PageSourceSearch

https://scavenger.ai/_next/static/chunks/8629.010e53019dccacb4.js

js scavenger.ai collected 2026-10-05 12:37:55 UTC 36,423 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8629],{11186:(e,a,t)=>{t.d(a,{bq:()=>u,eb:()=>h,gC:()=>f,l6:()=>c,yv:()=>m});var s=t(95155),r=t(12115),l=t(47887),i=t(24033),n=t(12108),d=t(5917),o=t(64269);let c=l.bL;l.YJ;let m=l.WT,u=r.forwardRef((e,a)=>{let{className:t,children:r,...n}=e;return(0,s.jsxs)(l.l9,{ref:a,className:(0,o.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[r,(0,s.jsx)(l.In,{asChild:!0,children:(0,s.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=l.l9.displayName;let p=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.PP,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,s.jsx)(n.A,{className:"h-4 w-4"})})});p.displayName=l.PP.displayName;let x=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.wn,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,s.jsx)(i.A,{className:"h-4 w-4"})})});x.displayName=l.wn.displayName;let f=r.forwardRef((e,a)=>{let{className:t,children:r,position:i="popper",...n}=e;return(0,s.jsx)(l.ZL,{children:(0,s.jsxs)(l.UC,{ref:a,className:(0,o.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:i,...n,children:[(0,s.jsx)(p,{}),(0,s.jsx)(l.LM,{className:(0,o.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,s.jsx)(x,{})]})})});f.displayName=l.UC.displayName,r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.JU,{ref:a,className:(0,o.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...r})}).displayName=l.JU.displayName;let h=r.forwardRef((e,a)=>{let{className:t,children:r,...i}=e;return(0,s.jsxs)(l.q7,{ref:a,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...i,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(l.VF,{children:(0,s.jsx)(d.A,{className:"h-4 w-4"})})}),(0,s.jsx)(l.p4,{children:r})]})});h.displayName=l.q7.displayName,r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.wv,{ref:a,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",t),...r})}).displayName=l.wv.displayName},23327:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(71847).A)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},23664:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(71847).A)("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]])},30579:(e,a,t)=>{t.d(a,{o:()=>r,w:()=>s});let s=e=>["home-profile",e],r=e=>["settings-profile",e]},31120:(e,a,t)=>{t.d(a,{T:()=>i});var s=t(95155),r=t(12115),l=t(64269);let i=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("textarea",{className:(0,l.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...r})});i.displayName="Textarea"},35626:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(71847).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},44846:(e,a,t)=>{t.d(a,{d:()=>n});var s=t(95155),r=t(12115),l=t(27599),i=t(64269);let n=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.bL,{className:(0,i.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:a,children:(0,s.jsx)(l.zi,{className:(0,i.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});n.displayName=l.bL.displayName},51217:(e,a,t)=>{t.d(a,{Uq:()=>r,r0:()=>s});let s="support-chat:open",r=()=>{window.dispatchEvent(new CustomEvent(s))}},69141:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(71847).A)("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]])},85998:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(71847).A)("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]])},86948:(e,a,t)=>{t.d(a,{BT:()=>o,Wu:()=>c,ZB:()=>d,Zp:()=>i,aR:()=>n});var s=t(95155),r=t(12115),l=t(64269);let i=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...r})});i.displayName="Card";let n=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",t),...r})});n.displayName="CardHeader";let d=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("h3",{ref:a,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",t),...r})});d.displayName="CardTitle";let o=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("p",{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",t),...r})});o.displayName="CardDescription";let c=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,l.cn)("p-6 pt-0",t),...r})});c.displayName="CardContent",r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,l.cn)("flex items-center p-6 pt-0",t),...r})}).displayName="CardFooter"},88629:(e,a,t)=>{t.r(a),t.d(a,{default:()=>eL});var s=t(95155),r=t(12115),l=t(85472),i=t(89300),n=t(99776),d=t(53455),o=t(80549),c=t(79156),m=t(1733),u=t(5282),p=t(36423),x=t(35299),f=t(35626),h=t(20508),y=t(23664),g=t(69141),b=t(55136),v=t(21873),j=t(99708),N=t(68854),w=t(23327),k=t(18514),_=t(85998),A=t(46046),C=t(65142),P=t(76444),R=t(44846),z=t(3998),S=t(18720),E=t(11186),q=t(98053),L=t(92556),M=t(94446),F=t(3468),I=t(97602),D=t(72431),Z=t(23558),T=t(66218),G=t(84288),O=t(78108),U=t(76842),H="Radio",[J,K]=(0,F.A)(H),[V,Q]=J(H),$=r.forwardRef((e,a)=>{let{__scopeRadio:t,name:l,checked:i=!1,required:n,disabled:d,value:o="on",onCheck:c,form:m,...u}=e,[p,x]=r.useState(null),f=(0,M.s)(a,e=>x(e)),h=r.useRef(!1),y=!p||m||!!p.closest("form");return(0,s.jsxs)(V,{scope:t,checked:i,disabled:d,children:[(0,s.jsx)(I.sG.button,{type:"button",role:"radio","aria-checked":i,"data-state":X(i),"data-disabled":d?"":void 0,disabled:d,value:o,...u,ref:f,onClick:(0,L.m)(e.onClick,e=>{i||null==c||c(),y&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),y&&(0,s.jsx)(Y,{control:p,bubbles:!h.current,name:l,value:o,checked:i,required:n,disabled:d,form:m,style:{transform:"translateX(-100%)"}})]})});$.displayName=H;var W="RadioIndicator",B=r.forwardRef((e,a)=>{let{__scopeRadio:t,forceMount:r,...l}=e,i=Q(W,t);return(0,s.jsx)(U.C,{present:r||i.checked,children:(0,s.jsx)(I.sG.span,{"data-state":X(i.checked),"data-disabled":i.disabled?"":void 0,...l,ref:a})})});B.displayName=W;var Y=r.forwardRef((e,a)=>{let{__scopeRadio:t,control:l,checked:i,bubbles:n=!0,...d}=e,o=r.useRef(null),c=(0,M.s)(o,a),m=(0,O.Z)(i),u=(0,G.X)(l);return r.useEffect(()=>{let e=o.current;if(!e)return;let a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(m!==i&&a){let t=new Event("click",{bubbles:n});a.call(e,i),e.dispatchEvent(t)}},[m,i,n]),(0,s.jsx)(I.sG.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...d,tabIndex:-1,ref:c,style:{...d.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function X(e){return e?"checked":"unchecked"}Y.displayName="RadioBubbleInput";var ee=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ea="RadioGroup",[et,es]=(0,F.A)(ea,[D.RG,K]),er=(0,D.RG)(),el=K(),[ei,en]=et(ea),ed=r.forwardRef((e,a)=>{let{__scopeRadioGroup:t,name:r,defaultValue:l,value:i,required:n=!1,disabled:d=!1,orientation:o,dir:c,loop:m=!0,onValueChange:u,...p}=e,x=er(t),f=(0,T.jH)(c),[h,y]=(0,Z.i)({prop:i,defaultProp:null!=l?l:null,onChange:u,caller:ea});return(0,s.jsx)(ei,{scope:t,name:r,required:n,disabled:d,value:h,onValueChange:y,children:(0,s.jsx)(D.bL,{asChild:!0,...x,orientation:o,dir:f,loop:m,children:(0,s.jsx)(I.sG.div,{role:"radiogroup","aria-required":n,"aria-orientation":o,"data-disabled":d?"":void 0,dir:f,...p,ref:a})})})});ed.displayName=ea;var eo="RadioGroupItem",ec=r.forwardRef((e,a)=>{let{__scopeRadioGroup:t,disabled:l,...i}=e,n=en(eo,t),d=n.disabled||l,o=er(t),c=el(t),m=r.useRef(null),u=(0,M.s)(a,m),p=n.value===i.value,x=r.useRef(!1);return r.useEffect(()=>{let e=e=>
1{ee.includes(e.key)&&(x.current=!0)},a=()=>x.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",a),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",a)}},[]),(0,s.jsx)(D.q7,{asChild:!0,...o,focusable:!d,active:p,children:(0,s.jsx)($,{disabled:d,required:n.required,checked:p,...c,...i,name:n.name,ref:u,onCheck:()=>n.onValueChange(i.value),onKeyDown:(0,L.m)(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:(0,L.m)(i.onFocus,()=>{var e;x.current&&(null==(e=m.current)||e.click())})})})});ec.displayName=eo;var em=r.forwardRef((e,a)=>{let{__scopeRadioGroup:t,...r}=e,l=el(t);return(0,s.jsx)(B,{...l,...r,ref:a})});em.displayName="RadioGroupIndicator";var eu=t(71847);let ep=(0,eu.A)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var ex=t(64269);let ef=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(ed,{className:(0,ex.cn)("grid gap-2",t),...r,ref:a})});ef.displayName=ed.displayName;let eh=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(ec,{ref:a,className:(0,ex.cn)("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",t),...r,children:(0,s.jsx)(em,{className:"flex items-center justify-center",children:(0,s.jsx)(ep,{className:"h-2.5 w-2.5 fill-current text-current"})})})});eh.displayName=ec.displayName;var ey=t(31120),eg=t(95740),eb=t(53913),ev=t(26497),ej=t(65229);let eN=(0,eu.A)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var ew=t(93499),ek=t(86948),e_=t(13836),eA=t(51217);let eC=e=>{let{isOpen:a,onClose:t}=e,{isPro:r}=(0,e_.R)();return a?(0,s.jsx)(ev.N,{children:(0,s.jsx)(m.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-end justify-center bg-black/60 p-0 backdrop-blur-sm sm:items-center sm:p-4",onClick:t,children:(0,s.jsxs)(m.P.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:25,stiffness:300},onClick:e=>e.stopPropagation(),className:"max-h-[90vh] w-full overflow-y-auto rounded-t-3xl bg-background sm:max-w-lg sm:rounded-3xl",children:[(0,s.jsxs)("div",{className:"relative border-b border-border p-6 pb-4",children:[(0,s.jsx)("button",{onClick:t,className:"absolute right-4 top-4 rounded-full bg-muted/50 p-2 transition-colors hover:bg-muted",children:(0,s.jsx)(ej.A,{className:"h-5 w-5"})}),(0,s.jsx)("h2",{className:"text-xl font-bold text-foreground",children:"Subscription"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Manage your Penny.ai subscription"})]}),(0,s.jsxs)("div",{className:"space-y-4 p-6",children:[(0,s.jsxs)(ek.Zp,{className:r?"border-primary bg-primary/5":"",children:[(0,s.jsx)(ek.aR,{className:"pb-2",children:(0,s.jsxs)(ek.ZB,{className:"flex items-center gap-2 text-lg",children:[(0,s.jsx)(N.A,{className:"h-5 w-5 ".concat(r?"text-primary":"text-muted-foreground")}),r?"Pro Member":"Free Plan"]})}),(0,s.jsx)(ek.Wu,{children:r?(0,s.jsx)("p",{className:"text-sm font-medium text-green-600",children:"All Pro features unlocked ✓"}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Upgrade to Pro to unlock all features and get unlimited penny alerts."})})]}),(0,s.jsxs)(z.$,{variant:"outline",className:"h-12 w-full justify-start gap-3",onClick:()=>{t(),(0,eA.Uq)()},children:[(0,s.jsx)(eN,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"flex-1 text-left",children:"Help Center"}),(0,s.jsx)(ew.A,{className:"h-4 w-4 text-muted-foreground"})]})]})]})})}):null},eP=e=>{var a,t;let{variant:l="default",className:n=""}=e,{isPro:d}=(0,e_.R)(),{user:o}=(0,i.A)(),[c,m]=(0,r.useState)(!1),[u,p]=(0,r.useState)(!1),x=()=>{m(!0)};return d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(z.$,{variant:"outline",size:"compact"===l?"sm":"default",className:"gap-2 ".concat(n),onClick:()=>p(!0),children:[(0,s.jsx)(N.A,{className:"h-4 w-4 text-amber-500"}),(0,s.jsx)("span",{children:"Pro Member"})]}),(0,s.jsx)(eC,{isOpen:u,onClose:()=>p(!1)})]}):"banner"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{onClick:x,className:"flex w-full items-center justify-between rounded-2xl bg-gradient-to-r from-amber-500 to-orange-500 p-4 text-white shadow-lg ".concat(n),children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-white/20",children:(0,s.jsx)(N.A,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{className:"text-left",children:[(0,s.jsx)("div",{className:"font-bold",children:"Upgrade to Pro"}),(0,s.jsx)("div",{className:"text-sm opacity-90",children:"Get unlimited penny alerts"})]})]}),(0,s.jsx)(eg.A,{className:"h-5 w-5"})]}),(0,s.jsx)(eb.j,{isOpen:c,onClose:()=>m(!1),email:null!=(a=null==o?void 0:o.email)?a:void 0})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(z.$,{variant:"compact"===l?"outline":"default",size:"compact"===l?"sm":"default",className:"gap-2 border-0 bg-gradient-to-r from-amber-500 to-orange-500 text-white hover:from-amber-600 hover:to-orange-600 ".concat(n),onClick:x,children:[(0,s.jsx)(N.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{children:"compact"===l?"Pro":"Upgrade to Pro"})]}),(0,s.jsx)(eb.j,{isOpen:c,onClose:()=>m(!1),email:null!=(t=null==o?void 0:o.email)?t:void 0})]})};var eR=t(30579),ez=t(30396),eS=t(46202),eE=t(84547);let eq=[{value:"too_expensive",label:"Too expensive"},{value:"missing_features",label:"Not enough features"},{value:"didnt_know_how",label:"Didn't know how to use it"},{value:"competitor",label:"Moving to a competitor"},{value:"other",label:"Other"}],eL=()=>{let{user:e,isAdmin:a}=(0,i.A)(),{subscriptionStatus:t,subscriptionExpiresAt:L,isPro:M}=(0,e_.R)(),F="cancelled"===t||"pending_cancel"===t,I=(0,l.Zp)(),D=(0,n.jE)(),[Z,T]=(0,r.useState)(!1),[G,O]=(0,r.useState)(!1),[U,H]=(0,r.useState)(""),[J,K]=(0,r.useState)(""),V=""!==U&&("other"!==U||""!==J.trim()),[Q,$]=(0,r.useState)(""),[W,B]=(0,r.useState)(""),[Y,X]=(0,r.useState)(""),[ee,ea]=(0,r.useState)(""),[et,es]=(0,r.useState)(!1),[er,el]=(0,r.useState)({penny_alerts:!0,price_drops:!0}),{data:ei,isLoading:en}=(0,d.I)({queryKey:(0,eR.o)(null==e?void 0:e.id),queryFn:async()=>
1{if(!(null==e?void 0:e.id))return null;let{data:a,error:t}=await c.supabase.from("profiles").select("*").eq("id",e.id).maybeSingle();if(t)throw t;return a},enabled:!!(null==e?void 0:e.id),staleTime:3e5,gcTime:6e5}),{data:ed=[]}=(0,d.I)({queryKey:["stores-list"],queryFn:async()=>{let{data:e,error:a}=await c.supabase.from("stores").select("store_number, name, city, state").eq("status","active").order("state",{ascending:!0}).order("city",{ascending:!0});if(a)throw a;return e},staleTime:18e5,gcTime:36e5});(0,r.useEffect)(()=>{if(ei){$(ei.full_name||""),B(ei.phone||""),X(ei.zipcode||""),ea(ei.primary_store_id||"");let e=ei.store_preferences&&"object"==typeof ei.store_preferences&&!Array.isArray(ei.store_preferences)?ei.store_preferences:null,a=null==e?void 0:e.notifications;a&&"object"==typeof a&&!Array.isArray(a)&&el({penny_alerts:"boolean"!=typeof a.penny_alerts||a.penny_alerts,price_drops:"boolean"!=typeof a.price_drops||a.price_drops})}},[ei]);let eo=(0,o.n)({mutationFn:async()=>{if(!(null==e?void 0:e.id))throw Error("Not authenticated");let t=ee!==(null==ei?void 0:ei.primary_store_id);if(t&&eg)throw Error("Store is locked for 30 days");let s=Y.replace(/\D/g,"").slice(0,5);if(a&&s!==(null==ei?void 0:ei.zipcode)){let{error:e}=await c.supabase.functions.invoke("resolve-zipcode",{body:{zipcode:s}});if(e)throw Error("We couldn't find this ZIP code. Please check and try again.")}let r={full_name:Q.trim(),phone:W,store_preferences:{...(null==ei?void 0:ei.store_preferences)&&"object"==typeof ei.store_preferences&&!Array.isArray(ei.store_preferences)?ei.store_preferences:{},notifications:er},updated_at:new Date().toISOString()};a&&(r.zipcode=s,r.primary_store_id=ee||null),a&&t&&ee&&(r.store_changed_at=new Date().toISOString());let{error:l}=await c.supabase.from("profiles").update(r).eq("id",e.id);if(l)throw l},onSuccess:()=>{D.invalidateQueries({queryKey:(0,eR.o)(null==e?void 0:e.id)}),D.invalidateQueries({queryKey:(0,eR.w)(null==e?void 0:e.id)}),S.oR.success("Settings saved successfully!")},onError:e=>{S.oR.error("We couldn't find this ZIP code. Please check and try again."===e.message?e.message:"Failed to save settings"),console.error(e)}}),ec=async t=>{if(!(null==e?void 0:e.id))throw Error("Not authenticated");(0,eS.vz)(a?null:null==ei?void 0:ei.store_changed_at);let s=(null==ei?void 0:ei.store_preferences)&&"object"==typeof ei.store_preferences&&!Array.isArray(ei.store_preferences)?ei.store_preferences:{},r=(0,eS.AH)(t,s,{changedAt:new Date().toISOString()});if(!r)throw Error("We could not find a store near that location.");let{error:l}=await c.supabase.from("profiles").update({...r,updated_at:new Date().toISOString()}).eq("id",e.id);if(l)throw l;await Promise.all([D.invalidateQueries({queryKey:(0,eR.o)(e.id)}),D.invalidateQueries({queryKey:(0,eR.w)(e.id)})]),es(!1),S.oR.success("Location updated successfully!")},em=async e=>{(0,eS.vz)(a?null:null==ei?void 0:ei.store_changed_at);let{data:t,error:s}=await c.supabase.functions.invoke("resolve-location",{body:e});if(s)throw s;await ec({...e,...t})},eu=async e=>{await ec(e)},ep=ed.find(e=>e.store_number===ee),ex=(0,r.useMemo)(()=>a?(0,eS.Pw)(null):(0,eS.Pw)(null==ei?void 0:ei.store_changed_at),[null==ei?void 0:ei.store_changed_at,a]),eg=ex.isLocked,eb=ex.unlockDate,ev=(0,eS.EQ)(ex),ej=(0,eS.a9)({location_type:null==ei?void 0:ei.location_type,location_latitude:null==ei?void 0:ei.location_latitude,location_longitude:null==ei?void 0:ei.location_longitude,zipcode:null==ei?void 0:ei.zipcode}),eN=!!(null==ei?void 0:ei.primary_store_id);return en?(0,s.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-background",children:(0,s.jsx)(x.A,{className:"h-8 w-8 animate-spin text-primary"})}):(0,s.jsxs)("div",{className:"min-h-screen bg-background",children:[(0,s.jsx)("div",{className:"rounded-b-[2rem] bg-primary px-6 pb-8 pt-4 md:pt-6",children:(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("button",{onClick:()=>I(-1),className:"flex h-10 w-10 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-md",children:(0,s.jsx)(f.A,{size:20})}),(0,s.jsx)("h1",{className:"text-2xl font-black text-white",children:"Settings"})]})}),(0,s.jsxs)("div",{className:"mt-6 grid grid-cols-1 gap-6 px-6 lg:grid-cols-2",children:[(0,s.jsx)(m.P.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},children:(0,s.jsx)(eP,{variant:"banner"})}),(0,s.jsxs)(m.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"rounded-2xl border border-border bg-card p-5 shadow-sm",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10",children:(0,s.jsx)(h.A,{size:20,className:"text-primary"})}),(0,s.jsx)("h2",{className:"text-lg font-bold text-foreground",children:"Profile"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(P.J,{htmlFor:"fullName",className:"text-sm font-medium text-muted-foreground",children:"Full Name"}),(0,s.jsx)(C.p,{id:"fullName",value:Q,onChange:e=>$(e.target.value),placeholder:"Enter your name",className:"h-12 rounded-xl"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(P.J,{htmlFor:"email",className:"text-sm font-medium text-muted-foreground",children:"Email"}),(0,s.jsxs)("div",{id:"email",className:"flex min-h-12 w-full cursor-not-allowed items-center gap-3 rounded-xl border border-input bg-muted/50 px-3 py-3",children:[(0,s.jsx)(y.A,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),(0,s.jsx)("span",{className:"min-w-0 flex-1 break-all text-base font-normal opacity-50 md:text-sm",children:(null==ei?void 0:ei.email)||(null==e?void 0:e.email)||"—"})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(P.J,{htmlFor:"phone",className:"text-sm font-medium text-muted-foreground",children:"Phone Number"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(g.A,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),(0,s.jsx)(C.p,{id:"phone",value:W,onChange:e=>(e=>{/[^\d]/.test(e)&&S.oR.error("Phone number can only contain numbers."),B(e.replace(/\D/g,"").slice(0,10))})(e.target.value),placeholder:"(555) 123-4567",className:"h-12 rounded-xl pl-10"})]})]})]})]}),(0,s.jsxs)(m.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"rounded-2xl border border-border bg-card p-5 shadow-sm",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-blue-500/10",children:(0,s.jsx)(b.A,{size:20,className:"text-blue-500"})}),(0,s.jsx)("h2",{className:"text-lg font-bold text-foreground",children:"Store Preferences"})]}),a?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(P.J,{htmlFor:"zipcode",className:"text-sm font-medium text-muted-foreground",children:"ZIP Code"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.A,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),(0,s.jsx)(C.p,{id:"zipcode",value:Y,onChange:e=>X(e.target.value.replace(/\D/g,"").slice(0,5)),placeholder:"Enter ZIP code",className:"h-12 rounded-xl pl-10",maxLength:5})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(P.J,{className:"text-sm font-medium text-muted-foreground",children:"Primary Store"}),eg&&(0,s.jsxs)("div",{className:"flex items-center gap-1 rounded-full bg-amber-50 px-2 py-1 text-xs text-amber-600",children:[(0,s.jsx)(j.A,{size:12}),(0,s.jsx)("span",{children:"Locked"})]})]}),(0,s.jsxs)(E.l6,{value:ee,onValueChange:ea,disabled:eg,children:[(0,s.jsx)(E.bq,{className:"h-12 rounded-xl ".concat(eg?"cursor-not-allowed opacity-60":""),children:(0,s.jsx)(E.yv,{placeholder:"Select your primary store",children:ep?(0,s.jsxs)("span",{children:[ep.name," - ",ep.city,", ",ep.state]}):"Select your primary store"})}),(0,s.jsx)(E.gC,{className:"max-h-[300px] w-[var(--radix-select-trigger-width)]",children:ed.map(e=>(0,s.jsxs)(E.eb,{value:e.store_number,children:[e.name," - ",e.city,", ",e.state]},e.store_number))})]}),a?(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 p-3",children:[(0,s.jsx)(N.A,{size:16,className:"mt-0.5 flex-shrink-0 text-amber-600"}),(0,s.jsx)("p",{className:"text-xs font-medium text-amber-700",children:"Admin: No store restrictions"})]}):eg&&eb?(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 p-3",children:[(0,s.jsx)(j.A,{size:16,className:"mt-0.5 flex-shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"text-xs",children:[(0,s.jsxs)("p",{className:"font-medium text-amber-800",children:["Store locked until ",(0,u.GP)(eb,"MMM d, yyyy")]}),(0,s.jsxs)("p",{className:"text-amber-600",children:[(0,p.m)(eb)," remaining"]})]})]}):eN?(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-blue-200 bg-blue-50 p-3",children:[(0,s.jsx)(w.A,{size:16,className:"mt-0.5 flex-shrink-0 text-blue-600"}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:"Changing your store will lock it for 30 days"})]}):(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-border bg-muted/50 p-3",children:[(0,s.jsx)(w.A,{size:16,className:"mt-0.5 flex-shrink-0 text-muted-foreground"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Once set, you can change stores every 30 days"})]})]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"rounded-xl bg-muted/50 p-3 text-sm text-muted-foreground",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 font-medium text-foreground",children:[(0,s.jsx)(v.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),(0,s.jsx)("span",{className:"min-w-0 break-words",children:(null==ei?void 0:ei.address_line1)?ei.address_line1:(null==ei?void 0:ei.city)&&(null==ei?void 0:ei.state)?"".concat(ei.city,", ").concat(ei.state):(null==ei?void 0:ei.zipcode)?"ZIP: ".concat(ei.zipcode):"No location set"})]}),!et&&(0,s.jsx)(z.$,{type:"button",variant:"ghost",size:"icon",disabled:eg,onClick:()=>es(!0),className:"h-8 w-8 shrink-0 rounded-lg text-muted-foreground hover:bg-background hover:text-primary","aria-label":"Change location",children:(0,s.jsx)(k.A,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"mt-1 break-words",children:(null==ei?void 0:ei.address_line1)?"".concat(ei.city,", ").concat(ei.state," ").concat(ei.zipcode||"").trim():"ZIP: ".concat((null==ei?void 0:ei.zipcode)||"Not set")}),(null==ei?void 0:ei.primary_store_id)&&(0,s.jsxs)("p",{className:"mt-1",children:["Primary store:"," ",(null==ep?void 0:ep.name)||"Home Depot #".concat(ei.primary_store_id)]})]}),et?ej?(0,s.jsx)(eE.T,{initialZipcode:(null==ei?void 0:ei.zipcode)||"",submitLabel:"Change ZIP",helperText:ev,disabled:eo.isPending||eg,onResolved:eu}):(0,s.jsx)(ez.c,{initialValue:{addressLine1:(null==ei?void 0:ei.address_line1)||"",addressLine2:(null==ei?void 0:ei.address_line2)||"",city:(null==ei?void 0:ei.city)||"",state:(null==ei?void 0:ei.state)||"",zipcode:(null==ei?void 0:ei.zipcode)||"",placeId:(null==ei?void 0:ei.google_place_id)||"",latitude:(null==ei?void 0:ei.location_latitude)||0,longitude:(null==ei?void 0:ei.location_longitude)||0},submitLabel:"Change location",helperText:ev,compactSubmit:!0,disabled:eo.isPending||eg,onResolved:em}):null,eg&&eb&&(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Location locked until ",(0,u.GP)(eb,"MMM d, yyyy")]})]})})]}),(0,s.jsxs)(m.P.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.2},className:"rounded-2xl border border-border bg-card p-5 shadow-sm",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-amber-500/10",children:(0,s.jsx)(_.A,{size:20,className:"text-amber-500"})}),(0,s.jsx)("h2",{className:"text-lg font-bold text-foreground",children:"Notifications"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between py-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium text-foreground",children:"Penny Deal Alerts"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get notified about new penny items"})]}),(0,s.jsx)(R.d,{checked:er.penny_alerts,onCheckedChange:e=>el(a=>({...a,penny_alerts:e}))})]}),(0,s.jsx)("div",{className:"h-px bg-border"}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium text-foreground",children:"Price Drop Alerts"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"When saved items drop in price"})]}),(0,s.jsx)(R.d,{checked:er.price_drops,onCheckedChange:e=>el(a=>({...a,price_drops:e}))})]})]})]}),(0,s.jsxs)(m.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"rounded-2xl border border-border bg-card p-5 shadow-sm lg:col-span-2",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10",children:(0,s.jsx)(N.A,{size:20,className:"text-primary"})}),(0,s.jsx)("h2",{className:"text-lg font-bold text-foreground",children:"Subscription"})]}),M?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium text-foreground",children:"Pro Plan"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:F?"Access until ".concat(L?(0,u.GP)(L,"MMM d, yyyy"):"end of billing period"):"Active subscription"})]}),(0,s.jsx)("span",{className:"rounded-full px-2.5 py-1 text-xs font-semibold ".concat(F?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"),children:F?"Cancelled":"Active"})]}),M&&!F&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"h-px bg-border"}),(0,s.jsxs)(q.Lt,{open:G,onOpenChange:e=>{O(e),e||(H(""),K(""))},children:[(0,s.jsx)(q.tv,{asChild:!0,children:(0,s.jsx)(z.$,{variant:"outline",className:"w-full border-destructive/30 text-destructive hover:bg-destructive/10",children:"Cancel Subscription"})}),(0,s.jsxs)(q.EO,{children:[(0,s.jsxs)(q.wd,{children:[(0,s.jsx)(q.r7,{children:"Sorry to see you go!"}),(0,s.jsx)(q.$v,{children:"Before we cancel, why are you canceling? Your Pro access will continue until the end of your current billing period."})]}),(0,s.jsx)(ef,{value:U,onValueChange:H,className:"gap-3 py-1",children:eq.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eh,{value:e.value,id:"cancel-reason-".concat(e.value)}),(0,s.jsx)(P.J,{htmlFor:"cancel-reason-".concat(e.value),className:"cursor-pointer font-normal",children:e.label})]},e.value))}),"other"===U&&(0,s.jsx)(ey.T,{value:J,onChange:e=>K(e.target.value),placeholder:"Tell us a bit more…",maxLength:500,className:"min-h-[72px]"}),(0,s.jsxs)(q.ck,{children:[(0,s.jsx)(q.Zr,{children:"Keep Subscription"}),(0,s.jsx)(q.Rx,{onClick:async()=>{let a="other"===U?J.trim():null;T(!0);try{let{data:s,error:r}=await c.supabase.functions.invoke("cancel-whop-membership",{body:{reason:U,reason_detail:a}});if(r){var t;let e=null==s?void 0:s.error;if(!e&&(null==(t=r.context)?void 0:t.json))try{let a=await r.context.json();e=null==a?void 0:a.error}catch(e){}throw Error(e||r.message||"Failed to cancel subscription")}if(null==s?void 0:s.error)throw Error(s.error);S.oR.success("Cancellation successful"),D.invalidateQueries({queryKey:["subscription"]}),D.invalidateQueries({queryKey:(0,eR.o)(null==e?void 0:e.id)}),D.invalidateQueries({queryKey:(0,eR.w)(null==e?void 0:e.id)})}catch(e){S.oR.error(e instanceof Error?e.message:"Failed to cancel subscription")}finally{T(!1)}},disabled:Z||!V,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Cancelling..."]}):"Yes, Cancel"})]})]})]})]})]}):(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"You're on the free plan. Upgrade to Pro for unlimited access to all penny deals."}),(0,s.jsx)(eP,{variant:"banner"})]})]}),(0,s.jsx)(m.P.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.4},className:"lg:col-span-2",children:(0,s.jsxs)(z.$,{onClick:()=>Q.trim()?W&&10!==W.length?void S.oR.error("Please enter a valid 10-digit phone number."):void eo.mutate():void S.oR.error("Please enter your name."),disabled:eo.isPending||et,className:"h-14 w-full rounded-2xl bg-primary text-base font-bold hover:bg-primary/90",children:[eo.isPending?(0,s.jsx)(x.A,{className:"mr-2 h-5 w-5 animate-spin"}):(0,s.jsx)(A.A,{className:"mr-2 h-5 w-5"}),eo.isPending?"Saving...":"Save Changes"]})})]})]})}},93499:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(71847).A)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},98053:(e,a,t)=>{t.d(a,{$v:()=>h,EO:()=>u,Lt:()=>d,Rx:()=>y,Zr:()=>g,ck:()=>x,r7:()=>f,tv:()=>o,wd:()=>p});var s=t(95155),r=t(12115),l=t(35646),i=t(64269),n=t(3998);let d=l.bL,o=l.l9,c=l.ZL,m=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.hJ,{className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:a})});m.displayName=l.hJ.displayName;let u=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsxs)(c,{children:[(0,s.jsx)(m,{}),(0,s.jsx)(l.UC,{ref:a,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r})]})});u.displayName=l.UC.displayName;let p=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",a),...t})};p.displayName="AlertDialogHeader";let x=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...t})};x.displayName="AlertDialogFooter";let f=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.hE,{ref:a,className:(0,i.cn)("text-lg font-semibold",t),...r})});f.displayName=l.hE.displayName;let h=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.VY,{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",t),...r})});h.displayName=l.VY.displayName;let y=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.rc,{ref:a,className:(0,i.cn)((0,n.r)(),t),...r})});y.displayName=l.rc.displayName;let g=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(l.ZD,{ref:a,className:(0,i.cn)((0,n.r)({variant:"outline"}),"mt-2 sm:mt-0",t),...r})});g.displayName=l.ZD.displayName},99708:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(71847).A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])}}]);

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.