PageSourceSearch

https://www.artcore.com/_next/static/chunks/pages/edit/merch-ee86730c15c49249.js

js artcore.com collected 2026-09-24 11:55:28 UTC 46,323 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4008],{19153:(e,s,i)=>{"use strict";i.d(s,{A:()=>l});var t=i(60699),r=i(37876);let l=(0,t.A)((0,r.jsx)("path",{d:"M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v2c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2m4 0v12h4V3z"}),"ThumbDown")},29308:(e,s,i)=>{"use strict";i.d(s,{O:()=>r});var t=i(35768);function r(e,s,i,r,l){let n=(0,t.tt)(s),a=(0,t.jT)(n);return a?(r(e,{type:"manual",message:a}),!1):(l(e),i(e,n.tags,{shouldDirty:!0}),!0)}},30079:(e,s,i)=>{"use strict";i.d(s,{A:()=>x,N:()=>p});var t=i(37876),r=i(14232),l=i(74904),n=i(27910),a=i(17471),c=i(75656),o=i(80214),d=i(61875),h=i(29308),m=i(35768);let u=`Type and press enter, or paste a list (max ${m.r4} tags, ${m.Ti} chars each)`;function x({value:e=[],onChange:s}){let{data:i,error:o}=(0,c.Ay)("/api/tags/common",e=>fetch(e).then(e=>e.json())),d=i?i.tags:[],[h,m]=(0,r.useState)("");return(0,t.jsx)(a.A,{sx:{},children:(0,t.jsx)(l.A,{multiple:!0,freeSolo:!0,autoSelect:!0,options:d,defaultValue:[d[0]],getOptionLabel:e=>e,value:e,inputValue:h,onChange:s,renderTags:()=>null,classes:{option:"text-xs"},renderInput:e=>(0,t.jsx)(n.A,{...e,placeholder:u}),onInputChange:(i,t)=>{if((t=t.trimStart()).includes(" ")||t.includes(",")){let r=t.split(/[\s,]+/).filter(e=>e.length);if(r?.length){s(i,e.concat(r)),m("");return}}t.endsWith(",")&&(i.target.blur(),i.target.focus()),m(t)}})})}function p({watchFields:e,field:s,setValue:i,setError:r,clearErrors:l,errors:n}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x,{value:e[s]||[],onChange:(e,t)=>
1{r&&l?(0,h.O)(s,t,i,r,e=>l(e)):i(s,t)}}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"my-2 flex flex-wrap overflow-scroll gap-x-1",children:e[s]?.map(r=>(0,t.jsx)(o.A,{sx:{my:"2px",borderRadius:10,color:"#fff",fontSize:"11px",height:"20px",backgroundColor:(0,m.T3)(r)?"#b91c1c":void 0},size:"small",style:{filter:"drop-shadow(2px 2px 2px rgb(0 0 0 / 0.3)"},label:r,onDelete:t=>{let n,a;a=(n=e[s]?[...e[s]]:[]).findIndex(e=>e==r),n.splice(a,1),i(s,n),l?.(s)}},r))}),(0,t.jsx)(d.Kw,{errors:n,field:s})]})]})}},34333:(e,s,i)=>{"use strict";i.d(s,{A:()=>c});var t=i(14232),r=i(91535),l=i(75656),n=i(2646);let a=n.r?e=>{e()}:t.startTransition,c=(0,r.Ht)(l.Ay,()=>(e,s,i={})=>{let{mutate:l}=(0,r.iX)(),c=(0,t.useRef)(e),o=(0,t.useRef)(s),d=(0,t.useRef)(i),h=(0,t.useRef)(0),[m,u,x]=(e=>{let[,s]=(0,t.useState)({}),i=(0,t.useRef)(!1),r=(0,t.useRef)(e),l=(0,t.useRef)({data:!1,error:!1,isValidating:!1}),a=(0,t.useCallback)(e=>{let t=!1,n=r.current;for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&n[s]!==e[s]&&(n[s]=e[s],l.current[s]&&(t=!0));t&&!i.current&&s({})},[]);return(0,n.u)(()=>(i.current=!1,()=>{i.current=!0})),[r,l.current,a]})({data:n.U,error:n.U,isMutating:!1}),p=m.current,g=(0,t.useCallback)(async(e,s)=>{let[i,t]=(0,n.s)(c.current);if(!o.current)throw Error("Can’t trigger the mutation: missing fetcher.");if(!i)throw Error("Can’t trigger the mutation: missing key.");let r=(0,n.m)((0,n.m)({populateCache:!1,throwOnError:!0},d.current),s),m=(0,n.o)();h.current=m,x({isMutating:!0});try{let s=await l(i,o.current(t,{arg:e}),(0,n.m)(r,{throwOnError:!0}));return h.current<=m&&(a(()=>x({data:s,isMutating:!1,error:void 0})),null==r.onSuccess||r.onSuccess.call(r,s,i,r)),s}catch(e){if(h.current<=m&&(a(()=>x({error:e,isMutating:!1})),null==r.onError||r.onError.call(r,e,i,r),r.throwOnError))throw e}},[]),f=(0,t.useCallback)(()=>{h.current=(0,n.o)(),x({data:n.U,error:n.U,isMutating:!1})},[]);return(0,n.u)(()=>{c.current=e,o.current=s,d.current=i}),{trigger:g,reset:f,get data(){return u.data=!0,p.data},get error(){return u.error=!0,p.error},get isMutating(){return u.isMutating=!0,p.isMutating}}})},42736:(e,s,i)=>{"use strict";i.d(s,{A:()=>l});var t=i(60699),r=i(37876);let l=(0,t.A)((0,r.jsx)("path",{d:"M1 21h4V9H1zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73z"}),"ThumbUp")},49481:(e,s,i)=>{"use strict";i.d(s,{A:()=>l});var t=i(60699),r=i(37876);let l=(0,t.A)((0,r.jsx)("path",{d:"M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4zM17 14H7c-.55 0-1-.45-1-1s.45-1 1-1h10c.55 0 1 .45 1 1s-.45 1-1 1m0-3H7c-.55 0-1-.45-1-1s.45-1 1-1h10c.55 0 1 .45 1 1s-.45 1-1 1m0-3H7c-.55 0-1-.45-1-1s.45-1 1-1h10c.55 0 1 .45 1 1s-.45 1-1 1"}),"CommentRounded")},53948:(e,s,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/edit/merch",function(){return i(89780)}])},64885:(e,s,i)=>{"use strict";i.d(s,{u:()=>n});var t=i(16413),r=i(88992),l=function(e,s){for(var i={};e.length;){var t=e[0],l=t.code,n=t.message,a=t.path.join(".");if(!i[a])if("unionErrors"in t){var c=t.unionErrors[0].errors[0];i[a]={message:c.message,type:c.code}}else i[a]={message:n,type:l};if("unionErrors"in t&&t.unionErrors.forEach(function(s){return s.errors.forEach(function(s){return e.push(s)})}),s){var o=i[a].types,d=o&&o[t.code];i[a]=(0,r.Gb)(a,s,i,l,d?[].concat(d,t.message):t.message)}e.shift()}return i},n=function(e,s,i){return void 0===i&&(i={}),function(r,n,a){try{return Promise.resolve(function(l){try{var n=Promise.resolve(e["sync"===i.mode?"parse":"parseAsync"](r,s)).then(function(e){return a.shouldUseNativeValidation&&(0,t.w)({},a),{errors:{},values:i.raw?r:e}})}catch(e){return l(e)}return n&&n.then?n.then(void 0,l):n}(function(e){if(Array.isArray(null==e?void 0:e.errors))return{values:{},errors:(0,t.H)(l(e.errors,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)};throw e}))}catch(e){return Promise.reject(e)}}}},70251:(e,s,i)=>{"use strict";i.d(s,{V:()=>l});var t=i(37876),r=i(14232);function l({onChange:e,value:s,defaultIndex:i=0,options:n=[{name:"yes",value:!0,help:(0,t.jsx)("span",{})},{name:"no",value:!1,help:(0,t.jsx)("span",{})}]}){let a=n.find(e=>e.value===s);a||(a=n[i]);
1let c=a?.name,[o,d]=r.useState(c);return(0,t.jsx)(t.Fragment,{children:n.map(s=>{let i=s.name===o;return(0,t.jsxs)("label",{className:`flex flex-col rounded cursor-pointer ${i?"bg-neutral-800":"bg-neutral-900 text-neutral-500"}`,children:[(0,t.jsxs)("div",{className:"flex-grow",children:[(0,t.jsx)("div",{children:s.name}),(0,t.jsx)("div",{className:"text-xs text-neutral-400 ",children:s.help})]}),(0,t.jsx)("div",{className:"text-right",children:(0,t.jsx)("input",{className:"ml-2",onChange:s=>{d(s.target.value),e(s.target.value===n.find(e=>e.value)?.name)},type:"radio",name:"answer",value:s.name,checked:s.name===o})})]},s.name)})})}},74413:(e,s,i)=>{"use strict";i.d(s,{A:()=>m});var t=i(37876),r=i(48230),l=i.n(r),n=i(4186),a=i(48516);i(14232);var c=i(89099),o=i(19512),d=i(29573),h=i(55737);function m({seller:e,className:s="",children:i,showSellerSelection:r=!1,seedSellerFromProp:u=!1,mobileManageHeader:x=!1,...p}){let g=(0,c.useRouter)(),{selectedSellerId:f,setSelectedSellerId:j,sellerIsSet:v}=(0,h.n)(u&&e?{fallbackSeller:e}:void 0),_=async(e,s)=>{if(s){let e=s.value,i=s.seller_type,t=g.pathname.replace(/(label|artist)/,i),r={...g.query,sellerId:e},l=Object.keys(r).map(e=>`${e}=${r[e]}`).join("&");t=`${t}?${l}`,g.push(t)}},y=(0,d.QP)(x?"mt-2 flex flex-col gap-2 px-1 poppins md:mt-4 md:flex-row md:gap-y-2 md:bg-brandgrey/20 md:rounded-md md:p-2":"mt-4 flex-col flex md:flex-row bg-brandgrey/20 p-2 rounded-md gap-y-2 poppins",s),w=r&&g.isReady?(0,t.jsx)(a.A,{renderSelected:void 0,sellerId:e?.id,onChange:_}):r?(0,t.jsx)("div",{children:"Loading"}):null;return x?(0,t.jsxs)("div",{className:y,children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 md:hidden",children:[(0,t.jsx)(l(),{href:"/seller",className:"shrink-0 text-xs text-neutral-400 hover:text-neutral-200",children:"Manage Profiles"}),(0,t.jsx)(n.xVu,{className:"shrink-0 text-base text-neutral-600"}),(0,t.jsx)("div",{className:"min-w-0 truncate text-sm font-semibold text-mainheading",children:e?.name})]}),(0,t.jsxs)("div",{className:"hidden md:flex flex-grow items-center gap-1 text-sm",children:[(0,t.jsx)(l(),{href:"/seller",children:(0,t.jsx)(o.A,{size:"small",variant:"contained",component:"label",children:"Manage Profiles"})}),(0,t.jsx)(n.xVu,{className:"shrink-0 text-xl text-neutral-500"}),i?(0,t.jsxs)(t.Fragment,{children:[e?(0,t.jsx)(l(),{href:`/manage?sellerId=${e?.id}`,className:"leading-none",children:e?.name}):(0,t.jsx)("span",{className:"leading-none",children:"Manage"}),(0,t.jsx)(n.xVu,{className:"shrink-0 text-xl text-neutral-500"}),i]}):(0,t.jsx)("span",{className:"leading-none",children:e?.name})]}),(0,t.jsx)("div",{className:"hidden md:block min-w-[300px]",children:w})]}):(0,t.jsxs)("div",{className:y,children:[(0,t.jsxs)("div",{className:"flex flex-grow items-center gap-1 text-sm",children:[(0,t.jsx)(l(),{href:"/seller",children:(0,t.jsx)(o.A,{size:"small",variant:"contained",component:"label",children:"Manage Profiles"})}),(0,t.jsx)(n.xVu,{className:"shrink-0 text-xl text-neutral-500"}),i?(0,t.jsxs)(t.Fragment,{children:[e?(0,t.jsx)(l(),{href:`/manage?sellerId=${e?.id}`,className:"leading-none",children:e?.name}):(0,t.jsx)("span",{className:"leading-none",children:"Manage"}),(0,t.jsx)(n.xVu,{className:"shrink-0 text-xl text-neutral-500"}),i]}):(0,t.jsx)("span",{className:"leading-none",children:e?.name})]}),(0,t.jsx)("div",{className:"min-w-[300px] md:min-w-[300px]",children:w})]})}},86777:(e,s,i)=>{"use strict";var t=i(29563);s.A=void 0,function(e){if((!e||!e.__esModule)&&null!==e&&("object"==typeof e||"function"==typeof e)){var s=n(void 0);if(s&&s.has(e))return s.get(e);var i={__proto__:null},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var l=t?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(i,r,l):i[r]=e[r]}i.default=e,s&&s.set(e,i)}}(i(14232));var r=t(i(78652)),l=i(37876);function n(e){if("function"!=typeof WeakMap)return null;var s=new WeakMap,i=new WeakMap;return(n=function(e){return e?i:s})(e)}s.A=(0,r.default)((0,l.jsx)("path",{d:"M7.8 2h8.4C19.4 2 22 4.6 22 7.8v8.4a5.8 5.8 0 0 1-5.8 5.8H7.8C4.6 22 2 19.4 2 16.2V7.8A5.8 5.8 0 0 1 7.8 2m-.2 2A3.6 3.6 0 0 0 4 7.6v8.8C4 18.39 5.61 20 7.6 20h8.8a3.6 3.6 0 0 0 3.6-3.6V7.6C20 5.61 18.39 4 16.4 4H7.6m9.65 1.5a1.25 1.25 0 0 1 1.25 1.25A1.25 1.25 0 0 1 17.25 8 1.25 1.25 0 0 1 16 6.75a1.25 1.25 0 0 1 1.25-1.25M12 7a5 5 0 0 1 5 5 5 5 0 0 1-5 5 5 5 0 0 1-5-5 5 5 0 0 1 5-5m0 2a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3z"}),"Instagram")},88707:(e,s,i)=>{"use strict";i.d(s,{E:()=>n});var t=i(37876),r=i(14232),l=i(33115);function n({children:e,name:s="debug"}){let[i,a]=r.useState(!1);return(0,l.B)()?(0,t.jsxs)("div",{className:"mt-8 text-xxs",children:[(0,t.jsx)("a",{className:"cursor-pointer",onClick:()=>a(!i),children:s}),i?e:""]}):(0,t.jsx)(t.Fragment,{})}},88806:(e,s,i)=>{"use strict";i.d(s,{k:()=>n});var t=i(37876),r=i(26746),l=i(55006);function n({message:e}={}
1){return(0,t.jsx)(r.A,{sx:{color:"#fff",zIndex:e=>e.zIndex.drawer+1},open:!0,children:e?(0,t.jsxs)("div",{className:"p-10 bg-neutral-800 text-neutral-200 rounded text-center ",children:[(0,t.jsx)("span",{className:"",children:(0,t.jsx)(l.A,{})}),(0,t.jsx)("div",{className:"font-light",children:e})]}):(0,t.jsx)("div",{children:(0,t.jsx)(l.A,{size:50})})})}i(14232)},89780:(e,s,i)=>{"use strict";i.r(s),i.d(s,{ArtcorePlus:()=>K,ShippingOption:()=>J,default:()=>X});var t=i(37876),r=i(14232),l=i(95364),n=i(77328),a=i.n(n),c=i(88992),o=i(89099),d=i(60577),h=i(61875),m=i(30738),u=i(92306),x=i(75426),p=i(74413),g=i(4186),f=i(72702),j=i(5904),v=i(66492),_=i(98250),y=i(27910),w=i(55006),N=i(19512);i(70251);var b=i(74904);function A({options:e,value:s,addRelease:i,defaultText:r="Select Release"}){return(0,t.jsx)(t.Fragment,{children:e?.length?(0,t.jsx)(b.A,{options:e,getOptionLabel:e=>`${e.title}`,value:s||null,onChange:(e,s)=>{console.log("Setting",s),i(s)},isOptionEqualToValue:(e,s)=>e.id==s.id,renderInput:e=>(0,t.jsx)(y.A,{...e,placeholder:r})}):""})}var k=i(71134),S=i(45880),$=i(29573),C=i(32381),O=i(64885),E=i(1353),I=i(34333),F=i(57186),P=i(91394),M=i(80381),z=i(11613),V=i(88806),T=i(88707),U=i(26793),q=i(75656);function D(e,s){let i=`/api/edit/shipping/edit?seller_id=${e}&schema_id=${s||""}`;return(0,q.Ay)(i,(0,u.we)())}var R=i(78992),W=i(30079),L=i(86468),H=i(75209),G=i(33115);function K(){return(0,t.jsxs)("span",{className:"relative -top-3 text-brand font-bold italic text-xxs ",children:["PLUS ",(0,t.jsx)(g.MJW,{className:"inline"})]})}function X(e){let s=(0,o.useRouter)(),i=s.query.id?parseInt(""+s.query.id):void 0,l=s.query.sellerId?(0,f.cH)(s.query.sellerId):(0,f.cH)(e.selectedSellerId),n=s.isReady&&(i||l)?`/api/edit/merch/edit?merchId=${i||""}&sellerId=${l||""}`:void 0,[a,c]=(0,r.useState)();(0,r.useEffect)(()=>{n&&fetch(n).then(async e=>{if(e.status>=400)return s.push("/seller");c(await e.json())})},[n]);let d=JSON.stringify(a)||i||"new";return(0,t.jsx)(t.Fragment,{children:a?(0,r.createElement)(B,{sellerId:a?.seller?.id,editData:a,...e,key:d,merchId:i}):(0,t.jsx)(V.k,{})})}function B({editData:e,sellerId:s,merchId:i,...n}){let{config:x}=(0,d.r)(),f=(0,o.useRouter)(),{data:b,trigger:$}=(0,I.A)(`/api/edit/merch/save?sellerId=${s}`,u.w$),[P,M]=(0,r.useState)(!1),[U,q]=(0,r.useState)(!1),[D,L]=(0,r.useState)(!1),[X,J]=(0,r.useState)(!1),[Y,Q]=(0,r.useState)(!1),es=e?.seller,ei=e?.merchTypes,et=e?.merch,{data:er,trigger:el}=(0,I.A)("/api/edit/merch/reduce_visibility",u.w$);async function en(){if(window.confirm("Are you sure you want to reduceVisibility for this merch?")){let e=await el({merchId:i});console.log("response",e);let s=await e.text();e.ok?(console.log("response body ",s),alert(`Ok ${e.status}: ${s}`)):alert(`Failed ${e.status}: ${s}`)}}function ea(s){return e.releases.find(e=>e.id==s)}let ec=et?.release_id?ea(et.release_id):void 0,[eo,ed]=(0,r.useState)(ec),eh={id:void 0,uuid:(0,F.A)(),status:"draft",merch_type_id:void 0,seller_id:s,images:[],release:void 0,release_id:void 0,splits_from_release:!1,title:"",description:"",regular_price:void 0,quantity:void 0,options:[{name:"",values:[""]}],merch_options:[],dynamic_check:!0},em=(0,c.mN)({resolver:(0,O.u)(E.k5),defaultValues:(0,r.useMemo)(()=>et?{...eh,...et}:eh,[et,eh])}),{register:eu,handleSubmit:ex,watch:ep,reset:eg,setValue:ef,formState:ej,control:ev,setError:e_,clearErrors:ey}
1=em,{errors:ew}=ej,eN=ep(),eb=eN.ship_from_country?[eN.ship_from_country]:[es.default_ship_country];function eA(e){return ei?.find(s=>s.id==e)}let ek=eA(eN.merch_type_id);function eS(){var e;console.log("RESET",e=et),e?eg(eh):eg()}function e$(e){let s=eA(e)?.category;return s?.toLowerCase()=="music"}async function eC(e){try{console.log("Passed Validation",e);let i=await $({data:e}),t=await i.text();if(i.status>=400){let e=t;try{e=JSON.parse(t).error}catch(e){console.log("Failed to parse data",t)}(0,z.UG)(`Error saving release: ${e}`),console.log("done: ",e)}else(0,z.VX)(`Saved ${e.title}`),console.log("DONE",i),f.push(`/manage?tab=${H.MERCH_TAB}&sellerId=`+s)}catch(e){throw console.log("Failed to save",e.message),(0,z.UG)("Failed to save: server error"),e}}async function eO(e){console.log("FormData",e),console.log("WatchFields",eN),console.log("FAILING valid:",ej.isValid,"errors:",ej.errors),(0,z.UG)("Please complete required fields: "+Object.keys(ew))}async function eE(){if(console.log("Archive function."),window.confirm("Are you sure you want to archive this merch? It will no longer be visible on the site.")){Q(!0);try{let e=await fetch("/api/edit/merch/archive",{headers:{"Content-Type":"application/json"},method:"PUT",body:JSON.stringify({merchId:i})}),t=e.status,r=await e.text();console.log("STATUS",t),console.log("TEXT",r),t>=400?(Q(!1),(0,z.UG)("Failed to archive "+r)):(f.push(`/manage?sellerId=${s}`),(0,z.VX)("Archived Merch "+t+" "+r))}catch(e){console.error("Archive error:",e),Q(!1),(0,z.UG)("Failed to archive: "+e.message)}}else console.log("Not confirmed")}(0,r.useEffect)(()=>{e$(eN.merch_type_id)&&(console.log("Setting splits_from_release"),ef("splits_from_release",!0))},[eN.merch_type_id]),(0,r.useEffect)(()=>{if(eN.options?.length){let e,s,i,t,r,l,n=(e=eN.options?.[0]?.name||"",s=eN.options?.[1]?.name||"",i=eN.options?.[2]?.name||"",t=eN.options?.[0]?.values?.filter(e=>e.length)||[],r=eN.options?.[1]?.values?.filter(e=>e.length)||[],l=eN.options?.[2]?.values?.filter(e=>e.length)||[],t.flatMap((t,n)=>r.length?r.flatMap((r,a)=>l.length?l.map((l,c)=>({position:`${n}-${a}-${c}`,option_json:[{category:e,value:t},{category:s,value:r},{category:i,value:l}],update_quantities:{}})):{position:`${n}-${a}`,option_json:[{category:e,value:t},{category:s,value:r}],update_quantities:{}}):{position:`${n}`,option_json:[{category:e,value:t}],update_quantities:{}})),a=eN.merch_options.filter(e=>e.id),c=a?.length?[...a]:[];n.map((e,s)=>{let{item:i,index:t}=(0,k.Q2)(c,s=>s.position==e.position);if(i){let s={...i,...e};c[t]=s}else c.push(e)}),ef("merch_options",c.map(e=>{let s=e.quantities?Object.fromEntries(e.quantities.map(e=>{let s=null!=e.quantity_available?e.quantity_available:void 0;return[e.ship_from_country,s]})):{};return{...e,update_quantities:s}}))}},[JSON.stringify(eN.options)]);let eI=(0,h.lX)(n,ej,()=>f.push("/manage"),eS,ex(eC,eO)),eF=4e3-(eN?.description?.length||0),eP=eN.options?.filter(e=>e.values?.filter(e=>e.length).length).length;(0,r.useEffect)(()=>{ek&&(["music"].includes(ek.category)&&!eN.release_id?ef("dynamic_check",!1):ef("dynamic_check",!0),ek.is_digital&&ef("shipping_scheme_id",1))},[ek,eN.dynamic_check,eN.release_id]);let{item:eM,index:ez}=(0,k.Q2)(eN.merch_options,e=>e.position==S.Qv),eV=ez>=0?eN.merch_options.toSpliced(ez,1):eN.merch_options;(0,r.useEffect)(()=>{if(eM){if(eM.quantities){let e=Object.fromEntries(eM.quantities.map(e=>[e.ship_from_country,e.quantity_available]).filter(e=>null!=e[1]));console.log("setValue update_quantities",e),ef("update_quantities",e)}console.log("Updating merch_options with",eV),ef("merch_options",eV)}},[eM,eV]);let eT=!e$(eN.merch_type_id);function eU(e){return`${e||"Untitled"}${eo&&!eT?`: ${eo?.title}`:""}`}let eq=eU(eN?.title);function eD(){return(0,t.jsx)(t.Fragment,{children:eN.merch_type_id?"":(0,t.jsxs)("div",{className:"mt-2 bg-neutral-300  p-2 text-xs rounded-2xl text-black text-center",children:["Start by selecting the type of merch you wish to create",(0,t.jsx)(g.TYx,{className:"md:hidden inline text-xl"}),(0,t.jsx)(g.a1M,{className:"hidden md:inline text-2xl"})]})})}function eR(){return(0,t.jsxs)("div",{className:"",children:[(0,t.jsxs)(h.Pz,{children:["Related Release ",(0,t.jsx)("span",{className:"text-sm",children:eT?"(optional)":""})]}),(0,t.jsx)(A,{options:e.releases,defaultText:"Select digital release",value:ea(eN.release_id),addRelease:e=>{console.log("Set release..",e),ed(e),ef("release_id",e?.id)}}
1),(0,t.jsx)(h.Kw,{field:"dynamic_check",errors:ew,message:"Related release is required for Music "})]})}return(0,t.jsx)(l.Ay,{...n,hideNav:!0,children:(0,t.jsxs)(c.Op,{...em,children:[(0,t.jsx)(a(),{children:(0,t.jsx)("title",{children:eN.id?"New Merch":"Edit Merch"})}),(0,t.jsx)(p.A,{seller:e?.seller,...n,children:eN.id?(0,t.jsxs)("span",{children:["Editing ",(0,t.jsx)("span",{className:"italic",children:eq})]}):(0,t.jsx)("span",{children:"New Merch"})}),Y?(0,t.jsx)(V.k,{message:(0,t.jsxs)(t.Fragment,{children:["Please wait while we archive ",(0,t.jsx)("span",{className:"font-semibold",children:eN.title})]})}):null,(0,t.jsxs)(h.cm,{className:"",children:[(0,t.jsx)("div",{children:(0,t.jsx)("div",{className:"hidden lg:flex ",children:(0,t.jsx)(eD,{})})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"min-h-[800px]",children:[(0,t.jsx)("div",{className:" text-5xl font-thin poppins text-brand  ",children:eq}),(0,t.jsx)("div",{className:"mt-1 text-xs font-bold poppins text-brand  ",children:es.name}),(0,t.jsx)("div",{className:"mt-2 mb-4 poppins",children:(0,t.jsx)(h.VX,{status:eN.status,className:"text-mygreen"})}),(0,t.jsx)("div",{className:"flex lg:hidden",children:(0,t.jsx)(eD,{})}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.Pz,{children:"Product Type"}),(0,t.jsxs)(j.A,{variant:"outlined",className:"w-[200px]",onChange:e=>{console.log("Select on Change",e);let s=e?.target?.value;if(!s)return;console.log("currentCat",ek?.category,"newCat",eA(s)?.category);let i=ek&&ek?.category!=eA(s)?.category;console.log("changedCategory",i),i&&confirm("Changing the merch category will reset the form, continue?")?(eS(),console.log("Resetting and setting type to",s)):console.log("Setting type to",s),ef("merch_type_id",s)},displayEmpty:!0,defaultValue:void 0,value:eN.merch_type_id,children:[(0,t.jsx)(v.A,{value:void 0,children:"Please select..."},"none"),(0,t.jsx)(_.A,{value:"music",children:"Music"}),ei.filter(e=>e.category?.toLowerCase()=="music").map(e=>(0,t.jsx)(v.A,{value:e.id,children:e.name},e.id)),(0,t.jsx)(_.A,{value:"apparel",children:"Apparel"}),ei.filter(e=>e.category?.toLowerCase()=="apparel").map(e=>(0,t.jsx)(v.A,{value:e.id,children:e.name},e.id)),(0,t.jsx)(_.A,{value:"misc",children:"Misc"}),ei.filter(e=>e.category?.toLowerCase()=="misc").map(e=>(0,t.jsx)(v.A,{value:e.id,children:e.name},e.id)),(0,t.jsx)(_.A,{value:"download",children:"Download"}),ei.filter(e=>e.category?.toLowerCase()=="digital").map(e=>(0,t.jsx)(v.A,{value:e.id,children:e.name},e.id))]})]}),eN.merch_type_id&&e$(eN.merch_type_id)?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"",children:(0,t.jsx)(eR,{})})}):"",eN.merch_type_id&&(!e$(eN.merch_type_id)||eo)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Pz,{children:"Title"}),(0,t.jsx)(h.Rr,{children:'Say what it is. e.g., "Limited Edition Vinyl.". Don\'t put the album name, we will add it.'}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.L0,{fullWidth:!0,field:"title",register:eu,errors:ew,onChange:function(e){let s=e.target.value;if(s.length>h.Og&&ef("title",s=s.substring(0,h.Og),{shouldDirty:!0}),eN.id||P&&eN.slug)console.log("Not updating, id or userSlug set");else{let e=eU(s),i=(0,k._g)(e);console.log("Updating Slug from title",i),M(!1),ef("slug",i,{shouldDirty:!0})}},placeholder:"Title of merch"}),(0,t.jsx)(h.Kw,{field:"title",errors:ew})]}),(0,t.jsxs)("div",{className:"mt-1 flex flex-row place-items-center",children:[(0,t.jsx)(h.oC,{urlPrefix:`${x.publicUrl}/merch/${eN.id||"[ID]"}/`,watchFields:eN,register:eu,errors:ew,field:"slug",fullWidth:!0,copyFrom:eq,editSlug:U,setEditSlug:q,setUserSlug:M,setValue:ef}),(0,t.jsx)(h.Kw,{field:"slug",errors:ew})]}),e$(eN.merch_type_id)?"":(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(eR,{})}),ek?.is_digital?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Pz,{children:"Downloadable Content"}),(0,t.jsx)(h.zp,{watchFields:eN,errors:ew,field:"downloadable_asset_url",fileData:eN.downloadable_content,uniqueId:`${es.id}`,buttonText:"Add zip file",processingFn:e=>J(e),setFileData:e=>{console.log("Set file data",e),(0,z.VX)("File uploaded "),ef("downloadable_asset_url",e?.fileData.sourceS3file),ef("downloadable_content",e?.fileData)},onError:e=>{(0,z.UG)(e)}})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Pz,{children:"Ships From"}),(0,t.jsx)(C.wP,{value:eN.ship_from_country||es.default_ship_country,valueType:"short",onChange:e=>{(!eN.id||confirm("Changing the ship from country will reset quantities and will require different shipping pricing, proceed?"))&&ef("ship_from_country",e)}})]}),(0,t.jsx)(h.Pz,{children:"Description"}),(0,t.jsx)(h.Rr,{children:"Give a clear detailed description of the product. Include sizing information for clothing."}),(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:`text-xs text-neutral-500 py-1 ${eF>0?"":"text-red-300"}`,children:[eF," characters available"]}),(0,t.jsx)(y.A,{className:`mt-1 w-full form-control ${ew.merch_type_id?"is-invalid":""}`,rows:20,multiline:!0,placeholder:`Clearly describe your ${eN.merch_type_id}.`,...eu("description")}
1),(0,t.jsx)(h.Kw,{field:"description",errors:ew})]}),(0,t.jsx)(h.Pz,{children:"Tags"}),(0,t.jsx)(W.N,{watchFields:eN,field:"tags_json",setValue:ef,setError:e_,clearErrors:ey,errors:ew}),(0,t.jsx)(h.Pz,{children:"Images"}),(0,t.jsx)("div",{className:"mt-2 text-neutral-500 text-xs",children:"Images should be high quality & minimum 1000x1000px"}),(0,t.jsx)("div",{children:(0,t.jsx)(h.Kw,{errors:ew,field:"images"})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mt-4 flex flex-row flex-wrap gap-4",children:[eN.images.map((e,s)=>(0,t.jsxs)("div",{className:"relative flex place-items-center",children:[(0,t.jsx)("img",{className:"max-w-[200px] max-h-[200px] rounded-sm",src:(0,k.mo)(e?.source_image_url)}),(0,t.jsx)("span",{className:"p-1 absolute bottom-0 right-0 cursor-pointer bg-black rounded-tl-sm",children:(0,t.jsx)(g.b6i,{className:"text-xl hover:text-white",onClick:()=>{let e=eN.images.toSpliced(s,1);console.log("NewImages",e),ef("images",e)}})}),(0,t.jsx)("div",{children:(0,t.jsx)(h.Kw,{errors:ew?.images?.[s],field:"seller_id"})}),(0,t.jsx)("div",{children:(0,t.jsx)(h.Kw,{errors:ew?.images?.[s],field:"source_image_url"})})]},s)),[...Array(6-(eN.images?.length||0))].map((e,s)=>(0,t.jsx)("div",{className:"flex w-[200px] h-[200px] bg-neutral-800 rounded-sm place-content-center text-center",children:D&&0==s?(0,t.jsx)("div",{className:"w-fit h-fit self-center",children:(0,t.jsx)(w.A,{size:30,className:""})}):null},`${6-s}`))]}),(0,t.jsx)("div",{className:"mt-4",children:eN.images?.length<6?(0,t.jsx)(h.ME,{watchFields:eN,errors:ew,field:"images",index:eN.images.length,uniqueId:`${es.id}`,sellerId:es.id,imageDisplay:!1,minWidth:500,minHeight:500,minArea:3e3,buttonText:"Add Artwork",processingFn:e=>L(e),setImages:e=>{console.log("Setting url from",e);let s=[...eN.images];s[eN.images.length]={image_url:e.imageUrl,source_image_url:e.sourceUrl},ef("images",s),(0,h.Yi)(ex,ej)},onError:e=>{(0,z.UG)(e)}}):""})]}),(0,t.jsx)(h.Pz,{children:"YouTube Video"}),(0,t.jsx)(h.L0,{fullWidth:!0,field:"youtube_id",register:eu,errors:ew,placeholder:"Youtube video ID",onChange:function(e){let s=e.target.value;for(let e of[/\/watch\?v\=([A-Za-z0-9]+).*/,/\/([A-Za-z0-9]+).*/]){console.log(`Trying regex ${e} with ${s}`);let i=s.match(e);if(console.log("MATCH",i),i){console.log(`Found ${i[1]}`),ef("youtube_id",i[1]);break}}}}),(0,t.jsx)(R.Hb,{className:"mt-12",youtubeId:eN.youtube_id||void 0,forceShow:!!eN?.youtube_id?.length}),(0,t.jsx)(h.Pz,{children:"Price"}),(0,t.jsx)("div",{className:"my-2 text-neutral-500 text-xs",children:"Price exclusive of VAT"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.IJ,{size:"small",currency:es.currency,placeholder:"",name:"regular_price"}),(0,t.jsx)(h.Kw,{field:"regular_price",errors:ew})]}),ek?.is_digital?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(h.Pz,{className:"",children:["Options ",(0,t.jsx)(K,{})]}),(0,t.jsxs)("div",{className:"bg-neutral-900 rounded-md p-4 ",children:[(0,t.jsx)(ee,{}),eP?(0,t.jsx)(h.Pz,{children:"Option specifics"}):"",(0,t.jsx)(T.E,{children:(0,t.jsx)(m.A,{content:e})}),(0,t.jsx)(T.E,{name:"quantities",children:(0,t.jsx)(m.A,{content:eN.merch_options.map(e=>e.update_quantities)||{}})}),eP?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mt-4 flex flex-row gap-1 text-xxs uppercase border-b-[1px] border-neutral-600 pb-1 mb-2",children:[(0,t.jsx)("div",{className:"flex flex-grow",children:"Option"}),eb?.map(e=>(0,t.jsxs)("div",{className:"w-[60px] shrink-0",children:[e," qty"]},e)),(0,t.jsx)("div",{className:"w-[160px] shrink-0",children:"sku"}),(0,t.jsx)("div",{className:"w-[80px] shrink-0",children:"price"}),(0,t.jsx)("div",{className:"w-[102px] shrink-0",children:"image"}),(0,t.jsx)("div",{className:"w-[20px] shrink-0"})]},"heading"),eN.merch_options?.map((e,s)=>{let i=e.disabled?" child:opacity-20 ":" ",r=e.position==S.Qv;return(0,t.jsxs)("div",{className:`${r?"hidden":" flex"} flex-row gap-1 place-items-center border-b-[1px] border-neutral-600 pb-2 mb-2 ${i}`,children:[(0,t.jsx)("div",{className:"ml-2 flex flex-grow text-xs uppercase",children:e.option_json.map(e=>e.value).join("-")}),eb?.map(e=>(0,t.jsx)("div",{className:"w-[60px] shrink-0",children:(0,t.jsx)(y.A,{className:"text-xxs",...eu(`merch_options[${s}].update_quantities[${e}]`),size:"small",placeholder:"Unlimited"})},e)),(0,t.jsx)("div",{className:"w-[160px] shrink-0",children:(0,t.jsx)(y.A,{fullWidth:!0,...eu(`merch_options[${s}].sku`),size:"small",placeholder:"sku"})}),(0,t.jsx)("div",{className:"w-[80px] shrink-0",children:(0,t.jsx)(h.IJ,{size:"small",currency:es.currency,placeholder:`${eN.regular_price}`,name:`merch_options[${s}].regular_price`})}),(0,t.jsx)("div",{className:"w-[64px] flex shrink-0",children:(0,t.jsx)(h.ME,{className:"mx-auto",watchFields:eN,errors:e
1w,field:"doesnt_matter",fullSizeField:"doesnt_matter",uniqueId:`${es.id}`,sellerId:es.id,imageDisplay:!1,buttonText:(0,t.jsx)("span",{className:"text-xxs",children:"Option Image"}),setImages:e=>{console.log(`Setting ${s} url from`,e);let i=[...eN.merch_options];if(null==i[s])throw Error("No option Details found in position "+s);i[s].image_json={image_url:e.imageUrl,source_image_url:e.sourceUrl},ef("merch_options",i),(0,h.Yi)(ex,ej)},onError:e=>{(0,z.UG)(e)}})}),(0,t.jsx)("div",{className:"w-[38px] shrink-0 flex place-content-center ",children:(0,t.jsx)("img",{className:"w-[38px] h-[38px] rounded border-[1px] border-neutral-600",width:36,height:36,src:eN.merch_options[s]?.image_json?.source_image_url||"/imgs/image-placeholder-dark.png"})}),(0,t.jsx)("div",{className:"w-[20px] shrink-0 px-1 border-l-[1px] border-neutral-600 !opacity-100",children:e.disabled?(0,t.jsx)(g.suc,{className:" text-lg cursor-pointer",onClick:()=>{ef(`merch_options.${s}.disabled`,!1)}}):(0,t.jsx)(g.b6i,{className:" text-lg cursor-pointer",onClick:()=>{ef(`merch_options.${s}.disabled`,!0)}})})]},e.position)}),(0,t.jsx)(h.Kw,{field:"merch_options",errors:ew}),(0,t.jsx)("div",{})]}):""]})]}),eP?"":(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Pz,{children:"Quantity"}),(0,t.jsxs)("div",{children:[eb?.map(e=>(0,t.jsxs)("div",{className:"mt-2 text-neutral-400 text-xs ",children:[(0,t.jsxs)("div",{children:["In ",(0,t.jsx)("span",{className:"mt-1 uppercase  font-semibold",children:(0,k.Fi)(e).name})]}),(0,t.jsx)("div",{className:"mt-1 ",children:(0,t.jsx)(y.A,{className:"text-xxs",...eu(`update_quantities[${e}]`),size:"small",placeholder:"unlimited"})})]},e)),(0,t.jsx)(h.Kw,{field:"quantity",errors:ew})]}),(0,t.jsxs)(h.Pz,{children:["Sku ",(0,t.jsx)("span",{className:"text-sm",children:"(optional)"})]}),(0,t.jsx)("div",{className:"w-[400px]",children:(0,t.jsx)(y.A,{fullWidth:!0,...eu("sku"),placeholder:"sku"})})]}),ek?.is_digital?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Pz,{children:"Shipping"}),(0,t.jsxs)("div",{className:"bg-neutral-900 rounded-md  p-4",children:[(0,t.jsx)(Z,{sellerId:s,currency:es?.currency,fromLocations:eb,selectedSchemeId:eN.shipping_scheme_id,setShippingSchemeId:e=>{ef("shipping_scheme_id",e)},placeholderName:`${(0,k.TF)(ei?.find(e=>e.id==eN.merch_type_id)?.name||"")} from ${(0,k.od)(eb.map(e=>(0,k.Fi)(e).name))}`}),(0,t.jsx)(h.Kw,{field:"shipping_scheme_id",message:"Shipping Required",errors:ew})]})]}),et?.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Pz,{children:"Admin"}),(0,t.jsxs)("div",{className:"flex flex-row gap-4",children:[(0,t.jsx)("div",{children:(0,t.jsx)(N.A,{variant:"contained",component:"label",onClick:eE,children:"Archive Merch"})}),(0,G.B)()?(0,t.jsxs)(t.Fragment,{children:[(0,k.i7)(eN.status)?(0,t.jsx)("div",{}):(0,t.jsx)("div",{children:(0,t.jsx)(N.A,{variant:"contained",component:"label",children:"Hold Merch (Not implemented)"})}),(0,t.jsx)("div",{children:(0,t.jsx)(N.A,{variant:"contained",component:"label",onClick:en,children:"Reduce Visibility"})})]}):""]})]}):"",(0,t.jsx)("div",{className:" mt-8",children:eI})]}):""]}),(0,t.jsx)(T.E,{children:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{children:"Debug"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.A,{content:e?.merch}),"ERRORS ",(0,t.jsx)(m.A,{content:Object.keys(ew)}),(0,t.jsx)("br",{}),"VALID ",ej.isValid?"yes":"no",(0,t.jsx)("br",{}),"DIRTY ",ej.isDirty?"yes":"no",(0,t.jsx)("br",{}),"VALIDATING ",ej.isValidating?"yes":"no",(0,t.jsx)("br",{}),"WATCH: ",(0,t.jsx)(m.A,{content:eN})]})]})})]})]})]})})}function J({shippingScheme:e,currency:s}){return(0,t.jsx)("div",{className:"bg-neutral-700 rounded-md p-2 ",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("div",{className:"pb-1 w-full font-bold",children:e.name}),(0,t.jsxs)("div",{className:"flex flex-row gap-8 text-xs pt-1 border-t-[1px] border-neutral-800 text-neutral-500",children:[(0,t.jsx)("div",{className:"w-[200px] ",children:"From"}),(0,t.jsx)("div",{className:"w-[20px] "}),(0,t.jsx)("div",{className:"w-[120px]",children:"Destination"}),(0,t.jsx)("div",{className:"w-[60px]",children:"First item"}),(0,t.jsx)("div",{className:"w-[60px]",children:"Additional"})]}),e.destinations.filter(e=>!e.disabled).map(e=>(0,t.jsxs)("div",{className:"flex flex-row gap-8 text-sm ",children:[(0,t.jsxs)("div",{className:"w-[200px] ",children:[" ",(0,k.Fi)(e.ship_from_country).name]}),(0,t.jsx)("div",{className:"w-[20px] text-neutral-500",children:(0,t.jsx)(U.A,{className:"text-[16px]"})}),(0,t.jsx)("div",{className:"w-[120px] truncate",children:(0,k.Fi)(e.ship_to).name}),(0,t.jsx)("div",{className:"w-[60px] text-right",children:(0,k.$g)(e.shipping_price,s)}),(0,t.jsx)("div",{className:"w-[60px] text-right",children:(0,k.$g)(e.shipping_extra_price||e.shipping_price,s)})]},e.id))]})})}function Y(e,s){return 0==s.filter(s=>!e.destinations.filter(e=>e.ship_from_country==s).length).length}function Q({sellerId:e,fromLocations:s,selectedSchemeId:i,setShippingSchemeId:l,currency:n,placeholderName:a,close:o}){let d=D(e,i),m=s.flatMap(e=>[{within:!0,ship_from_country:e,ship_to:e,ship_to_name:(0,k.Fi)(e).name,built_in:!0},{ship_from_country:e,ship_to:"EU",ship_to_name:"EU",built_in:!0},{ship_from_country:e,ship_to:"W",ship_to_name:"Rest of World",built_in:!0}]),{data:x,trigger:p}=(0,I.A)(`/api/edit/shipping/save?sellerId=${e}`,u.w$),{data:f,trigger:j}=(0,I.A)("/api/edit/shipping/delete",u.w$),{data:v,isValidating:_,error:b,mutate:A}=d;b&&console.log("ShipData Error",b);let S=(0,c.mN)({resolver:(0,O.u)(E.kH),defaultValues:(0,r.useMemo)(()=>({seller_id:e,destinations:m}),[v])}),{register:$,handleSubmit:F,watch:M,reset:V,setValue:T,formState:U,control:q}=S,{errors:R}=U,W=M(),{fields:L,append:H,prepend:G,remove:K,update:X}=(0,c.jz)({control:q,name:"destinations"}),B=Object.fromEntries(s.map(e=>
1[e,L.map((e,s)=>{let i=W.destinations[s];if(!i)throw Error("No shipping destination at index: "+s);return{index:s,shippingOption:i,field:e}}).filter(({shippingOption:s})=>s.ship_from_country==e)]));async function J(e){console.log("Failed to validate",e),(0,z.UG)("Please check errors: "+e.destinations?.map(e=>Object.keys(e).join(", ")))}async function Z(e){await j({shipping_scheme_id:e}),(0,z.VX)("Deleted Scheme"),await A()}async function ee(e){console.log("Validation passed, submitting",e);let s=await p({data:e});if(s.status<400){let e=(await s.json()).shippingSchemaId;l(e),o(),(0,z.VX)("Saved shipping schema: "+e),A()}else{let e=await s.text();(0,z.UG)("Failed to save: "+e)}}async function es(){console.log("Handling save..."),await F(ee,J)()}return(0,t.jsxs)(c.Op,{...S,children:[v?.shipping&&v?.shipping?.length>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"text-sm font-bold",children:"Use existing shipping"}),_?(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)(w.A,{className:"self-center"})}):(0,t.jsx)("div",{className:"mt-4 bg-neutral-900 rounded-md p-2",children:(0,t.jsx)("div",{className:"flex flex-col",children:v?.shipping.map(e=>{let r=i==e.id;return(0,t.jsxs)("div",{className:"flex flex-row first:border-t-0 border-t-[1px] border-neutral-950 py-1 text-md items-center align-center gap-x-4 ",children:[(0,t.jsx)("div",{className:"flex-grow text-xs ",children:e.name}),(0,t.jsx)("div",{className:"w-[20px] text-xs",children:(0,k.od)((0,k.v3)(e.destinations.map(e=>e.ship_from_country)))}),(0,t.jsx)("div",{className:"w-[80px] text-xs",children:(0,k.od)((0,k.v3)(e.destinations.map(e=>e.ship_to)))}),(0,t.jsx)("div",{className:"text-xs text-center w-[100px]",children:r?(0,t.jsx)("span",{className:"italic font-semibold",children:"Selected"}):Y(e,s)?(0,t.jsx)(N.A,{className:"inline",onClick:()=>{l(e.id),o()},children:" Select"}):(0,t.jsx)("span",{className:"text-xxs italic text-neutral-400",children:"No match"})}),(0,t.jsx)("div",{className:"text-xs text-center w-[100px]",children:e.merch_ids.length||r?(0,t.jsx)("div",{className:"text-xs italic",children:"In use"}):(0,t.jsx)(P.f,{className:"mx-auto w-fit text-center hover:text-white text-base cursor-pointer",onClick:()=>Z(e.id),children:(0,t.jsx)(g.b6i,{className:"inline"})})})]},e.id)})})})]}):"",(0,t.jsx)("div",{className:"mt-8 text-sm font-bold",children:"Create new shipping pricing"}),(0,t.jsxs)("div",{className:"mt-4 bg-neutral-900 rounded-md p-2",children:[s.map(e=>(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"border-b-[1px] border-neutral-600 py-1 text-sm",children:["From ",(0,t.jsx)("span",{className:"font-semibold",children:(0,k.Fi)(e).name})]}),(0,t.jsxs)("div",{children:[B[e]?.map(({index:s,shippingOption:i,field:r})=>{let l=B[e]?.map(e=>e.shippingOption.ship_to)||[],a=i.disabled?" opacity-20 ":" ";return(0,t.jsxs)("div",{className:"border-b-[1px] py-2 border-neutral-800 ",children:[(0,t.jsxs)("div",{className:"flex flex-row place-items-center gap-2 text-xxs px-1 ",children:[(0,t.jsx)("div",{className:` whitespace-nowrap ${a}`,children:"To"}),(0,t.jsx)("div",{className:`flex-grow ${a}`,children:i.built_in?i.ship_to_name:(0,t.jsx)(C.wP,{blacklist:l,priorityOptions:["GB","US"].filter(e=>!l.includes(e)),classes:" w-full",value:i.ship_to,valueType:"short",onChange:e=>{console.log("Change country to ",e),T(`destinations.${s}.ship_to`,e)}})}),(0,t.jsx)("div",{className:`w-[80px] shrink-0 ${a}`,children:(0,t.jsx)(h.IJ,{size:"small",currency:n,name:`destinations.${s}.shipping_price`,opts:{required:!0}})}),(0,t.jsxs)("div",{className:`relative whitespace-nowrap ${a}`,children:["for 1",(0,t.jsx)("span",{className:"inline -mt-1 text-xxs  ",children:"st"})," unit"]}),(0,t.jsx)("div",{className:`w-[80px] shrink-0 ${a}`,children:(0,t.jsx)(h.IJ,{size:"small",currency:n,placeholder:`${i?.shipping_price||""}`,name:`destinations.${s}.shipping_extra_price`})}),(0,t.jsx)("div",{className:`w-[80px] shrink-0 text-xxs ${a}`,children:"additional units"}),(0,t.jsx)("div",{className:"w-[20px]  px-1 border-l-[1px] border-neutral-600 ",children:i.disabled?(0,t.jsx)(g.suc,{className:" text-lg cursor-pointer",onClick:()=>{T(`destinations.${s}.disabled`,!1)}}):(0,t.jsx)(g.b6i,{className:" text-lg cursor-pointer",onClick:()=>{i.built_in?T(`destinations.${s}.disabled`,!0):K(s)}})})]}),(0,t.jsx)("div",{children:(0,t.jsx)(h.Kw,{className:"text-xxs",field:`destinations.${s}.shipping_price`,includeField:!0,errors:R})})]},r.id)}),L.length<9?(0,t.jsx)("div",{className:"mt-1 flex flex-row gap-1",children:(0,t.jsx)(N.A,{size:"small",onClick:()=>{G({ship_from_country:e,ship_to:"",shipping_price:void 0,shipping_extra_price:void 0})},children:"Add Destination"})}):""]})]},e)),(0,t.jsxs)("div",{className:"mt-4 py-2 flex flex-row border-t-[1px] border-neutral-800 gap-8 ",children:[(0,t.jsxs)("div",{className:"mt-1 w-1/2 flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"text-xs ",children:"Give this shipping scheme a name"}),(0,t.jsxs)("div",{className:"",children:[(0,t.jsx)(y.A,{className:"w-full",size:"small",defaultValue:a,...$("name",{required:!0}),placeholder:a||"Name"}),(0,t.jsx)(h.Kw,{field:"name",errors:R})]})]}),(0,t.jsx)("div",{className:"w-1/2 text-right self-end",children:(0,t.jsx)(N.A,{variant:"contained",component:"label",onClick:es,children:"Save and Select"})})]})]})]})}function Z({sellerId:e,currency:s,fromLocations:i,selectedSchemeId:l,placeholderName:n,setShippingSchemeId:a=e=>{}}
1){let{setPopupMessage:c}=(0,M.x)(),{data:o,isValidating:d,error:h,mutate:m}=D(e,l);n=o?.shipping?.find(e=>e.name===n)?n+" (2)":n;let u=o?.shipping.find(e=>e.id===l);(0,r.useEffect)(()=>{console.log("fromLocations/schema changed",i,u),u&&!Y(u,i)&&(console.log("Shipping does not match"),a(""),(0,z.uA)("Shipping not longer matches, shipping scheme removed"))},[i,u]);let p=u?.destinations.filter(e=>"W"==e.ship_to||"EU"==e.ship_to||(0,L.Bt)(e.ship_to)).length,f=i.filter(e=>!(0,L.Bt)(e)).length;return(0,t.jsxs)("div",{className:"poppins",children:[(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(N.A,{variant:"contained",component:"label",onClick:()=>{c({title:"Shipping",makeChildren:({close:r})=>(0,t.jsx)(Q,{currency:s,sellerId:e,fromLocations:i,close:r,selectedSchemeId:l,setShippingSchemeId:a,placeholderName:n})})},children:"Configure Shipping"})}),u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(J,{shippingScheme:u,currency:s}),(0,S.Vg)()&&p&&f?(0,t.jsxs)("div",{className:"mt-4 text-neutral-300 bg-brand/20 p-2 text-sm rounded-md",children:[(0,t.jsx)("div",{className:"text-base font-semibold",children:"Cross border shipping into EU"}),(0,t.jsx)("div",{className:"mt-4",children:"Your shipping options includes delivery into the EU from outside the EU."}),(0,t.jsx)("div",{className:"mt-4",children:"For orders under €150 entering the EU:"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsxs)("ul",{className:"list-disc ml-8",children:[(0,t.jsx)("li",{children:"We will collect VAT at checkout"}),(0,t.jsx)("li",{children:"You MUST use our IOSS number when booking the delivery (provided on order page)."}),(0,t.jsxs)("li",{children:["We will we apply a ",(0,k.$g)(S.Gt,x.UM.GBP)," surcharge to the customer's shipping cost and deducted as part of our platform fee to cover our EU VAT handling costs."]})]})}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("div",{className:"text-sm font-semibold",children:"IOSS Benefits"}),"Orders shipped using the IOSS scheme are delivered more quickly to customers as they bypass customs and customers avoid needing to pay VAT on delivery."]}),(0,t.jsxs)("div",{className:"mt-4 text-white bg-red-600/40 p-2 rounded-md ",children:[(0,t.jsx)(g.Wux,{className:"inline "})," Failure to use the IOSS number when booking delivery for an order marked as IOSS could result in additional VAT or expenses for which you may be liable."]})]}):null]}):""]})}function ee({}){let{register:e,control:s}=(0,c.xW)(),{fields:i,append:r,remove:l,update:n}=(0,c.jz)({control:s,name:"options"});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.ov,{children:"Category"}),(0,t.jsxs)("div",{className:"flex flex-row gap-2",children:[i.map((s,i)=>(0,t.jsxs)("div",{className:"mt-2 border-r-[1px] pr-4 border-neutral-600 ",children:[(0,t.jsxs)("div",{className:"flex flex-row",children:[(0,t.jsx)(y.A,{size:"small",...e(`options.${i}.name`,{required:!0}),placeholder:"Eg Size, Colour, Style"}),(0,t.jsx)(g.b6i,{className:"mt-2 text-lg cursor-pointer",onClick:()=>{l(i)}})]}),(0,t.jsx)(es,{className:"mt-2 ml-[20px]",optionIndex:i})]},s.id)),i.length<3?(0,t.jsx)("div",{className:"",children:(0,t.jsx)(N.A,{size:"small",onClick:()=>{r({name:"",values:[""]})},children:"Add Category"})}):""]})]})}function es({optionIndex:e,className:s=""}){let{register:i,control:l,watch:n}=(0,c.xW)(),a=n(),{fields:o,append:d,remove:m,update:u}=(0,c.jz)({control:l,name:`options[${e}].values`}),x=a.options[e].name,p=a.options[e].values;return(0,r.useEffect)(()=>{p.slice(-1).length&&d("")},[p?.join(",")]),(0,t.jsx)("div",{className:(0,$.QP)("",s),children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(h.ov,{children:["Values for ",x]}),(0,t.jsx)("div",{className:"mt-1 flex flex-col gap-1",children:o.map((s,r)=>(0,t.jsxs)("div",{className:"flex flex-row gap-1",children:[(0,t.jsx)(y.A,{size:"small",...i(`options[${e}].values[${r}]`,{required:!0}),placeholder:"Eg Blue, Large, Dots"}),(0,t.jsx)(g.b6i,{className:"mt-2 text-lg cursor-pointer",onClick:()=>{m(r)}})]},s.id))})]}):""})}},93180:(e,s,i)=>{"use strict";var t=i(29563);s.A=void 0,function(e){if((!e||!e.__esModule)&&null!==e&&("object"==typeof e||"function"==typeof e)){var s=n(void 0);if(s&&s.has(e))return s.get(e);var i={__proto__:null},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var l=t?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(i,r,l):i[r]=e[r]}i.default=e,s&&s.set(e,i)}}(i(14232));var r=t(i(78652)),l=i(37876);function n(e){if("function"!=typeof WeakMap)return null;var s=new WeakMap,i=new WeakMap;return(n=function(e){return e?i:s})(e)}s.A=(0,r.default)((0,l.jsx)("path",{d:"M10 15l5.19-3L10 9v6m11.56-7.83c.13.47.22 1.1.28 1.9.07.8.1 1.49.1 2.09L22 12c0 2.19-.16 3.8-.44 4.83-.25.9-.83 1.48-1.73 1.73-.47.13-1.33.22-2.65.28-1.3.07-2.49.1-3.59.1L12 19c-4.19 0-6.8-.16-7.83-.44-.9-.25-1.48-.83-1.73-1.73-.13-.47-.22-1.1-.28-1.9-.07-.8-.1-1.49-.1-2.09L2 12c0-2.19.16-3.8.44-4.83.25-.9.83-1.48 1.73-1.73.47-.13 1.33-.22 2.65-.28 1.3-.07 2.49-.1 3.59-.1L12 5c4.19 0 6.8.16 7.83.44.9.25 1.48.83 1.73 1.73z"}),"YouTube")},94570:(e,s,i)=>{"use strict";var t=i(29563);s.A=void 0,function(e){if((!e||!e.__esModule)&&null!==e&&("object"==typeof e||"function"==typeof e)){var s=n(void 0);if(s&&s.has(e))return s.get(e);var i={__proto__:null},t=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if("default"!==r&&Object.prototype.hasOwnProperty.call(e,r)){var l=t?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(i,r,l):i[r]=e[r]}i.default=e,s&&s.set(e,i)}}(i(14232));var r=t(i(78652)),l=i(37876);function n(e){if("function"!=typeof WeakMap)return null;var s=new WeakMap,i=new WeakMap;return(n=function(e){return e?i:s})(e)}s.A=(0,r.default)((0,l.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"}),"Twitter")}},e=>{e.O(0,[2710,3629,3083,4259,5289,8857,9559,5209,636,6593,8792],()=>e(e.s=53948)),_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.