@swan-admin/swan-web-component 1.0.77 → 1.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Header-CDkpLwYo.js +2 -0
- package/dist/Header-CDkpLwYo.js.map +1 -0
- package/dist/Header-F5rF4_EK.js +2 -0
- package/dist/Header-F5rF4_EK.js.map +1 -0
- package/dist/Header-KIq-IIp4.js +2 -0
- package/dist/Header-KIq-IIp4.js.map +1 -0
- package/dist/Header-SK4TdjTG.js +2 -0
- package/dist/Header-SK4TdjTG.js.map +1 -0
- package/dist/LoadingScreen-CJW5H884.js +2 -0
- package/dist/LoadingScreen-CJW5H884.js.map +1 -0
- package/dist/LoadingScreen-Cye_sGZu.js +2 -0
- package/dist/LoadingScreen-Cye_sGZu.js.map +1 -0
- package/dist/LoadingScreen-Czxa8Is0.js +2 -0
- package/dist/LoadingScreen-Czxa8Is0.js.map +1 -0
- package/dist/LoadingScreen-aAtRsi7Q.js +2 -0
- package/dist/LoadingScreen-aAtRsi7Q.js.map +1 -0
- package/dist/arrow-right-DWlQRbzE.js +27 -0
- package/dist/arrow-right-DWlQRbzE.js.map +1 -0
- package/dist/arrow-right-fsdw-5QY.js +27 -0
- package/dist/arrow-right-fsdw-5QY.js.map +1 -0
- package/dist/bodyScan.js +2 -2
- package/dist/bodyScan.js.map +1 -1
- package/dist/bodyScan.mjs +2 -2
- package/dist/bodyScan.mjs.map +1 -1
- package/dist/enums-BLzZlPIt.js +32 -0
- package/dist/enums-BLzZlPIt.js.map +1 -0
- package/dist/enums-BV1_VQpZ.js +32 -0
- package/dist/enums-BV1_VQpZ.js.map +1 -0
- package/dist/faceScan.js +1 -1
- package/dist/faceScan.js.map +1 -1
- package/dist/faceScan.mjs +1 -1
- package/dist/faceScan.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bodyScan.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{useCallback as i,useMemo as s,createContext as a,useState as l,useEffect as c,useLayoutEffect as u,useContext as d,useRef as h}from"react";import{H as p,v as _,S as f,p as m,L as g,q as y,r as v,t as w,V as b,G as S,C as E,w as k,x as P,y as T,z as O,u as C,A as x,B as R}from"./Header-BhrDARhH.js";import{ad as A,ae as N,af as F,ag as j,d as I,n as M,o as U,ah as L,f as z,ai as B,P as D,r as $,p as W,N as q,Y as H,aj as V,a4 as Y,Z as K,q as G,H as J,x as X,a0 as Q,ak as Z,G as ee,M as te,t as ne,O as re,B as oe,D as ie,Q as se,R as ae,m as le,S as ce,a2 as ue,a3 as de,$ as he,L as pe,a1 as _e,al as fe,J as me,ac as ge,am as ye,an as ve,ao as we,ap as be,aq as Se,ar as Ee,as as ke,at as Pe,h as Te,a7 as Oe,au as Ce,av as xe}from"./enums-C7dttoT7.js";import{L as Re}from"./LoadingScreen-BXF96hkf.js";import Ae from"video.js";import"react-dom";function Ne(e){const{sx:t,...n}=e,{systemProps:r,otherProps:o}=(e=>{const t={systemProps:{},otherProps:{}},n=e?.theme?.unstable_sxConfig??N;return Object.keys(e).forEach(r=>{n[r]?t.systemProps[r]=e[r]:t.otherProps[r]=e[r]}),t})(n);let i;return i=Array.isArray(t)?[r,...t]:"function"==typeof t?(...e)=>{const n=t(...e);return A(n)?{...r,...n}:r}:{...r,...t},{...o,sx:i}}const Fe=U("MuiBox",["root"]),je=function(t={}){const{themeId:n,defaultTheme:o,defaultClassName:i="MuiBox-root",generateClassName:s}=t,a=F("div",{shouldForwardProp:e=>"theme"!==e&&"sx"!==e&&"as"!==e})(j);return r.forwardRef(function(t,r){const l=I(o),{className:c,component:u="div",...d}=Ne(t);return e(a,{as:u,ref:r,className:M(c,s?s(i):i),theme:n&&l[n]||l,...d})})}({themeId:z,defaultTheme:B(),defaultClassName:Fe.root,generateClassName:L.generate});function Ie(e){return $("MuiDialog",e)}"production"!==process.env.NODE_ENV&&(je.propTypes={children:D.node,component:D.elementType,sx:D.oneOfType([D.arrayOf(D.oneOfType([D.func,D.object,D.bool])),D.func,D.object])});const Me=U("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),Ue=r.createContext({});"production"!==process.env.NODE_ENV&&(Ue.displayName="DialogContext");const Le=G(Z,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),ze=G(Q,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),Be=G("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${J(n.scroll)}`]]}})({height:"100%","@media print":{height:"auto"},outline:0,variants:[{props:{scroll:"paper"},style:{display:"flex",justifyContent:"center",alignItems:"center"}},{props:{scroll:"body"},style:{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}}}]}),De=G(H,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${J(n.scroll)}`],t[`paperWidth${J(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(ee(({theme:e})=>({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"},variants:[{props:{scroll:"paper"},style:{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"}},{props:{scroll:"body"},style:{display:"inline-block",verticalAlign:"middle",textAlign:"initial"}},{props:({ownerState:e})=>!e.maxWidth,style:{maxWidth:"calc(100% - 64px)"}},{props:{maxWidth:"xs"},style:{maxWidth:"px"===e.breakpoints.unit?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${Me.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:"calc(100% - 64px)"}}}},...Object.keys(e.breakpoints.values).filter(e=>"xs"!==e).map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${Me.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:"calc(100% - 64px)"}}}})),{props:({ownerState:e})=>e.fullWidth,style:{width:"calc(100% - 64px)"}},{props:({ownerState:e})=>e.fullScreen,style:{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${Me.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),$e=r.forwardRef(function(t,n){const o=W({props:t,name:"MuiDialog"}),i=q(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":l,"aria-modal":c=!0,BackdropComponent:u,BackdropProps:d,children:h,className:p,disableEscapeKeyDown:_=!1,fullScreen:f=!1,fullWidth:m=!1,maxWidth:g="sm",onClick:y,onClose:v,open:w,PaperComponent:b=H,PaperProps:S={},scroll:E="paper",slots:k={},slotProps:P={},TransitionComponent:T=V,transitionDuration:O=s,TransitionProps:C,...x}=o,R={...o,disableEscapeKeyDown:_,fullScreen:f,fullWidth:m,maxWidth:g,scroll:E},A=(e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:i}=e,s={root:["root"],container:["container",`scroll${J(n)}`],paper:["paper",`paperScroll${J(n)}`,`paperWidth${J(String(r))}`,o&&"paperFullWidth",i&&"paperFullScreen"]};return X(s,Ie,t)})(R),N=r.useRef(),F=Y(l),j=r.useMemo(()=>({titleId:F}),[F]),I={slots:{transition:T,...k},slotProps:{transition:C,paper:S,backdrop:d,...P}},[U,L]=K("root",{elementType:ze,shouldForwardComponentProp:!0,externalForwardedProps:I,ownerState:R,className:M(A.root,p),ref:n}),[z,B]=K("backdrop",{elementType:Le,shouldForwardComponentProp:!0,externalForwardedProps:I,ownerState:R}),[D,$]=K("paper",{elementType:De,shouldForwardComponentProp:!0,externalForwardedProps:I,ownerState:R,className:M(A.paper,S.className)}),[G,Q]=K("container",{elementType:Be,externalForwardedProps:I,ownerState:R,className:A.container}),[Z,ee]=K("transition",{elementType:V,externalForwardedProps:I,ownerState:R,additionalProps:{appear:!0,in:w,timeout:O,role:"presentation"}});return e(U,{closeAfterTransition:!0,slots:{backdrop:z},slotProps:{backdrop:{transitionDuration:O,as:u,...B}},disableEscapeKeyDown:_,onClose:v,open:w,onClick:e=>{y&&y(e),N.current&&(N.current=null,v&&v(e,"backdropClick"))},...L,...x,children:e(Z,{...ee,children:e(G,{onMouseDown:e=>{N.current=e.target===e.currentTarget},...Q,children:e(D,{as:b,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":F,"aria-modal":c,...$,children:e(Ue.Provider,{value:j,children:h})})})})})});function We(e){return"function"==typeof e?e():e}function qe(e,t,n){const r=function(e,t,n){const r=t.getBoundingClientRect(),o=n&&n.getBoundingClientRect(),i=oe(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const e=i.getComputedStyle(t);s=e.getPropertyValue("-webkit-transform")||e.getPropertyValue("transform")}let a=0,l=0;if(s&&"none"!==s&&"string"==typeof s){const e=s.split("(")[1].split(")")[0].split(",");a=parseInt(e[4],10),l=parseInt(e[5],10)}return"left"===e?o?`translateX(${o.right+a-r.left}px)`:`translateX(${i.innerWidth+a-r.left}px)`:"right"===e?o?`translateX(-${r.right-o.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:"up"===e?o?`translateY(${o.bottom+l-r.top}px)`:`translateY(${i.innerHeight+l-r.top}px)`:o?`translateY(-${r.top-o.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}(e,t,We(n));r&&(t.style.webkitTransform=r,t.style.transform=r)}"production"!==process.env.NODE_ENV&&($e.propTypes={"aria-describedby":D.string,"aria-labelledby":D.string,"aria-modal":D.oneOfType([D.oneOf(["false","true"]),D.bool]),BackdropComponent:D.elementType,BackdropProps:D.object,children:D.node,classes:D.object,className:D.string,disableEscapeKeyDown:D.bool,fullScreen:D.bool,fullWidth:D.bool,maxWidth:D.oneOfType([D.oneOf(["xs","sm","md","lg","xl",!1]),D.string]),onClick:D.func,onClose:D.func,open:D.bool.isRequired,PaperComponent:D.elementType,PaperProps:D.object,scroll:D.oneOf(["body","paper"]),slotProps:D.shape({backdrop:D.oneOfType([D.func,D.object]),container:D.oneOfType([D.func,D.object]),paper:D.oneOfType([D.func,D.object]),root:D.oneOfType([D.func,D.object]),transition:D.oneOfType([D.func,D.object])}),slots:D.shape({backdrop:D.elementType,container:D.elementType,paper:D.elementType,root:D.elementType,transition:D.elementType}),sx:D.oneOfType([D.arrayOf(D.oneOfType([D.func,D.object,D.bool])),D.func,D.object]),TransitionComponent:D.elementType,transitionDuration:D.oneOfType([D.number,D.shape({appear:D.number,enter:D.number,exit:D.number})]),TransitionProps:D.object});const He=r.forwardRef(function(t,n){const o=q(),i={enter:o.transitions.easing.easeOut,exit:o.transitions.easing.sharp},s={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{addEndListener:a,appear:l=!0,children:c,container:u,direction:d="down",easing:h=i,in:p,onEnter:_,onEntered:f,onEntering:m,onExit:g,onExited:y,onExiting:v,style:w,timeout:b=s,TransitionComponent:S=te,...E}=t,k=r.useRef(null),P=ne(re(c),k,n),T=e=>t=>{e&&(void 0===t?e(k.current):e(k.current,t))},O=T((e,t)=>{qe(d,e,u),ae(e),_&&_(e,t)}),C=T((e,t)=>{const n=se({timeout:b,style:w,easing:h},{mode:"enter"});e.style.webkitTransition=o.transitions.create("-webkit-transform",{...n}),e.style.transition=o.transitions.create("transform",{...n}),e.style.webkitTransform="none",e.style.transform="none",m&&m(e,t)}),x=T(f),R=T(v),A=T(e=>{const t=se({timeout:b,style:w,easing:h},{mode:"exit"});e.style.webkitTransition=o.transitions.create("-webkit-transform",t),e.style.transition=o.transitions.create("transform",t),qe(d,e,u),g&&g(e)}),N=T(e=>{e.style.webkitTransition="",e.style.transition="",y&&y(e)}),F=r.useCallback(()=>{k.current&&qe(d,k.current,u)},[d,u]);return r.useEffect(()=>{if(p||"down"===d||"right"===d)return;const e=ie(()=>{k.current&&qe(d,k.current,u)}),t=oe(k.current);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[d,p,u]),r.useEffect(()=>{p||F()},[p,F]),e(S,{nodeRef:k,onEnter:O,onEntered:x,onEntering:C,onExit:A,onExited:N,onExiting:R,addEndListener:e=>{a&&a(k.current,e)},appear:l,in:p,timeout:b,...E,children:(e,{ownerState:t,...n})=>r.cloneElement(c,{ref:P,style:{visibility:"exited"!==e||p?void 0:"hidden",...w,...c.props.style},...n})})});function Ve(e){return $("MuiDrawer",e)}"production"!==process.env.NODE_ENV&&(He.propTypes={addEndListener:D.func,appear:D.bool,children:ce.isRequired,container:le(D.oneOfType([ue,D.func]),e=>{if(e.open){const t=We(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:D.oneOf(["down","left","right","up"]),easing:D.oneOfType([D.shape({enter:D.string,exit:D.string}),D.string]),in:D.bool,onEnter:D.func,onEntered:D.func,onEntering:D.func,onExit:D.func,onExited:D.func,onExiting:D.func,style:D.object,timeout:D.oneOfType([D.number,D.shape({appear:D.number,enter:D.number,exit:D.number})])}),U("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Ye=(e,t)=>{const{ownerState:n}=e;return[t.root,("permanent"===n.variant||"persistent"===n.variant)&&t.docked,t.modal]},Ke=G(Q,{name:"MuiDrawer",slot:"Root",overridesResolver:Ye})(ee(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Ge=G("div",{shouldForwardProp:pe,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Ye})({flex:"0 0 auto"}),Je=G(H,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${J(n.anchor)}`],"temporary"!==n.variant&&t[`paperAnchorDocked${J(n.anchor)}`]]}})(ee(({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}`}}]}))),Xe={left:"right",right:"left",top:"down",bottom:"up"};const Qe=r.forwardRef(function(t,n){const o=W({props:t,name:"MuiDrawer"}),i=q(),s=de(),a={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:l="left",BackdropProps:c,children:u,className:d,elevation:h=16,hideBackdrop:p=!1,ModalProps:{BackdropProps:_,...f}={},onClose:m,open:g=!1,PaperProps:y={},SlideProps:v,TransitionComponent:w,transitionDuration:b=a,variant:S="temporary",slots:E={},slotProps:k={},...P}=o,T=r.useRef(!1);r.useEffect(()=>{T.current=!0},[]);const O=function({direction:e},t){return"rtl"===e&&function(e){return["left","right"].includes(e)}(t)?Xe[t]:t}({direction:s?"rtl":"ltr"},l),C=l,x={...o,anchor:C,elevation:h,open:g,variant:S,...P},R=(e=>{const{classes:t,anchor:n,variant:r}=e,o={root:["root",`anchor${J(n)}`],docked:[("permanent"===r||"persistent"===r)&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${J(n)}`,"temporary"!==r&&`paperAnchorDocked${J(n)}`]};return X(o,Ve,t)})(x),A={slots:{transition:w,...E},slotProps:{paper:y,transition:v,...k,backdrop:he(k.backdrop||{...c,..._},{transitionDuration:b})}},[N,F]=K("root",{ref:n,elementType:Ke,className:M(R.root,R.modal,d),shouldForwardComponentProp:!0,ownerState:x,externalForwardedProps:{...A,...P,...f},additionalProps:{open:g,onClose:m,hideBackdrop:p,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[j,I]=K("paper",{elementType:Je,shouldForwardComponentProp:!0,className:M(R.paper,y.className),ownerState:x,externalForwardedProps:A,additionalProps:{elevation:"temporary"===S?h:0,square:!0,..."temporary"===S&&{role:"dialog","aria-modal":"true"}}}),[U,L]=K("docked",{elementType:Ge,ref:n,className:M(R.root,R.docked,d),ownerState:x,externalForwardedProps:A,additionalProps:P}),[z,B]=K("transition",{elementType:He,ownerState:x,externalForwardedProps:A,additionalProps:{in:g,direction:Xe[O],timeout:b,appear:T.current}}),D=e(j,{...I,children:u});if("permanent"===S)return e(U,{...L,children:D});const $=e(z,{...B,children:D});return"persistent"===S?e(U,{...L,children:$}):e(N,{...F,children:$})});"production"!==process.env.NODE_ENV&&(Qe.propTypes={anchor:D.oneOf(["bottom","left","right","top"]),BackdropProps:D.object,children:D.node,classes:D.object,className:D.string,elevation:_e,hideBackdrop:D.bool,ModalProps:D.object,onClose:D.func,open:D.bool,PaperProps:D.object,SlideProps:D.object,slotProps:D.shape({backdrop:D.oneOfType([D.func,D.object]),docked:D.oneOfType([D.func,D.object]),paper:D.oneOfType([D.func,D.object]),root:D.oneOfType([D.func,D.object]),transition:D.oneOfType([D.func,D.object])}),slots:D.shape({backdrop:D.elementType,docked:D.elementType,paper:D.elementType,root:D.elementType,transition:D.elementType}),sx:D.oneOfType([D.arrayOf(D.oneOfType([D.func,D.object,D.bool])),D.func,D.object]),transitionDuration:D.oneOfType([D.number,D.shape({appear:D.number,enter:D.number,exit:D.number})]),variant:D.oneOf(["permanent","persistent","temporary"])});var Ze=o.memo(function({size:n=16}){return t("svg",{width:n,height:n,viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M22.6968 14.6968C22.6968 16.8185 21.8539 18.8533 20.3536 20.3536C18.8533 21.8539 16.8185 22.6968 14.6968 22.6968",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M18.6968 11.6968V10.6968C18.6968 10.1663 18.4861 9.65764 18.111 9.28256C17.7359 8.90749 17.2272 8.69678 16.6968 8.69678C16.1663 8.69678 15.6576 8.90749 15.2826 9.28256C14.9075 9.65764 14.6968 10.1663 14.6968 10.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M14.6968 10.6968V9.69678C14.6968 9.16634 14.4861 8.65764 14.111 8.28256C13.7359 7.90749 13.2272 7.69678 12.6968 7.69678C12.1663 7.69678 11.6576 7.90749 11.2826 8.28256C10.9075 8.65764 10.6968 9.16634 10.6968 9.69678V10.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10.6968 10.1968V4.69678C10.6968 4.16634 10.4861 3.65764 10.111 3.28256C9.73592 2.90749 9.22721 2.69678 8.69678 2.69678C8.16634 2.69678 7.65764 2.90749 7.28256 3.28256C6.90749 3.65764 6.69678 4.16634 6.69678 4.69678V14.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M18.6969 11.6968C18.6969 11.1663 18.9076 10.6576 19.2827 10.2826C19.6577 9.90749 20.1664 9.69678 20.6969 9.69678C21.2273 9.69678 21.736 9.90749 22.1111 10.2826C22.4862 10.6576 22.6969 11.1663 22.6969 11.6968V14.6968C22.6969 16.8185 21.854 18.8533 20.3537 20.3536C18.8534 21.8539 16.8186 22.6968 14.6969 22.6968H12.6969C9.89688 22.6968 8.19688 21.8368 6.70688 20.3568L3.10688 16.7568C2.76282 16.3757 2.57847 15.8769 2.592 15.3637C2.60554 14.8505 2.81593 14.3621 3.1796 13.9997C3.54327 13.6373 4.03238 13.4287 4.54565 13.417C5.05892 13.4053 5.55704 13.5914 5.93688 13.9368L7.69688 15.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})});var et,tt=o.memo(function({angle:n,countdown:r,isScanning:o,isInTargetRange:a,stabilityScore:l,children:c,config:u}){const d=i(()=>n<80?Math.max(0,Math.min(100,10*(n-60))):n>95?Math.max(0,Math.min(100,10*(105-n))):100,[n]),h=s(()=>{if(o)return u?.style?.base?.brandColor||"#4f46e5";const e=d();if(0===e)return"#ffffff";if(100===e)return u?.style?.base?.brandColor||"#8b5cf6";return`rgb(${Math.round(255-e/100*116)}, ${Math.round(255-e/100*163)}, ${Math.round(255-e/100*9)})`},[o,d]),_=i((e,t)=>t>70?e?"text-[#fff]/70":"text-[#fff]":e?"text-[#fff]/40":"text-[#000]/70",[]),f=i((e=!1)=>{const t=d();return o?"text-[#fff]":_(e,t)},[o,d]),m=r;function g(){document.documentElement.style.setProperty("--real-vh",window.innerHeight+"px")}return g(),window.addEventListener("resize",g),t("div",{className:"flex w-screen flex-col items-center h-[var(--real-vh)] overflow-hidden touch-none justify-center transition-all duration-300 max-w-[28rem] mx-auto",style:{backgroundColor:h},children:[e("div",{className:"flex justify-start fixed top-[.5rem] max-w-[28rem] mx-auto w-full px-[1rem]",children:e("div",{className:"flex justify-start ",children:e(p,{noTitle:!0,resolvedConfig:u})})}),null!==m?e("div",{className:"relative flex h-[6rem] w-[6rem] items-center justify-center rounded-[9999px] border-2 border-[#fff] bg-[#fff]/20 transition-all duration-300",children:e("div",{className:"text-[3rem] font-bold text-[#fff]",style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:m})}):t("div",o?{className:"relative flex flex-col items-center justify-center",children:[e("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-[9999px] border-2 bg-[#fff]/30 border-[#fff]",children:e("div",{className:"h-4 w-4 rounded-[9999px] animate-pulse bg-[#fff]/80"})}),c]}:{className:M("relative flex h-[4rem] w-[4rem] items-center justify-center rounded-[9999px] border-2 ",a?"bg-[#fff]/20 border-[#fff]":"bg-[#fff]/10 border-[#fff]"),style:{transform:`translateY(${3*(90-n)}px)`,transition:"transform 0.2s ease-out"},children:[e("div",{className:"h-[1rem] w-[1rem] rounded-[9999px] bg-[#fff]/80"}),t("div",{className:"mt-[.5rem] w-[180px] flex-col flex items-center absolute top-[60px] text-[#fff]",children:[e(Ze,{size:30}),t("p",{style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:[" ","Tap to start level check"]})]})]}),null!==m&&e("div",{className:"absolute bottom-[8rem] text-center",children:e("div",{className:"text-[#fff] text-sm font-medium px-4 py-1.5 bg-black/20 rounded-[9999px] mt-8",style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:"Leave your phone as is"})}),a&&null===m&&!o&&e("div",{className:"absolute bottom-[8rem] w-[12rem]",children:e("div",{className:"h-[.375rem] w-full bg-[#fff]/20 rounded-[9999px] overflow-hidden",children:e("div",{className:"h-full bg-[#fff]/70 transition-all duration-300 rounded-[9999px]",style:{width:`${l}%`}})})}),null===m&&!o&&e("div",{className:"absolute bottom-[5rem] text-center",children:t("div",{className:M("text-[1.5rem] font-light",f()),children:[Math.round(n),"°"]})}),null===m&&!o&&e("div",{className:"absolute bottom-[2rem] text-center max-w-[20rem] mx-auto",children:e("div",{className:M("text-[.75rem] opacity-50",f(!0)),style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:"Place your phone upright against an object. Once stable and within the 80-95° range a countdown will start to move to the scan."})})]})}),nt={exports:{}};var rt,ot=(et||(et=1,rt=nt,function(e,t){rt.exports=t(o)}(0,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{useCallback as i,useMemo as s,createContext as a,useState as l,useEffect as c,useLayoutEffect as u,useContext as d,useRef as h}from"react";import{H as p,v as _,S as f,p as m,L as g,q as y,r as v,t as w,V as b,G as S,C as E,w as k,x as P,y as T,z as O,u as C,A as x,B as R}from"./Header-CDkpLwYo.js";import{ad as A,ae as N,af as F,ag as j,d as I,n as M,o as U,ah as L,f as z,ai as B,P as D,r as $,p as W,N as q,Y as H,aj as V,a4 as Y,Z as K,q as G,H as J,x as X,a0 as Q,ak as Z,G as ee,M as te,t as ne,O as re,B as oe,D as ie,Q as se,R as ae,m as le,S as ce,a2 as ue,a3 as de,$ as he,L as pe,a1 as _e,al as fe,J as me,ac as ge,am as ye,an as ve,ao as we,ap as be,aq as Se,ar as Ee,as as ke,at as Pe,h as Te,a7 as Oe,au as Ce,av as xe}from"./enums-BV1_VQpZ.js";import{L as Re}from"./LoadingScreen-Czxa8Is0.js";import Ae from"video.js";import"react-dom";function Ne(e){const{sx:t,...n}=e,{systemProps:r,otherProps:o}=(e=>{const t={systemProps:{},otherProps:{}},n=e?.theme?.unstable_sxConfig??N;return Object.keys(e).forEach(r=>{n[r]?t.systemProps[r]=e[r]:t.otherProps[r]=e[r]}),t})(n);let i;return i=Array.isArray(t)?[r,...t]:"function"==typeof t?(...e)=>{const n=t(...e);return A(n)?{...r,...n}:r}:{...r,...t},{...o,sx:i}}const Fe=U("MuiBox",["root"]),je=function(t={}){const{themeId:n,defaultTheme:o,defaultClassName:i="MuiBox-root",generateClassName:s}=t,a=F("div",{shouldForwardProp:e=>"theme"!==e&&"sx"!==e&&"as"!==e})(j);return r.forwardRef(function(t,r){const l=I(o),{className:c,component:u="div",...d}=Ne(t);return e(a,{as:u,ref:r,className:M(c,s?s(i):i),theme:n&&l[n]||l,...d})})}({themeId:z,defaultTheme:B(),defaultClassName:Fe.root,generateClassName:L.generate});function Ie(e){return $("MuiDialog",e)}"production"!==process.env.NODE_ENV&&(je.propTypes={children:D.node,component:D.elementType,sx:D.oneOfType([D.arrayOf(D.oneOfType([D.func,D.object,D.bool])),D.func,D.object])});const Me=U("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),Ue=r.createContext({});"production"!==process.env.NODE_ENV&&(Ue.displayName="DialogContext");const Le=G(Z,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),ze=G(Q,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),Be=G("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${J(n.scroll)}`]]}})({height:"100%","@media print":{height:"auto"},outline:0,variants:[{props:{scroll:"paper"},style:{display:"flex",justifyContent:"center",alignItems:"center"}},{props:{scroll:"body"},style:{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}}}]}),De=G(H,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${J(n.scroll)}`],t[`paperWidth${J(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(ee(({theme:e})=>({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"},variants:[{props:{scroll:"paper"},style:{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"}},{props:{scroll:"body"},style:{display:"inline-block",verticalAlign:"middle",textAlign:"initial"}},{props:({ownerState:e})=>!e.maxWidth,style:{maxWidth:"calc(100% - 64px)"}},{props:{maxWidth:"xs"},style:{maxWidth:"px"===e.breakpoints.unit?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${Me.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:"calc(100% - 64px)"}}}},...Object.keys(e.breakpoints.values).filter(e=>"xs"!==e).map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${Me.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:"calc(100% - 64px)"}}}})),{props:({ownerState:e})=>e.fullWidth,style:{width:"calc(100% - 64px)"}},{props:({ownerState:e})=>e.fullScreen,style:{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${Me.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),$e=r.forwardRef(function(t,n){const o=W({props:t,name:"MuiDialog"}),i=q(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":l,"aria-modal":c=!0,BackdropComponent:u,BackdropProps:d,children:h,className:p,disableEscapeKeyDown:_=!1,fullScreen:f=!1,fullWidth:m=!1,maxWidth:g="sm",onClick:y,onClose:v,open:w,PaperComponent:b=H,PaperProps:S={},scroll:E="paper",slots:k={},slotProps:P={},TransitionComponent:T=V,transitionDuration:O=s,TransitionProps:C,...x}=o,R={...o,disableEscapeKeyDown:_,fullScreen:f,fullWidth:m,maxWidth:g,scroll:E},A=(e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:i}=e,s={root:["root"],container:["container",`scroll${J(n)}`],paper:["paper",`paperScroll${J(n)}`,`paperWidth${J(String(r))}`,o&&"paperFullWidth",i&&"paperFullScreen"]};return X(s,Ie,t)})(R),N=r.useRef(),F=Y(l),j=r.useMemo(()=>({titleId:F}),[F]),I={slots:{transition:T,...k},slotProps:{transition:C,paper:S,backdrop:d,...P}},[U,L]=K("root",{elementType:ze,shouldForwardComponentProp:!0,externalForwardedProps:I,ownerState:R,className:M(A.root,p),ref:n}),[z,B]=K("backdrop",{elementType:Le,shouldForwardComponentProp:!0,externalForwardedProps:I,ownerState:R}),[D,$]=K("paper",{elementType:De,shouldForwardComponentProp:!0,externalForwardedProps:I,ownerState:R,className:M(A.paper,S.className)}),[G,Q]=K("container",{elementType:Be,externalForwardedProps:I,ownerState:R,className:A.container}),[Z,ee]=K("transition",{elementType:V,externalForwardedProps:I,ownerState:R,additionalProps:{appear:!0,in:w,timeout:O,role:"presentation"}});return e(U,{closeAfterTransition:!0,slots:{backdrop:z},slotProps:{backdrop:{transitionDuration:O,as:u,...B}},disableEscapeKeyDown:_,onClose:v,open:w,onClick:e=>{y&&y(e),N.current&&(N.current=null,v&&v(e,"backdropClick"))},...L,...x,children:e(Z,{...ee,children:e(G,{onMouseDown:e=>{N.current=e.target===e.currentTarget},...Q,children:e(D,{as:b,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":F,"aria-modal":c,...$,children:e(Ue.Provider,{value:j,children:h})})})})})});function We(e){return"function"==typeof e?e():e}function qe(e,t,n){const r=function(e,t,n){const r=t.getBoundingClientRect(),o=n&&n.getBoundingClientRect(),i=oe(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const e=i.getComputedStyle(t);s=e.getPropertyValue("-webkit-transform")||e.getPropertyValue("transform")}let a=0,l=0;if(s&&"none"!==s&&"string"==typeof s){const e=s.split("(")[1].split(")")[0].split(",");a=parseInt(e[4],10),l=parseInt(e[5],10)}return"left"===e?o?`translateX(${o.right+a-r.left}px)`:`translateX(${i.innerWidth+a-r.left}px)`:"right"===e?o?`translateX(-${r.right-o.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:"up"===e?o?`translateY(${o.bottom+l-r.top}px)`:`translateY(${i.innerHeight+l-r.top}px)`:o?`translateY(-${r.top-o.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}(e,t,We(n));r&&(t.style.webkitTransform=r,t.style.transform=r)}"production"!==process.env.NODE_ENV&&($e.propTypes={"aria-describedby":D.string,"aria-labelledby":D.string,"aria-modal":D.oneOfType([D.oneOf(["false","true"]),D.bool]),BackdropComponent:D.elementType,BackdropProps:D.object,children:D.node,classes:D.object,className:D.string,disableEscapeKeyDown:D.bool,fullScreen:D.bool,fullWidth:D.bool,maxWidth:D.oneOfType([D.oneOf(["xs","sm","md","lg","xl",!1]),D.string]),onClick:D.func,onClose:D.func,open:D.bool.isRequired,PaperComponent:D.elementType,PaperProps:D.object,scroll:D.oneOf(["body","paper"]),slotProps:D.shape({backdrop:D.oneOfType([D.func,D.object]),container:D.oneOfType([D.func,D.object]),paper:D.oneOfType([D.func,D.object]),root:D.oneOfType([D.func,D.object]),transition:D.oneOfType([D.func,D.object])}),slots:D.shape({backdrop:D.elementType,container:D.elementType,paper:D.elementType,root:D.elementType,transition:D.elementType}),sx:D.oneOfType([D.arrayOf(D.oneOfType([D.func,D.object,D.bool])),D.func,D.object]),TransitionComponent:D.elementType,transitionDuration:D.oneOfType([D.number,D.shape({appear:D.number,enter:D.number,exit:D.number})]),TransitionProps:D.object});const He=r.forwardRef(function(t,n){const o=q(),i={enter:o.transitions.easing.easeOut,exit:o.transitions.easing.sharp},s={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{addEndListener:a,appear:l=!0,children:c,container:u,direction:d="down",easing:h=i,in:p,onEnter:_,onEntered:f,onEntering:m,onExit:g,onExited:y,onExiting:v,style:w,timeout:b=s,TransitionComponent:S=te,...E}=t,k=r.useRef(null),P=ne(re(c),k,n),T=e=>t=>{e&&(void 0===t?e(k.current):e(k.current,t))},O=T((e,t)=>{qe(d,e,u),ae(e),_&&_(e,t)}),C=T((e,t)=>{const n=se({timeout:b,style:w,easing:h},{mode:"enter"});e.style.webkitTransition=o.transitions.create("-webkit-transform",{...n}),e.style.transition=o.transitions.create("transform",{...n}),e.style.webkitTransform="none",e.style.transform="none",m&&m(e,t)}),x=T(f),R=T(v),A=T(e=>{const t=se({timeout:b,style:w,easing:h},{mode:"exit"});e.style.webkitTransition=o.transitions.create("-webkit-transform",t),e.style.transition=o.transitions.create("transform",t),qe(d,e,u),g&&g(e)}),N=T(e=>{e.style.webkitTransition="",e.style.transition="",y&&y(e)}),F=r.useCallback(()=>{k.current&&qe(d,k.current,u)},[d,u]);return r.useEffect(()=>{if(p||"down"===d||"right"===d)return;const e=ie(()=>{k.current&&qe(d,k.current,u)}),t=oe(k.current);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[d,p,u]),r.useEffect(()=>{p||F()},[p,F]),e(S,{nodeRef:k,onEnter:O,onEntered:x,onEntering:C,onExit:A,onExited:N,onExiting:R,addEndListener:e=>{a&&a(k.current,e)},appear:l,in:p,timeout:b,...E,children:(e,{ownerState:t,...n})=>r.cloneElement(c,{ref:P,style:{visibility:"exited"!==e||p?void 0:"hidden",...w,...c.props.style},...n})})});function Ve(e){return $("MuiDrawer",e)}"production"!==process.env.NODE_ENV&&(He.propTypes={addEndListener:D.func,appear:D.bool,children:ce.isRequired,container:le(D.oneOfType([ue,D.func]),e=>{if(e.open){const t=We(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:D.oneOf(["down","left","right","up"]),easing:D.oneOfType([D.shape({enter:D.string,exit:D.string}),D.string]),in:D.bool,onEnter:D.func,onEntered:D.func,onEntering:D.func,onExit:D.func,onExited:D.func,onExiting:D.func,style:D.object,timeout:D.oneOfType([D.number,D.shape({appear:D.number,enter:D.number,exit:D.number})])}),U("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Ye=(e,t)=>{const{ownerState:n}=e;return[t.root,("permanent"===n.variant||"persistent"===n.variant)&&t.docked,t.modal]},Ke=G(Q,{name:"MuiDrawer",slot:"Root",overridesResolver:Ye})(ee(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Ge=G("div",{shouldForwardProp:pe,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Ye})({flex:"0 0 auto"}),Je=G(H,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${J(n.anchor)}`],"temporary"!==n.variant&&t[`paperAnchorDocked${J(n.anchor)}`]]}})(ee(({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}`}}]}))),Xe={left:"right",right:"left",top:"down",bottom:"up"};const Qe=r.forwardRef(function(t,n){const o=W({props:t,name:"MuiDrawer"}),i=q(),s=de(),a={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:l="left",BackdropProps:c,children:u,className:d,elevation:h=16,hideBackdrop:p=!1,ModalProps:{BackdropProps:_,...f}={},onClose:m,open:g=!1,PaperProps:y={},SlideProps:v,TransitionComponent:w,transitionDuration:b=a,variant:S="temporary",slots:E={},slotProps:k={},...P}=o,T=r.useRef(!1);r.useEffect(()=>{T.current=!0},[]);const O=function({direction:e},t){return"rtl"===e&&function(e){return["left","right"].includes(e)}(t)?Xe[t]:t}({direction:s?"rtl":"ltr"},l),C=l,x={...o,anchor:C,elevation:h,open:g,variant:S,...P},R=(e=>{const{classes:t,anchor:n,variant:r}=e,o={root:["root",`anchor${J(n)}`],docked:[("permanent"===r||"persistent"===r)&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${J(n)}`,"temporary"!==r&&`paperAnchorDocked${J(n)}`]};return X(o,Ve,t)})(x),A={slots:{transition:w,...E},slotProps:{paper:y,transition:v,...k,backdrop:he(k.backdrop||{...c,..._},{transitionDuration:b})}},[N,F]=K("root",{ref:n,elementType:Ke,className:M(R.root,R.modal,d),shouldForwardComponentProp:!0,ownerState:x,externalForwardedProps:{...A,...P,...f},additionalProps:{open:g,onClose:m,hideBackdrop:p,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[j,I]=K("paper",{elementType:Je,shouldForwardComponentProp:!0,className:M(R.paper,y.className),ownerState:x,externalForwardedProps:A,additionalProps:{elevation:"temporary"===S?h:0,square:!0,..."temporary"===S&&{role:"dialog","aria-modal":"true"}}}),[U,L]=K("docked",{elementType:Ge,ref:n,className:M(R.root,R.docked,d),ownerState:x,externalForwardedProps:A,additionalProps:P}),[z,B]=K("transition",{elementType:He,ownerState:x,externalForwardedProps:A,additionalProps:{in:g,direction:Xe[O],timeout:b,appear:T.current}}),D=e(j,{...I,children:u});if("permanent"===S)return e(U,{...L,children:D});const $=e(z,{...B,children:D});return"persistent"===S?e(U,{...L,children:$}):e(N,{...F,children:$})});"production"!==process.env.NODE_ENV&&(Qe.propTypes={anchor:D.oneOf(["bottom","left","right","top"]),BackdropProps:D.object,children:D.node,classes:D.object,className:D.string,elevation:_e,hideBackdrop:D.bool,ModalProps:D.object,onClose:D.func,open:D.bool,PaperProps:D.object,SlideProps:D.object,slotProps:D.shape({backdrop:D.oneOfType([D.func,D.object]),docked:D.oneOfType([D.func,D.object]),paper:D.oneOfType([D.func,D.object]),root:D.oneOfType([D.func,D.object]),transition:D.oneOfType([D.func,D.object])}),slots:D.shape({backdrop:D.elementType,docked:D.elementType,paper:D.elementType,root:D.elementType,transition:D.elementType}),sx:D.oneOfType([D.arrayOf(D.oneOfType([D.func,D.object,D.bool])),D.func,D.object]),transitionDuration:D.oneOfType([D.number,D.shape({appear:D.number,enter:D.number,exit:D.number})]),variant:D.oneOf(["permanent","persistent","temporary"])});var Ze=o.memo(function({size:n=16}){return t("svg",{width:n,height:n,viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M22.6968 14.6968C22.6968 16.8185 21.8539 18.8533 20.3536 20.3536C18.8533 21.8539 16.8185 22.6968 14.6968 22.6968",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M18.6968 11.6968V10.6968C18.6968 10.1663 18.4861 9.65764 18.111 9.28256C17.7359 8.90749 17.2272 8.69678 16.6968 8.69678C16.1663 8.69678 15.6576 8.90749 15.2826 9.28256C14.9075 9.65764 14.6968 10.1663 14.6968 10.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M14.6968 10.6968V9.69678C14.6968 9.16634 14.4861 8.65764 14.111 8.28256C13.7359 7.90749 13.2272 7.69678 12.6968 7.69678C12.1663 7.69678 11.6576 7.90749 11.2826 8.28256C10.9075 8.65764 10.6968 9.16634 10.6968 9.69678V10.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M10.6968 10.1968V4.69678C10.6968 4.16634 10.4861 3.65764 10.111 3.28256C9.73592 2.90749 9.22721 2.69678 8.69678 2.69678C8.16634 2.69678 7.65764 2.90749 7.28256 3.28256C6.90749 3.65764 6.69678 4.16634 6.69678 4.69678V14.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M18.6969 11.6968C18.6969 11.1663 18.9076 10.6576 19.2827 10.2826C19.6577 9.90749 20.1664 9.69678 20.6969 9.69678C21.2273 9.69678 21.736 9.90749 22.1111 10.2826C22.4862 10.6576 22.6969 11.1663 22.6969 11.6968V14.6968C22.6969 16.8185 21.854 18.8533 20.3537 20.3536C18.8534 21.8539 16.8186 22.6968 14.6969 22.6968H12.6969C9.89688 22.6968 8.19688 21.8368 6.70688 20.3568L3.10688 16.7568C2.76282 16.3757 2.57847 15.8769 2.592 15.3637C2.60554 14.8505 2.81593 14.3621 3.1796 13.9997C3.54327 13.6373 4.03238 13.4287 4.54565 13.417C5.05892 13.4053 5.55704 13.5914 5.93688 13.9368L7.69688 15.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})});var et,tt=o.memo(function({angle:n,countdown:r,isScanning:o,isInTargetRange:a,stabilityScore:l,children:c,config:u}){const d=i(()=>n<80?Math.max(0,Math.min(100,10*(n-60))):n>95?Math.max(0,Math.min(100,10*(105-n))):100,[n]),h=s(()=>{if(o)return u?.style?.base?.brandColor||"#4f46e5";const e=d();if(0===e)return"#ffffff";if(100===e)return u?.style?.base?.brandColor||"#8b5cf6";return`rgb(${Math.round(255-e/100*116)}, ${Math.round(255-e/100*163)}, ${Math.round(255-e/100*9)})`},[o,d]),_=i((e,t)=>t>70?e?"text-[#fff]/70":"text-[#fff]":e?"text-[#fff]/40":"text-[#000]/70",[]),f=i((e=!1)=>{const t=d();return o?"text-[#fff]":_(e,t)},[o,d]),m=r;function g(){document.documentElement.style.setProperty("--real-vh",window.innerHeight+"px")}return g(),window.addEventListener("resize",g),t("div",{className:"flex w-screen flex-col items-center h-[var(--real-vh)] overflow-hidden touch-none justify-center transition-all duration-300 max-w-[28rem] mx-auto",style:{backgroundColor:h},children:[e("div",{className:"flex justify-start fixed top-[.5rem] max-w-[28rem] mx-auto w-full px-[1rem]",children:e("div",{className:"flex justify-start ",children:e(p,{noTitle:!0,resolvedConfig:u})})}),null!==m?e("div",{className:"relative flex h-[6rem] w-[6rem] items-center justify-center rounded-[9999px] border-2 border-[#fff] bg-[#fff]/20 transition-all duration-300",children:e("div",{className:"text-[3rem] font-bold text-[#fff]",style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:m})}):t("div",o?{className:"relative flex flex-col items-center justify-center",children:[e("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-[9999px] border-2 bg-[#fff]/30 border-[#fff]",children:e("div",{className:"h-4 w-4 rounded-[9999px] animate-pulse bg-[#fff]/80"})}),c]}:{className:M("relative flex h-[4rem] w-[4rem] items-center justify-center rounded-[9999px] border-2 ",a?"bg-[#fff]/20 border-[#fff]":"bg-[#fff]/10 border-[#fff]"),style:{transform:`translateY(${3*(90-n)}px)`,transition:"transform 0.2s ease-out"},children:[e("div",{className:"h-[1rem] w-[1rem] rounded-[9999px] bg-[#fff]/80"}),t("div",{className:"mt-[.5rem] w-[180px] flex-col flex items-center absolute top-[60px] text-[#fff]",children:[e(Ze,{size:30}),t("p",{style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:[" ","Tap to start level check"]})]})]}),null!==m&&e("div",{className:"absolute bottom-[8rem] text-center",children:e("div",{className:"text-[#fff] text-sm font-medium px-4 py-1.5 bg-black/20 rounded-[9999px] mt-8",style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:"Leave your phone as is"})}),a&&null===m&&!o&&e("div",{className:"absolute bottom-[8rem] w-[12rem]",children:e("div",{className:"h-[.375rem] w-full bg-[#fff]/20 rounded-[9999px] overflow-hidden",children:e("div",{className:"h-full bg-[#fff]/70 transition-all duration-300 rounded-[9999px]",style:{width:`${l}%`}})})}),null===m&&!o&&e("div",{className:"absolute bottom-[5rem] text-center",children:t("div",{className:M("text-[1.5rem] font-light",f()),children:[Math.round(n),"°"]})}),null===m&&!o&&e("div",{className:"absolute bottom-[2rem] text-center max-w-[20rem] mx-auto",children:e("div",{className:M("text-[.75rem] opacity-50",f(!0)),style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:"Place your phone upright against an object. Once stable and within the 80-95° range a countdown will start to move to the scan."})})]})}),nt={exports:{}};var rt,ot=(et||(et=1,rt=nt,function(e,t){rt.exports=t(o)}(0,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/react-webcam.tsx")}({"./src/react-webcam.tsx":
|
|
2
2
|
/*!******************************!*\
|
|
3
3
|
!*** ./src/react-webcam.tsx ***!
|
|
4
4
|
\******************************/
|
|
@@ -16,5 +16,5 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from
|
|
|
16
16
|
*
|
|
17
17
|
* @param phrase that needs interpolation, with placeholders
|
|
18
18
|
* @param options with values that will be used to replace placeholders
|
|
19
|
-
*/function Go(e,t){const n=/\$/g;let r=[e];if(null==t)return r;for(const e of Object.keys(t))if("_"!==e){let o=t[e];"string"==typeof o&&(o=n[Symbol.replace](o,"$$$$")),r=Ko(r,new RegExp(`%\\{${e}\\}`,"g"),o)}return r}const Jo=e=>{throw new Error(`missing string: ${e}`)};var Xo,Qo,Zo=Yo("onMissingKey"),ei=Yo("apply");class ti{constructor(e,t){let{onMissingKey:n=Jo}=void 0===t?{}:t;Object.defineProperty(this,ei,{value:ni}),Object.defineProperty(this,Zo,{writable:!0,value:void 0}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(e)?e.forEach(Ho(this,ei)[ei],this):Ho(this,ei)[ei](e),Ho(this,Zo)[Zo]=n}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let n=this.locale.strings[e];null==n&&(Ho(this,Zo)[Zo](e),n=e);if("object"==typeof n){if(t&&void 0!==t.smart_count){return Go(n[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 n)throw new Error("string was not a string");return Go(n,t)}}function ni(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 ri=fe((Qo||(Qo=1,Xo=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,s,a){var l=function(e){for(var n=t[e]?t[e]:[],r=e.indexOf(":"),o=-1===r?[e]:[e.substring(0,r),e.substring(r+1)],i=Object.keys(t),s=0,a=i.length;s<a;s++){var l=i[s];if("*"===l&&(n=n.concat(t[l])),2===o.length&&o[0]===l){n=n.concat(t[l]);break}}return n}(e);l.length&&function(e,t,n){for(var r=0,o=t.length;r<o&&t[r];r++)t[r].event=e,t[r].apply(t[r],n)}(e,l,[n,r,o,i,s,a])},e.on=function(e,n){t[e]||(t[e]=[]),t[e].push(n)},e.once=function(t,n){this.on(t,function r(){n.apply(this,arguments),e.off(t,r)})},e.off=function(e,t){var n=[];if(e&&t)for(var r=this._fns[e],o=0,i=r?r.length:0;o<i;o++)r[o]!==t&&n.push(r[o]);n.length?this._fns[e]=n:delete this._fns[e]},e}),Xo));var oi,ii,si,ai,li,ci,ui,di,hi,pi,_i,fi,mi,gi,yi,vi,wi,bi,Si,Ei,ki,Pi,Ti,Oi,Ci,xi,Ri,Ai,Ni,Fi;function ji(){if(ii)return oi;return ii=1,oi=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},oi}function Ii(){if(ci)return li;ci=1;var e=function(){if(ai)return si;ai=1;var e="object"==typeof ye&&ye&&ye.Object===Object&&ye;return si=e}(),t="object"==typeof self&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return li=n}function Mi(){if(fi)return _i;fi=1;var e=function(){if(pi)return hi;pi=1;var e=/\s/;return hi=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}}(),t=/^\s+/;return _i=function(n){return n?n.slice(0,e(n)+1).replace(t,""):n}}function Ui(){if(gi)return mi;gi=1;var e=Ii().Symbol;return mi=e}function Li(){if(Ei)return Si;Ei=1;var e=Ui(),t=function(){if(vi)return yi;vi=1;var e=Ui(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;return yi=function(e){var t=n.call(e,o),i=e[o];try{e[o]=void 0;var s=!0}catch(e){}var a=r.call(e);return s&&(t?e[o]=i:delete e[o]),a},yi}(),n=function(){if(bi)return wi;bi=1;var e=Object.prototype.toString;return wi=function(t){return e.call(t)},wi}(),r=e?e.toStringTag:void 0;return Si=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)},Si}function zi(){if(Oi)return Ti;Oi=1;var e=Li(),t=(Pi||(Pi=1,ki=function(e){return null!=e&&"object"==typeof e}),ki);return Ti=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)},Ti}function Bi(){if(Ai)return Ri;Ai=1;var e=ji(),t=function(){if(di)return ui;di=1;var e=Ii();return ui=function(){return e.Date.now()}}(),n=function(){if(xi)return Ci;xi=1;var e=Mi(),t=ji(),n=zi(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;return Ci=function(a){if("number"==typeof a)return a;if(n(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=o.test(a);return c||i.test(a)?s(a.slice(2),c?2:8):r.test(a)?NaN:+a},Ci}(),r=Math.max,o=Math.min;return Ri=function(i,s,a){var l,c,u,d,h,p,_=0,f=!1,m=!1,g=!0;if("function"!=typeof i)throw new TypeError("Expected a function");function y(e){var t=l,n=c;return l=c=void 0,_=e,d=i.apply(n,t)}function v(e){var t=e-p;return void 0===p||t>=s||t<0||m&&e-_>=u}function w(){var e=t();if(v(e))return b(e);h=setTimeout(w,function(e){var t=s-(e-p);return m?o(t,u-(e-_)):t}(e))}function b(e){return h=void 0,g&&l?y(e):(l=c=void 0,d)}function S(){var e=t(),n=v(e);if(l=arguments,c=this,p=e,n){if(void 0===h)return function(e){return _=e,h=setTimeout(w,s),f?y(e):d}(p);if(m)return clearTimeout(h),h=setTimeout(w,s),y(p)}return void 0===h&&(h=setTimeout(w,s)),d}return s=n(s)||0,e(a)&&(f=!!a.leading,u=(m="maxWait"in a)?r(n(a.maxWait)||0,s):u,g="trailing"in a?!!a.trailing:g),S.cancel=function(){void 0!==h&&clearTimeout(h),_=0,l=p=c=h=void 0},S.flush=function(){return void 0===h?d:b(t())},S},Ri}var Di=function(){if(Fi)return Ni;Fi=1;var e=Bi(),t=ji();return Ni=function(n,r,o){var i=!0,s=!0;if("function"!=typeof n)throw new TypeError("Expected a function");return t(o)&&(i="leading"in o?!!o.leading:i,s="trailing"in o?!!o.trailing:s),e(n,r,{leading:i,maxWait:r,trailing:s})}}(),$i=fe(Di);function Wi(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var qi=0;function Hi(e){return"__private_"+qi+++"_"+e}var Vi=Hi("callbacks"),Yi=Hi("publish");class Ki{constructor(){Object.defineProperty(this,Yi,{value:Gi}),this.state={},Object.defineProperty(this,Vi,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},n={...this.state,...e};this.state=n,Wi(this,Yi)[Yi](t,n,e)}subscribe(e){return Wi(this,Vi)[Vi].add(e),()=>{Wi(this,Vi)[Vi].delete(e)}}}function Gi(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Wi(this,Vi)[Vi].forEach(e=>{e(...t)})}function Ji(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)}}Ki.VERSION="3.2.2";var Xi={__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 Qi(e){var t;if(e.type)return e.type;const n=e.name?null==(t=Ji(e.name).extension)?void 0:t.toLowerCase():null;return n&&n in Xi?Xi[n]:"application/octet-stream"}function Zi(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}function es(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 n=Qi(e);return function(e,t){let n=t||"uppy";return"string"==typeof e.name&&(n+=`-${Zi(e.name.toLowerCase())}`),void 0!==e.type&&(n+=`-${e.type}`),e.meta&&"string"==typeof e.meta.relativePath&&(n+=`-${Zi(e.meta.relativePath.toLowerCase())}`),void 0!==e.data.size&&(n+=`-${e.data.size}`),void 0!==e.data.lastModified&&(n+=`-${e.data.lastModified}`),n}({...e,type:n},t)}function ts(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 n=t[1].split(".",2),r=parseInt(n[0],10),o=parseInt(n[1],10);return r<15||15===r&&o<15063||(r>18||18===r&&o>=18218)}function ns(e){return e<10?`0${e}`:e.toString()}function rs(){const e=new Date;return`${ns(e.getHours())}:${ns(e.getMinutes())}:${ns(e.getSeconds())}`}const os={debug:()=>{},warn:()=>{},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.error(`[Uppy] [${rs()}]`,...t)}},is={debug:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.debug(`[Uppy] [${rs()}]`,...t)},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.warn(`[Uppy] [${rs()}]`,...t)},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.error(`[Uppy] [${rs()}]`,...t)}};var ss,as;var ls,cs,us,ds,hs=(as||(as=1,ss=function(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("Expected a number, got "+typeof e);const t=e<0;let n=Math.abs(e);if(t&&(n=-n),0===n)return"0 B";const r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.min(Math.floor(Math.log(n)/Math.log(1024)),r.length-1),i=Number(n/1024**o),s=r[o];return`${i>=10||i%1==0?Math.round(i):i.toFixed(1)} ${s}`}),ss),ps=fe(hs);function _s(){if(cs)return ls;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return cs=1,e.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t<i;t++)"*"!==o[t]&&(r=t<n.length&&o[t]===n[t]);r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var s in r={},e)this.match(s)&&(r[s]=e[s]);return r},ls=function(t,n,r){var o=new e(t,r||/[\/\.]/);return void 0!==n?o.match(n):o},ls}var fs=function(){if(ds)return us;ds=1;var e=_s(),t=/[\/\+\.]/;return us=function(n,r){function o(r){var o=e(r,n,t);return o&&o.length>=2}return r?o(r.split(";")[0]):o},us}(),ms=fe(fs);const gs={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class ys extends Error{constructor(e,t){var n;super(e),this.isRestriction=!0,this.isUserFacing=null==(n=null==t?void 0:t.isUserFacing)||n,null!=t&&t.file&&(this.file=t.file)}}class vs{constructor(e,t){this.getI18n=t,this.getOpts=()=>{var t;const n=e();if(null!=(null==(t=n.restrictions)?void 0:t.allowedFileTypes)&&!Array.isArray(n.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return n}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:n,maxNumberOfFiles:r}=this.getOpts().restrictions;if(r){if(e.filter(e=>!e.isGhost).length+t.length>r)throw new ys(`${this.getI18n()("youCanOnlyUploadX",{smart_count:r})}`)}if(n){const r=[...e,...t].reduce((e,t)=>{var n;return e+(null!=(n=t.size)?n:0)},0);if(r>n)throw new ys(this.getI18n()("aggregateExceedsSize",{sizeAllowed:ps(n),size:ps(r)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:n,allowedFileTypes:r}=this.getOpts().restrictions;if(r){if(!r.some(t=>t.includes("/")?!!e.type&&ms(e.type.replace(/;.*?$/,""),t):!("."!==t[0]||!e.extension)&&e.extension.toLowerCase()===t.slice(1).toLowerCase())){const t=r.join(", ");throw new ys(this.getI18n()("youCanOnlyUploadFileTypes",{types:t}),{file:e})}}if(t&&null!=e.size&&e.size>t)throw new ys(this.getI18n()("exceedsSize",{size:ps(t),file:e.name}),{file:e});if(n&&null!=e.size&&e.size<n)throw new ys(this.getI18n()("inferiorSize",{size:ps(n)}),{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 ys(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new ys(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:n}=this.getOpts().restrictions,r=[];for(const t of n)Object.hasOwn(e.meta,t)&&""!==e.meta[t]||r.push(t);return{missingFields:r,error:t}}}var ws={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 bs,Ss;function Es(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var ks=0;function Ps(e){return"__private_"+ks+++"_"+e}const Ts={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var Os=Ps("plugins"),Cs=Ps("restricter"),xs=Ps("storeUnsubscribe"),Rs=Ps("emitter"),As=Ps("preProcessors"),Ns=Ps("uploaders"),Fs=Ps("postProcessors"),js=Ps("informAndEmit"),Is=Ps("checkRequiredMetaFieldsOnFile"),Ms=Ps("checkRequiredMetaFields"),Us=Ps("assertNewUploadAllowed"),Ls=Ps("transformFile"),zs=Ps("startIfAutoProceed"),Bs=Ps("checkAndUpdateFileState"),Ds=Ps("addListeners"),$s=Ps("updateOnlineStatus"),Ws=Ps("requestClientById"),qs=Ps("createUpload"),Hs=Ps("getUpload"),Vs=Ps("removeUpload"),Ys=Ps("runUpload");bs=Symbol.for("uppy test: getPlugins"),Ss=Symbol.for("uppy test: createUpload");class Ks{constructor(e){Object.defineProperty(this,Ys,{value:sa}),Object.defineProperty(this,Vs,{value:ia}),Object.defineProperty(this,Hs,{value:oa}),Object.defineProperty(this,qs,{value:ra}),Object.defineProperty(this,Ds,{value:na}),Object.defineProperty(this,Bs,{value:ta}),Object.defineProperty(this,zs,{value:ea}),Object.defineProperty(this,Ls,{value:Zs}),Object.defineProperty(this,Us,{value:Qs}),Object.defineProperty(this,Ms,{value:Xs}),Object.defineProperty(this,Is,{value:Js}),Object.defineProperty(this,js,{value:Gs}),Object.defineProperty(this,Os,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,Cs,{writable:!0,value:void 0}),Object.defineProperty(this,xs,{writable:!0,value:void 0}),Object.defineProperty(this,Rs,{writable:!0,value:ri()}),Object.defineProperty(this,As,{writable:!0,value:new Set}),Object.defineProperty(this,Ns,{writable:!0,value:new Set}),Object.defineProperty(this,Fs,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,this.calculateProgress=$i((e,t)=>{const n=this.getFile(null==e?void 0:e.id);if(null==e||!n)return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);if(100===n.progress.percentage)return void this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);const r=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...n.progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:r?Math.round(t.bytesUploaded/t.bytesTotal*100):0}}),this.calculateTotalProgress()},500,{leading:!0,trailing:!0}),Object.defineProperty(this,$s,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,Ws,{writable:!0,value:new Map}),this.defaultLocale=ws;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:gs,meta:{},onBeforeFileAdded:(e,t)=>!Object.hasOwn(t,e.id),onBeforeUpload:e=>e,store:new Ki,logger:os,infoTimeout:5e3},n={...t,...e};this.opts={...n,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=is),this.log(`Using Core v${Ks.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Ts,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:ts(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Es(this,Cs)[Cs]=new vs(()=>this.opts,()=>this.i18n),Es(this,xs)[xs]=this.store.subscribe((e,t,n)=>{this.emit("state-update",e,t,n),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),Es(this,Ds)[Ds]()}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Es(this,Rs)[Rs].emit(e,...n)}on(e,t){return Es(this,Rs)[Rs].on(e,t),this}once(e,t){return Es(this,Rs)[Rs].once(e,t),this}off(e,t){return Es(this,Rs)[Rs].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[n,r]=e;return[n,{...t[n],...r}]}))}})}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 ti([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},n={};Object.keys(t).forEach(r=>{n[r]={...t[r],progress:{...t[r].progress,...e}}}),this.setState({files:n,...Ts}),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({...Ts,files:{}})}addPreProcessor(e){Es(this,As)[As].add(e)}removePreProcessor(e){return Es(this,As)[As].delete(e)}addPostProcessor(e){Es(this,Fs)[Fs].add(e)}removePostProcessor(e){return Es(this,Fs)[Fs].delete(e)}addUploader(e){Es(this,Ns)[Ns].add(e)}removeUploader(e){return Es(this,Ns)[Ns].delete(e)}setMeta(e){const t={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(t=>{n[t]={...n[t],meta:{...n[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:n})}setFileMeta(e,t){const n={...this.getState().files};if(!n[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const r={...n[e].meta,...t};n[e]={...n[e],meta:r},this.setState({files:n})}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:n}=this.getState(),r=Object.values(e),o=[],i=[],s=[],a=[],l=[],c=[],u=[],d=[],h=[];for(const e of r){const{progress:t}=e;!t.uploadComplete&&t.uploadStarted&&(o.push(e),e.isPaused||d.push(e)),t.uploadStarted||i.push(e),(t.uploadStarted||t.preprocess||t.postprocess)&&s.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)&&h.push(e)}return{newFiles:i,startedFiles:s,uploadStartedFiles:a,pausedFiles:l,completeFiles:c,erroredFiles:u,inProgressFiles:o,inProgressNotPausedFiles:d,processingFiles:h,isUploadStarted:a.length>0,isAllComplete:100===t&&c.length===r.length&&0===h.length,isAllErrored:!!n&&u.length===r.length,isAllPaused:0!==o.length&&l.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:r.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{Es(this,Cs)[Cs].validate(t,[e])}catch(e){return e}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){Es(this,Us)[Us](e);const{nextFilesState:t,validFilesToAdd:n,errors:r}=Es(this,Bs)[Bs]([e]),o=r.filter(e=>e.isRestriction);if(Es(this,js)[js](o),r.length>0)throw r[0];this.setState({files:t});const[i]=n;return this.emit("file-added",i),this.emit("files-added",n),this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`),Es(this,zs)[zs](),i.id}addFiles(e){Es(this,Us)[Us]();const{nextFilesState:t,validFilesToAdd:n,errors:r}=Es(this,Bs)[Bs](e),o=r.filter(e=>e.isRestriction);Es(this,js)[js](o);const i=r.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}),n.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",n),n.length>5?this.log(`Added batch of ${n.length} files`):Object.values(n).forEach(e=>{this.log(`Added file: ${e.name}\n id: ${e.id}\n type: ${e.type}`)}),n.length>0&&Es(this,zs)[zs]()}removeFiles(e,t){const{files:n,currentUploads:r}=this.getState(),o={...n},i={...r},s=Object.create(null);function a(e){return void 0===s[e]}e.forEach(e=>{n[e]&&(s[e]=n[e],delete o[e])}),Object.keys(i).forEach(e=>{const t=r[e].fileIDs.filter(a);if(0===t.length)return void delete i[e];const{capabilities:n}=this.getState();if(t.length!==r[e].fileIDs.length&&!n.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");i[e]={...r[e],fileIDs:t}});const l={currentUploads:i,files:o};0===Object.keys(o).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const c=Object.keys(s);c.forEach(e=>{this.emit("file-removed",s[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 n={...e[t],isPaused:!0};e[t]=n}),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 n={...e[t],isPaused:!1,error:null};e[t]=n}),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 n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const n=Es(this,qs)[qs](t,{forceAllowNewUpload:!0});return Es(this,Ys)[Ys](n)}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(Ts)}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=Es(this,qs)[qs]([e],{forceAllowNewUpload:!0});return Es(this,Ys)[Ys](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),n=e.filter(e=>null==e.progress.bytesTotal);if(0===t.length){const t=100*e.length,r=n.reduce((e,t)=>e+t.progress.percentage,0),o=Math.round(r/t*100);return void this.setState({totalProgress:o})}let r=t.reduce((e,t)=>{var n;return e+(null!=(n=t.progress.bytesTotal)?n:0)},0);const o=r/t.length;r+=o*n.length;let i=0;t.forEach(e=>{i+=e.progress.bytesUploaded}),n.forEach(e=>{i+=o*(e.progress.percentage||0)/100});let s=0===r?0:Math.round(i/r*100);s>100&&(s=100),this.setState({totalProgress:s}),this.emit("progress",s)}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 n=new e(this,t),r=n.id;if(!r)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");const o=this.getPlugin(r);if(o){const e=`Already found a plugin named '${o.id}'. Tried to use: '${r}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${r} v${e.VERSION}`),n.type in Es(this,Os)[Os]?Es(this,Os)[Os][n.type].push(n):Es(this,Os)[Os][n.type]=[n],n.install(),this.emit("plugin-added",n),this}getPlugin(e){for(const t of Object.values(Es(this,Os)[Os])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[bs](e){return Es(this,Os)[Os][e]}iteratePlugins(e){Object.values(Es(this,Os)[Os]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=Es(this,Os)[Os][e.type],n=t.findIndex(t=>t.id===e.id);-1!==n&&t.splice(n,1);const r={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(r)}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}),Es(this,xs)[xs](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",Es(this,$s)[$s]),window.removeEventListener("offline",Es(this,$s)[$s]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,n){void 0===t&&(t="info"),void 0===n&&(n=3e3);const r="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:r?e.message:e,details:r?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,t){const{logger:n}=this.opts;switch(t){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e)}}registerRequestClient(e,t){Es(this,Ws)[Ws].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=Es(this,Ws)[Ws].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]?Es(this,Ys)[Ys](e):(Es(this,Vs)[Vs](e),Promise.reject(new Error("Nonexistent upload")))}[Ss](){return Es(this,qs)[qs](...arguments)}addResultData(e,t){if(!Es(this,Hs)[Hs](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:n}=this.getState(),r={...n[e],result:{...n[e].result,...t}};this.setState({currentUploads:{...n,[e]:r}})}upload(){var e;null!=(e=Es(this,Os)[Os].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const n=this.opts.onBeforeUpload(t);return!1===n?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(n&&"object"==typeof n&&(t=n,this.setState({files:t})),Promise.resolve().then(()=>Es(this,Cs)[Cs].validateMinNumberOfFiles(t)).catch(e=>{throw Es(this,js)[js]([e]),e}).then(()=>{if(!Es(this,Ms)[Ms](t))throw new ys(this.i18n("missingRequiredMetaField"))}).catch(e=>{throw e}).then(()=>{const{currentUploads:e}=this.getState(),n=Object.values(e).flatMap(e=>e.fileIDs),r=[];Object.keys(t).forEach(e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==n.indexOf(e)||r.push(t.id)});const o=Es(this,qs)[qs](r);return Es(this,Ys)[Ys](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function Gs(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),n=t.slice(0,4),r=t.slice(4);n.forEach(e=>{let{message:t,details:n=""}=e;this.info({message:t,details:n},"error",this.opts.infoTimeout)}),r.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:r.length})})}function Js(e){const{missingFields:t,error:n}=Es(this,Cs)[Cs].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(n.message),this.emit("restriction-failed",e,n),!1)}function Xs(e){let t=!0;for(const n of Object.values(e))Es(this,Is)[Is](n)||(t=!1);return t}function Qs(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new ys(this.i18n("noMoreFilesAllowed"),{file:e});throw Es(this,js)[js]([t]),t}}function Zs(e){const t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,n=Qi(t),r=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}(n,t),o=Ji(r).extension,i=es(t,this.getID()),s=t.meta||{};s.name=r,s.type=n;const a=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:i,name:r,extension:o||"",meta:{...this.getState().meta,...s},type:n,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 ea(){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 ta(e){const{files:t}=this.getState(),n={...t},r=[],o=[];for(const s of e)try{var i;let e=Es(this,Ls)[Ls](s);const o=null==(i=t[e.id])?void 0:i.isGhost;if(o){e={...t[e.id],isGhost:!1,data:s.data},this.log(`Replaced the blob in the restored ghost file: ${e.name}, ${e.id}`)}const a=this.opts.onBeforeFileAdded(e,n);if(!a&&this.checkIfFileAlreadyExists(e.id))throw new ys(this.i18n("noDuplicates",{fileName:e.name}),{file:s});if(!1===a&&!o)throw new ys("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:s});"object"==typeof a&&null!==a&&(e=a),Es(this,Cs)[Cs].validateSingleFile(e),n[e.id]=e,r.push(e)}catch(e){o.push(e)}try{Es(this,Cs)[Cs].validateAggregateRestrictions(Object.values(t),r)}catch(e){return o.push(e),{nextFilesState:t,validFilesToAdd:[],errors:o}}return{nextFilesState:n,validFilesToAdd:r,errors:o}}function na(){const e=(e,t,n)=>{let r=e.message||"Unknown error";e.details&&(r+=` ${e.details}`),this.setState({error:r}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:r,response:n})};this.on("error",e),this.on("upload-error",(t,n,r)=>{if(e(n,t,r),"object"==typeof n&&n.message){var o;this.log(n.message,"error");const e=new Error(this.i18n("failedToUpload",{file:null!=(o=null==t?void 0:t.name)?o:""}));e.isUserFacing=!0,e.details=n.message,n.details&&(e.details+=` ${n.details}`),Es(this,js)[js]([e])}else Es(this,js)[js]([n])});let t=null;this.on("upload-stalled",(e,n)=>{const{message:r}=e,o=n.map(e=>e.meta.name).join(", ");t||(this.info({message:r,details:o},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${r} ${o}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const n=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}),n=Object.fromEntries(t.map(e=>[e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}]));this.patchFilesState(n)};this.on("upload-start",e=>{e.forEach(e=>{this.emit("upload-started",e)}),n(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 n=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...n,postprocess:Es(this,Fs)[Fs].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:n.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||n.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&&Es(this,Is)[Is](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",Es(this,$s)[$s]),window.addEventListener("offline",Es(this,$s)[$s]),setTimeout(Es(this,$s)[$s],3e3))}function ra(e,t){void 0===t&&(t={});const{forceAllowNewUpload:n=!1}=t,{allowNewUpload:r,currentUploads:o}=this.getState();if(!r&&!n)throw new Error("Cannot create a new upload: already uploading.");const i=((e=21)=>{let t="",n=e;for(;n--;)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:{...o,[i]:{fileIDs:e,step:0,result:{}}}}),i}function oa(e){const{currentUploads:t}=this.getState();return t[e]}function ia(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function sa(e){const t=()=>{const{currentUploads:t}=this.getState();return t[e]};let n=t();const r=[...Es(this,As)[As],...Es(this,Ns)[Ns],...Es(this,Fs)[Fs]];try{for(let o=n.step||0;o<r.length&&n;o++){const i=r[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...n,step:o}}});const{fileIDs:s}=n;await i(s,e),n=t()}}catch(t){throw Es(this,Vs)[Vs](e),t}if(n){n.fileIDs.forEach(e=>{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)});const r=n.fileIDs.map(e=>this.getFile(e)),o=r.filter(e=>!e.error),i=r.filter(e=>e.error);this.addResultData(e,{successful:o,failed:i,uploadID:e}),n=t()}let o;return n&&(o=n.result,this.emit("complete",o),Es(this,Vs)[Vs](e)),null==o&&this.log(`Not setting result for an upload that has been removed: ${e}`),o}Ks.VERSION="3.13.1";class aa{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 ti([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 la extends Error{constructor(){super(...arguments),this.name="UserFacingApiError"}}var ca,ua,da,ha,pa,_a={};function fa(){return da||(da=1,e=_a,t=function(){if(ua)return ca;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 ua=1,ca=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 n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),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 n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._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,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,s=(e[i]||0)+1;e[i]=s,s>=n&&(t=o,n=s)}return t},ca}(),e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.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 n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout)},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var o in r=[],t)"function"==typeof t[o]&&r.push(o);for(var i=0;i<r.length;i++){var s=r[i],a=t[s];t[s]=function(r){var o=e.operation(n),i=Array.prototype.slice.call(arguments,1),s=i.pop();i.push(function(e){o.retry(e)||(e&&(arguments[0]=o.mainError()),s.apply(this,arguments))}),o.attempt(function(){r.apply(t,i)})}.bind(t,a),t[s].options=n}}),_a;var e,t}var ma=fe(pa?ha:(pa=1,ha=fa()));const ga=Object.prototype.toString,ya=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 va(e){const t=e&&(e=>"[object Error]"===ga.call(e))(e)&&"TypeError"===e.name&&"string"==typeof e.message;if(!t)return!1;const{message:n,stack:r}=e;return"Load failed"===n?void 0===r||"__sentry_captured__"in e:!!n.startsWith("error sending request for url")||ya.has(n)}class wa 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 ba=(e,t,n)=>{const r=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=r,e};async function Sa(e,t){return new Promise((n,r)=>{t={...t},t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.retries??=10;const o=ma.operation(t),i=()=>{o.stop(),r(t.signal?.reason)};t.signal&&!t.signal.aborted&&t.signal.addEventListener("abort",i,{once:!0});const s=()=>{t.signal?.removeEventListener("abort",i),o.stop()};o.attempt(async i=>{try{const t=await e(i);s(),n(t)}catch(e){try{if(!(e instanceof Error))throw new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(e instanceof wa)throw e.originalError;if(e instanceof TypeError&&!va(e))throw e;if(ba(e,i,t),await t.shouldRetry(e)||(o.stop(),r(e)),await t.onFailedAttempt(e),!o.retry(e))throw o.mainError()}catch(e){ba(e,i,t),s(),r(e)}}})})}class Ea 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 ka(e,t){return Object.prototype.hasOwnProperty.call(e,t)}class Pa extends Error{constructor(e,t){super(e),this.cause=null==t?void 0:t.cause,this.cause&&ka(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}var Ta=$i(function(e,t,n){const{progress:r,bytesUploaded:o,bytesTotal:i}=t;r&&(e.uppy.log(`Upload progress: ${r}`),e.uppy.emit("upload-progress",n,{uploader:e,bytesUploaded:o,bytesTotal:i}))},300,{leading:!0,trailing:!0});class Oa extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}let Ca;function xa(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ra=0;function Aa(e){return"__private_"+Ra+++"_"+e}class Na extends Error{constructor(e){let{statusCode:t,message:n}=e;super(n),this.name="HttpError",this.statusCode=t}}var Fa=Aa("companionHeaders"),ja=Aa("getUrl"),Ia=Aa("requestSocketToken"),Ma=Aa("awaitRemoteFileUpload");Ca=Symbol.for("uppy test: getCompanionHeaders");class Ua{constructor(e,t){Object.defineProperty(this,Ma,{value:za}),Object.defineProperty(this,ja,{value:La}),Object.defineProperty(this,Fa,{writable:!0,value:void 0}),Object.defineProperty(this,Ia,{writable:!0,value:async e=>{var t;let{file:n,postBody:r,signal:o}=e;if(null==(null==(t=n.remote)?void 0:t.url))throw new Error("Cannot connect to an undefined URL");return(await this.post(n.remote.url,{...n.remote.body,...r},{signal:o})).token}}),this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),xa(this,Fa)[Fa]=null==t?void 0:t.companionHeaders}setCompanionHeaders(e){xa(this,Fa)[Fa]=e}[Ca](){return xa(this,Fa)[Fa]}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"}},...xa(this,Fa)[Fa]}}onReceiveResponse(e){const{headers:t}=e,n=this.uppy.getState().companion||{},r=this.opts.companionUrl;t.has("i-am")&&t.get("i-am")!==n[r]&&this.uppy.setState({companion:{...n,[r]:t.get("i-am")}})}async request(e){let{path:t,method:n="GET",data:r,skipPostResponse:o,signal:i}=e;try{const e=await this.headers(!r),s=await function(){return fetch(...arguments).catch(e=>{throw"AbortError"===e.name?e:new Ea(e)})}(xa(this,ja)[ja](t),{method:n,signal:i,headers:e,credentials:this.opts.companionCookiesRule||"same-origin",body:r?JSON.stringify(r):null});return o||this.onReceiveResponse(s),await async function(e){if(401===e.status)throw new Oa;if(e.ok)return e.json();let t,n=`Failed request with status: ${e.status}. ${e.statusText}`;try{t=await e.json(),t.message&&(n=`${n} message: ${t.message}`),t.requestId&&(n=`${n} request-Id: ${t.requestId}`)}catch(e){throw new Error(n,{cause:e})}if(e.status>=400&&e.status<=499&&t.message)throw new la(t.message);throw new Na({statusCode:e.status,message:n})}(s)}catch(e){if(e.isAuthError||"UserFacingApiError"===e.name||"AbortError"===e.name)throw e;throw new Pa(`Could not ${n} ${xa(this,ja)[ja](t)}`,{cause:e})}}async get(e,t){return"boolean"==typeof t&&(t={skipPostResponse:t}),this.request({...t,path:e})}async post(e,t,n){return"boolean"==typeof n&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"POST",data:t})}async delete(e,t,n){return"boolean"==typeof n&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"DELETE",data:t})}async uploadRemoteFile(e,t,n){var r=this;try{const{signal:o,getQueue:i}=n||{};return await Sa(async()=>{var n;const s=null==(n=this.uppy.getFile(e.id))?void 0:n.serverToken;if(null!=s)return this.uppy.log(`Connecting to exiting websocket ${s}`),xa(this,Ma)[Ma]({file:e,queue:i(),signal:o});const a=i().wrapPromiseFunction(async function(){try{return await xa(r,Ia)[Ia](...arguments)}catch(e){if(e.isAuthError)throw new wa(e);if(null==e.cause)throw e;const t=e.cause,n=()=>[408,409,429,418,423].includes(t.statusCode)||t.statusCode>=500&&t.statusCode<=599&&![501,505].includes(t.statusCode);if("HttpError"===t.name&&!n())throw new wa(t);throw t}},{priority:-1}),l=await a({file:e,postBody:t,signal:o}).abortOn(o);return this.uppy.getFile(e.id)?(this.uppy.setFileState(e.id,{serverToken:l}),xa(this,Ma)[Ma]({file:this.uppy.getFile(e.id),queue:i(),signal:o})):void 0},{retries:10,signal:o,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 La(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}async function za(e){let t,{file:n,queue:r,signal:o}=e;const{capabilities:i}=this.uppy.getState();try{return await new Promise((e,s)=>{const a=n.serverToken,l=function(e){var t;const n=null==(t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e))?void 0:t[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${n}`}(n.remote.companionUrl);let c,u,d,{isPaused:h}=n;const p=(e,t)=>{var r;null!=c&&c.readyState===c.OPEN?c.send(JSON.stringify({action:e,payload:null!=t?t:{}})):this.uppy.log(`Cannot send "${e}" to socket ${n.id} because the socket state was ${String(null==(r=c)?void 0:r.readyState)}`,"warning")};function _(){i.resumableUploads&&p(h?"pause":"resume")}const f=async()=>{u&&u.abort(),u=new AbortController;const t=e=>{var t;this.uppy.setFileState(n.id,{serverToken:null}),null==(t=u)||null==t.abort||t.abort(),s(e)};function o(){clearTimeout(d),h||(d=setTimeout(()=>t(new Error("Timeout waiting for message from Companion socket")),3e5))}try{await r.wrapPromiseFunction(async()=>{await Sa(async()=>new Promise((r,i)=>{c=new WebSocket(`${l}/api/${a}`),o(),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",()=>{_()}),c.addEventListener("message",r=>{o();try{const{action:t,payload:o}=JSON.parse(r.data);switch(t){case"progress":Ta(this,o,this.uppy.getFile(n.id));break;case"success":{var i,s,a,l;const t=null==(i=o.response)?void 0:i.responseText;this.uppy.emit("upload-success",this.uppy.getFile(n.id),{uploadURL:o.url,status:null!=(s=null==(a=o.response)?void 0:a.status)?s:200,body:t?JSON.parse(t):void 0}),null==(l=u)||null==l.abort||l.abort(),e();break}case"error":{const{message:e}=o.error;throw Object.assign(new Error(e),{cause:o.error})}default:this.uppy.log(`Companion socket unknown action ${t}`,"warning")}}catch(e){t(e)}});const s=()=>{this.uppy.log(`Closing socket ${n.id}`,"info"),clearTimeout(d),c&&c.close(),c=void 0};u.signal.addEventListener("abort",()=>{s()})}),{retries:10,signal:u.signal,onFailedAttempt:()=>{u.signal.aborted||this.uppy.log(`Retrying websocket ${n.id}`,"info")}})})().abortOn(u.signal)}catch(e){if(u.signal.aborted)return;t(e)}},m=e=>{var t;i.resumableUploads&&(h=e,c&&_(),e?null==(t=u)||null==t.abort||t.abort():f())},g=t=>{var r;i.individualCancellation&&t.id===n.id&&(p("cancel"),null==(r=u)||null==r.abort||r.abort(),this.uppy.log(`upload ${n.id} was removed`,"info"),e())},y=t=>{var r;let{reason:o}=t;"user"===o&&p("cancel"),null==(r=u)||null==r.abort||r.abort(),this.uppy.log(`upload ${n.id} was canceled`,"info"),e()},v=(e,t)=>{e===n.id&&m(t)},w=()=>m(!0),b=()=>m(!1);this.uppy.on("file-removed",g),this.uppy.on("cancel-all",y),this.uppy.on("upload-pause",v),this.uppy.on("pause-all",w),this.uppy.on("resume-all",b),t=()=>{this.uppy.off("file-removed",g),this.uppy.off("cancel-all",y),this.uppy.off("upload-pause",v),this.uppy.off("pause-all",w),this.uppy.off("resume-all",b)},o.addEventListener("abort",()=>{var e;null==(e=u)||e.abort()}),f()})}finally{null==t||t()}}function Ba(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Ua.VERSION="3.8.2";var Da=0;function $a(e){return"__private_"+Da+++"_"+e}var Wa=$a("uppy"),qa=$a("events");class Ha{constructor(e){Object.defineProperty(this,Wa,{writable:!0,value:void 0}),Object.defineProperty(this,qa,{writable:!0,value:[]}),Ba(this,Wa)[Wa]=e}on(e,t){return Ba(this,qa)[qa].push([e,t]),Ba(this,Wa)[Wa].on(e,t)}remove(){for(const[e,t]of Ba(this,qa)[qa].splice(0))Ba(this,Wa)[Wa].off(e,t)}onFilePause(e,t){this.on("upload-pause",(n,r)=>{e===n&&t(r)})}onFileRemove(e,t){this.on("file-removed",n=>{e===n.id&&t(n.id)})}onPause(e,t){this.on("upload-pause",(n,r)=>{e===n&&t(r)})}onRetry(e,t){this.on("upload-retry",n=>{e===n&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{Ba(this,Wa)[Wa].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{Ba(this,Wa)[Wa].getFile(e)&&t()})}onCancelAll(e,t){var n=this;this.on("cancel-all",function(){Ba(n,Wa)[Wa].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{Ba(this,Wa)[Wa].getFile(e)&&t()})}}function Va(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ya=0;function Ka(e){return"__private_"+Ya+++"_"+e}function Ga(e){if(null!=e){var t;const n=()=>this.abort(e.reason);e.addEventListener("abort",n,{once:!0});const r=()=>{e.removeEventListener("abort",n)};null==(t=this.then)||t.call(this,r,r)}return this}var Ja=Ka("activeRequests"),Xa=Ka("queuedHandlers"),Qa=Ka("paused"),Za=Ka("pauseTimer"),el=Ka("downLimit"),tl=Ka("upperLimit"),nl=Ka("rateLimitingTimer"),rl=Ka("call"),ol=Ka("queueNext"),il=Ka("next"),sl=Ka("queue"),al=Ka("dequeue"),ll=Ka("resume"),cl=Ka("increaseLimit");class ul{constructor(e){Object.defineProperty(this,al,{value:fl}),Object.defineProperty(this,sl,{value:_l}),Object.defineProperty(this,il,{value:pl}),Object.defineProperty(this,ol,{value:hl}),Object.defineProperty(this,rl,{value:dl}),Object.defineProperty(this,Ja,{writable:!0,value:0}),Object.defineProperty(this,Xa,{writable:!0,value:[]}),Object.defineProperty(this,Qa,{writable:!0,value:!1}),Object.defineProperty(this,Za,{writable:!0,value:void 0}),Object.defineProperty(this,el,{writable:!0,value:1}),Object.defineProperty(this,tl,{writable:!0,value:void 0}),Object.defineProperty(this,nl,{writable:!0,value:void 0}),Object.defineProperty(this,ll,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,cl,{writable:!0,value:()=>{if(Va(this,Qa)[Qa])Va(this,nl)[nl]=setTimeout(Va(this,cl)[cl],0);else{Va(this,el)[el]=this.limit,this.limit=Math.ceil((Va(this,tl)[tl]+Va(this,el)[el])/2);for(let e=Va(this,el)[el];e<=this.limit;e++)Va(this,ol)[ol]();Va(this,tl)[tl]-Va(this,el)[el]>3?Va(this,nl)[nl]=setTimeout(Va(this,cl)[cl],2e3):Va(this,el)[el]=Math.floor(Va(this,el)[el]/2)}}}),this.limit="number"!=typeof e||0===e?1/0:e}run(e,t){return!Va(this,Qa)[Qa]&&Va(this,Ja)[Ja]<this.limit?Va(this,rl)[rl](e):Va(this,sl)[sl](e,t)}wrapSyncFunction(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];const s=n.run(()=>(e(...o),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Ga,abort(){s.abort()}}}}wrapPromiseFunction(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];let s;const a=new Promise((r,i)=>{s=n.run(()=>{let t,n;try{n=Promise.resolve(e(...o))}catch(e){n=Promise.reject(e)}return n.then(e=>{t?i(t):(s.done(),r(e))},e=>{t?i(t):(s.done(),i(e))}),e=>{t=function(e){return new Error("Cancelled",{cause:e})}(e)}},t)});return a.abort=e=>{s.abort(e)},a.abortOn=Ga,a}}resume(){Va(this,Qa)[Qa]=!1,clearTimeout(Va(this,Za)[Za]);for(let e=0;e<this.limit;e++)Va(this,ol)[ol]()}pause(e){void 0===e&&(e=null),Va(this,Qa)[Qa]=!0,clearTimeout(Va(this,Za)[Za]),null!=e&&(Va(this,Za)[Za]=setTimeout(Va(this,ll)[ll],e))}rateLimit(e){clearTimeout(Va(this,nl)[nl]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(Va(this,tl)[tl]=this.limit-1,this.limit=Va(this,el)[el],Va(this,nl)[nl]=setTimeout(Va(this,cl)[cl],e))}get isPaused(){return Va(this,Qa)[Qa]}}function dl(e){Va(this,Ja)[Ja]+=1;let t,n=!1;try{t=e()}catch(e){throw Va(this,Ja)[Ja]-=1,e}return{abort:e=>{n||(n=!0,Va(this,Ja)[Ja]-=1,null==t||t(e),Va(this,ol)[ol]())},done:()=>{n||(n=!0,Va(this,Ja)[Ja]-=1,Va(this,ol)[ol]())}}}function hl(){queueMicrotask(()=>Va(this,il)[il]())}function pl(){if(Va(this,Qa)[Qa]||Va(this,Ja)[Ja]>=this.limit)return;if(0===Va(this,Xa)[Xa].length)return;const e=Va(this,Xa)[Xa].shift();if(null==e)throw new Error("Invariant violation: next is null");const t=Va(this,rl)[rl](e.fn);e.abort=t.abort,e.done=t.done}function _l(e,t){const n={fn:e,priority:(null==t?void 0:t.priority)||0,abort:()=>{Va(this,al)[al](n)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},r=Va(this,Xa)[Xa].findIndex(e=>n.priority>e.priority);return-1===r?Va(this,Xa)[Xa].push(n):Va(this,Xa)[Xa].splice(r,0,n),n}function fl(e){const t=Va(this,Xa)[Xa].indexOf(e);-1!==t&&Va(this,Xa)[Xa].splice(t,1)}const{AbortController:ml}=globalThis,gl=function(e,t){void 0===e&&(e="Aborted");const n=new DOMException(e,"AbortError");return null!=t&&ka(t,"cause")&&Object.defineProperty(n,"cause",{__proto__:null,configurable:!0,writable:!0,value:t.cause}),n};function yl(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var vl=0;function wl(e){return"__private_"+vl+++"_"+e}const bl={getChunkSize:e=>Math.ceil(e.size/1e4),onProgress(){},onPartComplete(){},onSuccess(){},onError(e){throw e}};const Sl=Symbol("pausing upload, not an actual error");var El=wl("abortController"),kl=wl("chunks"),Pl=wl("chunkState"),Tl=wl("data"),Ol=wl("file"),Cl=wl("uploadHasStarted"),xl=wl("onError"),Rl=wl("onSuccess"),Al=wl("shouldUseMultipart"),Nl=wl("isRestoring"),Fl=wl("onReject"),jl=wl("maxMultipartParts"),Il=wl("minPartSize"),Ml=wl("initChunks"),Ul=wl("createUpload"),Ll=wl("resumeUpload"),zl=wl("onPartProgress"),Bl=wl("onPartComplete"),Dl=wl("abortUpload");class $l{constructor(e,t){var n;Object.defineProperty(this,Dl,{value:Vl}),Object.defineProperty(this,Ll,{value:Hl}),Object.defineProperty(this,Ul,{value:ql}),Object.defineProperty(this,Ml,{value:Wl}),Object.defineProperty(this,El,{writable:!0,value:new ml}),Object.defineProperty(this,kl,{writable:!0,value:void 0}),Object.defineProperty(this,Pl,{writable:!0,value:void 0}),Object.defineProperty(this,Tl,{writable:!0,value:void 0}),Object.defineProperty(this,Ol,{writable:!0,value:void 0}),Object.defineProperty(this,Cl,{writable:!0,value:!1}),Object.defineProperty(this,xl,{writable:!0,value:void 0}),Object.defineProperty(this,Rl,{writable:!0,value:void 0}),Object.defineProperty(this,Al,{writable:!0,value:void 0}),Object.defineProperty(this,Nl,{writable:!0,value:void 0}),Object.defineProperty(this,Fl,{writable:!0,value:e=>(null==e?void 0:e.cause)===Sl?null:yl(this,xl)[xl](e)}),Object.defineProperty(this,jl,{writable:!0,value:1e4}),Object.defineProperty(this,Il,{writable:!0,value:5242880}),Object.defineProperty(this,zl,{writable:!0,value:e=>t=>{if(!t.lengthComputable)return;yl(this,Pl)[Pl][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 n=yl(this,Pl)[Pl].reduce((e,t)=>e+t.uploaded,0);this.options.onProgress(n,yl(this,Tl)[Tl].size)}}),Object.defineProperty(this,Bl,{writable:!0,value:e=>t=>{yl(this,kl)[kl][e]=null,yl(this,Pl)[Pl][e].etag=t,yl(this,Pl)[Pl][e].done=!0;const n={PartNumber:e+1,ETag:t};this.options.onPartComplete(n)}}),this.options={...bl,...t},null!=(n=this.options).getChunkSize||(n.getChunkSize=bl.getChunkSize),yl(this,Tl)[Tl]=e,yl(this,Ol)[Ol]=t.file,yl(this,Rl)[Rl]=this.options.onSuccess,yl(this,xl)[xl]=this.options.onError,yl(this,Al)[Al]=this.options.shouldUseMultipart,yl(this,Nl)[Nl]=t.uploadId&&t.key,yl(this,Ml)[Ml]()}start(){yl(this,Cl)[Cl]?(yl(this,El)[El].signal.aborted||yl(this,El)[El].abort(Sl),yl(this,El)[El]=new ml,yl(this,Ll)[Ll]()):yl(this,Nl)[Nl]?(this.options.companionComm.restoreUploadFile(yl(this,Ol)[Ol],{uploadId:this.options.uploadId,key:this.options.key}),yl(this,Ll)[Ll]()):yl(this,Ul)[Ul]()}pause(){yl(this,El)[El].abort(Sl),yl(this,El)[El]=new ml}abort(e){null!=e&&e.really?yl(this,Dl)[Dl]():this.pause()}get chunkState(){return yl(this,Pl)[Pl]}}function Wl(){const e=yl(this,Tl)[Tl].size,t="function"==typeof yl(this,Al)[Al]?yl(this,Al)[Al](yl(this,Ol)[Ol]):Boolean(yl(this,Al)[Al]);if(t&&e>yl(this,Il)[Il]){let n=Math.max(this.options.getChunkSize(yl(this,Tl)[Tl]),yl(this,Il)[Il]),r=Math.floor(e/n);r>yl(this,jl)[jl]&&(r=yl(this,jl)[jl],n=e/yl(this,jl)[jl]),yl(this,kl)[kl]=Array(r);for(let r=0,o=0;r<e;r+=n,o++){const i=Math.min(e,r+n),s=()=>{const e=r;return yl(this,Tl)[Tl].slice(e,i)};if(yl(this,kl)[kl][o]={getData:s,onProgress:yl(this,zl)[zl](o),onComplete:yl(this,Bl)[Bl](o),shouldUseMultipart:t},yl(this,Nl)[Nl]){const t=r+n>e?e-r:n;yl(this,kl)[kl][o].setAsUploaded=()=>{yl(this,kl)[kl][o]=null,yl(this,Pl)[Pl][o].uploaded=t}}}}else yl(this,kl)[kl]=[{getData:()=>yl(this,Tl)[Tl],onProgress:yl(this,zl)[zl](0),onComplete:yl(this,Bl)[Bl](0),shouldUseMultipart:t}];yl(this,Pl)[Pl]=yl(this,kl)[kl].map(()=>({uploaded:0}))}function ql(){this.options.companionComm.uploadFile(yl(this,Ol)[Ol],yl(this,kl)[kl],yl(this,El)[El].signal).then(yl(this,Rl)[Rl],yl(this,Fl)[Fl]),yl(this,Cl)[Cl]=!0}function Hl(){this.options.companionComm.resumeUploadFile(yl(this,Ol)[Ol],yl(this,kl)[kl],yl(this,El)[El].signal).then(yl(this,Rl)[Rl],yl(this,Fl)[Fl])}function Vl(){yl(this,El)[El].abort(),this.options.companionComm.abortFileUpload(yl(this,Ol)[Ol]).catch(e=>this.options.log(e))}function Yl(e){if(null!=e&&e.aborted)throw gl("The operation was aborted",{cause:e.reason})}const Kl=new TextEncoder,Gl={name:"HMAC",hash:"SHA-256"};function Jl(e){const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=t[e].toString(16).padStart(2,"0");return n}async function Xl(e,t){const{subtle:n}=globalThis.crypto;return n.sign(Gl,await async function(e){const{subtle:t}=globalThis.crypto;return t.importKey("raw","string"==typeof e?Kl.encode(e):e,Gl,!1,["sign"])}(e),Kl.encode(t))}async function Ql(e){let{accountKey:t,accountSecret:n,sessionToken:r,bucketName:o,Key:i,Region:s,expires:a,uploadId:l,partNumber:c}=e;const u="s3",d=`${o}.${u}.${s}.amazonaws.com`,h=`/${encodeURI(i).replace(/[;?:@&=+$,#!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}`,p="UNSIGNED-PAYLOAD",_=(new Date).toISOString().replace(/[-:]|\.\d+/g,""),f=_.slice(0,8),m=`${f}/${s}/${u}/aws4_request`,g=new URL(`https://${d}${h}`);g.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),g.searchParams.set("X-Amz-Content-Sha256",p),g.searchParams.set("X-Amz-Credential",`${t}/${m}`),g.searchParams.set("X-Amz-Date",_),g.searchParams.set("X-Amz-Expires",a),g.searchParams.set("X-Amz-Security-Token",r),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 y=function(e){let{method:t="PUT",CanonicalUri:n="/",CanonicalQueryString:r="",SignedHeaders:o,HashedPayload:i}=e;const s=Object.keys(o).map(e=>e.toLowerCase()).sort();return[t,n,r,...s.map(e=>`${e}:${o[e]}`),"",s.join(";"),i].join("\n")}({CanonicalUri:h,CanonicalQueryString:g.search.slice(1),SignedHeaders:{host:d},HashedPayload:p}),v=["AWS4-HMAC-SHA256",_,m,Jl(await async function(e){const{subtle:t}=globalThis.crypto;return t.digest(Gl.hash,Kl.encode(e))}(y))].join("\n"),w=await Xl(`AWS4${n}`,f),b=await Xl(w,s),S=await Xl(b,u),E=await Xl(S,"aws4_request"),k=Jl(await Xl(E,v));return g.searchParams.set("X-Amz-Signature",k),g}function Zl(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var ec=0;function tc(e){return"__private_"+ec+++"_"+e}function nc(e){const t=new URL(e);return t.search="",t.hash="",t.href}var rc=tc("abortMultipartUpload"),oc=tc("cache"),ic=tc("createMultipartUpload"),sc=tc("fetchSignature"),ac=tc("getUploadParameters"),lc=tc("listParts"),cc=tc("previousRetryDelay"),uc=tc("requests"),dc=tc("retryDelays"),hc=tc("sendCompletionRequest"),pc=tc("setS3MultipartState"),_c=tc("uploadPartBytes"),fc=tc("getFile"),mc=tc("shouldRetry"),gc=tc("nonMultipartUpload");class yc{constructor(e,t,n,r){Object.defineProperty(this,gc,{value:wc}),Object.defineProperty(this,mc,{value:vc}),Object.defineProperty(this,rc,{writable:!0,value:void 0}),Object.defineProperty(this,oc,{writable:!0,value:new WeakMap}),Object.defineProperty(this,ic,{writable:!0,value:void 0}),Object.defineProperty(this,sc,{writable:!0,value:void 0}),Object.defineProperty(this,ac,{writable:!0,value:void 0}),Object.defineProperty(this,lc,{writable:!0,value:void 0}),Object.defineProperty(this,cc,{writable:!0,value:void 0}),Object.defineProperty(this,uc,{writable:!0,value:void 0}),Object.defineProperty(this,dc,{writable:!0,value:void 0}),Object.defineProperty(this,hc,{writable:!0,value:void 0}),Object.defineProperty(this,pc,{writable:!0,value:void 0}),Object.defineProperty(this,_c,{writable:!0,value:void 0}),Object.defineProperty(this,fc,{writable:!0,value:void 0}),Zl(this,uc)[uc]=e,Zl(this,pc)[pc]=n,Zl(this,fc)[fc]=r,this.setOptions(t)}setOptions(e){const t=Zl(this,uc)[uc];var n;("abortMultipartUpload"in e&&(Zl(this,rc)[rc]=t.wrapPromiseFunction(e.abortMultipartUpload,{priority:1})),"createMultipartUpload"in e&&(Zl(this,ic)[ic]=t.wrapPromiseFunction(e.createMultipartUpload,{priority:-1})),"signPart"in e&&(Zl(this,sc)[sc]=t.wrapPromiseFunction(e.signPart)),"listParts"in e&&(Zl(this,lc)[lc]=t.wrapPromiseFunction(e.listParts)),"completeMultipartUpload"in e&&(Zl(this,hc)[hc]=t.wrapPromiseFunction(e.completeMultipartUpload,{priority:1})),"retryDelays"in e)&&(Zl(this,dc)[dc]=null!=(n=e.retryDelays)?n:[]);"uploadPartBytes"in e&&(Zl(this,_c)[_c]=t.wrapPromiseFunction(e.uploadPartBytes,{priority:1/0})),"getUploadParameters"in e&&(Zl(this,ac)[ac]=t.wrapPromiseFunction(e.getUploadParameters))}async getUploadId(e,t){let n;for(;null!=(n=Zl(this,oc)[oc].get(e.data));)try{return await n}catch{}const r=Zl(this,ic)[ic](Zl(this,fc)[fc](e),t),o=()=>{r.abort(t.reason),Zl(this,oc)[oc].delete(e.data)};return t.addEventListener("abort",o,{once:!0}),Zl(this,oc)[oc].set(e.data,r),r.then(async n=>{t.removeEventListener("abort",o),Zl(this,pc)[pc](e,n),Zl(this,oc)[oc].set(e.data,n)},()=>{t.removeEventListener("abort",o),Zl(this,oc)[oc].delete(e.data)}),r}async abortFileUpload(e){const t=Zl(this,oc)[oc].get(e.data);if(null==t)return;let n;Zl(this,oc)[oc].delete(e.data),Zl(this,pc)[pc](e,Object.create(null));try{n=await t}catch{return}await Zl(this,rc)[rc](Zl(this,fc)[fc](e),n)}async uploadFile(e,t,n){if(Yl(n),1===t.length&&!t[0].shouldUseMultipart)return Zl(this,gc)[gc](e,t[0],n);const{uploadId:r,key:o}=await this.getUploadId(e,n);Yl(n);try{const i=await Promise.all(t.map((t,r)=>this.uploadChunk(e,r+1,t,n)));return Yl(n),await Zl(this,hc)[hc](Zl(this,fc)[fc](e),{key:o,uploadId:r,parts:i,signal:n},n).abortOn(n)}catch(t){throw(null==t?void 0:t.cause)!==Sl&&"AbortError"!==(null==t?void 0:t.name)&&this.abortFileUpload(e),t}}restoreUploadFile(e,t){Zl(this,oc)[oc].set(e.data,t)}async resumeUploadFile(e,t,n){if(Yl(n),1===t.length&&null!=t[0]&&!t[0].shouldUseMultipart)return Zl(this,gc)[gc](e,t[0],n);const{uploadId:r,key:o}=await this.getUploadId(e,n);Yl(n);const i=await Zl(this,lc)[lc](Zl(this,fc)[fc](e),{uploadId:r,key:o,signal:n},n).abortOn(n);Yl(n);const s=await Promise.all(t.map((t,r)=>{const o=r+1,s=i.find(e=>{let{PartNumber:t}=e;return t===o});return null==s?this.uploadChunk(e,o,t,n):(null==t||null==t.setAsUploaded||t.setAsUploaded(),{PartNumber:o,ETag:s.ETag})}));return Yl(n),Zl(this,hc)[hc](Zl(this,fc)[fc](e),{key:o,uploadId:r,parts:s,signal:n},n).abortOn(n)}async uploadChunk(e,t,n,r){Yl(r);const{uploadId:o,key:i}=await this.getUploadId(e,r),s=Zl(this,dc)[dc].values(),a=Zl(this,dc)[dc].values(),l=()=>{const e=s.next();return null==e||e.done?null:e.value};for(;;){Yl(r);const s=n.getData(),{onProgress:c,onComplete:u}=n;let d;try{d=await Zl(this,sc)[sc](Zl(this,fc)[fc](e),{uploadId:o,key:i,partNumber:t,body:s,signal:r}).abortOn(r)}catch(e){const t=l();if(null==t||r.aborted)throw e;await new Promise(e=>setTimeout(e,t));continue}Yl(r);try{return{PartNumber:t,...await Zl(this,_c)[_c]({signature:d,body:s,size:s.size,onProgress:c,onComplete:u,signal:r}).abortOn(r)}}catch(e){if(!await Zl(this,mc)[mc](e,a))throw e}}}}async function vc(e,t){var n;const r=Zl(this,uc)[uc],o=null==e||null==(n=e.source)?void 0:n.status;if(null==o)return!1;if(403===o&&"Request has expired"===e.message){if(!r.isPaused){if(1===r.limit||null==Zl(this,cc)[cc]){const e=t.next();if(null==e||e.done)return!1;Zl(this,cc)[cc]=e.value}r.rateLimit(0),await new Promise(e=>setTimeout(e,Zl(this,cc)[cc]))}}else if(429===o){if(!r.isPaused){const e=t.next();if(null==e||e.done)return!1;r.rateLimit(e.value)}}else{if(o>400&&o<500&&409!==o)return!1;if("undefined"!=typeof navigator&&!1===navigator.onLine)r.isPaused||(r.pause(),window.addEventListener("online",()=>{r.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 wc(e,t,n){const{method:r="POST",url:o,fields:i,headers:s}=await Zl(this,ac)[ac](Zl(this,fc)[fc](e),{signal:n}).abortOn(n);let a;const l=t.getData();if("POST"===r.toUpperCase()){const e=new FormData;Object.entries(i).forEach(t=>{let[n,r]=t;return e.set(n,r)}),e.set("file",l),a=e}else a=l;const{onProgress:c,onComplete:u}=t,d=await Zl(this,_c)[_c]({signature:{url:o,headers:s,method:r},body:a,size:l.size,onProgress:c,onComplete:u,signal:n}).abortOn(n);return"location"in d?d:{location:nc(o),...d}}let bc;function Sc(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ec=0;function kc(e){return"__private_"+Ec+++"_"+e}function Pc(e){if(null!=e&&e.error){const t=new Error(e.message);throw Object.assign(t,e.error),t}return e}function Tc(e){const t=e.Expiration;if(t){const e=Math.floor((new Date(t)-Date.now())/1e3);if(e>9)return e}}function Oc(e){let{meta:t,allowedMetaFields:n,querify:r=!1}=e;const o=null!=n?n:Object.keys(t);return t?Object.fromEntries(o.filter(e=>null!=t[e]).map(e=>[r?`metadata[${e}]`:e,String(t[e])])):{}}const Cc={allowedMetaFields:null,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:e=>0!==e.size,retryDelays:[0,1e3,3e3,5e3],companionHeaders:{}};var xc=kc("companionCommunicationQueue"),Rc=kc("client"),Ac=kc("cachedTemporaryCredentials"),Nc=kc("getTemporarySecurityCredentials"),Fc=kc("setS3MultipartState"),jc=kc("getFile"),Ic=kc("uploadLocalFile"),Mc=kc("getCompanionClientArgs"),Uc=kc("upload"),Lc=kc("setCompanionHeaders"),zc=kc("setResumableUploadsCapability"),Bc=kc("resetResumableCapability");bc=Symbol.for("uppy test: getClient");class Dc extends aa{constructor(e,t){var n;super(e,{...Cc,uploadPartBytes:Dc.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...t}),Object.defineProperty(this,Mc,{value:qc}),Object.defineProperty(this,Ic,{value:Wc}),Object.defineProperty(this,Nc,{value:$c}),Object.defineProperty(this,xc,{writable:!0,value:void 0}),Object.defineProperty(this,Rc,{writable:!0,value:void 0}),Object.defineProperty(this,Ac,{writable:!0,value:void 0}),Object.defineProperty(this,Fc,{writable:!0,value:(e,t)=>{let{key:n,uploadId:r}=t;const o=this.uppy.getFile(e.id);null!=o&&this.uppy.setFileState(e.id,{s3Multipart:{...o.s3Multipart,key:n,uploadId:r}})}}),Object.defineProperty(this,jc,{writable:!0,value:e=>this.uppy.getFile(e.id)||e}),Object.defineProperty(this,Uc,{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)),n=function(e){return e.filter(e=>{var t;return!(null!=(t=e.progress)&&t.uploadStarted&&e.isRestored)})}(t);this.uppy.emit("upload-start",n);const r=t.map(e=>{if(e.isRemote){const t=()=>this.requests;Sc(this,zc)[zc](!1);const n=new AbortController,r=t=>{t.id===e.id&&n.abort()};this.uppy.on("file-removed",r);const o=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,Sc(this,Mc)[Mc](e),{signal:n.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",r)},{priority:-1})(),o}return Sc(this,Ic)[Ic](e)}),o=await Promise.all(r);return Sc(this,zc)[zc](!0),o}}),Object.defineProperty(this,Lc,{writable:!0,value:()=>{Sc(this,Rc)[Rc].setCompanionHeaders(this.opts.companionHeaders)}}),Object.defineProperty(this,zc,{writable:!0,value:e=>{const{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,resumableUploads:e}})}}),Object.defineProperty(this,Bc,{writable:!0,value:()=>{Sc(this,zc)[zc](!0)}}),this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",this.title="AWS S3 Multipart",Sc(this,Rc)[Rc]=new Ua(e,t);const r={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(r))null==this.opts[e]&&(this.opts[e]=r[e].bind(this));null!=(null==t?void 0:t.prepareUploadParts)&&null==t.signPart&&(this.opts.signPart=async(e,n)=>{let{uploadId:r,key:o,partNumber:i,body:s,signal:a}=n;const{presignedUrls:l,headers:c}=await t.prepareUploadParts(e,{uploadId:r,key:o,parts:[{number:i,chunk:s}],signal:a});return{url:null==l?void 0:l[i],headers:null==c?void 0:c[i]}}),this.requests=null!=(n=this.opts.rateLimitedQueue)?n:new ul(this.opts.limit),Sc(this,xc)[xc]=new yc(this.requests,this.opts,Sc(this,Fc)[Fc],Sc(this,jc)[jc]),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null),this.uploaderSockets=Object.create(null)}[bc](){return Sc(this,Rc)[Rc]}setOptions(e){Sc(this,xc)[xc].setOptions(e),super.setOptions(e),Sc(this,Lc)[Lc]()}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"),Yl(t);const n=Oc({meta:e.meta,allowedMetaFields:this.opts.allowedMetaFields});return Sc(this,Rc)[Rc].post("s3/multipart",{filename:e.name,type:e.type,metadata:n},{signal:t}).then(Pc)}listParts(e,t,n){let{key:r,uploadId:o,signal:i}=t;null!=i||(i=n),this.assertHost("listParts"),Yl(i);const s=encodeURIComponent(r);return Sc(this,Rc)[Rc].get(`s3/multipart/${o}?key=${s}`,{signal:i}).then(Pc)}completeMultipartUpload(e,t,n){let{key:r,uploadId:o,parts:i,signal:s}=t;null!=s||(s=n),this.assertHost("completeMultipartUpload"),Yl(s);const a=encodeURIComponent(r),l=encodeURIComponent(o);return Sc(this,Rc)[Rc].post(`s3/multipart/${l}/complete?key=${a}`,{parts:i},{signal:s}).then(Pc)}async createSignedURL(e,t){const n=await Sc(this,Nc)[Nc](t),r=Tc(n.credentials)||604800,{uploadId:o,key:i,partNumber:s}=t;return{method:"PUT",expires:r,fields:{},url:`${await Ql({accountKey:n.credentials.AccessKeyId,accountSecret:n.credentials.SecretAccessKey,sessionToken:n.credentials.SessionToken,expires:r,bucketName:n.bucket,Region:n.region,Key:null!=i?i:`${crypto.randomUUID()}-${e.name}`,uploadId:o,partNumber:s})}`,headers:{"Content-Type":e.type}}}signPart(e,t){let{uploadId:n,key:r,partNumber:o,signal:i}=t;if(this.assertHost("signPart"),Yl(i),null==n||null==r||null==o)throw new Error("Cannot sign without a key, an uploadId, and a partNumber");const s=encodeURIComponent(r);return Sc(this,Rc)[Rc].get(`s3/multipart/${n}/${o}?key=${s}`,{signal:i}).then(Pc)}abortMultipartUpload(e,t,n){let{key:r,uploadId:o,signal:i}=t;null!=i||(i=n),this.assertHost("abortMultipartUpload");const s=encodeURIComponent(r),a=encodeURIComponent(o);return Sc(this,Rc)[Rc].delete(`s3/multipart/${a}?key=${s}`,void 0,{signal:i}).then(Pc)}getUploadParameters(e,t){const{meta:n}=e,{type:r,name:o}=n,i=Oc({meta:n,allowedMetaFields:this.opts.allowedMetaFields,querify:!0}),s=new URLSearchParams({filename:o,type:r,...i});return Sc(this,Rc)[Rc].get(`s3/params?${s}`,t)}static async uploadPartBytes(e){let{signature:{url:t,expires:n,headers:r,method:o="PUT"},body:i,size:s=i.size,onProgress:a,onComplete:l,signal:c}=e;if(Yl(c),null==t)throw new Error("Cannot upload to an undefined URL");return new Promise((e,u)=>{const d=new XMLHttpRequest;function h(){d.abort()}function p(){null==c||c.removeEventListener("abort",h)}d.open(o,t,!0),r&&Object.keys(r).forEach(e=>{d.setRequestHeader(e,r[e])}),d.responseType="text","number"==typeof n&&(d.timeout=1e3*n),null==c||c.addEventListener("abort",h),d.upload.addEventListener("progress",e=>{a(e)}),d.addEventListener("abort",()=>{p(),u(gl())}),d.addEventListener("timeout",()=>{p();const e=new Error("Request has expired");e.source={status:403},u(e)}),d.addEventListener("load",()=>{if(p(),403===d.status&&d.responseText.includes("<Message>Request has expired</Message>")){const e=new Error("Request has expired");return e.source=d,void u(e)}if(d.status<200||d.status>=300){const e=new Error("Non 2xx");return e.source=d,void u(e)}null==a||a({loaded:s,lengthComputable:!0});const t=d.getAllResponseHeaders().trim().split(/[\r\n]+/),n={__proto__:null};for(const e of t){const t=e.split(": "),r=t.shift(),o=t.join(": ");n[r]=o}const{etag:r,location:i}=n;"POST"===o.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!==r?(null==l||l(r),e({...n,ETag:r})):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."))}),d.addEventListener("error",e=>{p();const t=new Error("Unknown error");t.source=e.target,u(t)}),d.send(i)})}install(){Sc(this,zc)[zc](!0),this.uppy.addPreProcessor(Sc(this,Lc)[Lc]),this.uppy.addUploader(Sc(this,Uc)[Uc]),this.uppy.on("cancel-all",Sc(this,Bc)[Bc])}uninstall(){this.uppy.removePreProcessor(Sc(this,Lc)[Lc]),this.uppy.removeUploader(Sc(this,Uc)[Uc]),this.uppy.off("cancel-all",Sc(this,Bc)[Bc])}}async function $c(e){return Yl(null==e?void 0:e.signal),null==Sc(this,Ac)[Ac]&&(!0===this.opts.getTemporarySecurityCredentials?(this.assertHost("getTemporarySecurityCredentials"),Sc(this,Ac)[Ac]=Sc(this,Rc)[Rc].get("s3/sts",e).then(Pc)):Sc(this,Ac)[Ac]=this.opts.getTemporarySecurityCredentials(e),Sc(this,Ac)[Ac]=await Sc(this,Ac)[Ac],setTimeout(()=>{Sc(this,Ac)[Ac]=null},500*(Tc(Sc(this,Ac)[Ac].credentials)||0))),Sc(this,Ac)[Ac]}function Wc(e){var t=this;return new Promise((n,r)=>{const o=new $l(e.data,{companionComm:Sc(this,xc)[xc],log:function(){return t.uppy.log(...arguments)},getChunkSize:this.opts.getChunkSize?this.opts.getChunkSize.bind(this):null,onProgress:(t,n)=>{this.uppy.emit("upload-progress",this.uppy.getFile(e.id),{uploader:this,bytesUploaded:t,bytesTotal:n})},onError:t=>{this.uppy.log(t),this.uppy.emit("upload-error",e,t),this.resetUploaderReferences(e.id),r(t)},onSuccess:t=>{const r={body:{...t},status:200,uploadURL:t.location};this.resetUploaderReferences(e.id),this.uppy.emit("upload-success",Sc(this,jc)[jc](e),r),t.location&&this.uppy.log(`Download ${e.name} from ${t.location}`),n()},onPartComplete:t=>{this.uppy.emit("s3-multipart:part-uploaded",Sc(this,jc)[jc](e),t)},file:e,shouldUseMultipart:this.opts.shouldUseMultipart,...e.s3Multipart});this.uploaders[e.id]=o;const i=new Ha(this.uppy);this.uploaderEvents[e.id]=i,i.onFileRemove(e.id,t=>{o.abort(),this.resetUploaderReferences(e.id,{abort:!0}),n(`upload ${t} was removed`)}),i.onCancelAll(e.id,t=>{"user"===(null==t?void 0:t.reason)&&(o.abort(),this.resetUploaderReferences(e.id,{abort:!0})),n(`upload ${e.id} was canceled`)}),i.onFilePause(e.id,e=>{e?o.pause():o.start()}),i.onPauseAll(e.id,()=>{o.pause()}),i.onResumeAll(e.id,()=>{o.start()}),o.start()})}function qc(e){var t;return{...null==(t=e.remote)?void 0:t.body,protocol:"s3-multipart",size:e.data.size,metadata:e.meta}}Dc.VERSION="3.12.0";var Hc,Vc,Yc,Kc,Gc,Jc=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})},Xc=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},Qc=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},Zc=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};class eu{constructor(e,t=Po.PROD){Hc.add(this),Vc.set(this,void 0),Yc.set(this,void 0),Kc.set(this,void 0),Xc(this,Yc,e,"f"),Xc(this,Kc,t,"f")}uploadFileFrontend(e){return Jc(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:n,email:r,callBack:o}){if(!Co(e,t,n,r))throw new Error(bo);if(!Fo(r.trim()))throw new Error(Eo);if(!xo(t))throw new Error(So);return t=Ao(t,n,r),Qc(this,Hc,"m",Gc).call(this,{callBack:o,arrayMetaData:t,scanId:n,email:r,file:e})})}faceScanFileUploader(e){return Jc(this,arguments,void 0,function*({file:e,arrayMetaData:t,objectKey:n,email:r,callBack:o}){if(!Co(e,t,n,r))throw new Error(bo);if(!Fo(r.trim()))throw new Error(Eo);if(!Ro(t,wo))throw new Error(So);return t.push({email:r}),Qc(this,Hc,"m",Gc).call(this,{callBack:o,arrayMetaData:t,objectKey:n,email:r,file:e})})}uploadFile(e){return Jc(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:n,email:r}){if(!Co(e,t,n,r))throw new Error(bo);if(!Fo(r.trim()))throw new Error(Eo);if(!xo(t))throw new Error(So);return t=Ao(t,n,r),new Promise((n,r)=>Jc(this,void 0,void 0,function*(){var o;try{const r=yield Oo({path:Gr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{objectKey:e.name,contentType:e.type,objectMetadata:t},throwError:!0}),i=function(e,t=5242880){const n=e.size,r=[];let o=0;for(;o<n;)r.push(e.slice(o,o+t)),o+=t;return r}(e),s=[];for(let t=0;t<i.length;t++){const n=yield Oo({path:Xr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{objectKey:null==r?void 0:r.key,uploadId:null==r?void 0:r.uploadId,partNumber:t+1},throwError:!0}),a=yield Ar.put(null==n?void 0:n.url,i[t],{headers:{"Content-Type":e.type,"X-Api-Key":Qc(this,Yc,"f")}});s.push({PartNumber:t+1,ETag:null===(o=null==a?void 0:a.headers)||void 0===o?void 0:o.etag})}const a=yield Oo({path:Jr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{uploadId:null==r?void 0:r.uploadId,objectKey:null==r?void 0:r.key,parts:s,originalFileName:e.name},throwError:!0});n({message:"successfully uploaded",data:a})}catch(e){r(e)}}))})}setDeviceInfo(e){return Jc(this,void 0,void 0,function*(){const{scanId:t}=e,n=Zc(e,["scanId"]);if(!1===Co(t))throw new Error(bo);return Ar.post(`${No({urlName:Qr,urlType:Qc(this,Kc,"f")})}${go}/${t}`,{device_info:Object.assign({},n)},{headers:{"X-Api-Key":Qc(this,Yc,"f")}})})}}Vc=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Hc=new WeakSet,Gc=function({callBack:e,arrayMetaData:t,scanId:n,email:r,file:o,objectKey:i}){return new Promise((s,a)=>{Qc(this,Vc,"f")&&Qc(this,Vc,"f").close(),Xc(this,Vc,new Ks({autoProceed:!0}),"f"),Qc(this,Vc,"f").use(Dc,{limit:10,retryDelays:[0,1e3,3e3,5e3],companionUrl:No({urlName:Qr,urlType:Qc(this,Kc,"f")}),getChunkSize:()=>ko,createMultipartUpload:o=>{const s=Math.ceil(o.size/ko);null==e||e({eventName:"uploading_start",message:`File ${o.name} will be divided into ${s} chunks`,scanId:n,email:r,objectKey:i});const a=`${n||i}.${o.extension}`;return Oo({path:Gr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{objectKey:a,contentType:o.type,objectMetadata:t}})},completeMultipartUpload:(t,{uploadId:o,key:s,parts:a})=>(null==e||e({eventName:"uploading_complete_start",message:`${a.length} chunks of file, uploaded`,scanId:n,email:r,objectKey:i}),Oo({path:Jr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{uploadId:o,objectKey:s,parts:a,originalFileName:t.name}}).then(t=>(null==e||e({eventName:"uploading_complete_end",message:"Multipart upload completed successfully",scanId:n,email:r,objectKey:i}),t))),signPart:(e,t)=>Oo({path:Xr,urlType:Qc(this,Kc,"f"),apiKey:Qc(this,Yc,"f"),body:{objectKey:t.key,uploadId:t.uploadId,partNumber:t.partNumber}})}),Qc(this,Vc,"f").addFile({source:"manual",name:o.name,type:o.type,data:o}),Qc(this,Vc,"f").on("upload-error",(e,t,n)=>{t.isNetworkError?Qc(this,Vc,"f").retryUpload(e.id):a(t)}),Qc(this,Vc,"f").on("upload-success",()=>{s({message:"file uploaded successfully"})}),Qc(this,Vc,"f").on("complete",e=>{Qc(this,Vc,"f")&&Qc(this,Vc,"f").close()})})};var tu,nu,ru,ou,iu,su,au,lu,cu,uu,du,hu,pu=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})},_u=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},fu=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class mu{constructor(e,t=Po.PROD){tu.add(this),nu.set(this,{}),ru.set(this,{}),ou.set(this,{}),iu.set(this,{}),su.set(this,void 0),au.set(this,void 0),_u(this,su,e,"f"),_u(this,au,t,"f")}getMeasurementResult(e){if(!Co(e))throw new Error(bo);const t=`${No({urlName:Qr,urlType:fu(this,au,"f")})}/measurements?scanId=${e}`;return Ar.get(t,{headers:{"X-Api-Key":fu(this,su,"f")}})}getMeasurementRecommendation({scanId:e,shopDomain:t,productName:n}){if(!Co(e,t,n))throw new Error(bo);return Ar.get(`${No({urlName:Qr,urlType:fu(this,au,"f")})}${fo}/scan/${e}/shop/${t}/product/${n}`,{headers:{"X-Api-Key":fu(this,su,"f")}})}handleMeasurementSocket(e){const{scanId:t,onError:n,onSuccess:r,onClose:o,onOpen:i}=e;if(!Co(t))throw new Error(bo);fu(this,tu,"m",hu).call(this,{onOpen:i,scanId:t,onSuccess:r,onError:n,onClose:o,paramsKey:"scanId",isFallback:!0,delay:5e3})}handlFaceScaneSocket(e){const{faceScanId:t,onError:n,onSuccess:r,onClose:o,onOpen:i}=e;if(!Co(t))throw new Error(bo);fu(this,tu,"m",hu).call(this,{onOpen:i,faceScanId:t,onSuccess:r,onError:n,onClose:o,paramsKey:"faceScanId",isFallback:!1,delay:1e3})}}nu=new WeakMap,ru=new WeakMap,ou=new WeakMap,iu=new WeakMap,su=new WeakMap,au=new WeakMap,tu=new WeakSet,lu=function(e){var t;null===(t=fu(this,nu,"f")[e])||void 0===t||t.close(),fu(this,nu,"f")[e]=null,fu(this,ru,"f")[e]&&(clearTimeout(fu(this,ru,"f")[e]),fu(this,ru,"f")[e]=null)},cu=function(e,t){const{scanId:n,onSuccess:r,onError:o}=e;fu(this,iu,"f")[t]=1,fu(this,ru,"f")[t]=setTimeout(()=>{fu(this,tu,"m",uu).call(this,{scanId:n,onSuccess:r,onError:o},t),fu(this,tu,"m",lu).call(this,t)},9e4)},uu=function(e,t){const{scanId:n,onSuccess:r,onError:o}=e;fu(this,ou,"f")[t]&&clearTimeout(fu(this,ou,"f")[t]),fu(this,ou,"f")[t]=setTimeout(()=>{fu(this,tu,"m",du).call(this,{scanId:n,onSuccess:r,onError:o},t)},5e3*(fu(this,iu,"f")[t]||1))},du=function(e,t){return pu(this,void 0,void 0,function*(){var n;const{scanId:r,onSuccess:o,onError:i}=e;try{const e=yield this.getMeasurementResult(r);(null==e?void 0:e.data)&&!0===(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.isMeasured)?(null==o||o(e.data),clearInterval(fu(this,ou,"f")[t])):(fu(this,iu,"f")[t]||1)<8?(fu(this,iu,"f")[t]=(fu(this,iu,"f")[t]||1)+1,fu(this,tu,"m",uu).call(this,{scanId:r,onSuccess:o,onError:i},t)):(fu(this,iu,"f")[t]=1,clearInterval(fu(this,ou,"f")[t]),null==i||i({scanStatus:"failed",message:"Scan not found",isMeasured:!1}))}catch(e){clearInterval(fu(this,ou,"f")[t]),null==i||i(e)}})},hu=function({onOpen:e,isFallback:t,scanId:n,onSuccess:r,onError:o,onClose:i,paramsKey:s,faceScanId:a,delay:l}){const c=t?`measurement-${n}`:`faceScan-${a}`;setTimeout(()=>{fu(this,tu,"m",lu).call(this,c);const l=`${No({urlName:Zr,urlType:fu(this,au,"f")})}${_o}?${s}=${n||a}`,u=new WebSocket(l);fu(this,nu,"f")[c]=u,u.onopen=()=>{null==e||e(),t&&n&&fu(this,tu,"m",cu).call(this,{scanId:n,onSuccess:r,onError:o},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==r||r(t):(clearTimeout(fu(this,ru,"f")[c]),null==o||o(t)),200===(null==t?void 0:t.code)&&"success"===(null==t?void 0:t.scanStatus)&&"final"===(null==t?void 0:t.resultType)&&clearTimeout(fu(this,ru,"f")[c])},u.onclose=()=>null==i?void 0:i(),u.onerror=()=>{t||null==o||o(new Error("An error occurred in the WebSocket connection."))}},l)};const gu=Object.create(null);gu.open="0",gu.close="1",gu.ping="2",gu.pong="3",gu.message="4",gu.upgrade="5",gu.noop="6";const yu=Object.create(null);Object.keys(gu).forEach(e=>{yu[gu[e]]=e});const vu={type:"error",data:"parser error"},wu="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),bu="function"==typeof ArrayBuffer,Su=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Eu=({type:e,data:t},n,r)=>wu&&t instanceof Blob?n?r(t):ku(t,r):bu&&(t instanceof ArrayBuffer||Su(t))?n?r(t):ku(new Blob([t]),r):r(gu[e]+(t||"")),ku=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Pu(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Tu;const Ou="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cu="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Cu[Ou.charCodeAt(e)]=e;const xu="function"==typeof ArrayBuffer,Ru=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Nu(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:Au(e.substring(1),t)};return yu[n]?e.length>1?{type:yu[n],data:e.substring(1)}:{type:yu[n]}:vu},Au=(e,t)=>{if(xu){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const c=new ArrayBuffer(s),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=Cu[e.charCodeAt(t)],r=Cu[e.charCodeAt(t+1)],o=Cu[e.charCodeAt(t+2)],i=Cu[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|o>>2,u[l++]=(3&o)<<6|63&i;return c})(e);return Nu(n,t)}return{base64:!0,data:e}},Nu=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Fu=String.fromCharCode(30);function ju(){return new TransformStream({transform(e,t){!function(e,t){wu&&e.data instanceof Blob?e.data.arrayBuffer().then(Pu).then(t):bu&&(e.data instanceof ArrayBuffer||Su(e.data))?t(Pu(e.data)):Eu(e,!1,e=>{Tu||(Tu=new TextEncoder),t(Tu.encode(e))})}(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let Iu;function Mu(e){return e.reduce((e,t)=>e+t.length,0)}function Uu(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Lu(e){if(e)return function(e){for(var t in Lu.prototype)e[t]=Lu.prototype[t];return e}(e)}Lu.prototype.on=Lu.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Lu.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Lu.prototype.off=Lu.prototype.removeListener=Lu.prototype.removeAllListeners=Lu.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},Lu.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},Lu.prototype.emitReserved=Lu.prototype.emit,Lu.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Lu.prototype.hasListeners=function(e){return!!this.listeners(e).length};const zu="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Bu="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function Du(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const $u=Bu.setTimeout,Wu=Bu.clearTimeout;function qu(e,t){t.useNativeTimers?(e.setTimeoutFn=$u.bind(Bu),e.clearTimeoutFn=Wu.bind(Bu)):(e.setTimeoutFn=Bu.setTimeout.bind(Bu),e.clearTimeoutFn=Bu.clearTimeout.bind(Bu))}function Hu(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function Vu(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class Yu extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Ku extends Lu{constructor(e){super(),this.writable=!1,qu(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new Yu(e,t,n)),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=Ru(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 n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class Gu extends Ku{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 n=e.split(Fu),r=[];for(let e=0;e<n.length;e++){const o=Ru(n[e],t);if(r.push(o),"error"===o.type)break}return r})(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 n=e.length,r=new Array(n);let o=0;e.forEach((e,i)=>{Eu(e,!1,e=>{r[i]=e,++o===n&&t(r.join(Fu))})})})(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]=Vu()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let Ju=!1;try{Ju="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const Xu=Ju;function Qu(){}class Zu extends Gu{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.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 ed extends Lu{constructor(e,t,n){super(),this.createRequest=e,qu(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=Du(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=ed.requestsCount++,ed.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=Qu,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete ed.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(ed.requestsCount=0,ed.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",td);else if("function"==typeof addEventListener){addEventListener("onpagehide"in Bu?"pagehide":"unload",td,!1)}function td(){for(let e in ed.requests)ed.requests.hasOwnProperty(e)&&ed.requests[e].abort()}const nd=function(){const e=rd({xdomain:!1});return e&&null!==e.responseType}();function rd(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Xu))return new XMLHttpRequest}catch(e){}if(!t)try{return new(Bu[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const od="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class id extends Ku{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=od?{}:Du(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}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 n=e[t],r=t===e.length-1;Eu(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&zu(()=>{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]=Vu()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const sd=Bu.WebSocket||Bu.MozWebSocket;const ad={websocket:class extends id{createSocket(e,t,n){return od?new sd(e,t,n):t?new sd(e,t):new sd(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Ku{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){Iu||(Iu=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(Mu(n)<1)break;const e=Uu(n,1);i=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(Mu(n)<2)break;const e=Uu(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(Mu(n)<8)break;const e=Uu(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(vu);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(Mu(n)<o)break;const e=Uu(n,o);a.enqueue(Ru(i?e:Iu.decode(e),t)),r=0}if(0===o||o>e){a.enqueue(vu);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=ju();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();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 n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&zu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Zu{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=nd&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new ed(rd,this.uri(),e)}}},ld=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,cd=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ud(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=ld.exec(e||""),i={},s=14;for(;s--;)i[cd[s]]=o[s]||"";return-1!=n&&-1!=r&&(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 n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,i.query),i}const dd="function"==typeof addEventListener&&"function"==typeof removeEventListener,hd=[];dd&&addEventListener("offline",()=>{hd.forEach(e=>e())},!1);class pd extends Lu{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 n=ud(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=ud(t.host).host);qu(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={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),dd&&(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"})},hd.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 n=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](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&pd.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",pd.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 n=this.writeBuffer[t].data;if(n&&(e+=Hu(n)),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,zu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{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?n():e()}):this.upgrading?n():e()),this}_onError(e){if(pd.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(),dd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=hd.indexOf(this._offlineEventListener);-1!==e&&hd.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}pd.protocol=4;class _d extends pd{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),n=!1;pd.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;pd.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"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 o(){n||(n=!0,c(),t.close(),t=null)}const i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function s(){i("transport closed")}function a(){i("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};t.once("open",r),t.once("error",i),t.once("close",s),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let fd=class extends _d{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>ad[e]).filter(e=>!!e)),super(e,n)}};const md="function"==typeof ArrayBuffer,gd=Object.prototype.toString,yd="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===gd.call(Blob),vd="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===gd.call(File);function wd(e){return md&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||yd&&e instanceof Blob||vd&&e instanceof File}function bd(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(bd(e[t]))return!0;return!1}if(wd(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return bd(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&bd(e[t]))return!0;return!1}function Sd(e){const t=[],n=e.data,r=e;return r.data=Ed(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Ed(e,t){if(!e)return e;if(wd(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Ed(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Ed(e[r],t));return n}return e}function kd(e,t){return e.data=Pd(e.data,t),delete e.attachments,e}function Pd(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 n=0;n<e.length;n++)e[n]=Pd(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Pd(e[n],t));return e}const Td=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Od;!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"}(Od||(Od={}));function Cd(e){return"[object Object]"===Object.prototype.toString.call(e)}class xd extends Lu{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 n=t.type===Od.BINARY_EVENT;n||t.type===Od.BINARY_ACK?(t.type=n?Od.EVENT:Od.ACK,this.reconstructor=new Rd(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!wd(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 n={type:Number(e.charAt(0))};if(void 0===Od[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Od.BINARY_EVENT||n.type===Od.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!xd.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Od.CONNECT:return Cd(t);case Od.DISCONNECT:return void 0===t;case Od.CONNECT_ERROR:return"string"==typeof t||Cd(t);case Od.EVENT:case Od.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Td.indexOf(t[0]));case Od.ACK:case Od.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Rd{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=kd(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Ad=Object.freeze({__proto__:null,Decoder:xd,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Od.EVENT&&e.type!==Od.ACK||!bd(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Od.EVENT?Od.BINARY_EVENT:Od.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Od.BINARY_EVENT&&e.type!==Od.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=Sd(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Od},protocol:5});function Nd(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Fd=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class jd extends Lu{constructor(e,t,n){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,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Nd(e,"open",this.onopen.bind(this)),Nd(e,"packet",this.onpacket.bind(this)),Nd(e,"error",this.onerror.bind(this)),Nd(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 n,r,o;if(Fd.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:Od.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}const s=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const o=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"))},r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{const o=(e,t)=>e?r(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),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:Od.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 Od.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 Od.EVENT:case Od.BINARY_EVENT:this.onevent(e);break;case Od.ACK:case Od.BINARY_ACK:this.onack(e);break;case Od.DISCONNECT:this.ondisconnect();break;case Od.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 n of t)n.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 n=!1;return function(...r){n||(n=!0,t.packet({type:Od.ACK,id:e,data:r}))}}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:Od.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 n=0;n<t.length;n++)if(e===t[n])return t.splice(n,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 n=0;n<t.length;n++)if(e===t[n])return t.splice(n,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 n of t)n.apply(this,e.data)}}}function Id(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}Id.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Id.prototype.reset=function(){this.attempts=0},Id.prototype.setMin=function(e){this.ms=e},Id.prototype.setMax=function(e){this.max=e},Id.prototype.setJitter=function(e){this.jitter=e};class Md extends Lu{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,qu(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!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Id({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Ad;this.encoder=new r.Encoder,this.decoder=new r.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 fd(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Nd(t,"open",function(){n.onopen(),e&&e()}),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Nd(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),o(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),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(Nd(e,"ping",this.onping.bind(this)),Nd(e,"data",this.ondata.bind(this)),Nd(e,"error",this.onerror.bind(this)),Nd(e,"close",this.onclose.bind(this)),Nd(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){zu(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new jd(this,e,t),this.nsps[e]=n),n}_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 n=0;n<t.length;n++)this.engine.write(t[n],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 n;this.cleanup(),null===(n=this.engine)||void 0===n||n.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 n=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&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ud={};function Ld(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=ud(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=Ud[o]&&i in Ud[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new Md(r,t):(Ud[o]||(Ud[o]=new Md(r,t)),a=Ud[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(Ld,{Manager:Md,Socket:jd,io:Ld,connect:Ld});var zd,Bd,Dd,$d=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},Wd=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class qd{constructor(e,t=Po.PROD){zd.set(this,null),Bd.set(this,void 0),Dd.set(this,void 0),$d(this,Bd,e,"f"),$d(this,Dd,t,"f")}connect(){return new Promise((e,t)=>{$d(this,zd,Ld(No({urlName:"APP_POSE_DETECTION_WEBSOCKET_URL",urlType:Wd(this,Dd,"f")})),"f"),Wd(this,zd,"f").on("connect",()=>{var n;const r=null===(n=Wd(this,zd,"f"))||void 0===n?void 0:n.id;r?e(r):t("Failed to obtain socket ID.")}),Wd(this,zd,"f").on("connect_error",e=>{t(e)})})}videoEmit({image:e,scanId:t}){if(!Wd(this,zd,"f"))throw new Error("Socket is not connected");Wd(this,zd,"f").emit("video",{image:e,user_unique_key:t})}disconnect(){var e;null===(e=Wd(this,zd,"f"))||void 0===e||e.disconnect()}poseStatus(e){if(!Wd(this,zd,"f"))throw new Error("Socket is not connected");Wd(this,zd,"f").on("pose_status",t=>{null==e||e(t)})}connected(){var e;return!!(null===(e=Wd(this,zd,"f"))||void 0===e?void 0:e.connected)}}zd=new WeakMap,Bd=new WeakMap,Dd=new WeakMap;var Hd,Vd,Yd,Kd,Gd,Jd,Xd,Qd,Zd,eh,th=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})},nh=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},rh=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class oh{constructor(e,t=Po.PROD){Hd.add(this),Vd.set(this,new Map),Yd.set(this,new Map),Kd.set(this,void 0),Gd.set(this,void 0),Qd.set(this,e=>{if(e){const t=rh(this,Vd,"f").get(e),n=rh(this,Yd,"f").get(e);null==t||t.close(),n&&clearTimeout(n),rh(this,Vd,"f").delete(e),rh(this,Yd,"f").delete(e)}else rh(this,Vd,"f").forEach(e=>e.close()),rh(this,Yd,"f").forEach(e=>clearTimeout(e)),rh(this,Vd,"f").clear(),rh(this,Yd,"f").clear()}),Zd.set(this,({onSuccess:e,onError:t,tryonId:n})=>{const r=setTimeout(()=>{rh(this,eh,"f").call(this,{onSuccess:e,onError:t,tryonId:n}),rh(this,Qd,"f").call(this,n)},3e5);rh(this,Yd,"f").set(n,r)}),this.handleTryOnWebSocket=({tryonId:e,onError:t,onSuccess:n,onClose:r,onOpen:o})=>{if(!1===Co(e))throw new Error(bo);rh(this,Qd,"f").call(this,e);const i=`${No({urlName:Zr,urlType:rh(this,Gd,"f")})}${ho}?tryonId=${e}`,s=new WebSocket(i);rh(this,Vd,"f").set(e,s),s.onopen=()=>{null==o||o(),rh(this,Zd,"f").call(this,{onSuccess:n,onError:t,tryonId:e})},s.onmessage=r=>{let o;try{o=JSON.parse(r.data)}catch(e){return void console.log("Invalid JSON:",r.data)}"success"===(null==o?void 0:o.status)?null==n||n(o):null==t||t(o);const i=rh(this,Yd,"f").get(e);i&&clearTimeout(i),rh(this,Yd,"f").delete(e)},s.onclose=()=>{null==r||r()},s.onerror=e=>{null==t||t(e)}},eh.set(this,e=>th(this,[e],void 0,function*({onSuccess:e,onError:t,tryonId:n}){try{const t=yield this.getTryOnResult({tryonId:n});null==e||e(t.data)}catch(e){null==t||t(e)}})),this.getTryOnResult=({tryonId:e})=>{if(!1===Co(e))throw new Error(bo);const t=`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${uo}/${e}`;return Ar.post(t,null,{headers:{"X-Api-Key":rh(this,Kd,"f")}})},nh(this,Kd,e,"f"),nh(this,Gd,t,"f")}uploadFile(e){return th(this,arguments,void 0,function*({files:e,userEmail:t,fileNoLimit:n=2}){if(!1===Co(e,t))throw new Error(bo);if(!Fo(t.trim()))throw new Error(Eo);if(n<=0)throw new Error(`Provide valid file number limit ${n}.`);if((null==e?void 0:e.length)>n)throw new Error(`Cannot allow more than ${n} files.`);try{const n={userEmail:t,userImages:[]};null==e||e.forEach(e=>{n.userImages.push(e.name)});const r=yield rh(this,Hd,"m",Jd).call(this,n);for(const t of e)yield rh(this,Hd,"m",Xd).call(this,r.data.uploadUrls[t.name].url,t);return"uploaded successfully!"}catch(e){throw e}})}getUploadedFiles(e){if(!1===Co(e))throw new Error(bo);if(!Fo(e.trim()))throw new Error(Eo);const t={userEmail:e};return Ar.post(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${lo}`,t,{headers:{"X-Api-Key":rh(this,Kd,"f")}})}deleteImage({userEmail:e,fileName:t}){if(!1===Co(e,t))throw new Error(bo);if(!Fo(e.trim()))throw new Error(Eo);const n={userEmail:e,file:t};return Ar.delete(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${co}`,{headers:{"X-Api-Key":rh(this,Kd,"f")},data:n})}handleTryOnSubmit({shopDomain:e,products:t,selectedUserImages:n,requestSource:r,callbackUrl:o,openTryonId:i,selectedProductImageUrl:s,token:a}){if(!1===Co(e,t,a))throw new Error(bo);const l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({products:t,customerStoreUrl:e},null!=n&&{selectedUserImages:n}),null!=r&&{requestSource:r}),null!=o&&{callbackUrl:o}),null!=i&&{openTryonId:i}),null!=s&&{selectedProductImageUrl:s}),c=`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${ho}`,u={"X-Api-Key":rh(this,Kd,"f")};return a&&(u.Authorization=`Bearer ${a}`),Ar.post(c,l,{headers:u})}getShareLink(e){return Ar.post(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${mo}`,{tryonId:e},{headers:{"X-Api-Key":rh(this,Kd,"f")}})}getProductImageEligibility({storeUrl:e,productHandle:t,imageURL:n,productDescription:r}){if(!1===Co(e,t,n))throw new Error(bo);const o={storeUrl:e,productHandle:t,imageURL:n,productDescription:null!=r?r:null},i=`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${yo}`;return Ar.post(i,o,{headers:{"X-Api-Key":rh(this,Kd,"f")}})}}Vd=new WeakMap,Yd=new WeakMap,Kd=new WeakMap,Gd=new WeakMap,Qd=new WeakMap,Zd=new WeakMap,eh=new WeakMap,Hd=new WeakSet,Jd=function(e){if(!1===Co(e))throw new Error(bo);return Ar.post(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${ao}`,e,{headers:{"Content-Type":"application/json","X-Api-Key":rh(this,Kd,"f")}})},Xd=function(e,t){if(!1===Co(e,t))throw new Error(bo);return Ar.put(e,t,{headers:{"Content-Type":t.type}})};var ih,sh,ah,lh=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},ch=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};ih=new WeakMap,sh=new WeakMap,function(e){e.DEV="dev",e.STAGING="staging",e.PROD="prod"}(ah||(ah={}));const uh=new class{constructor(e,t=Po.PROD){ih.set(this,void 0),sh.set(this,void 0),lh(this,ih,e,"f"),lh(this,sh,t,"f"),this.auth=new zo(ch(this,ih,"f"),ch(this,sh,"f")),this.custom=new qo(ch(this,ih,"f"),ch(this,sh,"f")),this.fileUpload=new eu(ch(this,ih,"f"),ch(this,sh,"f")),this.measurement=new mu(ch(this,ih,"f"),ch(this,sh,"f")),this.poseDetection=new qd(ch(this,ih,"f"),ch(this,sh,"f")),this.tryOn=new oh(ch(this,ih,"f"),ch(this,sh,"f"))}}("8e35dfd4-010c-40ca-ad79-fc72dc307efb",ah.STAGING);let dh,hh=null,ph=null;var _h=o.memo(function({setIsScanLocked:t,resetDetector:n,scanID:r,setIsVideoUploaded:o,setScanFailsError:s,setScanStartTime:a,setScanUniqueKey:u,userDetails:p,config:_}){const{gender:f,heightInCm:m,email:g,shopDomain:w}=p,b=h(null),S=h(null),[E,k]=l([]),[P,T]=l(!0),[O,C]=l(!1),[x,R]=l(!1),[A,N]=l(!0),[F,j]=l(!1),I=h(null),[M,U]=l(""),[L,z]=l([]),[B,D]=l(""),[$,W]=l(!1),[q,H]=l(!1),[V,Y]=l(!1),[K,G]=l([]),[J,X]=l(!1),Q=h(!0),Z=h(!0),ee=h(!1);let te=0;const{setStartGyro:ne,handleFileUpload:re,setUploadLoading:oe}=d(Et),ie=()=>{ee.current=!1,clearTimeout(dh),I.current&&clearTimeout(I.current),u(Ee()),s(""),oe?.(!1),k([]),T(!0),C(!1),R(!1),N(!0),j(!1),I.current=null,U(""),z([]),D(""),W(!$),ne(!1),kt.stopAudio(),H(!1),Y(!1),te=0,null!==S.current&&S.current.stop(),K.forEach(e=>{S.current&&S.current.removeEventListener("dataavailable",e)}),G([]),Q.current=!0,X(!1),o(!1)},se=i(()=>{setTimeout(()=>{T(!1)},1e3)},[]),ae=i(()=>{ve({eventName:`${w}/rescan`,email:g,scanID:r,height:m,gender:f,status:!1}),Q.current=!1,ie(),ge()},[ie,r,g]),le=i(()=>{Q.current=!1,Y(!0),X(!1),I.current&&clearTimeout(I.current),S.current&&S.current.pause(),kt.stopAudio(),uh.poseDetection.disconnect(),te=0,S.current&&S.current.stop(),K.forEach(e=>{S.current&&S.current.removeEventListener("dataavailable",e)}),G([]),clearTimeout(dh)},[S,K,kt,Q]),ce=v.filter(e=>MediaRecorder.isTypeSupported(e)),ue=i(async()=>{Q.current=!0,await kt.playAudio(`${y}SpotOn.mp3`),Y(!1),X(!1),I.current&&clearTimeout(I.current),C(!1)},[I,kt]),de=i(async()=>{try{hh=await uh.poseDetection.connect(),we.capture(`${w}/pose_detection_connected`,{scanID:r,email:g,id:hh})}catch(e){console.log(e,"while connecting websocket")}},[r,w,g]),he=i(({data:e})=>{e&&e.size>0&&Q.current&&(k(t=>t.concat(e)),!ee.current&&b.current&&(ee.current=!0))},[ue,be,w,r,g,b]),pe=i(async()=>{L.length>0&&Q.current&&(await kt.playAudio(y+L[L.length-1]),Q.current&&(dh=setTimeout(pe,2e3)))},[L,Q]),_e=i(()=>{S&&S.current&&S.current.stop(),C(!0);try{if(b&&b.current&&b.current.stream){const e={mimeType:ce[0]};S.current=new MediaRecorder(b.current.stream,e),S.current.addEventListener("dataavailable",he),G([...K,he]),S.current.start(1e3),N(!1)}}catch(e){console.log("error while using media recorder",e)}},[b,ce,he,K]),fe=i(async()=>{I.current&&clearTimeout(I.current),_e(),Q.current&&(I.current=setTimeout(async()=>{Q.current&&(await kt.playAudio(`${y}SpotOn.mp3`),C(!1))},15e3)),R(!0),Q.current&&await kt.playAudio(`${y}Spin.mp3`)},[_e,Q,kt]),me=i(({data:e})=>{e.size>0&&uh.poseDetection.connected()&&(uh.poseDetection.poseStatus(async e=>{if(e&&e.audio&&e.audio.length>0){const t=document.querySelector("#audioElement");!0===e.status&&e.sid===hh?te<2?(0===te&&t?.paused&&await kt.playAudio(y+e.audio),te+=1):(D(e.audio),clearTimeout(dh),uh.poseDetection.disconnect(),setTimeout(fe,1e3)):(te=0,!t?.paused||ph&&ph?.audioName===e.audio?ph?.audioName===e.audio&&t?.paused&&(ph&&ph.no_of_times_skipped>=ph.skipCount?(ph.no_of_times_skipped=0,kt.playAudio(y+e.audio)):ph&&(ph.no_of_times_skipped+=1)):(ph={skipCount:2,no_of_times_skipped:0,audioName:e.audio},kt.playAudio(y+e.audio)))}}),b?.current&&null!==b.current.getScreenshot()&&uh.poseDetection.videoEmit({image:b.current.getScreenshot()||"",scanId:r}))},[b,r,uh,hh,te,fe,kt]),ge=i(async()=>{j(!0),ne(!0),Z.current&&(Z.current=!1,be({eventName:"scan started",scanID:r,status:"success",email:g})),a(Se()),T(!0),Q.current&&await kt.playAudio(`${y}StartScan.mp3`),Q.current&&await kt.playAudio(`${y}LiftArmsAndHoldAtHip.mp3`),Q.current&&(j(!1),C(!0),H(!0),X(!0),se());try{if(b&&b.current&&b.current.stream&&Q.current){const e={mimeType:ce[0]};Q.current&&(S.current=new MediaRecorder(b.current.stream,e)),Q.current&&S.current&&S.current.addEventListener("dataavailable",me),G([...K,me]),S.current&&S.current.start(1e3),N(!1),Q.current&&(dh=setTimeout(pe,2e3))}}catch(e){console.log("error ----------",e)}},[b,ce,me,K,pe,Q]);return c(()=>(w&&(t(!0),de()),()=>{hh&&(uh.poseDetection.disconnect(),we.capture(`${w}/pose_detection_disconnected`,{scanID:r,email:g,id:hh})),K.forEach(e=>{S?.current?.removeEventListener("dataavailable",e)})}),[$,w]),c(()=>{L.push(M)},[M]),c(()=>{z([])},[B]),c(()=>{const e=E.length&&E.length>0;A||!e||O||!Q.current||V||S&&S.current&&(O||(S.current.stop(),N(!0)))},[A,O,E,V]),c(()=>{const e=E.length&&E.length>0;if(A||!e||O)console.log("No video found to upload");else if(S&&S.current&&Q.current&&!V&&!O){const e=new File(E,`${r}.webm`,{type:"video/webm"});oe?.(!0),s(""),re?.(e)}},[A,O,E,V,S,Q]),c(()=>{ie()},[]),e(St,{resetDetector:n,handleShowStreamCamera:ie,loadingCam:P,handlePause:le,showRestart:q,pause:V,handleReScan:ae,recordingStarted:O,isScanning:F,startSendingVideoFrames:ge,faceDone:x,stopRecording:ue,showPause:J,webcamRef:b,handleUserMedia:se,config:_})});function fh({scanID:t,userDetails:n,setIsVideoUploaded:r,setScanFailsError:o,setScanStartTime:i,setScanUniqueKey:s,config:a}){const[u,d]=l(90),[p,_]=l(0),[f,m]=l(null),[g,y]=l(!1),[v,w]=l(0),b=h([]),[S,E]=l(!1),k=u-p,P=k>=80&&k<=95;c(()=>{if("undefined"!=typeof window&&window.DeviceOrientationEvent){const e=e=>{if(null!==e.beta){let t=Math.abs(e.beta);null!==e.gamma&&(t*=Math.cos(e.gamma*Math.PI/180)),t=Math.max(0,Math.min(180,t)),d(t)}},t=async()=>{const t=DeviceOrientationEvent;if(t&&"function"==typeof t.requestPermission)try{"granted"===await t.requestPermission()&&window.addEventListener("deviceorientation",e)}catch(e){console.error("Permission error",e)}else window.addEventListener("deviceorientation",e);return()=>{e&&window.removeEventListener("deviceorientation",e)}};document.addEventListener("click",t,{once:!0})}},[]),c(()=>{if(b.current=[...b.current.slice(-4),k],b.current.length>=5){const e=Math.max(...b.current)-Math.min(...b.current);w(P&&e<2?e=>Math.min(100,e+10):e=>Math.max(0,e-20))}P||null===f&&!g||O()},[k,P,f,g]),c(()=>{v>=100&&null===f&&!g&&T(),v<50&&null!==f&&O()},[v,f,g]);const T=()=>{m(3);const e=setInterval(()=>{m(t=>null===t||t<=1?(clearInterval(e),y(!0),null):t-1)},1e3)},O=()=>{m(null),S||y(!1)};return e(tt,{angle:k,countdown:f,isScanning:g,isInTargetRange:P,stabilityScore:v,config:a,children:g&&e(_h,{setIsScanLocked:E,resetDetector:()=>{d(90),_(0),m(null),y(!1),w(0),E(!1),b.current=[]},scanID:t,userDetails:n,setIsVideoUploaded:r,setScanFailsError:o,setScanStartTime:i,setScanUniqueKey:s,config:a})})}function mh({message:r,config:i}){const[s]=o.useState(!0),{translate:a}=d(wt)||{};return e($e,{open:s,className:"confirm-modal",children:e("div",{className:"modal-main",children:e("div",{className:"text-center",children:t(n,r?{children:[e("h2",{style:{fontFamily:i?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:i?.style?.heading?.headingFontSize||"32px",color:i?.style?.heading?.headingColor||"#000",fontWeight:i?.style?.heading?.headingFontWeight||"normal"},children:"Seems camera already in use"}),t("p",{className:"mt-[0.5rem] text-sm",style:{fontFamily:i?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:i?.style?.base?.baseFontSize||"16px",color:i?.style?.base?.baseTextColor||"#000"},children:["Can you try closing the browser/app that is using the camera and try again here."," "]})]}:{children:[e("h2",{style:{fontFamily:i?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:i?.style?.heading?.headingFontSize||"32px",color:i?.style?.heading?.headingColor||"#000",fontWeight:i?.style?.heading?.headingFontWeight||"normal"},children:a?.(g.Please_check_your_setting_for_camera_permission)}),e("p",{className:"mt-[0.5rem] text-sm",style:{fontFamily:i?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:i?.style?.base?.baseFontSize||"16px",color:i?.style?.base?.baseTextColor||"#000"},children:`${a?.(g.Settings)} > ${ke()} > ${a?.(g.Enable_the_camera_permissions)}`})]})})})})}function gh({setShowDrawer:t,config:n,loader:r}){const[o,s]=l({disabled:!1,message:""}),[a,u]=l(!0),d=h(null),p=i(async()=>{const e=await Pe();s(e),u(!1)},[]);return c(()=>{p()},[]),a?e(Re,{url:r}):o?.disabled?e(mh,{config:n,message:o?.message}):e(it,{audio:!1,ref:d,screenshotQuality:1,videoConstraints:_,mirrored:!0,onUserMedia:()=>t?.(!0),screenshotFormat:"image/jpeg",style:{position:"relative",top:0,bottom:0,zIndex:0,width:"100%",height:"100%",objectFit:"cover"}})}function yh({link:t,onReady:n,wrapperClassName:r="[&_video]:rounded-t-[20px] w-full h-full"}){const o=h(null),i=h(null);let s={autoplay:!0,controls:!1,responsive:!0,fluid:!0,muted:!0,navigationUI:"hide",preload:"metadata",poster:w};return c(()=>{if(!i.current&&t&&o?.current){const e=Ae(o.current,{...s});e.ready(()=>{i.current=e;const r={...s,sources:[{src:t,type:"application/x-mpegURL"}]};e.autoplay(r.autoplay),e.src(r.sources),n?.(e)})}},[t,o]),c(()=>{const e=i.current;return()=>{e&&!e.isDisposed()&&(e.dispose(),i.current=null)}},[i]),e("div",{className:r,children:e("video",{ref:o,muted:!0,className:"video-js",playsInline:!0,onDrag:e=>e.preventDefault()})})}function vh({scanFailsError:r,serverAtCapacity:o=!1,onNext:i,gender:s,setScanUniqueKey:a,resolvedConfig:c,setIsVideoUploaded:u}){const{translate:h}=d(wt)||{},[_,m]=l(!1),y=()=>{m(!_)};return t(n,{children:[t("div",{className:"flex flex-col h-full max-w-[28rem] mx-auto w-full rounded-t-[20px] overflow-y-auto",style:{background:c?.style?.base?.backgroundColor},children:[e("div",{className:"w-full max-w-[28rem] mx-auto pt-[1rem] px-[1rem]",children:e(p,{noTitle:!0,resolvedConfig:c})}),t("div",{className:"flex-1",children:[r&&t("div",{className:"px-[1rem]",children:[e("h2",{className:"text-center",style:{fontFamily:c?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:c?.style?.heading?.headingFontSize||"32px",color:c?.style?.heading?.headingColor||"#000",fontWeight:c?.style?.heading?.headingFontWeight||"normal"},children:"There was an issue with your scan"}),e("p",{style:{fontFamily:c?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:"Reason:"}),e("p",{style:{fontFamily:c?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:Te(r)}),e("img",{className:"my-[0.5rem] aspect-[2/1.4] w-full object-cover",onClick:y,src:b[s],alt:"icon"})]}),o&&t("div",{className:"p-[1rem] text-center",children:[t("h3",{style:{fontFamily:c?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:c?.style?.heading?.headingFontSize||"32px",color:c?.style?.heading?.headingColor||"#000",fontWeight:c?.style?.heading?.headingFontWeight||"normal"},children:[h?.(g.Scan_s)," ",e("span",{children:h?.(g.vision_model)})," ",h?.(g.is_at_capacity)]}),e("p",{className:"text-base mt-[0.5rem]",style:{fontFamily:c?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:h?.(g.We_are_sorry_about_this_We_are_working_hard_to_add_capacity_Please_try_again_soon)})]})]}),r&&e("div",{className:"p-[1rem] flex gap-[0.5rem]",children:e(f,{disabled:!1,buttonText:"Scan again",className:"!shadow-none",buttonFunc:()=>{i?i?.():a(Ee()),u(!1)},resolvedConfig:c})})]}),_&&t($e,{className:"w-screen h-screen video-modal",onClose:y,open:_,children:[e("div",{className:"flex justifyEnd ",children:e("span",{className:"closeBtn",onClick:y,children:e(st,{className:"absolute right-[8px] top-[8px] text-white z-[9]"})})}),e("div",{className:"aspect-video object-cover rounded-[20px] ",children:e(yh,{link:s?S[s].PRE_LINK:S.male.PRE_LINK,wrapperClassName:"w-screen h-screen fixed top-[0] left-[0]"})})]})]})}function wh({scanId:n,userDetails:r,config:o,isFaceScan:s,isVideoUploadedCorrect:a,isMeasurementAvailable:u,onComplete:d,isSuccess:h}){const{gender:_,shopDomain:m,heightInCm:g,deviceFocalLength:y,userName:v,email:w,scanType:b}=r,S=[E,k,P].includes(b),[C,x]=l(!0),R=i(async()=>{try{S&&await uh.auth.addUser({scanId:n,email:w,name:v,gender:_,height:g}),we.capture(m,{scanID:n,email:w,height:g,focalLength:y,clothesFit:"0",gender:_})}catch(e){console.log(e)}},[S]);c(()=>{a&&R()},[a]);const A=h||(s?u&&a:a||u);return e(je,{className:"flex h-full w-full flex-col ",children:t("div",{className:"h-full w-full flex-col items-center justify-center flex",children:[e(gh,{loader:o?.loader,setShowDrawer:x}),e(Qe,{open:C,onClose:(e,t)=>{},className:"camera-drawer",anchor:"bottom",children:e("div",{className:"max-w-[28rem] mx-auto w-full h-full flex text-center flex-col justify-between items-center bg-primary rounded-t-[30px] p-[1rem]",style:{background:o?.style?.base?.backgroundColor},children:t("div",{className:"w-full h-full flex flex-col",children:[e(p,{title:"Your measurements are being taken",resolvedConfig:o}),e("div",{className:"flex items-center justify-center flex-1",children:e("video",{className:"max-h-[calc(100vh-450px)] mx-auto w-full object-contain border-none",muted:!0,loop:!0,autoPlay:!0,playsInline:!0,children:e("source",{src:_===Oe.Male?T:O,type:"video/mp4"})})}),A&&e(f,{resolvedConfig:o,className:"!w-[180px] mx-auto",buttonText:"Next",buttonFunc:d&&d})]})})})]})})}const bh=({userDetails:n,language:r=ge.English,config:o,onRetry:s,onScanSuccess:a,onComplete:u,onScanError:h,isError:p,isSuccess:_})=>{const{gender:f,scanType:m,shopDomain:g,heightInCm:y,email:v,deviceFocalLength:w,deviceModelName:b,callbackUrl:S}=n,[E,k]=l(!1),[P,T]=l(!1),[O,A]=l(!1),[N,F]=l({disabled:!1,message:""}),[j,I]=l(""),[M,U]=l(!1),[L,z]=l(!0),[B,D]=l(!1),[$,W]=l(""),[q,H]=l(Se()),{gyroData:V}=function(e){const[t,n]=l([]),[r,o]=l(!1),s=i(e=>{try{const{alpha:t,beta:r,gamma:o}=e;n(e=>[...e,{alpha:t?.toString()||void 0,beta:r?.toString()||void 0,gamma:o?.toString()||void 0,timestamp:(new Date).toISOString()}])}catch(e){console.log(e)}},[]),a=i(async()=>{const e=DeviceOrientationEvent;if(void 0!==e&&"function"==typeof e.requestPermission)try{"granted"===await e.requestPermission()?o(!0):console.warn("Device orientation permission denied.")}catch(e){console.error("Error requesting device orientation permission:",e)}else o(!0)},[]);return c(()=>(e&&r?window.addEventListener("deviceorientation",s):n([]),()=>{window.removeEventListener("deviceorientation",s)}),[e,r,s]),c(()=>{e&&a()},[e,a]),{gyroData:t}}(B),{setPreferredLanguage:Y}=d(wt)||{},K=C(o),G=i(()=>{W(Ee()),I(""),k(!1),U(!1)},[]),J=e=>{h({...e,message:Te(e)}),X(),A(!1),I(e),T(!1),be({eventName:`${g}/measurement_failed/fit-view`,scanID:$,status:"failed",email:v,message:Te(e)}),q&&be({eventName:`${g}/scan_completion_time`,scanID:$,status:"failed",completionTime:Se()-q,email:v})},X=()=>{H(null),W("")},Q=i(async e=>{if(e&&"success"===e?.scanStatus&&"intermediate"===e?.resultType&&200===e?.code)return be({eventName:`${g}/measurement_success/intermediate`,scanID:$,status:"success",email:v}),void a?.(e);X();const t=$;A(!0),be({eventName:`${g}/measurement_success/fit-view`,scanID:t,status:"success",email:v}),q&&be({eventName:`${g}/scan_completion_time`,scanID:t,status:"success",completionTime:Se()-q,email:v})},[m,g,$]),Z=e=>{A(!1),I(""),T(!1),uh.measurement.handleMeasurementSocket({scanId:e||$,onOpen:()=>{xe({eventName:`${g}/webSocket`,scanID:$,connection:"open",type:"measurement_recommendation",email:v})},onClose:()=>xe({eventName:`${g}/webSocket`,scanID:$,connection:"close",type:"measurement_recommendation",email:v}),onError:e=>{J(e),xe({eventName:`${g}/webSocket`,scanID:$,connection:"error",type:"measurement_recommendation",email:v})},onSuccess:e=>{xe({eventName:`${g}/webSocket`,scanID:$,connection:"success",type:"measurement_recommendation",email:v}),Q(e)}})},ee=i(async e=>{const t=Ce({gender:f,focal_length:`${w}`,height:`${y}`,customer_store_url:g,clothes_fit:"0",scan_type:m,callback_url:S||"https://example.com/webhook"});be({eventName:`${g}/body_scan_meta_data`,scanID:$,email:v,data:JSON.stringify(t)});try{await uh.fileUpload.uploadFileFrontend({file:e,arrayMetaData:t,scanId:$,email:v}),await uh.fileUpload.setDeviceInfo({model:b,detection:"manual",gyro:V,scanId:$}),console.log("video successfully uploaded"),U(!1),be({eventName:`${g}/scan_success`,scanID:$,status:"success",email:v,data:JSON.stringify(t)}),be({eventName:"scan finished",scanID:$,status:"success",email:v}),H(Se()),setTimeout(()=>{U(!0)},3e3)}catch(e){be({eventName:"scan finished",scanID:$,status:"failed",email:v,message:Te(e)}),be({eventName:`${g}/scan_failed`,scanID:$,status:"failed",email:v,message:Te(e),data:JSON.stringify(t)}),I(Te(e)),U(!1),console.log(e,"video upload failed")}finally{D(!1)}},[$,V]),te=i(async e=>{try{const t=await uh.measurement.getMeasurementResult(e),n=t?.data?.isMeasured,r=q||Se(),o=Se(),i=300;if(z(!1),!1===n)return X(),void W(Ee());k(!0),!0===n?await Q(null):null===n&&r>o+i?J(t?.data?.error):Z(e)}catch(e){console.log(e),X(),W(Ee()),k(!1)}},[J,Q,W]),ne=i(async()=>{if(+y<152.4||+y>213.36)return void h({message:"Height must be between 152.4cm (5ft) and 213.36cm (7ft)"});const e=await Pe();if(e.disabled)be({eventName:`${g}/camera_activation`,scanID:$,status:"failed",email:v}),z(!1);else{$?te($):z(!1),be({eventName:`${g}/camera_activation`,scanID:$,status:"success",email:v})}F(e),I(""),U(!1)},[te,v,$,W,g]);return c(()=>{Y?.(r),we.init(x,{api_host:R}),we.capture("$pageview")},[]),c(()=>{p||_||g&&ne()},[g,y,p,_]),c(()=>{p||_||M&&g&&$&&Z()},[M,g,$,p,_]),p?t(bt,{children:[e(gh,{}),e(Qe,{anchor:"bottom",open:!0,className:"camera-drawer",onClose:(e,t)=>{},children:e(vh,{scanFailsError:j||p,onNext:()=>{},setScanUniqueKey:W,gender:f,resolvedConfig:K,setIsVideoUploaded:U})})]}):_?e(wh,{isFaceScan:!1,scanId:$,isMeasurementAvailable:O,userDetails:n,isVideoUploadedCorrect:P,config:K,isSuccess:_}):L?e("div",{className:"flex top-0 !mt-0 left-0 z-[999] bg-opacity-80 bg-[#1b1b1b] absolute justify-center items-center w-full h-full",children:e(Re,{url:K?.loader})}):N.disabled?e(bt,{children:e(mh,{})}):E||j?!E&&!O||j?t(bt,{children:[e(gh,{}),e(Qe,{anchor:"bottom",open:!0,className:"camera-drawer",onClose:(e,t)=>{},children:e(vh,{scanFailsError:j,onNext:()=>{s?.(),G()},setScanUniqueKey:W,gender:f,resolvedConfig:K,setIsVideoUploaded:U})})]}):e(wh,{isFaceScan:!1,scanId:$,isMeasurementAvailable:O,userDetails:n,onComplete:u,isVideoUploadedCorrect:P,config:K}):e(Et.Provider,{value:{setStartGyro:D,handleFileUpload:ee,setUploadLoading:k},children:e(dt,{children:e(bt,{children:e(fh,{config:K,scanID:$,userDetails:n,setIsVideoUploaded:U,setScanFailsError:I,setScanStartTime:H,setScanUniqueKey:W})})})})};export{bh as BodyScan};
|
|
19
|
+
*/function Go(e,t){const n=/\$/g;let r=[e];if(null==t)return r;for(const e of Object.keys(t))if("_"!==e){let o=t[e];"string"==typeof o&&(o=n[Symbol.replace](o,"$$$$")),r=Ko(r,new RegExp(`%\\{${e}\\}`,"g"),o)}return r}const Jo=e=>{throw new Error(`missing string: ${e}`)};var Xo,Qo,Zo=Yo("onMissingKey"),ei=Yo("apply");class ti{constructor(e,t){let{onMissingKey:n=Jo}=void 0===t?{}:t;Object.defineProperty(this,ei,{value:ni}),Object.defineProperty(this,Zo,{writable:!0,value:void 0}),this.locale={strings:{},pluralize:e=>1===e?0:1},Array.isArray(e)?e.forEach(Ho(this,ei)[ei],this):Ho(this,ei)[ei](e),Ho(this,Zo)[Zo]=n}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let n=this.locale.strings[e];null==n&&(Ho(this,Zo)[Zo](e),n=e);if("object"==typeof n){if(t&&void 0!==t.smart_count){return Go(n[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 n)throw new Error("string was not a string");return Go(n,t)}}function ni(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 ri=fe((Qo||(Qo=1,Xo=function(){var e={},t=e._fns={};return e.emit=function(e,n,r,o,i,s,a){var l=function(e){for(var n=t[e]?t[e]:[],r=e.indexOf(":"),o=-1===r?[e]:[e.substring(0,r),e.substring(r+1)],i=Object.keys(t),s=0,a=i.length;s<a;s++){var l=i[s];if("*"===l&&(n=n.concat(t[l])),2===o.length&&o[0]===l){n=n.concat(t[l]);break}}return n}(e);l.length&&function(e,t,n){for(var r=0,o=t.length;r<o&&t[r];r++)t[r].event=e,t[r].apply(t[r],n)}(e,l,[n,r,o,i,s,a])},e.on=function(e,n){t[e]||(t[e]=[]),t[e].push(n)},e.once=function(t,n){this.on(t,function r(){n.apply(this,arguments),e.off(t,r)})},e.off=function(e,t){var n=[];if(e&&t)for(var r=this._fns[e],o=0,i=r?r.length:0;o<i;o++)r[o]!==t&&n.push(r[o]);n.length?this._fns[e]=n:delete this._fns[e]},e}),Xo));var oi,ii,si,ai,li,ci,ui,di,hi,pi,_i,fi,mi,gi,yi,vi,wi,bi,Si,Ei,ki,Pi,Ti,Oi,Ci,xi,Ri,Ai,Ni,Fi;function ji(){if(ii)return oi;return ii=1,oi=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},oi}function Ii(){if(ci)return li;ci=1;var e=function(){if(ai)return si;ai=1;var e="object"==typeof ye&&ye&&ye.Object===Object&&ye;return si=e}(),t="object"==typeof self&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return li=n}function Mi(){if(fi)return _i;fi=1;var e=function(){if(pi)return hi;pi=1;var e=/\s/;return hi=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}}(),t=/^\s+/;return _i=function(n){return n?n.slice(0,e(n)+1).replace(t,""):n}}function Ui(){if(gi)return mi;gi=1;var e=Ii().Symbol;return mi=e}function Li(){if(Ei)return Si;Ei=1;var e=Ui(),t=function(){if(vi)return yi;vi=1;var e=Ui(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;return yi=function(e){var t=n.call(e,o),i=e[o];try{e[o]=void 0;var s=!0}catch(e){}var a=r.call(e);return s&&(t?e[o]=i:delete e[o]),a},yi}(),n=function(){if(bi)return wi;bi=1;var e=Object.prototype.toString;return wi=function(t){return e.call(t)},wi}(),r=e?e.toStringTag:void 0;return Si=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)},Si}function zi(){if(Oi)return Ti;Oi=1;var e=Li(),t=(Pi||(Pi=1,ki=function(e){return null!=e&&"object"==typeof e}),ki);return Ti=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)},Ti}function Bi(){if(Ai)return Ri;Ai=1;var e=ji(),t=function(){if(di)return ui;di=1;var e=Ii();return ui=function(){return e.Date.now()}}(),n=function(){if(xi)return Ci;xi=1;var e=Mi(),t=ji(),n=zi(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;return Ci=function(a){if("number"==typeof a)return a;if(n(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=o.test(a);return c||i.test(a)?s(a.slice(2),c?2:8):r.test(a)?NaN:+a},Ci}(),r=Math.max,o=Math.min;return Ri=function(i,s,a){var l,c,u,d,h,p,_=0,f=!1,m=!1,g=!0;if("function"!=typeof i)throw new TypeError("Expected a function");function y(e){var t=l,n=c;return l=c=void 0,_=e,d=i.apply(n,t)}function v(e){var t=e-p;return void 0===p||t>=s||t<0||m&&e-_>=u}function w(){var e=t();if(v(e))return b(e);h=setTimeout(w,function(e){var t=s-(e-p);return m?o(t,u-(e-_)):t}(e))}function b(e){return h=void 0,g&&l?y(e):(l=c=void 0,d)}function S(){var e=t(),n=v(e);if(l=arguments,c=this,p=e,n){if(void 0===h)return function(e){return _=e,h=setTimeout(w,s),f?y(e):d}(p);if(m)return clearTimeout(h),h=setTimeout(w,s),y(p)}return void 0===h&&(h=setTimeout(w,s)),d}return s=n(s)||0,e(a)&&(f=!!a.leading,u=(m="maxWait"in a)?r(n(a.maxWait)||0,s):u,g="trailing"in a?!!a.trailing:g),S.cancel=function(){void 0!==h&&clearTimeout(h),_=0,l=p=c=h=void 0},S.flush=function(){return void 0===h?d:b(t())},S},Ri}var Di=function(){if(Fi)return Ni;Fi=1;var e=Bi(),t=ji();return Ni=function(n,r,o){var i=!0,s=!0;if("function"!=typeof n)throw new TypeError("Expected a function");return t(o)&&(i="leading"in o?!!o.leading:i,s="trailing"in o?!!o.trailing:s),e(n,r,{leading:i,maxWait:r,trailing:s})}}(),$i=fe(Di);function Wi(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var qi=0;function Hi(e){return"__private_"+qi+++"_"+e}var Vi=Hi("callbacks"),Yi=Hi("publish");class Ki{constructor(){Object.defineProperty(this,Yi,{value:Gi}),this.state={},Object.defineProperty(this,Vi,{writable:!0,value:new Set})}getState(){return this.state}setState(e){const t={...this.state},n={...this.state,...e};this.state=n,Wi(this,Yi)[Yi](t,n,e)}subscribe(e){return Wi(this,Vi)[Vi].add(e),()=>{Wi(this,Vi)[Vi].delete(e)}}}function Gi(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Wi(this,Vi)[Vi].forEach(e=>{e(...t)})}function Ji(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)}}Ki.VERSION="3.2.2";var Xi={__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 Qi(e){var t;if(e.type)return e.type;const n=e.name?null==(t=Ji(e.name).extension)?void 0:t.toLowerCase():null;return n&&n in Xi?Xi[n]:"application/octet-stream"}function Zi(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}function es(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 n=Qi(e);return function(e,t){let n=t||"uppy";return"string"==typeof e.name&&(n+=`-${Zi(e.name.toLowerCase())}`),void 0!==e.type&&(n+=`-${e.type}`),e.meta&&"string"==typeof e.meta.relativePath&&(n+=`-${Zi(e.meta.relativePath.toLowerCase())}`),void 0!==e.data.size&&(n+=`-${e.data.size}`),void 0!==e.data.lastModified&&(n+=`-${e.data.lastModified}`),n}({...e,type:n},t)}function ts(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 n=t[1].split(".",2),r=parseInt(n[0],10),o=parseInt(n[1],10);return r<15||15===r&&o<15063||(r>18||18===r&&o>=18218)}function ns(e){return e<10?`0${e}`:e.toString()}function rs(){const e=new Date;return`${ns(e.getHours())}:${ns(e.getMinutes())}:${ns(e.getSeconds())}`}const os={debug:()=>{},warn:()=>{},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.error(`[Uppy] [${rs()}]`,...t)}},is={debug:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.debug(`[Uppy] [${rs()}]`,...t)},warn:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.warn(`[Uppy] [${rs()}]`,...t)},error:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.error(`[Uppy] [${rs()}]`,...t)}};var ss,as;var ls,cs,us,ds,hs=(as||(as=1,ss=function(e){if("number"!=typeof e||Number.isNaN(e))throw new TypeError("Expected a number, got "+typeof e);const t=e<0;let n=Math.abs(e);if(t&&(n=-n),0===n)return"0 B";const r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],o=Math.min(Math.floor(Math.log(n)/Math.log(1024)),r.length-1),i=Number(n/1024**o),s=r[o];return`${i>=10||i%1==0?Math.round(i):i.toFixed(1)} ${s}`}),ss),ps=fe(hs);function _s(){if(cs)return ls;function e(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}return cs=1,e.prototype.match=function(e){var t,n,r=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(n=(e||"").split(this.separator),t=0;r&&t<i;t++)"*"!==o[t]&&(r=t<n.length&&o[t]===n[t]);r=r&&n}else r=!1;else if("function"==typeof e.splice)for(r=[],t=e.length;t--;)this.match(e[t])&&(r[r.length]=e[t]);else if("object"==typeof e)for(var s in r={},e)this.match(s)&&(r[s]=e[s]);return r},ls=function(t,n,r){var o=new e(t,r||/[\/\.]/);return void 0!==n?o.match(n):o},ls}var fs=function(){if(ds)return us;ds=1;var e=_s(),t=/[\/\+\.]/;return us=function(n,r){function o(r){var o=e(r,n,t);return o&&o.length>=2}return r?o(r.split(";")[0]):o},us}(),ms=fe(fs);const gs={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class ys extends Error{constructor(e,t){var n;super(e),this.isRestriction=!0,this.isUserFacing=null==(n=null==t?void 0:t.isUserFacing)||n,null!=t&&t.file&&(this.file=t.file)}}class vs{constructor(e,t){this.getI18n=t,this.getOpts=()=>{var t;const n=e();if(null!=(null==(t=n.restrictions)?void 0:t.allowedFileTypes)&&!Array.isArray(n.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return n}}validateAggregateRestrictions(e,t){const{maxTotalFileSize:n,maxNumberOfFiles:r}=this.getOpts().restrictions;if(r){if(e.filter(e=>!e.isGhost).length+t.length>r)throw new ys(`${this.getI18n()("youCanOnlyUploadX",{smart_count:r})}`)}if(n){const r=[...e,...t].reduce((e,t)=>{var n;return e+(null!=(n=t.size)?n:0)},0);if(r>n)throw new ys(this.getI18n()("aggregateExceedsSize",{sizeAllowed:ps(n),size:ps(r)}))}}validateSingleFile(e){const{maxFileSize:t,minFileSize:n,allowedFileTypes:r}=this.getOpts().restrictions;if(r){if(!r.some(t=>t.includes("/")?!!e.type&&ms(e.type.replace(/;.*?$/,""),t):!("."!==t[0]||!e.extension)&&e.extension.toLowerCase()===t.slice(1).toLowerCase())){const t=r.join(", ");throw new ys(this.getI18n()("youCanOnlyUploadFileTypes",{types:t}),{file:e})}}if(t&&null!=e.size&&e.size>t)throw new ys(this.getI18n()("exceedsSize",{size:ps(t),file:e.name}),{file:e});if(n&&null!=e.size&&e.size<n)throw new ys(this.getI18n()("inferiorSize",{size:ps(n)}),{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 ys(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){const t=new ys(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name})),{requiredMetaFields:n}=this.getOpts().restrictions,r=[];for(const t of n)Object.hasOwn(e.meta,t)&&""!==e.meta[t]||r.push(t);return{missingFields:r,error:t}}}var ws={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 bs,Ss;function Es(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var ks=0;function Ps(e){return"__private_"+ks+++"_"+e}const Ts={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var Os=Ps("plugins"),Cs=Ps("restricter"),xs=Ps("storeUnsubscribe"),Rs=Ps("emitter"),As=Ps("preProcessors"),Ns=Ps("uploaders"),Fs=Ps("postProcessors"),js=Ps("informAndEmit"),Is=Ps("checkRequiredMetaFieldsOnFile"),Ms=Ps("checkRequiredMetaFields"),Us=Ps("assertNewUploadAllowed"),Ls=Ps("transformFile"),zs=Ps("startIfAutoProceed"),Bs=Ps("checkAndUpdateFileState"),Ds=Ps("addListeners"),$s=Ps("updateOnlineStatus"),Ws=Ps("requestClientById"),qs=Ps("createUpload"),Hs=Ps("getUpload"),Vs=Ps("removeUpload"),Ys=Ps("runUpload");bs=Symbol.for("uppy test: getPlugins"),Ss=Symbol.for("uppy test: createUpload");class Ks{constructor(e){Object.defineProperty(this,Ys,{value:sa}),Object.defineProperty(this,Vs,{value:ia}),Object.defineProperty(this,Hs,{value:oa}),Object.defineProperty(this,qs,{value:ra}),Object.defineProperty(this,Ds,{value:na}),Object.defineProperty(this,Bs,{value:ta}),Object.defineProperty(this,zs,{value:ea}),Object.defineProperty(this,Ls,{value:Zs}),Object.defineProperty(this,Us,{value:Qs}),Object.defineProperty(this,Ms,{value:Xs}),Object.defineProperty(this,Is,{value:Js}),Object.defineProperty(this,js,{value:Gs}),Object.defineProperty(this,Os,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,Cs,{writable:!0,value:void 0}),Object.defineProperty(this,xs,{writable:!0,value:void 0}),Object.defineProperty(this,Rs,{writable:!0,value:ri()}),Object.defineProperty(this,As,{writable:!0,value:new Set}),Object.defineProperty(this,Ns,{writable:!0,value:new Set}),Object.defineProperty(this,Fs,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,this.calculateProgress=$i((e,t)=>{const n=this.getFile(null==e?void 0:e.id);if(null==e||!n)return void this.log(`Not setting progress for a file that has been removed: ${null==e?void 0:e.id}`);if(100===n.progress.percentage)return void this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);const r=Number.isFinite(t.bytesTotal)&&t.bytesTotal>0;this.setFileState(e.id,{progress:{...n.progress,bytesUploaded:t.bytesUploaded,bytesTotal:t.bytesTotal,percentage:r?Math.round(t.bytesUploaded/t.bytesTotal*100):0}}),this.calculateTotalProgress()},500,{leading:!0,trailing:!0}),Object.defineProperty(this,$s,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,Ws,{writable:!0,value:new Map}),this.defaultLocale=ws;const t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:gs,meta:{},onBeforeFileAdded:(e,t)=>!Object.hasOwn(t,e.id),onBeforeUpload:e=>e,store:new Ki,logger:os,infoTimeout:5e3},n={...t,...e};this.opts={...n,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=is),this.log(`Using Core v${Ks.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Ts,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:ts(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Es(this,Cs)[Cs]=new vs(()=>this.opts,()=>this.i18n),Es(this,xs)[xs]=this.store.subscribe((e,t,n)=>{this.emit("state-update",e,t,n),this.updateAll(t)}),this.opts.debug&&"undefined"!=typeof window&&(window[this.opts.id]=this),Es(this,Ds)[Ds]()}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Es(this,Rs)[Rs].emit(e,...n)}on(e,t){return Es(this,Rs)[Rs].on(e,t),this}once(e,t){return Es(this,Rs)[Rs].once(e,t),this}off(e,t){return Es(this,Rs)[Rs].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[n,r]=e;return[n,{...t[n],...r}]}))}})}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 ti([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},n={};Object.keys(t).forEach(r=>{n[r]={...t[r],progress:{...t[r].progress,...e}}}),this.setState({files:n,...Ts}),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({...Ts,files:{}})}addPreProcessor(e){Es(this,As)[As].add(e)}removePreProcessor(e){return Es(this,As)[As].delete(e)}addPostProcessor(e){Es(this,Fs)[Fs].add(e)}removePostProcessor(e){return Es(this,Fs)[Fs].delete(e)}addUploader(e){Es(this,Ns)[Ns].add(e)}removeUploader(e){return Es(this,Ns)[Ns].delete(e)}setMeta(e){const t={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(t=>{n[t]={...n[t],meta:{...n[t].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:n})}setFileMeta(e,t){const n={...this.getState().files};if(!n[e])return void this.log("Was trying to set metadata for a file that has been removed: ",e);const r={...n[e].meta,...t};n[e]={...n[e],meta:r},this.setState({files:n})}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:n}=this.getState(),r=Object.values(e),o=[],i=[],s=[],a=[],l=[],c=[],u=[],d=[],h=[];for(const e of r){const{progress:t}=e;!t.uploadComplete&&t.uploadStarted&&(o.push(e),e.isPaused||d.push(e)),t.uploadStarted||i.push(e),(t.uploadStarted||t.preprocess||t.postprocess)&&s.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)&&h.push(e)}return{newFiles:i,startedFiles:s,uploadStartedFiles:a,pausedFiles:l,completeFiles:c,erroredFiles:u,inProgressFiles:o,inProgressNotPausedFiles:d,processingFiles:h,isUploadStarted:a.length>0,isAllComplete:100===t&&c.length===r.length&&0===h.length,isAllErrored:!!n&&u.length===r.length,isAllPaused:0!==o.length&&l.length===o.length,isUploadInProgress:o.length>0,isSomeGhost:r.some(e=>e.isGhost)}}validateRestrictions(e,t){void 0===t&&(t=this.getFiles());try{Es(this,Cs)[Cs].validate(t,[e])}catch(e){return e}return null}checkIfFileAlreadyExists(e){const{files:t}=this.getState();return!(!t[e]||t[e].isGhost)}addFile(e){Es(this,Us)[Us](e);const{nextFilesState:t,validFilesToAdd:n,errors:r}=Es(this,Bs)[Bs]([e]),o=r.filter(e=>e.isRestriction);if(Es(this,js)[js](o),r.length>0)throw r[0];this.setState({files:t});const[i]=n;return this.emit("file-added",i),this.emit("files-added",n),this.log(`Added file: ${i.name}, ${i.id}, mime type: ${i.type}`),Es(this,zs)[zs](),i.id}addFiles(e){Es(this,Us)[Us]();const{nextFilesState:t,validFilesToAdd:n,errors:r}=Es(this,Bs)[Bs](e),o=r.filter(e=>e.isRestriction);Es(this,js)[js](o);const i=r.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}),n.forEach(e=>{this.emit("file-added",e)}),this.emit("files-added",n),n.length>5?this.log(`Added batch of ${n.length} files`):Object.values(n).forEach(e=>{this.log(`Added file: ${e.name}\n id: ${e.id}\n type: ${e.type}`)}),n.length>0&&Es(this,zs)[zs]()}removeFiles(e,t){const{files:n,currentUploads:r}=this.getState(),o={...n},i={...r},s=Object.create(null);function a(e){return void 0===s[e]}e.forEach(e=>{n[e]&&(s[e]=n[e],delete o[e])}),Object.keys(i).forEach(e=>{const t=r[e].fileIDs.filter(a);if(0===t.length)return void delete i[e];const{capabilities:n}=this.getState();if(t.length!==r[e].fileIDs.length&&!n.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");i[e]={...r[e],fileIDs:t}});const l={currentUploads:i,files:o};0===Object.keys(o).length&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),this.calculateTotalProgress();const c=Object.keys(s);c.forEach(e=>{this.emit("file-removed",s[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 n={...e[t],isPaused:!0};e[t]=n}),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 n={...e[t],isPaused:!1,error:null};e[t]=n}),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 n={...e[t],isPaused:!1,error:null};e[t]=n}),this.setState({files:e,error:null}),this.emit("retry-all",t),0===t.length)return Promise.resolve({successful:[],failed:[]});const n=Es(this,qs)[qs](t,{forceAllowNewUpload:!0});return Es(this,Ys)[Ys](n)}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(Ts)}}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",e);const t=Es(this,qs)[qs]([e],{forceAllowNewUpload:!0});return Es(this,Ys)[Ys](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),n=e.filter(e=>null==e.progress.bytesTotal);if(0===t.length){const t=100*e.length,r=n.reduce((e,t)=>e+t.progress.percentage,0),o=Math.round(r/t*100);return void this.setState({totalProgress:o})}let r=t.reduce((e,t)=>{var n;return e+(null!=(n=t.progress.bytesTotal)?n:0)},0);const o=r/t.length;r+=o*n.length;let i=0;t.forEach(e=>{i+=e.progress.bytesUploaded}),n.forEach(e=>{i+=o*(e.progress.percentage||0)/100});let s=0===r?0:Math.round(i/r*100);s>100&&(s=100),this.setState({totalProgress:s}),this.emit("progress",s)}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 n=new e(this,t),r=n.id;if(!r)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");const o=this.getPlugin(r);if(o){const e=`Already found a plugin named '${o.id}'. Tried to use: '${r}'.\nUppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.`;throw new Error(e)}return e.VERSION&&this.log(`Using ${r} v${e.VERSION}`),n.type in Es(this,Os)[Os]?Es(this,Os)[Os][n.type].push(n):Es(this,Os)[Os][n.type]=[n],n.install(),this.emit("plugin-added",n),this}getPlugin(e){for(const t of Object.values(Es(this,Os)[Os])){const n=t.find(t=>t.id===e);if(null!=n)return n}}[bs](e){return Es(this,Os)[Os][e]}iteratePlugins(e){Object.values(Es(this,Os)[Os]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const t=Es(this,Os)[Os][e.type],n=t.findIndex(t=>t.id===e.id);-1!==n&&t.splice(n,1);const r={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(r)}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}),Es(this,xs)[xs](),this.iteratePlugins(e=>{this.removePlugin(e)}),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",Es(this,$s)[$s]),window.removeEventListener("offline",Es(this,$s)[$s]))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,n){void 0===t&&(t="info"),void 0===n&&(n=3e3);const r="object"==typeof e;this.setState({info:[...this.getState().info,{type:t,message:r?e.message:e,details:r?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,t){const{logger:n}=this.opts;switch(t){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e)}}registerRequestClient(e,t){Es(this,Ws)[Ws].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const t=Es(this,Ws)[Ws].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]?Es(this,Ys)[Ys](e):(Es(this,Vs)[Vs](e),Promise.reject(new Error("Nonexistent upload")))}[Ss](){return Es(this,qs)[qs](...arguments)}addResultData(e,t){if(!Es(this,Hs)[Hs](e))return void this.log(`Not setting result for an upload that has been removed: ${e}`);const{currentUploads:n}=this.getState(),r={...n[e],result:{...n[e].result,...t}};this.setState({currentUploads:{...n,[e]:r}})}upload(){var e;null!=(e=Es(this,Os)[Os].uploader)&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();const n=this.opts.onBeforeUpload(t);return!1===n?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(n&&"object"==typeof n&&(t=n,this.setState({files:t})),Promise.resolve().then(()=>Es(this,Cs)[Cs].validateMinNumberOfFiles(t)).catch(e=>{throw Es(this,js)[js]([e]),e}).then(()=>{if(!Es(this,Ms)[Ms](t))throw new ys(this.i18n("missingRequiredMetaField"))}).catch(e=>{throw e}).then(()=>{const{currentUploads:e}=this.getState(),n=Object.values(e).flatMap(e=>e.fileIDs),r=[];Object.keys(t).forEach(e=>{const t=this.getFile(e);t.progress.uploadStarted||-1!==n.indexOf(e)||r.push(t.id)});const o=Es(this,qs)[qs](r);return Es(this,Ys)[Ys](o)}).catch(e=>{throw this.emit("error",e),this.log(e,"error"),e}))}}function Gs(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),n=t.slice(0,4),r=t.slice(4);n.forEach(e=>{let{message:t,details:n=""}=e;this.info({message:t,details:n},"error",this.opts.infoTimeout)}),r.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:r.length})})}function Js(e){const{missingFields:t,error:n}=Es(this,Cs)[Cs].getMissingRequiredMetaFields(e);return!(t.length>0)||(this.setFileState(e.id,{missingRequiredMetaFields:t}),this.log(n.message),this.emit("restriction-failed",e,n),!1)}function Xs(e){let t=!0;for(const n of Object.values(e))Es(this,Is)[Is](n)||(t=!1);return t}function Qs(e){const{allowNewUpload:t}=this.getState();if(!1===t){const t=new ys(this.i18n("noMoreFilesAllowed"),{file:e});throw Es(this,js)[js]([t]),t}}function Zs(e){const t=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e}:e,n=Qi(t),r=function(e,t){return t.name?t.name:"image"===e.split("/")[0]?`${e.split("/")[0]}.${e.split("/")[1]}`:"noname"}(n,t),o=Ji(r).extension,i=es(t,this.getID()),s=t.meta||{};s.name=r,s.type=n;const a=Number.isFinite(t.data.size)?t.data.size:null;return{source:t.source||"",id:i,name:r,extension:o||"",meta:{...this.getState().meta,...s},type:n,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 ea(){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 ta(e){const{files:t}=this.getState(),n={...t},r=[],o=[];for(const s of e)try{var i;let e=Es(this,Ls)[Ls](s);const o=null==(i=t[e.id])?void 0:i.isGhost;if(o){e={...t[e.id],isGhost:!1,data:s.data},this.log(`Replaced the blob in the restored ghost file: ${e.name}, ${e.id}`)}const a=this.opts.onBeforeFileAdded(e,n);if(!a&&this.checkIfFileAlreadyExists(e.id))throw new ys(this.i18n("noDuplicates",{fileName:e.name}),{file:s});if(!1===a&&!o)throw new ys("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:s});"object"==typeof a&&null!==a&&(e=a),Es(this,Cs)[Cs].validateSingleFile(e),n[e.id]=e,r.push(e)}catch(e){o.push(e)}try{Es(this,Cs)[Cs].validateAggregateRestrictions(Object.values(t),r)}catch(e){return o.push(e),{nextFilesState:t,validFilesToAdd:[],errors:o}}return{nextFilesState:n,validFilesToAdd:r,errors:o}}function na(){const e=(e,t,n)=>{let r=e.message||"Unknown error";e.details&&(r+=` ${e.details}`),this.setState({error:r}),null!=t&&t.id in this.getState().files&&this.setFileState(t.id,{error:r,response:n})};this.on("error",e),this.on("upload-error",(t,n,r)=>{if(e(n,t,r),"object"==typeof n&&n.message){var o;this.log(n.message,"error");const e=new Error(this.i18n("failedToUpload",{file:null!=(o=null==t?void 0:t.name)?o:""}));e.isUserFacing=!0,e.details=n.message,n.details&&(e.details+=` ${n.details}`),Es(this,js)[js]([e])}else Es(this,js)[js]([n])});let t=null;this.on("upload-stalled",(e,n)=>{const{message:r}=e,o=n.map(e=>e.meta.name).join(", ");t||(this.info({message:r,details:o},"warning",this.opts.infoTimeout),t=setTimeout(()=>{t=null},this.opts.infoTimeout)),this.log(`${r} ${o}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const n=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}),n=Object.fromEntries(t.map(e=>[e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}]));this.patchFilesState(n)};this.on("upload-start",e=>{e.forEach(e=>{this.emit("upload-started",e)}),n(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 n=this.getFile(e.id).progress;this.setFileState(e.id,{progress:{...n,postprocess:Es(this,Fs)[Fs].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:n.bytesTotal},response:t,uploadURL:t.uploadURL,isPaused:!1}),null==e.size&&this.setFileState(e.id,{size:t.bytesUploaded||n.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&&Es(this,Is)[Is](e)}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",Es(this,$s)[$s]),window.addEventListener("offline",Es(this,$s)[$s]),setTimeout(Es(this,$s)[$s],3e3))}function ra(e,t){void 0===t&&(t={});const{forceAllowNewUpload:n=!1}=t,{allowNewUpload:r,currentUploads:o}=this.getState();if(!r&&!n)throw new Error("Cannot create a new upload: already uploading.");const i=((e=21)=>{let t="",n=e;for(;n--;)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:{...o,[i]:{fileIDs:e,step:0,result:{}}}}),i}function oa(e){const{currentUploads:t}=this.getState();return t[e]}function ia(e){const t={...this.getState().currentUploads};delete t[e],this.setState({currentUploads:t})}async function sa(e){const t=()=>{const{currentUploads:t}=this.getState();return t[e]};let n=t();const r=[...Es(this,As)[As],...Es(this,Ns)[Ns],...Es(this,Fs)[Fs]];try{for(let o=n.step||0;o<r.length&&n;o++){const i=r[o];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...n,step:o}}});const{fileIDs:s}=n;await i(s,e),n=t()}}catch(t){throw Es(this,Vs)[Vs](e),t}if(n){n.fileIDs.forEach(e=>{const t=this.getFile(e);t&&t.progress.postprocess&&this.emit("postprocess-complete",t)});const r=n.fileIDs.map(e=>this.getFile(e)),o=r.filter(e=>!e.error),i=r.filter(e=>e.error);this.addResultData(e,{successful:o,failed:i,uploadID:e}),n=t()}let o;return n&&(o=n.result,this.emit("complete",o),Es(this,Vs)[Vs](e)),null==o&&this.log(`Not setting result for an upload that has been removed: ${e}`),o}Ks.VERSION="3.13.1";class aa{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 ti([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 la extends Error{constructor(){super(...arguments),this.name="UserFacingApiError"}}var ca,ua,da,ha,pa,_a={};function fa(){return da||(da=1,e=_a,t=function(){if(ua)return ca;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 ua=1,ca=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 n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),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 n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._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,n=0,r=0;r<this._errors.length;r++){var o=this._errors[r],i=o.message,s=(e[i]||0)+1;e[i]=s,s>=n&&(t=o,n=s)}return t},ca}(),e.operation=function(n){var r=e.timeouts(n);return new t(r,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.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 n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],o=0;o<t.retries;o++)r.push(this.createTimeout(o,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(o,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout)},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var o in r=[],t)"function"==typeof t[o]&&r.push(o);for(var i=0;i<r.length;i++){var s=r[i],a=t[s];t[s]=function(r){var o=e.operation(n),i=Array.prototype.slice.call(arguments,1),s=i.pop();i.push(function(e){o.retry(e)||(e&&(arguments[0]=o.mainError()),s.apply(this,arguments))}),o.attempt(function(){r.apply(t,i)})}.bind(t,a),t[s].options=n}}),_a;var e,t}var ma=fe(pa?ha:(pa=1,ha=fa()));const ga=Object.prototype.toString,ya=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 va(e){const t=e&&(e=>"[object Error]"===ga.call(e))(e)&&"TypeError"===e.name&&"string"==typeof e.message;if(!t)return!1;const{message:n,stack:r}=e;return"Load failed"===n?void 0===r||"__sentry_captured__"in e:!!n.startsWith("error sending request for url")||ya.has(n)}class wa 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 ba=(e,t,n)=>{const r=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=r,e};async function Sa(e,t){return new Promise((n,r)=>{t={...t},t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.retries??=10;const o=ma.operation(t),i=()=>{o.stop(),r(t.signal?.reason)};t.signal&&!t.signal.aborted&&t.signal.addEventListener("abort",i,{once:!0});const s=()=>{t.signal?.removeEventListener("abort",i),o.stop()};o.attempt(async i=>{try{const t=await e(i);s(),n(t)}catch(e){try{if(!(e instanceof Error))throw new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(e instanceof wa)throw e.originalError;if(e instanceof TypeError&&!va(e))throw e;if(ba(e,i,t),await t.shouldRetry(e)||(o.stop(),r(e)),await t.onFailedAttempt(e),!o.retry(e))throw o.mainError()}catch(e){ba(e,i,t),s(),r(e)}}})})}class Ea 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 ka(e,t){return Object.prototype.hasOwnProperty.call(e,t)}class Pa extends Error{constructor(e,t){super(e),this.cause=null==t?void 0:t.cause,this.cause&&ka(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}var Ta=$i(function(e,t,n){const{progress:r,bytesUploaded:o,bytesTotal:i}=t;r&&(e.uppy.log(`Upload progress: ${r}`),e.uppy.emit("upload-progress",n,{uploader:e,bytesUploaded:o,bytesTotal:i}))},300,{leading:!0,trailing:!0});class Oa extends Error{constructor(){super("Authorization required"),this.name="AuthError",this.isAuthError=!0}}let Ca;function xa(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ra=0;function Aa(e){return"__private_"+Ra+++"_"+e}class Na extends Error{constructor(e){let{statusCode:t,message:n}=e;super(n),this.name="HttpError",this.statusCode=t}}var Fa=Aa("companionHeaders"),ja=Aa("getUrl"),Ia=Aa("requestSocketToken"),Ma=Aa("awaitRemoteFileUpload");Ca=Symbol.for("uppy test: getCompanionHeaders");class Ua{constructor(e,t){Object.defineProperty(this,Ma,{value:za}),Object.defineProperty(this,ja,{value:La}),Object.defineProperty(this,Fa,{writable:!0,value:void 0}),Object.defineProperty(this,Ia,{writable:!0,value:async e=>{var t;let{file:n,postBody:r,signal:o}=e;if(null==(null==(t=n.remote)?void 0:t.url))throw new Error("Cannot connect to an undefined URL");return(await this.post(n.remote.url,{...n.remote.body,...r},{signal:o})).token}}),this.uppy=e,this.opts=t,this.onReceiveResponse=this.onReceiveResponse.bind(this),xa(this,Fa)[Fa]=null==t?void 0:t.companionHeaders}setCompanionHeaders(e){xa(this,Fa)[Fa]=e}[Ca](){return xa(this,Fa)[Fa]}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"}},...xa(this,Fa)[Fa]}}onReceiveResponse(e){const{headers:t}=e,n=this.uppy.getState().companion||{},r=this.opts.companionUrl;t.has("i-am")&&t.get("i-am")!==n[r]&&this.uppy.setState({companion:{...n,[r]:t.get("i-am")}})}async request(e){let{path:t,method:n="GET",data:r,skipPostResponse:o,signal:i}=e;try{const e=await this.headers(!r),s=await function(){return fetch(...arguments).catch(e=>{throw"AbortError"===e.name?e:new Ea(e)})}(xa(this,ja)[ja](t),{method:n,signal:i,headers:e,credentials:this.opts.companionCookiesRule||"same-origin",body:r?JSON.stringify(r):null});return o||this.onReceiveResponse(s),await async function(e){if(401===e.status)throw new Oa;if(e.ok)return e.json();let t,n=`Failed request with status: ${e.status}. ${e.statusText}`;try{t=await e.json(),t.message&&(n=`${n} message: ${t.message}`),t.requestId&&(n=`${n} request-Id: ${t.requestId}`)}catch(e){throw new Error(n,{cause:e})}if(e.status>=400&&e.status<=499&&t.message)throw new la(t.message);throw new Na({statusCode:e.status,message:n})}(s)}catch(e){if(e.isAuthError||"UserFacingApiError"===e.name||"AbortError"===e.name)throw e;throw new Pa(`Could not ${n} ${xa(this,ja)[ja](t)}`,{cause:e})}}async get(e,t){return"boolean"==typeof t&&(t={skipPostResponse:t}),this.request({...t,path:e})}async post(e,t,n){return"boolean"==typeof n&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"POST",data:t})}async delete(e,t,n){return"boolean"==typeof n&&(n={skipPostResponse:n}),this.request({...n,path:e,method:"DELETE",data:t})}async uploadRemoteFile(e,t,n){var r=this;try{const{signal:o,getQueue:i}=n||{};return await Sa(async()=>{var n;const s=null==(n=this.uppy.getFile(e.id))?void 0:n.serverToken;if(null!=s)return this.uppy.log(`Connecting to exiting websocket ${s}`),xa(this,Ma)[Ma]({file:e,queue:i(),signal:o});const a=i().wrapPromiseFunction(async function(){try{return await xa(r,Ia)[Ia](...arguments)}catch(e){if(e.isAuthError)throw new wa(e);if(null==e.cause)throw e;const t=e.cause,n=()=>[408,409,429,418,423].includes(t.statusCode)||t.statusCode>=500&&t.statusCode<=599&&![501,505].includes(t.statusCode);if("HttpError"===t.name&&!n())throw new wa(t);throw t}},{priority:-1}),l=await a({file:e,postBody:t,signal:o}).abortOn(o);return this.uppy.getFile(e.id)?(this.uppy.setFileState(e.id,{serverToken:l}),xa(this,Ma)[Ma]({file:this.uppy.getFile(e.id),queue:i(),signal:o})):void 0},{retries:10,signal:o,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 La(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`}async function za(e){let t,{file:n,queue:r,signal:o}=e;const{capabilities:i}=this.uppy.getState();try{return await new Promise((e,s)=>{const a=n.serverToken,l=function(e){var t;const n=null==(t=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/i.exec(e))?void 0:t[1];return`${/^http:\/\//i.test(e)?"ws":"wss"}://${n}`}(n.remote.companionUrl);let c,u,d,{isPaused:h}=n;const p=(e,t)=>{var r;null!=c&&c.readyState===c.OPEN?c.send(JSON.stringify({action:e,payload:null!=t?t:{}})):this.uppy.log(`Cannot send "${e}" to socket ${n.id} because the socket state was ${String(null==(r=c)?void 0:r.readyState)}`,"warning")};function _(){i.resumableUploads&&p(h?"pause":"resume")}const f=async()=>{u&&u.abort(),u=new AbortController;const t=e=>{var t;this.uppy.setFileState(n.id,{serverToken:null}),null==(t=u)||null==t.abort||t.abort(),s(e)};function o(){clearTimeout(d),h||(d=setTimeout(()=>t(new Error("Timeout waiting for message from Companion socket")),3e5))}try{await r.wrapPromiseFunction(async()=>{await Sa(async()=>new Promise((r,i)=>{c=new WebSocket(`${l}/api/${a}`),o(),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",()=>{_()}),c.addEventListener("message",r=>{o();try{const{action:t,payload:o}=JSON.parse(r.data);switch(t){case"progress":Ta(this,o,this.uppy.getFile(n.id));break;case"success":{var i,s,a,l;const t=null==(i=o.response)?void 0:i.responseText;this.uppy.emit("upload-success",this.uppy.getFile(n.id),{uploadURL:o.url,status:null!=(s=null==(a=o.response)?void 0:a.status)?s:200,body:t?JSON.parse(t):void 0}),null==(l=u)||null==l.abort||l.abort(),e();break}case"error":{const{message:e}=o.error;throw Object.assign(new Error(e),{cause:o.error})}default:this.uppy.log(`Companion socket unknown action ${t}`,"warning")}}catch(e){t(e)}});const s=()=>{this.uppy.log(`Closing socket ${n.id}`,"info"),clearTimeout(d),c&&c.close(),c=void 0};u.signal.addEventListener("abort",()=>{s()})}),{retries:10,signal:u.signal,onFailedAttempt:()=>{u.signal.aborted||this.uppy.log(`Retrying websocket ${n.id}`,"info")}})})().abortOn(u.signal)}catch(e){if(u.signal.aborted)return;t(e)}},m=e=>{var t;i.resumableUploads&&(h=e,c&&_(),e?null==(t=u)||null==t.abort||t.abort():f())},g=t=>{var r;i.individualCancellation&&t.id===n.id&&(p("cancel"),null==(r=u)||null==r.abort||r.abort(),this.uppy.log(`upload ${n.id} was removed`,"info"),e())},y=t=>{var r;let{reason:o}=t;"user"===o&&p("cancel"),null==(r=u)||null==r.abort||r.abort(),this.uppy.log(`upload ${n.id} was canceled`,"info"),e()},v=(e,t)=>{e===n.id&&m(t)},w=()=>m(!0),b=()=>m(!1);this.uppy.on("file-removed",g),this.uppy.on("cancel-all",y),this.uppy.on("upload-pause",v),this.uppy.on("pause-all",w),this.uppy.on("resume-all",b),t=()=>{this.uppy.off("file-removed",g),this.uppy.off("cancel-all",y),this.uppy.off("upload-pause",v),this.uppy.off("pause-all",w),this.uppy.off("resume-all",b)},o.addEventListener("abort",()=>{var e;null==(e=u)||e.abort()}),f()})}finally{null==t||t()}}function Ba(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}Ua.VERSION="3.8.2";var Da=0;function $a(e){return"__private_"+Da+++"_"+e}var Wa=$a("uppy"),qa=$a("events");class Ha{constructor(e){Object.defineProperty(this,Wa,{writable:!0,value:void 0}),Object.defineProperty(this,qa,{writable:!0,value:[]}),Ba(this,Wa)[Wa]=e}on(e,t){return Ba(this,qa)[qa].push([e,t]),Ba(this,Wa)[Wa].on(e,t)}remove(){for(const[e,t]of Ba(this,qa)[qa].splice(0))Ba(this,Wa)[Wa].off(e,t)}onFilePause(e,t){this.on("upload-pause",(n,r)=>{e===n&&t(r)})}onFileRemove(e,t){this.on("file-removed",n=>{e===n.id&&t(n.id)})}onPause(e,t){this.on("upload-pause",(n,r)=>{e===n&&t(r)})}onRetry(e,t){this.on("upload-retry",n=>{e===n&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{Ba(this,Wa)[Wa].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{Ba(this,Wa)[Wa].getFile(e)&&t()})}onCancelAll(e,t){var n=this;this.on("cancel-all",function(){Ba(n,Wa)[Wa].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{Ba(this,Wa)[Wa].getFile(e)&&t()})}}function Va(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ya=0;function Ka(e){return"__private_"+Ya+++"_"+e}function Ga(e){if(null!=e){var t;const n=()=>this.abort(e.reason);e.addEventListener("abort",n,{once:!0});const r=()=>{e.removeEventListener("abort",n)};null==(t=this.then)||t.call(this,r,r)}return this}var Ja=Ka("activeRequests"),Xa=Ka("queuedHandlers"),Qa=Ka("paused"),Za=Ka("pauseTimer"),el=Ka("downLimit"),tl=Ka("upperLimit"),nl=Ka("rateLimitingTimer"),rl=Ka("call"),ol=Ka("queueNext"),il=Ka("next"),sl=Ka("queue"),al=Ka("dequeue"),ll=Ka("resume"),cl=Ka("increaseLimit");class ul{constructor(e){Object.defineProperty(this,al,{value:fl}),Object.defineProperty(this,sl,{value:_l}),Object.defineProperty(this,il,{value:pl}),Object.defineProperty(this,ol,{value:hl}),Object.defineProperty(this,rl,{value:dl}),Object.defineProperty(this,Ja,{writable:!0,value:0}),Object.defineProperty(this,Xa,{writable:!0,value:[]}),Object.defineProperty(this,Qa,{writable:!0,value:!1}),Object.defineProperty(this,Za,{writable:!0,value:void 0}),Object.defineProperty(this,el,{writable:!0,value:1}),Object.defineProperty(this,tl,{writable:!0,value:void 0}),Object.defineProperty(this,nl,{writable:!0,value:void 0}),Object.defineProperty(this,ll,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,cl,{writable:!0,value:()=>{if(Va(this,Qa)[Qa])Va(this,nl)[nl]=setTimeout(Va(this,cl)[cl],0);else{Va(this,el)[el]=this.limit,this.limit=Math.ceil((Va(this,tl)[tl]+Va(this,el)[el])/2);for(let e=Va(this,el)[el];e<=this.limit;e++)Va(this,ol)[ol]();Va(this,tl)[tl]-Va(this,el)[el]>3?Va(this,nl)[nl]=setTimeout(Va(this,cl)[cl],2e3):Va(this,el)[el]=Math.floor(Va(this,el)[el]/2)}}}),this.limit="number"!=typeof e||0===e?1/0:e}run(e,t){return!Va(this,Qa)[Qa]&&Va(this,Ja)[Ja]<this.limit?Va(this,rl)[rl](e):Va(this,sl)[sl](e,t)}wrapSyncFunction(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];const s=n.run(()=>(e(...o),queueMicrotask(()=>s.done()),()=>{}),t);return{abortOn:Ga,abort(){s.abort()}}}}wrapPromiseFunction(e,t){var n=this;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];let s;const a=new Promise((r,i)=>{s=n.run(()=>{let t,n;try{n=Promise.resolve(e(...o))}catch(e){n=Promise.reject(e)}return n.then(e=>{t?i(t):(s.done(),r(e))},e=>{t?i(t):(s.done(),i(e))}),e=>{t=function(e){return new Error("Cancelled",{cause:e})}(e)}},t)});return a.abort=e=>{s.abort(e)},a.abortOn=Ga,a}}resume(){Va(this,Qa)[Qa]=!1,clearTimeout(Va(this,Za)[Za]);for(let e=0;e<this.limit;e++)Va(this,ol)[ol]()}pause(e){void 0===e&&(e=null),Va(this,Qa)[Qa]=!0,clearTimeout(Va(this,Za)[Za]),null!=e&&(Va(this,Za)[Za]=setTimeout(Va(this,ll)[ll],e))}rateLimit(e){clearTimeout(Va(this,nl)[nl]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(Va(this,tl)[tl]=this.limit-1,this.limit=Va(this,el)[el],Va(this,nl)[nl]=setTimeout(Va(this,cl)[cl],e))}get isPaused(){return Va(this,Qa)[Qa]}}function dl(e){Va(this,Ja)[Ja]+=1;let t,n=!1;try{t=e()}catch(e){throw Va(this,Ja)[Ja]-=1,e}return{abort:e=>{n||(n=!0,Va(this,Ja)[Ja]-=1,null==t||t(e),Va(this,ol)[ol]())},done:()=>{n||(n=!0,Va(this,Ja)[Ja]-=1,Va(this,ol)[ol]())}}}function hl(){queueMicrotask(()=>Va(this,il)[il]())}function pl(){if(Va(this,Qa)[Qa]||Va(this,Ja)[Ja]>=this.limit)return;if(0===Va(this,Xa)[Xa].length)return;const e=Va(this,Xa)[Xa].shift();if(null==e)throw new Error("Invariant violation: next is null");const t=Va(this,rl)[rl](e.fn);e.abort=t.abort,e.done=t.done}function _l(e,t){const n={fn:e,priority:(null==t?void 0:t.priority)||0,abort:()=>{Va(this,al)[al](n)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},r=Va(this,Xa)[Xa].findIndex(e=>n.priority>e.priority);return-1===r?Va(this,Xa)[Xa].push(n):Va(this,Xa)[Xa].splice(r,0,n),n}function fl(e){const t=Va(this,Xa)[Xa].indexOf(e);-1!==t&&Va(this,Xa)[Xa].splice(t,1)}const{AbortController:ml}=globalThis,gl=function(e,t){void 0===e&&(e="Aborted");const n=new DOMException(e,"AbortError");return null!=t&&ka(t,"cause")&&Object.defineProperty(n,"cause",{__proto__:null,configurable:!0,writable:!0,value:t.cause}),n};function yl(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var vl=0;function wl(e){return"__private_"+vl+++"_"+e}const bl={getChunkSize:e=>Math.ceil(e.size/1e4),onProgress(){},onPartComplete(){},onSuccess(){},onError(e){throw e}};const Sl=Symbol("pausing upload, not an actual error");var El=wl("abortController"),kl=wl("chunks"),Pl=wl("chunkState"),Tl=wl("data"),Ol=wl("file"),Cl=wl("uploadHasStarted"),xl=wl("onError"),Rl=wl("onSuccess"),Al=wl("shouldUseMultipart"),Nl=wl("isRestoring"),Fl=wl("onReject"),jl=wl("maxMultipartParts"),Il=wl("minPartSize"),Ml=wl("initChunks"),Ul=wl("createUpload"),Ll=wl("resumeUpload"),zl=wl("onPartProgress"),Bl=wl("onPartComplete"),Dl=wl("abortUpload");class $l{constructor(e,t){var n;Object.defineProperty(this,Dl,{value:Vl}),Object.defineProperty(this,Ll,{value:Hl}),Object.defineProperty(this,Ul,{value:ql}),Object.defineProperty(this,Ml,{value:Wl}),Object.defineProperty(this,El,{writable:!0,value:new ml}),Object.defineProperty(this,kl,{writable:!0,value:void 0}),Object.defineProperty(this,Pl,{writable:!0,value:void 0}),Object.defineProperty(this,Tl,{writable:!0,value:void 0}),Object.defineProperty(this,Ol,{writable:!0,value:void 0}),Object.defineProperty(this,Cl,{writable:!0,value:!1}),Object.defineProperty(this,xl,{writable:!0,value:void 0}),Object.defineProperty(this,Rl,{writable:!0,value:void 0}),Object.defineProperty(this,Al,{writable:!0,value:void 0}),Object.defineProperty(this,Nl,{writable:!0,value:void 0}),Object.defineProperty(this,Fl,{writable:!0,value:e=>(null==e?void 0:e.cause)===Sl?null:yl(this,xl)[xl](e)}),Object.defineProperty(this,jl,{writable:!0,value:1e4}),Object.defineProperty(this,Il,{writable:!0,value:5242880}),Object.defineProperty(this,zl,{writable:!0,value:e=>t=>{if(!t.lengthComputable)return;yl(this,Pl)[Pl][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 n=yl(this,Pl)[Pl].reduce((e,t)=>e+t.uploaded,0);this.options.onProgress(n,yl(this,Tl)[Tl].size)}}),Object.defineProperty(this,Bl,{writable:!0,value:e=>t=>{yl(this,kl)[kl][e]=null,yl(this,Pl)[Pl][e].etag=t,yl(this,Pl)[Pl][e].done=!0;const n={PartNumber:e+1,ETag:t};this.options.onPartComplete(n)}}),this.options={...bl,...t},null!=(n=this.options).getChunkSize||(n.getChunkSize=bl.getChunkSize),yl(this,Tl)[Tl]=e,yl(this,Ol)[Ol]=t.file,yl(this,Rl)[Rl]=this.options.onSuccess,yl(this,xl)[xl]=this.options.onError,yl(this,Al)[Al]=this.options.shouldUseMultipart,yl(this,Nl)[Nl]=t.uploadId&&t.key,yl(this,Ml)[Ml]()}start(){yl(this,Cl)[Cl]?(yl(this,El)[El].signal.aborted||yl(this,El)[El].abort(Sl),yl(this,El)[El]=new ml,yl(this,Ll)[Ll]()):yl(this,Nl)[Nl]?(this.options.companionComm.restoreUploadFile(yl(this,Ol)[Ol],{uploadId:this.options.uploadId,key:this.options.key}),yl(this,Ll)[Ll]()):yl(this,Ul)[Ul]()}pause(){yl(this,El)[El].abort(Sl),yl(this,El)[El]=new ml}abort(e){null!=e&&e.really?yl(this,Dl)[Dl]():this.pause()}get chunkState(){return yl(this,Pl)[Pl]}}function Wl(){const e=yl(this,Tl)[Tl].size,t="function"==typeof yl(this,Al)[Al]?yl(this,Al)[Al](yl(this,Ol)[Ol]):Boolean(yl(this,Al)[Al]);if(t&&e>yl(this,Il)[Il]){let n=Math.max(this.options.getChunkSize(yl(this,Tl)[Tl]),yl(this,Il)[Il]),r=Math.floor(e/n);r>yl(this,jl)[jl]&&(r=yl(this,jl)[jl],n=e/yl(this,jl)[jl]),yl(this,kl)[kl]=Array(r);for(let r=0,o=0;r<e;r+=n,o++){const i=Math.min(e,r+n),s=()=>{const e=r;return yl(this,Tl)[Tl].slice(e,i)};if(yl(this,kl)[kl][o]={getData:s,onProgress:yl(this,zl)[zl](o),onComplete:yl(this,Bl)[Bl](o),shouldUseMultipart:t},yl(this,Nl)[Nl]){const t=r+n>e?e-r:n;yl(this,kl)[kl][o].setAsUploaded=()=>{yl(this,kl)[kl][o]=null,yl(this,Pl)[Pl][o].uploaded=t}}}}else yl(this,kl)[kl]=[{getData:()=>yl(this,Tl)[Tl],onProgress:yl(this,zl)[zl](0),onComplete:yl(this,Bl)[Bl](0),shouldUseMultipart:t}];yl(this,Pl)[Pl]=yl(this,kl)[kl].map(()=>({uploaded:0}))}function ql(){this.options.companionComm.uploadFile(yl(this,Ol)[Ol],yl(this,kl)[kl],yl(this,El)[El].signal).then(yl(this,Rl)[Rl],yl(this,Fl)[Fl]),yl(this,Cl)[Cl]=!0}function Hl(){this.options.companionComm.resumeUploadFile(yl(this,Ol)[Ol],yl(this,kl)[kl],yl(this,El)[El].signal).then(yl(this,Rl)[Rl],yl(this,Fl)[Fl])}function Vl(){yl(this,El)[El].abort(),this.options.companionComm.abortFileUpload(yl(this,Ol)[Ol]).catch(e=>this.options.log(e))}function Yl(e){if(null!=e&&e.aborted)throw gl("The operation was aborted",{cause:e.reason})}const Kl=new TextEncoder,Gl={name:"HMAC",hash:"SHA-256"};function Jl(e){const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=t[e].toString(16).padStart(2,"0");return n}async function Xl(e,t){const{subtle:n}=globalThis.crypto;return n.sign(Gl,await async function(e){const{subtle:t}=globalThis.crypto;return t.importKey("raw","string"==typeof e?Kl.encode(e):e,Gl,!1,["sign"])}(e),Kl.encode(t))}async function Ql(e){let{accountKey:t,accountSecret:n,sessionToken:r,bucketName:o,Key:i,Region:s,expires:a,uploadId:l,partNumber:c}=e;const u="s3",d=`${o}.${u}.${s}.amazonaws.com`,h=`/${encodeURI(i).replace(/[;?:@&=+$,#!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}`,p="UNSIGNED-PAYLOAD",_=(new Date).toISOString().replace(/[-:]|\.\d+/g,""),f=_.slice(0,8),m=`${f}/${s}/${u}/aws4_request`,g=new URL(`https://${d}${h}`);g.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),g.searchParams.set("X-Amz-Content-Sha256",p),g.searchParams.set("X-Amz-Credential",`${t}/${m}`),g.searchParams.set("X-Amz-Date",_),g.searchParams.set("X-Amz-Expires",a),g.searchParams.set("X-Amz-Security-Token",r),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 y=function(e){let{method:t="PUT",CanonicalUri:n="/",CanonicalQueryString:r="",SignedHeaders:o,HashedPayload:i}=e;const s=Object.keys(o).map(e=>e.toLowerCase()).sort();return[t,n,r,...s.map(e=>`${e}:${o[e]}`),"",s.join(";"),i].join("\n")}({CanonicalUri:h,CanonicalQueryString:g.search.slice(1),SignedHeaders:{host:d},HashedPayload:p}),v=["AWS4-HMAC-SHA256",_,m,Jl(await async function(e){const{subtle:t}=globalThis.crypto;return t.digest(Gl.hash,Kl.encode(e))}(y))].join("\n"),w=await Xl(`AWS4${n}`,f),b=await Xl(w,s),S=await Xl(b,u),E=await Xl(S,"aws4_request"),k=Jl(await Xl(E,v));return g.searchParams.set("X-Amz-Signature",k),g}function Zl(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var ec=0;function tc(e){return"__private_"+ec+++"_"+e}function nc(e){const t=new URL(e);return t.search="",t.hash="",t.href}var rc=tc("abortMultipartUpload"),oc=tc("cache"),ic=tc("createMultipartUpload"),sc=tc("fetchSignature"),ac=tc("getUploadParameters"),lc=tc("listParts"),cc=tc("previousRetryDelay"),uc=tc("requests"),dc=tc("retryDelays"),hc=tc("sendCompletionRequest"),pc=tc("setS3MultipartState"),_c=tc("uploadPartBytes"),fc=tc("getFile"),mc=tc("shouldRetry"),gc=tc("nonMultipartUpload");class yc{constructor(e,t,n,r){Object.defineProperty(this,gc,{value:wc}),Object.defineProperty(this,mc,{value:vc}),Object.defineProperty(this,rc,{writable:!0,value:void 0}),Object.defineProperty(this,oc,{writable:!0,value:new WeakMap}),Object.defineProperty(this,ic,{writable:!0,value:void 0}),Object.defineProperty(this,sc,{writable:!0,value:void 0}),Object.defineProperty(this,ac,{writable:!0,value:void 0}),Object.defineProperty(this,lc,{writable:!0,value:void 0}),Object.defineProperty(this,cc,{writable:!0,value:void 0}),Object.defineProperty(this,uc,{writable:!0,value:void 0}),Object.defineProperty(this,dc,{writable:!0,value:void 0}),Object.defineProperty(this,hc,{writable:!0,value:void 0}),Object.defineProperty(this,pc,{writable:!0,value:void 0}),Object.defineProperty(this,_c,{writable:!0,value:void 0}),Object.defineProperty(this,fc,{writable:!0,value:void 0}),Zl(this,uc)[uc]=e,Zl(this,pc)[pc]=n,Zl(this,fc)[fc]=r,this.setOptions(t)}setOptions(e){const t=Zl(this,uc)[uc];var n;("abortMultipartUpload"in e&&(Zl(this,rc)[rc]=t.wrapPromiseFunction(e.abortMultipartUpload,{priority:1})),"createMultipartUpload"in e&&(Zl(this,ic)[ic]=t.wrapPromiseFunction(e.createMultipartUpload,{priority:-1})),"signPart"in e&&(Zl(this,sc)[sc]=t.wrapPromiseFunction(e.signPart)),"listParts"in e&&(Zl(this,lc)[lc]=t.wrapPromiseFunction(e.listParts)),"completeMultipartUpload"in e&&(Zl(this,hc)[hc]=t.wrapPromiseFunction(e.completeMultipartUpload,{priority:1})),"retryDelays"in e)&&(Zl(this,dc)[dc]=null!=(n=e.retryDelays)?n:[]);"uploadPartBytes"in e&&(Zl(this,_c)[_c]=t.wrapPromiseFunction(e.uploadPartBytes,{priority:1/0})),"getUploadParameters"in e&&(Zl(this,ac)[ac]=t.wrapPromiseFunction(e.getUploadParameters))}async getUploadId(e,t){let n;for(;null!=(n=Zl(this,oc)[oc].get(e.data));)try{return await n}catch{}const r=Zl(this,ic)[ic](Zl(this,fc)[fc](e),t),o=()=>{r.abort(t.reason),Zl(this,oc)[oc].delete(e.data)};return t.addEventListener("abort",o,{once:!0}),Zl(this,oc)[oc].set(e.data,r),r.then(async n=>{t.removeEventListener("abort",o),Zl(this,pc)[pc](e,n),Zl(this,oc)[oc].set(e.data,n)},()=>{t.removeEventListener("abort",o),Zl(this,oc)[oc].delete(e.data)}),r}async abortFileUpload(e){const t=Zl(this,oc)[oc].get(e.data);if(null==t)return;let n;Zl(this,oc)[oc].delete(e.data),Zl(this,pc)[pc](e,Object.create(null));try{n=await t}catch{return}await Zl(this,rc)[rc](Zl(this,fc)[fc](e),n)}async uploadFile(e,t,n){if(Yl(n),1===t.length&&!t[0].shouldUseMultipart)return Zl(this,gc)[gc](e,t[0],n);const{uploadId:r,key:o}=await this.getUploadId(e,n);Yl(n);try{const i=await Promise.all(t.map((t,r)=>this.uploadChunk(e,r+1,t,n)));return Yl(n),await Zl(this,hc)[hc](Zl(this,fc)[fc](e),{key:o,uploadId:r,parts:i,signal:n},n).abortOn(n)}catch(t){throw(null==t?void 0:t.cause)!==Sl&&"AbortError"!==(null==t?void 0:t.name)&&this.abortFileUpload(e),t}}restoreUploadFile(e,t){Zl(this,oc)[oc].set(e.data,t)}async resumeUploadFile(e,t,n){if(Yl(n),1===t.length&&null!=t[0]&&!t[0].shouldUseMultipart)return Zl(this,gc)[gc](e,t[0],n);const{uploadId:r,key:o}=await this.getUploadId(e,n);Yl(n);const i=await Zl(this,lc)[lc](Zl(this,fc)[fc](e),{uploadId:r,key:o,signal:n},n).abortOn(n);Yl(n);const s=await Promise.all(t.map((t,r)=>{const o=r+1,s=i.find(e=>{let{PartNumber:t}=e;return t===o});return null==s?this.uploadChunk(e,o,t,n):(null==t||null==t.setAsUploaded||t.setAsUploaded(),{PartNumber:o,ETag:s.ETag})}));return Yl(n),Zl(this,hc)[hc](Zl(this,fc)[fc](e),{key:o,uploadId:r,parts:s,signal:n},n).abortOn(n)}async uploadChunk(e,t,n,r){Yl(r);const{uploadId:o,key:i}=await this.getUploadId(e,r),s=Zl(this,dc)[dc].values(),a=Zl(this,dc)[dc].values(),l=()=>{const e=s.next();return null==e||e.done?null:e.value};for(;;){Yl(r);const s=n.getData(),{onProgress:c,onComplete:u}=n;let d;try{d=await Zl(this,sc)[sc](Zl(this,fc)[fc](e),{uploadId:o,key:i,partNumber:t,body:s,signal:r}).abortOn(r)}catch(e){const t=l();if(null==t||r.aborted)throw e;await new Promise(e=>setTimeout(e,t));continue}Yl(r);try{return{PartNumber:t,...await Zl(this,_c)[_c]({signature:d,body:s,size:s.size,onProgress:c,onComplete:u,signal:r}).abortOn(r)}}catch(e){if(!await Zl(this,mc)[mc](e,a))throw e}}}}async function vc(e,t){var n;const r=Zl(this,uc)[uc],o=null==e||null==(n=e.source)?void 0:n.status;if(null==o)return!1;if(403===o&&"Request has expired"===e.message){if(!r.isPaused){if(1===r.limit||null==Zl(this,cc)[cc]){const e=t.next();if(null==e||e.done)return!1;Zl(this,cc)[cc]=e.value}r.rateLimit(0),await new Promise(e=>setTimeout(e,Zl(this,cc)[cc]))}}else if(429===o){if(!r.isPaused){const e=t.next();if(null==e||e.done)return!1;r.rateLimit(e.value)}}else{if(o>400&&o<500&&409!==o)return!1;if("undefined"!=typeof navigator&&!1===navigator.onLine)r.isPaused||(r.pause(),window.addEventListener("online",()=>{r.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 wc(e,t,n){const{method:r="POST",url:o,fields:i,headers:s}=await Zl(this,ac)[ac](Zl(this,fc)[fc](e),{signal:n}).abortOn(n);let a;const l=t.getData();if("POST"===r.toUpperCase()){const e=new FormData;Object.entries(i).forEach(t=>{let[n,r]=t;return e.set(n,r)}),e.set("file",l),a=e}else a=l;const{onProgress:c,onComplete:u}=t,d=await Zl(this,_c)[_c]({signature:{url:o,headers:s,method:r},body:a,size:l.size,onProgress:c,onComplete:u,signal:n}).abortOn(n);return"location"in d?d:{location:nc(o),...d}}let bc;function Sc(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ec=0;function kc(e){return"__private_"+Ec+++"_"+e}function Pc(e){if(null!=e&&e.error){const t=new Error(e.message);throw Object.assign(t,e.error),t}return e}function Tc(e){const t=e.Expiration;if(t){const e=Math.floor((new Date(t)-Date.now())/1e3);if(e>9)return e}}function Oc(e){let{meta:t,allowedMetaFields:n,querify:r=!1}=e;const o=null!=n?n:Object.keys(t);return t?Object.fromEntries(o.filter(e=>null!=t[e]).map(e=>[r?`metadata[${e}]`:e,String(t[e])])):{}}const Cc={allowedMetaFields:null,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:e=>0!==e.size,retryDelays:[0,1e3,3e3,5e3],companionHeaders:{}};var xc=kc("companionCommunicationQueue"),Rc=kc("client"),Ac=kc("cachedTemporaryCredentials"),Nc=kc("getTemporarySecurityCredentials"),Fc=kc("setS3MultipartState"),jc=kc("getFile"),Ic=kc("uploadLocalFile"),Mc=kc("getCompanionClientArgs"),Uc=kc("upload"),Lc=kc("setCompanionHeaders"),zc=kc("setResumableUploadsCapability"),Bc=kc("resetResumableCapability");bc=Symbol.for("uppy test: getClient");class Dc extends aa{constructor(e,t){var n;super(e,{...Cc,uploadPartBytes:Dc.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...t}),Object.defineProperty(this,Mc,{value:qc}),Object.defineProperty(this,Ic,{value:Wc}),Object.defineProperty(this,Nc,{value:$c}),Object.defineProperty(this,xc,{writable:!0,value:void 0}),Object.defineProperty(this,Rc,{writable:!0,value:void 0}),Object.defineProperty(this,Ac,{writable:!0,value:void 0}),Object.defineProperty(this,Fc,{writable:!0,value:(e,t)=>{let{key:n,uploadId:r}=t;const o=this.uppy.getFile(e.id);null!=o&&this.uppy.setFileState(e.id,{s3Multipart:{...o.s3Multipart,key:n,uploadId:r}})}}),Object.defineProperty(this,jc,{writable:!0,value:e=>this.uppy.getFile(e.id)||e}),Object.defineProperty(this,Uc,{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)),n=function(e){return e.filter(e=>{var t;return!(null!=(t=e.progress)&&t.uploadStarted&&e.isRestored)})}(t);this.uppy.emit("upload-start",n);const r=t.map(e=>{if(e.isRemote){const t=()=>this.requests;Sc(this,zc)[zc](!1);const n=new AbortController,r=t=>{t.id===e.id&&n.abort()};this.uppy.on("file-removed",r);const o=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,Sc(this,Mc)[Mc](e),{signal:n.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",r)},{priority:-1})(),o}return Sc(this,Ic)[Ic](e)}),o=await Promise.all(r);return Sc(this,zc)[zc](!0),o}}),Object.defineProperty(this,Lc,{writable:!0,value:()=>{Sc(this,Rc)[Rc].setCompanionHeaders(this.opts.companionHeaders)}}),Object.defineProperty(this,zc,{writable:!0,value:e=>{const{capabilities:t}=this.uppy.getState();this.uppy.setState({capabilities:{...t,resumableUploads:e}})}}),Object.defineProperty(this,Bc,{writable:!0,value:()=>{Sc(this,zc)[zc](!0)}}),this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",this.title="AWS S3 Multipart",Sc(this,Rc)[Rc]=new Ua(e,t);const r={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(r))null==this.opts[e]&&(this.opts[e]=r[e].bind(this));null!=(null==t?void 0:t.prepareUploadParts)&&null==t.signPart&&(this.opts.signPart=async(e,n)=>{let{uploadId:r,key:o,partNumber:i,body:s,signal:a}=n;const{presignedUrls:l,headers:c}=await t.prepareUploadParts(e,{uploadId:r,key:o,parts:[{number:i,chunk:s}],signal:a});return{url:null==l?void 0:l[i],headers:null==c?void 0:c[i]}}),this.requests=null!=(n=this.opts.rateLimitedQueue)?n:new ul(this.opts.limit),Sc(this,xc)[xc]=new yc(this.requests,this.opts,Sc(this,Fc)[Fc],Sc(this,jc)[jc]),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null),this.uploaderSockets=Object.create(null)}[bc](){return Sc(this,Rc)[Rc]}setOptions(e){Sc(this,xc)[xc].setOptions(e),super.setOptions(e),Sc(this,Lc)[Lc]()}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"),Yl(t);const n=Oc({meta:e.meta,allowedMetaFields:this.opts.allowedMetaFields});return Sc(this,Rc)[Rc].post("s3/multipart",{filename:e.name,type:e.type,metadata:n},{signal:t}).then(Pc)}listParts(e,t,n){let{key:r,uploadId:o,signal:i}=t;null!=i||(i=n),this.assertHost("listParts"),Yl(i);const s=encodeURIComponent(r);return Sc(this,Rc)[Rc].get(`s3/multipart/${o}?key=${s}`,{signal:i}).then(Pc)}completeMultipartUpload(e,t,n){let{key:r,uploadId:o,parts:i,signal:s}=t;null!=s||(s=n),this.assertHost("completeMultipartUpload"),Yl(s);const a=encodeURIComponent(r),l=encodeURIComponent(o);return Sc(this,Rc)[Rc].post(`s3/multipart/${l}/complete?key=${a}`,{parts:i},{signal:s}).then(Pc)}async createSignedURL(e,t){const n=await Sc(this,Nc)[Nc](t),r=Tc(n.credentials)||604800,{uploadId:o,key:i,partNumber:s}=t;return{method:"PUT",expires:r,fields:{},url:`${await Ql({accountKey:n.credentials.AccessKeyId,accountSecret:n.credentials.SecretAccessKey,sessionToken:n.credentials.SessionToken,expires:r,bucketName:n.bucket,Region:n.region,Key:null!=i?i:`${crypto.randomUUID()}-${e.name}`,uploadId:o,partNumber:s})}`,headers:{"Content-Type":e.type}}}signPart(e,t){let{uploadId:n,key:r,partNumber:o,signal:i}=t;if(this.assertHost("signPart"),Yl(i),null==n||null==r||null==o)throw new Error("Cannot sign without a key, an uploadId, and a partNumber");const s=encodeURIComponent(r);return Sc(this,Rc)[Rc].get(`s3/multipart/${n}/${o}?key=${s}`,{signal:i}).then(Pc)}abortMultipartUpload(e,t,n){let{key:r,uploadId:o,signal:i}=t;null!=i||(i=n),this.assertHost("abortMultipartUpload");const s=encodeURIComponent(r),a=encodeURIComponent(o);return Sc(this,Rc)[Rc].delete(`s3/multipart/${a}?key=${s}`,void 0,{signal:i}).then(Pc)}getUploadParameters(e,t){const{meta:n}=e,{type:r,name:o}=n,i=Oc({meta:n,allowedMetaFields:this.opts.allowedMetaFields,querify:!0}),s=new URLSearchParams({filename:o,type:r,...i});return Sc(this,Rc)[Rc].get(`s3/params?${s}`,t)}static async uploadPartBytes(e){let{signature:{url:t,expires:n,headers:r,method:o="PUT"},body:i,size:s=i.size,onProgress:a,onComplete:l,signal:c}=e;if(Yl(c),null==t)throw new Error("Cannot upload to an undefined URL");return new Promise((e,u)=>{const d=new XMLHttpRequest;function h(){d.abort()}function p(){null==c||c.removeEventListener("abort",h)}d.open(o,t,!0),r&&Object.keys(r).forEach(e=>{d.setRequestHeader(e,r[e])}),d.responseType="text","number"==typeof n&&(d.timeout=1e3*n),null==c||c.addEventListener("abort",h),d.upload.addEventListener("progress",e=>{a(e)}),d.addEventListener("abort",()=>{p(),u(gl())}),d.addEventListener("timeout",()=>{p();const e=new Error("Request has expired");e.source={status:403},u(e)}),d.addEventListener("load",()=>{if(p(),403===d.status&&d.responseText.includes("<Message>Request has expired</Message>")){const e=new Error("Request has expired");return e.source=d,void u(e)}if(d.status<200||d.status>=300){const e=new Error("Non 2xx");return e.source=d,void u(e)}null==a||a({loaded:s,lengthComputable:!0});const t=d.getAllResponseHeaders().trim().split(/[\r\n]+/),n={__proto__:null};for(const e of t){const t=e.split(": "),r=t.shift(),o=t.join(": ");n[r]=o}const{etag:r,location:i}=n;"POST"===o.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!==r?(null==l||l(r),e({...n,ETag:r})):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."))}),d.addEventListener("error",e=>{p();const t=new Error("Unknown error");t.source=e.target,u(t)}),d.send(i)})}install(){Sc(this,zc)[zc](!0),this.uppy.addPreProcessor(Sc(this,Lc)[Lc]),this.uppy.addUploader(Sc(this,Uc)[Uc]),this.uppy.on("cancel-all",Sc(this,Bc)[Bc])}uninstall(){this.uppy.removePreProcessor(Sc(this,Lc)[Lc]),this.uppy.removeUploader(Sc(this,Uc)[Uc]),this.uppy.off("cancel-all",Sc(this,Bc)[Bc])}}async function $c(e){return Yl(null==e?void 0:e.signal),null==Sc(this,Ac)[Ac]&&(!0===this.opts.getTemporarySecurityCredentials?(this.assertHost("getTemporarySecurityCredentials"),Sc(this,Ac)[Ac]=Sc(this,Rc)[Rc].get("s3/sts",e).then(Pc)):Sc(this,Ac)[Ac]=this.opts.getTemporarySecurityCredentials(e),Sc(this,Ac)[Ac]=await Sc(this,Ac)[Ac],setTimeout(()=>{Sc(this,Ac)[Ac]=null},500*(Tc(Sc(this,Ac)[Ac].credentials)||0))),Sc(this,Ac)[Ac]}function Wc(e){var t=this;return new Promise((n,r)=>{const o=new $l(e.data,{companionComm:Sc(this,xc)[xc],log:function(){return t.uppy.log(...arguments)},getChunkSize:this.opts.getChunkSize?this.opts.getChunkSize.bind(this):null,onProgress:(t,n)=>{this.uppy.emit("upload-progress",this.uppy.getFile(e.id),{uploader:this,bytesUploaded:t,bytesTotal:n})},onError:t=>{this.uppy.log(t),this.uppy.emit("upload-error",e,t),this.resetUploaderReferences(e.id),r(t)},onSuccess:t=>{const r={body:{...t},status:200,uploadURL:t.location};this.resetUploaderReferences(e.id),this.uppy.emit("upload-success",Sc(this,jc)[jc](e),r),t.location&&this.uppy.log(`Download ${e.name} from ${t.location}`),n()},onPartComplete:t=>{this.uppy.emit("s3-multipart:part-uploaded",Sc(this,jc)[jc](e),t)},file:e,shouldUseMultipart:this.opts.shouldUseMultipart,...e.s3Multipart});this.uploaders[e.id]=o;const i=new Ha(this.uppy);this.uploaderEvents[e.id]=i,i.onFileRemove(e.id,t=>{o.abort(),this.resetUploaderReferences(e.id,{abort:!0}),n(`upload ${t} was removed`)}),i.onCancelAll(e.id,t=>{"user"===(null==t?void 0:t.reason)&&(o.abort(),this.resetUploaderReferences(e.id,{abort:!0})),n(`upload ${e.id} was canceled`)}),i.onFilePause(e.id,e=>{e?o.pause():o.start()}),i.onPauseAll(e.id,()=>{o.pause()}),i.onResumeAll(e.id,()=>{o.start()}),o.start()})}function qc(e){var t;return{...null==(t=e.remote)?void 0:t.body,protocol:"s3-multipart",size:e.data.size,metadata:e.meta}}Dc.VERSION="3.12.0";var Hc,Vc,Yc,Kc,Gc,Jc=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})},Xc=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},Qc=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},Zc=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};class eu{constructor(e,t=Po.PROD){Hc.add(this),Vc.set(this,void 0),Yc.set(this,void 0),Kc.set(this,void 0),Xc(this,Yc,e,"f"),Xc(this,Kc,t,"f")}uploadFileFrontend(e){return Jc(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:n,email:r,callBack:o}){if(!Co(e,t,n,r))throw new Error(bo);if(!Fo(r.trim()))throw new Error(Eo);if(!xo(t))throw new Error(So);return t=Ao(t,n,r),Qc(this,Hc,"m",Gc).call(this,{callBack:o,arrayMetaData:t,scanId:n,email:r,file:e})})}faceScanFileUploader(e){return Jc(this,arguments,void 0,function*({file:e,arrayMetaData:t,objectKey:n,email:r,callBack:o}){if(!Co(e,t,n,r))throw new Error(bo);if(!Fo(r.trim()))throw new Error(Eo);if(!Ro(t,wo))throw new Error(So);return t.push({email:r}),Qc(this,Hc,"m",Gc).call(this,{callBack:o,arrayMetaData:t,objectKey:n,email:r,file:e})})}uploadFile(e){return Jc(this,arguments,void 0,function*({file:e,arrayMetaData:t,scanId:n,email:r}){if(!Co(e,t,n,r))throw new Error(bo);if(!Fo(r.trim()))throw new Error(Eo);if(!xo(t))throw new Error(So);return t=Ao(t,n,r),new Promise((n,r)=>Jc(this,void 0,void 0,function*(){var o;try{const r=yield Oo({path:Gr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{objectKey:e.name,contentType:e.type,objectMetadata:t},throwError:!0}),i=function(e,t=5242880){const n=e.size,r=[];let o=0;for(;o<n;)r.push(e.slice(o,o+t)),o+=t;return r}(e),s=[];for(let t=0;t<i.length;t++){const n=yield Oo({path:Xr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{objectKey:null==r?void 0:r.key,uploadId:null==r?void 0:r.uploadId,partNumber:t+1},throwError:!0}),a=yield Ar.put(null==n?void 0:n.url,i[t],{headers:{"Content-Type":e.type,"X-Api-Key":Qc(this,Yc,"f")}});s.push({PartNumber:t+1,ETag:null===(o=null==a?void 0:a.headers)||void 0===o?void 0:o.etag})}const a=yield Oo({path:Jr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{uploadId:null==r?void 0:r.uploadId,objectKey:null==r?void 0:r.key,parts:s,originalFileName:e.name},throwError:!0});n({message:"successfully uploaded",data:a})}catch(e){r(e)}}))})}setDeviceInfo(e){return Jc(this,void 0,void 0,function*(){const{scanId:t}=e,n=Zc(e,["scanId"]);if(!1===Co(t))throw new Error(bo);return Ar.post(`${No({urlName:Qr,urlType:Qc(this,Kc,"f")})}${go}/${t}`,{device_info:Object.assign({},n)},{headers:{"X-Api-Key":Qc(this,Yc,"f")}})})}}Vc=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Hc=new WeakSet,Gc=function({callBack:e,arrayMetaData:t,scanId:n,email:r,file:o,objectKey:i}){return new Promise((s,a)=>{Qc(this,Vc,"f")&&Qc(this,Vc,"f").close(),Xc(this,Vc,new Ks({autoProceed:!0}),"f"),Qc(this,Vc,"f").use(Dc,{limit:10,retryDelays:[0,1e3,3e3,5e3],companionUrl:No({urlName:Qr,urlType:Qc(this,Kc,"f")}),getChunkSize:()=>ko,createMultipartUpload:o=>{const s=Math.ceil(o.size/ko);null==e||e({eventName:"uploading_start",message:`File ${o.name} will be divided into ${s} chunks`,scanId:n,email:r,objectKey:i});const a=`${n||i}.${o.extension}`;return Oo({path:Gr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{objectKey:a,contentType:o.type,objectMetadata:t}})},completeMultipartUpload:(t,{uploadId:o,key:s,parts:a})=>(null==e||e({eventName:"uploading_complete_start",message:`${a.length} chunks of file, uploaded`,scanId:n,email:r,objectKey:i}),Oo({path:Jr,apiKey:Qc(this,Yc,"f"),urlType:Qc(this,Kc,"f"),body:{uploadId:o,objectKey:s,parts:a,originalFileName:t.name}}).then(t=>(null==e||e({eventName:"uploading_complete_end",message:"Multipart upload completed successfully",scanId:n,email:r,objectKey:i}),t))),signPart:(e,t)=>Oo({path:Xr,urlType:Qc(this,Kc,"f"),apiKey:Qc(this,Yc,"f"),body:{objectKey:t.key,uploadId:t.uploadId,partNumber:t.partNumber}})}),Qc(this,Vc,"f").addFile({source:"manual",name:o.name,type:o.type,data:o}),Qc(this,Vc,"f").on("upload-error",(e,t,n)=>{t.isNetworkError?Qc(this,Vc,"f").retryUpload(e.id):a(t)}),Qc(this,Vc,"f").on("upload-success",()=>{s({message:"file uploaded successfully"})}),Qc(this,Vc,"f").on("complete",e=>{Qc(this,Vc,"f")&&Qc(this,Vc,"f").close()})})};var tu,nu,ru,ou,iu,su,au,lu,cu,uu,du,hu,pu=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})},_u=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},fu=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class mu{constructor(e,t=Po.PROD){tu.add(this),nu.set(this,{}),ru.set(this,{}),ou.set(this,{}),iu.set(this,{}),su.set(this,void 0),au.set(this,void 0),_u(this,su,e,"f"),_u(this,au,t,"f")}getMeasurementResult(e){if(!Co(e))throw new Error(bo);const t=`${No({urlName:Qr,urlType:fu(this,au,"f")})}/measurements?scanId=${e}`;return Ar.get(t,{headers:{"X-Api-Key":fu(this,su,"f")}})}getMeasurementRecommendation({scanId:e,shopDomain:t,productName:n}){if(!Co(e,t,n))throw new Error(bo);return Ar.get(`${No({urlName:Qr,urlType:fu(this,au,"f")})}${fo}/scan/${e}/shop/${t}/product/${n}`,{headers:{"X-Api-Key":fu(this,su,"f")}})}handleMeasurementSocket(e){const{scanId:t,onError:n,onSuccess:r,onClose:o,onOpen:i}=e;if(!Co(t))throw new Error(bo);fu(this,tu,"m",hu).call(this,{onOpen:i,scanId:t,onSuccess:r,onError:n,onClose:o,paramsKey:"scanId",isFallback:!0,delay:5e3})}handlFaceScaneSocket(e){const{faceScanId:t,onError:n,onSuccess:r,onClose:o,onOpen:i}=e;if(!Co(t))throw new Error(bo);fu(this,tu,"m",hu).call(this,{onOpen:i,faceScanId:t,onSuccess:r,onError:n,onClose:o,paramsKey:"faceScanId",isFallback:!1,delay:1e3})}}nu=new WeakMap,ru=new WeakMap,ou=new WeakMap,iu=new WeakMap,su=new WeakMap,au=new WeakMap,tu=new WeakSet,lu=function(e){var t;null===(t=fu(this,nu,"f")[e])||void 0===t||t.close(),fu(this,nu,"f")[e]=null,fu(this,ru,"f")[e]&&(clearTimeout(fu(this,ru,"f")[e]),fu(this,ru,"f")[e]=null)},cu=function(e,t){const{scanId:n,onSuccess:r,onError:o}=e;fu(this,iu,"f")[t]=1,fu(this,ru,"f")[t]=setTimeout(()=>{fu(this,tu,"m",uu).call(this,{scanId:n,onSuccess:r,onError:o},t),fu(this,tu,"m",lu).call(this,t)},9e4)},uu=function(e,t){const{scanId:n,onSuccess:r,onError:o}=e;fu(this,ou,"f")[t]&&clearTimeout(fu(this,ou,"f")[t]),fu(this,ou,"f")[t]=setTimeout(()=>{fu(this,tu,"m",du).call(this,{scanId:n,onSuccess:r,onError:o},t)},5e3*(fu(this,iu,"f")[t]||1))},du=function(e,t){return pu(this,void 0,void 0,function*(){var n;const{scanId:r,onSuccess:o,onError:i}=e;try{const e=yield this.getMeasurementResult(r);(null==e?void 0:e.data)&&!0===(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.isMeasured)?(null==o||o(e.data),clearInterval(fu(this,ou,"f")[t])):(fu(this,iu,"f")[t]||1)<8?(fu(this,iu,"f")[t]=(fu(this,iu,"f")[t]||1)+1,fu(this,tu,"m",uu).call(this,{scanId:r,onSuccess:o,onError:i},t)):(fu(this,iu,"f")[t]=1,clearInterval(fu(this,ou,"f")[t]),null==i||i({scanStatus:"failed",message:"Scan not found",isMeasured:!1}))}catch(e){clearInterval(fu(this,ou,"f")[t]),null==i||i(e)}})},hu=function({onOpen:e,isFallback:t,scanId:n,onSuccess:r,onError:o,onClose:i,paramsKey:s,faceScanId:a,delay:l}){const c=t?`measurement-${n}`:`faceScan-${a}`;setTimeout(()=>{fu(this,tu,"m",lu).call(this,c);const l=`${No({urlName:Zr,urlType:fu(this,au,"f")})}${_o}?${s}=${n||a}`,u=new WebSocket(l);fu(this,nu,"f")[c]=u,u.onopen=()=>{null==e||e(),t&&n&&fu(this,tu,"m",cu).call(this,{scanId:n,onSuccess:r,onError:o},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==r||r(t):(clearTimeout(fu(this,ru,"f")[c]),null==o||o(t)),200===(null==t?void 0:t.code)&&"success"===(null==t?void 0:t.scanStatus)&&"final"===(null==t?void 0:t.resultType)&&clearTimeout(fu(this,ru,"f")[c])},u.onclose=()=>null==i?void 0:i(),u.onerror=()=>{t||null==o||o(new Error("An error occurred in the WebSocket connection."))}},l)};const gu=Object.create(null);gu.open="0",gu.close="1",gu.ping="2",gu.pong="3",gu.message="4",gu.upgrade="5",gu.noop="6";const yu=Object.create(null);Object.keys(gu).forEach(e=>{yu[gu[e]]=e});const vu={type:"error",data:"parser error"},wu="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),bu="function"==typeof ArrayBuffer,Su=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Eu=({type:e,data:t},n,r)=>wu&&t instanceof Blob?n?r(t):ku(t,r):bu&&(t instanceof ArrayBuffer||Su(t))?n?r(t):ku(new Blob([t]),r):r(gu[e]+(t||"")),ku=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Pu(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Tu;const Ou="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cu="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Cu[Ou.charCodeAt(e)]=e;const xu="function"==typeof ArrayBuffer,Ru=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Nu(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:Au(e.substring(1),t)};return yu[n]?e.length>1?{type:yu[n],data:e.substring(1)}:{type:yu[n]}:vu},Au=(e,t)=>{if(xu){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const c=new ArrayBuffer(s),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=Cu[e.charCodeAt(t)],r=Cu[e.charCodeAt(t+1)],o=Cu[e.charCodeAt(t+2)],i=Cu[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|o>>2,u[l++]=(3&o)<<6|63&i;return c})(e);return Nu(n,t)}return{base64:!0,data:e}},Nu=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Fu=String.fromCharCode(30);function ju(){return new TransformStream({transform(e,t){!function(e,t){wu&&e.data instanceof Blob?e.data.arrayBuffer().then(Pu).then(t):bu&&(e.data instanceof ArrayBuffer||Su(e.data))?t(Pu(e.data)):Eu(e,!1,e=>{Tu||(Tu=new TextEncoder),t(Tu.encode(e))})}(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let Iu;function Mu(e){return e.reduce((e,t)=>e+t.length,0)}function Uu(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Lu(e){if(e)return function(e){for(var t in Lu.prototype)e[t]=Lu.prototype[t];return e}(e)}Lu.prototype.on=Lu.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Lu.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Lu.prototype.off=Lu.prototype.removeListener=Lu.prototype.removeAllListeners=Lu.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},Lu.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},Lu.prototype.emitReserved=Lu.prototype.emit,Lu.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Lu.prototype.hasListeners=function(e){return!!this.listeners(e).length};const zu="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Bu="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function Du(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const $u=Bu.setTimeout,Wu=Bu.clearTimeout;function qu(e,t){t.useNativeTimers?(e.setTimeoutFn=$u.bind(Bu),e.clearTimeoutFn=Wu.bind(Bu)):(e.setTimeoutFn=Bu.setTimeout.bind(Bu),e.clearTimeoutFn=Bu.clearTimeout.bind(Bu))}function Hu(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function Vu(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class Yu extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Ku extends Lu{constructor(e){super(),this.writable=!1,qu(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new Yu(e,t,n)),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=Ru(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 n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class Gu extends Ku{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 n=e.split(Fu),r=[];for(let e=0;e<n.length;e++){const o=Ru(n[e],t);if(r.push(o),"error"===o.type)break}return r})(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 n=e.length,r=new Array(n);let o=0;e.forEach((e,i)=>{Eu(e,!1,e=>{r[i]=e,++o===n&&t(r.join(Fu))})})})(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]=Vu()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let Ju=!1;try{Ju="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const Xu=Ju;function Qu(){}class Zu extends Gu{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.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 ed extends Lu{constructor(e,t,n){super(),this.createRequest=e,qu(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=Du(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=ed.requestsCount++,ed.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=Qu,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete ed.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(ed.requestsCount=0,ed.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",td);else if("function"==typeof addEventListener){addEventListener("onpagehide"in Bu?"pagehide":"unload",td,!1)}function td(){for(let e in ed.requests)ed.requests.hasOwnProperty(e)&&ed.requests[e].abort()}const nd=function(){const e=rd({xdomain:!1});return e&&null!==e.responseType}();function rd(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Xu))return new XMLHttpRequest}catch(e){}if(!t)try{return new(Bu[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const od="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class id extends Ku{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=od?{}:Du(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}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 n=e[t],r=t===e.length-1;Eu(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&zu(()=>{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]=Vu()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const sd=Bu.WebSocket||Bu.MozWebSocket;const ad={websocket:class extends id{createSocket(e,t,n){return od?new sd(e,t,n):t?new sd(e,t):new sd(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Ku{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){Iu||(Iu=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(Mu(n)<1)break;const e=Uu(n,1);i=!(128&~e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(Mu(n)<2)break;const e=Uu(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(Mu(n)<8)break;const e=Uu(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(vu);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(Mu(n)<o)break;const e=Uu(n,o);a.enqueue(Ru(i?e:Iu.decode(e),t)),r=0}if(0===o||o>e){a.enqueue(vu);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=ju();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const o=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();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 n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&zu(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Zu{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=nd&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new ed(rd,this.uri(),e)}}},ld=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,cd=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ud(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=ld.exec(e||""),i={},s=14;for(;s--;)i[cd[s]]=o[s]||"";return-1!=n&&-1!=r&&(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 n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,i.query),i}const dd="function"==typeof addEventListener&&"function"==typeof removeEventListener,hd=[];dd&&addEventListener("offline",()=>{hd.forEach(e=>e())},!1);class pd extends Lu{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 n=ud(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=ud(t.host).host);qu(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={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),dd&&(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"})},hd.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 n=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](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&pd.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",pd.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 n=this.writeBuffer[t].data;if(n&&(e+=Hu(n)),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,zu(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{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?n():e()}):this.upgrading?n():e()),this}_onError(e){if(pd.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(),dd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=hd.indexOf(this._offlineEventListener);-1!==e&&hd.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}pd.protocol=4;class _d extends pd{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),n=!1;pd.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;pd.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"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 o(){n||(n=!0,c(),t.close(),t=null)}const i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function s(){i("transport closed")}function a(){i("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};t.once("open",r),t.once("error",i),t.once("close",s),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let fd=class extends _d{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>ad[e]).filter(e=>!!e)),super(e,n)}};const md="function"==typeof ArrayBuffer,gd=Object.prototype.toString,yd="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===gd.call(Blob),vd="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===gd.call(File);function wd(e){return md&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||yd&&e instanceof Blob||vd&&e instanceof File}function bd(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(bd(e[t]))return!0;return!1}if(wd(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return bd(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&bd(e[t]))return!0;return!1}function Sd(e){const t=[],n=e.data,r=e;return r.data=Ed(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Ed(e,t){if(!e)return e;if(wd(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Ed(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Ed(e[r],t));return n}return e}function kd(e,t){return e.data=Pd(e.data,t),delete e.attachments,e}function Pd(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 n=0;n<e.length;n++)e[n]=Pd(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Pd(e[n],t));return e}const Td=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Od;!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"}(Od||(Od={}));function Cd(e){return"[object Object]"===Object.prototype.toString.call(e)}class xd extends Lu{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 n=t.type===Od.BINARY_EVENT;n||t.type===Od.BINARY_ACK?(t.type=n?Od.EVENT:Od.ACK,this.reconstructor=new Rd(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!wd(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 n={type:Number(e.charAt(0))};if(void 0===Od[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Od.BINARY_EVENT||n.type===Od.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!xd.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Od.CONNECT:return Cd(t);case Od.DISCONNECT:return void 0===t;case Od.CONNECT_ERROR:return"string"==typeof t||Cd(t);case Od.EVENT:case Od.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Td.indexOf(t[0]));case Od.ACK:case Od.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Rd{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=kd(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Ad=Object.freeze({__proto__:null,Decoder:xd,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Od.EVENT&&e.type!==Od.ACK||!bd(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Od.EVENT?Od.BINARY_EVENT:Od.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Od.BINARY_EVENT&&e.type!==Od.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=Sd(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Od},protocol:5});function Nd(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Fd=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class jd extends Lu{constructor(e,t,n){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,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Nd(e,"open",this.onopen.bind(this)),Nd(e,"packet",this.onpacket.bind(this)),Nd(e,"error",this.onerror.bind(this)),Nd(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 n,r,o;if(Fd.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:Od.EVENT,data:t,options:{}};if(i.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),i.id=e}const s=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const o=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"))},r),i=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{const o=(e,t)=>e?r(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),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:Od.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 Od.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 Od.EVENT:case Od.BINARY_EVENT:this.onevent(e);break;case Od.ACK:case Od.BINARY_ACK:this.onack(e);break;case Od.DISCONNECT:this.ondisconnect();break;case Od.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 n of t)n.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 n=!1;return function(...r){n||(n=!0,t.packet({type:Od.ACK,id:e,data:r}))}}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:Od.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 n=0;n<t.length;n++)if(e===t[n])return t.splice(n,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 n=0;n<t.length;n++)if(e===t[n])return t.splice(n,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 n of t)n.apply(this,e.data)}}}function Id(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}Id.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Id.prototype.reset=function(){this.attempts=0},Id.prototype.setMin=function(e){this.ms=e},Id.prototype.setMax=function(e){this.max=e},Id.prototype.setJitter=function(e){this.jitter=e};class Md extends Lu{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,qu(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!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Id({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Ad;this.encoder=new r.Encoder,this.decoder=new r.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 fd(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Nd(t,"open",function(){n.onopen(),e&&e()}),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Nd(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),o(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),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(Nd(e,"ping",this.onping.bind(this)),Nd(e,"data",this.ondata.bind(this)),Nd(e,"error",this.onerror.bind(this)),Nd(e,"close",this.onclose.bind(this)),Nd(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){zu(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new jd(this,e,t),this.nsps[e]=n),n}_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 n=0;n<t.length;n++)this.engine.write(t[n],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 n;this.cleanup(),null===(n=this.engine)||void 0===n||n.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 n=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&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ud={};function Ld(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=ud(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=Ud[o]&&i in Ud[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new Md(r,t):(Ud[o]||(Ud[o]=new Md(r,t)),a=Ud[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(Ld,{Manager:Md,Socket:jd,io:Ld,connect:Ld});var zd,Bd,Dd,$d=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},Wd=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class qd{constructor(e,t=Po.PROD){zd.set(this,null),Bd.set(this,void 0),Dd.set(this,void 0),$d(this,Bd,e,"f"),$d(this,Dd,t,"f")}connect(){return new Promise((e,t)=>{$d(this,zd,Ld(No({urlName:"APP_POSE_DETECTION_WEBSOCKET_URL",urlType:Wd(this,Dd,"f")})),"f"),Wd(this,zd,"f").on("connect",()=>{var n;const r=null===(n=Wd(this,zd,"f"))||void 0===n?void 0:n.id;r?e(r):t("Failed to obtain socket ID.")}),Wd(this,zd,"f").on("connect_error",e=>{t(e)})})}videoEmit({image:e,scanId:t}){if(!Wd(this,zd,"f"))throw new Error("Socket is not connected");Wd(this,zd,"f").emit("video",{image:e,user_unique_key:t})}disconnect(){var e;null===(e=Wd(this,zd,"f"))||void 0===e||e.disconnect()}poseStatus(e){if(!Wd(this,zd,"f"))throw new Error("Socket is not connected");Wd(this,zd,"f").on("pose_status",t=>{null==e||e(t)})}connected(){var e;return!!(null===(e=Wd(this,zd,"f"))||void 0===e?void 0:e.connected)}}zd=new WeakMap,Bd=new WeakMap,Dd=new WeakMap;var Hd,Vd,Yd,Kd,Gd,Jd,Xd,Qd,Zd,eh,th=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})},nh=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},rh=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class oh{constructor(e,t=Po.PROD){Hd.add(this),Vd.set(this,new Map),Yd.set(this,new Map),Kd.set(this,void 0),Gd.set(this,void 0),Qd.set(this,e=>{if(e){const t=rh(this,Vd,"f").get(e),n=rh(this,Yd,"f").get(e);null==t||t.close(),n&&clearTimeout(n),rh(this,Vd,"f").delete(e),rh(this,Yd,"f").delete(e)}else rh(this,Vd,"f").forEach(e=>e.close()),rh(this,Yd,"f").forEach(e=>clearTimeout(e)),rh(this,Vd,"f").clear(),rh(this,Yd,"f").clear()}),Zd.set(this,({onSuccess:e,onError:t,tryonId:n})=>{const r=setTimeout(()=>{rh(this,eh,"f").call(this,{onSuccess:e,onError:t,tryonId:n}),rh(this,Qd,"f").call(this,n)},3e5);rh(this,Yd,"f").set(n,r)}),this.handleTryOnWebSocket=({tryonId:e,onError:t,onSuccess:n,onClose:r,onOpen:o})=>{if(!1===Co(e))throw new Error(bo);rh(this,Qd,"f").call(this,e);const i=`${No({urlName:Zr,urlType:rh(this,Gd,"f")})}${ho}?tryonId=${e}`,s=new WebSocket(i);rh(this,Vd,"f").set(e,s),s.onopen=()=>{null==o||o(),rh(this,Zd,"f").call(this,{onSuccess:n,onError:t,tryonId:e})},s.onmessage=r=>{let o;try{o=JSON.parse(r.data)}catch(e){return void console.log("Invalid JSON:",r.data)}"success"===(null==o?void 0:o.status)?null==n||n(o):null==t||t(o);const i=rh(this,Yd,"f").get(e);i&&clearTimeout(i),rh(this,Yd,"f").delete(e)},s.onclose=()=>{null==r||r()},s.onerror=e=>{null==t||t(e)}},eh.set(this,e=>th(this,[e],void 0,function*({onSuccess:e,onError:t,tryonId:n}){try{const t=yield this.getTryOnResult({tryonId:n});null==e||e(t.data)}catch(e){null==t||t(e)}})),this.getTryOnResult=({tryonId:e})=>{if(!1===Co(e))throw new Error(bo);const t=`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${uo}/${e}`;return Ar.post(t,null,{headers:{"X-Api-Key":rh(this,Kd,"f")}})},nh(this,Kd,e,"f"),nh(this,Gd,t,"f")}uploadFile(e){return th(this,arguments,void 0,function*({files:e,userEmail:t,fileNoLimit:n=2}){if(!1===Co(e,t))throw new Error(bo);if(!Fo(t.trim()))throw new Error(Eo);if(n<=0)throw new Error(`Provide valid file number limit ${n}.`);if((null==e?void 0:e.length)>n)throw new Error(`Cannot allow more than ${n} files.`);try{const n={userEmail:t,userImages:[]};null==e||e.forEach(e=>{n.userImages.push(e.name)});const r=yield rh(this,Hd,"m",Jd).call(this,n);for(const t of e)yield rh(this,Hd,"m",Xd).call(this,r.data.uploadUrls[t.name].url,t);return"uploaded successfully!"}catch(e){throw e}})}getUploadedFiles(e){if(!1===Co(e))throw new Error(bo);if(!Fo(e.trim()))throw new Error(Eo);const t={userEmail:e};return Ar.post(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${lo}`,t,{headers:{"X-Api-Key":rh(this,Kd,"f")}})}deleteImage({userEmail:e,fileName:t}){if(!1===Co(e,t))throw new Error(bo);if(!Fo(e.trim()))throw new Error(Eo);const n={userEmail:e,file:t};return Ar.delete(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${co}`,{headers:{"X-Api-Key":rh(this,Kd,"f")},data:n})}handleTryOnSubmit({shopDomain:e,products:t,selectedUserImages:n,requestSource:r,callbackUrl:o,openTryonId:i,selectedProductImageUrl:s,token:a}){if(!1===Co(e,t,a))throw new Error(bo);const l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({products:t,customerStoreUrl:e},null!=n&&{selectedUserImages:n}),null!=r&&{requestSource:r}),null!=o&&{callbackUrl:o}),null!=i&&{openTryonId:i}),null!=s&&{selectedProductImageUrl:s}),c=`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${ho}`,u={"X-Api-Key":rh(this,Kd,"f")};return a&&(u.Authorization=`Bearer ${a}`),Ar.post(c,l,{headers:u})}getShareLink(e){return Ar.post(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${mo}`,{tryonId:e},{headers:{"X-Api-Key":rh(this,Kd,"f")}})}getProductImageEligibility({storeUrl:e,productHandle:t,imageURL:n,productDescription:r}){if(!1===Co(e,t,n))throw new Error(bo);const o={storeUrl:e,productHandle:t,imageURL:n,productDescription:null!=r?r:null},i=`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${yo}`;return Ar.post(i,o,{headers:{"X-Api-Key":rh(this,Kd,"f")}})}}Vd=new WeakMap,Yd=new WeakMap,Kd=new WeakMap,Gd=new WeakMap,Qd=new WeakMap,Zd=new WeakMap,eh=new WeakMap,Hd=new WeakSet,Jd=function(e){if(!1===Co(e))throw new Error(bo);return Ar.post(`${No({urlName:Qr,urlType:rh(this,Gd,"f")})}${ao}`,e,{headers:{"Content-Type":"application/json","X-Api-Key":rh(this,Kd,"f")}})},Xd=function(e,t){if(!1===Co(e,t))throw new Error(bo);return Ar.put(e,t,{headers:{"Content-Type":t.type}})};var ih,sh,ah,lh=function(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n},ch=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};ih=new WeakMap,sh=new WeakMap,function(e){e.DEV="dev",e.STAGING="staging",e.PROD="prod"}(ah||(ah={}));const uh=new class{constructor(e,t=Po.PROD){ih.set(this,void 0),sh.set(this,void 0),lh(this,ih,e,"f"),lh(this,sh,t,"f"),this.auth=new zo(ch(this,ih,"f"),ch(this,sh,"f")),this.custom=new qo(ch(this,ih,"f"),ch(this,sh,"f")),this.fileUpload=new eu(ch(this,ih,"f"),ch(this,sh,"f")),this.measurement=new mu(ch(this,ih,"f"),ch(this,sh,"f")),this.poseDetection=new qd(ch(this,ih,"f"),ch(this,sh,"f")),this.tryOn=new oh(ch(this,ih,"f"),ch(this,sh,"f"))}}("8e35dfd4-010c-40ca-ad79-fc72dc307efb",ah.STAGING);let dh,hh=null,ph=null;var _h=o.memo(function({setIsScanLocked:t,resetDetector:n,scanID:r,setIsVideoUploaded:o,setScanFailsError:s,setScanStartTime:a,setScanUniqueKey:u,userDetails:p,config:_}){const{gender:f,heightInCm:m,email:g,shopDomain:w}=p,b=h(null),S=h(null),[E,k]=l([]),[P,T]=l(!0),[O,C]=l(!1),[x,R]=l(!1),[A,N]=l(!0),[F,j]=l(!1),I=h(null),[M,U]=l(""),[L,z]=l([]),[B,D]=l(""),[$,W]=l(!1),[q,H]=l(!1),[V,Y]=l(!1),[K,G]=l([]),[J,X]=l(!1),Q=h(!0),Z=h(!0),ee=h(!1);let te=0;const{setStartGyro:ne,handleFileUpload:re,setUploadLoading:oe}=d(Et),ie=()=>{ee.current=!1,clearTimeout(dh),I.current&&clearTimeout(I.current),u(Ee()),s(""),oe?.(!1),k([]),T(!0),C(!1),R(!1),N(!0),j(!1),I.current=null,U(""),z([]),D(""),W(!$),ne(!1),kt.stopAudio(),H(!1),Y(!1),te=0,null!==S.current&&S.current.stop(),K.forEach(e=>{S.current&&S.current.removeEventListener("dataavailable",e)}),G([]),Q.current=!0,X(!1),o(!1)},se=i(()=>{setTimeout(()=>{T(!1)},1e3)},[]),ae=i(()=>{ve({eventName:`${w}/rescan`,email:g,scanID:r,height:m,gender:f,status:!1}),Q.current=!1,ie(),ge()},[ie,r,g]),le=i(()=>{Q.current=!1,Y(!0),X(!1),I.current&&clearTimeout(I.current),S.current&&S.current.pause(),kt.stopAudio(),uh.poseDetection.disconnect(),te=0,S.current&&S.current.stop(),K.forEach(e=>{S.current&&S.current.removeEventListener("dataavailable",e)}),G([]),clearTimeout(dh)},[S,K,kt,Q]),ce=v.filter(e=>MediaRecorder.isTypeSupported(e)),ue=i(async()=>{Q.current=!0,await kt.playAudio(`${y}SpotOn.mp3`),Y(!1),X(!1),I.current&&clearTimeout(I.current),C(!1)},[I,kt]),de=i(async()=>{try{hh=await uh.poseDetection.connect(),we.capture(`${w}/pose_detection_connected`,{scanID:r,email:g,id:hh})}catch(e){console.log(e,"while connecting websocket")}},[r,w,g]),he=i(({data:e})=>{e&&e.size>0&&Q.current&&(k(t=>t.concat(e)),!ee.current&&b.current&&(ee.current=!0))},[ue,be,w,r,g,b]),pe=i(async()=>{L.length>0&&Q.current&&(await kt.playAudio(y+L[L.length-1]),Q.current&&(dh=setTimeout(pe,2e3)))},[L,Q]),_e=i(()=>{S&&S.current&&S.current.stop(),C(!0);try{if(b&&b.current&&b.current.stream){const e={mimeType:ce[0]};S.current=new MediaRecorder(b.current.stream,e),S.current.addEventListener("dataavailable",he),G([...K,he]),S.current.start(1e3),N(!1)}}catch(e){console.log("error while using media recorder",e)}},[b,ce,he,K]),fe=i(async()=>{I.current&&clearTimeout(I.current),_e(),Q.current&&(I.current=setTimeout(async()=>{Q.current&&(await kt.playAudio(`${y}SpotOn.mp3`),C(!1))},15e3)),R(!0),Q.current&&await kt.playAudio(`${y}Spin.mp3`)},[_e,Q,kt]),me=i(({data:e})=>{e.size>0&&uh.poseDetection.connected()&&(uh.poseDetection.poseStatus(async e=>{if(e&&e.audio&&e.audio.length>0){const t=document.querySelector("#audioElement");!0===e.status&&e.sid===hh?te<2?(0===te&&t?.paused&&await kt.playAudio(y+e.audio),te+=1):(D(e.audio),clearTimeout(dh),uh.poseDetection.disconnect(),setTimeout(fe,1e3)):(te=0,!t?.paused||ph&&ph?.audioName===e.audio?ph?.audioName===e.audio&&t?.paused&&(ph&&ph.no_of_times_skipped>=ph.skipCount?(ph.no_of_times_skipped=0,kt.playAudio(y+e.audio)):ph&&(ph.no_of_times_skipped+=1)):(ph={skipCount:2,no_of_times_skipped:0,audioName:e.audio},kt.playAudio(y+e.audio)))}}),b?.current&&null!==b.current.getScreenshot()&&uh.poseDetection.videoEmit({image:b.current.getScreenshot()||"",scanId:r}))},[b,r,uh,hh,te,fe,kt]),ge=i(async()=>{j(!0),ne(!0),Z.current&&(Z.current=!1,be({eventName:"scan started",scanID:r,status:"success",email:g})),a(Se()),T(!0),Q.current&&await kt.playAudio(`${y}StartScan.mp3`),Q.current&&await kt.playAudio(`${y}LiftArmsAndHoldAtHip.mp3`),Q.current&&(j(!1),C(!0),H(!0),X(!0),se());try{if(b&&b.current&&b.current.stream&&Q.current){const e={mimeType:ce[0]};Q.current&&(S.current=new MediaRecorder(b.current.stream,e)),Q.current&&S.current&&S.current.addEventListener("dataavailable",me),G([...K,me]),S.current&&S.current.start(1e3),N(!1),Q.current&&(dh=setTimeout(pe,2e3))}}catch(e){console.log("error ----------",e)}},[b,ce,me,K,pe,Q]);return c(()=>(w&&(t(!0),de()),()=>{hh&&(uh.poseDetection.disconnect(),we.capture(`${w}/pose_detection_disconnected`,{scanID:r,email:g,id:hh})),K.forEach(e=>{S?.current?.removeEventListener("dataavailable",e)})}),[$,w]),c(()=>{L.push(M)},[M]),c(()=>{z([])},[B]),c(()=>{const e=E.length&&E.length>0;A||!e||O||!Q.current||V||S&&S.current&&(O||(S.current.stop(),N(!0)))},[A,O,E,V]),c(()=>{const e=E.length&&E.length>0;if(A||!e||O)console.log("No video found to upload");else if(S&&S.current&&Q.current&&!V&&!O){const e=new File(E,`${r}.webm`,{type:"video/webm"});oe?.(!0),s(""),re?.(e)}},[A,O,E,V,S,Q]),c(()=>{ie()},[]),e(St,{resetDetector:n,handleShowStreamCamera:ie,loadingCam:P,handlePause:le,showRestart:q,pause:V,handleReScan:ae,recordingStarted:O,isScanning:F,startSendingVideoFrames:ge,faceDone:x,stopRecording:ue,showPause:J,webcamRef:b,handleUserMedia:se,config:_})});function fh({scanID:t,userDetails:n,setIsVideoUploaded:r,setScanFailsError:o,setScanStartTime:i,setScanUniqueKey:s,config:a}){const[u,d]=l(90),[p,_]=l(0),[f,m]=l(null),[g,y]=l(!1),[v,w]=l(0),b=h([]),[S,E]=l(!1),k=u-p,P=k>=80&&k<=95;c(()=>{if("undefined"!=typeof window&&window.DeviceOrientationEvent){const e=e=>{if(null!==e.beta){let t=Math.abs(e.beta);null!==e.gamma&&(t*=Math.cos(e.gamma*Math.PI/180)),t=Math.max(0,Math.min(180,t)),d(t)}},t=async()=>{const t=DeviceOrientationEvent;if(t&&"function"==typeof t.requestPermission)try{"granted"===await t.requestPermission()&&window.addEventListener("deviceorientation",e)}catch(e){console.error("Permission error",e)}else window.addEventListener("deviceorientation",e);return()=>{e&&window.removeEventListener("deviceorientation",e)}};document.addEventListener("click",t,{once:!0})}},[]),c(()=>{if(b.current=[...b.current.slice(-4),k],b.current.length>=5){const e=Math.max(...b.current)-Math.min(...b.current);w(P&&e<2?e=>Math.min(100,e+10):e=>Math.max(0,e-20))}P||null===f&&!g||O()},[k,P,f,g]),c(()=>{v>=100&&null===f&&!g&&T(),v<50&&null!==f&&O()},[v,f,g]);const T=()=>{m(3);const e=setInterval(()=>{m(t=>null===t||t<=1?(clearInterval(e),y(!0),null):t-1)},1e3)},O=()=>{m(null),S||y(!1)};return e(tt,{angle:k,countdown:f,isScanning:g,isInTargetRange:P,stabilityScore:v,config:a,children:g&&e(_h,{setIsScanLocked:E,resetDetector:()=>{d(90),_(0),m(null),y(!1),w(0),E(!1),b.current=[]},scanID:t,userDetails:n,setIsVideoUploaded:r,setScanFailsError:o,setScanStartTime:i,setScanUniqueKey:s,config:a})})}function mh({message:r,config:i}){const[s]=o.useState(!0),{translate:a}=d(wt)||{};return e($e,{open:s,className:"confirm-modal",children:e("div",{className:"modal-main",children:e("div",{className:"text-center",children:t(n,r?{children:[e("h2",{style:{fontFamily:i?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:i?.style?.heading?.headingFontSize||"32px",color:i?.style?.heading?.headingColor||"#000",fontWeight:i?.style?.heading?.headingFontWeight||"normal"},children:"Seems camera already in use"}),t("p",{className:"mt-[0.5rem] text-sm",style:{fontFamily:i?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:i?.style?.base?.baseFontSize||"16px",color:i?.style?.base?.baseTextColor||"#000"},children:["Can you try closing the browser/app that is using the camera and try again here."," "]})]}:{children:[e("h2",{style:{fontFamily:i?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:i?.style?.heading?.headingFontSize||"32px",color:i?.style?.heading?.headingColor||"#000",fontWeight:i?.style?.heading?.headingFontWeight||"normal"},children:a?.(g.Please_check_your_setting_for_camera_permission)}),e("p",{className:"mt-[0.5rem] text-sm",style:{fontFamily:i?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:i?.style?.base?.baseFontSize||"16px",color:i?.style?.base?.baseTextColor||"#000"},children:`${a?.(g.Settings)} > ${ke()} > ${a?.(g.Enable_the_camera_permissions)}`})]})})})})}function gh({setShowDrawer:t,config:n,loader:r}){const[o,s]=l({disabled:!1,message:""}),[a,u]=l(!0),d=h(null),p=i(async()=>{const e=await Pe();s(e),u(!1)},[]);return c(()=>{p()},[]),a?e(Re,{url:r}):o?.disabled?e(mh,{config:n,message:o?.message}):e(it,{audio:!1,ref:d,screenshotQuality:1,videoConstraints:_,mirrored:!0,onUserMedia:()=>t?.(!0),screenshotFormat:"image/jpeg",style:{position:"relative",top:0,bottom:0,zIndex:0,width:"100%",height:"100%",objectFit:"cover"}})}function yh({link:t,onReady:n,wrapperClassName:r="[&_video]:rounded-t-[20px] w-full h-full"}){const o=h(null),i=h(null);let s={autoplay:!0,controls:!1,responsive:!0,fluid:!0,muted:!0,navigationUI:"hide",preload:"metadata",poster:w};return c(()=>{if(!i.current&&t&&o?.current){const e=Ae(o.current,{...s});e.ready(()=>{i.current=e;const r={...s,sources:[{src:t,type:"application/x-mpegURL"}]};e.autoplay(r.autoplay),e.src(r.sources),n?.(e)})}},[t,o]),c(()=>{const e=i.current;return()=>{e&&!e.isDisposed()&&(e.dispose(),i.current=null)}},[i]),e("div",{className:r,children:e("video",{ref:o,muted:!0,className:"video-js",playsInline:!0,onDrag:e=>e.preventDefault()})})}function vh({scanFailsError:r,serverAtCapacity:o=!1,onNext:i,gender:s,setScanUniqueKey:a,resolvedConfig:c,setIsVideoUploaded:u}){const{translate:h}=d(wt)||{},[_,m]=l(!1),y=()=>{m(!_)};return t(n,{children:[t("div",{className:"flex flex-col h-full max-w-[28rem] mx-auto w-full rounded-t-[20px] overflow-y-auto",style:{background:c?.style?.base?.backgroundColor},children:[e("div",{className:"w-full max-w-[28rem] mx-auto pt-[1rem] px-[1rem]",children:e(p,{noTitle:!0,resolvedConfig:c})}),t("div",{className:"flex-1",children:[r&&t("div",{className:"px-[1rem]",children:[e("h2",{className:"text-center",style:{fontFamily:c?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:c?.style?.heading?.headingFontSize||"32px",color:c?.style?.heading?.headingColor||"#000",fontWeight:c?.style?.heading?.headingFontWeight||"normal"},children:"There was an issue with your scan"}),e("p",{style:{fontFamily:c?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:"Reason:"}),e("p",{style:{fontFamily:c?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:Te(r)}),e("img",{className:"my-[0.5rem] aspect-[2/1.4] w-full object-cover",onClick:y,src:b[s],alt:"icon"})]}),o&&t("div",{className:"p-[1rem] text-center",children:[t("h3",{style:{fontFamily:c?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:c?.style?.heading?.headingFontSize||"32px",color:c?.style?.heading?.headingColor||"#000",fontWeight:c?.style?.heading?.headingFontWeight||"normal"},children:[h?.(g.Scan_s)," ",e("span",{children:h?.(g.vision_model)})," ",h?.(g.is_at_capacity)]}),e("p",{className:"text-base mt-[0.5rem]",style:{fontFamily:c?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:h?.(g.We_are_sorry_about_this_We_are_working_hard_to_add_capacity_Please_try_again_soon)})]})]}),r&&e("div",{className:"p-[1rem] flex gap-[0.5rem]",children:e(f,{disabled:!1,buttonText:"Scan again",className:"!shadow-none",buttonFunc:()=>{i?i?.():a(Ee()),u(!1)},resolvedConfig:c})})]}),_&&t($e,{className:"w-screen h-screen video-modal",onClose:y,open:_,children:[e("div",{className:"flex justifyEnd ",children:e("span",{className:"closeBtn",onClick:y,children:e(st,{className:"absolute right-[8px] top-[8px] text-white z-[9]"})})}),e("div",{className:"aspect-video object-cover rounded-[20px] ",children:e(yh,{link:s?S[s].PRE_LINK:S.male.PRE_LINK,wrapperClassName:"w-screen h-screen fixed top-[0] left-[0]"})})]})]})}function wh({scanId:n,userDetails:r,config:o,isFaceScan:s,isVideoUploadedCorrect:a,isMeasurementAvailable:u,onComplete:d,isSuccess:h}){const{gender:_,shopDomain:m,heightInCm:g,deviceFocalLength:y,userName:v,email:w,scanType:b}=r,S=[E,k,P].includes(b),[C,x]=l(!0),R=i(async()=>{try{S&&await uh.auth.addUser({scanId:n,email:w,name:v,gender:_,height:g}),we.capture(m,{scanID:n,email:w,height:g,focalLength:y,clothesFit:"0",gender:_})}catch(e){console.log(e)}},[S]);c(()=>{a&&R()},[a]);const A=h||(s?u&&a:a||u);return e(je,{className:"flex h-full w-full flex-col ",children:t("div",{className:"h-full w-full flex-col items-center justify-center flex",children:[e(gh,{loader:o?.loader,setShowDrawer:x}),e(Qe,{open:C,onClose:(e,t)=>{},className:"camera-drawer",anchor:"bottom",children:e("div",{className:"max-w-[28rem] mx-auto w-full h-full flex text-center flex-col justify-between items-center bg-primary rounded-t-[30px] p-[1rem]",style:{background:o?.style?.base?.backgroundColor},children:t("div",{className:"w-full h-full flex flex-col",children:[e(p,{title:"Your measurements are being taken",resolvedConfig:o}),e("div",{className:"flex items-center justify-center flex-1",children:e("video",{preload:"auto",className:"max-h-[calc(100vh-450px)] mx-auto w-full object-contain border-none",muted:!0,loop:!0,autoPlay:!0,playsInline:!0,children:e("source",{src:_===Oe.Male?T:O,type:"video/mp4"})})}),A&&e(f,{resolvedConfig:o,className:"!w-[180px] mx-auto",buttonText:"Next",buttonFunc:d&&d})]})})})]})})}const bh=({userDetails:n,language:r=ge.English,config:o,onRetry:s,onScanSuccess:a,onComplete:u,onScanError:h,isError:p,isSuccess:_})=>{const{gender:f,scanType:m,shopDomain:g,heightInCm:y,email:v,deviceFocalLength:w,deviceModelName:b,callbackUrl:S}=n,[E,k]=l(!1),[P,T]=l(!1),[O,A]=l(!1),[N,F]=l({disabled:!1,message:""}),[j,I]=l(""),[M,U]=l(!1),[L,z]=l(!0),[B,D]=l(!1),[$,W]=l(""),[q,H]=l(Se()),{gyroData:V}=function(e){const[t,n]=l([]),[r,o]=l(!1),s=i(e=>{try{const{alpha:t,beta:r,gamma:o}=e;n(e=>[...e,{alpha:t?.toString()||void 0,beta:r?.toString()||void 0,gamma:o?.toString()||void 0,timestamp:(new Date).toISOString()}])}catch(e){console.log(e)}},[]),a=i(async()=>{const e=DeviceOrientationEvent;if(void 0!==e&&"function"==typeof e.requestPermission)try{"granted"===await e.requestPermission()?o(!0):console.warn("Device orientation permission denied.")}catch(e){console.error("Error requesting device orientation permission:",e)}else o(!0)},[]);return c(()=>(e&&r?window.addEventListener("deviceorientation",s):n([]),()=>{window.removeEventListener("deviceorientation",s)}),[e,r,s]),c(()=>{e&&a()},[e,a]),{gyroData:t}}(B),{setPreferredLanguage:Y}=d(wt)||{},K=C(o),G=i(()=>{W(Ee()),I(""),k(!1),U(!1)},[]),J=e=>{h({...e,message:Te(e)}),X(),A(!1),I(e),T(!1),be({eventName:`${g}/measurement_failed/fit-view`,scanID:$,status:"failed",email:v,message:Te(e)}),q&&be({eventName:`${g}/scan_completion_time`,scanID:$,status:"failed",completionTime:Se()-q,email:v})},X=()=>{H(null),W("")},Q=i(async e=>{if(e&&"success"===e?.scanStatus&&"intermediate"===e?.resultType&&200===e?.code)return be({eventName:`${g}/measurement_success/intermediate`,scanID:$,status:"success",email:v}),void a?.(e);X();const t=$;A(!0),be({eventName:`${g}/measurement_success/fit-view`,scanID:t,status:"success",email:v}),q&&be({eventName:`${g}/scan_completion_time`,scanID:t,status:"success",completionTime:Se()-q,email:v})},[m,g,$]),Z=e=>{A(!1),I(""),T(!1),uh.measurement.handleMeasurementSocket({scanId:e||$,onOpen:()=>{xe({eventName:`${g}/webSocket`,scanID:$,connection:"open",type:"measurement_recommendation",email:v})},onClose:()=>xe({eventName:`${g}/webSocket`,scanID:$,connection:"close",type:"measurement_recommendation",email:v}),onError:e=>{J(e),xe({eventName:`${g}/webSocket`,scanID:$,connection:"error",type:"measurement_recommendation",email:v})},onSuccess:e=>{xe({eventName:`${g}/webSocket`,scanID:$,connection:"success",type:"measurement_recommendation",email:v}),Q(e)}})},ee=i(async e=>{const t=Ce({gender:f,focal_length:`${w}`,height:`${y}`,customer_store_url:g,clothes_fit:"0",scan_type:m,callback_url:S||"https://example.com/webhook"});be({eventName:`${g}/body_scan_meta_data`,scanID:$,email:v,data:JSON.stringify(t)});try{await uh.fileUpload.uploadFileFrontend({file:e,arrayMetaData:t,scanId:$,email:v}),await uh.fileUpload.setDeviceInfo({model:b,detection:"manual",gyro:V,scanId:$}),console.log("video successfully uploaded"),U(!1),be({eventName:`${g}/scan_success`,scanID:$,status:"success",email:v,data:JSON.stringify(t)}),be({eventName:"scan finished",scanID:$,status:"success",email:v}),H(Se()),setTimeout(()=>{U(!0)},3e3)}catch(e){be({eventName:"scan finished",scanID:$,status:"failed",email:v,message:Te(e)}),be({eventName:`${g}/scan_failed`,scanID:$,status:"failed",email:v,message:Te(e),data:JSON.stringify(t)}),I(Te(e)),U(!1),console.log(e,"video upload failed")}finally{D(!1)}},[$,V]),te=i(async e=>{try{const t=await uh.measurement.getMeasurementResult(e),n=t?.data?.isMeasured,r=q||Se(),o=Se(),i=300;if(z(!1),!1===n)return X(),void W(Ee());k(!0),!0===n?await Q(null):null===n&&r>o+i?J(t?.data?.error):Z(e)}catch(e){console.log(e),X(),W(Ee()),k(!1)}},[J,Q,W]),ne=i(async()=>{if(+y<152.4||+y>213.36)return void h({message:"Height must be between 152.4cm (5ft) and 213.36cm (7ft)"});const e=await Pe();if(e.disabled)be({eventName:`${g}/camera_activation`,scanID:$,status:"failed",email:v}),z(!1);else{$?te($):z(!1),be({eventName:`${g}/camera_activation`,scanID:$,status:"success",email:v})}F(e),I(""),U(!1)},[te,v,$,W,g]);return c(()=>{Y?.(r),we.init(x,{api_host:R}),we.capture("$pageview")},[]),c(()=>{p||_||g&&ne()},[g,y,p,_]),c(()=>{p||_||M&&g&&$&&Z()},[M,g,$,p,_]),p?t(bt,{children:[e(gh,{}),e(Qe,{anchor:"bottom",open:!0,className:"camera-drawer",onClose:(e,t)=>{},children:e(vh,{scanFailsError:j||p,onNext:()=>{},setScanUniqueKey:W,gender:f,resolvedConfig:K,setIsVideoUploaded:U})})]}):_?e(wh,{isFaceScan:!1,scanId:$,isMeasurementAvailable:O,userDetails:n,isVideoUploadedCorrect:P,config:K,isSuccess:_}):L?e("div",{className:"flex top-0 !mt-0 left-0 z-[999] bg-opacity-80 bg-[#1b1b1b] absolute justify-center items-center w-full h-full",children:e(Re,{url:K?.loader})}):N.disabled?e(bt,{children:e(mh,{})}):E||j?!E&&!O||j?t(bt,{children:[e(gh,{}),e(Qe,{anchor:"bottom",open:!0,className:"camera-drawer",onClose:(e,t)=>{},children:e(vh,{scanFailsError:j,onNext:()=>{s?.(),G()},setScanUniqueKey:W,gender:f,resolvedConfig:K,setIsVideoUploaded:U})})]}):e(wh,{isFaceScan:!1,scanId:$,isMeasurementAvailable:O,userDetails:n,onComplete:u,isVideoUploadedCorrect:P,config:K}):e(Et.Provider,{value:{setStartGyro:D,handleFileUpload:ee,setUploadLoading:k},children:e(dt,{children:e(bt,{children:e(fh,{config:K,scanID:$,userDetails:n,setIsVideoUploaded:U,setScanFailsError:I,setScanStartTime:H,setScanUniqueKey:W})})})})};export{bh as BodyScan};
|
|
20
20
|
//# sourceMappingURL=bodyScan.mjs.map
|