1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2305],{12648:(e,t,a)=>{a.d(t,{UC:()=>ea,VY:()=>en,ZL:()=>ee,bL:()=>$,bm:()=>es,hE:()=>er,hJ:()=>et,l9:()=>Q});var r=a(66371),n=a(57980),s=a(72),o=a(29732),d=a(46193),l=a(13529),i=a(69079),c=a(2315),u=a(20532),p=a(5198),f=a(3431),m=a(46259),g=a(10805),h=a(42816),x=a(65698),y=a(69571),w="Dialog",[v,b]=(0,o.A)(w),[j,N]=v(w),R=e=>{let{__scopeDialog:t,children:a,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,c=r.useRef(null),u=r.useRef(null),[p,f]=(0,l.i)({prop:n,defaultProp:null!=s&&s,onChange:o,caller:w});return(0,y.jsx)(j,{scope:t,triggerRef:c,contentRef:u,contentId:(0,d.B)(),titleId:(0,d.B)(),descriptionId:(0,d.B)(),open:p,onOpenChange:f,onOpenToggle:r.useCallback(()=>f(e=>!e),[f]),modal:i,children:a})};R.displayName=w;var C="DialogTrigger",D=r.forwardRef((e,t)=>{let{__scopeDialog:a,...r}=e,o=N(C,a),d=(0,s.s)(t,o.triggerRef);return(0,y.jsx)(f.sG.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":V(o.open),...r,ref:d,onClick:(0,n.mK)(e.onClick,o.onOpenToggle)})});D.displayName=C;var E="DialogPortal",[k,_]=v(E,{forceMount:void 0}),A=e=>{let{__scopeDialog:t,forceMount:a,children:n,container:s}=e,o=N(E,t);return(0,y.jsx)(k,{scope:t,forceMount:a,children:r.Children.map(n,e=>(0,y.jsx)(p.C,{present:a||o.open,children:(0,y.jsx)(u.Z,{asChild:!0,container:s,children:e})}))})};A.displayName=E;var O="DialogOverlay",I=r.forwardRef((e,t)=>{let a=_(O,e.__scopeDialog),{forceMount:r=a.forceMount,...n}=e,s=N(O,e.__scopeDialog);return s.modal?(0,y.jsx)(p.C,{present:r||s.open,children:(0,y.jsx)(S,{...n,ref:t})}):null});I.displayName=O;var F=(0,x.TL)("DialogOverlay.RemoveScroll"),S=r.forwardRef((e,t)=>{let{__scopeDialog:a,...r}=e,n=N(O,a);return(0,y.jsx)(g.A,{as:F,allowPinchZoom:!0,shards:[n.contentRef],children:(0,y.jsx)(f.sG.div,{"data-state":V(n.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),P="DialogContent",L=r.forwardRef((e,t)=>{let a=_(P,e.__scopeDialog),{forceMount:r=a.forceMount,...n}=e,s=N(P,e.__scopeDialog);return(0,y.jsx)(p.C,{present:r||s.open,children:s.modal?(0,y.jsx)(T,{...n,ref:t}):(0,y.jsx)(M,{...n,ref:t})})});L.displayName=P;var T=r.forwardRef((e,t)=>{let a=N(P,e.__scopeDialog),o=r.useRef(null),d=(0,s.s)(t,a.contentRef,o);return r.useEffect(()=>{let e=o.current;if(e)return(0,h.Eq)(e)},[]),(0,y.jsx)(z,{...e,ref:d,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,n.mK)(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null==(t=a.triggerRef.current)||t.focus()}),onPointerDownOutside:(0,n.mK)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,a=0===t.button&&!0===t.ctrlKey;(2===t.button||a)&&e.preventDefault()}),onFocusOutside:(0,n.mK)(e.onFocusOutside,e=>e.preventDefault())})}),M=r.forwardRef((e,t)=>{let a=N(P,e.__scopeDialog),n=r.useRef(!1),s=r.useRef(!1);return(0,y.jsx)(z,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var r,o;null==(r=e.onCloseAutoFocus)||r.call(e,t),t.defaultPrevented||(n.current||null==(o=a.triggerRef.current)||o.focus(),t.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:t=>{var r,o;null==(r=e.onInteractOutside)||r.call(e,t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let d=t.target;(null==(o=a.triggerRef.current)?void 0:o.contains(d))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),z=r.forwardRef((e,t)=>{let{__scopeDialog:a,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:d,...l}=e,u=N(P,a),p=r.useRef(null),f=(0,s.s)(t,p);return(0,m.Oh)(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.n,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:d,children:(0,y.jsx)(i.qW,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":V(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Y,{titleId:u.titleId}),(0,y.jsx)(X,{contentRef:p,descriptionId:u.descriptionId})]})]})}),G="DialogTitle",U=r.forwardRef((e,t)=>
1{let{__scopeDialog:a,...r}=e,n=N(G,a);return(0,y.jsx)(f.sG.h2,{id:n.titleId,...r,ref:t})});U.displayName=G;var W="DialogDescription",q=r.forwardRef((e,t)=>{let{__scopeDialog:a,...r}=e,n=N(W,a);return(0,y.jsx)(f.sG.p,{id:n.descriptionId,...r,ref:t})});q.displayName=W;var B="DialogClose",K=r.forwardRef((e,t)=>{let{__scopeDialog:a,...r}=e,s=N(B,a);return(0,y.jsx)(f.sG.button,{type:"button",...r,ref:t,onClick:(0,n.mK)(e.onClick,()=>s.onOpenChange(!1))})});function V(e){return e?"open":"closed"}K.displayName=B;var H="DialogTitleWarning",[J,Z]=(0,o.q)(H,{contentName:P,titleName:G,docsSlug:"dialog"}),Y=e=>{let{titleId:t}=e,a=Z(H),n="`".concat(a.contentName,"` requires a `").concat(a.titleName,"` for the component to be accessible for screen reader users.\n\nIf you want to hide the `").concat(a.titleName,"`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/").concat(a.docsSlug);return r.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},X=e=>{let{contentRef:t,descriptionId:a}=e,n=Z("DialogDescriptionWarning"),s="Warning: Missing `Description` or `aria-describedby={undefined}` for {".concat(n.contentName,"}.");return r.useEffect(()=>{var e;let r=null==(e=t.current)?void 0:e.getAttribute("aria-describedby");a&&r&&(document.getElementById(a)||console.warn(s))},[s,t,a]),null},$=R,Q=D,ee=A,et=I,ea=L,er=U,en=q,es=K},19829:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(17364).A)("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]])},22907:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(17364).A)("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},89725:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(17364).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},92305:(e,t,a)=>{a.r(t),a.d(t,{default:()=>w});var r=a(69571),n=a(66371),s=a(99651),o=a.n(s),d=a(19829),l=a(22907),i=a(18227);let c=(0,a(17364).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);var u=a(63851),p=a(14854),f=a(93682),m=a(38997),g=a(55036);let h="https://securepubads.g.doubleclick.net/tag/js/gpt.js";async function x(e){return await new Promise((e,t)=>{var a;if(window.googletag=window.googletag||{cmd:[]},window.googletag,"function"==typeof(null==(a=window.googletag)?void 0:a.defineOutOfPageSlot))return void e();let r=document.querySelector('script[src="'.concat(h,'"]'));if(r){r.addEventListener("load",()=>e(),{once:!0}),r.addEventListener("error",()=>t(Error("Failed to load rewarded ads.")),{once:!0});return}let n=document.createElement("script");n.src=h,n.async=!0,n.addEventListener("load",()=>e(),{once:!0}),n.addEventListener("error",()=>t(Error("Failed to load rewarded ads.")),{once:!0}),document.head.appendChild(n)}),new Promise((t,a)=>{let r=window.googletag;if(!r)return void a(Error("Rewarded ads are unavailable."));let n=null,s=!1,o=!1,d=window.setTimeout(()=>{l(!1)},3e4),l=e=>{o||(o=!0,window.clearTimeout(d),n&&"function"==typeof r.destroySlots&&r.destroySlots([n]),t(e))};r.cmd.push(()=>{if(!(n=r.defineOutOfPageSlot(e,r.enums.OutOfPageFormat.REWARDED))){window.clearTimeout(d),a(Error("Rewarded ad slot is not available on this page."));return}let t=e=>!e.slot||e.slot===n;r.pubads().addEventListener("rewardedSlotReady",e=>{var a;t(e)&&(null==(a=e.makeRewardedVisible)||a.call(e))}),r.pubads().addEventListener("rewardedSlotGranted",e=>{t(e)&&(s=!0)}),r.pubads().addEventListener("rewardedSlotClosed",e=>{t(e)&&l(s)}),r.enableServices(),r.display(n)})})}async function y(e){let t=await e.json();if(!e.ok||0!==t.code||!t.data)throw Error(t.message||"Rewarded ad request failed.");return t.data}function w(e){var t,a,s;let{open:h,onOpenChange:w,onRewardGranted:v}=e,b=g.env.NEXT_PUBLIC_REWARDED_AD_UNIT_PATH||"",j=!!b,[N,R]=(0,n.use
1State)(null),[C,D]=(0,n.useState)(!1),[E,k]=(0,n.useState)(null),_=null!=(t=null==N?void 0:N.completed_ads)?t:0,A=null!=(a=null==N?void 0:N.required_ads)?a:3,O=null!=(s=null==N?void 0:N.reward_credits)?s:6,I=Math.min(_/A*100,100),F=Math.min(_+1,A),S=(null==N?void 0:N.status)==="claimed",P=(0,n.useMemo)(()=>S?"".concat(O," credits have been added to your account."):j?"Ads are optional. Closed or skipped ads do not count toward the reward.":"Rewarded ads need a Google rewarded ad unit path before this can run in production.",[j,O,S]),L=async()=>{let e=await fetch("/api/ad-rewards/start",{method:"POST"}),t=await y(e);return R(t),t},T=async e=>{let t=await fetch("/api/ad-rewards/progress",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session_uuid:e.uuid,event_id:"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():"".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2))})}),a=await y(t);R(a.session),a.session.reward_granted&&(u.oR.success("".concat(a.session.reward_credits," credits added.")),await (null==v?void 0:v()))},M=async()=>{if(!C&&!S){if(!j)return void k("Rewarded ads are not configured yet.");D(!0),k(null);try{let e=N||await L();if(!await x(b))return void k("The ad was closed before the reward was granted.");await T(e)}catch(e){k(e instanceof Error?e.message:"Rewarded ad is unavailable.")}finally{D(!1)}}};return(0,r.jsx)(f.lG,{open:h,onOpenChange:w,children:(0,r.jsxs)(f.Cf,{className:"w-[calc(100vw-2rem)] max-w-md rounded-xl p-5 sm:p-6",children:[(0,r.jsxs)(f.c7,{className:"space-y-3 text-left",children:[(0,r.jsx)("div",{className:"flex size-10 items-center justify-center rounded-full bg-primary/10 text-primary",children:(0,r.jsx)(d.A,{className:"size-5"})}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)(f.L3,{className:"text-xl leading-tight",children:"Watch 3 ads for 1 free image"}),(0,r.jsxs)(f.rr,{className:"leading-6",children:["Finish ",A," rewarded ads to get ",O," credits."]})]})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,r.jsxs)("span",{className:"font-medium text-foreground",children:[_,"/",A," completed"]}),(0,r.jsx)("span",{className:"text-muted-foreground",children:S?"Reward added":"".concat(A-_," left")})]}),(0,r.jsx)("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-primary transition-[width] duration-300",style:{width:"".concat(I,"%")}})})]}),(0,r.jsxs)("div",{className:(0,m.cn)("flex gap-2 rounded-lg border p-3 text-sm leading-6",S?"border-primary/25 bg-primary/5 text-foreground":"border-border bg-muted/30 text-muted-foreground"),children:[(0,r.jsx)(l.A,{className:"mt-0.5 size-4 shrink-0 text-primary"}),(0,r.jsx)("span",{children:P})]}),E&&(0,r.jsx)("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive",children:E})]}),(0,r.jsxs)(f.Es,{className:"gap-2 sm:gap-2",children:[(0,r.jsx)(p.$,{variant:"outline",asChild:!0,children:(0,r.jsx)(o(),{href:"/pricing",children:"Buy credits"})}),(0,r.jsx)(p.$,{type:"button",onClick:M,disabled:C||S||!j,children:C?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.A,{className:"mr-2 size-4 animate-spin"}),"Loading ad"]}):S?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.A,{className:"mr-2 size-4"}),"Reward added"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c,{className:"mr-2 size-4"}),"Watch ad ",F,"/",A]})})]})]})})}},93682:(e,t,a)=>{a.d(t,{Cf:()=>u,Es:()=>f,L3:()=>m,c7:()=>p,lG:()=>l,rr:()=>g});var r=a(69571),n=a(66371),s=a(12648),o=a(89725),d=a(38997);let l=s.bL;s.l9;let i=s.ZL;s.bm;let c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,r.jsx)(s.hJ,{ref:t,className:(0,d.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),...n})});c.displayName=s.hJ.displayName;let u=n.forwardRef((e,t)=>{let{className:a,children:n,...l}=e;return(0,r.jsxs)(i,{children:[(0,r.jsx)(c,{}),(0,r.jsxs)(s.UC,{ref:t,className:(0,d.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:rou
1nded-lg",a),...l,children:[n,(0,r.jsxs)(s.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden 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)(o.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=s.UC.displayName;let p=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,d.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};p.displayName="DialogHeader";let f=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,d.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};f.displayName="DialogFooter";let m=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,r.jsx)(s.hE,{ref:t,className:(0,d.cn)("text-lg font-semibold leading-none tracking-tight",a),...n})});m.displayName=s.hE.displayName;let g=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,r.jsx)(s.VY,{ref:t,className:(0,d.cn)("text-sm text-muted-foreground",a),...n})});g.displayName=s.VY.displayName}}]);
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.