diff --git a/assets/index-4e001952.js b/assets/index-2f36c00b.js similarity index 91% rename from assets/index-4e001952.js rename to assets/index-2f36c00b.js index b90b261..0c9e018 100644 --- a/assets/index-4e001952.js +++ b/assets/index-2f36c00b.js @@ -58,7 +58,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var uR;function $H(){if(uR)return Nd;uR=1;var t=cr,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,l){var u,f={},d=null,h=null;l!==void 0&&(d=""+l),c.key!==void 0&&(d=""+c.key),c.ref!==void 0&&(h=c.ref);for(u in c)n.call(c,u)&&!i.hasOwnProperty(u)&&(f[u]=c[u]);if(a&&a.defaultProps)for(u in c=a.defaultProps,c)f[u]===void 0&&(f[u]=c[u]);return{$$typeof:e,type:a,key:d,ref:h,props:f,_owner:s.current}}return Nd.Fragment=r,Nd.jsx=o,Nd.jsxs=o,Nd}F6.exports=$H();var E=F6.exports;function zH(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function HH(t){var e=zH(t,"string");return typeof e=="symbol"?e:String(e)}function GH(t,e,r){return e=HH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function dR(t){for(var e=1;e{for(var n of Object.keys(t)){var s;if(t[n]!==((s=e[n])!==null&&s!==void 0?s:r[n]))return!1}return!0},Nt=t=>{var e=r=>{var n=t.defaultClassName,s=dR(dR({},t.defaultVariants),r);for(var i in s){var o,a=(o=s[i])!==null&&o!==void 0?o:t.defaultVariants[i];if(a!=null){var c=a;typeof c=="boolean"&&(c=c===!0?"true":"false");var l=t.variantClassNames[i][c];l&&(n+=" "+l)}}for(var[u,f]of t.compoundVariants)qH(u,s,t.defaultVariants)&&(n+=" "+f);return n};return e.variants=()=>Object.keys(t.variantClassNames),e.classNames={get base(){return t.defaultClassName.split(" ")[0]},get variants(){return hR(t.variantClassNames,r=>hR(r,n=>n.split(" ")[0]))}},e};Nt({defaultClassName:"_2q9vfj7",variantClassNames:{variant:{info:"_2q9vfj8 _2q9vfj0 fyvr11ov",warning:"_2q9vfj9 _2q9vfj1 fyvr11p1",success:"_2q9vfja _2q9vfj2 fyvr11oj",error:"_2q9vfjb _2q9vfj3 fyvr11op"},size:{sm:"_2q9vfjc _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11mv fyvr11ec fyvr11fw fyvr11fs fyvr11f4 _2q9vfj4 fyvr1wo fyvr1yk fyvr13w fyvr1e8",md:"_2q9vfjd _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _2q9vfj5 fyvr1ws fyvr1yo fyvr140 fyvr1ec",lg:"_2q9vfje _1qxj1ib9 _1qxj1ibd _1qxj1ib3 fyvr11mv fyvr11ek fyvr11g4 fyvr11fo fyvr11fc _2q9vfj6 fyvr1ww fyvr1ys fyvr144 fyvr1eg"}},defaultVariants:{},compoundVariants:[]});const gr=t=>{const{color:e="borderNormal",marginY:r="4",...n}=t;return E.jsx(q,{as:"hr",marginY:r,background:e,height:"px",borderWidth:"none",...n})};var WH=Nt({defaultClassName:"_1qxj1ib9",variantClassNames:{variant:{inherit:"_1qxj1iba _1qxj1ib0 fyvr11mu fyvr11e4 fyvr11gg fyvr11fg fyvr11ew",xlarge:"_1qxj1ibb _1qxj1ib1 fyvr11mv fyvr11es fyvr11gc fyvr11fk fyvr11fc",large:"_1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8",medium:"_1qxj1ibd _1qxj1ib3 fyvr11mv fyvr11ek fyvr11g4 fyvr11fo fyvr11fc",normal:"_1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0",small:"_1qxj1ibf _1qxj1ib5 fyvr11mv fyvr11ec fyvr11fw fyvr11fs fyvr11f4",xsmall:"_1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc",code:"_1qxj1ibh _1qxj1ib7 fyvr11mw fyvr11eg fyvr11g0 fyvr11fk fyvr11f0"},ellipsis:{true:"_1qxj1ibi _1qxj1ib8 fyvr11ls fyvr11m8 fyvr11n9 fyvr11mx"},italic:{true:"_1qxj1ibj"},underline:{true:"_1qxj1ibk"},uppercase:{true:"_1qxj1ibl"},capitalize:{true:"_1qxj1ibm"},hidden:{true:"_1qxj1ibn"}},defaultVariants:{},compoundVariants:[]});const ue=v.forwardRef((t,e)=>{const{as:r="span",variant:n="inherit",className:s,hidden:i,italic:o,underline:a,children:c,ellipsis:l,uppercase:u,capitalize:f,...d}=t,h=RH[n];return E.jsx(q,{as:r,className:qr(s,WH({hidden:i,ellipsis:l,italic:o,underline:a,uppercase:u,capitalize:f})),ref:e,...h,...d,children:c})});var KH=Nt({defaultClassName:"_140wn8ni _140wn8n0 fyvr11ls fyvr11m8 fyvr11n9 fyvr11ko fyvr12o1 fyvr11n2 fyvr11h0 _4efw240",variantClassNames:{variant:{base:"_140wn8nj _140wn8n1 fyvr11od fyvr12s1",ghost:"_140wn8nk _140wn8n2 fyvr11od fyvr12s1",feature:"_140wn8nl _140wn8n3 fyvr11pj fyvr12od",primary:"_140wn8nm _140wn8n4 fyvr11pd fyvr12od",glass:"_140wn8nn _140wn8n5 fyvr11tv fyvr12s1",emphasis:"_140wn8no _140wn8n6 fyvr11u1 fyvr12s1",raised:"_140wn8np _140wn8n7 fyvr11tp fyvr12s1",danger:"_140wn8nq _140wn8n8 fyvr11op fyvr12od",text:"_140wn8nr _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11mv fyvr11ec fyvr11fw fyvr11fs fyvr11f4 _140wn8n9 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr11od fyvr12sd"},shape:{circle:"_140wn8ns _140wn8na fyvr11dc fyvr11e0 fyvr11c0 fyvr11co",square:"_140wn8nt _140wn8nb fyvr11d0 fyvr11do fyvr11bo fyvr11cc"},disabled:{true:"_140wn8nu _140wn8nc fyvr12v1 fyvr12vp",false:"_140wn8nv _140wn8nd fyvr12v7 fyvr12w1 fyvr12vz"},size:{xs:"_140wn8nw _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc _140wn8ne fyvr1ws fyvr1yo",sm:"_140wn8nx _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _140wn8nf fyvr1ww fyvr1ys",md:"_140wn8ny _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _140wn8ng fyvr1x0 fyvr1yw",lg:"_140wn8nz _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _140wn8nh fyvr1x0 fyvr1yw"},iconOnly:{true:"_140wn8n10"},hasLeftIcon:{true:"_140wn8n11"},hasRightIcon:{true:"_140wn8n12"},activeOutline:{light:"_140wn8n13",bold:"_140wn8n14"}},defaultVariants:{},compoundVariants:[[{iconOnly:!0,size:"xs"},"_140wn8n15"],[{iconOnly:!0,size:"sm"},"_140wn8n16"],[{iconOnly:!0,size:"md"},"_140wn8n17"],[{iconOnly:!0,size:"lg"},"_140wn8n18"],[{iconOnly:!1,hasLeftIcon:!0,size:"xs"},"_140wn8n19"],[{iconOnly:!1,hasLeftIcon:!0,size:"sm"},"_140wn8n1a"],[{iconOnly:!1,hasLeftIcon:!0,size:"md"},"_140wn8n1b"],[{iconOnly:!1,hasRightIcon:!0,size:"xs"},"_140wn8n1c"],[{iconOnly:!1,hasRightIcon:!0,size:"sm"},"_140wn8n1d"],[{iconOnly:!1,hasRightIcon:!0,size:"md"},"_140wn8n1e"]]});const ut=v.forwardRef((t,e)=>{const{as:r="button",activeOutline:n,className:s,disabled:i=!1,display:o="inline-flex",fontWeight:a="bold",pending:c=!1,label:l,leftIcon:u,rightIcon:f,size:d="md",variant:h="glass",width:p="fit",shape:y="circle",type:g="button",...m}=t,x=u!==void 0&&l!==void 0,b=f!==void 0&&l!==void 0,w=u!==void 0&&l===void 0,A=d==="xs"?"xs":"sm";return E.jsx(q,{as:r,className:qr(s,KH({activeOutline:n,disabled:i||c,hasLeftIcon:x,hasRightIcon:b,iconOnly:w,size:h==="text"?void 0:d,shape:h==="text"?void 0:y,variant:h})),disabled:i||c,display:o,fontWeight:a,ref:e,type:g,width:p,...m,children:w?E.jsx(u,{size:A}):E.jsxs(q,{width:"full",height:"full",justifyContent:"space-between",alignItems:"center",gap:d==="xs"?"1":"2",children:[E.jsxs(q,{justifyContent:"flex-start",alignItems:"center",gap:d==="xs"?"1":"2",children:[u&&E.jsx(u,{size:A}),E.jsx(ue,{children:l})]}),f&&E.jsx(f,{size:A})]})})});var QH=Nt({defaultClassName:"rhmai63",variantClassNames:{clickable:{true:"rhmai64 rhmai60 fyvr11a4 fyvr11ag fyvr11as fyvr11b4 fyvr12vz fyvr12v7 _4efw240"},disabled:{true:"rhmai65"},outlined:{true:"rhmai66 rhmai61 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8 fyvr12n7 fyvr12fv fyvr1217 fyvr128j fyvr12nj fyvr12g7 fyvr121j fyvr128v"},blur:{true:"rhmai67 rhmai62 fyvr11ms"}},defaultVariants:{},compoundVariants:[]});const YH=v.forwardRef((t,e)=>{const{className:r,children:n,clickable:s,outlined:i,disabled:o,blur:a,width:c="full",...l}=t;return E.jsx(q,{className:qr(r,QH({clickable:s,outlined:i,disabled:o,blur:a})),background:i?"transparent":"backgroundSecondary",overflow:"hidden",borderRadius:"md",padding:"4",width:c,ref:e,...l,children:n})});function JH(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function hm(...t){return e=>t.forEach(r=>JH(r,e))}function $e(...t){return v.useCallback(hm(...t),t)}function XH(t,e){const r=v.createContext(e);function n(i){const{children:o,...a}=i,c=v.useMemo(()=>a,Object.values(a));return E.jsx(r.Provider,{value:c,children:o})}function s(i){const o=v.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return n.displayName=t+"Provider",[n,s]}function Wr(t,e=[]){let r=[];function n(i,o){const a=v.createContext(o),c=r.length;r=[...r,o];function l(f){const{scope:d,children:h,...p}=f,y=(d==null?void 0:d[t][c])||a,g=v.useMemo(()=>p,Object.values(p));return E.jsx(y.Provider,{value:g,children:h})}function u(f,d){const h=(d==null?void 0:d[t][c])||a,p=v.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,u]}const s=()=>{const i=r.map(o=>v.createContext(o));return function(a){const c=(a==null?void 0:a[t])||i;return v.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return s.scopeName=t,[n,ZH(s,...e)]}function ZH(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const f=c(i)[`__scope${l}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function ce(t,e,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t==null||t(s),r===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function Gr(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function ps({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,s]=eG({defaultProp:e,onChange:r}),i=t!==void 0,o=i?t:n,a=Gr(r),c=v.useCallback(l=>{if(i){const f=typeof l=="function"?l(t):l;f!==t&&a(f)}else s(l)},[i,t,s,a]);return[o,c]}function eG({defaultProp:t,onChange:e}){const r=v.useState(t),[n]=r,s=v.useRef(n),i=Gr(e);return v.useEffect(()=>{s.current!==n&&(i(n),s.current=n)},[n,s,i]),r}function pm(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Tr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{};function ym(t){const[e,r]=v.useState(void 0);return Tr(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const c=i.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}function tG(t,e){return v.useReducer((r,n)=>e[r][n]??r,t)}var cn=t=>{const{present:e,children:r}=t,n=rG(e),s=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),i=$e(n.ref,nG(s));return typeof r=="function"||n.isPresent?v.cloneElement(s,{ref:i}):null};cn.displayName="Presence";function rG(t){const[e,r]=v.useState(),n=v.useRef({}),s=v.useRef(t),i=v.useRef("none"),o=t?"mounted":"unmounted",[a,c]=tG(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const l=r1(n.current);i.current=a==="mounted"?l:"none"},[a]),Tr(()=>{const l=n.current,u=s.current;if(u!==t){const d=i.current,h=r1(l);t?c("MOUNT"):h==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(u&&d!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),Tr(()=>{if(e){const l=f=>{const h=r1(n.current).includes(f.animationName);f.target===e&&h&&Eo.flushSync(()=>c("ANIMATION_END"))},u=f=>{f.target===e&&(i.current=r1(n.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",l),e.addEventListener("animationend",l),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",l),e.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function r1(t){return(t==null?void 0:t.animationName)||"none"}function nG(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,s=n&&"isReactWarning"in n&&n.isReactWarning;return s?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,s=n&&"isReactWarning"in n&&n.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var ll=v.forwardRef((t,e)=>{const{children:r,...n}=t,s=v.Children.toArray(r),i=s.find(sG);if(i){const o=i.props.children,a=s.map(c=>c===i?v.Children.count(o)>1?v.Children.only(null):v.isValidElement(o)?o.props.children:null:c);return E.jsx(xw,{...n,ref:e,children:v.isValidElement(o)?v.cloneElement(o,void 0,a):null})}return E.jsx(xw,{...n,ref:e,children:r})});ll.displayName="Slot";var xw=v.forwardRef((t,e)=>{const{children:r,...n}=t;if(v.isValidElement(r)){const s=oG(r);return v.cloneElement(r,{...iG(n,r.props),ref:e?hm(e,s):s})}return v.Children.count(r)>1?v.Children.only(null):null});xw.displayName="SlotClone";var U6=({children:t})=>E.jsx(E.Fragment,{children:t});function sG(t){return v.isValidElement(t)&&t.type===U6}function iG(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...a)=>{i(...a),s(...a)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function oG(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,s=n&&"isReactWarning"in n&&n.isReactWarning;return s?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,s=n&&"isReactWarning"in n&&n.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var aG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],we=aG.reduce((t,e)=>{const r=v.forwardRef((n,s)=>{const{asChild:i,...o}=n,a=i?ll:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(a,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vS(t,e){t&&Eo.flushSync(()=>t.dispatchEvent(e))}var mS="Checkbox",[cG,R1e]=Wr(mS),[lG,uG]=cG(mS),V6=v.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:i,required:o,disabled:a,value:c="on",onCheckedChange:l,...u}=t,[f,d]=v.useState(null),h=$e(e,b=>d(b)),p=v.useRef(!1),y=f?!!f.closest("form"):!0,[g=!1,m]=ps({prop:s,defaultProp:i,onChange:l}),x=v.useRef(g);return v.useEffect(()=>{const b=f==null?void 0:f.form;if(b){const w=()=>m(x.current);return b.addEventListener("reset",w),()=>b.removeEventListener("reset",w)}},[f,m]),E.jsxs(lG,{scope:r,state:g,disabled:a,children:[E.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Zc(g)?"mixed":g,"aria-required":o,"data-state":H6(g),"data-disabled":a?"":void 0,disabled:a,value:c,...u,ref:h,onKeyDown:ce(t.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:ce(t.onClick,b=>{m(w=>Zc(w)?!0:!w),y&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})}),y&&E.jsx(fG,{control:f,bubbles:!p.current,name:n,value:c,checked:g,required:o,disabled:a,style:{transform:"translateX(-100%)"}})]})});V6.displayName=mS;var $6="CheckboxIndicator",z6=v.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...s}=t,i=uG($6,r);return E.jsx(cn,{present:n||Zc(i.state)||i.state===!0,children:E.jsx(we.span,{"data-state":H6(i.state),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});z6.displayName=$6;var fG=t=>{const{control:e,checked:r,bubbles:n=!0,...s}=t,i=v.useRef(null),o=pm(r),a=ym(e);return v.useEffect(()=>{const c=i.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&f){const d=new Event("click",{bubbles:n});c.indeterminate=Zc(r),f.call(c,Zc(r)?!1:r),c.dispatchEvent(d)}},[o,r,n]),E.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:Zc(r)?!1:r,...s,tabIndex:-1,ref:i,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Zc(t){return t==="indeterminate"}function H6(t){return Zc(t)?"indeterminate":t?"checked":"unchecked"}var dG=V6,hG=z6,pG=Nt({defaultClassName:"_43lu9r4",variantClassNames:{labelLocation:{top:"_43lu9r5 _43lu9r0 fyvr11kw fyvr11i4 fyvr118k fyvr11h0",left:"_43lu9r6 _43lu9r1 fyvr11ko fyvr11ic fyvr118k fyvr11h0",right:"_43lu9r7 _43lu9r2 fyvr11ko fyvr11ic fyvr118k fyvr11h0",hidden:"_43lu9r8 _43lu9r3 fyvr1188 fyvr11h0"}},defaultVariants:{},compoundVariants:[]});const Al=t=>{const{id:e,label:r,description:n,labelLocation:s="top",children:i,...o}=t,a=()=>r||n?E.jsxs(q,{flexDirection:"column",gap:"0.5",children:[r&&E.jsx(ue,{variant:"small",color:"text100",hidden:s==="hidden",children:r}),n&&E.jsx(ue,{variant:"small",color:"text50",hidden:s==="hidden",children:n})]}):null;return E.jsxs(q,{as:"label",className:pG({labelLocation:s}),htmlFor:e,...o,children:[["left","top","hidden"].includes(s)&&a(),i,s==="right"&&a()]})};var ny=Nt({defaultClassName:"_1dizidw0",variantClassNames:{size:{xs:"_1dizidw1",sm:"_1dizidw2",md:"_1dizidw3",lg:"_1dizidw4",xl:"_1dizidw5"}},defaultVariants:{},compoundVariants:[]});const yG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{stroke:"currentColor",strokeWidth:1.5,d:"m4.304 10.232 4.263 4.79 7.13-11.238"})}),gS=({size:t="sm",...e})=>E.jsx(q,{as:yG,className:ny({size:t}),...e}),vG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m3.888 7.53 1.06-1.06 5.47 5.47 5.47-5.47 1.06 1.06-6.53 6.53-6.53-6.53Z",clipRule:"evenodd"})}),G6=({size:t="sm",...e})=>E.jsx(q,{as:vG,className:ny({size:t}),...e}),mG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.418 11.06 4.47 4.47 1.06-1.06L11.48 10l4.47-4.47-1.06-1.06-4.47 4.47-4.47-4.47-1.06 1.06L9.357 10l-4.47 4.47 1.06 1.06 4.47-4.47Z",clipRule:"evenodd"})}),Gh=({size:t="sm",...e})=>E.jsx(q,{as:mG,className:ny({size:t}),...e}),gG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.608 6.75h-5.19v-1.5h7.75V13h-1.5V7.81l-7.72 7.72-1.06-1.06 7.72-7.72Z",clipRule:"evenodd"})}),xG=({size:t="sm",...e})=>E.jsx(q,{as:gG,className:ny({size:t}),...e}),bG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.918 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm-.677 4.383a5.5 5.5 0 1 1 1.06-1.06l2.648 2.647-1.061 1.06-2.647-2.647Z",clipRule:"evenodd"})}),wG=({size:t="sm",...e})=>E.jsx(q,{as:bG,className:ny({size:t}),...e});var EG=Nt({defaultClassName:"_1c9x66f1 _1c9x66f0 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr12nd fyvr12g1 fyvr121d fyvr128p fyvr12nj fyvr12g7 fyvr121j fyvr128v fyvr11h0 fyvr11ko fyvr11jg fyvr11od fyvr12w1 fyvr12vz fyvr12vr fyvr12v7 fyvr12v3 _4efw240",variantClassNames:{size:{sm:"_1c9x66f2",lg:"_1c9x66f3"}},defaultVariants:{},compoundVariants:[]}),SG="_1c9x66f4 fyvr12s1 fyvr11h0 fyvr11ko fyvr11jg fyvr128 fyvr15o";const CG=({size:t="sm"})=>E.jsx(hG,{className:SG,children:E.jsx(gS,{size:t==="lg"?"sm":"xs"})});v.forwardRef((t,e)=>{const{disabled:r=!1,id:n,name:s,label:i="",labelLocation:o="left",size:a="sm",...c}=t;return E.jsx(Al,{disabled:r,display:"flex",id:n??s,label:i,labelLocation:o,whiteSpace:"nowrap",children:E.jsx(dG,{className:EG({size:a}),disabled:r,id:n??s,name:s,ref:e,...c,children:E.jsx(CG,{size:a})})})});cr.createContext(null);var AG=l5["useId".toString()]||(()=>{}),kG=0;function us(t){const[e,r]=v.useState(AG());return Tr(()=>{t||r(n=>n??String(kG++))},[t]),t||(e?`radix-${e}`:"")}var xS="Collapsible",[TG,I1e]=Wr(xS),[PG,bS]=TG(xS),q6=v.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:i,onOpenChange:o,...a}=t,[c=!1,l]=ps({prop:n,defaultProp:s,onChange:o});return E.jsx(PG,{scope:r,disabled:i,contentId:us(),open:c,onOpenToggle:v.useCallback(()=>l(u=>!u),[l]),children:E.jsx(we.div,{"data-state":ES(c),"data-disabled":i?"":void 0,...a,ref:e})})});q6.displayName=xS;var W6="CollapsibleTrigger",K6=v.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,s=bS(W6,r);return E.jsx(we.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":ES(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:e,onClick:ce(t.onClick,s.onOpenToggle)})});K6.displayName=W6;var wS="CollapsibleContent",Q6=v.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=bS(wS,t.__scopeCollapsible);return E.jsx(cn,{present:r||s.open,children:({present:i})=>E.jsx(RG,{...n,ref:e,present:i})})});Q6.displayName=wS;var RG=v.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:s,...i}=t,o=bS(wS,r),[a,c]=v.useState(n),l=v.useRef(null),u=$e(e,l),f=v.useRef(0),d=f.current,h=v.useRef(0),p=h.current,y=o.open||a,g=v.useRef(y),m=v.useRef();return v.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),Tr(()=>{const x=l.current;if(x){m.current=m.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const b=x.getBoundingClientRect();f.current=b.height,h.current=b.width,g.current||(x.style.transitionDuration=m.current.transitionDuration,x.style.animationName=m.current.animationName),c(n)}},[o.open,n]),E.jsx(we.div,{"data-state":ES(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!y,...i,ref:u,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...t.style},children:y&&s})});function ES(t){return t?"open":"closed"}var IG=q6,OG=K6,_G=Q6,pR="64px",NG="_4j62fl0",MG="_4j62fl2 _4j62fl1 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11h0 fyvr11ko fyvr11od fyvr128 fyvr12v7 fyvr11n4 _4efw240",DG="_4j62fl4 _4j62fl3 fyvr1ww fyvr1ys fyvr1so fyvr1v0 fyvr128",LG="_4j62fl5";const _l=t=>{const{className:e,children:r,defaultOpen:n,open:s,onOpenChange:i,label:o,...a}=t,[c,l]=v.useState(n),u=s??c,f=h=>{s===void 0&&l(h)},d=h=>{f(h),i==null||i(h)};return E.jsx(IG,{open:u,defaultOpen:n,onOpenChange:d,asChild:!0,children:E.jsxs(q,{as:Xc.div,className:qr(e,NG),initial:{height:u?"auto":pR},animate:{height:u?"auto":pR},transition:{ease:"easeOut",duration:.3},borderRadius:"md",background:"backgroundSecondary",position:"relative",overflow:"hidden",width:"full",...a,children:[E.jsxs(OG,{className:MG,children:[E.jsx(ue,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:o}),E.jsx(q,{as:Xc.div,position:"absolute",right:"0",marginRight:"4",initial:{rotate:u?180:0},animate:{rotate:u?180:0},transition:{ease:"linear",duration:.1},children:E.jsx(G6,{className:LG,color:"text50"})})]}),E.jsx(yS,{children:u&&E.jsx(_G,{className:DG,asChild:!0,forceMount:!0,children:E.jsx(Xc.div,{initial:{opacity:u?1:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:"easeOut",duration:.3},children:r})})})]})})};function vm(t){const e=t+"CollectionProvider",[r,n]=Wr(e),[s,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:p,children:y}=h,g=cr.useRef(null),m=cr.useRef(new Map).current;return E.jsx(s,{scope:p,itemMap:m,collectionRef:g,children:y})};o.displayName=e;const a=t+"CollectionSlot",c=cr.forwardRef((h,p)=>{const{scope:y,children:g}=h,m=i(a,y),x=$e(p,m.collectionRef);return E.jsx(ll,{ref:x,children:g})});c.displayName=a;const l=t+"CollectionItemSlot",u="data-radix-collection-item",f=cr.forwardRef((h,p)=>{const{scope:y,children:g,...m}=h,x=cr.useRef(null),b=$e(p,x),w=i(l,y);return cr.useEffect(()=>(w.itemMap.set(x,{ref:x,...m}),()=>void w.itemMap.delete(x))),E.jsx(ll,{[u]:"",ref:b,children:g})});f.displayName=l;function d(h){const p=i(t+"CollectionConsumer",h);return cr.useCallback(()=>{const g=p.collectionRef.current;if(!g)return[];const m=Array.from(g.querySelectorAll(`[${u}]`));return Array.from(p.itemMap.values()).sort((w,A)=>m.indexOf(w.ref.current)-m.indexOf(A.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},d,n]}var jG=v.createContext(void 0);function sy(t){const e=v.useContext(jG);return t||e||"ltr"}function BG(t,e=globalThis==null?void 0:globalThis.document){const r=Gr(t);v.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var FG="DismissableLayer",bw="dismissableLayer.update",UG="dismissableLayer.pointerDownOutside",VG="dismissableLayer.focusOutside",yR,Y6=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),od=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:a,...c}=t,l=v.useContext(Y6),[u,f]=v.useState(null),d=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=v.useState({}),p=$e(e,_=>f(_)),y=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),m=y.indexOf(g),x=u?y.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,w=x>=m,A=zG(_=>{const C=_.target,j=[...l.branches].some(V=>V.contains(C));!w||j||(s==null||s(_),o==null||o(_),_.defaultPrevented||a==null||a())},d),O=HG(_=>{const C=_.target;[...l.branches].some(V=>V.contains(C))||(i==null||i(_),o==null||o(_),_.defaultPrevented||a==null||a())},d);return BG(_=>{x===l.layers.size-1&&(n==null||n(_),!_.defaultPrevented&&a&&(_.preventDefault(),a()))},d),v.useEffect(()=>{if(u)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(yR=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),vR(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=yR)}},[u,d,r,l]),v.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),vR())},[u,l]),v.useEffect(()=>{const _=()=>h({});return document.addEventListener(bw,_),()=>document.removeEventListener(bw,_)},[]),E.jsx(we.div,{...c,ref:p,style:{pointerEvents:b?w?"auto":"none":void 0,...t.style},onFocusCapture:ce(t.onFocusCapture,O.onFocusCapture),onBlurCapture:ce(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ce(t.onPointerDownCapture,A.onPointerDownCapture)})});od.displayName=FG;var $G="DismissableLayerBranch",J6=v.forwardRef((t,e)=>{const r=v.useContext(Y6),n=v.useRef(null),s=$e(e,n);return v.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),E.jsx(we.div,{...t,ref:s})});J6.displayName=$G;function zG(t,e=globalThis==null?void 0:globalThis.document){const r=Gr(t),n=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const i=a=>{if(a.target&&!n.current){let c=function(){X6(UG,r,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function HG(t,e=globalThis==null?void 0:globalThis.document){const r=Gr(t),n=v.useRef(!1);return v.useEffect(()=>{const s=i=>{i.target&&!n.current&&X6(VG,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function vR(){const t=new CustomEvent(bw);document.dispatchEvent(t)}function X6(t,e,r,{discrete:n}){const s=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?vS(s,i):s.dispatchEvent(i)}var GG=od,qG=J6,nx=0;function SS(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??mR()),document.body.insertAdjacentElement("beforeend",t[1]??mR()),nx++,()=>{nx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),nx--}},[])}function mR(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}var sx="focusScope.autoFocusOnMount",ix="focusScope.autoFocusOnUnmount",gR={bubbles:!1,cancelable:!0},WG="FocusScope",mm=v.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=t,[a,c]=v.useState(null),l=Gr(s),u=Gr(i),f=v.useRef(null),d=$e(e,y=>c(y)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(n){let y=function(b){if(h.paused||!a)return;const w=b.target;a.contains(w)?f.current=w:Do(f.current,{select:!0})},g=function(b){if(h.paused||!a)return;const w=b.relatedTarget;w!==null&&(a.contains(w)||Do(f.current,{select:!0}))},m=function(b){if(document.activeElement===document.body)for(const A of b)A.removedNodes.length>0&&Do(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",g);const x=new MutationObserver(m);return a&&x.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",g),x.disconnect()}}},[n,a,h.paused]),v.useEffect(()=>{if(a){bR.add(h);const y=document.activeElement;if(!a.contains(y)){const m=new CustomEvent(sx,gR);a.addEventListener(sx,l),a.dispatchEvent(m),m.defaultPrevented||(KG(ZG(Z6(a)),{select:!0}),document.activeElement===y&&Do(a))}return()=>{a.removeEventListener(sx,l),setTimeout(()=>{const m=new CustomEvent(ix,gR);a.addEventListener(ix,u),a.dispatchEvent(m),m.defaultPrevented||Do(y??document.body,{select:!0}),a.removeEventListener(ix,u),bR.remove(h)},0)}}},[a,l,u,h]);const p=v.useCallback(y=>{if(!r&&!n||h.paused)return;const g=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,m=document.activeElement;if(g&&m){const x=y.currentTarget,[b,w]=QG(x);b&&w?!y.shiftKey&&m===w?(y.preventDefault(),r&&Do(b,{select:!0})):y.shiftKey&&m===b&&(y.preventDefault(),r&&Do(w,{select:!0})):m===x&&y.preventDefault()}},[r,n,h.paused]);return E.jsx(we.div,{tabIndex:-1,...o,ref:d,onKeyDown:p})});mm.displayName=WG;function KG(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Do(n,{select:e}),document.activeElement!==r)return}function QG(t){const e=Z6(t),r=xR(e,t),n=xR(e.reverse(),t);return[r,n]}function Z6(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function xR(t,e){for(const r of t)if(!YG(r,{upTo:e}))return r}function YG(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function JG(t){return t instanceof HTMLInputElement&&"select"in t}function Do(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&JG(t)&&e&&t.select()}}var bR=XG();function XG(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=wR(t,e),t.unshift(e)},remove(e){var r;t=wR(t,e),(r=t[0])==null||r.resume()}}}function wR(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function ZG(t){return t.filter(e=>e.tagName!=="A")}const eq=["top","right","bottom","left"],hi=Math.min,_n=Math.max,Qv=Math.round,n1=Math.floor,Ia=t=>({x:t,y:t}),tq={left:"right",right:"left",bottom:"top",top:"bottom"},rq={start:"end",end:"start"};function ww(t,e,r){return _n(t,hi(e,r))}function vo(t,e){return typeof t=="function"?t(e):t}function mo(t){return t.split("-")[0]}function ad(t){return t.split("-")[1]}function CS(t){return t==="x"?"y":"x"}function AS(t){return t==="y"?"height":"width"}function Oa(t){return["top","bottom"].includes(mo(t))?"y":"x"}function kS(t){return CS(Oa(t))}function nq(t,e,r){r===void 0&&(r=!1);const n=ad(t),s=kS(t),i=AS(s);let o=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Yv(o)),[o,Yv(o)]}function sq(t){const e=Yv(t);return[Ew(t),e,Ew(e)]}function Ew(t){return t.replace(/start|end/g,e=>rq[e])}function iq(t,e,r){const n=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?s:n:e?n:s;case"left":case"right":return e?i:o;default:return[]}}function oq(t,e,r,n){const s=ad(t);let i=iq(mo(t),r==="start",n);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Ew)))),i}function Yv(t){return t.replace(/left|right|bottom|top/g,e=>tq[e])}function aq(t){return{top:0,right:0,bottom:0,left:0,...t}}function e_(t){return typeof t!="number"?aq(t):{top:t,right:t,bottom:t,left:t}}function Jv(t){const{x:e,y:r,width:n,height:s}=t;return{width:n,height:s,top:r,left:e,right:e+n,bottom:r+s,x:e,y:r}}function ER(t,e,r){let{reference:n,floating:s}=t;const i=Oa(e),o=kS(e),a=AS(o),c=mo(e),l=i==="y",u=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,d=n[a]/2-s[a]/2;let h;switch(c){case"top":h={x:u,y:n.y-s.height};break;case"bottom":h={x:u,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:f};break;case"left":h={x:n.x-s.width,y:f};break;default:h={x:n.x,y:n.y}}switch(ad(e)){case"start":h[o]-=d*(r&&l?-1:1);break;case"end":h[o]+=d*(r&&l?-1:1);break}return h}const cq=async(t,e,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:o}=r,a=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:u,y:f}=ER(l,n,c),d=n,h={},p=0;for(let y=0;y({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:s,rects:i,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:u=0}=vo(t,e)||{};if(l==null)return{};const f=e_(u),d={x:r,y:n},h=kS(s),p=AS(h),y=await o.getDimensions(l),g=h==="y",m=g?"top":"left",x=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-d[h]-i.floating[p],A=d[h]-i.reference[h],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let _=O?O[b]:0;(!_||!await(o.isElement==null?void 0:o.isElement(O)))&&(_=a.floating[b]||i.floating[p]);const C=w/2-A/2,j=_/2-y[p]/2-1,V=hi(f[m],j),B=hi(f[x],j),z=V,Y=_-y[p]-B,H=_/2-y[p]/2+C,L=ww(z,H,Y),T=!c.arrow&&ad(s)!=null&&H!==L&&i.reference[p]/2-(HH<=0)){var B,z;const H=(((B=i.flip)==null?void 0:B.index)||0)+1,L=_[H];if(L)return{data:{index:H,overflows:V},reset:{placement:L}};let T=(z=V.filter(P=>P.overflows[0]<=0).sort((P,R)=>P.overflows[1]-R.overflows[1])[0])==null?void 0:z.placement;if(!T)switch(h){case"bestFit":{var Y;const P=(Y=V.filter(R=>{if(O){const I=Oa(R.placement);return I===x||I==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(I=>I>0).reduce((I,U)=>I+U,0)]).sort((R,I)=>R[1]-I[1])[0])==null?void 0:Y[0];P&&(T=P);break}case"initialPlacement":T=a;break}if(s!==T)return{reset:{placement:T}}}return{}}}};function SR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function CR(t){return eq.some(e=>t[e]>=0)}const fq=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...s}=vo(t,e);switch(n){case"referenceHidden":{const i=await qh(e,{...s,elementContext:"reference"}),o=SR(i,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:CR(o)}}}case"escaped":{const i=await qh(e,{...s,altBoundary:!0}),o=SR(i,r.floating);return{data:{escapedOffsets:o,escaped:CR(o)}}}default:return{}}}}};async function dq(t,e){const{placement:r,platform:n,elements:s}=t,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),o=mo(r),a=ad(r),c=Oa(r)==="y",l=["left","top"].includes(o)?-1:1,u=i&&c?-1:1,f=vo(e,t);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),c?{x:h*u,y:d*l}:{x:d*l,y:h*u}}const hq=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:s,y:i,placement:o,middlewareData:a}=e,c=await dq(e,t);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},pq=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:m,y:x}=g;return{x:m,y:x}}},...c}=vo(t,e),l={x:r,y:n},u=await qh(e,c),f=Oa(mo(s)),d=CS(f);let h=l[d],p=l[f];if(i){const g=d==="y"?"top":"left",m=d==="y"?"bottom":"right",x=h+u[g],b=h-u[m];h=ww(x,h,b)}if(o){const g=f==="y"?"top":"left",m=f==="y"?"bottom":"right",x=p+u[g],b=p-u[m];p=ww(x,p,b)}const y=a.fn({...e,[d]:h,[f]:p});return{...y,data:{x:y.x-r,y:y.y-n}}}}},yq=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=vo(t,e),u={x:r,y:n},f=Oa(s),d=CS(f);let h=u[d],p=u[f];const y=vo(a,e),g=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const b=d==="y"?"height":"width",w=i.reference[d]-i.floating[b]+g.mainAxis,A=i.reference[d]+i.reference[b]-g.mainAxis;hA&&(h=A)}if(l){var m,x;const b=d==="y"?"width":"height",w=["top","left"].includes(mo(s)),A=i.reference[f]-i.floating[b]+(w&&((m=o.offset)==null?void 0:m[f])||0)+(w?0:g.crossAxis),O=i.reference[f]+i.reference[b]+(w?0:((x=o.offset)==null?void 0:x[f])||0)-(w?g.crossAxis:0);pO&&(p=O)}return{[d]:h,[f]:p}}}},vq=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:s,elements:i}=e,{apply:o=()=>{},...a}=vo(t,e),c=await qh(e,a),l=mo(r),u=ad(r),f=Oa(r)==="y",{width:d,height:h}=n.floating;let p,y;l==="top"||l==="bottom"?(p=l,y=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(y=l,p=u==="end"?"top":"bottom");const g=h-c.top-c.bottom,m=d-c.left-c.right,x=hi(h-c[p],g),b=hi(d-c[y],m),w=!e.middlewareData.shift;let A=x,O=b;if(f?O=u||w?hi(b,m):m:A=u||w?hi(x,g):g,w&&!u){const C=_n(c.left,0),j=_n(c.right,0),V=_n(c.top,0),B=_n(c.bottom,0);f?O=d-2*(C!==0||j!==0?C+j:_n(c.left,c.right)):A=h-2*(V!==0||B!==0?V+B:_n(c.top,c.bottom))}await o({...e,availableWidth:O,availableHeight:A});const _=await s.getDimensions(i.floating);return d!==_.width||h!==_.height?{reset:{rects:!0}}:{}}}};function cd(t){return t_(t)?(t.nodeName||"").toLowerCase():"#document"}function jn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function So(t){var e;return(e=(t_(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function t_(t){return t instanceof Node||t instanceof jn(t).Node}function bi(t){return t instanceof Element||t instanceof jn(t).Element}function wi(t){return t instanceof HTMLElement||t instanceof jn(t).HTMLElement}function AR(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof jn(t).ShadowRoot}function iy(t){const{overflow:e,overflowX:r,overflowY:n,display:s}=Fs(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(s)}function mq(t){return["table","td","th"].includes(cd(t))}function gm(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function TS(t){const e=PS(),r=Fs(t);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function gq(t){let e=_a(t);for(;wi(e)&&!Bf(e);){if(gm(e))return null;if(TS(e))return e;e=_a(e)}return null}function PS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Bf(t){return["html","body","#document"].includes(cd(t))}function Fs(t){return jn(t).getComputedStyle(t)}function xm(t){return bi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function _a(t){if(cd(t)==="html")return t;const e=t.assignedSlot||t.parentNode||AR(t)&&t.host||So(t);return AR(e)?e.host:e}function r_(t){const e=_a(t);return Bf(e)?t.ownerDocument?t.ownerDocument.body:t.body:wi(e)&&iy(e)?e:r_(e)}function Wh(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const s=r_(t),i=s===((n=t.ownerDocument)==null?void 0:n.body),o=jn(s);return i?e.concat(o,o.visualViewport||[],iy(s)?s:[],o.frameElement&&r?Wh(o.frameElement):[]):e.concat(s,Wh(s,[],r))}function n_(t){const e=Fs(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=wi(t),i=s?t.offsetWidth:r,o=s?t.offsetHeight:n,a=Qv(r)!==i||Qv(n)!==o;return a&&(r=i,n=o),{width:r,height:n,$:a}}function RS(t){return bi(t)?t:t.contextElement}function ku(t){const e=RS(t);if(!wi(e))return Ia(1);const r=e.getBoundingClientRect(),{width:n,height:s,$:i}=n_(e);let o=(i?Qv(r.width):r.width)/n,a=(i?Qv(r.height):r.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const xq=Ia(0);function s_(t){const e=jn(t);return!PS()||!e.visualViewport?xq:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bq(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==jn(t)?!1:e}function ul(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),i=RS(t);let o=Ia(1);e&&(n?bi(n)&&(o=ku(n)):o=ku(t));const a=bq(i,r,n)?s_(i):Ia(0);let c=(s.left+a.x)/o.x,l=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const d=jn(i),h=n&&bi(n)?jn(n):n;let p=d,y=p.frameElement;for(;y&&n&&h!==p;){const g=ku(y),m=y.getBoundingClientRect(),x=Fs(y),b=m.left+(y.clientLeft+parseFloat(x.paddingLeft))*g.x,w=m.top+(y.clientTop+parseFloat(x.paddingTop))*g.y;c*=g.x,l*=g.y,u*=g.x,f*=g.y,c+=b,l+=w,p=jn(y),y=p.frameElement}}return Jv({width:u,height:f,x:c,y:l})}function wq(t){let{elements:e,rect:r,offsetParent:n,strategy:s}=t;const i=s==="fixed",o=So(n),a=e?gm(e.floating):!1;if(n===o||a&&i)return r;let c={scrollLeft:0,scrollTop:0},l=Ia(1);const u=Ia(0),f=wi(n);if((f||!f&&!i)&&((cd(n)!=="body"||iy(o))&&(c=xm(n)),wi(n))){const d=ul(n);l=ku(n),u.x=d.x+n.clientLeft,u.y=d.y+n.clientTop}return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+u.x,y:r.y*l.y-c.scrollTop*l.y+u.y}}function Eq(t){return Array.from(t.getClientRects())}function i_(t){return ul(So(t)).left+xm(t).scrollLeft}function Sq(t){const e=So(t),r=xm(t),n=t.ownerDocument.body,s=_n(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=_n(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+i_(t);const a=-r.scrollTop;return Fs(n).direction==="rtl"&&(o+=_n(e.clientWidth,n.clientWidth)-s),{width:s,height:i,x:o,y:a}}function Cq(t,e){const r=jn(t),n=So(t),s=r.visualViewport;let i=n.clientWidth,o=n.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;const l=PS();(!l||l&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:a,y:c}}function Aq(t,e){const r=ul(t,!0,e==="fixed"),n=r.top+t.clientTop,s=r.left+t.clientLeft,i=wi(t)?ku(t):Ia(1),o=t.clientWidth*i.x,a=t.clientHeight*i.y,c=s*i.x,l=n*i.y;return{width:o,height:a,x:c,y:l}}function kR(t,e,r){let n;if(e==="viewport")n=Cq(t,r);else if(e==="document")n=Sq(So(t));else if(bi(e))n=Aq(e,r);else{const s=s_(t);n={...e,x:e.x-s.x,y:e.y-s.y}}return Jv(n)}function o_(t,e){const r=_a(t);return r===e||!bi(r)||Bf(r)?!1:Fs(r).position==="fixed"||o_(r,e)}function kq(t,e){const r=e.get(t);if(r)return r;let n=Wh(t,[],!1).filter(a=>bi(a)&&cd(a)!=="body"),s=null;const i=Fs(t).position==="fixed";let o=i?_a(t):t;for(;bi(o)&&!Bf(o);){const a=Fs(o),c=TS(o);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||iy(o)&&!c&&o_(t,o))?n=n.filter(u=>u!==o):s=a,o=_a(o)}return e.set(t,n),n}function Tq(t){let{element:e,boundary:r,rootBoundary:n,strategy:s}=t;const o=[...r==="clippingAncestors"?gm(e)?[]:kq(e,this._c):[].concat(r),n],a=o[0],c=o.reduce((l,u)=>{const f=kR(e,u,s);return l.top=_n(f.top,l.top),l.right=hi(f.right,l.right),l.bottom=hi(f.bottom,l.bottom),l.left=_n(f.left,l.left),l},kR(e,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Pq(t){const{width:e,height:r}=n_(t);return{width:e,height:r}}function Rq(t,e,r){const n=wi(e),s=So(e),i=r==="fixed",o=ul(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const c=Ia(0);if(n||!n&&!i)if((cd(e)!=="body"||iy(s))&&(a=xm(e)),n){const f=ul(e,!0,i,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else s&&(c.x=i_(s));const l=o.left+a.scrollLeft-c.x,u=o.top+a.scrollTop-c.y;return{x:l,y:u,width:o.width,height:o.height}}function ox(t){return Fs(t).position==="static"}function TR(t,e){return!wi(t)||Fs(t).position==="fixed"?null:e?e(t):t.offsetParent}function a_(t,e){const r=jn(t);if(gm(t))return r;if(!wi(t)){let s=_a(t);for(;s&&!Bf(s);){if(bi(s)&&!ox(s))return s;s=_a(s)}return r}let n=TR(t,e);for(;n&&mq(n)&&ox(n);)n=TR(n,e);return n&&Bf(n)&&ox(n)&&!TS(n)?r:n||gq(t)||r}const Iq=async function(t){const e=this.getOffsetParent||a_,r=this.getDimensions,n=await r(t.floating);return{reference:Rq(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Oq(t){return Fs(t).direction==="rtl"}const _q={convertOffsetParentRelativeRectToViewportRelativeRect:wq,getDocumentElement:So,getClippingRect:Tq,getOffsetParent:a_,getElementRects:Iq,getClientRects:Eq,getDimensions:Pq,getScale:ku,isElement:bi,isRTL:Oq};function Nq(t,e){let r=null,n;const s=So(t);function i(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:l,top:u,width:f,height:d}=t.getBoundingClientRect();if(a||e(),!f||!d)return;const h=n1(u),p=n1(s.clientWidth-(l+f)),y=n1(s.clientHeight-(u+d)),g=n1(l),x={rootMargin:-h+"px "+-p+"px "+-y+"px "+-g+"px",threshold:_n(0,hi(1,c))||1};let b=!0;function w(A){const O=A[0].intersectionRatio;if(O!==c){if(!b)return o();O?o(!1,O):n=setTimeout(()=>{o(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(w,{...x,root:s.ownerDocument})}catch{r=new IntersectionObserver(w,x)}r.observe(t)}return o(!0),i}function Mq(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=RS(t),u=s||i?[...l?Wh(l):[],...Wh(e)]:[];u.forEach(m=>{s&&m.addEventListener("scroll",r,{passive:!0}),i&&m.addEventListener("resize",r)});const f=l&&a?Nq(l,r):null;let d=-1,h=null;o&&(h=new ResizeObserver(m=>{let[x]=m;x&&x.target===l&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),r()}),l&&!c&&h.observe(l),h.observe(e));let p,y=c?ul(t):null;c&&g();function g(){const m=ul(t);y&&(m.x!==y.x||m.y!==y.y||m.width!==y.width||m.height!==y.height)&&r(),y=m,p=requestAnimationFrame(g)}return r(),()=>{var m;u.forEach(x=>{s&&x.removeEventListener("scroll",r),i&&x.removeEventListener("resize",r)}),f==null||f(),(m=h)==null||m.disconnect(),h=null,c&&cancelAnimationFrame(p)}}const Dq=hq,Lq=pq,jq=uq,Bq=vq,Fq=fq,PR=lq,Uq=yq,Vq=(t,e,r)=>{const n=new Map,s={platform:_q,...r},i={...s.platform,_c:n};return cq(t,e,{...s,platform:i})};var K1=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Xv(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!Xv(t[n],e[n]))return!1;return!0}if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){const i=s[n];if(!(i==="_owner"&&t.$$typeof)&&!Xv(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function c_(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function RR(t,e){const r=c_(t);return Math.round(e*r)/r}function IR(t){const e=v.useRef(t);return K1(()=>{e.current=t}),e}function $q(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[u,f]=v.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=v.useState(n);Xv(d,n)||h(n);const[p,y]=v.useState(null),[g,m]=v.useState(null),x=v.useCallback(P=>{P!==O.current&&(O.current=P,y(P))},[]),b=v.useCallback(P=>{P!==_.current&&(_.current=P,m(P))},[]),w=i||p,A=o||g,O=v.useRef(null),_=v.useRef(null),C=v.useRef(u),j=c!=null,V=IR(c),B=IR(s),z=v.useCallback(()=>{if(!O.current||!_.current)return;const P={placement:e,strategy:r,middleware:d};B.current&&(P.platform=B.current),Vq(O.current,_.current,P).then(R=>{const I={...R,isPositioned:!0};Y.current&&!Xv(C.current,I)&&(C.current=I,Eo.flushSync(()=>{f(I)}))})},[d,e,r,B]);K1(()=>{l===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,f(P=>({...P,isPositioned:!1})))},[l]);const Y=v.useRef(!1);K1(()=>(Y.current=!0,()=>{Y.current=!1}),[]),K1(()=>{if(w&&(O.current=w),A&&(_.current=A),w&&A){if(V.current)return V.current(w,A,z);z()}},[w,A,z,V,j]);const H=v.useMemo(()=>({reference:O,floating:_,setReference:x,setFloating:b}),[x,b]),L=v.useMemo(()=>({reference:w,floating:A}),[w,A]),T=v.useMemo(()=>{const P={position:r,left:0,top:0};if(!L.floating)return P;const R=RR(L.floating,u.x),I=RR(L.floating,u.y);return a?{...P,transform:"translate("+R+"px, "+I+"px)",...c_(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:R,top:I}},[r,a,L.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:z,refs:H,elements:L,floatingStyles:T}),[u,z,H,L,T])}const zq=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:s}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?PR({element:n.current,padding:s}).fn(r):{}:n?PR({element:n,padding:s}).fn(r):{}}}},Hq=(t,e)=>({...Dq(t),options:[t,e]}),Gq=(t,e)=>({...Lq(t),options:[t,e]}),qq=(t,e)=>({...Uq(t),options:[t,e]}),Wq=(t,e)=>({...jq(t),options:[t,e]}),Kq=(t,e)=>({...Bq(t),options:[t,e]}),Qq=(t,e)=>({...Fq(t),options:[t,e]}),Yq=(t,e)=>({...zq(t),options:[t,e]});var Jq="Arrow",l_=v.forwardRef((t,e)=>{const{children:r,width:n=10,height:s=5,...i}=t;return E.jsx(we.svg,{...i,ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:E.jsx("polygon",{points:"0,0 30,0 15,10"})})});l_.displayName=Jq;var Xq=l_,IS="Popper",[u_,ld]=Wr(IS),[Zq,f_]=u_(IS),d_=t=>{const{__scopePopper:e,children:r}=t,[n,s]=v.useState(null);return E.jsx(Zq,{scope:e,anchor:n,onAnchorChange:s,children:r})};d_.displayName=IS;var h_="PopperAnchor",p_=v.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...s}=t,i=f_(h_,r),o=v.useRef(null),a=$e(e,o);return v.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:E.jsx(we.div,{...s,ref:a})});p_.displayName=h_;var OS="PopperContent",[eW,tW]=u_(OS),y_=v.forwardRef((t,e)=>{var r,n,s,i,o,a;const{__scopePopper:c,side:l="bottom",sideOffset:u=0,align:f="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:p=!0,collisionBoundary:y=[],collisionPadding:g=0,sticky:m="partial",hideWhenDetached:x=!1,updatePositionStrategy:b="optimized",onPlaced:w,...A}=t,O=f_(OS,c),[_,C]=v.useState(null),j=$e(e,at=>C(at)),[V,B]=v.useState(null),z=ym(V),Y=(z==null?void 0:z.width)??0,H=(z==null?void 0:z.height)??0,L=l+(f!=="center"?"-"+f:""),T=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},P=Array.isArray(y)?y:[y],R=P.length>0,I={padding:T,boundary:P.filter(nW),altBoundary:R},{refs:U,floatingStyles:F,placement:X,isPositioned:oe,middlewareData:ae}=$q({strategy:"fixed",placement:L,whileElementsMounted:(...at)=>Mq(...at,{animationFrame:b==="always"}),elements:{reference:O.anchor},middleware:[Hq({mainAxis:u+H,alignmentAxis:d}),p&&Gq({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?qq():void 0,...I}),p&&Wq({...I}),Kq({...I,apply:({elements:at,rects:qe,availableWidth:Kr,availableHeight:vs})=>{const{width:Qa,height:Ci}=qe.reference,Rl=at.floating.style;Rl.setProperty("--radix-popper-available-width",`${Kr}px`),Rl.setProperty("--radix-popper-available-height",`${vs}px`),Rl.setProperty("--radix-popper-anchor-width",`${Qa}px`),Rl.setProperty("--radix-popper-anchor-height",`${Ci}px`)}}),V&&Yq({element:V,padding:h}),sW({arrowWidth:Y,arrowHeight:H}),x&&Qq({strategy:"referenceHidden",...I})]}),[ke,ve]=g_(X),ie=Gr(w);Tr(()=>{oe&&(ie==null||ie())},[oe,ie]);const Me=(r=ae.arrow)==null?void 0:r.x,Be=(n=ae.arrow)==null?void 0:n.y,Te=((s=ae.arrow)==null?void 0:s.centerOffset)!==0,[De,ze]=v.useState();return Tr(()=>{_&&ze(window.getComputedStyle(_).zIndex)},[_]),E.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:oe?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:De,"--radix-popper-transform-origin":[(i=ae.transformOrigin)==null?void 0:i.x,(o=ae.transformOrigin)==null?void 0:o.y].join(" "),...((a=ae.hide)==null?void 0:a.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:E.jsx(eW,{scope:c,placedSide:ke,onArrowChange:B,arrowX:Me,arrowY:Be,shouldHideArrow:Te,children:E.jsx(we.div,{"data-side":ke,"data-align":ve,...A,ref:j,style:{...A.style,animation:oe?void 0:"none"}})})})});y_.displayName=OS;var v_="PopperArrow",rW={top:"bottom",right:"left",bottom:"top",left:"right"},m_=v.forwardRef(function(e,r){const{__scopePopper:n,...s}=e,i=tW(v_,n),o=rW[i.placedSide];return E.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:E.jsx(Xq,{...s,ref:r,style:{...s.style,display:"block"}})})});m_.displayName=v_;function nW(t){return t!==null}var sW=t=>({name:"transformOrigin",options:t,fn(e){var r,n,s;const{placement:i,rects:o,middlewareData:a}=e,l=((r=a.arrow)==null?void 0:r.centerOffset)!==0,u=l?0:t.arrowWidth,f=l?0:t.arrowHeight,[d,h]=g_(i),p={start:"0%",center:"50%",end:"100%"}[h],y=(((n=a.arrow)==null?void 0:n.x)??0)+u/2,g=(((s=a.arrow)==null?void 0:s.y)??0)+f/2;let m="",x="";return d==="bottom"?(m=l?p:`${y}px`,x=`${-f}px`):d==="top"?(m=l?p:`${y}px`,x=`${o.floating.height+f}px`):d==="right"?(m=`${-f}px`,x=l?p:`${g}px`):d==="left"&&(m=`${o.floating.width+f}px`,x=l?p:`${g}px`),{data:{x:m,y:x}}}});function g_(t){const[e,r="center"]=t.split("-");return[e,r]}var _S=d_,NS=p_,MS=y_,DS=m_,iW="Portal",oy=v.forwardRef((t,e)=>{var r;const{container:n,...s}=t,[i,o]=v.useState(!1);Tr(()=>o(!0),[]);const a=n||i&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return a?dO.createPortal(E.jsx(we.div,{...s,ref:e}),a):null});oy.displayName=iW;var ax="rovingFocusGroup.onEntryFocus",oW={bubbles:!1,cancelable:!0},bm="RovingFocusGroup",[Sw,x_,aW]=vm(bm),[cW,ud]=Wr(bm,[aW]),[lW,uW]=cW(bm),b_=v.forwardRef((t,e)=>E.jsx(Sw.Provider,{scope:t.__scopeRovingFocusGroup,children:E.jsx(Sw.Slot,{scope:t.__scopeRovingFocusGroup,children:E.jsx(fW,{...t,ref:e})})}));b_.displayName=bm;var fW=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...f}=t,d=v.useRef(null),h=$e(e,d),p=sy(i),[y=null,g]=ps({prop:o,defaultProp:a,onChange:c}),[m,x]=v.useState(!1),b=Gr(l),w=x_(r),A=v.useRef(!1),[O,_]=v.useState(0);return v.useEffect(()=>{const C=d.current;if(C)return C.addEventListener(ax,b),()=>C.removeEventListener(ax,b)},[b]),E.jsx(lW,{scope:r,orientation:n,dir:p,loop:s,currentTabStopId:y,onItemFocus:v.useCallback(C=>g(C),[g]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>_(C=>C+1),[]),onFocusableItemRemove:v.useCallback(()=>_(C=>C-1),[]),children:E.jsx(we.div,{tabIndex:m||O===0?-1:0,"data-orientation":n,...f,ref:h,style:{outline:"none",...t.style},onMouseDown:ce(t.onMouseDown,()=>{A.current=!0}),onFocus:ce(t.onFocus,C=>{const j=!A.current;if(C.target===C.currentTarget&&j&&!m){const V=new CustomEvent(ax,oW);if(C.currentTarget.dispatchEvent(V),!V.defaultPrevented){const B=w().filter(T=>T.focusable),z=B.find(T=>T.active),Y=B.find(T=>T.id===y),L=[z,Y,...B].filter(Boolean).map(T=>T.ref.current);S_(L,u)}}A.current=!1}),onBlur:ce(t.onBlur,()=>x(!1))})})}),w_="RovingFocusGroupItem",E_=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,...o}=t,a=us(),c=i||a,l=uW(w_,r),u=l.currentTabStopId===c,f=x_(r),{onFocusableItemAdd:d,onFocusableItemRemove:h}=l;return v.useEffect(()=>{if(n)return d(),()=>h()},[n,d,h]),E.jsx(Sw.ItemSlot,{scope:r,id:c,focusable:n,active:s,children:E.jsx(we.span,{tabIndex:u?0:-1,"data-orientation":l.orientation,...o,ref:e,onMouseDown:ce(t.onMouseDown,p=>{n?l.onItemFocus(c):p.preventDefault()}),onFocus:ce(t.onFocus,()=>l.onItemFocus(c)),onKeyDown:ce(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const y=pW(p,l.orientation,l.dir);if(y!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let m=f().filter(x=>x.focusable).map(x=>x.ref.current);if(y==="last")m.reverse();else if(y==="prev"||y==="next"){y==="prev"&&m.reverse();const x=m.indexOf(p.currentTarget);m=l.loop?yW(m,x+1):m.slice(x+1)}setTimeout(()=>S_(m))}})})})});E_.displayName=w_;var dW={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hW(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function pW(t,e,r){const n=hW(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return dW[n]}function S_(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function yW(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var LS=b_,jS=E_,vW=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Nl=new WeakMap,s1=new WeakMap,i1={},cx=0,C_=function(t){return t&&(t.host||C_(t.parentNode))},mW=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=C_(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},gW=function(t,e,r,n){var s=mW(e,Array.isArray(t)?t:[t]);i1[r]||(i1[r]=new WeakMap);var i=i1[r],o=[],a=new Set,c=new Set(s),l=function(f){!f||a.has(f)||(a.add(f),l(f.parentNode))};s.forEach(l);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(d){if(a.has(d))u(d);else try{var h=d.getAttribute(n),p=h!==null&&h!=="false",y=(Nl.get(d)||0)+1,g=(i.get(d)||0)+1;Nl.set(d,y),i.set(d,g),o.push(d),y===1&&p&&s1.set(d,!0),g===1&&d.setAttribute(r,"true"),p||d.setAttribute(n,"true")}catch(m){console.error("aria-hidden: cannot operate on ",d,m)}})};return u(e),a.clear(),cx++,function(){o.forEach(function(f){var d=Nl.get(f)-1,h=i.get(f)-1;Nl.set(f,d),i.set(f,h),d||(s1.has(f)||f.removeAttribute(n),s1.delete(f)),h||f.removeAttribute(r)}),cx--,cx||(Nl=new WeakMap,Nl=new WeakMap,s1=new WeakMap,i1={})}},BS=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=vW(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),gW(n,s,r,"aria-hidden")):function(){return null}},ci=function(){return ci=Object.assign||function(e){for(var r,n=1,s=arguments.length;n"u")return DW;var e=LW(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},BW=P_(),Tu="data-scroll-locked",FW=function(t,e,r,n){var s=t.left,i=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` + */var uR;function $H(){if(uR)return Nd;uR=1;var t=cr,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,l){var u,f={},d=null,h=null;l!==void 0&&(d=""+l),c.key!==void 0&&(d=""+c.key),c.ref!==void 0&&(h=c.ref);for(u in c)n.call(c,u)&&!i.hasOwnProperty(u)&&(f[u]=c[u]);if(a&&a.defaultProps)for(u in c=a.defaultProps,c)f[u]===void 0&&(f[u]=c[u]);return{$$typeof:e,type:a,key:d,ref:h,props:f,_owner:s.current}}return Nd.Fragment=r,Nd.jsx=o,Nd.jsxs=o,Nd}F6.exports=$H();var E=F6.exports;function zH(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function HH(t){var e=zH(t,"string");return typeof e=="symbol"?e:String(e)}function GH(t,e,r){return e=HH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fR(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function dR(t){for(var e=1;e{for(var n of Object.keys(t)){var s;if(t[n]!==((s=e[n])!==null&&s!==void 0?s:r[n]))return!1}return!0},Nt=t=>{var e=r=>{var n=t.defaultClassName,s=dR(dR({},t.defaultVariants),r);for(var i in s){var o,a=(o=s[i])!==null&&o!==void 0?o:t.defaultVariants[i];if(a!=null){var c=a;typeof c=="boolean"&&(c=c===!0?"true":"false");var l=t.variantClassNames[i][c];l&&(n+=" "+l)}}for(var[u,f]of t.compoundVariants)qH(u,s,t.defaultVariants)&&(n+=" "+f);return n};return e.variants=()=>Object.keys(t.variantClassNames),e.classNames={get base(){return t.defaultClassName.split(" ")[0]},get variants(){return hR(t.variantClassNames,r=>hR(r,n=>n.split(" ")[0]))}},e};Nt({defaultClassName:"_2q9vfj7",variantClassNames:{variant:{info:"_2q9vfj8 _2q9vfj0 fyvr11ov",warning:"_2q9vfj9 _2q9vfj1 fyvr11p1",success:"_2q9vfja _2q9vfj2 fyvr11oj",error:"_2q9vfjb _2q9vfj3 fyvr11op"},size:{sm:"_2q9vfjc _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11mv fyvr11ec fyvr11fw fyvr11fs fyvr11f4 _2q9vfj4 fyvr1wo fyvr1yk fyvr13w fyvr1e8",md:"_2q9vfjd _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _2q9vfj5 fyvr1ws fyvr1yo fyvr140 fyvr1ec",lg:"_2q9vfje _1qxj1ib9 _1qxj1ibd _1qxj1ib3 fyvr11mv fyvr11ek fyvr11g4 fyvr11fo fyvr11fc _2q9vfj6 fyvr1ww fyvr1ys fyvr144 fyvr1eg"}},defaultVariants:{},compoundVariants:[]});const gr=t=>{const{color:e="borderNormal",marginY:r="4",...n}=t;return E.jsx(q,{as:"hr",marginY:r,background:e,height:"px",borderWidth:"none",...n})};var WH=Nt({defaultClassName:"_1qxj1ib9",variantClassNames:{variant:{inherit:"_1qxj1iba _1qxj1ib0 fyvr11mu fyvr11e4 fyvr11gg fyvr11fg fyvr11ew",xlarge:"_1qxj1ibb _1qxj1ib1 fyvr11mv fyvr11es fyvr11gc fyvr11fk fyvr11fc",large:"_1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8",medium:"_1qxj1ibd _1qxj1ib3 fyvr11mv fyvr11ek fyvr11g4 fyvr11fo fyvr11fc",normal:"_1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0",small:"_1qxj1ibf _1qxj1ib5 fyvr11mv fyvr11ec fyvr11fw fyvr11fs fyvr11f4",xsmall:"_1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc",code:"_1qxj1ibh _1qxj1ib7 fyvr11mw fyvr11eg fyvr11g0 fyvr11fk fyvr11f0"},ellipsis:{true:"_1qxj1ibi _1qxj1ib8 fyvr11ls fyvr11m8 fyvr11n9 fyvr11mx"},italic:{true:"_1qxj1ibj"},underline:{true:"_1qxj1ibk"},uppercase:{true:"_1qxj1ibl"},capitalize:{true:"_1qxj1ibm"},hidden:{true:"_1qxj1ibn"}},defaultVariants:{},compoundVariants:[]});const ue=v.forwardRef((t,e)=>{const{as:r="span",variant:n="inherit",className:s,hidden:i,italic:o,underline:a,children:c,ellipsis:l,uppercase:u,capitalize:f,...d}=t,h=RH[n];return E.jsx(q,{as:r,className:qr(s,WH({hidden:i,ellipsis:l,italic:o,underline:a,uppercase:u,capitalize:f})),ref:e,...h,...d,children:c})});var KH=Nt({defaultClassName:"_140wn8ni _140wn8n0 fyvr11ls fyvr11m8 fyvr11n9 fyvr11ko fyvr12o1 fyvr11n2 fyvr11h0 _4efw240",variantClassNames:{variant:{base:"_140wn8nj _140wn8n1 fyvr11od fyvr12s1",ghost:"_140wn8nk _140wn8n2 fyvr11od fyvr12s1",feature:"_140wn8nl _140wn8n3 fyvr11pj fyvr12od",primary:"_140wn8nm _140wn8n4 fyvr11pd fyvr12od",glass:"_140wn8nn _140wn8n5 fyvr11tv fyvr12s1",emphasis:"_140wn8no _140wn8n6 fyvr11u1 fyvr12s1",raised:"_140wn8np _140wn8n7 fyvr11tp fyvr12s1",danger:"_140wn8nq _140wn8n8 fyvr11op fyvr12od",text:"_140wn8nr _1qxj1ib9 _1qxj1ibf _1qxj1ib5 fyvr11mv fyvr11ec fyvr11fw fyvr11fs fyvr11f4 _140wn8n9 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr11od fyvr12sd"},shape:{circle:"_140wn8ns _140wn8na fyvr11dc fyvr11e0 fyvr11c0 fyvr11co",square:"_140wn8nt _140wn8nb fyvr11d0 fyvr11do fyvr11bo fyvr11cc"},disabled:{true:"_140wn8nu _140wn8nc fyvr12v1 fyvr12vp",false:"_140wn8nv _140wn8nd fyvr12v7 fyvr12w1 fyvr12vz"},size:{xs:"_140wn8nw _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc _140wn8ne fyvr1ws fyvr1yo",sm:"_140wn8nx _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _140wn8nf fyvr1ww fyvr1ys",md:"_140wn8ny _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _140wn8ng fyvr1x0 fyvr1yw",lg:"_140wn8nz _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _140wn8nh fyvr1x0 fyvr1yw"},iconOnly:{true:"_140wn8n10"},hasLeftIcon:{true:"_140wn8n11"},hasRightIcon:{true:"_140wn8n12"},activeOutline:{light:"_140wn8n13",bold:"_140wn8n14"}},defaultVariants:{},compoundVariants:[[{iconOnly:!0,size:"xs"},"_140wn8n15"],[{iconOnly:!0,size:"sm"},"_140wn8n16"],[{iconOnly:!0,size:"md"},"_140wn8n17"],[{iconOnly:!0,size:"lg"},"_140wn8n18"],[{iconOnly:!1,hasLeftIcon:!0,size:"xs"},"_140wn8n19"],[{iconOnly:!1,hasLeftIcon:!0,size:"sm"},"_140wn8n1a"],[{iconOnly:!1,hasLeftIcon:!0,size:"md"},"_140wn8n1b"],[{iconOnly:!1,hasRightIcon:!0,size:"xs"},"_140wn8n1c"],[{iconOnly:!1,hasRightIcon:!0,size:"sm"},"_140wn8n1d"],[{iconOnly:!1,hasRightIcon:!0,size:"md"},"_140wn8n1e"]]});const ut=v.forwardRef((t,e)=>{const{as:r="button",activeOutline:n,className:s,disabled:i=!1,display:o="inline-flex",fontWeight:a="bold",pending:c=!1,label:l,leftIcon:u,rightIcon:f,size:d="md",variant:h="glass",width:p="fit",shape:y="circle",type:g="button",...m}=t,x=u!==void 0&&l!==void 0,b=f!==void 0&&l!==void 0,w=u!==void 0&&l===void 0,A=d==="xs"?"xs":"sm";return E.jsx(q,{as:r,className:qr(s,KH({activeOutline:n,disabled:i||c,hasLeftIcon:x,hasRightIcon:b,iconOnly:w,size:h==="text"?void 0:d,shape:h==="text"?void 0:y,variant:h})),disabled:i||c,display:o,fontWeight:a,ref:e,type:g,width:p,...m,children:w?E.jsx(u,{size:A}):E.jsxs(q,{width:"full",height:"full",justifyContent:"space-between",alignItems:"center",gap:d==="xs"?"1":"2",children:[E.jsxs(q,{justifyContent:"flex-start",alignItems:"center",gap:d==="xs"?"1":"2",children:[u&&E.jsx(u,{size:A}),E.jsx(ue,{children:l})]}),f&&E.jsx(f,{size:A})]})})});var QH=Nt({defaultClassName:"rhmai63",variantClassNames:{clickable:{true:"rhmai64 rhmai60 fyvr11a4 fyvr11ag fyvr11as fyvr11b4 fyvr12vz fyvr12v7 _4efw240"},disabled:{true:"rhmai65"},outlined:{true:"rhmai66 rhmai61 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8 fyvr12n7 fyvr12fv fyvr1217 fyvr128j fyvr12nj fyvr12g7 fyvr121j fyvr128v"},blur:{true:"rhmai67 rhmai62 fyvr11ms"}},defaultVariants:{},compoundVariants:[]});const YH=v.forwardRef((t,e)=>{const{className:r,children:n,clickable:s,outlined:i,disabled:o,blur:a,width:c="full",...l}=t;return E.jsx(q,{className:qr(r,QH({clickable:s,outlined:i,disabled:o,blur:a})),background:i?"transparent":"backgroundSecondary",overflow:"hidden",borderRadius:"md",padding:"4",width:c,ref:e,...l,children:n})});function JH(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function hm(...t){return e=>t.forEach(r=>JH(r,e))}function $e(...t){return v.useCallback(hm(...t),t)}function XH(t,e){const r=v.createContext(e);function n(i){const{children:o,...a}=i,c=v.useMemo(()=>a,Object.values(a));return E.jsx(r.Provider,{value:c,children:o})}function s(i){const o=v.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return n.displayName=t+"Provider",[n,s]}function Wr(t,e=[]){let r=[];function n(i,o){const a=v.createContext(o),c=r.length;r=[...r,o];function l(f){const{scope:d,children:h,...p}=f,y=(d==null?void 0:d[t][c])||a,g=v.useMemo(()=>p,Object.values(p));return E.jsx(y.Provider,{value:g,children:h})}function u(f,d){const h=(d==null?void 0:d[t][c])||a,p=v.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,u]}const s=()=>{const i=r.map(o=>v.createContext(o));return function(a){const c=(a==null?void 0:a[t])||i;return v.useMemo(()=>({[`__scope${t}`]:{...a,[t]:c}}),[a,c])}};return s.scopeName=t,[n,ZH(s,...e)]}function ZH(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((a,{useScope:c,scopeName:l})=>{const f=c(i)[`__scope${l}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function ce(t,e,{checkForDefaultPrevented:r=!0}={}){return function(s){if(t==null||t(s),r===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function Gr(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...r)=>{var n;return(n=e.current)==null?void 0:n.call(e,...r)},[])}function ps({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,s]=eG({defaultProp:e,onChange:r}),i=t!==void 0,o=i?t:n,a=Gr(r),c=v.useCallback(l=>{if(i){const f=typeof l=="function"?l(t):l;f!==t&&a(f)}else s(l)},[i,t,s,a]);return[o,c]}function eG({defaultProp:t,onChange:e}){const r=v.useState(t),[n]=r,s=v.useRef(n),i=Gr(e);return v.useEffect(()=>{s.current!==n&&(i(n),s.current=n)},[n,s,i]),r}function pm(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Tr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{};function ym(t){const[e,r]=v.useState(void 0);return Tr(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const c=i.borderBoxSize,l=Array.isArray(c)?c[0]:c;o=l.inlineSize,a=l.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else r(void 0)},[t]),e}function tG(t,e){return v.useReducer((r,n)=>e[r][n]??r,t)}var cn=t=>{const{present:e,children:r}=t,n=rG(e),s=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),i=$e(n.ref,nG(s));return typeof r=="function"||n.isPresent?v.cloneElement(s,{ref:i}):null};cn.displayName="Presence";function rG(t){const[e,r]=v.useState(),n=v.useRef({}),s=v.useRef(t),i=v.useRef("none"),o=t?"mounted":"unmounted",[a,c]=tG(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const l=r1(n.current);i.current=a==="mounted"?l:"none"},[a]),Tr(()=>{const l=n.current,u=s.current;if(u!==t){const d=i.current,h=r1(l);t?c("MOUNT"):h==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(u&&d!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),Tr(()=>{if(e){const l=f=>{const h=r1(n.current).includes(f.animationName);f.target===e&&h&&Eo.flushSync(()=>c("ANIMATION_END"))},u=f=>{f.target===e&&(i.current=r1(n.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",l),e.addEventListener("animationend",l),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",l),e.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function r1(t){return(t==null?void 0:t.animationName)||"none"}function nG(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,s=n&&"isReactWarning"in n&&n.isReactWarning;return s?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,s=n&&"isReactWarning"in n&&n.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var ll=v.forwardRef((t,e)=>{const{children:r,...n}=t,s=v.Children.toArray(r),i=s.find(sG);if(i){const o=i.props.children,a=s.map(c=>c===i?v.Children.count(o)>1?v.Children.only(null):v.isValidElement(o)?o.props.children:null:c);return E.jsx(xw,{...n,ref:e,children:v.isValidElement(o)?v.cloneElement(o,void 0,a):null})}return E.jsx(xw,{...n,ref:e,children:r})});ll.displayName="Slot";var xw=v.forwardRef((t,e)=>{const{children:r,...n}=t;if(v.isValidElement(r)){const s=oG(r);return v.cloneElement(r,{...iG(n,r.props),ref:e?hm(e,s):s})}return v.Children.count(r)>1?v.Children.only(null):null});xw.displayName="SlotClone";var U6=({children:t})=>E.jsx(E.Fragment,{children:t});function sG(t){return v.isValidElement(t)&&t.type===U6}function iG(t,e){const r={...e};for(const n in e){const s=t[n],i=e[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...a)=>{i(...a),s(...a)}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...t,...r}}function oG(t){var e,r;let n=(e=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:e.get,s=n&&"isReactWarning"in n&&n.isReactWarning;return s?t.ref:(n=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,s=n&&"isReactWarning"in n&&n.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var aG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],we=aG.reduce((t,e)=>{const r=v.forwardRef((n,s)=>{const{asChild:i,...o}=n,a=i?ll:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(a,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vS(t,e){t&&Eo.flushSync(()=>t.dispatchEvent(e))}var mS="Checkbox",[cG,O1e]=Wr(mS),[lG,uG]=cG(mS),V6=v.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:i,required:o,disabled:a,value:c="on",onCheckedChange:l,...u}=t,[f,d]=v.useState(null),h=$e(e,b=>d(b)),p=v.useRef(!1),y=f?!!f.closest("form"):!0,[g=!1,m]=ps({prop:s,defaultProp:i,onChange:l}),x=v.useRef(g);return v.useEffect(()=>{const b=f==null?void 0:f.form;if(b){const w=()=>m(x.current);return b.addEventListener("reset",w),()=>b.removeEventListener("reset",w)}},[f,m]),E.jsxs(lG,{scope:r,state:g,disabled:a,children:[E.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Zc(g)?"mixed":g,"aria-required":o,"data-state":H6(g),"data-disabled":a?"":void 0,disabled:a,value:c,...u,ref:h,onKeyDown:ce(t.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:ce(t.onClick,b=>{m(w=>Zc(w)?!0:!w),y&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})}),y&&E.jsx(fG,{control:f,bubbles:!p.current,name:n,value:c,checked:g,required:o,disabled:a,style:{transform:"translateX(-100%)"}})]})});V6.displayName=mS;var $6="CheckboxIndicator",z6=v.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...s}=t,i=uG($6,r);return E.jsx(cn,{present:n||Zc(i.state)||i.state===!0,children:E.jsx(we.span,{"data-state":H6(i.state),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});z6.displayName=$6;var fG=t=>{const{control:e,checked:r,bubbles:n=!0,...s}=t,i=v.useRef(null),o=pm(r),a=ym(e);return v.useEffect(()=>{const c=i.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&f){const d=new Event("click",{bubbles:n});c.indeterminate=Zc(r),f.call(c,Zc(r)?!1:r),c.dispatchEvent(d)}},[o,r,n]),E.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:Zc(r)?!1:r,...s,tabIndex:-1,ref:i,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Zc(t){return t==="indeterminate"}function H6(t){return Zc(t)?"indeterminate":t?"checked":"unchecked"}var dG=V6,hG=z6,pG=Nt({defaultClassName:"_43lu9r4",variantClassNames:{labelLocation:{top:"_43lu9r5 _43lu9r0 fyvr11kw fyvr11i4 fyvr118k fyvr11h0",left:"_43lu9r6 _43lu9r1 fyvr11ko fyvr11ic fyvr118k fyvr11h0",right:"_43lu9r7 _43lu9r2 fyvr11ko fyvr11ic fyvr118k fyvr11h0",hidden:"_43lu9r8 _43lu9r3 fyvr1188 fyvr11h0"}},defaultVariants:{},compoundVariants:[]});const Al=t=>{const{id:e,label:r,description:n,labelLocation:s="top",children:i,...o}=t,a=()=>r||n?E.jsxs(q,{flexDirection:"column",gap:"0.5",children:[r&&E.jsx(ue,{variant:"small",color:"text100",hidden:s==="hidden",children:r}),n&&E.jsx(ue,{variant:"small",color:"text50",hidden:s==="hidden",children:n})]}):null;return E.jsxs(q,{as:"label",className:pG({labelLocation:s}),htmlFor:e,...o,children:[["left","top","hidden"].includes(s)&&a(),i,s==="right"&&a()]})};var ny=Nt({defaultClassName:"_1dizidw0",variantClassNames:{size:{xs:"_1dizidw1",sm:"_1dizidw2",md:"_1dizidw3",lg:"_1dizidw4",xl:"_1dizidw5"}},defaultVariants:{},compoundVariants:[]});const yG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{stroke:"currentColor",strokeWidth:1.5,d:"m4.304 10.232 4.263 4.79 7.13-11.238"})}),gS=({size:t="sm",...e})=>E.jsx(q,{as:yG,className:ny({size:t}),...e}),vG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m3.888 7.53 1.06-1.06 5.47 5.47 5.47-5.47 1.06 1.06-6.53 6.53-6.53-6.53Z",clipRule:"evenodd"})}),G6=({size:t="sm",...e})=>E.jsx(q,{as:vG,className:ny({size:t}),...e}),mG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.418 11.06 4.47 4.47 1.06-1.06L11.48 10l4.47-4.47-1.06-1.06-4.47 4.47-4.47-4.47-1.06 1.06L9.357 10l-4.47 4.47 1.06 1.06 4.47-4.47Z",clipRule:"evenodd"})}),Gh=({size:t="sm",...e})=>E.jsx(q,{as:mG,className:ny({size:t}),...e}),gG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.608 6.75h-5.19v-1.5h7.75V13h-1.5V7.81l-7.72 7.72-1.06-1.06 7.72-7.72Z",clipRule:"evenodd"})}),xG=({size:t="sm",...e})=>E.jsx(q,{as:gG,className:ny({size:t}),...e}),bG=t=>E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:E.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.918 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm-.677 4.383a5.5 5.5 0 1 1 1.06-1.06l2.648 2.647-1.061 1.06-2.647-2.647Z",clipRule:"evenodd"})}),wG=({size:t="sm",...e})=>E.jsx(q,{as:bG,className:ny({size:t}),...e});var EG=Nt({defaultClassName:"_1c9x66f1 _1c9x66f0 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr12nd fyvr12g1 fyvr121d fyvr128p fyvr12nj fyvr12g7 fyvr121j fyvr128v fyvr11h0 fyvr11ko fyvr11jg fyvr11od fyvr12w1 fyvr12vz fyvr12vr fyvr12v7 fyvr12v3 _4efw240",variantClassNames:{size:{sm:"_1c9x66f2",lg:"_1c9x66f3"}},defaultVariants:{},compoundVariants:[]}),SG="_1c9x66f4 fyvr12s1 fyvr11h0 fyvr11ko fyvr11jg fyvr128 fyvr15o";const CG=({size:t="sm"})=>E.jsx(hG,{className:SG,children:E.jsx(gS,{size:t==="lg"?"sm":"xs"})});v.forwardRef((t,e)=>{const{disabled:r=!1,id:n,name:s,label:i="",labelLocation:o="left",size:a="sm",...c}=t;return E.jsx(Al,{disabled:r,display:"flex",id:n??s,label:i,labelLocation:o,whiteSpace:"nowrap",children:E.jsx(dG,{className:EG({size:a}),disabled:r,id:n??s,name:s,ref:e,...c,children:E.jsx(CG,{size:a})})})});cr.createContext(null);var AG=l5["useId".toString()]||(()=>{}),kG=0;function us(t){const[e,r]=v.useState(AG());return Tr(()=>{t||r(n=>n??String(kG++))},[t]),t||(e?`radix-${e}`:"")}var xS="Collapsible",[TG,_1e]=Wr(xS),[PG,bS]=TG(xS),q6=v.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:i,onOpenChange:o,...a}=t,[c=!1,l]=ps({prop:n,defaultProp:s,onChange:o});return E.jsx(PG,{scope:r,disabled:i,contentId:us(),open:c,onOpenToggle:v.useCallback(()=>l(u=>!u),[l]),children:E.jsx(we.div,{"data-state":ES(c),"data-disabled":i?"":void 0,...a,ref:e})})});q6.displayName=xS;var W6="CollapsibleTrigger",K6=v.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,s=bS(W6,r);return E.jsx(we.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":ES(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:e,onClick:ce(t.onClick,s.onOpenToggle)})});K6.displayName=W6;var wS="CollapsibleContent",Q6=v.forwardRef((t,e)=>{const{forceMount:r,...n}=t,s=bS(wS,t.__scopeCollapsible);return E.jsx(cn,{present:r||s.open,children:({present:i})=>E.jsx(RG,{...n,ref:e,present:i})})});Q6.displayName=wS;var RG=v.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:s,...i}=t,o=bS(wS,r),[a,c]=v.useState(n),l=v.useRef(null),u=$e(e,l),f=v.useRef(0),d=f.current,h=v.useRef(0),p=h.current,y=o.open||a,g=v.useRef(y),m=v.useRef();return v.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),Tr(()=>{const x=l.current;if(x){m.current=m.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const b=x.getBoundingClientRect();f.current=b.height,h.current=b.width,g.current||(x.style.transitionDuration=m.current.transitionDuration,x.style.animationName=m.current.animationName),c(n)}},[o.open,n]),E.jsx(we.div,{"data-state":ES(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!y,...i,ref:u,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...t.style},children:y&&s})});function ES(t){return t?"open":"closed"}var IG=q6,OG=K6,_G=Q6,pR="64px",NG="_4j62fl0",MG="_4j62fl2 _4j62fl1 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11h0 fyvr11ko fyvr11od fyvr128 fyvr12v7 fyvr11n4 _4efw240",DG="_4j62fl4 _4j62fl3 fyvr1ww fyvr1ys fyvr1so fyvr1v0 fyvr128",LG="_4j62fl5";const _l=t=>{const{className:e,children:r,defaultOpen:n,open:s,onOpenChange:i,label:o,...a}=t,[c,l]=v.useState(n),u=s??c,f=h=>{s===void 0&&l(h)},d=h=>{f(h),i==null||i(h)};return E.jsx(IG,{open:u,defaultOpen:n,onOpenChange:d,asChild:!0,children:E.jsxs(q,{as:Xc.div,className:qr(e,NG),initial:{height:u?"auto":pR},animate:{height:u?"auto":pR},transition:{ease:"easeOut",duration:.3},borderRadius:"md",background:"backgroundSecondary",position:"relative",overflow:"hidden",width:"full",...a,children:[E.jsxs(OG,{className:MG,children:[E.jsx(ue,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:o}),E.jsx(q,{as:Xc.div,position:"absolute",right:"0",marginRight:"4",initial:{rotate:u?180:0},animate:{rotate:u?180:0},transition:{ease:"linear",duration:.1},children:E.jsx(G6,{className:LG,color:"text50"})})]}),E.jsx(yS,{children:u&&E.jsx(_G,{className:DG,asChild:!0,forceMount:!0,children:E.jsx(Xc.div,{initial:{opacity:u?1:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:"easeOut",duration:.3},children:r})})})]})})};function vm(t){const e=t+"CollectionProvider",[r,n]=Wr(e),[s,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:p,children:y}=h,g=cr.useRef(null),m=cr.useRef(new Map).current;return E.jsx(s,{scope:p,itemMap:m,collectionRef:g,children:y})};o.displayName=e;const a=t+"CollectionSlot",c=cr.forwardRef((h,p)=>{const{scope:y,children:g}=h,m=i(a,y),x=$e(p,m.collectionRef);return E.jsx(ll,{ref:x,children:g})});c.displayName=a;const l=t+"CollectionItemSlot",u="data-radix-collection-item",f=cr.forwardRef((h,p)=>{const{scope:y,children:g,...m}=h,x=cr.useRef(null),b=$e(p,x),w=i(l,y);return cr.useEffect(()=>(w.itemMap.set(x,{ref:x,...m}),()=>void w.itemMap.delete(x))),E.jsx(ll,{[u]:"",ref:b,children:g})});f.displayName=l;function d(h){const p=i(t+"CollectionConsumer",h);return cr.useCallback(()=>{const g=p.collectionRef.current;if(!g)return[];const m=Array.from(g.querySelectorAll(`[${u}]`));return Array.from(p.itemMap.values()).sort((w,A)=>m.indexOf(w.ref.current)-m.indexOf(A.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},d,n]}var jG=v.createContext(void 0);function sy(t){const e=v.useContext(jG);return t||e||"ltr"}function BG(t,e=globalThis==null?void 0:globalThis.document){const r=Gr(t);v.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[r,e])}var FG="DismissableLayer",bw="dismissableLayer.update",UG="dismissableLayer.pointerDownOutside",VG="dismissableLayer.focusOutside",yR,Y6=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),od=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:a,...c}=t,l=v.useContext(Y6),[u,f]=v.useState(null),d=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=v.useState({}),p=$e(e,_=>f(_)),y=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),m=y.indexOf(g),x=u?y.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,w=x>=m,A=zG(_=>{const C=_.target,j=[...l.branches].some(V=>V.contains(C));!w||j||(s==null||s(_),o==null||o(_),_.defaultPrevented||a==null||a())},d),O=HG(_=>{const C=_.target;[...l.branches].some(V=>V.contains(C))||(i==null||i(_),o==null||o(_),_.defaultPrevented||a==null||a())},d);return BG(_=>{x===l.layers.size-1&&(n==null||n(_),!_.defaultPrevented&&a&&(_.preventDefault(),a()))},d),v.useEffect(()=>{if(u)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(yR=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),vR(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=yR)}},[u,d,r,l]),v.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),vR())},[u,l]),v.useEffect(()=>{const _=()=>h({});return document.addEventListener(bw,_),()=>document.removeEventListener(bw,_)},[]),E.jsx(we.div,{...c,ref:p,style:{pointerEvents:b?w?"auto":"none":void 0,...t.style},onFocusCapture:ce(t.onFocusCapture,O.onFocusCapture),onBlurCapture:ce(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ce(t.onPointerDownCapture,A.onPointerDownCapture)})});od.displayName=FG;var $G="DismissableLayerBranch",J6=v.forwardRef((t,e)=>{const r=v.useContext(Y6),n=v.useRef(null),s=$e(e,n);return v.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),E.jsx(we.div,{...t,ref:s})});J6.displayName=$G;function zG(t,e=globalThis==null?void 0:globalThis.document){const r=Gr(t),n=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const i=a=>{if(a.target&&!n.current){let c=function(){X6(UG,r,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function HG(t,e=globalThis==null?void 0:globalThis.document){const r=Gr(t),n=v.useRef(!1);return v.useEffect(()=>{const s=i=>{i.target&&!n.current&&X6(VG,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function vR(){const t=new CustomEvent(bw);document.dispatchEvent(t)}function X6(t,e,r,{discrete:n}){const s=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?vS(s,i):s.dispatchEvent(i)}var GG=od,qG=J6,nx=0;function SS(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??mR()),document.body.insertAdjacentElement("beforeend",t[1]??mR()),nx++,()=>{nx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),nx--}},[])}function mR(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}var sx="focusScope.autoFocusOnMount",ix="focusScope.autoFocusOnUnmount",gR={bubbles:!1,cancelable:!0},WG="FocusScope",mm=v.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=t,[a,c]=v.useState(null),l=Gr(s),u=Gr(i),f=v.useRef(null),d=$e(e,y=>c(y)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(n){let y=function(b){if(h.paused||!a)return;const w=b.target;a.contains(w)?f.current=w:Do(f.current,{select:!0})},g=function(b){if(h.paused||!a)return;const w=b.relatedTarget;w!==null&&(a.contains(w)||Do(f.current,{select:!0}))},m=function(b){if(document.activeElement===document.body)for(const A of b)A.removedNodes.length>0&&Do(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",g);const x=new MutationObserver(m);return a&&x.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",g),x.disconnect()}}},[n,a,h.paused]),v.useEffect(()=>{if(a){bR.add(h);const y=document.activeElement;if(!a.contains(y)){const m=new CustomEvent(sx,gR);a.addEventListener(sx,l),a.dispatchEvent(m),m.defaultPrevented||(KG(ZG(Z6(a)),{select:!0}),document.activeElement===y&&Do(a))}return()=>{a.removeEventListener(sx,l),setTimeout(()=>{const m=new CustomEvent(ix,gR);a.addEventListener(ix,u),a.dispatchEvent(m),m.defaultPrevented||Do(y??document.body,{select:!0}),a.removeEventListener(ix,u),bR.remove(h)},0)}}},[a,l,u,h]);const p=v.useCallback(y=>{if(!r&&!n||h.paused)return;const g=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,m=document.activeElement;if(g&&m){const x=y.currentTarget,[b,w]=QG(x);b&&w?!y.shiftKey&&m===w?(y.preventDefault(),r&&Do(b,{select:!0})):y.shiftKey&&m===b&&(y.preventDefault(),r&&Do(w,{select:!0})):m===x&&y.preventDefault()}},[r,n,h.paused]);return E.jsx(we.div,{tabIndex:-1,...o,ref:d,onKeyDown:p})});mm.displayName=WG;function KG(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(Do(n,{select:e}),document.activeElement!==r)return}function QG(t){const e=Z6(t),r=xR(e,t),n=xR(e.reverse(),t);return[r,n]}function Z6(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function xR(t,e){for(const r of t)if(!YG(r,{upTo:e}))return r}function YG(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function JG(t){return t instanceof HTMLInputElement&&"select"in t}function Do(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&JG(t)&&e&&t.select()}}var bR=XG();function XG(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=wR(t,e),t.unshift(e)},remove(e){var r;t=wR(t,e),(r=t[0])==null||r.resume()}}}function wR(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function ZG(t){return t.filter(e=>e.tagName!=="A")}const eq=["top","right","bottom","left"],hi=Math.min,_n=Math.max,Qv=Math.round,n1=Math.floor,Ia=t=>({x:t,y:t}),tq={left:"right",right:"left",bottom:"top",top:"bottom"},rq={start:"end",end:"start"};function ww(t,e,r){return _n(t,hi(e,r))}function vo(t,e){return typeof t=="function"?t(e):t}function mo(t){return t.split("-")[0]}function ad(t){return t.split("-")[1]}function CS(t){return t==="x"?"y":"x"}function AS(t){return t==="y"?"height":"width"}function Oa(t){return["top","bottom"].includes(mo(t))?"y":"x"}function kS(t){return CS(Oa(t))}function nq(t,e,r){r===void 0&&(r=!1);const n=ad(t),s=kS(t),i=AS(s);let o=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Yv(o)),[o,Yv(o)]}function sq(t){const e=Yv(t);return[Ew(t),e,Ew(e)]}function Ew(t){return t.replace(/start|end/g,e=>rq[e])}function iq(t,e,r){const n=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?s:n:e?n:s;case"left":case"right":return e?i:o;default:return[]}}function oq(t,e,r,n){const s=ad(t);let i=iq(mo(t),r==="start",n);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Ew)))),i}function Yv(t){return t.replace(/left|right|bottom|top/g,e=>tq[e])}function aq(t){return{top:0,right:0,bottom:0,left:0,...t}}function e_(t){return typeof t!="number"?aq(t):{top:t,right:t,bottom:t,left:t}}function Jv(t){const{x:e,y:r,width:n,height:s}=t;return{width:n,height:s,top:r,left:e,right:e+n,bottom:r+s,x:e,y:r}}function ER(t,e,r){let{reference:n,floating:s}=t;const i=Oa(e),o=kS(e),a=AS(o),c=mo(e),l=i==="y",u=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,d=n[a]/2-s[a]/2;let h;switch(c){case"top":h={x:u,y:n.y-s.height};break;case"bottom":h={x:u,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:f};break;case"left":h={x:n.x-s.width,y:f};break;default:h={x:n.x,y:n.y}}switch(ad(e)){case"start":h[o]-=d*(r&&l?-1:1);break;case"end":h[o]+=d*(r&&l?-1:1);break}return h}const cq=async(t,e,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:i=[],platform:o}=r,a=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:u,y:f}=ER(l,n,c),d=n,h={},p=0;for(let y=0;y({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:s,rects:i,platform:o,elements:a,middlewareData:c}=e,{element:l,padding:u=0}=vo(t,e)||{};if(l==null)return{};const f=e_(u),d={x:r,y:n},h=kS(s),p=AS(h),y=await o.getDimensions(l),g=h==="y",m=g?"top":"left",x=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-d[h]-i.floating[p],A=d[h]-i.reference[h],O=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let _=O?O[b]:0;(!_||!await(o.isElement==null?void 0:o.isElement(O)))&&(_=a.floating[b]||i.floating[p]);const C=w/2-A/2,j=_/2-y[p]/2-1,V=hi(f[m],j),B=hi(f[x],j),z=V,Y=_-y[p]-B,H=_/2-y[p]/2+C,L=ww(z,H,Y),T=!c.arrow&&ad(s)!=null&&H!==L&&i.reference[p]/2-(HH<=0)){var B,z;const H=(((B=i.flip)==null?void 0:B.index)||0)+1,L=_[H];if(L)return{data:{index:H,overflows:V},reset:{placement:L}};let T=(z=V.filter(P=>P.overflows[0]<=0).sort((P,R)=>P.overflows[1]-R.overflows[1])[0])==null?void 0:z.placement;if(!T)switch(h){case"bestFit":{var Y;const P=(Y=V.filter(R=>{if(O){const I=Oa(R.placement);return I===x||I==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(I=>I>0).reduce((I,U)=>I+U,0)]).sort((R,I)=>R[1]-I[1])[0])==null?void 0:Y[0];P&&(T=P);break}case"initialPlacement":T=a;break}if(s!==T)return{reset:{placement:T}}}return{}}}};function SR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function CR(t){return eq.some(e=>t[e]>=0)}const fq=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...s}=vo(t,e);switch(n){case"referenceHidden":{const i=await qh(e,{...s,elementContext:"reference"}),o=SR(i,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:CR(o)}}}case"escaped":{const i=await qh(e,{...s,altBoundary:!0}),o=SR(i,r.floating);return{data:{escapedOffsets:o,escaped:CR(o)}}}default:return{}}}}};async function dq(t,e){const{placement:r,platform:n,elements:s}=t,i=await(n.isRTL==null?void 0:n.isRTL(s.floating)),o=mo(r),a=ad(r),c=Oa(r)==="y",l=["left","top"].includes(o)?-1:1,u=i&&c?-1:1,f=vo(e,t);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),c?{x:h*u,y:d*l}:{x:d*l,y:h*u}}const hq=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var r,n;const{x:s,y:i,placement:o,middlewareData:a}=e,c=await dq(e,t);return o===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},pq=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:m,y:x}=g;return{x:m,y:x}}},...c}=vo(t,e),l={x:r,y:n},u=await qh(e,c),f=Oa(mo(s)),d=CS(f);let h=l[d],p=l[f];if(i){const g=d==="y"?"top":"left",m=d==="y"?"bottom":"right",x=h+u[g],b=h-u[m];h=ww(x,h,b)}if(o){const g=f==="y"?"top":"left",m=f==="y"?"bottom":"right",x=p+u[g],b=p-u[m];p=ww(x,p,b)}const y=a.fn({...e,[d]:h,[f]:p});return{...y,data:{x:y.x-r,y:y.y-n}}}}},yq=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=vo(t,e),u={x:r,y:n},f=Oa(s),d=CS(f);let h=u[d],p=u[f];const y=vo(a,e),g=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const b=d==="y"?"height":"width",w=i.reference[d]-i.floating[b]+g.mainAxis,A=i.reference[d]+i.reference[b]-g.mainAxis;hA&&(h=A)}if(l){var m,x;const b=d==="y"?"width":"height",w=["top","left"].includes(mo(s)),A=i.reference[f]-i.floating[b]+(w&&((m=o.offset)==null?void 0:m[f])||0)+(w?0:g.crossAxis),O=i.reference[f]+i.reference[b]+(w?0:((x=o.offset)==null?void 0:x[f])||0)-(w?g.crossAxis:0);pO&&(p=O)}return{[d]:h,[f]:p}}}},vq=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:s,elements:i}=e,{apply:o=()=>{},...a}=vo(t,e),c=await qh(e,a),l=mo(r),u=ad(r),f=Oa(r)==="y",{width:d,height:h}=n.floating;let p,y;l==="top"||l==="bottom"?(p=l,y=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(y=l,p=u==="end"?"top":"bottom");const g=h-c.top-c.bottom,m=d-c.left-c.right,x=hi(h-c[p],g),b=hi(d-c[y],m),w=!e.middlewareData.shift;let A=x,O=b;if(f?O=u||w?hi(b,m):m:A=u||w?hi(x,g):g,w&&!u){const C=_n(c.left,0),j=_n(c.right,0),V=_n(c.top,0),B=_n(c.bottom,0);f?O=d-2*(C!==0||j!==0?C+j:_n(c.left,c.right)):A=h-2*(V!==0||B!==0?V+B:_n(c.top,c.bottom))}await o({...e,availableWidth:O,availableHeight:A});const _=await s.getDimensions(i.floating);return d!==_.width||h!==_.height?{reset:{rects:!0}}:{}}}};function cd(t){return t_(t)?(t.nodeName||"").toLowerCase():"#document"}function jn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function So(t){var e;return(e=(t_(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function t_(t){return t instanceof Node||t instanceof jn(t).Node}function bi(t){return t instanceof Element||t instanceof jn(t).Element}function wi(t){return t instanceof HTMLElement||t instanceof jn(t).HTMLElement}function AR(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof jn(t).ShadowRoot}function iy(t){const{overflow:e,overflowX:r,overflowY:n,display:s}=Fs(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(s)}function mq(t){return["table","td","th"].includes(cd(t))}function gm(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function TS(t){const e=PS(),r=Fs(t);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function gq(t){let e=_a(t);for(;wi(e)&&!Bf(e);){if(gm(e))return null;if(TS(e))return e;e=_a(e)}return null}function PS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Bf(t){return["html","body","#document"].includes(cd(t))}function Fs(t){return jn(t).getComputedStyle(t)}function xm(t){return bi(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function _a(t){if(cd(t)==="html")return t;const e=t.assignedSlot||t.parentNode||AR(t)&&t.host||So(t);return AR(e)?e.host:e}function r_(t){const e=_a(t);return Bf(e)?t.ownerDocument?t.ownerDocument.body:t.body:wi(e)&&iy(e)?e:r_(e)}function Wh(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const s=r_(t),i=s===((n=t.ownerDocument)==null?void 0:n.body),o=jn(s);return i?e.concat(o,o.visualViewport||[],iy(s)?s:[],o.frameElement&&r?Wh(o.frameElement):[]):e.concat(s,Wh(s,[],r))}function n_(t){const e=Fs(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=wi(t),i=s?t.offsetWidth:r,o=s?t.offsetHeight:n,a=Qv(r)!==i||Qv(n)!==o;return a&&(r=i,n=o),{width:r,height:n,$:a}}function RS(t){return bi(t)?t:t.contextElement}function ku(t){const e=RS(t);if(!wi(e))return Ia(1);const r=e.getBoundingClientRect(),{width:n,height:s,$:i}=n_(e);let o=(i?Qv(r.width):r.width)/n,a=(i?Qv(r.height):r.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const xq=Ia(0);function s_(t){const e=jn(t);return!PS()||!e.visualViewport?xq:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bq(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==jn(t)?!1:e}function ul(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const s=t.getBoundingClientRect(),i=RS(t);let o=Ia(1);e&&(n?bi(n)&&(o=ku(n)):o=ku(t));const a=bq(i,r,n)?s_(i):Ia(0);let c=(s.left+a.x)/o.x,l=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const d=jn(i),h=n&&bi(n)?jn(n):n;let p=d,y=p.frameElement;for(;y&&n&&h!==p;){const g=ku(y),m=y.getBoundingClientRect(),x=Fs(y),b=m.left+(y.clientLeft+parseFloat(x.paddingLeft))*g.x,w=m.top+(y.clientTop+parseFloat(x.paddingTop))*g.y;c*=g.x,l*=g.y,u*=g.x,f*=g.y,c+=b,l+=w,p=jn(y),y=p.frameElement}}return Jv({width:u,height:f,x:c,y:l})}function wq(t){let{elements:e,rect:r,offsetParent:n,strategy:s}=t;const i=s==="fixed",o=So(n),a=e?gm(e.floating):!1;if(n===o||a&&i)return r;let c={scrollLeft:0,scrollTop:0},l=Ia(1);const u=Ia(0),f=wi(n);if((f||!f&&!i)&&((cd(n)!=="body"||iy(o))&&(c=xm(n)),wi(n))){const d=ul(n);l=ku(n),u.x=d.x+n.clientLeft,u.y=d.y+n.clientTop}return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+u.x,y:r.y*l.y-c.scrollTop*l.y+u.y}}function Eq(t){return Array.from(t.getClientRects())}function i_(t){return ul(So(t)).left+xm(t).scrollLeft}function Sq(t){const e=So(t),r=xm(t),n=t.ownerDocument.body,s=_n(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=_n(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+i_(t);const a=-r.scrollTop;return Fs(n).direction==="rtl"&&(o+=_n(e.clientWidth,n.clientWidth)-s),{width:s,height:i,x:o,y:a}}function Cq(t,e){const r=jn(t),n=So(t),s=r.visualViewport;let i=n.clientWidth,o=n.clientHeight,a=0,c=0;if(s){i=s.width,o=s.height;const l=PS();(!l||l&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:a,y:c}}function Aq(t,e){const r=ul(t,!0,e==="fixed"),n=r.top+t.clientTop,s=r.left+t.clientLeft,i=wi(t)?ku(t):Ia(1),o=t.clientWidth*i.x,a=t.clientHeight*i.y,c=s*i.x,l=n*i.y;return{width:o,height:a,x:c,y:l}}function kR(t,e,r){let n;if(e==="viewport")n=Cq(t,r);else if(e==="document")n=Sq(So(t));else if(bi(e))n=Aq(e,r);else{const s=s_(t);n={...e,x:e.x-s.x,y:e.y-s.y}}return Jv(n)}function o_(t,e){const r=_a(t);return r===e||!bi(r)||Bf(r)?!1:Fs(r).position==="fixed"||o_(r,e)}function kq(t,e){const r=e.get(t);if(r)return r;let n=Wh(t,[],!1).filter(a=>bi(a)&&cd(a)!=="body"),s=null;const i=Fs(t).position==="fixed";let o=i?_a(t):t;for(;bi(o)&&!Bf(o);){const a=Fs(o),c=TS(o);!c&&a.position==="fixed"&&(s=null),(i?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||iy(o)&&!c&&o_(t,o))?n=n.filter(u=>u!==o):s=a,o=_a(o)}return e.set(t,n),n}function Tq(t){let{element:e,boundary:r,rootBoundary:n,strategy:s}=t;const o=[...r==="clippingAncestors"?gm(e)?[]:kq(e,this._c):[].concat(r),n],a=o[0],c=o.reduce((l,u)=>{const f=kR(e,u,s);return l.top=_n(f.top,l.top),l.right=hi(f.right,l.right),l.bottom=hi(f.bottom,l.bottom),l.left=_n(f.left,l.left),l},kR(e,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Pq(t){const{width:e,height:r}=n_(t);return{width:e,height:r}}function Rq(t,e,r){const n=wi(e),s=So(e),i=r==="fixed",o=ul(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const c=Ia(0);if(n||!n&&!i)if((cd(e)!=="body"||iy(s))&&(a=xm(e)),n){const f=ul(e,!0,i,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else s&&(c.x=i_(s));const l=o.left+a.scrollLeft-c.x,u=o.top+a.scrollTop-c.y;return{x:l,y:u,width:o.width,height:o.height}}function ox(t){return Fs(t).position==="static"}function TR(t,e){return!wi(t)||Fs(t).position==="fixed"?null:e?e(t):t.offsetParent}function a_(t,e){const r=jn(t);if(gm(t))return r;if(!wi(t)){let s=_a(t);for(;s&&!Bf(s);){if(bi(s)&&!ox(s))return s;s=_a(s)}return r}let n=TR(t,e);for(;n&&mq(n)&&ox(n);)n=TR(n,e);return n&&Bf(n)&&ox(n)&&!TS(n)?r:n||gq(t)||r}const Iq=async function(t){const e=this.getOffsetParent||a_,r=this.getDimensions,n=await r(t.floating);return{reference:Rq(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Oq(t){return Fs(t).direction==="rtl"}const _q={convertOffsetParentRelativeRectToViewportRelativeRect:wq,getDocumentElement:So,getClippingRect:Tq,getOffsetParent:a_,getElementRects:Iq,getClientRects:Eq,getDimensions:Pq,getScale:ku,isElement:bi,isRTL:Oq};function Nq(t,e){let r=null,n;const s=So(t);function i(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const{left:l,top:u,width:f,height:d}=t.getBoundingClientRect();if(a||e(),!f||!d)return;const h=n1(u),p=n1(s.clientWidth-(l+f)),y=n1(s.clientHeight-(u+d)),g=n1(l),x={rootMargin:-h+"px "+-p+"px "+-y+"px "+-g+"px",threshold:_n(0,hi(1,c))||1};let b=!0;function w(A){const O=A[0].intersectionRatio;if(O!==c){if(!b)return o();O?o(!1,O):n=setTimeout(()=>{o(!1,1e-7)},1e3)}b=!1}try{r=new IntersectionObserver(w,{...x,root:s.ownerDocument})}catch{r=new IntersectionObserver(w,x)}r.observe(t)}return o(!0),i}function Mq(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=RS(t),u=s||i?[...l?Wh(l):[],...Wh(e)]:[];u.forEach(m=>{s&&m.addEventListener("scroll",r,{passive:!0}),i&&m.addEventListener("resize",r)});const f=l&&a?Nq(l,r):null;let d=-1,h=null;o&&(h=new ResizeObserver(m=>{let[x]=m;x&&x.target===l&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),r()}),l&&!c&&h.observe(l),h.observe(e));let p,y=c?ul(t):null;c&&g();function g(){const m=ul(t);y&&(m.x!==y.x||m.y!==y.y||m.width!==y.width||m.height!==y.height)&&r(),y=m,p=requestAnimationFrame(g)}return r(),()=>{var m;u.forEach(x=>{s&&x.removeEventListener("scroll",r),i&&x.removeEventListener("resize",r)}),f==null||f(),(m=h)==null||m.disconnect(),h=null,c&&cancelAnimationFrame(p)}}const Dq=hq,Lq=pq,jq=uq,Bq=vq,Fq=fq,PR=lq,Uq=yq,Vq=(t,e,r)=>{const n=new Map,s={platform:_q,...r},i={...s.platform,_c:n};return cq(t,e,{...s,platform:i})};var K1=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Xv(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,n,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(n=r;n--!==0;)if(!Xv(t[n],e[n]))return!1;return!0}if(s=Object.keys(t),r=s.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){const i=s[n];if(!(i==="_owner"&&t.$$typeof)&&!Xv(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function c_(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function RR(t,e){const r=c_(t);return Math.round(e*r)/r}function IR(t){const e=v.useRef(t);return K1(()=>{e.current=t}),e}function $q(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:c,open:l}=t,[u,f]=v.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=v.useState(n);Xv(d,n)||h(n);const[p,y]=v.useState(null),[g,m]=v.useState(null),x=v.useCallback(P=>{P!==O.current&&(O.current=P,y(P))},[]),b=v.useCallback(P=>{P!==_.current&&(_.current=P,m(P))},[]),w=i||p,A=o||g,O=v.useRef(null),_=v.useRef(null),C=v.useRef(u),j=c!=null,V=IR(c),B=IR(s),z=v.useCallback(()=>{if(!O.current||!_.current)return;const P={placement:e,strategy:r,middleware:d};B.current&&(P.platform=B.current),Vq(O.current,_.current,P).then(R=>{const I={...R,isPositioned:!0};Y.current&&!Xv(C.current,I)&&(C.current=I,Eo.flushSync(()=>{f(I)}))})},[d,e,r,B]);K1(()=>{l===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,f(P=>({...P,isPositioned:!1})))},[l]);const Y=v.useRef(!1);K1(()=>(Y.current=!0,()=>{Y.current=!1}),[]),K1(()=>{if(w&&(O.current=w),A&&(_.current=A),w&&A){if(V.current)return V.current(w,A,z);z()}},[w,A,z,V,j]);const H=v.useMemo(()=>({reference:O,floating:_,setReference:x,setFloating:b}),[x,b]),L=v.useMemo(()=>({reference:w,floating:A}),[w,A]),T=v.useMemo(()=>{const P={position:r,left:0,top:0};if(!L.floating)return P;const R=RR(L.floating,u.x),I=RR(L.floating,u.y);return a?{...P,transform:"translate("+R+"px, "+I+"px)",...c_(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:R,top:I}},[r,a,L.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:z,refs:H,elements:L,floatingStyles:T}),[u,z,H,L,T])}const zq=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:s}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?PR({element:n.current,padding:s}).fn(r):{}:n?PR({element:n,padding:s}).fn(r):{}}}},Hq=(t,e)=>({...Dq(t),options:[t,e]}),Gq=(t,e)=>({...Lq(t),options:[t,e]}),qq=(t,e)=>({...Uq(t),options:[t,e]}),Wq=(t,e)=>({...jq(t),options:[t,e]}),Kq=(t,e)=>({...Bq(t),options:[t,e]}),Qq=(t,e)=>({...Fq(t),options:[t,e]}),Yq=(t,e)=>({...zq(t),options:[t,e]});var Jq="Arrow",l_=v.forwardRef((t,e)=>{const{children:r,width:n=10,height:s=5,...i}=t;return E.jsx(we.svg,{...i,ref:e,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:E.jsx("polygon",{points:"0,0 30,0 15,10"})})});l_.displayName=Jq;var Xq=l_,IS="Popper",[u_,ld]=Wr(IS),[Zq,f_]=u_(IS),d_=t=>{const{__scopePopper:e,children:r}=t,[n,s]=v.useState(null);return E.jsx(Zq,{scope:e,anchor:n,onAnchorChange:s,children:r})};d_.displayName=IS;var h_="PopperAnchor",p_=v.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...s}=t,i=f_(h_,r),o=v.useRef(null),a=$e(e,o);return v.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:E.jsx(we.div,{...s,ref:a})});p_.displayName=h_;var OS="PopperContent",[eW,tW]=u_(OS),y_=v.forwardRef((t,e)=>{var r,n,s,i,o,a;const{__scopePopper:c,side:l="bottom",sideOffset:u=0,align:f="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:p=!0,collisionBoundary:y=[],collisionPadding:g=0,sticky:m="partial",hideWhenDetached:x=!1,updatePositionStrategy:b="optimized",onPlaced:w,...A}=t,O=f_(OS,c),[_,C]=v.useState(null),j=$e(e,at=>C(at)),[V,B]=v.useState(null),z=ym(V),Y=(z==null?void 0:z.width)??0,H=(z==null?void 0:z.height)??0,L=l+(f!=="center"?"-"+f:""),T=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},P=Array.isArray(y)?y:[y],R=P.length>0,I={padding:T,boundary:P.filter(nW),altBoundary:R},{refs:U,floatingStyles:F,placement:X,isPositioned:oe,middlewareData:ae}=$q({strategy:"fixed",placement:L,whileElementsMounted:(...at)=>Mq(...at,{animationFrame:b==="always"}),elements:{reference:O.anchor},middleware:[Hq({mainAxis:u+H,alignmentAxis:d}),p&&Gq({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?qq():void 0,...I}),p&&Wq({...I}),Kq({...I,apply:({elements:at,rects:qe,availableWidth:Kr,availableHeight:vs})=>{const{width:Qa,height:Ci}=qe.reference,Rl=at.floating.style;Rl.setProperty("--radix-popper-available-width",`${Kr}px`),Rl.setProperty("--radix-popper-available-height",`${vs}px`),Rl.setProperty("--radix-popper-anchor-width",`${Qa}px`),Rl.setProperty("--radix-popper-anchor-height",`${Ci}px`)}}),V&&Yq({element:V,padding:h}),sW({arrowWidth:Y,arrowHeight:H}),x&&Qq({strategy:"referenceHidden",...I})]}),[ke,ve]=g_(X),ie=Gr(w);Tr(()=>{oe&&(ie==null||ie())},[oe,ie]);const Me=(r=ae.arrow)==null?void 0:r.x,Be=(n=ae.arrow)==null?void 0:n.y,Te=((s=ae.arrow)==null?void 0:s.centerOffset)!==0,[De,ze]=v.useState();return Tr(()=>{_&&ze(window.getComputedStyle(_).zIndex)},[_]),E.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:oe?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:De,"--radix-popper-transform-origin":[(i=ae.transformOrigin)==null?void 0:i.x,(o=ae.transformOrigin)==null?void 0:o.y].join(" "),...((a=ae.hide)==null?void 0:a.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:E.jsx(eW,{scope:c,placedSide:ke,onArrowChange:B,arrowX:Me,arrowY:Be,shouldHideArrow:Te,children:E.jsx(we.div,{"data-side":ke,"data-align":ve,...A,ref:j,style:{...A.style,animation:oe?void 0:"none"}})})})});y_.displayName=OS;var v_="PopperArrow",rW={top:"bottom",right:"left",bottom:"top",left:"right"},m_=v.forwardRef(function(e,r){const{__scopePopper:n,...s}=e,i=tW(v_,n),o=rW[i.placedSide];return E.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:E.jsx(Xq,{...s,ref:r,style:{...s.style,display:"block"}})})});m_.displayName=v_;function nW(t){return t!==null}var sW=t=>({name:"transformOrigin",options:t,fn(e){var r,n,s;const{placement:i,rects:o,middlewareData:a}=e,l=((r=a.arrow)==null?void 0:r.centerOffset)!==0,u=l?0:t.arrowWidth,f=l?0:t.arrowHeight,[d,h]=g_(i),p={start:"0%",center:"50%",end:"100%"}[h],y=(((n=a.arrow)==null?void 0:n.x)??0)+u/2,g=(((s=a.arrow)==null?void 0:s.y)??0)+f/2;let m="",x="";return d==="bottom"?(m=l?p:`${y}px`,x=`${-f}px`):d==="top"?(m=l?p:`${y}px`,x=`${o.floating.height+f}px`):d==="right"?(m=`${-f}px`,x=l?p:`${g}px`):d==="left"&&(m=`${o.floating.width+f}px`,x=l?p:`${g}px`),{data:{x:m,y:x}}}});function g_(t){const[e,r="center"]=t.split("-");return[e,r]}var _S=d_,NS=p_,MS=y_,DS=m_,iW="Portal",oy=v.forwardRef((t,e)=>{var r;const{container:n,...s}=t,[i,o]=v.useState(!1);Tr(()=>o(!0),[]);const a=n||i&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return a?dO.createPortal(E.jsx(we.div,{...s,ref:e}),a):null});oy.displayName=iW;var ax="rovingFocusGroup.onEntryFocus",oW={bubbles:!1,cancelable:!0},bm="RovingFocusGroup",[Sw,x_,aW]=vm(bm),[cW,ud]=Wr(bm,[aW]),[lW,uW]=cW(bm),b_=v.forwardRef((t,e)=>E.jsx(Sw.Provider,{scope:t.__scopeRovingFocusGroup,children:E.jsx(Sw.Slot,{scope:t.__scopeRovingFocusGroup,children:E.jsx(fW,{...t,ref:e})})}));b_.displayName=bm;var fW=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...f}=t,d=v.useRef(null),h=$e(e,d),p=sy(i),[y=null,g]=ps({prop:o,defaultProp:a,onChange:c}),[m,x]=v.useState(!1),b=Gr(l),w=x_(r),A=v.useRef(!1),[O,_]=v.useState(0);return v.useEffect(()=>{const C=d.current;if(C)return C.addEventListener(ax,b),()=>C.removeEventListener(ax,b)},[b]),E.jsx(lW,{scope:r,orientation:n,dir:p,loop:s,currentTabStopId:y,onItemFocus:v.useCallback(C=>g(C),[g]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>_(C=>C+1),[]),onFocusableItemRemove:v.useCallback(()=>_(C=>C-1),[]),children:E.jsx(we.div,{tabIndex:m||O===0?-1:0,"data-orientation":n,...f,ref:h,style:{outline:"none",...t.style},onMouseDown:ce(t.onMouseDown,()=>{A.current=!0}),onFocus:ce(t.onFocus,C=>{const j=!A.current;if(C.target===C.currentTarget&&j&&!m){const V=new CustomEvent(ax,oW);if(C.currentTarget.dispatchEvent(V),!V.defaultPrevented){const B=w().filter(T=>T.focusable),z=B.find(T=>T.active),Y=B.find(T=>T.id===y),L=[z,Y,...B].filter(Boolean).map(T=>T.ref.current);S_(L,u)}}A.current=!1}),onBlur:ce(t.onBlur,()=>x(!1))})})}),w_="RovingFocusGroupItem",E_=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,...o}=t,a=us(),c=i||a,l=uW(w_,r),u=l.currentTabStopId===c,f=x_(r),{onFocusableItemAdd:d,onFocusableItemRemove:h}=l;return v.useEffect(()=>{if(n)return d(),()=>h()},[n,d,h]),E.jsx(Sw.ItemSlot,{scope:r,id:c,focusable:n,active:s,children:E.jsx(we.span,{tabIndex:u?0:-1,"data-orientation":l.orientation,...o,ref:e,onMouseDown:ce(t.onMouseDown,p=>{n?l.onItemFocus(c):p.preventDefault()}),onFocus:ce(t.onFocus,()=>l.onItemFocus(c)),onKeyDown:ce(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){l.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const y=pW(p,l.orientation,l.dir);if(y!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let m=f().filter(x=>x.focusable).map(x=>x.ref.current);if(y==="last")m.reverse();else if(y==="prev"||y==="next"){y==="prev"&&m.reverse();const x=m.indexOf(p.currentTarget);m=l.loop?yW(m,x+1):m.slice(x+1)}setTimeout(()=>S_(m))}})})})});E_.displayName=w_;var dW={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hW(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function pW(t,e,r){const n=hW(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return dW[n]}function S_(t,e=!1){const r=document.activeElement;for(const n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function yW(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var LS=b_,jS=E_,vW=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Nl=new WeakMap,s1=new WeakMap,i1={},cx=0,C_=function(t){return t&&(t.host||C_(t.parentNode))},mW=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=C_(r);return n&&t.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",t,". Doing nothing"),null)}).filter(function(r){return!!r})},gW=function(t,e,r,n){var s=mW(e,Array.isArray(t)?t:[t]);i1[r]||(i1[r]=new WeakMap);var i=i1[r],o=[],a=new Set,c=new Set(s),l=function(f){!f||a.has(f)||(a.add(f),l(f.parentNode))};s.forEach(l);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(d){if(a.has(d))u(d);else try{var h=d.getAttribute(n),p=h!==null&&h!=="false",y=(Nl.get(d)||0)+1,g=(i.get(d)||0)+1;Nl.set(d,y),i.set(d,g),o.push(d),y===1&&p&&s1.set(d,!0),g===1&&d.setAttribute(r,"true"),p||d.setAttribute(n,"true")}catch(m){console.error("aria-hidden: cannot operate on ",d,m)}})};return u(e),a.clear(),cx++,function(){o.forEach(function(f){var d=Nl.get(f)-1,h=i.get(f)-1;Nl.set(f,d),i.set(f,h),d||(s1.has(f)||f.removeAttribute(n),s1.delete(f)),h||f.removeAttribute(r)}),cx--,cx||(Nl=new WeakMap,Nl=new WeakMap,s1=new WeakMap,i1={})}},BS=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=vW(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),gW(n,s,r,"aria-hidden")):function(){return null}},ci=function(){return ci=Object.assign||function(e){for(var r,n=1,s=arguments.length;n"u")return DW;var e=LW(t),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-r+e[2]-e[0])}},BW=P_(),Tu="data-scroll-locked",FW=function(t,e,r,n){var s=t.left,i=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` .`.concat(bW,` { overflow: hidden `).concat(n,`; padding-right: `).concat(a,"px ").concat(n,`; @@ -98,16 +98,16 @@ Error generating stack: `+i.message+` `)},_R=function(){var t=parseInt(document.body.getAttribute(Tu)||"0",10);return isFinite(t)?t:0},UW=function(){v.useEffect(function(){return document.body.setAttribute(Tu,(_R()+1).toString()),function(){var t=_R()-1;t<=0?document.body.removeAttribute(Tu):document.body.setAttribute(Tu,t.toString())}},[])},VW=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,s=n===void 0?"margin":n;UW();var i=v.useMemo(function(){return jW(s)},[s]);return v.createElement(BW,{styles:FW(i,!e,s,r?"":"!important")})},Cw=!1;if(typeof window<"u")try{var o1=Object.defineProperty({},"passive",{get:function(){return Cw=!0,!0}});window.addEventListener("test",o1,o1),window.removeEventListener("test",o1,o1)}catch{Cw=!1}var Ml=Cw?{passive:!1}:!1,$W=function(t){return t.tagName==="TEXTAREA"},R_=function(t,e){var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!$W(t)&&r[e]==="visible")},zW=function(t){return R_(t,"overflowY")},HW=function(t){return R_(t,"overflowX")},NR=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=I_(t,n);if(s){var i=O_(t,n),o=i[1],a=i[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},GW=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},qW=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},I_=function(t,e){return t==="v"?zW(e):HW(e)},O_=function(t,e){return t==="v"?GW(e):qW(e)},WW=function(t,e){return t==="h"&&e==="rtl"?-1:1},KW=function(t,e,r,n,s){var i=WW(t,window.getComputedStyle(e).direction),o=i*n,a=r.target,c=e.contains(a),l=!1,u=o>0,f=0,d=0;do{var h=O_(t,a),p=h[0],y=h[1],g=h[2],m=y-g-i*p;(p||m)&&I_(t,a)&&(f+=m,d+=p),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(e.contains(a)||e===a));return(u&&(Math.abs(f)<1||!s)||!u&&(Math.abs(d)<1||!s))&&(l=!0),l},a1=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},MR=function(t){return[t.deltaX,t.deltaY]},DR=function(t){return t&&"current"in t?t.current:t},QW=function(t,e){return t[0]===e[0]&&t[1]===e[1]},YW=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},JW=0,Dl=[];function XW(t){var e=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(JW++)[0],i=v.useState(P_)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var y=xW([t.lockRef.current],(t.shards||[]).map(DR),!0).filter(Boolean);return y.forEach(function(g){return g.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),y.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var a=v.useCallback(function(y,g){if("touches"in y&&y.touches.length===2)return!o.current.allowPinchZoom;var m=a1(y),x=r.current,b="deltaX"in y?y.deltaX:x[0]-m[0],w="deltaY"in y?y.deltaY:x[1]-m[1],A,O=y.target,_=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in y&&_==="h"&&O.type==="range")return!1;var C=NR(_,O);if(!C)return!0;if(C?A=_:(A=_==="v"?"h":"v",C=NR(_,O)),!C)return!1;if(!n.current&&"changedTouches"in y&&(b||w)&&(n.current=A),!A)return!0;var j=n.current||A;return KW(j,g,y,j==="h"?b:w,!0)},[]),c=v.useCallback(function(y){var g=y;if(!(!Dl.length||Dl[Dl.length-1]!==i)){var m="deltaY"in g?MR(g):a1(g),x=e.current.filter(function(A){return A.name===g.type&&(A.target===g.target||g.target===A.shadowParent)&&QW(A.delta,m)})[0];if(x&&x.should){g.cancelable&&g.preventDefault();return}if(!x){var b=(o.current.shards||[]).map(DR).filter(Boolean).filter(function(A){return A.contains(g.target)}),w=b.length>0?a(g,b[0]):!o.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),l=v.useCallback(function(y,g,m,x){var b={name:y,delta:g,target:m,should:x,shadowParent:ZW(m)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(w){return w!==b})},1)},[]),u=v.useCallback(function(y){r.current=a1(y),n.current=void 0},[]),f=v.useCallback(function(y){l(y.type,MR(y),y.target,a(y,t.lockRef.current))},[]),d=v.useCallback(function(y){l(y.type,a1(y),y.target,a(y,t.lockRef.current))},[]);v.useEffect(function(){return Dl.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",c,Ml),document.addEventListener("touchmove",c,Ml),document.addEventListener("touchstart",u,Ml),function(){Dl=Dl.filter(function(y){return y!==i}),document.removeEventListener("wheel",c,Ml),document.removeEventListener("touchmove",c,Ml),document.removeEventListener("touchstart",u,Ml)}},[]);var h=t.removeScrollBar,p=t.inert;return v.createElement(v.Fragment,null,p?v.createElement(i,{styles:YW(s)}):null,h?v.createElement(VW,{gapMode:t.gapMode}):null)}function ZW(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const eK=PW(T_,XW);var Em=v.forwardRef(function(t,e){return v.createElement(wm,ci({},t,{ref:e,sideCar:eK}))});Em.classNames=wm.classNames;var Aw=["Enter"," "],tK=["ArrowDown","PageUp","Home"],__=["ArrowUp","PageDown","End"],rK=[...tK,...__],nK={ltr:[...Aw,"ArrowRight"],rtl:[...Aw,"ArrowLeft"]},sK={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ay="Menu",[Kh,iK,oK]=vm(ay),[kl,N_]=Wr(ay,[oK,ld,ud]),Sm=ld(),M_=ud(),[aK,Tl]=kl(ay),[cK,cy]=kl(ay),D_=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:s,onOpenChange:i,modal:o=!0}=t,a=Sm(e),[c,l]=v.useState(null),u=v.useRef(!1),f=Gr(i),d=sy(s);return v.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),E.jsx(_S,{...a,children:E.jsx(aK,{scope:e,open:r,onOpenChange:f,content:c,onContentChange:l,children:E.jsx(cK,{scope:e,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:d,modal:o,children:n})})})};D_.displayName=ay;var lK="MenuAnchor",FS=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=Sm(r);return E.jsx(NS,{...s,...n,ref:e})});FS.displayName=lK;var US="MenuPortal",[uK,L_]=kl(US,{forceMount:void 0}),j_=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:s}=t,i=Tl(US,e);return E.jsx(uK,{scope:e,forceMount:r,children:E.jsx(cn,{present:r||i.open,children:E.jsx(oy,{asChild:!0,container:s,children:n})})})};j_.displayName=US;var fs="MenuContent",[fK,VS]=kl(fs),B_=v.forwardRef((t,e)=>{const r=L_(fs,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=Tl(fs,t.__scopeMenu),o=cy(fs,t.__scopeMenu);return E.jsx(Kh.Provider,{scope:t.__scopeMenu,children:E.jsx(cn,{present:n||i.open,children:E.jsx(Kh.Slot,{scope:t.__scopeMenu,children:o.modal?E.jsx(dK,{...s,ref:e}):E.jsx(hK,{...s,ref:e})})})})}),dK=v.forwardRef((t,e)=>{const r=Tl(fs,t.__scopeMenu),n=v.useRef(null),s=$e(e,n);return v.useEffect(()=>{const i=n.current;if(i)return BS(i)},[]),E.jsx($S,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),hK=v.forwardRef((t,e)=>{const r=Tl(fs,t.__scopeMenu);return E.jsx($S,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),$S=v.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:d,onDismiss:h,disableOutsideScroll:p,...y}=t,g=Tl(fs,r),m=cy(fs,r),x=Sm(r),b=M_(r),w=iK(r),[A,O]=v.useState(null),_=v.useRef(null),C=$e(e,_,g.onContentChange),j=v.useRef(0),V=v.useRef(""),B=v.useRef(0),z=v.useRef(null),Y=v.useRef("right"),H=v.useRef(0),L=p?Em:v.Fragment,T=p?{as:ll,allowPinchZoom:!0}:void 0,P=I=>{var U,F;const X=V.current+I,oe=w().filter(Be=>!Be.disabled),ae=document.activeElement,ke=(U=oe.find(Be=>Be.ref.current===ae))==null?void 0:U.textValue,ve=oe.map(Be=>Be.textValue),ie=AK(ve,X,ke),Me=(F=oe.find(Be=>Be.textValue===ie))==null?void 0:F.ref.current;(function Be(Te){V.current=Te,window.clearTimeout(j.current),Te!==""&&(j.current=window.setTimeout(()=>Be(""),1e3))})(X),Me&&setTimeout(()=>Me.focus())};v.useEffect(()=>()=>window.clearTimeout(j.current),[]),SS();const R=v.useCallback(I=>{var U,F;return Y.current===((U=z.current)==null?void 0:U.side)&&TK(I,(F=z.current)==null?void 0:F.area)},[]);return E.jsx(fK,{scope:r,searchRef:V,onItemEnter:v.useCallback(I=>{R(I)&&I.preventDefault()},[R]),onItemLeave:v.useCallback(I=>{var U;R(I)||((U=_.current)==null||U.focus(),O(null))},[R]),onTriggerLeave:v.useCallback(I=>{R(I)&&I.preventDefault()},[R]),pointerGraceTimerRef:B,onPointerGraceIntentChange:v.useCallback(I=>{z.current=I},[]),children:E.jsx(L,{...T,children:E.jsx(mm,{asChild:!0,trapped:s,onMountAutoFocus:ce(i,I=>{var U;I.preventDefault(),(U=_.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:E.jsx(od,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:d,onDismiss:h,children:E.jsx(LS,{asChild:!0,...b,dir:m.dir,orientation:"vertical",loop:n,currentTabStopId:A,onCurrentTabStopIdChange:O,onEntryFocus:ce(c,I=>{m.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:E.jsx(MS,{role:"menu","aria-orientation":"vertical","data-state":eN(g.open),"data-radix-menu-content":"",dir:m.dir,...x,...y,ref:C,style:{outline:"none",...y.style},onKeyDown:ce(y.onKeyDown,I=>{const F=I.target.closest("[data-radix-menu-content]")===I.currentTarget,X=I.ctrlKey||I.altKey||I.metaKey,oe=I.key.length===1;F&&(I.key==="Tab"&&I.preventDefault(),!X&&oe&&P(I.key));const ae=_.current;if(I.target!==ae||!rK.includes(I.key))return;I.preventDefault();const ve=w().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);__.includes(I.key)&&ve.reverse(),SK(ve)}),onBlur:ce(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(j.current),V.current="")}),onPointerMove:ce(t.onPointerMove,Qh(I=>{const U=I.target,F=H.current!==I.clientX;if(I.currentTarget.contains(U)&&F){const X=I.clientX>H.current?"right":"left";Y.current=X,H.current=I.clientX}}))})})})})})})});B_.displayName=fs;var pK="MenuGroup",zS=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return E.jsx(we.div,{role:"group",...n,ref:e})});zS.displayName=pK;var yK="MenuLabel",F_=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return E.jsx(we.div,{...n,ref:e})});F_.displayName=yK;var Zv="MenuItem",LR="menu.itemSelect",Cm=v.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...s}=t,i=v.useRef(null),o=cy(Zv,t.__scopeMenu),a=VS(Zv,t.__scopeMenu),c=$e(e,i),l=v.useRef(!1),u=()=>{const f=i.current;if(!r&&f){const d=new CustomEvent(LR,{bubbles:!0,cancelable:!0});f.addEventListener(LR,h=>n==null?void 0:n(h),{once:!0}),vS(f,d),d.defaultPrevented?l.current=!1:o.onClose()}};return E.jsx(U_,{...s,ref:c,disabled:r,onClick:ce(t.onClick,u),onPointerDown:f=>{var d;(d=t.onPointerDown)==null||d.call(t,f),l.current=!0},onPointerUp:ce(t.onPointerUp,f=>{var d;l.current||(d=f.currentTarget)==null||d.click()}),onKeyDown:ce(t.onKeyDown,f=>{const d=a.searchRef.current!=="";r||d&&f.key===" "||Aw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Cm.displayName=Zv;var U_=v.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=t,o=VS(Zv,r),a=M_(r),c=v.useRef(null),l=$e(e,c),[u,f]=v.useState(!1),[d,h]=v.useState("");return v.useEffect(()=>{const p=c.current;p&&h((p.textContent??"").trim())},[i.children]),E.jsx(Kh.ItemSlot,{scope:r,disabled:n,textValue:s??d,children:E.jsx(jS,{asChild:!0,...a,focusable:!n,children:E.jsx(we.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:ce(t.onPointerMove,Qh(p=>{n?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(t.onPointerLeave,Qh(p=>o.onItemLeave(p))),onFocus:ce(t.onFocus,()=>f(!0)),onBlur:ce(t.onBlur,()=>f(!1))})})})}),vK="MenuCheckboxItem",V_=v.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...s}=t;return E.jsx(q_,{scope:t.__scopeMenu,checked:r,children:E.jsx(Cm,{role:"menuitemcheckbox","aria-checked":e0(r)?"mixed":r,...s,ref:e,"data-state":GS(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(e0(r)?!0:!r),{checkForDefaultPrevented:!1})})})});V_.displayName=vK;var $_="MenuRadioGroup",[mK,gK]=kl($_,{value:void 0,onValueChange:()=>{}}),z_=v.forwardRef((t,e)=>{const{value:r,onValueChange:n,...s}=t,i=Gr(n);return E.jsx(mK,{scope:t.__scopeMenu,value:r,onValueChange:i,children:E.jsx(zS,{...s,ref:e})})});z_.displayName=$_;var H_="MenuRadioItem",G_=v.forwardRef((t,e)=>{const{value:r,...n}=t,s=gK(H_,t.__scopeMenu),i=r===s.value;return E.jsx(q_,{scope:t.__scopeMenu,checked:i,children:E.jsx(Cm,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":GS(i),onSelect:ce(n.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,r)},{checkForDefaultPrevented:!1})})})});G_.displayName=H_;var HS="MenuItemIndicator",[q_,xK]=kl(HS,{checked:!1}),W_=v.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...s}=t,i=xK(HS,r);return E.jsx(cn,{present:n||e0(i.checked)||i.checked===!0,children:E.jsx(we.span,{...s,ref:e,"data-state":GS(i.checked)})})});W_.displayName=HS;var bK="MenuSeparator",K_=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return E.jsx(we.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});K_.displayName=bK;var wK="MenuArrow",Q_=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=Sm(r);return E.jsx(DS,{...s,...n,ref:e})});Q_.displayName=wK;var EK="MenuSub",[O1e,Y_]=kl(EK),Kd="MenuSubTrigger",J_=v.forwardRef((t,e)=>{const r=Tl(Kd,t.__scopeMenu),n=cy(Kd,t.__scopeMenu),s=Y_(Kd,t.__scopeMenu),i=VS(Kd,t.__scopeMenu),o=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=i,l={__scopeMenu:t.__scopeMenu},u=v.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),E.jsx(FS,{asChild:!0,...l,children:E.jsx(U_,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":eN(r.open),...t,ref:hm(e,s.onTriggerChange),onClick:f=>{var d;(d=t.onClick)==null||d.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(t.onPointerMove,Qh(f=>{i.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!r.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100))})),onPointerLeave:ce(t.onPointerLeave,Qh(f=>{var d,h;u();const p=(d=r.content)==null?void 0:d.getBoundingClientRect();if(p){const y=(h=r.content)==null?void 0:h.dataset.side,g=y==="right",m=g?-5:5,x=p[g?"left":"right"],b=p[g?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+m,y:f.clientY},{x,y:p.top},{x:b,y:p.top},{x:b,y:p.bottom},{x,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ce(t.onKeyDown,f=>{var d;const h=i.searchRef.current!=="";t.disabled||h&&f.key===" "||nK[n.dir].includes(f.key)&&(r.onOpenChange(!0),(d=r.content)==null||d.focus(),f.preventDefault())})})})});J_.displayName=Kd;var X_="MenuSubContent",Z_=v.forwardRef((t,e)=>{const r=L_(fs,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=Tl(fs,t.__scopeMenu),o=cy(fs,t.__scopeMenu),a=Y_(X_,t.__scopeMenu),c=v.useRef(null),l=$e(e,c);return E.jsx(Kh.Provider,{scope:t.__scopeMenu,children:E.jsx(cn,{present:n||i.open,children:E.jsx(Kh.Slot,{scope:t.__scopeMenu,children:E.jsx($S,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:l,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ce(t.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ce(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:ce(t.onKeyDown,u=>{var f;const d=u.currentTarget.contains(u.target),h=sK[o.dir].includes(u.key);d&&h&&(i.onOpenChange(!1),(f=a.trigger)==null||f.focus(),u.preventDefault())})})})})})});Z_.displayName=X_;function eN(t){return t?"open":"closed"}function e0(t){return t==="indeterminate"}function GS(t){return e0(t)?"indeterminate":t?"checked":"unchecked"}function SK(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function CK(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function AK(t,e,r){const s=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=CK(t,Math.max(i,0));s.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function kK(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;in!=u>n&&r<(l-a)*(n-c)/(u-c)+a&&(s=!s)}return s}function TK(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return kK(r,e)}function Qh(t){return e=>e.pointerType==="mouse"?t(e):void 0}var PK=D_,RK=FS,IK=j_,OK=B_,_K=zS,NK=F_,MK=Cm,DK=V_,LK=z_,jK=G_,BK=W_,FK=K_,UK=Q_,VK=J_,$K=Z_,qS="DropdownMenu",[zK,_1e]=Wr(qS,[N_]),ln=N_(),[HK,tN]=zK(qS),GK=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:o,modal:a=!0}=t,c=ln(e),l=v.useRef(null),[u=!1,f]=ps({prop:s,defaultProp:i,onChange:o});return E.jsx(HK,{scope:e,triggerId:us(),triggerRef:l,contentId:us(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(d=>!d),[f]),modal:a,children:E.jsx(PK,{...c,open:u,onOpenChange:f,dir:n,modal:a,children:r})})};GK.displayName=qS;var rN="DropdownMenuTrigger",qK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=t,i=tN(rN,r),o=ln(r);return E.jsx(RK,{asChild:!0,...o,children:E.jsx(we.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:hm(e,i.triggerRef),onPointerDown:ce(t.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:ce(t.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});qK.displayName=rN;var WK="DropdownMenuPortal",KK=t=>{const{__scopeDropdownMenu:e,...r}=t,n=ln(e);return E.jsx(IK,{...n,...r})};KK.displayName=WK;var nN="DropdownMenuContent",QK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=tN(nN,r),i=ln(r),o=v.useRef(!1);return E.jsx(OK,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:e,onCloseAutoFocus:ce(t.onCloseAutoFocus,a=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:ce(t.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!s.modal||u)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});QK.displayName=nN;var YK="DropdownMenuGroup",JK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(_K,{...s,...n,ref:e})});JK.displayName=YK;var XK="DropdownMenuLabel",ZK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(NK,{...s,...n,ref:e})});ZK.displayName=XK;var eQ="DropdownMenuItem",tQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(MK,{...s,...n,ref:e})});tQ.displayName=eQ;var rQ="DropdownMenuCheckboxItem",sN=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(DK,{...s,...n,ref:e})});sN.displayName=rQ;var nQ="DropdownMenuRadioGroup",sQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(LK,{...s,...n,ref:e})});sQ.displayName=nQ;var iQ="DropdownMenuRadioItem",iN=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(jK,{...s,...n,ref:e})});iN.displayName=iQ;var oQ="DropdownMenuItemIndicator",oN=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(BK,{...s,...n,ref:e})});oN.displayName=oQ;var aQ="DropdownMenuSeparator",cQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(FK,{...s,...n,ref:e})});cQ.displayName=aQ;var lQ="DropdownMenuArrow",uQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(UK,{...s,...n,ref:e})});uQ.displayName=lQ;var fQ="DropdownMenuSubTrigger",dQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(VK,{...s,...n,ref:e})});dQ.displayName=fQ;var hQ="DropdownMenuSubContent",pQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx($K,{...s,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pQ.displayName=hQ;var yQ=sN,vQ=iN,aN=oN,cN="_1k2mbvi4 _1k2mbvi3 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1x4 fyvr1yk fyvr1ss fyvr1uo fyvr12ws fyvr12wm fyvr11h0 fyvr11ko fyvr11jw fyvr12v7 fyvr11n4 fyvr11hw fyvr12s7",lN="_1k2mbvi5";const mQ=({children:t})=>E.jsx(aN,{className:lN,children:t});v.forwardRef(({className:t,children:e,...r},n)=>E.jsxs(yQ,{className:qr(cN,t),...r,ref:n,children:[E.jsx(mQ,{children:E.jsx(gS,{size:"xs"})}),E.jsx(ue,{variant:"small",children:e})]}));v.forwardRef(({className:t,children:e,...r},n)=>E.jsxs(vQ,{className:qr(cN,t),...r,ref:n,children:[E.jsx(aN,{className:lN,children:E.jsx(ue,{children:"•"})}),E.jsx(ue,{variant:"small",children:e})]}));const Am=v.forwardRef((t,e)=>{const{icon:r,size:n="md",...s}=t;return E.jsx(ut,{leftIcon:r,size:n,flexShrink:"0",ref:e,...s})}),gQ=(...t)=>e=>t.forEach(r=>{r&&(typeof r=="function"?r(e):r.current=e)});var xQ="_1hq71vk1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _1hq71vk0 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8 fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr12n7 fyvr12fv fyvr1217 fyvr128j fyvr12np fyvr12gd fyvr121p fyvr1291 fyvr11ko fyvr11hc fyvr11ic fyvr11jc fyvr1g0 fyvr11hw",bQ=Nt({defaultClassName:"_1hq71vk5",variantClassNames:{borderRadius:{xs:"_1hq71vk6 _1hq71vk2 fyvr11cw fyvr11dk fyvr11bk fyvr11c8",sm:"_1hq71vk7 _1hq71vk3 fyvr11d0 fyvr11do fyvr11bo fyvr11cc",md:"_1hq71vk8 _1hq71vk4 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg"}},defaultVariants:{},compoundVariants:[]}),wQ="_1hq71vka _1hq71vk9 fyvr12wp fyvr12wj fyvr11ho fyvr12vj fyvr1ko fyvr1oo fyvr1mo fyvr1qo";const EQ={png:".png,image/png",jpeg:".jpeg,image/jpeg",jpg:".jpg,image/jpg",images:"image/*, video/*",pdf:".pdf,application/pdf",mp4:".mp4,video/mp4",csv:".csv,text/csv",json:".json,application/json"};v.forwardRef((t,e)=>{const{borderRadius:r="md",description:n,disabled:s=!1,id:i,label:o="",labelLocation:a="hidden",name:c,onValueChange:l,placeholder:u="Upload a file",validExtensions:f,...d}=t,h=v.useRef(null),p=gQ(h,e),[y,g]=v.useState(null),m=b=>{const w=b.currentTarget.files;if(!w||!w[0])return;const A=w[0],O=A.name,_=A.size/1e3;g({name:O,size:_,extension:O.split(".").pop()??""}),l==null||l(A)},x=f.map(b=>EQ[b]).join(",");return E.jsx(Al,{description:n,disabled:s,display:"grid",id:i??c,label:o,labelLocation:a,children:E.jsxs(q,{width:"full",minWidth:"0",justifyContent:y?"space-between":"flex-start",gap:"2",color:y?"text100":"text50",className:qr(xQ,bQ({borderRadius:r})),children:[y?E.jsxs(q,{flexDirection:"row",gap:"2",alignItems:"center",minWidth:"0",children:[E.jsx(ue,{ellipsis:!0,children:y.name}),E.jsxs(ue,{color:"text50",variant:"xsmall",whiteSpace:"nowrap",children:[y.size.toFixed(2)," kb"]})]}):E.jsx(ue,{ellipsis:!0,children:u}),E.jsx(q,{accept:x,as:"input",className:wQ,cursor:"pointer",disabled:s,id:i??c,name:c,onChange:m,ref:p,type:"file",...d}),y&&E.jsx(Am,{cursor:"pointer",icon:Gh,size:"xs",onClick:b=>{var w;b.preventDefault(),b.stopPropagation(),(w=h.current)!=null&&w.value&&(h.current.value=""),l==null||l(null),g(null)},zIndex:"10"})]})})});var SQ=Nt({defaultClassName:"_1bhyzin0",variantClassNames:{size:{xs:"_1bhyzin1",sm:"_1bhyzin2",md:"_1bhyzin3",lg:"_1bhyzin4",xl:"_1bhyzin5"}},defaultVariants:{},compoundVariants:[]});const kw=1e3,Pu=64,dx=Pu/2,hx=(t,e=kw)=>t%e/(kw/Pu),Ll=(t,e=0)=>{let r=3735928559^e,n=1103547991^e;for(let s=0,i;s>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)},CQ=(t,e,r)=>{const n=t%360,s=(t+120)%360,i=r%360;return{a:`hsl(${n}deg 100% 40%)`,b:`hsl(${s}deg 100% 50%)`,c:`hsl(${i}deg 100% 50%)`}},AQ=(t,e)=>{const r=[];for(let n=0;n{const i=Pu/10+hx(n.r,kw*1.5/(s+1));return{...CQ(n.a,n.b,n.c),x:hx(n.x),y:hx(n.y),r:i}})};v.memo(t=>{const{className:e,address:r,size:n="md",complexity:s=1,...i}=t,o=AQ(r,s);return E.jsxs(q,{as:"svg",className:qr(e,SQ({size:n})),viewBox:`0 0 ${Pu} ${Pu}`,version:"1.1",flexShrink:"0",borderRadius:"circle",overflow:"hidden",xmlns:"http://www.w3.org/2000/svg",...i,children:[E.jsxs("defs",{children:[E.jsx("clipPath",{id:"circle-clip",children:E.jsx("circle",{cx:dx,cy:dx,r:dx})}),E.jsxs("filter",{id:"blur",x:"-10%",y:"-10%",width:"120%",height:"120%",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[E.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),E.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),E.jsx("feGaussianBlur",{stdDeviation:Pu/10,result:"effect1_foregroundBlur"})]}),E.jsxs("linearGradient",{id:`gradient-background-${r}`,x1:"0",y1:"0",x2:"1",y2:"1",children:[E.jsx("stop",{offset:"0",stopColor:o[0].c}),E.jsx("stop",{offset:"1",stopColor:o[0].a})]}),o.map((a,c)=>E.jsxs(v.Fragment,{children:[E.jsxs("radialGradient",{id:`gradient-primary-${r}-${c}`,children:[E.jsx("stop",{offset:"0",stopColor:a.a}),E.jsx("stop",{offset:"1",stopColor:a.b})]}),E.jsxs("radialGradient",{id:`gradient-secondary-${r}-${c}`,children:[E.jsx("stop",{offset:"0",stopColor:a.c}),E.jsx("stop",{offset:"1",stopColor:a.b})]})]},c))]}),E.jsxs("g",{clipPath:"url(#circle-clip)",children:[E.jsx("rect",{width:"100%",height:"100%",fill:`url(#gradient-background-${r})`}),E.jsx("g",{filter:"url(#blur)",children:o.map((a,c)=>E.jsxs(v.Fragment,{children:[E.jsx("circle",{fill:`url(#gradient-primary-${r}-${c})`,cx:a.x,cy:a.y,r:a.r}),E.jsx("circle",{fill:`url(#gradient-secondary-${r}-${c})`,cx:a.y,cy:a.x,r:a.r/2})]},c))})]})]})});const uN=t=>{const{disableAnimation:e=!1,onLoad:r,...n}=t,[s,i]=v.useState(!1),o=a=>{i(!0),r==null||r(a)};return E.jsx(q,{as:Xc.img,initial:e?void 0:{opacity:0},animate:e?void 0:{opacity:s?1:0},transition:{duration:.2},onLoad:e?void 0:o,...n})};var WS="Dialog",[fN,N1e]=Wr(WS),[kQ,$s]=fN(WS),dN=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,a=v.useRef(null),c=v.useRef(null),[l=!1,u]=ps({prop:n,defaultProp:s,onChange:i});return E.jsx(kQ,{scope:e,triggerRef:a,contentRef:c,contentId:us(),titleId:us(),descriptionId:us(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(f=>!f),[u]),modal:o,children:r})};dN.displayName=WS;var hN="DialogTrigger",TQ=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(hN,r),i=$e(e,s.triggerRef);return E.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":YS(s.open),...n,ref:i,onClick:ce(t.onClick,s.onOpenToggle)})});TQ.displayName=hN;var KS="DialogPortal",[PQ,pN]=fN(KS,{forceMount:void 0}),yN=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,i=$s(KS,e);return E.jsx(PQ,{scope:e,forceMount:r,children:v.Children.map(n,o=>E.jsx(cn,{present:r||i.open,children:E.jsx(oy,{asChild:!0,container:s,children:o})}))})};yN.displayName=KS;var t0="DialogOverlay",vN=v.forwardRef((t,e)=>{const r=pN(t0,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=$s(t0,t.__scopeDialog);return i.modal?E.jsx(cn,{present:n||i.open,children:E.jsx(RQ,{...s,ref:e})}):null});vN.displayName=t0;var RQ=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(t0,r);return E.jsx(Em,{as:ll,allowPinchZoom:!0,shards:[s.contentRef],children:E.jsx(we.div,{"data-state":YS(s.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),fl="DialogContent",mN=v.forwardRef((t,e)=>{const r=pN(fl,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=$s(fl,t.__scopeDialog);return E.jsx(cn,{present:n||i.open,children:i.modal?E.jsx(IQ,{...s,ref:e}):E.jsx(OQ,{...s,ref:e})})});mN.displayName=fl;var IQ=v.forwardRef((t,e)=>{const r=$s(fl,t.__scopeDialog),n=v.useRef(null),s=$e(e,r.contentRef,n);return v.useEffect(()=>{const i=n.current;if(i)return BS(i)},[]),E.jsx(gN,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ce(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:ce(t.onFocusOutside,i=>i.preventDefault())})}),OQ=v.forwardRef((t,e)=>{const r=$s(fl,t.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return E.jsx(gN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var o,a;(o=t.onInteractOutside)==null||o.call(t,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=i.target;((a=r.triggerRef.current)==null?void 0:a.contains(c))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),gN=v.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=t,a=$s(fl,r),c=v.useRef(null),l=$e(e,c);return SS(),E.jsxs(E.Fragment,{children:[E.jsx(mm,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:E.jsx(od,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":YS(a.open),...o,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),E.jsxs(E.Fragment,{children:[E.jsx(MQ,{titleId:a.titleId}),E.jsx(LQ,{contentRef:c,descriptionId:a.descriptionId})]})]})}),QS="DialogTitle",_Q=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(QS,r);return E.jsx(we.h2,{id:s.titleId,...n,ref:e})});_Q.displayName=QS;var xN="DialogDescription",NQ=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(xN,r);return E.jsx(we.p,{id:s.descriptionId,...n,ref:e})});NQ.displayName=xN;var bN="DialogClose",wN=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(bN,r);return E.jsx(we.button,{type:"button",...n,ref:e,onClick:ce(t.onClick,()=>s.onOpenChange(!1))})});wN.displayName=bN;function YS(t){return t?"open":"closed"}var EN="DialogTitleWarning",[M1e,SN]=XH(EN,{contentName:fl,titleName:QS,docsSlug:"dialog"}),MQ=({titleId:t})=>{const e=SN(EN),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. +`)},JW=0,Dl=[];function XW(t){var e=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(JW++)[0],i=v.useState(P_)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var y=xW([t.lockRef.current],(t.shards||[]).map(DR),!0).filter(Boolean);return y.forEach(function(g){return g.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),y.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var a=v.useCallback(function(y,g){if("touches"in y&&y.touches.length===2)return!o.current.allowPinchZoom;var m=a1(y),x=r.current,b="deltaX"in y?y.deltaX:x[0]-m[0],w="deltaY"in y?y.deltaY:x[1]-m[1],A,O=y.target,_=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in y&&_==="h"&&O.type==="range")return!1;var C=NR(_,O);if(!C)return!0;if(C?A=_:(A=_==="v"?"h":"v",C=NR(_,O)),!C)return!1;if(!n.current&&"changedTouches"in y&&(b||w)&&(n.current=A),!A)return!0;var j=n.current||A;return KW(j,g,y,j==="h"?b:w,!0)},[]),c=v.useCallback(function(y){var g=y;if(!(!Dl.length||Dl[Dl.length-1]!==i)){var m="deltaY"in g?MR(g):a1(g),x=e.current.filter(function(A){return A.name===g.type&&(A.target===g.target||g.target===A.shadowParent)&&QW(A.delta,m)})[0];if(x&&x.should){g.cancelable&&g.preventDefault();return}if(!x){var b=(o.current.shards||[]).map(DR).filter(Boolean).filter(function(A){return A.contains(g.target)}),w=b.length>0?a(g,b[0]):!o.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),l=v.useCallback(function(y,g,m,x){var b={name:y,delta:g,target:m,should:x,shadowParent:ZW(m)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(w){return w!==b})},1)},[]),u=v.useCallback(function(y){r.current=a1(y),n.current=void 0},[]),f=v.useCallback(function(y){l(y.type,MR(y),y.target,a(y,t.lockRef.current))},[]),d=v.useCallback(function(y){l(y.type,a1(y),y.target,a(y,t.lockRef.current))},[]);v.useEffect(function(){return Dl.push(i),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",c,Ml),document.addEventListener("touchmove",c,Ml),document.addEventListener("touchstart",u,Ml),function(){Dl=Dl.filter(function(y){return y!==i}),document.removeEventListener("wheel",c,Ml),document.removeEventListener("touchmove",c,Ml),document.removeEventListener("touchstart",u,Ml)}},[]);var h=t.removeScrollBar,p=t.inert;return v.createElement(v.Fragment,null,p?v.createElement(i,{styles:YW(s)}):null,h?v.createElement(VW,{gapMode:t.gapMode}):null)}function ZW(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const eK=PW(T_,XW);var Em=v.forwardRef(function(t,e){return v.createElement(wm,ci({},t,{ref:e,sideCar:eK}))});Em.classNames=wm.classNames;var Aw=["Enter"," "],tK=["ArrowDown","PageUp","Home"],__=["ArrowUp","PageDown","End"],rK=[...tK,...__],nK={ltr:[...Aw,"ArrowRight"],rtl:[...Aw,"ArrowLeft"]},sK={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ay="Menu",[Kh,iK,oK]=vm(ay),[kl,N_]=Wr(ay,[oK,ld,ud]),Sm=ld(),M_=ud(),[aK,Tl]=kl(ay),[cK,cy]=kl(ay),D_=t=>{const{__scopeMenu:e,open:r=!1,children:n,dir:s,onOpenChange:i,modal:o=!0}=t,a=Sm(e),[c,l]=v.useState(null),u=v.useRef(!1),f=Gr(i),d=sy(s);return v.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),E.jsx(_S,{...a,children:E.jsx(aK,{scope:e,open:r,onOpenChange:f,content:c,onContentChange:l,children:E.jsx(cK,{scope:e,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:d,modal:o,children:n})})})};D_.displayName=ay;var lK="MenuAnchor",FS=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=Sm(r);return E.jsx(NS,{...s,...n,ref:e})});FS.displayName=lK;var US="MenuPortal",[uK,L_]=kl(US,{forceMount:void 0}),j_=t=>{const{__scopeMenu:e,forceMount:r,children:n,container:s}=t,i=Tl(US,e);return E.jsx(uK,{scope:e,forceMount:r,children:E.jsx(cn,{present:r||i.open,children:E.jsx(oy,{asChild:!0,container:s,children:n})})})};j_.displayName=US;var fs="MenuContent",[fK,VS]=kl(fs),B_=v.forwardRef((t,e)=>{const r=L_(fs,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=Tl(fs,t.__scopeMenu),o=cy(fs,t.__scopeMenu);return E.jsx(Kh.Provider,{scope:t.__scopeMenu,children:E.jsx(cn,{present:n||i.open,children:E.jsx(Kh.Slot,{scope:t.__scopeMenu,children:o.modal?E.jsx(dK,{...s,ref:e}):E.jsx(hK,{...s,ref:e})})})})}),dK=v.forwardRef((t,e)=>{const r=Tl(fs,t.__scopeMenu),n=v.useRef(null),s=$e(e,n);return v.useEffect(()=>{const i=n.current;if(i)return BS(i)},[]),E.jsx($S,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),hK=v.forwardRef((t,e)=>{const r=Tl(fs,t.__scopeMenu);return E.jsx($S,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),$S=v.forwardRef((t,e)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:d,onDismiss:h,disableOutsideScroll:p,...y}=t,g=Tl(fs,r),m=cy(fs,r),x=Sm(r),b=M_(r),w=iK(r),[A,O]=v.useState(null),_=v.useRef(null),C=$e(e,_,g.onContentChange),j=v.useRef(0),V=v.useRef(""),B=v.useRef(0),z=v.useRef(null),Y=v.useRef("right"),H=v.useRef(0),L=p?Em:v.Fragment,T=p?{as:ll,allowPinchZoom:!0}:void 0,P=I=>{var U,F;const X=V.current+I,oe=w().filter(Be=>!Be.disabled),ae=document.activeElement,ke=(U=oe.find(Be=>Be.ref.current===ae))==null?void 0:U.textValue,ve=oe.map(Be=>Be.textValue),ie=AK(ve,X,ke),Me=(F=oe.find(Be=>Be.textValue===ie))==null?void 0:F.ref.current;(function Be(Te){V.current=Te,window.clearTimeout(j.current),Te!==""&&(j.current=window.setTimeout(()=>Be(""),1e3))})(X),Me&&setTimeout(()=>Me.focus())};v.useEffect(()=>()=>window.clearTimeout(j.current),[]),SS();const R=v.useCallback(I=>{var U,F;return Y.current===((U=z.current)==null?void 0:U.side)&&TK(I,(F=z.current)==null?void 0:F.area)},[]);return E.jsx(fK,{scope:r,searchRef:V,onItemEnter:v.useCallback(I=>{R(I)&&I.preventDefault()},[R]),onItemLeave:v.useCallback(I=>{var U;R(I)||((U=_.current)==null||U.focus(),O(null))},[R]),onTriggerLeave:v.useCallback(I=>{R(I)&&I.preventDefault()},[R]),pointerGraceTimerRef:B,onPointerGraceIntentChange:v.useCallback(I=>{z.current=I},[]),children:E.jsx(L,{...T,children:E.jsx(mm,{asChild:!0,trapped:s,onMountAutoFocus:ce(i,I=>{var U;I.preventDefault(),(U=_.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:E.jsx(od,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:d,onDismiss:h,children:E.jsx(LS,{asChild:!0,...b,dir:m.dir,orientation:"vertical",loop:n,currentTabStopId:A,onCurrentTabStopIdChange:O,onEntryFocus:ce(c,I=>{m.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:E.jsx(MS,{role:"menu","aria-orientation":"vertical","data-state":eN(g.open),"data-radix-menu-content":"",dir:m.dir,...x,...y,ref:C,style:{outline:"none",...y.style},onKeyDown:ce(y.onKeyDown,I=>{const F=I.target.closest("[data-radix-menu-content]")===I.currentTarget,X=I.ctrlKey||I.altKey||I.metaKey,oe=I.key.length===1;F&&(I.key==="Tab"&&I.preventDefault(),!X&&oe&&P(I.key));const ae=_.current;if(I.target!==ae||!rK.includes(I.key))return;I.preventDefault();const ve=w().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);__.includes(I.key)&&ve.reverse(),SK(ve)}),onBlur:ce(t.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(j.current),V.current="")}),onPointerMove:ce(t.onPointerMove,Qh(I=>{const U=I.target,F=H.current!==I.clientX;if(I.currentTarget.contains(U)&&F){const X=I.clientX>H.current?"right":"left";Y.current=X,H.current=I.clientX}}))})})})})})})});B_.displayName=fs;var pK="MenuGroup",zS=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return E.jsx(we.div,{role:"group",...n,ref:e})});zS.displayName=pK;var yK="MenuLabel",F_=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return E.jsx(we.div,{...n,ref:e})});F_.displayName=yK;var Zv="MenuItem",LR="menu.itemSelect",Cm=v.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...s}=t,i=v.useRef(null),o=cy(Zv,t.__scopeMenu),a=VS(Zv,t.__scopeMenu),c=$e(e,i),l=v.useRef(!1),u=()=>{const f=i.current;if(!r&&f){const d=new CustomEvent(LR,{bubbles:!0,cancelable:!0});f.addEventListener(LR,h=>n==null?void 0:n(h),{once:!0}),vS(f,d),d.defaultPrevented?l.current=!1:o.onClose()}};return E.jsx(U_,{...s,ref:c,disabled:r,onClick:ce(t.onClick,u),onPointerDown:f=>{var d;(d=t.onPointerDown)==null||d.call(t,f),l.current=!0},onPointerUp:ce(t.onPointerUp,f=>{var d;l.current||(d=f.currentTarget)==null||d.click()}),onKeyDown:ce(t.onKeyDown,f=>{const d=a.searchRef.current!=="";r||d&&f.key===" "||Aw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Cm.displayName=Zv;var U_=v.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=t,o=VS(Zv,r),a=M_(r),c=v.useRef(null),l=$e(e,c),[u,f]=v.useState(!1),[d,h]=v.useState("");return v.useEffect(()=>{const p=c.current;p&&h((p.textContent??"").trim())},[i.children]),E.jsx(Kh.ItemSlot,{scope:r,disabled:n,textValue:s??d,children:E.jsx(jS,{asChild:!0,...a,focusable:!n,children:E.jsx(we.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:ce(t.onPointerMove,Qh(p=>{n?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(t.onPointerLeave,Qh(p=>o.onItemLeave(p))),onFocus:ce(t.onFocus,()=>f(!0)),onBlur:ce(t.onBlur,()=>f(!1))})})})}),vK="MenuCheckboxItem",V_=v.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...s}=t;return E.jsx(q_,{scope:t.__scopeMenu,checked:r,children:E.jsx(Cm,{role:"menuitemcheckbox","aria-checked":e0(r)?"mixed":r,...s,ref:e,"data-state":GS(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(e0(r)?!0:!r),{checkForDefaultPrevented:!1})})})});V_.displayName=vK;var $_="MenuRadioGroup",[mK,gK]=kl($_,{value:void 0,onValueChange:()=>{}}),z_=v.forwardRef((t,e)=>{const{value:r,onValueChange:n,...s}=t,i=Gr(n);return E.jsx(mK,{scope:t.__scopeMenu,value:r,onValueChange:i,children:E.jsx(zS,{...s,ref:e})})});z_.displayName=$_;var H_="MenuRadioItem",G_=v.forwardRef((t,e)=>{const{value:r,...n}=t,s=gK(H_,t.__scopeMenu),i=r===s.value;return E.jsx(q_,{scope:t.__scopeMenu,checked:i,children:E.jsx(Cm,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":GS(i),onSelect:ce(n.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,r)},{checkForDefaultPrevented:!1})})})});G_.displayName=H_;var HS="MenuItemIndicator",[q_,xK]=kl(HS,{checked:!1}),W_=v.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...s}=t,i=xK(HS,r);return E.jsx(cn,{present:n||e0(i.checked)||i.checked===!0,children:E.jsx(we.span,{...s,ref:e,"data-state":GS(i.checked)})})});W_.displayName=HS;var bK="MenuSeparator",K_=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t;return E.jsx(we.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});K_.displayName=bK;var wK="MenuArrow",Q_=v.forwardRef((t,e)=>{const{__scopeMenu:r,...n}=t,s=Sm(r);return E.jsx(DS,{...s,...n,ref:e})});Q_.displayName=wK;var EK="MenuSub",[N1e,Y_]=kl(EK),Kd="MenuSubTrigger",J_=v.forwardRef((t,e)=>{const r=Tl(Kd,t.__scopeMenu),n=cy(Kd,t.__scopeMenu),s=Y_(Kd,t.__scopeMenu),i=VS(Kd,t.__scopeMenu),o=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=i,l={__scopeMenu:t.__scopeMenu},u=v.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return v.useEffect(()=>u,[u]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),E.jsx(FS,{asChild:!0,...l,children:E.jsx(U_,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":eN(r.open),...t,ref:hm(e,s.onTriggerChange),onClick:f=>{var d;(d=t.onClick)==null||d.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(t.onPointerMove,Qh(f=>{i.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!r.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100))})),onPointerLeave:ce(t.onPointerLeave,Qh(f=>{var d,h;u();const p=(d=r.content)==null?void 0:d.getBoundingClientRect();if(p){const y=(h=r.content)==null?void 0:h.dataset.side,g=y==="right",m=g?-5:5,x=p[g?"left":"right"],b=p[g?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+m,y:f.clientY},{x,y:p.top},{x:b,y:p.top},{x:b,y:p.bottom},{x,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ce(t.onKeyDown,f=>{var d;const h=i.searchRef.current!=="";t.disabled||h&&f.key===" "||nK[n.dir].includes(f.key)&&(r.onOpenChange(!0),(d=r.content)==null||d.focus(),f.preventDefault())})})})});J_.displayName=Kd;var X_="MenuSubContent",Z_=v.forwardRef((t,e)=>{const r=L_(fs,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,i=Tl(fs,t.__scopeMenu),o=cy(fs,t.__scopeMenu),a=Y_(X_,t.__scopeMenu),c=v.useRef(null),l=$e(e,c);return E.jsx(Kh.Provider,{scope:t.__scopeMenu,children:E.jsx(cn,{present:n||i.open,children:E.jsx(Kh.Slot,{scope:t.__scopeMenu,children:E.jsx($S,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:l,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:ce(t.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ce(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:ce(t.onKeyDown,u=>{var f;const d=u.currentTarget.contains(u.target),h=sK[o.dir].includes(u.key);d&&h&&(i.onOpenChange(!1),(f=a.trigger)==null||f.focus(),u.preventDefault())})})})})})});Z_.displayName=X_;function eN(t){return t?"open":"closed"}function e0(t){return t==="indeterminate"}function GS(t){return e0(t)?"indeterminate":t?"checked":"unchecked"}function SK(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function CK(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function AK(t,e,r){const s=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=CK(t,Math.max(i,0));s.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function kK(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;in!=u>n&&r<(l-a)*(n-c)/(u-c)+a&&(s=!s)}return s}function TK(t,e){if(!e)return!1;const r={x:t.clientX,y:t.clientY};return kK(r,e)}function Qh(t){return e=>e.pointerType==="mouse"?t(e):void 0}var PK=D_,RK=FS,IK=j_,OK=B_,_K=zS,NK=F_,MK=Cm,DK=V_,LK=z_,jK=G_,BK=W_,FK=K_,UK=Q_,VK=J_,$K=Z_,qS="DropdownMenu",[zK,M1e]=Wr(qS,[N_]),ln=N_(),[HK,tN]=zK(qS),GK=t=>{const{__scopeDropdownMenu:e,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:o,modal:a=!0}=t,c=ln(e),l=v.useRef(null),[u=!1,f]=ps({prop:s,defaultProp:i,onChange:o});return E.jsx(HK,{scope:e,triggerId:us(),triggerRef:l,contentId:us(),open:u,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(d=>!d),[f]),modal:a,children:E.jsx(PK,{...c,open:u,onOpenChange:f,dir:n,modal:a,children:r})})};GK.displayName=qS;var rN="DropdownMenuTrigger",qK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=t,i=tN(rN,r),o=ln(r);return E.jsx(RK,{asChild:!0,...o,children:E.jsx(we.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:hm(e,i.triggerRef),onPointerDown:ce(t.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:ce(t.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});qK.displayName=rN;var WK="DropdownMenuPortal",KK=t=>{const{__scopeDropdownMenu:e,...r}=t,n=ln(e);return E.jsx(IK,{...n,...r})};KK.displayName=WK;var nN="DropdownMenuContent",QK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=tN(nN,r),i=ln(r),o=v.useRef(!1);return E.jsx(OK,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:e,onCloseAutoFocus:ce(t.onCloseAutoFocus,a=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:ce(t.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;(!s.modal||u)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});QK.displayName=nN;var YK="DropdownMenuGroup",JK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(_K,{...s,...n,ref:e})});JK.displayName=YK;var XK="DropdownMenuLabel",ZK=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(NK,{...s,...n,ref:e})});ZK.displayName=XK;var eQ="DropdownMenuItem",tQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(MK,{...s,...n,ref:e})});tQ.displayName=eQ;var rQ="DropdownMenuCheckboxItem",sN=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(DK,{...s,...n,ref:e})});sN.displayName=rQ;var nQ="DropdownMenuRadioGroup",sQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(LK,{...s,...n,ref:e})});sQ.displayName=nQ;var iQ="DropdownMenuRadioItem",iN=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(jK,{...s,...n,ref:e})});iN.displayName=iQ;var oQ="DropdownMenuItemIndicator",oN=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(BK,{...s,...n,ref:e})});oN.displayName=oQ;var aQ="DropdownMenuSeparator",cQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(FK,{...s,...n,ref:e})});cQ.displayName=aQ;var lQ="DropdownMenuArrow",uQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(UK,{...s,...n,ref:e})});uQ.displayName=lQ;var fQ="DropdownMenuSubTrigger",dQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx(VK,{...s,...n,ref:e})});dQ.displayName=fQ;var hQ="DropdownMenuSubContent",pQ=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,s=ln(r);return E.jsx($K,{...s,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pQ.displayName=hQ;var yQ=sN,vQ=iN,aN=oN,cN="_1k2mbvi4 _1k2mbvi3 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1x4 fyvr1yk fyvr1ss fyvr1uo fyvr12ws fyvr12wm fyvr11h0 fyvr11ko fyvr11jw fyvr12v7 fyvr11n4 fyvr11hw fyvr12s7",lN="_1k2mbvi5";const mQ=({children:t})=>E.jsx(aN,{className:lN,children:t});v.forwardRef(({className:t,children:e,...r},n)=>E.jsxs(yQ,{className:qr(cN,t),...r,ref:n,children:[E.jsx(mQ,{children:E.jsx(gS,{size:"xs"})}),E.jsx(ue,{variant:"small",children:e})]}));v.forwardRef(({className:t,children:e,...r},n)=>E.jsxs(vQ,{className:qr(cN,t),...r,ref:n,children:[E.jsx(aN,{className:lN,children:E.jsx(ue,{children:"•"})}),E.jsx(ue,{variant:"small",children:e})]}));const Am=v.forwardRef((t,e)=>{const{icon:r,size:n="md",...s}=t;return E.jsx(ut,{leftIcon:r,size:n,flexShrink:"0",ref:e,...s})}),gQ=(...t)=>e=>t.forEach(r=>{r&&(typeof r=="function"?r(e):r.current=e)});var xQ="_1hq71vk1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _1hq71vk0 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8 fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr12n7 fyvr12fv fyvr1217 fyvr128j fyvr12np fyvr12gd fyvr121p fyvr1291 fyvr11ko fyvr11hc fyvr11ic fyvr11jc fyvr1g0 fyvr11hw",bQ=Nt({defaultClassName:"_1hq71vk5",variantClassNames:{borderRadius:{xs:"_1hq71vk6 _1hq71vk2 fyvr11cw fyvr11dk fyvr11bk fyvr11c8",sm:"_1hq71vk7 _1hq71vk3 fyvr11d0 fyvr11do fyvr11bo fyvr11cc",md:"_1hq71vk8 _1hq71vk4 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg"}},defaultVariants:{},compoundVariants:[]}),wQ="_1hq71vka _1hq71vk9 fyvr12wp fyvr12wj fyvr11ho fyvr12vj fyvr1ko fyvr1oo fyvr1mo fyvr1qo";const EQ={png:".png,image/png",jpeg:".jpeg,image/jpeg",jpg:".jpg,image/jpg",images:"image/*, video/*",pdf:".pdf,application/pdf",mp4:".mp4,video/mp4",csv:".csv,text/csv",json:".json,application/json"};v.forwardRef((t,e)=>{const{borderRadius:r="md",description:n,disabled:s=!1,id:i,label:o="",labelLocation:a="hidden",name:c,onValueChange:l,placeholder:u="Upload a file",validExtensions:f,...d}=t,h=v.useRef(null),p=gQ(h,e),[y,g]=v.useState(null),m=b=>{const w=b.currentTarget.files;if(!w||!w[0])return;const A=w[0],O=A.name,_=A.size/1e3;g({name:O,size:_,extension:O.split(".").pop()??""}),l==null||l(A)},x=f.map(b=>EQ[b]).join(",");return E.jsx(Al,{description:n,disabled:s,display:"grid",id:i??c,label:o,labelLocation:a,children:E.jsxs(q,{width:"full",minWidth:"0",justifyContent:y?"space-between":"flex-start",gap:"2",color:y?"text100":"text50",className:qr(xQ,bQ({borderRadius:r})),children:[y?E.jsxs(q,{flexDirection:"row",gap:"2",alignItems:"center",minWidth:"0",children:[E.jsx(ue,{ellipsis:!0,children:y.name}),E.jsxs(ue,{color:"text50",variant:"xsmall",whiteSpace:"nowrap",children:[y.size.toFixed(2)," kb"]})]}):E.jsx(ue,{ellipsis:!0,children:u}),E.jsx(q,{accept:x,as:"input",className:wQ,cursor:"pointer",disabled:s,id:i??c,name:c,onChange:m,ref:p,type:"file",...d}),y&&E.jsx(Am,{cursor:"pointer",icon:Gh,size:"xs",onClick:b=>{var w;b.preventDefault(),b.stopPropagation(),(w=h.current)!=null&&w.value&&(h.current.value=""),l==null||l(null),g(null)},zIndex:"10"})]})})});var SQ=Nt({defaultClassName:"_1bhyzin0",variantClassNames:{size:{xs:"_1bhyzin1",sm:"_1bhyzin2",md:"_1bhyzin3",lg:"_1bhyzin4",xl:"_1bhyzin5"}},defaultVariants:{},compoundVariants:[]});const kw=1e3,Pu=64,dx=Pu/2,hx=(t,e=kw)=>t%e/(kw/Pu),Ll=(t,e=0)=>{let r=3735928559^e,n=1103547991^e;for(let s=0,i;s>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)},CQ=(t,e,r)=>{const n=t%360,s=(t+120)%360,i=r%360;return{a:`hsl(${n}deg 100% 40%)`,b:`hsl(${s}deg 100% 50%)`,c:`hsl(${i}deg 100% 50%)`}},AQ=(t,e)=>{const r=[];for(let n=0;n{const i=Pu/10+hx(n.r,kw*1.5/(s+1));return{...CQ(n.a,n.b,n.c),x:hx(n.x),y:hx(n.y),r:i}})};v.memo(t=>{const{className:e,address:r,size:n="md",complexity:s=1,...i}=t,o=AQ(r,s);return E.jsxs(q,{as:"svg",className:qr(e,SQ({size:n})),viewBox:`0 0 ${Pu} ${Pu}`,version:"1.1",flexShrink:"0",borderRadius:"circle",overflow:"hidden",xmlns:"http://www.w3.org/2000/svg",...i,children:[E.jsxs("defs",{children:[E.jsx("clipPath",{id:"circle-clip",children:E.jsx("circle",{cx:dx,cy:dx,r:dx})}),E.jsxs("filter",{id:"blur",x:"-10%",y:"-10%",width:"120%",height:"120%",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[E.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),E.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),E.jsx("feGaussianBlur",{stdDeviation:Pu/10,result:"effect1_foregroundBlur"})]}),E.jsxs("linearGradient",{id:`gradient-background-${r}`,x1:"0",y1:"0",x2:"1",y2:"1",children:[E.jsx("stop",{offset:"0",stopColor:o[0].c}),E.jsx("stop",{offset:"1",stopColor:o[0].a})]}),o.map((a,c)=>E.jsxs(v.Fragment,{children:[E.jsxs("radialGradient",{id:`gradient-primary-${r}-${c}`,children:[E.jsx("stop",{offset:"0",stopColor:a.a}),E.jsx("stop",{offset:"1",stopColor:a.b})]}),E.jsxs("radialGradient",{id:`gradient-secondary-${r}-${c}`,children:[E.jsx("stop",{offset:"0",stopColor:a.c}),E.jsx("stop",{offset:"1",stopColor:a.b})]})]},c))]}),E.jsxs("g",{clipPath:"url(#circle-clip)",children:[E.jsx("rect",{width:"100%",height:"100%",fill:`url(#gradient-background-${r})`}),E.jsx("g",{filter:"url(#blur)",children:o.map((a,c)=>E.jsxs(v.Fragment,{children:[E.jsx("circle",{fill:`url(#gradient-primary-${r}-${c})`,cx:a.x,cy:a.y,r:a.r}),E.jsx("circle",{fill:`url(#gradient-secondary-${r}-${c})`,cx:a.y,cy:a.x,r:a.r/2})]},c))})]})]})});const uN=t=>{const{disableAnimation:e=!1,onLoad:r,...n}=t,[s,i]=v.useState(!1),o=a=>{i(!0),r==null||r(a)};return E.jsx(q,{as:Xc.img,initial:e?void 0:{opacity:0},animate:e?void 0:{opacity:s?1:0},transition:{duration:.2},onLoad:e?void 0:o,...n})};var WS="Dialog",[fN,D1e]=Wr(WS),[kQ,$s]=fN(WS),dN=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,a=v.useRef(null),c=v.useRef(null),[l=!1,u]=ps({prop:n,defaultProp:s,onChange:i});return E.jsx(kQ,{scope:e,triggerRef:a,contentRef:c,contentId:us(),titleId:us(),descriptionId:us(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(f=>!f),[u]),modal:o,children:r})};dN.displayName=WS;var hN="DialogTrigger",TQ=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(hN,r),i=$e(e,s.triggerRef);return E.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":YS(s.open),...n,ref:i,onClick:ce(t.onClick,s.onOpenToggle)})});TQ.displayName=hN;var KS="DialogPortal",[PQ,pN]=fN(KS,{forceMount:void 0}),yN=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:s}=t,i=$s(KS,e);return E.jsx(PQ,{scope:e,forceMount:r,children:v.Children.map(n,o=>E.jsx(cn,{present:r||i.open,children:E.jsx(oy,{asChild:!0,container:s,children:o})}))})};yN.displayName=KS;var t0="DialogOverlay",vN=v.forwardRef((t,e)=>{const r=pN(t0,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=$s(t0,t.__scopeDialog);return i.modal?E.jsx(cn,{present:n||i.open,children:E.jsx(RQ,{...s,ref:e})}):null});vN.displayName=t0;var RQ=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(t0,r);return E.jsx(Em,{as:ll,allowPinchZoom:!0,shards:[s.contentRef],children:E.jsx(we.div,{"data-state":YS(s.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),fl="DialogContent",mN=v.forwardRef((t,e)=>{const r=pN(fl,t.__scopeDialog),{forceMount:n=r.forceMount,...s}=t,i=$s(fl,t.__scopeDialog);return E.jsx(cn,{present:n||i.open,children:i.modal?E.jsx(IQ,{...s,ref:e}):E.jsx(OQ,{...s,ref:e})})});mN.displayName=fl;var IQ=v.forwardRef((t,e)=>{const r=$s(fl,t.__scopeDialog),n=v.useRef(null),s=$e(e,r.contentRef,n);return v.useEffect(()=>{const i=n.current;if(i)return BS(i)},[]),E.jsx(gN,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ce(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:ce(t.onFocusOutside,i=>i.preventDefault())})}),OQ=v.forwardRef((t,e)=>{const r=$s(fl,t.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return E.jsx(gN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),i.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:i=>{var o,a;(o=t.onInteractOutside)==null||o.call(t,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=i.target;((a=r.triggerRef.current)==null?void 0:a.contains(c))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),gN=v.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=t,a=$s(fl,r),c=v.useRef(null),l=$e(e,c);return SS(),E.jsxs(E.Fragment,{children:[E.jsx(mm,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:E.jsx(od,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":YS(a.open),...o,ref:l,onDismiss:()=>a.onOpenChange(!1)})}),E.jsxs(E.Fragment,{children:[E.jsx(MQ,{titleId:a.titleId}),E.jsx(LQ,{contentRef:c,descriptionId:a.descriptionId})]})]})}),QS="DialogTitle",_Q=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(QS,r);return E.jsx(we.h2,{id:s.titleId,...n,ref:e})});_Q.displayName=QS;var xN="DialogDescription",NQ=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(xN,r);return E.jsx(we.p,{id:s.descriptionId,...n,ref:e})});NQ.displayName=xN;var bN="DialogClose",wN=v.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,s=$s(bN,r);return E.jsx(we.button,{type:"button",...n,ref:e,onClick:ce(t.onClick,()=>s.onOpenChange(!1))})});wN.displayName=bN;function YS(t){return t?"open":"closed"}var EN="DialogTitleWarning",[L1e,SN]=XH(EN,{contentName:fl,titleName:QS,docsSlug:"dialog"}),MQ=({titleId:t})=>{const e=SN(EN),r=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},DQ="DialogDescriptionWarning",LQ=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${SN(DQ).contentName}}.`;return v.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},jQ=dN,BQ=yN,FQ=vN,UQ=mN,VQ=wN,$Q=Nt({defaultClassName:"_1vqx0w91 _1vqx0w90 fyvr128 fyvr15o",variantClassNames:{direction:{vertical:"_1vqx0w92",horizontal:"_1vqx0w93"}},defaultVariants:{},compoundVariants:[]}),zQ=Nt({defaultClassName:"_1vqx0w94",variantClassNames:{shadows:{true:"_1vqx0w95",false:"_1vqx0w96"},direction:{vertical:"_1vqx0w97",horizontal:"_1vqx0w98"}},defaultVariants:{},compoundVariants:[]});const HQ=t=>{const{children:e,shadows:r=!0,direction:n="vertical",contentProps:s,...i}=t;return E.jsx(q,{className:zQ({direction:n,shadows:r}),position:"relative",width:"full",height:"full",...i,children:E.jsx(q,{className:$Q({direction:n}),background:"backgroundPrimary",...s,children:e})})};function GQ(t){var e=t.match(/^var\((.*)\)$/);return e?e[1]:t}function qQ(t,e){var r=t;for(var n of e){if(!(n in r))throw new Error("Path ".concat(e.join(" -> ")," does not exist in object"));r=r[n]}return r}function CN(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n={};for(var s in t){var i=t[s],o=[...r,s];typeof i=="string"||typeof i=="number"||i==null?n[s]=e(i,o):typeof i=="object"&&!Array.isArray(i)?n[s]=CN(i,e,o):console.warn('Skipping invalid key "'.concat(o.join("."),'". Should be a string, number, null or object. Received: "').concat(Array.isArray(i)?"Array":typeof i,'"'))}return n}function jR(t,e,r){t.style.setProperty(GQ(e),r)}function BR(t,e,r){if(typeof r=="object"){var n=e;CN(r,(a,c)=>{a!=null&&jR(t,qQ(n,c),String(a))})}else{var s=e;for(var i in s){var o=s[i];o!=null&&jR(t,i,s[i])}}}const JS=["dark","light"],AN="dark",WQ="data-theme",FR="@sequence.theme",KQ=t=>JS.includes(t),QQ=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),kN=t=>t?`${FR}.${t}`:FR,YQ=t=>{const e=localStorage.getItem(kN(t));return e&&JS.includes(e)?e:AN},TN=v.createContext(null),JQ=t=>{const[e,r]=v.useState(t.theme||AN);v.useEffect(()=>{/Mac/.test(window.navigator.userAgent)&&window.document.documentElement.classList.add("is-apple")},[]),v.useEffect(()=>{t.theme||r(YQ(t.scope))},[t.theme,t.scope]),v.useEffect(()=>{t.theme&&r(t.theme)},[t.theme]),v.useEffect(()=>{const s=document.querySelector(t.root||":root");s&&(KQ(e)?(s.setAttribute(WQ,e),BR(s,cR,{colors:PH[e]})):QQ(e)&&BR(s,cR,{colors:e}),t.root&&s.classList.add("seq-root"))},[e,t.root]);const n=v.useMemo(()=>({theme:e,root:t.root,setTheme:s=>{JS.includes(s)&&(localStorage.setItem(kN(t.scope),s),r(s))}}),[e,t.root,t.scope]);return E.jsx(TN.Provider,{value:n,children:t.children})},XQ=()=>{const t=v.useContext(TN);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};var ZQ="_5b32m91 _5b32m90 fyvr11jg fyvr11ko fyvr11h0 fyvr11hs fyvr11nk fyvr1ko fyvr1oo fyvr1qo fyvr1mo",eY="_5b32m93 _5b32m92 fyvr11hs fyvr1ko fyvr1oo fyvr1qo fyvr1mo",tY=Nt({defaultClassName:"_5b32m95 _5b32m94 fyvr11d8 fyvr11dw fyvr11bg fyvr11by fyvr11c4 fyvr11cm fyvr11ls fyvr11m8 fyvr12ws fyvr12wm fyvr11h0 fyvr11i4 fyvr11hs fyvr11sd fyvr1mo fyvr1om",variantClassNames:{size:{sm:"_5b32m96",lg:"_5b32m97"},autoHeight:{true:"_5b32m98"}},defaultVariants:{},compoundVariants:[[{autoHeight:!0,size:"lg"},"_5b32m99"]]}),rY="_5b32m9b _5b32m9a fyvr110o fyvr112o fyvr114o fyvr116o fyvr11ho fyvr1qo fyvr1ko fyvr11nk";const PN=t=>{const{autoHeight:e=!1,backdropColor:r="backgroundBackdrop",children:n,disableAnimation:s=!1,isDismissible:i=!0,onClose:o,scroll:a=!0,size:c="lg",overlayProps:l,contentProps:u,rootProps:f={}}=t,{root:d}=XQ(),[h,p]=v.useState(null);return v.useEffect(()=>{p(document.querySelector(d||"body"))},[d]),h?E.jsx(jQ,{modal:!0,defaultOpen:!0,onOpenChange:o,children:E.jsx(BQ,{forceMount:!0,container:h,children:E.jsxs(q,{...f,className:qr("seq-root",ZQ,f==null?void 0:f.className),children:[E.jsx(q,{as:FQ,asChild:!0,background:r,className:eY,forceMount:!0,children:E.jsx(Xc.div,{initial:s?!1:{opacity:0},animate:s?!1:{opacity:1},exit:s?void 0:{opacity:0},transition:{type:"tween",ease:"linear"},...l},"modal-overlay")}),E.jsx(UQ,{asChild:!0,className:tY({autoHeight:e,size:c}),forceMount:!0,onEscapeKeyDown:y=>{i?o==null||o():y.preventDefault()},onInteractOutside:y=>{i||y.preventDefault()},children:E.jsxs(Xc.div,{initial:s?!1:{y:"100%",opacity:c==="sm"?0:1},animate:s?!1:{y:0,opacity:1},exit:s?void 0:{y:"100%",opacity:c==="sm"?0:1},transition:{type:"tween",ease:"easeOut"},...u,children:[a?E.jsx(HQ,{children:n}):n,i&&E.jsx(VQ,{asChild:!0,children:E.jsx(Am,{icon:Gh,backdropFilter:"blur",size:"xs",className:rY,"aria-label":"Close"})})]},"modal-content")})]})})}):null};var nY="_1acm19y1 _1acm19y0 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1ww fyvr1ys fyvr11hc fyvr11ko fyvr11od fyvr12s1 fyvr1g0 fyvr118g",sY=Nt({defaultClassName:"_1acm19y5",variantClassNames:{borderRadius:{xs:"_1acm19y6 _1acm19y2 fyvr11cw fyvr11dk fyvr11bk fyvr11c8",sm:"_1acm19y7 _1acm19y3 fyvr11d0 fyvr11do fyvr11bo fyvr11cc",md:"_1acm19y8 _1acm19y4 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg"}},defaultVariants:{},compoundVariants:[]}),iY=Nt({defaultClassName:"_1acm19ya _1acm19y9 fyvr1wg fyvr1yc fyvr1t4 fyvr1v0 fyvr12wp fyvr12wj fyvr11gw fyvr11od fyvr12s1 fyvr12o1 fyvr128 fyvr15o",variantClassNames:{numeric:{false:"_1acm19yb _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0",true:"_1acm19yc _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8"}},defaultVariants:{},compoundVariants:[]});const sr=v.forwardRef((t,e)=>{const{as:r="input",autoComplete:n="off",borderRadius:s="md",description:i,disabled:o=!1,id:a,label:c="",labelLocation:l="hidden",leftIcon:u,rightIcon:f,name:d,controls:h,type:p="text",numeric:y=!1,...g}=t;return E.jsx(Al,{description:i,disabled:o,display:"grid",id:a??d,label:c,labelLocation:l,children:E.jsx(q,{width:"full",children:E.jsxs(q,{className:qr(nY,sY({borderRadius:s})),children:[u&&E.jsx(u,{size:"sm"}),E.jsx(q,{as:r,autoComplete:n,spellCheck:"false",className:iY({numeric:y}),disabled:o,id:a??d,name:d,ref:e,type:p,...g}),f&&E.jsx(f,{size:"sm"}),h]})})})}),oY=RegExp("^\\d*(?:\\\\[.])?\\d*$");function aY(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}v.forwardRef((t,e)=>{const{name:r="amount",placeholder:n,onChange:s,onBlur:i,...o}=t,a=l=>{let{value:u}=l.target;u=u.replace(/,/g,"."),u.startsWith(".")&&(u="0"+u),u.startsWith("0")&&(u=u.replace(/^0+(?=\d)/,"")),(u===""||oY.test(aY(u)))&&(s==null||s({...l,target:{...l.target,value:u}}))},c=l=>{const{value:u}=l.target;let f=u;f.endsWith(".")&&(f=f.slice(0,-1)),f.endsWith(".0")&&(f=f.slice(0,-2)),f==="0"&&(f=""),i==null||i(l),f!==u&&(s==null||s({...l,target:{...l.target,value:f}}))};return E.jsx(sr,{name:r,onChange:a,onBlur:c,inputMode:"decimal",autoComplete:"off",autoCorrect:"off",type:"text",pattern:"^[0-9]*[.,]?[0-9]*$",placeholder:n||"0",minLength:1,maxLength:79,spellCheck:"false",numeric:!0,ref:e,...o})});var cY="y5zf971 _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8 _4efw240";const lY=t=>{const{value:e,digits:r=6,group:n,onChange:s,onConfirm:i,disabled:o=!1}=t,a=v.useMemo(()=>UR(0,r).map(()=>v.createRef()),[r]);v.useEffect(()=>{var d,h;(h=(d=a[0])==null?void 0:d.current)==null||h.focus()},[a]);const c=(d,h)=>{var p,y;/^\d$/.test(h)||(h="");const g=[...e];g[d]=h,h!==""&&((y=(p=a[d+1])==null?void 0:p.current)==null||y.focus()),s(g)},l=()=>e.join("").length===r,u=(d,h)=>{var p,y;const g=a[d].current,m=(p=a[d-1])==null?void 0:p.current,x=(y=a[d+1])==null?void 0:y.current;switch(h.key){case"Backspace":h.preventDefault(),g&&(g.value="",c(d,"")),m==null||m.focus();break;case"ArrowLeft":h.preventDefault(),m==null||m.focus();break;case"ArrowRight":h.preventDefault(),x==null||x.focus();break;case"Enter":h.preventDefault(),l()&&(i==null||i());break;default:(g==null?void 0:g.value)===h.key&&(h.preventDefault(),c(d,h.key))}},f=(d,h)=>{var p,y;const m=h.clipboardData.getData("text/plain").replace(/\D/g,"");new RegExp(`^\\d{${r}}$`).test(m)&&((y=(p=a[0])==null?void 0:p.current)==null||y.focus(),s(m.split("")),setTimeout(()=>{var b,w;(w=(b=a[a.length-1])==null?void 0:b.current)==null||w.focus()}))};return E.jsx(q,{gap:"2",children:UR(0,r).map(d=>E.jsxs(v.Fragment,{children:[!!n&&d>0&&d%n===0&&E.jsx("span",{}),E.jsx(q,{as:"input",className:cY,value:e[d]||"",ref:a[d],type:"text",inputMode:"numeric",maxLength:1,disabled:o,onFocus:h=>h.target.select(),onPaste:h=>f(d,h),onChange:h=>c(d,h.target.value),onKeyDown:h=>{u(d,h)}})]},d))})},UR=(t,e)=>Array.from({length:e-t},(r,n)=>n+t);Nt({defaultClassName:"_1jujggt1",variantClassNames:{size:{sm:"_1jujggt2",normal:"_1jujggt3",md:"_1jujggt4",lg:"_1jujggt5",xl:"_1jujggt6"}},defaultVariants:{},compoundVariants:[]});var XS="Progress",ZS=100,[uY,D1e]=Wr(XS),[fY,dY]=uY(XS),hY=v.forwardRef((t,e)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:i=yY,...o}=t;(s||s===0)&&!VR(s)&&console.error(vY(`${s}`,"Progress"));const a=VR(s)?s:ZS;n!==null&&!$R(n,a)&&console.error(mY(`${n}`,"Progress"));const c=$R(n,a)?n:null,l=r0(c)?i(c,a):void 0;return E.jsx(fY,{scope:r,value:c,max:a,children:E.jsx(we.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":r0(c)?c:void 0,"aria-valuetext":l,role:"progressbar","data-state":IN(c,a),"data-value":c??void 0,"data-max":a,...o,ref:e})})});hY.displayName=XS;var RN="ProgressIndicator",pY=v.forwardRef((t,e)=>{const{__scopeProgress:r,...n}=t,s=dY(RN,r);return E.jsx(we.div,{"data-state":IN(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:e})});pY.displayName=RN;function yY(t,e){return`${Math.round(t/e*100)}%`}function IN(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function r0(t){return typeof t=="number"}function VR(t){return r0(t)&&!isNaN(t)&&t>0}function $R(t,e){return r0(t)&&!isNaN(t)&&t<=e&&t>=0}function vY(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ZS}\`.`}function mY(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},DQ="DialogDescriptionWarning",LQ=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${SN(DQ).contentName}}.`;return v.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},jQ=dN,BQ=yN,FQ=vN,UQ=mN,VQ=wN,$Q=Nt({defaultClassName:"_1vqx0w91 _1vqx0w90 fyvr128 fyvr15o",variantClassNames:{direction:{vertical:"_1vqx0w92",horizontal:"_1vqx0w93"}},defaultVariants:{},compoundVariants:[]}),zQ=Nt({defaultClassName:"_1vqx0w94",variantClassNames:{shadows:{true:"_1vqx0w95",false:"_1vqx0w96"},direction:{vertical:"_1vqx0w97",horizontal:"_1vqx0w98"}},defaultVariants:{},compoundVariants:[]});const HQ=t=>{const{children:e,shadows:r=!0,direction:n="vertical",contentProps:s,...i}=t;return E.jsx(q,{className:zQ({direction:n,shadows:r}),position:"relative",width:"full",height:"full",...i,children:E.jsx(q,{className:$Q({direction:n}),background:"backgroundPrimary",...s,children:e})})};function GQ(t){var e=t.match(/^var\((.*)\)$/);return e?e[1]:t}function qQ(t,e){var r=t;for(var n of e){if(!(n in r))throw new Error("Path ".concat(e.join(" -> ")," does not exist in object"));r=r[n]}return r}function CN(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n={};for(var s in t){var i=t[s],o=[...r,s];typeof i=="string"||typeof i=="number"||i==null?n[s]=e(i,o):typeof i=="object"&&!Array.isArray(i)?n[s]=CN(i,e,o):console.warn('Skipping invalid key "'.concat(o.join("."),'". Should be a string, number, null or object. Received: "').concat(Array.isArray(i)?"Array":typeof i,'"'))}return n}function jR(t,e,r){t.style.setProperty(GQ(e),r)}function BR(t,e,r){if(typeof r=="object"){var n=e;CN(r,(a,c)=>{a!=null&&jR(t,qQ(n,c),String(a))})}else{var s=e;for(var i in s){var o=s[i];o!=null&&jR(t,i,s[i])}}}const JS=["dark","light"],AN="dark",WQ="data-theme",FR="@sequence.theme",KQ=t=>JS.includes(t),QQ=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),kN=t=>t?`${FR}.${t}`:FR,YQ=t=>{const e=localStorage.getItem(kN(t));return e&&JS.includes(e)?e:AN},TN=v.createContext(null),JQ=t=>{const[e,r]=v.useState(t.theme||AN);v.useEffect(()=>{/Mac/.test(window.navigator.userAgent)&&window.document.documentElement.classList.add("is-apple")},[]),v.useEffect(()=>{t.theme||r(YQ(t.scope))},[t.theme,t.scope]),v.useEffect(()=>{t.theme&&r(t.theme)},[t.theme]),v.useEffect(()=>{const s=document.querySelector(t.root||":root");s&&(KQ(e)?(s.setAttribute(WQ,e),BR(s,cR,{colors:PH[e]})):QQ(e)&&BR(s,cR,{colors:e}),t.root&&s.classList.add("seq-root"))},[e,t.root]);const n=v.useMemo(()=>({theme:e,root:t.root,setTheme:s=>{JS.includes(s)&&(localStorage.setItem(kN(t.scope),s),r(s))}}),[e,t.root,t.scope]);return E.jsx(TN.Provider,{value:n,children:t.children})},XQ=()=>{const t=v.useContext(TN);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};var ZQ="_5b32m91 _5b32m90 fyvr11jg fyvr11ko fyvr11h0 fyvr11hs fyvr11nk fyvr1ko fyvr1oo fyvr1qo fyvr1mo",eY="_5b32m93 _5b32m92 fyvr11hs fyvr1ko fyvr1oo fyvr1qo fyvr1mo",tY=Nt({defaultClassName:"_5b32m95 _5b32m94 fyvr11d8 fyvr11dw fyvr11bg fyvr11by fyvr11c4 fyvr11cm fyvr11ls fyvr11m8 fyvr12ws fyvr12wm fyvr11h0 fyvr11i4 fyvr11hs fyvr11sd fyvr1mo fyvr1om",variantClassNames:{size:{sm:"_5b32m96",lg:"_5b32m97"},autoHeight:{true:"_5b32m98"}},defaultVariants:{},compoundVariants:[[{autoHeight:!0,size:"lg"},"_5b32m99"]]}),rY="_5b32m9b _5b32m9a fyvr110o fyvr112o fyvr114o fyvr116o fyvr11ho fyvr1qo fyvr1ko fyvr11nk";const PN=t=>{const{autoHeight:e=!1,backdropColor:r="backgroundBackdrop",children:n,disableAnimation:s=!1,isDismissible:i=!0,onClose:o,scroll:a=!0,size:c="lg",overlayProps:l,contentProps:u,rootProps:f={}}=t,{root:d}=XQ(),[h,p]=v.useState(null);return v.useEffect(()=>{p(document.querySelector(d||"body"))},[d]),h?E.jsx(jQ,{modal:!0,defaultOpen:!0,onOpenChange:o,children:E.jsx(BQ,{forceMount:!0,container:h,children:E.jsxs(q,{...f,className:qr("seq-root",ZQ,f==null?void 0:f.className),children:[E.jsx(q,{as:FQ,asChild:!0,background:r,className:eY,forceMount:!0,children:E.jsx(Xc.div,{initial:s?!1:{opacity:0},animate:s?!1:{opacity:1},exit:s?void 0:{opacity:0},transition:{type:"tween",ease:"linear"},...l},"modal-overlay")}),E.jsx(UQ,{asChild:!0,className:tY({autoHeight:e,size:c}),forceMount:!0,onEscapeKeyDown:y=>{i?o==null||o():y.preventDefault()},onInteractOutside:y=>{i||y.preventDefault()},children:E.jsxs(Xc.div,{initial:s?!1:{y:"100%",opacity:c==="sm"?0:1},animate:s?!1:{y:0,opacity:1},exit:s?void 0:{y:"100%",opacity:c==="sm"?0:1},transition:{type:"tween",ease:"easeOut"},...u,children:[a?E.jsx(HQ,{children:n}):n,i&&E.jsx(VQ,{asChild:!0,children:E.jsx(Am,{icon:Gh,backdropFilter:"blur",size:"xs",className:rY,"aria-label":"Close"})})]},"modal-content")})]})})}):null};var nY="_1acm19y1 _1acm19y0 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1ww fyvr1ys fyvr11hc fyvr11ko fyvr11od fyvr12s1 fyvr1g0 fyvr118g",sY=Nt({defaultClassName:"_1acm19y5",variantClassNames:{borderRadius:{xs:"_1acm19y6 _1acm19y2 fyvr11cw fyvr11dk fyvr11bk fyvr11c8",sm:"_1acm19y7 _1acm19y3 fyvr11d0 fyvr11do fyvr11bo fyvr11cc",md:"_1acm19y8 _1acm19y4 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg"}},defaultVariants:{},compoundVariants:[]}),iY=Nt({defaultClassName:"_1acm19ya _1acm19y9 fyvr1wg fyvr1yc fyvr1t4 fyvr1v0 fyvr12wp fyvr12wj fyvr11gw fyvr11od fyvr12s1 fyvr12o1 fyvr128 fyvr15o",variantClassNames:{numeric:{false:"_1acm19yb _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0",true:"_1acm19yc _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8"}},defaultVariants:{},compoundVariants:[]});const sr=v.forwardRef((t,e)=>{const{as:r="input",autoComplete:n="off",borderRadius:s="md",description:i,disabled:o=!1,id:a,label:c="",labelLocation:l="hidden",leftIcon:u,rightIcon:f,name:d,controls:h,type:p="text",numeric:y=!1,...g}=t;return E.jsx(Al,{description:i,disabled:o,display:"grid",id:a??d,label:c,labelLocation:l,children:E.jsx(q,{width:"full",children:E.jsxs(q,{className:qr(nY,sY({borderRadius:s})),children:[u&&E.jsx(u,{size:"sm"}),E.jsx(q,{as:r,autoComplete:n,spellCheck:"false",className:iY({numeric:y}),disabled:o,id:a??d,name:d,ref:e,type:p,...g}),f&&E.jsx(f,{size:"sm"}),h]})})})}),oY=RegExp("^\\d*(?:\\\\[.])?\\d*$");function aY(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}v.forwardRef((t,e)=>{const{name:r="amount",placeholder:n,onChange:s,onBlur:i,...o}=t,a=l=>{let{value:u}=l.target;u=u.replace(/,/g,"."),u.startsWith(".")&&(u="0"+u),u.startsWith("0")&&(u=u.replace(/^0+(?=\d)/,"")),(u===""||oY.test(aY(u)))&&(s==null||s({...l,target:{...l.target,value:u}}))},c=l=>{const{value:u}=l.target;let f=u;f.endsWith(".")&&(f=f.slice(0,-1)),f.endsWith(".0")&&(f=f.slice(0,-2)),f==="0"&&(f=""),i==null||i(l),f!==u&&(s==null||s({...l,target:{...l.target,value:f}}))};return E.jsx(sr,{name:r,onChange:a,onBlur:c,inputMode:"decimal",autoComplete:"off",autoCorrect:"off",type:"text",pattern:"^[0-9]*[.,]?[0-9]*$",placeholder:n||"0",minLength:1,maxLength:79,spellCheck:"false",numeric:!0,ref:e,...o})});var cY="y5zf971 _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8 _4efw240";const lY=t=>{const{value:e,digits:r=6,group:n,onChange:s,onConfirm:i,disabled:o=!1}=t,a=v.useMemo(()=>UR(0,r).map(()=>v.createRef()),[r]);v.useEffect(()=>{var d,h;(h=(d=a[0])==null?void 0:d.current)==null||h.focus()},[a]);const c=(d,h)=>{var p,y;/^\d$/.test(h)||(h="");const g=[...e];g[d]=h,h!==""&&((y=(p=a[d+1])==null?void 0:p.current)==null||y.focus()),s(g)},l=()=>e.join("").length===r,u=(d,h)=>{var p,y;const g=a[d].current,m=(p=a[d-1])==null?void 0:p.current,x=(y=a[d+1])==null?void 0:y.current;switch(h.key){case"Backspace":h.preventDefault(),g&&(g.value="",c(d,"")),m==null||m.focus();break;case"ArrowLeft":h.preventDefault(),m==null||m.focus();break;case"ArrowRight":h.preventDefault(),x==null||x.focus();break;case"Enter":h.preventDefault(),l()&&(i==null||i());break;default:(g==null?void 0:g.value)===h.key&&(h.preventDefault(),c(d,h.key))}},f=(d,h)=>{var p,y;const m=h.clipboardData.getData("text/plain").replace(/\D/g,"");new RegExp(`^\\d{${r}}$`).test(m)&&((y=(p=a[0])==null?void 0:p.current)==null||y.focus(),s(m.split("")),setTimeout(()=>{var b,w;(w=(b=a[a.length-1])==null?void 0:b.current)==null||w.focus()}))};return E.jsx(q,{gap:"2",children:UR(0,r).map(d=>E.jsxs(v.Fragment,{children:[!!n&&d>0&&d%n===0&&E.jsx("span",{}),E.jsx(q,{as:"input",className:cY,value:e[d]||"",ref:a[d],type:"text",inputMode:"numeric",maxLength:1,disabled:o,onFocus:h=>h.target.select(),onPaste:h=>f(d,h),onChange:h=>c(d,h.target.value),onKeyDown:h=>{u(d,h)}})]},d))})},UR=(t,e)=>Array.from({length:e-t},(r,n)=>n+t);Nt({defaultClassName:"_1jujggt1",variantClassNames:{size:{sm:"_1jujggt2",normal:"_1jujggt3",md:"_1jujggt4",lg:"_1jujggt5",xl:"_1jujggt6"}},defaultVariants:{},compoundVariants:[]});var XS="Progress",ZS=100,[uY,j1e]=Wr(XS),[fY,dY]=uY(XS),hY=v.forwardRef((t,e)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:i=yY,...o}=t;(s||s===0)&&!VR(s)&&console.error(vY(`${s}`,"Progress"));const a=VR(s)?s:ZS;n!==null&&!$R(n,a)&&console.error(mY(`${n}`,"Progress"));const c=$R(n,a)?n:null,l=r0(c)?i(c,a):void 0;return E.jsx(fY,{scope:r,value:c,max:a,children:E.jsx(we.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":r0(c)?c:void 0,"aria-valuetext":l,role:"progressbar","data-state":IN(c,a),"data-value":c??void 0,"data-max":a,...o,ref:e})})});hY.displayName=XS;var RN="ProgressIndicator",pY=v.forwardRef((t,e)=>{const{__scopeProgress:r,...n}=t,s=dY(RN,r);return E.jsx(we.div,{"data-state":IN(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:e})});pY.displayName=RN;function yY(t,e){return`${Math.round(t/e*100)}%`}function IN(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function r0(t){return typeof t=="number"}function VR(t){return r0(t)&&!isNaN(t)&&t>0}function $R(t,e){return r0(t)&&!isNaN(t)&&t<=e&&t>=0}function vY(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ZS}\`.`}function mY(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${ZS} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var eC="Radio",[gY,ON]=Wr(eC),[xY,bY]=gY(eC),_N=v.forwardRef((t,e)=>{const{__scopeRadio:r,name:n,checked:s=!1,required:i,disabled:o,value:a="on",onCheck:c,...l}=t,[u,f]=v.useState(null),d=$e(e,y=>f(y)),h=v.useRef(!1),p=u?!!u.closest("form"):!0;return E.jsxs(xY,{scope:r,checked:s,disabled:o,children:[E.jsx(we.button,{type:"button",role:"radio","aria-checked":s,"data-state":DN(s),"data-disabled":o?"":void 0,disabled:o,value:a,...l,ref:d,onClick:ce(t.onClick,y=>{s||c==null||c(),p&&(h.current=y.isPropagationStopped(),h.current||y.stopPropagation())})}),p&&E.jsx(wY,{control:u,bubbles:!h.current,name:n,value:a,checked:s,required:i,disabled:o,style:{transform:"translateX(-100%)"}})]})});_N.displayName=eC;var NN="RadioIndicator",MN=v.forwardRef((t,e)=>{const{__scopeRadio:r,forceMount:n,...s}=t,i=bY(NN,r);return E.jsx(cn,{present:n||i.checked,children:E.jsx(we.span,{"data-state":DN(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e})})});MN.displayName=NN;var wY=t=>{const{control:e,checked:r,bubbles:n=!0,...s}=t,i=v.useRef(null),o=pm(r),a=ym(e);return v.useEffect(()=>{const c=i.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&f){const d=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(d)}},[o,r,n]),E.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:i,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function DN(t){return t?"checked":"unchecked"}var EY=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],tC="RadioGroup",[SY,L1e]=Wr(tC,[ud,ON]),LN=ud(),jN=ON(),[CY,AY]=SY(tC),BN=v.forwardRef((t,e)=>{const{__scopeRadioGroup:r,name:n,defaultValue:s,value:i,required:o=!1,disabled:a=!1,orientation:c,dir:l,loop:u=!0,onValueChange:f,...d}=t,h=LN(r),p=sy(l),[y,g]=ps({prop:i,defaultProp:s,onChange:f});return E.jsx(CY,{scope:r,name:n,required:o,disabled:a,value:y,onValueChange:g,children:E.jsx(LS,{asChild:!0,...h,orientation:c,dir:p,loop:u,children:E.jsx(we.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":a?"":void 0,dir:p,...d,ref:e})})})});BN.displayName=tC;var FN="RadioGroupItem",UN=v.forwardRef((t,e)=>{const{__scopeRadioGroup:r,disabled:n,...s}=t,i=AY(FN,r),o=i.disabled||n,a=LN(r),c=jN(r),l=v.useRef(null),u=$e(e,l),f=i.value===s.value,d=v.useRef(!1);return v.useEffect(()=>{const h=y=>{EY.includes(y.key)&&(d.current=!0)},p=()=>d.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),E.jsx(jS,{asChild:!0,...a,focusable:!o,active:f,children:E.jsx(_N,{disabled:o,required:i.required,checked:f,...c,...s,name:i.name,ref:u,onCheck:()=>i.onValueChange(s.value),onKeyDown:ce(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:ce(s.onFocus,()=>{var h;d.current&&((h=l.current)==null||h.click())})})})});UN.displayName=FN;var kY="RadioGroupIndicator",VN=v.forwardRef((t,e)=>{const{__scopeRadioGroup:r,...n}=t,s=jN(r);return E.jsx(MN,{...s,...n,ref:e})});VN.displayName=kY;var TY=BN,PY=UN,RY=VN,IY=Nt({defaultClassName:"io59uy3 io59uy0 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr1so fyvr1uk fyvr1wg fyvr1yc fyvr12nd fyvr12g1 fyvr121d fyvr128p fyvr12nj fyvr12g7 fyvr121j fyvr128v fyvr11od fyvr12v7 fyvr12v3 fyvr12vz fyvr12vr _4efw240",variantClassNames:{size:{sm:"io59uy4 io59uy1 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8",lg:"io59uy5 io59uy2 fyvr11ac fyvr11ao fyvr11b0 fyvr11bc"}},defaultVariants:{},compoundVariants:[]}),OY=Nt({defaultClassName:"io59uy8 io59uy7 io59uy6 fyvr11h0 fyvr11ko fyvr11jg fyvr11hw fyvr128 fyvr15o fyvr12s1",variantClassNames:{size:{sm:"io59uy9",lg:"io59uya"}},defaultVariants:{},compoundVariants:[]});const _Y=t=>{const{id:e,label:r,size:n="sm",value:s,disabled:i}=t;return E.jsx(q,{alignItems:"center",children:E.jsx(Al,{disabled:i,display:"flex",id:e,label:r,labelLocation:"right",children:E.jsx(PY,{className:IY({size:n}),value:s,id:e,disabled:i,children:E.jsx(RY,{className:OY({size:n})})})})})};v.forwardRef((t,e)=>{const{flexDirection:r="column",disabled:n=!1,gap:s="2",name:i,options:o,size:a="sm",...c}=t;return E.jsx(TY,{disabled:n,name:i,ref:e,...c,children:E.jsx(q,{flexDirection:r,gap:s,children:o.map(({label:l,value:u,disabled:f})=>E.jsx(_Y,{id:`${i}-${u}`,label:l,size:a,value:u,disabled:f},u))})})});function zR(t,[e,r]){return Math.min(r,Math.max(e,t))}var NY="VisuallyHidden",ly=v.forwardRef((t,e)=>E.jsx(we.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));ly.displayName=NY;var MY=ly,DY=[" ","Enter","ArrowUp","ArrowDown"],LY=[" ","Enter"],uy="Select",[km,Tm,jY]=vm(uy),[fd,j1e]=Wr(uy,[jY,ld]),Pm=ld(),[BY,Ua]=fd(uy),[FY,UY]=fd(uy),$N=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:d,required:h}=t,p=Pm(e),[y,g]=v.useState(null),[m,x]=v.useState(null),[b,w]=v.useState(!1),A=sy(l),[O=!1,_]=ps({prop:n,defaultProp:s,onChange:i}),[C,j]=ps({prop:o,defaultProp:a,onChange:c}),V=v.useRef(null),B=y?!!y.closest("form"):!0,[z,Y]=v.useState(new Set),H=Array.from(z).map(L=>L.props.value).join(";");return E.jsx(_S,{...p,children:E.jsxs(BY,{required:h,scope:e,trigger:y,onTriggerChange:g,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:b,onValueNodeHasChildrenChange:w,contentId:us(),value:C,onValueChange:j,open:O,onOpenChange:_,dir:A,triggerPointerDownPosRef:V,disabled:d,children:[E.jsx(km.Provider,{scope:e,children:E.jsx(FY,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(L=>{Y(T=>new Set(T).add(L))},[]),onNativeOptionRemove:v.useCallback(L=>{Y(T=>{const P=new Set(T);return P.delete(L),P})},[]),children:r})}),B?E.jsxs(c9,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:f,value:C,onChange:L=>j(L.target.value),disabled:d,children:[C===void 0?E.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};$N.displayName=uy;var zN="SelectTrigger",HN=v.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...s}=t,i=Pm(r),o=Ua(zN,r),a=o.disabled||n,c=$e(e,o.onTriggerChange),l=Tm(r),[u,f,d]=l9(p=>{const y=l().filter(x=>!x.disabled),g=y.find(x=>x.value===o.value),m=u9(y,p,g);m!==void 0&&o.onValueChange(m.value)}),h=()=>{a||(o.onOpenChange(!0),d())};return E.jsx(NS,{asChild:!0,...i,children:E.jsx(we.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":a9(o.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,p=>{p.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,p=>{const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&(h(),o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)},p.preventDefault())}),onKeyDown:ce(s.onKeyDown,p=>{const y=u.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&f(p.key),!(y&&p.key===" ")&&DY.includes(p.key)&&(h(),p.preventDefault())})})})});HN.displayName=zN;var GN="SelectValue",qN=v.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,children:i,placeholder:o="",...a}=t,c=Ua(GN,r),{onValueNodeHasChildrenChange:l}=c,u=i!==void 0,f=$e(e,c.onValueNodeChange);return Tr(()=>{l(u)},[l,u]),E.jsx(we.span,{...a,ref:f,style:{pointerEvents:"none"},children:a9(c.value)?E.jsx(E.Fragment,{children:o}):i})});qN.displayName=GN;var VY="SelectIcon",WN=v.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...s}=t;return E.jsx(we.span,{"aria-hidden":!0,...s,ref:e,children:n||"▼"})});WN.displayName=VY;var dl="SelectContent",KN=v.forwardRef((t,e)=>{const r=Ua(dl,t.__scopeSelect),[n,s]=v.useState();if(Tr(()=>{s(new DocumentFragment)},[]),!r.open){const i=n;return i?Eo.createPortal(E.jsx(QN,{scope:t.__scopeSelect,children:E.jsx(km.Slot,{scope:t.__scopeSelect,children:E.jsx("div",{children:t.children})})}),i):null}return E.jsx(YN,{...t,ref:e})});KN.displayName=dl;var Mi=10,[QN,Va]=fd(dl),$Y="SelectContentImpl",YN=v.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:g,...m}=t,x=Ua(dl,r),[b,w]=v.useState(null),[A,O]=v.useState(null),_=$e(e,ie=>w(ie)),[C,j]=v.useState(null),[V,B]=v.useState(null),z=Tm(r),[Y,H]=v.useState(!1),L=v.useRef(!1);v.useEffect(()=>{if(b)return BS(b)},[b]),SS();const T=v.useCallback(ie=>{const[Me,...Be]=z().map(ze=>ze.ref.current),[Te]=Be.slice(-1),De=document.activeElement;for(const ze of ie)if(ze===De||(ze==null||ze.scrollIntoView({block:"nearest"}),ze===Me&&A&&(A.scrollTop=0),ze===Te&&A&&(A.scrollTop=A.scrollHeight),ze==null||ze.focus(),document.activeElement!==De))return},[z,A]),P=v.useCallback(()=>T([C,b]),[T,C,b]);v.useEffect(()=>{Y&&P()},[Y,P]);const{onOpenChange:R,triggerPointerDownPosRef:I}=x;v.useEffect(()=>{if(b){let ie={x:0,y:0};const Me=Te=>{var De,ze;ie={x:Math.abs(Math.round(Te.pageX)-(((De=I.current)==null?void 0:De.x)??0)),y:Math.abs(Math.round(Te.pageY)-(((ze=I.current)==null?void 0:ze.y)??0))}},Be=Te=>{ie.x<=10&&ie.y<=10?Te.preventDefault():b.contains(Te.target)||R(!1),document.removeEventListener("pointermove",Me),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",Me),document.addEventListener("pointerup",Be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Me),document.removeEventListener("pointerup",Be,{capture:!0})}}},[b,R,I]),v.useEffect(()=>{const ie=()=>R(!1);return window.addEventListener("blur",ie),window.addEventListener("resize",ie),()=>{window.removeEventListener("blur",ie),window.removeEventListener("resize",ie)}},[R]);const[U,F]=l9(ie=>{const Me=z().filter(De=>!De.disabled),Be=Me.find(De=>De.ref.current===document.activeElement),Te=u9(Me,ie,Be);Te&&setTimeout(()=>Te.ref.current.focus())}),X=v.useCallback((ie,Me,Be)=>{const Te=!L.current&&!Be;(x.value!==void 0&&x.value===Me||Te)&&(j(ie),Te&&(L.current=!0))},[x.value]),oe=v.useCallback(()=>b==null?void 0:b.focus(),[b]),ae=v.useCallback((ie,Me,Be)=>{const Te=!L.current&&!Be;(x.value!==void 0&&x.value===Me||Te)&&B(ie)},[x.value]),ke=n==="popper"?Tw:JN,ve=ke===Tw?{side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:g}:{};return E.jsx(QN,{scope:r,content:b,viewport:A,onViewportChange:O,itemRefCallback:X,selectedItem:C,onItemLeave:oe,itemTextRefCallback:ae,focusSelectedItem:P,selectedItemText:V,position:n,isPositioned:Y,searchRef:U,children:E.jsx(Em,{as:ll,allowPinchZoom:!0,children:E.jsx(mm,{asChild:!0,trapped:x.open,onMountAutoFocus:ie=>{ie.preventDefault()},onUnmountAutoFocus:ce(s,ie=>{var Me;(Me=x.trigger)==null||Me.focus({preventScroll:!0}),ie.preventDefault()}),children:E.jsx(od,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:ie=>ie.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:E.jsx(ke,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ie=>ie.preventDefault(),...m,...ve,onPlaced:()=>H(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:ce(m.onKeyDown,ie=>{const Me=ie.ctrlKey||ie.altKey||ie.metaKey;if(ie.key==="Tab"&&ie.preventDefault(),!Me&&ie.key.length===1&&F(ie.key),["ArrowUp","ArrowDown","Home","End"].includes(ie.key)){let Te=z().filter(De=>!De.disabled).map(De=>De.ref.current);if(["ArrowUp","End"].includes(ie.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(ie.key)){const De=ie.target,ze=Te.indexOf(De);Te=Te.slice(ze+1)}setTimeout(()=>T(Te)),ie.preventDefault()}})})})})})})});YN.displayName=$Y;var zY="SelectItemAlignedPosition",JN=v.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...s}=t,i=Ua(dl,r),o=Va(dl,r),[a,c]=v.useState(null),[l,u]=v.useState(null),f=$e(e,_=>u(_)),d=Tm(r),h=v.useRef(!1),p=v.useRef(!0),{viewport:y,selectedItem:g,selectedItemText:m,focusSelectedItem:x}=o,b=v.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&l&&y&&g&&m){const _=i.trigger.getBoundingClientRect(),C=l.getBoundingClientRect(),j=i.valueNode.getBoundingClientRect(),V=m.getBoundingClientRect();if(i.dir!=="rtl"){const De=V.left-C.left,ze=j.left-De,at=_.left-ze,qe=_.width+at,Kr=Math.max(qe,C.width),vs=window.innerWidth-Mi,Qa=zR(ze,[Mi,vs-Kr]);a.style.minWidth=qe+"px",a.style.left=Qa+"px"}else{const De=C.right-V.right,ze=window.innerWidth-j.right-De,at=window.innerWidth-_.right-ze,qe=_.width+at,Kr=Math.max(qe,C.width),vs=window.innerWidth-Mi,Qa=zR(ze,[Mi,vs-Kr]);a.style.minWidth=qe+"px",a.style.right=Qa+"px"}const B=d(),z=window.innerHeight-Mi*2,Y=y.scrollHeight,H=window.getComputedStyle(l),L=parseInt(H.borderTopWidth,10),T=parseInt(H.paddingTop,10),P=parseInt(H.borderBottomWidth,10),R=parseInt(H.paddingBottom,10),I=L+T+Y+R+P,U=Math.min(g.offsetHeight*5,I),F=window.getComputedStyle(y),X=parseInt(F.paddingTop,10),oe=parseInt(F.paddingBottom,10),ae=_.top+_.height/2-Mi,ke=z-ae,ve=g.offsetHeight/2,ie=g.offsetTop+ve,Me=L+T+ie,Be=I-Me;if(Me<=ae){const De=g===B[B.length-1].ref.current;a.style.bottom="0px";const ze=l.clientHeight-y.offsetTop-y.offsetHeight,at=Math.max(ke,ve+(De?oe:0)+ze+P),qe=Me+at;a.style.height=qe+"px"}else{const De=g===B[0].ref.current;a.style.top="0px";const at=Math.max(ae,L+y.offsetTop+(De?X:0)+ve)+Be;a.style.height=at+"px",y.scrollTop=Me-ae+y.offsetTop}a.style.margin=`${Mi}px 0`,a.style.minHeight=U+"px",a.style.maxHeight=z+"px",n==null||n(),requestAnimationFrame(()=>h.current=!0)}},[d,i.trigger,i.valueNode,a,l,y,g,m,i.dir,n]);Tr(()=>b(),[b]);const[w,A]=v.useState();Tr(()=>{l&&A(window.getComputedStyle(l).zIndex)},[l]);const O=v.useCallback(_=>{_&&p.current===!0&&(b(),x==null||x(),p.current=!1)},[b,x]);return E.jsx(GY,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:O,children:E.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:E.jsx(we.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});JN.displayName=zY;var HY="SelectPopperPosition",Tw=v.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Mi,...i}=t,o=Pm(r);return E.jsx(MS,{...o,...i,ref:e,align:n,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Tw.displayName=HY;var[GY,rC]=fd(dl,{}),Pw="SelectViewport",XN=v.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...s}=t,i=Va(Pw,r),o=rC(Pw,r),a=$e(e,i.onViewportChange),c=v.useRef(0);return E.jsxs(E.Fragment,{children:[E.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),E.jsx(km.Slot,{scope:r,children:E.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,l=>{const u=l.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:d}=o;if(d!=null&&d.current&&f){const h=Math.abs(c.current-u.scrollTop);if(h>0){const p=window.innerHeight-Mi*2,y=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),m=Math.max(y,g);if(m0?w:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});XN.displayName=Pw;var ZN="SelectGroup",[qY,WY]=fd(ZN),e9=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=us();return E.jsx(qY,{scope:r,id:s,children:E.jsx(we.div,{role:"group","aria-labelledby":s,...n,ref:e})})});e9.displayName=ZN;var t9="SelectLabel",KY=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=WY(t9,r);return E.jsx(we.div,{id:s.id,...n,ref:e})});KY.displayName=t9;var n0="SelectItem",[QY,r9]=fd(n0),n9=v.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:i,...o}=t,a=Ua(n0,r),c=Va(n0,r),l=a.value===n,[u,f]=v.useState(i??""),[d,h]=v.useState(!1),p=$e(e,m=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,m,n,s)}),y=us(),g=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return E.jsx(QY,{scope:r,value:n,disabled:s,textId:y,isSelected:l,onItemTextChange:v.useCallback(m=>{f(x=>x||((m==null?void 0:m.textContent)??"").trim())},[]),children:E.jsx(km.ItemSlot,{scope:r,value:n,disabled:s,textValue:u,children:E.jsx(we.div,{role:"option","aria-labelledby":y,"data-highlighted":d?"":void 0,"aria-selected":l&&d,"data-state":l?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:p,onFocus:ce(o.onFocus,()=>h(!0)),onBlur:ce(o.onBlur,()=>h(!1)),onPointerUp:ce(o.onPointerUp,g),onPointerMove:ce(o.onPointerMove,m=>{var x;s?(x=c.onItemLeave)==null||x.call(c):m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(o.onPointerLeave,m=>{var x;m.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:ce(o.onKeyDown,m=>{var x;((x=c.searchRef)==null?void 0:x.current)!==""&&m.key===" "||(LY.includes(m.key)&&g(),m.key===" "&&m.preventDefault())})})})})});n9.displayName=n0;var Qd="SelectItemText",s9=v.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,...i}=t,o=Ua(Qd,r),a=Va(Qd,r),c=r9(Qd,r),l=UY(Qd,r),[u,f]=v.useState(null),d=$e(e,m=>f(m),c.onItemTextChange,m=>{var x;return(x=a.itemTextRefCallback)==null?void 0:x.call(a,m,c.value,c.disabled)}),h=u==null?void 0:u.textContent,p=v.useMemo(()=>E.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:y,onNativeOptionRemove:g}=l;return Tr(()=>(y(p),()=>g(p)),[y,g,p]),E.jsxs(E.Fragment,{children:[E.jsx(we.span,{id:c.textId,...i,ref:d}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Eo.createPortal(i.children,o.valueNode):null]})});s9.displayName=Qd;var i9="SelectItemIndicator",YY=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return r9(i9,r).isSelected?E.jsx(we.span,{"aria-hidden":!0,...n,ref:e}):null});YY.displayName=i9;var Rw="SelectScrollUpButton",JY=v.forwardRef((t,e)=>{const r=Va(Rw,t.__scopeSelect),n=rC(Rw,t.__scopeSelect),[s,i]=v.useState(!1),o=$e(e,n.onScrollButtonChange);return Tr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const l=c.scrollTop>0;i(l)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?E.jsx(o9,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});JY.displayName=Rw;var Iw="SelectScrollDownButton",XY=v.forwardRef((t,e)=>{const r=Va(Iw,t.__scopeSelect),n=rC(Iw,t.__scopeSelect),[s,i]=v.useState(!1),o=$e(e,n.onScrollButtonChange);return Tr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?E.jsx(o9,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});XY.displayName=Iw;var o9=v.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=t,i=Va("SelectScrollButton",r),o=v.useRef(null),a=Tm(r),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Tr(()=>{var l;const u=a().find(f=>f.ref.current===document.activeElement);(l=u==null?void 0:u.ref.current)==null||l.scrollIntoView({block:"nearest"})},[a]),E.jsx(we.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var l;(l=i.onItemLeave)==null||l.call(i),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),ZY="SelectSeparator",eJ=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return E.jsx(we.div,{"aria-hidden":!0,...n,ref:e})});eJ.displayName=ZY;var Ow="SelectArrow",tJ=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=Pm(r),i=Ua(Ow,r),o=Va(Ow,r);return i.open&&o.position==="popper"?E.jsx(DS,{...s,...n,ref:e}):null});tJ.displayName=Ow;function a9(t){return t===""||t===void 0}var c9=v.forwardRef((t,e)=>{const{value:r,...n}=t,s=v.useRef(null),i=$e(e,s),o=pm(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==r&&u){const f=new Event("change",{bubbles:!0});u.call(a,r),a.dispatchEvent(f)}},[o,r]),E.jsx(ly,{asChild:!0,children:E.jsx("select",{...n,ref:i,defaultValue:r})})});c9.displayName="BubbleSelect";function l9(t){const e=Gr(t),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(o=>{const a=r.current+o;e(a),function c(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[e]),i=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,i]}function u9(t,e,r){const s=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=rJ(t,Math.max(i,0));s.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function rJ(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var nJ=$N,sJ=HN,iJ=qN,oJ=WN,aJ=KN,cJ=XN,lJ=e9,uJ=n9,fJ=s9,dJ="gohwum1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 gohwum0 fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11ko fyvr11od fyvr11hc fyvr11f4 fyvr12s1 fyvr118c fyvr11jw fyvr11n4 fyvr12v7 fyvr12o1",hJ=Nt({defaultClassName:"gohwum5",variantClassNames:{borderRadius:{xs:"gohwum6 gohwum2 fyvr11cw fyvr11dk fyvr11bk fyvr11c8",sm:"gohwum7 gohwum3 fyvr11d0 fyvr11do fyvr11bo fyvr11cc",md:"gohwum8 gohwum4 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg"}},defaultVariants:{},compoundVariants:[]}),pJ="gohwuma gohwum9 fyvr11d0 fyvr11do fyvr11bo fyvr11cc fyvr11ls fyvr11m8 fyvr11ms fyvr11tv fyvr12s1 fyvr11nl",yJ="gohwume _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 gohwumd fyvr1ww fyvr1ys fyvr1t0 fyvr1uw fyvr12ws fyvr12wt fyvr12wm fyvr12wn fyvr11h0 fyvr11jw fyvr11ko fyvr12v7 fyvr12v3 fyvr12s1 fyvr12w1 fyvr12vr";const vJ=v.forwardRef(({children:t,className:e,...r},n)=>E.jsx(uJ,{className:qr(yJ,e),...r,ref:n,children:E.jsx(fJ,{children:t})})),Rm=v.forwardRef((t,e)=>{const{borderRadius:r="md",disabled:n=!1,id:s,label:i="",description:o,labelLocation:a="hidden",name:c,options:l,placeholder:u,...f}=t;return E.jsx(Al,{disabled:n,display:"grid",id:s??c,label:i,labelLocation:a,description:o,whiteSpace:"nowrap",children:E.jsxs(nJ,{disabled:n,name:c,...f,children:[E.jsxs(sJ,{id:s??c,className:qr(dJ,hJ({borderRadius:r})),ref:e,children:[E.jsx(iJ,{placeholder:u}),E.jsx(q,{as:oJ,display:"inline-flex",children:E.jsx(G6,{})})]}),E.jsx(aJ,{className:pJ,children:E.jsx(cJ,{children:E.jsx(lJ,{children:l.map(({value:d,label:h,...p})=>E.jsx(vJ,{value:d,...p,children:h},d))})})})]})})});v.forwardRef((t,e)=>{const{controls:r,onChange:n,placeholder:s="Search",name:i="search",value:o,...a}=t,c=o?E.jsx(Am,{icon:Gh,size:"xs",onClick:()=>n==null?void 0:n({target:{value:""}})}):void 0;return E.jsx(sr,{ref:e,name:i,leftIcon:wG,controls:r||c,placeholder:s,value:o,onChange:l=>n==null?void 0:n(l),...a})});var mJ=Nt({defaultClassName:"en4abt1",variantClassNames:{size:{sm:"en4abt2",md:"en4abt3",lg:"en4abt4"}},defaultVariants:{},compoundVariants:[]});const Bn=v.forwardRef((t,e)=>{const{size:r="md",...n}=t;return E.jsx(q,{className:mJ({size:r}),color:"text50",ref:e,...n,children:E.jsxs("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",children:[E.jsx("circle",{cx:"12",cy:"12",fill:"none",r:"10.5",strokeDasharray:"42",strokeLinecap:"round"}),E.jsx("circle",{cx:"12",cy:"12",fill:"none",opacity:"0.25",r:"10.5",strokeLinecap:"round"})]})})});v.forwardRef(({children:t},e)=>E.jsx(q,{ref:e,width:"fit",height:"fit",onClick:r=>{r.preventDefault(),r.stopPropagation()},onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation())},children:t}));var nC="Switch",[gJ,B1e]=Wr(nC),[xJ,bJ]=gJ(nC),f9=v.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:a,value:c="on",onCheckedChange:l,...u}=t,[f,d]=v.useState(null),h=$e(e,x=>d(x)),p=v.useRef(!1),y=f?!!f.closest("form"):!0,[g=!1,m]=ps({prop:s,defaultProp:i,onChange:l});return E.jsxs(xJ,{scope:r,checked:g,disabled:a,children:[E.jsx(we.button,{type:"button",role:"switch","aria-checked":g,"aria-required":o,"data-state":p9(g),"data-disabled":a?"":void 0,disabled:a,value:c,...u,ref:h,onClick:ce(t.onClick,x=>{m(b=>!b),y&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})}),y&&E.jsx(wJ,{control:f,bubbles:!p.current,name:n,value:c,checked:g,required:o,disabled:a,style:{transform:"translateX(-100%)"}})]})});f9.displayName=nC;var d9="SwitchThumb",h9=v.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=bJ(d9,r);return E.jsx(we.span,{"data-state":p9(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});h9.displayName=d9;var wJ=t=>{const{control:e,checked:r,bubbles:n=!0,...s}=t,i=v.useRef(null),o=pm(r),a=ym(e);return v.useEffect(()=>{const c=i.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&f){const d=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(d)}},[o,r,n]),E.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:i,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function p9(t){return t?"checked":"unchecked"}var EJ=f9,SJ=h9,CJ="_1lp2u8e1 _1lp2u8e0 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr1ss fyvr1uo fyvr1wk fyvr1yg fyvr11t1 fyvr11hw fyvr12v7 fyvr12o1 _4efw240",AJ="_1lp2u8e3 _1lp2u8e2 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ho fyvr1ko fyvr1oo fyvr1k fyvr140 fyvr11o1";const kJ=t=>{const{disabled:e,label:r,labelLocation:n="left",description:s,id:i,name:o,...a}=t;return E.jsx(Al,{disabled:e,display:"flex",id:i??o,label:r,labelLocation:n,description:s,whiteSpace:"nowrap",children:E.jsx(EJ,{className:CJ,disabled:e,...a,children:E.jsx(q,{position:"relative",width:"full",height:"full",children:E.jsx(SJ,{className:AJ})})})})};Nt({defaultClassName:"nwwh3z8",variantClassNames:{variant:{pill:"nwwh3z9",line:"nwwh3za nwwh3z1 fyvr11g0"},active:{true:"nwwh3zb nwwh3z2 fyvr12w5",false:"nwwh3zc"},disabled:{true:"nwwh3zd nwwh3z3 fyvr12vp"}},defaultVariants:{},compoundVariants:[[{active:!0,variant:"pill"},"nwwh3z4 fyvr11u7 fyvr12sj"],[{active:!1,variant:"pill"},"nwwh3z5 fyvr11od fyvr12s7"],[{active:!0,variant:"line"},"nwwh3z6 fyvr12s1"],[{active:!1,variant:"line"},"nwwh3z7 fyvr12s7"]]});var sC="Tabs",[TJ,F1e]=Wr(sC,[ud]),y9=ud(),[PJ,iC]=TJ(sC),RJ=v.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:c="automatic",...l}=t,u=sy(a),[f,d]=ps({prop:n,onChange:s,defaultProp:i});return E.jsx(PJ,{scope:r,baseId:us(),value:f,onValueChange:d,orientation:o,dir:u,activationMode:c,children:E.jsx(we.div,{dir:u,"data-orientation":o,...l,ref:e})})});RJ.displayName=sC;var v9="TabsList",IJ=v.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...s}=t,i=iC(v9,r),o=y9(r);return E.jsx(LS,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:n,children:E.jsx(we.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});IJ.displayName=v9;var m9="TabsTrigger",OJ=v.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...i}=t,o=iC(m9,r),a=y9(r),c=x9(o.baseId,n),l=b9(o.baseId,n),u=n===o.value;return E.jsx(jS,{asChild:!0,...a,focusable:!s,active:u,children:E.jsx(we.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":l,"data-state":u?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:ce(t.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:ce(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:ce(t.onFocus,()=>{const f=o.activationMode!=="manual";!u&&!s&&f&&o.onValueChange(n)})})})});OJ.displayName=m9;var g9="TabsContent",_J=v.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:s,children:i,...o}=t,a=iC(g9,r),c=x9(a.baseId,n),l=b9(a.baseId,n),u=n===a.value,f=v.useRef(u);return v.useEffect(()=>{const d=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(d)},[]),E.jsx(cn,{present:s||u,children:({present:d})=>E.jsx(we.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!d,id:l,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:d&&i})})});_J.displayName=g9;function x9(t,e){return`${t}-trigger-${e}`}function b9(t,e){return`${t}-content-${e}`}var NJ="_1ppqbnx1 _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc _1ppqbnx0 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1wo fyvr1yk fyvr1ss fyvr1uo fyvr11hc fyvr118c fyvr11n9";v.forwardRef((t,e)=>{const{icon:r,label:n,...s}=t;return E.jsxs(q,{className:NJ,ref:e,background:"buttonGlass",color:"text80",...s,children:[r&&E.jsx(r,{size:"xs"}),E.jsx(ue,{children:n})]})});var oC="ToastProvider",[aC,MJ,DJ]=vm("Toast"),[w9,U1e]=Wr("Toast",[DJ]),[LJ,Im]=w9(oC),E9=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=t,[a,c]=v.useState(null),[l,u]=v.useState(0),f=v.useRef(!1),d=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${oC}\`. Expected non-empty \`string\`.`),E.jsx(aC.Provider,{scope:e,children:E.jsx(LJ,{scope:e,label:r,duration:n,swipeDirection:s,swipeThreshold:i,toastCount:l,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>u(h=>h+1),[]),onToastRemove:v.useCallback(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:d,children:o})})};E9.displayName=oC;var S9="ToastViewport",jJ=["F8"],_w="toast.viewportPause",Nw="toast.viewportResume",C9=v.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=jJ,label:s="Notifications ({hotkey})",...i}=t,o=Im(S9,r),a=MJ(r),c=v.useRef(null),l=v.useRef(null),u=v.useRef(null),f=v.useRef(null),d=$e(e,f,o.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=o.toastCount>0;v.useEffect(()=>{const g=m=>{var x;n.every(w=>m[w]||m.code===w)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]),v.useEffect(()=>{const g=c.current,m=f.current;if(p&&g&&m){const x=()=>{if(!o.isClosePausedRef.current){const O=new CustomEvent(_w);m.dispatchEvent(O),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const O=new CustomEvent(Nw);m.dispatchEvent(O),o.isClosePausedRef.current=!1}},w=O=>{!g.contains(O.relatedTarget)&&b()},A=()=>{g.contains(document.activeElement)||b()};return g.addEventListener("focusin",x),g.addEventListener("focusout",w),g.addEventListener("pointermove",x),g.addEventListener("pointerleave",A),window.addEventListener("blur",x),window.addEventListener("focus",b),()=>{g.removeEventListener("focusin",x),g.removeEventListener("focusout",w),g.removeEventListener("pointermove",x),g.removeEventListener("pointerleave",A),window.removeEventListener("blur",x),window.removeEventListener("focus",b)}}},[p,o.isClosePausedRef]);const y=v.useCallback(({tabbingDirection:g})=>{const x=a().map(b=>{const w=b.ref.current,A=[w,...JJ(w)];return g==="forwards"?A:A.reverse()});return(g==="forwards"?x.reverse():x).flat()},[a]);return v.useEffect(()=>{const g=f.current;if(g){const m=x=>{var b,w,A;const O=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!O){const C=document.activeElement,j=x.shiftKey;if(x.target===g&&j){(b=l.current)==null||b.focus();return}const z=y({tabbingDirection:j?"backwards":"forwards"}),Y=z.findIndex(H=>H===C);px(z.slice(Y+1))?x.preventDefault():j?(w=l.current)==null||w.focus():(A=u.current)==null||A.focus()}};return g.addEventListener("keydown",m),()=>g.removeEventListener("keydown",m)}},[a,y]),E.jsxs(qG,{ref:c,role:"region","aria-label":s.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:p?void 0:"none"},children:[p&&E.jsx(Mw,{ref:l,onFocusFromOutsideViewport:()=>{const g=y({tabbingDirection:"forwards"});px(g)}}),E.jsx(aC.Slot,{scope:r,children:E.jsx(we.ol,{tabIndex:-1,...i,ref:d})}),p&&E.jsx(Mw,{ref:u,onFocusFromOutsideViewport:()=>{const g=y({tabbingDirection:"backwards"});px(g)}})]})});C9.displayName=S9;var A9="ToastFocusProxy",Mw=v.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=t,i=Im(A9,r);return E.jsx(ly,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:o=>{var a;const c=o.relatedTarget;!((a=i.viewport)!=null&&a.contains(c))&&n()}})});Mw.displayName=A9;var Om="Toast",BJ="toast.swipeStart",FJ="toast.swipeMove",UJ="toast.swipeCancel",VJ="toast.swipeEnd",k9=v.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...o}=t,[a=!0,c]=ps({prop:n,defaultProp:s,onChange:i});return E.jsx(cn,{present:r||a,children:E.jsx(HJ,{open:a,...o,ref:e,onClose:()=>c(!1),onPause:Gr(t.onPause),onResume:Gr(t.onResume),onSwipeStart:ce(t.onSwipeStart,l=>{l.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(t.onSwipeMove,l=>{const{x:u,y:f}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","move"),l.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(t.onSwipeCancel,l=>{l.currentTarget.setAttribute("data-swipe","cancel"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(t.onSwipeEnd,l=>{const{x:u,y:f}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","end"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});k9.displayName=Om;var[$J,zJ]=w9(Om,{onClose(){}}),HJ=v.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:f,onSwipeCancel:d,onSwipeEnd:h,...p}=t,y=Im(Om,r),[g,m]=v.useState(null),x=$e(e,H=>m(H)),b=v.useRef(null),w=v.useRef(null),A=s||y.duration,O=v.useRef(0),_=v.useRef(A),C=v.useRef(0),{onToastAdd:j,onToastRemove:V}=y,B=Gr(()=>{var H;(g==null?void 0:g.contains(document.activeElement))&&((H=y.viewport)==null||H.focus()),o()}),z=v.useCallback(H=>{!H||H===1/0||(window.clearTimeout(C.current),O.current=new Date().getTime(),C.current=window.setTimeout(B,H))},[B]);v.useEffect(()=>{const H=y.viewport;if(H){const L=()=>{z(_.current),l==null||l()},T=()=>{const P=new Date().getTime()-O.current;_.current=_.current-P,window.clearTimeout(C.current),c==null||c()};return H.addEventListener(_w,T),H.addEventListener(Nw,L),()=>{H.removeEventListener(_w,T),H.removeEventListener(Nw,L)}}},[y.viewport,A,c,l,z]),v.useEffect(()=>{i&&!y.isClosePausedRef.current&&z(A)},[i,A,y.isClosePausedRef,z]),v.useEffect(()=>(j(),()=>V()),[j,V]);const Y=v.useMemo(()=>g?_9(g):null,[g]);return y.viewport?E.jsxs(E.Fragment,{children:[Y&&E.jsx(GJ,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:Y}),E.jsx($J,{scope:r,onClose:B,children:Eo.createPortal(E.jsx(aC.ItemSlot,{scope:r,children:E.jsx(GG,{asChild:!0,onEscapeKeyDown:ce(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||B(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:E.jsx(we.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":y.swipeDirection,...p,ref:x,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ce(t.onKeyDown,H=>{H.key==="Escape"&&(a==null||a(H.nativeEvent),H.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,B()))}),onPointerDown:ce(t.onPointerDown,H=>{H.button===0&&(b.current={x:H.clientX,y:H.clientY})}),onPointerMove:ce(t.onPointerMove,H=>{if(!b.current)return;const L=H.clientX-b.current.x,T=H.clientY-b.current.y,P=!!w.current,R=["left","right"].includes(y.swipeDirection),I=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,U=R?I(0,L):0,F=R?0:I(0,T),X=H.pointerType==="touch"?10:2,oe={x:U,y:F},ae={originalEvent:H,delta:oe};P?(w.current=oe,c1(FJ,f,ae,{discrete:!1})):HR(oe,y.swipeDirection,X)?(w.current=oe,c1(BJ,u,ae,{discrete:!1}),H.target.setPointerCapture(H.pointerId)):(Math.abs(L)>X||Math.abs(T)>X)&&(b.current=null)}),onPointerUp:ce(t.onPointerUp,H=>{const L=w.current,T=H.target;if(T.hasPointerCapture(H.pointerId)&&T.releasePointerCapture(H.pointerId),w.current=null,b.current=null,L){const P=H.currentTarget,R={originalEvent:H,delta:L};HR(L,y.swipeDirection,y.swipeThreshold)?c1(VJ,h,R,{discrete:!0}):c1(UJ,d,R,{discrete:!0}),P.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),GJ=t=>{const{__scopeToast:e,children:r,...n}=t,s=Im(Om,e),[i,o]=v.useState(!1),[a,c]=v.useState(!1);return QJ(()=>o(!0)),v.useEffect(()=>{const l=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(l)},[]),a?null:E.jsx(oy,{asChild:!0,children:E.jsx(ly,{...n,children:i&&E.jsxs(E.Fragment,{children:[s.label," ",r]})})})},qJ="ToastTitle",T9=v.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return E.jsx(we.div,{...n,ref:e})});T9.displayName=qJ;var WJ="ToastDescription",P9=v.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return E.jsx(we.div,{...n,ref:e})});P9.displayName=WJ;var R9="ToastAction",KJ=v.forwardRef((t,e)=>{const{altText:r,...n}=t;return r.trim()?E.jsx(O9,{altText:r,asChild:!0,children:E.jsx(cC,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${R9}\`. Expected non-empty \`string\`.`),null)});KJ.displayName=R9;var I9="ToastClose",cC=v.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,s=zJ(I9,r);return E.jsx(O9,{asChild:!0,children:E.jsx(we.button,{type:"button",...n,ref:e,onClick:ce(t.onClick,s.onClose)})})});cC.displayName=I9;var O9=v.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...s}=t;return E.jsx(we.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:e})});function _9(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),YJ(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=n.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(..._9(n))}}),e}function c1(t,e,r,{discrete:n}){const s=r.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?vS(s,i):s.dispatchEvent(i)}var HR=(t,e,r=0)=>{const n=Math.abs(t.x),s=Math.abs(t.y),i=n>s;return e==="left"||e==="right"?i&&n>r:!i&&s>r};function QJ(t=()=>{}){const e=Gr(t);Tr(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function YJ(t){return t.nodeType===t.ELEMENT_NODE}function JJ(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function px(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var XJ=E9,ZJ=C9,eX=k9,tX=T9,rX=P9,nX=cC,sX="_6wut8v1 _6wut8v0 fyvr12wp fyvr12wj fyvr11hs fyvr1qo fyvr1mo fyvr128 fyvr118g fyvr11i4 fyvr11h0",iX=Nt({defaultClassName:"_6wut8v3",variantClassNames:{variant:{normal:"_6wut8v4",success:"_6wut8v5",error:"_6wut8v6"}},defaultVariants:{},compoundVariants:[]});const N9=v.createContext(null),oX=t=>{const{children:e,...r}=t,[n,s]=v.useState(new Set);return E.jsxs(XJ,{...r,children:[E.jsxs(N9.Provider,{value:s,children:[e,E.jsx(yS,{children:Array.from(n).map(i=>E.jsx(cX,{...i},i.id))})]}),E.jsx(aX,{})]})},aX=()=>E.jsx(ZJ,{className:sX}),cX=t=>{const{id:e,variant:r,title:n,description:s,icon:i,isDismissible:o=!0,...a}=t,c=()=>{if(i)return E.jsx(i,{});switch(r){case"success":return E.jsx(q,{background:"positive",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:E.jsx(gS,{})});case"error":return E.jsx(q,{background:"negative",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:E.jsx(Gh,{})});default:return null}};return E.jsx(eX,{className:iX({variant:r}),open:!0,forceMount:!0,asChild:!0,...a,children:E.jsxs(YH,{as:Xc.li,layoutId:e,layout:!0,initial:{x:"100%"},animate:{x:0},exit:{y:"100%",opacity:0},borderRadius:"md",background:"buttonGlass",backdropFilter:"blur",position:"relative",width:"full",justifyContent:"space-between",children:[E.jsxs(q,{gap:"3",alignItems:"center",children:[c(),E.jsxs(q,{flexDirection:"column",gap:"1",children:[n&&E.jsx(tX,{children:E.jsx(ue,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:n})}),E.jsx(rX,{children:E.jsx(ue,{as:"div",variant:"normal",fontWeight:"medium",color:"text50",children:s})})]})]}),o&&E.jsx(nX,{"aria-label":"Close",asChild:!0,children:E.jsx(Am,{icon:Gh,size:"xs"})})]})})},M9=()=>{const t=v.useContext(N9);return e=>{const r={...e,id:Math.random().toString(36).slice(2,12),onOpenChange:n=>{n||t(s=>(s.delete(r),new Set([...s])))}};t(n=>new Set([...n,r]))}};var lX="_15pztn1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _15pztn0 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11ko fyvr11od fyvr12s1 fyvr12o1 fyvr12wj fyvr128 fyvr11h0",uX="_15pztn2";v.forwardRef((t,e)=>{const{as:r="textarea",autoComplete:n="off",borderRadius:s="md",description:i,disabled:o=!1,id:a,label:c="",labelLocation:l="hidden",name:u,rows:f,resize:d=!1,...h}=t;return E.jsx(Al,{description:i,disabled:o,display:"grid",id:a??u,label:c,labelLocation:l,children:E.jsx(q,{as:r,autoComplete:n,spellCheck:"false",className:qr(lX,d&&uX),disabled:o,id:a??u,name:u,ref:e,rows:f,borderRadius:s,...h})})});var fX=Nt({defaultClassName:"_18h918k5 _18h918k0 fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11h0",variantClassNames:{size:{xs:"_18h918k6",sm:"_18h918k7",md:"_18h918k8",lg:"_18h918k9",xl:"_18h918ka"},borderRadius:{circle:"_18h918kb _18h918k1 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co",lg:"_18h918kc _18h918k2 fyvr11d8 fyvr11dw fyvr11bw fyvr11ck",md:"_18h918kd _18h918k3 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg",sm:"_18h918ke _18h918k4 fyvr11d0 fyvr11do fyvr11bo fyvr11cc"}},defaultVariants:{},compoundVariants:[]}),dX="_18h918kf";const hX=v.memo(t=>{const{chainId:e,borderRadius:r="circle",className:n,disableAnimation:s=!1,style:i,src:o,size:a="md",...c}=t,l=o||UH(VH(e),a);return E.jsx(q,{className:qr(n,fX({borderRadius:r,size:a})),style:i,flexShrink:"0",...c,children:E.jsx(uN,{className:dX,disableAnimation:s,src:l})})});var pX=Nt({defaultClassName:"bnrreb1 bnrreb0 fyvr11jg fyvr11ko fyvr11hw fyvr11h0",variantClassNames:{size:{xs:"bnrreb2",sm:"bnrreb3",md:"bnrreb4",lg:"bnrreb5",xl:"bnrreb6"}},defaultVariants:{},compoundVariants:[]}),yX="bnrreb7",vX="bnrreb9 bnrreb8 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11sj fyvr128 fyvr15o fyvr11h0";const mX=v.memo(t=>{const{borderRadius:e="circle",className:r,disableAnimation:n=!1,style:s,src:i,symbol:o,size:a="md",withNetwork:c,...l}=t;return E.jsxs(q,{className:qr(r,pX({size:a})),style:s,flexShrink:"0",...l,children:[i?E.jsx(uN,{className:yX,disableAnimation:n,borderRadius:e,overflow:"hidden",src:i}):E.jsx(ue,{className:vX,variant:"normal",fontWeight:"medium",color:"text50",borderRadius:e,overflow:"hidden",uppercase:!0,children:o==null?void 0:o.replace(/\s/,"").slice(0,4)}),c&&E.jsx(q,{position:"absolute",zIndex:"1",borderRadius:"circle",borderWidth:"thin",borderStyle:"solid",borderColor:"backgroundPrimary",background:"backgroundPrimary",placeItems:"center",style:{width:16+2,height:16+2,right:-2,bottom:-2},children:E.jsx(hX,{chainId:c,style:{width:16,height:16}})})]})});var[_m,V1e]=Wr("Tooltip",[ld]),Nm=ld(),D9="TooltipProvider",gX=700,Dw="tooltip.open",[xX,lC]=_m(D9),bX=t=>{const{__scopeTooltip:e,delayDuration:r=gX,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:i}=t,[o,a]=v.useState(!0),c=v.useRef(!1),l=v.useRef(0);return v.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),E.jsx(xX,{scope:e,isOpenDelayed:o,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(l.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(u=>{c.current=u},[]),disableHoverableContent:s,children:i})};bX.displayName=D9;var Mm="Tooltip",[wX,fy]=_m(Mm),EX=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:s=!1,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,c=lC(Mm,t.__scopeTooltip),l=Nm(e),[u,f]=v.useState(null),d=us(),h=v.useRef(0),p=o??c.disableHoverableContent,y=a??c.delayDuration,g=v.useRef(!1),[m=!1,x]=ps({prop:n,defaultProp:s,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(Dw))):c.onClose(),i==null||i(_)}}),b=v.useMemo(()=>m?g.current?"delayed-open":"instant-open":"closed",[m]),w=v.useCallback(()=>{window.clearTimeout(h.current),g.current=!1,x(!0)},[x]),A=v.useCallback(()=>{window.clearTimeout(h.current),x(!1)},[x]),O=v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{g.current=!0,x(!0)},y)},[y,x]);return v.useEffect(()=>()=>window.clearTimeout(h.current),[]),E.jsx(_S,{...l,children:E.jsx(wX,{scope:e,contentId:d,open:m,stateAttribute:b,trigger:u,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?O():w()},[c.isOpenDelayed,O,w]),onTriggerLeave:v.useCallback(()=>{p?A():window.clearTimeout(h.current)},[A,p]),onOpen:w,onClose:A,disableHoverableContent:p,children:r})})};EX.displayName=Mm;var Lw="TooltipTrigger",SX=v.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=fy(Lw,r),i=lC(Lw,r),o=Nm(r),a=v.useRef(null),c=$e(e,a,s.onTriggerChange),l=v.useRef(!1),u=v.useRef(!1),f=v.useCallback(()=>l.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),E.jsx(NS,{asChild:!0,...o,children:E.jsx(we.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(t.onPointerMove,d=>{d.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:ce(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:ce(t.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(t.onFocus,()=>{l.current||s.onOpen()}),onBlur:ce(t.onBlur,s.onClose),onClick:ce(t.onClick,s.onClose)})})});SX.displayName=Lw;var uC="TooltipPortal",[CX,AX]=_m(uC,{forceMount:void 0}),kX=t=>{const{__scopeTooltip:e,forceMount:r,children:n,container:s}=t,i=fy(uC,e);return E.jsx(CX,{scope:e,forceMount:r,children:E.jsx(cn,{present:r||i.open,children:E.jsx(oy,{asChild:!0,container:s,children:n})})})};kX.displayName=uC;var Ff="TooltipContent",TX=v.forwardRef((t,e)=>{const r=AX(Ff,t.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...i}=t,o=fy(Ff,t.__scopeTooltip);return E.jsx(cn,{present:n||o.open,children:o.disableHoverableContent?E.jsx(L9,{side:s,...i,ref:e}):E.jsx(PX,{side:s,...i,ref:e})})}),PX=v.forwardRef((t,e)=>{const r=fy(Ff,t.__scopeTooltip),n=lC(Ff,t.__scopeTooltip),s=v.useRef(null),i=$e(e,s),[o,a]=v.useState(null),{trigger:c,onClose:l}=r,u=s.current,{onPointerInTransitChange:f}=n,d=v.useCallback(()=>{a(null),f(!1)},[f]),h=v.useCallback((p,y)=>{const g=p.currentTarget,m={x:p.clientX,y:p.clientY},x=_X(m,g.getBoundingClientRect()),b=NX(m,x),w=MX(y.getBoundingClientRect()),A=LX([...b,...w]);a(A),f(!0)},[f]);return v.useEffect(()=>()=>d(),[d]),v.useEffect(()=>{if(c&&u){const p=g=>h(g,u),y=g=>h(g,c);return c.addEventListener("pointerleave",p),u.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",y)}}},[c,u,h,d]),v.useEffect(()=>{if(o){const p=y=>{const g=y.target,m={x:y.clientX,y:y.clientY},x=(c==null?void 0:c.contains(g))||(u==null?void 0:u.contains(g)),b=!DX(m,o);x?d():b&&(d(),l())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,u,o,l,d]),E.jsx(L9,{...t,ref:i})}),[RX,IX]=_m(Mm,{isInside:!1}),L9=v.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=t,c=fy(Ff,r),l=Nm(r),{onClose:u}=c;return v.useEffect(()=>(document.addEventListener(Dw,u),()=>document.removeEventListener(Dw,u)),[u]),v.useEffect(()=>{if(c.trigger){const f=d=>{const h=d.target;h!=null&&h.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),E.jsx(od,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:E.jsxs(MS,{"data-state":c.stateAttribute,...l,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[E.jsx(U6,{children:n}),E.jsx(RX,{scope:r,isInside:!0,children:E.jsx(MY,{id:c.contentId,role:"tooltip",children:s||n})})]})})});TX.displayName=Ff;var j9="TooltipArrow",OX=v.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=Nm(r);return IX(j9,r).isInside?null:E.jsx(DS,{...s,...n,ref:e})});OX.displayName=j9;function _X(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,s,i)){case i:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function NX(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function MX(t){const{top:e,right:r,bottom:n,left:s}=t;return[{x:s,y:e},{x:r,y:e},{x:r,y:n},{x:s,y:n}]}function DX(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;in!=u>n&&r<(l-a)*(n-c)/(u-c)+a&&(s=!s)}return s}function LX(t){const e=t.slice();return e.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),jX(e)}function jX(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const s=t[n];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))r.pop();else break}r.push(s)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}/** +Defaulting to \`null\`.`}var eC="Radio",[gY,ON]=Wr(eC),[xY,bY]=gY(eC),_N=v.forwardRef((t,e)=>{const{__scopeRadio:r,name:n,checked:s=!1,required:i,disabled:o,value:a="on",onCheck:c,...l}=t,[u,f]=v.useState(null),d=$e(e,y=>f(y)),h=v.useRef(!1),p=u?!!u.closest("form"):!0;return E.jsxs(xY,{scope:r,checked:s,disabled:o,children:[E.jsx(we.button,{type:"button",role:"radio","aria-checked":s,"data-state":DN(s),"data-disabled":o?"":void 0,disabled:o,value:a,...l,ref:d,onClick:ce(t.onClick,y=>{s||c==null||c(),p&&(h.current=y.isPropagationStopped(),h.current||y.stopPropagation())})}),p&&E.jsx(wY,{control:u,bubbles:!h.current,name:n,value:a,checked:s,required:i,disabled:o,style:{transform:"translateX(-100%)"}})]})});_N.displayName=eC;var NN="RadioIndicator",MN=v.forwardRef((t,e)=>{const{__scopeRadio:r,forceMount:n,...s}=t,i=bY(NN,r);return E.jsx(cn,{present:n||i.checked,children:E.jsx(we.span,{"data-state":DN(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e})})});MN.displayName=NN;var wY=t=>{const{control:e,checked:r,bubbles:n=!0,...s}=t,i=v.useRef(null),o=pm(r),a=ym(e);return v.useEffect(()=>{const c=i.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&f){const d=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(d)}},[o,r,n]),E.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:i,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function DN(t){return t?"checked":"unchecked"}var EY=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],tC="RadioGroup",[SY,B1e]=Wr(tC,[ud,ON]),LN=ud(),jN=ON(),[CY,AY]=SY(tC),BN=v.forwardRef((t,e)=>{const{__scopeRadioGroup:r,name:n,defaultValue:s,value:i,required:o=!1,disabled:a=!1,orientation:c,dir:l,loop:u=!0,onValueChange:f,...d}=t,h=LN(r),p=sy(l),[y,g]=ps({prop:i,defaultProp:s,onChange:f});return E.jsx(CY,{scope:r,name:n,required:o,disabled:a,value:y,onValueChange:g,children:E.jsx(LS,{asChild:!0,...h,orientation:c,dir:p,loop:u,children:E.jsx(we.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":a?"":void 0,dir:p,...d,ref:e})})})});BN.displayName=tC;var FN="RadioGroupItem",UN=v.forwardRef((t,e)=>{const{__scopeRadioGroup:r,disabled:n,...s}=t,i=AY(FN,r),o=i.disabled||n,a=LN(r),c=jN(r),l=v.useRef(null),u=$e(e,l),f=i.value===s.value,d=v.useRef(!1);return v.useEffect(()=>{const h=y=>{EY.includes(y.key)&&(d.current=!0)},p=()=>d.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),E.jsx(jS,{asChild:!0,...a,focusable:!o,active:f,children:E.jsx(_N,{disabled:o,required:i.required,checked:f,...c,...s,name:i.name,ref:u,onCheck:()=>i.onValueChange(s.value),onKeyDown:ce(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:ce(s.onFocus,()=>{var h;d.current&&((h=l.current)==null||h.click())})})})});UN.displayName=FN;var kY="RadioGroupIndicator",VN=v.forwardRef((t,e)=>{const{__scopeRadioGroup:r,...n}=t,s=jN(r);return E.jsx(MN,{...s,...n,ref:e})});VN.displayName=kY;var TY=BN,PY=UN,RY=VN,IY=Nt({defaultClassName:"io59uy3 io59uy0 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr1so fyvr1uk fyvr1wg fyvr1yc fyvr12nd fyvr12g1 fyvr121d fyvr128p fyvr12nj fyvr12g7 fyvr121j fyvr128v fyvr11od fyvr12v7 fyvr12v3 fyvr12vz fyvr12vr _4efw240",variantClassNames:{size:{sm:"io59uy4 io59uy1 fyvr11a8 fyvr11ak fyvr11aw fyvr11b8",lg:"io59uy5 io59uy2 fyvr11ac fyvr11ao fyvr11b0 fyvr11bc"}},defaultVariants:{},compoundVariants:[]}),OY=Nt({defaultClassName:"io59uy8 io59uy7 io59uy6 fyvr11h0 fyvr11ko fyvr11jg fyvr11hw fyvr128 fyvr15o fyvr12s1",variantClassNames:{size:{sm:"io59uy9",lg:"io59uya"}},defaultVariants:{},compoundVariants:[]});const _Y=t=>{const{id:e,label:r,size:n="sm",value:s,disabled:i}=t;return E.jsx(q,{alignItems:"center",children:E.jsx(Al,{disabled:i,display:"flex",id:e,label:r,labelLocation:"right",children:E.jsx(PY,{className:IY({size:n}),value:s,id:e,disabled:i,children:E.jsx(RY,{className:OY({size:n})})})})})};v.forwardRef((t,e)=>{const{flexDirection:r="column",disabled:n=!1,gap:s="2",name:i,options:o,size:a="sm",...c}=t;return E.jsx(TY,{disabled:n,name:i,ref:e,...c,children:E.jsx(q,{flexDirection:r,gap:s,children:o.map(({label:l,value:u,disabled:f})=>E.jsx(_Y,{id:`${i}-${u}`,label:l,size:a,value:u,disabled:f},u))})})});function zR(t,[e,r]){return Math.min(r,Math.max(e,t))}var NY="VisuallyHidden",ly=v.forwardRef((t,e)=>E.jsx(we.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));ly.displayName=NY;var MY=ly,DY=[" ","Enter","ArrowUp","ArrowDown"],LY=[" ","Enter"],uy="Select",[km,Tm,jY]=vm(uy),[fd,F1e]=Wr(uy,[jY,ld]),Pm=ld(),[BY,Ua]=fd(uy),[FY,UY]=fd(uy),$N=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:d,required:h}=t,p=Pm(e),[y,g]=v.useState(null),[m,x]=v.useState(null),[b,w]=v.useState(!1),A=sy(l),[O=!1,_]=ps({prop:n,defaultProp:s,onChange:i}),[C,j]=ps({prop:o,defaultProp:a,onChange:c}),V=v.useRef(null),B=y?!!y.closest("form"):!0,[z,Y]=v.useState(new Set),H=Array.from(z).map(L=>L.props.value).join(";");return E.jsx(_S,{...p,children:E.jsxs(BY,{required:h,scope:e,trigger:y,onTriggerChange:g,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:b,onValueNodeHasChildrenChange:w,contentId:us(),value:C,onValueChange:j,open:O,onOpenChange:_,dir:A,triggerPointerDownPosRef:V,disabled:d,children:[E.jsx(km.Provider,{scope:e,children:E.jsx(FY,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback(L=>{Y(T=>new Set(T).add(L))},[]),onNativeOptionRemove:v.useCallback(L=>{Y(T=>{const P=new Set(T);return P.delete(L),P})},[]),children:r})}),B?E.jsxs(c9,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:f,value:C,onChange:L=>j(L.target.value),disabled:d,children:[C===void 0?E.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};$N.displayName=uy;var zN="SelectTrigger",HN=v.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...s}=t,i=Pm(r),o=Ua(zN,r),a=o.disabled||n,c=$e(e,o.onTriggerChange),l=Tm(r),[u,f,d]=l9(p=>{const y=l().filter(x=>!x.disabled),g=y.find(x=>x.value===o.value),m=u9(y,p,g);m!==void 0&&o.onValueChange(m.value)}),h=()=>{a||(o.onOpenChange(!0),d())};return E.jsx(NS,{asChild:!0,...i,children:E.jsx(we.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":a9(o.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,p=>{p.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,p=>{const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&(h(),o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)},p.preventDefault())}),onKeyDown:ce(s.onKeyDown,p=>{const y=u.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&f(p.key),!(y&&p.key===" ")&&DY.includes(p.key)&&(h(),p.preventDefault())})})})});HN.displayName=zN;var GN="SelectValue",qN=v.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,children:i,placeholder:o="",...a}=t,c=Ua(GN,r),{onValueNodeHasChildrenChange:l}=c,u=i!==void 0,f=$e(e,c.onValueNodeChange);return Tr(()=>{l(u)},[l,u]),E.jsx(we.span,{...a,ref:f,style:{pointerEvents:"none"},children:a9(c.value)?E.jsx(E.Fragment,{children:o}):i})});qN.displayName=GN;var VY="SelectIcon",WN=v.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...s}=t;return E.jsx(we.span,{"aria-hidden":!0,...s,ref:e,children:n||"▼"})});WN.displayName=VY;var dl="SelectContent",KN=v.forwardRef((t,e)=>{const r=Ua(dl,t.__scopeSelect),[n,s]=v.useState();if(Tr(()=>{s(new DocumentFragment)},[]),!r.open){const i=n;return i?Eo.createPortal(E.jsx(QN,{scope:t.__scopeSelect,children:E.jsx(km.Slot,{scope:t.__scopeSelect,children:E.jsx("div",{children:t.children})})}),i):null}return E.jsx(YN,{...t,ref:e})});KN.displayName=dl;var Mi=10,[QN,Va]=fd(dl),$Y="SelectContentImpl",YN=v.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:g,...m}=t,x=Ua(dl,r),[b,w]=v.useState(null),[A,O]=v.useState(null),_=$e(e,ie=>w(ie)),[C,j]=v.useState(null),[V,B]=v.useState(null),z=Tm(r),[Y,H]=v.useState(!1),L=v.useRef(!1);v.useEffect(()=>{if(b)return BS(b)},[b]),SS();const T=v.useCallback(ie=>{const[Me,...Be]=z().map(ze=>ze.ref.current),[Te]=Be.slice(-1),De=document.activeElement;for(const ze of ie)if(ze===De||(ze==null||ze.scrollIntoView({block:"nearest"}),ze===Me&&A&&(A.scrollTop=0),ze===Te&&A&&(A.scrollTop=A.scrollHeight),ze==null||ze.focus(),document.activeElement!==De))return},[z,A]),P=v.useCallback(()=>T([C,b]),[T,C,b]);v.useEffect(()=>{Y&&P()},[Y,P]);const{onOpenChange:R,triggerPointerDownPosRef:I}=x;v.useEffect(()=>{if(b){let ie={x:0,y:0};const Me=Te=>{var De,ze;ie={x:Math.abs(Math.round(Te.pageX)-(((De=I.current)==null?void 0:De.x)??0)),y:Math.abs(Math.round(Te.pageY)-(((ze=I.current)==null?void 0:ze.y)??0))}},Be=Te=>{ie.x<=10&&ie.y<=10?Te.preventDefault():b.contains(Te.target)||R(!1),document.removeEventListener("pointermove",Me),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",Me),document.addEventListener("pointerup",Be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Me),document.removeEventListener("pointerup",Be,{capture:!0})}}},[b,R,I]),v.useEffect(()=>{const ie=()=>R(!1);return window.addEventListener("blur",ie),window.addEventListener("resize",ie),()=>{window.removeEventListener("blur",ie),window.removeEventListener("resize",ie)}},[R]);const[U,F]=l9(ie=>{const Me=z().filter(De=>!De.disabled),Be=Me.find(De=>De.ref.current===document.activeElement),Te=u9(Me,ie,Be);Te&&setTimeout(()=>Te.ref.current.focus())}),X=v.useCallback((ie,Me,Be)=>{const Te=!L.current&&!Be;(x.value!==void 0&&x.value===Me||Te)&&(j(ie),Te&&(L.current=!0))},[x.value]),oe=v.useCallback(()=>b==null?void 0:b.focus(),[b]),ae=v.useCallback((ie,Me,Be)=>{const Te=!L.current&&!Be;(x.value!==void 0&&x.value===Me||Te)&&B(ie)},[x.value]),ke=n==="popper"?Tw:JN,ve=ke===Tw?{side:a,sideOffset:c,align:l,alignOffset:u,arrowPadding:f,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:y,avoidCollisions:g}:{};return E.jsx(QN,{scope:r,content:b,viewport:A,onViewportChange:O,itemRefCallback:X,selectedItem:C,onItemLeave:oe,itemTextRefCallback:ae,focusSelectedItem:P,selectedItemText:V,position:n,isPositioned:Y,searchRef:U,children:E.jsx(Em,{as:ll,allowPinchZoom:!0,children:E.jsx(mm,{asChild:!0,trapped:x.open,onMountAutoFocus:ie=>{ie.preventDefault()},onUnmountAutoFocus:ce(s,ie=>{var Me;(Me=x.trigger)==null||Me.focus({preventScroll:!0}),ie.preventDefault()}),children:E.jsx(od,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:ie=>ie.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:E.jsx(ke,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ie=>ie.preventDefault(),...m,...ve,onPlaced:()=>H(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:ce(m.onKeyDown,ie=>{const Me=ie.ctrlKey||ie.altKey||ie.metaKey;if(ie.key==="Tab"&&ie.preventDefault(),!Me&&ie.key.length===1&&F(ie.key),["ArrowUp","ArrowDown","Home","End"].includes(ie.key)){let Te=z().filter(De=>!De.disabled).map(De=>De.ref.current);if(["ArrowUp","End"].includes(ie.key)&&(Te=Te.slice().reverse()),["ArrowUp","ArrowDown"].includes(ie.key)){const De=ie.target,ze=Te.indexOf(De);Te=Te.slice(ze+1)}setTimeout(()=>T(Te)),ie.preventDefault()}})})})})})})});YN.displayName=$Y;var zY="SelectItemAlignedPosition",JN=v.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...s}=t,i=Ua(dl,r),o=Va(dl,r),[a,c]=v.useState(null),[l,u]=v.useState(null),f=$e(e,_=>u(_)),d=Tm(r),h=v.useRef(!1),p=v.useRef(!0),{viewport:y,selectedItem:g,selectedItemText:m,focusSelectedItem:x}=o,b=v.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&l&&y&&g&&m){const _=i.trigger.getBoundingClientRect(),C=l.getBoundingClientRect(),j=i.valueNode.getBoundingClientRect(),V=m.getBoundingClientRect();if(i.dir!=="rtl"){const De=V.left-C.left,ze=j.left-De,at=_.left-ze,qe=_.width+at,Kr=Math.max(qe,C.width),vs=window.innerWidth-Mi,Qa=zR(ze,[Mi,vs-Kr]);a.style.minWidth=qe+"px",a.style.left=Qa+"px"}else{const De=C.right-V.right,ze=window.innerWidth-j.right-De,at=window.innerWidth-_.right-ze,qe=_.width+at,Kr=Math.max(qe,C.width),vs=window.innerWidth-Mi,Qa=zR(ze,[Mi,vs-Kr]);a.style.minWidth=qe+"px",a.style.right=Qa+"px"}const B=d(),z=window.innerHeight-Mi*2,Y=y.scrollHeight,H=window.getComputedStyle(l),L=parseInt(H.borderTopWidth,10),T=parseInt(H.paddingTop,10),P=parseInt(H.borderBottomWidth,10),R=parseInt(H.paddingBottom,10),I=L+T+Y+R+P,U=Math.min(g.offsetHeight*5,I),F=window.getComputedStyle(y),X=parseInt(F.paddingTop,10),oe=parseInt(F.paddingBottom,10),ae=_.top+_.height/2-Mi,ke=z-ae,ve=g.offsetHeight/2,ie=g.offsetTop+ve,Me=L+T+ie,Be=I-Me;if(Me<=ae){const De=g===B[B.length-1].ref.current;a.style.bottom="0px";const ze=l.clientHeight-y.offsetTop-y.offsetHeight,at=Math.max(ke,ve+(De?oe:0)+ze+P),qe=Me+at;a.style.height=qe+"px"}else{const De=g===B[0].ref.current;a.style.top="0px";const at=Math.max(ae,L+y.offsetTop+(De?X:0)+ve)+Be;a.style.height=at+"px",y.scrollTop=Me-ae+y.offsetTop}a.style.margin=`${Mi}px 0`,a.style.minHeight=U+"px",a.style.maxHeight=z+"px",n==null||n(),requestAnimationFrame(()=>h.current=!0)}},[d,i.trigger,i.valueNode,a,l,y,g,m,i.dir,n]);Tr(()=>b(),[b]);const[w,A]=v.useState();Tr(()=>{l&&A(window.getComputedStyle(l).zIndex)},[l]);const O=v.useCallback(_=>{_&&p.current===!0&&(b(),x==null||x(),p.current=!1)},[b,x]);return E.jsx(GY,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:O,children:E.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:E.jsx(we.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});JN.displayName=zY;var HY="SelectPopperPosition",Tw=v.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Mi,...i}=t,o=Pm(r);return E.jsx(MS,{...o,...i,ref:e,align:n,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Tw.displayName=HY;var[GY,rC]=fd(dl,{}),Pw="SelectViewport",XN=v.forwardRef((t,e)=>{const{__scopeSelect:r,nonce:n,...s}=t,i=Va(Pw,r),o=rC(Pw,r),a=$e(e,i.onViewportChange),c=v.useRef(0);return E.jsxs(E.Fragment,{children:[E.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),E.jsx(km.Slot,{scope:r,children:E.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,l=>{const u=l.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:d}=o;if(d!=null&&d.current&&f){const h=Math.abs(c.current-u.scrollTop);if(h>0){const p=window.innerHeight-Mi*2,y=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),m=Math.max(y,g);if(m0?w:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});XN.displayName=Pw;var ZN="SelectGroup",[qY,WY]=fd(ZN),e9=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=us();return E.jsx(qY,{scope:r,id:s,children:E.jsx(we.div,{role:"group","aria-labelledby":s,...n,ref:e})})});e9.displayName=ZN;var t9="SelectLabel",KY=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=WY(t9,r);return E.jsx(we.div,{id:s.id,...n,ref:e})});KY.displayName=t9;var n0="SelectItem",[QY,r9]=fd(n0),n9=v.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:i,...o}=t,a=Ua(n0,r),c=Va(n0,r),l=a.value===n,[u,f]=v.useState(i??""),[d,h]=v.useState(!1),p=$e(e,m=>{var x;return(x=c.itemRefCallback)==null?void 0:x.call(c,m,n,s)}),y=us(),g=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return E.jsx(QY,{scope:r,value:n,disabled:s,textId:y,isSelected:l,onItemTextChange:v.useCallback(m=>{f(x=>x||((m==null?void 0:m.textContent)??"").trim())},[]),children:E.jsx(km.ItemSlot,{scope:r,value:n,disabled:s,textValue:u,children:E.jsx(we.div,{role:"option","aria-labelledby":y,"data-highlighted":d?"":void 0,"aria-selected":l&&d,"data-state":l?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:p,onFocus:ce(o.onFocus,()=>h(!0)),onBlur:ce(o.onBlur,()=>h(!1)),onPointerUp:ce(o.onPointerUp,g),onPointerMove:ce(o.onPointerMove,m=>{var x;s?(x=c.onItemLeave)==null||x.call(c):m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(o.onPointerLeave,m=>{var x;m.currentTarget===document.activeElement&&((x=c.onItemLeave)==null||x.call(c))}),onKeyDown:ce(o.onKeyDown,m=>{var x;((x=c.searchRef)==null?void 0:x.current)!==""&&m.key===" "||(LY.includes(m.key)&&g(),m.key===" "&&m.preventDefault())})})})})});n9.displayName=n0;var Qd="SelectItemText",s9=v.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:s,...i}=t,o=Ua(Qd,r),a=Va(Qd,r),c=r9(Qd,r),l=UY(Qd,r),[u,f]=v.useState(null),d=$e(e,m=>f(m),c.onItemTextChange,m=>{var x;return(x=a.itemTextRefCallback)==null?void 0:x.call(a,m,c.value,c.disabled)}),h=u==null?void 0:u.textContent,p=v.useMemo(()=>E.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:y,onNativeOptionRemove:g}=l;return Tr(()=>(y(p),()=>g(p)),[y,g,p]),E.jsxs(E.Fragment,{children:[E.jsx(we.span,{id:c.textId,...i,ref:d}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Eo.createPortal(i.children,o.valueNode):null]})});s9.displayName=Qd;var i9="SelectItemIndicator",YY=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return r9(i9,r).isSelected?E.jsx(we.span,{"aria-hidden":!0,...n,ref:e}):null});YY.displayName=i9;var Rw="SelectScrollUpButton",JY=v.forwardRef((t,e)=>{const r=Va(Rw,t.__scopeSelect),n=rC(Rw,t.__scopeSelect),[s,i]=v.useState(!1),o=$e(e,n.onScrollButtonChange);return Tr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const l=c.scrollTop>0;i(l)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?E.jsx(o9,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});JY.displayName=Rw;var Iw="SelectScrollDownButton",XY=v.forwardRef((t,e)=>{const r=Va(Iw,t.__scopeSelect),n=rC(Iw,t.__scopeSelect),[s,i]=v.useState(!1),o=$e(e,n.onScrollButtonChange);return Tr(()=>{if(r.viewport&&r.isPositioned){let a=function(){const l=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?E.jsx(o9,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});XY.displayName=Iw;var o9=v.forwardRef((t,e)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=t,i=Va("SelectScrollButton",r),o=v.useRef(null),a=Tm(r),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Tr(()=>{var l;const u=a().find(f=>f.ref.current===document.activeElement);(l=u==null?void 0:u.ref.current)==null||l.scrollIntoView({block:"nearest"})},[a]),E.jsx(we.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var l;(l=i.onItemLeave)==null||l.call(i),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),ZY="SelectSeparator",eJ=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t;return E.jsx(we.div,{"aria-hidden":!0,...n,ref:e})});eJ.displayName=ZY;var Ow="SelectArrow",tJ=v.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,s=Pm(r),i=Ua(Ow,r),o=Va(Ow,r);return i.open&&o.position==="popper"?E.jsx(DS,{...s,...n,ref:e}):null});tJ.displayName=Ow;function a9(t){return t===""||t===void 0}var c9=v.forwardRef((t,e)=>{const{value:r,...n}=t,s=v.useRef(null),i=$e(e,s),o=pm(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==r&&u){const f=new Event("change",{bubbles:!0});u.call(a,r),a.dispatchEvent(f)}},[o,r]),E.jsx(ly,{asChild:!0,children:E.jsx("select",{...n,ref:i,defaultValue:r})})});c9.displayName="BubbleSelect";function l9(t){const e=Gr(t),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(o=>{const a=r.current+o;e(a),function c(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[e]),i=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,i]}function u9(t,e,r){const s=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=r?t.indexOf(r):-1;let o=rJ(t,Math.max(i,0));s.length===1&&(o=o.filter(l=>l!==r));const c=o.find(l=>l.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function rJ(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var nJ=$N,sJ=HN,iJ=qN,oJ=WN,aJ=KN,cJ=XN,lJ=e9,uJ=n9,fJ=s9,dJ="gohwum1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 gohwum0 fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11ko fyvr11od fyvr11hc fyvr11f4 fyvr12s1 fyvr118c fyvr11jw fyvr11n4 fyvr12v7 fyvr12o1",hJ=Nt({defaultClassName:"gohwum5",variantClassNames:{borderRadius:{xs:"gohwum6 gohwum2 fyvr11cw fyvr11dk fyvr11bk fyvr11c8",sm:"gohwum7 gohwum3 fyvr11d0 fyvr11do fyvr11bo fyvr11cc",md:"gohwum8 gohwum4 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg"}},defaultVariants:{},compoundVariants:[]}),pJ="gohwuma gohwum9 fyvr11d0 fyvr11do fyvr11bo fyvr11cc fyvr11ls fyvr11m8 fyvr11ms fyvr11tv fyvr12s1 fyvr11nl",yJ="gohwume _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 gohwumd fyvr1ww fyvr1ys fyvr1t0 fyvr1uw fyvr12ws fyvr12wt fyvr12wm fyvr12wn fyvr11h0 fyvr11jw fyvr11ko fyvr12v7 fyvr12v3 fyvr12s1 fyvr12w1 fyvr12vr";const vJ=v.forwardRef(({children:t,className:e,...r},n)=>E.jsx(uJ,{className:qr(yJ,e),...r,ref:n,children:E.jsx(fJ,{children:t})})),Rm=v.forwardRef((t,e)=>{const{borderRadius:r="md",disabled:n=!1,id:s,label:i="",description:o,labelLocation:a="hidden",name:c,options:l,placeholder:u,...f}=t;return E.jsx(Al,{disabled:n,display:"grid",id:s??c,label:i,labelLocation:a,description:o,whiteSpace:"nowrap",children:E.jsxs(nJ,{disabled:n,name:c,...f,children:[E.jsxs(sJ,{id:s??c,className:qr(dJ,hJ({borderRadius:r})),ref:e,children:[E.jsx(iJ,{placeholder:u}),E.jsx(q,{as:oJ,display:"inline-flex",children:E.jsx(G6,{})})]}),E.jsx(aJ,{className:pJ,children:E.jsx(cJ,{children:E.jsx(lJ,{children:l.map(({value:d,label:h,...p})=>E.jsx(vJ,{value:d,...p,children:h},d))})})})]})})});v.forwardRef((t,e)=>{const{controls:r,onChange:n,placeholder:s="Search",name:i="search",value:o,...a}=t,c=o?E.jsx(Am,{icon:Gh,size:"xs",onClick:()=>n==null?void 0:n({target:{value:""}})}):void 0;return E.jsx(sr,{ref:e,name:i,leftIcon:wG,controls:r||c,placeholder:s,value:o,onChange:l=>n==null?void 0:n(l),...a})});var mJ=Nt({defaultClassName:"en4abt1",variantClassNames:{size:{sm:"en4abt2",md:"en4abt3",lg:"en4abt4"}},defaultVariants:{},compoundVariants:[]});const Bn=v.forwardRef((t,e)=>{const{size:r="md",...n}=t;return E.jsx(q,{className:mJ({size:r}),color:"text50",ref:e,...n,children:E.jsxs("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",children:[E.jsx("circle",{cx:"12",cy:"12",fill:"none",r:"10.5",strokeDasharray:"42",strokeLinecap:"round"}),E.jsx("circle",{cx:"12",cy:"12",fill:"none",opacity:"0.25",r:"10.5",strokeLinecap:"round"})]})})});v.forwardRef(({children:t},e)=>E.jsx(q,{ref:e,width:"fit",height:"fit",onClick:r=>{r.preventDefault(),r.stopPropagation()},onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation())},children:t}));var nC="Switch",[gJ,U1e]=Wr(nC),[xJ,bJ]=gJ(nC),f9=v.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:a,value:c="on",onCheckedChange:l,...u}=t,[f,d]=v.useState(null),h=$e(e,x=>d(x)),p=v.useRef(!1),y=f?!!f.closest("form"):!0,[g=!1,m]=ps({prop:s,defaultProp:i,onChange:l});return E.jsxs(xJ,{scope:r,checked:g,disabled:a,children:[E.jsx(we.button,{type:"button",role:"switch","aria-checked":g,"aria-required":o,"data-state":p9(g),"data-disabled":a?"":void 0,disabled:a,value:c,...u,ref:h,onClick:ce(t.onClick,x=>{m(b=>!b),y&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})}),y&&E.jsx(wJ,{control:f,bubbles:!p.current,name:n,value:c,checked:g,required:o,disabled:a,style:{transform:"translateX(-100%)"}})]})});f9.displayName=nC;var d9="SwitchThumb",h9=v.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=bJ(d9,r);return E.jsx(we.span,{"data-state":p9(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});h9.displayName=d9;var wJ=t=>{const{control:e,checked:r,bubbles:n=!0,...s}=t,i=v.useRef(null),o=pm(r),a=ym(e);return v.useEffect(()=>{const c=i.current,l=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(l,"checked").set;if(o!==r&&f){const d=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(d)}},[o,r,n]),E.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:i,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function p9(t){return t?"checked":"unchecked"}var EJ=f9,SJ=h9,CJ="_1lp2u8e1 _1lp2u8e0 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr1ss fyvr1uo fyvr1wk fyvr1yg fyvr11t1 fyvr11hw fyvr12v7 fyvr12o1 _4efw240",AJ="_1lp2u8e3 _1lp2u8e2 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ho fyvr1ko fyvr1oo fyvr1k fyvr140 fyvr11o1";const kJ=t=>{const{disabled:e,label:r,labelLocation:n="left",description:s,id:i,name:o,...a}=t;return E.jsx(Al,{disabled:e,display:"flex",id:i??o,label:r,labelLocation:n,description:s,whiteSpace:"nowrap",children:E.jsx(EJ,{className:CJ,disabled:e,...a,children:E.jsx(q,{position:"relative",width:"full",height:"full",children:E.jsx(SJ,{className:AJ})})})})};Nt({defaultClassName:"nwwh3z8",variantClassNames:{variant:{pill:"nwwh3z9",line:"nwwh3za nwwh3z1 fyvr11g0"},active:{true:"nwwh3zb nwwh3z2 fyvr12w5",false:"nwwh3zc"},disabled:{true:"nwwh3zd nwwh3z3 fyvr12vp"}},defaultVariants:{},compoundVariants:[[{active:!0,variant:"pill"},"nwwh3z4 fyvr11u7 fyvr12sj"],[{active:!1,variant:"pill"},"nwwh3z5 fyvr11od fyvr12s7"],[{active:!0,variant:"line"},"nwwh3z6 fyvr12s1"],[{active:!1,variant:"line"},"nwwh3z7 fyvr12s7"]]});var sC="Tabs",[TJ,V1e]=Wr(sC,[ud]),y9=ud(),[PJ,iC]=TJ(sC),RJ=v.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:c="automatic",...l}=t,u=sy(a),[f,d]=ps({prop:n,onChange:s,defaultProp:i});return E.jsx(PJ,{scope:r,baseId:us(),value:f,onValueChange:d,orientation:o,dir:u,activationMode:c,children:E.jsx(we.div,{dir:u,"data-orientation":o,...l,ref:e})})});RJ.displayName=sC;var v9="TabsList",IJ=v.forwardRef((t,e)=>{const{__scopeTabs:r,loop:n=!0,...s}=t,i=iC(v9,r),o=y9(r);return E.jsx(LS,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:n,children:E.jsx(we.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});IJ.displayName=v9;var m9="TabsTrigger",OJ=v.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...i}=t,o=iC(m9,r),a=y9(r),c=x9(o.baseId,n),l=b9(o.baseId,n),u=n===o.value;return E.jsx(jS,{asChild:!0,...a,focusable:!s,active:u,children:E.jsx(we.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":l,"data-state":u?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:ce(t.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:ce(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:ce(t.onFocus,()=>{const f=o.activationMode!=="manual";!u&&!s&&f&&o.onValueChange(n)})})})});OJ.displayName=m9;var g9="TabsContent",_J=v.forwardRef((t,e)=>{const{__scopeTabs:r,value:n,forceMount:s,children:i,...o}=t,a=iC(g9,r),c=x9(a.baseId,n),l=b9(a.baseId,n),u=n===a.value,f=v.useRef(u);return v.useEffect(()=>{const d=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(d)},[]),E.jsx(cn,{present:s||u,children:({present:d})=>E.jsx(we.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!d,id:l,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:d&&i})})});_J.displayName=g9;function x9(t,e){return`${t}-trigger-${e}`}function b9(t,e){return`${t}-content-${e}`}var NJ="_1ppqbnx1 _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc _1ppqbnx0 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1wo fyvr1yk fyvr1ss fyvr1uo fyvr11hc fyvr118c fyvr11n9";v.forwardRef((t,e)=>{const{icon:r,label:n,...s}=t;return E.jsxs(q,{className:NJ,ref:e,background:"buttonGlass",color:"text80",...s,children:[r&&E.jsx(r,{size:"xs"}),E.jsx(ue,{children:n})]})});var oC="ToastProvider",[aC,MJ,DJ]=vm("Toast"),[w9,$1e]=Wr("Toast",[DJ]),[LJ,Im]=w9(oC),E9=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=t,[a,c]=v.useState(null),[l,u]=v.useState(0),f=v.useRef(!1),d=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${oC}\`. Expected non-empty \`string\`.`),E.jsx(aC.Provider,{scope:e,children:E.jsx(LJ,{scope:e,label:r,duration:n,swipeDirection:s,swipeThreshold:i,toastCount:l,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>u(h=>h+1),[]),onToastRemove:v.useCallback(()=>u(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:d,children:o})})};E9.displayName=oC;var S9="ToastViewport",jJ=["F8"],_w="toast.viewportPause",Nw="toast.viewportResume",C9=v.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=jJ,label:s="Notifications ({hotkey})",...i}=t,o=Im(S9,r),a=MJ(r),c=v.useRef(null),l=v.useRef(null),u=v.useRef(null),f=v.useRef(null),d=$e(e,f,o.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=o.toastCount>0;v.useEffect(()=>{const g=m=>{var x;n.every(w=>m[w]||m.code===w)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]),v.useEffect(()=>{const g=c.current,m=f.current;if(p&&g&&m){const x=()=>{if(!o.isClosePausedRef.current){const O=new CustomEvent(_w);m.dispatchEvent(O),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const O=new CustomEvent(Nw);m.dispatchEvent(O),o.isClosePausedRef.current=!1}},w=O=>{!g.contains(O.relatedTarget)&&b()},A=()=>{g.contains(document.activeElement)||b()};return g.addEventListener("focusin",x),g.addEventListener("focusout",w),g.addEventListener("pointermove",x),g.addEventListener("pointerleave",A),window.addEventListener("blur",x),window.addEventListener("focus",b),()=>{g.removeEventListener("focusin",x),g.removeEventListener("focusout",w),g.removeEventListener("pointermove",x),g.removeEventListener("pointerleave",A),window.removeEventListener("blur",x),window.removeEventListener("focus",b)}}},[p,o.isClosePausedRef]);const y=v.useCallback(({tabbingDirection:g})=>{const x=a().map(b=>{const w=b.ref.current,A=[w,...JJ(w)];return g==="forwards"?A:A.reverse()});return(g==="forwards"?x.reverse():x).flat()},[a]);return v.useEffect(()=>{const g=f.current;if(g){const m=x=>{var b,w,A;const O=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!O){const C=document.activeElement,j=x.shiftKey;if(x.target===g&&j){(b=l.current)==null||b.focus();return}const z=y({tabbingDirection:j?"backwards":"forwards"}),Y=z.findIndex(H=>H===C);px(z.slice(Y+1))?x.preventDefault():j?(w=l.current)==null||w.focus():(A=u.current)==null||A.focus()}};return g.addEventListener("keydown",m),()=>g.removeEventListener("keydown",m)}},[a,y]),E.jsxs(qG,{ref:c,role:"region","aria-label":s.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:p?void 0:"none"},children:[p&&E.jsx(Mw,{ref:l,onFocusFromOutsideViewport:()=>{const g=y({tabbingDirection:"forwards"});px(g)}}),E.jsx(aC.Slot,{scope:r,children:E.jsx(we.ol,{tabIndex:-1,...i,ref:d})}),p&&E.jsx(Mw,{ref:u,onFocusFromOutsideViewport:()=>{const g=y({tabbingDirection:"backwards"});px(g)}})]})});C9.displayName=S9;var A9="ToastFocusProxy",Mw=v.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=t,i=Im(A9,r);return E.jsx(ly,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:o=>{var a;const c=o.relatedTarget;!((a=i.viewport)!=null&&a.contains(c))&&n()}})});Mw.displayName=A9;var Om="Toast",BJ="toast.swipeStart",FJ="toast.swipeMove",UJ="toast.swipeCancel",VJ="toast.swipeEnd",k9=v.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...o}=t,[a=!0,c]=ps({prop:n,defaultProp:s,onChange:i});return E.jsx(cn,{present:r||a,children:E.jsx(HJ,{open:a,...o,ref:e,onClose:()=>c(!1),onPause:Gr(t.onPause),onResume:Gr(t.onResume),onSwipeStart:ce(t.onSwipeStart,l=>{l.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(t.onSwipeMove,l=>{const{x:u,y:f}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","move"),l.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(t.onSwipeCancel,l=>{l.currentTarget.setAttribute("data-swipe","cancel"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(t.onSwipeEnd,l=>{const{x:u,y:f}=l.detail.delta;l.currentTarget.setAttribute("data-swipe","end"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),l.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),l.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),l.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});k9.displayName=Om;var[$J,zJ]=w9(Om,{onClose(){}}),HJ=v.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:f,onSwipeCancel:d,onSwipeEnd:h,...p}=t,y=Im(Om,r),[g,m]=v.useState(null),x=$e(e,H=>m(H)),b=v.useRef(null),w=v.useRef(null),A=s||y.duration,O=v.useRef(0),_=v.useRef(A),C=v.useRef(0),{onToastAdd:j,onToastRemove:V}=y,B=Gr(()=>{var H;(g==null?void 0:g.contains(document.activeElement))&&((H=y.viewport)==null||H.focus()),o()}),z=v.useCallback(H=>{!H||H===1/0||(window.clearTimeout(C.current),O.current=new Date().getTime(),C.current=window.setTimeout(B,H))},[B]);v.useEffect(()=>{const H=y.viewport;if(H){const L=()=>{z(_.current),l==null||l()},T=()=>{const P=new Date().getTime()-O.current;_.current=_.current-P,window.clearTimeout(C.current),c==null||c()};return H.addEventListener(_w,T),H.addEventListener(Nw,L),()=>{H.removeEventListener(_w,T),H.removeEventListener(Nw,L)}}},[y.viewport,A,c,l,z]),v.useEffect(()=>{i&&!y.isClosePausedRef.current&&z(A)},[i,A,y.isClosePausedRef,z]),v.useEffect(()=>(j(),()=>V()),[j,V]);const Y=v.useMemo(()=>g?_9(g):null,[g]);return y.viewport?E.jsxs(E.Fragment,{children:[Y&&E.jsx(GJ,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:Y}),E.jsx($J,{scope:r,onClose:B,children:Eo.createPortal(E.jsx(aC.ItemSlot,{scope:r,children:E.jsx(GG,{asChild:!0,onEscapeKeyDown:ce(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||B(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:E.jsx(we.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":y.swipeDirection,...p,ref:x,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ce(t.onKeyDown,H=>{H.key==="Escape"&&(a==null||a(H.nativeEvent),H.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,B()))}),onPointerDown:ce(t.onPointerDown,H=>{H.button===0&&(b.current={x:H.clientX,y:H.clientY})}),onPointerMove:ce(t.onPointerMove,H=>{if(!b.current)return;const L=H.clientX-b.current.x,T=H.clientY-b.current.y,P=!!w.current,R=["left","right"].includes(y.swipeDirection),I=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,U=R?I(0,L):0,F=R?0:I(0,T),X=H.pointerType==="touch"?10:2,oe={x:U,y:F},ae={originalEvent:H,delta:oe};P?(w.current=oe,c1(FJ,f,ae,{discrete:!1})):HR(oe,y.swipeDirection,X)?(w.current=oe,c1(BJ,u,ae,{discrete:!1}),H.target.setPointerCapture(H.pointerId)):(Math.abs(L)>X||Math.abs(T)>X)&&(b.current=null)}),onPointerUp:ce(t.onPointerUp,H=>{const L=w.current,T=H.target;if(T.hasPointerCapture(H.pointerId)&&T.releasePointerCapture(H.pointerId),w.current=null,b.current=null,L){const P=H.currentTarget,R={originalEvent:H,delta:L};HR(L,y.swipeDirection,y.swipeThreshold)?c1(VJ,h,R,{discrete:!0}):c1(UJ,d,R,{discrete:!0}),P.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),GJ=t=>{const{__scopeToast:e,children:r,...n}=t,s=Im(Om,e),[i,o]=v.useState(!1),[a,c]=v.useState(!1);return QJ(()=>o(!0)),v.useEffect(()=>{const l=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(l)},[]),a?null:E.jsx(oy,{asChild:!0,children:E.jsx(ly,{...n,children:i&&E.jsxs(E.Fragment,{children:[s.label," ",r]})})})},qJ="ToastTitle",T9=v.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return E.jsx(we.div,{...n,ref:e})});T9.displayName=qJ;var WJ="ToastDescription",P9=v.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return E.jsx(we.div,{...n,ref:e})});P9.displayName=WJ;var R9="ToastAction",KJ=v.forwardRef((t,e)=>{const{altText:r,...n}=t;return r.trim()?E.jsx(O9,{altText:r,asChild:!0,children:E.jsx(cC,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${R9}\`. Expected non-empty \`string\`.`),null)});KJ.displayName=R9;var I9="ToastClose",cC=v.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,s=zJ(I9,r);return E.jsx(O9,{asChild:!0,children:E.jsx(we.button,{type:"button",...n,ref:e,onClick:ce(t.onClick,s.onClose)})})});cC.displayName=I9;var O9=v.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...s}=t;return E.jsx(we.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:e})});function _9(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),YJ(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=n.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(..._9(n))}}),e}function c1(t,e,r,{discrete:n}){const s=r.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&s.addEventListener(t,e,{once:!0}),n?vS(s,i):s.dispatchEvent(i)}var HR=(t,e,r=0)=>{const n=Math.abs(t.x),s=Math.abs(t.y),i=n>s;return e==="left"||e==="right"?i&&n>r:!i&&s>r};function QJ(t=()=>{}){const e=Gr(t);Tr(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function YJ(t){return t.nodeType===t.ELEMENT_NODE}function JJ(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function px(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var XJ=E9,ZJ=C9,eX=k9,tX=T9,rX=P9,nX=cC,sX="_6wut8v1 _6wut8v0 fyvr12wp fyvr12wj fyvr11hs fyvr1qo fyvr1mo fyvr128 fyvr118g fyvr11i4 fyvr11h0",iX=Nt({defaultClassName:"_6wut8v3",variantClassNames:{variant:{normal:"_6wut8v4",success:"_6wut8v5",error:"_6wut8v6"}},defaultVariants:{},compoundVariants:[]});const N9=v.createContext(null),oX=t=>{const{children:e,...r}=t,[n,s]=v.useState(new Set);return E.jsxs(XJ,{...r,children:[E.jsxs(N9.Provider,{value:s,children:[e,E.jsx(yS,{children:Array.from(n).map(i=>E.jsx(cX,{...i},i.id))})]}),E.jsx(aX,{})]})},aX=()=>E.jsx(ZJ,{className:sX}),cX=t=>{const{id:e,variant:r,title:n,description:s,icon:i,isDismissible:o=!0,...a}=t,c=()=>{if(i)return E.jsx(i,{});switch(r){case"success":return E.jsx(q,{background:"positive",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:E.jsx(gS,{})});case"error":return E.jsx(q,{background:"negative",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:E.jsx(Gh,{})});default:return null}};return E.jsx(eX,{className:iX({variant:r}),open:!0,forceMount:!0,asChild:!0,...a,children:E.jsxs(YH,{as:Xc.li,layoutId:e,layout:!0,initial:{x:"100%"},animate:{x:0},exit:{y:"100%",opacity:0},borderRadius:"md",background:"buttonGlass",backdropFilter:"blur",position:"relative",width:"full",justifyContent:"space-between",children:[E.jsxs(q,{gap:"3",alignItems:"center",children:[c(),E.jsxs(q,{flexDirection:"column",gap:"1",children:[n&&E.jsx(tX,{children:E.jsx(ue,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:n})}),E.jsx(rX,{children:E.jsx(ue,{as:"div",variant:"normal",fontWeight:"medium",color:"text50",children:s})})]})]}),o&&E.jsx(nX,{"aria-label":"Close",asChild:!0,children:E.jsx(Am,{icon:Gh,size:"xs"})})]})})},M9=()=>{const t=v.useContext(N9);return e=>{const r={...e,id:Math.random().toString(36).slice(2,12),onOpenChange:n=>{n||t(s=>(s.delete(r),new Set([...s])))}};t(n=>new Set([...n,r]))}};var lX="_15pztn1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 _15pztn0 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11ko fyvr11od fyvr12s1 fyvr12o1 fyvr12wj fyvr128 fyvr11h0",uX="_15pztn2";v.forwardRef((t,e)=>{const{as:r="textarea",autoComplete:n="off",borderRadius:s="md",description:i,disabled:o=!1,id:a,label:c="",labelLocation:l="hidden",name:u,rows:f,resize:d=!1,...h}=t;return E.jsx(Al,{description:i,disabled:o,display:"grid",id:a??u,label:c,labelLocation:l,children:E.jsx(q,{as:r,autoComplete:n,spellCheck:"false",className:qr(lX,d&&uX),disabled:o,id:a??u,name:u,ref:e,rows:f,borderRadius:s,...h})})});var fX=Nt({defaultClassName:"_18h918k5 _18h918k0 fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11h0",variantClassNames:{size:{xs:"_18h918k6",sm:"_18h918k7",md:"_18h918k8",lg:"_18h918k9",xl:"_18h918ka"},borderRadius:{circle:"_18h918kb _18h918k1 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co",lg:"_18h918kc _18h918k2 fyvr11d8 fyvr11dw fyvr11bw fyvr11ck",md:"_18h918kd _18h918k3 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg",sm:"_18h918ke _18h918k4 fyvr11d0 fyvr11do fyvr11bo fyvr11cc"}},defaultVariants:{},compoundVariants:[]}),dX="_18h918kf";const hX=v.memo(t=>{const{chainId:e,borderRadius:r="circle",className:n,disableAnimation:s=!1,style:i,src:o,size:a="md",...c}=t,l=o||UH(VH(e),a);return E.jsx(q,{className:qr(n,fX({borderRadius:r,size:a})),style:i,flexShrink:"0",...c,children:E.jsx(uN,{className:dX,disableAnimation:s,src:l})})});var pX=Nt({defaultClassName:"bnrreb1 bnrreb0 fyvr11jg fyvr11ko fyvr11hw fyvr11h0",variantClassNames:{size:{xs:"bnrreb2",sm:"bnrreb3",md:"bnrreb4",lg:"bnrreb5",xl:"bnrreb6"}},defaultVariants:{},compoundVariants:[]}),yX="bnrreb7",vX="bnrreb9 bnrreb8 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11sj fyvr128 fyvr15o fyvr11h0";const mX=v.memo(t=>{const{borderRadius:e="circle",className:r,disableAnimation:n=!1,style:s,src:i,symbol:o,size:a="md",withNetwork:c,...l}=t;return E.jsxs(q,{className:qr(r,pX({size:a})),style:s,flexShrink:"0",...l,children:[i?E.jsx(uN,{className:yX,disableAnimation:n,borderRadius:e,overflow:"hidden",src:i}):E.jsx(ue,{className:vX,variant:"normal",fontWeight:"medium",color:"text50",borderRadius:e,overflow:"hidden",uppercase:!0,children:o==null?void 0:o.replace(/\s/,"").slice(0,4)}),c&&E.jsx(q,{position:"absolute",zIndex:"1",borderRadius:"circle",borderWidth:"thin",borderStyle:"solid",borderColor:"backgroundPrimary",background:"backgroundPrimary",placeItems:"center",style:{width:16+2,height:16+2,right:-2,bottom:-2},children:E.jsx(hX,{chainId:c,style:{width:16,height:16}})})]})});var[_m,z1e]=Wr("Tooltip",[ld]),Nm=ld(),D9="TooltipProvider",gX=700,Dw="tooltip.open",[xX,lC]=_m(D9),bX=t=>{const{__scopeTooltip:e,delayDuration:r=gX,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:i}=t,[o,a]=v.useState(!0),c=v.useRef(!1),l=v.useRef(0);return v.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),E.jsx(xX,{scope:e,isOpenDelayed:o,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(l.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(u=>{c.current=u},[]),disableHoverableContent:s,children:i})};bX.displayName=D9;var Mm="Tooltip",[wX,fy]=_m(Mm),EX=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:s=!1,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,c=lC(Mm,t.__scopeTooltip),l=Nm(e),[u,f]=v.useState(null),d=us(),h=v.useRef(0),p=o??c.disableHoverableContent,y=a??c.delayDuration,g=v.useRef(!1),[m=!1,x]=ps({prop:n,defaultProp:s,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(Dw))):c.onClose(),i==null||i(_)}}),b=v.useMemo(()=>m?g.current?"delayed-open":"instant-open":"closed",[m]),w=v.useCallback(()=>{window.clearTimeout(h.current),g.current=!1,x(!0)},[x]),A=v.useCallback(()=>{window.clearTimeout(h.current),x(!1)},[x]),O=v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{g.current=!0,x(!0)},y)},[y,x]);return v.useEffect(()=>()=>window.clearTimeout(h.current),[]),E.jsx(_S,{...l,children:E.jsx(wX,{scope:e,contentId:d,open:m,stateAttribute:b,trigger:u,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?O():w()},[c.isOpenDelayed,O,w]),onTriggerLeave:v.useCallback(()=>{p?A():window.clearTimeout(h.current)},[A,p]),onOpen:w,onClose:A,disableHoverableContent:p,children:r})})};EX.displayName=Mm;var Lw="TooltipTrigger",SX=v.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=fy(Lw,r),i=lC(Lw,r),o=Nm(r),a=v.useRef(null),c=$e(e,a,s.onTriggerChange),l=v.useRef(!1),u=v.useRef(!1),f=v.useCallback(()=>l.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),E.jsx(NS,{asChild:!0,...o,children:E.jsx(we.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(t.onPointerMove,d=>{d.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:ce(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:ce(t.onPointerDown,()=>{l.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(t.onFocus,()=>{l.current||s.onOpen()}),onBlur:ce(t.onBlur,s.onClose),onClick:ce(t.onClick,s.onClose)})})});SX.displayName=Lw;var uC="TooltipPortal",[CX,AX]=_m(uC,{forceMount:void 0}),kX=t=>{const{__scopeTooltip:e,forceMount:r,children:n,container:s}=t,i=fy(uC,e);return E.jsx(CX,{scope:e,forceMount:r,children:E.jsx(cn,{present:r||i.open,children:E.jsx(oy,{asChild:!0,container:s,children:n})})})};kX.displayName=uC;var Ff="TooltipContent",TX=v.forwardRef((t,e)=>{const r=AX(Ff,t.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...i}=t,o=fy(Ff,t.__scopeTooltip);return E.jsx(cn,{present:n||o.open,children:o.disableHoverableContent?E.jsx(L9,{side:s,...i,ref:e}):E.jsx(PX,{side:s,...i,ref:e})})}),PX=v.forwardRef((t,e)=>{const r=fy(Ff,t.__scopeTooltip),n=lC(Ff,t.__scopeTooltip),s=v.useRef(null),i=$e(e,s),[o,a]=v.useState(null),{trigger:c,onClose:l}=r,u=s.current,{onPointerInTransitChange:f}=n,d=v.useCallback(()=>{a(null),f(!1)},[f]),h=v.useCallback((p,y)=>{const g=p.currentTarget,m={x:p.clientX,y:p.clientY},x=_X(m,g.getBoundingClientRect()),b=NX(m,x),w=MX(y.getBoundingClientRect()),A=LX([...b,...w]);a(A),f(!0)},[f]);return v.useEffect(()=>()=>d(),[d]),v.useEffect(()=>{if(c&&u){const p=g=>h(g,u),y=g=>h(g,c);return c.addEventListener("pointerleave",p),u.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",y)}}},[c,u,h,d]),v.useEffect(()=>{if(o){const p=y=>{const g=y.target,m={x:y.clientX,y:y.clientY},x=(c==null?void 0:c.contains(g))||(u==null?void 0:u.contains(g)),b=!DX(m,o);x?d():b&&(d(),l())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,u,o,l,d]),E.jsx(L9,{...t,ref:i})}),[RX,IX]=_m(Mm,{isInside:!1}),L9=v.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=t,c=fy(Ff,r),l=Nm(r),{onClose:u}=c;return v.useEffect(()=>(document.addEventListener(Dw,u),()=>document.removeEventListener(Dw,u)),[u]),v.useEffect(()=>{if(c.trigger){const f=d=>{const h=d.target;h!=null&&h.contains(c.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,u]),E.jsx(od,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:E.jsxs(MS,{"data-state":c.stateAttribute,...l,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[E.jsx(U6,{children:n}),E.jsx(RX,{scope:r,isInside:!0,children:E.jsx(MY,{id:c.contentId,role:"tooltip",children:s||n})})]})})});TX.displayName=Ff;var j9="TooltipArrow",OX=v.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,s=Nm(r);return IX(j9,r).isInside?null:E.jsx(DS,{...s,...n,ref:e})});OX.displayName=j9;function _X(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,n,s,i)){case i:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function NX(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function MX(t){const{top:e,right:r,bottom:n,left:s}=t;return[{x:s,y:e},{x:r,y:e},{x:r,y:n},{x:s,y:n}]}function DX(t,e){const{x:r,y:n}=t;let s=!1;for(let i=0,o=e.length-1;in!=u>n&&r<(l-a)*(n-c)/(u-c)+a&&(s=!s)}return s}function LX(t){const e=t.slice();return e.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),jX(e)}function jX(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const s=t[n];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))r.pop();else break}r.push(s)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}/** * @remix-run/router v1.19.2 * * Copyright (c) Remix Software Inc. @@ -163,14 +163,14 @@ Defaulting to \`null\`.`}var eC="Radio",[gY,ON]=Wr(eC),[xY,bY]=gY(eC),_N=v.forwa color: #FFF; border-color: #FFF; }`.replace(/ {2}|\n/g,""),Mee=function(e){var r=e.onSuccess,n=e.onError,s=e.skipScript,i=s===void 0?!1:s,o=e.authOptions,a=e.iconProps,c=e.render,l=e.uiType,u=l===void 0?"dark":l,f=e.className,d=e.noDefaultStyle,h=d===void 0?!1:d,p=e.buttonExtraChildren,y=p===void 0?"Continue with Apple":p,g=Oee(e,Pee);(0,Tee.default)(i?null:f4.default.APPLE_SCRIPT_SRC);var m=function(w){w&&(w.preventDefault(),w.stopPropagation()),f4.default.signIn({authOptions:o,onSuccess:r,onError:n})},x=Ree({children:Gs.default.createElement(Gs.default.Fragment,null,Gs.default.createElement("svg",a0({width:"24px",height:"44px",viewBox:"0 0 24 44"},a),Gs.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},Gs.default.createElement("rect",{fill:u==="light"?"#FFF":"#000",x:"0",y:"0",width:"24",height:"44"}),Gs.default.createElement("path",{d:"M12.2337427,16.9879688 C12.8896607,16.9879688 13.7118677,16.5445313 14.2014966,15.9532812 C14.6449341,15.4174609 14.968274,14.6691602 14.968274,13.9208594 C14.968274,13.8192383 14.9590357,13.7176172 14.9405591,13.6344727 C14.2107349,13.6621875 13.3330982,14.1241016 12.8065162,14.7430664 C12.3907935,15.2142188 12.012024,15.9532812 12.012024,16.7108203 C12.012024,16.8216797 12.0305005,16.9325391 12.0397388,16.9694922 C12.0859302,16.9787305 12.1598365,16.9879688 12.2337427,16.9879688 Z M9.92417241,28.1662891 C10.8202857,28.1662891 11.2175318,27.5658008 12.3353638,27.5658008 C13.4716724,27.5658008 13.721106,28.1478125 14.7188404,28.1478125 C15.6980982,28.1478125 16.3540162,27.2424609 16.972981,26.3555859 C17.6658521,25.339375 17.9522388,24.3416406 17.9707154,24.2954492 C17.9060474,24.2769727 16.0306763,23.5101953 16.0306763,21.3576758 C16.0306763,19.491543 17.5088013,18.6508594 17.5919459,18.5861914 C16.612688,17.1819727 15.1253248,17.1450195 14.7188404,17.1450195 C13.6194849,17.1450195 12.7233716,17.8101758 12.1598365,17.8101758 C11.5501099,17.8101758 10.7463794,17.1819727 9.79483648,17.1819727 C7.98413335,17.1819727 6.14571538,18.6785742 6.14571538,21.5054883 C6.14571538,23.2607617 6.8293482,25.1176563 7.67003179,26.3186328 C8.39061773,27.3348438 9.01882085,28.1662891 9.92417241,28.1662891 Z",fill:u==="light"?"#000":"#FFF",fillRule:"nonzero"}))),y),onClick:m},g);return c?c(x):Gs.default.createElement(Gs.default.Fragment,null,Gs.default.createElement("button",a0({className:"".concat(h?"":"react-apple-signin-auth-btn react-apple-signin-auth-btn-".concat(u)).concat(f?" ".concat(f):""),type:"button","aria-label":"Signin with apple ID"},x)),h?null:Gs.default.createElement("style",null,Nee))},Dee=Mee;Bm.default=Dee;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"appleAuthHelpers",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"useScript",{enumerable:!0,get:function(){return n.default}}),t.default=void 0;var e=s(Bm),r=s(yy),n=s(py);function s(o){return o&&o.__esModule?o:{default:o}}var i=e.default;t.default=i})(t7);const r7=X2(t7);var Lee="_1csw4y80 _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8";const n7=t=>{const{value:e,digits:r=6,onChange:n,disabled:s=!1}=t,i=v.useMemo(()=>h4(0,r).map(()=>v.createRef()),[]);v.useEffect(()=>{var l,u;(u=(l=i[0])==null?void 0:l.current)==null||u.focus()},[]);const o=(l,u)=>{var d,h;/^\d$/.test(u)||(u="");const f=[...e];f[l]=u,u!==""&&((h=(d=i[l+1])==null?void 0:d.current)==null||h.focus()),n(f)},a=(l,u)=>{var p,y;const f=i[l].current,d=(p=i[l-1])==null?void 0:p.current,h=(y=i[l+1])==null?void 0:y.current;switch(u.key){case"Backspace":u.preventDefault(),f&&(f.value="",o(l,"")),d==null||d.focus();break;case"ArrowLeft":u.preventDefault(),d==null||d.focus();break;case"ArrowRight":u.preventDefault(),h==null||h.focus();break;default:(f==null?void 0:f.value)===u.key&&(u.preventDefault(),o(l,u.key))}},c=(l,u)=>{var h,p;const d=u.clipboardData.getData("text/plain").replace(/\D/g,"");/^\d{6}$/.test(d)&&((p=(h=i[0])==null?void 0:h.current)==null||p.focus(),n(d.split("")),setTimeout(()=>{var y,g;(g=(y=i[i.length-1])==null?void 0:y.current)==null||g.focus()}))};return k.jsx(q,{gap:"2",children:h4(0,r).map(l=>k.jsxs(v.Fragment,{children:[l===r/2&&k.jsx("span",{}),k.jsx(q,{as:"input",className:Lee,value:e[l]||"",ref:i[l],type:"text",inputMode:"numeric",maxLength:1,disabled:s,onFocus:u=>u.target.select(),onPaste:u=>c(l,u),onChange:u=>o(l,u.target.value),onKeyDown:u=>{a(l,u)}})]},l))})},h4=(t,e)=>Array.from({length:e-t},(r,n)=>n+t),s7=()=>k.jsxs(q,{gap:"2",flexDirection:"column",borderStyle:"solid",width:"1/3",padding:"4",borderWidth:"thin",borderColor:"borderNormal",borderRadius:"sm",children:[k.jsx(ue,{variant:"xlarge",fontWeight:"bold",color:"gnosisLight",children:"Demo App"}),k.jsx(ue,{variant:"normal",marginLeft:"auto",color:"polygonLight",children:"Showcasing WaaS"})]}),i7="6.13.2";function jee(t,e,r){const n=e.split("|").map(i=>i.trim());for(let i=0;iPromise.resolve(t[n])))).reduce((n,s,i)=>(n[e[i]]=s,n),{})}function me(t,e,r){for(let n in e){let s=e[n];const i=r?r[n]:null;i&&jee(s,i,n),Object.defineProperty(t,n,{enumerable:!0,value:s,writable:!1})}}function hu(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(hu).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let n=0;n>4],r+=e[t[n]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return hu(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(r=>`${hu(r)}: ${hu(t[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Vr(t,e){return t&&t.code===e}function vC(t){return Vr(t,"CALL_EXCEPTION")}function Lt(t,e,r){let n=t;{const i=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${hu(r)}`);for(const o in r){if(o==="shortMessage")continue;const a=r[o];i.push(o+"="+hu(a))}}i.push(`code=${e}`),i.push(`version=${i7}`),i.length&&(t+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return me(s,{code:e}),r&&Object.assign(s,r),s.shortMessage==null&&me(s,{shortMessage:n}),s}function J(t,e,r,n){if(!t)throw Lt(e,r,n)}function M(t,e,r,n){J(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function o7(t,e,r){r==null&&(r=""),r&&(r=": "+r),J(t>=e,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),J(t<=e,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const Bee=["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"){const r=String.fromCharCode(233).normalize("NFD"),n=String.fromCharCode(101,769);if(r!==n)throw new Error("broken")}t.push(e)}catch{}return t},[]);function a7(t){J(Bee.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function $a(t,e,r){if(r==null&&(r=""),t!==e){let n=r,s="new";r&&(n+=".",s+=" "+r),J(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function c7(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((t.length-2)/2);let s=2;for(let i=0;i>4]+p4[s&15]}return r}function ot(t){return"0x"+t.map(e=>ne(e).substring(2)).join("")}function Ru(t){return vt(t,!0)?(t.length-2)/2:fe(t).length}function xt(t,e,r){const n=fe(t);return r!=null&&r>n.length&&J(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),ne(n.slice(e??0,r??n.length))}function l7(t,e,r){const n=fe(t);J(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),r?s.set(n,e-n.length):s.set(n,0),ne(s)}function pl(t,e){return l7(t,e,!0)}function Fee(t,e){return l7(t,e,!1)}const Vm=BigInt(0),Ns=BigInt(1),pu=9007199254740991;function c0(t,e){const r=$m(t,"value"),n=BigInt(_e(e,"width"));if(J(r>>n===Vm,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-Ns){const s=(Ns<=-pu&&t<=pu,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){M(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}M(!1,"invalid BigNumberish value",e||"value",t)}function $m(t,e){const r=ye(t,e);return J(r>=Vm,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const y4="0123456789abcdef";function vy(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=y4[r>>4],e+=y4[r&15];return BigInt(e)}return ye(t)}function _e(t,e){switch(typeof t){case"bigint":return M(t>=-pu&&t<=pu,"overflow",e||"value",t),Number(t);case"number":return M(Number.isInteger(t),"underflow",e||"value",t),M(t>=-pu&&t<=pu,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return _e(BigInt(t),e)}catch(r){M(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}M(!1,"invalid numeric value",e||"value",t)}function Uee(t){return _e(vy(t))}function go(t,e){let n=$m(t,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const s=_e(e,"width");for(J(s*2>=n.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length>6===2;o++)i++;return i}return t==="OVERRUN"?r.length-e-1:0}function Wee(t,e,r,n,s){return t==="OVERLONG"?(M(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),n.push(s),0):(n.push(65533),h7(t,e,r))}const Kee=Object.freeze({error:qee,ignore:h7,replace:Wee});function Qee(t,e){e==null&&(e=Kee.error);const r=fe(t,"bytes"),n=[];let s=0;for(;s>7)){n.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,r,n):s+=e("BAD_PREFIX",s-1,r,n);continue}if(s-1+o>=r.length){s+=e("OVERRUN",s-1,r,n);continue}let c=i&(1<<8-o-1)-1;for(let l=0;l1114111){s+=e("OUT_OF_RANGE",s-1-o,r,n,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-o,r,n,c);continue}if(c<=a){s+=e("OVERLONG",s-1-o,r,n,c);continue}n.push(c)}}return n}function Sr(t,e){M(typeof t=="string","invalid string value","str",t),e!=null&&(a7(e),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(s&63|128);else if((s&64512)==55296){n++;const i=t.charCodeAt(n);M(n>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128)}return new Uint8Array(r)}function Yee(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function u0(t,e){return Yee(Qee(t,e))}function p7(t){async function e(r,n){J(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const s=r.url.split(":")[0].toLowerCase();J(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),J(s==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=Lt("request timeout","TIMEOUT"),o.abort()},r.timeout);n&&n.addListener(()=>{i=Lt("request cancelled","CANCELLED"),o.abort()});const c={method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:o.signal};let l;try{l=await fetch(r.url,c)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const u={};l.headers.forEach((h,p)=>{u[p.toLowerCase()]=h});const f=await l.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:l.status,statusMessage:l.statusText,headers:u,body:d}}return e}const Jee=12,Xee=250;let v4=p7();const Zee=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),ete=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let gx=!1;async function y7(t,e){try{const r=t.match(Zee);if(!r)throw new Error("invalid data");return new Ea(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?Hee(r[3]):rte(r[3]))}catch{return new Ea(599,"BAD REQUEST (invalid data: URI)",{},null,new xo(t))}}function v7(t){async function e(r,n){try{const s=r.match(ete);if(!s)throw new Error("invalid link");return new xo(`${t}${s[2]}`)}catch{return new Ea(599,"BAD REQUEST (invalid IPFS URI)",{},null,new xo(r))}}return e}const f1={data:y7,ipfs:v7("https://gateway.ipfs.io/ipfs/")},m7=new WeakMap;var kc,Go;class tte{constructor(e){W(this,kc,void 0);W(this,Go,void 0);N(this,kc,[]),N(this,Go,!1),m7.set(e,()=>{if(!S(this,Go)){N(this,Go,!0);for(const r of S(this,kc))setTimeout(()=>{r()},0);N(this,kc,[])}})}addListener(e){J(!S(this,Go),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),S(this,kc).push(e)}get cancelled(){return S(this,Go)}checkSignal(){J(!this.cancelled,"cancelled","CANCELLED",{})}}kc=new WeakMap,Go=new WeakMap;function d1(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var Bu,Fu,Cs,Vi,Uu,Vu,or,kn,$i,Tc,Pc,Rc,Xs,As,qo,Ic,Jd;const D0=class D0{constructor(e){W(this,Ic);W(this,Bu,void 0);W(this,Fu,void 0);W(this,Cs,void 0);W(this,Vi,void 0);W(this,Uu,void 0);W(this,Vu,void 0);W(this,or,void 0);W(this,kn,void 0);W(this,$i,void 0);W(this,Tc,void 0);W(this,Pc,void 0);W(this,Rc,void 0);W(this,Xs,void 0);W(this,As,void 0);W(this,qo,void 0);N(this,Vu,String(e)),N(this,Bu,!1),N(this,Fu,!0),N(this,Cs,{}),N(this,Vi,""),N(this,Uu,3e5),N(this,As,{slotInterval:Xee,maxAttempts:Jee}),N(this,qo,null)}get url(){return S(this,Vu)}set url(e){N(this,Vu,String(e))}get body(){return S(this,or)==null?null:new Uint8Array(S(this,or))}set body(e){if(e==null)N(this,or,void 0),N(this,kn,void 0);else if(typeof e=="string")N(this,or,Sr(e)),N(this,kn,"text/plain");else if(e instanceof Uint8Array)N(this,or,e),N(this,kn,"application/octet-stream");else if(typeof e=="object")N(this,or,Sr(JSON.stringify(e))),N(this,kn,"application/json");else throw new Error("invalid body")}hasBody(){return S(this,or)!=null}get method(){return S(this,Vi)?S(this,Vi):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),N(this,Vi,String(e).toUpperCase())}get headers(){const e=Object.assign({},S(this,Cs));return S(this,$i)&&(e.authorization=`Basic ${Gee(Sr(S(this,$i)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&S(this,kn)&&(e["content-type"]=S(this,kn)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){S(this,Cs)[String(e).toLowerCase()]=String(r)}clearHeaders(){N(this,Cs,{})}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",e),N(this,Uu,e)}get preflightFunc(){return S(this,Tc)||null}set preflightFunc(e){N(this,Tc,e)}get processFunc(){return S(this,Pc)||null}set processFunc(e){N(this,Pc,e)}get retryFunc(){return S(this,Rc)||null}set retryFunc(e){N(this,Rc,e)}get getUrlFunc(){return S(this,qo)||v4}set getUrlFunc(e){N(this,qo,e)}toString(){return``}setThrottleParams(e){e.slotInterval!=null&&(S(this,As).slotInterval=e.slotInterval),e.maxAttempts!=null&&(S(this,As).maxAttempts=e.maxAttempts)}send(){return J(S(this,Xs)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),N(this,Xs,new tte(this)),ee(this,Ic,Jd).call(this,0,m4()+this.timeout,0,this,new Ea(0,"",{},null,this))}cancel(){J(S(this,Xs)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=m7.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();J(this.method==="GET"&&(r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new D0(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,N(s,Cs,Object.assign({},S(this,Cs))),S(this,or)&&N(s,or,new Uint8Array(S(this,or))),N(s,kn,S(this,kn)),s}clone(){const e=new D0(this.url);return N(e,Vi,S(this,Vi)),S(this,or)&&N(e,or,S(this,or)),N(e,kn,S(this,kn)),N(e,Cs,Object.assign({},S(this,Cs))),N(e,$i,S(this,$i)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),N(e,Tc,S(this,Tc)),N(e,Pc,S(this,Pc)),N(e,Rc,S(this,Rc)),N(e,As,Object.assign({},S(this,As))),N(e,qo,S(this,qo)),e}static lockConfig(){gx=!0}static getGateway(e){return f1[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(gx)throw new Error("gateways locked");f1[e]=r}static registerGetUrl(e){if(gx)throw new Error("gateways locked");v4=e}static createGetUrlFunc(e){return p7()}static createDataGateway(){return y7}static createIpfsGatewayFunc(e){return v7(e)}};Bu=new WeakMap,Fu=new WeakMap,Cs=new WeakMap,Vi=new WeakMap,Uu=new WeakMap,Vu=new WeakMap,or=new WeakMap,kn=new WeakMap,$i=new WeakMap,Tc=new WeakMap,Pc=new WeakMap,Rc=new WeakMap,Xs=new WeakMap,As=new WeakMap,qo=new WeakMap,Ic=new WeakSet,Jd=async function(e,r,n,s,i){var u,f,d;if(e>=S(this,As).maxAttempts)return i.makeServerError("exceeded maximum retry limit");J(m4()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),n>0&&await nte(n);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in f1){const h=await f1[a](o.url,d1(S(s,Xs)));if(h instanceof Ea){let p=h;if(this.processFunc){d1(S(s,Xs));try{p=await this.processFunc(o,p)}catch(y){(y.throttle==null||typeof y.stall!="number")&&p.makeServerError("error in post-processing function",y).assertOk()}}return p}o=h}this.preflightFunc&&(o=await this.preflightFunc(o));const c=await this.getUrlFunc(o,d1(S(s,Xs)));let l=new Ea(c.statusCode,c.statusMessage,c.headers,c.body,s);if(l.statusCode===301||l.statusCode===302){try{const h=l.headers.location||"";return ee(u=o.redirect(h),Ic,Jd).call(u,e+1,r,0,s,l)}catch{}return l}else if(l.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,l,e))){const h=l.headers["retry-after"];let p=S(this,As).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),ee(f=o.clone(),Ic,Jd).call(f,e+1,r,p,s,l)}if(this.processFunc){d1(S(s,Xs));try{l=await this.processFunc(o,l)}catch(h){(h.throttle==null||typeof h.stall!="number")&&l.makeServerError("error in post-processing function",h).assertOk();let p=S(this,As).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),ee(d=o.clone(),Ic,Jd).call(d,e+1,r,p,s,l)}}return l};let xo=D0;var Ep,Sp,Cp,Tn,$u,Oc;const _k=class _k{constructor(e,r,n,s,i){W(this,Ep,void 0);W(this,Sp,void 0);W(this,Cp,void 0);W(this,Tn,void 0);W(this,$u,void 0);W(this,Oc,void 0);N(this,Ep,e),N(this,Sp,r),N(this,Cp,Object.keys(n).reduce((o,a)=>(o[a.toLowerCase()]=String(n[a]),o),{})),N(this,Tn,s==null?null:new Uint8Array(s)),N(this,$u,i||null),N(this,Oc,{message:""})}toString(){return``}get statusCode(){return S(this,Ep)}get statusMessage(){return S(this,Sp)}get headers(){return Object.assign({},S(this,Cp))}get body(){return S(this,Tn)==null?null:new Uint8Array(S(this,Tn))}get bodyText(){try{return S(this,Tn)==null?"":u0(S(this,Tn))}catch{J(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{J(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw me(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return S(this,Tn)!=null}get request(){return S(this,$u)}ok(){return S(this,Oc).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:r}=S(this,Oc);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let s=null;try{S(this,Tn)&&(s=u0(S(this,Tn)))}catch{}J(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r,info:{requestUrl:n,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};Ep=new WeakMap,Sp=new WeakMap,Cp=new WeakMap,Tn=new WeakMap,$u=new WeakMap,Oc=new WeakMap;let Ea=_k;function m4(){return new Date().getTime()}function rte(t){return Sr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function nte(t){return new Promise(e=>setTimeout(e,t))}const ste=BigInt(-1),xs=BigInt(0),vu=BigInt(1),ite=BigInt(5),Bl={};let Iu="0000";for(;Iu.length<80;)Iu+=Iu;function Xa(t){let e=Iu;for(;e.length=-s&&txs?t=c0(bc(t,n),n):t=-c0(bc(-t,n),n)}else{const s=vu<=0&&ti[a]==null?l:(M(typeof i[a]===c,"invalid fixed format ("+a+" not "+c+")","format."+a,i[a]),i[a]);e=o("signed","boolean",e),r=o("width","number",r),n=o("decimals","number",n)}M(r%8===0,"invalid FixedNumber width (not byte aligned)","format.width",r),M(n<=80,"invalid FixedNumber decimals (too large)","format.decimals",n);const s=(e?"":"u")+"fixed"+String(r)+"x"+String(n);return{signed:e,width:r,decimals:n,name:s}}function ote(t,e){let r="";t0?n*=Xa(s):s<0&&(r*=Xa(-s)),rn?1:0}eq(e){return this.cmp(e)===0}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=S(this,st);return S(this,st)xs&&(e+=S(this,Yr)-vu),e=S(this,st)/S(this,Yr)*S(this,Yr),ee(this,Ts,Ii).call(this,e,"ceiling")}round(e){if(e==null&&(e=0),e>=this.decimals)return this;const r=this.decimals-e,n=ite*Xa(r-1);let s=this.value+n;const i=Xa(r);return s=s/i*i,jd(s,S(this,ks),"round"),new $o(Bl,s,S(this,ks))}isZero(){return S(this,st)===xs}isNegative(){return S(this,st)0){const c=Xa(a);J(o%c===xs,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),o/=c}else a<0&&(o*=Xa(-a));return jd(o,i,"fromValue"),new $o(Bl,o,i)}static fromString(e,r){const n=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);M(n&&n[2].length+n[3].length>0,"invalid FixedNumber string value","value",e);const s=xx(r);let i=n[2]||"0",o=n[3]||"";for(;o.length{J(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const s=g4(t,e+1,n);return r(e+1+n+s),x4(t,e,e+1+n,n+s)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),x4(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const s=g4(t,e+1,n);r(e+1+n+s);const i=ne(t.slice(e+1+n,e+1+n+s));return{consumed:1+n+s,result:i}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const s=ne(t.slice(e+1,e+1+n));return{consumed:1+n,result:s}}return{consumed:1,result:ate(t[e])}}function zm(t){const e=fe(t,"data"),r=g7(e,0);return M(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function b4(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function x7(t){if(Array.isArray(t)){let n=[];if(t.forEach(function(i){n=n.concat(x7(i))}),n.length<=55)return n.unshift(192+n.length),n;const s=b4(n.length);return s.unshift(247+s.length),s.concat(n)}const e=Array.prototype.slice.call(fe(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=b4(e.length);return r.unshift(183+r.length),r.concat(e)}const w4="0123456789abcdef";function yl(t){let e="0x";for(const r of x7(t))e+=w4[r>>4],e+=w4[r&15];return e}const b7=["wei","kwei","mwei","gwei","szabo","finney","ether"];function mC(t,e){let r=18;if(typeof e=="string"){const n=b7.indexOf(e);M(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=_e(e,"unit"));return f0.fromValue(t,r,{decimals:r,width:512}).toString()}function Xh(t,e){M(typeof t=="string","value must be a string","value",t);let r=18;if(typeof e=="string"){const n=b7.indexOf(e);M(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=_e(e,"unit"));return f0.fromString(t,{decimals:r,width:512}).value}function cte(t){return mC(t,18)}function E4(t){return Xh(t,18)}function lte(t){const e=fe(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=ne(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const rn=32,Gw=new Uint8Array(rn),ute=["then"],h1={},w7=new WeakMap;function lc(t){return w7.get(t)}function S4(t,e){w7.set(t,e)}function Bd(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}function qw(t,e,r){return t.indexOf(null)>=0?e.map((n,s)=>n instanceof Uf?qw(lc(n),n,r):n):t.reduce((n,s,i)=>{let o=e.getValue(s);return s in n||(r&&o instanceof Uf&&(o=qw(lc(o),o,r)),n[s]=o),n},{})}var zu;const mu=class mu extends Array{constructor(...r){const n=r[0];let s=r[1],i=(r[2]||[]).slice(),o=!0;n!==h1&&(s=r,i=[],o=!1);super(s.length);W(this,zu,void 0);s.forEach((l,u)=>{this[u]=l});const a=i.reduce((l,u)=>(typeof u=="string"&&l.set(u,(l.get(u)||0)+1),l),new Map);if(S4(this,Object.freeze(s.map((l,u)=>{const f=i[u];return f!=null&&a.get(f)===1?f:null}))),N(this,zu,[]),S(this,zu)==null&&S(this,zu),!o)return;Object.freeze(this);const c=new Proxy(this,{get:(l,u,f)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const h=_e(u,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=l[h];return p instanceof Error&&Bd(`index ${h}`,p),p}if(ute.indexOf(u)>=0)return Reflect.get(l,u,f);const d=l[u];if(d instanceof Function)return function(...h){return d.apply(this===f?l:this,h)};if(!(u in l))return l.getValue.apply(this===f?l:this,[u])}return Reflect.get(l,u,f)}});return S4(c,lc(this)),c}toArray(r){const n=[];return this.forEach((s,i)=>{s instanceof Error&&Bd(`index ${i}`,s),r&&s instanceof mu&&(s=s.toArray(r)),n.push(s)}),n}toObject(r){const n=lc(this);return n.reduce((s,i,o)=>(J(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),qw(n,this,r)),{})}slice(r,n){r==null&&(r=0),r<0&&(r+=this.length,r<0&&(r=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const s=lc(this),i=[],o=[];for(let a=r;a{S(this,Hi)[e]=C4(r)}}}Hi=new WeakMap,_c=new WeakMap,Hu=new WeakSet,X1=function(e){return S(this,Hi).push(e),N(this,_c,S(this,_c)+e.length),e.length};var un,Pn,Nc,Mc,Wo,Rp,Qw,L0,E7;const Nk=class Nk{constructor(e,r,n){W(this,Rp);W(this,L0);G(this,"allowLoose");W(this,un,void 0);W(this,Pn,void 0);W(this,Nc,void 0);W(this,Mc,void 0);W(this,Wo,void 0);me(this,{allowLoose:!!r}),N(this,un,br(e)),N(this,Nc,0),N(this,Mc,null),N(this,Wo,n??1024),N(this,Pn,0)}get data(){return ne(S(this,un))}get dataLength(){return S(this,un).length}get consumed(){return S(this,Pn)}get bytes(){return new Uint8Array(S(this,un))}subReader(e){const r=new Nk(S(this,un).slice(S(this,Pn)+e),this.allowLoose,S(this,Wo));return N(r,Mc,this),r}readBytes(e,r){let n=ee(this,L0,E7).call(this,0,e,!!r);return ee(this,Rp,Qw).call(this,e),N(this,Pn,S(this,Pn)+n.length),n.slice(0,e)}readValue(){return vy(this.readBytes(rn))}readIndex(){return Uee(this.readBytes(rn))}};un=new WeakMap,Pn=new WeakMap,Nc=new WeakMap,Mc=new WeakMap,Wo=new WeakMap,Rp=new WeakSet,Qw=function(e){var r;if(S(this,Mc))return ee(r=S(this,Mc),Rp,Qw).call(r,e);N(this,Nc,S(this,Nc)+e),J(S(this,Wo)<1||S(this,Nc)<=S(this,Wo)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${S(this,Wo)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:br(S(this,un)),offset:S(this,Pn),length:e,info:{bytesRead:S(this,Nc),dataLength:this.dataLength}})},L0=new WeakSet,E7=function(e,r,n){let s=Math.ceil(r/rn)*rn;return S(this,Pn)+s>S(this,un).length&&(this.allowLoose&&n&&S(this,Pn)+r<=S(this,un).length?s=r:J(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:br(S(this,un)),length:S(this,un).length,offset:S(this,Pn)+s})),S(this,un).slice(S(this,Pn),S(this,Pn)+s)};let Kw=Nk;function Nn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function gC(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function S7(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nn(t.outputLen),Nn(t.blockLen)}function Vf(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function C7(t,e){gC(t);const r=e.outputLen;if(t.lengtht instanceof Uint8Array,Z1=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ev=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),qs=(t,e)=>t<<32-e|t>>>e,fte=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!fte)throw new Error("Non little-endian hardware is not supported");const dte=async()=>{};async function A4(t,e,r){let n=Date.now();for(let s=0;s=0&&in+s.length,0));let r=0;return t.forEach(n=>{if(!A7(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}class xC{clone(){return this._cloneInto()}}const yte={}.toString;function k7(t,e){if(e!==void 0&&yte.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function Hm(t){const e=n=>t().update($f(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function vte(t=32){if(bx&&typeof bx.getRandomValues=="function")return bx.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class T7 extends xC{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,S7(e);const n=$f(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?e.create().update(n).digest():n);for(let o=0;onew T7(t,e).update(r).digest();Gm.create=(t,e)=>new T7(t,e);function mte(t,e,r,n){S7(t);const s=k7({dkLen:32,asyncTick:10},n),{c:i,dkLen:o,asyncTick:a}=s;if(Nn(i),Nn(o),Nn(a),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=$f(e),l=$f(r),u=new Uint8Array(o),f=Gm.create(t,c),d=f._cloneInto().update(l);return{c:i,dkLen:o,asyncTick:a,DK:u,PRF:f,PRFSalt:d}}function gte(t,e,r,n,s){return t.destroy(),e.destroy(),n&&n.destroy(),s.fill(0),r}function bC(t,e,r,n){const{c:s,dkLen:i,DK:o,PRF:a,PRFSalt:c}=mte(t,e,r,n);let l;const u=new Uint8Array(4),f=ev(u),d=new Uint8Array(a.outputLen);for(let h=1,p=0;p>s&i),a=Number(r&i),c=n?4:0,l=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+l,a,n)}class wC extends xC{constructor(e,r,n,s){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ev(this.buffer)}update(e){Vf(this);const{view:r,buffer:n,blockLen:s}=this;e=$f(e);const i=e.length;for(let o=0;os-o&&(this.process(n,0),o=0);for(let f=o;fu.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;ft&e^~t&r,wte=(t,e,r)=>t&e^t&r^e&r,Ete=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ro=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Io=new Uint32Array(64);class Ste extends wC{constructor(){super(64,32,8,!1),this.A=Ro[0]|0,this.B=Ro[1]|0,this.C=Ro[2]|0,this.D=Ro[3]|0,this.E=Ro[4]|0,this.F=Ro[5]|0,this.G=Ro[6]|0,this.H=Ro[7]|0}get(){const{A:e,B:r,C:n,D:s,E:i,F:o,G:a,H:c}=this;return[e,r,n,s,i,o,a,c]}set(e,r,n,s,i,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let f=0;f<16;f++,r+=4)Io[f]=e.getUint32(r,!1);for(let f=16;f<64;f++){const d=Io[f-15],h=Io[f-2],p=qs(d,7)^qs(d,18)^d>>>3,y=qs(h,17)^qs(h,19)^h>>>10;Io[f]=y+Io[f-7]+p+Io[f-16]|0}let{A:n,B:s,C:i,D:o,E:a,F:c,G:l,H:u}=this;for(let f=0;f<64;f++){const d=qs(a,6)^qs(a,11)^qs(a,25),h=u+d+bte(a,c,l)+Ete[f]+Io[f]|0,y=(qs(n,2)^qs(n,13)^qs(n,22))+wte(n,s,i)|0;u=l,l=c,c=a,a=o+h|0,o=i,i=s,s=n,n=h+y|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(n,s,i,o,a,c,l,u)}roundClean(){Io.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const dd=Hm(()=>new Ste),p1=BigInt(2**32-1),Yw=BigInt(32);function P7(t,e=!1){return e?{h:Number(t&p1),l:Number(t>>Yw&p1)}:{h:Number(t>>Yw&p1)|0,l:Number(t&p1)|0}}function R7(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let s=0;sBigInt(t>>>0)<>>0),Ate=(t,e,r)=>t>>>r,kte=(t,e,r)=>t<<32-r|e>>>r,Tte=(t,e,r)=>t>>>r|e<<32-r,Pte=(t,e,r)=>t<<32-r|e>>>r,Rte=(t,e,r)=>t<<64-r|e>>>r-32,Ite=(t,e,r)=>t>>>r-32|e<<64-r,Ote=(t,e)=>e,_te=(t,e)=>t,I7=(t,e,r)=>t<>>32-r,O7=(t,e,r)=>e<>>32-r,_7=(t,e,r)=>e<>>64-r,N7=(t,e,r)=>t<>>64-r;function Nte(t,e,r,n){const s=(e>>>0)+(n>>>0);return{h:t+r+(s/2**32|0)|0,l:s|0}}const Mte=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Dte=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Lte=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),jte=(t,e,r,n,s)=>e+r+n+s+(t/2**32|0)|0,Bte=(t,e,r,n,s)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(s>>>0),Fte=(t,e,r,n,s,i)=>e+r+n+s+i+(t/2**32|0)|0,Ute={fromBig:P7,split:R7,toBig:Cte,shrSH:Ate,shrSL:kte,rotrSH:Tte,rotrSL:Pte,rotrBH:Rte,rotrBL:Ite,rotr32H:Ote,rotr32L:_te,rotlSH:I7,rotlSL:O7,rotlBH:_7,rotlBL:N7,add:Nte,add3L:Mte,add3H:Dte,add4L:Lte,add4H:jte,add5H:Fte,add5L:Bte},je=Ute,[Vte,$te]=(()=>je.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),Oo=new Uint32Array(80),_o=new Uint32Array(80);class zte extends wC{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:l,El:u,Fh:f,Fl:d,Gh:h,Gl:p,Hh:y,Hl:g}=this;return[e,r,n,s,i,o,a,c,l,u,f,d,h,p,y,g]}set(e,r,n,s,i,o,a,c,l,u,f,d,h,p,y,g){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=y|0,this.Hl=g|0}process(e,r){for(let b=0;b<16;b++,r+=4)Oo[b]=e.getUint32(r),_o[b]=e.getUint32(r+=4);for(let b=16;b<80;b++){const w=Oo[b-15]|0,A=_o[b-15]|0,O=je.rotrSH(w,A,1)^je.rotrSH(w,A,8)^je.shrSH(w,A,7),_=je.rotrSL(w,A,1)^je.rotrSL(w,A,8)^je.shrSL(w,A,7),C=Oo[b-2]|0,j=_o[b-2]|0,V=je.rotrSH(C,j,19)^je.rotrBH(C,j,61)^je.shrSH(C,j,6),B=je.rotrSL(C,j,19)^je.rotrBL(C,j,61)^je.shrSL(C,j,6),z=je.add4L(_,B,_o[b-7],_o[b-16]),Y=je.add4H(z,O,V,Oo[b-7],Oo[b-16]);Oo[b]=Y|0,_o[b]=z|0}let{Ah:n,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:l,Dl:u,Eh:f,El:d,Fh:h,Fl:p,Gh:y,Gl:g,Hh:m,Hl:x}=this;for(let b=0;b<80;b++){const w=je.rotrSH(f,d,14)^je.rotrSH(f,d,18)^je.rotrBH(f,d,41),A=je.rotrSL(f,d,14)^je.rotrSL(f,d,18)^je.rotrBL(f,d,41),O=f&h^~f&y,_=d&p^~d&g,C=je.add5L(x,A,_,$te[b],_o[b]),j=je.add5H(C,m,w,O,Vte[b],Oo[b]),V=C|0,B=je.rotrSH(n,s,28)^je.rotrBH(n,s,34)^je.rotrBH(n,s,39),z=je.rotrSL(n,s,28)^je.rotrBL(n,s,34)^je.rotrBL(n,s,39),Y=n&i^n&a^i&a,H=s&o^s&c^o&c;m=y|0,x=g|0,y=h|0,g=p|0,h=f|0,p=d|0,{h:f,l:d}=je.add(l|0,u|0,j|0,V|0),l=a|0,u=c|0,a=i|0,c=o|0,i=n|0,o=s|0;const L=je.add3L(V,z,H);n=je.add3H(L,j,B,Y),s=L|0}({h:n,l:s}=je.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:o}=je.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=je.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=je.add(this.Dh|0,this.Dl|0,l|0,u|0),{h:f,l:d}=je.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=je.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:y,l:g}=je.add(this.Gh|0,this.Gl|0,y|0,g|0),{h:m,l:x}=je.add(this.Hh|0,this.Hl|0,m|0,x|0),this.set(n,s,i,o,a,c,l,u,f,d,h,p,y,g,m,x)}roundClean(){Oo.fill(0),_o.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const EC=Hm(()=>new zte);function Hte(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const k4=Hte(),T4=k4.crypto||k4.msCrypto;function Gte(t){switch(t){case"sha256":return dd.create();case"sha512":return EC.create()}M(!1,"invalid hashing algorithm name","algorithm",t)}function qte(t,e){const r={sha256:dd,sha512:EC}[t];return M(r!=null,"invalid hmac algorithm","algorithm",t),Gm.create(r,e)}function Wte(t,e,r,n,s){const i={sha256:dd,sha512:EC}[s];return M(i!=null,"invalid pbkdf2 algorithm","algorithm",s),bC(i,t,e,{c:r,dkLen:n})}function Kte(t){J(T4!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),M(Number.isInteger(t)&&t>0&&t<=1024,"invalid length","length",t);const e=new Uint8Array(t);return T4.getRandomValues(e),e}let M7=!1;const D7=function(t,e,r){return qte(t,e).update(r).digest()};let L7=D7;function hd(t,e,r){const n=fe(e,"key"),s=fe(r,"data");return ne(L7(t,n,s))}hd._=D7;hd.lock=function(){M7=!0};hd.register=function(t){if(M7)throw new Error("computeHmac is locked");L7=t};Object.freeze(hd);const[j7,B7,F7]=[[],[],[]],Qte=BigInt(0),Fd=BigInt(1),Yte=BigInt(2),Jte=BigInt(7),Xte=BigInt(256),Zte=BigInt(113);for(let t=0,e=Fd,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],j7.push(2*(5*n+r)),B7.push((t+1)*(t+2)/2%64);let s=Qte;for(let i=0;i<7;i++)e=(e<>Jte)*Zte)%Xte,e&Yte&&(s^=Fd<<(Fd<r>32?_7(t,e,r):I7(t,e,r),R4=(t,e,r)=>r>32?N7(t,e,r):O7(t,e,r);function rre(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=r[c],u=r[c+1],f=P4(l,u,1)^r[a],d=R4(l,u,1)^r[a+1];for(let h=0;h<50;h+=10)t[o+h]^=f,t[o+h+1]^=d}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=B7[o],c=P4(s,i,a),l=R4(s,i,a),u=j7[o];s=t[u],i=t[u+1],t[u]=c,t[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=ere[n],t[1]^=tre[n]}r.fill(0)}class SC extends xC{constructor(e,r,n,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Nn(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Z1(this.state)}keccak(){rre(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Vf(this);const{blockLen:r,state:n}=this;e=$f(e);const s=e.length;for(let i=0;i=n&&this.keccak();const o=Math.min(n-this.posOut,i-s);e.set(r.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Nn(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(C7(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new SC(r,n,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const nre=(t,e,r)=>Hm(()=>new SC(e,t,r)),sre=nre(1,136,256/8);let U7=!1;const V7=function(t){return sre(t)};let $7=V7;function Ct(t){const e=fe(t,"data");return ne($7(e))}Ct._=V7;Ct.lock=function(){U7=!0};Ct.register=function(t){if(U7)throw new TypeError("keccak256 is locked");$7=t};Object.freeze(Ct);const ire=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),z7=Uint8Array.from({length:16},(t,e)=>e),ore=z7.map(t=>(9*t+5)%16);let CC=[z7],AC=[ore];for(let t=0;t<4;t++)for(let e of[CC,AC])e.push(e[t].map(r=>ire[r]));const H7=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),are=CC.map((t,e)=>t.map(r=>H7[e][r])),cre=AC.map((t,e)=>t.map(r=>H7[e][r])),lre=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),ure=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),y1=(t,e)=>t<>>32-e;function I4(t,e,r,n){return t===0?e^r^n:t===1?e&r|~e&n:t===2?(e|~r)^n:t===3?e&n|r&~n:e^(r|~n)}const v1=new Uint32Array(16);class fre extends wC{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:r,h2:n,h3:s,h4:i}=this;return[e,r,n,s,i]}set(e,r,n,s,i){this.h0=e|0,this.h1=r|0,this.h2=n|0,this.h3=s|0,this.h4=i|0}process(e,r){for(let h=0;h<16;h++,r+=4)v1[h]=e.getUint32(r,!0);let n=this.h0|0,s=n,i=this.h1|0,o=i,a=this.h2|0,c=a,l=this.h3|0,u=l,f=this.h4|0,d=f;for(let h=0;h<5;h++){const p=4-h,y=lre[h],g=ure[h],m=CC[h],x=AC[h],b=are[h],w=cre[h];for(let A=0;A<16;A++){const O=y1(n+I4(h,i,a,l)+v1[m[A]]+y,b[A])+f|0;n=f,f=l,l=y1(a,10)|0,a=i,i=O}for(let A=0;A<16;A++){const O=y1(s+I4(p,o,c,u)+v1[x[A]]+g,w[A])+d|0;s=d,d=u,u=y1(c,10)|0,c=o,o=O}}this.set(this.h1+a+u|0,this.h2+l+d|0,this.h3+f+s|0,this.h4+n+o|0,this.h0+i+c|0)}roundClean(){v1.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const dre=Hm(()=>new fre);let G7=!1;const q7=function(t){return dre(t)};let W7=q7;function pd(t){const e=fe(t,"data");return ne(W7(e))}pd._=q7;pd.lock=function(){G7=!0};pd.register=function(t){if(G7)throw new TypeError("ripemd160 is locked");W7=t};Object.freeze(pd);let K7=!1;const Q7=function(t,e,r,n,s){return Wte(t,e,r,n,s)};let Y7=Q7;function za(t,e,r,n,s){const i=fe(t,"password"),o=fe(e,"salt");return ne(Y7(i,o,r,n,s))}za._=Q7;za.lock=function(){K7=!0};za.register=function(t){if(K7)throw new Error("pbkdf2 is locked");Y7=t};Object.freeze(za);let J7=!1;const X7=function(t){return new Uint8Array(Kte(t))};let Z7=X7;function co(t){return Z7(t)}co._=X7;co.lock=function(){J7=!0};co.register=function(t){if(J7)throw new Error("randomBytes is locked");Z7=t};Object.freeze(co);const Ye=(t,e)=>t<>>32-e;function O4(t,e,r,n,s,i){let o=t[e++]^r[n++],a=t[e++]^r[n++],c=t[e++]^r[n++],l=t[e++]^r[n++],u=t[e++]^r[n++],f=t[e++]^r[n++],d=t[e++]^r[n++],h=t[e++]^r[n++],p=t[e++]^r[n++],y=t[e++]^r[n++],g=t[e++]^r[n++],m=t[e++]^r[n++],x=t[e++]^r[n++],b=t[e++]^r[n++],w=t[e++]^r[n++],A=t[e++]^r[n++],O=o,_=a,C=c,j=l,V=u,B=f,z=d,Y=h,H=p,L=y,T=g,P=m,R=x,I=b,U=w,F=A;for(let X=0;X<8;X+=2)V^=Ye(O+R|0,7),H^=Ye(V+O|0,9),R^=Ye(H+V|0,13),O^=Ye(R+H|0,18),L^=Ye(B+_|0,7),I^=Ye(L+B|0,9),_^=Ye(I+L|0,13),B^=Ye(_+I|0,18),U^=Ye(T+z|0,7),C^=Ye(U+T|0,9),z^=Ye(C+U|0,13),T^=Ye(z+C|0,18),j^=Ye(F+P|0,7),Y^=Ye(j+F|0,9),P^=Ye(Y+j|0,13),F^=Ye(P+Y|0,18),_^=Ye(O+j|0,7),C^=Ye(_+O|0,9),j^=Ye(C+_|0,13),O^=Ye(j+C|0,18),z^=Ye(B+V|0,7),Y^=Ye(z+B|0,9),V^=Ye(Y+z|0,13),B^=Ye(V+Y|0,18),P^=Ye(T+L|0,7),H^=Ye(P+T|0,9),L^=Ye(H+P|0,13),T^=Ye(L+H|0,18),R^=Ye(F+U|0,7),I^=Ye(R+F|0,9),U^=Ye(I+R|0,13),F^=Ye(U+I|0,18);s[i++]=o+O|0,s[i++]=a+_|0,s[i++]=c+C|0,s[i++]=l+j|0,s[i++]=u+V|0,s[i++]=f+B|0,s[i++]=d+z|0,s[i++]=h+Y|0,s[i++]=p+H|0,s[i++]=y+L|0,s[i++]=g+T|0,s[i++]=m+P|0,s[i++]=x+R|0,s[i++]=b+I|0,s[i++]=w+U|0,s[i++]=A+F|0}function Ou(t,e,r,n,s){let i=n+0,o=n+16*s;for(let a=0;a<16;a++)r[o+a]=t[e+(2*s-1)*16+a];for(let a=0;a0&&(o+=16),O4(r,i,t,e+=16,r,o)}function eM(t,e,r){const n=k7({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:s,r:i,p:o,dkLen:a,asyncTick:c,maxmem:l,onProgress:u}=n;if(Nn(s),Nn(i),Nn(o),Nn(a),Nn(c),Nn(l),u!==void 0&&typeof u!="function")throw new Error("progressCb should be function");const f=128*i,d=f/4;if(s<=1||s&s-1||s>=2**(f/8)||s>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(o<0||o>(2**32-1)*32/f)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(a<0||a>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const h=f*(s+o);if(h>l)throw new Error(`Scrypt: parameters too large, ${h} (128 * r * (N + p)) > ${l} (maxmem)`);const p=bC(dd,t,e,{c:1,dkLen:f*o}),y=Z1(p),g=Z1(new Uint8Array(f*s)),m=Z1(new Uint8Array(f));let x=()=>{};if(u){const b=2*s*o,w=Math.max(Math.floor(b/1e4),1);let A=0;x=()=>{A++,u&&(!(A%w)||A===b)&&u(A/b)}}return{N:s,r:i,p:o,dkLen:a,blockSize32:d,V:g,B32:y,B:p,tmp:m,blockMixCb:x,asyncTick:c}}function tM(t,e,r,n,s){const i=bC(dd,t,r,{c:1,dkLen:e});return r.fill(0),n.fill(0),s.fill(0),i}function hre(t,e,r){const{N:n,r:s,p:i,dkLen:o,blockSize32:a,V:c,B32:l,B:u,tmp:f,blockMixCb:d}=eM(t,e,r);for(let h=0;h{Ou(c,g,c,g+=a,s),d()}),Ou(c,(n-1)*a,l,y,s),d(),await A4(n,h,()=>{const m=l[y+a-16]%n;for(let x=0;xt instanceof Uint8Array,vre=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function zf(t){if(!Wm(t))throw new Error("Uint8Array expected");let e="";for(let r=0;rn+s.length,0));let r=0;return t.forEach(n=>{if(!Wm(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function gre(t,e){if(t.length!==e.length)return!1;for(let r=0;rfM;t>>=qm,e+=1);return e}function wre(t,e){return t>>BigInt(e)&qm}const Ere=(t,e,r)=>t|(r?qm:fM)<(yre<new Uint8Array(t),_4=t=>Uint8Array.from(t);function hM(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=wx(t),s=wx(t),i=0;const o=()=>{n.fill(1),s.fill(0),i=0},a=(...f)=>r(s,n,...f),c=(f=wx())=>{s=a(_4([0]),f),n=a(),f.length!==0&&(s=a(_4([1]),f),n=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f{o(),c(f);let h;for(;!(h=d(l()));)c();return o(),h}}const Sre={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function my(t,e,r={}){const n=(s,i,o)=>{const a=Sre[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${i}`)};for(const[s,i]of Object.entries(e))n(s,i,!1);for(const[s,i]of Object.entries(r))n(s,i,!0);return t}const Cre=Object.freeze(Object.defineProperty({__proto__:null,bitGet:wre,bitLen:bre,bitMask:RC,bitSet:Ere,bytesToHex:zf,bytesToNumberBE:tl,bytesToNumberLE:TC,concatBytes:Zh,createHmacDrbg:hM,ensureBytes:Ss,equalBytes:gre,hexToBytes:Hf,hexToNumber:kC,numberToBytesBE:Gf,numberToBytesLE:PC,numberToHexUnpadded:dM,numberToVarBytesBE:mre,utf8ToBytes:xre,validateObject:my},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fr=BigInt(0),Kt=BigInt(1),uc=BigInt(2),Are=BigInt(3),Jw=BigInt(4),N4=BigInt(5),M4=BigInt(8);BigInt(9);BigInt(16);function dn(t,e){const r=t%e;return r>=fr?r:e+r}function kre(t,e,r){if(r<=fr||e 0");if(r===Kt)return fr;let n=Kt;for(;e>fr;)e&Kt&&(n=n*t%r),t=t*t%r,e>>=Kt;return n}function qn(t,e,r){let n=t;for(;e-- >fr;)n*=n,n%=r;return n}function Xw(t,e){if(t===fr||e<=fr)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=dn(t,e),n=e,s=fr,i=Kt;for(;r!==fr;){const a=n/r,c=n%r,l=s-i*a;n=r,r=c,s=i,i=l}if(n!==Kt)throw new Error("invert: does not exist");return dn(s,e)}function Tre(t){const e=(t-Kt)/uc;let r,n,s;for(r=t-Kt,n=0;r%uc===fr;r/=uc,n++);for(s=uc;s(n[s]="function",n),e);return my(t,r)}function Ore(t,e,r){if(r 0");if(r===fr)return t.ONE;if(r===Kt)return e;let n=t.ONE,s=e;for(;r>fr;)r&Kt&&(n=t.mul(n,s)),s=t.sqr(s),r>>=Kt;return n}function _re(t,e){const r=new Array(e.length),n=e.reduce((i,o,a)=>t.is0(o)?i:(r[a]=i,t.mul(i,o)),t.ONE),s=t.inv(n);return e.reduceRight((i,o,a)=>t.is0(o)?i:(r[a]=t.mul(i,r[a]),t.mul(i,o)),s),r}function pM(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Nre(t,e,r=!1,n={}){if(t<=fr)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:i}=pM(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Pre(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:i,MASK:RC(s),ZERO:fr,ONE:Kt,create:c=>dn(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return fr<=c&&cc===fr,isOdd:c=>(c&Kt)===Kt,neg:c=>dn(-c,t),eql:(c,l)=>c===l,sqr:c=>dn(c*c,t),add:(c,l)=>dn(c+l,t),sub:(c,l)=>dn(c-l,t),mul:(c,l)=>dn(c*l,t),pow:(c,l)=>Ore(a,c,l),div:(c,l)=>dn(c*Xw(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>Xw(c,t),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>_re(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>r?PC(c,i):Gf(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return r?TC(c):tl(c)}});return Object.freeze(a)}function yM(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function vM(t){const e=yM(t);return e+Math.ceil(e/2)}function Mre(t,e,r=!1){const n=t.length,s=yM(e),i=vM(e);if(n<16||n1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const o=r?tl(t):TC(t),a=dn(o,e-Kt)+Kt;return r?PC(a,s):Gf(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Dre=BigInt(0),Ex=BigInt(1);function Lre(t,e){const r=(s,i)=>{const o=i.negate();return s?o:i},n=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:r,unsafeLadder(s,i){let o=t.ZERO,a=s;for(;i>Dre;)i&Ex&&(o=o.add(a)),a=a.double(),i>>=Ex;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=n(i),c=[];let l=s,u=l;for(let f=0;f>=h,g>c&&(g-=d,o+=Ex);const m=y,x=y+Math.abs(g)-1,b=p%2!==0,w=g<0;g===0?u=u.add(r(b,i[m])):l=l.add(r(w,i[x]))}return{p:l,f:u}},wNAFCached(s,i,o,a){const c=s._WINDOW_SIZE||1;let l=i.get(s);return l||(l=this.precomputeWindow(s,c),c!==1&&i.set(s,a(l))),this.wNAF(c,l,o)}}}function mM(t){return Ire(t.Fp),my(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pM(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function jre(t){const e=mM(t);my(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:s}=e;if(r){if(!n.eql(s,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Bre,hexToBytes:Fre}=Cre,wc={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=wc;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Bre(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=wc,r=typeof t=="string"?Fre(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=wc._parseInt(r.subarray(2)),{d:o,l:a}=wc._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=l=>Number.parseInt(l[0],16)&8?"00"+l:l,r=l=>{const u=l.toString(16);return u.length&1?`0${u}`:u},n=e(r(t.s)),s=e(r(t.r)),i=n.length/2,o=s.length/2,a=r(i),c=r(o);return`30${r(o+i+4)}02${c}${s}02${a}${n}`}},eo=BigInt(0),ss=BigInt(1);BigInt(2);const D4=BigInt(3);BigInt(4);function Ure(t){const e=jre(t),{Fp:r}=e,n=e.toBytes||((p,y,g)=>{const m=y.toAffine();return Zh(Uint8Array.from([4]),r.toBytes(m.x),r.toBytes(m.y))}),s=e.fromBytes||(p=>{const y=p.subarray(1),g=r.fromBytes(y.subarray(0,r.BYTES)),m=r.fromBytes(y.subarray(r.BYTES,2*r.BYTES));return{x:g,y:m}});function i(p){const{a:y,b:g}=e,m=r.sqr(p),x=r.mul(m,p);return r.add(r.add(x,r.mul(p,y)),g)}if(!r.eql(r.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&eor.eql(b,r.ZERO);return x(g)&&x(m)?f.ZERO:new f(g,m,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){const g=r.invertBatch(y.map(m=>m.pz));return y.map((m,x)=>m.toAffine(g[x])).map(f.fromAffine)}static fromHex(y){const g=f.fromAffine(s(Ss("pointHex",y)));return g.assertValidity(),g}static fromPrivateKey(y){return f.BASE.multiply(c(y))}_setWindowSize(y){this._WINDOW_SIZE=y,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:y,y:g}=this.toAffine();if(!r.isValid(y)||!r.isValid(g))throw new Error("bad point: x or y not FE");const m=r.sqr(g),x=i(y);if(!r.eql(m,x))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y}=this.toAffine();if(r.isOdd)return!r.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){u(y);const{px:g,py:m,pz:x}=this,{px:b,py:w,pz:A}=y,O=r.eql(r.mul(g,A),r.mul(b,x)),_=r.eql(r.mul(m,A),r.mul(w,x));return O&&_}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:y,b:g}=e,m=r.mul(g,D4),{px:x,py:b,pz:w}=this;let A=r.ZERO,O=r.ZERO,_=r.ZERO,C=r.mul(x,x),j=r.mul(b,b),V=r.mul(w,w),B=r.mul(x,b);return B=r.add(B,B),_=r.mul(x,w),_=r.add(_,_),A=r.mul(y,_),O=r.mul(m,V),O=r.add(A,O),A=r.sub(j,O),O=r.add(j,O),O=r.mul(A,O),A=r.mul(B,A),_=r.mul(m,_),V=r.mul(y,V),B=r.sub(C,V),B=r.mul(y,B),B=r.add(B,_),_=r.add(C,C),C=r.add(_,C),C=r.add(C,V),C=r.mul(C,B),O=r.add(O,C),V=r.mul(b,w),V=r.add(V,V),C=r.mul(V,B),A=r.sub(A,C),_=r.mul(V,j),_=r.add(_,_),_=r.add(_,_),new f(A,O,_)}add(y){u(y);const{px:g,py:m,pz:x}=this,{px:b,py:w,pz:A}=y;let O=r.ZERO,_=r.ZERO,C=r.ZERO;const j=e.a,V=r.mul(e.b,D4);let B=r.mul(g,b),z=r.mul(m,w),Y=r.mul(x,A),H=r.add(g,m),L=r.add(b,w);H=r.mul(H,L),L=r.add(B,z),H=r.sub(H,L),L=r.add(g,x);let T=r.add(b,A);return L=r.mul(L,T),T=r.add(B,Y),L=r.sub(L,T),T=r.add(m,x),O=r.add(w,A),T=r.mul(T,O),O=r.add(z,Y),T=r.sub(T,O),C=r.mul(j,L),O=r.mul(V,Y),C=r.add(O,C),O=r.sub(z,C),C=r.add(z,C),_=r.mul(O,C),z=r.add(B,B),z=r.add(z,B),Y=r.mul(j,Y),L=r.mul(V,L),z=r.add(z,Y),Y=r.sub(B,Y),Y=r.mul(j,Y),L=r.add(L,Y),B=r.mul(z,L),_=r.add(_,B),B=r.mul(T,L),O=r.mul(H,O),O=r.sub(O,B),B=r.mul(H,z),C=r.mul(T,C),C=r.add(C,B),new f(O,_,C)}subtract(y){return this.add(y.negate())}is0(){return this.equals(f.ZERO)}wNAF(y){return h.wNAFCached(this,l,y,g=>{const m=r.invertBatch(g.map(x=>x.pz));return g.map((x,b)=>x.toAffine(m[b])).map(f.fromAffine)})}multiplyUnsafe(y){const g=f.ZERO;if(y===eo)return g;if(a(y),y===ss)return this;const{endo:m}=e;if(!m)return h.unsafeLadder(this,y);let{k1neg:x,k1:b,k2neg:w,k2:A}=m.splitScalar(y),O=g,_=g,C=this;for(;b>eo||A>eo;)b&ss&&(O=O.add(C)),A&ss&&(_=_.add(C)),C=C.double(),b>>=ss,A>>=ss;return x&&(O=O.negate()),w&&(_=_.negate()),_=new f(r.mul(_.px,m.beta),_.py,_.pz),O.add(_)}multiply(y){a(y);let g=y,m,x;const{endo:b}=e;if(b){const{k1neg:w,k1:A,k2neg:O,k2:_}=b.splitScalar(g);let{p:C,f:j}=this.wNAF(A),{p:V,f:B}=this.wNAF(_);C=h.constTimeNegate(w,C),V=h.constTimeNegate(O,V),V=new f(r.mul(V.px,b.beta),V.py,V.pz),m=C.add(V),x=j.add(B)}else{const{p:w,f:A}=this.wNAF(g);m=w,x=A}return f.normalizeZ([m,x])[0]}multiplyAndAddUnsafe(y,g,m){const x=f.BASE,b=(A,O)=>O===eo||O===ss||!A.equals(x)?A.multiplyUnsafe(O):A.multiply(O),w=b(this,g).add(b(y,m));return w.is0()?void 0:w}toAffine(y){const{px:g,py:m,pz:x}=this,b=this.is0();y==null&&(y=b?r.ONE:r.inv(x));const w=r.mul(g,y),A=r.mul(m,y),O=r.mul(x,y);if(b)return{x:r.ZERO,y:r.ZERO};if(!r.eql(O,r.ONE))throw new Error("invZ was invalid");return{x:w,y:A}}isTorsionFree(){const{h:y,isTorsionFree:g}=e;if(y===ss)return!0;if(g)return g(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:y,clearCofactor:g}=e;return y===ss?this:g?g(f,this):this.multiplyUnsafe(e.h)}toRawBytes(y=!0){return this.assertValidity(),n(f,this,y)}toHex(y=!0){return zf(this.toRawBytes(y))}}f.BASE=new f(e.Gx,e.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const d=e.nBitLength,h=Lre(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:o}}function Vre(t){const e=mM(t);return my(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function $re(t){const e=Vre(t),{Fp:r,n}=e,s=r.BYTES+1,i=2*r.BYTES+1;function o(L){return eozf(Gf(L,e.nByteLength));function p(L){const T=n>>ss;return L>T}function y(L){return p(L)?a(-L):L}const g=(L,T,P)=>tl(L.slice(T,P));class m{constructor(T,P,R){this.r=T,this.s=P,this.recovery=R,this.assertValidity()}static fromCompact(T){const P=e.nByteLength;return T=Ss("compactSignature",T,P*2),new m(g(T,0,P),g(T,P,2*P))}static fromDER(T){const{r:P,s:R}=wc.toSig(Ss("DER",T));return new m(P,R)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(T){return new m(this.r,this.s,T)}recoverPublicKey(T){const{r:P,s:R,recovery:I}=this,U=_(Ss("msgHash",T));if(I==null||![0,1,2,3].includes(I))throw new Error("recovery id invalid");const F=I===2||I===3?P+e.n:P;if(F>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const X=I&1?"03":"02",oe=l.fromHex(X+h(F)),ae=c(F),ke=a(-U*ae),ve=a(R*ae),ie=l.BASE.multiplyAndAddUnsafe(oe,ke,ve);if(!ie)throw new Error("point at infinify");return ie.assertValidity(),ie}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Hf(this.toDERHex())}toDERHex(){return wc.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Hf(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const x={isValidPrivateKey(L){try{return u(L),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const L=vM(e.n);return Mre(e.randomBytes(L),e.n)},precompute(L=8,T=l.BASE){return T._setWindowSize(L),T.multiply(BigInt(3)),T}};function b(L,T=!0){return l.fromPrivateKey(L).toRawBytes(T)}function w(L){const T=L instanceof Uint8Array,P=typeof L=="string",R=(T||P)&&L.length;return T?R===s||R===i:P?R===2*s||R===2*i:L instanceof l}function A(L,T,P=!0){if(w(L))throw new Error("first arg must be private key");if(!w(T))throw new Error("second arg must be public key");return l.fromHex(T).multiply(u(L)).toRawBytes(P)}const O=e.bits2int||function(L){const T=tl(L),P=L.length*8-e.nBitLength;return P>0?T>>BigInt(P):T},_=e.bits2int_modN||function(L){return a(O(L))},C=RC(e.nBitLength);function j(L){if(typeof L!="bigint")throw new Error("bigint expected");if(!(eo<=L&&LBe in P))throw new Error("sign() legacy options not supported");const{hash:R,randomBytes:I}=e;let{lowS:U,prehash:F,extraEntropy:X}=P;U==null&&(U=!0),L=Ss("msgHash",L),F&&(L=Ss("prehashed msgHash",R(L)));const oe=_(L),ae=u(T),ke=[j(ae),j(oe)];if(X!=null){const Be=X===!0?I(r.BYTES):X;ke.push(Ss("extraEntropy",Be))}const ve=Zh(...ke),ie=oe;function Me(Be){const Te=O(Be);if(!d(Te))return;const De=c(Te),ze=l.BASE.multiply(Te).toAffine(),at=a(ze.x);if(at===eo)return;const qe=a(De*a(ie+at*ae));if(qe===eo)return;let Kr=(ze.x===at?0:2)|Number(ze.y&ss),vs=qe;return U&&p(qe)&&(vs=y(qe),Kr^=1),new m(at,vs,Kr)}return{seed:ve,k2sig:Me}}const B={lowS:e.lowS,prehash:!1},z={lowS:e.lowS,prehash:!1};function Y(L,T,P=B){const{seed:R,k2sig:I}=V(L,T,P),U=e;return hM(U.hash.outputLen,U.nByteLength,U.hmac)(R,I)}l.BASE._setWindowSize(8);function H(L,T,P,R=z){var ze;const I=L;if(T=Ss("msgHash",T),P=Ss("publicKey",P),"strict"in R)throw new Error("options.strict was renamed to lowS");const{lowS:U,prehash:F}=R;let X,oe;try{if(typeof I=="string"||I instanceof Uint8Array)try{X=m.fromDER(I)}catch(at){if(!(at instanceof wc.Err))throw at;X=m.fromCompact(I)}else if(typeof I=="object"&&typeof I.r=="bigint"&&typeof I.s=="bigint"){const{r:at,s:qe}=I;X=new m(at,qe)}else throw new Error("PARSE");oe=l.fromHex(P)}catch(at){if(at.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(U&&X.hasHighS())return!1;F&&(T=e.hash(T));const{r:ae,s:ke}=X,ve=_(T),ie=c(ke),Me=a(ve*ie),Be=a(ae*ie),Te=(ze=l.BASE.multiplyAndAddUnsafe(oe,Me,Be))==null?void 0:ze.toAffine();return Te?a(Te.x)===ae:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:A,sign:Y,verify:H,ProjectivePoint:l,Signature:m,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function zre(t){return{hash:t,hmac:(e,...r)=>Gm(t,e,pte(...r)),randomBytes:vte}}function Hre(t,e){const r=n=>$re({...t,...zre(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gM=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),L4=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Gre=BigInt(1),Zw=BigInt(2),j4=(t,e)=>(t+e/Zw)/e;function qre(t){const e=gM,r=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=t*t*t%e,u=l*l*t%e,f=qn(u,r,e)*u%e,d=qn(f,r,e)*u%e,h=qn(d,Zw,e)*l%e,p=qn(h,s,e)*h%e,y=qn(p,i,e)*p%e,g=qn(y,a,e)*y%e,m=qn(g,c,e)*g%e,x=qn(m,a,e)*y%e,b=qn(x,r,e)*u%e,w=qn(b,o,e)*p%e,A=qn(w,n,e)*l%e,O=qn(A,Zw,e);if(!e2.eql(e2.sqr(O),t))throw new Error("Cannot find square root");return O}const e2=Nre(gM,void 0,void 0,{sqrt:qre}),jo=Hre({a:BigInt(0),b:BigInt(7),Fp:e2,n:L4,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=L4,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Gre*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,o=BigInt("0x100000000000000000000000000000000"),a=j4(i*t,e),c=j4(-n*t,e);let l=dn(t-a*r-c*s,e),u=dn(-a*n-c*i,e);const f=l>o,d=u>o;if(f&&(l=e-l),d&&(u=e-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:l,k2neg:d,k2:u}}}},dd);BigInt(0);jo.ProjectivePoint;const vl="0x0000000000000000000000000000000000000000",B4="0x0000000000000000000000000000000000000000000000000000000000000000",Wre=`Ethereum Signed Message: -`,F4=BigInt(0),U4=BigInt(1),V4=BigInt(2),$4=BigInt(27),z4=BigInt(28),m1=BigInt(35),Fl={};function H4(t){return pl($r(t),32)}var Gu,qu,Wu,Dc;const bs=class bs{constructor(e,r,n,s){W(this,Gu,void 0);W(this,qu,void 0);W(this,Wu,void 0);W(this,Dc,void 0);$a(e,Fl,"Signature"),N(this,Gu,r),N(this,qu,n),N(this,Wu,s),N(this,Dc,null)}get r(){return S(this,Gu)}set r(e){M(Ru(e)===32,"invalid r","value",e),N(this,Gu,ne(e))}get s(){return S(this,qu)}set s(e){M(Ru(e)===32,"invalid s","value",e);const r=ne(e);M(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),N(this,qu,r)}get v(){return S(this,Wu)}set v(e){const r=_e(e,"value");M(r===27||r===28,"invalid v","v",e),N(this,Wu,r)}get networkV(){return S(this,Dc)}get legacyChainId(){const e=this.networkV;return e==null?null:bs.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=fe(this.s);return this.yParity&&(e[0]|=128),ne(e)}get compactSerialized(){return ot([this.r,this.yParityAndS])}get serialized(){return ot([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new bs(Fl,this.r,this.s,this.v);return this.networkV&&N(e,Dc,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const r=ye(e,"v");return r==$4||r==z4?F4:(M(r>=m1,"invalid EIP-155 v","v",e),(r-m1)/V4)}static getChainIdV(e,r){return ye(e)*V4+BigInt(35+r-27)}static getNormalizedV(e){const r=ye(e);return r===F4||r===$4?27:r===U4||r===z4?28:(M(r>=m1,"invalid v","v",e),r&U4?27:28)}static from(e){function r(l,u){M(l,u,"signature",e)}if(e==null)return new bs(Fl,B4,B4,27);if(typeof e=="string"){const l=fe(e,"signature");if(l.length===64){const u=ne(l.slice(0,32)),f=l.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new bs(Fl,u,ne(f),d)}if(l.length===65){const u=ne(l.slice(0,32)),f=l.slice(32,64);r((f[0]&128)===0,"non-canonical s");const d=bs.getNormalizedV(l[64]);return new bs(Fl,u,ne(f),d)}r(!1,"invalid raw signature length")}if(e instanceof bs)return e.clone();const n=e.r;r(n!=null,"missing r");const s=H4(n),i=function(l,u){if(l!=null)return H4(l);if(u!=null){r(vt(u,32),"invalid yParityAndS");const f=fe(u);return f[0]&=127,ne(f)}r(!1,"missing s")}(e.s,e.yParityAndS);r((fe(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(l,u,f){if(l!=null){const d=ye(l);return{networkV:d>=m1?d:void 0,v:bs.getNormalizedV(d)}}if(u!=null)return r(vt(u,32),"invalid yParityAndS"),{v:fe(u)[0]&128?28:27};if(f!=null){switch(_e(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new bs(Fl,s,i,a);return o&&N(c,Dc,o),r(e.yParity==null||_e(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};Gu=new WeakMap,qu=new WeakMap,Wu=new WeakMap,Dc=new WeakMap;let Us=bs;var Gi;const dc=class dc{constructor(e){W(this,Gi,void 0);M(Ru(e)===32,"invalid private key","privateKey","[REDACTED]"),N(this,Gi,ne(e))}get privateKey(){return S(this,Gi)}get publicKey(){return dc.computePublicKey(S(this,Gi))}get compressedPublicKey(){return dc.computePublicKey(S(this,Gi),!0)}sign(e){M(Ru(e)===32,"invalid digest length","digest",e);const r=jo.sign(br(e),br(S(this,Gi)),{lowS:!0});return Us.from({r:go(r.r,32),s:go(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=dc.computePublicKey(e);return ne(jo.getSharedSecret(br(S(this,Gi)),fe(r),!1))}static computePublicKey(e,r){let n=fe(e,"key");if(n.length===32){const i=jo.getPublicKey(n,!!r);return ne(i)}if(n.length===64){const i=new Uint8Array(65);i[0]=4,i.set(n,1),n=i}const s=jo.ProjectivePoint.fromHex(n);return ne(s.toRawBytes(r))}static recoverPublicKey(e,r){M(Ru(e)===32,"invalid digest length","digest",e);const n=Us.from(r);let s=jo.Signature.fromCompact(br(ot([n.r,n.s])));s=s.addRecoveryBit(n.yParity);const i=s.recoverPublicKey(br(e));return M(i!=null,"invalid signautre for digest","signature",r),"0x"+i.toHex(!1)}static addPoints(e,r,n){const s=jo.ProjectivePoint.fromHex(dc.computePublicKey(e).substring(2)),i=jo.ProjectivePoint.fromHex(dc.computePublicKey(r).substring(2));return"0x"+s.add(i).toHex(!!n)}};Gi=new WeakMap;let gi=dc;const Kre=BigInt(0),Qre=BigInt(36);function G4(t){t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=e[s].charCodeAt(0);const n=fe(Ct(r));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(n[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const IC={};for(let t=0;t<10;t++)IC[String(t)]=String(t);for(let t=0;t<26;t++)IC[String.fromCharCode(65+t)]=String(10+t);const q4=15;function Yre(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>IC[n]).join("");for(;e.length>=q4;){let n=e.substring(0,q4);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}const Jre=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function Xre(t){t=t.toLowerCase();let e=Kre;for(let r=0;re.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return S(this,Lc)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return S(this,Lc)===!0?-1:S(this,Lc)===!1?this.value.length:null}static from(e,r){return new Li(Di,e,r)}static uint8(e){return he(e,8)}static uint16(e){return he(e,16)}static uint24(e){return he(e,24)}static uint32(e){return he(e,32)}static uint40(e){return he(e,40)}static uint48(e){return he(e,48)}static uint56(e){return he(e,56)}static uint64(e){return he(e,64)}static uint72(e){return he(e,72)}static uint80(e){return he(e,80)}static uint88(e){return he(e,88)}static uint96(e){return he(e,96)}static uint104(e){return he(e,104)}static uint112(e){return he(e,112)}static uint120(e){return he(e,120)}static uint128(e){return he(e,128)}static uint136(e){return he(e,136)}static uint144(e){return he(e,144)}static uint152(e){return he(e,152)}static uint160(e){return he(e,160)}static uint168(e){return he(e,168)}static uint176(e){return he(e,176)}static uint184(e){return he(e,184)}static uint192(e){return he(e,192)}static uint200(e){return he(e,200)}static uint208(e){return he(e,208)}static uint216(e){return he(e,216)}static uint224(e){return he(e,224)}static uint232(e){return he(e,232)}static uint240(e){return he(e,240)}static uint248(e){return he(e,248)}static uint256(e){return he(e,256)}static uint(e){return he(e,256)}static int8(e){return he(e,-8)}static int16(e){return he(e,-16)}static int24(e){return he(e,-24)}static int32(e){return he(e,-32)}static int40(e){return he(e,-40)}static int48(e){return he(e,-48)}static int56(e){return he(e,-56)}static int64(e){return he(e,-64)}static int72(e){return he(e,-72)}static int80(e){return he(e,-80)}static int88(e){return he(e,-88)}static int96(e){return he(e,-96)}static int104(e){return he(e,-104)}static int112(e){return he(e,-112)}static int120(e){return he(e,-120)}static int128(e){return he(e,-128)}static int136(e){return he(e,-136)}static int144(e){return he(e,-144)}static int152(e){return he(e,-152)}static int160(e){return he(e,-160)}static int168(e){return he(e,-168)}static int176(e){return he(e,-176)}static int184(e){return he(e,-184)}static int192(e){return he(e,-192)}static int200(e){return he(e,-200)}static int208(e){return he(e,-208)}static int216(e){return he(e,-216)}static int224(e){return he(e,-224)}static int232(e){return he(e,-232)}static int240(e){return he(e,-240)}static int248(e){return he(e,-248)}static int256(e){return he(e,-256)}static int(e){return he(e,-256)}static bytes1(e){return Je(e,1)}static bytes2(e){return Je(e,2)}static bytes3(e){return Je(e,3)}static bytes4(e){return Je(e,4)}static bytes5(e){return Je(e,5)}static bytes6(e){return Je(e,6)}static bytes7(e){return Je(e,7)}static bytes8(e){return Je(e,8)}static bytes9(e){return Je(e,9)}static bytes10(e){return Je(e,10)}static bytes11(e){return Je(e,11)}static bytes12(e){return Je(e,12)}static bytes13(e){return Je(e,13)}static bytes14(e){return Je(e,14)}static bytes15(e){return Je(e,15)}static bytes16(e){return Je(e,16)}static bytes17(e){return Je(e,17)}static bytes18(e){return Je(e,18)}static bytes19(e){return Je(e,19)}static bytes20(e){return Je(e,20)}static bytes21(e){return Je(e,21)}static bytes22(e){return Je(e,22)}static bytes23(e){return Je(e,23)}static bytes24(e){return Je(e,24)}static bytes25(e){return Je(e,25)}static bytes26(e){return Je(e,26)}static bytes27(e){return Je(e,27)}static bytes28(e){return Je(e,28)}static bytes29(e){return Je(e,29)}static bytes30(e){return Je(e,30)}static bytes31(e){return Je(e,31)}static bytes32(e){return Je(e,32)}static address(e){return new Li(Di,"address",e)}static bool(e){return new Li(Di,"bool",!!e)}static bytes(e){return new Li(Di,"bytes",e)}static string(e){return new Li(Di,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new Li(Di,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===W4}static dereference(e,r){if(Li.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};Lc=new WeakMap;let zr=Li;class tne extends Co{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=zr.dereference(r,"string");try{n=Xe(n)}catch(s){return this._throwError(s.message,r)}return e.writeValue(n)}decode(e){return Xe(go(e.readValue(),20))}}class rne extends Co{constructor(r){super(r.name,r.type,"_",r.dynamic);G(this,"coder");this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function bM(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(l=>{const u=l.localName;return J(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),J(!c[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),c[u]=!0,r[u]})}else M(!1,"invalid tuple value","tuple",r);M(e.length===n.length,"types/value length mismatch","tuple",r);let s=new Ww,i=new Ww,o=[];e.forEach((c,l)=>{let u=n[l];if(c.dynamic){let f=i.length;c.encode(i,u);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else c.encode(s,u)}),o.forEach(c=>{c(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function wM(t,e){let r=[],n=[],s=t.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=t.readIndex(),c=s.subReader(a);try{o=i.decode(c)}catch(l){if(Vr(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(t)}catch(a){if(Vr(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");r.push(o),n.push(i.localName||null)}),Uf.fromItems(r,n)}class nne extends Co{constructor(r,n,s){const i=r.type+"["+(n>=0?n:"")+"]",o=n===-1||r.dynamic;super("array",i,s,o);G(this,"coder");G(this,"length");me(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let s=0;so||s<-(o+une))&&this._throwError("value out-of-bounds",n),s=u7(s,8*rn)}else(sbc(i,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(s)}decode(r){let n=bc(r.readValue(),this.size*8);return this.signed&&(n=c0(n,this.size*8)),n}}class hne extends EM{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,Sr(zr.dereference(r,"string")))}decode(e){return u0(super.decode(e))}}class g1 extends Co{constructor(r,n){let s=!1;const i=[];r.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,n,s);G(this,"coders");me(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];this.coders.forEach(s=>{r.push(s.defaultValue())});const n=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||n[o]!==1||(o==="length"&&(o="_length"),r[o]==null&&(r[o]=r[i]))}),Object.freeze(r)}encode(r,n){const s=zr.dereference(n,"tuple");return bM(r,this.coders,s)}decode(r){return wM(r,this.coders)}}function Cr(t){return Ct(Sr(t))}var pne="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const K4=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Q4=4;function yne(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),s=1,i=[0,1];for(let A=1;A>--c&1}const f=31,d=2**f,h=d>>>1,p=h>>1,y=d-1;let g=0;for(let A=0;A1;){let V=O+_>>>1;A>>1|u(),C=C<<1^h,j=(j^h)<<1|h|1;x=C,b=1+j-C}let w=n-4;return m.map(A=>{switch(A-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return A-1}})}function vne(t){let e=0;return()=>t[e++]}function SM(t){return vne(yne(mne(t)))}function mne(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let r=t.length,n=new Uint8Array(6*r>>3);for(let s=0,i=0,o=0,a=0;s=8&&(n[i++]=a>>(o-=8));return n}function gne(t){return t&1?~t>>1:t>>1}function xne(t,e){let r=Array(t);for(let n=0,s=0;n{let e=ep(t);if(e.length)return e})}function AM(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(bne(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(wne(r,t))}return e.flat()}function tp(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function kM(t,e,r){let n=Array(t).fill().map(()=>[]);for(let s=0;sn[o].push(i));return n}function bne(t,e){let r=1+e(),n=e(),s=tp(e);return kM(s.length,1+t,e).flatMap((o,a)=>{let[c,...l]=o;return Array(s[a]).fill().map((u,f)=>{let d=f*n;return[c+f*r,l.map(h=>h+d)]})})}function wne(t,e){let r=1+e();return kM(r,1+t,e).map(s=>[s[0],s.slice(1)])}function Ene(t){let e=[],r=ep(t);return s(n([]),[]),e;function n(i){let o=t(),a=tp(()=>{let c=ep(t).map(l=>r[l]);if(c.length)return n(c)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,c){if(!(i&4&&c===a[a.length-1])){i&2&&(c=a[a.length-1]),i&1&&e.push(a);for(let l of o)for(let u of l.Q)s(l,[...a,u],c)}}}function Sne(t){return t.toString(16).toUpperCase().padStart(2,"0")}function TM(t){return`{${Sne(t)}}`}function Cne(t){let e=[];for(let r=0,n=t.length;r>24&255}function IM(t){return t&16777215}let t2,Y4,r2,tv;function _ne(){let t=SM(kne);t2=new Map(CM(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),Y4=new Set(ep(t)),r2=new Map,tv=new Map;for(let[e,r]of AM(t)){if(!Y4.has(e)&&r.length==2){let[n,s]=r,i=tv.get(n);i||(i=new Map,tv.set(n,i)),i.set(s,e)}r2.set(e,r.reverse())}}function OM(t){return t>=rp&&t=d0&&t=h0&&ep0&&e0&&s(p0+l)}else{let o=r2.get(i);o?r.push(...o):s(i)}if(!r.length)break;i=r.pop()}if(n&&e.length>1){let i=Xd(e[0]);for(let o=1;o0&&s>=o)o==0?(e.push(n,...r),r.length=0,n=a):r.push(a),s=o;else{let c=Nne(n,a);c>=0?n=c:s==0&&o==0?(e.push(n),n=a):(r.push(a),s=o)}}return n>=0&&e.push(n,...r),e}function NM(t){return _M(t).map(IM)}function Dne(t){return Mne(_M(t))}const J4=45,MM=".",DM=65039,LM=1,v0=t=>Array.from(t);function np(t,e){return t.P.has(e)||t.Q.has(e)}class Lne extends Array{get is_emoji(){return!0}}let n2,jM,Ec,s2,BM,_u,Cx,ql,oc,X4,i2;function OC(){if(n2)return;let t=SM(pne);const e=()=>ep(t),r=()=>new Set(e()),n=(u,f)=>f.forEach(d=>u.add(d));n2=new Map(AM(t)),jM=r(),Ec=e(),s2=new Set(e().map(u=>Ec[u])),Ec=new Set(Ec),BM=r(),r();let s=CM(t),i=t();const o=()=>{let u=new Set;return e().forEach(f=>n(u,s[f])),n(u,e()),u};_u=tp(u=>{let f=tp(t).map(d=>d+96);if(f.length){let d=u>=i;f[0]-=32,f=qf(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),y=!t();return{N:f,P:h,Q:p,M:y,R:d}}}),Cx=r(),ql=new Map;let a=e().concat(v0(Cx)).sort((u,f)=>u-f);a.forEach((u,f)=>{let d=t(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(u),Cx.has(u)||ql.set(u,h)});for(let{V:u,M:f}of new Set(ql.values())){let d=[];for(let p of u){let y=_u.filter(m=>np(m,p)),g=d.find(({G:m})=>y.some(x=>m.has(x)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),n(g.G,y)}let h=d.flatMap(p=>v0(p.G));for(let{G:p,V:y}of d){let g=new Set(h.filter(m=>!p.has(m)));for(let m of y)f.set(m,g)}}oc=new Set;let c=new Set;const l=u=>oc.has(u)?c.add(u):oc.add(u);for(let u of _u){for(let f of u.P)l(f);for(let f of u.Q)l(f)}for(let u of oc)!ql.has(u)&&!c.has(u)&&ql.set(u,LM);n(oc,NM(oc)),X4=Ene(t).map(u=>Lne.from(u)).sort(Ane),i2=new Map;for(let u of X4){let f=[i2];for(let d of u){let h=f.map(p=>{let y=p.get(d);return y||(y=new Map,p.set(d,y)),y});d===DM?f.push(...h):f=h}for(let d of f)d.V=u}}function _C(t){return(FM(t)?"":`${NC(Km([t]))} `)+TM(t)}function NC(t){return`"${t}"‎`}function jne(t){if(t.length>=4&&t[2]==J4&&t[3]==J4)throw new Error(`invalid label extension: "${qf(t.slice(0,4))}"`)}function Bne(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function Fne(t){let e=t[0],r=K4.get(e);if(r)throw xh(`leading ${r}`);let n=t.length,s=-1;for(let i=1;ie&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,i=t.length;for(let o=0;o{let i=Cne(s),o={input:i,offset:n};n+=i.length+1;try{let a=o.tokens=Wne(i,e,r),c=a.length,l;if(!c)throw new Error("empty label");let u=o.output=a.flat();if(Bne(u),!(o.emoji=c>1||a[0].is_emoji)&&u.every(d=>d<128))jne(u),l="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)l="Emoji";else{if(Ec.has(u[0]))throw xh("leading combining mark");for(let y=1;yo.has(a)):v0(o),!r.length)return}else n.push(s)}if(r){for(let s of r)if(n.every(i=>np(s,i)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function Hne(t){let e=_u;for(let r of t){let n=e.filter(s=>np(s,r));if(!n.length)throw _u.some(s=>np(s,r))?VM(e[0],r):UM(r);if(e=n,n.length==1)break}return e}function Gne(t){return t.map(({input:e,error:r,output:n})=>{if(r){let s=r.message;throw new Error(t.length==1?s:`Invalid label ${NC(Km(e,63))}: ${s}`)}return qf(n)}).join(MM)}function UM(t){return new Error(`disallowed character: ${_C(t)}`)}function VM(t,e){let r=_C(e),n=_u.find(s=>s.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function xh(t){return new Error(`illegal placement: ${t}`)}function qne(t,e){for(let r of e)if(!np(t,r))throw VM(t,r);if(t.M){let r=NM(e);for(let n=1,s=r.length;nQ4)throw new Error(`excessive non-spacing marks: ${NC(Km(r.slice(n-1,i)))} (${i-n}/${Q4})`);n=i}}}function Wne(t,e,r){let n=[],s=[];for(t=t.slice().reverse();t.length;){let i=Qne(t);if(i)s.length&&(n.push(e(s)),s=[]),n.push(r(i));else{let o=t.pop();if(oc.has(o))s.push(o);else{let a=n2.get(o);if(a)s.push(...a);else if(!jM.has(o))throw UM(o)}}}return s.length&&n.push(e(s)),n}function Kne(t){return t.filter(e=>e!=DM)}function Qne(t,e){let r=i2,n,s=t.length;for(;s&&(r=r.get(t[--s]),!!r);){let{V:i}=r;i&&(n=i,e&&e.push(...t.slice(s).reverse()),t.length=s)}return n}const $M=new Uint8Array(32);$M.fill(0);function Z4(t){return M(t.length!==0,"invalid ENS name; empty component","comp",t),t}function zM(t){const e=Sr(Yne(t)),r=[];if(t.length===0)return r;let n=0;for(let s=0;s{M(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const s=new Uint8Array(n.length+1);return s.set(n,1),s[0]=s.length-1,s})))+"00"}function Ax(t,e){return{address:Xe(t),storageKeys:e.map((r,n)=>(M(vt(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function Pl(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(M(r.length===2,"invalid slot set",`value[${n}]`,r),Ax(r[0],r[1])):(M(r!=null&&typeof r=="object","invalid address-slot set","value",t),Ax(r.address,r.storageKeys)));M(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((s,i)=>(s[i]=!0,s),{});return Ax(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function gy(t){let e;return typeof t=="string"?e=gi.computePublicKey(t,!1):e=t.publicKey,Xe(Ct("0x"+e.substring(4)).substring(26))}function Xne(t,e){return gy(gi.recoverPublicKey(t,e))}const lr=BigInt(0),Zne=BigInt(2),ese=BigInt(27),tse=BigInt(28),rse=BigInt(35),nse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),kx=4096*32;function e3(t,e){let r=t.toString(16);for(;r.length<2;)r="0"+r;return r+=ys(e).substring(4),"0x"+r}function Qm(t){return t==="0x"?null:Xe(t)}function MC(t,e){try{return Pl(t)}catch(r){M(!1,r.message,e,t)}}function xy(t,e){return t==="0x"?0:_e(t,e)}function Qt(t,e){if(t==="0x")return lr;const r=ye(t,e);return M(r<=nse,"value exceeds uint size",e,r),r}function bt(t,e){const r=ye(t,"value"),n=$r(r);return M(n.length<=32,"value too large",`tx.${e}`,r),n}function DC(t){return Pl(t).map(e=>[e.address,e.storageKeys])}function sse(t,e){M(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;rs.data),r.map(s=>s.commitment),r.map(s=>s.proof)])]):ot(["0x03",yl(n)])}var Zs,Ku,Qu,Yu,Ju,Xu,Zu,ef,tf,rf,nf,sf,jc,Ko,qi,Qo,of,rv;const ji=class ji{constructor(){W(this,of);W(this,Zs,void 0);W(this,Ku,void 0);W(this,Qu,void 0);W(this,Yu,void 0);W(this,Ju,void 0);W(this,Xu,void 0);W(this,Zu,void 0);W(this,ef,void 0);W(this,tf,void 0);W(this,rf,void 0);W(this,nf,void 0);W(this,sf,void 0);W(this,jc,void 0);W(this,Ko,void 0);W(this,qi,void 0);W(this,Qo,void 0);N(this,Zs,null),N(this,Ku,null),N(this,Yu,0),N(this,Ju,lr),N(this,Xu,null),N(this,Zu,null),N(this,ef,null),N(this,Qu,"0x"),N(this,tf,lr),N(this,rf,lr),N(this,nf,null),N(this,sf,null),N(this,jc,null),N(this,Ko,null),N(this,Qo,null),N(this,qi,null)}get type(){return S(this,Zs)}set type(e){switch(e){case null:N(this,Zs,null);break;case 0:case"legacy":N(this,Zs,0);break;case 1:case"berlin":case"eip-2930":N(this,Zs,1);break;case 2:case"london":case"eip-1559":N(this,Zs,2);break;case 3:case"cancun":case"eip-4844":N(this,Zs,3);break;default:M(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=S(this,Ku);return e==null&&this.type===3?vl:e}set to(e){N(this,Ku,e==null?null:Xe(e))}get nonce(){return S(this,Yu)}set nonce(e){N(this,Yu,_e(e,"value"))}get gasLimit(){return S(this,Ju)}set gasLimit(e){N(this,Ju,ye(e))}get gasPrice(){const e=S(this,Xu);return e==null&&(this.type===0||this.type===1)?lr:e}set gasPrice(e){N(this,Xu,e==null?null:ye(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=S(this,Zu);return e??(this.type===2||this.type===3?lr:null)}set maxPriorityFeePerGas(e){N(this,Zu,e==null?null:ye(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=S(this,ef);return e??(this.type===2||this.type===3?lr:null)}set maxFeePerGas(e){N(this,ef,e==null?null:ye(e,"maxFeePerGas"))}get data(){return S(this,Qu)}set data(e){N(this,Qu,ne(e))}get value(){return S(this,tf)}set value(e){N(this,tf,ye(e,"value"))}get chainId(){return S(this,rf)}set chainId(e){N(this,rf,ye(e))}get signature(){return S(this,nf)||null}set signature(e){N(this,nf,e==null?null:Us.from(e))}get accessList(){const e=S(this,sf)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){N(this,sf,e==null?null:Pl(e))}get maxFeePerBlobGas(){const e=S(this,jc);return e==null&&this.type===3?lr:e}set maxFeePerBlobGas(e){N(this,jc,e==null?null:ye(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=S(this,Ko);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){M(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let r=0;rObject.assign({},e))}set blobs(e){if(e==null){N(this,Qo,null);return}const r=[],n=[];for(let s=0;s=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,s=S(this,jc)!=null||S(this,Ko);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&J(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),J(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),J(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):r?i.push(2):e?(i.push(1),n||i.push(0)):n?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return ji.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new ji;if(typeof e=="string"){const n=fe(e);if(n[0]>=127)return ji.from(ise(n));switch(n[0]){case 1:return ji.from(lse(n));case 2:return ji.from(ase(n));case 3:return ji.from(fse(n))}J(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new ji;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=Us.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(r.kzg=e.kzg),e.blobs!=null&&(r.blobs=e.blobs),e.hash!=null&&(M(r.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),M(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(M(r.isSigned(),"unsigned transaction cannot define '.from'","tx",e),M(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};Zs=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Yu=new WeakMap,Ju=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,ef=new WeakMap,tf=new WeakMap,rf=new WeakMap,nf=new WeakMap,sf=new WeakMap,jc=new WeakMap,Ko=new WeakMap,qi=new WeakMap,Qo=new WeakMap,of=new WeakSet,rv=function(e,r){J(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return ose(this,n);case 1:return use(this,n);case 2:return cse(this,n);case 3:return dse(this,n,r?this.blobs:null)}J(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let sp=ji;function hse(t){return typeof t=="string"&&(t=Sr(t)),Ct(ot([Sr(Wre),Sr(String(t.length)),t]))}const HM=new Uint8Array(32);HM.fill(0);const pse=BigInt(-1),GM=BigInt(0),qM=BigInt(1),yse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function vse(t){const e=fe(t),r=e.length%32;return r?ot([e,HM.slice(r)]):ne(e)}const mse=go(qM,32),gse=go(GM,32),t3={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Tx=["name","version","chainId","verifyingContract","salt"];function r3(t){return function(e){return M(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const xse={name:r3("name"),version:r3("version"),chainId:function(t){const e=ye(t,"domain.chainId");return M(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):yu(e)},verifyingContract:function(t){try{return Xe(t).toLowerCase()}catch{}M(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=fe(t,"domain.salt");return M(e.length===32,'invalid domain value "salt"',"domain.salt",t),ne(e)}};function Px(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);M(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const s=bc(yse,r?n-1:n),i=r?(s+qM)*pse:GM;return function(o){const a=ye(o,"value");return M(a>=i&&a<=s,`value out-of-bounds for ${t}`,"value",a),go(r?u7(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return M(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const s=fe(n);return M(s.length===r,`invalid length for ${t}`,"value",n),vse(n)}}}switch(t){case"address":return function(e){return pl(Xe(e),32)};case"bool":return function(e){return e?mse:gse};case"bytes":return function(e){return Ct(e)};case"string":return function(e){return Cr(e)}}return null}function n3(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function x1(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var Ip,Wi,af,j0,WM;const Xn=class Xn{constructor(e){W(this,j0);G(this,"primaryType");W(this,Ip,void 0);W(this,Wi,void 0);W(this,af,void 0);N(this,Wi,new Map),N(this,af,new Map);const r=new Map,n=new Map,s=new Map,i={};Object.keys(e).forEach(c=>{i[c]=e[c].map(({name:l,type:u})=>{let{base:f,index:d}=x1(u);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:l,type:f+(d||"")}}),r.set(c,new Set),n.set(c,[]),s.set(c,new Set)}),N(this,Ip,JSON.stringify(i));for(const c in i){const l=new Set;for(const u of i[c]){M(!l.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(c)}`,"types",e),l.add(u.name);const f=x1(u.type).base;M(f!==c,`circular type reference to ${JSON.stringify(f)}`,"types",e),!Px(f)&&(M(n.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),n.get(f).push(c),r.get(c).add(f))}}const o=Array.from(n.keys()).filter(c=>n.get(c).length===0);M(o.length!==0,"missing primary type","types",e),M(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),me(this,{primaryType:o[0]});function a(c,l){M(!l.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),l.add(c);for(const u of r.get(c))if(n.has(u)){a(u,l);for(const f of l)s.get(f).add(u)}l.delete(c)}a(this.primaryType,new Set);for(const[c,l]of s){const u=Array.from(l);u.sort(),S(this,Wi).set(c,n3(c,i[c])+u.map(f=>n3(f,i[f])).join(""))}}get types(){return JSON.parse(S(this,Ip))}getEncoder(e){let r=S(this,af).get(e);return r||(r=ee(this,j0,WM).call(this,e),S(this,af).set(e,r)),r}encodeType(e){const r=S(this,Wi).get(e);return M(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return Ct(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(Px(e))return n(e,r);const s=x1(e).array;if(s)return M(s.count===-1||s.count===r.length,`array length mismatch; expected length ${s.count}`,"value",r),r.map(o=>this._visit(s.prefix,o,n));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:c})=>(o[a]=this._visit(c,r[a],n),o),{});M(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new Xn(e)}static getPrimaryType(e){return Xn.from(e).primaryType}static hashStruct(e,r,n){return Xn.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const s=t3[n];M(s,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:s})}return r.sort((n,s)=>Tx.indexOf(n.name)-Tx.indexOf(s.name)),Xn.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return ot(["0x1901",Xn.hashDomain(e),Xn.from(r).hash(n)])}static hash(e,r,n){return Ct(Xn.encode(e,r,n))}static async resolveNames(e,r,n,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!vt(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=Xn.from(r);o.visit(n,(a,c)=>(a==="address"&&!vt(c,20)&&(i[c]="0x"),c));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=o.visit(n,(a,c)=>a==="address"&&i[c]?i[c]:c),{domain:e,value:n}}static getPayload(e,r,n){Xn.hashDomain(e);const s={},i=[];Tx.forEach(c=>{const l=e[c];l!=null&&(s[c]=xse[c](l),i.push({name:c,type:t3[c]}))});const o=Xn.from(r);r=o.types;const a=Object.assign({},r);return M(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),a.EIP712Domain=i,o.encode(n),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(n,(c,l)=>{if(c.match(/^bytes(\d*)/))return ne(fe(l));if(c.match(/^u?int/))return ye(l).toString();switch(c){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return M(typeof l=="string","invalid string","value",l),l}M(!1,"unsupported type","type",c)})}}};Ip=new WeakMap,Wi=new WeakMap,af=new WeakMap,j0=new WeakSet,WM=function(e){{const s=Px(e);if(s)return s}const r=x1(e).array;if(r){const s=r.prefix,i=this.getEncoder(s);return o=>{M(r.count===-1||r.count===o.length,`array length mismatch; expected length ${r.count}`,"value",o);let a=o.map(i);return S(this,Wi).has(s)&&(a=a.map(Ct)),Ct(ot(a))}}const n=this.types[e];if(n){const s=Cr(S(this,Wi).get(e));return i=>{const o=n.map(({name:a,type:c})=>{const l=this.getEncoder(c)(i[a]);return S(this,Wi).has(c)?Ct(l):l});return o.unshift(s),ot(o)}}M(!1,`unknown type: ${e}`,"type",e)};let Kf=Xn;function nn(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const bse="external public payable override",wse=nn(bse.split(" ")),KM="constant external internal payable private public pure view override",Ese=nn(KM.split(" ")),QM="constructor error event fallback function receive struct",YM=nn(QM.split(" ")),JM="calldata memory storage payable indexed",Sse=nn(JM.split(" ")),Cse="tuple returns",Ase=[QM,JM,Cse,KM].join(" "),kse=nn(Ase.split(" ")),Tse={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Pse=new RegExp("^(\\s*)"),Rse=new RegExp("^([0-9]+)"),Ise=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),XM=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),ZM=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var vr,Ps,Op,a2;const B0=class B0{constructor(e){W(this,Op);W(this,vr,void 0);W(this,Ps,void 0);N(this,vr,0),N(this,Ps,e.slice())}get offset(){return S(this,vr)}get length(){return S(this,Ps).length-S(this,vr)}clone(){return new B0(S(this,Ps))}reset(){N(this,vr,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=ee(this,Op,a2).call(this,S(this,vr)+1,e.match+1);return N(this,vr,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;S(this,vr)=S(this,Ps).length)throw new Error("out-of-bounds");return S(this,Ps)[S(this,vr)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return Ed(this,vr)._++,e}toString(){const e=[];for(let r=S(this,vr);r`}};vr=new WeakMap,Ps=new WeakMap,Op=new WeakSet,a2=function(e=0,r=0){return new B0(S(this,Ps).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Vs=B0;function Ha(t){const e=[],r=o=>{const a=i0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;u=f+u,e[e.length-1].value=_e(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=u}continue}if(a=o.match(Ise),a){if(c.text=a[1],i+=c.text.length,kse.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(ZM)){c.type="TYPE";continue}c.type="ID";continue}if(a=o.match(Rse),a){c.text=a[1],c.type="NUMBER",i+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new Vs(e.map(o=>Object.freeze(o)))}function s3(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function Ym(t,e){if(e.peekKeyword(YM)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function bo(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function eD(t){let e=bo(t,Ese);return s3(e,nn("constant payable nonpayable".split(" "))),s3(e,nn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function lo(t,e){return t.popParams().map(r=>Ar.from(r,e))}function tD(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return ye(t.pop().text);throw new Error("invalid gas")}return null}function ml(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const Ose=new RegExp(/^(.*)\[([0-9]*)\]$/);function i3(t){const e=t.match(ZM);if(M(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);M(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);M(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const Pt={},bn=Symbol.for("_ethers_internal"),o3="_ParamTypeInternal",a3="_ErrorInternal",c3="_EventInternal",l3="_ConstructorInternal",u3="_FallbackInternal",f3="_FunctionInternal",d3="_StructInternal";var cf,nv;const Zn=class Zn{constructor(e,r,n,s,i,o,a,c){W(this,cf);G(this,"name");G(this,"type");G(this,"baseType");G(this,"indexed");G(this,"components");G(this,"arrayLength");G(this,"arrayChildren");if($a(e,Pt,"ParamType"),Object.defineProperty(this,bn,{value:o3}),o&&(o=Object.freeze(o.slice())),s==="array"){if(a==null||c==null)throw new Error("")}else if(a!=null||c!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");me(this,{name:r,type:n,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=n,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(s=>n.arrayChildren.walk(s,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((s,i)=>n.components[i].walk(s,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],s=[e];return ee(this,cf,nv).call(this,n,e,r,i=>{s[0]=i}),n.length&&await Promise.all(n),s[0]}static from(e,r){if(Zn.isParamType(e))return e;if(typeof e=="string")try{return Zn.from(Ha(e),r)}catch{M(!1,"invalid param type","obj",e)}else if(e instanceof Vs){let a="",c="",l=null;bo(e,nn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",l=e.popParams().map(y=>Zn.from(y)),a=`tuple(${l.map(y=>y.format()).join(",")})`):(a=i3(e.popType("TYPE")),c=a);let u=null,f=null;for(;e.length&&e.peekType("BRACKET");){const y=e.pop();u=new Zn(Pt,"",a,c,null,l,f,u),f=y.value,a+=y.text,c="array",l=null}let d=null;if(bo(e,Sse).has("indexed")){if(!r)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Zn(Pt,p,a,c,d,l,f,u)}const n=e.name;M(!n||typeof n=="string"&&n.match(XM),"invalid name","obj.name",n);let s=e.indexed;s!=null&&(M(r,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(Ose);if(o){const a=parseInt(o[2]||"-1"),c=Zn.from({type:o[1],components:e.components});return new Zn(Pt,n||"",i,"array",s,null,a,c)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(l=>Zn.from(l)):null;return new Zn(Pt,n||"",i,"tuple",s,a,null,null)}return i=i3(e.type),new Zn(Pt,n||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[bn]===o3}};cf=new WeakSet,nv=function(e,r,n,s){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=r.slice();a.forEach((c,l)=>{var u;ee(u=o,cf,nv).call(u,e,c,n,f=>{a[l]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(r))a=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");a=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((c,l)=>{var u;ee(u=o[l],cf,nv).call(u,e,c,n,f=>{a[l]=f})}),s(a);return}const i=n(this.type,r);i.then?e.push(async function(){s(await i)}()):s(i)};let Ar=Zn;class gl{constructor(e,r,n){G(this,"type");G(this,"inputs");$a(e,Pt,"Fragment"),n=Object.freeze(n.slice()),me(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{gl.from(JSON.parse(e))}catch{}return gl.from(Ha(e))}if(e instanceof Vs)switch(e.peekKeyword(YM)){case"constructor":return so.from(e);case"error":return pn.from(e);case"event":return li.from(e);case"fallback":case"receive":return Fi.from(e);case"function":return ui.from(e);case"struct":return rl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return so.from(e);case"error":return pn.from(e);case"event":return li.from(e);case"fallback":case"receive":return Fi.from(e);case"function":return ui.from(e);case"struct":return rl.from(e)}J(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}M(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return so.isFragment(e)}static isError(e){return pn.isFragment(e)}static isEvent(e){return li.isFragment(e)}static isFunction(e){return ui.isFragment(e)}static isStruct(e){return rl.isFragment(e)}}class Jm extends gl{constructor(r,n,s,i){super(r,n,i);G(this,"name");M(typeof s=="string"&&s.match(XM),"invalid identifier","name",s),i=Object.freeze(i.slice()),me(this,{name:s})}}function ip(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class pn extends Jm{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,bn,{value:a3})}get selector(){return Cr(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+ip(e,this.inputs)),r.join(" ")}static from(e){if(pn.isFragment(e))return e;if(typeof e=="string")return pn.from(Ha(e));if(e instanceof Vs){const r=Ym("error",e),n=lo(e);return ml(e),new pn(Pt,r,n)}return new pn(Pt,e.name,e.inputs?e.inputs.map(Ar.from):[])}static isFragment(e){return e&&e[bn]===a3}}class li extends Jm{constructor(r,n,s,i){super(r,"event",n,s);G(this,"anonymous");Object.defineProperty(this,bn,{value:c3}),me(this,{anonymous:i})}get topicHash(){return Cr(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+ip(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(i=>Ar.from(i)),new li(Pt,r,n,!1).topicHash}static from(r){if(li.isFragment(r))return r;if(typeof r=="string")try{return li.from(Ha(r))}catch{M(!1,"invalid event fragment","obj",r)}else if(r instanceof Vs){const n=Ym("event",r),s=lo(r,!0),i=!!bo(r,nn(["anonymous"])).has("anonymous");return ml(r),new li(Pt,n,s,i)}return new li(Pt,r.name,r.inputs?r.inputs.map(n=>Ar.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[bn]===c3}}class so extends gl{constructor(r,n,s,i,o){super(r,n,s);G(this,"payable");G(this,"gas");Object.defineProperty(this,bn,{value:l3}),me(this,{payable:i,gas:o})}format(r){if(J(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});const n=[`constructor${ip(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(so.isFragment(r))return r;if(typeof r=="string")try{return so.from(Ha(r))}catch{M(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Vs){bo(r,nn(["constructor"]));const n=lo(r),s=!!bo(r,wse).has("payable"),i=tD(r);return ml(r),new so(Pt,"constructor",n,s,i)}return new so(Pt,"constructor",r.inputs?r.inputs.map(Ar.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[bn]===l3}}class Fi extends gl{constructor(r,n,s){super(r,"fallback",n);G(this,"payable");Object.defineProperty(this,bn,{value:u3}),me(this,{payable:s})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:s})}return`${n}()${this.payable?" payable":""}`}static from(r){if(Fi.isFragment(r))return r;if(typeof r=="string")try{return Fi.from(Ha(r))}catch{M(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Vs){const n=r.toString(),s=r.peekKeyword(nn(["fallback","receive"]));if(M(s,"type must be fallback or receive","obj",n),r.popKeyword(nn(["fallback","receive"]))==="receive"){const c=lo(r);return M(c.length===0,"receive cannot have arguments","obj.inputs",c),bo(r,nn(["payable"])),ml(r),new Fi(Pt,[],!0)}let o=lo(r);o.length?M(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[Ar.from("bytes")];const a=eD(r);if(M(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),bo(r,nn(["returns"])).has("returns")){const c=lo(r);M(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(l=>l.format("minimal")).join(", "))}return ml(r),new Fi(Pt,o,a==="payable")}if(r.type==="receive")return new Fi(Pt,[],!0);if(r.type==="fallback"){const n=[Ar.from("bytes")],s=r.stateMutability==="payable";return new Fi(Pt,n,s)}M(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[bn]===u3}}class ui extends Jm{constructor(r,n,s,i,o,a){super(r,"function",n,i);G(this,"constant");G(this,"outputs");G(this,"stateMutability");G(this,"payable");G(this,"gas");Object.defineProperty(this,bn,{value:f3}),o=Object.freeze(o.slice()),me(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return Cr(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r))),outputs:this.outputs.map(s=>JSON.parse(s.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+ip(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(ip(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(i=>Ar.from(i)),new ui(Pt,r,"view",n,[],null).selector}static from(r){if(ui.isFragment(r))return r;if(typeof r=="string")try{return ui.from(Ha(r))}catch{M(!1,"invalid function fragment","obj",r)}else if(r instanceof Vs){const s=Ym("function",r),i=lo(r),o=eD(r);let a=[];bo(r,nn(["returns"])).has("returns")&&(a=lo(r));const c=tD(r);return ml(r),new ui(Pt,s,o,i,a,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new ui(Pt,r.name,n,r.inputs?r.inputs.map(Ar.from):[],r.outputs?r.outputs.map(Ar.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[bn]===f3}}class rl extends Jm{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,bn,{value:d3})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return rl.from(Ha(e))}catch{M(!1,"invalid struct fragment","obj",e)}else if(e instanceof Vs){const r=Ym("struct",e),n=lo(e);return ml(e),new rl(Pt,r,n)}return new rl(Pt,e.name,e.inputs?e.inputs.map(Ar.from):[])}static isFragment(e){return e&&e[bn]===d3}}const zs=new Map;zs.set(0,"GENERIC_PANIC");zs.set(1,"ASSERT_FALSE");zs.set(17,"OVERFLOW");zs.set(18,"DIVIDE_BY_ZERO");zs.set(33,"ENUM_RANGE_ERROR");zs.set(34,"BAD_STORAGE_DATA");zs.set(49,"STACK_UNDERFLOW");zs.set(50,"ARRAY_RANGE_ERROR");zs.set(65,"OUT_OF_MEMORY");zs.set(81,"UNINITIALIZED_FUNCTION_CALL");const _se=new RegExp(/^bytes([0-9]*)$/),Nse=new RegExp(/^(u?int)([0-9]*)$/);let Rx=null,h3=1024;function Mse(t,e,r,n){let s="missing revert data",i=null;const o=null;let a=null;if(r){s="execution reverted";const l=fe(r);if(r=ne(r),l.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(l.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(ne(l.slice(0,4))==="0x08c379a0")try{i=n.decode(["string"],l.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(ne(l.slice(0,4))==="0x4e487b71")try{const u=Number(n.decode(["uint256"],l.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[u]},i=`Panic due to ${zs.get(u)||"UNKNOWN"}(${u})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?Xe(e.to):null,data:e.data||"0x"};return e.from&&(c.from=Xe(e.from)),Lt(s,"CALL_EXCEPTION",{action:t,data:r,reason:i,transaction:c,invocation:o,revert:a})}var Yo,Wl;const F0=class F0{constructor(){W(this,Yo)}getDefaultValue(e){const r=e.map(s=>ee(this,Yo,Wl).call(this,Ar.from(s)));return new g1(r,"_").defaultValue()}encode(e,r){o7(r.length,e.length,"types/values length mismatch");const n=e.map(o=>ee(this,Yo,Wl).call(this,Ar.from(o))),s=new g1(n,"_"),i=new Ww;return s.encode(i,r),i.data}decode(e,r,n){const s=e.map(o=>ee(this,Yo,Wl).call(this,Ar.from(o)));return new g1(s,"_").decode(new Kw(r,n,h3))}static _setDefaultMaxInflation(e){M(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),h3=e}static defaultAbiCoder(){return Rx==null&&(Rx=new F0),Rx}static getBuiltinCallException(e,r,n){return Mse(e,r,n,F0.defaultAbiCoder())}};Yo=new WeakSet,Wl=function(e){if(e.isArray())return new nne(ee(this,Yo,Wl).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new g1(e.components.map(n=>ee(this,Yo,Wl).call(this,n)),e.name);switch(e.baseType){case"address":return new tne(e.name);case"bool":return new sne(e.name);case"string":return new hne(e.name);case"bytes":return new ine(e.name);case"":return new cne(e.name)}let r=e.type.match(Nse);if(r){let n=parseInt(r[2]||"256");return M(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new dne(n/8,r[1]==="int",e.name)}if(r=e.type.match(_se),r){let n=parseInt(r[1]);return M(n!==0&&n<=32,"invalid bytes length","param",e),new one(n,e.name)}M(!1,"invalid type","type",e.type)};let op=F0;class Dse{constructor(e,r,n){G(this,"fragment");G(this,"name");G(this,"signature");G(this,"topic");G(this,"args");const s=e.name,i=e.format();me(this,{fragment:e,name:s,signature:i,topic:r,args:n})}}class Lse{constructor(e,r,n,s){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");G(this,"value");const i=e.name,o=e.format();me(this,{fragment:e,name:i,args:n,signature:o,selector:r,value:s})}}class jse{constructor(e,r,n){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");const s=e.name,i=e.format();me(this,{fragment:e,name:s,args:n,signature:i,selector:r})}}class p3{constructor(e){G(this,"hash");G(this,"_isIndexed");me(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const y3={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},v3={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&y3[t.toString()]&&(e=y3[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var ei,ti,ri,Dr,lf,sv,uf,iv;const hc=class hc{constructor(e){W(this,lf);W(this,uf);G(this,"fragments");G(this,"deploy");G(this,"fallback");G(this,"receive");W(this,ei,void 0);W(this,ti,void 0);W(this,ri,void 0);W(this,Dr,void 0);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,N(this,ri,new Map),N(this,ei,new Map),N(this,ti,new Map);const n=[];for(const o of r)try{n.push(gl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}me(this,{fragments:Object.freeze(n)});let s=null,i=!1;N(this,Dr,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}me(this,{deploy:o});return;case"fallback":o.inputs.length===0?i=!0:(M(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${a}]`,o),s=o,i=s.payable);return;case"function":c=S(this,ri);break;case"event":c=S(this,ti);break;case"error":c=S(this,ei);break;default:return}const l=o.format();c.has(l)||c.set(l,o)}),this.deploy||me(this,{deploy:so.from("constructor()")}),me(this,{fallback:s,receive:i})}format(e){const r=e?"minimal":"full";return this.fragments.map(s=>s.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return op.defaultAbiCoder()}getFunctionName(e){const r=ee(this,lf,sv).call(this,e,null,!1);return M(r,"no matching function","key",e),r.name}hasFunction(e){return!!ee(this,lf,sv).call(this,e,null,!1)}getFunction(e,r){return ee(this,lf,sv).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from(S(this,ri).keys());r.sort((n,s)=>n.localeCompare(s));for(let n=0;nn.localeCompare(s));for(let n=0;n1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");M(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=pn.from(e).format(),e==="Error(string)")return pn.from("error Error(string)");if(e==="Panic(uint256)")return pn.from("error Panic(uint256)");const n=S(this,ei).get(e);return n||null}forEachError(e){const r=Array.from(S(this,ei).keys());r.sort((n,s)=>n.localeCompare(s));for(let n=0;ni.type==="string"?Cr(o):i.type==="bytes"?Ct(ne(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=go(o):i.type.match(/^bytes/)?o=Fee(o,32):i.type==="address"&&S(this,Dr).encode(["address"],[o]),pl(ne(o),32));for(r.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){M(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?M(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?n.push(i.map(c=>s(a,c))):n.push(s(a,i))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const o=this.getEvent(e);M(o,"unknown event","eventFragment",e),e=o}const n=[],s=[],i=[];return e.anonymous||n.push(e.topicHash),M(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const c=r[a];if(o.indexed)if(o.type==="string")n.push(Cr(c));else if(o.type==="bytes")n.push(Ct(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(S(this,Dr).encode([o.type],[c]))}else s.push(o),i.push(c)}),{data:S(this,Dr).encode(s,i),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const h=this.getEvent(e);M(h,"unknown event","eventFragment",e),e=h}if(n!=null&&!e.anonymous){const h=e.topicHash;M(vt(n[0],32)&&n[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(Ar.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=n!=null?S(this,Dr).decode(s,ot(n)):null,c=S(this,Dr).decode(i,r,!0),l=[],u=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let y=null;if(h.indexed)if(a==null)y=new p3(null);else if(o[p])y=new p3(a[d++]);else try{y=a[d++]}catch(g){y=g}else try{y=c[f++]}catch(g){y=g}l.push(y),u.push(h.name||null)}),Uf.fromItems(l,u)}parseTransaction(e){const r=fe(e.data,"tx.data"),n=ye(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(ne(r.slice(0,4)));if(!s)return null;const i=S(this,Dr).decode(s.inputs,r.slice(4));return new Lse(s,s.selector,i,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new Dse(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=ne(e),n=this.getError(xt(r,0,4));if(!n)return null;const s=S(this,Dr).decode(n.inputs,xt(r,4));return new jse(n,n.selector,s)}static from(e){return e instanceof hc?e:typeof e=="string"?new hc(JSON.parse(e)):typeof e.formatJson=="function"?new hc(e.formatJson()):typeof e.format=="function"?new hc(e.format("json")):new hc(e)}};ei=new WeakMap,ti=new WeakMap,ri=new WeakMap,Dr=new WeakMap,lf=new WeakSet,sv=function(e,r,n){if(vt(e)){const i=e.toLowerCase();for(const o of S(this,ri).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of S(this,ri))o.split("(")[0]===e&&i.push(a);if(r){const o=r.length>0?r[r.length-1]:null;let a=r.length,c=!0;zr.isTyped(o)&&o.type==="overrides"&&(c=!1,a--);for(let l=i.length-1;l>=0;l--){const u=i[l].inputs.length;u!==a&&(!c||u!==a-1)&&i.splice(l,1)}for(let l=i.length-1;l>=0;l--){const u=i[l].inputs;for(let f=0;f=u.length){if(r[f].type==="overrides")continue;i.splice(l,1);break}if(r[f].type!==u[f].baseType){i.splice(l,1);break}}}}if(i.length===1&&r&&r.length!==i[0].inputs.length){const o=r[r.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&n){const o=i.map(a=>JSON.stringify(a.format())).join(", ");M(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=S(this,ri).get(ui.from(e).format());return s||null},uf=new WeakSet,iv=function(e,r,n){if(vt(e)){const i=e.toLowerCase();for(const o of S(this,ti).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of S(this,ti))o.split("(")[0]===e&&i.push(a);if(r){for(let o=i.length-1;o>=0;o--)i[o].inputs.length=0;o--){const a=i[o].inputs;for(let c=0;c1&&n){const o=i.map(a=>JSON.stringify(a.format())).join(", ");M(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=S(this,ti).get(li.from(e).format());return s||null};let c2=hc;const rD=BigInt(0);function Nu(t){return t??null}function Gt(t){return t==null?null:t.toString()}class m3{constructor(e,r,n){G(this,"gasPrice");G(this,"maxFeePerGas");G(this,"maxPriorityFeePerGas");me(this,{gasPrice:Nu(e),maxFeePerGas:Nu(r),maxPriorityFeePerGas:Nu(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:Gt(e),maxFeePerGas:Gt(r),maxPriorityFeePerGas:Gt(n)}}}function ap(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=ne(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=ye(t[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=_e(t[s],`request.${s}`));return t.accessList&&(e.accessList=Pl(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>Um(s)?ne(s):Object.assign({},s))),e}var Ki;class Bse{constructor(e,r){G(this,"provider");G(this,"number");G(this,"hash");G(this,"timestamp");G(this,"parentHash");G(this,"parentBeaconBlockRoot");G(this,"nonce");G(this,"difficulty");G(this,"gasLimit");G(this,"gasUsed");G(this,"stateRoot");G(this,"receiptsRoot");G(this,"blobGasUsed");G(this,"excessBlobGas");G(this,"miner");G(this,"prevRandao");G(this,"extraData");G(this,"baseFeePerGas");W(this,Ki,void 0);N(this,Ki,e.transactions.map(n=>typeof n!="string"?new cp(n,r):n)),me(this,{provider:r,hash:Nu(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Nu(e.prevRandao),extraData:e.extraData,baseFeePerGas:Nu(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return S(this,Ki).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=S(this,Ki).slice();return e.length===0?[]:(J(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:c,nonce:l,number:u,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:y,transactions:g}=this;return{_type:"Block",baseFeePerGas:Gt(e),difficulty:Gt(r),extraData:n,gasLimit:Gt(s),gasUsed:Gt(i),blobGasUsed:Gt(this.blobGasUsed),excessBlobGas:Gt(this.excessBlobGas),hash:o,miner:a,prevRandao:c,nonce:l,number:u,parentHash:f,timestamp:y,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>enew by(s,r))));let n=rD;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),me(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return S(this,_p)}toJSON(){const{to:e,from:r,contractAddress:n,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:c,logs:l,status:u,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:n,cumulativeGasUsed:Gt(this.cumulativeGasUsed),from:r,gasPrice:Gt(this.gasPrice),blobGasUsed:Gt(this.blobGasUsed),blobGasPrice:Gt(this.blobGasPrice),gasUsed:Gt(this.gasUsed),hash:s,index:i,logs:l,logsBloom:c,root:f,status:u,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(a)return null;const{blockNumber:d,nonce:h}=await Fr({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h{if(d==null||d.status!==0)return d;J(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},u=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(u);if(u){if(await u.confirmations()>=n)return l(u)}else if(await c(),n===0)return null;return await new Promise((d,h)=>{const p=[],y=()=>{p.forEach(m=>m())};if(p.push(()=>{a=!0}),s>0){const m=setTimeout(()=>{y(),h(Lt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(m)})}const g=async m=>{if(await m.confirmations()>=n){y();try{d(l(m))}catch(x){h(x)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const m=async()=>{try{await c()}catch(x){if(Vr(x,"TRANSACTION_REPLACED")){y(),h(x);return}}a||this.provider.once("block",m)};p.push(()=>{this.provider.off("block",m)}),this.provider.once("block",m)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return J(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),iD(this)}reorderedEvent(e){return J(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),J(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),sD(this,e)}replaceableTransaction(e){M(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new Mk(this,this.provider);return N(r,Jo,e),r}};Jo=new WeakMap;let cp=Mk;function Fse(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function sD(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function iD(t){return{orphan:"drop-transaction",tx:t}}function Use(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class jC extends by{constructor(r,n,s){super(r,r.provider);G(this,"interface");G(this,"fragment");G(this,"args");const i=n.decodeEventLog(s,r.data,r.topics);me(this,{args:i,fragment:s,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class oD extends by{constructor(r,n){super(r,r.provider);G(this,"error");me(this,{error:n})}}var ff;class Vse extends nD{constructor(r,n,s){super(s,n);W(this,ff,void 0);N(this,ff,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?S(this,ff).getEvent(r.topics[0]):null;if(n)try{return new jC(r,S(this,ff),n)}catch(s){return new oD(r,s)}return r})}}ff=new WeakMap;var Np;class BC extends cp{constructor(r,n,s){super(s,n);W(this,Np,void 0);N(this,Np,r)}async wait(r,n){const s=await super.wait(r,n);return s==null?null:new Vse(S(this,Np),this.provider,s)}}Np=new WeakMap;class aD extends d7{constructor(r,n,s,i){super(r,n,s);G(this,"log");me(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class $se extends aD{constructor(e,r,n,s,i){super(e,r,n,new jC(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);me(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const g3=BigInt(0);function cD(t){return t&&typeof t.call=="function"}function lD(t){return t&&typeof t.estimateGas=="function"}function Xm(t){return t&&typeof t.resolveName=="function"}function uD(t){return t&&typeof t.sendTransaction=="function"}function fD(t){if(t!=null){if(Xm(t))return t;if(t.provider)return t.provider}}var Mp;class zse{constructor(e,r,n){W(this,Mp,void 0);G(this,"fragment");if(me(this,{fragment:r}),r.inputs.lengthn[c]==null?null:a.walkAsync(n[c],(u,f)=>u==="address"?Array.isArray(f)?Promise.all(f.map(d=>wr(d,i))):wr(f,i):f)));return e.interface.encodeFilterTopics(r,o)}())}getTopicFilter(){return S(this,Mp)}}Mp=new WeakMap;function xl(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Sc(t){return t==null?null:t.provider||null}async function dD(t,e){const r=zr.dereference(t,"overrides");M(typeof r=="object","invalid overrides parameter","overrides",t);const n=ap(r);return M(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),M(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function Hse(t,e,r){const n=xl(t,"resolveName"),s=Xm(n)?n:null;return await Promise.all(e.map((i,o)=>i.walkAsync(r[o],(a,c)=>(c=zr.dereference(c,a),a==="address"?wr(c,s):c))))}function Gse(t){const e=async function(o){const a=await dD(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await wr(a.from,fD(t.runner)));const c=t.interface,l=ye(a.value||g3,"overrides.value")===g3,u=(a.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!u&&!l&&M(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),M(c.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data);const f=c.receive||c.fallback&&c.fallback.payable;return M(f||l,"cannot send value to non-payable fallback","overrides.value",a.value),M(c.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data),a},r=async function(o){const a=xl(t.runner,"call");J(cD(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(o);try{return await a.call(c)}catch(l){throw vC(l)&&l.data?t.interface.makeError(l.data,c):l}},n=async function(o){const a=t.runner;J(uD(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await a.sendTransaction(await e(o)),l=Sc(t.runner);return new BC(t.interface,l,c)},s=async function(o){const a=xl(t.runner,"estimateGas");return J(lD(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},i=async o=>await n(o);return me(i,{_contract:t,estimateGas:s,populateTransaction:e,send:n,staticCall:r}),i}function qse(t,e){const r=function(...l){const u=t.interface.getFunction(e,l);return J(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:l}}),u},n=async function(...l){const u=r(...l);let f={};if(u.inputs.length+1===l.length&&(f=await dD(l.pop()),f.from&&(f.from=await wr(f.from,fD(t.runner)))),u.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Hse(t.runner,u.inputs,l);return Object.assign({},f,await Fr({to:t.getAddress(),data:t.interface.encodeFunctionData(u,d)}))},s=async function(...l){const u=await a(...l);return u.length===1?u[0]:u},i=async function(...l){const u=t.runner;J(uD(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await u.sendTransaction(await n(...l)),d=Sc(t.runner);return new BC(t.interface,d,f)},o=async function(...l){const u=xl(t.runner,"estimateGas");return J(lD(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await n(...l))},a=async function(...l){const u=xl(t.runner,"call");J(cD(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await n(...l);let d="0x";try{d=await u.call(f)}catch(p){throw vC(p)&&p.data?t.interface.makeError(p.data,f):p}const h=r(...l);return t.interface.decodeFunctionResult(h,d)},c=async(...l)=>r(...l).constant?await s(...l):await i(...l);return me(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:o,populateTransaction:n,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=t.interface.getFunction(e);return J(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),l}}),c}function Wse(t,e){const r=function(...s){const i=t.interface.getEvent(e,s);return J(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},n=function(...s){return new zse(t,r(...s),s)};return me(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return J(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),n}const m0=Symbol.for("_ethersInternal_contract"),hD=new WeakMap;function Kse(t,e){hD.set(t[m0],e)}function An(t){return hD.get(t[m0])}function Qse(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function FC(t,e){let r,n=null;if(Array.isArray(e)){const i=function(o){if(vt(o,32))return o;const a=t.interface.getEvent(o);return M(a,"unknown fragment","name",o),a.topicHash};r=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?r=[null]:typeof e=="string"?vt(e,32)?r=[e]:(n=t.interface.getEvent(e),M(n,"unknown fragment","event",e),r=[n.topicHash]):Qse(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):M(!1,"unknown event name","event",e);r=r.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=r.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:n,tag:s,topics:r}}async function Zd(t,e){const{subs:r}=An(t);return r.get((await FC(t,e)).tag)||null}async function x3(t,e,r){const n=Sc(t.runner);J(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await FC(t,r),{addr:a,subs:c}=An(t);let l=c.get(i);if(!l){const f={address:a||t,topics:o},d=g=>{let m=s;if(m==null)try{m=t.interface.getEvent(g.topics[0])}catch{}if(m){const x=m,b=s?t.interface.decodeEventLog(s,g.data,g.topics):[];u2(t,r,b,w=>new $se(t,w,r,x,g))}else u2(t,r,[],x=>new aD(t,x,r,g))};let h=[];l={tag:i,listeners:[],start:()=>{h.length||h.push(n.on(f,d))},stop:async()=>{if(h.length==0)return;let g=h;h=[],await Promise.all(g),n.off(f,d)}},c.set(i,l)}return l}let l2=Promise.resolve();async function Yse(t,e,r,n){await l2;const s=await Zd(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const c=Array.from(r);n&&c.push(n(a?null:o));try{o.call(t,...c)}catch{}return!a}),s.listeners.length===0&&(s.stop(),An(t).subs.delete(s.tag)),i>0}async function u2(t,e,r,n){try{await l2}catch{}const s=Yse(t,e,r,n);return l2=s,await s}const b1=["then"];var k1e;const Ch=class Ch{constructor(e,r,n,s){G(this,"target");G(this,"interface");G(this,"runner");G(this,"filters");G(this,k1e);G(this,"fallback");M(typeof e=="string"||xM(e),"invalid value for Contract target","target",e),n==null&&(n=null);const i=c2.from(r);me(this,{target:e,runner:n,interface:i}),Object.defineProperty(this,m0,{value:{}});let o,a=null,c=null;if(s){const f=Sc(n);c=new BC(this.interface,f,s)}let l=new Map;if(typeof e=="string")if(vt(e))a=e,o=Promise.resolve(e);else{const f=xl(n,"resolveName");if(!Xm(f))throw Lt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Lt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return An(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return An(this).addr=f,f});Kse(this,{addrPromise:o,addr:a,deployTx:c,subs:l});const u=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||b1.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!Vr(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>b1.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return me(this,{filters:u}),me(this,{fallback:i.receive||i.fallback?Gse(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||b1.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!Vr(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||b1.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Ch(this.target,this.interface,e)}attach(e){return new Ch(e,this.interface,this.runner)}async getAddress(){return await An(this).addrPromise}async getDeployedCode(){const e=Sc(this.runner);J(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=Sc(this.runner);return J(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);n.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return An(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),qse(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),Wse(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:s,addrPromise:i}=An(this),o=s||await i,{fragment:a,topics:c}=await FC(this,e),l={address:o,topics:c,fromBlock:r,toBlock:n},u=Sc(this.runner);return J(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(l)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new jC(f,this.interface,d)}catch(h){return new oD(f,h)}return new by(f,u)})}async on(e,r){const n=await x3(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await x3(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await u2(this,e,r,null)}async listenerCount(e){if(e){const s=await Zd(this,e);return s?s.listeners.length:0}const{subs:r}=An(this);let n=0;for(const{listeners:s}of r.values())n+=s.length;return n}async listeners(e){if(e){const s=await Zd(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:r}=An(this);let n=[];for(const{listeners:s}of r.values())n=n.concat(s.map(({listener:i})=>i));return n}async off(e,r){const n=await Zd(this,e);if(!n)return this;if(r){const s=n.listeners.map(({listener:i})=>i).indexOf(r);s>=0&&n.listeners.splice(s,1)}return(r==null||n.listeners.length===0)&&(n.stop(),An(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await Zd(this,e);if(!r)return this;r.stop(),An(this).subs.delete(r.tag)}else{const{subs:r}=An(this);for(const{tag:n,stop:s}of r.values())s(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends Ch{constructor(s,i=null){super(s,e,i)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};k1e=m0;let f2=Ch;function Jse(){return f2}class Mu extends Jse(){}function Ix(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):M(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Xse{constructor(e){G(this,"name");me(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const pD=new RegExp("^(ipfs)://(.*)$","i"),b3=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),pD,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Xo,Bc,Zo,Kl,U0,yD;const gu=class gu{constructor(e,r,n){W(this,Zo);G(this,"provider");G(this,"address");G(this,"name");W(this,Xo,void 0);W(this,Bc,void 0);me(this,{provider:e,address:r,name:n}),N(this,Xo,null),N(this,Bc,new Mu(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return S(this,Xo)==null&&N(this,Xo,(async()=>{try{return await S(this,Bc).supportsInterface("0x9061b923")}catch(e){if(Vr(e,"CALL_EXCEPTION"))return!1;throw N(this,Xo,null),e}})()),await S(this,Xo)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await ee(this,Zo,Kl).call(this,"addr(bytes32)");return i==null||i===vl?null:i}catch(i){if(Vr(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await ee(this,Zo,Kl).call(this,"addr(bytes32,uint)",[i]);if(vt(o,20))return Xe(o)}let r=null;for(const i of this.provider.plugins)if(i instanceof Xse&&i.supportsCoinType(e)){r=i;break}if(r==null)return null;const n=await ee(this,Zo,Kl).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const s=await r.decodeAddress(e,n);if(s!=null)return s;J(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await ee(this,Zo,Kl).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await ee(this,Zo,Kl).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const s=r[1]==="e3010170"?"ipfs":"ipns",i=parseInt(r[4],16);if(r[5].length===i*2)return`${s}://${f7("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;J(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))}}function wy(t,e){return r=>{const n={};for(const s in t){let i=s;if(e&&s in e&&!(i in r)){for(const o of e[s])if(o in r){i=o;break}}try{const o=t[s](r[i]);o!==void 0&&(n[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";J(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:r})}}return n}}function Zse(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}M(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Qf(t){return M(vt(t,!0),"invalid data","value",t),t}function xr(t){return M(vt(t,32),"invalid hash","value",t),t}const eie=wy({address:Xe,blockHash:xr,blockNumber:_e,data:Qf,index:_e,removed:Ge(Zse,!1),topics:Zm(xr),transactionHash:xr,transactionIndex:_e},{index:["logIndex"]});function tie(t){return eie(t)}const rie=wy({hash:Ge(xr),parentHash:xr,parentBeaconBlockRoot:Ge(xr,null),number:_e,timestamp:_e,nonce:Ge(Qf),difficulty:ye,gasLimit:ye,gasUsed:ye,stateRoot:Ge(xr,null),receiptsRoot:Ge(xr,null),blobGasUsed:Ge(ye,null),excessBlobGas:Ge(ye,null),miner:Ge(Xe),prevRandao:Ge(xr,null),extraData:Qf,baseFeePerGas:Ge(ye)},{prevRandao:["mixHash"]});function nie(t){const e=rie(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:vD(r)),e}const sie=wy({transactionIndex:_e,blockNumber:_e,transactionHash:xr,address:Xe,topics:Zm(xr),data:Qf,index:_e,blockHash:xr},{index:["logIndex"]});function iie(t){return sie(t)}const oie=wy({to:Ge(Xe,null),from:Ge(Xe,null),contractAddress:Ge(Xe,null),index:_e,root:Ge(ne),gasUsed:ye,blobGasUsed:Ge(ye,null),logsBloom:Ge(Qf),blockHash:xr,hash:xr,logs:Zm(iie),blockNumber:_e,cumulativeGasUsed:ye,effectiveGasPrice:Ge(ye),blobGasPrice:Ge(ye,null),status:Ge(_e),type:Ge(_e,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function aie(t){return oie(t)}function vD(t){t.to&&ye(t.to)===w3&&(t.to="0x0000000000000000000000000000000000000000");const e=wy({hash:xr,index:Ge(_e,void 0),type:r=>r==="0x"||r==null?0:_e(r),accessList:Ge(Pl,null),blobVersionedHashes:Ge(Zm(xr,!0),null),blockHash:Ge(xr,null),blockNumber:Ge(_e,null),transactionIndex:Ge(_e,null),from:Xe,gasPrice:Ge(ye),maxPriorityFeePerGas:Ge(ye),maxFeePerGas:Ge(ye),maxFeePerBlobGas:Ge(ye,null),gasLimit:ye,to:Ge(Xe,null),value:ye,nonce:_e,data:Qf,creates:Ge(Xe,null),chainId:Ge(ye,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=Zre(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Us.from(t.signature):e.signature=Us.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&ye(e.blockHash)===w3&&(e.blockHash=null),e}const cie="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Ey{constructor(e){G(this,"name");me(this,{name:e})}clone(){return new Ey(this.name)}}class eg extends Ey{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);G(this,"effectiveBlock");G(this,"txBase");G(this,"txCreate");G(this,"txDataZero");G(this,"txDataNonzero");G(this,"txAccessListStorageKey");G(this,"txAccessListAddress");const s={effectiveBlock:r};function i(o,a){let c=(n||{})[o];c==null&&(c=a),M(typeof c=="number",`invalud value for ${o}`,"costs",n),s[o]=c}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),me(this,s)}clone(){return new eg(this.effectiveBlock,this)}}class tg extends Ey{constructor(r,n){super("org.ethers.plugins.network.Ens");G(this,"address");G(this,"targetNetwork");me(this,{address:r||cie,targetNetwork:n??1})}clone(){return new tg(this.address,this.targetNetwork)}}var Dp,Lp;class lie extends Ey{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");W(this,Dp,void 0);W(this,Lp,void 0);N(this,Dp,r),N(this,Lp,n)}get url(){return S(this,Dp)}get processFunc(){return S(this,Lp)}clone(){return this}}Dp=new WeakMap,Lp=new WeakMap;const Ox=new Map;var df,hf,ea;const xu=class xu{constructor(e,r){W(this,df,void 0);W(this,hf,void 0);W(this,ea,void 0);N(this,df,e),N(this,hf,ye(r)),N(this,ea,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return S(this,df)}set name(e){N(this,df,e)}get chainId(){return S(this,hf)}set chainId(e){N(this,hf,ye(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===ye(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===ye(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===ye(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(S(this,ea).values())}attachPlugin(e){if(S(this,ea).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return S(this,ea).set(e.name,e.clone()),this}getPlugin(e){return S(this,ea).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new xu(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new eg;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let s=2;s9){let s=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||s++,n[1]=s.toString()}return BigInt(n[0]+n[1])}function S3(t){return new lie(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([n.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:E3(a.maxFee,9),maxPriorityFeePerGas:E3(a.maxPriorityFee,9)}}catch(i){J(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:s,error:i})}})}let C3=!1;function uie(){if(C3)return;C3=!0;function t(e,r,n){const s=function(){const i=new pi(e,r);return n.ensNetwork!=null&&i.attachPlugin(new tg(null,n.ensNetwork)),i.attachPlugin(new eg),(n.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};pi.register(e,s),pi.register(r,s),n.altNames&&n.altNames.forEach(i=>{pi.register(i,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[S3("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[S3("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function d2(t){return JSON.parse(JSON.stringify(t))}var Qi,es,ta,ni,pf,ov;class fie{constructor(e){W(this,pf);W(this,Qi,void 0);W(this,es,void 0);W(this,ta,void 0);W(this,ni,void 0);N(this,Qi,e),N(this,es,null),N(this,ta,4e3),N(this,ni,-2)}get pollingInterval(){return S(this,ta)}set pollingInterval(e){N(this,ta,e)}start(){S(this,es)||(N(this,es,S(this,Qi)._setTimeout(ee(this,pf,ov).bind(this),S(this,ta))),ee(this,pf,ov).call(this))}stop(){S(this,es)&&(S(this,Qi)._clearTimeout(S(this,es)),N(this,es,null))}pause(e){this.stop(),e&&N(this,ni,-2)}resume(){this.start()}}Qi=new WeakMap,es=new WeakMap,ta=new WeakMap,ni=new WeakMap,pf=new WeakSet,ov=async function(){try{const e=await S(this,Qi).getBlockNumber();if(S(this,ni)===-2){N(this,ni,e);return}if(e!==S(this,ni)){for(let r=S(this,ni)+1;r<=e;r++){if(S(this,es)==null)return;await S(this,Qi).emit("block",r)}N(this,ni,e)}}catch{}S(this,es)!=null&&N(this,es,S(this,Qi)._setTimeout(ee(this,pf,ov).bind(this),S(this,ta)))};var Fc,Uc,ra;class UC{constructor(e){W(this,Fc,void 0);W(this,Uc,void 0);W(this,ra,void 0);N(this,Fc,e),N(this,ra,!1),N(this,Uc,r=>{this._poll(r,S(this,Fc))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){S(this,ra)||(N(this,ra,!0),S(this,Uc).call(this,-2),S(this,Fc).on("block",S(this,Uc)))}stop(){S(this,ra)&&(N(this,ra,!1),S(this,Fc).off("block",S(this,Uc)))}pause(e){this.stop()}resume(){this.start()}}Fc=new WeakMap,Uc=new WeakMap,ra=new WeakMap;var yf,Yi;class die extends UC{constructor(r,n){super(r);W(this,yf,void 0);W(this,Yi,void 0);N(this,yf,n),N(this,Yi,-2)}pause(r){r&&N(this,Yi,-2),super.pause(r)}async _poll(r,n){const s=await n.getBlock(S(this,yf));s!=null&&(S(this,Yi)===-2?N(this,Yi,s.number):s.number>S(this,Yi)&&(n.emit(S(this,yf),s.number),N(this,Yi,s.number)))}}yf=new WeakMap,Yi=new WeakMap;var V0;class hie extends UC{constructor(r,n){super(r);W(this,V0,void 0);N(this,V0,d2(n))}async _poll(r,n){throw new Error("@TODO")}}V0=new WeakMap;var vf;class pie extends UC{constructor(r,n){super(r);W(this,vf,void 0);N(this,vf,n)}async _poll(r,n){const s=await n.getTransactionReceipt(S(this,vf));s&&n.emit(S(this,vf),s)}}vf=new WeakMap;var Ji,mf,gf,na,ts,$0,mD;class VC{constructor(e,r){W(this,$0);W(this,Ji,void 0);W(this,mf,void 0);W(this,gf,void 0);W(this,na,void 0);W(this,ts,void 0);N(this,Ji,e),N(this,mf,d2(r)),N(this,gf,ee(this,$0,mD).bind(this)),N(this,na,!1),N(this,ts,-2)}start(){S(this,na)||(N(this,na,!0),S(this,ts)===-2&&S(this,Ji).getBlockNumber().then(e=>{N(this,ts,e)}),S(this,Ji).on("block",S(this,gf)))}stop(){S(this,na)&&(N(this,na,!1),S(this,Ji).off("block",S(this,gf)))}pause(e){this.stop(),e&&N(this,ts,-2)}resume(){this.start()}}Ji=new WeakMap,mf=new WeakMap,gf=new WeakMap,na=new WeakMap,ts=new WeakMap,$0=new WeakSet,mD=async function(e){if(S(this,ts)===-2)return;const r=d2(S(this,mf));r.fromBlock=S(this,ts)+1,r.toBlock=e;const n=await S(this,Ji).getLogs(r);if(n.length===0){S(this,ts){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const s=Object.keys(n);return s.sort(),s.reduce((i,o)=>(i[o]=n[o],i),{})}return n})}class gD{constructor(e){G(this,"name");me(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function mie(t){return JSON.parse(JSON.stringify(t))}function h2(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function _x(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(vt(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:av("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:av("orphan",r),filter:mie(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(s=>s==null?null:Array.isArray(s)?h2(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(r.address){const s=[],i=[],o=a=>{vt(a)?s.push(a):i.push((async()=>{s.push(await wr(a,e))})())};Array.isArray(r.address)?r.address.forEach(o):o(r.address),i.length&&await Promise.all(i),n.address=h2(s.map(a=>a.toLowerCase()))}return{filter:n,tag:av("event",n),type:"event"}}M(!1,"unknown ProviderEvent","event",t)}function Nx(){return new Date().getTime()}const gie={cacheTimeout:250,pollingInterval:4e3};var Lr,sa,jr,xf,Rn,Vc,ia,Xi,jp,rs,bf,wf,Jr,Cn,Bp,p2,Fp,y2,$c,eh,Up,v2,zc,th,Ef,cv;class xie{constructor(e,r){W(this,Jr);W(this,Bp);W(this,Fp);W(this,$c);W(this,Up);W(this,zc);W(this,Ef);W(this,Lr,void 0);W(this,sa,void 0);W(this,jr,void 0);W(this,xf,void 0);W(this,Rn,void 0);W(this,Vc,void 0);W(this,ia,void 0);W(this,Xi,void 0);W(this,jp,void 0);W(this,rs,void 0);W(this,bf,void 0);W(this,wf,void 0);if(N(this,wf,Object.assign({},gie,r||{})),e==="any")N(this,Vc,!0),N(this,Rn,null);else if(e){const n=pi.from(e);N(this,Vc,!1),N(this,Rn,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else N(this,Vc,!1),N(this,Rn,null);N(this,Xi,-1),N(this,ia,new Map),N(this,Lr,new Map),N(this,sa,new Map),N(this,jr,null),N(this,xf,!1),N(this,jp,1),N(this,rs,new Map),N(this,bf,!1)}get pollingInterval(){return S(this,wf).pollingInterval}get provider(){return this}get plugins(){return Array.from(S(this,sa).values())}attachPlugin(e){if(S(this,sa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return S(this,sa).set(e.name,e.connect(this)),this}getPlugin(e){return S(this,sa).get(e)||null}get disableCcipRead(){return S(this,bf)}set disableCcipRead(e){N(this,bf,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=r.toLowerCase(),o=[];for(let a=0;a=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:f}}),o.push(f)}J(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:o}})}_wrapBlock(e,r){return new Bse(nie(e),this)}_wrapLog(e,r){return new by(tie(e),this)}_wrapTransactionReceipt(e,r){return new nD(aie(e),this)}_wrapTransactionResponse(e,r){return new cp(vD(e),this)}_detectNetwork(){J(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){J(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=_e(await ee(this,Jr,Cn).call(this,{method:"getBlockNumber"}),"%response");return S(this,Xi)>=0&&N(this,Xi,e),e}_getAddress(e){return wr(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(vt(e))return vt(e,32)?e:yu(e);if(typeof e=="bigint"&&(e=_e(e,"blockTag")),typeof e=="number")return e>=0?yu(e):S(this,Xi)>=0?yu(S(this,Xi)+e):this.getBlockNumber().then(r=>yu(r+e));M(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?h2(c.map(l=>l.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,s=(c,l,u)=>{let f;switch(c.length){case 0:break;case 1:f=c[0];break;default:c.sort(),f=c}if(n&&(l!=null||u!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),r.length&&(d.topics=r),l&&(d.fromBlock=l),u&&(d.toBlock=u),n&&(d.blockHash=n),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)i.push(this._getAddress(c));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(c=>typeof c!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(c=>s(c[0],c[1],c[2])):s(i,o,a)}_getTransactionRequest(e){const r=ap(e),n=[];if(["to","from"].forEach(s=>{if(r[s]==null)return;const i=wr(r[s],this);w1(i)?n.push(async function(){r[s]=await i}()):r[s]=i}),r.blockTag!=null){const s=this._getBlockTag(r.blockTag);w1(s)?n.push(async function(){r.blockTag=await s}()):r.blockTag=s}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if(S(this,Rn)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw S(this,Rn)===s&&N(this,Rn,null),i}})();return N(this,Rn,s),(await s).clone()}const e=S(this,Rn),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(S(this,Vc)?(this.emit("network",n,r),S(this,Rn)===e&&N(this,Rn,Promise.resolve(n))):J(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await Fr({_block:ee(this,Up,v2).call(this,"latest",!1),gasPrice:(async()=>{try{const u=await ee(this,Jr,Cn).call(this,{method:"getGasPrice"});return ye(u,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const u=await ee(this,Jr,Cn).call(this,{method:"getPriorityFee"});return ye(u,"%response")}catch{}return null})()});let a=null,c=null;const l=this._wrapBlock(s,e);return l&&l.baseFeePerGas&&(c=o??BigInt("1000000000"),a=l.baseFeePerGas*yie+c),new m3(i,a,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const s=new xo(n.url),i=await n.processFunc(r,this,s);return new m3(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return w1(r)&&(r=await r),ye(await ee(this,Jr,Cn).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await Fr({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await ee(this,Fp,y2).call(this,ee(this,Bp,p2).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return ye(await ee(this,$c,eh).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return _e(await ee(this,$c,eh).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return ne(await ee(this,$c,eh).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const s=ye(r,"position");return ne(await ee(this,$c,eh).call(this,{method:"getStorage",position:s},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:s}=await Fr({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=sp.from(e);if(i.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:s}=await Fr({network:this.getNetwork(),params:ee(this,Up,v2).call(this,e,!!r)});return s==null?null:this._wrapBlock(s,n)}async getTransaction(e){const{network:r,params:n}=await Fr({network:this.getNetwork(),params:ee(this,Jr,Cn).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await Fr({network:this.getNetwork(),params:ee(this,Jr,Cn).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const s=await ee(this,Jr,Cn).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await Fr({network:this.getNetwork(),result:ee(this,Jr,Cn).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:ne(r)}async getLogs(e){let r=this._getFilter(e);w1(r)&&(r=await r);const{network:n,params:s}=await Fr({network:this.getNetwork(),params:ee(this,Jr,Cn).call(this,{method:"getLogs",filter:r})});return s.map(i=>this._wrapLog(i,n))}_getProvider(e){J(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await g0.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=Xe(e);const r=o2(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await g0.getEnsAddress(this),i=await new Mu(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(i==null||i===vl)return null;const a=await new Mu(i,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(a)!==e?null:a}catch(n){if(Vr(n,"BAD_DATA")&&n.value==="0x"||Vr(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const s=r??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const c=async l=>{try{const u=await this.getTransactionReceipt(e);if(u!=null&&l-u.blockNumber+1>=s){i(u),a&&(clearTimeout(a),a=null);return}}catch(u){console.log("EEE",u)}this.once("block",c)};n!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",c),o(Lt("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){J(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=S(this,rs).get(e);r&&(r.timer&&clearTimeout(r.timer),S(this,rs).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=Ed(this,jp)._++,s=()=>{S(this,rs).delete(n),e()};if(this.paused)S(this,rs).set(n,{timer:null,func:s,time:r});else{const i=setTimeout(s,r);S(this,rs).set(n,{timer:i,func:s,time:Nx()})}return n}_forEachSubscriber(e){for(const r of S(this,Lr).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new gD(e.type);case"block":{const r=new fie(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new die(this,e.type);case"event":return new VC(this,e.filter);case"transaction":return new pie(this,e.hash);case"orphan":return new hie(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of S(this,Lr).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),S(this,jr)!=null&&r.pause(S(this,jr));break}}async on(e,r){const n=await ee(this,Ef,cv).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,S(this,jr)!=null&&n.subscriber.pause(S(this,jr))),this}async once(e,r){const n=await ee(this,Ef,cv).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,S(this,jr)!=null&&n.subscriber.pause(S(this,jr))),this}async emit(e,...r){const n=await ee(this,zc,th).call(this,e,r);if(!n||n.listeners.length===0)return!1;const s=n.listeners.length;return n.listeners=n.listeners.filter(({listener:i,once:o})=>{const a=new d7(this,o?null:i,e);try{i.call(this,...r,a)}catch{}return!o}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),S(this,Lr).delete(n.tag)),s>0}async listenerCount(e){if(e){const n=await ee(this,zc,th).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of S(this,Lr).values())r+=n.length;return r}async listeners(e){if(e){const n=await ee(this,zc,th).call(this,e);return n?n.listeners.map(({listener:s})=>s):[]}let r=[];for(const{listeners:n}of S(this,Lr).values())r=r.concat(n.map(({listener:s})=>s));return r}async off(e,r){const n=await ee(this,zc,th).call(this,e);if(!n)return this;if(r){const s=n.listeners.map(({listener:i})=>i).indexOf(r);s>=0&&n.listeners.splice(s,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),S(this,Lr).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:s}=await ee(this,Ef,cv).call(this,e);n&&s.stop(),S(this,Lr).delete(r)}else for(const[r,{started:n,subscriber:s}]of S(this,Lr))n&&s.stop(),S(this,Lr).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return S(this,xf)}destroy(){this.removeAllListeners();for(const e of S(this,rs).keys())this._clearTimeout(e);N(this,xf,!0)}get paused(){return S(this,jr)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(N(this,Xi,-1),S(this,jr)!=null){if(S(this,jr)==!!e)return;J(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),N(this,jr,!!e);for(const r of S(this,rs).values())r.timer&&clearTimeout(r.timer),r.time=Nx()-r.time}resume(){if(S(this,jr)!=null){this._forEachSubscriber(e=>e.resume()),N(this,jr,null);for(const e of S(this,rs).values()){let r=e.time;r<0&&(r=0),e.time=Nx(),setTimeout(e.func,r)}}}}Lr=new WeakMap,sa=new WeakMap,jr=new WeakMap,xf=new WeakMap,Rn=new WeakMap,Vc=new WeakMap,ia=new WeakMap,Xi=new WeakMap,jp=new WeakMap,rs=new WeakMap,bf=new WeakMap,wf=new WeakMap,Jr=new WeakSet,Cn=async function(e){const r=S(this,wf).cacheTimeout;if(r<0)return await this._perform(e);const n=av(e.method,e);let s=S(this,ia).get(n);return s||(s=this._perform(e),S(this,ia).set(n,s),setTimeout(()=>{S(this,ia).get(n)===s&&S(this,ia).delete(n)},r)),await s},Bp=new WeakSet,p2=async function(e,r,n){J(n=0&&r==="latest"&&s.to!=null&&xt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await wr(s.to,this);let c;try{c=Cie(xt(i.data,4))}catch(f){J(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}J(c.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const l=await this.ccipReadFetch(s,c.calldata,c.urls);J(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:c.errorArgs}});const u={to:a,data:ot([c.selector,Sie([l,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:u});try{const f=await ee(this,Bp,p2).call(this,u,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},u),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},u),error:f}),f}}throw i}},Fp=new WeakSet,y2=async function(e){const{value:r}=await Fr({network:this.getNetwork(),value:e});return r},$c=new WeakSet,eh=async function(e,r,n){let s=this._getAddress(r),i=this._getBlockTag(n);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await ee(this,Fp,y2).call(this,ee(this,Jr,Cn).call(this,Object.assign(e,{address:s,blockTag:i})))},Up=new WeakSet,v2=async function(e,r){if(vt(e,32))return await ee(this,Jr,Cn).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await ee(this,Jr,Cn).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},zc=new WeakSet,th=async function(e,r){let n=await _x(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await _x({orphan:"drop-log",log:r[0]},this)),S(this,Lr).get(n.tag)||null},Ef=new WeakSet,cv=async function(e){const r=await _x(e,this),n=r.tag;let s=S(this,Lr).get(n);return s||(s={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},S(this,Lr).set(n,s)),s};function bie(t,e){try{const r=m2(t,e);if(r)return u0(r)}catch{}return null}function m2(t,e){if(t==="0x")return null;try{const r=_e(xt(t,e,e+32)),n=_e(xt(t,r,r+32));return xt(t,r+32,r+32+n)}catch{}return null}function A3(t){const e=$r(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function wie(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Eie=new Uint8Array([]);function Sie(t){const e=[];let r=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=xt(t,0,32);J(xt(r,0,12)===xt(k3,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=xt(r,12);try{const n=[],s=_e(xt(t,32,64)),i=_e(xt(t,s,s+32)),o=xt(t,s+32);for(let a=0;ae[n]),e}function Ul(t,e){if(t.provider)return t.provider;J(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function T3(t,e){let r=ap(e);if(r.to!=null&&(r.to=wr(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),wr(n,t)]).then(([s,i])=>(M(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else r.from=t.getAddress();return await Fr(r)}class $C{constructor(e){G(this,"provider");me(this,{provider:e||null})}async getNonce(e){return Ul(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await T3(this,e)}async populateTransaction(e){const r=Ul(this,"populateTransaction"),n=await T3(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const s=await this.provider.getNetwork();if(n.chainId!=null){const o=ye(n.chainId);M(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=s.chainId;const i=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||i)?M(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&i&&M(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const o=await r.getFeeData();J(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice)}else{const o=await r.getFeeData();if(n.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const a=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=a,n.maxPriorityFeePerGas=a}else n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(J(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice),n.type=0):J(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await Fr(n)}async estimateGas(e){return Ul(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Ul(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Ul(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=Ul(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const s=sp.from(n);return await r.broadcastTransaction(await this.signTransaction(s))}}var Sf,lv;const Dk=class Dk extends $C{constructor(r,n){super(n);W(this,Sf);G(this,"address");me(this,{address:r})}async getAddress(){return this.address}connect(r){return new Dk(this.address,r)}async signTransaction(r){ee(this,Sf,lv).call(this,"transactions","signTransaction")}async signMessage(r){ee(this,Sf,lv).call(this,"messages","signMessage")}async signTypedData(r,n,s){ee(this,Sf,lv).call(this,"typed-data","signTypedData")}};Sf=new WeakSet,lv=function(r,n){J(!1,`VoidSigner cannot sign ${r}`,"UNSUPPORTED_OPERATION",{operation:n})};let g2=Dk;function Aie(t){return JSON.parse(JSON.stringify(t))}var Xr,si,Hc,oa,Gc,Cf,Vp,x2,$p,b2;class xD{constructor(e){W(this,Vp);W(this,$p);W(this,Xr,void 0);W(this,si,void 0);W(this,Hc,void 0);W(this,oa,void 0);W(this,Gc,void 0);W(this,Cf,void 0);N(this,Xr,e),N(this,si,null),N(this,Hc,ee(this,Vp,x2).bind(this)),N(this,oa,!1),N(this,Gc,null),N(this,Cf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){S(this,oa)||(N(this,oa,!0),ee(this,Vp,x2).call(this,-2))}stop(){S(this,oa)&&(N(this,oa,!1),N(this,Cf,!0),ee(this,$p,b2).call(this),S(this,Xr).off("block",S(this,Hc)))}pause(e){e&&ee(this,$p,b2).call(this),S(this,Xr).off("block",S(this,Hc))}resume(){this.start()}}Xr=new WeakMap,si=new WeakMap,Hc=new WeakMap,oa=new WeakMap,Gc=new WeakMap,Cf=new WeakMap,Vp=new WeakSet,x2=async function(e){try{S(this,si)==null&&N(this,si,this._subscribe(S(this,Xr)));let r=null;try{r=await S(this,si)}catch(i){if(!Vr(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(r==null){N(this,si,null),S(this,Xr)._recoverSubscriber(this,this._recover(S(this,Xr)));return}const n=await S(this,Xr).getNetwork();if(S(this,Gc)||N(this,Gc,n),S(this,Gc).chainId!==n.chainId)throw new Error("chaid changed");if(S(this,Cf))return;const s=await S(this,Xr).send("eth_getFilterChanges",[r]);await this._emitResults(S(this,Xr),s)}catch(r){console.log("@TODO",r)}S(this,Xr).once("block",S(this,Hc))},$p=new WeakSet,b2=function(){const e=S(this,si);e&&(N(this,si,null),e.then(r=>{S(this,Xr).destroyed||S(this,Xr).send("eth_uninstallFilter",[r])}))};var qc;class kie extends xD{constructor(r,n){super(r);W(this,qc,void 0);N(this,qc,Aie(n))}_recover(r){return new VC(r,S(this,qc))}async _subscribe(r){return await r.send("eth_newFilter",[S(this,qc)])}async _emitResults(r,n){for(const s of n)r.emit(S(this,qc),r._wrapLog(s,r._network))}}qc=new WeakMap;class Tie extends xD{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const Pie="bigint,boolean,function,number,string,symbol".split(/,/g);function uv(t){if(t==null||Pie.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(uv);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function Rie(t){return new Promise(e=>{setTimeout(e,t)})}function Vl(t){return t&&t.toLowerCase()}function P3(t){return t&&typeof t.pollingInterval=="number"}const bD={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Mx extends $C{constructor(r,n){super(r);G(this,"address");n=Xe(n),me(this,{address:n})}connect(r){J(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=uv(r),s=[];if(n.from){const o=n.from;s.push((async()=>{const a=await wr(o,this.provider);M(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=a})())}else n.from=this.address;if(n.gasLimit==null&&s.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const o=n.to;s.push((async()=>{n.to=await wr(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(r);return await new Promise((i,o)=>{const a=[1e3,100];let c=0;const l=async()=>{try{const u=await this.provider.getTransaction(s);if(u!=null){i(u.replaceableTransaction(n));return}}catch(u){if(Vr(u,"CANCELLED")||Vr(u,"BAD_DATA")||Vr(u,"NETWORK_ERROR")){u.info==null&&(u.info={}),u.info.sendTransactionHash=s,o(u);return}if(Vr(u,"INVALID_ARGUMENT")&&(c++,u.info==null&&(u.info={}),u.info.sendTransactionHash=s,c>10)){o(u);return}this.provider.emit("error",Lt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{l()},a.pop()||4e3)};l()})}async signTransaction(r){const n=uv(r);if(n.from){const i=await wr(n.from,this.provider);M(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=i}else n.from=this.address;const s=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[s])}async signMessage(r){const n=typeof r=="string"?Sr(r):r;return await this.provider.send("personal_sign",[ne(n),this.address.toLowerCase()])}async signTypedData(r,n,s){const i=uv(s),o=await Kf.resolveNames(r,n,i,async a=>{const c=await wr(a);return M(c!=null,"TypedData does not support null address","value",a),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Kf.getPayload(o.domain,n,o.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?Sr(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),ne(n)])}}var Wc,Af,Zi,ii,Rs,ns,fn,zp,w2;class Iie extends xie{constructor(r,n){super(r,n);W(this,zp);W(this,Wc,void 0);W(this,Af,void 0);W(this,Zi,void 0);W(this,ii,void 0);W(this,Rs,void 0);W(this,ns,void 0);W(this,fn,void 0);N(this,Af,1),N(this,Wc,Object.assign({},bD,n||{})),N(this,Zi,[]),N(this,ii,null),N(this,ns,null),N(this,fn,null);{let i=null;const o=new Promise(a=>{i=a});N(this,Rs,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(M(!s||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),s&&r!=null&&N(this,ns,pi.from(r))):s&&(M(r==null||s.matches(r),"staticNetwork MUST match network object","options",n),N(this,ns,s))}_getOption(r){return S(this,Wc)[r]}get _network(){return J(S(this,ns),"network is not available yet","NETWORK_ERROR"),S(this,ns)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let s=r.transaction;if(s&&s.type!=null&&ye(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},s,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if(S(this,ns))return S(this,ns)}else return r;return S(this,fn)?await S(this,fn):this.ready?(N(this,fn,(async()=>{try{const n=pi.from(ye(await this.send("eth_chainId",[])));return N(this,fn,null),n}catch(n){throw N(this,fn,null),n}})()),await S(this,fn)):(N(this,fn,(async()=>{const n={id:Ed(this,Af)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let s;try{s=(await this._send(n))[0],N(this,fn,null)}catch(i){throw N(this,fn,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return pi.from(ye(s.result));throw this.getRpcError(n,s)})()),await S(this,fn))}_start(){S(this,Rs)==null||S(this,Rs).resolve==null||(S(this,Rs).resolve(),N(this,Rs,null),(async()=>{for(;S(this,ns)==null&&!this.destroyed;)try{N(this,ns,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Lt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await Rie(1e3)}ee(this,zp,w2).call(this)})())}async _waitUntilReady(){if(S(this,Rs)!=null)return await S(this,Rs).promise}_getSubscriber(r){return r.type==="pending"?new Tie(this):r.type==="event"?this._getOption("polling")?new VC(this,r.filter):new kie(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new gD("orphan"):super._getSubscriber(r)}get ready(){return S(this,Rs)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(r[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),n[i]=yu(ye(r[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{r[s]!=null&&(n[s]=ne(r[s]))}),r.accessList&&(n.accessList=Pl(r.accessList)),r.blobVersionedHashes&&(n.blobVersionedHashes=r.blobVersionedHashes.map(s=>s.toLowerCase())),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Vl(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Vl(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[Vl(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Vl(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(Vl):r.filter.address=Vl(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:s}=r,{error:i}=n;if(s==="eth_estimateGas"&&i.message){const c=i.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return Lt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const c=E2(i),l=op.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return l.info={error:i,payload:r},l}const o=JSON.stringify(_ie(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Lt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:r,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const c=r.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Lt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Lt("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Lt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:i}});if(o.match(/only replay-protected/i))return Lt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:c,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?Lt("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:i,payload:r}}):Lt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(Lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const s=Ed(this,Af)._++,i=new Promise((o,a)=>{S(this,Zi).push({resolve:o,reject:a,payload:{method:r,params:n,id:s,jsonrpc:"2.0"}})});return ee(this,zp,w2).call(this),i}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const i=await n;if(r>=i.length)throw new Error("no such account");return new Mx(this,i[r])}const{accounts:s}=await Fr({network:this.getNetwork(),accounts:n});r=Xe(r);for(const i of s)if(Xe(i)===r)return new Mx(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new Mx(this,n))}destroy(){S(this,ii)&&(clearTimeout(S(this,ii)),N(this,ii,null));for(const{payload:r,reject:n}of S(this,Zi))n(Lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));N(this,Zi,[]),super.destroy()}}Wc=new WeakMap,Af=new WeakMap,Zi=new WeakMap,ii=new WeakMap,Rs=new WeakMap,ns=new WeakMap,fn=new WeakMap,zp=new WeakSet,w2=function(){if(S(this,ii))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");N(this,ii,setTimeout(()=>{N(this,ii,null);const n=S(this,Zi);for(N(this,Zi,[]);n.length;){const s=[n.shift()];for(;n.length&&s.length!==S(this,Wc).batchMaxCount;)if(s.push(n.shift()),JSON.stringify(s.map(o=>o.payload)).length>S(this,Wc).batchMaxSize){n.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:c,payload:l}of s){if(this.destroyed){c(Lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const u=o.filter(f=>f.id===l.id)[0];if(u==null){const f=Lt("missing response for request","BAD_DATA",{value:o,info:{payload:l}});this.emit("error",f),c(f);continue}if("error"in u){c(this.getRpcError(l,u));continue}a(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},r))};var aa;class Oie extends Iie{constructor(r,n){super(r,n);W(this,aa,void 0);let s=this._getOption("pollingInterval");s==null&&(s=bD.pollingInterval),N(this,aa,s)}_getSubscriber(r){const n=super._getSubscriber(r);return P3(n)&&(n.pollingInterval=S(this,aa)),n}get pollingInterval(){return S(this,aa)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");N(this,aa,r),this._forEachSubscriber(n=>{P3(n)&&(n.pollingInterval=S(this,aa))})}}aa=new WeakMap;var kf,J8;let wD=(J8=class extends Oie{constructor(r,n,s){r==null&&(r="http://localhost:8545");super(n,s);W(this,kf,void 0);typeof r=="string"?N(this,kf,new xo(r)):N(this,kf,r.clone())}_getConnection(){return S(this,kf).clone()}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){const n=this._getConnection();n.body=JSON.stringify(r),n.setHeader("content-type","application/json");const s=await n.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}},kf=new WeakMap,J8);function E2(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&vt(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=E2(t[e]);if(r)return r}return null}if(typeof t=="string")try{return E2(JSON.parse(t))}catch{}return null}function S2(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)S2(t[r],e);if(typeof t=="string")try{return S2(JSON.parse(t),e)}catch{}}}function _ie(t){const e=[];return S2(t,e),e}var Tf;const Lk=class Lk extends $C{constructor(r,n){super(n);G(this,"address");W(this,Tf,void 0);M(r&&typeof r.sign=="function","invalid private key","privateKey","[ REDACTED ]"),N(this,Tf,r);const s=gy(this.signingKey.publicKey);me(this,{address:s})}get signingKey(){return S(this,Tf)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(r){return new Lk(S(this,Tf),r)}async signTransaction(r){r=ap(r);const{to:n,from:s}=await Fr({to:r.to?wr(r.to,this.provider):void 0,from:r.from?wr(r.from,this.provider):void 0});n!=null&&(r.to=n),s!=null&&(r.from=s),r.from!=null&&(M(Xe(r.from)===this.address,"transaction from address mismatch","tx.from",r.from),delete r.from);const i=sp.from(r);return i.signature=this.signingKey.sign(i.unsignedHash),i.serialized}async signMessage(r){return this.signMessageSync(r)}signMessageSync(r){return this.signingKey.sign(hse(r)).serialized}async signTypedData(r,n,s){const i=await Kf.resolveNames(r,n,s,async o=>{J(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:o}});const a=await this.provider.resolveName(o);return J(a!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),a});return this.signingKey.sign(Kf.hash(i.domain,n,i.value)).serialized}};Tf=new WeakMap;let x0=Lk;const b0=" !#$%&'()*+,-./<=>?@[]^_`{|}~",Nie=/^[a-z]*$/i;function R3(t,e){let r=97;return t.reduce((n,s)=>(s===e?r++:s.match(Nie)?n.push(String.fromCharCode(r)+s):(r=97,n.push(s)),n),[])}function Mie(t,e){for(let s=b0.length-1;s>=0;s--)t=t.split(b0[s]).join(e.substring(2*s,2*s+2));const r=[],n=t.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(s,i,o,a)=>{if(o)for(let c=parseInt(o);c>=0;c--)r.push(";");else r.push(i.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return R3(R3(r,";"),":")}function Die(t){return M(t[0]==="0","unsupported auwl data","data",t),Mie(t.substring(1+2*b0.length),t.substring(1,1+2*b0.length))}class Lie{constructor(e){G(this,"locale");me(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}var Pf,Hp,Kc,Gp,C2;class jie extends Lie{constructor(r,n,s){super(r);W(this,Gp);W(this,Pf,void 0);W(this,Hp,void 0);W(this,Kc,void 0);N(this,Pf,n),N(this,Hp,s),N(this,Kc,null)}get _data(){return S(this,Pf)}_decodeWords(){return Die(S(this,Pf))}getWord(r){const n=ee(this,Gp,C2).call(this);return M(r>=0&&r=m1,"invalid EIP-155 v","v",e),(r-m1)/V4)}static getChainIdV(e,r){return ye(e)*V4+BigInt(35+r-27)}static getNormalizedV(e){const r=ye(e);return r===F4||r===$4?27:r===U4||r===z4?28:(M(r>=m1,"invalid v","v",e),r&U4?27:28)}static from(e){function r(l,u){M(l,u,"signature",e)}if(e==null)return new bs(Fl,B4,B4,27);if(typeof e=="string"){const l=fe(e,"signature");if(l.length===64){const u=ne(l.slice(0,32)),f=l.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new bs(Fl,u,ne(f),d)}if(l.length===65){const u=ne(l.slice(0,32)),f=l.slice(32,64);r((f[0]&128)===0,"non-canonical s");const d=bs.getNormalizedV(l[64]);return new bs(Fl,u,ne(f),d)}r(!1,"invalid raw signature length")}if(e instanceof bs)return e.clone();const n=e.r;r(n!=null,"missing r");const s=H4(n),i=function(l,u){if(l!=null)return H4(l);if(u!=null){r(vt(u,32),"invalid yParityAndS");const f=fe(u);return f[0]&=127,ne(f)}r(!1,"missing s")}(e.s,e.yParityAndS);r((fe(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(l,u,f){if(l!=null){const d=ye(l);return{networkV:d>=m1?d:void 0,v:bs.getNormalizedV(d)}}if(u!=null)return r(vt(u,32),"invalid yParityAndS"),{v:fe(u)[0]&128?28:27};if(f!=null){switch(_e(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new bs(Fl,s,i,a);return o&&N(c,Dc,o),r(e.yParity==null||_e(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};Gu=new WeakMap,qu=new WeakMap,Wu=new WeakMap,Dc=new WeakMap;let Us=bs;var Gi;const dc=class dc{constructor(e){W(this,Gi,void 0);M(Ru(e)===32,"invalid private key","privateKey","[REDACTED]"),N(this,Gi,ne(e))}get privateKey(){return S(this,Gi)}get publicKey(){return dc.computePublicKey(S(this,Gi))}get compressedPublicKey(){return dc.computePublicKey(S(this,Gi),!0)}sign(e){M(Ru(e)===32,"invalid digest length","digest",e);const r=jo.sign(br(e),br(S(this,Gi)),{lowS:!0});return Us.from({r:go(r.r,32),s:go(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=dc.computePublicKey(e);return ne(jo.getSharedSecret(br(S(this,Gi)),fe(r),!1))}static computePublicKey(e,r){let n=fe(e,"key");if(n.length===32){const i=jo.getPublicKey(n,!!r);return ne(i)}if(n.length===64){const i=new Uint8Array(65);i[0]=4,i.set(n,1),n=i}const s=jo.ProjectivePoint.fromHex(n);return ne(s.toRawBytes(r))}static recoverPublicKey(e,r){M(Ru(e)===32,"invalid digest length","digest",e);const n=Us.from(r);let s=jo.Signature.fromCompact(br(ot([n.r,n.s])));s=s.addRecoveryBit(n.yParity);const i=s.recoverPublicKey(br(e));return M(i!=null,"invalid signautre for digest","signature",r),"0x"+i.toHex(!1)}static addPoints(e,r,n){const s=jo.ProjectivePoint.fromHex(dc.computePublicKey(e).substring(2)),i=jo.ProjectivePoint.fromHex(dc.computePublicKey(r).substring(2));return"0x"+s.add(i).toHex(!!n)}};Gi=new WeakMap;let gi=dc;const Kre=BigInt(0),Qre=BigInt(36);function G4(t){t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=e[s].charCodeAt(0);const n=fe(Ct(r));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(n[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const IC={};for(let t=0;t<10;t++)IC[String(t)]=String(t);for(let t=0;t<26;t++)IC[String.fromCharCode(65+t)]=String(10+t);const q4=15;function Yre(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>IC[n]).join("");for(;e.length>=q4;){let n=e.substring(0,q4);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}const Jre=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function Xre(t){t=t.toLowerCase();let e=Kre;for(let r=0;re.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return S(this,Lc)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return S(this,Lc)===!0?-1:S(this,Lc)===!1?this.value.length:null}static from(e,r){return new Li(Di,e,r)}static uint8(e){return he(e,8)}static uint16(e){return he(e,16)}static uint24(e){return he(e,24)}static uint32(e){return he(e,32)}static uint40(e){return he(e,40)}static uint48(e){return he(e,48)}static uint56(e){return he(e,56)}static uint64(e){return he(e,64)}static uint72(e){return he(e,72)}static uint80(e){return he(e,80)}static uint88(e){return he(e,88)}static uint96(e){return he(e,96)}static uint104(e){return he(e,104)}static uint112(e){return he(e,112)}static uint120(e){return he(e,120)}static uint128(e){return he(e,128)}static uint136(e){return he(e,136)}static uint144(e){return he(e,144)}static uint152(e){return he(e,152)}static uint160(e){return he(e,160)}static uint168(e){return he(e,168)}static uint176(e){return he(e,176)}static uint184(e){return he(e,184)}static uint192(e){return he(e,192)}static uint200(e){return he(e,200)}static uint208(e){return he(e,208)}static uint216(e){return he(e,216)}static uint224(e){return he(e,224)}static uint232(e){return he(e,232)}static uint240(e){return he(e,240)}static uint248(e){return he(e,248)}static uint256(e){return he(e,256)}static uint(e){return he(e,256)}static int8(e){return he(e,-8)}static int16(e){return he(e,-16)}static int24(e){return he(e,-24)}static int32(e){return he(e,-32)}static int40(e){return he(e,-40)}static int48(e){return he(e,-48)}static int56(e){return he(e,-56)}static int64(e){return he(e,-64)}static int72(e){return he(e,-72)}static int80(e){return he(e,-80)}static int88(e){return he(e,-88)}static int96(e){return he(e,-96)}static int104(e){return he(e,-104)}static int112(e){return he(e,-112)}static int120(e){return he(e,-120)}static int128(e){return he(e,-128)}static int136(e){return he(e,-136)}static int144(e){return he(e,-144)}static int152(e){return he(e,-152)}static int160(e){return he(e,-160)}static int168(e){return he(e,-168)}static int176(e){return he(e,-176)}static int184(e){return he(e,-184)}static int192(e){return he(e,-192)}static int200(e){return he(e,-200)}static int208(e){return he(e,-208)}static int216(e){return he(e,-216)}static int224(e){return he(e,-224)}static int232(e){return he(e,-232)}static int240(e){return he(e,-240)}static int248(e){return he(e,-248)}static int256(e){return he(e,-256)}static int(e){return he(e,-256)}static bytes1(e){return Je(e,1)}static bytes2(e){return Je(e,2)}static bytes3(e){return Je(e,3)}static bytes4(e){return Je(e,4)}static bytes5(e){return Je(e,5)}static bytes6(e){return Je(e,6)}static bytes7(e){return Je(e,7)}static bytes8(e){return Je(e,8)}static bytes9(e){return Je(e,9)}static bytes10(e){return Je(e,10)}static bytes11(e){return Je(e,11)}static bytes12(e){return Je(e,12)}static bytes13(e){return Je(e,13)}static bytes14(e){return Je(e,14)}static bytes15(e){return Je(e,15)}static bytes16(e){return Je(e,16)}static bytes17(e){return Je(e,17)}static bytes18(e){return Je(e,18)}static bytes19(e){return Je(e,19)}static bytes20(e){return Je(e,20)}static bytes21(e){return Je(e,21)}static bytes22(e){return Je(e,22)}static bytes23(e){return Je(e,23)}static bytes24(e){return Je(e,24)}static bytes25(e){return Je(e,25)}static bytes26(e){return Je(e,26)}static bytes27(e){return Je(e,27)}static bytes28(e){return Je(e,28)}static bytes29(e){return Je(e,29)}static bytes30(e){return Je(e,30)}static bytes31(e){return Je(e,31)}static bytes32(e){return Je(e,32)}static address(e){return new Li(Di,"address",e)}static bool(e){return new Li(Di,"bool",!!e)}static bytes(e){return new Li(Di,"bytes",e)}static string(e){return new Li(Di,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new Li(Di,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===W4}static dereference(e,r){if(Li.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};Lc=new WeakMap;let zr=Li;class tne extends Co{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=zr.dereference(r,"string");try{n=Xe(n)}catch(s){return this._throwError(s.message,r)}return e.writeValue(n)}decode(e){return Xe(go(e.readValue(),20))}}class rne extends Co{constructor(r){super(r.name,r.type,"_",r.dynamic);G(this,"coder");this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function bM(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(l=>{const u=l.localName;return J(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),J(!c[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),c[u]=!0,r[u]})}else M(!1,"invalid tuple value","tuple",r);M(e.length===n.length,"types/value length mismatch","tuple",r);let s=new Ww,i=new Ww,o=[];e.forEach((c,l)=>{let u=n[l];if(c.dynamic){let f=i.length;c.encode(i,u);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else c.encode(s,u)}),o.forEach(c=>{c(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function wM(t,e){let r=[],n=[],s=t.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=t.readIndex(),c=s.subReader(a);try{o=i.decode(c)}catch(l){if(Vr(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(t)}catch(a){if(Vr(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");r.push(o),n.push(i.localName||null)}),Uf.fromItems(r,n)}class nne extends Co{constructor(r,n,s){const i=r.type+"["+(n>=0?n:"")+"]",o=n===-1||r.dynamic;super("array",i,s,o);G(this,"coder");G(this,"length");me(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let s=0;so||s<-(o+une))&&this._throwError("value out-of-bounds",n),s=u7(s,8*rn)}else(sbc(i,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(s)}decode(r){let n=bc(r.readValue(),this.size*8);return this.signed&&(n=c0(n,this.size*8)),n}}class hne extends EM{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,Sr(zr.dereference(r,"string")))}decode(e){return u0(super.decode(e))}}class g1 extends Co{constructor(r,n){let s=!1;const i=[];r.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,n,s);G(this,"coders");me(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];this.coders.forEach(s=>{r.push(s.defaultValue())});const n=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||n[o]!==1||(o==="length"&&(o="_length"),r[o]==null&&(r[o]=r[i]))}),Object.freeze(r)}encode(r,n){const s=zr.dereference(n,"tuple");return bM(r,this.coders,s)}decode(r){return wM(r,this.coders)}}function Cr(t){return Ct(Sr(t))}var pne="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const K4=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),Q4=4;function yne(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),s=1,i=[0,1];for(let A=1;A>--c&1}const f=31,d=2**f,h=d>>>1,p=h>>1,y=d-1;let g=0;for(let A=0;A1;){let V=O+_>>>1;A>>1|u(),C=C<<1^h,j=(j^h)<<1|h|1;x=C,b=1+j-C}let w=n-4;return m.map(A=>{switch(A-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return A-1}})}function vne(t){let e=0;return()=>t[e++]}function SM(t){return vne(yne(mne(t)))}function mne(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let r=t.length,n=new Uint8Array(6*r>>3);for(let s=0,i=0,o=0,a=0;s=8&&(n[i++]=a>>(o-=8));return n}function gne(t){return t&1?~t>>1:t>>1}function xne(t,e){let r=Array(t);for(let n=0,s=0;n{let e=ep(t);if(e.length)return e})}function AM(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(bne(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(wne(r,t))}return e.flat()}function tp(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function kM(t,e,r){let n=Array(t).fill().map(()=>[]);for(let s=0;sn[o].push(i));return n}function bne(t,e){let r=1+e(),n=e(),s=tp(e);return kM(s.length,1+t,e).flatMap((o,a)=>{let[c,...l]=o;return Array(s[a]).fill().map((u,f)=>{let d=f*n;return[c+f*r,l.map(h=>h+d)]})})}function wne(t,e){let r=1+e();return kM(r,1+t,e).map(s=>[s[0],s.slice(1)])}function Ene(t){let e=[],r=ep(t);return s(n([]),[]),e;function n(i){let o=t(),a=tp(()=>{let c=ep(t).map(l=>r[l]);if(c.length)return n(c)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,c){if(!(i&4&&c===a[a.length-1])){i&2&&(c=a[a.length-1]),i&1&&e.push(a);for(let l of o)for(let u of l.Q)s(l,[...a,u],c)}}}function Sne(t){return t.toString(16).toUpperCase().padStart(2,"0")}function TM(t){return`{${Sne(t)}}`}function Cne(t){let e=[];for(let r=0,n=t.length;r>24&255}function IM(t){return t&16777215}let t2,Y4,r2,tv;function _ne(){let t=SM(kne);t2=new Map(CM(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),Y4=new Set(ep(t)),r2=new Map,tv=new Map;for(let[e,r]of AM(t)){if(!Y4.has(e)&&r.length==2){let[n,s]=r,i=tv.get(n);i||(i=new Map,tv.set(n,i)),i.set(s,e)}r2.set(e,r.reverse())}}function OM(t){return t>=rp&&t=d0&&t=h0&&ep0&&e0&&s(p0+l)}else{let o=r2.get(i);o?r.push(...o):s(i)}if(!r.length)break;i=r.pop()}if(n&&e.length>1){let i=Xd(e[0]);for(let o=1;o0&&s>=o)o==0?(e.push(n,...r),r.length=0,n=a):r.push(a),s=o;else{let c=Nne(n,a);c>=0?n=c:s==0&&o==0?(e.push(n),n=a):(r.push(a),s=o)}}return n>=0&&e.push(n,...r),e}function NM(t){return _M(t).map(IM)}function Dne(t){return Mne(_M(t))}const J4=45,MM=".",DM=65039,LM=1,v0=t=>Array.from(t);function np(t,e){return t.P.has(e)||t.Q.has(e)}class Lne extends Array{get is_emoji(){return!0}}let n2,jM,Ec,s2,BM,_u,Cx,ql,oc,X4,i2;function OC(){if(n2)return;let t=SM(pne);const e=()=>ep(t),r=()=>new Set(e()),n=(u,f)=>f.forEach(d=>u.add(d));n2=new Map(AM(t)),jM=r(),Ec=e(),s2=new Set(e().map(u=>Ec[u])),Ec=new Set(Ec),BM=r(),r();let s=CM(t),i=t();const o=()=>{let u=new Set;return e().forEach(f=>n(u,s[f])),n(u,e()),u};_u=tp(u=>{let f=tp(t).map(d=>d+96);if(f.length){let d=u>=i;f[0]-=32,f=qf(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),y=!t();return{N:f,P:h,Q:p,M:y,R:d}}}),Cx=r(),ql=new Map;let a=e().concat(v0(Cx)).sort((u,f)=>u-f);a.forEach((u,f)=>{let d=t(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(u),Cx.has(u)||ql.set(u,h)});for(let{V:u,M:f}of new Set(ql.values())){let d=[];for(let p of u){let y=_u.filter(m=>np(m,p)),g=d.find(({G:m})=>y.some(x=>m.has(x)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),n(g.G,y)}let h=d.flatMap(p=>v0(p.G));for(let{G:p,V:y}of d){let g=new Set(h.filter(m=>!p.has(m)));for(let m of y)f.set(m,g)}}oc=new Set;let c=new Set;const l=u=>oc.has(u)?c.add(u):oc.add(u);for(let u of _u){for(let f of u.P)l(f);for(let f of u.Q)l(f)}for(let u of oc)!ql.has(u)&&!c.has(u)&&ql.set(u,LM);n(oc,NM(oc)),X4=Ene(t).map(u=>Lne.from(u)).sort(Ane),i2=new Map;for(let u of X4){let f=[i2];for(let d of u){let h=f.map(p=>{let y=p.get(d);return y||(y=new Map,p.set(d,y)),y});d===DM?f.push(...h):f=h}for(let d of f)d.V=u}}function _C(t){return(FM(t)?"":`${NC(Km([t]))} `)+TM(t)}function NC(t){return`"${t}"‎`}function jne(t){if(t.length>=4&&t[2]==J4&&t[3]==J4)throw new Error(`invalid label extension: "${qf(t.slice(0,4))}"`)}function Bne(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function Fne(t){let e=t[0],r=K4.get(e);if(r)throw xh(`leading ${r}`);let n=t.length,s=-1;for(let i=1;ie&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,i=t.length;for(let o=0;o{let i=Cne(s),o={input:i,offset:n};n+=i.length+1;try{let a=o.tokens=Wne(i,e,r),c=a.length,l;if(!c)throw new Error("empty label");let u=o.output=a.flat();if(Bne(u),!(o.emoji=c>1||a[0].is_emoji)&&u.every(d=>d<128))jne(u),l="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)l="Emoji";else{if(Ec.has(u[0]))throw xh("leading combining mark");for(let y=1;yo.has(a)):v0(o),!r.length)return}else n.push(s)}if(r){for(let s of r)if(n.every(i=>np(s,i)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function Hne(t){let e=_u;for(let r of t){let n=e.filter(s=>np(s,r));if(!n.length)throw _u.some(s=>np(s,r))?VM(e[0],r):UM(r);if(e=n,n.length==1)break}return e}function Gne(t){return t.map(({input:e,error:r,output:n})=>{if(r){let s=r.message;throw new Error(t.length==1?s:`Invalid label ${NC(Km(e,63))}: ${s}`)}return qf(n)}).join(MM)}function UM(t){return new Error(`disallowed character: ${_C(t)}`)}function VM(t,e){let r=_C(e),n=_u.find(s=>s.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function xh(t){return new Error(`illegal placement: ${t}`)}function qne(t,e){for(let r of e)if(!np(t,r))throw VM(t,r);if(t.M){let r=NM(e);for(let n=1,s=r.length;nQ4)throw new Error(`excessive non-spacing marks: ${NC(Km(r.slice(n-1,i)))} (${i-n}/${Q4})`);n=i}}}function Wne(t,e,r){let n=[],s=[];for(t=t.slice().reverse();t.length;){let i=Qne(t);if(i)s.length&&(n.push(e(s)),s=[]),n.push(r(i));else{let o=t.pop();if(oc.has(o))s.push(o);else{let a=n2.get(o);if(a)s.push(...a);else if(!jM.has(o))throw UM(o)}}}return s.length&&n.push(e(s)),n}function Kne(t){return t.filter(e=>e!=DM)}function Qne(t,e){let r=i2,n,s=t.length;for(;s&&(r=r.get(t[--s]),!!r);){let{V:i}=r;i&&(n=i,e&&e.push(...t.slice(s).reverse()),t.length=s)}return n}const $M=new Uint8Array(32);$M.fill(0);function Z4(t){return M(t.length!==0,"invalid ENS name; empty component","comp",t),t}function zM(t){const e=Sr(Yne(t)),r=[];if(t.length===0)return r;let n=0;for(let s=0;s{M(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const s=new Uint8Array(n.length+1);return s.set(n,1),s[0]=s.length-1,s})))+"00"}function Ax(t,e){return{address:Xe(t),storageKeys:e.map((r,n)=>(M(vt(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function Pl(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(M(r.length===2,"invalid slot set",`value[${n}]`,r),Ax(r[0],r[1])):(M(r!=null&&typeof r=="object","invalid address-slot set","value",t),Ax(r.address,r.storageKeys)));M(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((s,i)=>(s[i]=!0,s),{});return Ax(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function gy(t){let e;return typeof t=="string"?e=gi.computePublicKey(t,!1):e=t.publicKey,Xe(Ct("0x"+e.substring(4)).substring(26))}function Xne(t,e){return gy(gi.recoverPublicKey(t,e))}const lr=BigInt(0),Zne=BigInt(2),ese=BigInt(27),tse=BigInt(28),rse=BigInt(35),nse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),kx=4096*32;function e3(t,e){let r=t.toString(16);for(;r.length<2;)r="0"+r;return r+=ys(e).substring(4),"0x"+r}function Qm(t){return t==="0x"?null:Xe(t)}function MC(t,e){try{return Pl(t)}catch(r){M(!1,r.message,e,t)}}function xy(t,e){return t==="0x"?0:_e(t,e)}function Qt(t,e){if(t==="0x")return lr;const r=ye(t,e);return M(r<=nse,"value exceeds uint size",e,r),r}function bt(t,e){const r=ye(t,"value"),n=$r(r);return M(n.length<=32,"value too large",`tx.${e}`,r),n}function DC(t){return Pl(t).map(e=>[e.address,e.storageKeys])}function sse(t,e){M(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;rs.data),r.map(s=>s.commitment),r.map(s=>s.proof)])]):ot(["0x03",yl(n)])}var Zs,Ku,Qu,Yu,Ju,Xu,Zu,ef,tf,rf,nf,sf,jc,Ko,qi,Qo,of,rv;const ji=class ji{constructor(){W(this,of);W(this,Zs,void 0);W(this,Ku,void 0);W(this,Qu,void 0);W(this,Yu,void 0);W(this,Ju,void 0);W(this,Xu,void 0);W(this,Zu,void 0);W(this,ef,void 0);W(this,tf,void 0);W(this,rf,void 0);W(this,nf,void 0);W(this,sf,void 0);W(this,jc,void 0);W(this,Ko,void 0);W(this,qi,void 0);W(this,Qo,void 0);N(this,Zs,null),N(this,Ku,null),N(this,Yu,0),N(this,Ju,lr),N(this,Xu,null),N(this,Zu,null),N(this,ef,null),N(this,Qu,"0x"),N(this,tf,lr),N(this,rf,lr),N(this,nf,null),N(this,sf,null),N(this,jc,null),N(this,Ko,null),N(this,Qo,null),N(this,qi,null)}get type(){return S(this,Zs)}set type(e){switch(e){case null:N(this,Zs,null);break;case 0:case"legacy":N(this,Zs,0);break;case 1:case"berlin":case"eip-2930":N(this,Zs,1);break;case 2:case"london":case"eip-1559":N(this,Zs,2);break;case 3:case"cancun":case"eip-4844":N(this,Zs,3);break;default:M(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=S(this,Ku);return e==null&&this.type===3?vl:e}set to(e){N(this,Ku,e==null?null:Xe(e))}get nonce(){return S(this,Yu)}set nonce(e){N(this,Yu,_e(e,"value"))}get gasLimit(){return S(this,Ju)}set gasLimit(e){N(this,Ju,ye(e))}get gasPrice(){const e=S(this,Xu);return e==null&&(this.type===0||this.type===1)?lr:e}set gasPrice(e){N(this,Xu,e==null?null:ye(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=S(this,Zu);return e??(this.type===2||this.type===3?lr:null)}set maxPriorityFeePerGas(e){N(this,Zu,e==null?null:ye(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=S(this,ef);return e??(this.type===2||this.type===3?lr:null)}set maxFeePerGas(e){N(this,ef,e==null?null:ye(e,"maxFeePerGas"))}get data(){return S(this,Qu)}set data(e){N(this,Qu,ne(e))}get value(){return S(this,tf)}set value(e){N(this,tf,ye(e,"value"))}get chainId(){return S(this,rf)}set chainId(e){N(this,rf,ye(e))}get signature(){return S(this,nf)||null}set signature(e){N(this,nf,e==null?null:Us.from(e))}get accessList(){const e=S(this,sf)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){N(this,sf,e==null?null:Pl(e))}get maxFeePerBlobGas(){const e=S(this,jc);return e==null&&this.type===3?lr:e}set maxFeePerBlobGas(e){N(this,jc,e==null?null:ye(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=S(this,Ko);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){M(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let r=0;rObject.assign({},e))}set blobs(e){if(e==null){N(this,Qo,null);return}const r=[],n=[];for(let s=0;s=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,s=S(this,jc)!=null||S(this,Ko);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&J(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),J(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),J(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):r?i.push(2):e?(i.push(1),n||i.push(0)):n?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return ji.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new ji;if(typeof e=="string"){const n=fe(e);if(n[0]>=127)return ji.from(ise(n));switch(n[0]){case 1:return ji.from(lse(n));case 2:return ji.from(ase(n));case 3:return ji.from(fse(n))}J(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new ji;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=Us.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(r.kzg=e.kzg),e.blobs!=null&&(r.blobs=e.blobs),e.hash!=null&&(M(r.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),M(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(M(r.isSigned(),"unsigned transaction cannot define '.from'","tx",e),M(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};Zs=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Yu=new WeakMap,Ju=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,ef=new WeakMap,tf=new WeakMap,rf=new WeakMap,nf=new WeakMap,sf=new WeakMap,jc=new WeakMap,Ko=new WeakMap,qi=new WeakMap,Qo=new WeakMap,of=new WeakSet,rv=function(e,r){J(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return ose(this,n);case 1:return use(this,n);case 2:return cse(this,n);case 3:return dse(this,n,r?this.blobs:null)}J(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let sp=ji;function hse(t){return typeof t=="string"&&(t=Sr(t)),Ct(ot([Sr(Wre),Sr(String(t.length)),t]))}const HM=new Uint8Array(32);HM.fill(0);const pse=BigInt(-1),GM=BigInt(0),qM=BigInt(1),yse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function vse(t){const e=fe(t),r=e.length%32;return r?ot([e,HM.slice(r)]):ne(e)}const mse=go(qM,32),gse=go(GM,32),t3={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Tx=["name","version","chainId","verifyingContract","salt"];function r3(t){return function(e){return M(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const xse={name:r3("name"),version:r3("version"),chainId:function(t){const e=ye(t,"domain.chainId");return M(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):yu(e)},verifyingContract:function(t){try{return Xe(t).toLowerCase()}catch{}M(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=fe(t,"domain.salt");return M(e.length===32,'invalid domain value "salt"',"domain.salt",t),ne(e)}};function Px(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);M(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const s=bc(yse,r?n-1:n),i=r?(s+qM)*pse:GM;return function(o){const a=ye(o,"value");return M(a>=i&&a<=s,`value out-of-bounds for ${t}`,"value",a),go(r?u7(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return M(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const s=fe(n);return M(s.length===r,`invalid length for ${t}`,"value",n),vse(n)}}}switch(t){case"address":return function(e){return pl(Xe(e),32)};case"bool":return function(e){return e?mse:gse};case"bytes":return function(e){return Ct(e)};case"string":return function(e){return Cr(e)}}return null}function n3(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function x1(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var Ip,Wi,af,j0,WM;const Xn=class Xn{constructor(e){W(this,j0);G(this,"primaryType");W(this,Ip,void 0);W(this,Wi,void 0);W(this,af,void 0);N(this,Wi,new Map),N(this,af,new Map);const r=new Map,n=new Map,s=new Map,i={};Object.keys(e).forEach(c=>{i[c]=e[c].map(({name:l,type:u})=>{let{base:f,index:d}=x1(u);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:l,type:f+(d||"")}}),r.set(c,new Set),n.set(c,[]),s.set(c,new Set)}),N(this,Ip,JSON.stringify(i));for(const c in i){const l=new Set;for(const u of i[c]){M(!l.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(c)}`,"types",e),l.add(u.name);const f=x1(u.type).base;M(f!==c,`circular type reference to ${JSON.stringify(f)}`,"types",e),!Px(f)&&(M(n.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),n.get(f).push(c),r.get(c).add(f))}}const o=Array.from(n.keys()).filter(c=>n.get(c).length===0);M(o.length!==0,"missing primary type","types",e),M(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),me(this,{primaryType:o[0]});function a(c,l){M(!l.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),l.add(c);for(const u of r.get(c))if(n.has(u)){a(u,l);for(const f of l)s.get(f).add(u)}l.delete(c)}a(this.primaryType,new Set);for(const[c,l]of s){const u=Array.from(l);u.sort(),S(this,Wi).set(c,n3(c,i[c])+u.map(f=>n3(f,i[f])).join(""))}}get types(){return JSON.parse(S(this,Ip))}getEncoder(e){let r=S(this,af).get(e);return r||(r=ee(this,j0,WM).call(this,e),S(this,af).set(e,r)),r}encodeType(e){const r=S(this,Wi).get(e);return M(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return Ct(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if(Px(e))return n(e,r);const s=x1(e).array;if(s)return M(s.count===-1||s.count===r.length,`array length mismatch; expected length ${s.count}`,"value",r),r.map(o=>this._visit(s.prefix,o,n));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:c})=>(o[a]=this._visit(c,r[a],n),o),{});M(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new Xn(e)}static getPrimaryType(e){return Xn.from(e).primaryType}static hashStruct(e,r,n){return Xn.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const s=t3[n];M(s,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:s})}return r.sort((n,s)=>Tx.indexOf(n.name)-Tx.indexOf(s.name)),Xn.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return ot(["0x1901",Xn.hashDomain(e),Xn.from(r).hash(n)])}static hash(e,r,n){return Ct(Xn.encode(e,r,n))}static async resolveNames(e,r,n,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!vt(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=Xn.from(r);o.visit(n,(a,c)=>(a==="address"&&!vt(c,20)&&(i[c]="0x"),c));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=o.visit(n,(a,c)=>a==="address"&&i[c]?i[c]:c),{domain:e,value:n}}static getPayload(e,r,n){Xn.hashDomain(e);const s={},i=[];Tx.forEach(c=>{const l=e[c];l!=null&&(s[c]=xse[c](l),i.push({name:c,type:t3[c]}))});const o=Xn.from(r);r=o.types;const a=Object.assign({},r);return M(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),a.EIP712Domain=i,o.encode(n),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(n,(c,l)=>{if(c.match(/^bytes(\d*)/))return ne(fe(l));if(c.match(/^u?int/))return ye(l).toString();switch(c){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return M(typeof l=="string","invalid string","value",l),l}M(!1,"unsupported type","type",c)})}}};Ip=new WeakMap,Wi=new WeakMap,af=new WeakMap,j0=new WeakSet,WM=function(e){{const s=Px(e);if(s)return s}const r=x1(e).array;if(r){const s=r.prefix,i=this.getEncoder(s);return o=>{M(r.count===-1||r.count===o.length,`array length mismatch; expected length ${r.count}`,"value",o);let a=o.map(i);return S(this,Wi).has(s)&&(a=a.map(Ct)),Ct(ot(a))}}const n=this.types[e];if(n){const s=Cr(S(this,Wi).get(e));return i=>{const o=n.map(({name:a,type:c})=>{const l=this.getEncoder(c)(i[a]);return S(this,Wi).has(c)?Ct(l):l});return o.unshift(s),ot(o)}}M(!1,`unknown type: ${e}`,"type",e)};let Kf=Xn;function nn(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const bse="external public payable override",wse=nn(bse.split(" ")),KM="constant external internal payable private public pure view override",Ese=nn(KM.split(" ")),QM="constructor error event fallback function receive struct",YM=nn(QM.split(" ")),JM="calldata memory storage payable indexed",Sse=nn(JM.split(" ")),Cse="tuple returns",Ase=[QM,JM,Cse,KM].join(" "),kse=nn(Ase.split(" ")),Tse={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Pse=new RegExp("^(\\s*)"),Rse=new RegExp("^([0-9]+)"),Ise=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),XM=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),ZM=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var vr,Ps,Op,a2;const B0=class B0{constructor(e){W(this,Op);W(this,vr,void 0);W(this,Ps,void 0);N(this,vr,0),N(this,Ps,e.slice())}get offset(){return S(this,vr)}get length(){return S(this,Ps).length-S(this,vr)}clone(){return new B0(S(this,Ps))}reset(){N(this,vr,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=ee(this,Op,a2).call(this,S(this,vr)+1,e.match+1);return N(this,vr,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;S(this,vr)=S(this,Ps).length)throw new Error("out-of-bounds");return S(this,Ps)[S(this,vr)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return Ed(this,vr)._++,e}toString(){const e=[];for(let r=S(this,vr);r`}};vr=new WeakMap,Ps=new WeakMap,Op=new WeakSet,a2=function(e=0,r=0){return new B0(S(this,Ps).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Vs=B0;function Ha(t){const e=[],r=o=>{const a=i0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;u=f+u,e[e.length-1].value=_e(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=u}continue}if(a=o.match(Ise),a){if(c.text=a[1],i+=c.text.length,kse.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(ZM)){c.type="TYPE";continue}c.type="ID";continue}if(a=o.match(Rse),a){c.text=a[1],c.type="NUMBER",i+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new Vs(e.map(o=>Object.freeze(o)))}function s3(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function Ym(t,e){if(e.peekKeyword(YM)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function bo(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function eD(t){let e=bo(t,Ese);return s3(e,nn("constant payable nonpayable".split(" "))),s3(e,nn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function lo(t,e){return t.popParams().map(r=>Ar.from(r,e))}function tD(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return ye(t.pop().text);throw new Error("invalid gas")}return null}function ml(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const Ose=new RegExp(/^(.*)\[([0-9]*)\]$/);function i3(t){const e=t.match(ZM);if(M(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);M(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);M(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const Pt={},bn=Symbol.for("_ethers_internal"),o3="_ParamTypeInternal",a3="_ErrorInternal",c3="_EventInternal",l3="_ConstructorInternal",u3="_FallbackInternal",f3="_FunctionInternal",d3="_StructInternal";var cf,nv;const Zn=class Zn{constructor(e,r,n,s,i,o,a,c){W(this,cf);G(this,"name");G(this,"type");G(this,"baseType");G(this,"indexed");G(this,"components");G(this,"arrayLength");G(this,"arrayChildren");if($a(e,Pt,"ParamType"),Object.defineProperty(this,bn,{value:o3}),o&&(o=Object.freeze(o.slice())),s==="array"){if(a==null||c==null)throw new Error("")}else if(a!=null||c!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");me(this,{name:r,type:n,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=n,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(s=>n.arrayChildren.walk(s,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((s,i)=>n.components[i].walk(s,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],s=[e];return ee(this,cf,nv).call(this,n,e,r,i=>{s[0]=i}),n.length&&await Promise.all(n),s[0]}static from(e,r){if(Zn.isParamType(e))return e;if(typeof e=="string")try{return Zn.from(Ha(e),r)}catch{M(!1,"invalid param type","obj",e)}else if(e instanceof Vs){let a="",c="",l=null;bo(e,nn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",l=e.popParams().map(y=>Zn.from(y)),a=`tuple(${l.map(y=>y.format()).join(",")})`):(a=i3(e.popType("TYPE")),c=a);let u=null,f=null;for(;e.length&&e.peekType("BRACKET");){const y=e.pop();u=new Zn(Pt,"",a,c,null,l,f,u),f=y.value,a+=y.text,c="array",l=null}let d=null;if(bo(e,Sse).has("indexed")){if(!r)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Zn(Pt,p,a,c,d,l,f,u)}const n=e.name;M(!n||typeof n=="string"&&n.match(XM),"invalid name","obj.name",n);let s=e.indexed;s!=null&&(M(r,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(Ose);if(o){const a=parseInt(o[2]||"-1"),c=Zn.from({type:o[1],components:e.components});return new Zn(Pt,n||"",i,"array",s,null,a,c)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(l=>Zn.from(l)):null;return new Zn(Pt,n||"",i,"tuple",s,a,null,null)}return i=i3(e.type),new Zn(Pt,n||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[bn]===o3}};cf=new WeakSet,nv=function(e,r,n,s){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=r.slice();a.forEach((c,l)=>{var u;ee(u=o,cf,nv).call(u,e,c,n,f=>{a[l]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(r))a=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");a=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((c,l)=>{var u;ee(u=o[l],cf,nv).call(u,e,c,n,f=>{a[l]=f})}),s(a);return}const i=n(this.type,r);i.then?e.push(async function(){s(await i)}()):s(i)};let Ar=Zn;class gl{constructor(e,r,n){G(this,"type");G(this,"inputs");$a(e,Pt,"Fragment"),n=Object.freeze(n.slice()),me(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{gl.from(JSON.parse(e))}catch{}return gl.from(Ha(e))}if(e instanceof Vs)switch(e.peekKeyword(YM)){case"constructor":return so.from(e);case"error":return pn.from(e);case"event":return li.from(e);case"fallback":case"receive":return Fi.from(e);case"function":return ui.from(e);case"struct":return rl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return so.from(e);case"error":return pn.from(e);case"event":return li.from(e);case"fallback":case"receive":return Fi.from(e);case"function":return ui.from(e);case"struct":return rl.from(e)}J(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}M(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return so.isFragment(e)}static isError(e){return pn.isFragment(e)}static isEvent(e){return li.isFragment(e)}static isFunction(e){return ui.isFragment(e)}static isStruct(e){return rl.isFragment(e)}}class Jm extends gl{constructor(r,n,s,i){super(r,n,i);G(this,"name");M(typeof s=="string"&&s.match(XM),"invalid identifier","name",s),i=Object.freeze(i.slice()),me(this,{name:s})}}function ip(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class pn extends Jm{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,bn,{value:a3})}get selector(){return Cr(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+ip(e,this.inputs)),r.join(" ")}static from(e){if(pn.isFragment(e))return e;if(typeof e=="string")return pn.from(Ha(e));if(e instanceof Vs){const r=Ym("error",e),n=lo(e);return ml(e),new pn(Pt,r,n)}return new pn(Pt,e.name,e.inputs?e.inputs.map(Ar.from):[])}static isFragment(e){return e&&e[bn]===a3}}class li extends Jm{constructor(r,n,s,i){super(r,"event",n,s);G(this,"anonymous");Object.defineProperty(this,bn,{value:c3}),me(this,{anonymous:i})}get topicHash(){return Cr(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+ip(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(i=>Ar.from(i)),new li(Pt,r,n,!1).topicHash}static from(r){if(li.isFragment(r))return r;if(typeof r=="string")try{return li.from(Ha(r))}catch{M(!1,"invalid event fragment","obj",r)}else if(r instanceof Vs){const n=Ym("event",r),s=lo(r,!0),i=!!bo(r,nn(["anonymous"])).has("anonymous");return ml(r),new li(Pt,n,s,i)}return new li(Pt,r.name,r.inputs?r.inputs.map(n=>Ar.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[bn]===c3}}class so extends gl{constructor(r,n,s,i,o){super(r,n,s);G(this,"payable");G(this,"gas");Object.defineProperty(this,bn,{value:l3}),me(this,{payable:i,gas:o})}format(r){if(J(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r)))});const n=[`constructor${ip(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(so.isFragment(r))return r;if(typeof r=="string")try{return so.from(Ha(r))}catch{M(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Vs){bo(r,nn(["constructor"]));const n=lo(r),s=!!bo(r,wse).has("payable"),i=tD(r);return ml(r),new so(Pt,"constructor",n,s,i)}return new so(Pt,"constructor",r.inputs?r.inputs.map(Ar.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[bn]===l3}}class Fi extends gl{constructor(r,n,s){super(r,"fallback",n);G(this,"payable");Object.defineProperty(this,bn,{value:u3}),me(this,{payable:s})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:s})}return`${n}()${this.payable?" payable":""}`}static from(r){if(Fi.isFragment(r))return r;if(typeof r=="string")try{return Fi.from(Ha(r))}catch{M(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Vs){const n=r.toString(),s=r.peekKeyword(nn(["fallback","receive"]));if(M(s,"type must be fallback or receive","obj",n),r.popKeyword(nn(["fallback","receive"]))==="receive"){const c=lo(r);return M(c.length===0,"receive cannot have arguments","obj.inputs",c),bo(r,nn(["payable"])),ml(r),new Fi(Pt,[],!0)}let o=lo(r);o.length?M(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[Ar.from("bytes")];const a=eD(r);if(M(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),bo(r,nn(["returns"])).has("returns")){const c=lo(r);M(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(l=>l.format("minimal")).join(", "))}return ml(r),new Fi(Pt,o,a==="payable")}if(r.type==="receive")return new Fi(Pt,[],!0);if(r.type==="fallback"){const n=[Ar.from("bytes")],s=r.stateMutability==="payable";return new Fi(Pt,n,s)}M(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[bn]===u3}}class ui extends Jm{constructor(r,n,s,i,o,a){super(r,"function",n,i);G(this,"constant");G(this,"outputs");G(this,"stateMutability");G(this,"payable");G(this,"gas");Object.defineProperty(this,bn,{value:f3}),o=Object.freeze(o.slice()),me(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return Cr(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(r))),outputs:this.outputs.map(s=>JSON.parse(s.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+ip(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(ip(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(i=>Ar.from(i)),new ui(Pt,r,"view",n,[],null).selector}static from(r){if(ui.isFragment(r))return r;if(typeof r=="string")try{return ui.from(Ha(r))}catch{M(!1,"invalid function fragment","obj",r)}else if(r instanceof Vs){const s=Ym("function",r),i=lo(r),o=eD(r);let a=[];bo(r,nn(["returns"])).has("returns")&&(a=lo(r));const c=tD(r);return ml(r),new ui(Pt,s,o,i,a,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new ui(Pt,r.name,n,r.inputs?r.inputs.map(Ar.from):[],r.outputs?r.outputs.map(Ar.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[bn]===f3}}class rl extends Jm{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,bn,{value:d3})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return rl.from(Ha(e))}catch{M(!1,"invalid struct fragment","obj",e)}else if(e instanceof Vs){const r=Ym("struct",e),n=lo(e);return ml(e),new rl(Pt,r,n)}return new rl(Pt,e.name,e.inputs?e.inputs.map(Ar.from):[])}static isFragment(e){return e&&e[bn]===d3}}const zs=new Map;zs.set(0,"GENERIC_PANIC");zs.set(1,"ASSERT_FALSE");zs.set(17,"OVERFLOW");zs.set(18,"DIVIDE_BY_ZERO");zs.set(33,"ENUM_RANGE_ERROR");zs.set(34,"BAD_STORAGE_DATA");zs.set(49,"STACK_UNDERFLOW");zs.set(50,"ARRAY_RANGE_ERROR");zs.set(65,"OUT_OF_MEMORY");zs.set(81,"UNINITIALIZED_FUNCTION_CALL");const _se=new RegExp(/^bytes([0-9]*)$/),Nse=new RegExp(/^(u?int)([0-9]*)$/);let Rx=null,h3=1024;function Mse(t,e,r,n){let s="missing revert data",i=null;const o=null;let a=null;if(r){s="execution reverted";const l=fe(r);if(r=ne(r),l.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(l.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(ne(l.slice(0,4))==="0x08c379a0")try{i=n.decode(["string"],l.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(ne(l.slice(0,4))==="0x4e487b71")try{const u=Number(n.decode(["uint256"],l.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[u]},i=`Panic due to ${zs.get(u)||"UNKNOWN"}(${u})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?Xe(e.to):null,data:e.data||"0x"};return e.from&&(c.from=Xe(e.from)),Lt(s,"CALL_EXCEPTION",{action:t,data:r,reason:i,transaction:c,invocation:o,revert:a})}var Yo,Wl;const F0=class F0{constructor(){W(this,Yo)}getDefaultValue(e){const r=e.map(s=>ee(this,Yo,Wl).call(this,Ar.from(s)));return new g1(r,"_").defaultValue()}encode(e,r){o7(r.length,e.length,"types/values length mismatch");const n=e.map(o=>ee(this,Yo,Wl).call(this,Ar.from(o))),s=new g1(n,"_"),i=new Ww;return s.encode(i,r),i.data}decode(e,r,n){const s=e.map(o=>ee(this,Yo,Wl).call(this,Ar.from(o)));return new g1(s,"_").decode(new Kw(r,n,h3))}static _setDefaultMaxInflation(e){M(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),h3=e}static defaultAbiCoder(){return Rx==null&&(Rx=new F0),Rx}static getBuiltinCallException(e,r,n){return Mse(e,r,n,F0.defaultAbiCoder())}};Yo=new WeakSet,Wl=function(e){if(e.isArray())return new nne(ee(this,Yo,Wl).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new g1(e.components.map(n=>ee(this,Yo,Wl).call(this,n)),e.name);switch(e.baseType){case"address":return new tne(e.name);case"bool":return new sne(e.name);case"string":return new hne(e.name);case"bytes":return new ine(e.name);case"":return new cne(e.name)}let r=e.type.match(Nse);if(r){let n=parseInt(r[2]||"256");return M(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new dne(n/8,r[1]==="int",e.name)}if(r=e.type.match(_se),r){let n=parseInt(r[1]);return M(n!==0&&n<=32,"invalid bytes length","param",e),new one(n,e.name)}M(!1,"invalid type","type",e.type)};let op=F0;class Dse{constructor(e,r,n){G(this,"fragment");G(this,"name");G(this,"signature");G(this,"topic");G(this,"args");const s=e.name,i=e.format();me(this,{fragment:e,name:s,signature:i,topic:r,args:n})}}class Lse{constructor(e,r,n,s){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");G(this,"value");const i=e.name,o=e.format();me(this,{fragment:e,name:i,args:n,signature:o,selector:r,value:s})}}class jse{constructor(e,r,n){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");const s=e.name,i=e.format();me(this,{fragment:e,name:s,args:n,signature:i,selector:r})}}class p3{constructor(e){G(this,"hash");G(this,"_isIndexed");me(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const y3={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},v3={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&y3[t.toString()]&&(e=y3[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var ei,ti,ri,Dr,lf,sv,uf,iv;const hc=class hc{constructor(e){W(this,lf);W(this,uf);G(this,"fragments");G(this,"deploy");G(this,"fallback");G(this,"receive");W(this,ei,void 0);W(this,ti,void 0);W(this,ri,void 0);W(this,Dr,void 0);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,N(this,ri,new Map),N(this,ei,new Map),N(this,ti,new Map);const n=[];for(const o of r)try{n.push(gl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}me(this,{fragments:Object.freeze(n)});let s=null,i=!1;N(this,Dr,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}me(this,{deploy:o});return;case"fallback":o.inputs.length===0?i=!0:(M(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${a}]`,o),s=o,i=s.payable);return;case"function":c=S(this,ri);break;case"event":c=S(this,ti);break;case"error":c=S(this,ei);break;default:return}const l=o.format();c.has(l)||c.set(l,o)}),this.deploy||me(this,{deploy:so.from("constructor()")}),me(this,{fallback:s,receive:i})}format(e){const r=e?"minimal":"full";return this.fragments.map(s=>s.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return op.defaultAbiCoder()}getFunctionName(e){const r=ee(this,lf,sv).call(this,e,null,!1);return M(r,"no matching function","key",e),r.name}hasFunction(e){return!!ee(this,lf,sv).call(this,e,null,!1)}getFunction(e,r){return ee(this,lf,sv).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from(S(this,ri).keys());r.sort((n,s)=>n.localeCompare(s));for(let n=0;nn.localeCompare(s));for(let n=0;n1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");M(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=pn.from(e).format(),e==="Error(string)")return pn.from("error Error(string)");if(e==="Panic(uint256)")return pn.from("error Panic(uint256)");const n=S(this,ei).get(e);return n||null}forEachError(e){const r=Array.from(S(this,ei).keys());r.sort((n,s)=>n.localeCompare(s));for(let n=0;ni.type==="string"?Cr(o):i.type==="bytes"?Ct(ne(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=go(o):i.type.match(/^bytes/)?o=Fee(o,32):i.type==="address"&&S(this,Dr).encode(["address"],[o]),pl(ne(o),32));for(r.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){M(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?M(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?n.push(i.map(c=>s(a,c))):n.push(s(a,i))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const o=this.getEvent(e);M(o,"unknown event","eventFragment",e),e=o}const n=[],s=[],i=[];return e.anonymous||n.push(e.topicHash),M(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const c=r[a];if(o.indexed)if(o.type==="string")n.push(Cr(c));else if(o.type==="bytes")n.push(Ct(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(S(this,Dr).encode([o.type],[c]))}else s.push(o),i.push(c)}),{data:S(this,Dr).encode(s,i),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const h=this.getEvent(e);M(h,"unknown event","eventFragment",e),e=h}if(n!=null&&!e.anonymous){const h=e.topicHash;M(vt(n[0],32)&&n[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(Ar.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=n!=null?S(this,Dr).decode(s,ot(n)):null,c=S(this,Dr).decode(i,r,!0),l=[],u=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let y=null;if(h.indexed)if(a==null)y=new p3(null);else if(o[p])y=new p3(a[d++]);else try{y=a[d++]}catch(g){y=g}else try{y=c[f++]}catch(g){y=g}l.push(y),u.push(h.name||null)}),Uf.fromItems(l,u)}parseTransaction(e){const r=fe(e.data,"tx.data"),n=ye(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(ne(r.slice(0,4)));if(!s)return null;const i=S(this,Dr).decode(s.inputs,r.slice(4));return new Lse(s,s.selector,i,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new Dse(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=ne(e),n=this.getError(xt(r,0,4));if(!n)return null;const s=S(this,Dr).decode(n.inputs,xt(r,4));return new jse(n,n.selector,s)}static from(e){return e instanceof hc?e:typeof e=="string"?new hc(JSON.parse(e)):typeof e.formatJson=="function"?new hc(e.formatJson()):typeof e.format=="function"?new hc(e.format("json")):new hc(e)}};ei=new WeakMap,ti=new WeakMap,ri=new WeakMap,Dr=new WeakMap,lf=new WeakSet,sv=function(e,r,n){if(vt(e)){const i=e.toLowerCase();for(const o of S(this,ri).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of S(this,ri))o.split("(")[0]===e&&i.push(a);if(r){const o=r.length>0?r[r.length-1]:null;let a=r.length,c=!0;zr.isTyped(o)&&o.type==="overrides"&&(c=!1,a--);for(let l=i.length-1;l>=0;l--){const u=i[l].inputs.length;u!==a&&(!c||u!==a-1)&&i.splice(l,1)}for(let l=i.length-1;l>=0;l--){const u=i[l].inputs;for(let f=0;f=u.length){if(r[f].type==="overrides")continue;i.splice(l,1);break}if(r[f].type!==u[f].baseType){i.splice(l,1);break}}}}if(i.length===1&&r&&r.length!==i[0].inputs.length){const o=r[r.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&n){const o=i.map(a=>JSON.stringify(a.format())).join(", ");M(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=S(this,ri).get(ui.from(e).format());return s||null},uf=new WeakSet,iv=function(e,r,n){if(vt(e)){const i=e.toLowerCase();for(const o of S(this,ti).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of S(this,ti))o.split("(")[0]===e&&i.push(a);if(r){for(let o=i.length-1;o>=0;o--)i[o].inputs.length=0;o--){const a=i[o].inputs;for(let c=0;c1&&n){const o=i.map(a=>JSON.stringify(a.format())).join(", ");M(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=S(this,ti).get(li.from(e).format());return s||null};let c2=hc;const rD=BigInt(0);function Nu(t){return t??null}function Gt(t){return t==null?null:t.toString()}class m3{constructor(e,r,n){G(this,"gasPrice");G(this,"maxFeePerGas");G(this,"maxPriorityFeePerGas");me(this,{gasPrice:Nu(e),maxFeePerGas:Nu(r),maxPriorityFeePerGas:Nu(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:Gt(e),maxFeePerGas:Gt(r),maxPriorityFeePerGas:Gt(n)}}}function ap(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=ne(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=ye(t[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=_e(t[s],`request.${s}`));return t.accessList&&(e.accessList=Pl(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>Um(s)?ne(s):Object.assign({},s))),e}var Ki;class Bse{constructor(e,r){G(this,"provider");G(this,"number");G(this,"hash");G(this,"timestamp");G(this,"parentHash");G(this,"parentBeaconBlockRoot");G(this,"nonce");G(this,"difficulty");G(this,"gasLimit");G(this,"gasUsed");G(this,"stateRoot");G(this,"receiptsRoot");G(this,"blobGasUsed");G(this,"excessBlobGas");G(this,"miner");G(this,"prevRandao");G(this,"extraData");G(this,"baseFeePerGas");W(this,Ki,void 0);N(this,Ki,e.transactions.map(n=>typeof n!="string"?new cp(n,r):n)),me(this,{provider:r,hash:Nu(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Nu(e.prevRandao),extraData:e.extraData,baseFeePerGas:Nu(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return S(this,Ki).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=S(this,Ki).slice();return e.length===0?[]:(J(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:c,nonce:l,number:u,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:y,transactions:g}=this;return{_type:"Block",baseFeePerGas:Gt(e),difficulty:Gt(r),extraData:n,gasLimit:Gt(s),gasUsed:Gt(i),blobGasUsed:Gt(this.blobGasUsed),excessBlobGas:Gt(this.excessBlobGas),hash:o,miner:a,prevRandao:c,nonce:l,number:u,parentHash:f,timestamp:y,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>enew by(s,r))));let n=rD;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),me(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return S(this,_p)}toJSON(){const{to:e,from:r,contractAddress:n,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:c,logs:l,status:u,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:n,cumulativeGasUsed:Gt(this.cumulativeGasUsed),from:r,gasPrice:Gt(this.gasPrice),blobGasUsed:Gt(this.blobGasUsed),blobGasPrice:Gt(this.blobGasPrice),gasUsed:Gt(this.gasUsed),hash:s,index:i,logs:l,logsBloom:c,root:f,status:u,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(a)return null;const{blockNumber:d,nonce:h}=await Fr({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h{if(d==null||d.status!==0)return d;J(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},u=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(u);if(u){if(await u.confirmations()>=n)return l(u)}else if(await c(),n===0)return null;return await new Promise((d,h)=>{const p=[],y=()=>{p.forEach(m=>m())};if(p.push(()=>{a=!0}),s>0){const m=setTimeout(()=>{y(),h(Lt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(m)})}const g=async m=>{if(await m.confirmations()>=n){y();try{d(l(m))}catch(x){h(x)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const m=async()=>{try{await c()}catch(x){if(Vr(x,"TRANSACTION_REPLACED")){y(),h(x);return}}a||this.provider.once("block",m)};p.push(()=>{this.provider.off("block",m)}),this.provider.once("block",m)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return J(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),iD(this)}reorderedEvent(e){return J(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),J(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),sD(this,e)}replaceableTransaction(e){M(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new Mk(this,this.provider);return N(r,Jo,e),r}};Jo=new WeakMap;let cp=Mk;function Fse(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function sD(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function iD(t){return{orphan:"drop-transaction",tx:t}}function Use(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class jC extends by{constructor(r,n,s){super(r,r.provider);G(this,"interface");G(this,"fragment");G(this,"args");const i=n.decodeEventLog(s,r.data,r.topics);me(this,{args:i,fragment:s,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class oD extends by{constructor(r,n){super(r,r.provider);G(this,"error");me(this,{error:n})}}var ff;class Vse extends nD{constructor(r,n,s){super(s,n);W(this,ff,void 0);N(this,ff,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?S(this,ff).getEvent(r.topics[0]):null;if(n)try{return new jC(r,S(this,ff),n)}catch(s){return new oD(r,s)}return r})}}ff=new WeakMap;var Np;class BC extends cp{constructor(r,n,s){super(s,n);W(this,Np,void 0);N(this,Np,r)}async wait(r,n){const s=await super.wait(r,n);return s==null?null:new Vse(S(this,Np),this.provider,s)}}Np=new WeakMap;class aD extends d7{constructor(r,n,s,i){super(r,n,s);G(this,"log");me(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class $se extends aD{constructor(e,r,n,s,i){super(e,r,n,new jC(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);me(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const g3=BigInt(0);function cD(t){return t&&typeof t.call=="function"}function lD(t){return t&&typeof t.estimateGas=="function"}function Xm(t){return t&&typeof t.resolveName=="function"}function uD(t){return t&&typeof t.sendTransaction=="function"}function fD(t){if(t!=null){if(Xm(t))return t;if(t.provider)return t.provider}}var Mp;class zse{constructor(e,r,n){W(this,Mp,void 0);G(this,"fragment");if(me(this,{fragment:r}),r.inputs.lengthn[c]==null?null:a.walkAsync(n[c],(u,f)=>u==="address"?Array.isArray(f)?Promise.all(f.map(d=>wr(d,i))):wr(f,i):f)));return e.interface.encodeFilterTopics(r,o)}())}getTopicFilter(){return S(this,Mp)}}Mp=new WeakMap;function xl(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Sc(t){return t==null?null:t.provider||null}async function dD(t,e){const r=zr.dereference(t,"overrides");M(typeof r=="object","invalid overrides parameter","overrides",t);const n=ap(r);return M(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),M(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function Hse(t,e,r){const n=xl(t,"resolveName"),s=Xm(n)?n:null;return await Promise.all(e.map((i,o)=>i.walkAsync(r[o],(a,c)=>(c=zr.dereference(c,a),a==="address"?wr(c,s):c))))}function Gse(t){const e=async function(o){const a=await dD(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await wr(a.from,fD(t.runner)));const c=t.interface,l=ye(a.value||g3,"overrides.value")===g3,u=(a.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!u&&!l&&M(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),M(c.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data);const f=c.receive||c.fallback&&c.fallback.payable;return M(f||l,"cannot send value to non-payable fallback","overrides.value",a.value),M(c.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data),a},r=async function(o){const a=xl(t.runner,"call");J(cD(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(o);try{return await a.call(c)}catch(l){throw vC(l)&&l.data?t.interface.makeError(l.data,c):l}},n=async function(o){const a=t.runner;J(uD(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await a.sendTransaction(await e(o)),l=Sc(t.runner);return new BC(t.interface,l,c)},s=async function(o){const a=xl(t.runner,"estimateGas");return J(lD(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},i=async o=>await n(o);return me(i,{_contract:t,estimateGas:s,populateTransaction:e,send:n,staticCall:r}),i}function qse(t,e){const r=function(...l){const u=t.interface.getFunction(e,l);return J(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:l}}),u},n=async function(...l){const u=r(...l);let f={};if(u.inputs.length+1===l.length&&(f=await dD(l.pop()),f.from&&(f.from=await wr(f.from,fD(t.runner)))),u.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Hse(t.runner,u.inputs,l);return Object.assign({},f,await Fr({to:t.getAddress(),data:t.interface.encodeFunctionData(u,d)}))},s=async function(...l){const u=await a(...l);return u.length===1?u[0]:u},i=async function(...l){const u=t.runner;J(uD(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await u.sendTransaction(await n(...l)),d=Sc(t.runner);return new BC(t.interface,d,f)},o=async function(...l){const u=xl(t.runner,"estimateGas");return J(lD(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await n(...l))},a=async function(...l){const u=xl(t.runner,"call");J(cD(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await n(...l);let d="0x";try{d=await u.call(f)}catch(p){throw vC(p)&&p.data?t.interface.makeError(p.data,f):p}const h=r(...l);return t.interface.decodeFunctionResult(h,d)},c=async(...l)=>r(...l).constant?await s(...l):await i(...l);return me(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:o,populateTransaction:n,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=t.interface.getFunction(e);return J(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),l}}),c}function Wse(t,e){const r=function(...s){const i=t.interface.getEvent(e,s);return J(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},n=function(...s){return new zse(t,r(...s),s)};return me(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return J(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),n}const m0=Symbol.for("_ethersInternal_contract"),hD=new WeakMap;function Kse(t,e){hD.set(t[m0],e)}function An(t){return hD.get(t[m0])}function Qse(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function FC(t,e){let r,n=null;if(Array.isArray(e)){const i=function(o){if(vt(o,32))return o;const a=t.interface.getEvent(o);return M(a,"unknown fragment","name",o),a.topicHash};r=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?r=[null]:typeof e=="string"?vt(e,32)?r=[e]:(n=t.interface.getEvent(e),M(n,"unknown fragment","event",e),r=[n.topicHash]):Qse(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):M(!1,"unknown event name","event",e);r=r.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=r.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:n,tag:s,topics:r}}async function Zd(t,e){const{subs:r}=An(t);return r.get((await FC(t,e)).tag)||null}async function x3(t,e,r){const n=Sc(t.runner);J(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await FC(t,r),{addr:a,subs:c}=An(t);let l=c.get(i);if(!l){const f={address:a||t,topics:o},d=g=>{let m=s;if(m==null)try{m=t.interface.getEvent(g.topics[0])}catch{}if(m){const x=m,b=s?t.interface.decodeEventLog(s,g.data,g.topics):[];u2(t,r,b,w=>new $se(t,w,r,x,g))}else u2(t,r,[],x=>new aD(t,x,r,g))};let h=[];l={tag:i,listeners:[],start:()=>{h.length||h.push(n.on(f,d))},stop:async()=>{if(h.length==0)return;let g=h;h=[],await Promise.all(g),n.off(f,d)}},c.set(i,l)}return l}let l2=Promise.resolve();async function Yse(t,e,r,n){await l2;const s=await Zd(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const c=Array.from(r);n&&c.push(n(a?null:o));try{o.call(t,...c)}catch{}return!a}),s.listeners.length===0&&(s.stop(),An(t).subs.delete(s.tag)),i>0}async function u2(t,e,r,n){try{await l2}catch{}const s=Yse(t,e,r,n);return l2=s,await s}const b1=["then"];var P1e;const Ch=class Ch{constructor(e,r,n,s){G(this,"target");G(this,"interface");G(this,"runner");G(this,"filters");G(this,P1e);G(this,"fallback");M(typeof e=="string"||xM(e),"invalid value for Contract target","target",e),n==null&&(n=null);const i=c2.from(r);me(this,{target:e,runner:n,interface:i}),Object.defineProperty(this,m0,{value:{}});let o,a=null,c=null;if(s){const f=Sc(n);c=new BC(this.interface,f,s)}let l=new Map;if(typeof e=="string")if(vt(e))a=e,o=Promise.resolve(e);else{const f=xl(n,"resolveName");if(!Xm(f))throw Lt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Lt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return An(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return An(this).addr=f,f});Kse(this,{addrPromise:o,addr:a,deployTx:c,subs:l});const u=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||b1.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!Vr(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>b1.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return me(this,{filters:u}),me(this,{fallback:i.receive||i.fallback?Gse(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||b1.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!Vr(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||b1.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Ch(this.target,this.interface,e)}attach(e){return new Ch(e,this.interface,this.runner)}async getAddress(){return await An(this).addrPromise}async getDeployedCode(){const e=Sc(this.runner);J(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=Sc(this.runner);return J(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);n.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return An(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),qse(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),Wse(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:s,addrPromise:i}=An(this),o=s||await i,{fragment:a,topics:c}=await FC(this,e),l={address:o,topics:c,fromBlock:r,toBlock:n},u=Sc(this.runner);return J(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(l)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new jC(f,this.interface,d)}catch(h){return new oD(f,h)}return new by(f,u)})}async on(e,r){const n=await x3(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await x3(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await u2(this,e,r,null)}async listenerCount(e){if(e){const s=await Zd(this,e);return s?s.listeners.length:0}const{subs:r}=An(this);let n=0;for(const{listeners:s}of r.values())n+=s.length;return n}async listeners(e){if(e){const s=await Zd(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:r}=An(this);let n=[];for(const{listeners:s}of r.values())n=n.concat(s.map(({listener:i})=>i));return n}async off(e,r){const n=await Zd(this,e);if(!n)return this;if(r){const s=n.listeners.map(({listener:i})=>i).indexOf(r);s>=0&&n.listeners.splice(s,1)}return(r==null||n.listeners.length===0)&&(n.stop(),An(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await Zd(this,e);if(!r)return this;r.stop(),An(this).subs.delete(r.tag)}else{const{subs:r}=An(this);for(const{tag:n,stop:s}of r.values())s(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends Ch{constructor(s,i=null){super(s,e,i)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};P1e=m0;let f2=Ch;function Jse(){return f2}class Mu extends Jse(){}function Ix(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):M(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class Xse{constructor(e){G(this,"name");me(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const pD=new RegExp("^(ipfs)://(.*)$","i"),b3=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),pD,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Xo,Bc,Zo,Kl,U0,yD;const gu=class gu{constructor(e,r,n){W(this,Zo);G(this,"provider");G(this,"address");G(this,"name");W(this,Xo,void 0);W(this,Bc,void 0);me(this,{provider:e,address:r,name:n}),N(this,Xo,null),N(this,Bc,new Mu(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return S(this,Xo)==null&&N(this,Xo,(async()=>{try{return await S(this,Bc).supportsInterface("0x9061b923")}catch(e){if(Vr(e,"CALL_EXCEPTION"))return!1;throw N(this,Xo,null),e}})()),await S(this,Xo)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await ee(this,Zo,Kl).call(this,"addr(bytes32)");return i==null||i===vl?null:i}catch(i){if(Vr(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await ee(this,Zo,Kl).call(this,"addr(bytes32,uint)",[i]);if(vt(o,20))return Xe(o)}let r=null;for(const i of this.provider.plugins)if(i instanceof Xse&&i.supportsCoinType(e)){r=i;break}if(r==null)return null;const n=await ee(this,Zo,Kl).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const s=await r.decodeAddress(e,n);if(s!=null)return s;J(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await ee(this,Zo,Kl).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await ee(this,Zo,Kl).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const s=r[1]==="e3010170"?"ipfs":"ipns",i=parseInt(r[4],16);if(r[5].length===i*2)return`${s}://${f7("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;J(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))}}function wy(t,e){return r=>{const n={};for(const s in t){let i=s;if(e&&s in e&&!(i in r)){for(const o of e[s])if(o in r){i=o;break}}try{const o=t[s](r[i]);o!==void 0&&(n[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";J(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:r})}}return n}}function Zse(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}M(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Qf(t){return M(vt(t,!0),"invalid data","value",t),t}function xr(t){return M(vt(t,32),"invalid hash","value",t),t}const eie=wy({address:Xe,blockHash:xr,blockNumber:_e,data:Qf,index:_e,removed:Ge(Zse,!1),topics:Zm(xr),transactionHash:xr,transactionIndex:_e},{index:["logIndex"]});function tie(t){return eie(t)}const rie=wy({hash:Ge(xr),parentHash:xr,parentBeaconBlockRoot:Ge(xr,null),number:_e,timestamp:_e,nonce:Ge(Qf),difficulty:ye,gasLimit:ye,gasUsed:ye,stateRoot:Ge(xr,null),receiptsRoot:Ge(xr,null),blobGasUsed:Ge(ye,null),excessBlobGas:Ge(ye,null),miner:Ge(Xe),prevRandao:Ge(xr,null),extraData:Qf,baseFeePerGas:Ge(ye)},{prevRandao:["mixHash"]});function nie(t){const e=rie(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:vD(r)),e}const sie=wy({transactionIndex:_e,blockNumber:_e,transactionHash:xr,address:Xe,topics:Zm(xr),data:Qf,index:_e,blockHash:xr},{index:["logIndex"]});function iie(t){return sie(t)}const oie=wy({to:Ge(Xe,null),from:Ge(Xe,null),contractAddress:Ge(Xe,null),index:_e,root:Ge(ne),gasUsed:ye,blobGasUsed:Ge(ye,null),logsBloom:Ge(Qf),blockHash:xr,hash:xr,logs:Zm(iie),blockNumber:_e,cumulativeGasUsed:ye,effectiveGasPrice:Ge(ye),blobGasPrice:Ge(ye,null),status:Ge(_e),type:Ge(_e,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function aie(t){return oie(t)}function vD(t){t.to&&ye(t.to)===w3&&(t.to="0x0000000000000000000000000000000000000000");const e=wy({hash:xr,index:Ge(_e,void 0),type:r=>r==="0x"||r==null?0:_e(r),accessList:Ge(Pl,null),blobVersionedHashes:Ge(Zm(xr,!0),null),blockHash:Ge(xr,null),blockNumber:Ge(_e,null),transactionIndex:Ge(_e,null),from:Xe,gasPrice:Ge(ye),maxPriorityFeePerGas:Ge(ye),maxFeePerGas:Ge(ye),maxFeePerBlobGas:Ge(ye,null),gasLimit:ye,to:Ge(Xe,null),value:ye,nonce:_e,data:Qf,creates:Ge(Xe,null),chainId:Ge(ye,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=Zre(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Us.from(t.signature):e.signature=Us.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&ye(e.blockHash)===w3&&(e.blockHash=null),e}const cie="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Ey{constructor(e){G(this,"name");me(this,{name:e})}clone(){return new Ey(this.name)}}class eg extends Ey{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);G(this,"effectiveBlock");G(this,"txBase");G(this,"txCreate");G(this,"txDataZero");G(this,"txDataNonzero");G(this,"txAccessListStorageKey");G(this,"txAccessListAddress");const s={effectiveBlock:r};function i(o,a){let c=(n||{})[o];c==null&&(c=a),M(typeof c=="number",`invalud value for ${o}`,"costs",n),s[o]=c}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),me(this,s)}clone(){return new eg(this.effectiveBlock,this)}}class tg extends Ey{constructor(r,n){super("org.ethers.plugins.network.Ens");G(this,"address");G(this,"targetNetwork");me(this,{address:r||cie,targetNetwork:n??1})}clone(){return new tg(this.address,this.targetNetwork)}}var Dp,Lp;class lie extends Ey{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");W(this,Dp,void 0);W(this,Lp,void 0);N(this,Dp,r),N(this,Lp,n)}get url(){return S(this,Dp)}get processFunc(){return S(this,Lp)}clone(){return this}}Dp=new WeakMap,Lp=new WeakMap;const Ox=new Map;var df,hf,ea;const xu=class xu{constructor(e,r){W(this,df,void 0);W(this,hf,void 0);W(this,ea,void 0);N(this,df,e),N(this,hf,ye(r)),N(this,ea,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return S(this,df)}set name(e){N(this,df,e)}get chainId(){return S(this,hf)}set chainId(e){N(this,hf,ye(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===ye(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===ye(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===ye(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(S(this,ea).values())}attachPlugin(e){if(S(this,ea).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return S(this,ea).set(e.name,e.clone()),this}getPlugin(e){return S(this,ea).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new xu(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new eg;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let s=2;s9){let s=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||s++,n[1]=s.toString()}return BigInt(n[0]+n[1])}function S3(t){return new lie(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([n.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:E3(a.maxFee,9),maxPriorityFeePerGas:E3(a.maxPriorityFee,9)}}catch(i){J(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:s,error:i})}})}let C3=!1;function uie(){if(C3)return;C3=!0;function t(e,r,n){const s=function(){const i=new pi(e,r);return n.ensNetwork!=null&&i.attachPlugin(new tg(null,n.ensNetwork)),i.attachPlugin(new eg),(n.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};pi.register(e,s),pi.register(r,s),n.altNames&&n.altNames.forEach(i=>{pi.register(i,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[S3("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[S3("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function d2(t){return JSON.parse(JSON.stringify(t))}var Qi,es,ta,ni,pf,ov;class fie{constructor(e){W(this,pf);W(this,Qi,void 0);W(this,es,void 0);W(this,ta,void 0);W(this,ni,void 0);N(this,Qi,e),N(this,es,null),N(this,ta,4e3),N(this,ni,-2)}get pollingInterval(){return S(this,ta)}set pollingInterval(e){N(this,ta,e)}start(){S(this,es)||(N(this,es,S(this,Qi)._setTimeout(ee(this,pf,ov).bind(this),S(this,ta))),ee(this,pf,ov).call(this))}stop(){S(this,es)&&(S(this,Qi)._clearTimeout(S(this,es)),N(this,es,null))}pause(e){this.stop(),e&&N(this,ni,-2)}resume(){this.start()}}Qi=new WeakMap,es=new WeakMap,ta=new WeakMap,ni=new WeakMap,pf=new WeakSet,ov=async function(){try{const e=await S(this,Qi).getBlockNumber();if(S(this,ni)===-2){N(this,ni,e);return}if(e!==S(this,ni)){for(let r=S(this,ni)+1;r<=e;r++){if(S(this,es)==null)return;await S(this,Qi).emit("block",r)}N(this,ni,e)}}catch{}S(this,es)!=null&&N(this,es,S(this,Qi)._setTimeout(ee(this,pf,ov).bind(this),S(this,ta)))};var Fc,Uc,ra;class UC{constructor(e){W(this,Fc,void 0);W(this,Uc,void 0);W(this,ra,void 0);N(this,Fc,e),N(this,ra,!1),N(this,Uc,r=>{this._poll(r,S(this,Fc))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){S(this,ra)||(N(this,ra,!0),S(this,Uc).call(this,-2),S(this,Fc).on("block",S(this,Uc)))}stop(){S(this,ra)&&(N(this,ra,!1),S(this,Fc).off("block",S(this,Uc)))}pause(e){this.stop()}resume(){this.start()}}Fc=new WeakMap,Uc=new WeakMap,ra=new WeakMap;var yf,Yi;class die extends UC{constructor(r,n){super(r);W(this,yf,void 0);W(this,Yi,void 0);N(this,yf,n),N(this,Yi,-2)}pause(r){r&&N(this,Yi,-2),super.pause(r)}async _poll(r,n){const s=await n.getBlock(S(this,yf));s!=null&&(S(this,Yi)===-2?N(this,Yi,s.number):s.number>S(this,Yi)&&(n.emit(S(this,yf),s.number),N(this,Yi,s.number)))}}yf=new WeakMap,Yi=new WeakMap;var V0;class hie extends UC{constructor(r,n){super(r);W(this,V0,void 0);N(this,V0,d2(n))}async _poll(r,n){throw new Error("@TODO")}}V0=new WeakMap;var vf;class pie extends UC{constructor(r,n){super(r);W(this,vf,void 0);N(this,vf,n)}async _poll(r,n){const s=await n.getTransactionReceipt(S(this,vf));s&&n.emit(S(this,vf),s)}}vf=new WeakMap;var Ji,mf,gf,na,ts,$0,mD;class VC{constructor(e,r){W(this,$0);W(this,Ji,void 0);W(this,mf,void 0);W(this,gf,void 0);W(this,na,void 0);W(this,ts,void 0);N(this,Ji,e),N(this,mf,d2(r)),N(this,gf,ee(this,$0,mD).bind(this)),N(this,na,!1),N(this,ts,-2)}start(){S(this,na)||(N(this,na,!0),S(this,ts)===-2&&S(this,Ji).getBlockNumber().then(e=>{N(this,ts,e)}),S(this,Ji).on("block",S(this,gf)))}stop(){S(this,na)&&(N(this,na,!1),S(this,Ji).off("block",S(this,gf)))}pause(e){this.stop(),e&&N(this,ts,-2)}resume(){this.start()}}Ji=new WeakMap,mf=new WeakMap,gf=new WeakMap,na=new WeakMap,ts=new WeakMap,$0=new WeakSet,mD=async function(e){if(S(this,ts)===-2)return;const r=d2(S(this,mf));r.fromBlock=S(this,ts)+1,r.toBlock=e;const n=await S(this,Ji).getLogs(r);if(n.length===0){S(this,ts){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const s=Object.keys(n);return s.sort(),s.reduce((i,o)=>(i[o]=n[o],i),{})}return n})}class gD{constructor(e){G(this,"name");me(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function mie(t){return JSON.parse(JSON.stringify(t))}function h2(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function _x(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(vt(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:av("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:av("orphan",r),filter:mie(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(s=>s==null?null:Array.isArray(s)?h2(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(r.address){const s=[],i=[],o=a=>{vt(a)?s.push(a):i.push((async()=>{s.push(await wr(a,e))})())};Array.isArray(r.address)?r.address.forEach(o):o(r.address),i.length&&await Promise.all(i),n.address=h2(s.map(a=>a.toLowerCase()))}return{filter:n,tag:av("event",n),type:"event"}}M(!1,"unknown ProviderEvent","event",t)}function Nx(){return new Date().getTime()}const gie={cacheTimeout:250,pollingInterval:4e3};var Lr,sa,jr,xf,Rn,Vc,ia,Xi,jp,rs,bf,wf,Jr,Cn,Bp,p2,Fp,y2,$c,eh,Up,v2,zc,th,Ef,cv;class xie{constructor(e,r){W(this,Jr);W(this,Bp);W(this,Fp);W(this,$c);W(this,Up);W(this,zc);W(this,Ef);W(this,Lr,void 0);W(this,sa,void 0);W(this,jr,void 0);W(this,xf,void 0);W(this,Rn,void 0);W(this,Vc,void 0);W(this,ia,void 0);W(this,Xi,void 0);W(this,jp,void 0);W(this,rs,void 0);W(this,bf,void 0);W(this,wf,void 0);if(N(this,wf,Object.assign({},gie,r||{})),e==="any")N(this,Vc,!0),N(this,Rn,null);else if(e){const n=pi.from(e);N(this,Vc,!1),N(this,Rn,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else N(this,Vc,!1),N(this,Rn,null);N(this,Xi,-1),N(this,ia,new Map),N(this,Lr,new Map),N(this,sa,new Map),N(this,jr,null),N(this,xf,!1),N(this,jp,1),N(this,rs,new Map),N(this,bf,!1)}get pollingInterval(){return S(this,wf).pollingInterval}get provider(){return this}get plugins(){return Array.from(S(this,sa).values())}attachPlugin(e){if(S(this,sa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return S(this,sa).set(e.name,e.connect(this)),this}getPlugin(e){return S(this,sa).get(e)||null}get disableCcipRead(){return S(this,bf)}set disableCcipRead(e){N(this,bf,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=r.toLowerCase(),o=[];for(let a=0;a=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:f}}),o.push(f)}J(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:o}})}_wrapBlock(e,r){return new Bse(nie(e),this)}_wrapLog(e,r){return new by(tie(e),this)}_wrapTransactionReceipt(e,r){return new nD(aie(e),this)}_wrapTransactionResponse(e,r){return new cp(vD(e),this)}_detectNetwork(){J(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){J(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=_e(await ee(this,Jr,Cn).call(this,{method:"getBlockNumber"}),"%response");return S(this,Xi)>=0&&N(this,Xi,e),e}_getAddress(e){return wr(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(vt(e))return vt(e,32)?e:yu(e);if(typeof e=="bigint"&&(e=_e(e,"blockTag")),typeof e=="number")return e>=0?yu(e):S(this,Xi)>=0?yu(S(this,Xi)+e):this.getBlockNumber().then(r=>yu(r+e));M(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?h2(c.map(l=>l.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,s=(c,l,u)=>{let f;switch(c.length){case 0:break;case 1:f=c[0];break;default:c.sort(),f=c}if(n&&(l!=null||u!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),r.length&&(d.topics=r),l&&(d.fromBlock=l),u&&(d.toBlock=u),n&&(d.blockHash=n),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)i.push(this._getAddress(c));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(c=>typeof c!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(c=>s(c[0],c[1],c[2])):s(i,o,a)}_getTransactionRequest(e){const r=ap(e),n=[];if(["to","from"].forEach(s=>{if(r[s]==null)return;const i=wr(r[s],this);w1(i)?n.push(async function(){r[s]=await i}()):r[s]=i}),r.blockTag!=null){const s=this._getBlockTag(r.blockTag);w1(s)?n.push(async function(){r.blockTag=await s}()):r.blockTag=s}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if(S(this,Rn)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw S(this,Rn)===s&&N(this,Rn,null),i}})();return N(this,Rn,s),(await s).clone()}const e=S(this,Rn),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(S(this,Vc)?(this.emit("network",n,r),S(this,Rn)===e&&N(this,Rn,Promise.resolve(n))):J(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await Fr({_block:ee(this,Up,v2).call(this,"latest",!1),gasPrice:(async()=>{try{const u=await ee(this,Jr,Cn).call(this,{method:"getGasPrice"});return ye(u,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const u=await ee(this,Jr,Cn).call(this,{method:"getPriorityFee"});return ye(u,"%response")}catch{}return null})()});let a=null,c=null;const l=this._wrapBlock(s,e);return l&&l.baseFeePerGas&&(c=o??BigInt("1000000000"),a=l.baseFeePerGas*yie+c),new m3(i,a,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const s=new xo(n.url),i=await n.processFunc(r,this,s);return new m3(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return w1(r)&&(r=await r),ye(await ee(this,Jr,Cn).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await Fr({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await ee(this,Fp,y2).call(this,ee(this,Bp,p2).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return ye(await ee(this,$c,eh).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return _e(await ee(this,$c,eh).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return ne(await ee(this,$c,eh).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const s=ye(r,"position");return ne(await ee(this,$c,eh).call(this,{method:"getStorage",position:s},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:s}=await Fr({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=sp.from(e);if(i.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:s}=await Fr({network:this.getNetwork(),params:ee(this,Up,v2).call(this,e,!!r)});return s==null?null:this._wrapBlock(s,n)}async getTransaction(e){const{network:r,params:n}=await Fr({network:this.getNetwork(),params:ee(this,Jr,Cn).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await Fr({network:this.getNetwork(),params:ee(this,Jr,Cn).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const s=await ee(this,Jr,Cn).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await Fr({network:this.getNetwork(),result:ee(this,Jr,Cn).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:ne(r)}async getLogs(e){let r=this._getFilter(e);w1(r)&&(r=await r);const{network:n,params:s}=await Fr({network:this.getNetwork(),params:ee(this,Jr,Cn).call(this,{method:"getLogs",filter:r})});return s.map(i=>this._wrapLog(i,n))}_getProvider(e){J(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await g0.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=Xe(e);const r=o2(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await g0.getEnsAddress(this),i=await new Mu(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(i==null||i===vl)return null;const a=await new Mu(i,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(a)!==e?null:a}catch(n){if(Vr(n,"BAD_DATA")&&n.value==="0x"||Vr(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const s=r??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const c=async l=>{try{const u=await this.getTransactionReceipt(e);if(u!=null&&l-u.blockNumber+1>=s){i(u),a&&(clearTimeout(a),a=null);return}}catch(u){console.log("EEE",u)}this.once("block",c)};n!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",c),o(Lt("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){J(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=S(this,rs).get(e);r&&(r.timer&&clearTimeout(r.timer),S(this,rs).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=Ed(this,jp)._++,s=()=>{S(this,rs).delete(n),e()};if(this.paused)S(this,rs).set(n,{timer:null,func:s,time:r});else{const i=setTimeout(s,r);S(this,rs).set(n,{timer:i,func:s,time:Nx()})}return n}_forEachSubscriber(e){for(const r of S(this,Lr).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new gD(e.type);case"block":{const r=new fie(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new die(this,e.type);case"event":return new VC(this,e.filter);case"transaction":return new pie(this,e.hash);case"orphan":return new hie(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of S(this,Lr).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),S(this,jr)!=null&&r.pause(S(this,jr));break}}async on(e,r){const n=await ee(this,Ef,cv).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,S(this,jr)!=null&&n.subscriber.pause(S(this,jr))),this}async once(e,r){const n=await ee(this,Ef,cv).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,S(this,jr)!=null&&n.subscriber.pause(S(this,jr))),this}async emit(e,...r){const n=await ee(this,zc,th).call(this,e,r);if(!n||n.listeners.length===0)return!1;const s=n.listeners.length;return n.listeners=n.listeners.filter(({listener:i,once:o})=>{const a=new d7(this,o?null:i,e);try{i.call(this,...r,a)}catch{}return!o}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),S(this,Lr).delete(n.tag)),s>0}async listenerCount(e){if(e){const n=await ee(this,zc,th).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of S(this,Lr).values())r+=n.length;return r}async listeners(e){if(e){const n=await ee(this,zc,th).call(this,e);return n?n.listeners.map(({listener:s})=>s):[]}let r=[];for(const{listeners:n}of S(this,Lr).values())r=r.concat(n.map(({listener:s})=>s));return r}async off(e,r){const n=await ee(this,zc,th).call(this,e);if(!n)return this;if(r){const s=n.listeners.map(({listener:i})=>i).indexOf(r);s>=0&&n.listeners.splice(s,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),S(this,Lr).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:s}=await ee(this,Ef,cv).call(this,e);n&&s.stop(),S(this,Lr).delete(r)}else for(const[r,{started:n,subscriber:s}]of S(this,Lr))n&&s.stop(),S(this,Lr).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return S(this,xf)}destroy(){this.removeAllListeners();for(const e of S(this,rs).keys())this._clearTimeout(e);N(this,xf,!0)}get paused(){return S(this,jr)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(N(this,Xi,-1),S(this,jr)!=null){if(S(this,jr)==!!e)return;J(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),N(this,jr,!!e);for(const r of S(this,rs).values())r.timer&&clearTimeout(r.timer),r.time=Nx()-r.time}resume(){if(S(this,jr)!=null){this._forEachSubscriber(e=>e.resume()),N(this,jr,null);for(const e of S(this,rs).values()){let r=e.time;r<0&&(r=0),e.time=Nx(),setTimeout(e.func,r)}}}}Lr=new WeakMap,sa=new WeakMap,jr=new WeakMap,xf=new WeakMap,Rn=new WeakMap,Vc=new WeakMap,ia=new WeakMap,Xi=new WeakMap,jp=new WeakMap,rs=new WeakMap,bf=new WeakMap,wf=new WeakMap,Jr=new WeakSet,Cn=async function(e){const r=S(this,wf).cacheTimeout;if(r<0)return await this._perform(e);const n=av(e.method,e);let s=S(this,ia).get(n);return s||(s=this._perform(e),S(this,ia).set(n,s),setTimeout(()=>{S(this,ia).get(n)===s&&S(this,ia).delete(n)},r)),await s},Bp=new WeakSet,p2=async function(e,r,n){J(n=0&&r==="latest"&&s.to!=null&&xt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await wr(s.to,this);let c;try{c=Cie(xt(i.data,4))}catch(f){J(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}J(c.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const l=await this.ccipReadFetch(s,c.calldata,c.urls);J(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:c.errorArgs}});const u={to:a,data:ot([c.selector,Sie([l,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:u});try{const f=await ee(this,Bp,p2).call(this,u,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},u),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},u),error:f}),f}}throw i}},Fp=new WeakSet,y2=async function(e){const{value:r}=await Fr({network:this.getNetwork(),value:e});return r},$c=new WeakSet,eh=async function(e,r,n){let s=this._getAddress(r),i=this._getBlockTag(n);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await ee(this,Fp,y2).call(this,ee(this,Jr,Cn).call(this,Object.assign(e,{address:s,blockTag:i})))},Up=new WeakSet,v2=async function(e,r){if(vt(e,32))return await ee(this,Jr,Cn).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await ee(this,Jr,Cn).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},zc=new WeakSet,th=async function(e,r){let n=await _x(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await _x({orphan:"drop-log",log:r[0]},this)),S(this,Lr).get(n.tag)||null},Ef=new WeakSet,cv=async function(e){const r=await _x(e,this),n=r.tag;let s=S(this,Lr).get(n);return s||(s={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},S(this,Lr).set(n,s)),s};function bie(t,e){try{const r=m2(t,e);if(r)return u0(r)}catch{}return null}function m2(t,e){if(t==="0x")return null;try{const r=_e(xt(t,e,e+32)),n=_e(xt(t,r,r+32));return xt(t,r+32,r+32+n)}catch{}return null}function A3(t){const e=$r(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function wie(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Eie=new Uint8Array([]);function Sie(t){const e=[];let r=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=xt(t,0,32);J(xt(r,0,12)===xt(k3,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=xt(r,12);try{const n=[],s=_e(xt(t,32,64)),i=_e(xt(t,s,s+32)),o=xt(t,s+32);for(let a=0;ae[n]),e}function Ul(t,e){if(t.provider)return t.provider;J(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function T3(t,e){let r=ap(e);if(r.to!=null&&(r.to=wr(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),wr(n,t)]).then(([s,i])=>(M(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else r.from=t.getAddress();return await Fr(r)}class $C{constructor(e){G(this,"provider");me(this,{provider:e||null})}async getNonce(e){return Ul(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await T3(this,e)}async populateTransaction(e){const r=Ul(this,"populateTransaction"),n=await T3(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const s=await this.provider.getNetwork();if(n.chainId!=null){const o=ye(n.chainId);M(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=s.chainId;const i=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||i)?M(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&i&&M(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const o=await r.getFeeData();J(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice)}else{const o=await r.getFeeData();if(n.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const a=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=a,n.maxPriorityFeePerGas=a}else n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(J(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice),n.type=0):J(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await Fr(n)}async estimateGas(e){return Ul(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Ul(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Ul(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=Ul(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const s=sp.from(n);return await r.broadcastTransaction(await this.signTransaction(s))}}var Sf,lv;const Dk=class Dk extends $C{constructor(r,n){super(n);W(this,Sf);G(this,"address");me(this,{address:r})}async getAddress(){return this.address}connect(r){return new Dk(this.address,r)}async signTransaction(r){ee(this,Sf,lv).call(this,"transactions","signTransaction")}async signMessage(r){ee(this,Sf,lv).call(this,"messages","signMessage")}async signTypedData(r,n,s){ee(this,Sf,lv).call(this,"typed-data","signTypedData")}};Sf=new WeakSet,lv=function(r,n){J(!1,`VoidSigner cannot sign ${r}`,"UNSUPPORTED_OPERATION",{operation:n})};let g2=Dk;function Aie(t){return JSON.parse(JSON.stringify(t))}var Xr,si,Hc,oa,Gc,Cf,Vp,x2,$p,b2;class xD{constructor(e){W(this,Vp);W(this,$p);W(this,Xr,void 0);W(this,si,void 0);W(this,Hc,void 0);W(this,oa,void 0);W(this,Gc,void 0);W(this,Cf,void 0);N(this,Xr,e),N(this,si,null),N(this,Hc,ee(this,Vp,x2).bind(this)),N(this,oa,!1),N(this,Gc,null),N(this,Cf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){S(this,oa)||(N(this,oa,!0),ee(this,Vp,x2).call(this,-2))}stop(){S(this,oa)&&(N(this,oa,!1),N(this,Cf,!0),ee(this,$p,b2).call(this),S(this,Xr).off("block",S(this,Hc)))}pause(e){e&&ee(this,$p,b2).call(this),S(this,Xr).off("block",S(this,Hc))}resume(){this.start()}}Xr=new WeakMap,si=new WeakMap,Hc=new WeakMap,oa=new WeakMap,Gc=new WeakMap,Cf=new WeakMap,Vp=new WeakSet,x2=async function(e){try{S(this,si)==null&&N(this,si,this._subscribe(S(this,Xr)));let r=null;try{r=await S(this,si)}catch(i){if(!Vr(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(r==null){N(this,si,null),S(this,Xr)._recoverSubscriber(this,this._recover(S(this,Xr)));return}const n=await S(this,Xr).getNetwork();if(S(this,Gc)||N(this,Gc,n),S(this,Gc).chainId!==n.chainId)throw new Error("chaid changed");if(S(this,Cf))return;const s=await S(this,Xr).send("eth_getFilterChanges",[r]);await this._emitResults(S(this,Xr),s)}catch(r){console.log("@TODO",r)}S(this,Xr).once("block",S(this,Hc))},$p=new WeakSet,b2=function(){const e=S(this,si);e&&(N(this,si,null),e.then(r=>{S(this,Xr).destroyed||S(this,Xr).send("eth_uninstallFilter",[r])}))};var qc;class kie extends xD{constructor(r,n){super(r);W(this,qc,void 0);N(this,qc,Aie(n))}_recover(r){return new VC(r,S(this,qc))}async _subscribe(r){return await r.send("eth_newFilter",[S(this,qc)])}async _emitResults(r,n){for(const s of n)r.emit(S(this,qc),r._wrapLog(s,r._network))}}qc=new WeakMap;class Tie extends xD{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const Pie="bigint,boolean,function,number,string,symbol".split(/,/g);function uv(t){if(t==null||Pie.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(uv);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function Rie(t){return new Promise(e=>{setTimeout(e,t)})}function Vl(t){return t&&t.toLowerCase()}function P3(t){return t&&typeof t.pollingInterval=="number"}const bD={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class Mx extends $C{constructor(r,n){super(r);G(this,"address");n=Xe(n),me(this,{address:n})}connect(r){J(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=uv(r),s=[];if(n.from){const o=n.from;s.push((async()=>{const a=await wr(o,this.provider);M(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=a})())}else n.from=this.address;if(n.gasLimit==null&&s.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const o=n.to;s.push((async()=>{n.to=await wr(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(r);return await new Promise((i,o)=>{const a=[1e3,100];let c=0;const l=async()=>{try{const u=await this.provider.getTransaction(s);if(u!=null){i(u.replaceableTransaction(n));return}}catch(u){if(Vr(u,"CANCELLED")||Vr(u,"BAD_DATA")||Vr(u,"NETWORK_ERROR")){u.info==null&&(u.info={}),u.info.sendTransactionHash=s,o(u);return}if(Vr(u,"INVALID_ARGUMENT")&&(c++,u.info==null&&(u.info={}),u.info.sendTransactionHash=s,c>10)){o(u);return}this.provider.emit("error",Lt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{l()},a.pop()||4e3)};l()})}async signTransaction(r){const n=uv(r);if(n.from){const i=await wr(n.from,this.provider);M(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=i}else n.from=this.address;const s=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[s])}async signMessage(r){const n=typeof r=="string"?Sr(r):r;return await this.provider.send("personal_sign",[ne(n),this.address.toLowerCase()])}async signTypedData(r,n,s){const i=uv(s),o=await Kf.resolveNames(r,n,i,async a=>{const c=await wr(a);return M(c!=null,"TypedData does not support null address","value",a),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(Kf.getPayload(o.domain,n,o.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?Sr(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),ne(n)])}}var Wc,Af,Zi,ii,Rs,ns,fn,zp,w2;class Iie extends xie{constructor(r,n){super(r,n);W(this,zp);W(this,Wc,void 0);W(this,Af,void 0);W(this,Zi,void 0);W(this,ii,void 0);W(this,Rs,void 0);W(this,ns,void 0);W(this,fn,void 0);N(this,Af,1),N(this,Wc,Object.assign({},bD,n||{})),N(this,Zi,[]),N(this,ii,null),N(this,ns,null),N(this,fn,null);{let i=null;const o=new Promise(a=>{i=a});N(this,Rs,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(M(!s||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),s&&r!=null&&N(this,ns,pi.from(r))):s&&(M(r==null||s.matches(r),"staticNetwork MUST match network object","options",n),N(this,ns,s))}_getOption(r){return S(this,Wc)[r]}get _network(){return J(S(this,ns),"network is not available yet","NETWORK_ERROR"),S(this,ns)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let s=r.transaction;if(s&&s.type!=null&&ye(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},s,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if(S(this,ns))return S(this,ns)}else return r;return S(this,fn)?await S(this,fn):this.ready?(N(this,fn,(async()=>{try{const n=pi.from(ye(await this.send("eth_chainId",[])));return N(this,fn,null),n}catch(n){throw N(this,fn,null),n}})()),await S(this,fn)):(N(this,fn,(async()=>{const n={id:Ed(this,Af)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let s;try{s=(await this._send(n))[0],N(this,fn,null)}catch(i){throw N(this,fn,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return pi.from(ye(s.result));throw this.getRpcError(n,s)})()),await S(this,fn))}_start(){S(this,Rs)==null||S(this,Rs).resolve==null||(S(this,Rs).resolve(),N(this,Rs,null),(async()=>{for(;S(this,ns)==null&&!this.destroyed;)try{N(this,ns,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Lt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await Rie(1e3)}ee(this,zp,w2).call(this)})())}async _waitUntilReady(){if(S(this,Rs)!=null)return await S(this,Rs).promise}_getSubscriber(r){return r.type==="pending"?new Tie(this):r.type==="event"?this._getOption("polling")?new VC(this,r.filter):new kie(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new gD("orphan"):super._getSubscriber(r)}get ready(){return S(this,Rs)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(r[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),n[i]=yu(ye(r[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{r[s]!=null&&(n[s]=ne(r[s]))}),r.accessList&&(n.accessList=Pl(r.accessList)),r.blobVersionedHashes&&(n.blobVersionedHashes=r.blobVersionedHashes.map(s=>s.toLowerCase())),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Vl(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Vl(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[Vl(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Vl(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(Vl):r.filter.address=Vl(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:s}=r,{error:i}=n;if(s==="eth_estimateGas"&&i.message){const c=i.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return Lt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const c=E2(i),l=op.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return l.info={error:i,payload:r},l}const o=JSON.stringify(_ie(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Lt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:r,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const c=r.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Lt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Lt("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Lt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:i}});if(o.match(/only replay-protected/i))return Lt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:c,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?Lt("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:i,payload:r}}):Lt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(Lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const s=Ed(this,Af)._++,i=new Promise((o,a)=>{S(this,Zi).push({resolve:o,reject:a,payload:{method:r,params:n,id:s,jsonrpc:"2.0"}})});return ee(this,zp,w2).call(this),i}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const i=await n;if(r>=i.length)throw new Error("no such account");return new Mx(this,i[r])}const{accounts:s}=await Fr({network:this.getNetwork(),accounts:n});r=Xe(r);for(const i of s)if(Xe(i)===r)return new Mx(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new Mx(this,n))}destroy(){S(this,ii)&&(clearTimeout(S(this,ii)),N(this,ii,null));for(const{payload:r,reject:n}of S(this,Zi))n(Lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));N(this,Zi,[]),super.destroy()}}Wc=new WeakMap,Af=new WeakMap,Zi=new WeakMap,ii=new WeakMap,Rs=new WeakMap,ns=new WeakMap,fn=new WeakMap,zp=new WeakSet,w2=function(){if(S(this,ii))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");N(this,ii,setTimeout(()=>{N(this,ii,null);const n=S(this,Zi);for(N(this,Zi,[]);n.length;){const s=[n.shift()];for(;n.length&&s.length!==S(this,Wc).batchMaxCount;)if(s.push(n.shift()),JSON.stringify(s.map(o=>o.payload)).length>S(this,Wc).batchMaxSize){n.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:c,payload:l}of s){if(this.destroyed){c(Lt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const u=o.filter(f=>f.id===l.id)[0];if(u==null){const f=Lt("missing response for request","BAD_DATA",{value:o,info:{payload:l}});this.emit("error",f),c(f);continue}if("error"in u){c(this.getRpcError(l,u));continue}a(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},r))};var aa;class Oie extends Iie{constructor(r,n){super(r,n);W(this,aa,void 0);let s=this._getOption("pollingInterval");s==null&&(s=bD.pollingInterval),N(this,aa,s)}_getSubscriber(r){const n=super._getSubscriber(r);return P3(n)&&(n.pollingInterval=S(this,aa)),n}get pollingInterval(){return S(this,aa)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");N(this,aa,r),this._forEachSubscriber(n=>{P3(n)&&(n.pollingInterval=S(this,aa))})}}aa=new WeakMap;var kf,J8;let wD=(J8=class extends Oie{constructor(r,n,s){r==null&&(r="http://localhost:8545");super(n,s);W(this,kf,void 0);typeof r=="string"?N(this,kf,new xo(r)):N(this,kf,r.clone())}_getConnection(){return S(this,kf).clone()}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){const n=this._getConnection();n.body=JSON.stringify(r),n.setHeader("content-type","application/json");const s=await n.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}},kf=new WeakMap,J8);function E2(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&vt(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=E2(t[e]);if(r)return r}return null}if(typeof t=="string")try{return E2(JSON.parse(t))}catch{}return null}function S2(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)S2(t[r],e);if(typeof t=="string")try{return S2(JSON.parse(t),e)}catch{}}}function _ie(t){const e=[];return S2(t,e),e}var Tf;const Lk=class Lk extends $C{constructor(r,n){super(n);G(this,"address");W(this,Tf,void 0);M(r&&typeof r.sign=="function","invalid private key","privateKey","[ REDACTED ]"),N(this,Tf,r);const s=gy(this.signingKey.publicKey);me(this,{address:s})}get signingKey(){return S(this,Tf)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(r){return new Lk(S(this,Tf),r)}async signTransaction(r){r=ap(r);const{to:n,from:s}=await Fr({to:r.to?wr(r.to,this.provider):void 0,from:r.from?wr(r.from,this.provider):void 0});n!=null&&(r.to=n),s!=null&&(r.from=s),r.from!=null&&(M(Xe(r.from)===this.address,"transaction from address mismatch","tx.from",r.from),delete r.from);const i=sp.from(r);return i.signature=this.signingKey.sign(i.unsignedHash),i.serialized}async signMessage(r){return this.signMessageSync(r)}signMessageSync(r){return this.signingKey.sign(hse(r)).serialized}async signTypedData(r,n,s){const i=await Kf.resolveNames(r,n,s,async o=>{J(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:o}});const a=await this.provider.resolveName(o);return J(a!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),a});return this.signingKey.sign(Kf.hash(i.domain,n,i.value)).serialized}};Tf=new WeakMap;let x0=Lk;const b0=" !#$%&'()*+,-./<=>?@[]^_`{|}~",Nie=/^[a-z]*$/i;function R3(t,e){let r=97;return t.reduce((n,s)=>(s===e?r++:s.match(Nie)?n.push(String.fromCharCode(r)+s):(r=97,n.push(s)),n),[])}function Mie(t,e){for(let s=b0.length-1;s>=0;s--)t=t.split(b0[s]).join(e.substring(2*s,2*s+2));const r=[],n=t.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(s,i,o,a)=>{if(o)for(let c=parseInt(o);c>=0;c--)r.push(";");else r.push(i.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return R3(R3(r,";"),":")}function Die(t){return M(t[0]==="0","unsupported auwl data","data",t),Mie(t.substring(1+2*b0.length),t.substring(1,1+2*b0.length))}class Lie{constructor(e){G(this,"locale");me(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}var Pf,Hp,Kc,Gp,C2;class jie extends Lie{constructor(r,n,s){super(r);W(this,Gp);W(this,Pf,void 0);W(this,Hp,void 0);W(this,Kc,void 0);N(this,Pf,n),N(this,Hp,s),N(this,Kc,null)}get _data(){return S(this,Pf)}_decodeWords(){return Die(S(this,Pf))}getWord(r){const n=ee(this,Gp,C2).call(this);return M(r>=0&&r=12&&r.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const n=new Uint8Array(Math.ceil(11*r.length/8));let s=0;for(let l=0;l=0,`invalid mnemonic word at index ${l}`,"mnemonic","[ REDACTED ]");for(let f=0;f<11;f++)u&1<<10-f&&(n[s>>3]|=1<<7-s%8),s++}const i=32*r.length/3,o=r.length/3,a=ED(o),c=fe(ys(n.slice(0,i/8)))[0]&a;return M(c===(n[n.length-1]&a),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),ne(n.slice(0,i/8))}function jx(t,e){M(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=Na.wordlist());const r=[0];let n=11;for(let o=0;o8?(r[r.length-1]<<=8,r[r.length-1]|=t[o],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[o]>>8-n,r.push(t[o]&Uie(8-n)),n+=3);const s=t.length/4,i=parseInt(ys(t).substring(2,4),16)&ED(s);return r[r.length-1]<<=s,r[r.length-1]|=i>>8-s,e.join(r.map(o=>e.getWord(o)))}const Bx={};class Yf{constructor(e,r,n,s,i){G(this,"phrase");G(this,"password");G(this,"wordlist");G(this,"entropy");s==null&&(s=""),i==null&&(i=Na.wordlist()),$a(e,Bx,"Mnemonic"),me(this,{phrase:n,password:s,wordlist:i,entropy:r})}computeSeed(){const e=Sr("mnemonic"+this.password,"NFKD");return za(Sr(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,r,n){const s=Lx(e,n);return e=jx(fe(s),n),new Yf(Bx,s,e,r,n)}static fromEntropy(e,r,n){const s=fe(e,"entropy"),i=jx(s,n);return new Yf(Bx,ne(s),i,r,n)}static entropyToPhrase(e,r){const n=fe(e,"entropy");return jx(n,r)}static phraseToEntropy(e,r){return Lx(e,r)}static isValidMnemonic(e,r){try{return Lx(e,r),!0}catch{}return!1}}/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */var hr=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Fx=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r},fv,Qn,Ks;const Vie={16:10,24:12,32:14},$ie=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Wn=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],E1=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],zie=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Hie=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Gie=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],qie=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Wie=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Kie=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Qie=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Yie=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Jie=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Xie=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Zie=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],eoe=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ux(t){const e=[];for(let r=0;r>2,hr(this,Ks,"f")[o][u%4]=i[u],hr(this,Qn,"f")[r-o][u%4]=i[u];let a=0,c=s,l;for(;c>16&255]<<24^Wn[l>>8&255]<<16^Wn[l&255]<<8^Wn[l>>24&255]^$ie[a]<<24,a+=1,s!=8)for(let h=1;h>8&255]<<8^Wn[l>>16&255]<<16^Wn[l>>24&255]<<24;for(let h=s/2+1;h>2,d=c%4,hr(this,Ks,"f")[f][d]=i[u],hr(this,Qn,"f")[r-f][d]=i[u++],c++}for(let u=1;u>24&255]^Xie[l>>16&255]^Zie[l>>8&255]^eoe[l&255]}encrypt(e){if(e.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const r=hr(this,Ks,"f").length-1,n=[0,0,0,0];let s=Ux(e);for(let a=0;a<4;a++)s[a]^=hr(this,Ks,"f")[0][a];for(let a=1;a>24&255]^Hie[s[(c+1)%4]>>16&255]^Gie[s[(c+2)%4]>>8&255]^qie[s[(c+3)%4]&255]^hr(this,Ks,"f")[a][c];s=n.slice()}const i=new Uint8Array(16);let o=0;for(let a=0;a<4;a++)o=hr(this,Ks,"f")[r][a],i[4*a]=(Wn[s[a]>>24&255]^o>>24)&255,i[4*a+1]=(Wn[s[(a+1)%4]>>16&255]^o>>16)&255,i[4*a+2]=(Wn[s[(a+2)%4]>>8&255]^o>>8)&255,i[4*a+3]=(Wn[s[(a+3)%4]&255]^o)&255;return i}decrypt(e){if(e.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const r=hr(this,Qn,"f").length-1,n=[0,0,0,0];let s=Ux(e);for(let a=0;a<4;a++)s[a]^=hr(this,Qn,"f")[0][a];for(let a=1;a>24&255]^Kie[s[(c+3)%4]>>16&255]^Qie[s[(c+2)%4]>>8&255]^Yie[s[(c+1)%4]&255]^hr(this,Qn,"f")[a][c];s=n.slice()}const i=new Uint8Array(16);let o=0;for(let a=0;a<4;a++)o=hr(this,Qn,"f")[r][a],i[4*a]=(E1[s[a]>>24&255]^o>>24)&255,i[4*a+1]=(E1[s[(a+3)%4]>>16&255]^o>>16)&255,i[4*a+2]=(E1[s[(a+2)%4]>>8&255]^o>>8)&255,i[4*a+3]=(E1[s[(a+1)%4]&255]^o)&255;return i}}fv=new WeakMap,Qn=new WeakMap,Ks=new WeakMap;class SD{constructor(e,r,n){if(n&&!(this instanceof n))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new zC(r)},name:{enumerable:!0,value:e}})}}var S1=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r},$l=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},rh,Oi;class HC extends SD{constructor(e,r){if(super("ECC",e,HC),rh.set(this,void 0),Oi.set(this,void 0),r){if(r.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");S1(this,rh,new Uint8Array(r),"f")}else S1(this,rh,new Uint8Array(16),"f");S1(this,Oi,this.iv,"f")}get iv(){return new Uint8Array($l(this,rh,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const r=new Uint8Array(e.length);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let r=15;r>=0;--r)Kn(this,Yn,"f")[r]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(e.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");Kn(this,Yn,"f").set(e)}increment(){for(let e=15;e>=0;e--)if(Kn(this,Yn,"f")[e]===255)Kn(this,Yn,"f")[e]=0;else{Kn(this,Yn,"f")[e]++;break}}encrypt(e){var r,n;const s=new Uint8Array(e);for(let i=0;i16)throw new TypeError("PKCS#7 padding byte out of range");const r=t.length-e;for(let n=0;n0&&(n&n-1)===0,"invalid kdf.N","kdf.N",n),M(s>0&&i>0,"invalid kdf","kdf",e);const o=Ht(t,"crypto.kdfparams.dklen:int!");return M(o===32,"invalid kdf.dklen","kdf.dflen",o),{name:"scrypt",salt:r,N:n,r:s,p:i,dkLen:64}}else if(e.toLowerCase()==="pbkdf2"){const r=Ht(t,"crypto.kdfparams.salt:data!"),n=Ht(t,"crypto.kdfparams.prf:string!"),s=n.split("-").pop();M(s==="sha256"||s==="sha512","invalid kdf.pdf","kdf.pdf",n);const i=Ht(t,"crypto.kdfparams.c:int!"),o=Ht(t,"crypto.kdfparams.dklen:int!");return M(o===32,"invalid kdf.dklen","kdf.dklen",o),{name:"pbkdf2",salt:r,count:i,dkLen:o,algorithm:s}}}M(!1,"unsupported key-derivation function","kdf",e)}function noe(t,e){const r=JSON.parse(t),n=Sy(e),s=kD(r);if(s.name==="pbkdf2"){const{salt:f,count:d,dkLen:h,algorithm:p}=s,y=za(n,f,d,h,p);return w0(r,y)}J(s.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:s});const{salt:i,N:o,r:a,p:c,dkLen:l}=s,u=vd(n,i,o,a,c,l);return w0(r,u)}function O3(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function soe(t,e,r){const n=JSON.parse(t),s=Sy(e),i=kD(n);if(i.name==="pbkdf2"){r&&(r(0),await O3(0));const{salt:d,count:h,dkLen:p,algorithm:y}=i,g=za(s,d,h,p,y);return r&&(r(1),await O3(0)),w0(n,g)}J(i.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:o,N:a,r:c,p:l,dkLen:u}=i,f=await yd(s,o,a,c,l,u,r);return w0(n,f)}function TD(t){const e=t.salt!=null?fe(t.salt,"options.salt"):co(32);let r=1<<17,n=8,s=1;return t.scrypt&&(t.scrypt.N&&(r=t.scrypt.N),t.scrypt.r&&(n=t.scrypt.r),t.scrypt.p&&(s=t.scrypt.p)),M(typeof r=="number"&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),M(typeof n=="number"&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),M(typeof s=="number"&&s>0&&Number.isSafeInteger(s),"invalid scrypt p parameter","options.p",s),{name:"scrypt",dkLen:32,salt:e,N:r,r:n,p:s}}function PD(t,e,r,n){const s=fe(r.privateKey,"privateKey"),i=n.iv!=null?fe(n.iv,"options.iv"):co(16);M(i.length===16,"invalid options.iv length","options.iv",n.iv);const o=n.uuid!=null?fe(n.uuid,"options.uuid"):co(16);M(o.length===16,"invalid options.uuid length","options.uuid",n.iv);const a=t.slice(0,16),c=t.slice(16,32),l=new Jf(a,i),u=fe(l.encrypt(s)),f=Ct(ot([c,u])),d={address:r.address.substring(2).toLowerCase(),id:lte(o),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ne(i).substring(2)},ciphertext:ne(u).substring(2),kdf:"scrypt",kdfparams:{salt:ne(e.salt).substring(2),n:e.N,dklen:32,p:e.p,r:e.r},mac:f.substring(2)}};if(r.mnemonic){const h=n.client!=null?n.client:`ethers/${i7}`,p=r.mnemonic.path||AD,y=r.mnemonic.locale||"en",g=t.slice(32,64),m=fe(r.mnemonic.entropy,"account.mnemonic.entropy"),x=co(16),b=new Jf(g,x),w=fe(b.encrypt(m)),A=new Date,_="UTC--"+(A.getUTCFullYear()+"-"+Ud(A.getUTCMonth()+1,2)+"-"+Ud(A.getUTCDate(),2)+"T"+Ud(A.getUTCHours(),2)+"-"+Ud(A.getUTCMinutes(),2)+"-"+Ud(A.getUTCSeconds(),2)+".0Z")+"--"+d.address;d["x-ethers"]={client:h,gethFilename:_,path:p,locale:y,mnemonicCounter:ne(x).substring(2),mnemonicCiphertext:ne(w).substring(2),version:"0.1"}}return JSON.stringify(d)}function RD(t,e,r){r==null&&(r={});const n=Sy(e),s=TD(r),i=vd(n,s.salt,s.N,s.r,s.p,64);return PD(fe(i),s,t,r)}async function ID(t,e,r){r==null&&(r={});const n=Sy(e),s=TD(r),i=await yd(n,s.salt,s.N,s.r,s.p,64,r.progressCallback);return PD(fe(i),s,t,r)}const Vx="m/44'/60'/0'/0/0",ioe=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Sa=2147483648,ooe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),aoe="0123456789abcdef";function E0(t,e){let r="";for(;t;)r=aoe[t%16]+r,t=Math.trunc(t/16);for(;r.length=0;o-=8)s[33+(o>>3)]=t>>24-o&255;const i=fe(hd("sha512",e,s));return{IL:i.slice(0,32),IR:i.slice(32)}}function _D(t,e){const r=e.split("/");M(r.length>0,"invalid path","path",e),r[0]==="m"&&(M(t.depth===0,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${t.depth}`,"path",e),r.shift());let n=t;for(let s=0;s=16&&s.length<=64,"invalid seed","seed","[REDACTED]");const i=fe(hd("sha512",ioe,s)),o=new gi(ne(i.slice(0,32)));return new ws(Js,o,"0x00000000",ne(i.slice(32)),"m",0,0,n,null)},W(ws,Qc);let bh=ws;class lp extends g2{constructor(r,n,s,i,o,a,c,l,u){super(n,u);G(this,"publicKey");G(this,"fingerprint");G(this,"parentFingerprint");G(this,"chainCode");G(this,"path");G(this,"index");G(this,"depth");$a(r,Js,"HDNodeVoidWallet"),me(this,{publicKey:s});const f=xt(pd(ys(s)),0,4);me(this,{publicKey:s,fingerprint:f,parentFingerprint:i,chainCode:o,path:a,index:c,depth:l})}connect(r){return new lp(Js,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,r)}get extendedKey(){return J(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),A2(ot(["0x0488B21E",E0(this.depth,1),this.parentFingerprint,E0(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(r){const n=_e(r,"index");M(n<=4294967295,"invalid index","index",n);let s=this.path;s&&(s+="/"+(n&~Sa),n&Sa&&(s+="'"));const{IR:i,IL:o}=OD(n,this.chainCode,this.publicKey,null),a=gi.addPoints(o,this.publicKey,!0),c=gy(a);return new lp(Js,c,a,this.fingerprint,ne(i),s,n,this.depth+1,this.provider)}derivePath(r){return _D(this,r)}}function _3(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function N3(t,e){const r=JSON.parse(t),n=Sy(e),s=Xe(Ht(r,"ethaddr:string!")),i=CD(Ht(r,"encseed:string!"));M(i&&i.length%16===0,"invalid encseed","json",t);const o=fe(za(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),l=new HC(o,a),u=toe(fe(l.decrypt(c)));let f="";for(let d=0;d{setTimeout(()=>{e()},t)})}var Wp,T2;const pc=class pc extends x0{constructor(e,r){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let n=typeof e=="string"?new gi(e):e;super(n,r)}connect(e){return new pc(this.signingKey,e)}async encrypt(e,r){const n={address:this.address,privateKey:this.privateKey};return await ID(n,e,{progressCallback:r})}encryptSync(e){const r={address:this.address,privateKey:this.privateKey};return RD(r,e)}static async fromEncryptedJson(e,r,n){var i;let s=null;return I3(e)?s=await soe(e,r,n):_3(e)&&(n&&(n(0),await M3(0)),s=N3(e,r),n&&(n(1),await M3(0))),ee(i=pc,Wp,T2).call(i,s)}static fromEncryptedJsonSync(e,r){var s;let n=null;return I3(e)?n=noe(e,r):_3(e)?n=N3(e,r):M(!1,"invalid JSON wallet","json","[ REDACTED ]"),ee(s=pc,Wp,T2).call(s,n)}static createRandom(e){const r=bh.createRandom();return e?r.connect(e):r}static fromPhrase(e,r){const n=bh.fromPhrase(e);return r?n.connect(r):n}};Wp=new WeakSet,T2=function(e){if(M(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const n=Yf.fromEntropy(e.mnemonic.entropy),s=bh.fromMnemonic(n,e.mnemonic.path);if(s.address===e.address&&s.privateKey===e.privateKey)return s;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const r=new pc(e.privateKey);return M(r.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),r},W(pc,Wp);let up=pc;const coe={en:Na.wordlist()};BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const GC=t=>{const e=t.toString(16);return`${e.length%2===0?"0x":"0x0"}${e}`};function P2(){return P2=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&(e+=","),e+=JSON.stringify(i),e+=":",r(s[i])}}let K=function(t){return t[t.MAINNET=1]="MAINNET",t[t.ROPSTEN=3]="ROPSTEN",t[t.RINKEBY=4]="RINKEBY",t[t.GOERLI=5]="GOERLI",t[t.KOVAN=42]="KOVAN",t[t.SEPOLIA=11155111]="SEPOLIA",t[t.POLYGON=137]="POLYGON",t[t.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",t[t.POLYGON_ZKEVM=1101]="POLYGON_ZKEVM",t[t.POLYGON_AMOY=80002]="POLYGON_AMOY",t[t.BSC=56]="BSC",t[t.BSC_TESTNET=97]="BSC_TESTNET",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_KOVAN=69]="OPTIMISM_KOVAN",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.OPTIMISM_SEPOLIA=11155420]="OPTIMISM_SEPOLIA",t[t.ARBITRUM=42161]="ARBITRUM",t[t.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",t[t.ARBITRUM_SEPOLIA=421614]="ARBITRUM_SEPOLIA",t[t.ARBITRUM_NOVA=42170]="ARBITRUM_NOVA",t[t.AVALANCHE=43114]="AVALANCHE",t[t.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",t[t.GNOSIS=100]="GNOSIS",t[t.BASE=8453]="BASE",t[t.BASE_GOERLI=84531]="BASE_GOERLI",t[t.BASE_SEPOLIA=84532]="BASE_SEPOLIA",t[t.HOMEVERSE_TESTNET=40875]="HOMEVERSE_TESTNET",t[t.HOMEVERSE=19011]="HOMEVERSE",t[t.XAI=660279]="XAI",t[t.XAI_SEPOLIA=37714555429]="XAI_SEPOLIA",t[t.ASTAR_ZKEVM=3776]="ASTAR_ZKEVM",t[t.ASTAR_ZKYOTO=6038361]="ASTAR_ZKYOTO",t[t.XR_SEPOLIA=2730]="XR_SEPOLIA",t[t.TELOS=40]="TELOS",t[t.B3_SEPOLIA=1993]="B3_SEPOLIA",t[t.APECHAIN_TESTNET=33111]="APECHAIN_TESTNET",t[t.BLAST=81457]="BLAST",t[t.BLAST_SEPOLIA=168587773]="BLAST_SEPOLIA",t[t.BORNE_TESTNET=94984]="BORNE_TESTNET",t[t.HARDHAT=31337]="HARDHAT",t[t.HARDHAT_2=31338]="HARDHAT_2",t}({}),Fe=function(t){return t.MAINNET="mainnet",t.TESTNET="testnet",t}({});const S0={[K.MAINNET]:{chainId:K.MAINNET,type:Fe.MAINNET,name:"mainnet",title:"Ethereum",logoURI:`https://assets.sequence.info/images/networks/medium/${K.MAINNET}.webp`,blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[K.ROPSTEN]:{chainId:K.ROPSTEN,type:Fe.TESTNET,name:"ropsten",title:"Ropsten",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ROPSTEN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},nativeToken:{symbol:"roETH",name:"Ropsten Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deprecated:!0},[K.RINKEBY]:{chainId:K.RINKEBY,type:Fe.TESTNET,name:"rinkeby",title:"Rinkeby",logoURI:`https://assets.sequence.info/images/networks/medium/${K.RINKEBY}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},nativeToken:{symbol:"rETH",name:"Rinkeby Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deprecated:!0},[K.GOERLI]:{chainId:K.GOERLI,type:Fe.TESTNET,name:"goerli",title:"Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deprecated:!0},[K.KOVAN]:{chainId:K.KOVAN,type:Fe.TESTNET,name:"kovan",title:"Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${K.KOVAN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"},nativeToken:{symbol:"kETH",name:"Kovan Ether",decimals:18},deprecated:!0},[K.SEPOLIA]:{chainId:K.SEPOLIA,type:Fe.TESTNET,name:"sepolia",title:"Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Sepolia)",rootUrl:"https://sepolia.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.POLYGON]:{chainId:K.POLYGON,type:Fe.MAINNET,name:"polygon",title:"Polygon",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON}.webp`,blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"},nativeToken:{symbol:"MATIC",name:"Polygon",decimals:18}},[K.POLYGON_MUMBAI]:{chainId:K.POLYGON_MUMBAI,type:Fe.TESTNET,name:"mumbai",title:"Polygon Mumbai",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON_MUMBAI}.webp`,testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"},nativeToken:{symbol:"mMATIC",name:"Mumbai Polygon",decimals:18},deprecated:!0},[K.POLYGON_AMOY]:{chainId:K.POLYGON_AMOY,type:Fe.TESTNET,name:"amoy",title:"Polygon Amoy",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON_AMOY}.webp`,testnet:!0,blockExplorer:{name:"OKLink (Amoy)",rootUrl:"https://www.oklink.com/amoy/"},nativeToken:{symbol:"aMATIC",name:"Amoy Polygon",decimals:18}},[K.POLYGON_ZKEVM]:{chainId:K.POLYGON_ZKEVM,type:Fe.MAINNET,name:"polygon-zkevm",title:"Polygon zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON_ZKEVM}.webp`,blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.BSC]:{chainId:K.BSC,type:Fe.MAINNET,name:"bsc",title:"BNB Smart Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BSC}.webp`,blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"},nativeToken:{symbol:"BNB",name:"BNB",decimals:18}},[K.BSC_TESTNET]:{chainId:K.BSC_TESTNET,type:Fe.TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BSC_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"},nativeToken:{symbol:"tBNB",name:"Testnet BNB",decimals:18}},[K.OPTIMISM]:{chainId:K.OPTIMISM,type:Fe.MAINNET,name:"optimism",title:"Optimism",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM}.webp`,blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.OPTIMISM_KOVAN]:{chainId:K.OPTIMISM_KOVAN,type:Fe.TESTNET,name:"optimism-kovan",title:"Optimism Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM_KOVAN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Kovan)",rootUrl:"https://kovan-optimistic.etherscan.io/"},nativeToken:{symbol:"kETH",name:"Kovan Ether",decimals:18},deprecated:!0},[K.OPTIMISM_GOERLI]:{chainId:K.OPTIMISM_GOERLI,type:Fe.TESTNET,name:"optimism-goerli",title:"Optimism Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM_GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Goerli)",rootUrl:"https://goerli-optimistic.etherscan.io/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},deprecated:!0},[K.OPTIMISM_SEPOLIA]:{chainId:K.OPTIMISM_SEPOLIA,type:Fe.TESTNET,name:"optimism-sepolia",title:"Optimism Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Sepolia)",rootUrl:"https://sepolia-optimistic.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.ARBITRUM]:{chainId:K.ARBITRUM,type:Fe.MAINNET,name:"arbitrum",title:"Arbitrum One",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM}.webp`,blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.ARBITRUM_GOERLI]:{chainId:K.ARBITRUM_GOERLI,type:Fe.TESTNET,name:"arbitrum-goerli",title:"Arbitrum Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM_GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Arbiscan (Goerli Testnet)",rootUrl:"https://testnet.arbiscan.io/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},deprecated:!0},[K.ARBITRUM_SEPOLIA]:{chainId:K.ARBITRUM_SEPOLIA,type:Fe.TESTNET,name:"arbitrum-sepolia",title:"Arbitrum Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Arbiscan (Sepolia Testnet)",rootUrl:"https://sepolia.arbiscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.ARBITRUM_NOVA]:{chainId:K.ARBITRUM_NOVA,type:Fe.MAINNET,name:"arbitrum-nova",title:"Arbitrum Nova",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM_NOVA}.webp`,blockExplorer:{name:"Arbiscan Nova",rootUrl:"https://nova.arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.AVALANCHE]:{chainId:K.AVALANCHE,type:Fe.MAINNET,name:"avalanche",title:"Avalanche",logoURI:`https://assets.sequence.info/images/networks/medium/${K.AVALANCHE}.webp`,blockExplorer:{name:"Snowtrace",rootUrl:"https://subnets.avax.network/c-chain/"},nativeToken:{symbol:"AVAX",name:"AVAX",decimals:18}},[K.AVALANCHE_TESTNET]:{chainId:K.AVALANCHE_TESTNET,type:Fe.TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.AVALANCHE_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://subnets-test.avax.network/c-chain/"},nativeToken:{symbol:"tAVAX",name:"Testnet AVAX",decimals:18}},[K.GNOSIS]:{chainId:K.GNOSIS,type:Fe.MAINNET,name:"gnosis",title:"Gnosis Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${K.GNOSIS}.webp`,blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"},nativeToken:{symbol:"XDAI",name:"XDAI",decimals:18}},[K.BASE]:{chainId:K.BASE,type:Fe.MAINNET,name:"base",title:"Base (Coinbase)",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BASE}.webp`,blockExplorer:{name:"Base Explorer",rootUrl:"https://basescan.org/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.BASE_GOERLI]:{chainId:K.BASE_GOERLI,type:Fe.TESTNET,name:"base-goerli",title:"Base Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BASE_GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},deprecated:!0},[K.BASE_SEPOLIA]:{chainId:K.BASE_SEPOLIA,type:Fe.TESTNET,name:"base-sepolia",title:"Base Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BASE_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Base Sepolia Explorer",rootUrl:"https://base-sepolia.blockscout.com/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.HOMEVERSE]:{chainId:K.HOMEVERSE,type:Fe.MAINNET,name:"homeverse",title:"Oasys Homeverse",logoURI:`https://assets.sequence.info/images/networks/medium/${K.HOMEVERSE}.webp`,blockExplorer:{name:"Oasys Homeverse Explorer",rootUrl:"https://explorer.oasys.homeverse.games/"},nativeToken:{symbol:"OAS",name:"OAS",decimals:18}},[K.HOMEVERSE_TESTNET]:{chainId:K.HOMEVERSE_TESTNET,type:Fe.TESTNET,name:"homeverse-testnet",title:"Oasys Homeverse Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.HOMEVERSE_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"Oasys Homeverse Explorer (Testnet)",rootUrl:"https://explorer.testnet.oasys.homeverse.games/"},nativeToken:{symbol:"tOAS",name:"Testnet OAS",decimals:18}},[K.XAI]:{chainId:K.XAI,type:Fe.MAINNET,name:"xai",title:"Xai",logoURI:`https://assets.sequence.info/images/networks/medium/${K.XAI}.webp`,blockExplorer:{name:"Xai Explorer",rootUrl:"https://explorer.xai-chain.net/"},nativeToken:{symbol:"XAI",name:"XAI",decimals:18}},[K.XAI_SEPOLIA]:{chainId:K.XAI_SEPOLIA,type:Fe.TESTNET,name:"xai-sepolia",title:"Xai Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.XAI_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Xai Sepolia Explorer",rootUrl:"https://testnet-explorer-v2.xai-chain.net/"},nativeToken:{symbol:"sXAI",name:"Sepolia XAI",decimals:18}},[K.ASTAR_ZKEVM]:{chainId:K.ASTAR_ZKEVM,type:Fe.MAINNET,name:"astar-zkevm",title:"Astar zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ASTAR_ZKEVM}.webp`,blockExplorer:{name:"Astar zkEVM Explorer",rootUrl:"https://astar-zkevm.explorer.startale.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.ASTAR_ZKYOTO]:{chainId:K.ASTAR_ZKYOTO,type:Fe.TESTNET,name:"astar-zkyoto",title:"Astar zKyoto Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ASTAR_ZKYOTO}.webp`,testnet:!0,blockExplorer:{name:"Astar zKyoto Explorer",rootUrl:"https://astar-zkyoto.blockscout.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.XR_SEPOLIA]:{chainId:K.XR_SEPOLIA,type:Fe.TESTNET,name:"xr-sepolia",title:"XR Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.XR_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"XR Sepolia Explorer",rootUrl:"https://xr-sepolia-testnet.explorer.caldera.xyz/"},nativeToken:{symbol:"tXR",name:"Sepolia XR",decimals:18}},[K.B3_SEPOLIA]:{chainId:K.B3_SEPOLIA,type:Fe.TESTNET,name:"b3-sepolia",title:"B3 Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.B3_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"B3 Sepolia Explorer",rootUrl:"https://sepolia.explorer.b3.fun/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.APECHAIN_TESTNET]:{chainId:K.APECHAIN_TESTNET,type:Fe.TESTNET,name:"apechain-testnet",title:"APE Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.APECHAIN_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"APE Chain Explorer",rootUrl:"https://curtis.explorer.caldera.xyz/"},nativeToken:{symbol:"APE",name:"ApeCoin",decimals:18}},[K.BLAST]:{chainId:K.BLAST,type:Fe.MAINNET,name:"blast",title:"Blast",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BLAST}.webp`,blockExplorer:{name:"Blast Explorer",rootUrl:"https://blastscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.BLAST_SEPOLIA]:{chainId:K.BLAST_SEPOLIA,type:Fe.TESTNET,name:"blast-sepolia",title:"Blast Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BLAST_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Blast Sepolia Explorer",rootUrl:"https://sepolia.blastexplorer.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.TELOS]:{chainId:K.TELOS,type:Fe.MAINNET,name:"telos",title:"Telos",logoURI:`https://assets.sequence.info/images/networks/medium/${K.TELOS}.webp`,blockExplorer:{name:"Telos Explorer",rootUrl:"https://explorer.telos.net/network/"},nativeToken:{symbol:"TLOS",name:"TLOS",decimals:18}},[K.BORNE_TESTNET]:{chainId:K.BORNE_TESTNET,type:Fe.TESTNET,name:"borne-testnet",title:"Borne Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BORNE_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"Borne Testnet Explorer",rootUrl:"https://subnets-test.avax.network/bornegfdn"},nativeToken:{symbol:"BORNE",name:"BORNE",decimals:18}},[K.HARDHAT]:{chainId:K.HARDHAT,name:"hardhat",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.HARDHAT_2]:{chainId:K.HARDHAT_2,name:"hardhat2",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}}};function Xf(){return Xf=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(!t)throw new Error("invalid network config: empty config");const n=[];if(Array.isArray(t)?n.push(...t):n.push(t),n.length===0){if(e)throw new Error("invalid network config: empty config");return!1}const s=n.map(l=>l.chainId).sort(),i=s.filter((l,u)=>s.indexOf(l)!==u);if(i.length>0){if(e)throw new Error(`invalid network config: duplicate chainIds ${i}`);return!1}n.forEach(l=>l.name=l.name.toLowerCase());const o=n.map(l=>l.name).sort(),a=o.filter((l,u)=>o.indexOf(l)!==u);if(a.length>0){if(e)throw new Error(`invalid network config: duplicate network names ${a}`);return!1}let c=!1;for(let l=0;l(doe(t,!0,e),t),poe=t=>hoe(voe(t)),yoe=(t,e)=>{if(typeof e=="string")if(e.startsWith("0x")){const r=Number(e);return t.find(n=>n.chainId===r)}else return t.find(r=>r.name===e||`${r.chainId}`===e);else{if(typeof e=="number")return t.find(r=>r.chainId===e);if(e.chainId)return t.find(r=>r.chainId===e.chainId);if(typeof e=="bigint"){const r=Number(e);return t.find(n=>n.chainId===r)}else return}},voe=t=>{if(!t)return[];const e=t.sort((n,s)=>n.chainId===s.chainId?0:n.chainIdn.isDefaultChain);return r>0&&e.splice(0,0,e.splice(r,1)[0]),e},qC=(t,e)=>typeof t=="string"?(e=e||{},t.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,function(r,n){let s=e[n];return typeof s=="function"?s=s():s==null?s="":typeof s=="object"||typeof s=="symbol"?s=s.toString():s=s.valueOf(),s})):"",ND=t=>qC("https://${network}-indexer.sequence.app",{network:t}),moe=t=>qC("https://${network}-relayer.sequence.app",{network:t}),goe=t=>qC("https://nodes.sequence.app/${network}",{network:t});function fp(t){return yoe(boe,t)}const Ke=(t,e)=>{const r=S0[t];if(!r)throw new Error(`Network with chainId ${t} not found`);const n=goe(r.name);return Xf({},r,{rpcUrl:n,indexerUrl:ND(r.name),relayer:{url:moe(r.name),provider:{url:n}}},e)},xoe=[Xf({},S0[K.HARDHAT],{rpcUrl:"http://localhost:8545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:8545"}}}),Xf({},S0[K.HARDHAT_2],{rpcUrl:"http://localhost:9545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:9545"}}})],boe=poe([Xf({},Ke(K.POLYGON),{isDefaultChain:!0,isAuthChain:!0}),Ke(K.MAINNET),Ke(K.BSC),Ke(K.AVALANCHE),Ke(K.ARBITRUM),Ke(K.ARBITRUM_NOVA),Ke(K.OPTIMISM),Ke(K.OPTIMISM_SEPOLIA),Ke(K.POLYGON_ZKEVM),Ke(K.GNOSIS),Ke(K.RINKEBY,{disabled:!0}),Ke(K.GOERLI,{disabled:!0}),Ke(K.SEPOLIA),Ke(K.POLYGON_MUMBAI,{disabled:!0}),Ke(K.POLYGON_AMOY),Ke(K.BSC_TESTNET),Ke(K.ARBITRUM_SEPOLIA),Ke(K.BASE),Ke(K.BASE_SEPOLIA),Ke(K.HOMEVERSE),Ke(K.HOMEVERSE_TESTNET),Ke(K.XAI),Ke(K.XAI_SEPOLIA),Ke(K.AVALANCHE_TESTNET),Ke(K.ASTAR_ZKEVM),Ke(K.ASTAR_ZKYOTO),Ke(K.XR_SEPOLIA),Ke(K.B3_SEPOLIA),Ke(K.APECHAIN_TESTNET),Ke(K.BLAST),Ke(K.BLAST_SEPOLIA),Ke(K.TELOS),Ke(K.BORNE_TESTNET),...xoe]),woe=(t,e)=>e.some(r=>t instanceof r);let D3,L3;function Eoe(){return D3||(D3=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Soe(){return L3||(L3=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const MD=new WeakMap,R2=new WeakMap,DD=new WeakMap,$x=new WeakMap,WC=new WeakMap;function Coe(t){const e=new Promise((r,n)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{r(Ca(t.result)),s()},o=()=>{n(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(r=>{r instanceof IDBCursor&&MD.set(r,t)}).catch(()=>{}),WC.set(e,t),e}function Aoe(t){if(R2.has(t))return;const e=new Promise((r,n)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{r(),s()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});R2.set(t,e)}let I2={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return R2.get(t);if(e==="objectStoreNames")return t.objectStoreNames||DD.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Ca(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function koe(t){I2=t(I2)}function Toe(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){const n=t.call(zx(this),e,...r);return DD.set(n,e.sort?e.sort():[e]),Ca(n)}:Soe().includes(t)?function(...e){return t.apply(zx(this),e),Ca(MD.get(this))}:function(...e){return Ca(t.apply(zx(this),e))}}function Poe(t){return typeof t=="function"?Toe(t):(t instanceof IDBTransaction&&Aoe(t),woe(t,Eoe())?new Proxy(t,I2):t)}function Ca(t){if(t instanceof IDBRequest)return Coe(t);if($x.has(t))return $x.get(t);const e=Poe(t);return e!==t&&($x.set(t,e),WC.set(e,t)),e}const zx=t=>WC.get(t);function Roe(t,e,{blocked:r,upgrade:n,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=Ca(o);return n&&o.addEventListener("upgradeneeded",c=>{n(Ca(o.result),c.oldVersion,c.newVersion,Ca(o.transaction),c)}),r&&o.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",l=>s(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const Ioe=["get","getKey","getAll","getAllKeys","count"],Ooe=["put","add","delete","clear"],Hx=new Map;function j3(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Hx.get(e))return Hx.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,s=Ooe.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(s||Ioe.includes(r)))return;const i=async function(o,...a){const c=this.transaction(o,s?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),s&&c.done]))[0]};return Hx.set(e,i),i}koe(t=>({...t,get:(e,r,n)=>j3(e,r)||t.get(e,r,n),has:(e,r)=>!!j3(e,r)||t.has(e,r)}));const _oe=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Noe=t=>({httpHandler:t.httpHandler()});var B3;(function(t){t.HEADER="header",t.QUERY="query"})(B3||(B3={}));var F3;(function(t){t.HEADER="header",t.QUERY="query"})(F3||(F3={}));var dp;(function(t){t.HTTP="http",t.HTTPS="https"})(dp||(dp={}));var C0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(C0||(C0={}));var U3;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(U3||(U3={}));const O2="__smithy_context";var V3;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(V3||(V3={}));var $3;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})($3||($3={}));class Vn{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const r=new Vn({...e,headers:{...e.headers}});return r.query&&(r.query=Moe(r.query)),r}static isInstance(e){if(!e)return!1;const r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return Vn.clone(this)}}function Moe(t){return Object.keys(t).reduce((e,r)=>{const n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}class A0{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}const Doe=t=>e=>async r=>{if(!Vn.isInstance(r.request))return e(r);const{request:n}=r,{handlerProtocol:s=""}=t.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let i=n.hostname;n.port!=null&&(i+=`:${n.port}`),n.headers.host=i}return e(r)},Loe={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},joe=t=>({applyToStack:e=>{e.add(Doe(t),Loe)}}),Boe=()=>(t,e)=>async r=>{var n,s;try{const i=await t(r),{clientName:o,commandName:a,logger:c,dynamoDbDocumentClientOptions:l={}}=e,{overrideInputFilterSensitiveLog:u,overrideOutputFilterSensitiveLog:f}=l,d=u??e.inputFilterSensitiveLog,h=f??e.outputFilterSensitiveLog,{$metadata:p,...y}=i.output;return(n=c==null?void 0:c.info)==null||n.call(c,{clientName:o,commandName:a,input:d(r.input),output:h(y),metadata:p}),i}catch(i){const{clientName:o,commandName:a,logger:c,dynamoDbDocumentClientOptions:l={}}=e,{overrideInputFilterSensitiveLog:u}=l,f=u??e.inputFilterSensitiveLog;throw(s=c==null?void 0:c.error)==null||s.call(c,{clientName:o,commandName:a,input:f(r.input),error:i,metadata:i.$metadata}),i}},Foe={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Uoe=t=>({applyToStack:e=>{e.add(Boe(),Foe)}}),z3="X-Amzn-Trace-Id",Voe="AWS_LAMBDA_FUNCTION_NAME",$oe="_X_AMZN_TRACE_ID",zoe=t=>e=>async r=>{const{request:n}=r;if(!Vn.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(z3))return e(r);const s=process.env[Voe],i=process.env[$oe],o=a=>typeof a=="string"&&a.length>0;return o(s)&&o(i)&&(n.headers[z3]=i),e({...r,request:n})},Hoe={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},Goe=t=>({applyToStack:e=>{e.add(zoe(t),Hoe)}});function qoe(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}const Woe=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),LD=t=>Woe.test(t)||t.startsWith("[")&&t.endsWith("]"),Koe=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),KC=(t,e=!1)=>{if(!e)return Koe.test(t);const r=t.split(".");for(const n of r)if(!KC(n))return!1;return!0},k0={},hp="endpoints";function Ma(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Ma(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Ma).join(", ")})`:JSON.stringify(t,null,2)}class $n extends Error{constructor(e){super(e),this.name="EndpointError"}}const Qoe=(t,e)=>t===e,Yoe=t=>{const e=t.split("."),r=[];for(const n of e){const s=n.indexOf("[");if(s!==-1){if(n.indexOf("]")!==n.length-1)throw new $n(`Path: '${t}' does not end with ']'`);const i=n.slice(s+1,-1);if(Number.isNaN(parseInt(i)))throw new $n(`Invalid array index: '${i}' in path: '${t}'`);s!==0&&r.push(n.slice(0,s)),r.push(i)}else r.push(n)}return r},jD=(t,e)=>Yoe(e).reduce((r,n)=>{if(typeof r!="object")throw new $n(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t),Joe=t=>t!=null,Xoe=t=>!t,Gx={[dp.HTTP]:80,[dp.HTTPS]:443},Zoe=t=>{const e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){const{hostname:d,port:h,protocol:p="",path:y="",query:g={}}=t,m=new URL(`${p}//${d}${h?`:${h}`:""}${y}`);return m.search=Object.entries(g).map(([x,b])=>`${x}=${b}`).join("&"),m}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;const r=e.href,{host:n,hostname:s,pathname:i,protocol:o,search:a}=e;if(a)return null;const c=o.slice(0,-1);if(!Object.values(dp).includes(c))return null;const l=LD(s),u=r.includes(`${n}:${Gx[c]}`)||typeof t=="string"&&t.includes(`${n}:${Gx[c]}`),f=`${n}${u?`:${Gx[c]}`:""}`;return{scheme:c,authority:f,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}},eae=(t,e)=>t===e,tae=(t,e,r,n)=>e>=r||t.lengthencodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),nae={booleanEquals:Qoe,getAttr:jD,isSet:Joe,isValidHostLabel:KC,not:Xoe,parseURL:Zoe,stringEquals:eae,substring:tae,uriEncode:rae},BD=(t,e)=>{const r=[],n={...e.endpointParams,...e.referenceRecord};let s=0;for(;s({...e.endpointParams,...e.referenceRecord})[t],rg=(t,e,r)=>{if(typeof t=="string")return BD(t,r);if(t.fn)return FD(t,r);if(t.ref)return sae(t,r);throw new $n(`'${e}': ${String(t)} is not a string, function or reference.`)},FD=({fn:t,argv:e},r)=>{const n=e.map(i=>["boolean","number"].includes(typeof i)?i:rg(i,"arg",r)),s=t.split(".");return s[0]in k0&&s[1]!=null?k0[s[0]][s[1]](...n):nae[t](...n)},iae=({assign:t,...e},r)=>{var s,i;if(t&&t in r.referenceRecord)throw new $n(`'${t}' is already defined in Reference Record.`);const n=FD(e,r);return(i=(s=r.logger)==null?void 0:s.debug)==null||i.call(s,`${hp} evaluateCondition: ${Ma(e)} = ${Ma(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}},QC=(t=[],e)=>{var n,s;const r={};for(const i of t){const{result:o,toAssign:a}=iae(i,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};a&&(r[a.name]=a.value,(s=(n=e.logger)==null?void 0:n.debug)==null||s.call(n,`${hp} assign: ${a.name} := ${Ma(a.value)}`))}return{result:!0,referenceRecord:r}},oae=(t,e)=>Object.entries(t).reduce((r,[n,s])=>({...r,[n]:s.map(i=>{const o=rg(i,"Header value entry",e);if(typeof o!="string")throw new $n(`Header '${n}' value '${o}' is not a string`);return o})}),{}),UD=(t,e)=>{if(Array.isArray(t))return t.map(r=>UD(r,e));switch(typeof t){case"string":return BD(t,e);case"object":if(t===null)throw new $n(`Unexpected endpoint property: ${t}`);return VD(t,e);case"boolean":return t;default:throw new $n(`Unexpected endpoint property type: ${typeof t}`)}},VD=(t,e)=>Object.entries(t).reduce((r,[n,s])=>({...r,[n]:UD(s,e)}),{}),aae=(t,e)=>{const r=rg(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new $n(`Endpoint URL must be a string, got ${typeof r}`)},cae=(t,e)=>{var u,f;const{conditions:r,endpoint:n}=t,{result:s,referenceRecord:i}=QC(r,e);if(!s)return;const o={...e,referenceRecord:{...e.referenceRecord,...i}},{url:a,properties:c,headers:l}=n;return(f=(u=e.logger)==null?void 0:u.debug)==null||f.call(u,`${hp} Resolving endpoint from template: ${Ma(n)}`),{...l!=null&&{headers:oae(l,o)},...c!=null&&{properties:VD(c,o)},url:aae(a,o)}},lae=(t,e)=>{const{conditions:r,error:n}=t,{result:s,referenceRecord:i}=QC(r,e);if(s)throw new $n(rg(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))},uae=(t,e)=>{const{conditions:r,rules:n}=t,{result:s,referenceRecord:i}=QC(r,e);if(s)return $D(n,{...e,referenceRecord:{...e.referenceRecord,...i}})},$D=(t,e)=>{for(const r of t)if(r.type==="endpoint"){const n=cae(r,e);if(n)return n}else if(r.type==="error")lae(r,e);else if(r.type==="tree"){const n=uae(r,e);if(n)return n}else throw new $n(`Unknown endpoint rule: ${r}`);throw new $n("Rules evaluation failed")},fae=(t,e)=>{var l,u,f,d;const{endpointParams:r,logger:n}=e,{parameters:s,rules:i}=t;(u=(l=e.logger)==null?void 0:l.debug)==null||u.call(l,`${hp} Initial EndpointParams: ${Ma(r)}`);const o=Object.entries(s).filter(([,h])=>h.default!=null).map(([h,p])=>[h,p.default]);if(o.length>0)for(const[h,p]of o)r[h]=r[h]??p;const a=Object.entries(s).filter(([,h])=>h.required).map(([h])=>h);for(const h of a)if(r[h]==null)throw new $n(`Missing required parameter: '${h}'`);const c=$D(i,{endpointParams:r,logger:n,referenceRecord:{}});return(d=(f=e.logger)==null?void 0:f.debug)==null||d.call(f,`${hp} Resolved endpoint: ${Ma(c)}`),c},zD=(t,e=!1)=>{if(e){for(const r of t.split("."))if(!zD(r))return!1;return!0}return!(!KC(t)||t.length<3||t.length>63||t!==t.toLowerCase()||LD(t))},H3=":",dae="/",hae=t=>{const e=t.split(H3);if(e.length<6)return null;const[r,n,s,i,o,...a]=e;if(r!=="arn"||n===""||s===""||a.join(H3)==="")return null;const c=a.map(l=>l.split(dae)).flat();return{partition:n,service:s,region:i,accountId:o,resourceId:c}},pae=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],yae="1.1",vae={partitions:pae,version:yae};let mae=vae;const gae=t=>{const{partitions:e}=mae;for(const n of e){const{regions:s,outputs:i}=n;for(const[o,a]of Object.entries(s))if(o===t)return{...i,...a}}for(const n of e){const{regionRegex:s,outputs:i}=n;if(new RegExp(s).test(t))return{...i}}const r=e.find(n=>n.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},HD={isVirtualHostableS3Bucket:zD,parseArn:hae,partition:gae};k0.aws=HD;const G3="user-agent",qx="x-amz-user-agent",q3=" ",Wx="/",xae=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,bae=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,W3="-",wae=t=>(e,r)=>async n=>{var f,d;const{request:s}=n;if(!Vn.isInstance(s))return e(n);const{headers:i}=s,o=((f=r==null?void 0:r.userAgent)==null?void 0:f.map(Kx))||[],a=(await t.defaultUserAgentProvider()).map(Kx),c=((d=t==null?void 0:t.customUserAgent)==null?void 0:d.map(Kx))||[],l=[].concat([...a,...o,...c]).join(q3),u=[...a.filter(h=>h.startsWith("aws-sdk-")),...c].join(q3);return t.runtime!=="browser"?(u&&(i[qx]=i[qx]?`${i[G3]} ${u}`:u),i[G3]=l):i[qx]=l,e({...n,request:s})},Kx=t=>{var o;const e=t[0].split(Wx).map(a=>a.replace(xae,W3)).join(Wx),r=(o=t[1])==null?void 0:o.replace(bae,W3),n=e.indexOf(Wx),s=e.substring(0,n);let i=e.substring(n+1);return s==="api"&&(i=i.toLowerCase()),[s,i,r].filter(a=>a&&a.length>0).reduce((a,c,l)=>{switch(l){case 0:return c;case 1:return`${a}/${c}`;default:return`${a}#${c}`}},"")},Eae={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Sae=t=>({applyToStack:e=>{e.add(wae(t),Eae)}});var K3;(function(t){t.ENV="env",t.CONFIG="shared config entry"})(K3||(K3={}));const Cae=!1,Aae=!1,ng=t=>t[O2]||(t[O2]={}),Aa=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e},GD=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips")),Q3=t=>GD(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t,kae=t=>{const{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return Q3(e);const n=await e();return Q3(n)},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return GD(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}};function Tae(t){const e=new Map;for(const r of t)e.set(r.schemeId,r);return e}const Pae=(t,e)=>(r,n)=>async s=>{var l;const i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,s.input)),o=Tae(t.httpAuthSchemes),a=ng(n),c=[];for(const u of i){const f=o.get(u.schemeId);if(!f){c.push(`HttpAuthScheme \`${u.schemeId}\` was not enabled for this service.`);continue}const d=f.identityProvider(await e.identityProviderConfigProvider(t));if(!d){c.push(`HttpAuthScheme \`${u.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:h={},signingProperties:p={}}=((l=u.propertiesExtractor)==null?void 0:l.call(u,t,n))||{};u.identityProperties=Object.assign(u.identityProperties||{},h),u.signingProperties=Object.assign(u.signingProperties||{},p),a.selectedHttpAuthScheme={httpAuthOption:u,identity:await d(u.identityProperties),signer:f.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join(` -`));return r(s)},Rae=async t=>{const e=(t==null?void 0:t.Bucket)||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Mae(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Nae(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},Iae=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Oae=/(\d+\.){3}\d+/,_ae=/\.\./,Nae=t=>Iae.test(t)&&!Oae.test(t)&&!_ae.test(t),Mae=t=>{const[e,r,n,,,s]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,o=!!(i&&r&&n&&s);if(i&&!o)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return o},Dae=(t,e,r)=>{const n=async()=>{const s=r[t]??r[e];return typeof s=="function"?s():s};return t==="credentialScope"||e==="CredentialScope"?async()=>{const s=typeof r.credentials=="function"?await r.credentials():r.credentials;return(s==null?void 0:s.credentialScope)??(s==null?void 0:s.CredentialScope)}:t==="accountId"||e==="AccountId"?async()=>{const s=typeof r.credentials=="function"?await r.credentials():r.credentials;return(s==null?void 0:s.accountId)??(s==null?void 0:s.AccountId)}:t==="endpoint"||e==="endpoint"?async()=>{const s=await n();if(s&&typeof s=="object"){if("url"in s)return s.url.href;if("hostname"in s){const{protocol:i,hostname:o,port:a,path:c}=s;return`${i}//${o}${a?":"+a:""}${c}`}}return s}:n},qD=async t=>{};function Lae(t){const e={};if(t=t.replace(/^\?/,""),t)for(const r of t.split("&")){let[n,s=null]=r.split("=");n=decodeURIComponent(n),s&&(s=decodeURIComponent(s)),n in e?Array.isArray(e[n])?e[n].push(s):e[n]=[e[n],s]:e[n]=s}return e}const T0=t=>{if(typeof t=="string")return T0(new URL(t));const{hostname:e,pathname:r,port:n,protocol:s,search:i}=t;let o;return i&&(o=Lae(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:s,path:r,query:o}},WD=t=>typeof t=="object"?"url"in t?T0(t.url):t:T0(t),jae=async(t,e,r,n)=>{if(!r.endpoint){let o;r.serviceConfiguredEndpoint?o=await r.serviceConfiguredEndpoint():o=await qD(r.serviceId),o&&(r.endpoint=()=>Promise.resolve(WD(o)))}const s=await Bae(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(s,n)},Bae=async(t,e,r)=>{var i;const n={},s=((i=e==null?void 0:e.getEndpointParameterInstructions)==null?void 0:i.call(e))||{};for(const[o,a]of Object.entries(s))switch(a.type){case"staticContextParams":n[o]=a.value;break;case"contextParams":n[o]=t[a.name];break;case"clientContextParams":case"builtInParams":n[o]=await Dae(a.name,o,r)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(a))}return Object.keys(s).length===0&&Object.assign(n,r),String(r.serviceId).toLowerCase()==="s3"&&await Rae(n),n},Fae=({config:t,instructions:e})=>(r,n)=>async s=>{var a,c,l;const i=await jae(s.input,{getEndpointParameterInstructions(){return e}},{...t},n);n.endpointV2=i,n.authSchemes=(a=i.properties)==null?void 0:a.authSchemes;const o=(c=n.authSchemes)==null?void 0:c[0];if(o){n.signing_region=o.signingRegion,n.signing_service=o.signingName;const u=ng(n),f=(l=u==null?void 0:u.selectedHttpAuthScheme)==null?void 0:l.httpAuthOption;f&&(f.signingProperties=Object.assign(f.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return r({...s})},Uae=(t,e)=>r=>async n=>{const{response:s}=await r(n);try{const i=await e(s,t);return{response:s,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:s}),!("$metadata"in i)){const o="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";i.message+=` - `+o,typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText)}throw i}},Vae=(t,e)=>(r,n)=>async s=>{var a;const i=(a=n.endpointV2)!=null&&a.url&&t.urlParser?async()=>t.urlParser(n.endpointV2.url):t.endpoint;if(!i)throw new Error("No valid endpoint provider available.");const o=await e(s.input,{...t,endpoint:i});return r({...s,request:o})},$ae={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},YC={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function JC(t,e,r){return{applyToStack:n=>{n.add(Uae(t,r),$ae),n.add(Vae(t,e),YC)}}}const KD={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:YC.name},XC=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Fae({config:t,instructions:e}),KD)}}),zae=t=>{const e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>WD(await Aa(r)()):void 0,i={...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:Aa(t.useDualstackEndpoint??!1),useFipsEndpoint:Aa(t.useFipsEndpoint??!1)};let o;return i.serviceConfiguredEndpoint=async()=>(t.serviceId&&!o&&(o=qD(t.serviceId)),o),i},Hae={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:KD.name},Gae=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(Pae(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Hae)}});YC.name;const qae=t=>e=>{throw e},Wae=(t,e)=>{},Kae=t=>(e,r)=>async n=>{if(!Vn.isInstance(n.request))return e(n);const i=ng(r).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:o={}},identity:a,signer:c}=i,l=await e({...n,request:await c.sign(n.request,a,o)}).catch((c.errorHandler||qae)(o));return(c.successHandler||Wae)(l.response,o),l};var Zf;(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Zf||(Zf={}));const P0=3,Qae=Zf.STANDARD,Yae=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Jae=["TimeoutError","RequestTimeout","RequestTimeoutException"],Xae=[500,502,503,504],Zae=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],ece=t=>{var e;return(e=t.$metadata)==null?void 0:e.clockSkewCorrected},QD=t=>{var e,r;return((e=t.$metadata)==null?void 0:e.httpStatusCode)===429||Yae.includes(t.name)||((r=t.$retryable)==null?void 0:r.throttling)==!0},YD=t=>{var e;return ece(t)||Jae.includes(t.name)||Zae.includes((t==null?void 0:t.code)||"")||Xae.includes(((e=t.$metadata)==null?void 0:e.httpStatusCode)||0)},tce=t=>{var e;if(((e=t.$metadata)==null?void 0:e.httpStatusCode)!==void 0){const r=t.$metadata.httpStatusCode;return 500<=r&&r<=599&&!YD(t)}return!1};class rce{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=(e==null?void 0:e.beta)??.7,this.minCapacity=(e==null?void 0:e.minCapacity)??1,this.minFillRate=(e==null?void 0:e.minFillRate)??.5,this.scaleConstant=(e==null?void 0:e.scaleConstant)??.4,this.smooth=(e==null?void 0:e.smooth)??.8;const r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(n=>setTimeout(n,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),QD(e)){const s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){const n=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}const _2=100,JD=20*1e3,nce=500,Y3=500,sce=5,ice=10,oce=1,ace="amz-sdk-invocation-id",cce="amz-sdk-request",lce=()=>{let t=_2;return{computeNextBackoffDelay:n=>Math.floor(Math.min(JD,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}},J3=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(JD,t),getRetryCost:()=>r});class XD{constructor(e){this.maxAttempts=e,this.mode=Zf.STANDARD,this.capacity=Y3,this.retryBackoffStrategy=lce(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return J3({retryDelay:_2,retryCount:0})}async refreshRetryTokenForRetry(e,r){const n=await this.getMaxAttempts();if(this.shouldRetry(e,r,n)){const s=r.errorType;this.retryBackoffStrategy.setDelayBase(s==="THROTTLING"?nce:_2);const i=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),o=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,i):i,a=this.getCapacityCost(s);return this.capacity-=a,J3({retryDelay:o,retryCount:e.getRetryCount()+1,retryCost:a})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(Y3,this.capacity+(e.getRetryCost()??oce))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${P0}`),P0}}shouldRetry(e,r,n){return e.getRetryCount()+1=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?ice:sce}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class uce{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Zf.ADAPTIVE;const{rateLimiter:n}=r??{};this.rateLimiter=n??new rce,this.standardRetryStrategy=new XD(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}let C1;const fce=new Uint8Array(16);function dce(){if(!C1&&(C1=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!C1))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return C1(fce)}const pr=[];for(let t=0;t<256;++t)pr.push((t+256).toString(16).slice(1));function hce(t,e=0){return pr[t[e+0]]+pr[t[e+1]]+pr[t[e+2]]+pr[t[e+3]]+"-"+pr[t[e+4]]+pr[t[e+5]]+"-"+pr[t[e+6]]+pr[t[e+7]]+"-"+pr[t[e+8]]+pr[t[e+9]]+"-"+pr[t[e+10]]+pr[t[e+11]]+pr[t[e+12]]+pr[t[e+13]]+pr[t[e+14]]+pr[t[e+15]]}const pce=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),X3={randomUUID:pce};function yce(t,e,r){if(X3.randomUUID&&!e&&!t)return X3.randomUUID();t=t||{};const n=t.random||(t.rng||dce)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let s=0;s<16;++s)e[r+s]=n[s];return e}return hce(n)}const vce=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`),mce=t=>{const{retryStrategy:e}=t,r=Aa(t.maxAttempts??P0);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await Aa(t.retryMode)()===Zf.ADAPTIVE?new uce(r):new XD(r))}};class ZD{trace(){}debug(){}info(){}warn(){}error(){}}const Za=(t,e)=>{const r=[];if(t&&r.push(t),e)for(const n of e)r.push(n);return r},No=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,R0=()=>{let t=[],e=[],r=!1;const n=new Set,s=f=>f.sort((d,h)=>Z3[h.step]-Z3[d.step]||e8[h.priority||"normal"]-e8[d.priority||"normal"]),i=f=>{let d=!1;const h=p=>{const y=Za(p.name,p.aliases);if(y.includes(f)){d=!0;for(const g of y)n.delete(g);return!1}return!0};return t=t.filter(h),e=e.filter(h),d},o=f=>{let d=!1;const h=p=>{if(p.middleware===f){d=!0;for(const y of Za(p.name,p.aliases))n.delete(y);return!1}return!0};return t=t.filter(h),e=e.filter(h),d},a=f=>{var d;return t.forEach(h=>{f.add(h.middleware,{...h})}),e.forEach(h=>{f.addRelativeTo(h.middleware,{...h})}),(d=f.identifyOnResolve)==null||d.call(f,u.identifyOnResolve()),f},c=f=>{const d=[];return f.before.forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...c(h))}),d.push(f),f.after.reverse().forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...c(h))}),d},l=(f=!1)=>{const d=[],h=[],p={};return t.forEach(g=>{const m={...g,before:[],after:[]};for(const x of Za(m.name,m.aliases))p[x]=m;d.push(m)}),e.forEach(g=>{const m={...g,before:[],after:[]};for(const x of Za(m.name,m.aliases))p[x]=m;h.push(m)}),h.forEach(g=>{if(g.toMiddleware){const m=p[g.toMiddleware];if(m===void 0){if(f)return;throw new Error(`${g.toMiddleware} is not found when adding ${No(g.name,g.aliases)} middleware ${g.relation} ${g.toMiddleware}`)}g.relation==="after"&&m.after.push(g),g.relation==="before"&&m.before.push(g)}}),s(d).map(c).reduce((g,m)=>(g.push(...m),g),[])},u={add:(f,d={})=>{const{name:h,override:p,aliases:y}=d,g={step:"initialize",priority:"normal",middleware:f,...d},m=Za(h,y);if(m.length>0){if(m.some(x=>n.has(x))){if(!p)throw new Error(`Duplicate middleware name '${No(h,y)}'`);for(const x of m){const b=t.findIndex(A=>{var O;return A.name===x||((O=A.aliases)==null?void 0:O.some(_=>_===x))});if(b===-1)continue;const w=t[b];if(w.step!==g.step||g.priority!==w.priority)throw new Error(`"${No(w.name,w.aliases)}" middleware with ${w.priority} priority in ${w.step} step cannot be overridden by "${No(h,y)}" middleware with ${g.priority} priority in ${g.step} step.`);t.splice(b,1)}}for(const x of m)n.add(x)}t.push(g)},addRelativeTo:(f,d)=>{const{name:h,override:p,aliases:y}=d,g={middleware:f,...d},m=Za(h,y);if(m.length>0){if(m.some(x=>n.has(x))){if(!p)throw new Error(`Duplicate middleware name '${No(h,y)}'`);for(const x of m){const b=e.findIndex(A=>{var O;return A.name===x||((O=A.aliases)==null?void 0:O.some(_=>_===x))});if(b===-1)continue;const w=e[b];if(w.toMiddleware!==g.toMiddleware||w.relation!==g.relation)throw new Error(`"${No(w.name,w.aliases)}" middleware ${w.relation} "${w.toMiddleware}" middleware cannot be overridden by "${No(h,y)}" middleware ${g.relation} "${g.toMiddleware}" middleware.`);e.splice(b,1)}}for(const x of m)n.add(x)}e.push(g)},clone:()=>a(R0()),use:f=>{f.applyToStack(u)},remove:f=>typeof f=="string"?i(f):o(f),removeByTag:f=>{let d=!1;const h=p=>{const{tags:y,name:g,aliases:m}=p;if(y&&y.includes(f)){const x=Za(g,m);for(const b of x)n.delete(b);return d=!0,!1}return!0};return t=t.filter(h),e=e.filter(h),d},concat:f=>{var h;const d=a(R0());return d.use(f),d.identifyOnResolve(r||d.identifyOnResolve()||(((h=f.identifyOnResolve)==null?void 0:h.call(f))??!1)),d},applyToStack:a,identify:()=>l(!0).map(f=>{const d=f.step??f.relation+" "+f.toMiddleware;return No(f.name,f.aliases)+" - "+d}),identifyOnResolve(f){return typeof f=="boolean"&&(r=f),r},resolve:(f,d)=>{for(const h of l().map(p=>p.middleware).reverse())f=h(f,d);return r&&console.log(u.identify()),f}};return u},Z3={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},e8={high:3,normal:2,low:1};class gce{constructor(e){this.config=e,this.middlewareStack=R0()}send(e,r,n){const s=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,o=s===void 0&&this.config.cacheMiddleware===!0;let a;if(o){this.handlers||(this.handlers=new WeakMap);const c=this.handlers;c.has(e.constructor)?a=c.get(e.constructor):(a=e.resolveMiddleware(this.middlewareStack,this.config,s),c.set(e.constructor,a))}else delete this.handlers,a=e.resolveMiddleware(this.middlewareStack,this.config,s);if(i)a(e).then(c=>i(null,c.output),c=>i(c)).catch(()=>{});else return a(e).then(c=>c.output)}destroy(){var e,r,n;(n=(r=(e=this.config)==null?void 0:e.requestHandler)==null?void 0:r.destroy)==null||n.call(r),delete this.handlers}}const Da={},md=new Array(64);for(let t=0,e="A".charCodeAt(0),r="Z".charCodeAt(0);t+e<=r;t++){const n=String.fromCharCode(t+e);Da[n]=t,md[t]=n}for(let t=0,e="a".charCodeAt(0),r="z".charCodeAt(0);t+e<=r;t++){const n=String.fromCharCode(t+e),s=t+26;Da[n]=s,md[s]=n}for(let t=0;t<10;t++){Da[t.toString(10)]=t+52;const e=t.toString(10),r=t+52;Da[e]=r,md[r]=e}Da["+"]=62;md[62]="+";Da["/"]=63;md[63]="/";const Du=6,wh=8,xce=63,ZC=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;const r=new ArrayBuffer(e),n=new DataView(r);for(let s=0;s>=Du;const a=s/4*3;i>>=o%wh;const c=Math.floor(o/wh);for(let l=0;l>u)}}return new Uint8Array(r)},ed=t=>new TextEncoder().encode(t),Eh=t=>typeof t=="string"?ed(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),eL=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)};function tL(t){let e;typeof t=="string"?e=ed(t):e=t;const r=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let s="";for(let i=0;i>u]}s+="==".slice(0,4-c)}return s}function bce(t,e="utf-8"){return e==="base64"?tL(t):eL(t)}function wce(t,e){return e==="base64"?nl.mutate(ZC(t)):nl.mutate(ed(t))}class nl extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return wce(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,nl.prototype),e}transformToString(e="utf-8"){return bce(this,e)}}const fa=t=>encodeURIComponent(t).replace(/[!'()*]/g,Ece),Ece=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`;function Sce(t){const e=[];for(let r of Object.keys(t).sort()){const n=t[r];if(r=fa(r),Array.isArray(n))for(let s=0,i=n.length;s{t&&setTimeout(()=>{const n=new Error(`Request did not complete within ${t} ms`);n.name="TimeoutError",r(n)},t)})}const Qx={supported:void 0};class eA{static create(e){return typeof(e==null?void 0:e.handle)=="function"?e:new eA(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),Qx.supported===void 0&&(Qx.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);const n=this.config.requestTimeout,s=this.config.keepAlive===!0,i=this.config.credentials;if(r!=null&&r.aborted){const m=new Error("Request aborted");return m.name="AbortError",Promise.reject(m)}let o=e.path;const a=Sce(e.query||{});a&&(o+=`?${a}`),e.fragment&&(o+=`#${e.fragment}`);let c="";if(e.username!=null||e.password!=null){const m=e.username??"",x=e.password??"";c=`${m}:${x}@`}const{port:l,method:u}=e,f=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:""}${o}`,d=u==="GET"||u==="HEAD"?void 0:e.body,h={body:d,headers:new Headers(e.headers),method:u,credentials:i};d&&(h.duplex="half"),typeof AbortController<"u"&&(h.signal=r),Qx.supported&&(h.keepalive=s);let p=()=>{};const y=new Request(f,h),g=[fetch(y).then(m=>{const x=m.headers,b={};for(const A of x.entries())b[A[0]]=A[1];return m.body!=null?{response:new A0({headers:b,reason:m.statusText,statusCode:m.status,body:m.body})}:m.blob().then(A=>({response:new A0({headers:b,reason:m.statusText,statusCode:m.status,body:A})}))}),Cce(n)];return r&&g.push(new Promise((m,x)=>{const b=()=>{const w=new Error("Request aborted");w.name="AbortError",x(w)};if(typeof r.addEventListener=="function"){const w=r;w.addEventListener("abort",b,{once:!0}),p=()=>w.removeEventListener("abort",b)}else r.onabort=b})),Promise.race(g).finally(p)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}const Ace=t=>typeof Blob=="function"&&t instanceof Blob?kce(t):Tce(t);async function kce(t){const e=await Pce(t),r=ZC(e);return new Uint8Array(r)}async function Tce(t){const e=[],r=t.getReader();let n=!1,s=0;for(;!n;){const{done:a,value:c}=await r.read();c&&(e.push(c),s+=c.length),n=a}const i=new Uint8Array(s);let o=0;for(const a of e)i.set(a,o),o+=a.length;return i}function Pce(t){return new Promise((e,r)=>{const n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return r(new Error("Reader aborted too early"));const s=n.result??"",i=s.indexOf(","),o=i>-1?i+1:s.length;e(s.substring(o))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}const rL={},N2={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),rL[t]=e,N2[e]=t}function Rce(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(t.length/2);for(let r=0;r{if(t instanceof Uint8Array)return nl.mutate(t);if(!t)return nl.mutate(new Uint8Array);const r=e.streamCollector(t);return nl.mutate(await r)};class sg{constructor(){this.middlewareStack=R0()}static classBuilder(){return new Oce}resolveMiddlewareWithContext(e,r,n,{middlewareFn:s,clientName:i,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:l,additionalContext:u,CommandCtor:f}){for(const g of s.bind(this)(f,e,r,n))this.middlewareStack.use(g);const d=e.concat(this.middlewareStack),{logger:h}=r,p={logger:h,clientName:i,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[O2]:{commandInstance:this,...l},...u},{requestHandler:y}=r;return d.resolve(g=>y.handle(g.request,n||{}),p)}}class Oce{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,n={}){return this._smithyContext={service:e,operation:r,...n},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=n=>n,r=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let r;return r=class extends sg{static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=n??{},e._init(this)}resolveMiddleware(n,s,i){return this.resolveMiddlewareWithContext(n,s,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}const ur="***SensitiveInformation***";class tA extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,tA.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const Ne=(t,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,s])=>{(t[n]==null||t[n]==="")&&(t[n]=s)});const r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t},_ce=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{const s=Mce(t),i=s.httpStatusCode?s.httpStatusCode+"":void 0,o=new r({name:(e==null?void 0:e.code)||(e==null?void 0:e.Code)||n||i||"UnknownError",$fault:"client",$metadata:s});throw Ne(o,e)},Nce=t=>({output:e,parsedBody:r,errorCode:n})=>{_ce({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},Mce=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),Dce=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},Lce=t=>{const e=[];for(const r in C0){const n=C0[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},jce=t=>{const e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},Bce=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},Fce=t=>{const e={};return e.retryStrategy=t.retryStrategy(),e},Uce=t=>({...Lce(t),...Bce(t)}),Vce=t=>({...jce(t),...Fce(t)}),M2=function(){const t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};M2.prototype=Object.create(String.prototype,{constructor:{value:M2,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(M2,String);const Ce=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(Ce);if(typeof t=="object"){const e={};for(const r of Object.keys(t))t[r]!=null&&(e[r]=Ce(t[r]));return e}return t},$ce=t=>(t==null?void 0:t.body)instanceof ReadableStream,zce=t=>(e,r)=>async n=>{var o;let s=await t.retryStrategy();const i=await t.maxAttempts();if(Hce(s)){s=s;let a=await s.acquireInitialRetryToken(r.partition_id),c=new Error,l=0,u=0;const{request:f}=n,d=Vn.isInstance(f);for(d&&(f.headers[ace]=yce());;)try{d&&(f.headers[cce]=`attempt=${l+1}; max=${i}`);const{response:h,output:p}=await e(n);return s.recordSuccess(a),p.$metadata.attempts=l+1,p.$metadata.totalRetryDelay=u,{response:h,output:p}}catch(h){const p=Gce(h);if(c=vce(h),d&&$ce(f))throw(o=r.logger instanceof ZD?console:r.logger)==null||o.warn("An error was encountered in a non-retryable streaming request."),c;try{a=await s.refreshRetryTokenForRetry(a,p)}catch{throw c.$metadata||(c.$metadata={}),c.$metadata.attempts=l+1,c.$metadata.totalRetryDelay=u,c}l=a.getRetryCount();const y=a.getRetryDelay();u+=y,await new Promise(g=>setTimeout(g,y))}}else return s=s,s!=null&&s.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",s.mode]]),s.retry(e,n)},Hce=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",Gce=t=>{const e={error:t,errorType:qce(t)},r=Kce(t.$response);return r&&(e.retryAfterHint=r),e},qce=t=>QD(t)?"THROTTLING":YD(t)?"TRANSIENT":tce(t)?"SERVER_ERROR":"CLIENT_ERROR",nL={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Wce=t=>({applyToStack:e=>{e.add(zce(t),nL)}}),Kce=t=>{if(!A0.isInstance(t))return;const e=Object.keys(t.headers).find(i=>i.toLowerCase()==="retry-after");if(!e)return;const r=t.headers[e],n=Number(r);return Number.isNaN(n)?new Date(r):new Date(n*1e3)},Qce={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:nL.name},Yce=t=>({applyToStack:e=>{e.addRelativeTo(Kae(),Qce)}});class Jce{constructor(e){this.authSchemes=new Map;for(const[r,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(r,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}class Xce{async sign(e,r,n){return e}}const Zce=t=>e=>sL(e)&&e.expiration.getTime()-Date.now()t.expiration!==void 0,rle=(t,e,r)=>{if(t===void 0)return;const n=typeof t!="function"?async()=>Promise.resolve(t):t;let s,i,o,a=!1;const c=async l=>{i||(i=n(l));try{s=await i,o=!0,a=!1}finally{i=void 0}return s};return e===void 0?async l=>((!o||l!=null&&l.forceRefresh)&&(s=await c(l)),s):async l=>((!o||l!=null&&l.forceRefresh)&&(s=await c(l)),a?s:r(s)?(e(s)&&await c(l),s):(a=!0,s))},A1=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e},t8="content-length";function nle(t){return e=>async r=>{const n=r.request;if(Vn.isInstance(n)){const{body:s,headers:i}=n;if(s&&Object.keys(i).map(o=>o.toLowerCase()).indexOf(t8)===-1)try{const o=t(s);n.headers={...n.headers,[t8]:String(o)}}catch{}}return e({...r,request:n})}}const sle={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},ile=t=>({applyToStack:e=>{e.add(nle(t.bodyLengthChecker),sle)}}),r8=t=>{var e,r;return A0.isInstance(t)?((e=t.headers)==null?void 0:e.date)??((r=t.headers)==null?void 0:r.Date):void 0},iL=t=>new Date(Date.now()+t),ole=(t,e)=>Math.abs(iL(e).getTime()-t)>=3e5,n8=(t,e)=>{const r=Date.parse(t);return ole(r,e)?r-Date.now():e},Sh=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},ale=async t=>{var l,u,f;const e=Sh("context",t.context),r=Sh("config",t.config),n=(f=(u=(l=e.endpointV2)==null?void 0:l.properties)==null?void 0:u.authSchemes)==null?void 0:f[0],i=await Sh("signer",r.signer)(n),o=t==null?void 0:t.signingRegion,a=t==null?void 0:t.signingRegionSet,c=t==null?void 0:t.signingName;return{config:r,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}};class cle{async sign(e,r,n){var f;if(!Vn.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const s=await ale(n),{config:i,signer:o}=s;let{signingRegion:a,signingName:c}=s;const l=n.context;if(((f=l==null?void 0:l.authSchemes)==null?void 0:f.length)??0>1){const[d,h]=l.authSchemes;(d==null?void 0:d.name)==="sigv4a"&&(h==null?void 0:h.name)==="sigv4"&&(a=(h==null?void 0:h.signingRegion)??a,c=(h==null?void 0:h.signingName)??c)}return await o.sign(e,{signingDate:iL(i.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return r=>{const n=r.ServerTime??r8(r.$response);if(n){const s=Sh("config",e.config),i=s.systemClockOffset;s.systemClockOffset=n8(n,s.systemClockOffset),s.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){const n=r8(e);if(n){const s=Sh("config",r.config);s.systemClockOffset=n8(n,s.systemClockOffset)}}}const lle=(t,e,r)=>{let n,s,i,o=!1;const a=async()=>{s||(s=t());try{n=await s,i=!0,o=!1}finally{s=void 0}return n};return e===void 0?async c=>((!i||c!=null&&c.forceRefresh)&&(n=await a()),n):async c=>((!i||c!=null&&c.forceRefresh)&&(n=await a()),o?n:r&&!r(n)?(o=!0,n):(e(n)&&await a(),n))},ule="X-Amz-Algorithm",fle="X-Amz-Credential",oL="X-Amz-Date",dle="X-Amz-SignedHeaders",hle="X-Amz-Expires",aL="X-Amz-Signature",cL="X-Amz-Security-Token",lL="authorization",uL=oL.toLowerCase(),ple="date",yle=[lL,uL,ple],vle=aL.toLowerCase(),D2="x-amz-content-sha256",mle=cL.toLowerCase(),gle={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},xle=/^proxy-/,ble=/^sec-/,Yx="AWS4-HMAC-SHA256",wle="AWS4-HMAC-SHA256-PAYLOAD",Ele="UNSIGNED-PAYLOAD",Sle=50,fL="aws4_request",Cle=60*60*24*7,k1={},Jx=[],Xx=(t,e,r)=>`${t}/${e}/${r}/${fL}`,Ale=async(t,e,r,n,s)=>{const i=await s8(t,e.secretAccessKey,e.accessKeyId),o=`${r}:${n}:${s}:${Cc(i)}:${e.sessionToken}`;if(o in k1)return k1[o];for(Jx.push(o);Jx.length>Sle;)delete k1[Jx.shift()];let a=`AWS4${e.secretAccessKey}`;for(const c of[r,n,s,fL])a=await s8(t,a,c);return k1[o]=a},s8=(t,e,r)=>{const n=new t(e);return n.update(Eh(r)),n.digest()},i8=({headers:t},e,r)=>{const n={};for(const s of Object.keys(t).sort()){if(t[s]==null)continue;const i=s.toLowerCase();(i in gle||e!=null&&e.has(i)||xle.test(i)||ble.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[s].trim().replace(/\s+/g," "))}return n},kle=({query:t={}})=>{const e=[],r={};for(const n of Object.keys(t).sort()){if(n.toLowerCase()===vle)continue;e.push(n);const s=t[n];typeof s=="string"?r[n]=`${fa(n)}=${fa(s)}`:Array.isArray(s)&&(r[n]=s.slice(0).reduce((i,o)=>i.concat([`${fa(n)}=${fa(o)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")},Tle=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",Zx=async({headers:t,body:e},r)=>{for(const n of Object.keys(t))if(n.toLowerCase()===D2)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||Tle(e)){const n=new r;return n.update(Eh(e)),Cc(await n.digest())}return Ele};class Ple{format(e){const r=[];for(const i of Object.keys(e)){const o=ed(i);r.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(e[i]))}const n=new Uint8Array(r.reduce((i,o)=>i+o.byteLength,0));let s=0;for(const i of r)n.set(i,s),s+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(i.buffer);return o.set(e.value,3),o;case"string":const a=ed(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);const l=new Uint8Array(c.buffer);return l.set(a,3),l;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(rA.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!Rle.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(Rce(e.value.replace(/\-/g,"")),1),f}}}var o8;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(o8||(o8={}));const Rle=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class rA{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let n=7,s=Math.abs(Math.round(e));n>-1&&s>0;n--,s/=256)r[n]=s;return e<0&&a8(r),new rA(r)}valueOf(){const e=this.bytes.slice(0),r=e[0]&128;return r&&a8(e),parseInt(Cc(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}function a8(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}const Ile=(t,e)=>{t=t.toLowerCase();for(const r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1},Ole=(t,e={})=>{var s;const{headers:r,query:n={}}=Vn.clone(t);for(const i of Object.keys(r)){const o=i.toLowerCase();o.slice(0,6)==="x-amz-"&&!((s=e.unhoistableHeaders)!=null&&s.has(o))&&(n[i]=r[i],delete r[i])}return{...t,headers:r,query:n}},c8=t=>{t=Vn.clone(t);for(const e of Object.keys(t.headers))yle.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},_le=t=>Nle(t).toISOString().replace(/\.\d{3}Z$/,"Z"),Nle=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;class l8{constructor({applyChecksum:e,credentials:r,region:n,service:s,sha256:i,uriEscapePath:o=!0}){this.headerFormatter=new Ple,this.service=s,this.sha256=i,this.uriEscapePath=o,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Aa(n),this.credentialProvider=Aa(r)}async presign(e,r={}){const{signingDate:n=new Date,expiresIn:s=3600,unsignableHeaders:i,unhoistableHeaders:o,signableHeaders:a,signingRegion:c,signingService:l}=r,u=await this.credentialProvider();this.validateResolvedCredentials(u);const f=c??await this.regionProvider(),{longDate:d,shortDate:h}=T1(n);if(s>Cle)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const p=Xx(h,f,l??this.service),y=Ole(c8(e),{unhoistableHeaders:o});u.sessionToken&&(y.query[cL]=u.sessionToken),y.query[ule]=Yx,y.query[fle]=`${u.accessKeyId}/${p}`,y.query[oL]=d,y.query[hle]=s.toString(10);const g=i8(y,i,a);return y.query[dle]=u8(g),y.query[aL]=await this.getSignature(d,p,this.getSigningKey(u,f,h,l),this.createCanonicalRequest(y,g,await Zx(e,this.sha256))),y}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:s,signingRegion:i,signingService:o}){const a=i??await this.regionProvider(),{shortDate:c,longDate:l}=T1(n),u=Xx(c,a,o??this.service),f=await Zx({headers:{},body:r},this.sha256),d=new this.sha256;d.update(e);const h=Cc(await d.digest()),p=[wle,l,u,s,h,f].join(` -`);return this.signString(p,{signingDate:n,signingRegion:a,signingService:o})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:s}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:s,priorSignature:e.priorSignature}).then(o=>({message:e.message,signature:o}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:s}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const o=n??await this.regionProvider(),{shortDate:a}=T1(r),c=new this.sha256(await this.getSigningKey(i,o,a,s));return c.update(Eh(e)),Cc(await c.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:s,signingRegion:i,signingService:o}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const c=i??await this.regionProvider(),l=c8(e),{longDate:u,shortDate:f}=T1(r),d=Xx(f,c,o??this.service);l.headers[uL]=u,a.sessionToken&&(l.headers[mle]=a.sessionToken);const h=await Zx(l,this.sha256);!Ile(D2,l.headers)&&this.applyChecksum&&(l.headers[D2]=h);const p=i8(l,s,n),y=await this.getSignature(u,d,this.getSigningKey(a,c,f,o),this.createCanonicalRequest(l,p,h));return l.headers[lL]=`${Yx} Credential=${a.accessKeyId}/${d}, SignedHeaders=${u8(p)}, Signature=${y}`,l}createCanonicalRequest(e,r,n){const s=Object.keys(r).sort();return`${e.method} +`)!==S(this,Hp))throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);N(this,Kc,r)}return S(this,Kc)};const Bie="0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-EgSe0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-PM&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryFN Noc|PutQuirySSue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO",Fie="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60";let Dx=null;class Na extends jie{constructor(){super("en",Bie,Fie)}static wordlist(){return Dx==null&&(Dx=new Na),Dx}}function ED(t){return(1<=12&&r.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const n=new Uint8Array(Math.ceil(11*r.length/8));let s=0;for(let l=0;l=0,`invalid mnemonic word at index ${l}`,"mnemonic","[ REDACTED ]");for(let f=0;f<11;f++)u&1<<10-f&&(n[s>>3]|=1<<7-s%8),s++}const i=32*r.length/3,o=r.length/3,a=ED(o),c=fe(ys(n.slice(0,i/8)))[0]&a;return M(c===(n[n.length-1]&a),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),ne(n.slice(0,i/8))}function jx(t,e){M(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=Na.wordlist());const r=[0];let n=11;for(let o=0;o8?(r[r.length-1]<<=8,r[r.length-1]|=t[o],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[o]>>8-n,r.push(t[o]&Uie(8-n)),n+=3);const s=t.length/4,i=parseInt(ys(t).substring(2,4),16)&ED(s);return r[r.length-1]<<=s,r[r.length-1]|=i>>8-s,e.join(r.map(o=>e.getWord(o)))}const Bx={};class Yf{constructor(e,r,n,s,i){G(this,"phrase");G(this,"password");G(this,"wordlist");G(this,"entropy");s==null&&(s=""),i==null&&(i=Na.wordlist()),$a(e,Bx,"Mnemonic"),me(this,{phrase:n,password:s,wordlist:i,entropy:r})}computeSeed(){const e=Sr("mnemonic"+this.password,"NFKD");return za(Sr(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,r,n){const s=Lx(e,n);return e=jx(fe(s),n),new Yf(Bx,s,e,r,n)}static fromEntropy(e,r,n){const s=fe(e,"entropy"),i=jx(s,n);return new Yf(Bx,ne(s),i,r,n)}static entropyToPhrase(e,r){const n=fe(e,"entropy");return jx(n,r)}static phraseToEntropy(e,r){return Lx(e,r)}static isValidMnemonic(e,r){try{return Lx(e,r),!0}catch{}return!1}}/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */var hr=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Fx=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r},fv,Qn,Ks;const Vie={16:10,24:12,32:14},$ie=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Wn=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],E1=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],zie=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Hie=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Gie=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],qie=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Wie=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Kie=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Qie=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Yie=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Jie=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Xie=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Zie=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],eoe=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ux(t){const e=[];for(let r=0;r>2,hr(this,Ks,"f")[o][u%4]=i[u],hr(this,Qn,"f")[r-o][u%4]=i[u];let a=0,c=s,l;for(;c>16&255]<<24^Wn[l>>8&255]<<16^Wn[l&255]<<8^Wn[l>>24&255]^$ie[a]<<24,a+=1,s!=8)for(let h=1;h>8&255]<<8^Wn[l>>16&255]<<16^Wn[l>>24&255]<<24;for(let h=s/2+1;h>2,d=c%4,hr(this,Ks,"f")[f][d]=i[u],hr(this,Qn,"f")[r-f][d]=i[u++],c++}for(let u=1;u>24&255]^Xie[l>>16&255]^Zie[l>>8&255]^eoe[l&255]}encrypt(e){if(e.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const r=hr(this,Ks,"f").length-1,n=[0,0,0,0];let s=Ux(e);for(let a=0;a<4;a++)s[a]^=hr(this,Ks,"f")[0][a];for(let a=1;a>24&255]^Hie[s[(c+1)%4]>>16&255]^Gie[s[(c+2)%4]>>8&255]^qie[s[(c+3)%4]&255]^hr(this,Ks,"f")[a][c];s=n.slice()}const i=new Uint8Array(16);let o=0;for(let a=0;a<4;a++)o=hr(this,Ks,"f")[r][a],i[4*a]=(Wn[s[a]>>24&255]^o>>24)&255,i[4*a+1]=(Wn[s[(a+1)%4]>>16&255]^o>>16)&255,i[4*a+2]=(Wn[s[(a+2)%4]>>8&255]^o>>8)&255,i[4*a+3]=(Wn[s[(a+3)%4]&255]^o)&255;return i}decrypt(e){if(e.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const r=hr(this,Qn,"f").length-1,n=[0,0,0,0];let s=Ux(e);for(let a=0;a<4;a++)s[a]^=hr(this,Qn,"f")[0][a];for(let a=1;a>24&255]^Kie[s[(c+3)%4]>>16&255]^Qie[s[(c+2)%4]>>8&255]^Yie[s[(c+1)%4]&255]^hr(this,Qn,"f")[a][c];s=n.slice()}const i=new Uint8Array(16);let o=0;for(let a=0;a<4;a++)o=hr(this,Qn,"f")[r][a],i[4*a]=(E1[s[a]>>24&255]^o>>24)&255,i[4*a+1]=(E1[s[(a+3)%4]>>16&255]^o>>16)&255,i[4*a+2]=(E1[s[(a+2)%4]>>8&255]^o>>8)&255,i[4*a+3]=(E1[s[(a+1)%4]&255]^o)&255;return i}}fv=new WeakMap,Qn=new WeakMap,Ks=new WeakMap;class SD{constructor(e,r,n){if(n&&!(this instanceof n))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new zC(r)},name:{enumerable:!0,value:e}})}}var S1=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r},$l=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},rh,Oi;class HC extends SD{constructor(e,r){if(super("ECC",e,HC),rh.set(this,void 0),Oi.set(this,void 0),r){if(r.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");S1(this,rh,new Uint8Array(r),"f")}else S1(this,rh,new Uint8Array(16),"f");S1(this,Oi,this.iv,"f")}get iv(){return new Uint8Array($l(this,rh,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const r=new Uint8Array(e.length);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let r=15;r>=0;--r)Kn(this,Yn,"f")[r]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(e.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");Kn(this,Yn,"f").set(e)}increment(){for(let e=15;e>=0;e--)if(Kn(this,Yn,"f")[e]===255)Kn(this,Yn,"f")[e]=0;else{Kn(this,Yn,"f")[e]++;break}}encrypt(e){var r,n;const s=new Uint8Array(e);for(let i=0;i16)throw new TypeError("PKCS#7 padding byte out of range");const r=t.length-e;for(let n=0;n0&&(n&n-1)===0,"invalid kdf.N","kdf.N",n),M(s>0&&i>0,"invalid kdf","kdf",e);const o=Ht(t,"crypto.kdfparams.dklen:int!");return M(o===32,"invalid kdf.dklen","kdf.dflen",o),{name:"scrypt",salt:r,N:n,r:s,p:i,dkLen:64}}else if(e.toLowerCase()==="pbkdf2"){const r=Ht(t,"crypto.kdfparams.salt:data!"),n=Ht(t,"crypto.kdfparams.prf:string!"),s=n.split("-").pop();M(s==="sha256"||s==="sha512","invalid kdf.pdf","kdf.pdf",n);const i=Ht(t,"crypto.kdfparams.c:int!"),o=Ht(t,"crypto.kdfparams.dklen:int!");return M(o===32,"invalid kdf.dklen","kdf.dklen",o),{name:"pbkdf2",salt:r,count:i,dkLen:o,algorithm:s}}}M(!1,"unsupported key-derivation function","kdf",e)}function noe(t,e){const r=JSON.parse(t),n=Sy(e),s=kD(r);if(s.name==="pbkdf2"){const{salt:f,count:d,dkLen:h,algorithm:p}=s,y=za(n,f,d,h,p);return w0(r,y)}J(s.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:s});const{salt:i,N:o,r:a,p:c,dkLen:l}=s,u=vd(n,i,o,a,c,l);return w0(r,u)}function O3(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function soe(t,e,r){const n=JSON.parse(t),s=Sy(e),i=kD(n);if(i.name==="pbkdf2"){r&&(r(0),await O3(0));const{salt:d,count:h,dkLen:p,algorithm:y}=i,g=za(s,d,h,p,y);return r&&(r(1),await O3(0)),w0(n,g)}J(i.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:o,N:a,r:c,p:l,dkLen:u}=i,f=await yd(s,o,a,c,l,u,r);return w0(n,f)}function TD(t){const e=t.salt!=null?fe(t.salt,"options.salt"):co(32);let r=1<<17,n=8,s=1;return t.scrypt&&(t.scrypt.N&&(r=t.scrypt.N),t.scrypt.r&&(n=t.scrypt.r),t.scrypt.p&&(s=t.scrypt.p)),M(typeof r=="number"&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),M(typeof n=="number"&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),M(typeof s=="number"&&s>0&&Number.isSafeInteger(s),"invalid scrypt p parameter","options.p",s),{name:"scrypt",dkLen:32,salt:e,N:r,r:n,p:s}}function PD(t,e,r,n){const s=fe(r.privateKey,"privateKey"),i=n.iv!=null?fe(n.iv,"options.iv"):co(16);M(i.length===16,"invalid options.iv length","options.iv",n.iv);const o=n.uuid!=null?fe(n.uuid,"options.uuid"):co(16);M(o.length===16,"invalid options.uuid length","options.uuid",n.iv);const a=t.slice(0,16),c=t.slice(16,32),l=new Jf(a,i),u=fe(l.encrypt(s)),f=Ct(ot([c,u])),d={address:r.address.substring(2).toLowerCase(),id:lte(o),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ne(i).substring(2)},ciphertext:ne(u).substring(2),kdf:"scrypt",kdfparams:{salt:ne(e.salt).substring(2),n:e.N,dklen:32,p:e.p,r:e.r},mac:f.substring(2)}};if(r.mnemonic){const h=n.client!=null?n.client:`ethers/${i7}`,p=r.mnemonic.path||AD,y=r.mnemonic.locale||"en",g=t.slice(32,64),m=fe(r.mnemonic.entropy,"account.mnemonic.entropy"),x=co(16),b=new Jf(g,x),w=fe(b.encrypt(m)),A=new Date,_="UTC--"+(A.getUTCFullYear()+"-"+Ud(A.getUTCMonth()+1,2)+"-"+Ud(A.getUTCDate(),2)+"T"+Ud(A.getUTCHours(),2)+"-"+Ud(A.getUTCMinutes(),2)+"-"+Ud(A.getUTCSeconds(),2)+".0Z")+"--"+d.address;d["x-ethers"]={client:h,gethFilename:_,path:p,locale:y,mnemonicCounter:ne(x).substring(2),mnemonicCiphertext:ne(w).substring(2),version:"0.1"}}return JSON.stringify(d)}function RD(t,e,r){r==null&&(r={});const n=Sy(e),s=TD(r),i=vd(n,s.salt,s.N,s.r,s.p,64);return PD(fe(i),s,t,r)}async function ID(t,e,r){r==null&&(r={});const n=Sy(e),s=TD(r),i=await yd(n,s.salt,s.N,s.r,s.p,64,r.progressCallback);return PD(fe(i),s,t,r)}const Vx="m/44'/60'/0'/0/0",ioe=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Sa=2147483648,ooe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),aoe="0123456789abcdef";function E0(t,e){let r="";for(;t;)r=aoe[t%16]+r,t=Math.trunc(t/16);for(;r.length=0;o-=8)s[33+(o>>3)]=t>>24-o&255;const i=fe(hd("sha512",e,s));return{IL:i.slice(0,32),IR:i.slice(32)}}function _D(t,e){const r=e.split("/");M(r.length>0,"invalid path","path",e),r[0]==="m"&&(M(t.depth===0,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${t.depth}`,"path",e),r.shift());let n=t;for(let s=0;s=16&&s.length<=64,"invalid seed","seed","[REDACTED]");const i=fe(hd("sha512",ioe,s)),o=new gi(ne(i.slice(0,32)));return new ws(Js,o,"0x00000000",ne(i.slice(32)),"m",0,0,n,null)},W(ws,Qc);let bh=ws;class lp extends g2{constructor(r,n,s,i,o,a,c,l,u){super(n,u);G(this,"publicKey");G(this,"fingerprint");G(this,"parentFingerprint");G(this,"chainCode");G(this,"path");G(this,"index");G(this,"depth");$a(r,Js,"HDNodeVoidWallet"),me(this,{publicKey:s});const f=xt(pd(ys(s)),0,4);me(this,{publicKey:s,fingerprint:f,parentFingerprint:i,chainCode:o,path:a,index:c,depth:l})}connect(r){return new lp(Js,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,r)}get extendedKey(){return J(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),A2(ot(["0x0488B21E",E0(this.depth,1),this.parentFingerprint,E0(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(r){const n=_e(r,"index");M(n<=4294967295,"invalid index","index",n);let s=this.path;s&&(s+="/"+(n&~Sa),n&Sa&&(s+="'"));const{IR:i,IL:o}=OD(n,this.chainCode,this.publicKey,null),a=gi.addPoints(o,this.publicKey,!0),c=gy(a);return new lp(Js,c,a,this.fingerprint,ne(i),s,n,this.depth+1,this.provider)}derivePath(r){return _D(this,r)}}function _3(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function N3(t,e){const r=JSON.parse(t),n=Sy(e),s=Xe(Ht(r,"ethaddr:string!")),i=CD(Ht(r,"encseed:string!"));M(i&&i.length%16===0,"invalid encseed","json",t);const o=fe(za(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),l=new HC(o,a),u=toe(fe(l.decrypt(c)));let f="";for(let d=0;d{setTimeout(()=>{e()},t)})}var Wp,T2;const pc=class pc extends x0{constructor(e,r){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let n=typeof e=="string"?new gi(e):e;super(n,r)}connect(e){return new pc(this.signingKey,e)}async encrypt(e,r){const n={address:this.address,privateKey:this.privateKey};return await ID(n,e,{progressCallback:r})}encryptSync(e){const r={address:this.address,privateKey:this.privateKey};return RD(r,e)}static async fromEncryptedJson(e,r,n){var i;let s=null;return I3(e)?s=await soe(e,r,n):_3(e)&&(n&&(n(0),await M3(0)),s=N3(e,r),n&&(n(1),await M3(0))),ee(i=pc,Wp,T2).call(i,s)}static fromEncryptedJsonSync(e,r){var s;let n=null;return I3(e)?n=noe(e,r):_3(e)?n=N3(e,r):M(!1,"invalid JSON wallet","json","[ REDACTED ]"),ee(s=pc,Wp,T2).call(s,n)}static createRandom(e){const r=bh.createRandom();return e?r.connect(e):r}static fromPhrase(e,r){const n=bh.fromPhrase(e);return r?n.connect(r):n}};Wp=new WeakSet,T2=function(e){if(M(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const n=Yf.fromEntropy(e.mnemonic.entropy),s=bh.fromMnemonic(n,e.mnemonic.path);if(s.address===e.address&&s.privateKey===e.privateKey)return s;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const r=new pc(e.privateKey);return M(r.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),r},W(pc,Wp);let up=pc;const coe={en:Na.wordlist()};BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const GC=t=>{const e=t.toString(16);return`${e.length%2===0?"0x":"0x0"}${e}`};function P2(){return P2=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&(e+=","),e+=JSON.stringify(i),e+=":",r(s[i])}}let K=function(t){return t[t.MAINNET=1]="MAINNET",t[t.ROPSTEN=3]="ROPSTEN",t[t.RINKEBY=4]="RINKEBY",t[t.GOERLI=5]="GOERLI",t[t.KOVAN=42]="KOVAN",t[t.SEPOLIA=11155111]="SEPOLIA",t[t.POLYGON=137]="POLYGON",t[t.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",t[t.POLYGON_ZKEVM=1101]="POLYGON_ZKEVM",t[t.POLYGON_AMOY=80002]="POLYGON_AMOY",t[t.BSC=56]="BSC",t[t.BSC_TESTNET=97]="BSC_TESTNET",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_KOVAN=69]="OPTIMISM_KOVAN",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.OPTIMISM_SEPOLIA=11155420]="OPTIMISM_SEPOLIA",t[t.ARBITRUM=42161]="ARBITRUM",t[t.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",t[t.ARBITRUM_SEPOLIA=421614]="ARBITRUM_SEPOLIA",t[t.ARBITRUM_NOVA=42170]="ARBITRUM_NOVA",t[t.AVALANCHE=43114]="AVALANCHE",t[t.AVALANCHE_TESTNET=43113]="AVALANCHE_TESTNET",t[t.GNOSIS=100]="GNOSIS",t[t.BASE=8453]="BASE",t[t.BASE_GOERLI=84531]="BASE_GOERLI",t[t.BASE_SEPOLIA=84532]="BASE_SEPOLIA",t[t.HOMEVERSE_TESTNET=40875]="HOMEVERSE_TESTNET",t[t.HOMEVERSE=19011]="HOMEVERSE",t[t.XAI=660279]="XAI",t[t.XAI_SEPOLIA=37714555429]="XAI_SEPOLIA",t[t.ASTAR_ZKEVM=3776]="ASTAR_ZKEVM",t[t.ASTAR_ZKYOTO=6038361]="ASTAR_ZKYOTO",t[t.XR_SEPOLIA=2730]="XR_SEPOLIA",t[t.TELOS=40]="TELOS",t[t.B3_SEPOLIA=1993]="B3_SEPOLIA",t[t.APECHAIN_TESTNET=33111]="APECHAIN_TESTNET",t[t.BLAST=81457]="BLAST",t[t.BLAST_SEPOLIA=168587773]="BLAST_SEPOLIA",t[t.BORNE_TESTNET=94984]="BORNE_TESTNET",t[t.HARDHAT=31337]="HARDHAT",t[t.HARDHAT_2=31338]="HARDHAT_2",t}({}),Fe=function(t){return t.MAINNET="mainnet",t.TESTNET="testnet",t}({});const S0={[K.MAINNET]:{chainId:K.MAINNET,type:Fe.MAINNET,name:"mainnet",title:"Ethereum",logoURI:`https://assets.sequence.info/images/networks/medium/${K.MAINNET}.webp`,blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[K.ROPSTEN]:{chainId:K.ROPSTEN,type:Fe.TESTNET,name:"ropsten",title:"Ropsten",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ROPSTEN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Ropsten)",rootUrl:"https://ropsten.etherscan.io/"},nativeToken:{symbol:"roETH",name:"Ropsten Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deprecated:!0},[K.RINKEBY]:{chainId:K.RINKEBY,type:Fe.TESTNET,name:"rinkeby",title:"Rinkeby",logoURI:`https://assets.sequence.info/images/networks/medium/${K.RINKEBY}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Rinkeby)",rootUrl:"https://rinkeby.etherscan.io/"},nativeToken:{symbol:"rETH",name:"Rinkeby Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deprecated:!0},[K.GOERLI]:{chainId:K.GOERLI,type:Fe.TESTNET,name:"goerli",title:"Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Goerli)",rootUrl:"https://goerli.etherscan.io/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",deprecated:!0},[K.KOVAN]:{chainId:K.KOVAN,type:Fe.TESTNET,name:"kovan",title:"Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${K.KOVAN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"},nativeToken:{symbol:"kETH",name:"Kovan Ether",decimals:18},deprecated:!0},[K.SEPOLIA]:{chainId:K.SEPOLIA,type:Fe.TESTNET,name:"sepolia",title:"Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Sepolia)",rootUrl:"https://sepolia.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.POLYGON]:{chainId:K.POLYGON,type:Fe.MAINNET,name:"polygon",title:"Polygon",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON}.webp`,blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"},nativeToken:{symbol:"MATIC",name:"Polygon",decimals:18}},[K.POLYGON_MUMBAI]:{chainId:K.POLYGON_MUMBAI,type:Fe.TESTNET,name:"mumbai",title:"Polygon Mumbai",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON_MUMBAI}.webp`,testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"},nativeToken:{symbol:"mMATIC",name:"Mumbai Polygon",decimals:18},deprecated:!0},[K.POLYGON_AMOY]:{chainId:K.POLYGON_AMOY,type:Fe.TESTNET,name:"amoy",title:"Polygon Amoy",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON_AMOY}.webp`,testnet:!0,blockExplorer:{name:"OKLink (Amoy)",rootUrl:"https://www.oklink.com/amoy/"},nativeToken:{symbol:"aMATIC",name:"Amoy Polygon",decimals:18}},[K.POLYGON_ZKEVM]:{chainId:K.POLYGON_ZKEVM,type:Fe.MAINNET,name:"polygon-zkevm",title:"Polygon zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${K.POLYGON_ZKEVM}.webp`,blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.BSC]:{chainId:K.BSC,type:Fe.MAINNET,name:"bsc",title:"BNB Smart Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BSC}.webp`,blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"},nativeToken:{symbol:"BNB",name:"BNB",decimals:18}},[K.BSC_TESTNET]:{chainId:K.BSC_TESTNET,type:Fe.TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BSC_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"},nativeToken:{symbol:"tBNB",name:"Testnet BNB",decimals:18}},[K.OPTIMISM]:{chainId:K.OPTIMISM,type:Fe.MAINNET,name:"optimism",title:"Optimism",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM}.webp`,blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.OPTIMISM_KOVAN]:{chainId:K.OPTIMISM_KOVAN,type:Fe.TESTNET,name:"optimism-kovan",title:"Optimism Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM_KOVAN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Kovan)",rootUrl:"https://kovan-optimistic.etherscan.io/"},nativeToken:{symbol:"kETH",name:"Kovan Ether",decimals:18},deprecated:!0},[K.OPTIMISM_GOERLI]:{chainId:K.OPTIMISM_GOERLI,type:Fe.TESTNET,name:"optimism-goerli",title:"Optimism Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM_GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Goerli)",rootUrl:"https://goerli-optimistic.etherscan.io/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},deprecated:!0},[K.OPTIMISM_SEPOLIA]:{chainId:K.OPTIMISM_SEPOLIA,type:Fe.TESTNET,name:"optimism-sepolia",title:"Optimism Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.OPTIMISM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Sepolia)",rootUrl:"https://sepolia-optimistic.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.ARBITRUM]:{chainId:K.ARBITRUM,type:Fe.MAINNET,name:"arbitrum",title:"Arbitrum One",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM}.webp`,blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.ARBITRUM_GOERLI]:{chainId:K.ARBITRUM_GOERLI,type:Fe.TESTNET,name:"arbitrum-goerli",title:"Arbitrum Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM_GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Arbiscan (Goerli Testnet)",rootUrl:"https://testnet.arbiscan.io/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},deprecated:!0},[K.ARBITRUM_SEPOLIA]:{chainId:K.ARBITRUM_SEPOLIA,type:Fe.TESTNET,name:"arbitrum-sepolia",title:"Arbitrum Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Arbiscan (Sepolia Testnet)",rootUrl:"https://sepolia.arbiscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.ARBITRUM_NOVA]:{chainId:K.ARBITRUM_NOVA,type:Fe.MAINNET,name:"arbitrum-nova",title:"Arbitrum Nova",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ARBITRUM_NOVA}.webp`,blockExplorer:{name:"Arbiscan Nova",rootUrl:"https://nova.arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.AVALANCHE]:{chainId:K.AVALANCHE,type:Fe.MAINNET,name:"avalanche",title:"Avalanche",logoURI:`https://assets.sequence.info/images/networks/medium/${K.AVALANCHE}.webp`,blockExplorer:{name:"Snowtrace",rootUrl:"https://subnets.avax.network/c-chain/"},nativeToken:{symbol:"AVAX",name:"AVAX",decimals:18}},[K.AVALANCHE_TESTNET]:{chainId:K.AVALANCHE_TESTNET,type:Fe.TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.AVALANCHE_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"Snowtrace (Testnet)",rootUrl:"https://subnets-test.avax.network/c-chain/"},nativeToken:{symbol:"tAVAX",name:"Testnet AVAX",decimals:18}},[K.GNOSIS]:{chainId:K.GNOSIS,type:Fe.MAINNET,name:"gnosis",title:"Gnosis Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${K.GNOSIS}.webp`,blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"},nativeToken:{symbol:"XDAI",name:"XDAI",decimals:18}},[K.BASE]:{chainId:K.BASE,type:Fe.MAINNET,name:"base",title:"Base (Coinbase)",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BASE}.webp`,blockExplorer:{name:"Base Explorer",rootUrl:"https://basescan.org/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.BASE_GOERLI]:{chainId:K.BASE_GOERLI,type:Fe.TESTNET,name:"base-goerli",title:"Base Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BASE_GOERLI}.webp`,testnet:!0,blockExplorer:{name:"Base Goerli Explorer",rootUrl:"https://goerli.basescan.org/"},nativeToken:{symbol:"gETH",name:"Goerli Ether",decimals:18},deprecated:!0},[K.BASE_SEPOLIA]:{chainId:K.BASE_SEPOLIA,type:Fe.TESTNET,name:"base-sepolia",title:"Base Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BASE_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Base Sepolia Explorer",rootUrl:"https://base-sepolia.blockscout.com/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[K.HOMEVERSE]:{chainId:K.HOMEVERSE,type:Fe.MAINNET,name:"homeverse",title:"Oasys Homeverse",logoURI:`https://assets.sequence.info/images/networks/medium/${K.HOMEVERSE}.webp`,blockExplorer:{name:"Oasys Homeverse Explorer",rootUrl:"https://explorer.oasys.homeverse.games/"},nativeToken:{symbol:"OAS",name:"OAS",decimals:18}},[K.HOMEVERSE_TESTNET]:{chainId:K.HOMEVERSE_TESTNET,type:Fe.TESTNET,name:"homeverse-testnet",title:"Oasys Homeverse Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.HOMEVERSE_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"Oasys Homeverse Explorer (Testnet)",rootUrl:"https://explorer.testnet.oasys.homeverse.games/"},nativeToken:{symbol:"tOAS",name:"Testnet OAS",decimals:18}},[K.XAI]:{chainId:K.XAI,type:Fe.MAINNET,name:"xai",title:"Xai",logoURI:`https://assets.sequence.info/images/networks/medium/${K.XAI}.webp`,blockExplorer:{name:"Xai Explorer",rootUrl:"https://explorer.xai-chain.net/"},nativeToken:{symbol:"XAI",name:"XAI",decimals:18}},[K.XAI_SEPOLIA]:{chainId:K.XAI_SEPOLIA,type:Fe.TESTNET,name:"xai-sepolia",title:"Xai Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.XAI_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Xai Sepolia Explorer",rootUrl:"https://testnet-explorer-v2.xai-chain.net/"},nativeToken:{symbol:"sXAI",name:"Sepolia XAI",decimals:18}},[K.ASTAR_ZKEVM]:{chainId:K.ASTAR_ZKEVM,type:Fe.MAINNET,name:"astar-zkevm",title:"Astar zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ASTAR_ZKEVM}.webp`,blockExplorer:{name:"Astar zkEVM Explorer",rootUrl:"https://astar-zkevm.explorer.startale.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.ASTAR_ZKYOTO]:{chainId:K.ASTAR_ZKYOTO,type:Fe.TESTNET,name:"astar-zkyoto",title:"Astar zKyoto Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.ASTAR_ZKYOTO}.webp`,testnet:!0,blockExplorer:{name:"Astar zKyoto Explorer",rootUrl:"https://astar-zkyoto.blockscout.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.XR_SEPOLIA]:{chainId:K.XR_SEPOLIA,type:Fe.TESTNET,name:"xr-sepolia",title:"XR Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.XR_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"XR Sepolia Explorer",rootUrl:"https://xr-sepolia-testnet.explorer.caldera.xyz/"},nativeToken:{symbol:"tXR",name:"Sepolia XR",decimals:18}},[K.B3_SEPOLIA]:{chainId:K.B3_SEPOLIA,type:Fe.TESTNET,name:"b3-sepolia",title:"B3 Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.B3_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"B3 Sepolia Explorer",rootUrl:"https://sepolia.explorer.b3.fun/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.APECHAIN_TESTNET]:{chainId:K.APECHAIN_TESTNET,type:Fe.TESTNET,name:"apechain-testnet",title:"APE Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.APECHAIN_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"APE Chain Explorer",rootUrl:"https://curtis.explorer.caldera.xyz/"},nativeToken:{symbol:"APE",name:"ApeCoin",decimals:18}},[K.BLAST]:{chainId:K.BLAST,type:Fe.MAINNET,name:"blast",title:"Blast",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BLAST}.webp`,blockExplorer:{name:"Blast Explorer",rootUrl:"https://blastscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.BLAST_SEPOLIA]:{chainId:K.BLAST_SEPOLIA,type:Fe.TESTNET,name:"blast-sepolia",title:"Blast Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BLAST_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Blast Sepolia Explorer",rootUrl:"https://sepolia.blastexplorer.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.TELOS]:{chainId:K.TELOS,type:Fe.MAINNET,name:"telos",title:"Telos",logoURI:`https://assets.sequence.info/images/networks/medium/${K.TELOS}.webp`,blockExplorer:{name:"Telos Explorer",rootUrl:"https://explorer.telos.net/network/"},nativeToken:{symbol:"TLOS",name:"TLOS",decimals:18}},[K.BORNE_TESTNET]:{chainId:K.BORNE_TESTNET,type:Fe.TESTNET,name:"borne-testnet",title:"Borne Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${K.BORNE_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"Borne Testnet Explorer",rootUrl:"https://subnets-test.avax.network/bornegfdn"},nativeToken:{symbol:"BORNE",name:"BORNE",decimals:18}},[K.HARDHAT]:{chainId:K.HARDHAT,name:"hardhat",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[K.HARDHAT_2]:{chainId:K.HARDHAT_2,name:"hardhat2",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}}};function Xf(){return Xf=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(!t)throw new Error("invalid network config: empty config");const n=[];if(Array.isArray(t)?n.push(...t):n.push(t),n.length===0){if(e)throw new Error("invalid network config: empty config");return!1}const s=n.map(l=>l.chainId).sort(),i=s.filter((l,u)=>s.indexOf(l)!==u);if(i.length>0){if(e)throw new Error(`invalid network config: duplicate chainIds ${i}`);return!1}n.forEach(l=>l.name=l.name.toLowerCase());const o=n.map(l=>l.name).sort(),a=o.filter((l,u)=>o.indexOf(l)!==u);if(a.length>0){if(e)throw new Error(`invalid network config: duplicate network names ${a}`);return!1}let c=!1;for(let l=0;l(doe(t,!0,e),t),poe=t=>hoe(voe(t)),yoe=(t,e)=>{if(typeof e=="string")if(e.startsWith("0x")){const r=Number(e);return t.find(n=>n.chainId===r)}else return t.find(r=>r.name===e||`${r.chainId}`===e);else{if(typeof e=="number")return t.find(r=>r.chainId===e);if(e.chainId)return t.find(r=>r.chainId===e.chainId);if(typeof e=="bigint"){const r=Number(e);return t.find(n=>n.chainId===r)}else return}},voe=t=>{if(!t)return[];const e=t.sort((n,s)=>n.chainId===s.chainId?0:n.chainIdn.isDefaultChain);return r>0&&e.splice(0,0,e.splice(r,1)[0]),e},qC=(t,e)=>typeof t=="string"?(e=e||{},t.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,function(r,n){let s=e[n];return typeof s=="function"?s=s():s==null?s="":typeof s=="object"||typeof s=="symbol"?s=s.toString():s=s.valueOf(),s})):"",ND=t=>qC("https://${network}-indexer.sequence.app",{network:t}),moe=t=>qC("https://${network}-relayer.sequence.app",{network:t}),goe=t=>qC("https://nodes.sequence.app/${network}",{network:t});function fp(t){return yoe(boe,t)}const Ke=(t,e)=>{const r=S0[t];if(!r)throw new Error(`Network with chainId ${t} not found`);const n=goe(r.name);return Xf({},r,{rpcUrl:n,indexerUrl:ND(r.name),relayer:{url:moe(r.name),provider:{url:n}}},e)},xoe=[Xf({},S0[K.HARDHAT],{rpcUrl:"http://localhost:8545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:8545"}}}),Xf({},S0[K.HARDHAT_2],{rpcUrl:"http://localhost:9545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:9545"}}})],boe=poe([Xf({},Ke(K.POLYGON),{isDefaultChain:!0,isAuthChain:!0}),Ke(K.MAINNET),Ke(K.BSC),Ke(K.AVALANCHE),Ke(K.ARBITRUM),Ke(K.ARBITRUM_NOVA),Ke(K.OPTIMISM),Ke(K.OPTIMISM_SEPOLIA),Ke(K.POLYGON_ZKEVM),Ke(K.GNOSIS),Ke(K.RINKEBY,{disabled:!0}),Ke(K.GOERLI,{disabled:!0}),Ke(K.SEPOLIA),Ke(K.POLYGON_MUMBAI,{disabled:!0}),Ke(K.POLYGON_AMOY),Ke(K.BSC_TESTNET),Ke(K.ARBITRUM_SEPOLIA),Ke(K.BASE),Ke(K.BASE_SEPOLIA),Ke(K.HOMEVERSE),Ke(K.HOMEVERSE_TESTNET),Ke(K.XAI),Ke(K.XAI_SEPOLIA),Ke(K.AVALANCHE_TESTNET),Ke(K.ASTAR_ZKEVM),Ke(K.ASTAR_ZKYOTO),Ke(K.XR_SEPOLIA),Ke(K.B3_SEPOLIA),Ke(K.APECHAIN_TESTNET),Ke(K.BLAST),Ke(K.BLAST_SEPOLIA),Ke(K.TELOS),Ke(K.BORNE_TESTNET),...xoe]),woe=(t,e)=>e.some(r=>t instanceof r);let D3,L3;function Eoe(){return D3||(D3=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Soe(){return L3||(L3=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const MD=new WeakMap,R2=new WeakMap,DD=new WeakMap,$x=new WeakMap,WC=new WeakMap;function Coe(t){const e=new Promise((r,n)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{r(Ca(t.result)),s()},o=()=>{n(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(r=>{r instanceof IDBCursor&&MD.set(r,t)}).catch(()=>{}),WC.set(e,t),e}function Aoe(t){if(R2.has(t))return;const e=new Promise((r,n)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{r(),s()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});R2.set(t,e)}let I2={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return R2.get(t);if(e==="objectStoreNames")return t.objectStoreNames||DD.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Ca(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function koe(t){I2=t(I2)}function Toe(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){const n=t.call(zx(this),e,...r);return DD.set(n,e.sort?e.sort():[e]),Ca(n)}:Soe().includes(t)?function(...e){return t.apply(zx(this),e),Ca(MD.get(this))}:function(...e){return Ca(t.apply(zx(this),e))}}function Poe(t){return typeof t=="function"?Toe(t):(t instanceof IDBTransaction&&Aoe(t),woe(t,Eoe())?new Proxy(t,I2):t)}function Ca(t){if(t instanceof IDBRequest)return Coe(t);if($x.has(t))return $x.get(t);const e=Poe(t);return e!==t&&($x.set(t,e),WC.set(e,t)),e}const zx=t=>WC.get(t);function Roe(t,e,{blocked:r,upgrade:n,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=Ca(o);return n&&o.addEventListener("upgradeneeded",c=>{n(Ca(o.result),c.oldVersion,c.newVersion,Ca(o.transaction),c)}),r&&o.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",l=>s(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const Ioe=["get","getKey","getAll","getAllKeys","count"],Ooe=["put","add","delete","clear"],Hx=new Map;function j3(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Hx.get(e))return Hx.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,s=Ooe.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(s||Ioe.includes(r)))return;const i=async function(o,...a){const c=this.transaction(o,s?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),s&&c.done]))[0]};return Hx.set(e,i),i}koe(t=>({...t,get:(e,r,n)=>j3(e,r)||t.get(e,r,n),has:(e,r)=>!!j3(e,r)||t.has(e,r)}));const _oe=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},Noe=t=>({httpHandler:t.httpHandler()});var B3;(function(t){t.HEADER="header",t.QUERY="query"})(B3||(B3={}));var F3;(function(t){t.HEADER="header",t.QUERY="query"})(F3||(F3={}));var dp;(function(t){t.HTTP="http",t.HTTPS="https"})(dp||(dp={}));var C0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(C0||(C0={}));var U3;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(U3||(U3={}));const O2="__smithy_context";var V3;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(V3||(V3={}));var $3;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})($3||($3={}));class Vn{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const r=new Vn({...e,headers:{...e.headers}});return r.query&&(r.query=Moe(r.query)),r}static isInstance(e){if(!e)return!1;const r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return Vn.clone(this)}}function Moe(t){return Object.keys(t).reduce((e,r)=>{const n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}class A0{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}const Doe=t=>e=>async r=>{if(!Vn.isInstance(r.request))return e(r);const{request:n}=r,{handlerProtocol:s=""}=t.requestHandler.metadata||{};if(s.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let i=n.hostname;n.port!=null&&(i+=`:${n.port}`),n.headers.host=i}return e(r)},Loe={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},joe=t=>({applyToStack:e=>{e.add(Doe(t),Loe)}}),Boe=()=>(t,e)=>async r=>{var n,s;try{const i=await t(r),{clientName:o,commandName:a,logger:c,dynamoDbDocumentClientOptions:l={}}=e,{overrideInputFilterSensitiveLog:u,overrideOutputFilterSensitiveLog:f}=l,d=u??e.inputFilterSensitiveLog,h=f??e.outputFilterSensitiveLog,{$metadata:p,...y}=i.output;return(n=c==null?void 0:c.info)==null||n.call(c,{clientName:o,commandName:a,input:d(r.input),output:h(y),metadata:p}),i}catch(i){const{clientName:o,commandName:a,logger:c,dynamoDbDocumentClientOptions:l={}}=e,{overrideInputFilterSensitiveLog:u}=l,f=u??e.inputFilterSensitiveLog;throw(s=c==null?void 0:c.error)==null||s.call(c,{clientName:o,commandName:a,input:f(r.input),error:i,metadata:i.$metadata}),i}},Foe={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Uoe=t=>({applyToStack:e=>{e.add(Boe(),Foe)}}),z3="X-Amzn-Trace-Id",Voe="AWS_LAMBDA_FUNCTION_NAME",$oe="_X_AMZN_TRACE_ID",zoe=t=>e=>async r=>{const{request:n}=r;if(!Vn.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(z3))return e(r);const s=process.env[Voe],i=process.env[$oe],o=a=>typeof a=="string"&&a.length>0;return o(s)&&o(i)&&(n.headers[z3]=i),e({...r,request:n})},Hoe={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},Goe=t=>({applyToStack:e=>{e.add(zoe(t),Hoe)}});function qoe(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}class Woe{constructor({size:e,params:r}){this.data=new Map,this.parameters=[],this.capacity=e??50,r&&(this.parameters=r)}get(e,r){const n=this.hash(e);if(n===!1)return r();if(!this.data.has(n)){if(this.data.size>this.capacity+10){const s=this.data.keys();let i=0;for(;;){const{value:o,done:a}=s.next();if(this.data.delete(o),a||++i>10)break}}this.data.set(n,r())}return this.data.get(n)}size(){return this.data.size}hash(e){let r="";const{parameters:n}=this;if(n.length===0)return!1;for(const s of n){const i=String(e[s]??"");if(i.includes("|;"))return!1;r+=i+"|;"}return r}}const Koe=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),LD=t=>Koe.test(t)||t.startsWith("[")&&t.endsWith("]"),Qoe=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),KC=(t,e=!1)=>{if(!e)return Qoe.test(t);const r=t.split(".");for(const n of r)if(!KC(n))return!1;return!0},k0={},hp="endpoints";function Ma(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Ma(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Ma).join(", ")})`:JSON.stringify(t,null,2)}class $n extends Error{constructor(e){super(e),this.name="EndpointError"}}const Yoe=(t,e)=>t===e,Joe=t=>{const e=t.split("."),r=[];for(const n of e){const s=n.indexOf("[");if(s!==-1){if(n.indexOf("]")!==n.length-1)throw new $n(`Path: '${t}' does not end with ']'`);const i=n.slice(s+1,-1);if(Number.isNaN(parseInt(i)))throw new $n(`Invalid array index: '${i}' in path: '${t}'`);s!==0&&r.push(n.slice(0,s)),r.push(i)}else r.push(n)}return r},jD=(t,e)=>Joe(e).reduce((r,n)=>{if(typeof r!="object")throw new $n(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t),Xoe=t=>t!=null,Zoe=t=>!t,Gx={[dp.HTTP]:80,[dp.HTTPS]:443},eae=t=>{const e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){const{hostname:d,port:h,protocol:p="",path:y="",query:g={}}=t,m=new URL(`${p}//${d}${h?`:${h}`:""}${y}`);return m.search=Object.entries(g).map(([x,b])=>`${x}=${b}`).join("&"),m}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;const r=e.href,{host:n,hostname:s,pathname:i,protocol:o,search:a}=e;if(a)return null;const c=o.slice(0,-1);if(!Object.values(dp).includes(c))return null;const l=LD(s),u=r.includes(`${n}:${Gx[c]}`)||typeof t=="string"&&t.includes(`${n}:${Gx[c]}`),f=`${n}${u?`:${Gx[c]}`:""}`;return{scheme:c,authority:f,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}},tae=(t,e)=>t===e,rae=(t,e,r,n)=>e>=r||t.lengthencodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),sae={booleanEquals:Yoe,getAttr:jD,isSet:Xoe,isValidHostLabel:KC,not:Zoe,parseURL:eae,stringEquals:tae,substring:rae,uriEncode:nae},BD=(t,e)=>{const r=[],n={...e.endpointParams,...e.referenceRecord};let s=0;for(;s({...e.endpointParams,...e.referenceRecord})[t],rg=(t,e,r)=>{if(typeof t=="string")return BD(t,r);if(t.fn)return FD(t,r);if(t.ref)return iae(t,r);throw new $n(`'${e}': ${String(t)} is not a string, function or reference.`)},FD=({fn:t,argv:e},r)=>{const n=e.map(i=>["boolean","number"].includes(typeof i)?i:rg(i,"arg",r)),s=t.split(".");return s[0]in k0&&s[1]!=null?k0[s[0]][s[1]](...n):sae[t](...n)},oae=({assign:t,...e},r)=>{var s,i;if(t&&t in r.referenceRecord)throw new $n(`'${t}' is already defined in Reference Record.`);const n=FD(e,r);return(i=(s=r.logger)==null?void 0:s.debug)==null||i.call(s,`${hp} evaluateCondition: ${Ma(e)} = ${Ma(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}},QC=(t=[],e)=>{var n,s;const r={};for(const i of t){const{result:o,toAssign:a}=oae(i,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};a&&(r[a.name]=a.value,(s=(n=e.logger)==null?void 0:n.debug)==null||s.call(n,`${hp} assign: ${a.name} := ${Ma(a.value)}`))}return{result:!0,referenceRecord:r}},aae=(t,e)=>Object.entries(t).reduce((r,[n,s])=>({...r,[n]:s.map(i=>{const o=rg(i,"Header value entry",e);if(typeof o!="string")throw new $n(`Header '${n}' value '${o}' is not a string`);return o})}),{}),UD=(t,e)=>{if(Array.isArray(t))return t.map(r=>UD(r,e));switch(typeof t){case"string":return BD(t,e);case"object":if(t===null)throw new $n(`Unexpected endpoint property: ${t}`);return VD(t,e);case"boolean":return t;default:throw new $n(`Unexpected endpoint property type: ${typeof t}`)}},VD=(t,e)=>Object.entries(t).reduce((r,[n,s])=>({...r,[n]:UD(s,e)}),{}),cae=(t,e)=>{const r=rg(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new $n(`Endpoint URL must be a string, got ${typeof r}`)},lae=(t,e)=>{var u,f;const{conditions:r,endpoint:n}=t,{result:s,referenceRecord:i}=QC(r,e);if(!s)return;const o={...e,referenceRecord:{...e.referenceRecord,...i}},{url:a,properties:c,headers:l}=n;return(f=(u=e.logger)==null?void 0:u.debug)==null||f.call(u,`${hp} Resolving endpoint from template: ${Ma(n)}`),{...l!=null&&{headers:aae(l,o)},...c!=null&&{properties:VD(c,o)},url:cae(a,o)}},uae=(t,e)=>{const{conditions:r,error:n}=t,{result:s,referenceRecord:i}=QC(r,e);if(s)throw new $n(rg(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))},fae=(t,e)=>{const{conditions:r,rules:n}=t,{result:s,referenceRecord:i}=QC(r,e);if(s)return $D(n,{...e,referenceRecord:{...e.referenceRecord,...i}})},$D=(t,e)=>{for(const r of t)if(r.type==="endpoint"){const n=lae(r,e);if(n)return n}else if(r.type==="error")uae(r,e);else if(r.type==="tree"){const n=fae(r,e);if(n)return n}else throw new $n(`Unknown endpoint rule: ${r}`);throw new $n("Rules evaluation failed")},dae=(t,e)=>{var l,u,f,d;const{endpointParams:r,logger:n}=e,{parameters:s,rules:i}=t;(u=(l=e.logger)==null?void 0:l.debug)==null||u.call(l,`${hp} Initial EndpointParams: ${Ma(r)}`);const o=Object.entries(s).filter(([,h])=>h.default!=null).map(([h,p])=>[h,p.default]);if(o.length>0)for(const[h,p]of o)r[h]=r[h]??p;const a=Object.entries(s).filter(([,h])=>h.required).map(([h])=>h);for(const h of a)if(r[h]==null)throw new $n(`Missing required parameter: '${h}'`);const c=$D(i,{endpointParams:r,logger:n,referenceRecord:{}});return(d=(f=e.logger)==null?void 0:f.debug)==null||d.call(f,`${hp} Resolved endpoint: ${Ma(c)}`),c},zD=(t,e=!1)=>{if(e){for(const r of t.split("."))if(!zD(r))return!1;return!0}return!(!KC(t)||t.length<3||t.length>63||t!==t.toLowerCase()||LD(t))},H3=":",hae="/",pae=t=>{const e=t.split(H3);if(e.length<6)return null;const[r,n,s,i,o,...a]=e;if(r!=="arn"||n===""||s===""||a.join(H3)==="")return null;const c=a.map(l=>l.split(hae)).flat();return{partition:n,service:s,region:i,accountId:o,resourceId:c}},yae=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],vae="1.1",mae={partitions:yae,version:vae};let gae=mae;const xae=t=>{const{partitions:e}=gae;for(const n of e){const{regions:s,outputs:i}=n;for(const[o,a]of Object.entries(s))if(o===t)return{...i,...a}}for(const n of e){const{regionRegex:s,outputs:i}=n;if(new RegExp(s).test(t))return{...i}}const r=e.find(n=>n.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}},HD={isVirtualHostableS3Bucket:zD,parseArn:pae,partition:xae};k0.aws=HD;const G3="user-agent",qx="x-amz-user-agent",q3=" ",Wx="/",bae=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,wae=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,W3="-",Eae=t=>(e,r)=>async n=>{var f,d;const{request:s}=n;if(!Vn.isInstance(s))return e(n);const{headers:i}=s,o=((f=r==null?void 0:r.userAgent)==null?void 0:f.map(Kx))||[],a=(await t.defaultUserAgentProvider()).map(Kx),c=((d=t==null?void 0:t.customUserAgent)==null?void 0:d.map(Kx))||[],l=[].concat([...a,...o,...c]).join(q3),u=[...a.filter(h=>h.startsWith("aws-sdk-")),...c].join(q3);return t.runtime!=="browser"?(u&&(i[qx]=i[qx]?`${i[G3]} ${u}`:u),i[G3]=l):i[qx]=l,e({...n,request:s})},Kx=t=>{var o;const e=t[0].split(Wx).map(a=>a.replace(bae,W3)).join(Wx),r=(o=t[1])==null?void 0:o.replace(wae,W3),n=e.indexOf(Wx),s=e.substring(0,n);let i=e.substring(n+1);return s==="api"&&(i=i.toLowerCase()),[s,i,r].filter(a=>a&&a.length>0).reduce((a,c,l)=>{switch(l){case 0:return c;case 1:return`${a}/${c}`;default:return`${a}#${c}`}},"")},Sae={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Cae=t=>({applyToStack:e=>{e.add(Eae(t),Sae)}});var K3;(function(t){t.ENV="env",t.CONFIG="shared config entry"})(K3||(K3={}));const Aae=!1,kae=!1,ng=t=>t[O2]||(t[O2]={}),Aa=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e},GD=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips")),Q3=t=>GD(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t,Tae=t=>{const{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return Q3(e);const n=await e();return Q3(n)},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return GD(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}};function Pae(t){const e=new Map;for(const r of t)e.set(r.schemeId,r);return e}const Rae=(t,e)=>(r,n)=>async s=>{var l;const i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,s.input)),o=Pae(t.httpAuthSchemes),a=ng(n),c=[];for(const u of i){const f=o.get(u.schemeId);if(!f){c.push(`HttpAuthScheme \`${u.schemeId}\` was not enabled for this service.`);continue}const d=f.identityProvider(await e.identityProviderConfigProvider(t));if(!d){c.push(`HttpAuthScheme \`${u.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:h={},signingProperties:p={}}=((l=u.propertiesExtractor)==null?void 0:l.call(u,t,n))||{};u.identityProperties=Object.assign(u.identityProperties||{},h),u.signingProperties=Object.assign(u.signingProperties||{},p),a.selectedHttpAuthScheme={httpAuthOption:u,identity:await d(u.identityProperties),signer:f.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(c.join(` +`));return r(s)},Iae=async t=>{const e=(t==null?void 0:t.Bucket)||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Dae(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Mae(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},Oae=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,_ae=/(\d+\.){3}\d+/,Nae=/\.\./,Mae=t=>Oae.test(t)&&!_ae.test(t)&&!Nae.test(t),Dae=t=>{const[e,r,n,,,s]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,o=!!(i&&r&&n&&s);if(i&&!o)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return o},Lae=(t,e,r)=>{const n=async()=>{const s=r[t]??r[e];return typeof s=="function"?s():s};return t==="credentialScope"||e==="CredentialScope"?async()=>{const s=typeof r.credentials=="function"?await r.credentials():r.credentials;return(s==null?void 0:s.credentialScope)??(s==null?void 0:s.CredentialScope)}:t==="accountId"||e==="AccountId"?async()=>{const s=typeof r.credentials=="function"?await r.credentials():r.credentials;return(s==null?void 0:s.accountId)??(s==null?void 0:s.AccountId)}:t==="endpoint"||e==="endpoint"?async()=>{const s=await n();if(s&&typeof s=="object"){if("url"in s)return s.url.href;if("hostname"in s){const{protocol:i,hostname:o,port:a,path:c}=s;return`${i}//${o}${a?":"+a:""}${c}`}}return s}:n},qD=async t=>{};function jae(t){const e={};if(t=t.replace(/^\?/,""),t)for(const r of t.split("&")){let[n,s=null]=r.split("=");n=decodeURIComponent(n),s&&(s=decodeURIComponent(s)),n in e?Array.isArray(e[n])?e[n].push(s):e[n]=[e[n],s]:e[n]=s}return e}const T0=t=>{if(typeof t=="string")return T0(new URL(t));const{hostname:e,pathname:r,port:n,protocol:s,search:i}=t;let o;return i&&(o=jae(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:s,path:r,query:o}},WD=t=>typeof t=="object"?"url"in t?T0(t.url):t:T0(t),Bae=async(t,e,r,n)=>{if(!r.endpoint){let o;r.serviceConfiguredEndpoint?o=await r.serviceConfiguredEndpoint():o=await qD(r.serviceId),o&&(r.endpoint=()=>Promise.resolve(WD(o)))}const s=await Fae(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(s,n)},Fae=async(t,e,r)=>{var i;const n={},s=((i=e==null?void 0:e.getEndpointParameterInstructions)==null?void 0:i.call(e))||{};for(const[o,a]of Object.entries(s))switch(a.type){case"staticContextParams":n[o]=a.value;break;case"contextParams":n[o]=t[a.name];break;case"clientContextParams":case"builtInParams":n[o]=await Lae(a.name,o,r)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(a))}return Object.keys(s).length===0&&Object.assign(n,r),String(r.serviceId).toLowerCase()==="s3"&&await Iae(n),n},Uae=({config:t,instructions:e})=>(r,n)=>async s=>{var a,c,l;const i=await Bae(s.input,{getEndpointParameterInstructions(){return e}},{...t},n);n.endpointV2=i,n.authSchemes=(a=i.properties)==null?void 0:a.authSchemes;const o=(c=n.authSchemes)==null?void 0:c[0];if(o){n.signing_region=o.signingRegion,n.signing_service=o.signingName;const u=ng(n),f=(l=u==null?void 0:u.selectedHttpAuthScheme)==null?void 0:l.httpAuthOption;f&&(f.signingProperties=Object.assign(f.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return r({...s})},Vae=(t,e)=>r=>async n=>{const{response:s}=await r(n);try{const i=await e(s,t);return{response:s,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:s}),!("$metadata"in i)){const o="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";i.message+=` + `+o,typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText)}throw i}},$ae=(t,e)=>(r,n)=>async s=>{var a;const i=(a=n.endpointV2)!=null&&a.url&&t.urlParser?async()=>t.urlParser(n.endpointV2.url):t.endpoint;if(!i)throw new Error("No valid endpoint provider available.");const o=await e(s.input,{...t,endpoint:i});return r({...s,request:o})},zae={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},YC={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function JC(t,e,r){return{applyToStack:n=>{n.add(Vae(t,r),zae),n.add($ae(t,e),YC)}}}const KD={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:YC.name},XC=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Uae({config:t,instructions:e}),KD)}}),Hae=t=>{const e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>WD(await Aa(r)()):void 0,i={...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:Aa(t.useDualstackEndpoint??!1),useFipsEndpoint:Aa(t.useFipsEndpoint??!1)};let o;return i.serviceConfiguredEndpoint=async()=>(t.serviceId&&!o&&(o=qD(t.serviceId)),o),i},Gae={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:KD.name},qae=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(Rae(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),Gae)}});YC.name;const Wae=t=>e=>{throw e},Kae=(t,e)=>{},Qae=t=>(e,r)=>async n=>{if(!Vn.isInstance(n.request))return e(n);const i=ng(r).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:o={}},identity:a,signer:c}=i,l=await e({...n,request:await c.sign(n.request,a,o)}).catch((c.errorHandler||Wae)(o));return(c.successHandler||Kae)(l.response,o),l};var Zf;(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(Zf||(Zf={}));const P0=3,Yae=Zf.STANDARD,Jae=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Xae=["TimeoutError","RequestTimeout","RequestTimeoutException"],Zae=[500,502,503,504],ece=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],tce=t=>{var e;return(e=t.$metadata)==null?void 0:e.clockSkewCorrected},QD=t=>{var e,r;return((e=t.$metadata)==null?void 0:e.httpStatusCode)===429||Jae.includes(t.name)||((r=t.$retryable)==null?void 0:r.throttling)==!0},YD=t=>{var e;return tce(t)||Xae.includes(t.name)||ece.includes((t==null?void 0:t.code)||"")||Zae.includes(((e=t.$metadata)==null?void 0:e.httpStatusCode)||0)},rce=t=>{var e;if(((e=t.$metadata)==null?void 0:e.httpStatusCode)!==void 0){const r=t.$metadata.httpStatusCode;return 500<=r&&r<=599&&!YD(t)}return!1};class nce{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=(e==null?void 0:e.beta)??.7,this.minCapacity=(e==null?void 0:e.minCapacity)??1,this.minFillRate=(e==null?void 0:e.minFillRate)??.5,this.scaleConstant=(e==null?void 0:e.scaleConstant)??.4,this.smooth=(e==null?void 0:e.smooth)??.8;const r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(n=>setTimeout(n,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),QD(e)){const s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){const n=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}const _2=100,JD=20*1e3,sce=500,Y3=500,ice=5,oce=10,ace=1,cce="amz-sdk-invocation-id",lce="amz-sdk-request",uce=()=>{let t=_2;return{computeNextBackoffDelay:n=>Math.floor(Math.min(JD,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}},J3=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(JD,t),getRetryCost:()=>r});class XD{constructor(e){this.maxAttempts=e,this.mode=Zf.STANDARD,this.capacity=Y3,this.retryBackoffStrategy=uce(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return J3({retryDelay:_2,retryCount:0})}async refreshRetryTokenForRetry(e,r){const n=await this.getMaxAttempts();if(this.shouldRetry(e,r,n)){const s=r.errorType;this.retryBackoffStrategy.setDelayBase(s==="THROTTLING"?sce:_2);const i=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),o=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,i):i,a=this.getCapacityCost(s);return this.capacity-=a,J3({retryDelay:o,retryCount:e.getRetryCount()+1,retryCost:a})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(Y3,this.capacity+(e.getRetryCost()??ace))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${P0}`),P0}}shouldRetry(e,r,n){return e.getRetryCount()+1=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?oce:ice}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class fce{constructor(e,r){this.maxAttemptsProvider=e,this.mode=Zf.ADAPTIVE;const{rateLimiter:n}=r??{};this.rateLimiter=n??new nce,this.standardRetryStrategy=new XD(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}let C1;const dce=new Uint8Array(16);function hce(){if(!C1&&(C1=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!C1))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return C1(dce)}const pr=[];for(let t=0;t<256;++t)pr.push((t+256).toString(16).slice(1));function pce(t,e=0){return pr[t[e+0]]+pr[t[e+1]]+pr[t[e+2]]+pr[t[e+3]]+"-"+pr[t[e+4]]+pr[t[e+5]]+"-"+pr[t[e+6]]+pr[t[e+7]]+"-"+pr[t[e+8]]+pr[t[e+9]]+"-"+pr[t[e+10]]+pr[t[e+11]]+pr[t[e+12]]+pr[t[e+13]]+pr[t[e+14]]+pr[t[e+15]]}const yce=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),X3={randomUUID:yce};function vce(t,e,r){if(X3.randomUUID&&!e&&!t)return X3.randomUUID();t=t||{};const n=t.random||(t.rng||hce)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let s=0;s<16;++s)e[r+s]=n[s];return e}return pce(n)}const mce=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`),gce=t=>{const{retryStrategy:e}=t,r=Aa(t.maxAttempts??P0);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await Aa(t.retryMode)()===Zf.ADAPTIVE?new fce(r):new XD(r))}};class ZD{trace(){}debug(){}info(){}warn(){}error(){}}const Za=(t,e)=>{const r=[];if(t&&r.push(t),e)for(const n of e)r.push(n);return r},No=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,R0=()=>{let t=[],e=[],r=!1;const n=new Set,s=f=>f.sort((d,h)=>Z3[h.step]-Z3[d.step]||e8[h.priority||"normal"]-e8[d.priority||"normal"]),i=f=>{let d=!1;const h=p=>{const y=Za(p.name,p.aliases);if(y.includes(f)){d=!0;for(const g of y)n.delete(g);return!1}return!0};return t=t.filter(h),e=e.filter(h),d},o=f=>{let d=!1;const h=p=>{if(p.middleware===f){d=!0;for(const y of Za(p.name,p.aliases))n.delete(y);return!1}return!0};return t=t.filter(h),e=e.filter(h),d},a=f=>{var d;return t.forEach(h=>{f.add(h.middleware,{...h})}),e.forEach(h=>{f.addRelativeTo(h.middleware,{...h})}),(d=f.identifyOnResolve)==null||d.call(f,u.identifyOnResolve()),f},c=f=>{const d=[];return f.before.forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...c(h))}),d.push(f),f.after.reverse().forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...c(h))}),d},l=(f=!1)=>{const d=[],h=[],p={};return t.forEach(g=>{const m={...g,before:[],after:[]};for(const x of Za(m.name,m.aliases))p[x]=m;d.push(m)}),e.forEach(g=>{const m={...g,before:[],after:[]};for(const x of Za(m.name,m.aliases))p[x]=m;h.push(m)}),h.forEach(g=>{if(g.toMiddleware){const m=p[g.toMiddleware];if(m===void 0){if(f)return;throw new Error(`${g.toMiddleware} is not found when adding ${No(g.name,g.aliases)} middleware ${g.relation} ${g.toMiddleware}`)}g.relation==="after"&&m.after.push(g),g.relation==="before"&&m.before.push(g)}}),s(d).map(c).reduce((g,m)=>(g.push(...m),g),[])},u={add:(f,d={})=>{const{name:h,override:p,aliases:y}=d,g={step:"initialize",priority:"normal",middleware:f,...d},m=Za(h,y);if(m.length>0){if(m.some(x=>n.has(x))){if(!p)throw new Error(`Duplicate middleware name '${No(h,y)}'`);for(const x of m){const b=t.findIndex(A=>{var O;return A.name===x||((O=A.aliases)==null?void 0:O.some(_=>_===x))});if(b===-1)continue;const w=t[b];if(w.step!==g.step||g.priority!==w.priority)throw new Error(`"${No(w.name,w.aliases)}" middleware with ${w.priority} priority in ${w.step} step cannot be overridden by "${No(h,y)}" middleware with ${g.priority} priority in ${g.step} step.`);t.splice(b,1)}}for(const x of m)n.add(x)}t.push(g)},addRelativeTo:(f,d)=>{const{name:h,override:p,aliases:y}=d,g={middleware:f,...d},m=Za(h,y);if(m.length>0){if(m.some(x=>n.has(x))){if(!p)throw new Error(`Duplicate middleware name '${No(h,y)}'`);for(const x of m){const b=e.findIndex(A=>{var O;return A.name===x||((O=A.aliases)==null?void 0:O.some(_=>_===x))});if(b===-1)continue;const w=e[b];if(w.toMiddleware!==g.toMiddleware||w.relation!==g.relation)throw new Error(`"${No(w.name,w.aliases)}" middleware ${w.relation} "${w.toMiddleware}" middleware cannot be overridden by "${No(h,y)}" middleware ${g.relation} "${g.toMiddleware}" middleware.`);e.splice(b,1)}}for(const x of m)n.add(x)}e.push(g)},clone:()=>a(R0()),use:f=>{f.applyToStack(u)},remove:f=>typeof f=="string"?i(f):o(f),removeByTag:f=>{let d=!1;const h=p=>{const{tags:y,name:g,aliases:m}=p;if(y&&y.includes(f)){const x=Za(g,m);for(const b of x)n.delete(b);return d=!0,!1}return!0};return t=t.filter(h),e=e.filter(h),d},concat:f=>{var h;const d=a(R0());return d.use(f),d.identifyOnResolve(r||d.identifyOnResolve()||(((h=f.identifyOnResolve)==null?void 0:h.call(f))??!1)),d},applyToStack:a,identify:()=>l(!0).map(f=>{const d=f.step??f.relation+" "+f.toMiddleware;return No(f.name,f.aliases)+" - "+d}),identifyOnResolve(f){return typeof f=="boolean"&&(r=f),r},resolve:(f,d)=>{for(const h of l().map(p=>p.middleware).reverse())f=h(f,d);return r&&console.log(u.identify()),f}};return u},Z3={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},e8={high:3,normal:2,low:1};class xce{constructor(e){this.config=e,this.middlewareStack=R0()}send(e,r,n){const s=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,o=s===void 0&&this.config.cacheMiddleware===!0;let a;if(o){this.handlers||(this.handlers=new WeakMap);const c=this.handlers;c.has(e.constructor)?a=c.get(e.constructor):(a=e.resolveMiddleware(this.middlewareStack,this.config,s),c.set(e.constructor,a))}else delete this.handlers,a=e.resolveMiddleware(this.middlewareStack,this.config,s);if(i)a(e).then(c=>i(null,c.output),c=>i(c)).catch(()=>{});else return a(e).then(c=>c.output)}destroy(){var e,r,n;(n=(r=(e=this.config)==null?void 0:e.requestHandler)==null?void 0:r.destroy)==null||n.call(r),delete this.handlers}}const Da={},md=new Array(64);for(let t=0,e="A".charCodeAt(0),r="Z".charCodeAt(0);t+e<=r;t++){const n=String.fromCharCode(t+e);Da[n]=t,md[t]=n}for(let t=0,e="a".charCodeAt(0),r="z".charCodeAt(0);t+e<=r;t++){const n=String.fromCharCode(t+e),s=t+26;Da[n]=s,md[s]=n}for(let t=0;t<10;t++){Da[t.toString(10)]=t+52;const e=t.toString(10),r=t+52;Da[e]=r,md[r]=e}Da["+"]=62;md[62]="+";Da["/"]=63;md[63]="/";const Du=6,wh=8,bce=63,ZC=t=>{let e=t.length/4*3;t.slice(-2)==="=="?e-=2:t.slice(-1)==="="&&e--;const r=new ArrayBuffer(e),n=new DataView(r);for(let s=0;s>=Du;const a=s/4*3;i>>=o%wh;const c=Math.floor(o/wh);for(let l=0;l>u)}}return new Uint8Array(r)},ed=t=>new TextEncoder().encode(t),Eh=t=>typeof t=="string"?ed(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),eL=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)};function tL(t){let e;typeof t=="string"?e=ed(t):e=t;const r=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let s="";for(let i=0;i>u]}s+="==".slice(0,4-c)}return s}function wce(t,e="utf-8"){return e==="base64"?tL(t):eL(t)}function Ece(t,e){return e==="base64"?nl.mutate(ZC(t)):nl.mutate(ed(t))}class nl extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return Ece(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,nl.prototype),e}transformToString(e="utf-8"){return wce(this,e)}}const fa=t=>encodeURIComponent(t).replace(/[!'()*]/g,Sce),Sce=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`;function Cce(t){const e=[];for(let r of Object.keys(t).sort()){const n=t[r];if(r=fa(r),Array.isArray(n))for(let s=0,i=n.length;s{t&&setTimeout(()=>{const n=new Error(`Request did not complete within ${t} ms`);n.name="TimeoutError",r(n)},t)})}const Qx={supported:void 0};class eA{static create(e){return typeof(e==null?void 0:e.handle)=="function"?e:new eA(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),Qx.supported===void 0&&(Qx.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);const n=this.config.requestTimeout,s=this.config.keepAlive===!0,i=this.config.credentials;if(r!=null&&r.aborted){const m=new Error("Request aborted");return m.name="AbortError",Promise.reject(m)}let o=e.path;const a=Cce(e.query||{});a&&(o+=`?${a}`),e.fragment&&(o+=`#${e.fragment}`);let c="";if(e.username!=null||e.password!=null){const m=e.username??"",x=e.password??"";c=`${m}:${x}@`}const{port:l,method:u}=e,f=`${e.protocol}//${c}${e.hostname}${l?`:${l}`:""}${o}`,d=u==="GET"||u==="HEAD"?void 0:e.body,h={body:d,headers:new Headers(e.headers),method:u,credentials:i};d&&(h.duplex="half"),typeof AbortController<"u"&&(h.signal=r),Qx.supported&&(h.keepalive=s);let p=()=>{};const y=new Request(f,h),g=[fetch(y).then(m=>{const x=m.headers,b={};for(const A of x.entries())b[A[0]]=A[1];return m.body!=null?{response:new A0({headers:b,reason:m.statusText,statusCode:m.status,body:m.body})}:m.blob().then(A=>({response:new A0({headers:b,reason:m.statusText,statusCode:m.status,body:A})}))}),Ace(n)];return r&&g.push(new Promise((m,x)=>{const b=()=>{const w=new Error("Request aborted");w.name="AbortError",x(w)};if(typeof r.addEventListener=="function"){const w=r;w.addEventListener("abort",b,{once:!0}),p=()=>w.removeEventListener("abort",b)}else r.onabort=b})),Promise.race(g).finally(p)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}const kce=t=>typeof Blob=="function"&&t instanceof Blob?Tce(t):Pce(t);async function Tce(t){const e=await Rce(t),r=ZC(e);return new Uint8Array(r)}async function Pce(t){const e=[],r=t.getReader();let n=!1,s=0;for(;!n;){const{done:a,value:c}=await r.read();c&&(e.push(c),s+=c.length),n=a}const i=new Uint8Array(s);let o=0;for(const a of e)i.set(a,o),o+=a.length;return i}function Rce(t){return new Promise((e,r)=>{const n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return r(new Error("Reader aborted too early"));const s=n.result??"",i=s.indexOf(","),o=i>-1?i+1:s.length;e(s.substring(o))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}const rL={},N2={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),rL[t]=e,N2[e]=t}function Ice(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(t.length/2);for(let r=0;r{if(t instanceof Uint8Array)return nl.mutate(t);if(!t)return nl.mutate(new Uint8Array);const r=e.streamCollector(t);return nl.mutate(await r)};class sg{constructor(){this.middlewareStack=R0()}static classBuilder(){return new _ce}resolveMiddlewareWithContext(e,r,n,{middlewareFn:s,clientName:i,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:l,additionalContext:u,CommandCtor:f}){for(const g of s.bind(this)(f,e,r,n))this.middlewareStack.use(g);const d=e.concat(this.middlewareStack),{logger:h}=r,p={logger:h,clientName:i,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[O2]:{commandInstance:this,...l},...u},{requestHandler:y}=r;return d.resolve(g=>y.handle(g.request,n||{}),p)}}class _ce{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,n={}){return this._smithyContext={service:e,operation:r,...n},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=n=>n,r=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let r;return r=class extends sg{static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=n??{},e._init(this)}resolveMiddleware(n,s,i){return this.resolveMiddlewareWithContext(n,s,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}const ur="***SensitiveInformation***";class tA extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,tA.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const Ne=(t,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,s])=>{(t[n]==null||t[n]==="")&&(t[n]=s)});const r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t},Nce=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{const s=Dce(t),i=s.httpStatusCode?s.httpStatusCode+"":void 0,o=new r({name:(e==null?void 0:e.code)||(e==null?void 0:e.Code)||n||i||"UnknownError",$fault:"client",$metadata:s});throw Ne(o,e)},Mce=t=>({output:e,parsedBody:r,errorCode:n})=>{Nce({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},Dce=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),Lce=t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},jce=t=>{const e=[];for(const r in C0){const n=C0[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},Bce=t=>{const e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},Fce=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},Uce=t=>{const e={};return e.retryStrategy=t.retryStrategy(),e},Vce=t=>({...jce(t),...Fce(t)}),$ce=t=>({...Bce(t),...Uce(t)}),M2=function(){const t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};M2.prototype=Object.create(String.prototype,{constructor:{value:M2,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(M2,String);const Ce=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(Ce);if(typeof t=="object"){const e={};for(const r of Object.keys(t))t[r]!=null&&(e[r]=Ce(t[r]));return e}return t},zce=t=>(t==null?void 0:t.body)instanceof ReadableStream,Hce=t=>(e,r)=>async n=>{var o;let s=await t.retryStrategy();const i=await t.maxAttempts();if(Gce(s)){s=s;let a=await s.acquireInitialRetryToken(r.partition_id),c=new Error,l=0,u=0;const{request:f}=n,d=Vn.isInstance(f);for(d&&(f.headers[cce]=vce());;)try{d&&(f.headers[lce]=`attempt=${l+1}; max=${i}`);const{response:h,output:p}=await e(n);return s.recordSuccess(a),p.$metadata.attempts=l+1,p.$metadata.totalRetryDelay=u,{response:h,output:p}}catch(h){const p=qce(h);if(c=mce(h),d&&zce(f))throw(o=r.logger instanceof ZD?console:r.logger)==null||o.warn("An error was encountered in a non-retryable streaming request."),c;try{a=await s.refreshRetryTokenForRetry(a,p)}catch{throw c.$metadata||(c.$metadata={}),c.$metadata.attempts=l+1,c.$metadata.totalRetryDelay=u,c}l=a.getRetryCount();const y=a.getRetryDelay();u+=y,await new Promise(g=>setTimeout(g,y))}}else return s=s,s!=null&&s.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",s.mode]]),s.retry(e,n)},Gce=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",qce=t=>{const e={error:t,errorType:Wce(t)},r=Qce(t.$response);return r&&(e.retryAfterHint=r),e},Wce=t=>QD(t)?"THROTTLING":YD(t)?"TRANSIENT":rce(t)?"SERVER_ERROR":"CLIENT_ERROR",nL={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Kce=t=>({applyToStack:e=>{e.add(Hce(t),nL)}}),Qce=t=>{if(!A0.isInstance(t))return;const e=Object.keys(t.headers).find(i=>i.toLowerCase()==="retry-after");if(!e)return;const r=t.headers[e],n=Number(r);return Number.isNaN(n)?new Date(r):new Date(n*1e3)},Yce={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:nL.name},Jce=t=>({applyToStack:e=>{e.addRelativeTo(Qae(),Yce)}});class Xce{constructor(e){this.authSchemes=new Map;for(const[r,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(r,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}class Zce{async sign(e,r,n){return e}}const ele=t=>e=>sL(e)&&e.expiration.getTime()-Date.now()t.expiration!==void 0,nle=(t,e,r)=>{if(t===void 0)return;const n=typeof t!="function"?async()=>Promise.resolve(t):t;let s,i,o,a=!1;const c=async l=>{i||(i=n(l));try{s=await i,o=!0,a=!1}finally{i=void 0}return s};return e===void 0?async l=>((!o||l!=null&&l.forceRefresh)&&(s=await c(l)),s):async l=>((!o||l!=null&&l.forceRefresh)&&(s=await c(l)),a?s:r(s)?(e(s)&&await c(l),s):(a=!0,s))},A1=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e},t8="content-length";function sle(t){return e=>async r=>{const n=r.request;if(Vn.isInstance(n)){const{body:s,headers:i}=n;if(s&&Object.keys(i).map(o=>o.toLowerCase()).indexOf(t8)===-1)try{const o=t(s);n.headers={...n.headers,[t8]:String(o)}}catch{}}return e({...r,request:n})}}const ile={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},ole=t=>({applyToStack:e=>{e.add(sle(t.bodyLengthChecker),ile)}}),r8=t=>{var e,r;return A0.isInstance(t)?((e=t.headers)==null?void 0:e.date)??((r=t.headers)==null?void 0:r.Date):void 0},iL=t=>new Date(Date.now()+t),ale=(t,e)=>Math.abs(iL(e).getTime()-t)>=3e5,n8=(t,e)=>{const r=Date.parse(t);return ale(r,e)?r-Date.now():e},Sh=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},cle=async t=>{var l,u,f;const e=Sh("context",t.context),r=Sh("config",t.config),n=(f=(u=(l=e.endpointV2)==null?void 0:l.properties)==null?void 0:u.authSchemes)==null?void 0:f[0],i=await Sh("signer",r.signer)(n),o=t==null?void 0:t.signingRegion,a=t==null?void 0:t.signingRegionSet,c=t==null?void 0:t.signingName;return{config:r,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}};class lle{async sign(e,r,n){var f;if(!Vn.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const s=await cle(n),{config:i,signer:o}=s;let{signingRegion:a,signingName:c}=s;const l=n.context;if(((f=l==null?void 0:l.authSchemes)==null?void 0:f.length)??0>1){const[d,h]=l.authSchemes;(d==null?void 0:d.name)==="sigv4a"&&(h==null?void 0:h.name)==="sigv4"&&(a=(h==null?void 0:h.signingRegion)??a,c=(h==null?void 0:h.signingName)??c)}return await o.sign(e,{signingDate:iL(i.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(e){return r=>{const n=r.ServerTime??r8(r.$response);if(n){const s=Sh("config",e.config),i=s.systemClockOffset;s.systemClockOffset=n8(n,s.systemClockOffset),s.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){const n=r8(e);if(n){const s=Sh("config",r.config);s.systemClockOffset=n8(n,s.systemClockOffset)}}}const ule=(t,e,r)=>{let n,s,i,o=!1;const a=async()=>{s||(s=t());try{n=await s,i=!0,o=!1}finally{s=void 0}return n};return e===void 0?async c=>((!i||c!=null&&c.forceRefresh)&&(n=await a()),n):async c=>((!i||c!=null&&c.forceRefresh)&&(n=await a()),o?n:r&&!r(n)?(o=!0,n):(e(n)&&await a(),n))},fle="X-Amz-Algorithm",dle="X-Amz-Credential",oL="X-Amz-Date",hle="X-Amz-SignedHeaders",ple="X-Amz-Expires",aL="X-Amz-Signature",cL="X-Amz-Security-Token",lL="authorization",uL=oL.toLowerCase(),yle="date",vle=[lL,uL,yle],mle=aL.toLowerCase(),D2="x-amz-content-sha256",gle=cL.toLowerCase(),xle={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},ble=/^proxy-/,wle=/^sec-/,Yx="AWS4-HMAC-SHA256",Ele="AWS4-HMAC-SHA256-PAYLOAD",Sle="UNSIGNED-PAYLOAD",Cle=50,fL="aws4_request",Ale=60*60*24*7,k1={},Jx=[],Xx=(t,e,r)=>`${t}/${e}/${r}/${fL}`,kle=async(t,e,r,n,s)=>{const i=await s8(t,e.secretAccessKey,e.accessKeyId),o=`${r}:${n}:${s}:${Cc(i)}:${e.sessionToken}`;if(o in k1)return k1[o];for(Jx.push(o);Jx.length>Cle;)delete k1[Jx.shift()];let a=`AWS4${e.secretAccessKey}`;for(const c of[r,n,s,fL])a=await s8(t,a,c);return k1[o]=a},s8=(t,e,r)=>{const n=new t(e);return n.update(Eh(r)),n.digest()},i8=({headers:t},e,r)=>{const n={};for(const s of Object.keys(t).sort()){if(t[s]==null)continue;const i=s.toLowerCase();(i in xle||e!=null&&e.has(i)||ble.test(i)||wle.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[s].trim().replace(/\s+/g," "))}return n},Tle=({query:t={}})=>{const e=[],r={};for(const n of Object.keys(t).sort()){if(n.toLowerCase()===mle)continue;e.push(n);const s=t[n];typeof s=="string"?r[n]=`${fa(n)}=${fa(s)}`:Array.isArray(s)&&(r[n]=s.slice(0).reduce((i,o)=>i.concat([`${fa(n)}=${fa(o)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")},Ple=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",Zx=async({headers:t,body:e},r)=>{for(const n of Object.keys(t))if(n.toLowerCase()===D2)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||Ple(e)){const n=new r;return n.update(Eh(e)),Cc(await n.digest())}return Sle};class Rle{format(e){const r=[];for(const i of Object.keys(e)){const o=ed(i);r.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(e[i]))}const n=new Uint8Array(r.reduce((i,o)=>i+o.byteLength,0));let s=0;for(const i of r)n.set(i,s),s+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(i.buffer);return o.set(e.value,3),o;case"string":const a=ed(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);const l=new Uint8Array(c.buffer);return l.set(a,3),l;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(rA.fromNumber(e.value.valueOf()).bytes,1),u;case"uuid":if(!Ile.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(Ice(e.value.replace(/\-/g,"")),1),f}}}var o8;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(o8||(o8={}));const Ile=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class rA{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let n=7,s=Math.abs(Math.round(e));n>-1&&s>0;n--,s/=256)r[n]=s;return e<0&&a8(r),new rA(r)}valueOf(){const e=this.bytes.slice(0),r=e[0]&128;return r&&a8(e),parseInt(Cc(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}function a8(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}const Ole=(t,e)=>{t=t.toLowerCase();for(const r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1},_le=(t,e={})=>{var s;const{headers:r,query:n={}}=Vn.clone(t);for(const i of Object.keys(r)){const o=i.toLowerCase();o.slice(0,6)==="x-amz-"&&!((s=e.unhoistableHeaders)!=null&&s.has(o))&&(n[i]=r[i],delete r[i])}return{...t,headers:r,query:n}},c8=t=>{t=Vn.clone(t);for(const e of Object.keys(t.headers))vle.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},Nle=t=>Mle(t).toISOString().replace(/\.\d{3}Z$/,"Z"),Mle=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;class l8{constructor({applyChecksum:e,credentials:r,region:n,service:s,sha256:i,uriEscapePath:o=!0}){this.headerFormatter=new Rle,this.service=s,this.sha256=i,this.uriEscapePath=o,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Aa(n),this.credentialProvider=Aa(r)}async presign(e,r={}){const{signingDate:n=new Date,expiresIn:s=3600,unsignableHeaders:i,unhoistableHeaders:o,signableHeaders:a,signingRegion:c,signingService:l}=r,u=await this.credentialProvider();this.validateResolvedCredentials(u);const f=c??await this.regionProvider(),{longDate:d,shortDate:h}=T1(n);if(s>Ale)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const p=Xx(h,f,l??this.service),y=_le(c8(e),{unhoistableHeaders:o});u.sessionToken&&(y.query[cL]=u.sessionToken),y.query[fle]=Yx,y.query[dle]=`${u.accessKeyId}/${p}`,y.query[oL]=d,y.query[ple]=s.toString(10);const g=i8(y,i,a);return y.query[hle]=u8(g),y.query[aL]=await this.getSignature(d,p,this.getSigningKey(u,f,h,l),this.createCanonicalRequest(y,g,await Zx(e,this.sha256))),y}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:s,signingRegion:i,signingService:o}){const a=i??await this.regionProvider(),{shortDate:c,longDate:l}=T1(n),u=Xx(c,a,o??this.service),f=await Zx({headers:{},body:r},this.sha256),d=new this.sha256;d.update(e);const h=Cc(await d.digest()),p=[Ele,l,u,s,h,f].join(` +`);return this.signString(p,{signingDate:n,signingRegion:a,signingService:o})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:s}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:s,priorSignature:e.priorSignature}).then(o=>({message:e.message,signature:o}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:s}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const o=n??await this.regionProvider(),{shortDate:a}=T1(r),c=new this.sha256(await this.getSigningKey(i,o,a,s));return c.update(Eh(e)),Cc(await c.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:s,signingRegion:i,signingService:o}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const c=i??await this.regionProvider(),l=c8(e),{longDate:u,shortDate:f}=T1(r),d=Xx(f,c,o??this.service);l.headers[uL]=u,a.sessionToken&&(l.headers[gle]=a.sessionToken);const h=await Zx(l,this.sha256);!Ole(D2,l.headers)&&this.applyChecksum&&(l.headers[D2]=h);const p=i8(l,s,n),y=await this.getSignature(u,d,this.getSigningKey(a,c,f,o),this.createCanonicalRequest(l,p,h));return l.headers[lL]=`${Yx} Credential=${a.accessKeyId}/${d}, SignedHeaders=${u8(p)}, Signature=${y}`,l}createCanonicalRequest(e,r,n){const s=Object.keys(r).sort();return`${e.method} ${this.getCanonicalPath(e)} -${kle(e)} +${Tle(e)} ${s.map(i=>`${i}:${r[i]}`).join(` `)} @@ -178,24 +178,24 @@ ${s.join(";")} ${n}`}async createStringToSign(e,r,n){const s=new this.sha256;s.update(Eh(n));const i=await s.digest();return`${Yx} ${e} ${r} -${Cc(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const r=[];for(const i of e.split("/"))(i==null?void 0:i.length)!==0&&i!=="."&&(i===".."?r.pop():r.push(i));const n=`${e!=null&&e.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&(e!=null&&e.endsWith("/"))?"/":""}`;return fa(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,s){const i=await this.createStringToSign(e,r,s),o=new this.sha256(await n);return o.update(Eh(i)),Cc(await o.digest())}getSigningKey(e,r,n,s){return Ale(this.sha256,e,n,r,s||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}}const T1=t=>{const e=_le(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},u8=t=>Object.keys(t).sort().join(";"),Mle=t=>{let e;t.credentials&&(e=rle(t.credentials,tle,sL)),e||(t.credentialDefaultProvider?e=A1(t.credentialDefaultProvider(Object.assign({},t,{parentClientConfig:t}))):e=async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:r=!0,systemClockOffset:n=t.systemClockOffset||0,sha256:s}=t;let i;return t.signer?i=A1(t.signer):t.regionInfoProvider?i=()=>A1(t.region)().then(async o=>[await t.regionInfoProvider(o,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},o]).then(([o,a])=>{const{signingRegion:c,signingService:l}=o;t.signingRegion=t.signingRegion||c||a,t.signingName=t.signingName||l||t.serviceId;const u={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:s,uriEscapePath:r},f=t.signerConstructor||l8;return new f(u)}):i=async o=>{o=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await A1(t.region)(),properties:{}},o);const a=o.signingRegion,c=o.signingName;t.signingRegion=t.signingRegion||a,t.signingName=t.signingName||c||t.serviceId;const l={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:s,uriEscapePath:r},u=t.signerConstructor||l8;return new u(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}},Dle=(t,e)=>Ice(t,e).then(r=>e.utf8Encoder(r)),ig=(t,e)=>Dle(t,e).then(r=>{if(r.length)try{return JSON.parse(r)}catch(n){throw(n==null?void 0:n.name)==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:r}),n}return{}}),Lle=async(t,e)=>{const r=await ig(t,e);return r.message=r.message??r.Message,r},jle=(t,e)=>{const r=(i,o)=>Object.keys(i).find(a=>a.toLowerCase()===o.toLowerCase()),n=i=>{let o=i;return typeof o=="number"&&(o=o.toString()),o.indexOf(",")>=0&&(o=o.split(",")[0]),o.indexOf(":")>=0&&(o=o.split(":")[0]),o.indexOf("#")>=0&&(o=o.split("#")[1]),o},s=r(t.headers,"x-amzn-errortype");if(s!==void 0)return n(t.headers[s]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)},Ble=async(t,e,r)=>({operation:ng(e).operation,region:await Aa(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function Fle(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-idp",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function ft(t){return{schemeId:"smithy.api#noAuth"}}const Ule=t=>{const e=[];switch(t.operation){case"AssociateSoftwareToken":{e.push(ft());break}case"ChangePassword":{e.push(ft());break}case"ConfirmDevice":{e.push(ft());break}case"ConfirmForgotPassword":{e.push(ft());break}case"ConfirmSignUp":{e.push(ft());break}case"DeleteUser":{e.push(ft());break}case"DeleteUserAttributes":{e.push(ft());break}case"ForgetDevice":{e.push(ft());break}case"ForgotPassword":{e.push(ft());break}case"GetDevice":{e.push(ft());break}case"GetUser":{e.push(ft());break}case"GetUserAttributeVerificationCode":{e.push(ft());break}case"GlobalSignOut":{e.push(ft());break}case"InitiateAuth":{e.push(ft());break}case"ListDevices":{e.push(ft());break}case"ResendConfirmationCode":{e.push(ft());break}case"RespondToAuthChallenge":{e.push(ft());break}case"RevokeToken":{e.push(ft());break}case"SetUserMFAPreference":{e.push(ft());break}case"SetUserSettings":{e.push(ft());break}case"SignUp":{e.push(ft());break}case"UpdateAuthEventFeedback":{e.push(ft());break}case"UpdateDeviceStatus":{e.push(ft());break}case"UpdateUserAttributes":{e.push(ft());break}case"VerifySoftwareToken":{e.push(ft());break}case"VerifyUserAttribute":{e.push(ft());break}default:e.push(Fle(t))}return e},Vle=t=>({...Mle(t)}),$le=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-idp"}),nA={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},zle="@aws-sdk/client-cognito-identity-provider",Hle="AWS SDK for JavaScript Cognito Identity Provider Client for Node.js, Browser and React Native",Gle="3.645.0",qle={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity-provider","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo cognito-identity-provider"},Wle="./dist-cjs/index.js",Kle="./dist-types/index.d.ts",Qle="./dist-es/index.js",Yle=!1,Jle={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/client-sts":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},Xle={"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},Zle={node:">=16.0.0"},eue={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},tue=["dist-*/**"],rue={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},nue="Apache-2.0",sue={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},iue="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity-provider",oue={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity-provider"},aue={name:zle,description:Hle,version:Gle,scripts:qle,main:Wle,types:Kle,module:Qle,sideEffects:Yle,dependencies:Jle,devDependencies:Xle,engines:Zle,typesVersions:eue,files:tue,author:rue,license:nue,browser:sue,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:iue,repository:oue},cue=t=>new TextEncoder().encode(t);var lue=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:cue;function pp(t){return t instanceof Uint8Array?t:typeof t=="string"?lue(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}function L2(t){return typeof t=="string"?t.length===0:t.byteLength===0}var dL={name:"SHA-256"},f8={name:"HMAC",hash:dL},uue=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const fue={};function dv(){return typeof window<"u"?window:typeof self<"u"?self:fue}var due=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!L2(e)){var r=pp(e),n=new Uint8Array(this.toHash.byteLength+r.byteLength);n.set(this.toHash,0),n.set(r,this.toHash.byteLength),this.toHash=n}},t.prototype.digest=function(){var e=this;return this.key?this.key.then(function(r){return dv().crypto.subtle.sign(f8,r,e.toHash).then(function(n){return new Uint8Array(n)})}):L2(this.toHash)?Promise.resolve(uue):Promise.resolve().then(function(){return dv().crypto.subtle.digest(dL,e.toHash)}).then(function(r){return Promise.resolve(new Uint8Array(r))})},t.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(r,n){dv().crypto.subtle.importKey("raw",pp(e.secret),f8,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}();function hue(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{l(n.next(u))}catch(f){o(f)}}function c(u){try{l(n.throw(u))}catch(f){o(f)}}function l(u){u.done?i(u.value):s(u.value).then(a,c)}l((n=n.apply(t,e||[])).next())})}function pue(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return c([l,u])}}function c(l){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(r=0)),r;)try{if(n=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,s=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]gue)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[r++],n--,this.bufferLength===is&&(this.hashBuffer(),this.bufferLength=0)},t.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(r.setUint8(this.bufferLength++,128),n%is>=is-8){for(var s=this.bufferLength;s>>24&255,i[s*4+1]=this.state[s]>>>16&255,i[s*4+2]=this.state[s]>>>8&255,i[s*4+3]=this.state[s]>>>0&255;return i},t.prototype.hashBuffer=function(){for(var e=this,r=e.buffer,n=e.state,s=n[0],i=n[1],o=n[2],a=n[3],c=n[4],l=n[5],u=n[6],f=n[7],d=0;d>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=this.temp[d-15];var y=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(y+this.temp[d-16]|0)}var g=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(f+(vue[d]+this.temp[d]|0)|0)|0,m=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&i^s&o^i&o)|0;f=u,u=l,l=c,c=a+g|0,a=o,o=i,i=s,s=g+m|0}n[0]+=s,n[1]+=i,n[2]+=o,n[3]+=a,n[4]+=c,n[5]+=l,n[6]+=u,n[7]+=f},t}(),xue=function(){function t(e){this.secret=e,this.hash=new hv,this.reset()}return t.prototype.update=function(e){if(!(L2(e)||this.error))try{this.hash.update(pp(e))}catch(r){this.error=r}},t.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},t.prototype.digest=function(){return hue(this,void 0,void 0,function(){return pue(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new hv,this.secret){this.outer=new hv;var e=bue(this.secret),r=new Uint8Array(is);r.set(e);for(var n=0;nis){var r=new hv;r.update(e),e=r.digest()}var n=new Uint8Array(is);return n.set(e),n}var wue=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function Eue(t){if(Sue(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return Cue(e)}return!1}function Sue(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function Cue(t){return t&&wue.every(function(e){return typeof t[e]=="function"})}var Aue=function(){function t(e){Eue(dv())?this.hash=new due(e):this.hash=new xue(e)}return t.prototype.update=function(e,r){this.hash.update(pp(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}();const kue={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},hL={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Vt={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Qr={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Bo={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class te{static getFirstMatch(e,r){const n=r.match(e);return n&&n.length>0&&n[1]||""}static getSecondMatch(e,r){const n=r.match(e);return n&&n.length>1&&n[2]||""}static matchAndReturnConst(e,r,n){if(e.test(r))return n}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const r=e.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),r[0]===10)switch(r[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const r=e.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),!(r[0]===1&&r[1]<5)){if(r[0]===1&&r[1]<6)return"Cupcake";if(r[0]===1&&r[1]>=6)return"Donut";if(r[0]===2&&r[1]<2)return"Eclair";if(r[0]===2&&r[1]===2)return"Froyo";if(r[0]===2&&r[1]>2)return"Gingerbread";if(r[0]===3)return"Honeycomb";if(r[0]===4&&r[1]<1)return"Ice Cream Sandwich";if(r[0]===4&&r[1]<4)return"Jelly Bean";if(r[0]===4&&r[1]>=4)return"KitKat";if(r[0]===5)return"Lollipop";if(r[0]===6)return"Marshmallow";if(r[0]===7)return"Nougat";if(r[0]===8)return"Oreo";if(r[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,r,n=!1){const s=te.getVersionPrecision(e),i=te.getVersionPrecision(r);let o=Math.max(s,i),a=0;const c=te.map([e,r],l=>{const u=o-te.getVersionPrecision(l),f=l+new Array(u+1).join(".0");return te.map(f.split("."),d=>new Array(20-d.length).join("0")+d).reverse()});for(n&&(a=o-Math.min(s,i)),o-=1;o>=a;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===a)return 0;o-=1}else if(c[0][o]{n[c]=o[c]})}return e}static getBrowserAlias(e){return kue[e]}static getBrowserTypeByAlias(e){return hL[e]||""}}const ct=/version\/(\d+(\.?_?\d+)+)/i,Tue=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},r=te.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},r=te.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},r=te.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},r=te.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},r=te.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},r=te.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},r=te.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},r=te.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=te.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},r=te.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},r=te.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},r=te.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},r=te.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},r=te.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},r=te.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},r=te.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},r=te.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},r=te.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},r=te.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},r=te.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},r=te.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},r=te.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},r=te.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},r=te.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},r=te.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},r=te.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},r=te.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e={name:"Android Browser"},r=te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},r=te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},r=te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,r=/^(.*)\/(.*)[ \t]\((.*)/,s=t.search("\\(")!==-1?r:e;return{name:te.getFirstMatch(s,t),version:te.getSecondMatch(s,t)}}}],Pue=[{test:[/Roku\/DVP/],describe(t){const e=te.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Qr.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=te.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Qr.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=te.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=te.getWindowsVersionName(e);return{name:Qr.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Qr.iOS},r=te.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe(t){const e=te.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=te.getMacOSVersionName(e),n={name:Qr.MacOS,version:e};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=te.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Qr.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e=te.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=te.getAndroidVersionName(e),n={name:Qr.Android,version:e};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=te.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:Qr.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=te.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||te.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||te.getFirstMatch(/\bbb(\d+)/i,t);return{name:Qr.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=te.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Qr.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=te.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Qr.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Qr.Linux}}},{test:[/CrOS/],describe(){return{name:Qr.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=te.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Qr.PlayStation4,version:e}}}],Rue=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(t){const e=te.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:Vt.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:Vt.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:Vt.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:Vt.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:Vt.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:Vt.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:Vt.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe(t){const e=te.getFirstMatch(/(ipod|iphone)/i,t);return{type:Vt.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:Vt.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:Vt.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:Vt.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:Vt.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:Vt.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:Vt.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:Vt.mobile}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:Vt.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:Vt.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:Vt.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:Vt.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:Vt.tv}}}],Iue=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Bo.Blink};const r=te.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Bo.EdgeHTML,version:r}}},{test:[/trident/i],describe(t){const e={name:Bo.Trident},r=te.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:Bo.Presto},r=te.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe(t){const e={name:Bo.Gecko},r=te.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Bo.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:Bo.WebKit},r=te.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];class d8{constructor(e,r=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},r!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=te.find(Tue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=te.find(Pue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:r}=this.getOS();return e?String(r).toLowerCase()||"":r||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:r}=this.getPlatform();return e?String(r).toLowerCase()||"":r||""}parsePlatform(){this.parsedResult.platform={};const e=te.find(Rue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=te.find(Iue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return te.assign({},this.parsedResult)}satisfies(e){const r={};let n=0;const s={};let i=0;if(Object.keys(e).forEach(a=>{const c=e[a];typeof c=="string"?(s[a]=c,i+=1):typeof c=="object"&&(r[a]=c,n+=1)}),n>0){const a=Object.keys(r),c=te.find(a,u=>this.isOS(u));if(c){const u=this.satisfies(r[c]);if(u!==void 0)return u}const l=te.find(a,u=>this.isPlatform(u));if(l){const u=this.satisfies(r[l]);if(u!==void 0)return u}}if(i>0){const a=Object.keys(s),c=te.find(a,l=>this.isBrowser(l,!0));if(c!==void 0)return this.compareVersion(s[c])}}isBrowser(e,r=!1){const n=this.getBrowserName().toLowerCase();let s=e.toLowerCase();const i=te.getBrowserTypeByAlias(s);return r&&i&&(s=i.toLowerCase()),s===n}compareVersion(e){let r=[0],n=e,s=!1;const i=this.getBrowserVersion();if(typeof i=="string")return e[0]===">"||e[0]==="<"?(n=e.substr(1),e[1]==="="?(s=!0,n=e.substr(2)):r=[],e[0]===">"?r.push(1):r.push(-1)):e[0]==="="?n=e.substr(1):e[0]==="~"&&(s=!0,n=e.substr(1)),r.indexOf(te.compareVersions(i,n,s))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,r=!1){return this.isBrowser(e,r)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(r=>this.is(r))}}/*! +${Cc(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const r=[];for(const i of e.split("/"))(i==null?void 0:i.length)!==0&&i!=="."&&(i===".."?r.pop():r.push(i));const n=`${e!=null&&e.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&(e!=null&&e.endsWith("/"))?"/":""}`;return fa(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,s){const i=await this.createStringToSign(e,r,s),o=new this.sha256(await n);return o.update(Eh(i)),Cc(await o.digest())}getSigningKey(e,r,n,s){return kle(this.sha256,e,n,r,s||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}}const T1=t=>{const e=Nle(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},u8=t=>Object.keys(t).sort().join(";"),Dle=t=>{let e;t.credentials&&(e=nle(t.credentials,rle,sL)),e||(t.credentialDefaultProvider?e=A1(t.credentialDefaultProvider(Object.assign({},t,{parentClientConfig:t}))):e=async()=>{throw new Error("`credentials` is missing")});const{signingEscapePath:r=!0,systemClockOffset:n=t.systemClockOffset||0,sha256:s}=t;let i;return t.signer?i=A1(t.signer):t.regionInfoProvider?i=()=>A1(t.region)().then(async o=>[await t.regionInfoProvider(o,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},o]).then(([o,a])=>{const{signingRegion:c,signingService:l}=o;t.signingRegion=t.signingRegion||c||a,t.signingName=t.signingName||l||t.serviceId;const u={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:s,uriEscapePath:r},f=t.signerConstructor||l8;return new f(u)}):i=async o=>{o=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await A1(t.region)(),properties:{}},o);const a=o.signingRegion,c=o.signingName;t.signingRegion=t.signingRegion||a,t.signingName=t.signingName||c||t.serviceId;const l={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:s,uriEscapePath:r},u=t.signerConstructor||l8;return new u(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}},Lle=(t,e)=>Oce(t,e).then(r=>e.utf8Encoder(r)),ig=(t,e)=>Lle(t,e).then(r=>{if(r.length)try{return JSON.parse(r)}catch(n){throw(n==null?void 0:n.name)==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:r}),n}return{}}),jle=async(t,e)=>{const r=await ig(t,e);return r.message=r.message??r.Message,r},Ble=(t,e)=>{const r=(i,o)=>Object.keys(i).find(a=>a.toLowerCase()===o.toLowerCase()),n=i=>{let o=i;return typeof o=="number"&&(o=o.toString()),o.indexOf(",")>=0&&(o=o.split(",")[0]),o.indexOf(":")>=0&&(o=o.split(":")[0]),o.indexOf("#")>=0&&(o=o.split("#")[1]),o},s=r(t.headers,"x-amzn-errortype");if(s!==void 0)return n(t.headers[s]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)},Fle=async(t,e,r)=>({operation:ng(e).operation,region:await Aa(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function Ule(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-idp",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function ft(t){return{schemeId:"smithy.api#noAuth"}}const Vle=t=>{const e=[];switch(t.operation){case"AssociateSoftwareToken":{e.push(ft());break}case"ChangePassword":{e.push(ft());break}case"ConfirmDevice":{e.push(ft());break}case"ConfirmForgotPassword":{e.push(ft());break}case"ConfirmSignUp":{e.push(ft());break}case"DeleteUser":{e.push(ft());break}case"DeleteUserAttributes":{e.push(ft());break}case"ForgetDevice":{e.push(ft());break}case"ForgotPassword":{e.push(ft());break}case"GetDevice":{e.push(ft());break}case"GetUser":{e.push(ft());break}case"GetUserAttributeVerificationCode":{e.push(ft());break}case"GlobalSignOut":{e.push(ft());break}case"InitiateAuth":{e.push(ft());break}case"ListDevices":{e.push(ft());break}case"ResendConfirmationCode":{e.push(ft());break}case"RespondToAuthChallenge":{e.push(ft());break}case"RevokeToken":{e.push(ft());break}case"SetUserMFAPreference":{e.push(ft());break}case"SetUserSettings":{e.push(ft());break}case"SignUp":{e.push(ft());break}case"UpdateAuthEventFeedback":{e.push(ft());break}case"UpdateDeviceStatus":{e.push(ft());break}case"UpdateUserAttributes":{e.push(ft());break}case"VerifySoftwareToken":{e.push(ft());break}case"VerifyUserAttribute":{e.push(ft());break}default:e.push(Ule(t))}return e},$le=t=>({...Dle(t)}),zle=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-idp"}),nA={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},Hle="@aws-sdk/client-cognito-identity-provider",Gle="AWS SDK for JavaScript Cognito Identity Provider Client for Node.js, Browser and React Native",qle="3.649.0",Wle={build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity-provider","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo cognito-identity-provider"},Kle="./dist-cjs/index.js",Qle="./dist-types/index.d.ts",Yle="./dist-es/index.js",Jle=!1,Xle={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.649.0","@aws-sdk/client-sts":"3.649.0","@aws-sdk/core":"3.649.0","@aws-sdk/credential-provider-node":"3.649.0","@aws-sdk/middleware-host-header":"3.649.0","@aws-sdk/middleware-logger":"3.649.0","@aws-sdk/middleware-recursion-detection":"3.649.0","@aws-sdk/middleware-user-agent":"3.649.0","@aws-sdk/region-config-resolver":"3.649.0","@aws-sdk/types":"3.649.0","@aws-sdk/util-endpoints":"3.649.0","@aws-sdk/util-user-agent-browser":"3.649.0","@aws-sdk/util-user-agent-node":"3.649.0","@smithy/config-resolver":"^3.0.6","@smithy/core":"^2.4.1","@smithy/fetch-http-handler":"^3.2.5","@smithy/hash-node":"^3.0.4","@smithy/invalid-dependency":"^3.0.4","@smithy/middleware-content-length":"^3.0.6","@smithy/middleware-endpoint":"^3.1.1","@smithy/middleware-retry":"^3.0.16","@smithy/middleware-serde":"^3.0.4","@smithy/middleware-stack":"^3.0.4","@smithy/node-config-provider":"^3.1.5","@smithy/node-http-handler":"^3.2.0","@smithy/protocol-http":"^4.1.1","@smithy/smithy-client":"^3.3.0","@smithy/types":"^3.4.0","@smithy/url-parser":"^3.0.4","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.16","@smithy/util-defaults-mode-node":"^3.0.16","@smithy/util-endpoints":"^2.1.0","@smithy/util-middleware":"^3.0.4","@smithy/util-retry":"^3.0.4","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},Zle={"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},eue={node:">=16.0.0"},tue={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},rue=["dist-*/**"],nue={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},sue="Apache-2.0",iue={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},oue="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity-provider",aue={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity-provider"},cue={name:Hle,description:Gle,version:qle,scripts:Wle,main:Kle,types:Qle,module:Yle,sideEffects:Jle,dependencies:Xle,devDependencies:Zle,engines:eue,typesVersions:tue,files:rue,author:nue,license:sue,browser:iue,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:oue,repository:aue},lue=t=>new TextEncoder().encode(t);var uue=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:lue;function pp(t){return t instanceof Uint8Array?t:typeof t=="string"?uue(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}function L2(t){return typeof t=="string"?t.length===0:t.byteLength===0}var dL={name:"SHA-256"},f8={name:"HMAC",hash:dL},fue=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const due={};function dv(){return typeof window<"u"?window:typeof self<"u"?self:due}var hue=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!L2(e)){var r=pp(e),n=new Uint8Array(this.toHash.byteLength+r.byteLength);n.set(this.toHash,0),n.set(r,this.toHash.byteLength),this.toHash=n}},t.prototype.digest=function(){var e=this;return this.key?this.key.then(function(r){return dv().crypto.subtle.sign(f8,r,e.toHash).then(function(n){return new Uint8Array(n)})}):L2(this.toHash)?Promise.resolve(fue):Promise.resolve().then(function(){return dv().crypto.subtle.digest(dL,e.toHash)}).then(function(r){return Promise.resolve(new Uint8Array(r))})},t.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(r,n){dv().crypto.subtle.importKey("raw",pp(e.secret),f8,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}();function pue(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{l(n.next(u))}catch(f){o(f)}}function c(u){try{l(n.throw(u))}catch(f){o(f)}}function l(u){u.done?i(u.value):s(u.value).then(a,c)}l((n=n.apply(t,e||[])).next())})}function yue(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return c([l,u])}}function c(l){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(r=0)),r;)try{if(n=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,s=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]xue)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[r++],n--,this.bufferLength===is&&(this.hashBuffer(),this.bufferLength=0)},t.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,r=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(r.setUint8(this.bufferLength++,128),n%is>=is-8){for(var s=this.bufferLength;s>>24&255,i[s*4+1]=this.state[s]>>>16&255,i[s*4+2]=this.state[s]>>>8&255,i[s*4+3]=this.state[s]>>>0&255;return i},t.prototype.hashBuffer=function(){for(var e=this,r=e.buffer,n=e.state,s=n[0],i=n[1],o=n[2],a=n[3],c=n[4],l=n[5],u=n[6],f=n[7],d=0;d>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=this.temp[d-15];var y=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(y+this.temp[d-16]|0)}var g=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(f+(mue[d]+this.temp[d]|0)|0)|0,m=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&i^s&o^i&o)|0;f=u,u=l,l=c,c=a+g|0,a=o,o=i,i=s,s=g+m|0}n[0]+=s,n[1]+=i,n[2]+=o,n[3]+=a,n[4]+=c,n[5]+=l,n[6]+=u,n[7]+=f},t}(),bue=function(){function t(e){this.secret=e,this.hash=new hv,this.reset()}return t.prototype.update=function(e){if(!(L2(e)||this.error))try{this.hash.update(pp(e))}catch(r){this.error=r}},t.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},t.prototype.digest=function(){return pue(this,void 0,void 0,function(){return yue(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new hv,this.secret){this.outer=new hv;var e=wue(this.secret),r=new Uint8Array(is);r.set(e);for(var n=0;nis){var r=new hv;r.update(e),e=r.digest()}var n=new Uint8Array(is);return n.set(e),n}var Eue=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function Sue(t){if(Cue(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return Aue(e)}return!1}function Cue(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function Aue(t){return t&&Eue.every(function(e){return typeof t[e]=="function"})}var kue=function(){function t(e){Sue(dv())?this.hash=new hue(e):this.hash=new bue(e)}return t.prototype.update=function(e,r){this.hash.update(pp(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}();const Tue={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},hL={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Vt={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Qr={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Bo={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class te{static getFirstMatch(e,r){const n=r.match(e);return n&&n.length>0&&n[1]||""}static getSecondMatch(e,r){const n=r.match(e);return n&&n.length>1&&n[2]||""}static matchAndReturnConst(e,r,n){if(e.test(r))return n}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const r=e.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),r[0]===10)switch(r[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const r=e.split(".").splice(0,2).map(n=>parseInt(n,10)||0);if(r.push(0),!(r[0]===1&&r[1]<5)){if(r[0]===1&&r[1]<6)return"Cupcake";if(r[0]===1&&r[1]>=6)return"Donut";if(r[0]===2&&r[1]<2)return"Eclair";if(r[0]===2&&r[1]===2)return"Froyo";if(r[0]===2&&r[1]>2)return"Gingerbread";if(r[0]===3)return"Honeycomb";if(r[0]===4&&r[1]<1)return"Ice Cream Sandwich";if(r[0]===4&&r[1]<4)return"Jelly Bean";if(r[0]===4&&r[1]>=4)return"KitKat";if(r[0]===5)return"Lollipop";if(r[0]===6)return"Marshmallow";if(r[0]===7)return"Nougat";if(r[0]===8)return"Oreo";if(r[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,r,n=!1){const s=te.getVersionPrecision(e),i=te.getVersionPrecision(r);let o=Math.max(s,i),a=0;const c=te.map([e,r],l=>{const u=o-te.getVersionPrecision(l),f=l+new Array(u+1).join(".0");return te.map(f.split("."),d=>new Array(20-d.length).join("0")+d).reverse()});for(n&&(a=o-Math.min(s,i)),o-=1;o>=a;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===a)return 0;o-=1}else if(c[0][o]{n[c]=o[c]})}return e}static getBrowserAlias(e){return Tue[e]}static getBrowserTypeByAlias(e){return hL[e]||""}}const ct=/version\/(\d+(\.?_?\d+)+)/i,Pue=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},r=te.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},r=te.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},r=te.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},r=te.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},r=te.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},r=te.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},r=te.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},r=te.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=te.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},r=te.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},r=te.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},r=te.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},r=te.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},r=te.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},r=te.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},r=te.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},r=te.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},r=te.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},r=te.getFirstMatch(ct,t)||te.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},r=te.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},r=te.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},r=te.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},r=te.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},r=te.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},r=te.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},r=te.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},r=te.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},r=te.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e={name:"Android Browser"},r=te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},r=te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},r=te.getFirstMatch(ct,t);return r&&(e.version=r),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,r=/^(.*)\/(.*)[ \t]\((.*)/,s=t.search("\\(")!==-1?r:e;return{name:te.getFirstMatch(s,t),version:te.getSecondMatch(s,t)}}}],Rue=[{test:[/Roku\/DVP/],describe(t){const e=te.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Qr.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=te.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Qr.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=te.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=te.getWindowsVersionName(e);return{name:Qr.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Qr.iOS},r=te.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe(t){const e=te.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=te.getMacOSVersionName(e),n={name:Qr.MacOS,version:e};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=te.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Qr.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e=te.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=te.getAndroidVersionName(e),n={name:Qr.Android,version:e};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=te.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:Qr.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=te.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||te.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||te.getFirstMatch(/\bbb(\d+)/i,t);return{name:Qr.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=te.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Qr.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=te.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Qr.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Qr.Linux}}},{test:[/CrOS/],describe(){return{name:Qr.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=te.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Qr.PlayStation4,version:e}}}],Iue=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(t){const e=te.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:Vt.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:Vt.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:Vt.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:Vt.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:Vt.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:Vt.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:Vt.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe(t){const e=te.getFirstMatch(/(ipod|iphone)/i,t);return{type:Vt.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:Vt.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:Vt.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:Vt.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:Vt.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:Vt.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:Vt.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:Vt.mobile}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:Vt.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:Vt.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:Vt.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:Vt.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:Vt.tv}}}],Oue=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:Bo.Blink};const r=te.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Bo.EdgeHTML,version:r}}},{test:[/trident/i],describe(t){const e={name:Bo.Trident},r=te.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:Bo.Presto},r=te.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe(t){const e={name:Bo.Gecko},r=te.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Bo.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:Bo.WebKit},r=te.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];class d8{constructor(e,r=!1){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},r!==!0&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=te.find(Pue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=te.find(Rue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:r}=this.getOS();return e?String(r).toLowerCase()||"":r||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:r}=this.getPlatform();return e?String(r).toLowerCase()||"":r||""}parsePlatform(){this.parsedResult.platform={};const e=te.find(Iue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=te.find(Oue,r=>{if(typeof r.test=="function")return r.test(this);if(r.test instanceof Array)return r.test.some(n=>this.test(n));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return te.assign({},this.parsedResult)}satisfies(e){const r={};let n=0;const s={};let i=0;if(Object.keys(e).forEach(a=>{const c=e[a];typeof c=="string"?(s[a]=c,i+=1):typeof c=="object"&&(r[a]=c,n+=1)}),n>0){const a=Object.keys(r),c=te.find(a,u=>this.isOS(u));if(c){const u=this.satisfies(r[c]);if(u!==void 0)return u}const l=te.find(a,u=>this.isPlatform(u));if(l){const u=this.satisfies(r[l]);if(u!==void 0)return u}}if(i>0){const a=Object.keys(s),c=te.find(a,l=>this.isBrowser(l,!0));if(c!==void 0)return this.compareVersion(s[c])}}isBrowser(e,r=!1){const n=this.getBrowserName().toLowerCase();let s=e.toLowerCase();const i=te.getBrowserTypeByAlias(s);return r&&i&&(s=i.toLowerCase()),s===n}compareVersion(e){let r=[0],n=e,s=!1;const i=this.getBrowserVersion();if(typeof i=="string")return e[0]===">"||e[0]==="<"?(n=e.substr(1),e[1]==="="?(s=!0,n=e.substr(2)):r=[],e[0]===">"?r.push(1):r.push(-1)):e[0]==="="?n=e.substr(1):e[0]==="~"&&(s=!0,n=e.substr(1)),r.indexOf(te.compareVersions(i,n,s))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,r=!1){return this.isBrowser(e,r)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(r=>this.is(r))}}/*! * Bowser - a browser detector * https://github.com/lancedikson/bowser * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2019 - */class pL{static getParser(e,r=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new d8(e,r)}static parse(e){return new d8(e).getResult()}static get BROWSER_MAP(){return hL}static get ENGINE_MAP(){return Bo}static get OS_MAP(){return Qr}static get PLATFORMS_MAP(){return Vt}}const Oue=({serviceId:t,clientVersion:e})=>async()=>{var s,i,o,a,c;const r=typeof window<"u"&&((s=window==null?void 0:window.navigator)!=null&&s.userAgent)?pL.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${((i=r==null?void 0:r.os)==null?void 0:i.name)||"other"}`,(o=r==null?void 0:r.os)==null?void 0:o.version],["lang/js"],["md/browser",`${((a=r==null?void 0:r.browser)==null?void 0:a.name)??"unknown"}_${((c=r==null?void 0:r.browser)==null?void 0:c.version)??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n},_ue=t=>()=>Promise.reject(t),h8=typeof TextEncoder=="function"?new TextEncoder:null,Nue=t=>{if(typeof t=="string"){if(h8)return h8.encode(t).byteLength;let e=t.length;for(let r=e-1;r>=0;r--){const n=t.charCodeAt(r);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&r--}return e}else{if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size}throw new Error(`Body Length computation failed for ${t}`)},yL="required",fi="fn",di="argv",gd="ref",p8=!0,y8="isSet",yp="booleanEquals",Hl="error",Vd="endpoint",Ri="tree",sA="PartitionResult",v8={[yL]:!1,type:"String"},m8={[yL]:!0,default:!1,type:"Boolean"},g8={[gd]:"Endpoint"},vL={[fi]:yp,[di]:[{[gd]:"UseFIPS"},!0]},mL={[fi]:yp,[di]:[{[gd]:"UseDualStack"},!0]},Ws={},x8={[fi]:"getAttr",[di]:[{[gd]:sA},"supportsFIPS"]},b8={[fi]:yp,[di]:[!0,{[fi]:"getAttr",[di]:[{[gd]:sA},"supportsDualStack"]}]},w8=[vL],E8=[mL],S8=[{[gd]:"Region"}],Mue={version:"1.0",parameters:{Region:v8,UseDualStack:m8,UseFIPS:m8,Endpoint:v8},rules:[{conditions:[{[fi]:y8,[di]:[g8]}],rules:[{conditions:w8,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Hl},{conditions:E8,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Hl},{endpoint:{url:g8,properties:Ws,headers:Ws},type:Vd}],type:Ri},{conditions:[{[fi]:y8,[di]:S8}],rules:[{conditions:[{[fi]:"aws.partition",[di]:S8,assign:sA}],rules:[{conditions:[vL,mL],rules:[{conditions:[{[fi]:yp,[di]:[p8,x8]},b8],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Hl}],type:Ri},{conditions:w8,rules:[{conditions:[{[fi]:yp,[di]:[x8,p8]}],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri},{error:"FIPS is enabled but this partition does not support FIPS",type:Hl}],type:Ri},{conditions:E8,rules:[{conditions:[b8],rules:[{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri},{error:"DualStack is enabled but this partition does not support DualStack",type:Hl}],type:Ri},{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri}],type:Ri},{error:"Invalid Configuration: Missing Region",type:Hl}]},Due=Mue,Lue=(t,e={})=>fae(Due,{endpointParams:t,logger:e.logger});k0.aws=HD;const jue=t=>({apiVersion:"2016-04-18",base64Decoder:(t==null?void 0:t.base64Decoder)??ZC,base64Encoder:(t==null?void 0:t.base64Encoder)??tL,disableHostPrefix:(t==null?void 0:t.disableHostPrefix)??!1,endpointProvider:(t==null?void 0:t.endpointProvider)??Lue,extensions:(t==null?void 0:t.extensions)??[],httpAuthSchemeProvider:(t==null?void 0:t.httpAuthSchemeProvider)??Ule,httpAuthSchemes:(t==null?void 0:t.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new cle},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Xce}],logger:(t==null?void 0:t.logger)??new ZD,serviceId:(t==null?void 0:t.serviceId)??"Cognito Identity Provider",urlParser:(t==null?void 0:t.urlParser)??T0,utf8Decoder:(t==null?void 0:t.utf8Decoder)??ed,utf8Encoder:(t==null?void 0:t.utf8Encoder)??eL}),Bue=["in-region","cross-region","mobile","standard","legacy"],Fue=({defaultsMode:t}={})=>lle(async()=>{const e=typeof t=="function"?await t():t;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve(Uue()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e==null?void 0:e.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Bue.join(", ")}, got ${e}`)}}),Uue=()=>{var r,n;const t=typeof window<"u"&&((r=window==null?void 0:window.navigator)!=null&&r.userAgent)?pL.parse(window.navigator.userAgent):void 0,e=(n=t==null?void 0:t.platform)==null?void 0:n.type;return e==="tablet"||e==="mobile"},Vue=t=>{const e=Fue(t),r=()=>e().then(Dce),n=jue(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:(t==null?void 0:t.bodyLengthChecker)??Nue,credentialDefaultProvider:(t==null?void 0:t.credentialDefaultProvider)??(s=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(t==null?void 0:t.defaultUserAgentProvider)??Oue({serviceId:n.serviceId,clientVersion:aue.version}),maxAttempts:(t==null?void 0:t.maxAttempts)??P0,region:(t==null?void 0:t.region)??_ue("Region is missing"),requestHandler:eA.create((t==null?void 0:t.requestHandler)??r),retryMode:(t==null?void 0:t.retryMode)??(async()=>(await r()).retryMode||Qae),sha256:(t==null?void 0:t.sha256)??Aue,streamCollector:(t==null?void 0:t.streamCollector)??Ace,useDualstackEndpoint:(t==null?void 0:t.useDualstackEndpoint)??(()=>Promise.resolve(Cae)),useFipsEndpoint:(t==null?void 0:t.useFipsEndpoint)??(()=>Promise.resolve(Aae))}},$ue=t=>{let e=async()=>{if(t.region===void 0)throw new Error("Region is missing from runtimeConfig");const r=t.region;return typeof r=="string"?r:r()};return{setRegion(r){e=r},region(){return e}}},zue=t=>({region:t.region()}),Hue=t=>{const e=t.httpAuthSchemes;let r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(s){const i=e.findIndex(o=>o.schemeId===s.schemeId);i===-1?e.push(s):e.splice(i,1,s)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(s){r=s},httpAuthSchemeProvider(){return r},setCredentials(s){n=s},credentials(){return n}}},Gue=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()}),P1=t=>t,que=(t,e)=>{const r={...P1($ue(t)),...P1(Uce(t)),...P1(_oe(t)),...P1(Hue(t))};return e.forEach(n=>n.configure(r)),{...t,...zue(r),...Vce(r),...Noe(r),...Gue(r)}};class Wue extends gce{constructor(...[e]){const r=Vue(e||{}),n=$le(r),s=qoe(n),i=mce(s),o=kae(i),a=o,c=zae(a),l=Vle(c),u=que(l,(e==null?void 0:e.extensions)||[]);super(u),this.config=u,this.middlewareStack.use(Sae(this.config)),this.middlewareStack.use(Wce(this.config)),this.middlewareStack.use(ile(this.config)),this.middlewareStack.use(joe(this.config)),this.middlewareStack.use(Uoe(this.config)),this.middlewareStack.use(Goe(this.config)),this.middlewareStack.use(Gae(this.config,{httpAuthSchemeParametersProvider:Ble,identityProviderConfigProvider:async f=>new Jce({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(Yce(this.config))}destroy(){super.destroy()}}class Re extends tA{constructor(e){super(e),Object.setPrototypeOf(this,Re.prototype)}}class iA extends Re{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,iA.prototype)}}class oA extends Re{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,oA.prototype)}}class aA extends Re{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,aA.prototype)}}class cA extends Re{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,cA.prototype)}}class lA extends Re{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,lA.prototype)}}class uA extends Re{constructor(e){super({name:"UserImportInProgressException",$fault:"client",...e}),this.name="UserImportInProgressException",this.$fault="client",Object.setPrototypeOf(this,uA.prototype)}}class fA extends Re{constructor(e){super({name:"UserNotFoundException",$fault:"client",...e}),this.name="UserNotFoundException",this.$fault="client",Object.setPrototypeOf(this,fA.prototype)}}class dA extends Re{constructor(e){super({name:"InvalidLambdaResponseException",$fault:"client",...e}),this.name="InvalidLambdaResponseException",this.$fault="client",Object.setPrototypeOf(this,dA.prototype)}}class hA extends Re{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,hA.prototype)}}class pA extends Re{constructor(e){super({name:"TooManyFailedAttemptsException",$fault:"client",...e}),this.name="TooManyFailedAttemptsException",this.$fault="client",Object.setPrototypeOf(this,pA.prototype)}}class yA extends Re{constructor(e){super({name:"UnexpectedLambdaException",$fault:"client",...e}),this.name="UnexpectedLambdaException",this.$fault="client",Object.setPrototypeOf(this,yA.prototype)}}class og extends Re{constructor(e){super({name:"UserLambdaValidationException",$fault:"client",...e}),this.name="UserLambdaValidationException",this.$fault="client",Object.setPrototypeOf(this,og.prototype)}}class vA extends Re{constructor(e){super({name:"CodeDeliveryFailureException",$fault:"client",...e}),this.name="CodeDeliveryFailureException",this.$fault="client",Object.setPrototypeOf(this,vA.prototype)}}class mA extends Re{constructor(e){super({name:"InvalidPasswordException",$fault:"client",...e}),this.name="InvalidPasswordException",this.$fault="client",Object.setPrototypeOf(this,mA.prototype)}}class gA extends Re{constructor(e){super({name:"InvalidSmsRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidSmsRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,gA.prototype)}}class xA extends Re{constructor(e){super({name:"InvalidSmsRoleTrustRelationshipException",$fault:"client",...e}),this.name="InvalidSmsRoleTrustRelationshipException",this.$fault="client",Object.setPrototypeOf(this,xA.prototype)}}class bA extends Re{constructor(e){super({name:"PreconditionNotMetException",$fault:"client",...e}),this.name="PreconditionNotMetException",this.$fault="client",Object.setPrototypeOf(this,bA.prototype)}}class wA extends Re{constructor(e){super({name:"UnsupportedUserStateException",$fault:"client",...e}),this.name="UnsupportedUserStateException",this.$fault="client",Object.setPrototypeOf(this,wA.prototype)}}class EA extends Re{constructor(e){super({name:"UsernameExistsException",$fault:"client",...e}),this.name="UsernameExistsException",this.$fault="client",Object.setPrototypeOf(this,EA.prototype)}}class SA extends Re{constructor(e){super({name:"AliasExistsException",$fault:"client",...e}),this.name="AliasExistsException",this.$fault="client",Object.setPrototypeOf(this,SA.prototype)}}class CA extends Re{constructor(e){super({name:"InvalidUserPoolConfigurationException",$fault:"client",...e}),this.name="InvalidUserPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,CA.prototype)}}class AA extends Re{constructor(e){super({name:"MFAMethodNotFoundException",$fault:"client",...e}),this.name="MFAMethodNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AA.prototype)}}class kA extends Re{constructor(e){super({name:"PasswordResetRequiredException",$fault:"client",...e}),this.name="PasswordResetRequiredException",this.$fault="client",Object.setPrototypeOf(this,kA.prototype)}}class TA extends Re{constructor(e){super({name:"UserNotConfirmedException",$fault:"client",...e}),this.name="UserNotConfirmedException",this.$fault="client",Object.setPrototypeOf(this,TA.prototype)}}class PA extends Re{constructor(e){super({name:"UserPoolAddOnNotEnabledException",$fault:"client",...e}),this.name="UserPoolAddOnNotEnabledException",this.$fault="client",Object.setPrototypeOf(this,PA.prototype)}}class RA extends Re{constructor(e){super({name:"InvalidEmailRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidEmailRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,RA.prototype)}}class IA extends Re{constructor(e){super({name:"CodeMismatchException",$fault:"client",...e}),this.name="CodeMismatchException",this.$fault="client",Object.setPrototypeOf(this,IA.prototype)}}class OA extends Re{constructor(e){super({name:"ExpiredCodeException",$fault:"client",...e}),this.name="ExpiredCodeException",this.$fault="client",Object.setPrototypeOf(this,OA.prototype)}}class _A extends Re{constructor(e){super({name:"PasswordHistoryPolicyViolationException",$fault:"client",...e}),this.name="PasswordHistoryPolicyViolationException",this.$fault="client",Object.setPrototypeOf(this,_A.prototype)}}class NA extends Re{constructor(e){super({name:"SoftwareTokenMFANotFoundException",$fault:"client",...e}),this.name="SoftwareTokenMFANotFoundException",this.$fault="client",Object.setPrototypeOf(this,NA.prototype)}}class MA extends Re{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,MA.prototype)}}class DA extends Re{constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,DA.prototype)}}class LA extends Re{constructor(e){super({name:"GroupExistsException",$fault:"client",...e}),this.name="GroupExistsException",this.$fault="client",Object.setPrototypeOf(this,LA.prototype)}}class jA extends Re{constructor(e){super({name:"DuplicateProviderException",$fault:"client",...e}),this.name="DuplicateProviderException",this.$fault="client",Object.setPrototypeOf(this,jA.prototype)}}class BA extends Re{constructor(e){super({name:"UserPoolTaggingException",$fault:"client",...e}),this.name="UserPoolTaggingException",this.$fault="client",Object.setPrototypeOf(this,BA.prototype)}}class FA extends Re{constructor(e){super({name:"InvalidOAuthFlowException",$fault:"client",...e}),this.name="InvalidOAuthFlowException",this.$fault="client",Object.setPrototypeOf(this,FA.prototype)}}class UA extends Re{constructor(e){super({name:"ScopeDoesNotExistException",$fault:"client",...e}),this.name="ScopeDoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,UA.prototype)}}class VA extends Re{constructor(e){super({name:"UnsupportedIdentityProviderException",$fault:"client",...e}),this.name="UnsupportedIdentityProviderException",this.$fault="client",Object.setPrototypeOf(this,VA.prototype)}}const C8=t=>({...t,...t.Value&&{Value:ur}}),gL=t=>({...t,...t.AccessToken&&{AccessToken:ur},...t.RefreshToken&&{RefreshToken:ur},...t.IdToken&&{IdToken:ur}}),Kue=t=>({...t,...t.AuthParameters&&{AuthParameters:ur},...t.ClientId&&{ClientId:ur},...t.UserContextData&&{UserContextData:ur}}),Que=t=>({...t,...t.Session&&{Session:ur},...t.AuthenticationResult&&{AuthenticationResult:gL(t.AuthenticationResult)}}),Yue=t=>({...t,...t.ClientId&&{ClientId:ur},...t.Session&&{Session:ur},...t.ChallengeResponses&&{ChallengeResponses:ur},...t.UserContextData&&{UserContextData:ur}}),Jue=t=>({...t,...t.Session&&{Session:ur},...t.AuthenticationResult&&{AuthenticationResult:gL(t.AuthenticationResult)}});class $A extends Re{constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),this.name="UnauthorizedException",this.$fault="client",Object.setPrototypeOf(this,$A.prototype)}}class zA extends Re{constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),this.name="UnsupportedOperationException",this.$fault="client",Object.setPrototypeOf(this,zA.prototype)}}class HA extends Re{constructor(e){super({name:"UnsupportedTokenTypeException",$fault:"client",...e}),this.name="UnsupportedTokenTypeException",this.$fault="client",Object.setPrototypeOf(this,HA.prototype)}}class GA extends Re{constructor(e){super({name:"EnableSoftwareTokenMFAException",$fault:"client",...e}),this.name="EnableSoftwareTokenMFAException",this.$fault="client",Object.setPrototypeOf(this,GA.prototype)}}const Xue=t=>({...t,...t.ClientId&&{ClientId:ur},...t.SecretHash&&{SecretHash:ur},...t.Username&&{Username:ur},...t.Password&&{Password:ur},...t.UserAttributes&&{UserAttributes:t.UserAttributes.map(e=>C8(e))},...t.ValidationData&&{ValidationData:t.ValidationData.map(e=>C8(e))},...t.UserContextData&&{UserContextData:ur}}),Zue=async(t,e)=>{const r=KA("InitiateAuth");let n;return n=JSON.stringify(Ce(t)),WA(e,r,"/",void 0,n)},efe=async(t,e)=>{const r=KA("RespondToAuthChallenge");let n;return n=JSON.stringify(Ce(t)),WA(e,r,"/",void 0,n)},tfe=async(t,e)=>{const r=KA("SignUp");let n;return n=JSON.stringify(Ce(t)),WA(e,r,"/",void 0,n)},rfe=async(t,e)=>{if(t.statusCode>=300)return qA(t,e);const r=await ig(t.body,e);let n={};return n=Ce(r),{$metadata:Ie(t),...n}},nfe=async(t,e)=>{if(t.statusCode>=300)return qA(t,e);const r=await ig(t.body,e);let n={};return n=Ce(r),{$metadata:Ie(t),...n}},sfe=async(t,e)=>{if(t.statusCode>=300)return qA(t,e);const r=await ig(t.body,e);let n={};return n=Ce(r),{$metadata:Ie(t),...n}},qA=async(t,e)=>{const r={...t,body:await Lle(t.body,e)},n=jle(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentityprovider#InternalErrorException":throw await pfe(r);case"InvalidParameterException":case"com.amazonaws.cognitoidentityprovider#InvalidParameterException":throw await gfe(r);case"NotAuthorizedException":case"com.amazonaws.cognitoidentityprovider#NotAuthorizedException":throw await Afe(r);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentityprovider#ResourceNotFoundException":throw await Rfe(r);case"TooManyRequestsException":case"com.amazonaws.cognitoidentityprovider#TooManyRequestsException":throw await Nfe(r);case"UserImportInProgressException":case"com.amazonaws.cognitoidentityprovider#UserImportInProgressException":throw await Ufe(r);case"UserNotFoundException":case"com.amazonaws.cognitoidentityprovider#UserNotFoundException":throw await Hfe(r);case"InvalidLambdaResponseException":case"com.amazonaws.cognitoidentityprovider#InvalidLambdaResponseException":throw await vfe(r);case"LimitExceededException":case"com.amazonaws.cognitoidentityprovider#LimitExceededException":throw await Sfe(r);case"TooManyFailedAttemptsException":case"com.amazonaws.cognitoidentityprovider#TooManyFailedAttemptsException":throw await _fe(r);case"UnexpectedLambdaException":case"com.amazonaws.cognitoidentityprovider#UnexpectedLambdaException":throw await Dfe(r);case"UserLambdaValidationException":case"com.amazonaws.cognitoidentityprovider#UserLambdaValidationException":throw await Vfe(r);case"CodeDeliveryFailureException":case"com.amazonaws.cognitoidentityprovider#CodeDeliveryFailureException":throw await ofe(r);case"InvalidPasswordException":case"com.amazonaws.cognitoidentityprovider#InvalidPasswordException":throw await xfe(r);case"InvalidSmsRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleAccessPolicyException":throw await bfe(r);case"InvalidSmsRoleTrustRelationshipException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleTrustRelationshipException":throw await wfe(r);case"PreconditionNotMetException":case"com.amazonaws.cognitoidentityprovider#PreconditionNotMetException":throw await Pfe(r);case"UnsupportedUserStateException":case"com.amazonaws.cognitoidentityprovider#UnsupportedUserStateException":throw await Ffe(r);case"UsernameExistsException":case"com.amazonaws.cognitoidentityprovider#UsernameExistsException":throw await $fe(r);case"AliasExistsException":case"com.amazonaws.cognitoidentityprovider#AliasExistsException":throw await ife(r);case"InvalidUserPoolConfigurationException":case"com.amazonaws.cognitoidentityprovider#InvalidUserPoolConfigurationException":throw await Efe(r);case"MFAMethodNotFoundException":case"com.amazonaws.cognitoidentityprovider#MFAMethodNotFoundException":throw await Cfe(r);case"PasswordResetRequiredException":case"com.amazonaws.cognitoidentityprovider#PasswordResetRequiredException":throw await Tfe(r);case"UserNotConfirmedException":case"com.amazonaws.cognitoidentityprovider#UserNotConfirmedException":throw await zfe(r);case"UserPoolAddOnNotEnabledException":case"com.amazonaws.cognitoidentityprovider#UserPoolAddOnNotEnabledException":throw await Gfe(r);case"InvalidEmailRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidEmailRoleAccessPolicyException":throw await yfe(r);case"CodeMismatchException":case"com.amazonaws.cognitoidentityprovider#CodeMismatchException":throw await afe(r);case"ExpiredCodeException":case"com.amazonaws.cognitoidentityprovider#ExpiredCodeException":throw await ffe(r);case"PasswordHistoryPolicyViolationException":case"com.amazonaws.cognitoidentityprovider#PasswordHistoryPolicyViolationException":throw await kfe(r);case"SoftwareTokenMFANotFoundException":case"com.amazonaws.cognitoidentityprovider#SoftwareTokenMFANotFoundException":throw await Ofe(r);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentityprovider#ConcurrentModificationException":throw await cfe(r);case"ForbiddenException":case"com.amazonaws.cognitoidentityprovider#ForbiddenException":throw await dfe(r);case"GroupExistsException":case"com.amazonaws.cognitoidentityprovider#GroupExistsException":throw await hfe(r);case"DuplicateProviderException":case"com.amazonaws.cognitoidentityprovider#DuplicateProviderException":throw await lfe(r);case"UserPoolTaggingException":case"com.amazonaws.cognitoidentityprovider#UserPoolTaggingException":throw await qfe(r);case"InvalidOAuthFlowException":case"com.amazonaws.cognitoidentityprovider#InvalidOAuthFlowException":throw await mfe(r);case"ScopeDoesNotExistException":case"com.amazonaws.cognitoidentityprovider#ScopeDoesNotExistException":throw await Ife(r);case"UnsupportedIdentityProviderException":case"com.amazonaws.cognitoidentityprovider#UnsupportedIdentityProviderException":throw await Lfe(r);case"UnauthorizedException":case"com.amazonaws.cognitoidentityprovider#UnauthorizedException":throw await Mfe(r);case"UnsupportedOperationException":case"com.amazonaws.cognitoidentityprovider#UnsupportedOperationException":throw await jfe(r);case"UnsupportedTokenTypeException":case"com.amazonaws.cognitoidentityprovider#UnsupportedTokenTypeException":throw await Bfe(r);case"EnableSoftwareTokenMFAException":case"com.amazonaws.cognitoidentityprovider#EnableSoftwareTokenMFAException":throw await ufe(r);default:const s=r.body;return Wfe({output:t,parsedBody:s,errorCode:n})}},ife=async(t,e)=>{const r=t.body,n=Ce(r),s=new SA({$metadata:Ie(t),...n});return Ne(s,r)},ofe=async(t,e)=>{const r=t.body,n=Ce(r),s=new vA({$metadata:Ie(t),...n});return Ne(s,r)},afe=async(t,e)=>{const r=t.body,n=Ce(r),s=new IA({$metadata:Ie(t),...n});return Ne(s,r)},cfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new MA({$metadata:Ie(t),...n});return Ne(s,r)},lfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new jA({$metadata:Ie(t),...n});return Ne(s,r)},ufe=async(t,e)=>{const r=t.body,n=Ce(r),s=new GA({$metadata:Ie(t),...n});return Ne(s,r)},ffe=async(t,e)=>{const r=t.body,n=Ce(r),s=new OA({$metadata:Ie(t),...n});return Ne(s,r)},dfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new DA({$metadata:Ie(t),...n});return Ne(s,r)},hfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new LA({$metadata:Ie(t),...n});return Ne(s,r)},pfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new iA({$metadata:Ie(t),...n});return Ne(s,r)},yfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new RA({$metadata:Ie(t),...n});return Ne(s,r)},vfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new dA({$metadata:Ie(t),...n});return Ne(s,r)},mfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new FA({$metadata:Ie(t),...n});return Ne(s,r)},gfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new oA({$metadata:Ie(t),...n});return Ne(s,r)},xfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new mA({$metadata:Ie(t),...n});return Ne(s,r)},bfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new gA({$metadata:Ie(t),...n});return Ne(s,r)},wfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new xA({$metadata:Ie(t),...n});return Ne(s,r)},Efe=async(t,e)=>{const r=t.body,n=Ce(r),s=new CA({$metadata:Ie(t),...n});return Ne(s,r)},Sfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new hA({$metadata:Ie(t),...n});return Ne(s,r)},Cfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new AA({$metadata:Ie(t),...n});return Ne(s,r)},Afe=async(t,e)=>{const r=t.body,n=Ce(r),s=new aA({$metadata:Ie(t),...n});return Ne(s,r)},kfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new _A({$metadata:Ie(t),...n});return Ne(s,r)},Tfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new kA({$metadata:Ie(t),...n});return Ne(s,r)},Pfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new bA({$metadata:Ie(t),...n});return Ne(s,r)},Rfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new cA({$metadata:Ie(t),...n});return Ne(s,r)},Ife=async(t,e)=>{const r=t.body,n=Ce(r),s=new UA({$metadata:Ie(t),...n});return Ne(s,r)},Ofe=async(t,e)=>{const r=t.body,n=Ce(r),s=new NA({$metadata:Ie(t),...n});return Ne(s,r)},_fe=async(t,e)=>{const r=t.body,n=Ce(r),s=new pA({$metadata:Ie(t),...n});return Ne(s,r)},Nfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new lA({$metadata:Ie(t),...n});return Ne(s,r)},Mfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new $A({$metadata:Ie(t),...n});return Ne(s,r)},Dfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new yA({$metadata:Ie(t),...n});return Ne(s,r)},Lfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new VA({$metadata:Ie(t),...n});return Ne(s,r)},jfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new zA({$metadata:Ie(t),...n});return Ne(s,r)},Bfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new HA({$metadata:Ie(t),...n});return Ne(s,r)},Ffe=async(t,e)=>{const r=t.body,n=Ce(r),s=new wA({$metadata:Ie(t),...n});return Ne(s,r)},Ufe=async(t,e)=>{const r=t.body,n=Ce(r),s=new uA({$metadata:Ie(t),...n});return Ne(s,r)},Vfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new og({$metadata:Ie(t),...n});return Ne(s,r)},$fe=async(t,e)=>{const r=t.body,n=Ce(r),s=new EA({$metadata:Ie(t),...n});return Ne(s,r)},zfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new TA({$metadata:Ie(t),...n});return Ne(s,r)},Hfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new fA({$metadata:Ie(t),...n});return Ne(s,r)},Gfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new PA({$metadata:Ie(t),...n});return Ne(s,r)},qfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new BA({$metadata:Ie(t),...n});return Ne(s,r)},Ie=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),Wfe=Nce(Re),WA=async(t,e,r,n,s)=>{const{hostname:i,protocol:o="https",port:a,path:c}=await t.endpoint(),l={protocol:o,hostname:i,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+r:c+r,headers:e};return n!==void 0&&(l.hostname=n),s!==void 0&&(l.body=s),new Vn(l)};function KA(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${t}`}}class Kfe extends sg.classBuilder().ep({...nA}).m(function(e,r,n,s){return[JC(n,this.serialize,this.deserialize),XC(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","InitiateAuth",{}).n("CognitoIdentityProviderClient","InitiateAuthCommand").f(Kue,Que).ser(Zue).de(rfe).build(){}class Qfe extends sg.classBuilder().ep({...nA}).m(function(e,r,n,s){return[JC(n,this.serialize,this.deserialize),XC(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","RespondToAuthChallenge",{}).n("CognitoIdentityProviderClient","RespondToAuthChallengeCommand").f(Yue,Jue).ser(efe).de(nfe).build(){}class Yfe extends sg.classBuilder().ep({...nA}).m(function(e,r,n,s){return[JC(n,this.serialize,this.deserialize),XC(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","SignUp",{}).n("CognitoIdentityProviderClient","SignUpCommand").f(Xue,void 0).ser(tfe).de(sfe).build(){}class ih extends Error{}ih.prototype.name="InvalidTokenError";function Jfe(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function Xfe(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Jfe(e)}catch{return atob(e)}}function xL(t,e){if(typeof t!="string")throw new ih("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new ih(`Invalid token specified: missing part #${r+1}`);let s;try{s=Xfe(n)}catch(i){throw new ih(`Invalid token specified: invalid base64 for part #${r+1} (${i.message})`)}try{return JSON.parse(s)}catch(i){throw new ih(`Invalid token specified: invalid json for part #${r+1} (${i.message})`)}}function tr(){return tr=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[s]=t[s]);return r}const Zfe=["signatures"],ede=1,tde=`${ede} (Web ${uoe})`;function Rr(t,e,r){const n=Math.floor(Date.now()/1e3),s=n+e;return{version:tde,issuedAt:n,expiresAt:s,name:t,data:r}}async function rde(t,e){const r=nde(e),n=await t.sign(new Uint8Array(r));return tr({},e,{signatures:[{sessionId:await t.sessionId(),signature:n}]})}function nde(t){const{version:e,issuedAt:r,expiresAt:n,name:s,data:i}=t,a=Sr(foe({version:e,issuedAt:r,expiresAt:n,name:s,data:i}));return fe(Ct(a))}function sde(t,e){const r=Pr(t,Zfe),n=t.expiresAt-t.issuedAt;return r.issuedAt=Math.floor(e.getTime()/1e3),r.expiresAt=r.issuedAt+n,r}let Ir=function(t){return t.initiateAuth="initiateAuth",t.openSession="openSession",t.closeSession="closeSession",t.validateSession="validateSession",t.finishValidateSession="finishValidateSession",t.listSessions="listSessions",t.getSession="getSession",t.sessionAuthProof="sessionAuthProof",t.feeOptions="feeOptions",t.signMessage="signMessage",t.sendTransaction="sendTransaction",t.getTransactionReceipt="getTransactionReceipt",t.federateAccount="federateAccount",t.removeAccount="removeAccount",t.listAccounts="listAccounts",t.getIdToken="getIdToken",t}({}),xd=function(t){return t.authInitiated="authInitiated",t.sessionOpened="sessionOpened",t.sessionClosed="sessionClosed",t.sessionList="sessionList",t.validationRequired="validationRequired",t.validationStarted="validationStarted",t.validationFinished="validationFinished",t.sessionAuthProof="sessionAuthProof",t.signedMessage="signedMessage",t.feeOptions="feeOptions",t.transactionReceipt="transactionReceipt",t.transactionFailed="transactionFailed",t.getSessionResponse="getSessionResponse",t.accountList="accountList",t.accountFederated="accountFederated",t.accountRemoved="accountRemoved",t.idToken="idToken",t}({}),eb=function(t){return t.unknown="unknown",t.erc20Token="erc20Token",t.erc1155Token="erc1155Token",t}({}),Ft=function(t){return t.None="None",t.Guest="Guest",t.OIDC="OIDC",t.Email="Email",t.PlayFab="PlayFab",t.Stytch="Stytch",t}({});function ide({wallet:t,chainId:e,message:r,lifespan:n}){return Rr(Ir.signMessage,n,{wallet:t,network:e.toString(),message:r.startsWith("0x")?r:ne(Sr(r))})}const ode=["lifespan"],ade=["lifespan"],cde=["lifespan"],lde=["lifespan"],ude=["lifespan"],fde=["lifespan"],dde=["lifespan"],hde=["lifespan"],pde=["lifespan"];async function $d(t){let{lifespan:e}=t,r=Pr(t,ode);return Rr(Ir.initiateAuth,e,r)}async function A8(t){let{lifespan:e}=t,r=Pr(t,ade);return Rr(Ir.openSession,e,r)}async function yde(t){let{lifespan:e}=t,r=Pr(t,cde);return Rr(Ir.validateSession,e,r)}function vde(t){let{lifespan:e}=t,r=Pr(t,lde);return Rr(Ir.finishValidateSession,e,r)}function k8(t){let{lifespan:e}=t,r=Pr(t,ude);return Rr(Ir.closeSession,e,r)}function mde(t){let{lifespan:e}=t,r=Pr(t,fde);return Rr(Ir.listSessions,e,r)}function gde(t){let{lifespan:e}=t,r=Pr(t,dde);return Rr(Ir.getSession,e,r)}function xde(t){let{lifespan:e}=t,r=Pr(t,hde);return Rr(Ir.sessionAuthProof,e,r)}function bde(t){let{lifespan:e}=t,r=Pr(t,pde);return Rr(Ir.getIdToken,e,r)}const wde=["token","to","value"],Ede=["token","to","id","safe","data"],Sde=["token","to","values","data"],Cde=["to","value","abi","func","args"];function Ade({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:s}){return Rr(Ir.feeOptions,t,{identifier:r,wallet:e,network:n.toString(),transactions:s.map(i=>{if(!i.to||i.to===vl)throw new Error("Contract creation not supported");return wL(i)?{type:"transaction",to:i.to,value:GC(BigInt(i.value||0)),data:ne(i.data||"0x")}:i})})}function Cy({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:s,transactionsFeeQuote:i,transactionsFeeOption:o}){return Rr(Ir.sendTransaction,t,{identifier:r,wallet:e,network:n.toString(),transactions:kde(s,o).map(a=>{if(!a.to||a.to===vl)throw new Error("Contract creation not supported");return wL(a)?{type:"transaction",to:a.to,value:GC(BigInt(a.value||0)),data:ne(a.data||"0x")}:a}),transactionsFeeQuote:i})}function kde(t,e){const r=[...t];if(e)switch(e.token.type){case eb.unknown:r.push({to:e.to,value:e.value});break;case eb.erc20Token:if(!e.token.contractAddress)throw new Error("contract address is required");r.push(QA({tokenAddress:e.token.contractAddress,to:e.to,value:e.value}));break;case eb.erc1155Token:if(!e.token.contractAddress)throw new Error("contract address is required");if(!e.token.tokenID)throw new Error("token ID is required");r.push(YA({tokenAddress:e.token.contractAddress,to:e.to,vals:[{id:e.token.tokenID,amount:e.value}]}));break}return r}function Tde({lifespan:t,chainId:e,wallet:r,metaTxHash:n}){return Rr(Ir.getTransactionReceipt,t,{wallet:r,network:e.toString(),metaTxHash:n})}function Pde(t){let{token:e,to:r,value:n}=t,s=Pr(t,wde);return Cy(tr({transactions:[QA({tokenAddress:e,to:r,value:n.toString()})]},s))}function Rde(t){let{token:e,to:r,id:n,safe:s,data:i}=t,o=Pr(t,Ede);return Cy(tr({transactions:[_de({tokenAddress:e,to:r,id:n,data:i,safe:s})]},o))}function Ide(t){let{token:e,to:r,values:n,data:s}=t,i=Pr(t,Sde);const o=n.map(a=>({id:a.id,amount:BigInt(a.amount).toString()}));return Cy(tr({transactions:[YA({tokenAddress:e,to:r,vals:o,data:s})]},i))}function Ode(t){let{to:e,value:r,abi:n,func:s,args:i}=t,o=Pr(t,Cde);return Cy(tr({transactions:[bL({to:e,value:BigInt(r).toString(),data:{abi:n,func:s,args:i}})]},o))}function QA(t){const e=t,r=t;if(e.token!==void 0)return{type:"erc20send",tokenAddress:e.token,to:e.to,value:e.value.toString()};if(r.tokenAddress!==void 0)return tr({type:"erc20send"},r);throw new Error("Invalid ERC20 transaction")}function _de(t){const e=t,r=t;if(e.token!==void 0)return{type:"erc721send",tokenAddress:e.token,to:e.to,id:e.id,data:e.data,safe:e.safe};if(r.tokenAddress!==void 0)return tr({type:"erc721send"},r);throw new Error("Invalid ERC721 transaction")}function YA(t){const e=t,r=t;if(e.values!==void 0)return{type:"erc1155send",vals:e.values.map(n=>({id:n.id,amount:n.amount.toString()})),tokenAddress:e.token,to:e.to,data:e.data};if(r.vals!==void 0)return{type:"erc1155send",vals:r.vals.map(n=>({id:n.id,amount:n.amount})),tokenAddress:r.tokenAddress,to:r.to,data:r.data};throw new Error("Invalid ERC1155 transaction")}function bL(t){const e=t,r=t;if(e.abi!==void 0)return{type:"delayedEncode",to:e.to,value:GC(BigInt(e.value)),data:{abi:e.abi,func:e.func,args:e.args}};if(r.data!==void 0)return{type:"delayedEncode",to:r.to,value:r.value,data:r.data};throw new Error("Invalid delayed encode transaction")}function Nde(t){if(t.length===0)throw new Error("No packets provided");const e=t[0].data.network,r=t[0].data.wallet,n=t[0].expiresAt-t[0].issuedAt,s=t[0].data.identifier,i=t[0].data.transactionsFeeQuote;if(!t.every(o=>o.data.network===e))throw new Error("All packets must have the same chainId");if(!t.every(o=>o.data.wallet===r))throw new Error("All packets must have the same wallet");return Rr(Ir.sendTransaction,n,{network:e,wallet:r,identifier:s,transactions:t.flatMap(o=>o.data.transactions),transactionsFeeQuote:i})}function wL(t){return!["transaction","erc20send","erc721send","erc1155send","delayedEncode"].includes(t.type)}class pv{constructor(e,r,n){this.store=e,this.key=r,this.defaultValue=n}async get(){const e=await this.store.get(this.key);return e||this.defaultValue}async set(e){e?await this.store.set(this.key,e):await this.store.set(this.key,null)}}class EL{constructor(){this.store=void 0,I0.isAvailable()?this.store=new I0:this.store=new Mde}async get(e){return this.store.get(e)}async set(e,r){return this.store.set(e,r)}}class I0{static isAvailable(){return typeof window=="object"&&typeof window.localStorage=="object"}constructor(){if(!I0.isAvailable())throw new Error("No localStorage")}async get(e){return window.localStorage.getItem(e)}async set(e,r){r?window.localStorage.setItem(e,r):window.localStorage.removeItem(e)}}class Mde{constructor(){this.store={},this.store={}}async get(e){return this.store[e]||null}async set(e,r){r?this.store[e]=r:delete this.store[e]}}const j2="seq-waas-session-p256k1",B2="seq-waas-session";async function SL(t,e){const r=await e.get(j2,B2,t);if(!r)throw new Error("No private key found");const n=new up(r);return{sessionId(){return n.getAddress()},sign(s){return n.signMessage(s)},clear:async()=>{await e.delete(j2,B2,t)}}}async function Dde(t,e){const n=await new up(t).getAddress();return await e.set(j2,B2,n,t),SL(n,e)}async function Lde(t){const e=up.createRandom();return Dde(e.privateKey,t)}let CL=function(t){return t[t.ECDSAP256K1=0]="ECDSAP256K1",t[t.ECDSAP256R1=1]="ECDSAP256R1",t}({});const F2="seq-waas-session-p256r1",U2="seq-waas-session";async function AL(t,e,r){const n=await r.get(F2,U2,t);if(!n||!n.privateKey)throw new Error("No private key found");const s=new TextEncoder;return{sessionId:async()=>{const i=await e.exportKey("raw",n.publicKey),o=new Uint8Array(i.byteLength+1);return o[0]=CL.ECDSAP256R1,o.set(new Uint8Array(i),1),ne(o)},sign:async i=>{typeof i=="string"&&(i.startsWith("0x")?(i=i.slice(2),i=fe(i)):i=s.encode(i));const o=await e.sign({name:"ECDSA",hash:{name:"SHA-256"}},n.privateKey,i);return ne(new Uint8Array(o))},clear:async()=>{await r.delete(F2,U2,t)}}}async function jde(t,e,r){const n=await Fde(e,t.publicKey);return await r.set(F2,U2,n,t),AL(n,e,r)}async function Bde(t,e){const r=await t.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"]);return jde(r,t,e)}async function Fde(t,e){const r=await t.exportKey("raw",e),n=new Uint8Array(r.byteLength+1);return n[0]=CL.ECDSAP256R1,n.set(new Uint8Array(r),1),ne(n)}async function V2(t,e,r){if(!r)throw new Error("No secure store available");return e?AL(t,e,r):SL(t,r)}async function Ude(t,e){if(!e)throw new Error("No secure store available");return t?Bde(t,e):Lde(e)}const Vde=["lifespan"],$de=["lifespan"],zde=["lifespan"];function Hde(t){let{lifespan:e}=t,r=Pr(t,Vde);return Rr(Ir.listAccounts,e,r)}function Gde(t){let{lifespan:e}=t,r=Pr(t,$de);return Rr(Ir.federateAccount,e,r)}function qde(t){let{lifespan:e}=t,r=Pr(t,zde);return Rr(Ir.removeAccount,e,r)}const $2=Object.entries(S0).reduce((t,[e,r])=>(t[r.name]=r.chainId,t),{}),Wde=Object.entries($2).reduce((t,[e,r])=>(t[r]=e,t),{});function tb(t){const e=typeof t=="number"?t:parseInt(t);if(e in Wde)return e;const r=t.toString().toLowerCase();if(r in $2)return $2[r];throw new Error(`Unknown network: ${t}`)}const kL=()=>TL()?new Kde:null;function TL(){return typeof window=="object"&&typeof window.crypto=="object"&&typeof window.crypto.subtle=="object"}class Kde{constructor(){if(!TL())throw new Error("window.crypto.subtle is not available")}generateKey(e,r,n){return window.crypto.subtle.generateKey(e,r,n)}importKey(e,r,n,s,i){return window.crypto.subtle.importKey(e,r,n,s,i)}async exportKey(e,r){const n=await window.crypto.subtle.exportKey(e,r);return new Uint8Array(n)}async digest(e,r){const n=await window.crypto.subtle.digest(e,r);return new Uint8Array(n)}async sign(e,r,n){const s=await window.crypto.subtle.sign(e,r,n);return new Uint8Array(s)}verify(e,r,n,s){return window.crypto.subtle.verify(e,r,n,s)}getRandomValues(e){const r=new Uint8Array(e);return window.crypto.getRandomValues(r)}}const PL=()=>RL()?new Qde:null;function RL(){return typeof indexedDB=="object"}class Qde{constructor(){if(this.db=void 0,!RL())throw new Error("IndexedDB is not available");this.db=null}async openDB(e,r,n){return this.db?this.db:(this.db=await Roe(e,1,{upgrade(s){s.createObjectStore(r)}}),this.db)}async get(e,r,n){const s=await this.openDB(e,r,1),i=s.transaction(r,"readonly"),o=await s.get(r,n);return await i.done,o}async set(e,r,n,s){const i=await this.openDB(e,r,1),o=i.transaction(r,"readwrite");return await i.put(r,s,n),await o.done,!0}async delete(e,r,n){const s=await this.openDB(e,r,1),i=s.transaction(r,"readwrite");return await s.delete(r,n),await i.done,!0}}const Yde="@0xsequence.waas.wallet",Jde="@0xsequence.waas.session_id",Xde="@0xsequence.waas.status",Xt=5*60;class Zde{constructor(e={network:1},r=new EL,n=kL(),s=PL()){this.config=e,this.store=r,this.cryptoBackend=n,this.secureStoreBackend=s,this.status=void 0,this.sessionId=void 0,this.wallet=void 0,this.sessionObservers=[],this.gettingSessionIdPromise=void 0,this.status=new pv(this.store,Xde,"signed-out"),this.sessionId=new pv(this.store,Jde,void 0),this.wallet=new pv(this.store,Yde,void 0)}async getAddress(){return this.getWalletAddress()}async getWalletAddress(){if(!await this.isSignedIn())throw new Error("Not signed in");const e=await this.wallet.get();if(!e)throw new Error("No wallet");return e}async commonArgs(e){var r;return tr({},e,{identifier:e==null?void 0:e.identifier,wallet:await this.getWalletAddress(),lifespan:(r=e==null?void 0:e.lifespan)!=null?r:Xt,chainId:tb(e.network||this.config.network)})}async signIntent(e){const r=await this.getSessionId();if(r===void 0)throw new Error("session not open");const n=await V2(r,this.cryptoBackend,this.secureStoreBackend);return rde(n,e)}async signUsingSessionKey(e){const r=await this.getSessionId();if(!r)throw new Error("session not open");return(await V2(r,this.cryptoBackend,this.secureStoreBackend)).sign(e)}async getSessionId(){var e=this;if(this.gettingSessionIdPromise)return this.gettingSessionIdPromise;const r=async function(){let s=await e.sessionId.get();return s||(s=await(await Ude(e.cryptoBackend,e.secureStoreBackend)).sessionId(),await e.sessionId.set(s),e.signalObservers(e.sessionObservers,s)),e.gettingSessionIdPromise=void 0,s};return this.gettingSessionIdPromise=r(),this.gettingSessionIdPromise}async signInWithIdToken(e){if(await this.status.get()!=="signed-out")throw await this.completeSignOut(),new Error("you are already signed in");const n=await this.getSessionId(),s=await A8({sessionId:n,identityType:Ft.None,idToken:e,lifespan:Xt});return await this.status.set("pending"),this.signIntent(s)}async initiateGuestAuth(){const e=await this.getSessionId(),r=await $d({sessionId:e,identityType:Ft.Guest,verifier:e,lifespan:Xt});return this.signIntent(r)}async initiateEmailAuth(e){const r=await this.getSessionId(),n=await $d({sessionId:r,identityType:Ft.Email,verifier:`${e};${r}`,lifespan:Xt});return this.signIntent(n)}async initiateIdTokenAuth(e,r){const n=await this.getSessionId(),s=Cr(e),i=await $d({sessionId:n,identityType:Ft.OIDC,verifier:`${s};${r}`,lifespan:Xt});return this.signIntent(i)}async initiateStytchAuth(e,r){const n=await this.getSessionId(),s=Cr(e),i=await $d({sessionId:n,identityType:Ft.Stytch,verifier:`${s};${r}`,lifespan:Xt});return this.signIntent(i)}async initiatePlayFabAuth(e,r){const n=await this.getSessionId(),s=Cr(r),i=await $d({sessionId:n,identityType:Ft.PlayFab,verifier:`${e}|${s}`,lifespan:Xt});return this.signIntent(i)}async completeAuth(e,r){const n=await this.getSessionId(),s=await A8(tr({},r,{sessionId:n,lifespan:Xt},e));return await this.status.set("pending"),this.signIntent(s)}onSessionStateChanged(e){return this.sessionObservers.push(e),()=>{this.sessionObservers=this.sessionObservers.filter(r=>r!=e)}}async signOut({lifespan:e,sessionId:r}={}){if(r=r||await this.sessionId.get(),!r)throw new Error("session not open");const n=k8({lifespan:e||Xt,sessionId:r});return this.signIntent(n)}async signOutSession(e){const r=k8({lifespan:Xt,sessionId:e});return this.signIntent(r)}async listSessions(){const e=mde({lifespan:Xt,wallet:await this.getWalletAddress()});return this.signIntent(e)}async completeSignOut(){await Promise.all([this.status.set("signed-out"),this.wallet.set(void 0),this.sessionId.set(void 0)]),this.signalObservers(this.sessionObservers,null)}async completeSignIn(e){if(e.result)return this.completeSignIn(e.result);const r=await this.status.get();if(e.code!=="sessionOpened")throw new Error("Invalid receipt");if(r!=="pending")throw new Error("No pending sign in");return await Promise.all([this.status.set("signed-in"),this.wallet.set(e.data.wallet)]),e.data.wallet}async isSignedIn(){return await this.status.get()==="signed-in"}async sessionAuthProof(e){var r;const n=xde({lifespan:(r=e.lifespan)!=null?r:Xt,network:tb(e.network||this.config.network).toString(),wallet:await this.getWalletAddress(),nonce:e.nonce});return this.signIntent(n)}async signMessage(e){var r;const n=ide(tr({chainId:tb(e.network||this.config.network)},e,{lifespan:(r=e.lifespan)!=null?r:Xt,wallet:await this.getWalletAddress()}));return this.signIntent(n)}async sendTransaction(e){const r=Cy(await this.commonArgs(e));return this.signIntent(r)}async getTransactionReceipt(e){const r=Tde(await this.commonArgs(e));return this.signIntent(r)}async sendERC20(e){if(e.token.toLowerCase()===e.to.toLowerCase())throw new Error("Cannot burn tokens using sendERC20");const r=Pde(await this.commonArgs(e));return this.signIntent(r)}async sendERC721(e){if(e.token.toLowerCase()===e.to.toLowerCase())throw new Error("Cannot burn tokens using sendERC721");const r=Rde(await this.commonArgs(e));return this.signIntent(r)}async sendERC1155(e){if(e.token.toLowerCase()===e.to.toLowerCase())throw new Error("Cannot burn tokens using sendERC1155");const r=Ide(await this.commonArgs(e));return this.signIntent(r)}async callContract(e){const r=Ode(await this.commonArgs(e));return this.signIntent(r)}async feeOptions(e){const r=Ade(await this.commonArgs(e));return this.signIntent(r)}async validateSession({deviceMetadata:e}){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=await yde({lifespan:Xt,sessionId:r,deviceMetadata:e,wallet:await this.getWalletAddress()});return this.signIntent(n)}async getSession(){const e=await this.sessionId.get();if(!e)throw new Error("session not open");const r=gde({sessionId:e,wallet:await this.getWalletAddress(),lifespan:Xt});return this.signIntent(r)}async finishValidateSession(e,r){const n=await this.sessionId.get();if(!n)throw new Error("session not open");const s=await this.getWalletAddress(),i=vde({sessionId:n,wallet:s,lifespan:Xt,salt:e,challenge:r});return this.signIntent(i)}async listAccounts(){const e=Hde({wallet:await this.getWalletAddress(),lifespan:Xt});return this.signIntent(e)}async linkAccount(e){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=Gde(tr({wallet:await this.getWalletAddress(),lifespan:Xt,sessionId:r},e));return this.signIntent(n)}async removeAccount({accountId:e}){const r=qde({wallet:await this.getWalletAddress(),lifespan:Xt,accountId:e});return this.signIntent(r)}async getIdToken({nonce:e}){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=bde({wallet:await this.getWalletAddress(),lifespan:Xt,sessionId:r,nonce:e});return this.signIntent(n)}async batch(e){const r=Nde(e);return this.signIntent(r)}signalObservers(e,r){e.forEach(n=>n(r))}async updateIntentTime(e,r){const n=sde(e,r);return this.signIntent(n)}}class ehe{constructor(e,r){this.hostname=void 0,this.fetch=void 0,this.path="/rpc/WaasAuthenticator/",this.registerSession=(n,s,i)=>this.fetch(this.url("RegisterSession"),rb(n,s,i)).then(o=>nb(o).then(a=>({session:a.session,response:a.response})),o=>{throw yv.new({cause:`fetch(): ${o.message||""}`})}),this.sendIntent=(n,s,i)=>this.fetch(this.url("SendIntent"),rb(n,s,i)).then(o=>nb(o).then(a=>({response:a.response})),o=>{throw yv.new({cause:`fetch(): ${o.message||""}`})}),this.chainList=(n,s)=>this.fetch(this.url("ChainList"),rb({},n,s)).then(i=>nb(i).then(o=>({chains:o.chains})),i=>{throw yv.new({cause:`fetch(): ${i.message||""}`})}),this.hostname=e,this.fetch=(n,s)=>r(n,s)}url(e){return this.hostname+this.path+e}}const rb=(t={},e={},r=null)=>({method:"POST",headers:tr({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),nb=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let s="";throw n instanceof Error&&(s=n.message),LL.new({status:t.status,cause:`JSON.parse(): ${s}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(fhe[n]||Yt).new(r)}return r});let Yt=class IL extends Error{constructor(e,r,n,s,i){super(n),this.name=void 0,this.code=void 0,this.message=void 0,this.status=void 0,this.cause=void 0,this.msg=void 0,this.name=e||"WebrpcError",this.code=typeof r=="number"?r:0,this.message=n||`endpoint error ${this.code}`,this.msg=this.message,this.status=typeof s=="number"?s:0,this.cause=i,Object.setPrototypeOf(this,IL.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}},the=class OL extends Yt{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,OL.prototype)}},yv=class _L extends Yt{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,_L.prototype)}},rhe=class NL extends Yt{constructor(e="WebrpcBadRoute",r=-2,n="bad route",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,NL.prototype)}},nhe=class ML extends Yt{constructor(e="WebrpcBadMethod",r=-3,n="bad method",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ML.prototype)}},she=class DL extends Yt{constructor(e="WebrpcBadRequest",r=-4,n="bad request",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,DL.prototype)}},LL=class jL extends Yt{constructor(e="WebrpcBadResponse",r=-5,n="bad response",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,jL.prototype)}},ihe=class BL extends Yt{constructor(e="WebrpcServerPanic",r=-6,n="server panic",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,BL.prototype)}},ohe=class FL extends Yt{constructor(e="WebrpcInternalError",r=-7,n="internal error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,FL.prototype)}},ahe=class UL extends Yt{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,UL.prototype)}},che=class VL extends Yt{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,VL.prototype)}},lhe=class $L extends Yt{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,$L.prototype)}},uhe=class zL extends Yt{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,zL.prototype)}};class JA extends Yt{constructor(e="TenantNotFound",r=1001,n="Tenant not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,JA.prototype)}}class vp extends Yt{constructor(e="EmailAlreadyInUse",r=7e3,n="Could not create account as the email is already in use",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,vp.prototype)}}class XA extends Yt{constructor(e="AccountAlreadyLinked",r=7001,n="Could not link account as it is linked to another wallet",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,XA.prototype)}}class ZA extends Yt{constructor(e="ProofVerificationFailed",r=7002,n="The authentication proof could not be verified",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ZA.prototype)}}class mp extends Yt{constructor(e="AnswerIncorrect",r=7003,n="The provided answer is incorrect",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,mp.prototype)}}class ek extends Yt{constructor(e="ChallengeExpired",r=7004,n="The challenge has expired",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ek.prototype)}}class tk extends Yt{constructor(e="TooManyAttempts",r=7005,n="Too many attempts",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,tk.prototype)}}const fhe={0:the,[-1]:yv,[-2]:rhe,[-3]:nhe,[-4]:she,[-5]:LL,[-6]:ihe,[-7]:ohe,[-8]:ahe,[-9]:che,[-10]:lhe,1e3:uhe,1001:JA,7e3:vp,7001:XA,7002:ZA,7003:mp,7004:ek,7005:tk};function R1(t){return typeof t=="object"&&t.code===xd.authInitiated&&typeof t.data=="object"&&typeof t.data.sessionId=="string"&&typeof t.data.identityType=="string"&&typeof t.data.expiresIn=="number"}function Ay(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="transactionReceipt"&&typeof t.data=="object"&&typeof t.data.txHash=="string"&&typeof t.data.receipt=="object"&&typeof t.data.request=="object"}function HL(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="transactionReceipt"&&typeof t.data=="object"&&typeof t.data.metaTxHash=="string"&&!t.data.txHash&&typeof t.data.request=="object"}function dhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="transactionFailed"&&typeof t.data=="object"&&typeof t.data.request=="object"&&Array.isArray(t.data.simulations)&&typeof t.data.error=="string"}function T8(t){return Ay(t)||dhe(t)||HL(t)}function hhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="signedMessage"&&typeof t.data=="object"&&typeof t.data.message=="string"&&typeof t.data.signature=="string"}function phe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="sessionAuthProof"&&typeof t.data=="object"&&typeof t.data.sessionId=="string"&&typeof t.data.network=="string"&&typeof t.data.wallet=="string"&&typeof t.data.message=="string"&&typeof t.data.signature=="string"}function yhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="feeOptions"&&typeof t.data=="object"&&Array.isArray(t.data.feeOptions)}function vhe(t){return typeof t=="object"&&t.code===xd.validationRequired&&typeof t.data=="object"&&typeof t.data.sessionId=="string"}function mhe(t){return typeof t=="object"&&t.code===xd.validationFinished&&typeof t.data=="object"}function ghe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="sessionClosed"}function xhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="getSessionResponse"&&typeof t.data=="object"&&typeof t.data.session=="string"&&typeof t.data.wallet=="string"}function bhe(t){return typeof t=="object"&&t.code===xd.accountFederated&&typeof t.data=="object"&&typeof t.data.account=="object"}function whe(t){return typeof t=="object"&&t.code===xd.accountList&&typeof t.data=="object"}function P8(t){var e,r;return!!(t instanceof Yt&&((e=t.cause)!=null&&e.endsWith("intent is invalid: intent expired")||(r=t.cause)!=null&&r.endsWith("intent is invalid: intent issued in the future")))}function Ehe(t){return typeof t=="object"&&t.code===xd.idToken&&typeof t.data=="object"&&typeof t.data.idToken=="string"}class She{constructor(e,r){this.region=e,this.clientId=r,this.cognitoMemo=void 0}cognito(){return this.cognitoMemo||(this.cognitoMemo=new Wue({region:this.region})),this.cognitoMemo}signUp(e){return e=e.toLowerCase().trim(),this.cognito().send(new Yfe({ClientId:this.clientId,Username:e,Password:"aB1%"+Che(14),UserAttributes:[{Name:"email",Value:e}]}))}signIn(e){return e=e.toLowerCase().trim(),this.cognito().send(new Kfe({AuthFlow:"CUSTOM_AUTH",ClientId:this.clientId,AuthParameters:{USERNAME:e}}))}async initiateAuth({email:e}){let r;e=e.toLowerCase().trim();try{r=await this.signIn(e)}catch(n){if(n instanceof og&&n.message.includes("user not found"))await this.signUp(e),r=await this.signIn(e);else throw n}if(!r.Session)throw new Error("response session is empty");return{instance:r.Session,email:e}}async finalizeAuth({instance:e,email:r,answer:n,sessionHash:s}){r=r.toLowerCase().trim();const i=await this.cognito().send(new Qfe({ClientId:this.clientId,Session:e,ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:{USERNAME:r,ANSWER:n},ClientMetadata:{SESSION_HASH:s}}));if(!i.AuthenticationResult||!i.AuthenticationResult.IdToken)throw new Error("AuthenticationResult.IdToken is empty");return{idToken:i.AuthenticationResult.IdToken}}}function Che(t){return Array.from(Ahe(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}function Ahe(t){const e=new Uint8Array(t);if(typeof window=="object"&&typeof window.crypto=="object")return window.crypto.getRandomValues(e);{console.warn("window.crypto.getRandomValues is not available. Falling back to less secure Math.random().");const r=new Uint8Array(t);for(let n=0;n{if(this.signatureVerificationFailed)throw new Error("Signature verification failed");if(this.cryptoBackend&&this.config.disableHttpSignatureCheck!==!0&&a!=null&&a.headers){const l={};l["Accept-Signature"]='sig=();alg="rsa-v1_5-sha256"',a.headers=tr({},a.headers,l)}const c=Ohe(o,a);return this.cryptoBackend&&this.config.disableHttpSignatureCheck!==!0&&c.then(async function(l){try{var u,f;const h=await l.clone().text(),p=l.headers.get("Content-Digest"),y=l.headers.get("Signature-Input"),g=l.headers.get("Signature");if(!p)throw new Error("Content-Digest header not set");if(!y)throw new Error("Signature-Input header not set");if(!g)throw new Error("Signature header not set");const m=(u=p.match(":(.*):"))==null?void 0:u[1];if(!m)throw new Error("Content digest not found");const x=new TextEncoder().encode(h),b=await i.cryptoBackend.digest("SHA-256",x),w=btoa(String.fromCharCode(...b));if(m!==w)throw new Error("Digest mismatch");const A=`"content-digest": ${p} -"@signature-params": ${y.substring(4)}`,O={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},_=l.url.includes("dev-waas")?_he:Nhe,C=await i.cryptoBackend.importKey("jwk",_.keys[0],O,!1,["verify"]),j=(f=g.match(":(.*):"))==null?void 0:f[1];if(!j)throw new Error("Signature not found");const V=Uint8Array.from(atob(j),z=>z.charCodeAt(0));if(!await i.cryptoBackend.verify(O,C,V,new TextEncoder().encode(A)))throw new Error("Signature verification failed, consequent requests will fail")}catch(d){throw i.signatureVerificationFailed=!0,d}}),c},this.config=Ihe(e),this.waas=new Zde(tr({network:1},e),this.store,this.cryptoBackend,this.secureStoreBackend),this.client=new ehe(this.config.rpcServer,this._fetch),this.deviceName=new pv(this.store,"@0xsequence.waas.auth.deviceName",void 0)}get email(){if(this.emailClient)return this.emailClient;if(!this.config.emailRegion)throw new Error("Missing emailRegion");if(!this.config.emailClientId)throw new Error("Missing emailClientId");return this.emailClient=new She(this.config.emailRegion,this.config.emailClientId),this.emailClient}async onValidationRequired(e){return this.validationRequiredCallback.push(e),()=>{this.validationRequiredCallback=this.validationRequiredCallback.filter(r=>r!==e)}}onEmailConflict(e){return this.emailConflictCallback.push(e),()=>{this.emailConflictCallback=this.emailConflictCallback.filter(r=>r!==e)}}onEmailAuthCodeRequired(e){return this.emailAuthCodeRequiredCallback.push(e),()=>{this.emailAuthCodeRequiredCallback=this.emailAuthCodeRequiredCallback.filter(r=>r!==e)}}async handleValidationRequired({onValidationRequired:e}={}){var r;if(!(e?e():!0))return!1;const s=await this.waas.validateSession({deviceMetadata:(r=await this.deviceName.get())!=null?r:"Unknown device"}),i=await this.sendIntent(s);this.validationRequiredSalt=i.data.salt;for(const o of this.validationRequiredCallback)o();return this.waitForSessionValid()}headers(){return{"X-Access-Key":this.config.projectAccessKey}}async sendIntent(e){if(!await this.waas.getSessionId())throw new Error("session not open");try{return(await this.client.sendIntent({intent:e},this.headers())).response}catch(n){if(P8(n)&&this.lastDate){const s=await this.waas.updateIntentTime(e,this.lastDate);return(await this.client.sendIntent({intent:s},this.headers())).response}throw n}}async isSignedIn(){return this.waas.isSignedIn()}signIn(e,r){var n=this;const s="email"in e;return s&&this.emailAuthCodeRequiredCallback.length==0?Promise.reject("Missing emailAuthCodeRequired callback"):new Promise(async function(i,o){let a;try{a=await n.initAuth(e)}catch(l){return o(l)}const c=async function(u){try{const f=await n.completeAuth(a.withAnswer(u),{sessionName:r});i(f)}catch(f){if(f instanceof mp)throw f;if(f instanceof vp){const d=async function(){try{const y=await n.completeAuth(a.withAnswer(u),{sessionName:r,forceCreateAccount:!0});i(y)}catch(y){o(y)}},h={type:Ft.None,email:"",issuer:""};if(f.cause){const p=f.cause.split("|");p.length>=2&&(h.type=p[0],h.email=p[1]),p.length>=3&&(h.issuer=p[2])}for(const p of n.emailConflictCallback)p(h,d)}else o(f)}};if(s)for(const l of n.emailAuthCodeRequiredCallback)l(c);else c("")})}async initAuth(e){if("guest"in e&&e.guest)return this.initGuestAuth();if("idToken"in e)return this.initIdTokenAuth(e.idToken);if("email"in e)return this.initEmailAuth(e.email);if("playFabTitleId"in e)return this.initPlayFabAuth(e.playFabTitleId,e.playFabSessionTicket);throw new Error("invalid identity")}async initGuestAuth(){const e=await this.waas.getSessionId(),r=await this.waas.initiateGuestAuth(),n=await this.sendIntent(r);if(!R1(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return new khe(e,n.data.challenge)}async initIdTokenAuth(e){var r;const n=xL(e),s=((r=n.iss)==null?void 0:r.startsWith("stytch.com/"))||!1,i=s?await this.waas.initiateStytchAuth(e,n.exp):await this.waas.initiateIdTokenAuth(e,n.exp),o=await this.sendIntent(i);if(!R1(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`);return s?new The(e):new GL(e)}async initEmailAuth(e){const r=await this.waas.getSessionId(),n=await this.waas.initiateEmailAuth(e),s=await this.sendIntent(n);if(!R1(s))throw new Error(`Invalid response: ${JSON.stringify(s)}`);return new rk(e,r,s.data.challenge)}async initPlayFabAuth(e,r){const n=await this.waas.initiatePlayFabAuth(e,r),s=await this.sendIntent(n);if(!R1(s))throw new Error(`Invalid response: ${JSON.stringify(s)}`);return new Phe(e,r)}async completeAuth(e,r){r||(r={}),r.sessionName||(r.sessionName="session name");const n=await this.waas.completeAuth(e.getIntentParams(),{forceCreateAccount:r.forceCreateAccount});try{const s=await this.registerSession(n,r.sessionName);return await this.waas.completeSignIn({code:"sessionOpened",data:{sessionId:s.session.id,wallet:s.response.data.wallet}}),{sessionId:s.session.id,wallet:s.response.data.wallet,email:s.session.identity.email}}catch(s){throw!(s instanceof vp)&&!(s instanceof mp)&&await this.waas.completeSignOut(),s}}async registerSession(e,r){try{return await this.client.registerSession({intent:e,friendlyName:r},this.headers())}catch(n){if(P8(n)&&this.lastDate){const s=await this.waas.updateIntentTime(e,this.lastDate);return await this.client.registerSession({intent:s,friendlyName:r},this.headers())}throw n}}async refreshSession(){throw new Error("Not implemented")}async getSessionId(){return this.waas.getSessionId()}async getSessionHash(){const e=(await this.waas.getSessionId()).toLowerCase();return Cr(e)}async dropSession({sessionId:e,strict:r}={}){const n=await this.waas.getSessionId();if(!n)throw new Error("session not open");const s=e||n;try{const i=await this.waas.signOutSession(s),o=await this.sendIntent(i);if(!ghe(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`)}catch(i){if(r)throw i;console.error(i)}if(s===n){if(!this.secureStoreBackend)throw new Error("No secure store available");(await V2(n,this.cryptoBackend,this.secureStoreBackend)).clear(),await this.waas.completeSignOut(),await this.deviceName.set(void 0)}}async listSessions(){const e=await this.waas.getSessionId();if(!e)throw new Error("session not open");const r=await this.waas.listSessions();return(await this.sendIntent(r)).data.map(s=>tr({},s,{isThis:s.id===e}))}async getAddress(){return this.waas.getAddress()}async validateSession(e){return await this.isSessionValid()?!0:this.handleValidationRequired(e)}async finishValidateSession(e){const r=await this.waas.finishValidateSession(this.validationRequiredSalt,e),n=await this.sendIntent(r);if(!mhe(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return this.validationRequiredSalt="",n.data.isValid}async isSessionValid(){const e=await this.waas.getSession(),r=await this.sendIntent(e);if(!xhe(r))throw new Error(`Invalid response: ${JSON.stringify(r)}`);return r.data.validated}async waitForSessionValid(e=6e5,r=2e3){const n=Date.now();for(;Date.now()-nsetTimeout(s,r))}return!1}async sessionAuthProof({nonce:e,network:r,validation:n}){const s=await this.waas.sessionAuthProof({nonce:e,network:r});return await this.trySendIntent({validation:n},s,phe)}async listAccounts(){const e=await this.waas.listAccounts(),r=await this.sendIntent(e);if(!whe(r))throw new Error(`Invalid response: ${JSON.stringify(r)}`);return r.data}async linkAccount(e){const r=await this.waas.linkAccount(e.getIntentParams()),n=await this.sendIntent(r);if(!bhe(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return n.data}async removeAccount(e){const r=await this.waas.removeAccount({accountId:e});await this.sendIntent(r)}async getIdToken(e){const r=await this.waas.getIdToken({nonce:e==null?void 0:e.nonce}),n=await this.sendIntent(r);if(!Ehe(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return n.data}async useIdentifier(e){if(e.identifier)return e;const r=`ts-sdk-${Date.now()}-${await this.waas.getSessionId()}`;return tr({},e,{identifier:r})}async trySendIntent(e,r,n){const s=await this.sendIntent(r);if(n(s))return s;if(vhe(s)&&await this.handleValidationRequired(e.validation)){const o=await this.sendIntent(r);if(n(o))return o}throw new Error(JSON.stringify(s))}async signMessage(e){const r=await this.waas.signMessage(await this.useIdentifier(e));return this.trySendIntent(e,r,hhe)}async trySendTransactionIntent(e,r){let n=await this.trySendIntent(r,e,T8);for(;HL(n);){await new Promise(o=>setTimeout(o,1e3));const s={metaTxHash:n.data.metaTxHash,network:e.data.network,identifier:e.data.identifier,validation:r.validation},i=await this.waas.getTransactionReceipt(await this.useIdentifier(s));n=await this.trySendIntent(s,i,T8)}return n}async sendTransaction(e){const r=await this.waas.sendTransaction(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async sendERC20(e){const r=await this.waas.sendERC20(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async sendERC721(e){const r=await this.waas.sendERC721(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async sendERC1155(e){const r=await this.waas.sendERC1155(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async callContract(e){const r=await this.waas.callContract(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async feeOptions(e){const r=await this.waas.feeOptions(await this.useIdentifier(e));return this.trySendIntent(e,r,yhe)}async networkList(){const e=[],r=await this.client.chainList({"X-Access-Key":this.config.projectAccessKey});for(const n of r.chains)e.push({id:n.id,name:n.name,isEnabled:n.isEnabled});return e}onSessionStateChanged(e){return this.waas.onSessionStateChanged(e)}async fetch(e,r){const n=await globalThis.fetch(e,r),s=n.headers.get("date");return s&&(this.lastDate=new Date(s)),n}}const Dhe=t=>{if(t.type===Ft.PlayFab)return"PlayFab login";if(t.type===Ft.Email)return"Email login";if(t.type===Ft.OIDC){if(t.issuer.includes("cognito-idp"))return"Email v1 login";switch(t.issuer){case"https://accounts.google.com":return"Google login";case"https://appleid.apple.com":return"Apple login";default:return"Unknown account type"}}return"Unknown account type"},Lhe=t=>{const{onCancel:e,onConfirm:r}=t;return k.jsxs(q,{style:{maxWidth:"600px"},flexDirection:"column",paddingX:"10",paddingY:"4",alignItems:"center",gap:"4",children:[k.jsx(q,{children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Email already in use"})}),k.jsx(q,{height:"full",children:k.jsxs(ue,{as:"div",variant:"normal",color:"text50",textAlign:"center",children:["Another account with this email address ",k.jsxs(ue,{color:"text80",children:["(",t.info.email,")"]})," already exists with account type ",k.jsxs(ue,{color:"text80",children:["(",Dhe(t.info),")"]}),". You can cancel this or force create a new account."]})}),k.jsxs(q,{flexDirection:"row",gap:"3",marginTop:"6",marginBottom:"2",children:[k.jsx(ut,{label:"Cancel",onClick:e}),k.jsx(ut,{variant:"primary",label:"Create new account",onClick:r})]})]})};function O0(){return O0=Object.assign?Object.assign.bind():function(t){for(var e=1;ethis.fetch(this.url("Ping"),dt({},n,s)).then(i=>Et(i).then(o=>({status:o.status})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.version=(n,s)=>this.fetch(this.url("Version"),dt({},n,s)).then(i=>Et(i).then(o=>({version:o.version})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.runtimeStatus=(n,s)=>this.fetch(this.url("RuntimeStatus"),dt({},n,s)).then(i=>Et(i).then(o=>({status:o.status})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.getChainID=(n,s)=>this.fetch(this.url("GetChainID"),dt({},n,s)).then(i=>Et(i).then(o=>({chainID:o.chainID})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.getEtherBalance=(n,s,i)=>this.fetch(this.url("GetEtherBalance"),dt(n,s,i)).then(o=>Et(o).then(a=>({balance:a.balance})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenBalances=(n,s,i)=>this.fetch(this.url("GetTokenBalances"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSupplies=(n,s,i)=>this.fetch(this.url("GetTokenSupplies"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,contractType:a.contractType,tokenIDs:a.tokenIDs})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSuppliesMap=(n,s,i)=>this.fetch(this.url("GetTokenSuppliesMap"),dt(n,s,i)).then(o=>Et(o).then(a=>({supplies:a.supplies})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getBalanceUpdates=(n,s,i)=>this.fetch(this.url("GetBalanceUpdates"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTransactionHistory=(n,s,i)=>this.fetch(this.url("GetTransactionHistory"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.syncBalance=(n,s,i)=>this.fetch(this.url("SyncBalance"),dt(n,s,i)).then(o=>Et(o).then(a=>({})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceipt=(n,s,i)=>this.fetch(this.url("FetchTransactionReceipt"),dt(n,s,i)).then(o=>Et(o).then(a=>({receipt:a.receipt})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getOrderbookOrders=(n,s,i)=>this.fetch(this.url("GetOrderbookOrders"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,orders:a.orders})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTopOrders=(n,s,i)=>this.fetch(this.url("GetTopOrders"),dt(n,s,i)).then(o=>Et(o).then(a=>({orders:a.orders})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceiptWithFilter=(n,s,i)=>this.fetch(this.url("FetchTransactionReceiptWithFilter"),dt(n,s,i)).then(o=>Et(o).then(a=>({receipt:a.receipt})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getAllWebhookListeners=(n,s,i)=>this.fetch(this.url("GetAllWebhookListeners"),dt(n,s,i)).then(o=>Et(o).then(a=>({listeners:a.listeners})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getWebhookListener=(n,s,i)=>this.fetch(this.url("GetWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({listener:a.listener})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.addWebhookListener=(n,s,i)=>this.fetch(this.url("AddWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status,listener:a.listener})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.updateWebhookListener=(n,s,i)=>this.fetch(this.url("UpdateWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.removeWebhookListener=(n,s,i)=>this.fetch(this.url("RemoveWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.toggleWebhookListener=(n,s,i)=>this.fetch(this.url("ToggleWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({webhookListener:a.webhookListener})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.pauseAllWebhookListeners=(n,s,i)=>this.fetch(this.url("PauseAllWebhookListeners"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.resumeAllWebhookListeners=(n,s,i)=>this.fetch(this.url("ResumeAllWebhookListeners"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.subscribeReceipts=(n,s)=>{const i=()=>this.fetch(this.url("SubscribeReceipts"),dt(n,s.headers,s.signal)).then(async function(o){await sb(o,s,i)},o=>{s.onError(o,i)});return i()},this.subscribeEvents=(n,s)=>{const i=()=>this.fetch(this.url("SubscribeEvents"),dt(n,s.headers,s.signal)).then(async function(o){await sb(o,s,i)},o=>{s.onError(o,i)});return i()},this.subscribeBalanceUpdates=(n,s)=>{const i=()=>this.fetch(this.url("SubscribeBalanceUpdates"),dt(n,s.headers,s.signal)).then(async function(o){await sb(o,s,i)},o=>{s.onError(o,i)});return i()},this.hostname=e,this.fetch=(n,s)=>r(n,s)}url(e){return this.hostname+this.path+e}}const sb=async(t,e,r)=>{const{onMessage:n,onOpen:s,onClose:i,onError:o}=e;if(!t.ok){try{await Et(t)}catch(h){o(h,r)}return}if(!t.body){o(td.new({status:t.status,cause:"Invalid response, missing body"}),r);return}s&&s();const a=t.body.getReader(),c=new TextDecoder;let l="",u=Date.now();const f=(10+1)*1e3;let d;try{for(d=setInterval(()=>{if(Date.now()-u>f)throw Lu.new({cause:"Stream timed out"})},f);;){let h,p;try{({value:h,done:p}=await a.read()),u=Date.now(),l+=c.decode(h,{stream:!0})}catch(g){let m="";g instanceof Error&&(m=g.message),g instanceof DOMException&&g.name==="AbortError"?o(lt.new({message:"AbortError",cause:`AbortError: ${m}`}),()=>{throw new Error("Abort signal cannot be used to reconnect")}):o(Lu.new({cause:`reader.read(): ${m}`}),r);return}let y=l.split(` -`);for(let g=0;g({method:"POST",headers:O0({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),Et=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let s="";throw n instanceof Error&&(s=n.message),td.new({status:t.status,cause:`JSON.parse(): ${s}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(qL[n]||nt).new(r)}return r});class nt extends Error{constructor(e,r,n,s,i){super(n),this.name=void 0,this.code=void 0,this.message=void 0,this.status=void 0,this.cause=void 0,this.msg=void 0,this.name=e||"WebrpcError",this.code=typeof r=="number"?r:0,this.message=n||`endpoint error ${this.code}`,this.msg=this.message,this.status=typeof s=="number"?s:0,this.cause=i,Object.setPrototypeOf(this,nt.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}}class nk extends nt{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,nk.prototype)}}class lt extends nt{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,lt.prototype)}}class sk extends nt{constructor(e="WebrpcBadRoute",r=-2,n="bad route",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,sk.prototype)}}class ik extends nt{constructor(e="WebrpcBadMethod",r=-3,n="bad method",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ik.prototype)}}class ok extends nt{constructor(e="WebrpcBadRequest",r=-4,n="bad request",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ok.prototype)}}class td extends nt{constructor(e="WebrpcBadResponse",r=-5,n="bad response",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,td.prototype)}}class ak extends nt{constructor(e="WebrpcServerPanic",r=-6,n="server panic",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ak.prototype)}}class ck extends nt{constructor(e="WebrpcInternalError",r=-7,n="internal error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ck.prototype)}}class lk extends nt{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,lk.prototype)}}class Lu extends nt{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Lu.prototype)}}class uk extends nt{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,uk.prototype)}}class fk extends nt{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,fk.prototype)}}class dk extends nt{constructor(e="PermissionDenied",r=1001,n="Permission denied",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,dk.prototype)}}class hk extends nt{constructor(e="SessionExpired",r=1002,n="Session expired",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,hk.prototype)}}class pk extends nt{constructor(e="MethodNotFound",r=1003,n="Method not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,pk.prototype)}}class yk extends nt{constructor(e="RequestConflict",r=1004,n="Conflict with target resource",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,yk.prototype)}}class vk extends nt{constructor(e="Aborted",r=1005,n="Request aborted",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,vk.prototype)}}class mk extends nt{constructor(e="Timeout",r=2e3,n="Request timed out",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,mk.prototype)}}class gk extends nt{constructor(e="InvalidArgument",r=2001,n="Invalid argument",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,gk.prototype)}}class xk extends nt{constructor(e="Unavailable",r=2002,n="Unavailable resource",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,xk.prototype)}}class bk extends nt{constructor(e="QueryFailed",r=2003,n="Query failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,bk.prototype)}}class wk extends nt{constructor(e="ResourceExhausted",r=2004,n="Resource exhausted",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,wk.prototype)}}class Ek extends nt{constructor(e="NotFound",r=3e3,n="Resource not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Ek.prototype)}}class Sk extends nt{constructor(e="ProjectNotFound",r=3002,n="Project not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Sk.prototype)}}class Ck extends nt{constructor(e="MetadataCallFailed",r=3003,n="Metadata service call failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Ck.prototype)}}const qL={0:nk,[-1]:lt,[-2]:sk,[-3]:ik,[-4]:ok,[-5]:td,[-6]:ak,[-7]:ck,[-8]:lk,[-9]:Lu,[-10]:uk,1e3:fk,1001:dk,1002:hk,1003:pk,1004:yk,1005:vk,2e3:mk,2001:gk,2002:xk,2003:bk,2004:wk,3e3:Ek,3002:Sk,3003:Ck},R8=globalThis.fetch;class WL extends jhe{constructor(e,r,n){super(e.endsWith("/")?e.slice(0,-1):e,R8),this.projectAccessKey=r,this.jwtAuth=n,this._fetch=(s,i)=>{const o={},a=this.jwtAuth,c=this.projectAccessKey;return a&&a.length>0&&(o.Authorization=`BEARER ${a}`),c&&c.length>0&&(o["X-Access-Key"]=c),i.headers=O0({},i.headers,o),R8(s,i)},this.fetch=this._fetch}}const I8=[..."🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐸🐵🙈🙉🙊🐒🐔🐧🐦🐤🐣🐥🦆🦅🦉🦇🐺🐗🐴🦄🐝🐛🦋🐌🐞🐜🦟🦗🕷🕸🦂🐢🐍🦎🦖🦕🐙🦑🦐🦞🦀🐡🐠🐟🐬🐳🐋🦈🐊🐅🐆🦓🦍🦧🐘🦛🦏🐪🐫🦒🦘🐃🐂🐄🐎🐖🐏🐑🦙🐐🦌🐕🐩🦮🐈🐓🦃🦚🦜🦢🦩🕊🐇🦝🦨🦡🦦🦥🐁🐀🐿🦔🐾🐉🐲🌵🎄🌲🌳🌴🌱🌿🍀🎍🎋🍃👣🍂🍁🍄🐚🌾💐🌷🌹🥀🌺🌸🌼🌻🌞🌝🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🥭🍍🥥🥝🍅🥑🥦🥬🥒🌶🌽🥕🧄🧅🥔🍠🥐🥯🍞🥖🥨🧀🥚🍳🧈🥞🧇🥓🥩🍗🍖🦴🌭🍔🍟🍕🥪🥙🧆🌮🌯🥗🥘🥫🍝🍜🍲🍛🍣🍱🥟🦪🍤🍙🍚🍘🍥🥠🥮🍢🍡🍧🍨🍦🥧🧁🍰🎂🍮🍭🍬🍫🍿🍩🍪🌰🥜👀👂👃👄👅👆👇👈👉👊👋👌👍👎👏👐👑👒👓🎯🎰🎱🎲🎳👾👯👺👻👽🏂🏃🏄"];function fc(){const e=coe.en,r=I8[Math.floor(Math.random()*I8.length)],n=e.getWord(Math.floor(Math.random()*2048)),s=e.getWord(Math.floor(Math.random()*2048));return`${r} ${n} ${s}`}const vv=t=>t.name==="AccountAlreadyLinked";function KL({onSuccess:t,sessionName:e,linkAccount:r=!1}){const n=M9(),[s,i]=v.useState(),[o,a]=v.useState(!1),[c,l]=v.useState(!1),[u,f]=v.useState(),[d,h]=v.useState();return v.useEffect(()=>Oe.onEmailAuthCodeRequired(async m=>{a(!1),f(()=>m)}),[Oe,a,f]),{inProgress:c,initiateAuth:async m=>{a(!0),l(!0);try{if(r){const x=await Oe.initAuth({email:m});h(x),a(!1)}else{const x=await Oe.signIn({email:m},e);t(x)}}catch(x){i(x.message||"Unknown error")}finally{r||(a(!1),l(!1))}},loading:o,error:s,sendChallengeAnswer:c?async m=>{if(r&&d){try{await Oe.linkAccount(d.withAnswer(m))}catch(x){vv(x)&&n({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}a(!1),l(!1);return}u&&await u(m)}:void 0,cancel:()=>{l(!1),a(!1),h(void 0),f(null)}}}const Bhe=({KEYS_TO_EXCLUDE:t=[]}={})=>{const e=(r,n)=>typeof r!=typeof n?!1:r===null||n===null?r===n:typeof r=="object"?Object.keys(r).length!==Object.keys(n).length||Object.keys(r).some(s=>!(s in n))?!1:Object.entries(r).filter(([s])=>!t.includes(s)).every(([s,i])=>e(i,n[s])):r===n;return e},Fhe=Bhe(),Uhe=(t,e)=>t===e?e:Object.keys(t).reduce((r,n)=>(n in e&&Fhe(t[n],e[n])&&(r[n]=t[n]),r),Object.assign({},e)),Vhe=t=>{const e=v.useRef(!0),[r,n]=v.useState(t);v.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]);const s=v.useCallback(i=>{e.current&&n(i)},[]);return[r,s]},QL=(t,e="StytchProvider")=>`${t} can only be used inside <${e}>.`,$he="You cannot render a inside another .",zhe=`The @stytch/react library is not meant for use with serverside environments like NextJS. + */class pL{static getParser(e,r=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new d8(e,r)}static parse(e){return new d8(e).getResult()}static get BROWSER_MAP(){return hL}static get ENGINE_MAP(){return Bo}static get OS_MAP(){return Qr}static get PLATFORMS_MAP(){return Vt}}const _ue=({serviceId:t,clientVersion:e})=>async()=>{var s,i,o,a,c;const r=typeof window<"u"&&((s=window==null?void 0:window.navigator)!=null&&s.userAgent)?pL.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${((i=r==null?void 0:r.os)==null?void 0:i.name)||"other"}`,(o=r==null?void 0:r.os)==null?void 0:o.version],["lang/js"],["md/browser",`${((a=r==null?void 0:r.browser)==null?void 0:a.name)??"unknown"}_${((c=r==null?void 0:r.browser)==null?void 0:c.version)??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n},Nue=t=>()=>Promise.reject(t),h8=typeof TextEncoder=="function"?new TextEncoder:null,Mue=t=>{if(typeof t=="string"){if(h8)return h8.encode(t).byteLength;let e=t.length;for(let r=e-1;r>=0;r--){const n=t.charCodeAt(r);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&r--}return e}else{if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size}throw new Error(`Body Length computation failed for ${t}`)},yL="required",fi="fn",di="argv",gd="ref",p8=!0,y8="isSet",yp="booleanEquals",Hl="error",Vd="endpoint",Ri="tree",sA="PartitionResult",v8={[yL]:!1,type:"String"},m8={[yL]:!0,default:!1,type:"Boolean"},g8={[gd]:"Endpoint"},vL={[fi]:yp,[di]:[{[gd]:"UseFIPS"},!0]},mL={[fi]:yp,[di]:[{[gd]:"UseDualStack"},!0]},Ws={},x8={[fi]:"getAttr",[di]:[{[gd]:sA},"supportsFIPS"]},b8={[fi]:yp,[di]:[!0,{[fi]:"getAttr",[di]:[{[gd]:sA},"supportsDualStack"]}]},w8=[vL],E8=[mL],S8=[{[gd]:"Region"}],Due={version:"1.0",parameters:{Region:v8,UseDualStack:m8,UseFIPS:m8,Endpoint:v8},rules:[{conditions:[{[fi]:y8,[di]:[g8]}],rules:[{conditions:w8,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Hl},{conditions:E8,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Hl},{endpoint:{url:g8,properties:Ws,headers:Ws},type:Vd}],type:Ri},{conditions:[{[fi]:y8,[di]:S8}],rules:[{conditions:[{[fi]:"aws.partition",[di]:S8,assign:sA}],rules:[{conditions:[vL,mL],rules:[{conditions:[{[fi]:yp,[di]:[p8,x8]},b8],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Hl}],type:Ri},{conditions:w8,rules:[{conditions:[{[fi]:yp,[di]:[x8,p8]}],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri},{error:"FIPS is enabled but this partition does not support FIPS",type:Hl}],type:Ri},{conditions:E8,rules:[{conditions:[b8],rules:[{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri},{error:"DualStack is enabled but this partition does not support DualStack",type:Hl}],type:Ri},{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dnsSuffix}",properties:Ws,headers:Ws},type:Vd}],type:Ri}],type:Ri},{error:"Invalid Configuration: Missing Region",type:Hl}]},Lue=Due,jue=new Woe({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Bue=(t,e={})=>jue.get(t,()=>dae(Lue,{endpointParams:t,logger:e.logger}));k0.aws=HD;const Fue=t=>({apiVersion:"2016-04-18",base64Decoder:(t==null?void 0:t.base64Decoder)??ZC,base64Encoder:(t==null?void 0:t.base64Encoder)??tL,disableHostPrefix:(t==null?void 0:t.disableHostPrefix)??!1,endpointProvider:(t==null?void 0:t.endpointProvider)??Bue,extensions:(t==null?void 0:t.extensions)??[],httpAuthSchemeProvider:(t==null?void 0:t.httpAuthSchemeProvider)??Vle,httpAuthSchemes:(t==null?void 0:t.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new lle},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Zce}],logger:(t==null?void 0:t.logger)??new ZD,serviceId:(t==null?void 0:t.serviceId)??"Cognito Identity Provider",urlParser:(t==null?void 0:t.urlParser)??T0,utf8Decoder:(t==null?void 0:t.utf8Decoder)??ed,utf8Encoder:(t==null?void 0:t.utf8Encoder)??eL}),Uue=["in-region","cross-region","mobile","standard","legacy"],Vue=({defaultsMode:t}={})=>ule(async()=>{const e=typeof t=="function"?await t():t;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve($ue()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e==null?void 0:e.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Uue.join(", ")}, got ${e}`)}}),$ue=()=>{var r,n;const t=typeof window<"u"&&((r=window==null?void 0:window.navigator)!=null&&r.userAgent)?pL.parse(window.navigator.userAgent):void 0,e=(n=t==null?void 0:t.platform)==null?void 0:n.type;return e==="tablet"||e==="mobile"},zue=t=>{const e=Vue(t),r=()=>e().then(Lce),n=Fue(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:(t==null?void 0:t.bodyLengthChecker)??Mue,credentialDefaultProvider:(t==null?void 0:t.credentialDefaultProvider)??(s=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(t==null?void 0:t.defaultUserAgentProvider)??_ue({serviceId:n.serviceId,clientVersion:cue.version}),maxAttempts:(t==null?void 0:t.maxAttempts)??P0,region:(t==null?void 0:t.region)??Nue("Region is missing"),requestHandler:eA.create((t==null?void 0:t.requestHandler)??r),retryMode:(t==null?void 0:t.retryMode)??(async()=>(await r()).retryMode||Yae),sha256:(t==null?void 0:t.sha256)??kue,streamCollector:(t==null?void 0:t.streamCollector)??kce,useDualstackEndpoint:(t==null?void 0:t.useDualstackEndpoint)??(()=>Promise.resolve(Aae)),useFipsEndpoint:(t==null?void 0:t.useFipsEndpoint)??(()=>Promise.resolve(kae))}},Hue=t=>{let e=async()=>{if(t.region===void 0)throw new Error("Region is missing from runtimeConfig");const r=t.region;return typeof r=="string"?r:r()};return{setRegion(r){e=r},region(){return e}}},Gue=t=>({region:t.region()}),que=t=>{const e=t.httpAuthSchemes;let r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(s){const i=e.findIndex(o=>o.schemeId===s.schemeId);i===-1?e.push(s):e.splice(i,1,s)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(s){r=s},httpAuthSchemeProvider(){return r},setCredentials(s){n=s},credentials(){return n}}},Wue=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()}),P1=t=>t,Kue=(t,e)=>{const r={...P1(Hue(t)),...P1(Vce(t)),...P1(_oe(t)),...P1(que(t))};return e.forEach(n=>n.configure(r)),{...t,...Gue(r),...$ce(r),...Noe(r),...Wue(r)}};class Que extends xce{constructor(...[e]){const r=zue(e||{}),n=zle(r),s=qoe(n),i=gce(s),o=Tae(i),a=o,c=Hae(a),l=$le(c),u=Kue(l,(e==null?void 0:e.extensions)||[]);super(u),this.config=u,this.middlewareStack.use(Cae(this.config)),this.middlewareStack.use(Kce(this.config)),this.middlewareStack.use(ole(this.config)),this.middlewareStack.use(joe(this.config)),this.middlewareStack.use(Uoe(this.config)),this.middlewareStack.use(Goe(this.config)),this.middlewareStack.use(qae(this.config,{httpAuthSchemeParametersProvider:Fle,identityProviderConfigProvider:async f=>new Xce({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(Jce(this.config))}destroy(){super.destroy()}}class Re extends tA{constructor(e){super(e),Object.setPrototypeOf(this,Re.prototype)}}class iA extends Re{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,iA.prototype)}}class oA extends Re{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,oA.prototype)}}class aA extends Re{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,aA.prototype)}}class cA extends Re{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,cA.prototype)}}class lA extends Re{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,lA.prototype)}}class uA extends Re{constructor(e){super({name:"UserImportInProgressException",$fault:"client",...e}),this.name="UserImportInProgressException",this.$fault="client",Object.setPrototypeOf(this,uA.prototype)}}class fA extends Re{constructor(e){super({name:"UserNotFoundException",$fault:"client",...e}),this.name="UserNotFoundException",this.$fault="client",Object.setPrototypeOf(this,fA.prototype)}}class dA extends Re{constructor(e){super({name:"InvalidLambdaResponseException",$fault:"client",...e}),this.name="InvalidLambdaResponseException",this.$fault="client",Object.setPrototypeOf(this,dA.prototype)}}class hA extends Re{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,hA.prototype)}}class pA extends Re{constructor(e){super({name:"TooManyFailedAttemptsException",$fault:"client",...e}),this.name="TooManyFailedAttemptsException",this.$fault="client",Object.setPrototypeOf(this,pA.prototype)}}class yA extends Re{constructor(e){super({name:"UnexpectedLambdaException",$fault:"client",...e}),this.name="UnexpectedLambdaException",this.$fault="client",Object.setPrototypeOf(this,yA.prototype)}}class og extends Re{constructor(e){super({name:"UserLambdaValidationException",$fault:"client",...e}),this.name="UserLambdaValidationException",this.$fault="client",Object.setPrototypeOf(this,og.prototype)}}class vA extends Re{constructor(e){super({name:"CodeDeliveryFailureException",$fault:"client",...e}),this.name="CodeDeliveryFailureException",this.$fault="client",Object.setPrototypeOf(this,vA.prototype)}}class mA extends Re{constructor(e){super({name:"InvalidPasswordException",$fault:"client",...e}),this.name="InvalidPasswordException",this.$fault="client",Object.setPrototypeOf(this,mA.prototype)}}class gA extends Re{constructor(e){super({name:"InvalidSmsRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidSmsRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,gA.prototype)}}class xA extends Re{constructor(e){super({name:"InvalidSmsRoleTrustRelationshipException",$fault:"client",...e}),this.name="InvalidSmsRoleTrustRelationshipException",this.$fault="client",Object.setPrototypeOf(this,xA.prototype)}}class bA extends Re{constructor(e){super({name:"PreconditionNotMetException",$fault:"client",...e}),this.name="PreconditionNotMetException",this.$fault="client",Object.setPrototypeOf(this,bA.prototype)}}class wA extends Re{constructor(e){super({name:"UnsupportedUserStateException",$fault:"client",...e}),this.name="UnsupportedUserStateException",this.$fault="client",Object.setPrototypeOf(this,wA.prototype)}}class EA extends Re{constructor(e){super({name:"UsernameExistsException",$fault:"client",...e}),this.name="UsernameExistsException",this.$fault="client",Object.setPrototypeOf(this,EA.prototype)}}class SA extends Re{constructor(e){super({name:"AliasExistsException",$fault:"client",...e}),this.name="AliasExistsException",this.$fault="client",Object.setPrototypeOf(this,SA.prototype)}}class CA extends Re{constructor(e){super({name:"InvalidUserPoolConfigurationException",$fault:"client",...e}),this.name="InvalidUserPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,CA.prototype)}}class AA extends Re{constructor(e){super({name:"MFAMethodNotFoundException",$fault:"client",...e}),this.name="MFAMethodNotFoundException",this.$fault="client",Object.setPrototypeOf(this,AA.prototype)}}class kA extends Re{constructor(e){super({name:"PasswordResetRequiredException",$fault:"client",...e}),this.name="PasswordResetRequiredException",this.$fault="client",Object.setPrototypeOf(this,kA.prototype)}}class TA extends Re{constructor(e){super({name:"UserNotConfirmedException",$fault:"client",...e}),this.name="UserNotConfirmedException",this.$fault="client",Object.setPrototypeOf(this,TA.prototype)}}class PA extends Re{constructor(e){super({name:"UserPoolAddOnNotEnabledException",$fault:"client",...e}),this.name="UserPoolAddOnNotEnabledException",this.$fault="client",Object.setPrototypeOf(this,PA.prototype)}}class RA extends Re{constructor(e){super({name:"InvalidEmailRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidEmailRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,RA.prototype)}}class IA extends Re{constructor(e){super({name:"CodeMismatchException",$fault:"client",...e}),this.name="CodeMismatchException",this.$fault="client",Object.setPrototypeOf(this,IA.prototype)}}class OA extends Re{constructor(e){super({name:"ExpiredCodeException",$fault:"client",...e}),this.name="ExpiredCodeException",this.$fault="client",Object.setPrototypeOf(this,OA.prototype)}}class _A extends Re{constructor(e){super({name:"PasswordHistoryPolicyViolationException",$fault:"client",...e}),this.name="PasswordHistoryPolicyViolationException",this.$fault="client",Object.setPrototypeOf(this,_A.prototype)}}class NA extends Re{constructor(e){super({name:"SoftwareTokenMFANotFoundException",$fault:"client",...e}),this.name="SoftwareTokenMFANotFoundException",this.$fault="client",Object.setPrototypeOf(this,NA.prototype)}}class MA extends Re{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,MA.prototype)}}class DA extends Re{constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,DA.prototype)}}class LA extends Re{constructor(e){super({name:"GroupExistsException",$fault:"client",...e}),this.name="GroupExistsException",this.$fault="client",Object.setPrototypeOf(this,LA.prototype)}}class jA extends Re{constructor(e){super({name:"DuplicateProviderException",$fault:"client",...e}),this.name="DuplicateProviderException",this.$fault="client",Object.setPrototypeOf(this,jA.prototype)}}class BA extends Re{constructor(e){super({name:"UserPoolTaggingException",$fault:"client",...e}),this.name="UserPoolTaggingException",this.$fault="client",Object.setPrototypeOf(this,BA.prototype)}}class FA extends Re{constructor(e){super({name:"InvalidOAuthFlowException",$fault:"client",...e}),this.name="InvalidOAuthFlowException",this.$fault="client",Object.setPrototypeOf(this,FA.prototype)}}class UA extends Re{constructor(e){super({name:"ScopeDoesNotExistException",$fault:"client",...e}),this.name="ScopeDoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,UA.prototype)}}class VA extends Re{constructor(e){super({name:"UnsupportedIdentityProviderException",$fault:"client",...e}),this.name="UnsupportedIdentityProviderException",this.$fault="client",Object.setPrototypeOf(this,VA.prototype)}}const C8=t=>({...t,...t.Value&&{Value:ur}}),gL=t=>({...t,...t.AccessToken&&{AccessToken:ur},...t.RefreshToken&&{RefreshToken:ur},...t.IdToken&&{IdToken:ur}}),Yue=t=>({...t,...t.AuthParameters&&{AuthParameters:ur},...t.ClientId&&{ClientId:ur},...t.UserContextData&&{UserContextData:ur}}),Jue=t=>({...t,...t.Session&&{Session:ur},...t.AuthenticationResult&&{AuthenticationResult:gL(t.AuthenticationResult)}}),Xue=t=>({...t,...t.ClientId&&{ClientId:ur},...t.Session&&{Session:ur},...t.ChallengeResponses&&{ChallengeResponses:ur},...t.UserContextData&&{UserContextData:ur}}),Zue=t=>({...t,...t.Session&&{Session:ur},...t.AuthenticationResult&&{AuthenticationResult:gL(t.AuthenticationResult)}});class $A extends Re{constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),this.name="UnauthorizedException",this.$fault="client",Object.setPrototypeOf(this,$A.prototype)}}class zA extends Re{constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),this.name="UnsupportedOperationException",this.$fault="client",Object.setPrototypeOf(this,zA.prototype)}}class HA extends Re{constructor(e){super({name:"UnsupportedTokenTypeException",$fault:"client",...e}),this.name="UnsupportedTokenTypeException",this.$fault="client",Object.setPrototypeOf(this,HA.prototype)}}class GA extends Re{constructor(e){super({name:"EnableSoftwareTokenMFAException",$fault:"client",...e}),this.name="EnableSoftwareTokenMFAException",this.$fault="client",Object.setPrototypeOf(this,GA.prototype)}}const efe=t=>({...t,...t.ClientId&&{ClientId:ur},...t.SecretHash&&{SecretHash:ur},...t.Username&&{Username:ur},...t.Password&&{Password:ur},...t.UserAttributes&&{UserAttributes:t.UserAttributes.map(e=>C8(e))},...t.ValidationData&&{ValidationData:t.ValidationData.map(e=>C8(e))},...t.UserContextData&&{UserContextData:ur}}),tfe=async(t,e)=>{const r=KA("InitiateAuth");let n;return n=JSON.stringify(Ce(t)),WA(e,r,"/",void 0,n)},rfe=async(t,e)=>{const r=KA("RespondToAuthChallenge");let n;return n=JSON.stringify(Ce(t)),WA(e,r,"/",void 0,n)},nfe=async(t,e)=>{const r=KA("SignUp");let n;return n=JSON.stringify(Ce(t)),WA(e,r,"/",void 0,n)},sfe=async(t,e)=>{if(t.statusCode>=300)return qA(t,e);const r=await ig(t.body,e);let n={};return n=Ce(r),{$metadata:Ie(t),...n}},ife=async(t,e)=>{if(t.statusCode>=300)return qA(t,e);const r=await ig(t.body,e);let n={};return n=Ce(r),{$metadata:Ie(t),...n}},ofe=async(t,e)=>{if(t.statusCode>=300)return qA(t,e);const r=await ig(t.body,e);let n={};return n=Ce(r),{$metadata:Ie(t),...n}},qA=async(t,e)=>{const r={...t,body:await jle(t.body,e)},n=Ble(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentityprovider#InternalErrorException":throw await vfe(r);case"InvalidParameterException":case"com.amazonaws.cognitoidentityprovider#InvalidParameterException":throw await bfe(r);case"NotAuthorizedException":case"com.amazonaws.cognitoidentityprovider#NotAuthorizedException":throw await Tfe(r);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentityprovider#ResourceNotFoundException":throw await Ofe(r);case"TooManyRequestsException":case"com.amazonaws.cognitoidentityprovider#TooManyRequestsException":throw await Dfe(r);case"UserImportInProgressException":case"com.amazonaws.cognitoidentityprovider#UserImportInProgressException":throw await $fe(r);case"UserNotFoundException":case"com.amazonaws.cognitoidentityprovider#UserNotFoundException":throw await qfe(r);case"InvalidLambdaResponseException":case"com.amazonaws.cognitoidentityprovider#InvalidLambdaResponseException":throw await gfe(r);case"LimitExceededException":case"com.amazonaws.cognitoidentityprovider#LimitExceededException":throw await Afe(r);case"TooManyFailedAttemptsException":case"com.amazonaws.cognitoidentityprovider#TooManyFailedAttemptsException":throw await Mfe(r);case"UnexpectedLambdaException":case"com.amazonaws.cognitoidentityprovider#UnexpectedLambdaException":throw await jfe(r);case"UserLambdaValidationException":case"com.amazonaws.cognitoidentityprovider#UserLambdaValidationException":throw await zfe(r);case"CodeDeliveryFailureException":case"com.amazonaws.cognitoidentityprovider#CodeDeliveryFailureException":throw await cfe(r);case"InvalidPasswordException":case"com.amazonaws.cognitoidentityprovider#InvalidPasswordException":throw await wfe(r);case"InvalidSmsRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleAccessPolicyException":throw await Efe(r);case"InvalidSmsRoleTrustRelationshipException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleTrustRelationshipException":throw await Sfe(r);case"PreconditionNotMetException":case"com.amazonaws.cognitoidentityprovider#PreconditionNotMetException":throw await Ife(r);case"UnsupportedUserStateException":case"com.amazonaws.cognitoidentityprovider#UnsupportedUserStateException":throw await Vfe(r);case"UsernameExistsException":case"com.amazonaws.cognitoidentityprovider#UsernameExistsException":throw await Hfe(r);case"AliasExistsException":case"com.amazonaws.cognitoidentityprovider#AliasExistsException":throw await afe(r);case"InvalidUserPoolConfigurationException":case"com.amazonaws.cognitoidentityprovider#InvalidUserPoolConfigurationException":throw await Cfe(r);case"MFAMethodNotFoundException":case"com.amazonaws.cognitoidentityprovider#MFAMethodNotFoundException":throw await kfe(r);case"PasswordResetRequiredException":case"com.amazonaws.cognitoidentityprovider#PasswordResetRequiredException":throw await Rfe(r);case"UserNotConfirmedException":case"com.amazonaws.cognitoidentityprovider#UserNotConfirmedException":throw await Gfe(r);case"UserPoolAddOnNotEnabledException":case"com.amazonaws.cognitoidentityprovider#UserPoolAddOnNotEnabledException":throw await Wfe(r);case"InvalidEmailRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidEmailRoleAccessPolicyException":throw await mfe(r);case"CodeMismatchException":case"com.amazonaws.cognitoidentityprovider#CodeMismatchException":throw await lfe(r);case"ExpiredCodeException":case"com.amazonaws.cognitoidentityprovider#ExpiredCodeException":throw await hfe(r);case"PasswordHistoryPolicyViolationException":case"com.amazonaws.cognitoidentityprovider#PasswordHistoryPolicyViolationException":throw await Pfe(r);case"SoftwareTokenMFANotFoundException":case"com.amazonaws.cognitoidentityprovider#SoftwareTokenMFANotFoundException":throw await Nfe(r);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentityprovider#ConcurrentModificationException":throw await ufe(r);case"ForbiddenException":case"com.amazonaws.cognitoidentityprovider#ForbiddenException":throw await pfe(r);case"GroupExistsException":case"com.amazonaws.cognitoidentityprovider#GroupExistsException":throw await yfe(r);case"DuplicateProviderException":case"com.amazonaws.cognitoidentityprovider#DuplicateProviderException":throw await ffe(r);case"UserPoolTaggingException":case"com.amazonaws.cognitoidentityprovider#UserPoolTaggingException":throw await Kfe(r);case"InvalidOAuthFlowException":case"com.amazonaws.cognitoidentityprovider#InvalidOAuthFlowException":throw await xfe(r);case"ScopeDoesNotExistException":case"com.amazonaws.cognitoidentityprovider#ScopeDoesNotExistException":throw await _fe(r);case"UnsupportedIdentityProviderException":case"com.amazonaws.cognitoidentityprovider#UnsupportedIdentityProviderException":throw await Bfe(r);case"UnauthorizedException":case"com.amazonaws.cognitoidentityprovider#UnauthorizedException":throw await Lfe(r);case"UnsupportedOperationException":case"com.amazonaws.cognitoidentityprovider#UnsupportedOperationException":throw await Ffe(r);case"UnsupportedTokenTypeException":case"com.amazonaws.cognitoidentityprovider#UnsupportedTokenTypeException":throw await Ufe(r);case"EnableSoftwareTokenMFAException":case"com.amazonaws.cognitoidentityprovider#EnableSoftwareTokenMFAException":throw await dfe(r);default:const s=r.body;return Qfe({output:t,parsedBody:s,errorCode:n})}},afe=async(t,e)=>{const r=t.body,n=Ce(r),s=new SA({$metadata:Ie(t),...n});return Ne(s,r)},cfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new vA({$metadata:Ie(t),...n});return Ne(s,r)},lfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new IA({$metadata:Ie(t),...n});return Ne(s,r)},ufe=async(t,e)=>{const r=t.body,n=Ce(r),s=new MA({$metadata:Ie(t),...n});return Ne(s,r)},ffe=async(t,e)=>{const r=t.body,n=Ce(r),s=new jA({$metadata:Ie(t),...n});return Ne(s,r)},dfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new GA({$metadata:Ie(t),...n});return Ne(s,r)},hfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new OA({$metadata:Ie(t),...n});return Ne(s,r)},pfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new DA({$metadata:Ie(t),...n});return Ne(s,r)},yfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new LA({$metadata:Ie(t),...n});return Ne(s,r)},vfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new iA({$metadata:Ie(t),...n});return Ne(s,r)},mfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new RA({$metadata:Ie(t),...n});return Ne(s,r)},gfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new dA({$metadata:Ie(t),...n});return Ne(s,r)},xfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new FA({$metadata:Ie(t),...n});return Ne(s,r)},bfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new oA({$metadata:Ie(t),...n});return Ne(s,r)},wfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new mA({$metadata:Ie(t),...n});return Ne(s,r)},Efe=async(t,e)=>{const r=t.body,n=Ce(r),s=new gA({$metadata:Ie(t),...n});return Ne(s,r)},Sfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new xA({$metadata:Ie(t),...n});return Ne(s,r)},Cfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new CA({$metadata:Ie(t),...n});return Ne(s,r)},Afe=async(t,e)=>{const r=t.body,n=Ce(r),s=new hA({$metadata:Ie(t),...n});return Ne(s,r)},kfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new AA({$metadata:Ie(t),...n});return Ne(s,r)},Tfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new aA({$metadata:Ie(t),...n});return Ne(s,r)},Pfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new _A({$metadata:Ie(t),...n});return Ne(s,r)},Rfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new kA({$metadata:Ie(t),...n});return Ne(s,r)},Ife=async(t,e)=>{const r=t.body,n=Ce(r),s=new bA({$metadata:Ie(t),...n});return Ne(s,r)},Ofe=async(t,e)=>{const r=t.body,n=Ce(r),s=new cA({$metadata:Ie(t),...n});return Ne(s,r)},_fe=async(t,e)=>{const r=t.body,n=Ce(r),s=new UA({$metadata:Ie(t),...n});return Ne(s,r)},Nfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new NA({$metadata:Ie(t),...n});return Ne(s,r)},Mfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new pA({$metadata:Ie(t),...n});return Ne(s,r)},Dfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new lA({$metadata:Ie(t),...n});return Ne(s,r)},Lfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new $A({$metadata:Ie(t),...n});return Ne(s,r)},jfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new yA({$metadata:Ie(t),...n});return Ne(s,r)},Bfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new VA({$metadata:Ie(t),...n});return Ne(s,r)},Ffe=async(t,e)=>{const r=t.body,n=Ce(r),s=new zA({$metadata:Ie(t),...n});return Ne(s,r)},Ufe=async(t,e)=>{const r=t.body,n=Ce(r),s=new HA({$metadata:Ie(t),...n});return Ne(s,r)},Vfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new wA({$metadata:Ie(t),...n});return Ne(s,r)},$fe=async(t,e)=>{const r=t.body,n=Ce(r),s=new uA({$metadata:Ie(t),...n});return Ne(s,r)},zfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new og({$metadata:Ie(t),...n});return Ne(s,r)},Hfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new EA({$metadata:Ie(t),...n});return Ne(s,r)},Gfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new TA({$metadata:Ie(t),...n});return Ne(s,r)},qfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new fA({$metadata:Ie(t),...n});return Ne(s,r)},Wfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new PA({$metadata:Ie(t),...n});return Ne(s,r)},Kfe=async(t,e)=>{const r=t.body,n=Ce(r),s=new BA({$metadata:Ie(t),...n});return Ne(s,r)},Ie=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),Qfe=Mce(Re),WA=async(t,e,r,n,s)=>{const{hostname:i,protocol:o="https",port:a,path:c}=await t.endpoint(),l={protocol:o,hostname:i,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+r:c+r,headers:e};return n!==void 0&&(l.hostname=n),s!==void 0&&(l.body=s),new Vn(l)};function KA(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${t}`}}class Yfe extends sg.classBuilder().ep({...nA}).m(function(e,r,n,s){return[JC(n,this.serialize,this.deserialize),XC(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","InitiateAuth",{}).n("CognitoIdentityProviderClient","InitiateAuthCommand").f(Yue,Jue).ser(tfe).de(sfe).build(){}class Jfe extends sg.classBuilder().ep({...nA}).m(function(e,r,n,s){return[JC(n,this.serialize,this.deserialize),XC(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","RespondToAuthChallenge",{}).n("CognitoIdentityProviderClient","RespondToAuthChallengeCommand").f(Xue,Zue).ser(rfe).de(ife).build(){}class Xfe extends sg.classBuilder().ep({...nA}).m(function(e,r,n,s){return[JC(n,this.serialize,this.deserialize),XC(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","SignUp",{}).n("CognitoIdentityProviderClient","SignUpCommand").f(efe,void 0).ser(nfe).de(ofe).build(){}class ih extends Error{}ih.prototype.name="InvalidTokenError";function Zfe(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function ede(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Zfe(e)}catch{return atob(e)}}function xL(t,e){if(typeof t!="string")throw new ih("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new ih(`Invalid token specified: missing part #${r+1}`);let s;try{s=ede(n)}catch(i){throw new ih(`Invalid token specified: invalid base64 for part #${r+1} (${i.message})`)}try{return JSON.parse(s)}catch(i){throw new ih(`Invalid token specified: invalid json for part #${r+1} (${i.message})`)}}function tr(){return tr=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[s]=t[s]);return r}const tde=["signatures"],rde=1,nde=`${rde} (Web ${uoe})`;function Rr(t,e,r){const n=Math.floor(Date.now()/1e3),s=n+e;return{version:nde,issuedAt:n,expiresAt:s,name:t,data:r}}async function sde(t,e){const r=ide(e),n=await t.sign(new Uint8Array(r));return tr({},e,{signatures:[{sessionId:await t.sessionId(),signature:n}]})}function ide(t){const{version:e,issuedAt:r,expiresAt:n,name:s,data:i}=t,a=Sr(foe({version:e,issuedAt:r,expiresAt:n,name:s,data:i}));return fe(Ct(a))}function ode(t,e){const r=Pr(t,tde),n=t.expiresAt-t.issuedAt;return r.issuedAt=Math.floor(e.getTime()/1e3),r.expiresAt=r.issuedAt+n,r}let Ir=function(t){return t.initiateAuth="initiateAuth",t.openSession="openSession",t.closeSession="closeSession",t.validateSession="validateSession",t.finishValidateSession="finishValidateSession",t.listSessions="listSessions",t.getSession="getSession",t.sessionAuthProof="sessionAuthProof",t.feeOptions="feeOptions",t.signMessage="signMessage",t.sendTransaction="sendTransaction",t.getTransactionReceipt="getTransactionReceipt",t.federateAccount="federateAccount",t.removeAccount="removeAccount",t.listAccounts="listAccounts",t.getIdToken="getIdToken",t}({}),xd=function(t){return t.authInitiated="authInitiated",t.sessionOpened="sessionOpened",t.sessionClosed="sessionClosed",t.sessionList="sessionList",t.validationRequired="validationRequired",t.validationStarted="validationStarted",t.validationFinished="validationFinished",t.sessionAuthProof="sessionAuthProof",t.signedMessage="signedMessage",t.feeOptions="feeOptions",t.transactionReceipt="transactionReceipt",t.transactionFailed="transactionFailed",t.getSessionResponse="getSessionResponse",t.accountList="accountList",t.accountFederated="accountFederated",t.accountRemoved="accountRemoved",t.idToken="idToken",t}({}),eb=function(t){return t.unknown="unknown",t.erc20Token="erc20Token",t.erc1155Token="erc1155Token",t}({}),Ft=function(t){return t.None="None",t.Guest="Guest",t.OIDC="OIDC",t.Email="Email",t.PlayFab="PlayFab",t.Stytch="Stytch",t}({});function ade({wallet:t,chainId:e,message:r,lifespan:n}){return Rr(Ir.signMessage,n,{wallet:t,network:e.toString(),message:r.startsWith("0x")?r:ne(Sr(r))})}const cde=["lifespan"],lde=["lifespan"],ude=["lifespan"],fde=["lifespan"],dde=["lifespan"],hde=["lifespan"],pde=["lifespan"],yde=["lifespan"],vde=["lifespan"];async function $d(t){let{lifespan:e}=t,r=Pr(t,cde);return Rr(Ir.initiateAuth,e,r)}async function A8(t){let{lifespan:e}=t,r=Pr(t,lde);return Rr(Ir.openSession,e,r)}async function mde(t){let{lifespan:e}=t,r=Pr(t,ude);return Rr(Ir.validateSession,e,r)}function gde(t){let{lifespan:e}=t,r=Pr(t,fde);return Rr(Ir.finishValidateSession,e,r)}function k8(t){let{lifespan:e}=t,r=Pr(t,dde);return Rr(Ir.closeSession,e,r)}function xde(t){let{lifespan:e}=t,r=Pr(t,hde);return Rr(Ir.listSessions,e,r)}function bde(t){let{lifespan:e}=t,r=Pr(t,pde);return Rr(Ir.getSession,e,r)}function wde(t){let{lifespan:e}=t,r=Pr(t,yde);return Rr(Ir.sessionAuthProof,e,r)}function Ede(t){let{lifespan:e}=t,r=Pr(t,vde);return Rr(Ir.getIdToken,e,r)}const Sde=["token","to","value"],Cde=["token","to","id","safe","data"],Ade=["token","to","values","data"],kde=["to","value","abi","func","args"];function Tde({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:s}){return Rr(Ir.feeOptions,t,{identifier:r,wallet:e,network:n.toString(),transactions:s.map(i=>{if(!i.to||i.to===vl)throw new Error("Contract creation not supported");return wL(i)?{type:"transaction",to:i.to,value:GC(BigInt(i.value||0)),data:ne(i.data||"0x")}:i})})}function Cy({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:s,transactionsFeeQuote:i,transactionsFeeOption:o}){return Rr(Ir.sendTransaction,t,{identifier:r,wallet:e,network:n.toString(),transactions:Pde(s,o).map(a=>{if(!a.to||a.to===vl)throw new Error("Contract creation not supported");return wL(a)?{type:"transaction",to:a.to,value:GC(BigInt(a.value||0)),data:ne(a.data||"0x")}:a}),transactionsFeeQuote:i})}function Pde(t,e){const r=[...t];if(e)switch(e.token.type){case eb.unknown:r.push({to:e.to,value:e.value});break;case eb.erc20Token:if(!e.token.contractAddress)throw new Error("contract address is required");r.push(QA({tokenAddress:e.token.contractAddress,to:e.to,value:e.value}));break;case eb.erc1155Token:if(!e.token.contractAddress)throw new Error("contract address is required");if(!e.token.tokenID)throw new Error("token ID is required");r.push(YA({tokenAddress:e.token.contractAddress,to:e.to,vals:[{id:e.token.tokenID,amount:e.value}]}));break}return r}function Rde({lifespan:t,chainId:e,wallet:r,metaTxHash:n}){return Rr(Ir.getTransactionReceipt,t,{wallet:r,network:e.toString(),metaTxHash:n})}function Ide(t){let{token:e,to:r,value:n}=t,s=Pr(t,Sde);return Cy(tr({transactions:[QA({tokenAddress:e,to:r,value:n.toString()})]},s))}function Ode(t){let{token:e,to:r,id:n,safe:s,data:i}=t,o=Pr(t,Cde);return Cy(tr({transactions:[Mde({tokenAddress:e,to:r,id:n,data:i,safe:s})]},o))}function _de(t){let{token:e,to:r,values:n,data:s}=t,i=Pr(t,Ade);const o=n.map(a=>({id:a.id,amount:BigInt(a.amount).toString()}));return Cy(tr({transactions:[YA({tokenAddress:e,to:r,vals:o,data:s})]},i))}function Nde(t){let{to:e,value:r,abi:n,func:s,args:i}=t,o=Pr(t,kde);return Cy(tr({transactions:[bL({to:e,value:BigInt(r).toString(),data:{abi:n,func:s,args:i}})]},o))}function QA(t){const e=t,r=t;if(e.token!==void 0)return{type:"erc20send",tokenAddress:e.token,to:e.to,value:e.value.toString()};if(r.tokenAddress!==void 0)return tr({type:"erc20send"},r);throw new Error("Invalid ERC20 transaction")}function Mde(t){const e=t,r=t;if(e.token!==void 0)return{type:"erc721send",tokenAddress:e.token,to:e.to,id:e.id,data:e.data,safe:e.safe};if(r.tokenAddress!==void 0)return tr({type:"erc721send"},r);throw new Error("Invalid ERC721 transaction")}function YA(t){const e=t,r=t;if(e.values!==void 0)return{type:"erc1155send",vals:e.values.map(n=>({id:n.id,amount:n.amount.toString()})),tokenAddress:e.token,to:e.to,data:e.data};if(r.vals!==void 0)return{type:"erc1155send",vals:r.vals.map(n=>({id:n.id,amount:n.amount})),tokenAddress:r.tokenAddress,to:r.to,data:r.data};throw new Error("Invalid ERC1155 transaction")}function bL(t){const e=t,r=t;if(e.abi!==void 0)return{type:"delayedEncode",to:e.to,value:GC(BigInt(e.value)),data:{abi:e.abi,func:e.func,args:e.args}};if(r.data!==void 0)return{type:"delayedEncode",to:r.to,value:r.value,data:r.data};throw new Error("Invalid delayed encode transaction")}function Dde(t){if(t.length===0)throw new Error("No packets provided");const e=t[0].data.network,r=t[0].data.wallet,n=t[0].expiresAt-t[0].issuedAt,s=t[0].data.identifier,i=t[0].data.transactionsFeeQuote;if(!t.every(o=>o.data.network===e))throw new Error("All packets must have the same chainId");if(!t.every(o=>o.data.wallet===r))throw new Error("All packets must have the same wallet");return Rr(Ir.sendTransaction,n,{network:e,wallet:r,identifier:s,transactions:t.flatMap(o=>o.data.transactions),transactionsFeeQuote:i})}function wL(t){return!["transaction","erc20send","erc721send","erc1155send","delayedEncode"].includes(t.type)}class pv{constructor(e,r,n){this.store=e,this.key=r,this.defaultValue=n}async get(){const e=await this.store.get(this.key);return e||this.defaultValue}async set(e){e?await this.store.set(this.key,e):await this.store.set(this.key,null)}}class EL{constructor(){this.store=void 0,I0.isAvailable()?this.store=new I0:this.store=new Lde}async get(e){return this.store.get(e)}async set(e,r){return this.store.set(e,r)}}class I0{static isAvailable(){return typeof window=="object"&&typeof window.localStorage=="object"}constructor(){if(!I0.isAvailable())throw new Error("No localStorage")}async get(e){return window.localStorage.getItem(e)}async set(e,r){r?window.localStorage.setItem(e,r):window.localStorage.removeItem(e)}}class Lde{constructor(){this.store={},this.store={}}async get(e){return this.store[e]||null}async set(e,r){r?this.store[e]=r:delete this.store[e]}}const j2="seq-waas-session-p256k1",B2="seq-waas-session";async function SL(t,e){const r=await e.get(j2,B2,t);if(!r)throw new Error("No private key found");const n=new up(r);return{sessionId(){return n.getAddress()},sign(s){return n.signMessage(s)},clear:async()=>{await e.delete(j2,B2,t)}}}async function jde(t,e){const n=await new up(t).getAddress();return await e.set(j2,B2,n,t),SL(n,e)}async function Bde(t){const e=up.createRandom();return jde(e.privateKey,t)}let CL=function(t){return t[t.ECDSAP256K1=0]="ECDSAP256K1",t[t.ECDSAP256R1=1]="ECDSAP256R1",t}({});const F2="seq-waas-session-p256r1",U2="seq-waas-session";async function AL(t,e,r){const n=await r.get(F2,U2,t);if(!n||!n.privateKey)throw new Error("No private key found");const s=new TextEncoder;return{sessionId:async()=>{const i=await e.exportKey("raw",n.publicKey),o=new Uint8Array(i.byteLength+1);return o[0]=CL.ECDSAP256R1,o.set(new Uint8Array(i),1),ne(o)},sign:async i=>{typeof i=="string"&&(i.startsWith("0x")?(i=i.slice(2),i=fe(i)):i=s.encode(i));const o=await e.sign({name:"ECDSA",hash:{name:"SHA-256"}},n.privateKey,i);return ne(new Uint8Array(o))},clear:async()=>{await r.delete(F2,U2,t)}}}async function Fde(t,e,r){const n=await Vde(e,t.publicKey);return await r.set(F2,U2,n,t),AL(n,e,r)}async function Ude(t,e){const r=await t.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"]);return Fde(r,t,e)}async function Vde(t,e){const r=await t.exportKey("raw",e),n=new Uint8Array(r.byteLength+1);return n[0]=CL.ECDSAP256R1,n.set(new Uint8Array(r),1),ne(n)}async function V2(t,e,r){if(!r)throw new Error("No secure store available");return e?AL(t,e,r):SL(t,r)}async function $de(t,e){if(!e)throw new Error("No secure store available");return t?Ude(t,e):Bde(e)}const zde=["lifespan"],Hde=["lifespan"],Gde=["lifespan"];function qde(t){let{lifespan:e}=t,r=Pr(t,zde);return Rr(Ir.listAccounts,e,r)}function Wde(t){let{lifespan:e}=t,r=Pr(t,Hde);return Rr(Ir.federateAccount,e,r)}function Kde(t){let{lifespan:e}=t,r=Pr(t,Gde);return Rr(Ir.removeAccount,e,r)}const $2=Object.entries(S0).reduce((t,[e,r])=>(t[r.name]=r.chainId,t),{}),Qde=Object.entries($2).reduce((t,[e,r])=>(t[r]=e,t),{});function tb(t){const e=typeof t=="number"?t:parseInt(t);if(e in Qde)return e;const r=t.toString().toLowerCase();if(r in $2)return $2[r];throw new Error(`Unknown network: ${t}`)}const kL=()=>TL()?new Yde:null;function TL(){return typeof window=="object"&&typeof window.crypto=="object"&&typeof window.crypto.subtle=="object"}class Yde{constructor(){if(!TL())throw new Error("window.crypto.subtle is not available")}generateKey(e,r,n){return window.crypto.subtle.generateKey(e,r,n)}importKey(e,r,n,s,i){return window.crypto.subtle.importKey(e,r,n,s,i)}async exportKey(e,r){const n=await window.crypto.subtle.exportKey(e,r);return new Uint8Array(n)}async digest(e,r){const n=await window.crypto.subtle.digest(e,r);return new Uint8Array(n)}async sign(e,r,n){const s=await window.crypto.subtle.sign(e,r,n);return new Uint8Array(s)}verify(e,r,n,s){return window.crypto.subtle.verify(e,r,n,s)}getRandomValues(e){const r=new Uint8Array(e);return window.crypto.getRandomValues(r)}}const PL=()=>RL()?new Jde:null;function RL(){return typeof indexedDB=="object"}class Jde{constructor(){if(this.db=void 0,!RL())throw new Error("IndexedDB is not available");this.db=null}async openDB(e,r,n){return this.db?this.db:(this.db=await Roe(e,1,{upgrade(s){s.createObjectStore(r)}}),this.db)}async get(e,r,n){const s=await this.openDB(e,r,1),i=s.transaction(r,"readonly"),o=await s.get(r,n);return await i.done,o}async set(e,r,n,s){const i=await this.openDB(e,r,1),o=i.transaction(r,"readwrite");return await i.put(r,s,n),await o.done,!0}async delete(e,r,n){const s=await this.openDB(e,r,1),i=s.transaction(r,"readwrite");return await s.delete(r,n),await i.done,!0}}const Xde="@0xsequence.waas.wallet",Zde="@0xsequence.waas.session_id",ehe="@0xsequence.waas.status",Xt=5*60;class the{constructor(e={network:1},r=new EL,n=kL(),s=PL()){this.config=e,this.store=r,this.cryptoBackend=n,this.secureStoreBackend=s,this.status=void 0,this.sessionId=void 0,this.wallet=void 0,this.sessionObservers=[],this.gettingSessionIdPromise=void 0,this.status=new pv(this.store,ehe,"signed-out"),this.sessionId=new pv(this.store,Zde,void 0),this.wallet=new pv(this.store,Xde,void 0)}async getAddress(){return this.getWalletAddress()}async getWalletAddress(){if(!await this.isSignedIn())throw new Error("Not signed in");const e=await this.wallet.get();if(!e)throw new Error("No wallet");return e}async commonArgs(e){var r;return tr({},e,{identifier:e==null?void 0:e.identifier,wallet:await this.getWalletAddress(),lifespan:(r=e==null?void 0:e.lifespan)!=null?r:Xt,chainId:tb(e.network||this.config.network)})}async signIntent(e){const r=await this.getSessionId();if(r===void 0)throw new Error("session not open");const n=await V2(r,this.cryptoBackend,this.secureStoreBackend);return sde(n,e)}async signUsingSessionKey(e){const r=await this.getSessionId();if(!r)throw new Error("session not open");return(await V2(r,this.cryptoBackend,this.secureStoreBackend)).sign(e)}async getSessionId(){var e=this;if(this.gettingSessionIdPromise)return this.gettingSessionIdPromise;const r=async function(){let s=await e.sessionId.get();return s||(s=await(await $de(e.cryptoBackend,e.secureStoreBackend)).sessionId(),await e.sessionId.set(s),e.signalObservers(e.sessionObservers,s)),e.gettingSessionIdPromise=void 0,s};return this.gettingSessionIdPromise=r(),this.gettingSessionIdPromise}async signInWithIdToken(e){if(await this.status.get()!=="signed-out")throw await this.completeSignOut(),new Error("you are already signed in");const n=await this.getSessionId(),s=await A8({sessionId:n,identityType:Ft.None,idToken:e,lifespan:Xt});return await this.status.set("pending"),this.signIntent(s)}async initiateGuestAuth(){const e=await this.getSessionId(),r=await $d({sessionId:e,identityType:Ft.Guest,verifier:e,lifespan:Xt});return this.signIntent(r)}async initiateEmailAuth(e){const r=await this.getSessionId(),n=await $d({sessionId:r,identityType:Ft.Email,verifier:`${e};${r}`,lifespan:Xt});return this.signIntent(n)}async initiateIdTokenAuth(e,r){const n=await this.getSessionId(),s=Cr(e),i=await $d({sessionId:n,identityType:Ft.OIDC,verifier:`${s};${r}`,lifespan:Xt});return this.signIntent(i)}async initiateStytchAuth(e,r){const n=await this.getSessionId(),s=Cr(e),i=await $d({sessionId:n,identityType:Ft.Stytch,verifier:`${s};${r}`,lifespan:Xt});return this.signIntent(i)}async initiatePlayFabAuth(e,r){const n=await this.getSessionId(),s=Cr(r),i=await $d({sessionId:n,identityType:Ft.PlayFab,verifier:`${e}|${s}`,lifespan:Xt});return this.signIntent(i)}async completeAuth(e,r){const n=await this.getSessionId(),s=await A8(tr({},r,{sessionId:n,lifespan:Xt},e));return await this.status.set("pending"),this.signIntent(s)}onSessionStateChanged(e){return this.sessionObservers.push(e),()=>{this.sessionObservers=this.sessionObservers.filter(r=>r!=e)}}async signOut({lifespan:e,sessionId:r}={}){if(r=r||await this.sessionId.get(),!r)throw new Error("session not open");const n=k8({lifespan:e||Xt,sessionId:r});return this.signIntent(n)}async signOutSession(e){const r=k8({lifespan:Xt,sessionId:e});return this.signIntent(r)}async listSessions(){const e=xde({lifespan:Xt,wallet:await this.getWalletAddress()});return this.signIntent(e)}async completeSignOut(){await Promise.all([this.status.set("signed-out"),this.wallet.set(void 0),this.sessionId.set(void 0)]),this.signalObservers(this.sessionObservers,null)}async completeSignIn(e){if(e.result)return this.completeSignIn(e.result);const r=await this.status.get();if(e.code!=="sessionOpened")throw new Error("Invalid receipt");if(r!=="pending")throw new Error("No pending sign in");return await Promise.all([this.status.set("signed-in"),this.wallet.set(e.data.wallet)]),e.data.wallet}async isSignedIn(){return await this.status.get()==="signed-in"}async sessionAuthProof(e){var r;const n=wde({lifespan:(r=e.lifespan)!=null?r:Xt,network:tb(e.network||this.config.network).toString(),wallet:await this.getWalletAddress(),nonce:e.nonce});return this.signIntent(n)}async signMessage(e){var r;const n=ade(tr({chainId:tb(e.network||this.config.network)},e,{lifespan:(r=e.lifespan)!=null?r:Xt,wallet:await this.getWalletAddress()}));return this.signIntent(n)}async sendTransaction(e){const r=Cy(await this.commonArgs(e));return this.signIntent(r)}async getTransactionReceipt(e){const r=Rde(await this.commonArgs(e));return this.signIntent(r)}async sendERC20(e){if(e.token.toLowerCase()===e.to.toLowerCase())throw new Error("Cannot burn tokens using sendERC20");const r=Ide(await this.commonArgs(e));return this.signIntent(r)}async sendERC721(e){if(e.token.toLowerCase()===e.to.toLowerCase())throw new Error("Cannot burn tokens using sendERC721");const r=Ode(await this.commonArgs(e));return this.signIntent(r)}async sendERC1155(e){if(e.token.toLowerCase()===e.to.toLowerCase())throw new Error("Cannot burn tokens using sendERC1155");const r=_de(await this.commonArgs(e));return this.signIntent(r)}async callContract(e){const r=Nde(await this.commonArgs(e));return this.signIntent(r)}async feeOptions(e){const r=Tde(await this.commonArgs(e));return this.signIntent(r)}async validateSession({deviceMetadata:e}){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=await mde({lifespan:Xt,sessionId:r,deviceMetadata:e,wallet:await this.getWalletAddress()});return this.signIntent(n)}async getSession(){const e=await this.sessionId.get();if(!e)throw new Error("session not open");const r=bde({sessionId:e,wallet:await this.getWalletAddress(),lifespan:Xt});return this.signIntent(r)}async finishValidateSession(e,r){const n=await this.sessionId.get();if(!n)throw new Error("session not open");const s=await this.getWalletAddress(),i=gde({sessionId:n,wallet:s,lifespan:Xt,salt:e,challenge:r});return this.signIntent(i)}async listAccounts(){const e=qde({wallet:await this.getWalletAddress(),lifespan:Xt});return this.signIntent(e)}async linkAccount(e){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=Wde(tr({wallet:await this.getWalletAddress(),lifespan:Xt,sessionId:r},e));return this.signIntent(n)}async removeAccount({accountId:e}){const r=Kde({wallet:await this.getWalletAddress(),lifespan:Xt,accountId:e});return this.signIntent(r)}async getIdToken({nonce:e}){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=Ede({wallet:await this.getWalletAddress(),lifespan:Xt,sessionId:r,nonce:e});return this.signIntent(n)}async batch(e){const r=Dde(e);return this.signIntent(r)}signalObservers(e,r){e.forEach(n=>n(r))}async updateIntentTime(e,r){const n=ode(e,r);return this.signIntent(n)}}class rhe{constructor(e,r){this.hostname=void 0,this.fetch=void 0,this.path="/rpc/WaasAuthenticator/",this.registerSession=(n,s,i)=>this.fetch(this.url("RegisterSession"),rb(n,s,i)).then(o=>nb(o).then(a=>({session:a.session,response:a.response})),o=>{throw yv.new({cause:`fetch(): ${o.message||""}`})}),this.sendIntent=(n,s,i)=>this.fetch(this.url("SendIntent"),rb(n,s,i)).then(o=>nb(o).then(a=>({response:a.response})),o=>{throw yv.new({cause:`fetch(): ${o.message||""}`})}),this.chainList=(n,s)=>this.fetch(this.url("ChainList"),rb({},n,s)).then(i=>nb(i).then(o=>({chains:o.chains})),i=>{throw yv.new({cause:`fetch(): ${i.message||""}`})}),this.hostname=e,this.fetch=(n,s)=>r(n,s)}url(e){return this.hostname+this.path+e}}const rb=(t={},e={},r=null)=>({method:"POST",headers:tr({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),nb=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let s="";throw n instanceof Error&&(s=n.message),LL.new({status:t.status,cause:`JSON.parse(): ${s}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(hhe[n]||Yt).new(r)}return r});let Yt=class IL extends Error{constructor(e,r,n,s,i){super(n),this.name=void 0,this.code=void 0,this.message=void 0,this.status=void 0,this.cause=void 0,this.msg=void 0,this.name=e||"WebrpcError",this.code=typeof r=="number"?r:0,this.message=n||`endpoint error ${this.code}`,this.msg=this.message,this.status=typeof s=="number"?s:0,this.cause=i,Object.setPrototypeOf(this,IL.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}},nhe=class OL extends Yt{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,OL.prototype)}},yv=class _L extends Yt{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,_L.prototype)}},she=class NL extends Yt{constructor(e="WebrpcBadRoute",r=-2,n="bad route",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,NL.prototype)}},ihe=class ML extends Yt{constructor(e="WebrpcBadMethod",r=-3,n="bad method",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ML.prototype)}},ohe=class DL extends Yt{constructor(e="WebrpcBadRequest",r=-4,n="bad request",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,DL.prototype)}},LL=class jL extends Yt{constructor(e="WebrpcBadResponse",r=-5,n="bad response",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,jL.prototype)}},ahe=class BL extends Yt{constructor(e="WebrpcServerPanic",r=-6,n="server panic",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,BL.prototype)}},che=class FL extends Yt{constructor(e="WebrpcInternalError",r=-7,n="internal error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,FL.prototype)}},lhe=class UL extends Yt{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,UL.prototype)}},uhe=class VL extends Yt{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,VL.prototype)}},fhe=class $L extends Yt{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,$L.prototype)}},dhe=class zL extends Yt{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,zL.prototype)}};class JA extends Yt{constructor(e="TenantNotFound",r=1001,n="Tenant not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,JA.prototype)}}class vp extends Yt{constructor(e="EmailAlreadyInUse",r=7e3,n="Could not create account as the email is already in use",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,vp.prototype)}}class XA extends Yt{constructor(e="AccountAlreadyLinked",r=7001,n="Could not link account as it is linked to another wallet",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,XA.prototype)}}class ZA extends Yt{constructor(e="ProofVerificationFailed",r=7002,n="The authentication proof could not be verified",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ZA.prototype)}}class mp extends Yt{constructor(e="AnswerIncorrect",r=7003,n="The provided answer is incorrect",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,mp.prototype)}}class ek extends Yt{constructor(e="ChallengeExpired",r=7004,n="The challenge has expired",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ek.prototype)}}class tk extends Yt{constructor(e="TooManyAttempts",r=7005,n="Too many attempts",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,tk.prototype)}}const hhe={0:nhe,[-1]:yv,[-2]:she,[-3]:ihe,[-4]:ohe,[-5]:LL,[-6]:ahe,[-7]:che,[-8]:lhe,[-9]:uhe,[-10]:fhe,1e3:dhe,1001:JA,7e3:vp,7001:XA,7002:ZA,7003:mp,7004:ek,7005:tk};function R1(t){return typeof t=="object"&&t.code===xd.authInitiated&&typeof t.data=="object"&&typeof t.data.sessionId=="string"&&typeof t.data.identityType=="string"&&typeof t.data.expiresIn=="number"}function Ay(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="transactionReceipt"&&typeof t.data=="object"&&typeof t.data.txHash=="string"&&typeof t.data.receipt=="object"&&typeof t.data.request=="object"}function HL(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="transactionReceipt"&&typeof t.data=="object"&&typeof t.data.metaTxHash=="string"&&!t.data.txHash&&typeof t.data.request=="object"}function phe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="transactionFailed"&&typeof t.data=="object"&&typeof t.data.request=="object"&&Array.isArray(t.data.simulations)&&typeof t.data.error=="string"}function T8(t){return Ay(t)||phe(t)||HL(t)}function yhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="signedMessage"&&typeof t.data=="object"&&typeof t.data.message=="string"&&typeof t.data.signature=="string"}function vhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="sessionAuthProof"&&typeof t.data=="object"&&typeof t.data.sessionId=="string"&&typeof t.data.network=="string"&&typeof t.data.wallet=="string"&&typeof t.data.message=="string"&&typeof t.data.signature=="string"}function mhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="feeOptions"&&typeof t.data=="object"&&Array.isArray(t.data.feeOptions)}function ghe(t){return typeof t=="object"&&t.code===xd.validationRequired&&typeof t.data=="object"&&typeof t.data.sessionId=="string"}function xhe(t){return typeof t=="object"&&t.code===xd.validationFinished&&typeof t.data=="object"}function bhe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="sessionClosed"}function whe(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="getSessionResponse"&&typeof t.data=="object"&&typeof t.data.session=="string"&&typeof t.data.wallet=="string"}function Ehe(t){return typeof t=="object"&&t.code===xd.accountFederated&&typeof t.data=="object"&&typeof t.data.account=="object"}function She(t){return typeof t=="object"&&t.code===xd.accountList&&typeof t.data=="object"}function P8(t){var e,r;return!!(t instanceof Yt&&((e=t.cause)!=null&&e.endsWith("intent is invalid: intent expired")||(r=t.cause)!=null&&r.endsWith("intent is invalid: intent issued in the future")))}function Che(t){return typeof t=="object"&&t.code===xd.idToken&&typeof t.data=="object"&&typeof t.data.idToken=="string"}class Ahe{constructor(e,r){this.region=e,this.clientId=r,this.cognitoMemo=void 0}cognito(){return this.cognitoMemo||(this.cognitoMemo=new Que({region:this.region})),this.cognitoMemo}signUp(e){return e=e.toLowerCase().trim(),this.cognito().send(new Xfe({ClientId:this.clientId,Username:e,Password:"aB1%"+khe(14),UserAttributes:[{Name:"email",Value:e}]}))}signIn(e){return e=e.toLowerCase().trim(),this.cognito().send(new Yfe({AuthFlow:"CUSTOM_AUTH",ClientId:this.clientId,AuthParameters:{USERNAME:e}}))}async initiateAuth({email:e}){let r;e=e.toLowerCase().trim();try{r=await this.signIn(e)}catch(n){if(n instanceof og&&n.message.includes("user not found"))await this.signUp(e),r=await this.signIn(e);else throw n}if(!r.Session)throw new Error("response session is empty");return{instance:r.Session,email:e}}async finalizeAuth({instance:e,email:r,answer:n,sessionHash:s}){r=r.toLowerCase().trim();const i=await this.cognito().send(new Jfe({ClientId:this.clientId,Session:e,ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:{USERNAME:r,ANSWER:n},ClientMetadata:{SESSION_HASH:s}}));if(!i.AuthenticationResult||!i.AuthenticationResult.IdToken)throw new Error("AuthenticationResult.IdToken is empty");return{idToken:i.AuthenticationResult.IdToken}}}function khe(t){return Array.from(The(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}function The(t){const e=new Uint8Array(t);if(typeof window=="object"&&typeof window.crypto=="object")return window.crypto.getRandomValues(e);{console.warn("window.crypto.getRandomValues is not available. Falling back to less secure Math.random().");const r=new Uint8Array(t);for(let n=0;n{if(this.signatureVerificationFailed)throw new Error("Signature verification failed");if(this.cryptoBackend&&this.config.disableHttpSignatureCheck!==!0&&a!=null&&a.headers){const l={};l["Accept-Signature"]='sig=();alg="rsa-v1_5-sha256"',a.headers=tr({},a.headers,l)}const c=Nhe(o,a);return this.cryptoBackend&&this.config.disableHttpSignatureCheck!==!0&&c.then(async function(l){try{var u,f;const h=await l.clone().text(),p=l.headers.get("Content-Digest"),y=l.headers.get("Signature-Input"),g=l.headers.get("Signature");if(!p)throw new Error("Content-Digest header not set");if(!y)throw new Error("Signature-Input header not set");if(!g)throw new Error("Signature header not set");const m=(u=p.match(":(.*):"))==null?void 0:u[1];if(!m)throw new Error("Content digest not found");const x=new TextEncoder().encode(h),b=await i.cryptoBackend.digest("SHA-256",x),w=btoa(String.fromCharCode(...b));if(m!==w)throw new Error("Digest mismatch");const A=`"content-digest": ${p} +"@signature-params": ${y.substring(4)}`,O={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},_=l.url.includes("dev-waas")?Mhe:Dhe,C=await i.cryptoBackend.importKey("jwk",_.keys[0],O,!1,["verify"]),j=(f=g.match(":(.*):"))==null?void 0:f[1];if(!j)throw new Error("Signature not found");const V=Uint8Array.from(atob(j),z=>z.charCodeAt(0));if(!await i.cryptoBackend.verify(O,C,V,new TextEncoder().encode(A)))throw new Error("Signature verification failed, consequent requests will fail")}catch(d){throw i.signatureVerificationFailed=!0,d}}),c},this.config=_he(e),this.waas=new the(tr({network:1},e),this.store,this.cryptoBackend,this.secureStoreBackend),this.client=new rhe(this.config.rpcServer,this._fetch),this.deviceName=new pv(this.store,"@0xsequence.waas.auth.deviceName",void 0)}get email(){if(this.emailClient)return this.emailClient;if(!this.config.emailRegion)throw new Error("Missing emailRegion");if(!this.config.emailClientId)throw new Error("Missing emailClientId");return this.emailClient=new Ahe(this.config.emailRegion,this.config.emailClientId),this.emailClient}async onValidationRequired(e){return this.validationRequiredCallback.push(e),()=>{this.validationRequiredCallback=this.validationRequiredCallback.filter(r=>r!==e)}}onEmailConflict(e){return this.emailConflictCallback.push(e),()=>{this.emailConflictCallback=this.emailConflictCallback.filter(r=>r!==e)}}onEmailAuthCodeRequired(e){return this.emailAuthCodeRequiredCallback.push(e),()=>{this.emailAuthCodeRequiredCallback=this.emailAuthCodeRequiredCallback.filter(r=>r!==e)}}async handleValidationRequired({onValidationRequired:e}={}){var r;if(!(e?e():!0))return!1;const s=await this.waas.validateSession({deviceMetadata:(r=await this.deviceName.get())!=null?r:"Unknown device"}),i=await this.sendIntent(s);this.validationRequiredSalt=i.data.salt;for(const o of this.validationRequiredCallback)o();return this.waitForSessionValid()}headers(){return{"X-Access-Key":this.config.projectAccessKey}}async sendIntent(e){if(!await this.waas.getSessionId())throw new Error("session not open");try{return(await this.client.sendIntent({intent:e},this.headers())).response}catch(n){if(P8(n)&&this.lastDate){const s=await this.waas.updateIntentTime(e,this.lastDate);return(await this.client.sendIntent({intent:s},this.headers())).response}throw n}}async isSignedIn(){return this.waas.isSignedIn()}signIn(e,r){var n=this;const s="email"in e;return s&&this.emailAuthCodeRequiredCallback.length==0?Promise.reject("Missing emailAuthCodeRequired callback"):new Promise(async function(i,o){let a;try{a=await n.initAuth(e)}catch(l){return o(l)}const c=async function(u){try{const f=await n.completeAuth(a.withAnswer(u),{sessionName:r});i(f)}catch(f){if(f instanceof mp)throw f;if(f instanceof vp){const d=async function(){try{const y=await n.completeAuth(a.withAnswer(u),{sessionName:r,forceCreateAccount:!0});i(y)}catch(y){o(y)}},h={type:Ft.None,email:"",issuer:""};if(f.cause){const p=f.cause.split("|");p.length>=2&&(h.type=p[0],h.email=p[1]),p.length>=3&&(h.issuer=p[2])}for(const p of n.emailConflictCallback)p(h,d)}else o(f)}};if(s)for(const l of n.emailAuthCodeRequiredCallback)l(c);else c("")})}async initAuth(e){if("guest"in e&&e.guest)return this.initGuestAuth();if("idToken"in e)return this.initIdTokenAuth(e.idToken);if("email"in e)return this.initEmailAuth(e.email);if("playFabTitleId"in e)return this.initPlayFabAuth(e.playFabTitleId,e.playFabSessionTicket);throw new Error("invalid identity")}async initGuestAuth(){const e=await this.waas.getSessionId(),r=await this.waas.initiateGuestAuth(),n=await this.sendIntent(r);if(!R1(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return new Phe(e,n.data.challenge)}async initIdTokenAuth(e){var r;const n=xL(e),s=((r=n.iss)==null?void 0:r.startsWith("stytch.com/"))||!1,i=s?await this.waas.initiateStytchAuth(e,n.exp):await this.waas.initiateIdTokenAuth(e,n.exp),o=await this.sendIntent(i);if(!R1(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`);return s?new Rhe(e):new GL(e)}async initEmailAuth(e){const r=await this.waas.getSessionId(),n=await this.waas.initiateEmailAuth(e),s=await this.sendIntent(n);if(!R1(s))throw new Error(`Invalid response: ${JSON.stringify(s)}`);return new rk(e,r,s.data.challenge)}async initPlayFabAuth(e,r){const n=await this.waas.initiatePlayFabAuth(e,r),s=await this.sendIntent(n);if(!R1(s))throw new Error(`Invalid response: ${JSON.stringify(s)}`);return new Ihe(e,r)}async completeAuth(e,r){r||(r={}),r.sessionName||(r.sessionName="session name");const n=await this.waas.completeAuth(e.getIntentParams(),{forceCreateAccount:r.forceCreateAccount});try{const s=await this.registerSession(n,r.sessionName);return await this.waas.completeSignIn({code:"sessionOpened",data:{sessionId:s.session.id,wallet:s.response.data.wallet}}),{sessionId:s.session.id,wallet:s.response.data.wallet,email:s.session.identity.email}}catch(s){throw!(s instanceof vp)&&!(s instanceof mp)&&await this.waas.completeSignOut(),s}}async registerSession(e,r){try{return await this.client.registerSession({intent:e,friendlyName:r},this.headers())}catch(n){if(P8(n)&&this.lastDate){const s=await this.waas.updateIntentTime(e,this.lastDate);return await this.client.registerSession({intent:s,friendlyName:r},this.headers())}throw n}}async refreshSession(){throw new Error("Not implemented")}async getSessionId(){return this.waas.getSessionId()}async getSessionHash(){const e=(await this.waas.getSessionId()).toLowerCase();return Cr(e)}async dropSession({sessionId:e,strict:r}={}){const n=await this.waas.getSessionId();if(!n)throw new Error("session not open");const s=e||n;try{const i=await this.waas.signOutSession(s),o=await this.sendIntent(i);if(!bhe(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`)}catch(i){if(r)throw i;console.error(i)}if(s===n){if(!this.secureStoreBackend)throw new Error("No secure store available");(await V2(n,this.cryptoBackend,this.secureStoreBackend)).clear(),await this.waas.completeSignOut(),await this.deviceName.set(void 0)}}async listSessions(){const e=await this.waas.getSessionId();if(!e)throw new Error("session not open");const r=await this.waas.listSessions();return(await this.sendIntent(r)).data.map(s=>tr({},s,{isThis:s.id===e}))}async getAddress(){return this.waas.getAddress()}async validateSession(e){return await this.isSessionValid()?!0:this.handleValidationRequired(e)}async finishValidateSession(e){const r=await this.waas.finishValidateSession(this.validationRequiredSalt,e),n=await this.sendIntent(r);if(!xhe(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return this.validationRequiredSalt="",n.data.isValid}async isSessionValid(){const e=await this.waas.getSession(),r=await this.sendIntent(e);if(!whe(r))throw new Error(`Invalid response: ${JSON.stringify(r)}`);return r.data.validated}async waitForSessionValid(e=6e5,r=2e3){const n=Date.now();for(;Date.now()-nsetTimeout(s,r))}return!1}async sessionAuthProof({nonce:e,network:r,validation:n}){const s=await this.waas.sessionAuthProof({nonce:e,network:r});return await this.trySendIntent({validation:n},s,vhe)}async listAccounts(){const e=await this.waas.listAccounts(),r=await this.sendIntent(e);if(!She(r))throw new Error(`Invalid response: ${JSON.stringify(r)}`);return r.data}async linkAccount(e){const r=await this.waas.linkAccount(e.getIntentParams()),n=await this.sendIntent(r);if(!Ehe(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return n.data}async removeAccount(e){const r=await this.waas.removeAccount({accountId:e});await this.sendIntent(r)}async getIdToken(e){const r=await this.waas.getIdToken({nonce:e==null?void 0:e.nonce}),n=await this.sendIntent(r);if(!Che(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return n.data}async useIdentifier(e){if(e.identifier)return e;const r=`ts-sdk-${Date.now()}-${await this.waas.getSessionId()}`;return tr({},e,{identifier:r})}async trySendIntent(e,r,n){const s=await this.sendIntent(r);if(n(s))return s;if(ghe(s)&&await this.handleValidationRequired(e.validation)){const o=await this.sendIntent(r);if(n(o))return o}throw new Error(JSON.stringify(s))}async signMessage(e){const r=await this.waas.signMessage(await this.useIdentifier(e));return this.trySendIntent(e,r,yhe)}async trySendTransactionIntent(e,r){let n=await this.trySendIntent(r,e,T8);for(;HL(n);){await new Promise(o=>setTimeout(o,1e3));const s={metaTxHash:n.data.metaTxHash,network:e.data.network,identifier:e.data.identifier,validation:r.validation},i=await this.waas.getTransactionReceipt(await this.useIdentifier(s));n=await this.trySendIntent(s,i,T8)}return n}async sendTransaction(e){const r=await this.waas.sendTransaction(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async sendERC20(e){const r=await this.waas.sendERC20(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async sendERC721(e){const r=await this.waas.sendERC721(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async sendERC1155(e){const r=await this.waas.sendERC1155(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async callContract(e){const r=await this.waas.callContract(await this.useIdentifier(e));return this.trySendTransactionIntent(r,e)}async feeOptions(e){const r=await this.waas.feeOptions(await this.useIdentifier(e));return this.trySendIntent(e,r,mhe)}async networkList(){const e=[],r=await this.client.chainList({"X-Access-Key":this.config.projectAccessKey});for(const n of r.chains)e.push({id:n.id,name:n.name,isEnabled:n.isEnabled});return e}onSessionStateChanged(e){return this.waas.onSessionStateChanged(e)}async fetch(e,r){const n=await globalThis.fetch(e,r),s=n.headers.get("date");return s&&(this.lastDate=new Date(s)),n}}const jhe=t=>{if(t.type===Ft.PlayFab)return"PlayFab login";if(t.type===Ft.Email)return"Email login";if(t.type===Ft.OIDC){if(t.issuer.includes("cognito-idp"))return"Email v1 login";switch(t.issuer){case"https://accounts.google.com":return"Google login";case"https://appleid.apple.com":return"Apple login";default:return"Unknown account type"}}return"Unknown account type"},Bhe=t=>{const{onCancel:e,onConfirm:r}=t;return k.jsxs(q,{style:{maxWidth:"600px"},flexDirection:"column",paddingX:"10",paddingY:"4",alignItems:"center",gap:"4",children:[k.jsx(q,{children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Email already in use"})}),k.jsx(q,{height:"full",children:k.jsxs(ue,{as:"div",variant:"normal",color:"text50",textAlign:"center",children:["Another account with this email address ",k.jsxs(ue,{color:"text80",children:["(",t.info.email,")"]})," already exists with account type ",k.jsxs(ue,{color:"text80",children:["(",jhe(t.info),")"]}),". You can cancel this or force create a new account."]})}),k.jsxs(q,{flexDirection:"row",gap:"3",marginTop:"6",marginBottom:"2",children:[k.jsx(ut,{label:"Cancel",onClick:e}),k.jsx(ut,{variant:"primary",label:"Create new account",onClick:r})]})]})};function O0(){return O0=Object.assign?Object.assign.bind():function(t){for(var e=1;ethis.fetch(this.url("Ping"),dt({},n,s)).then(i=>Et(i).then(o=>({status:o.status})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.version=(n,s)=>this.fetch(this.url("Version"),dt({},n,s)).then(i=>Et(i).then(o=>({version:o.version})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.runtimeStatus=(n,s)=>this.fetch(this.url("RuntimeStatus"),dt({},n,s)).then(i=>Et(i).then(o=>({status:o.status})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.getChainID=(n,s)=>this.fetch(this.url("GetChainID"),dt({},n,s)).then(i=>Et(i).then(o=>({chainID:o.chainID})),i=>{throw lt.new({cause:`fetch(): ${i.message||""}`})}),this.getEtherBalance=(n,s,i)=>this.fetch(this.url("GetEtherBalance"),dt(n,s,i)).then(o=>Et(o).then(a=>({balance:a.balance})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenBalances=(n,s,i)=>this.fetch(this.url("GetTokenBalances"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSupplies=(n,s,i)=>this.fetch(this.url("GetTokenSupplies"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,contractType:a.contractType,tokenIDs:a.tokenIDs})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSuppliesMap=(n,s,i)=>this.fetch(this.url("GetTokenSuppliesMap"),dt(n,s,i)).then(o=>Et(o).then(a=>({supplies:a.supplies})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getBalanceUpdates=(n,s,i)=>this.fetch(this.url("GetBalanceUpdates"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTransactionHistory=(n,s,i)=>this.fetch(this.url("GetTransactionHistory"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.syncBalance=(n,s,i)=>this.fetch(this.url("SyncBalance"),dt(n,s,i)).then(o=>Et(o).then(a=>({})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceipt=(n,s,i)=>this.fetch(this.url("FetchTransactionReceipt"),dt(n,s,i)).then(o=>Et(o).then(a=>({receipt:a.receipt})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getOrderbookOrders=(n,s,i)=>this.fetch(this.url("GetOrderbookOrders"),dt(n,s,i)).then(o=>Et(o).then(a=>({page:a.page,orders:a.orders})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getTopOrders=(n,s,i)=>this.fetch(this.url("GetTopOrders"),dt(n,s,i)).then(o=>Et(o).then(a=>({orders:a.orders})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceiptWithFilter=(n,s,i)=>this.fetch(this.url("FetchTransactionReceiptWithFilter"),dt(n,s,i)).then(o=>Et(o).then(a=>({receipt:a.receipt})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getAllWebhookListeners=(n,s,i)=>this.fetch(this.url("GetAllWebhookListeners"),dt(n,s,i)).then(o=>Et(o).then(a=>({listeners:a.listeners})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.getWebhookListener=(n,s,i)=>this.fetch(this.url("GetWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({listener:a.listener})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.addWebhookListener=(n,s,i)=>this.fetch(this.url("AddWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status,listener:a.listener})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.updateWebhookListener=(n,s,i)=>this.fetch(this.url("UpdateWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.removeWebhookListener=(n,s,i)=>this.fetch(this.url("RemoveWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.toggleWebhookListener=(n,s,i)=>this.fetch(this.url("ToggleWebhookListener"),dt(n,s,i)).then(o=>Et(o).then(a=>({webhookListener:a.webhookListener})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.pauseAllWebhookListeners=(n,s,i)=>this.fetch(this.url("PauseAllWebhookListeners"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.resumeAllWebhookListeners=(n,s,i)=>this.fetch(this.url("ResumeAllWebhookListeners"),dt(n,s,i)).then(o=>Et(o).then(a=>({status:a.status})),o=>{throw lt.new({cause:`fetch(): ${o.message||""}`})}),this.subscribeReceipts=(n,s)=>{const i=()=>this.fetch(this.url("SubscribeReceipts"),dt(n,s.headers,s.signal)).then(async function(o){await sb(o,s,i)},o=>{s.onError(o,i)});return i()},this.subscribeEvents=(n,s)=>{const i=()=>this.fetch(this.url("SubscribeEvents"),dt(n,s.headers,s.signal)).then(async function(o){await sb(o,s,i)},o=>{s.onError(o,i)});return i()},this.subscribeBalanceUpdates=(n,s)=>{const i=()=>this.fetch(this.url("SubscribeBalanceUpdates"),dt(n,s.headers,s.signal)).then(async function(o){await sb(o,s,i)},o=>{s.onError(o,i)});return i()},this.hostname=e,this.fetch=(n,s)=>r(n,s)}url(e){return this.hostname+this.path+e}}const sb=async(t,e,r)=>{const{onMessage:n,onOpen:s,onClose:i,onError:o}=e;if(!t.ok){try{await Et(t)}catch(h){o(h,r)}return}if(!t.body){o(td.new({status:t.status,cause:"Invalid response, missing body"}),r);return}s&&s();const a=t.body.getReader(),c=new TextDecoder;let l="",u=Date.now();const f=(10+1)*1e3;let d;try{for(d=setInterval(()=>{if(Date.now()-u>f)throw Lu.new({cause:"Stream timed out"})},f);;){let h,p;try{({value:h,done:p}=await a.read()),u=Date.now(),l+=c.decode(h,{stream:!0})}catch(g){let m="";g instanceof Error&&(m=g.message),g instanceof DOMException&&g.name==="AbortError"?o(lt.new({message:"AbortError",cause:`AbortError: ${m}`}),()=>{throw new Error("Abort signal cannot be used to reconnect")}):o(Lu.new({cause:`reader.read(): ${m}`}),r);return}let y=l.split(` +`);for(let g=0;g({method:"POST",headers:O0({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),Et=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let s="";throw n instanceof Error&&(s=n.message),td.new({status:t.status,cause:`JSON.parse(): ${s}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(qL[n]||nt).new(r)}return r});class nt extends Error{constructor(e,r,n,s,i){super(n),this.name=void 0,this.code=void 0,this.message=void 0,this.status=void 0,this.cause=void 0,this.msg=void 0,this.name=e||"WebrpcError",this.code=typeof r=="number"?r:0,this.message=n||`endpoint error ${this.code}`,this.msg=this.message,this.status=typeof s=="number"?s:0,this.cause=i,Object.setPrototypeOf(this,nt.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}}class nk extends nt{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,nk.prototype)}}class lt extends nt{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,lt.prototype)}}class sk extends nt{constructor(e="WebrpcBadRoute",r=-2,n="bad route",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,sk.prototype)}}class ik extends nt{constructor(e="WebrpcBadMethod",r=-3,n="bad method",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ik.prototype)}}class ok extends nt{constructor(e="WebrpcBadRequest",r=-4,n="bad request",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ok.prototype)}}class td extends nt{constructor(e="WebrpcBadResponse",r=-5,n="bad response",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,td.prototype)}}class ak extends nt{constructor(e="WebrpcServerPanic",r=-6,n="server panic",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ak.prototype)}}class ck extends nt{constructor(e="WebrpcInternalError",r=-7,n="internal error",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,ck.prototype)}}class lk extends nt{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,lk.prototype)}}class Lu extends nt{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Lu.prototype)}}class uk extends nt{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,uk.prototype)}}class fk extends nt{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,fk.prototype)}}class dk extends nt{constructor(e="PermissionDenied",r=1001,n="Permission denied",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,dk.prototype)}}class hk extends nt{constructor(e="SessionExpired",r=1002,n="Session expired",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,hk.prototype)}}class pk extends nt{constructor(e="MethodNotFound",r=1003,n="Method not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,pk.prototype)}}class yk extends nt{constructor(e="RequestConflict",r=1004,n="Conflict with target resource",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,yk.prototype)}}class vk extends nt{constructor(e="Aborted",r=1005,n="Request aborted",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,vk.prototype)}}class mk extends nt{constructor(e="Timeout",r=2e3,n="Request timed out",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,mk.prototype)}}class gk extends nt{constructor(e="InvalidArgument",r=2001,n="Invalid argument",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,gk.prototype)}}class xk extends nt{constructor(e="Unavailable",r=2002,n="Unavailable resource",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,xk.prototype)}}class bk extends nt{constructor(e="QueryFailed",r=2003,n="Query failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,bk.prototype)}}class wk extends nt{constructor(e="ResourceExhausted",r=2004,n="Resource exhausted",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,wk.prototype)}}class Ek extends nt{constructor(e="NotFound",r=3e3,n="Resource not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Ek.prototype)}}class Sk extends nt{constructor(e="ProjectNotFound",r=3002,n="Project not found",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Sk.prototype)}}class Ck extends nt{constructor(e="MetadataCallFailed",r=3003,n="Metadata service call failed",s=0,i){super(e,r,n,s,i),Object.setPrototypeOf(this,Ck.prototype)}}const qL={0:nk,[-1]:lt,[-2]:sk,[-3]:ik,[-4]:ok,[-5]:td,[-6]:ak,[-7]:ck,[-8]:lk,[-9]:Lu,[-10]:uk,1e3:fk,1001:dk,1002:hk,1003:pk,1004:yk,1005:vk,2e3:mk,2001:gk,2002:xk,2003:bk,2004:wk,3e3:Ek,3002:Sk,3003:Ck},R8=globalThis.fetch;class WL extends Fhe{constructor(e,r,n){super(e.endsWith("/")?e.slice(0,-1):e,R8),this.projectAccessKey=r,this.jwtAuth=n,this._fetch=(s,i)=>{const o={},a=this.jwtAuth,c=this.projectAccessKey;return a&&a.length>0&&(o.Authorization=`BEARER ${a}`),c&&c.length>0&&(o["X-Access-Key"]=c),i.headers=O0({},i.headers,o),R8(s,i)},this.fetch=this._fetch}}const I8=[..."🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐸🐵🙈🙉🙊🐒🐔🐧🐦🐤🐣🐥🦆🦅🦉🦇🐺🐗🐴🦄🐝🐛🦋🐌🐞🐜🦟🦗🕷🕸🦂🐢🐍🦎🦖🦕🐙🦑🦐🦞🦀🐡🐠🐟🐬🐳🐋🦈🐊🐅🐆🦓🦍🦧🐘🦛🦏🐪🐫🦒🦘🐃🐂🐄🐎🐖🐏🐑🦙🐐🦌🐕🐩🦮🐈🐓🦃🦚🦜🦢🦩🕊🐇🦝🦨🦡🦦🦥🐁🐀🐿🦔🐾🐉🐲🌵🎄🌲🌳🌴🌱🌿🍀🎍🎋🍃👣🍂🍁🍄🐚🌾💐🌷🌹🥀🌺🌸🌼🌻🌞🌝🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🥭🍍🥥🥝🍅🥑🥦🥬🥒🌶🌽🥕🧄🧅🥔🍠🥐🥯🍞🥖🥨🧀🥚🍳🧈🥞🧇🥓🥩🍗🍖🦴🌭🍔🍟🍕🥪🥙🧆🌮🌯🥗🥘🥫🍝🍜🍲🍛🍣🍱🥟🦪🍤🍙🍚🍘🍥🥠🥮🍢🍡🍧🍨🍦🥧🧁🍰🎂🍮🍭🍬🍫🍿🍩🍪🌰🥜👀👂👃👄👅👆👇👈👉👊👋👌👍👎👏👐👑👒👓🎯🎰🎱🎲🎳👾👯👺👻👽🏂🏃🏄"];function fc(){const e=coe.en,r=I8[Math.floor(Math.random()*I8.length)],n=e.getWord(Math.floor(Math.random()*2048)),s=e.getWord(Math.floor(Math.random()*2048));return`${r} ${n} ${s}`}const vv=t=>t.name==="AccountAlreadyLinked";function KL({onSuccess:t,sessionName:e,linkAccount:r=!1}){const n=M9(),[s,i]=v.useState(),[o,a]=v.useState(!1),[c,l]=v.useState(!1),[u,f]=v.useState(),[d,h]=v.useState();return v.useEffect(()=>Oe.onEmailAuthCodeRequired(async m=>{a(!1),f(()=>m)}),[Oe,a,f]),{inProgress:c,initiateAuth:async m=>{a(!0),l(!0);try{if(r){const x=await Oe.initAuth({email:m});h(x),a(!1)}else{const x=await Oe.signIn({email:m},e);t(x)}}catch(x){i(x.message||"Unknown error")}finally{r||(a(!1),l(!1))}},loading:o,error:s,sendChallengeAnswer:c?async m=>{if(r&&d){try{await Oe.linkAccount(d.withAnswer(m))}catch(x){vv(x)&&n({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}a(!1),l(!1);return}u&&await u(m)}:void 0,cancel:()=>{l(!1),a(!1),h(void 0),f(null)}}}const Uhe=({KEYS_TO_EXCLUDE:t=[]}={})=>{const e=(r,n)=>typeof r!=typeof n?!1:r===null||n===null?r===n:typeof r=="object"?Object.keys(r).length!==Object.keys(n).length||Object.keys(r).some(s=>!(s in n))?!1:Object.entries(r).filter(([s])=>!t.includes(s)).every(([s,i])=>e(i,n[s])):r===n;return e},Vhe=Uhe(),$he=(t,e)=>t===e?e:Object.keys(t).reduce((r,n)=>(n in e&&Vhe(t[n],e[n])&&(r[n]=t[n]),r),Object.assign({},e)),zhe=t=>{const e=v.useRef(!0),[r,n]=v.useState(t);v.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]);const s=v.useCallback(i=>{e.current&&n(i)},[]);return[r,s]},QL=(t,e="StytchProvider")=>`${t} can only be used inside <${e}>.`,Hhe="You cannot render a inside another .",Ghe=`The @stytch/react library is not meant for use with serverside environments like NextJS. Use the @stytch/nextjs library instead - npm remove @stytch/react && npm install @stytch/nextjs -`;function _0(t,e){if(!t)throw new Error(e)}const Hhe={user:null,fromCache:!1},Ghe={session:null,fromCache:!1},Ak=v.createContext({isMounted:!1}),qhe=v.createContext(Hhe),YL=v.createContext(Ghe),JL=()=>v.useContext(Ak).isMounted,Whe=()=>(_0(JL(),QL("useStytchSession")),v.useContext(YL)),Khe=()=>{const t=v.useContext(Ak);return _0(t.isMounted,QL("useStytch")),t.client},Qhe=({stytch:t,children:e})=>{_0(!JL(),$he),_0(typeof window<"u",zhe);const r=v.useMemo(()=>({client:t,isMounted:!0}),[t]),[{user:n,session:s},i]=Vhe({session:t.session.getInfo(),user:t.user.getInfo()});return v.useEffect(()=>t.onStateChange(()=>{i(o=>{const a={session:t.session.getInfo(),user:t.user.getInfo()};return Uhe(o,a)})}),[i,t]),cr.createElement(Ak.Provider,{value:r},cr.createElement(qhe.Provider,{value:n},cr.createElement(YL.Provider,{value:s},e)))};function Yhe(){const t=Khe(),{session:e}=Whe(),[r,n]=v.useState(0),[s,i]=v.useState(""),o=v.useRef(null);v.useEffect(()=>{if(localStorage.getItem("stytch_auth")!=="native")return;const c=new URLSearchParams(window.location.search);c.get("stytch_token_type")==="magic_links"&&r===0&&(n(2),(async()=>await t.magicLinks.authenticate(c.get("token")||"",{session_duration_minutes:5}))())},[t,e,r]),v.useEffect(()=>{localStorage.getItem("stytch_auth")==="native"&&e&&r==2&&(n(3),(async()=>{const c=t.session.getTokens(),l=await Oe.signIn({idToken:c.session_jwt},fc());console.log(`Wallet address: ${l}`),await t.session.revoke(),n(0),window.location.search="",oi.navigate("/")})())},[e,t,r]);const a=async c=>{localStorage.setItem("stytch_auth","native"),n(1),await t.magicLinks.email.loginOrCreate(c,{})};return k.jsxs(q,{children:[k.jsx(q,{marginBottom:"4",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Stytch login"})}),k.jsxs(q,{marginTop:"5",marginBottom:"4",children:[k.jsx(q,{marginTop:"6",children:k.jsx(sr,{name:"stytchEmail",type:"email",onChange:c=>{i(c.target.value)},ref:o,onKeyDown:c=>{s&&c.key==="Enter"&&a(s)},value:s,placeholder:"hello@example.com",disabled:r!==0,required:!0})}),k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(ut,{variant:"primary",label:"Continue",onClick:()=>a(s),"data-id":"continueButton",disabled:r!==0})}),r===1&&k.jsx(q,{children:k.jsx(ue,{variant:"normal",color:"text80",children:"Magic link sent to your email. Please click the link. You can close this page."})})]})]})}function Jhe(){var B;const[t,e]=v.useState(""),r=v.useRef(null),n=(B=r.current)==null?void 0:B.validity.valid,[s,i]=v.useState(!1),[o,a]=v.useState([]),[c,l]=v.useState(),[u,f]=v.useState(!1),d=v.useRef(null);Oe.onEmailConflict(async(z,Y)=>{d.current=Y,l(z),f(!0)});const h=e7({flow:"implicit",onSuccess:z=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:z.access_token,CreateAccount:!0,TitleId:"8F854"},async(Y,H)=>{if(Y)try{const L=await Oe.signIn({playFabTitleId:"8F854",playFabSessionTicket:Y.data.SessionTicket},fc());console.log("Sequence response:",L),oi.navigate("/")}catch{console.error("Error: "+JSON.stringify(H))}else H&&console.error("Error: "+JSON.stringify(H))})}}),{inProgress:p,loading:y,initiateAuth:g,sendChallengeAnswer:m,cancel:x}=KL({sessionName:fc(),onSuccess:async({wallet:z})=>{console.log(`Wallet address: ${z}`),oi.navigate("/")}});v.useEffect(()=>{(async()=>await Oe.isSignedIn()&&oi.navigate("/"))()},[]);const b=async z=>{const Y=await Oe.signIn({idToken:z.credential},fc());console.log(`Wallet address: ${Y.wallet}`),console.log(`Email address: ${Y.email}`),oi.navigate("/")},w="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":""),A=async z=>{const Y=await Oe.signIn({idToken:z.authorization.id_token},fc());console.log(`Wallet address: ${Y.wallet}`),console.log(`Email address: ${Y.email}`),oi.navigate("/")},O=async()=>{const z=await Oe.signIn({guest:!0},fc());console.log(`Wallet address: ${z.wallet}`),oi.navigate("/")},_=new URLSearchParams(window.location.search),C=_.get("env")==="dev",[j,V]=v.useState(C);return k.jsxs(k.Fragment,{children:[k.jsxs(q,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[k.jsxs(q,{marginBottom:"16",flexDirection:"row",children:[k.jsx(s7,{}),k.jsx(q,{marginLeft:"auto",children:k.jsx(kJ,{label:"Use dev env",checked:j,onCheckedChange:()=>{j?(_.delete("env"),window.location.search=_.toString()):(_.set("env","dev"),window.location.search=_.toString()),V(!j)}})})]}),k.jsx(q,{marginTop:"6",marginBottom:"4",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Guest Login"})}),k.jsx(q,{gap:"4",children:k.jsx(ut,{label:"Login as guest",onClick:O})}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{marginTop:"6",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Email Login"})}),m?k.jsxs(q,{flexDirection:"column",children:[k.jsx(q,{marginTop:"6",children:k.jsx(ue,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),k.jsx(q,{marginTop:"4",children:k.jsx(n7,{value:o,digits:6,onChange:a})}),k.jsx(q,{gap:"2",marginY:"4",children:y?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:o.includes(""),label:"Verify",onClick:()=>m(o.join("")),"data-id":"verifyButton"})})]}):k.jsxs(q,{marginTop:"5",marginBottom:"4",children:[k.jsxs(ue,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",k.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),k.jsxs(q,{marginTop:"6",children:[k.jsx(sr,{name:"email",type:"email",onChange:z=>{e(z.target.value)},ref:r,onKeyDown:z=>{t&&z.key==="Enter"&&g(t)},onBlur:()=>i(!!t&&!n),value:t,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),s&&k.jsx(ue,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:y?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:!n,label:"Continue",onClick:()=>g(t),"data-id":"continueButton"})})]}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{paddingY:"4",gap:"4",flexDirection:"column",width:"full",children:!p&&k.jsxs(k.Fragment,{children:[k.jsx(q,{marginBottom:"2",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Social Login"})}),k.jsxs(q,{gap:"4",flexDirection:"column",width:"fit",children:[k.jsx(q,{children:k.jsx(Z9,{onSuccess:b,shape:"circle",width:230},"google")}),k.jsx(r7,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:w,usePopup:!0},onError:z=>console.error(z),onSuccess:A,uiType:"dark"},"apple")]}),k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsxs(q,{children:[k.jsx(q,{marginBottom:"4",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Playfab login"})}),k.jsx(q,{children:k.jsx(ut,{label:"Login with Google (through Playfab)",onClick:h})})]}),k.jsx(Yhe,{}),""]})})]}),u&&c&&k.jsx(PN,{size:"small",onClose:()=>f(!1),children:k.jsx(Lhe,{info:c,onCancel:()=>{f(!1),l(void 0),p&&(a([]),x(),e(""))},onConfirm:async()=>{var z;f(!1),l(void 0),await((z=d.current)==null?void 0:z.call(d))}})})]})}async function cg({transactions:t,network:e}){const r=await Oe.feeOptions({transactions:t,network:e==null?void 0:e.id});return r.data.feeQuote&&r.data.feeOptions?{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!1}:{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!0}}function lg(t){var i;const{feeOptions:e,onSelected:r}=t,[n,s]=v.useState();return v.useEffect(()=>{e&&e.length>0&&(s(e[0]),r(e[0]))},[e]),v.useEffect(()=>{n&&r(n)},[n]),e?k.jsxs(q,{marginTop:"5",children:[k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options:"}),k.jsx(q,{marginTop:"3"}),k.jsx(Rm,{name:"chainId",labelLocation:"top",onValueChange:o=>{const a=e.find(c=>c.token.name===o);a&&s(a)},value:(i=n==null?void 0:n.token)==null?void 0:i.name,options:[...e.map(o=>{var a,c,l;return{label:k.jsx(q,{alignItems:"center",gap:"2",children:k.jsxs(ue,{children:[(a=o==null?void 0:o.token)==null?void 0:a.name," ",mC(o==null?void 0:o.value,(c=o==null?void 0:o.token)==null?void 0:c.decimals)]})}),value:String((l=o==null?void 0:o.token)==null?void 0:l.name)}})]})]}):k.jsx(q,{})}const Xhe="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Zhe(t){const[e,r]=v.useState(),[n,s]=v.useState("ETH"),[i,o]=v.useState(""),[a,c]=v.useState(""),[l,u]=v.useState(""),[f,d]=v.useState(),[h,p]=v.useState(!1),[y,g]=v.useState(),[m,x]=v.useState(),[b,w]=v.useState(),[A,O]=v.useState(),[_,C]=v.useState(!1);v.useEffect(()=>{j()},[]),v.useEffect(()=>{var z,Y;if(t.network){const H=fp(t.network.name);if(H){const L=H.name in{polygon:1,mumbai:1}?"MATIC":"ETH";s(L),j(),(z=H.blockExplorer)!=null&&z.rootUrl&&o((Y=H.blockExplorer)==null?void 0:Y.rootUrl)}}},[t.network]);const j=async()=>{if(!t.network)return;const z=fp(t.network.name);if(!z)return;const Y=await Oe.getAddress(),L=await new WL(ND(z.name),Xhe).getEtherBalance({accountAddress:Y});r(BigInt(L.balance.balanceWei))},V=async(z,Y)=>{const H=await cg({transactions:[{to:z,value:E4(Y)}],network:t.network});if(H.feeQuote&&H.feeOptions){x(H.feeOptions),O(H.feeQuote),console.log("feeOptions",H);return}C(!0),console.log("tx sponsored")},B=async(z,Y)=>{var H;try{g(void 0),p(!0);const L=await Oe.sendTransaction({transactions:[{to:z,value:E4(Y)}],network:(H=t.network)==null?void 0:H.id,transactionsFeeOption:b,transactionsFeeQuote:A});Ay(L)?d(L.data.txHash):g(L.data.error),p(!1)}catch(L){console.error(L),p(!1)}finally{O(void 0),x(void 0),w(void 0),C(!1)}};return k.jsxs(q,{children:[k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Native token balance: ",cte(e||0)," ",n]}),k.jsx(ut,{marginLeft:"2",size:"xs",label:"Fetch",onClick:j}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"sendNativeTokenTo",type:"text",onChange:z=>{c(z.target.value)},value:a,placeholder:"To address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"sendNativeTokenAmount",type:"text",onChange:z=>{u(z.target.value)},value:l,placeholder:"Amount",required:!0,"data-id":"nativeTokenSendAmount"})}),y&&k.jsxs(q,{marginTop:"3",children:["Transaction failed: ",y]}),k.jsx(lg,{feeOptions:m,onSelected:w}),_&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:a===""&&l==="",onClick:()=>V(a,l)}),k.jsx(ut,{marginTop:"5",label:"Send native token",disabled:a===""&&l==="",onClick:()=>B(a,l)})]}),f&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),k.jsx("br",{}),k.jsx("a",{href:`${i}tx/${f}`,target:"_blank",rel:"noopener noreferrer",children:f})]})]})}function epe(){const[t,e]=v.useState(),[r,n]=v.useState(),[s,i]=v.useState(!0),[o,a]=v.useState(),c=async l=>{i(!0),e(void 0);try{await Oe.dropSession({sessionId:l}),e(await Oe.listSessions())}catch(u){a(u.message),e(await Oe.listSessions())}i(!1)};return v.useEffect(()=>{Promise.all([Oe.listSessions(),Oe.getSessionId()]).then(([l,u])=>{e(l),n(u),i(!1)}).catch(l=>{a(l.message),i(!1)})},[]),k.jsxs(q,{children:[k.jsxs(q,{marginBottom:"5",children:[k.jsx(q,{marginBottom:"5",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your open sessions:"})}),t&&k.jsx(k.Fragment,{children:t.map(l=>k.jsx(q,{children:k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"normal",children:[l.friendlyName,!l.isThis&&k.jsx("a",{style:{marginLeft:"7px",textDecoration:"underline",cursor:"pointer"},onClick:()=>c(l.id),children:"x"}),l.isThis&&k.jsx(k.Fragment,{children:" (current)"})]})},l.id))}),s&&k.jsx(Bn,{})]}),o&&k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading sessions: ",o]})]})}function tpe(t){const[e,r]=v.useState(""),[n,s]=v.useState(),i=async()=>{var a;const o=await Oe.signMessage({message:e,network:(a=t.network)==null?void 0:a.id});s(o.data.signature)};return k.jsxs(q,{children:[k.jsx(sr,{name:"signMessageText",type:"text",onChange:o=>{r(o.target.value),n!=""&&s("")},value:e,placeholder:"Enter a message to sign",required:!0,"data-id":"signMessageInput"}),k.jsx(ut,{marginTop:"5",label:"Sign message",disabled:e==="",onClick:()=>i()}),n&&n!==""&&k.jsxs(q,{flexDirection:"column",marginTop:"5",children:[k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Signature for ",e,":"]}),k.jsx(q,{children:k.jsx(ue,{as:"p",wordBreak:"break-word",children:n})})]})]})}function rpe(t){const[e,r]=v.useState(""),[n,s]=v.useState(""),[i,o]=v.useState(""),[a,c]=v.useState(""),[l,u]=v.useState(),[f,d]=v.useState(!1),[h,p]=v.useState(),[y,g]=v.useState(),[m,x]=v.useState(),[b,w]=v.useState(),[A,O]=v.useState(!1),[_,C]=v.useState("");v.useEffect(()=>{var B,z;if(t.network){const Y=fp(t.network.name);(B=Y==null?void 0:Y.blockExplorer)!=null&&B.rootUrl&&C((z=Y.blockExplorer)==null?void 0:z.rootUrl)}},[t.network]);const j=async()=>{const B=await cg({transactions:[bL({to:e,abi:n,func:i,args:JSON.parse(a),value:"0"})],network:t.network});if(B.feeQuote&&B.feeOptions){g(B.feeOptions),w(B.feeQuote),console.log("feeOptions",B);return}O(!0),console.log("tx sponsored")},V=async()=>{var B;try{p(void 0),d(!0);const z=await Oe.callContract({network:(B=t.network)==null?void 0:B.id,to:e,abi:n,func:i,args:JSON.parse(a),value:0,transactionsFeeOption:m,transactionsFeeQuote:b});Ay(z)?u(z.data.txHash):p(z.data.error),d(!1)}catch(z){console.error(z),d(!1)}};return k.jsxs(q,{children:[k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractAddress",type:"text",onChange:B=>{r(B.target.value)},value:e,placeholder:"Contract address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractAbi",type:"text",onChange:B=>{s(B.target.value)},value:n,placeholder:"Contract ABI or function ABI, e.g. [{...}] or [{...}, {...}] or transfer(address,uint256)",required:!0,"data-id":"nativeTokenSendAmount"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractMethod",type:"text",onChange:B=>{o(B.target.value)},value:i,placeholder:"Method name, e.g. transfer",required:!0,"data-id":"nativeTokenSendAmount"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractArgs",type:"text",onChange:B=>{c(B.target.value)},value:a,placeholder:'Method args, e.g. [0x..., 1000] or named { "to": "0x...", "amount": "1000" }',required:!0,"data-id":"nativeTokenSendAmount"})}),k.jsx(lg,{feeOptions:y,onSelected:x}),A&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h&&k.jsxs(q,{marginTop:"3",children:["Transaction failed: ",h]}),f?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&n===""&&i===""&&a==="",onClick:()=>j()}),k.jsx(ut,{marginTop:"5",label:"Call contract",disabled:e===""&&n===""&&i===""&&a==="",onClick:()=>V()})]}),l&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),k.jsx("br",{}),k.jsx("a",{href:`${_}tx/${l}`,target:"_blank",rel:"noopener noreferrer",children:l})]})]})}const O8=[{label:"Custom Token",value:"Custom"},{label:"USDC Old",value:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"},{label:"USDC New",value:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"},{label:"DAI",value:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"}];function npe(t){const[e,r]=v.useState(O8[0].value),[n,s]=v.useState(""),[i,o]=v.useState(!0),[a,c]=v.useState("---"),[l,u]=v.useState(""),[f,d]=v.useState(""),[h,p]=v.useState(""),[y,g]=v.useState(""),[m,x]=v.useState(!1),[b,w]=v.useState(0),[A,O]=v.useState(),[_,C]=v.useState(),[j,V]=v.useState(),[B,z]=v.useState(!1),[Y,H]=v.useState("");v.useEffect(()=>{var I,U;if(t.network){const F=fp(t.network.name);(I=F==null?void 0:F.blockExplorer)!=null&&I.rootUrl&&H((U=F.blockExplorer)==null?void 0:U.rootUrl)}},[t.network]),v.useEffect(()=>{L(n)},[n]);const L=async I=>{var X;if(!ene(I)){c("---");return}c("...");const U=new wD(`https://nodes.sequence.app/${(X=t.network)==null?void 0:X.name}`),F=new Mu(I,["function balanceOf(address) view returns (uint256)","function decimals() view returns (uint8)","function symbol() view returns (string)"],U);try{const[oe,ae,ke]=await Promise.all([F.balanceOf(Oe.getAddress()),F.decimals(),F.symbol()]);w(ae),c(`${mC(oe,ae)} ${ke}`)}catch{c("---")}},T=async()=>{const I=await cg({transactions:[QA({token:n,to:l,value:Xh(f,b).toString()})],network:t.network});if(I.feeQuote&&I.feeOptions){O(I.feeOptions),V(I.feeQuote),console.log("feeOptions",I);return}z(!0),console.log("tx sponsored")},P=async()=>{var I;try{g(""),x(!0);const U=await Oe.sendERC20({token:n,to:l,value:Xh(f,b),network:(I=t.network)==null?void 0:I.id,transactionsFeeOption:_,transactionsFeeQuote:j});Ay(U)?p(U.data.txHash):g(U.data.error)}catch(U){console.error(U)}finally{x(!1)}},R=I=>{r(I),I==="Custom"?(s(""),o(!0)):(s(I),o(!1))};return k.jsxs(q,{children:[k.jsxs(q,{marginTop:"5",children:[k.jsx(Rm,{name:"token",options:O8,value:e??"",onValueChange:I=>R(I)}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:n,disabled:!i,onChange:I=>s(I.target.value),placeholder:"Custom ERC20 Contract Address"})})]}),k.jsxs(q,{marginTop:"3",children:[k.jsxs(ue,{variant:"normal",color:"text100",children:["Token Balance: ",a]}),k.jsx(ut,{marginLeft:"2",size:"xs",label:"Fetch",onClick:()=>L(n)})]}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:l,onChange:I=>u(I.target.value),placeholder:"Destination Address"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:f,onChange:I=>d(I.target.value),placeholder:"Amount"})}),y&&k.jsx(q,{marginTop:"3",children:k.jsxs(ue,{color:"error",children:["Error: ",y]})}),k.jsx(lg,{feeOptions:A,onSelected:C}),B&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),m?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:n===""&&l==="",onClick:()=>T()}),k.jsx(ut,{marginTop:"5",label:"Send Token",onClick:P})]}),h&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),k.jsx("a",{href:`${Y}tx/${h}`,target:"_blank",rel:"noopener noreferrer",children:h})]})]})}const spe="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function ipe(t){var a;const[e,r]=v.useState(""),[n,s]=v.useState("");v.useEffect(()=>{t.onChange(t.index,e,n)},[e,n]);const i={display:"flex",gap:"10px",marginBottom:"10px"},o={flex:1};return k.jsxs(q,{style:i,children:[k.jsx(q,{style:o,children:k.jsx(Rm,{name:`sendERC1155TokenId${t.index}`,value:e,disabled:!t.options,onValueChange:c=>{r(c)},options:((a=t.options)==null?void 0:a.balances.map(c=>{var l;return{label:`${((l=c.tokenMetadata)==null?void 0:l.name)||"Unknown"} - ${c.balance}`,value:c.tokenID}}))||[],placeholder:"Select a token"})}),k.jsx(q,{style:o,children:k.jsx(sr,{type:"text",value:e,onChange:c=>r(c.target.value),placeholder:"Token ID"})}),k.jsx(q,{style:o,children:k.jsx(sr,{type:"text",value:n,onChange:c=>s(c.target.value),placeholder:"Amount"})}),k.jsx(q,{style:o,children:k.jsx(ut,{label:"Remove",onClick:()=>t.removeTokenEntry(t.index)})})]})}function ope(t){const[e,r]=v.useState(""),[n,s]=v.useState([]),[i,o]=v.useState(""),[a,c]=v.useState(""),[l,u]=v.useState(""),[f,d]=v.useState(!1),[h,p]=v.useState(void 0),[y,g]=v.useState(),[m,x]=v.useState(),[b,w]=v.useState(),[A,O]=v.useState(!1),[_,C]=v.useState("");v.useEffect(()=>{var L,T;if(t.network){const P=fp(t.network.name);(L=P==null?void 0:P.blockExplorer)!=null&&L.rootUrl&&C((T=P.blockExplorer)==null?void 0:T.rootUrl)}},[t.network]);const j=()=>{s([...n,{tokenId:"",amount:""}])},V=async()=>{if(!e||!t.network)return;const L=t.network.name,T=new WL("https://"+L+"-indexer.sequence.app",spe),P=e,R=await Oe.getAddress(),I=!0;p(await T.getTokenBalances({contractAddress:P,accountAddress:R,includeMetadata:I}))};v.useEffect(()=>{V()},[e]);const B=(L,T)=>{const P=[...n];P[L]=T,s(P)},z=L=>{const T=[...n];T.splice(L,1),s(T)},Y=async()=>{const L=await cg({transactions:[YA({to:i,token:e,values:n.map(T=>({id:T.tokenId,amount:Xh(T.amount,0)}))})],network:t.network});if(L.feeQuote&&L.feeOptions){g(L.feeOptions),w(L.feeQuote),console.log("feeOptions",L);return}O(!0),console.log("tx sponsored")},H=async()=>{var L;try{u(""),d(!0);const T=await Oe.sendERC1155({to:i,token:e,values:n.map(P=>({id:P.tokenId,amount:Xh(P.amount,0)})),network:(L=t.network)==null?void 0:L.id,transactionsFeeOption:m,transactionsFeeQuote:b});Ay(T)?c(T.data.txHash):u(T.data.error)}catch(T){console.error(T)}finally{d(!1)}};return k.jsxs(q,{children:[k.jsx(q,{marginBottom:"5",children:k.jsx(sr,{type:"text",value:e,onChange:L=>r(L.target.value),placeholder:"Token Contract Address"})}),k.jsx(q,{marginBottom:"5",children:k.jsx(ut,{label:"Fetch metadata",onClick:()=>V()})}),n.map((L,T)=>k.jsx(q,{marginBottom:"3",children:k.jsx(ipe,{index:T,options:h,onChange:(P,R,I)=>B(P,{tokenId:R,amount:I}),removeTokenEntry:z})},T)),k.jsx(ut,{label:"Add Token",onClick:j}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:i,onChange:L=>o(L.target.value),placeholder:"Destination Address"})}),l&&k.jsx(q,{marginTop:"3",children:k.jsxs(ue,{color:"error",children:["Error: ",l]})}),k.jsx(lg,{feeOptions:y,onSelected:x}),A&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),f?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&i===""&&n.length!==0,onClick:()=>Y()}),k.jsx(ut,{marginTop:"5",label:"Send Tokens",onClick:H})]}),a&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),k.jsx("a",{href:`${_}tx/${a}`,target:"_blank",rel:"noopener noreferrer",children:a})]})]})}const Ue={AMOY:80002,APE_CHAIN_TESTNET:33111,ARBITRUM:42161,ARBITRUM_GOERLI:421613,ARBITRUM_NOVA:42170,ARBITRUM_SEPOLIA:421614,AVALANCHE:43114,AVALANCHE_TESTNET:43113,BASE:8453,BASE_GOERLI:84531,BASE_SEPOLIA:84532,B3_SEPOLIA:1993,BLAST:81457,BLAST_SEPOLIA:168587773,BORNE_TESTNET:94984,BSC:56,BSC_TESTNET:97,FANTOM:250,FANTOM_TESTNET:4002,GNOSIS:100,GOERLI:5,HOMEVERSE:19011,HOMEVERSE_TESTNET:40875,IMMUTABLE_ZKEVM:13371,IMMUTABLE_ZKEVM_TESTNET:13473,KOVAN:42,MAINNET:1,OPTIMISM:10,OPTIMISM_SEPOLIA:11155420,OPTIMISM_TESTNET:69,POLYGON:137,POLYGON_MUMBAI:80001,POLYGON_ZKEVM:1101,RINKEBY:4,ROPSTEN:3,SEPOLIA:11155111,ASTAR_ZKEVM:3776,ASTAR_ZKYOTO:6038361,XAI:660279,XAI_SEPOLIA:37714555429,XR_SEPOLIA:2730},ape={[Ue.MAINNET]:"https://assets.sequence.info/images/networks/small/1.webp",[Ue.ROPSTEN]:"https://assets.sequence.info/images/networks/small/3.webp",[Ue.GOERLI]:"https://assets.sequence.info/images/networks/small/5.webp",[Ue.KOVAN]:"https://assets.sequence.info/images/networks/small/42.webp",[Ue.OPTIMISM]:"https://assets.sequence.info/images/networks/small/10.webp",[Ue.OPTIMISM_TESTNET]:"https://assets.sequence.info/images/networks/small/69.webp",[Ue.OPTIMISM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155420.webp",[Ue.POLYGON]:"https://assets.sequence.info/images/networks/small/137.webp",[Ue.POLYGON_MUMBAI]:"https://assets.sequence.info/images/networks/small/80001.webp",[Ue.POLYGON_ZKEVM]:"https://assets.sequence.info/images/networks/small/1101.webp",[Ue.APE_CHAIN_TESTNET]:"https://assets.sequence.info/images/networks/small/33111.webp",[Ue.ARBITRUM]:"https://assets.sequence.info/images/networks/small/42161.webp",[Ue.ARBITRUM_NOVA]:"https://assets.sequence.info/images/networks/small/42170.webp",[Ue.ARBITRUM_GOERLI]:"https://assets.sequence.info/images/networks/small/421613.webp",[Ue.ARBITRUM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/421614.webp",[Ue.GNOSIS]:"https://assets.sequence.info/images/networks/small/100.webp",[Ue.BSC]:"https://assets.sequence.info/images/networks/small/56.webp",[Ue.BSC_TESTNET]:"https://assets.sequence.info/images/networks/small/97.webp",[Ue.FANTOM]:"https://assets.sequence.info/images/networks/small/250.webp",[Ue.FANTOM_TESTNET]:"https://assets.sequence.info/images/networks/small/4002.webp",[Ue.AVALANCHE]:"https://assets.sequence.info/images/networks/small/43114.webp",[Ue.AVALANCHE_TESTNET]:"https://assets.sequence.info/images/networks/small/43113.webp",[Ue.BASE]:"https://assets.sequence.info/images/networks/small/8453.webp",[Ue.BASE_SEPOLIA]:"https://assets.sequence.info/images/networks/small/84532.webp",[Ue.BORNE_TESTNET]:"https://assets.sequence.info/images/networks/small/94984.webp",[Ue.BLAST]:"https://assets.sequence.info/images/networks/small/81457.webp",[Ue.BLAST_SEPOLIA]:"https://assets.sequence.info/images/networks/small/168587773.webp",[Ue.SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155111.webp",[Ue.AMOY]:"https://assets.sequence.info/images/networks/small/80002.webp",[Ue.HOMEVERSE]:"https://assets.sequence.info/images/networks/small/19011.webp",[Ue.HOMEVERSE_TESTNET]:"https://assets.sequence.info/images/networks/small/40875.webp",[Ue.IMMUTABLE_ZKEVM]:"https://assets.sequence.info/images/networks/small/13371.webp",[Ue.IMMUTABLE_ZKEVM_TESTNET]:"https://assets.sequence.info/images/networks/small/13473.webp",[Ue.XAI]:"https://assets.sequence.info/images/networks/small/660279.webp",[Ue.XAI_SEPOLIA]:"https://assets.sequence.info/images/networks/small/37714555429.webp",[Ue.ASTAR_ZKEVM]:"https://assets.sequence.info/images/networks/small/3776.webp",[Ue.ASTAR_ZKYOTO]:"https://assets.sequence.info/images/networks/small/6038361.webp",[Ue.B3_SEPOLIA]:"https://assets.sequence.info/images/networks/small/1993.webp",[Ue.XR_SEPOLIA]:"https://assets.sequence.info/images/networks/small/2730.webp"};function cpe({onNetworkChange:t}){const[e,r]=v.useState(),[n,s]=v.useState([]);return v.useEffect(()=>{Oe.networkList().then(i=>{s(i),r(i[0]),t(i[0])})},[]),n.length===0?k.jsx(q,{marginY:"5",children:k.jsx(Bn,{})}):k.jsxs(q,{marginBottom:"4",children:[k.jsx(q,{marginBottom:"4",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Network to use with requests:"})}),k.jsx(q,{children:k.jsx(Rm,{name:"chainId",labelLocation:"top",onValueChange:i=>{const o=n==null?void 0:n.find(a=>a.name===i);o&&(r(o),t(o))},value:e==null?void 0:e.name,options:[...n.map(i=>({label:k.jsxs(q,{alignItems:"center",gap:"2",children:[k.jsx(mX,{src:ape[i.id],size:"sm"}),k.jsx(ue,{children:i.name})]}),value:String(i.name)}))]})})]})}function XL(t){var e;if(t.type===Ft.Email)return k.jsxs(ue,{variant:"normal",color:"text100",children:["Email (",t.email,")"]});if(t.type===Ft.Guest)return k.jsx(ue,{variant:"normal",color:"text100",children:"Guest account"});if(t.type===Ft.PlayFab)return k.jsxs(ue,{variant:"normal",color:"text100",children:["PlayFab (",t.email,")"]});if(t.type===Ft.OIDC&&(e=t.issuer)!=null&&e.includes("cognito-idp"))return k.jsxs(ue,{variant:"normal",color:"text100",children:["Email Legacy (",t.email,")"]});if(t.type===Ft.Stytch)return k.jsxs(k.Fragment,{children:["Stytch account (",t.email,")"]});switch(t.issuer){case"https://accounts.google.com":return k.jsxs(q,{gap:"2",marginTop:"2",children:[k.jsx("img",{width:24,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABq9JREFUaEPVWWtsFFUU/s6d2S1F6IJgAQWiBQooEmiRR0NLCxQpLwUBQRI0JD4wGh9RedjVEkqERKMxmuAPjBgpWECJoNViaQFTKbitFiyUh5ogiykaSym07M7MkVmt3W13Z2Z3Fg3zbzPnfOf7zjl777l3CDf4Qzc4f8RNwKW80beofl8WaTSCwalgStYk6i6YGRqaIdEFBp8EUCs7HAe7l9RciEfybAlozr6zr18SS4hpCROPIlhLCANMQA2DtjhUtahbRd1vsYqJSUDjtJF3QOFVDF5KhIRYg+t+zLjKhA9Ildf3rPj+l2ixohLAeYMTmq52WcmElQC6RBvM2J5bCGJ9krNlA5WcvmoV27KAi7nDh7AmFQMYZRU8JjumGpKUB117j5+y4m9JQOOUEblg7AAhyQqobRtGE4ge6FF29GszLFMBrWuSl7ccSH6TYK/XzYh0fM8MnyCe6Cr78YiRr6EALscsMD5VTiQ1XP5k4K3gaGnYsdfed2XWPUoF0GISwOUYAUIVGF11AF9tkrdld1QiWsHsBUEA6ANQYhRyNrkyjz1mRl7HC1sB/go3QcYRCAwPDmoogvkKBH1OGn8qZKmse2ltQ7BvU3ZqbxaOXCaaA+Y5IAokpvNjLfNtfuEFlGM9gBXh4JXjSd7gdgrsswJbFPKvvGVvvddKlvVdW/FdzQfoSQLJ7T7RkQ9bAd6HoRCoBcMZiUxbJZhxXrB2v2tf3WErxDvaXJw6crzG2icE9AOiJx9eQAU2g7HUjJCvqldV875+C3qVHjtrZmv0/o/skf1liZclZR4ttNLzHbFCWoj3YwBUnAHBYUiKcRaEsZSDmGcYO6KDfUMF7MPqa+TXGYITfGCMoxx8Hy8SdnBCBZTjGIC7TAS8Tdl4xk7QePr+K4DLcBsEfjVpnUuQMYiyEJdZPh5C2gWUYwmAj0xAN1MOHrETOG0tD5eg3GYHAyTXH8mnwOIRLOA1IDAmGz1zKQe77ARPW6dsJMbjdjDAvNbjdrwSKqACO8GYZwjcAhfNQJOd4PERoBV53E69Y0IqcABAZkRyjEaajJ52yOu+8RGAgx63nBUqoAzVEBgdkSChjrJNVigL6uIk4JDHLU+ITgBQTzkYZoGjoUk8BGiMwzVuedwN20IaUFGTL+d0rMB2CMw3TJ+CHpSLi3aqEI8KgLUPPW7nw7EsowsoBzv+bwHMvK7a7cjvuIwuBqPoem9ko9e3ZJHqjPhfIg3LQWx888GY63HLgf2ofSM7gH5QYXYguXxttx58vabQCQV8s09WzgKRTmuBmzCGKid7Cuj3EAH6Dy5DLQTuNqnCO5SDp+20USTf9EL/GwA9b4jNVO1xS+ltNh2nUX2U0EeKyI8+TqvIpCmI6RQWCXh0oW+MYKoEkeFZhEHPVedLb4UXoE+kEn4yOk7+43gOEu6hLJyPRyXGreM+flYrCUgxxmOfJuT+Navp32m406GeK7AJjGVGQBpDW9o0dluV2mvF6QdKjEdwE4VDi6cPTTj3wgbH5ez7LCRjoydfXh5s11lAGQZB4MdrrRT21lknP/dixsE6v2uSfqgnxrzTi0oOWQjeyWTQ9rw80rQikOiR+OuqSueVjIxIOAxudSjykKoCCklYpGuVQgAvdwTTyc9vzCg/qrimtL9jDRA7JSgr6heW/mxFSMq2GalCoBDM80HtK2Gi1/2ds3nsmHAYxLzmO7ejoOO7SAK6gPEtqP0mOpD5PzMO1qmuSRFIthJQAqLdmqJ8fUZyebFwu6rbpr+X7mjq3XcAFJ7GpM5hFrlECLoPakcMWwmmaiSL8Z7HyW9JQGBJ3Y/hUHEYhG7BbWMlw3/bsMpMDURMYOoTnGkzjESvu8rZPDYwrAHcCCFP8KymE2ErYwTGZZisEfbMb8yoDG0bMwr233f1rjzkaM5IE4yZR9yOiNfsptfrT3yWNmtva/JOAkW8qbNPtzMCA82J3qcWH3t25h4jfFMBuvOQj++dqpHYSfjPPnA0aMyzflr0peG3AZ2bJQG64bCt02/3SbxNQPzTm9cj74AG7YAMx0MnF+45ZyWCZQE62OAv8hLoMr/IGlZFvh63EjaMDWuNBHr1FHV/t231soIUlYA2wJTi2QMF+V/6e8eO6sNFJ07MfAkkNkJWXj8zrzTkm8J1E9AGnFo0u7cqK4sIvBjAOIAkK0EZ8BP4G2baqjoTtv8yd1ejFb+ol9FoQFOKp7okSBOZxQgIpILRG+BuDKER1GaCaNAYpwTRD4mtSmXt0lL9bGH7iamFbEeNI8ANL+AvTa+pT4hOMw0AAAAASUVORK5CYII="}),k.jsxs(ue,{variant:"normal",color:"text100",children:["Google (",t.email,")"]})]});case"https://appleid.apple.com":return k.jsxs(q,{gap:"2",children:[k.jsx("img",{width:24,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABMlJREFUaEPVmV1oXEUUx89/Ete6SUykWiv4QcRYymISc2fWdCPUVUQUpIqKPggaEa1Wqj7UPokg+hJfagM+iMX2QS0RjQSFIkLpQ2Oyd+7GtaTiB4rgB8ZqNKlJupvco6MbCHH33tnNzSaZ1zn3f/6/O3PnzMwFbfCGDe6f1gxgfHw8Njs7exMRXd/c3Hygra3tXDUvs+YAx48f39TU1LSPiJ4koq1F0y1Syj/XPYDWuouIjhJR2xKzc47jxAHwugZwXbcHwEdE1LzUKIBhx3F6qjFvnqnJFMpkMluFEGNLpsxSv3ullP3rGkBrbd78HctNMvNkoVC4JpVK/b5uATKZjBJCZEoZBPC44zivV2u+JlPI87x+Zn6qhMnDUsrelZivCYDW+nMium6pUWZ+U0r5KAB/IwCcIaLNxigz/yGEeNZxnMMrNb74/IpXoZGRkUvr6+vnyhUirfXbRDTDzCfi8fhgIpE4a5KPjo5uFkJcKf5rv3V2dn5fTS2oGEBrfRkRPUREdzFzJ4Dzi2/3VwAnieiDWCw21N7ePrls2sB13R11dXW7mPn2EtPqLAAN4Eh9ff27HR0df9mMkjWA2QI0NjY+T0RPA2gIEmfmcwCOEdHHzPyjECLFzPcS0dU2pojoDDPvVkq9FxZvBWAKERENCiG6wwQj7u+XUu4N0gwFGBsba1lYWBglomsjNmcr94KU8sVywYEAzCyy2eyHxTlrmzCyOGbOA9gnpTxYFYDrug8AeCcyRxUIMfNPRHS3UqpkFQ9dRgcGBupaW1tPAdheQd6oQqd939+RTCbHwwTLTqFsNnuL7/ufhAmsUv8eKeVrNtplAVzX7TPzz0YkyhhmNgWtTUpZsNEtC6C1Nvv3ThuRKGOY+RWl1HO2mkEjMAmgxVYoqjgA9ziO876tXkkAc2MwMzMzByC0Ttgmso1j5hvCVp6lWiUNFvc7ZhmreWPmLqWUmb5WrSRALpfbUigUfrFSiDiImW9VSlmvfiUBhoeHL4jFYjMRe7OSY+b9Sqk+q+CgWwnXdScAXGIrFFUcM3+qlErZ6pX9SD3PO8nM1kK2CW3ifN/vSSaTwzaxQXXggNn724isQsyp6enpZDqdngvTDgK4j4gGwgRWsf+Q4ziPhR38ywIUzwETRHTeKpoMlAZwdGpqqjdoJAILVSaTOSaEuG2tAExeZv4GwDNSSnO7978WCOB53p3/FJahtQQwuX3fn2hoaLgikUjkl3sJO5HB87wviGjbGkO8JKU0FwqVjYCJ1lqbQ/WrawgwPz8/39rd3f1DVQDFqvwVEV2+RhBvSSkfLJfbarfped7D5j6z1gDmUE9E25VS364IwNxOeJ53gohurCUEgD7HcfYH5bQaASPguu42AJ8R0aYaQXydz+c7UqnUbCQARYhHAByqAcAcM++0OdhYj8Ci6YAfFpFwMTMD6JVSHrERrBjAfA9a64MA9lgkWCCin33fjwkhtljG75ZSvmER+29IxQCLwlrrJ5j5ZQAXLUt2GoDZBA5OTU2dTqfT86Y/l8s15PP5nQDuN1fzRHThsue+NL+iKjmNrQigWOQuJiJzbX4VgO8AjHZ1deXC3l6xttxslkjz35iZc/F4fKjUViFMq+oRCBOuVf+GB/gb9M3GQJMHYpQAAAAASUVORK5CYII="}),k.jsxs(ue,{variant:"normal",color:"text100",children:["Apple (",t.email,")"]})]});default:return"Unknown"}}function lpe(){var V;const t=M9(),[e,r]=v.useState(),[n,s]=v.useState(),[i,o]=v.useState(!0),[a,c]=v.useState(),[l,u]=v.useState(""),f=v.useRef(null),d=(V=f.current)==null?void 0:V.validity.valid,[h,p]=v.useState(!1),[y,g]=v.useState([]),{inProgress:m,loading:x,initiateAuth:b,sendChallengeAnswer:w}=KL({sessionName:fc(),onSuccess:async({wallet:B})=>{console.log(`Wallet address: ${B}`)},linkAccount:!0}),A=async B=>{o(!0),s(void 0);try{await Oe.removeAccount(B);const z=await Oe.listAccounts();s(z.accounts)}catch(z){c(z.message);const Y=await Oe.listAccounts();s(Y.accounts)}o(!1)},O=async B=>{const z=await Oe.initAuth({idToken:B.credential});try{const Y=await Oe.linkAccount(z);s(H=>[...H||[],Y.account])}catch(Y){vv(Y)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},_="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":"/"),C=async B=>{const z=await Oe.initAuth({idToken:B.authorization.id_token});try{const Y=await Oe.linkAccount(z);s(H=>[...H||[],Y.account])}catch(Y){vv(Y)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},j=e7({flow:"implicit",onSuccess:B=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:B.access_token,CreateAccount:!0,TitleId:"8F854"},async(z,Y)=>{if(z)try{const H=await Oe.initAuth({playFabTitleId:"8F854",playFabSessionTicket:z.data.SessionTicket}),L=await Oe.linkAccount(H);console.log("playfab account",JSON.stringify(L.account,null,2)),s(T=>[...T||[],L.account])}catch(H){console.error(H),vv(H)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}else Y&&console.log("Error: "+JSON.stringify(Y))})}});return v.useEffect(()=>{Oe.listAccounts().then(B=>{s(B.accounts),B.currentAccountId&&r(B.accounts.find(z=>z.id===B.currentAccountId)),o(!1)}).catch(B=>{c(B.message),o(!1)})},[m]),k.jsxs(q,{children:[k.jsx(gr,{background:"buttonGlass"}),k.jsxs(q,{marginBottom:"5",gap:"4",flexDirection:"column",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your connected (linked) accounts"}),n&&k.jsx(k.Fragment,{children:n.map(B=>k.jsxs(q,{flexDirection:"row",alignItems:"center",gap:"2",children:[k.jsx(ue,{variant:"normal",color:"text100",children:XL(B)}),B.id!==(e==null?void 0:e.id)&&k.jsx(ut,{size:"xs",label:"Remove",onClick:()=>A(B.id)}),B.id===(e==null?void 0:e.id)&&k.jsx(q,{children:k.jsx(ue,{variant:"small",color:"text100",children:"(Account you logged in with)"})})]},B.id))}),i&&k.jsx(Bn,{})]}),k.jsx(gr,{background:"buttonGlass"}),k.jsxs(q,{flexDirection:"column",gap:"2",width:"fit",children:[k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",marginBottom:"5",children:"Connect (link) another login method"}),k.jsx(Z9,{onSuccess:O,shape:"circle",width:230}),k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsx(r7,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:_,usePopup:!0},onError:B=>console.error(B),onSuccess:C,uiType:"dark"}),k.jsxs(k.Fragment,{children:[k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsx(q,{marginTop:"2",children:k.jsx(q,{children:k.jsx(ut,{label:"Login with Google (through Playfab)",onClick:j})})})]}),k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsx(q,{marginTop:"2",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Email"})}),w?k.jsxs(q,{flexDirection:"column",children:[k.jsx(q,{marginTop:"3",children:k.jsx(ue,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),k.jsx(q,{marginTop:"4",children:k.jsx(lY,{value:y,digits:6,onChange:g})}),k.jsx(q,{gap:"2",marginY:"4",children:x?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:y.includes(""),label:"Verify",onClick:()=>w(y.join("")),"data-id":"verifyButton"})})]}):k.jsxs(q,{marginBottom:"4",children:[k.jsxs(ue,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",k.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),k.jsxs(q,{marginTop:"6",children:[k.jsx(sr,{name:"email",type:"email",onChange:B=>{u(B.target.value)},ref:f,onKeyDown:B=>{l&&B.key==="Enter"&&b(l)},onBlur:()=>p(!!l&&!d),value:l,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),h&&k.jsx(ue,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:x?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:!d,label:"Continue",onClick:()=>b(l),"data-id":"continueButton"})})]})]}),a&&k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading accounts: ",a]})]})}function upe(){const[t,e]=v.useState(),[r,n]=v.useState(),[s,i]=v.useState([]),[o,a]=v.useState(!1),[c,l]=v.useState(!1),[u,f]=v.useState(),[d,h]=v.useState();return v.useEffect(()=>{Oe.getAddress().then(p=>{e(p)}).catch(p=>{n(p.message)}),Oe.listAccounts().then(p=>{p.currentAccountId&&h(p.accounts.find(y=>y.id===p.currentAccountId))})},[]),v.useEffect(()=>{Oe.isSignedIn().then(p=>{p||oi.navigate("/login")})},[]),v.useEffect(()=>{const p=s.join("");p.length===6&&(l(!0),Oe.finishValidateSession(p))},[s]),v.useEffect(()=>{const p=Oe.onValidationRequired(()=>{a(!0),Oe.waitForSessionValid(6e5,4e3).then(y=>{console.log("isValid",y),i([]),a(!1),l(!1)})});return()=>{p.then(y=>y())}},[]),k.jsxs(k.Fragment,{children:[k.jsx(yS,{children:o&&k.jsx(PN,{children:k.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"1.2em",height:"50vh"},children:k.jsxs(q,{flexDirection:"column",alignItems:"center",children:[k.jsx(ue,{marginBottom:"7",children:"Please enter the session verification code that was sent to your email"}),k.jsx(n7,{value:s,digits:6,onChange:i}),k.jsx(q,{marginTop:"5",children:c&&k.jsx(Bn,{})})]})})})}),k.jsxs(q,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[k.jsx(q,{marginBottom:"10",children:k.jsx(s7,{})}),k.jsxs(q,{marginBottom:"5",flexDirection:"row",children:[d&&k.jsxs(q,{flexDirection:"column",gap:"2",children:[k.jsxs(ue,{marginTop:"1",variant:"normal",color:"text100",children:[d.type===Ft.Guest?"Guest account":`Logged in with account type ${d.type}`," "]}),d.type!==Ft.Guest&&XL(d)]}),k.jsx(ut,{marginLeft:"auto",label:"Log out",size:"xs",onClick:async()=>{try{await Oe.dropSession({strict:!1})}catch(p){console.warn(`Could not drop session: ${p.message}`)}vee(),oi.navigate("/login")}})]}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{marginBottom:"5",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your wallet address:"})}),k.jsx(q,{marginBottom:"5",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"normal",children:t?k.jsx(q,{children:k.jsx(ue,{children:t})}):k.jsx(Bn,{})})}),k.jsx(q,{children:r&&k.jsxs(ue,{children:["Error fetching wallet address: ",r]})}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(epe,{}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{marginBottom:"5",children:k.jsx(cpe,{onNetworkChange:f})}),k.jsx(gr,{background:"buttonGlass"}),k.jsxs(_l,{marginY:"3",label:"Send native token transaction",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(Zhe,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Send ERC20 transaction",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(npe,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Send ERC1155 transaction",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(ope,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Sign a message",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(tpe,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Call contracts",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(rpe,{network:u})]}),k.jsx(_l,{marginY:"3",label:"External Wallet Linking Demo",children:k.jsxs(ue,{as:"a",variant:"medium",color:"text100",href:"https://demo-waas-wallet-link.pages.dev/",target:"_blank",rel:"noopener noreferrer",children:["Go to demo",k.jsx(xG,{position:"relative",top:"1",marginLeft:"1"})]})}),k.jsx(lpe,{})]})]})}function fpe(t,e,r){return e=rj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z2(t,e){return ppe(t)||hpe(t,e)||ZL(t,e)||dpe()}function dpe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hpe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,a=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(u){l=!0,s=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw s}}return a}}function ppe(t){if(Array.isArray(t))return t}function ype(t){return gpe(t)||mpe(t)||ZL(t)||vpe()}function vpe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZL(t,e){if(t){if(typeof t=="string")return H2(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H2(t,e)}}function mpe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function gpe(t){if(Array.isArray(t))return H2(t)}function H2(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--U){var F=this.tryEntries[U],X=F.completion;if(F.tryLoc==="root")return I("end");if(F.tryLoc<=this.prev){var oe=n.call(F,"catchLoc"),ae=n.call(F,"finallyLoc");if(oe&&ae){if(this.prev=0;--I){var U=this.tryEntries[I];if(U.tryLoc<=this.prev&&n.call(U,"finallyLoc")&&this.prev=0;--R){var I=this.tryEntries[R];if(I.finallyLoc===P)return this.complete(I.completion,I.afterLoc),Y(I),g}},catch:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var I=this.tryEntries[R];if(I.tryLoc===P){var U=I.completion;if(U.type==="throw"){var F=U.arg;Y(I)}return F}}throw new Error("illegal catch attempt")},delegateYield:function(P,R,I){return this.delegate={iterator:L(P),resultName:R,nextLoc:I},this.method==="next"&&(this.arg=t),g}},e}function Ls(t){"@babel/helpers - typeof";return Ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ls(t)}function wn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _8(t,e){for(var r=0;rv.useContext(Ak).isMounted,Qhe=()=>(_0(JL(),QL("useStytchSession")),v.useContext(YL)),Yhe=()=>{const t=v.useContext(Ak);return _0(t.isMounted,QL("useStytch")),t.client},Jhe=({stytch:t,children:e})=>{_0(!JL(),Hhe),_0(typeof window<"u",Ghe);const r=v.useMemo(()=>({client:t,isMounted:!0}),[t]),[{user:n,session:s},i]=zhe({session:t.session.getInfo(),user:t.user.getInfo()});return v.useEffect(()=>t.onStateChange(()=>{i(o=>{const a={session:t.session.getInfo(),user:t.user.getInfo()};return $he(o,a)})}),[i,t]),cr.createElement(Ak.Provider,{value:r},cr.createElement(Khe.Provider,{value:n},cr.createElement(YL.Provider,{value:s},e)))};function Xhe(){const t=Yhe(),{session:e}=Qhe(),[r,n]=v.useState(0),[s,i]=v.useState(""),o=v.useRef(null);v.useEffect(()=>{if(localStorage.getItem("stytch_auth")!=="native")return;const c=new URLSearchParams(window.location.search);c.get("stytch_token_type")==="magic_links"&&r===0&&(n(2),(async()=>await t.magicLinks.authenticate(c.get("token")||"",{session_duration_minutes:5}))())},[t,e,r]),v.useEffect(()=>{localStorage.getItem("stytch_auth")==="native"&&e&&r==2&&(n(3),(async()=>{const c=t.session.getTokens(),l=await Oe.signIn({idToken:c.session_jwt},fc());console.log(`Wallet address: ${l}`),await t.session.revoke(),n(0),window.location.search="",oi.navigate("/")})())},[e,t,r]);const a=async c=>{localStorage.setItem("stytch_auth","native"),n(1),await t.magicLinks.email.loginOrCreate(c,{})};return k.jsxs(q,{children:[k.jsx(q,{marginBottom:"4",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Stytch login"})}),k.jsxs(q,{marginTop:"5",marginBottom:"4",children:[k.jsx(q,{marginTop:"6",children:k.jsx(sr,{name:"stytchEmail",type:"email",onChange:c=>{i(c.target.value)},ref:o,onKeyDown:c=>{s&&c.key==="Enter"&&a(s)},value:s,placeholder:"hello@example.com",disabled:r!==0,required:!0})}),k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(ut,{variant:"primary",label:"Continue",onClick:()=>a(s),"data-id":"continueButton",disabled:r!==0})}),r===1&&k.jsx(q,{children:k.jsx(ue,{variant:"normal",color:"text80",children:"Magic link sent to your email. Please click the link. You can close this page."})})]})]})}function Zhe(){var B;const[t,e]=v.useState(""),r=v.useRef(null),n=(B=r.current)==null?void 0:B.validity.valid,[s,i]=v.useState(!1),[o,a]=v.useState([]),[c,l]=v.useState(),[u,f]=v.useState(!1),d=v.useRef(null);Oe.onEmailConflict(async(z,Y)=>{d.current=Y,l(z),f(!0)});const h=e7({flow:"implicit",onSuccess:z=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:z.access_token,CreateAccount:!0,TitleId:"8F854"},async(Y,H)=>{if(Y)try{const L=await Oe.signIn({playFabTitleId:"8F854",playFabSessionTicket:Y.data.SessionTicket},fc());console.log("Sequence response:",L),oi.navigate("/")}catch{console.error("Error: "+JSON.stringify(H))}else H&&console.error("Error: "+JSON.stringify(H))})}}),{inProgress:p,loading:y,initiateAuth:g,sendChallengeAnswer:m,cancel:x}=KL({sessionName:fc(),onSuccess:async({wallet:z})=>{console.log(`Wallet address: ${z}`),oi.navigate("/")}});v.useEffect(()=>{(async()=>await Oe.isSignedIn()&&oi.navigate("/"))()},[]);const b=async z=>{const Y=await Oe.signIn({idToken:z.credential},fc());console.log(`Wallet address: ${Y.wallet}`),console.log(`Email address: ${Y.email}`),oi.navigate("/")},w="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":""),A=async z=>{const Y=await Oe.signIn({idToken:z.authorization.id_token},fc());console.log(`Wallet address: ${Y.wallet}`),console.log(`Email address: ${Y.email}`),oi.navigate("/")},O=async()=>{const z=await Oe.signIn({guest:!0},fc());console.log(`Wallet address: ${z.wallet}`),oi.navigate("/")},_=new URLSearchParams(window.location.search),C=_.get("env")==="dev",[j,V]=v.useState(C);return k.jsxs(k.Fragment,{children:[k.jsxs(q,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[k.jsxs(q,{marginBottom:"16",flexDirection:"row",children:[k.jsx(s7,{}),k.jsx(q,{marginLeft:"auto",children:k.jsx(kJ,{label:"Use dev env",checked:j,onCheckedChange:()=>{j?(_.delete("env"),window.location.search=_.toString()):(_.set("env","dev"),window.location.search=_.toString()),V(!j)}})})]}),k.jsx(q,{marginTop:"6",marginBottom:"4",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Guest Login"})}),k.jsx(q,{gap:"4",children:k.jsx(ut,{label:"Login as guest",onClick:O})}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{marginTop:"6",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Email Login"})}),m?k.jsxs(q,{flexDirection:"column",children:[k.jsx(q,{marginTop:"6",children:k.jsx(ue,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),k.jsx(q,{marginTop:"4",children:k.jsx(n7,{value:o,digits:6,onChange:a})}),k.jsx(q,{gap:"2",marginY:"4",children:y?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:o.includes(""),label:"Verify",onClick:()=>m(o.join("")),"data-id":"verifyButton"})})]}):k.jsxs(q,{marginTop:"5",marginBottom:"4",children:[k.jsxs(ue,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",k.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),k.jsxs(q,{marginTop:"6",children:[k.jsx(sr,{name:"email",type:"email",onChange:z=>{e(z.target.value)},ref:r,onKeyDown:z=>{t&&z.key==="Enter"&&g(t)},onBlur:()=>i(!!t&&!n),value:t,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),s&&k.jsx(ue,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:y?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:!n,label:"Continue",onClick:()=>g(t),"data-id":"continueButton"})})]}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{paddingY:"4",gap:"4",flexDirection:"column",width:"full",children:!p&&k.jsxs(k.Fragment,{children:[k.jsx(q,{marginBottom:"2",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Social Login"})}),k.jsxs(q,{gap:"4",flexDirection:"column",width:"fit",children:[k.jsx(q,{children:k.jsx(Z9,{onSuccess:b,shape:"circle",width:230},"google")}),k.jsx(r7,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:w,usePopup:!0},onError:z=>console.error(z),onSuccess:A,uiType:"dark"},"apple")]}),k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsxs(q,{children:[k.jsx(q,{marginBottom:"4",children:k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",children:"Playfab login"})}),k.jsx(q,{children:k.jsx(ut,{label:"Login with Google (through Playfab)",onClick:h})})]}),k.jsx(Xhe,{}),""]})})]}),u&&c&&k.jsx(PN,{size:"small",onClose:()=>f(!1),children:k.jsx(Bhe,{info:c,onCancel:()=>{f(!1),l(void 0),p&&(a([]),x(),e(""))},onConfirm:async()=>{var z;f(!1),l(void 0),await((z=d.current)==null?void 0:z.call(d))}})})]})}async function cg({transactions:t,network:e}){const r=await Oe.feeOptions({transactions:t,network:e==null?void 0:e.id});return r.data.feeQuote&&r.data.feeOptions?{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!1}:{feeQuote:r.data.feeQuote,feeOptions:r.data.feeOptions,isSponsored:!0}}function lg(t){var i;const{feeOptions:e,onSelected:r}=t,[n,s]=v.useState();return v.useEffect(()=>{e&&e.length>0&&(s(e[0]),r(e[0]))},[e]),v.useEffect(()=>{n&&r(n)},[n]),e?k.jsxs(q,{marginTop:"5",children:[k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options:"}),k.jsx(q,{marginTop:"3"}),k.jsx(Rm,{name:"chainId",labelLocation:"top",onValueChange:o=>{const a=e.find(c=>c.token.name===o);a&&s(a)},value:(i=n==null?void 0:n.token)==null?void 0:i.name,options:[...e.map(o=>{var a,c,l;return{label:k.jsx(q,{alignItems:"center",gap:"2",children:k.jsxs(ue,{children:[(a=o==null?void 0:o.token)==null?void 0:a.name," ",mC(o==null?void 0:o.value,(c=o==null?void 0:o.token)==null?void 0:c.decimals)]})}),value:String((l=o==null?void 0:o.token)==null?void 0:l.name)}})]})]}):k.jsx(q,{})}const epe="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function tpe(t){const[e,r]=v.useState(),[n,s]=v.useState("ETH"),[i,o]=v.useState(""),[a,c]=v.useState(""),[l,u]=v.useState(""),[f,d]=v.useState(),[h,p]=v.useState(!1),[y,g]=v.useState(),[m,x]=v.useState(),[b,w]=v.useState(),[A,O]=v.useState(),[_,C]=v.useState(!1);v.useEffect(()=>{j()},[]),v.useEffect(()=>{var z,Y;if(t.network){const H=fp(t.network.name);if(H){const L=H.name in{polygon:1,mumbai:1}?"MATIC":"ETH";s(L),j(),(z=H.blockExplorer)!=null&&z.rootUrl&&o((Y=H.blockExplorer)==null?void 0:Y.rootUrl)}}},[t.network]);const j=async()=>{if(!t.network)return;const z=fp(t.network.name);if(!z)return;const Y=await Oe.getAddress(),L=await new WL(ND(z.name),epe).getEtherBalance({accountAddress:Y});r(BigInt(L.balance.balanceWei))},V=async(z,Y)=>{const H=await cg({transactions:[{to:z,value:E4(Y)}],network:t.network});if(H.feeQuote&&H.feeOptions){x(H.feeOptions),O(H.feeQuote),console.log("feeOptions",H);return}C(!0),console.log("tx sponsored")},B=async(z,Y)=>{var H;try{g(void 0),p(!0);const L=await Oe.sendTransaction({transactions:[{to:z,value:E4(Y)}],network:(H=t.network)==null?void 0:H.id,transactionsFeeOption:b,transactionsFeeQuote:A});Ay(L)?d(L.data.txHash):g(L.data.error),p(!1)}catch(L){console.error(L),p(!1)}finally{O(void 0),x(void 0),w(void 0),C(!1)}};return k.jsxs(q,{children:[k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Native token balance: ",cte(e||0)," ",n]}),k.jsx(ut,{marginLeft:"2",size:"xs",label:"Fetch",onClick:j}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"sendNativeTokenTo",type:"text",onChange:z=>{c(z.target.value)},value:a,placeholder:"To address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"sendNativeTokenAmount",type:"text",onChange:z=>{u(z.target.value)},value:l,placeholder:"Amount",required:!0,"data-id":"nativeTokenSendAmount"})}),y&&k.jsxs(q,{marginTop:"3",children:["Transaction failed: ",y]}),k.jsx(lg,{feeOptions:m,onSelected:w}),_&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:a===""&&l==="",onClick:()=>V(a,l)}),k.jsx(ut,{marginTop:"5",label:"Send native token",disabled:a===""&&l==="",onClick:()=>B(a,l)})]}),f&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),k.jsx("br",{}),k.jsx("a",{href:`${i}tx/${f}`,target:"_blank",rel:"noopener noreferrer",children:f})]})]})}function rpe(){const[t,e]=v.useState(),[r,n]=v.useState(),[s,i]=v.useState(!0),[o,a]=v.useState(),c=async l=>{i(!0),e(void 0);try{await Oe.dropSession({sessionId:l}),e(await Oe.listSessions())}catch(u){a(u.message),e(await Oe.listSessions())}i(!1)};return v.useEffect(()=>{Promise.all([Oe.listSessions(),Oe.getSessionId()]).then(([l,u])=>{e(l),n(u),i(!1)}).catch(l=>{a(l.message),i(!1)})},[]),k.jsxs(q,{children:[k.jsxs(q,{marginBottom:"5",children:[k.jsx(q,{marginBottom:"5",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your open sessions:"})}),t&&k.jsx(k.Fragment,{children:t.map(l=>k.jsx(q,{children:k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"normal",children:[l.friendlyName,!l.isThis&&k.jsx("a",{style:{marginLeft:"7px",textDecoration:"underline",cursor:"pointer"},onClick:()=>c(l.id),children:"x"}),l.isThis&&k.jsx(k.Fragment,{children:" (current)"})]})},l.id))}),s&&k.jsx(Bn,{})]}),o&&k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading sessions: ",o]})]})}function npe(t){const[e,r]=v.useState(""),[n,s]=v.useState(),i=async()=>{var a;const o=await Oe.signMessage({message:e,network:(a=t.network)==null?void 0:a.id});s(o.data.signature)};return k.jsxs(q,{children:[k.jsx(sr,{name:"signMessageText",type:"text",onChange:o=>{r(o.target.value),n!=""&&s("")},value:e,placeholder:"Enter a message to sign",required:!0,"data-id":"signMessageInput"}),k.jsx(ut,{marginTop:"5",label:"Sign message",disabled:e==="",onClick:()=>i()}),n&&n!==""&&k.jsxs(q,{flexDirection:"column",marginTop:"5",children:[k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Signature for ",e,":"]}),k.jsx(q,{children:k.jsx(ue,{as:"p",wordBreak:"break-word",children:n})})]})]})}function spe(t){const[e,r]=v.useState(""),[n,s]=v.useState(""),[i,o]=v.useState(""),[a,c]=v.useState(""),[l,u]=v.useState(),[f,d]=v.useState(!1),[h,p]=v.useState(),[y,g]=v.useState(),[m,x]=v.useState(),[b,w]=v.useState(),[A,O]=v.useState(!1),[_,C]=v.useState("");v.useEffect(()=>{var B,z;if(t.network){const Y=fp(t.network.name);(B=Y==null?void 0:Y.blockExplorer)!=null&&B.rootUrl&&C((z=Y.blockExplorer)==null?void 0:z.rootUrl)}},[t.network]);const j=async()=>{const B=await cg({transactions:[bL({to:e,abi:n,func:i,args:JSON.parse(a),value:"0"})],network:t.network});if(B.feeQuote&&B.feeOptions){g(B.feeOptions),w(B.feeQuote),console.log("feeOptions",B);return}O(!0),console.log("tx sponsored")},V=async()=>{var B;try{p(void 0),d(!0);const z=await Oe.callContract({network:(B=t.network)==null?void 0:B.id,to:e,abi:n,func:i,args:JSON.parse(a),value:0,transactionsFeeOption:m,transactionsFeeQuote:b});Ay(z)?u(z.data.txHash):p(z.data.error),d(!1)}catch(z){console.error(z),d(!1)}};return k.jsxs(q,{children:[k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractAddress",type:"text",onChange:B=>{r(B.target.value)},value:e,placeholder:"Contract address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractAbi",type:"text",onChange:B=>{s(B.target.value)},value:n,placeholder:"Contract ABI or function ABI, e.g. [{...}] or [{...}, {...}] or transfer(address,uint256)",required:!0,"data-id":"nativeTokenSendAmount"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractMethod",type:"text",onChange:B=>{o(B.target.value)},value:i,placeholder:"Method name, e.g. transfer",required:!0,"data-id":"nativeTokenSendAmount"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{name:"callContractArgs",type:"text",onChange:B=>{c(B.target.value)},value:a,placeholder:'Method args, e.g. [0x..., 1000] or named { "to": "0x...", "amount": "1000" }',required:!0,"data-id":"nativeTokenSendAmount"})}),k.jsx(lg,{feeOptions:y,onSelected:x}),A&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h&&k.jsxs(q,{marginTop:"3",children:["Transaction failed: ",h]}),f?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&n===""&&i===""&&a==="",onClick:()=>j()}),k.jsx(ut,{marginTop:"5",label:"Call contract",disabled:e===""&&n===""&&i===""&&a==="",onClick:()=>V()})]}),l&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),k.jsx("br",{}),k.jsx("a",{href:`${_}tx/${l}`,target:"_blank",rel:"noopener noreferrer",children:l})]})]})}const O8=[{label:"Custom Token",value:"Custom"},{label:"USDC Old",value:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"},{label:"USDC New",value:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"},{label:"DAI",value:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"}];function ipe(t){const[e,r]=v.useState(O8[0].value),[n,s]=v.useState(""),[i,o]=v.useState(!0),[a,c]=v.useState("---"),[l,u]=v.useState(""),[f,d]=v.useState(""),[h,p]=v.useState(""),[y,g]=v.useState(""),[m,x]=v.useState(!1),[b,w]=v.useState(0),[A,O]=v.useState(),[_,C]=v.useState(),[j,V]=v.useState(),[B,z]=v.useState(!1),[Y,H]=v.useState("");v.useEffect(()=>{var I,U;if(t.network){const F=fp(t.network.name);(I=F==null?void 0:F.blockExplorer)!=null&&I.rootUrl&&H((U=F.blockExplorer)==null?void 0:U.rootUrl)}},[t.network]),v.useEffect(()=>{L(n)},[n]);const L=async I=>{var X;if(!ene(I)){c("---");return}c("...");const U=new wD(`https://nodes.sequence.app/${(X=t.network)==null?void 0:X.name}`),F=new Mu(I,["function balanceOf(address) view returns (uint256)","function decimals() view returns (uint8)","function symbol() view returns (string)"],U);try{const[oe,ae,ke]=await Promise.all([F.balanceOf(Oe.getAddress()),F.decimals(),F.symbol()]);w(ae),c(`${mC(oe,ae)} ${ke}`)}catch{c("---")}},T=async()=>{const I=await cg({transactions:[QA({token:n,to:l,value:Xh(f,b).toString()})],network:t.network});if(I.feeQuote&&I.feeOptions){O(I.feeOptions),V(I.feeQuote),console.log("feeOptions",I);return}z(!0),console.log("tx sponsored")},P=async()=>{var I;try{g(""),x(!0);const U=await Oe.sendERC20({token:n,to:l,value:Xh(f,b),network:(I=t.network)==null?void 0:I.id,transactionsFeeOption:_,transactionsFeeQuote:j});Ay(U)?p(U.data.txHash):g(U.data.error)}catch(U){console.error(U)}finally{x(!1)}},R=I=>{r(I),I==="Custom"?(s(""),o(!0)):(s(I),o(!1))};return k.jsxs(q,{children:[k.jsxs(q,{marginTop:"5",children:[k.jsx(Rm,{name:"token",options:O8,value:e??"",onValueChange:I=>R(I)}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:n,disabled:!i,onChange:I=>s(I.target.value),placeholder:"Custom ERC20 Contract Address"})})]}),k.jsxs(q,{marginTop:"3",children:[k.jsxs(ue,{variant:"normal",color:"text100",children:["Token Balance: ",a]}),k.jsx(ut,{marginLeft:"2",size:"xs",label:"Fetch",onClick:()=>L(n)})]}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:l,onChange:I=>u(I.target.value),placeholder:"Destination Address"})}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:f,onChange:I=>d(I.target.value),placeholder:"Amount"})}),y&&k.jsx(q,{marginTop:"3",children:k.jsxs(ue,{color:"error",children:["Error: ",y]})}),k.jsx(lg,{feeOptions:A,onSelected:C}),B&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),m?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:n===""&&l==="",onClick:()=>T()}),k.jsx(ut,{marginTop:"5",label:"Send Token",onClick:P})]}),h&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),k.jsx("a",{href:`${Y}tx/${h}`,target:"_blank",rel:"noopener noreferrer",children:h})]})]})}const ope="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function ape(t){var a;const[e,r]=v.useState(""),[n,s]=v.useState("");v.useEffect(()=>{t.onChange(t.index,e,n)},[e,n]);const i={display:"flex",gap:"10px",marginBottom:"10px"},o={flex:1};return k.jsxs(q,{style:i,children:[k.jsx(q,{style:o,children:k.jsx(Rm,{name:`sendERC1155TokenId${t.index}`,value:e,disabled:!t.options,onValueChange:c=>{r(c)},options:((a=t.options)==null?void 0:a.balances.map(c=>{var l;return{label:`${((l=c.tokenMetadata)==null?void 0:l.name)||"Unknown"} - ${c.balance}`,value:c.tokenID}}))||[],placeholder:"Select a token"})}),k.jsx(q,{style:o,children:k.jsx(sr,{type:"text",value:e,onChange:c=>r(c.target.value),placeholder:"Token ID"})}),k.jsx(q,{style:o,children:k.jsx(sr,{type:"text",value:n,onChange:c=>s(c.target.value),placeholder:"Amount"})}),k.jsx(q,{style:o,children:k.jsx(ut,{label:"Remove",onClick:()=>t.removeTokenEntry(t.index)})})]})}function cpe(t){const[e,r]=v.useState(""),[n,s]=v.useState([]),[i,o]=v.useState(""),[a,c]=v.useState(""),[l,u]=v.useState(""),[f,d]=v.useState(!1),[h,p]=v.useState(void 0),[y,g]=v.useState(),[m,x]=v.useState(),[b,w]=v.useState(),[A,O]=v.useState(!1),[_,C]=v.useState("");v.useEffect(()=>{var L,T;if(t.network){const P=fp(t.network.name);(L=P==null?void 0:P.blockExplorer)!=null&&L.rootUrl&&C((T=P.blockExplorer)==null?void 0:T.rootUrl)}},[t.network]);const j=()=>{s([...n,{tokenId:"",amount:""}])},V=async()=>{if(!e||!t.network)return;const L=t.network.name,T=new WL("https://"+L+"-indexer.sequence.app",ope),P=e,R=await Oe.getAddress(),I=!0;p(await T.getTokenBalances({contractAddress:P,accountAddress:R,includeMetadata:I}))};v.useEffect(()=>{V()},[e]);const B=(L,T)=>{const P=[...n];P[L]=T,s(P)},z=L=>{const T=[...n];T.splice(L,1),s(T)},Y=async()=>{const L=await cg({transactions:[YA({to:i,token:e,values:n.map(T=>({id:T.tokenId,amount:Xh(T.amount,0)}))})],network:t.network});if(L.feeQuote&&L.feeOptions){g(L.feeOptions),w(L.feeQuote),console.log("feeOptions",L);return}O(!0),console.log("tx sponsored")},H=async()=>{var L;try{u(""),d(!0);const T=await Oe.sendERC1155({to:i,token:e,values:n.map(P=>({id:P.tokenId,amount:Xh(P.amount,0)})),network:(L=t.network)==null?void 0:L.id,transactionsFeeOption:m,transactionsFeeQuote:b});Ay(T)?c(T.data.txHash):u(T.data.error)}catch(T){console.error(T)}finally{d(!1)}};return k.jsxs(q,{children:[k.jsx(q,{marginBottom:"5",children:k.jsx(sr,{type:"text",value:e,onChange:L=>r(L.target.value),placeholder:"Token Contract Address"})}),k.jsx(q,{marginBottom:"5",children:k.jsx(ut,{label:"Fetch metadata",onClick:()=>V()})}),n.map((L,T)=>k.jsx(q,{marginBottom:"3",children:k.jsx(ape,{index:T,options:h,onChange:(P,R,I)=>B(P,{tokenId:R,amount:I}),removeTokenEntry:z})},T)),k.jsx(ut,{label:"Add Token",onClick:j}),k.jsx(q,{marginTop:"5",children:k.jsx(sr,{type:"text",value:i,onChange:L=>o(L.target.value),placeholder:"Destination Address"})}),l&&k.jsx(q,{marginTop:"3",children:k.jsxs(ue,{color:"error",children:["Error: ",l]})}),k.jsx(lg,{feeOptions:y,onSelected:x}),A&&k.jsx(q,{marginTop:"5",children:k.jsx(ue,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),f?k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:k.jsx(Bn,{})}):k.jsxs(q,{children:[k.jsx(ut,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&i===""&&n.length!==0,onClick:()=>Y()}),k.jsx(ut,{marginTop:"5",label:"Send Tokens",onClick:H})]}),a&&k.jsxs(q,{marginTop:"3",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),k.jsx("a",{href:`${_}tx/${a}`,target:"_blank",rel:"noopener noreferrer",children:a})]})]})}const Ue={AMOY:80002,APE_CHAIN_TESTNET:33111,ARBITRUM:42161,ARBITRUM_GOERLI:421613,ARBITRUM_NOVA:42170,ARBITRUM_SEPOLIA:421614,AVALANCHE:43114,AVALANCHE_TESTNET:43113,BASE:8453,BASE_GOERLI:84531,BASE_SEPOLIA:84532,B3_SEPOLIA:1993,BLAST:81457,BLAST_SEPOLIA:168587773,BORNE_TESTNET:94984,BSC:56,BSC_TESTNET:97,FANTOM:250,FANTOM_TESTNET:4002,GNOSIS:100,GOERLI:5,HOMEVERSE:19011,HOMEVERSE_TESTNET:40875,IMMUTABLE_ZKEVM:13371,IMMUTABLE_ZKEVM_TESTNET:13473,KOVAN:42,MAINNET:1,OPTIMISM:10,OPTIMISM_SEPOLIA:11155420,OPTIMISM_TESTNET:69,POLYGON:137,POLYGON_MUMBAI:80001,POLYGON_ZKEVM:1101,RINKEBY:4,ROPSTEN:3,SEPOLIA:11155111,ASTAR_ZKEVM:3776,ASTAR_ZKYOTO:6038361,XAI:660279,XAI_SEPOLIA:37714555429,XR_SEPOLIA:2730},lpe={[Ue.MAINNET]:"https://assets.sequence.info/images/networks/small/1.webp",[Ue.ROPSTEN]:"https://assets.sequence.info/images/networks/small/3.webp",[Ue.GOERLI]:"https://assets.sequence.info/images/networks/small/5.webp",[Ue.KOVAN]:"https://assets.sequence.info/images/networks/small/42.webp",[Ue.OPTIMISM]:"https://assets.sequence.info/images/networks/small/10.webp",[Ue.OPTIMISM_TESTNET]:"https://assets.sequence.info/images/networks/small/69.webp",[Ue.OPTIMISM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155420.webp",[Ue.POLYGON]:"https://assets.sequence.info/images/networks/small/137.webp",[Ue.POLYGON_MUMBAI]:"https://assets.sequence.info/images/networks/small/80001.webp",[Ue.POLYGON_ZKEVM]:"https://assets.sequence.info/images/networks/small/1101.webp",[Ue.APE_CHAIN_TESTNET]:"https://assets.sequence.info/images/networks/small/33111.webp",[Ue.ARBITRUM]:"https://assets.sequence.info/images/networks/small/42161.webp",[Ue.ARBITRUM_NOVA]:"https://assets.sequence.info/images/networks/small/42170.webp",[Ue.ARBITRUM_GOERLI]:"https://assets.sequence.info/images/networks/small/421613.webp",[Ue.ARBITRUM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/421614.webp",[Ue.GNOSIS]:"https://assets.sequence.info/images/networks/small/100.webp",[Ue.BSC]:"https://assets.sequence.info/images/networks/small/56.webp",[Ue.BSC_TESTNET]:"https://assets.sequence.info/images/networks/small/97.webp",[Ue.FANTOM]:"https://assets.sequence.info/images/networks/small/250.webp",[Ue.FANTOM_TESTNET]:"https://assets.sequence.info/images/networks/small/4002.webp",[Ue.AVALANCHE]:"https://assets.sequence.info/images/networks/small/43114.webp",[Ue.AVALANCHE_TESTNET]:"https://assets.sequence.info/images/networks/small/43113.webp",[Ue.BASE]:"https://assets.sequence.info/images/networks/small/8453.webp",[Ue.BASE_SEPOLIA]:"https://assets.sequence.info/images/networks/small/84532.webp",[Ue.BORNE_TESTNET]:"https://assets.sequence.info/images/networks/small/94984.webp",[Ue.BLAST]:"https://assets.sequence.info/images/networks/small/81457.webp",[Ue.BLAST_SEPOLIA]:"https://assets.sequence.info/images/networks/small/168587773.webp",[Ue.SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155111.webp",[Ue.AMOY]:"https://assets.sequence.info/images/networks/small/80002.webp",[Ue.HOMEVERSE]:"https://assets.sequence.info/images/networks/small/19011.webp",[Ue.HOMEVERSE_TESTNET]:"https://assets.sequence.info/images/networks/small/40875.webp",[Ue.IMMUTABLE_ZKEVM]:"https://assets.sequence.info/images/networks/small/13371.webp",[Ue.IMMUTABLE_ZKEVM_TESTNET]:"https://assets.sequence.info/images/networks/small/13473.webp",[Ue.XAI]:"https://assets.sequence.info/images/networks/small/660279.webp",[Ue.XAI_SEPOLIA]:"https://assets.sequence.info/images/networks/small/37714555429.webp",[Ue.ASTAR_ZKEVM]:"https://assets.sequence.info/images/networks/small/3776.webp",[Ue.ASTAR_ZKYOTO]:"https://assets.sequence.info/images/networks/small/6038361.webp",[Ue.B3_SEPOLIA]:"https://assets.sequence.info/images/networks/small/1993.webp",[Ue.XR_SEPOLIA]:"https://assets.sequence.info/images/networks/small/2730.webp"};function upe({onNetworkChange:t}){const[e,r]=v.useState(),[n,s]=v.useState([]);return v.useEffect(()=>{Oe.networkList().then(i=>{s(i),r(i[0]),t(i[0])})},[]),n.length===0?k.jsx(q,{marginY:"5",children:k.jsx(Bn,{})}):k.jsxs(q,{marginBottom:"4",children:[k.jsx(q,{marginBottom:"4",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Network to use with requests:"})}),k.jsx(q,{children:k.jsx(Rm,{name:"chainId",labelLocation:"top",onValueChange:i=>{const o=n==null?void 0:n.find(a=>a.name===i);o&&(r(o),t(o))},value:e==null?void 0:e.name,options:[...n.map(i=>({label:k.jsxs(q,{alignItems:"center",gap:"2",children:[k.jsx(mX,{src:lpe[i.id],size:"sm"}),k.jsx(ue,{children:i.name})]}),value:String(i.name)}))]})})]})}function XL(t){var e;if(t.type===Ft.Email)return k.jsxs(ue,{variant:"normal",color:"text100",children:["Email (",t.email,")"]});if(t.type===Ft.Guest)return k.jsx(ue,{variant:"normal",color:"text100",children:"Guest account"});if(t.type===Ft.PlayFab)return k.jsxs(ue,{variant:"normal",color:"text100",children:["PlayFab (",t.email,")"]});if(t.type===Ft.OIDC&&(e=t.issuer)!=null&&e.includes("cognito-idp"))return k.jsxs(ue,{variant:"normal",color:"text100",children:["Email Legacy (",t.email,")"]});if(t.type===Ft.Stytch)return k.jsxs(k.Fragment,{children:["Stytch account (",t.email,")"]});switch(t.issuer){case"https://accounts.google.com":return k.jsxs(q,{gap:"2",marginTop:"2",children:[k.jsx("img",{width:24,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABq9JREFUaEPVWWtsFFUU/s6d2S1F6IJgAQWiBQooEmiRR0NLCxQpLwUBQRI0JD4wGh9RedjVEkqERKMxmuAPjBgpWECJoNViaQFTKbitFiyUh5ogiykaSym07M7MkVmt3W13Z2Z3Fg3zbzPnfOf7zjl777l3CDf4Qzc4f8RNwKW80beofl8WaTSCwalgStYk6i6YGRqaIdEFBp8EUCs7HAe7l9RciEfybAlozr6zr18SS4hpCROPIlhLCANMQA2DtjhUtahbRd1vsYqJSUDjtJF3QOFVDF5KhIRYg+t+zLjKhA9Ildf3rPj+l2ixohLAeYMTmq52WcmElQC6RBvM2J5bCGJ9krNlA5WcvmoV27KAi7nDh7AmFQMYZRU8JjumGpKUB117j5+y4m9JQOOUEblg7AAhyQqobRtGE4ge6FF29GszLFMBrWuSl7ccSH6TYK/XzYh0fM8MnyCe6Cr78YiRr6EALscsMD5VTiQ1XP5k4K3gaGnYsdfed2XWPUoF0GISwOUYAUIVGF11AF9tkrdld1QiWsHsBUEA6ANQYhRyNrkyjz1mRl7HC1sB/go3QcYRCAwPDmoogvkKBH1OGn8qZKmse2ltQ7BvU3ZqbxaOXCaaA+Y5IAokpvNjLfNtfuEFlGM9gBXh4JXjSd7gdgrsswJbFPKvvGVvvddKlvVdW/FdzQfoSQLJ7T7RkQ9bAd6HoRCoBcMZiUxbJZhxXrB2v2tf3WErxDvaXJw6crzG2icE9AOiJx9eQAU2g7HUjJCvqldV875+C3qVHjtrZmv0/o/skf1liZclZR4ttNLzHbFCWoj3YwBUnAHBYUiKcRaEsZSDmGcYO6KDfUMF7MPqa+TXGYITfGCMoxx8Hy8SdnBCBZTjGIC7TAS8Tdl4xk7QePr+K4DLcBsEfjVpnUuQMYiyEJdZPh5C2gWUYwmAj0xAN1MOHrETOG0tD5eg3GYHAyTXH8mnwOIRLOA1IDAmGz1zKQe77ARPW6dsJMbjdjDAvNbjdrwSKqACO8GYZwjcAhfNQJOd4PERoBV53E69Y0IqcABAZkRyjEaajJ52yOu+8RGAgx63nBUqoAzVEBgdkSChjrJNVigL6uIk4JDHLU+ITgBQTzkYZoGjoUk8BGiMwzVuedwN20IaUFGTL+d0rMB2CMw3TJ+CHpSLi3aqEI8KgLUPPW7nw7EsowsoBzv+bwHMvK7a7cjvuIwuBqPoem9ko9e3ZJHqjPhfIg3LQWx888GY63HLgf2ofSM7gH5QYXYguXxttx58vabQCQV8s09WzgKRTmuBmzCGKid7Cuj3EAH6Dy5DLQTuNqnCO5SDp+20USTf9EL/GwA9b4jNVO1xS+ltNh2nUX2U0EeKyI8+TqvIpCmI6RQWCXh0oW+MYKoEkeFZhEHPVedLb4UXoE+kEn4yOk7+43gOEu6hLJyPRyXGreM+flYrCUgxxmOfJuT+Navp32m406GeK7AJjGVGQBpDW9o0dluV2mvF6QdKjEdwE4VDi6cPTTj3wgbH5ez7LCRjoydfXh5s11lAGQZB4MdrrRT21lknP/dixsE6v2uSfqgnxrzTi0oOWQjeyWTQ9rw80rQikOiR+OuqSueVjIxIOAxudSjykKoCCklYpGuVQgAvdwTTyc9vzCg/qrimtL9jDRA7JSgr6heW/mxFSMq2GalCoBDM80HtK2Gi1/2ds3nsmHAYxLzmO7ejoOO7SAK6gPEtqP0mOpD5PzMO1qmuSRFIthJQAqLdmqJ8fUZyebFwu6rbpr+X7mjq3XcAFJ7GpM5hFrlECLoPakcMWwmmaiSL8Z7HyW9JQGBJ3Y/hUHEYhG7BbWMlw3/bsMpMDURMYOoTnGkzjESvu8rZPDYwrAHcCCFP8KymE2ErYwTGZZisEfbMb8yoDG0bMwr233f1rjzkaM5IE4yZR9yOiNfsptfrT3yWNmtva/JOAkW8qbNPtzMCA82J3qcWH3t25h4jfFMBuvOQj++dqpHYSfjPPnA0aMyzflr0peG3AZ2bJQG64bCt02/3SbxNQPzTm9cj74AG7YAMx0MnF+45ZyWCZQE62OAv8hLoMr/IGlZFvh63EjaMDWuNBHr1FHV/t231soIUlYA2wJTi2QMF+V/6e8eO6sNFJ07MfAkkNkJWXj8zrzTkm8J1E9AGnFo0u7cqK4sIvBjAOIAkK0EZ8BP4G2baqjoTtv8yd1ejFb+ol9FoQFOKp7okSBOZxQgIpILRG+BuDKER1GaCaNAYpwTRD4mtSmXt0lL9bGH7iamFbEeNI8ANL+AvTa+pT4hOMw0AAAAASUVORK5CYII="}),k.jsxs(ue,{variant:"normal",color:"text100",children:["Google (",t.email,")"]})]});case"https://appleid.apple.com":return k.jsxs(q,{gap:"2",children:[k.jsx("img",{width:24,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABMlJREFUaEPVmV1oXEUUx89/Ete6SUykWiv4QcRYymISc2fWdCPUVUQUpIqKPggaEa1Wqj7UPokg+hJfagM+iMX2QS0RjQSFIkLpQ2Oyd+7GtaTiB4rgB8ZqNKlJupvco6MbCHH33tnNzSaZ1zn3f/6/O3PnzMwFbfCGDe6f1gxgfHw8Njs7exMRXd/c3Hygra3tXDUvs+YAx48f39TU1LSPiJ4koq1F0y1Syj/XPYDWuouIjhJR2xKzc47jxAHwugZwXbcHwEdE1LzUKIBhx3F6qjFvnqnJFMpkMluFEGNLpsxSv3ullP3rGkBrbd78HctNMvNkoVC4JpVK/b5uATKZjBJCZEoZBPC44zivV2u+JlPI87x+Zn6qhMnDUsrelZivCYDW+nMium6pUWZ+U0r5KAB/IwCcIaLNxigz/yGEeNZxnMMrNb74/IpXoZGRkUvr6+vnyhUirfXbRDTDzCfi8fhgIpE4a5KPjo5uFkJcKf5rv3V2dn5fTS2oGEBrfRkRPUREdzFzJ4Dzi2/3VwAnieiDWCw21N7ePrls2sB13R11dXW7mPn2EtPqLAAN4Eh9ff27HR0df9mMkjWA2QI0NjY+T0RPA2gIEmfmcwCOEdHHzPyjECLFzPcS0dU2pojoDDPvVkq9FxZvBWAKERENCiG6wwQj7u+XUu4N0gwFGBsba1lYWBglomsjNmcr94KU8sVywYEAzCyy2eyHxTlrmzCyOGbOA9gnpTxYFYDrug8AeCcyRxUIMfNPRHS3UqpkFQ9dRgcGBupaW1tPAdheQd6oQqd939+RTCbHwwTLTqFsNnuL7/ufhAmsUv8eKeVrNtplAVzX7TPzz0YkyhhmNgWtTUpZsNEtC6C1Nvv3ThuRKGOY+RWl1HO2mkEjMAmgxVYoqjgA9ziO876tXkkAc2MwMzMzByC0Ttgmso1j5hvCVp6lWiUNFvc7ZhmreWPmLqWUmb5WrSRALpfbUigUfrFSiDiImW9VSlmvfiUBhoeHL4jFYjMRe7OSY+b9Sqk+q+CgWwnXdScAXGIrFFUcM3+qlErZ6pX9SD3PO8nM1kK2CW3ifN/vSSaTwzaxQXXggNn724isQsyp6enpZDqdngvTDgK4j4gGwgRWsf+Q4ziPhR38ywIUzwETRHTeKpoMlAZwdGpqqjdoJAILVSaTOSaEuG2tAExeZv4GwDNSSnO7978WCOB53p3/FJahtQQwuX3fn2hoaLgikUjkl3sJO5HB87wviGjbGkO8JKU0FwqVjYCJ1lqbQ/WrawgwPz8/39rd3f1DVQDFqvwVEV2+RhBvSSkfLJfbarfped7D5j6z1gDmUE9E25VS364IwNxOeJ53gohurCUEgD7HcfYH5bQaASPguu42AJ8R0aYaQXydz+c7UqnUbCQARYhHAByqAcAcM++0OdhYj8Ci6YAfFpFwMTMD6JVSHrERrBjAfA9a64MA9lgkWCCin33fjwkhtljG75ZSvmER+29IxQCLwlrrJ5j5ZQAXLUt2GoDZBA5OTU2dTqfT86Y/l8s15PP5nQDuN1fzRHThsue+NL+iKjmNrQigWOQuJiJzbX4VgO8AjHZ1deXC3l6xttxslkjz35iZc/F4fKjUViFMq+oRCBOuVf+GB/gb9M3GQJMHYpQAAAAASUVORK5CYII="}),k.jsxs(ue,{variant:"normal",color:"text100",children:["Apple (",t.email,")"]})]});default:return"Unknown"}}function fpe(){var V;const t=M9(),[e,r]=v.useState(),[n,s]=v.useState(),[i,o]=v.useState(!0),[a,c]=v.useState(),[l,u]=v.useState(""),f=v.useRef(null),d=(V=f.current)==null?void 0:V.validity.valid,[h,p]=v.useState(!1),[y,g]=v.useState([]),{inProgress:m,loading:x,initiateAuth:b,sendChallengeAnswer:w}=KL({sessionName:fc(),onSuccess:async({wallet:B})=>{console.log(`Wallet address: ${B}`)},linkAccount:!0}),A=async B=>{o(!0),s(void 0);try{await Oe.removeAccount(B);const z=await Oe.listAccounts();s(z.accounts)}catch(z){c(z.message);const Y=await Oe.listAccounts();s(Y.accounts)}o(!1)},O=async B=>{const z=await Oe.initAuth({idToken:B.credential});try{const Y=await Oe.linkAccount(z);s(H=>[...H||[],Y.account])}catch(Y){vv(Y)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},_="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":"/"),C=async B=>{const z=await Oe.initAuth({idToken:B.authorization.id_token});try{const Y=await Oe.linkAccount(z);s(H=>[...H||[],Y.account])}catch(Y){vv(Y)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},j=e7({flow:"implicit",onSuccess:B=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:B.access_token,CreateAccount:!0,TitleId:"8F854"},async(z,Y)=>{if(z)try{const H=await Oe.initAuth({playFabTitleId:"8F854",playFabSessionTicket:z.data.SessionTicket}),L=await Oe.linkAccount(H);console.log("playfab account",JSON.stringify(L.account,null,2)),s(T=>[...T||[],L.account])}catch(H){console.error(H),vv(H)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}else Y&&console.log("Error: "+JSON.stringify(Y))})}});return v.useEffect(()=>{Oe.listAccounts().then(B=>{s(B.accounts),B.currentAccountId&&r(B.accounts.find(z=>z.id===B.currentAccountId)),o(!1)}).catch(B=>{c(B.message),o(!1)})},[m]),k.jsxs(q,{children:[k.jsx(gr,{background:"buttonGlass"}),k.jsxs(q,{marginBottom:"5",gap:"4",flexDirection:"column",children:[k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your connected (linked) accounts"}),n&&k.jsx(k.Fragment,{children:n.map(B=>k.jsxs(q,{flexDirection:"row",alignItems:"center",gap:"2",children:[k.jsx(ue,{variant:"normal",color:"text100",children:XL(B)}),B.id!==(e==null?void 0:e.id)&&k.jsx(ut,{size:"xs",label:"Remove",onClick:()=>A(B.id)}),B.id===(e==null?void 0:e.id)&&k.jsx(q,{children:k.jsx(ue,{variant:"small",color:"text100",children:"(Account you logged in with)"})})]},B.id))}),i&&k.jsx(Bn,{})]}),k.jsx(gr,{background:"buttonGlass"}),k.jsxs(q,{flexDirection:"column",gap:"2",width:"fit",children:[k.jsx(ue,{variant:"large",color:"text100",fontWeight:"bold",marginBottom:"5",children:"Connect (link) another login method"}),k.jsx(Z9,{onSuccess:O,shape:"circle",width:230}),k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsx(r7,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:_,usePopup:!0},onError:B=>console.error(B),onSuccess:C,uiType:"dark"}),k.jsxs(k.Fragment,{children:[k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsx(q,{marginTop:"2",children:k.jsx(q,{children:k.jsx(ut,{label:"Login with Google (through Playfab)",onClick:j})})})]}),k.jsx(gr,{background:"buttonGlass",width:"full"}),k.jsx(q,{marginTop:"2",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Email"})}),w?k.jsxs(q,{flexDirection:"column",children:[k.jsx(q,{marginTop:"3",children:k.jsx(ue,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),k.jsx(q,{marginTop:"4",children:k.jsx(lY,{value:y,digits:6,onChange:g})}),k.jsx(q,{gap:"2",marginY:"4",children:x?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:y.includes(""),label:"Verify",onClick:()=>w(y.join("")),"data-id":"verifyButton"})})]}):k.jsxs(q,{marginBottom:"4",children:[k.jsxs(ue,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",k.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),k.jsxs(q,{marginTop:"6",children:[k.jsx(sr,{name:"email",type:"email",onChange:B=>{u(B.target.value)},ref:f,onKeyDown:B=>{l&&B.key==="Enter"&&b(l)},onBlur:()=>p(!!l&&!d),value:l,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),h&&k.jsx(ue,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),k.jsx(q,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:x?k.jsx(Bn,{}):k.jsx(ut,{variant:"primary",disabled:!d,label:"Continue",onClick:()=>b(l),"data-id":"continueButton"})})]})]}),a&&k.jsxs(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading accounts: ",a]})]})}function dpe(){const[t,e]=v.useState(),[r,n]=v.useState(),[s,i]=v.useState([]),[o,a]=v.useState(!1),[c,l]=v.useState(!1),[u,f]=v.useState(),[d,h]=v.useState();return v.useEffect(()=>{Oe.getAddress().then(p=>{e(p)}).catch(p=>{n(p.message)}),Oe.listAccounts().then(p=>{p.currentAccountId&&h(p.accounts.find(y=>y.id===p.currentAccountId))})},[]),v.useEffect(()=>{Oe.isSignedIn().then(p=>{p||oi.navigate("/login")})},[]),v.useEffect(()=>{const p=s.join("");p.length===6&&(l(!0),Oe.finishValidateSession(p))},[s]),v.useEffect(()=>{const p=Oe.onValidationRequired(()=>{a(!0),Oe.waitForSessionValid(6e5,4e3).then(y=>{console.log("isValid",y),i([]),a(!1),l(!1)})});return()=>{p.then(y=>y())}},[]),k.jsxs(k.Fragment,{children:[k.jsx(yS,{children:o&&k.jsx(PN,{children:k.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"1.2em",height:"50vh"},children:k.jsxs(q,{flexDirection:"column",alignItems:"center",children:[k.jsx(ue,{marginBottom:"7",children:"Please enter the session verification code that was sent to your email"}),k.jsx(n7,{value:s,digits:6,onChange:i}),k.jsx(q,{marginTop:"5",children:c&&k.jsx(Bn,{})})]})})})}),k.jsxs(q,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[k.jsx(q,{marginBottom:"10",children:k.jsx(s7,{})}),k.jsxs(q,{marginBottom:"5",flexDirection:"row",children:[d&&k.jsxs(q,{flexDirection:"column",gap:"2",children:[k.jsxs(ue,{marginTop:"1",variant:"normal",color:"text100",children:[d.type===Ft.Guest?"Guest account":`Logged in with account type ${d.type}`," "]}),d.type!==Ft.Guest&&XL(d)]}),k.jsx(ut,{marginLeft:"auto",label:"Log out",size:"xs",onClick:async()=>{try{await Oe.dropSession({strict:!1})}catch(p){console.warn(`Could not drop session: ${p.message}`)}vee(),oi.navigate("/login")}})]}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{marginBottom:"5",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your wallet address:"})}),k.jsx(q,{marginBottom:"5",children:k.jsx(ue,{variant:"normal",color:"text100",fontWeight:"normal",children:t?k.jsx(q,{children:k.jsx(ue,{children:t})}):k.jsx(Bn,{})})}),k.jsx(q,{children:r&&k.jsxs(ue,{children:["Error fetching wallet address: ",r]})}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(rpe,{}),k.jsx(gr,{background:"buttonGlass"}),k.jsx(q,{marginBottom:"5",children:k.jsx(upe,{onNetworkChange:f})}),k.jsx(gr,{background:"buttonGlass"}),k.jsxs(_l,{marginY:"3",label:"Send native token transaction",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(tpe,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Send ERC20 transaction",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(ipe,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Send ERC1155 transaction",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(cpe,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Sign a message",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(npe,{network:u})]}),k.jsxs(_l,{marginY:"3",label:"Call contracts",children:[k.jsx(gr,{background:"buttonGlass"}),k.jsx(spe,{network:u})]}),k.jsx(_l,{marginY:"3",label:"External Wallet Linking Demo",children:k.jsxs(ue,{as:"a",variant:"medium",color:"text100",href:"https://demo-waas-wallet-link.pages.dev/",target:"_blank",rel:"noopener noreferrer",children:["Go to demo",k.jsx(xG,{position:"relative",top:"1",marginLeft:"1"})]})}),k.jsx(fpe,{})]})]})}function hpe(t,e,r){return e=rj(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function z2(t,e){return vpe(t)||ype(t,e)||ZL(t,e)||ppe()}function ppe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ype(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,s,i,o,a=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(u){l=!0,s=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw s}}return a}}function vpe(t){if(Array.isArray(t))return t}function mpe(t){return bpe(t)||xpe(t)||ZL(t)||gpe()}function gpe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZL(t,e){if(t){if(typeof t=="string")return H2(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H2(t,e)}}function xpe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function bpe(t){if(Array.isArray(t))return H2(t)}function H2(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--U){var F=this.tryEntries[U],X=F.completion;if(F.tryLoc==="root")return I("end");if(F.tryLoc<=this.prev){var oe=n.call(F,"catchLoc"),ae=n.call(F,"finallyLoc");if(oe&&ae){if(this.prev=0;--I){var U=this.tryEntries[I];if(U.tryLoc<=this.prev&&n.call(U,"finallyLoc")&&this.prev=0;--R){var I=this.tryEntries[R];if(I.finallyLoc===P)return this.complete(I.completion,I.afterLoc),Y(I),g}},catch:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var I=this.tryEntries[R];if(I.tryLoc===P){var U=I.completion;if(U.type==="throw"){var F=U.arg;Y(I)}return F}}throw new Error("illegal catch attempt")},delegateYield:function(P,R,I){return this.delegate={iterator:L(P),resultName:R,nextLoc:I},this.method==="next"&&(this.arg=t),g}},e}function Ls(t){"@babel/helpers - typeof";return Ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ls(t)}function wn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _8(t,e){for(var r=0;r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return i=l.done,l},e:function(l){o=!0,a=l},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function oj(t,e){if(t){if(typeof t=="string")return $8(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $8(t,e)}}function $8(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--U){var F=this.tryEntries[U],X=F.completion;if(F.tryLoc==="root")return I("end");if(F.tryLoc<=this.prev){var oe=n.call(F,"catchLoc"),ae=n.call(F,"finallyLoc");if(oe&&ae){if(this.prev=0;--I){var U=this.tryEntries[I];if(U.tryLoc<=this.prev&&n.call(U,"finallyLoc")&&this.prev=0;--R){var I=this.tryEntries[R];if(I.finallyLoc===P)return this.complete(I.completion,I.afterLoc),Y(I),g}},catch:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var I=this.tryEntries[R];if(I.tryLoc===P){var U=I.completion;if(U.type==="throw"){var F=U.arg;Y(I)}return F}}throw new Error("illegal catch attempt")},delegateYield:function(P,R,I){return this.delegate={iterator:L(P),resultName:R,nextLoc:I},this.method==="next"&&(this.arg=t),g}},e}function z8(t,e){for(var r=0;r1&&arguments[1]!==void 0?arguments[1]:0,r=(yr[t[e+0]]+yr[t[e+1]]+yr[t[e+2]]+yr[t[e+3]]+"-"+yr[t[e+4]]+yr[t[e+5]]+"-"+yr[t[e+6]]+yr[t[e+7]]+"-"+yr[t[e+8]]+yr[t[e+9]]+"-"+yr[t[e+10]]+yr[t[e+11]]+yr[t[e+12]]+yr[t[e+13]]+yr[t[e+14]]+yr[t[e+15]]).toLowerCase();if(!Ype(r))throw TypeError("Stringified UUID is invalid");return r}function Ik(t,e,r){t=t||{};var n=t.random||(t.rng||Kpe)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Jpe(n)}var O1={};function Ok(t,e){return be(this,void 0,void 0,Z().mark(function r(){return Z().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(O1[t]===void 0){s.next=2;break}return s.abrupt("return",O1[t]);case 2:return O1[t]=Xpe(t,e),s.abrupt("return",O1[t]);case 4:case"end":return s.stop()}},r)}))}function Xpe(t,e){return new Promise(function(r,n){var s=eye(t);if(s&&s.dataset.loaded==="true")try{r(e())}catch(o){return n(new Error("".concat(t," already loaded, but module was not found in global scope: ").concat(o)))}var i=tye(t);i.addEventListener("load",function(){i.dataset.loaded="true";try{r(e())}catch(o){n(new Error("".concat(t," was loaded, but module was not found in global scope: ").concat(o)))}}),i.addEventListener("error",function(o){n(new Error("".concat(t," could not be loaded: ").concat(o)))})})}var Zpe=function(e){return document.querySelectorAll('script[src="'.concat(e,'"]'))};function eye(t){var e=Zpe(t);if(e[0])return e[0]}function tye(t){var e=document.createElement("script");return e.setAttribute("src",t),e.setAttribute("async","true"),e.setAttribute("defer","true"),document.head.appendChild(e),e}var ob=["[Stytch]"],rye=!1,xi={debug:function(){return rye},log:function(){for(var e,r=arguments.length,n=new Array(r),s=0;s=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return i=l.done,l},e:function(l){o=!0,a=l},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function oj(t,e){if(t){if(typeof t=="string")return $8(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $8(t,e)}}function $8(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--U){var F=this.tryEntries[U],X=F.completion;if(F.tryLoc==="root")return I("end");if(F.tryLoc<=this.prev){var oe=n.call(F,"catchLoc"),ae=n.call(F,"finallyLoc");if(oe&&ae){if(this.prev=0;--I){var U=this.tryEntries[I];if(U.tryLoc<=this.prev&&n.call(U,"finallyLoc")&&this.prev=0;--R){var I=this.tryEntries[R];if(I.finallyLoc===P)return this.complete(I.completion,I.afterLoc),Y(I),g}},catch:function(P){for(var R=this.tryEntries.length-1;R>=0;--R){var I=this.tryEntries[R];if(I.tryLoc===P){var U=I.completion;if(U.type==="throw"){var F=U.arg;Y(I)}return F}}throw new Error("illegal catch attempt")},delegateYield:function(P,R,I){return this.delegate={iterator:L(P),resultName:R,nextLoc:I},this.method==="next"&&(this.arg=t),g}},e}function z8(t,e){for(var r=0;r1&&arguments[1]!==void 0?arguments[1]:0,r=(yr[t[e+0]]+yr[t[e+1]]+yr[t[e+2]]+yr[t[e+3]]+"-"+yr[t[e+4]]+yr[t[e+5]]+"-"+yr[t[e+6]]+yr[t[e+7]]+"-"+yr[t[e+8]]+yr[t[e+9]]+"-"+yr[t[e+10]]+yr[t[e+11]]+yr[t[e+12]]+yr[t[e+13]]+yr[t[e+14]]+yr[t[e+15]]).toLowerCase();if(!Xpe(r))throw TypeError("Stringified UUID is invalid");return r}function Ik(t,e,r){t=t||{};var n=t.random||(t.rng||Ype)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Zpe(n)}var O1={};function Ok(t,e){return be(this,void 0,void 0,Z().mark(function r(){return Z().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(O1[t]===void 0){s.next=2;break}return s.abrupt("return",O1[t]);case 2:return O1[t]=eye(t,e),s.abrupt("return",O1[t]);case 4:case"end":return s.stop()}},r)}))}function eye(t,e){return new Promise(function(r,n){var s=rye(t);if(s&&s.dataset.loaded==="true")try{r(e())}catch(o){return n(new Error("".concat(t," already loaded, but module was not found in global scope: ").concat(o)))}var i=nye(t);i.addEventListener("load",function(){i.dataset.loaded="true";try{r(e())}catch(o){n(new Error("".concat(t," was loaded, but module was not found in global scope: ").concat(o)))}}),i.addEventListener("error",function(o){n(new Error("".concat(t," could not be loaded: ").concat(o)))})})}var tye=function(e){return document.querySelectorAll('script[src="'.concat(e,'"]'))};function rye(t){var e=tye(t);if(e[0])return e[0]}function nye(t){var e=document.createElement("script");return e.setAttribute("src",t),e.setAttribute("async","true"),e.setAttribute("defer","true"),document.head.appendChild(e),e}var ob=["[Stytch]"],sye=!1,xi={debug:function(){return sye},log:function(){for(var e,r=arguments.length,n=new Array(r),s=0;s"u")throw new Error("The ".concat(e,` is not compatible with server-side environments. -If using nextjs, use the create`).concat(e," method instead.\n```\n").concat(r,"\n```\n"))},iye=function(e){var r,n;return!((r=e==null?void 0:e.endpointOptions)===null||r===void 0)&&r.dfppaDomain?"https://"+e.endpointOptions.dfppaDomain:!((n=e==null?void 0:e.endpoints)===null||n===void 0)&&n.dfpBackendURL?e.endpoints.dfpBackendURL:zpe},uj=function(e){return e.includes("public-token-test")},oye=function(){return"event-id-".concat(Ik())},aye=function(){return"app-session-id-".concat(Ik())},cye=function(){return"persistent-id-".concat(Ik())},Tt=function(e){var r={isObject:function(s,i){var o=Ei(i)==="object"&&!Array.isArray(i)&&i!==null;if(!o)throw new Gl(e,s+" must be an object.");return r},isOptionalObject:function(s,i){return typeof i>"u"?r:r.isObject(s,i)},isString:function(s,i){if(typeof i!="string")throw new Gl(e,s+" must be a string.");return r},isOptionalString:function(s,i){return typeof i>"u"?r:r.isString(s,i)},isStringArray:function(s,i){if(!Array.isArray(i))throw new Gl(e,s+" must be an array of strings.");var o=ij(i),a;try{for(o.s();!(a=o.n()).done;){var c=a.value;if(typeof c!="string")throw new Gl(e,s+" must be an array of strings.")}}catch(l){o.e(l)}finally{o.f()}return r},isOptionalStringArray:function(s,i){return typeof i>"u"?r:r.isStringArray(s,i)},isNumber:function(s,i){if(typeof i!="number")throw new Gl(e,s+" must be a number.");return r},isOptionalNumber:function(s,i){return typeof i>"u"?r:r.isNumber(s,i)},isBoolean:function(s,i){if(typeof i!="boolean")throw new Gl(e,s+" must be a boolean.");return r},isOptionalBoolean:function(s,i){return typeof i>"u"?r:r.isBoolean(s,i)}};return r},Ys=function(e){var r=cj(e,["request_id","status_code"]);return r},qt=function(e){var r=cj(e,["__user"]);return r},lye=function(){return Ok("".concat(Hpe,"/telemetry.js"),function(){return window.GetTelemetryID})},uye=Or(function t(e,r,n){var s=this,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)};_r(this,t),this.bootstrapPromise=n,this.isEnabled=function(){return be(s,void 0,void 0,Z().mark(function o(){return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",this.state.then(function(l){return l.enabled}));case 1:case"end":return c.stop()}},o,this)}))},this.getTelemetryID=function(){return be(s,void 0,void 0,Z().mark(function o(){var a,c,l,u;return Z().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,this.state;case 2:if(a=d.sent,c=a.publicToken,l=a.enabled,u=a.dfpBackendURL,l){d.next=8;break}return d.abrupt("return",void 0);case 8:return d.next=10,window.GetTelemetryID(c,"".concat(u,"/submit"));case 10:return d.abrupt("return",d.sent);case 11:case"end":return d.stop()}},o,this)}))},this.getDFPTelemetryIDAndCaptcha=function(){return be(s,void 0,void 0,Z().mark(function o(){var a,c,l,u,f,d;return Z().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.state;case 2:if(a=p.sent,c=a.enabled,l=a.executeRecaptcha,u=a.mode,f=void 0,d=void 0,c){p.next=12;break}return p.next=11,l();case 11:d=p.sent;case 12:if(u!=="DECISIONING"){p.next=18;break}return p.next=15,this.getTelemetryID();case 15:f=p.sent,p.next=25;break;case 18:if(u!=="OBSERVATION"){p.next=25;break}return p.next=21,this.getTelemetryID();case 21:return f=p.sent,p.next=24,l();case 24:d=p.sent;case 25:return p.abrupt("return",{dfp_telemetry_id:f,captcha_token:d});case 26:case"end":return p.stop()}},o,this)}))},this.retryWithCaptchaAndDFP=function(o,a){return be(s,void 0,void 0,Z().mark(function c(){var l,u,f;return Z().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.state;case 2:if(l=h.sent,u=l.enabled,f=l.executeRecaptcha,!(o.type===M0.RequiredCatcha&&u)){h.next=14;break}if(!a.body){h.next=13;break}return h.next=9,this.getTelemetryID();case 9:return a.body.dfp_telemetry_id=h.sent,h.next=12,f();case 12:a.body.captcha_token=h.sent;case 13:return h.abrupt("return",a);case 14:throw new Error("Unable to query captcha and/or dfp telemetry ID");case 15:case"end":return h.stop()}},c,this)}))},this.state=n.then(function(o){return be(s,void 0,void 0,Z().mark(function a(){return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(o.runDFPProtectedAuth){l.next=2;break}return l.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!1,loaded:!1,executeRecaptcha:i});case 2:return l.next=4,lye();case 4:return l.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!0,mode:o.dfpProtectedAuthMode||"OBSERVATION",loaded:!0,executeRecaptcha:i});case 5:case"end":return l.stop()}},a)}))})}),fye=function(){function t(){_r(this,t)}return Or(t,null,[{key:"marshall",value:function(r){return Object.assign(Object.assign({},r),{name:r.name,message:r.message,stack:r.stack})}},{key:"inflate",value:function(r,n){var s=new r(n);return Object.assign(s,n),Object.setPrototypeOf(s,r.prototype),s}},{key:"unmarshall",value:function(r){if("name"in r)switch(r.name){case"SDKAPIUnreachableError":return t.inflate(Cpe,r);case"StytchSDKSchemaError":return t.inflate(Ape,r);case"StytchAPIUnreachableError":return t.inflate(Ql,r);case"StytchAPISchemaError":return t.inflate(nj,r);case"StytchSDKAPIError":return t.inflate(kpe,r);case"StytchAPIError":return t.inflate(sj,r);case"TypeError":return t.inflate(TypeError,r);case"SyntaxError":return t.inflate(SyntaxError,r);case"ReferenceError":return t.inflate(ReferenceError,r);case"RangeError":return t.inflate(RangeError,r);case"EvalError":return t.inflate(EvalError,r);case"URIError":return t.inflate(URIError,r)}return t.inflate(Error,r)}}]),t}(),dye=15,hye=800,pye=function(){function t(e){_r(this,t),this.maxBatchSize=e.maxBatchSize,this.logEventURL=e.logEventURL,setInterval(this.flush.bind(this),e.intervalDurationMs),this.batch=[]}return Or(t,[{key:"logEvent",value:function(r,n){this.batch.push({telemetry:r,event:n}),this.batch.length>=this.maxBatchSize&&this.flush()}},{key:"flush",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n;return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(this.batch.length){i.next=2;break}return i.abrupt("return");case 2:return n=this.batch,this.batch=[],i.prev=4,i.next=7,fetch(this.logEventURL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 7:i.next=11;break;case 9:i.prev=9,i.t0=i.catch(4);case 11:case"end":return i.stop()}},r,this,[[4,9]])}))}}]),t}(),H8;(function(t){t.LoginOrCreateEML="login_or_create_eml",t.LoginOrCreateOTP="login_or_create_otp",t.ResetPassword="reset_password"})(H8||(H8={}));var yye=Or(function t(e,r){var n=this;_r(this,t),this._networkClient=e,this._subscriptionService=r,this.get=function(){return be(n,void 0,void 0,Z().mark(function s(){var i,o;return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/me",errorMessage:"Failed to retrieve user info.",method:"GET"});case 2:return i=c.sent,o=Ys(i),this._subscriptionService.updateUser(o),c.abrupt("return",o);case 6:case"end":return c.stop()}},s,this)}))},this.getSync=function(){return n._subscriptionService.getUser()},this.getInfo=function(){return{user:n.getSync(),fromCache:n._subscriptionService.getFromCache()}},this.update=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.user.update").isOptionalObject("untrusted_metadata",s.untrusted_metadata),l.next=3,this._networkClient.fetchSDK({url:"/users/me",body:s,errorMessage:"Failed to update user.",method:"PUT"});case 3:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 7:case"end":return l.stop()}},i,this)}))},this.deleteEmail=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/emails/".concat(s),errorMessage:"Failed to delete email.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deletePhoneNumber=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/phone_numbers/".concat(s),errorMessage:"Failed to delete phone number.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteTOTP=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/totps/".concat(s),errorMessage:"Failed to delete TOTP.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteOAuthRegistration=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/oauth/".concat(s),errorMessage:"Failed to delete OAuth registration.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteWebauthnRegistration=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/webauthn_registrations/".concat(s),errorMessage:"Failed to delete WebAuthn registration.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteBiometricRegistration=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/biometric_registrations/".concat(s),errorMessage:"Failed to delete Biometric registration.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.onChange=function(s){var i=n._subscriptionService.getUser(),o=function(c){var l;(c==null?void 0:c.user)!==i&&(i=(l=c==null?void 0:c.user)!==null&&l!==void 0?l:null,s(i))};return n._subscriptionService.subscribeToState(o)}}),vye=function(){function t(e,r){var n=this;_r(this,t),this._networkClient=e,this._subscriptionService=r,this.getSync=function(){return n._subscriptionService.getSession()},this.getInfo=function(){return{session:n.getSync(),fromCache:n._subscriptionService.getFromCache()}},this.onChange=function(s){var i=n._subscriptionService.getSession(),o=function(c){var l;(c==null?void 0:c.session)!==i&&(i=(l=c==null?void 0:c.session)!==null&&l!==void 0?l:null,s(i))};return n._subscriptionService.subscribeToState(o)},this.revoke=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o;return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.prev=0,c.next=3,this._networkClient.fetchSDK({url:"/sessions/revoke",errorMessage:"Error revoking session",method:"POST"});case 3:return o=c.sent,this._subscriptionService.destroyState(),c.abrupt("return",o);case 8:throw c.prev=8,c.t0=c.catch(0),s!=null&&s.forceClear?this._subscriptionService.destroyState():W2.includes(c.t0.error_type)&&this._subscriptionService.destroyState(),c.t0;case 12:case"end":return c.stop()}},i,this,[[0,8]])}))},this.authenticate=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o=this,a,c,l,u;return Z().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return a=this._subscriptionService.getSession(),c=function(){var p;return(a==null?void 0:a.session_id)!==((p=o._subscriptionService.getSession())===null||p===void 0?void 0:p.session_id)},d.prev=2,l={session_duration_minutes:s==null?void 0:s.session_duration_minutes},d.next=6,this._networkClient.fetchSDK({url:"/sessions/authenticate",body:l,errorMessage:"Error authenticating session",method:"POST"});case 6:if(u=d.sent,!c()){d.next=9;break}return d.abrupt("return",this.authenticate(s));case 9:return this._subscriptionService.updateStateAndTokens({state:{session:u.session,user:u.user},session_token:u.session_token,session_jwt:u.session_jwt,intermediate_session_token:null}),d.abrupt("return",qt(u));case 13:if(d.prev=13,d.t0=d.catch(2),!c()){d.next=17;break}return d.abrupt("return",this.authenticate(s));case 17:throw W2.includes(d.t0.error_type)&&this._subscriptionService.destroySession(),d.t0;case 19:case"end":return d.stop()}},i,this,[[2,13]])}))}}return Or(t,[{key:"getTokens",value:function(){return this._subscriptionService.getTokens()}},{key:"updateSession",value:function(r){var n;Tt("stytch.session.updateSession").isString("session_token",r.session_token).isOptionalString("session_jwt",(n=r.session_jwt)!==null&&n!==void 0?n:void 0),this._subscriptionService.updateTokens(r)}}]),t}(),mye=Promise.resolve({pkceRequiredForEmailMagicLinks:!1}),gye=function(){function t(e,r,n,s){var i=this,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:mye,a=arguments.length>5?arguments[5]:void 0;_r(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._passwordResetPKCEManager=s,this._config=o,this.dfpProtectedAuth=a,this.email={loginOrCreate:function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return be(i,void 0,void 0,Z().mark(function f(){var d,h,p,y,g,m,x;return Z().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,this._config;case 2:if(d=w.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){w.next=9;break}return w.next=8,this.getCodeChallenge();case 8:p=w.sent;case 9:return w.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return y=w.sent,g=y.dfp_telemetry_id,m=y.captcha_token,x=Object.assign(Object.assign({},u),{email:l,code_challenge:p,captcha_token:m,dfp_telemetry_id:g}),w.abrupt("return",this._networkClient.retriableFetchSDK({url:"/magic_links/email/login_or_create",body:x,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 16:case"end":return w.stop()}},f,this)}))},send:function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return be(i,void 0,void 0,Z().mark(function f(){var d,h,p,y,g,m,x,b,w;return Z().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return O.next=2,this._config;case 2:if(d=O.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){O.next=9;break}return O.next=8,this.getCodeChallenge();case 8:p=O.sent;case 9:return O.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return y=O.sent,g=y.dfp_telemetry_id,m=y.captcha_token,x=Object.assign(Object.assign({},u),{email:l,code_challenge:p,captcha_token:m,dfp_telemetry_id:g}),b=!!this._subscriptionService.getSession(),w=b?"/magic_links/email/send/secondary":"/magic_links/email/send/primary",O.abrupt("return",this._networkClient.retriableFetchSDK({url:w,body:x,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 18:case"end":return O.stop()}},f,this)}))}},this.authenticate=function(c,l){return be(i,void 0,void 0,Z().mark(function u(){var f,d;return Z().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return Tt("stytch.magicLinks.authenticate").isString("Token",c).isNumber("session_duration_minutes",l.session_duration_minutes),p.next=3,this._passwordResetPKCEManager.getPKPair();case 3:if(f=p.sent,d=null,!(f!=null&&f.code_verifier)){p.next=19;break}return p.prev=6,p.next=9,this.handlePKCEForAuthenticate(this._passwordResetPKCEManager,Object.assign(Object.assign({},l),{token:c}));case 9:d=p.sent,p.next=19;break;case 12:if(p.prev=12,p.t0=p.catch(6),!p.t0.message.includes("pkce")){p.next=18;break}console.log("Authenticate with passwords pkce namespace failed. Falling back to authenticate with magic_links namespace."),p.next=19;break;case 18:throw p.t0;case 19:if(d){p.next=23;break}return p.next=22,this.handlePKCEForAuthenticate(this._pkceManager,Object.assign(Object.assign({},l),{token:c}));case 22:d=p.sent;case 23:return this._subscriptionService.updateStateAndTokens({state:{session:d.session,user:d.user},session_token:d.session_token,session_jwt:d.session_jwt,intermediate_session_token:null}),p.abrupt("return",qt(d));case 25:case"end":return p.stop()}},u,this,[[6,12]])}))}}return Or(t,[{key:"getCodeChallenge",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n;return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._pkceManager.getPKPair();case 2:if(n=i.sent,!n){i.next=5;break}return i.abrupt("return",n.code_challenge);case 5:return i.next=7,this._pkceManager.startPKCETransaction();case 7:return n=i.sent,i.abrupt("return",n.code_challenge);case 9:case"end":return i.stop()}},r,this)}))}},{key:"handlePKCEForAuthenticate",value:function(r,n){return be(this,void 0,void 0,Z().mark(function s(){var i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,r.getPKPair();case 2:return i=l.sent,o=Object.assign({code_verifier:i==null?void 0:i.code_verifier},n),l.next=6,this._networkClient.fetchSDK({url:"/magic_links/authenticate",body:o,errorMessage:"Failed to authenticate token.",method:"POST"});case 6:return a=l.sent,r.clearPKPair(),l.abrupt("return",a);case 9:case"end":return l.stop()}},s,this)}))}}]),t}(),xye=Or(function t(e,r){var n=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return Promise.resolve(void 0)},i=arguments.length>3?arguments[3]:void 0;_r(this,t),this._networkClient=e,this._subscriptionService=r,this.executeRecaptcha=s,this.dfpProtectedAuth=i,this.sms={loginOrCreate:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h;return Z().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=y.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,captcha_token:d,dfp_telemetry_id:f}),y.abrupt("return",this._networkClient.retriableFetchSDK({url:"/otps/sms/login_or_create",body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 7:case"end":return y.stop()}},l,this)}))},send:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p,y;return Z().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=m.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,captcha_token:d,dfp_telemetry_id:f}),p=!!this._subscriptionService.getSession(),y=p?"/otps/sms/send/secondary":"/otps/sms/send/primary",m.abrupt("return",this._networkClient.retriableFetchSDK({url:y,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return m.stop()}},l,this)}))}},this.whatsapp={loginOrCreate:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h;return Z().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=y.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,dfp_telemetry_id:f,captcha_token:d}),y.abrupt("return",this._networkClient.retriableFetchSDK({url:"/otps/whatsapp/login_or_create",body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 7:case"end":return y.stop()}},l,this)}))},send:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p,y;return Z().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=m.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,captcha_token:d,dfp_telemetry_id:f}),p=!!this._subscriptionService.getSession(),y=p?"/otps/whatsapp/send/secondary":"/otps/whatsapp/send/primary",m.abrupt("return",this._networkClient.retriableFetchSDK({url:y,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return m.stop()}},l,this)}))}},this.email={loginOrCreate:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f;return Z().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.executeRecaptcha();case 2:return u=h.sent,f=Object.assign(Object.assign({},c),{email:a,captcha_token:u}),h.abrupt("return",this._networkClient.fetchSDK({url:"/otps/email/login_or_create",body:f,errorMessage:"Failed to send one time passcode",method:"POST"}));case 5:case"end":return h.stop()}},l,this)}))},send:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h;return Z().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this.executeRecaptcha();case 2:return u=y.sent,f=Object.assign(Object.assign({},c),{email:a,captcha_token:u}),d=!!this._subscriptionService.getSession(),h=d?"/otps/email/send/secondary":"/otps/email/send/primary",y.abrupt("return",this._networkClient.fetchSDK({url:h,body:f,errorMessage:"Failed to send one time passcode",method:"POST"}));case 7:case"end":return y.stop()}},l,this)}))}},this.authenticate=function(o,a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p;return Z().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return Tt("stytch.otps.authenticate").isString("Code",o).isNumber("session_duration_minutes",c.session_duration_minutes),g.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return u=g.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign({token:o,method_id:a,dfp_telemetry_id:f,captcha_token:d},c),g.next=9,this._networkClient.retriableFetchSDK({url:"/otps/authenticate",body:h,errorMessage:"Failed to authenticate token.",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 9:return p=g.sent,this._subscriptionService.updateStateAndTokens({state:{session:p.session,user:p.user},session_token:p.session_token,session_jwt:p.session_jwt,intermediate_session_token:null}),g.abrupt("return",qt(p));case 12:case"end":return g.stop()}},l,this)}))}}),bye=function(){function t(e,r,n,s,i){_r(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._dynamicConfig=s,this._config=i,this.google={start:this.startOAuthFlow($t.Google)},this.apple={start:this.startOAuthFlow($t.Apple)},this.microsoft={start:this.startOAuthFlow($t.Microsoft)},this.github={start:this.startOAuthFlow($t.Github)},this.gitlab={start:this.startOAuthFlow($t.GitLab)},this.facebook={start:this.startOAuthFlow($t.Facebook)},this.discord={start:this.startOAuthFlow($t.Discord)},this.salesforce={start:this.startOAuthFlow($t.Salesforce)},this.slack={start:this.startOAuthFlow($t.Slack)},this.amazon={start:this.startOAuthFlow($t.Amazon)},this.bitbucket={start:this.startOAuthFlow($t.Bitbucket)},this.linkedin={start:this.startOAuthFlow($t.LinkedIn)},this.coinbase={start:this.startOAuthFlow($t.Coinbase)},this.twitch={start:this.startOAuthFlow($t.Twitch)},this.twitter={start:this.startOAuthFlow($t.Twitter)},this.tiktok={start:this.startOAuthFlow($t.TikTok)},this.snapchat={start:this.startOAuthFlow($t.Snapchat)},this.figma={start:this.startOAuthFlow($t.Figma)},this.yahoo={start:this.startOAuthFlow($t.Yahoo)}}return Or(t,[{key:"authenticate",value:function(r,n){return be(this,void 0,void 0,Z().mark(function s(){var i,o;return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Tt("stytch.oauth.authenticate").isString("Token",r).isNumber("session_duration_minutes",n.session_duration_minutes),c.next=3,this._pkceManager.getPKPair();case 3:return i=c.sent,i||xi.warn(`No code verifier found in local storage for OAuth flow. +If using nextjs, use the create`).concat(e," method instead.\n```\n").concat(r,"\n```\n"))},aye=function(e){var r,n;return!((r=e==null?void 0:e.endpointOptions)===null||r===void 0)&&r.dfppaDomain?"https://"+e.endpointOptions.dfppaDomain:!((n=e==null?void 0:e.endpoints)===null||n===void 0)&&n.dfpBackendURL?e.endpoints.dfpBackendURL:Gpe},uj=function(e){return e.includes("public-token-test")},cye=function(){return"event-id-".concat(Ik())},lye=function(){return"app-session-id-".concat(Ik())},uye=function(){return"persistent-id-".concat(Ik())},Tt=function(e){var r={isObject:function(s,i){var o=Ei(i)==="object"&&!Array.isArray(i)&&i!==null;if(!o)throw new Gl(e,s+" must be an object.");return r},isOptionalObject:function(s,i){return typeof i>"u"?r:r.isObject(s,i)},isString:function(s,i){if(typeof i!="string")throw new Gl(e,s+" must be a string.");return r},isOptionalString:function(s,i){return typeof i>"u"?r:r.isString(s,i)},isStringArray:function(s,i){if(!Array.isArray(i))throw new Gl(e,s+" must be an array of strings.");var o=ij(i),a;try{for(o.s();!(a=o.n()).done;){var c=a.value;if(typeof c!="string")throw new Gl(e,s+" must be an array of strings.")}}catch(l){o.e(l)}finally{o.f()}return r},isOptionalStringArray:function(s,i){return typeof i>"u"?r:r.isStringArray(s,i)},isNumber:function(s,i){if(typeof i!="number")throw new Gl(e,s+" must be a number.");return r},isOptionalNumber:function(s,i){return typeof i>"u"?r:r.isNumber(s,i)},isBoolean:function(s,i){if(typeof i!="boolean")throw new Gl(e,s+" must be a boolean.");return r},isOptionalBoolean:function(s,i){return typeof i>"u"?r:r.isBoolean(s,i)}};return r},Ys=function(e){var r=cj(e,["request_id","status_code"]);return r},qt=function(e){var r=cj(e,["__user"]);return r},fye=function(){return Ok("".concat(qpe,"/telemetry.js"),function(){return window.GetTelemetryID})},dye=Or(function t(e,r,n){var s=this,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)};_r(this,t),this.bootstrapPromise=n,this.isEnabled=function(){return be(s,void 0,void 0,Z().mark(function o(){return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",this.state.then(function(l){return l.enabled}));case 1:case"end":return c.stop()}},o,this)}))},this.getTelemetryID=function(){return be(s,void 0,void 0,Z().mark(function o(){var a,c,l,u;return Z().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,this.state;case 2:if(a=d.sent,c=a.publicToken,l=a.enabled,u=a.dfpBackendURL,l){d.next=8;break}return d.abrupt("return",void 0);case 8:return d.next=10,window.GetTelemetryID(c,"".concat(u,"/submit"));case 10:return d.abrupt("return",d.sent);case 11:case"end":return d.stop()}},o,this)}))},this.getDFPTelemetryIDAndCaptcha=function(){return be(s,void 0,void 0,Z().mark(function o(){var a,c,l,u,f,d;return Z().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.state;case 2:if(a=p.sent,c=a.enabled,l=a.executeRecaptcha,u=a.mode,f=void 0,d=void 0,c){p.next=12;break}return p.next=11,l();case 11:d=p.sent;case 12:if(u!=="DECISIONING"){p.next=18;break}return p.next=15,this.getTelemetryID();case 15:f=p.sent,p.next=25;break;case 18:if(u!=="OBSERVATION"){p.next=25;break}return p.next=21,this.getTelemetryID();case 21:return f=p.sent,p.next=24,l();case 24:d=p.sent;case 25:return p.abrupt("return",{dfp_telemetry_id:f,captcha_token:d});case 26:case"end":return p.stop()}},o,this)}))},this.retryWithCaptchaAndDFP=function(o,a){return be(s,void 0,void 0,Z().mark(function c(){var l,u,f;return Z().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.state;case 2:if(l=h.sent,u=l.enabled,f=l.executeRecaptcha,!(o.type===M0.RequiredCatcha&&u)){h.next=14;break}if(!a.body){h.next=13;break}return h.next=9,this.getTelemetryID();case 9:return a.body.dfp_telemetry_id=h.sent,h.next=12,f();case 12:a.body.captcha_token=h.sent;case 13:return h.abrupt("return",a);case 14:throw new Error("Unable to query captcha and/or dfp telemetry ID");case 15:case"end":return h.stop()}},c,this)}))},this.state=n.then(function(o){return be(s,void 0,void 0,Z().mark(function a(){return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(o.runDFPProtectedAuth){l.next=2;break}return l.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!1,loaded:!1,executeRecaptcha:i});case 2:return l.next=4,fye();case 4:return l.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!0,mode:o.dfpProtectedAuthMode||"OBSERVATION",loaded:!0,executeRecaptcha:i});case 5:case"end":return l.stop()}},a)}))})}),hye=function(){function t(){_r(this,t)}return Or(t,null,[{key:"marshall",value:function(r){return Object.assign(Object.assign({},r),{name:r.name,message:r.message,stack:r.stack})}},{key:"inflate",value:function(r,n){var s=new r(n);return Object.assign(s,n),Object.setPrototypeOf(s,r.prototype),s}},{key:"unmarshall",value:function(r){if("name"in r)switch(r.name){case"SDKAPIUnreachableError":return t.inflate(kpe,r);case"StytchSDKSchemaError":return t.inflate(Tpe,r);case"StytchAPIUnreachableError":return t.inflate(Ql,r);case"StytchAPISchemaError":return t.inflate(nj,r);case"StytchSDKAPIError":return t.inflate(Ppe,r);case"StytchAPIError":return t.inflate(sj,r);case"TypeError":return t.inflate(TypeError,r);case"SyntaxError":return t.inflate(SyntaxError,r);case"ReferenceError":return t.inflate(ReferenceError,r);case"RangeError":return t.inflate(RangeError,r);case"EvalError":return t.inflate(EvalError,r);case"URIError":return t.inflate(URIError,r)}return t.inflate(Error,r)}}]),t}(),pye=15,yye=800,vye=function(){function t(e){_r(this,t),this.maxBatchSize=e.maxBatchSize,this.logEventURL=e.logEventURL,setInterval(this.flush.bind(this),e.intervalDurationMs),this.batch=[]}return Or(t,[{key:"logEvent",value:function(r,n){this.batch.push({telemetry:r,event:n}),this.batch.length>=this.maxBatchSize&&this.flush()}},{key:"flush",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n;return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(this.batch.length){i.next=2;break}return i.abrupt("return");case 2:return n=this.batch,this.batch=[],i.prev=4,i.next=7,fetch(this.logEventURL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 7:i.next=11;break;case 9:i.prev=9,i.t0=i.catch(4);case 11:case"end":return i.stop()}},r,this,[[4,9]])}))}}]),t}(),H8;(function(t){t.LoginOrCreateEML="login_or_create_eml",t.LoginOrCreateOTP="login_or_create_otp",t.ResetPassword="reset_password"})(H8||(H8={}));var mye=Or(function t(e,r){var n=this;_r(this,t),this._networkClient=e,this._subscriptionService=r,this.get=function(){return be(n,void 0,void 0,Z().mark(function s(){var i,o;return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/me",errorMessage:"Failed to retrieve user info.",method:"GET"});case 2:return i=c.sent,o=Ys(i),this._subscriptionService.updateUser(o),c.abrupt("return",o);case 6:case"end":return c.stop()}},s,this)}))},this.getSync=function(){return n._subscriptionService.getUser()},this.getInfo=function(){return{user:n.getSync(),fromCache:n._subscriptionService.getFromCache()}},this.update=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.user.update").isOptionalObject("untrusted_metadata",s.untrusted_metadata),l.next=3,this._networkClient.fetchSDK({url:"/users/me",body:s,errorMessage:"Failed to update user.",method:"PUT"});case 3:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 7:case"end":return l.stop()}},i,this)}))},this.deleteEmail=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/emails/".concat(s),errorMessage:"Failed to delete email.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deletePhoneNumber=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/phone_numbers/".concat(s),errorMessage:"Failed to delete phone number.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteTOTP=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/totps/".concat(s),errorMessage:"Failed to delete TOTP.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteOAuthRegistration=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/oauth/".concat(s),errorMessage:"Failed to delete OAuth registration.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteWebauthnRegistration=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/webauthn_registrations/".concat(s),errorMessage:"Failed to delete WebAuthn registration.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.deleteBiometricRegistration=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/biometric_registrations/".concat(s),errorMessage:"Failed to delete Biometric registration.",method:"DELETE"});case 2:return o=l.sent,a=Ys(o.__user),this._subscriptionService.updateUser(a),l.abrupt("return",qt(o));case 6:case"end":return l.stop()}},i,this)}))},this.onChange=function(s){var i=n._subscriptionService.getUser(),o=function(c){var l;(c==null?void 0:c.user)!==i&&(i=(l=c==null?void 0:c.user)!==null&&l!==void 0?l:null,s(i))};return n._subscriptionService.subscribeToState(o)}}),gye=function(){function t(e,r){var n=this;_r(this,t),this._networkClient=e,this._subscriptionService=r,this.getSync=function(){return n._subscriptionService.getSession()},this.getInfo=function(){return{session:n.getSync(),fromCache:n._subscriptionService.getFromCache()}},this.onChange=function(s){var i=n._subscriptionService.getSession(),o=function(c){var l;(c==null?void 0:c.session)!==i&&(i=(l=c==null?void 0:c.session)!==null&&l!==void 0?l:null,s(i))};return n._subscriptionService.subscribeToState(o)},this.revoke=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o;return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.prev=0,c.next=3,this._networkClient.fetchSDK({url:"/sessions/revoke",errorMessage:"Error revoking session",method:"POST"});case 3:return o=c.sent,this._subscriptionService.destroyState(),c.abrupt("return",o);case 8:throw c.prev=8,c.t0=c.catch(0),s!=null&&s.forceClear?this._subscriptionService.destroyState():W2.includes(c.t0.error_type)&&this._subscriptionService.destroyState(),c.t0;case 12:case"end":return c.stop()}},i,this,[[0,8]])}))},this.authenticate=function(s){return be(n,void 0,void 0,Z().mark(function i(){var o=this,a,c,l,u;return Z().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return a=this._subscriptionService.getSession(),c=function(){var p;return(a==null?void 0:a.session_id)!==((p=o._subscriptionService.getSession())===null||p===void 0?void 0:p.session_id)},d.prev=2,l={session_duration_minutes:s==null?void 0:s.session_duration_minutes},d.next=6,this._networkClient.fetchSDK({url:"/sessions/authenticate",body:l,errorMessage:"Error authenticating session",method:"POST"});case 6:if(u=d.sent,!c()){d.next=9;break}return d.abrupt("return",this.authenticate(s));case 9:return this._subscriptionService.updateStateAndTokens({state:{session:u.session,user:u.user},session_token:u.session_token,session_jwt:u.session_jwt,intermediate_session_token:null}),d.abrupt("return",qt(u));case 13:if(d.prev=13,d.t0=d.catch(2),!c()){d.next=17;break}return d.abrupt("return",this.authenticate(s));case 17:throw W2.includes(d.t0.error_type)&&this._subscriptionService.destroySession(),d.t0;case 19:case"end":return d.stop()}},i,this,[[2,13]])}))}}return Or(t,[{key:"getTokens",value:function(){return this._subscriptionService.getTokens()}},{key:"updateSession",value:function(r){var n;Tt("stytch.session.updateSession").isString("session_token",r.session_token).isOptionalString("session_jwt",(n=r.session_jwt)!==null&&n!==void 0?n:void 0),this._subscriptionService.updateTokens(r)}}]),t}(),xye=Promise.resolve({pkceRequiredForEmailMagicLinks:!1}),bye=function(){function t(e,r,n,s){var i=this,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:xye,a=arguments.length>5?arguments[5]:void 0;_r(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._passwordResetPKCEManager=s,this._config=o,this.dfpProtectedAuth=a,this.email={loginOrCreate:function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return be(i,void 0,void 0,Z().mark(function f(){var d,h,p,y,g,m,x;return Z().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,this._config;case 2:if(d=w.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){w.next=9;break}return w.next=8,this.getCodeChallenge();case 8:p=w.sent;case 9:return w.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return y=w.sent,g=y.dfp_telemetry_id,m=y.captcha_token,x=Object.assign(Object.assign({},u),{email:l,code_challenge:p,captcha_token:m,dfp_telemetry_id:g}),w.abrupt("return",this._networkClient.retriableFetchSDK({url:"/magic_links/email/login_or_create",body:x,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 16:case"end":return w.stop()}},f,this)}))},send:function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return be(i,void 0,void 0,Z().mark(function f(){var d,h,p,y,g,m,x,b,w;return Z().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return O.next=2,this._config;case 2:if(d=O.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){O.next=9;break}return O.next=8,this.getCodeChallenge();case 8:p=O.sent;case 9:return O.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return y=O.sent,g=y.dfp_telemetry_id,m=y.captcha_token,x=Object.assign(Object.assign({},u),{email:l,code_challenge:p,captcha_token:m,dfp_telemetry_id:g}),b=!!this._subscriptionService.getSession(),w=b?"/magic_links/email/send/secondary":"/magic_links/email/send/primary",O.abrupt("return",this._networkClient.retriableFetchSDK({url:w,body:x,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 18:case"end":return O.stop()}},f,this)}))}},this.authenticate=function(c,l){return be(i,void 0,void 0,Z().mark(function u(){var f,d;return Z().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return Tt("stytch.magicLinks.authenticate").isString("Token",c).isNumber("session_duration_minutes",l.session_duration_minutes),p.next=3,this._passwordResetPKCEManager.getPKPair();case 3:if(f=p.sent,d=null,!(f!=null&&f.code_verifier)){p.next=19;break}return p.prev=6,p.next=9,this.handlePKCEForAuthenticate(this._passwordResetPKCEManager,Object.assign(Object.assign({},l),{token:c}));case 9:d=p.sent,p.next=19;break;case 12:if(p.prev=12,p.t0=p.catch(6),!p.t0.message.includes("pkce")){p.next=18;break}console.log("Authenticate with passwords pkce namespace failed. Falling back to authenticate with magic_links namespace."),p.next=19;break;case 18:throw p.t0;case 19:if(d){p.next=23;break}return p.next=22,this.handlePKCEForAuthenticate(this._pkceManager,Object.assign(Object.assign({},l),{token:c}));case 22:d=p.sent;case 23:return this._subscriptionService.updateStateAndTokens({state:{session:d.session,user:d.user},session_token:d.session_token,session_jwt:d.session_jwt,intermediate_session_token:null}),p.abrupt("return",qt(d));case 25:case"end":return p.stop()}},u,this,[[6,12]])}))}}return Or(t,[{key:"getCodeChallenge",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n;return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._pkceManager.getPKPair();case 2:if(n=i.sent,!n){i.next=5;break}return i.abrupt("return",n.code_challenge);case 5:return i.next=7,this._pkceManager.startPKCETransaction();case 7:return n=i.sent,i.abrupt("return",n.code_challenge);case 9:case"end":return i.stop()}},r,this)}))}},{key:"handlePKCEForAuthenticate",value:function(r,n){return be(this,void 0,void 0,Z().mark(function s(){var i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,r.getPKPair();case 2:return i=l.sent,o=Object.assign({code_verifier:i==null?void 0:i.code_verifier},n),l.next=6,this._networkClient.fetchSDK({url:"/magic_links/authenticate",body:o,errorMessage:"Failed to authenticate token.",method:"POST"});case 6:return a=l.sent,r.clearPKPair(),l.abrupt("return",a);case 9:case"end":return l.stop()}},s,this)}))}}]),t}(),wye=Or(function t(e,r){var n=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return Promise.resolve(void 0)},i=arguments.length>3?arguments[3]:void 0;_r(this,t),this._networkClient=e,this._subscriptionService=r,this.executeRecaptcha=s,this.dfpProtectedAuth=i,this.sms={loginOrCreate:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h;return Z().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=y.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,captcha_token:d,dfp_telemetry_id:f}),y.abrupt("return",this._networkClient.retriableFetchSDK({url:"/otps/sms/login_or_create",body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 7:case"end":return y.stop()}},l,this)}))},send:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p,y;return Z().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=m.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,captcha_token:d,dfp_telemetry_id:f}),p=!!this._subscriptionService.getSession(),y=p?"/otps/sms/send/secondary":"/otps/sms/send/primary",m.abrupt("return",this._networkClient.retriableFetchSDK({url:y,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return m.stop()}},l,this)}))}},this.whatsapp={loginOrCreate:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h;return Z().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=y.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,dfp_telemetry_id:f,captcha_token:d}),y.abrupt("return",this._networkClient.retriableFetchSDK({url:"/otps/whatsapp/login_or_create",body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 7:case"end":return y.stop()}},l,this)}))},send:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p,y;return Z().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return u=m.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign(Object.assign({},c),{phone_number:a,captcha_token:d,dfp_telemetry_id:f}),p=!!this._subscriptionService.getSession(),y=p?"/otps/whatsapp/send/secondary":"/otps/whatsapp/send/primary",m.abrupt("return",this._networkClient.retriableFetchSDK({url:y,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return m.stop()}},l,this)}))}},this.email={loginOrCreate:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f;return Z().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.executeRecaptcha();case 2:return u=h.sent,f=Object.assign(Object.assign({},c),{email:a,captcha_token:u}),h.abrupt("return",this._networkClient.fetchSDK({url:"/otps/email/login_or_create",body:f,errorMessage:"Failed to send one time passcode",method:"POST"}));case 5:case"end":return h.stop()}},l,this)}))},send:function(a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h;return Z().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this.executeRecaptcha();case 2:return u=y.sent,f=Object.assign(Object.assign({},c),{email:a,captcha_token:u}),d=!!this._subscriptionService.getSession(),h=d?"/otps/email/send/secondary":"/otps/email/send/primary",y.abrupt("return",this._networkClient.fetchSDK({url:h,body:f,errorMessage:"Failed to send one time passcode",method:"POST"}));case 7:case"end":return y.stop()}},l,this)}))}},this.authenticate=function(o,a,c){return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p;return Z().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return Tt("stytch.otps.authenticate").isString("Code",o).isNumber("session_duration_minutes",c.session_duration_minutes),g.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return u=g.sent,f=u.dfp_telemetry_id,d=u.captcha_token,h=Object.assign({token:o,method_id:a,dfp_telemetry_id:f,captcha_token:d},c),g.next=9,this._networkClient.retriableFetchSDK({url:"/otps/authenticate",body:h,errorMessage:"Failed to authenticate token.",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 9:return p=g.sent,this._subscriptionService.updateStateAndTokens({state:{session:p.session,user:p.user},session_token:p.session_token,session_jwt:p.session_jwt,intermediate_session_token:null}),g.abrupt("return",qt(p));case 12:case"end":return g.stop()}},l,this)}))}}),Eye=function(){function t(e,r,n,s,i){_r(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._dynamicConfig=s,this._config=i,this.google={start:this.startOAuthFlow($t.Google)},this.apple={start:this.startOAuthFlow($t.Apple)},this.microsoft={start:this.startOAuthFlow($t.Microsoft)},this.github={start:this.startOAuthFlow($t.Github)},this.gitlab={start:this.startOAuthFlow($t.GitLab)},this.facebook={start:this.startOAuthFlow($t.Facebook)},this.discord={start:this.startOAuthFlow($t.Discord)},this.salesforce={start:this.startOAuthFlow($t.Salesforce)},this.slack={start:this.startOAuthFlow($t.Slack)},this.amazon={start:this.startOAuthFlow($t.Amazon)},this.bitbucket={start:this.startOAuthFlow($t.Bitbucket)},this.linkedin={start:this.startOAuthFlow($t.LinkedIn)},this.coinbase={start:this.startOAuthFlow($t.Coinbase)},this.twitch={start:this.startOAuthFlow($t.Twitch)},this.twitter={start:this.startOAuthFlow($t.Twitter)},this.tiktok={start:this.startOAuthFlow($t.TikTok)},this.snapchat={start:this.startOAuthFlow($t.Snapchat)},this.figma={start:this.startOAuthFlow($t.Figma)},this.yahoo={start:this.startOAuthFlow($t.Yahoo)}}return Or(t,[{key:"authenticate",value:function(r,n){return be(this,void 0,void 0,Z().mark(function s(){var i,o;return Z().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Tt("stytch.oauth.authenticate").isString("Token",r).isNumber("session_duration_minutes",n.session_duration_minutes),c.next=3,this._pkceManager.getPKPair();case 3:return i=c.sent,i||xi.warn(`No code verifier found in local storage for OAuth flow. Consider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security. -See https://stytch.com/docs/oauth#guides_pkce for more information.`),c.next=7,this._networkClient.fetchSDK({url:"/oauth/authenticate",method:"POST",body:Object.assign({token:r,code_verifier:i==null?void 0:i.code_verifier},n),errorMessage:"Failed to authenticate token"});case 7:return o=c.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:o.session,user:Ys(o.__user)},session_token:o.session_token,session_jwt:o.session_jwt,intermediate_session_token:null}),c.abrupt("return",qt(o));case 11:case"end":return c.stop()}},s,this)}))}},{key:"getBaseApiUrl",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n,s;return Z().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this._dynamicConfig;case 2:if(n=o.sent,s=n.cnameDomain,!s){o.next=6;break}return o.abrupt("return","https://".concat(s));case 6:if(!uj(this._config.publicToken)){o.next=8;break}return o.abrupt("return",this._config.testAPIURL);case 8:return o.abrupt("return",this._config.liveAPIURL);case 9:case"end":return o.stop()}},r,this)}))}},{key:"startOAuthFlow",value:function(r){var n=this;return function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=s.login_redirect_url,o=s.signup_redirect_url,a=s.custom_scopes,c=s.provider_params;return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p,y,g;return Z().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,this._dynamicConfig;case 2:return u=x.sent,f=u.cnameDomain,d=u.pkceRequiredForOAuth,x.next=7,this.getBaseApiUrl();case 7:if(h=x.sent,this._networkClient.logEvent({name:"start_oauth_flow",details:{provider_type:r,custom_scopes:a,cname_domain:f,pkce:d,provider_params:c}}),p=new URL("".concat(h,"/v1/public/oauth/").concat(r,"/start")),p.searchParams.set("public_token",this._config.publicToken),!d){x.next=18;break}return x.next=14,this._pkceManager.startPKCETransaction();case 14:y=x.sent,p.searchParams.set("code_challenge",y.code_challenge),x.next=19;break;case 18:this._pkceManager.clearPKPair();case 19:if(a&&(Tt("startOAuthFlow").isStringArray("custom_scopes",a),p.searchParams.set("custom_scopes",a.join(" "))),c){Tt("startOAuthFlow").isOptionalObject("provider_params",c);for(g in c)p.searchParams.set("provider_"+g,c[g])}i&&p.searchParams.set("login_redirect_url",i),o&&p.searchParams.set("signup_redirect_url",o),window.location.href=p.toString();case 24:case"end":return x.stop()}},l,this)}))}}}]),t}(),wye=Promise.resolve({siweRequiredForCryptoWallets:!1}),Eye=function(){function t(e,r,n){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)},i=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:wye;_r(this,t),this._networkClient=e,this._apiNetworkClient=r,this._subscriptionService=n,this.executeRecaptcha=s,this.dfpProtectedAuth=i,this._config=o}return Or(t,[{key:"authenticateStart",value:function(r){var n;return be(this,void 0,void 0,Z().mark(function s(){var i,o,a,c,l,u,f;return Z().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return Tt("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address",r.crypto_wallet_address).isString("crypto_wallet_type",r.crypto_wallet_type),r.siwe_params&&Tt("stytch.cryptoWallets.authenticateStart").isOptionalString("uri",r.siwe_params.uri).isOptionalString("chain_id",r.siwe_params.chain_id).isOptionalString("issued_at",r.siwe_params.issued_at).isOptionalString("statement",r.siwe_params.statement).isOptionalString("not_before",r.siwe_params.not_before).isOptionalString("message_request_id",r.siwe_params.message_request_id).isOptionalStringArray("resources",r.siwe_params.resources),i=!!this._subscriptionService.getSession(),h.next=5,this.executeRecaptcha();case 5:return o=h.sent,h.next=8,this._config;case 8:return a=h.sent,c=a.siweRequiredForCryptoWallets,l={crypto_wallet_address:r.crypto_wallet_address,crypto_wallet_type:r.crypto_wallet_type},c&&r.crypto_wallet_type=="ethereum"&&(l.siwe_params=Object.assign(Object.assign({},r.siwe_params),{uri:((n=r.siwe_params)===null||n===void 0?void 0:n.uri)||window.location.origin})),u=i?"/crypto_wallets/authenticate/start/secondary":"/crypto_wallets/authenticate/start/primary",f=Object.assign(Object.assign({},l),{captcha_token:o}),h.abrupt("return",this._apiNetworkClient.fetchSDK({url:u,method:"POST",errorMessage:"Failed to start wallet authentication.",body:f}));case 15:case"end":return h.stop()}},s,this)}))}},{key:"authenticate",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.cryptoWallets.authenticate").isString("signature",r.signature).isString("crypto_wallet_address",r.crypto_wallet_address).isString("crypto_wallet_type",r.crypto_wallet_type).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._apiNetworkClient.retriableFetchSDK({url:"/crypto_wallets/authenticate",method:"POST",errorMessage:"Failed to authenticate.",body:{session_duration_minutes:r.session_duration_minutes,crypto_wallet_address:r.crypto_wallet_address,crypto_wallet_type:r.crypto_wallet_type,signature:r.signature,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:Ys(a.__user)},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}}]),t}(),Sye=function(){function t(e,r,n){_r(this,t),this._networkClient=e,this._subscriptionService=r,this.dfpProtectedAuth=n}return Or(t,[{key:"create",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s;return Z().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return Tt("stytch.totps.create").isNumber("expiration_minutes",r.expiration_minutes),o.next=3,this._networkClient.fetchSDK({url:"/totps",method:"POST",errorMessage:"Failed to create TOTP",body:{expiration_minutes:r.expiration_minutes}});case 3:return s=o.sent,this._subscriptionService.updateUser(s.__user),o.abrupt("return",qt(s));case 6:case"end":return o.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.totps.authenticate").isNumber("session_duration_minutes",r.session_duration_minutes).isString("totp_code",r.totp_code),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/totps/authenticate",method:"POST",errorMessage:"Failed to authenticate TOTP",body:{session_duration_minutes:r.session_duration_minutes,totp_code:r.totp_code,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.__user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"recoveryCodes",value:function(){return be(this,void 0,void 0,Z().mark(function r(){return Z().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",this._networkClient.fetchSDK({url:"/totps/recovery_codes",method:"POST",errorMessage:"Failed to retrieve recovery codes"}));case 1:case"end":return s.stop()}},r,this)}))}},{key:"recover",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.totps.recover").isNumber("session_duration_minutes",r.session_duration_minutes).isString("recovery_code",r.recovery_code),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/totps/recover",method:"POST",errorMessage:"Failed to recover TOTP",body:{session_duration_minutes:r.session_duration_minutes,recovery_code:r.recovery_code,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.__user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}}]),t}();function fj(t){for(var e="==".slice(0,(4-t.length%4)%4),r=t.replace(/-/g,"+").replace(/_/g,"/")+e,n=atob(r),s=new ArrayBuffer(n.length),i=new Uint8Array(s),o=0;o with `"webauthn"` in its `autocomplete` attribute was detected'),!1):!0}}return Or(t,[{key:"register",value:function(r){var n,s;return be(this,void 0,void 0,Z().mark(function i(){var o,a,c,l,u;return Z().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return Tt("stytch.webauthn.register").isOptionalString("domain",r==null?void 0:r.domain).isOptionalString("authenticator_type",r==null?void 0:r.authenticator_type).isOptionalBoolean("is_passkey",r==null?void 0:r.is_passkey).isOptionalNumber("session_duration_minutes",r==null?void 0:r.session_duration_minutes),d.next=3,this._networkClient.fetchSDK({url:"/webauthn/register/start",method:"POST",errorMessage:"Failed to start WebAuthn registration",body:{domain:(n=r==null?void 0:r.domain)!==null&&n!==void 0?n:window.location.hostname,authenticator_type:(s=r==null?void 0:r.authenticator_type)!==null&&s!==void 0?s:void 0,return_passkey_credential_options:r==null?void 0:r.is_passkey,user_agent:navigator.userAgent}});case 3:return o=d.sent,a=o.public_key_credential_creation_options,c=JSON.parse(a),d.next=8,Iye({publicKey:c});case 8:return l=d.sent,d.next=11,this._networkClient.fetchSDK({url:"/webauthn/register",method:"POST",errorMessage:"Failed to register WebAuthn device",body:{public_key_credential:JSON.stringify(l),session_duration_minutes:r==null?void 0:r.session_duration_minutes}});case 11:return u=d.sent,this._subscriptionService.updateStateAndTokens({state:{session:u.session,user:u.__user},session_token:u.session_token,session_jwt:u.session_jwt,intermediate_session_token:null}),d.abrupt("return",qt(u));case 14:case"end":return d.stop()}},i,this)}))}},{key:"authenticate",value:function(r){var n,s;return be(this,void 0,void 0,Z().mark(function i(){var o,a,c,l,u,f,d,h,p,y,g,m;return Z().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return Tt("stytch.webauthn.authenticate").isOptionalString("domain",r.domain).isNumber("session_duration_minutes",r.session_duration_minutes).isOptionalBoolean("is_passkey",r.is_passkey).isOptionalObject("signal",r.signal),b.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:if(o=b.sent,a=o.dfp_telemetry_id,c=o.captcha_token,!r.conditional_mediation){b.next=14;break}return b.next=9,this.browserSupportsAutofill();case 9:if(b.sent){b.next=12;break}return console.error("Browser does not support WebAuthn autofill"),b.abrupt("return",null);case 12:if(this.checkEligibleInputs()){b.next=14;break}return b.abrupt("return",null);case 14:return l=!!this._subscriptionService.getSession(),u=l?"/webauthn/authenticate/start/secondary":"/webauthn/authenticate/start/primary",b.next=18,this._networkClient.fetchSDK({url:u,method:"POST",errorMessage:"Failed to start WebAuthn authentication",body:{domain:(n=r.domain)!==null&&n!==void 0?n:window.location.hostname,return_passkey_credential_options:r==null?void 0:r.is_passkey}});case 18:return f=b.sent,d=f.public_key_credential_request_options,h=new AbortController,p={publicKey:JSON.parse(d),signal:(s=r.signal)!==null&&s!==void 0?s:h.signal},y=Object.assign(Object.assign({},p),{mediation:"conditional"}),b.next=25,Nye(r.conditional_mediation?y:p);case 25:return g=b.sent,b.next=28,this._networkClient.retriableFetchSDK({url:"/webauthn/authenticate",method:"POST",errorMessage:"Failed to authenticate WebAuthn device",body:{public_key_credential:JSON.stringify(g),session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:a,captcha_token:c},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 28:return m=b.sent,this._subscriptionService.updateStateAndTokens({state:{session:m.session,user:m.__user},session_token:m.session_token,session_jwt:m.session_jwt,intermediate_session_token:null}),b.abrupt("return",qt(m));case 31:case"end":return b.stop()}},i,this)}))}},{key:"update",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s;return Z().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return s="/webauthn/update/"+r.webauthn_registration_id,o.next=3,this._networkClient.fetchSDK({url:s,method:"PUT",errorMessage:"Failed to update WebAuthn Registration",body:{name:r.name}});case 3:return o.abrupt("return",o.sent);case 4:case"end":return o.stop()}},n,this)}))}},{key:"browserSupportsAutofill",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n;return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(n=window.PublicKeyCredential,!(n===void 0||n.isConditionalMediationAvailable===void 0)){i.next=3;break}return i.abrupt("return",new Promise(function(o){return o(!1)}));case 3:return i.abrupt("return",n.isConditionalMediationAvailable());case 4:case"end":return i.stop()}},r)}))}}]),t}(),Dye=Promise.resolve({pkceRequiredForPasswordResets:!1}),Lye=function(){function t(e,r,n){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Dye,i=arguments.length>4?arguments[4]:void 0;_r(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._config=s,this.dfpProtectedAuth=i}return Or(t,[{key:"getCodeChallenge",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n,s,i;return Z().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this._config;case 2:if(n=a.sent,s=n.pkceRequiredForPasswordResets,s){a.next=6;break}return a.abrupt("return",void 0);case 6:return a.next=8,this._pkceManager.getPKPair();case 8:if(i=a.sent,!i){a.next=11;break}return a.abrupt("return",i.code_challenge);case 11:return a.next=13,this._pkceManager.startPKCETransaction();case 13:return i=a.sent,a.abrupt("return",i.code_challenge);case 15:case"end":return a.stop()}},r,this)}))}},{key:"create",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.create").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords",method:"POST",errorMessage:"Failed to create password.",body:{email:r.email,password:r.password,session_duration_minutes:r.session_duration_minutes,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.authenticate").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords/authenticate",method:"POST",errorMessage:"Failed to authenticate password.",body:{email:r.email,password:r.password,session_duration_minutes:r.session_duration_minutes,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"resetByEmailStart",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.resetByEmailStart").isString("email",r.email).isOptionalString("login_redirect_url",r.login_redirect_url).isOptionalString("reset_password_redirect_url",r.reset_password_redirect_url).isOptionalString("reset_password_template_id",r.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes",r.reset_password_expiration_minutes),l.next=3,this.getCodeChallenge();case 3:return s=l.sent,l.next=6,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 6:return i=l.sent,o=i.dfp_telemetry_id,a=i.captcha_token,l.abrupt("return",this._networkClient.retriableFetchSDK({url:"/passwords/email/reset/start",method:"POST",errorMessage:"Failed to start password reset flow.",body:{email:r.email,login_redirect_url:r.login_redirect_url,reset_password_redirect_url:r.reset_password_redirect_url,reset_password_expiration_minutes:r.reset_password_expiration_minutes,reset_password_template_id:r.reset_password_template_id,code_challenge:s,captcha_token:a,dfp_telemetry_id:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 10:case"end":return l.stop()}},n,this)}))}},{key:"resetByEmail",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a,c,l;return Z().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return Tt("stytch.passwords.resetByEmail").isString("token",r.token).isString("password",r.password).isNumber("session_duration_minutes",r.session_duration_minutes),f.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=f.sent,i=s.dfp_telemetry_id,o=s.captcha_token,f.next=8,this._pkceManager.getPKPair();case 8:return a=f.sent,c=a==null?void 0:a.code_verifier,f.next=12,this._networkClient.retriableFetchSDK({url:"/passwords/email/reset",method:"POST",errorMessage:"Failed to reset password.",body:{token:r.token,password:r.password,session_duration_minutes:r.session_duration_minutes,captcha_token:o,code_verifier:c,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 12:return l=f.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:l.session,user:l.user},session_token:l.session_token,session_jwt:l.session_jwt,intermediate_session_token:null}),f.abrupt("return",qt(l));case 16:case"end":return f.stop()}},n,this)}))}},{key:"resetByExistingPassword",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.resetByExistingPassword").isString("email",r.email).isString("existing_password",r.existing_password).isString("new_password",r.new_password).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords/existing_password/reset",method:"POST",errorMessage:"Failed to reset password.",body:{email:r.email,existing_password:r.existing_password,new_password:r.new_password,session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:i,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"resetBySession",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.resetBySession").isString("password",r.password),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords/session/reset",method:"POST",errorMessage:"Failed to reset by session.",body:{password:r.password,session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:i,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",a);case 11:case"end":return l.stop()}},n,this)}))}},{key:"strengthCheck",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return Tt("stytch.passwords.strengthCheck").isOptionalString("email",r.email).isString("password",r.password),i.abrupt("return",this._networkClient.fetchSDK({url:"/passwords/strength_check",method:"POST",errorMessage:"Failed to check password strength.",body:{email:r.email,password:r.password}}));case 2:case"end":return i.stop()}},n,this)}))}}]),t}();Promise.resolve({pkceRequiredForEmailMagicLinks:!1});Promise.resolve({pkceRequiredForPasswordResets:!1});var jye=function(){function t(e){_r(this,t),this.iframeURL=e,this.createIframe()}return Or(t,[{key:"createIframe",value:function(){var r=document.querySelector('[src~="'.concat(this.iframeURL,'"]'));if(r?xi.warn("It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function."):(r=document.createElement("iframe"),r.src=this.iframeURL,r.style.position="absolute",r.style.width="0",r.style.height="0",r.style.border="0",document.body.appendChild(r)),r.dataset.loaded==="true"){this.frame=Promise.resolve(r);return}this.frame=new Promise(function(n){r.addEventListener("load",function(){r.dataset.loaded="true",n(r)},{once:!0})})}},{key:"call",value:function(r,n){return be(this,void 0,void 0,Z().mark(function s(){var i=this,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this.frame;case 2:return o=l.sent,a=new MessageChannel,l.abrupt("return",new Promise(function(u,f){var d;a.port1.onmessage=function(p){var y=p.data;a.port1.close(),y.success?u(y.payload):f(fye.unmarshall(y.error))};var h={method:r,args:n};(d=o.contentWindow)===null||d===void 0||d.postMessage(h,i.iframeURL,[a.port2])}));case 5:case"end":return l.stop()}},s,this)}))}}]),t}(),Bye=function(){function t(e,r){_r(this,t),this._networkClient=e,this.dfpProtectedAuth=r}return Or(t,[{key:"searchUser",value:function(r){var n=this;return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function(s){var i=s.dfp_telemetry_id,o=s.captcha_token;return n._networkClient.fetchSDK({url:"/users/search",method:"POST",body:{email:r,dfp_telemetry_id:i,captcha_token:o},errorMessage:"Error searching for user ".concat(r)})})}},{key:"searchMember",value:function(r,n){return this._networkClient.fetchSDK({url:"/b2b/organizations/members/search",method:"POST",body:{email_address:r,organization_id:n},errorMessage:"Error searching for member ".concat(r)})}}]),t}(),Fye=function(e){return!!(e!=null&&e.session)},vj=function(){function t(e,r){var n=this;_r(this,t),this._subscriptionService=e,this._headlessSessionClient=r,this._onDataChange=function(s){Fye(s)?n.scheduleBackgroundRefresh():n.cancelBackgroundRefresh()},this._reauthenticateWithBackoff=function(){return be(n,void 0,void 0,Z().mark(function s(){var i;return Z().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:i=0;case 1:return a.prev=2,a.next=5,this._headlessSessionClient.authenticate();case 5:return a.abrupt("return",a.sent);case 8:if(a.prev=8,a.t0=a.catch(2),!t.isUnrecoverableError(a.t0)){a.next=12;break}return a.abrupt("return",Promise.reject(a.t0));case 12:return i++,a.next=15,new Promise(function(c){return setTimeout(c,t.timeoutForAttempt(i))});case 15:a.next=1;break;case 17:case"end":return a.stop()}},s,this,[[2,8]])}))},this.timeout=null,this._subscriptionService.subscribeToState(this._onDataChange)}return Or(t,[{key:"performBackgroundRefresh",value:function(){var r=this;this._reauthenticateWithBackoff().then(function(){r.scheduleBackgroundRefresh()}).catch(function(n){xi.warn("Session background refresh failed. Signalling to app that user is logged out.",{error:n}),r._subscriptionService.destroySession()})}},{key:"scheduleBackgroundRefresh",value:function(){var r=this;this.cancelBackgroundRefresh(),this.timeout=setTimeout(function(){r.performBackgroundRefresh()},t.REFRESH_INTERVAL_MS)}},{key:"cancelBackgroundRefresh",value:function(){this.timeout!==null&&(clearTimeout(this.timeout),this.timeout=null)}}],[{key:"timeoutForAttempt",value:function(r){r=Math.min(r,7);var n=Math.floor(Math.random()*350)-175,s=2e3*Math.pow(2,r);return n+s}},{key:"isUnrecoverableError",value:function(r){return W2.includes(r.error_type)}}]),t}();vj.REFRESH_INTERVAL_MS=1e3*60*3;var Uye=Or(function t(e,r){var n=this;_r(this,t),this._subscriptionService=e,this.emptyState=r,this.onStateChange=function(s){return n._subscriptionService.subscribeToState(function(i){s(i??n.emptyState)})}}),G8="bootstrap",cb=function(){return{displayWatermark:!1,cnameDomain:null,emailDomains:["stytch.com"],captchaSettings:{enabled:!1},pkceRequiredForEmailMagicLinks:!1,pkceRequiredForPasswordResets:!1,pkceRequiredForOAuth:!1,pkceRequiredForSso:!1,slugPattern:null,createOrganizationEnabled:!1,passwordConfig:null,runDFPProtectedAuth:!1,rbacPolicy:null,siweRequiredForCryptoWallets:!1}},Vye=function(){function t(e,r,n){var s=this;wn(this,t),this._publicToken=e,this._networkClient=r,this._dataLayer=n,this._bootstrapDataPromise=this._networkClient.fetchSDK({url:"/projects/bootstrap/".concat(this._publicToken),method:"GET",errorMessage:"Error fetching bootstrap data for SDK for ".concat(this._publicToken)}).then(t.mapBootstrapData).then(function(i){return s._dataLayer.setItem(G8,JSON.stringify(i)),i}).catch(function(i){return xi.error(i),cb()})}return En(t,[{key:"getSync",value:function(){var r=this._dataLayer.getItem(G8);if(r===null)return cb();try{return JSON.parse(r)}catch{return cb()}}},{key:"getAsync",value:function(){return this._bootstrapDataPromise}}],[{key:"mapBootstrapData",value:function(r){var n,s,i=r.password_config!==null?{ludsComplexity:r.password_config.luds_complexity,ludsMinimumCount:r.password_config.luds_minimum_count}:null;return{displayWatermark:!r.disable_sdk_watermark,captchaSettings:r.captcha_settings,cnameDomain:r.cname_domain,emailDomains:r.email_domains,pkceRequiredForEmailMagicLinks:r.pkce_required_for_email_magic_links,pkceRequiredForPasswordResets:r.pkce_required_for_password_resets,pkceRequiredForOAuth:r.pkce_required_for_oauth,pkceRequiredForSso:r.pkce_required_for_sso,slugPattern:r.slug_pattern,createOrganizationEnabled:r.create_organization_enabled,passwordConfig:i,runDFPProtectedAuth:(n=r.dfp_protected_auth_enabled)!==null&&n!==void 0?n:!1,dfpProtectedAuthMode:r.dfp_protected_auth_mode,rbacPolicy:(s=r.rbac_policy)!==null&&s!==void 0?s:null,siweRequiredForCryptoWallets:r.siwe_required_for_crypto_wallets}}}]),t}();function js(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{l(n.next(u))}catch(f){o(f)}}function c(u){try{l(n.throw(u))}catch(f){o(f)}}function l(u){u.done?i(u.value):s(u.value).then(a,c)}l((n=n.apply(t,e||[])).next())})}var $ye=function(e){return Ok("https://www.google.com/recaptcha/enterprise.js?render=".concat(e),function(){return window.grecaptcha.enterprise})},zye=En(function t(e){var r=this;wn(this,t),this.bootstrapPromise=e,this.executeRecaptcha=function(){return js(r,void 0,void 0,Rt().mark(function n(){var s,i,o,a;return Rt().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this.state;case 2:if(s=l.sent,i=s.captchaClient,o=s.configured,a=s.siteKey,o){l.next=8;break}return l.abrupt("return",void 0);case 8:return l.next=10,new Promise(function(u){return i.ready(u)});case 10:return l.abrupt("return",i.execute(a,{action:"LOGIN"}));case 11:case"end":return l.stop()}},n,this)}))},this.state=e.then(function(n){return js(r,void 0,void 0,Rt().mark(function s(){return Rt().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(n.captchaSettings.enabled){o.next=2;break}return o.abrupt("return",{configured:!1});case 2:return o.next=4,$ye(n.captchaSettings.siteKey);case 4:return o.t0=o.sent,o.t1=n.captchaSettings.siteKey,o.abrupt("return",{configured:!0,captchaClient:o.t0,siteKey:o.t1});case 7:case"end":return o.stop()}},s)}))})}),Hye=function(){function t(e){var r=this;wn(this,t),this.iframeURL=e,this.oneTapStart=function(n){return r.call("oneTapStart",n)},this.oneTapSubmit=function(n){return r.call("oneTapSubmit",n)},this.parsedPhoneNumber=function(n){return r.call("parsedPhoneNumber",n)}}return En(t,[{key:"frameClient",get:function(){var r;return this._frameClient=(r=this._frameClient)!==null&&r!==void 0?r:new jye(this.iframeURL),this._frameClient}},{key:"call",value:function(r,n){return this.frameClient.call(r,[n])}}]),t}(),Gye=function(t){fg(e,t);function e(r,n,s,i,o,a){var c;return wn(this,e),c=ug(this,e,[r,n,s,i,o]),c._oneTap=a,c.startOneTap=function(l){return js(tj(c),void 0,void 0,Rt().mark(function u(){var f,d,h;return Rt().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this._oneTap.createOneTapClient();case 2:if(f=y.sent,f.success){y.next=5;break}throw new Error("One Tap could not load: ".concat(f.reason));case 5:return d=f.client,h=this._oneTap.createOnSuccessHandler({signupRedirectUrl:l.signup_redirect_url,loginRedirectUrl:l.login_redirect_url,onSuccess:this._oneTap.RedirectOnSuccess}),y.abrupt("return",d.render({style:{position:Ac.floating},onOneTapCancelled:l.onOneTapCancelled,callback:h}));case 8:case"end":return y.stop()}},u,this)}))},c.googleOneTap={start:c.startOneTap},c}return En(e)}(bye),qye="4.18.2",mj=function(){function t(e,r,n,s){wn(this,t),this._publicToken=e,this._subscriptionDataLayer=r,this.baseURL=n,this.additionalTelemetryDataFn=s,this.updateSessionToken=function(){return null},this.eventLogger=new pye({maxBatchSize:dye,intervalDurationMs:hye,logEventURL:this.buildSDKUrl("/events")})}return En(t,[{key:"logEvent",value:function(r){var n=r.name,s=r.details,i=r.error,o=i===void 0?{}:i;this.eventLogger.logEvent(this.createTelemetryBlob(),{public_token:this._publicToken,event_name:n,details:s,error_code:o.error_code,error_description:o.error_description,http_status_code:o.http_status_code})}},{key:"createTelemetryBlob",value:function(){return Object.assign(Object.assign({event_id:oye(),app_session_id:aye(),persistent_id:cye(),client_sent_at:new Date().toISOString(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},this.additionalTelemetryDataFn()),{app:{identifier:window.location.hostname},sdk:{identifier:"Stytch.js Javascript SDK",version:qye}})}},{key:"fetchSDK",value:function(r){var n=r.url,s=r.body,i=r.errorMessage,o=r.method;return js(this,void 0,void 0,Rt().mark(function a(){var c,l,u,f;return Rt().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return c=this._subscriptionDataLayer.readSessionCookie().session_token,l="Basic "+window.btoa(this._publicToken+":"+(c||this._publicToken)),u=window.btoa(JSON.stringify(this.createTelemetryBlob())),f=window.location.origin,h.abrupt("return",Q2({basicAuthHeader:l,body:s,errorMessage:i,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:u,xSDKParentHostHeader:f}));case 5:case"end":return h.stop()}},a,this)}))}},{key:"retriableFetchSDK",value:function(r){var n=r.url,s=r.body,i=r.errorMessage,o=r.method,a=r.retryCallback;return js(this,void 0,void 0,Rt().mark(function c(){var l,u,f,d;return Rt().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return l=this._subscriptionDataLayer.readSessionCookie().session_token,u="Basic "+window.btoa(this._publicToken+":"+(l||this._publicToken)),f=window.btoa(JSON.stringify(this.createTelemetryBlob())),d=window.location.origin,p.abrupt("return",qpe({basicAuthHeader:u,body:s,errorMessage:i,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:f,xSDKParentHostHeader:d,retryCallback:a}));case 5:case"end":return p.stop()}},c,this)}))}},{key:"buildSDKUrl",value:function(r){return"".concat(this.baseURL,"/sdk/v1").concat(r)}}]),t}(),Wye=typeof window<"u"&&"IdentityCredential"in window,gj=function(e){return e===Ac.forceLegacyEmbedded?"force":e===Ac.embeddedOnly||e===Ac.embedded||e===Ac.floatingOrEmbedded},Kye=function(e){var r=gj(e);return r==="force"||r&&!Wye},Qye=function(){function t(e,r){wn(this,t),this._googleClient=e,this._clientId=r}return En(t,[{key:"cancel",value:function(){this._googleClient.cancel()}},{key:"render",value:function(r){var n=r.callback,s=r.onOneTapCancelled,i=r.style;return js(this,void 0,void 0,Rt().mark(function o(){var a=this,c,l,u;return Rt().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return c=gj(i.position),l=Kye(i.position),u={client_id:this._clientId,callback:n,auto_select:!1,context:"use",itp_support:!0,use_fedcm_for_prompt:c!=="force"},l&&(u.prompt_parent_id="google-parent-prompt",u.cancel_on_tap_outside=!1),this._googleClient.initialize(u),d.abrupt("return",new Promise(function(h){a._googleClient.prompt(function(p){var y,g,m,x,b;if(p.isSkippedMoment()){var w=(g=(y=p.getSkippedReason)===null||y===void 0?void 0:y.call(p))!==null&&g!==void 0?g:"unknown_reason";return w==="user_cancel"&&(s==null||s()),h({success:!1,reason:w})}if(!p.isNotDisplayed&&l||!((m=p.isNotDisplayed)===null||m===void 0)&&m.call(p))return h({success:!1,reason:(b=(x=p.getNotDisplayedReason)===null||x===void 0?void 0:x.call(p))!==null&&b!==void 0?b:"unknown_reason"});if(!p.isDismissedMoment())return a.styleFrame(l),h({success:!0})})}));case 6:case"end":return d.stop()}},o,this)}))}},{key:"styleFrame",value:function(r){r&&Array.from(document.getElementsByTagName("iframe")).forEach(function(n){n.src.includes(aj)&&(n.style.width="100%")})}}]),t}(),Yye=function(){return Ok(Gpe,function(){return window.google.accounts.id})},Jye=function(){function t(e,r){var n=this;wn(this,t),this._publicToken=e,this.clientsideServices=r,this.createOnSuccessHandler=function(s){var i=s.loginRedirectUrl,o=s.signupRedirectUrl,a=s.onSuccess;return function(c){return js(n,void 0,void 0,Rt().mark(function l(){var u,f,d;return Rt().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return u=c.credential,p.next=3,this.submitGoogleOneTapToken({credential:u,loginRedirectUrl:i,signupRedirectUrl:o});case 3:f=p.sent,d=f.redirect_url,a(d);case 6:case"end":return p.stop()}},l,this)}))}},this.RedirectOnSuccess=function(s){window.location.href=s}}return En(t,[{key:"createOneTapClient",value:function(){return js(this,void 0,void 0,Rt().mark(function r(){var n,s,i,o;return Rt().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.prev=0,c.next=3,this.fetchGoogleStart();case 3:s=c.sent,n=s.googleClientId,c.next=11;break;case 7:return c.prev=7,c.t0=c.catch(0),i=c.t0,c.abrupt("return",{success:!1,reason:i.error_type});case 11:if(n!==""){c.next=13;break}return c.abrupt("return",{success:!1,reason:"oauth_config_not_found"});case 13:return c.t1=Qye,c.next=16,Yye();case 16:return c.t2=c.sent,c.t3=n,o=new c.t1(c.t2,c.t3),c.abrupt("return",{success:!0,client:o});case 20:case"end":return c.stop()}},r,this,[[0,7]])}))}},{key:"fetchGoogleStart",value:function(){return this.googleConfig?this.googleConfig:(this.googleConfig=this.clientsideServices.oneTapStart({publicToken:this._publicToken}),this.googleConfig)}},{key:"submitGoogleOneTapToken",value:function(r){var n=r.credential,s=r.loginRedirectUrl,i=r.signupRedirectUrl;return js(this,void 0,void 0,Rt().mark(function o(){var a,c;return Rt().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.fetchGoogleStart();case 2:return a=u.sent,c=a.oauthCallbackId,u.abrupt("return",this.clientsideServices.oneTapSubmit({publicToken:this._publicToken,idToken:n,loginRedirectURL:s,oauthCallbackID:c,signupRedirectURL:i}));case 5:case"end":return u.stop()}},o,this)}))}}],[{key:"WillGoogleOneTapShowBannerForUA",value:function(r){var n=function(a,c){return a.indexOf(c)!==-1},s=n(r,"iPad")||n(r,"Android")&&!n(r,"Mobile")||n(r,"Silk"),i=n(r,"iPod")||n(r,"iPhone")||n(r,"Android")||n(r,"IEMobile");return!s&&i}},{key:"WillGoogleOneTapShowEmbedded",value:function(){return!t.WillGoogleOneTapShowBannerForUA(navigator.userAgent)}}]),t}(),Xye="PKCE_VERIFIER";function Zye(t){var e=t.toString(16);return e.length===1&&(e="0"+e),e}function e1e(t){var e;return btoa((e=String.fromCharCode).call.apply(e,[null].concat(ype(new Uint8Array(t))))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var lb=function(){function t(e,r){wn(this,t),this._dataLayer=e,this.namespace=r}return En(t,[{key:"key",value:function(){return Xye+":"+this.namespace}},{key:"startPKCETransaction",value:function(){return js(this,void 0,void 0,Rt().mark(function r(){var n;return Rt().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.createProofkeyPair();case 2:return n=i.sent,this._dataLayer.setItem(this.key(),JSON.stringify(n)),i.abrupt("return",n);case 5:case"end":return i.stop()}},r,this)}))}},{key:"getPKPair",value:function(){var r=this._dataLayer.getItem(this.key());if(r!==null)try{return JSON.parse(r)}catch{xi.warn("Found malformed Proof Key pair in localstorage.");return}}},{key:"clearPKPair",value:function(){return this._dataLayer.removeItem(this.key())}}],[{key:"createProofkeyPair",value:function(){return js(this,void 0,void 0,Rt().mark(function r(){var n,s,i;return Rt().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return n=new Uint32Array(16),window.crypto.getRandomValues(n),s=Array.from(n).map(Zye).join(""),a.next=5,window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(s));case 5:return i=a.sent,a.abrupt("return",{code_challenge:e1e(i),code_verifier:s});case 7:case"end":return a.stop()}},r)}))}}]),t}(),t1e=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.KEYS_TO_EXCLUDE,n=r===void 0?[]:r,s=function i(o,a){return Ls(o)!==Ls(a)?!1:o===null||a===null?o===a:Ls(o)==="object"?Object.keys(o).length!==Object.keys(a).length||Object.keys(o).some(function(c){return!(c in a)})?!1:Object.entries(o).filter(function(c){var l=z2(c,1),u=l[0];return!n.includes(u)}).every(function(c){var l=z2(c,2),u=l[0],f=l[1];return i(f,a[u])}):o===a};return s},r1e=function(){return!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))},n1e=function(e){var r,n,s,i,o,a,c,l;return{cookieOptions:e==null?void 0:e.cookieOptions,endpoints:{sdkBackendURL:(n=(r=e==null?void 0:e.endpoints)===null||r===void 0?void 0:r.sdkBackendURL)!==null&&n!==void 0?n:$pe,testAPIURL:(i=(s=e==null?void 0:e.endpoints)===null||s===void 0?void 0:s.testAPIURL)!==null&&i!==void 0?i:Fpe,liveAPIURL:(a=(o=e==null?void 0:e.endpoints)===null||o===void 0?void 0:o.liveAPIURL)!==null&&a!==void 0?a:Upe,dfpBackendURL:iye(e),clientsideServicesIframeURL:(l=(c=e==null?void 0:e.endpoints)===null||c===void 0?void 0:c.clientsideServicesIframeURL)!==null&&l!==void 0?l:Vpe}}},_1=function(e){var r=document.cookie?document.cookie.split("; "):[],n=r.filter(function(s){var i=s.split("="),o=z2(i,1),a=o[0];return e===a});return n.length>1},s1e="stytch_sdk_state_",_i=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"".concat(s1e).concat(e).concat(r?"::".concat(r):"")};/*! js-cookie v3.0.1 | MIT */function N1(t){for(var e=1;e"u")){o=N1({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var c in o)o[c]&&(a+="; "+c,o[c]!==!0&&(a+="="+o[c].split(";")[0]));return document.cookie=s+"="+t.write(i,s)+a}}function n(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],o={},a=0;a1&&arguments[1]!==void 0?arguments[1]:!1,s=this._datalayer.state,i=r===null?null:Object.assign(Object.assign({},this._datalayer.state),r);this._datalayer.state=i;var o=this.getFromCache();this.setCacheRefreshed();var a=!W8(s,i);(o||a)&&(q8(this._datalayer.subscriptions,i),a&&!n&&this._datalayer.syncToLocalStorage())}},{key:"updateTokens",value:function(r){var n=r.session_token,s=r.session_jwt,i=this._datalayer.readSessionCookie(),o=Object.assign(Object.assign({},i),{session_token:n,session_jwt:s});n||s?(this._datalayer.writeSessionCookie(o),this._datalayer.removeISTCookie()):this._datalayer.removeSessionCookie()}},{key:"subscribeToState",value:function(r){return h1e(this._datalayer.subscriptions,r)}},{key:"getState",value:function(){return this._datalayer.state}},{key:"destroy",value:function(){window.removeEventListener("storage",this._listen)}},{key:"syncFromDeviceStorage",value:function(){return null}},{key:"getFromCache",value:function(){return this.fromCache}},{key:"setCacheRefreshed",value:function(){this.fromCache=!1}}]),t}(),y1e=function(t){fg(e,t);function e(){var r;return wn(this,e),r=ug(this,e,arguments),r.updateUser=function(n){return r.updateState({user:n})},r.getUser=function(){var n,s;return(s=(n=r.getState())===null||n===void 0?void 0:n.user)!==null&&s!==void 0?s:null},r.getSession=function(){var n,s;return(s=(n=r.getState())===null||n===void 0?void 0:n.session)!==null&&s!==void 0?s:null},r}return En(e)}(p1e),v1e=Symbol.for("stytch__internal_b2c"),m1e=function(e,r){Object.assign(e,fpe({},v1e,r))},g1e=function(t){fg(e,t);function e(r,n,s,i,o){wn(this,e);var a=s;return uj(r)&&(a=i),ug(this,e,[r,n,a,o])}return En(e)}(mj),x1e=En(function t(e,r){var n=this;wn(this,t),sye("StytchHeadlessClient"),nye(e);var s=r,i=n1e(s);this._dataLayer=d1e(e,s),this._subscriptionService=new y1e(e,this._dataLayer),this._stateChangeClient=new Uye(this._subscriptionService,{}),this.onStateChange=function(){var p;return(p=n._stateChangeClient).onStateChange.apply(p,arguments)};var o=function(){var y,g,m,x;return{stytch_user_id:(g=(y=n._dataLayer.state)===null||y===void 0?void 0:y.user)===null||g===void 0?void 0:g.user_id,stytch_session_id:(x=(m=n._dataLayer.state)===null||m===void 0?void 0:m.session)===null||x===void 0?void 0:x.session_id}},a=new lb(this._dataLayer,"passwords");this._networkClient=new mj(e,this._dataLayer,i.endpoints.sdkBackendURL,o),this._apiNetworkClient=new g1e(e,this._dataLayer,i.endpoints.liveAPIURL,i.endpoints.testAPIURL,o);var c=new Vye(e,this._networkClient,this._dataLayer),l=new zye(c.getAsync()),u=new uye(e,i.endpoints.dfpBackendURL,c.getAsync(),l.executeRecaptcha),f=new Hye(i.endpoints.clientsideServicesIframeURL),d=new Jye(e,f),h=new Bye(this._networkClient,u);this.user=new yye(this._networkClient,this._subscriptionService),this.session=new vye(this._networkClient,this._subscriptionService),this.magicLinks=new gye(this._networkClient,this._subscriptionService,new lb(this._dataLayer,"magic_links"),a,c.getAsync(),u),this.otps=new xye(this._networkClient,this._subscriptionService,l.executeRecaptcha,u),this.oauth=new Gye(this._networkClient,this._subscriptionService,new lb(this._dataLayer,"oauth"),c.getAsync(),{publicToken:e,testAPIURL:i.endpoints.testAPIURL,liveAPIURL:i.endpoints.liveAPIURL},d),this.cryptoWallets=new Eye(this._networkClient,this._apiNetworkClient,this._subscriptionService,l.executeRecaptcha,u,c.getAsync()),this.totps=new Sye(this._networkClient,this._subscriptionService,u),this.webauthn=new Mye(this._networkClient,this._subscriptionService,u),this.passwords=new Lye(this._networkClient,this._subscriptionService,a,c.getAsync(),u),this._sessionManager=new vj(this._subscriptionService,this.session),this._dataLayer.readSessionCookie().session_token&&this._sessionManager.performBackgroundRefresh(),this._networkClient.logEvent({name:"sdk_instance_instantiated",details:{event_callback_registered:!1,error_callback_registered:!1,success_callback_registered:!1}}),m1e(this,{bootstrap:c,clientsideServices:f,captcha:l,oneTap:d,searchManager:h,publicToken:e,dataLayer:this._dataLayer,networkClient:this._networkClient})});const b1e="public-token-test-b10ed486-70f4-44d3-8696-662052833e88";function w1e({children:t}){return k.jsx(Qhe,{stytch:new x1e(b1e),children:t})}const E1e="970987756660-35a6tc48hvi8cev9cnknp0iugv9poa23.apps.googleusercontent.com",K8="970987756660-6ibakd38eibf3cg9rq42hri7o0jn5va8.apps.googleusercontent.com",S1e="AQAAAAAAAEGv4rUgioUNUbcdNZlvOZE72JI",C1e="eyJwcm9qZWN0SWQiOjE2ODE1LCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI2N2V2NXVvc3ZxMzVmcGI2OXI3NnJoYnVoIiwicnBjU2VydmVyIjoiaHR0cHM6Ly93YWFzLnNlcXVlbmNlLmFwcCJ9",Q8="AQAAAAAAAAK2JvvZhWqZ51riasWBftkrVXE",Y8="eyJwcm9qZWN0SWQiOjY5NCwiZW1haWxSZWdpb24iOiJjYS1jZW50cmFsLTEiLCJlbWFpbENsaWVudElkIjoiNTRhdG41dXBpNjNxYzU5YTFlbTN2Ymhyc24iLCJycGNTZXJ2ZXIiOiJodHRwczovL2Rldi13YWFzLnNlcXVlbmNlLmFwcCJ9";new wD("https://nodes.sequence.app/polygon");const dg=new URLSearchParams(window.location.search),A1e=dg.get("env")??"prod";let wj=dg.get("projectAccessKey")??S1e,Ej=dg.get("waasConfigKey")??C1e,Sj=dg.get("googleClientId")??E1e;A1e==="dev"&&(console.log("Using dev environment"),console.log(`Project Access Key: ${Q8}`),console.log(`Waas Config Key: ${Y8}`),console.log(`Google Client ID: ${K8}`),wj=Q8,Ej=Y8,Sj=K8);const Oe=new Mhe({network:"polygon",projectAccessKey:wj,waasConfigKey:Ej}),oi=eee([{path:"/login",element:k.jsx(Jhe,{})},{path:"/",element:k.jsx(upe,{})}]);db.createRoot(document.getElementById("root")).render(k.jsx(cr.StrictMode,{children:k.jsx(JQ,{children:k.jsx(oX,{children:k.jsx(hee,{clientId:Sj,children:k.jsx(w1e,{children:k.jsx(lee,{router:oi})})})})})})); +See https://stytch.com/docs/oauth#guides_pkce for more information.`),c.next=7,this._networkClient.fetchSDK({url:"/oauth/authenticate",method:"POST",body:Object.assign({token:r,code_verifier:i==null?void 0:i.code_verifier},n),errorMessage:"Failed to authenticate token"});case 7:return o=c.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:o.session,user:Ys(o.__user)},session_token:o.session_token,session_jwt:o.session_jwt,intermediate_session_token:null}),c.abrupt("return",qt(o));case 11:case"end":return c.stop()}},s,this)}))}},{key:"getBaseApiUrl",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n,s;return Z().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this._dynamicConfig;case 2:if(n=o.sent,s=n.cnameDomain,!s){o.next=6;break}return o.abrupt("return","https://".concat(s));case 6:if(!uj(this._config.publicToken)){o.next=8;break}return o.abrupt("return",this._config.testAPIURL);case 8:return o.abrupt("return",this._config.liveAPIURL);case 9:case"end":return o.stop()}},r,this)}))}},{key:"startOAuthFlow",value:function(r){var n=this;return function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=s.login_redirect_url,o=s.signup_redirect_url,a=s.custom_scopes,c=s.provider_params;return be(n,void 0,void 0,Z().mark(function l(){var u,f,d,h,p,y,g;return Z().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,this._dynamicConfig;case 2:return u=x.sent,f=u.cnameDomain,d=u.pkceRequiredForOAuth,x.next=7,this.getBaseApiUrl();case 7:if(h=x.sent,this._networkClient.logEvent({name:"start_oauth_flow",details:{provider_type:r,custom_scopes:a,cname_domain:f,pkce:d,provider_params:c}}),p=new URL("".concat(h,"/v1/public/oauth/").concat(r,"/start")),p.searchParams.set("public_token",this._config.publicToken),!d){x.next=18;break}return x.next=14,this._pkceManager.startPKCETransaction();case 14:y=x.sent,p.searchParams.set("code_challenge",y.code_challenge),x.next=19;break;case 18:this._pkceManager.clearPKPair();case 19:if(a&&(Tt("startOAuthFlow").isStringArray("custom_scopes",a),p.searchParams.set("custom_scopes",a.join(" "))),c){Tt("startOAuthFlow").isOptionalObject("provider_params",c);for(g in c)p.searchParams.set("provider_"+g,c[g])}i&&p.searchParams.set("login_redirect_url",i),o&&p.searchParams.set("signup_redirect_url",o),window.location.href=p.toString();case 24:case"end":return x.stop()}},l,this)}))}}}]),t}(),Sye=Promise.resolve({siweRequiredForCryptoWallets:!1}),Cye=function(){function t(e,r,n){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)},i=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Sye;_r(this,t),this._networkClient=e,this._apiNetworkClient=r,this._subscriptionService=n,this.executeRecaptcha=s,this.dfpProtectedAuth=i,this._config=o}return Or(t,[{key:"authenticateStart",value:function(r){var n;return be(this,void 0,void 0,Z().mark(function s(){var i,o,a,c,l,u,f;return Z().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return Tt("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address",r.crypto_wallet_address).isString("crypto_wallet_type",r.crypto_wallet_type),r.siwe_params&&Tt("stytch.cryptoWallets.authenticateStart").isOptionalString("uri",r.siwe_params.uri).isOptionalString("chain_id",r.siwe_params.chain_id).isOptionalString("issued_at",r.siwe_params.issued_at).isOptionalString("statement",r.siwe_params.statement).isOptionalString("not_before",r.siwe_params.not_before).isOptionalString("message_request_id",r.siwe_params.message_request_id).isOptionalStringArray("resources",r.siwe_params.resources),i=!!this._subscriptionService.getSession(),h.next=5,this.executeRecaptcha();case 5:return o=h.sent,h.next=8,this._config;case 8:return a=h.sent,c=a.siweRequiredForCryptoWallets,l={crypto_wallet_address:r.crypto_wallet_address,crypto_wallet_type:r.crypto_wallet_type},c&&r.crypto_wallet_type=="ethereum"&&(l.siwe_params=Object.assign(Object.assign({},r.siwe_params),{uri:((n=r.siwe_params)===null||n===void 0?void 0:n.uri)||window.location.origin})),u=i?"/crypto_wallets/authenticate/start/secondary":"/crypto_wallets/authenticate/start/primary",f=Object.assign(Object.assign({},l),{captcha_token:o}),h.abrupt("return",this._apiNetworkClient.fetchSDK({url:u,method:"POST",errorMessage:"Failed to start wallet authentication.",body:f}));case 15:case"end":return h.stop()}},s,this)}))}},{key:"authenticate",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.cryptoWallets.authenticate").isString("signature",r.signature).isString("crypto_wallet_address",r.crypto_wallet_address).isString("crypto_wallet_type",r.crypto_wallet_type).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._apiNetworkClient.retriableFetchSDK({url:"/crypto_wallets/authenticate",method:"POST",errorMessage:"Failed to authenticate.",body:{session_duration_minutes:r.session_duration_minutes,crypto_wallet_address:r.crypto_wallet_address,crypto_wallet_type:r.crypto_wallet_type,signature:r.signature,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:Ys(a.__user)},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}}]),t}(),Aye=function(){function t(e,r,n){_r(this,t),this._networkClient=e,this._subscriptionService=r,this.dfpProtectedAuth=n}return Or(t,[{key:"create",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s;return Z().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return Tt("stytch.totps.create").isNumber("expiration_minutes",r.expiration_minutes),o.next=3,this._networkClient.fetchSDK({url:"/totps",method:"POST",errorMessage:"Failed to create TOTP",body:{expiration_minutes:r.expiration_minutes}});case 3:return s=o.sent,this._subscriptionService.updateUser(s.__user),o.abrupt("return",qt(s));case 6:case"end":return o.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.totps.authenticate").isNumber("session_duration_minutes",r.session_duration_minutes).isString("totp_code",r.totp_code),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/totps/authenticate",method:"POST",errorMessage:"Failed to authenticate TOTP",body:{session_duration_minutes:r.session_duration_minutes,totp_code:r.totp_code,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.__user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"recoveryCodes",value:function(){return be(this,void 0,void 0,Z().mark(function r(){return Z().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",this._networkClient.fetchSDK({url:"/totps/recovery_codes",method:"POST",errorMessage:"Failed to retrieve recovery codes"}));case 1:case"end":return s.stop()}},r,this)}))}},{key:"recover",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.totps.recover").isNumber("session_duration_minutes",r.session_duration_minutes).isString("recovery_code",r.recovery_code),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/totps/recover",method:"POST",errorMessage:"Failed to recover TOTP",body:{session_duration_minutes:r.session_duration_minutes,recovery_code:r.recovery_code,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.__user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}}]),t}();function fj(t){for(var e="==".slice(0,(4-t.length%4)%4),r=t.replace(/-/g,"+").replace(/_/g,"/")+e,n=atob(r),s=new ArrayBuffer(n.length),i=new Uint8Array(s),o=0;o with `"webauthn"` in its `autocomplete` attribute was detected'),!1):!0}}return Or(t,[{key:"register",value:function(r){var n,s;return be(this,void 0,void 0,Z().mark(function i(){var o,a,c,l,u;return Z().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return Tt("stytch.webauthn.register").isOptionalString("domain",r==null?void 0:r.domain).isOptionalString("authenticator_type",r==null?void 0:r.authenticator_type).isOptionalBoolean("is_passkey",r==null?void 0:r.is_passkey).isOptionalNumber("session_duration_minutes",r==null?void 0:r.session_duration_minutes),d.next=3,this._networkClient.fetchSDK({url:"/webauthn/register/start",method:"POST",errorMessage:"Failed to start WebAuthn registration",body:{domain:(n=r==null?void 0:r.domain)!==null&&n!==void 0?n:window.location.hostname,authenticator_type:(s=r==null?void 0:r.authenticator_type)!==null&&s!==void 0?s:void 0,return_passkey_credential_options:r==null?void 0:r.is_passkey,user_agent:navigator.userAgent}});case 3:return o=d.sent,a=o.public_key_credential_creation_options,c=JSON.parse(a),d.next=8,_ye({publicKey:c});case 8:return l=d.sent,d.next=11,this._networkClient.fetchSDK({url:"/webauthn/register",method:"POST",errorMessage:"Failed to register WebAuthn device",body:{public_key_credential:JSON.stringify(l),session_duration_minutes:r==null?void 0:r.session_duration_minutes}});case 11:return u=d.sent,this._subscriptionService.updateStateAndTokens({state:{session:u.session,user:u.__user},session_token:u.session_token,session_jwt:u.session_jwt,intermediate_session_token:null}),d.abrupt("return",qt(u));case 14:case"end":return d.stop()}},i,this)}))}},{key:"authenticate",value:function(r){var n,s;return be(this,void 0,void 0,Z().mark(function i(){var o,a,c,l,u,f,d,h,p,y,g,m;return Z().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return Tt("stytch.webauthn.authenticate").isOptionalString("domain",r.domain).isNumber("session_duration_minutes",r.session_duration_minutes).isOptionalBoolean("is_passkey",r.is_passkey).isOptionalObject("signal",r.signal),b.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:if(o=b.sent,a=o.dfp_telemetry_id,c=o.captcha_token,!r.conditional_mediation){b.next=14;break}return b.next=9,this.browserSupportsAutofill();case 9:if(b.sent){b.next=12;break}return console.error("Browser does not support WebAuthn autofill"),b.abrupt("return",null);case 12:if(this.checkEligibleInputs()){b.next=14;break}return b.abrupt("return",null);case 14:return l=!!this._subscriptionService.getSession(),u=l?"/webauthn/authenticate/start/secondary":"/webauthn/authenticate/start/primary",b.next=18,this._networkClient.fetchSDK({url:u,method:"POST",errorMessage:"Failed to start WebAuthn authentication",body:{domain:(n=r.domain)!==null&&n!==void 0?n:window.location.hostname,return_passkey_credential_options:r==null?void 0:r.is_passkey}});case 18:return f=b.sent,d=f.public_key_credential_request_options,h=new AbortController,p={publicKey:JSON.parse(d),signal:(s=r.signal)!==null&&s!==void 0?s:h.signal},y=Object.assign(Object.assign({},p),{mediation:"conditional"}),b.next=25,Dye(r.conditional_mediation?y:p);case 25:return g=b.sent,b.next=28,this._networkClient.retriableFetchSDK({url:"/webauthn/authenticate",method:"POST",errorMessage:"Failed to authenticate WebAuthn device",body:{public_key_credential:JSON.stringify(g),session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:a,captcha_token:c},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 28:return m=b.sent,this._subscriptionService.updateStateAndTokens({state:{session:m.session,user:m.__user},session_token:m.session_token,session_jwt:m.session_jwt,intermediate_session_token:null}),b.abrupt("return",qt(m));case 31:case"end":return b.stop()}},i,this)}))}},{key:"update",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s;return Z().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return s="/webauthn/update/"+r.webauthn_registration_id,o.next=3,this._networkClient.fetchSDK({url:s,method:"PUT",errorMessage:"Failed to update WebAuthn Registration",body:{name:r.name}});case 3:return o.abrupt("return",o.sent);case 4:case"end":return o.stop()}},n,this)}))}},{key:"browserSupportsAutofill",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n;return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(n=window.PublicKeyCredential,!(n===void 0||n.isConditionalMediationAvailable===void 0)){i.next=3;break}return i.abrupt("return",new Promise(function(o){return o(!1)}));case 3:return i.abrupt("return",n.isConditionalMediationAvailable());case 4:case"end":return i.stop()}},r)}))}}]),t}(),jye=Promise.resolve({pkceRequiredForPasswordResets:!1}),Bye=function(){function t(e,r,n){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:jye,i=arguments.length>4?arguments[4]:void 0;_r(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._config=s,this.dfpProtectedAuth=i}return Or(t,[{key:"getCodeChallenge",value:function(){return be(this,void 0,void 0,Z().mark(function r(){var n,s,i;return Z().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this._config;case 2:if(n=a.sent,s=n.pkceRequiredForPasswordResets,s){a.next=6;break}return a.abrupt("return",void 0);case 6:return a.next=8,this._pkceManager.getPKPair();case 8:if(i=a.sent,!i){a.next=11;break}return a.abrupt("return",i.code_challenge);case 11:return a.next=13,this._pkceManager.startPKCETransaction();case 13:return i=a.sent,a.abrupt("return",i.code_challenge);case 15:case"end":return a.stop()}},r,this)}))}},{key:"create",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.create").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords",method:"POST",errorMessage:"Failed to create password.",body:{email:r.email,password:r.password,session_duration_minutes:r.session_duration_minutes,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.authenticate").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords/authenticate",method:"POST",errorMessage:"Failed to authenticate password.",body:{email:r.email,password:r.password,session_duration_minutes:r.session_duration_minutes,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"resetByEmailStart",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.resetByEmailStart").isString("email",r.email).isOptionalString("login_redirect_url",r.login_redirect_url).isOptionalString("reset_password_redirect_url",r.reset_password_redirect_url).isOptionalString("reset_password_template_id",r.reset_password_template_id).isOptionalNumber("reset_password_expiration_minutes",r.reset_password_expiration_minutes),l.next=3,this.getCodeChallenge();case 3:return s=l.sent,l.next=6,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 6:return i=l.sent,o=i.dfp_telemetry_id,a=i.captcha_token,l.abrupt("return",this._networkClient.retriableFetchSDK({url:"/passwords/email/reset/start",method:"POST",errorMessage:"Failed to start password reset flow.",body:{email:r.email,login_redirect_url:r.login_redirect_url,reset_password_redirect_url:r.reset_password_redirect_url,reset_password_expiration_minutes:r.reset_password_expiration_minutes,reset_password_template_id:r.reset_password_template_id,code_challenge:s,captcha_token:a,dfp_telemetry_id:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 10:case"end":return l.stop()}},n,this)}))}},{key:"resetByEmail",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a,c,l;return Z().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return Tt("stytch.passwords.resetByEmail").isString("token",r.token).isString("password",r.password).isNumber("session_duration_minutes",r.session_duration_minutes),f.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=f.sent,i=s.dfp_telemetry_id,o=s.captcha_token,f.next=8,this._pkceManager.getPKPair();case 8:return a=f.sent,c=a==null?void 0:a.code_verifier,f.next=12,this._networkClient.retriableFetchSDK({url:"/passwords/email/reset",method:"POST",errorMessage:"Failed to reset password.",body:{token:r.token,password:r.password,session_duration_minutes:r.session_duration_minutes,captcha_token:o,code_verifier:c,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 12:return l=f.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:l.session,user:l.user},session_token:l.session_token,session_jwt:l.session_jwt,intermediate_session_token:null}),f.abrupt("return",qt(l));case 16:case"end":return f.stop()}},n,this)}))}},{key:"resetByExistingPassword",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.resetByExistingPassword").isString("email",r.email).isString("existing_password",r.existing_password).isString("new_password",r.new_password).isNumber("session_duration_minutes",r.session_duration_minutes),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords/existing_password/reset",method:"POST",errorMessage:"Failed to reset password.",body:{email:r.email,existing_password:r.existing_password,new_password:r.new_password,session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:i,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",qt(a));case 11:case"end":return l.stop()}},n,this)}))}},{key:"resetBySession",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){var s,i,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Tt("stytch.passwords.resetBySession").isString("password",r.password),l.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return s=l.sent,i=s.dfp_telemetry_id,o=s.captcha_token,l.next=8,this._networkClient.retriableFetchSDK({url:"/passwords/session/reset",method:"POST",errorMessage:"Failed to reset by session.",body:{password:r.password,session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:i,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=l.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:a.user},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),l.abrupt("return",a);case 11:case"end":return l.stop()}},n,this)}))}},{key:"strengthCheck",value:function(r){return be(this,void 0,void 0,Z().mark(function n(){return Z().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return Tt("stytch.passwords.strengthCheck").isOptionalString("email",r.email).isString("password",r.password),i.abrupt("return",this._networkClient.fetchSDK({url:"/passwords/strength_check",method:"POST",errorMessage:"Failed to check password strength.",body:{email:r.email,password:r.password}}));case 2:case"end":return i.stop()}},n,this)}))}}]),t}();Promise.resolve({pkceRequiredForEmailMagicLinks:!1});Promise.resolve({pkceRequiredForPasswordResets:!1});var Fye=function(){function t(e){_r(this,t),this.iframeURL=e,this.createIframe()}return Or(t,[{key:"createIframe",value:function(){var r=document.querySelector('[src~="'.concat(this.iframeURL,'"]'));if(r?xi.warn("It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function."):(r=document.createElement("iframe"),r.src=this.iframeURL,r.style.position="absolute",r.style.width="0",r.style.height="0",r.style.border="0",document.body.appendChild(r)),r.dataset.loaded==="true"){this.frame=Promise.resolve(r);return}this.frame=new Promise(function(n){r.addEventListener("load",function(){r.dataset.loaded="true",n(r)},{once:!0})})}},{key:"call",value:function(r,n){return be(this,void 0,void 0,Z().mark(function s(){var i=this,o,a;return Z().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this.frame;case 2:return o=l.sent,a=new MessageChannel,l.abrupt("return",new Promise(function(u,f){var d;a.port1.onmessage=function(p){var y=p.data;a.port1.close(),y.success?u(y.payload):f(hye.unmarshall(y.error))};var h={method:r,args:n};(d=o.contentWindow)===null||d===void 0||d.postMessage(h,i.iframeURL,[a.port2])}));case 5:case"end":return l.stop()}},s,this)}))}}]),t}(),Uye=function(){function t(e,r){_r(this,t),this._networkClient=e,this.dfpProtectedAuth=r}return Or(t,[{key:"searchUser",value:function(r){var n=this;return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function(s){var i=s.dfp_telemetry_id,o=s.captcha_token;return n._networkClient.fetchSDK({url:"/users/search",method:"POST",body:{email:r,dfp_telemetry_id:i,captcha_token:o},errorMessage:"Error searching for user ".concat(r)})})}},{key:"searchMember",value:function(r,n){return this._networkClient.fetchSDK({url:"/b2b/organizations/members/search",method:"POST",body:{email_address:r,organization_id:n},errorMessage:"Error searching for member ".concat(r)})}}]),t}(),Vye=function(e){return!!(e!=null&&e.session)},vj=function(){function t(e,r){var n=this;_r(this,t),this._subscriptionService=e,this._headlessSessionClient=r,this._onDataChange=function(s){Vye(s)?n.scheduleBackgroundRefresh():n.cancelBackgroundRefresh()},this._reauthenticateWithBackoff=function(){return be(n,void 0,void 0,Z().mark(function s(){var i;return Z().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:i=0;case 1:return a.prev=2,a.next=5,this._headlessSessionClient.authenticate();case 5:return a.abrupt("return",a.sent);case 8:if(a.prev=8,a.t0=a.catch(2),!t.isUnrecoverableError(a.t0)){a.next=12;break}return a.abrupt("return",Promise.reject(a.t0));case 12:return i++,a.next=15,new Promise(function(c){return setTimeout(c,t.timeoutForAttempt(i))});case 15:a.next=1;break;case 17:case"end":return a.stop()}},s,this,[[2,8]])}))},this.timeout=null,this._subscriptionService.subscribeToState(this._onDataChange)}return Or(t,[{key:"performBackgroundRefresh",value:function(){var r=this;this._reauthenticateWithBackoff().then(function(){r.scheduleBackgroundRefresh()}).catch(function(n){xi.warn("Session background refresh failed. Signalling to app that user is logged out.",{error:n}),r._subscriptionService.destroySession()})}},{key:"scheduleBackgroundRefresh",value:function(){var r=this;this.cancelBackgroundRefresh(),this.timeout=setTimeout(function(){r.performBackgroundRefresh()},t.REFRESH_INTERVAL_MS)}},{key:"cancelBackgroundRefresh",value:function(){this.timeout!==null&&(clearTimeout(this.timeout),this.timeout=null)}}],[{key:"timeoutForAttempt",value:function(r){r=Math.min(r,7);var n=Math.floor(Math.random()*350)-175,s=2e3*Math.pow(2,r);return n+s}},{key:"isUnrecoverableError",value:function(r){return W2.includes(r.error_type)}}]),t}();vj.REFRESH_INTERVAL_MS=1e3*60*3;var $ye=Or(function t(e,r){var n=this;_r(this,t),this._subscriptionService=e,this.emptyState=r,this.onStateChange=function(s){return n._subscriptionService.subscribeToState(function(i){s(i??n.emptyState)})}}),G8="bootstrap",cb=function(){return{displayWatermark:!1,cnameDomain:null,emailDomains:["stytch.com"],captchaSettings:{enabled:!1},pkceRequiredForEmailMagicLinks:!1,pkceRequiredForPasswordResets:!1,pkceRequiredForOAuth:!1,pkceRequiredForSso:!1,slugPattern:null,createOrganizationEnabled:!1,passwordConfig:null,runDFPProtectedAuth:!1,rbacPolicy:null,siweRequiredForCryptoWallets:!1}},zye=function(){function t(e,r,n){var s=this;wn(this,t),this._publicToken=e,this._networkClient=r,this._dataLayer=n,this._bootstrapDataPromise=this._networkClient.fetchSDK({url:"/projects/bootstrap/".concat(this._publicToken),method:"GET",errorMessage:"Error fetching bootstrap data for SDK for ".concat(this._publicToken)}).then(t.mapBootstrapData).then(function(i){return s._dataLayer.setItem(G8,JSON.stringify(i)),i}).catch(function(i){return xi.error(i),cb()})}return En(t,[{key:"getSync",value:function(){var r=this._dataLayer.getItem(G8);if(r===null)return cb();try{return JSON.parse(r)}catch{return cb()}}},{key:"getAsync",value:function(){return this._bootstrapDataPromise}}],[{key:"mapBootstrapData",value:function(r){var n,s,i=r.password_config!==null?{ludsComplexity:r.password_config.luds_complexity,ludsMinimumCount:r.password_config.luds_minimum_count}:null;return{displayWatermark:!r.disable_sdk_watermark,captchaSettings:r.captcha_settings,cnameDomain:r.cname_domain,emailDomains:r.email_domains,pkceRequiredForEmailMagicLinks:r.pkce_required_for_email_magic_links,pkceRequiredForPasswordResets:r.pkce_required_for_password_resets,pkceRequiredForOAuth:r.pkce_required_for_oauth,pkceRequiredForSso:r.pkce_required_for_sso,slugPattern:r.slug_pattern,createOrganizationEnabled:r.create_organization_enabled,passwordConfig:i,runDFPProtectedAuth:(n=r.dfp_protected_auth_enabled)!==null&&n!==void 0?n:!1,dfpProtectedAuthMode:r.dfp_protected_auth_mode,rbacPolicy:(s=r.rbac_policy)!==null&&s!==void 0?s:null,siweRequiredForCryptoWallets:r.siwe_required_for_crypto_wallets}}}]),t}();function js(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{l(n.next(u))}catch(f){o(f)}}function c(u){try{l(n.throw(u))}catch(f){o(f)}}function l(u){u.done?i(u.value):s(u.value).then(a,c)}l((n=n.apply(t,e||[])).next())})}var Hye=function(e){return Ok("https://www.google.com/recaptcha/enterprise.js?render=".concat(e),function(){return window.grecaptcha.enterprise})},Gye=En(function t(e){var r=this;wn(this,t),this.bootstrapPromise=e,this.executeRecaptcha=function(){return js(r,void 0,void 0,Rt().mark(function n(){var s,i,o,a;return Rt().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this.state;case 2:if(s=l.sent,i=s.captchaClient,o=s.configured,a=s.siteKey,o){l.next=8;break}return l.abrupt("return",void 0);case 8:return l.next=10,new Promise(function(u){return i.ready(u)});case 10:return l.abrupt("return",i.execute(a,{action:"LOGIN"}));case 11:case"end":return l.stop()}},n,this)}))},this.state=e.then(function(n){return js(r,void 0,void 0,Rt().mark(function s(){return Rt().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(n.captchaSettings.enabled){o.next=2;break}return o.abrupt("return",{configured:!1});case 2:return o.next=4,Hye(n.captchaSettings.siteKey);case 4:return o.t0=o.sent,o.t1=n.captchaSettings.siteKey,o.abrupt("return",{configured:!0,captchaClient:o.t0,siteKey:o.t1});case 7:case"end":return o.stop()}},s)}))})}),qye=function(){function t(e){var r=this;wn(this,t),this.iframeURL=e,this.oneTapStart=function(n){return r.call("oneTapStart",n)},this.oneTapSubmit=function(n){return r.call("oneTapSubmit",n)},this.parsedPhoneNumber=function(n){return r.call("parsedPhoneNumber",n)}}return En(t,[{key:"frameClient",get:function(){var r;return this._frameClient=(r=this._frameClient)!==null&&r!==void 0?r:new Fye(this.iframeURL),this._frameClient}},{key:"call",value:function(r,n){return this.frameClient.call(r,[n])}}]),t}(),Wye=function(t){fg(e,t);function e(r,n,s,i,o,a){var c;return wn(this,e),c=ug(this,e,[r,n,s,i,o]),c._oneTap=a,c.startOneTap=function(l){return js(tj(c),void 0,void 0,Rt().mark(function u(){var f,d,h;return Rt().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,this._oneTap.createOneTapClient();case 2:if(f=y.sent,f.success){y.next=5;break}throw new Error("One Tap could not load: ".concat(f.reason));case 5:return d=f.client,h=this._oneTap.createOnSuccessHandler({signupRedirectUrl:l.signup_redirect_url,loginRedirectUrl:l.login_redirect_url,onSuccess:this._oneTap.RedirectOnSuccess}),y.abrupt("return",d.render({style:{position:Ac.floating},onOneTapCancelled:l.onOneTapCancelled,callback:h}));case 8:case"end":return y.stop()}},u,this)}))},c.googleOneTap={start:c.startOneTap},c}return En(e)}(Eye),Kye="4.18.2",mj=function(){function t(e,r,n,s){wn(this,t),this._publicToken=e,this._subscriptionDataLayer=r,this.baseURL=n,this.additionalTelemetryDataFn=s,this.updateSessionToken=function(){return null},this.eventLogger=new vye({maxBatchSize:pye,intervalDurationMs:yye,logEventURL:this.buildSDKUrl("/events")})}return En(t,[{key:"logEvent",value:function(r){var n=r.name,s=r.details,i=r.error,o=i===void 0?{}:i;this.eventLogger.logEvent(this.createTelemetryBlob(),{public_token:this._publicToken,event_name:n,details:s,error_code:o.error_code,error_description:o.error_description,http_status_code:o.http_status_code})}},{key:"createTelemetryBlob",value:function(){return Object.assign(Object.assign({event_id:cye(),app_session_id:lye(),persistent_id:uye(),client_sent_at:new Date().toISOString(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},this.additionalTelemetryDataFn()),{app:{identifier:window.location.hostname},sdk:{identifier:"Stytch.js Javascript SDK",version:Kye}})}},{key:"fetchSDK",value:function(r){var n=r.url,s=r.body,i=r.errorMessage,o=r.method;return js(this,void 0,void 0,Rt().mark(function a(){var c,l,u,f;return Rt().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return c=this._subscriptionDataLayer.readSessionCookie().session_token,l="Basic "+window.btoa(this._publicToken+":"+(c||this._publicToken)),u=window.btoa(JSON.stringify(this.createTelemetryBlob())),f=window.location.origin,h.abrupt("return",Q2({basicAuthHeader:l,body:s,errorMessage:i,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:u,xSDKParentHostHeader:f}));case 5:case"end":return h.stop()}},a,this)}))}},{key:"retriableFetchSDK",value:function(r){var n=r.url,s=r.body,i=r.errorMessage,o=r.method,a=r.retryCallback;return js(this,void 0,void 0,Rt().mark(function c(){var l,u,f,d;return Rt().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return l=this._subscriptionDataLayer.readSessionCookie().session_token,u="Basic "+window.btoa(this._publicToken+":"+(l||this._publicToken)),f=window.btoa(JSON.stringify(this.createTelemetryBlob())),d=window.location.origin,p.abrupt("return",Kpe({basicAuthHeader:u,body:s,errorMessage:i,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:f,xSDKParentHostHeader:d,retryCallback:a}));case 5:case"end":return p.stop()}},c,this)}))}},{key:"buildSDKUrl",value:function(r){return"".concat(this.baseURL,"/sdk/v1").concat(r)}}]),t}(),Qye=typeof window<"u"&&"IdentityCredential"in window,gj=function(e){return e===Ac.forceLegacyEmbedded?"force":e===Ac.embeddedOnly||e===Ac.embedded||e===Ac.floatingOrEmbedded},Yye=function(e){var r=gj(e);return r==="force"||r&&!Qye},Jye=function(){function t(e,r){wn(this,t),this._googleClient=e,this._clientId=r}return En(t,[{key:"cancel",value:function(){this._googleClient.cancel()}},{key:"render",value:function(r){var n=r.callback,s=r.onOneTapCancelled,i=r.style;return js(this,void 0,void 0,Rt().mark(function o(){var a=this,c,l,u;return Rt().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return c=gj(i.position),l=Yye(i.position),u={client_id:this._clientId,callback:n,auto_select:!1,context:"use",itp_support:!0,use_fedcm_for_prompt:c!=="force"},l&&(u.prompt_parent_id="google-parent-prompt",u.cancel_on_tap_outside=!1),this._googleClient.initialize(u),d.abrupt("return",new Promise(function(h){a._googleClient.prompt(function(p){var y,g,m,x,b;if(p.isSkippedMoment()){var w=(g=(y=p.getSkippedReason)===null||y===void 0?void 0:y.call(p))!==null&&g!==void 0?g:"unknown_reason";return w==="user_cancel"&&(s==null||s()),h({success:!1,reason:w})}if(!p.isNotDisplayed&&l||!((m=p.isNotDisplayed)===null||m===void 0)&&m.call(p))return h({success:!1,reason:(b=(x=p.getNotDisplayedReason)===null||x===void 0?void 0:x.call(p))!==null&&b!==void 0?b:"unknown_reason"});if(!p.isDismissedMoment())return a.styleFrame(l),h({success:!0})})}));case 6:case"end":return d.stop()}},o,this)}))}},{key:"styleFrame",value:function(r){r&&Array.from(document.getElementsByTagName("iframe")).forEach(function(n){n.src.includes(aj)&&(n.style.width="100%")})}}]),t}(),Xye=function(){return Ok(Wpe,function(){return window.google.accounts.id})},Zye=function(){function t(e,r){var n=this;wn(this,t),this._publicToken=e,this.clientsideServices=r,this.createOnSuccessHandler=function(s){var i=s.loginRedirectUrl,o=s.signupRedirectUrl,a=s.onSuccess;return function(c){return js(n,void 0,void 0,Rt().mark(function l(){var u,f,d;return Rt().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return u=c.credential,p.next=3,this.submitGoogleOneTapToken({credential:u,loginRedirectUrl:i,signupRedirectUrl:o});case 3:f=p.sent,d=f.redirect_url,a(d);case 6:case"end":return p.stop()}},l,this)}))}},this.RedirectOnSuccess=function(s){window.location.href=s}}return En(t,[{key:"createOneTapClient",value:function(){return js(this,void 0,void 0,Rt().mark(function r(){var n,s,i,o;return Rt().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.prev=0,c.next=3,this.fetchGoogleStart();case 3:s=c.sent,n=s.googleClientId,c.next=11;break;case 7:return c.prev=7,c.t0=c.catch(0),i=c.t0,c.abrupt("return",{success:!1,reason:i.error_type});case 11:if(n!==""){c.next=13;break}return c.abrupt("return",{success:!1,reason:"oauth_config_not_found"});case 13:return c.t1=Jye,c.next=16,Xye();case 16:return c.t2=c.sent,c.t3=n,o=new c.t1(c.t2,c.t3),c.abrupt("return",{success:!0,client:o});case 20:case"end":return c.stop()}},r,this,[[0,7]])}))}},{key:"fetchGoogleStart",value:function(){return this.googleConfig?this.googleConfig:(this.googleConfig=this.clientsideServices.oneTapStart({publicToken:this._publicToken}),this.googleConfig)}},{key:"submitGoogleOneTapToken",value:function(r){var n=r.credential,s=r.loginRedirectUrl,i=r.signupRedirectUrl;return js(this,void 0,void 0,Rt().mark(function o(){var a,c;return Rt().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.fetchGoogleStart();case 2:return a=u.sent,c=a.oauthCallbackId,u.abrupt("return",this.clientsideServices.oneTapSubmit({publicToken:this._publicToken,idToken:n,loginRedirectURL:s,oauthCallbackID:c,signupRedirectURL:i}));case 5:case"end":return u.stop()}},o,this)}))}}],[{key:"WillGoogleOneTapShowBannerForUA",value:function(r){var n=function(a,c){return a.indexOf(c)!==-1},s=n(r,"iPad")||n(r,"Android")&&!n(r,"Mobile")||n(r,"Silk"),i=n(r,"iPod")||n(r,"iPhone")||n(r,"Android")||n(r,"IEMobile");return!s&&i}},{key:"WillGoogleOneTapShowEmbedded",value:function(){return!t.WillGoogleOneTapShowBannerForUA(navigator.userAgent)}}]),t}(),e1e="PKCE_VERIFIER";function t1e(t){var e=t.toString(16);return e.length===1&&(e="0"+e),e}function r1e(t){var e;return btoa((e=String.fromCharCode).call.apply(e,[null].concat(mpe(new Uint8Array(t))))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var lb=function(){function t(e,r){wn(this,t),this._dataLayer=e,this.namespace=r}return En(t,[{key:"key",value:function(){return e1e+":"+this.namespace}},{key:"startPKCETransaction",value:function(){return js(this,void 0,void 0,Rt().mark(function r(){var n;return Rt().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.createProofkeyPair();case 2:return n=i.sent,this._dataLayer.setItem(this.key(),JSON.stringify(n)),i.abrupt("return",n);case 5:case"end":return i.stop()}},r,this)}))}},{key:"getPKPair",value:function(){var r=this._dataLayer.getItem(this.key());if(r!==null)try{return JSON.parse(r)}catch{xi.warn("Found malformed Proof Key pair in localstorage.");return}}},{key:"clearPKPair",value:function(){return this._dataLayer.removeItem(this.key())}}],[{key:"createProofkeyPair",value:function(){return js(this,void 0,void 0,Rt().mark(function r(){var n,s,i;return Rt().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return n=new Uint32Array(16),window.crypto.getRandomValues(n),s=Array.from(n).map(t1e).join(""),a.next=5,window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(s));case 5:return i=a.sent,a.abrupt("return",{code_challenge:r1e(i),code_verifier:s});case 7:case"end":return a.stop()}},r)}))}}]),t}(),n1e=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.KEYS_TO_EXCLUDE,n=r===void 0?[]:r,s=function i(o,a){return Ls(o)!==Ls(a)?!1:o===null||a===null?o===a:Ls(o)==="object"?Object.keys(o).length!==Object.keys(a).length||Object.keys(o).some(function(c){return!(c in a)})?!1:Object.entries(o).filter(function(c){var l=z2(c,1),u=l[0];return!n.includes(u)}).every(function(c){var l=z2(c,2),u=l[0],f=l[1];return i(f,a[u])}):o===a};return s},s1e=function(){return!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))},i1e=function(e){var r,n,s,i,o,a,c,l;return{cookieOptions:e==null?void 0:e.cookieOptions,endpoints:{sdkBackendURL:(n=(r=e==null?void 0:e.endpoints)===null||r===void 0?void 0:r.sdkBackendURL)!==null&&n!==void 0?n:Hpe,testAPIURL:(i=(s=e==null?void 0:e.endpoints)===null||s===void 0?void 0:s.testAPIURL)!==null&&i!==void 0?i:Vpe,liveAPIURL:(a=(o=e==null?void 0:e.endpoints)===null||o===void 0?void 0:o.liveAPIURL)!==null&&a!==void 0?a:$pe,dfpBackendURL:aye(e),clientsideServicesIframeURL:(l=(c=e==null?void 0:e.endpoints)===null||c===void 0?void 0:c.clientsideServicesIframeURL)!==null&&l!==void 0?l:zpe}}},_1=function(e){var r=document.cookie?document.cookie.split("; "):[],n=r.filter(function(s){var i=s.split("="),o=z2(i,1),a=o[0];return e===a});return n.length>1},o1e="stytch_sdk_state_",_i=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"".concat(o1e).concat(e).concat(r?"::".concat(r):"")};/*! js-cookie v3.0.1 | MIT */function N1(t){for(var e=1;e"u")){o=N1({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var c in o)o[c]&&(a+="; "+c,o[c]!==!0&&(a+="="+o[c].split(";")[0]));return document.cookie=s+"="+t.write(i,s)+a}}function n(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],o={},a=0;a1&&arguments[1]!==void 0?arguments[1]:!1,s=this._datalayer.state,i=r===null?null:Object.assign(Object.assign({},this._datalayer.state),r);this._datalayer.state=i;var o=this.getFromCache();this.setCacheRefreshed();var a=!W8(s,i);(o||a)&&(q8(this._datalayer.subscriptions,i),a&&!n&&this._datalayer.syncToLocalStorage())}},{key:"updateTokens",value:function(r){var n=r.session_token,s=r.session_jwt,i=this._datalayer.readSessionCookie(),o=Object.assign(Object.assign({},i),{session_token:n,session_jwt:s});n||s?(this._datalayer.writeSessionCookie(o),this._datalayer.removeISTCookie()):this._datalayer.removeSessionCookie()}},{key:"subscribeToState",value:function(r){return y1e(this._datalayer.subscriptions,r)}},{key:"getState",value:function(){return this._datalayer.state}},{key:"destroy",value:function(){window.removeEventListener("storage",this._listen)}},{key:"syncFromDeviceStorage",value:function(){return null}},{key:"getFromCache",value:function(){return this.fromCache}},{key:"setCacheRefreshed",value:function(){this.fromCache=!1}}]),t}(),m1e=function(t){fg(e,t);function e(){var r;return wn(this,e),r=ug(this,e,arguments),r.updateUser=function(n){return r.updateState({user:n})},r.getUser=function(){var n,s;return(s=(n=r.getState())===null||n===void 0?void 0:n.user)!==null&&s!==void 0?s:null},r.getSession=function(){var n,s;return(s=(n=r.getState())===null||n===void 0?void 0:n.session)!==null&&s!==void 0?s:null},r}return En(e)}(v1e),g1e=Symbol.for("stytch__internal_b2c"),x1e=function(e,r){Object.assign(e,hpe({},g1e,r))},b1e=function(t){fg(e,t);function e(r,n,s,i,o){wn(this,e);var a=s;return uj(r)&&(a=i),ug(this,e,[r,n,a,o])}return En(e)}(mj),w1e=En(function t(e,r){var n=this;wn(this,t),oye("StytchHeadlessClient"),iye(e);var s=r,i=i1e(s);this._dataLayer=p1e(e,s),this._subscriptionService=new m1e(e,this._dataLayer),this._stateChangeClient=new $ye(this._subscriptionService,{}),this.onStateChange=function(){var p;return(p=n._stateChangeClient).onStateChange.apply(p,arguments)};var o=function(){var y,g,m,x;return{stytch_user_id:(g=(y=n._dataLayer.state)===null||y===void 0?void 0:y.user)===null||g===void 0?void 0:g.user_id,stytch_session_id:(x=(m=n._dataLayer.state)===null||m===void 0?void 0:m.session)===null||x===void 0?void 0:x.session_id}},a=new lb(this._dataLayer,"passwords");this._networkClient=new mj(e,this._dataLayer,i.endpoints.sdkBackendURL,o),this._apiNetworkClient=new b1e(e,this._dataLayer,i.endpoints.liveAPIURL,i.endpoints.testAPIURL,o);var c=new zye(e,this._networkClient,this._dataLayer),l=new Gye(c.getAsync()),u=new dye(e,i.endpoints.dfpBackendURL,c.getAsync(),l.executeRecaptcha),f=new qye(i.endpoints.clientsideServicesIframeURL),d=new Zye(e,f),h=new Uye(this._networkClient,u);this.user=new mye(this._networkClient,this._subscriptionService),this.session=new gye(this._networkClient,this._subscriptionService),this.magicLinks=new bye(this._networkClient,this._subscriptionService,new lb(this._dataLayer,"magic_links"),a,c.getAsync(),u),this.otps=new wye(this._networkClient,this._subscriptionService,l.executeRecaptcha,u),this.oauth=new Wye(this._networkClient,this._subscriptionService,new lb(this._dataLayer,"oauth"),c.getAsync(),{publicToken:e,testAPIURL:i.endpoints.testAPIURL,liveAPIURL:i.endpoints.liveAPIURL},d),this.cryptoWallets=new Cye(this._networkClient,this._apiNetworkClient,this._subscriptionService,l.executeRecaptcha,u,c.getAsync()),this.totps=new Aye(this._networkClient,this._subscriptionService,u),this.webauthn=new Lye(this._networkClient,this._subscriptionService,u),this.passwords=new Bye(this._networkClient,this._subscriptionService,a,c.getAsync(),u),this._sessionManager=new vj(this._subscriptionService,this.session),this._dataLayer.readSessionCookie().session_token&&this._sessionManager.performBackgroundRefresh(),this._networkClient.logEvent({name:"sdk_instance_instantiated",details:{event_callback_registered:!1,error_callback_registered:!1,success_callback_registered:!1}}),x1e(this,{bootstrap:c,clientsideServices:f,captcha:l,oneTap:d,searchManager:h,publicToken:e,dataLayer:this._dataLayer,networkClient:this._networkClient})});const E1e="public-token-test-b10ed486-70f4-44d3-8696-662052833e88";function S1e({children:t}){return k.jsx(Jhe,{stytch:new w1e(E1e),children:t})}const C1e="970987756660-35a6tc48hvi8cev9cnknp0iugv9poa23.apps.googleusercontent.com",K8="970987756660-6ibakd38eibf3cg9rq42hri7o0jn5va8.apps.googleusercontent.com",A1e="AQAAAAAAAEGv4rUgioUNUbcdNZlvOZE72JI",k1e="eyJwcm9qZWN0SWQiOjE2ODE1LCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI2N2V2NXVvc3ZxMzVmcGI2OXI3NnJoYnVoIiwicnBjU2VydmVyIjoiaHR0cHM6Ly93YWFzLnNlcXVlbmNlLmFwcCJ9",Q8="AQAAAAAAAAK2JvvZhWqZ51riasWBftkrVXE",Y8="eyJwcm9qZWN0SWQiOjY5NCwiZW1haWxSZWdpb24iOiJjYS1jZW50cmFsLTEiLCJlbWFpbENsaWVudElkIjoiNTRhdG41dXBpNjNxYzU5YTFlbTN2Ymhyc24iLCJycGNTZXJ2ZXIiOiJodHRwczovL2Rldi13YWFzLnNlcXVlbmNlLmFwcCJ9";new wD("https://nodes.sequence.app/polygon");const dg=new URLSearchParams(window.location.search),T1e=dg.get("env")??"prod";let wj=dg.get("projectAccessKey")??A1e,Ej=dg.get("waasConfigKey")??k1e,Sj=dg.get("googleClientId")??C1e;T1e==="dev"&&(console.log("Using dev environment"),console.log(`Project Access Key: ${Q8}`),console.log(`Waas Config Key: ${Y8}`),console.log(`Google Client ID: ${K8}`),wj=Q8,Ej=Y8,Sj=K8);const Oe=new Lhe({network:"polygon",projectAccessKey:wj,waasConfigKey:Ej}),oi=eee([{path:"/login",element:k.jsx(Zhe,{})},{path:"/",element:k.jsx(dpe,{})}]);db.createRoot(document.getElementById("root")).render(k.jsx(cr.StrictMode,{children:k.jsx(JQ,{children:k.jsx(oX,{children:k.jsx(hee,{clientId:Sj,children:k.jsx(S1e,{children:k.jsx(lee,{router:oi})})})})})})); diff --git a/index.html b/index.html index 1501887..c5354c8 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Demo Waas App - +