>>4;if(!(b>>>8))a[y++]=b;else{if(b==256)break;var F=y+b-254;if(b>264){var $=p.ldef[b-257];F=y+($>>>3)+h(o,T,7&$),T+=7&$}var G=C[g(o,T)&x];T+=15&G;var Y=G>>>4,B=p.ddef[Y],K=(B>>>4)+f(o,T,15&B);for(T+=15&B,m&&(a=n.F._check(a,y+131072));y >>1);for(;E >2);let F;if(T.length<2e7)for(var $=0;$ >>1);for(;E>>4;if(p<=15)h[u]=p,u++;else{var m=0,w=0;p==16?(w=3+c(l,f,2),f+=2,m=h[u-1]):p==17?(w=3+c(l,f,3),f+=3):p==18&&(w=11+c(l,f,7),f+=7);for(var C=u+w;uf&&(f=i),h++}for(;h>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)&(1<>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)},n.F._get25=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16|o[3+(a>>>3)]<<24)>>>(7&a)},n.F.U=(t=Uint16Array,r=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new r(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new r(286),dhst:new r(30),ihst:new r(19),lits:new r(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=n.F.U,a=0;a<32768;a++){var s=a;s=(4278255360&(s=(4042322160&(s=(3435973836&(s=(2863311530&s)>>>1|(1431655765&s)<<1))>>>2|(858993459&s)<<2))>>>4|(252645135&s)<<4))>>>8|(16711935&s)<<8,o.rev15[a]=(s>>>16|s<<16)>>>17}function l(f,h,c){for(;h--!=0;)f.push(0,c)}for(a=0;a<32;a++)o.ldef[a]=o.of0[a]<<3|o.exb[a],o.ddef[a]=o.df0[a]<<4|o.dxb[a];l(o.fltree,144,8),l(o.fltree,112,9),l(o.fltree,24,7),l(o.fltree,8,8),n.F.makeCodes(o.fltree,9),n.F.codes2map(o.fltree,9,o.flmap),n.F.revCodes(o.fltree,9),l(o.fdtree,32,5),n.F.makeCodes(o.fdtree,5),n.F.codes2map(o.fdtree,5,o.fdmap),n.F.revCodes(o.fdtree,5),l(o.itree,19,0),l(o.ltree,286,0),l(o.dtree,30,0),l(o.ttree,320,0)})()})();var ag=rg({__proto__:null,default:On},[On]);const Ht=(function(){var e={nextZero(c,i){for(;c[i]!=0;)i++;return i},readUshort:(c,i)=>c[i]<<8|c[i+1],writeUshort(c,i,u){c[i]=u>>8&255,c[i+1]=255&u},readUint:(c,i)=>16777216*c[i]+(c[i+1]<<16|c[i+2]<<8|c[i+3]),writeUint(c,i,u){c[i]=u>>24&255,c[i+1]=u>>16&255,c[i+2]=u>>8&255,c[i+3]=255&u},readASCII(c,i,u){let g="";for(let p=0;pc.length<2?`0${c}`:c,readUTF8(c,i,u){let g,p="";for(let m=0;m>3)]>>7-((7&_)<<0)&1);C[y]=$[D],C[y+1]=$[D+1],C[y+2]=$[D+2],C[y+3]=L>2]=F.ind,P[$>>2]=F.est.rgba;else for($=0;$>2]=F.ind,P[$>>2]=F.est.rgba}return{abuf:A.buffer,inds:b,plte:U}}function w(x,y,T){T==null&&(T=1e-4);const A=new Uint32Array(x.buffer),P={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};P.bst=I(x,P.i0,P.i1),P.est=_(P.bst);const D=[P];for(;D.lengthr(o),n.readAsArrayBuffer(e)}))}function Kl(e,t){const{width:r}=e,{height:n}=e,{maxWidthOrHeight:o}=t;let a,s=e;return isFinite(o)&&(r>o||n>o)&&([s,a]=Dn(r,n),r>n?(s.width=o,s.height=n/r*o):(s.width=r/n*o,s.height=o),a.drawImage(e,0,0,s.width,s.height),Kt(e)),s}function Yl(e,t){const{width:r}=e,{height:n}=e,[o,a]=Dn(r,n);switch(t>4&&t<9?(o.width=n,o.height=r):(o.width=r,o.height=n),t){case 2:a.transform(-1,0,0,1,r,0);break;case 3:a.transform(-1,0,0,-1,r,n);break;case 4:a.transform(1,0,0,-1,0,n);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,n,0);break;case 7:a.transform(0,-1,-1,0,n,r);break;case 8:a.transform(0,-1,1,0,0,r)}return a.drawImage(e,0,0,r,n),Kt(e),o}function Xl(e,t,r=0){return new Promise((function(n,o){let a,s,l,f,h,c,i,u,g,p,m,w,C,O,v,E,I,_,M,x;function y(A=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=A,t.onProgress(Math.min(a,100))}function T(A){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(A,a),100),t.onProgress(a)}return a=r,s=t.maxIteration||10,l=1024*t.maxSizeMB*1024,y(),Pn(e,t).then(function(A){try{return[,f]=A,y(),h=Kl(f,t),y(),new Promise((function(P,D){var L;if(!(L=t.exifOrientation))return Vl(e).then(function(S){try{return L=S,U.call(this)}catch(b){return D(b)}}.bind(this),D);function U(){return P(L)}return U.call(this)})).then(function(P){try{return c=P,y(),Nr().then(function(D){try{return i=D?h:Yl(h,c),y(),u=t.initialQuality||1,g=t.fileType||e.type,$n(i,g,e.name,e.lastModified,u).then(function(L){try{{let S=function(){if(s--&&(v>l||v>C)){let F,$;return F=x?.95*M.width:M.width,$=x?.95*M.height:M.height,[I,_]=Dn(F,$),_.drawImage(M,0,0,F,$),u*=g==="image/png"?.85:.95,$n(I,g,e.name,e.lastModified,u).then((function(G){try{return E=G,Kt(M),M=I,v=E.size,T(Math.min(99,Math.floor((O-v)/(O-l)*100))),S}catch(Y){return o(Y)}}),o)}return[1]},b=function(){return Kt(M),Kt(I),Kt(h),Kt(i),Kt(f),T(100),n(E)};if(p=L,y(),m=p.size>l,w=p.size>e.size,!m&&!w)return T(100),n(p);var U;return C=e.size,O=p.size,v=O,M=i,x=!t.alwaysKeepResolution&&m,(U=function(F){for(;F;){if(F.then)return void F.then(U,o);try{if(F.pop){if(F.length)return F.pop()?b.call(this):F;F=S}else F=F.call(this)}catch($){return o($)}}}.bind(this))(S)}}catch(S){return o(S)}}.bind(this),o)}catch(L){return o(L)}}.bind(this),o)}catch(D){return o(D)}}.bind(this),o)}catch(P){return o(P)}}.bind(this),o)}))}const ig=`
+ `.trim().replace(/\s+/g," ");return d.jsx(j,{id:a,className:c,dangerouslySetInnerHTML:{__html:h},...s})},Lg=Object.freeze(Object.defineProperty({__proto__:null,HtmlContent:ca},Symbol.toStringTag,{value:"Module"})),da=()=>window.G7Core,ua=(e,t)=>da()?.t?.(e,t)??e,oi=({content:e="",onChange:t,isHtml:r=!1,onIsHtmlChange:n,rows:o=15,placeholder:a="",label:s,showHtmlModeToggle:l=!0,contentClassName:f="",purifyConfig:h,className:c="",name:i="content",htmlFieldName:u="content_mode",readOnly:g=!1,id:p,editorAttrs:m})=>{const[x,k]=C.useState(r),[M,v]=C.useState(e),[E,O]=C.useState(!1);C.useEffect(()=>{k(r)},[r]),C.useEffect(()=>{v(e)},[e]);const S=C.useCallback(y=>{const T=y.target.value;if(v(T),t){const I=da()?.createChangeEvent?.({value:T,name:i,type:"textarea"})??{target:{name:i,value:T}};t(I)}},[t,i]),A=C.useCallback(y=>{const T=y.target.checked;if(k(T),T||O(!1),n){const I=da()?.createChangeEvent?.({checked:T,name:u,type:"checkbox"})??{target:{name:u,checked:T}};n(I)}},[n,u]),w=C.useCallback(()=>{O(y=>!y)},[]);return d.jsxs(j,{className:`space-y-2 ${c}`,id:p,...m,children:[d.jsxs(j,{className:"flex items-center justify-between",children:[s&&d.jsx(Nr,{className:"block text-sm font-medium text-gray-500 dark:text-gray-400",children:s}),d.jsxs(j,{className:"flex items-center gap-3",children:[x&&!g&&d.jsx(J,{type:"button",onClick:w,className:`px-3 py-1.5 text-xs font-bold rounded-lg focus:outline-none focus:ring-2 ${E?"text-gray-700 dark:text-gray-200 bg-gray-200 dark:bg-gray-600 border border-gray-300 dark:border-gray-500 hover:bg-gray-300 dark:hover:bg-gray-500 focus:ring-gray-400 dark:focus:ring-gray-500":"text-blue-600 dark:text-blue-400 bg-white dark:bg-gray-700 border border-blue-300 dark:border-blue-600 hover:bg-blue-50 dark:hover:bg-gray-600 focus:ring-blue-500 dark:focus:ring-blue-600"}`,children:ua(E?"common.preview_off":"common.preview")}),l&&d.jsxs(Nr,{className:"flex items-center gap-2 p-2 cursor-pointer",children:[d.jsx(Et,{type:"checkbox",name:u,checked:x,onChange:A,disabled:g,className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"}),d.jsx(j,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:ua("common.html_mode")})]})]})]}),!E&&d.jsx(wo,{name:i,value:M,onChange:S,placeholder:a,rows:o,readOnly:g,className:`block w-full rounded-lg border px-3 py-2 text-sm placeholder-gray-400 dark:placeholder-gray-500 focus:outline-none focus:ring-1 disabled:opacity-50 disabled:cursor-not-allowed ${x?"font-mono bg-white dark:bg-gray-800 border-blue-300 dark:border-blue-600 text-gray-800 dark:text-gray-200 focus:border-blue-500 focus:ring-blue-500":"bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white focus:border-blue-500 focus:ring-blue-500"}`}),E&&d.jsx(j,{className:"p-4 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800 min-h-[400px]",children:d.jsx(ca,{content:M,isHtml:!0,className:f||"prose dark:prose-invert max-w-none text-gray-900 dark:text-gray-100",purifyConfig:h})})]})},Fg=Object.freeze(Object.defineProperty({__proto__:null,HtmlEditor:oi},Symbol.toStringTag,{value:"Module"})),ai=e=>window.G7Core?.t?.(e)??e,fa=({maxHeight:e=500,expandText:t,collapseText:r,className:n="",children:o,id:a,editorAttrs:s})=>{const[l,f]=C.useState(!1),[h,c]=C.useState(!1),i=C.useRef(null),u=C.useCallback(()=>{if(i.current){const x=i.current.scrollHeight;c(x>e)}},[e]);C.useEffect(()=>{u();const x=i.current;if(!x)return;const k=x.querySelectorAll("img");k.forEach(v=>{v.complete||v.addEventListener("load",u)});let M=null;return typeof ResizeObserver<"u"&&(M=new ResizeObserver(u),M.observe(x)),()=>{k.forEach(v=>{v.removeEventListener("load",u)}),M?.disconnect()}},[u,o]);const g=()=>{f(x=>!x)},p=t||ai("sirsoft-ecommerce.shop.product.expand_detail"),m=r||ai("sirsoft-ecommerce.shop.product.collapse_detail");return d.jsxs(j,{className:n,id:a,...s,children:[d.jsxs(j,{className:"relative",children:[d.jsx(j,{ref:i,className:!l&&h?"overflow-hidden transition-[max-height] duration-300 ease-in-out":"transition-[max-height] duration-300 ease-in-out",style:!l&&h?{maxHeight:`${e}px`}:void 0,children:o}),!l&&h&&d.jsx(j,{className:"absolute bottom-0 left-0 right-0 h-24 bg-gradient-to-t from-white dark:from-gray-900 to-transparent pointer-events-none"})]}),h&&d.jsxs(J,{type:"button",onClick:g,className:"flex items-center justify-center w-full py-3.5 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors cursor-pointer gap-1.5",children:[d.jsx(te,{className:"text-sm font-semibold text-gray-600 dark:text-gray-400",children:l?m:p}),d.jsx(ge,{name:l?"chevron-up":"chevron-down",size:"sm"})]})]})},$g=Object.freeze(Object.defineProperty({__proto__:null,ExpandableContent:fa,default:fa},Symbol.toStringTag,{value:"Module"})),Ug=(e,t)=>window.G7Core?.t?.(e,t)??e,ga=({isOpen:e,onClose:t,title:r,icon:n,iconClassName:o="text-gray-500 dark:text-gray-400",closeOnBackdropClick:a=!0,closeOnOverlayClick:s,showCloseButton:l=!0,closeOnEscape:f=!0,children:h,width:c="500px",className:i="",style:u})=>{const g=s!==void 0?s:a,p=C.useRef(null),m=C.useRef(null);if(C.useEffect(()=>{const k=M=>{M.key==="Escape"&&e&&f&&t()};if(e&&f)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[e,t,f]),C.useEffect(()=>{if(e&&p.current){m.current=document.activeElement;const k=p.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),M=k[0],v=k[k.length-1];M?.focus();const E=O=>{O.key==="Tab"&&(O.shiftKey?document.activeElement===M&&(O.preventDefault(),v?.focus()):document.activeElement===v&&(O.preventDefault(),M?.focus()))};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E),m.current?.focus()}}},[e]),C.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const x=u?.zIndex??50;return d.jsxs(j,{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:x},onClick:g?t:void 0,children:[d.jsx(j,{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),d.jsxs(j,{ref:p,className:`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-h-[90vh] max-w-[calc(100vw-2rem)] overflow-hidden ${i}`,style:{width:c,...u?{...u,zIndex:void 0}:{}},onClick:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[(r||n||l)&&d.jsxs(j,{className:"flex items-center justify-between p-4",children:[(r||n)&&d.jsxs(j,{id:"modal-title",className:"flex items-center gap-3 text-lg font-semibold text-gray-900 dark:text-white",children:[n&&d.jsx(ge,{name:n,size:"md",className:o}),r]}),l&&d.jsx(J,{onClick:t,className:"ml-auto text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 focus:outline-none","aria-label":Ug("common.close_modal"),children:d.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),d.jsx(j,{className:"px-6 py-4 overflow-y-auto max-h-[calc(90vh-140px)]",children:h})]})]})},zg=Object.freeze(Object.defineProperty({__proto__:null,Modal:ga},Symbol.toStringTag,{value:"Module"})),ha=(e,t)=>window.G7Core?.t?.(e,t)??e,pa=({isOpen:e,onClose:t,title:r,message:n,confirmText:o,cancelText:a,onConfirm:s,onCancel:l,confirmButtonVariant:f="primary",cancelButtonVariant:h="secondary",width:c="500px",closeOnOverlay:i=!0,isLoading:u=!1,loadingText:g})=>{const p=o??ha("common.confirm"),m=a??ha("common.cancel"),x=g??ha("common.loading"),k=()=>{s()},M=()=>{u||(l?.(),t())},v=()=>{u||t()},E={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-600",danger:"bg-red-600 text-white hover:bg-red-700",ghost:"bg-transparent text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"};return d.jsxs(ga,{isOpen:e,onClose:v,title:r,width:c,children:[d.jsx(j,{className:"py-2",children:typeof n=="string"?d.jsx(Ut,{className:"text-gray-700 dark:text-gray-300",children:n}):n}),d.jsxs(j,{className:"flex justify-end gap-3 mt-6",children:[d.jsx(J,{onClick:M,disabled:u,className:"px-4 py-2 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed",children:d.jsx(te,{children:m})}),d.jsxs(J,{onClick:k,disabled:u,className:`flex items-center gap-2 px-4 py-2 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed ${E[f]}`,children:[u&&d.jsx(Ot,{className:"fa-solid fa-spinner w-4 h-4 animate-spin"}),d.jsx(te,{children:u?x:p})]})]})]})},Hg=Object.freeze(Object.defineProperty({__proto__:null,ConfirmDialog:pa},Symbol.toStringTag,{value:"Module"})),si=C.createContext(null),li=({value:e,children:t})=>d.jsx(si.Provider,{value:e,children:t}),Gg=()=>{const e=C.useContext(si);if(!e)throw new Error("useFileUploaderContext must be used within FileUploaderProvider");return e};function jg(e,t){return t.forEach((function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach((function(n){if(n!=="default"&&!(n in e)){var o=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return r[n]}})}}))})),Object.freeze(e)}function ii(e,t){return new Promise((function(r,n){let o;return Bg(e).then((function(a){try{return o=a,r(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(s){return n(s)}}),n)}))}const Bg=e=>new Promise(((t,r)=>{const n=new FileReader;n.addEventListener("load",(({target:{result:o}})=>{const a=new DataView(o);let s=0;if(a.getUint16(s)!==65496)return r("not a valid JPEG");for(s+=2;;){const l=a.getUint16(s);if(l===65498)break;const f=a.getUint16(s+2);if(l===65505&&a.getUint32(s+4)===1165519206){const h=s+10;let c;switch(a.getUint16(h)){case 18761:c=!0;break;case 19789:c=!1;break;default:return r("TIFF header contains invalid endian")}if(a.getUint16(h+2,c)!==42)return r("TIFF header contains invalid version");const i=a.getUint32(h+4,c),u=h+i+2+12*a.getUint16(h+i,c);for(let g=h+i+2;g>>24&255,l[s+1]=f>>>16&255,l[s+2]=f>>>8&255,l[s+3]=f>>>0&255,new Uint8Array(l.buffer,0,s+4)},n.deflateRaw=function(o,a){a==null&&(a={level:6});var s=new Uint8Array(50+Math.floor(1.1*o.length)),l=n.F.deflateRaw(o,s,l,a.level);return new Uint8Array(s.buffer,0,l)},n.encode=function(o,a){a==null&&(a=!1);var s=0,l=n.bin.writeUint,f=n.bin.writeUshort,h={};for(var c in o){var i=!n._noNeed(c)&&!a,u=o[c],g=n.crc.crc(u,0,u.length);h[c]={cpr:i,usize:u.length,crc:g,file:i?n.deflateRaw(u):u}}for(var c in h)s+=h[c].file.length+30+46+2*n.bin.sizeUTF8(c);s+=22;var p=new Uint8Array(s),m=0,x=[];for(var c in h){var k=h[c];x.push(m),m=n._writeHeader(p,m,c,k,0)}var M=0,v=m;for(var c in h)k=h[c],x.push(m),m=n._writeHeader(p,m,c,k,1,x[M++]);var E=m-v;return l(p,m,101010256),m+=4,f(p,m+=4,M),f(p,m+=2,M),l(p,m+=2,E),l(p,m+=4,v),m+=4,m+=2,p.buffer},n._noNeed=function(o){var a=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(a)!=-1},n._writeHeader=function(o,a,s,l,f,h){var c=n.bin.writeUint,i=n.bin.writeUshort,u=l.file;return c(o,a,f==0?67324752:33639248),a+=4,f==1&&(a+=2),i(o,a,20),i(o,a+=2,0),i(o,a+=2,l.cpr?8:0),c(o,a+=2,0),c(o,a+=4,l.crc),c(o,a+=4,u.length),c(o,a+=4,l.usize),i(o,a+=4,n.bin.sizeUTF8(s)),i(o,a+=2,0),a+=2,f==1&&(a+=2,a+=2,c(o,a+=6,h),a+=4),a+=n.bin.writeUTF8(o,a,s),f==0&&(o.set(u,a),a+=u.length),a},n.crc={table:(function(){for(var o=new Uint32Array(256),a=0;a<256;a++){for(var s=a,l=0;l<8;l++)1&s?s=3988292384^s>>>1:s>>>=1;o[a]=s}return o})(),update:function(o,a,s,l){for(var f=0;f>6,o[a+f+1]=128|c>>0&63,f+=2;else if((4294901760&c)==0)o[a+f]=224|c>>12,o[a+f+1]=128|c>>6&63,o[a+f+2]=128|c>>0&63,f+=3;else{if((4292870144&c)!=0)throw"e";o[a+f]=240|c>>18,o[a+f+1]=128|c>>12&63,o[a+f+2]=128|c>>6&63,o[a+f+3]=128|c>>0&63,f+=4}}return f},sizeUTF8:function(o){for(var a=o.length,s=0,l=0;l>>3}var x=h.lits,k=h.strt,M=h.prev,v=0,E=0,O=0,S=0,A=0,w=0;for(m>2&&(k[w=n.F._hash(o,0)]=0),u=0;u>>1,138))<11?a.push(17,g-3):a.push(18,g-11),l+=2*g-2}else if(f==i&&h==f&&c==f){for(u=l+5;u+2>>1,6);a.push(16,g-3),l+=2*g-2}else a.push(f,0)}return s>>>1},n.F._hufTree=function(o,a,s){var l=[],f=o.length,h=a.length,c=0;for(c=0;cF&&(F=D)}T+=3*S,i(p.itree,F),u(p.itree,F,p.imap),x=p.lmap,k=p.dmap,T=c(p.imap,(1<>>4;if(p<=15)h[u]=p,u++;else{var m=0,x=0;p==16?(x=3+c(l,f,2),f+=2,m=h[u-1]):p==17?(x=3+c(l,f,3),f+=3):p==18&&(x=11+c(l,f,7),f+=7);for(var k=u+x;uf&&(f=i),h++}for(;h>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)&(1<>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16)>>>(7&a)},n.F._get25=function(o,a){return(o[a>>>3]|o[1+(a>>>3)]<<8|o[2+(a>>>3)]<<16|o[3+(a>>>3)]<<24)>>>(7&a)},n.F.U=(t=Uint16Array,r=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new r(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new r(286),dhst:new r(30),ihst:new r(19),lits:new r(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=n.F.U,a=0;a<32768;a++){var s=a;s=(4278255360&(s=(4042322160&(s=(3435973836&(s=(2863311530&s)>>>1|(1431655765&s)<<1))>>>2|(858993459&s)<<2))>>>4|(252645135&s)<<4))>>>8|(16711935&s)<<8,o.rev15[a]=(s>>>16|s<<16)>>>17}function l(f,h,c){for(;h--!=0;)f.push(0,c)}for(a=0;a<32;a++)o.ldef[a]=o.of0[a]<<3|o.exb[a],o.ddef[a]=o.df0[a]<<4|o.dxb[a];l(o.fltree,144,8),l(o.fltree,112,9),l(o.fltree,24,7),l(o.fltree,8,8),n.F.makeCodes(o.fltree,9),n.F.codes2map(o.fltree,9,o.flmap),n.F.revCodes(o.fltree,9),l(o.fdtree,32,5),n.F.makeCodes(o.fdtree,5),n.F.codes2map(o.fdtree,5,o.fdmap),n.F.revCodes(o.fdtree,5),l(o.itree,19,0),l(o.ltree,286,0),l(o.dtree,30,0),l(o.ttree,320,0)})()})();var Vg=jg({__proto__:null,default:Bn},[Bn]);const Wt=(function(){var e={nextZero(c,i){for(;c[i]!=0;)i++;return i},readUshort:(c,i)=>c[i]<<8|c[i+1],writeUshort(c,i,u){c[i]=u>>8&255,c[i+1]=255&u},readUint:(c,i)=>16777216*c[i]+(c[i+1]<<16|c[i+2]<<8|c[i+3]),writeUint(c,i,u){c[i]=u>>24&255,c[i+1]=u>>16&255,c[i+2]=u>>8&255,c[i+3]=255&u},readASCII(c,i,u){let g="";for(let p=0;pc.length<2?`0${c}`:c,readUTF8(c,i,u){let g,p="";for(let m=0;m>3)]>>7-((7&S)<<0)&1);k[y]=U[D],k[y+1]=U[D+1],k[y+2]=U[D+2],k[y+3]=Lr(o),n.readAsArrayBuffer(e)}))}function bi(e,t){const{width:r}=e,{height:n}=e,{maxWidthOrHeight:o}=t;let a,s=e;return isFinite(o)&&(r>o||n>o)&&([s,a]=Vn(r,n),r>n?(s.width=o,s.height=n/r*o):(s.width=r/n*o,s.height=o),a.drawImage(e,0,0,s.width,s.height),qt(e)),s}function yi(e,t){const{width:r}=e,{height:n}=e,[o,a]=Vn(r,n);switch(t>4&&t<9?(o.width=n,o.height=r):(o.width=r,o.height=n),t){case 2:a.transform(-1,0,0,1,r,0);break;case 3:a.transform(-1,0,0,-1,r,n);break;case 4:a.transform(1,0,0,-1,0,n);break;case 5:a.transform(0,1,1,0,0,0);break;case 6:a.transform(0,1,-1,0,n,0);break;case 7:a.transform(0,-1,-1,0,n,r);break;case 8:a.transform(0,-1,1,0,0,r)}return a.drawImage(e,0,0,r,n),qt(e),o}function vi(e,t,r=0){return new Promise((function(n,o){let a,s,l,f,h,c,i,u,g,p,m,x,k,M,v,E,O,S,A,w;function y(I=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;a+=I,t.onProgress(Math.min(a,100))}function T(I){if(t.signal&&t.signal.aborted)throw t.signal.reason;a=Math.min(Math.max(I,a),100),t.onProgress(a)}return a=r,s=t.maxIteration||10,l=1024*t.maxSizeMB*1024,y(),Yn(e,t).then(function(I){try{return[,f]=I,y(),h=bi(f,t),y(),new Promise((function(F,D){var L;if(!(L=t.exifOrientation))return mi(e).then(function(_){try{return L=_,$.call(this)}catch(b){return D(b)}}.bind(this),D);function $(){return F(L)}return $.call(this)})).then(function(F){try{return c=F,y(),Gr().then(function(D){try{return i=D?h:yi(h,c),y(),u=t.initialQuality||1,g=t.fileType||e.type,Xn(i,g,e.name,e.lastModified,u).then(function(L){try{{let _=function(){if(s--&&(v>l||v>k)){let z,U;return z=w?.95*A.width:A.width,U=w?.95*A.height:A.height,[O,S]=Vn(z,U),S.drawImage(A,0,0,z,U),u*=g==="image/png"?.85:.95,Xn(O,g,e.name,e.lastModified,u).then((function(H){try{return E=H,qt(A),A=O,v=E.size,T(Math.min(99,Math.floor((M-v)/(M-l)*100))),_}catch(Y){return o(Y)}}),o)}return[1]},b=function(){return qt(A),qt(O),qt(h),qt(i),qt(f),T(100),n(E)};if(p=L,y(),m=p.size>l,x=p.size>e.size,!m&&!x)return T(100),n(p);var $;return k=e.size,M=p.size,v=M,A=i,w=!t.alwaysKeepResolution&&m,($=function(z){for(;z;){if(z.then)return void z.then($,o);try{if(z.pop){if(z.length)return z.pop()?b.call(this):z;z=_}else z=z.call(this)}catch(U){return o(U)}}}.bind(this))(_)}}catch(_){return o(_)}}.bind(this),o)}catch(L){return o(L)}}.bind(this),o)}catch(D){return o(D)}}.bind(this),o)}catch(F){return o(F)}}.bind(this),o)}))}const Xg=`
let scriptImported = false
self.addEventListener('message', async (e) => {
const { file, id, imageCompressionLibUrl, options } = e.data
@@ -58,20 +59,20 @@ self.addEventListener('message', async (e) => {
self.postMessage({ error: e.message + '\\n' + e.stack, id })
}
})
-`;let oa;function cg(e,t){return new Promise(((r,n)=>{oa||(oa=(function(s){const l=[];return l.push(s),URL.createObjectURL(new Blob(l))})(ig));const o=new Worker(oa);o.addEventListener("message",(function(s){if(t.signal&&t.signal.aborted)o.terminate();else if(s.data.progress===void 0){if(s.data.error)return n(new Error(s.data.error)),void o.terminate();r(s.data.file),o.terminate()}else t.onProgress(s.data.progress)})),o.addEventListener("error",n),t.signal&&t.signal.addEventListener("abort",(()=>{n(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function ct(e,t){return new Promise((function(r,n){let o,a,s,l,f,h;if(o={...t},s=0,{onProgress:l}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,f=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=g=>{s=g,typeof l=="function"&&l(s)},!(e instanceof Blob||e instanceof lg))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return n(new Error("The file given is not an image"));if(h=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!f||typeof Worker!="function"||h)return Xl(e,o).then(function(g){try{return a=g,u.call(this)}catch(p){return n(p)}}.bind(this),n);var c=function(){try{return u.call(this)}catch(g){return n(g)}}.bind(this),i=function(g){try{return Xl(e,o).then((function(p){try{return a=p,c()}catch(m){return n(m)}}),n)}catch(p){return n(p)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",cg(e,o).then((function(g){try{return a=g,c()}catch{return i()}}),i)}catch{i()}function u(){try{a.name=e.name,a.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(a=Fl(e,a))}catch{}return r(a)}}))}ct.getDataUrlFromFile=Gl,ct.getFilefromDataUrl=na,ct.loadImage=jl,ct.drawImageInCanvas=Wl,ct.drawFileInCanvas=Pn,ct.canvasToFile=$n,ct.getExifOrientation=Vl,ct.handleMaxWidthOrHeight=Kl,ct.followExifOrientation=Yl,ct.cleanupCanvasMemory=Kt,ct.isAutoOrientationInBrowser=Nr,ct.approximateBelowMaximumCanvasSizeOfBrowser=Bl,ct.copyExifWithoutOrientation=Fl,ct.getBrowserName=fr,ct.version="2.0.2";const dg=window.G7Core,Fn=e=>{const t=["B","KB","MB","GB"];let r=0,n=e;for(;n>=1024&&rSe.map(_e=>_e.id===ve.id?{..._e,status:"uploading",progress:0}:_e));try{const Se=await Me(ve);if(Se)se.push(Se),ie.set(String(ve.id),String(Se.hash)),L.current.set(Se.id,Se),x(_e=>_e.filter(Ue=>Ue.id!==ve.id)),_(_e=>[..._e,Se]),K(_e=>{if(_e.length===0)return _e;const Ue=String(ve.id);return _e.some(Ee=>String(Ee)===Ue)?_e.map(Ee=>String(Ee)===Ue?String(Se.hash):Ee):_e}),ve.preview&&URL.revokeObjectURL(ve.preview);else{const _e=Re("attachment.upload_response_invalid");x(Ue=>Ue.map(je=>je.id===ve.id?{...je,status:"error",error:_e}:je)),m?.(`[${ve.original_filename}] ${_e}`,ve.file)}}catch(Se){const _e=Se instanceof Error?Se.message:"업로드 실패";x(Ue=>Ue.map(je=>je.id===ve.id?{...je,status:"error",error:_e}:je)),m?.(`[${ve.original_filename}] ${_e}`,ve.file)}finally{P.current--}}},Te=Array(Math.min(s,X.length)).fill(null).map(()=>ne());if(await Promise.all(Te),se.length>0&&(p?.(se),u.reorder&&B.length>0&&C)){const ve=[...I,...se],Se=B.map(je=>ie.get(String(je))??je),_e=new Map(Se.map((je,Ee)=>[String(je),Ee])),Ue=[...ve].sort((je,Ee)=>{const he=_e.get(String(je.hash))??ve.length,Ne=_e.get(String(Ee.hash))??ve.length;return he-Ne}).map((je,Ee)=>({...je,sort_order:Ee,order:Ee+1}));C(Ue)}return se},[M,s,Me,p,m,B,I,C,u.reorder]);k.useEffect(()=>{if(!O)return;const X=gr.componentEvent.on(O,async()=>{const se=await Ce();return{uploadedAttachments:se,existingFiles:I,allFiles:[...I,...se]}});return()=>{X()}},[O,Ce,I]),k.useEffect(()=>{c&&M.some(X=>X.status==="pending")&&Ce()},[c,M,Ce]);const we=k.useCallback(async X=>{G(!0);try{if(X.id&&u.delete){const ie=u.delete.replace(":id",String(X.id));await gr.api.delete(ie)}const se=X.hash||X.id;X.id&&(D.current.add(X.id),L.current.delete(X.id)),X.hash&&D.current.add(X.hash),_(ie=>ie.filter(le=>(le.hash||le.id)!==se)),w?.(X.hash||X.id),S(!1),F(null)}catch{console.error("첨부파일 삭제 실패")}finally{G(!1)}},[w,u.delete]),Fe=k.useCallback(async X=>{"hash"in X?v?(F(X),S(!0)):await we(X):(X.preview&&URL.revokeObjectURL(X.preview),x(se=>se.filter(ie=>ie.id!==X.id)))},[v,we]),Le=k.useCallback(X=>{x(se=>se.map(ie=>ie.id===X.id?{...ie,status:"pending",error:void 0}:ie))},[]),V=k.useCallback(async X=>{const{arrayMove:se}=await Promise.resolve().then(()=>Vh),{active:ie,over:le}=X;if(!le||ie.id===le.id)return;const ne=[...I,...M];let Te;if(B.length===0)Te=ne;else{const he=new Map(B.map((Ne,Ke)=>[String(Ne),Ke]));Te=[...ne].sort((Ne,Ke)=>{const $e="hash"in Ne?String(Ne.hash):String(Ne.id),Be="hash"in Ke?String(Ke.hash):String(Ke.id);return(he.get($e)??ne.length)-(he.get(Be)??ne.length)})}const ve=Te.findIndex(he=>"hash"in he?he.hash===ie.id:he.id===ie.id),Se=Te.findIndex(he=>"hash"in he?he.hash===le.id:he.id===le.id),_e=se(Te,ve,Se);K(_e.map(he=>"hash"in he?he.hash:he.id));const Ue=_e.filter(he=>"hash"in he),je=_e.filter(he=>!("hash"in he));Y.current=!0,_(Ue),x(je);const Ee=Ue.map((he,Ne)=>({...he,sort_order:Ne,order:Ne+1}));if(Ue.length>0&&u.reorder){const he=Ue.map((Ne,Ke)=>({id:Ne.id,order:Ke+1}));try{const Ne=await gr.api.patch(u.reorder,{order:he});gr.toast.success(Ne.message)}catch(Ne){const Ke=Ne instanceof Error?Ne.message:Re("attachment.reorder_failed");gr.toast.error(Ke)}}C?.(Ee)},[I,M,B,u.reorder,C]),re=k.useMemo(()=>[...I,...M].filter(X=>"is_image"in X?X.is_image:X.mime_type?.startsWith("image/")??!1),[I,M]),oe=k.useCallback(X=>{const se=re.findIndex(ie=>"hash"in X&&"hash"in ie?ie.hash===X.hash:"id"in X&&"id"in ie&&!("hash"in X)&&!("hash"in ie)?ie.id===X.id:!1);se!==-1&&(fe.current+=1,te(se),q(!0))},[re]);k.useEffect(()=>{let X=!1;return(async()=>{const ie=I.filter(ne=>ne.is_image),le=new Set(ie.map(ne=>ne.id));for(const[ne,Te]of me.current)le.has(ne)||(URL.revokeObjectURL(Te),me.current.delete(ne));for(const ne of ie){if(X)break;if(!me.current.has(ne.id))try{const Te=await gr.api.get(ne.download_url,{responseType:"blob"});if(!X&&Te){const ve=URL.createObjectURL(Te);me.current.set(ne.id,ve),ke(new Map(me.current))}}catch(Te){console.error("Failed to load authenticated image:",Te)}}})(),()=>{X=!0}},[I]),k.useEffect(()=>()=>{me.current.forEach(X=>URL.revokeObjectURL(X)),me.current.clear()},[]);const ae=k.useCallback(async X=>{const{executeImageDownload:se}=await Promise.resolve().then(()=>Nl);await se({src:X.download_url,downloadUrl:X.download_url,filename:X.original_filename,downloadRequiresAuth:!0})},[]),be=k.useMemo(()=>{const X=[...I,...M];if(B.length===0)return X;const se=new Map(B.map((ie,le)=>[String(ie),le]));return[...X].sort((ie,le)=>{const ne="hash"in ie?String(ie.hash):String(ie.id),Te="hash"in le?String(le.hash):String(le.id),ve=se.get(ne)??X.length,Se=se.get(Te)??X.length;return ve-Se})},[I,M,B]),xe=be.length,He=xe>0,Pe=xeEe.map(we=>we.id===Se.id?{...we,status:"uploading",progress:0}:we));try{const Ee=await Pe(Se);if(Ee)le.push(Ee),he.set(String(Se.id),String(Ee.hash)),L.current.set(Ee.id,Ee),w(we=>we.filter(He=>He.id!==Se.id)),S(we=>[...we,Ee]),X(we=>{if(we.length===0)return we;const He=String(Se.id);return we.some(Ne=>String(Ne)===He)?we.map(Ne=>String(Ne)===He?String(Ee.hash):Ne):we}),Se.preview&&URL.revokeObjectURL(Se.preview);else{const we=nt("attachment.upload_response_invalid");w(He=>He.map(Ve=>Ve.id===Se.id?{...Ve,status:"error",error:we}:Ve)),m?.(`[${Se.original_filename}] ${we}`,Se.file)}}catch(Ee){const we=Ee instanceof Error?Ee.message:"업로드 실패";w(He=>He.map(Ve=>Ve.id===Se.id?{...Ve,status:"error",error:we}:Ve)),m?.(`[${Se.original_filename}] ${we}`,Se.file)}finally{F.current--}}},Le=Array(Math.min(s,Z.length)).fill(null).map(()=>fe());if(await Promise.all(Le),le.length>0&&(p?.(le),u.reorder&&B.length>0&&k)){const Se=[...O,...le],Ee=B.map(Ve=>he.get(String(Ve))??Ve),we=new Map(Ee.map((Ve,Ne)=>[String(Ve),Ne])),He=[...Se].sort((Ve,Ne)=>{const xe=we.get(String(Ve.hash))??Se.length,Ie=we.get(String(Ne.hash))??Se.length;return xe-Ie}).map((Ve,Ne)=>({...Ve,sort_order:Ne,order:Ne+1}));k(He)}return le},[A,s,Pe,p,m,B,O,k,u.reorder]);C.useEffect(()=>{if(!M)return;const Z=Cr.componentEvent.on(M,async()=>{const le=await Ae();return{uploadedAttachments:le,existingFiles:O,allFiles:[...O,...le]}});return()=>{Z()}},[M,Ae,O]),C.useEffect(()=>{c&&A.some(Z=>Z.status==="pending")&&Ae()},[c,A,Ae]);const ke=C.useCallback(async Z=>{H(!0);try{if(Z.id&&u.delete){const he=u.delete.replace(":id",String(Z.id));await Cr.api.delete(he)}const le=Z.hash||Z.id;Z.id&&(D.current.add(Z.id),L.current.delete(Z.id)),Z.hash&&D.current.add(Z.hash),S(he=>he.filter(ue=>(ue.hash||ue.id)!==le)),x?.(Z.hash||Z.id),_(!1),z(null)}catch{console.error("첨부파일 삭제 실패")}finally{H(!1)}},[x,u.delete]),je=C.useCallback(async Z=>{"hash"in Z?v?(z(Z),_(!0)):await ke(Z):(Z.preview&&URL.revokeObjectURL(Z.preview),w(le=>le.filter(he=>he.id!==Z.id)))},[v,ke]),$e=C.useCallback(Z=>{w(le=>le.map(he=>he.id===Z.id?{...he,status:"pending",error:void 0}:he))},[]),V=C.useCallback(async Z=>{const{arrayMove:le}=await Promise.resolve().then(()=>M0),{active:he,over:ue}=Z;if(!ue||he.id===ue.id)return;const fe=[...O,...A];let Le;if(B.length===0)Le=fe;else{const xe=new Map(B.map((Ie,We)=>[String(Ie),We]));Le=[...fe].sort((Ie,We)=>{const Je="hash"in Ie?String(Ie.hash):String(Ie.id),Be="hash"in We?String(We.hash):String(We.id);return(xe.get(Je)??fe.length)-(xe.get(Be)??fe.length)})}const Se=Le.findIndex(xe=>"hash"in xe?xe.hash===he.id:xe.id===he.id),Ee=Le.findIndex(xe=>"hash"in xe?xe.hash===ue.id:xe.id===ue.id),we=le(Le,Se,Ee);X(we.map(xe=>"hash"in xe?xe.hash:xe.id));const He=we.filter(xe=>"hash"in xe),Ve=we.filter(xe=>!("hash"in xe));Y.current=!0,S(He),w(Ve);const Ne=He.map((xe,Ie)=>({...xe,sort_order:Ie,order:Ie+1}));if(He.length>0&&u.reorder){const xe=He.map((Ie,We)=>({id:Ie.id,order:We+1}));try{const Ie=await Cr.api.patch(u.reorder,{order:xe});Cr.toast.success(Ie.message)}catch(Ie){const We=Ie instanceof Error?Ie.message:nt("attachment.reorder_failed");Cr.toast.error(We)}}k?.(Ne)},[O,A,B,u.reorder,k]),oe=C.useMemo(()=>[...O,...A].filter(Z=>"is_image"in Z?Z.is_image:Z.mime_type?.startsWith("image/")??!1),[O,A]),re=C.useCallback(Z=>{const le=oe.findIndex(he=>"hash"in Z&&"hash"in he?he.hash===Z.hash:"id"in Z&&"id"in he&&!("hash"in Z)&&!("hash"in he)?he.id===Z.id:!1);le!==-1&&(pe.current+=1,se(le),Q(!0))},[oe]);C.useEffect(()=>{let Z=!1;return(async()=>{const he=O.filter(fe=>fe.is_image),ue=new Set(he.map(fe=>fe.id));for(const[fe,Le]of ve.current)ue.has(fe)||(URL.revokeObjectURL(Le),ve.current.delete(fe));for(const fe of he){if(Z)break;if(!ve.current.has(fe.id))try{const Le=await Cr.api.get(fe.download_url,{responseType:"blob"});if(!Z&&Le){const Se=URL.createObjectURL(Le);ve.current.set(fe.id,Se),ce(new Map(ve.current))}}catch(Le){console.error("Failed to load authenticated image:",Le)}}})(),()=>{Z=!0}},[O]),C.useEffect(()=>()=>{ve.current.forEach(Z=>URL.revokeObjectURL(Z)),ve.current.clear()},[]);const ae=C.useCallback(async Z=>{const{executeImageDownload:le}=await Promise.resolve().then(()=>Rl);await le({src:Z.download_url,downloadUrl:Z.download_url,filename:Z.original_filename,downloadRequiresAuth:!0})},[]),be=C.useMemo(()=>{const Z=[...O,...A];if(B.length===0)return Z;const le=new Map(B.map((he,ue)=>[String(he),ue]));return[...Z].sort((he,ue)=>{const fe="hash"in he?String(he.hash):String(he.id),Le="hash"in ue?String(ue.hash):String(ue.id),Se=le.get(fe)??Z.length,Ee=le.get(Le)??Z.length;return Se-Ee})},[O,A,B]),Me=be.length,Xe=Me>0,Fe=Me