@swan-admin/swan-web-component 1.0.72 → 1.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Header-Bf7ClSfT.js +32 -0
- package/dist/Header-Bf7ClSfT.js.map +1 -0
- package/dist/Header-C65iSMsF.js +32 -0
- package/dist/Header-C65iSMsF.js.map +1 -0
- package/dist/LoadingScreen-C9vDF8N6.js +12 -0
- package/dist/LoadingScreen-C9vDF8N6.js.map +1 -0
- package/dist/LoadingScreen-CDhtnDGT.js +12 -0
- package/dist/LoadingScreen-CDhtnDGT.js.map +1 -0
- package/dist/LoadingScreen-DFKUWqQS.js +12 -0
- package/dist/LoadingScreen-DFKUWqQS.js.map +1 -0
- package/dist/LoadingScreen-DGyU-r8n.js +12 -0
- package/dist/LoadingScreen-DGyU-r8n.js.map +1 -0
- package/dist/bodyScan.d.ts +2 -2
- package/dist/bodyScan.js +2 -2
- package/dist/bodyScan.js.map +1 -1
- package/dist/bodyScan.mjs +2 -2
- package/dist/bodyScan.mjs.map +1 -1
- package/dist/createSvgIcon-CSumJvXf.js +2 -0
- package/dist/createSvgIcon-CSumJvXf.js.map +1 -0
- package/dist/createSvgIcon-KYNE9Cmr.js +2 -0
- package/dist/createSvgIcon-KYNE9Cmr.js.map +1 -0
- package/dist/faceScan.d.ts +2 -2
- package/dist/faceScan.js +1 -1
- package/dist/faceScan.js.map +1 -1
- package/dist/faceScan.mjs +1 -1
- package/dist/faceScan.mjs.map +1 -1
- package/dist/index-B23Mlqqj.js +5068 -0
- package/dist/index-B23Mlqqj.js.map +1 -0
- package/dist/index-CenJi_ia.js +4686 -0
- package/dist/index-CenJi_ia.js.map +1 -0
- package/dist/index-D0NFHRX9.js +5068 -0
- package/dist/index-D0NFHRX9.js.map +1 -0
- package/dist/index-slG-fgu8.js +4684 -0
- package/dist/index-slG-fgu8.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interfaces-C9CQpzhP.d.ts +142 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import*as e from"react";import{M as t,L as r,t as s,N as n,B as i,D as o,O as a,Q as l,P as c,m as u,R as h,a2 as d,r as p,o as f,p as m,a3 as g,$ as y,Z as w,n as b,q as v,H as E,x as S,a0 as O,G as T,Y as _,K as P,a1 as k,aQ as A,b5 as R,b6 as C,b7 as x}from"./Header-C65iSMsF.js";import{jsx as j}from"react/jsx-runtime";function U(e){return"function"==typeof e?e():e}function F(e,t,r){const s=function(e,t,r){const s=t.getBoundingClientRect(),n=r&&r.getBoundingClientRect(),o=i(t);let a;if(t.fakeTransform)a=t.fakeTransform;else{const e=o.getComputedStyle(t);a=e.getPropertyValue("-webkit-transform")||e.getPropertyValue("transform")}let l=0,c=0;if(a&&"none"!==a&&"string"==typeof a){const e=a.split("(")[1].split(")")[0].split(",");l=parseInt(e[4],10),c=parseInt(e[5],10)}return"left"===e?n?`translateX(${n.right+l-s.left}px)`:`translateX(${o.innerWidth+l-s.left}px)`:"right"===e?n?`translateX(-${s.right-n.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:"up"===e?n?`translateY(${n.bottom+c-s.top}px)`:`translateY(${o.innerHeight+c-s.top}px)`:n?`translateY(-${s.top-n.top+s.height-c}px)`:`translateY(-${s.top+s.height-c}px)`}(e,t,U(r));s&&(t.style.webkitTransform=s,t.style.transform=s)}const N=e.forwardRef(function(c,u){const h=t(),d={enter:h.transitions.easing.easeOut,exit:h.transitions.easing.sharp},p={enter:h.transitions.duration.enteringScreen,exit:h.transitions.duration.leavingScreen},{addEndListener:f,appear:m=!0,children:g,container:y,direction:w="down",easing:b=d,in:v,onEnter:E,onEntered:S,onEntering:O,onExit:T,onExited:_,onExiting:P,style:k,timeout:A=p,TransitionComponent:R=r,...C}=c,x=e.useRef(null),U=s(n(g),x,u),N=e=>t=>{e&&(void 0===t?e(x.current):e(x.current,t))},I=N((e,t)=>{F(w,e,y),l(e),E&&E(e,t)}),L=N((e,t)=>{const r=a({timeout:A,style:k,easing:b},{mode:"enter"});e.style.webkitTransition=h.transitions.create("-webkit-transform",{...r}),e.style.transition=h.transitions.create("transform",{...r}),e.style.webkitTransform="none",e.style.transform="none",O&&O(e,t)}),$=N(S),M=N(P),B=N(e=>{const t=a({timeout:A,style:k,easing:b},{mode:"exit"});e.style.webkitTransition=h.transitions.create("-webkit-transform",t),e.style.transition=h.transitions.create("transform",t),F(w,e,y),T&&T(e)}),D=N(e=>{e.style.webkitTransition="",e.style.transition="",_&&_(e)}),q=e.useCallback(()=>{x.current&&F(w,x.current,y)},[w,y]);return e.useEffect(()=>{if(v||"down"===w||"right"===w)return;const e=o(()=>{x.current&&F(w,x.current,y)}),t=i(x.current);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[w,v,y]),e.useEffect(()=>{v||q()},[v,q]),j(R,{nodeRef:x,onEnter:I,onEntered:$,onEntering:L,onExit:B,onExited:D,onExiting:M,addEndListener:e=>{f&&f(x.current,e)},appear:m,in:v,timeout:A,...C,children:(t,{ownerState:r,...s})=>e.cloneElement(g,{ref:U,style:{visibility:"exited"!==t||v?void 0:"hidden",...k,...g.props.style},...s})})});function I(e){return p("MuiDrawer",e)}"production"!==process.env.NODE_ENV&&(N.propTypes={addEndListener:c.func,appear:c.bool,children:h.isRequired,container:u(c.oneOfType([d,c.func]),e=>{if(e.open){const t=U(e.container);if(t&&1===t.nodeType){const e=t.getBoundingClientRect();if("test"!==process.env.NODE_ENV&&0===e.top&&0===e.left&&0===e.right&&0===e.bottom)return new Error(["MUI: The `container` prop provided to the component is invalid.","The anchor element should be part of the document layout.","Make sure the element is present in the document or that it's not display none."].join("\n"))}else if(!t||"function"!=typeof t.getBoundingClientRect||null!=t.contextElement&&1!==t.contextElement.nodeType)return new Error(["MUI: The `container` prop provided to the component is invalid.","It should be an HTML element instance."].join("\n"))}return null}),direction:c.oneOf(["down","left","right","up"]),easing:c.oneOfType([c.shape({enter:c.string,exit:c.string}),c.string]),in:c.bool,onEnter:c.func,onEntered:c.func,onEntering:c.func,onExit:c.func,onExited:c.func,onExiting:c.func,style:c.object,timeout:c.oneOfType([c.number,c.shape({appear:c.number,enter:c.number,exit:c.number})])}),f("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const L=(e,t)=>{const{ownerState:r}=e;return[t.root,("permanent"===r.variant||"persistent"===r.variant)&&t.docked,t.modal]},$=v(O,{name:"MuiDrawer",slot:"Root",overridesResolver:L})(T(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),M=v("div",{shouldForwardProp:P,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:L})({flex:"0 0 auto"}),B=v(_,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:r}=e;return[t.paper,t[`paperAnchor${E(r.anchor)}`],"temporary"!==r.variant&&t[`paperAnchorDocked${E(r.anchor)}`]]}})(T(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:e})=>"left"===e.anchor&&"temporary"!==e.variant,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"top"===e.anchor&&"temporary"!==e.variant,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"right"===e.anchor&&"temporary"!==e.variant,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>"bottom"===e.anchor&&"temporary"!==e.variant,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),D={left:"right",right:"left",top:"down",bottom:"up"};const q=e.forwardRef(function(r,s){const n=m({props:r,name:"MuiDrawer"}),i=t(),o=g(),a={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:l="left",BackdropProps:c,children:u,className:h,elevation:d=16,hideBackdrop:p=!1,ModalProps:{BackdropProps:f,...v}={},onClose:O,open:T=!1,PaperProps:_={},SlideProps:P,TransitionComponent:k,transitionDuration:A=a,variant:R="temporary",slots:C={},slotProps:x={},...U}=n,F=e.useRef(!1);e.useEffect(()=>{F.current=!0},[]);const L=function({direction:e},t){return"rtl"===e&&function(e){return["left","right"].includes(e)}(t)?D[t]:t}({direction:o?"rtl":"ltr"},l),q=l,z={...n,anchor:q,elevation:d,open:T,variant:R,...U},W=(e=>{const{classes:t,anchor:r,variant:s}=e,n={root:["root",`anchor${E(r)}`],docked:[("permanent"===s||"persistent"===s)&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${E(r)}`,"temporary"!==s&&`paperAnchorDocked${E(r)}`]};return S(n,I,t)})(z),H={slots:{transition:k,...C},slotProps:{paper:_,transition:P,...x,backdrop:y(x.backdrop||{...c,...f},{transitionDuration:A})}},[K,V]=w("root",{ref:s,elementType:$,className:b(W.root,W.modal,h),shouldForwardComponentProp:!0,ownerState:z,externalForwardedProps:{...H,...U,...v},additionalProps:{open:T,onClose:O,hideBackdrop:p,slots:{backdrop:H.slots.backdrop},slotProps:{backdrop:H.slotProps.backdrop}}}),[X,J]=w("paper",{elementType:B,shouldForwardComponentProp:!0,className:b(W.paper,_.className),ownerState:z,externalForwardedProps:H,additionalProps:{elevation:"temporary"===R?d:0,square:!0,..."temporary"===R&&{role:"dialog","aria-modal":"true"}}}),[Y,G]=w("docked",{elementType:M,ref:s,className:b(W.root,W.docked,h),ownerState:z,externalForwardedProps:H,additionalProps:U}),[Q,Z]=w("transition",{elementType:N,ownerState:z,externalForwardedProps:H,additionalProps:{in:T,direction:D[L],timeout:A,appear:F.current}}),ee=j(X,{...J,children:u});if("permanent"===R)return j(Y,{...G,children:ee});const te=j(Q,{...Z,children:ee});return"persistent"===R?j(Y,{...G,children:te}):j(K,{...V,children:te})});function z(e,t){return function(){return e.apply(t,arguments)}}"production"!==process.env.NODE_ENV&&(q.propTypes={anchor:c.oneOf(["bottom","left","right","top"]),BackdropProps:c.object,children:c.node,classes:c.object,className:c.string,elevation:k,hideBackdrop:c.bool,ModalProps:c.object,onClose:c.func,open:c.bool,PaperProps:c.object,SlideProps:c.object,slotProps:c.shape({backdrop:c.oneOfType([c.func,c.object]),docked:c.oneOfType([c.func,c.object]),paper:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object]),transition:c.oneOfType([c.func,c.object])}),slots:c.shape({backdrop:c.elementType,docked:c.elementType,paper:c.elementType,root:c.elementType,transition:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),transitionDuration:c.oneOfType([c.number,c.shape({appear:c.number,enter:c.number,exit:c.number})]),variant:c.oneOf(["permanent","persistent","temporary"])});const{toString:W}=Object.prototype,{getPrototypeOf:H}=Object,{iterator:K,toStringTag:V}=Symbol,X=(e=>t=>{const r=W.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),J=e=>(e=e.toLowerCase(),t=>X(t)===e),Y=e=>t=>typeof t===e,{isArray:G}=Array,Q=Y("undefined");function Z(e){return null!==e&&!Q(e)&&null!==e.constructor&&!Q(e.constructor)&&re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ee=J("ArrayBuffer");const te=Y("string"),re=Y("function"),se=Y("number"),ne=e=>null!==e&&"object"==typeof e,ie=e=>{if("object"!==X(e))return!1;const t=H(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||V in e||K in e)},oe=J("Date"),ae=J("File"),le=J("Blob"),ce=J("FileList"),ue=J("URLSearchParams"),[he,de,pe,fe]=["ReadableStream","Request","Response","Headers"].map(J);function me(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let s,n;if("object"!=typeof e&&(e=[e]),G(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{if(Z(e))return;const n=r?Object.getOwnPropertyNames(e):Object.keys(e),i=n.length;let o;for(s=0;s<i;s++)o=n[s],t.call(null,e[o],o,e)}}function ge(e,t){if(Z(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s,n=r.length;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,we=e=>!Q(e)&&e!==ye;const be=(ve="undefined"!=typeof Uint8Array&&H(Uint8Array),e=>ve&&e instanceof ve);var ve;const Ee=J("HTMLFormElement"),Se=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Oe=J("RegExp"),Te=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};me(r,(r,n)=>{let i;!1!==(i=t(r,n,e))&&(s[n]=i||r)}),Object.defineProperties(e,s)};const _e=J("AsyncFunction"),Pe=(ke="function"==typeof setImmediate,Ae=re(ye.postMessage),ke?setImmediate:Ae?(Re=`axios@${Math.random()}`,Ce=[],ye.addEventListener("message",({source:e,data:t})=>{e===ye&&t===Re&&Ce.length&&Ce.shift()()},!1),e=>{Ce.push(e),ye.postMessage(Re,"*")}):e=>setTimeout(e));var ke,Ae,Re,Ce;const xe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ye):"undefined"!=typeof process&&process.nextTick||Pe;var je={isArray:G,isArrayBuffer:ee,isBuffer:Z,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||re(e.append)&&("formdata"===(t=X(e))||"object"===t&&re(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ee(e.buffer),t},isString:te,isNumber:se,isBoolean:e=>!0===e||!1===e,isObject:ne,isPlainObject:ie,isEmptyObject:e=>{if(!ne(e)||Z(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:he,isRequest:de,isResponse:pe,isHeaders:fe,isUndefined:Q,isDate:oe,isFile:ae,isBlob:le,isRegExp:Oe,isFunction:re,isStream:e=>ne(e)&&re(e.pipe),isURLSearchParams:ue,isTypedArray:be,isFileList:ce,forEach:me,merge:function e(){const{caseless:t,skipUndefined:r}=we(this)&&this||{},s={},n=(n,i)=>{const o=t&&ge(s,i)||i;ie(s[o])&&ie(n)?s[o]=e(s[o],n):ie(n)?s[o]=e({},n):G(n)?s[o]=n.slice():r&&Q(n)||(s[o]=n)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&me(arguments[e],n);return s},extend:(e,t,r,{allOwnKeys:s}={})=>(me(t,(t,s)=>{r&&re(t)?e[s]=z(t,r):e[s]=t},{allOwnKeys:s}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,s)=>{let n,i,o;const a={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),i=n.length;i-- >0;)o=n[i],s&&!s(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&H(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:X,kindOfTest:J,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return-1!==s&&s===r},toArray:e=>{if(!e)return null;if(G(e))return e;let t=e.length;if(!se(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[K]).call(e);let s;for(;(s=r.next())&&!s.done;){const r=s.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const s=[];for(;null!==(r=e.exec(t));)s.push(r);return s},isHTMLForm:Ee,hasOwnProperty:Se,hasOwnProp:Se,reduceDescriptors:Te,freezeMethods:e=>{Te(e,(t,r)=>{if(re(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const s=e[r];re(s)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},s=e=>{e.forEach(e=>{r[e]=!0})};return G(e)?s(e):s(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ge,global:ye,isContextDefined:we,isSpecCompliantForm:function(e){return!!(e&&re(e.append)&&"FormData"===e[V]&&e[K])},toJSONObject:e=>{const t=new Array(10),r=(e,s)=>{if(ne(e)){if(t.indexOf(e)>=0)return;if(Z(e))return e;if(!("toJSON"in e)){t[s]=e;const n=G(e)?[]:{};return me(e,(e,t)=>{const i=r(e,s+1);!Q(i)&&(n[t]=i)}),t[s]=void 0,n}}return e};return r(e,0)},isAsyncFn:_e,isThenable:e=>e&&(ne(e)||re(e))&&re(e.then)&&re(e.catch),setImmediate:Pe,asap:xe,isIterable:e=>null!=e&&re(e[K])};function Ue(e,t,r,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}je.inherits(Ue,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.status}}});const Fe=Ue.prototype,Ne={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ne[e]={value:e}}),Object.defineProperties(Ue,Ne),Object.defineProperty(Fe,"isAxiosError",{value:!0}),Ue.from=(e,t,r,s,n,i)=>{const o=Object.create(Fe);je.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",l=null==t&&e?e.code:t;return Ue.call(o,a,l,r,s,n),e&&null==o.cause&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};function Ie(e){return je.isPlainObject(e)||je.isArray(e)}function Le(e){return je.endsWith(e,"[]")?e.slice(0,-2):e}function $e(e,t,r){return e?e.concat(t).map(function(e,t){return e=Le(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Me=je.toFlatObject(je,{},null,function(e){return/^is[A-Z]/.test(e)});function Be(e,t,r){if(!je.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const s=(r=je.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!je.isUndefined(t[e])})).metaTokens,n=r.visitor||c,i=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&je.isSpecCompliantForm(t);if(!je.isFunction(n))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(je.isDate(e))return e.toISOString();if(je.isBoolean(e))return e.toString();if(!a&&je.isBlob(e))throw new Ue("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(e)||je.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,n){let a=e;if(e&&!n&&"object"==typeof e)if(je.endsWith(r,"{}"))r=s?r:r.slice(0,-2),e=JSON.stringify(e);else if(je.isArray(e)&&function(e){return je.isArray(e)&&!e.some(Ie)}(e)||(je.isFileList(e)||je.endsWith(r,"[]"))&&(a=je.toArray(e)))return r=Le(r),a.forEach(function(e,s){!je.isUndefined(e)&&null!==e&&t.append(!0===o?$e([r],s,i):null===o?r:r+"[]",l(e))}),!1;return!!Ie(e)||(t.append($e(n,r,i),l(e)),!1)}const u=[],h=Object.assign(Me,{defaultVisitor:c,convertValue:l,isVisitable:Ie});if(!je.isObject(e))throw new TypeError("data must be an object");return function e(r,s){if(!je.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+s.join("."));u.push(r),je.forEach(r,function(r,i){!0===(!(je.isUndefined(r)||null===r)&&n.call(t,r,je.isString(i)?i.trim():i,s,h))&&e(r,s?s.concat(i):[i])}),u.pop()}}(e),t}function De(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function qe(e,t){this._pairs=[],e&&Be(e,this,t)}const ze=qe.prototype;function We(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function He(e,t,r){if(!t)return e;const s=r&&r.encode||We;je.isFunction(r)&&(r={serialize:r});const n=r&&r.serialize;let i;if(i=n?n(t,r):je.isURLSearchParams(t)?t.toString():new qe(t,r).toString(s),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}ze.append=function(e,t){this._pairs.push([e,t])},ze.toString=function(e){const t=e?function(t){return e.call(this,t,De)}:De;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Ke{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){je.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Ve={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Xe={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:qe,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Je="undefined"!=typeof window&&"undefined"!=typeof document,Ye="object"==typeof navigator&&navigator||void 0,Ge=Je&&(!Ye||["ReactNative","NativeScript","NS"].indexOf(Ye.product)<0),Qe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ze=Je&&window.location.href||"http://localhost";var et={...Object.freeze({__proto__:null,hasBrowserEnv:Je,hasStandardBrowserEnv:Ge,hasStandardBrowserWebWorkerEnv:Qe,navigator:Ye,origin:Ze}),...Xe};function tt(e){function t(e,r,s,n){let i=e[n++];if("__proto__"===i)return!0;const o=Number.isFinite(+i),a=n>=e.length;if(i=!i&&je.isArray(s)?s.length:i,a)return je.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!o;s[i]&&je.isObject(s[i])||(s[i]=[]);return t(e,r,s[i],n)&&je.isArray(s[i])&&(s[i]=function(e){const t={},r=Object.keys(e);let s;const n=r.length;let i;for(s=0;s<n;s++)i=r[s],t[i]=e[i];return t}(s[i])),!o}if(je.isFormData(e)&&je.isFunction(e.entries)){const r={};return je.forEachEntry(e,(e,s)=>{t(function(e){return je.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),s,r,0)}),r}return null}const rt={transitional:Ve,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,n=je.isObject(e);n&&je.isHTMLForm(e)&&(e=new FormData(e));if(je.isFormData(e))return s?JSON.stringify(tt(e)):e;if(je.isArrayBuffer(e)||je.isBuffer(e)||je.isStream(e)||je.isFile(e)||je.isBlob(e)||je.isReadableStream(e))return e;if(je.isArrayBufferView(e))return e.buffer;if(je.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Be(e,new et.classes.URLSearchParams,{visitor:function(e,t,r,s){return et.isNode&&je.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=je.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Be(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||s?(t.setContentType("application/json",!1),function(e,t,r){if(je.isString(e))try{return(t||JSON.parse)(e),je.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||rt.transitional,r=t&&t.forcedJSONParsing,s="json"===this.responseType;if(je.isResponse(e)||je.isReadableStream(e))return e;if(e&&je.isString(e)&&(r&&!this.responseType||s)){const r=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw Ue.from(e,Ue.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:et.classes.FormData,Blob:et.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};je.forEach(["delete","get","head","post","put","patch"],e=>{rt.headers[e]={}});const st=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const nt=Symbol("internals");function it(e){return e&&String(e).trim().toLowerCase()}function ot(e){return!1===e||null==e?e:je.isArray(e)?e.map(ot):String(e)}function at(e,t,r,s,n){return je.isFunction(s)?s.call(this,t,r):(n&&(t=r),je.isString(t)?je.isString(s)?-1!==t.indexOf(s):je.isRegExp(s)?s.test(t):void 0:void 0)}let lt=class{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function n(e,t,r){const n=it(t);if(!n)throw new Error("header name must be a non-empty string");const i=je.findKey(s,n);(!i||void 0===s[i]||!0===r||void 0===r&&!1!==s[i])&&(s[i||t]=ot(e))}const i=(e,t)=>je.forEach(e,(e,r)=>n(e,r,t));if(je.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(je.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let r,s,n;return e&&e.split("\n").forEach(function(e){n=e.indexOf(":"),r=e.substring(0,n).trim().toLowerCase(),s=e.substring(n+1).trim(),!r||t[r]&&st[r]||("set-cookie"===r?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t})(e),t);else if(je.isObject(e)&&je.isIterable(e)){let r,s,n={};for(const t of e){if(!je.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[s=t[0]]=(r=n[s])?je.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}i(n,t)}else null!=e&&n(t,e,r);return this}get(e,t){if(e=it(e)){const r=je.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}(e);if(je.isFunction(t))return t.call(this,e,r);if(je.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=it(e)){const r=je.findKey(this,e);return!(!r||void 0===this[r]||t&&!at(0,this[r],r,t))}return!1}delete(e,t){const r=this;let s=!1;function n(e){if(e=it(e)){const n=je.findKey(r,e);!n||t&&!at(0,r[n],n,t)||(delete r[n],s=!0)}}return je.isArray(e)?e.forEach(n):n(e),s}clear(e){const t=Object.keys(this);let r=t.length,s=!1;for(;r--;){const n=t[r];e&&!at(0,this[n],n,e,!0)||(delete this[n],s=!0)}return s}normalize(e){const t=this,r={};return je.forEach(this,(s,n)=>{const i=je.findKey(r,n);if(i)return t[i]=ot(s),void delete t[n];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(n):String(n).trim();o!==n&&delete t[n],t[o]=ot(s),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return je.forEach(this,(r,s)=>{null!=r&&!1!==r&&(t[s]=e&&je.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[nt]=this[nt]={accessors:{}}).accessors,r=this.prototype;function s(e){const s=it(e);t[s]||(!function(e,t){const r=je.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(e,r,n){return this[s].call(this,t,e,r,n)},configurable:!0})})}(r,e),t[s]=!0)}return je.isArray(e)?e.forEach(s):s(e),this}};function ct(e,t){const r=this||rt,s=t||r,n=lt.from(s.headers);let i=s.data;return je.forEach(e,function(e){i=e.call(r,i,n.normalize(),t?t.status:void 0)}),n.normalize(),i}function ut(e){return!(!e||!e.__CANCEL__)}function ht(e,t,r){Ue.call(this,null==e?"canceled":e,Ue.ERR_CANCELED,t,r),this.name="CanceledError"}function dt(e,t,r){const s=r.config.validateStatus;r.status&&s&&!s(r.status)?t(new Ue("Request failed with status code "+r.status,[Ue.ERR_BAD_REQUEST,Ue.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}lt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),je.reduceDescriptors(lt.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),je.freezeMethods(lt),je.inherits(ht,Ue,{__CANCEL__:!0});const pt=(e,t,r=3)=>{let s=0;const n=function(e,t){e=e||10;const r=new Array(e),s=new Array(e);let n,i=0,o=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=s[o];n||(n=l),r[i]=a,s[i]=l;let u=o,h=0;for(;u!==i;)h+=r[u++],u%=e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-n<t)return;const d=c&&l-c;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let r,s,n=0,i=1e3/t;const o=(t,i=Date.now())=>{n=i,r=null,s&&(clearTimeout(s),s=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-n;a>=i?o(e,t):(r=e,s||(s=setTimeout(()=>{s=null,o(r)},i-a)))},()=>r&&o(r)]}(r=>{const i=r.loaded,o=r.lengthComputable?r.total:void 0,a=i-s,l=n(a);s=i;e({loaded:i,total:o,progress:o?i/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&i<=o?(o-i)/l:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},ft=(e,t)=>{const r=null!=e;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},mt=e=>(...t)=>je.asap(()=>e(...t));var gt=et.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,et.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(et.origin),et.navigator&&/(msie|trident)/i.test(et.navigator.userAgent)):()=>!0,yt=et.hasStandardBrowserEnv?{write(e,t,r,s,n,i,o){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];je.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),je.isString(s)&&a.push(`path=${s}`),je.isString(n)&&a.push(`domain=${n}`),!0===i&&a.push("secure"),je.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function wt(e,t,r){let s=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(s||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const bt=e=>e instanceof lt?{...e}:e;function vt(e,t){t=t||{};const r={};function s(e,t,r,s){return je.isPlainObject(e)&&je.isPlainObject(t)?je.merge.call({caseless:s},e,t):je.isPlainObject(t)?je.merge({},t):je.isArray(t)?t.slice():t}function n(e,t,r,n){return je.isUndefined(t)?je.isUndefined(e)?void 0:s(void 0,e,0,n):s(e,t,0,n)}function i(e,t){if(!je.isUndefined(t))return s(void 0,t)}function o(e,t){return je.isUndefined(t)?je.isUndefined(e)?void 0:s(void 0,e):s(void 0,t)}function a(r,n,i){return i in t?s(r,n):i in e?s(void 0,r):void 0}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t,r)=>n(bt(e),bt(t),0,!0)};return je.forEach(Object.keys({...e,...t}),function(s){const i=l[s]||n,o=i(e[s],t[s],s);je.isUndefined(o)&&i!==a||(r[s]=o)}),r}var Et=e=>{const t=vt({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=lt.from(o),t.url=He(wt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),je.isFormData(r))if(et.hasStandardBrowserEnv||et.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(je.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&o.set(e,r)})}if(et.hasStandardBrowserEnv&&(s&&je.isFunction(s)&&(s=s(t)),s||!1!==s&>(t.url))){const e=n&&i&&yt.read(i);e&&o.set(n,e)}return t};var St="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const s=Et(e);let n=s.data;const i=lt.from(s.headers).normalize();let o,a,l,c,u,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=s;function f(){c&&c(),u&&u(),s.cancelToken&&s.cancelToken.unsubscribe(o),s.signal&&s.signal.removeEventListener("abort",o)}let m=new XMLHttpRequest;function g(){if(!m)return;const s=lt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());dt(function(e){t(e),f()},function(e){r(e),f()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:s,config:e,request:m}),m=null}m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(r(new Ue("Request aborted",Ue.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const s=new Ue(t&&t.message?t.message:"Network Error",Ue.ERR_NETWORK,e,m);s.event=t||null,r(s),m=null},m.ontimeout=function(){let t=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const n=s.transitional||Ve;s.timeoutErrorMessage&&(t=s.timeoutErrorMessage),r(new Ue(t,n.clarifyTimeoutError?Ue.ETIMEDOUT:Ue.ECONNABORTED,e,m)),m=null},void 0===n&&i.setContentType(null),"setRequestHeader"in m&&je.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),je.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),h&&"json"!==h&&(m.responseType=s.responseType),p&&([l,u]=pt(p,!0),m.addEventListener("progress",l)),d&&m.upload&&([a,c]=pt(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(s.cancelToken||s.signal)&&(o=t=>{m&&(r(!t||t.type?new ht(null,e,m):t),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(o),s.signal&&(s.signal.aborted?o():s.signal.addEventListener("abort",o)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(s.url);y&&-1===et.protocols.indexOf(y)?r(new Ue("Unsupported protocol "+y+":",Ue.ERR_BAD_REQUEST,e)):m.send(n||null)})};const Ot=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,s=new AbortController;const n=function(e){if(!r){r=!0,o();const t=e instanceof Error?e:this.reason;s.abort(t instanceof Ue?t:new ht(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,n(new Ue(`timeout ${t} of ms exceeded`,Ue.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(n):e.removeEventListener("abort",n)}),e=null)};e.forEach(e=>e.addEventListener("abort",n));const{signal:a}=s;return a.unsubscribe=()=>je.asap(o),a}},Tt=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let s,n=0;for(;n<r;)s=n+t,yield e.slice(n,s),n=s},_t=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Pt=(e,t,r,s)=>{const n=async function*(e,t){for await(const r of _t(e))yield*Tt(r,t)}(e,t);let i,o=0,a=e=>{i||(i=!0,s&&s(e))};return new ReadableStream({async pull(e){try{const{done:t,value:s}=await n.next();if(t)return a(),void e.close();let i=s.byteLength;if(r){let e=o+=i;r(e)}e.enqueue(new Uint8Array(s))}catch(e){throw a(e),e}},cancel:e=>(a(e),n.return())},{highWaterMark:2})},{isFunction:kt}=je,At=(({Request:e,Response:t})=>({Request:e,Response:t}))(je.global),{ReadableStream:Rt,TextEncoder:Ct}=je.global,xt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},jt=e=>{e=je.merge.call({skipUndefined:!0},At,e);const{fetch:t,Request:r,Response:s}=e,n=t?kt(t):"function"==typeof fetch,i=kt(r),o=kt(s);if(!n)return!1;const a=n&&kt(Rt),l=n&&("function"==typeof Ct?(c=new Ct,e=>c.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var c;const u=i&&a&&xt(()=>{let e=!1;const t=new r(et.origin,{body:new Rt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=o&&a&&xt(()=>je.isReadableStream(new s("").body)),d={stream:h&&(e=>e.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,r)=>{let s=t&&t[e];if(s)return s.call(t);throw new Ue(`Response type '${e}' is not supported`,Ue.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const s=je.toFiniteNumber(e.getContentLength());return null==s?(async e=>{if(null==e)return 0;if(je.isBlob(e))return e.size;if(je.isSpecCompliantForm(e)){const t=new r(et.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return je.isArrayBufferView(e)||je.isArrayBuffer(e)?e.byteLength:(je.isURLSearchParams(e)&&(e+=""),je.isString(e)?(await l(e)).byteLength:void 0)})(t):s};return async e=>{let{url:n,method:o,data:a,signal:l,cancelToken:c,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:w,withCredentials:b="same-origin",fetchOptions:v}=Et(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let S=Ot([l,c&&c.toAbortSignal()],f),O=null;const T=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let _;try{if(g&&u&&"get"!==o&&"head"!==o&&0!==(_=await p(w,a))){let e,t=new r(n,{method:"POST",body:a,duplex:"half"});if(je.isFormData(a)&&(e=t.headers.get("content-type"))&&w.setContentType(e),t.body){const[e,r]=ft(_,pt(mt(g)));a=Pt(t.body,65536,e,r)}}je.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in r.prototype,l={...v,signal:S,method:o.toUpperCase(),headers:w.normalize().toJSON(),body:a,duplex:"half",credentials:t?b:void 0};O=i&&new r(n,l);let c=await(i?E(O,v):E(n,l));const f=h&&("stream"===y||"response"===y);if(h&&(m||f&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=je.toFiniteNumber(c.headers.get("content-length")),[r,n]=m&&ft(t,pt(mt(m),!0))||[];c=new s(Pt(c.body,65536,r,()=>{n&&n(),T&&T()}),e)}y=y||"text";let P=await d[je.findKey(d,y)||"text"](c,e);return!f&&T&&T(),await new Promise((t,r)=>{dt(t,r,{data:P,headers:lt.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:O})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ue("Network Error",Ue.ERR_NETWORK,e,O),{cause:t.cause||t});throw Ue.from(t,t&&t.code,e,O)}}},Ut=new Map,Ft=e=>{let t=e&&e.env||{};const{fetch:r,Request:s,Response:n}=t,i=[s,n,r];let o,a,l=i.length,c=Ut;for(;l--;)o=i[l],a=c.get(o),void 0===a&&c.set(o,a=l?new Map:jt(t)),c=a;return a};Ft();const Nt={http:null,xhr:St,fetch:{get:Ft}};je.forEach(Nt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const It=e=>`- ${e}`,Lt=e=>je.isFunction(e)||null===e||!1===e;var $t={getAdapter:function(e,t){e=je.isArray(e)?e:[e];const{length:r}=e;let s,n;const i={};for(let o=0;o<r;o++){let r;if(s=e[o],n=s,!Lt(s)&&(n=Nt[(r=String(s)).toLowerCase()],void 0===n))throw new Ue(`Unknown adapter '${r}'`);if(n&&(je.isFunction(n)||(n=n.get(t))))break;i[r||"#"+o]=n}if(!n){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Ue("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(It).join("\n"):" "+It(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n},adapters:Nt};function Mt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ht(null,e)}function Bt(e){Mt(e),e.headers=lt.from(e.headers),e.data=ct.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return $t.getAdapter(e.adapter||rt.adapter,e)(e).then(function(t){return Mt(e),t.data=ct.call(e,e.transformResponse,t),t.headers=lt.from(t.headers),t},function(t){return ut(t)||(Mt(e),t&&t.response&&(t.response.data=ct.call(e,e.transformResponse,t.response),t.response.headers=lt.from(t.response.headers))),Promise.reject(t)})}const Dt="1.13.2",qt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{qt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const zt={};qt.transitional=function(e,t,r){function s(e,t){return"[Axios v"+Dt+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,i)=>{if(!1===e)throw new Ue(s(n," has been removed"+(t?" in "+t:"")),Ue.ERR_DEPRECATED);return t&&!zt[n]&&(zt[n]=!0,console.warn(s(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,i)}},qt.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Wt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Ue("options must be an object",Ue.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const i=s[n],o=t[i];if(o){const t=e[i],r=void 0===t||o(t,i,e);if(!0!==r)throw new Ue("option "+i+" must be "+r,Ue.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Ue("Unknown option "+i,Ue.ERR_BAD_OPTION)}},validators:qt};const Ht=Wt.validators;let Kt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ke,response:new Ke}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=vt(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:n}=t;void 0!==r&&Wt.assertOptions(r,{silentJSONParsing:Ht.transitional(Ht.boolean),forcedJSONParsing:Ht.transitional(Ht.boolean),clarifyTimeoutError:Ht.transitional(Ht.boolean)},!1),null!=s&&(je.isFunction(s)?t.paramsSerializer={serialize:s}:Wt.assertOptions(s,{encode:Ht.function,serialize:Ht.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Wt.assertOptions(t,{baseUrl:Ht.spelling("baseURL"),withXsrfToken:Ht.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=n&&je.merge(n.common,n[t.method]);n&&je.forEach(["delete","get","head","post","put","patch","common"],e=>{delete n[e]}),t.headers=lt.concat(i,n);const o=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let u,h=0;if(!a){const e=[Bt.bind(this),void 0];for(e.unshift(...o),e.push(...l),u=e.length,c=Promise.resolve(t);h<u;)c=c.then(e[h++],e[h++]);return c}u=o.length;let d=t;for(;h<u;){const e=o[h++],t=o[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{c=Bt.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,u=l.length;h<u;)c=c.then(l[h++],l[h++]);return c}getUri(e){return He(wt((e=vt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};je.forEach(["delete","get","head","options"],function(e){Kt.prototype[e]=function(t,r){return this.request(vt(r||{},{method:e,url:t,data:(r||{}).data}))}}),je.forEach(["post","put","patch"],function(e){function t(t){return function(r,s,n){return this.request(vt(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}Kt.prototype[e]=t(),Kt.prototype[e+"Form"]=t(!0)});const Vt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Vt).forEach(([e,t])=>{Vt[t]=e});const Xt=function e(t){const r=new Kt(t),s=z(Kt.prototype.request,r);return je.extend(s,Kt.prototype,r,{allOwnKeys:!0}),je.extend(s,r,null,{allOwnKeys:!0}),s.create=function(r){return e(vt(t,r))},s}(rt);Xt.Axios=Kt,Xt.CanceledError=ht,Xt.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const s=new Promise(e=>{r.subscribe(e),t=e}).then(e);return s.cancel=function(){r.unsubscribe(t)},s},e(function(e,s,n){r.reason||(r.reason=new ht(e,s,n),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Xt.isCancel=ut,Xt.VERSION=Dt,Xt.toFormData=Be,Xt.AxiosError=Ue,Xt.Cancel=Xt.CanceledError,Xt.all=function(e){return Promise.all(e)},Xt.spread=function(e){return function(t){return e.apply(null,t)}},Xt.isAxiosError=function(e){return je.isObject(e)&&!0===e.isAxiosError},Xt.mergeConfig=vt,Xt.AxiosHeaders=lt,Xt.formToJSON=e=>tt(je.isHTMLForm(e)?new FormData(e):e),Xt.getAdapter=$t.getAdapter,Xt.HttpStatusCode=Vt,Xt.default=Xt;const{Axios:Jt,AxiosError:Yt,CanceledError:Gt,isCancel:Qt,CancelToken:Zt,VERSION:er,all:tr,Cancel:rr,isAxiosError:sr,spread:nr,toFormData:ir,AxiosHeaders:or,HttpStatusCode:ar,formToJSON:lr,getAdapter:cr,mergeConfig:ur}=Xt,hr={dev:{APP_AUTH_BASE_URL:"https://develop.api.swanvision.ai",APP_BASE_WEBSOCKET_URL:"wss://develop.wsnotify.api.swanvision.ai",APP_POSE_DETECTION_WEBSOCKET_URL:"https://posedetect-service-staging.ft2a64raup4pg.us-east-1.cs.amazonlightsail.com"},staging:{APP_AUTH_BASE_URL:"https://staging.api.swanvision.ai",APP_BASE_WEBSOCKET_URL:"wss://staging.wsnotify.api.swanvision.ai",APP_POSE_DETECTION_WEBSOCKET_URL:"https://posedetect-service-staging.ft2a64raup4pg.us-east-1.cs.amazonlightsail.com"},prod:{APP_AUTH_BASE_URL:"https://api.swanvision.ai",APP_BASE_WEBSOCKET_URL:"wss://wsnotify.api.swanvision.ai",APP_POSE_DETECTION_WEBSOCKET_URL:"https://posedetect-service.uvcn97hn133d6.eu-west-1.cs.amazonlightsail.com"}},dr="/upload/start",pr="/upload/complete",fr="/upload/signpart",mr="APP_AUTH_BASE_URL",gr="APP_BASE_WEBSOCKET_URL",yr="/user",wr="/auth/register",br="/auth/verify",vr="/user",Er="/customers/custom",Sr="/customers",Or="/model",Tr="/tryon/user-image-urls/upload",_r="/tryon/user-image-urls/download",Pr="/tryon/user-image-urls",kr="/tryon/result-image-urls/download",Ar="/tryon",Rr="/auth",Cr="/scanning",xr="/recommendation",jr="/tryon/share",Ur="/deviceinfo",Fr="/tryon/product-image-eligibility",Nr=["gender","focal_length","height","customer_store_url","callback_url","clothes_fit"],Ir=["gender","focal_length","customer_store_url","scan_type","callback_url","face_scan_id"],Lr="Please verify required parameters",$r="Please verify required parameters in meta data",Mr="Invalid Email",Br=5242880;var Dr;!function(e){e.DEV="dev",e.STAGING="staging",e.PROD="prod"}(Dr||(Dr={}));var qr=function(e,t,r,s){return new(r||(r=Promise))(function(n,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof r?e:new r(function(t){t(e)})}(e.value).then(o,a)}l((s=s.apply(e,t||[])).next())})};function zr(e){return qr(this,void 0,void 0,function*(){const{path:t,body:r,queryParams:s,baseUrl:n=mr,apiKey:i="",throwError:o=!1,headers:a={"X-Api-Key":i,"Content-Type":"application/json"},urlType:l=Dr.PROD}=e,c=`${Xr({urlName:n,urlType:l})}${t}${s?`?${new URLSearchParams(s)}`:""}`;try{const e=yield Xt.post(c,r,{headers:a});if(e.status>=200&&e.status<300)return e.data;if(console.error(`Error: Unexpected response status ${e.status}`),o)throw new Error("Failed to upload");return{}}catch(e){if(console.error(e,"while uploading"),o)throw new Error(`Failed to upload: ${(null==e?void 0:e.message)||"something went wrong"}`);return{}}})}function Wr(...e){for(const t of e)if(!t)return!1;return!0}function Hr(e){if(!Kr(e,Nr))return!1;let t=!1;for(const r of e)r.callback_url&&r.callback_url.startsWith("https")&&(t=!0);return!!t}const Kr=(e,t)=>{for(const r of t){let t=!1;for(const s of e)if(Object.prototype.hasOwnProperty.call(s,r)&&void 0!==s[r]&&null!==s[r]&&""!==s[r]&&"number"!=typeof s[r]){t=!0;break}if(!t)return!1}return!0},Vr=(e,t,r)=>(e.find(e=>e.scan_type)||e.push({scan_type:"clothing_scan"}),e.push({scan_id:t}),e.push({email:r}),e);const Xr=({urlName:e,urlType:t=Dr.PROD})=>hr[t][e],Jr=e=>/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e);var Yr,Gr,Qr,Zr=function(e,t,r,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},es=function(e,t,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class ts{constructor(e,t=Dr.PROD){Yr.set(this,void 0),Gr.set(this,void 0),Qr.set(this,void 0),Zr(this,Gr,e,"f"),Zr(this,Qr,t,"f")}registerUser({email:e,appVerifyUrl:t,gender:r,height:s,username:n}){if(!Wr(e,t))throw new Error(Lr);let i={username:n,email:e,appVerifyUrl:t};return r&&s&&(i=Object.assign(Object.assign({},i),{attributes:{gender:r,height:s}})),Xt.post(`${Xr({urlName:mr,urlType:es(this,Qr,"f")})}${wr}`,i,{headers:{"X-Api-Key":es(this,Gr,"f")}})}verifyToken(e){if(!Wr(e))throw new Error(Lr);return Xt.post(`${Xr({urlName:mr,urlType:es(this,Qr,"f")})}${br}`,null,{params:{token:e},headers:{"X-Api-Key":es(this,Gr,"f")}})}addUser({scanId:e,email:t,name:r,height:s,gender:n,offsetMarketingConsent:i}){if(!Wr(e,t,s,n))throw new Error(Lr);return Xt.post(`${Xr({urlName:mr,urlType:es(this,Qr,"f")})}${vr}`,{scan_id:e,email:t,name:r,offsetMarketingConsent:i,attributes:JSON.stringify({height:s,gender:n})},{headers:{"X-Api-Key":es(this,Gr,"f")}})}getUserDetail(e){if(!Wr(e))throw new Error(Lr);return Xt.get(`${Xr({urlName:mr,urlType:es(this,Qr,"f")})}${yr}/${e}`,{headers:{"X-Api-Key":es(this,Gr,"f")}})}handleAuthSocket({email:e,scanId:t,onError:r,onSuccess:s,onClose:n,onOpen:i}){if(!Wr(e,t))throw new Error(Lr);es(this,Yr,"f")&&es(this,Yr,"f").close(),Zr(this,Yr,new WebSocket(`${Xr({urlName:gr,urlType:es(this,Qr,"f")})}${Rr}`),"f");const o={email:e,scanId:t};es(this,Yr,"f")&&(es(this,Yr,"f").onopen=()=>{var e;null===(e=es(this,Yr,"f"))||void 0===e||e.send(JSON.stringify(o)),null==i||i()},es(this,Yr,"f").onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch(e){return void console.log(t,e,"noy correct format for data")}t=JSON.parse(e.data),null==s||s(t)},es(this,Yr,"f").onclose=()=>{null==n||n()},es(this,Yr,"f").onerror=e=>{null==r||r(e)})}}Yr=new WeakMap,Gr=new WeakMap,Qr=new WeakMap;var rs,ss,ns=function(e,t,r,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},is=function(e,t,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class os{constructor(e,t=Dr.PROD){rs.set(this,void 0),ss.set(this,void 0),this.getCustomCustomerConfig=e=>{if(!1===Wr(e))throw new Error(Lr);return Xt.get(`${Xr({urlName:mr,urlType:is(this,ss,"f")})}${Er}`,{params:{store_url:e},headers:{"X-Api-Key":is(this,rs,"f")}})},this.getModelUrl=e=>{if(!1===Wr(e))throw new Error(Lr);return Xt.get(`${Xr({urlName:mr,urlType:is(this,ss,"f")})}${Or}/${e}`,{headers:{"X-Api-Key":is(this,rs,"f")}})},ns(this,rs,e,"f"),ns(this,ss,t,"f")}createCustomer(e){if(!1===Wr(e.name,e.storeUrl,e.email,e.location))throw new Error(Lr);return Xt.post(`${Xr({urlName:mr,urlType:is(this,ss,"f")})}${Sr}`,Object.assign(Object.assign({},e),{headers:{"X-Api-Key":is(this,rs,"f")}}))}}function as(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}rs=new WeakMap,ss=new WeakMap;var ls=0;function cs(e){return"__private_"+ls+++"_"+e}function us(e,t,r){const s=[];return e.forEach(e=>"string"!=typeof e?s.push(e):t[Symbol.split](e).forEach((e,t,n)=>{""!==e&&s.push(e),t<n.length-1&&s.push(r)})),s}
|
|
2
|
+
/**
|
|
3
|
+
* Takes a string with placeholder variables like `%{smart_count} file selected`
|
|
4
|
+
* and replaces it with values from options `{smart_count: 5}`
|
|
5
|
+
*
|
|
6
|
+
* @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE
|
|
7
|
+
* taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299
|
|
8
|
+
*
|
|
9
|
+
* @param phrase that needs interpolation, with placeholders
|
|
10
|
+
* @param options with values that will be used to replace placeholders
|
|
11
|
+
*/function hs(e,t){const r=/\$/g;let s=[e];if(null==t)return s;for(const e of Object.keys(t))if("_"!==e){let n=t[e];"string"==typeof n&&(n=r[Symbol.replace](n,"$$$$")),s=us(s,new RegExp(`%\\{${e}\\}`,"g"),n)}return s}const ds=e=>{throw new Error(`missing string: ${e}`)};var ps,fs,ms=cs("onMissingKey"),gs=cs("apply");class ys{constructor(e,t){let{onMissingKey:r=ds}=void 0===t?{}:t;Object.defineProperty(this,gs,{value:ws}),Object.defineProperty(this,ms,{writable:!0,value:void 0}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(e)?e.forEach(as(this,gs)[gs],this):as(this,gs)[gs](e),as(this,ms)[ms]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];null==r&&(as(this,ms)[ms](e),r=e);if("object"==typeof r){if(t&&void 0!==t.smart_count){return hs(r[this.locale.pluralize(t.smart_count)],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if("string"!=typeof r)throw new Error("string was not a string");return hs(r,t)}}function ws(e){if(null==e||!e.strings)return;const t=this.locale;Object.assign(this.locale,{strings:{...t.strings,...e.strings},pluralize:e.pluralize||t.pluralize})}var bs=A((fs||(fs=1,ps=function(){var e={},t=e._fns={};return e.emit=function(e,r,s,n,i,o,a){var l=function(e){for(var r=t[e]?t[e]:[],s=e.indexOf(":"),n=-1===s?[e]:[e.substring(0,s),e.substring(s+1)],i=Object.keys(t),o=0,a=i.length;o<a;o++){var l=i[o];if("*"===l&&(r=r.concat(t[l])),2===n.length&&n[0]===l){r=r.concat(t[l]);break}}return r}(e);l.length&&function(e,t,r){for(var s=0,n=t.length;s<n&&t[s];s++)t[s].event=e,t[s].apply(t[s],r)}(e,l,[r,s,n,i,o,a])},e.on=function(e,r){t[e]||(t[e]=[]),t[e].push(r)},e.once=function(t,r){this.on(t,function s(){r.apply(this,arguments),e.off(t,s)})},e.off=function(e,t){var r=[];if(e&&t)for(var s=this._fns[e],n=0,i=s?s.length:0;n<i;n++)s[n]!==t&&r.push(s[n]);r.length?this._fns[e]=r:delete this._fns[e]},e}),ps));var vs,Es,Ss,Os,Ts,_s,Ps,ks,As,Rs,Cs,xs,js,Us,Fs,Ns,Is,Ls,$s,Ms,Bs,Ds,qs,zs,Ws,Hs,Ks,Vs,Xs,Js;function Ys(){if(Es)return vs;return Es=1,vs=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},vs}function Gs(){if(_s)return Ts;_s=1;var e=function(){if(Os)return Ss;Os=1;var e="object"==typeof R&&R&&R.Object===Object&&R;return Ss=e}(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ts=r}function Qs(){if(xs)return Cs;xs=1;var e=function(){if(Rs)return As;Rs=1;var e=/\s/;return As=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}}(),t=/^\s+/;return Cs=function(r){return r?r.slice(0,e(r)+1).replace(t,""):r}}function Zs(){if(Us)return js;Us=1;var e=Gs().Symbol;return js=e}function en(){if(Ms)return $s;Ms=1;var e=Zs(),t=function(){if(Ns)return Fs;Ns=1;var e=Zs(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,n=e?e.toStringTag:void 0;return Fs=function(e){var t=r.call(e,n),i=e[n];try{e[n]=void 0;var o=!0}catch(e){}var a=s.call(e);return o&&(t?e[n]=i:delete e[n]),a},Fs}(),r=function(){if(Ls)return Is;Ls=1;var e=Object.prototype.toString;return Is=function(t){return e.call(t)},Is}(),s=e?e.toStringTag:void 0;return $s=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?t(e):r(e)},$s}function tn(){if(zs)return qs;zs=1;var e=en(),t=(Ds||(Ds=1,Bs=function(e){return null!=e&&"object"==typeof e}),Bs);return qs=function(r){return"symbol"==typeof r||t(r)&&"[object Symbol]"==e(r)},qs}function rn(){if(Vs)return Ks;Vs=1;var e=Ys(),t=function(){if(ks)return Ps;ks=1;var e=Gs();return Ps=function(){return e.Date.now()}}(),r=function(){if(Hs)return Ws;Hs=1;var e=Qs(),t=Ys(),r=tn(),s=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,i=/^0o[0-7]+$/i,o=parseInt;return Ws=function(a){if("number"==typeof a)return a;if(r(a))return NaN;if(t(a)){var l="function"==typeof a.valueOf?a.valueOf():a;a=t(l)?l+"":l}if("string"!=typeof a)return 0===a?a:+a;a=e(a);var c=n.test(a);return c||i.test(a)?o(a.slice(2),c?2:8):s.test(a)?NaN:+a},Ws}(),s=Math.max,n=Math.min;return Ks=function(i,o,a){var l,c,u,h,d,p,f=0,m=!1,g=!1,y=!0;if("function"!=typeof i)throw new TypeError("Expected a function");function w(e){var t=l,r=c;return l=c=void 0,f=e,h=i.apply(r,t)}function b(e){var t=e-p;return void 0===p||t>=o||t<0||g&&e-f>=u}function v(){var e=t();if(b(e))return E(e);d=setTimeout(v,function(e){var t=o-(e-p);return g?n(t,u-(e-f)):t}(e))}function E(e){return d=void 0,y&&l?w(e):(l=c=void 0,h)}function S(){var e=t(),r=b(e);if(l=arguments,c=this,p=e,r){if(void 0===d)return function(e){return f=e,d=setTimeout(v,o),m?w(e):h}(p);if(g)return clearTimeout(d),d=setTimeout(v,o),w(p)}return void 0===d&&(d=setTimeout(v,o)),h}return o=r(o)||0,e(a)&&(m=!!a.leading,u=(g="maxWait"in a)?s(r(a.maxWait)||0,o):u,y="trailing"in a?!!a.trailing:y),S.cancel=function(){void 0!==d&&clearTimeout(d),f=0,l=p=c=d=void 0},S.flush=function(){return void 0===d?h:E(t())},S},Ks}var sn=function(){if(Js)return Xs;Js=1;var e=rn(),t=Ys();return Xs=function(r,s,n){var i=!0,o=!0;if("function"!=typeof r)throw new TypeError("Expected a function");return t(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),e(r,s,{leading:i,maxWait:s,trailing:o})}}(),nn=A(sn);function on(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var an=0;function ln(e){return"__private_"+an+++"_"+e}var cn=ln("callbacks"),un=ln("publish");class hn{constructor(){Object.defineProperty(this,un,{value:dn}),this.state={},Object.defineProperty(this,cn,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},r={...this.state,...e};this.state=r,on(this,un)[un](t,r,e)}subscribe(e){return on(this,cn)[cn].add(e),()=>{on(this,cn)[cn].delete(e)}}}function dn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];on(this,cn)[cn].forEach(e=>{e(...t)})}function pn(e){const t=e.lastIndexOf(".");return-1===t||t===e.length-1?{name:e,extension:void 0}:{name:e.slice(0,t),extension:e.slice(t+1)}}hn.VERSION="3.2.2";var fn={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function mn(e){var t;if(e.type)return e.type;const r=e.name?null==(t=pn(e.name).extension)?void 0:t.toLowerCase():null;return r&&r in fn?fn[r]:"application/octet-stream"}function gn(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}function yn(e,t){if(function(e){return!(!e.isRemote||!e.remote)&&new Set(["box","dropbox","drive","facebook","unsplash"]).has(e.remote.provider)}(e))return e.id;const r=mn(e);return function(e,t){let r=t||"uppy";return"string"==typeof e.name&&(r+=`-${gn(e.name.toLowerCase())}`),void 0!==e.type&&(r+=`-${e.type}`),e.meta&&"string"==typeof e.meta.relativePath&&(r+=`-${gn(e.meta.relativePath.toLowerCase())}`),void 0!==e.data.size&&(r+=`-${e.data.size}`),void 0!==e.data.lastModified&&(r+=`-${e.data.lastModified}`),r}({...e,type:r},t)}function wn(e){if(null==e&&"undefined"!=typeof navigator&&(e=navigator.userAgent),!e)return!0;const t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;const r=t[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||15===s&&n<15063||(s>18||18===s&&n>=18218)}function bn(e){return e<10?`0${e}`:e.toString()}function vn(){const e=new Date;return`${bn(e.getHours())}:${bn(e.getMinutes())}:${bn(e.getSeconds())}`}const En={debug:()=>{},warn:()=>{},error:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return console.error(`[Uppy] [${vn()}]`,...t)}},Sn={debug:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return console.debug(`[Uppy] [${vn()}]`,...t)},warn:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return console.warn(`[Uppy] [${vn()}]`,...t)},error:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return console.error(`[Uppy] [${vn()}]`,...t)}};var On,Tn;var _n,Pn,kn,An,Rn=(Tn||(Tn=1,On=function(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("Expected a number, got "+typeof e);const t=e<0;let r=Math.abs(e);if(t&&(r=-r),0===r)return"0 B";const s=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(r)/Math.log(1024)),s.length-1),i=Number(r/1024**n),o=s[n];return`${i>=10||i%1==0?Math.round(i):i.toFixed(1)} ${o}`}),On),Cn=A(Rn);function xn(){if(Pn)return _n;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return Pn=1,e.prototype.match=function(e){var t,r,s=!0,n=this.parts,i=n.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(r=(e||"").split(this.separator),t=0;s&&t<i;t++)"*"!==n[t]&&(s=t<r.length&&n[t]===r[t]);s=s&&r}else s=!1;else if("function"==typeof e.splice)for(s=[],t=e.length;t--;)this.match(e[t])&&(s[s.length]=e[t]);else if("object"==typeof e)for(var o in s={},e)this.match(o)&&(s[o]=e[o]);return s},_n=function(t,r,s){var n=new e(t,s||/[\/\.]/);return void 0!==r?n.match(r):n},_n}var jn=function(){if(An)return kn;An=1;var e=xn(),t=/[\/\+\.]/;return kn=function(r,s){function n(s){var n=e(s,r,t);return n&&n.length>=2}return s?n(s.split(";")[0]):n},kn}(),Un=A(jn);const Fn={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class Nn extends Error{constructor(e,t){var r;super(e),this.isRestriction=!0,this.isUserFacing=null==(r=null==t?void 0:t.isUserFacing)||r,null!=t&&t.file&&(this.file=t.file)}}class In{constructor(e,t){this.getI18n=t,this.getOpts=()=>{var t;const r=e();if(null!=(null==(t=r.restrictions)?void 0:t.allowedFileTypes)&&!Array.isArray(r.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return r}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s){if(e.filter(e=>!e.isGhost).length+t.length>s)throw new Nn(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`)}if(r){const s=[...e,...t].reduce((e,t)=>{var r;return e+(null!=(r=t.size)?r:0)},0);if(s>r)throw new Nn(this.getI18n()("aggregateExceedsSize",{sizeAllowed:Cn(r),size:Cn(s)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s){if(!s.some(t=>t.includes("/")?!!e.type&&Un(e.type.replace(/;.*?$/,""),t):!("."!==t[0]||!e.extension)&&e.extension.toLowerCase()===t.slice(1).toLowerCase())){const t=s.join(", ");throw new Nn(this.getI18n()("youCanOnlyUploadFileTypes",{types:t}),{file:e})}}if(t&&null!=e.size&&e.size>t)throw new Nn(this.getI18n()("exceedsSize",{size:Cn(t),file:e.name}),{file:e});if(r&&null!=e.size&&e.size<r)throw new Nn(this.getI18n()("inferiorSize",{size:Cn(r)}),{file:e})}validate(e,t){t.forEach(e=>{this.validateSingleFile(e)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){const{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new Nn(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new Nn(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:r}=this.getOpts().restrictions,s=[];for(const t of r)Object.hasOwn(e.meta,t)&&""!==e.meta[t]||s.push(t);return{missingFields:s,error:t}}}var Ln={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed"}};let $n,Mn;function Bn(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Dn=0;function qn(e){return"__private_"+Dn+++"_"+e}const zn={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var Wn=qn("plugins"),Hn=qn("restricter"),Kn=qn("storeUnsubscribe"),Vn=qn("emitter"),Xn=qn("preProcessors"),Jn=qn("uploaders"),Yn=qn("postProcessors"),Gn=qn("informAndEmit"),Qn=qn("checkRequiredMetaFieldsOnFile"),Zn=qn("checkRequiredMetaFields"),ei=qn("assertNewUploadAllowed"),ti=qn("transformFile"),ri=qn("startIfAutoProceed"),si=qn("checkAndUpdateFileState"),ni=qn("addListeners"),ii=qn("updateOnlineStatus"),oi=qn("requestClientById"),ai=qn("createUpload"),li=qn("getUpload"),ci=qn("removeUpload"),ui=qn("runUpload");$n=Symbol.for("uppy test: getPlugins"),Mn=Symbol.for("uppy test: createUpload");class hi{constructor(e){Object.defineProperty(this,ui,{value:Oi}),Object.defineProperty(this,ci,{value:Si}),Object.defineProperty(this,li,{value:Ei}),Object.defineProperty(this,ai,{value:vi}),Object.defineProperty(this,ni,{value:bi}),Object.defineProperty(this,si,{value:wi}),Object.defineProperty(this,ri,{value:yi}),Object.defineProperty(this,ti,{value:gi}),Object.defineProperty(this,ei,{value:mi}),Object.defineProperty(this,Zn,{value:fi}),Object.defineProperty(this,Qn,{value:pi}),Object.defineProperty(this,Gn,{value:di}),Object.defineProperty(this,Wn,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,Hn,{writable:!0,value:void 0}),Object.defineProperty(this,Kn,{writable:!0,value:void 0}),Object.defineProperty(this,Vn,{writable:!0,value:bs()}),Object.defineProperty(this,Xn,{writable:!0,value:new Set}),Object.defineProperty(this,Jn,{writable:!0,value:new Set}),Object.defineProperty(this,Yn,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,this.calculateProgress=nn((e,t)=>{const r=this.getFile(null==e?void 0:e.id);if(null==e||!r)return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);if(100===r.progress.percentage)return void this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);const s=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...r.progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:s?Math.round(t.bytesUploaded/t.bytesTotal*100):0}}),this.calculateTotalProgress()},500,{leading:!0,trailing:!0}),Object.defineProperty(this,ii,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,oi,{writable:!0,value:new Map}),this.defaultLocale=Ln;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Fn,meta:{},onBeforeFileAdded:(e,t)=>!Object.hasOwn(t,e.id),onBeforeUpload:e=>e,store:new hn,logger:En,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=Sn),this.log(`Using Core v${hi.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...zn,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:wn(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Bn(this,Hn)[Hn]=new In(()=>this.opts,()=>this.i18n),Bn(this,Kn)[Kn]=this.store.subscribe((e,t,r)=>{this.emit("state-update",e,t,r),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),Bn(this,ni)[ni]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];Bn(this,Vn)[Vn].emit(e,...r)}on(e,t){return Bn(this,Vn)[Vn].on(e,t),this}once(e,t){return Bn(this,Vn)[Vn].once(e,t),this}off(e,t){return Bn(this,Vn)[Vn].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){const t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(e=>{let[r,s]=e;return[r,{...t[r],...s}]}))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can’t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){const e=new ys([this.defaultLocale,this.opts.locale],{onMissingKey:e=>this.log(`Missing i18n string: ${e}`,"error")});this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.locale=e.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...null==e?void 0:e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){const e={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r={};Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e}}}),this.setState({files:r,...zn}),this.emit("reset-progress")}clearUploadedFiles(){const{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...zn,files:{}})}addPreProcessor(e){Bn(this,Xn)[Xn].add(e)}removePreProcessor(e){return Bn(this,Xn)[Xn].delete(e)}addPostProcessor(e){Bn(this,Yn)[Yn].add(e)}removePostProcessor(e){return Bn(this,Yn)[Yn].delete(e)}addUploader(e){Bn(this,Jn)[Jn].add(e)}removeUploader(e){return Bn(this,Jn)[Jn].delete(e)}setMeta(e){const t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(t=>{r[t]={...r[t],meta:{...r[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){const r={...this.getState().files};if(!r[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(e=>this.getFile(e))}getObjectOfFilesPerState(){const{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],i=[],o=[],a=[],l=[],c=[],u=[],h=[],d=[];for(const e of s){const{progress:t}=e;!t.uploadComplete&&t.uploadStarted&&(n.push(e),e.isPaused||h.push(e)),t.uploadStarted||i.push(e),(t.uploadStarted||t.preprocess||t.postprocess)&&o.push(e),t.uploadStarted&&a.push(e),e.isPaused&&l.push(e),t.uploadComplete&&c.push(e),e.error&&u.push(e),(t.preprocess||t.postprocess)&&d.push(e)}return{newFiles:i,startedFiles:o,uploadStartedFiles:a,pausedFiles:l,completeFiles:c,erroredFiles:u,inProgressFiles:n,inProgressNotPausedFiles:h,processingFiles:d,isUploadStarted:a.length>0,isAllComplete:100===t&&c.length===s.length&&0===d.length,isAllErrored:!!r&&u.length===s.length,isAllPaused:0!==n.length&&l.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{Bn(this,Hn)[Hn].validate(t,[e])}catch(e){return e}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){Bn(this,ei)[ei](e);const{nextFilesState:t,validFilesToAdd:r,errors:s}=Bn(this,si)[si]([e]),n=s.filter(e=>e.isRestriction);if(Bn(this,Gn)[Gn](n),s.length>0)throw s[0];this.setState({files:t});const[i]=r;return this.emit("file-added",i),this.emit("files-added",r),this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`),Bn(this,ri)[ri](),i.id}addFiles(e){Bn(this,ei)[ei]();const{nextFilesState:t,validFilesToAdd:r,errors:s}=Bn(this,si)[si](e),n=s.filter(e=>e.isRestriction);Bn(this,Gn)[Gn](n);const i=s.filter(e=>!e.isRestriction);if(i.length>0){let e="Multiple errors occurred while adding files:\n";if(i.forEach(t=>{e+=`\n * ${t.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:i.length}),details:e},"error",this.opts.infoTimeout),"function"==typeof AggregateError)throw new AggregateError(i,e);{const t=new Error(e);throw t.errors=i,t}}this.setState({files:t}),r.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(e=>{this.log(`Added file: ${e.name}\n id: ${e.id}\n type: ${e.type}`)}),r.length>0&&Bn(this,ri)[ri]()}removeFiles(e,t){const{files:r,currentUploads:s}=this.getState(),n={...r},i={...s},o=Object.create(null);function a(e){return void 0===o[e]}e.forEach(e=>{r[e]&&(o[e]=r[e],delete n[e])}),Object.keys(i).forEach(e=>{const t=s[e].fileIDs.filter(a);if(0===t.length)return void delete i[e];const{capabilities:r}=this.getState();if(t.length!==s[e].fileIDs.length&&!r.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");i[e]={...s[e],fileIDs:t}});const l={currentUploads:i,files:n};0===Object.keys(n).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const c=Object.keys(o);c.forEach(e=>{this.emit("file-removed",o[e],t)}),c.length>5?this.log(`Removed ${c.length} files`):this.log(`Removed files: ${c.join(", ")}`)}removeFile(e,t){this.removeFiles([e],t)}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;const t=!(this.getFile(e).isPaused||!1);return this.setFileState(e,{isPaused:t}),this.emit("upload-pause",e,t),t}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const r={...e[t],isPaused:!0};e[t]=r}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(t=>!e[t].progress.uploadComplete&&e[t].progress.uploadStarted).forEach(t=>{const r={...e[t],isPaused:!1,error:null};e[t]=r}),this.setState({files:e}),this.emit("resume-all")}retryAll(){const e={...this.getState().files},t=Object.keys(e).filter(t=>e[t].error);if(t.forEach(t=>{const r={...e[t],isPaused:!1,error:null};e[t]=r}),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const r=Bn(this,ai)[ai](t,{forceAllowNewUpload:!0});return Bn(this,ui)[ui](r)}cancelAll(e){let{reason:t="user"}=void 0===e?{}:e;if(this.emit("cancel-all",{reason:t}),"user"===t){const{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t,"cancel-all"),this.setState(zn)}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=Bn(this,ai)[ai]([e],{forceAllowNewUpload:!0});return Bn(this,ui)[ui](t)}logout(){this.iteratePlugins(e=>{var t;null==(t=e.provider)||null==t.logout||t.logout()})}calculateTotalProgress(){const e=this.getFiles().filter(e=>e.progress.uploadStarted||e.progress.preprocess||e.progress.postprocess);if(0===e.length)return this.emit("progress",0),void this.setState({totalProgress:0});const t=e.filter(e=>null!=e.progress.bytesTotal),r=e.filter(e=>null==e.progress.bytesTotal);if(0===t.length){const t=100*e.length,s=r.reduce((e,t)=>e+t.progress.percentage,0),n=Math.round(s/t*100);return void this.setState({totalProgress:n})}let s=t.reduce((e,t)=>{var r;return e+(null!=(r=t.progress.bytesTotal)?r:0)},0);const n=s/t.length;s+=n*r.length;let i=0;t.forEach(e=>{i+=e.progress.bytesUploaded}),r.forEach(e=>{i+=n*(e.progress.percentage||0)/100});let o=0===s?0:Math.round(i/s*100);o>100&&(o=100),this.setState({totalProgress:o}),this.emit("progress",o)}updateOnlineStatus(){var e;null==(e=window.navigator.onLine)||e?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e,t){if("function"!=typeof e){throw new TypeError(`Expected a plugin class, but got ${null===e?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`)}const r=new e(this,t),s=r.id;if(!s)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");const n=this.getPlugin(s);if(n){const e=`Already found a plugin named '${n.id}'. Tried to use: '${s}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${s} v${e.VERSION}`),r.type in Bn(this,Wn)[Wn]?Bn(this,Wn)[Wn][r.type].push(r):Bn(this,Wn)[Wn][r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(const t of Object.values(Bn(this,Wn)[Wn])){const r=t.find(t=>t.id===e);if(null!=r)return r}}[$n](e){return Bn(this,Wn)[Wn][e]}iteratePlugins(e){Object.values(Bn(this,Wn)[Wn]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=Bn(this,Wn)[Wn][e.type],r=t.findIndex(t=>t.id===e.id);-1!==r&&t.splice(r,1);const s={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(s)}close(e){let{reason:t}=void 0===e?{}:e;this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll({reason:t}),Bn(this,Kn)[Kn](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",Bn(this,ii)[ii]),window.removeEventListener("offline",Bn(this,ii)[ii]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,r){void 0===t&&(t="info"),void 0===r&&(r=3e3);const s="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){const{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e)}}registerRequestClient(e,t){Bn(this,oi)[oi].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=Bn(this,oi)[oi].get(e.remote.requestClientId);if(null==t)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?Bn(this,ui)[ui](e):(Bn(this,ci)[ci](e),Promise.reject(new Error("Nonexistent upload")))}[Mn](){return Bn(this,ai)[ai](...arguments)}addResultData(e,t){if(!Bn(this,li)[li](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}upload(){var e;null!=(e=Bn(this,Wn)[Wn].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const r=this.opts.onBeforeUpload(t);return!1===r?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&"object"==typeof r&&(t=r,this.setState({files:t})),Promise.resolve().then(()=>Bn(this,Hn)[Hn].validateMinNumberOfFiles(t)).catch(e=>{throw Bn(this,Gn)[Gn]([e]),e}).then(()=>{if(!Bn(this,Zn)[Zn](t))throw new Nn(this.i18n("missingRequiredMetaField"))}).catch(e=>{throw e}).then(()=>{const{currentUploads:e}=this.getState(),r=Object.values(e).flatMap(e=>e.fileIDs),s=[];Object.keys(t).forEach(e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==r.indexOf(e)||s.push(t.id)});const n=Bn(this,ai)[ai](s);return Bn(this,ui)[ui](n)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function di(e){for(const t of e)t.isRestriction?this.emit("restriction-failed",t.file,t):this.emit("error",t,t.file),this.log(t,"warning");const t=e.filter(e=>e.isUserFacing),r=t.slice(0,4),s=t.slice(4);r.forEach(e=>{let{message:t,details:r=""}=e;this.info({message:t,details:r},"error",this.opts.infoTimeout)}),s.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:s.length})})}function pi(e){const{missingFields:t,error:r}=Bn(this,Hn)[Hn].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(r.message),this.emit("restriction-failed",e,r),!1)}function fi(e){let t=!0;for(const r of Object.values(e))Bn(this,Qn)[Qn](r)||(t=!1);return t}function mi(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new Nn(this.i18n("noMoreFilesAllowed"),{file:e});throw Bn(this,Gn)[Gn]([t]),t}}function gi(e){const t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=mn(t),s=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}(r,t),n=pn(s).extension,i=yn(t,this.getID()),o=t.meta||{};o.name=s,o.type=r;const a=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:i,name:s,extension:n||"",meta:{...this.getState().meta,...o},type:r,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:a,uploadComplete:!1,uploadStarted:null},size:a,isGhost:!1,isRemote:t.isRemote||!1,remote:t.remote||"",preview:t.preview}}function yi(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))}function wi(e){const{files:t}=this.getState(),r={...t},s=[],n=[];for(const o of e)try{var i;let e=Bn(this,ti)[ti](o);const n=null==(i=t[e.id])?void 0:i.isGhost;if(n){e={...t[e.id],isGhost:!1,data:o.data},this.log(`Replaced the blob in the restored ghost file: ${e.name}, ${e.id}`)}const a=this.opts.onBeforeFileAdded(e,r);if(!a&&this.checkIfFileAlreadyExists(e.id))throw new Nn(this.i18n("noDuplicates",{fileName:e.name}),{file:o});if(!1===a&&!n)throw new Nn("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});"object"==typeof a&&null!==a&&(e=a),Bn(this,Hn)[Hn].validateSingleFile(e),r[e.id]=e,s.push(e)}catch(e){n.push(e)}try{Bn(this,Hn)[Hn].validateAggregateRestrictions(Object.values(t),s)}catch(e){return n.push(e),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}function bi(){const e=(e,t,r)=>{let s=e.message||"Unknown error";e.details&&(s+=` ${e.details}`),this.setState({error:s}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:s,response:r})};this.on("error",e),this.on("upload-error",(t,r,s)=>{if(e(r,t,s),"object"==typeof r&&r.message){var n;this.log(r.message,"error");const e=new Error(this.i18n("failedToUpload",{file:null!=(n=null==t?void 0:t.name)?n:""}));e.isUserFacing=!0,e.details=r.message,r.details&&(e.details+=` ${r.details}`),Bn(this,Gn)[Gn]([e])}else Bn(this,Gn)[Gn]([r])});let t=null;this.on("upload-stalled",(e,r)=>{const{message:s}=e,n=r.map(e=>e.meta.name).join(", ");t||(this.info({message:s,details:n},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${s} ${n}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const r=e=>{const t=e.filter(e=>{const t=null!=e&&this.getFile(e.id);return t||this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`),t}),r=Object.fromEntries(t.map(e=>[e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}]));this.patchFilesState(r)};this.on("upload-start",e=>{e.forEach(e=>{this.emit("upload-started",e)}),r(e)}),this.on("upload-progress",this.calculateProgress),this.on("upload-success",(e,t)=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const r=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...r,postprocess:Bn(this,Yn)[Yn].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:r.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||r.bytesTotal}),this.calculateTotalProgress()}),this.on("preprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getFile(e.id).progress,preprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("preprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.preprocess,this.setState({files:t})}),this.on("postprocess-progress",(e,t)=>{null!=e&&this.getFile(e.id)?this.setFileState(e.id,{progress:{...this.getState().files[e.id].progress,postprocess:t}}):this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`)}),this.on("postprocess-complete",e=>{if(null==e||!this.getFile(e.id))return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);const t={...this.getState().files};t[e.id]={...t[e.id],progress:{...t[e.id].progress}},delete t[e.id].progress.postprocess,this.setState({files:t})}),this.on("restored",()=>{this.calculateTotalProgress()}),this.on("dashboard:file-edit-complete",e=>{e&&Bn(this,Qn)[Qn](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",Bn(this,ii)[ii]),window.addEventListener("offline",Bn(this,ii)[ii]),setTimeout(Bn(this,ii)[ii],3e3))}function vi(e,t){void 0===t&&(t={});const{forceAllowNewUpload:r=!1}=t,{allowNewUpload:s,currentUploads:n}=this.getState();if(!s&&!r)throw new Error("Cannot create a new upload: already uploading.");const i=((e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t})();return this.emit("upload",{id:i,fileIDs:e}),this.setState({allowNewUpload:!1!==this.opts.allowMultipleUploadBatches&&!1!==this.opts.allowMultipleUploads,currentUploads:{...n,[i]:{fileIDs:e,step:0,result:{}}}}),i}function Ei(e){const{currentUploads:t}=this.getState();return t[e]}function Si(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function Oi(e){const t=()=>{const{currentUploads:t}=this.getState();return t[e]};let r=t();const s=[...Bn(this,Xn)[Xn],...Bn(this,Jn)[Jn],...Bn(this,Yn)[Yn]];try{for(let n=r.step||0;n<s.length&&r;n++){const i=s[n];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...r,step:n}}});const{fileIDs:o}=r;await i(o,e),r=t()}}catch(t){throw Bn(this,ci)[ci](e),t}if(r){r.fileIDs.forEach(e=>{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)});const s=r.fileIDs.map(e=>this.getFile(e)),n=s.filter(e=>!e.error),i=s.filter(e=>e.error);this.addResultData(e,{successful:n,failed:i,uploadID:e}),r=t()}let n;return r&&(n=r.result,this.emit("complete",n),Bn(this,ci)[ci](e)),null==n&&this.log(`Not setting result for an upload that has been removed: ${e}`),n}hi.VERSION="3.13.1";class Ti{constructor(e,t){this.uppy=e,this.opts=null!=t?t:{}}getPluginState(){const{plugins:e}=this.uppy.getState();return(null==e?void 0:e[this.id])||{}}setPluginState(e){const{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new ys([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}class _i extends Error{constructor(){super(...arguments),this.name="UserFacingApiError"}}var Pi,ki,Ai,Ri,Ci,xi={};function ji(){return Ai||(Ai=1,e=xi,t=function(){if(ki)return Pi;function e(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return ki=1,Pi=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var s=this;return this._timer=setTimeout(function(){s._attempts++,s._operationTimeoutCb&&(s._timeout=setTimeout(function(){s._operationTimeoutCb(s._attempts)},s._operationTimeout),s._options.unref&&s._timeout.unref()),s._fn(s._attempts)},r),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},e.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},e.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,s=0;s<this._errors.length;s++){var n=this._errors[s],i=n.message,o=(e[i]||0)+1;e[i]=o,o>=r&&(t=n,r=o)}return t},Pi}(),e.operation=function(r){var s=e.timeouts(r);return new t(s,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],n=0;n<t.retries;n++)s.push(this.createTimeout(n,t));return e&&e.forever&&!s.length&&s.push(this.createTimeout(n,t)),s.sort(function(e,t){return e-t}),s},e.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,s=Math.round(r*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return s=Math.min(s,t.maxTimeout)},e.wrap=function(t,r,s){if(r instanceof Array&&(s=r,r=null),!s)for(var n in s=[],t)"function"==typeof t[n]&&s.push(n);for(var i=0;i<s.length;i++){var o=s[i],a=t[o];t[o]=function(s){var n=e.operation(r),i=Array.prototype.slice.call(arguments,1),o=i.pop();i.push(function(e){n.retry(e)||(e&&(arguments[0]=n.mainError()),o.apply(this,arguments))}),n.attempt(function(){s.apply(t,i)})}.bind(t,a),t[o].options=r}}),xi;var e,t}var Ui=A(Ci?Ri:(Ci=1,Ri=ji()));const Fi=Object.prototype.toString,Ni=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function Ii(e){const t=e&&(e=>"[object Error]"===Fi.call(e))(e)&&"TypeError"===e.name&&"string"==typeof e.message;if(!t)return!1;const{message:r,stack:s}=e;return"Load failed"===r?void 0===s||"__sentry_captured__"in e:!!r.startsWith("error sending request for url")||Ni.has(r)}class Li extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}}const $i=(e,t,r)=>{const s=r.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=s,e};async function Mi(e,t){return new Promise((r,s)=>{t={...t},t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.retries??=10;const n=Ui.operation(t),i=()=>{n.stop(),s(t.signal?.reason)};t.signal&&!t.signal.aborted&&t.signal.addEventListener("abort",i,{once:!0});const o=()=>{t.signal?.removeEventListener("abort",i),n.stop()};n.attempt(async i=>{try{const t=await e(i);o(),r(t)}catch(e){try{if(!(e instanceof Error))throw new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(e instanceof Li)throw e.originalError;if(e instanceof TypeError&&!Ii(e))throw e;if($i(e,i,t),await t.shouldRetry(e)||(n.stop(),s(e)),await t.onFailedAttempt(e),!n.retry(e))throw n.mainError()}catch(e){$i(e,i,t),o(),s(e)}}})})}class Bi extends Error{constructor(e,t){void 0===t&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}}function Di(e,t){return Object.prototype.hasOwnProperty.call(e,t)}class qi extends Error{constructor(e,t){super(e),this.cause=null==t?void 0:t.cause,this.cause&&Di(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}var zi=nn(function(e,t,r){const{progress:s,bytesUploaded:n,bytesTotal:i}=t;s&&(e.uppy.log(`Upload progress: ${s}`),e.uppy.emit("upload-progress",r,{uploader:e,bytesUploaded:n,bytesTotal:i}))},300,{leading:!0,trailing:!0});class Wi extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}let Hi;function Ki(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Vi=0;function Xi(e){return"__private_"+Vi+++"_"+e}class Ji extends Error{constructor(e){let{statusCode:t,message:r}=e;super(r),this.name="HttpError",this.statusCode=t}}var Yi=Xi("companionHeaders"),Gi=Xi("getUrl"),Qi=Xi("requestSocketToken"),Zi=Xi("awaitRemoteFileUpload");Hi=Symbol.for("uppy test: getCompanionHeaders");class eo{constructor(e,t){Object.defineProperty(this,Zi,{value:ro}),Object.defineProperty(this,Gi,{value:to}),Object.defineProperty(this,Yi,{writable:!0,value:void 0}),Object.defineProperty(this,Qi,{writable:!0,value:async e=>{var t;let{file:r,postBody:s,signal:n}=e;if(null==(null==(t=r.remote)?void 0:t.url))throw new Error("Cannot connect to an undefined URL");return(await this.post(r.remote.url,{...r.remote.body,...s},{signal:n})).token}}),this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),Ki(this,Yi)[Yi]=null==t?void 0:t.companionHeaders}setCompanionHeaders(e){Ki(this,Yi)[Yi]=e}[Hi](){return Ki(this,Yi)[Yi]}get hostname(){const{companion:e}=this.uppy.getState(),t=this.opts.companionUrl;return function(e){return e.replace(/\/$/,"")}(e&&e[t]?e[t]:t)}async headers(e){void 0===e&&(e=!1);return{...{Accept:"application/json",...e?void 0:{"Content-Type":"application/json"}},...Ki(this,Yi)[Yi]}}onReceiveResponse(e){const{headers:t}=e,r=this.uppy.getState().companion||{},s=this.opts.companionUrl;t.has("i-am")&&t.get("i-am")!==r[s]&&this.uppy.setState({companion:{...r,[s]:t.get("i-am")}})}async request(e){let{path:t,method:r="GET",data:s,skipPostResponse:n,signal:i}=e;try{const e=await this.headers(!s),o=await function(){return fetch(...arguments).catch(e=>{throw"AbortError"===e.name?e:new Bi(e)})}(Ki(this,Gi)[Gi](t),{method:r,signal:i,headers:e,credentials:this.opts.companionCookiesRule||"same-origin",body:s?JSON.stringify(s):null});return n||this.onReceiveResponse(o),await async function(e){if(401===e.status)throw new Wi;if(e.ok)return e.json();let t,r=`Failed request with status: ${e.status}. ${e.statusText}`;try{t=await e.json(),t.message&&(r=`${r} message: ${t.message}`),t.requestId&&(r=`${r} request-Id: ${t.requestId}`)}catch(e){throw new Error(r,{cause:e})}if(e.status>=400&&e.status<=499&&t.message)throw new _i(t.message);throw new Ji({statusCode:e.status,message:r})}(o)}catch(e){if(e.isAuthError||"UserFacingApiError"===e.name||"AbortError"===e.name)throw e;throw new qi(`Could not ${r} ${Ki(this,Gi)[Gi](t)}`,{cause:e})}}async get(e,t){return"boolean"==typeof t&&(t={skipPostResponse:t}),this.request({...t,path:e})}async post(e,t,r){return"boolean"==typeof r&&(r={skipPostResponse:r}),this.request({...r,path:e,method:"POST",data:t})}async delete(e,t,r){return"boolean"==typeof r&&(r={skipPostResponse:r}),this.request({...r,path:e,method:"DELETE",data:t})}async uploadRemoteFile(e,t,r){var s=this;try{const{signal:n,getQueue:i}=r||{};return await Mi(async()=>{var r;const o=null==(r=this.uppy.getFile(e.id))?void 0:r.serverToken;if(null!=o)return this.uppy.log(`Connecting to exiting websocket ${o}`),Ki(this,Zi)[Zi]({file:e,queue:i(),signal:n});const a=i().wrapPromiseFunction(async function(){try{return await Ki(s,Qi)[Qi](...arguments)}catch(e){if(e.isAuthError)throw new Li(e);if(null==e.cause)throw e;const t=e.cause,r=()=>[408,409,429,418,423].includes(t.statusCode)||t.statusCode>=500&&t.statusCode<=599&&![501,505].includes(t.statusCode);if("HttpError"===t.name&&!r())throw new Li(t);throw t}},{priority:-1}),l=await a({file:e,postBody:t,signal:n}).abortOn(n);return this.uppy.getFile(e.id)?(this.uppy.setFileState(e.id,{serverToken:l}),Ki(this,Zi)[Zi]({file:this.uppy.getFile(e.id),queue:i(),signal:n})):void 0},{retries:10,signal:n,onFailedAttempt:e=>this.uppy.log(`Retrying upload due to: ${e.message}`,"warning")})}catch(t){if("AbortError"===t.name)return;throw this.uppy.emit("upload-error",e,t),t}}}function to(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}async function ro(e){let t,{file:r,queue:s,signal:n}=e;const{capabilities:i}=this.uppy.getState();try{return await new Promise((e,o)=>{const a=r.serverToken,l=function(e){var t;const r=null==(t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e))?void 0:t[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${r}`}(r.remote.companionUrl);let c,u,h,{isPaused:d}=r;const p=(e,t)=>{var s;null!=c&&c.readyState===c.OPEN?c.send(JSON.stringify({action:e,payload:null!=t?t:{}})):this.uppy.log(`Cannot send "${e}" to socket ${r.id} because the socket state was ${String(null==(s=c)?void 0:s.readyState)}`,"warning")};function f(){i.resumableUploads&&p(d?"pause":"resume")}const m=async()=>{u&&u.abort(),u=new AbortController;const t=e=>{var t;this.uppy.setFileState(r.id,{serverToken:null}),null==(t=u)||null==t.abort||t.abort(),o(e)};function n(){clearTimeout(h),d||(h=setTimeout(()=>t(new Error("Timeout waiting for message from Companion socket")),3e5))}try{await s.wrapPromiseFunction(async()=>{await Mi(async()=>new Promise((s,i)=>{c=new WebSocket(`${l}/api/${a}`),n(),c.addEventListener("close",()=>{c=void 0,i(new Error("Socket closed unexpectedly"))}),c.addEventListener("error",e=>{var t;this.uppy.log(`Companion socket error ${JSON.stringify(e)}, closing socket`,"warning"),null==(t=c)||t.close()}),c.addEventListener("open",()=>{f()}),c.addEventListener("message",s=>{n();try{const{action:t,payload:n}=JSON.parse(s.data);switch(t){case"progress":zi(this,n,this.uppy.getFile(r.id));break;case"success":{var i,o,a,l;const t=null==(i=n.response)?void 0:i.responseText;this.uppy.emit("upload-success",this.uppy.getFile(r.id),{uploadURL:n.url,status:null!=(o=null==(a=n.response)?void 0:a.status)?o:200,body:t?JSON.parse(t):void 0}),null==(l=u)||null==l.abort||l.abort(),e();break}case"error":{const{message:e}=n.error;throw Object.assign(new Error(e),{cause:n.error})}default:this.uppy.log(`Companion socket unknown action ${t}`,"warning")}}catch(e){t(e)}});const o=()=>{this.uppy.log(`Closing socket ${r.id}`,"info"),clearTimeout(h),c&&c.close(),c=void 0};u.signal.addEventListener("abort",()=>{o()})}),{retries:10,signal:u.signal,onFailedAttempt:()=>{u.signal.aborted||this.uppy.log(`Retrying websocket ${r.id}`,"info")}})})().abortOn(u.signal)}catch(e){if(u.signal.aborted)return;t(e)}},g=e=>{var t;i.resumableUploads&&(d=e,c&&f(),e?null==(t=u)||null==t.abort||t.abort():m())},y=t=>{var s;i.individualCancellation&&t.id===r.id&&(p("cancel"),null==(s=u)||null==s.abort||s.abort(),this.uppy.log(`upload ${r.id} was removed`,"info"),e())},w=t=>{var s;let{reason:n}=t;"user"===n&&p("cancel"),null==(s=u)||null==s.abort||s.abort(),this.uppy.log(`upload ${r.id} was canceled`,"info"),e()},b=(e,t)=>{e===r.id&&g(t)},v=()=>g(!0),E=()=>g(!1);this.uppy.on("file-removed",y),this.uppy.on("cancel-all",w),this.uppy.on("upload-pause",b),this.uppy.on("pause-all",v),this.uppy.on("resume-all",E),t=()=>{this.uppy.off("file-removed",y),this.uppy.off("cancel-all",w),this.uppy.off("upload-pause",b),this.uppy.off("pause-all",v),this.uppy.off("resume-all",E)},n.addEventListener("abort",()=>{var e;null==(e=u)||e.abort()}),m()})}finally{null==t||t()}}function so(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}eo.VERSION="3.8.2";var no=0;function io(e){return"__private_"+no+++"_"+e}var oo=io("uppy"),ao=io("events");class lo{constructor(e){Object.defineProperty(this,oo,{writable:!0,value:void 0}),Object.defineProperty(this,ao,{writable:!0,value:[]}),so(this,oo)[oo]=e}on(e,t){return so(this,ao)[ao].push([e,t]),so(this,oo)[oo].on(e,t)}remove(){for(const[e,t]of so(this,ao)[ao].splice(0))so(this,oo)[oo].off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{so(this,oo)[oo].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{so(this,oo)[oo].getFile(e)&&t()})}onCancelAll(e,t){var r=this;this.on("cancel-all",function(){so(r,oo)[oo].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{so(this,oo)[oo].getFile(e)&&t()})}}function co(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var uo=0;function ho(e){return"__private_"+uo+++"_"+e}function po(e){if(null!=e){var t;const r=()=>this.abort(e.reason);e.addEventListener("abort",r,{once:!0});const s=()=>{e.removeEventListener("abort",r)};null==(t=this.then)||t.call(this,s,s)}return this}var fo=ho("activeRequests"),mo=ho("queuedHandlers"),go=ho("paused"),yo=ho("pauseTimer"),wo=ho("downLimit"),bo=ho("upperLimit"),vo=ho("rateLimitingTimer"),Eo=ho("call"),So=ho("queueNext"),Oo=ho("next"),To=ho("queue"),_o=ho("dequeue"),Po=ho("resume"),ko=ho("increaseLimit");class Ao{constructor(e){Object.defineProperty(this,_o,{value:Uo}),Object.defineProperty(this,To,{value:jo}),Object.defineProperty(this,Oo,{value:xo}),Object.defineProperty(this,So,{value:Co}),Object.defineProperty(this,Eo,{value:Ro}),Object.defineProperty(this,fo,{writable:!0,value:0}),Object.defineProperty(this,mo,{writable:!0,value:[]}),Object.defineProperty(this,go,{writable:!0,value:!1}),Object.defineProperty(this,yo,{writable:!0,value:void 0}),Object.defineProperty(this,wo,{writable:!0,value:1}),Object.defineProperty(this,bo,{writable:!0,value:void 0}),Object.defineProperty(this,vo,{writable:!0,value:void 0}),Object.defineProperty(this,Po,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,ko,{writable:!0,value:()=>{if(co(this,go)[go])co(this,vo)[vo]=setTimeout(co(this,ko)[ko],0);else{co(this,wo)[wo]=this.limit,this.limit=Math.ceil((co(this,bo)[bo]+co(this,wo)[wo])/2);for(let e=co(this,wo)[wo];e<=this.limit;e++)co(this,So)[So]();co(this,bo)[bo]-co(this,wo)[wo]>3?co(this,vo)[vo]=setTimeout(co(this,ko)[ko],2e3):co(this,wo)[wo]=Math.floor(co(this,wo)[wo]/2)}}}),this.limit="number"!=typeof e||0===e?1/0:e}run(e,t){return!co(this,go)[go]&&co(this,fo)[fo]<this.limit?co(this,Eo)[Eo](e):co(this,To)[To](e,t)}wrapSyncFunction(e,t){var r=this;return function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];const o=r.run(()=>(e(...n),queueMicrotask(()=>o.done()),()=>{}),t);return{abortOn:po,abort(){o.abort()}}}}wrapPromiseFunction(e,t){var r=this;return function(){for(var s=arguments.length,n=new Array(s),i=0;i<s;i++)n[i]=arguments[i];let o;const a=new Promise((s,i)=>{o=r.run(()=>{let t,r;try{r=Promise.resolve(e(...n))}catch(e){r=Promise.reject(e)}return r.then(e=>{t?i(t):(o.done(),s(e))},e=>{t?i(t):(o.done(),i(e))}),e=>{t=function(e){return new Error("Cancelled",{cause:e})}(e)}},t)});return a.abort=e=>{o.abort(e)},a.abortOn=po,a}}resume(){co(this,go)[go]=!1,clearTimeout(co(this,yo)[yo]);for(let e=0;e<this.limit;e++)co(this,So)[So]()}pause(e){void 0===e&&(e=null),co(this,go)[go]=!0,clearTimeout(co(this,yo)[yo]),null!=e&&(co(this,yo)[yo]=setTimeout(co(this,Po)[Po],e))}rateLimit(e){clearTimeout(co(this,vo)[vo]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(co(this,bo)[bo]=this.limit-1,this.limit=co(this,wo)[wo],co(this,vo)[vo]=setTimeout(co(this,ko)[ko],e))}get isPaused(){return co(this,go)[go]}}function Ro(e){co(this,fo)[fo]+=1;let t,r=!1;try{t=e()}catch(e){throw co(this,fo)[fo]-=1,e}return{abort:e=>{r||(r=!0,co(this,fo)[fo]-=1,null==t||t(e),co(this,So)[So]())},done:()=>{r||(r=!0,co(this,fo)[fo]-=1,co(this,So)[So]())}}}function Co(){queueMicrotask(()=>co(this,Oo)[Oo]())}function xo(){if(co(this,go)[go]||co(this,fo)[fo]>=this.limit)return;if(0===co(this,mo)[mo].length)return;const e=co(this,mo)[mo].shift();if(null==e)throw new Error("Invariant violation: next is null");const t=co(this,Eo)[Eo](e.fn);e.abort=t.abort,e.done=t.done}function jo(e,t){const r={fn:e,priority:(null==t?void 0:t.priority)||0,abort:()=>{co(this,_o)[_o](r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=co(this,mo)[mo].findIndex(e=>r.priority>e.priority);return-1===s?co(this,mo)[mo].push(r):co(this,mo)[mo].splice(s,0,r),r}function Uo(e){const t=co(this,mo)[mo].indexOf(e);-1!==t&&co(this,mo)[mo].splice(t,1)}const{AbortController:Fo}=globalThis,No=function(e,t){void 0===e&&(e="Aborted");const r=new DOMException(e,"AbortError");return null!=t&&Di(t,"cause")&&Object.defineProperty(r,"cause",{__proto__:null,configurable:!0,writable:!0,value:t.cause}),r};function Io(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Lo=0;function $o(e){return"__private_"+Lo+++"_"+e}const Mo={getChunkSize:e=>Math.ceil(e.size/1e4),onProgress(){},onPartComplete(){},onSuccess(){},onError(e){throw e}};const Bo=Symbol("pausing upload, not an actual error");var Do=$o("abortController"),qo=$o("chunks"),zo=$o("chunkState"),Wo=$o("data"),Ho=$o("file"),Ko=$o("uploadHasStarted"),Vo=$o("onError"),Xo=$o("onSuccess"),Jo=$o("shouldUseMultipart"),Yo=$o("isRestoring"),Go=$o("onReject"),Qo=$o("maxMultipartParts"),Zo=$o("minPartSize"),ea=$o("initChunks"),ta=$o("createUpload"),ra=$o("resumeUpload"),sa=$o("onPartProgress"),na=$o("onPartComplete"),ia=$o("abortUpload");class oa{constructor(e,t){var r;Object.defineProperty(this,ia,{value:ua}),Object.defineProperty(this,ra,{value:ca}),Object.defineProperty(this,ta,{value:la}),Object.defineProperty(this,ea,{value:aa}),Object.defineProperty(this,Do,{writable:!0,value:new Fo}),Object.defineProperty(this,qo,{writable:!0,value:void 0}),Object.defineProperty(this,zo,{writable:!0,value:void 0}),Object.defineProperty(this,Wo,{writable:!0,value:void 0}),Object.defineProperty(this,Ho,{writable:!0,value:void 0}),Object.defineProperty(this,Ko,{writable:!0,value:!1}),Object.defineProperty(this,Vo,{writable:!0,value:void 0}),Object.defineProperty(this,Xo,{writable:!0,value:void 0}),Object.defineProperty(this,Jo,{writable:!0,value:void 0}),Object.defineProperty(this,Yo,{writable:!0,value:void 0}),Object.defineProperty(this,Go,{writable:!0,value:e=>(null==e?void 0:e.cause)===Bo?null:Io(this,Vo)[Vo](e)}),Object.defineProperty(this,Qo,{writable:!0,value:1e4}),Object.defineProperty(this,Zo,{writable:!0,value:5242880}),Object.defineProperty(this,sa,{writable:!0,value:e=>t=>{if(!t.lengthComputable)return;Io(this,zo)[zo][e].uploaded=function(e){if("string"==typeof e)return parseInt(e,10);if("number"==typeof e)return e;throw new TypeError("Expected a number")}(t.loaded);const r=Io(this,zo)[zo].reduce((e,t)=>e+t.uploaded,0);this.options.onProgress(r,Io(this,Wo)[Wo].size)}}),Object.defineProperty(this,na,{writable:!0,value:e=>t=>{Io(this,qo)[qo][e]=null,Io(this,zo)[zo][e].etag=t,Io(this,zo)[zo][e].done=!0;const r={PartNumber:e+1,ETag:t};this.options.onPartComplete(r)}}),this.options={...Mo,...t},null!=(r=this.options).getChunkSize||(r.getChunkSize=Mo.getChunkSize),Io(this,Wo)[Wo]=e,Io(this,Ho)[Ho]=t.file,Io(this,Xo)[Xo]=this.options.onSuccess,Io(this,Vo)[Vo]=this.options.onError,Io(this,Jo)[Jo]=this.options.shouldUseMultipart,Io(this,Yo)[Yo]=t.uploadId&&t.key,Io(this,ea)[ea]()}start(){Io(this,Ko)[Ko]?(Io(this,Do)[Do].signal.aborted||Io(this,Do)[Do].abort(Bo),Io(this,Do)[Do]=new Fo,Io(this,ra)[ra]()):Io(this,Yo)[Yo]?(this.options.companionComm.restoreUploadFile(Io(this,Ho)[Ho],{uploadId:this.options.uploadId,key:this.options.key}),Io(this,ra)[ra]()):Io(this,ta)[ta]()}pause(){Io(this,Do)[Do].abort(Bo),Io(this,Do)[Do]=new Fo}abort(e){null!=e&&e.really?Io(this,ia)[ia]():this.pause()}get chunkState(){return Io(this,zo)[zo]}}function aa(){const e=Io(this,Wo)[Wo].size,t="function"==typeof Io(this,Jo)[Jo]?Io(this,Jo)[Jo](Io(this,Ho)[Ho]):Boolean(Io(this,Jo)[Jo]);if(t&&e>Io(this,Zo)[Zo]){let r=Math.max(this.options.getChunkSize(Io(this,Wo)[Wo]),Io(this,Zo)[Zo]),s=Math.floor(e/r);s>Io(this,Qo)[Qo]&&(s=Io(this,Qo)[Qo],r=e/Io(this,Qo)[Qo]),Io(this,qo)[qo]=Array(s);for(let s=0,n=0;s<e;s+=r,n++){const i=Math.min(e,s+r),o=()=>{const e=s;return Io(this,Wo)[Wo].slice(e,i)};if(Io(this,qo)[qo][n]={getData:o,onProgress:Io(this,sa)[sa](n),onComplete:Io(this,na)[na](n),shouldUseMultipart:t},Io(this,Yo)[Yo]){const t=s+r>e?e-s:r;Io(this,qo)[qo][n].setAsUploaded=()=>{Io(this,qo)[qo][n]=null,Io(this,zo)[zo][n].uploaded=t}}}}else Io(this,qo)[qo]=[{getData:()=>Io(this,Wo)[Wo],onProgress:Io(this,sa)[sa](0),onComplete:Io(this,na)[na](0),shouldUseMultipart:t}];Io(this,zo)[zo]=Io(this,qo)[qo].map(()=>({uploaded:0}))}function la(){this.options.companionComm.uploadFile(Io(this,Ho)[Ho],Io(this,qo)[qo],Io(this,Do)[Do].signal).then(Io(this,Xo)[Xo],Io(this,Go)[Go]),Io(this,Ko)[Ko]=!0}function ca(){this.options.companionComm.resumeUploadFile(Io(this,Ho)[Ho],Io(this,qo)[qo],Io(this,Do)[Do].signal).then(Io(this,Xo)[Xo],Io(this,Go)[Go])}function ua(){Io(this,Do)[Do].abort(),this.options.companionComm.abortFileUpload(Io(this,Ho)[Ho]).catch(e=>this.options.log(e))}function ha(e){if(null!=e&&e.aborted)throw No("The operation was aborted",{cause:e.reason})}const da=new TextEncoder,pa={name:"HMAC",hash:"SHA-256"};function fa(e){const t=new Uint8Array(e);let r="";for(let e=0;e<t.length;e++)r+=t[e].toString(16).padStart(2,"0");return r}async function ma(e,t){const{subtle:r}=globalThis.crypto;return r.sign(pa,await async function(e){const{subtle:t}=globalThis.crypto;return t.importKey("raw","string"==typeof e?da.encode(e):e,pa,!1,["sign"])}(e),da.encode(t))}async function ga(e){let{accountKey:t,accountSecret:r,sessionToken:s,bucketName:n,Key:i,Region:o,expires:a,uploadId:l,partNumber:c}=e;const u="s3",h=`${n}.${u}.${o}.amazonaws.com`,d=`/${encodeURI(i).replace(/[;?:@&=+$,#!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}`,p="UNSIGNED-PAYLOAD",f=(new Date).toISOString().replace(/[-:]|\.\d+/g,""),m=f.slice(0,8),g=`${m}/${o}/${u}/aws4_request`,y=new URL(`https://${h}${d}`);y.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),y.searchParams.set("X-Amz-Content-Sha256",p),y.searchParams.set("X-Amz-Credential",`${t}/${g}`),y.searchParams.set("X-Amz-Date",f),y.searchParams.set("X-Amz-Expires",a),y.searchParams.set("X-Amz-Security-Token",s),y.searchParams.set("X-Amz-SignedHeaders","host"),c&&y.searchParams.set("partNumber",c),l&&y.searchParams.set("uploadId",l),y.searchParams.set("x-id",c&&l?"UploadPart":"PutObject");const w=function(e){let{method:t="PUT",CanonicalUri:r="/",CanonicalQueryString:s="",SignedHeaders:n,HashedPayload:i}=e;const o=Object.keys(n).map(e=>e.toLowerCase()).sort();return[t,r,s,...o.map(e=>`${e}:${n[e]}`),"",o.join(";"),i].join("\n")}({CanonicalUri:d,CanonicalQueryString:y.search.slice(1),SignedHeaders:{host:h},HashedPayload:p}),b=["AWS4-HMAC-SHA256",f,g,fa(await async function(e){const{subtle:t}=globalThis.crypto;return t.digest(pa.hash,da.encode(e))}(w))].join("\n"),v=await ma(`AWS4${r}`,m),E=await ma(v,o),S=await ma(E,u),O=await ma(S,"aws4_request"),T=fa(await ma(O,b));return y.searchParams.set("X-Amz-Signature",T),y}function ya(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var wa=0;function ba(e){return"__private_"+wa+++"_"+e}function va(e){const t=new URL(e);return t.search="",t.hash="",t.href}var Ea=ba("abortMultipartUpload"),Sa=ba("cache"),Oa=ba("createMultipartUpload"),Ta=ba("fetchSignature"),_a=ba("getUploadParameters"),Pa=ba("listParts"),ka=ba("previousRetryDelay"),Aa=ba("requests"),Ra=ba("retryDelays"),Ca=ba("sendCompletionRequest"),xa=ba("setS3MultipartState"),ja=ba("uploadPartBytes"),Ua=ba("getFile"),Fa=ba("shouldRetry"),Na=ba("nonMultipartUpload");class Ia{constructor(e,t,r,s){Object.defineProperty(this,Na,{value:$a}),Object.defineProperty(this,Fa,{value:La}),Object.defineProperty(this,Ea,{writable:!0,value:void 0}),Object.defineProperty(this,Sa,{writable:!0,value:new WeakMap}),Object.defineProperty(this,Oa,{writable:!0,value:void 0}),Object.defineProperty(this,Ta,{writable:!0,value:void 0}),Object.defineProperty(this,_a,{writable:!0,value:void 0}),Object.defineProperty(this,Pa,{writable:!0,value:void 0}),Object.defineProperty(this,ka,{writable:!0,value:void 0}),Object.defineProperty(this,Aa,{writable:!0,value:void 0}),Object.defineProperty(this,Ra,{writable:!0,value:void 0}),Object.defineProperty(this,Ca,{writable:!0,value:void 0}),Object.defineProperty(this,xa,{writable:!0,value:void 0}),Object.defineProperty(this,ja,{writable:!0,value:void 0}),Object.defineProperty(this,Ua,{writable:!0,value:void 0}),ya(this,Aa)[Aa]=e,ya(this,xa)[xa]=r,ya(this,Ua)[Ua]=s,this.setOptions(t)}setOptions(e){const t=ya(this,Aa)[Aa];var r;("abortMultipartUpload"in e&&(ya(this,Ea)[Ea]=t.wrapPromiseFunction(e.abortMultipartUpload,{priority:1})),"createMultipartUpload"in e&&(ya(this,Oa)[Oa]=t.wrapPromiseFunction(e.createMultipartUpload,{priority:-1})),"signPart"in e&&(ya(this,Ta)[Ta]=t.wrapPromiseFunction(e.signPart)),"listParts"in e&&(ya(this,Pa)[Pa]=t.wrapPromiseFunction(e.listParts)),"completeMultipartUpload"in e&&(ya(this,Ca)[Ca]=t.wrapPromiseFunction(e.completeMultipartUpload,{priority:1})),"retryDelays"in e)&&(ya(this,Ra)[Ra]=null!=(r=e.retryDelays)?r:[]);"uploadPartBytes"in e&&(ya(this,ja)[ja]=t.wrapPromiseFunction(e.uploadPartBytes,{priority:1/0})),"getUploadParameters"in e&&(ya(this,_a)[_a]=t.wrapPromiseFunction(e.getUploadParameters))}async getUploadId(e,t){let r;for(;null!=(r=ya(this,Sa)[Sa].get(e.data));)try{return await r}catch{}const s=ya(this,Oa)[Oa](ya(this,Ua)[Ua](e),t),n=()=>{s.abort(t.reason),ya(this,Sa)[Sa].delete(e.data)};return t.addEventListener("abort",n,{once:!0}),ya(this,Sa)[Sa].set(e.data,s),s.then(async r=>{t.removeEventListener("abort",n),ya(this,xa)[xa](e,r),ya(this,Sa)[Sa].set(e.data,r)},()=>{t.removeEventListener("abort",n),ya(this,Sa)[Sa].delete(e.data)}),s}async abortFileUpload(e){const t=ya(this,Sa)[Sa].get(e.data);if(null==t)return;let r;ya(this,Sa)[Sa].delete(e.data),ya(this,xa)[xa](e,Object.create(null));try{r=await t}catch{return}await ya(this,Ea)[Ea](ya(this,Ua)[Ua](e),r)}async uploadFile(e,t,r){if(ha(r),1===t.length&&!t[0].shouldUseMultipart)return ya(this,Na)[Na](e,t[0],r);const{uploadId:s,key:n}=await this.getUploadId(e,r);ha(r);try{const i=await Promise.all(t.map((t,s)=>this.uploadChunk(e,s+1,t,r)));return ha(r),await ya(this,Ca)[Ca](ya(this,Ua)[Ua](e),{key:n,uploadId:s,parts:i,signal:r},r).abortOn(r)}catch(t){throw(null==t?void 0:t.cause)!==Bo&&"AbortError"!==(null==t?void 0:t.name)&&this.abortFileUpload(e),t}}restoreUploadFile(e,t){ya(this,Sa)[Sa].set(e.data,t)}async resumeUploadFile(e,t,r){if(ha(r),1===t.length&&null!=t[0]&&!t[0].shouldUseMultipart)return ya(this,Na)[Na](e,t[0],r);const{uploadId:s,key:n}=await this.getUploadId(e,r);ha(r);const i=await ya(this,Pa)[Pa](ya(this,Ua)[Ua](e),{uploadId:s,key:n,signal:r},r).abortOn(r);ha(r);const o=await Promise.all(t.map((t,s)=>{const n=s+1,o=i.find(e=>{let{PartNumber:t}=e;return t===n});return null==o?this.uploadChunk(e,n,t,r):(null==t||null==t.setAsUploaded||t.setAsUploaded(),{PartNumber:n,ETag:o.ETag})}));return ha(r),ya(this,Ca)[Ca](ya(this,Ua)[Ua](e),{key:n,uploadId:s,parts:o,signal:r},r).abortOn(r)}async uploadChunk(e,t,r,s){ha(s);const{uploadId:n,key:i}=await this.getUploadId(e,s),o=ya(this,Ra)[Ra].values(),a=ya(this,Ra)[Ra].values(),l=()=>{const e=o.next();return null==e||e.done?null:e.value};for(;;){ha(s);const o=r.getData(),{onProgress:c,onComplete:u}=r;let h;try{h=await ya(this,Ta)[Ta](ya(this,Ua)[Ua](e),{uploadId:n,key:i,partNumber:t,body:o,signal:s}).abortOn(s)}catch(e){const t=l();if(null==t||s.aborted)throw e;await new Promise(e=>setTimeout(e,t));continue}ha(s);try{return{PartNumber:t,...await ya(this,ja)[ja]({signature:h,body:o,size:o.size,onProgress:c,onComplete:u,signal:s}).abortOn(s)}}catch(e){if(!await ya(this,Fa)[Fa](e,a))throw e}}}}async function La(e,t){var r;const s=ya(this,Aa)[Aa],n=null==e||null==(r=e.source)?void 0:r.status;if(null==n)return!1;if(403===n&&"Request has expired"===e.message){if(!s.isPaused){if(1===s.limit||null==ya(this,ka)[ka]){const e=t.next();if(null==e||e.done)return!1;ya(this,ka)[ka]=e.value}s.rateLimit(0),await new Promise(e=>setTimeout(e,ya(this,ka)[ka]))}}else if(429===n){if(!s.isPaused){const e=t.next();if(null==e||e.done)return!1;s.rateLimit(e.value)}}else{if(n>400&&n<500&&409!==n)return!1;if("undefined"!=typeof navigator&&!1===navigator.onLine)s.isPaused||(s.pause(),window.addEventListener("online",()=>{s.resume()},{once:!0}));else{const e=t.next();if(null==e||e.done)return!1;await new Promise(t=>setTimeout(t,e.value))}}return!0}async function $a(e,t,r){const{method:s="POST",url:n,fields:i,headers:o}=await ya(this,_a)[_a](ya(this,Ua)[Ua](e),{signal:r}).abortOn(r);let a;const l=t.getData();if("POST"===s.toUpperCase()){const e=new FormData;Object.entries(i).forEach(t=>{let[r,s]=t;return e.set(r,s)}),e.set("file",l),a=e}else a=l;const{onProgress:c,onComplete:u}=t,h=await ya(this,ja)[ja]({signature:{url:n,headers:o,method:s},body:a,size:l.size,onProgress:c,onComplete:u,signal:r}).abortOn(r);return"location"in h?h:{location:va(n),...h}}let Ma;function Ba(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Da=0;function qa(e){return"__private_"+Da+++"_"+e}function za(e){if(null!=e&&e.error){const t=new Error(e.message);throw Object.assign(t,e.error),t}return e}function Wa(e){const t=e.Expiration;if(t){const e=Math.floor((new Date(t)-Date.now())/1e3);if(e>9)return e}}function Ha(e){let{meta:t,allowedMetaFields:r,querify:s=!1}=e;const n=null!=r?r:Object.keys(t);return t?Object.fromEntries(n.filter(e=>null!=t[e]).map(e=>[s?`metadata[${e}]`:e,String(t[e])])):{}}const Ka={allowedMetaFields:null,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:e=>0!==e.size,retryDelays:[0,1e3,3e3,5e3],companionHeaders:{}};var Va=qa("companionCommunicationQueue"),Xa=qa("client"),Ja=qa("cachedTemporaryCredentials"),Ya=qa("getTemporarySecurityCredentials"),Ga=qa("setS3MultipartState"),Qa=qa("getFile"),Za=qa("uploadLocalFile"),el=qa("getCompanionClientArgs"),tl=qa("upload"),rl=qa("setCompanionHeaders"),sl=qa("setResumableUploadsCapability"),nl=qa("resetResumableCapability");Ma=Symbol.for("uppy test: getClient");class il extends Ti{constructor(e,t){var r;super(e,{...Ka,uploadPartBytes:il.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...t}),Object.defineProperty(this,el,{value:ll}),Object.defineProperty(this,Za,{value:al}),Object.defineProperty(this,Ya,{value:ol}),Object.defineProperty(this,Va,{writable:!0,value:void 0}),Object.defineProperty(this,Xa,{writable:!0,value:void 0}),Object.defineProperty(this,Ja,{writable:!0,value:void 0}),Object.defineProperty(this,Ga,{writable:!0,value:(e,t)=>{let{key:r,uploadId:s}=t;const n=this.uppy.getFile(e.id);null!=n&&this.uppy.setFileState(e.id,{s3Multipart:{...n.s3Multipart,key:r,uploadId:s}})}}),Object.defineProperty(this,Qa,{writable:!0,value:e=>this.uppy.getFile(e.id)||e}),Object.defineProperty(this,tl,{writable:!0,value:async e=>{if(0===e.length)return;const t=function(e){return e.filter(e=>!(e=>"error"in e&&!!e.error)(e))}(this.uppy.getFilesByIds(e)),r=function(e){return e.filter(e=>{var t;return!(null!=(t=e.progress)&&t.uploadStarted&&e.isRestored)})}(t);this.uppy.emit("upload-start",r);const s=t.map(e=>{if(e.isRemote){const t=()=>this.requests;Ba(this,sl)[sl](!1);const r=new AbortController,s=t=>{t.id===e.id&&r.abort()};this.uppy.on("file-removed",s);const n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,Ba(this,el)[el](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return Ba(this,Za)[Za](e)}),n=await Promise.all(s);return Ba(this,sl)[sl](!0),n}}),Object.defineProperty(this,rl,{writable:!0,value:()=>{Ba(this,Xa)[Xa].setCompanionHeaders(this.opts.companionHeaders)}}),Object.defineProperty(this,sl,{writable:!0,value:e=>{const{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,resumableUploads:e}})}}),Object.defineProperty(this,nl,{writable:!0,value:()=>{Ba(this,sl)[sl](!0)}}),this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",this.title="AWS S3 Multipart",Ba(this,Xa)[Xa]=new eo(e,t);const s={createMultipartUpload:this.createMultipartUpload,listParts:this.listParts,abortMultipartUpload:this.abortMultipartUpload,completeMultipartUpload:this.completeMultipartUpload,signPart:null!=t&&t.getTemporarySecurityCredentials?this.createSignedURL:this.signPart,getUploadParameters:null!=t&&t.getTemporarySecurityCredentials?this.createSignedURL:this.getUploadParameters};for(const e of Object.keys(s))null==this.opts[e]&&(this.opts[e]=s[e].bind(this));null!=(null==t?void 0:t.prepareUploadParts)&&null==t.signPart&&(this.opts.signPart=async(e,r)=>{let{uploadId:s,key:n,partNumber:i,body:o,signal:a}=r;const{presignedUrls:l,headers:c}=await t.prepareUploadParts(e,{uploadId:s,key:n,parts:[{number:i,chunk:o}],signal:a});return{url:null==l?void 0:l[i],headers:null==c?void 0:c[i]}}),this.requests=null!=(r=this.opts.rateLimitedQueue)?r:new Ao(this.opts.limit),Ba(this,Va)[Va]=new Ia(this.requests,this.opts,Ba(this,Ga)[Ga],Ba(this,Qa)[Qa]),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null),this.uploaderSockets=Object.create(null)}[Ma](){return Ba(this,Xa)[Xa]}setOptions(e){Ba(this,Va)[Va].setOptions(e),super.setOptions(e),Ba(this,rl)[rl]()}resetUploaderReferences(e,t){this.uploaders[e]&&(this.uploaders[e].abort({really:(null==t?void 0:t.abort)||!1}),this.uploaders[e]=null),this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null),this.uploaderSockets[e]&&(this.uploaderSockets[e].close(),this.uploaderSockets[e]=null)}assertHost(e){if(!this.opts.companionUrl)throw new Error(`Expected a \`companionUrl\` option containing a Companion address, or if you are not using Companion, a custom \`${e}\` implementation.`)}createMultipartUpload(e,t){this.assertHost("createMultipartUpload"),ha(t);const r=Ha({meta:e.meta,allowedMetaFields:this.opts.allowedMetaFields});return Ba(this,Xa)[Xa].post("s3/multipart",{filename:e.name,type:e.type,metadata:r},{signal:t}).then(za)}listParts(e,t,r){let{key:s,uploadId:n,signal:i}=t;null!=i||(i=r),this.assertHost("listParts"),ha(i);const o=encodeURIComponent(s);return Ba(this,Xa)[Xa].get(`s3/multipart/${n}?key=${o}`,{signal:i}).then(za)}completeMultipartUpload(e,t,r){let{key:s,uploadId:n,parts:i,signal:o}=t;null!=o||(o=r),this.assertHost("completeMultipartUpload"),ha(o);const a=encodeURIComponent(s),l=encodeURIComponent(n);return Ba(this,Xa)[Xa].post(`s3/multipart/${l}/complete?key=${a}`,{parts:i},{signal:o}).then(za)}async createSignedURL(e,t){const r=await Ba(this,Ya)[Ya](t),s=Wa(r.credentials)||604800,{uploadId:n,key:i,partNumber:o}=t;return{method:"PUT",expires:s,fields:{},url:`${await ga({accountKey:r.credentials.AccessKeyId,accountSecret:r.credentials.SecretAccessKey,sessionToken:r.credentials.SessionToken,expires:s,bucketName:r.bucket,Region:r.region,Key:null!=i?i:`${crypto.randomUUID()}-${e.name}`,uploadId:n,partNumber:o})}`,headers:{"Content-Type":e.type}}}signPart(e,t){let{uploadId:r,key:s,partNumber:n,signal:i}=t;if(this.assertHost("signPart"),ha(i),null==r||null==s||null==n)throw new Error("Cannot sign without a key, an uploadId, and a partNumber");const o=encodeURIComponent(s);return Ba(this,Xa)[Xa].get(`s3/multipart/${r}/${n}?key=${o}`,{signal:i}).then(za)}abortMultipartUpload(e,t,r){let{key:s,uploadId:n,signal:i}=t;null!=i||(i=r),this.assertHost("abortMultipartUpload");const o=encodeURIComponent(s),a=encodeURIComponent(n);return Ba(this,Xa)[Xa].delete(`s3/multipart/${a}?key=${o}`,void 0,{signal:i}).then(za)}getUploadParameters(e,t){const{meta:r}=e,{type:s,name:n}=r,i=Ha({meta:r,allowedMetaFields:this.opts.allowedMetaFields,querify:!0}),o=new URLSearchParams({filename:n,type:s,...i});return Ba(this,Xa)[Xa].get(`s3/params?${o}`,t)}static async uploadPartBytes(e){let{signature:{url:t,expires:r,headers:s,method:n="PUT"},body:i,size:o=i.size,onProgress:a,onComplete:l,signal:c}=e;if(ha(c),null==t)throw new Error("Cannot upload to an undefined URL");return new Promise((e,u)=>{const h=new XMLHttpRequest;function d(){h.abort()}function p(){null==c||c.removeEventListener("abort",d)}h.open(n,t,!0),s&&Object.keys(s).forEach(e=>{h.setRequestHeader(e,s[e])}),h.responseType="text","number"==typeof r&&(h.timeout=1e3*r),null==c||c.addEventListener("abort",d),h.upload.addEventListener("progress",e=>{a(e)}),h.addEventListener("abort",()=>{p(),u(No())}),h.addEventListener("timeout",()=>{p();const e=new Error("Request has expired");e.source={status:403},u(e)}),h.addEventListener("load",()=>{if(p(),403===h.status&&h.responseText.includes("<Message>Request has expired</Message>")){const e=new Error("Request has expired");return e.source=h,void u(e)}if(h.status<200||h.status>=300){const e=new Error("Non 2xx");return e.source=h,void u(e)}null==a||a({loaded:o,lengthComputable:!0});const t=h.getAllResponseHeaders().trim().split(/[\r\n]+/),r={__proto__:null};for(const e of t){const t=e.split(": "),s=t.shift(),n=t.join(": ");r[s]=n}const{etag:s,location:i}=r;"POST"===n.toUpperCase()&&null===i&&console.warn("AwsS3/Multipart: Could not read the Location header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3-multipart#S3-Bucket-Configuration for instructions."),null!==s?(null==l||l(s),e({...r,ETag:s})):u(new Error("AwsS3/Multipart: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3-multipart#S3-Bucket-Configuration for instructions."))}),h.addEventListener("error",e=>{p();const t=new Error("Unknown error");t.source=e.target,u(t)}),h.send(i)})}install(){Ba(this,sl)[sl](!0),this.uppy.addPreProcessor(Ba(this,rl)[rl]),this.uppy.addUploader(Ba(this,tl)[tl]),this.uppy.on("cancel-all",Ba(this,nl)[nl])}uninstall(){this.uppy.removePreProcessor(Ba(this,rl)[rl]),this.uppy.removeUploader(Ba(this,tl)[tl]),this.uppy.off("cancel-all",Ba(this,nl)[nl])}}async function ol(e){return ha(null==e?void 0:e.signal),null==Ba(this,Ja)[Ja]&&(!0===this.opts.getTemporarySecurityCredentials?(this.assertHost("getTemporarySecurityCredentials"),Ba(this,Ja)[Ja]=Ba(this,Xa)[Xa].get("s3/sts",e).then(za)):Ba(this,Ja)[Ja]=this.opts.getTemporarySecurityCredentials(e),Ba(this,Ja)[Ja]=await Ba(this,Ja)[Ja],setTimeout(()=>{Ba(this,Ja)[Ja]=null},500*(Wa(Ba(this,Ja)[Ja].credentials)||0))),Ba(this,Ja)[Ja]}function al(e){var t=this;return new Promise((r,s)=>{const n=new oa(e.data,{companionComm:Ba(this,Va)[Va],log:function(){return t.uppy.log(...arguments)},getChunkSize:this.opts.getChunkSize?this.opts.getChunkSize.bind(this):null,onProgress:(t,r)=>{this.uppy.emit("upload-progress",this.uppy.getFile(e.id),{uploader:this,bytesUploaded:t,bytesTotal:r})},onError:t=>{this.uppy.log(t),this.uppy.emit("upload-error",e,t),this.resetUploaderReferences(e.id),s(t)},onSuccess:t=>{const s={body:{...t},status:200,uploadURL:t.location};this.resetUploaderReferences(e.id),this.uppy.emit("upload-success",Ba(this,Qa)[Qa](e),s),t.location&&this.uppy.log(`Download ${e.name} from ${t.location}`),r()},onPartComplete:t=>{this.uppy.emit("s3-multipart:part-uploaded",Ba(this,Qa)[Qa](e),t)},file:e,shouldUseMultipart:this.opts.shouldUseMultipart,...e.s3Multipart});this.uploaders[e.id]=n;const i=new lo(this.uppy);this.uploaderEvents[e.id]=i,i.onFileRemove(e.id,t=>{n.abort(),this.resetUploaderReferences(e.id,{abort:!0}),r(`upload ${t} was removed`)}),i.onCancelAll(e.id,t=>{"user"===(null==t?void 0:t.reason)&&(n.abort(),this.resetUploaderReferences(e.id,{abort:!0})),r(`upload ${e.id} was canceled`)}),i.onFilePause(e.id,e=>{e?n.pause():n.start()}),i.onPauseAll(e.id,()=>{n.pause()}),i.onResumeAll(e.id,()=>{n.start()}),n.start()})}function ll(e){var t;return{...null==(t=e.remote)?void 0:t.body,protocol:"s3-multipart",size:e.data.size,metadata:e.meta}}il.VERSION="3.12.0";var cl,ul,hl,dl,pl,fl=function(e,t,r,s){return new(r||(r=Promise))(function(n,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof r?e:new r(function(t){t(e)})}(e.value).then(o,a)}l((s=s.apply(e,t||[])).next())})},ml=function(e,t,r,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},gl=function(e,t,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)},yl=function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(e);n<s.length;n++)t.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(r[s[n]]=e[s[n]])}return r};class wl{constructor(e,t=Dr.PROD){cl.add(this),ul.set(this,void 0),hl.set(this,void 0),dl.set(this,void 0),ml(this,hl,e,"f"),ml(this,dl,t,"f")}uploadFileFrontend(e){return fl(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:r,email:s,callBack:n}){if(!Wr(e,t,r,s))throw new Error(Lr);if(!Jr(s.trim()))throw new Error(Mr);if(!Hr(t))throw new Error($r);return t=Vr(t,r,s),gl(this,cl,"m",pl).call(this,{callBack:n,arrayMetaData:t,scanId:r,email:s,file:e})})}faceScanFileUploader(e){return fl(this,arguments,void 0,function*({file:e,arrayMetaData:t,objectKey:r,email:s,callBack:n}){if(!Wr(e,t,r,s))throw new Error(Lr);if(!Jr(s.trim()))throw new Error(Mr);if(!Kr(t,Ir))throw new Error($r);return t.push({email:s}),gl(this,cl,"m",pl).call(this,{callBack:n,arrayMetaData:t,objectKey:r,email:s,file:e})})}uploadFile(e){return fl(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:r,email:s}){if(!Wr(e,t,r,s))throw new Error(Lr);if(!Jr(s.trim()))throw new Error(Mr);if(!Hr(t))throw new Error($r);return t=Vr(t,r,s),new Promise((r,s)=>fl(this,void 0,void 0,function*(){var n;try{const s=yield zr({path:dr,apiKey:gl(this,hl,"f"),urlType:gl(this,dl,"f"),body:{objectKey:e.name,contentType:e.type,objectMetadata:t},throwError:!0}),i=function(e,t=5242880){const r=e.size,s=[];let n=0;for(;n<r;)s.push(e.slice(n,n+t)),n+=t;return s}(e),o=[];for(let t=0;t<i.length;t++){const r=yield zr({path:fr,apiKey:gl(this,hl,"f"),urlType:gl(this,dl,"f"),body:{objectKey:null==s?void 0:s.key,uploadId:null==s?void 0:s.uploadId,partNumber:t+1},throwError:!0}),a=yield Xt.put(null==r?void 0:r.url,i[t],{headers:{"Content-Type":e.type,"X-Api-Key":gl(this,hl,"f")}});o.push({PartNumber:t+1,ETag:null===(n=null==a?void 0:a.headers)||void 0===n?void 0:n.etag})}const a=yield zr({path:pr,apiKey:gl(this,hl,"f"),urlType:gl(this,dl,"f"),body:{uploadId:null==s?void 0:s.uploadId,objectKey:null==s?void 0:s.key,parts:o,originalFileName:e.name},throwError:!0});r({message:"successfully uploaded",data:a})}catch(e){s(e)}}))})}setDeviceInfo(e){return fl(this,void 0,void 0,function*(){const{scanId:t}=e,r=yl(e,["scanId"]);if(!1===Wr(t))throw new Error(Lr);return Xt.post(`${Xr({urlName:mr,urlType:gl(this,dl,"f")})}${Ur}/${t}`,{device_info:Object.assign({},r)},{headers:{"X-Api-Key":gl(this,hl,"f")}})})}}ul=new WeakMap,hl=new WeakMap,dl=new WeakMap,cl=new WeakSet,pl=function({callBack:e,arrayMetaData:t,scanId:r,email:s,file:n,objectKey:i}){return new Promise((o,a)=>{gl(this,ul,"f")&&gl(this,ul,"f").close(),ml(this,ul,new hi({autoProceed:!0}),"f"),gl(this,ul,"f").use(il,{limit:10,retryDelays:[0,1e3,3e3,5e3],companionUrl:Xr({urlName:mr,urlType:gl(this,dl,"f")}),getChunkSize:()=>Br,createMultipartUpload:n=>{const o=Math.ceil(n.size/Br);null==e||e({eventName:"uploading_start",message:`File ${n.name} will be divided into ${o} chunks`,scanId:r,email:s,objectKey:i});const a=`${r||i}.${n.extension}`;return zr({path:dr,apiKey:gl(this,hl,"f"),urlType:gl(this,dl,"f"),body:{objectKey:a,contentType:n.type,objectMetadata:t}})},completeMultipartUpload:(t,{uploadId:n,key:o,parts:a})=>(null==e||e({eventName:"uploading_complete_start",message:`${a.length} chunks of file, uploaded`,scanId:r,email:s,objectKey:i}),zr({path:pr,apiKey:gl(this,hl,"f"),urlType:gl(this,dl,"f"),body:{uploadId:n,objectKey:o,parts:a,originalFileName:t.name}}).then(t=>(null==e||e({eventName:"uploading_complete_end",message:"Multipart upload completed successfully",scanId:r,email:s,objectKey:i}),t))),signPart:(e,t)=>zr({path:fr,urlType:gl(this,dl,"f"),apiKey:gl(this,hl,"f"),body:{objectKey:t.key,uploadId:t.uploadId,partNumber:t.partNumber}})}),gl(this,ul,"f").addFile({source:"manual",name:n.name,type:n.type,data:n}),gl(this,ul,"f").on("upload-error",(e,t,r)=>{t.isNetworkError?gl(this,ul,"f").retryUpload(e.id):a(t)}),gl(this,ul,"f").on("upload-success",()=>{o({message:"file uploaded successfully"})}),gl(this,ul,"f").on("complete",e=>{gl(this,ul,"f")&&gl(this,ul,"f").close()})})};var bl,vl,El,Sl,Ol,Tl,_l,Pl,kl,Al,Rl,Cl,xl=function(e,t,r,s){return new(r||(r=Promise))(function(n,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof r?e:new r(function(t){t(e)})}(e.value).then(o,a)}l((s=s.apply(e,t||[])).next())})},jl=function(e,t,r,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},Ul=function(e,t,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class Fl{constructor(e,t=Dr.PROD){bl.add(this),vl.set(this,{}),El.set(this,{}),Sl.set(this,{}),Ol.set(this,{}),Tl.set(this,void 0),_l.set(this,void 0),jl(this,Tl,e,"f"),jl(this,_l,t,"f")}getMeasurementResult(e){if(!Wr(e))throw new Error(Lr);const t=`${Xr({urlName:mr,urlType:Ul(this,_l,"f")})}/measurements?scanId=${e}`;return Xt.get(t,{headers:{"X-Api-Key":Ul(this,Tl,"f")}})}getMeasurementRecommendation({scanId:e,shopDomain:t,productName:r}){if(!Wr(e,t,r))throw new Error(Lr);return Xt.get(`${Xr({urlName:mr,urlType:Ul(this,_l,"f")})}${xr}/scan/${e}/shop/${t}/product/${r}`,{headers:{"X-Api-Key":Ul(this,Tl,"f")}})}handleMeasurementSocket(e){const{scanId:t,onError:r,onSuccess:s,onClose:n,onOpen:i}=e;if(!Wr(t))throw new Error(Lr);Ul(this,bl,"m",Cl).call(this,{onOpen:i,scanId:t,onSuccess:s,onError:r,onClose:n,paramsKey:"scanId",isFallback:!0,delay:5e3})}handlFaceScaneSocket(e){const{faceScanId:t,onError:r,onSuccess:s,onClose:n,onOpen:i}=e;if(!Wr(t))throw new Error(Lr);Ul(this,bl,"m",Cl).call(this,{onOpen:i,faceScanId:t,onSuccess:s,onError:r,onClose:n,paramsKey:"faceScanId",isFallback:!1,delay:1e3})}}vl=new WeakMap,El=new WeakMap,Sl=new WeakMap,Ol=new WeakMap,Tl=new WeakMap,_l=new WeakMap,bl=new WeakSet,Pl=function(e){var t;null===(t=Ul(this,vl,"f")[e])||void 0===t||t.close(),Ul(this,vl,"f")[e]=null,Ul(this,El,"f")[e]&&(clearTimeout(Ul(this,El,"f")[e]),Ul(this,El,"f")[e]=null)},kl=function(e,t){const{scanId:r,onSuccess:s,onError:n}=e;Ul(this,Ol,"f")[t]=1,Ul(this,El,"f")[t]=setTimeout(()=>{Ul(this,bl,"m",Al).call(this,{scanId:r,onSuccess:s,onError:n},t),Ul(this,bl,"m",Pl).call(this,t)},9e4)},Al=function(e,t){const{scanId:r,onSuccess:s,onError:n}=e;Ul(this,Sl,"f")[t]&&clearTimeout(Ul(this,Sl,"f")[t]),Ul(this,Sl,"f")[t]=setTimeout(()=>{Ul(this,bl,"m",Rl).call(this,{scanId:r,onSuccess:s,onError:n},t)},5e3*(Ul(this,Ol,"f")[t]||1))},Rl=function(e,t){return xl(this,void 0,void 0,function*(){var r;const{scanId:s,onSuccess:n,onError:i}=e;try{const e=yield this.getMeasurementResult(s);(null==e?void 0:e.data)&&!0===(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.isMeasured)?(null==n||n(e.data),clearInterval(Ul(this,Sl,"f")[t])):(Ul(this,Ol,"f")[t]||1)<8?(Ul(this,Ol,"f")[t]=(Ul(this,Ol,"f")[t]||1)+1,Ul(this,bl,"m",Al).call(this,{scanId:s,onSuccess:n,onError:i},t)):(Ul(this,Ol,"f")[t]=1,clearInterval(Ul(this,Sl,"f")[t]),null==i||i({scanStatus:"failed",message:"Scan not found",isMeasured:!1}))}catch(e){clearInterval(Ul(this,Sl,"f")[t]),null==i||i(e)}})},Cl=function({onOpen:e,isFallback:t,scanId:r,onSuccess:s,onError:n,onClose:i,paramsKey:o,faceScanId:a,delay:l}){const c=t?`measurement-${r}`:`faceScan-${a}`;setTimeout(()=>{Ul(this,bl,"m",Pl).call(this,c);const l=`${Xr({urlName:gr,urlType:Ul(this,_l,"f")})}${Cr}?${o}=${r||a}`,u=new WebSocket(l);Ul(this,vl,"f")[c]=u,u.onopen=()=>{null==e||e(),t&&r&&Ul(this,bl,"m",kl).call(this,{scanId:r,onSuccess:s,onError:n},c)},u.onmessage=e=>{const t=JSON.parse(e.data);200===(null==t?void 0:t.code)&&"success"===(null==t?void 0:t.scanStatus)?null==s||s(t):(clearTimeout(Ul(this,El,"f")[c]),null==n||n(t)),200===(null==t?void 0:t.code)&&"success"===(null==t?void 0:t.scanStatus)&&"final"===(null==t?void 0:t.resultType)&&clearTimeout(Ul(this,El,"f")[c])},u.onclose=()=>null==i?void 0:i(),u.onerror=()=>{t||null==n||n(new Error("An error occurred in the WebSocket connection."))}},l)};const Nl=Object.create(null);Nl.open="0",Nl.close="1",Nl.ping="2",Nl.pong="3",Nl.message="4",Nl.upgrade="5",Nl.noop="6";const Il=Object.create(null);Object.keys(Nl).forEach(e=>{Il[Nl[e]]=e});const Ll={type:"error",data:"parser error"},$l="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Ml="function"==typeof ArrayBuffer,Bl=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Dl=({type:e,data:t},r,s)=>$l&&t instanceof Blob?r?s(t):ql(t,s):Ml&&(t instanceof ArrayBuffer||Bl(t))?r?s(t):ql(new Blob([t]),s):s(Nl[e]+(t||"")),ql=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+(e||""))},r.readAsDataURL(e)};function zl(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Wl;const Hl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Kl="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Kl[Hl.charCodeAt(e)]=e;const Vl="function"==typeof ArrayBuffer,Xl=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Yl(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:Jl(e.substring(1),t)};return Il[r]?e.length>1?{type:Il[r],data:e.substring(1)}:{type:Il[r]}:Ll},Jl=(e,t)=>{if(Vl){const r=(e=>{let t,r,s,n,i,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);const c=new ArrayBuffer(o),u=new Uint8Array(c);for(t=0;t<a;t+=4)r=Kl[e.charCodeAt(t)],s=Kl[e.charCodeAt(t+1)],n=Kl[e.charCodeAt(t+2)],i=Kl[e.charCodeAt(t+3)],u[l++]=r<<2|s>>4,u[l++]=(15&s)<<4|n>>2,u[l++]=(3&n)<<6|63&i;return c})(e);return Yl(r,t)}return{base64:!0,data:e}},Yl=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Gl=String.fromCharCode(30);function Ql(){return new TransformStream({transform(e,t){!function(e,t){$l&&e.data instanceof Blob?e.data.arrayBuffer().then(zl).then(t):Ml&&(e.data instanceof ArrayBuffer||Bl(e.data))?t(zl(e.data)):Dl(e,!1,e=>{Wl||(Wl=new TextEncoder),t(Wl.encode(e))})}(e,r=>{const s=r.length;let n;if(s<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,s);else if(s<65536){n=new Uint8Array(3);const e=new DataView(n.buffer);e.setUint8(0,126),e.setUint16(1,s)}else{n=new Uint8Array(9);const e=new DataView(n.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(s))}e.data&&"string"!=typeof e.data&&(n[0]|=128),t.enqueue(n),t.enqueue(r)})}})}let Zl;function ec(e){return e.reduce((e,t)=>e+t.length,0)}function tc(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let s=0;for(let n=0;n<t;n++)r[n]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),r}function rc(e){if(e)return function(e){for(var t in rc.prototype)e[t]=rc.prototype[t];return e}(e)}rc.prototype.on=rc.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},rc.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},rc.prototype.off=rc.prototype.removeListener=rc.prototype.removeAllListeners=rc.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,s=this._callbacks["$"+e];if(!s)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n=0;n<s.length;n++)if((r=s[n])===t||r.fn===t){s.splice(n,1);break}return 0===s.length&&delete this._callbacks["$"+e],this},rc.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(r){s=0;for(var n=(r=r.slice(0)).length;s<n;++s)r[s].apply(this,t)}return this},rc.prototype.emitReserved=rc.prototype.emit,rc.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},rc.prototype.hasListeners=function(e){return!!this.listeners(e).length};const sc="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),nc="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ic(e,...t){return t.reduce((t,r)=>(e.hasOwnProperty(r)&&(t[r]=e[r]),t),{})}const oc=nc.setTimeout,ac=nc.clearTimeout;function lc(e,t){t.useNativeTimers?(e.setTimeoutFn=oc.bind(nc),e.clearTimeoutFn=ac.bind(nc)):(e.setTimeoutFn=nc.setTimeout.bind(nc),e.clearTimeoutFn=nc.clearTimeout.bind(nc))}function cc(e){return"string"==typeof e?function(e){let t=0,r=0;for(let s=0,n=e.length;s<n;s++)t=e.charCodeAt(s),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(s++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))}function uc(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class hc extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class dc extends rc{constructor(e){super(),this.writable=!1,lc(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new hc(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Xl(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}(e);return t.length?"?"+t:""}}class pc extends dc{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const r=e.split(Gl),s=[];for(let e=0;e<r.length;e++){const n=Xl(r[e],t);if(s.push(n),"error"===n.type)break}return s})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const r=e.length,s=new Array(r);let n=0;e.forEach((e,i)=>{Dl(e,!1,e=>{s[i]=e,++n===r&&t(s.join(Gl))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=uc()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let fc=!1;try{fc="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const mc=fc;function gc(){}class yc extends pc{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class wc extends rc{constructor(e,t,r){super(),this.createRequest=e,lc(this,r),this._opts=r,this._method=r.method||"GET",this._uri=t,this._data=void 0!==r.data?r.data:null,this._create()}_create(){var e;const t=ic(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(t);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{r.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=wc.requestsCount++,wc.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=gc,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete wc.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(wc.requestsCount=0,wc.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",bc);else if("function"==typeof addEventListener){addEventListener("onpagehide"in nc?"pagehide":"unload",bc,!1)}function bc(){for(let e in wc.requests)wc.requests.hasOwnProperty(e)&&wc.requests[e].abort()}const vc=function(){const e=Ec({xdomain:!1});return e&&null!==e.responseType}();function Ec(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||mc))return new XMLHttpRequest}catch(e){}if(!t)try{return new(nc[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Sc="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Oc extends dc{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,r=Sc?{}:ic(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;Dl(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(e){}s&&sc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=uc()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Tc=nc.WebSocket||nc.MozWebSocket;const _c={websocket:class extends Oc{createSocket(e,t,r){return Sc?new Tc(e,t,r):t?new Tc(e,t):new Tc(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends dc{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){Zl||(Zl=new TextDecoder);const r=[];let s=0,n=-1,i=!1;return new TransformStream({transform(o,a){for(r.push(o);;){if(0===s){if(ec(r)<1)break;const e=tc(r,1);i=!(128&~e[0]),n=127&e[0],s=n<126?3:126===n?1:2}else if(1===s){if(ec(r)<2)break;const e=tc(r,2);n=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),s=3}else if(2===s){if(ec(r)<8)break;const e=tc(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(Ll);break}n=i*Math.pow(2,32)+t.getUint32(4),s=3}else{if(ec(r)<n)break;const e=tc(r,n);a.enqueue(Xl(i?e:Zl.decode(e),t)),s=0}if(0===n||n>e){a.enqueue(Ll);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=Ql();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const n=()=>{r.read().then(({done:e,value:t})=>{e||(this.onPacket(t),n())}).catch(e=>{})};n();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;this._writer.write(r).then(()=>{s&&sc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends yc{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=vc&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new wc(Ec,this.uri(),e)}}},Pc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,kc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ac(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),s=e.indexOf("]");-1!=r&&-1!=s&&(e=e.substring(0,r)+e.substring(r,s).replace(/:/g,";")+e.substring(s,e.length));let n=Pc.exec(e||""),i={},o=14;for(;o--;)i[kc[o]]=n[o]||"";return-1!=r&&-1!=s&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const r=/\/{2,9}/g,s=t.replace(r,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||s.splice(0,1);"/"==t.slice(-1)&&s.splice(s.length-1,1);return s}(0,i.path),i.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,s){t&&(r[t]=s)}),r}(0,i.query),i}const Rc="function"==typeof addEventListener&&"function"==typeof removeEventListener,Cc=[];Rc&&addEventListener("offline",()=>{Cc.forEach(e=>e())},!1);class xc extends rc{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const r=Ac(e);t.hostname=r.host,t.secure="https"===r.protocol||"wss"===r.protocol,t.port=r.port,r.query&&(t.query=r.query)}else t.host&&(t.hostname=Ac(t.host).host);lc(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},r=e.split("&");for(let e=0,s=r.length;e<s;e++){let s=r[e].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}(this.opts.query)),Rc&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Cc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&xc.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",xc.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const r=this.writeBuffer[t].data;if(r&&(e+=cc(r)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,sc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,r){return this._sendPacket("message",e,t,r),this}send(e,t,r){return this._sendPacket("message",e,t,r),this}_sendPacket(e,t,r,s){if("function"==typeof t&&(s=t,t=void 0),"function"==typeof r&&(s=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(xc.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Rc&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Cc.indexOf(this._offlineEventListener);-1!==e&&Cc.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}xc.protocol=4;class jc extends xc{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),r=!1;xc.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!r)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;xc.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function n(){r||(r=!0,c(),t.close(),t=null)}const i=e=>{const r=new Error("probe error: "+e);r.transport=t.name,n(),this.emitReserved("upgradeError",r)};function o(){i("transport closed")}function a(){i("socket closed")}function l(e){t&&e.name!==t.name&&n()}const c=()=>{t.removeListener("open",s),t.removeListener("error",i),t.removeListener("close",o),this.off("close",a),this.off("upgrading",l)};t.once("open",s),t.once("error",i),t.once("close",o),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}let Uc=class extends jc{constructor(e,t={}){const r="object"==typeof e?e:t;(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>_c[e]).filter(e=>!!e)),super(e,r)}};const Fc="function"==typeof ArrayBuffer,Nc=Object.prototype.toString,Ic="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Nc.call(Blob),Lc="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Nc.call(File);function $c(e){return Fc&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Ic&&e instanceof Blob||Lc&&e instanceof File}function Mc(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,r=e.length;t<r;t++)if(Mc(e[t]))return!0;return!1}if($c(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Mc(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Mc(e[t]))return!0;return!1}function Bc(e){const t=[],r=e.data,s=e;return s.data=Dc(r,t),s.attachments=t.length,{packet:s,buffers:t}}function Dc(e,t){if(!e)return e;if($c(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}if(Array.isArray(e)){const r=new Array(e.length);for(let s=0;s<e.length;s++)r[s]=Dc(e[s],t);return r}if("object"==typeof e&&!(e instanceof Date)){const r={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=Dc(e[s],t));return r}return e}function qc(e,t){return e.data=zc(e.data,t),delete e.attachments,e}function zc(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=zc(e[r],t);else if("object"==typeof e)for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=zc(e[r],t));return e}const Wc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Hc;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Hc||(Hc={}));function Kc(e){return"[object Object]"===Object.prototype.toString.call(e)}class Vc extends rc{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===Hc.BINARY_EVENT;r||t.type===Hc.BINARY_ACK?(t.type=r?Hc.EVENT:Hc.ACK,this.reconstructor=new Xc(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!$c(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(void 0===Hc[r.type])throw new Error("unknown packet type "+r.type);if(r.type===Hc.BINARY_EVENT||r.type===Hc.BINARY_ACK){const s=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const n=e.substring(s,t);if(n!=Number(n)||"-"!==e.charAt(t))throw new Error("Illegal attachments");r.attachments=Number(n)}if("/"===e.charAt(t+1)){const s=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}r.nsp=e.substring(s,t)}else r.nsp="/";const s=e.charAt(t+1);if(""!==s&&Number(s)==s){const s=t+1;for(;++t;){const r=e.charAt(t);if(null==r||Number(r)!=r){--t;break}if(t===e.length)break}r.id=Number(e.substring(s,t+1))}if(e.charAt(++t)){const s=this.tryParse(e.substr(t));if(!Vc.isPayloadValid(r.type,s))throw new Error("invalid payload");r.data=s}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Hc.CONNECT:return Kc(t);case Hc.DISCONNECT:return void 0===t;case Hc.CONNECT_ERROR:return"string"==typeof t||Kc(t);case Hc.EVENT:case Hc.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Wc.indexOf(t[0]));case Hc.ACK:case Hc.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Xc{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=qc(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Jc=Object.freeze({__proto__:null,Decoder:Vc,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Hc.EVENT&&e.type!==Hc.ACK||!Mc(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Hc.EVENT?Hc.BINARY_EVENT:Hc.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Hc.BINARY_EVENT&&e.type!==Hc.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Bc(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}},get PacketType(){return Hc},protocol:5});function Yc(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const Gc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Qc extends rc{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Yc(e,"open",this.onopen.bind(this)),Yc(e,"packet",this.onpacket.bind(this)),Yc(e,"error",this.onerror.bind(this)),Yc(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var r,s,n;if(Gc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const i={type:Hc.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),i.id=e}const o=null===(s=null===(r=this.io.engine)||void 0===r?void 0:r.transport)||void 0===s?void 0:s.writable,a=this.connected&&!(null===(n=this.io.engine)||void 0===n?void 0:n._hasPingExpired());return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var r;const s=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===s)return void(this.acks[e]=t);const n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},s),i=(...e)=>{this.io.clearTimeoutFn(n),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((r,s)=>{const n=(e,t)=>e?s(e):r(t);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...s)=>{if(r!==this._queue[0])return;return null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...s)),r.pending=!1,this._drainQueue()}),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Hc.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Hc.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Hc.EVENT:case Hc.BINARY_EVENT:this.onevent(e);break;case Hc.ACK:case Hc.BINARY_ACK:this.onack(e);break;case Hc.DISCONNECT:this.ondisconnect();break;case Hc.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:Hc.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Hc.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function Zc(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Zc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+r:e-r}return 0|Math.min(e,this.max)},Zc.prototype.reset=function(){this.attempts=0},Zc.prototype.setMin=function(e){this.ms=e},Zc.prototype.setMax=function(e){this.max=e},Zc.prototype.setJitter=function(e){this.jitter=e};class eu extends rc{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,lc(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=t.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new Zc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||Jc;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Uc(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Yc(t,"open",function(){r.onopen(),e&&e()}),n=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Yc(t,"error",n);if(!1!==this._timeout){const e=this._timeout,r=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),t.close()},e);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}return this.subs.push(s),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Yc(e,"ping",this.onping.bind(this)),Yc(e,"data",this.ondata.bind(this)),Yc(e,"error",this.onerror.bind(this)),Yc(e,"close",this.onclose.bind(this)),Yc(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){sc(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Qc(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var r;this.cleanup(),null===(r=this.engine)||void 0===r||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const tu={};function ru(e,t){"object"==typeof e&&(t=e,e=void 0);const r=function(e,t="",r){let s=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),s=Ac(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const n=-1!==s.host.indexOf(":")?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+t,s.href=s.protocol+"://"+n+(r&&r.port===s.port?"":":"+s.port),s}(e,(t=t||{}).path||"/socket.io"),s=r.source,n=r.id,i=r.path,o=tu[n]&&i in tu[n].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?a=new eu(s,t):(tu[n]||(tu[n]=new eu(s,t)),a=tu[n]),r.query&&!t.query&&(t.query=r.queryKey),a.socket(r.path,t)}Object.assign(ru,{Manager:eu,Socket:Qc,io:ru,connect:ru});var su,nu,iu,ou=function(e,t,r,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},au=function(e,t,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class lu{constructor(e,t=Dr.PROD){su.set(this,null),nu.set(this,void 0),iu.set(this,void 0),ou(this,nu,e,"f"),ou(this,iu,t,"f")}connect(){return new Promise((e,t)=>{ou(this,su,ru(Xr({urlName:"APP_POSE_DETECTION_WEBSOCKET_URL",urlType:au(this,iu,"f")})),"f"),au(this,su,"f").on("connect",()=>{var r;const s=null===(r=au(this,su,"f"))||void 0===r?void 0:r.id;s?e(s):t("Failed to obtain socket ID.")}),au(this,su,"f").on("connect_error",e=>{t(e)})})}videoEmit({image:e,scanId:t}){if(!au(this,su,"f"))throw new Error("Socket is not connected");au(this,su,"f").emit("video",{image:e,user_unique_key:t})}disconnect(){var e;null===(e=au(this,su,"f"))||void 0===e||e.disconnect()}poseStatus(e){if(!au(this,su,"f"))throw new Error("Socket is not connected");au(this,su,"f").on("pose_status",t=>{null==e||e(t)})}connected(){var e;return!!(null===(e=au(this,su,"f"))||void 0===e?void 0:e.connected)}}su=new WeakMap,nu=new WeakMap,iu=new WeakMap;var cu,uu,hu,du,pu,fu,mu,gu,yu,wu,bu=function(e,t,r,s){return new(r||(r=Promise))(function(n,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof r?e:new r(function(t){t(e)})}(e.value).then(o,a)}l((s=s.apply(e,t||[])).next())})},vu=function(e,t,r,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},Eu=function(e,t,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class Su{constructor(e,t=Dr.PROD){cu.add(this),uu.set(this,new Map),hu.set(this,new Map),du.set(this,void 0),pu.set(this,void 0),gu.set(this,e=>{if(e){const t=Eu(this,uu,"f").get(e),r=Eu(this,hu,"f").get(e);null==t||t.close(),r&&clearTimeout(r),Eu(this,uu,"f").delete(e),Eu(this,hu,"f").delete(e)}else Eu(this,uu,"f").forEach(e=>e.close()),Eu(this,hu,"f").forEach(e=>clearTimeout(e)),Eu(this,uu,"f").clear(),Eu(this,hu,"f").clear()}),yu.set(this,({onSuccess:e,onError:t,tryonId:r})=>{const s=setTimeout(()=>{Eu(this,wu,"f").call(this,{onSuccess:e,onError:t,tryonId:r}),Eu(this,gu,"f").call(this,r)},3e5);Eu(this,hu,"f").set(r,s)}),this.handleTryOnWebSocket=({tryonId:e,onError:t,onSuccess:r,onClose:s,onOpen:n})=>{if(!1===Wr(e))throw new Error(Lr);Eu(this,gu,"f").call(this,e);const i=`${Xr({urlName:gr,urlType:Eu(this,pu,"f")})}${Ar}?tryonId=${e}`,o=new WebSocket(i);Eu(this,uu,"f").set(e,o),o.onopen=()=>{null==n||n(),Eu(this,yu,"f").call(this,{onSuccess:r,onError:t,tryonId:e})},o.onmessage=s=>{let n;try{n=JSON.parse(s.data)}catch(e){return void console.log("Invalid JSON:",s.data)}"success"===(null==n?void 0:n.status)?null==r||r(n):null==t||t(n);const i=Eu(this,hu,"f").get(e);i&&clearTimeout(i),Eu(this,hu,"f").delete(e)},o.onclose=()=>{null==s||s()},o.onerror=e=>{null==t||t(e)}},wu.set(this,e=>bu(this,[e],void 0,function*({onSuccess:e,onError:t,tryonId:r}){try{const t=yield this.getTryOnResult({tryonId:r});null==e||e(t.data)}catch(e){null==t||t(e)}})),this.getTryOnResult=({tryonId:e})=>{if(!1===Wr(e))throw new Error(Lr);const t=`${Xr({urlName:mr,urlType:Eu(this,pu,"f")})}${kr}/${e}`;return Xt.post(t,null,{headers:{"X-Api-Key":Eu(this,du,"f")}})},vu(this,du,e,"f"),vu(this,pu,t,"f")}uploadFile(e){return bu(this,arguments,void 0,function*({files:e,userEmail:t,fileNoLimit:r=2}){if(!1===Wr(e,t))throw new Error(Lr);if(!Jr(t.trim()))throw new Error(Mr);if(r<=0)throw new Error(`Provide valid file number limit ${r}.`);if((null==e?void 0:e.length)>r)throw new Error(`Cannot allow more than ${r} files.`);try{const r={userEmail:t,userImages:[]};null==e||e.forEach(e=>{r.userImages.push(e.name)});const s=yield Eu(this,cu,"m",fu).call(this,r);for(const t of e)yield Eu(this,cu,"m",mu).call(this,s.data.uploadUrls[t.name].url,t);return"uploaded successfully!"}catch(e){throw e}})}getUploadedFiles(e){if(!1===Wr(e))throw new Error(Lr);if(!Jr(e.trim()))throw new Error(Mr);const t={userEmail:e};return Xt.post(`${Xr({urlName:mr,urlType:Eu(this,pu,"f")})}${_r}`,t,{headers:{"X-Api-Key":Eu(this,du,"f")}})}deleteImage({userEmail:e,fileName:t}){if(!1===Wr(e,t))throw new Error(Lr);if(!Jr(e.trim()))throw new Error(Mr);const r={userEmail:e,file:t};return Xt.delete(`${Xr({urlName:mr,urlType:Eu(this,pu,"f")})}${Pr}`,{headers:{"X-Api-Key":Eu(this,du,"f")},data:r})}handleTryOnSubmit({shopDomain:e,products:t,selectedUserImages:r,requestSource:s,callbackUrl:n,openTryonId:i,selectedProductImageUrl:o,token:a}){if(!1===Wr(e,t,a))throw new Error(Lr);const l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({products:t,customerStoreUrl:e},null!=r&&{selectedUserImages:r}),null!=s&&{requestSource:s}),null!=n&&{callbackUrl:n}),null!=i&&{openTryonId:i}),null!=o&&{selectedProductImageUrl:o}),c=`${Xr({urlName:mr,urlType:Eu(this,pu,"f")})}${Ar}`,u={"X-Api-Key":Eu(this,du,"f")};return a&&(u.Authorization=`Bearer ${a}`),Xt.post(c,l,{headers:u})}getShareLink(e){return Xt.post(`${Xr({urlName:mr,urlType:Eu(this,pu,"f")})}${jr}`,{tryonId:e},{headers:{"X-Api-Key":Eu(this,du,"f")}})}getProductImageEligibility({storeUrl:e,productHandle:t,imageURL:r,productDescription:s}){if(!1===Wr(e,t,r))throw new Error(Lr);const n={storeUrl:e,productHandle:t,imageURL:r,productDescription:null!=s?s:null},i=`${Xr({urlName:mr,urlType:Eu(this,pu,"f")})}${Fr}`;return Xt.post(i,n,{headers:{"X-Api-Key":Eu(this,du,"f")}})}}uu=new WeakMap,hu=new WeakMap,du=new WeakMap,pu=new WeakMap,gu=new WeakMap,yu=new WeakMap,wu=new WeakMap,cu=new WeakSet,fu=function(e){if(!1===Wr(e))throw new Error(Lr);return Xt.post(`${Xr({urlName:mr,urlType:Eu(this,pu,"f")})}${Tr}`,e,{headers:{"Content-Type":"application/json","X-Api-Key":Eu(this,du,"f")}})},mu=function(e,t){if(!1===Wr(e,t))throw new Error(Lr);return Xt.put(e,t,{headers:{"Content-Type":t.type}})};var Ou,Tu,_u,Pu=function(e,t,r,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},ku=function(e,t,r,s){if("a"===r&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};Ou=new WeakMap,Tu=new WeakMap,function(e){e.DEV="dev",e.STAGING="staging",e.PROD="prod"}(_u||(_u={}));const Au=new class{constructor(e,t=Dr.PROD){Ou.set(this,void 0),Tu.set(this,void 0),Pu(this,Ou,e,"f"),Pu(this,Tu,t,"f"),this.auth=new ts(ku(this,Ou,"f"),ku(this,Tu,"f")),this.custom=new os(ku(this,Ou,"f"),ku(this,Tu,"f")),this.fileUpload=new wl(ku(this,Ou,"f"),ku(this,Tu,"f")),this.measurement=new Fl(ku(this,Ou,"f"),ku(this,Tu,"f")),this.poseDetection=new lu(ku(this,Ou,"f"),ku(this,Tu,"f")),this.tryOn=new Su(ku(this,Ou,"f"),ku(this,Tu,"f"))}}("8e35dfd4-010c-40ca-ad79-fc72dc307efb",_u.STAGING),Ru={playAudio:e=>new Promise(t=>{const r=document.querySelector("#audioElement");if(!r)return void t();r.src=e;const s=()=>{r.removeEventListener("ended",s),t()};r.addEventListener("ended",s),r.play().catch(e=>{r.removeEventListener("ended",s),t(),console.error(e)})}),stopAudio:async()=>{const e=document.querySelector("#audioElement");try{e&&(e.pause(),e.src="",e.currentTime=0)}catch(e){console.error(e)}}};function Cu({size:e=60,loaderType:t="default",url:r}){return j("div",{className:"flex items-center justify-center h-full w-full",children:j("img",{src:r||("black"===t?C:x),alt:"Swan logo",className:`w-[${e}px]`,width:e})})}export{q as D,Cu as L,Au as a,Ru as s};
|
|
12
|
+
//# sourceMappingURL=LoadingScreen-DGyU-r8n.js.map
|