PageSourceSearch

https://app.iyzads.com/_next/static/chunks/pages/catalog/video-93b11bc888a3f90a.js

js iyzads.com collected 2026-10-01 12:14:22 UTC 67,640 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8041],{89955:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/catalog/video",function(){return l(30524)}])},88751:function(e,t,l){"use strict";l.d(t,{n:function(){return o}});var s=l(85893),r=l(67294),a=l(25675),n=l.n(a),i=l(62079);function o(e){let{src:t,fallback:l,className:a,_loading:o,...c}=e,[d,u]=(0,r.useState)(!0),[x,m]=(0,r.useState)(!1);return(0,s.jsx)(n(),{...c,src:(!t||x)&&(null!=l?l:"/images/common/not-found-image.svg")||t,onError:()=>m(!0),onLoad:()=>u(!1),className:(0,i.cn)(a,(d||o)&&"animate-pulse bg-muted")})}},3175:function(e,t,l){"use strict";l.d(t,{Fw:function(){return i},wy:function(){return n},zF:function(){return a}});var s=l(85893),r=l(87479);function a(e){let{...t}=e;return(0,s.jsx)(r.fC,{"data-slot":"collapsible",...t})}function n(e){let{...t}=e;return(0,s.jsx)(r.wy,{"data-slot":"collapsible-trigger",...t})}function i(e){let{...t}=e;return(0,s.jsx)(r.Fw,{"data-slot":"collapsible-content",...t})}},14665:function(e,t,l){"use strict";l.d(t,{P:function(){return n},x:function(){return a}});var s=l(85893),r=l(62079);function a(e){let{containerClassName:t,className:l,children:a,...n}=e;return(0,s.jsx)("div",{className:(0,r.cn)("w-full p-1.5 backdrop-blur-sm",t),children:(0,s.jsx)("div",{className:(0,r.cn)("px-layout w-full max-w-screen-4xl rounded-lg bg-background py-4 shadow-sm ring-1 ring-border",l),...n,children:a})})}function n(e){let{title:t,description:l,className:a,titleClassName:n,descriptionClassName:i,...o}=e;return(0,s.jsxs)("div",{...o,className:(0,r.cn)("flex flex-col items-start justify-center gap-px",a),children:[(0,s.jsx)("p",{className:(0,r.cn)("line-clamp-1 font-semibold",n),children:t}),(0,s.jsx)("p",{className:(0,r.cn)("line-clamp-2 text-sm text-muted-foreground",i),children:l})]})}},17076:function(e,t,l){"use strict";l.d(t,{cm:function(){return p}});var s=l(85893),r=l(67294),a=l(62079),n=l(45587),i=l(24285);let o=(0,r.createContext)({attributes:{},listeners:void 0,isDragging:!1});function c(e){let{id:t,children:l,className:c,withHandle:u=!0,handlePosition:x="left",fullRowDrag:m=!1}=e,{attributes:p,listeners:f,setNodeRef:h,transform:g,transition:b,isDragging:v}=(0,n.nB)({id:t}),j={transform:i.ux.Translate.toString(g),transition:b,opacity:v?.4:1},N=(0,r.useMemo)(()=>({attributes:p,listeners:f,isDragging:v}),[p,f,v]),y=m?{onMouseDown:null==f?void 0:f.onMouseDown,onTouchStart:null==f?void 0:f.onTouchStart}:{};return(0,s.jsx)(o.Provider,{value:N,children:(0,s.jsxs)("div",{ref:h,style:j,className:(0,a.cn)("flex items-center",c),...y,children:[u&&"left"===x&&(0,s.jsx)(d,{}),(0,s.jsx)("div",{className:"min-w-0 flex-1",children:l}),u&&"right"===x&&(0,s.jsx)(d,{})]})})}function d(e){let{className:t,children:l}=e,{attributes:n,listeners:i}=(0,r.useContext)(o);return(0,s.jsx)("button",{type:"button",className:(0,a.cn)("flex shrink-0 cursor-grab items-center justify-center rounded p-1 text-muted-foreground/50 hover:text-muted-foreground active:cursor-grabbing",t),...n,...i,children:null!=l?l:(0,s.jsx)(u,{})})}function u(){return(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:20,height:20,children:(0,s.jsx)("path",{d:"M8.5 17c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm7-10c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm-7 3c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm7 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-7-14c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z",fill:"currentColor"})})}var x=l(60887),m=l(73935);function p(e){let{items:t,onChange:l,renderItem:i,renderOverlay:o,className:d,itemClassName:u,handlePosition:p="left",withHandle:f=!0,fullRowDrag:h=!1,gap:g=8}=e,[b,v]=(0,r.useState)(null),j=(0,r.useMemo)(()=>t.find(e=>e.id===b),[b,t]),N=(0,r.useMemo)(()=>t.map(e=>e.id),[t]),y=(0,x.Dy)((0,x.VT)(x.MA,{activationConstraint:{distance:8}}),(0,x.VT)(x.LO,{activationConstraint:{delay:200,tolerance:6}}),(0,x.VT)(x.Lg,{coordinateGetter:n.is}));return(0,s.jsxs)(x.LB,{sensors:y,collisionDetection:x.pE,onDragStart:function(e){v(e.active.id)},onDragEnd:function(e){let{active:s,over:r}=e;if(v(null),!r||s.id===r.id)return;let a=t.findIndex(e=>e.id===s.id),i=t.findIndex(e=>e.id===r.id);l((0,n.Rp)(t,a,i))},onDragCancel:function(){v(null)},children:[(0,s.jsx)(n.Fo,{items:N,strategy:n.qw,children:(0,s.jsx)("div",{className:(0,a.cn)("flex flex-col",d),style:{gap:g},children:t.map((e,t)=>(0,s.jsx)(c,{id:e.id,className:u,withHandle:f,handlePosition:p,fullRowDrag:h,children:i(e,t)},e.id))})}),(0,m.createPortal)((0,s.jsx)(x.y9,{children:j?(0,s.jsx)("div",{className:"rounded-lg shadow-lg ring-2 ring-primary",children:o?o(j):i(j,t.indexOf(j))}):null}),document.body)]})}},10921:function(e,t,l){"use strict";l.d(t,{n:function(){return i}});var s=l(85893);let r={x:21.25,y:19.25,width:389.5,height:843.5,radius:55.75},a={x:15,y:13,width:402,radius:60}
1,n={dark:{frame:"#404040",body:"#262626",island:"#262626",screen:"#404040"},light:{frame:"#E5E5E5",body:"#FFFFFF",island:"#F5F5F5",screen:"#E5E5E5"}};function i(e){let{src:t,videoSrc:l,className:i,style:o,content:c,variant:d="dark",screenAspect:u,bgColor:x,...m}=e,p=n[d],f=null!=x?x:p.screen,h=u?{...a,height:a.width/u}:r,g=h.height+2*h.y,b={left:"".concat(h.x/433*100,"%"),top:"".concat(h.y/g*100,"%"),width:"".concat(h.width/433*100,"%"),height:"".concat(h.height/g*100,"%"),borderRadius:"".concat(h.radius/h.width*100,"% / ").concat(h.radius/h.height*100,"%")},v=!!l,j=v||!!t||!!c;return(0,s.jsxs)("div",{className:"relative inline-block w-full overflow-y-auto align-middle leading-none ".concat(i),style:{aspectRatio:"".concat(433,"/").concat(g),...o},...m,children:[v&&(0,s.jsx)("div",{className:"pointer-events-none absolute z-0 overflow-hidden",style:b,children:(0,s.jsx)("video",{className:"block size-full object-cover",src:l,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"metadata"})}),!v&&t&&(0,s.jsx)("div",{className:"pointer-events-none absolute z-0 overflow-hidden",style:b,children:(0,s.jsx)("img",{src:t,alt:"",className:"block size-full object-cover object-top"})}),c&&(0,s.jsx)("div",{className:"absolute z-[1] overflow-y-auto overflow-x-hidden scrollbar-hide",style:b,children:c}),(0,s.jsxs)("svg",{viewBox:"0 0 ".concat(433," ").concat(g),fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"pointer-events-none absolute inset-0 z-[2] size-full",style:{transform:"translateZ(0)"},children:[(0,s.jsxs)("g",{mask:j?"url(#screenPunch)":void 0,children:[(0,s.jsx)("rect",{x:"2",width:"428",height:g,rx:"73",fill:p.frame}),(0,s.jsx)("path",{d:"M0 171C0 170.448 0.447715 170 1 170H3V204H1C0.447715 204 0 203.552 0 203V171Z",fill:p.frame}),(0,s.jsx)("path",{d:"M1 234C1 233.448 1.44772 233 2 233H3.5V300H2C1.44772 300 1 299.552 1 299V234Z",fill:p.frame}),(0,s.jsx)("path",{d:"M1 319C1 318.448 1.44772 318 2 318H3.5V385H2C1.44772 385 1 384.552 1 384V319Z",fill:p.frame}),(0,s.jsx)("path",{d:"M430 279H432C432.552 279 433 279.448 433 280V384C433 384.552 432.552 385 432 385H430V279Z",fill:p.frame}),(0,s.jsx)("rect",{x:"6",y:"4",width:"420",height:g-8,rx:"70",fill:p.body})]}),(0,s.jsx)("path",{opacity:"0.5",d:"M174 5H258V5.5C258 6.60457 257.105 7.5 256 7.5H176C174.895 7.5 174 6.60457 174 5.5V5Z",fill:p.frame}),(0,s.jsx)("rect",{x:h.x,y:h.y,width:h.width,height:h.height,rx:h.radius,style:{fill:f,stroke:f,strokeWidth:"0.5px"},mask:j?"url(#screenPunch)":void 0}),(0,s.jsx)("path",{d:"M154 48.5C154 38.2827 162.283 30 172.5 30H259.5C269.717 30 278 38.2827 278 48.5C278 58.7173 269.717 67 259.5 67H172.5C162.283 67 154 58.7173 154 48.5Z",fill:p.island}),(0,s.jsx)("path",{d:"M249 48.5C249 42.701 253.701 38 259.5 38C265.299 38 270 42.701 270 48.5C270 54.299 265.299 59 259.5 59C253.701 59 249 54.299 249 48.5Z",fill:p.island}),(0,s.jsx)("path",{d:"M254 48.5C254 45.4624 256.462 43 259.5 43C262.538 43 265 45.4624 265 48.5C265 51.5376 262.538 54 259.5 54C256.462 54 254 51.5376 254 48.5Z",fill:p.frame}),(0,s.jsxs)("defs",{children:[(0,s.jsxs)("mask",{id:"screenPunch",maskUnits:"userSpaceOnUse",children:[(0,s.jsx)("rect",{x:"0",y:"0",width:433,height:g,fill:"white"}),(0,s.jsx)("rect",{x:h.x,y:h.y,width:h.width,height:h.height,rx:h.radius,ry:h.radius,fill:"black"})]}
1),(0,s.jsx)("clipPath",{id:"roundedCorners",children:(0,s.jsx)("rect",{x:h.x,y:h.y,width:h.width,height:h.height,rx:h.radius,ry:h.radius})})]})]})]})}},3741:function(e,t,l){"use strict";l.d(t,{Y:function(){return u}});var s=l(85893),r=l(67294),a=l(47280),n=l(96877),i=l(64521),o=l(73935),c=l(92693),d=l(62079);function u(e){let{viewId:t,onClose:l,children:u,placement:x="bottom",className:m}=e,p=null!==t,f=(0,a.J)(),h=f?0:"bottom"===x?40:20,[g,b]=(0,r.useState)(!0);return((0,r.useEffect)(()=>{p&&b(!1)},[p]),(0,r.useEffect)(()=>{if(p)return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0);function e(e){"Escape"===e.key&&(e.stopPropagation(),l())}},[p,l]),p||!g)?(0,o.createPortal)((0,s.jsxs)("div",{"aria-hidden":!p,"data-inert":!p,className:(0,d.cn)("fixed inset-0 z-[80]",p?"pointer-events-auto":"pointer-events-none"),children:[(0,s.jsx)(n.E.button,{type:"button","aria-label":"Close modal",initial:{opacity:0},animate:{opacity:p?1:0},transition:{duration:.2,ease:c.sq},onClick:l,className:(0,d.cn)("absolute inset-0 bg-background/30 [-webkit-backdrop-filter:blur(8px)] [backdrop-filter:blur(8px)]",p?"pointer-events-auto":"pointer-events-none")}),(0,s.jsx)("div",{className:(0,d.cn)("pointer-events-none absolute inset-0 flex justify-center px-4","bottom"===x?"items-end pb-8":"items-center"),children:(0,s.jsx)(i.M,{onExitComplete:()=>b(!0),children:p?(0,s.jsx)(n.E.div,{layout:!0,initial:{opacity:0,y:h,scale:f?1:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:h,scale:f?1:.98,transition:{duration:.18,ease:c.sq}},transition:c.Qk,className:(0,d.cn)("pointer-events-auto relative flex w-full max-w-sm flex-col overflow-hidden rounded-3xl border border-border bg-background shadow-2xl will-change-transform","max-h-[85dvh]",m),children:(0,s.jsx)(n.E.div,{layout:"position",className:"min-h-0 overflow-y-auto overscroll-contain p-5 scrollbar-hide",children:(0,s.jsx)(i.M,{mode:"popLayout",initial:!1,children:(0,s.jsx)(n.E.div,{initial:f?{opacity:0}:{opacity:0,y:8,filter:"blur(4px)"},animate:f?{opacity:1,transition:{duration:.18,ease:c.sq}}:{opacity:1,y:0,filter:"blur(0px)",transition:{duration:.24,ease:c.sq}},exit:f?{opacity:0,transition:{duration:.14,ease:c.sq}}:{opacity:0,y:-8,filter:"blur(4px)",transition:{duration:.16,ease:c.sq}},children:u},t)})})},"panel"):null})})]}),document.body):null}},35739:function(e,t,l){"use strict";l.d(t,{s:function(){return i}});var s=l(85893),r=l(67421),a=l(62079),n=l(70900);function i(e){let{t}=(0,r.$G)("common"),{title:l,description:i,className:o,extra:c,variant:d="data",...u}=e;return(0,s.jsxs)("div",{...u,className:(0,a.cn)("flex flex-1 flex-col items-center justify-center gap-6 rounded-lg bg-background p-4",o),children:[(0,s.jsx)(n.gz,{className:"h-full max-h-60 w-full max-w-60"}),(0,s.jsxs)("div",{className:"flex max-w-sm flex-col items-center justify-center text-center",children:[(0,s.jsx)("p",{className:"font-semibold text-foreground",children:null!=l?l:t("lottie.not_found_".concat(d,".title"))}),(0,s.jsx)("p",{className:"text-sm font-normal text-muted-foreground",children:null!=i?i:t("lottie.not_found_".concat(d,".description"))})]}),c]})}},87970:function(e,t,l){"use strict";l.d(t,{M:function(){return c}});var s=l(85893),r=l(67294),a=l(67421),n=l(62079),i=l(55235),o=l(47989);let c=r.forwardRef((e,t)=>{let{className:l,containerClassName:r,iconClassName:c,...d}=e,{t:u}=(0,a.$G)("common");return(0,s.jsxs)("div",{className:(0,n.cn)("relative flex items-center",r),"cmdk-input-wrapper":"",children:[(0,s.jsx)(i.SearchIcon,{className:(0,n.cn)("absolute left-4 h-4 w-4 shrink-0 opacity-50",c)}),(0,s.jsx)(o.I,{ref:t,placeholder:u("component.search"),className:(0,n.cn)("bg-transparent py-2 pl-10 pr-4",l),...d})]})});c.displayName="SearchInput"},92693:function(e,t,l){"use strict";l.d(t,{Qk:function(){return r},sq:function(){return s}});let s=[.16,1,.3,1],r={type:"spring",stiffness:420,damping:40,mass:.5}},30524:function(e,t,l){"use strict";l.r(t),l.d(t,{__N_SSG:function(){return tw},default:function(){return tk}});var s=l(85893),r=l(67294),a=l(82355),n=l(72333),i=l(67421),o=l(55235),c=l(14665),d=l(35739),u=l(82701),x=l(67896),m=l(86501),p=l(44627);let f=["product_name","price","product_description"],h={product_name:e=>e.title,price:e=>e.price,product_description:e=>e.description},g="#000000";function b(e){var t;return e.flatMap(e=>[e,...b(null!==(t=e.children)&&void 0!==t?t:[])])}let v=(e,t)=>
1{var l;return"image"===e.type&&(null===(l=e.properties)||void 0===l?void 0:l.iyztype)===t},j=e=>{var t;return"text"===e.type&&!(null===(t=e.properties)||void 0===t?void 0:t.iyztype)};function N(e){if("text"===e.type)return f.find(t=>{var l;return t===(null===(l=e.properties)||void 0===l?void 0:l.iyztype)})}function y(e){let t=e.additionalImageLinks,l=Array.isArray(t)?t:(null!=t?t:"").split(","),s=l.filter(t=>t.trim()!==e.imageLink);return[e.imageLink,...s].filter(e=>null==e?void 0:e.trim())}let w=e=>"/_next/image?url=".concat(encodeURIComponent(e),"&w=").concat(1080,"&q=90"),k=["templates","products","edit"],C={ratio:null,sector:null,maxProducts:null},_=(0,r.createContext)(null);function z(){let e=(0,r.useContext)(_);if(!e)throw Error("useCatalogVideoBuilder must be used inside CatalogVideoBuilderProvider");return e}function S(e){var t,l;let{children:o}=e,{t:c}=(0,i.$G)("catalog_video"),d=(0,n.T)(),u=(0,n.C)(e=>e.catalogVideo.catalogAccount),[x,g]=(0,r.useState)("templates"),[j,w]=(0,r.useState)(null),[k,z]=(0,r.useState)(null),[S,E]=(0,r.useState)(!1),[M,I]=(0,r.useState)(C),[P,Z]=(0,r.useState)([]),[T,G]=(0,r.useState)({}),[R,L]=(0,r.useState)({}),[V,$]=(0,r.useState)(null),[O,D]=(0,r.useState)(!1),F=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{var e;return null===(e=F.current)||void 0===e?void 0:e.abort()},[]);let q=null!==(t=null==j?void 0:j.productCount)&&void 0!==t?t:0,A=null!==(l=null==j?void 0:j.minImagesByProduct)&&void 0!==l?l:0,B=!!j&&P.length===q,H=(0,r.useCallback)(e=>"products"===e?!!k:"edit"!==e||B,[k,B]),U=(0,r.useCallback)(e=>{H(e)&&g(e)},[H]),W=(0,r.useCallback)(()=>{Z([]),G({}),L({}),$(null)},[]);(0,r.useEffect)(()=>{W(),g(e=>"edit"===e?"products":e)},[null==u?void 0:u.id,W]);let J=(0,r.useCallback)(e=>{var t;w(e),z(null),W(),null===(t=F.current)||void 0===t||t.abort();let l=new AbortController;F.current=l,E(!0),p.qy.getCatalogVideoTemplate(e.id,l.signal).then(e=>{let{data:t}=e;return z(t.videoJson)}).catch(e=>{var t;l.signal.aborted||(m.ZP.error(null!==(t=null==e?void 0:e.message)&&void 0!==t?t:c("builder.preview.load_error")),w(null))}).finally(()=>{l.signal.aborted||E(!1)})},[c,W]),Y=(0,r.useCallback)(e=>y(e).length>=A,[A]),K=(0,r.useCallback)(e=>{Z(t=>t.some(t=>t.id===e.id)?t.filter(t=>t.id!==e.id):t.length>=q?t:[...t,e])},[q]),Q=(0,r.useCallback)(e=>{Z(t=>{let l=new Set(t.map(e=>e.id)),s=q-t.length,r=e.filter(e=>!l.has(e.id)).slice(0,Math.max(0,s));return[...t,...r]})},[q]),X=(0,r.useCallback)(e=>{Z(t=>t.filter(t=>t.id!==e))},[]),ee=(0,r.useCallback)(()=>Z([]),[]),et=(0,r.useCallback)((e,t)=>{G(l=>({...l,[e]:t}))},[]),el=(0,r.useCallback)((e,t)=>{L(l=>({...l,[e]:t}))},[]),es=(0,r.useMemo)(()=>k?function(e,t){let l=new Map(Object.entries(t.texts)),s=new Map(Object.entries(t.colors)),r=new Map,a=new Map,n=b(e.layers),i=Math.max(1,t.imagesPerProduct),o=t.products.flatMap(e=>Array.from({length:i},(t,l)=>({link:y(e)[l],key:"".concat(e.id,".image[").concat(l,"]")})));n.filter(e=>
1v(e,"product")).forEach((e,t)=>{let l=o[t];(null==l?void 0:l.link)&&(r.set(e.id,l.link),a.set(e.id,l.key))});let c=t.logo;for(let d of(c&&n.filter(e=>v(e,"brand")).forEach(e=>r.set(e.id,c)),f))n.filter(e=>N(e)===d).forEach((e,s)=>{let r=t.products[s];r&&(l.set(e.id,h[d](r)),a.set(e.id,"".concat(r.id,".").concat(d)))});return{...e,layers:e.layers.map(e=>(function e(t,l){let s={...t,properties:{...t.properties}},r=l.texts.get(t.id);void 0!==r&&(s.properties.text=r);let a=l.colors.get(t.id);void 0!==a&&(s.properties.color=a);let n=l.images.get(t.id);void 0!==n&&(s.settings={...s.settings,source:n});let i=l.keys.get(t.id);return void 0!==i&&(s.settings={...s.settings,key:i}),t.children&&(s.children=t.children.map(t=>e(t,l))),s})(e,{texts:l,colors:s,images:r,keys:a}))}}(k,{texts:T,colors:R,products:P,imagesPerProduct:A,logo:V}):null,[k,T,R,P,A,V]),er=!!(null==u?void 0:u.id)&&!!j&&!!es&&B&&!O,ea=(0,r.useCallback)(()=>{(null==u?void 0:u.id)&&j&&es&&er&&(D(!0),m.ZP.promise(p.qy.createCatalogVideoRequest({catalogId:u.id,videoTemplateId:j.id,productIds:P.map(e=>e.id),videoJson:es}),{loading:c("create.statuses.loading"),success:()=>(d(a.wr.getRequests()),D(!1),w(null),z(null),W(),g("generated"),c("create.statuses.success")),error:e=>{var t;return D(!1),c(null!==(t=null==e?void 0:e.message)&&void 0!==t?t:"create.statuses.error")}}))},[null==u?void 0:u.id,j,es,er,P,W,d,c]);return(0,s.jsx)(_.Provider,{value:{step:x,goToStep:U,canOpenStep:H,template:j,selectTemplate:J,templateJson:k,templateLoading:S,templateFilters:M,setTemplateFilters:I,products:P,isSelectionComplete:B,isProductEligible:Y,toggleProduct:K,addProducts:Q,removeProduct:X,reorderProducts:Z,clearProducts:ee,texts:T,setText:et,colors:R,setColor:el,logo:V,setLogo:$,videoJson:es,submitting:O,canSubmit:er,submit:ea},children:o})}function E(){let{t:e}=(0,i.$G)("catalog_video"),{step:t,template:l,goToStep:r,canOpenStep:a,canSubmit:n,submitting:o,submit:c}=z();if(!l||!k.includes(t))return null;let d=k[k.indexOf(t)+1];return d?(0,s.jsxs)(x.z,{onClick:()=>r(d),disabled:!a(d),className:"w-full shrink-0 gap-2",children:[e("builder.action.next"),(0,s.jsx)(u.Z,{className:"size-4"})]}):(0,s.jsx)(x.z,{onClick:c,disabled:!n,className:"w-full shrink-0",children:e(o?"create.statuses.loading":"builder.action.create")})}var M=l(62079),I=l(41976);let P=["templates","products","edit","generated"];function Z(){let{t:e}=(0,i.$G)("catalog_video"),{step:t,goToStep:l,canOpenStep:r}=z();return(0,s.jsx)(I.mQ,{value:t,onValueChange:e=>l(e),children:(0,s.jsx)(I.dr,{size:"sm",className:"grid w-full grid-cols-4 rounded-xl p-1",children:P.map(l=>(0,s.jsx)(I.SP,{value:l,disabled:l!==t&&!r(l),className:(0,M.cn)("rounded-lg","data-[state=active]:shadow-sm","disabled:cursor-not-allowed disabled:opacity-40"),children:e("builder.tabs.".concat(l))},l))})})}var T=l(75283),G=l(90332),R=l(28142),L=l(88751),V=l(74476);function $(e){let{current:t,uploaded:l,onChange:a}=e,{t:n}=(0,i.$G)("catalog_video"),o=(0,r.useRef)(null),[c,d]=(0,r.useState)(!1),u=async e=>{if(e.size>5242880){m.ZP.error(n("builder.edit.logo_too_large"));return}let t=new FormData;t.append("file",e),t.append("type",V.zS.LOGO),d(!0);try{let{data:l}=await p.L2.uploadImage(t);a(l.url)}catch(s){m.ZP.error(n("builder.edit.logo_upload_error"))}finally{d(!1)}};return(0,s.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold",children:[(0,s.jsx)(T.Z,{className:"size-4 text-primary"}),n("builder.edit.logo_title")]}
1),(0,s.jsxs)("div",{className:"flex items-center gap-4 rounded-xl bg-muted p-4",children:[(0,s.jsx)("div",{className:"flex size-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border bg-background",children:c?(0,s.jsx)(G.Z,{className:"size-5 animate-spin text-muted-foreground"}):(0,s.jsx)(L.n,{src:t,alt:"",width:80,height:80,unoptimized:!0,className:"size-full object-contain p-2"})}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("builder.edit.logo_desc")}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)(x.z,{size:"sm",variant:"outline",className:"gap-1.5",disabled:c,onClick:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.click()},children:[(0,s.jsx)(R.Z,{className:"size-4"}),n(l?"builder.edit.logo_change":"builder.edit.logo_upload")]}),l&&(0,s.jsx)(x.z,{size:"sm",variant:"ghost",disabled:c,onClick:()=>a(null),children:n("builder.edit.logo_reset")})]})]}),(0,s.jsx)("input",{ref:o,type:"file",accept:"image/*",className:"hidden",onChange:e=>{var t;let l=null===(t=e.target.files)||void 0===t?void 0:t[0];l&&u(l),e.target.value=""}})]})]})}var O=l(71646),D=l(13742),F=l(55651),q=l(47989),A=l(93409);let B=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,H=r.forwardRef((e,t)=>{let{value:l,onChange:a,presets:n=[],className:i,...o}=e,[c,d]=r.useState(l);r.useEffect(()=>d(l),[l]);let u=e=>{let t=e.startsWith("#")?e:"#".concat(e);d(t),B.test(t)&&a(t)};return(0,s.jsxs)(A.J2,{children:[(0,s.jsx)(A.xo,{asChild:!0,children:(0,s.jsx)("button",{ref:t,type:"button",className:(0,M.cn)("size-10 shrink-0 rounded-lg border border-input bg-background p-1.5 ring-offset-background transition-shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",i),...o,children:(0,s.jsx)("span",{className:"block size-full rounded-md border border-black/10",style:{backgroundColor:l}})})}),(0,s.jsxs)(A.yk,{align:"end",className:"color-picker flex w-60 flex-col gap-3 p-3",children:[(0,s.jsx)(F.gW,{color:l,onChange:a}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"size-9 shrink-0 rounded-lg border border-black/10",style:{backgroundColor:l}}),(0,s.jsx)(q.I,{value:c,onChange:e=>u(e.target.value),spellCheck:!1,className:"h-9 font-mono text-xs uppercase"})]}),n.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>a(e),className:"flex size-7 items-center justify-center rounded-full border border-black/10 transition-transform hover:scale-110",style:{backgroundColor:e},children:e.toLowerCase()===l.toLowerCase()&&(0,s.jsx)(D.Z,{className:"size-3.5 text-white mix-blend-difference"})},e))})]})]})});H.displayName="ColorPicker";let U={product_name:"builder.edit.product_name_color",price:"builder.edit.price_color",product_description:"builder.edit.product_description_color"};function W(e){let{fields:t,colors:l,presets:r,onColorChange:a}=e,{t:n}=(0,i.$G)("catalog_video");return 0===t.length?null:(0,s.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold",children:[(0,s.jsx)(O.Z,{className:"size-4 text-primary"}),n("builder.edit.product_texts_title")]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:n("builder.edit.product_texts_desc")})]}),(0,s.jsx)("div",{className:"divide-y divide-border/60 rounded-xl bg-muted px-4",children:t.map(e=>{var t;let i=null!==(t=l[e.ids[0]])&&void 0!==t?t:e.color;return(0,s.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,s.jsx)(H,{value:i,presets:r,onChange:t=>e.ids.forEach(e=>a(e,t)),"aria-label":n("builder.edit.color").toString(),className:"size-8 p-1"}),(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:n(U[e.type])}),(0,s.jsx)("span",{className:"font-mono text-xs uppercase text-muted-foreground",children:i})]},e.type)})})]})}var J=l(84031),Y=l(84979),K=l(8971),Q=l(41352),X=l(17076);function ee(e){var t;let{product:l,selected:r}=e;return(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative shrink-0",children:[(0,s.jsx)("div",{className:"size-14 overflow-hidden rounded-lg border bg-muted",children:(0,s.jsx)(L.n,{src:l.imageLink||(null===(t=l.additionalImageLinks)||void 0===t?void 0:t[0]),alt:l.title,width:56,height:56,unoptimized:!0,className:"size-full object-cover"})}),r&&(0,s.jsx)("span",{className:"absolute -right-1.5 -top-1.5 flex size-4 items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-background",children:(0,s.jsx)(D.Z,{className:"size-2.5",strokeWidth:3.5})})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,s.jsx)("p",{className:"line-clamp-1 text-sm font-semibold",children:l.title}),(0,s.jsx)("p",{className:"line-clamp-1 text-sm font-medium text-primary",children:l.price})]})]})}function et(e){let{products:t,onReorder:l,onRemove:r}=e,{t:a}=(0,i.$G)("catalog_video"),n=(e,s)=>{if(s<0||s>=t.length)return;let r=[...t],[a]=r.splice(e,1);r.splice(s,0,a),l(r)};return(0,s.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold",children:[(0,s.jsx)(J.Z,{className:"size-4 text-primary"}),a("builder.edit.order_title")]}),0===t.length?(0,s.jsx)("p",{className:"rounded-xl border border-dashed p-4 text-sm text-muted-foreground",children:a("builder.edit.no_products")}):(0,s.jsx)(X.cm,{items:t,onChange:l,withHandle:!1,fullRowDrag:!0,gap:8,itemClassName:"cursor-grab active:cursor-grabbing",renderItem:(e,l)=>(0,s.jsxs)("div",{className:"flex items-center gap-3 rounded-xl border bg-background p-3",children:[(0,s.jsxs)("div",{className:"flex shrink-0 flex-col items-center text-muted-foreground",children:[(0,s.jsx)(el,{disabled:0===l,onClick:()=>n(l,l-1),children:(0,s.jsx)(Y.Z,{className:"size-4"})}),(0,s.jsx)("span",{className:"text-xs tabular-nums",children:l+1}),(0,s.jsx)(el,{disabled:l===t.length-1,onClick:()=>n(l,l+1),children:(0,s.jsx)(K.Z,{className:"size-4"})})]}),(0,s.jsx)(ee,{product:e}),(0,s.jsx)("button",{type:"button","aria-label":a("builder.edit.remove").toString(),onClick:()=>r(e.id),className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive",children:(0,s.jsx)(Q.Z,{className:"size-4"})})]})})]})}function el(e){let{disabled:t,onClick:l,children:r}=e;return(0,s.jsx)("button",{type:"button",disabled:t,onClick:l,className:(0,M.cn)("rounded p-0.5 transition-colors hover:text-foreground",t&&"pointer-events-none opacity-30"),children:r})}var es=l(25169),er=l(24073),ea=l(49e3);function en(e){var t,l;let{fields:r,values:a,colors:n,presets:o,onChange:c,onColorChange:d}=e,{t:u}=(0,i.$G)("catalog_video");return(0,s.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-2 text-base font-semibold",children:[(0,s.jsx)(es.Z,{className:"size-4 text-primary"}),u("builder.edit.texts_title")]}),0===r.length?(0,s.jsx)("p",{className:"rounded-xl border border-dashed p-4 text-sm text-muted-foreground",children:u("builder.edit.no_texts")}):(0,s.jsx)("div",{className:"flex flex-col gap-3 rounded-xl bg-muted p-4",children:r.map((e,r)=>(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[(0,s.jsx)(er._,{className:"text-xs font-semibold text-muted-foreground",children:u("builder.edit.text_label",{index:r+1})}),(0,s.jsx)(ea.g,{value:null!==(t=a[e.id])&&void 0!==t?t:e.text,onChange:t=>c(e.id,t.target.value),rows:e.text.split("\n").length,className:"max-h-20 min-h-10 rounded-lg bg-background"})]}),(0,s.jsx)(H,{value:null!==(l=n[e.id])&&void 0!==l?l:e.color,presets:o,onChange:t=>d(e.id,t),"aria-label":u("builder.edit.color").toString()})]},e.id))})]})}var ei=l(71981),eo=l(87970);let ec="__all__",ed=["all_products","best_sellers","new_products"],eu={productSet:"all_products",name:"",type:ec,idMin:"",idMax:"",priceMin:"",priceMax:""},ex=e=>Object.keys(e).some(t=>e[t]!==eu[t]),em=e=>e.googleProductCategory||e.productType;var ep=l(86),ef=l(18814);function eh(e){var t,l;let{scrollElement:a,products:n,loading:o,selectedIds:c,selectionFull:d,onToggle:u}=e,{t:x}=(0,i.$G)("common"),m=(0,r.useRef)(null),p=(0,ep.MG)({count:n.length,getScrollElement:()=>a,estimateSize:()=>80,overscan:6,scrollMargin:null!==(l=null===(t=m.current)||void 0===t?void 0:t.offsetTop)&&void 0!==l?l:0});return o?(0,s.jsx)(eg,{children:x("button.loading")}):0===n.length?(0,s.jsx)(eg,{children:x("component.no_result")}):(0,s.jsx)("div",{ref:m,className:"relative w-full",style:{height:p.getTotalSize()},children:p.getVirtualItems().map(e=>{let t=n[e.index],l=c.has(t.id),r=!l&&d;return(0,s.jsx)("div",{className:"absolute inset-x-0 top-0 py-1",style:{height:e.size,transform:"translateY(".concat(e.start-p.options.scrollMargin,"px)")},children:(0,s.jsxs)("div",{className:(0,M.cn)("flex h-full items-center gap-3 rounded-xl border pr-3 transition-colors",l?"border-primary/50 bg-primary/5":"border-transparent hover:bg-muted"),children:[(0,s.jsx)("button",{type:"button",disabled:r,onClick:()=>u(t),className:(0,M.cn)("flex h-full min-w-0 flex-1 items-center pl-3 text-left",r&&"curs
1or-not-allowed opacity-40"),children:(0,s.jsx)(ee,{product:t,selected:l})}),t.link&&(0,s.jsx)("a",{href:t.link,target:"_blank",rel:"noopener noreferrer",className:"flex size-8 shrink-0 items-center justify-center rounded-full border bg-background text-muted-foreground transition-colors hover:border-primary/50 hover:text-primary",children:(0,s.jsx)(ef.Z,{className:"size-4"})})]})},t.id)})})}function eg(e){let{children:t}=e;return(0,s.jsx)("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:t})}var eb=l(75010),ev=l(79274),ej=l(26967);function eN(e){let{open:t,onOpenChange:l,products:a,customProductSets:n,filters:o,onFiltersChange:c,matchingCount:d,loading:u,remaining:m,selectedCount:p,onSelectMatching:f,onClearSelection:h}=e,{t:g}=(0,i.$G)("catalog"),b=(0,r.useMemo)(()=>{let e=Array.from(new Set(a.map(em).filter(Boolean))).sort((e,t)=>e.localeCompare(t));return[{value:ec,label:g("filter_type_all").toString()},...e.map(e=>({value:e,label:e}))]},[a,g]),v=(0,r.useMemo)(()=>[...ed.map(e=>({value:e,label:g(e).toString()})),...n.map(e=>({value:e.id,label:e.name,group:"custom",groupLabel:g("custom_sets_title").toString()}))],[n,g]),j=e=>c({...o,...e});return(0,s.jsx)(ej.Vq,{open:t,onOpenChange:l,children:(0,s.jsxs)(ej.cZ,{className:"flex max-h-[90dvh] flex-col gap-4 overflow-y-auto sm:max-w-md sm:rounded-2xl",children:[(0,s.jsxs)(ej.fK,{children:[(0,s.jsx)(ej.$N,{children:g("quick_select_title")}),(0,s.jsx)(ej.Be,{children:g("quick_select_desc")})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(er._,{className:"text-xs",children:g("filter_product_set")}),(0,s.jsx)(ev.h,{value:o.productSet,options:v,triggerClassName:"h-9 w-full max-w-none",contentClassName:"popover-content-width",onChange:e=>e.target.value&&j({productSet:e.target.value})})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(er._,{className:"text-xs",children:g("filter_name")}),(0,s.jsx)(q.I,{value:o.name,onChange:e=>j({name:e.target.value}),placeholder:g("filter_name_placeholder").toString(),className:"h-9"})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(er._,{className:"text-xs",children:g("column.product_type")}),(0,s.jsx)(ev.h,{value:o.type,options:b,triggerClassName:"h-9 w-full max-w-none",contentClassName:"popover-content-width",onChange:e=>j({type:e.target.value})})]}),(0,s.jsx)(ey,{label:g("filter_id_range"),min:o.idMin,max:o.idMax,onChange:(e,t)=>
1j({idMin:e,idMax:t})}),(0,s.jsx)(ey,{label:g("filter_price_range"),numeric:!0,min:o.priceMin,max:o.priceMax,onChange:(e,t)=>j({priceMin:e,priceMax:t})}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 border-t pt-4",children:[(0,s.jsxs)(x.z,{size:"sm",className:"h-9 w-full gap-1.5",onClick:f,disabled:0===d||0===m,children:[(0,s.jsx)(eb.Z,{className:"size-4"}),g("select_matching",{count:Math.min(d,m)})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(x.z,{variant:"outline",size:"sm",className:"h-9 flex-1",onClick:h,disabled:0===p,children:g("clear_selection")}),(0,s.jsx)(x.z,{variant:"outline",size:"sm",className:"h-9 flex-1",disabled:u,onClick:()=>l(!1),children:g("show_matching",{count:d})})]})]})]})})}function ey(e){let{label:t,min:l,max:r,numeric:a,onChange:n}=e,{t:o}=(0,i.$G)("catalog"),c=a?{type:"number",inputMode:"decimal"}:{};return(0,s.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,s.jsx)(er._,{className:"text-xs",children:t}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(q.I,{...c,value:l,onChange:e=>n(e.target.value,r),placeholder:o("filter_min").toString(),className:"h-9"}),(0,s.jsx)("span",{className:"text-muted-foreground",children:"–"}),(0,s.jsx)(q.I,{...c,value:r,onChange:e=>n(l,e.target.value),placeholder:o("filter_max").toString(),className:"h-9"})]})]})}function ew(e){let{selectedCount:t,productCount:l,minImagesByProduct:r}=e,{t:a}=(0,i.$G)("catalog_video");return(0,s.jsxs)("div",{className:(0,M.cn)("flex items-center justify-between gap-4 rounded-xl border px-4 py-3 transition-colors",t===l?"border-primary/40 bg-primary/10":"border-primary/20 bg-primary/5"),children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-primary",children:a("builder.products.requirement_title")}),(0,s.jsx)("p",{className:"text-xs text-primary/80",children:a("builder.products.requirement_desc",{count:l})}),r>0&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:a("builder.products.min_images_hint",{count:r})})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-baseline gap-1 rounded-lg border bg-background px-3 py-1.5 tabular-nums shadow-sm",children:[(0,s.jsx)("span",{className:"text-lg font-semibold",children:t}),(0,s.jsxs)("span",{className:"text-sm text-muted-foreground",children:["/ ",l]})]})]})}let ek={loading:!0,isFetched:!1,data:[]};var eC=l(45077),e_=l(38986),ez=l(57882);let eS=[{label:"9:16",value:9/16},{label:"1:1",value:1},{label:"4:3",value:4/3},{label:"16:9",value:16/9}];function eE(e){let t=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let l=t.current;if(!l||!e)return;l.src="".concat(e,"#t=").concat(.5);let s=window.setTimeout(()=>{l.readyState>=2||l.play().then(()=>{l.pause(),l.currentTime=.5}).catch(()=>{})},1200);return()=>{window.clearTimeout(s),l.removeAttribute("src"),l.load()}},[e]),t}let eM="relative aspect-[9/16] w-full overflow-hidden rounded-xl bg-muted text-left",eI="rounded-full bg-white/90 px-2 py-1 text-[11px] font-semibold leading-3 text-foreground shadow-sm";function eP(e){let{template:t,selected:l,deferred:a,onSelect:n}=e,{t:o}=(0,i.$G)("catalog_video"),[c,d]=(0,r.useState)(!a);return(0,r.useEffect)(()=>{a||d(!0)},[a]),(0,s.jsxs)("button",{type:"button",onClick:n,className:(0,M.cn)(eM,"group ring-offset-2 ring-offset-background transition-shadow focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",l?"ring-2 ring-primary":"hover:shadow-md"),children:[(0,s.jsx)(eZ,{url:c?t.previewUrl:""}),(0,s.jsx)("span",{className:(0,M.cn)(eI,"absolute left-2 top-2"),children:o("sector.".concat(t.sector),{defaultValue:t.sectorLabel})}),l&&(0,s.jsx)("span",{className:"absolute right-2 top-2 flex size-6 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm",children:(0,s.jsx)(D.Z,{className:"size-3.5",strokeWidth:3})}),(0,s.jsxs)("div",{className:"absolute inset-x-2 bottom-2 flex items-center justify-between gap-1",children:[(0,s.jsx)("span",{className:eI,children:t.aspectRatio}),(0,s.jsxs)("span",{className:(0,M.cn)(eI,"flex shrink-0 items-center gap-1"),children:[(0,s.jsx)(eC.Z,{className:"size-3"}),o("card.duration",{seconds:t.estimatedDurationSec})]})]})]})}function eZ(e){let{url:t}=e,l=eE(t);
1return t?(0,s.jsx)("video",{ref:l,muted:!0,playsInline:!0,preload:"metadata",disablePictureInPicture:!0,className:"size-full object-cover"}):(0,s.jsx)("div",{className:"flex size-full animate-pulse items-center justify-center"})}function eT(){return(0,s.jsx)(e_.O,{className:(0,M.cn)(eM,"h-auto bg-border")})}var eG=l(46795),eR=l(3175);function eL(e){var t,l,a;let{sectorOptions:n,ratioOptions:o,maxProductOptions:c,filters:d,onChange:u,loading:x}=e,{t:m}=(0,i.$G)("catalog_video"),[p,f]=(0,r.useState)(!1),h=[null===(t=n.find(e=>e.value===d.sector))||void 0===t?void 0:t.label,null===(l=o.find(e=>e.value===d.ratio))||void 0===l?void 0:l.label,null===(a=c.find(e=>e.value===d.maxProducts))||void 0===a?void 0:a.label].filter(Boolean);return(0,s.jsxs)(eR.zF,{open:p,onOpenChange:f,className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex h-11 items-center rounded-xl border bg-background",children:[(0,s.jsxs)(eR.wy,{className:"flex h-full min-w-0 flex-1 items-center gap-2 px-4 text-sm font-medium",children:[(0,s.jsx)(eG.Z,{className:"size-4 shrink-0 text-primary"}),(0,s.jsx)("span",{className:"shrink-0",children:m("builder.filters.title")}),(0,s.jsx)("span",{className:"flex min-w-0 items-center gap-1.5 overflow-hidden",children:h.map(e=>(0,s.jsx)("span",{className:"truncate rounded-full bg-primary/10 px-2.5 py-0.5 text-xs text-primary",children:e},e))}),(0,s.jsx)(K.Z,{className:(0,M.cn)("ml-auto size-4 shrink-0 text-muted-foreground transition-transform",p&&"rotate-180")})]}),h.length>0&&(0,s.jsx)("button",{type:"button","aria-label":m("builder.filters.clear").toString(),onClick:()=>u({sector:null,ratio:null,maxProducts:null}),className:"flex h-full shrink-0 items-center border-l px-3 text-muted-foreground transition-colors hover:text-destructive",children:(0,s.jsx)(Q.Z,{className:"size-4"})})]}),(0,s.jsxs)(eR.Fw,{className:"flex flex-col gap-2 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-top-1",children:[(0,s.jsx)(eV,{allLabel:m("builder.filters.all_sectors"),options:n,value:d.sector,onChange:e=>u({...d,sector:e}),loading:x}),(0,s.jsx)(eV,{allLabel:m("builder.filters.all_sizes"),options:o,value:d.ratio,onChange:e=>u({...d,ratio:e}),loading:x}),(0,s.jsx)(eV,{allLabel:m("builder.filters.all_product_counts"),options:c,value:d.maxProducts,onChange:e=>u({...d,maxProducts:e}),loading:x})]})]})}function eV(e){let{allLabel:t,options:l,value:r,onChange:a,loading:n}=e,i=[{value:"",label:t},...l];return(0,s.jsx)("div",{className:"flex gap-2 overflow-x-auto py-0.5 scrollbar-hide",children:n?Array.from({length:4},(e,t)=>(0,s.jsx)(e_.O,{className:"h-8 w-20 shrink-0 rounded-full bg-border"},t)):i.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>a(e.value||null),className:(0,M.cn)("shrink-0 rounded-full border px-3.5 py-1.5 text-xs font-medium transition-colors",(e.value||null)===r?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-foreground hover:border-primary/50"),children:e.label},e.value))})}function e$(e){let{templates:t,selectedId:l,onSelect:a}=e,[n,i]=(0,r.useState)(null),o=(0,ep.MG)({count:Math.ceil(t.length/2),getScrollElement:()=>n,estimateSize:()=>400,overscan:1});return(0,r.useEffect)(()=>{null==n||n.scrollTo({top:0})},[t,n]),(0,s.jsx)("div",{ref:i,className:"min-h-0 flex-1 overflow-y-auto p-1",children:(0,s.jsx)("div",{className:"relative w-full",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(e=>{let r=2*e.index;return(0,s.jsx)("div",{"data-index":e.index,ref:o.measureElement,className:"absolute inset-x-0 top-0 grid grid-cols-2 gap-4 pb-4",style:{transform:"translateY(".concat(e.start,"px)")},children:t.slice(r,r+2).map(e=>(0,s.jsx)(eP,{template:e,selected:e.id===l,deferred:o.isScrolling,onSelect:()=>a(e)},e.id))},e.key)})})})}let eO=(e,t)=>Array.from(new Map(e.map(e=>[t(e),e])).values()),eD=[5,10,15,20];var eF=l(96486),eq=l.n(eF),eA=l(95999),eB=l(28463),eH=l(10361),eU=l(16142),eW=l(49482),eJ=l(64521),eY=l(96877);let eK={initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.5,opacity:0}};function eQ(e){let{videoSrc:t,className:l,videoClassName:a,onDownload:n,onDelete:i,aspectRatio:c}=e,[d,u]=(0,r.useState)(!1),[x,m]=(0,r.useState)(!1),p=(0,r.useRef)(null),f=eE(t),[h,g]=(null!=c?c:"16:9").split(":").map(Number),b=g>0?h/g:16/9;return(0,r.useEffect)(()=>
1{if(d&&p.current){let e=p.current;e.defaultMuted=!1,e.muted=!1,e.load(),m(!1)}},[d]),(0,s.jsxs)("div",{className:(0,M.cn)("relative",l),children:[(0,s.jsxs)("button",{type:"button","aria-label":"Play video",className:"group relative size-full cursor-pointer border-0 bg-transparent p-0",onClick:()=>u(!0),children:[(0,s.jsx)("video",{ref:f,muted:!0,playsInline:!0,preload:"metadata",disablePictureInPicture:!0,className:(0,M.cn)("h-full w-full object-contain transition-all duration-200 ease-out group-hover:brightness-[0.8]",a)}),(0,s.jsx)("div",{className:"absolute inset-0 flex scale-[0.9] transform-gpu items-center justify-center rounded-2xl transition-all duration-200 ease-out group-hover:scale-100",children:(0,s.jsx)("div",{className:"flex size-14 items-center justify-center rounded-full bg-primary/10 backdrop-blur-md",children:(0,s.jsx)(eW.Z,{className:"size-6 scale-100 fill-white text-white transition-transform duration-200 ease-out group-hover:scale-105",style:{filter:"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))"}})})})]}),(0,s.jsx)(eJ.M,{children:d&&(0,s.jsx)(eY.E.div,{initial:{opacity:0}
1,animate:{opacity:1},role:"button",tabIndex:0,onKeyDown:e=>{("Escape"===e.key||"Enter"===e.key||" "===e.key)&&u(!1)},onClick:e=>{e.target===e.currentTarget&&u(!1)},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-md",children:(0,s.jsxs)(eY.E.div,{...eK,transition:{type:"spring",damping:30,stiffness:300},style:{aspectRatio:b,width:"min(56rem, calc(100vw - 2rem), calc(80vh * ".concat(b,"))")},className:"relative",children:[(0,s.jsx)(eY.E.button,{whileHover:{scale:1.1},whileTap:{scale:.9},className:"absolute -top-14 right-24 rounded-full bg-neutral-100/50 p-2 text-xl text-white ring-1 backdrop-blur-md",type:"button",onClick:e=>{e.stopPropagation(),null==i||i()},children:(0,s.jsx)(o.TrashCanIcon,{className:"size-5"})}),(0,s.jsx)(eY.E.button,{whileHover:{scale:1.1},whileTap:{scale:.9},className:"absolute -top-14 right-12 rounded-full bg-neutral-100/50 p-2 text-xl text-white ring-1 backdrop-blur-md",type:"button",onClick:e=>{e.stopPropagation(),null==n||n()},children:(0,s.jsx)(o.DownloadBoxIcon,{className:"size-5"})}),(0,s.jsx)(eY.E.button,{whileHover:{scale:1.1},whileTap:{scale:.9},className:"absolute -top-14 right-0 rounded-full bg-neutral-100/50 p-2 text-xl text-white ring-1 backdrop-blur-md",type:"button",onClick:e=>{e.stopPropagation(),u(!1)},children:(0,s.jsx)(Q.Z,{className:"size-5"})}),(0,s.jsxs)("div",{className:"relative isolate z-[1] size-full overflow-hidden rounded-2xl border-2 border-white bg-white",children:[(0,s.jsx)("video",{ref:p,className:"h-full w-full rounded-2xl object-contain",preload:"none",autoPlay:!0,loop:!0,controls:!0,playsInline:!0,onPause:()=>m(!0),onPlay:()=>m(!1),onCanPlay:e=>{let t=e.currentTarget;t.defaultMuted=!1,t.muted=!1,t.play().catch(()=>{})},children:(0,s.jsx)("source",{src:t,type:"video/mp4"})}),x&&(0,s.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,s.jsx)("button",{type:"button",className:"pointer-events-auto flex size-20 items-center justify-center rounded-full bg-black/50 text-white shadow-lg backdrop-blur",onClick:e=>{e.stopPropagation();let t=p.current;t&&t.play()},children:(0,s.jsx)(eW.Z,{className:"size-8 fill-white text-white"})})})]})]})})})]})}var eX=l(98814),e0=l(3741);let e1="inline-flex size-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-gray-100 hover:text-foreground";function e2(e){let{title:t,onBack:l,onClose:r}=e,{t:a}=(0,i.$G)("common");return(0,s.jsxs)("div",{className:"mb-4 flex items-center gap-2",children:[l&&(0,s.jsx)("button",{type:"button","aria-label":a("button.prev").toString(),onClick:l,className:e1,children:(0,s.jsx)(eX.Z,{className:"size-4"})}),(0,s.jsx)("h2",{className:"min-w-0 flex-1 truncate text-base font-semibold text-foreground",children:t}),(0,s.jsx)("button",{type:"button","aria-label":a("button.close").toString(),onClick:r,className:e1,children:(0,s.jsx)(Q.Z,{className:"size-4"})})]})}function e4(e){let{icon:t,label:l,destructive:r,onClick:a}=e;return(0,s.jsxs)("button",{type:"button",onClick:a,className:(0,M.cn)("flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-sm font-medium transition-colors",r?"bg-destructive/10 text-destructive hover:bg-destructive/15":"bg-gray-100 text-foreground hover:bg-gray-300/60"),children:[(0,s.jsx)(t,{className:(0,M.cn)("size-4 shrink-0",r?"text-destructive":"text-primary")}),l]})}function e5(e){let{request:t,view:l,changeView:r}=e,{t:c}=(0,i.$G)("catalog_video"),d=(0,n.T)(),u=(null==t?void 0:t.videoUrl)||"",m=()=>r(null),p=()=>{t&&(d(a.wr.deleteRequest({id:t.id})),m())};return(0,s.jsx)(e0.Y,{viewId:l,onClose:m,placement:"center",children:"delete"===l?(0,s.jsxs)("div",{children:[(0,s.jsx)(e2,{title:c("confirm.delete_title").toString(),onBack:()=>r("actions"),onClose:m}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:c("confirm.delete_description")}),(0,s.jsxs)("div",{className:"mt-5 flex items-center gap-2",children:[(0,s.jsx)(x.z,{variant:"secondary",className:"flex-1 rounded-xl",onClick:()=>r("actions"),children:c("common:button.cancel")}),(0,s.jsx)(x.z,{variant:"destructive",className:"flex-1 rounded-xl",onClick:p,children:c("common:button.delete")})]})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(e2,{title:c("action.options").toString(),onClose:m}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[u&&(0,s.jsx)(e4,{icon:o.DownloadBoxIcon,label:c("action.download").toString(),onClick:()=>{window.open(u,"_blank")}}),(0,s.jsx)(e4,{icon:o.TrashCanIcon,label:c("action.delete").toString(),destructive:!0,onClick:()=>r("delete")})]})]})})}var e3=l(24958),e9=l(14199),e8=l(78107),e7=l(82914),e6=l(6571),te=l(47280),tt=l(92693);let tl=[{key:"preparing",icon:e3.Z},{key:"backdrop",icon:e9.Z},{key:"visuals",icon:e8.Z},{key:"scenes",icon:e7.Z},{key:"polish",icon:e6.Z}],ts={initial:{opacity:0,y:14}
1,animate:{opacity:1,y:0,transition:{duration:.42,ease:tt.sq}},exit:{opacity:0,y:-14,transition:{duration:.24,ease:tt.sq}}},tr={initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}}};function ta(e){let{createdAt:t}=e,{t:l}=(0,i.$G)("catalog_video"),a=(0,te.J)(),[n,o]=(0,r.useState)(0);(0,r.useEffect)(()=>{let e=window.setInterval(()=>o(e=>e+1),5e3);return()=>window.clearInterval(e)},[]);let c=t?new Date(t).getTime():Number.NaN,d=(0,r.useMemo)(()=>Number.isNaN(c)?0:Math.floor(Math.max(0,Date.now()-c)/5e3),[c]),u=tl[(n+d)%tl.length],x=u.icon;return(0,s.jsxs)("div",{className:"absolute inset-0 overflow-hidden bg-gradient-to-br from-primary/20 via-primary/[0.06] to-primary/25",children:[(0,s.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute -inset-y-1/4 left-0 w-1/3 bg-gradient-to-r from-transparent via-white/80 to-transparent motion-safe:animate-sweep"}),(0,s.jsxs)("div",{className:"relative flex h-full flex-col items-center justify-center gap-1.5 px-5 pb-9 text-center",children:[(0,s.jsx)("div",{className:"grid w-full",children:(0,s.jsx)(eJ.M,{initial:!1,children:(0,s.jsxs)(eY.E.div,{variants:a?tr:ts,initial:"initial",animate:"animate",exit:"exit",className:"col-start-1 row-start-1 flex flex-col items-center gap-2.5",children:[(0,s.jsx)("span",{className:"flex size-11 items-center justify-center rounded-full bg-background text-primary shadow-sm ring-1 ring-primary/40",children:(0,s.jsx)(x,{className:"size-5"})}),(0,s.jsx)("p",{className:"flex min-h-8 items-center text-xs font-medium leading-4 text-foreground",children:l("card.stage.".concat(u.key))})]},u.key)})}),(0,s.jsx)("p",{className:"text-[11px] leading-none text-muted-foreground",children:l("card.processing_hint")})]})]})}
1let tn="rounded-full bg-white/90 px-2 py-1 text-[11px] font-semibold leading-3 text-foreground shadow-sm",ti=r.memo(e=>{var t,l;let{request:c,template:d}=e,{t:u}=(0,i.$G)("catalog_video"),x=(0,n.T)(),m=(0,n.C)(e=>e.catalogVideo.metaUploadingIds.includes(c.id)),[p,f]=(0,r.useState)(null),h=c.status===ez.eE.PENDING||c.status===ez.eE.PROCESSING,g=c.status===ez.eE.FAILED,b=c.durationSec||(null==d?void 0:d.estimatedDurationSec),v=(0,r.useCallback)(e=>f(e),[]),j=(0,r.useCallback)(()=>{c.videoUrl&&window.open(c.videoUrl,"_blank")},[c.videoUrl]),N=(0,r.useCallback)(()=>{x(a.wr.uploadToMeta({id:c.id,videoUrl:c.videoUrl}))},[x,c.id,c.videoUrl]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative m-0.5",children:[h&&(0,s.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute -inset-[2px] overflow-hidden rounded-[14px] bg-primary/35",children:(0,s.jsx)("span",{style:{backgroundImage:"conic-gradient(from 0deg, rgba(64, 201, 162, 0) 0deg, rgba(64, 201, 162, 1) 14deg, rgba(64, 201, 162, 0.4) 90deg, rgba(64, 201, 162, 0) 170deg, rgba(64, 201, 162, 0) 360deg)"},className:"absolute -left-1/2 -top-1/2 h-[200%] w-[200%] motion-safe:animate-border-orbit"})}),(0,s.jsxs)(eU.Zb,{className:(0,M.cn)("group relative aspect-[9/16] w-full overflow-hidden rounded-xl border border-gray-300 bg-muted transition-shadow duration-300 hover:shadow-md",h&&"border-primary"),children:[c.videoUrl?(0,s.jsx)(eQ,{videoSrc:c.videoUrl,className:"size-full",videoClassName:"object-cover",aspectRatio:function(e,t){if(!e||!t)return;let l=e/t;return eS.reduce((e,t)=>Math.abs(t.value-l)<Math.abs(e.value-l)?t:e).label}(null==d?void 0:d.width,null==d?void 0:d.height),onDownload:j,onDelete:()=>f("delete")}):g?(0,s.jsxs)("div",{className:"flex size-full flex-col items-center justify-center gap-2 px-5 text-center",children:[(0,s.jsx)(o.ClapperboardEditIcon,{className:"size-8 shrink-0 text-destructive"}),(0,s.jsx)("p",{className:"text-xs font-medium text-destructive",children:u("card.failed")}),c.error&&(0,s.jsx)("p",{className:"line-clamp-2 text-[11px] leading-snug text-muted-foreground",children:c.error})]}):h?(0,s.jsx)(ta,{createdAt:c.createdAt}):(0,s.jsx)("div",{className:"flex size-full items-center justify-center",children:(0,s.jsx)(o.ClapperboardEditIcon,{className:"size-8 text-muted-foreground"})}),(0,s.jsxs)("div",{className:"pointer-events-none absolute left-2 top-2 z-[4] flex transform-gpu flex-col items-start gap-0.5",children:[c.status!==ez.eE.COMPLETED&&(0,s.jsxs)(eH.C,{variant:function(e){switch(e){case ez.eE.COMPLETED:return"success";case ez.eE.FAILED:return"destructive";case ez.eE.PROCESSING:return"warning";case ez.eE.REVISED:return"blue";case ez.eE.PENDING:default:return"default"}}(c.status),className:(0,M.cn)(tn,"flex items-center gap-1.5",h&&"border border-primary/60 text-primary",g&&"text-destructive"),children:[h&&(0,s.jsx)("span",{className:"size-1.5 shrink-0 animate-pulse rounded-full bg-primary"}),u("status.".concat(c.status))]}),!!b&&c.videoUrl&&(0,s.jsxs)("span",{className:(0,M.cn)(tn,"flex items-center gap-1"),children:[(0,s.jsx)(eC.Z,{className:"size-3"}),u("card.duration",{seconds:b})]})]}),(0,s.jsx)("button",{type:"button","aria-label":u("action.options").toString(),onClick:()=>f("actions"),className:"absolute right-2 top-2 z-[4] flex size-6 items-center justify-center rounded-full bg-black/10 text-white backdrop-blur-md transition-colors hover:bg-black/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:(0,s.jsx)(eA.Z,{className:"size-4"})}),(0,s.jsxs)("span",{className:(0,M.cn)(tn,"pointer-events-none absolute bottom-2 left-2 z-[4] flex transform-gpu items-center gap-1"),children:[(0,s.jsx)(eB.Z,{className:"size-3"}),u("card.products",{count:null!==(l=null===(t=c.productIds)||void 0===t?void 0:t.length)&&void 0!==l?l:0})]}),c.videoUrl&&(0,s.jsxs)("button",{type:"button",disabled:m,onClick:N,className:(0,M.cn)(tn,"absolute bottom-2 right-2 z-[4] flex items-center gap-1 whitespace-nowrap transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-60"),children:[(0,s.jsx)(o.MetaLogoIcon,{className:"size-3"}),u(m?"action.uploading_to_meta":"action.upload_to_meta")]})]})]}),(0,s.jsx)(e5,{request:c,view:p,changeView:v})]})});function to(){return(0,s.jsx)(e_.O,{className:"m-0.5 aspect-[9/16] w-full rounded-xl bg-border"})}
1ti.displayName="CatalogVideoCard";let tc={templates:function(){let{t:e}=(0,i.$G)("catalog_video"),{data:t,loading:l,isFetched:o}=(0,n.C)(a.p8),{template:c,selectTemplate:d,templateFilters:u,setTemplateFilters:x}=z(),{ratio:m,sector:p,maxProducts:f}=u,h=(0,r.useMemo)(()=>eO(t,e=>e.aspectRatio).map(t=>{let{aspectRatio:l}=t,s=e("ratio.".concat(l.replace(":","_")),{defaultValue:""});return{value:l,label:s?"".concat(l," ").concat(s):l}}),[t,e]),g=(0,r.useMemo)(()=>eO(t,e=>e.sector).map(t=>{let{sector:l,sectorLabel:s}=t;return{value:l,label:e("sector.".concat(l),{defaultValue:s}).toString()}}),[t,e]),b=(0,r.useMemo)(()=>eD.map(t=>({value:t,label:e("builder.filters.max_products",{max:t}).toString()})),[e]),v=l&&!o,j=(0,r.useMemo)(()=>t.filter(e=>(null===m||e.aspectRatio===m)&&(null===p||e.sector===p)&&(null===f||e.productCount<=f)),[t,m,p,f]);return(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2",children:[(0,s.jsx)(eL,{sectorOptions:g,ratioOptions:h,maxProductOptions:b,filters:u,onChange:x,loading:v}),v?(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden p-1",children:(0,s.jsx)("div",{className:"grid grid-cols-2 gap-4",children:Array.from({length:6}).map((e,t)=>(0,s.jsx)(eT,{},t))})}):0===j.length?(0,s.jsx)("div",{className:"flex flex-1 items-center justify-center rounded-lg border border-dashed p-12 text-center text-sm text-muted-foreground",children:e("card.empty_templates")}):(0,s.jsx)(e$,{templates:j,selectedId:null==c?void 0:c.id,onSelect:d})]})},products:function(){let{t:e}=(0,i.$G)("catalog_video"),t=(0,n.T)(),{catalogAccount:l,allProducts:o,bestSellerProducts:c,newProducts:d,customProductSets:u,customProductSetProducts:m}=(0,n.C)(e=>e.catalogVideo),{template:p,products:f,isProductEligible:h,toggleProduct:g,addProducts:b,clearProducts:v}=z(),[j,N]=(0,r.useState)(""),[y,w]=(0,r.useState)(!1),[k,C]=(0,r.useState)(eu),[_,S]=(0,r.useState)(null),{productSet:E}=k;(0,r.useEffect)(()=>C(eu),[null==l?void 0:l.id]),(0,r.useEffect)(()=>{ed.includes(E)||m[E]||t(a.wr.getCustomProductSetProducts({customProductSetId:E}))},[E,m,t]);let I=(0,r.useMemo)(()=>o.data.filter(h),[o.data,h]),P=(0,r.useMemo)(()=>{switch(E){case"all_products":return null;case"best_sellers":return c;case"new_products":return d;default:var e;return null!==(e=m[E])&&void 0!==e?e:ek}},[E,c,d,m]),Z=(0,r.useMemo)(()=>P?new Set(P.data.map(e=>e.productId)):null,[P]),T=o.loading||!!(null==P?void 0:P.loading),G=(0,r.useMemo)(()=>{var e;let t=j.trim().toLowerCase();return(function(e,t,l){let s=t.name.trim().toLowerCase();return e.filter(e=>{var r;return(!l||!!l.has(e.productId))&&(!s||!!(null!==(r=e.title)&&void 0!==r?r:"").toLowerCase().includes(s))&&(t.type===ec||em(e)===t.type)&&!!function(e,t,l){if(!t&&!l)return!0;let s=Number(e),r=!Number.isNaN(s)&&(!t||!Number.isNaN(Number(t)))&&(!l||!Number.isNaN(Number(l)));return r?!(t&&s<Number(t)||l&&s>Number(l)):(!t||!(e<t))&&(!l||!(e>l))}(e.productId,t.idMin.trim(),t.idMax.trim())&&!!function(e,t,l){if(!t&&!l)return!0;let s=function(e){if(!e)return null;let t=e.replace(/[^\d.,-]/g,"");if(!t)return null;let l=t;t.includes(",")&&t.includes(".")?l=t.replace(/,/g,""):t.includes(",")&&(l=t.replace(",","."));let s=parseFloat(l);return Number.isNaN(s)?null:s}(e);return!(null===s||t&&s<parseFloat(t)||l&&s>parseFloat(l))}(e.price,t.priceMin.trim(),t.priceMax.trim())})})(I,k,Z).filter(l=>!t||(null!==(e=l.title)&&void 0!==e?e:"").toLowerCase().includes(t))},[I,k,Z,j]),R=(0,r.useMemo)(()=>new Set(f.map(e=>e.id)),[f]);if(!p)return null;let L=p.productCount-f.length;return(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[(0,s.jsx)(ew,{selectedCount:f.length,productCount:p.productCount,minImagesByProduct:p.minImagesByProduct}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eo.M,{value:j,onChange:e=>N(e.target.value),placeholder:e("builder.products.search_placeholder").toString(),containerClassName:"flex-1",className:"h-11 rounded-xl"}),(0,s.jsx)(x.z,{variant:"outline",size:"icon","aria-label":e("builder.products.filters").toString(),onClick:()=>w(!0),className:(0,M.cn)("rounded-xl",ex(k)&&"border-primary/50 bg-primary/5"),children:(0,s.jsx)(ei.Z,{className:"size-4 text-primary"})})]}),(0,s.jsx)(eN,{open:y,onOpenChange:w,products:I,customProductSets:u.data,filters:k,onFiltersChange:C,matchingCount:G.length,loading:T,remaining:L,selectedCount:f.length,onSelectMatching:()=>b(G),onClearSelection:v}),(0,s.jsx)("div",{ref:S,className:"min-h-0 flex-1 overflow-y-auto pr-1",children:(0,s.jsx)(eh,{scrollElement:_,products:G,loading:T,selectedIds:R,selectionFull:0===L,onToggle:g})})]})},edit:function(){let{templateJson:e,texts:t,setText:l,colors:a,setColor:n,logo:i,setLogo:o,products:c,reorderProducts:d,removeProduct:u}=z(),x=(0,r.useMemo)(()=>{var t,l;
1return e?b(e.layers).filter(j).map(e=>({id:e.id,text:String(null!==(t=e.properties.text)&&void 0!==t?t:""),color:null!==(l=e.properties.color)&&void 0!==l?l:g})):[]},[e]),m=(0,r.useMemo)(()=>e?function(e){let t=b(e.layers);return f.map(e=>{var l,s;let r=t.filter(t=>N(t)===e);return{type:e,ids:r.map(e=>e.id),color:null!==(s=null===(l=r[0])||void 0===l?void 0:l.properties.color)&&void 0!==s?s:g}}).filter(e=>e.ids.length>0)}(e):[],[e]),p=(0,r.useMemo)(()=>Array.from(new Set([...x,...m].map(e=>e.color))),[x,m]),h=(0,r.useMemo)(()=>e?function(e){var t,l;let s=b(e.layers).find(e=>v(e,"brand"));return s?String(null!==(l=null===(t=s.settings)||void 0===t?void 0:t.source)&&void 0!==l?l:""):void 0}(e):void 0,[e]);return e?(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto pr-1",children:[void 0!==h&&(0,s.jsx)($,{current:null!=i?i:h,uploaded:i,onChange:o}),(0,s.jsx)(en,{fields:x,values:t,colors:a,presets:p,onChange:l,onColorChange:n}),(0,s.jsx)(W,{fields:m,colors:a,presets:p,onColorChange:n}),(0,s.jsx)(et,{products:c,onReorder:d,onRemove:u})]}):null},generated:function(){let{t:e}=(0,i.$G)("catalog_video"),t=(0,n.C)(a.$L),l=(0,n.C)(a.cR),o=(0,n.C)(a.p8),c=(0,r.useMemo)(()=>eq().orderBy(t.data.filter(e=>e.catalogId===(null==l?void 0:l.id)),"createdAt","desc"),[t.data,null==l?void 0:l.id]),d=(0,r.useMemo)(()=>eq().keyBy(o.data,"id"),[o.data]);return(0,s.jsx)("div",{className:"flex h-full min-h-0 flex-1 flex-col gap-4 overflow-y-auto pr-1",children:t.loading&&!t.isFetched?(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Array.from({length:6}).map((e,t)=>(0,s.jsx)(to,{},t))}):0===c.length?(0,s.jsx)("div",{className:"flex flex-1 items-center justify-center rounded-lg border border-dashed border-border bg-background p-12 text-center text-sm text-muted-foreground",children:e("card.empty_requests")}):(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:c.map(e=>(0,s.jsx)(ti,{request:e,template:d[e.videoTemplateId]},e.id))})})}};function td(){let{step:e}=z(),t=tc[e];return(0,s.jsxs)("div",{className:"flex h-full min-h-0 flex-col rounded-lg border bg-background",children:[(0,s.jsx)("div",{className:"border-b p-4",children:(0,s.jsx)(Z,{})}),(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 p-4",children:[(0,s.jsx)(t,{}),(0,s.jsx)(E,{})]})]})}var tu=l(82431),tx=l(56179),tm=l(10921);function tp(e){e.play().catch(()=>void 0)}let tf={backgroundImage:"radial-gradient(hsl(var(--border)) 1px, transparent 1px)",backgroundSize:"18px 18px"};function th(){var e;let{t}=(0,i.$G)("catalog_video"),{step:a,template:n,templateLoading:c,videoJson:d}
1=z(),{hostRef:u,loading:x,failed:m,playing:p,togglePlayback:f}=function(e){let{videoKey:t,video:s}=e,a=(0,r.useRef)(null),n=(0,r.useRef)(null),i=(0,r.useRef)(!0),[o,c]=(0,r.useState)(null),[d,u]=(0,r.useState)(!1),[x,m]=(0,r.useState)(!0),[p,f]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=a.current;if(!e||!t)return;let s=null,r=!1;return u(!0),f(!1),Promise.all([l.e(9989),l.e(6324),l.e(9163),l.e(3705)]).then(l.bind(l,7595)).then(t=>{r||c(s=t.createRenderer(e))}),()=>{r=!0,null==s||s.destroy(!0),c(null),u(!1)}},[t]),(0,r.useEffect)(()=>{if(!o||!s)return;let e=!1,t=n.current!==o,l=async()=>{let l=t?0:o.currentFrame;n.current=o,await function(e,t){let l=new Promise((e,t)=>setTimeout(()=>t(Error("Video load timed out")),2e4));return Promise.race([e,l])}(o.loadVideo(function(e){let t=e=>({...e,properties:{...e.properties,mute:!0},...v(e,"product")&&e.settings.source&&{settings:{...e.settings,source:w(e.settings.source)}},...e.children&&{children:e.children.map(t)}});return{...e,layers:e.layers.map(t)}}(s)),0),e||(l>0&&await o.seek(l),!e&&i.current&&tp(o))},r=window.setTimeout(()=>l().catch(l=>{t&&!e&&f(!0)}).finally(()=>t&&u(!1)),t?0:150);return()=>{e=!0,window.clearTimeout(r)}},[o,s]);let h=()=>{if(!o||n.current!==o)return;let e=!x;e?tp(o):o.stop(),i.current=e,m(e)};return{hostRef:a,loading:d,failed:p,playing:x,togglePlayback:h}}({videoKey:null!==(e=null==n?void 0:n.id)&&void 0!==e?e:null,video:d}),h=c||x,g=k.indexOf(a)+1;return(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col rounded-lg border bg-background",style:tf,children:[(0,s.jsx)("div",{className:"flex h-[68px] items-center justify-end p-4",children:g>0&&(0,s.jsx)(eH.C,{variant:"outline",className:"rounded-full bg-background text-xs shadow-sm",children:t("builder.preview.step",{current:g,total:k.length})})}),(0,s.jsx)("div",{className:"flex flex-1 items-center justify-center px-6 pb-6",children:(0,s.jsx)(tm.n,{variant:"light",screenAspect:9/16,style:{width:"min(400px, 100%, (100dvh - 250px) * 433 / 741)"},content:(0,s.jsxs)("div",{className:(0,M.cn)("relative size-full bg-[#E5E5E5]"),children:[(0,s.jsx)("div",{ref:u,className:(0,M.cn)("size-full",h&&"opacity-0"),style:{containerType:"size"}}),!n&&(0,s.jsxs)(tg,{className:"bg-transparent text-neutral-500",children:[(0,s.jsx)(o.ClapperboardEditIcon,{className:"size-6"}),(0,s.jsx)("p",{className:"text-[11px]",children:t("builder.preview.empty")})]}),n&&h&&(0,s.jsxs)(tg,{className:"gap-2 bg-transparent text-neutral-500",children:[(0,s.jsx)(G.Z,{className:"size-5 animate-spin"}),(0,s.jsx)("p",{className:"text-xs",children:t("builder.preview.loading")})]}),n&&m&&(0,s.jsxs)(tg,{className:"gap-2 text-white/50",children:[(0,s.jsx)(tu.Z,{className:"size-5"}),(0,s.jsx)("p",{className:"text-xs",children:t("builder.preview.load_error")})]}),(0,s.jsx)(tb,{}),n&&!h&&!m&&(0,s.jsx)("button",{type:"button","aria-label":t(p?"builder.preview.pause":"builder.preview.play").toString(),onClick:f,className:"absolute inset-0 flex items-center justify-center opacity-0 transition-opacity hover:opacity-100",children:(0,s.jsx)("span",{className:"flex size-14 items-center justify-center rounded-full bg-white/80 text-foreground shadow-md backdrop-blur-sm",children:p?(0,s.jsx)(tx.Z,{className:"size-6"}):(0,s.jsx)(eW.Z,{className:"size-6"})})})]})})})]})}function tg(e){let{className:t,children:l}=e;return(0,s.jsx)("div",{className:(0,M.cn)("absolute inset-0 flex flex-col items-center justify-center gap-3 bg-[#111111] px-8 text-center text-white/80",t),children:l})}function tb(){return(0,s.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-0 flex h-14 select-none items-center justify-between text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.45)]",children:[(0,s.jsx)("span",{className:"w-[34%] text-center text-[15px] font-semibold",children:"9:41"}),(0,s.jsxs)("div",{className:"flex w-[34%] items-center justify-center gap-1",children:[(0,s.jsxs)("svg",{viewBox:"0 0 18 12",className:"h-3 w-[18px] fill-current",children:[(0,s.jsx)("rect",{x:"0",y:"7.5",width:"3.2",height:"4.5",rx:"1"}),(0,s.jsx)("rect",{x:"4.8",y:"5",width:"3.2",height:"7",rx:"1"}),(0,s.jsx)("rect",{x:"9.6",y:"2.5",width:"3.2",height:"9.5",rx:"1"}),(0,s.jsx)("rect",{x:"14.4",y:"0",width:"3.2",height:"12",rx:"1"})]}),(0,s.jsxs)("svg",{viewBox:"0 0 16 12",className:"h-3 w-4 fill-current",children:[(0,s.jsx)("path",{d:"M8 11.5 5.6 9.1a3.4 3.4 0 0 1 4.8 0Z"}),(0,s.jsx)("path",{d:"M3.05 6.55a7 7 0 0 1 9.9 0l-1.41 1.41a5 5 0 0 0-7.08 0Z"}),(0,s.jsx)("path",{d:"M.5 4a10.6 10.6 0 0 1 15 0l-1.42 1.42a8.6 8.6 0 0 0-12.16 0Z"})]}),(0,s.jsxs)("svg",{viewBox:"0 0 27 13",className:"h-[13px] w-[27px] fill-current",children:[(0,s.jsx)("rect",{x:"0.5",y:"0.5",width:"23",height:"12",rx:"3.5",fill:"none",stroke:"currentColor",strokeOpacity:"0.4"}),(0,s.jsx)("rect",{x:"2",y:"2",width:"20",height:"9",rx:"2"}),(0,s.jsx)("path",{d:"M25 4.5v4a2 2 0 0 0 0-4Z",fillOpacity:"0.4"})]})]})]})}function tv(){var e,t;let{t:l}=(0,i.$G)("catalog"),c=(0,n.T)(),{data:d,loading:u}=(0,n.C)(a.ww),x=(0,n.C)(a.cR),m=(0,r.useMemo)(()=>d.map(t=>{var l;return{value:t.id,label:t.siteName,labelComponent:(0,s.jsxs)("span",{className:"flex flex-col text-left",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,s.jsx)(o.MetaLogoIcon,{className:"h-3 w-3 shrink-0"}),(0,s.jsx)("span",{className:"line-clamp-1",children:null!==(e=null===(l=t.facebookAdAccount)||void 0===l?void 0:l.name)&&void 0!==e?e:"-"})]}),(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs+",children:[(0,s.jsx)(o.CatalogIcon,{className:"h-3 w-3 shrink-0"}),(0,s.jsx)("span",{className:"line-clamp-1",children:t.siteName})]})]})}}),[d]),p=e=>{let t=d.find(t=>
1t.id===e.target.value);t&&t.id!==(null==x?void 0:x.id)&&c(a.wr.selectCatalogAccount(t))};return(0,s.jsx)(ev.h,{value:null!==(t=null==x?void 0:x.id)&&void 0!==t?t:"",options:m,onChange:p,placeholder:l("select_account").toString(),loading:u,triggerClassName:"w-48",contentAlign:"end",modal:!1})}var tj=l(36316);function tN(){let{t:e}=(0,i.$G)("catalog_video"),{data:t}=(0,n.C)(a.$L),l=(0,n.C)(a.cR),o=(0,r.useMemo)(()=>t.filter(e=>e.catalogId===(null==l?void 0:l.id)&&(e.status===ez.eE.PENDING||e.status===ez.eE.PROCESSING)).length,[t,null==l?void 0:l.id]);return 0===o?null:(0,s.jsxs)("button",{type:"button",className:"inline-flex h-11 shrink-0 select-none items-center gap-2 rounded-lg border border-orange/40 bg-orange/[0.08] px-3.5 text-sm font-medium tabular-nums text-orange outline-none transition-colors hover:bg-orange/[0.14] focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[(0,s.jsx)(tj.Z,{className:"h-3.5 w-3.5 shrink-0 animate-spin motion-reduce:animate-none"}),e("refresh.in_progress",{count:o})]})}function ty(){let{t:e}=(0,i.$G)("catalog_video"),{loading:t}=(0,n.C)(a.ww),l=(0,n.C)(a.cR);return(0,s.jsxs)("div",{className:"flex min-h-full flex-col bg-muted",children:[(0,s.jsx)(c.x,{children:(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-sm border",children:(0,s.jsx)(o.ClapperboardEditIcon,{className:"h-6 w-6"})}),(0,s.jsx)(c.P,{title:e("title"),description:e("title_description")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,s.jsx)(tN,{}),(0,s.jsx)(tv,{})]})]})}),(0,s.jsx)("div",{className:"px-layout py-layout flex w-full max-w-screen-4xl flex-1 flex-col",children:t||l?(0,s.jsx)(S,{children:(0,s.jsxs)("div",{className:"flex flex-col gap-4 xl:h-[calc(100dvh-148px)] xl:flex-row",children:[(0,s.jsx)("div",{className:"h-[calc(100dvh-148px)] shrink-0 xl:h-auto xl:w-1/3 xl:min-w-[380px]",children:(0,s.jsx)(td,{})}),(0,s.jsx)(th,{})]})}):(0,s.jsx)(d.s,{variant:"account"})})]})}var tw=!0;function tk(){let e=(0,n.T)();return(0,r.useEffect)(()=>(e(a.wr.getTemplates()),e(a.wr.getRequests()),e(a.wr.getCatalogAccounts()),()=>{e(a.wr.clearState())}),[e]),(0,s.jsx)(ty,{})}tk.pageOptions={title:"catalog_video",layout:"default"}}},function(e){e.O(0,[6612,7479,86,6877,38,2926,900,9774,2888,179],function(){return e(e.s=89955)}),_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.