1import{c as ae,ad as L,r as t,ae as S,j as e,af as b,ag as w,ah as re,ai as te,aj as oe,ak as T,al as ne,am as ie,an as ce,ao as le,w as O,A as de,Z as A,C as I,f as _,g as G,ap as ue,B as pe,i as F,aq as me,h as y,ar as xe,$ as fe,L as he,n as C}from"./index-Bm3D-n5I.js";import{P as ve}from"./progress-3MD1_tC7.js";import{D as ge,a as je,b as ye,c as be,d as Re,e as Ne}from"./dialog-BV1BLgeG.js";import{T as Ce}from"./textarea-CktACBbN.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 we=ae("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var k="Radio",[Se,M]=L(k),[ke,Pe]=Se(k),B=t.forwardRef((a,c)=>{const{__scopeRadio:s,name:l,checked:r=!1,required:o,disabled:n,value:x="on",onCheck:u,form:p,...f}=a,[m,h]=t.useState(null),i=S(c,g=>h(g)),d=t.useRef(!1),v=m?p||!!m.closest("form"):!0;return e.jsxs(ke,{scope:s,checked:r,disabled:n,children:[e.jsx(b.button,{type:"button",role:"radio","aria-checked":r,"data-state":$(r),"data-disabled":n?"":void 0,disabled:n,value:x,...f,ref:i,onClick:w(a.onClick,g=>{r||u==null||u(),v&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})}),v&&e.jsx(z,{control:m,bubbles:!d.current,name:l,value:x,checked:r,required:o,disabled:n,form:p,style:{transform:"translateX(-100%)"}})]})});B.displayName=k;var U="RadioIndicator",q=t.forwardRef((a,c)=>{const{__scopeRadio:s,forceMount:l,...r}=a,o=Pe(U,s);return e.jsx(re,{present:l||o.checked,children:e.jsx(b.span,{"data-state":$(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:c})})});q.displayName=U;var De="RadioBubbleInput",z=t.forwardRef(({__scopeRadio:a,control:c,checked:s,bubbles:l=!0,...r},o)=>{const n=t.useRef(null),x=S(n,o),u=te(s),p=oe(c);return t.useEffect(()=>{const f=n.current;if(!f)return;const m=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==s&&i){const d=new Event("click",{bubbles:l});i.call(f,s),f.dispatchEvent(d)}},[u,s,l]),e.jsx(b.input,{type:"radio","aria-hidden":!0,defaultChecked:s,...r,tabIndex:-1,ref:x,style:{...r.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});z.displayName=De;function $(a){return a?"checked":"unchecked"}var Ee=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],R="RadioGroup",[Ae,Ue]=L(R,[T,M]),K=T(),V=M(),[Ie,_e]=Ae(R),Y=t.forwardRef((a,c)=>{const{__scopeRadioGroup:s,name:l,defaultValue:r,value:o,required:n=!1,disabled:x=!1,orientation:u,dir:p,loop:f=!0,onValueChange:m,...h}=a,i=K(s),d=ne(p),[v,g]=ie({prop:o,defaultProp:r??null,onChange:m,caller:R});return e.jsx(Ie,{scope:s,name:l,required:n,disabled:x,value:v,onValueChange:g,children:e.jsx(ce,{asChild:!0,...i,orientation:u,dir:d,loop:f,children:e.jsx(b.div,{role:"radiogroup","aria-required":n,"aria-orientation":u,"data-disabled":x?"":void 0,dir:d,...h,ref:c})})})});Y.displayName=R;var H="RadioGroupItem",W=t.forwardRef((a,c)=>{const{__scopeRadioGroup:s,disabled:l,...r}=a,o=_e(H,s),n=o.disabled||l,x=K(s),u=V(s),p=t.useRef(null),f=S(c,p),m=o.value===r.value,h=t.useRef(!1);return t.useEffect(()=>{const i=v=>{Ee.includes(v.key)&&(h.current=!0)},d=()=>h.current=!1;return document.addEventListener("keydown",i),document.addEventListener("keyup",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("keyup",d)}},[]),e.jsx(le,{asChild:!0,...x,focusable:!n,active:m,children:e.jsx(B,{disabled:n,required:o.required,checked:m,...u,...r,name:o.name,ref:f,onCheck:()=>o.onValueChange(r.value),onKeyDown:w(i=>{i.key==="Enter"&&i.preventDefault()}),onFocus:w(r.onFocus,()=>{var i;h.current&&((i=p.current)==null||i.click())})})})});W.displayName=H;var Ge="RadioGroupIndicator",Z=t.forwardRef((a,c)=>{const{__scopeRadioGroup:s,...l}=a,r=V(s);return e.jsx(q,{...r,...l,ref:c})});Z.displayName=Ge;var X=Y,J=W,Fe=Z;const Q=t.forwardRef(({className:a,...c},s)=>e.jsx(X,{className:O("grid gap-2",a),...c,ref:s}));Q.displayName=X.displayName;const ee=t.forwardRef(({className:a,...c},s)=>e.jsx(J,{ref:s,className:O("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),...c,children:e.jsx(Fe,{className:"flex items-center justify-center",children:e.jsx(we,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ee.displayName=J.displayName;const Le=["Too expensive","Not enough features","Found a better tool","Not using it enough","Technical issues","Other"];function qe(){const{plan:a,subscribed:c,subscriptionEnd:s,cancelAtPeriodEnd:l,loading:r,monthlyUsed:o,monthlyLimit:n,monthlyRemaining:x,cycleStart:u,cycleEnd:p,createCheckout:f,openPortal:m,cancelSubscription:h}=de(),[i,d]=t.useState(!1),[v,g]=t.useState(""),[P,D]=t.useState(""),[N,E]=t.useState(!1),se=async()=>
6{if(!v){C.error("Please select a reason");return}E(!0);try{await h(v,P||void 0),C.success("Subscription cancelled. You will keep access until the end of your billing period."),d(!1),g(""),D("")}catch(j){C.error("Failed to cancel subscription. Please try again."),console.error(j)}finally{E(!1)}};return r?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(A,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsxs("div",{className:"space-y-6 max-w-2xl",children:[e.jsxs(I,{children:[e.jsx(_,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(G,{className:"text-lg flex items-center gap-2",children:[e.jsx(ue,{className:"h-5 w-5"}),"Subscription"]}),e.jsx(pe,{variant:a==="pro"?"default":"secondary",className:"text-xs",children:a==="pro"?"Pro":"Free"})]})}),e.jsx(F,{className:"space-y-4",children:a==="pro"?e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-md bg-muted border border-border",children:[e.jsx(me,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Subscription cancelling"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Your Pro plan is active until ",s?new Date(s).toLocaleDateString():"end of period",". After that you'll be moved to the Free plan."]})]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You're on the ",e.jsx("span",{className:"font-semibold text-foreground",children:"Pro plan"})," â unlimited applications, Fast speed enabled."]}),s&&!l&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Renews ",new Date(s).toLocaleDateString()]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:l?e.jsx(y,{variant:"outline",size:"sm",onClick:m,children:"Reactivate Subscription"}):e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"outline",size:"sm",onClick:m,children:"Manage Subscription"}),e.jsx(y,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>d(!0),children:"Cancel Subscription"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You're on the ",e.jsx("span",{className:"font-semibold text-foreground",children:"Free plan"})," â ",n," auto-applied applications per month. Discovery, scoring and browsing stay unlimited."]}),e.jsxs(y,{size:"sm",onClick:f,children:[e.jsx(xe,{className:"h-4 w-4 mr-1"}),"Upgrade to Pro â $9.99/mo",e.jsx(fe,{className:"h-4 w-4 ml-1"})]})]})})]}),a==="free"&&e.jsxs(I,{children:[e.jsxs(_,{className:"pb-3",children:[e.jsx(G,{className:"text-lg",children:"Current Cycle Usage"}),u&&p&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[new Date(u+"T00:00:00").toLocaleDateString()," â ",new Date(p+"T00:00:00").toLocaleDateString()]})]}),e.jsxs(F,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1.5",children:[e.jsx("span",{children:"Applications Used"}),e.jsxs("span",{className:"font-medium",children:[o," / ",n]})]}),e.jsx(ve,{value:o/n*100,className:"h-2"})]}),x===0?e.jsxs("p",{className:"text-xs text-destructive",children:["Monthly limit reached â auto-apply is paused",p?` until ${new Date(p+"T00:00:00").toLocaleDateString()}`:"","."]}):e.jsxs("p",{className:"text-xs text-muted-foreground",children:[x," remaining this cycle"]})]})]}),e.jsx(ge,{open:i,onOpenChange:d,children:e.jsxs(je,{children:[e.jsxs(ye,{children:[e.jsx(be,{children:"We're sorry to see you go"}),e.jsx(Re,{children:"Your subscription will remain active until the end of your current billing period. Help us improve by letting us know why you're leaving."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsx(Q,{value:v,onValueChange:g,children:Le.map(j=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ee,{value:j,id:`reason-${j}`}),e.jsx(he,{htmlFor:`reason-${j}`,className:"text-sm cursor-pointer",children:j})]},j))}),e.jsx(Ce,{placeholder:"Any additional feedback? (optional)",value:P,onChange:j=>D(j.target.value),className:"resize-none",rows:3})]}),e.jsxs(Ne,{children:[e.jsx(y,{variant:"outline",onClick:()=>d(!1),disabled:N,children:"Keep My Plan"}),e.jsxs(y,{variant:"destructive",onClick:se,disabled:N,children:[N&&e.jsx(A,{className:"h-4 w-4 animate-spin mr-1"}),"Cancel Subscription"]})]})]})})]})}export{qe 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.