1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[447],{3998:(e,t,a)=>{a.d(t,{$:()=>d,r:()=>i});var r=a(95155),s=a(12115),l=a(32467),n=a(83101),o=a(64269);let i=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=s.forwardRef((e,t)=>{let{className:a,variant:s,size:n,asChild:d=!1,...c}=e,u=d?l.DX:"button";return(0,r.jsx)(u,{className:(0,o.cn)(i({variant:s,size:n,className:a})),ref:t,...c})});d.displayName="Button"},11186:(e,t,a)=>{a.d(t,{bq:()=>f,eb:()=>h,gC:()=>x,l6:()=>c,yv:()=>u});var r=a(95155),s=a(12115),l=a(47887),n=a(24033),o=a(12108),i=a(5917),d=a(64269);let c=l.bL;l.YJ;let u=l.WT,f=s.forwardRef((e,t)=>{let{className:a,children:s,...o}=e;return(0,r.jsxs)(l.l9,{ref:t,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-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",a),...o,children:[s,(0,r.jsx)(l.In,{asChild:!0,children:(0,r.jsx)(n.A,{className:"h-4 w-4 opacity-50"})})]})});f.displayName=l.l9.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.PP,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,r.jsx)(o.A,{className:"h-4 w-4"})})});p.displayName=l.PP.displayName;let m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.wn,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,r.jsx)(n.A,{className:"h-4 w-4"})})});m.displayName=l.wn.displayName;let x=s.forwardRef((e,t)=>{let{className:a,children:s,position:n="popper",...o}=e;return(0,r.jsx)(l.ZL,{children:(0,r.jsxs)(l.UC,{ref:t,className:(0,d.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"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:n,...o,children:[(0,r.jsx)(p,{}),(0,r.jsx)(l.LM,{className:(0,d.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,r.jsx)(m,{})]})})});x.displayName=l.UC.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.JU,{ref:t,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...s})}).displayName=l.JU.displayName;let h=s.forwardRef((e,t)=>{let{className:a,children:s,...n}=e;return(0,r.jsxs)(l.q7,{ref:t,className:(0,d.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",a),...n,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(l.VF,{children:(0,r.jsx)(i.A,{className:"h-4 w-4"})})}),(0,r.jsx)(l.p4,{children:s})]})});h.displayName=l.q7.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.wv,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=l.wv.displayName},11647:(e,t,a)=>{a.d(t,{E:()=>o});var r=a(95155);a(12115);var s=a(83101),l=a(64269);let n=(0,s.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function o(e){let{className:t,variant:a,...s}=e;return(0,r.jsx)("div",{className:(0,l.cn)(n({variant:a}),t),...s})}},17037:(e,t,a)=>{a.d(t,{F:()=>o});var r=a(95155),s=a(12115),l=a(59034),n=a(64269);let o=s.forwardRef((e,t)=>{let{className:a,children:s,...o}=e;return(0,r.jsxs)(l.bL,{ref:t,className:(0,n.cn)("relative overflow-hidden",a),...o,children:[(0,r.jsx)(l.LM,{className:"h-full w-full rounded-[inherit]",children:s}),(0,r.jsx)(i,{}),(0,r.jsx)(l.OK,{})]})});o.displayName=l.bL.displayName;let i=s.forwardRef((e,t)=>{let{className:a,orientation:s="vertical",...o}=e;return(0,r.jsx)(l.VM,{ref:t,orientation:s,className:(0,n.cn)("flex touch-none select-none transition-colors","vertical"===s&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...o,children:(0,r.jsx)(l.lr,{className:"relative flex-1 rounded-full bg-border"})})});i.displayName=l.VM.displayName},20243:(e,t,a)=>{a.d(t,{E:()=>l});var r=a(95155),s=a(64269);function l(e){let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,s.cn)("animate-pulse rounded-md bg-muted",t),...a})}},38735:(e,t,a)=>{a.d(t,{Kc:()=>l,WA:()=>s,a_:()=>o,hf:()=>n,lo:()=>c,wx:()=>d});var r=a(79156);let s="admin_panel_mode",l="web",n=e=>"web"===e||"app"===e,o=e=>"web"===e?"profiles":"penny_app_profiles",i=async e=>
1{if("web"===e){let{count:e,error:t}=await r.supabase.from("profiles").select("id",{count:"exact",head:!0});if(t)throw t;return e||0}let{count:t,error:a}=await r.supabase.from("penny_app_profiles").select("id",{count:"exact",head:!0});if(a)throw a;return t||0},d=async e=>{var t;let a=e=>r.supabase.rpc(e),[s,l,n]=await Promise.all([a("get_admin_dashboard_stats"),i(e),Promise.resolve(a("get_potential_penny_count")).then(e=>{let{data:t,error:a}=e;return a?(console.warn("potential pennies unavailable:",a),null):"number"==typeof t?t:null})]);if(s.error)throw s.error;let o=null!=(t=s.data)?t:{};return{totalStores:o.total_stores||0,totalProducts:o.total_products||0,pennyDeals:o.penny_deals||0,potentialPennies:n,activeRuns:o.active_runs||0,totalUsers:l}},c=async(e,t)=>{if("web"===e){let e=t.page*t.pageSize,a=(t.page+1)*t.pageSize-1,s=r.supabase.from("profiles").select("id, email, full_name, subscription_tier, subscription_status, subscription_expires_at, primary_store_id, store_preferences, created_at, city, state, zipcode",{count:"exact"}).order("created_at",{ascending:!1}).range(e,a);t.searchTerm.trim()&&(s=s.or("email.ilike.%".concat(t.searchTerm,"%,full_name.ilike.%").concat(t.searchTerm,"%")));let{data:l,error:n,count:o}=await s;if(n)throw n;return{users:l,totalCount:o||0}}let a=t.page*t.pageSize,s=(t.page+1)*t.pageSize-1,l=r.supabase.from("penny_app_profiles").select("id, email, full_name, primary_store_id, store_preferences, created_at, city, state, zipcode",{count:"exact"}).order("created_at",{ascending:!1}).range(a,s);t.searchTerm.trim()&&(l=l.or("email.ilike.%".concat(t.searchTerm,"%,full_name.ilike.%").concat(t.searchTerm,"%")));let{data:n,error:o,count:i}=await l;if(o)throw o;let d=(n||[]).map(e=>e.id),c=new Map;if(d.length>0){let{data:e,error:t}=await r.supabase.from("penny_app_subscriptions").select("user_id, tier, status, expires_at").in("user_id",d);if(t)throw t;c=new Map((e||[]).map(e=>[e.user_id,{tier:e.tier,status:e.status,expires_at:e.expires_at}]))}return{users:(n||[]).map(e=>{let t=c.get(e.id);return{id:e.id,email:e.email,full_name:e.full_name,subscription_tier:(null==t?void 0:t.tier)||"free",subscription_status:(null==t?void 0:t.status)||"inactive",subscription_expires_at:(null==t?void 0:t.expires_at)||null,primary_store_id:e.primary_store_id,store_preferences:(e=>!e||"object"!=typeof e||Array.isArray(e)?null:e)(e.store_preferences),created_at:e.created_at,city:e.city,state:e.state,zipcode:e.zipcode}}),totalCount:i||0}}},51834:(e,t,a)=>{a.d(t,{Cf:()=>f,Es:()=>m,L3:()=>x,c7:()=>p,lG:()=>i,rr:()=>h,zM:()=>d});var r=a(95155),s=a(12115),l=a(89511),n=a(65229),o=a(64269);let i=l.bL,d=l.l9,c=l.ZL;l.bm;let u=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.hJ,{ref:t,className:(0,o.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",a),...s})});u.displayName=l.hJ.displayName;let f=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;return(0,r.jsxs)(c,{children:[(0,r.jsx)(u,{}),(0,r.jsxs)(l.UC,{ref:t,className:(0,o.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",a),...i,children:[s,(0,r.jsxs)(l.bm,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(n.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});f.displayName=l.UC.displayName;let p=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};p.displayName="DialogHeader";let m=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};m.displayName="DialogFooter";let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.hE,{ref:t,className:(0,o.cn)("text-lg font-semibold leading-none tracking-tight",a),...s})});x.displayName=l.hE.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(l.VY,{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",a),...s})});h.displayName=l.VY.displayName},59850:(e,t,a)=>{a.d(t,{B:()=>r});async function r(e){let{pageSize:t=1e3,maxPages:a=50}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];for(let s=0;s<a;s+=1){let a=s*t,{data:l,error:n}=await e(a,a+t-1);if(n)throw n;let o=null!=l?l:[];if(r.push(...o),o.length<t)return r}throw Error("fetchAllRows: still full after ".concat(a," pages of ").concat(t,". Narrow the query rather than raising the cap."))}},64269:(e,t,a)=>{a.d(t,{cn:()=>l});var r=a(2821),s=a(75889);function l(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.QP)((0,r.$)(t))}},70164:(e,t,a)=>{a.d(t,{hg:()=>l});var r=a(79156);let s=async(e,t,a)=>{let r=Math.ceil(t.length/200),s=[],l=0;for(let n=0;n<t.length;n+=200){let o=t.slice(n,n+200),{data:i,error:d}=await e(o);if(d)return console.error("Failed to load store product counts",d),{completed:!1,loadedChunks:l,totalChunks:r,coveredStoreIds:s,error:d};let c={};for(let e of null!=i?i:[])c[e.store_id]=Number(e.product_count);a(e=>({...e,...c})),l+=1,s.push(...o)}return{completed:!0,loadedChunks:l,totalChunks:r,coveredStoreIds:s,error:null}},l=async(e,t)=>s(async e=>{let{data:t,error:a}=await r.supabase.rpc("get_store_product_counts",{p_store_ids:e});return{data:null!=t?t:null,error:a}},e,t)},85472:(e,t,a)=>{a.d(t,{N_:()=>i,Zp:()=>d,g:()=>o.useParams,ok:()=>u,zy:()=>c});var r=a(95155),s=a(12115),l=a(52619),n=a.n(l),o=a(20063);function i(e){let{to:t,replace:a,...s}=e;return(0,r.jsx)(n(),{href:t,replace:a,...s})}function d(){let e=(0,o.useRouter)();return(0,s.useCallback)((t,a)=>"number"==typeof t?void e.back():(null==a?void 0:a.replace)?void e.replace(t):void e.push(t),[e])}function c(){let e=(0,o.usePathname)(),t=(0,o.useSearchParams)().toString();return(0,s.useMemo)(()=>({pathname:e,search:t?"?".concat(t):"",hash:"",state:null,key:"default"}),[e,t])}function u(){let e=(0,o.useSearchParams)(),t=(0,o.usePathname)(),a=(0,o.useRouter)(),r=e.toString();return[(0,s.useMemo)(()=>new URLSearchParams(r),[r]),(0,s.useCallback)((e,r)=>{let s=function(e,t){let a=t.toString();return a?"".concat(e,"?").concat(a):e}(t,e instanceof URLSearchParams?e:new URLSearchParams(e));if(null==r?void 0:r.replace)return void a.replace(s,{scroll:!1});a.push(s,{scroll:!1})},[t,a])]}},86948:(e,t,a)=>{a.d(t,{BT:()=>d,Wu:()=>c,ZB:()=>i,Zp:()=>n,aR:()=>o});var r=a(95155),s=a(12115),l=a(64269);let n=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",a),...s})});n.displayName="Card";let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",a),...s})});o.displayName="CardHeader";let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",a),...s})});i.displayName="CardTitle";let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",a),...s})});
1d.displayName="CardDescription";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",a),...s})});c.displayName="CardContent",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",a),...s})}).displayName="CardFooter"},87270:(e,t,a)=>{a.d(t,{A0:()=>o,BF:()=>i,Hj:()=>d,XI:()=>n,nA:()=>u,nd:()=>c});var r=a(95155),s=a(12115),l=a(64269);let n=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:(0,l.cn)("w-full caption-bottom text-sm",a),...s})})});n.displayName="Table";let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("thead",{ref:t,className:(0,l.cn)("[&_tr]:border-b",a),...s})});o.displayName="TableHeader";let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("tbody",{ref:t,className:(0,l.cn)("[&_tr:last-child]:border-0",a),...s})});i.displayName="TableBody",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("tfoot",{ref:t,className:(0,l.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...s})}).displayName="TableFooter";let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("tr",{ref:t,className:(0,l.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...s})});d.displayName="TableRow";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("th",{ref:t,className:(0,l.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...s})});c.displayName="TableHead";let u=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("td",{ref:t,className:(0,l.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...s})});u.displayName="TableCell",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("caption",{ref:t,className:(0,l.cn)("mt-4 text-sm text-muted-foreground",a),...s})}).displayName="TableCaption"}}]);
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.