1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6868],{5847:function(e,t,s){Promise.resolve().then(s.bind(s,7452))},7452:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eQ}});var r=s(7437),a=s(2265),l=s(3145),n=s(8706),i=s(6010),o=s(7648),c=s(9376),d=s(970),x=s(4508);let m=(0,a.forwardRef)((e,t)=>{let{className:s,label:a,error:l,...n}=e;return(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[a&&(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-700",children:a}),(0,r.jsx)("input",{ref:t,className:(0,x.cn)("w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-primary-300 focus:border-primary-400 transition-all",l&&"border-red-400 focus:ring-red-200",s),...n}),l&&(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 bg-rose-50 border border-rose-100 rounded-lg",children:[(0,r.jsx)("span",{className:"shrink-0 text-[10px] font-black text-rose-500",children:"â"}),(0,r.jsx)("p",{className:"text-xs text-rose-600 font-medium leading-tight",children:l})]})]})});m.displayName="Input";var u=s(2489),h=s(2208),p=s(7769);function g(e){let{open:t,onClose:s,defaultTab:i="login"}=e,o=(0,n.T)("auth"),g=(0,c.useRouter)(),[f,b]=(0,a.useState)(i),[y,v]=(0,a.useState)(!1),[j,w]=(0,a.useState)(""),[N,k]=(0,a.useState)(!1),[C,D]=(0,a.useState)(""),[S,_]=(0,a.useState)(""),E=()=>{w(""),v(!1),k(!1)},Z=async e=>{e.preventDefault(),E(),v(!0);let t=(0,d.N)(),{error:r}=await t.auth.signInWithPassword({email:C,password:S});if(v(!1),r){w(r.message);return}s()};return t?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:s}),(0,r.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-sm p-7",children:[(0,r.jsx)("button",{onClick:s,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600",children:(0,r.jsx)(u.Z,{className:"w-5 h-5"})}),(0,r.jsxs)("div",{className:"flex justify-center items-center gap-2 mb-5",children:[(0,r.jsx)(l.default,{src:"/logo.png",alt:"Wishlify",width:36,height:36,className:"h-9 w-9"}),(0,r.jsx)("span",{className:"text-xl font-black tracking-tight text-primary-700",children:"Wishlify"})]}),(0,r.jsx)("div",{className:"flex bg-gray-100 rounded-xl p-1 mb-5",children:["login","register"].map(e=>(0,r.jsx)("button",{onClick:()=>{b(e),E()},className:(0,x.cn)("flex-1 text-sm font-semibold py-1.5 rounded-lg transition-all",f===e?"bg-white shadow text-gray-900":"text-gray-500 hover:text-gray-700"),children:"login"===e?o("loginTab"):o("registerTab")},e))}),"login"===f?(0,r.jsxs)("form",{onSubmit:Z,className:"flex flex-col gap-3",children:[(0,r.jsx)(m,{type:"email",required:!0,placeholder:o("emailPlaceholder"),value:C,onChange:e=>D(e.target.value)}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(m,{type:N?"text":"password",required:!0,placeholder:o("passwordPlaceholder"),value:S,onChange:e=>_(e.target.value),className:"pr-10"}),(0,r.jsx)("button",{type:"button",onClick:()=>k(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",tabIndex:-1,children:N?(0,r.jsx)(h.Z,{className:"w-4 h-4"}):(0,r.jsx)(p.Z,{className:"w-4 h-4"})})]}),j&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-rose-50 border border-rose-100 rounded-xl",children:[(0,r.jsx)("span",{className:"shrink-0 text-[10px] font-black text-rose-500",children:"â"}),(0,r.jsx)("p",{className:"text-xs text-rose-600 font-medium",children:j})]}),(0,r.jsx)("button",{type:"submit",disabled:y,className:"w-full bg-primary-600 hover:bg-primary-700 text-white font-semibold text-sm py-2.5 rounded-xl transition-colors disabled:opacity-60",children:y?o("loggingIn"):o("loginBtn")}),(0,r.jsx)("button",{type:"button",onClick:()=>{s(),g.push("/reset-password".concat(C?"?email=".concat(encodeURIComponent(C)):""))},className:"text-xs text-gray-400 hover:text-primary-600 text-center transition-colors mt-1",children:o("forgotPassword")})]}):(0,r.jsxs)("div",{className:"flex flex-col items-center text-center gap-4",children:[(0,r.jsx)("div",{className:"w-16 h-16 bg-primary-50 rounded-2xl flex items-center justify-center text-3xl",children:"\uD83E\uDDE9"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-base font-black text-gray-900 mb-1",children:o("registerTitle")}),(0,r.jsx)("p",{className:"text-sm text-gray-500 leading-relaxed",children:o("registerDesc")})]}),(0,r.jsxs)("a",{href:"https://chrome.google.com/webstore",target:"_blank",rel:"noopener noreferrer",className:"w-full bg-primary-600 hover:bg-primary-700 text-white font-semibold text-sm py-2.5 rounded-xl transition-colors text-center",children:[o("registerGetExtension")," â"]}),(0,r.jsxs)("p",{className:"text-[11px] text-gray-400 leading-relaxed text-center px-2",children:[o("registerConsent")," ",(0,r.jsx)("a",{href:"/terms",target:"_blank",className:"underline hover:text-primary-600",children:o("registerTerms")})," ",o("registerAnd")," ",(0,r.jsx)("a",{href:"/privacy",target:"_blank",className:"underline hover:text-primary-600",children:o("registerPrivacy")}),o("registerConsentAffiliate")]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{b("login"),E()},className:"text-xs text-gray-400 hover:text-primary-600 transition-colors",children:[o("registerAlreadyHave")," ",(0,r.jsx)("span",{className:"underline",children:o("loginTab")})]})]})]})]}):null}var f=s(9397),b=s(7411);let y=(0,b.Z)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var v=s(3073),j=s(9985),w=s(7414),N=s(6439),k=s(2369);let C=(0,b.Z)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);function D(e){var t,s;
1let{profile:c,collections:d,productCounts:x,totalCount:m,activeCollectionId:u,section:h,isGuest:p,onSelectCollection:g,onSelectSection:b,onNewCollection:D,onSignOut:S}=e,_=(0,n.T)("app"),E=(0,i.bU)(),Z=(0,a.useMemo)(()=>[...d].sort((e,t)=>{var s,r;return(null!==(s=x[t.id])&&void 0!==s?s:0)-(null!==(r=x[e.id])&&void 0!==r?r:0)}),[d,x]),T=(e,t,s,a)=>(0,r.jsxs)("button",{onClick:()=>b(e),className:"w-full flex items-center gap-3 px-3 py-2 rounded-xl text-sm transition-colors ".concat(h===e?"bg-primary-50 text-primary-700 font-semibold":"text-gray-600 hover:bg-gray-50"),children:[(0,r.jsx)("span",{className:"shrink-0 ".concat(h===e?"text-primary-600":"text-primary-400"),children:t}),(0,r.jsx)("span",{className:"flex-1 text-left",children:s}),a]},e);return(0,r.jsxs)("aside",{className:"w-64 shrink-0 hidden md:flex flex-col h-full border-r border-gray-100 bg-white",children:[(0,r.jsx)("div",{className:"px-5 py-4 border-b border-gray-100 shrink-0",children:(0,r.jsxs)(o.default,{href:"en"===E?"/en":"/",className:"flex items-center gap-2.5",children:[(0,r.jsx)(l.default,{src:"/logousethis.png",alt:"Wishlify",width:36,height:36,className:"rounded-xl object-cover"}),(0,r.jsxs)("div",{className:"flex flex-col leading-tight",children:[(0,r.jsx)("span",{className:"text-base font-black tracking-tight text-primary-700",children:"Wishlify"}),(0,r.jsx)("span",{className:"text-[10px] text-gray-400",children:"en"===E?"One list for all shopping sites.":"T\xfcm alıÅveriÅ siteleri i\xe7in tek liste."})]})]})}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto py-3 px-2",children:[(0,r.jsxs)("button",{onClick:()=>{g(null),b("collections")},className:"w-full flex items-center justify-between px-3 py-2 text-sm font-semibold rounded-xl transition-colors ".concat("collections"!==h||u?"text-gray-600 hover:bg-gray-50":"bg-primary-50 text-primary-700"),children:[(0,r.jsx)("span",{children:_("allProducts")}),(0,r.jsx)("span",{className:"text-[10px] font-bold bg-gray-100 text-gray-500 px-1.5 py-0.5 rounded-full",children:m})]}),(0,r.jsxs)("div",{className:"mt-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 mb-1",children:[(0,r.jsx)("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wide",children:_("collections")}),(0,r.jsx)("button",{onClick:D,className:"w-5 h-5 flex items-center justify-center rounded text-gray-400 hover:text-primary-600 hover:bg-primary-50 transition-colors",children:(0,r.jsx)(f.Z,{className:"w-3.5 h-3.5"})})]}),Z.map(e=>{var t;return(0,r.jsxs)("button",{onClick:()=>{g(e.id),b("collections")},className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-xl text-sm transition-colors ".concat("collections"===h&&u===e.id?"bg-primary-50 text-primary-700 font-semibold":"text-gray-600 hover:bg-gray-50"),children:[(0,r.jsx)("span",{className:"text-base leading-none shrink-0",children:e.emoji}),(0,r.jsx)("span",{className:"flex-1 truncate text-left",children:e.name}),(0,r.jsx)("span",{className:"text-[10px] font-bold bg-gray-100 text-gray-500 px-1.5 py-0.5 rounded-full shrink-0",children:null!==(t=x[e.id])&&void 0!==t?t:0})]},e.id)}),(0,r.jsxs)("button",{onClick:D,className:"w-full flex items-center gap-2 px-3 py-2 mt-1 rounded-xl text-sm text-primary-600 hover:bg-primary-50 transition-colors font-semibold",children:[(0,r.jsx)(f.Z,{className:"w-4 h-4"}),_("newCollection")," +"]})]})]}),(0,r.jsxs)("div",{className:"border-t border-gray-100 shrink-0",children:[(0,r.jsxs)("div",{className:"px-2 pt-3 pb-1",children:[(0,r.jsx)("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wide px-2 block mb-1",children:_("tools")}),T("sites",(0,r.jsx)(y,{className:"w-4 h-4"}),_("sites")),T("discover",(0,r.jsx)(v.Z,{className:"w-4 h-4"}),_("discover")),!p&&T("links",(0,r.jsx)(j.Z,{className:"w-4 h-4"}),_("links.nav")),!p&&T("events",(0,r.jsx)(w.Z,{className:"w-4 h-4"}),_("events.nav")),!p&&T("announcements",(0,r.jsx)(N.Z,{className:"w-4 h-4"}),_("announcementsNav")),T("profile",(0,r.jsx)(k.Z,{className:"w-4 h-4"}),_("profile"))]}),(0,r.jsxs)("div",{className:"px-3 py-2.5 flex items-center gap-2.5 border-t border-gray-100",children:[(0,r.jsxs)("button",{onClick:()=>b("profile"),className:"flex items-center gap-2.5 flex-1 min-w-0 hover:opacity-80 transition-opacity",children:[(0,r.jsx)("span",{className:"text-xl leading-none shrink-0",children:null!==(t=null==c?void 0:c.avatar)&&void 0!==t?t:"\uD83E\uDDD1"}),(0,r.jsxs)("span",{className:"text-xs font-semibold text-gray-700 truncate",children:["@",null!==(s=null==c?void 0:c.nickname)&&void 0!==s?s:"â¦"]})]}),(0,r.jsx)("button",{onClick:S,title:_("logout"),className:"shrink-0 w-7 h-7 flex items-center justify-center rounded-lg text-gray-300 hover:text-red-500 hover:bg-red-50 transition-colors",children:(0,r.jsx)(C,{className:"w-3.5 h-3.5"})})]})]})]})}var S=s(9202),_=s(6362),E=s(8930),Z=s(7419),T=s(6121);function M(e){let{product:t,currentCollection:s,showCollection:i,onDelete:o,onClick:c}=e,d=(0,n.T)("app"),m=(0,Z.h)(),{showToast:u}=(0,T.p)(),h=(0,a.useRef)(null);return(0,r.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm hover:shadow-md transition-shadow overflow-hidden group flex flex-col",children:[(0,r.jsx)("div",{className:"relative h-44 overflow-hidden cursor-pointer shrink-0",onClick:c,children:t.image_url?(0,r.jsx)("div",{className:"relative w-full h-full bg-gray-50",children:(0,r.jsx)(l.default,{src:t.image_url,alt:t.title,fill:!0,className:"object-contain group-hover:scale-105 transition-transform duration-300 p-2",unoptimized:!0})}):(0,r.jsxs)("div",{className:"w-full h-full flex flex-col items-center justify-center gap-3 bg-gradient-to-br from-slate-50 via-primary-50/50 to-indigo-50",children:[(0,r.jsxs)("div",{className:"absolute top-2.5 right-2.5 flex items-center gap-1 bg-white/80 backdrop-blur-sm border border-gray-200 rounded-full px-2 py-0.5",children:[(0,r.jsx)(S.Z,{className:"w-2.5 h-2.5 text-primary-500"}),(0,r.jsx)("span",{className:"text-[9px] font-semibold text-gray-500",children:d("manualLinkBadge")})]}),(0,r.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-white shadow-md ring-1 ring-black/5 flex items-center justify-center",children:(0,r.jsx)(S.Z,{className:"w-5 h-5 text-primary-500"})}),(0,r.jsxs)("div",{className:"text-center px-4",children:[(0,r.jsx)("p",{className:"text-[11px] font-bold text-gray-600 truncate max-w-[140px]",children:(0,x.g)(t.source_url)}),(0,r.jsx)("p",{className:"text-[10px] text-gray-400 mt-0.5",children:d("manualLink")})]})]})}),(0,r.jsxs)("div",{className:"p-3.5 flex flex-col gap-2 flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-gray-800 line-clamp-2 cursor-pointer hover:text-primary-700 transition-colors leading-snug",onClick:c,children:t.title}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(()=>{let e=(0,x.T)(t.price_value,t.price_currency,t.price_raw);return e?(0,r.jsx)("span",{className:"text-sm font-black text-gray-900 tabular-nums tracking-tight",children:e}):(0,r.jsx)("span",{})})(),(0,r.jsx)("span",{className:"text-[10px] text-gray-400 ml-auto truncate",children:(0,x.g)(t.source_url)})]}),i&&s&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"text-xs leading-none",children:s.emoji}),(0,r.jsx)("span",{className:"text-[10px] font-semibold text-gray-500 truncate",children:s.name})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mt-auto",children:[(0,r.jsxs)("a",{href:m(t.source_url),target:"_blank",rel:"noopener noreferrer sponsored",className:"flex-1 flex items-center justify-center gap-1 bg-primary-50 hover:bg-primary-100 text-primary-700 text-xs font-semibold py-1.5 rounded-lg transition-colors",children:[(0,r.jsx)(_.Z,{className:"w-3 h-3"}),d("goToSite")]}),(0,r.jsx)("button",{onClick:()=>{h.current=setTimeout(()=>
1o(t.id),4e3),u(d("deleted"),"info",()=>{h.current&&clearTimeout(h.current)},4e3,d("undo"))},className:"p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors",title:d("delete"),children:(0,r.jsx)(E.Z,{className:"w-3.5 h-3.5"})})]})]})]})}var P=s(2451),U=s(407),z=s(401),B=s(5675);let L=(0,b.Z)("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);function F(e){let{product:t,collections:s,onClose:i,onDelete:o,onMove:c,onPriceUpdate:d}=e,m=(0,n.T)("app"),h=(0,Z.h)(),[p,g]=(0,a.useState)(0),[f,b]=(0,a.useState)(!1),[y,v]=(0,a.useState)(!1),[j,w]=(0,a.useState)(""),[N,k]=(0,a.useState)(!1);(0,a.useEffect)(()=>{var e;w(null!==(e=null==t?void 0:t.price_raw)&&void 0!==e?e:""),v(!1)},[null==t?void 0:t.id,null==t?void 0:t.price_raw]);let C=(0,a.useMemo)(()=>{if(!t)return[];let e=[],s=t.images;if(Array.isArray(s))e=s.filter(e=>"string"==typeof e);else if("string"==typeof s)try{let t=JSON.parse(s);Array.isArray(t)&&(e=t.filter(e=>"string"==typeof e))}catch(t){e=[]}return Array.from(new Set([t.image_url,...e].filter(Boolean)))},[t]);if(!t)return null;let D=e=>{c(t.id,e),b(!1),i()},S=async()=>{if(!d){v(!1);return}k(!0),await d(t.id,j.trim()),k(!1),v(!1)};return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>{b(!1),i()}}),(0,r.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden flex flex-col",style:{maxHeight:"90vh"},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 shrink-0",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-gray-500 bg-gray-100 px-2.5 py-1 rounded-full truncate max-w-[200px]",children:(0,x.g)(t.source_url)}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium text-gray-400",children:m("affiliateLabel")}),(0,r.jsxs)("a",{href:h(t.source_url),target:"_blank",rel:"noopener noreferrer sponsored",className:"px-3 py-1.5 bg-primary-600 hover:bg-primary-700 text-white text-xs font-semibold rounded-lg transition-colors flex items-center gap-1",children:[(0,r.jsx)(_.Z,{className:"w-3 h-3"}),m("goToSite")]}),(0,r.jsx)("button",{onClick:i,className:"w-7 h-7 flex items-center justify-center rounded-full text-gray-400 hover:bg-gray-100 transition-colors",children:(0,r.jsx)(u.Z,{className:"w-4 h-4"})})]})]}),(0,r.jsx)("div",{className:"relative bg-gray-50 shrink-0",style:{height:220},children:C.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.default,{src:C[p],alt:t.title,fill:!0,className:"object-contain",unoptimized:!0}),C.length>1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>g(e=>(e-1+C.length)%C.length),className:"absolute left-2 top-1/2 -translate-y-1/2 w-7 h-7 bg-white/90 rounded-full flex items-center justify-center shadow text-gray-600 hover:bg-white transition-colors",children:(0,r.jsx)(P.Z,{className:"w-4 h-4"})}),(0,r.jsx)("button",{onClick:()=>g(e=>(e+1)%C.length),className:"absolute right-2 top-1/2 -translate-y-1/2 w-7 h-7 bg-white/90 rounded-full flex items-center justify-center shadow text-gray-600 hover:bg-white transition-colors",children:(0,r.jsx)(U.Z,{className:"w-4 h-4"})}),(0,r.jsx)("div",{className:"absolute bottom-2 left-0 right-0 flex justify-center gap-1",children:C.map((e,t)=>(0,r.jsx)("button",{onClick:()=>g(t),className:"w-1.5 h-1.5 rounded-full transition-all ".concat(t===p?"bg-primary-600 w-3":"bg-gray-400/60")},t))})]})]}):(0,r.jsx)("div",{className:"w-full h-full flex items-center justify-center text-5xl",children:"\uD83D\uDECDï¸"})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-1",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-gray-800 leading-snug flex-1",children:t.title}),d?y?(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,r.jsx)("input",{type:"text",value:j,autoFocus:!0,onChange:e=>w(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&(e.preventDefault(),S()),"Escape"===e.key){var s;v(!1),w(null!==(s=t.price_raw)&&void 0!==s?s:"")}},placeholder:m("priceEditPlaceholder"),className:"w-24 text-sm font-black text-primary-600 bg-primary-50 border border-primary-200 rounded px-2 py-1 outline-none focus:ring-2 focus:ring-primary-300"}),(0,r.jsx)("button",{onClick:()=>void S(),disabled:N,"aria-label":"Save price",className:"w-7 h-7 rounded-full bg-primary-600 text-white flex items-center justify-center shadow-sm hover:bg-primary-700 disabled:opacity-50",children:(0,r.jsx)(z.Z,{className:"w-3.5 h-3.5",strokeWidth:3})})]}):(0,r.jsxs)("button",{onClick:()=>{var e;w(null!==(e=t.price_raw)&&void 0!==e?e:""),v(!0)},title:m("priceEditHint"),className:"group inline-flex items-center gap-1.5 shrink-0 text-sm font-black text-primary-600 hover:bg-primary-50 px-2 py-1 -my-1 -mr-1 rounded-md transition-colors",children:[(0,r.jsx)("span",{children:t.price_raw||m("priceEditEmpty")}),(0,r.jsx)(B.Z,{className:"w-3 h-3 text-primary-400 opacity-60 group-hover:opacity-100 transition-opacity"})]}):t.price_raw&&(0,r.jsx)("span",{className:"text-sm font-black text-primary-600 shrink-0",children:t.price_raw})]})}),(0,r.jsxs)("div",{className:"border-t border-gray-100 px-4 py-3 flex items-center justify-between shrink-0",children:[(0,r.jsxs)("button",{onClick:()=>b(e=>!e),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs text-gray-500 hover:bg-gray-100 hover:text-gray-700 rounded-lg transition-colors font-medium",children:[(0,r.jsx)(L,{className:"w-3.5 h-3.5"}),m("move")]}),(0,r.jsx)("button",{onClick:()=>{o(t.id),i()},className:"px-3 py-1.5 text-xs text-red-500 hover:bg-red-50 rounded-lg transition-colors font-medium",children:m("delete")})]}),(0,r.jsxs)("div",{className:"absolute inset-x-0 bottom-0 bg-white rounded-t-2xl shadow-2xl transition-transform duration-300 z-10",style:{transform:f?"translateY(0)":"translateY(100%)"},children:[(0,r.jsx)("div",{className:"w-8 h-1 bg-gray-200 rounded-full mx-auto mt-3 mb-0.5"}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-gray-800",children:m("moveToCollection")}),(0,r.jsx)("button",{onClick:()=>b(!1),className:"w-6 h-6 flex items-center justify-center rounded-full text-gray-400 hover:bg-gray-100 text-lg",children:"\xd7"})]}),(0,r.jsx)("div",{className:"px-3 pb-4 grid grid-cols-2 gap-2 max-h-52 overflow-y-auto",children:0===s.length?(0,r.jsx)("p",{className:"col-span-2 text-xs text-gray-400 text-center py-4",children:m("noOtherCollections")}):s.map(e=>(0,r.jsxs)("button",{onClick:()=>D(e.id),className:"flex items-center gap-2 px-3 py-2.5 bg-gray-50 hover:bg-primary-50 hover:border-primary-200 border border-gray-100 rounded-xl text-sm font-medium text-gray-700 transition-colors text-left",children:[(0,r.jsx)("span",{className:"text-lg leading-none",children:e.emoji}),(0,r.jsx)("span",{className:"truncate text-xs",children:e.name})]},e.id))})]})]})]})}let A={info:{emoji:"â¹ï¸",iconBg:"bg-sky-100",iconText:"text-sky-600",accent:"text-sky-600"},update:{emoji:"â¨",iconBg:"bg-violet-100",iconText:"text-violet-600",accent:"text-violet-600"},maintenance:{emoji:"\uD83D\uDD27",iconBg:"bg-amber-100",iconText:"text-amber-600",accent:"text-amber-600"},deal:{emoji:"\uD83C\uDF81",iconBg:"bg-rose-100",iconText:"text-rose-600",accent:"text-rose-600"}};function I(){let[e,t]=(0,a.useState)([]),[s,l]=(0,a.useState)(new Set),[n,i]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=()=>{let e=document.querySelector("[data-coupon-notice]");i(e?e.offsetHeight+12:0)};e();let t=new MutationObserver(e);t.observe(document.body,{childList:!0,subtree:!0});let s=()=>e();
1return window.addEventListener("resize",s),()=>{t.disconnect(),window.removeEventListener("resize",s)}},[]),(0,a.useEffect)(()=>{let e=!1;return(async()=>{try{var s;let r=(0,d.N)(),{data:{session:a}}=await r.auth.getSession(),l=null==a?void 0:a.access_token;if(!l)return;let n=await fetch("/api/announcements?mode=unseen-list",{cache:"no-store",headers:{Authorization:"Bearer ".concat(l)}});if(!n.ok||e)return;let i=await n.json(),o=null!==(s=i.announcements)&&void 0!==s?s:[];e||t([...o].reverse())}catch(e){}})(),()=>{e=!0}},[]),(0,a.useEffect)(()=>{if(0===e.length)return;let t=[];return e.forEach((e,s)=>{let r=window.setTimeout(()=>{l(t=>{if(t.has(e.id))return t;let s=new Set(t);return s.add(e.id),s})},1e3*s);t.push(r)}),()=>{t.forEach(window.clearTimeout)}},[e]);let o=e=>{l(t=>{let s=new Set(t);return s.delete(e),s})};return 0===e.length?null:(0,r.jsx)("div",{className:"fixed right-4 sm:right-6 z-[51] flex flex-col-reverse gap-2 max-w-[calc(100vw-2rem)] sm:max-w-sm pointer-events-none transition-all duration-200",style:{bottom:"".concat(16+n,"px")},children:e.map(e=>{let t=s.has(e.id);return(0,r.jsx)("div",{className:t?"pointer-events-auto":"pointer-events-none",children:(0,r.jsx)(R,{announcement:e,open:t,onClose:()=>o(e.id)})},e.id)})})}function R(e){let{announcement:t,open:s,onClose:l}=e,n="en"===(0,i.bU)(),o=A[t.kind],c=n?t.title_en:t.title_tr,d=n?t.body_en:t.body_tr,x=n?t.cta_label_en:t.cta_label_tr,[m,h]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(!s||m)return;let e=window.setTimeout(l,9e3);return()=>window.clearTimeout(e)},[s,m,l]),(0,r.jsx)("div",{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),className:"relative bg-white/95 backdrop-blur-md rounded-xl shadow-lg shadow-black/10 ring-1 ring-black/5 transition-all duration-300 origin-bottom-right ".concat(s?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-1 scale-95"),style:{width:300},children:(0,r.jsxs)("div",{className:"p-3 flex items-start gap-2.5",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-lg ".concat(o.iconBg," flex items-center justify-center shrink-0"),children:(0,r.jsx)("span",{className:"text-sm leading-none",children:o.emoji})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-[13px] font-bold text-gray-900 leading-snug pr-5",children:c}),(0,r.jsx)("p",{className:"text-[11.5px] text-gray-500 leading-relaxed mt-0.5 whitespace-pre-wrap line-clamp-2",children:d}),t.cta_url&&x&&(0,r.jsxs)("a",{href:t.cta_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1.5 inline-flex items-center gap-1 text-[11px] font-bold ".concat(o.accent," hover:underline"),children:[x,(0,r.jsx)(_.Z,{className:"w-2.5 h-2.5"})]})]}),(0,r.jsx)("button",{onClick:l,className:"absolute top-2 right-2 w-5 h-5 flex items-center justify-center rounded-md text-gray-300 hover:text-gray-600 hover:bg-gray-100 transition-colors","aria-label":"Dismiss",children:(0,r.jsx)(u.Z,{className:"w-3 h-3"})})]})})}var O=s(2660);function q(e){let{products:t,collections:s,onDelete:l,onMove:i,onProductClick:o}=e,c=(0,n.T)("app"),[d,x]=(0,a.useState)(null),m=(0,a.useMemo)(()=>{let e=new Map;for(let a of t){var s,r;let t=null!==(s=a.domain)&&void 0!==s?s:"other",l=null!==(r=e.get(t))&&void 0!==r?r:[];l.push(a),e.set(t,l)}return e},[t]),u=(0,a.useMemo)(()=>Array.from(m.entries()).sort((e,t)=>t[1].length-e[1].length),[m]);if(0===t.length)return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[(0,r.jsx)(S.Z,{className:"w-12 h-12 text-gray-200 mb-3"}),(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:c("sitesEmpty")})]});if(d){var h;let e=null!==(h=m.get(d))&&void 0!==h?h:[];return(0,r.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100 flex items-center gap-3 shrink-0",children:[(0,r.jsx)("button",{onClick:()=>x(null),className:"p-1 text-gray-400 hover:text-primary-600 transition-colors",children:(0,r.jsx)(O.Z,{className:"w-4 h-4"})}),(0,r.jsx)("img",{src:"https://www.google.com/s2/favicons?domain=".concat(d,"&sz=24"),className:"w-5 h-5 rounded",alt:""}),(0,r.jsx)("span",{className:"font-bold text-gray-900 text-sm",children:d}),(0,r.jsxs)("span",{className:"text-xs text-gray-400 ml-auto",children:[e.length," ",c("products")]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:(0,r.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 ga
1p-4",children:e.map(e=>(0,r.jsx)(M,{product:e,collections:s.filter(t=>t.id!==e.collection_id),onDelete:l,onMove:i,onClick:()=>o(e)},e.id))})})]})}return(0,r.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"px-6 py-4 border-b border-gray-100 shrink-0",children:[(0,r.jsx)("h2",{className:"font-bold text-gray-900",children:c("sites")}),(0,r.jsxs)("p",{className:"text-xs text-gray-400 mt-0.5",children:[u.length," ",c("siteDomains")]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:(0,r.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:u.map(e=>{let[t,s]=e;return(0,r.jsxs)("button",{onClick:()=>x(t),className:"bg-white rounded-2xl border border-gray-100 shadow-sm hover:shadow-md hover:border-primary-200 p-4 flex items-center gap-3 transition-all text-left",children:[(0,r.jsx)("img",{src:"https://www.google.com/s2/favicons?domain=".concat(t,"&sz=32"),className:"w-8 h-8 rounded-lg shrink-0",alt:t}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-gray-800 truncate",children:t}),(0,r.jsxs)("p",{className:"text-xs text-gray-400",children:[s.length," ",c("products")]})]})]},t)})})})]})}var H=s(2023),W=s(4413),J=s(2720),G=s(6595),Y=s(2449),K=s(3948);let $=/\s+(?:WW|US|UK|EU|BR|AE|SA|KW|RU|TR|DE|CA|AU|JP|CN|MX|IT|FR|ES|NL|PL|KR|IN|HK|SG|TW|AT|BE|CH|CZ|DK|FI|HU|IE|PT|SE|NO|RO|UA|Worldwide|Many\s+GEOs?|Offline\s+codes(?:\s*&\s*links)?|CPA(?:\s+\w+)?|All\s+GEOs?|Online|Codes\s*&\s*links|App)\b.*$/i;function V(e){if(!e)return"";let t=e.replace($,"").trim();return t.length>0?t:e}function Q(e){var t,s;return{id:e.id,name:e.name,brandColor:e.brand_color,siteUrl:e.site_url,logoEmoji:e.logo_emoji,logoImage:null!==(t=e.logo_image)&&void 0!==t?t:void 0,category:e.category,locales:e.locales.filter(e=>"tr"===e||"en"===e),hostPatterns:e.host_patterns.map(e=>{try{return RegExp(e,"i")}catch(e){return/(?!)/}}),deeplinkBase:e.deeplink_base,description:{tr:e.description_tr,en:e.description_en},couponCount:null!==(s=e.coupon_count)&&void 0!==s?s:0,isStarred:!!e.is_starred}}function X(e){let{merchant:t}=e,[s,l]=(0,a.useState)(!1),[n,i]=(0,a.useState)(!1),o="";try{o=new URL(t.siteUrl).hostname.replace(/^www\./,"")}catch(e){}let c=o?"https://www.google.com/s2/favicons?domain=".concat(o,"&sz=128"):"",d=!!t.logoImage&&!s,x=!d&&!!c&&!n;return(0,r.jsxs)("div",{className:"relative w-12 h-12 rounded-xl flex items-center justify-center shrink-0 shadow-sm ring-1 ring-black/5 overflow-hidden bg-white",children:[d&&(0,r.jsx)("img",{src:t.logoImage,alt:t.name,onError:()=>l(!0),className:"w-full h-full object-contain p-1"}),x&&(0,r.jsx)("img",{src:c,alt:t.name,onError:()=>i(!0),className:"w-9 h-9 object-contain"}),!d&&!x&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center text-2xl select-none",style:{backgroundColor:t.brandColor+"20"},children:t.logoEmoji})]})}function ee(e){let{merchant:t,locale:s,categoryLabel:a,visitLabel:l,couponCount:n,couponBadge:i,isStarred:o}=e,c=(0,K.MJ)(t,t.siteUrl),d=t.description[s],x="";try{x=new URL(t.siteUrl).hostname.replace(/^www\./,"")}catch(e){}return(0,r.jsxs)("a",{href:c,target:"_blank",rel:"noopener sponsored",className:"group relative bg-white border border-gray-100 rounded-2xl p-4 hover:border-emerald-300 hover:shadow-md transition-all overflow-hidden flex flex-col h-full min-h-[150px]",children:[(0,r.jsx)("div",{className:"absolute inset-x-0 top-0 h-1 opacity-80",style:{backgroundColor:t.brandColor}}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)(X,{merchant:t}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[o&&(0,r.jsx)(G.Z,{className:"w-3.5 h-3.5 text-amber-500 fill-current shrink-0"}),(0,r.jsx)("h3",{className:"text-base font-black text-gray-900 truncate",children:V(t.name)}),(0,r.jsx)(_.Z,{className:"w-3.5 h-3.5 text-gray-300 group-hover:text-emerald-500 transition shrink-0"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[(0,r.jsx)("span",{className:"inline-block text-[10px] text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded-full font-bold uppercase tracking-wider",children:a}),n>0&&(0,r.jsxs)("a",{href:"#coupons",onClick:e=>e.stopPropagation(),className:"inline-flex items-center gap-1 text-[10px] text-amber-700 bg-amber-50 hover:bg-amber-100 px-2 py-0.5 rounded-full font-bold uppercase tracking-wider transition-colors",children:[(0,r.jsx)(J.Z,{className:"w-2.5 h-2.5"}),i]})]})]})]}),d&&(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-3 leading-relaxed line-clamp-3 flex-1",children:d}),(0,r.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-100 flex items-center justify-between text-[11px]",children:[(0,r.jsx)("span",{className:"text-gray-400 truncate",children:x}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-emerald-600 font-bold shrink-0 group-hover:gap-1.5 transition-all",children:[l,(0,r.jsx)(_.Z,{className:"w-3 h-3"})]})]})]})}
1let et=["general","electronics","fashion","home","beauty","sports","books","grocery"];function es(){let{hideOwnFilter:e,categoryFilter:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=(0,n.T)("app"),l=(0,i.bU)(),[o,c]=(0,a.useState)("all"),d=e?null!=t?t:"all":o,x=(0,a.useRef)(null),[m,u]=(0,a.useState)([]),[h,p]=(0,a.useState)(!1);(0,a.useEffect)(()=>{fetch("/api/merchants",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{var t;u((null!==(t=null==e?void 0:e.merchants)&&void 0!==t?t:[]).map(Q)),p(!0)}).catch(()=>p(!0))},[]);let g=(0,a.useMemo)(()=>m.filter(e=>e.locales.includes(l)),[m,l]),f=(0,a.useMemo)(()=>"all"===d?g:"starred"===d?g.filter(e=>e.isStarred):g.filter(e=>e.category===d),[g,d]),b=(0,a.useMemo)(()=>(function(e){let t=[];for(let s=0;s<e.length;s+=2)t.push(e.slice(s,s+2));return t})(f),[f]),y=(0,a.useMemo)(()=>{let e=new Set;return g.forEach(t=>e.add(t.category)),et.filter(t=>e.has(t))},[g]),v=e=>{var t;null===(t=x.current)||void 0===t||t.scrollBy({left:e,behavior:"smooth"})},j=b.length>3;return(0,r.jsxs)("div",{className:"space-y-4",children:[!e&&y.length>1&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)("button",{onClick:()=>c("all"),className:"px-3 py-1.5 text-xs font-bold rounded-full transition ".concat("all"===d?"bg-emerald-500 text-white shadow-md shadow-emerald-200":"bg-white border border-gray-200 text-gray-600 hover:border-emerald-300 hover:text-emerald-700"),children:s("discoverPartners.categoryAll")}),y.map(e=>(0,r.jsx)("button",{onClick:()=>c(e),className:"px-3 py-1.5 text-xs font-bold rounded-full transition ".concat(d===e?"bg-emerald-500 text-white shadow-md shadow-emerald-200":"bg-white border border-gray-200 text-gray-600 hover:border-emerald-300 hover:text-emerald-700"),children:s("discoverPartners.category_".concat(e))},e))]}),h?f.length>0?(0,r.jsxs)("div",{className:"space-y-3",children:[j&&(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,r.jsx)("button",{onClick:()=>v(-320),"aria-label":"Previous",className:"w-9 h-9 rounded-full bg-white shadow-sm ring-1 ring-gray-200 flex items-center justify-center hover:bg-emerald-50 hover:text-emerald-600 hover:ring-emerald-300 text-gray-500 transition",children:(0,r.jsx)(P.Z,{className:"w-4 h-4"})}),(0,r.jsx)("button",{onClick:()=>v(320),"aria-label":"Next",className:"w-9 h-9 rounded-full bg-white shadow-sm ring-1 ring-gray-200 flex items-center justify-center hover:bg-emerald-50 hover:text-emerald-600 hover:ring-emerald-300 text-gray-500 transition",children:(0,r.jsx)(U.Z,{className:"w-4 h-4"})})]}),(0,r.jsx)("div",{ref:x,className:"flex overflow-x-auto snap-x snap-mandatory gap-4 pb-2 -mx-4 px-4 scroll-px-4 scroll-smooth scrollbar-none overscroll-x-contain touch-pan-x",children:b.map((e,t)=>(0,r.jsxs)("div",{className:"flex-none w-[230px] sm:w-[270px] flex flex-col gap-4 snap-start",children:[e.map(e=>(0,r.jsx)(ee,{merchant:e,locale:l,categoryLabel:s("discoverPartners.category_".concat(e.category)),visitLabel:s("discoverPartners.visitStore"),couponCount:e.couponCount,couponBadge:s("discoverCoupons.merchantBadge",{count:e.couponCount}),isStarred:e.isStarred},e.id)),1===e.length&&(0,r.jsx)("div",{className:"invisible","aria-hidden":!0})]},t))})]}):(0,r.jsxs)("div",{className:"bg-gradient-to-br from-amber-50 to-orange-50 border border-amber-100 rounded-3xl p-8 text-center",children:[(0,r.jsx)("div",{className:"w-14 h-14 mx-auto rounded-2xl bg-amber-100 flex items-center justify-center mb-3",children:(0,r.jsx)(Y.Z,{className:"w-7 h-7 text-amber-600"})}),(0,r.jsx)("h3",{className:"text-sm font-bold text-amber-900",children:"en"===l?"We're onboarding partners":"Yakında daha fazla maÄaza"}),(0,r.jsx)("p",{className:"text-xs text-amber-800/70 mt-2 max-w-sm mx-auto leading-relaxed",children:"en"===l?"No active partners for your region yet. New stores will appear here as soon as we onboard them.":"B\xf6lgen i\xe7in hen\xfcz aktif maÄaza yok. Yeni partnerler eklendik\xe7e burada g\xf6r\xfcnecek. Åimdilik dilediÄin siteden \xfcr\xfcn kaydetmeye devam edebilirsin."})]}):(0,r.jsx)("div",{className:"flex items-center justify-center py-10",children:(0,r.jsx)("div",{className:"w-6 h-6 rounded-full border-2 border-emerald-500 border-t-transparent animate-spin"})})]})}var er=s(8867);function ea(e){var t,s,l;let{coupon:n}=e,[i,o]=(0,a.useState)(!1),c=n.merchants,d=function(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch(e){return""}}(null!==(t=null==c?void 0:c.site_url)&&void 0!==t?t:n.goto_link),x=d?"https://www.google.com/s2/favicons?domain=".concat(d,"&sz=64"):"",m=null!==(s=null==c?void 0:c.brand_color)&&void 0!==s?s:"#9ca3af",u=null!==(l=null==c?void 0:c.logo_emoji)&&void 0!==l?l:"\uD83C\uDFF7ï¸";return(0,r.jsx)("div",{className:"relative w-11 h-11 rounded-xl flex items-center justify-center shrink-0 shadow-sm ring-1 ring-black/5 overflow-hidden bg-white",children:x&&!i?(0,r.jsx)("img",{src:x,alt:"",onError:()=>o(!0),className:"w-7 h-7 object-contain"}):(0,r.jsx)("div",{className:"w-full h-full flex items-center justify-center text-xl",style:{backgroundColor:m+"20"},children:u})})}function el(e){var t,s,a;let{coupon:l,locale:n,t:i,copiedId:o,onCopy:c}=e,d=l.merchants,x=V(null!==(s=null!==(t=null==d?void 0:d.name)&&void 0!==t?t:l.campaign_name)&&void 0!==s?s:"")||i("discoverCoupons.partner
1Store"),m=l.date_end?new Date(l.date_end).toLocaleDateString("en"===n?"en-US":"tr-TR",{day:"numeric",month:"short"}):null,u=o===l.id,h=null!==(a=null==d?void 0:d.brand_color)&&void 0!==a?a:"#f59e0b";return(0,r.jsxs)("div",{className:"relative bg-white border border-gray-100 rounded-2xl p-4 hover:border-amber-300 hover:shadow-md transition-all overflow-hidden flex flex-col gap-2.5 min-h-[170px]",children:[(0,r.jsx)("div",{className:"absolute inset-x-0 top-0 h-1 opacity-80",style:{backgroundColor:h}}),(0,r.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,r.jsx)(ea,{coupon:l}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[l.is_starred&&(0,r.jsx)(G.Z,{className:"w-3 h-3 text-amber-500 fill-current shrink-0"}),(0,r.jsx)("h3",{className:"text-sm font-black text-gray-900 truncate",children:x}),l.exclusive&&(0,r.jsx)("span",{className:"text-[9px] bg-amber-100 text-amber-700 font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-full shrink-0",children:i("discoverCoupons.exclusive")}),!d&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[9px] bg-gray-100 text-gray-500 font-bold uppercase tracking-wider px-1.5 py-0.5 rounded-full shrink-0",children:[(0,r.jsx)(S.Z,{className:"w-2.5 h-2.5"}),i("discoverCoupons.networkDeal")]})]}),l.discount&&(0,r.jsx)("p",{className:"text-base font-black text-amber-600 mt-0.5",children:l.discount})]})]}),(0,r.jsx)("p",{className:"text-[11px] text-gray-600 leading-snug line-clamp-2",children:l.name||l.description||l.campaign_name}),l.promocode?(0,r.jsxs)("button",{onClick:()=>c(l.id,l.promocode),className:"flex items-center justify-between gap-2 px-2.5 py-1.5 bg-amber-50 hover:bg-amber-100 border border-dashed border-amber-300 rounded-lg transition-colors",children:[(0,r.jsx)("span",{className:"text-xs font-black text-amber-900 font-mono truncate",children:l.promocode}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold text-amber-600 shrink-0",children:[u?(0,r.jsx)(z.Z,{className:"w-3 h-3"}):(0,r.jsx)(er.Z,{className:"w-3 h-3"}),i(u?"discoverCoupons.copied":"discoverCoupons.copy")]})]}):(0,r.jsx)("p",{className:"text-[10px] text-gray-400 italic",children:i("discoverCoupons.noCode")}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-[10px] mt-auto pt-1",children:[(0,r.jsx)("span",{className:"text-gray-400 truncate",children:m?i("discoverCoupons.expiresOn",{date:m}):""}),(0,r.jsxs)("a",{href:l.goto_link,target:"_blank",rel:"noopener sponsored",className:"inline-flex items-center gap-0.5 text-emerald-600 font-bold shrink-0 hover:gap-1 transition-all",children:[i("discoverCoupons.visitStore"),(0,r.jsx)(_.Z,{className:"w-2.5 h-2.5"})]})]})]})}function en(){let{categoryFilter:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,n.T)("app"),s=(0,i.bU)(),[l,o]=(0,a.useState)([]),[c,d]=(0,a.useState)(!0),[x,m]=(0,a.useState)(null),u=(0,a.useRef)(null),h=(0,a.useCallback)(async()=>{d(!0);try{var e;let t=await fetch("/api/coupons?locale=".concat(s)),r=await t.json();o(null!==(e=r.coupons)&&void 0!==e?e:[])}finally{d(!1)}},[s]);(0,a.useEffect)(()=>{h()},[h]);let p=(0,a.useMemo)(()=>{if(!e||"all"===e)return l;if("starred"===e)return l.filter(e=>e.is_starred);let t=l.filter(t=>t.merchant_id===e);return t.length>0?t:l.filter(t=>{var s,r;return(null!==(r=null===(s=t.merchants)||void 0===s?void 0:s.category)&&void 0!==r?r:"general")===e})},[l,e]),g=(0,a.useCallback)(async(e,t)=>{try{await navigator.clipboard.writeText(t),m(e),setTimeout(()=>m(null),2e3)}catch(e){}},[]),f=(0,a.useMemo)(()=>(function(e){let t=[];for(let s=0;s<e.length;s+=2)t.push(e.slice(s,s+2));return t})(p),[p]),b=f.length>3,y=e=>{var t;null===(t=u.current)||void 0===t||t.scrollBy({left:e,behavior:"smooth"})};return c?(0,r.jsx)("div",{className:"flex items-center justify-center py-10",children:(0,r.jsx)("div",{className:"w-6 h-6 rounded-full border-2 border-amber-500 border-t-transparent animate-spin"})}):0===p.length?(0,r.jsxs)("div",{className:"bg-gradient-to-br from-amber-50 to-orange-50 border border-amber-100 rounded-3xl p-8 text-center",children:[(0,r.jsx)("div",{className:"w-12 h-12 mx-auto rounded-2xl bg-amber-100 flex items-center justify-center mb-3",children:(0,r.jsx)(H.Z,{className:"w-6 h-6 text-amber-600"})}),(0,r.jsx)("h3",{className:"text-sm font-bold text-amber-900",children:t("discoverCoupons.emptyTitle")}),(0,r.jsx)("p",{className:"text-xs text-amber-800/70 mt-1 max-w-sm mx-auto leading-relaxed",children:t("discoverCoupons.empty
1Desc")})]}):(0,r.jsxs)("div",{className:"space-y-3",children:[b&&(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,r.jsx)("button",{onClick:()=>y(-320),"aria-label":"Previous",className:"w-9 h-9 rounded-full bg-white shadow-sm ring-1 ring-gray-200 flex items-center justify-center hover:bg-amber-50 hover:text-amber-600 hover:ring-amber-300 text-gray-500 transition",children:(0,r.jsx)(P.Z,{className:"w-4 h-4"})}),(0,r.jsx)("button",{onClick:()=>y(320),"aria-label":"Next",className:"w-9 h-9 rounded-full bg-white shadow-sm ring-1 ring-gray-200 flex items-center justify-center hover:bg-amber-50 hover:text-amber-600 hover:ring-amber-300 text-gray-500 transition",children:(0,r.jsx)(U.Z,{className:"w-4 h-4"})})]}),(0,r.jsx)("div",{ref:u,className:"flex overflow-x-auto snap-x snap-mandatory gap-4 pb-2 -mx-4 px-4 scroll-px-4 scroll-smooth scrollbar-none overscroll-x-contain touch-pan-x",children:f.map((e,a)=>(0,r.jsxs)("div",{className:"flex-none w-[260px] sm:w-[300px] flex flex-col gap-4 snap-start",children:[e.map(e=>(0,r.jsx)(el,{coupon:e,locale:s,t:t,copiedId:x,onCopy:g},e.id)),1===e.length&&(0,r.jsx)("div",{className:"invisible","aria-hidden":!0})]},a))})]})}var ei=s(875),eo=s(3247);function ec(e){var t;let{options:s,selectedId:l,onSelect:i,accent:o="#f59e0b"}=e,c=(0,n.T)("app"),[d,x]=(0,a.useState)(!1),[m,h]=(0,a.useState)(""),p=(0,a.useRef)(null),g=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(d)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),setTimeout(()=>{var e;return null===(e=g.current)||void 0===e?void 0:e.focus()},50),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){p.current&&!p.current.contains(e.target)&&x(!1)}function t(e){"Escape"===e.key&&x(!1)}},[d]);let f=null!==(t=s.find(e=>e.id===l))&&void 0!==t?t:null,b=m.trim()?s.filter(e=>V(e.name).toLowerCase().includes(m.toLowerCase())):s;return(0,r.jsxs)("div",{ref:p,className:"relative shrink-0",children:[(0,r.jsx)("button",{onClick:()=>x(e=>!e),className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-bold transition border ".concat(f?"text-white border-transparent shadow-sm":"bg-white border-gray-200 text-gray-600 hover:border-gray-300"),style:f?{backgroundColor:o}:void 0,children:f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-sm leading-none",children:f.logo_emoji}),(0,r.jsx)("span",{className:"max-w-[100px] truncate",children:V(f.name)}),(0,r.jsx)("span",{role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),i(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),i(null))},className:"ml-0.5 -mr-1 inline-flex items-center justify-center w-4 h-4 rounded-full hover:bg-white/20 cursor-pointer","aria-label":"Clear",children:(0,r.jsx)(u.Z,{className:"w-3 h-3"})})]}):(0,r.jsxs)(r.Fragment,{children:[c("discoverPartners.pickStore"),(0,r.jsx)(ei.Z,{className:"w-3 h-3"})]})}),d&&(0,r.jsxs)("div",{className:"absolute top-full left-0 mt-1 w-72 max-w-[calc(100vw-2rem)] bg-white rounded-2xl shadow-xl ring-1 ring-black/5 z-30 overflow-hidden",children:[(0,r.jsxs)("div",{className:"px-3 py-2 border-b border-gray-100 flex items-center gap-2",children:[(0,r.jsx)(eo.Z,{className:"w-3.5 h-3.5 text-gray-400"}),(0,r.jsx)("input",{ref:g,type:"text",value:m,onChange:e=>h(e.target.value),placeholder:c("discoverPartners.searchStore"),className:"flex-1 text-sm outline-none bg-transparent placeholder:text-gray-400"}),m&&(0,r.jsx)("button",{onClick:()=>h(""),className:"text-gray-400 hover:text-gray-700",children:(0,r.jsx)(u.Z,{className:"w-3.5 h-3.5"})})]}),(0,r.jsx)("ul",{className:"max-h-72 overflow-y-auto py-1",children:0===b.length?(0,r.jsx)("li",{className:"px-4 py-6 text-center text-xs text-gray-400",children:c("discoverPartners.noStoreFound")}):b.map(e=>{let t=e.id===l;return(0,r.jsx)("li",{children:(0,r.jsxs)("button",{onClick:()=>{i(e.id),x(!1),h("")},className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-gray-50 transition ".concat(t?"bg-amber-50":""),children:[(0,r.jsx)("span",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-base shrink-0",style:{backgroundColor:e.brand_color+"20"},children:e.logo_emoji}),(0,r.jsx)("span",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-900 truncate",children:V(e.name)}),(0,r.jsx)("span",{className:"text-[10px] font-bold text-gray-400 bg-gray-100 px-1.5 py-0.5 rounded-full shrink-0",children:e.count}),t&&(0,r.jsx)(z.Z,{className:"w-4 h-4 text-amber-500"})]})},e.id)})})]})]})}
1let ed=["general","electronics","fashion","home","beauty","sports","books","grocery"];function ex(){let e=(0,n.T)("app"),t=(0,i.bU)(),[s,l]=(0,a.useState)("stores"),[o,c]=(0,a.useState)("all"),[d,x]=(0,a.useState)(0),[m,u]=(0,a.useState)(0),[h,p]=(0,a.useState)([]),[g,f]=(0,a.useState)([]),[b,y]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1);(0,a.useEffect)(()=>{fetch("/api/merchants").then(e=>e.ok?e.json():null).then(e=>{var s;let r=(null!==(s=null==e?void 0:e.merchants)&&void 0!==s?s:[]).filter(e=>!e.locales||e.locales.includes(t));x(r.length),y(r.some(e=>e.is_starred));let a=new Set;for(let e of r)e.category&&a.add(e.category);p(ed.filter(e=>a.has(e)))}).catch(()=>{}),fetch("/api/coupons/stats?locale=".concat(t)).then(e=>e.ok?e.json():null).then(e=>{var t;return u(null!==(t=null==e?void 0:e.total)&&void 0!==t?t:0)}).catch(()=>{}),fetch("/api/coupons?locale=".concat(t)).then(e=>e.ok?e.json():null).then(e=>{var t,s,r,a;let l=null!==(t=null==e?void 0:e.coupons)&&void 0!==t?t:[];j(l.some(e=>e.is_starred));let n=new Map;for(let e of l){let t=e.merchant_id;if(!t||!e.merchants)continue;let l=n.get(t);l?l.count++:n.set(t,{id:t,name:null!==(s=e.merchants.name)&&void 0!==s?s:t,logo_emoji:null!==(r=e.merchants.logo_emoji)&&void 0!==r?r:"\uD83D\uDECDï¸",brand_color:null!==(a=e.merchants.brand_color)&&void 0!==a?a:"#6b7280",count:1})}f(Array.from(n.values()).sort((e,t)=>t.count-e.count))}).catch(()=>{})},[t]);let w=e=>{l(e),c("all")},N="stores"===s?b:v,k="stores"===s?h.length>0:g.length>0;return(0,r.jsx)("div",{className:"h-full overflow-y-auto",children:(0,r.jsxs)("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 pt-4 sm:pt-6 pb-8 space-y-4 sm:space-y-5",children:[(0,r.jsxs)("section",{className:"relative overflow-hidden rounded-3xl p-5 sm:p-6 text-white shadow-lg transition-colors duration-300 ".concat("stores"===s?"bg-gradient-to-br from-emerald-500 via-teal-500 to-cyan-600":"bg-gradient-to-br from-amber-400 via-orange-500 to-rose-500"),children:[(0,r.jsx)("div",{className:"absolute -top-10 -right-10 w-40 h-40 bg-white/10 rounded-full blur-3xl pointer-events-none"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("div",{className:"inline-flex items-center gap-1.5 bg-white/15 backdrop-blur-md border border-white/20 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider mb-2",children:[(0,r.jsx)(H.Z,{className:"w-3 h-3"}),"stores"===s?e("discoverPartners.eyebrow"):e("discoverCoupons.eyebrow")]}),(0,r.jsx)("h1",{className:"text-xl sm:text-2xl font-black tracking-tight leading-tight",children:"stores"===s?e("discoverPartners.heroTitle"):e("discoverCoupons.heroTitle")}),(0,r.jsx)("p",{className:"mt-1.5 text-xs sm:text-sm text-white/85 leading-relaxed",children:"stores"===s?e("discoverPartners.heroSubtitle"):e("discoverCoupons.heroSubtitle")})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 bg-white border border-gray-100 rounded-2xl p-1.5 shadow-sm",children:[(0,r.jsxs)("button",{onClick:()=>w("stores"),className:"flex-1 inline-flex items-center justify-center gap-1.5 px-3 py-2 rounded-xl text-xs font-bold transition ".concat("stores"===s?"bg-emerald-500 text-white shadow":"text-gray-500 hover:text-emerald-600"),children:[(0,r.jsx)(W.Z,{className:"w-3.5 h-3.5"}),e("discoverPartners.storesTab"),(0,r.jsx)("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded-full ".concat("stores"===s?"bg-white/25 text-white":"bg-gray-100 text-gray-500"),children:d})]}),(0,r.jsxs)("button",{onClick:()=>w("coupons"),className:"flex-1 inline-flex items-center justify-center gap-1.5 px-3 py-2 rounded-xl text-xs font-bold transition ".concat("coupons"===s?"bg-amber-500 text-white shadow":"text-gray-500 hover:text-amber-600"),children:[(0,r.jsx)(J.Z,{className:"w-3.5 h-3.5"}),e("discoverPartners.couponsTab"),(0,r.jsx)("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded-full ".concat("coupons"===s?"bg-white/25 text-white":"bg-gray-100 text-gray-500"),children:m})]})]}),(k||N)&&(0,r.jsx)("div",{className:"flex gap-2 overflow-x-auto scrollbar-none -mx-4 px-4 pb-1 scroll-px-4",children:(()=>{let t="stores"===s?"bg-emerald-500":"bg-amber-500",a=(e,s,a)=>(0,r.jsx)("button",{onClick:()=>c(e),className:"shrink-0 px-3 py-1.5 text-xs font-bold rounded-full transition ".concat(o===e?"".concat(t," text-white shadow-sm"):"bg-white border border-gray-200 text-gray-600 hover:border-gray-300"),children:s},a);return(0,r.jsxs)(r.Fragment,{children:[a("all",e("discoverPartners.categoryAll"),"all"),N&&a("starred",(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(G.Z,{className:"w-3 h-3 ".concat("starred"===o?"fill-current":"fill-amber-400 text-amber-400")}),e("discoverPartners.starred")]}),"starred"),"stores"===s&&h.map(t=>a(t,e("discoverPartners.category_".concat(t)),t))]})})()}),"coupons"===s&&g.length>0&&(0,r.jsx)("div",{className:"flex",children:(0,r.jsx)(ec,{options:g,selectedId:"all"!==o&&"starred"!==o?o:null,onSelect:e=>c(null!=e?e:"all"),accent:"#f59e0b"})}),"stores"===s?(0,r.jsx)(es,{categoryFilter:o,hideOwnFilter:!0}):(0,r.jsx)(en,{categoryFilter:o}),(0,r.jsx)("p",{className:"text-[10px] text-gray-400 leading-relaxed text-center pt-2",children:"en"===t?"These links contain affiliate tracking. Wishlify may earn a small commission at no extra cost to you.":"Bu baÄlantılar gelir ortaklıÄı i\xe7erir. Wishlify \xfczerinden alıÅveriÅ yaparsan bize destek olmuÅ olursun, sana ek \xfccreti yansımaz."})]})})}let em="wishlify_coupon_notice_dismissed_at";function eu(e){let{onView:t}=e,s=(0,n.T)("app"),l=(0,i.bU)(),[o,c]=(0,a.useState)(0),[d,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{try{var e;let t=parseInt(null!==(e=localStorage.getItem(em))&&void 0!==e?e:"0",10);if(Date.now()-t<864e5)return}catch(e){}let t=!0;return fetch("/api/coupons/stats?locale=".concat(l)).then(e=>e.ok?e.json():null).then(e=>{var s;if(!t)return;let r=null!==(s=null==e?void 0:e.total)&&void 0!==s?s:0;r>0&&(c(r),setTimeout(()=>t&&x(!0),600))}).catch(()=>{}),()=>{t=!1}},[l]);let m=()=>{x(!1);try{localStorage.setItem(em,String(Date.now()))}catch(e){}};return d&&0!==o?(0,r.jsx)("div",{"data-coupon-notice":!0,className:"fixed bottom-4 right-4 sm:bottom-6 sm:right-6 z-50 max-w-[300px] animate-modal-in",children:(0,r.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl ring-1 ring-black/5 overflow-hidden",children:[(0,r.jsxs)("div",{className:"relative bg-gradient-to-br from-amber-400 via-orange-500 to-rose-500 px-4 pt-4 pb-3",children:[(0,r.jsx)("button",{onClick:m,className:"absolute top-2 right-2 p-1 text-white/70 hover:text-white","aria-label":"Dismiss",children:(0,r.jsx)(u.Z,{className:"w-3.5 h-3.5"})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-xl bg-white/20 backdrop-blur-md flex items-center justify-center",children:(0,r.jsx)(J.Z,{className:"w-4 h-4"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-black leading-tight",children:s("discoverCoupons.toastTitle",{count:o})}),(0,r.jsx)("p",{className:"text-[11px] text-white/85 leading-snug mt-0.5",children:s("discoverCoupons.toastDesc")})]})]})]}),(0,r.jsxs)("button",{onClick:()=>{m(),t()},className:"block w-full text-center px-4 py-2.5 text-xs font-bold text-amber-700 hover:bg-amber-50 transition-colors",children:[s("discoverCoupons.toastCta")," â"]})]})}):null}var eh=s(5998);function ep(){let e=(0,n.T)("app"),t=(0,i.bU)(),[s,l]=(0,a.useState)([]),[o,c]=(0,a.useState)({total_links:0,total_products:0}),[d,x]=(0,a.useState)(!0),[m,u]=(0,a.useState)(null),[h,p]=(0,a.useState)(null),[g,f]=(0,a.useState)(null),b=(0,a.useCallback)(async()=>{x(!0);let e=await fetch("/api/share/list"),t=await e.json();t.links&&l(t.links),t.stats&&c(t.stats),x(!1)},[]);(0,a.useEffect)(()=>{b()},[b]);let y=e=>"".concat(e,"?lang=").concat(t),v=async e=>{let t=y(e.url);try{await navigator.clipboard.writeText(t)}
1catch(s){let e=document.createElement("textarea");e.value=t,e.style.cssText="position:fixed;opacity:0;pointer-events:none;",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e)}u(e.id),setTimeout(()=>u(null),2e3)},w=async e=>{f(null),p(e),await fetch("/api/share/revoke/".concat(e),{method:"DELETE"}),l(t=>t.filter(t=>t.id!==e)),c(e=>({...e,total_links:Math.max(0,e.total_links-1)})),p(null)},N=e=>new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});return(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 py-5",children:[(0,r.jsxs)("div",{className:"max-w-2xl mx-auto space-y-4",children:[(0,r.jsxs)("div",{className:"rounded-2xl p-5 bg-gradient-to-br from-primary-600 to-primary-700 text-white",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"text-3xl shrink-0",children:"\uD83D\uDD17"}),(0,r.jsx)("div",{className:"flex-1 min-w-0",children:o.total_links>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"font-bold text-base leading-snug mb-0.5",children:e("links.statTitle",{links:o.total_links,products:o.total_products})}),(0,r.jsx)("p",{className:"text-primary-100 text-xs leading-relaxed",children:e("links.statSub")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"font-bold text-base leading-snug mb-0.5",children:e("links.emptyNoteTitle")}),(0,r.jsx)("p",{className:"text-primary-100 text-xs leading-relaxed",children:e("links.emptyNoteSub")})]})})]}),(0,r.jsxs)("a",{href:"https://chrome.google.com/webstore",target:"_blank",rel:"noopener noreferrer",className:"mt-4 inline-flex items-center gap-1.5 px-4 py-2 bg-white/20 hover:bg-white/30 rounded-xl text-sm font-semibold transition-colors",children:[(0,r.jsx)(G.Z,{className:"w-3.5 h-3.5"}),e("links.reviewBtn")]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-bold text-gray-700",children:e("links.activeLinks")}),s.length>0&&(0,r.jsx)("span",{className:"text-xs text-gray-400",children:e("links.linkCount",{count:s.length})})]}),d&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)("div",{className:"w-6 h-6 rounded-full border-2 border-primary-600 border-t-transparent animate-spin"})}),!d&&0===s.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)(j.Z,{className:"w-12 h-12 text-gray-200 mb-3"}),(0,r.jsx)("p",{className:"text-gray-500 text-sm font-medium",children:e("links.noLinks")}),(0,r.jsx)("p",{className:"text-gray-400 text-xs mt-1 max-w-xs",children:e("links.noLinksDesc")})]}),!d&&s.map(t=>(0,r.jsxs)("div",{className:"bg-white border border-gray-100 rounded-2xl shadow-sm overflow-hidden",children:[(0,r.jsxs)("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-2xl shrink-0",children:t.collection_emoji}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"font-semibold text-sm text-gray-900 truncate",children:t.collection_name}),(0,r.jsxs)("p",{className:"text-xs text-gray-400 mt-0.5",children:[e("links.products",{count:t.product_count})," \xb7 ",e("links.views",{count:t.view_count})," \xb7 ",e("links.expires",{date:N(t.expires_at)})]})]})]}),(0,r.jsxs)("div",{className:"px-4 pb-3.5 flex items-center gap-2",children:[(0,r.jsx)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-xl px-3 py-2 text-xs text-gray-500 font-mono truncate cursor-pointer",onClick:()=>v(t),children:y(t.url)}),(0,r.jsxs)("button",{onClick:()=>v(t),className:"shrink-0 flex items-center gap-1.5 px-3 py-2 rounded-xl text-xs font-semibold transition-colors ".concat(m===t.id?"bg-green-100 text-green-700":"bg-primary-50 hover:bg-primary-100 text-primary-700"),children:[m===t.id?(0,r.jsx)(z.Z,{className:"w-3.5 h-3.5"}):(0,r.jsx)(er.Z,{className:"w-3.5 h-3.5"}),m===t.id?e("links.copied"):e("links.copy")]}),(0,r.jsx)("button",{onClick:()=>f(t),disabled:h===t.id,className:"shrink-0 p-2 text-gray-300 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors disabled:opacity-40",title:e("links.revoke"),children:(0,r.jsx)(E.Z,{className:"w-4 h-4"})})]})]},t.id))]}),(0,r.jsx)(eh.u,{open:!!g,onClose:()=>f(null),children:(0,r.jsxs)("div",{className:"flex flex-col items-center text-center px-2 pb-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 roun
1ded-2xl bg-red-100 flex items-center justify-center mb-4",children:(0,r.jsx)("span",{className:"text-3xl",children:"\uD83D\uDDD1ï¸"})}),(0,r.jsx)("h3",{className:"text-base font-black text-gray-900 mb-1",children:e("links.revokeConfirmTitle")}),g&&(0,r.jsxs)("p",{className:"text-xs text-primary-600 font-semibold mb-3 bg-primary-50 px-3 py-1 rounded-full",children:[g.collection_emoji," ",g.collection_name]}),(0,r.jsx)("p",{className:"text-sm text-gray-500 leading-relaxed mb-6",children:e("links.revokeConfirmDesc")}),(0,r.jsxs)("div",{className:"flex gap-3 w-full",children:[(0,r.jsx)("button",{onClick:()=>f(null),className:"flex-1 py-2.5 rounded-xl border border-gray-200 text-sm font-semibold text-gray-600 hover:bg-gray-50 transition-colors",children:e("links.revokeConfirmNo")}),(0,r.jsx)("button",{onClick:()=>g&&w(g.id),disabled:!!h,className:"flex-1 py-2.5 rounded-xl bg-red-500 hover:bg-red-600 text-white text-sm font-semibold transition-colors disabled:opacity-50",children:h?"...":e("links.revokeConfirmYes")})]})]})})]})}let eg=(0,b.Z)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),ef=(0,b.Z)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var eb=s(1047),ey=s(3774),ev=s(5805);let ej=[{value:"birthday",emoji:"\uD83C\uDF82"},{value:"wedding",emoji:"\uD83D\uDC8D"},{value:"baby_shower",emoji:"\uD83D\uDC76"},{value:"graduation",emoji:"\uD83C\uDF93"},{value:"housewarming",emoji:"\uD83C\uDFE0"},{value:"anniversary",emoji:"\uD83D\uDC9D"},{value:"engagement",emoji:"\uD83D\uDC90"},{value:"retirement",emoji:"\uD83C\uDF89"},{value:"custom",emoji:"â¨"}];function ew(){let e=new Date;e.setDate(e.getDate()+14),e.setHours(19,0,0,0);let t=e=>String(e).padStart(2,"0");return"".concat(e.getFullYear(),"-").concat(t(e.getMonth()+1),"-").concat(t(e.getDate()),"T").concat(t(e.getHours()),":").concat(t(e.getMinutes()))}function eN(e){let{open:t,onClose:s,onCreated:l,collectionId:o,collectionName:c,collectionEmoji:d}=e,x=(0,n.T)("app"),m=(0,i.bU)(),[u,g]=(0,a.useState)(""),[f,b]=(0,a.useState)("birthday"),[y,v]=(0,a.useState)(ew()),[j,w]=(0,a.useState)(""),[N,k]=(0,a.useState)(""),[C,D]=(0,a.useState)(""),[S,_]=(0,a.useState)(!1),[E,Z]=(0,a.useState)(!1),[T,M]=(0,a.useState)(""),[P,U]=(0,a.useState)(null),[B,L]=(0,a.useState)(""),[F,A]=(0,a.useState)(""),[I,R]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(g(""),b("birthday"),v(ew()),w(""),k(""),D(""),_(!1),L(""),A(""),M(""),U(null),R(!1))},[t]);let O=async()=>{if(o&&u.trim()&&y){Z(!0),M("");try{let e=await fetch("/api/events/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collectionId:o,title:u.trim(),eventType:f,eventDate:new Date(y).toISOString(),location:j.trim()||null,hostMessage:N.trim()||null,password:C.trim()||"",locale:m})}),t=await e.json();if(!e.ok||!t.url){409===e.status&&"active_event_exists"===t.error&&t.existingEvent?U(t.existingEvent):M(t.error||"Failed"),Z(!1);return}L(t.url),A(t.id)}catch(e){M("Network error")}finally{Z(!1)}}},q=async()=>{try{await navigator.clipboard.writeText(B),R(!0),setTimeout(()=>R(!1),2e3)}catch(e){}},H=B?x("events.successTitle"):x("events.createTitle");if(P&&t){let e=new Date(P.event_date).toLocaleString("en"===m?"en-US":"tr-TR",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"}),t="/".concat("en"===m?"en/":"","app/events/").concat(P.id);return(0,r.jsx)(eh.u,{open:!0,onClose:s,className:"max-w-md",children:(0,r.jsxs)("div",{className:"flex flex-col items-center text-center py-2",children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-br from-amber-400 to-orange-500 flex items-center justify-center mb-3 text-2xl",children:"â ï¸"}),(0,r.jsx)("h3",{className:"text-base font-black text-gray-900",children:"en"===m?"You already have an active event":"Zaten aktif bir etkinliÄin var"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-2 max-w-xs leading-relaxed",children:"en"===m?"You can create a new event after your current one ends.":"Mevcut etkinliÄin sona erince yeni bir etkinlik oluÅturabilirsin."}),(0,r.jsxs)("div",{className:"mt-4 w-full bg-amber-50 border border-amber-200 rounded-xl px-3 py-2.5 text-left",children:[(0,r.jsx)("p",{className:"text-[10px] uppercase tracking-wide font-bold text-amber-700",children:"en"===m?"Active Event":"Aktif Etkinlik"}),(0,r.jsx)("p",{className:"text-sm font-bold text-amber-900 mt-0.5 truncate",children:P.title}),(0,r.jsxs)("p",{className:"text-[11px] text-amber-700 mt-0.5",children:["\uD83D\uDCC5 ",e]})]}),(0,r.jsx)("a",{href:t,className:"mt-5 w-full inline-flex items-center justify-center gap-2 bg-gradient-to-r from-pink-500 to-purple-600 text-white text-sm font-bold py-2.5 rounded-xl",children:"en"===m?"Manage Active Event":"Aktif EtkinliÄi Y\xf6net"}),(0,r.jsx)("button",{onClick:s,className:"mt-2 text-xs text-gray-400 hover:text-gray-600",children:x("cancel")})]})})}return(0,r.jsxs)(eh.u,{open:t,onClose:s,title:H,className:"max-w-lg",children:[c&&(0,r.jsxs)("div",{className:"flex items-center gap-2 bg-gradient-to-r from-pink-50 to-purple-50 border border-pink-100 rounded-xl px-3 py-2 mb-4",children:[d&&(0,r.jsx)("span",{className:"text-lg",children:d}),(0,r.jsx)("p",{className:"text-sm font-semibold text-pink-700 truncate",children:c})]}),B?(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"w-14 h-14 mx-auto mb-2 rounded-2xl bg-gradient-to-br from-pink-400 to-purple-500 flex items-center justify-center text-2xl",children:"\uD83C\uDF81"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:x("events.successDesc")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{readOnly:!0,value:B,onClick:e=>e.target.select(),className:"flex-1 px-3 py-2 bg-gray-50 border border-gray-200 rounded-xl text-xs text-gray-700 font-mono"}),(0,r.jsxs)("button",{onClick:q,className:"flex items-center gap-1.5 px-3 py-2 bg-pink-600 hover:bg-pink-700 text-white text-xs font-semibold rounded-xl transition-colors",children:[I?(0,r.jsx)(z.Z,{className:"w-3.5 h-3.5"}):(0,r.jsx)(er.Z,{className:"w-3.5 h-3.5"}),I?x("events.copied"):x("events.copyLink")]})]}),(0,r.jsxs)("button",{onClick:()=>{F&&(null==l||l(F)),s()},className:"w-full flex items-center justify-center gap-2 bg-gradient-to-r from-pink-500 to-purple-600 text-white text-sm font-bold py-2.5 rounded-xl transition-all",children:[x("events.viewEvent"),(0,r.jsx)(ef,{className:"w-4 h-4"})]})]}):(0,r.jsxs)("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-xs font-bold text-gray-600 mb-1.5",children:[x("events.eventName")," *"]}),(0,r.jsx)("input",{type:"text",value:u,onChange:e=>g(e.target.value),placeholder:x("events.eventNamePh"),maxLength:120,className:"w-full px-3 py-2.5 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-pink-400 placeholder:text-gray-400"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-bold text-gray-600 mb-1.5",children:x("events.eventType")}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:ej.map(e=>{let{value:t,emoji:s}=e;return(0,r.jsxs)("button",{onClick:()=>b(t),className:"flex flex-col items-center justify-center gap-1 py-2.5 rounded-xl border-2 transition-all ".concat(f===t?"border-pink-400 bg-pink-50 ring-2 ring-pink-100":"border-gray-100 hover:border-gray-200 bg-white"),children:[(0,r.jsx)("span",{className:"text-xl",children:s}),(0,r.jsx)("span",{className:"text-[10px] font-semibold text-gray-700 leading-tight text-center",children:x("events.type_".concat(t))})]},t)})})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-xs font-bold text-gray-600 mb-1.5",children:[x("events.eventDate")," *"]}),(0,r.jsx)("input",{type:"datetime-local",value:y,onChange:e=>v(e.target.value),className:"w-full px-3 py-2.5 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-pink-400"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-bold text-gray-600 mb-1.5",children:x("events.location")}),(0,r.jsx)("input",{type:"text",value:j,onChange:e=>w(e.target.value),placeholder:x("events.locationPh"),maxLength:200,className:"w-full px-3 py-2.5 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-pink-400 placeholder:text-gray-400"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-bold text-gray-600 mb-1.5",children:x("events.hostMessage")}),(0,r.jsx)("textarea",{value:N,onChange:e=>k(e.target.value),placeholder:x("events.hostMessagePh"),maxLength:500,rows:3,className:"w-full px-3 py-2.5 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-pink-400 placeholder:text-gray-400 resize-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-bold text-gray-600 mb-1.5",children:x("events.password")}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:S?"text":"password",value:C,onChange:e=>D(e.target.value),placeholder:x("events.passwordPh"),maxLength:100,className:"w-full px-3 py-2.5 pr-10 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-pink-400 placeholder:text-gray-400"}),(0,r.jsx)("button",{type:"button",onClick:()=>_(e=>!e),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 text-gray-400 hover:text-gray-600",children:S?(0,r.jsx)(p.Z,{className:"w-4 h-4"}):(0,r.jsx)(h.Z,{className:"w-4 h-4"})})]}),(0,r.jsx)("p",{className:"text-[11px] text-gray-400 mt-1 leading-snug",children:x("events.passwordHint")})]}),T&&(0,r.jsx)("div",{className:"text-xs text-red-600 bg-red-50 border border-red-100 rounded-lg px-3 py-2",children:T}),(0,r.jsx)("button",{onClick:O,disabled:E||!u.trim()||!y||!o,className:"w-full bg-gradient-to-r from-pink-500 to-purple-600 hover:from-pink-600 hover:to-purple-700 text-white text-sm font-bold py-3 rounded-xl transition-all disabled:opacity-60",children:E?x("events.creating"):x("events.createBtn")})]})]})}let ek={birthday:"\uD83C\uDF82",wedding:"\uD83D\uDC8D",baby_shower:"\uD83D\uDC76",graduation:"\uD83C\uDF93",housewarming:"\uD83C\uDFE0",anniversary:"\uD83D\uDC9D",engagement:"\uD83D\uDC90",retirement:"\uD83C\uDF89",custom:"â¨"};function eC(e){var t,s,l;
1let{collections:o,productCounts:d}=e,x=(0,n.T)("app"),m=(0,i.bU)(),u=(0,c.useRouter)(),[h,p]=(0,a.useState)([]),[g,b]=(0,a.useState)(!0),[y,v]=(0,a.useState)(!1),[j,N]=(0,a.useState)(null),k=(0,a.useCallback)(async()=>{b(!0);let e=await fetch("/api/events/list"),t=await e.json();t.events&&p(t.events),b(!1)},[]);(0,a.useEffect)(()=>{k()},[k]);let{upcoming:C,past:D,pastHidden:S}=(0,a.useMemo)(()=>{let e=Date.now(),t=[],s=[];for(let r of h)new Date(r.event_date).getTime()<e?s.push(r):t.push(r);return s.sort((e,t)=>new Date(t.event_date).getTime()-new Date(e.event_date).getTime()),{upcoming:t,past:s.slice(0,3),pastHidden:Math.max(0,s.length-3)}},[h]),_=e=>new Date(e).toLocaleString("en"===m?"en-US":"tr-TR",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"}),E=e=>{u.push("/".concat("en"===m?"en/":"","app/events/").concat(e))},Z=o.filter(e=>{var t;return(null!==(t=d[e.id])&&void 0!==t?t:0)>0});return(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 py-5",children:[(0,r.jsxs)("div",{className:"max-w-2xl mx-auto space-y-4",children:[(0,r.jsxs)("div",{className:"rounded-2xl p-5 bg-gradient-to-br from-pink-500 via-purple-500 to-indigo-600 text-white",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"text-3xl shrink-0",children:"\uD83C\uDF81"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"font-bold text-base leading-snug mb-0.5",children:x("events.listTitle")}),(0,r.jsx)("p",{className:"text-white/80 text-xs leading-relaxed",children:x("events.listEmptyDesc")})]})]}),(0,r.jsxs)("button",{onClick:()=>v(!0),className:"mt-4 inline-flex items-center gap-1.5 px-4 py-2 bg-white text-pink-700 hover:bg-pink-50 rounded-xl text-sm font-bold transition-colors shadow",children:[(0,r.jsx)(f.Z,{className:"w-4 h-4"}),x("events.createBtn")]})]}),g&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)("div",{className:"w-6 h-6 rounded-full border-2 border-pink-500 border-t-transparent animate-spin"})}),!g&&0===h.length&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)(w.Z,{className:"w-12 h-12 text-gray-200 mb-3"}),(0,r.jsx)("p",{className:"text-gray-500 text-sm font-medium",children:x("events.listEmpty")}),(0,r.jsx)("p",{className:"text-gray-400 text-xs mt-1 max-w-xs",children:x("events.listEmptyDesc")}),(0,r.jsxs)("button",{onClick:()=>v(!0),className:"mt-4 inline-flex items-center gap-1.5 px-4 py-2 bg-gradient-to-r from-pink-500 to-purple-600 text-white rounded-xl text-sm font-bold",children:[(0,r.jsx)(f.Z,{className:"w-4 h-4"}),x("events.createFirst")]})]}),!g&&C.map(e=>(0,r.jsx)(eD,{event:e,onClick:E,formatDate:_,t:x},e.id)),!g&&h.length>0&&0===C.length&&(0,r.jsx)("div",{className:"bg-gray-50/70 border border-dashed border-gray-200 rounded-2xl px-4 py-5 text-center",children:(0,r.jsx)("p",{className:"text-xs text-gray-500 font-medium",children:x("events.noUpcoming")})}),!g&&D.length>0&&(0,r.jsxs)("div",{className:"pt-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-gray-400 px-1 mb-2",children:[(0,r.jsx)(eg,{className:"w-3.5 h-3.5"}),(0,r.jsx)("span",{children:x("events.pastSection")}),S>0&&(0,r.jsx)("span",{className:"text-[10px] font-bold text-gray-300 ml-auto normal-case tracking-normal",children:x("events.pastHidden",{count:S})})]}),(0,r.jsx)("div",{className:"space-y-3",children:D.map(e=>(0,r.jsx)(eS,{event:e,locale:m,t:x},e.id))})]})]}),(0,r.jsxs)(eh.u,{open:y&&!j,onClose:()=>v(!1),title:x("events.pickCollectionTitle"),children:[(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-3",children:x("events.pickCollectionDesc")}),0===Z.length?(0,r.jsxs)("div",{className:"text-center py-6",children:[(0,r.jsx)(w.Z,{className:"w-10 h-10 text-gray-200 mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-sm text-gray-500 font-medium",children:x("events.noCollectionsTitle")}),(0,r.jsx)("p",{className:"text-xs text-gray-400 mt-1 max-w-xs mx-auto",children:x("events.noCollectionsDesc")})]}):(0,r.jsx)("div",{className:"space-y-1.5 max-h-[50vh] overflow-y-auto",children:Z.map(e=>{var t;return(0,r.jsxs)("button",{onClick:()=>N(e),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-xl border border-gray-100 hover:border-pink-300 hover:bg-pink-50/30 transition-all text-left",children:[(0,r.jsx)("span",{className:"text-2xl shrink-0",children:e.emoji}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-gray-900 truncate",children:e.name}),(0,r.jsx)("p",{className:"text-[11px] text-gray-400",children:x("events.products",{count:null!==(t=d[e.id])&&void 0!==t?t:0})})]}),(0,r.jsx)(ef,{className:"w-4 h-4 text-gray-300 shrink-0"})]},e.id)})})]}),(0,r.jsx)(eN,{open:!!j,onClose:()=>{N(null),v(!1)},onCreated:e=>{N(null),v(!1),u.push("/".concat("en"===m?"en/":"","app/events/").concat(e))},collectionId:null!==(t=null==j?void 0:j.id)&&void 0!==t?t:null,collectionName:null!==(s=null==j?void 0:j.name)&&void 0!==s?s:null,collectionEmoji:null!==(l=null==j?void 0:j.emoji)&&void 0!==l?l:null})]})}function eD(e){var t;let{event:s,onClick:a,formatDate:l,t:n}=e;return(0,r.jsxs)("button",{onClick:()=>
1a(s.id),className:"w-full text-left bg-white border border-gray-100 rounded-2xl shadow-sm overflow-hidden hover:shadow-md transition-shadow",children:[(0,r.jsxs)("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-2xl shrink-0",children:null!==(t=ek[s.event_type])&&void 0!==t?t:"\uD83C\uDF81"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"font-bold text-sm text-gray-900 truncate",children:s.title}),(0,r.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5 truncate",children:[s.collection_emoji," ",s.collection_name]})]}),(0,r.jsx)(ef,{className:"w-4 h-4 text-gray-300 shrink-0"})]}),(0,r.jsxs)("div",{className:"px-4 pb-3.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-gray-500",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(eb.Z,{className:"w-3 h-3"}),l(s.event_date)]}),s.location&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 max-w-[180px] truncate",children:[(0,r.jsx)(ey.Z,{className:"w-3 h-3"}),s.location]}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(w.Z,{className:"w-3 h-3"}),n("events.products",{count:s.product_count})]}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(ev.Z,{className:"w-3 h-3"}),n("events.reservations",{count:s.reservation_count})]}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(h.Z,{className:"w-3 h-3"}),n("events.views",{count:s.view_count})]})]})]})}function eS(e){var t;let{event:s,locale:a,t:l}=e,n=new Date(s.event_date).toLocaleDateString("en"===a?"en-US":"tr-TR",{day:"numeric",month:"long",year:"numeric"});return(0,r.jsx)("div",{className:"bg-white/70 border border-gray-100 rounded-2xl shadow-sm overflow-hidden opacity-80",children:(0,r.jsxs)("div",{className:"px-4 py-3.5 flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-2xl shrink-0 grayscale",children:null!==(t=ek[s.event_type])&&void 0!==t?t:"\uD83C\uDF81"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("p",{className:"font-bold text-sm text-gray-700 truncate",children:s.title}),(0,r.jsx)("span",{className:"shrink-0 text-[9px] font-black uppercase tracking-wider px-1.5 py-0.5 rounded-full bg-gray-100 text-gray-500 border border-gray-200",children:l("events.expiredBadge")})]}),(0,r.jsxs)("p",{className:"text-xs text-gray-400 mt-0.5 truncate",children:[s.collection_emoji," ",s.collection_name]}),(0,r.jsx)("p",{className:"text-[11px] text-gray-400 italic mt-1",children:l("events.expiredOn",{date:n})})]})]})})}let e_={info:{emoji:"â¹ï¸",chip:"bg-sky-50 text-sky-700 border-sky-200",bar:"from-sky-400 to-blue-600",labelTr:"Bilgi",labelEn:"Info"},update:{emoji:"â¨",chip:"bg-violet-50 text-violet-700 border-violet-200",bar:"from-violet-400 to-purple-600",labelTr:"G\xfcncelleme",labelEn:"Update"},maintenance:{emoji:"\uD83D\uDD27",chip:"bg-amber-50 text-amber-700 border-amber-200",bar:"from-amber-400 to-orange-500",labelTr:"Bakım",labelEn:"Maintenance"},deal:{emoji:"\uD83C\uDF81",chip:"bg-rose-50 text-rose-700 border-rose-200",bar:"from-rose-400 to-pink-600",labelTr:"Fırsat",labelEn:"Deal"}};function eE(){let e=(0,n.T)("app"),t="en"===(0,i.bU)(),[s,l]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=!1;return(async()=>{try{var t;let s=await fetch("/api/announcements?mode=recent&limit=50",{cache:"no-store"});if(!s.ok||e){e||l([]);return}let r=await s.json();e||l(null!==(t=r.announcements)&&void 0!==t?t:[])}catch(t){e||l([])}})(),()=>{e=!0}},[]);let o=null===s,c=!o&&0===(null!=s?s:[]).length;return(0,r.jsxs)("div",{className:"flex flex-col gap-4 p-4 sm:p-5 max-w-3xl mx-auto w-full",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-10 h-10 sm:w-11 sm:h-11 rounded-2xl bg-gradient-to-br from-primary-600 to-violet-600 flex items-center justify-center shadow-md shadow-primary-500/25 shrink-0",children:(0,r.jsx)(N.Z,{className:"w-5 h-5 sm:w-6 sm:h-6 text-white"})}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h2",{className:"text-xl sm:text-2xl font-black text-gray-900 tracking-tight",children:e("announcementsNav")}),(0,r.jsx)("p",{className:"text-xs sm:text-sm text-gray-500 mt-0.5",children:e("announcementsSubtitle")})]})]}),o?(0,r.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,r.jsx)("div",{className:"w-6 h-6 rounded-full border-2 border-primary-500 border-t-transparent animate-spin"})}):c?(0,r.jsxs)("div",{className:"bg-white border border-dashed border-gray-200 rounded-2xl p-10 text-center",children:[(0,r.jsx)(N.Z,{className:"w-10 h-10 text-gray-300 mx-auto mb-3"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:e("announcementsEmpty")})]}):(0,r.jsx)("div",{className:"flex flex-col gap-3",children:(null!=s?s:[]).map(e=>{let s=e_[e.kind],a=t?e.title_en:e.title_tr,l=t?e.body_en:e.body_tr,n=t?e.cta_label_en:e.cta_label_tr,i=new Date(e.published_at).toLocaleDateString(t?"en-GB":"tr-TR",{day:"numeric",month:"long",year:"numeric"});return(0,r.jsxs)("article",{className:"relative bg-white rounded-2xl shadow-sm ring-1 ring-black/5 overflow-hidden flex",children:[(0,r.jsx)("div",{className:"w-1.5 shrink-0 bg-gradient-to-b ".concat(s.bar)}),(0,r.jsxs)("div",{className:"flex-1 p-4 sm:p-5 min-w-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-2.5",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] font-black uppercase tracking-wider px-2 py-0.5 rounded-full border ".concat(s.chip),children:[(0,r.jsx)("span",{className:"text-sm leading-none",children:s.emoji}),t?s.labelEn:s.labelTr]}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] text-gray-400",children:[(0,r.jsx)(eb.Z,{className:"w-3 h-3"}),i]})]}),(0,r.jsx)("h3",{className:"text-base sm:text-lg font-black text-gray-900 tracking-tight leading-snug mb-1.5",children:a}),(0,r.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed whitespace-pre-wrap",children:l}),e.cta_url&&n&&(0,r.jsxs)("a",{href:e.cta_url,target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-flex items-center gap-1.5 text-sm font-bold text-primary-600 hover:text-primary-700",children:[n,(0,r.jsx)(_.Z,{className:"w-3.5 h-3.5"})]})]})]},e.id)})})]})}let eZ=(0,b.Z)("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}
1],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]);var eT=s(1817);function eM(e){let{open:t,onClose:s}=e,l=(0,n.T)("bugReport"),o=(0,i.bU)(),{showToast:c}=(0,T.p)(),[x,m]=(0,a.useState)(""),[h,p]=(0,a.useState)(""),[g,f]=(0,a.useState)(!1),[b,y]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&(m(""),p(""),(async()=>{let{data:{session:e}}=await (0,d.N)().auth.getSession();y(!!(null==e?void 0:e.access_token))})())},[t]),(0,a.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&s()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,s]);let v=async e=>{if(e.preventDefault(),x.trim()){f(!0);try{let{data:{session:e}}=await (0,d.N)().auth.getSession(),t=null==e?void 0:e.access_token,r=await fetch("/api/report-bug",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}},body:JSON.stringify({source:"web",message:x.trim(),email:h.trim(),locale:o,path:window.location.pathname+window.location.search,userAgent:"undefined"!=typeof navigator?navigator.userAgent:"",appVersion:"web"})});if(r.ok)c(l("success"),"success"),s();else{let e=await r.json().catch(()=>({}));c(e.error||l("error"),"error")}}catch(e){c(l("error"),"error")}finally{f(!1)}}};return t?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:s}),(0,r.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden flex flex-col",style:{maxHeight:"90vh"},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-rose-500 to-pink-500 flex items-center justify-center shadow-sm",children:(0,r.jsx)(eZ,{className:"w-4 h-4 text-white"})}),(0,r.jsx)("h2",{className:"text-base font-bold text-gray-900",children:l("title")})]}),(0,r.jsx)("button",{onClick:s,className:"w-8 h-8 flex items-center justify-center rounded-full text-gray-400 hover:bg-gray-100 transition-colors",children:(0,r.jsx)(u.Z,{className:"w-4 h-4"})})]}),(0,r.jsxs)("form",{onSubmit:v,className:"p-5 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsx)("p",{className:"text-sm text-gray-500 leading-relaxed",children:l("desc")}),!1===b&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 mb-1.5 block",children:l("emailLabel")}),(0,r.jsx)("input",{type:"email",value:h,onChange:e=>p(e.target.value),placeholder:l("emailPlaceholder"),className:"w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-primary-400"}),(0,r.jsx)("p",{className:"text-[11px] text-gray-400 mt-1.5",children:l("emailHint")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 mb-1.5 block",children:l("messageLabel")}),(0,r.jsx)("textarea",{required:!0,value:x,onChange:e=>m(e.target.value),placeholder:l("messagePlaceholder"),rows:6,maxLength:5e3,className:"w-full px-3.5 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-primary-400 resize-none"}),(0,r.jsx)("p",{className:"text-[11px] text-gray-400 mt-1.5",children:l("autoMeta")})]}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-1",children:[(0,r.jsx)("button",{type:"button",onClick:s,className:"px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-xl transition-colors font-medium",children:l("cancel")}),(0,r.jsxs)("button",{type:"submit",disabled:g||!x.trim(),className:"inline-flex items-center gap-2 px-4 py-2 bg-rose-600 hover:bg-rose-700 text-white text-sm font-semibold rounded-xl transition-colors disabled:opacity-60 disabled:cursor-not-allowed",children:[g&&(0,r.jsx)(eT.Z,{className:"w-4 h-4 animate-spin"}),g?l("sending"):l("sendBtn")]})]})]})]})]}):null}var eP=s(2363);let eU=["\uD83D\uDC31","\uD83D\uDC36","\uD83E\uDD8A","\uD83D\uDC3C","\uD83D\uDC28","\uD83D\uDC38","\uD83E\uDD81","\uD83D\uDC2F","\uD83D\uDC3B","\uD83E\uDD8B","\uD83D\uDC19","\uD83E\uDD84","\uD83E\uDD16","\uD83D\uDC7E","\uD83E\uDDD9","\uD83E\uDD77"],ez=[{id:"purple",grad:"linear-gradient(135deg,#7c3aed,#6d28d9)"},{id:"blue",grad:"linear-gradient(135deg,#2563eb,#1d4ed8)"},{id:"pink",grad:"linear-gradient(135deg,#db2777,#be185d)"},{id:"orange",grad:"linear-gradient(135deg,#ea580c,#c2410c)"},{id:"teal",grad:"linear-gradient(135deg,#0d9488,#0f766e)"},{id:"slate",grad:"linear-gradient(135deg,#1f2937,#111827)"}];function eB(e){var t,s,l;let{profile:c,onSignOut:x,onAvatarUpdated:m}=e,u=(0,n.T)("app"),h=(0,n.T)("bugReport"),p=(0,i.bU)(),g=(0,eP.tv)(),{showToast:f}=(0,T.p)(),b=(0,d.N)(),[y,v]=(0,a.useState)(!1),[j,w]=(0,a.useState)(!1),[N,k]=(0,a.useState)(!1),[C,D]=(0,a.useState)(!1),[S,_]=(0,a.useState)(""),[E,Z]=(0,a.useState)(""),[M,P]=(0,a.useState)(!1),[z,B]=(0,a.useState)(!1),[L,F]=(0,a.useState)(!1),[A,I]=(0,a.useState)(""),[R,O]=(0,a.useState)(""),[q,H]=(0,a.useState)(!1),W="en"===p?"DELETE":"SİL",[J,G]=(0,a.useState)("circle"),[Y,K]=(0,a.useState)("purple"),[$,V]=(0,a.useState)(!1);(0,a.useEffect)(()=>{b.from("user_preferences").select("btn_shape, btn_color").maybeSingle().then(e=>{let{data:t}=e;(null==t?void 0:t.btn_shape)&&G(t.btn_shape),(null==t?void 0:t.btn_color)&&K(t.btn_color)})},[]);let Q=async e=>{v(!1);let{error:t}=await b.from("profiles").update({avatar:e}).eq("id",c.id);if(t){f(u("profileGenericError"),"error");return}null==m||m(),f("â","success")},X=async e=>{e!==p&&(await b.from("user_preferences").upsert({user_id:c.id,language:e},{onConflict:"user_id"}),g.replace("/app",{locale:e}))},ee=async e=>{G(e),V(!0),await b.from("user_preferences").upsert({user_id:c.id,btn_shape:e},{onConflict:"user_id"}),V(!1)},et=async e=>{K(e),V(!0),await b.from("user_preferences").upsert({user_id:c.id,btn_color:e},{onConflict:"user_id"}),V(!1)},es=async()=>{let e=function(e,t){if(e.length<8)return t("profilePwTooShort");if(/^(.)\1+$/.test(e))return t("profilePwTooSimple");let s=e.toLowerCase();for(let e of["0123456789","9876543210","abcdefghijklmnopqrstuvwxyz","zyxwvutsrqponmlkjihgfedcba","qwertyuiop","asdfghjkl","zxcvbnm"])for(let r=0;r<=e.length-5;r++)if(s.includes(e.slice(r,r+5)))return t("profilePwTooSimple");return null}(S,u);if(e){f(e,"error");return}if(S!==E){f(u("profilePwMismatch"),"error");return}F(!0);let{error:t}=await b.auth.updateUser({password:S});F(!1),t?f(t.message,"error"):(f(u("profilePwUpdated"),"success"),k(!1),_(""),Z(""))},er=async()=>
1{if(A!==W){f(u("profileDeleteTypeError"),"error");return}if(!R){f(u("profileDeletePasswordRequired"),"error");return}H(!0);let{data:{session:e}}=await b.auth.getSession(),t=await fetch("/api/account/delete",{method:"POST",headers:{Authorization:"Bearer ".concat(null==e?void 0:e.access_token),"Content-Type":"application/json"},body:JSON.stringify({password:R})});if(H(!1),401===t.status){f(u("profileDeleteWrongPassword"),"error");return}if(!t.ok){f(u("profileDeleteError"),"error");return}O(""),await b.auth.signOut()},ea=null!==(s=null===(t=ez.find(e=>e.id===Y))||void 0===t?void 0:t.grad)&&void 0!==s?s:ez[0].grad;return(0,r.jsxs)("div",{className:"h-full overflow-y-auto px-6 py-8",children:[(0,r.jsxs)("div",{className:"max-w-md mx-auto space-y-4",children:[(0,r.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>v(e=>!e),className:"w-full flex items-center gap-4 px-5 py-4 hover:bg-gray-50 transition-colors",children:[(0,r.jsx)("span",{className:"text-5xl leading-none",children:null!==(l=null==c?void 0:c.avatar)&&void 0!==l?l:"\uD83D\uDE0A"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,r.jsxs)("p",{className:"font-bold text-gray-900",children:["@",null==c?void 0:c.nickname]}),(0,r.jsx)("p",{className:"text-sm text-gray-400 truncate",children:null==c?void 0:c.email}),(null==c?void 0:c.created_at)&&(0,r.jsx)("p",{className:"text-[11px] text-gray-300 mt-0.5",children:u("profileMemberSince",{date:new Date(c.created_at).toLocaleDateString("en"===p?"en-US":"tr-TR",{year:"numeric",month:"long",day:"numeric"})})})]}),(0,r.jsx)(ei.Z,{className:"w-4 h-4 text-gray-300 shrink-0 transition-transform ".concat(y?"rotate-180":"")})]}),y&&(0,r.jsxs)("div",{className:"px-5 pb-4 border-t border-gray-100 pt-3",children:[(0,r.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-widest text-primary-400 mb-2",children:u("profilePickAvatar")}),(0,r.jsx)("div",{className:"grid gap-1.5",style:{gridTemplateColumns:"repeat(8,1fr)"},children:eU.map(e=>(0,r.jsx)("button",{onClick:()=>Q(e),className:"text-2xl w-9 h-9 rounded-xl flex items-center justify-center transition-all hover:scale-110 hover:bg-primary-50 ".concat((null==c?void 0:c.avatar)===e?"bg-primary-100 ring-2 ring-primary-400":""),children:e},e))})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-widest text-primary-400 px-1 mb-1.5",children:u("profileAppearance")}),(0,r.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm divide-y divide-gray-100",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:u("profileLang")}),(0,r.jsx)("div",{className:"flex p-0.5 rounded-xl bg-gray-100 gap-0.5",children:["tr","en"].map(e=>(0,r.jsx)("button",{onClick:()=>X(e),className:"px-3 py-1 text-xs font-semibold rounded-lg transition-all ".concat(p===e?"bg-white text-primary-700 shadow-sm":"text-gray-400"),children:"tr"===e?"T\xfcrk\xe7e":"English"},e))})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:u("profileIconShape")}),(0,r.jsx)("p",{className:"text-[10px] text-gray-400",children:u("profileIconHint")})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:[{id:"circle",radius:"50%",title:"Yuvarlak"},{id:"rounded",radius:"14px",title:"YuvarlatılmıÅ"},{id:"square",radius:"6px",title:"K\xf6Åeli"}].map(e=>{let{id:t,radius:s,title:a}=e;return(0,r.jsx)("button",{title:a,onClick:()=>ee(t),className:"w-8 h-8 flex items-center justify-center text-white text-[10px] font-black transition-all",style:{borderRadius:s,background:ea,boxShadow:J===t?"0 0 0 2.5px white, 0 0 0 4px #7c3aed":"none",transform:J===t?"scale(1.1)":"scale(1)"},children:"W"},t)})})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:u("profileIconColor")}),(0,r.jsx)("div",{className:"flex items-center gap-1.5",children:ez.map(e=>{let{id:t,grad:s}=e;return(0,r.jsx)("button",{onClick:()=>et(t),className:"w-6 h-6 rounded-full transition-all",style:{background:s,boxShadow:Y===t?"0 0 0 2px white, 0 0 0 3.5px #7c3aed":"none",transform:Y===t?"scale(1.15)":"scale(1)"}},t)})})]})]}),$&&(0,r.jsx)("p",{className:"text-[10px] text-primary-400 px-1 mt-1",children:u("profilePrefsSaving")})]}),(0,r.jsxs)("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>k(!N),className:"w-full flex items-center justify-between px-5 py-4 text-sm font-semibold text-gray-700 hover:bg-gray-50 transition-colors",children:[u("profileChangePw"),(0,r.jsx)(ei.Z,{className:"w-4 h-4 text-gray-400 transition-transform ".concat(N?"rotate-180":"")})]}),N&&(0,r.jsxs)("div",{className:"px-5 pb-4 space-y-3 border-t border-gray-100 pt-4",children:[(0,r.jsx)(eL,{value:S,onChange:_,placeholder:u("profileNewPw"),show:M,onToggle:()=>P(e=>!e)}),(0,r.jsx)(eL,{value:E,onChange:Z,placeholder:u("profileConfirmPw"),show:z,onToggle:()=>B(e=>!e)}),(0,r.jsx)("button",{onClick:es,disabled:L,className:"w-full bg-primary-600 hover:bg-primary-700 text-white font-semibold text-sm py-2.5 rounded-xl transition-colors disabled:opacity-60",children:L?"â¦":u("profilePwUpdate")})]})]}),(0,r.jsx)("button",{onClick:x,className:"w-full border border-gray-200 text-gray-600 hover:bg-gray-50 font-semibold text-sm py-3 rounded-2xl transition-colors",children:u("logout")}),(0,r.jsxs)("button",{onClick:()=>w(!0),className:"w-full bg-white hover:bg-rose-50 rounded-2xl border border-gray-100 hover:border-rose-200 shadow-sm transition-all flex items-center gap-3 px-5 py-3.5 text-left group",children:[(0,r.jsx)("span",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-rose-500 to-pink-500 flex items-center justify-center shadow-sm shrink-0 group-hover:scale-105 transition-transform",children:(0,r.jsx)(eZ,{className:"w-4 h-4 text-white"})}),(0,r.jsx)("span",{className:"text-sm font-semibold text-gray-800",children:h("trigger")}),(0,r.jsx)(U.Z,{className:"w-4 h-4 text-gray-300 ml-auto"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-widest text-primary-400 px-1 mb-1.5",children:u("profileLegal")}),(0,r.jsx)("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm divide-y divide-gray-100 overflow-hidden",children:[{href:"/privacy",label:u("profilePrivacy")},{href:"/privacy",label:u("profileKvkk")},{href:"/terms",label:u("profileTerms")}].map(e=>{let{href:t,label:s}=e;return(0,r.jsxs)(o.default,{href:t,target:"_blank",className:"flex items-center justify-between px-5 py-3 hover:bg-gray-50 transition-colors",children:[(0,r.jsx)("span",{className:"text-sm text-gray-700",children:s}),(0,r.jsx)(U.Z,{className:"w-4 h-4 text-gray-300"})]},s)})})]}),(0,r.jsxs)("div",{className:"bg-red-50 rounded-2xl border border-red-100 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>D(!C),className:"w-full flex items-center justify-between px-5 py-4 text-sm font-semibold text-red-700 hover:bg-red-100/50 transition-colors",children:[u("profileDeleteAccount"),(0,r.jsx)(ei.Z,{className:"w-4 h-4 text-red-400 transition-transform ".concat(C?"rotate-180":"")})]}),C&&(0,r.jsxs)("div",{className:"px-5 pb-4 space-y-3 border-t border-red-100 pt-4",children:[(0,r.jsx)("p",{className:"text-xs text-red-500 leading-relaxed",children:u("profileDeleteDesc")}),(0,r.jsx)("input",{type:"text",value:A,onChange:e=>I(e.target.value),placeholder:u("profileDeletePlaceholder"),className:"w-full border border-red-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-red-400 bg-white"}),(0,r.jsx)("input",{type:"password",value:R,onChange:e=>O(e.target.value),placeholder:u("profileDeletePasswordPlaceholder"),autoComplete:"current-password",className:"w-full border border-red-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-red-400 bg-white"}),(0,r.jsx)("button",{onClick:er,disabled:q,className:"w-full bg-red-600 hover:bg-red-700 text-white font-semibold text-sm py-2.5 rounded-xl transition-colors disabled:opacity-60",children:q?"â¦":u("profileDeleteConfirmBtn")}
1)]})]})]}),(0,r.jsx)(eM,{open:j,onClose:()=>w(!1)})]})}function eL(e){let{value:t,onChange:s,placeholder:a,show:l,onToggle:n}=e;return(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:l?"text":"password",value:t,onChange:e=>s(e.target.value),placeholder:a,className:"w-full border border-gray-200 rounded-xl px-3 py-2.5 pr-10 text-sm focus:outline-none focus:ring-2 focus:ring-primary-400"}),(0,r.jsx)("button",{type:"button",onClick:n,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",tabIndex:-1,children:l?(0,r.jsx)(h.Z,{className:"w-4 h-4"}):(0,r.jsx)(p.Z,{className:"w-4 h-4"})})]})}let eF=["\uD83D\uDCE6","\uD83D\uDECDï¸","\uD83D\uDC57","\uD83D\uDC5F","\uD83C\uDFE0","\uD83D\uDCBB","\uD83D\uDCDA","\uD83C\uDFAE","\uD83C\uDF81","\uD83D\uDC84","\uD83C\uDF3F","\uD83C\uDF55","âï¸","\uD83C\uDFB5","â½","\uD83C\uDFCBï¸","\uD83D\uDC3E","\uD83D\uDC8D","\uD83E\uDEB4","\uD83E\uDDF4"];function eA(e){let{open:t,onClose:s,onCreate:l}=e,i=(0,n.T)("app"),o=i.raw("collectionSuggestions"),[c,d]=(0,a.useState)(""),[x,m]=(0,a.useState)("\uD83D\uDCE6"),[u,h]=(0,a.useState)(!1),p=async e=>{e.preventDefault(),c.trim()&&(h(!0),await l(c.trim(),x),h(!1),d(""),m("\uD83D\uDCE6"),s())},g=e=>{d(e.name),m(e.emoji)};return(0,r.jsx)(eh.u,{open:t,onClose:s,title:i("newCollection"),children:(0,r.jsxs)("form",{onSubmit:p,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-widest text-primary-400 mb-2",children:i("collectionQuickPick")}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:o.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>g(e),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-semibold border transition-all\n ".concat(c===e.name&&x===e.emoji?"bg-primary-50 border-primary-300 text-primary-700":"bg-white border-gray-200 text-gray-600 hover:border-primary-300 hover:text-primary-600"),children:[(0,r.jsx)("span",{children:e.emoji}),(0,r.jsx)("span",{children:e.name})]},e.name))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 mb-1 block",children:i("collectionName")}),(0,r.jsx)("input",{type:"text",required:!0,value:c,onChange:e=>d(e.target.value),placeholder:i("collectionName"),className:"w-full px-4 py-2.5 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-primary-400",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs font-semibold text-gray-500 mb-1 block",children:i("collectionEmoji")}),(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:eF.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>m(e),className:"w-9 h-9 rounded-xl text-lg transition-all ".concat(x===e?"bg-primary-100 ring-2 ring-primary-400":"hover:bg-gray-100"),children:e},e))})]}),(0,r.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,r.jsx)("button",{type:"button",onClick:s,className:"px-4 py-2 text-sm text-gray-600 hover:text-gray-900 transition-colors",children:i("cancel")}),(0,r.jsx)("button",{type:"submit",disabled:u||!c.trim(),className:"px-5 py-2 bg-primary-600 hover:bg-primary-700 text-white text-sm font-semibold rounded-xl transition-colors disabled:opacity-60",children:u?"â¦":i("create")})]})]})})}function eI(e){let{open:t,onClose:s,onGoToLinks:l,onEventCreated:o,collectionId:c,collectionName:d,collectionEmoji:x}=e,m=(0,n.T)("app"),u=(0,i.bU)(),[h,p]=(0,a.useState)("choose"),[g,f]=(0,a.useState)(!1),[b,y]=(0,a.useState)(""),[v,N]=(0,a.useState)(""),[k,C]=(0,a.useState)(!1),[D,S]=(0,a.useState)(!1),[_,E]=(0,a.useState)(!1),[Z,T]=(0,a.useState)(""),M=async()=>{if(!c)return;C(!0);let e=await fetch("/api/share/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({collectionId:c,message:Z.trim()||null})}),t=await e.json();if(C(!1),t.url){var s;y("".concat(t.url,"?lang=").concat(u)),N(null!==(s=t.expiresAt)&&void 0!==s?s:""),E(!!t.existing),p("normal-success")}},P=async()=>{try{await navigator.clipboard.writeText(b)}catch(t){let e=document.createElement("textarea");e.value=b,e.style.cssText="position:fixed;opacity:0;pointer-events:none;",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e)}S(!0),setTimeout(()=>S(!1),2e3)},U=()=>{p("choose"),y(""),N(""),S(!1),E(!1),T(""),s()};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(eh.u,{open:t&&!g,onClose:U,title:m("shareModal.title"),children:[d&&(0,r.jsxs)("div",{className:"flex items-center gap-2 bg-primary-50 border border-primary-100 rounded-xl px-3 py-2 mb-4",children:[x&&(0,r.jsx)("span",{className:"text-lg",children:x}),(0,r.jsx)("p",{className:"text-sm font-semibold text-primary-700 truncate",children:d})]}),"choose"===h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:m("shareModal.chooseType")}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,r.jsxs)("button",{onClick:()=>p("normal"),className:"group flex flex-col items-start gap-2 p-4 rounded-2xl border-2 border-gray-100 hover:border-primary-300 hover:bg-primary-50/50 transition-all text-left",children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-xl bg-primary-50 group-hover:bg-primary-100 flex items-center justify-center transition-colors",children:(0,r.jsx)(j.Z,{className:"w-4 h-4 text-primary-600"})}),(0,r.jsx)("p",{className:"text-sm font-bold text-gray-900",children:m("shareModal.typeNormalTitle")}),(0,r.jsx)("p",{className:"text-xs text-gray-500 leading-snug",children:m("shareModal.typeNormalDesc")})]}),(0,r.jsxs)("button",{onClick:()=>f(!0),className:"group flex flex-col items-start gap-2 p-4 rounded-2xl border-2 border-gray-100 hover:border-pink-300 hover:bg-pink-50/50 transition-all text-left",children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-br from-pink-100 to-purple-100 flex items-center justify-center",children:(0,r.jsx)(w.Z,{className:"w-4 h-4 text-pink-600"})}),(0,r.jsx)("p",{className:"text-sm font-bold text-gray-900",children:m("shareModal.typeEventTitle")}),(0,r.jsx)("p",{className:"text-xs text-gray-500 leading-snug",children:m("shareModal.typeEventDesc")})]})]})]}),"normal"===h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:m("shareModal.desc")}),(0,r.jsx)("textarea",{value:Z,onChange:e=>T(e.target.value),placeholder:m("shareModal.messagePlaceholder"),maxLength:200,rows:2,className:"w-full px-3 py-2.5 border border-gray-200 rounded-xl text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary-400 mb-3 placeholder:text-gray-400"}),(0,r.jsx)("button",{onClick:M,disabled:k||!c,className:"w-full bg-primary-600 hover:bg-primary-700 text-white text-sm font-semibold py-2.5 rounded-xl transition-colors disabled:opacity-60",children:m(k?"shareModal.creating":"shareModal.createBtn")})]}),"normal-success"===h&&_&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center text-center gap-3 px-2 py-4",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-primary-50 flex items-center justify-center text-xl font-black text-primary-600",children:"\uD83D\uDD17"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-bold text-gray-900 mb-1",children:m("links.alreadyExistsTitle")}),(0,r.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:v?m("links.alreadyExistsUntil",{date:new Date(v).toLocaleDateString("en"===u?"en-US":"tr-TR",{day:"numeric",month:"long",hour:"2-digit",minute:"2-digit"})}):m("links.alreadyExists")})]})]}),(0,r.jsxs)("button",{onClick:()=>{U(),null==l||l()},className:"w-full flex items-center justify-center gap-2 bg-primary-600 hover:bg-primary-700 text-white text-sm font-semibold py-2.5 rounded-xl transition-colors",children:[(0,r.jsx)(j.Z,{className:"w-4 h-4"}),m("links.goToLinks"),(0,r.jsx)(ef,{className:"w-3.5 h-3.5"})]}),(0,r.jsx)("button",{onClick:U,className:"w-full text-xs text-gray-400 hover:text-gray-600 py-1 transition-colors",children:m("cancel")})]}),"normal-success"===h&&!_&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{readOnly:!0,value:b,onClick:e=>e.target.select(),className:"flex-1 px-3 py-2 bg-gray-50 border border-gray-200 rounded-xl text-xs text-gray-700 font-mono"}),(0,r.jsxs)("button",{onClick:P,className:"flex items-center gap-1.5 px-3 py-2 bg-primary-600 hover:bg-primary-700 text-white text-xs font-semibold rounded-xl transition-colors",children:[D?(0,r.jsx)(z.Z,{className:"w-3.5 h-3.5"}):(0,r.jsx)(er.Z,{className:"w-3.5 h-3.5"}),m(D?"shareModal.copied":"shareModal.copyBtn")]})]}),(0,r.jsx)("p",{className:"text-xs text-gray-400 text-center",children:m("shareModal.expires
1In")})]})]}),(0,r.jsx)(eN,{open:g,onClose:()=>f(!1),onCreated:e=>{f(!1),U(),null==o||o(e)},collectionId:c,collectionName:null!=d?d:null,collectionEmoji:null!=x?x:null})]})}function eR(e){let{open:t,onClose:s}=e,o=(0,n.T)("app.qrModal"),c=(0,i.bU)(),[d,x]=(0,a.useState)(""),[m,u]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(!t){x("");return}u(!0),fetch("/api/qr/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:c})}).then(e=>e.json()).then(e=>{var t;x(null!==(t=e.qrUrl)&&void 0!==t?t:""),u(!1)}).catch(()=>u(!1))},[t]),(0,r.jsxs)(eh.u,{open:t,onClose:s,title:o("title"),children:[(0,r.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:o("desc")}),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[m?(0,r.jsx)("div",{className:"w-48 h-48 bg-gray-100 rounded-2xl flex items-center justify-center",children:(0,r.jsx)("span",{className:"text-sm text-gray-400",children:o("generating")})}):d?(0,r.jsx)(l.default,{src:d,alt:"QR",width:192,height:192,className:"rounded-2xl border border-gray-100",unoptimized:!0}):null,(0,r.jsx)("p",{className:"text-xs text-gray-400",children:o("expireNote")})]})]})}var eO=s(3245),eq=s(9322);function eH(e){let{open:t,collectionId:s,onClose:l,onAdded:i}=e,o=(0,n.T)("app"),{showToast:c}=(0,T.p)(),[x,m]=(0,a.useState)(""),[h,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)(null);if(!t)return null;let b=()=>{m(""),f(null),l()},y=async e=>{if(e.preventDefault(),x.trim()&&s){p(!0),f(null);try{let e=(0,d.N)(),{data:{session:t}}=await e.auth.getSession(),r=await fetch("/api/products/from-url",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(null==t?void 0:t.access_token)},body:JSON.stringify({url:x.trim(),collection_id:s})}),a=await r.json();if(!r.ok){if(409===r.status&&"already_saved"===a.error){f({kind:"info",msg:o("addUrlAlreadySaved")});return}f({kind:"error",msg:o("addUrlFailed")});return}i(a.product),b(),c(o("addUrlSuccess"),"success")}finally{p(!1)}}};return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:b}),(0,r.jsxs)("div",{className:"relative bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(j.Z,{className:"w-4 h-4 text-primary-600"}),(0,r.jsx)("h3",{className:"text-sm font-bold text-gray-900",children:o("addUrlTitle")})]}),(0,r.jsx)("button",{onClick:b,className:"w-7 h-7 flex items-center justify-center rounded-full text-gray-400 hover:bg-gray-100",children:(0,r.jsx)(u.Z,{className:"w-4 h-4"})})]}),(0,r.jsxs)("form",{onSubmit:y,className:"px-5 py-5 space-y-3",children:[(0,r.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:o("addUrlDesc")}),(0,r.jsx)("input",{type:"url",value:x,onChange:e=>{m(e.target.value),g&&f(null)},placeholder:o("addUrlPlaceholder"),autoFocus:!0,required:!0,className:"w-full px-3 py-2.5 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-primary-400"}),g&&(0,r.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-xl text-xs ".concat("info"===g.kind?"bg-amber-50 border border-amber-200 text-amber-800":"bg-rose-50 border border-rose-200 text-rose-700"),children:["info"===g.kind?(0,r.jsx)(eO.Z,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}):(0,r.jsx)(eq.Z,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),(0,r.jsx)("span",{className:"leading-relaxed",children:g.msg})]}),(0,r.jsx)("button",{type:"submit",disabled:h||!x.trim()||!s,className:"w-full bg-primary-600 hover:bg-primary-700 disabled:opacity-60 text-white font-semibold text-sm py-2.5 rounded-xl transition-colors",children:h?o("addUrlLoading"):o("addUrlSubmit")})]})]})]})}var eW=s(4440),eJ=s(4645),eG=s(8919);let eY=(0,b.Z)("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);var eK=s(7342);let e$=[{s:"collections",icon:y},{s:"sites",icon:S.Z},{s:"discover",icon:H.Z},{s:"events",icon:w.Z},{s:"links",icon:j.Z},{s:"announcements",icon:N.Z},{s:"profile",icon:k.Z}];function eV(){var e,t,s,x,m,u,h,p;let b=(0,n.T)("app"),y=(0,i.bU)(),{showToast:v}=(0,T.p)(),{user:j,profile:w,loading:N,signOut:k,refetchProfile:C}=function(){let[e,t]=(0,a.useState)(null),[s,r]=(0,a.useState)(null),[l,n]=(0,a.useState)(!0),i=(0,a.useCallback)(async e=>{let t=(0,d.N)(),{data:s}=await t.from("profiles").select("*").eq("id",e).single();s&&r(s)},[]);return(0,a.useEffect)(()=>{let e=(0,d.N)();e.auth.getSession().then(e=>{let{data:{session:s}}=e;(null==s?void 0:s.user)&&(t(s.user),i(s.user.id)),n(!1)});let{data:{subscription:s}}=e.auth.onAuthStateChange((e,s)=>{var a;t(null!==(a=null==s?void 0:s.user)&&void 0!==a?a:null),(null==s?void 0:s.user)?i(s.user.id):r(null)});return()=>s.unsubscribe()},[i]),{user:e,profile:s,loading:l,signOut:(0,a.useCallback)(async()=>{let e=(0,d.N)();await e.auth.signOut(),t(null),r(null)},[]),refetchProfile:()=>e&&i(e.id)}}(),S=!(null==j?void 0:j.email),_=(0,c.useSearchParams)(),P=(0,c.useRouter)();(0,a.useEffect)(()=>
1{let e=window.location.hash||"",t=/(?:^|[#&])qr=([^&]+)/.exec(e),s=t?decodeURIComponent(t[1]):null,r=_.get("token"),a=null!=s?s:r;a&&(P.replace("/app",{scroll:!1}),fetch("/api/qr/consume/".concat(encodeURIComponent(a))).then(e=>e.json()).then(async e=>{if(e.access_token){let t=(0,d.N)();await t.auth.setSession({access_token:e.access_token,refresh_token:e.refresh_token})}}).catch(()=>{}))},[]),(0,a.useEffect)(()=>{let e=_.get("createEvent");if(!e||!j)return;A(e),ed(!0);let t=new URL(window.location.href);t.searchParams.delete("createEvent"),P.replace(t.pathname+t.search,{scroll:!1})},[j]);let U=(()=>{let e=_.get("section");return"sites"===e||"discover"===e||"links"===e||"events"===e||"announcements"===e||"profile"===e?e:"collections"})(),[z,B]=(0,a.useState)(U),[L,A]=(0,a.useState)(null),[R,O]=(0,a.useState)(null),{collections:H,loading:W,refetch:J,create:G,remove:Y}=function(e){let[t,s]=(0,a.useState)([]),[r,l]=(0,a.useState)(!1),n=(0,a.useCallback)(async()=>{if(!e)return;l(!0);let t=(0,d.N)(),{data:r}=await t.from("collections").select("*").eq("user_id",e).order("sort_order",{ascending:!0});s(null!=r?r:[]),l(!1)},[e]);(0,a.useEffect)(()=>{n()},[n]);let i=async(r,a)=>{if(!e)return;let l=(0,d.N)(),{data:n,error:i}=await l.from("collections").insert({user_id:e,name:r,emoji:a,sort_order:t.length}).select().single();return!i&&n&&s(e=>[...e,n]),{data:n,error:i}};return{collections:t,loading:r,refetch:n,create:i,remove:async e=>{let t=(0,d.N)(),{error:r}=await t.from("collections").delete().eq("id",e);return r||s(t=>t.filter(t=>t.id!==e)),{error:r}}}}(null==j?void 0:j.id),{products:K,refetch:$,remove:V,move:Q,removeByCollection:X,addLocal:ee,updatePrice:et}=function(e,t){let[s,r]=(0,a.useState)([]),[l,n]=(0,a.useState)(!1),i=(0,a.useCallback)(async()=>{if(!e)return;n(!0);let t=(0,d.N)().from("products").select("*").eq("user_id",e),{data:s}=await t.order("created_at",{ascending:!1});r(null!=s?s:[]),n(!1)},[e,null]);return(0,a.useEffect)(()=>{i()},[i]),{products:s,loading:l,refetch:i,remove:async e=>{let t=(0,d.N)(),{error:s}=await t.from("products").delete().eq("id",e);return s||r(t=>t.filter(t=>t.id!==e)),{error:s}},move:async(e,t)=>{let s=(0,d.N)(),{error:a}=await s.from("products").update({collection_id:t}).eq("id",e);return a||r(s=>s.map(s=>s.id===e?{...s,collection_id:t}:s)),{error:a}},removeByCollection:async e=>{let t=(0,d.N)(),{error:s}=await t.from("products").delete().eq("collection_id",e);return s||r(t=>t.filter(t=>t.collection_id!==e)),{error:s}},addLocal:e=>{r(t=>[e,...t])},updatePrice:async(e,t)=>{let s=(0,d.N)(),{data:{session:a}}=await s.auth.getSession(),l=null==a?void 0:a.access_token;if(!l)return{error:"auth"};let n=await globalThis.fetch("/api/products/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(l)},body:JSON.stringify(t)});if(!n.ok){var i;return{error:null!==(i=(await n.json().catch(()=>({}))).error)&&void 0!==i?i:"failed"}}let o=(await n.json()).product;return r(t=>t.map(t=>t.id===e?{...t,price_raw:o.price_raw,price_value:o.price_value,price_currency:o.price_currency}:t)),{}}}}(null==j?void 0:j.id,0),[es,er]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!j||S||W||H.length>0)return;let e="starter_seed_called_".concat(j.id);if(sessionStorage.getItem(e))return;sessionStorage.setItem(e,"1");let t=(0,d.N)();(async()=>{let{data:{session:e}}=await t.auth.getSession(),s=await fetch("/api/starter/seed",{method:"POST",headers:{"Content-Type":"application/json",...(null==e?void 0:e.access_token)?{Authorization:"Bearer ".concat(e.access_token)}:{}},body:JSON.stringify({locale:y})});s.ok&&"seeded"===(await s.json().catch(()=>({}))).status&&(await J(),await $())})()},[null==j?void 0:j.id,S,W,H.length]);let[ea,el]=(0,a.useState)(!1),[en,ei]=(0,a.useState)(!1),[ec,ed]=(0,a.useState)(!1),[em,eh]=(0,a.useState)(!1),[eg,ef]=(0,a.useState)(null),eb=(e,t,s,r)=>new Promise(a=>ef({title:e,body:t,confirmLabel:null!=s?s:b("delete"),danger:r,resolve:a})),[ey,ev]=(0,a.useState)(""),[ej,ew]=(0,a.useState)("newest"),eN=(0,a.useMemo)(()=>{let e=L?K.filter(e=>e.collection_id===L):K;if(ey.trim()){let t=ey.toLowerCase();e=e.filter(e=>{var s;return e.title.toLowerCase().includes(t)||(null!==(s=e.domain)&&void 0!==s?s:"").includes(t)})}return"price-asc"===ej?e=[...e].sort((e,t)=>
1{var s,r;return(null!==(s=e.price_value)&&void 0!==s?s:0)-(null!==(r=t.price_value)&&void 0!==r?r:0)}):"price-desc"===ej&&(e=[...e].sort((e,t)=>{var s,r;return(null!==(s=t.price_value)&&void 0!==s?s:0)-(null!==(r=e.price_value)&&void 0!==r?r:0)})),e},[K,L,ey,ej]),ek=(0,a.useMemo)(()=>{let e={};for(let s of K){var t;s.collection_id&&(e[s.collection_id]=(null!==(t=e[s.collection_id])&&void 0!==t?t:0)+1)}return e},[K]),eD=async()=>{await eb(b("logoutConfirm"),void 0,b("logoutYes"),!1)&&await k()},eS=async e=>{let{error:t}=await V(e);t&&v(t.message,"error")},e_=async(e,t)=>{let{error:s}=await Q(e,t);s||v(b("save"),"success")},eZ=async e=>{var t;let s=null!==(t=ek[e])&&void 0!==t?t:0,r=H.find(t=>t.id===e),a=r?"".concat(r.emoji," ").concat(r.name):b("deleteCollectionConfirm"),l=s>0?b("deleteCollectionWithProducts",{count:s}):void 0;if(!await eb(a,l,b("delete"),!0))return;s>0&&await X(e);let{error:n}=await Y(e);n?v(n.message,"error"):L===e&&A(null)},eT=e=>{B(e),"collections"!==e&&A(null)},eM=null!==(s=H.find(e=>e.id===L))&&void 0!==s?s:null;if(N)return(0,r.jsx)("div",{className:"min-h-dvh flex items-center justify-center bg-gray-50",children:(0,r.jsx)("div",{className:"w-8 h-8 rounded-full border-2 border-primary-600 border-t-transparent animate-spin"})});if(!j)return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"min-h-dvh flex flex-col items-center justify-center bg-gradient-to-br from-[#f8f5ff] via-white to-[#f0ebff] px-4",children:[(0,r.jsx)(l.default,{src:"/logousethis.png",alt:"Wishlify",width:80,height:80,className:"rounded-3xl object-cover mb-8 shadow-lg shadow-violet-200"}),(0,r.jsx)("h1",{className:"text-2xl font-black text-gray-900 mb-2",children:"Wishlify"}),(0,r.jsx)("p",{className:"text-gray-500 text-sm mb-8 text-center max-w-xs",children:b("emptyState")}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 w-full max-w-xs sm:max-w-none sm:w-auto",children:[(0,r.jsxs)("button",{onClick:()=>el(!0),className:"px-5 py-2.5 bg-primary-600 hover:bg-primary-700 text-white text-sm font-semibold rounded-xl transition-colors text-center",children:["en"===y?"Access My Collections":"Koleksiyonlarına EriÅ"," â"]}),(0,r.jsx)(eW.ChromeButton,{label:b("emptyStateCta"),size:"md"})]}),(0,r.jsxs)("div",{className:"mt-6 flex items-center gap-4",children:[(0,r.jsxs)(o.default,{href:"en"===y?"/en":"/",className:"text-sm text-gray-400 hover:text-primary-600 transition-colors font-medium",children:["â ","en"===y?"Back to Home":"Ana Sayfaya D\xf6n"]}),(0,r.jsx)(eK.B,{})]})]}),(0,r.jsx)(g,{open:ea,onClose:()=>el(!1)})]});let eP={collections:b("allProducts"),sites:b("sites"),discover:b("discover"),events:b("events.nav"),links:b("links.nav"),announcements:b("announcementsNav"),profile:b("profile")};return(0,r.jsx)(Z.AffiliateProvider,{children:(0,r.jsxs)("div",{className:"flex h-dvh overflow-hidden bg-white",children:[(0,r.jsx)(D,{profile:w,collections:H,productCounts:ek,totalCount:K.length,activeCollectionId:L,section:z,isGuest:S,onSelectCollection:e=>{A(e),B("collections")},onSelectSection:eT,onNewCollection:()=>ei(!0),onSignOut:eD}),(0,r.jsxs)("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,r.jsxs)("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 border-b border-gray-100 bg-white shrink-0",children:[(0,r.jsx)(l.default,{src:"/logousethis.png",alt:"Wishlify",width:28,height:28,className:"rounded-lg object-cover shrink-0"}),(0,r.jsx)("span",{className:"font-black text-primary-700 text-base flex-1 truncate",children:eM?"".concat(eM.emoji," ").concat(eM.name):b("collections"===z?"allProducts":z)}),"collections"===z&&L&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>er(!0),className:"p-2 text-white bg-primary-600 hover:bg-primary-700 rounded-lg shrink-0",title:b("addByUrl"),"aria-label":b("addByUrl"),children:(0,r.jsx)(f.Z,{className:"w-[18px] h-[18px]"})}),!S&&(0,r.jsx)("button",{onClick:()=>ed(!0),className:"p-2 text-gray-500 hover:text-primary-600 shrink-0",children:(0,r.jsx)(eG.Z,{className:"w-[18px] h-[18px]"})}),(0,r.jsx)("button",{onClick:()=>eZ(L),className:"p-2 text-gray-400 hover:text-red-500 shrink-0",children:(0,r.jsx)(E.Z,{className:"w-[18px] h-[18px]"})})]}),(0,r.jsx)(eK.B,{})]}),"collections"===z&&(0,r.jsxs)("div",{className:"md:hidden flex items-center gap-2 px-4 py-2 overflow-x-auto scrollbar-none border-b border-gray-100 shrink-0",children:[(0,r.jsxs)("button",{onClick:()=>A(null),className:"shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-semibold transition-colors ".concat(L?"bg-gray-100 text-gray-600":"bg-primary-600 text-white"),children:[b("allProducts"),(0,r.jsx)("span",{className:"text-[10px] font-bold px-1 rounded-full ".concat(L?"bg-gray-200 text-gray-500":"bg-white/20 text-white"),children:K.length})]}),H.map(e=>{var t;return(0,r.jsxs)("button",{onClick:()=>A(e.id),className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-semibold transition-colors ".concat(L===e.id?"bg-primary-600 text-white":"bg-gray-100 text-gray-600"),children:[(0,r.jsx)("span",{children:e.emoji}),(0,r.jsx)("span",{children:e.name}),(0,r.jsx)("span",{className:"text-[10px] font-bold px-1 rounded-full ".concat(L===e.id?"bg-white/20 text-white":"bg-gray-200 text-gray-500"),children:null!==(t=ek[e.id])&&void 0!==t?t:0})]},e.id)}),(0,r.jsx)("button",{onClick:()=>ei(!0),className:"shrink-0 flex items-center justify-center w-7 h-7 rounded-full bg-gray-100 text-gray-500 hover:bg-primary-50 hover:text-primary-600 transition-colors font-bold text-base",children:"+"})]}),"collections"===z&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 md:px-6 py-3 border-b border-gray-100 shrink-0",children:[(0,r.jsxs)("div",{className:"relative flex-1 md:max-w-xs",children:[(0,r.jsx)(eo.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,r.jsx)("input",{type:"text",value:ey,onChange:e=>ev(e.target.value),placeholder:b("search"),className:"w-full pl-9 pr-4 py-2 bg-gray-50 border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-primary-400"})]}),(0,r.jsxs)("select",{value:ej,onChange:e=>ew(e.target.value),className:"text-sm border border-gray-200 rounded-xl px-2 md:px-3 py-2 bg-gray-50 text-gray-600 focus:outline-none focus:ring-2 focus:ring-primary-400",children:[(0,r.jsx)("option",{value:"newest",children:b("sortNewest")}
1),(0,r.jsx)("option",{value:"price-asc",children:b("sortPriceLow")}),(0,r.jsx)("option",{value:"price-desc",children:b("sortPriceHigh")})]}),(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 ml-auto",children:[L&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>er(!0),className:"flex items-center gap-1.5 px-3 py-2 text-sm bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-xl transition-colors",children:[(0,r.jsx)(f.Z,{className:"w-4 h-4"}),b("addByUrl")]}),!S&&(0,r.jsxs)("button",{onClick:()=>ed(!0),className:"flex items-center gap-1.5 px-3 py-2 text-sm text-gray-600 hover:text-primary-600 hover:bg-primary-50 rounded-xl transition-colors",children:[(0,r.jsx)(eG.Z,{className:"w-4 h-4"}),eM?(0,r.jsxs)(r.Fragment,{children:[eM.emoji," ",(0,r.jsx)("span",{className:"max-w-[120px] truncate",children:eM.name})]}):b("share")]}),(0,r.jsx)("button",{onClick:()=>eZ(L),className:"p-2 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",title:b("delete"),children:(0,r.jsx)(E.Z,{className:"w-4 h-4"})})]}),(0,r.jsxs)("button",{onClick:()=>eh(!0),className:"flex items-center gap-1.5 px-3 py-2 text-sm text-gray-600 hover:text-primary-600 hover:bg-primary-50 rounded-xl transition-colors",children:[(0,r.jsx)(eY,{className:"w-4 h-4"}),b("qrOpen")]}),(0,r.jsx)(eK.B,{})]})]}),"collections"===z&&(0,r.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[eM&&(0,r.jsx)("div",{className:"px-4 md:px-6 pt-4 pb-2 shrink-0",children:(0,r.jsxs)("h2",{className:"text-lg font-bold text-gray-900 flex items-center gap-2",children:[(0,r.jsx)("span",{children:eM.emoji}),(0,r.jsx)("span",{children:eM.name})]})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-4 md:px-6 py-4",children:0===eN.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[(0,r.jsx)("div",{className:"text-5xl mb-4",children:"\uD83D\uDECDï¸"}),(0,r.jsx)("p",{className:"text-gray-500 text-sm max-w-xs",children:b("emptyState")}),(0,r.jsx)(eW.ChromeButton,{label:b("emptyStateCta"),size:"md",className:"mt-4"})]}):(0,r.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3 md:gap-4",children:eN.map(e=>{var t;return(0,r.jsx)(M,{product:e,collections:H.filter(t=>t.id!==e.collection_id),currentCollection:null!==(t=H.find(t=>t.id===e.collection_id))&&void 0!==t?t:null,showCollection:!L,onDelete:eS,onMove:e_,onClick:()=>O(e)},e.id)})})})]}),"sites"===z&&(0,r.jsx)(q,{products:K,collections:H,onDelete:eS,onMove:e_,onProductClick:O}),"discover"===z&&(0,r.jsx)(ex,{}),"links"===z&&!S&&(0,r.jsx)(ep,{}),"events"===z&&!S&&(0,r.jsx)(eC,{collections:H,productCounts:ek}),"announcements"===z&&!S&&(0,r.jsx)(eE,{}),"profile"===z&&(0,r.jsx)(eB,{profile:w,onSignOut:eD,onAvatarUpdated:C}),(0,r.jsx)("nav",{className:"md:hidden flex border-t border-gray-100 bg-white shrink-0 safe-bottom",children:e$.filter(e=>{let{s:t}=e;return!(S&&("links"===t||"events"===t||"announcements"===t))}).map(e=>{let{s:t,icon:s}=e;return(0,r.jsxs)("button",{onClick:()=>eT(t),className:"flex-1 flex flex-col items-center gap-0.5 py-2.5 transition-colors ".concat(z===t?"text-primary-600":"text-gray-400"),children:[(0,r.jsx)(s,{className:"w-5 h-5"}),(0,r.jsx)("span",{className:"text-[10px] font-semibold leading-tight",children:eP[t]})]},t)})})]}),!S&&(0,r.jsx)(I,{}),(0,r.jsx)(F,{product:R,collections:H.filter(e=>e.id!==(null==R?void 0:R.collection_id)),onClose:()=>O(null),onDelete:eS,onMove:e_,onPriceUpdate:async(e,t)=>{let s=await et(e,{price_raw:t||null});return s.error?v(s.error,"error"):O(s=>s&&s.id===e?{...s,price_raw:t||null}:s),s}}),(0,r.jsx)(eA,{open:en,onClose:()=>ei(!1),onCreate:async(e,t)=>{var s;let{error:r}=null!==(s=await G(e,t))&&void 0!==s?s:{};r&&v(r.message,"error")}}),(0,r.jsx)(eI,{open:ec,onClose:()=>ed(!1),onGoToLinks:()=>B("links"),onEventCreated:e=>P.push("/".concat("en"===y?"en/":"","app/events/").concat(e)),collectionId:L,collectionName:null!==(x=null===(e=H.find(e=>e.id===L))||void 0===e?void 0:e.name)&&void 0!==x?x:null,collectionEmoji:null!==(m=null===(t=H.find(e=>e.id===L))||void 0===t?void 0:t.emoji)&&void 0!==m?m:null}),(0,r.jsx)(eR,{open:em,onClose:()=>eh(!1)}),!S&&(0,r.jsx)(eu,{onView:()=>B("discover")}),(0,r.jsx)(eH,{open:es,collectionId:L,onClose:()=>er(!1),onAdded:ee}),(0,r.jsx)(eJ.s,{open:null!==eg,title:null!==(u=null==eg?void 0:eg.title)&&void 0!==u?u:"",body:null==eg?void 0:eg.body,confirmLabel:null!==(h=null==eg?void 0:eg.confirmLabel)&&void 0!==h?h:b("delete"),cancelLabel:b("cancel"),danger:null===(p=null==eg?void 0:eg.danger)||void 0===p||p,onConfirm:()=>{null==eg||eg.resolve(!0),ef(null)},onCancel:()=>{null==eg||eg.resolve(!1),ef(null)}})]})})}function eQ(){return(0,r.jsx)(a.Suspense,{children:(0,r.jsx)(eV,{})})}},4440:function(e,t,s){"use strict";s.d(t,{U:function(){return n},ChromeButton:function(){return i}});var r=s(7437),a=s(4508);function l(){window.gtag&&window.gtag("event","install_intent")}let n="https://chromewebstore.google.com/detail/wishlify/coedndifjklkahkpdagkhaadiiejblff";function i(e){let{label:t,size:s="md",className:i}=e;return(0,r.jsxs)("a",{href:n,target:"_blank",rel:"noopener noreferrer",onClick:l,className:(0,a.cn)("relative inline-flex items-center gap-2.5 font-bold rounded-xl text-white transition-all active:scale-95","bg-gradient-to-br from-gray-800 via-gray-900 to-black","shadow-[0_4px_20px_rgba(0,0,0,0.35)] hover:shadow-[0_6px_28px_rgba(0,0,0,0.5)]","hover:from-gray-700 hover:via-gray-800 hover:to-gray-900",{md:"px-5 py-2.5 text-sm",lg:"px-8 py-4 text-base"}[s],i),children:[(0,r.jsx)("svg",{className:"lg"===s?"w-5 h-5":"w-4 h-4",viewBox:"0 0 24 24",fill:"
1currentColor",children:(0,r.jsx)("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm0 2a8 8 0 110 16A8 8 0 0112 4zm0 2a6 6 0 100 12A6 6 0 0012 6zm0 2a4 4 0 110 8 4 4 0 010-8z"})}),t]})}},4645:function(e,t,s){"use strict";s.d(t,{s:function(){return i}});var r=s(7437),a=s(2265),l=s(8930),n=s(3245);function i(e){let{open:t,title:s,body:i,confirmLabel:o,cancelLabel:c,danger:d=!0,onConfirm:x,onCancel:m}=e;return((0,a.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&m()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,m]),t)?(0,r.jsxs)("div",{className:"fixed inset-0 z-[200] flex items-end sm:items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/55 backdrop-blur-md",onClick:m}),(0,r.jsxs)("div",{className:"relative bg-white rounded-3xl shadow-2xl w-full max-w-[300px] mx-auto flex flex-col items-center text-center px-6 pt-8 pb-5 gap-0 animate-modal-in ring-1 ring-black/5",children:[(0,r.jsx)("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-5\n ".concat(d?"bg-rose-50 text-rose-400":"bg-violet-50 text-violet-400"),children:d?(0,r.jsx)(l.Z,{className:"w-7 h-7",strokeWidth:1.6}):(0,r.jsx)(n.Z,{className:"w-7 h-7",strokeWidth:1.6})}),(0,r.jsx)("p",{className:"text-[15px] font-extrabold text-slate-900 leading-snug tracking-tight",children:s}),i&&(0,r.jsx)("p",{className:"mt-2.5 text-xs text-slate-400 leading-relaxed",children:i}),(0,r.jsx)("button",{onClick:x,className:"mt-7 w-full py-3 text-sm font-bold rounded-2xl text-white transition-all active:scale-[.97]\n ".concat(d?"bg-gradient-to-br from-rose-500 to-rose-600 shadow-[0_6px_18px_rgba(244,63,94,0.35)]":"bg-gradient-to-br from-violet-600 to-violet-700 shadow-[0_6px_18px_rgba(124,58,237,0.35)]"),children:o}),(0,r.jsx)("button",{onClick:m,className:"mt-1.5 w-full py-2.5 text-xs font-medium text-slate-400 hover:text-slate-600 transition-colors",children:c})]})]}):null}},7342:function(e,t,s){"use strict";s.d(t,{B:function(){return n}});var r=s(7437),a=s(6010),l=s(2363);function n(e){let{className:t}=e,s=(0,a.bU)(),n=(0,l.tv)(),i=(0,l.jD)();return(0,r.jsx)("button",{onClick:()=>{n.push(i,{locale:"tr"===s?"en":"tr"})},className:"text-xs font-semibold px-2.5 py-1 rounded-lg border border-gray-200 text-gray-600 hover:text-primary-600 hover:border-primary-200 transition-colors ".concat(null!=t?t:""),children:"tr"===s?"\uD83C\uDDEC\uD83C\uDDE7 EN":"\uD83C\uDDF9\uD83C\uDDF7 TR"})}},6121:function(e,t,s){"use strict";s.d(t,{ToastProvider:function(){return c},p:function(){return i}});var r=s(7437),a=s(2265),l=s(2489);let n=(0,a.createContext)({showToast:()=>{}});function i(){return(0,a.useContext)(n)}let o={success:{emoji:"â¦",iconBg:"bg-emerald-100",iconColor:"text-emerald-600",bar:"from-emerald-400 to-emerald-500",border:"border-emerald-100"},error:{emoji:"â",iconBg:"bg-rose-100",iconColor:"text-rose-500",bar:"from-rose-400 to-rose-500",border:"border-rose-100"},info:{emoji:"â¦",iconBg:"bg-primary-100",iconColor:"text-primary-600",bar:"from-primary-400 to-primary-600",border:"border-primary-100"}};function c(e){let{children:t}=e,[s,i]=(0,a.useState)([]),c=(0,a.useRef)(0),d=(0,a.useCallback)(e=>{i(t=>t.filter(t=>t.id!==e))},[]),x=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success",s=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2800,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"Geri Al",l=++c.current;i(n=>[...n,{id:l,message:e,type:t,onUndo:s,undoLabel:a,duration:r}]),setTimeout(()=>d(l),r)},[d]);return(0,r.jsxs)(n.Provider,{value:{showToast:x},children:[t,(0,r.jsx)("div",{className:"fixed z-[200] flex flex-col gap-2 pointer-events-none bottom-[76px] left-3 right-3 md:bottom-6 md:left-auto md:right-6 md:w-[340px]",children:s.map(e=>{let t=o[e.type];return(0,r.jsx)("div",{className:"pointer-events-auto animate-toast-in",children:(0,r.jsxs)("div",{className:"relative flex items-center gap-3 bg-white rounded-2xl border shadow-[0_8px_24px_rgba(0,0,0,0.10)] overflow-hidden ".concat(t.border),children:[(0,r.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-gradient-to-b ".concat(t.bar)}),(0,r.jsx)("div",{className:"ml-4 w-8 h-8 rounded-xl flex items-center justify-center shrink-0 text-sm font-black ".concat(t.iconBg," ").concat(t.iconColor),children:t.emoji}),(0,r.jsx)("span",{className:"flex-1 py-3 text-sm font-semibold text-gray-800 leading-snug pr-1",children:e.message}),e.onUndo&&(0,r.jsx)("button",{onClick:()=>{e.onUndo(),d(e.id)},className:"text-xs font-black shrink-0 px-2 py-1 rounded-lg ".concat(t.iconBg," ").concat(t.iconColor," hover:opacity-80 transition-opacity"),children:e.undoLabel}),(0,r.jsx)("button",{onClick:()=>d(e.id),className:"pr-3 pl-1 py-3 text-gray-300 hover:text-gray-500 transition-colors shrink-0",children:(0,r.jsx)(l.Z,{className:"w-3.5 h-3.5"})}),(0,r.jsx)("span",{className:"absolute bottom-0 left-0 h-[2px] bg-gradient-to-r ".concat(t.bar," opacity-40 rounded-full"),style:{animation:"toast-shrink ".concat(e.duration,"ms linear forwards")}})]})},e.id)})})]})}},5998:function(e,t,s){"use strict";s.d(t,{u:function(){return i}});var r=s(7437),a=s(2265),l=s(4508),n=s(2489);function i(e){let{open:t,onClose:s,title:i,children:o,className:c}=e;return((0,a.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:s}),(0,r.jsxs)("div",{className:(0,l.cn)("relative bg-white rounded-2xl shadow-2xl w-full max-w-md p-6",c),children:[i&&(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h3",{className:"text-base font-bold text-gray-900",children:i}),(0,r.jsx)("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,r.jsx)(n.Z,{className:"w-5 h-5"})})]}),o]})]}):null}},7419:function(e,t,s){"use strict";s.d(t,{AffiliateProvider:function(){return i},h:function(){return o}});var r=s(7437),a=s(2265),l=s(3948);let n=(0,a.createContext)(null);function i(e){let{children:t}=e,[s,i]=(0,a.useState)([]);(0,a.useEffect)(()=>{fetch("/api/merchants",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{(null==e?void 0:e.merchants)&&i(e.merchants)}).catch(()=>{})},[]);let o=(0,a.useMemo)(()=>e=>{if(!e||"string"!=typeof e)return"#";try{let n=new URL(e);if("http:"!==n.protocol&&"https:"!==n.protocol)return"#";for(let l of s){var t,r,a;if(null===(t=l.host_patterns)||void 0===t?void 0:t.length)for(let t of l.host_patterns)try{if(!RegExp(t,"i").test(n.hostname))continue;if("amazon"===l.network&&l.affiliate_tag)return function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"tag";try{let r=new URL(e);return r.searchParams.set(s,t),r.toString()}catch(t){return e}}(e,l.affiliate_tag,l.deeplink_param||"tag");let s=null===(r=l.deeplink_base)||void 0===r?void 0:r.trim();if(s&&/^https?:\/\//i.test(s))return function(e,t,s){if(e.includes("{target}"))return e.replace(/\{target\}/g,encodeURIComponent(s));let r=e.includes("?")?"&":"?";return"".concat(e).concat(r).concat(t||"ulp","=").concat(encodeURIComponent(s))}(s,null!==(a=l.deeplink_param)&&void 0!==a?a:"ulp",e)}catch(e){}}let i=(0,l.pB)(n.hostname);if(i)return(0,l.MJ)(i,e);return e}catch(e){return"#"}},[s]);return(0,r.jsx)(n.Provider,{value:o,children:t})}function o(){let e=(0,a.useContext)(n);return t=>e?e(null!=t?t:""):function(e){if(!e||"string"!=typeof e)return"#";try{let t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol?e:"#"}catch(e){return"#"}}(t)}},2363:function(e,t,s){"use strict";s.d(t,{jD:function(){return i},tv:function(){return o}});var r=s(9198);let a=(0,s(5426).Z)({locales:["tr","en"],defaultLocale:"tr",localePrefix:"as-needed"}),{Link:l,redirect:n,usePathname:i,useRouter:o}=(0,r.Z)(a)},3948:function(e,t,s){"use strict";s.d(t,{MJ:function(){return l},pB:function(){return a}});let r=[{id:"walmart",name:"Walmart",brandColor:"#0071ce",siteUrl:"https://www.walmart.com",logoEmoji:"\uD83D\uDED2",category:"general",locales:["en"],hostPatterns:[/(^|\.)walmart\.com$/i],deeplinkBase:"https://bednari.com/g/4jg2ecwjgp2e5d1f98afbef27d4341/",description:{tr:"ABD'nin en b\xfcy\xfck perakende zinciri. Elektronikten markete, modaya kadar her Åey.",en:"The largest US retail chain. Electronics, groceries, fashion, home â everything in one place."}},{id:"geekbuying",name:"Geekbuying",brandColor:"#e60012",siteUrl:"https://www.geekbuying.com",logoEmoji:"\uD83D\uDCF1",category:"electronics",locales:["en","tr"],hostPatterns:[/(^|\.)geekbuying\.com$/i],deeplinkBase:"https://bywiola.com/g/78tuvzaw8k2e5d1f98af0267b86f6e/",description:{tr:"K\xfcresel teknoloji ve gadget pazarı. Telefon, akıllı ev cihazları, elektrikli scooter ve daha fazlası.",en:"Global tech and gadget marketplace. Phones, smart home, e-scooters, drones and more."}},{id:"alibaba",name:"Alibaba",brandColor:"#ff6a00",siteUrl:"https://www.alibaba.com",logoEmoji:"\uD83C\uDF10",category:"general",locales:["en","tr"],hostPatterns:[/(^|\.)alibaba\.com$/i],deeplinkBase:"https://rzekl.com/g/pm1aev55cl2e5d1f98af219aa26f6f/",description:{tr:"K\xfcresel B2B ticaret pazarı. \xdcreticilerden doÄrudan toptan veya proje bazlı satın alma.",en:"Global B2B trade marketplace. Source products directly from manufacturers worldwide."}},{id:"hacoo",name:"Hacoo",brandColor:"#111111",siteUrl:"https://www.hacoo.app",logoEmoji:"\uD83D\uDECDï¸",category:"fashion",locales:["en","tr"],hostPatterns:[/(^|\.)hacoo\.app$/i],deeplinkBase:"https://dorinebeaumont.com/g/84e1j7pvh12e5d1f98aff271888eea/",description:{tr:"Trend giyim, aksesuar ve ev \xfcr\xfcnleri uygun fiyatlarla. Hızlı kargo d\xfcnya genelinde.",en:"Trendy fashion, accessories and home goods at affordable prices. Ships worldwide."}},{id:"gshopper",name:"Gshopper",brandColor:"#28a745",siteUrl:"https://www.gshopper.com",logoEmoji:"\uD83C\uDF0D",category:"electronics",locales:["en","tr"],hostPatterns:[/(^|\.)gshopper\.com$/i],deeplinkBase:"https://bywiola.com/g/nx2yncwth62e5d1f98afd497214fca/",description:{tr:"K\xfcresel gadget maÄazası. Akıllı ev, telefon aksesuarları, drone ve daha fazlası.",en:"Global gadget marketplace. Smart home, phone accessories, drones and more."}},{id:"stylewe",name:"StyleWe",brandColor:"#1a1a1a",siteUrl:"https://www.stylewe.com",logoEmoji:"\uD83D\uDC57",category:"fashion",locales:["en","tr"],hostPatterns:[/(^|\.)stylewe\.com$/i],deeplinkBase:"https://codeaven.com/g/r9ybpohdxo2e5d1f98af806f4427c0/",description:{tr:"BaÄımsız tasarımcı kadın giyim pazarı. EÅsiz par\xe7alar ve modern siluetler.",en:"Independent-designer womenswear marketplace. Unique pieces and modern silhouettes."}},{id:"timberland",name:"Timberland",brandColor:"#7c4f1a",siteUrl:"https://www.timberland.com",logoEmoji:"\uD83E\uDD7E",category:"fashion",locales:["en","tr"],hostPatterns:[/(^|\.)timberland\.(com|com\.tr|co\.uk|de|fr|it|es|nl|ca|jp|com\.au|com\.mx|ae|com\.cn|ru)$/i],deeplinkBase:"https://vxrlm.com/g/a5zw6cyyga2e5d1f98af30161b8f9f/",de
1scription:{tr:"İkonik outdoor bot ve giyim markası. Su ge\xe7irmez, dayanıklı, klasik tasarımlar.",en:"Iconic outdoor boots and apparel. Waterproof, durable, timeless designs."}},{id:"diesel",name:"Diesel",brandColor:"#d70015",siteUrl:"https://www.diesel.com",logoEmoji:"\uD83D\uDC56",category:"fashion",locales:["en"],hostPatterns:[/(^|\.)diesel\.(com|com\.tr|co\.uk|co\.kr|de|fr|it|es|ae)$/i],deeplinkBase:"https://bywiola.com/g/idw1vvlz5l2e5d1f98af8716e55fa2/",description:{tr:"İtalyan kot ve premium moda markası. Cesur tasarımlar, ikonik denim.",en:"Italian denim and premium fashion. Bold designs, signature denim."}},{id:"noracora",name:"Noracora",brandColor:"#2c2c2c",siteUrl:"https://www.noracora.com",logoEmoji:"\uD83D\uDC5A",category:"fashion",locales:["en","tr"],hostPatterns:[/(^|\.)noracora\.com$/i],deeplinkBase:"https://qwpeg.com/g/of8pqgktr22e5d1f98afc8dbeb8f0d/",description:{tr:"Vintage esinli kadın giyim. Rahat keten elbiseler, boho stiller.",en:"Vintage-inspired womenswear. Comfortable linen dresses, boho styles."}}];function a(e){return r.find(t=>t.hostPatterns.some(t=>t.test(e)))}function l(e,t){var s;let r=null===(s=e.deeplinkBase)||void 0===s?void 0:s.trim();return r&&/^https?:\/\//i.test(r)?"".concat(r,"?ulp=").concat(encodeURIComponent(t)):t}},970:function(e,t,s){"use strict";s.d(t,{N:function(){return l}});var r=s(887);let a=null;function l(){return a||(a=(0,r.createBrowserClient)("https://nkkpkrkzkrulywzptxtb.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im5ra3Brcmt6a3J1bHl3enB0eHRiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzU0MDgwNzMsImV4cCI6MjA5MDk4NDA3M30.o9rOZ9pfE8dM9OEaCjHsjKoy3gQQY6RIqOcGKX-7vzA")),a}},4508:function(e,t,s){"use strict";s.d(t,{T:function(){return n},cn:function(){return l},g:function(){return i}});var r=s(1994),a=s(3335);function l(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,a.m6)((0,r.W)(t))}function n(e,t,s,r){if(e){let s="TL"===t?"TRY":null!=t?t:"TRY";try{return new Intl.NumberFormat("en"===r?"en-US":"tr-TR",{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(t){return"".concat(e," ").concat(s)}}return null!=s?s:""}function i(e){try{return new URL(e).hostname.replace("www.","")}catch(t){return e}}},2660:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},875:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},2451:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},9322:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},7769:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},2208:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},3245:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},1817:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},6439:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("megaphone",[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]])},5675:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(7411).Z)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},7648:function(e,t,s){"use strict";s.d(t,{default:function(){return a.a}});var r=s(2972),a=s.n(r)}},function(e){e.O(0,[9762,2972,8266,8720,5258,619,3451,2971,2117,1744],function(){return e(e.s=5847)}),_N_E=e.O()}]);
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.