PageSourceSearch

https://app.listingview.io/_next/static/chunks/6311-dcce7e9b330396f1.js

js listingview.io collected 2026-09-24 14:24:30 UTC 49,706 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6311],{3397:function(e,n,l){l.d(n,{Bp:function(){return r.Bp},JI:function(){return r.JI},TG:function(){return r.TG},Ym:function(){return d},is:function(){return s}});var t=l(86804),i=l(98527),r=l(59623);let o=e=>new Promise(n=>setTimeout(n,e));class a extends Error{constructor(e,{stage:n,httpStatus:l,errorCode:t,cause:i}={}){super(e),this.name="PsdUploadError",this.stage=n,this.httpStatus=l,this.errorCode=t,this.cause=i}}async function s(e){var n,l;let i,{onProgress:o,onStage:s,assetCategory:d,signal:u}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f=e=>{if(null==u?void 0:u.aborted)throw new a("PSD upload cancelled.",{stage:e,errorCode:"cancelled"})};if(!e)throw new a("No file provided",{stage:"presign"});if((0,r.TG)(e))throw new a("PSDs must be ".concat(r.JI," MB or smaller (this file is ").concat(Math.round((e.size||0)/1024/1024)," MB)."),{stage:"presign"});let p=(0,r.Bp)(e)?r.vh:e.type||r.vh;for(let l=0;l<2;l++){let r;f("presign"),null==s||s("presign");try{let l=await (0,t.n7)({filename:e.name,mimeType:p,contentLength:e.size,assetCategory:d||"mockup_templates"},{signal:u});r=(null==l?void 0:null===(n=l.data)||void 0===n?void 0:n.data)||(null==l?void 0:l.data)}catch(e){throw v(e,"presign")}let{fileId:g,uploadUrl:h}=r||{};if(!g||!h)throw new a("Presigned upload response missing fileId or uploadUrl.",{stage:"presign"});i=g,null==o||o(5),f("s3-put"),null==s||s("s3-put");try{await c(i,h,e,e=>{let n=5+Math.round(.8*e);null==o||o(n)},p,u);break}catch(e){if((null==e?void 0:e.errorCode)==="cancelled")throw e;if((null==e?void 0:e.errorCode)==="not_resumable"&&0===l)continue;throw e}}null==o||o(85),f("finalize"),null==s||s("finalize");try{await (0,t.$U)(i,{signal:u})}catch(e){if((null==e?void 0:null===(l=e.response)||void 0===l?void 0:l.status)!==409)throw v(e,"finalize")}return null==o||o(92),{fileId:i}}async function d(e){var n,l,i;let r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{fileId:d}=await s(e,o);null===(n=o.onStage)||void 0===n||n.call(o,"register");try{let e=await (0,t.kD)(d);r=(null==e?void 0:null===(i=e.data)||void 0===i?void 0:i.data)||(null==e?void 0:e.data),(null==e?void 0:e.status)===202&&(null==r?void 0:r.jobId)!=null&&(r=await u(r.jobId,o))}catch(e){if(e instanceof a)throw e;throw v(e,"register")}return null===(l=o.onProgress)||void 0===l||l.call(o,100),{fileId:d,registerResponse:r}}async function u(e){let{onProgress:n,signal:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Date.now()+48e4;for(;;){var s,d,u,c,v,f;if(null==l?void 0:l.aborted)throw new a("PSD upload cancelled.",{stage:"register",errorCode:"cancelled"});let p=null;try{p=await (0,i.m0)(e)}catch(e){if((null==e?void 0:e.code)==="ERR_CANCELED"||(null==e?void 0:e.name)==="CanceledError"||(null==e?void 0:e.name)==="AbortError")throw new a("PSD upload cancelled.",{stage:"register",errorCode:"cancelled",cause:e});if((null==e?void 0:null===(s=e.response)||void 0===s?void 0:s.status)===404)throw new a("PSD registration was lost — please try the upload again.",{stage:"register",httpStatus:404,cause:e})}if(p){if("done"===p.status)return p.result;if("failed"===p.status||"expired"===p.status){let e=null===(u=p.error)||void 0===u?void 0:u.code;throw new a((0,t.zo)(e,null,null!==(f=null===(c=p.error)||void 0===c?void 0:c.context)&&void 0!==f?f:null)||(null===(v=p.error)||void 0===v?void 0:v.message)||"PSD registration failed. Please try again.",{stage:"register",errorCode:e})}let e=Number(null===(d=p.progress)||void 0===d?void 0:d.percent);Number.isFinite(e)&&(null==n||n(92+Math.min(7,Math.max(0,Math.round(.07*e)))))}if(Date.now()>=r)throw new a("PSD registration is taking longer than expected. It may still finish — check your library in a few minutes before re-uploading.",{stage:"register",errorCode:"timeout"});await o(2500)}}async function c(e,n,l,i,s,d){let u=n;for(let n=1;n<=3;n++)try{if(null==d?void 0:d.aborted)throw new a("PSD upload cancelled.",{stage:"s3-put",errorCode:"cancelled"});await function(e,n,l,t,i){return new Promise((o,s)=>{var d;let u=new XMLHttpRequest,c=()=>u.abort();null==i||null===(d=i.addEventListener)||void 0===d||d.call(i,"abort",c,{once:!0}),u.open("PUT",e),u.setRequestHeader("Content-Type",t||n.type||r.vh),u.upload.addEventListener("progress",e=>{e.lengthComputable&&l(Math.round(e.loaded/e.total*100))}),u.addEventListener("loadend",()=>{var e;return null==i?void 0:null===(e=i.removeEventListener)||void 0===e?void 0:e.call(i,"abort",c)}),u.addEventListener("load",()=>{u.status>=200&&u.status<300?o():s(new a("S3 upload failed (HTTP ".concat(u.status,")"),{stage:"s3-put",httpStatus:u.status}))}),u.addEventListener("error",()=>s(new a("S3 upload network error",{stage:"s3-put"}))),u.addEventListener("abort",()=>s(new a("PSD upload cancelled.",{stage:"s3-put",errorCode:"cancelled"}))),u.send(n)})}(u,l,i,s,d);return}catch(r){var c,f;let l;if((null==r?void 0:r.errorCode)==="cancelled"||3===n)throw r;await o(1e3*n);try{l=await (0,t.Md)(e,{signal:d})}catch(n){let e=null==n?void 0:null===(f=n.response)||void 0===f?void 0:f.status;if(409===e)return;if(422===e)throw new a("This upload could not be resumed; starting over.",{stage:"s3-put",httpStatus:422,errorCode:"not_resumable",cause:n});
1throw v(n,"s3-put")}let i=(null==l?void 0:null===(c=l.data)||void 0===c?void 0:c.data)||(null==l?void 0:l.data)||{};if(!i.uploadUrl)throw new a("Refresh upload URL response missing uploadUrl.",{stage:"s3-put"});u=i.uploadUrl}}function v(e,n){var l,i;if((null==e?void 0:e.code)==="ERR_CANCELED"||(null==e?void 0:e.name)==="CanceledError"||(null==e?void 0:e.name)==="AbortError")return new a("PSD upload cancelled.",{stage:n,errorCode:"cancelled",cause:e});let r=null==e?void 0:null===(l=e.response)||void 0===l?void 0:l.status,o=(null==e?void 0:null===(i=e.response)||void 0===i?void 0:i.data)||{},s=o.error_code||o.errorCode;return new a((0,t.zo)(s,r)||o.message||(null==e?void 0:e.message)||"PSD ".concat(n," failed."),{stage:n,httpStatus:r,errorCode:s,cause:e})}},59446:function(e,n,l){l.d(n,{ZP:function(){return g},hn:function(){return f},sS:function(){return p}});var t=l(57437),i=l(2265),r=l(2069),o=l(95576),a=l(66337),s=l(71533),d=l(13213),u=l(43792),c=l(80188);function v(){return(0,t.jsxs)(r.Z,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:"2px",px:"4px",py:"1px",borderRadius:"999px",bgcolor:"var(--lv-brand)",color:"#fff",fontSize:"7px",fontWeight:700,letterSpacing:.5,ml:.5},children:[(0,t.jsx)(a.Z,{size:6}),"PLUS"]})}function f(e){let{minWidth:n=180}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[l,o]=(0,i.useState)(null),a=!!l,s=(0,i.useCallback)(e=>{e.stopPropagation(),o(e.currentTarget)},[]),u=(0,i.useCallback)(()=>o(null),[]),c=!!(null==e?void 0:e.length),f=(0,i.useMemo)(()=>c?function(e){let n=[],l=null;return e.forEach(e=>{null!==l&&e.group!==l&&n.push({divider:!0}),l=e.group,n.push({key:e.key,label:e.locked?(0,t.jsxs)(r.Z,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[e.label,(0,t.jsx)(v,{})]}):e.label,icon:e.icon,onClick:e.onClick,disabled:e.disabled,danger:e.danger,...e.children?{children:e.children,submenuProps:e.submenuProps}:{}})}),n}(e):[],[e,c]);return{open:a,hasActions:c,triggerProps:{onClick:s,"aria-haspopup":"menu","aria-expanded":a||void 0},menu:c?(0,t.jsx)(d.Z,{anchorEl:l,open:a,onClose:u,items:f,minWidth:n}):null}}function p(e){let{actions:n,size:l="small",minWidth:i=180}=e,{hasActions:r,triggerProps:a,menu:d}=f(n,{minWidth:i});return r?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{title:"More actions",placement:"bottom",children:(0,t.jsx)(o.Z,{size:l,"aria-label":"More actions",...a,draggable:!1,onDragStart:e=>e.preventDefault(),onMouseDown:e=>e.stopPropagation(),sx:{p:.5,color:"var(--lv-text-secondary)"},children:(0,t.jsx)(s.Z,{size:16})})}),d]}):null}function g(e){let{file:n,context:l="table",size:i="small",minWidth:r=180,isEtsyImageContext:o=!1,onViewDetails:a,onRename:s,onReplace:d,onDelete:u,onClose:v,onOpenMockupTray:f,onCategoryChanged:g,onRegionSaved:h}=e,{actions:m,modals:b}=(0,c.a)(n,{context:l,isEtsyImageContext:o,onViewDetails:a,onRename:s,onReplace:d,onDelete:u,onClose:v,onOpenMockupTray:f,onCategoryChanged:g,onRegionSaved:h});return 0===m.length?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p,{actions:m,size:i,minWidth:r}),b]})}},65740:function(e,n,l){l.d(n,{Y:function(){return j},Z:function(){return k}});var t=l(57437),i=l(2265),r=l(68575),o=l(7261),a=l(76865),s=l(62720),d=l(44794),u=l(71621),c=l(56475),v=l(1974),f=l(11388),p=l(66848),g=l(80863);let h=function(e,n){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"".concat(n,"s");return 1===e?"".concat(e," ").concat(n,"'s"):"".concat(e," ").concat(l,"'")},m=e=>(null==e?void 0:e.title)||((null==e?void 0:e.listingId)?"Listing ".concat(e.listingId):"A listing"),b=e=>(null==e?void 0:e.title)||((null==e?void 0:e.sourceListingId)?"Product ".concat(e.sourceListingId):"A POD product"),x=e=>{var n;return"Order #".concat(null!==(n=null==e?void 0:e.podOrderId)&&void 0!==n?n:"—").concat((null==e?void 0:e.status)?" — ".concat(String(e.status).replace(/_/g," ")):"")},y=e=>(null==e?void 0:e.name)||((null==e?void 0:e.id)?"Collection ".concat(e.id):"A collection");function w(e){let{icon:n,title:l,items:i,tone:r="error"}=e;return(null==i?void 0:i.length)?(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(n,{size:14,className:"info"===r?"text-lv-text-tertiary":"text-lv-error-strong","aria-hidden":"true"}),(0,t.jsx)("span",{className:"text-lv-strong text-lv-text-primary",children:l})]}),(0,t.jsx)("ul",{className:"mt-1 list-none space-y-0.5 pl-[22px]",children:i.map(e=>(0,t.jsx)("li",{className:"text-lv-body text-lv-text-secondary break-words",children:e.label},e.key))})]}):null}function k(e){let{open:n,file:l,blocked:i,loading:r=!1,error:o=null,onClose:g,onConfirm:k}=e,C=(null==i?void 0:i.attachedTo)||{},j=(null==l?void 0:l.sanitizedFilename)||(null==l?void 0:l.originalFilename)||"this file",E=(C.listings||[]).map((e,n)=>{var l,t;return{key:"listing-".concat(null!==(t=null!==(l=null==e?void 0:e.catalogId)&&void 0!==l?l:null==e?void 0:e.listingId)&&void 0!==t?t:n),label:m(e)}}),S=(C.podProducts||[]).map((e,n)=>{var l;return{key:"pod-".concat(null!==(l=null==e?void 0:e.catalogId)&&void 0!==l?l:n),label:b(e)}}),I=(C.openOrders||[]).map((e,n)=>{var l;return{key:"order-".concat(null!==(l=null==e?void 0:e.podOrderId)&&void 0!==l?l:n),label:x(e)}}),R=(C.collections||[]).map((e,n)=>{var l;return{key:"collection-".concat(null!==(l=null==e?void 0:e.id)&&void 0!==l?l:n),label:y(e)}}),D=Number.isFinite(C.deliverableCount)?C.deliverableCount:E.length,A=Number.isFinite(C.flaggedListingCount)?C.flaggedListingCount:E.length+S.length,L=C.lineage||C,N=Number.isFinite(L.mockupsAffected)?L.mockupsAffected:null,P=Number.isFinite(L.layerStacksAffected)?L.layerStacksAffected:null,T=N>0||P>0,Z=[D>0&&"Removes it from ".concat(h(D,"listing")," deliverables."),A>0&&"".concat(A," ").concat((0,f._6)(A,"listing")," will be flagged for review."),S.length>0&&"POD products keep an empty design slot — assign a new design before publishing them again.",I.length>0&&"".concat(I.length," open ").concat((0,f._6)(I.length,"order")," will NOT be cancelled and will still be missing this design."),R.length>0&&"Removes it from ".concat(R.length," ").concat((0,f._6)(R.length,"collection"),"."),(()=>{let e=[],n=[];null===N?n.push("any mockups generated from it"):N>0&&e.push("".concat(N," ").concat((0,f._6)(N,"mockup"))),null===P?n.push("any editor layer stacks using it"):P>0&&e.push("".concat(P," ").concat((0,f._6)(P,"layer stack")));let l=[...e,...n];if(0===l.length)return"";let t=l.join(" and ");return"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1)," ").concat("will lose their source — they are kept, but can no longer be regenerated from it.")})(),"The file and its stored copy are deleted permanently. This cannot be undone."].filter(
1Boolean),_=!(E.length>0||S.length>0||I.length>0)&&T,F=_?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-lv-strong",children:["“",j,"”"]})," is the source for work that already exists. You can delete it anyway, but that work can no longer be regenerated from it."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"text-lv-strong",children:["“",j,"”"]})," is still being used. You can delete it anyway, but the items below will be left without it."]});return(0,t.jsx)(v.Z,{open:n,onClose:r?void 0:g,disableBackdropClose:r,disableEscapeKeyDown:r,title:_?"Other files were made from this one":"This file is still in use",maxWidth:"sm",fullWidth:!0,actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.f,{text:"Cancel",color:"white",width:"auto",disabled:r,onClick:g}),(0,t.jsx)(p.f,{text:r?"Deleting...":o?"Try again":"Delete anyway",color:"destructive",width:"auto",disabled:r,onClick:k})]}),children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsx)(a.Z,{size:16,className:"mt-[2px] shrink-0 text-lv-error-strong","aria-hidden":"true"}),(0,t.jsx)("p",{className:"m-0 text-lv-body text-lv-text-primary",children:F})]}),(null==i?void 0:i.message)&&(0,t.jsx)("p",{className:"mt-2 mb-0 text-lv-caption text-lv-text-tertiary",children:i.message}),(0,t.jsx)(w,{icon:s.Z,title:"Listings",items:E}),(0,t.jsx)(w,{icon:d.Z,title:"POD products",items:S}),(0,t.jsx)(w,{icon:u.Z,title:"Open orders",items:I}),(0,t.jsx)(w,{icon:c.Z,title:"Also in these collections",items:R,tone:"info"}),o&&(0,t.jsx)("div",{role:"alert",className:"mt-3 rounded-lv-md border border-lv-error-border bg-lv-error-surface p-3 shadow-lv-status",children:(0,t.jsx)("p",{className:"m-0 text-lv-body text-lv-error-strong",children:o})}),(0,t.jsxs)("div",{className:"mt-4 rounded-lv-md border border-lv-error-border bg-lv-error-surface p-3 shadow-lv-status",children:[(0,t.jsx)("p",{className:"m-0 text-lv-strong text-lv-error-strong",children:"If you delete it anyway"}),(0,t.jsx)("ul",{className:"mt-1.5 mb-0 list-disc space-y-1 pl-4",children:Z.map(e=>(0,t.jsx)("li",{className:"text-lv-body text-lv-text-secondary",children:e},e))})]})]})})}let C=new Set(["TIMEOUT","INTERNAL","DEPENDENCY_CHECK_FAILED"]);function j(){let{onDeleted:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,r.I0)(),[l,t]=(0,i.useState)(null),[a,s]=(0,i.useState)(null),[d,u]=(0,i.useState)(!1),[c,v]=(0,i.useState)(null),f=(0,i.useRef)(!1),p=(0,i.useRef)(!1),[h,m]=(0,i.useState)(!1),b=(0,i.useRef)(!0);(0,i.useEffect)(()=>(b.current=!0,()=>{b.current=!1}),[]);let x=(0,i.useCallback)(()=>{p.current||(t(null),s(null),u(!1),v(null))},[]),y=(0,i.useCallback)(async l=>{if(null==l?void 0:l.id){if(f.current){o.Am.info("A delete is already in progress.");return}f.current=!0,m(!0);try{await n((0,g.Vg)({fileId:l.id})).unwrap(),o.Am.success("File deleted."),null==e||e(l)}catch(e){if((0,g.oi)(e)){if(!b.current){o.Am.warn(e.message||g.ss);return}s(l),t(e),v(null);return}e&&!e.message&&o.Am.error("Failed to delete file.")}finally{f.current=!1,b.current&&m(!1)}}},[n,e]),w=(0,i.useCallback)(async()=>{if((null==a?void 0:a.id)&&!f.current){f.current=!0,p.current=!0,m(!0),u(!0),v(null);try{await n((0,g.Vg)({fileId:a.id,force:!0})).unwrap(),o.Am.success("File deleted."),p.current=!1,x(),null==e||e(a)}catch(n){if(p.current=!1,b.current&&u(!1),(0,g.oi)(n)){o.Am.error(n.message||g.ss),x();return}if(!b.current)return;let e=(null==n?void 0:n.message)||"Couldn't delete this file. Please try again.";if(C.has(null==n?void 0:n.code)){v(e);return}x()}finally{f.current=!1,b.current&&m(!1)}}},[n,a,x,e]);return{requestDelete:y,isDeleting:h,dialogProps:{open:!!l,file:a,blocked:l,loading:d,error:c,onClose:x,onConfirm:w}}}},6072:function(e,n,l){l.d(n,{ZP:function(){return j},gK:function(){return C}});var t=l(57437),i=l(2265),r=l(22048),o=l(2069),a=l(68575),s=l(7261),d=l(1974),u=l(59446),c=l(80188),v=l(26770),f=l(45975),p=l(80863),g=l(36841),h=l(42934);let m="lv-mockup-template-regions-saved",b="picker-tile-kebab",x=Object.freeze({DELETE:"delete",RENAME:"rename",REPLACE:"replace",ROLE:"role",REGION:"region"}),y=["editDesign","generateMockups","editLayers"],w=e=>(null==e?void 0:e.assetCategory)===h.Xg.MOCKUP_TEMPLATES,k=()=>{r.uT("PickerTileActions: Generate Mockups reached a picker tile, which cannot host the tray.")};function C(){let e=(0,g.w)();return(0,i.useMemo)(()=>({["& .".concat(b)]:{opacity:e?1:0,transition:"opacity 150ms","@media (prefers-reduced-motion: reduce)":{transition:"none"}},["&:hover .".concat(b,", & .").concat(b,":focus-within")]:{opacity:1}}),[e])}function j(e){var n,l,r,g,h,C;let{file:j,onMutated:E,isEtsyImageContext:S=!1,size:I="small",sx:R}=e,D=(0,a.I0)(),[A,L]=(0,i.useState)(!1),[N,P]=(0,i.useState)(!1),[T,Z]=(0,i.useState)(!1),_=(0,i.useCallback)(function(e){let{updated:n=null,removed:l=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};
1null==E||E({file:j,kind:e,updated:n,removed:l})},[j,E]),F=(0,i.useCallback)(()=>L(!0),[]),z=(0,i.useCallback)(()=>P(!0),[]),O=(0,i.useCallback)(()=>Z(!0),[]),U=(0,i.useCallback)((e,n)=>_(x.ROLE,{updated:n}),[_]),M=(0,i.useCallback)(()=>_(x.REGION),[_]),{actions:G,modals:B}=(0,c.a)(j,{context:"card",isEtsyImageContext:S,onRename:F,onReplace:z,onDelete:O,onOpenMockupTray:k,onCategoryChanged:U,onRegionSaved:M}),W=(0,i.useMemo)(()=>new Set(w(j)?y:[...y,"unifiedEdit"]),[j]),K=(0,i.useMemo)(()=>G.filter(e=>!W.has(e.key)),[G,W]),H=(0,i.useMemo)(()=>K.some(e=>"unifiedEdit"===e.key),[K]);(0,i.useEffect)(()=>{if(!H||(null==j?void 0:j.id)==null)return;let e=e=>{var n,l;String(null!==(l=null==e?void 0:null===(n=e.detail)||void 0===n?void 0:n.fileId)&&void 0!==l?l:"")===String(j.id)&&_(x.REGION)};return window.addEventListener(m,e),()=>window.removeEventListener(m,e)},[H,null==j?void 0:j.id,_]);let V=(0,i.useCallback)(async()=>{Z(!1);try{await D((0,p.Vg)({fileId:j.id})).unwrap(),s.Am.success("File deleted."),_(x.DELETE,{removed:!0})}catch(e){if((0,p.oi)(e)){s.Am.warn(e.message||p.ss);return}e&&!e.message&&s.Am.error("Failed to delete file.")}},[D,null==j?void 0:j.id,_]),Y=(0,i.useCallback)(()=>{L(!1),_(x.RENAME)},[_]),X=(0,i.useCallback)(()=>{P(!1),_(x.REPLACE)},[_]);if(0===K.length)return null;let q=null!==(g=null!==(r=null==j?void 0:j.linkedListingCount)&&void 0!==r?r:null==j?void 0:null===(n=j.linkedListings)||void 0===n?void 0:n.length)&&void 0!==g?g:0,Q=null!==(C=null!==(h=null==j?void 0:j.collectionCount)&&void 0!==h?h:null==j?void 0:null===(l=j.collections)||void 0===l?void 0:l.length)&&void 0!==C?C:0,J=(null==j?void 0:j.sanitizedFilename)||(null==j?void 0:j.originalFilename)||"",$=['Delete "'.concat(J,'"?'),q>0?"This file is linked to ".concat(q," listing").concat(q>1?"s":"","."):"",Q>0?"It belongs to ".concat(Q," collection").concat(Q>1?"s":"","."):"","This action cannot be undone."].filter(Boolean).join(" ");return(0,t.jsxs)(o.Z,{className:b,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),sx:{display:"inline-flex",...R},children:[(0,t.jsx)(u.sS,{actions:K,size:I}),B,(0,t.jsx)(v.Z,{file:j,open:A,onClose:Y}),(0,t.jsx)(f.Z,{file:j,open:N,onClose:X}),(0,t.jsx)(d.Z,{open:T,onClose:()=>Z(!1),onConfirm:V,title:"Delete File?",message:$,confirmText:"Delete",variant:"danger"})]})}},26770:function(e,n,l){l.d(n,{Z:function(){return c}});var t=l(57437),i=l(2265),r=l(68575),o=l(7261),a=l(37930),s=l(67136),d=l(66848),u=l(80863);function c(e){let{file:n,open:l,onClose:c}=e,v=(0,r.I0)(),f=(null==n?void 0:n.sanitizedFilename)||(null==n?void 0:n.originalFilename)||"",[p,g]=(0,i.useState)(f),[h,m]=(0,i.useState)(!1);(0,i.useEffect)(()=>{l&&g(f)},[l,f]);let b=async()=>{let e=p.trim();if(!e||e===f){c();return}m(!0);try{await v((0,u.bI)({fileId:n.id,newName:e})).unwrap(),o.Am.success("File renamed."),c()}catch(e){o.Am.error((null==e?void 0:e.message)||"Failed to rename file.")}finally{m(!1)}};return(0,t.jsx)(a.Z,{open:l,onClose:c,size:"xs",title:"Rename File",actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.f,{text:"Cancel",color:"white",width:"auto",padding:"px-3 py-1.5",textSize:"text-sm",noShadow:!0,onClick:c}),(0,t.jsx)(d.f,{text:"Save",color:"black",width:"auto",padding:"px-3 py-1.5",textSize:"text-sm",noShadow:!0,loading:h,disabled:h,onClick:b})]}),children:(0,t.jsx)(s.Z,{value:p,onChange:g,size:"sm",inputProps:{autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&b(),"Escape"===e.key&&c()}}})})}},45975:function(e,n,l){l.d(n,{Z:function(){return x}});var t=l(57437),i=l(2265),r=l(15735),o=l(2069),a=l(46387),s=l(17689),d=l(7261),u=l(1974),c=l(66848),v=l(98527),f=l(84955);async function p(e,n){var l;let{expectedRevisionId:t=null,idempotencyKey:i,onProgress:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{items:o}=(0,f.SP)([n],{transport:"multipart",method:"PUT",endpoint:"".concat("https://backend.listingview.io","/api/files/").concat(e,"/replace"),fieldName:"files",surface:"library",idempotencyKey:i,extraFields:{expectedRevisionId:t},onItem:r?e=>{"number"==typeof(null==e?void 0:e.pct)&&r(e.pct)}:void 0}),a=await o[0].promise;if(null==a?void 0:a.cancelled){let e=Error("The replacement was cancelled.");throw e.name="AbortError",e}if((null==a?void 0:a.failed)||(null==a?void 0:a.response)==null)throw function(e){var n,l,t;let i=Error((null==e?void 0:e.error)||"The replacement failed.");return i.response={status:null!==(n=null==e?void 0:e.errorStatus)&&void 0!==n?n:null,data:null!==(l=null==e?void 0:e.errorBody)&&void 0!==l?l:null},i.status=null!==(t=null==e?void 0:e.errorStatus)&&void 0!==t?t:null,i}(a);let s=a.response;return null!==(l=null==s?void 0:s.data)&&void 0!==l?l:s}var g=l(91931),h=l(72160);let m=e=>{var n,l,t;return null!==(t=null!==(l=null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.data)&&void 0!==l?l:null==e?void 0:e.data)&&void 0!==t?t:e},b=e=>{var n,l,t,i,r,o,a,s;let d=null!==(o=null!==(r=null==e?void 0:null===(l=e.response)||void 0===l?void 0:null===(n=l.data)||void 0===n?void 0:n.data)&&void 0!==r?r:null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.data)&&void 0!==o?o:{},u=null!==(a=d.code)&&void 0!==a?a:d.error;return(null==e?void 0:null===(i=e.response)||void 0===i?void 0:i.status)!==409||"revision_conflict"!==u?null:{currentRevisionId:null!==(s=d.currentRevisionId)&&void 0!==s?s:null,message:"This file changed after the dialog opened. Your edited result is still available."}};function x(e){var n,l,f,x,y,w;let{file:k,open:C,onClose:j,onReplaced:E,sourceRevision:S=null,onSaveAsNew:I}=e,[R,D]=(0,i.useState)(null),[A,L]=(0,i.useState)(!1),[N,P]=(0,i.useState)(null),[T,Z]=(0,i.useState)(""),[_,F]=(0,i.useState)(null),[z,O]=(0,i.useState)(k),U=(0,i.useRef)(null),M=(0,i.useRef)(null),{handleError:G,modal:B}=(0,g.R)(),W=!!((null==S?void 0:S.assetFileId)&&(null==S?void 0:S.revisionId));(0,i.useEffect)(()=>{C&&(D(null),L(!1),P(null),Z(""),F(null),O(k),M.current=null)},[k,C,null==S?void 0:S.assetFileId,null==S?void 0:S.revisionId]);let K=null!==(x=null!==(f=null==z?void 0:z.linkedListingCount)&&void 0!==f?f:null==z?void 0:null===(n=z.linkedListings)||void 0===n?void 0:n.length)&&void 0!==x?x:0,H=null!==(w=null!==(y=null==z?void 0:z.collectionCount)&&void 0!==y?y:null==z?void 0:null===(l=z.collections)||void 0===l?void 0:l.length)&&void 0!==w?w:0,V=async function(){let{expectedRevisionId:e=(null==z?void 0:z.currentRevisionId)||null,rotateIdempotencyKey:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((null==z?void 0:z.id)&&(W||R)){n&&(M.current=null),M.current||(M.current=(0,h.q)()),Z(""),F(null),L(!0),P(null);try{let n=W?m(await (0,v.OI)({source:{assetFileId:Number(S.assetFileId),revisionId:S.revisionId},target:{assetFileId:Number(z.id),expectedRevisionId:e},idempotencyKey:M.current})):await p(z.id,R,{expectedRevisionId:e,idempotencyKey:M.current,onProgress:P});await (null==E?void 0:E(n)),d.Am.success("File replaced successfully."),X()}catch(n){let e=b(n);e?(F(e),Z(e.message)):(Z(W?"We couldn’t replace the original. Your edited result is unchanged; retry or save it as new.":""),G(n))}finally{L(!1),P(null)}}},Y=async()=>
1{if((null==z?void 0:z.id)&&!A){L(!0);try{let e=m(await (0,v.hn)(z.id));if(!(null==e?void 0:e.currentRevisionId))throw Error("current_revision_unavailable");O(e),F(null),Z("Original details refreshed. Review the impact, then replace again."),M.current=null}catch(e){Z("We couldn’t refresh the original. Your edited result is unchanged."),G(e)}finally{L(!1)}}},X=()=>{D(null),Z(""),F(null),M.current=null,null==j||j()};return(0,t.jsxs)(t.Fragment,{children:[B,(0,t.jsxs)(u.Z,{open:C,onClose:X,title:"Replace File",maxWidth:"sm",fullWidth:!0,onConfirm:V,confirmText:A?null!=N&&N<100?"Replacing… ".concat(N,"%"):"Replacing…":"Replace",loading:A,disableBackdropClose:A,disableEscapeKeyDown:A,confirmDisabled:A||!(null==z?void 0:z.id)||(W?!(null==z?void 0:z.currentRevisionId):!R),children:[(0,t.jsxs)(r.Z,{severity:"warning",sx:{mb:2},children:["This will replace “",(null==z?void 0:z.sanitizedFilename)||(null==z?void 0:z.originalFilename)||"Asset ".concat((null==z?void 0:z.id)||""),"” across all linked listings and collections. Its current revision changes globally; Canvas Undo only restores this canvas node."]}),T&&(0,t.jsx)(r.Z,{severity:_?"error":"info","aria-live":"polite",sx:{mb:2},children:T}),_&&W?(0,t.jsxs)(o.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1,mb:2},children:[(0,t.jsx)(c.f,{text:"Refresh details",color:"white",width:"auto",padding:"px-3 py-1.5",onClick:Y,disabled:A,ariaLabel:"Refresh original file details"}),(0,t.jsx)(c.f,{text:"Save as new",color:"white",width:"auto",padding:"px-3 py-1.5",onClick:()=>null==I?void 0:I(S),disabled:A||!I,ariaLabel:"Save the edited result as a new file"}),(0,t.jsx)(c.f,{text:"Retry replacement",color:"black",width:"auto",padding:"px-3 py-1.5",onClick:()=>V({expectedRevisionId:(null==_?void 0:_.currentRevisionId)||(null==z?void 0:z.currentRevisionId)||null,rotateIdempotencyKey:!!_}),disabled:A||!_.currentRevisionId,ariaLabel:"Retry replacement against the latest revision"})]}):null,K>0&&(0,t.jsxs)(a.Z,{variant:"body2",sx:{mb:.5},children:["This file is linked to ",(0,t.jsx)("strong",{children:K})," listing",K>1?"s":""," — they will serve the new file."]}),H>0&&(0,t.jsxs)(a.Z,{variant:"body2",sx:{mb:1.5},children:["This file is in ",(0,t.jsx)("strong",{children:H})," collection",H>1?"s":""," — it will be updated there as well."]}),W?(0,t.jsxs)(o.Z,{sx:{border:"1px solid var(--lv-border-default)",borderRadius:2,p:2,bgcolor:"var(--lv-bg-subtle)"},children:[(0,t.jsx)(a.Z,{variant:"body2",fontWeight:600,children:"Edited canvas result"}),(0,t.jsxs)(a.Z,{variant:"body2",color:"text.secondary",children:["The server will c
1opy exact revision ",S.revisionId,". No browser image data or storage URL is used."]})]}):(0,t.jsxs)(o.Z,{component:"button",type:"button",disabled:A,"aria-label":R?"Selected replacement file: ".concat(R.name,". Choose a different file."):"Select replacement file",sx:{width:"100%",border:"2px dashed var(--lv-border-default)",borderRadius:2,p:3,textAlign:"center",cursor:"pointer",color:"inherit",bgcolor:"transparent",font:"inherit","&:hover":{borderColor:"var(--lv-brand)",bgcolor:"var(--lv-bg-hover)"},"&:focus-visible":{outline:"3px solid var(--lv-focus-ring, var(--lv-brand))",outlineOffset:2},"&:disabled":{cursor:"not-allowed",opacity:.6}},onClick:()=>{var e;return null===(e=U.current)||void 0===e?void 0:e.click()},children:[(0,t.jsx)(s.Z,{size:32,color:"var(--lv-text-tertiary)"}),(0,t.jsx)(a.Z,{variant:"body2",color:"text.secondary",sx:{mt:1},children:R?R.name:"Click to select replacement file"}),(0,t.jsx)("input",{ref:U,type:"file",hidden:!0,"aria-hidden":"true",tabIndex:-1,onChange:e=>{var n;D((null===(n=e.target.files)||void 0===n?void 0:n[0])||null),Z(""),F(null),M.current=null}})]})]})]})}},38960:function(e,n,l){var t=l(57437),i=l(2265),r=l(2069),o=l(46387),a=l(9871),s=l(17689),d=l(93634),u=l(24132),c=l(54755);let v="undefined"!=typeof navigator&&/Mac/i.test(navigator.userAgent)?"⌘V":"Ctrl+V",f=(0,i.forwardRef)(function(e,n){let{onFiles:l,onFolderDrop:f,enableFolderUpload:p=!1,showPasteHint:g=!1,isUploading:h=!1,uploadingText:m="Uploading…",title:b="Upload from computer",subtitle:x="Click or drag & drop files here",accept:y,multiple:w=!0,disabled:k=!1,sx:C={}}=e,[j,E]=(0,i.useState)(!1),S=(0,i.useRef)(null),I=(0,i.useRef)(null),R=h||k;(0,i.useImperativeHandle)(n,()=>({openFilePicker:()=>{var e;R||null===(e=S.current)||void 0===e||e.click()}}),[R]);let D=async e=>{var n;if(e.preventDefault(),E(!1),!R){if(p&&f&&(0,c.aF)(e.dataTransfer)){let n=await (0,c.Im)(e.dataTransfer);f((0,c.yD)(n));return}(null===(n=e.dataTransfer.files)||void 0===n?void 0:n.length)&&l(e.dataTransfer.files)}},A=()=>{var e;R||null===(e=S.current)||void 0===e||e.click()},L=e=>{var n;e.stopPropagation(),R||null===(n=I.current)||void 0===n||n.click()};return(0,t.jsxs)(r.Z,{onDragOver:e=>{e.preventDefault(),R||E(!0)},onDragLeave:e=>{e.preventDefault(),E(!1)},onDrop:D,onClick:e=>{e.target===e.currentTarget&&A()},sx:{border:j?"1.5px dashed var(--lv-focus-ring)":"1.5px dashed var(--lv-border-default)",borderRadius:"16px",bgcolor:j?"var(--lv-selected-light)":"var(--lv-bg-elevated)",display:"flex",alignItems:"center",gap:1.5,px:2,py:1.5,cursor:R?"default":"pointer",transition:"border-color 150ms, background-color 150ms","&:hover":R?{}:{borderColor:"var(--lv-focus-ring)",bgcolor:"var(--lv-selected-light)"},"@media (prefers-reduced-motion: reduce)":{transition:"none"},...C},children:[(0,t.jsx)(r.Z,{role:"button",tabIndex:R?-1:0,"aria-disabled":R||void 0,"aria-label":b,onClick:A,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),A())},sx:{minWidth:0,flex:1,display:"flex",alignItems:"center",gap:1.5,borderRadius:"8px","&:focus-visible":{outline:"2px solid var(--lv-focus-ring)",outlineOffset:"2px"}},children:h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.D8,{size:16,sx:{color:"var(--lv-focus-ring)",flexShrink:0}}),(0,t.jsx)(o.Z,{sx:{fontSize:13,color:"var(--lv-text-secondary)"},children:m})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.Z,{size:16,style:{flexShrink:0,color:"var(--lv-text-secondary)"}}),(0,t.jsxs)(r.Z,{sx:{flex:1},children:[(0,t.jsx)(o.Z,{sx:{fontSize:13,color:"var(--lv-text-primary)",lineHeight:1.3},children:b}),(0,t.jsx)(o.Z,{sx:{fontSize:11,color:"var(--lv-text-secondary)",lineHeight:1.3},children:x})]}),g&&(0,t.jsxs)(r.Z,{sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,borderRadius:"8px",flexShrink:0,cursor:"default"},onClick:e=>e.stopPropagation(),children:[(0,t.jsx)(d.Z,{size:14,style:{color:"var(--lv-text-secondary)"}}),(0,t.jsx)(o.Z,{sx:{fontSize:11,color:"var(--lv-text-secondary)",whiteSpace:"nowrap"},children:"Paste"}),(0,t.jsx)(r.Z,{component:"kbd",sx:{fontSize:10,fontFamily:"inherit",fontWeight:500,color:"var(--lv-text-secondary)",bgcolor:"var(--lv-bg-card)",border:"1px solid var(--lv-border-default)",borderRadius:"4px",px:.5,py:0,lineHeight:1.4},children:v})]})]})}),!h&&p&&(0,t.jsxs)(r.Z,{onClick:L,onKeyDown:e=>
1{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),L(e))},role:"button",tabIndex:R?-1:0,"aria-disabled":R||void 0,"aria-label":"Upload folder",sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,borderRadius:"8px",cursor:"pointer",flexShrink:0,"&:hover":{bgcolor:"var(--lv-bg-card)"},"&:focus-visible":{outline:"2px solid var(--lv-focus-ring)",outlineOffset:"2px"}},children:[(0,t.jsx)(u.Z,{size:14,style:{color:"var(--lv-text-secondary)"}}),(0,t.jsx)(o.Z,{sx:{fontSize:11,color:"var(--lv-text-secondary)",whiteSpace:"nowrap"},children:"Upload folder"})]}),(0,t.jsx)("input",{ref:S,type:"file",accept:y,multiple:w,hidden:!0,onChange:e=>{var n;(null===(n=e.target.files)||void 0===n?void 0:n.length)&&(l(e.target.files),e.target.value="")}}),p&&(0,t.jsx)("input",{ref:I,type:"file",webkitdirectory:"",hidden:!0,onChange:e=>{var n;if(!(null===(n=e.target.files)||void 0===n?void 0:n.length)||!f)return;let l=(0,c.jV)(e.target.files);f((0,c.yD)(l)),e.target.value=""}})]})});n.Z=f},65191:function(e,n,l){l.d(n,{ED:function(){return a},Hm:function(){return d},KI:function(){return o},LB:function(){return s},Xw:function(){return r}});var t=l(57437),i=l(42934);let r=360,o=400,a=Object.freeze({minWidth:360,maxWidth:400});function s(e,n){let{disabled:l=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.Xj.map(r=>{let o=(0,i.r)(r),a=o.icon,s=(0,i.EE)(e,r);return{key:r,label:o.label,description:o.description,descriptionLines:2,icon:(0,t.jsx)(a,{size:14}),role:"menuitemradio",checked:s,active:s,disabled:s||l,onClick:s?void 0:()=>{Promise.resolve(n(e,r)).catch(()=>{})}}})}function d(e){let{disabled:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i.Xj.map(l=>{let r=(0,i.r)(l),o=r.icon;return{key:l,label:r.label,description:r.description,descriptionLines:2,icon:(0,t.jsx)(o,{size:14}),role:"menuitemradio",checked:!1,disabled:n,onClick:()=>{Promise.resolve(e(l)).catch(()=>{})}}})}},80188:function(e,n,l){l.d(n,{a:function(){return F}});var t=l(57437),i=l(2265),r=l(30166),o=l(68575),a=l(7261),s=l(42208),d=l(33954),u=l(62883),c=l(28124),v=l(31349),f=l(70094),p=l(92735),g=l(82431),h=l(45675),m=l(18930),b=l(1974),x=l(65740),y=l(80863),w=l(3397),k=l(42934),C=l(65191),j=l(37914),E=l(65370),S=l(73540),I=l(95846);let R=(0,r.default)(()=>Promise.all([l.e(2713),l.e(7571),l.e(2147),l.e(8215),l.e(6280),l.e(2615),l.e(5466),l.e(985)]).then(l.bind(l,66706)),{loadableGenerated:{webpack:()=>[66706]},ssr:!1}),D=(0,r.default)(()=>Promise.all([l.e(2833),l.e(6691),l.e(8352),l.e(3407),l.e(6941),l.e(8361),l.e(6171),l.e(3415)]).then(l.bind(l,40382)),{loadableGenerated:{webpack:()=>[40382]},ssr:!1}),A=(0,r.default)(()=>Promise.all([l.e(1953),l.e(7571),l.e(9414),l.e(372),l.e(6204)]).then(l.bind(l,95089)),{loadableGenerated:{webpack:()=>[95089]},ssr:!1}),L=(0,r.default)(()=>Promise.all([l.e(2833),l.e(6691),l.e(3662),l.e(8352),l.e(734),l.e(3407),l.e(6941),l.e(8361),l.e(204),l.e(8538)]).then(l.bind(l,20204)),{loadableGenerated:{webpack:()=>[20204]},ssr:!1}),N=(0,r.default)(()=>Promise.all([l.e(1953),l.e(1041),l.e(3407),l.e(4085),l.e(6569),l.e(405),l.e(5607),l.e(9784),l.e(8786)]).then(l.bind(l,33329)),{loadableGenerated:{webpack:()=>[33329]},ssr:!1}),P=["viewDetails","editDesign","unifiedEdit","editLayers","defineRegion","generateMockups","changeRole","download","replace","rename","delete"],T={card:P,table:P,detail:["unifiedEdit","editLayers","defineRegion","generateMockups"]},Z={card:new Set(["unifiedEdit","editLayers","defineRegion","generateMockups"]),table:new Set(["unifiedEdit","editLayers","defineRegion","generateMockups"]),detail:new Set(["unifiedEdit","editLayers"])},_={viewDetails:"view",editDesign:"tools",unifiedEdit:"tools",editLayers:"tools",defineRegion:"tools",generateMockups:"tools",changeRole:"transform",download:"file",replace:"file",rename:"file",delete:"danger"};function F(e){let{context:n,isEtsyImageContext:l=!1,onViewDetails:r,onRename:P,onReplace:F,onDelete:O,onClose:U,onOpenMockupTray:M,onCategoryChanged:G,onRegionSaved:B}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},W=(0,o.I0)(),K=(0,o.v9)(e=>{var n,l;return(null===(l=e.user.myInfo)||void 0===l?void 0:null===(n=l.subscription)||void 0===n?void 0:n.plan)==="plus"}),[H,V]=(0,i.useState)(!1),[Y,X]=(0,i.useState)(!1),[q,Q]=(0,i.useState)(!1),[J,$]=(0,i.useState)(!1),[ee,en]=(0,i.useState)(null),[el,et]=(0,i.useState)(!1),{offered:ei,locked:er}=(0,S.Z)(),eo=(0,o.v9)(e=>{var n;return null===(n=e.assetLibrary)||void 0===n?void 0:n.filters}),ea=(0,I.c)("unifiedAssetEditor")&&!l,[es,ed]=(0,i.useState)(!1),[eu,ec]=(0,i.useState)(!1),{changeRole:ev,changing:ef}=(0,j.ZP)(),ep=T[n]||[],eg=Z[n]||new Set,eh=ep.includes("delete")&&!O,{requestDelete:em,dialogProps:eb}=(0,x.Y)();return{actions:(0,i.useMemo)(()=>{var n,i;if(!e)return[];let o=e.mimeType||"",b=e.assetCategory||"",x=o.startsWith("image/"),j=b===k.Xg.MOCKUP_TEMPLATES,S="ready"===e.uploadStatus,I=(0,E.F6)(e),R=e=>"editDesign"===e?er:eg.has(e)&&!K,D={viewDetails:{key:"viewDetails",label:"View Details",icon:(0,t.jsx)(s.Z,{size:14}),onClick:()=>null==r?void 0:r(e),show:!!r},changeRole:{key:"changeRole",label:"Change role",icon:(0,t.jsx)(d.Z,{size:14}),children:(0,C.LB)(e,(e,n)=>ev(e,n,{isEtsyImageContext:l}).then(e=>(null==G||G((0,k.i7)(n),e),e)),{disabled:ef}),submenuProps:C.ED,loading:ef,show:(0,k.sF)(e,{isEtsyImageContext:l})},editDesign:{key:"editDesign",label:"Edit design",icon:(0,t.jsx)(u.Z,{size:14}),onClick:()=>
1{if(R("editDesign")){V(!0);return}et(!0)},show:ei&&!l&&S&&x&&!(0,w.Bp)(e)&&"psd"!==String(null!==(n=null==e?void 0:e.fileExtension)&&void 0!==n?n:"").toLowerCase().replace(/^\./,"")&&"image/vnd.adobe.photoshop"!==String(null!==(i=null==e?void 0:e.mimeType)&&void 0!==i?i:"").toLowerCase()&&!j},unifiedEdit:{key:"unifiedEdit",label:"Edit layers & regions",icon:(0,t.jsx)(c.Z,{size:14}),onClick:e=>{if(R("unifiedEdit")){V(!0);return}en("string"==typeof(null==e?void 0:e.intent)?e.intent:null),$(!0)},show:ea&&!!(e.hasLayers||x||j)},editLayers:{key:"editLayers",label:"Edit Layers",icon:(0,t.jsx)(c.Z,{size:14}),onClick:()=>{if(R("editLayers")){V(!0);return}X(!0)},show:!ea&&!!(e.hasLayers||x)},defineRegion:{key:"defineRegion",label:I?"Edit Region":"Define Mockup Region",icon:(0,t.jsx)(v.Z,{size:14}),onClick:()=>{if(R("defineRegion")){V(!0);return}Q(!0)},show:!ea&&j&&S},generateMockups:{key:"generateMockups",label:"Generate Mockups",icon:(0,t.jsx)(f.Z,{size:14}),onClick:()=>{if(R("generateMockups")){V(!0);return}if(M){null==U||U(),M(e);return}ed(!0)},show:x&&!j},download:{key:"download",label:"Download",icon:(0,t.jsx)(p.Z,{size:14}),onClick:()=>{e.id&&(W((0,y.Zb)({fileId:e.id,url:e.s3Url,filename:e.sanitizedFilename||e.originalFilename||"download"})),a.Am.success("Download started."))},disabled:!e.id||!S,show:!l},replace:{key:"replace",label:"Replace",icon:(0,t.jsx)(g.Z,{size:14}),onClick:()=>null==F?void 0:F(e),disabled:!S,show:!l&&!!F},rename:{key:"rename",label:"Rename",icon:(0,t.jsx)(h.Z,{size:14}),onClick:()=>null==P?void 0:P(e),show:!l&&!!P},delete:{key:"delete",label:"Delete",icon:(0,t.jsx)(m.Z,{size:14}),onClick:()=>{if(O){O(e);return}ec(!0)},danger:!0,show:!l}};return ep.map(e=>D[e]).filter(e=>e&&e.show).map(e=>({key:e.key,label:e.label,icon:e.icon,onClick:e.onClick,...e.children?{children:e.children,submenuProps:e.submenuProps}:{},disabled:!!e.disabled,loading:!!e.loading,danger:!!e.danger,locked:R(e.key),group:_[e.key]||"other"}))},[e,ep,eg,K,l,ea,ei,er,ev,ef,W,r,P,F,O,U,M,G]),modals:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(R,{open:Y,onClose:()=>X(!1),file:e,isEtsyImage:l}),(0,t.jsx)(D,{open:q,onClose:()=>Q(!1),onSaved:B,file:e,prePopulatedRegion:null==e?void 0:e.mockupRegion}),(0,t.jsx)(L,{open:J,onClose:()=>{$(!1),en(null)},file:e,isEtsyImage:l,openIntent:ee}),el&&(0,t.jsx)(N,{open:!0,assetFile:e,onClose:()=>et(!1),onSaved:e=>{e&&W((0,y.cT)({...e,updatedAt:new Date().toISOString()})),W((0,y.uB)(eo))}}),!M&&(0,t.jsx)(A,{open:es,onClose:()=>ed(!1),designFile:e}),(0,t.jsx)(b.Z,{open:H,onClose:()=>V(!1),title:"Plus Plan Required",message:"The layer editor and mockup tools are available on the Plus plan. Upgrade to unlock these features.",confirmText:"Upgrade to Plus",onConfirm:()=>{V(!1),window.location.href="/dashboard/manage-subscription"}}),eh&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{file:e,open:eu,onClose:()=>ec(!1),onConfirmed:async()=>{ec(!1),await em(e)}}),(0,t.jsx)(x.Z,{...eb})]})]})}}function z(e){var n,l,i,r;let{file:o,open:a,onClose:s,onConfirmed:d}=e,u=(null==o?void 0:null===(n=o.linkedListings)||void 0===n?void 0:n.length)||0,c=(null==o?void 0:null===(l=o.collections)||void 0===l?void 0:l.length)||0,v=(null==o?void 0:null===(i=o.podProducts)||void 0===i?void 0:i.length)||0,f=(null==o?void 0:null===(r=o.openOrders)||void 0===r?void 0:r.length)||0,p=(null==o?void 0:o.sanitizedFilename)||(null==o?void 0:o.originalFilename)||"",g=['Delete "'.concat(p,'"?'),u>0?"This file is linked to ".concat(u," listing").concat(u>1?"s":"","."):"",c>0?"It will be removed from ".concat(c," collection").concat(c>1?"s":"","."):"",v>0?"It's used by ".concat(v," POD product").concat(v>1?"s":"","."):"",f>0?"It's referenced by ".concat(f," open order").concat(f>1?"s":"","."):"","This action cannot be undone."].filter(Boolean).join(" ");return(0,t.jsx)(b.Z,{open:a,onClose:s,onConfirm:d,title:"Delete File?",message:g,confirmText:"Delete",variant:"danger"})}},37914:function(e,n,l){l.d(n,{jY:function(){return c},ts:function(){return g}});var t=l(2265),i=l(68575),r=l(7261),o=l(98527),a=l(80863),s=l(65370),d=l(42934);let u="Couldn't change role. Try again.",c=Object.freeze({INVALID_ROLE:"invalid_role",MISSING_ID:"missing_id",NOT_CHANGEABLE:"not_changeable"});
1class v extends Error{constructor(e,n){super(e),this.name="RoleChangeRejectedError",this.reason=n}}let f=(e,n)=>String(e)===String(n),p=Object.freeze({removedFromList:!1,placed:!1});function g(){let e=(0,i.I0)(),n=(0,i.oR)(),l=(0,t.useRef)(0),[g,h]=(0,t.useState)(!1),m=(0,t.useCallback)(()=>{l.current+=1,h(!0)},[]),b=(0,t.useCallback)(()=>{l.current=Math.max(0,l.current-1),0===l.current&&h(!1)},[]),x=(0,t.useCallback)(l=>{var t;let i=(null===(t=n.getState())||void 0===t?void 0:t.assetLibrary)||{},r=i.filters||{},o=Array.isArray(i.files)?i.files:[],s=r.assetCategory||"";if(s===d.Xg.LISTING_IMAGES&&"user_marked"!==r.listingImagesSubTab||!o.some(e=>f(e.id,l.id)))return p;let u=l.assetCategory||"";return s&&s!==u?(e((0,a.az)(l.id)),{removedFromList:!0,placed:!1}):(e((0,a.cT)(l)),{removedFromList:!1,placed:!0})},[e,n]),y=(0,t.useCallback)(async function(n,l){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{silent:i=!1,openRegionEditor:f=!0,context:p}=t,g=!0===t.isEtsyImageContext||(null==p?void 0:p.isEtsyImageContext)===!0;if(!d.Xj.includes(l))throw new v('useChangeAssetRole: "'.concat(l,'" is not a changeable asset role.'),c.INVALID_ROLE);if(!(null==n?void 0:n.id))throw new v("useChangeAssetRole: changeRole needs a file with an id.",c.MISSING_ID);if(!(0,d.sF)(n,{isEtsyImageContext:g}))throw new v("useChangeAssetRole: this asset's role cannot be changed (link, Etsy-synced listing image, or not an asset_file row).",c.NOT_CHANGEABLE);if((0,d.EE)(n,l))return{row:n,removedFromList:!1,placed:!1,changed:!1};let h=(0,d.i7)(l);m();try{var y,w,k;let t=(null==(y=await (0,o.Dd)(n.id,{assetCategory:h}))?void 0:null===(w=y.data)||void 0===w?void 0:w.file)||(null==y?void 0:null===(k=y.data)||void 0===k?void 0:k.data)||(null==y?void 0:y.data)||null,u=t?(0,o.G_)({...n,...t}):{...n,assetCategory:h},{removedFromList:c,placed:v}=x(u);return!1!==f&&h===d.Xg.MOCKUP_TEMPLATES&&"ready"===u.uploadStatus&&String(u.mimeType||"").startsWith("image/")&&!(0,s.F6)(u)&&e((0,a.O1)({file:u,source:"role-change",requestedAt:Date.now()})),i||r.Am.success("Role changed to ".concat((0,d.r)(l).label,".")),{row:u,removedFromList:c,placed:v,changed:!0}}catch(e){throw i||r.Am.error(u),e}finally{b()}},[x,m,e,b]),w=(0,t.useCallback)(async(e,n,l)=>{let{row:t}=await y(e,n,l);return t},[y]),k=(0,t.useCallback)(async function(e,n){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=(Array.isArray(e)?e:[]).filter(Boolean);if(0===t.length)return{succeeded:[],failed:[],removedFromList:[]};let i=await Promise.allSettled(t.map(e=>y(e,n,{...l,silent:!0,openRegionEditor:!1}))),o=[],a=[],s=[];i.forEach((e,n)=>{if("fulfilled"===e.status)o.push(e.value.row),e.value.removedFromList&&s.push(t[n].id);else{var l;a.push({file:t[n],error:e.reason,reason:null===(l=e.reason)||void 0===l?void 0:l.reason})}});let{label:c}=(0,d.r)(n);return 0===a.length?r.Am.success("Role changed to ".concat(c," for ").concat(o.length," ").concat(1===o.length?"asset":"assets",".")):0===o.length?r.Am.error(u):r.Am.warn("Role changed to ".concat(c," for ").concat(o.length," of ").concat(t.length," assets — ").concat(a.length," failed.")),{succeeded:o,failed:a,removedFromList:s}},[y]);return{changeRole:w,changeRoleDetailed:y,changeRoleForFiles:k,changing:g}}n.ZP=g},73540:function(e,n,l){l.d(n,{Z:function(){return s}});var t=l(68575),i=l(22656),r=l(95846),o=l(93092),a=l(57692);function s(){let e=(0,r.y)("singleAssetEditor"),n=(0,o.Z)(),l=(0,t.v9)(e=>{var n,l;return null===(l=e.user)||void 0===l?void 0:null===(n=l.myInfo)||void 0===n?void 0:n.planTier}),{unavailable:s}=(0,i.zk)(),d=e&&n&&!s,u=!(0,a.XB)(l);return{available:d&&!u,offered:d,locked:u}}},22656:function(e,n,l){l.d(n,{Pf:function(){return f},Ui:function(){return i},X3:function(){return h},Z8:function(){return m},dd:function(){return d},k0:function(){return g},si:function(){return s},zk:function(){return p}});var t=l(2265);let i="library",r=Object.freeze({unavailable:!1,launching:!1}),o=r,a=new Set;function s(e){if(e.unavailable!==o.unavailable||e.launching!==o.launching)for(let n of(o=Object.freeze(e),[...a]))n()}function d(){return o}function u(e){return a.add(e),()=>{a.delete(e)}}let c=()=>o,v=()=>r;function f(){s({...o,unavailable:!0})}function p(){return(0,t.useSyncExternalStore)(u,c,v)}let g=Object.freeze({FEATURE_DISABLED:"feature_disabled",UPGRADE_REQUIRED:"upgrade_required",TOO_MANY_RUNNING_BATCHES:"too_many_running_batches",INVALID_INPUT:"invalid_input",NOT_FOUND:"not_found",UNKNOWN:"unknown"}),h=Object.freeze({[g.UPGRADE_REQUIRED]:"Prep Studio requires a Plus plan.",[g.TOO_MANY_RUNNING_BATCHES]:"You already have 2 batches running. Wait for one to finish, or cancel it.",[g.INVA
1LID_INPUT]:"The selected designs are invalid. Refresh the Library and try again.",[g.NOT_FOUND]:"Some selected files are unavailable. Refresh the Library and try again."});function m(e){var n,l,t,i,r,o,a;let s=null!==(r=null==e?void 0:null===(n=e.response)||void 0===n?void 0:n.status)&&void 0!==r?r:null,d=null!==(o=function(e){var n,l,t;let i=null==e?void 0:null===(l=e.response)||void 0===l?void 0:null===(n=l.data)||void 0===n?void 0:n.data;return null!==(t=null==i?void 0:i.code)&&void 0!==t?t:null==i?void 0:i.error}(e))&&void 0!==o?o:null,u=null!==(a=null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:null===(l=t.data)||void 0===l?void 0:l.details)&&void 0!==a?a:null,c=g.UNKNOWN;return 404===s&&"feature_disabled"===d?c=g.FEATURE_DISABLED:403===s&&"upgrade_required"===d?c=g.UPGRADE_REQUIRED:409===s&&"too_many_running_batches"===d?c=g.TOO_MANY_RUNNING_BATCHES:400===s&&"invalid_input"===d?c=g.INVALID_INPUT:404===s&&(c=g.NOT_FOUND),{refusal:c,code:d,status:s,details:u}}},91931:function(e,n,l){l.d(n,{R:function(){return c}});var t=l(57437),i=l(2265),r=l(7261),o=l(2069),a=l(46387),s=l(37930),d=l(66848),u=l(29266);function c(){let[e,n]=(0,i.useState)({open:!1,headline:"",resubscribeUrl:null}),l=(0,i.useCallback)(e=>{var l,t,i,o,a,s,d;let c=null==e?void 0:null===(l=e.response)||void 0===l?void 0:l.status,v=null!==(i=null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.data)&&void 0!==i?i:{},f=(null==v?void 0:v.error)==="retention_locked"||(null==v?void 0:v.code)==="RETENTION_LOCKED";if(403===c&&f){let e=null!==(o=null==v?void 0:v.retention)&&void 0!==o?o:{};n({open:!0,headline:function(e,n){switch(e){case u.Gw.LAPSE_WARNING:return"Action limited during your lapse warning";case u.Gw.GRACE:{let e=null!=n?n:0;return"Action limited during your grace period — ".concat(e," day").concat(1!==e?"s":""," remaining")}case u.Gw.FROZEN:return"Subscription frozen — resubscribe to continue";case u.Gw.COLD_ARCHIVE:return"Library in cold storage — resubscribe to thaw";
1case u.Gw.PURGE_ELIGIBLE:return"Library at risk of deletion — resubscribe immediately";default:return"Action blocked — check your subscription status"}}(null==e?void 0:e.state,null!==(a=null==e?void 0:e.daysRemainingInGrace)&&void 0!==a?a:null),resubscribeUrl:null!==(d=null!==(s=null==e?void 0:e.resubscribeUrl)&&void 0!==s?s:null==v?void 0:v.resubscribeUrl)&&void 0!==d?d:null});return}r.Am.error((null==v?void 0:v.message)||(null==e?void 0:e.message)||"Action not allowed.")},[]),c=(0,i.useCallback)(()=>{n(e=>({...e,open:!1}))},[]),v=(0,i.useCallback)(()=>{let n=e.resubscribeUrl;n&&window.open(n,"_blank","noopener,noreferrer"),c()},[e.resubscribeUrl,c]);return{handleError:l,modal:(0,t.jsx)(s.Z,{open:e.open,onClose:c,size:"sm",fullWidth:!0,title:e.headline,actions:(0,t.jsxs)(o.Z,{sx:{display:"flex",gap:1,justifyContent:"flex-end",width:"100%"},children:[(0,t.jsx)(d.f,{text:"Cancel",color:"white",width:"auto",padding:"px-3 py-1.5",textSize:"text-sm",noShadow:!0,onClick:c}),(0,t.jsx)(d.f,{text:"Resubscribe",color:"purple",width:"auto",padding:"px-3 py-1.5",textSize:"text-sm",noShadow:!0,disabled:!e.resubscribeUrl,onClick:v})]}),children:(0,t.jsx)(a.Z,{variant:"body2",sx:{color:"var(--lv-text-secondary)",fontSize:"13px"},children:"Your current plan limits this action. Resubscribe to restore full access to your library."})})}}},93092:function(e,n,l){l.d(n,{Z:function(){return i}});var t=l(95846);function i(){return(0,t.y)("workbench")}},72160:function(e,n,l){l.d(n,{q:function(){return t}});function t(){var e,n;if("function"==typeof(null===(e=globalThis.crypto)||void 0===e?void 0:e.randomUUID))return globalThis.crypto.randomUUID();let l=new Uint8Array(16);if("function"==typeof(null===(n=globalThis.crypto)||void 0===n?void 0:n.getRandomValues))globalThis.crypto.getRandomValues(l);else for(let e=0;e<l.length;e+=1)l[e]=Math.floor(256*Math.random());l[6]=15&l[6]|64,l[8]=63&l[8]|128;let t=[...l].map(e=>e.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10).join("")].join("-")}},69036:function(e,n,l){l.d(n,{Q:function(){return t}});function t(){let e=new Map,n=(n,l)=>{let t=String(n),i=(e.get(t)||Promise.resolve()).then(l,l),r=i.then(()=>{},()=>{});return e.set(t,r),r.then(()=>{e.get(t)===r&&e.delete(t)}),i};return n.size=()=>e.size,n}}}]);

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.