PageSourceSearch

https://app.webability.io/assets/index-D61-5aMq.js

js webability.io collected 2026-10-02 09:59:05 UTC 45,842 bytes, 38 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addDomainTourSteps-CrdBsCPL.js","assets/vendor-CXh69xiq.js"])))=>i.map(i=>d[i]);
2import{j as e,A as Ct,r as a,F as qe,G as Ye,aG as ls,C as kt,H as bt,S as cs,h as ds}from"./vendor-CXh69xiq.js";import{c as fe,bl as k,aw as me,O as pe,T as us,a7 as hs,a6 as xs,a$ as ms,i as Tt,bm as ps,bn as Te,bo as Ae,bp as q,bq as fs,br as Pe,bs as At,P as Pt,Q as _t,bt as Et,U as It,Z as E,bu as Dt,bv as te,bw as Mt,g as bs,aF as gs,bx as ys,by as js,bz as vs,bA as ws,S as Ns,bB as Ss,bC as Cs,bD as ks,bE as gt,bF as Ue,bG as Ts,f as Ce,bH as As,N as Ps,h as yt,k as _s,bI as Es,bJ as Is,bK as Ds,bL as Ms,aJ as Rs,aM as $s,aN as Fs}from"./index-BVVRvbjs.js";import{t as C}from"./app-vendor-nlFuy7bi.js";import{p as Ls,r as jt}from"./PlanSetting-Dn70Ar7R.js";import{F as Rt}from"./Favicon-BLYmuA4y.js";import{E as $t,P as Ft}from"./pencil-BmVVAkZe.js";import{C as Lt}from"./code-DQE-Ikto.js";import{S as _e}from"./settings-BctwWCTZ.js";import{T as Ot}from"./trash-2-DKtTEclF.js";import{C as Os}from"./chevron-left-C5VzX_1C.js";import{S as Bs}from"./search-x-B3GCjEpo.js";import zs from"./TrialBannerAndModal-8JshxKPz.js";import"./index-CQf3wr__.js";import"./addSite-B-Nd9PJN.js";import"./Modal-BmPxbOG5.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"app-build-1790920293420"};var r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="2da9671c-0e0e-403c-aacc-efddf2396eb5",s._sentryDebugIdIdentifier="sentry-dbid-2da9671c-0e0e-403c-aacc-efddf2396eb5")}catch{}})();/**
3 * @license lucide-react v0.511.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const Us=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Vs=fe("chevrons-up-down",Us);/**
8 * @license lucide-react v0.511.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const Ks=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],qs=fe("circle-dashed",Ks);/**
13 * @license lucide-react v0.511.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const Ys=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],Gs=fe("circle-slash",Ys);/**
18 * @license lucide-react v0.511.0 - ISC
19 *
20 * This source code is licensed under the ISC license.
21 * See the LICENSE file in the root directory of this source tree.
22 */const Hs=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ws=fe("ellipsis",Hs);/**
23 * @license lucide-react v0.511.0 - ISC
24 *
25 * This source code is licensed under the ISC license.
26 * See the LICENSE file in the root directory of this source tree.
27 */const Js=[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]],Xs=fe("infinity",Js);function Qs({className:s,type:r,...p}){return e.jsx("input",{type:r,"data-slot":"input",className:k("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[2px] focus-visible:ring-ring","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",s),...p})}function Zs({className:s,...r}){return e.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:k("mx-auto flex w-full justify-center",s
27),...r})}function er({className:s,...r}){return e.jsx("ul",{"data-slot":"pagination-content",className:k("flex flex-row items-center gap-1",s),...r})}function ke({...s}){return e.jsx("li",{"data-slot":"pagination-item",...s})}function tr({className:s,...r}){return e.jsxs("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:k("flex size-9 items-center justify-center",s),...r,children:[e.jsx(Ws,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"More pages"})]})}function sr({className:s,...r}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:k("w-full caption-bottom text-sm",s),...r})})}function rr({className:s,...r}){return e.jsx("thead",{"data-slot":"table-header",className:k("[&_tr]:border-b",s),...r})}function ar({className:s,...r}){return e.jsx("tbody",{"data-slot":"table-body",className:k("[&_tr:last-child]:border-0",s),...r})}function vt({className:s,...r}){return e.jsx("tr",{"data-slot":"table-row",className:k("border-b border-border transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",s),...r})}function Z({className:s,...r}){return e.jsx("th",{"data-slot":"table-head",className:k("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...r})}function ee({className:s,...r}){return e.jsx("td",{"data-slot":"table-cell",className:k("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...r})}const nr=Ct`
28  query getVisitorCountsBySiteIds($siteIds: [Int!]!) {
29    getVisitorCountsBySiteIds(siteIds: $siteIds) {
30      siteId
31      count
32    }
33  }
34`,ir={Active:"success","Life Time":"default",Free:"neutral",Trial:"default",Expiring:"warning",Expired:"destructive",Cancelled:"destructive","Card Failed":"destructive",Deactivated:"neutral"},or={Active:xs,"Life Time":Xs,Trial:hs,Expiring:us,Expired:pe,Cancelled:pe,"Card Failed":me,Deactivated:Gs,Free:qs},lr=s=>ir[s]??"neutral",cr=s=>or[s]??pe,Bt=s=>new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),dr=(s,r)=>{switch(s){case"Card Failed":return"Last renewal payment failed. Click to update card";case"Life Time":return"Lifetime license - Never expires";case"Active":return"Subscription is active";case"Trial":return`Trial period ends on ${r&&Number.isFinite(Number.parseInt(r))?Bt(Number.parseInt(r)):"N/A"}`;case"Deactivated":return"Domain not active. Choose a plan to activate";case"Free":return"Free plan. Upgrade to bring back AI auto-fixes";case"Expiring":return"Subscription is expiring soon";case"Cancelled":return"Subscription was cancelled. The widget is off";default:return"Subscription has expired"}},ur=Ct`
35  mutation updateSite($url: String!, $siteId: Int!) {
36    changeURL(newURL:$url, siteId: $siteId)
37  }
38`,hr=({isOpen:s,onClose:r,onDelete:p,domainID:h,domainStatus:o,billingLoading:b,appSumoCount:R=0,isCancel:d=!1,isAgencySlot:w=!1})=>{const[x,I]=a.useState(""),[j,T]=a.useState(""),[A,f]=a.useState(!1),[g,u]=a.useState(!1),[y,v]=a.useState(""),[D,$]=a.useState(!1),[O,P]=a.useState("Copy code"),M="#8B95A4",{data:B}=qe(n=>n.user),F=[{id:"too_expensive",label:"Too expensive"},{id:"not_using",label:"Not using the service"},{id:"found_alternative",label:"Found a better alternative"},{id:"mistake",label:"Added the site by mistake"},{id:"other",label:"Other"}],z=a.useRef(null);a.useEffect(()=>{s&&(I(""),T(""),f(!1),u(!1),v(""),$(!1),P("Copy code"))},[s]),a.useEffect(()=>{if(!s)return;const n=z.current;if(!n)return;const N=n.querySelector('button:not([disabled]), input, textarea, [tabindex]:not([tabindex="-1"])');N==null||N.focus();const m=W=>{if(W.key!=="Tab")return;const V=Array.from(n.querySelectorAll('input, button:not([disabled]), textarea, [tabindex]:not([tabindex="-1"])'));if(V.length===0)return;const Y=V[0],re=V[V.length-1];W.shiftKey?document.activeElement===Y&&(W.preventDefault(),re.focus()):document.activeElement===re&&(W.preventDefault(),Y.focus())};return n.addEventListener("keydown",m),()=>n.removeEventListener("keydown",m)},[s]);const U=n=>{I(n),n==="too_expensive"&&o!=="Life Time"&&(R||0)<=1?f(!0):f(!1)},ce=()=>{var N;const n=x==="other"?j:((N=F.find(m=>m.id===x))==null?void 0:N.label)||x;p(h,o,n,j)},Ee=async()=>{u(!0);try{const n=Tt(),N=await fetch("https://api.webability.io/apply-retention-discount",{method:"POST",headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{}},body:JSON.stringify({domainId:h,email:B==null?void 0:B.email,status:o})}),m=await N.json();if(N.ok)m!=null&&m.couponCode?v(m==null?void 0:m.couponCode):($(!0),setTimeout(()=>{r()},1e4));else throw new Error(m.error)}catch(n){console.error("Error applying discount:",n),C.error("Failed to apply discount. Please try again.")}finally{u(!1)}},de=async()=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(y),P("Copied!"),setTimeout(()=>P("Copy code"),2e3);else{const n=document.createElement("textarea");n.value=y,n.style.position="fixed",n.style.left="-999999px",n.style.top="-999999px",document.body.appendChild(n),n.focus(),n.select();const N=document.execCommand("copy");if(document.body.removeChild(n),N)P("Copied!"),setTimeout(()=>P("Copy code"),2e3);else throw new Error("Copy command failed")}}catch(n){console.error("Failed to copy:",n),P("Failed to copy"),setTimeout(()=>P("Copy code"),2e3)}};if(!s)return null;const se=x&&(x!=="other"||j.trim().length>0);return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-xs z-50 transition-opacity duration-300",onClick:b?void 0:r,onKeyDown:n=>{n.key==="Escape"&&!b&&r()},children:e.jsxs("div",{ref:z,role:"dialog","aria-modal":"true","aria-labelledby":"
38confirm-modal-title",className:"bg-white rounded-2xl shadow-2xl p-8 w-full max-w-lg mx-4 border border-border transform transition-all duration-300 hover:shadow-3xl max-h-[90vh] overflow-y-auto",onClick:n=>n.stopPropagation(),style:{boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05)"},children:[e.jsx("h2",{id:"confirm-modal-title",className:"text-2xl font-bold mb-6 text-gray-800",children:d?w?"Confirm Removing This Site From Your Plan":"Confirm Subscription Cancellation":"Confirm Site Deletion"}),d&&w&&e.jsx("p",{className:"text-sm text-gray-600 -mt-4 mb-6",children:"If this site was covered by your agency plan, this frees up that slot. Your agency subscription keeps billing as usual — it covers the other sites on your plan."}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-800 mb-4","aria-hidden":"true",children:d?w?"Please tell us why you're removing this site from your plan:":"Please tell us why you're canceling this subscription:":"Please tell us why you're deleting this site:"}),e.jsxs("fieldset",{className:"space-y-3",children:[e.jsx("legend",{id:"delete-reason-legend",className:"sr-only",children:d?w?"Please tell us why you're removing this site from your plan:":"Please tell us why you're canceling this subscription:":"Please tell us why you're deleting this site:"}),F.map(n=>e.jsx("div",{className:"group",children:e.jsxs("label",{htmlFor:n.id,className:`flex items-start p-4 rounded-xl border-2 cursor-pointer transition-all duration-200 hover:shadow-xs ${x===n.id?"border-red-200 bg-red-50 shadow-xs":"border-border hover:border-input hover:bg-gray-50"}`,children:[e.jsxs("div",{className:"relative flex items-center justify-center mt-0.5",children:[e.jsx("input",{type:"radio",id:n.id,name:"deleteReason",value:n.id,checked:x===n.id,onChange:N=>U(N.target.value),className:"sr-only"}),e.jsx("div",{className:`w-5 h-5 rounded-full border-2 transition-all duration-200 flex items-center justify-center ${x===n.id?"border-red-500 bg-red-500":"bg-white"}`,style:x===n.id?void 0:{borderColor:M},children:x===n.id&&e.jsx("div",{className:"w-2 h-2 bg-white rounded-full"})})]}),e.jsx("span",{className:`ml-4 text-sm font-medium transition-colors duration-200 ${x===n.id?"text-red-900":"text-gray-700 group-hover:text-gray-900"}`,children:n.label})]})},n.id))]}),x==="other"&&e.jsxs("div",{className:"mt-6 p-4 bg-gray-50 rounded-xl border border-border",children:[e.jsx("label",{htmlFor:"other-reason-text",className:"block text-sm font-medium text-gray-700 mb-3",children:"Please specify your reason:"}),e.jsx("textarea",{id:"other-reason-text",placeholder:"Tell us more about why you're deleting this site...",value:j,onChange:n=>T(n.target.value),className:"w-full p-4 border-2 border-border rounded-xl focus:ring-2 focus:ring-red-500 focus:border-red-500 resize-none h-24 text-sm transition-all duration-200 hover:border-input",maxLength:500}),e.jsxs("div",{className:"flex justify-between items-center mt-2",children:[e.jsxs("p",{className:"text-xs text-gray-500",children:[j.length,"/500 characters"]}),j.length>400&&e.jsxs("p",{className:"text-xs text-orange-600 font-medium",children:[500-j.length," characters remaining"]})]})]}),A&&e.jsxs("div",{className:"mt-6 p-6 bg-linear-to-br from-emerald-50 via-green-50 to-teal-50 border-2 border-emerald-200 rounded-2xl shadow-lg",children:[e.jsxs("div",{className:"flex items-start mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-linear-to-br from-emerald-400 to-green-500 rounded-full flex items-center justify-center mr-4 shrink-0",children:e.jsx("span",{className:"text-2xl",children:"🎉"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-xl font-bold text-emerald-900 mb-3 leading-tight",children:"Wait! We have a special offer for you!"}),e.jsxs("p",{className:"text-emerald-800 mb-4 leading-relaxed",children:["We understand cost is a concern. How about a"," ",e.jsx("span",{className:"font-bold bg-emerald-100 px-2 py-1 rounded-md text-emerald-900",children:"5% discount"})," ","on your next billing cycle?"]})]})]}),e.jsx("div",{className:"mt-4 w-full",style:{display:"block",width:"100%"},children:!y&&!D&&e.jsx("button",{onClick:Ee,disabled:g,"aria-busy":g,type:"button",style:{width:"100%",minHeight:"52px",padding:"16px 24px",backgroundColor:g?"#9CA3AF":"#10b981",backgroundImage:g?"none":"linear-gradient(to right, #10b981, #059669)",color:"#ffffff",border:"none",borderRadius:"12px",cursor:g?"not-allowed":"pointer",fontSize:"16px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",transition:"all 0.2s",zIndex:10,position:"relative"},onMouseEnter:n=>{g||(n.currentTarget.style.transform="scale(1.02)",n.currentTarget.style.boxShadow="0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)")},onMouseLeave:n=>{g||(n.currentTarget.style.transform="scale(1)",n.currentTarget.style.boxShadow="0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)")},children:g?e.jsxs(e.Fragment,{children:[e.jsx(Ye,{size:18,sx:{color:"white",marginRight:1},"aria-hidden":"true"}),e.jsx("span",{children:"Redeeming Discount..."})]}):e.jsx(e.Fragment,{children:e.jsx("span",{children:"Redeem Discount & Keep Site"})})})}),y&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white p-4 rounded-xl border-2 border-dashed border-emerald-300 mb-4 shadow-xs",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-emerald-800",children:"Your Discount Code:"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("code",{className:"bg-linear-to-r from-emerald-100 to-green-100 px-3 py-2 rounded-lg text-emerald-900 font-mono font-bold text-lg border border-emerald-200",children:y}),e.jsx(ls,{title:O,arrow:!0,children:e.jsx("button",{onClick:de,"aria-label":O,className:"ml-3 text-emerald-600 hover:text-emerald-800 transition-all duration-200 p-2 rounded-lg hover:bg-emerald-50 border border-emerald-200 hover:border-emerald-300",children:e.jsx(ms,{size:18,"aria-hidden":"true"})})})]})]})}),e.jsx("div",{className:"bg-emerald-100 rounded-xl p-3 border border-emerald-200",children:e.jsx("p",{className:"text-sm text-emerald-800 text-center font-medium",children:"🎯 Use this code at checkout to get your 5% discount!"})})]}),D&&e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"bg-linear-to-r from-emerald-100 to-green-100 p-6 rounded-xl mb-4 border-2 border-emerald-200 shadow-xs",children:[e.jsx("div",{className:"w-16 h-16 bg-linear-to-r from-emerald-400 to-green-500 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-white",f
38ill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("p",{className:"text-emerald-900 font-bold text-lg mb-2",children:"Discount Applied Successfully!"}),e.jsx("p",{className:"text-emerald-800 text-sm leading-relaxed",children:"Your 5% discount has been applied to your subscription. Thank you for staying with us!"})]}),e.jsx("div",{className:"bg-emerald-50 rounded-lg p-3 border border-emerald-200",children:e.jsx("p",{className:"text-sm text-emerald-700 font-medium",children:"⏱️ This modal will close automatically in 10 seconds..."})})]})]})]}),e.jsx("div",{className:"bg-gray-50 rounded-xl p-4 mb-6",children:e.jsxs("p",{className:"text-gray-600 text-sm text-center",children:["Click ",e.jsx("strong",{className:"text-gray-800",children:"Cancel"})," to return without making any changes."]})}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:r,className:"px-6 py-3 rounded-xl text-gray-600 hover:text-gray-800 hover:bg-gray-100 transition-all duration-200 font-medium border border-border hover:border-input hover:shadow-xs",disabled:b,children:"Cancel"}),e.jsx("button",{onClick:ce,className:`px-6 py-3 rounded-xl text-white transition-all duration-200 flex items-center font-medium shadow-xs hover:shadow-md ${se&&!b?"bg-linear-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 transform hover:scale-105":"bg-gray-400 cursor-not-allowed"}`,disabled:b||!se,"aria-busy":b,children:b?e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:"-ml-1 mr-3",size:20,sx:{color:"white"},"aria-hidden":"true"}),"Processing..."]}):d?w?"Remove Site From Plan":"Cancel Subscription":"Delete Site"})]})]})})};function zt(s,r){const p=r!==""&&r!=="Never";switch(s){case"Free":return"No end date";case"Expired":return p?`Ended ${r}`:"Expired";case"Cancelled":return"Cancelled";case"Deactivated":return p?r:"No plan";default:return r===""?"Never":r}}function Ut({status:s,expiredAt:r}){const p=cr(s),h=lr(s),o=ps(),b=s==="Card Failed";return e.jsxs(Te,{open:o.open,onOpenChange:o.onOpenChange,children:[e.jsx(Ae,{asChild:!0,children:e.jsx("span",{className:"inline-flex",children:e.jsx(q,{asChild:!0,variant:h,className:b?"cursor-pointer":"cursor-help",children:e.jsxs("button",{type:"button",...b?{onClick:()=>fs()}:o.triggerProps,children:[e.jsx(p,{"aria-hidden":"true"}),s]})})})}),e.jsx(Pe,{className:"max-w-60",children:dr(s,r)})]})}function le(s,r){const p=new URLSearchParams;r&&p.set("tab",r),s.url&&p.set("site",s.url);const h=p.toString();return`/domain-plans/${s.id}${h?`?${h}`:""}`}const xr=({domain:s,domainStatus:r,endDate:p,visitorCount:h,billingLoading:o,activePlan:b,tierPlan:R,appSumoCount:d,codeCount:w,userData:x,isAppSumoOrg:I,isEnterpriseUser:j=!1,onChangeDomain:T,onDelete:A,onSubscription:f,onOpenActivateModal:g,onPaymentView:u,onCancelSubscription:y})=>{var z;const v=kt(),D=Mt({isAppSumoOrg:I,activePlan:b,tierPlan:R,appSumoCount:d,codeCount:w}),$=!j&&s.is_owner&&At(r),O=s.is_owner&&(r==="Active"||r==="Life Time"),P=O&&!j,M=o&&D.action==="activate-subscription",B=()=>{M||(D.action==="activate-subscription"?f(s):D.action==="activate-modal"?g(s):D.action==="stack-codes"?v("/redeem"):u())},F=`Shared by ${s.user_email||"another member"}`;return e.jsxs("div",{"data-tour":"site-card",className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 rounded-t-2xl border border-b-0 border-border bg-muted pt-2.5 pr-2 pb-[1.375rem] pl-4",children:[e.jsx("span",{className:"flex shrink-0",children:e.jsx(Rt,{domain:s.url??"",size:24})}),e.jsx("div",{className:"min-w-0 flex-1 text-sm font-medium break-all text-ink",children:(s.url??"").replace(/^https?:\/\//,"").replace(/^www\./,"")}),e.jsxs(Pt,{children:[e.jsxs(Te,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx("span",{className:"inline-flex",children:e.jsx(_t,{className:Et({variant:"ghost",size:"icon-sm"}),"aria-label":`More actions for ${s.url}`,children:e.jsx($t,{})})})}),e.jsx(Pe,{children:"More actions"})]}),e.jsxs(It,{align:"end",collisionPadding:16,children:[((x==null?void 0:x.isAdminOrOwnerOrSuper)||s.is_owner)&&e.jsxs(E,{onSelect:()=>T(s),children:[e.jsx(Ft,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Change domain"]}),$&&e.jsxs(E,{disabled:M,onSelect:B,children:[e.jsx(me,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),M?"Processing...":D.label]}),e.jsxs(E,{onSelect:()=>v(le(s,"install")),children:[e.jsx(Lt,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Install widget"]}),e.jsxs(E,{onSelect:()=>v(le(s)),children:[e.jsx(_e,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Site settings"]}),O&&e.jsx(Dt,{}),P&&e.jsxs(E,{onSelect:()=>y(s.id??0,r),children:[e.jsx(pe,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Cancel subscription"]}),O&&e.jsxs(E,{variant:"destructive",onSelect:()=>A(s.id??0,r),children:[e.jsx(Ot,{"aria-hidden":"true",className:"h-4 w-4"}),"Remove"]})]})]})]}),e.jsxs("div",{className:"relative -mt-3 space-y-3 rounded-t-[12px] rounded-b-2xl border border-border bg-surface p-3",children:[e.jsxs("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-2.5",children:[e.jsx("dt",{className:"text-xs text-ink",children:"Plan:"}),e.jsx("dd",{className:"flex",children:e.jsx(Ut,{status:r,expiredAt:s==null?void 0:s.expiredAt})}),e.jsx("dt",{className:"text-xs text-ink",children:"End date:"}),e.jsx("dd",{className:"flex",children:e.jsx(q,{variant:"outline",children:zt(r,p)})}),e.jsx("dt",{className:"self-start pt-0.5 text-xs text-ink",children:"Access:"}),e.jsx("dd",{children:e.jsxs("div",{className:"flex min-w-0 flex-wrap gap-1 [&_[data-slot=badge]]:h-auto [&_[data-slot=badge]]:max-w-full [&_[data-slot=badge]]:shrink [&_[data-slot=badge]]:rounded-[11px] [&_[data-slot=badge]]:text-left [&_[data-slot=badge]]:break-all [&_[data-slot=badge]]:whitespace-normal",children:[s.is_owner&&e.jsx(q,{variant:"outline",className:"border-success text-success",children:"Owner"}),!s.is_owner&&e.jsx(q,{variant:"outline",children:F}),!!((z=s==null?void 0:s.workspaces)!=null&&z.length)&&e.jsx(q,{variant:"outline",className:"border-primary text-primary",children:"Worksp
38ace"})]})}),e.jsx("dt",{className:"text-xs text-ink",children:"Unique visitors:"}),e.jsx("dd",{className:"text-xs font-medium tabular-nums text-ink",children:h.toLocaleString()})]}),e.jsx("div",{className:"-mx-3 flex justify-end border-t border-border px-3 pt-3",children:$?e.jsxs(te,{size:"xs",className:"rounded-full px-3 has-[>svg]:px-3",disabled:M,onClick:B,children:[e.jsx(me,{"aria-hidden":"true"}),M?"Processing...":D.label]}):e.jsxs(te,{size:"xs",className:"rounded-full px-3 has-[>svg]:px-3",onClick:()=>v(le(s)),children:[e.jsx(_e,{"aria-hidden":"true"}),"Manage"]})})]})]})},Ve=[{id:"all",label:"All sites",short:"All"},{id:"paid",label:"Paid",short:"Paid"},{id:"free",label:"Free & trial",short:"Free & trial"},{id:"inactive",label:"Inactive",short:"Inactive"}],mr=new Set(["Active","Expiring","Card Failed","Life Time"]),pr=new Set(["Trial","Free"]),fr=new Set(["Expired","Cancelled","Deactivated"]);function br(s,r){switch(s){case"paid":return mr.has(r);case"free":return pr.has(r);case"inactive":return fr.has(r);default:return!0}}function Ke(s,r){return s<=5?Array.from(Array(s>0?s:0).keys()):s>5&&r<4?[0,1,2,3,4,"...",s-1]:r>=4&&s>4&&r<s-4?[0,1,"...",r-1,r,r+1,"...",s-1]:r>=s-4?[0,1,"...",s-4,s-3,s-2,s-1]:[]}const gr=({total:s,size:r=20,onPageChange:p})=>{const[h,o]=a.useState(Math.ceil(s/r)),[b,R]=a.useState(Ke(h,0)),[d,w]=a.useState(0);a.useEffect(()=>{o(Math.ceil(s/r)),R(Ke(Math.ceil(s/r),d))},[s,r]),a.useEffect(()=>{R(Ke(h,d)),p(d*r,r)},[d]);function x(f){f==="prev"?d!==0&&w(g=>g-1):d<h-1&&w(g=>g+1)}const I=()=>h<=5?Array.from(Array(h>0?h:0).keys()):d<=1?[0,1,2,"...",h-1]:d>=h-2?[0,"...",h-3,h-2,h-1]:[0,"...",d-1,d,d+1,"...",h-1];if(!b||b.length<=1)return null;const j=d*r+1,T=Math.min((d+1)*r,s),A=(f,g,u)=>f.map((y,v)=>y==="..."?e.jsx(ke,{className:u,children:e.jsx(tr,{className:"size-8"})},`${g}-gap-${v}`):e.jsx(ke,{className:u,children:e.jsx(te,{type:"button",size:"icon-sm",variant:y===d?"default":"secondary",className:y===d?void 0:"bg-muted","aria-current":y===d?"page":void 0,"aria-label":`Go to page ${y+1}`,onClick:()=>w(y),children:y+1})},`${g}-${y}`));return e.jsxs("div",{className:"flex flex-col items-center justify-between gap-3 sm:flex-row",children:[e.jsxs("p",{className:"text-sm whitespace-nowrap text-muted-foreground","aria-live":"polite",children:["Showing ",j," to ",T," of ",s," entries"]}),e.jsx(Zs,{className:"mx-0 w-auto justify-end",children:e.jsxs(er,{children:[e.jsx(ke,{children:e.jsxs(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>x("prev"),disabled:d===0,"aria-label":"Go to previous page",children:[e.jsx(Os,{"aria-hidden":"true"}),e.jsx("span",{className:"max-sm:hidden",children:"Previous"})]})}),A(b,"desktop","hidden sm:block"),A(I(),"mobile","sm:hidden"),e.jsx(ke,{children:e.jsxs(te,{type:"button",size:"sm",variant:"ghost",onClick:()=>x("next"),disabled:d===h-1,"aria-label":"Go to next page",children:[e.jsx("span",{className:"max-sm:hidden",children:"Next"}),e.jsx(bs,{"aria-hidden":"true"})]})})]})})]})},yr=a.memo(gr),jr=253402300799e3,wt="rounded-[10px]",Nt="inline-flex items-baseline gap-1 rounded-xs hover:text-ink focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",Ge=s=>{const r=Number.parseInt(s??"",10);return Number.isFinite(r)?r>=jr?null:r:null},vr="",St=s=>{const r=Ge(s);return r!==null?Bt(r):Number.isFinite(Number.parseInt(s??"",10))?"Never":vr},wr=({setReloadSites:s,setPaymentView:r,openModal:p,setOptionalDomain:h,customerData:o,refetchSites:b,totalCount:R})=>{var ft;const[d,w]=a.useState(()=>new Set),[x]=a.useState(20),[I,j]=a.useState(0),[T,A]=a.useState(""),[f,g]=a.useState(""),[u,y]=a.useState("all"),[v,D]=a.useState(null),[$,O]=a.useState("asc"),P=a.useRef("all"),M=a.useRef(""),B=a.useRef(null);a.useEffect(()=>{const t=setTimeout(()=>{g(T)},300);return()=>clearTimeout(t)},[T]),a.useEffect(()=>{f!==M.current&&j(0)},[f]);const F=a.useMemo(()=>u!==P.current?(P.current=u,0):f!==M.current?(M.current=f,0):I,[u,I,f]),z="all",U=u!=="all",{data:ce,previousData:Ee,loading:de,refetch:se}=bt(gs,{variables:U?{filter:z,search:f||void 0}:{limit:x,offset:F,filter:z,search:f||void 0},skip:!1}),n=u,N=a.useRef(null);ce&&!de&&(N.current=n);const m=ce??(N.current===n?Ee:void 0),W=de&&!m,V=de&&!!m&&!ce,{data:Y}=qe(t=>t.user),re=qe(t=>t.organization.data),[be,J]=a.useState(!1),[ae,Vt]=a.useState(""),[Ie,
38Kt]=a.useState(!1),[,qt]=a.useState({}),[G,ne]=a.useState(!1),[Yt,ge]=a.useState(!1),[Gt,De]=a.useState(-1),[Ht,Me]=a.useState(""),[He,ye]=a.useState(!1),[,Wt]=a.useState(-1),We=a.useRef(null),[Jt,Je]=a.useState(!1),[Xt,Qt]=a.useState(""),[Re,Xe]=a.useState(!1),[$e,Qe]=a.useState(null),[Fe,Le]=a.useState("");a.useEffect(()=>{if(!Re)return;const t=B.current;if(!t)return;const i=l=>{if(l.key!=="Tab")return;const c=Array.from(t.querySelectorAll('input, button:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(c.length===0)return;const _=c[0],S=c[c.length-1];l.shiftKey?document.activeElement===_&&(l.preventDefault(),S.focus()):document.activeElement===S&&(l.preventDefault(),_.focus())};return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)},[Re]);const[Zt]=cs(ur,{onCompleted:async t=>{var i;s(!0),(i=t==null?void 0:t.changeURL)!=null&&i.includes("Successfully")&&C.success("The domain name was successfully updated."),b&&b(),se&&await se()},onError:t=>{C.error(`There was an error while editing the domain name. ${t.message}`)}}),es=async(t,i,l,c)=>{var xe;const _=(xe=H.find(oe=>oe.id===t))==null?void 0:xe.url;if(!_){C.error("There has been a problem deleting the domain.");return}J(!0);const S="https://api.webability.io/cancel-site-subscription",L={domainId:t,domainUrl:_,userId:Y.id,status:i,cancelReason:l,otherReason:c,isCancel:He},Q=Tt();try{const oe=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json",...Q?{Authorization:`Bearer ${Q}`}:{}},body:JSON.stringify(L)});if(!oe.ok)throw new Error("Network response was not ok");await oe.json(),w(os=>new Set(os).add(t)),C.success("The domain was successfully removed"),J(!1),ze(),window.location.reload()}
38catch(oe){J(!1),ze(),C.error("There has been a problem deleting the domain."),console.error("Error during fetch operation:",oe)}},je=kt(),Ze=t=>{Qe(t),Le(t.url??""),Xe(!0)},ve=()=>{Xe(!1),Qe(null),Le("")},et=async()=>{if(!$e)return;if(ne(!0),!Fe){C.error("Domain name cannot be empty"),ne(!1);return}const t=yt(Fe);if(!t){C.error("Please enter a valid domain name"),ne(!1);return}if(!_s(t)){C.error("Please enter a valid domain name"),ne(!1);return}if(H.some(l=>yt(l.url??"")===t&&l.id!==$e.id)){C.error("This domain already exists"),ne(!1);return}try{const l=await Zt({variables:{siteId:$e.id,url:t}});l.errors?C.error(l.errors[0].message):ve()}catch{}finally{ne(!1)}},[tt,ts]=a.useState(!1),[we,ss]=a.useState(0),[Oe,st]=a.useState(0),[rs,as]=a.useState(!1),rt=(re==null?void 0:re.id)==="1",Be=(o==null?void 0:o.customerType)==="enterprise",at=async t=>{var i;J(!0);try{const l=await Ls({email:Y.email,returnURL:window.location.href,planName:ae.toLowerCase(),billingInterval:jt(ae,Ie),domainId:t.id,domainUrl:t.url,userId:Y.id});if(!l.ok)throw new Error("Network response was not ok");const c=await l.json();Es({transaction_id:(c==null?void 0:c.subscriptionId)??void 0,value:typeof(c==null?void 0:c.amount)=="number"?c.amount:Is((i=Ds[0])==null?void 0:i.price,Ie),plan:ae,billing_period:jt(ae,Ie)}),Ms(),C.success("The domain was successfully added to your active plan"),J(!1),window.location.reload()}catch(l){J(!1),C.error("You have reached the maximum number of allowed domains for this plan"),console.error("Fetch operation error:",l)}},ze=()=>{ge(!1)},ns=()=>{Je(!1)},nt=t=>{Je(!0),We.current=t},it=(t,i)=>{ge(!0),De(t),Me(i),ye(!0)},H=a.useMemo(()=>{var i;if(!m)return[];const t=((i=m.getUserSites)==null?void 0:i.sites)||m.getUserSites||[];return d.size?t.filter(l=>!d.has(l.id)):t},[m,d]),ue=a.useMemo(()=>H.filter(t=>(t==null?void 0:t.isAppsumo)===!0||(t==null?void 0:t.planTier)==="appsumo").map(t=>t.url).filter(t=>!!t),[H]),K=a.useMemo(()=>{const t=c=>Ue(c.url??"",c.expiredAt??"",c.trial??0,ue,c.dunningState,c.planTier),i=u==="all"?H:H.filter(c=>br(u,t(c)));if(!v)return i;const l=$==="asc"?1:-1;return[...i].sort((c,_)=>{if(v==="domain")return l*(c.url??"").localeCompare(_.url??"");const S=Ge(c.expiredAt),L=Ge(_.expiredAt);return S===null||L===null?S===L?0:S===null?1:-1:l*(S-L)})},[H,ue,u,v,$]),Ne=a.useMemo(()=>U?K.slice(F,F+x):K,[K,U,F,x]),ot=a.useMemo(()=>Ne.map(t=>Number(t.id)).filter(t=>Number.isFinite(t)),[Ne]),{data:Se}=bt(nr,{variables:{siteIds:ot},skip:ot.length===0}),lt=a.useMemo(()=>{const t=new Map;return((Se==null?void 0:Se.getVisitorCountsBySiteIds)??[]).forEach(i=>{t.set(i.siteId,i.count)}),t},[Se]),ct=f.trim(),is=((ft=Ve.find(t=>t.id===u))==null?void 0:ft.label)??"All sites",X=ct?{icon:Bs,title:`No sites match "${ct}"`,description:u!=="all"?`Nothing in ${is} matches. Try another search, or switch to All sites.`:"Check the spelling, or try a shorter part of the domain.",action:"clearSearch"}:u==="paid"?{icon:Ce,title:"No paid sites",description:"None of your sites is on a paid plan yet. Switch to All sites to see every site you have.",action:null}:u==="free"?{icon:Ce,title:"No free or trial sites",description:"None of your sites is on a trial or the free plan.",action:null}:u==="inactive"?{icon:Ce,title:"No inactive sites",description:"None of your sites is expired, cancelled or without a plan.",action:null}:{icon:Ce,title:"No sites yet",description:"Add your first domain to get started with accessibility monitoring.",action:"addDomain"},dt=t=>{switch(X.action){case"clearSearch":return{label:"Clear search",onClick:()=>A("")};case"addDomain":return{label:"Add new domain",onClick:()=>{p(),t&&ye(!1)}};default:return null}},ut=t=>{if(v===t){O(i=>i==="asc"?"desc":"asc");return}D(t),O("asc")},ht=t=>v!==t?"none":$==="asc"?"ascending":"descending",xt=({column:t})=>{const i="size-3 shrink-0 self-center";return v!==t?e.jsx(Vs,{"aria-hidden":"true",className:i}):$==="asc"?e.jsx(As,{"aria-hidden":"true",className:i}):e.jsx(Ps,{"aria-hidden":"true",className:i})},ie=Mt({isAppSumoOrg:rt,activePlan:ae,tierPlan:tt,appSumoCount:we,codeCount:Oe}),he=be&&ie.action==="activate-subscription",mt=(t,i)=>!Be&&!!t.is_owner&&At(i),pt=t=>{he||(ie.action==="activate-subscription"?at(t):ie.action==="activate-modal"?nt(t):ie.action==="stack-codes"?je("/redeem"):(r(!0),p(),h(t.url??"")))};return a.useEffect(()=>{var S,L;const t=f.trim(),i=((S=Ve.find(Q=>Q.id===u))==null?void 0:S.label)??"All sites",l=U?K.length:Number(((L=m==null?void 0:m.getUserSites)==null?void 0:L.total)??K.length),c=l===0?"No sites found":`${l} ${l===1?"site":"sites"} found`,_=t?`${c} in ${i} for "${t}"`:`${c} in ${i}`;Qt(_)},[K.length,f,u,U,m]),a.useEffect(()=>{o&&(o.submeta&&qt(o.submeta),o.tierPlan&&o.tierPlan==!0&&ts(!0),o.isCustomer===!0&&(Vt(o.plan_name),o.interval==="yearly"&&Kt(!0)),o.expiry&&Wt(o.expiry),o.appSumoCount&&ss(o.appSumoCount),o.codeCount&&(o.codeCount==9999?st(1/0):st(o.codeCount*2)),o.isCustomer==!0&&o.card&&as(!0))},[o]),e.jsxs(e.Fragment,{children:[e.jsx(hr,{billingLoading:be,domainID:Gt,domainStatus:Ht,isOpen:Yt,onClose:ze,onDelete:es,appSumoCount:(o==null?void 0:o.appSumoCount)||0,isCancel:He,isAgencySlot:(o==null?void 0:o.customerType)==="agency"}),e.jsx(ys,{billingLoading:be,setBillingLoading:J,domain:We.current,promoCode:we<=Oe?[we]:[],setReloadSites:s,isOpen:Jt,onClose:ns,isStripeCustomer:rs}),e.jsxs(js,{value:u,onValueChange:t=>y(t),className:"w-full gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsx(vs,{className:`my-sites-tabs ${wt}`,children:Ve.map(({id:t,label:i,short:l})=>e.jsxs(ws,{value:t,className:"rounded-lg",children:[e.jsx("span",{className:"sm:hidden",children:l}),e.jsx("span",{className:"hidden sm:inline",children:i})]},t))}),e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 md:gap-4",children:e.jsxs("div",{className:"relative w-full md:w-80 md:max-w-md my-sites-search",children:[e.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:Xt}),e.jsx(Ns,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-foreground","aria-hidden":"true"}),e.jsx(Qs,{type:"search",placeholder:"Search","aria-label":"Search sites",value:T,onChange:t=>A(t.target.value),className:`border-transparent bg-muted pl-9 shadow-none placeholder:text-foreground ${wt}`})]})})]}),e.jsx(Ss,{value:u,children:e.jsxs(Cs,{className:"gap-0 overflow-hidden py-0 max-md:rounded-none max-md:border-0 max-md:bg-transparent max-md:shadow-none",children:[e.jsx("div",{className:"w-full px-6",children:e.jsx("div",{className:"hidden md:block",children:W?e.jsx(ks,{}
38):K.length===0?e.jsx(gt,{icon:X.icon,title:X.title,description:X.description,action:dt(!1)}):e.jsx(e.Fragment,{children:e.jsx("div",{"aria-busy":V||void 0,className:k("@container/sites hidden transition-opacity md:-mx-6 md:block",V&&"opacity-60"),children:e.jsxs(sr,{className:"my-sites-table-headers [&_td_[data-slot=badge][data-variant=outline]]:bg-background [&_td]:px-5 [&_th]:px-5 [&_td:first-child]:pl-6 [&_td:first-child]:pr-0 [&_th:first-child]:pl-6 [&_th:first-child]:pr-0 [&_td:nth-child(2)]:pl-3 [&_th:nth-child(2)]:pl-3 [&_td:last-child]:pr-6 [&_th:last-child]:pr-6",children:[e.jsx("caption",{className:"sr-only",children:"Your sites"}),e.jsxs("colgroup",{children:[e.jsx("col",{className:"w-12"})," ",e.jsx("col",{className:"w-full"})," ",e.jsx("col",{className:"w-28"})," ",e.jsx("col",{className:"w-28"})," ",e.jsx("col",{className:"w-52"})," ",e.jsx("col",{className:"w-20"})," ",e.jsx("col",{className:"w-36"})," "]}),e.jsx(rr,{children:e.jsxs(vt,{className:"h-14 bg-muted hover:bg-muted [&>th]:pb-3 [&>th]:align-bottom [&>th]:text-sm [&>th]:font-medium [&>th]:text-ink",children:[e.jsx(Z,{children:e.jsx("span",{className:"sr-only",children:"Site icon"})}),e.jsx(Z,{"aria-sort":ht("domain"),children:e.jsxs("button",{type:"button",onClick:()=>ut("domain"),className:Nt,children:["Domain",e.jsx(xt,{column:"domain"})]})}),e.jsx(Z,{children:"Plan"}),e.jsx(Z,{"aria-sort":ht("endDate"),children:e.jsxs("button",{type:"button",onClick:()=>ut("endDate"),className:Nt,children:["End date",e.jsx(xt,{column:"endDate"})]})}),e.jsx(Z,{children:e.jsxs(Te,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx("span",{className:"cursor-help",children:"Access"})}),e.jsx(Pe,{children:"Domain ownership status and workspace sharing"})]})}),e.jsx(Z,{className:"text-right leading-tight whitespace-normal",children:"Unique visitors"}),e.jsx(Z,{className:"pr-16! text-right",children:"Actions"})]})}),e.jsx(ar,{children:Ne.map(t=>{var Q,xe;const i=Ue(t.url??"",t.expiredAt??"",t.trial??0,ue,t.dunningState,t.planTier),l=mt(t,i),c=t.is_owner&&(i==="Active"||i==="Life Time"),_=c&&!Be,S=St(t.expiredAt),L=!t.is_owner&&!!((Q=t==null?void 0:t.workspaces)!=null&&Q.length);return e.jsxs(vt,{className:k("my-sites-domain-row h-14",L&&"[&>td]:align-top"),children:[e.jsx(ee,{children:e.jsx(Rt,{domain:t.url??"",size:24})}),e.jsx(ee,{className:"font-medium text-ink",children:t.url??""}),e.jsx(ee,{className:"my-sites-plan-status",children:e.jsx(Ut,{status:i,expiredAt:t.expiredAt})}),e.jsx(ee,{children:e.jsx(q,{variant:"outline",children:zt(i,S)})}),e.jsx(ee,{className:"@max-[72rem]/sites:max-w-52",children:e.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[t.is_owner&&e.jsx(q,{variant:"outline",className:"border-success text-success",children:"Owner"}),!t.is_owner&&e.jsx(q,{variant:"outline",className:"max-w-full",title:`Shared by ${t.user_email||"another member"}`,children:e.jsx("span",{className:"truncate",children:`Shared by ${t.user_email||"another member"}`})}),!!((xe=t==null?void 0:t.workspaces)!=null&&xe.length)&&e.jsx(q,{variant:"outline",className:"border-primary text-primary",children:"Workspace"})]})}),e.jsx(ee,{className:"text-right tabular-nums",children:(lt.get(Number(t.id))??0).toLocaleString()}),e.jsx(ee,{className:"my-sites-actions",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[mt(t,i)?e.jsxs(te,{size:"xs",className:"rounded-full px-3 has-[>svg]:px-3",disabled:he,onClick:()=>pt(t),children:[e.jsx(me,{}),he?"Processing...":ie.label]}):e.jsxs(te,{size:"xs",className:"rounded-full px-3 has-[>svg]:px-3",onClick:()=>je(le(t)),children:[e.jsx(_e,{}),"Manage"]}),e.jsxs(Pt,{children:[e.jsxs(Te,{children:[e.jsx(Ae,{asChild:!0,children:e.jsx("span",{className:"inline-flex",children:e.jsx(_t,{className:Et({variant:"ghost",size:"icon-xs"}),"aria-label":`More actions for ${t.url}`,children:e.jsx($t,{className:"size-4"})})})}),e.jsx(Pe,{children:"More actions"})]}),e.jsxs(It,{align:"end",collisionPadding:16,children:[(Y.isAdminOrOwnerOrSuper||t.is_owner)&&e.jsxs(E,{onSelect:()=>Ze(t),children:[e.jsx(Ft,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Change domain"]}),l&&e.jsxs(E,{disabled:he,onSelect:()=>pt(t),children:[e.jsx(me,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),he?"Processing...":ie.label]}),e.jsxs(E,{onSelect:()=>je(le(t,"install")),children:[e.jsx(Lt,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Install widget"]}),e.jsxs(E,{onSelect:()=>je(le(t)),children:[e.jsx(_e,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Site settings"]}),c&&e.jsx(Dt,{}),_&&e.jsxs(E,{onSelect:()=>it(t.id??0,i),children:[e.jsx(pe,{"aria-hidden":"true",className:"h-4 w-4 text-ink"}),"Cancel subscription"]}),c&&e.jsxs(E,{variant:"destructive",onSelect:()=>
38{De(t.id??0),Me(i),ge(!0),ye(!1)},children:[e.jsx(Ot,{"aria-hidden":"true",className:"h-4 w-4"}),"Remove"]})]})]})]})})]},t.id)})})]})})})})}),Re&&e.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-xs z-50 transition-opacity duration-300",onClick:G?void 0:ve,onKeyDown:t=>{t.key==="Escape"&&!G&&ve()},children:e.jsxs("div",{ref:B,role:"dialog","aria-modal":"true","aria-labelledby":"change-domain-title",className:"bg-white rounded-2xl shadow-2xl p-8 w-full max-w-lg mx-4 border border-border",onClick:t=>t.stopPropagation(),style:{boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05)"},children:[e.jsx("h2",{id:"change-domain-title",className:"text-2xl font-bold mb-6 text-gray-800",children:"Change domain"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"new-domain-url",className:"block text-sm font-medium text-gray-700 mb-2",children:"Domain URL"}),e.jsx("input",{id:"new-domain-url",type:"text",autoFocus:!0,value:Fe,onChange:t=>Le(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!G&&et()},placeholder:"e.g. example.com","aria-describedby":"domain-url-hint",className:"w-full px-4 py-3 border-2 border-border rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-all duration-200 hover:border-input"}),e.jsx("p",{id:"domain-url-hint",className:"text-xs text-gray-500 mt-2",children:"Enter the full domain, e.g. example.com"})]}),e.jsx("div",{className:"bg-gray-50 rounded-xl p-4 mb-6",children:e.jsxs("p",{className:"text-gray-600 text-sm text-center",children:["Click ",e.jsx("strong",{className:"text-gray-800",children:"Cancel"})," to return without making any changes."]})}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:ve,className:"px-6 py-3 rounded-xl text-gray-600 hover:text-gray-800 hover:bg-gray-100 transition-all duration-200 font-medium border border-border hover:border-input hover:shadow-xs",disabled:G,children:"Cancel"}),e.jsx("button",{onClick:et,disabled:G,"aria-busy":G,className:`px-6 py-3 rounded-xl text-white transition-all duration-200 flex items-center font-medium shadow-xs hover:shadow-md ${G?"bg-gray-400 cursor-not-allowed":"bg-linear-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 transform hover:scale-105"}`,children:G?e.jsxs(e.Fragment,{children:[e.jsx(Ye,{size:18,sx:{color:"white",marginRight:1},"aria-hidden":"true"}),"Saving..."]}):"Save"})]})]})}),e.jsx("div",{"aria-busy":V||void 0,className:k("space-y-3 pb-6 transition-opacity md:hidden",V&&"opacity-60"),children:W?e.jsx(Ts,{}):K.length===0?e.jsx(gt,{icon:X.icon,title:X.title,description:X.description,action:dt(!0)}):Ne.map(t=>{const i=Ue(t.url??"",t.expiredAt??"",t.trial??0,ue,t.dunningState,t.planTier);return e.jsx(xr,{domain:t,domainStatus:i,endDate:St(t.expiredAt),visitorCount:lt.get(Number(t.id))??0,billingLoading:be,activePlan:ae,tierPlan:tt,appSumoCount:we,codeCount:Oe,appSumoDomains:ue,userData:Y,isAppSumoOrg:rt,isEnterpriseUser:Be,onChangeDomain:Ze,onDelete:(l,c)=>{De(l),Me(c),ge(!0),ye(!1)},onSubscription:at,onOpenActivateModal:nt,onPaymentView:()=>{r(!0),p(),h(t.url??"")},onCancelSubscription:it},t.id)})}),(()=>{var i;const t=U?K.length:((i=m==null?void 0:m.getUserSites)==null?void 0:i.total)||R||H.length;return t>x?e.jsx("div",{className:"w-full overflow-hidden border-border py-4 md:border-t md:px-6",children:e.jsx(yr,{total:t,size:x,onPageChange:l=>{j(l),!(U||l===F)&&se({limit:x,offset:l,filter:z,search:f||void 0})}},`${u}|${f}`)}):null})()]})})]})]})},Lr=({domains:s,setReloadSites:r,customerData:p,refetchSites:h,totalCount:o,openModalSignal:b=0})=>{const[R,d]=a.useState(!1),w=()=>{d(!0)},x=()=>{d(!1),A("yes"),j(!1)},[I,j]=a.useState(!1),[T,A]=a.useState("yes"),f=Rs(()=>ds(()=>import("./addDomainTourSteps-CrdBsCPL.js"),__vite__mapDeps([0,1])).then(u=>u.addDomainTourSteps),[]);a.useEffect(()=>{if(b<=0)return;if(d(!0),!(localStorage.getItem("add_domain_unified_tour_completed")==="true")){const y=setTimeout(()=>{const v=new CustomEvent("startTour",{detail:{tourKey:"add_domain_unified_tour",startStep:1}});window.dispatchEvent(v)},1e3);return()=>clearTimeout(y)}},[b]);const g=()=>{console.log("Add Domain tour completed!")};
38return e.jsxs(e.Fragment,{children:[e.jsx($s,{steps:f,tourKey:Fs.addDomain,autoStart:!1,onTourComplete:g}),e.jsxs("div",{className:"add-domain-container",children:[e.jsx(zs,{allDomains:s,setReloadSites:r,customerData:p,isModalOpen:R,closeModal:x,openModal:w,paymentView:I,setPaymentView:j,optionalDomain:T,hideBanner:!0}),e.jsx(wr,{setReloadSites:r,customerData:p,setPaymentView:j,openModal:w,setOptionalDomain:A,refetchSites:h,totalCount:o})]})]})};export{Lr 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.