PageSourceSearch

https://getvsble.com/assets/Index-OLKsQbRt.js

js getvsble.com collected 2026-10-09 04:53:00 UTC 120,672 bytes, 258 lines download raw bytes

1import{d as Ze,H as ne,r as n,j as e,D as X,e as J,a7 as re,f as te,T as Re,g as ve,a8 as oe,B as k,a9 as V,L as K,aa as Ce,s as $,t as E,b as Xe,G as Te,ab as xt,ac as Zt,ad as Xt,ae as Jt,af as ye,c as O,a3 as Ne,a4 as Se,a6 as _e,ag as ke,ah as Qt,u as le,ai as gt,aj as ft,ak as pt,P as Ge,al as es,am as ts,an as ss,ao as as,R as rs,S as Me,C as ns,q as bt,X as Je,ap as vt,aq as is,ar as jt,as as os,at as ls,au as nt,av as wt,N as it,aw as cs,Q as ds,U as us,x as Ee,w as ms,v as hs,a as xs,ax as gs,ay as fs,az as ps,$ as bs}from"./index-ByYYWl6V.js";import{S as We}from"./skeleton-Dgkec9Dl.js";import{L as Ue}from"./label-Dast61oh.js";import{S as vs}from"./shield-check-B0UX5bny.js";import{T as Fe}from"./trash-2-250o4KTP.js";import{C as yt}from"./circle-check-DOzaU1SH.js";import{B as je}from"./badge-DuSeH5ON.js";import{D as Qe,a as et,b as tt,c as ae,d as js}from"./dropdown-menu-BZRKspBv.js";import{S as Nt,a as St,b as _t,c as Ct,d as Le}from"./select-B7Jb7eSA.js";import{f as ws}from"./format-relative-time-C2tafYUB.js";import{P as Ke}from"./plus-CwyWY8pM.js";import{E as ys}from"./ellipsis-CAg5Wdfa.js";import{P as Ns}from"./pencil-B-pqnzl9.js";import{S as ze}from"./separator-DYEmDTsQ.js";import{S as Ss,a as _s}from"./sheet-ke76V1vr.js";import{P as Cs}from"./panel-left-MR5e7au6.js";import{A as ks,a as Ds}from"./avatar-DfyiTc_8.js";import{N as ot}from"./new-badge-lkBGkPWm.js";import{L as As}from"./languages-Da3cfIiy.js";import{L as Es}from"./layout-grid-_L0PwbdX.js";import{I as Pe}from"./info-CA6lfwP8.js";import{B as kt,a as Ps,b as Is}from"./BookingEmbedAnimation-DScsYcVC.js";import{I as Dt,D as Ts,P as Ls}from"./PaymentsAnimation-2UXFYxXS.js";import{A as zs}from"./AiMonitorDemoAnimation-CdBbjFGN.js";import{T as $s}from"./trending-up-CoVlDfmF.js";import{T as Ms}from"./trending-down-E8r6sk-M.js";import{P as Us,p as Rs,n as Fs,A as Os,B as Bs,a as Vs,T as Gs,D as Ws}from"./DnsChangeBanner-wbakL5py.js";import{A as At,a as Et,b as Pt,c as It,d as Tt,e as Lt,f as zt,g as $t}from"./alert-dialog-Cm0yc26w.js";import{t as st}from"./triggerBrowserDownload-BPysCpKo.js";import{C as Ks}from"./circle-check-big-Dep-aQzF.js";import{D as at}from"./download-BCb29Zdu.js";import{C as Mt}from"./clock-CUm8QZGC.js";import{i as lt}from"./supabase-functions-CBdNz-q5.js";import{C as Ut}from"./crown-B0tqQyDv.js";import{E as Rt}from"./shield-alert-DaLDabRa.js";import{E as Ft}from"./eye-BhPuToFK.js";import{C as Hs}from"./chevron-left-yeSSr-Cv.js";import{C as qs}from"./chevron-right-X_hlXzqd.js";import{d as Ie,e as Ys}from"./website-helpers-Bkym8S9-.js";import{F as Zs}from"./FeatureUpgradeModal-CX-W5enu.js";import"./index-CnBNeFET.js";import"./circle-DcpkfI2n.js";import"./chevron-up-DJ99KL3C.js";import"./en-US-D0KhEKBm.js";import"./index-C4Lchjjk.js";import"./calendar-DY8QzU4v.js";import"./map-pin-54GgpTKZ.js";import"./link-2-C5arFvZC.js";import"./progress-BNcERlIT.js";import"./radio-group-Dj8DJm3J.js";import"./external-link-CECnRthk.js";import"./useAioCredits-DXWFt562.js";import"./brain-BHfXUzQi.js";import"./tabs-DWXE4Edw.js";import"./pricing-feature-data--sJ_fBAR.js";import"./fs-feature-seed-D9E3VAKP.js";/* empty css                    */import"./user-DZPeHrpM.js";import"./settings-Cp6SvoNk.js";import"./zap-D0Cx9orD.js";import"./use-posthog-analytics-6Qqrf_m9.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Xs=Ze("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Js=Ze("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Qs=Ze("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function ea({open:t,onOpenChange:s,onConfirm:r,siteName:i,isExtraWebsite:l,extraCost:a,currency:d}){const{t:o}=ne(),[m,h]=n.useState(1),[u,j]=n.useState(!1),[C,D]=n.useState(""),[N,S]=n.useState(""),T=d==="USD"?"$":"€";n.useEffect(()=>{t&&(h(1),j(!1),D(""),S(""))},[t]);const P=C===i,f=N==="DELETE",x=P&&f,p=async()=>{j(!0);try{await r(),s(!1)}finally{j(!1)}},L=()=>e.jsx("div",{className:"flex items-center justify-center gap-2 pb-2",children:[1,2,3].map(b=>e.jsx("div",{className:`h-2 w-2 rounded-full transition-colors ${b===m?"bg-destructive":b<m?"bg-destructive/40":"bg-muted-foreground
16/20"}`},b))});return e.jsx(X,{open:t,onOpenChange:s,children:e.jsxs(J,{className:"sm:max-w-md",children:[e.jsx(L,{}),m===1&&e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(te,{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-5 w-5 text-destructive"}),o("dashboard.deleteDialog.title")]}),e.jsx(ve,{className:"pt-1",children:o("dashboard.deleteDialog.description",{siteName:i})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-foreground space-y-2",children:[e.jsx("p",{className:"font-medium",children:o("dashboard.deleteDialog.whatRemoved")}),e.jsxs("ul",{className:"list-disc list-inside text-muted-foreground space-y-1 text-[13px]",children:[e.jsx("li",{children:o("dashboard.deleteDialog.allPages")}),e.jsx("li",{children:o("dashboard.deleteDialog.uploadedImages")}),e.jsx("li",{children:o("dashboard.deleteDialog.customDomain")}),e.jsx("li",{children:o("dashboard.deleteDialog.analyticsContacts")})]})]}),l&&a>0&&e.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-4 text-sm text-muted-foreground",children:o("dashboard.deleteDialog.extraCharge",{amount:`${T}${a}`})})]}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>s(!1),children:o("common.cancel")}),e.jsx(k,{variant:"destructive",onClick:()=>h(2),children:o("common.continue")})]})]}),m===2&&e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(te,{className:"flex items-center gap-2",children:[e.jsx(vs,{className:"h-5 w-5 text-destructive"}),o("dashboard.deleteDialog.confirmByTyping")]}),e.jsx(ve,{className:"pt-1",children:o("dashboard.deleteDialog.typeInstructions")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ue,{htmlFor:"confirm-name",className:"text-xs text-muted-foreground",children:[o("dashboard.deleteDialog.typeWebsiteName")," ",e.jsx("span",{className:"font-mono font-semibold text-foreground",children:i})]}),e.jsx(V,{id:"confirm-name",value:C,onChange:b=>D(b.target.value),placeholder:i,autoComplete:"off",className:P?"border-green-500/50 focus-visible:ring-green-500/30":""})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ue,{htmlFor:"confirm-delete",className:"text-xs text-muted-foreground",children:o("dashboard.deleteDialog.typeDelete")}),e.jsx(V,{id:"confirm-delete",value:N,onChange:b=>S(b.target.value),placeholder:"DELETE",autoComplete:"off",className:f?"border-green-500/50 focus-visible:ring-green-500/30":""})]})]}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>h(1),children:o("common.back")}),e.jsx(k,{variant:"destructive",disabled:!x,onClick:()=>h(3),children:o("common.continue")})]})]}),m===3&&e.jsxs(e.Fragment,{children:[e.jsx(re,{children:e.jsxs(te,{className:"flex items-center gap-2",children:[e.jsx(Fe,{className:"h-5 w-5 text-destructive"}),o("dashboard.deleteDialog.finalConfirmation")]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-foreground",children:e.jsx("p",{children:o("dashboard.deleteDialog.permanentDelete",{siteName:i})})}),l&&a>0&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border bg-muted/30 p-4 text-sm text-muted-foreground",children:[e.jsx(yt,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),e.jsx("span",{children:o("dashboard.deleteDialog.monthlyChargeRemoved",{amount:`${T}${a}`})})]})]}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>h(2),disabled:u,children:o("common.back")}),e.jsxs(k,{variant:"destructive",onClick:p,disabled:u,children:[u&&e.jsx(K,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),o(u?"common.deleting":"dashboard.deleteDialog.deleteWebsite")]})]})]})]})})}function ta({open:t,onOpenChange:s,siteName:r,siteId:i,onDelete:l}){const{t:a}=ne(),[d,o]=n.useState(null),m=async()=>{o("portal");try{const{data:u,error:j}=await $.functions.invoke("customer-portal");if(j||u!=null&&u.error)throw new Error((j==null?void 0:j.message)||(u==null?void 0:u.error));u!=null&&u.url&&window.open(u.url,"_blank")}catch(u){E({title:a("common.error"),description:u.message,variant:"destructive"})}finally{o(null)}},h=async()=>{o("delete");try{await(l==null?void 0:l(i)),s(!1)}finally{o(null)}};return e.jsx(X,{open:t,onOpenChange:s,children:e.jsxs(J,{className:"sm:max-w-md",children:[e.jsxs(re,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-5 w-5 text-destructive"}),e.jsx(te,{children:a("dashboard.paymentFailed.title")})]}),e.jsx(ve,{className:"pt-2",children:a("dashboard.paymentFailed.description",{siteName:r})})]}),e.jsxs(oe,{className:"flex-col sm:flex-row gap-2 pt-2",children:[e.jsxs(k,{variant:"outline",onClick:h,disabled:!!d,className:"text-destructive hover:text-destructive",children:[d==="delete"?e.jsx(K,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Fe,{className:"mr-2 h-4 w-4"}),a("dashboard.paymentFailed.deleteWebsite")]}),e.jsxs(k,{onClick:m,disabled:!!d,children:[d==="portal"?e.jsx(K,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Ce,{className:"mr-2 h-4 w-4"}),a("dashboard.paymentFailed.updatePayment")]})]})]})})}function sa({sites:t,onCreateSite:s,onDeleteSite:r,onRestoreSite:i,onDuplicateSite:l,onRenameSite:a,onSiteClick:d,onSelectPlan:o,searchQuery:m,planName:h,subscriptionStatus:u="free",mode:j,includedWebsites:C=0,totalWebsites:D=0,extraWebsiteCost:N=0,extraPaymentFailed:S=!1,subscriptionUnpaid:T=!1,outstandingInvoiceUrl:P=null}){var rt;const f=Xe(),{t:x}=ne(),[p,L]=n.useState(!1),[b,I]=n.useState(""),[B,G]=n.useState(!1),[M,z]=n.useState(null),[c,F]=n.useState("created"),[R,_]=n.useState(null),[W,me]=n.useState(!1),[Q,he]=n.useState(null),[ie,ce]=n.useState(""),[ee,De]=n.useState(!1),[se,be]=n.useState(null),[xe,ge]=n.useState(""),[de,Ae]=n.useState(!1),Y=j==="archive",g=t.length===0&&!m.trim()&&!Y,y=n.useMemo(()=>
16{if(!S||C<=0)return new Set;const w=[...t].reverse(),q=new Set;return w.slice(C).forEach(Z=>q.add(Z.id)),q},[t,C,S]),v=async()=>{if(!(!b.trim()||B)){G(!0);try{await(s==null?void 0:s(b.trim())),I(""),L(!1)}finally{G(!1)}}},A=async()=>{if(!(!Q||!ie.trim()||ee)){De(!0);try{await(l==null?void 0:l(Q.id,ie.trim())),he(null),ce("")}finally{De(!1)}}},U=async()=>{if(!(!se||!xe.trim()||de)){Ae(!0);try{await(a==null?void 0:a(se.id,xe.trim())),be(null),ge("")}finally{Ae(!1)}}},H=n.useMemo(()=>{let w=t;if(m.trim()){const q=m.toLowerCase();w=w.filter(Z=>Z.name.toLowerCase().includes(q)||Z.domain&&Z.domain.toLowerCase().includes(q))}return Y||(c==="name"?w=[...w].sort((q,Z)=>q.name.localeCompare(Z.name)):c==="lastUpdated"&&(w=[...w].sort((q,Z)=>{const Be=q.lastContentUpdate||"";return(Z.lastContentUpdate||"").localeCompare(Be)}))),w},[t,m,c,Y]),we=w=>{if(w)return{label:x("dashboard.sitesList.paymentFailed"),className:"bg-destructive/15 text-destructive border-destructive/20"};switch(u){case"trialing":return{label:`${h??"Plan"} ${x("dashboard.sitesList.planTrial").replace("Plan ","")}`,className:"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/20"};case"active":return{label:h??x("dashboard.sitesList.active"),className:"bg-green-500 text-white dark:text-white border-green-500"};case"canceled":return{label:`${h??"Plan"} ${x("dashboard.sitesList.planCanceled").replace("Plan ","")}`,className:"bg-destructive/15 text-destructive border-destructive/20"};case"expired":return{label:x("dashboard.sitesList.expired"),className:"bg-muted text-muted-foreground border-border"};case"payment_pending":return{label:"Payment outstanding",className:"bg-muted text-muted-foreground border-border"};case"payment_failed":return{label:`${h??"Plan"} – ${x("dashboard.sitesList.paymentFailed")}`,className:"bg-destructive/15 text-destructive border-destructive/20"};case"unpaid":return{label:x("dashboard.sitesList.unpaidOffline"),className:"bg-destructive text-destructive-foreground border-destructive cursor-pointer hover:opacity-90 transition-opacity"};default:return{label:x("dashboard.sitesList.selectPlan"),className:"bg-blue-500/15 text-blue-600 dark:text-blue-400 border-blue-500/20 cursor-pointer hover:bg-blue-500/25 transition-colors"}}};return e.jsxs("div",{className:"p-6 lg:p-8",children:[g?e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4",children:[e.jsx(Te,{className:"h-12 w-12 text-muted-foreground/30"}),e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:x("dashboard.sitesList.noWebsitesYet")}),e.jsxs(k,{size:"lg",onClick:()=>L(!0),children:[e.jsx(Ke,{className:"mr-2 h-4 w-4"}),x("dashboard.sitesList.newWebsite")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:x(Y?"dashboard.sidebar.archive":"dashboard.sidebar.myWebsites")}),!Y&&u!=="free"&&u!=="loading"&&C>0&&e.jsx("span",{className:"text-sm text-muted-foreground font-medium",children:D>C?`${D} ${x("dashboard.sitesList.websites")} (${D-C} extra)`:`${D}${x("dashboard.sitesList.includedWebsites",{count:C})}`})]}),!Y&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Nt,{value:c,onValueChange:w=>F(w),children:[e.jsx(St,{className:"h-8 w-[140px] sm:w-[170px] text-xs",children:e.jsx(_t,{})}),e.jsxs(Ct,{children:[e.jsx(Le,{value:"created",children:x("dashboard.sitesList.dateCreated")}),e.jsx(Le,{value:"lastUpdated",children:x("dashboard.sitesList.lastUpdated")}),e.jsx(Le,{value:"name",children:x("dashboard.sitesList.name")})]})]}),e.jsxs(k,{size:"sm",className:"h-8 text-xs",onClick:()=>L(!0),children:[e.jsx(Ke,{className:"mr-1 h-3.5 w-3.5"}),x("dashboard.sitesList.newWebsite")]})]})]}),H.length===0&&e.jsx("p",{className:"text-center text-sm text-muted-foreground py-12",children:m.trim()?x("dashboard.sitesList.noProjectsMatch"):x(Y?"dashboard.sitesList.noArchived":"dashboard.sitesList.noProjectsYet")}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:H.map(w=>{const q=S&&y.has(w.id),Z=we(q),Be=u==="free"||u==="unpaid"||q;return e.jsxs("div",{className:"group relative flex flex-col overflow-hidden rounded-xl border border-border bg-card transition-all hover:shadow-md",children:[Y?e.jsx("div",{className:"relative w-full",children:w.screenshotUrl?e.jsx("img",{src:w.screenshotUrl,alt:w.name,className:"w-full object-cover opacity-50 grayscale",style:{aspectRatio:"36 / 25"},loading:"lazy"}):e.jsx("div",{className:"flex w-full items-center justify-center bg-muted",style:{aspectRatio:"36 / 25"}
16,children:e.jsx(Te,{className:"h-8 w-8 text-muted-foreground/20"})})}):e.jsxs("div",{className:"relative w-full",children:[e.jsx("button",{onClick:()=>{if(q){_(w);return}d?d(w.id):f(`/sites/${w.id}`)},className:"block w-full",children:w.screenshotUrl?e.jsx("img",{src:w.screenshotUrl,alt:w.name,className:`w-full object-cover ${q?"opacity-50 grayscale":""}`,style:{aspectRatio:"36 / 25"},loading:"lazy"}):e.jsx("div",{className:`flex w-full items-center justify-center bg-muted ${q?"opacity-50":""}`,style:{aspectRatio:"36 / 25"},children:e.jsx(Te,{className:`h-8 w-8 ${q?"text-muted-foreground/20":"text-muted-foreground/40"}`})})}),u==="loading"?e.jsx(We,{className:"absolute top-2 right-2 h-5 w-16 rounded-full pointer-events-none"}):e.jsx(je,{variant:"outline",className:`absolute top-2 right-2 max-w-[calc(100%-1rem)] truncate whitespace-nowrap text-[10px] px-1.5 py-0 h-5 font-medium uppercase shadow-sm ${Be?"":"pointer-events-none"} ${Z.className}`,onClick:u==="free"?ue=>{ue.stopPropagation(),o==null||o()}:u==="unpaid"?ue=>{ue.stopPropagation(),me(!0)}:q?ue=>{ue.stopPropagation(),_(w)}:void 0,children:Z.label})]}),e.jsxs("div",{className:"flex items-center justify-between p-3",children:[e.jsxs("div",{className:"flex flex-1 flex-col text-left min-w-0",children:[e.jsx("h3",{className:"text-sm font-medium text-card-foreground truncate",children:w.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-0.5",children:[e.jsx("span",{children:ws(w.lastContentUpdate||w.screenshotCapturedAt)||x("dashboard.sitesList.justCreated")}),(w.imageCount??0)>0&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(xt,{className:"h-3 w-3"}),w.imageCount]})]})]}),e.jsx("div",{className:"flex items-center shrink-0 ml-2",children:e.jsxs(Qe,{children:[e.jsx(et,{asChild:!0,children:e.jsx("button",{onClick:ue=>ue.stopPropagation(),className:"rounded-md p-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors opacity-100 md:opacity-0 md:group-hover:opacity-100",children:e.jsx(ys,{className:"h-4 w-4"})})}),e.jsx(tt,{align:"end",children:Y?e.jsxs(ae,{onClick:()=>i==null?void 0:i(w.id),children:[e.jsx(Xs,{className:"mr-2 h-3.5 w-3.5"}),x("dashboard.sitesList.restore")]}):e.jsxs(e.Fragment,{children:[a&&e.jsxs(ae,{onClick:()=>{be(w),ge(w.name)},children:[e.jsx(Ns,{className:"mr-2 h-3.5 w-3.5"}),x("dashboard.sitesList.rename")||"Rename"]}),l&&e.jsxs(ae,{onClick:()=>{he(w),ce(`${w.name}${x("dashboard.sitesList.copySuffix")}`)},children:[e.jsx(Zt,{className:"mr-2 h-3.5 w-3.5"}),x("dashboard.sitesList.duplicate")]}),r&&e.jsxs(ae,{onClick:()=>z(w.id),className:"text-destructive focus:text-destructive",children:[e.jsx(Fe,{className:"mr-2 h-3.5 w-3.5"}),x("common.delete")]})]})})]})})]})]},w.id)})})]}),!Y&&e.jsxs(e.Fragment,{children:[e.jsx(X,{open:p,onOpenChange:L,children:e.jsxs(J,{className:"sm:max-w-sm",children:[e.jsx(re,{children:e.jsx(te,{children:x("dashboard.sitesList.createNewWebsite")})}),e.jsx("div",{className:"py-2",children:e.jsx(V,{placeholder:x("dashboard.sitesList.websiteName"),value:b,onChange:w=>I(w.target.value),onKeyDown:w=>w.key==="Enter"&&v(),disabled:B,autoFocus:!0})}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>L(!1),disabled:B,children:x("common.cancel")}),e.jsxs(k,{onClick:v,disabled:!b.trim()||B,children:[B&&e.jsx(K,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),x(B?"common.creating":"common.create")]})]})]})}),e.jsx(X,{open:!!Q,onOpenChange:w=>{!w&&!ee&&(he(null),ce(""))},children:e.jsxs(J,{className:"sm:max-w-sm",children:[e.jsx(re,{children:e.jsx(te,{children:x("dashboard.sitesList.duplicateWebsite")})}),e.jsx("div",{className:"py-2",children:e.jsx(V,{placeholder:x("dashboard.sitesList.websiteName"),value:ie,onChange:w=>ce(w.target.value),onKeyDown:w=>w.key==="Enter"&&A(),disabled:ee,autoFocus:!0})}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>{he(null),ce("")},disabled:ee,children:x("common.cancel")}),e.jsxs(k,{onClick:A,disabled:!ie.trim()||ee,children:[ee&&e.jsx(K,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),x(ee?"dashboard.sitesList.duplicating":"dashboard.sitesList.duplicate")]})]})]})}),e.jsx(X,{open:!!se,onOpenChange:w=>{!w&&!de&&(be(null),ge(""))},children:e.jsxs(J,{className:"sm:max-w-sm",children:[e.jsx(re,{children:e.jsx(te,{children:x("dashboard.sitesList.renameTitle")||"Rename website"})}),e.jsxs("div",{className:"py-2 space-y-2",children:[e.jsx(V,{placeholder:x("dashboard.sitesList.websiteName"),value:xe,onChange:w=>ge(w.target.value),onKeyDown:w=>w.key==="Enter"&&U(),disabled:de,autoFocus:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:x("dashboard.sitesList.renameHint")||"Only the display name changes. Your website URL and logo stay the same."})]}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>{be(null),ge("")},disabled:de,children:x("common.cancel")}),e.jsxs(k,{onClick:U,disabled:!xe.trim()||de||xe.trim()===(se==null?void 0:se.name),children:[de&&e.jsx(K,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),x("common.save")||"Save"]})]})]})}),e.jsx(ea,{open:!!M,onOpenChange:w=>{w||z(null)},onConfirm:async()=>{M&&(await r(M),z(null))},siteName:((rt=t.find(w=>w.id===M))==null?void 0:rt.name)||"this website",isExtraWebsite:D>C,extraCost:N,currency:"EUR"}),e.jsx(ta,{open:!!R,onOpenChange:w=>{w||_(null)},siteName:(R==null?void 0:R.name)||"",siteId:(R==null?void 0:R.id)||"",onDelete:w=>{r==null||r(w),_(null)}}),e.jsx(Xt,{open:W,onOpenChange:me,outstandingInvoiceUrl:P})]})]})}const aa="sidebar:state",ra=60*60*24*7,na="16rem",ia="18rem",oa="3rem",la="b",Ot=n.createContext(null);function Oe(){const t=n.useContext(Ot);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const Bt=n.forwardRef(({defaultOpen:t=!0,open:s,onOpenChange:r,className:i,style:l,children:a,...d},o)=>{const m=Jt(),[h,u]=n.useState(!1),[j,C]=n.useState(t),D=s??j,N=n.useCallback(f=>{const x=typeof f=="function"?f(D):f;r?r(x):C(x),document.cookie=`${aa}=${x}; path=/; max-age=${ra}`},[r,D]),S=n.useCallback(()=>m?u(f=>!f):N(f=>!f),[m,N,u]);n.useEffect(()=>{const f=x=>
16{x.key===la&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),S())};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[S]);const T=D?"expanded":"collapsed",P=n.useMemo(()=>({state:T,open:D,setOpen:N,isMobile:m,openMobile:h,setOpenMobile:u,toggleSidebar:S}),[T,D,N,m,h,u,S]);return e.jsx(Ot.Provider,{value:P,children:e.jsx(ye,{delayDuration:0,children:e.jsx("div",{style:{"--sidebar-width":na,"--sidebar-width-icon":oa,...l},className:O("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",i),ref:o,...d,children:a})})})});Bt.displayName="SidebarProvider";const Vt=n.forwardRef(({side:t="left",variant:s="sidebar",collapsible:r="offcanvas",className:i,children:l,...a},d)=>{const{isMobile:o,state:m,openMobile:h,setOpenMobile:u}=Oe();return r==="none"?e.jsx("div",{className:O("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",i),ref:d,...a,children:l}):o?e.jsx(Ss,{open:h,onOpenChange:u,...a,children:e.jsx(_s,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":ia},side:t,children:e.jsx("div",{className:"flex h-full w-full flex-col",children:l})})}):e.jsxs("div",{ref:d,className:"group peer hidden text-sidebar-foreground md:block","data-state":m,"data-collapsible":m==="collapsed"?r:"","data-variant":s,"data-side":t,children:[e.jsx("div",{className:O("relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),e.jsx("div",{className:O("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",i),...a,children:e.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:l})})]})});Vt.displayName="Sidebar";const Gt=n.forwardRef(({className:t,onClick:s,...r},i)=>{const{toggleSidebar:l}=Oe();return e.jsxs(k,{ref:i,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:O("h-7 w-7",t),onClick:a=>{s==null||s(a),l()},...r,children:[e.jsx(Cs,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Gt.displayName="SidebarTrigger";const ca=n.forwardRef(({className:t,...s},r)=>{const{toggleSidebar:i}=Oe();return e.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:i,title:"Toggle Sidebar",className:O("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 hover:after:bg-sidebar-border sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...s})});ca.displayName="SidebarRail";const da=n.forwardRef(({className:t,...s},r)=>e.jsx("main",{ref:r,className:O("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-
16h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",t),...s}));da.displayName="SidebarInset";const Wt=n.forwardRef(({className:t,...s},r)=>e.jsx(V,{ref:r,"data-sidebar":"input",className:O("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",t),...s}));Wt.displayName="SidebarInput";const Kt=n.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"header",className:O("flex flex-col gap-2 p-2",t),...s}));Kt.displayName="SidebarHeader";const ua=n.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"footer",className:O("flex flex-col gap-2 p-2",t),...s}));ua.displayName="SidebarFooter";const Ht=n.forwardRef(({className:t,...s},r)=>e.jsx(ze,{ref:r,"data-sidebar":"separator",className:O("mx-2 w-auto bg-sidebar-border",t),...s}));Ht.displayName="SidebarSeparator";const qt=n.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"content",className:O("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s}));qt.displayName="SidebarContent";const $e=n.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"group",className:O("relative flex w-full min-w-0 flex-col p-2",t),...s}));$e.displayName="SidebarGroup";const He=n.forwardRef(({className:t,asChild:s=!1,...r},i)=>{const l=s?ke:"div";return e.jsx(l,{ref:i,"data-sidebar":"group-label",className:O("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...r})});He.displayName="SidebarGroupLabel";const ma=n.forwardRef(({className:t,asChild:s=!1,...r},i)=>{const l=s?ke:"button";return e.jsx(l,{ref:i,"data-sidebar":"group-action",className:O("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",t),...r})});ma.displayName="SidebarGroupAction";const qe=n.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"group-content",className:O("w-full text-sm",t),...s}));qe.displayName="SidebarGroupContent";const Ye=n.forwardRef(({className:t,...s},r)=>e.jsx("ul",{ref:r,"data-sidebar":"menu",className:O("flex w-full min-w-0 flex-col gap-1",t),...s}));Ye.displayName="SidebarMenu";const fe=n.forwardRef(({className:t,...s},r)=>e.jsx("li",{ref:r,"data-sidebar":"menu-item",className:O("group/menu-item relative",t),...s}));fe.displayName="SidebarMenuItem";const ha=Qt("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),pe=n.forwardRef(({asChild:t=!1,isActive:s=!1,variant:r="default",size:i="default",tooltip:l,className:a,...d},o)=>{const m=t?ke:"button",{isMobile:h,state:u}=Oe(),j=e.jsx(m,{ref:o,"data-sidebar":"menu-button","data-size":i,"data-active":s,className:O(ha({variant:r,size:i}),a),...d});return l?(typeof l=="string"&&(l={children:l}),e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,children:j}),e.jsx(_e,{side:"right",align:"center",hidden:u!=="collapsed"||h,...l})]})):j});pe.displayName="SidebarMenuButton";const xa=n.forwardRef(({className:t,asChild:s=!1,showOnHover:r=!1,...i},l)=>{const a=s?ke:"button";return e.jsx(a,{ref:l,"data-sidebar":"menu-action",className:O("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",t),...i})});xa.displayName="SidebarMenuAction";const ga=n.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:O("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...s}));ga.displayName="SidebarMenuBadge";const fa=n.forwardRef(({className:t,showIcon:s=!1,...r},i)=>{const l=n.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return e.jsxs("div",{ref:i,"data-sidebar":"menu-skeleton",className:O("flex h-8 items-center gap-2 rounded-md px-2",t),...r,children:[s&&e.jsx(We,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),e.jsx(We,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":l}})]})});fa.displayName="SidebarMenuSkeleton";const pa=n.forwardRef(({className:t,...s},r)=>e.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:O("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...s}));pa.displayName="SidebarMenuSub";const ba=n.forwardRef(({...t},s)=>e.jsx("li",{ref:s,...t}));ba.displayName="SidebarMenuSubItem";const va=n.forwardRef(({asChild:t=!1,size:s="md",isActive:r,className:i,...l},a)=>{const d=t?ke:"a";return e.jsx(d,{ref:a,"data-sidebar":"menu-sub-button","data-size":s,"data-active":r,className:O("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",s==="sm"&&"text-xs",s==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",i),...l})});va.displayName="SidebarMenuSubButton";function ja({searchQuery:t,onSearchChange:s,activeView:r,onViewChange:i,accountSection:l,onAccountSectionChange:a}){const{user:d,signOut:o}=le(),{t:m}=ne(),h=Xe(),{gatedAction:u}=gt(),j=ft(),C=Object.values(j).some(P=>P.active),N=((d==null?void 0:d.email)||"").split("@")[0]||"User",S=N.charAt(0).toUpperCase()+N.slice(1),T=S.charAt(0).toUpperCase();return e.jsxs(Vt,{collapsible:"offcanvas",children:[e.jsx(Kt,{className:"p-4",children:e.jsxs(Qe,{children:[e.jsx(et,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md p-1 hover:bg-sidebar-accent transition-colors text-left",children:[e.jsx(ks,{className:"h-7 w-7",children:e.jsx(Ds,{className:"bg-primary text-primary-foreground text-xs font-semibold",children:T})}),e.jsxs("span",{className:"flex-1 truncate text-sm font-semibold tracking-tight",children:[S,"'s Workspace"]}),e.jsx(pt,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}),e.jsxs(tt,{align:"start",className:"w-56",children:[e.jsxs(ae,{onClick:()=>{a==null||a("account"),i("account")},"data-active":r==="account"&&l==="account"?"":void 0,children:[e.jsx(As,{className:"h-4 w-4 mr-2"}),"Account & Language"]}),e.jsxs(ae,{onClick:()=>{a==null||a("billing"),i("account")},"data-active":r==="account"&&l==="billing"?"":void 0,children:[e.jsx(Ce,{className:"h-4 w-4 mr-2"}),"Billing & Plans"]}),e.jsxs(ae,{onClick:()=>{a==null||a("legal"),i("account")},"data-active":r==="account"&&l==="legal"?"":void 0,children:[e.jsx(Ge,{className:"h-4 w-4 mr-2"}),"Legal / DPA"]}),e.jsx(js,{}),e.jsxs(ae,{onClick:()=>o(),children:[e.jsx(es,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]})}),e.jsxs(qt,{children:[e.jsx($e,{className:"px-4 py-2",children:e.jsx(Wt,{placeholder:m("
16common.search"),value:t,onChange:P=>s(P.target.value)})}),e.jsxs($e,{children:[e.jsx(He,{children:"Websites"}),e.jsx(qe,{children:e.jsxs(Ye,{children:[e.jsx(fe,{children:e.jsxs(pe,{tooltip:m("dashboard.sidebar.myWebsites"),onClick:()=>i("all"),"data-active":r==="all"?"":void 0,children:[e.jsx(Es,{className:"h-4 w-4"}),e.jsx("span",{children:m("dashboard.sidebar.myWebsites")})]})}),e.jsx(fe,{children:e.jsxs(pe,{tooltip:m("dashboard.sidebar.archive"),onClick:()=>i("archive"),"data-active":r==="archive"?"":void 0,children:[e.jsx(Js,{className:"h-4 w-4"}),e.jsx("span",{children:m("dashboard.sidebar.archive")})]})})]})})]}),C&&e.jsxs(e.Fragment,{children:[e.jsx(Ht,{}),e.jsxs($e,{children:[e.jsx(He,{children:"Tools"}),e.jsx(qe,{children:e.jsxs(Ye,{children:[j.file_sharing.active&&e.jsx(fe,{children:e.jsxs(pe,{tooltip:"Backup & Collaboration",onClick:()=>h("/file-sharing"),children:[e.jsx(ts,{className:"h-4 w-4"}),e.jsx("span",{children:"Backup & Collaboration"}),e.jsx(ye,{children:e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,onClick:P=>P.stopPropagation(),children:e.jsx(Pe,{className:"h-3.5 w-3.5 ml-auto text-muted-foreground hover:text-foreground transition-colors cursor-help"})}),e.jsx(_e,{side:"right",className:"max-w-[220px]",children:"Backup, file-sharing, culling, collaboration and presentation in one place"})]})})]})}),j.aio.active&&e.jsx(fe,{children:e.jsxs(pe,{tooltip:"Brand AI Monitor",onClick:()=>h("/aio"),children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx("span",{children:"Brand AI Monitor"}),e.jsx(ye,{children:e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,onClick:P=>P.stopPropagation(),children:e.jsx(Pe,{className:"h-3.5 w-3.5 ml-auto text-muted-foreground hover:text-foreground transition-colors cursor-help"})}),e.jsx(_e,{side:"right",className:"max-w-[220px]",children:"Monitor your brand visibility across LLM's like ChatGPT, Gemini & Perplexity and get actionable insight to improve it"})]})})]})}),j.calendar.active&&e.jsx(fe,{children:e.jsxs(pe,{tooltip:"Calendar",onClick:()=>h("/booking"),children:[e.jsx(as,{className:"h-4 w-4"}),e.jsx("span",{children:"Calendar"}),e.jsx(ot,{className:"ml-1"}),e.jsx(ye,{children:e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,onClick:P=>P.stopPropagation(),children:e.jsx(Pe,{className:"h-3.5 w-3.5 ml-auto text-muted-foreground hover:text-foreground transition-colors cursor-help"})}),e.jsx(_e,{side:"right",className:"max-w-[220px]",children:"A built in Calendly alternative — schedule meetings with a public booking page and automatic calendar sync."})]})})]})}),j.invoicing.active&&e.jsx(fe,{children:e.jsxs(pe,{tooltip:"Invoicing",onClick:()=>u("invoicing",()=>h("/invoicing"),"Invoicing"),children:[e.jsx(rs,{className:"h-4 w-4"}),e.jsx("span",{children:"Invoicing"}),e.jsx(ot,{className:"ml-1"}),e.jsx(ye,{children:e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,onClick:P=>P.stopPropagation(),children:e.jsx(Pe,{className:"h-3.5 w-3.5 ml-auto text-muted-foreground hover:text-foreground transition-colors cursor-help"})}),e.jsx(_e,{side:"right",className:"max-w-[220px]",children:"Create invoices, send PDFs and run automated dunning reminders. Connect your own Stripe or PayPal for payments."})]})})]})})]})})]})]})]})]})}function ct({children:t,searchQuery:s,onSearchChange:r,activeView:i,onViewChange:l,accountSection:a,onAccountSectionChange:d}){return e.jsx(Bt,{defaultOpen:!0,children:e.jsxs("div",{className:"flex min-h-screen w-full",children:[e.jsx(ja,{searchQuery:s,onSearchChange:r,activeView:i,onViewChange:l,accountSection:a,onAccountSectionChange:d}),e.jsxs("main",{className:"flex-1 overflow-auto",children:[e.jsx("div",{className:"md:hidden flex items-center p-4 border-b border-border",children:e.jsx(Gt,{})}),t]})]})})}const dt=[[{name:"Your brand",score:41,you:!0,trend:"up"},{name:"competitor-a.com",score:68,trend:"down"},{name:"competitor-b.com",score:55,trend:"up"},{name:"competitor-c.com",score:33,trend:"down"}],[{name:"Your brand",score:74,you:!0,trend:"up"},{name:"competitor-a.com",score:61,trend:"down"},{name:"competitor-b.com",score:52,trend:"down"},{name:"competitor-c.com",score:30,trend:"down"}]];function Yt(){const[t,s]=n.useState(0);n.useEffect(()=>{const i=setInterval(()=>s(l=>(l+1)%dt.length),2600);return()=>clearInterval(i)},[]);const r=[...dt[t]].sort((i,l)=>l.score-i.score);return e.jsxs("div",{className:"relative w-full overflow-hidden rounded-xl bg-background/95 p-4 select-none",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("p",{className:"text-[11px] font-semibold tracking-tight text-foreground",children:"Share of AI voice"}),e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[9px] font-medium text-muted-foreground",children:"last 30 days"})]}),e.jsx("div",{className:"space-y-2",children:r.map(i=>e.jsxs("div",{className:"flex items-center gap-2 transition-all duration-700 ease-out",children:[e.jsx("span",{className:`w-[86px] shrink-0 truncate text-[10px] ${i.you?"font-bold text-foreground":"text-muted-foreground"}`,children:i.name}),e.jsx("div",{className:"h-2.5 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-1000 ease-out",style:{width:`${i.score}%`,backgroundColor:i.you?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.35)"}})}),e.jsxs("span",{className:"flex w-[42px] shrink-0 items-center justify-end gap-1 text-[10px] font-semibold text-foreground",children:[i.score,"%",i.trend==="up"?e.jsx($s,{size:10,
16className:"text-emerald-500"}):e.jsx(Ms,{size:10,className:"text-muted-foreground"})]})]},i.name))}),e.jsx("p",{className:"mt-3 text-[10px] text-muted-foreground",children:"Tracked weekly across ChatGPT, Gemini & Perplexity."})]})}const ut=["Add an FAQ answering “best photographer in Berlin”","Publish a pricing page — AI models cite prices","Get listed on 3 local directories","Add schema markup to your services page"];function wa(){const[t,s]=n.useState(0);return n.useEffect(()=>{const r=setInterval(()=>s(i=>(i+1)%(ut.length+2)),900);return()=>clearInterval(r)},[]),e.jsxs("div",{className:"relative w-full overflow-hidden rounded-xl bg-background/95 p-4 select-none",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-1.5",children:[e.jsx(Me,{size:12,className:"text-primary"}),e.jsx("p",{className:"text-[11px] font-semibold tracking-tight text-foreground",children:"Actionable suggestions"})]}),e.jsx("div",{className:"space-y-2",children:ut.map((r,i)=>{const l=t>i,a=t>i+1;return e.jsxs("div",{className:"flex items-start gap-2 rounded-lg bg-muted/70 px-2.5 py-2 transition-all duration-500 ease-out",style:{opacity:l?1:0,transform:l?"translateY(0)":"translateY(10px)"},children:[e.jsx("span",{className:"mt-[1px] flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300",style:{borderColor:a?"hsl(var(--primary))":"hsl(var(--muted-foreground) / 0.4)",backgroundColor:a?"hsl(var(--primary))":"transparent"},children:a&&e.jsx(ns,{size:9,className:"text-primary-foreground",strokeWidth:3})}),e.jsx("span",{className:`text-[10px] leading-snug ${a?"text-muted-foreground line-through":"text-foreground"}`,children:r})]},r)})}),e.jsx("p",{className:"mt-3 text-[10px] text-muted-foreground",children:"Prioritised by impact on your AI visibility."})]})}function ya({kind:t,onClose:s}){const{subscription:r,user:i}=le(),l=bt(),[a,d]=n.useState(!1),[o,m]=n.useState(0),[h,u]=n.useState(null),j=t?vt[t]:null,C=t==="calendar",D=t==="file_sharing",N=t==="invoicing",S=t==="aio",T=C||D||N||S;n.useEffect(()=>{if(!T)return;const b=setInterval(()=>m(I=>(I+1)%3),5e3);return()=>clearInterval(b)},[T]);const P=[kt,Ps,Is],f=[{type:"video",src:"https://getvsble.com/videos/PIKD_-_Senden_Sie_Fotos_und_Videos_in_beeindruckenden_kundengere.mp4"},{type:"image",src:"https://r2.landing.govsble.com/landing-media/61080f30-6c1c-4b76-ab53-a0c605d4bd87.jpeg"},{type:"video",src:"https://r2.landing.govsble.com/landing-media/2930af23-64bd-4871-8682-00bbfa45ee46.mp4"}],x=[zs,Yt,wa],p=[Dt,Ts,Ls],L=async()=>{var I,B;if(!t)return;d(!0);const b=Rs();try{const G=r.interval==="yearly"?"yearly":"monthly",{data:M,error:z}=await $.functions.invoke("create-checkout",{body:{priceId:is[t][l][G],product:t,currency:l}}),c=(M==null?void 0:M.error)||(z==null?void 0:z.message);if(c==="included_in_builder_plan"||c==="already_subscribed"){(I=b==null?void 0:b.close)==null||I.call(b),E({title:"This tool is already included in your plan."}),s();return}if(z||M!=null&&M.error)throw(B=b==null?void 0:b.close)==null||B.call(b),new Error(c||"Checkout failed");M!=null&&M.url&&Fs(b,M.url)==="blocked"&&u(M.url)}catch(G){jt(G,{source:"AddonTeaserModal",action:`activate-${t}`,userId:i==null?void 0:i.id,email:i==null?void 0:i.email}),E({title:"Could not start checkout",description:(G==null?void 0:G.message)??"Please try again.",variant:"destructive"})}finally{d(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(X,{open:!!t,onOpenChange:b=>!b&&s(),children:e.jsx(J,{className:"max-w-[420px] gap-0 overflow-hidden rounded-2xl border-0 p-0 [&>button.absolute]:hidden",children:j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative aspect-[4/3] w-full overflow-hidden bg-neutral-900",children:[C&&P.map((b,I)=>e.jsx("div",{className:`absolute inset-0 flex items-center justify-center p-4 transition-opacity duration-500 ${o===I?"opacity-100":"pointer-events-none opacity-0"}`,children:e.jsx("div",{className:"w-full max-w-[320px]",children:e.jsx(b,{})})},I)),N&&p.map((b,I)=>e.jsx("div",{className:`absolute inset-0 flex items-center justify-center p-2 transition-opacity duration-500 ${o===I?"opacity-100":"pointer-events-none opacity-0"}`,children:e.jsx("div",{className:"w-full max-w-[360px]",children:e.jsx(b,{})})},I)),S&&x.map((b,I)=>e.jsx("div",{className:`absolute inset-0 flex items-center justify-center p-3 transition-opacity duration-500 ${o===I?"opacity-100":"pointer-events-none opacity-0"}`,children:e.jsx("div",{className:"w-full max-w-[340px]",children:e.jsx(b,{})})},I)),D&&f.map((b,I)=>e.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-500 ${o===I?"opacity-100":"pointer-events-none opacity-0"}`,children:b.type==="video"?e.jsx("video",{src:b.src,autoPlay:!0,loop:!0,muted:!0,playsInl
16ine:!0,className:"h-full w-full object-cover"}):e.jsx("img",{src:b.src,alt:`File Sharing preview ${I+1}`,className:"h-full w-full object-cover"})},I)),e.jsx("button",{type:"button",onClick:s,"aria-label":"Close",className:"absolute right-3 top-3 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",children:e.jsx(Je,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"bg-white px-6 pb-6 pt-5 text-center",children:[e.jsx(te,{className:"text-[19px] font-bold leading-snug tracking-tight text-neutral-900",children:j.headline}),e.jsx(ve,{className:"mt-2 text-sm leading-relaxed text-neutral-500",children:j.subline}),e.jsx("div",{className:"mt-5 flex items-center justify-center gap-1.5",children:[0,1,2].map(b=>e.jsx("button",{type:"button","aria-label":`Slide ${b+1}`,onClick:()=>m(b),className:`h-1.5 rounded-full transition-all ${o===b?"w-4 bg-neutral-900":"w-1.5 bg-neutral-300"}`},b))}),e.jsxs("button",{type:"button",disabled:a,onClick:L,className:"mt-5 flex w-full items-center justify-center gap-2 rounded-lg bg-neutral-900 px-4 py-3 text-sm font-semibold text-white transition-colors hover:bg-neutral-800 disabled:opacity-60",children:[a&&e.jsx(K,{className:"h-4 w-4 animate-spin"}),"Activate ",j.name]})]})]})})}),e.jsx(Us,{url:h,onClose:()=>u(null)})]})}const Na={calendar:kt,invoicing:Dt,aio:Yt};function Sa(){const t=ft(),[s,r]=n.useState(null),i=os.filter(l=>!t[l].active);return i.length===0?null:e.jsxs("div",{className:"mt-10 border-t border-border pt-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold tracking-tight text-muted-foreground",children:"Discover"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-4",children:i.map(l=>{const a=vt[l],d=a.icon,o=Na[l];return e.jsxs("div",{className:"flex h-full flex-col overflow-hidden rounded-xl border border-border bg-card transition-shadow hover:shadow-sm",children:[e.jsx("div",{className:"relative aspect-video w-full overflow-hidden bg-muted",children:a.previewImage?e.jsx("img",{src:a.previewImage,alt:`${a.name} preview`,loading:"lazy",className:"h-full w-full object-cover"}):o?e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-muted to-muted/50",children:e.jsx("div",{className:"absolute left-1/2 top-1/2 w-[300px] -translate-x-1/2 -translate-y-1/2 scale-[0.62] origin-center",children:e.jsx(o,{})})}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-to-br from-muted to-muted/60",children:e.jsx(d,{className:"h-8 w-8 text-muted-foreground/40"})})}),e.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.jsx(d,{className:"h-5 w-5 text-foreground"}),e.jsx("h3",{className:"mt-3 text-sm font-semibold tracking-tight text-foreground",children:a.name}),e.jsx("p",{className:"mt-1 mb-4 text-xs leading-relaxed text-muted-foreground",children:a.cardDesc}),e.jsx("button",{type:"button",onClick:()=>r(l),className:"mt-auto w-full rounded-lg border border-border py-2 text-xs font-semibold text-foreground transition-colors hover:bg-muted",children:"See it"})]})]},l)})}),e.jsx(ya,{kind:s,onClose:()=>r(null)})]})}const _a="Der Anbieter setzt angemessene technische und organisatorische Maßnahmen ein, insbesondere in den Bereichen Zugriffsschutz (Multi-Faktor-Authentifizierung, rollenbasierte Berechtigungen), Verschlüsselung (TLS 1.2+ für Datenübertragung, AES-256 für gespeicherte Daten), Verfügbarkeit (redundante Infrastruktur, automatische Backups), Trennung von Kundendaten (logische Mandantentrennung), Protokollierung (Zugriffs- und Änderungsprotokolle) und Sicherheitsmanagement (regelmäßige Überprüfungen, Patch-Management).",Ca="The Provider implements appropriate technical and organizational measures, in particular regarding access control (multi-factor authentication, role-based permissions), encryption (TLS 1.2+ for data in transit, AES-256 for data at rest), availability (redundant infrastructure, automatic backups), segregation of customer data (logical tenant separation), logging (access and change logs) and security management (regular reviews, patch management).",ka=`| Name | Zweck | Standort |
17|------|-------|----------|
18| Hetzner Online GmbH | Hosting & Infrastruktur | Deutschland |
19| Supabase Inc. | Datenbank & Authentifizierung | EU (Frankfurt) |
20| Cloudflare Inc. | CDN & DDoS-Schutz | Global (EU-Verarbeitung) |
21| Stripe Inc. | Zahlungsabwicklung | EU / USA |`,Da=`| Name | Purpose | Location |
22|------|---------|----------|
23| Hetzner Online GmbH | Hosting & Infrastructure | Germany |
24| Supabase Inc. | Database & Authentication | EU (Frankfurt) |
25| Cloudflare Inc. | CDN & DDoS Protection | Global (EU processing) |
26| Stripe Inc. | Payment Processing | EU / USA |`,Aa="Vsble Website Builder, Vsble File Sharing, Vsble AI Tools",Ea="Name, E-Mail-Adresse, IP-Adresse, Bilddateien, Kontaktformulardaten",Pa="Name, email address, IP address, image files, contact form data",Ia="Endkunden, Website-Besucher, Kontaktpersonen",Ta="End customers, website visitors, contact persons";function La(t){return`Auftragsverarbeitungsvertrag (AVV) gemäß Art. 28 DSGVO
27
28Zwischen
29Artbrief UG (haftungsbeschränkt), Urbanstraße 71, 3. Hof, 4. TRH, 10967 Berlin, Deutschland
30– nachfolgend „Anbieter" oder „Auftragsverarbeiter" –
31
32und
33
34${t.customer_legal_name}
35${t.customer_legal_form}
36${t.customer_street}
37${t.customer_postal_code} ${t.customer_city}
38${t.customer_country}
39vertreten durch ${t.customer_authorized_representative}
40E-Mail: ${t.customer_email}${t.customer_vat_id?`
41USt-IdNr.: ${t.customer_vat_id}`:""}
42– nachfolgend „Kunde" oder „Verantwortlicher" –
43
44
451. Gegenstand
46
47Der Anbieter verarbeitet personenbezogene Daten im Auftrag des Kunden, soweit dies für die Bereitstellung der vom Kunden genutzten Online-Dienstleistungen von Vsble erforderlich ist.
48
492. Dauer
50
51Dieser Vertrag gilt ab Abschluss bis zum Ende der Nutzung der vertragsgegenständlichen Dienste, soweit der Anbieter personenbezogene Daten im Auftrag des Kunden verarbeitet.
52
533. Art und Zweck der Verarbeitung
54
55Die Verarbeitung umfasst insbesondere das Speichern, Hosten, Organisieren, Bereitstellen, Übermitteln, Anzeigen und Löschen personenbezogener Daten zur Erbringung der vom Kunden genutzten Vsble-Dienste.
56
574. Kategorien von Daten und betroffenen Personen
58
59Die Kategorien personenbezogener Daten, die Kategorien betroffener Personen sowie die vom Vertrag erfassten Dienste ergeben sich aus Anhang A.
60
615. Weisungen
62
63Der Anbieter verarbeitet personenbezogene Daten nur auf dokumentierte Weisung des Kunden, einschließlich der Nutzungseinstellungen, Freigaben, Uploads, Löschungen und sonstigen Aktionen des Kunden innerhalb der Dienste.
64
656. Vertraulichkeit
66
67Der Anbieter stellt sicher, dass alle zur Datenverarbeitung befugten Personen auf Vertraulichkeit verpflichtet sind oder einer angemessenen gesetzlichen Verschwiegenheitspflicht unterliegen.
68
697. Sicherheit
70
71Der Anbieter trifft angemessene technische und organisatorische Maßnahmen gemäß Art. 32 DSGVO. Die zum Zeitpunkt des Abschlusses geltenden Maßnahmen ergeben sich aus Anhang B.
72
738. Unterauftragsverarbeiter
74
75Der Kunde erteilt eine allgemeine Genehmigung zur Einschaltung von Unterauftragsverarbeitern. Die aktuell eingesetzten Unterauftragsverarbeiter ergeben sich aus Anhang C. Über wesentliche Änderungen wird der Kunde informiert.
76
779. Unterstützung
78
79Der Anbieter unterstützt den Kunden im angemessenen Umfang bei:
80- Anfragen betroffener Personen,
81- Sicherheitsvorfällen,
82- Datenschutz-Folgenabschätzungen,
83- sonstigen Pflichten nach Art. 32 bis 36 DSGVO,
84soweit dies die vom Anbieter im Auftrag verarbeiteten Daten betrifft und dem Anbieter möglich ist.
85
8610. Löschung oder Rückgabe
87
88Nach Ende der Auftragsverarbeitung wird der Anbieter personenbezogene Daten nach Wahl des Kunden löschen oder zurückgeben, soweit keine gesetzliche Aufbewahrungspflicht oder technisch notwendige Restaufbewahrung besteht.
89
9011. Nachweise
91
92Der Anbieter stellt dem Kunden auf Anfrage die Informationen zur Verfügung, die erforderlich sind, um die Einhaltung dieses Vertrags und von Art. 28 DSGVO nachzuweisen. Der Anbieter kann geeignete Nachweise auch durch aktuelle Berichte, Zertifikate oder vergleichbare Dokumentationen erbringen.
93
9412. Eigene Verantwortlichkeit des Anbieters
95
96Soweit der Anbieter personenbezogene Daten für eigene Zwecke verarbeitet, insbesondere für Abrechnung, Sicherheit, Missbrauchsprävention, rechtliche Pflichten oder Vertragsadministration, erfolgt dies nicht als Auftragsverarbeiter, sondern in eigener Verantwortlichkeit.
97
9813. Elektronischer Abschluss
99
100Dieser Vertrag kann elektronisch abgeschlossen werden. Der elektronische Abschluss, einschließlich Protokollierung von Zeitstempel, Vertragsversion, Nutzerkennung, E-Mail-Adresse, IP-Adresse und User-Agent, gilt als Nachweis des Vertragsschlusses. Der Kunde kann eine PDF-Fassung herunterladen.
101
10214. Schlussbestimmungen
103
104Es gilt deutsches Recht. Gerichtsstand, soweit zulässig, ist Hamburg. Im Übrigen gelten die zwingenden datenschutzrechtlichen Vorschriften.
105
106
107─────────────────────────────────────────────────
108Anhang A – Vertragsgegenstand
109
110Erfasste Dienste: ${t.services_list}
111
112Kategorien personenbezogener Daten: ${t.data_categories}
113
114Kategorien betroffener Personen: ${t.data_subject_categories}
115
116
117─────────────────────────────────────────────────
118Anhang B – Technische und organisatorische Maßnahmen
119
120Der Anbieter setzt angemessene technische und organisatorische Maßnahmen ein, insbesondere in den Bereichen Zugriffsschutz, Berechtigungsmanagement, Übertragungssicherheit, Verfügbarkeit, Backup, Trennung von Kundendaten, Protokollierung und Sicherheitsmanagement.
121
122${t.toms_summary}
123
124
125─────────────────────────────────────────────────
126Anhang C – Unterauftragsverarbeiter
127
128${t.subprocessors_table}
129
130
131─────────────────────────────────────────────────
132Elektronischer Abschlussvermerk
133
134Vertrags-ID: ${t.agreement_id||"–"}
135Version: ${t.dpa_version||"–"}
136Abgeschlossen am: ${t.accepted_at_local||"–"}
137Bestätigende Person: ${t.signer_name||"–"}
138E-Mail: ${t.signer_email||"–"}
139IP-Adresse: ${t.signer_ip||"–"}
140GeoIP-Land: ${t.signer_geoip_country||"–"}
141User-Agent: ${t.signer_user_agent||"–"}
142Dokumenten-Hash: ${t.document_checksum||"–"}`}function za(t){return`Data Processing Agreement (DPA) pursuant to Art. 28 GDPR
143
144Between
145Artbrief UG (haftungsbeschränkt), Urbanstraße 71, 3. Hof, 4. TRH, 10967 Berlin, Germany
146– hereinafter "Provider" or "Processor" –
147
148and
149
150${t.customer_legal_name}
151${t.customer_legal_form}
152${t.customer_street}
153${t.customer_postal_code} ${t.customer_city}
154${t.customer_country}
155represented by ${t.customer_authorized_representative}
156Email: ${t.customer_email}${t.customer_vat_id?`
157VAT ID: ${t.customer_vat_id}`:""}
158– hereinafter "Customer" or "Controller" –
159
160
1611. Subject Matter
162
163The Provider processes personal data on behalf of the Customer insofar as required to provide the Vsble online services used by the Customer.
164
1652. Term
166
167This Agreement applies from the time of conclusion until the end of the Customer's use of the relevant services, insofar as the Provider processes personal data on behalf of the Customer.
168
1693. Nature and Purpose of Processing
170
171Processing may include in particular the storage, hosting, organization, provision, transmission, display and deletion of personal data for the purpose of providing the Vsble services used by the Customer.
172
1734. Categories of Data and Data Subjects
174
175The categories of personal data, categories of data subjects, and the services covered by this Agreement are set out in Annex A.
176
1775. Instructions
178
179The Provider shall process personal data only on documented instructions from the Customer, including the Customer's settings, permissions, uploads, deleti
179ons and other actions within the services.
180
1816. Confidentiality
182
183The Provider shall ensure that all persons authorized to process personal data are bound by confidentiality or are under an appropriate statutory obligation of confidentiality.
184
1857. Security
186
187The Provider shall implement appropriate technical and organizational measures pursuant to Art. 32 GDPR. The measures applicable at the time of conclusion are set out in Annex B.
188
1898. Sub-processors
190
191The Customer grants a general authorization for the engagement of sub-processors. The current sub-processors are listed in Annex C. The Customer will be informed of material changes.
192
1939. Assistance
194
195The Provider shall assist the Customer, to a reasonable extent, with:
196- data subject requests,
197- personal data breaches,
198- data protection impact assessments,
199- other obligations under Art. 32 to 36 GDPR,
200insofar as these relate to the personal data processed by the Provider on behalf of the Customer and insofar as such assistance is possible.
201
20210. Deletion or Return
203
204At the end of the processing services, the Provider shall, at the Customer's choice, delete or return personal data unless statutory retention obligations or technically necessary residual storage apply.
205
20611. Demonstration of Compliance
207
208Upon request, the Provider shall make available to the Customer the information necessary to demonstrate compliance with this Agreement and Art. 28 GDPR. The Provider may provide such evidence through current reports, certifications or similar documentation.
209
21012. Provider's Own Controller Activities
211
212Where the Provider processes personal data for its own purposes, including billing, security, abuse prevention, legal compliance or contract administration, such processing is not carried out as a processor but under the Provider's own responsibility as controller.
213
21413. Electronic Conclusion
215
216This Agreement may be concluded electronically. Electronic conclusion, including logging of timestamp, contract version, user identifier, email address, IP address and user agent, shall serve as evidence of conclusion. The Customer may download a PDF copy.
217
21814. Final Provisions
219
220German law shall apply. To the extent permitted by law, place of jurisdiction shall be Berlin, Germany. Mandatory data protection law remains unaffected.
221
222
223─────────────────────────────────────────────────
224Annex A – Scope
225
226Covered services: ${t.services_list}
227
228Categories of personal data: ${t.data_categories}
229
230Categories of data subjects: ${t.data_subject_categories}
231
232
233─────────────────────────────────────────────────
234Annex B – Technical and Organizational Measures
235
236The Provider implements appropriate technical and organizational measures, in particular regarding access control, authorization management, transmission security, availability, backups, segregation of customer data, logging and security management.
237
238${t.toms_summary}
239
240
241─────────────────────────────────────────────────
242Annex C – Sub-processors
243
244${t.subprocessors_table}
245
246
247─────────────────────────────────────────────────
248Electronic Conclusion Record
249
250Agreement ID: ${t.agreement_id||"–"}
251Version: ${t.dpa_version||"–"}
252Concluded on: ${t.accepted_at_local||"–"}
253Confirming person: ${t.signer_name||"–"}
254Email: ${t.signer_email||"–"}
255IP address: ${t.signer_ip||"–"}
256GeoIP country: ${t.signer_geoip_country||"–"}
257User agent: ${t.signer_user_agent||"–"}
258Document hash: ${t.document_checksum||"–"}`}function $a({open:t,onOpenChange:s,locale:r,onComplete:i}){const{user:l}=le(),a=r==="de",[d,o]=n.useState(1),[m,h]=n.useState(!1),[u,j]=n.useState(!1),[C,D]=n.useState(!1),[N,S]=n.useState(null),[T,P]=n.useState(!1),[f,x]=n.useState({customer_legal_name:"",customer_legal_form:"",customer_street:"",customer_postal_code:"",customer_city:"",customer_country:"",customer_authorized_representative:"",customer_email:(l==null?void 0:l.email)||"",customer_vat_id:"",services_list:Aa,data_categories:a?Ea:Pa,data_subject_categories:a?Ia:Ta}),p=(c,F)=>x(R=>({...R,[c]:F})),L={...f,toms_summary:a?_a:Ca,subprocessors_table:a?ka:Da},b=a?La(L):za(L),I=f.customer_legal_name.trim()&&f.customer_legal_form.trim()&&f.customer_street.trim()&&f.customer_postal_code.trim()&&f.customer_city.trim()&&f.customer_country.trim()&&f.customer_authorized_representative.trim()&&f.customer_email.trim(),B=async()=>{if(!(!u||!C)){h(!0);try{const{data:c,error:F}=await $.functions.invoke("conclude-dpa",{body:{action:"conclude",dpa_language:a?"de":"en",customer_data:{legal_name:f.customer_legal_name,legal_form:f.customer_legal_form,street:f.customer_street,postal_code:f.customer_postal_code,city:f.customer_city,country:f.customer_country,authorized_representative:f.customer_authorized_representative,email:f.customer_email,vat_id:f.customer_vat_id},services_list:f.services_list,data_categories:f.data_categories,data_subject_categories:f.data_subject_categories}});if(F)throw new Error(F.message);if(c!=null&&c.error)throw new Error(c.error);S({agreement_id:c.agreement_id,dpa_version:c.dpa_version,accepted_at_local:c.accepted_at_local}),o(4),i()}catch(c){E({title:a?"Fehler":"Error",description:c instanceof Error?c.message:"Unknown error",variant:"destructive"})}finally{h(!1)}}},G=async()=>{if(N){P(!0);try{const{data:c,error:F}=await $.functions.invoke("conclude-dpa",{body:{action:"download",agreement_id:N.agreement_id}});if(F)throw new Error(F.message);if(c!=null&&c.error)throw new Error(c.error);if(c!=null&&c.url){const R=await fetch(c.url);if(!R.ok)throw new Error("Download failed");const _=await R.blob();st(_,`DPA_${N.dpa_version}_${N.agreement_id.slice(0,8)}.pdf`)}}catch(c){E({title:a?"Fehler":"Error",description:c instanceof Error?c.message:"Unknown error",variant:"destructive"})}finally{P(!1)}}},M=()=>{s(!1),setTimeout(()=>{o(1),j(!1),D(!1),S(null)},300)},z=(c,F)=>a?c:F;return e.jsx(X,{open:t,onOpenChange:M,children:e.jsxs(J,{className:"max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs(re,{children:[e.jsxs(te,{children:[d===1&&z("Unternehmensdaten","Company Details"),d===2&&z("Vertrag prüfen","Review Agreement"),d===3&&z("Vertrag abschließen","Conclude Agreement"),d===4&&z("Vertrag abgeschlossen","Agreement Concluded")]}),d<4&&e.jsx("div",{className:"flex gap-1 pt-2",children:[1,2,3].map(c=>e.jsx("div",{className:`h-1 flex-1 rounded-full ${c<=d?"bg-primary":"bg-muted"}`},c))})]}),d===1&&e.jsx(ls,{className:"flex-1 pr-4 -mr-4",children:e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Firmenname *","Company Name *")}),e.jsx(V,{value:f.customer_legal_name,onChange:c=>p("customer_legal_name",c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Rechtsform *","Legal Form *")}),e.jsx(V,{value:f.customer_legal_form,onChange:c=>p("customer_legal_form",c.target.value),placeholder:a?"z.B. GmbH":"e.g. LLC"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Straße *","Street *")}),e.jsx(V,{value:f.customer_street,onChange:c=>p("customer_street",c.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("PLZ *","Postal Code *")}),e.jsx(V,{value:f.customer_postal_code,onChange:c=>p("customer_postal_code",c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Stadt *","City *")}),e.jsx(V,{value:f.customer_city,onChange:c=>p("customer_city",c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Land *","Country *")}),e.jsx(V,{value:f.customer_country,onChange:c=>p("customer_country",c.target.value)})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Vertretungsberechtigte Person *","Authorized Representative *")}),e.jsx(V,{value:f.customer_authorized_representative,onChange:c=>p("customer_authorized_representative",c.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("E-Mail *","Email *")}),e.jsx(V,{value:f.customer_email,onChange:c=>p("customer_email",c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("USt-IdNr. (optional)","VAT ID (optional)")}),e.jsx(V,{value:f.customer_vat_id,onChange:c=>p("customer_vat_id",c.target.value)})]})]}),e.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium",children:z("Verarbeitungsdetails","Processing Details")}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Genutzte Dienste","Services 
258Used")}),e.jsx(V,{value:f.services_list,onChange:c=>p("services_list",c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Kategorien personenbezogener Daten","Categories of Personal Data")}),e.jsx(V,{value:f.data_categories,onChange:c=>p("data_categories",c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:z("Kategorien betroffener Personen","Categories of Data Subjects")}),e.jsx(V,{value:f.data_subject_categories,onChange:c=>p("data_subject_categories",c.target.value)})]})]})]})}),d===2&&e.jsx("div",{className:"flex-1 overflow-y-auto max-h-[50vh] pr-4 -mr-4 border rounded-md border-border p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap text-xs leading-relaxed font-mono text-foreground/90",children:b})}),d===3&&e.jsxs("div",{className:"flex-1 space-y-6 py-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a?"Bitte bestätigen Sie die folgenden Punkte, um den Vertrag rechtsverbindlich abzuschließen.":"Please confirm the following to conclude the agreement in a legally binding manner."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx(nt,{checked:u,onCheckedChange:c=>j(c===!0),className:"mt-0.5"}),e.jsx("span",{className:"text-sm",children:a?"Ich schließe den AVV in der angezeigten Fassung rechtsverbindlich ab.":"I conclude the DPA in the displayed version in a legally binding way."})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx(nt,{checked:C,onCheckedChange:c=>D(c===!0),className:"mt-0.5"}),e.jsx("span",{className:"text-sm",children:a?"Ich bestätige, dass ich zum Abschluss dieses Vertrags berechtigt bin.":"I confirm that I am authorized to enter into this agreement."})]})]})]}),d===4&&N&&e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-8 space-y-6",children:[e.jsx(Ks,{className:"h-12 w-12 text-green-500"}),e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("h3",{className:"text-lg font-semibold",children:a?"Vertrag erfolgreich abgeschlossen":"Agreement successfully concluded"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a?"Vertrags-ID":"Agreement ID",": ",N.agreement_id.slice(0,8),"…"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Version","
258: ",N.dpa_version]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a?"Abgeschlossen am":"Concluded on",": ",N.accepted_at_local]})]}),e.jsxs(k,{onClick:G,disabled:T,className:"gap-2",children:[T?e.jsx(K,{className:"h-4 w-4 animate-spin"}):e.jsx(at,{className:"h-4 w-4"}),T?a?"Wird heruntergeladen…":"Downloading…":a?"PDF herunterladen":"Download PDF"]})]}),d<4&&e.jsxs("div",{className:"flex justify-between pt-4 border-t border-border",children:[d>1?e.jsxs(k,{variant:"ghost",onClick:()=>o(d-1),className:"gap-1",children:[e.jsx(wt,{className:"h-4 w-4"}),a?"Zurück":"Back"]}):e.jsx("div",{}),d===1&&e.jsxs(k,{onClick:()=>o(2),disabled:!I,className:"gap-1",children:[a?"Vertrag prüfen":"Review Agreement",e.jsx(it,{className:"h-4 w-4"})]}),d===2&&e.jsxs(k,{onClick:()=>o(3),className:"gap-1",children:[a?"Weiter zum Abschluss":"Proceed to Conclude",e.jsx(it,{className:"h-4 w-4"})]}),d===3&&e.jsx(k,{onClick:B,disabled:!u||!C||m,className:"gap-1 bg-green-600 hover:bg-green-700 text-white",children:m?e.jsx(K,{className:"h-4 w-4 animate-spin"}):a?"AVV jetzt abschließen":"Conclude DPA now"})]}),d===4&&e.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:e.jsx(k,{variant:"secondary",onClick:M,children:a?"Schließen":"Close"})})]})})}function Ma({agreements:t,onRefresh:s}){const{t:r,locale:i}=ne(),[l,a]=n.useState(null),d=async m=>{a(m.id);try{const{data:h,error:u}=await $.functions.invoke("conclude-dpa",{body:{action:"download",agreement_id:m.id}});if(u)throw new Error(u.message);if(h!=null&&h.error)throw new Error(h.error);if(h!=null&&h.url){const j=await fetch(h.url);if(!j.ok)throw new Error("Download failed");const C=await j.blob();st(C,`DPA_${m.dpa_version}_${m.id.slice(0,8)}.pdf`),s()}}catch(h){E({title:i==="de"?"Fehler beim Download":"Download failed",description:h instanceof Error?h.message:"Unknown error",variant:"destructive"})}finally{a(null)}};if(t.length===0)return null;const o=m=>{const h=new Date(m);return i==="de"?h.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}):h.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:i==="de"?"Vertragshistorie":"Agreement History"}),e.jsx("div",{className:"rounded-lg border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-muted/50 text-left",children:[e.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Version"}),e.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:i==="de"?"Sprache":"Language"}),e.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:"Status"}),e.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground",children:i==="de"?"Datum":"Date"}),e.jsx("th",{className:"px-3 py-2 font-medium text-muted-foreground"})]})}),e.jsx("tbody",{children:t.map(m=>e.jsxs("tr",{className:"border-t border-border",children:[e.jsx("td",{className:"px-3 py-2.5 font-mono text-xs",children:m.dpa_version}),e.jsx("td",{className:"px-3 py-2.5",children:m.dpa_language==="de"?"🇩🇪 DE":"🇬🇧 EN"}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx(je,{variant:m.status==="active"?"default":"secondary",className:"text-xs",children:m.status==="active"?i==="de"?"Aktiv":"Active":i==="de"?"Ersetzt":"Superseded"})}),e.jsx("td",{className:"px-3 py-2.5 text-muted-foreground",children:o(m.accepted_at)}),e.jsx("td",{className:"px-3 py-2.5 text-right",children:e.jsx(k,{size:"sm",variant:"ghost",onClick:()=>d(m),disabled:l===m.id,children:l===m.id?e.jsx(K,{className:"h-4 w-4 animate-spin"}):e.jsx(at,{className:"h-4 w-4"})})})]},m.id))})]})})]})}function Ua(){const{user:t}=le(),{locale:s}=ne(),r=s==="de",[i,l]=n.useState([]),[a,d]=n.useState(!0),[o,m]=n.useState(!1),h=async()=>{if(!t)return;const{data:N}=await $.from("dpa_agreements").select("id, dpa_version, dpa_language, status, accepted_at, downloaded_at, signer_name").eq("user_id",t.id).order("accepted_at",{ascending:!1});l(N||[]),d(!1)};n.useEffect(()=>{h()},[t]);const u=i.find(N=>N.status==="active"),[j,C]=n.useState(null),D=async N=>{C(N);try{const{data:S,error:T}=await $.functions.invoke("conclude-dpa",{body:{action:"download",agreement_id:N}});if(T)throw new Error(T.message);if(S!=null&&S.error)throw new Error(S.error);if(S!=null&&S.url){const P=await fetch(S.url);if(!P.ok)throw new Error("Download failed");const f=await P.blob();st(f,`DPA_${N.slice(0,8)}.pdf`),h()}}catch(S){E({title:r?"Fehler beim Download":"Download failed",description:S instanceof Error?S.message:"Unknown error",variant:"destructive"})}finally{C(null)}};return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Ge,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:r?"Rechtliches / AVV":"Legal / DPA"})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 sm:p-5 space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:r?"Ein Auftragsverarbeitungsvertrag (AVV) regelt die Verarbeitung personenbezogener Daten gemäß Art. 28 DSGVO. Wenn Sie Vsble geschäftlich nutzen und personenbezogene Daten Dritter verarbeiten, können Sie hier Ihren AVV elektronisch abschließen.":"A Data Processing Agreement (DPA) governs the processing of personal data pursuant to Art. 28 GDPR. If you use Vsble for business purposes and process third-party personal data, you can conclude your DPA electronically here."}),a?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(K,{className:"h-4 w-4 animate-spin"}),r?"Laden…":"Loading…"]}):u?e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsx("div",{className:"flex-1 space-y-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{variant:"default",className:"text-xs",children:r?"Aktiv":"Active"}),e.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:u.dpa_version}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["• ",new Date(u.accepted_at).toLocaleDateString(r?"de-DE":"en-US")]})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(k,{size:"sm",variant:"outline",className:"gap-1.5",onClick:()=>D(u.id),disabled:j===u.id,children:[j===u.id?e.jsx(K,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(at,{className:"h-3.5 w-3.5"}),r?"PDF herunterladen":"Download PDF"]}),e.jsxs(k,{size:"sm",variant:"secondary",className:"gap-1.5",onClick:()=>m(!0),children:[e.jsx(Ke,{className:"h-3.5 w-3.5"}),r?"Neue Version":"New Version"]})]})]}):e.jsxs(k,{className:"bg-green-600 hover:bg-green-700 text-white gap-1.5",onClick:()=>m(!0),children:[e.jsx(Ge,{className:"h-4 w-4"}),r?"AVV abschließen":"Conclude DPA"]})]}),e.jsx(Ma,{agreements:i,onRefresh:h}),e.jsx($a,{open:o,onOpenChange:m,locale:r?"de":"en",onComplete:h})]})}function Ve(t,s){if(!t||!s)return"—";const r=String(t).padStart(2,"0"),i=String(s).slice(-2);return`${r}/${i}`}function mt(t,s){if(t==null||!s)return"—";try{return new Intl.NumberFormat(void 0,{style:"currency",currency:s.toUpperCase()}).format(t/100)}catch{return`${(t/100).toFixed(2)} ${s.toUpperCase()}`}}function Ra(t){if(!t)return"—";const s=typeof t=="number"?new Date(t*1e3):new Date(t);return isNaN(s.getTime())?"—":s.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function Fa({onManage:t,isManaging:s}){const{subscription:r}=le(),{t:i}=ne(),l=n.useMemo(()=>
258{if(!r.subscribed)return"none";if(r.paymentFailed)return"payment_failed";const u=r.paymentMethod;if(u!=null&&u.expMonth&&(u!=null&&u.expYear)){const j=new Date,C=new Date(u.expYear,u.expMonth,0),D=Math.floor((C.getTime()-j.getTime())/(1e3*60*60*24));if(D<0)return"expired";if(D<=60)return"expires_soon"}return"active"},[r]);if(!r.subscribed)return null;const a=r.paymentMethod,d=a!=null&&a.brand?a.brand.charAt(0).toUpperCase()+a.brand.slice(1):"Card",o=(a==null?void 0:a.last4)??"••••",h={active:{icon:e.jsx(yt,{className:"h-5 w-5"}),badgeClass:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20",badgeLabel:i("dashboard.account.cardStatus.activeBadge")||"Active",accent:"border-l-emerald-500",title:i("dashboard.account.cardStatus.activeTitle")||"Payment method active",description:i("dashboard.account.cardStatus.activeDesc")||`Next charge ${mt(r.nextChargeAmount,r.nextChargeCurrency)} on ${Ra(r.nextChargeAt)}.`,cta:i("dashboard.account.manageBilling")||"Manage billing"},expires_soon:{icon:e.jsx(Mt,{className:"h-5 w-5"}),badgeClass:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",badgeLabel:i("dashboard.account.cardStatus.expiresSoonBadge")||"Expires soon",accent:"border-l-amber-500",title:i("dashboard.account.cardStatus.expiresSoonTitle")||"Your card expires soon",description:i("dashboard.account.cardStatus.expiresSoonDesc")||`${d} •••• ${o} expires ${Ve((a==null?void 0:a.expMonth)??null,(a==null?void 0:a.expYear)??null)}. Update it to avoid interruption.`,cta:i("dashboard.account.cardStatus.updateCard")||"Update card"},expired:{icon:e.jsx(Re,{className:"h-5 w-5"}),badgeClass:"bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20",badgeLabel:i("dashboard.account.cardStatus.expiredBadge")||"Expired",accent:"border-l-orange-500",title:i("dashboard.account.cardStatus.expiredTitle")||"Your card has expired",description:i("dashboard.account.cardStatus.expiredDesc")||`${d} •••• ${o} expired ${Ve((a==null?void 0:a.expMonth)??null,(a==null?void 0:a.expYear)??null)}. Add a new card to keep your plan active.`,cta:i("dashboard.account.cardStatus.updateCard")||"Update card"},payment_failed:{icon:e.jsx(Qs,{className:"h-5 w-5"}),badgeClass:"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20",badgeLabel:i("dashboard.account.cardStatus.failedBadge")||"Payment failed",accent:"border-l-red-500",title:i("dashboard.account.cardStatus.failedTitle")||"Last payment failed",description:r.lastFailedInvoice?i("dashboard.account.cardStatus.failedDesc")||`${mt(r.lastFailedInvoice.amountDue,r.lastFailedInvoice.currency)} couldn't be charged to ${d} •••• ${o}. Settle now to avoid service interruption.`:i("dashboard.account.cardStatus.failedDescGeneric")||`We couldn't charge ${d} •••• ${o}. Settle now to avoid service interruption.`,cta:i("dashboard.account.cardStatus.settleNow")||"Settle now"}}[l];return e.jsx("div",{className:`rounded-lg border bg-card border-l-4 ${h.accent} p-4 sm:p-5 space-y-4`,children:e.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[e.jsx("div",{className:"mt-0.5 text-muted-foreground shrink-0",children:h.icon}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:h.title}),e.jsx(je,{variant:"outline",className:h.badgeClass,children:h.badgeLabel})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:h.description}),a&&e.jsxs("div",{className:"flex items-center gap-2 pt-1 text-xs text-muted-foreground",children:[e.jsx(Ce,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[d," •••• ",o," · ",i("dashboard.account.cardStatus.expires")||"Expires"," ",Ve(a.expMonth??null,a.expYear??null)]})]})]})]}),e.jsx(k,{size:"sm",variant:l==="payment_failed"||l==="expired"?"default":"outline",onClick:t,disabled:s,className:"shrink-0",children:h.cta})]})})}const Oa="https://getvsble.com/ltd?k=007fccca-fd84-4270-bebc-ced274aca00a",Ba=[{code:"price",label:"Price is too high"},{code:"features",label:"Missing features I need"},{code:"alternative",label:"Found a better alternative"},{code:"other",label:"Something else"}];function Va({open:t,onOpenChange:s}){const{user:r,signOut:i}=le(),[l,a]=n.useState("reason"),[d,o]=n.useState(null),[m,h]=n.useState(""),[u,j]=n.useState(null),[C,D]=n.useState(null),[N,S]=n.useState(!1),[T,P]=n.useState(""),[f,x]=n.useState(!1),p=n.useRef(!1);n.useEffect(()=>{t&&(p.current=!1,a("reason"),o(null),h(""),j(null),D(null),P(""),x(!1),S(!1))},[t]);const L=c=>
258{!c&&u&&!p.current&&(p.current=!0,$.from("account_deletion_attempts").update({outcome:"abandoned"}).eq("id",u).eq("outcome","started")),s(c)},b=async()=>{if(!(!d||!r)){if(d==="other"&&!m.trim()){E({title:"Please tell us a bit more",variant:"destructive"});return}S(!0);try{const{data:c,error:F}=await $.from("account_deletion_attempts").insert({user_id:r.id,reason_code:d,reason_text:m.trim()||null,outcome:"started"}).select("id").single();if(F)throw F;j(c.id),a(d==="other"?"ltd":"discount")}catch(c){E({title:"Could not start",description:(c==null?void 0:c.message)??String(c),variant:"destructive"})}finally{S(!1)}}},I=async()=>{S(!0);try{const{data:c,error:F}=await lt("apply-winback-discount",{body:{attempt_id:u}});if(F)throw new Error(F.message);const R=c==null?void 0:c.status;if(R==="applied"){const _=c.tier;D(_),E({title:_==="50_12"?"50% off applied for 12 months":"35% off applied for 6 months",description:"Discount is live on your next invoices."}),L(!1);return}if(R==="no_subscription"||R==="lifetime"){a("ltd"),E({title:"No active subscription to discount",description:"Check out our lifetime offer instead."});return}throw new Error((c==null?void 0:c.error)??"unknown")}catch(c){E({title:"Could not apply discount",description:(c==null?void 0:c.message)??String(c),variant:"destructive"})}finally{S(!1)}},B=async()=>{u&&$.from("account_deletion_attempts").update({outcome:"discount_declined"}).eq("id",u),a("ltd")},G=()=>{u&&$.from("account_deletion_attempts").update({outcome:"ltd_opened"}).eq("id",u);try{window.open(Oa,"_blank","noopener,noreferrer")}catch{}},M=async()=>{if(!(!(r!=null&&r.email)||!T.trim())){S(!0);try{const{error:c}=await $.auth.signInWithPassword({email:r.email,password:T.trim()});if(c){E({title:"Incorrect password. Please try again.",variant:"destructive"}),S(!1);return}u&&await $.from("account_deletion_attempts").update({outcome:"deleted"}).eq("id",u);const{data:F,error:R}=await lt("delete-account");if(R)throw new Error(R.message);if(F!=null&&F.error)throw new Error(F.error);p.current=!0,await i(),window.location.href="/"}catch(c){E({title:"Error",description:(c==null?void 0:c.message)??"Something went wrong",variant:"destructive"}),S(!1)}}},z=()=>{l==="discount"?a("reason"):l==="ltd"?a(d==="other"?"reason":"discount"):l==="confirm"&&a("ltd")};return e.jsx(X,{open:t,onOpenChange:L,children:e.jsxs(J,{className:"max-w-md p-0 overflow-hidden gap-0",children:[e.jsx("div",{className:"px-6 pt-6 pb-4 border-b",children:e.jsxs("div",{className:"flex items-center justify-between",children:[l!=="reason"&&l!=="confirm"?e.jsxs("button",{onClick:z,className:"text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1",children:[e.jsx(wt,{className:"h-3 w-3"})," Back"]}):e.jsx("span",{}),e.jsx(Ga,{step:l})]})}),e.jsxs("div",{className:"px-6 py-5",children:[l==="reason"&&e.jsx(Wa,{reason:d,setReason:o,reasonText:m,setReasonText:h}),l==="discount"&&e.jsx(Ka,{}),l==="ltd"&&e.jsx(Ha,{onOpenLtd:G}),l==="confirm"&&e.jsx(qa,{password:T,setPassword:P,showPwd:f,setShowPwd:x})]}),e.jsxs("div",{className:"px-6 pb-6 pt-2 flex gap-2 justify-end",children:[l==="reason"&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",size:"sm",onClick:()=>L(!1),children:"Cancel"}),e.jsxs(k,{size:"sm",onClick:b,disabled:N||!d||d==="other"&&!m.trim(),children:[N&&e.jsx(K,{className:"h-4 w-4 animate-spin mr-2"}),"Continue"]})]}),l==="discount"&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",size:"sm",onClick:B,disabled:N,children:"No thanks"}),e.jsxs(k,{size:"sm",onClick:I,disabled:N,children:[N&&e.jsx(K,{className:"h-4 w-4 animate-spin mr-2"}),"Yes — apply discount"]})]}),l==="ltd"&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",size:"sm",onClick:()=>a("confirm"),children:"No thanks, delete account"}),e.jsxs(k,{size:"sm",onClick:G,className:"bg-amber-500 hover:bg-amber-600 text-white",children:[e.jsx(Ut,{className:"h-4 w-4 mr-1.5"}),"View Lifetime Deal"]})]}),l==="confirm"&&e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",size:"sm",onClick:()=>L(!1),disabled:N,children:"Cancel"}),e.jsxs(k,{size:"sm",variant:"destructive",onClick:M,disabled:N||!T.trim(),children:[N&&e.jsx(K,{className:"h-4 w-4 animate-spin mr-2"}),"Delete my account"]})]})]})]})})}function Ga({step:t}){const s=["reason","discount","ltd","confirm"],r=s.indexOf(t);return e.jsx("div",{className:"flex items-center gap-1.5",children:s.map((i,l)=>e.jsx("span",{className:O("h-1.5 rounded-full transition-all",l===r?"bg-foreground w-6":l<r?"bg-foreground
258/60 w-1.5":"bg-foreground/15 w-1.5")},i))})}function Wa({reason:t,setReason:s,reasonText:r,setReasonText:i}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sorry to see you go"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Before we delete your account — what's the main reason?"})]}),e.jsx("div",{className:"space-y-2",children:Ba.map(l=>e.jsx("button",{type:"button",onClick:()=>s(l.code),className:O("w-full text-left text-sm px-3 py-2.5 rounded-lg border transition-colors",t===l.code?"border-foreground bg-foreground/5":"border-border hover:bg-muted/50"),children:l.label},l.code))}),t==="other"&&e.jsxs("div",{className:"space-y-1.5 pt-1",children:[e.jsx(Ue,{htmlFor:"reason-text",className:"text-xs text-muted-foreground",children:"Tell us more (required)"}),e.jsx(cs,{id:"reason-text",value:r,onChange:l=>i(l.target.value),rows:3,maxLength:500,placeholder:"What's missing for you?",className:"text-sm"})]})]})}function Ka(){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{className:"h-5 w-5 text-amber-500"}),e.jsx("h2",{className:"text-lg font-semibold",children:"Wait — here's an exclusive offer"})]}),e.jsxs("div",{className:"rounded-xl border bg-gradient-to-br from-amber-50 to-amber-100/40 dark:from-amber-950/30 dark:to-amber-900/10 p-4 space-y-2",children:[e.jsx("div",{className:"text-2xl font-bold text-amber-700 dark:text-amber-400",children:"Up to 50% off"}),e.jsx("p",{className:"text-sm text-foreground/80",children:"Stay with us and we'll cut your bill in half. The discount is applied instantly to your subscription — no payment details needed."}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 pt-1",children:[e.jsx("li",{children:"• Trial users: 50% off the next 12 months"}),e.jsx("li",{children:"• Paid subscribers: 35% off the next 6 months"})]})]})]})}function Ha({onOpenLtd:t}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ut,{className:"h-5 w-5 text-amber-500"}),e.jsx("h2",{className:"text-lg font-semibold",children:"One last thing — pay once, use forever"})]}),e.jsxs("div",{className:"rounded-xl border bg-gradient-to-br from-purple-50 to-amber-50 dark:from-purple-950/20 dark:to-amber-950/20 p-4 space-y-2",children:[e.jsx("div",{className:"text-base font-semibold",children:"Lifetime Deal"}),e.jsx("p",{className:"text-sm text-foreground/80",children:"Get lifetime access to Vsble for a single one-time payment. No more monthly bills, ever. Tap below to view plans — your dashboard stays open."})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"After your lifetime purchase your account is upgraded automatically."})]})}function qa({password:t,setPassword:s,showPwd:r,setShowPwd:i}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-destructive",children:"Confirm deletion"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Your account will be deleted. This action is permanent."})]}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1 text-xs text-muted-foreground",children:[e.jsx("li",{children:"All your websites and content will be permanently deleted."}),e.jsx("li",{children:"Active subscriptions will be cancelled."}),e.jsx("li",{children:"All files and data will be removed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ue,{className:"text-xs text-muted-foreground",children:"Enter your account password to confirm"}),e.jsxs("div",{className:"relative",children:[e.jsx(V,{type:r?"text":"password",value:t,onChange:l=>s(l.target.value),placeholder:"Password",className:"pr-10",autoComplete:"current-password"}),e.jsx("button",{type:"button",onClick:()=>i(!r),className:"absolute right-0 top-0 h-full px-3 text-muted-foreground hover:text-foreground",children:r?e.jsx(Rt,{className:"h-4 w-4"}):e.jsx(Ft,{className:"h-4 w-4"})})]})]})]})}function Ya(){const{t}=ne(),[s,r]=n.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Fe,{className:"h-5 w-5 text-destructive"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:t("dashboard.deleteAccount.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-2xl",children:t("dashboard.deleteAccount.warning")}),e.jsx(k,{variant:"destructive",size:"sm",onClick:()=>r(!0),children:t("dashboard.deleteAccount.title")})]}),e.jsx(Va,{open:s,onOpenChange:r})]})}function Za({defaultBillingTab:t,onBillingTabConsumed:s,section:r="account"}={}){const{user:i,session:l,subscription:a,signOut:d}=le(),{t:o}=ne(),{locale:m,setLocale:h}=ds(),[u,j]=n.useState(""),[C,D]=n.useState(""),[N,S]=n.useState(""),[T,P]=n.useState(!1),[f,x]=n.useState(!1),[p,L]=n.useState(!1),[b,I]=n.useState(!1),[B,G]=n.useState(!1),M=n.useRef(null);n.useEffect(()=>{t&&M.current&&setTimeout(()=>{var _;(_=M.current)==null||_.scrollIntoView({behavior:"smooth",block:"start"}),s==null||s()},150)},[t,s]),n.useEffect(()=>{if(!i)return;j(i.email??""),(async()=>{const{data:W}=await $.from("profiles").select("display_name").eq("id",i.id).single();W!=null&&W.display_name&&D(W.display_name)})()},[i]);const z=async()=>
258{if(!(!i||!u.trim())){P(!0);try{const{data:_,error:W}=await $.functions.invoke("update-email",{body:{newEmail:u.trim().toLowerCase()}});if(W)throw new Error(W.message);if(_!=null&&_.error)throw new Error(_.error);E({title:o("dashboard.account.emailUpdated"),description:o("dashboard.account.emailUpdatedDesc")})}catch(_){E({title:o("dashboard.account.errorUpdatingEmail"),description:_ instanceof Error?_.message:o("dashboard.account.unknownError"),variant:"destructive"})}finally{P(!1)}}},c=async()=>{if(!(!i||!C.trim())){x(!0);try{const{error:_}=await $.from("profiles").update({display_name:C}).eq("id",i.id);if(_)throw _;$.functions.invoke("update-intercom-contact",{body:{email:i.email,name:C}}).catch(()=>{}),E({title:o("dashboard.account.nameUpdated")})}catch(_){E({title:o("dashboard.account.errorUpdatingName"),description:_ instanceof Error?_.message:o("dashboard.account.unknownError"),variant:"destructive"})}finally{x(!1)}}},F=async()=>{if(!N.trim()||N.length<6){E({title:o("dashboard.account.passwordMinLength"),variant:"destructive"});return}L(!0);try{const{error:_}=await $.auth.updateUser({password:N});if(_)throw _;S(""),G(!1),I(!1),E({title:o("auth.passwordUpdated")})}catch(_){E({title:o("dashboard.account.errorUpdatingPassword"),description:_ instanceof Error?_.message:o("dashboard.account.unknownError"),variant:"destructive"})}finally{L(!1)}},R=async()=>{if(l)try{const{data:_,error:W}=await $.functions.invoke("customer-portal");if(W)throw new Error(W.message);_!=null&&_.url&&window.open(_.url,"_blank")}catch(_){E({title:o("common.error"),description:_ instanceof Error?_.message:o("dashboard.account.unknownError"),variant:"destructive"})}};return e.jsxs("div",{className:"p-6 lg:p-8 max-w-5xl space-y-10",children:[r==="account"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Account & Language"}),e.jsx("section",{className:"space-y-5",children:e.jsxs("div",{className:"rounded-lg border border-border p-4 sm:p-5 space-y-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:o("dashboard.account.loginInfo")}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end gap-3",children:[e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:o("dashboard.account.email")}),e.jsx(V,{value:u,onChange:_=>j(_.target.value)})]}),e.jsx(k,{size:"sm",className:"bg-green-600 hover:bg-green-700 text-white w-full sm:w-auto",onClick:z,disabled:T,children:T?e.jsx(K,{className:"h-4 w-4 animate-spin"}):o("common.update")})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end gap-3",children:[e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:o("dashboard.account.name")}),e.jsx(V,{value:C,onChange:_=>D(_.target.value)})]}),e.jsx(k,{size:"sm",className:"bg-green-600 hover:bg-green-700 text-white w-full sm:w-auto",onClick:c,disabled:f,children:f?e.jsx(K,{className:"h-4 w-4 animate-spin"}):o("common.update")})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-end gap-3",children:[e.jsx("div",{className:"flex-1 space-y-1.5",children:e.jsx("label",{className:"text-xs text-muted-foreground",children:o("dashboard.account.password")})}),e.jsx(k,{size:"sm",variant:"secondary",className:"w-full sm:w-auto",onClick:()=>I(!0),children:o("common.change")})]}),e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-end gap-3",children:e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:o("dashboard.account.language")}),e.jsxs(Nt,{value:m,onValueChange:_=>h(_),children:[e.jsx(St,{children:e.jsx(_t,{})}),e.jsx(Ct,{children:Object.entries(us).map(([_,{flag:W,label:me}])=>e.jsxs(Le,{value:_,children:[W," ",me]},_))})]})]})})]})})]}),r==="billing"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:o("dashboard.account.manageBillingHeading")||"Manage billing & payments"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o("dashboard.account.manageBillingSubtitle")||"Review your card, upcoming charges and plan."})]}),e.jsx(Fa,{onManage:R}),e.jsx(Os,{}),e.jsx(ze,{}),e.jsx(Bs,{}),e.jsx(ze,{}),e.jsxs("section",{ref:M,className:"space-y-5",children:[e.jsx("div",{className:"flex items-center justify-between",children:a.subscribed?e.jsxs(Qe,{children:[e.jsx(et,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-2.5 rounded-md px-1 py-0.5 -ml-1 hover:bg-accent transition-colors",children:[e.jsx(Ce,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:o("dashboard.account.billing")}),e.jsx(pt,{className:"h-4 w-4 text-muted-foreground"})]})}),e.jsxs(tt,{align:"start",children:[e.jsx(ae,{onClick:R,children:o("dashboard.account.manageBilling")}),a.stripeAccountType!=="old"&&e.jsx(ae,{className:"text-destructive focus:text-destructive",onClick:()=>{window.dispatchEvent(new CustomEvent("open-cancel-dialog"))},children:o("dashboard.account.cancelPlan")})]})]}):e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Ce,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:o("dashboard.account.billing")})]})}),e.jsx(Vs,{})]}),e.jsx(ze,{}),e.jsx(Ya,{})]}
258),r==="legal"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Legal / DPA"}),e.jsx(Ua,{})]}),e.jsx(At,{open:b,onOpenChange:I,children:e.jsxs(Et,{children:[e.jsxs(Pt,{children:[e.jsx(It,{children:o("dashboard.account.changePassword")}),e.jsx(Tt,{children:o("dashboard.account.changePasswordDesc")})]}),e.jsx("div",{className:"py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(V,{type:B?"text":"password",placeholder:o("dashboard.account.newPassword"),value:N,onChange:_=>S(_.target.value),className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>G(!B),className:"absolute right-0 top-0 h-full px-3 text-muted-foreground hover:text-foreground transition-colors","aria-label":B?"Hide password":"Show password",children:B?e.jsx(Rt,{className:"h-4 w-4"}):e.jsx(Ft,{className:"h-4 w-4"})})]})}),e.jsxs(Lt,{children:[e.jsx(zt,{onClick:()=>{S(""),G(!1)},children:o("common.cancel")}),e.jsx($t,{className:"bg-green-600 hover:bg-green-700",onClick:F,disabled:p,children:o(p?"common.saving":"dashboard.account.updatePassword")})]})]})})]})}const Xa=[{name:"Starter",monthly:Ee.Starter.monthly,descriptionKey:"Get started with your portfolio"},{name:"Creator",monthly:Ee.Creator.monthly,descriptionKey:"For professional creatives"},{name:"Studio",monthly:Ee.Studio.monthly,descriptionKey:"For studios & agencies",popular:!0},{name:"Business",monthly:Ee.Business.monthly,descriptionKey:"For growing businesses"}];function Ja({open:t,onDismiss:s}){const{session:r}=le(),i=bt(),l=ms(i),a=i==="usd"?"USD":"EUR",[d,o]=n.useState(null),[m,h]=n.useState(0),[u,j]=n.useState(null),[C,D]=n.useState(!1),N=n.useRef(null);n.useEffect(()=>{t&&$.from("app_settings").select("value").eq("key","welcome_offer").single().then(({data:p})=>{if(p){const L=p.value;L.enabled?(o(L),h(L.timer_seconds)):s()}})},[t]),n.useEffect(()=>{if(!(!t||!d||m<=0))return N.current=setInterval(()=>{h(p=>p<=1?(clearInterval(N.current),s(),0):p-1)},1e3),()=>{N.current&&clearInterval(N.current)}},[t,d,m>0]);const S=p=>{const L=Math.floor(p/60),b=p%60;return`${L}:${b.toString().padStart(2,"0")}`},T=n.useCallback(p=>{p||D(!0)},[]),P=()=>{D(!1),N.current&&clearInterval(N.current),s()},f=async p=>{if(!r){E({title:"Please log in first",variant:"destructive"});return}const L=hs(p,"monthly",i);j(p);try{const{data:b,error:I}=await $.functions.invoke("create-checkout",{body:{priceId:L,welcomeOffer:!0,skipTrial:!0}});if(I)throw new Error(I.message);b!=null&&b.url&&(typeof window.fbq=="function"&&window.fbq("track","InitiateCheckout",{content_name:p,content_category:"welcome_offer"}),window.location.href=b.url)}catch(b){E({title:"Error",description:b instanceof Error?b.message:"Something went wrong",variant:"destructive"})}finally{j(null)}};if(!d)return null;const x=d.discount_percent;return e.jsxs(e.Fragment,{children:[e.jsx(X,{open:t&&!C,onOpenChange:T,children:e.jsx(J,{className:"sm:max-w-3xl max-h-[90vh] overflow-y-auto",onPointerDownOutside:p=>p.preventDefault(),children:e.jsxs("div",{className:"space-y-6 pt-2",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Me,{className:"h-5 w-5 text-yellow-500"}),e.jsxs("h2",{className:"text-xl font-bold text-foreground",children:["Welcome Offer — ",x,"% Off!"]}),e.jsx(Me,{className:"h-5 w-5 text-yellow-500"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Save ",x,"% on your first month. This one-time offer won't come back!"]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Mt,{className:"h-4 w-4 text-destructive"}),e.jsx("span",{className:"text-lg font-mono font-bold text-destructive",children:S(m)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"remaining"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Xa.map(p=>{const L=p.monthly,b=(L*(1-x/100)).toFixed(2),I=u===p.name;return e.jsxs("div",{className:`relative rounded-xl border-2 p-5 space-y-3 transition-colors ${p.popular?"border-primary bg-primary/5 shadow-sm":"border-border hover:border-muted-foreground
258/30"}`,children:[p.popular&&e.jsx(je,{className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-primary text-primary-foreground text-[10px] px-2.5",children:"Most Popular"}),e.jsx("h3",{className:"font-semibold text-foreground text-base",children:p.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p.descriptionKey}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-lg line-through text-muted-foreground whitespace-nowrap",children:[l,L," ",a]}),e.jsxs("span",{className:"text-3xl font-bold text-[#22c55e] whitespace-nowrap",children:[l,b]})]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"/mo first month"})]}),e.jsxs(je,{variant:"secondary",className:"bg-green-500/10 text-green-600 border-0 text-[10px] font-semibold",children:["Save ",x,"%"]}),e.jsx(k,{className:`w-full ${p.popular?"bg-green-600 hover:bg-green-700 text-white":"bg-neutral-800 hover:bg-neutral-900 text-white"}`,size:"sm",disabled:I,onClick:()=>f(p.name),children:I?e.jsx(K,{className:"h-4 w-4 animate-spin"}):`Get ${p.name}`})]},p.name)})}),e.jsx("p",{className:"text-center text-[11px] text-muted-foreground",children:"Discount applies to the first month only. Regular pricing after."})]})})}),e.jsx(At,{open:C,onOpenChange:D,children:e.jsxs(Et,{children:[e.jsxs(Pt,{children:[e.jsx(It,{children:"Dismiss offer?"}),e.jsx(Tt,{children:"This discount is one-time only and won't be available again. Are you sure?"})]}),e.jsxs(Lt,{children:[e.jsx(zt,{children:"No, keep offer"}),e.jsx($t,{onClick:P,children:"Yes, dismiss"})]})]})})]})}function Qa({open:t,onOpenChange:s,onConfirm:r,extraCost:i,currency:l,includedWebsites:a,totalWebsites:d}){const{t:o}=ne(),[m,h]=n.useState(!1),u=l==="USD"?"$":"€",j=async()=>{h(!0);try{await r()&&s(!1)}finally{h(!1)}};return e.jsx(X,{open:t,onOpenChange:s,children:e.jsxs(J,{className:"sm:max-w-sm",children:[e.jsxs(re,{children:[e.jsxs(te,{className:"flex items-center gap-2",children:[e.jsx(Te,{className:"h-5 w-5 text-primary"}),o("dashboard.extraWebsite.title")]}),e.jsx(ve,{children:o("dashboard.extraWebsite.usedAll",{count:a})})]}),e.jsxs("div",{className:"py-3 space-y-3",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 text-center",children:[e.jsxs("p",{className:"text-2xl font-bold text-foreground",children:["+",u,i,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:o("dashboard.planSelection.perMonth")})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o("dashboard.extraWebsite.perExtra")})]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:o("dashboard.extraWebsite.addedToBill")})]}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>s(!1),disabled:m,children:o("common.cancel")}),e.jsxs(k,{onClick:j,disabled:m,children:[m&&e.jsx(K,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),o(m?"dashboard.extraWebsite.adding":"dashboard.extraWebsite.addExtra")]})]})]})})}function er({open:t,onOpenChange:s,onChoosePlan:r}){return e.jsx(X,{open:t,onOpenChange:s,children:e.jsxs(J,{className:"sm:max-w-md",children:[e.jsxs(re,{children:[e.jsxs(te,{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-5 w-5 text-destructive"}),"Legacy Plan"]}),e.jsx(ve,{children:"Your current plan is a legacy plan and does not support multiple websites in one account. To create a new website, you need to switch to one of our current plans."})]}),e.jsxs("div",{className:"py-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-2",children:"Please note:"}),e.jsxs("ul",{className:"space-y-1.5 text-sm text-muted-foreground list-disc pl-5",children:[e.jsx("li",{children:"You will be asked to enter your payment details again"}),e.jsx("li",{children:"Your new plan will become active immediately after checkout"}),e.jsx("li",{children:"Your old legacy plan will be cancelled immediately after the new plan is activated"}),e.jsx("li",{children:"No unused time, proration, or refund will be applied to the legacy plan"})]})]}),e.jsxs(oe,{children:[e.jsx(k,{variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(k,{onClick:r,children:"Choose a Plan"})]})]})})}function tr(){const{pathname:t}=xs(),s=t.startsWith("/b/")||t.startsWith("/booking"),[r,i]=n.useState(!1),[l,a]=n.useState(null),[d,o]=n.useState(0);n.useEffect(()=>{s||$.from("app_settings").select("value").eq("key","news_modal").single().then(({data:j})=>{var N;if(!j)return;const C=j.value;!(C!=null&&C.enabled)||!((N=C.pages)!=null&&N.length)||localStorage.getItem("news_modal_seen")===C.version||(a(C),i(!0))})},[s]);const m=()=>{i(!1),l&&localStorage.setItem("news_modal_seen",l.version)};if(s||!l||!l.pages.length)return null;const h=l.pages[d],u=l.pages.length;return e.jsx(X,{open:r,onOpenChange:j=>{j||m()},children:e.jsxs(J,{className:"w-[min(600px,90vw)] max-h-[min(650px,85vh)] p-0 gap-0 overflow-hidden [&>button]:hidden",children:[e.jsx("button",{onClick:m,className:"absolute right-3 top-3 z-10 rounded-full bg-background/80 backdrop-blur-sm p-1.5 text-muted-foreground hover:text-foreground transition-colors border border-border/50",children:e.jsx(Je,{className:"h-4 w-4"})}),e.jsx("div",{className:"aspect-video w-full bg-muted overflow-hidden",children:h.media_url?h.media_type==="video"?e.jsx("video",{src:h.media_url,className:"w-full h-full object-cover",autoPlay:!0,muted:!0,loop:!0,playsInl
258ine:!0}):e.jsx("img",{src:h.media_url,alt:h.title,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(xt,{className:"h-12 w-12 text-muted-foreground/30"})})}),e.jsxs("div",{className:"px-6 pt-4 pb-5 flex flex-col gap-3 overflow-auto",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground leading-tight",children:h.title}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line leading-relaxed",children:h.text})]}),u>1&&e.jsxs("div",{className:"flex items-center justify-center gap-3 px-6 pb-5",children:[e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:d===0,onClick:()=>o(j=>j-1),children:e.jsx(Hs,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex items-center gap-1.5",children:l.pages.map((j,C)=>e.jsx("button",{onClick:()=>o(C),className:`h-2 w-2 rounded-full transition-colors ${C===d?"bg-primary":"bg-muted-foreground/30 hover:bg-muted-foreground/50"}`},C))}),e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:d===u-1,onClick:()=>o(j=>j+1),children:e.jsx(qs,{className:"h-4 w-4"})})]})]})})}const ht="trial-extend-banner-dismissed";function sr({trialEnd:t,onExtend:s}){const[r,i]=n.useState(!0);if(n.useEffect(()=>{i(sessionStorage.getItem(ht)==="1")},[]),r)return null;const l=Math.max(0,Math.ceil((new Date(t).getTime()-Date.now())/864e5)),a=()=>{sessionStorage.setItem(ht,"1"),i(!0)};return e.jsxs("div",{className:"fixed bottom-6 left-6 z-40 w-[320px] max-w-[calc(100vw-2rem)] rounded-xl bg-slate-900/95 text-white shadow-2xl ring-1 ring-white/10 backdrop-blur-md",children:[e.jsx("button",{onClick:a,"aria-label":"Dismiss",className:"absolute right-2 top-2 rounded-md p-1 text-white/50 transition hover:bg-white/10 hover:text-white",children:e.jsx(Je,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"px-4 py-3 pr-8",children:[e.jsxs("div",{className:"mb-1 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-emerald-400",children:"Trial"}),e.jsxs("span",{className:"text-sm font-semibold text-white",children:[l," day",l===1?"":"s"," left"]})]}),e.jsxs("p",{className:"mb-3 text-xs leading-relaxed text-white/70",children:["Need more time? Get ",e.jsx("strong",{className:"text-white",children:"+16 extra days"})," for €5 / $5."]}),e.jsx("button",{onClick:s,className:"w-full rounded-md bg-white px-3 py-1.5 text-xs font-semibold text-slate-900 transition hover:bg-emerald-400 hover:text-slate-900",children:"Extend trial"})]})]})}function un(){const{user:t,subscription:s,refreshSubscription:r}=le(),{features:i}=gt(),l=Xe(),[a,d]=gs(),[o,m]=n.useState([]),[h,u]=n.useState([]),[j,C]=n.useState(!0),[D,N]=n.useState(""),[S,T]=n.useState("all"),[P,f]=n.useState(!1),[x,p]=n.useState(!1),[L,b]=n.useState(!1),[I,B]=n.useState(!1),[G,M]=n.useState(!1),[z,c]=n.useState({open:!1,pendingAction:null}),[F,R]=n.useState(null),[_,W]=n.useState("account");n.useEffect(()=>{if(a.get("plan")==="1"){p(!0);const g=new URLSearchParams(a);g.delete("plan"),d(g,{replace:!0})}},[a,d]),n.useEffect(()=>{if(a.get("extend_trial")==="1"){B(!0);const g=new URLSearchParams(a);g.delete("extend_trial"),d(g,{replace:!0})}},[a,d]),n.useEffect(()=>{const g=a.get("trial_extended");if(g!=="1"&&g!=="0")return;const y=new URLSearchParams(a);y.delete("trial_extended"),d(y,{replace:!0}),g==="1"?(r(),E({title:"Trial extended",description:"You now have 16 extra days. Enjoy the full Studio plan."})):E({title:"Checkout cancelled"})},[a,d,r]),n.useEffect(()=>{const g=v=>{const A=v.detail;R(A),W("billing"),T("account")},y=()=>{p(!0)};return window.addEventListener("open-account-tab",g),window.addEventListener("start-trial",y),()=>{window.removeEventListener("open-account-tab",g),window.removeEventListener("start-trial",y)}},[]);const me=s.plan,Q=me?fs(i,"websites_included",me):0,he=bs.monthly;n.useEffect(()=>{a.get("credits")==="success"&&(W("billing"),T("account"))},[]),n.useEffect(()=>{if(!t)return;const g=sessionStorage.getItem("post_auth_intent");g==="file_sharing"?(sessionStorage.removeItem("post_auth_intent"),R("file_sharing"),W("billing"),T("account")):g==="aio"&&(sessionStorage.removeItem("post_auth_intent"),R("aio"),W("billing"),T("account"))},[t==null?void 0:t.id]),n.useEffect(()=>{a.get("checkout")==="success"&&(a.delete("checkout"),d(a,{replace:!0}),r(),E({title:"Welcome! Your trial has started."}),typeof window.fbq=="function"&&window.fbq("track","StartTrial",{content_name:"checkout"}))},[]),n.useEffect(()=>{sessionStorage.removeItem("show_welcome_offer")},[]);const ie=n.useCallback(async()=>
258{if(!t)return[];const g=y=>{const v=y,A=(v==null?void 0:v.name)??"",U=String((v==null?void 0:v.message)??"");return A==="AbortError"||/abort/i.test(U)};try{for(let y=0;y<3;y++)try{const{data:v,error:A}=await $.from("websites").select("*").is("deleted_at",null).order("created_at",{ascending:!1});if(A){if(g(A)&&y<2){await new Promise(H=>setTimeout(H,600));continue}return g(A)?(console.warn("[Index] fetchSites aborted after retries, suppressing toast"),[]):(E({title:"Error loading sites",description:A.message,variant:"destructive"}),[])}const U=(v||[]).map(Ie);return m(U),U}catch(v){if(g(v)&&y<2){await new Promise(A=>setTimeout(A,600));continue}return g(v)?(console.warn("[Index] fetchSites threw AbortError after retries, suppressing toast"),[]):(E({title:"Error loading sites",description:String((v==null?void 0:v.message)??v),variant:"destructive"}),[])}return[]}finally{C(!1)}},[t==null?void 0:t.id]),ce=n.useCallback(async()=>{if(!t)return;const g=y=>{const v=y,A=(v==null?void 0:v.name)??"",U=String((v==null?void 0:v.message)??"");return A==="AbortError"||/abort/i.test(U)};for(let y=0;y<3;y++)try{const{data:v,error:A}=await $.from("websites").select("*").not("deleted_at","is",null).order("deleted_at",{ascending:!1});if(A){if(g(A)&&y<2){await new Promise(U=>setTimeout(U,600));continue}if(g(A)){console.warn("[Index] fetchArchivedSites aborted after retries, suppressing toast");return}E({title:"Error loading archive",description:A.message,variant:"destructive"});return}u((v||[]).map(Ie));return}catch(v){if(g(v)&&y<2){await new Promise(A=>setTimeout(A,600));continue}if(g(v)){console.warn("[Index] fetchArchivedSites threw AbortError after retries, suppressing toast");return}E({title:"Error loading archive",description:String((v==null?void 0:v.message)??v),variant:"destructive"});return}},[t==null?void 0:t.id]);n.useEffect(()=>{ie().then(async g=>{var A;sessionStorage.removeItem("just_signed_up");const y=g.filter(U=>U.domain&&(!U.screenshotCapturedAt||U.lastContentUpdate&&new Date(U.lastContentUpdate)>new Date(U.screenshotCapturedAt)));if(y.length===0)return;let v=0;for(const U of y.slice(0,5))try{(A=(await $.functions.invoke("capture-screenshot",{body:{websiteId:U.id}})).data)!=null&&A.success&&v++,await new Promise(we=>setTimeout(we,1e3))}catch(H){console.error(`Screenshot failed for ${U.id}:`,H)}v>0&&ie()})},[ie]),n.useEffect(()=>{S==="archive"&&ce()},[S,ce]);const ee=async g=>{const{data:y,error:v}=await $.functions.invoke("create-site",{body:{name:g}});if(v){E({title:"Error creating site",description:v.message,variant:"destructive"});return}if(y){const A=Ie(y);m(U=>[A,...U]),s.subscribed||p(!0)}},De=async g=>{if(!t)return;const y=o.length;if(s.stripeAccountType==="old"&&y>=Q){M(!0);return}if(!s.subscribed){await ee(g);return}if(y<Q){await ee(g);return}c({open:!0,pendingAction:()=>ee(g)})},se=async(g,y)=>{const{data:v,error:A}=await $.functions.invoke("duplicate-site",{body:{siteId:g,name:y}});if(A){E({title:"Error duplicating site",description:A.message,variant:"destructive"});return}if(v){const U=Ie(v);m(H=>[U,...H]),s.subscribed||p(!0)}},be=async(g,y)=>{if(!t)return;const v=o.length;if(s.stripeAccountType==="old"&&v>=Q){M(!0);return}if(!s.subscribed){await se(g,y);return}if(v<Q){await se(g,y);return}c({open:!0,pendingAction:()=>se(g,y)})},xe=async()=>{const{data:g,error:y}=await $.functions.invoke("manage-extra-websites",{body:{action:"add"}}),v=(y==null?void 0:y.message)||(g==null?void 0:g.error);if(v)return typeof v=="string"&&v.includes("No active subscription found")?(c({open:!1,pendingAction:null}),r(),p(!0),!1):(g==null?void 0:g.code)==="payment_required"?(c({open:!1,pendingAction:null}),E({title:"Payment required",description:"We couldn't charge your card for the extra website. Please update your payment details and try again.",variant:"destructive"}),g!=null&&g.hostedInvoiceUrl&&window.open(g.hostedInvoiceUrl,"_blank"),!1):(E({title:"Failed to add extra website",description:v||"Unknown error",variant:"destructive"}),jt(y??new Error(String(v)),{source:"Index.handleConfirmExtraWebsite",edgeFunction:"manage-extra-websites",action:"add",userId:t==null?void 0:t.id,email:(t==null?void 0:t.email)??void 0,currentPlan:s.plan,currentInterval:s.interval}),!1);
258const A=z.pendingAction;return A&&await A(),!0},ge=async g=>{const y=o.find(H=>H.id===g),v=crypto.randomUUID().slice(0,8),A=o.length>Q&&s.subscribed;if(y!=null&&y.premiumDomain)try{await $.functions.invoke("connect-domain",{body:{action:"disconnect",websiteId:g}})}catch{}if(y!=null&&y.externalId)try{await Ys(y.externalId,{website:{domain:`deleted-${v}`,status:"HIDDEN",premiumDomain:null}})}catch{}const{error:U}=await $.from("websites").update({domain:`deleted-${v}-${(y==null?void 0:y.domain)||""}`,premium_domain:null,approximated_id:null,approximated_status:null,deleted_at:new Date().toISOString()}).eq("id",g);if(U){E({title:"Error deleting site",description:U.message,variant:"destructive"});return}if(m(H=>H.filter(we=>we.id!==g)),A)try{await $.functions.invoke("manage-extra-websites",{body:{action:"remove"}})}catch{}},de=async(g,y)=>{const v=y.trim();if(!v)return;const{error:A}=await $.from("websites").update({name:v}).eq("id",g);if(A){E({title:"Error renaming site",description:A.message,variant:"destructive"});return}m(U=>U.map(H=>H.id===g?{...H,name:v}:H)),E({title:"Website renamed"})},Ae=async g=>{const{error:y}=await $.from("websites").update({deleted_at:null}).eq("id",g);y?E({title:"Error restoring site",description:y.message,variant:"destructive"}):(u(v=>v.filter(A=>A.id!==g)),ie(),E({title:"Website restored"}))},Y={searchQuery:D,onSearchChange:N,activeView:S,onViewChange:T,accountSection:_,onAccountSectionChange:W};return n.useEffect(()=>{if(j||s.loading){const g=setTimeout(()=>{f(!0)},2e3);return()=>{clearTimeout(g),f(!1)}}else f(!1)},[j,s.loading]),j||s.loading?e.jsx(ct,{...Y,children:e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center min-h-[50vh] gap-4",children:[e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),P&&e.jsx("p",{className:"text-sm text-muted-foreground animate-in fade-in duration-300",children:"Checking subscription details..."})]})}):e.jsxs(e.Fragment,{children:[e.jsx(tr,{}),e.jsx(Zs,{}),e.jsx(ps,{open:x,onOpenChange:p}),e.jsx(Ja,{open:L,onDismiss:()=>b(!1)}),e.jsx(Gs,{open:I,onOpenChange:B}),s.onTrial&&!s.trialExtensionUsed&&s.trialEnd&&e.jsx(sr,{trialEnd:s.trialEnd,onExtend:()=>B(!0)}),e.jsx(er,{open:G,onOpenChange:M,onChoosePlan:()=>{M(!1),p(!0)}}),e.jsx(Qa,{open:z.open,onOpenChange:g=>c(y=>({...y,open:g})),onConfirm:xe,extraCost:he,currency:"EUR",includedWebsites:Q,totalWebsites:o.length}),e.jsxs(ct,{...Y,children:[e.jsx(Ws,{sites:o}),s.onTrial&&s.trialExtensionUsed&&s.trialEnd&&e.jsxs("div",{className:"mb-4 rounded-lg border border-green-200/60 bg-green-50/60 px-4 py-2 text-xs text-green-800 dark:border-green-900/50 dark:bg-green-950/30 dark:text-green-200",children:["Trial extended — active until"," ",new Date(s.trialEnd).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]}),S==="account"?e.jsx(Za,{section:_,defaultBillingTab:F,onBillingTabConsumed:()=>R(null)}):e.jsxs(e.Fragment,{children:[e.jsx(sa,{sites:S==="archive"?h:o,mode:S==="archive"?"archive":"all",onCreateSite:De,onDeleteSite:ge,onRestoreSite:Ae,onDuplicateSite:be,onRenameSite:de,onSiteClick:g=>{l(`/sites/${g}`)},onSelectPlan:()=>p(!0),searchQuery:D,planName:s.plan,subscriptionStatus:s.loading?"loading":s.subscriptionUnpaid?"unpaid":s.paymentPending?"payment_pending":s.paymentFailed?"payment_failed":s.onTrial?"trialing":s.cancelAtPeriodEnd?"canceled":s.subscribed?"active":s.plan?"expired":"free",subscriptionUnpaid:s.subscriptionUnpaid,outstandingInvoiceUrl:s.outstandingInvoiceUrl,includedWebsites:Q,totalWebsites:o.length,extraWebsiteCost:he,extraPaymentFailed:s.extraPaymentFailed}),S==="all"&&e.jsx("div",{className:"px-4 pb-10 md:px-8",children:e.jsx(Sa,{})})]})]})]})}export{un as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.