PageSourceSearch

https://www.emelpirlanta.com/_next/static/chunks/86388.e0130590ae2b282e.js

js emelpirlanta.com collected 2026-09-27 02:10:52 UTC 34,904 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[86388],{3989:(e,t,a)=>{a.d(t,{B9:()=>u,JW:()=>f,UC:()=>p,at:()=>d,eX:()=>m});let r=e=>String(e||"").trim().replace(/^\/+/,""),s=["matras-assets","matras-media","zen-assets","zen-import","images","uploads","local-uploads"],n=["matras-assets","zen-assets","zen-import"],l=["products","urunler"],i=["banners","blog","homepage-template","pdp-content-sections","resim","sertifika","site","stores","tenants","uploads"],o=["zen-import","matras-media/urun","resim/urun"];function c(e,t){let a=r(e),s=r(t).replace(/\/+$/,"");return a===s||a.startsWith("".concat(s,"/"))}function d(e){let t=r(e);return s.some(e=>c(t,e))}function u(e){let t=r(e);return n.some(e=>c(t,e))}function m(e){let t=r(e);return l.some(e=>c(t,e))}function p(e){let t=r(e);return i.some(e=>c(t,e))}function f(e){let t=r(e);return o.some(e=>c(t,e))}},23700:(e,t,a)=>{async function r(e,t){var a,r,n,l,i;let o=await e.json().catch(()=>({}));if(401===e.status||(null==o?void 0:o.message)==="Unauthorized"||(null==o||null==(a=o.error)?void 0:a.code)==="UNAUTHORIZED"||(null==o||null==(r=o.error)?void 0:r.code)==="TOKEN_CHANGED")throw(null==t?void 0:t.signOut)&&await t.signOut(),new s("Oturum s\xfcresi doldu veya ge\xe7ersiz",401,o);if(!(e.ok&&(null==o?void 0:o.success)!==!1)){let t=null==o?void 0:o.details;throw new s((null==o?void 0:o.error_message)||(null==t?void 0:t.error_message)||(null==o||null==(n=o.error)?void 0:n.description)||(null==t||null==(l=t.error)?void 0:l.description)||(null==t?void 0:t.message)||(null==o?void 0:o.message)||("string"==typeof(null==o?void 0:o.error)?o.error:"")||(400===(i=e.status)?"G\xf6nderilen bilgiler ge\xe7ersiz veya eksik.":401===i?"Oturum s\xfcresi doldu veya ge\xe7ersiz.":403===i?"Bu işlem i\xe7in yetkiniz yok.":404===i?"İstenen işlem bulunamadı.":408===i||504===i?"İstek zamanında tamamlanamadı.":429===i?"\xc7ok fazla deneme yapıldı. Bir s\xfcre sonra yeniden deneyin.":i>=500?"Servis isteği tamamlayamadı. L\xfctfen tekrar deneyin.":"İstek başarısız oldu (".concat(i,").")),e.status,o)}return o}a.d(t,{fp:()=>s,j:()=>r,n2:()=>n});class s extends Error{constructor(e,t,a){super(e),this.status=t,this.details=a,this.name="ClientResponseError"}}let n="application/vnd.msgpack, application/json, */*"},25016:(e,t,a)=>{a.d(t,{cn:()=>n});var r=a(2821),s=a(75889);function n(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.QP)((0,r.$)(t))}},30224:(e,t,a)=>{a.d(t,{Breadcrumb:()=>r});function r(e){return null}},31911:(e,t,a)=>{a.d(t,{b:()=>i});var r=a(38620),s=a(23700);let n=new Map;function l(e){return e.startsWith("/api/proxy/")?e:"/api/proxy/".concat(e.replace(/^\/+/,""))}async function i(e,t){var a;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=l(e),c=null!=(a=i.ttlMs)?a:6e4,d="".concat(t,":").concat(l(o)),u=Date.now();if(!i.bypassCache&&c>0){let e=n.get(d);if(e&&e.expiresAt>u)return e.promise}let m={Accept:s.n2};t&&(m.Authorization="Bearer ".concat(t));let p=fetch(o,{headers:m,cache:"no-store"}).then(e=>(0,s.j)(e,{signOut:r.d}));return c>0&&(n.set(d,{expiresAt:u+c,promise:p}),p.catch(()=>{var e;(null==(e=n.get(d))?void 0:e.promise)===p&&n.delete(d)})),p}},33789:(e,t,a)=>{a.d(t,{p:()=>l});var r=a(95155),s=a(12115),n=a(25016);let l=s.forwardRef((e,t)=>{let{className:a,type:s,...l}=e;return(0,r.jsx)("input",{type:s,autoComplete:"off",className:(0,n.cn)("flex h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 transition-colors",a),ref:t,...l})});l.displayName="Input"},38620:(e,t,a)=>{a.d(t,{d:()=>s});var r=a(36489);function s(){return(0,r.signOut)({redirect:!0,callbackUrl:new URL("/auth/login",window.location.origin).toString()})}},47507:(e,t,a)=>{a.d(t,{bq:()=>m,eb:()=>h,gC:()=>x,l6:()=>d,yv:()=>u});var r=a(95155),s=a(12115),n=a(47887),l=a(24033),i=a(12108),o=a(5917),c=a(25016);let d=n.bL;n.YJ;let u=n.WT,m=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;
1return(0,r.jsxs)(n.l9,{ref:t,className:(0,c.cn)("flex h-11 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm  placeholder:text-muted-foreground focus:outline-none  disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[s,(0,r.jsx)(n.In,{asChild:!0,children:(0,r.jsx)(l.A,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=n.l9.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.PP,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,r.jsx)(i.A,{className:"h-4 w-4"})})});p.displayName=n.PP.displayName;let f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.wn,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,r.jsx)(l.A,{className:"h-4 w-4"})})});f.displayName=n.wn.displayName;let x=s.forwardRef((e,t)=>{let{className:a,children:s,position:l="popper",...i}=e;return(0,r.jsx)(n.ZL,{children:(0,r.jsxs)(n.UC,{ref:t,className:(0,c.cn)("relative z-[10000] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:l,...i,children:[(0,r.jsx)(p,{}),(0,r.jsx)(n.LM,{className:(0,c.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,r.jsx)(f,{})]})})});x.displayName=n.UC.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.JU,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...s})}).displayName=n.JU.displayName;let h=s.forwardRef((e,t)=>{let{className:a,children:s,...l}=e;return(0,r.jsxs)(n.q7,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...l,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(n.VF,{children:(0,r.jsx)(o.A,{className:"h-4 w-4"})})}),(0,r.jsx)(n.p4,{children:s})]})});h.displayName=n.q7.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.wv,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=n.wv.displayName},54679:(e,t,a)=>{a.d(t,{Cf:()=>p,Es:()=>x,HM:()=>u,L3:()=>h,c7:()=>f,lG:()=>o,rr:()=>g,zM:()=>c});var r=a(95155),s=a(12115),n=a(89511),l=a(65229),i=a(25016);let o=n.bL,c=n.l9,d=n.ZL,u=n.bm,m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.hJ,{ref:t,"data-app-dialog-overlay":"",className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s})});m.displayName=n.hJ.displayName;let p=s.forwardRef((e,t)=>{let{className:a,children:s,...o}=e;return(0,r.jsxs)(d,{children:[(0,r.jsx)(m,{}),(0,r.jsxs)(n.UC,{ref:t,"data-app-dialog-content":"",className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...o,children:[s,(0,r.jsxs)(n.bm,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(l.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});p.displayName=n.UC.displayName;let f=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};f.displayName="DialogHeader";let x=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};x.displayName="DialogFooter";let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.hE,{ref:t,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",a),...s})});h.displayName=n.hE.displayName;let g=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.VY,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});g.displayName=n.VY.displayName},69077:(e,t,a)=>{a.d(t,{a:()=>c});let r=["products","urunler"],s=["zen-import","matras-media/urun"];function n(e,t){let a=String(e||"").trim().replace(/^\/+/,""),r=String(t||"").trim().replace(/^\/+|\/+$/g,"");return a===r||a.startsWith("".concat(r,"/"))}function l(e){return String(e||"https://cdn.storefront.local").replace(/\/+$/,"")}function i(e,t){if(!e)return"";if(/^https?:\/\//.test(e)||e.startsWith("blob:"))return e;let a=e.replace(/^\/+/,""),i=function(e){let t=String(e||"").trim().replace(/^\/+/,"");if(!t)return"";if(r.some(e=>n(t,e)))return t;let a=t.split("/").pop();return a&&s.some(e=>n(t,e))?"products/".concat(a):""}(a);return e.startsWith("/local-uploads/")||e.startsWith("local-uploads/")?"/".concat(a):i?"".concat(l(t),"/").concat(i):e.startsWith("/uploads/")||e.startsWith("uploads/")?"/local-uploads/".concat(a.replace(/^uploads\/+/,"")):e.startsWith("/zen-import/")||e.startsWith("zen-import/")?e.startsWith("/")?e:"/".concat(e):"".concat(l(t),"/").concat(a)}var o=a(3989);function c(e,t){let a=String(e||"").trim();if(!a)return"";let r=String(t||"").trim().replace(/\/+$/,"")||String(window.__KALIMERO_DASHBOARD_MEDIA_CDN_BASE_URL__||"").trim().replace(/\/+$/,"");if(r){if(/^https?:\/\//i.test(a))try{let e=new URL(a);if(!function(e){let t=String(e||"").trim().replace(/^\/+/,"");return(0,o.eX)(t)||(0,o.UC)(t)||(0,o.JW)(t)}(e.pathname))return a;let t=new URL(r).hostname;if(e.hostname&&t&&e.hostname!==t)return a;let s=i(e.pathname.replace(/^\/+/,""),r);if(!/^https?:\/\//i.test(s))return s;let n=new URL(s);return n.search=e.search,n.toString()}catch(e){return a}return i(a,r)}if(/^https?:\/\//i.test(a)||a.startsWith("blob:"))return a;let s=a.replace(/^\/+/,"");return s?s.startsWith("uploads/")?"/local-uploads/".concat(s.replace(/^uploads\/+/,"")):"/".concat(s):""}},82180:(e,t,a)=>{a.d(t,{Bc:()=>i,PR:()=>u,ZI:()=>d,k$:()=>c,m_:()=>o});var r=a(95155),s=a(12115),n=a(47520),l=a(25016);let i=n.Kq,o=n.bL,c=n.l9,d=s.forwardRef((e,t)=>{let{className:a,sideOffset:s=4,...i}=e;return(0,r.jsx)(n.UC,{ref:t,sideOffset:s,className:(0,l.cn)("z-50 overflow-hidden rounded-md border bg-white px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",a),...i})});d.displayName=n.UC.displayName;let u=n.i3},83209:(e,t,a)=>{a.d(t,{BT:()=>u,Wu:()=>m,ZB:()=>d,Zp:()=>o,aR:()=>c,wL:()=>p});var r=a(95155),s=a(12115),n=a(25016),l=a(82180),i=a(80021);let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("rounded-lg border bg-card text-card-foreground shadow-custom",a),...s})});o.displayName="Card";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("flex flex-col space-y-1.5 py-2 px-4 border-b ",a),...s})});
1c.displayName="CardHeader";let d=s.forwardRef((e,t)=>{let{className:a,tooltip:s,children:o,...c}=e;return(0,r.jsxs)("div",{ref:t,className:(0,n.cn)("text-[16px] lg:h-[40px] lg:!leading-[40px] text-[#111827] font-semibold tracking-tight flex items-center gap-2",a),...c,children:[(0,r.jsx)("span",{children:o}),s&&(0,r.jsx)(l.Bc,{delayDuration:0,children:(0,r.jsxs)(l.m_,{children:[(0,r.jsx)(l.k$,{asChild:!0,children:(0,r.jsx)("span",{className:"ml-1 align-middle cursor-pointer flex items-center",onMouseDown:e=>e.preventDefault(),onTouchStart:e=>e.preventDefault(),children:(0,r.jsx)(i.A,{className:"inline h-4 w-4 text-muted-foreground"})})}),(0,r.jsxs)(l.ZI,{sideOffset:8,side:"top",align:"center",className:"text-[13px] leading-[14px] border-none shadow-none -mt-4 bg-black text-white max-w-[200px]",children:[(0,r.jsx)(l.PR,{className:"fill-black -mt-[1px]"}),s]})]})})]})});d.displayName="CardTitle";let u=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("text-sm text-muted-foreground",a),...s})});u.displayName="CardDescription";let m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("p-4 ",a),...s})});m.displayName="CardContent";let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("flex items-center p-4 md:p-6 pt-0",a),...s})});p.displayName="CardFooter"},86388:(e,t,a)=>{a.r(t),a.d(t,{default:()=>M});var r=a(95155),s=a(12115),n=a(15239),l=a(36489),i=a(83209),o=a(97003),c=a(33789),d=a(47507),u=a(54679),m=a(30224),p=a(49476),f=a(35299),x=a(90368),h=a(27937),g=a(18720),y=a(31911),v=a(69077),b=a(17787),j=a(49027),N=a(27587);let w=[{value:"price-asc",label:"Fiyata g\xf6re artan"},{value:"price-desc",label:"Fiyata g\xf6re azalan"},{value:"discount-desc",label:"İndirim oranına g\xf6re azalan"},{value:"sales-count",label:"Satış adedine g\xf6re"},{value:"view-count",label:"G\xf6r\xfcnt\xfclenme sayısına g\xf6re"},{value:"conversion-rate",label:"D\xf6n\xfcş\xfcm oranına g\xf6re"},{value:"newest",label:"Yeni eklenenler"},{value:"manual",label:"\xd6zel Sıralama"}],k=[{value:"normal",label:"Normal",description:"Standart \xfcr\xfcn kartı"},{value:"wide",label:"Geniş",description:"Desktop gridde iki kolon"},{value:"large",label:"B\xfcy\xfck",description:"Desktop gridde \xf6ne \xe7ıkan b\xfcy\xfck kart"}];function S(e){return"wide"===e||"large"===e?e:"normal"}function z(e){let t={};return(e||[]).forEach(e=>{let a=Number(e.product_id||0);Number.isFinite(a)&&!(a<=0)&&(t[a]=S(e.card_variant))}),t}function C(e){var t;return{id:e.id,name:e.name,price:"number"==typeof e.sell_price?e.sell_price:0,currency:(null==(t=e.currency)?void 0:t.trim().toUpperCase())||"",discountPrice:"number"==typeof e.discount_price?e.discount_price:null,image:e.image_url||"",status:"ACTIVE"===e.status?"active":"inactive",barcode:e.barcode||e.sku||String(e.id),categoryIds:(e.category_ids||[]).filter(e=>"number"==typeof e),collectionIds:(e.collection_ids||[]).filter(e=>"number"==typeof e),createdAtTs:e.created_at?new Date(e.created_at).getTime():0}}function A(e,t,a){return"collection"===e&&a?{scopeType:"collection",scopeId:Number(a)||0}:"category"===e&&t?{scopeType:"category",scopeId:Number(t)||0}:{scopeType:"all",scopeId:0}}function R(e,t){window.localStorage.setItem(e,JSON.stringify(t))}function _(e,t){let a=e.map(e=>e.id);return[...t.filter(e=>a.includes(e)),...a.filter(e=>!t.includes(e))]}async function D(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(a.cacheLookup)return(0,y.b)(e,t);let r=await fetch("/api/proxy".concat(e),{headers:{Authorization:"Bearer ".concat(t),Accept:"application/vnd.msgpack, application/json, */*"},cache:"no-store"}),s=await r.json().catch(()=>({}));if(!r.ok||(null==s?void 0:s.success)===!1)throw Error((null==s?void 0:s.message)||"Veri alınamadı");return s}function E(e){let{product:t,absoluteIndex:a,cardVariant:s,onMoveClick:l,onCardVariantChange:i}=e,{attributes:o,listeners:c,setNodeRef:u,transform:m,transition:f,isDragging:x}=(0,j.gl)({id:t.id});return(0,r.jsx)("div",{ref:u,style:{transform:N.Ks.Transform.toString(m),transition:f,opacity:x?.45:1,zIndex:x?20:"auto"},className:"relative",children:(0,r.jsxs)("div",{className:"group w-full rounded-lg border bg-white p-4 transition-all duration-200 hover:shadow-md",children:[(0,r.jsxs)("div",{className:"mb-3 flex items-start justify-between",children:[(0,r.jsxs)("span",{className:"rounded bg-gray-100 px-2 py-1 text-xs text-gray-500",children:["#",a+1]}),(0,r.jsx)("button",{type:"button",className:"rounded p-1 opacity-0 transition-opacity duration-200 hover:bg-gray-100 group-hover:opacity-100",onClick:e=>{e.stopPropagation(),l(t.id)},children:(0,r.jsx)(p.A,{className:"h-4 w-4 text-gray-400"})})]}),(0,r.jsx)("div",{className:"relative mb-3 flex h-32 w-full cursor-move items-center justify-center overflow-hidden rounded-lg bg-gray-100",...o,...c,children:t.image?(0,r.jsx)(n.default,{src:(0,v.a)(t.image),alt:t.name,fill:!0,sizes:"240px",className:"object-cover",unoptimized:!0}):(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"G\xf6rsel yok"})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h3",{className:"line-clamp-2 text-sm font-medium",children:t.name}),(0,r.jsxs)("p",{className:"text-lg font-bold text-primary",children:[t.price.toLocaleStr
1ing("tr-TR")," ",t.currency]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-1 block text-xs font-medium text-gray-500",children:"Kart tipi"}),(0,r.jsxs)(d.l6,{value:s,onValueChange:e=>i(t.id,S(e)),children:[(0,r.jsx)(d.bq,{className:"h-8 text-xs",onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,r.jsx)(d.yv,{})}),(0,r.jsx)(d.gC,{children:k.map(e=>(0,r.jsx)(d.eb,{value:e.value,children:(0,r.jsxs)("span",{className:"flex flex-col",children:[(0,r.jsx)("span",{children:e.label}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:e.description})]})},e.value))})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium ".concat("active"===t.status?"border-green-200 bg-green-50 text-green-700":"border-red-200 bg-red-50 text-red-700"),children:"active"===t.status?"Aktif":"Pasif"}),(0,r.jsxs)("div",{className:"text-xs text-gray-500",children:["Barkod: ",t.barcode]})]})]})]})})}function M(){let{data:e,status:t}
1=(0,l.useSession)(),[a,p]=(0,s.useState)("category"),[y,N]=(0,s.useState)(""),[k,M]=(0,s.useState)(""),[L,K]=(0,s.useState)("manual"),[P,B]=(0,s.useState)(!0),[I,T]=(0,s.useState)(!0),[U,W]=(0,s.useState)(1),[O,$]=(0,s.useState)(12),[V,G]=(0,s.useState)([]),[Z,F]=(0,s.useState)([]),[J,q]=(0,s.useState)([]),[H,Y]=(0,s.useState)([]),[X,Q]=(0,s.useState)({}),[ee,et]=(0,s.useState)(null),[ea,er]=(0,s.useState)(!1),[es,en]=(0,s.useState)(null),[el,ei]=(0,s.useState)(""),[eo,ec]=(0,s.useState)(!0),[ed,eu]=(0,s.useState)(!1),em=null==e?void 0:e.accessToken,ep=(0,s.useMemo)(()=>"category"===a&&y?"product-order:category:".concat(y):"collection"===a&&k?"product-order:collection:".concat(k):"product-order:all",[a,y,k]),ef=(0,s.useMemo)(()=>{var e,t;return"category"===a?(null==(t=Z.find(e=>String(e.id)===y))?void 0:t.name)||"Kategori se\xe7iniz":(null==(e=J.find(e=>String(e.id)===k))?void 0:e.name)||"Koleksiyon se\xe7iniz"},[Z,J,y,k,a]);(0,s.useEffect)(()=>{if(!em)return;let e=!0;return(async()=>{try{ec(!0);let[t,a,r]=await Promise.all([D("/products/ordering-options?size=5000",em),D("/categories/options?size=1000",em,{cacheLookup:!0}),D("/collections/options?size=1000",em,{cacheLookup:!0})]);if(!e)return;let s=(t.data||[]).map(C),n=a.data||[],l=r.data||[];G(s),F(n),q(l),n.length>0&&N(e=>e||String(n[0].id)),l.length>0&&M(e=>e||String(l[0].id))}catch(e){console.error(e),g.toast.error("\xdcr\xfcn sıralama verileri y\xfcklenemedi")}finally{e&&ec(!1)}})(),()=>{e=!1}},[em]),(0,s.useEffect)(()=>{"category"===a&&!y&&Z.length>0&&N(String(Z[0].id)),"collection"===a&&!k&&J.length>0&&M(String(J[0].id))},[Z,J,y,k,a]);let ex=(0,s.useMemo)(()=>{if("category"===a){if(!y)return[];let e=Number(y);return V.filter(t=>t.categoryIds.includes(e))}if(!k)return[];let e=Number(k);return V.filter(t=>t.collectionIds.includes(e))},[V,y,k,a]);(0,s.useEffect)(()=>{if(!em)return;let e=!1;return(async()=>{let t=function(e){try{let t=window.localStorage.getItem(e);if(!t)return[];let a=JSON.parse(t);return Array.isArray(a)?a.filter(e=>"number"==typeof e):[]}catch(e){return[]}}(ep),{scopeType:r,scopeId:s}=A(a,y,k);try{var n,l;let a=await fetch("/api/product-orderings?scope_type=".concat(r,"&scope_id=").concat(s),{cache:"no-store"}),i=await a.json().catch(()=>({}));if(!a.ok||(null==i?void 0:i.success)===!1)throw Error("Kaydedilmiş sıra alınamadı");let o=Array.isArray(null==(n=i.data)?void 0:n.product_ids)?i.data.product_ids.filter(e=>"number"==typeof e):[],c=z(null==(l=i.data)?void 0:l.items),d=o.length>0?o:t;if(e)return;o.length>0&&R(ep,o),Y(_(ex,d)),Q(c),W(1)}catch(a){if(console.error(a),e)return;Y(_(ex,t)),Q({}),W(1)}})(),()=>{e=!0}},[em,ep,ex,y,k,a]);let eh=(0,s.useMemo)(()=>{let e=new Map(ex.map(e=>[e.id,e]));return[...H.map(t=>e.get(t)).filter(e=>!!e),...ex.filter(e=>!H.includes(e.id))]},[H,ex]),eg=(0,s.useMemo)(()=>{if("manual"===L)return eh;let e=[...eh];switch(L){case"price-asc":return e.sort((e,t)=>e.price-t.price),e;case"price-desc":return e.sort((e,t)=>t.price-e.price),e;case"discount-desc":return e.sort((e,t)=>{let a=null!=e.discountPrice&&e.price>0?(e.price-e.discountPrice)/e.price*100:0;return(null!=t.discountPrice&&t.price>0?(t.price-t.discountPrice)/t.price*100:0)-a}),e;case"newest":return e.sort((e,t)=>t.createdAtTs-e.createdAtTs),e;default:return e}},[eh,L]),ey=(0,s.useMemo)(()=>P?eg:eg.filter(e=>"active"===e.status),[eg,P]),ev=ey.length,eb=Math.max(1,Math.ceil(ev/O));(0,s.useEffect)(()=>{U>eb&&W(eb)},[U,eb]);let ej=(U-1)*O,eN=ey.slice(ej,ej+O),ew=(0,b.FR)((0,b.MS)(b.AN),(0,b.MS)(b.uN,{coordinateGetter:j.JR})),ek=e=>{Y(function(e,t,a){let r=new Set(t),s=0;return e.map(e=>{if(!r.has(e))return e;let t=a[s];return s+=1,t})}(eg.map(e=>e.id),ey.map(e=>e.id),e))},eS=(e,t)=>{let a=ey.map(e=>e.id),r=a.indexOf(e);if(-1===r)return;let s=Math.max(0,Math.min(t-1,a.length-1));K("manual"),ek((0,j.be)(a,r,s)),g.toast.success("\xdcr\xfcn ".concat(t,". sıraya taşındı"))},ez=(e,t)=>{K("manual"),Q(a=>({...a,[e]:t}))},eC=async()=>{try{var e;eu(!0);let{scopeType:t,scopeId:r}=A(a,y,k),s=eg.map(e=>e.id),n=s.map(e=>({product_id:e,card_variant:S(X[e])})),l=await fetch("/api/product-orderings",{method:"PATCH",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({scope_type:t,scope_id:r,product_ids:s,items:n})}),i=await l.json().catch(()=>({}));if(!l.ok||(null==i?void 0:i.success)===!1)throw Error((null==i?void 0:i.message)||"Sıralama kaydedilemedi");Y(s),Q(z(Array.isArray(null==i||null==(e=i.data)?void 0:e.items)?i.data.items:n)),R(ep,s),g.toast.success("Sıralama kaydedildi ve vitrinde aktif edildi")}catch(e){console.error(e),g.toast.error(e instanceof Error?e.message:"Sıralama kaydedilemedi")}finally{eu(!1)}};(0,s.useEffect)(()=>{let e=e=>{("ArrowLeft"===e.key||"a"===e.key||"A"===e.key)&&U>1&&(e.preventDefault(),W(e=>Math.max(1,e-1))),("ArrowRight"===e.key||"d"===e.key||"D"===e.key)&&U<eb&&(e.preventDefault(),W(e=>Math.min(eb,e+1)))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[U,eb]);let eA=null!=ee?ey.find(e=>e.id===ee):null,eR="category"===a&&!y||"collection"===a&&!k;return(0,r.jsxs)("div",{className:"px-4 py-2 lg:px-8 lg:py-4",children:[(0,r.jsx)(m.Breadcrumb,{items:[{label:"\xdcr\xfcn Sıralama"}]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-4",children:[(0,r.jsx)("div",{className:"pb-5 transition-all duration-300 ease-in-out ".concat(I?"lg:col-span-3":"lg:col-span-4"),children:(0,r.jsxs)(i.Zp,{children:[(0,r.jsxs)(i.aR,{className:"flex flex-row items-center justify-between",children:[(0,r.jsxs)(i.ZB,{children:[ef,(0,r.jsx)("span",{className:"ml-2 text-sm font-normal text-gray-500",children:ev>0?"(".concat(ev," \xfcr\xfcn)"):""})]}),(0,r.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>T(e=>!e),className:"mt-2",children:I?"Ayarları Gizle":"Ayarları G\xf6ster"})]}),(0,r.jsx)(i.Wu,{children:eo||"loading"===t?(0,r.jsxs)("div",{className:"flex min-h-[260px] items-center justify-center text-gray-500",children:[(0,r.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"}),"\xdcr\xfcnler y\xfckleniyor..."]}):eR?(0,r.jsx)("div",{className:"flex min-h-[260px] items-center justify-center text-sm text-gray-500",children:"Sıralama yapmak i\xe7in 
1soldan bir kategori veya koleksiyon se\xe7in."}):0===ev?(0,r.jsx)("div",{className:"flex min-h-[260px] items-center justify-center text-sm text-gray-500",children:"Bu filtreye uygun \xfcr\xfcn bulunamadı."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:(0,r.jsxs)(b.Mp,{sensors:ew,collisionDetection:b.fp,onDragStart:e=>{et(Number(e.active.id))},onDragEnd:e=>{let{active:t,over:a}=e;if(et(null),!a||t.id===a.id)return;let r=ey.map(e=>e.id),s=r.indexOf(Number(t.id)),n=r.indexOf(Number(a.id));-1!==s&&-1!==n&&(K("manual"),ek((0,j.be)(r,s,n)),g.toast.success("\xdcr\xfcn sırası g\xfcncellendi"))},children:[(0,r.jsx)(j.gB,{items:eN.map(e=>e.id),strategy:j._G,children:eN.map((e,t)=>(0,r.jsx)(E,{product:e,absoluteIndex:ej+t,cardVariant:S(X[e.id]),onMoveClick:e=>{en(e),ei(""),er(!0)},onCardVariantChange:ez},e.id))}),(0,r.jsx)(b.Hd,{children:eA?(0,r.jsxs)("div",{className:"w-full rounded-lg border-2 border-blue-500 bg-white p-4 shadow-xl opacity-95",children:[(0,r.jsx)("div",{className:"relative mb-3 flex h-32 w-full items-center justify-center overflow-hidden rounded bg-gray-100",children:eA.image?(0,r.jsx)(n.default,{src:(0,v.a)(eA.image),alt:eA.name,fill:!0,sizes:"240px",className:"object-cover",unoptimized:!0}):(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"G\xf6rsel yok"})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("h3",{className:"line-clamp-2 text-sm font-medium",children:eA.name}),(0,r.jsxs)("p",{className:"text-lg font-bold text-primary",children:[eA.price.toLocaleString("tr-TR")," ",eA.currency]})]})]}):null})]})}),(0,r.jsx)("div",{className:"mt-6 flex justify-center",children:(0,r.jsxs)("div",{className:"flex w-full flex-col items-center gap-3 border-t border-gray-100 pt-4",children:[(0,r.jsx)("div",{className:"text-sm text-gray-600",children:0===ev?"0 \xfcr\xfcn":"".concat(ej+1,"-").concat(Math.min(ej+eN.length,ev)," / ").concat(ev," \xfcr\xfcn ").concat(P?"":"(sadece aktif)")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"Sayfa boyutu"}),(0,r.jsxs)(d.l6,{value:String(O),onValueChange:e=>{$(Number(e)),W(1)},children:[(0,r.jsx)(d.bq,{className:"h-9 w-[92px]",children:(0,r.jsx)(d.yv,{})}),(0,r.jsx)(d.gC,{children:["12","24","36","48"].map(e=>(0,r.jsx)(d.eb,{value:e,children:e},e))})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)(o.$,{type:"button",variant:"outline",size:"sm",onClick:()=>W(e=>Math.max(1,e-1)),disabled:U<=1,children:[(0,r.jsx)(x.A,{className:"mr-1 h-4 w-4"}),"\xd6nceki"]}),(0,r.jsxs)("span",{className:"min-w-[92px] text-center text-sm font-medium text-gray-700",children:["Sayfa ",U," / ",eb]}),(0,r.jsxs)(o.$,{type:"button",variant:"outline",size:"sm",onClick:()=>W(e=>Math.min(eb,e+1)),disabled:U>=eb,children:["Sonraki",(0,r.jsx)(h.A,{className:"ml-1 h-4 w-4"})]})]})]})]})})]})})]})}),I&&(0,r.jsxs)("div",{className:"space-y-6 lg:col-span-1",children:[(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)(i.aR,{children:(0,r.jsx)(i.ZB,{children:"Sıralama Ayarları"})}),(0,r.jsxs)(i.Wu,{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Sıralama T\xfcr\xfc"}),(0,r.jsxs)(d.l6,{value:a,onValueChange:p,children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Sıralama t\xfcr\xfc se\xe7iniz"})}),(0,r.jsxs)(d.gC,{children:[(0,r.jsx)(d.eb,{value:"category",children:"Kategori"}),(0,r.jsx)(d.eb,{value:"collection",children:"Koleksiyon"})]})]})]}),"category"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Kategori"}),(0,r.jsxs)(d.l6,{value:y,onValueChange:N,children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Kategori se\xe7iniz"})}),(0,r.jsx)(d.gC,{children:Z.map(e=>(0,r.jsx)(d.eb,{value:String(e.id),children:e.name},e.id))})]})]}),"collection"===a&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Koleksiyon"}),(0,r.jsxs)(d.l6,{value:k,onValueChange:M,children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Koleksiyon se\xe7iniz"})}),(0,r.jsx)(d.gC,{children:J.map(e=>(0,r.jsx)(d.eb,{value:String(e.id),children:e.name},e.id))})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Sıralama \xd6l\xe7\xfct\xfc"}),(0,r.jsxs)(d.l6,{value:L,onValueChange:e=>{K(e),("sales-count"===e||"view-count"===e||"conversion-rate"===e)&&g.toast.info("Bu sıralama \xf6l\xe7\xfct\xfc i\xe7in backend verisi hen\xfcz yok")},children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Sıralama \xf6l\xe7\xfct\xfc se\xe7iniz"})}),(0,r.jsx)(d.gC,{children:w.map(e=>(0,r.jsx)(d.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Pasif \xdcr\xfcnler"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"showInactive",checked:P,onChange:e=>B(e.target.checked),className:"rounded border-gray-300"}),(0,r.jsx)("label",{htmlFor:"showInactive",className:"text-sm",children:"Pasif \xfcr\xfcnleri g\xf6ster"})]})]}),"manual"!==L&&(0,r.jsx)(o.$,{onClick:()=>
1{if(ey.length)switch(L){case"sales-count":case"view-count":case"conversion-rate":g.toast.info("Bu sıralama \xf6l\xe7\xfct\xfc i\xe7in backend verisi hen\xfcz yok");return;default:return}},className:"w-full",disabled:eo||0===ev,children:"Sırala"}),(0,r.jsx)(o.$,{onClick:eC,className:"w-full",disabled:eo||ed||0===ev,children:ed?"Kaydediliyor...":"Kaydet"})]})]}),(0,r.jsxs)(i.Zp,{children:[(0,r.jsx)(i.aR,{children:(0,r.jsx)(i.ZB,{className:"text-sm",children:"Kullanım Kılavuzu"})}),(0,r.jsxs)(i.Wu,{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"mb-2 text-sm font-medium",children:"Ger\xe7ek Veri"}),(0,r.jsxs)("div",{className:"space-y-2 text-xs text-gray-600",children:[(0,r.jsx)("div",{children:"• Kategori ve koleksiyon se\xe7enekleri ger\xe7ek backoffice verisinden geliyor"}),(0,r.jsx)("div",{children:"• Kartlarda ger\xe7ek \xfcr\xfcn adı, fiyatı, g\xf6rseli ve barkodu g\xf6steriliyor"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"mb-2 text-sm font-medium",children:"Sıralama"}),(0,r.jsxs)("div",{className:"space-y-2 text-xs text-gray-600",children:[(0,r.jsx)("div",{children:"• Kartları s\xfcr\xfckleyip bıraktığınız anda \xf6l\xe7\xfct otomatik olarak \xd6zel Sıralama olur"}),(0,r.jsx)("div",{children:"• Fiyat, indirim ve yeni \xfcr\xfcn gibi \xf6l\xe7\xfctler se\xe7ildiğinde liste o kurala g\xf6re g\xf6sterilir"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"mb-2 text-sm font-medium",children:"Kaydetme"}),(0,r.jsxs)("div",{className:"space-y-2 text-xs text-gray-600",children:[(0,r.jsx)("div",{children:"• Her kategori veya koleksiyon kendi sırasını ayrı ayrı veritabanında saklar"}),(0,r.jsx)("div",{children:"• Kaydedilen sıra storefront kategori ve \xfcr\xfcn detay ekranlarında kullanılabilir"})]})]})]})]})]})]}),(0,r.jsx)(u.lG,{open:ea,onOpenChange:er,children:(0,r.jsxs)(u.Cf,{className:"sm:max-w-[440px]",children:[(0,r.jsx)(u.c7,{children:(0,r.jsx)(u.L3,{children:"\xdcr\xfcn Pozisyonu Değiştir"})}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("p",{children:"\xdcr\xfcn\xfc hangi pozisyona taşımak istiyorsunuz?"}),(0,r.jsx)(c.p,{placeholder:"1-".concat(ey.length," arası bir sayı girin"),value:el,onChange:e=>ei(e.target.value),onKeyDown:e=>{if("Enter"===e.key){e.preventDefault();let t=parseInt(el,10);if(!es||!el)return void g.toast.error("L\xfctfen ge\xe7erli bir pozisyon girin");if(Number.isNaN(t)||t<1||t>ey.length)return void g.toast.error("Pozisyon 1 ile ".concat(ey.length," arasında olmalıdır"));eS(es,t),er(!1),en(null),ei("")}},type:"number",min:1,max:ey.length})]}),(0,r.jsxs)(u.Es,{children:[(0,r.jsx)(o.$,{type:"button",variant:"outline",onClick:()=>{er(!1),en(null),ei("")},children:"İptal"}),(0,r.jsx)(o.$,{type:"button",onClick:()=>{if(!es||!el)return void g.toast.error("L\xfctfen ge\xe7erli bir pozisyon girin");let e=parseInt(el,10);if(Number.isNaN(e)||e<1||e>ey.length)return void g.toast.error("Pozisyon 1 ile ".concat(ey.length," arasında olmalıdır"));eS(es,e),er(!1),en(null),ei("")},children:"Taşı"})]})]})})]})}},97003:(e,t,a)=>{a.d(t,{$:()=>c,r:()=>o});var r=a(95155),s=a(12115),n=a(32467),l=a(83101),i=a(25016);let o=(0,l.F)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-normal ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 select-none",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-9 rounded-md px-4",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=s.forwardRef((e,t)=>
1{let{className:a,variant:s,size:l,asChild:c=!1,...d}=e,u=c?n.DX:"button";return(0,r.jsx)(u,{className:(0,i.cn)(o({variant:s,size:l,className:a})),ref:t,onClick:e=>{var t;e.currentTarget.blur(),null==(t=d.onClick)||t.call(d,e)},...d})});c.displayName="Button"}}]);

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.