@swan-admin/swan-web-component 1.0.67 → 1.0.70

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.
Files changed (76) hide show
  1. package/dist/Header-BFI4gBKm.js +32 -0
  2. package/dist/Header-BFI4gBKm.js.map +1 -0
  3. package/dist/Header-Bx138Dy4.js +32 -0
  4. package/dist/Header-Bx138Dy4.js.map +1 -0
  5. package/dist/Header-D0NKQg96.js +32 -0
  6. package/dist/Header-D0NKQg96.js.map +1 -0
  7. package/dist/Header-D8_Sa__H.js +32 -0
  8. package/dist/Header-D8_Sa__H.js.map +1 -0
  9. package/dist/Header-DMYoyh62.js +32 -0
  10. package/dist/Header-DMYoyh62.js.map +1 -0
  11. package/dist/Header-DRhCgsEK.js +32 -0
  12. package/dist/Header-DRhCgsEK.js.map +1 -0
  13. package/dist/Header-D_BB6axT.js +32 -0
  14. package/dist/Header-D_BB6axT.js.map +1 -0
  15. package/dist/Header-OyvO17xa.js +32 -0
  16. package/dist/Header-OyvO17xa.js.map +1 -0
  17. package/dist/LoadingScreen-5f0O92DQ.js +12 -0
  18. package/dist/LoadingScreen-5f0O92DQ.js.map +1 -0
  19. package/dist/LoadingScreen-Ag6WfanK.js +12 -0
  20. package/dist/LoadingScreen-Ag6WfanK.js.map +1 -0
  21. package/dist/LoadingScreen-BNwk457j.js +12 -0
  22. package/dist/LoadingScreen-BNwk457j.js.map +1 -0
  23. package/dist/LoadingScreen-CoAEjnx8.js +12 -0
  24. package/dist/LoadingScreen-CoAEjnx8.js.map +1 -0
  25. package/dist/LoadingScreen-DHVoBy6C.js +12 -0
  26. package/dist/LoadingScreen-DHVoBy6C.js.map +1 -0
  27. package/dist/LoadingScreen-DWeZHrB3.js +12 -0
  28. package/dist/LoadingScreen-DWeZHrB3.js.map +1 -0
  29. package/dist/LoadingScreen-mBOEmdqd.js +12 -0
  30. package/dist/LoadingScreen-mBOEmdqd.js.map +1 -0
  31. package/dist/LoadingScreen-yLhReGEL.js +12 -0
  32. package/dist/LoadingScreen-yLhReGEL.js.map +1 -0
  33. package/dist/arrow-right-4StboB67.js +27 -0
  34. package/dist/arrow-right-4StboB67.js.map +1 -0
  35. package/dist/arrow-right-BIjAwodZ.js +27 -0
  36. package/dist/arrow-right-BIjAwodZ.js.map +1 -0
  37. package/dist/arrow-right-BQ8kQEFA.js +27 -0
  38. package/dist/arrow-right-BQ8kQEFA.js.map +1 -0
  39. package/dist/arrow-right-B_jaXYNN.js +27 -0
  40. package/dist/arrow-right-B_jaXYNN.js.map +1 -0
  41. package/dist/arrow-right-CC40lbPC.js +27 -0
  42. package/dist/arrow-right-CC40lbPC.js.map +1 -0
  43. package/dist/arrow-right-CiukVcmB.js +27 -0
  44. package/dist/arrow-right-CiukVcmB.js.map +1 -0
  45. package/dist/arrow-right-Oh8jj4in.js +27 -0
  46. package/dist/arrow-right-Oh8jj4in.js.map +1 -0
  47. package/dist/arrow-right-bhyA4u2f.js +27 -0
  48. package/dist/arrow-right-bhyA4u2f.js.map +1 -0
  49. package/dist/bodyScan.js +1 -1
  50. package/dist/bodyScan.js.map +1 -1
  51. package/dist/bodyScan.mjs +2 -2
  52. package/dist/bodyScan.mjs.map +1 -1
  53. package/dist/createSvgIcon-CLSFk7Pc.js +2 -0
  54. package/dist/createSvgIcon-CLSFk7Pc.js.map +1 -0
  55. package/dist/createSvgIcon-CMwN6IW3.js +2 -0
  56. package/dist/createSvgIcon-CMwN6IW3.js.map +1 -0
  57. package/dist/createSvgIcon-CVFfAghA.js +2 -0
  58. package/dist/createSvgIcon-CVFfAghA.js.map +1 -0
  59. package/dist/createSvgIcon-CZpqw5ub.js +2 -0
  60. package/dist/createSvgIcon-CZpqw5ub.js.map +1 -0
  61. package/dist/createSvgIcon-CokHDtcC.js +2 -0
  62. package/dist/createSvgIcon-CokHDtcC.js.map +1 -0
  63. package/dist/createSvgIcon-DdcpWvxL.js +2 -0
  64. package/dist/createSvgIcon-DdcpWvxL.js.map +1 -0
  65. package/dist/createSvgIcon-HtNZtQrW.js +2 -0
  66. package/dist/createSvgIcon-HtNZtQrW.js.map +1 -0
  67. package/dist/createSvgIcon-korDjwHA.js +2 -0
  68. package/dist/createSvgIcon-korDjwHA.js.map +1 -0
  69. package/dist/faceScan.js +1 -1
  70. package/dist/faceScan.mjs +1 -1
  71. package/dist/index.css +1 -3
  72. package/dist/index.js +15 -15
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +15 -15
  75. package/dist/index.mjs.map +1 -1
  76. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ "use strict";var e=require("react"),t=require("./Header-DMYoyh62.js"),r=require("react/jsx-runtime");function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var n=s(e);function i(e){return"function"==typeof e?e():e}function o(e,r,s){const n=function(e,r,s){const n=r.getBoundingClientRect(),i=s&&s.getBoundingClientRect(),o=t.ownerWindow(r);let a;if(r.fakeTransform)a=r.fakeTransform;else{const e=o.getComputedStyle(r);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?i?`translateX(${i.right+l-n.left}px)`:`translateX(${o.innerWidth+l-n.left}px)`:"right"===e?i?`translateX(-${n.right-i.left-l}px)`:`translateX(-${n.left+n.width-l}px)`:"up"===e?i?`translateY(${i.bottom+c-n.top}px)`:`translateY(${o.innerHeight+c-n.top}px)`:i?`translateY(-${n.top-i.top+n.height-c}px)`:`translateY(-${n.top+n.height-c}px)`}(e,r,i(s));n&&(r.style.webkitTransform=n,r.style.transform=n)}const a=n.forwardRef(function(e,s){const i=t.useTheme$1(),a={enter:i.transitions.easing.easeOut,exit:i.transitions.easing.sharp},l={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{addEndListener:c,appear:u=!0,children:h,container:p,direction:d="down",easing:f=a,in:m,onEnter:y,onEntered:g,onEntering:w,onExit:b,onExited:v,onExiting:E,style:T,timeout:S=l,TransitionComponent:O=t.Transition,...P}=e,_=n.useRef(null),k=t.useForkRef(t.getReactElementRef(h),_,s),A=e=>t=>{e&&(void 0===t?e(_.current):e(_.current,t))},R=A((e,r)=>{o(d,e,p),t.reflow(e),y&&y(e,r)}),C=A((e,r)=>{const s=t.getTransitionProps({timeout:S,style:T,easing:f},{mode:"enter"});e.style.webkitTransition=i.transitions.create("-webkit-transform",{...s}),e.style.transition=i.transitions.create("transform",{...s}),e.style.webkitTransform="none",e.style.transform="none",w&&w(e,r)}),x=A(g),j=A(E),U=A(e=>{const r=t.getTransitionProps({timeout:S,style:T,easing:f},{mode:"exit"});e.style.webkitTransition=i.transitions.create("-webkit-transform",r),e.style.transition=i.transitions.create("transform",r),o(d,e,p),b&&b(e)}),F=A(e=>{e.style.webkitTransition="",e.style.transition="",v&&v(e)}),N=n.useCallback(()=>{_.current&&o(d,_.current,p)},[d,p]);return n.useEffect(()=>{if(m||"down"===d||"right"===d)return;const e=t.debounce(()=>{_.current&&o(d,_.current,p)}),r=t.ownerWindow(_.current);return r.addEventListener("resize",e),()=>{e.clear(),r.removeEventListener("resize",e)}},[d,m,p]),n.useEffect(()=>{m||N()},[m,N]),r.jsx(O,{nodeRef:_,onEnter:R,onEntered:x,onEntering:C,onExit:U,onExited:F,onExiting:j,addEndListener:e=>{c&&c(_.current,e)},appear:u,in:m,timeout:S,...P,children:(e,{ownerState:t,...r})=>n.cloneElement(h,{ref:k,style:{visibility:"exited"!==e||m?void 0:"hidden",...T,...h.props.style},...r})})});function l(e){return t.generateUtilityClass("MuiDrawer",e)}"production"!==process.env.NODE_ENV&&(a.propTypes={addEndListener:t.PropTypes.func,appear:t.PropTypes.bool,children:t.elementAcceptingRef.isRequired,container:t.chainPropTypes(t.PropTypes.oneOfType([t.HTMLElementType,t.PropTypes.func]),e=>{if(e.open){const t=i(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:t.PropTypes.oneOf(["down","left","right","up"]),easing:t.PropTypes.oneOfType([t.PropTypes.shape({enter:t.PropTypes.string,exit:t.PropTypes.string}),t.PropTypes.string]),in:t.PropTypes.bool,onEnter:t.PropTypes.func,onEntered:t.PropTypes.func,onEntering:t.PropTypes.func,onExit:t.PropTypes.func,onExited:t.PropTypes.func,onExiting:t.PropTypes.func,style:t.PropTypes.object,timeout:t.PropTypes.oneOfType([t.PropTypes.number,t.PropTypes.shape({appear:t.PropTypes.number,enter:t.PropTypes.number,exit:t.PropTypes.number})])}),t.generateUtilityClasses("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const c=(e,t)=>{const{ownerState:r}=e;return[t.root,("permanent"===r.variant||"persistent"===r.variant)&&t.docked,t.modal]},u=t.styled(t.Modal,{name:"MuiDrawer",slot:"Root",overridesResolver:c})(t.memoTheme(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),h=t.styled("div",{shouldForwardProp:t.rootShouldForwardProp,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:c})({flex:"0 0 auto"}),p=t.styled(t.Paper,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:s}=e;return[r.paper,r[`paperAnchor${t.capitalize(s.anchor)}`],"temporary"!==s.variant&&r[`paperAnchorDocked${t.capitalize(s.anchor)}`]]}})(t.memoTheme(({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 f=n.forwardRef(function(e,s){const i=t.useDefaultProps({props:e,name:"MuiDrawer"}),o=t.useTheme$1(),c=t.useRtl(),f={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{anchor:m="left",BackdropProps:y,children:g,className:w,elevation:b=16,hideBackdrop:v=!1,ModalProps:{BackdropProps:E,...T}={},onClose:S,open:O=!1,PaperProps:P={},SlideProps:_,TransitionComponent:k,transitionDuration:A=f,variant:R="temporary",slots:C={},slotProps:x={},...j}=i,U=n.useRef(!1);n.useEffect(()=>{U.current=!0},[]);const F=function({direction:e},t){return"rtl"===e&&function(e){return["left","right"].includes(e)}(t)?d[t]:t}({direction:c?"rtl":"ltr"},m),N=m,I={...i,anchor:N,elevation:b,open:O,variant:R,...j},L=(e=>{const{classes:r,anchor:s,variant:n}=e,i={root:["root",`anchor${t.capitalize(s)}`],docked:[("permanent"===n||"persistent"===n)&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${t.capitalize(s)}`,"temporary"!==n&&`paperAnchorDocked${t.capitalize(s)}`]};return t.composeClasses(i,l,r)})(I),$={slots:{transition:k,...C},slotProps:{paper:P,transition:_,...x,backdrop:t.mergeSlotProps$1(x.backdrop||{...y,...E},{transitionDuration:A})}},[M,B]=t.useSlot("root",{ref:s,elementType:u,className:t.clsx(L.root,L.modal,w),shouldForwardComponentProp:!0,ownerState:I,externalForwardedProps:{...$,...j,...T},additionalProps:{open:O,onClose:S,hideBackdrop:v,slots:{backdrop:$.slots.backdrop},slotProps:{backdrop:$.slotProps.backdrop}}}),[D,q]=t.useSlot("paper",{elementType:p,shouldForwardComponentProp:!0,className:t.clsx(L.paper,P.className),ownerState:I,externalForwardedProps:$,additionalProps:{elevation:"temporary"===R?b:0,square:!0,..."temporary"===R&&{role:"dialog","aria-modal":"true"}}}),[z,W]=t.useSlot("docked",{elementType:h,ref:s,className:t.clsx(L.root,L.docked,w),ownerState:I,externalForwardedProps:$,additionalProps:j}),[H,K]=t.useSlot("transition",{elementType:a,ownerState:I,externalForwardedProps:$,additionalProps:{in:O,direction:d[F],timeout:A,appear:U.current}}),V=r.jsx(D,{...q,children:g});if("permanent"===R)return r.jsx(z,{...W,children:V});const X=r.jsx(H,{...K,children:V});return"persistent"===R?r.jsx(z,{...W,children:X}):r.jsx(M,{...B,children:X})});function m(e,t){return function(){return e.apply(t,arguments)}}"production"!==process.env.NODE_ENV&&(f.propTypes={anchor:t.PropTypes.oneOf(["bottom","left","right","top"]),BackdropProps:t.PropTypes.object,children:t.PropTypes.node,classes:t.PropTypes.object,className:t.PropTypes.string,elevation:t.integerPropType,hideBackdrop:t.PropTypes.bool,ModalProps:t.PropTypes.object,onClose:t.PropTypes.func,open:t.PropTypes.bool,PaperProps:t.PropTypes.object,SlideProps:t.PropTypes.object,slotProps:t.PropTypes.shape({backdrop:t.PropTypes.oneOfType([t.PropTypes.func,t.PropTypes.object]),docked:t.PropTypes.oneOfType([t.PropTypes.func,t.PropTypes.object]),paper:t.PropTypes.oneOfType([t.PropTypes.func,t.PropTypes.object]),root:t.PropTypes.oneOfType([t.PropTypes.func,t.PropTypes.object]),transition:t.PropTypes.oneOfType([t.PropTypes.func,t.PropTypes.object])}),slots:t.PropTypes.shape({backdrop:t.PropTypes.elementType,docked:t.PropTypes.elementType,paper:t.PropTypes.elementType,root:t.PropTypes.elementType,transition:t.PropTypes.elementType}),sx:t.PropTypes.oneOfType([t.PropTypes.arrayOf(t.PropTypes.oneOfType([t.PropTypes.func,t.PropTypes.object,t.PropTypes.bool])),t.PropTypes.func,t.PropTypes.object]),transitionDuration:t.PropTypes.oneOfType([t.PropTypes.number,t.PropTypes.shape({appear:t.PropTypes.number,enter:t.PropTypes.number,exit:t.PropTypes.number})]),variant:t.PropTypes.oneOf(["permanent","persistent","temporary"])});const{toString:y}=Object.prototype,{getPrototypeOf:g}=Object,{iterator:w,toStringTag:b}=Symbol,v=(e=>t=>{const r=y.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),E=e=>(e=e.toLowerCase(),t=>v(t)===e),T=e=>t=>typeof t===e,{isArray:S}=Array,O=T("undefined");function P(e){return null!==e&&!O(e)&&null!==e.constructor&&!O(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const _=E("ArrayBuffer");const k=T("string"),A=T("function"),R=T("number"),C=e=>null!==e&&"object"==typeof e,x=e=>{if("object"!==v(e))return!1;const t=g(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||b in e||w in e)},j=E("Date"),U=E("File"),F=E("Blob"),N=E("FileList"),I=E("URLSearchParams"),[L,$,M,B]=["ReadableStream","Request","Response","Headers"].map(E);function D(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let s,n;if("object"!=typeof e&&(e=[e]),S(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{if(P(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 q(e,t){if(P(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 z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,W=e=>!O(e)&&e!==z;const H=(K="undefined"!=typeof Uint8Array&&g(Uint8Array),e=>K&&e instanceof K);var K;const V=E("HTMLFormElement"),X=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),J=E("RegExp"),Y=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};D(r,(r,n)=>{let i;!1!==(i=t(r,n,e))&&(s[n]=i||r)}),Object.defineProperties(e,s)};const G=E("AsyncFunction"),Q=(Z="function"==typeof setImmediate,ee=A(z.postMessage),Z?setImmediate:ee?(te=`axios@${Math.random()}`,re=[],z.addEventListener("message",({source:e,data:t})=>{e===z&&t===te&&re.length&&re.shift()()},!1),e=>{re.push(e),z.postMessage(te,"*")}):e=>setTimeout(e));var Z,ee,te,re;const se="undefined"!=typeof queueMicrotask?queueMicrotask.bind(z):"undefined"!=typeof process&&process.nextTick||Q;var ne={isArray:S,isArrayBuffer:_,isBuffer:P,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||A(e.append)&&("formdata"===(t=v(e))||"object"===t&&A(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_(e.buffer),t},isString:k,isNumber:R,isBoolean:e=>!0===e||!1===e,isObject:C,isPlainObject:x,isEmptyObject:e=>{if(!C(e)||P(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:L,isRequest:$,isResponse:M,isHeaders:B,isUndefined:O,isDate:j,isFile:U,isBlob:F,isRegExp:J,isFunction:A,isStream:e=>C(e)&&A(e.pipe),isURLSearchParams:I,isTypedArray:H,isFileList:N,forEach:D,merge:function e(){const{caseless:t,skipUndefined:r}=W(this)&&this||{},s={},n=(n,i)=>{const o=t&&q(s,i)||i;x(s[o])&&x(n)?s[o]=e(s[o],n):x(n)?s[o]=e({},n):S(n)?s[o]=n.slice():r&&O(n)||(s[o]=n)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&D(arguments[e],n);return s},extend:(e,t,r,{allOwnKeys:s}={})=>(D(t,(t,s)=>{r&&A(t)?e[s]=m(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&&g(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:v,kindOfTest:E,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(S(e))return e;let t=e.length;if(!R(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[w]).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:V,hasOwnProperty:X,hasOwnProp:X,reduceDescriptors:Y,freezeMethods:e=>{Y(e,(t,r)=>{if(A(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const s=e[r];A(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 S(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:q,global:z,isContextDefined:W,isSpecCompliantForm:function(e){return!!(e&&A(e.append)&&"FormData"===e[b]&&e[w])},toJSONObject:e=>{const t=new Array(10),r=(e,s)=>{if(C(e)){if(t.indexOf(e)>=0)return;if(P(e))return e;if(!("toJSON"in e)){t[s]=e;const n=S(e)?[]:{};return D(e,(e,t)=>{const i=r(e,s+1);!O(i)&&(n[t]=i)}),t[s]=void 0,n}}return e};return r(e,0)},isAsyncFn:G,isThenable:e=>e&&(C(e)||A(e))&&A(e.then)&&A(e.catch),setImmediate:Q,asap:se,isIterable:e=>null!=e&&A(e[w])};function ie(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)}ne.inherits(ie,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:ne.toJSONObject(this.config),code:this.code,status:this.status}}});const oe=ie.prototype,ae={};["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=>{ae[e]={value:e}}),Object.defineProperties(ie,ae),Object.defineProperty(oe,"isAxiosError",{value:!0}),ie.from=(e,t,r,s,n,i)=>{const o=Object.create(oe);ne.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 ie.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 le(e){return ne.isPlainObject(e)||ne.isArray(e)}function ce(e){return ne.endsWith(e,"[]")?e.slice(0,-2):e}function ue(e,t,r){return e?e.concat(t).map(function(e,t){return e=ce(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const he=ne.toFlatObject(ne,{},null,function(e){return/^is[A-Z]/.test(e)});function pe(e,t,r){if(!ne.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const s=(r=ne.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ne.isUndefined(t[e])})).metaTokens,n=r.visitor||c,i=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ne.isSpecCompliantForm(t);if(!ne.isFunction(n))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(ne.isDate(e))return e.toISOString();if(ne.isBoolean(e))return e.toString();if(!a&&ne.isBlob(e))throw new ie("Blob is not supported. Use a Buffer instead.");return ne.isArrayBuffer(e)||ne.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(ne.endsWith(r,"{}"))r=s?r:r.slice(0,-2),e=JSON.stringify(e);else if(ne.isArray(e)&&function(e){return ne.isArray(e)&&!e.some(le)}(e)||(ne.isFileList(e)||ne.endsWith(r,"[]"))&&(a=ne.toArray(e)))return r=ce(r),a.forEach(function(e,s){!ne.isUndefined(e)&&null!==e&&t.append(!0===o?ue([r],s,i):null===o?r:r+"[]",l(e))}),!1;return!!le(e)||(t.append(ue(n,r,i),l(e)),!1)}const u=[],h=Object.assign(he,{defaultVisitor:c,convertValue:l,isVisitable:le});if(!ne.isObject(e))throw new TypeError("data must be an object");return function e(r,s){if(!ne.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+s.join("."));u.push(r),ne.forEach(r,function(r,i){!0===(!(ne.isUndefined(r)||null===r)&&n.call(t,r,ne.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 fe(e,t){this._pairs=[],e&&pe(e,this,t)}const me=fe.prototype;function ye(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ge(e,t,r){if(!t)return e;const s=r&&r.encode||ye;ne.isFunction(r)&&(r={serialize:r});const n=r&&r.serialize;let i;if(i=n?n(t,r):ne.isURLSearchParams(t)?t.toString():new fe(t,r).toString(s),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}me.append=function(e,t){this._pairs.push([e,t])},me.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 we{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){ne.forEach(this.handlers,function(t){null!==t&&e(t)})}}var be={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ve={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:fe,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Ee="undefined"!=typeof window&&"undefined"!=typeof document,Te="object"==typeof navigator&&navigator||void 0,Se=Ee&&(!Te||["ReactNative","NativeScript","NS"].indexOf(Te.product)<0),Oe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Pe=Ee&&window.location.href||"http://localhost";var _e={...Object.freeze({__proto__:null,hasBrowserEnv:Ee,hasStandardBrowserEnv:Se,hasStandardBrowserWebWorkerEnv:Oe,navigator:Te,origin:Pe}),...ve};function ke(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&&ne.isArray(s)?s.length:i,a)return ne.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!o;s[i]&&ne.isObject(s[i])||(s[i]=[]);return t(e,r,s[i],n)&&ne.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(ne.isFormData(e)&&ne.isFunction(e.entries)){const r={};return ne.forEachEntry(e,(e,s)=>{t(function(e){return ne.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),s,r,0)}),r}return null}const Ae={transitional:be,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,n=ne.isObject(e);n&&ne.isHTMLForm(e)&&(e=new FormData(e));if(ne.isFormData(e))return s?JSON.stringify(ke(e)):e;if(ne.isArrayBuffer(e)||ne.isBuffer(e)||ne.isStream(e)||ne.isFile(e)||ne.isBlob(e)||ne.isReadableStream(e))return e;if(ne.isArrayBufferView(e))return e.buffer;if(ne.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 pe(e,new _e.classes.URLSearchParams,{visitor:function(e,t,r,s){return _e.isNode&&ne.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=ne.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return pe(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||s?(t.setContentType("application/json",!1),function(e,t,r){if(ne.isString(e))try{return(t||JSON.parse)(e),ne.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ae.transitional,r=t&&t.forcedJSONParsing,s="json"===this.responseType;if(ne.isResponse(e)||ne.isReadableStream(e))return e;if(e&&ne.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 ie.from(e,ie.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:_e.classes.FormData,Blob:_e.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ne.forEach(["delete","get","head","post","put","patch"],e=>{Ae.headers[e]={}});const Re=ne.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 Ce=Symbol("internals");function xe(e){return e&&String(e).trim().toLowerCase()}function je(e){return!1===e||null==e?e:ne.isArray(e)?e.map(je):String(e)}function Ue(e,t,r,s,n){return ne.isFunction(s)?s.call(this,t,r):(n&&(t=r),ne.isString(t)?ne.isString(s)?-1!==t.indexOf(s):ne.isRegExp(s)?s.test(t):void 0:void 0)}let Fe=class{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function n(e,t,r){const n=xe(t);if(!n)throw new Error("header name must be a non-empty string");const i=ne.findKey(s,n);(!i||void 0===s[i]||!0===r||void 0===r&&!1!==s[i])&&(s[i||t]=je(e))}const i=(e,t)=>ne.forEach(e,(e,r)=>n(e,r,t));if(ne.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ne.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]&&Re[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(ne.isObject(e)&&ne.isIterable(e)){let r,s,n={};for(const t of e){if(!ne.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[s=t[0]]=(r=n[s])?ne.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=xe(e)){const r=ne.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(ne.isFunction(t))return t.call(this,e,r);if(ne.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=xe(e)){const r=ne.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ue(0,this[r],r,t))}return!1}delete(e,t){const r=this;let s=!1;function n(e){if(e=xe(e)){const n=ne.findKey(r,e);!n||t&&!Ue(0,r[n],n,t)||(delete r[n],s=!0)}}return ne.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&&!Ue(0,this[n],n,e,!0)||(delete this[n],s=!0)}return s}normalize(e){const t=this,r={};return ne.forEach(this,(s,n)=>{const i=ne.findKey(r,n);if(i)return t[i]=je(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]=je(s),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ne.forEach(this,(r,s)=>{null!=r&&!1!==r&&(t[s]=e&&ne.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[Ce]=this[Ce]={accessors:{}}).accessors,r=this.prototype;function s(e){const s=xe(e);t[s]||(!function(e,t){const r=ne.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 ne.isArray(e)?e.forEach(s):s(e),this}};function Ne(e,t){const r=this||Ae,s=t||r,n=Fe.from(s.headers);let i=s.data;return ne.forEach(e,function(e){i=e.call(r,i,n.normalize(),t?t.status:void 0)}),n.normalize(),i}function Ie(e){return!(!e||!e.__CANCEL__)}function Le(e,t,r){ie.call(this,null==e?"canceled":e,ie.ERR_CANCELED,t,r),this.name="CanceledError"}function $e(e,t,r){const s=r.config.validateStatus;r.status&&s&&!s(r.status)?t(new ie("Request failed with status code "+r.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}Fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ne.reduceDescriptors(Fe.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),ne.freezeMethods(Fe),ne.inherits(Le,ie,{__CANCEL__:!0});const Me=(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 p=c&&l-c;return p?Math.round(1e3*h/p):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)},Be=(e,t)=>{const r=null!=e;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},De=e=>(...t)=>ne.asap(()=>e(...t));var qe=_e.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,_e.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(_e.origin),_e.navigator&&/(msie|trident)/i.test(_e.navigator.userAgent)):()=>!0,ze=_e.hasStandardBrowserEnv?{write(e,t,r,s,n,i,o){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ne.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),ne.isString(s)&&a.push(`path=${s}`),ne.isString(n)&&a.push(`domain=${n}`),!0===i&&a.push("secure"),ne.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 We(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 He=e=>e instanceof Fe?{...e}:e;function Ke(e,t){t=t||{};const r={};function s(e,t,r,s){return ne.isPlainObject(e)&&ne.isPlainObject(t)?ne.merge.call({caseless:s},e,t):ne.isPlainObject(t)?ne.merge({},t):ne.isArray(t)?t.slice():t}function n(e,t,r,n){return ne.isUndefined(t)?ne.isUndefined(e)?void 0:s(void 0,e,0,n):s(e,t,0,n)}function i(e,t){if(!ne.isUndefined(t))return s(void 0,t)}function o(e,t){return ne.isUndefined(t)?ne.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(He(e),He(t),0,!0)};return ne.forEach(Object.keys({...e,...t}),function(s){const i=l[s]||n,o=i(e[s],t[s],s);ne.isUndefined(o)&&i!==a||(r[s]=o)}),r}var Ve=e=>{const t=Ke({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=Fe.from(o),t.url=ge(We(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ne.isFormData(r))if(_e.hasStandardBrowserEnv||_e.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(ne.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(_e.hasStandardBrowserEnv&&(s&&ne.isFunction(s)&&(s=s(t)),s||!1!==s&&qe(t.url))){const e=n&&i&&ze.read(i);e&&o.set(n,e)}return t};var Xe="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const s=Ve(e);let n=s.data;const i=Fe.from(s.headers).normalize();let o,a,l,c,u,{responseType:h,onUploadProgress:p,onDownloadProgress:d}=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 y(){if(!m)return;const s=Fe.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());$e(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=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(r(new ie("Request aborted",ie.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const s=new ie(t&&t.message?t.message:"Network Error",ie.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||be;s.timeoutErrorMessage&&(t=s.timeoutErrorMessage),r(new ie(t,n.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,m)),m=null},void 0===n&&i.setContentType(null),"setRequestHeader"in m&&ne.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),ne.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),h&&"json"!==h&&(m.responseType=s.responseType),d&&([l,u]=Me(d,!0),m.addEventListener("progress",l)),p&&m.upload&&([a,c]=Me(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(s.cancelToken||s.signal)&&(o=t=>{m&&(r(!t||t.type?new Le(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 g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(s.url);g&&-1===_e.protocols.indexOf(g)?r(new ie("Unsupported protocol "+g+":",ie.ERR_BAD_REQUEST,e)):m.send(n||null)})};const Je=(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 ie?t:new Le(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,n(new ie(`timeout ${t} of ms exceeded`,ie.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=()=>ne.asap(o),a}},Ye=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},Ge=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()}},Qe=(e,t,r,s)=>{const n=async function*(e,t){for await(const r of Ge(e))yield*Ye(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:Ze}=ne,et=(({Request:e,Response:t})=>({Request:e,Response:t}))(ne.global),{ReadableStream:tt,TextEncoder:rt}=ne.global,st=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},nt=e=>{e=ne.merge.call({skipUndefined:!0},et,e);const{fetch:t,Request:r,Response:s}=e,n=t?Ze(t):"function"==typeof fetch,i=Ze(r),o=Ze(s);if(!n)return!1;const a=n&&Ze(tt),l=n&&("function"==typeof rt?(c=new rt,e=>c.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var c;const u=i&&a&&st(()=>{let e=!1;const t=new r(_e.origin,{body:new tt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=o&&a&&st(()=>ne.isReadableStream(new s("").body)),p={stream:h&&(e=>e.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,r)=>{let s=t&&t[e];if(s)return s.call(t);throw new ie(`Response type '${e}' is not supported`,ie.ERR_NOT_SUPPORT,r)})});const d=async(e,t)=>{const s=ne.toFiniteNumber(e.getContentLength());return null==s?(async e=>{if(null==e)return 0;if(ne.isBlob(e))return e.size;if(ne.isSpecCompliantForm(e)){const t=new r(_e.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ne.isArrayBufferView(e)||ne.isArrayBuffer(e)?e.byteLength:(ne.isURLSearchParams(e)&&(e+=""),ne.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:y,responseType:g,headers:w,withCredentials:b="same-origin",fetchOptions:v}=Ve(e),E=t||fetch;g=g?(g+"").toLowerCase():"text";let T=Je([l,c&&c.toAbortSignal()],f),S=null;const O=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let P;try{if(y&&u&&"get"!==o&&"head"!==o&&0!==(P=await d(w,a))){let e,t=new r(n,{method:"POST",body:a,duplex:"half"});if(ne.isFormData(a)&&(e=t.headers.get("content-type"))&&w.setContentType(e),t.body){const[e,r]=Be(P,Me(De(y)));a=Qe(t.body,65536,e,r)}}ne.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in r.prototype,l={...v,signal:T,method:o.toUpperCase(),headers:w.normalize().toJSON(),body:a,duplex:"half",credentials:t?b:void 0};S=i&&new r(n,l);let c=await(i?E(S,v):E(n,l));const f=h&&("stream"===g||"response"===g);if(h&&(m||f&&O)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=ne.toFiniteNumber(c.headers.get("content-length")),[r,n]=m&&Be(t,Me(De(m),!0))||[];c=new s(Qe(c.body,65536,r,()=>{n&&n(),O&&O()}),e)}g=g||"text";let _=await p[ne.findKey(p,g)||"text"](c,e);return!f&&O&&O(),await new Promise((t,r)=>{$e(t,r,{data:_,headers:Fe.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:S})})}catch(t){if(O&&O(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ie("Network Error",ie.ERR_NETWORK,e,S),{cause:t.cause||t});throw ie.from(t,t&&t.code,e,S)}}},it=new Map,ot=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=it;for(;l--;)o=i[l],a=c.get(o),void 0===a&&c.set(o,a=l?new Map:nt(t)),c=a;return a};ot();const at={http:null,xhr:Xe,fetch:{get:ot}};ne.forEach(at,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const lt=e=>`- ${e}`,ct=e=>ne.isFunction(e)||null===e||!1===e;var ut={getAdapter:function(e,t){e=ne.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,!ct(s)&&(n=at[(r=String(s)).toLowerCase()],void 0===n))throw new ie(`Unknown adapter '${r}'`);if(n&&(ne.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 ie("There is no suitable adapter to dispatch the request "+(r?e.length>1?"since :\n"+e.map(lt).join("\n"):" "+lt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n},adapters:at};function ht(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Le(null,e)}function pt(e){ht(e),e.headers=Fe.from(e.headers),e.data=Ne.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ut.getAdapter(e.adapter||Ae.adapter,e)(e).then(function(t){return ht(e),t.data=Ne.call(e,e.transformResponse,t),t.headers=Fe.from(t.headers),t},function(t){return Ie(t)||(ht(e),t&&t.response&&(t.response.data=Ne.call(e,e.transformResponse,t.response),t.response.headers=Fe.from(t.response.headers))),Promise.reject(t)})}const dt="1.13.2",ft={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ft[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const mt={};ft.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 ie(s(n," has been removed"+(t?" in "+t:"")),ie.ERR_DEPRECATED);return t&&!mt[n]&&(mt[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)}},ft.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var yt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ie("options must be an object",ie.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 ie("option "+i+" must be "+r,ie.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new ie("Unknown option "+i,ie.ERR_BAD_OPTION)}},validators:ft};const gt=yt.validators;let wt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new we,response:new we}}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=Ke(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:n}=t;void 0!==r&&yt.assertOptions(r,{silentJSONParsing:gt.transitional(gt.boolean),forcedJSONParsing:gt.transitional(gt.boolean),clarifyTimeoutError:gt.transitional(gt.boolean)},!1),null!=s&&(ne.isFunction(s)?t.paramsSerializer={serialize:s}:yt.assertOptions(s,{encode:gt.function,serialize:gt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),yt.assertOptions(t,{baseUrl:gt.spelling("baseURL"),withXsrfToken:gt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=n&&ne.merge(n.common,n[t.method]);n&&ne.forEach(["delete","get","head","post","put","patch","common"],e=>{delete n[e]}),t.headers=Fe.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=[pt.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 p=t;for(;h<u;){const e=o[h++],t=o[h++];try{p=e(p)}catch(e){t.call(this,e);break}}try{c=pt.call(this,p)}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 ge(We((e=Ke(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ne.forEach(["delete","get","head","options"],function(e){wt.prototype[e]=function(t,r){return this.request(Ke(r||{},{method:e,url:t,data:(r||{}).data}))}}),ne.forEach(["post","put","patch"],function(e){function t(t){return function(r,s,n){return this.request(Ke(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}wt.prototype[e]=t(),wt.prototype[e+"Form"]=t(!0)});const bt={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(bt).forEach(([e,t])=>{bt[t]=e});const vt=function e(t){const r=new wt(t),s=m(wt.prototype.request,r);return ne.extend(s,wt.prototype,r,{allOwnKeys:!0}),ne.extend(s,r,null,{allOwnKeys:!0}),s.create=function(r){return e(Ke(t,r))},s}(Ae);vt.Axios=wt,vt.CanceledError=Le,vt.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 Le(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}}},vt.isCancel=Ie,vt.VERSION=dt,vt.toFormData=pe,vt.AxiosError=ie,vt.Cancel=vt.CanceledError,vt.all=function(e){return Promise.all(e)},vt.spread=function(e){return function(t){return e.apply(null,t)}},vt.isAxiosError=function(e){return ne.isObject(e)&&!0===e.isAxiosError},vt.mergeConfig=Ke,vt.AxiosHeaders=Fe,vt.formToJSON=e=>ke(ne.isHTMLForm(e)?new FormData(e):e),vt.getAdapter=ut.getAdapter,vt.HttpStatusCode=bt,vt.default=vt;const{Axios:Et,AxiosError:Tt,CanceledError:St,isCancel:Ot,CancelToken:Pt,VERSION:_t,all:kt,Cancel:At,isAxiosError:Rt,spread:Ct,toFormData:xt,AxiosHeaders:jt,HttpStatusCode:Ut,formToJSON:Ft,getAdapter:Nt,mergeConfig:It}=vt,Lt={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"}},$t="/upload/start",Mt="/upload/complete",Bt="/upload/signpart",Dt="APP_AUTH_BASE_URL",qt="APP_BASE_WEBSOCKET_URL",zt="/user",Wt="/auth/register",Ht="/auth/verify",Kt="/user",Vt="/customers/custom",Xt="/customers",Jt="/model",Yt="/tryon/user-image-urls/upload",Gt="/tryon/user-image-urls/download",Qt="/tryon/user-image-urls",Zt="/tryon/result-image-urls/download",er="/tryon",tr="/auth",rr="/scanning",sr="/recommendation",nr="/tryon/share",ir="/deviceinfo",or="/tryon/product-image-eligibility",ar=["gender","focal_length","height","customer_store_url","callback_url","clothes_fit"],lr=["gender","focal_length","customer_store_url","scan_type","callback_url","face_scan_id"],cr="Please verify required parameters",ur="Please verify required parameters in meta data",hr="Invalid Email",pr=5242880;var dr;!function(e){e.DEV="dev",e.STAGING="staging",e.PROD="prod"}(dr||(dr={}));var fr=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 mr(e){return fr(this,void 0,void 0,function*(){const{path:t,body:r,queryParams:s,baseUrl:n=Dt,apiKey:i="",throwError:o=!1,headers:a={"X-Api-Key":i,"Content-Type":"application/json"},urlType:l=dr.PROD}=e,c=`${vr({urlName:n,urlType:l})}${t}${s?`?${new URLSearchParams(s)}`:""}`;try{const e=yield vt.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 yr(...e){for(const t of e)if(!t)return!1;return!0}function gr(e){if(!wr(e,ar))return!1;let t=!1;for(const r of e)r.callback_url&&r.callback_url.startsWith("https")&&(t=!0);return!!t}const wr=(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},br=(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 vr=({urlName:e,urlType:t=dr.PROD})=>Lt[t][e],Er=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 Tr,Sr,Or,Pr=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},_r=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 kr{constructor(e,t=dr.PROD){Tr.set(this,void 0),Sr.set(this,void 0),Or.set(this,void 0),Pr(this,Sr,e,"f"),Pr(this,Or,t,"f")}registerUser({email:e,appVerifyUrl:t,gender:r,height:s,username:n}){if(!yr(e,t))throw new Error(cr);let i={username:n,email:e,appVerifyUrl:t};return r&&s&&(i=Object.assign(Object.assign({},i),{attributes:{gender:r,height:s}})),vt.post(`${vr({urlName:Dt,urlType:_r(this,Or,"f")})}${Wt}`,i,{headers:{"X-Api-Key":_r(this,Sr,"f")}})}verifyToken(e){if(!yr(e))throw new Error(cr);return vt.post(`${vr({urlName:Dt,urlType:_r(this,Or,"f")})}${Ht}`,null,{params:{token:e},headers:{"X-Api-Key":_r(this,Sr,"f")}})}addUser({scanId:e,email:t,name:r,height:s,gender:n,offsetMarketingConsent:i}){if(!yr(e,t,s,n))throw new Error(cr);return vt.post(`${vr({urlName:Dt,urlType:_r(this,Or,"f")})}${Kt}`,{scan_id:e,email:t,name:r,offsetMarketingConsent:i,attributes:JSON.stringify({height:s,gender:n})},{headers:{"X-Api-Key":_r(this,Sr,"f")}})}getUserDetail(e){if(!yr(e))throw new Error(cr);return vt.get(`${vr({urlName:Dt,urlType:_r(this,Or,"f")})}${zt}/${e}`,{headers:{"X-Api-Key":_r(this,Sr,"f")}})}handleAuthSocket({email:e,scanId:t,onError:r,onSuccess:s,onClose:n,onOpen:i}){if(!yr(e,t))throw new Error(cr);_r(this,Tr,"f")&&_r(this,Tr,"f").close(),Pr(this,Tr,new WebSocket(`${vr({urlName:qt,urlType:_r(this,Or,"f")})}${tr}`),"f");const o={email:e,scanId:t};_r(this,Tr,"f")&&(_r(this,Tr,"f").onopen=()=>{var e;null===(e=_r(this,Tr,"f"))||void 0===e||e.send(JSON.stringify(o)),null==i||i()},_r(this,Tr,"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)},_r(this,Tr,"f").onclose=()=>{null==n||n()},_r(this,Tr,"f").onerror=e=>{null==r||r(e)})}}Tr=new WeakMap,Sr=new WeakMap,Or=new WeakMap;var Ar,Rr,Cr=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},xr=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 jr{constructor(e,t=dr.PROD){Ar.set(this,void 0),Rr.set(this,void 0),this.getCustomCustomerConfig=e=>{if(!1===yr(e))throw new Error(cr);return vt.get(`${vr({urlName:Dt,urlType:xr(this,Rr,"f")})}${Vt}`,{params:{store_url:e},headers:{"X-Api-Key":xr(this,Ar,"f")}})},this.getModelUrl=e=>{if(!1===yr(e))throw new Error(cr);return vt.get(`${vr({urlName:Dt,urlType:xr(this,Rr,"f")})}${Jt}/${e}`,{headers:{"X-Api-Key":xr(this,Ar,"f")}})},Cr(this,Ar,e,"f"),Cr(this,Rr,t,"f")}createCustomer(e){if(!1===yr(e.name,e.storeUrl,e.email,e.location))throw new Error(cr);return vt.post(`${vr({urlName:Dt,urlType:xr(this,Rr,"f")})}${Xt}`,Object.assign(Object.assign({},e),{headers:{"X-Api-Key":xr(this,Ar,"f")}}))}}function Ur(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Ar=new WeakMap,Rr=new WeakMap;var Fr=0;function Nr(e){return"__private_"+Fr+++"_"+e}function Ir(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 Lr(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=Ir(s,new RegExp(`%\\{${e}\\}`,"g"),n)}return s}const $r=e=>{throw new Error(`missing string: ${e}`)};var Mr,Br,Dr=Nr("onMissingKey"),qr=Nr("apply");class zr{constructor(e,t){let{onMissingKey:r=$r}=void 0===t?{}:t;Object.defineProperty(this,qr,{value:Wr}),Object.defineProperty(this,Dr,{writable:!0,value:void 0}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(e)?e.forEach(Ur(this,qr)[qr],this):Ur(this,qr)[qr](e),Ur(this,Dr)[Dr]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];null==r&&(Ur(this,Dr)[Dr](e),r=e);if("object"==typeof r){if(t&&void 0!==t.smart_count){return Lr(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 Lr(r,t)}}function Wr(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 Hr=(Br||(Br=1,Mr=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}),Mr),Kr=t.getDefaultExportFromCjs(Hr);var Vr,Xr,Jr,Yr,Gr,Qr,Zr,es,ts,rs,ss,ns,is,os,as,ls,cs,us,hs,ps,ds,fs,ms,ys,gs,ws,bs,vs,Es,Ts;function Ss(){if(Xr)return Vr;return Xr=1,Vr=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Vr}function Os(){if(Qr)return Gr;Qr=1;var e=function(){if(Yr)return Jr;Yr=1;var e="object"==typeof t.commonjsGlobal&&t.commonjsGlobal&&t.commonjsGlobal.Object===Object&&t.commonjsGlobal;return Jr=e}(),r="object"==typeof self&&self&&self.Object===Object&&self,s=e||r||Function("return this")();return Gr=s}function Ps(){if(ns)return ss;ns=1;var e=function(){if(rs)return ts;rs=1;var e=/\s/;return ts=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}}(),t=/^\s+/;return ss=function(r){return r?r.slice(0,e(r)+1).replace(t,""):r}}function _s(){if(os)return is;os=1;var e=Os().Symbol;return is=e}function ks(){if(ps)return hs;ps=1;var e=_s(),t=function(){if(ls)return as;ls=1;var e=_s(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,n=e?e.toStringTag:void 0;return as=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},as}(),r=function(){if(us)return cs;us=1;var e=Object.prototype.toString;return cs=function(t){return e.call(t)},cs}(),s=e?e.toStringTag:void 0;return hs=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?t(e):r(e)},hs}function As(){if(ys)return ms;ys=1;var e=ks(),t=(fs||(fs=1,ds=function(e){return null!=e&&"object"==typeof e}),ds);return ms=function(r){return"symbol"==typeof r||t(r)&&"[object Symbol]"==e(r)},ms}function Rs(){if(vs)return bs;vs=1;var e=Ss(),t=function(){if(es)return Zr;es=1;var e=Os();return Zr=function(){return e.Date.now()}}(),r=function(){if(ws)return gs;ws=1;var e=Ps(),t=Ss(),r=As(),s=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,i=/^0o[0-7]+$/i,o=parseInt;return gs=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},gs}(),s=Math.max,n=Math.min;return bs=function(i,o,a){var l,c,u,h,p,d,f=0,m=!1,y=!1,g=!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-d;return void 0===d||t>=o||t<0||y&&e-f>=u}function v(){var e=t();if(b(e))return E(e);p=setTimeout(v,function(e){var t=o-(e-d);return y?n(t,u-(e-f)):t}(e))}function E(e){return p=void 0,g&&l?w(e):(l=c=void 0,h)}function T(){var e=t(),r=b(e);if(l=arguments,c=this,d=e,r){if(void 0===p)return function(e){return f=e,p=setTimeout(v,o),m?w(e):h}(d);if(y)return clearTimeout(p),p=setTimeout(v,o),w(d)}return void 0===p&&(p=setTimeout(v,o)),h}return o=r(o)||0,e(a)&&(m=!!a.leading,u=(y="maxWait"in a)?s(r(a.maxWait)||0,o):u,g="trailing"in a?!!a.trailing:g),T.cancel=function(){void 0!==p&&clearTimeout(p),f=0,l=d=c=p=void 0},T.flush=function(){return void 0===p?h:E(t())},T},bs}var Cs=function(){if(Ts)return Es;Ts=1;var e=Rs(),t=Ss();return Es=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})}}(),xs=t.getDefaultExportFromCjs(Cs);function js(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Us=0;function Fs(e){return"__private_"+Us+++"_"+e}var Ns=Fs("callbacks"),Is=Fs("publish");class Ls{constructor(){Object.defineProperty(this,Is,{value:$s}),this.state={},Object.defineProperty(this,Ns,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},r={...this.state,...e};this.state=r,js(this,Is)[Is](t,r,e)}subscribe(e){return js(this,Ns)[Ns].add(e),()=>{js(this,Ns)[Ns].delete(e)}}}function $s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];js(this,Ns)[Ns].forEach(e=>{e(...t)})}function Ms(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)}}Ls.VERSION="3.2.2";var Bs={__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 Ds(e){var t;if(e.type)return e.type;const r=e.name?null==(t=Ms(e.name).extension)?void 0:t.toLowerCase():null;return r&&r in Bs?Bs[r]:"application/octet-stream"}function qs(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}function zs(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=Ds(e);return function(e,t){let r=t||"uppy";return"string"==typeof e.name&&(r+=`-${qs(e.name.toLowerCase())}`),void 0!==e.type&&(r+=`-${e.type}`),e.meta&&"string"==typeof e.meta.relativePath&&(r+=`-${qs(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 Ws(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 Hs(e){return e<10?`0${e}`:e.toString()}function Ks(){const e=new Date;return`${Hs(e.getHours())}:${Hs(e.getMinutes())}:${Hs(e.getSeconds())}`}const Vs={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] [${Ks()}]`,...t)}},Xs={debug:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return console.debug(`[Uppy] [${Ks()}]`,...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] [${Ks()}]`,...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] [${Ks()}]`,...t)}};var Js,Ys;var Gs,Qs,Zs,en,tn=(Ys||(Ys=1,Js=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}`}),Js),rn=t.getDefaultExportFromCjs(tn);function sn(){if(Qs)return Gs;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return Qs=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},Gs=function(t,r,s){var n=new e(t,s||/[\/\.]/);return void 0!==r?n.match(r):n},Gs}var nn=function(){if(en)return Zs;en=1;var e=sn(),t=/[\/\+\.]/;return Zs=function(r,s){function n(s){var n=e(s,r,t);return n&&n.length>=2}return s?n(s.split(";")[0]):n},Zs}(),on=t.getDefaultExportFromCjs(nn);const an={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class ln 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 cn{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 ln(`${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 ln(this.getI18n()("aggregateExceedsSize",{sizeAllowed:rn(r),size:rn(s)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s){if(!s.some(t=>t.includes("/")?!!e.type&&on(e.type.replace(/;.*?$/,""),t):!("."!==t[0]||!e.extension)&&e.extension.toLowerCase()===t.slice(1).toLowerCase())){const t=s.join(", ");throw new ln(this.getI18n()("youCanOnlyUploadFileTypes",{types:t}),{file:e})}}if(t&&null!=e.size&&e.size>t)throw new ln(this.getI18n()("exceedsSize",{size:rn(t),file:e.name}),{file:e});if(r&&null!=e.size&&e.size<r)throw new ln(this.getI18n()("inferiorSize",{size:rn(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 ln(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new ln(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 un={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 hn,pn;function dn(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var fn=0;function mn(e){return"__private_"+fn+++"_"+e}const yn={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var gn=mn("plugins"),wn=mn("restricter"),bn=mn("storeUnsubscribe"),vn=mn("emitter"),En=mn("preProcessors"),Tn=mn("uploaders"),Sn=mn("postProcessors"),On=mn("informAndEmit"),Pn=mn("checkRequiredMetaFieldsOnFile"),_n=mn("checkRequiredMetaFields"),kn=mn("assertNewUploadAllowed"),An=mn("transformFile"),Rn=mn("startIfAutoProceed"),Cn=mn("checkAndUpdateFileState"),xn=mn("addListeners"),jn=mn("updateOnlineStatus"),Un=mn("requestClientById"),Fn=mn("createUpload"),Nn=mn("getUpload"),In=mn("removeUpload"),Ln=mn("runUpload");hn=Symbol.for("uppy test: getPlugins"),pn=Symbol.for("uppy test: createUpload");class $n{constructor(e){Object.defineProperty(this,Ln,{value:Yn}),Object.defineProperty(this,In,{value:Jn}),Object.defineProperty(this,Nn,{value:Xn}),Object.defineProperty(this,Fn,{value:Vn}),Object.defineProperty(this,xn,{value:Kn}),Object.defineProperty(this,Cn,{value:Hn}),Object.defineProperty(this,Rn,{value:Wn}),Object.defineProperty(this,An,{value:zn}),Object.defineProperty(this,kn,{value:qn}),Object.defineProperty(this,_n,{value:Dn}),Object.defineProperty(this,Pn,{value:Bn}),Object.defineProperty(this,On,{value:Mn}),Object.defineProperty(this,gn,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,wn,{writable:!0,value:void 0}),Object.defineProperty(this,bn,{writable:!0,value:void 0}),Object.defineProperty(this,vn,{writable:!0,value:Kr()}),Object.defineProperty(this,En,{writable:!0,value:new Set}),Object.defineProperty(this,Tn,{writable:!0,value:new Set}),Object.defineProperty(this,Sn,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,this.calculateProgress=xs((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,jn,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,Un,{writable:!0,value:new Map}),this.defaultLocale=un;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:an,meta:{},onBeforeFileAdded:(e,t)=>!Object.hasOwn(t,e.id),onBeforeUpload:e=>e,store:new Ls,logger:Vs,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=Xs),this.log(`Using Core v${$n.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...yn,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:Ws(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),dn(this,wn)[wn]=new cn(()=>this.opts,()=>this.i18n),dn(this,bn)[bn]=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),dn(this,xn)[xn]()}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];dn(this,vn)[vn].emit(e,...r)}on(e,t){return dn(this,vn)[vn].on(e,t),this}once(e,t){return dn(this,vn)[vn].once(e,t),this}off(e,t){return dn(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 zr([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,...yn}),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({...yn,files:{}})}addPreProcessor(e){dn(this,En)[En].add(e)}removePreProcessor(e){return dn(this,En)[En].delete(e)}addPostProcessor(e){dn(this,Sn)[Sn].add(e)}removePostProcessor(e){return dn(this,Sn)[Sn].delete(e)}addUploader(e){dn(this,Tn)[Tn].add(e)}removeUploader(e){return dn(this,Tn)[Tn].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=[],p=[];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)&&p.push(e)}return{newFiles:i,startedFiles:o,uploadStartedFiles:a,pausedFiles:l,completeFiles:c,erroredFiles:u,inProgressFiles:n,inProgressNotPausedFiles:h,processingFiles:p,isUploadStarted:a.length>0,isAllComplete:100===t&&c.length===s.length&&0===p.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{dn(this,wn)[wn].validate(t,[e])}catch(e){return e}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){dn(this,kn)[kn](e);const{nextFilesState:t,validFilesToAdd:r,errors:s}=dn(this,Cn)[Cn]([e]),n=s.filter(e=>e.isRestriction);if(dn(this,On)[On](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}`),dn(this,Rn)[Rn](),i.id}addFiles(e){dn(this,kn)[kn]();const{nextFilesState:t,validFilesToAdd:r,errors:s}=dn(this,Cn)[Cn](e),n=s.filter(e=>e.isRestriction);dn(this,On)[On](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&&dn(this,Rn)[Rn]()}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=dn(this,Fn)[Fn](t,{forceAllowNewUpload:!0});return dn(this,Ln)[Ln](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(yn)}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=dn(this,Fn)[Fn]([e],{forceAllowNewUpload:!0});return dn(this,Ln)[Ln](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 dn(this,gn)[gn]?dn(this,gn)[gn][r.type].push(r):dn(this,gn)[gn][r.type]=[r],r.install(),this.emit("plugin-added",r),this}getPlugin(e){for(const t of Object.values(dn(this,gn)[gn])){const r=t.find(t=>t.id===e);if(null!=r)return r}}[hn](e){return dn(this,gn)[gn][e]}iteratePlugins(e){Object.values(dn(this,gn)[gn]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=dn(this,gn)[gn][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}),dn(this,bn)[bn](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",dn(this,jn)[jn]),window.removeEventListener("offline",dn(this,jn)[jn]))}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){dn(this,Un)[Un].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=dn(this,Un)[Un].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]?dn(this,Ln)[Ln](e):(dn(this,In)[In](e),Promise.reject(new Error("Nonexistent upload")))}[pn](){return dn(this,Fn)[Fn](...arguments)}addResultData(e,t){if(!dn(this,Nn)[Nn](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=dn(this,gn)[gn].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(()=>dn(this,wn)[wn].validateMinNumberOfFiles(t)).catch(e=>{throw dn(this,On)[On]([e]),e}).then(()=>{if(!dn(this,_n)[_n](t))throw new ln(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=dn(this,Fn)[Fn](s);return dn(this,Ln)[Ln](n)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function Mn(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 Bn(e){const{missingFields:t,error:r}=dn(this,wn)[wn].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(r.message),this.emit("restriction-failed",e,r),!1)}function Dn(e){let t=!0;for(const r of Object.values(e))dn(this,Pn)[Pn](r)||(t=!1);return t}function qn(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new ln(this.i18n("noMoreFilesAllowed"),{file:e});throw dn(this,On)[On]([t]),t}}function zn(e){const t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,r=Ds(t),s=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}(r,t),n=Ms(s).extension,i=zs(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 Wn(){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 Hn(e){const{files:t}=this.getState(),r={...t},s=[],n=[];for(const o of e)try{var i;let e=dn(this,An)[An](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 ln(this.i18n("noDuplicates",{fileName:e.name}),{file:o});if(!1===a&&!n)throw new ln("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:o});"object"==typeof a&&null!==a&&(e=a),dn(this,wn)[wn].validateSingleFile(e),r[e.id]=e,s.push(e)}catch(e){n.push(e)}try{dn(this,wn)[wn].validateAggregateRestrictions(Object.values(t),s)}catch(e){return n.push(e),{nextFilesState:t,validFilesToAdd:[],errors:n}}return{nextFilesState:r,validFilesToAdd:s,errors:n}}function Kn(){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}`),dn(this,On)[On]([e])}else dn(this,On)[On]([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:dn(this,Sn)[Sn].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&&dn(this,Pn)[Pn](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",dn(this,jn)[jn]),window.addEventListener("offline",dn(this,jn)[jn]),setTimeout(dn(this,jn)[jn],3e3))}function Vn(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 Xn(e){const{currentUploads:t}=this.getState();return t[e]}function Jn(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function Yn(e){const t=()=>{const{currentUploads:t}=this.getState();return t[e]};let r=t();const s=[...dn(this,En)[En],...dn(this,Tn)[Tn],...dn(this,Sn)[Sn]];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 dn(this,In)[In](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),dn(this,In)[In](e)),null==n&&this.log(`Not setting result for an upload that has been removed: ${e}`),n}$n.VERSION="3.13.1";class Gn{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 zr([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 Qn extends Error{constructor(){super(...arguments),this.name="UserFacingApiError"}}var Zn,ei,ti,ri,si,ni={};function ii(){return ti||(ti=1,e=ni,t=function(){if(ei)return Zn;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 ei=1,Zn=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},Zn}(),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}}),ni;var e,t}var oi=si?ri:(si=1,ri=ii()),ai=t.getDefaultExportFromCjs(oi);const li=Object.prototype.toString,ci=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 ui(e){const t=e&&(e=>"[object Error]"===li.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")||ci.has(r)}class hi 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 pi=(e,t,r)=>{const s=r.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=s,e};async function di(e,t){return new Promise((r,s)=>{t={...t},t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.retries??=10;const n=ai.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 hi)throw e.originalError;if(e instanceof TypeError&&!ui(e))throw e;if(pi(e,i,t),await t.shouldRetry(e)||(n.stop(),s(e)),await t.onFailedAttempt(e),!n.retry(e))throw n.mainError()}catch(e){pi(e,i,t),o(),s(e)}}})})}class fi 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 mi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}class yi extends Error{constructor(e,t){super(e),this.cause=null==t?void 0:t.cause,this.cause&&mi(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}var gi=xs(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 bi;function vi(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ei=0;function Ti(e){return"__private_"+Ei+++"_"+e}class Si extends Error{constructor(e){let{statusCode:t,message:r}=e;super(r),this.name="HttpError",this.statusCode=t}}var Oi=Ti("companionHeaders"),Pi=Ti("getUrl"),_i=Ti("requestSocketToken"),ki=Ti("awaitRemoteFileUpload");bi=Symbol.for("uppy test: getCompanionHeaders");class Ai{constructor(e,t){Object.defineProperty(this,ki,{value:Ci}),Object.defineProperty(this,Pi,{value:Ri}),Object.defineProperty(this,Oi,{writable:!0,value:void 0}),Object.defineProperty(this,_i,{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),vi(this,Oi)[Oi]=null==t?void 0:t.companionHeaders}setCompanionHeaders(e){vi(this,Oi)[Oi]=e}[bi](){return vi(this,Oi)[Oi]}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"}},...vi(this,Oi)[Oi]}}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 fi(e)})}(vi(this,Pi)[Pi](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 Qn(t.message);throw new Si({statusCode:e.status,message:r})}(o)}catch(e){if(e.isAuthError||"UserFacingApiError"===e.name||"AbortError"===e.name)throw e;throw new yi(`Could not ${r} ${vi(this,Pi)[Pi](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 di(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}`),vi(this,ki)[ki]({file:e,queue:i(),signal:n});const a=i().wrapPromiseFunction(async function(){try{return await vi(s,_i)[_i](...arguments)}catch(e){if(e.isAuthError)throw new hi(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 hi(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}),vi(this,ki)[ki]({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 Ri(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}async function Ci(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:p}=r;const d=(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&&d(p?"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),p||(h=setTimeout(()=>t(new Error("Timeout waiting for message from Companion socket")),3e5))}try{await s.wrapPromiseFunction(async()=>{await di(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":gi(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)}},y=e=>{var t;i.resumableUploads&&(p=e,c&&f(),e?null==(t=u)||null==t.abort||t.abort():m())},g=t=>{var s;i.individualCancellation&&t.id===r.id&&(d("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&&d("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&&y(t)},v=()=>y(!0),E=()=>y(!1);this.uppy.on("file-removed",g),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",g),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 xi(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Ai.VERSION="3.8.2";var ji=0;function Ui(e){return"__private_"+ji+++"_"+e}var Fi=Ui("uppy"),Ni=Ui("events");class Ii{constructor(e){Object.defineProperty(this,Fi,{writable:!0,value:void 0}),Object.defineProperty(this,Ni,{writable:!0,value:[]}),xi(this,Fi)[Fi]=e}on(e,t){return xi(this,Ni)[Ni].push([e,t]),xi(this,Fi)[Fi].on(e,t)}remove(){for(const[e,t]of xi(this,Ni)[Ni].splice(0))xi(this,Fi)[Fi].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",()=>{xi(this,Fi)[Fi].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{xi(this,Fi)[Fi].getFile(e)&&t()})}onCancelAll(e,t){var r=this;this.on("cancel-all",function(){xi(r,Fi)[Fi].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{xi(this,Fi)[Fi].getFile(e)&&t()})}}function Li(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var $i=0;function Mi(e){return"__private_"+$i+++"_"+e}function Bi(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 Di=Mi("activeRequests"),qi=Mi("queuedHandlers"),zi=Mi("paused"),Wi=Mi("pauseTimer"),Hi=Mi("downLimit"),Ki=Mi("upperLimit"),Vi=Mi("rateLimitingTimer"),Xi=Mi("call"),Ji=Mi("queueNext"),Yi=Mi("next"),Gi=Mi("queue"),Qi=Mi("dequeue"),Zi=Mi("resume"),eo=Mi("increaseLimit");class to{constructor(e){Object.defineProperty(this,Qi,{value:oo}),Object.defineProperty(this,Gi,{value:io}),Object.defineProperty(this,Yi,{value:no}),Object.defineProperty(this,Ji,{value:so}),Object.defineProperty(this,Xi,{value:ro}),Object.defineProperty(this,Di,{writable:!0,value:0}),Object.defineProperty(this,qi,{writable:!0,value:[]}),Object.defineProperty(this,zi,{writable:!0,value:!1}),Object.defineProperty(this,Wi,{writable:!0,value:void 0}),Object.defineProperty(this,Hi,{writable:!0,value:1}),Object.defineProperty(this,Ki,{writable:!0,value:void 0}),Object.defineProperty(this,Vi,{writable:!0,value:void 0}),Object.defineProperty(this,Zi,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,eo,{writable:!0,value:()=>{if(Li(this,zi)[zi])Li(this,Vi)[Vi]=setTimeout(Li(this,eo)[eo],0);else{Li(this,Hi)[Hi]=this.limit,this.limit=Math.ceil((Li(this,Ki)[Ki]+Li(this,Hi)[Hi])/2);for(let e=Li(this,Hi)[Hi];e<=this.limit;e++)Li(this,Ji)[Ji]();Li(this,Ki)[Ki]-Li(this,Hi)[Hi]>3?Li(this,Vi)[Vi]=setTimeout(Li(this,eo)[eo],2e3):Li(this,Hi)[Hi]=Math.floor(Li(this,Hi)[Hi]/2)}}}),this.limit="number"!=typeof e||0===e?1/0:e}run(e,t){return!Li(this,zi)[zi]&&Li(this,Di)[Di]<this.limit?Li(this,Xi)[Xi](e):Li(this,Gi)[Gi](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:Bi,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=Bi,a}}resume(){Li(this,zi)[zi]=!1,clearTimeout(Li(this,Wi)[Wi]);for(let e=0;e<this.limit;e++)Li(this,Ji)[Ji]()}pause(e){void 0===e&&(e=null),Li(this,zi)[zi]=!0,clearTimeout(Li(this,Wi)[Wi]),null!=e&&(Li(this,Wi)[Wi]=setTimeout(Li(this,Zi)[Zi],e))}rateLimit(e){clearTimeout(Li(this,Vi)[Vi]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(Li(this,Ki)[Ki]=this.limit-1,this.limit=Li(this,Hi)[Hi],Li(this,Vi)[Vi]=setTimeout(Li(this,eo)[eo],e))}get isPaused(){return Li(this,zi)[zi]}}function ro(e){Li(this,Di)[Di]+=1;let t,r=!1;try{t=e()}catch(e){throw Li(this,Di)[Di]-=1,e}return{abort:e=>{r||(r=!0,Li(this,Di)[Di]-=1,null==t||t(e),Li(this,Ji)[Ji]())},done:()=>{r||(r=!0,Li(this,Di)[Di]-=1,Li(this,Ji)[Ji]())}}}function so(){queueMicrotask(()=>Li(this,Yi)[Yi]())}function no(){if(Li(this,zi)[zi]||Li(this,Di)[Di]>=this.limit)return;if(0===Li(this,qi)[qi].length)return;const e=Li(this,qi)[qi].shift();if(null==e)throw new Error("Invariant violation: next is null");const t=Li(this,Xi)[Xi](e.fn);e.abort=t.abort,e.done=t.done}function io(e,t){const r={fn:e,priority:(null==t?void 0:t.priority)||0,abort:()=>{Li(this,Qi)[Qi](r)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},s=Li(this,qi)[qi].findIndex(e=>r.priority>e.priority);return-1===s?Li(this,qi)[qi].push(r):Li(this,qi)[qi].splice(s,0,r),r}function oo(e){const t=Li(this,qi)[qi].indexOf(e);-1!==t&&Li(this,qi)[qi].splice(t,1)}const{AbortController:ao}=globalThis,lo=function(e,t){void 0===e&&(e="Aborted");const r=new DOMException(e,"AbortError");return null!=t&&mi(t,"cause")&&Object.defineProperty(r,"cause",{__proto__:null,configurable:!0,writable:!0,value:t.cause}),r};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}const po={getChunkSize:e=>Math.ceil(e.size/1e4),onProgress(){},onPartComplete(){},onSuccess(){},onError(e){throw e}};const fo=Symbol("pausing upload, not an actual error");var mo=ho("abortController"),yo=ho("chunks"),go=ho("chunkState"),wo=ho("data"),bo=ho("file"),vo=ho("uploadHasStarted"),Eo=ho("onError"),To=ho("onSuccess"),So=ho("shouldUseMultipart"),Oo=ho("isRestoring"),Po=ho("onReject"),_o=ho("maxMultipartParts"),ko=ho("minPartSize"),Ao=ho("initChunks"),Ro=ho("createUpload"),Co=ho("resumeUpload"),xo=ho("onPartProgress"),jo=ho("onPartComplete"),Uo=ho("abortUpload");class Fo{constructor(e,t){var r;Object.defineProperty(this,Uo,{value:$o}),Object.defineProperty(this,Co,{value:Lo}),Object.defineProperty(this,Ro,{value:Io}),Object.defineProperty(this,Ao,{value:No}),Object.defineProperty(this,mo,{writable:!0,value:new ao}),Object.defineProperty(this,yo,{writable:!0,value:void 0}),Object.defineProperty(this,go,{writable:!0,value:void 0}),Object.defineProperty(this,wo,{writable:!0,value:void 0}),Object.defineProperty(this,bo,{writable:!0,value:void 0}),Object.defineProperty(this,vo,{writable:!0,value:!1}),Object.defineProperty(this,Eo,{writable:!0,value:void 0}),Object.defineProperty(this,To,{writable:!0,value:void 0}),Object.defineProperty(this,So,{writable:!0,value:void 0}),Object.defineProperty(this,Oo,{writable:!0,value:void 0}),Object.defineProperty(this,Po,{writable:!0,value:e=>(null==e?void 0:e.cause)===fo?null:co(this,Eo)[Eo](e)}),Object.defineProperty(this,_o,{writable:!0,value:1e4}),Object.defineProperty(this,ko,{writable:!0,value:5242880}),Object.defineProperty(this,xo,{writable:!0,value:e=>t=>{if(!t.lengthComputable)return;co(this,go)[go][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=co(this,go)[go].reduce((e,t)=>e+t.uploaded,0);this.options.onProgress(r,co(this,wo)[wo].size)}}),Object.defineProperty(this,jo,{writable:!0,value:e=>t=>{co(this,yo)[yo][e]=null,co(this,go)[go][e].etag=t,co(this,go)[go][e].done=!0;const r={PartNumber:e+1,ETag:t};this.options.onPartComplete(r)}}),this.options={...po,...t},null!=(r=this.options).getChunkSize||(r.getChunkSize=po.getChunkSize),co(this,wo)[wo]=e,co(this,bo)[bo]=t.file,co(this,To)[To]=this.options.onSuccess,co(this,Eo)[Eo]=this.options.onError,co(this,So)[So]=this.options.shouldUseMultipart,co(this,Oo)[Oo]=t.uploadId&&t.key,co(this,Ao)[Ao]()}start(){co(this,vo)[vo]?(co(this,mo)[mo].signal.aborted||co(this,mo)[mo].abort(fo),co(this,mo)[mo]=new ao,co(this,Co)[Co]()):co(this,Oo)[Oo]?(this.options.companionComm.restoreUploadFile(co(this,bo)[bo],{uploadId:this.options.uploadId,key:this.options.key}),co(this,Co)[Co]()):co(this,Ro)[Ro]()}pause(){co(this,mo)[mo].abort(fo),co(this,mo)[mo]=new ao}abort(e){null!=e&&e.really?co(this,Uo)[Uo]():this.pause()}get chunkState(){return co(this,go)[go]}}function No(){const e=co(this,wo)[wo].size,t="function"==typeof co(this,So)[So]?co(this,So)[So](co(this,bo)[bo]):Boolean(co(this,So)[So]);if(t&&e>co(this,ko)[ko]){let r=Math.max(this.options.getChunkSize(co(this,wo)[wo]),co(this,ko)[ko]),s=Math.floor(e/r);s>co(this,_o)[_o]&&(s=co(this,_o)[_o],r=e/co(this,_o)[_o]),co(this,yo)[yo]=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 co(this,wo)[wo].slice(e,i)};if(co(this,yo)[yo][n]={getData:o,onProgress:co(this,xo)[xo](n),onComplete:co(this,jo)[jo](n),shouldUseMultipart:t},co(this,Oo)[Oo]){const t=s+r>e?e-s:r;co(this,yo)[yo][n].setAsUploaded=()=>{co(this,yo)[yo][n]=null,co(this,go)[go][n].uploaded=t}}}}else co(this,yo)[yo]=[{getData:()=>co(this,wo)[wo],onProgress:co(this,xo)[xo](0),onComplete:co(this,jo)[jo](0),shouldUseMultipart:t}];co(this,go)[go]=co(this,yo)[yo].map(()=>({uploaded:0}))}function Io(){this.options.companionComm.uploadFile(co(this,bo)[bo],co(this,yo)[yo],co(this,mo)[mo].signal).then(co(this,To)[To],co(this,Po)[Po]),co(this,vo)[vo]=!0}function Lo(){this.options.companionComm.resumeUploadFile(co(this,bo)[bo],co(this,yo)[yo],co(this,mo)[mo].signal).then(co(this,To)[To],co(this,Po)[Po])}function $o(){co(this,mo)[mo].abort(),this.options.companionComm.abortFileUpload(co(this,bo)[bo]).catch(e=>this.options.log(e))}function Mo(e){if(null!=e&&e.aborted)throw lo("The operation was aborted",{cause:e.reason})}const Bo=new TextEncoder,Do={name:"HMAC",hash:"SHA-256"};function qo(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 zo(e,t){const{subtle:r}=globalThis.crypto;return r.sign(Do,await async function(e){const{subtle:t}=globalThis.crypto;return t.importKey("raw","string"==typeof e?Bo.encode(e):e,Do,!1,["sign"])}(e),Bo.encode(t))}async function Wo(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`,p=`/${encodeURI(i).replace(/[;?:@&=+$,#!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}`,d="UNSIGNED-PAYLOAD",f=(new Date).toISOString().replace(/[-:]|\.\d+/g,""),m=f.slice(0,8),y=`${m}/${o}/${u}/aws4_request`,g=new URL(`https://${h}${p}`);g.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),g.searchParams.set("X-Amz-Content-Sha256",d),g.searchParams.set("X-Amz-Credential",`${t}/${y}`),g.searchParams.set("X-Amz-Date",f),g.searchParams.set("X-Amz-Expires",a),g.searchParams.set("X-Amz-Security-Token",s),g.searchParams.set("X-Amz-SignedHeaders","host"),c&&g.searchParams.set("partNumber",c),l&&g.searchParams.set("uploadId",l),g.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:p,CanonicalQueryString:g.search.slice(1),SignedHeaders:{host:h},HashedPayload:d}),b=["AWS4-HMAC-SHA256",f,y,qo(await async function(e){const{subtle:t}=globalThis.crypto;return t.digest(Do.hash,Bo.encode(e))}(w))].join("\n"),v=await zo(`AWS4${r}`,m),E=await zo(v,o),T=await zo(E,u),S=await zo(T,"aws4_request"),O=qo(await zo(S,b));return g.searchParams.set("X-Amz-Signature",O),g}function Ho(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ko=0;function Vo(e){return"__private_"+Ko+++"_"+e}function Xo(e){const t=new URL(e);return t.search="",t.hash="",t.href}var Jo=Vo("abortMultipartUpload"),Yo=Vo("cache"),Go=Vo("createMultipartUpload"),Qo=Vo("fetchSignature"),Zo=Vo("getUploadParameters"),ea=Vo("listParts"),ta=Vo("previousRetryDelay"),ra=Vo("requests"),sa=Vo("retryDelays"),na=Vo("sendCompletionRequest"),ia=Vo("setS3MultipartState"),oa=Vo("uploadPartBytes"),aa=Vo("getFile"),la=Vo("shouldRetry"),ca=Vo("nonMultipartUpload");class ua{constructor(e,t,r,s){Object.defineProperty(this,ca,{value:pa}),Object.defineProperty(this,la,{value:ha}),Object.defineProperty(this,Jo,{writable:!0,value:void 0}),Object.defineProperty(this,Yo,{writable:!0,value:new WeakMap}),Object.defineProperty(this,Go,{writable:!0,value:void 0}),Object.defineProperty(this,Qo,{writable:!0,value:void 0}),Object.defineProperty(this,Zo,{writable:!0,value:void 0}),Object.defineProperty(this,ea,{writable:!0,value:void 0}),Object.defineProperty(this,ta,{writable:!0,value:void 0}),Object.defineProperty(this,ra,{writable:!0,value:void 0}),Object.defineProperty(this,sa,{writable:!0,value:void 0}),Object.defineProperty(this,na,{writable:!0,value:void 0}),Object.defineProperty(this,ia,{writable:!0,value:void 0}),Object.defineProperty(this,oa,{writable:!0,value:void 0}),Object.defineProperty(this,aa,{writable:!0,value:void 0}),Ho(this,ra)[ra]=e,Ho(this,ia)[ia]=r,Ho(this,aa)[aa]=s,this.setOptions(t)}setOptions(e){const t=Ho(this,ra)[ra];var r;("abortMultipartUpload"in e&&(Ho(this,Jo)[Jo]=t.wrapPromiseFunction(e.abortMultipartUpload,{priority:1})),"createMultipartUpload"in e&&(Ho(this,Go)[Go]=t.wrapPromiseFunction(e.createMultipartUpload,{priority:-1})),"signPart"in e&&(Ho(this,Qo)[Qo]=t.wrapPromiseFunction(e.signPart)),"listParts"in e&&(Ho(this,ea)[ea]=t.wrapPromiseFunction(e.listParts)),"completeMultipartUpload"in e&&(Ho(this,na)[na]=t.wrapPromiseFunction(e.completeMultipartUpload,{priority:1})),"retryDelays"in e)&&(Ho(this,sa)[sa]=null!=(r=e.retryDelays)?r:[]);"uploadPartBytes"in e&&(Ho(this,oa)[oa]=t.wrapPromiseFunction(e.uploadPartBytes,{priority:1/0})),"getUploadParameters"in e&&(Ho(this,Zo)[Zo]=t.wrapPromiseFunction(e.getUploadParameters))}async getUploadId(e,t){let r;for(;null!=(r=Ho(this,Yo)[Yo].get(e.data));)try{return await r}catch{}const s=Ho(this,Go)[Go](Ho(this,aa)[aa](e),t),n=()=>{s.abort(t.reason),Ho(this,Yo)[Yo].delete(e.data)};return t.addEventListener("abort",n,{once:!0}),Ho(this,Yo)[Yo].set(e.data,s),s.then(async r=>{t.removeEventListener("abort",n),Ho(this,ia)[ia](e,r),Ho(this,Yo)[Yo].set(e.data,r)},()=>{t.removeEventListener("abort",n),Ho(this,Yo)[Yo].delete(e.data)}),s}async abortFileUpload(e){const t=Ho(this,Yo)[Yo].get(e.data);if(null==t)return;let r;Ho(this,Yo)[Yo].delete(e.data),Ho(this,ia)[ia](e,Object.create(null));try{r=await t}catch{return}await Ho(this,Jo)[Jo](Ho(this,aa)[aa](e),r)}async uploadFile(e,t,r){if(Mo(r),1===t.length&&!t[0].shouldUseMultipart)return Ho(this,ca)[ca](e,t[0],r);const{uploadId:s,key:n}=await this.getUploadId(e,r);Mo(r);try{const i=await Promise.all(t.map((t,s)=>this.uploadChunk(e,s+1,t,r)));return Mo(r),await Ho(this,na)[na](Ho(this,aa)[aa](e),{key:n,uploadId:s,parts:i,signal:r},r).abortOn(r)}catch(t){throw(null==t?void 0:t.cause)!==fo&&"AbortError"!==(null==t?void 0:t.name)&&this.abortFileUpload(e),t}}restoreUploadFile(e,t){Ho(this,Yo)[Yo].set(e.data,t)}async resumeUploadFile(e,t,r){if(Mo(r),1===t.length&&null!=t[0]&&!t[0].shouldUseMultipart)return Ho(this,ca)[ca](e,t[0],r);const{uploadId:s,key:n}=await this.getUploadId(e,r);Mo(r);const i=await Ho(this,ea)[ea](Ho(this,aa)[aa](e),{uploadId:s,key:n,signal:r},r).abortOn(r);Mo(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 Mo(r),Ho(this,na)[na](Ho(this,aa)[aa](e),{key:n,uploadId:s,parts:o,signal:r},r).abortOn(r)}async uploadChunk(e,t,r,s){Mo(s);const{uploadId:n,key:i}=await this.getUploadId(e,s),o=Ho(this,sa)[sa].values(),a=Ho(this,sa)[sa].values(),l=()=>{const e=o.next();return null==e||e.done?null:e.value};for(;;){Mo(s);const o=r.getData(),{onProgress:c,onComplete:u}=r;let h;try{h=await Ho(this,Qo)[Qo](Ho(this,aa)[aa](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}Mo(s);try{return{PartNumber:t,...await Ho(this,oa)[oa]({signature:h,body:o,size:o.size,onProgress:c,onComplete:u,signal:s}).abortOn(s)}}catch(e){if(!await Ho(this,la)[la](e,a))throw e}}}}async function ha(e,t){var r;const s=Ho(this,ra)[ra],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==Ho(this,ta)[ta]){const e=t.next();if(null==e||e.done)return!1;Ho(this,ta)[ta]=e.value}s.rateLimit(0),await new Promise(e=>setTimeout(e,Ho(this,ta)[ta]))}}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 pa(e,t,r){const{method:s="POST",url:n,fields:i,headers:o}=await Ho(this,Zo)[Zo](Ho(this,aa)[aa](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 Ho(this,oa)[oa]({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:Xo(n),...h}}let da;function fa(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var ma=0;function ya(e){return"__private_"+ma+++"_"+e}function ga(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 ba(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 va={allowedMetaFields:null,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:e=>0!==e.size,retryDelays:[0,1e3,3e3,5e3],companionHeaders:{}};var Ea=ya("companionCommunicationQueue"),Ta=ya("client"),Sa=ya("cachedTemporaryCredentials"),Oa=ya("getTemporarySecurityCredentials"),Pa=ya("setS3MultipartState"),_a=ya("getFile"),ka=ya("uploadLocalFile"),Aa=ya("getCompanionClientArgs"),Ra=ya("upload"),Ca=ya("setCompanionHeaders"),xa=ya("setResumableUploadsCapability"),ja=ya("resetResumableCapability");da=Symbol.for("uppy test: getClient");class Ua extends Gn{constructor(e,t){var r;super(e,{...va,uploadPartBytes:Ua.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...t}),Object.defineProperty(this,Aa,{value:Ia}),Object.defineProperty(this,ka,{value:Na}),Object.defineProperty(this,Oa,{value:Fa}),Object.defineProperty(this,Ea,{writable:!0,value:void 0}),Object.defineProperty(this,Ta,{writable:!0,value:void 0}),Object.defineProperty(this,Sa,{writable:!0,value:void 0}),Object.defineProperty(this,Pa,{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,_a,{writable:!0,value:e=>this.uppy.getFile(e.id)||e}),Object.defineProperty(this,Ra,{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;fa(this,xa)[xa](!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,fa(this,Aa)[Aa](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return fa(this,ka)[ka](e)}),n=await Promise.all(s);return fa(this,xa)[xa](!0),n}}),Object.defineProperty(this,Ca,{writable:!0,value:()=>{fa(this,Ta)[Ta].setCompanionHeaders(this.opts.companionHeaders)}}),Object.defineProperty(this,xa,{writable:!0,value:e=>{const{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,resumableUploads:e}})}}),Object.defineProperty(this,ja,{writable:!0,value:()=>{fa(this,xa)[xa](!0)}}),this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",this.title="AWS S3 Multipart",fa(this,Ta)[Ta]=new Ai(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 to(this.opts.limit),fa(this,Ea)[Ea]=new ua(this.requests,this.opts,fa(this,Pa)[Pa],fa(this,_a)[_a]),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null),this.uploaderSockets=Object.create(null)}[da](){return fa(this,Ta)[Ta]}setOptions(e){fa(this,Ea)[Ea].setOptions(e),super.setOptions(e),fa(this,Ca)[Ca]()}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"),Mo(t);const r=ba({meta:e.meta,allowedMetaFields:this.opts.allowedMetaFields});return fa(this,Ta)[Ta].post("s3/multipart",{filename:e.name,type:e.type,metadata:r},{signal:t}).then(ga)}listParts(e,t,r){let{key:s,uploadId:n,signal:i}=t;null!=i||(i=r),this.assertHost("listParts"),Mo(i);const o=encodeURIComponent(s);return fa(this,Ta)[Ta].get(`s3/multipart/${n}?key=${o}`,{signal:i}).then(ga)}completeMultipartUpload(e,t,r){let{key:s,uploadId:n,parts:i,signal:o}=t;null!=o||(o=r),this.assertHost("completeMultipartUpload"),Mo(o);const a=encodeURIComponent(s),l=encodeURIComponent(n);return fa(this,Ta)[Ta].post(`s3/multipart/${l}/complete?key=${a}`,{parts:i},{signal:o}).then(ga)}async createSignedURL(e,t){const r=await fa(this,Oa)[Oa](t),s=wa(r.credentials)||604800,{uploadId:n,key:i,partNumber:o}=t;return{method:"PUT",expires:s,fields:{},url:`${await Wo({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"),Mo(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 fa(this,Ta)[Ta].get(`s3/multipart/${r}/${n}?key=${o}`,{signal:i}).then(ga)}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 fa(this,Ta)[Ta].delete(`s3/multipart/${a}?key=${o}`,void 0,{signal:i}).then(ga)}getUploadParameters(e,t){const{meta:r}=e,{type:s,name:n}=r,i=ba({meta:r,allowedMetaFields:this.opts.allowedMetaFields,querify:!0}),o=new URLSearchParams({filename:n,type:s,...i});return fa(this,Ta)[Ta].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(Mo(c),null==t)throw new Error("Cannot upload to an undefined URL");return new Promise((e,u)=>{const h=new XMLHttpRequest;function p(){h.abort()}function d(){null==c||c.removeEventListener("abort",p)}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",p),h.upload.addEventListener("progress",e=>{a(e)}),h.addEventListener("abort",()=>{d(),u(lo())}),h.addEventListener("timeout",()=>{d();const e=new Error("Request has expired");e.source={status:403},u(e)}),h.addEventListener("load",()=>{if(d(),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=>{d();const t=new Error("Unknown error");t.source=e.target,u(t)}),h.send(i)})}install(){fa(this,xa)[xa](!0),this.uppy.addPreProcessor(fa(this,Ca)[Ca]),this.uppy.addUploader(fa(this,Ra)[Ra]),this.uppy.on("cancel-all",fa(this,ja)[ja])}uninstall(){this.uppy.removePreProcessor(fa(this,Ca)[Ca]),this.uppy.removeUploader(fa(this,Ra)[Ra]),this.uppy.off("cancel-all",fa(this,ja)[ja])}}async function Fa(e){return Mo(null==e?void 0:e.signal),null==fa(this,Sa)[Sa]&&(!0===this.opts.getTemporarySecurityCredentials?(this.assertHost("getTemporarySecurityCredentials"),fa(this,Sa)[Sa]=fa(this,Ta)[Ta].get("s3/sts",e).then(ga)):fa(this,Sa)[Sa]=this.opts.getTemporarySecurityCredentials(e),fa(this,Sa)[Sa]=await fa(this,Sa)[Sa],setTimeout(()=>{fa(this,Sa)[Sa]=null},500*(wa(fa(this,Sa)[Sa].credentials)||0))),fa(this,Sa)[Sa]}function Na(e){var t=this;return new Promise((r,s)=>{const n=new Fo(e.data,{companionComm:fa(this,Ea)[Ea],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",fa(this,_a)[_a](e),s),t.location&&this.uppy.log(`Download ${e.name} from ${t.location}`),r()},onPartComplete:t=>{this.uppy.emit("s3-multipart:part-uploaded",fa(this,_a)[_a](e),t)},file:e,shouldUseMultipart:this.opts.shouldUseMultipart,...e.s3Multipart});this.uploaders[e.id]=n;const i=new Ii(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 Ia(e){var t;return{...null==(t=e.remote)?void 0:t.body,protocol:"s3-multipart",size:e.data.size,metadata:e.meta}}Ua.VERSION="3.12.0";var La,$a,Ma,Ba,Da,qa=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())})},za=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},Wa=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)},Ha=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 Ka{constructor(e,t=dr.PROD){La.add(this),$a.set(this,void 0),Ma.set(this,void 0),Ba.set(this,void 0),za(this,Ma,e,"f"),za(this,Ba,t,"f")}uploadFileFrontend(e){return qa(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:r,email:s,callBack:n}){if(!yr(e,t,r,s))throw new Error(cr);if(!Er(s.trim()))throw new Error(hr);if(!gr(t))throw new Error(ur);return t=br(t,r,s),Wa(this,La,"m",Da).call(this,{callBack:n,arrayMetaData:t,scanId:r,email:s,file:e})})}faceScanFileUploader(e){return qa(this,arguments,void 0,function*({file:e,arrayMetaData:t,objectKey:r,email:s,callBack:n}){if(!yr(e,t,r,s))throw new Error(cr);if(!Er(s.trim()))throw new Error(hr);if(!wr(t,lr))throw new Error(ur);return t.push({email:s}),Wa(this,La,"m",Da).call(this,{callBack:n,arrayMetaData:t,objectKey:r,email:s,file:e})})}uploadFile(e){return qa(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:r,email:s}){if(!yr(e,t,r,s))throw new Error(cr);if(!Er(s.trim()))throw new Error(hr);if(!gr(t))throw new Error(ur);return t=br(t,r,s),new Promise((r,s)=>qa(this,void 0,void 0,function*(){var n;try{const s=yield mr({path:$t,apiKey:Wa(this,Ma,"f"),urlType:Wa(this,Ba,"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 mr({path:Bt,apiKey:Wa(this,Ma,"f"),urlType:Wa(this,Ba,"f"),body:{objectKey:null==s?void 0:s.key,uploadId:null==s?void 0:s.uploadId,partNumber:t+1},throwError:!0}),a=yield vt.put(null==r?void 0:r.url,i[t],{headers:{"Content-Type":e.type,"X-Api-Key":Wa(this,Ma,"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 mr({path:Mt,apiKey:Wa(this,Ma,"f"),urlType:Wa(this,Ba,"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 qa(this,void 0,void 0,function*(){const{scanId:t}=e,r=Ha(e,["scanId"]);if(!1===yr(t))throw new Error(cr);return vt.post(`${vr({urlName:Dt,urlType:Wa(this,Ba,"f")})}${ir}/${t}`,{device_info:Object.assign({},r)},{headers:{"X-Api-Key":Wa(this,Ma,"f")}})})}}$a=new WeakMap,Ma=new WeakMap,Ba=new WeakMap,La=new WeakSet,Da=function({callBack:e,arrayMetaData:t,scanId:r,email:s,file:n,objectKey:i}){return new Promise((o,a)=>{Wa(this,$a,"f")&&Wa(this,$a,"f").close(),za(this,$a,new $n({autoProceed:!0}),"f"),Wa(this,$a,"f").use(Ua,{limit:10,retryDelays:[0,1e3,3e3,5e3],companionUrl:vr({urlName:Dt,urlType:Wa(this,Ba,"f")}),getChunkSize:()=>pr,createMultipartUpload:n=>{const o=Math.ceil(n.size/pr);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 mr({path:$t,apiKey:Wa(this,Ma,"f"),urlType:Wa(this,Ba,"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}),mr({path:Mt,apiKey:Wa(this,Ma,"f"),urlType:Wa(this,Ba,"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)=>mr({path:Bt,urlType:Wa(this,Ba,"f"),apiKey:Wa(this,Ma,"f"),body:{objectKey:t.key,uploadId:t.uploadId,partNumber:t.partNumber}})}),Wa(this,$a,"f").addFile({source:"manual",name:n.name,type:n.type,data:n}),Wa(this,$a,"f").on("upload-error",(e,t,r)=>{t.isNetworkError?Wa(this,$a,"f").retryUpload(e.id):a(t)}),Wa(this,$a,"f").on("upload-success",()=>{o({message:"file uploaded successfully"})}),Wa(this,$a,"f").on("complete",e=>{Wa(this,$a,"f")&&Wa(this,$a,"f").close()})})};var Va,Xa,Ja,Ya,Ga,Qa,Za,el,tl,rl,sl,nl,il=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())})},ol=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},al=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 ll{constructor(e,t=dr.PROD){Va.add(this),Xa.set(this,{}),Ja.set(this,{}),Ya.set(this,{}),Ga.set(this,{}),Qa.set(this,void 0),Za.set(this,void 0),ol(this,Qa,e,"f"),ol(this,Za,t,"f")}getMeasurementResult(e){if(!yr(e))throw new Error(cr);const t=`${vr({urlName:Dt,urlType:al(this,Za,"f")})}/measurements?scanId=${e}`;return vt.get(t,{headers:{"X-Api-Key":al(this,Qa,"f")}})}getMeasurementRecommendation({scanId:e,shopDomain:t,productName:r}){if(!yr(e,t,r))throw new Error(cr);return vt.get(`${vr({urlName:Dt,urlType:al(this,Za,"f")})}${sr}/scan/${e}/shop/${t}/product/${r}`,{headers:{"X-Api-Key":al(this,Qa,"f")}})}handleMeasurementSocket(e){const{scanId:t,onError:r,onSuccess:s,onClose:n,onOpen:i}=e;if(!yr(t))throw new Error(cr);al(this,Va,"m",nl).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(!yr(t))throw new Error(cr);al(this,Va,"m",nl).call(this,{onOpen:i,faceScanId:t,onSuccess:s,onError:r,onClose:n,paramsKey:"faceScanId",isFallback:!1,delay:1e3})}}Xa=new WeakMap,Ja=new WeakMap,Ya=new WeakMap,Ga=new WeakMap,Qa=new WeakMap,Za=new WeakMap,Va=new WeakSet,el=function(e){var t;null===(t=al(this,Xa,"f")[e])||void 0===t||t.close(),al(this,Xa,"f")[e]=null,al(this,Ja,"f")[e]&&(clearTimeout(al(this,Ja,"f")[e]),al(this,Ja,"f")[e]=null)},tl=function(e,t){const{scanId:r,onSuccess:s,onError:n}=e;al(this,Ga,"f")[t]=1,al(this,Ja,"f")[t]=setTimeout(()=>{al(this,Va,"m",rl).call(this,{scanId:r,onSuccess:s,onError:n},t),al(this,Va,"m",el).call(this,t)},9e4)},rl=function(e,t){const{scanId:r,onSuccess:s,onError:n}=e;al(this,Ya,"f")[t]&&clearTimeout(al(this,Ya,"f")[t]),al(this,Ya,"f")[t]=setTimeout(()=>{al(this,Va,"m",sl).call(this,{scanId:r,onSuccess:s,onError:n},t)},5e3*(al(this,Ga,"f")[t]||1))},sl=function(e,t){return il(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(al(this,Ya,"f")[t])):(al(this,Ga,"f")[t]||1)<8?(al(this,Ga,"f")[t]=(al(this,Ga,"f")[t]||1)+1,al(this,Va,"m",rl).call(this,{scanId:s,onSuccess:n,onError:i},t)):(al(this,Ga,"f")[t]=1,clearInterval(al(this,Ya,"f")[t]),null==i||i({scanStatus:"failed",message:"Scan not found",isMeasured:!1}))}catch(e){clearInterval(al(this,Ya,"f")[t]),null==i||i(e)}})},nl=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(()=>{al(this,Va,"m",el).call(this,c);const l=`${vr({urlName:qt,urlType:al(this,Za,"f")})}${rr}?${o}=${r||a}`,u=new WebSocket(l);al(this,Xa,"f")[c]=u,u.onopen=()=>{null==e||e(),t&&r&&al(this,Va,"m",tl).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(al(this,Ja,"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(al(this,Ja,"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 cl=Object.create(null);cl.open="0",cl.close="1",cl.ping="2",cl.pong="3",cl.message="4",cl.upgrade="5",cl.noop="6";const ul=Object.create(null);Object.keys(cl).forEach(e=>{ul[cl[e]]=e});const hl={type:"error",data:"parser error"},pl="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),dl="function"==typeof ArrayBuffer,fl=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ml=({type:e,data:t},r,s)=>pl&&t instanceof Blob?r?s(t):yl(t,s):dl&&(t instanceof ArrayBuffer||fl(t))?r?s(t):yl(new Blob([t]),s):s(cl[e]+(t||"")),yl=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+(e||""))},r.readAsDataURL(e)};function gl(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let wl;const bl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vl="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)vl[bl.charCodeAt(e)]=e;const El="function"==typeof ArrayBuffer,Tl=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Ol(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:Sl(e.substring(1),t)};return ul[r]?e.length>1?{type:ul[r],data:e.substring(1)}:{type:ul[r]}:hl},Sl=(e,t)=>{if(El){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=vl[e.charCodeAt(t)],s=vl[e.charCodeAt(t+1)],n=vl[e.charCodeAt(t+2)],i=vl[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 Ol(r,t)}return{base64:!0,data:e}},Ol=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Pl=String.fromCharCode(30);function _l(){return new TransformStream({transform(e,t){!function(e,t){pl&&e.data instanceof Blob?e.data.arrayBuffer().then(gl).then(t):dl&&(e.data instanceof ArrayBuffer||fl(e.data))?t(gl(e.data)):ml(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 kl;function Al(e){return e.reduce((e,t)=>e+t.length,0)}function Rl(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 Cl(e){if(e)return function(e){for(var t in Cl.prototype)e[t]=Cl.prototype[t];return e}(e)}Cl.prototype.on=Cl.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Cl.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},Cl.prototype.off=Cl.prototype.removeListener=Cl.prototype.removeAllListeners=Cl.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},Cl.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},Cl.prototype.emitReserved=Cl.prototype.emit,Cl.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Cl.prototype.hasListeners=function(e){return!!this.listeners(e).length};const xl="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),jl="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function Ul(e,...t){return t.reduce((t,r)=>(e.hasOwnProperty(r)&&(t[r]=e[r]),t),{})}const Fl=jl.setTimeout,Nl=jl.clearTimeout;function Il(e,t){t.useNativeTimers?(e.setTimeoutFn=Fl.bind(jl),e.clearTimeoutFn=Nl.bind(jl)):(e.setTimeoutFn=jl.setTimeout.bind(jl),e.clearTimeoutFn=jl.clearTimeout.bind(jl))}function Ll(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 $l(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class Ml extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class Bl extends Cl{constructor(e){super(),this.writable=!1,Il(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 Ml(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=Tl(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 Dl extends Bl{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(Pl),s=[];for(let e=0;e<r.length;e++){const n=Tl(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)=>{ml(e,!1,e=>{s[i]=e,++n===r&&t(s.join(Pl))})})})(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]=$l()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let ql=!1;try{ql="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const zl=ql;function Wl(){}class Hl extends Dl{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 Kl extends Cl{constructor(e,t,r){super(),this.createRequest=e,Il(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=Ul(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=Kl.requestsCount++,Kl.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=Wl,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Kl.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(Kl.requestsCount=0,Kl.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Vl);else if("function"==typeof addEventListener){addEventListener("onpagehide"in jl?"pagehide":"unload",Vl,!1)}function Vl(){for(let e in Kl.requests)Kl.requests.hasOwnProperty(e)&&Kl.requests[e].abort()}const Xl=function(){const e=Jl({xdomain:!1});return e&&null!==e.responseType}();function Jl(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||zl))return new XMLHttpRequest}catch(e){}if(!t)try{return new(jl[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Yl="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Gl extends Bl{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,r=Yl?{}:Ul(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;ml(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(e){}s&&xl(()=>{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]=$l()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ql=jl.WebSocket||jl.MozWebSocket;const Zl={websocket:class extends Gl{createSocket(e,t,r){return Yl?new Ql(e,t,r):t?new Ql(e,t):new Ql(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Bl{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){kl||(kl=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(Al(r)<1)break;const e=Rl(r,1);i=!(128&~e[0]),n=127&e[0],s=n<126?3:126===n?1:2}else if(1===s){if(Al(r)<2)break;const e=Rl(r,2);n=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),s=3}else if(2===s){if(Al(r)<8)break;const e=Rl(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(hl);break}n=i*Math.pow(2,32)+t.getUint32(4),s=3}else{if(Al(r)<n)break;const e=Rl(r,n);a.enqueue(Tl(i?e:kl.decode(e),t)),s=0}if(0===n||n>e){a.enqueue(hl);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=_l();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&&xl(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Hl{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Xl&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Kl(Jl,this.uri(),e)}}},ec=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function rc(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=ec.exec(e||""),i={},o=14;for(;o--;)i[tc[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 sc="function"==typeof addEventListener&&"function"==typeof removeEventListener,nc=[];sc&&addEventListener("offline",()=>{nc.forEach(e=>e())},!1);class ic extends Cl{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=rc(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=rc(t.host).host);Il(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)),sc&&(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"})},nc.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&&ic.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",ic.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+=Ll(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,xl(()=>{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(ic.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(),sc&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=nc.indexOf(this._offlineEventListener);-1!==e&&nc.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ic.protocol=4;class oc extends ic{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;ic.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;ic.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 ac=class extends oc{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=>Zl[e]).filter(e=>!!e)),super(e,r)}};const lc="function"==typeof ArrayBuffer,cc=Object.prototype.toString,uc="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===cc.call(Blob),hc="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===cc.call(File);function pc(e){return lc&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||uc&&e instanceof Blob||hc&&e instanceof File}function dc(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,r=e.length;t<r;t++)if(dc(e[t]))return!0;return!1}if(pc(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return dc(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&dc(e[t]))return!0;return!1}function fc(e){const t=[],r=e.data,s=e;return s.data=mc(r,t),s.attachments=t.length,{packet:s,buffers:t}}function mc(e,t){if(!e)return e;if(pc(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]=mc(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]=mc(e[s],t));return r}return e}function yc(e,t){return e.data=gc(e.data,t),delete e.attachments,e}function gc(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]=gc(e[r],t);else if("object"==typeof e)for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=gc(e[r],t));return e}const wc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var bc;!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"}(bc||(bc={}));function vc(e){return"[object Object]"===Object.prototype.toString.call(e)}class Ec extends Cl{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===bc.BINARY_EVENT;r||t.type===bc.BINARY_ACK?(t.type=r?bc.EVENT:bc.ACK,this.reconstructor=new Tc(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!pc(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===bc[r.type])throw new Error("unknown packet type "+r.type);if(r.type===bc.BINARY_EVENT||r.type===bc.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(!Ec.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 bc.CONNECT:return vc(t);case bc.DISCONNECT:return void 0===t;case bc.CONNECT_ERROR:return"string"==typeof t||vc(t);case bc.EVENT:case bc.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===wc.indexOf(t[0]));case bc.ACK:case bc.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Tc{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=yc(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Sc=Object.freeze({__proto__:null,Decoder:Ec,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==bc.EVENT&&e.type!==bc.ACK||!dc(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===bc.EVENT?bc.BINARY_EVENT:bc.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==bc.BINARY_EVENT&&e.type!==bc.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=fc(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}},get PacketType(){return bc},protocol:5});function Oc(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const Pc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class _c extends Cl{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=[Oc(e,"open",this.onopen.bind(this)),Oc(e,"packet",this.onpacket.bind(this)),Oc(e,"error",this.onerror.bind(this)),Oc(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(Pc.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:bc.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:bc.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 bc.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 bc.EVENT:case bc.BINARY_EVENT:this.onevent(e);break;case bc.ACK:case bc.BINARY_ACK:this.onack(e);break;case bc.DISCONNECT:this.ondisconnect();break;case bc.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:bc.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:bc.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 kc(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}kc.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)},kc.prototype.reset=function(){this.attempts=0},kc.prototype.setMin=function(e){this.ms=e},kc.prototype.setMax=function(e){this.max=e},kc.prototype.setJitter=function(e){this.jitter=e};class Ac extends Cl{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,Il(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 kc({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||Sc;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 ac(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Oc(t,"open",function(){r.onopen(),e&&e()}),n=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Oc(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(Oc(e,"ping",this.onping.bind(this)),Oc(e,"data",this.ondata.bind(this)),Oc(e,"error",this.onerror.bind(this)),Oc(e,"close",this.onclose.bind(this)),Oc(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){xl(()=>{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 _c(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 Rc={};function Cc(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=rc(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=Rc[n]&&i in Rc[n].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?a=new Ac(s,t):(Rc[n]||(Rc[n]=new Ac(s,t)),a=Rc[n]),r.query&&!t.query&&(t.query=r.queryKey),a.socket(r.path,t)}Object.assign(Cc,{Manager:Ac,Socket:_c,io:Cc,connect:Cc});var xc,jc,Uc,Fc=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},Nc=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 Ic{constructor(e,t=dr.PROD){xc.set(this,null),jc.set(this,void 0),Uc.set(this,void 0),Fc(this,jc,e,"f"),Fc(this,Uc,t,"f")}connect(){return new Promise((e,t)=>{Fc(this,xc,Cc(vr({urlName:"APP_POSE_DETECTION_WEBSOCKET_URL",urlType:Nc(this,Uc,"f")})),"f"),Nc(this,xc,"f").on("connect",()=>{var r;const s=null===(r=Nc(this,xc,"f"))||void 0===r?void 0:r.id;s?e(s):t("Failed to obtain socket ID.")}),Nc(this,xc,"f").on("connect_error",e=>{t(e)})})}videoEmit({image:e,scanId:t}){if(!Nc(this,xc,"f"))throw new Error("Socket is not connected");Nc(this,xc,"f").emit("video",{image:e,user_unique_key:t})}disconnect(){var e;null===(e=Nc(this,xc,"f"))||void 0===e||e.disconnect()}poseStatus(e){if(!Nc(this,xc,"f"))throw new Error("Socket is not connected");Nc(this,xc,"f").on("pose_status",t=>{null==e||e(t)})}connected(){var e;return!!(null===(e=Nc(this,xc,"f"))||void 0===e?void 0:e.connected)}}xc=new WeakMap,jc=new WeakMap,Uc=new WeakMap;var Lc,$c,Mc,Bc,Dc,qc,zc,Wc,Hc,Kc,Vc=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())})},Xc=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},Jc=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 Yc{constructor(e,t=dr.PROD){Lc.add(this),$c.set(this,new Map),Mc.set(this,new Map),Bc.set(this,void 0),Dc.set(this,void 0),Wc.set(this,e=>{if(e){const t=Jc(this,$c,"f").get(e),r=Jc(this,Mc,"f").get(e);null==t||t.close(),r&&clearTimeout(r),Jc(this,$c,"f").delete(e),Jc(this,Mc,"f").delete(e)}else Jc(this,$c,"f").forEach(e=>e.close()),Jc(this,Mc,"f").forEach(e=>clearTimeout(e)),Jc(this,$c,"f").clear(),Jc(this,Mc,"f").clear()}),Hc.set(this,({onSuccess:e,onError:t,tryonId:r})=>{const s=setTimeout(()=>{Jc(this,Kc,"f").call(this,{onSuccess:e,onError:t,tryonId:r}),Jc(this,Wc,"f").call(this,r)},3e5);Jc(this,Mc,"f").set(r,s)}),this.handleTryOnWebSocket=({tryonId:e,onError:t,onSuccess:r,onClose:s,onOpen:n})=>{if(!1===yr(e))throw new Error(cr);Jc(this,Wc,"f").call(this,e);const i=`${vr({urlName:qt,urlType:Jc(this,Dc,"f")})}${er}?tryonId=${e}`,o=new WebSocket(i);Jc(this,$c,"f").set(e,o),o.onopen=()=>{null==n||n(),Jc(this,Hc,"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=Jc(this,Mc,"f").get(e);i&&clearTimeout(i),Jc(this,Mc,"f").delete(e)},o.onclose=()=>{null==s||s()},o.onerror=e=>{null==t||t(e)}},Kc.set(this,e=>Vc(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===yr(e))throw new Error(cr);const t=`${vr({urlName:Dt,urlType:Jc(this,Dc,"f")})}${Zt}/${e}`;return vt.post(t,null,{headers:{"X-Api-Key":Jc(this,Bc,"f")}})},Xc(this,Bc,e,"f"),Xc(this,Dc,t,"f")}uploadFile(e){return Vc(this,arguments,void 0,function*({files:e,userEmail:t,fileNoLimit:r=2}){if(!1===yr(e,t))throw new Error(cr);if(!Er(t.trim()))throw new Error(hr);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 Jc(this,Lc,"m",qc).call(this,r);for(const t of e)yield Jc(this,Lc,"m",zc).call(this,s.data.uploadUrls[t.name].url,t);return"uploaded successfully!"}catch(e){throw e}})}getUploadedFiles(e){if(!1===yr(e))throw new Error(cr);if(!Er(e.trim()))throw new Error(hr);const t={userEmail:e};return vt.post(`${vr({urlName:Dt,urlType:Jc(this,Dc,"f")})}${Gt}`,t,{headers:{"X-Api-Key":Jc(this,Bc,"f")}})}deleteImage({userEmail:e,fileName:t}){if(!1===yr(e,t))throw new Error(cr);if(!Er(e.trim()))throw new Error(hr);const r={userEmail:e,file:t};return vt.delete(`${vr({urlName:Dt,urlType:Jc(this,Dc,"f")})}${Qt}`,{headers:{"X-Api-Key":Jc(this,Bc,"f")},data:r})}handleTryOnSubmit({shopDomain:e,products:t,selectedUserImages:r,requestSource:s,callbackUrl:n,openTryonId:i,selectedProductImageUrl:o,token:a}){if(!1===yr(e,t,a))throw new Error(cr);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=`${vr({urlName:Dt,urlType:Jc(this,Dc,"f")})}${er}`,u={"X-Api-Key":Jc(this,Bc,"f")};return a&&(u.Authorization=`Bearer ${a}`),vt.post(c,l,{headers:u})}getShareLink(e){return vt.post(`${vr({urlName:Dt,urlType:Jc(this,Dc,"f")})}${nr}`,{tryonId:e},{headers:{"X-Api-Key":Jc(this,Bc,"f")}})}getProductImageEligibility({storeUrl:e,productHandle:t,imageURL:r,productDescription:s}){if(!1===yr(e,t,r))throw new Error(cr);const n={storeUrl:e,productHandle:t,imageURL:r,productDescription:null!=s?s:null},i=`${vr({urlName:Dt,urlType:Jc(this,Dc,"f")})}${or}`;return vt.post(i,n,{headers:{"X-Api-Key":Jc(this,Bc,"f")}})}}$c=new WeakMap,Mc=new WeakMap,Bc=new WeakMap,Dc=new WeakMap,Wc=new WeakMap,Hc=new WeakMap,Kc=new WeakMap,Lc=new WeakSet,qc=function(e){if(!1===yr(e))throw new Error(cr);return vt.post(`${vr({urlName:Dt,urlType:Jc(this,Dc,"f")})}${Yt}`,e,{headers:{"Content-Type":"application/json","X-Api-Key":Jc(this,Bc,"f")}})},zc=function(e,t){if(!1===yr(e,t))throw new Error(cr);return vt.put(e,t,{headers:{"Content-Type":t.type}})};var Gc,Qc,Zc,eu=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},tu=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)};Gc=new WeakMap,Qc=new WeakMap,function(e){e.DEV="dev",e.STAGING="staging",e.PROD="prod"}(Zc||(Zc={}));const ru=new class{constructor(e,t=dr.PROD){Gc.set(this,void 0),Qc.set(this,void 0),eu(this,Gc,e,"f"),eu(this,Qc,t,"f"),this.auth=new kr(tu(this,Gc,"f"),tu(this,Qc,"f")),this.custom=new jr(tu(this,Gc,"f"),tu(this,Qc,"f")),this.fileUpload=new Ka(tu(this,Gc,"f"),tu(this,Qc,"f")),this.measurement=new ll(tu(this,Gc,"f"),tu(this,Qc,"f")),this.poseDetection=new Ic(tu(this,Gc,"f"),tu(this,Qc,"f")),this.tryOn=new Yc(tu(this,Gc,"f"),tu(this,Qc,"f"))}}("8e35dfd4-010c-40ca-ad79-fc72dc307efb",Zc.STAGING),su={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)}}};exports.Drawer=f,exports.LoadingScreen=function({size:e=60,loaderType:s="default"}){return r.jsx("div",{className:"flex items-center justify-center h-full w-full",children:r.jsx("img",{src:"black"===s?t.loaderBlackGif:t.loaderGif,alt:"Swan logo",className:`w-[${e}px]`,width:e})})},exports.speechService=su,exports.swan=ru;
12
+ //# sourceMappingURL=LoadingScreen-mBOEmdqd.js.map