diff --git a/assets/index-c5081da7.js b/assets/index-f798eedc.js similarity index 94% rename from assets/index-c5081da7.js rename to assets/index-f798eedc.js index a1f2087..42c1196 100644 --- a/assets/index-c5081da7.js +++ b/assets/index-f798eedc.js @@ -6,7 +6,7 @@ function dC(t,e){for(var r=0;ra||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{B1=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?sf(t):""}function K9(t){switch(t.tag){case 5:return sf(t.type);case 16:return sf("Lazy");case 13:return sf("Suspense");case 19:return sf("SuspenseList");case 0:case 2:case 15:return t=U1(t.type,!1),t;case 11:return t=U1(t.type.render,!1),t;case 1:return t=U1(t.type,!0),t;default:return""}}function Tp(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ml:return"Fragment";case yl:return"Portal";case Ap:return"Profiler";case Dm:return"StrictMode";case Cp:return"Suspense";case _p:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case IC:return(t.displayName||"Context")+".Consumer";case RC:return(t._context.displayName||"Context")+".Provider";case Lm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case jm:return e=t.displayName||null,e!==null?e:Tp(t.type)||"Memo";case go:e=t._payload,t=t._init;try{return Tp(t(e))}catch{}}return null}function Y9(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Tp(e);case 8:return e===Dm?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Uo(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function MC(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Q9(t){var e=MC(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Yu(t){t._valueTracker||(t._valueTracker=Q9(t))}function NC(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=MC(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function mh(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Pp(t,e){var r=e.checked;return nr({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Rw(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Uo(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function $C(t,e){e=e.checked,e!=null&&$m(t,"checked",e,!1)}function Rp(t,e){$C(t,e);var r=Uo(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Ip(t,e.type,r):e.hasOwnProperty("defaultValue")&&Ip(t,e.type,Uo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Iw(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function Ip(t,e,r){(e!=="number"||mh(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var of=Array.isArray;function $l(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Qu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function $f(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var vf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},J9=["Webkit","ms","Moz","O"];Object.keys(vf).forEach(function(t){J9.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),vf[e]=vf[t]})});function FC(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||vf.hasOwnProperty(t)&&vf[t]?(""+e).trim():e+"px"}function BC(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=FC(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var X9=nr({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Np(t,e){if(e){if(X9[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ue(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ue(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ue(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ue(62))}}function $p(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Dp=null;function Fm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Lp=null,Dl=null,Ll=null;function Nw(t){if(t=Pu(t)){if(typeof Lp!="function")throw Error(ue(280));var e=t.stateNode;e&&(e=M0(e),Lp(t.stateNode,t.type,e))}}function UC(t){Dl?Ll?Ll.push(t):Ll=[t]:Dl=t}function zC(){if(Dl){var t=Dl,e=Ll;if(Ll=Dl=null,Nw(t),e)for(t=0;t>>=0,t===0?32:31-(cP(t)/fP|0)|0}var Ju=64,Xu=4194304;function af(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function wh(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=af(a):(s&=o,s!==0&&(n=af(s)))}else o=r&~i,o!==0?n=af(o):s!==0&&(n=af(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function _u(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Mi(e),t[e]=r}function vP(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=yf),Vw=String.fromCharCode(32),qw=!1;function l3(t,e){switch(t){case"keyup":return zP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c3(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var gl=!1;function qP(t,e){switch(t){case"compositionend":return c3(e);case"keypress":return e.which!==32?null:(qw=!0,Vw);case"textInput":return t=e.data,t===Vw&&qw?null:t;default:return null}}function HP(t,e){if(gl)return t==="compositionend"||!Gm&&l3(t,e)?(t=o3(),zd=qm=Ao=null,gl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Kw(r)}}function h3(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?h3(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function v3(){for(var t=window,e=mh();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=mh(t.document)}return e}function Km(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function eR(t){var e=v3(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&h3(r.ownerDocument.documentElement,r)){if(n!==null&&Km(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=Yw(r,s);var o=Yw(r,n);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,xl=null,Vp=null,gf=null,qp=!1;function Qw(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;qp||xl==null||xl!==mh(n)||(n=xl,"selectionStart"in n&&Km(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),gf&&Uf(gf,n)||(gf=n,n=kh(Vp,"onSelect"),0")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{B1=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?sf(t):""}function K9(t){switch(t.tag){case 5:return sf(t.type);case 16:return sf("Lazy");case 13:return sf("Suspense");case 19:return sf("SuspenseList");case 0:case 2:case 15:return t=U1(t.type,!1),t;case 11:return t=U1(t.type.render,!1),t;case 1:return t=U1(t.type,!0),t;default:return""}}function Tp(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ml:return"Fragment";case yl:return"Portal";case Ap:return"Profiler";case Dm:return"StrictMode";case Cp:return"Suspense";case _p:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case IC:return(t.displayName||"Context")+".Consumer";case RC:return(t._context.displayName||"Context")+".Provider";case Lm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case jm:return e=t.displayName||null,e!==null?e:Tp(t.type)||"Memo";case go:e=t._payload,t=t._init;try{return Tp(t(e))}catch{}}return null}function Y9(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Tp(e);case 8:return e===Dm?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Uo(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function MC(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Q9(t){var e=MC(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Yu(t){t._valueTracker||(t._valueTracker=Q9(t))}function NC(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=MC(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function mh(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Pp(t,e){var r=e.checked;return nr({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Rw(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=Uo(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function $C(t,e){e=e.checked,e!=null&&$m(t,"checked",e,!1)}function Rp(t,e){$C(t,e);var r=Uo(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Ip(t,e.type,r):e.hasOwnProperty("defaultValue")&&Ip(t,e.type,Uo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Iw(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function Ip(t,e,r){(e!=="number"||mh(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var of=Array.isArray;function $l(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Qu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function $f(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var vf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},J9=["Webkit","ms","Moz","O"];Object.keys(vf).forEach(function(t){J9.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),vf[e]=vf[t]})});function FC(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||vf.hasOwnProperty(t)&&vf[t]?(""+e).trim():e+"px"}function BC(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=FC(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var X9=nr({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Np(t,e){if(e){if(X9[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ue(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ue(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ue(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ue(62))}}function $p(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Dp=null;function Fm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Lp=null,Dl=null,Ll=null;function Nw(t){if(t=Pu(t)){if(typeof Lp!="function")throw Error(ue(280));var e=t.stateNode;e&&(e=M0(e),Lp(t.stateNode,t.type,e))}}function UC(t){Dl?Ll?Ll.push(t):Ll=[t]:Dl=t}function zC(){if(Dl){var t=Dl,e=Ll;if(Ll=Dl=null,Nw(t),e)for(t=0;t>>=0,t===0?32:31-(cP(t)/fP|0)|0}var Ju=64,Xu=4194304;function af(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function wh(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=af(a):(s&=o,s!==0&&(n=af(s)))}else o=r&~i,o!==0?n=af(o):s!==0&&(n=af(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function _u(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Mi(e),t[e]=r}function vP(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=yf),Vw=String.fromCharCode(32),qw=!1;function l3(t,e){switch(t){case"keyup":return zP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c3(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var gl=!1;function qP(t,e){switch(t){case"compositionend":return c3(e);case"keypress":return e.which!==32?null:(qw=!0,Vw);case"textInput":return t=e.data,t===Vw&&qw?null:t;default:return null}}function HP(t,e){if(gl)return t==="compositionend"||!Gm&&l3(t,e)?(t=o3(),zd=qm=Ao=null,gl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Kw(r)}}function h3(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?h3(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function v3(){for(var t=window,e=mh();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=mh(t.document)}return e}function Km(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function eR(t){var e=v3(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&h3(r.ownerDocument.documentElement,r)){if(n!==null&&Km(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=Yw(r,s);var o=Yw(r,n);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,xl=null,Vp=null,gf=null,qp=!1;function Qw(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;qp||xl==null||xl!==mh(n)||(n=xl,"selectionStart"in n&&Km(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),gf&&Uf(gf,n)||(gf=n,n=kh(Vp,"onSelect"),0El||(t.current=Qp[El],Qp[El]=null,El--)}function Ut(t,e){El++,Qp[El]=t.current,t.current=e}var zo={},ln=Zo(zo),kn=Zo(!1),Na=zo;function Ql(t,e){var r=t.type.contextTypes;if(!r)return zo;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function An(t){return t=t.childContextTypes,t!=null}function Ch(){Ht(kn),Ht(ln)}function n2(t,e,r){if(ln.current!==zo)throw Error(ue(168));Ut(ln,e),Ut(kn,r)}function S3(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(ue(108,Y9(t)||"Unknown",i));return nr({},r,n)}function _h(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||zo,Na=ln.current,Ut(ln,t),Ut(kn,kn.current),!0}function i2(t,e,r){var n=t.stateNode;if(!n)throw Error(ue(169));r?(t=S3(t,e,Na),n.__reactInternalMemoizedMergedChildContext=t,Ht(kn),Ht(ln),Ut(ln,t)):Ht(kn),Ut(kn,r)}var Rs=null,N0=!1,tv=!1;function k3(t){Rs===null?Rs=[t]:Rs.push(t)}function dR(t){N0=!0,k3(t)}function ea(){if(!tv&&Rs!==null){tv=!0;var t=0,e=pt;try{var r=Rs;for(pt=1;t>=o,i-=o,$s=1<<32-Mi(e)+i|r<L?(U=j,j=null):U=j.sibling;var K=d(b,j,E[L],P);if(K===null){j===null&&(j=U);break}t&&j&&K.alternate===null&&e(b,j),w=s(K,w,L),I===null?N=K:I.sibling=K,I=K,j=U}if(L===E.length)return r(b,j),Kt&&fa(b,L),N;if(j===null){for(;LL?(U=j,j=null):U=j.sibling;var X=d(b,j,K.value,P);if(X===null){j===null&&(j=U);break}t&&j&&X.alternate===null&&e(b,j),w=s(X,w,L),I===null?N=X:I.sibling=X,I=X,j=U}if(K.done)return r(b,j),Kt&&fa(b,L),N;if(j===null){for(;!K.done;L++,K=E.next())K=u(b,K.value,P),K!==null&&(w=s(K,w,L),I===null?N=K:I.sibling=K,I=K);return Kt&&fa(b,L),N}for(j=n(b,j);!K.done;L++,K=E.next())K=h(j,b,L,K.value,P),K!==null&&(t&&K.alternate!==null&&j.delete(K.key===null?L:K.key),w=s(K,w,L),I===null?N=K:I.sibling=K,I=K);return t&&j.forEach(function(ee){return e(b,ee)}),Kt&&fa(b,L),N}function x(b,w,E,P){if(typeof E=="object"&&E!==null&&E.type===ml&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case Ku:e:{for(var N=E.key,I=w;I!==null;){if(I.key===N){if(N=E.type,N===ml){if(I.tag===7){r(b,I.sibling),w=i(I,E.props.children),w.return=b,b=w;break e}}else if(I.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===go&&a2(N)===I.type){r(b,I.sibling),w=i(I,E.props),w.ref=Bc(b,I,E),w.return=b,b=w;break e}r(b,I);break}else e(b,I);I=I.sibling}E.type===ml?(w=_a(E.props.children,b.mode,P,E.key),w.return=b,b=w):(P=Qd(E.type,E.key,E.props,null,b.mode,P),P.ref=Bc(b,w,E),P.return=b,b=P)}return o(b);case yl:e:{for(I=E.key;w!==null;){if(w.key===I)if(w.tag===4&&w.stateNode.containerInfo===E.containerInfo&&w.stateNode.implementation===E.implementation){r(b,w.sibling),w=i(w,E.children||[]),w.return=b,b=w;break e}else{r(b,w);break}else e(b,w);w=w.sibling}w=cv(E,b.mode,P),w.return=b,b=w}return o(b);case go:return I=E._init,x(b,w,I(E._payload),P)}if(of(E))return p(b,w,E,P);if($c(E))return m(b,w,E,P);sd(b,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,w!==null&&w.tag===6?(r(b,w.sibling),w=i(w,E),w.return=b,b=w):(r(b,w),w=lv(E,b.mode,P),w.return=b,b=w),o(b)):r(b,w)}return x}var Xl=T3(!0),P3=T3(!1),Rh=Zo(null),Ih=null,Al=null,Xm=null;function Zm(){Xm=Al=Ih=null}function eg(t){var e=Rh.current;Ht(Rh),t._currentValue=e}function Zp(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Fl(t,e){Ih=t,Xm=Al=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Sn=!0),t.firstContext=null)}function vi(t){var e=t._currentValue;if(Xm!==t)if(t={context:t,memoizedValue:e,next:null},Al===null){if(Ih===null)throw Error(ue(308));Al=t,Ih.dependencies={lanes:0,firstContext:t}}else Al=Al.next=t;return e}var ga=null;function tg(t){ga===null?ga=[t]:ga.push(t)}function R3(t,e,r,n){var i=e.interleaved;return i===null?(r.next=r,tg(e)):(r.next=i.next,i.next=r),e.interleaved=r,Hs(t,n)}function Hs(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var xo=!1;function rg(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function I3(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Fs(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Oo(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,tt&2){var i=n.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),n.pending=e,Hs(t,r)}return i=n.interleaved,i===null?(e.next=e,tg(n)):(e.next=i.next,i.next=e),n.interleaved=e,Hs(t,r)}function qd(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Um(t,r)}}function l2(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=e:s=s.next=e}else i=s=e;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function Oh(t,e,r,n){var i=t.updateQueue;xo=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var f=t.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(s!==null){var u=i.baseState;o=0,f=c=l=null,a=s;do{var d=a.lane,h=a.eventTime;if((n&d)===d){f!==null&&(f=f.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=t,m=a;switch(d=e,h=r,m.tag){case 1:if(p=m.payload,typeof p=="function"){u=p.call(h,u,d);break e}u=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,d=typeof p=="function"?p.call(h,u,d):p,d==null)break e;u=nr({},u,d);break e;case 2:xo=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=i.effects,d===null?i.effects=[a]:d.push(a))}else h={eventTime:h,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=h,l=u):f=f.next=h,o|=d;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;d=a,a=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(1);if(f===null&&(l=u),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=f,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);La|=o,t.lanes=o,t.memoizedState=u}}function c2(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;er?r:4,t(!0);var n=nv.transition;nv.transition={};try{t(!1),e()}finally{pt=r,nv.transition=n}}function K3(){return pi().memoizedState}function yR(t,e,r){var n=No(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Y3(t))Q3(e,r);else if(r=R3(t,e,r,n),r!==null){var i=yn();Ni(r,t,n,i),J3(r,e,n)}}function mR(t,e,r){var n=No(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Y3(t))Q3(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,Li(a,o)){var l=e.interleaved;l===null?(i.next=i,tg(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}r=R3(t,e,i,n),r!==null&&(i=yn(),Ni(r,t,n,i),J3(r,e,n))}}function Y3(t){var e=t.alternate;return t===rr||e!==null&&e===rr}function Q3(t,e){xf=Nh=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function J3(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Um(t,r)}}var $h={readContext:vi,useCallback:en,useContext:en,useEffect:en,useImperativeHandle:en,useInsertionEffect:en,useLayoutEffect:en,useMemo:en,useReducer:en,useRef:en,useState:en,useDebugValue:en,useDeferredValue:en,useTransition:en,useMutableSource:en,useSyncExternalStore:en,useId:en,unstable_isNewReconciler:!1},gR={readContext:vi,useCallback:function(t,e){return Ki().memoizedState=[t,e===void 0?null:e],t},useContext:vi,useEffect:u2,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Wd(4194308,4,V3.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Wd(4194308,4,t,e)},useInsertionEffect:function(t,e){return Wd(4,2,t,e)},useMemo:function(t,e){var r=Ki();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Ki();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=yR.bind(null,rr,t),[n.memoizedState,t]},useRef:function(t){var e=Ki();return t={current:t},e.memoizedState=t},useState:f2,useDebugValue:fg,useDeferredValue:function(t){return Ki().memoizedState=t},useTransition:function(){var t=f2(!1),e=t[0];return t=pR.bind(null,t[1]),Ki().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=rr,i=Ki();if(Kt){if(r===void 0)throw Error(ue(407));r=r()}else{if(r=e(),jr===null)throw Error(ue(349));Da&30||$3(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,u2(L3.bind(null,n,s,t),[t]),n.flags|=2048,Yf(9,D3.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=Ki(),e=jr.identifierPrefix;if(Kt){var r=Ds,n=$s;r=(n&~(1<<32-Mi(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Gf++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[Xi]=e,t[qf]=n,a4(t,e,!1,!1),e.stateNode=t;e:{switch(o=$p(r,n),r){case"dialog":qt("cancel",t),qt("close",t),i=n;break;case"iframe":case"object":case"embed":qt("load",t),i=n;break;case"video":case"audio":for(i=0;itc&&(e.flags|=128,n=!0,Uc(s,!1),e.lanes=4194304)}else{if(!n)if(t=Mh(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Uc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Kt)return tn(e),null}else 2*xr()-s.renderingStartTime>tc&&r!==1073741824&&(e.flags|=128,n=!0,Uc(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=xr(),e.sibling=null,r=Xt.current,Ut(Xt,n?r&1|2:r&1),e):(tn(e),null);case 22:case 23:return yg(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?Dn&1073741824&&(tn(e),e.subtreeFlags&6&&(e.flags|=8192)):tn(e),null;case 24:return null;case 25:return null}throw Error(ue(156,e.tag))}function CR(t,e){switch(Qm(e),e.tag){case 1:return An(e.type)&&Ch(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Zl(),Ht(kn),Ht(ln),sg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ig(e),null;case 13:if(Ht(Xt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ue(340));Jl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ht(Xt),null;case 4:return Zl(),null;case 10:return eg(e.type._context),null;case 22:case 23:return yg(),null;case 24:return null;default:return null}}var ad=!1,nn=!1,_R=typeof WeakSet=="function"?WeakSet:Set,xe=null;function Cl(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ar(t,e,n)}else r.current=null}function ly(t,e,r){try{r()}catch(n){ar(t,e,n)}}var E2=!1;function TR(t,e){if(Hp=Eh,t=v3(),Km(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,c=0,f=0,u=t,d=null;t:for(;;){for(var h;u!==r||i!==0&&u.nodeType!==3||(a=o+i),u!==s||n!==0&&u.nodeType!==3||(l=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(h=u.firstChild)!==null;)d=u,u=h;for(;;){if(u===t)break t;if(d===r&&++c===i&&(a=o),d===s&&++f===n&&(l=o),(h=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=h}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Wp={focusedElem:t,selectionRange:r},Eh=!1,xe=e;xe!==null;)if(e=xe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,xe=t;else for(;xe!==null;){e=xe;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,x=p.memoizedState,b=e.stateNode,w=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:Ci(e.type,m),x);b.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ue(163))}}catch(P){ar(e,e.return,P)}if(t=e.sibling,t!==null){t.return=e.return,xe=t;break}xe=e.return}return p=E2,E2=!1,p}function bf(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&ly(e,r,s)}i=i.next}while(i!==n)}}function L0(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function cy(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function f4(t){var e=t.alternate;e!==null&&(t.alternate=null,f4(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Xi],delete e[qf],delete e[Yp],delete e[fR],delete e[uR])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function u4(t){return t.tag===5||t.tag===3||t.tag===4}function S2(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||u4(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function fy(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ah));else if(n!==4&&(t=t.child,t!==null))for(fy(t,e,r),t=t.sibling;t!==null;)fy(t,e,r),t=t.sibling}function uy(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(uy(t,e,r),t=t.sibling;t!==null;)uy(t,e,r),t=t.sibling}var qr=null,Ti=!1;function co(t,e,r){for(r=r.child;r!==null;)d4(t,e,r),r=r.sibling}function d4(t,e,r){if(os&&typeof os.onCommitFiberUnmount=="function")try{os.onCommitFiberUnmount(P0,r)}catch{}switch(r.tag){case 5:nn||Cl(r,e);case 6:var n=qr,i=Ti;qr=null,co(t,e,r),qr=n,Ti=i,qr!==null&&(Ti?(t=qr,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):qr.removeChild(r.stateNode));break;case 18:qr!==null&&(Ti?(t=qr,r=r.stateNode,t.nodeType===8?ev(t.parentNode,r):t.nodeType===1&&ev(t,r),Ff(t)):ev(qr,r.stateNode));break;case 4:n=qr,i=Ti,qr=r.stateNode.containerInfo,Ti=!0,co(t,e,r),qr=n,Ti=i;break;case 0:case 11:case 14:case 15:if(!nn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&ly(r,e,o),i=i.next}while(i!==n)}co(t,e,r);break;case 1:if(!nn&&(Cl(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){ar(r,e,a)}co(t,e,r);break;case 21:co(t,e,r);break;case 22:r.mode&1?(nn=(n=nn)||r.memoizedState!==null,co(t,e,r),nn=n):co(t,e,r);break;default:co(t,e,r)}}function k2(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new _R),e.forEach(function(n){var i=LR.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function wi(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=xr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*RR(n/1960))-n,10t?16:t,Co===null)var n=!1;else{if(t=Co,Co=null,jh=0,tt&6)throw Error(ue(331));var i=tt;for(tt|=4,xe=t.current;xe!==null;){var s=xe,o=s.child;if(xe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lxr()-vg?Ca(t,0):hg|=r),Cn(t,e)}function b4(t,e){e===0&&(t.mode&1?(e=Xu,Xu<<=1,!(Xu&130023424)&&(Xu=4194304)):e=1);var r=yn();t=Hs(t,e),t!==null&&(_u(t,e,r),Cn(t,r))}function DR(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),b4(t,r)}function LR(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(ue(314))}n!==null&&n.delete(e),b4(t,r)}var w4;w4=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||kn.current)Sn=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Sn=!1,kR(t,e,r);Sn=!!(t.flags&131072)}else Sn=!1,Kt&&e.flags&1048576&&A3(e,Ph,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Gd(t,e),t=e.pendingProps;var i=Ql(e,ln.current);Fl(e,r),i=ag(null,e,n,t,i,r);var s=lg();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,An(n)?(s=!0,_h(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,rg(e),i.updater=D0,e.stateNode=i,i._reactInternals=e,ty(e,n,t,r),e=iy(null,e,n,!0,s,r)):(e.tag=0,Kt&&s&&Ym(e),vn(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Gd(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=FR(n),t=Ci(n,t),i){case 0:e=ny(null,e,n,t,r);break e;case 1:e=x2(null,e,n,t,r);break e;case 11:e=m2(null,e,n,t,r);break e;case 14:e=g2(null,e,n,Ci(n.type,t),r);break e}throw Error(ue(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),ny(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),x2(t,e,n,i,r);case 3:e:{if(i4(e),t===null)throw Error(ue(387));n=e.pendingProps,s=e.memoizedState,i=s.element,I3(t,e),Oh(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ec(Error(ue(423)),e),e=b2(t,e,n,r,i);break e}else if(n!==i){i=ec(Error(ue(424)),e),e=b2(t,e,n,r,i);break e}else for(Vn=Io(e.stateNode.containerInfo.firstChild),qn=e,Kt=!0,Ii=null,r=P3(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Jl(),n===i){e=Ws(t,e,r);break e}vn(t,e,n,r)}e=e.child}return e;case 5:return O3(e),t===null&&Xp(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Gp(n,i)?o=null:s!==null&&Gp(n,s)&&(e.flags|=32),n4(t,e),vn(t,e,o,r),e.child;case 6:return t===null&&Xp(e),null;case 13:return s4(t,e,r);case 4:return ng(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Xl(e,null,n,r):vn(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),m2(t,e,n,i,r);case 7:return vn(t,e,e.pendingProps,r),e.child;case 8:return vn(t,e,e.pendingProps.children,r),e.child;case 12:return vn(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Ut(Rh,n._currentValue),n._currentValue=o,s!==null)if(Li(s.value,o)){if(s.children===i.children&&!kn.current){e=Ws(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=Fs(-1,r&-r),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Zp(s.return,r,e),a.lanes|=r;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ue(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Zp(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}vn(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Fl(e,r),i=vi(i),n=n(i),e.flags|=1,vn(t,e,n,r),e.child;case 14:return n=e.type,i=Ci(n,e.pendingProps),i=Ci(n.type,i),g2(t,e,n,i,r);case 15:return t4(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),Gd(t,e),e.tag=1,An(n)?(t=!0,_h(e)):t=!1,Fl(e,r),X3(e,n,i),ty(e,n,i,r),iy(null,e,n,!0,t,r);case 19:return o4(t,e,r);case 22:return r4(t,e,r)}throw Error(ue(156,e.tag))};function E4(t,e){return YC(t,e)}function jR(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function di(t,e,r,n){return new jR(t,e,r,n)}function gg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function FR(t){if(typeof t=="function")return gg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Lm)return 11;if(t===jm)return 14}return 2}function $o(t,e){var r=t.alternate;return r===null?(r=di(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Qd(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")gg(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ml:return _a(r.children,i,s,e);case Dm:o=8,i|=8;break;case Ap:return t=di(12,r,e,i|2),t.elementType=Ap,t.lanes=s,t;case Cp:return t=di(13,r,e,i),t.elementType=Cp,t.lanes=s,t;case _p:return t=di(19,r,e,i),t.elementType=_p,t.lanes=s,t;case OC:return F0(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case RC:o=10;break e;case IC:o=9;break e;case Lm:o=11;break e;case jm:o=14;break e;case go:o=16,n=null;break e}throw Error(ue(130,t==null?t:typeof t,""))}return e=di(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function _a(t,e,r,n){return t=di(7,t,n,e),t.lanes=r,t}function F0(t,e,r,n){return t=di(22,t,n,e),t.elementType=OC,t.lanes=r,t.stateNode={isHidden:!1},t}function lv(t,e,r){return t=di(6,t,null,e),t.lanes=r,t}function cv(t,e,r){return e=di(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function BR(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=V1(0),this.expirationTimes=V1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=V1(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xg(t,e,r,n,i,s,o,a,l){return t=new BR(t,e,r,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=di(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},rg(s),t}function UR(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(C4)}catch(t){console.error(t)}}C4(),CC.exports=Jn;var ro=CC.exports;const _4=eo(ro),WR=dC({__proto__:null,default:_4},[ro]);var O2=ro;Sp.createRoot=O2.createRoot,Sp.hydrateRoot=O2.hydrateRoot;const T4=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),q0=y.createContext({}),H0=y.createContext(null),W0=typeof document<"u",Sg=W0?y.useLayoutEffect:y.useEffect,P4=y.createContext({strict:!1}),kg=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),GR="framerAppearId",R4="data-"+kg(GR);function KR(t,e,r,n){const{visualElement:i}=y.useContext(q0),s=y.useContext(P4),o=y.useContext(H0),a=y.useContext(T4).reducedMotion,l=y.useRef();n=n||s.renderer,!l.current&&n&&(l.current=n(t,{visualState:e,parent:i,props:r,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const c=l.current;y.useInsertionEffect(()=>{c&&c.update(r,o)});const f=y.useRef(!!(r[R4]&&!window.HandoffComplete));return Sg(()=>{c&&(c.render(),f.current&&c.animationState&&c.animationState.animateChanges())}),y.useEffect(()=>{c&&(c.updateFeatures(),!f.current&&c.animationState&&c.animationState.animateChanges(),f.current&&(f.current=!1,window.HandoffComplete=!0))}),c}function Tl(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function YR(t,e,r){return y.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Tl(r)&&(r.current=n))},[e])}function Jf(t){return typeof t=="string"||Array.isArray(t)}function G0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Ag=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cg=["initial",...Ag];function K0(t){return G0(t.animate)||Cg.some(e=>Jf(t[e]))}function I4(t){return!!(K0(t)||t.variants)}function QR(t,e){if(K0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Jf(r)?r:void 0,animate:Jf(n)?n:void 0}}return t.inherit!==!1?e:{}}function JR(t){const{initial:e,animate:r}=QR(t,y.useContext(q0));return y.useMemo(()=>({initial:e,animate:r}),[M2(e),M2(r)])}function M2(t){return Array.isArray(t)?t.join(" "):t}const N2={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Xf={};for(const t in N2)Xf[t]={isEnabled:e=>N2[t].some(r=>!!e[r])};function XR(t){for(const e in t)Xf[e]={...Xf[e],...t[e]}}const _g=y.createContext({}),O4=y.createContext({}),ZR=Symbol.for("motionComponentSymbol");function eI({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&XR(t);function s(a,l){let c;const f={...y.useContext(T4),...a,layoutId:tI(a)},{isStatic:u}=f,d=JR(a),h=n(a,u);if(!u&&W0){d.visualElement=KR(i,h,f,e);const p=y.useContext(O4),m=y.useContext(P4).strict;d.visualElement&&(c=d.visualElement.loadFeatures(f,m,t,p))}return y.createElement(q0.Provider,{value:d},c&&d.visualElement?y.createElement(c,{visualElement:d.visualElement,...f}):null,r(i,a,YR(h,d.visualElement,l),h,u,d.visualElement))}const o=y.forwardRef(s);return o[ZR]=i,o}function tI({layoutId:t}){const e=y.useContext(_g).id;return e&&t!==void 0?e+"-"+t:t}function rI(t){function e(n,i={}){return eI(t(n,i))}if(typeof Proxy>"u")return e;const r=new Map;return new Proxy(e,{get:(n,i)=>(r.has(i)||r.set(i,e(i)),r.get(i))})}const nI=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tg(t){return typeof t!="string"||t.includes("-")?!1:!!(nI.indexOf(t)>-1||/[A-Z]/.test(t))}const Uh={};function iI(t){Object.assign(Uh,t)}const Iu=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Qa=new Set(Iu);function M4(t,{layout:e,layoutId:r}){return Qa.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Uh[t]||t==="opacity")}const Tn=t=>!!(t&&t.getVelocity),sI={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oI=Iu.length;function aI(t,{enableHardwareAcceleration:e=!0,allowTransformNone:r=!0},n,i){let s="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),$4=N4("--"),yy=N4("var(--"),lI=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,cI=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Vo=(t,e,r)=>Math.min(Math.max(r,t),e),Ja={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Sf={...Ja,transform:t=>Vo(0,1,t)},fd={...Ja,default:1},kf=t=>Math.round(t*1e5)/1e5,Y0=/(-)?([\d]*\.?[\d])+/g,D4=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,fI=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Ou(t){return typeof t=="string"}const Mu=t=>({test:e=>Ou(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),vo=Mu("deg"),ls=Mu("%"),Pe=Mu("px"),uI=Mu("vh"),dI=Mu("vw"),$2={...ls,parse:t=>ls.parse(t)/100,transform:t=>ls.transform(t*100)},D2={...Ja,transform:Math.round},L4={borderWidth:Pe,borderTopWidth:Pe,borderRightWidth:Pe,borderBottomWidth:Pe,borderLeftWidth:Pe,borderRadius:Pe,radius:Pe,borderTopLeftRadius:Pe,borderTopRightRadius:Pe,borderBottomRightRadius:Pe,borderBottomLeftRadius:Pe,width:Pe,maxWidth:Pe,height:Pe,maxHeight:Pe,size:Pe,top:Pe,right:Pe,bottom:Pe,left:Pe,padding:Pe,paddingTop:Pe,paddingRight:Pe,paddingBottom:Pe,paddingLeft:Pe,margin:Pe,marginTop:Pe,marginRight:Pe,marginBottom:Pe,marginLeft:Pe,rotate:vo,rotateX:vo,rotateY:vo,rotateZ:vo,scale:fd,scaleX:fd,scaleY:fd,scaleZ:fd,skew:vo,skewX:vo,skewY:vo,distance:Pe,translateX:Pe,translateY:Pe,translateZ:Pe,x:Pe,y:Pe,z:Pe,perspective:Pe,transformPerspective:Pe,opacity:Sf,originX:$2,originY:$2,originZ:Pe,zIndex:D2,fillOpacity:Sf,strokeOpacity:Sf,numOctaves:D2};function Pg(t,e,r,n){const{style:i,vars:s,transform:o,transformOrigin:a}=t;let l=!1,c=!1,f=!0;for(const u in e){const d=e[u];if($4(u)){s[u]=d;continue}const h=L4[u],p=cI(d,h);if(Qa.has(u)){if(l=!0,o[u]=p,!f)continue;d!==(h.default||0)&&(f=!1)}else u.startsWith("origin")?(c=!0,a[u]=p):i[u]=p}if(e.transform||(l||n?i.transform=aI(t.transform,r,f,n):i.transform&&(i.transform="none")),c){const{originX:u="50%",originY:d="50%",originZ:h=0}=a;i.transformOrigin=`${u} ${d} ${h}`}}const Rg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function j4(t,e,r){for(const n in e)!Tn(e[n])&&!M4(n,r)&&(t[n]=e[n])}function hI({transformTemplate:t},e,r){return y.useMemo(()=>{const n=Rg();return Pg(n,e,{enableHardwareAcceleration:!r},t),Object.assign({},n.vars,n.style)},[e])}function vI(t,e,r){const n=t.style||{},i={};return j4(i,n,t),Object.assign(i,hI(t,e,r)),t.transformValues?t.transformValues(i):i}function pI(t,e,r){const n={},i=vI(t,e,r);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const yI=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function zh(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||yI.has(t)}let F4=t=>!zh(t);function mI(t){t&&(F4=e=>e.startsWith("on")?!zh(e):t(e))}try{mI(require("@emotion/is-prop-valid").default)}catch{}function gI(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(F4(i)||r===!0&&zh(i)||!e&&!zh(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function L2(t,e,r){return typeof t=="string"?t:Pe.transform(e+r*t)}function xI(t,e,r){const n=L2(e,t.x,t.width),i=L2(r,t.y,t.height);return`${n} ${i}`}const bI={offset:"stroke-dashoffset",array:"stroke-dasharray"},wI={offset:"strokeDashoffset",array:"strokeDasharray"};function EI(t,e,r=1,n=0,i=!0){t.pathLength=1;const s=i?bI:wI;t[s.offset]=Pe.transform(-n);const o=Pe.transform(e),a=Pe.transform(r);t[s.array]=`${o} ${a}`}function Ig(t,{attrX:e,attrY:r,attrScale:n,originX:i,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},f,u,d){if(Pg(t,c,f,d),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p,dimensions:m}=t;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||s!==void 0||p.transform)&&(p.transformOrigin=xI(m,i!==void 0?i:.5,s!==void 0?s:.5)),e!==void 0&&(h.x=e),r!==void 0&&(h.y=r),n!==void 0&&(h.scale=n),o!==void 0&&EI(h,o,a,l,!1)}const B4=()=>({...Rg(),attrs:{}}),Og=t=>typeof t=="string"&&t.toLowerCase()==="svg";function SI(t,e,r,n){const i=y.useMemo(()=>{const s=B4();return Ig(s,e,{enableHardwareAcceleration:!1},Og(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};j4(s,t.style,t),i.style={...s,...i.style}}return i}function kI(t=!1){return(r,n,i,{latestValues:s},o)=>{const l=(Tg(r)?SI:pI)(n,s,o,r),f={...gI(n,typeof r=="string",t),...l,ref:i},{children:u}=n,d=y.useMemo(()=>Tn(u)?u.get():u,[u]);return y.createElement(r,{...f,children:d})}}function U4(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const z4=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function V4(t,e,r,n){U4(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(z4.has(i)?i:kg(i),e.attrs[i])}function Mg(t,e){const{style:r}=t,n={};for(const i in r)(Tn(r[i])||e.style&&Tn(e.style[i])||M4(i,t))&&(n[i]=r[i]);return n}function q4(t,e){const r=Mg(t,e);for(const n in t)if(Tn(t[n])||Tn(e[n])){const i=Iu.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;r[i]=t[n]}return r}function Ng(t,e,r,n={},i={}){return typeof e=="function"&&(e=e(r!==void 0?r:t.custom,n,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(r!==void 0?r:t.custom,n,i)),e}function H4(t){const e=y.useRef(null);return e.current===null&&(e.current=t()),e.current}const Vh=t=>Array.isArray(t),AI=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CI=t=>Vh(t)?t[t.length-1]||0:t;function Jd(t){const e=Tn(t)?t.get():t;return AI(e)?e.toValue():e}function _I({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:TI(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const W4=t=>(e,r)=>{const n=y.useContext(q0),i=y.useContext(H0),s=()=>_I(t,e,n,i);return r?s():H4(s)};function TI(t,e,r,n){const i={},s=n(t,{});for(const d in s)i[d]=Jd(s[d]);let{initial:o,animate:a}=t;const l=K0(t),c=I4(t);e&&c&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let f=r?r.initial===!1:!1;f=f||o===!1;const u=f?a:o;return u&&typeof u!="boolean"&&!G0(u)&&(Array.isArray(u)?u:[u]).forEach(h=>{const p=Ng(t,h);if(!p)return;const{transitionEnd:m,transition:x,...b}=p;for(const w in b){let E=b[w];if(Array.isArray(E)){const P=f?E.length-1:0;E=E[P]}E!==null&&(i[w]=E)}for(const w in m)i[w]=m[w]}),i}const cr=t=>t;class j2{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const r=this.order.indexOf(e);r!==-1&&(this.order.splice(r,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function PI(t){let e=new j2,r=new j2,n=0,i=!1,s=!1;const o=new WeakSet,a={schedule:(l,c=!1,f=!1)=>{const u=f&&i,d=u?e:r;return c&&o.add(l),d.add(l)&&u&&i&&(n=e.order.length),l},cancel:l=>{r.remove(l),o.delete(l)},process:l=>{if(i){s=!0;return}if(i=!0,[e,r]=[r,e],r.clear(),n=e.order.length,n)for(let c=0;c(u[d]=PI(()=>r=!0),u),{}),o=u=>s[u].process(i),a=()=>{const u=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(u-i.timestamp,RI),1),i.timestamp=u,i.isProcessing=!0,ud.forEach(o),i.isProcessing=!1,r&&e&&(n=!1,t(a))},l=()=>{r=!0,n=!0,i.isProcessing||t(a)};return{schedule:ud.reduce((u,d)=>{const h=s[d];return u[d]=(p,m=!1,x=!1)=>(r||l(),h.schedule(p,m,x)),u},{}),cancel:u=>ud.forEach(d=>s[d].cancel(u)),state:i,steps:s}}const{schedule:zt,cancel:Gs,state:rn,steps:fv}=II(typeof requestAnimationFrame<"u"?requestAnimationFrame:cr,!0),OI={useVisualState:W4({scrapeMotionValuesFromProps:q4,createRenderState:B4,onMount:(t,e,{renderState:r,latestValues:n})=>{zt.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),zt.render(()=>{Ig(r,n,{enableHardwareAcceleration:!1},Og(e.tagName),t.transformTemplate),V4(e,r)})}})},MI={useVisualState:W4({scrapeMotionValuesFromProps:Mg,createRenderState:Rg})};function NI(t,{forwardMotionProps:e=!1},r,n){return{...Tg(t)?OI:MI,preloadedFeatures:r,useRender:kI(e),createVisualElement:n,Component:t}}function Ls(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}const G4=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Q0(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const $I=t=>e=>G4(e)&&t(e,Q0(e));function Bs(t,e,r,n){return Ls(t,e,$I(r),n)}const DI=(t,e)=>r=>e(t(r)),Do=(...t)=>t.reduce(DI);function K4(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const F2=K4("dragHorizontal"),B2=K4("dragVertical");function Y4(t){let e=!1;if(t==="y")e=B2();else if(t==="x")e=F2();else{const r=F2(),n=B2();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function Q4(){const t=Y4(!0);return t?(t(),!1):!0}class ta{constructor(e){this.isMounted=!1,this.node=e}update(){}}function U2(t,e){const r="pointer"+(e?"enter":"leave"),n="onHover"+(e?"Start":"End"),i=(s,o)=>{if(s.pointerType==="touch"||Q4())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[n]&&zt.update(()=>a[n](s,o))};return Bs(t.current,r,i,{passive:!t.getProps()[n]})}class LI extends ta{mount(){this.unmount=Do(U2(this.node,!0),U2(this.node,!1))}unmount(){}}class jI extends ta{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Do(Ls(this.node.current,"focus",()=>this.onFocus()),Ls(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const J4=(t,e)=>e?t===e?!0:J4(t,e.parentElement):!1;function uv(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,Q0(r))}class FI extends ta{constructor(){super(...arguments),this.removeStartListeners=cr,this.removeEndListeners=cr,this.removeAccessibleListeners=cr,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=Bs(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:f,globalTapTarget:u}=this.node.getProps();zt.update(()=>{!u&&!J4(this.node.current,a.target)?f&&f(a,l):c&&c(a,l)})},{passive:!(n.onTap||n.onPointerUp)}),o=Bs(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Do(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||uv("up",(l,c)=>{const{onTap:f}=this.node.getProps();f&&zt.update(()=>f(l,c))})};this.removeEndListeners(),this.removeEndListeners=Ls(this.node.current,"keyup",o),uv("down",(a,l)=>{this.startPress(a,l)})},r=Ls(this.node.current,"keydown",e),n=()=>{this.isPressing&&uv("cancel",(s,o)=>this.cancelPress(s,o))},i=Ls(this.node.current,"blur",n);this.removeAccessibleListeners=Do(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&zt.update(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Q4()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&zt.update(()=>n(e,r))}mount(){const e=this.node.getProps(),r=Bs(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Ls(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Do(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const my=new WeakMap,dv=new WeakMap,BI=t=>{const e=my.get(t.target);e&&e(t)},UI=t=>{t.forEach(BI)};function zI({root:t,...e}){const r=t||document;dv.has(r)||dv.set(r,{});const n=dv.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(UI,{root:t,...e})),n[i]}function VI(t,e,r){const n=zI(e);return my.set(t,r),n.observe(t),()=>{my.delete(t),n.unobserve(t)}}const qI={some:0,all:1};class HI extends ta{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:qI[i]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,s&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:f,onViewportLeave:u}=this.node.getProps(),d=c?f:u;d&&d(l)};return VI(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(WI(e,r))&&this.startObserver()}unmount(){}}function WI({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const GI={inView:{Feature:HI},tap:{Feature:FI},focus:{Feature:jI},hover:{Feature:LI}};function X4(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;ne[n]=r.get()),e}function YI(t){const e={};return t.values.forEach((r,n)=>e[n]=r.getVelocity()),e}function J0(t,e,r){const n=t.getProps();return Ng(n,e,r!==void 0?r:n.custom,KI(t),YI(t))}let QI=cr,$g=cr;const Lo=t=>t*1e3,Us=t=>t/1e3,JI={current:!1},Z4=t=>Array.isArray(t)&&typeof t[0]=="number";function e6(t){return!!(!t||typeof t=="string"&&t6[t]||Z4(t)||Array.isArray(t)&&t.every(e6))}const cf=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,t6={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cf([0,.65,.55,1]),circOut:cf([.55,0,1,.45]),backIn:cf([.31,.01,.66,-.59]),backOut:cf([.33,1.53,.69,.99])};function r6(t){if(t)return Z4(t)?cf(t):Array.isArray(t)?t.map(r6):t6[t]}function XI(t,e,r,{delay:n=0,duration:i,repeat:s=0,repeatType:o="loop",ease:a,times:l}={}){const c={[e]:r};l&&(c.offset=l);const f=r6(a);return Array.isArray(f)&&(c.easing=f),t.animate(c,{delay:n,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function ZI(t,{repeat:e,repeatType:r="loop"}){const n=e&&r!=="loop"&&e%2===1?0:t.length-1;return t[n]}const n6=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,eO=1e-7,tO=12;function rO(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=n6(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>eO&&++arO(s,0,1,t,r);return s=>s===0||s===1?s:n6(i(s),e,n)}const nO=Nu(.42,0,1,1),iO=Nu(0,0,.58,1),i6=Nu(.42,0,.58,1),sO=t=>Array.isArray(t)&&typeof t[0]!="number",s6=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,o6=t=>e=>1-t(1-e),Dg=t=>1-Math.sin(Math.acos(t)),a6=o6(Dg),oO=s6(Dg),l6=Nu(.33,1.53,.69,.99),Lg=o6(l6),aO=s6(Lg),lO=t=>(t*=2)<1?.5*Lg(t):.5*(2-Math.pow(2,-10*(t-1))),cO={linear:cr,easeIn:nO,easeInOut:i6,easeOut:iO,circIn:Dg,circInOut:oO,circOut:a6,backIn:Lg,backInOut:aO,backOut:l6,anticipate:lO},z2=t=>{if(Array.isArray(t)){$g(t.length===4);const[e,r,n,i]=t;return Nu(e,r,n,i)}else if(typeof t=="string")return cO[t];return t},jg=(t,e)=>r=>!!(Ou(r)&&fI.test(r)&&r.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(r,e)),c6=(t,e,r)=>n=>{if(!Ou(n))return n;const[i,s,o,a]=n.match(Y0);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},fO=t=>Vo(0,255,t),hv={...Ja,transform:t=>Math.round(fO(t))},ba={test:jg("rgb","red"),parse:c6("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+hv.transform(t)+", "+hv.transform(e)+", "+hv.transform(r)+", "+kf(Sf.transform(n))+")"};function uO(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const gy={test:jg("#"),parse:uO,transform:ba.transform},Pl={test:jg("hsl","hue"),parse:c6("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+ls.transform(kf(e))+", "+ls.transform(kf(r))+", "+kf(Sf.transform(n))+")"},dn={test:t=>ba.test(t)||gy.test(t)||Pl.test(t),parse:t=>ba.test(t)?ba.parse(t):Pl.test(t)?Pl.parse(t):gy.parse(t),transform:t=>Ou(t)?t:t.hasOwnProperty("red")?ba.transform(t):Pl.transform(t)},tr=(t,e,r)=>-r*t+r*e+t;function vv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function dO({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,l=2*r-a;i=vv(l,a,t+1/3),s=vv(l,a,t),o=vv(l,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}const pv=(t,e,r)=>{const n=t*t;return Math.sqrt(Math.max(0,r*(e*e-n)+n))},hO=[gy,ba,Pl],vO=t=>hO.find(e=>e.test(t));function V2(t){const e=vO(t);let r=e.parse(t);return e===Pl&&(r=dO(r)),r}const f6=(t,e)=>{const r=V2(t),n=V2(e),i={...r};return s=>(i.red=pv(r.red,n.red,s),i.green=pv(r.green,n.green,s),i.blue=pv(r.blue,n.blue,s),i.alpha=tr(r.alpha,n.alpha,s),ba.transform(i))};function pO(t){var e,r;return isNaN(t)&&Ou(t)&&(((e=t.match(Y0))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(D4))===null||r===void 0?void 0:r.length)||0)>0}const u6={regex:lI,countKey:"Vars",token:"${v}",parse:cr},d6={regex:D4,countKey:"Colors",token:"${c}",parse:dn.parse},h6={regex:Y0,countKey:"Numbers",token:"${n}",parse:Ja.parse};function yv(t,{regex:e,countKey:r,token:n,parse:i}){const s=t.tokenised.match(e);s&&(t["num"+r]=s.length,t.tokenised=t.tokenised.replace(e,n),t.values.push(...s.map(i)))}function qh(t){const e=t.toString(),r={value:e,tokenised:e,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&yv(r,u6),yv(r,d6),yv(r,h6),r}function v6(t){return qh(t).values}function p6(t){const{values:e,numColors:r,numVars:n,tokenised:i}=qh(t),s=e.length;return o=>{let a=i;for(let l=0;ltypeof t=="number"?0:t;function mO(t){const e=v6(t);return p6(t)(e.map(yO))}const qo={test:pO,parse:v6,createTransformer:p6,getAnimatableNone:mO},y6=(t,e)=>r=>`${r>0?e:t}`;function m6(t,e){return typeof t=="number"?r=>tr(t,e,r):dn.test(t)?f6(t,e):t.startsWith("var(")?y6(t,e):x6(t,e)}const g6=(t,e)=>{const r=[...t],n=r.length,i=t.map((s,o)=>m6(s,e[o]));return s=>{for(let o=0;o{const r={...t,...e},n={};for(const i in r)t[i]!==void 0&&e[i]!==void 0&&(n[i]=m6(t[i],e[i]));return i=>{for(const s in n)r[s]=n[s](i);return r}},x6=(t,e)=>{const r=qo.createTransformer(e),n=qh(t),i=qh(e);return n.numVars===i.numVars&&n.numColors===i.numColors&&n.numNumbers>=i.numNumbers?Do(g6(n.values,i.values),r):y6(t,e)},Zf=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},q2=(t,e)=>r=>tr(t,e,r);function xO(t){return typeof t=="number"?q2:typeof t=="string"?dn.test(t)?f6:x6:Array.isArray(t)?g6:typeof t=="object"?gO:q2}function bO(t,e,r){const n=[],i=r||xO(t[0]),s=t.length-1;for(let o=0;oe[0];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=bO(e,n,i),a=o.length,l=c=>{let f=0;if(a>1)for(;fl(Vo(t[0],t[s-1],c)):l}function wO(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Zf(0,e,n);t.push(tr(r,1,i))}}function EO(t){const e=[0];return wO(e,t.length-1),e}function SO(t,e){return t.map(r=>r*e)}function kO(t,e){return t.map(()=>e||i6).splice(0,t.length-1)}function Hh({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=sO(n)?n.map(z2):z2(n),s={done:!1,value:e[0]},o=SO(r&&r.length===e.length?r:EO(e),t),a=b6(o,e,{ease:Array.isArray(i)?i:kO(e,i)});return{calculatedDuration:t,next:l=>(s.value=a(l),s.done=l>=t,s)}}function w6(t,e){return e?t*(1e3/e):0}const AO=5;function E6(t,e,r){const n=Math.max(e-AO,0);return w6(r-t(n),e-n)}const mv=.001,CO=.01,H2=10,_O=.05,TO=1;function PO({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;QI(t<=Lo(H2));let o=1-e;o=Vo(_O,TO,o),t=Vo(CO,H2,Us(t)),o<1?(i=c=>{const f=c*o,u=f*t,d=f-r,h=xy(c,o),p=Math.exp(-u);return mv-d/h*p},s=c=>{const u=c*o*t,d=u*r+r,h=Math.pow(o,2)*Math.pow(c,2)*t,p=Math.exp(-u),m=xy(Math.pow(c,2),o);return(-i(c)+mv>0?-1:1)*((d-h)*p)/m}):(i=c=>{const f=Math.exp(-c*t),u=(c-r)*t+1;return-mv+f*u},s=c=>{const f=Math.exp(-c*t),u=(r-c)*(t*t);return f*u});const a=5/t,l=IO(i,s,a);if(t=Lo(t),isNaN(l))return{stiffness:100,damping:10,duration:t};{const c=Math.pow(l,2)*n;return{stiffness:c,damping:o*2*Math.sqrt(n*c),duration:t}}}const RO=12;function IO(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function NO(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!W2(t,MO)&&W2(t,OO)){const r=PO(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function S6({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:l,mass:c,duration:f,velocity:u,isResolvedFromDuration:d}=NO({...n,velocity:-Us(n.velocity||0)}),h=u||0,p=l/(2*Math.sqrt(a*c)),m=s-i,x=Us(Math.sqrt(a/c)),b=Math.abs(m)<5;r||(r=b?.01:2),e||(e=b?.005:.5);let w;if(p<1){const E=xy(x,p);w=P=>{const N=Math.exp(-p*x*P);return s-N*((h+p*x*m)/E*Math.sin(E*P)+m*Math.cos(E*P))}}else if(p===1)w=E=>s-Math.exp(-x*E)*(m+(h+x*m)*E);else{const E=x*Math.sqrt(p*p-1);w=P=>{const N=Math.exp(-p*x*P),I=Math.min(E*P,300);return s-N*((h+p*x*m)*Math.sinh(I)+E*m*Math.cosh(I))/E}}return{calculatedDuration:d&&f||null,next:E=>{const P=w(E);if(d)o.done=E>=f;else{let N=h;E!==0&&(p<1?N=E6(w,E,P):N=0);const I=Math.abs(N)<=r,j=Math.abs(s-P)<=e;o.done=I&&j}return o.value=o.done?s:P,o}}}function G2({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:f}){const u=t[0],d={done:!1,value:u},h=L=>a!==void 0&&Ll,p=L=>a===void 0?l:l===void 0||Math.abs(a-L)-m*Math.exp(-L/n),E=L=>b+w(L),P=L=>{const U=w(L),K=E(L);d.done=Math.abs(U)<=c,d.value=d.done?b:K};let N,I;const j=L=>{h(d.value)&&(N=L,I=S6({keyframes:[d.value,p(d.value)],velocity:E6(E,L,d.value),damping:i,stiffness:s,restDelta:c,restSpeed:f}))};return j(0),{calculatedDuration:null,next:L=>{let U=!1;return!I&&N===void 0&&(U=!0,P(L),j(L)),N!==void 0&&L>N?I.next(L-N):(!U&&P(L),d)}}}const $O=t=>{const e=({timestamp:r})=>t(r);return{start:()=>zt.update(e,!0),stop:()=>Gs(e),now:()=>rn.isProcessing?rn.timestamp:performance.now()}},K2=2e4;function Y2(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=K2?1/0:e}const DO={decay:G2,inertia:G2,tween:Hh,keyframes:Hh,spring:S6};function Wh({autoplay:t=!0,delay:e=0,driver:r=$O,keyframes:n,type:i="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:a="loop",onPlay:l,onStop:c,onComplete:f,onUpdate:u,...d}){let h=1,p=!1,m,x;const b=()=>{x=new Promise(S=>{m=S})};b();let w;const E=DO[i]||Hh;let P;E!==Hh&&typeof n[0]!="number"&&(P=b6([0,100],n,{clamp:!1}),n=[0,100]);const N=E({...d,keyframes:n});let I;a==="mirror"&&(I=E({...d,keyframes:[...n].reverse(),velocity:-(d.velocity||0)}));let j="idle",L=null,U=null,K=null;N.calculatedDuration===null&&s&&(N.calculatedDuration=Y2(N));const{calculatedDuration:X}=N;let ee=1/0,M=1/0;X!==null&&(ee=X+o,M=ee*(s+1)-o);let v=0;const _=S=>{if(U===null)return;h>0&&(U=Math.min(U,S)),h<0&&(U=Math.min(S-M/h,U)),L!==null?v=L:v=Math.round(S-U)*h;const g=v-e*(h>=0?1:-1),R=h>=0?g<0:g>M;v=Math.max(g,0),j==="finished"&&L===null&&(v=M);let F=v,C=N;if(s){const Z=Math.min(v,M)/ee;let le=Math.floor(Z),ne=Z%1;!ne&&Z>=1&&(ne=1),ne===1&&le--,le=Math.min(le,s+1),!!(le%2)&&(a==="reverse"?(ne=1-ne,o&&(ne-=o/ee)):a==="mirror"&&(C=I)),F=Vo(0,1,ne)*ee}const B=R?{done:!1,value:n[0]}:C.next(F);P&&(B.value=P(B.value));let{done:V}=B;!R&&X!==null&&(V=h>=0?v>=M:v<=0);const H=L===null&&(j==="finished"||j==="running"&&V);return u&&u(B.value),H&&T(),B},k=()=>{w&&w.stop(),w=void 0},A=()=>{j="idle",k(),m(),b(),U=K=null},T=()=>{j="finished",f&&f(),k(),m()},O=()=>{if(p)return;w||(w=r(_));const S=w.now();l&&l(),L!==null?U=S-L:(!U||j==="finished")&&(U=S),j==="finished"&&b(),K=U,L=null,j="running",w.start()};t&&O();const D={then(S,g){return x.then(S,g)},get time(){return Us(v)},set time(S){S=Lo(S),v=S,L!==null||!w||h===0?L=S:U=w.now()-S/h},get duration(){const S=N.calculatedDuration===null?Y2(N):N.calculatedDuration;return Us(S)},get speed(){return h},set speed(S){S===h||!w||(h=S,D.time=Us(v))},get state(){return j},play:O,pause:()=>{j="paused",L=v},stop:()=>{p=!0,j!=="idle"&&(j="idle",c&&c(),A())},cancel:()=>{K!==null&&_(K),A()},complete:()=>{j="finished"},sample:S=>(U=0,_(S))};return D}function LO(t){let e;return()=>(e===void 0&&(e=t()),e)}const jO=LO(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),FO=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),dd=10,BO=2e4,UO=(t,e)=>e.type==="spring"||t==="backgroundColor"||!e6(e.ease);function zO(t,e,{onUpdate:r,onComplete:n,...i}){if(!(jO()&&FO.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let o=!1,a,l,c=!1;const f=()=>{l=new Promise(E=>{a=E})};f();let{keyframes:u,duration:d=300,ease:h,times:p}=i;if(UO(e,i)){const E=Wh({...i,repeat:0,delay:0});let P={done:!1,value:u[0]};const N=[];let I=0;for(;!P.done&&I{c=!1,m.cancel()},b=()=>{c=!0,zt.update(x),a(),f()};return m.onfinish=()=>{c||(t.set(ZI(u,i)),n&&n(),b())},{then(E,P){return l.then(E,P)},attachTimeline(E){return m.timeline=E,m.onfinish=null,cr},get time(){return Us(m.currentTime||0)},set time(E){m.currentTime=Lo(E)},get speed(){return m.playbackRate},set speed(E){m.playbackRate=E},get duration(){return Us(d)},play:()=>{o||(m.play(),Gs(x))},pause:()=>m.pause(),stop:()=>{if(o=!0,m.playState==="idle")return;const{currentTime:E}=m;if(E){const P=Wh({...i,autoplay:!1});t.setWithVelocity(P.sample(E-dd).value,P.sample(E).value,dd)}b()},complete:()=>{c||m.finish()},cancel:b}}function VO({keyframes:t,delay:e,onUpdate:r,onComplete:n}){const i=()=>(r&&r(t[t.length-1]),n&&n(),{time:0,speed:1,duration:0,play:cr,pause:cr,stop:cr,then:s=>(s(),Promise.resolve()),cancel:cr,complete:cr});return e?Wh({keyframes:[0,1],duration:0,delay:e,onComplete:i}):i()}const qO={type:"spring",stiffness:500,damping:25,restSpeed:10},HO=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),WO={type:"keyframes",duration:.8},GO={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KO=(t,{keyframes:e})=>e.length>2?WO:Qa.has(t)?t.startsWith("scale")?HO(e[1]):qO:GO,by=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(qo.test(e)||e==="0")&&!e.startsWith("url(")),YO=new Set(["brightness","contrast","saturate","opacity"]);function QO(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Y0)||[];if(!n)return t;const i=r.replace(n,"");let s=YO.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const JO=/([a-z-]*)\(.*?\)/g,wy={...qo,getAnimatableNone:t=>{const e=t.match(JO);return e?e.map(QO).join(" "):t}},XO={...L4,color:dn,backgroundColor:dn,outlineColor:dn,fill:dn,stroke:dn,borderColor:dn,borderTopColor:dn,borderRightColor:dn,borderBottomColor:dn,borderLeftColor:dn,filter:wy,WebkitFilter:wy},Fg=t=>XO[t];function k6(t,e){let r=Fg(t);return r!==wy&&(r=qo),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const A6=t=>/^0[^.\s]+$/.test(t);function ZO(t){if(typeof t=="number")return t===0;if(t!==null)return t==="none"||t==="0"||A6(t)}function eM(t,e,r,n){const i=by(e,r);let s;Array.isArray(r)?s=[...r]:s=[null,r];const o=n.from!==void 0?n.from:t.get();let a;const l=[];for(let c=0;ci=>{const s=Bg(n,t)||{},o=s.delay||n.delay||0;let{elapsed:a=0}=n;a=a-Lo(o);const l=eM(e,t,r,s),c=l[0],f=l[l.length-1],u=by(t,c),d=by(t,f);let h={keyframes:l,velocity:e.getVelocity(),ease:"easeOut",...s,delay:-a,onUpdate:p=>{e.set(p),s.onUpdate&&s.onUpdate(p)},onComplete:()=>{i(),s.onComplete&&s.onComplete()}};if(tM(s)||(h={...h,...KO(t,h)}),h.duration&&(h.duration=Lo(h.duration)),h.repeatDelay&&(h.repeatDelay=Lo(h.repeatDelay)),!u||!d||JI.current||s.type===!1||rM.skipAnimations)return VO(h);if(!n.isHandoff&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=zO(e,t,h);if(p)return p}return Wh(h)};function Gh(t){return!!(Tn(t)&&t.add)}const C6=t=>/^\-?\d*\.?\d+$/.test(t);function zg(t,e){t.indexOf(e)===-1&&t.push(e)}function Vg(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class qg{constructor(){this.subscriptions=[]}add(e){return zg(this.subscriptions,e),()=>Vg(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class iM{constructor(e,r={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(n,i=!0)=>{this.prev=this.current,this.current=n;const{delta:s,timestamp:o}=rn;this.lastUpdated!==o&&(this.timeDelta=s,this.lastUpdated=o,zt.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>zt.postRender(this.velocityCheck),this.velocityCheck=({timestamp:n})=>{n!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=nM(this.current),this.owner=r.owner}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new qg);const n=this.events[e].add(r);return e==="change"?()=>{n(),zt.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=e,this.timeDelta=n}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?w6(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function rc(t,e){return new iM(t,e)}const _6=t=>e=>e.test(t),sM={test:t=>t==="auto",parse:t=>t},T6=[Ja,Pe,ls,vo,dI,uI,sM],Vc=t=>T6.find(_6(t)),oM=[...T6,dn,qo],aM=t=>oM.find(_6(t));function lM(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,rc(r))}function cM(t,e){const r=J0(t,e);let{transitionEnd:n={},transition:i={},...s}=r?t.makeTargetAnimatable(r,!1):{};s={...s,...n};for(const o in s){const a=CI(s[o]);lM(t,o,a)}}function fM(t,e,r){var n,i;const s=Object.keys(e).filter(a=>!t.hasValue(a)),o=s.length;if(o)for(let a=0;al.remove(u))),c.push(x)}return o&&Promise.all(c).then(()=>{o&&cM(t,o)}),c}function Ey(t,e,r={}){const n=J0(t,e,r.custom);let{transition:i=t.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);const s=n?()=>Promise.all(P6(t,n,r)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:u}=i;return pM(t,e,c+l,f,u,r)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,c]=a==="beforeChildren"?[s,o]:[o,s];return l().then(()=>c())}else return Promise.all([s(),o(r.delay)])}function pM(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,l=i===1?(c=0)=>c*n:(c=0)=>a-c*n;return Array.from(t.variantChildren).sort(yM).forEach((c,f)=>{c.notify("AnimationStart",e),o.push(Ey(c,e,{...s,delay:r+l(f)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function yM(t,e){return t.sortNodePosition(e)}function mM(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Ey(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Ey(t,e,r);else{const i=typeof e=="function"?J0(t,e,r.custom):e;n=Promise.all(P6(t,i,r))}return n.then(()=>t.notify("AnimationComplete",e))}const gM=[...Ag].reverse(),xM=Ag.length;function bM(t){return e=>Promise.all(e.map(({animation:r,options:n})=>mM(t,r,n)))}function wM(t){let e=bM(t);const r=SM();let n=!0;const i=(l,c)=>{const f=J0(t,c);if(f){const{transition:u,transitionEnd:d,...h}=f;l={...l,...h,...d}}return l};function s(l){e=l(t)}function o(l,c){const f=t.getProps(),u=t.getVariantContext(!0)||{},d=[],h=new Set;let p={},m=1/0;for(let b=0;bm&&N,K=!1;const X=Array.isArray(P)?P:[P];let ee=X.reduce(i,{});I===!1&&(ee={});const{prevResolvedValues:M={}}=E,v={...M,...ee},_=k=>{U=!0,h.has(k)&&(K=!0,h.delete(k)),E.needsAnimating[k]=!0};for(const k in v){const A=ee[k],T=M[k];if(p.hasOwnProperty(k))continue;let O=!1;Vh(A)&&Vh(T)?O=!X4(A,T):O=A!==T,O?A!==void 0?_(k):h.add(k):A!==void 0&&h.has(k)?_(k):E.protectedKeys[k]=!0}E.prevProp=P,E.prevResolvedValues=ee,E.isActive&&(p={...p,...ee}),n&&t.blockInitialAnimation&&(U=!1),U&&(!j||K)&&d.push(...X.map(k=>({animation:k,options:{type:w,...l}})))}if(h.size){const b={};h.forEach(w=>{const E=t.getBaseTarget(w);E!==void 0&&(b[w]=E)}),d.push({animation:b})}let x=!!d.length;return n&&(f.initial===!1||f.initial===f.animate)&&!t.manuallyAnimateOnMount&&(x=!1),n=!1,x?e(d):Promise.resolve()}function a(l,c,f){var u;if(r[l].isActive===c)return Promise.resolve();(u=t.variantChildren)===null||u===void 0||u.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,c)}),r[l].isActive=c;const d=o(f,l);for(const h in r)r[h].protectedKeys={};return d}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r}}function EM(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!X4(e,t):!1}function la(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function SM(){return{animate:la(!0),whileInView:la(),whileHover:la(),whileTap:la(),whileDrag:la(),whileFocus:la(),exit:la()}}class kM extends ta{constructor(e){super(e),e.animationState||(e.animationState=wM(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),G0(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){}}let AM=0;class CM extends ta{constructor(){super(...arguments),this.id=AM++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r,custom:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const s=this.node.animationState.setActive("exit",!e,{custom:n??this.node.getProps().custom});r&&!e&&s.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const _M={animation:{Feature:kM},exit:{Feature:CM}},Q2=(t,e)=>Math.abs(t-e);function TM(t,e){const r=Q2(t.x,e.x),n=Q2(t.y,e.y);return Math.sqrt(r**2+n**2)}class R6{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=xv(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=TM(u.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=u,{timestamp:m}=rn;this.history.push({...p,timestamp:m});const{onStart:x,onMove:b}=this.handlers;d||(x&&x(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,u)},this.handlePointerMove=(u,d)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=gv(d,this.transformPagePoint),zt.update(this.updatePoint,!0)},this.handlePointerUp=(u,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=xv(u.type==="pointercancel"?this.lastMoveEventInfo:gv(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(u,x),p&&p(u,x)},!G4(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=Q0(e),a=gv(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=rn;this.history=[{...l,timestamp:c}];const{onSessionStart:f}=r;f&&f(e,xv(a,this.history)),this.removeListeners=Do(Bs(this.contextWindow,"pointermove",this.handlePointerMove),Bs(this.contextWindow,"pointerup",this.handlePointerUp),Bs(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gs(this.updatePoint)}}function gv(t,e){return e?{point:e(t.point)}:t}function J2(t,e){return{x:t.x-e.x,y:t.y-e.y}}function xv({point:t},e){return{point:t,delta:J2(t,I6(e)),offset:J2(t,PM(e)),velocity:RM(e,.1)}}function PM(t){return t[0]}function I6(t){return t[t.length-1]}function RM(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=I6(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Lo(e)));)r--;if(!n)return{x:0,y:0};const s=Us(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Gn(t){return t.max-t.min}function Sy(t,e=0,r=.01){return Math.abs(t-e)<=r}function X2(t,e,r,n=.5){t.origin=n,t.originPoint=tr(e.min,e.max,t.origin),t.scale=Gn(r)/Gn(e),(Sy(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=tr(r.min,r.max,t.origin)-t.originPoint,(Sy(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Af(t,e,r,n){X2(t.x,e.x,r.x,n?n.originX:void 0),X2(t.y,e.y,r.y,n?n.originY:void 0)}function Z2(t,e,r){t.min=r.min+e.min,t.max=t.min+Gn(e)}function IM(t,e,r){Z2(t.x,e.x,r.x),Z2(t.y,e.y,r.y)}function eE(t,e,r){t.min=e.min-r.min,t.max=t.min+Gn(e)}function Cf(t,e,r){eE(t.x,e.x,r.x),eE(t.y,e.y,r.y)}function OM(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?tr(r,t,n.max):Math.min(t,r)),t}function tE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function MM(t,{top:e,left:r,bottom:n,right:i}){return{x:tE(t.x,r,i),y:tE(t.y,e,n)}}function rE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Zf(e.min,e.max-n,t.min):n>i&&(r=Zf(t.min,t.max-i,e.min)),Vo(0,1,r)}function DM(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const ky=.35;function LM(t=ky){return t===!1?t=0:t===!0&&(t=ky),{x:nE(t,"left","right"),y:nE(t,"top","bottom")}}function nE(t,e,r){return{min:iE(t,e),max:iE(t,r)}}function iE(t,e){return typeof t=="number"?t:t[e]||0}const sE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Rl=()=>({x:sE(),y:sE()}),oE=()=>({min:0,max:0}),kr=()=>({x:oE(),y:oE()});function ai(t){return[t("x"),t("y")]}function O6({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function jM({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function FM(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function bv(t){return t===void 0||t===1}function Ay({scale:t,scaleX:e,scaleY:r}){return!bv(t)||!bv(e)||!bv(r)}function da(t){return Ay(t)||M6(t)||t.z||t.rotate||t.rotateX||t.rotateY}function M6(t){return aE(t.x)||aE(t.y)}function aE(t){return t&&t!=="0%"}function Kh(t,e,r){const n=t-r,i=e*n;return r+i}function lE(t,e,r,n,i){return i!==void 0&&(t=Kh(t,i,n)),Kh(t,r,n)+e}function Cy(t,e=0,r=1,n,i){t.min=lE(t.min,e,r,n,i),t.max=lE(t.max,e,r,n,i)}function N6(t,{x:e,y:r}){Cy(t.x,e.translate,e.scale,e.originPoint),Cy(t.y,r.translate,r.scale,r.originPoint)}function BM(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function bo(t,e){t.min=t.min+e,t.max=t.max+e}function fE(t,e,[r,n,i]){const s=e[i]!==void 0?e[i]:.5,o=tr(t.min,t.max,s);Cy(t,e[r],e[n],o,e.scale)}const UM=["x","scaleX","originX"],zM=["y","scaleY","originY"];function Il(t,e){fE(t.x,e,UM),fE(t.y,e,zM)}function $6(t,e){return O6(FM(t.getBoundingClientRect(),e))}function VM(t,e,r){const n=$6(t,r),{scroll:i}=e;return i&&(bo(n.x,i.offset.x),bo(n.y,i.offset.y)),n}const D6=({current:t})=>t?t.ownerDocument.defaultView:null,qM=new WeakMap;class HM{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=kr(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=f=>{const{dragSnapToOrigin:u}=this.getProps();u?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Q0(f,"page").point)},s=(f,u)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Y4(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ai(x=>{let b=this.getAxisMotionValue(x).get()||0;if(ls.test(b)){const{projection:w}=this.visualElement;if(w&&w.layout){const E=w.layout.layoutBox[x];E&&(b=Gn(E)*(parseFloat(b)/100))}}this.originPoint[x]=b}),p&&zt.update(()=>p(f,u),!1,!0);const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(f,u)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:x}=u;if(h&&this.currentDirection===null){this.currentDirection=WM(x),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",u.point,x),this.updateAxis("y",u.point,x),this.visualElement.render(),m&&m(f,u)},a=(f,u)=>this.stop(f,u),l=()=>ai(f=>{var u;return this.getAnimationState(f)==="paused"&&((u=this.getAxisMotionValue(f).animation)===null||u===void 0?void 0:u.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new R6(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:D6(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&zt.update(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!hd(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=OM(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Tl(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=MM(i.layoutBox,r):this.constraints=!1,this.elastic=LM(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&ai(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=DM(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Tl(e))return!1;const n=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=VM(n,i.root,this.visualElement.getTransformPagePoint());let o=NM(i.layout.layoutBox,s);if(r){const a=r(jM(o));this.hasMutatedConstraints=!!a,a&&(o=O6(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=ai(f=>{if(!hd(f,r,this.currentDirection))return;let u=l&&l[f]||{};o&&(u={min:0,max:0});const d=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:n?e[f]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...s,...u};return this.startAxisValueAnimation(f,p)});return Promise.all(c).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return n.start(Ug(e,n,0,r))}stopAnimation(){ai(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ai(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r="_drag"+e.toUpperCase(),n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ai(r=>{const{drag:n}=this.getProps();if(!hd(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-tr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Tl(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ai(o=>{const a=this.getAxisMotionValue(o);if(a){const l=a.get();i[o]=$M({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ai(o=>{if(!hd(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(tr(l,c,i[o]))})}addListeners(){if(!this.visualElement.current)return;qM.set(this.visualElement,this);const e=this.visualElement.current,r=Bs(e,"pointerdown",l=>{const{drag:c,dragListener:f=!0}=this.getProps();c&&f&&this.start(l)}),n=()=>{const{dragConstraints:l}=this.getProps();Tl(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),n();const o=Ls(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(ai(f=>{const u=this.getAxisMotionValue(f);u&&(this.originPoint[f]+=l[f].translate,u.set(u.get()+l[f].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=ky,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function hd(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function WM(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class GM extends ta{constructor(e){super(e),this.removeGroupControls=cr,this.removeListeners=cr,this.controls=new HM(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||cr}unmount(){this.removeGroupControls(),this.removeListeners()}}const uE=t=>(e,r)=>{t&&zt.update(()=>t(e,r))};class KM extends ta{constructor(){super(...arguments),this.removePointerDownListener=cr}onPointerDown(e){this.session=new R6(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:D6(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:uE(e),onStart:uE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&zt.update(()=>i(s,o))}}}mount(){this.removePointerDownListener=Bs(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function YM(){const t=y.useContext(H0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=y.useId();return y.useEffect(()=>n(i),[]),!e&&r?[!1,()=>r&&r(i)]:[!0]}const Xd={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function dE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const qc={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Pe.test(t))t=parseFloat(t);else return t;const r=dE(t,e.target.x),n=dE(t,e.target.y);return`${r}% ${n}%`}},QM={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=qo.parse(t);if(i.length>5)return n;const s=qo.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,l=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=l;const c=tr(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=c),typeof i[3+o]=="number"&&(i[3+o]/=c),s(i)}};class JM extends vr.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;iI(XM),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Xd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||zt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),queueMicrotask(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function L6(t){const[e,r]=YM(),n=y.useContext(_g);return vr.createElement(JM,{...t,layoutGroup:n,switchLayoutGroup:y.useContext(O4),isPresent:e,safeToRemove:r})}const XM={borderRadius:{...qc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:qc,borderTopRightRadius:qc,borderBottomLeftRadius:qc,borderBottomRightRadius:qc,boxShadow:QM},j6=["TopLeft","TopRight","BottomLeft","BottomRight"],ZM=j6.length,hE=t=>typeof t=="string"?parseFloat(t):t,vE=t=>typeof t=="number"||Pe.test(t);function eN(t,e,r,n,i,s){i?(t.opacity=tr(0,r.opacity!==void 0?r.opacity:1,tN(n)),t.opacityExit=tr(e.opacity!==void 0?e.opacity:1,0,rN(n))):s&&(t.opacity=tr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Zf(t,e,n))}function yE(t,e){t.min=e.min,t.max=e.max}function ii(t,e){yE(t.x,e.x),yE(t.y,e.y)}function mE(t,e,r,n,i){return t-=e,t=Kh(t,1/r,n),i!==void 0&&(t=Kh(t,1/i,n)),t}function nN(t,e=0,r=1,n=.5,i,s=t,o=t){if(ls.test(e)&&(e=parseFloat(e),e=tr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=tr(s.min,s.max,n);t===s&&(a-=e),t.min=mE(t.min,e,r,a,i),t.max=mE(t.max,e,r,a,i)}function gE(t,e,[r,n,i],s,o){nN(t,e[r],e[n],e[i],e.scale,s,o)}const iN=["x","scaleX","originX"],sN=["y","scaleY","originY"];function xE(t,e,r,n){gE(t.x,e,iN,r?r.x:void 0,n?n.x:void 0),gE(t.y,e,sN,r?r.y:void 0,n?n.y:void 0)}function bE(t){return t.translate===0&&t.scale===1}function B6(t){return bE(t.x)&&bE(t.y)}function oN(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function U6(t,e){return Math.round(t.x.min)===Math.round(e.x.min)&&Math.round(t.x.max)===Math.round(e.x.max)&&Math.round(t.y.min)===Math.round(e.y.min)&&Math.round(t.y.max)===Math.round(e.y.max)}function wE(t){return Gn(t.x)/Gn(t.y)}class aN{constructor(){this.members=[]}add(e){zg(this.members,e),e.scheduleRender()}remove(e){if(Vg(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function EE(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y;if((i||s)&&(n=`translate3d(${i}px, ${s}px, 0) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{rotate:l,rotateX:c,rotateY:f}=r;l&&(n+=`rotate(${l}deg) `),c&&(n+=`rotateX(${c}deg) `),f&&(n+=`rotateY(${f}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(n+=`scale(${o}, ${a})`),n||"none"}const lN=(t,e)=>t.depth-e.depth;class cN{constructor(){this.children=[],this.isDirty=!1}add(e){zg(this.children,e),this.isDirty=!0}remove(e){Vg(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(lN),this.isDirty=!1,this.children.forEach(e)}}function fN(t,e){const r=performance.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(Gs(n),t(s-e))};return zt.read(n,!0),()=>Gs(n)}function uN(t){window.MotionDebug&&window.MotionDebug.record(t)}function dN(t){return t instanceof SVGElement&&t.tagName!=="svg"}function hN(t,e,r){const n=Tn(t)?t:rc(t);return n.start(Ug("",n,e,r)),n.animation}const SE=["","X","Y","Z"],vN={visibility:"hidden"},kE=1e3;let pN=0;const ha={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function z6({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=pN++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ha.totalNodes=ha.resolvedTargetDeltas=ha.recalculatedProjection=0,this.nodes.forEach(gN),this.nodes.forEach(SN),this.nodes.forEach(kN),this.nodes.forEach(xN),uN(ha)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,u&&u(),u=fN(d,250),Xd.hasAnimatedSinceResize&&(Xd.hasAnimatedSinceResize=!1,this.nodes.forEach(CE))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&f&&(l||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||f.getDefaultTransition()||PN,{onLayoutAnimationStart:x,onLayoutAnimationComplete:b}=f.getProps(),w=!this.targetLayout||!U6(this.targetLayout,p)||h,E=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||d&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(u,E);const P={...Bg(m,"layout"),onPlay:x,onComplete:b};(f.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P)}else d||CE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(AN),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;fthis.update()))}clearAllSnapshots(){this.nodes.forEach(bN),this.sharedNodes.forEach(CN)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,zt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){zt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const N=P/1e3;_E(u.x,o.x,N),_E(u.y,o.y,N),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cf(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),_N(this.relativeTarget,this.relativeTargetOrigin,d,N),E&&oN(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=kr()),ii(E,this.relativeTarget)),m&&(this.animationValues=f,eN(f,c,this.latestValues,N,w,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=N},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Gs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=zt.update(()=>{Xd.hasAnimatedSinceResize=!0,this.currentAnimation=hN(0,kE,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(kE),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:f}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&V6(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||kr();const u=Gn(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+u;const d=Gn(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}ii(a,l),Il(a,f),Af(this.projectionDeltaWithTransform,this.layoutCorrected,a,f)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new aN),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const c={};for(let f=0;f{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(AE),this.root.sharedNodes.clear()}}}function yN(t){t.updateLayout()}function mN(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?ai(u=>{const d=o?r.measuredBox[u]:r.layoutBox[u],h=Gn(d);d.min=n[u].min,d.max=d.min+h}):V6(s,r.layoutBox,n)&&ai(u=>{const d=o?r.measuredBox[u]:r.layoutBox[u],h=Gn(n[u]);d.max=d.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+h)});const a=Rl();Af(a,n,r.layoutBox);const l=Rl();o?Af(l,t.applyTransform(i,!0),r.measuredBox):Af(l,n,r.layoutBox);const c=!B6(a);let f=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:d,layout:h}=u;if(d&&h){const p=kr();Cf(p,r.layoutBox,d.layoutBox);const m=kr();Cf(m,n,h.layoutBox),U6(p,m)||(f=!0),u.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=p,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:f})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function gN(t){ha.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function xN(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function bN(t){t.clearSnapshot()}function AE(t){t.clearMeasurements()}function wN(t){t.isLayoutDirty=!1}function EN(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function CE(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function SN(t){t.resolveTargetDelta()}function kN(t){t.calcProjection()}function AN(t){t.resetRotation()}function CN(t){t.removeLeadSnapshot()}function _E(t,e,r){t.translate=tr(e.translate,0,r),t.scale=tr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function TE(t,e,r,n){t.min=tr(e.min,r.min,n),t.max=tr(e.max,r.max,n)}function _N(t,e,r,n){TE(t.x,e.x,r.x,n),TE(t.y,e.y,r.y,n)}function TN(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const PN={duration:.45,ease:[.4,0,.1,1]},PE=t=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(t),RE=PE("applewebkit/")&&!PE("chrome/")?Math.round:cr;function IE(t){t.min=RE(t.min),t.max=RE(t.max)}function RN(t){IE(t.x),IE(t.y)}function V6(t,e,r){return t==="position"||t==="preserve-aspect"&&!Sy(wE(e),wE(r),.2)}const IN=z6({attachResizeListener:(t,e)=>Ls(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),wv={current:void 0},q6=z6({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!wv.current){const t=new IN({});t.mount(window),t.setOptions({layoutScroll:!0}),wv.current=t}return wv.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),ON={pan:{Feature:KM},drag:{Feature:GM,ProjectionNode:q6,MeasureLayout:L6}},MN=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function NN(t){const e=MN.exec(t);if(!e)return[,];const[,r,n]=e;return[r,n]}function _y(t,e,r=1){const[n,i]=NN(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return C6(o)?parseFloat(o):o}else return yy(i)?_y(i,e,r+1):i}function $N(t,{...e},r){const n=t.current;if(!(n instanceof Element))return{target:e,transitionEnd:r};r&&(r={...r}),t.values.forEach(i=>{const s=i.get();if(!yy(s))return;const o=_y(s,n);o&&i.set(o)});for(const i in e){const s=e[i];if(!yy(s))continue;const o=_y(s,n);o&&(e[i]=o,r||(r={}),r[i]===void 0&&(r[i]=s))}return{target:e,transitionEnd:r}}const DN=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),H6=t=>DN.has(t),LN=t=>Object.keys(t).some(H6),OE=t=>t===Ja||t===Pe,ME=(t,e)=>parseFloat(t.split(", ")[e]),NE=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/);if(i)return ME(i[1],e);{const s=n.match(/^matrix\((.+)\)$/);return s?ME(s[1],t):0}},jN=new Set(["x","y","z"]),FN=Iu.filter(t=>!jN.has(t));function BN(t){const e=[];return FN.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e.length&&t.render(),e}const nc={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:NE(4,13),y:NE(5,14)};nc.translateX=nc.x;nc.translateY=nc.y;const UN=(t,e,r)=>{const n=e.measureViewportBox(),i=e.current,s=getComputedStyle(i),{display:o}=s,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),r.forEach(c=>{a[c]=nc[c](n,s)}),e.render();const l=e.measureViewportBox();return r.forEach(c=>{const f=e.getValue(c);f&&f.jump(a[c]),t[c]=nc[c](l,s)}),t},zN=(t,e,r={},n={})=>{e={...e},n={...n};const i=Object.keys(e).filter(H6);let s=[],o=!1;const a=[];if(i.forEach(l=>{const c=t.getValue(l);if(!t.hasValue(l))return;let f=r[l],u=Vc(f);const d=e[l];let h;if(Vh(d)){const p=d.length,m=d[0]===null?1:0;f=d[m],u=Vc(f);for(let x=m;x=0?window.pageYOffset:null,c=UN(e,t,a);return s.length&&s.forEach(([f,u])=>{t.getValue(f).set(u)}),t.render(),W0&&l!==null&&window.scrollTo({top:l}),{target:c,transitionEnd:n}}else return{target:e,transitionEnd:n}};function VN(t,e,r,n){return LN(e)?zN(t,e,r,n):{target:e,transitionEnd:n}}const qN=(t,e,r,n)=>{const i=$N(t,e,n);return e=i.target,n=i.transitionEnd,VN(t,e,r,n)},Ty={current:null},W6={current:!1};function HN(){if(W6.current=!0,!!W0)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Ty.current=t.matches;t.addListener(e),e()}else Ty.current=!1}function WN(t,e,r){const{willChange:n}=e;for(const i in e){const s=e[i],o=r[i];if(Tn(s))t.addValue(i,s),Gh(n)&&n.add(i);else if(Tn(o))t.addValue(i,rc(s,{owner:t})),Gh(n)&&n.remove(i);else if(o!==s)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(s)}else{const a=t.getStaticValue(i);t.addValue(i,rc(a!==void 0?a:s,{owner:t}))}}for(const i in r)e[i]===void 0&&t.removeValue(i);return e}const $E=new WeakMap,G6=Object.keys(Xf),GN=G6.length,DE=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],KN=Cg.length;class YN{constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,visualState:s},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>zt.render(this.render,!1,!0);const{latestValues:a,renderState:l}=s;this.latestValues=a,this.baseTarget={...a},this.initialValues=r.initial?{...a}:{},this.renderState=l,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=K0(r),this.isVariantNode=I4(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(r,{});for(const u in f){const d=f[u];a[u]!==void 0&&Tn(d)&&(d.set(a[u],!1),Gh(c)&&c.add(u))}}scrapeMotionValuesFromProps(e,r){return{}}mount(e){this.current=e,$E.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),W6.current||HN(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Ty.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$E.delete(this.current),this.projection&&this.projection.unmount(),Gs(this.notifyUpdate),Gs(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,r){const n=Qa.has(e),i=r.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&zt.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),s()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...r},n,i,s){let o,a;for(let l=0;lthis.scheduleRender(),animationType:typeof c=="string"?c:"both",initialPromotionConfig:s,layoutScroll:d,layoutRoot:h})}return a}updateFeatures(){for(const e in this.features){const r=this.features[e];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):kr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}makeTargetAnimatable(e,r=!0){return this.makeTargetAnimatableFromInstance(e,this.props,r)}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){r!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,r)),this.values.set(e,r),this.latestValues[e]=r.get()}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=rc(r,{owner:this}),this.addValue(e,n)),n}readValue(e){var r;return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props,i=typeof n=="string"||typeof n=="object"?(r=Ng(this.props,n))===null||r===void 0?void 0:r[e]:void 0;if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Tn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new qg),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class K6 extends YN{sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:r,...n},{transformValues:i},s){let o=dM(n,e||{},this);if(i&&(r&&(r=i(r)),n&&(n=i(n)),o&&(o=i(o))),s){fM(this,n,o);const a=qN(this,n,o,r);r=a.transitionEnd,n=a.target}return{transition:e,transitionEnd:r,...n}}}function QN(t){return window.getComputedStyle(t)}class JN extends K6{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,r){if(Qa.has(r)){const n=Fg(r);return n&&n.default||0}else{const n=QN(e),i=($4(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return $6(e,r)}build(e,r,n,i){Pg(e,r,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,r){return Mg(e,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Tn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}renderInstance(e,r,n,i){U4(e,r,n,i)}}class XN extends K6{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Qa.has(r)){const n=Fg(r);return n&&n.default||0}return r=z4.has(r)?r:kg(r),e.getAttribute(r)}measureInstanceViewportBox(){return kr()}scrapeMotionValuesFromProps(e,r){return q4(e,r)}build(e,r,n,i){Ig(e,r,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,r,n,i){V4(e,r,n,i)}mount(e){this.isSVGTag=Og(e.tagName),super.mount(e)}}const ZN=(t,e)=>Tg(t)?new XN(e,{enableHardwareAcceleration:!1}):new JN(e,{enableHardwareAcceleration:!0}),e$={layout:{ProjectionNode:q6,MeasureLayout:L6}},t$={..._M,...GI,...ON,...e$},Ta=rI((t,e)=>NI(t,e,t$,ZN));function Y6(){const t=y.useRef(!1);return Sg(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function r$(){const t=Y6(),[e,r]=y.useState(0),n=y.useCallback(()=>{t.current&&r(e+1)},[e]);return[y.useCallback(()=>zt.postRender(n),[n]),e]}class n$ extends y.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function i$({children:t,isPresent:e}){const r=y.useId(),n=y.useRef(null),i=y.useRef({width:0,height:0,top:0,left:0});return y.useInsertionEffect(()=>{const{width:s,height:o,top:a,left:l}=i.current;if(e||!n.current||!s||!o)return;n.current.dataset.motionPopId=r;const c=document.createElement("style");return document.head.appendChild(c),c.sheet&&c.sheet.insertRule(` +`+s.stack}return{value:t,source:e,stack:i,digest:null}}function ov(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function ry(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var wR=typeof WeakMap=="function"?WeakMap:Map;function Z3(t,e,r){r=Fs(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Lh||(Lh=!0,dy=n),ry(t,e)},r}function e4(t,e,r){r=Fs(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var i=e.value;r.payload=function(){return n(i)},r.callback=function(){ry(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){ry(t,e),typeof n!="function"&&(Mo===null?Mo=new Set([this]):Mo.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function v2(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new wR;var i=new Set;n.set(e,i)}else i=n.get(e),i===void 0&&(i=new Set,n.set(e,i));i.has(r)||(i.add(r),t=$R.bind(null,t,e,r),e.then(t,t))}function p2(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function y2(t,e,r,n,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Fs(-1,1),e.tag=2,Oo(r,e,1))),r.lanes|=1),t)}var ER=to.ReactCurrentOwner,Sn=!1;function vn(t,e,r,n){e.child=t===null?P3(e,null,r,n):Xl(e,t.child,r,n)}function m2(t,e,r,n,i){r=r.render;var s=e.ref;return Fl(e,i),n=ag(t,e,r,n,s,i),r=lg(),t!==null&&!Sn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Ws(t,e,i)):(Kt&&r&&Ym(e),e.flags|=1,vn(t,e,n,i),e.child)}function g2(t,e,r,n,i){if(t===null){var s=r.type;return typeof s=="function"&&!gg(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=s,t4(t,e,s,n,i)):(t=Qd(r.type,null,n,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Uf,r(o,n)&&t.ref===e.ref)return Ws(t,e,i)}return e.flags|=1,t=$o(s,n),t.ref=e.ref,t.return=e,e.child=t}function t4(t,e,r,n,i){if(t!==null){var s=t.memoizedProps;if(Uf(s,n)&&t.ref===e.ref)if(Sn=!1,e.pendingProps=n=s,(t.lanes&i)!==0)t.flags&131072&&(Sn=!0);else return e.lanes=t.lanes,Ws(t,e,i)}return ny(t,e,r,n,i)}function r4(t,e,r){var n=e.pendingProps,i=n.children,s=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ut(_l,Dn),Dn|=r;else{if(!(r&1073741824))return t=s!==null?s.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Ut(_l,Dn),Dn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,Ut(_l,Dn),Dn|=n}else s!==null?(n=s.baseLanes|r,e.memoizedState=null):n=r,Ut(_l,Dn),Dn|=n;return vn(t,e,i,r),e.child}function n4(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function ny(t,e,r,n,i){var s=An(r)?Na:ln.current;return s=Ql(e,s),Fl(e,i),r=ag(t,e,r,n,s,i),n=lg(),t!==null&&!Sn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Ws(t,e,i)):(Kt&&n&&Ym(e),e.flags|=1,vn(t,e,r,i),e.child)}function x2(t,e,r,n,i){if(An(r)){var s=!0;_h(e)}else s=!1;if(Fl(e,i),e.stateNode===null)Gd(t,e),X3(e,r,n),ty(e,r,n,i),n=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=r.contextType;typeof c=="object"&&c!==null?c=vi(c):(c=An(r)?Na:ln.current,c=Ql(e,c));var f=r.getDerivedStateFromProps,u=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||l!==c)&&h2(e,o,n,c),xo=!1;var d=e.memoizedState;o.state=d,Oh(e,n,o,i),l=e.memoizedState,a!==n||d!==l||kn.current||xo?(typeof f=="function"&&(ey(e,r,f,n),l=e.memoizedState),(a=xo||d2(e,r,a,n,d,l,c))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=l),o.props=n,o.state=l,o.context=c,n=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,I3(t,e),a=e.memoizedProps,c=e.type===e.elementType?a:Ci(e.type,a),o.props=c,u=e.pendingProps,d=o.context,l=r.contextType,typeof l=="object"&&l!==null?l=vi(l):(l=An(r)?Na:ln.current,l=Ql(e,l));var h=r.getDerivedStateFromProps;(f=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||d!==l)&&h2(e,o,n,l),xo=!1,d=e.memoizedState,o.state=d,Oh(e,n,o,i);var p=e.memoizedState;a!==u||d!==p||kn.current||xo?(typeof h=="function"&&(ey(e,r,h,n),p=e.memoizedState),(c=xo||d2(e,r,c,n,d,p,l)||!1)?(f||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,p,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,p,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=p),o.props=n,o.state=p,o.context=l,n=c):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),n=!1)}return iy(t,e,r,n,s,i)}function iy(t,e,r,n,i,s){n4(t,e);var o=(e.flags&128)!==0;if(!n&&!o)return i&&i2(e,r,!1),Ws(t,e,s);n=e.stateNode,ER.current=e;var a=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&o?(e.child=Xl(e,t.child,null,s),e.child=Xl(e,null,a,s)):vn(t,e,a,s),e.memoizedState=n.state,i&&i2(e,r,!0),e.child}function i4(t){var e=t.stateNode;e.pendingContext?n2(t,e.pendingContext,e.pendingContext!==e.context):e.context&&n2(t,e.context,!1),ng(t,e.containerInfo)}function b2(t,e,r,n,i){return Jl(),Jm(i),e.flags|=256,vn(t,e,r,n),e.child}var sy={dehydrated:null,treeContext:null,retryLane:0};function oy(t){return{baseLanes:t,cachePool:null,transitions:null}}function s4(t,e,r){var n=e.pendingProps,i=Xt.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Ut(Xt,i&1),t===null)return Xp(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=n.children,t=n.fallback,s?(n=e.mode,s=e.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=F0(o,n,0,null),t=_a(t,n,r,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=oy(r),e.memoizedState=sy,t):ug(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return SR(t,e,o,n,a,i,r);if(s){s=n.fallback,o=e.mode,i=t.child,a=i.sibling;var l={mode:"hidden",children:n.children};return!(o&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=l,e.deletions=null):(n=$o(i,l),n.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=$o(a,s):(s=_a(s,o,r,null),s.flags|=2),s.return=e,n.return=e,n.sibling=s,e.child=n,n=s,s=e.child,o=t.child.memoizedState,o=o===null?oy(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~r,e.memoizedState=sy,n}return s=t.child,t=s.sibling,n=$o(s,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function ug(t,e){return e=F0({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function od(t,e,r,n){return n!==null&&Jm(n),Xl(e,t.child,null,r),t=ug(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function SR(t,e,r,n,i,s,o){if(r)return e.flags&256?(e.flags&=-257,n=ov(Error(ue(422))),od(t,e,o,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=n.fallback,i=e.mode,n=F0({mode:"visible",children:n.children},i,0,null),s=_a(s,i,o,null),s.flags|=2,n.return=e,s.return=e,n.sibling=s,e.child=n,e.mode&1&&Xl(e,t.child,null,o),e.child.memoizedState=oy(o),e.memoizedState=sy,s);if(!(e.mode&1))return od(t,e,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var a=n.dgst;return n=a,s=Error(ue(419)),n=ov(s,n,void 0),od(t,e,o,n)}if(a=(o&t.childLanes)!==0,Sn||a){if(n=jr,n!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Hs(t,i),Ni(n,t,i,-1))}return mg(),n=ov(Error(ue(421))),od(t,e,o,n)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=DR.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,Vn=Io(i.nextSibling),qn=e,Kt=!0,Ii=null,t!==null&&(fi[ui++]=$s,fi[ui++]=Ds,fi[ui++]=$a,$s=t.id,Ds=t.overflow,$a=e),e=ug(e,n.children),e.flags|=4096,e)}function w2(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),Zp(t.return,e,r)}function av(t,e,r,n,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function o4(t,e,r){var n=e.pendingProps,i=n.revealOrder,s=n.tail;if(vn(t,e,n.children,r),n=Xt.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&w2(t,r,e);else if(t.tag===19)w2(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(Ut(Xt,n),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(r=e.child,i=null;r!==null;)t=r.alternate,t!==null&&Mh(t)===null&&(i=r),r=r.sibling;r=i,r===null?(i=e.child,e.child=null):(i=r.sibling,r.sibling=null),av(e,!1,i,r,s);break;case"backwards":for(r=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Mh(t)===null){e.child=i;break}t=i.sibling,i.sibling=r,r=i,i=t}av(e,!0,r,null,s);break;case"together":av(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Gd(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Ws(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),La|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(ue(153));if(e.child!==null){for(t=e.child,r=$o(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=$o(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function kR(t,e,r){switch(e.tag){case 3:i4(e),Jl();break;case 5:O3(e);break;case 1:An(e.type)&&_h(e);break;case 4:ng(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;Ut(Rh,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Ut(Xt,Xt.current&1),e.flags|=128,null):r&e.child.childLanes?s4(t,e,r):(Ut(Xt,Xt.current&1),t=Ws(t,e,r),t!==null?t.sibling:null);Ut(Xt,Xt.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return o4(t,e,r);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ut(Xt,Xt.current),n)break;return null;case 22:case 23:return e.lanes=0,r4(t,e,r)}return Ws(t,e,r)}var a4,ay,l4,c4;a4=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};ay=function(){};l4=function(t,e,r,n){var i=t.memoizedProps;if(i!==n){t=e.stateNode,xa(as.current);var s=null;switch(r){case"input":i=Pp(t,i),n=Pp(t,n),s=[];break;case"select":i=nr({},i,{value:void 0}),n=nr({},n,{value:void 0}),s=[];break;case"textarea":i=Op(t,i),n=Op(t,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Ah)}Np(r,n);var o;r=null;for(c in i)if(!n.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Nf.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in n){var l=n[c];if(a=i!=null?i[c]:void 0,n.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(s||(s=[]),s.push(c,r)),r=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Nf.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&qt("scroll",t),s||a===l||(s=[])):(s=s||[]).push(c,l))}r&&(s=s||[]).push("style",r);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};c4=function(t,e,r,n){r!==n&&(e.flags|=4)};function Uc(t,e){if(!Kt)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function tn(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function AR(t,e,r){var n=e.pendingProps;switch(Qm(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tn(e),null;case 1:return An(e.type)&&Ch(),tn(e),null;case 3:return n=e.stateNode,Zl(),Ht(kn),Ht(ln),sg(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(id(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Ii!==null&&(py(Ii),Ii=null))),ay(t,e),tn(e),null;case 5:ig(e);var i=xa(Wf.current);if(r=e.type,t!==null&&e.stateNode!=null)l4(t,e,r,n,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(ue(166));return tn(e),null}if(t=xa(as.current),id(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[Xi]=e,n[qf]=s,t=(e.mode&1)!==0,r){case"dialog":qt("cancel",n),qt("close",n);break;case"iframe":case"object":case"embed":qt("load",n);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[Xi]=e,t[qf]=n,a4(t,e,!1,!1),e.stateNode=t;e:{switch(o=$p(r,n),r){case"dialog":qt("cancel",t),qt("close",t),i=n;break;case"iframe":case"object":case"embed":qt("load",t),i=n;break;case"video":case"audio":for(i=0;itc&&(e.flags|=128,n=!0,Uc(s,!1),e.lanes=4194304)}else{if(!n)if(t=Mh(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Uc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Kt)return tn(e),null}else 2*br()-s.renderingStartTime>tc&&r!==1073741824&&(e.flags|=128,n=!0,Uc(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=br(),e.sibling=null,r=Xt.current,Ut(Xt,n?r&1|2:r&1),e):(tn(e),null);case 22:case 23:return yg(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?Dn&1073741824&&(tn(e),e.subtreeFlags&6&&(e.flags|=8192)):tn(e),null;case 24:return null;case 25:return null}throw Error(ue(156,e.tag))}function CR(t,e){switch(Qm(e),e.tag){case 1:return An(e.type)&&Ch(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Zl(),Ht(kn),Ht(ln),sg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return ig(e),null;case 13:if(Ht(Xt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ue(340));Jl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ht(Xt),null;case 4:return Zl(),null;case 10:return eg(e.type._context),null;case 22:case 23:return yg(),null;case 24:return null;default:return null}}var ad=!1,nn=!1,_R=typeof WeakSet=="function"?WeakSet:Set,xe=null;function Cl(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ar(t,e,n)}else r.current=null}function ly(t,e,r){try{r()}catch(n){ar(t,e,n)}}var E2=!1;function TR(t,e){if(Hp=Eh,t=v3(),Km(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,l=-1,c=0,f=0,u=t,d=null;t:for(;;){for(var h;u!==r||i!==0&&u.nodeType!==3||(a=o+i),u!==s||n!==0&&u.nodeType!==3||(l=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(h=u.firstChild)!==null;)d=u,u=h;for(;;){if(u===t)break t;if(d===r&&++c===i&&(a=o),d===s&&++f===n&&(l=o),(h=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=h}r=a===-1||l===-1?null:{start:a,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(Wp={focusedElem:t,selectionRange:r},Eh=!1,xe=e;xe!==null;)if(e=xe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,xe=t;else for(;xe!==null;){e=xe;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,x=p.memoizedState,b=e.stateNode,w=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:Ci(e.type,m),x);b.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ue(163))}}catch(P){ar(e,e.return,P)}if(t=e.sibling,t!==null){t.return=e.return,xe=t;break}xe=e.return}return p=E2,E2=!1,p}function bf(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&ly(e,r,s)}i=i.next}while(i!==n)}}function L0(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function cy(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function f4(t){var e=t.alternate;e!==null&&(t.alternate=null,f4(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Xi],delete e[qf],delete e[Yp],delete e[fR],delete e[uR])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function u4(t){return t.tag===5||t.tag===3||t.tag===4}function S2(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||u4(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function fy(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ah));else if(n!==4&&(t=t.child,t!==null))for(fy(t,e,r),t=t.sibling;t!==null;)fy(t,e,r),t=t.sibling}function uy(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(uy(t,e,r),t=t.sibling;t!==null;)uy(t,e,r),t=t.sibling}var qr=null,Ti=!1;function co(t,e,r){for(r=r.child;r!==null;)d4(t,e,r),r=r.sibling}function d4(t,e,r){if(os&&typeof os.onCommitFiberUnmount=="function")try{os.onCommitFiberUnmount(P0,r)}catch{}switch(r.tag){case 5:nn||Cl(r,e);case 6:var n=qr,i=Ti;qr=null,co(t,e,r),qr=n,Ti=i,qr!==null&&(Ti?(t=qr,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):qr.removeChild(r.stateNode));break;case 18:qr!==null&&(Ti?(t=qr,r=r.stateNode,t.nodeType===8?ev(t.parentNode,r):t.nodeType===1&&ev(t,r),Ff(t)):ev(qr,r.stateNode));break;case 4:n=qr,i=Ti,qr=r.stateNode.containerInfo,Ti=!0,co(t,e,r),qr=n,Ti=i;break;case 0:case 11:case 14:case 15:if(!nn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&ly(r,e,o),i=i.next}while(i!==n)}co(t,e,r);break;case 1:if(!nn&&(Cl(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){ar(r,e,a)}co(t,e,r);break;case 21:co(t,e,r);break;case 22:r.mode&1?(nn=(n=nn)||r.memoizedState!==null,co(t,e,r),nn=n):co(t,e,r);break;default:co(t,e,r)}}function k2(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new _R),e.forEach(function(n){var i=LR.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function wi(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=br()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*RR(n/1960))-n,10t?16:t,Co===null)var n=!1;else{if(t=Co,Co=null,jh=0,tt&6)throw Error(ue(331));var i=tt;for(tt|=4,xe=t.current;xe!==null;){var s=xe,o=s.child;if(xe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lbr()-vg?Ca(t,0):hg|=r),Cn(t,e)}function b4(t,e){e===0&&(t.mode&1?(e=Xu,Xu<<=1,!(Xu&130023424)&&(Xu=4194304)):e=1);var r=yn();t=Hs(t,e),t!==null&&(_u(t,e,r),Cn(t,r))}function DR(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),b4(t,r)}function LR(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(ue(314))}n!==null&&n.delete(e),b4(t,r)}var w4;w4=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||kn.current)Sn=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Sn=!1,kR(t,e,r);Sn=!!(t.flags&131072)}else Sn=!1,Kt&&e.flags&1048576&&A3(e,Ph,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;Gd(t,e),t=e.pendingProps;var i=Ql(e,ln.current);Fl(e,r),i=ag(null,e,n,t,i,r);var s=lg();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,An(n)?(s=!0,_h(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,rg(e),i.updater=D0,e.stateNode=i,i._reactInternals=e,ty(e,n,t,r),e=iy(null,e,n,!0,s,r)):(e.tag=0,Kt&&s&&Ym(e),vn(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(Gd(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=FR(n),t=Ci(n,t),i){case 0:e=ny(null,e,n,t,r);break e;case 1:e=x2(null,e,n,t,r);break e;case 11:e=m2(null,e,n,t,r);break e;case 14:e=g2(null,e,n,Ci(n.type,t),r);break e}throw Error(ue(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),ny(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),x2(t,e,n,i,r);case 3:e:{if(i4(e),t===null)throw Error(ue(387));n=e.pendingProps,s=e.memoizedState,i=s.element,I3(t,e),Oh(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ec(Error(ue(423)),e),e=b2(t,e,n,r,i);break e}else if(n!==i){i=ec(Error(ue(424)),e),e=b2(t,e,n,r,i);break e}else for(Vn=Io(e.stateNode.containerInfo.firstChild),qn=e,Kt=!0,Ii=null,r=P3(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Jl(),n===i){e=Ws(t,e,r);break e}vn(t,e,n,r)}e=e.child}return e;case 5:return O3(e),t===null&&Xp(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,Gp(n,i)?o=null:s!==null&&Gp(n,s)&&(e.flags|=32),n4(t,e),vn(t,e,o,r),e.child;case 6:return t===null&&Xp(e),null;case 13:return s4(t,e,r);case 4:return ng(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Xl(e,null,n,r):vn(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),m2(t,e,n,i,r);case 7:return vn(t,e,e.pendingProps,r),e.child;case 8:return vn(t,e,e.pendingProps.children,r),e.child;case 12:return vn(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,Ut(Rh,n._currentValue),n._currentValue=o,s!==null)if(Li(s.value,o)){if(s.children===i.children&&!kn.current){e=Ws(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===n){if(s.tag===1){l=Fs(-1,r&-r),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Zp(s.return,r,e),a.lanes|=r;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ue(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Zp(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}vn(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Fl(e,r),i=vi(i),n=n(i),e.flags|=1,vn(t,e,n,r),e.child;case 14:return n=e.type,i=Ci(n,e.pendingProps),i=Ci(n.type,i),g2(t,e,n,i,r);case 15:return t4(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Ci(n,i),Gd(t,e),e.tag=1,An(n)?(t=!0,_h(e)):t=!1,Fl(e,r),X3(e,n,i),ty(e,n,i,r),iy(null,e,n,!0,t,r);case 19:return o4(t,e,r);case 22:return r4(t,e,r)}throw Error(ue(156,e.tag))};function E4(t,e){return YC(t,e)}function jR(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function di(t,e,r,n){return new jR(t,e,r,n)}function gg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function FR(t){if(typeof t=="function")return gg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Lm)return 11;if(t===jm)return 14}return 2}function $o(t,e){var r=t.alternate;return r===null?(r=di(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Qd(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")gg(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ml:return _a(r.children,i,s,e);case Dm:o=8,i|=8;break;case Ap:return t=di(12,r,e,i|2),t.elementType=Ap,t.lanes=s,t;case Cp:return t=di(13,r,e,i),t.elementType=Cp,t.lanes=s,t;case _p:return t=di(19,r,e,i),t.elementType=_p,t.lanes=s,t;case OC:return F0(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case RC:o=10;break e;case IC:o=9;break e;case Lm:o=11;break e;case jm:o=14;break e;case go:o=16,n=null;break e}throw Error(ue(130,t==null?t:typeof t,""))}return e=di(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function _a(t,e,r,n){return t=di(7,t,n,e),t.lanes=r,t}function F0(t,e,r,n){return t=di(22,t,n,e),t.elementType=OC,t.lanes=r,t.stateNode={isHidden:!1},t}function lv(t,e,r){return t=di(6,t,null,e),t.lanes=r,t}function cv(t,e,r){return e=di(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function BR(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=V1(0),this.expirationTimes=V1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=V1(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xg(t,e,r,n,i,s,o,a,l){return t=new BR(t,e,r,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=di(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},rg(s),t}function UR(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(C4)}catch(t){console.error(t)}}C4(),CC.exports=Jn;var ro=CC.exports;const _4=eo(ro),WR=dC({__proto__:null,default:_4},[ro]);var O2=ro;Sp.createRoot=O2.createRoot,Sp.hydrateRoot=O2.hydrateRoot;const T4=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),q0=y.createContext({}),H0=y.createContext(null),W0=typeof document<"u",Sg=W0?y.useLayoutEffect:y.useEffect,P4=y.createContext({strict:!1}),kg=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),GR="framerAppearId",R4="data-"+kg(GR);function KR(t,e,r,n){const{visualElement:i}=y.useContext(q0),s=y.useContext(P4),o=y.useContext(H0),a=y.useContext(T4).reducedMotion,l=y.useRef();n=n||s.renderer,!l.current&&n&&(l.current=n(t,{visualState:e,parent:i,props:r,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const c=l.current;y.useInsertionEffect(()=>{c&&c.update(r,o)});const f=y.useRef(!!(r[R4]&&!window.HandoffComplete));return Sg(()=>{c&&(c.render(),f.current&&c.animationState&&c.animationState.animateChanges())}),y.useEffect(()=>{c&&(c.updateFeatures(),!f.current&&c.animationState&&c.animationState.animateChanges(),f.current&&(f.current=!1,window.HandoffComplete=!0))}),c}function Tl(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function YR(t,e,r){return y.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Tl(r)&&(r.current=n))},[e])}function Jf(t){return typeof t=="string"||Array.isArray(t)}function G0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Ag=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Cg=["initial",...Ag];function K0(t){return G0(t.animate)||Cg.some(e=>Jf(t[e]))}function I4(t){return!!(K0(t)||t.variants)}function QR(t,e){if(K0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Jf(r)?r:void 0,animate:Jf(n)?n:void 0}}return t.inherit!==!1?e:{}}function JR(t){const{initial:e,animate:r}=QR(t,y.useContext(q0));return y.useMemo(()=>({initial:e,animate:r}),[M2(e),M2(r)])}function M2(t){return Array.isArray(t)?t.join(" "):t}const N2={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Xf={};for(const t in N2)Xf[t]={isEnabled:e=>N2[t].some(r=>!!e[r])};function XR(t){for(const e in t)Xf[e]={...Xf[e],...t[e]}}const _g=y.createContext({}),O4=y.createContext({}),ZR=Symbol.for("motionComponentSymbol");function eI({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&XR(t);function s(a,l){let c;const f={...y.useContext(T4),...a,layoutId:tI(a)},{isStatic:u}=f,d=JR(a),h=n(a,u);if(!u&&W0){d.visualElement=KR(i,h,f,e);const p=y.useContext(O4),m=y.useContext(P4).strict;d.visualElement&&(c=d.visualElement.loadFeatures(f,m,t,p))}return y.createElement(q0.Provider,{value:d},c&&d.visualElement?y.createElement(c,{visualElement:d.visualElement,...f}):null,r(i,a,YR(h,d.visualElement,l),h,u,d.visualElement))}const o=y.forwardRef(s);return o[ZR]=i,o}function tI({layoutId:t}){const e=y.useContext(_g).id;return e&&t!==void 0?e+"-"+t:t}function rI(t){function e(n,i={}){return eI(t(n,i))}if(typeof Proxy>"u")return e;const r=new Map;return new Proxy(e,{get:(n,i)=>(r.has(i)||r.set(i,e(i)),r.get(i))})}const nI=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tg(t){return typeof t!="string"||t.includes("-")?!1:!!(nI.indexOf(t)>-1||/[A-Z]/.test(t))}const Uh={};function iI(t){Object.assign(Uh,t)}const Iu=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Qa=new Set(Iu);function M4(t,{layout:e,layoutId:r}){return Qa.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Uh[t]||t==="opacity")}const Tn=t=>!!(t&&t.getVelocity),sI={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oI=Iu.length;function aI(t,{enableHardwareAcceleration:e=!0,allowTransformNone:r=!0},n,i){let s="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),$4=N4("--"),yy=N4("var(--"),lI=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,cI=(t,e)=>e&&typeof t=="number"?e.transform(t):t,Vo=(t,e,r)=>Math.min(Math.max(r,t),e),Ja={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Sf={...Ja,transform:t=>Vo(0,1,t)},fd={...Ja,default:1},kf=t=>Math.round(t*1e5)/1e5,Y0=/(-)?([\d]*\.?[\d])+/g,D4=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,fI=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Ou(t){return typeof t=="string"}const Mu=t=>({test:e=>Ou(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),vo=Mu("deg"),ls=Mu("%"),Pe=Mu("px"),uI=Mu("vh"),dI=Mu("vw"),$2={...ls,parse:t=>ls.parse(t)/100,transform:t=>ls.transform(t*100)},D2={...Ja,transform:Math.round},L4={borderWidth:Pe,borderTopWidth:Pe,borderRightWidth:Pe,borderBottomWidth:Pe,borderLeftWidth:Pe,borderRadius:Pe,radius:Pe,borderTopLeftRadius:Pe,borderTopRightRadius:Pe,borderBottomRightRadius:Pe,borderBottomLeftRadius:Pe,width:Pe,maxWidth:Pe,height:Pe,maxHeight:Pe,size:Pe,top:Pe,right:Pe,bottom:Pe,left:Pe,padding:Pe,paddingTop:Pe,paddingRight:Pe,paddingBottom:Pe,paddingLeft:Pe,margin:Pe,marginTop:Pe,marginRight:Pe,marginBottom:Pe,marginLeft:Pe,rotate:vo,rotateX:vo,rotateY:vo,rotateZ:vo,scale:fd,scaleX:fd,scaleY:fd,scaleZ:fd,skew:vo,skewX:vo,skewY:vo,distance:Pe,translateX:Pe,translateY:Pe,translateZ:Pe,x:Pe,y:Pe,z:Pe,perspective:Pe,transformPerspective:Pe,opacity:Sf,originX:$2,originY:$2,originZ:Pe,zIndex:D2,fillOpacity:Sf,strokeOpacity:Sf,numOctaves:D2};function Pg(t,e,r,n){const{style:i,vars:s,transform:o,transformOrigin:a}=t;let l=!1,c=!1,f=!0;for(const u in e){const d=e[u];if($4(u)){s[u]=d;continue}const h=L4[u],p=cI(d,h);if(Qa.has(u)){if(l=!0,o[u]=p,!f)continue;d!==(h.default||0)&&(f=!1)}else u.startsWith("origin")?(c=!0,a[u]=p):i[u]=p}if(e.transform||(l||n?i.transform=aI(t.transform,r,f,n):i.transform&&(i.transform="none")),c){const{originX:u="50%",originY:d="50%",originZ:h=0}=a;i.transformOrigin=`${u} ${d} ${h}`}}const Rg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function j4(t,e,r){for(const n in e)!Tn(e[n])&&!M4(n,r)&&(t[n]=e[n])}function hI({transformTemplate:t},e,r){return y.useMemo(()=>{const n=Rg();return Pg(n,e,{enableHardwareAcceleration:!r},t),Object.assign({},n.vars,n.style)},[e])}function vI(t,e,r){const n=t.style||{},i={};return j4(i,n,t),Object.assign(i,hI(t,e,r)),t.transformValues?t.transformValues(i):i}function pI(t,e,r){const n={},i=vI(t,e,r);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const yI=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function zh(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||yI.has(t)}let F4=t=>!zh(t);function mI(t){t&&(F4=e=>e.startsWith("on")?!zh(e):t(e))}try{mI(require("@emotion/is-prop-valid").default)}catch{}function gI(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(F4(i)||r===!0&&zh(i)||!e&&!zh(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function L2(t,e,r){return typeof t=="string"?t:Pe.transform(e+r*t)}function xI(t,e,r){const n=L2(e,t.x,t.width),i=L2(r,t.y,t.height);return`${n} ${i}`}const bI={offset:"stroke-dashoffset",array:"stroke-dasharray"},wI={offset:"strokeDashoffset",array:"strokeDasharray"};function EI(t,e,r=1,n=0,i=!0){t.pathLength=1;const s=i?bI:wI;t[s.offset]=Pe.transform(-n);const o=Pe.transform(e),a=Pe.transform(r);t[s.array]=`${o} ${a}`}function Ig(t,{attrX:e,attrY:r,attrScale:n,originX:i,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},f,u,d){if(Pg(t,c,f,d),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p,dimensions:m}=t;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||s!==void 0||p.transform)&&(p.transformOrigin=xI(m,i!==void 0?i:.5,s!==void 0?s:.5)),e!==void 0&&(h.x=e),r!==void 0&&(h.y=r),n!==void 0&&(h.scale=n),o!==void 0&&EI(h,o,a,l,!1)}const B4=()=>({...Rg(),attrs:{}}),Og=t=>typeof t=="string"&&t.toLowerCase()==="svg";function SI(t,e,r,n){const i=y.useMemo(()=>{const s=B4();return Ig(s,e,{enableHardwareAcceleration:!1},Og(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};j4(s,t.style,t),i.style={...s,...i.style}}return i}function kI(t=!1){return(r,n,i,{latestValues:s},o)=>{const l=(Tg(r)?SI:pI)(n,s,o,r),f={...gI(n,typeof r=="string",t),...l,ref:i},{children:u}=n,d=y.useMemo(()=>Tn(u)?u.get():u,[u]);return y.createElement(r,{...f,children:d})}}function U4(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const z4=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function V4(t,e,r,n){U4(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(z4.has(i)?i:kg(i),e.attrs[i])}function Mg(t,e){const{style:r}=t,n={};for(const i in r)(Tn(r[i])||e.style&&Tn(e.style[i])||M4(i,t))&&(n[i]=r[i]);return n}function q4(t,e){const r=Mg(t,e);for(const n in t)if(Tn(t[n])||Tn(e[n])){const i=Iu.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;r[i]=t[n]}return r}function Ng(t,e,r,n={},i={}){return typeof e=="function"&&(e=e(r!==void 0?r:t.custom,n,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(r!==void 0?r:t.custom,n,i)),e}function H4(t){const e=y.useRef(null);return e.current===null&&(e.current=t()),e.current}const Vh=t=>Array.isArray(t),AI=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CI=t=>Vh(t)?t[t.length-1]||0:t;function Jd(t){const e=Tn(t)?t.get():t;return AI(e)?e.toValue():e}function _I({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:r},n,i,s){const o={latestValues:TI(n,i,s,t),renderState:e()};return r&&(o.mount=a=>r(n,a,o)),o}const W4=t=>(e,r)=>{const n=y.useContext(q0),i=y.useContext(H0),s=()=>_I(t,e,n,i);return r?s():H4(s)};function TI(t,e,r,n){const i={},s=n(t,{});for(const d in s)i[d]=Jd(s[d]);let{initial:o,animate:a}=t;const l=K0(t),c=I4(t);e&&c&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let f=r?r.initial===!1:!1;f=f||o===!1;const u=f?a:o;return u&&typeof u!="boolean"&&!G0(u)&&(Array.isArray(u)?u:[u]).forEach(h=>{const p=Ng(t,h);if(!p)return;const{transitionEnd:m,transition:x,...b}=p;for(const w in b){let E=b[w];if(Array.isArray(E)){const P=f?E.length-1:0;E=E[P]}E!==null&&(i[w]=E)}for(const w in m)i[w]=m[w]}),i}const fr=t=>t;class j2{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const r=this.order.indexOf(e);r!==-1&&(this.order.splice(r,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function PI(t){let e=new j2,r=new j2,n=0,i=!1,s=!1;const o=new WeakSet,a={schedule:(l,c=!1,f=!1)=>{const u=f&&i,d=u?e:r;return c&&o.add(l),d.add(l)&&u&&i&&(n=e.order.length),l},cancel:l=>{r.remove(l),o.delete(l)},process:l=>{if(i){s=!0;return}if(i=!0,[e,r]=[r,e],r.clear(),n=e.order.length,n)for(let c=0;c(u[d]=PI(()=>r=!0),u),{}),o=u=>s[u].process(i),a=()=>{const u=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(u-i.timestamp,RI),1),i.timestamp=u,i.isProcessing=!0,ud.forEach(o),i.isProcessing=!1,r&&e&&(n=!1,t(a))},l=()=>{r=!0,n=!0,i.isProcessing||t(a)};return{schedule:ud.reduce((u,d)=>{const h=s[d];return u[d]=(p,m=!1,x=!1)=>(r||l(),h.schedule(p,m,x)),u},{}),cancel:u=>ud.forEach(d=>s[d].cancel(u)),state:i,steps:s}}const{schedule:zt,cancel:Gs,state:rn,steps:fv}=II(typeof requestAnimationFrame<"u"?requestAnimationFrame:fr,!0),OI={useVisualState:W4({scrapeMotionValuesFromProps:q4,createRenderState:B4,onMount:(t,e,{renderState:r,latestValues:n})=>{zt.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),zt.render(()=>{Ig(r,n,{enableHardwareAcceleration:!1},Og(e.tagName),t.transformTemplate),V4(e,r)})}})},MI={useVisualState:W4({scrapeMotionValuesFromProps:Mg,createRenderState:Rg})};function NI(t,{forwardMotionProps:e=!1},r,n){return{...Tg(t)?OI:MI,preloadedFeatures:r,useRender:kI(e),createVisualElement:n,Component:t}}function Ls(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}const G4=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Q0(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const $I=t=>e=>G4(e)&&t(e,Q0(e));function Bs(t,e,r,n){return Ls(t,e,$I(r),n)}const DI=(t,e)=>r=>e(t(r)),Do=(...t)=>t.reduce(DI);function K4(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const F2=K4("dragHorizontal"),B2=K4("dragVertical");function Y4(t){let e=!1;if(t==="y")e=B2();else if(t==="x")e=F2();else{const r=F2(),n=B2();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function Q4(){const t=Y4(!0);return t?(t(),!1):!0}class ta{constructor(e){this.isMounted=!1,this.node=e}update(){}}function U2(t,e){const r="pointer"+(e?"enter":"leave"),n="onHover"+(e?"Start":"End"),i=(s,o)=>{if(s.pointerType==="touch"||Q4())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[n]&&zt.update(()=>a[n](s,o))};return Bs(t.current,r,i,{passive:!t.getProps()[n]})}class LI extends ta{mount(){this.unmount=Do(U2(this.node,!0),U2(this.node,!1))}unmount(){}}class jI extends ta{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Do(Ls(this.node.current,"focus",()=>this.onFocus()),Ls(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const J4=(t,e)=>e?t===e?!0:J4(t,e.parentElement):!1;function uv(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,Q0(r))}class FI extends ta{constructor(){super(...arguments),this.removeStartListeners=fr,this.removeEndListeners=fr,this.removeAccessibleListeners=fr,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=Bs(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:f,globalTapTarget:u}=this.node.getProps();zt.update(()=>{!u&&!J4(this.node.current,a.target)?f&&f(a,l):c&&c(a,l)})},{passive:!(n.onTap||n.onPointerUp)}),o=Bs(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Do(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||uv("up",(l,c)=>{const{onTap:f}=this.node.getProps();f&&zt.update(()=>f(l,c))})};this.removeEndListeners(),this.removeEndListeners=Ls(this.node.current,"keyup",o),uv("down",(a,l)=>{this.startPress(a,l)})},r=Ls(this.node.current,"keydown",e),n=()=>{this.isPressing&&uv("cancel",(s,o)=>this.cancelPress(s,o))},i=Ls(this.node.current,"blur",n);this.removeAccessibleListeners=Do(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&zt.update(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Q4()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&zt.update(()=>n(e,r))}mount(){const e=this.node.getProps(),r=Bs(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Ls(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Do(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const my=new WeakMap,dv=new WeakMap,BI=t=>{const e=my.get(t.target);e&&e(t)},UI=t=>{t.forEach(BI)};function zI({root:t,...e}){const r=t||document;dv.has(r)||dv.set(r,{});const n=dv.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(UI,{root:t,...e})),n[i]}function VI(t,e,r){const n=zI(e);return my.set(t,r),n.observe(t),()=>{my.delete(t),n.unobserve(t)}}const qI={some:0,all:1};class HI extends ta{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:qI[i]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,s&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:f,onViewportLeave:u}=this.node.getProps(),d=c?f:u;d&&d(l)};return VI(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(WI(e,r))&&this.startObserver()}unmount(){}}function WI({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const GI={inView:{Feature:HI},tap:{Feature:FI},focus:{Feature:jI},hover:{Feature:LI}};function X4(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;ne[n]=r.get()),e}function YI(t){const e={};return t.values.forEach((r,n)=>e[n]=r.getVelocity()),e}function J0(t,e,r){const n=t.getProps();return Ng(n,e,r!==void 0?r:n.custom,KI(t),YI(t))}let QI=fr,$g=fr;const Lo=t=>t*1e3,Us=t=>t/1e3,JI={current:!1},Z4=t=>Array.isArray(t)&&typeof t[0]=="number";function e6(t){return!!(!t||typeof t=="string"&&t6[t]||Z4(t)||Array.isArray(t)&&t.every(e6))}const cf=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,t6={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cf([0,.65,.55,1]),circOut:cf([.55,0,1,.45]),backIn:cf([.31,.01,.66,-.59]),backOut:cf([.33,1.53,.69,.99])};function r6(t){if(t)return Z4(t)?cf(t):Array.isArray(t)?t.map(r6):t6[t]}function XI(t,e,r,{delay:n=0,duration:i,repeat:s=0,repeatType:o="loop",ease:a,times:l}={}){const c={[e]:r};l&&(c.offset=l);const f=r6(a);return Array.isArray(f)&&(c.easing=f),t.animate(c,{delay:n,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function ZI(t,{repeat:e,repeatType:r="loop"}){const n=e&&r!=="loop"&&e%2===1?0:t.length-1;return t[n]}const n6=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,eO=1e-7,tO=12;function rO(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=n6(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>eO&&++arO(s,0,1,t,r);return s=>s===0||s===1?s:n6(i(s),e,n)}const nO=Nu(.42,0,1,1),iO=Nu(0,0,.58,1),i6=Nu(.42,0,.58,1),sO=t=>Array.isArray(t)&&typeof t[0]!="number",s6=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,o6=t=>e=>1-t(1-e),Dg=t=>1-Math.sin(Math.acos(t)),a6=o6(Dg),oO=s6(Dg),l6=Nu(.33,1.53,.69,.99),Lg=o6(l6),aO=s6(Lg),lO=t=>(t*=2)<1?.5*Lg(t):.5*(2-Math.pow(2,-10*(t-1))),cO={linear:fr,easeIn:nO,easeInOut:i6,easeOut:iO,circIn:Dg,circInOut:oO,circOut:a6,backIn:Lg,backInOut:aO,backOut:l6,anticipate:lO},z2=t=>{if(Array.isArray(t)){$g(t.length===4);const[e,r,n,i]=t;return Nu(e,r,n,i)}else if(typeof t=="string")return cO[t];return t},jg=(t,e)=>r=>!!(Ou(r)&&fI.test(r)&&r.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(r,e)),c6=(t,e,r)=>n=>{if(!Ou(n))return n;const[i,s,o,a]=n.match(Y0);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},fO=t=>Vo(0,255,t),hv={...Ja,transform:t=>Math.round(fO(t))},ba={test:jg("rgb","red"),parse:c6("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+hv.transform(t)+", "+hv.transform(e)+", "+hv.transform(r)+", "+kf(Sf.transform(n))+")"};function uO(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const gy={test:jg("#"),parse:uO,transform:ba.transform},Pl={test:jg("hsl","hue"),parse:c6("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+ls.transform(kf(e))+", "+ls.transform(kf(r))+", "+kf(Sf.transform(n))+")"},dn={test:t=>ba.test(t)||gy.test(t)||Pl.test(t),parse:t=>ba.test(t)?ba.parse(t):Pl.test(t)?Pl.parse(t):gy.parse(t),transform:t=>Ou(t)?t:t.hasOwnProperty("red")?ba.transform(t):Pl.transform(t)},tr=(t,e,r)=>-r*t+r*e+t;function vv(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function dO({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,l=2*r-a;i=vv(l,a,t+1/3),s=vv(l,a,t),o=vv(l,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}const pv=(t,e,r)=>{const n=t*t;return Math.sqrt(Math.max(0,r*(e*e-n)+n))},hO=[gy,ba,Pl],vO=t=>hO.find(e=>e.test(t));function V2(t){const e=vO(t);let r=e.parse(t);return e===Pl&&(r=dO(r)),r}const f6=(t,e)=>{const r=V2(t),n=V2(e),i={...r};return s=>(i.red=pv(r.red,n.red,s),i.green=pv(r.green,n.green,s),i.blue=pv(r.blue,n.blue,s),i.alpha=tr(r.alpha,n.alpha,s),ba.transform(i))};function pO(t){var e,r;return isNaN(t)&&Ou(t)&&(((e=t.match(Y0))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(D4))===null||r===void 0?void 0:r.length)||0)>0}const u6={regex:lI,countKey:"Vars",token:"${v}",parse:fr},d6={regex:D4,countKey:"Colors",token:"${c}",parse:dn.parse},h6={regex:Y0,countKey:"Numbers",token:"${n}",parse:Ja.parse};function yv(t,{regex:e,countKey:r,token:n,parse:i}){const s=t.tokenised.match(e);s&&(t["num"+r]=s.length,t.tokenised=t.tokenised.replace(e,n),t.values.push(...s.map(i)))}function qh(t){const e=t.toString(),r={value:e,tokenised:e,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&yv(r,u6),yv(r,d6),yv(r,h6),r}function v6(t){return qh(t).values}function p6(t){const{values:e,numColors:r,numVars:n,tokenised:i}=qh(t),s=e.length;return o=>{let a=i;for(let l=0;ltypeof t=="number"?0:t;function mO(t){const e=v6(t);return p6(t)(e.map(yO))}const qo={test:pO,parse:v6,createTransformer:p6,getAnimatableNone:mO},y6=(t,e)=>r=>`${r>0?e:t}`;function m6(t,e){return typeof t=="number"?r=>tr(t,e,r):dn.test(t)?f6(t,e):t.startsWith("var(")?y6(t,e):x6(t,e)}const g6=(t,e)=>{const r=[...t],n=r.length,i=t.map((s,o)=>m6(s,e[o]));return s=>{for(let o=0;o{const r={...t,...e},n={};for(const i in r)t[i]!==void 0&&e[i]!==void 0&&(n[i]=m6(t[i],e[i]));return i=>{for(const s in n)r[s]=n[s](i);return r}},x6=(t,e)=>{const r=qo.createTransformer(e),n=qh(t),i=qh(e);return n.numVars===i.numVars&&n.numColors===i.numColors&&n.numNumbers>=i.numNumbers?Do(g6(n.values,i.values),r):y6(t,e)},Zf=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},q2=(t,e)=>r=>tr(t,e,r);function xO(t){return typeof t=="number"?q2:typeof t=="string"?dn.test(t)?f6:x6:Array.isArray(t)?g6:typeof t=="object"?gO:q2}function bO(t,e,r){const n=[],i=r||xO(t[0]),s=t.length-1;for(let o=0;oe[0];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=bO(e,n,i),a=o.length,l=c=>{let f=0;if(a>1)for(;fl(Vo(t[0],t[s-1],c)):l}function wO(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=Zf(0,e,n);t.push(tr(r,1,i))}}function EO(t){const e=[0];return wO(e,t.length-1),e}function SO(t,e){return t.map(r=>r*e)}function kO(t,e){return t.map(()=>e||i6).splice(0,t.length-1)}function Hh({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=sO(n)?n.map(z2):z2(n),s={done:!1,value:e[0]},o=SO(r&&r.length===e.length?r:EO(e),t),a=b6(o,e,{ease:Array.isArray(i)?i:kO(e,i)});return{calculatedDuration:t,next:l=>(s.value=a(l),s.done=l>=t,s)}}function w6(t,e){return e?t*(1e3/e):0}const AO=5;function E6(t,e,r){const n=Math.max(e-AO,0);return w6(r-t(n),e-n)}const mv=.001,CO=.01,H2=10,_O=.05,TO=1;function PO({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s;QI(t<=Lo(H2));let o=1-e;o=Vo(_O,TO,o),t=Vo(CO,H2,Us(t)),o<1?(i=c=>{const f=c*o,u=f*t,d=f-r,h=xy(c,o),p=Math.exp(-u);return mv-d/h*p},s=c=>{const u=c*o*t,d=u*r+r,h=Math.pow(o,2)*Math.pow(c,2)*t,p=Math.exp(-u),m=xy(Math.pow(c,2),o);return(-i(c)+mv>0?-1:1)*((d-h)*p)/m}):(i=c=>{const f=Math.exp(-c*t),u=(c-r)*t+1;return-mv+f*u},s=c=>{const f=Math.exp(-c*t),u=(r-c)*(t*t);return f*u});const a=5/t,l=IO(i,s,a);if(t=Lo(t),isNaN(l))return{stiffness:100,damping:10,duration:t};{const c=Math.pow(l,2)*n;return{stiffness:c,damping:o*2*Math.sqrt(n*c),duration:t}}}const RO=12;function IO(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function NO(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!W2(t,MO)&&W2(t,OO)){const r=PO(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function S6({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:l,mass:c,duration:f,velocity:u,isResolvedFromDuration:d}=NO({...n,velocity:-Us(n.velocity||0)}),h=u||0,p=l/(2*Math.sqrt(a*c)),m=s-i,x=Us(Math.sqrt(a/c)),b=Math.abs(m)<5;r||(r=b?.01:2),e||(e=b?.005:.5);let w;if(p<1){const E=xy(x,p);w=P=>{const N=Math.exp(-p*x*P);return s-N*((h+p*x*m)/E*Math.sin(E*P)+m*Math.cos(E*P))}}else if(p===1)w=E=>s-Math.exp(-x*E)*(m+(h+x*m)*E);else{const E=x*Math.sqrt(p*p-1);w=P=>{const N=Math.exp(-p*x*P),I=Math.min(E*P,300);return s-N*((h+p*x*m)*Math.sinh(I)+E*m*Math.cosh(I))/E}}return{calculatedDuration:d&&f||null,next:E=>{const P=w(E);if(d)o.done=E>=f;else{let N=h;E!==0&&(p<1?N=E6(w,E,P):N=0);const I=Math.abs(N)<=r,j=Math.abs(s-P)<=e;o.done=I&&j}return o.value=o.done?s:P,o}}}function G2({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:f}){const u=t[0],d={done:!1,value:u},h=L=>a!==void 0&&Ll,p=L=>a===void 0?l:l===void 0||Math.abs(a-L)-m*Math.exp(-L/n),E=L=>b+w(L),P=L=>{const U=w(L),K=E(L);d.done=Math.abs(U)<=c,d.value=d.done?b:K};let N,I;const j=L=>{h(d.value)&&(N=L,I=S6({keyframes:[d.value,p(d.value)],velocity:E6(E,L,d.value),damping:i,stiffness:s,restDelta:c,restSpeed:f}))};return j(0),{calculatedDuration:null,next:L=>{let U=!1;return!I&&N===void 0&&(U=!0,P(L),j(L)),N!==void 0&&L>N?I.next(L-N):(!U&&P(L),d)}}}const $O=t=>{const e=({timestamp:r})=>t(r);return{start:()=>zt.update(e,!0),stop:()=>Gs(e),now:()=>rn.isProcessing?rn.timestamp:performance.now()}},K2=2e4;function Y2(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=K2?1/0:e}const DO={decay:G2,inertia:G2,tween:Hh,keyframes:Hh,spring:S6};function Wh({autoplay:t=!0,delay:e=0,driver:r=$O,keyframes:n,type:i="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:a="loop",onPlay:l,onStop:c,onComplete:f,onUpdate:u,...d}){let h=1,p=!1,m,x;const b=()=>{x=new Promise(S=>{m=S})};b();let w;const E=DO[i]||Hh;let P;E!==Hh&&typeof n[0]!="number"&&(P=b6([0,100],n,{clamp:!1}),n=[0,100]);const N=E({...d,keyframes:n});let I;a==="mirror"&&(I=E({...d,keyframes:[...n].reverse(),velocity:-(d.velocity||0)}));let j="idle",L=null,U=null,K=null;N.calculatedDuration===null&&s&&(N.calculatedDuration=Y2(N));const{calculatedDuration:X}=N;let ee=1/0,M=1/0;X!==null&&(ee=X+o,M=ee*(s+1)-o);let v=0;const _=S=>{if(U===null)return;h>0&&(U=Math.min(U,S)),h<0&&(U=Math.min(S-M/h,U)),L!==null?v=L:v=Math.round(S-U)*h;const g=v-e*(h>=0?1:-1),R=h>=0?g<0:g>M;v=Math.max(g,0),j==="finished"&&L===null&&(v=M);let F=v,C=N;if(s){const Z=Math.min(v,M)/ee;let le=Math.floor(Z),ne=Z%1;!ne&&Z>=1&&(ne=1),ne===1&&le--,le=Math.min(le,s+1),!!(le%2)&&(a==="reverse"?(ne=1-ne,o&&(ne-=o/ee)):a==="mirror"&&(C=I)),F=Vo(0,1,ne)*ee}const B=R?{done:!1,value:n[0]}:C.next(F);P&&(B.value=P(B.value));let{done:V}=B;!R&&X!==null&&(V=h>=0?v>=M:v<=0);const H=L===null&&(j==="finished"||j==="running"&&V);return u&&u(B.value),H&&T(),B},k=()=>{w&&w.stop(),w=void 0},A=()=>{j="idle",k(),m(),b(),U=K=null},T=()=>{j="finished",f&&f(),k(),m()},O=()=>{if(p)return;w||(w=r(_));const S=w.now();l&&l(),L!==null?U=S-L:(!U||j==="finished")&&(U=S),j==="finished"&&b(),K=U,L=null,j="running",w.start()};t&&O();const D={then(S,g){return x.then(S,g)},get time(){return Us(v)},set time(S){S=Lo(S),v=S,L!==null||!w||h===0?L=S:U=w.now()-S/h},get duration(){const S=N.calculatedDuration===null?Y2(N):N.calculatedDuration;return Us(S)},get speed(){return h},set speed(S){S===h||!w||(h=S,D.time=Us(v))},get state(){return j},play:O,pause:()=>{j="paused",L=v},stop:()=>{p=!0,j!=="idle"&&(j="idle",c&&c(),A())},cancel:()=>{K!==null&&_(K),A()},complete:()=>{j="finished"},sample:S=>(U=0,_(S))};return D}function LO(t){let e;return()=>(e===void 0&&(e=t()),e)}const jO=LO(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),FO=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),dd=10,BO=2e4,UO=(t,e)=>e.type==="spring"||t==="backgroundColor"||!e6(e.ease);function zO(t,e,{onUpdate:r,onComplete:n,...i}){if(!(jO()&&FO.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let o=!1,a,l,c=!1;const f=()=>{l=new Promise(E=>{a=E})};f();let{keyframes:u,duration:d=300,ease:h,times:p}=i;if(UO(e,i)){const E=Wh({...i,repeat:0,delay:0});let P={done:!1,value:u[0]};const N=[];let I=0;for(;!P.done&&I{c=!1,m.cancel()},b=()=>{c=!0,zt.update(x),a(),f()};return m.onfinish=()=>{c||(t.set(ZI(u,i)),n&&n(),b())},{then(E,P){return l.then(E,P)},attachTimeline(E){return m.timeline=E,m.onfinish=null,fr},get time(){return Us(m.currentTime||0)},set time(E){m.currentTime=Lo(E)},get speed(){return m.playbackRate},set speed(E){m.playbackRate=E},get duration(){return Us(d)},play:()=>{o||(m.play(),Gs(x))},pause:()=>m.pause(),stop:()=>{if(o=!0,m.playState==="idle")return;const{currentTime:E}=m;if(E){const P=Wh({...i,autoplay:!1});t.setWithVelocity(P.sample(E-dd).value,P.sample(E).value,dd)}b()},complete:()=>{c||m.finish()},cancel:b}}function VO({keyframes:t,delay:e,onUpdate:r,onComplete:n}){const i=()=>(r&&r(t[t.length-1]),n&&n(),{time:0,speed:1,duration:0,play:fr,pause:fr,stop:fr,then:s=>(s(),Promise.resolve()),cancel:fr,complete:fr});return e?Wh({keyframes:[0,1],duration:0,delay:e,onComplete:i}):i()}const qO={type:"spring",stiffness:500,damping:25,restSpeed:10},HO=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),WO={type:"keyframes",duration:.8},GO={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KO=(t,{keyframes:e})=>e.length>2?WO:Qa.has(t)?t.startsWith("scale")?HO(e[1]):qO:GO,by=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(qo.test(e)||e==="0")&&!e.startsWith("url(")),YO=new Set(["brightness","contrast","saturate","opacity"]);function QO(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(Y0)||[];if(!n)return t;const i=r.replace(n,"");let s=YO.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const JO=/([a-z-]*)\(.*?\)/g,wy={...qo,getAnimatableNone:t=>{const e=t.match(JO);return e?e.map(QO).join(" "):t}},XO={...L4,color:dn,backgroundColor:dn,outlineColor:dn,fill:dn,stroke:dn,borderColor:dn,borderTopColor:dn,borderRightColor:dn,borderBottomColor:dn,borderLeftColor:dn,filter:wy,WebkitFilter:wy},Fg=t=>XO[t];function k6(t,e){let r=Fg(t);return r!==wy&&(r=qo),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const A6=t=>/^0[^.\s]+$/.test(t);function ZO(t){if(typeof t=="number")return t===0;if(t!==null)return t==="none"||t==="0"||A6(t)}function eM(t,e,r,n){const i=by(e,r);let s;Array.isArray(r)?s=[...r]:s=[null,r];const o=n.from!==void 0?n.from:t.get();let a;const l=[];for(let c=0;ci=>{const s=Bg(n,t)||{},o=s.delay||n.delay||0;let{elapsed:a=0}=n;a=a-Lo(o);const l=eM(e,t,r,s),c=l[0],f=l[l.length-1],u=by(t,c),d=by(t,f);let h={keyframes:l,velocity:e.getVelocity(),ease:"easeOut",...s,delay:-a,onUpdate:p=>{e.set(p),s.onUpdate&&s.onUpdate(p)},onComplete:()=>{i(),s.onComplete&&s.onComplete()}};if(tM(s)||(h={...h,...KO(t,h)}),h.duration&&(h.duration=Lo(h.duration)),h.repeatDelay&&(h.repeatDelay=Lo(h.repeatDelay)),!u||!d||JI.current||s.type===!1||rM.skipAnimations)return VO(h);if(!n.isHandoff&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=zO(e,t,h);if(p)return p}return Wh(h)};function Gh(t){return!!(Tn(t)&&t.add)}const C6=t=>/^\-?\d*\.?\d+$/.test(t);function zg(t,e){t.indexOf(e)===-1&&t.push(e)}function Vg(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}class qg{constructor(){this.subscriptions=[]}add(e){return zg(this.subscriptions,e),()=>Vg(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class iM{constructor(e,r={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(n,i=!0)=>{this.prev=this.current,this.current=n;const{delta:s,timestamp:o}=rn;this.lastUpdated!==o&&(this.timeDelta=s,this.lastUpdated=o,zt.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>zt.postRender(this.velocityCheck),this.velocityCheck=({timestamp:n})=>{n!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=nM(this.current),this.owner=r.owner}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new qg);const n=this.events[e].add(r);return e==="change"?()=>{n(),zt.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=e,this.timeDelta=n}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?w6(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function rc(t,e){return new iM(t,e)}const _6=t=>e=>e.test(t),sM={test:t=>t==="auto",parse:t=>t},T6=[Ja,Pe,ls,vo,dI,uI,sM],Vc=t=>T6.find(_6(t)),oM=[...T6,dn,qo],aM=t=>oM.find(_6(t));function lM(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,rc(r))}function cM(t,e){const r=J0(t,e);let{transitionEnd:n={},transition:i={},...s}=r?t.makeTargetAnimatable(r,!1):{};s={...s,...n};for(const o in s){const a=CI(s[o]);lM(t,o,a)}}function fM(t,e,r){var n,i;const s=Object.keys(e).filter(a=>!t.hasValue(a)),o=s.length;if(o)for(let a=0;al.remove(u))),c.push(x)}return o&&Promise.all(c).then(()=>{o&&cM(t,o)}),c}function Ey(t,e,r={}){const n=J0(t,e,r.custom);let{transition:i=t.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);const s=n?()=>Promise.all(P6(t,n,r)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:u}=i;return pM(t,e,c+l,f,u,r)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,c]=a==="beforeChildren"?[s,o]:[o,s];return l().then(()=>c())}else return Promise.all([s(),o(r.delay)])}function pM(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,l=i===1?(c=0)=>c*n:(c=0)=>a-c*n;return Array.from(t.variantChildren).sort(yM).forEach((c,f)=>{c.notify("AnimationStart",e),o.push(Ey(c,e,{...s,delay:r+l(f)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function yM(t,e){return t.sortNodePosition(e)}function mM(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>Ey(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=Ey(t,e,r);else{const i=typeof e=="function"?J0(t,e,r.custom):e;n=Promise.all(P6(t,i,r))}return n.then(()=>t.notify("AnimationComplete",e))}const gM=[...Ag].reverse(),xM=Ag.length;function bM(t){return e=>Promise.all(e.map(({animation:r,options:n})=>mM(t,r,n)))}function wM(t){let e=bM(t);const r=SM();let n=!0;const i=(l,c)=>{const f=J0(t,c);if(f){const{transition:u,transitionEnd:d,...h}=f;l={...l,...h,...d}}return l};function s(l){e=l(t)}function o(l,c){const f=t.getProps(),u=t.getVariantContext(!0)||{},d=[],h=new Set;let p={},m=1/0;for(let b=0;bm&&N,K=!1;const X=Array.isArray(P)?P:[P];let ee=X.reduce(i,{});I===!1&&(ee={});const{prevResolvedValues:M={}}=E,v={...M,...ee},_=k=>{U=!0,h.has(k)&&(K=!0,h.delete(k)),E.needsAnimating[k]=!0};for(const k in v){const A=ee[k],T=M[k];if(p.hasOwnProperty(k))continue;let O=!1;Vh(A)&&Vh(T)?O=!X4(A,T):O=A!==T,O?A!==void 0?_(k):h.add(k):A!==void 0&&h.has(k)?_(k):E.protectedKeys[k]=!0}E.prevProp=P,E.prevResolvedValues=ee,E.isActive&&(p={...p,...ee}),n&&t.blockInitialAnimation&&(U=!1),U&&(!j||K)&&d.push(...X.map(k=>({animation:k,options:{type:w,...l}})))}if(h.size){const b={};h.forEach(w=>{const E=t.getBaseTarget(w);E!==void 0&&(b[w]=E)}),d.push({animation:b})}let x=!!d.length;return n&&(f.initial===!1||f.initial===f.animate)&&!t.manuallyAnimateOnMount&&(x=!1),n=!1,x?e(d):Promise.resolve()}function a(l,c,f){var u;if(r[l].isActive===c)return Promise.resolve();(u=t.variantChildren)===null||u===void 0||u.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,c)}),r[l].isActive=c;const d=o(f,l);for(const h in r)r[h].protectedKeys={};return d}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r}}function EM(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!X4(e,t):!1}function la(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function SM(){return{animate:la(!0),whileInView:la(),whileHover:la(),whileTap:la(),whileDrag:la(),whileFocus:la(),exit:la()}}class kM extends ta{constructor(e){super(e),e.animationState||(e.animationState=wM(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),G0(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){}}let AM=0;class CM extends ta{constructor(){super(...arguments),this.id=AM++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r,custom:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const s=this.node.animationState.setActive("exit",!e,{custom:n??this.node.getProps().custom});r&&!e&&s.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const _M={animation:{Feature:kM},exit:{Feature:CM}},Q2=(t,e)=>Math.abs(t-e);function TM(t,e){const r=Q2(t.x,e.x),n=Q2(t.y,e.y);return Math.sqrt(r**2+n**2)}class R6{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=xv(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=TM(u.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=u,{timestamp:m}=rn;this.history.push({...p,timestamp:m});const{onStart:x,onMove:b}=this.handlers;d||(x&&x(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,u)},this.handlePointerMove=(u,d)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=gv(d,this.transformPagePoint),zt.update(this.updatePoint,!0)},this.handlePointerUp=(u,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=xv(u.type==="pointercancel"?this.lastMoveEventInfo:gv(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(u,x),p&&p(u,x)},!G4(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=Q0(e),a=gv(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=rn;this.history=[{...l,timestamp:c}];const{onSessionStart:f}=r;f&&f(e,xv(a,this.history)),this.removeListeners=Do(Bs(this.contextWindow,"pointermove",this.handlePointerMove),Bs(this.contextWindow,"pointerup",this.handlePointerUp),Bs(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Gs(this.updatePoint)}}function gv(t,e){return e?{point:e(t.point)}:t}function J2(t,e){return{x:t.x-e.x,y:t.y-e.y}}function xv({point:t},e){return{point:t,delta:J2(t,I6(e)),offset:J2(t,PM(e)),velocity:RM(e,.1)}}function PM(t){return t[0]}function I6(t){return t[t.length-1]}function RM(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=I6(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>Lo(e)));)r--;if(!n)return{x:0,y:0};const s=Us(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Gn(t){return t.max-t.min}function Sy(t,e=0,r=.01){return Math.abs(t-e)<=r}function X2(t,e,r,n=.5){t.origin=n,t.originPoint=tr(e.min,e.max,t.origin),t.scale=Gn(r)/Gn(e),(Sy(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=tr(r.min,r.max,t.origin)-t.originPoint,(Sy(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Af(t,e,r,n){X2(t.x,e.x,r.x,n?n.originX:void 0),X2(t.y,e.y,r.y,n?n.originY:void 0)}function Z2(t,e,r){t.min=r.min+e.min,t.max=t.min+Gn(e)}function IM(t,e,r){Z2(t.x,e.x,r.x),Z2(t.y,e.y,r.y)}function eE(t,e,r){t.min=e.min-r.min,t.max=t.min+Gn(e)}function Cf(t,e,r){eE(t.x,e.x,r.x),eE(t.y,e.y,r.y)}function OM(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?tr(r,t,n.max):Math.min(t,r)),t}function tE(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function MM(t,{top:e,left:r,bottom:n,right:i}){return{x:tE(t.x,r,i),y:tE(t.y,e,n)}}function rE(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=Zf(e.min,e.max-n,t.min):n>i&&(r=Zf(t.min,t.max-i,e.min)),Vo(0,1,r)}function DM(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const ky=.35;function LM(t=ky){return t===!1?t=0:t===!0&&(t=ky),{x:nE(t,"left","right"),y:nE(t,"top","bottom")}}function nE(t,e,r){return{min:iE(t,e),max:iE(t,r)}}function iE(t,e){return typeof t=="number"?t:t[e]||0}const sE=()=>({translate:0,scale:1,origin:0,originPoint:0}),Rl=()=>({x:sE(),y:sE()}),oE=()=>({min:0,max:0}),kr=()=>({x:oE(),y:oE()});function ai(t){return[t("x"),t("y")]}function O6({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function jM({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function FM(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function bv(t){return t===void 0||t===1}function Ay({scale:t,scaleX:e,scaleY:r}){return!bv(t)||!bv(e)||!bv(r)}function da(t){return Ay(t)||M6(t)||t.z||t.rotate||t.rotateX||t.rotateY}function M6(t){return aE(t.x)||aE(t.y)}function aE(t){return t&&t!=="0%"}function Kh(t,e,r){const n=t-r,i=e*n;return r+i}function lE(t,e,r,n,i){return i!==void 0&&(t=Kh(t,i,n)),Kh(t,r,n)+e}function Cy(t,e=0,r=1,n,i){t.min=lE(t.min,e,r,n,i),t.max=lE(t.max,e,r,n,i)}function N6(t,{x:e,y:r}){Cy(t.x,e.translate,e.scale,e.originPoint),Cy(t.y,r.translate,r.scale,r.originPoint)}function BM(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function bo(t,e){t.min=t.min+e,t.max=t.max+e}function fE(t,e,[r,n,i]){const s=e[i]!==void 0?e[i]:.5,o=tr(t.min,t.max,s);Cy(t,e[r],e[n],o,e.scale)}const UM=["x","scaleX","originX"],zM=["y","scaleY","originY"];function Il(t,e){fE(t.x,e,UM),fE(t.y,e,zM)}function $6(t,e){return O6(FM(t.getBoundingClientRect(),e))}function VM(t,e,r){const n=$6(t,r),{scroll:i}=e;return i&&(bo(n.x,i.offset.x),bo(n.y,i.offset.y)),n}const D6=({current:t})=>t?t.ownerDocument.defaultView:null,qM=new WeakMap;class HM{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=kr(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=f=>{const{dragSnapToOrigin:u}=this.getProps();u?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Q0(f,"page").point)},s=(f,u)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Y4(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ai(x=>{let b=this.getAxisMotionValue(x).get()||0;if(ls.test(b)){const{projection:w}=this.visualElement;if(w&&w.layout){const E=w.layout.layoutBox[x];E&&(b=Gn(E)*(parseFloat(b)/100))}}this.originPoint[x]=b}),p&&zt.update(()=>p(f,u),!1,!0);const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(f,u)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:x}=u;if(h&&this.currentDirection===null){this.currentDirection=WM(x),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",u.point,x),this.updateAxis("y",u.point,x),this.visualElement.render(),m&&m(f,u)},a=(f,u)=>this.stop(f,u),l=()=>ai(f=>{var u;return this.getAnimationState(f)==="paused"&&((u=this.getAxisMotionValue(f).animation)===null||u===void 0?void 0:u.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new R6(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:D6(this.visualElement)})}stop(e,r){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:i}=r;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&zt.update(()=>s(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!hd(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=OM(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&Tl(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=MM(i.layoutBox,r):this.constraints=!1,this.elastic=LM(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&ai(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=DM(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Tl(e))return!1;const n=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=VM(n,i.root,this.visualElement.getTransformPagePoint());let o=NM(i.layout.layoutBox,s);if(r){const a=r(jM(o));this.hasMutatedConstraints=!!a,a&&(o=O6(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=ai(f=>{if(!hd(f,r,this.currentDirection))return;let u=l&&l[f]||{};o&&(u={min:0,max:0});const d=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:n?e[f]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...s,...u};return this.startAxisValueAnimation(f,p)});return Promise.all(c).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return n.start(Ug(e,n,0,r))}stopAnimation(){ai(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ai(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r="_drag"+e.toUpperCase(),n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ai(r=>{const{drag:n}=this.getProps();if(!hd(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-tr(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Tl(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ai(o=>{const a=this.getAxisMotionValue(o);if(a){const l=a.get();i[o]=$M({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ai(o=>{if(!hd(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(tr(l,c,i[o]))})}addListeners(){if(!this.visualElement.current)return;qM.set(this.visualElement,this);const e=this.visualElement.current,r=Bs(e,"pointerdown",l=>{const{drag:c,dragListener:f=!0}=this.getProps();c&&f&&this.start(l)}),n=()=>{const{dragConstraints:l}=this.getProps();Tl(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),n();const o=Ls(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(ai(f=>{const u=this.getAxisMotionValue(f);u&&(this.originPoint[f]+=l[f].translate,u.set(u.get()+l[f].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=ky,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function hd(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function WM(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class GM extends ta{constructor(e){super(e),this.removeGroupControls=fr,this.removeListeners=fr,this.controls=new HM(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||fr}unmount(){this.removeGroupControls(),this.removeListeners()}}const uE=t=>(e,r)=>{t&&zt.update(()=>t(e,r))};class KM extends ta{constructor(){super(...arguments),this.removePointerDownListener=fr}onPointerDown(e){this.session=new R6(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:D6(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:uE(e),onStart:uE(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&zt.update(()=>i(s,o))}}}mount(){this.removePointerDownListener=Bs(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function YM(){const t=y.useContext(H0);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=y.useId();return y.useEffect(()=>n(i),[]),!e&&r?[!1,()=>r&&r(i)]:[!0]}const Xd={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function dE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const qc={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Pe.test(t))t=parseFloat(t);else return t;const r=dE(t,e.target.x),n=dE(t,e.target.y);return`${r}% ${n}%`}},QM={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=qo.parse(t);if(i.length>5)return n;const s=qo.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,l=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=l;const c=tr(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=c),typeof i[3+o]=="number"&&(i[3+o]/=c),s(i)}};class JM extends pr.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;iI(XM),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),Xd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||zt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),queueMicrotask(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function L6(t){const[e,r]=YM(),n=y.useContext(_g);return pr.createElement(JM,{...t,layoutGroup:n,switchLayoutGroup:y.useContext(O4),isPresent:e,safeToRemove:r})}const XM={borderRadius:{...qc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:qc,borderTopRightRadius:qc,borderBottomLeftRadius:qc,borderBottomRightRadius:qc,boxShadow:QM},j6=["TopLeft","TopRight","BottomLeft","BottomRight"],ZM=j6.length,hE=t=>typeof t=="string"?parseFloat(t):t,vE=t=>typeof t=="number"||Pe.test(t);function eN(t,e,r,n,i,s){i?(t.opacity=tr(0,r.opacity!==void 0?r.opacity:1,tN(n)),t.opacityExit=tr(e.opacity!==void 0?e.opacity:1,0,rN(n))):s&&(t.opacity=tr(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(Zf(t,e,n))}function yE(t,e){t.min=e.min,t.max=e.max}function ii(t,e){yE(t.x,e.x),yE(t.y,e.y)}function mE(t,e,r,n,i){return t-=e,t=Kh(t,1/r,n),i!==void 0&&(t=Kh(t,1/i,n)),t}function nN(t,e=0,r=1,n=.5,i,s=t,o=t){if(ls.test(e)&&(e=parseFloat(e),e=tr(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=tr(s.min,s.max,n);t===s&&(a-=e),t.min=mE(t.min,e,r,a,i),t.max=mE(t.max,e,r,a,i)}function gE(t,e,[r,n,i],s,o){nN(t,e[r],e[n],e[i],e.scale,s,o)}const iN=["x","scaleX","originX"],sN=["y","scaleY","originY"];function xE(t,e,r,n){gE(t.x,e,iN,r?r.x:void 0,n?n.x:void 0),gE(t.y,e,sN,r?r.y:void 0,n?n.y:void 0)}function bE(t){return t.translate===0&&t.scale===1}function B6(t){return bE(t.x)&&bE(t.y)}function oN(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function U6(t,e){return Math.round(t.x.min)===Math.round(e.x.min)&&Math.round(t.x.max)===Math.round(e.x.max)&&Math.round(t.y.min)===Math.round(e.y.min)&&Math.round(t.y.max)===Math.round(e.y.max)}function wE(t){return Gn(t.x)/Gn(t.y)}class aN{constructor(){this.members=[]}add(e){zg(this.members,e),e.scheduleRender()}remove(e){if(Vg(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function EE(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y;if((i||s)&&(n=`translate3d(${i}px, ${s}px, 0) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{rotate:l,rotateX:c,rotateY:f}=r;l&&(n+=`rotate(${l}deg) `),c&&(n+=`rotateX(${c}deg) `),f&&(n+=`rotateY(${f}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(n+=`scale(${o}, ${a})`),n||"none"}const lN=(t,e)=>t.depth-e.depth;class cN{constructor(){this.children=[],this.isDirty=!1}add(e){zg(this.children,e),this.isDirty=!0}remove(e){Vg(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(lN),this.isDirty=!1,this.children.forEach(e)}}function fN(t,e){const r=performance.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(Gs(n),t(s-e))};return zt.read(n,!0),()=>Gs(n)}function uN(t){window.MotionDebug&&window.MotionDebug.record(t)}function dN(t){return t instanceof SVGElement&&t.tagName!=="svg"}function hN(t,e,r){const n=Tn(t)?t:rc(t);return n.start(Ug("",n,e,r)),n.animation}const SE=["","X","Y","Z"],vN={visibility:"hidden"},kE=1e3;let pN=0;const ha={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function z6({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=pN++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ha.totalNodes=ha.resolvedTargetDeltas=ha.recalculatedProjection=0,this.nodes.forEach(gN),this.nodes.forEach(SN),this.nodes.forEach(kN),this.nodes.forEach(xN),uN(ha)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,u&&u(),u=fN(d,250),Xd.hasAnimatedSinceResize&&(Xd.hasAnimatedSinceResize=!1,this.nodes.forEach(CE))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&f&&(l||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||f.getDefaultTransition()||PN,{onLayoutAnimationStart:x,onLayoutAnimationComplete:b}=f.getProps(),w=!this.targetLayout||!U6(this.targetLayout,p)||h,E=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||d&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(u,E);const P={...Bg(m,"layout"),onPlay:x,onComplete:b};(f.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P)}else d||CE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Gs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(AN),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;fthis.update()))}clearAllSnapshots(){this.nodes.forEach(bN),this.sharedNodes.forEach(CN)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,zt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){zt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const N=P/1e3;_E(u.x,o.x,N),_E(u.y,o.y,N),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cf(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),_N(this.relativeTarget,this.relativeTargetOrigin,d,N),E&&oN(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=kr()),ii(E,this.relativeTarget)),m&&(this.animationValues=f,eN(f,c,this.latestValues,N,w,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=N},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Gs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=zt.update(()=>{Xd.hasAnimatedSinceResize=!0,this.currentAnimation=hN(0,kE,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(kE),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:f}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&V6(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||kr();const u=Gn(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+u;const d=Gn(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}ii(a,l),Il(a,f),Af(this.projectionDeltaWithTransform,this.layoutCorrected,a,f)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new aN),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const c={};for(let f=0;f{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(AE),this.root.sharedNodes.clear()}}}function yN(t){t.updateLayout()}function mN(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?ai(u=>{const d=o?r.measuredBox[u]:r.layoutBox[u],h=Gn(d);d.min=n[u].min,d.max=d.min+h}):V6(s,r.layoutBox,n)&&ai(u=>{const d=o?r.measuredBox[u]:r.layoutBox[u],h=Gn(n[u]);d.max=d.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+h)});const a=Rl();Af(a,n,r.layoutBox);const l=Rl();o?Af(l,t.applyTransform(i,!0),r.measuredBox):Af(l,n,r.layoutBox);const c=!B6(a);let f=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:d,layout:h}=u;if(d&&h){const p=kr();Cf(p,r.layoutBox,d.layoutBox);const m=kr();Cf(m,n,h.layoutBox),U6(p,m)||(f=!0),u.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=p,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:f})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function gN(t){ha.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function xN(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function bN(t){t.clearSnapshot()}function AE(t){t.clearMeasurements()}function wN(t){t.isLayoutDirty=!1}function EN(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function CE(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function SN(t){t.resolveTargetDelta()}function kN(t){t.calcProjection()}function AN(t){t.resetRotation()}function CN(t){t.removeLeadSnapshot()}function _E(t,e,r){t.translate=tr(e.translate,0,r),t.scale=tr(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function TE(t,e,r,n){t.min=tr(e.min,r.min,n),t.max=tr(e.max,r.max,n)}function _N(t,e,r,n){TE(t.x,e.x,r.x,n),TE(t.y,e.y,r.y,n)}function TN(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const PN={duration:.45,ease:[.4,0,.1,1]},PE=t=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(t),RE=PE("applewebkit/")&&!PE("chrome/")?Math.round:fr;function IE(t){t.min=RE(t.min),t.max=RE(t.max)}function RN(t){IE(t.x),IE(t.y)}function V6(t,e,r){return t==="position"||t==="preserve-aspect"&&!Sy(wE(e),wE(r),.2)}const IN=z6({attachResizeListener:(t,e)=>Ls(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),wv={current:void 0},q6=z6({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!wv.current){const t=new IN({});t.mount(window),t.setOptions({layoutScroll:!0}),wv.current=t}return wv.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),ON={pan:{Feature:KM},drag:{Feature:GM,ProjectionNode:q6,MeasureLayout:L6}},MN=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function NN(t){const e=MN.exec(t);if(!e)return[,];const[,r,n]=e;return[r,n]}function _y(t,e,r=1){const[n,i]=NN(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return C6(o)?parseFloat(o):o}else return yy(i)?_y(i,e,r+1):i}function $N(t,{...e},r){const n=t.current;if(!(n instanceof Element))return{target:e,transitionEnd:r};r&&(r={...r}),t.values.forEach(i=>{const s=i.get();if(!yy(s))return;const o=_y(s,n);o&&i.set(o)});for(const i in e){const s=e[i];if(!yy(s))continue;const o=_y(s,n);o&&(e[i]=o,r||(r={}),r[i]===void 0&&(r[i]=s))}return{target:e,transitionEnd:r}}const DN=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),H6=t=>DN.has(t),LN=t=>Object.keys(t).some(H6),OE=t=>t===Ja||t===Pe,ME=(t,e)=>parseFloat(t.split(", ")[e]),NE=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/);if(i)return ME(i[1],e);{const s=n.match(/^matrix\((.+)\)$/);return s?ME(s[1],t):0}},jN=new Set(["x","y","z"]),FN=Iu.filter(t=>!jN.has(t));function BN(t){const e=[];return FN.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e.length&&t.render(),e}const nc={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:NE(4,13),y:NE(5,14)};nc.translateX=nc.x;nc.translateY=nc.y;const UN=(t,e,r)=>{const n=e.measureViewportBox(),i=e.current,s=getComputedStyle(i),{display:o}=s,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),r.forEach(c=>{a[c]=nc[c](n,s)}),e.render();const l=e.measureViewportBox();return r.forEach(c=>{const f=e.getValue(c);f&&f.jump(a[c]),t[c]=nc[c](l,s)}),t},zN=(t,e,r={},n={})=>{e={...e},n={...n};const i=Object.keys(e).filter(H6);let s=[],o=!1;const a=[];if(i.forEach(l=>{const c=t.getValue(l);if(!t.hasValue(l))return;let f=r[l],u=Vc(f);const d=e[l];let h;if(Vh(d)){const p=d.length,m=d[0]===null?1:0;f=d[m],u=Vc(f);for(let x=m;x=0?window.pageYOffset:null,c=UN(e,t,a);return s.length&&s.forEach(([f,u])=>{t.getValue(f).set(u)}),t.render(),W0&&l!==null&&window.scrollTo({top:l}),{target:c,transitionEnd:n}}else return{target:e,transitionEnd:n}};function VN(t,e,r,n){return LN(e)?zN(t,e,r,n):{target:e,transitionEnd:n}}const qN=(t,e,r,n)=>{const i=$N(t,e,n);return e=i.target,n=i.transitionEnd,VN(t,e,r,n)},Ty={current:null},W6={current:!1};function HN(){if(W6.current=!0,!!W0)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Ty.current=t.matches;t.addListener(e),e()}else Ty.current=!1}function WN(t,e,r){const{willChange:n}=e;for(const i in e){const s=e[i],o=r[i];if(Tn(s))t.addValue(i,s),Gh(n)&&n.add(i);else if(Tn(o))t.addValue(i,rc(s,{owner:t})),Gh(n)&&n.remove(i);else if(o!==s)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(s)}else{const a=t.getStaticValue(i);t.addValue(i,rc(a!==void 0?a:s,{owner:t}))}}for(const i in r)e[i]===void 0&&t.removeValue(i);return e}const $E=new WeakMap,G6=Object.keys(Xf),GN=G6.length,DE=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],KN=Cg.length;class YN{constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,visualState:s},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>zt.render(this.render,!1,!0);const{latestValues:a,renderState:l}=s;this.latestValues=a,this.baseTarget={...a},this.initialValues=r.initial?{...a}:{},this.renderState=l,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=K0(r),this.isVariantNode=I4(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(r,{});for(const u in f){const d=f[u];a[u]!==void 0&&Tn(d)&&(d.set(a[u],!1),Gh(c)&&c.add(u))}}scrapeMotionValuesFromProps(e,r){return{}}mount(e){this.current=e,$E.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),W6.current||HN(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Ty.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$E.delete(this.current),this.projection&&this.projection.unmount(),Gs(this.notifyUpdate),Gs(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,r){const n=Qa.has(e),i=r.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&zt.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),s()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...r},n,i,s){let o,a;for(let l=0;lthis.scheduleRender(),animationType:typeof c=="string"?c:"both",initialPromotionConfig:s,layoutScroll:d,layoutRoot:h})}return a}updateFeatures(){for(const e in this.features){const r=this.features[e];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):kr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}makeTargetAnimatable(e,r=!0){return this.makeTargetAnimatableFromInstance(e,this.props,r)}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){r!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,r)),this.values.set(e,r),this.latestValues[e]=r.get()}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=rc(r,{owner:this}),this.addValue(e,n)),n}readValue(e){var r;return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props,i=typeof n=="string"||typeof n=="object"?(r=Ng(this.props,n))===null||r===void 0?void 0:r[e]:void 0;if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Tn(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new qg),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class K6 extends YN{sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:r,...n},{transformValues:i},s){let o=dM(n,e||{},this);if(i&&(r&&(r=i(r)),n&&(n=i(n)),o&&(o=i(o))),s){fM(this,n,o);const a=qN(this,n,o,r);r=a.transitionEnd,n=a.target}return{transition:e,transitionEnd:r,...n}}}function QN(t){return window.getComputedStyle(t)}class JN extends K6{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,r){if(Qa.has(r)){const n=Fg(r);return n&&n.default||0}else{const n=QN(e),i=($4(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return $6(e,r)}build(e,r,n,i){Pg(e,r,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,r){return Mg(e,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Tn(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}renderInstance(e,r,n,i){U4(e,r,n,i)}}class XN extends K6{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Qa.has(r)){const n=Fg(r);return n&&n.default||0}return r=z4.has(r)?r:kg(r),e.getAttribute(r)}measureInstanceViewportBox(){return kr()}scrapeMotionValuesFromProps(e,r){return q4(e,r)}build(e,r,n,i){Ig(e,r,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,r,n,i){V4(e,r,n,i)}mount(e){this.isSVGTag=Og(e.tagName),super.mount(e)}}const ZN=(t,e)=>Tg(t)?new XN(e,{enableHardwareAcceleration:!1}):new JN(e,{enableHardwareAcceleration:!0}),e$={layout:{ProjectionNode:q6,MeasureLayout:L6}},t$={..._M,...GI,...ON,...e$},Ta=rI((t,e)=>NI(t,e,t$,ZN));function Y6(){const t=y.useRef(!1);return Sg(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function r$(){const t=Y6(),[e,r]=y.useState(0),n=y.useCallback(()=>{t.current&&r(e+1)},[e]);return[y.useCallback(()=>zt.postRender(n),[n]),e]}class n$ extends y.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function i$({children:t,isPresent:e}){const r=y.useId(),n=y.useRef(null),i=y.useRef({width:0,height:0,top:0,left:0});return y.useInsertionEffect(()=>{const{width:s,height:o,top:a,left:l}=i.current;if(e||!n.current||!s||!o)return;n.current.dataset.motionPopId=r;const c=document.createElement("style");return document.head.appendChild(c),c.sheet&&c.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${s}px !important; @@ -58,7 +58,7 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var FE;function b$(){if(FE)return Hc;FE=1;var t=vr,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var f,u={},d=null,h=null;c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(h=l.ref);for(f in l)n.call(l,f)&&!s.hasOwnProperty(f)&&(u[f]=l[f]);if(a&&a.defaultProps)for(f in l=a.defaultProps,l)u[f]===void 0&&(u[f]=l[f]);return{$$typeof:e,type:a,key:d,ref:h,props:u,_owner:i.current}}return Hc.Fragment=r,Hc.jsx=o,Hc.jsxs=o,Hc}Z6.exports=b$();var Y=Z6.exports;function w$(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 E$(t){var e=w$(t,"string");return typeof e=="symbol"?e:String(e)}function S$(t,e,r){return e=E$(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function BE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function UE(t){for(var e=1;e{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},fr=t=>{var e=r=>{var n=t.defaultClassName,i=UE(UE({},t.defaultVariants),r);for(var s in i){var o,a=(o=i[s])!==null&&o!==void 0?o:t.defaultVariants[s];if(a!=null){var l=a;typeof l=="boolean"&&(l=l===!0?"true":"false");var c=t.variantClassNames[s][l];c&&(n+=" "+c)}}for(var[f,u]of t.compoundVariants)k$(f,i,t.defaultVariants)&&(n+=" "+u);return n};return e.variants=()=>Object.keys(t.variantClassNames),e.classNames={get base(){return t.defaultClassName.split(" ")[0]},get variants(){return zE(t.variantClassNames,r=>zE(r,n=>n.split(" ")[0]))}},e};fr({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 Nr=t=>{const{color:e="borderNormal",marginY:r="4",...n}=t;return Y.jsx(G,{as:"hr",marginY:r,background:e,height:"px",borderWidth:"none",...n})};var A$=fr({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 me=y.forwardRef((t,e)=>{const{as:r="span",variant:n="inherit",className:i,hidden:s,italic:o,underline:a,children:l,ellipsis:c,uppercase:f,capitalize:u,...d}=t,h=d$[n];return Y.jsx(G,{as:r,className:In(i,A$({hidden:s,ellipsis:c,italic:o,underline:a,uppercase:f,capitalize:u})),ref:e,...h,...d,children:l})});var C$=fr({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 Ct=y.forwardRef((t,e)=>{const{as:r="button",activeOutline:n,className:i,disabled:s=!1,display:o="inline-flex",fontWeight:a="bold",pending:l=!1,label:c,leftIcon:f,rightIcon:u,size:d="md",variant:h="glass",width:p="fit",shape:m="circle",type:x="button",...b}=t,w=f!==void 0&&c!==void 0,E=u!==void 0&&c!==void 0,P=f!==void 0&&c===void 0,N=d==="xs"?"xs":"sm";return Y.jsx(G,{as:r,className:In(i,C$({activeOutline:n,disabled:s||l,hasLeftIcon:w,hasRightIcon:E,iconOnly:P,size:h==="text"?void 0:d,shape:h==="text"?void 0:m,variant:h})),disabled:s||l,display:o,fontWeight:a,ref:e,type:x,width:p,...b,children:P?Y.jsx(f,{size:N}):Y.jsxs(G,{width:"full",height:"full",justifyContent:"space-between",alignItems:"center",gap:d==="xs"?"1":"2",children:[Y.jsxs(G,{justifyContent:"flex-start",alignItems:"center",gap:d==="xs"?"1":"2",children:[f&&Y.jsx(f,{size:N}),Y.jsx(me,{children:c})]}),u&&Y.jsx(u,{size:N})]})})});var _$=fr({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 T$=y.forwardRef((t,e)=>{const{className:r,children:n,clickable:i,outlined:s,disabled:o,blur:a,width:l="full",...c}=t;return Y.jsx(G,{className:In(r,_$({clickable:i,outlined:s,disabled:o,blur:a})),background:s?"transparent":"backgroundSecondary",overflow:"hidden",borderRadius:"md",padding:"4",width:l,ref:e,...c,children:n})});function Wt(){return Wt=Object.assign?Object.assign.bind():function(t){for(var e=1;et.forEach(r=>P$(r,e))}function Tt(...t){return y.useCallback(e5(...t),t)}function cn(t,e=[]){let r=[];function n(s,o){const a=y.createContext(o),l=r.length;r=[...r,o];function c(u){const{scope:d,children:h,...p}=u,m=(d==null?void 0:d[t][l])||a,x=y.useMemo(()=>p,Object.values(p));return y.createElement(m.Provider,{value:x},h)}function f(u,d){const h=(d==null?void 0:d[t][l])||a,p=y.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,f]}const i=()=>{const s=r.map(o=>y.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return y.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[n,R$(i,...e)]}function R$(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Ce(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Pn(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}function Ks({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=I$({defaultProp:e,onChange:r}),s=t!==void 0,o=s?t:n,a=Pn(r),l=y.useCallback(c=>{if(s){const u=typeof c=="function"?c(t):c;u!==t&&a(u)}else i(c)},[s,t,i,a]);return[o,l]}function I$({defaultProp:t,onChange:e}){const r=y.useState(t),[n]=r,i=y.useRef(n),s=Pn(e);return y.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}function X0(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const Kn=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{};function Z0(t){const[e,r]=y.useState(void 0);return Kn(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.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 O$(t,e){return y.useReducer((r,n)=>{const i=e[r][n];return i??r},t)}const no=t=>{const{present:e,children:r}=t,n=M$(e),i=typeof r=="function"?r({present:n.isPresent}):y.Children.only(r),s=Tt(n.ref,i.ref);return typeof r=="function"||n.isPresent?y.cloneElement(i,{ref:s}):null};no.displayName="Presence";function M$(t){const[e,r]=y.useState(),n=y.useRef({}),i=y.useRef(t),s=y.useRef("none"),o=t?"mounted":"unmounted",[a,l]=O$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=vd(n.current);s.current=a==="mounted"?c:"none"},[a]),Kn(()=>{const c=n.current,f=i.current;if(f!==t){const d=s.current,h=vd(c);t?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(f&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Kn(()=>{if(e){const c=u=>{const h=vd(n.current).includes(u.animationName);u.target===e&&h&&ro.flushSync(()=>l("ANIMATION_END"))},f=u=>{u.target===e&&(s.current=vd(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:y.useCallback(c=>{c&&(n.current=getComputedStyle(c)),r(c)},[])}}function vd(t){return(t==null?void 0:t.animationName)||"none"}function _e(){return _e=Object.assign?Object.assign.bind():function(t){for(var e=1;e{const{children:r,...n}=t,i=y.Children.toArray(r),s=i.find($$);if(s){const o=s.props.children,a=i.map(l=>l===s?y.Children.count(o)>1?y.Children.only(null):y.isValidElement(o)?o.props.children:null:l);return y.createElement(Ry,_e({},n,{ref:e}),y.isValidElement(o)?y.cloneElement(o,void 0,a):null)}return y.createElement(Ry,_e({},n,{ref:e}),r)});ic.displayName="Slot";const Ry=y.forwardRef((t,e)=>{const{children:r,...n}=t;return y.isValidElement(r)?y.cloneElement(r,{...D$(n,r.props),ref:e?e5(e,r.ref):r.ref}):y.Children.count(r)>1?y.Children.only(null):null});Ry.displayName="SlotClone";const N$=({children:t})=>y.createElement(y.Fragment,null,t);function $$(t){return y.isValidElement(t)&&t.type===N$}function D$(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}const L$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ve=L$.reduce((t,e)=>{const r=y.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?ic:e;return y.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),y.createElement(a,Wt({},o,{ref:i}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Wg(t,e){t&&ro.flushSync(()=>t.dispatchEvent(e))}const t5="Checkbox",[j$,gse]=cn(t5),[F$,B$]=j$(t5),U$=y.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,...f}=t,[u,d]=y.useState(null),h=Tt(e,E=>d(E)),p=y.useRef(!1),m=u?!!u.closest("form"):!0,[x=!1,b]=Ks({prop:i,defaultProp:s,onChange:c}),w=y.useRef(x);return y.useEffect(()=>{const E=u==null?void 0:u.form;if(E){const P=()=>b(w.current);return E.addEventListener("reset",P),()=>E.removeEventListener("reset",P)}},[u,b]),y.createElement(F$,{scope:r,state:x,disabled:a},y.createElement(Ve.button,Wt({type:"button",role:"checkbox","aria-checked":Pa(x)?"mixed":x,"aria-required":o,"data-state":r5(x),"data-disabled":a?"":void 0,disabled:a,value:l},f,{ref:h,onKeyDown:Ce(t.onKeyDown,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Ce(t.onClick,E=>{b(P=>Pa(P)?!0:!P),m&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})),m&&y.createElement(q$,{control:u,bubbles:!p.current,name:n,value:l,checked:x,required:o,disabled:a,style:{transform:"translateX(-100%)"}}))}),z$="CheckboxIndicator",V$=y.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...i}=t,s=B$(z$,r);return y.createElement(no,{present:n||Pa(s.state)||s.state===!0},y.createElement(Ve.span,Wt({"data-state":r5(s.state),"data-disabled":s.disabled?"":void 0},i,{ref:e,style:{pointerEvents:"none",...t.style}})))}),q$=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=y.useRef(null),o=X0(r),a=Z0(e);return y.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==r&&u){const d=new Event("click",{bubbles:n});l.indeterminate=Pa(r),u.call(l,Pa(r)?!1:r),l.dispatchEvent(d)}},[o,r,n]),y.createElement("input",Wt({type:"checkbox","aria-hidden":!0,defaultChecked:Pa(r)?!1:r},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Pa(t){return t==="indeterminate"}function r5(t){return Pa(t)?"indeterminate":t?"checked":"unchecked"}const H$=U$,W$=V$;var G$=fr({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 Xa=t=>{const{id:e,label:r,description:n,labelLocation:i="top",children:s,...o}=t,a=()=>r||n?Y.jsxs(G,{flexDirection:"column",gap:"0.5",children:[r&&Y.jsx(me,{variant:"small",color:"text100",hidden:i==="hidden",children:r}),n&&Y.jsx(me,{variant:"small",color:"text50",hidden:i==="hidden",children:n})]}):null;return Y.jsxs(G,{as:"label",className:G$({labelLocation:i}),htmlFor:e,...o,children:[["left","top","hidden"].includes(i)&&a(),s,i==="right"&&a()]})};var e1=fr({defaultClassName:"_1dizidw0",variantClassNames:{size:{xs:"_1dizidw1",sm:"_1dizidw2",md:"_1dizidw3",lg:"_1dizidw4",xl:"_1dizidw5"}},defaultVariants:{},compoundVariants:[]});const K$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{stroke:"currentColor",strokeWidth:1.5,d:"m4.304 10.232 4.263 4.79 7.13-11.238"})}),Gg=({size:t="sm",...e})=>Y.jsx(G,{as:K$,className:e1({size:t}),...e}),Y$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.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"})}),n5=({size:t="sm",...e})=>Y.jsx(G,{as:Y$,className:e1({size:t}),...e}),Q$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.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"})}),eu=({size:t="sm",...e})=>Y.jsx(G,{as:Q$,className:e1({size:t}),...e}),J$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.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"})}),X$=({size:t="sm",...e})=>Y.jsx(G,{as:J$,className:e1({size:t}),...e});var Z$=fr({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:[]}),eD="_1c9x66f4 fyvr12s1 fyvr11h0 fyvr11ko fyvr11jg fyvr128 fyvr15o";const tD=({size:t="sm"})=>Y.jsx(W$,{className:eD,children:Y.jsx(Gg,{size:t==="lg"?"sm":"xs"})}),i5=y.forwardRef((t,e)=>{const{disabled:r=!1,id:n,name:i,label:s="",labelLocation:o="left",size:a="sm",...l}=t;return Y.jsx(Xa,{disabled:r,display:"flex",id:n??i,label:s,labelLocation:o,whiteSpace:"nowrap",children:Y.jsx(H$,{className:Z$({size:a}),disabled:r,id:n??i,name:i,ref:e,...l,children:Y.jsx(tD,{size:a})})})});vr.createContext(null);const rD=kC["useId".toString()]||(()=>{});let nD=0;function jo(t){const[e,r]=y.useState(rD());return Kn(()=>{t||r(n=>n??String(nD++))},[t]),t||(e?`radix-${e}`:"")}const s5="Collapsible",[iD,xse]=cn(s5),[sD,Kg]=iD(s5),oD=y.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l=!1,c]=Ks({prop:n,defaultProp:i,onChange:o});return y.createElement(sD,{scope:r,disabled:s,contentId:jo(),open:l,onOpenToggle:y.useCallback(()=>c(f=>!f),[c])},y.createElement(Ve.div,Wt({"data-state":Yg(l),"data-disabled":s?"":void 0},a,{ref:e})))}),aD="CollapsibleTrigger",lD=y.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,i=Kg(aD,r);return y.createElement(Ve.button,Wt({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Yg(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},n,{ref:e,onClick:Ce(t.onClick,i.onOpenToggle)}))}),o5="CollapsibleContent",cD=y.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Kg(o5,t.__scopeCollapsible);return y.createElement(no,{present:r||i.open},({present:s})=>y.createElement(fD,Wt({},n,{ref:e,present:s})))}),fD=y.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:i,...s}=t,o=Kg(o5,r),[a,l]=y.useState(n),c=y.useRef(null),f=Tt(e,c),u=y.useRef(0),d=u.current,h=y.useRef(0),p=h.current,m=o.open||a,x=y.useRef(m),b=y.useRef();return y.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),Kn(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const E=w.getBoundingClientRect();u.current=E.height,h.current=E.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(n)}},[o.open,n]),y.createElement(Ve.div,Wt({"data-state":Yg(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m},s,{ref:f,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...t.style}}),m&&i)});function Yg(t){return t?"open":"closed"}const uD=oD,dD=lD,hD=cD;var VE="64px",vD="_4j62fl0",pD="_4j62fl2 _4j62fl1 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11h0 fyvr11ko fyvr11od fyvr128 fyvr12v7 fyvr11n4 _4efw240",yD="_4j62fl4 _4j62fl3 fyvr1ww fyvr1ys fyvr1so fyvr1v0 fyvr128",mD="_4j62fl5";const il=t=>{const{className:e,children:r,defaultOpen:n,open:i,onOpenChange:s,label:o,...a}=t,[l,c]=y.useState(n),f=i??l,u=h=>{i===void 0&&c(h)},d=h=>{u(h),s==null||s(h)};return Y.jsx(uD,{open:f,defaultOpen:n,onOpenChange:d,asChild:!0,children:Y.jsxs(G,{as:Ta.div,className:In(e,vD),initial:{height:f?"auto":VE},animate:{height:f?"auto":VE},transition:{ease:"easeOut",duration:.3},borderRadius:"md",background:"backgroundSecondary",position:"relative",overflow:"hidden",width:"full",...a,children:[Y.jsxs(dD,{className:pD,children:[Y.jsx(me,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:o}),Y.jsx(G,{as:Ta.div,position:"absolute",right:"0",marginRight:"4",initial:{rotate:f?180:0},animate:{rotate:f?180:0},transition:{ease:"linear",duration:.1},children:Y.jsx(n5,{className:mD,color:"text50"})})]}),Y.jsx(Hg,{children:f&&Y.jsx(hD,{className:yD,asChild:!0,forceMount:!0,children:Y.jsx(Ta.div,{initial:{opacity:f?1:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:"easeOut",duration:.3},children:r})})})]})})};function t1(t){const e=t+"CollectionProvider",[r,n]=cn(e),[i,s]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:p,children:m}=h,x=vr.useRef(null),b=vr.useRef(new Map).current;return vr.createElement(i,{scope:p,itemMap:b,collectionRef:x},m)},a=t+"CollectionSlot",l=vr.forwardRef((h,p)=>{const{scope:m,children:x}=h,b=s(a,m),w=Tt(p,b.collectionRef);return vr.createElement(ic,{ref:w},x)}),c=t+"CollectionItemSlot",f="data-radix-collection-item",u=vr.forwardRef((h,p)=>{const{scope:m,children:x,...b}=h,w=vr.useRef(null),E=Tt(p,w),P=s(c,m);return vr.useEffect(()=>(P.itemMap.set(w,{ref:w,...b}),()=>void P.itemMap.delete(w))),vr.createElement(ic,{[f]:"",ref:E},x)});function d(h){const p=s(t+"CollectionConsumer",h);return vr.useCallback(()=>{const x=p.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((P,N)=>b.indexOf(P.ref.current)-b.indexOf(N.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:l,ItemSlot:u},d,n]}const gD=y.createContext(void 0);function Qg(t){const e=y.useContext(gD);return t||e||"ltr"}function xD(t,e=globalThis==null?void 0:globalThis.document){const r=Pn(t);y.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[r,e])}const Iy="dismissableLayer.update",bD="dismissableLayer.pointerDownOutside",wD="dismissableLayer.focusOutside";let qE;const a5=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jg=y.forwardRef((t,e)=>{var r;const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,f=y.useContext(a5),[u,d]=y.useState(null),h=(r=u==null?void 0:u.ownerDocument)!==null&&r!==void 0?r:globalThis==null?void 0:globalThis.document,[,p]=y.useState({}),m=Tt(e,L=>d(L)),x=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=x.indexOf(b),E=u?x.indexOf(u):-1,P=f.layersWithOutsidePointerEventsDisabled.size>0,N=E>=w,I=SD(L=>{const U=L.target,K=[...f.branches].some(X=>X.contains(U));!N||K||(s==null||s(L),a==null||a(L),L.defaultPrevented||l==null||l())},h),j=kD(L=>{const U=L.target;[...f.branches].some(X=>X.contains(U))||(o==null||o(L),a==null||a(L),L.defaultPrevented||l==null||l())},h);return xD(L=>{E===f.layers.size-1&&(i==null||i(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))},h),y.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(qE=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),HE(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=qE)}},[u,h,n,f]),y.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),HE())},[u,f]),y.useEffect(()=>{const L=()=>p({});return document.addEventListener(Iy,L),()=>document.removeEventListener(Iy,L)},[]),y.createElement(Ve.div,_e({},c,{ref:m,style:{pointerEvents:P?N?"auto":"none":void 0,...t.style},onFocusCapture:Ce(t.onFocusCapture,j.onFocusCapture),onBlurCapture:Ce(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Ce(t.onPointerDownCapture,I.onPointerDownCapture)}))}),ED=y.forwardRef((t,e)=>{const r=y.useContext(a5),n=y.useRef(null),i=Tt(e,n);return y.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),y.createElement(Ve.div,_e({},t,{ref:i}))});function SD(t,e=globalThis==null?void 0:globalThis.document){const r=Pn(t),n=y.useRef(!1),i=y.useRef(()=>{});return y.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){l5(bD,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function kD(t,e=globalThis==null?void 0:globalThis.document){const r=Pn(t),n=y.useRef(!1);return y.useEffect(()=>{const i=s=>{s.target&&!n.current&&l5(wD,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function HE(){const t=new CustomEvent(Iy);document.dispatchEvent(t)}function l5(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?Wg(i,s):i.dispatchEvent(s)}const AD=Jg,CD=ED;let kv=0;function c5(){y.useEffect(()=>{var t,e;const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=r[0])!==null&&t!==void 0?t:WE()),document.body.insertAdjacentElement("beforeend",(e=r[1])!==null&&e!==void 0?e:WE()),kv++,()=>{kv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),kv--}},[])}function WE(){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}const Av="focusScope.autoFocusOnMount",Cv="focusScope.autoFocusOnUnmount",GE={bubbles:!1,cancelable:!0},f5=y.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=y.useState(null),c=Pn(i),f=Pn(s),u=y.useRef(null),d=Tt(e,m=>l(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(n){let m=function(E){if(h.paused||!a)return;const P=E.target;a.contains(P)?u.current=P:po(u.current,{select:!0})},x=function(E){if(h.paused||!a)return;const P=E.relatedTarget;P!==null&&(a.contains(P)||po(u.current,{select:!0}))},b=function(E){if(document.activeElement===document.body)for(const N of E)N.removedNodes.length>0&&po(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),w.disconnect()}}},[n,a,h.paused]),y.useEffect(()=>{if(a){YE.add(h);const m=document.activeElement;if(!a.contains(m)){const b=new CustomEvent(Av,GE);a.addEventListener(Av,c),a.dispatchEvent(b),b.defaultPrevented||(_D(OD(u5(a)),{select:!0}),document.activeElement===m&&po(a))}return()=>{a.removeEventListener(Av,c),setTimeout(()=>{const b=new CustomEvent(Cv,GE);a.addEventListener(Cv,f),a.dispatchEvent(b),b.defaultPrevented||po(m??document.body,{select:!0}),a.removeEventListener(Cv,f),YE.remove(h)},0)}}},[a,c,f,h]);const p=y.useCallback(m=>{if(!r&&!n||h.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const w=m.currentTarget,[E,P]=TD(w);E&&P?!m.shiftKey&&b===P?(m.preventDefault(),r&&po(E,{select:!0})):m.shiftKey&&b===E&&(m.preventDefault(),r&&po(P,{select:!0})):b===w&&m.preventDefault()}},[r,n,h.paused]);return y.createElement(Ve.div,_e({tabIndex:-1},o,{ref:d,onKeyDown:p}))});function _D(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(po(n,{select:e}),document.activeElement!==r)return}function TD(t){const e=u5(t),r=KE(e,t),n=KE(e.reverse(),t);return[r,n]}function u5(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function KE(t,e){for(const r of t)if(!PD(r,{upTo:e}))return r}function PD(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 RD(t){return t instanceof HTMLInputElement&&"select"in t}function po(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&RD(t)&&e&&t.select()}}const YE=ID();function ID(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=QE(t,e),t.unshift(e)},remove(e){var r;t=QE(t,e),(r=t[0])===null||r===void 0||r.resume()}}}function QE(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function OD(t){return t.filter(e=>e.tagName!=="A")}const MD=["top","right","bottom","left"],Ho=Math.min,Un=Math.max,Yh=Math.round,pd=Math.floor,Wo=t=>({x:t,y:t}),ND={left:"right",right:"left",bottom:"top",top:"bottom"},$D={start:"end",end:"start"};function Oy(t,e,r){return Un(t,Ho(e,r))}function Ys(t,e){return typeof t=="function"?t(e):t}function Qs(t){return t.split("-")[0]}function xc(t){return t.split("-")[1]}function Xg(t){return t==="x"?"y":"x"}function Zg(t){return t==="y"?"height":"width"}function bc(t){return["top","bottom"].includes(Qs(t))?"y":"x"}function ex(t){return Xg(bc(t))}function DD(t,e,r){r===void 0&&(r=!1);const n=xc(t),i=ex(t),s=Zg(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Qh(o)),[o,Qh(o)]}function LD(t){const e=Qh(t);return[My(t),e,My(e)]}function My(t){return t.replace(/start|end/g,e=>$D[e])}function jD(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:o;default:return[]}}function FD(t,e,r,n){const i=xc(t);let s=jD(Qs(t),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(My)))),s}function Qh(t){return t.replace(/left|right|bottom|top/g,e=>ND[e])}function BD(t){return{top:0,right:0,bottom:0,left:0,...t}}function d5(t){return typeof t!="number"?BD(t):{top:t,right:t,bottom:t,left:t}}function Jh(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function JE(t,e,r){let{reference:n,floating:i}=t;const s=bc(e),o=ex(e),a=Zg(o),l=Qs(e),c=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,d=n[a]/2-i[a]/2;let h;switch(l){case"top":h={x:f,y:n.y-i.height};break;case"bottom":h={x:f,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:u};break;case"left":h={x:n.x-i.width,y:u};break;default:h={x:n.x,y:n.y}}switch(xc(e)){case"start":h[o]-=d*(r&&c?-1:1);break;case"end":h[o]+=d*(r&&c?-1:1);break}return h}const UD=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=JE(c,n,l),d=n,h={},p=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:f=0}=Ys(t,e)||{};if(c==null)return{};const u=d5(f),d={x:r,y:n},h=ex(i),p=Zg(h),m=await o.getDimensions(c),x=h==="y",b=x?"top":"left",w=x?"bottom":"right",E=x?"clientHeight":"clientWidth",P=s.reference[p]+s.reference[h]-d[h]-s.floating[p],N=d[h]-s.reference[h],I=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let j=I?I[E]:0;(!j||!await(o.isElement==null?void 0:o.isElement(I)))&&(j=a.floating[E]||s.floating[p]);const L=P/2-N/2,U=j/2-m[p]/2-1,K=Ho(u[b],U),X=Ho(u[w],U),ee=K,M=j-m[p]-X,v=j/2-m[p]/2+L,_=Oy(ee,v,M),k=!l.arrow&&xc(i)!=null&&v!=_&&s.reference[p]/2-(vee<=0)){var U,K;const ee=(((U=s.flip)==null?void 0:U.index)||0)+1,M=N[ee];if(M)return{data:{index:ee,overflows:L},reset:{placement:M}};let v=(K=L.filter(_=>_.overflows[0]<=0).sort((_,k)=>_.overflows[1]-k.overflows[1])[0])==null?void 0:K.placement;if(!v)switch(h){case"bestFit":{var X;const _=(X=L.map(k=>[k.placement,k.overflows.filter(A=>A>0).reduce((A,T)=>A+T,0)]).sort((k,A)=>k[1]-A[1])[0])==null?void 0:X[0];_&&(v=_);break}case"initialPlacement":v=a;break}if(i!==v)return{reset:{placement:v}}}return{}}}};function ZE(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function eS(t){return MD.some(e=>t[e]>=0)}const VD=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=Ys(t,e);switch(n){case"referenceHidden":{const s=await tu(e,{...i,elementContext:"reference"}),o=ZE(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:eS(o)}}}case"escaped":{const s=await tu(e,{...i,altBoundary:!0}),o=ZE(s,r.floating);return{data:{escapedOffsets:o,escaped:eS(o)}}}default:return{}}}}};async function qD(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Qs(r),a=xc(r),l=bc(r)==="y",c=["left","top"].includes(o)?-1:1,f=s&&l?-1:1,u=Ys(e,t);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*f,y:d*c}:{x:d*c,y:h*f}}const HD=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){const{x:r,y:n}=e,i=await qD(e,t);return{x:r+i.x,y:n+i.y,data:i}}}},WD=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...l}=Ys(t,e),c={x:r,y:n},f=await tu(e,l),u=bc(Qs(i)),d=Xg(u);let h=c[d],p=c[u];if(s){const x=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=h+f[x],E=h-f[b];h=Oy(w,h,E)}if(o){const x=u==="y"?"top":"left",b=u==="y"?"bottom":"right",w=p+f[x],E=p-f[b];p=Oy(w,p,E)}const m=a.fn({...e,[d]:h,[u]:p});return{...m,data:{x:m.x-r,y:m.y-n}}}}},GD=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ys(t,e),f={x:r,y:n},u=bc(i),d=Xg(u);let h=f[d],p=f[u];const m=Ys(a,e),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const E=d==="y"?"height":"width",P=s.reference[d]-s.floating[E]+x.mainAxis,N=s.reference[d]+s.reference[E]-x.mainAxis;hN&&(h=N)}if(c){var b,w;const E=d==="y"?"width":"height",P=["top","left"].includes(Qs(i)),N=s.reference[u]-s.floating[E]+(P&&((b=o.offset)==null?void 0:b[u])||0)+(P?0:x.crossAxis),I=s.reference[u]+s.reference[E]+(P?0:((w=o.offset)==null?void 0:w[u])||0)-(P?x.crossAxis:0);pI&&(p=I)}return{[d]:h,[u]:p}}}},KD=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:i,elements:s}=e,{apply:o=()=>{},...a}=Ys(t,e),l=await tu(e,a),c=Qs(r),f=xc(r),u=bc(r)==="y",{width:d,height:h}=n.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(m=c,p=f==="end"?"top":"bottom");const x=h-l[p],b=d-l[m],w=!e.middlewareData.shift;let E=x,P=b;if(u){const I=d-l.left-l.right;P=f||w?Ho(b,I):I}else{const I=h-l.top-l.bottom;E=f||w?Ho(x,I):I}if(w&&!f){const I=Un(l.left,0),j=Un(l.right,0),L=Un(l.top,0),U=Un(l.bottom,0);u?P=d-2*(I!==0||j!==0?I+j:Un(l.left,l.right)):E=h-2*(L!==0||U!==0?L+U:Un(l.top,l.bottom))}await o({...e,availableWidth:P,availableHeight:E});const N=await i.getDimensions(s.floating);return d!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function Go(t){return h5(t)?(t.nodeName||"").toLowerCase():"#document"}function Hn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function io(t){var e;return(e=(h5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function h5(t){return t instanceof Node||t instanceof Hn(t).Node}function Js(t){return t instanceof Element||t instanceof Hn(t).Element}function hs(t){return t instanceof HTMLElement||t instanceof Hn(t).HTMLElement}function tS(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Hn(t).ShadowRoot}function $u(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=yi(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function YD(t){return["table","td","th"].includes(Go(t))}function tx(t){const e=rx(),r=yi(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 QD(t){let e=sc(t);for(;hs(e)&&!r1(e);){if(tx(e))return e;e=sc(e)}return null}function rx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function r1(t){return["html","body","#document"].includes(Go(t))}function yi(t){return Hn(t).getComputedStyle(t)}function n1(t){return Js(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function sc(t){if(Go(t)==="html")return t;const e=t.assignedSlot||t.parentNode||tS(t)&&t.host||io(t);return tS(e)?e.host:e}function v5(t){const e=sc(t);return r1(e)?t.ownerDocument?t.ownerDocument.body:t.body:hs(e)&&$u(e)?e:v5(e)}function ru(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=v5(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),o=Hn(i);return s?e.concat(o,o.visualViewport||[],$u(i)?i:[],o.frameElement&&r?ru(o.frameElement):[]):e.concat(i,ru(i,[],r))}function p5(t){const e=yi(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=hs(t),s=i?t.offsetWidth:r,o=i?t.offsetHeight:n,a=Yh(r)!==s||Yh(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function nx(t){return Js(t)?t:t.contextElement}function Ul(t){const e=nx(t);if(!hs(e))return Wo(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=p5(e);let o=(s?Yh(r.width):r.width)/n,a=(s?Yh(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const JD=Wo(0);function y5(t){const e=Hn(t);return!rx()||!e.visualViewport?JD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function XD(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Hn(t)?!1:e}function Fa(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=nx(t);let o=Wo(1);e&&(n?Js(n)&&(o=Ul(n)):o=Ul(t));const a=XD(s,r,n)?y5(s):Wo(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,f=i.width/o.x,u=i.height/o.y;if(s){const d=Hn(s),h=n&&Js(n)?Hn(n):n;let p=d.frameElement;for(;p&&n&&h!==d;){const m=Ul(p),x=p.getBoundingClientRect(),b=yi(p),w=x.left+(p.clientLeft+parseFloat(b.paddingLeft))*m.x,E=x.top+(p.clientTop+parseFloat(b.paddingTop))*m.y;l*=m.x,c*=m.y,f*=m.x,u*=m.y,l+=w,c+=E,p=Hn(p).frameElement}}return Jh({width:f,height:u,x:l,y:c})}function ZD(t){let{rect:e,offsetParent:r,strategy:n}=t;const i=hs(r),s=io(r);if(r===s)return e;let o={scrollLeft:0,scrollTop:0},a=Wo(1);const l=Wo(0);if((i||!i&&n!=="fixed")&&((Go(r)!=="body"||$u(s))&&(o=n1(r)),hs(r))){const c=Fa(r);a=Ul(r),l.x=c.x+r.clientLeft,l.y=c.y+r.clientTop}return{width:e.width*a.x,height:e.height*a.y,x:e.x*a.x-o.scrollLeft*a.x+l.x,y:e.y*a.y-o.scrollTop*a.y+l.y}}function eL(t){return Array.from(t.getClientRects())}function m5(t){return Fa(io(t)).left+n1(t).scrollLeft}function tL(t){const e=io(t),r=n1(t),n=t.ownerDocument.body,i=Un(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=Un(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+m5(t);const a=-r.scrollTop;return yi(n).direction==="rtl"&&(o+=Un(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function rL(t,e){const r=Hn(t),n=io(t),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=rx();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function nL(t,e){const r=Fa(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=hs(t)?Ul(t):Wo(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:o,height:a,x:l,y:c}}function rS(t,e,r){let n;if(e==="viewport")n=rL(t,r);else if(e==="document")n=tL(io(t));else if(Js(e))n=nL(e,r);else{const i=y5(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return Jh(n)}function g5(t,e){const r=sc(t);return r===e||!Js(r)||r1(r)?!1:yi(r).position==="fixed"||g5(r,e)}function iL(t,e){const r=e.get(t);if(r)return r;let n=ru(t,[],!1).filter(a=>Js(a)&&Go(a)!=="body"),i=null;const s=yi(t).position==="fixed";let o=s?sc(t):t;for(;Js(o)&&!r1(o);){const a=yi(o),l=tx(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||$u(o)&&!l&&g5(t,o))?n=n.filter(f=>f!==o):i=a,o=sc(o)}return e.set(t,n),n}function sL(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const o=[...r==="clippingAncestors"?iL(e,this._c):[].concat(r),n],a=o[0],l=o.reduce((c,f)=>{const u=rS(e,f,i);return c.top=Un(u.top,c.top),c.right=Ho(u.right,c.right),c.bottom=Ho(u.bottom,c.bottom),c.left=Un(u.left,c.left),c},rS(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function oL(t){return p5(t)}function aL(t,e,r){const n=hs(e),i=io(e),s=r==="fixed",o=Fa(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Wo(0);if(n||!n&&!s)if((Go(e)!=="body"||$u(i))&&(a=n1(e)),n){const c=Fa(e,!0,s,e);l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}else i&&(l.x=m5(i));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function nS(t,e){return!hs(t)||yi(t).position==="fixed"?null:e?e(t):t.offsetParent}function x5(t,e){const r=Hn(t);if(!hs(t))return r;let n=nS(t,e);for(;n&&YD(n)&&yi(n).position==="static";)n=nS(n,e);return n&&(Go(n)==="html"||Go(n)==="body"&&yi(n).position==="static"&&!tx(n))?r:n||QD(t)||r}const lL=async function(t){let{reference:e,floating:r,strategy:n}=t;const i=this.getOffsetParent||x5,s=this.getDimensions;return{reference:aL(e,await i(r),n),floating:{x:0,y:0,...await s(r)}}};function cL(t){return yi(t).direction==="rtl"}const fL={convertOffsetParentRelativeRectToViewportRelativeRect:ZD,getDocumentElement:io,getClippingRect:sL,getOffsetParent:x5,getElementRects:lL,getClientRects:eL,getDimensions:oL,getScale:Ul,isElement:Js,isRTL:cL};function uL(t,e){let r=null,n;const i=io(t);function s(){clearTimeout(n),r&&r.disconnect(),r=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:f,width:u,height:d}=t.getBoundingClientRect();if(a||e(),!u||!d)return;const h=pd(f),p=pd(i.clientWidth-(c+u)),m=pd(i.clientHeight-(f+d)),x=pd(c),w={rootMargin:-h+"px "+-p+"px "+-m+"px "+-x+"px",threshold:Un(0,Ho(1,l))||1};let E=!0;function P(N){const I=N[0].intersectionRatio;if(I!==l){if(!E)return o();I?o(!1,I):n=setTimeout(()=>{o(!1,1e-7)},100)}E=!1}try{r=new IntersectionObserver(P,{...w,root:i.ownerDocument})}catch{r=new IntersectionObserver(P,w)}r.observe(t)}return o(!0),s}function dL(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=nx(t),f=i||s?[...c?ru(c):[],...ru(e)]:[];f.forEach(b=>{i&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const u=c&&a?uL(c,r):null;let d=-1,h=null;o&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{h&&h.observe(e)})),r()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?Fa(t):null;l&&x();function x(){const b=Fa(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&r(),m=b,p=requestAnimationFrame(x)}return r(),()=>{f.forEach(b=>{i&&b.removeEventListener("scroll",r),s&&b.removeEventListener("resize",r)}),u&&u(),h&&h.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const hL=(t,e,r)=>{const n=new Map,i={platform:fL,...r},s={...i.platform,_c:n};return UD(t,e,{...i,platform:s})},vL=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?XE({element:n.current,padding:i}).fn(r):{}:n?XE({element:n,padding:i}).fn(r):{}}}};var Zd=typeof document<"u"?y.useLayoutEffect:y.useEffect;function Xh(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,i;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(!Xh(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!Xh(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function b5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function iS(t,e){const r=b5(t);return Math.round(e*r)/r}function sS(t){const e=y.useRef(t);return Zd(()=>{e.current=t}),e}function pL(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[f,u]=y.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=y.useState(n);Xh(d,n)||h(n);const[p,m]=y.useState(null),[x,b]=y.useState(null),w=y.useCallback(k=>{k!=I.current&&(I.current=k,m(k))},[m]),E=y.useCallback(k=>{k!==j.current&&(j.current=k,b(k))},[b]),P=s||p,N=o||x,I=y.useRef(null),j=y.useRef(null),L=y.useRef(f),U=sS(l),K=sS(i),X=y.useCallback(()=>{if(!I.current||!j.current)return;const k={placement:e,strategy:r,middleware:d};K.current&&(k.platform=K.current),hL(I.current,j.current,k).then(A=>{const T={...A,isPositioned:!0};ee.current&&!Xh(L.current,T)&&(L.current=T,ro.flushSync(()=>{u(T)}))})},[d,e,r,K]);Zd(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(k=>({...k,isPositioned:!1})))},[c]);const ee=y.useRef(!1);Zd(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Zd(()=>{if(P&&(I.current=P),N&&(j.current=N),P&&N){if(U.current)return U.current(P,N,X);X()}},[P,N,X,U]);const M=y.useMemo(()=>({reference:I,floating:j,setReference:w,setFloating:E}),[w,E]),v=y.useMemo(()=>({reference:P,floating:N}),[P,N]),_=y.useMemo(()=>{const k={position:r,left:0,top:0};if(!v.floating)return k;const A=iS(v.floating,f.x),T=iS(v.floating,f.y);return a?{...k,transform:"translate("+A+"px, "+T+"px)",...b5(v.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:T}},[r,a,v.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:X,refs:M,elements:v,floatingStyles:_}),[f,X,M,v,_])}const w5="Popper",[E5,wc]=cn(w5),[yL,S5]=E5(w5),mL=t=>{const{__scopePopper:e,children:r}=t,[n,i]=y.useState(null);return y.createElement(yL,{scope:e,anchor:n,onAnchorChange:i},r)},gL="PopperAnchor",xL=y.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=S5(gL,r),o=y.useRef(null),a=Tt(e,o);return y.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:y.createElement(Ve.div,_e({},i,{ref:a}))}),k5="PopperContent",[bL,bse]=E5(k5),wL=y.forwardRef((t,e)=>{var r,n,i,s,o,a,l,c;const{__scopePopper:f,side:u="bottom",sideOffset:d=0,align:h="center",alignOffset:p=0,arrowPadding:m=0,avoidCollisions:x=!0,collisionBoundary:b=[],collisionPadding:w=0,sticky:E="partial",hideWhenDetached:P=!1,updatePositionStrategy:N="optimized",onPlaced:I,...j}=t,L=S5(k5,f),[U,K]=y.useState(null),X=Tt(e,ke=>K(ke)),[ee,M]=y.useState(null),v=Z0(ee),_=(r=v==null?void 0:v.width)!==null&&r!==void 0?r:0,k=(n=v==null?void 0:v.height)!==null&&n!==void 0?n:0,A=u+(h!=="center"?"-"+h:""),T=typeof w=="number"?w:{top:0,right:0,bottom:0,left:0,...w},O=Array.isArray(b)?b:[b],D=O.length>0,S={padding:T,boundary:O.filter(EL),altBoundary:D},{refs:g,floatingStyles:R,placement:F,isPositioned:C,middlewareData:B}=pL({strategy:"fixed",placement:A,whileElementsMounted:(...ke)=>dL(...ke,{animationFrame:N==="always"}),elements:{reference:L.anchor},middleware:[HD({mainAxis:d+k,alignmentAxis:p}),x&&WD({mainAxis:!0,crossAxis:!1,limiter:E==="partial"?GD():void 0,...S}),x&&zD({...S}),KD({...S,apply:({elements:ke,rects:sr,availableWidth:Ze,availableHeight:ct})=>{const{width:ei,height:ft}=sr.reference,rt=ke.floating.style;rt.setProperty("--radix-popper-available-width",`${Ze}px`),rt.setProperty("--radix-popper-available-height",`${ct}px`),rt.setProperty("--radix-popper-anchor-width",`${ei}px`),rt.setProperty("--radix-popper-anchor-height",`${ft}px`)}}),ee&&vL({element:ee,padding:m}),SL({arrowWidth:_,arrowHeight:k}),P&&VD({strategy:"referenceHidden",...S})]}),[V,H]=A5(F),Z=Pn(I);Kn(()=>{C&&(Z==null||Z())},[C,Z]);const le=(i=B.arrow)===null||i===void 0?void 0:i.x,ne=(s=B.arrow)===null||s===void 0?void 0:s.y,te=((o=B.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[Me,pe]=y.useState();return Kn(()=>{U&&pe(window.getComputedStyle(U).zIndex)},[U]),y.createElement("div",{ref:g.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:C?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(a=B.transformOrigin)===null||a===void 0?void 0:a.x,(l=B.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:t.dir},y.createElement(bL,{scope:f,placedSide:V,onArrowChange:M,arrowX:le,arrowY:ne,shouldHideArrow:te},y.createElement(Ve.div,_e({"data-side":V,"data-align":H},j,{ref:X,style:{...j.style,animation:C?void 0:"none",opacity:(c=B.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function EL(t){return t!==null}const SL=t=>({name:"transformOrigin",options:t,fn(e){var r,n,i,s,o;const{placement:a,rects:l,middlewareData:c}=e,u=((r=c.arrow)===null||r===void 0?void 0:r.centerOffset)!==0,d=u?0:t.arrowWidth,h=u?0:t.arrowHeight,[p,m]=A5(a),x={start:"0%",center:"50%",end:"100%"}[m],b=((n=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&n!==void 0?n:0)+d/2,w=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+h/2;let E="",P="";return p==="bottom"?(E=u?x:`${b}px`,P=`${-h}px`):p==="top"?(E=u?x:`${b}px`,P=`${l.floating.height+h}px`):p==="right"?(E=`${-h}px`,P=u?x:`${w}px`):p==="left"&&(E=`${l.floating.width+h}px`,P=u?x:`${w}px`),{data:{x:E,y:P}}}});function A5(t){const[e,r="center"]=t.split("-");return[e,r]}const kL=mL,AL=xL,CL=wL,C5=y.forwardRef((t,e)=>{var r;const{container:n=globalThis==null||(r=globalThis.document)===null||r===void 0?void 0:r.body,...i}=t;return n?_4.createPortal(y.createElement(Ve.div,_e({},i,{ref:e})),n):null}),_v="rovingFocusGroup.onEntryFocus",_L={bubbles:!1,cancelable:!0},ix="RovingFocusGroup",[Ny,_5,TL]=t1(ix),[PL,Ec]=cn(ix,[TL]),[RL,IL]=PL(ix),OL=y.forwardRef((t,e)=>y.createElement(Ny.Provider,{scope:t.__scopeRovingFocusGroup},y.createElement(Ny.Slot,{scope:t.__scopeRovingFocusGroup},y.createElement(ML,Wt({},t,{ref:e}))))),ML=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...f}=t,u=y.useRef(null),d=Tt(e,u),h=Qg(s),[p=null,m]=Ks({prop:o,defaultProp:a,onChange:l}),[x,b]=y.useState(!1),w=Pn(c),E=_5(r),P=y.useRef(!1),[N,I]=y.useState(0);return y.useEffect(()=>{const j=u.current;if(j)return j.addEventListener(_v,w),()=>j.removeEventListener(_v,w)},[w]),y.createElement(RL,{scope:r,orientation:n,dir:h,loop:i,currentTabStopId:p,onItemFocus:y.useCallback(j=>m(j),[m]),onItemShiftTab:y.useCallback(()=>b(!0),[]),onFocusableItemAdd:y.useCallback(()=>I(j=>j+1),[]),onFocusableItemRemove:y.useCallback(()=>I(j=>j-1),[])},y.createElement(Ve.div,Wt({tabIndex:x||N===0?-1:0,"data-orientation":n},f,{ref:d,style:{outline:"none",...t.style},onMouseDown:Ce(t.onMouseDown,()=>{P.current=!0}),onFocus:Ce(t.onFocus,j=>{const L=!P.current;if(j.target===j.currentTarget&&L&&!x){const U=new CustomEvent(_v,_L);if(j.currentTarget.dispatchEvent(U),!U.defaultPrevented){const K=E().filter(_=>_.focusable),X=K.find(_=>_.active),ee=K.find(_=>_.id===p),v=[X,ee,...K].filter(Boolean).map(_=>_.ref.current);T5(v)}}P.current=!1}),onBlur:Ce(t.onBlur,()=>b(!1))})))}),NL="RovingFocusGroupItem",$L=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=t,a=jo(),l=s||a,c=IL(NL,r),f=c.currentTabStopId===l,u=_5(r),{onFocusableItemAdd:d,onFocusableItemRemove:h}=c;return y.useEffect(()=>{if(n)return d(),()=>h()},[n,d,h]),y.createElement(Ny.ItemSlot,{scope:r,id:l,focusable:n,active:i},y.createElement(Ve.span,Wt({tabIndex:f?0:-1,"data-orientation":c.orientation},o,{ref:e,onMouseDown:Ce(t.onMouseDown,p=>{n?c.onItemFocus(l):p.preventDefault()}),onFocus:Ce(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:Ce(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){c.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const m=jL(p,c.orientation,c.dir);if(m!==void 0){p.preventDefault();let b=u().filter(w=>w.focusable).map(w=>w.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const w=b.indexOf(p.currentTarget);b=c.loop?FL(b,w+1):b.slice(w+1)}setTimeout(()=>T5(b))}})})))}),DL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function LL(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function jL(t,e,r){const n=LL(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return DL[n]}function T5(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function FL(t,e){return t.map((r,n)=>t[(e+n)%t.length])}const BL=OL,P5=$L;var UL=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},sl=new WeakMap,yd=new WeakMap,md={},Tv=0,R5=function(t){return t&&(t.host||R5(t.parentNode))},zL=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=R5(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})},VL=function(t,e,r,n){var i=zL(e,Array.isArray(t)?t:[t]);md[r]||(md[r]=new WeakMap);var s=md[r],o=[],a=new Set,l=new Set(i),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode))};i.forEach(c);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(d){if(a.has(d))f(d);else{var h=d.getAttribute(n),p=h!==null&&h!=="false",m=(sl.get(d)||0)+1,x=(s.get(d)||0)+1;sl.set(d,m),s.set(d,x),o.push(d),m===1&&p&&yd.set(d,!0),x===1&&d.setAttribute(r,"true"),p||d.setAttribute(n,"true")}})};return f(e),a.clear(),Tv++,function(){o.forEach(function(u){var d=sl.get(u)-1,h=s.get(u)-1;sl.set(u,d),s.set(u,h),d||(yd.has(u)||u.removeAttribute(n),yd.delete(u)),h||u.removeAttribute(r)}),Tv--,Tv||(sl=new WeakMap,sl=new WeakMap,yd=new WeakMap,md={})}},I5=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=UL(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),VL(n,i,r,"aria-hidden")):function(){return null}},Zi=function(){return Zi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return oj;var e=aj(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])}},cj=$5(),fj=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` + */var FE;function b$(){if(FE)return Hc;FE=1;var t=pr,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var f,u={},d=null,h=null;c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+l.key),l.ref!==void 0&&(h=l.ref);for(f in l)n.call(l,f)&&!s.hasOwnProperty(f)&&(u[f]=l[f]);if(a&&a.defaultProps)for(f in l=a.defaultProps,l)u[f]===void 0&&(u[f]=l[f]);return{$$typeof:e,type:a,key:d,ref:h,props:u,_owner:i.current}}return Hc.Fragment=r,Hc.jsx=o,Hc.jsxs=o,Hc}Z6.exports=b$();var Y=Z6.exports;function w$(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 E$(t){var e=w$(t,"string");return typeof e=="symbol"?e:String(e)}function S$(t,e,r){return e=E$(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function BE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function UE(t){for(var e=1;e{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},ur=t=>{var e=r=>{var n=t.defaultClassName,i=UE(UE({},t.defaultVariants),r);for(var s in i){var o,a=(o=i[s])!==null&&o!==void 0?o:t.defaultVariants[s];if(a!=null){var l=a;typeof l=="boolean"&&(l=l===!0?"true":"false");var c=t.variantClassNames[s][l];c&&(n+=" "+c)}}for(var[f,u]of t.compoundVariants)k$(f,i,t.defaultVariants)&&(n+=" "+u);return n};return e.variants=()=>Object.keys(t.variantClassNames),e.classNames={get base(){return t.defaultClassName.split(" ")[0]},get variants(){return zE(t.variantClassNames,r=>zE(r,n=>n.split(" ")[0]))}},e};ur({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 Nr=t=>{const{color:e="borderNormal",marginY:r="4",...n}=t;return Y.jsx(G,{as:"hr",marginY:r,background:e,height:"px",borderWidth:"none",...n})};var A$=ur({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 me=y.forwardRef((t,e)=>{const{as:r="span",variant:n="inherit",className:i,hidden:s,italic:o,underline:a,children:l,ellipsis:c,uppercase:f,capitalize:u,...d}=t,h=d$[n];return Y.jsx(G,{as:r,className:In(i,A$({hidden:s,ellipsis:c,italic:o,underline:a,uppercase:f,capitalize:u})),ref:e,...h,...d,children:l})});var C$=ur({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 Ct=y.forwardRef((t,e)=>{const{as:r="button",activeOutline:n,className:i,disabled:s=!1,display:o="inline-flex",fontWeight:a="bold",pending:l=!1,label:c,leftIcon:f,rightIcon:u,size:d="md",variant:h="glass",width:p="fit",shape:m="circle",type:x="button",...b}=t,w=f!==void 0&&c!==void 0,E=u!==void 0&&c!==void 0,P=f!==void 0&&c===void 0,N=d==="xs"?"xs":"sm";return Y.jsx(G,{as:r,className:In(i,C$({activeOutline:n,disabled:s||l,hasLeftIcon:w,hasRightIcon:E,iconOnly:P,size:h==="text"?void 0:d,shape:h==="text"?void 0:m,variant:h})),disabled:s||l,display:o,fontWeight:a,ref:e,type:x,width:p,...b,children:P?Y.jsx(f,{size:N}):Y.jsxs(G,{width:"full",height:"full",justifyContent:"space-between",alignItems:"center",gap:d==="xs"?"1":"2",children:[Y.jsxs(G,{justifyContent:"flex-start",alignItems:"center",gap:d==="xs"?"1":"2",children:[f&&Y.jsx(f,{size:N}),Y.jsx(me,{children:c})]}),u&&Y.jsx(u,{size:N})]})})});var _$=ur({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 T$=y.forwardRef((t,e)=>{const{className:r,children:n,clickable:i,outlined:s,disabled:o,blur:a,width:l="full",...c}=t;return Y.jsx(G,{className:In(r,_$({clickable:i,outlined:s,disabled:o,blur:a})),background:s?"transparent":"backgroundSecondary",overflow:"hidden",borderRadius:"md",padding:"4",width:l,ref:e,...c,children:n})});function Wt(){return Wt=Object.assign?Object.assign.bind():function(t){for(var e=1;et.forEach(r=>P$(r,e))}function Tt(...t){return y.useCallback(e5(...t),t)}function cn(t,e=[]){let r=[];function n(s,o){const a=y.createContext(o),l=r.length;r=[...r,o];function c(u){const{scope:d,children:h,...p}=u,m=(d==null?void 0:d[t][l])||a,x=y.useMemo(()=>p,Object.values(p));return y.createElement(m.Provider,{value:x},h)}function f(u,d){const h=(d==null?void 0:d[t][l])||a,p=y.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,f]}const i=()=>{const s=r.map(o=>y.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return y.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[n,R$(i,...e)]}function R$(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const n=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=n.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Ce(t,e,{checkForDefaultPrevented:r=!0}={}){return function(i){if(t==null||t(i),r===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Pn(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...r)=>{var n;return(n=e.current)===null||n===void 0?void 0:n.call(e,...r)},[])}function Ks({prop:t,defaultProp:e,onChange:r=()=>{}}){const[n,i]=I$({defaultProp:e,onChange:r}),s=t!==void 0,o=s?t:n,a=Pn(r),l=y.useCallback(c=>{if(s){const u=typeof c=="function"?c(t):c;u!==t&&a(u)}else i(c)},[s,t,i,a]);return[o,l]}function I$({defaultProp:t,onChange:e}){const r=y.useState(t),[n]=r,i=y.useRef(n),s=Pn(e);return y.useEffect(()=>{i.current!==n&&(s(n),i.current=n)},[n,i,s]),r}function X0(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const Kn=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{};function Z0(t){const[e,r]=y.useState(void 0);return Kn(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.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 O$(t,e){return y.useReducer((r,n)=>{const i=e[r][n];return i??r},t)}const no=t=>{const{present:e,children:r}=t,n=M$(e),i=typeof r=="function"?r({present:n.isPresent}):y.Children.only(r),s=Tt(n.ref,i.ref);return typeof r=="function"||n.isPresent?y.cloneElement(i,{ref:s}):null};no.displayName="Presence";function M$(t){const[e,r]=y.useState(),n=y.useRef({}),i=y.useRef(t),s=y.useRef("none"),o=t?"mounted":"unmounted",[a,l]=O$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const c=vd(n.current);s.current=a==="mounted"?c:"none"},[a]),Kn(()=>{const c=n.current,f=i.current;if(f!==t){const d=s.current,h=vd(c);t?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(f&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Kn(()=>{if(e){const c=u=>{const h=vd(n.current).includes(u.animationName);u.target===e&&h&&ro.flushSync(()=>l("ANIMATION_END"))},f=u=>{u.target===e&&(s.current=vd(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:y.useCallback(c=>{c&&(n.current=getComputedStyle(c)),r(c)},[])}}function vd(t){return(t==null?void 0:t.animationName)||"none"}function _e(){return _e=Object.assign?Object.assign.bind():function(t){for(var e=1;e{const{children:r,...n}=t,i=y.Children.toArray(r),s=i.find($$);if(s){const o=s.props.children,a=i.map(l=>l===s?y.Children.count(o)>1?y.Children.only(null):y.isValidElement(o)?o.props.children:null:l);return y.createElement(Ry,_e({},n,{ref:e}),y.isValidElement(o)?y.cloneElement(o,void 0,a):null)}return y.createElement(Ry,_e({},n,{ref:e}),r)});ic.displayName="Slot";const Ry=y.forwardRef((t,e)=>{const{children:r,...n}=t;return y.isValidElement(r)?y.cloneElement(r,{...D$(n,r.props),ref:e?e5(e,r.ref):r.ref}):y.Children.count(r)>1?y.Children.only(null):null});Ry.displayName="SlotClone";const N$=({children:t})=>y.createElement(y.Fragment,null,t);function $$(t){return y.isValidElement(t)&&t.type===N$}function D$(t,e){const r={...e};for(const n in e){const i=t[n],s=e[n];/^on[A-Z]/.test(n)?i&&s?r[n]=(...a)=>{s(...a),i(...a)}:i&&(r[n]=i):n==="style"?r[n]={...i,...s}:n==="className"&&(r[n]=[i,s].filter(Boolean).join(" "))}return{...t,...r}}const L$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ve=L$.reduce((t,e)=>{const r=y.forwardRef((n,i)=>{const{asChild:s,...o}=n,a=s?ic:e;return y.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),y.createElement(a,Wt({},o,{ref:i}))});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Wg(t,e){t&&ro.flushSync(()=>t.dispatchEvent(e))}const t5="Checkbox",[j$,gse]=cn(t5),[F$,B$]=j$(t5),U$=y.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,...f}=t,[u,d]=y.useState(null),h=Tt(e,E=>d(E)),p=y.useRef(!1),m=u?!!u.closest("form"):!0,[x=!1,b]=Ks({prop:i,defaultProp:s,onChange:c}),w=y.useRef(x);return y.useEffect(()=>{const E=u==null?void 0:u.form;if(E){const P=()=>b(w.current);return E.addEventListener("reset",P),()=>E.removeEventListener("reset",P)}},[u,b]),y.createElement(F$,{scope:r,state:x,disabled:a},y.createElement(Ve.button,Wt({type:"button",role:"checkbox","aria-checked":Pa(x)?"mixed":x,"aria-required":o,"data-state":r5(x),"data-disabled":a?"":void 0,disabled:a,value:l},f,{ref:h,onKeyDown:Ce(t.onKeyDown,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Ce(t.onClick,E=>{b(P=>Pa(P)?!0:!P),m&&(p.current=E.isPropagationStopped(),p.current||E.stopPropagation())})})),m&&y.createElement(q$,{control:u,bubbles:!p.current,name:n,value:l,checked:x,required:o,disabled:a,style:{transform:"translateX(-100%)"}}))}),z$="CheckboxIndicator",V$=y.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...i}=t,s=B$(z$,r);return y.createElement(no,{present:n||Pa(s.state)||s.state===!0},y.createElement(Ve.span,Wt({"data-state":r5(s.state),"data-disabled":s.disabled?"":void 0},i,{ref:e,style:{pointerEvents:"none",...t.style}})))}),q$=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=y.useRef(null),o=X0(r),a=Z0(e);return y.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==r&&u){const d=new Event("click",{bubbles:n});l.indeterminate=Pa(r),u.call(l,Pa(r)?!1:r),l.dispatchEvent(d)}},[o,r,n]),y.createElement("input",Wt({type:"checkbox","aria-hidden":!0,defaultChecked:Pa(r)?!1:r},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Pa(t){return t==="indeterminate"}function r5(t){return Pa(t)?"indeterminate":t?"checked":"unchecked"}const H$=U$,W$=V$;var G$=ur({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 Xa=t=>{const{id:e,label:r,description:n,labelLocation:i="top",children:s,...o}=t,a=()=>r||n?Y.jsxs(G,{flexDirection:"column",gap:"0.5",children:[r&&Y.jsx(me,{variant:"small",color:"text100",hidden:i==="hidden",children:r}),n&&Y.jsx(me,{variant:"small",color:"text50",hidden:i==="hidden",children:n})]}):null;return Y.jsxs(G,{as:"label",className:G$({labelLocation:i}),htmlFor:e,...o,children:[["left","top","hidden"].includes(i)&&a(),s,i==="right"&&a()]})};var e1=ur({defaultClassName:"_1dizidw0",variantClassNames:{size:{xs:"_1dizidw1",sm:"_1dizidw2",md:"_1dizidw3",lg:"_1dizidw4",xl:"_1dizidw5"}},defaultVariants:{},compoundVariants:[]});const K$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.jsx("path",{stroke:"currentColor",strokeWidth:1.5,d:"m4.304 10.232 4.263 4.79 7.13-11.238"})}),Gg=({size:t="sm",...e})=>Y.jsx(G,{as:K$,className:e1({size:t}),...e}),Y$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.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"})}),n5=({size:t="sm",...e})=>Y.jsx(G,{as:Y$,className:e1({size:t}),...e}),Q$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.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"})}),eu=({size:t="sm",...e})=>Y.jsx(G,{as:Q$,className:e1({size:t}),...e}),J$=t=>Y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",...t,children:Y.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"})}),X$=({size:t="sm",...e})=>Y.jsx(G,{as:J$,className:e1({size:t}),...e});var Z$=ur({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:[]}),eD="_1c9x66f4 fyvr12s1 fyvr11h0 fyvr11ko fyvr11jg fyvr128 fyvr15o";const tD=({size:t="sm"})=>Y.jsx(W$,{className:eD,children:Y.jsx(Gg,{size:t==="lg"?"sm":"xs"})}),i5=y.forwardRef((t,e)=>{const{disabled:r=!1,id:n,name:i,label:s="",labelLocation:o="left",size:a="sm",...l}=t;return Y.jsx(Xa,{disabled:r,display:"flex",id:n??i,label:s,labelLocation:o,whiteSpace:"nowrap",children:Y.jsx(H$,{className:Z$({size:a}),disabled:r,id:n??i,name:i,ref:e,...l,children:Y.jsx(tD,{size:a})})})});pr.createContext(null);const rD=kC["useId".toString()]||(()=>{});let nD=0;function jo(t){const[e,r]=y.useState(rD());return Kn(()=>{t||r(n=>n??String(nD++))},[t]),t||(e?`radix-${e}`:"")}const s5="Collapsible",[iD,xse]=cn(s5),[sD,Kg]=iD(s5),oD=y.forwardRef((t,e)=>{const{__scopeCollapsible:r,open:n,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l=!1,c]=Ks({prop:n,defaultProp:i,onChange:o});return y.createElement(sD,{scope:r,disabled:s,contentId:jo(),open:l,onOpenToggle:y.useCallback(()=>c(f=>!f),[c])},y.createElement(Ve.div,Wt({"data-state":Yg(l),"data-disabled":s?"":void 0},a,{ref:e})))}),aD="CollapsibleTrigger",lD=y.forwardRef((t,e)=>{const{__scopeCollapsible:r,...n}=t,i=Kg(aD,r);return y.createElement(Ve.button,Wt({type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Yg(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},n,{ref:e,onClick:Ce(t.onClick,i.onOpenToggle)}))}),o5="CollapsibleContent",cD=y.forwardRef((t,e)=>{const{forceMount:r,...n}=t,i=Kg(o5,t.__scopeCollapsible);return y.createElement(no,{present:r||i.open},({present:s})=>y.createElement(fD,Wt({},n,{ref:e,present:s})))}),fD=y.forwardRef((t,e)=>{const{__scopeCollapsible:r,present:n,children:i,...s}=t,o=Kg(o5,r),[a,l]=y.useState(n),c=y.useRef(null),f=Tt(e,c),u=y.useRef(0),d=u.current,h=y.useRef(0),p=h.current,m=o.open||a,x=y.useRef(m),b=y.useRef();return y.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),Kn(()=>{const w=c.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const E=w.getBoundingClientRect();u.current=E.height,h.current=E.width,x.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),l(n)}},[o.open,n]),y.createElement(Ve.div,Wt({"data-state":Yg(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m},s,{ref:f,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...t.style}}),m&&i)});function Yg(t){return t?"open":"closed"}const uD=oD,dD=lD,hD=cD;var VE="64px",vD="_4j62fl0",pD="_4j62fl2 _4j62fl1 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11h0 fyvr11ko fyvr11od fyvr128 fyvr12v7 fyvr11n4 _4efw240",yD="_4j62fl4 _4j62fl3 fyvr1ww fyvr1ys fyvr1so fyvr1v0 fyvr128",mD="_4j62fl5";const il=t=>{const{className:e,children:r,defaultOpen:n,open:i,onOpenChange:s,label:o,...a}=t,[l,c]=y.useState(n),f=i??l,u=h=>{i===void 0&&c(h)},d=h=>{u(h),s==null||s(h)};return Y.jsx(uD,{open:f,defaultOpen:n,onOpenChange:d,asChild:!0,children:Y.jsxs(G,{as:Ta.div,className:In(e,vD),initial:{height:f?"auto":VE},animate:{height:f?"auto":VE},transition:{ease:"easeOut",duration:.3},borderRadius:"md",background:"backgroundSecondary",position:"relative",overflow:"hidden",width:"full",...a,children:[Y.jsxs(dD,{className:pD,children:[Y.jsx(me,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:o}),Y.jsx(G,{as:Ta.div,position:"absolute",right:"0",marginRight:"4",initial:{rotate:f?180:0},animate:{rotate:f?180:0},transition:{ease:"linear",duration:.1},children:Y.jsx(n5,{className:mD,color:"text50"})})]}),Y.jsx(Hg,{children:f&&Y.jsx(hD,{className:yD,asChild:!0,forceMount:!0,children:Y.jsx(Ta.div,{initial:{opacity:f?1:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:"easeOut",duration:.3},children:r})})})]})})};function t1(t){const e=t+"CollectionProvider",[r,n]=cn(e),[i,s]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=h=>{const{scope:p,children:m}=h,x=pr.useRef(null),b=pr.useRef(new Map).current;return pr.createElement(i,{scope:p,itemMap:b,collectionRef:x},m)},a=t+"CollectionSlot",l=pr.forwardRef((h,p)=>{const{scope:m,children:x}=h,b=s(a,m),w=Tt(p,b.collectionRef);return pr.createElement(ic,{ref:w},x)}),c=t+"CollectionItemSlot",f="data-radix-collection-item",u=pr.forwardRef((h,p)=>{const{scope:m,children:x,...b}=h,w=pr.useRef(null),E=Tt(p,w),P=s(c,m);return pr.useEffect(()=>(P.itemMap.set(w,{ref:w,...b}),()=>void P.itemMap.delete(w))),pr.createElement(ic,{[f]:"",ref:E},x)});function d(h){const p=s(t+"CollectionConsumer",h);return pr.useCallback(()=>{const x=p.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((P,N)=>b.indexOf(P.ref.current)-b.indexOf(N.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:l,ItemSlot:u},d,n]}const gD=y.createContext(void 0);function Qg(t){const e=y.useContext(gD);return t||e||"ltr"}function xD(t,e=globalThis==null?void 0:globalThis.document){const r=Pn(t);y.useEffect(()=>{const n=i=>{i.key==="Escape"&&r(i)};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[r,e])}const Iy="dismissableLayer.update",bD="dismissableLayer.pointerDownOutside",wD="dismissableLayer.focusOutside";let qE;const a5=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jg=y.forwardRef((t,e)=>{var r;const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,f=y.useContext(a5),[u,d]=y.useState(null),h=(r=u==null?void 0:u.ownerDocument)!==null&&r!==void 0?r:globalThis==null?void 0:globalThis.document,[,p]=y.useState({}),m=Tt(e,L=>d(L)),x=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),w=x.indexOf(b),E=u?x.indexOf(u):-1,P=f.layersWithOutsidePointerEventsDisabled.size>0,N=E>=w,I=SD(L=>{const U=L.target,K=[...f.branches].some(X=>X.contains(U));!N||K||(s==null||s(L),a==null||a(L),L.defaultPrevented||l==null||l())},h),j=kD(L=>{const U=L.target;[...f.branches].some(X=>X.contains(U))||(o==null||o(L),a==null||a(L),L.defaultPrevented||l==null||l())},h);return xD(L=>{E===f.layers.size-1&&(i==null||i(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))},h),y.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(qE=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),HE(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=qE)}},[u,h,n,f]),y.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),HE())},[u,f]),y.useEffect(()=>{const L=()=>p({});return document.addEventListener(Iy,L),()=>document.removeEventListener(Iy,L)},[]),y.createElement(Ve.div,_e({},c,{ref:m,style:{pointerEvents:P?N?"auto":"none":void 0,...t.style},onFocusCapture:Ce(t.onFocusCapture,j.onFocusCapture),onBlurCapture:Ce(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Ce(t.onPointerDownCapture,I.onPointerDownCapture)}))}),ED=y.forwardRef((t,e)=>{const r=y.useContext(a5),n=y.useRef(null),i=Tt(e,n);return y.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),y.createElement(Ve.div,_e({},t,{ref:i}))});function SD(t,e=globalThis==null?void 0:globalThis.document){const r=Pn(t),n=y.useRef(!1),i=y.useRef(()=>{});return y.useEffect(()=>{const s=a=>{if(a.target&&!n.current){let l=function(){l5(bD,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);n.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,r]),{onPointerDownCapture:()=>n.current=!0}}function kD(t,e=globalThis==null?void 0:globalThis.document){const r=Pn(t),n=y.useRef(!1);return y.useEffect(()=>{const i=s=>{s.target&&!n.current&&l5(wD,r,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function HE(){const t=new CustomEvent(Iy);document.dispatchEvent(t)}function l5(t,e,r,{discrete:n}){const i=r.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?Wg(i,s):i.dispatchEvent(s)}const AD=Jg,CD=ED;let kv=0;function c5(){y.useEffect(()=>{var t,e;const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=r[0])!==null&&t!==void 0?t:WE()),document.body.insertAdjacentElement("beforeend",(e=r[1])!==null&&e!==void 0?e:WE()),kv++,()=>{kv===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),kv--}},[])}function WE(){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}const Av="focusScope.autoFocusOnMount",Cv="focusScope.autoFocusOnUnmount",GE={bubbles:!1,cancelable:!0},f5=y.forwardRef((t,e)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=y.useState(null),c=Pn(i),f=Pn(s),u=y.useRef(null),d=Tt(e,m=>l(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(n){let m=function(E){if(h.paused||!a)return;const P=E.target;a.contains(P)?u.current=P:po(u.current,{select:!0})},x=function(E){if(h.paused||!a)return;const P=E.relatedTarget;P!==null&&(a.contains(P)||po(u.current,{select:!0}))},b=function(E){if(document.activeElement===document.body)for(const N of E)N.removedNodes.length>0&&po(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const w=new MutationObserver(b);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),w.disconnect()}}},[n,a,h.paused]),y.useEffect(()=>{if(a){YE.add(h);const m=document.activeElement;if(!a.contains(m)){const b=new CustomEvent(Av,GE);a.addEventListener(Av,c),a.dispatchEvent(b),b.defaultPrevented||(_D(OD(u5(a)),{select:!0}),document.activeElement===m&&po(a))}return()=>{a.removeEventListener(Av,c),setTimeout(()=>{const b=new CustomEvent(Cv,GE);a.addEventListener(Cv,f),a.dispatchEvent(b),b.defaultPrevented||po(m??document.body,{select:!0}),a.removeEventListener(Cv,f),YE.remove(h)},0)}}},[a,c,f,h]);const p=y.useCallback(m=>{if(!r&&!n||h.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const w=m.currentTarget,[E,P]=TD(w);E&&P?!m.shiftKey&&b===P?(m.preventDefault(),r&&po(E,{select:!0})):m.shiftKey&&b===E&&(m.preventDefault(),r&&po(P,{select:!0})):b===w&&m.preventDefault()}},[r,n,h.paused]);return y.createElement(Ve.div,_e({tabIndex:-1},o,{ref:d,onKeyDown:p}))});function _D(t,{select:e=!1}={}){const r=document.activeElement;for(const n of t)if(po(n,{select:e}),document.activeElement!==r)return}function TD(t){const e=u5(t),r=KE(e,t),n=KE(e.reverse(),t);return[r,n]}function u5(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function KE(t,e){for(const r of t)if(!PD(r,{upTo:e}))return r}function PD(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 RD(t){return t instanceof HTMLInputElement&&"select"in t}function po(t,{select:e=!1}={}){if(t&&t.focus){const r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&RD(t)&&e&&t.select()}}const YE=ID();function ID(){let t=[];return{add(e){const r=t[0];e!==r&&(r==null||r.pause()),t=QE(t,e),t.unshift(e)},remove(e){var r;t=QE(t,e),(r=t[0])===null||r===void 0||r.resume()}}}function QE(t,e){const r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function OD(t){return t.filter(e=>e.tagName!=="A")}const MD=["top","right","bottom","left"],Ho=Math.min,Un=Math.max,Yh=Math.round,pd=Math.floor,Wo=t=>({x:t,y:t}),ND={left:"right",right:"left",bottom:"top",top:"bottom"},$D={start:"end",end:"start"};function Oy(t,e,r){return Un(t,Ho(e,r))}function Ys(t,e){return typeof t=="function"?t(e):t}function Qs(t){return t.split("-")[0]}function xc(t){return t.split("-")[1]}function Xg(t){return t==="x"?"y":"x"}function Zg(t){return t==="y"?"height":"width"}function bc(t){return["top","bottom"].includes(Qs(t))?"y":"x"}function ex(t){return Xg(bc(t))}function DD(t,e,r){r===void 0&&(r=!1);const n=xc(t),i=ex(t),s=Zg(i);let o=i==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Qh(o)),[o,Qh(o)]}function LD(t){const e=Qh(t);return[My(t),e,My(e)]}function My(t){return t.replace(/start|end/g,e=>$D[e])}function jD(t,e,r){const n=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return r?e?i:n:e?n:i;case"left":case"right":return e?s:o;default:return[]}}function FD(t,e,r,n){const i=xc(t);let s=jD(Qs(t),r==="start",n);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(My)))),s}function Qh(t){return t.replace(/left|right|bottom|top/g,e=>ND[e])}function BD(t){return{top:0,right:0,bottom:0,left:0,...t}}function d5(t){return typeof t!="number"?BD(t):{top:t,right:t,bottom:t,left:t}}function Jh(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function JE(t,e,r){let{reference:n,floating:i}=t;const s=bc(e),o=ex(e),a=Zg(o),l=Qs(e),c=s==="y",f=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,d=n[a]/2-i[a]/2;let h;switch(l){case"top":h={x:f,y:n.y-i.height};break;case"bottom":h={x:f,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:u};break;case"left":h={x:n.x-i.width,y:u};break;default:h={x:n.x,y:n.y}}switch(xc(e)){case"start":h[o]-=d*(r&&c?-1:1);break;case"end":h[o]+=d*(r&&c?-1:1);break}return h}const UD=async(t,e,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=JE(c,n,l),d=n,h={},p=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:r,y:n,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:f=0}=Ys(t,e)||{};if(c==null)return{};const u=d5(f),d={x:r,y:n},h=ex(i),p=Zg(h),m=await o.getDimensions(c),x=h==="y",b=x?"top":"left",w=x?"bottom":"right",E=x?"clientHeight":"clientWidth",P=s.reference[p]+s.reference[h]-d[h]-s.floating[p],N=d[h]-s.reference[h],I=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let j=I?I[E]:0;(!j||!await(o.isElement==null?void 0:o.isElement(I)))&&(j=a.floating[E]||s.floating[p]);const L=P/2-N/2,U=j/2-m[p]/2-1,K=Ho(u[b],U),X=Ho(u[w],U),ee=K,M=j-m[p]-X,v=j/2-m[p]/2+L,_=Oy(ee,v,M),k=!l.arrow&&xc(i)!=null&&v!=_&&s.reference[p]/2-(vee<=0)){var U,K;const ee=(((U=s.flip)==null?void 0:U.index)||0)+1,M=N[ee];if(M)return{data:{index:ee,overflows:L},reset:{placement:M}};let v=(K=L.filter(_=>_.overflows[0]<=0).sort((_,k)=>_.overflows[1]-k.overflows[1])[0])==null?void 0:K.placement;if(!v)switch(h){case"bestFit":{var X;const _=(X=L.map(k=>[k.placement,k.overflows.filter(A=>A>0).reduce((A,T)=>A+T,0)]).sort((k,A)=>k[1]-A[1])[0])==null?void 0:X[0];_&&(v=_);break}case"initialPlacement":v=a;break}if(i!==v)return{reset:{placement:v}}}return{}}}};function ZE(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function eS(t){return MD.some(e=>t[e]>=0)}const VD=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:r}=e,{strategy:n="referenceHidden",...i}=Ys(t,e);switch(n){case"referenceHidden":{const s=await tu(e,{...i,elementContext:"reference"}),o=ZE(s,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:eS(o)}}}case"escaped":{const s=await tu(e,{...i,altBoundary:!0}),o=ZE(s,r.floating);return{data:{escapedOffsets:o,escaped:eS(o)}}}default:return{}}}}};async function qD(t,e){const{placement:r,platform:n,elements:i}=t,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=Qs(r),a=xc(r),l=bc(r)==="y",c=["left","top"].includes(o)?-1:1,f=s&&l?-1:1,u=Ys(e,t);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*f,y:d*c}:{x:d*c,y:h*f}}const HD=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){const{x:r,y:n}=e,i=await qD(e,t);return{x:r+i.x,y:n+i.y,data:i}}}},WD=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:r,y:n,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:x=>{let{x:b,y:w}=x;return{x:b,y:w}}},...l}=Ys(t,e),c={x:r,y:n},f=await tu(e,l),u=bc(Qs(i)),d=Xg(u);let h=c[d],p=c[u];if(s){const x=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=h+f[x],E=h-f[b];h=Oy(w,h,E)}if(o){const x=u==="y"?"top":"left",b=u==="y"?"bottom":"right",w=p+f[x],E=p-f[b];p=Oy(w,p,E)}const m=a.fn({...e,[d]:h,[u]:p});return{...m,data:{x:m.x-r,y:m.y-n}}}}},GD=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:n,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ys(t,e),f={x:r,y:n},u=bc(i),d=Xg(u);let h=f[d],p=f[u];const m=Ys(a,e),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const E=d==="y"?"height":"width",P=s.reference[d]-s.floating[E]+x.mainAxis,N=s.reference[d]+s.reference[E]-x.mainAxis;hN&&(h=N)}if(c){var b,w;const E=d==="y"?"width":"height",P=["top","left"].includes(Qs(i)),N=s.reference[u]-s.floating[E]+(P&&((b=o.offset)==null?void 0:b[u])||0)+(P?0:x.crossAxis),I=s.reference[u]+s.reference[E]+(P?0:((w=o.offset)==null?void 0:w[u])||0)-(P?x.crossAxis:0);pI&&(p=I)}return{[d]:h,[u]:p}}}},KD=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:r,rects:n,platform:i,elements:s}=e,{apply:o=()=>{},...a}=Ys(t,e),l=await tu(e,a),c=Qs(r),f=xc(r),u=bc(r)==="y",{width:d,height:h}=n.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=f===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(m=c,p=f==="end"?"top":"bottom");const x=h-l[p],b=d-l[m],w=!e.middlewareData.shift;let E=x,P=b;if(u){const I=d-l.left-l.right;P=f||w?Ho(b,I):I}else{const I=h-l.top-l.bottom;E=f||w?Ho(x,I):I}if(w&&!f){const I=Un(l.left,0),j=Un(l.right,0),L=Un(l.top,0),U=Un(l.bottom,0);u?P=d-2*(I!==0||j!==0?I+j:Un(l.left,l.right)):E=h-2*(L!==0||U!==0?L+U:Un(l.top,l.bottom))}await o({...e,availableWidth:P,availableHeight:E});const N=await i.getDimensions(s.floating);return d!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function Go(t){return h5(t)?(t.nodeName||"").toLowerCase():"#document"}function Hn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function io(t){var e;return(e=(h5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function h5(t){return t instanceof Node||t instanceof Hn(t).Node}function Js(t){return t instanceof Element||t instanceof Hn(t).Element}function hs(t){return t instanceof HTMLElement||t instanceof Hn(t).HTMLElement}function tS(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Hn(t).ShadowRoot}function $u(t){const{overflow:e,overflowX:r,overflowY:n,display:i}=yi(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!["inline","contents"].includes(i)}function YD(t){return["table","td","th"].includes(Go(t))}function tx(t){const e=rx(),r=yi(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 QD(t){let e=sc(t);for(;hs(e)&&!r1(e);){if(tx(e))return e;e=sc(e)}return null}function rx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function r1(t){return["html","body","#document"].includes(Go(t))}function yi(t){return Hn(t).getComputedStyle(t)}function n1(t){return Js(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function sc(t){if(Go(t)==="html")return t;const e=t.assignedSlot||t.parentNode||tS(t)&&t.host||io(t);return tS(e)?e.host:e}function v5(t){const e=sc(t);return r1(e)?t.ownerDocument?t.ownerDocument.body:t.body:hs(e)&&$u(e)?e:v5(e)}function ru(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);const i=v5(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),o=Hn(i);return s?e.concat(o,o.visualViewport||[],$u(i)?i:[],o.frameElement&&r?ru(o.frameElement):[]):e.concat(i,ru(i,[],r))}function p5(t){const e=yi(t);let r=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=hs(t),s=i?t.offsetWidth:r,o=i?t.offsetHeight:n,a=Yh(r)!==s||Yh(n)!==o;return a&&(r=s,n=o),{width:r,height:n,$:a}}function nx(t){return Js(t)?t:t.contextElement}function Ul(t){const e=nx(t);if(!hs(e))return Wo(1);const r=e.getBoundingClientRect(),{width:n,height:i,$:s}=p5(e);let o=(s?Yh(r.width):r.width)/n,a=(s?Yh(r.height):r.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const JD=Wo(0);function y5(t){const e=Hn(t);return!rx()||!e.visualViewport?JD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function XD(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Hn(t)?!1:e}function Fa(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);const i=t.getBoundingClientRect(),s=nx(t);let o=Wo(1);e&&(n?Js(n)&&(o=Ul(n)):o=Ul(t));const a=XD(s,r,n)?y5(s):Wo(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,f=i.width/o.x,u=i.height/o.y;if(s){const d=Hn(s),h=n&&Js(n)?Hn(n):n;let p=d.frameElement;for(;p&&n&&h!==d;){const m=Ul(p),x=p.getBoundingClientRect(),b=yi(p),w=x.left+(p.clientLeft+parseFloat(b.paddingLeft))*m.x,E=x.top+(p.clientTop+parseFloat(b.paddingTop))*m.y;l*=m.x,c*=m.y,f*=m.x,u*=m.y,l+=w,c+=E,p=Hn(p).frameElement}}return Jh({width:f,height:u,x:l,y:c})}function ZD(t){let{rect:e,offsetParent:r,strategy:n}=t;const i=hs(r),s=io(r);if(r===s)return e;let o={scrollLeft:0,scrollTop:0},a=Wo(1);const l=Wo(0);if((i||!i&&n!=="fixed")&&((Go(r)!=="body"||$u(s))&&(o=n1(r)),hs(r))){const c=Fa(r);a=Ul(r),l.x=c.x+r.clientLeft,l.y=c.y+r.clientTop}return{width:e.width*a.x,height:e.height*a.y,x:e.x*a.x-o.scrollLeft*a.x+l.x,y:e.y*a.y-o.scrollTop*a.y+l.y}}function eL(t){return Array.from(t.getClientRects())}function m5(t){return Fa(io(t)).left+n1(t).scrollLeft}function tL(t){const e=io(t),r=n1(t),n=t.ownerDocument.body,i=Un(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=Un(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+m5(t);const a=-r.scrollTop;return yi(n).direction==="rtl"&&(o+=Un(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:o,y:a}}function rL(t,e){const r=Hn(t),n=io(t),i=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=rx();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function nL(t,e){const r=Fa(t,!0,e==="fixed"),n=r.top+t.clientTop,i=r.left+t.clientLeft,s=hs(t)?Ul(t):Wo(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=n*s.y;return{width:o,height:a,x:l,y:c}}function rS(t,e,r){let n;if(e==="viewport")n=rL(t,r);else if(e==="document")n=tL(io(t));else if(Js(e))n=nL(e,r);else{const i=y5(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return Jh(n)}function g5(t,e){const r=sc(t);return r===e||!Js(r)||r1(r)?!1:yi(r).position==="fixed"||g5(r,e)}function iL(t,e){const r=e.get(t);if(r)return r;let n=ru(t,[],!1).filter(a=>Js(a)&&Go(a)!=="body"),i=null;const s=yi(t).position==="fixed";let o=s?sc(t):t;for(;Js(o)&&!r1(o);){const a=yi(o),l=tx(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||$u(o)&&!l&&g5(t,o))?n=n.filter(f=>f!==o):i=a,o=sc(o)}return e.set(t,n),n}function sL(t){let{element:e,boundary:r,rootBoundary:n,strategy:i}=t;const o=[...r==="clippingAncestors"?iL(e,this._c):[].concat(r),n],a=o[0],l=o.reduce((c,f)=>{const u=rS(e,f,i);return c.top=Un(u.top,c.top),c.right=Ho(u.right,c.right),c.bottom=Ho(u.bottom,c.bottom),c.left=Un(u.left,c.left),c},rS(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function oL(t){return p5(t)}function aL(t,e,r){const n=hs(e),i=io(e),s=r==="fixed",o=Fa(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Wo(0);if(n||!n&&!s)if((Go(e)!=="body"||$u(i))&&(a=n1(e)),n){const c=Fa(e,!0,s,e);l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}else i&&(l.x=m5(i));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function nS(t,e){return!hs(t)||yi(t).position==="fixed"?null:e?e(t):t.offsetParent}function x5(t,e){const r=Hn(t);if(!hs(t))return r;let n=nS(t,e);for(;n&&YD(n)&&yi(n).position==="static";)n=nS(n,e);return n&&(Go(n)==="html"||Go(n)==="body"&&yi(n).position==="static"&&!tx(n))?r:n||QD(t)||r}const lL=async function(t){let{reference:e,floating:r,strategy:n}=t;const i=this.getOffsetParent||x5,s=this.getDimensions;return{reference:aL(e,await i(r),n),floating:{x:0,y:0,...await s(r)}}};function cL(t){return yi(t).direction==="rtl"}const fL={convertOffsetParentRelativeRectToViewportRelativeRect:ZD,getDocumentElement:io,getClippingRect:sL,getOffsetParent:x5,getElementRects:lL,getClientRects:eL,getDimensions:oL,getScale:Ul,isElement:Js,isRTL:cL};function uL(t,e){let r=null,n;const i=io(t);function s(){clearTimeout(n),r&&r.disconnect(),r=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:f,width:u,height:d}=t.getBoundingClientRect();if(a||e(),!u||!d)return;const h=pd(f),p=pd(i.clientWidth-(c+u)),m=pd(i.clientHeight-(f+d)),x=pd(c),w={rootMargin:-h+"px "+-p+"px "+-m+"px "+-x+"px",threshold:Un(0,Ho(1,l))||1};let E=!0;function P(N){const I=N[0].intersectionRatio;if(I!==l){if(!E)return o();I?o(!1,I):n=setTimeout(()=>{o(!1,1e-7)},100)}E=!1}try{r=new IntersectionObserver(P,{...w,root:i.ownerDocument})}catch{r=new IntersectionObserver(P,w)}r.observe(t)}return o(!0),s}function dL(t,e,r,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=nx(t),f=i||s?[...c?ru(c):[],...ru(e)]:[];f.forEach(b=>{i&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const u=c&&a?uL(c,r):null;let d=-1,h=null;o&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{h&&h.observe(e)})),r()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?Fa(t):null;l&&x();function x(){const b=Fa(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&r(),m=b,p=requestAnimationFrame(x)}return r(),()=>{f.forEach(b=>{i&&b.removeEventListener("scroll",r),s&&b.removeEventListener("resize",r)}),u&&u(),h&&h.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const hL=(t,e,r)=>{const n=new Map,i={platform:fL,...r},s={...i.platform,_c:n};return UD(t,e,{...i,platform:s})},vL=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:n,padding:i}=typeof t=="function"?t(r):t;return n&&e(n)?n.current!=null?XE({element:n.current,padding:i}).fn(r):{}:n?XE({element:n,padding:i}).fn(r):{}}}};var Zd=typeof document<"u"?y.useLayoutEffect:y.useEffect;function Xh(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,i;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(!Xh(t[n],e[n]))return!1;return!0}if(i=Object.keys(t),r=i.length,r!==Object.keys(e).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){const s=i[n];if(!(s==="_owner"&&t.$$typeof)&&!Xh(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function b5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function iS(t,e){const r=b5(t);return Math.round(e*r)/r}function sS(t){const e=y.useRef(t);return Zd(()=>{e.current=t}),e}function pL(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[f,u]=y.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=y.useState(n);Xh(d,n)||h(n);const[p,m]=y.useState(null),[x,b]=y.useState(null),w=y.useCallback(k=>{k!=I.current&&(I.current=k,m(k))},[m]),E=y.useCallback(k=>{k!==j.current&&(j.current=k,b(k))},[b]),P=s||p,N=o||x,I=y.useRef(null),j=y.useRef(null),L=y.useRef(f),U=sS(l),K=sS(i),X=y.useCallback(()=>{if(!I.current||!j.current)return;const k={placement:e,strategy:r,middleware:d};K.current&&(k.platform=K.current),hL(I.current,j.current,k).then(A=>{const T={...A,isPositioned:!0};ee.current&&!Xh(L.current,T)&&(L.current=T,ro.flushSync(()=>{u(T)}))})},[d,e,r,K]);Zd(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(k=>({...k,isPositioned:!1})))},[c]);const ee=y.useRef(!1);Zd(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Zd(()=>{if(P&&(I.current=P),N&&(j.current=N),P&&N){if(U.current)return U.current(P,N,X);X()}},[P,N,X,U]);const M=y.useMemo(()=>({reference:I,floating:j,setReference:w,setFloating:E}),[w,E]),v=y.useMemo(()=>({reference:P,floating:N}),[P,N]),_=y.useMemo(()=>{const k={position:r,left:0,top:0};if(!v.floating)return k;const A=iS(v.floating,f.x),T=iS(v.floating,f.y);return a?{...k,transform:"translate("+A+"px, "+T+"px)",...b5(v.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:T}},[r,a,v.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:X,refs:M,elements:v,floatingStyles:_}),[f,X,M,v,_])}const w5="Popper",[E5,wc]=cn(w5),[yL,S5]=E5(w5),mL=t=>{const{__scopePopper:e,children:r}=t,[n,i]=y.useState(null);return y.createElement(yL,{scope:e,anchor:n,onAnchorChange:i},r)},gL="PopperAnchor",xL=y.forwardRef((t,e)=>{const{__scopePopper:r,virtualRef:n,...i}=t,s=S5(gL,r),o=y.useRef(null),a=Tt(e,o);return y.useEffect(()=>{s.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:y.createElement(Ve.div,_e({},i,{ref:a}))}),k5="PopperContent",[bL,bse]=E5(k5),wL=y.forwardRef((t,e)=>{var r,n,i,s,o,a,l,c;const{__scopePopper:f,side:u="bottom",sideOffset:d=0,align:h="center",alignOffset:p=0,arrowPadding:m=0,avoidCollisions:x=!0,collisionBoundary:b=[],collisionPadding:w=0,sticky:E="partial",hideWhenDetached:P=!1,updatePositionStrategy:N="optimized",onPlaced:I,...j}=t,L=S5(k5,f),[U,K]=y.useState(null),X=Tt(e,ke=>K(ke)),[ee,M]=y.useState(null),v=Z0(ee),_=(r=v==null?void 0:v.width)!==null&&r!==void 0?r:0,k=(n=v==null?void 0:v.height)!==null&&n!==void 0?n:0,A=u+(h!=="center"?"-"+h:""),T=typeof w=="number"?w:{top:0,right:0,bottom:0,left:0,...w},O=Array.isArray(b)?b:[b],D=O.length>0,S={padding:T,boundary:O.filter(EL),altBoundary:D},{refs:g,floatingStyles:R,placement:F,isPositioned:C,middlewareData:B}=pL({strategy:"fixed",placement:A,whileElementsMounted:(...ke)=>dL(...ke,{animationFrame:N==="always"}),elements:{reference:L.anchor},middleware:[HD({mainAxis:d+k,alignmentAxis:p}),x&&WD({mainAxis:!0,crossAxis:!1,limiter:E==="partial"?GD():void 0,...S}),x&&zD({...S}),KD({...S,apply:({elements:ke,rects:sr,availableWidth:Ze,availableHeight:ct})=>{const{width:ei,height:ft}=sr.reference,rt=ke.floating.style;rt.setProperty("--radix-popper-available-width",`${Ze}px`),rt.setProperty("--radix-popper-available-height",`${ct}px`),rt.setProperty("--radix-popper-anchor-width",`${ei}px`),rt.setProperty("--radix-popper-anchor-height",`${ft}px`)}}),ee&&vL({element:ee,padding:m}),SL({arrowWidth:_,arrowHeight:k}),P&&VD({strategy:"referenceHidden",...S})]}),[V,H]=A5(F),Z=Pn(I);Kn(()=>{C&&(Z==null||Z())},[C,Z]);const le=(i=B.arrow)===null||i===void 0?void 0:i.x,ne=(s=B.arrow)===null||s===void 0?void 0:s.y,te=((o=B.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[Me,pe]=y.useState();return Kn(()=>{U&&pe(window.getComputedStyle(U).zIndex)},[U]),y.createElement("div",{ref:g.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:C?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(a=B.transformOrigin)===null||a===void 0?void 0:a.x,(l=B.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:t.dir},y.createElement(bL,{scope:f,placedSide:V,onArrowChange:M,arrowX:le,arrowY:ne,shouldHideArrow:te},y.createElement(Ve.div,_e({"data-side":V,"data-align":H},j,{ref:X,style:{...j.style,animation:C?void 0:"none",opacity:(c=B.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function EL(t){return t!==null}const SL=t=>({name:"transformOrigin",options:t,fn(e){var r,n,i,s,o;const{placement:a,rects:l,middlewareData:c}=e,u=((r=c.arrow)===null||r===void 0?void 0:r.centerOffset)!==0,d=u?0:t.arrowWidth,h=u?0:t.arrowHeight,[p,m]=A5(a),x={start:"0%",center:"50%",end:"100%"}[m],b=((n=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&n!==void 0?n:0)+d/2,w=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+h/2;let E="",P="";return p==="bottom"?(E=u?x:`${b}px`,P=`${-h}px`):p==="top"?(E=u?x:`${b}px`,P=`${l.floating.height+h}px`):p==="right"?(E=`${-h}px`,P=u?x:`${w}px`):p==="left"&&(E=`${l.floating.width+h}px`,P=u?x:`${w}px`),{data:{x:E,y:P}}}});function A5(t){const[e,r="center"]=t.split("-");return[e,r]}const kL=mL,AL=xL,CL=wL,C5=y.forwardRef((t,e)=>{var r;const{container:n=globalThis==null||(r=globalThis.document)===null||r===void 0?void 0:r.body,...i}=t;return n?_4.createPortal(y.createElement(Ve.div,_e({},i,{ref:e})),n):null}),_v="rovingFocusGroup.onEntryFocus",_L={bubbles:!1,cancelable:!0},ix="RovingFocusGroup",[Ny,_5,TL]=t1(ix),[PL,Ec]=cn(ix,[TL]),[RL,IL]=PL(ix),OL=y.forwardRef((t,e)=>y.createElement(Ny.Provider,{scope:t.__scopeRovingFocusGroup},y.createElement(Ny.Slot,{scope:t.__scopeRovingFocusGroup},y.createElement(ML,Wt({},t,{ref:e}))))),ML=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...f}=t,u=y.useRef(null),d=Tt(e,u),h=Qg(s),[p=null,m]=Ks({prop:o,defaultProp:a,onChange:l}),[x,b]=y.useState(!1),w=Pn(c),E=_5(r),P=y.useRef(!1),[N,I]=y.useState(0);return y.useEffect(()=>{const j=u.current;if(j)return j.addEventListener(_v,w),()=>j.removeEventListener(_v,w)},[w]),y.createElement(RL,{scope:r,orientation:n,dir:h,loop:i,currentTabStopId:p,onItemFocus:y.useCallback(j=>m(j),[m]),onItemShiftTab:y.useCallback(()=>b(!0),[]),onFocusableItemAdd:y.useCallback(()=>I(j=>j+1),[]),onFocusableItemRemove:y.useCallback(()=>I(j=>j-1),[])},y.createElement(Ve.div,Wt({tabIndex:x||N===0?-1:0,"data-orientation":n},f,{ref:d,style:{outline:"none",...t.style},onMouseDown:Ce(t.onMouseDown,()=>{P.current=!0}),onFocus:Ce(t.onFocus,j=>{const L=!P.current;if(j.target===j.currentTarget&&L&&!x){const U=new CustomEvent(_v,_L);if(j.currentTarget.dispatchEvent(U),!U.defaultPrevented){const K=E().filter(_=>_.focusable),X=K.find(_=>_.active),ee=K.find(_=>_.id===p),v=[X,ee,...K].filter(Boolean).map(_=>_.ref.current);T5(v)}}P.current=!1}),onBlur:Ce(t.onBlur,()=>b(!1))})))}),NL="RovingFocusGroupItem",$L=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:i=!1,tabStopId:s,...o}=t,a=jo(),l=s||a,c=IL(NL,r),f=c.currentTabStopId===l,u=_5(r),{onFocusableItemAdd:d,onFocusableItemRemove:h}=c;return y.useEffect(()=>{if(n)return d(),()=>h()},[n,d,h]),y.createElement(Ny.ItemSlot,{scope:r,id:l,focusable:n,active:i},y.createElement(Ve.span,Wt({tabIndex:f?0:-1,"data-orientation":c.orientation},o,{ref:e,onMouseDown:Ce(t.onMouseDown,p=>{n?c.onItemFocus(l):p.preventDefault()}),onFocus:Ce(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:Ce(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){c.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const m=jL(p,c.orientation,c.dir);if(m!==void 0){p.preventDefault();let b=u().filter(w=>w.focusable).map(w=>w.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const w=b.indexOf(p.currentTarget);b=c.loop?FL(b,w+1):b.slice(w+1)}setTimeout(()=>T5(b))}})})))}),DL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function LL(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function jL(t,e,r){const n=LL(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return DL[n]}function T5(t){const e=document.activeElement;for(const r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function FL(t,e){return t.map((r,n)=>t[(e+n)%t.length])}const BL=OL,P5=$L;var UL=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},sl=new WeakMap,yd=new WeakMap,md={},Tv=0,R5=function(t){return t&&(t.host||R5(t.parentNode))},zL=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=R5(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})},VL=function(t,e,r,n){var i=zL(e,Array.isArray(t)?t:[t]);md[r]||(md[r]=new WeakMap);var s=md[r],o=[],a=new Set,l=new Set(i),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode))};i.forEach(c);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(d){if(a.has(d))f(d);else{var h=d.getAttribute(n),p=h!==null&&h!=="false",m=(sl.get(d)||0)+1,x=(s.get(d)||0)+1;sl.set(d,m),s.set(d,x),o.push(d),m===1&&p&&yd.set(d,!0),x===1&&d.setAttribute(r,"true"),p||d.setAttribute(n,"true")}})};return f(e),a.clear(),Tv++,function(){o.forEach(function(u){var d=sl.get(u)-1,h=s.get(u)-1;sl.set(u,d),s.set(u,h),d||(yd.has(u)||u.removeAttribute(n),yd.delete(u)),h||u.removeAttribute(r)}),Tv--,Tv||(sl=new WeakMap,sl=new WeakMap,yd=new WeakMap,md={})}},I5=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),i=UL(t);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),VL(n,i,r,"aria-hidden")):function(){return null}},Zi=function(){return Zi=Object.assign||function(e){for(var r,n=1,i=arguments.length;n"u")return oj;var e=aj(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])}},cj=$5(),fj=function(t,e,r,n){var i=t.left,s=t.top,o=t.right,a=t.gap;return r===void 0&&(r="margin"),` .`.concat(HL,` { overflow: hidden `).concat(n,`; padding-right: `).concat(a,"px ").concat(n,`; @@ -98,12 +98,12 @@ Error generating stack: `+s.message+` `)},uj=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,i=n===void 0?"margin":n,s=y.useMemo(function(){return lj(i)},[i]);return y.createElement(cj,{styles:fj(s,!e,i,r?"":"!important")})},$y=!1;if(typeof window<"u")try{var gd=Object.defineProperty({},"passive",{get:function(){return $y=!0,!0}});window.addEventListener("test",gd,gd),window.removeEventListener("test",gd,gd)}catch{$y=!1}var ol=$y?{passive:!1}:!1,dj=function(t){return t.tagName==="TEXTAREA"},D5=function(t,e){var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!dj(t)&&r[e]==="visible")},hj=function(t){return D5(t,"overflowY")},vj=function(t){return D5(t,"overflowX")},oS=function(t,e){var r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var n=L5(t,r);if(n){var i=j5(t,r),s=i[1],o=i[2];if(s>o)return!0}r=r.parentNode}while(r&&r!==document.body);return!1},pj=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},yj=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},L5=function(t,e){return t==="v"?hj(e):vj(e)},j5=function(t,e){return t==="v"?pj(e):yj(e)},mj=function(t,e){return t==="h"&&e==="rtl"?-1:1},gj=function(t,e,r,n,i){var s=mj(t,window.getComputedStyle(e).direction),o=s*n,a=r.target,l=e.contains(a),c=!1,f=o>0,u=0,d=0;do{var h=j5(t,a),p=h[0],m=h[1],x=h[2],b=m-x-s*p;(p||b)&&L5(t,a)&&(u+=b,d+=p),a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(f&&(u===0||!i)||!f&&(d===0||!i))&&(c=!0),c},xd=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},aS=function(t){return[t.deltaX,t.deltaY]},lS=function(t){return t&&"current"in t?t.current:t},xj=function(t,e){return t[0]===e[0]&&t[1]===e[1]},bj=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},wj=0,al=[];function Ej(t){var e=y.useRef([]),r=y.useRef([0,0]),n=y.useRef(),i=y.useState(wj++)[0],s=y.useState(function(){return $5()})[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=qL([t.lockRef.current],(t.shards||[]).map(lS),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=y.useCallback(function(m,x){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var b=xd(m),w=r.current,E="deltaX"in m?m.deltaX:w[0]-b[0],P="deltaY"in m?m.deltaY:w[1]-b[1],N,I=m.target,j=Math.abs(E)>Math.abs(P)?"h":"v";if("touches"in m&&j==="h"&&I.type==="range")return!1;var L=oS(j,I);if(!L)return!0;if(L?N=j:(N=j==="v"?"h":"v",L=oS(j,I)),!L)return!1;if(!n.current&&"changedTouches"in m&&(E||P)&&(n.current=N),!N)return!0;var U=n.current||N;return gj(U,x,m,U==="h"?E:P,!0)},[]),l=y.useCallback(function(m){var x=m;if(!(!al.length||al[al.length-1]!==s)){var b="deltaY"in x?aS(x):xd(x),w=e.current.filter(function(N){return N.name===x.type&&N.target===x.target&&xj(N.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var E=(o.current.shards||[]).map(lS).filter(Boolean).filter(function(N){return N.contains(x.target)}),P=E.length>0?a(x,E[0]):!o.current.noIsolation;P&&x.cancelable&&x.preventDefault()}}},[]),c=y.useCallback(function(m,x,b,w){var E={name:m,delta:x,target:b,should:w};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(P){return P!==E})},1)},[]),f=y.useCallback(function(m){r.current=xd(m),n.current=void 0},[]),u=y.useCallback(function(m){c(m.type,aS(m),m.target,a(m,t.lockRef.current))},[]),d=y.useCallback(function(m){c(m.type,xd(m),m.target,a(m,t.lockRef.current))},[]);y.useEffect(function(){return al.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:d}),document.addEventListener("wheel",l,ol),document.addEventListener("touchmove",l,ol),document.addEventListener("touchstart",f,ol),function(){al=al.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,ol),document.removeEventListener("touchmove",l,ol),document.removeEventListener("touchstart",f,ol)}},[]);var h=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(s,{styles:bj(i)}):null,h?y.createElement(uj,{gapMode:"margin"}):null)}const Sj=ZL(N5,Ej);var sx=y.forwardRef(function(t,e){return y.createElement(i1,Zi({},t,{ref:e,sideCar:Sj}))});sx.classNames=i1.classNames;const kj=["Enter"," "],s1="Menu",[Aj,wse,Cj]=t1(s1),[Za,F5]=cn(s1,[Cj,wc,Ec]);wc();const _j=Ec();Za(s1);const[Ese,Tj]=Za(s1),Pj="MenuPortal";Za(Pj,{forceMount:void 0});const Rj="MenuContent",[Sse,B5]=Za(Rj),Dy="MenuItem",cS="menu.itemSelect",U5=y.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...i}=t,s=y.useRef(null),o=Tj(Dy,t.__scopeMenu),a=B5(Dy,t.__scopeMenu),l=Tt(e,s),c=y.useRef(!1),f=()=>{const u=s.current;if(!r&&u){const d=new CustomEvent(cS,{bubbles:!0,cancelable:!0});u.addEventListener(cS,h=>n==null?void 0:n(h),{once:!0}),Wg(u,d),d.defaultPrevented?c.current=!1:o.onClose()}};return y.createElement(Ij,_e({},i,{ref:l,disabled:r,onClick:Ce(t.onClick,f),onPointerDown:u=>{var d;(d=t.onPointerDown)===null||d===void 0||d.call(t,u),c.current=!0},onPointerUp:Ce(t.onPointerUp,u=>{var d;c.current||(d=u.currentTarget)===null||d===void 0||d.click()}),onKeyDown:Ce(t.onKeyDown,u=>{const d=a.searchRef.current!=="";r||d&&u.key===" "||kj.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})}))}),Ij=y.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=t,o=B5(Dy,r),a=_j(r),l=y.useRef(null),c=Tt(e,l),[f,u]=y.useState(!1),[d,h]=y.useState("");return y.useEffect(()=>{const p=l.current;if(p){var m;h(((m=p.textContent)!==null&&m!==void 0?m:"").trim())}},[s.children]),y.createElement(Aj.ItemSlot,{scope:r,disabled:n,textValue:i??d},y.createElement(P5,_e({asChild:!0},a,{focusable:!n}),y.createElement(Ve.div,_e({role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0},s,{ref:c,onPointerMove:Ce(t.onPointerMove,fS(p=>{n?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus())})),onPointerLeave:Ce(t.onPointerLeave,fS(p=>o.onItemLeave(p))),onFocus:Ce(t.onFocus,()=>u(!0)),onBlur:Ce(t.onBlur,()=>u(!1))}))))}),Oj=y.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...i}=t;return y.createElement(V5,{scope:t.__scopeMenu,checked:r},y.createElement(U5,_e({role:"menuitemcheckbox","aria-checked":Zh(r)?"mixed":r},i,{ref:e,"data-state":ox(r),onSelect:Ce(i.onSelect,()=>n==null?void 0:n(Zh(r)?!0:!r),{checkForDefaultPrevented:!1})})))}),Mj="MenuRadioGroup",[kse,Nj]=Za(Mj,{value:void 0,onValueChange:()=>{}}),$j="MenuRadioItem",Dj=y.forwardRef((t,e)=>{const{value:r,...n}=t,i=Nj($j,t.__scopeMenu),s=r===i.value;return y.createElement(V5,{scope:t.__scopeMenu,checked:s},y.createElement(U5,_e({role:"menuitemradio","aria-checked":s},n,{ref:e,"data-state":ox(s),onSelect:Ce(n.onSelect,()=>{var o;return(o=i.onValueChange)===null||o===void 0?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})))}),z5="MenuItemIndicator",[V5,Lj]=Za(z5,{checked:!1}),jj=y.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...i}=t,s=Lj(z5,r);return y.createElement(no,{present:n||Zh(s.checked)||s.checked===!0},y.createElement(Ve.span,_e({},i,{ref:e,"data-state":ox(s.checked)})))}),Fj="MenuSub";Za(Fj);function Zh(t){return t==="indeterminate"}function ox(t){return Zh(t)?"indeterminate":t?"checked":"unchecked"}function fS(t){return e=>e.pointerType==="mouse"?t(e):void 0}const Bj=Oj,Uj=Dj,zj=jj,q5="DropdownMenu",[Vj,Ase]=cn(q5,[F5]),ax=F5();Vj(q5);const qj=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=ax(r);return y.createElement(Bj,_e({},i,n,{ref:e}))}),Hj=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=ax(r);return y.createElement(Uj,_e({},i,n,{ref:e}))}),Wj=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=ax(r);return y.createElement(zj,_e({},i,n,{ref:e}))}),Gj=qj,Kj=Hj,H5=Wj;var W5="_1k2mbvi4 _1k2mbvi3 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1x4 fyvr1yk fyvr1ss fyvr1uo fyvr12ws fyvr12wm fyvr11h0 fyvr11ko fyvr11jw fyvr12v7 fyvr11n4 fyvr11hw fyvr12s7",G5="_1k2mbvi5";const Yj=({children:t})=>Y.jsx(H5,{className:G5,children:t});y.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(Gj,{className:In(W5,t),...r,ref:n,children:[Y.jsx(Yj,{children:Y.jsx(Gg,{size:"xs"})}),Y.jsx(me,{variant:"small",children:e})]}));y.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(Kj,{className:In(W5,t),...r,ref:n,children:[Y.jsx(H5,{className:G5,children:Y.jsx(me,{children:"•"})}),Y.jsx(me,{variant:"small",children:e})]}));const o1=y.forwardRef((t,e)=>{const{icon:r,size:n="md",...i}=t;return Y.jsx(Ct,{leftIcon:r,size:n,flexShrink:"0",ref:e,...i})}),Qj=(...t)=>e=>t.forEach(r=>{r&&(typeof r=="function"?r(e):r.current=e)});var Jj="_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",Xj=fr({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:[]}),Zj="_1hq71vka _1hq71vk9 fyvr12wp fyvr12wj fyvr11ho fyvr12vj fyvr1ko fyvr1oo fyvr1mo fyvr1qo";const eF={png:".png,image/png",jpeg:".jpeg,image/jpeg",jpg:".jpg,image/jpg",images:"image/*, video/*",pdf:".pdf,application/pdf",mp4:".mp4,video/mp4"};y.forwardRef((t,e)=>{const{borderRadius:r="md",description:n,disabled:i=!1,id:s,label:o="",labelLocation:a="hidden",name:l,onValueChange:c,placeholder:f="Upload a file",validExtensions:u,...d}=t,h=y.useRef(null),p=Qj(h,e),[m,x]=y.useState(null),b=E=>{const P=E.currentTarget.files;if(!P||!P[0])return;const N=P[0],I=N.name,j=N.size/1e3;x({name:I,size:j,extension:I.split(".").pop()??""}),c==null||c(N)},w=u.map(E=>eF[E]).join(",");return Y.jsx(Xa,{description:n,disabled:i,display:"grid",id:s??l,label:o,labelLocation:a,children:Y.jsxs(G,{width:"full",minWidth:"0",justifyContent:m?"space-between":"flex-start",gap:"2",color:m?"text100":"text50",className:In(Jj,Xj({borderRadius:r})),children:[m?Y.jsxs(G,{flexDirection:"row",gap:"2",alignItems:"center",minWidth:"0",children:[Y.jsx(me,{ellipsis:!0,children:m.name}),Y.jsxs(me,{color:"text50",variant:"xsmall",whiteSpace:"nowrap",children:[m.size.toFixed(2)," kb"]})]}):Y.jsx(me,{ellipsis:!0,children:f}),Y.jsx(G,{accept:w,as:"input",className:Zj,cursor:"pointer",disabled:i,id:s??l,name:l,onChange:b,ref:p,type:"file",...d}),m&&Y.jsx(o1,{cursor:"pointer",icon:eu,size:"xs",onClick:E=>{var P;E.preventDefault(),E.stopPropagation(),(P=h.current)!=null&&P.value&&(h.current.value=""),c==null||c(null),x(null)},zIndex:"10"})]})})});var tF=fr({defaultClassName:"_1bhyzin0",variantClassNames:{size:{xs:"_1bhyzin1",sm:"_1bhyzin2",md:"_1bhyzin3",lg:"_1bhyzin4",xl:"_1bhyzin5"}},defaultVariants:{},compoundVariants:[]});const Ly=1e3,zl=64,Iv=zl/2,Ov=(t,e=Ly)=>t%e/(Ly/zl),pa=(t,e=0)=>{let r=3735928559^e,n=1103547991^e;for(let i=0,s;i>>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)},rF=(t,e,r)=>{const n=Math.random().toString(36).slice(2,12),i=t%360,s=(t+120)%360,o=r%360;return{id:pa(n),a:`hsl(${i}deg 100% 40%)`,b:`hsl(${s}deg 100% 50%)`,c:`hsl(${o}deg 100% 50%)`}},nF=(t,e)=>{const r=[];for(let n=0;n{const s=zl/10+Ov(n.r,Ly*1.5/(i+1));return{...rF(n.a,n.b,n.c),x:Ov(n.x),y:Ov(n.y),r:s}})};y.memo(t=>{const{className:e,address:r,size:n="md",complexity:i=1,...s}=t,o=nF(r,i);return Y.jsxs(G,{as:"svg",className:In(e,tF({size:n})),viewBox:`0 0 ${zl} ${zl}`,version:"1.1",flexShrink:"0",borderRadius:"circle",overflow:"hidden",xmlns:"http://www.w3.org/2000/svg",...s,children:[Y.jsxs("defs",{children:[Y.jsx("clipPath",{id:"circle-clip",children:Y.jsx("circle",{cx:Iv,cy:Iv,r:Iv})}),Y.jsxs("filter",{id:"blur",x:"-10%",y:"-10%",width:"120%",height:"120%",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[Y.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),Y.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),Y.jsx("feGaussianBlur",{stdDeviation:zl/10,result:"effect1_foregroundBlur"})]}),Y.jsxs("linearGradient",{id:`gradient-background-${o[0].id}`,x1:"0",y1:"0",x2:"1",y2:"1",children:[Y.jsx("stop",{offset:"0",stopColor:o[0].c}),Y.jsx("stop",{offset:"1",stopColor:o[0].a})]}),o.map(a=>Y.jsxs(y.Fragment,{children:[Y.jsxs("radialGradient",{id:`gradient-primary-${a.id}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.a}),Y.jsx("stop",{offset:"1",stopColor:a.b})]}),Y.jsxs("radialGradient",{id:`gradient-secondary-${a.id}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.c}),Y.jsx("stop",{offset:"1",stopColor:a.b})]})]},a.id))]}),Y.jsxs("g",{clipPath:"url(#circle-clip)",children:[Y.jsx("rect",{width:"100%",height:"100%",fill:`url(#gradient-background-${o[0].id})`}),Y.jsx("g",{filter:"url(#blur)",children:o.map(a=>Y.jsxs(y.Fragment,{children:[Y.jsx("circle",{fill:`url(#gradient-primary-${a.id})`,cx:a.x,cy:a.y,r:a.r}),Y.jsx("circle",{fill:`url(#gradient-secondary-${a.id})`,cx:a.y,cy:a.x,r:a.r/2})]},a.id))})]})]})});const iF=t=>{const{disableAnimation:e=!1,onLoad:r,...n}=t,[i,s]=y.useState(!1),o=a=>{s(!0),r==null||r(a)};return Y.jsx(G,{as:Ta.img,initial:e?void 0:{opacity:0},animate:e?void 0:{opacity:i?1:0},transition:{duration:.2},onLoad:e?void 0:o,...n})},K5="Dialog",[Y5,Cse]=cn(K5),[sF,ra]=Y5(K5),oF=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=y.useRef(null),l=y.useRef(null),[c=!1,f]=Ks({prop:n,defaultProp:i,onChange:s});return y.createElement(sF,{scope:e,triggerRef:a,contentRef:l,contentId:jo(),titleId:jo(),descriptionId:jo(),open:c,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(u=>!u),[f]),modal:o},r)},Q5="DialogPortal",[aF,J5]=Y5(Q5,{forceMount:void 0}),lF=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=ra(Q5,e);return y.createElement(aF,{scope:e,forceMount:r},y.Children.map(n,o=>y.createElement(no,{present:r||s.open},y.createElement(C5,{asChild:!0,container:i},o))))},jy="DialogOverlay",cF=y.forwardRef((t,e)=>{const r=J5(jy,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=ra(jy,t.__scopeDialog);return s.modal?y.createElement(no,{present:n||s.open},y.createElement(fF,_e({},i,{ref:e}))):null}),fF=y.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=ra(jy,r);return y.createElement(sx,{as:ic,allowPinchZoom:!0,shards:[i.contentRef]},y.createElement(Ve.div,_e({"data-state":Z5(i.open)},n,{ref:e,style:{pointerEvents:"auto",...n.style}})))}),nu="DialogContent",uF=y.forwardRef((t,e)=>{const r=J5(nu,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=ra(nu,t.__scopeDialog);return y.createElement(no,{present:n||s.open},s.modal?y.createElement(dF,_e({},i,{ref:e})):y.createElement(hF,_e({},i,{ref:e})))}),dF=y.forwardRef((t,e)=>{const r=ra(nu,t.__scopeDialog),n=y.useRef(null),i=Tt(e,r.contentRef,n);return y.useEffect(()=>{const s=n.current;if(s)return I5(s)},[]),y.createElement(X5,_e({},t,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)===null||o===void 0||o.focus()}),onPointerDownOutside:Ce(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Ce(t.onFocusOutside,s=>s.preventDefault())}))}),hF=y.forwardRef((t,e)=>{const r=ra(nu,t.__scopeDialog),n=y.useRef(!1),i=y.useRef(!1);return y.createElement(X5,_e({},t,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o;if((o=t.onCloseAutoFocus)===null||o===void 0||o.call(t,s),!s.defaultPrevented){var a;n.current||(a=r.triggerRef.current)===null||a===void 0||a.focus(),s.preventDefault()}n.current=!1,i.current=!1},onInteractOutside:s=>{var o,a;(o=t.onInteractOutside)===null||o===void 0||o.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=s.target;((a=r.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}}))}),X5=y.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=ra(nu,r),l=y.useRef(null),c=Tt(e,l);return c5(),y.createElement(y.Fragment,null,y.createElement(f5,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s},y.createElement(Jg,_e({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Z5(a.open)},o,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)}),vF="DialogClose",pF=y.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=ra(vF,r);return y.createElement(Ve.button,_e({type:"button"},n,{ref:e,onClick:Ce(t.onClick,()=>i.onOpenChange(!1))}))});function Z5(t){return t?"open":"closed"}const yF=oF,mF=lF,gF=cF,xF=uF,bF=pF;var wF=fr({defaultClassName:"_1vqx0w91 _1vqx0w90 fyvr128 fyvr15o",variantClassNames:{direction:{vertical:"_1vqx0w92",horizontal:"_1vqx0w93"}},defaultVariants:{},compoundVariants:[]}),EF=fr({defaultClassName:"_1vqx0w94",variantClassNames:{shadows:{true:"_1vqx0w95",false:"_1vqx0w96"},direction:{vertical:"_1vqx0w97",horizontal:"_1vqx0w98"}},defaultVariants:{},compoundVariants:[]});const SF=t=>{const{children:e,shadows:r=!0,direction:n="vertical",contentProps:i,...s}=t;return Y.jsx(G,{className:EF({direction:n,shadows:r}),position:"relative",width:"full",height:"full",...s,children:Y.jsx(G,{className:wF({direction:n}),background:"backgroundPrimary",...i,children:e})})};function kF(t){var e=t.match(/^var\((.*)\)$/);return e?e[1]:t}function AF(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 e8(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n=t.constructor();for(var i in t){var s=t[i],o=[...r,i];typeof s=="string"||typeof s=="number"||s==null?n[i]=e(s,o):typeof s=="object"&&!Array.isArray(s)?n[i]=e8(s,e,o):console.warn('Skipping invalid key "'.concat(o.join("."),'". Should be a string, number, null or object. Received: "').concat(Array.isArray(s)?"Array":typeof s,'"'))}return n}function uS(t,e,r){t.style.setProperty(kF(e),r)}function dS(t,e,r){if(typeof r=="object"){var n=e;e8(r,(a,l)=>{a!=null&&uS(t,AF(n,l),String(a))})}else{var i=e;for(var s in i){var o=i[s];o!=null&&uS(t,s,i[s])}}}const lx=["dark","light"],t8="dark",CF="data-theme",hS="@sequence.theme",_F=t=>lx.includes(t),TF=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),r8=t=>t?`${hS}.${t}`:hS,PF=t=>{const e=localStorage.getItem(r8(t));return e&&lx.includes(e)?e:t8},n8=y.createContext(null),RF=t=>{const[e,r]=y.useState(t.theme||t8);y.useEffect(()=>{/Mac/.test(window.navigator.userAgent)&&window.document.documentElement.classList.add("is-apple")},[]),y.useEffect(()=>{t.theme||r(PF(t.scope))},[t.theme,t.scope]),y.useEffect(()=>{t.theme&&r(t.theme)},[t.theme]),y.useEffect(()=>{const i=document.querySelector(t.root||":root");i&&(_F(e)?(i.setAttribute(CF,e),dS(i,LE,{colors:u$[e]})):TF(e)&&dS(i,LE,{colors:e}))},[e,t.root]);const n=y.useMemo(()=>({theme:e,root:t.root,setTheme:i=>{lx.includes(i)&&(localStorage.setItem(r8(t.scope),i),r(i))}}),[e,t.root,t.scope]);return Y.jsx(n8.Provider,{value:n,children:t.children})},IF=()=>{const t=y.useContext(n8);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};var OF="_5b32m91 _5b32m90 fyvr11jg fyvr11ko fyvr11h0 fyvr11hs fyvr11nk fyvr1ko fyvr1oo fyvr1qo fyvr1mo",MF="_5b32m93 _5b32m92 fyvr11hs fyvr1ko fyvr1oo fyvr1qo fyvr1mo",NF=fr({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"]]}),$F="_5b32m9b _5b32m9a fyvr110o fyvr112o fyvr114o fyvr116o fyvr11ho fyvr1qo fyvr1ko fyvr11nk";const i8=t=>{const{autoHeight:e=!1,backdropColor:r="backgroundBackdrop",children:n,disableAnimation:i=!1,isDismissible:s=!0,onClose:o,scroll:a=!0,size:l="lg",overlayProps:c,contentProps:f}=t,{root:u}=IF(),[d,h]=y.useState(null);return y.useEffect(()=>{h(document.querySelector(u||"body"))},[u]),d?Y.jsx(yF,{modal:!0,defaultOpen:!0,onOpenChange:o,children:Y.jsx(mF,{forceMount:!0,container:d,children:Y.jsxs(G,{className:OF,children:[Y.jsx(G,{as:gF,asChild:!0,background:r,className:MF,forceMount:!0,children:Y.jsx(Ta.div,{initial:i?!1:{opacity:0},animate:i?!1:{opacity:1},exit:i?void 0:{opacity:0},transition:{type:"tween",ease:"linear"},...c},"modal-overlay")}),Y.jsx(xF,{asChild:!0,className:NF({autoHeight:e,size:l}),forceMount:!0,onEscapeKeyDown:p=>{s?o==null||o():p.preventDefault()},onInteractOutside:p=>{s||p.preventDefault()},children:Y.jsxs(Ta.div,{initial:i?!1:{y:"100%",opacity:l==="sm"?0:1},animate:i?!1:{y:0,opacity:1},exit:i?void 0:{y:"100%",opacity:l==="sm"?0:1},transition:{type:"tween",ease:"easeOut"},...f,children:[a?Y.jsx(SF,{children:n}):n,s&&Y.jsx(bF,{asChild:!0,children:Y.jsx(o1,{icon:eu,backdropFilter:"blur",size:"xs",className:$F,"aria-label":"Close"})})]},"modal-content")})]})})}):null};var DF="_1acm19y1 _1acm19y0 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1ww fyvr1ys fyvr11hc fyvr11ko fyvr11od fyvr12s1 fyvr1g0 fyvr118g",LF=fr({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:[]}),jF=fr({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 Ir=y.forwardRef((t,e)=>{const{as:r="input",autoComplete:n="off",borderRadius:i="md",description:s,disabled:o=!1,id:a,label:l="",labelLocation:c="hidden",leftIcon:f,rightIcon:u,name:d,controls:h,type:p="text",numeric:m=!1,...x}=t;return Y.jsx(Xa,{description:s,disabled:o,display:"grid",id:a??d,label:l,labelLocation:c,children:Y.jsx(G,{width:"full",children:Y.jsxs(G,{className:In(DF,LF({borderRadius:i})),children:[f&&Y.jsx(f,{size:"sm"}),Y.jsx(G,{as:r,autoComplete:n,spellCheck:"false",className:jF({numeric:m}),disabled:o,id:a??d,name:d,ref:e,type:p,...x}),u&&Y.jsx(u,{size:"sm"}),h]})})})}),FF=RegExp("^\\d*(?:\\\\[.])?\\d*$");function BF(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}y.forwardRef((t,e)=>{const{name:r="amount",placeholder:n,onChange:i,onBlur:s,...o}=t,a=c=>{let{value:f}=c.target;f=f.replace(/,/g,"."),f.startsWith(".")&&(f="0"+f),f.startsWith("0")&&(f=f.replace(/^0+(?=\d)/,"")),(f===""||FF.test(BF(f)))&&(i==null||i({...c,target:{...c.target,value:f}}))},l=c=>{const{value:f}=c.target;let u=f;u.endsWith(".")&&(u=u.slice(0,-1)),u.endsWith(".0")&&(u=u.slice(0,-2)),u==="0"&&(u=""),s==null||s(c),u!==f&&(i==null||i({...c,target:{...c.target,value:u}}))};return Y.jsx(Ir,{name:r,onChange:a,onBlur:l,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 UF="y5zf971 _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8 _4efw240";const zF=t=>{const{value:e,digits:r=6,group:n,onChange:i,onConfirm:s,disabled:o=!1}=t,a=y.useMemo(()=>vS(0,r).map(()=>y.createRef()),[r]);y.useEffect(()=>{var d,h;(h=(d=a[0])==null?void 0:d.current)==null||h.focus()},[a]);const l=(d,h)=>{var p,m;/^\d$/.test(h)||(h="");const x=[...e];x[d]=h,h!==""&&((m=(p=a[d+1])==null?void 0:p.current)==null||m.focus()),i(x)},c=()=>e.join("").length===r,f=(d,h)=>{var p,m;const x=a[d].current,b=(p=a[d-1])==null?void 0:p.current,w=(m=a[d+1])==null?void 0:m.current;switch(h.key){case"Backspace":h.preventDefault(),x&&(x.value="",l(d,"")),b==null||b.focus();break;case"ArrowLeft":h.preventDefault(),b==null||b.focus();break;case"ArrowRight":h.preventDefault(),w==null||w.focus();break;case"Enter":h.preventDefault(),c()&&(s==null||s());break;default:(x==null?void 0:x.value)===h.key&&(h.preventDefault(),l(d,h.key))}},u=(d,h)=>{var p,m;const b=h.clipboardData.getData("text/plain").replace(/\D/g,"");new RegExp(`^\\d{${r}}$`).test(b)&&((m=(p=a[0])==null?void 0:p.current)==null||m.focus(),i(b.split("")),setTimeout(()=>{var E,P;(P=(E=a[a.length-1])==null?void 0:E.current)==null||P.focus()}))};return Y.jsx(G,{gap:"2",children:vS(0,r).map(d=>Y.jsxs(y.Fragment,{children:[!!n&&d>0&&d%n===0&&Y.jsx("span",{}),Y.jsx(G,{as:"input",className:UF,value:e[d]||"",ref:a[d],type:"text",inputMode:"numeric",maxLength:1,disabled:o,onFocus:h=>h.target.select(),onPaste:h=>u(d,h),onChange:h=>l(d,h.target.value),onKeyDown:h=>{f(d,h)}})]},d))})},vS=(t,e)=>Array.from({length:e-t},(r,n)=>n+t);fr({defaultClassName:"_1jujggt1",variantClassNames:{size:{sm:"_1jujggt2",normal:"_1jujggt3",md:"_1jujggt4",lg:"_1jujggt5",xl:"_1jujggt6"}},defaultVariants:{},compoundVariants:[]});const s8="Progress",a1=100,[VF,_se]=cn(s8),[qF,Tse]=VF(s8),HF=y.forwardRef((t,e)=>{const{__scopeProgress:r,value:n,max:i,getValueLabel:s=WF,...o}=t,a=Fy(i)?i:a1,l=o8(n,a)?n:null,c=e0(l)?s(l,a):void 0;return y.createElement(qF,{scope:r,value:l,max:a},y.createElement(Ve.div,Wt({"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":e0(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":GF(l,a),"data-value":l??void 0,"data-max":a},o,{ref:e})))});HF.propTypes={max(t,e,r){const n=t[e],i=String(n);return n&&!Fy(n)?new Error(KF(i,r)):null},value(t,e,r){const n=t[e],i=String(n),s=Fy(t.max)?t.max:a1;return n!=null&&!o8(n,s)?new Error(YF(i,r)):null}};function WF(t,e){return`${Math.round(t/e*100)}%`}function GF(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function e0(t){return typeof t=="number"}function Fy(t){return e0(t)&&!isNaN(t)&&t>0}function o8(t,e){return e0(t)&&!isNaN(t)&&t<=e&&t>=0}function KF(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${a1}\`.`}function YF(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +`)},wj=0,al=[];function Ej(t){var e=y.useRef([]),r=y.useRef([0,0]),n=y.useRef(),i=y.useState(wj++)[0],s=y.useState(function(){return $5()})[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=qL([t.lockRef.current],(t.shards||[]).map(lS),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=y.useCallback(function(m,x){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var b=xd(m),w=r.current,E="deltaX"in m?m.deltaX:w[0]-b[0],P="deltaY"in m?m.deltaY:w[1]-b[1],N,I=m.target,j=Math.abs(E)>Math.abs(P)?"h":"v";if("touches"in m&&j==="h"&&I.type==="range")return!1;var L=oS(j,I);if(!L)return!0;if(L?N=j:(N=j==="v"?"h":"v",L=oS(j,I)),!L)return!1;if(!n.current&&"changedTouches"in m&&(E||P)&&(n.current=N),!N)return!0;var U=n.current||N;return gj(U,x,m,U==="h"?E:P,!0)},[]),l=y.useCallback(function(m){var x=m;if(!(!al.length||al[al.length-1]!==s)){var b="deltaY"in x?aS(x):xd(x),w=e.current.filter(function(N){return N.name===x.type&&N.target===x.target&&xj(N.delta,b)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var E=(o.current.shards||[]).map(lS).filter(Boolean).filter(function(N){return N.contains(x.target)}),P=E.length>0?a(x,E[0]):!o.current.noIsolation;P&&x.cancelable&&x.preventDefault()}}},[]),c=y.useCallback(function(m,x,b,w){var E={name:m,delta:x,target:b,should:w};e.current.push(E),setTimeout(function(){e.current=e.current.filter(function(P){return P!==E})},1)},[]),f=y.useCallback(function(m){r.current=xd(m),n.current=void 0},[]),u=y.useCallback(function(m){c(m.type,aS(m),m.target,a(m,t.lockRef.current))},[]),d=y.useCallback(function(m){c(m.type,xd(m),m.target,a(m,t.lockRef.current))},[]);y.useEffect(function(){return al.push(s),t.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:d}),document.addEventListener("wheel",l,ol),document.addEventListener("touchmove",l,ol),document.addEventListener("touchstart",f,ol),function(){al=al.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,ol),document.removeEventListener("touchmove",l,ol),document.removeEventListener("touchstart",f,ol)}},[]);var h=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(s,{styles:bj(i)}):null,h?y.createElement(uj,{gapMode:"margin"}):null)}const Sj=ZL(N5,Ej);var sx=y.forwardRef(function(t,e){return y.createElement(i1,Zi({},t,{ref:e,sideCar:Sj}))});sx.classNames=i1.classNames;const kj=["Enter"," "],s1="Menu",[Aj,wse,Cj]=t1(s1),[Za,F5]=cn(s1,[Cj,wc,Ec]);wc();const _j=Ec();Za(s1);const[Ese,Tj]=Za(s1),Pj="MenuPortal";Za(Pj,{forceMount:void 0});const Rj="MenuContent",[Sse,B5]=Za(Rj),Dy="MenuItem",cS="menu.itemSelect",U5=y.forwardRef((t,e)=>{const{disabled:r=!1,onSelect:n,...i}=t,s=y.useRef(null),o=Tj(Dy,t.__scopeMenu),a=B5(Dy,t.__scopeMenu),l=Tt(e,s),c=y.useRef(!1),f=()=>{const u=s.current;if(!r&&u){const d=new CustomEvent(cS,{bubbles:!0,cancelable:!0});u.addEventListener(cS,h=>n==null?void 0:n(h),{once:!0}),Wg(u,d),d.defaultPrevented?c.current=!1:o.onClose()}};return y.createElement(Ij,_e({},i,{ref:l,disabled:r,onClick:Ce(t.onClick,f),onPointerDown:u=>{var d;(d=t.onPointerDown)===null||d===void 0||d.call(t,u),c.current=!0},onPointerUp:Ce(t.onPointerUp,u=>{var d;c.current||(d=u.currentTarget)===null||d===void 0||d.click()}),onKeyDown:Ce(t.onKeyDown,u=>{const d=a.searchRef.current!=="";r||d&&u.key===" "||kj.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})}))}),Ij=y.forwardRef((t,e)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=t,o=B5(Dy,r),a=_j(r),l=y.useRef(null),c=Tt(e,l),[f,u]=y.useState(!1),[d,h]=y.useState("");return y.useEffect(()=>{const p=l.current;if(p){var m;h(((m=p.textContent)!==null&&m!==void 0?m:"").trim())}},[s.children]),y.createElement(Aj.ItemSlot,{scope:r,disabled:n,textValue:i??d},y.createElement(P5,_e({asChild:!0},a,{focusable:!n}),y.createElement(Ve.div,_e({role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0},s,{ref:c,onPointerMove:Ce(t.onPointerMove,fS(p=>{n?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus())})),onPointerLeave:Ce(t.onPointerLeave,fS(p=>o.onItemLeave(p))),onFocus:Ce(t.onFocus,()=>u(!0)),onBlur:Ce(t.onBlur,()=>u(!1))}))))}),Oj=y.forwardRef((t,e)=>{const{checked:r=!1,onCheckedChange:n,...i}=t;return y.createElement(V5,{scope:t.__scopeMenu,checked:r},y.createElement(U5,_e({role:"menuitemcheckbox","aria-checked":Zh(r)?"mixed":r},i,{ref:e,"data-state":ox(r),onSelect:Ce(i.onSelect,()=>n==null?void 0:n(Zh(r)?!0:!r),{checkForDefaultPrevented:!1})})))}),Mj="MenuRadioGroup",[kse,Nj]=Za(Mj,{value:void 0,onValueChange:()=>{}}),$j="MenuRadioItem",Dj=y.forwardRef((t,e)=>{const{value:r,...n}=t,i=Nj($j,t.__scopeMenu),s=r===i.value;return y.createElement(V5,{scope:t.__scopeMenu,checked:s},y.createElement(U5,_e({role:"menuitemradio","aria-checked":s},n,{ref:e,"data-state":ox(s),onSelect:Ce(n.onSelect,()=>{var o;return(o=i.onValueChange)===null||o===void 0?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})))}),z5="MenuItemIndicator",[V5,Lj]=Za(z5,{checked:!1}),jj=y.forwardRef((t,e)=>{const{__scopeMenu:r,forceMount:n,...i}=t,s=Lj(z5,r);return y.createElement(no,{present:n||Zh(s.checked)||s.checked===!0},y.createElement(Ve.span,_e({},i,{ref:e,"data-state":ox(s.checked)})))}),Fj="MenuSub";Za(Fj);function Zh(t){return t==="indeterminate"}function ox(t){return Zh(t)?"indeterminate":t?"checked":"unchecked"}function fS(t){return e=>e.pointerType==="mouse"?t(e):void 0}const Bj=Oj,Uj=Dj,zj=jj,q5="DropdownMenu",[Vj,Ase]=cn(q5,[F5]),ax=F5();Vj(q5);const qj=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=ax(r);return y.createElement(Bj,_e({},i,n,{ref:e}))}),Hj=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=ax(r);return y.createElement(Uj,_e({},i,n,{ref:e}))}),Wj=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:r,...n}=t,i=ax(r);return y.createElement(zj,_e({},i,n,{ref:e}))}),Gj=qj,Kj=Hj,H5=Wj;var W5="_1k2mbvi4 _1k2mbvi3 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1x4 fyvr1yk fyvr1ss fyvr1uo fyvr12ws fyvr12wm fyvr11h0 fyvr11ko fyvr11jw fyvr12v7 fyvr11n4 fyvr11hw fyvr12s7",G5="_1k2mbvi5";const Yj=({children:t})=>Y.jsx(H5,{className:G5,children:t});y.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(Gj,{className:In(W5,t),...r,ref:n,children:[Y.jsx(Yj,{children:Y.jsx(Gg,{size:"xs"})}),Y.jsx(me,{variant:"small",children:e})]}));y.forwardRef(({className:t,children:e,...r},n)=>Y.jsxs(Kj,{className:In(W5,t),...r,ref:n,children:[Y.jsx(H5,{className:G5,children:Y.jsx(me,{children:"•"})}),Y.jsx(me,{variant:"small",children:e})]}));const o1=y.forwardRef((t,e)=>{const{icon:r,size:n="md",...i}=t;return Y.jsx(Ct,{leftIcon:r,size:n,flexShrink:"0",ref:e,...i})}),Qj=(...t)=>e=>t.forEach(r=>{r&&(typeof r=="function"?r(e):r.current=e)});var Jj="_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",Xj=ur({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:[]}),Zj="_1hq71vka _1hq71vk9 fyvr12wp fyvr12wj fyvr11ho fyvr12vj fyvr1ko fyvr1oo fyvr1mo fyvr1qo";const eF={png:".png,image/png",jpeg:".jpeg,image/jpeg",jpg:".jpg,image/jpg",images:"image/*, video/*",pdf:".pdf,application/pdf",mp4:".mp4,video/mp4"};y.forwardRef((t,e)=>{const{borderRadius:r="md",description:n,disabled:i=!1,id:s,label:o="",labelLocation:a="hidden",name:l,onValueChange:c,placeholder:f="Upload a file",validExtensions:u,...d}=t,h=y.useRef(null),p=Qj(h,e),[m,x]=y.useState(null),b=E=>{const P=E.currentTarget.files;if(!P||!P[0])return;const N=P[0],I=N.name,j=N.size/1e3;x({name:I,size:j,extension:I.split(".").pop()??""}),c==null||c(N)},w=u.map(E=>eF[E]).join(",");return Y.jsx(Xa,{description:n,disabled:i,display:"grid",id:s??l,label:o,labelLocation:a,children:Y.jsxs(G,{width:"full",minWidth:"0",justifyContent:m?"space-between":"flex-start",gap:"2",color:m?"text100":"text50",className:In(Jj,Xj({borderRadius:r})),children:[m?Y.jsxs(G,{flexDirection:"row",gap:"2",alignItems:"center",minWidth:"0",children:[Y.jsx(me,{ellipsis:!0,children:m.name}),Y.jsxs(me,{color:"text50",variant:"xsmall",whiteSpace:"nowrap",children:[m.size.toFixed(2)," kb"]})]}):Y.jsx(me,{ellipsis:!0,children:f}),Y.jsx(G,{accept:w,as:"input",className:Zj,cursor:"pointer",disabled:i,id:s??l,name:l,onChange:b,ref:p,type:"file",...d}),m&&Y.jsx(o1,{cursor:"pointer",icon:eu,size:"xs",onClick:E=>{var P;E.preventDefault(),E.stopPropagation(),(P=h.current)!=null&&P.value&&(h.current.value=""),c==null||c(null),x(null)},zIndex:"10"})]})})});var tF=ur({defaultClassName:"_1bhyzin0",variantClassNames:{size:{xs:"_1bhyzin1",sm:"_1bhyzin2",md:"_1bhyzin3",lg:"_1bhyzin4",xl:"_1bhyzin5"}},defaultVariants:{},compoundVariants:[]});const Ly=1e3,zl=64,Iv=zl/2,Ov=(t,e=Ly)=>t%e/(Ly/zl),pa=(t,e=0)=>{let r=3735928559^e,n=1103547991^e;for(let i=0,s;i>>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)},rF=(t,e,r)=>{const n=Math.random().toString(36).slice(2,12),i=t%360,s=(t+120)%360,o=r%360;return{id:pa(n),a:`hsl(${i}deg 100% 40%)`,b:`hsl(${s}deg 100% 50%)`,c:`hsl(${o}deg 100% 50%)`}},nF=(t,e)=>{const r=[];for(let n=0;n{const s=zl/10+Ov(n.r,Ly*1.5/(i+1));return{...rF(n.a,n.b,n.c),x:Ov(n.x),y:Ov(n.y),r:s}})};y.memo(t=>{const{className:e,address:r,size:n="md",complexity:i=1,...s}=t,o=nF(r,i);return Y.jsxs(G,{as:"svg",className:In(e,tF({size:n})),viewBox:`0 0 ${zl} ${zl}`,version:"1.1",flexShrink:"0",borderRadius:"circle",overflow:"hidden",xmlns:"http://www.w3.org/2000/svg",...s,children:[Y.jsxs("defs",{children:[Y.jsx("clipPath",{id:"circle-clip",children:Y.jsx("circle",{cx:Iv,cy:Iv,r:Iv})}),Y.jsxs("filter",{id:"blur",x:"-10%",y:"-10%",width:"120%",height:"120%",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[Y.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),Y.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),Y.jsx("feGaussianBlur",{stdDeviation:zl/10,result:"effect1_foregroundBlur"})]}),Y.jsxs("linearGradient",{id:`gradient-background-${o[0].id}`,x1:"0",y1:"0",x2:"1",y2:"1",children:[Y.jsx("stop",{offset:"0",stopColor:o[0].c}),Y.jsx("stop",{offset:"1",stopColor:o[0].a})]}),o.map(a=>Y.jsxs(y.Fragment,{children:[Y.jsxs("radialGradient",{id:`gradient-primary-${a.id}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.a}),Y.jsx("stop",{offset:"1",stopColor:a.b})]}),Y.jsxs("radialGradient",{id:`gradient-secondary-${a.id}`,children:[Y.jsx("stop",{offset:"0",stopColor:a.c}),Y.jsx("stop",{offset:"1",stopColor:a.b})]})]},a.id))]}),Y.jsxs("g",{clipPath:"url(#circle-clip)",children:[Y.jsx("rect",{width:"100%",height:"100%",fill:`url(#gradient-background-${o[0].id})`}),Y.jsx("g",{filter:"url(#blur)",children:o.map(a=>Y.jsxs(y.Fragment,{children:[Y.jsx("circle",{fill:`url(#gradient-primary-${a.id})`,cx:a.x,cy:a.y,r:a.r}),Y.jsx("circle",{fill:`url(#gradient-secondary-${a.id})`,cx:a.y,cy:a.x,r:a.r/2})]},a.id))})]})]})});const iF=t=>{const{disableAnimation:e=!1,onLoad:r,...n}=t,[i,s]=y.useState(!1),o=a=>{s(!0),r==null||r(a)};return Y.jsx(G,{as:Ta.img,initial:e?void 0:{opacity:0},animate:e?void 0:{opacity:i?1:0},transition:{duration:.2},onLoad:e?void 0:o,...n})},K5="Dialog",[Y5,Cse]=cn(K5),[sF,ra]=Y5(K5),oF=t=>{const{__scopeDialog:e,children:r,open:n,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=y.useRef(null),l=y.useRef(null),[c=!1,f]=Ks({prop:n,defaultProp:i,onChange:s});return y.createElement(sF,{scope:e,triggerRef:a,contentRef:l,contentId:jo(),titleId:jo(),descriptionId:jo(),open:c,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(u=>!u),[f]),modal:o},r)},Q5="DialogPortal",[aF,J5]=Y5(Q5,{forceMount:void 0}),lF=t=>{const{__scopeDialog:e,forceMount:r,children:n,container:i}=t,s=ra(Q5,e);return y.createElement(aF,{scope:e,forceMount:r},y.Children.map(n,o=>y.createElement(no,{present:r||s.open},y.createElement(C5,{asChild:!0,container:i},o))))},jy="DialogOverlay",cF=y.forwardRef((t,e)=>{const r=J5(jy,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=ra(jy,t.__scopeDialog);return s.modal?y.createElement(no,{present:n||s.open},y.createElement(fF,_e({},i,{ref:e}))):null}),fF=y.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=ra(jy,r);return y.createElement(sx,{as:ic,allowPinchZoom:!0,shards:[i.contentRef]},y.createElement(Ve.div,_e({"data-state":Z5(i.open)},n,{ref:e,style:{pointerEvents:"auto",...n.style}})))}),nu="DialogContent",uF=y.forwardRef((t,e)=>{const r=J5(nu,t.__scopeDialog),{forceMount:n=r.forceMount,...i}=t,s=ra(nu,t.__scopeDialog);return y.createElement(no,{present:n||s.open},s.modal?y.createElement(dF,_e({},i,{ref:e})):y.createElement(hF,_e({},i,{ref:e})))}),dF=y.forwardRef((t,e)=>{const r=ra(nu,t.__scopeDialog),n=y.useRef(null),i=Tt(e,r.contentRef,n);return y.useEffect(()=>{const s=n.current;if(s)return I5(s)},[]),y.createElement(X5,_e({},t,{ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=r.triggerRef.current)===null||o===void 0||o.focus()}),onPointerDownOutside:Ce(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Ce(t.onFocusOutside,s=>s.preventDefault())}))}),hF=y.forwardRef((t,e)=>{const r=ra(nu,t.__scopeDialog),n=y.useRef(!1),i=y.useRef(!1);return y.createElement(X5,_e({},t,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o;if((o=t.onCloseAutoFocus)===null||o===void 0||o.call(t,s),!s.defaultPrevented){var a;n.current||(a=r.triggerRef.current)===null||a===void 0||a.focus(),s.preventDefault()}n.current=!1,i.current=!1},onInteractOutside:s=>{var o,a;(o=t.onInteractOutside)===null||o===void 0||o.call(t,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=s.target;((a=r.triggerRef.current)===null||a===void 0?void 0:a.contains(l))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}}))}),X5=y.forwardRef((t,e)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=ra(nu,r),l=y.useRef(null),c=Tt(e,l);return c5(),y.createElement(y.Fragment,null,y.createElement(f5,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:s},y.createElement(Jg,_e({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Z5(a.open)},o,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)}),vF="DialogClose",pF=y.forwardRef((t,e)=>{const{__scopeDialog:r,...n}=t,i=ra(vF,r);return y.createElement(Ve.button,_e({type:"button"},n,{ref:e,onClick:Ce(t.onClick,()=>i.onOpenChange(!1))}))});function Z5(t){return t?"open":"closed"}const yF=oF,mF=lF,gF=cF,xF=uF,bF=pF;var wF=ur({defaultClassName:"_1vqx0w91 _1vqx0w90 fyvr128 fyvr15o",variantClassNames:{direction:{vertical:"_1vqx0w92",horizontal:"_1vqx0w93"}},defaultVariants:{},compoundVariants:[]}),EF=ur({defaultClassName:"_1vqx0w94",variantClassNames:{shadows:{true:"_1vqx0w95",false:"_1vqx0w96"},direction:{vertical:"_1vqx0w97",horizontal:"_1vqx0w98"}},defaultVariants:{},compoundVariants:[]});const SF=t=>{const{children:e,shadows:r=!0,direction:n="vertical",contentProps:i,...s}=t;return Y.jsx(G,{className:EF({direction:n,shadows:r}),position:"relative",width:"full",height:"full",...s,children:Y.jsx(G,{className:wF({direction:n}),background:"backgroundPrimary",...i,children:e})})};function kF(t){var e=t.match(/^var\((.*)\)$/);return e?e[1]:t}function AF(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 e8(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],n=t.constructor();for(var i in t){var s=t[i],o=[...r,i];typeof s=="string"||typeof s=="number"||s==null?n[i]=e(s,o):typeof s=="object"&&!Array.isArray(s)?n[i]=e8(s,e,o):console.warn('Skipping invalid key "'.concat(o.join("."),'". Should be a string, number, null or object. Received: "').concat(Array.isArray(s)?"Array":typeof s,'"'))}return n}function uS(t,e,r){t.style.setProperty(kF(e),r)}function dS(t,e,r){if(typeof r=="object"){var n=e;e8(r,(a,l)=>{a!=null&&uS(t,AF(n,l),String(a))})}else{var i=e;for(var s in i){var o=i[s];o!=null&&uS(t,s,i[s])}}}const lx=["dark","light"],t8="dark",CF="data-theme",hS="@sequence.theme",_F=t=>lx.includes(t),TF=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),r8=t=>t?`${hS}.${t}`:hS,PF=t=>{const e=localStorage.getItem(r8(t));return e&&lx.includes(e)?e:t8},n8=y.createContext(null),RF=t=>{const[e,r]=y.useState(t.theme||t8);y.useEffect(()=>{/Mac/.test(window.navigator.userAgent)&&window.document.documentElement.classList.add("is-apple")},[]),y.useEffect(()=>{t.theme||r(PF(t.scope))},[t.theme,t.scope]),y.useEffect(()=>{t.theme&&r(t.theme)},[t.theme]),y.useEffect(()=>{const i=document.querySelector(t.root||":root");i&&(_F(e)?(i.setAttribute(CF,e),dS(i,LE,{colors:u$[e]})):TF(e)&&dS(i,LE,{colors:e}))},[e,t.root]);const n=y.useMemo(()=>({theme:e,root:t.root,setTheme:i=>{lx.includes(i)&&(localStorage.setItem(r8(t.scope),i),r(i))}}),[e,t.root,t.scope]);return Y.jsx(n8.Provider,{value:n,children:t.children})},IF=()=>{const t=y.useContext(n8);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t};var OF="_5b32m91 _5b32m90 fyvr11jg fyvr11ko fyvr11h0 fyvr11hs fyvr11nk fyvr1ko fyvr1oo fyvr1qo fyvr1mo",MF="_5b32m93 _5b32m92 fyvr11hs fyvr1ko fyvr1oo fyvr1qo fyvr1mo",NF=ur({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"]]}),$F="_5b32m9b _5b32m9a fyvr110o fyvr112o fyvr114o fyvr116o fyvr11ho fyvr1qo fyvr1ko fyvr11nk";const i8=t=>{const{autoHeight:e=!1,backdropColor:r="backgroundBackdrop",children:n,disableAnimation:i=!1,isDismissible:s=!0,onClose:o,scroll:a=!0,size:l="lg",overlayProps:c,contentProps:f}=t,{root:u}=IF(),[d,h]=y.useState(null);return y.useEffect(()=>{h(document.querySelector(u||"body"))},[u]),d?Y.jsx(yF,{modal:!0,defaultOpen:!0,onOpenChange:o,children:Y.jsx(mF,{forceMount:!0,container:d,children:Y.jsxs(G,{className:OF,children:[Y.jsx(G,{as:gF,asChild:!0,background:r,className:MF,forceMount:!0,children:Y.jsx(Ta.div,{initial:i?!1:{opacity:0},animate:i?!1:{opacity:1},exit:i?void 0:{opacity:0},transition:{type:"tween",ease:"linear"},...c},"modal-overlay")}),Y.jsx(xF,{asChild:!0,className:NF({autoHeight:e,size:l}),forceMount:!0,onEscapeKeyDown:p=>{s?o==null||o():p.preventDefault()},onInteractOutside:p=>{s||p.preventDefault()},children:Y.jsxs(Ta.div,{initial:i?!1:{y:"100%",opacity:l==="sm"?0:1},animate:i?!1:{y:0,opacity:1},exit:i?void 0:{y:"100%",opacity:l==="sm"?0:1},transition:{type:"tween",ease:"easeOut"},...f,children:[a?Y.jsx(SF,{children:n}):n,s&&Y.jsx(bF,{asChild:!0,children:Y.jsx(o1,{icon:eu,backdropFilter:"blur",size:"xs",className:$F,"aria-label":"Close"})})]},"modal-content")})]})})}):null};var DF="_1acm19y1 _1acm19y0 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg fyvr1ww fyvr1ys fyvr11hc fyvr11ko fyvr11od fyvr12s1 fyvr1g0 fyvr118g",LF=ur({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:[]}),jF=ur({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 Ir=y.forwardRef((t,e)=>{const{as:r="input",autoComplete:n="off",borderRadius:i="md",description:s,disabled:o=!1,id:a,label:l="",labelLocation:c="hidden",leftIcon:f,rightIcon:u,name:d,controls:h,type:p="text",numeric:m=!1,...x}=t;return Y.jsx(Xa,{description:s,disabled:o,display:"grid",id:a??d,label:l,labelLocation:c,children:Y.jsx(G,{width:"full",children:Y.jsxs(G,{className:In(DF,LF({borderRadius:i})),children:[f&&Y.jsx(f,{size:"sm"}),Y.jsx(G,{as:r,autoComplete:n,spellCheck:"false",className:jF({numeric:m}),disabled:o,id:a??d,name:d,ref:e,type:p,...x}),u&&Y.jsx(u,{size:"sm"}),h]})})})}),FF=RegExp("^\\d*(?:\\\\[.])?\\d*$");function BF(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}y.forwardRef((t,e)=>{const{name:r="amount",placeholder:n,onChange:i,onBlur:s,...o}=t,a=c=>{let{value:f}=c.target;f=f.replace(/,/g,"."),f.startsWith(".")&&(f="0"+f),f.startsWith("0")&&(f=f.replace(/^0+(?=\d)/,"")),(f===""||FF.test(BF(f)))&&(i==null||i({...c,target:{...c.target,value:f}}))},l=c=>{const{value:f}=c.target;let u=f;u.endsWith(".")&&(u=u.slice(0,-1)),u.endsWith(".0")&&(u=u.slice(0,-2)),u==="0"&&(u=""),s==null||s(c),u!==f&&(i==null||i({...c,target:{...c.target,value:u}}))};return Y.jsx(Ir,{name:r,onChange:a,onBlur:l,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 UF="y5zf971 _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8 _4efw240";const zF=t=>{const{value:e,digits:r=6,group:n,onChange:i,onConfirm:s,disabled:o=!1}=t,a=y.useMemo(()=>vS(0,r).map(()=>y.createRef()),[r]);y.useEffect(()=>{var d,h;(h=(d=a[0])==null?void 0:d.current)==null||h.focus()},[a]);const l=(d,h)=>{var p,m;/^\d$/.test(h)||(h="");const x=[...e];x[d]=h,h!==""&&((m=(p=a[d+1])==null?void 0:p.current)==null||m.focus()),i(x)},c=()=>e.join("").length===r,f=(d,h)=>{var p,m;const x=a[d].current,b=(p=a[d-1])==null?void 0:p.current,w=(m=a[d+1])==null?void 0:m.current;switch(h.key){case"Backspace":h.preventDefault(),x&&(x.value="",l(d,"")),b==null||b.focus();break;case"ArrowLeft":h.preventDefault(),b==null||b.focus();break;case"ArrowRight":h.preventDefault(),w==null||w.focus();break;case"Enter":h.preventDefault(),c()&&(s==null||s());break;default:(x==null?void 0:x.value)===h.key&&(h.preventDefault(),l(d,h.key))}},u=(d,h)=>{var p,m;const b=h.clipboardData.getData("text/plain").replace(/\D/g,"");new RegExp(`^\\d{${r}}$`).test(b)&&((m=(p=a[0])==null?void 0:p.current)==null||m.focus(),i(b.split("")),setTimeout(()=>{var E,P;(P=(E=a[a.length-1])==null?void 0:E.current)==null||P.focus()}))};return Y.jsx(G,{gap:"2",children:vS(0,r).map(d=>Y.jsxs(y.Fragment,{children:[!!n&&d>0&&d%n===0&&Y.jsx("span",{}),Y.jsx(G,{as:"input",className:UF,value:e[d]||"",ref:a[d],type:"text",inputMode:"numeric",maxLength:1,disabled:o,onFocus:h=>h.target.select(),onPaste:h=>u(d,h),onChange:h=>l(d,h.target.value),onKeyDown:h=>{f(d,h)}})]},d))})},vS=(t,e)=>Array.from({length:e-t},(r,n)=>n+t);ur({defaultClassName:"_1jujggt1",variantClassNames:{size:{sm:"_1jujggt2",normal:"_1jujggt3",md:"_1jujggt4",lg:"_1jujggt5",xl:"_1jujggt6"}},defaultVariants:{},compoundVariants:[]});const s8="Progress",a1=100,[VF,_se]=cn(s8),[qF,Tse]=VF(s8),HF=y.forwardRef((t,e)=>{const{__scopeProgress:r,value:n,max:i,getValueLabel:s=WF,...o}=t,a=Fy(i)?i:a1,l=o8(n,a)?n:null,c=e0(l)?s(l,a):void 0;return y.createElement(qF,{scope:r,value:l,max:a},y.createElement(Ve.div,Wt({"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":e0(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":GF(l,a),"data-value":l??void 0,"data-max":a},o,{ref:e})))});HF.propTypes={max(t,e,r){const n=t[e],i=String(n);return n&&!Fy(n)?new Error(KF(i,r)):null},value(t,e,r){const n=t[e],i=String(n),s=Fy(t.max)?t.max:a1;return n!=null&&!o8(n,s)?new Error(YF(i,r)):null}};function WF(t,e){return`${Math.round(t/e*100)}%`}function GF(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function e0(t){return typeof t=="number"}function Fy(t){return e0(t)&&!isNaN(t)&&t>0}function o8(t,e){return e0(t)&&!isNaN(t)&&t<=e&&t>=0}function KF(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${a1}\`.`}function YF(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 ${a1} if no \`max\` prop is set) - \`null\` if the progress is indeterminate. -Defaulting to \`null\`.`}const a8="Radio",[QF,l8]=cn(a8),[JF,XF]=QF(a8),ZF=y.forwardRef((t,e)=>{const{__scopeRadio:r,name:n,checked:i=!1,required:s,disabled:o,value:a="on",onCheck:l,...c}=t,[f,u]=y.useState(null),d=Tt(e,m=>u(m)),h=y.useRef(!1),p=f?!!f.closest("form"):!0;return y.createElement(JF,{scope:r,checked:i,disabled:o},y.createElement(Ve.button,Wt({type:"button",role:"radio","aria-checked":i,"data-state":c8(i),"data-disabled":o?"":void 0,disabled:o,value:a},c,{ref:d,onClick:Ce(t.onClick,m=>{i||l==null||l(),p&&(h.current=m.isPropagationStopped(),h.current||m.stopPropagation())})})),p&&y.createElement(rB,{control:f,bubbles:!h.current,name:n,value:a,checked:i,required:s,disabled:o,style:{transform:"translateX(-100%)"}}))}),eB="RadioIndicator",tB=y.forwardRef((t,e)=>{const{__scopeRadio:r,forceMount:n,...i}=t,s=XF(eB,r);return y.createElement(no,{present:n||s.checked},y.createElement(Ve.span,Wt({"data-state":c8(s.checked),"data-disabled":s.disabled?"":void 0},i,{ref:e})))}),rB=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=y.useRef(null),o=X0(r),a=Z0(e);return y.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==r&&u){const d=new Event("click",{bubbles:n});u.call(l,r),l.dispatchEvent(d)}},[o,r,n]),y.createElement("input",Wt({type:"radio","aria-hidden":!0,defaultChecked:r},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function c8(t){return t?"checked":"unchecked"}const nB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],f8="RadioGroup",[iB,Pse]=cn(f8,[Ec,l8]),u8=Ec(),d8=l8(),[sB,oB]=iB(f8),aB=y.forwardRef((t,e)=>{const{__scopeRadioGroup:r,name:n,defaultValue:i,value:s,required:o=!1,disabled:a=!1,orientation:l,dir:c,loop:f=!0,onValueChange:u,...d}=t,h=u8(r),p=Qg(c),[m,x]=Ks({prop:s,defaultProp:i,onChange:u});return y.createElement(sB,{scope:r,name:n,required:o,disabled:a,value:m,onValueChange:x},y.createElement(BL,Wt({asChild:!0},h,{orientation:l,dir:p,loop:f}),y.createElement(Ve.div,Wt({role:"radiogroup","aria-required":o,"aria-orientation":l,"data-disabled":a?"":void 0,dir:p},d,{ref:e}))))}),lB="RadioGroupItem",cB=y.forwardRef((t,e)=>{const{__scopeRadioGroup:r,disabled:n,...i}=t,s=oB(lB,r),o=s.disabled||n,a=u8(r),l=d8(r),c=y.useRef(null),f=Tt(e,c),u=s.value===i.value,d=y.useRef(!1);return y.useEffect(()=>{const h=m=>{nB.includes(m.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)}},[]),y.createElement(P5,Wt({asChild:!0},a,{focusable:!o,active:u}),y.createElement(ZF,Wt({disabled:o,required:s.required,checked:u},l,i,{name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:Ce(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Ce(i.onFocus,()=>{var h;d.current&&((h=c.current)===null||h===void 0||h.click())})})))}),fB=y.forwardRef((t,e)=>{const{__scopeRadioGroup:r,...n}=t,i=d8(r);return y.createElement(tB,Wt({},i,n,{ref:e}))}),uB=aB,dB=cB,hB=fB;var vB=fr({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:[]}),pB=fr({defaultClassName:"io59uy8 io59uy7 io59uy6 fyvr11h0 fyvr11ko fyvr11jg fyvr11hw fyvr128 fyvr15o fyvr12s1",variantClassNames:{size:{sm:"io59uy9",lg:"io59uya"}},defaultVariants:{},compoundVariants:[]});const yB=t=>{const{id:e,label:r,size:n="sm",value:i,disabled:s}=t;return Y.jsx(G,{alignItems:"center",children:Y.jsx(Xa,{disabled:s,display:"flex",id:e,label:r,labelLocation:"right",children:Y.jsx(dB,{className:vB({size:n}),value:i,id:e,disabled:s,children:Y.jsx(hB,{className:pB({size:n})})})})})};y.forwardRef((t,e)=>{const{flexDirection:r="column",disabled:n=!1,gap:i="2",name:s,options:o,size:a="sm",...l}=t;return Y.jsx(uB,{disabled:n,name:s,ref:e,...l,children:Y.jsx(G,{flexDirection:r,gap:i,children:o.map(({label:c,value:f,disabled:u})=>Y.jsx(yB,{id:`${s}-${f}`,label:c,size:a,value:f,disabled:u},f))})})});function pS(t,[e,r]){return Math.min(r,Math.max(e,t))}const cx=y.forwardRef((t,e)=>y.createElement(Ve.span,_e({},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}}))),mB=[" ","Enter","ArrowUp","ArrowDown"],gB=[" ","Enter"],l1="Select",[c1,fx,xB]=t1(l1),[Sc,Rse]=cn(l1,[xB,wc]),ux=wc(),[bB,el]=Sc(l1),[wB,EB]=Sc(l1),SB=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:f,autoComplete:u,disabled:d,required:h}=t,p=ux(e),[m,x]=y.useState(null),[b,w]=y.useState(null),[E,P]=y.useState(!1),N=Qg(c),[I=!1,j]=Ks({prop:n,defaultProp:i,onChange:s}),[L,U]=Ks({prop:o,defaultProp:a,onChange:l}),K=y.useRef(null),X=m?!!m.closest("form"):!0,[ee,M]=y.useState(new Set),v=Array.from(ee).map(_=>_.props.value).join(";");return y.createElement(kL,p,y.createElement(bB,{required:h,scope:e,trigger:m,onTriggerChange:x,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:P,contentId:jo(),value:L,onValueChange:U,open:I,onOpenChange:j,dir:N,triggerPointerDownPosRef:K,disabled:d},y.createElement(c1.Provider,{scope:e},y.createElement(wB,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(_=>{M(k=>new Set(k).add(_))},[]),onNativeOptionRemove:y.useCallback(_=>{M(k=>{const A=new Set(k);return A.delete(_),A})},[])},r)),X?y.createElement(p8,{key:v,"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:u,value:L,onChange:_=>U(_.target.value),disabled:d},L===void 0?y.createElement("option",{value:""}):null,Array.from(ee)):null))},kB="SelectTrigger",AB=y.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...i}=t,s=ux(r),o=el(kB,r),a=o.disabled||n,l=Tt(e,o.onTriggerChange),c=fx(r),[f,u,d]=y8(p=>{const m=c().filter(w=>!w.disabled),x=m.find(w=>w.value===o.value),b=m8(m,p,x);b!==void 0&&o.onValueChange(b.value)}),h=()=>{a||(o.onOpenChange(!0),d())};return y.createElement(AL,_e({asChild:!0},s),y.createElement(Ve.button,_e({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":v8(o.value)?"":void 0},i,{ref:l,onClick:Ce(i.onClick,p=>{p.currentTarget.focus()}),onPointerDown:Ce(i.onPointerDown,p=>{const m=p.target;m.hasPointerCapture(p.pointerId)&&m.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(i.onKeyDown,p=>{const m=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&u(p.key),!(m&&p.key===" ")&&mB.includes(p.key)&&(h(),p.preventDefault())})})))}),CB="SelectValue",_B=y.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,children:s,placeholder:o="",...a}=t,l=el(CB,r),{onValueNodeHasChildrenChange:c}=l,f=s!==void 0,u=Tt(e,l.onValueNodeChange);return Kn(()=>{c(f)},[c,f]),y.createElement(Ve.span,_e({},a,{ref:u,style:{pointerEvents:"none"}}),v8(l.value)?y.createElement(y.Fragment,null,o):s)}),TB=y.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...i}=t;return y.createElement(Ve.span,_e({"aria-hidden":!0},i,{ref:e}),n||"▼")}),oc="SelectContent",PB=y.forwardRef((t,e)=>{const r=el(oc,t.__scopeSelect),[n,i]=y.useState();if(Kn(()=>{i(new DocumentFragment)},[]),!r.open){const s=n;return s?ro.createPortal(y.createElement(h8,{scope:t.__scopeSelect},y.createElement(c1.Slot,{scope:t.__scopeSelect},y.createElement("div",null,t.children))),s):null}return y.createElement(RB,_e({},t,{ref:e}))}),_s=10,[h8,f1]=Sc(oc),RB=y.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:u,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:x,...b}=t,w=el(oc,r),[E,P]=y.useState(null),[N,I]=y.useState(null),j=Tt(e,V=>P(V)),[L,U]=y.useState(null),[K,X]=y.useState(null),ee=fx(r),[M,v]=y.useState(!1),_=y.useRef(!1);y.useEffect(()=>{if(E)return I5(E)},[E]),c5();const k=y.useCallback(V=>{const[H,...Z]=ee().map(te=>te.ref.current),[le]=Z.slice(-1),ne=document.activeElement;for(const te of V)if(te===ne||(te==null||te.scrollIntoView({block:"nearest"}),te===H&&N&&(N.scrollTop=0),te===le&&N&&(N.scrollTop=N.scrollHeight),te==null||te.focus(),document.activeElement!==ne))return},[ee,N]),A=y.useCallback(()=>k([L,E]),[k,L,E]);y.useEffect(()=>{M&&A()},[M,A]);const{onOpenChange:T,triggerPointerDownPosRef:O}=w;y.useEffect(()=>{if(E){let V={x:0,y:0};const H=le=>{var ne,te,Me,pe;V={x:Math.abs(Math.round(le.pageX)-((ne=(te=O.current)===null||te===void 0?void 0:te.x)!==null&&ne!==void 0?ne:0)),y:Math.abs(Math.round(le.pageY)-((Me=(pe=O.current)===null||pe===void 0?void 0:pe.y)!==null&&Me!==void 0?Me:0))}},Z=le=>{V.x<=10&&V.y<=10?le.preventDefault():E.contains(le.target)||T(!1),document.removeEventListener("pointermove",H),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",Z,{capture:!0})}}},[E,T,O]),y.useEffect(()=>{const V=()=>T(!1);return window.addEventListener("blur",V),window.addEventListener("resize",V),()=>{window.removeEventListener("blur",V),window.removeEventListener("resize",V)}},[T]);const[D,S]=y8(V=>{const H=ee().filter(ne=>!ne.disabled),Z=H.find(ne=>ne.ref.current===document.activeElement),le=m8(H,V,Z);le&&setTimeout(()=>le.ref.current.focus())}),g=y.useCallback((V,H,Z)=>{const le=!_.current&&!Z;(w.value!==void 0&&w.value===H||le)&&(U(V),le&&(_.current=!0))},[w.value]),R=y.useCallback(()=>E==null?void 0:E.focus(),[E]),F=y.useCallback((V,H,Z)=>{const le=!_.current&&!Z;(w.value!==void 0&&w.value===H||le)&&X(V)},[w.value]),C=n==="popper"?yS:IB,B=C===yS?{side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:u,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:x}:{};return y.createElement(h8,{scope:r,content:E,viewport:N,onViewportChange:I,itemRefCallback:g,selectedItem:L,onItemLeave:R,itemTextRefCallback:F,focusSelectedItem:A,selectedItemText:K,position:n,isPositioned:M,searchRef:D},y.createElement(sx,{as:ic,allowPinchZoom:!0},y.createElement(f5,{asChild:!0,trapped:w.open,onMountAutoFocus:V=>{V.preventDefault()},onUnmountAutoFocus:Ce(i,V=>{var H;(H=w.trigger)===null||H===void 0||H.focus({preventScroll:!0}),V.preventDefault()})},y.createElement(Jg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:V=>V.preventDefault(),onDismiss:()=>w.onOpenChange(!1)},y.createElement(C,_e({role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:V=>V.preventDefault()},b,B,{onPlaced:()=>v(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ce(b.onKeyDown,V=>{const H=V.ctrlKey||V.altKey||V.metaKey;if(V.key==="Tab"&&V.preventDefault(),!H&&V.key.length===1&&S(V.key),["ArrowUp","ArrowDown","Home","End"].includes(V.key)){let le=ee().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(V.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(V.key)){const ne=V.target,te=le.indexOf(ne);le=le.slice(te+1)}setTimeout(()=>k(le)),V.preventDefault()}})}))))))}),IB=y.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...i}=t,s=el(oc,r),o=f1(oc,r),[a,l]=y.useState(null),[c,f]=y.useState(null),u=Tt(e,j=>f(j)),d=fx(r),h=y.useRef(!1),p=y.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=o,E=y.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&m&&x&&b){const j=s.trigger.getBoundingClientRect(),L=c.getBoundingClientRect(),U=s.valueNode.getBoundingClientRect(),K=b.getBoundingClientRect();if(s.dir!=="rtl"){const ne=K.left-L.left,te=U.left-ne,Me=j.left-te,pe=j.width+Me,ke=Math.max(pe,L.width),sr=window.innerWidth-_s,Ze=pS(te,[_s,sr-ke]);a.style.minWidth=pe+"px",a.style.left=Ze+"px"}else{const ne=L.right-K.right,te=window.innerWidth-U.right-ne,Me=window.innerWidth-j.right-te,pe=j.width+Me,ke=Math.max(pe,L.width),sr=window.innerWidth-_s,Ze=pS(te,[_s,sr-ke]);a.style.minWidth=pe+"px",a.style.right=Ze+"px"}const X=d(),ee=window.innerHeight-_s*2,M=m.scrollHeight,v=window.getComputedStyle(c),_=parseInt(v.borderTopWidth,10),k=parseInt(v.paddingTop,10),A=parseInt(v.borderBottomWidth,10),T=parseInt(v.paddingBottom,10),O=_+k+M+T+A,D=Math.min(x.offsetHeight*5,O),S=window.getComputedStyle(m),g=parseInt(S.paddingTop,10),R=parseInt(S.paddingBottom,10),F=j.top+j.height/2-_s,C=ee-F,B=x.offsetHeight/2,V=x.offsetTop+B,H=_+k+V,Z=O-H;if(H<=F){const ne=x===X[X.length-1].ref.current;a.style.bottom="0px";const te=c.clientHeight-m.offsetTop-m.offsetHeight,Me=Math.max(C,B+(ne?R:0)+te+A),pe=H+Me;a.style.height=pe+"px"}else{const ne=x===X[0].ref.current;a.style.top="0px";const Me=Math.max(F,_+m.offsetTop+(ne?g:0)+B)+Z;a.style.height=Me+"px",m.scrollTop=H-F+m.offsetTop}a.style.margin=`${_s}px 0`,a.style.minHeight=D+"px",a.style.maxHeight=ee+"px",n==null||n(),requestAnimationFrame(()=>h.current=!0)}},[d,s.trigger,s.valueNode,a,c,m,x,b,s.dir,n]);Kn(()=>E(),[E]);const[P,N]=y.useState();Kn(()=>{c&&N(window.getComputedStyle(c).zIndex)},[c]);const I=y.useCallback(j=>{j&&p.current===!0&&(E(),w==null||w(),p.current=!1)},[E,w]);return y.createElement(OB,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:I},y.createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P}},y.createElement(Ve.div,_e({},i,{ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}}))))}),yS=y.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:i=_s,...s}=t,o=ux(r);return y.createElement(CL,_e({},o,s,{ref:e,align:n,collisionPadding:i,style:{boxSizing:"border-box",...s.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)"}}))}),[OB,MB]=Sc(oc,{}),mS="SelectViewport",NB=y.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=f1(mS,r),s=MB(mS,r),o=Tt(e,i.onViewportChange),a=y.useRef(0);return y.createElement(y.Fragment,null,y.createElement("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}"}}),y.createElement(c1.Slot,{scope:r},y.createElement(Ve.div,_e({"data-radix-select-viewport":"",role:"presentation"},n,{ref:o,style:{position:"relative",flex:1,overflow:"auto",...n.style},onScroll:Ce(n.onScroll,l=>{const c=l.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:u}=s;if(u!=null&&u.current&&f){const d=Math.abs(a.current-c.scrollTop);if(d>0){const h=window.innerHeight-_s*2,p=parseFloat(f.style.minHeight),m=parseFloat(f.style.height),x=Math.max(p,m);if(x0?E:0,f.style.justifyContent="flex-end")}}}a.current=c.scrollTop})}))))}),$B="SelectGroup",[DB,Ise]=Sc($B),LB=y.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=jo();return y.createElement(DB,{scope:r,id:i},y.createElement(Ve.div,_e({role:"group","aria-labelledby":i},n,{ref:e})))}),By="SelectItem",[jB,FB]=Sc(By),BB=y.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:i=!1,textValue:s,...o}=t,a=el(By,r),l=f1(By,r),c=a.value===n,[f,u]=y.useState(s??""),[d,h]=y.useState(!1),p=Tt(e,b=>{var w;return(w=l.itemRefCallback)===null||w===void 0?void 0:w.call(l,b,n,i)}),m=jo(),x=()=>{i||(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 y.createElement(jB,{scope:r,value:n,disabled:i,textId:m,isSelected:c,onItemTextChange:y.useCallback(b=>{u(w=>{var E;return w||((E=b==null?void 0:b.textContent)!==null&&E!==void 0?E:"").trim()})},[])},y.createElement(c1.ItemSlot,{scope:r,value:n,disabled:i,textValue:f},y.createElement(Ve.div,_e({role:"option","aria-labelledby":m,"data-highlighted":d?"":void 0,"aria-selected":c&&d,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1},o,{ref:p,onFocus:Ce(o.onFocus,()=>h(!0)),onBlur:Ce(o.onBlur,()=>h(!1)),onPointerUp:Ce(o.onPointerUp,x),onPointerMove:Ce(o.onPointerMove,b=>{if(i){var w;(w=l.onItemLeave)===null||w===void 0||w.call(l)}else b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ce(o.onPointerLeave,b=>{if(b.currentTarget===document.activeElement){var w;(w=l.onItemLeave)===null||w===void 0||w.call(l)}}),onKeyDown:Ce(o.onKeyDown,b=>{var w;((w=l.searchRef)===null||w===void 0?void 0:w.current)!==""&&b.key===" "||(gB.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})}))))}),bd="SelectItemText",UB=y.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,...s}=t,o=el(bd,r),a=f1(bd,r),l=FB(bd,r),c=EB(bd,r),[f,u]=y.useState(null),d=Tt(e,b=>u(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)===null||w===void 0?void 0:w.call(a,b,l.value,l.disabled)}),h=f==null?void 0:f.textContent,p=y.useMemo(()=>y.createElement("option",{key:l.value,value:l.value,disabled:l.disabled},h),[l.disabled,l.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=c;return Kn(()=>(m(p),()=>x(p)),[m,x,p]),y.createElement(y.Fragment,null,y.createElement(Ve.span,_e({id:l.textId},s,{ref:d})),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ro.createPortal(s.children,o.valueNode):null)});function v8(t){return t===""||t===void 0}const p8=y.forwardRef((t,e)=>{const{value:r,...n}=t,i=y.useRef(null),s=Tt(e,i),o=X0(r);return y.useEffect(()=>{const a=i.current,l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==r&&f){const u=new Event("change",{bubbles:!0});f.call(a,r),a.dispatchEvent(u)}},[o,r]),y.createElement(cx,{asChild:!0},y.createElement("select",_e({},n,{ref:s,defaultValue:r})))});p8.displayName="BubbleSelect";function y8(t){const e=Pn(t),r=y.useRef(""),n=y.useRef(0),i=y.useCallback(o=>{const a=r.current+o;e(a),function l(c){r.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=y.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,i,s]}function m8(t,e,r){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let o=zB(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==r));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}function zB(t,e){return t.map((r,n)=>t[(e+n)%t.length])}const VB=SB,qB=AB,HB=_B,WB=TB,GB=PB,KB=NB,YB=LB,QB=BB,JB=UB;var XB="gohwum1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 gohwum0 fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11ko fyvr11od fyvr11hc fyvr11f4 fyvr12s1 fyvr118c fyvr11jw fyvr11n4 fyvr12v7 fyvr12o1",ZB=fr({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:[]}),eU="gohwuma gohwum9 fyvr11d0 fyvr11do fyvr11bo fyvr11cc fyvr11ls fyvr11m8 fyvr11ms fyvr11tv fyvr12s1 fyvr11nl",tU="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 rU=y.forwardRef(({children:t,className:e,...r},n)=>Y.jsx(QB,{className:In(tU,e),...r,ref:n,children:Y.jsx(JB,{children:t})})),u1=y.forwardRef((t,e)=>{const{borderRadius:r="md",disabled:n=!1,id:i,label:s="",description:o,labelLocation:a="hidden",name:l,options:c,placeholder:f,...u}=t;return Y.jsx(Xa,{disabled:n,display:"grid",id:i??l,label:s,labelLocation:a,description:o,whiteSpace:"nowrap",children:Y.jsxs(VB,{disabled:n,name:l,...u,children:[Y.jsxs(qB,{id:i??l,className:In(XB,ZB({borderRadius:r})),ref:e,children:[Y.jsx(HB,{placeholder:f}),Y.jsx(G,{as:WB,display:"inline-flex",children:Y.jsx(n5,{})})]}),Y.jsx(GB,{className:eU,children:Y.jsx(KB,{children:Y.jsx(YB,{children:c.map(({value:d,label:h,...p})=>Y.jsx(rU,{value:d,...p,children:h},d))})})})]})})});y.forwardRef((t,e)=>{const{controls:r,onChange:n,placeholder:i="Search",name:s="search",value:o,...a}=t,l=o?Y.jsx(o1,{icon:eu,size:"xs",onClick:()=>n==null?void 0:n({target:{value:""}})}):void 0;return Y.jsx(Ir,{ref:e,name:s,leftIcon:X$,controls:r||l,placeholder:i,value:o,onChange:c=>n==null?void 0:n(c),...a})});var nU=fr({defaultClassName:"en4abt1",variantClassNames:{size:{sm:"en4abt2",md:"en4abt3",lg:"en4abt4"}},defaultVariants:{},compoundVariants:[]});const _n=y.forwardRef((t,e)=>{const{size:r="md",...n}=t;return Y.jsx(G,{className:nU({size:r}),color:"text50",ref:e,...n,children:Y.jsxs("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",children:[Y.jsx("circle",{cx:"12",cy:"12",fill:"none",r:"10.5",strokeDasharray:"42",strokeLinecap:"round"}),Y.jsx("circle",{cx:"12",cy:"12",fill:"none",opacity:"0.25",r:"10.5",strokeLinecap:"round"})]})})});y.forwardRef(({children:t},e)=>Y.jsx(G,{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}));const g8="Switch",[iU,Ose]=cn(g8),[sU,oU]=iU(g8),aU=y.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,...f}=t,[u,d]=y.useState(null),h=Tt(e,w=>d(w)),p=y.useRef(!1),m=u?!!u.closest("form"):!0,[x=!1,b]=Ks({prop:i,defaultProp:s,onChange:c});return y.createElement(sU,{scope:r,checked:x,disabled:a},y.createElement(Ve.button,Wt({type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":x8(x),"data-disabled":a?"":void 0,disabled:a,value:l},f,{ref:h,onClick:Ce(t.onClick,w=>{b(E=>!E),m&&(p.current=w.isPropagationStopped(),p.current||w.stopPropagation())})})),m&&y.createElement(fU,{control:u,bubbles:!p.current,name:n,value:l,checked:x,required:o,disabled:a,style:{transform:"translateX(-100%)"}}))}),lU="SwitchThumb",cU=y.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,i=oU(lU,r);return y.createElement(Ve.span,Wt({"data-state":x8(i.checked),"data-disabled":i.disabled?"":void 0},n,{ref:e}))}),fU=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=y.useRef(null),o=X0(r),a=Z0(e);return y.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==r&&u){const d=new Event("click",{bubbles:n});u.call(l,r),l.dispatchEvent(d)}},[o,r,n]),y.createElement("input",Wt({type:"checkbox","aria-hidden":!0,defaultChecked:r},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function x8(t){return t?"checked":"unchecked"}const uU=aU,dU=cU;var hU="_1lp2u8e1 _1lp2u8e0 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr1ss fyvr1uo fyvr1wk fyvr1yg fyvr11t1 fyvr11hw fyvr12v7 fyvr12o1 _4efw240",vU="_1lp2u8e3 _1lp2u8e2 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ho fyvr1ko fyvr1oo fyvr1k fyvr140 fyvr11o1";const pU=t=>{const{disabled:e,label:r,labelLocation:n="left",description:i,id:s,name:o,...a}=t;return Y.jsx(Xa,{disabled:e,display:"flex",id:s??o,label:r,labelLocation:n,description:i,whiteSpace:"nowrap",children:Y.jsx(uU,{className:hU,disabled:e,...a,children:Y.jsx(G,{position:"relative",width:"full",height:"full",children:Y.jsx(dU,{className:vU})})})})};fr({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"]]});const b8="Tabs",[yU,Mse]=cn(b8,[Ec]);Ec();yU(b8);var mU="_1ppqbnx1 _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc _1ppqbnx0 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1wo fyvr1yk fyvr1ss fyvr1uo fyvr11hc fyvr118c fyvr11n9";y.forwardRef((t,e)=>{const{icon:r,label:n,...i}=t;return Y.jsxs(G,{className:mU,ref:e,background:"buttonGlass",color:"text80",...i,children:[r&&Y.jsx(r,{size:"xs"}),Y.jsx(me,{children:n})]})});const w8="ToastProvider",[dx,gU,xU]=t1("Toast"),[E8,Nse]=cn("Toast",[xU]),[bU,d1]=E8(w8),S8=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:o}=t,[a,l]=y.useState(null),[c,f]=y.useState(0),u=y.useRef(!1),d=y.useRef(!1);return y.createElement(dx.Provider,{scope:e},y.createElement(bU,{scope:e,label:r,duration:n,swipeDirection:i,swipeThreshold:s,toastCount:c,viewport:a,onViewportChange:l,onToastAdd:y.useCallback(()=>f(h=>h+1),[]),onToastRemove:y.useCallback(()=>f(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:u,isClosePausedRef:d},o))};S8.propTypes={label(t){if(t.label&&typeof t.label=="string"&&!t.label.trim()){const e=`Invalid prop \`label\` supplied to \`${w8}\`. Expected non-empty \`string\`.`;return new Error(e)}return null}};const wU="ToastViewport",EU=["F8"],Uy="toast.viewportPause",zy="toast.viewportResume",SU=y.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=EU,label:i="Notifications ({hotkey})",...s}=t,o=d1(wU,r),a=gU(r),l=y.useRef(null),c=y.useRef(null),f=y.useRef(null),u=y.useRef(null),d=Tt(e,u,o.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=o.toastCount>0;y.useEffect(()=>{const x=b=>{var w;n.every(P=>b[P]||b.code===P)&&((w=u.current)===null||w===void 0||w.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]),y.useEffect(()=>{const x=l.current,b=u.current;if(p&&x&&b){const w=()=>{if(!o.isClosePausedRef.current){const I=new CustomEvent(Uy);b.dispatchEvent(I),o.isClosePausedRef.current=!0}},E=()=>{if(o.isClosePausedRef.current){const I=new CustomEvent(zy);b.dispatchEvent(I),o.isClosePausedRef.current=!1}},P=I=>{!x.contains(I.relatedTarget)&&E()},N=()=>{x.contains(document.activeElement)||E()};return x.addEventListener("focusin",w),x.addEventListener("focusout",P),x.addEventListener("pointermove",w),x.addEventListener("pointerleave",N),window.addEventListener("blur",w),window.addEventListener("focus",E),()=>{x.removeEventListener("focusin",w),x.removeEventListener("focusout",P),x.removeEventListener("pointermove",w),x.removeEventListener("pointerleave",N),window.removeEventListener("blur",w),window.removeEventListener("focus",E)}}},[p,o.isClosePausedRef]);const m=y.useCallback(({tabbingDirection:x})=>{const w=a().map(E=>{const P=E.ref.current,N=[P,...BU(P)];return x==="forwards"?N:N.reverse()});return(x==="forwards"?w.reverse():w).flat()},[a]);return y.useEffect(()=>{const x=u.current;if(x){const b=w=>{const E=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!E){const L=document.activeElement,U=w.shiftKey;if(w.target===x&&U){var N;(N=c.current)===null||N===void 0||N.focus();return}const ee=m({tabbingDirection:U?"backwards":"forwards"}),M=ee.findIndex(v=>v===L);if(Mv(ee.slice(M+1)))w.preventDefault();else{var I,j;U?(I=c.current)===null||I===void 0||I.focus():(j=f.current)===null||j===void 0||j.focus()}}};return x.addEventListener("keydown",b),()=>x.removeEventListener("keydown",b)}},[a,m]),y.createElement(CD,{ref:l,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:p?void 0:"none"}},p&&y.createElement(gS,{ref:c,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"forwards"});Mv(x)}}),y.createElement(dx.Slot,{scope:r},y.createElement(Ve.ol,_e({tabIndex:-1},s,{ref:d}))),p&&y.createElement(gS,{ref:f,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"backwards"});Mv(x)}}))}),kU="ToastFocusProxy",gS=y.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...i}=t,s=d1(kU,r);return y.createElement(cx,_e({"aria-hidden":!0,tabIndex:0},i,{ref:e,style:{position:"fixed"},onFocus:o=>{var a;const l=o.relatedTarget;!((a=s.viewport)!==null&&a!==void 0&&a.contains(l))&&n()}}))}),h1="Toast",AU="toast.swipeStart",CU="toast.swipeMove",_U="toast.swipeCancel",TU="toast.swipeEnd",PU=y.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:i,onOpenChange:s,...o}=t,[a=!0,l]=Ks({prop:n,defaultProp:i,onChange:s});return y.createElement(no,{present:r||a},y.createElement(k8,_e({open:a},o,{ref:e,onClose:()=>l(!1),onPause:Pn(t.onPause),onResume:Pn(t.onResume),onSwipeStart:Ce(t.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ce(t.onSwipeMove,c=>{const{x:f,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:Ce(t.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ce(t.onSwipeEnd,c=>{const{x:f,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})))}),[RU,IU]=E8(h1,{onClose(){}}),k8=y.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:i,open:s,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:d,onSwipeEnd:h,...p}=t,m=d1(h1,r),[x,b]=y.useState(null),w=Tt(e,v=>b(v)),E=y.useRef(null),P=y.useRef(null),N=i||m.duration,I=y.useRef(0),j=y.useRef(N),L=y.useRef(0),{onToastAdd:U,onToastRemove:K}=m,X=Pn(()=>{var v;(x==null?void 0:x.contains(document.activeElement))&&((v=m.viewport)===null||v===void 0||v.focus()),o()}),ee=y.useCallback(v=>{!v||v===1/0||(window.clearTimeout(L.current),I.current=new Date().getTime(),L.current=window.setTimeout(X,v))},[X]);y.useEffect(()=>{const v=m.viewport;if(v){const _=()=>{ee(j.current),c==null||c()},k=()=>{const A=new Date().getTime()-I.current;j.current=j.current-A,window.clearTimeout(L.current),l==null||l()};return v.addEventListener(Uy,k),v.addEventListener(zy,_),()=>{v.removeEventListener(Uy,k),v.removeEventListener(zy,_)}}},[m.viewport,N,l,c,ee]),y.useEffect(()=>{s&&!m.isClosePausedRef.current&&ee(N)},[s,N,m.isClosePausedRef,ee]),y.useEffect(()=>(U(),()=>K()),[U,K]);const M=y.useMemo(()=>x?_8(x):null,[x]);return m.viewport?y.createElement(y.Fragment,null,M&&y.createElement(OU,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0},M),y.createElement(RU,{scope:r,onClose:X},ro.createPortal(y.createElement(dx.ItemSlot,{scope:r},y.createElement(AD,{asChild:!0,onEscapeKeyDown:Ce(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||X(),m.isFocusedToastEscapeKeyDownRef.current=!1})},y.createElement(Ve.li,_e({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":m.swipeDirection},p,{ref:w,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ce(t.onKeyDown,v=>{v.key==="Escape"&&(a==null||a(v.nativeEvent),v.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,X()))}),onPointerDown:Ce(t.onPointerDown,v=>{v.button===0&&(E.current={x:v.clientX,y:v.clientY})}),onPointerMove:Ce(t.onPointerMove,v=>{if(!E.current)return;const _=v.clientX-E.current.x,k=v.clientY-E.current.y,A=!!P.current,T=["left","right"].includes(m.swipeDirection),O=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,D=T?O(0,_):0,S=T?0:O(0,k),g=v.pointerType==="touch"?10:2,R={x:D,y:S},F={originalEvent:v,delta:R};A?(P.current=R,wd(CU,u,F,{discrete:!1})):xS(R,m.swipeDirection,g)?(P.current=R,wd(AU,f,F,{discrete:!1}),v.target.setPointerCapture(v.pointerId)):(Math.abs(_)>g||Math.abs(k)>g)&&(E.current=null)}),onPointerUp:Ce(t.onPointerUp,v=>{const _=P.current,k=v.target;if(k.hasPointerCapture(v.pointerId)&&k.releasePointerCapture(v.pointerId),P.current=null,E.current=null,_){const A=v.currentTarget,T={originalEvent:v,delta:_};xS(_,m.swipeDirection,m.swipeThreshold)?wd(TU,h,T,{discrete:!0}):wd(_U,d,T,{discrete:!0}),A.addEventListener("click",O=>O.preventDefault(),{once:!0})}})})))),m.viewport))):null});k8.propTypes={type(t){if(t.type&&!["foreground","background"].includes(t.type)){const e=`Invalid prop \`type\` supplied to \`${h1}\`. Expected \`foreground | background\`.`;return new Error(e)}return null}};const OU=t=>{const{__scopeToast:e,children:r,...n}=t,i=d1(h1,e),[s,o]=y.useState(!1),[a,l]=y.useState(!1);return jU(()=>o(!0)),y.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:y.createElement(C5,{asChild:!0},y.createElement(cx,n,s&&y.createElement(y.Fragment,null,i.label," ",r)))},MU=y.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return y.createElement(Ve.div,_e({},n,{ref:e}))}),NU=y.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return y.createElement(Ve.div,_e({},n,{ref:e}))}),$U="ToastAction",DU=y.forwardRef((t,e)=>{const{altText:r,...n}=t;return r?y.createElement(C8,{altText:r,asChild:!0},y.createElement(A8,_e({},n,{ref:e}))):null});DU.propTypes={altText(t){return t.altText?null:new Error(`Missing prop \`altText\` expected on \`${$U}\``)}};const LU="ToastClose",A8=y.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,i=IU(LU,r);return y.createElement(C8,{asChild:!0},y.createElement(Ve.button,_e({type:"button"},n,{ref:e,onClick:Ce(t.onClick,i.onClose)})))}),C8=y.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...i}=t;return y.createElement(Ve.div,_e({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0},i,{ref:e}))});function _8(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),FU(n)){const i=n.ariaHidden||n.hidden||n.style.display==="none",s=n.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const o=n.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(..._8(n))}}),e}function wd(t,e,r,{discrete:n}){const i=r.originalEvent.currentTarget,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?Wg(i,s):i.dispatchEvent(s)}const xS=(t,e,r=0)=>{const n=Math.abs(t.x),i=Math.abs(t.y),s=n>i;return e==="left"||e==="right"?s&&n>r:!s&&i>r};function jU(t=()=>{}){const e=Pn(t);Kn(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function FU(t){return t.nodeType===t.ELEMENT_NODE}function BU(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Mv(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}const UU=S8,zU=SU,VU=PU,qU=MU,HU=NU,WU=A8;var GU="_6wut8v1 _6wut8v0 fyvr12wp fyvr12wj fyvr11hs fyvr1qo fyvr1mo fyvr128 fyvr118g fyvr11i4 fyvr11h0",KU=fr({defaultClassName:"_6wut8v3",variantClassNames:{variant:{normal:"_6wut8v4",success:"_6wut8v5",error:"_6wut8v6"}},defaultVariants:{},compoundVariants:[]});const T8=y.createContext(null),YU=t=>{const{children:e,...r}=t,[n,i]=y.useState(new Set);return Y.jsxs(UU,{...r,children:[Y.jsxs(T8.Provider,{value:i,children:[e,Y.jsx(Hg,{children:Array.from(n).map(s=>Y.jsx(JU,{...s},s.id))})]}),Y.jsx(QU,{})]})},QU=()=>Y.jsx(zU,{className:GU}),JU=t=>{const{id:e,variant:r,title:n,description:i,icon:s,isDismissible:o=!0,...a}=t,l=()=>{if(s)return Y.jsx(s,{});switch(r){case"success":return Y.jsx(G,{background:"positive",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:Y.jsx(Gg,{})});case"error":return Y.jsx(G,{background:"negative",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:Y.jsx(eu,{})});default:return null}};return Y.jsx(VU,{className:KU({variant:r}),open:!0,forceMount:!0,asChild:!0,...a,children:Y.jsxs(T$,{as:Ta.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:[Y.jsxs(G,{gap:"3",alignItems:"center",children:[l(),Y.jsxs(G,{flexDirection:"column",gap:"1",children:[n&&Y.jsx(qU,{children:Y.jsx(me,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:n})}),Y.jsx(HU,{children:Y.jsx(me,{as:"div",variant:"normal",fontWeight:"medium",color:"text50",children:i})})]})]}),o&&Y.jsx(WU,{"aria-label":"Close",asChild:!0,children:Y.jsx(o1,{icon:eu,size:"xs"})})]})})},P8=()=>{const t=y.useContext(T8);return e=>{const r={...e,id:Math.random().toString(36).slice(2,12),onOpenChange:n=>{n||t(i=>(i.delete(r),new Set([...i])))}};t(n=>new Set([...n,r]))}};var XU="_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",ZU="_15pztn2";y.forwardRef((t,e)=>{const{as:r="textarea",autoComplete:n="off",borderRadius:i="md",description:s,disabled:o=!1,id:a,label:l="",labelLocation:c="hidden",name:f,rows:u,resize:d=!1,...h}=t;return Y.jsx(Xa,{description:s,disabled:o,display:"grid",id:a??f,label:l,labelLocation:c,children:Y.jsx(G,{as:r,autoComplete:n,spellCheck:"false",className:In(XU,d&&ZU),disabled:o,id:a??f,name:f,ref:e,rows:u,borderRadius:i,...h})})});var ez=fr({defaultClassName:"bnrreb5 bnrreb0 fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11h0",variantClassNames:{size:{xs:"bnrreb6",sm:"bnrreb7",md:"bnrreb8",lg:"bnrreb9",xl:"bnrreba"},borderRadius:{circle:"bnrrebb bnrreb1 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co",lg:"bnrrebc bnrreb2 fyvr11d8 fyvr11dw fyvr11bw fyvr11ck",md:"bnrrebd bnrreb3 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg",sm:"bnrrebe bnrreb4 fyvr11d0 fyvr11do fyvr11bo fyvr11cc"}},defaultVariants:{},compoundVariants:[]}),tz="bnrrebf",rz="bnrrebh bnrrebg fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11sj fyvr128 fyvr15o fyvr11h0";const nz=y.memo(t=>{const{borderRadius:e="circle",className:r,disableAnimation:n=!1,style:i,src:s,symbol:o,size:a="md",...l}=t;return Y.jsx(G,{className:In(r,ez({borderRadius:e,size:a})),style:i,flexShrink:"0",...l,children:s?Y.jsx(iF,{className:tz,disableAnimation:n,src:s}):Y.jsx(me,{className:rz,variant:"normal",fontWeight:"medium",color:"text50",uppercase:!0,children:o==null?void 0:o.replace(/\s/,"").slice(0,4)})})}),[v1,$se]=cn("Tooltip",[wc]);wc();const iz="TooltipProvider";v1(iz);const R8="Tooltip";v1(R8);const sz="TooltipPortal";v1(sz,{forceMount:void 0});v1(R8,{isInside:!1});/** +Defaulting to \`null\`.`}const a8="Radio",[QF,l8]=cn(a8),[JF,XF]=QF(a8),ZF=y.forwardRef((t,e)=>{const{__scopeRadio:r,name:n,checked:i=!1,required:s,disabled:o,value:a="on",onCheck:l,...c}=t,[f,u]=y.useState(null),d=Tt(e,m=>u(m)),h=y.useRef(!1),p=f?!!f.closest("form"):!0;return y.createElement(JF,{scope:r,checked:i,disabled:o},y.createElement(Ve.button,Wt({type:"button",role:"radio","aria-checked":i,"data-state":c8(i),"data-disabled":o?"":void 0,disabled:o,value:a},c,{ref:d,onClick:Ce(t.onClick,m=>{i||l==null||l(),p&&(h.current=m.isPropagationStopped(),h.current||m.stopPropagation())})})),p&&y.createElement(rB,{control:f,bubbles:!h.current,name:n,value:a,checked:i,required:s,disabled:o,style:{transform:"translateX(-100%)"}}))}),eB="RadioIndicator",tB=y.forwardRef((t,e)=>{const{__scopeRadio:r,forceMount:n,...i}=t,s=XF(eB,r);return y.createElement(no,{present:n||s.checked},y.createElement(Ve.span,Wt({"data-state":c8(s.checked),"data-disabled":s.disabled?"":void 0},i,{ref:e})))}),rB=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=y.useRef(null),o=X0(r),a=Z0(e);return y.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==r&&u){const d=new Event("click",{bubbles:n});u.call(l,r),l.dispatchEvent(d)}},[o,r,n]),y.createElement("input",Wt({type:"radio","aria-hidden":!0,defaultChecked:r},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function c8(t){return t?"checked":"unchecked"}const nB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],f8="RadioGroup",[iB,Pse]=cn(f8,[Ec,l8]),u8=Ec(),d8=l8(),[sB,oB]=iB(f8),aB=y.forwardRef((t,e)=>{const{__scopeRadioGroup:r,name:n,defaultValue:i,value:s,required:o=!1,disabled:a=!1,orientation:l,dir:c,loop:f=!0,onValueChange:u,...d}=t,h=u8(r),p=Qg(c),[m,x]=Ks({prop:s,defaultProp:i,onChange:u});return y.createElement(sB,{scope:r,name:n,required:o,disabled:a,value:m,onValueChange:x},y.createElement(BL,Wt({asChild:!0},h,{orientation:l,dir:p,loop:f}),y.createElement(Ve.div,Wt({role:"radiogroup","aria-required":o,"aria-orientation":l,"data-disabled":a?"":void 0,dir:p},d,{ref:e}))))}),lB="RadioGroupItem",cB=y.forwardRef((t,e)=>{const{__scopeRadioGroup:r,disabled:n,...i}=t,s=oB(lB,r),o=s.disabled||n,a=u8(r),l=d8(r),c=y.useRef(null),f=Tt(e,c),u=s.value===i.value,d=y.useRef(!1);return y.useEffect(()=>{const h=m=>{nB.includes(m.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)}},[]),y.createElement(P5,Wt({asChild:!0},a,{focusable:!o,active:u}),y.createElement(ZF,Wt({disabled:o,required:s.required,checked:u},l,i,{name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:Ce(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Ce(i.onFocus,()=>{var h;d.current&&((h=c.current)===null||h===void 0||h.click())})})))}),fB=y.forwardRef((t,e)=>{const{__scopeRadioGroup:r,...n}=t,i=d8(r);return y.createElement(tB,Wt({},i,n,{ref:e}))}),uB=aB,dB=cB,hB=fB;var vB=ur({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:[]}),pB=ur({defaultClassName:"io59uy8 io59uy7 io59uy6 fyvr11h0 fyvr11ko fyvr11jg fyvr11hw fyvr128 fyvr15o fyvr12s1",variantClassNames:{size:{sm:"io59uy9",lg:"io59uya"}},defaultVariants:{},compoundVariants:[]});const yB=t=>{const{id:e,label:r,size:n="sm",value:i,disabled:s}=t;return Y.jsx(G,{alignItems:"center",children:Y.jsx(Xa,{disabled:s,display:"flex",id:e,label:r,labelLocation:"right",children:Y.jsx(dB,{className:vB({size:n}),value:i,id:e,disabled:s,children:Y.jsx(hB,{className:pB({size:n})})})})})};y.forwardRef((t,e)=>{const{flexDirection:r="column",disabled:n=!1,gap:i="2",name:s,options:o,size:a="sm",...l}=t;return Y.jsx(uB,{disabled:n,name:s,ref:e,...l,children:Y.jsx(G,{flexDirection:r,gap:i,children:o.map(({label:c,value:f,disabled:u})=>Y.jsx(yB,{id:`${s}-${f}`,label:c,size:a,value:f,disabled:u},f))})})});function pS(t,[e,r]){return Math.min(r,Math.max(e,t))}const cx=y.forwardRef((t,e)=>y.createElement(Ve.span,_e({},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}}))),mB=[" ","Enter","ArrowUp","ArrowDown"],gB=[" ","Enter"],l1="Select",[c1,fx,xB]=t1(l1),[Sc,Rse]=cn(l1,[xB,wc]),ux=wc(),[bB,el]=Sc(l1),[wB,EB]=Sc(l1),SB=t=>{const{__scopeSelect:e,children:r,open:n,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:f,autoComplete:u,disabled:d,required:h}=t,p=ux(e),[m,x]=y.useState(null),[b,w]=y.useState(null),[E,P]=y.useState(!1),N=Qg(c),[I=!1,j]=Ks({prop:n,defaultProp:i,onChange:s}),[L,U]=Ks({prop:o,defaultProp:a,onChange:l}),K=y.useRef(null),X=m?!!m.closest("form"):!0,[ee,M]=y.useState(new Set),v=Array.from(ee).map(_=>_.props.value).join(";");return y.createElement(kL,p,y.createElement(bB,{required:h,scope:e,trigger:m,onTriggerChange:x,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:E,onValueNodeHasChildrenChange:P,contentId:jo(),value:L,onValueChange:U,open:I,onOpenChange:j,dir:N,triggerPointerDownPosRef:K,disabled:d},y.createElement(c1.Provider,{scope:e},y.createElement(wB,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(_=>{M(k=>new Set(k).add(_))},[]),onNativeOptionRemove:y.useCallback(_=>{M(k=>{const A=new Set(k);return A.delete(_),A})},[])},r)),X?y.createElement(p8,{key:v,"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:u,value:L,onChange:_=>U(_.target.value),disabled:d},L===void 0?y.createElement("option",{value:""}):null,Array.from(ee)):null))},kB="SelectTrigger",AB=y.forwardRef((t,e)=>{const{__scopeSelect:r,disabled:n=!1,...i}=t,s=ux(r),o=el(kB,r),a=o.disabled||n,l=Tt(e,o.onTriggerChange),c=fx(r),[f,u,d]=y8(p=>{const m=c().filter(w=>!w.disabled),x=m.find(w=>w.value===o.value),b=m8(m,p,x);b!==void 0&&o.onValueChange(b.value)}),h=()=>{a||(o.onOpenChange(!0),d())};return y.createElement(AL,_e({asChild:!0},s),y.createElement(Ve.button,_e({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":v8(o.value)?"":void 0},i,{ref:l,onClick:Ce(i.onClick,p=>{p.currentTarget.focus()}),onPointerDown:Ce(i.onPointerDown,p=>{const m=p.target;m.hasPointerCapture(p.pointerId)&&m.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(i.onKeyDown,p=>{const m=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&u(p.key),!(m&&p.key===" ")&&mB.includes(p.key)&&(h(),p.preventDefault())})})))}),CB="SelectValue",_B=y.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,children:s,placeholder:o="",...a}=t,l=el(CB,r),{onValueNodeHasChildrenChange:c}=l,f=s!==void 0,u=Tt(e,l.onValueNodeChange);return Kn(()=>{c(f)},[c,f]),y.createElement(Ve.span,_e({},a,{ref:u,style:{pointerEvents:"none"}}),v8(l.value)?y.createElement(y.Fragment,null,o):s)}),TB=y.forwardRef((t,e)=>{const{__scopeSelect:r,children:n,...i}=t;return y.createElement(Ve.span,_e({"aria-hidden":!0},i,{ref:e}),n||"▼")}),oc="SelectContent",PB=y.forwardRef((t,e)=>{const r=el(oc,t.__scopeSelect),[n,i]=y.useState();if(Kn(()=>{i(new DocumentFragment)},[]),!r.open){const s=n;return s?ro.createPortal(y.createElement(h8,{scope:t.__scopeSelect},y.createElement(c1.Slot,{scope:t.__scopeSelect},y.createElement("div",null,t.children))),s):null}return y.createElement(RB,_e({},t,{ref:e}))}),_s=10,[h8,f1]=Sc(oc),RB=y.forwardRef((t,e)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:u,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:x,...b}=t,w=el(oc,r),[E,P]=y.useState(null),[N,I]=y.useState(null),j=Tt(e,V=>P(V)),[L,U]=y.useState(null),[K,X]=y.useState(null),ee=fx(r),[M,v]=y.useState(!1),_=y.useRef(!1);y.useEffect(()=>{if(E)return I5(E)},[E]),c5();const k=y.useCallback(V=>{const[H,...Z]=ee().map(te=>te.ref.current),[le]=Z.slice(-1),ne=document.activeElement;for(const te of V)if(te===ne||(te==null||te.scrollIntoView({block:"nearest"}),te===H&&N&&(N.scrollTop=0),te===le&&N&&(N.scrollTop=N.scrollHeight),te==null||te.focus(),document.activeElement!==ne))return},[ee,N]),A=y.useCallback(()=>k([L,E]),[k,L,E]);y.useEffect(()=>{M&&A()},[M,A]);const{onOpenChange:T,triggerPointerDownPosRef:O}=w;y.useEffect(()=>{if(E){let V={x:0,y:0};const H=le=>{var ne,te,Me,pe;V={x:Math.abs(Math.round(le.pageX)-((ne=(te=O.current)===null||te===void 0?void 0:te.x)!==null&&ne!==void 0?ne:0)),y:Math.abs(Math.round(le.pageY)-((Me=(pe=O.current)===null||pe===void 0?void 0:pe.y)!==null&&Me!==void 0?Me:0))}},Z=le=>{V.x<=10&&V.y<=10?le.preventDefault():E.contains(le.target)||T(!1),document.removeEventListener("pointermove",H),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",Z,{capture:!0})}}},[E,T,O]),y.useEffect(()=>{const V=()=>T(!1);return window.addEventListener("blur",V),window.addEventListener("resize",V),()=>{window.removeEventListener("blur",V),window.removeEventListener("resize",V)}},[T]);const[D,S]=y8(V=>{const H=ee().filter(ne=>!ne.disabled),Z=H.find(ne=>ne.ref.current===document.activeElement),le=m8(H,V,Z);le&&setTimeout(()=>le.ref.current.focus())}),g=y.useCallback((V,H,Z)=>{const le=!_.current&&!Z;(w.value!==void 0&&w.value===H||le)&&(U(V),le&&(_.current=!0))},[w.value]),R=y.useCallback(()=>E==null?void 0:E.focus(),[E]),F=y.useCallback((V,H,Z)=>{const le=!_.current&&!Z;(w.value!==void 0&&w.value===H||le)&&X(V)},[w.value]),C=n==="popper"?yS:IB,B=C===yS?{side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:u,collisionBoundary:d,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:x}:{};return y.createElement(h8,{scope:r,content:E,viewport:N,onViewportChange:I,itemRefCallback:g,selectedItem:L,onItemLeave:R,itemTextRefCallback:F,focusSelectedItem:A,selectedItemText:K,position:n,isPositioned:M,searchRef:D},y.createElement(sx,{as:ic,allowPinchZoom:!0},y.createElement(f5,{asChild:!0,trapped:w.open,onMountAutoFocus:V=>{V.preventDefault()},onUnmountAutoFocus:Ce(i,V=>{var H;(H=w.trigger)===null||H===void 0||H.focus({preventScroll:!0}),V.preventDefault()})},y.createElement(Jg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:V=>V.preventDefault(),onDismiss:()=>w.onOpenChange(!1)},y.createElement(C,_e({role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:V=>V.preventDefault()},b,B,{onPlaced:()=>v(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ce(b.onKeyDown,V=>{const H=V.ctrlKey||V.altKey||V.metaKey;if(V.key==="Tab"&&V.preventDefault(),!H&&V.key.length===1&&S(V.key),["ArrowUp","ArrowDown","Home","End"].includes(V.key)){let le=ee().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);if(["ArrowUp","End"].includes(V.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(V.key)){const ne=V.target,te=le.indexOf(ne);le=le.slice(te+1)}setTimeout(()=>k(le)),V.preventDefault()}})}))))))}),IB=y.forwardRef((t,e)=>{const{__scopeSelect:r,onPlaced:n,...i}=t,s=el(oc,r),o=f1(oc,r),[a,l]=y.useState(null),[c,f]=y.useState(null),u=Tt(e,j=>f(j)),d=fx(r),h=y.useRef(!1),p=y.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=o,E=y.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&m&&x&&b){const j=s.trigger.getBoundingClientRect(),L=c.getBoundingClientRect(),U=s.valueNode.getBoundingClientRect(),K=b.getBoundingClientRect();if(s.dir!=="rtl"){const ne=K.left-L.left,te=U.left-ne,Me=j.left-te,pe=j.width+Me,ke=Math.max(pe,L.width),sr=window.innerWidth-_s,Ze=pS(te,[_s,sr-ke]);a.style.minWidth=pe+"px",a.style.left=Ze+"px"}else{const ne=L.right-K.right,te=window.innerWidth-U.right-ne,Me=window.innerWidth-j.right-te,pe=j.width+Me,ke=Math.max(pe,L.width),sr=window.innerWidth-_s,Ze=pS(te,[_s,sr-ke]);a.style.minWidth=pe+"px",a.style.right=Ze+"px"}const X=d(),ee=window.innerHeight-_s*2,M=m.scrollHeight,v=window.getComputedStyle(c),_=parseInt(v.borderTopWidth,10),k=parseInt(v.paddingTop,10),A=parseInt(v.borderBottomWidth,10),T=parseInt(v.paddingBottom,10),O=_+k+M+T+A,D=Math.min(x.offsetHeight*5,O),S=window.getComputedStyle(m),g=parseInt(S.paddingTop,10),R=parseInt(S.paddingBottom,10),F=j.top+j.height/2-_s,C=ee-F,B=x.offsetHeight/2,V=x.offsetTop+B,H=_+k+V,Z=O-H;if(H<=F){const ne=x===X[X.length-1].ref.current;a.style.bottom="0px";const te=c.clientHeight-m.offsetTop-m.offsetHeight,Me=Math.max(C,B+(ne?R:0)+te+A),pe=H+Me;a.style.height=pe+"px"}else{const ne=x===X[0].ref.current;a.style.top="0px";const Me=Math.max(F,_+m.offsetTop+(ne?g:0)+B)+Z;a.style.height=Me+"px",m.scrollTop=H-F+m.offsetTop}a.style.margin=`${_s}px 0`,a.style.minHeight=D+"px",a.style.maxHeight=ee+"px",n==null||n(),requestAnimationFrame(()=>h.current=!0)}},[d,s.trigger,s.valueNode,a,c,m,x,b,s.dir,n]);Kn(()=>E(),[E]);const[P,N]=y.useState();Kn(()=>{c&&N(window.getComputedStyle(c).zIndex)},[c]);const I=y.useCallback(j=>{j&&p.current===!0&&(E(),w==null||w(),p.current=!1)},[E,w]);return y.createElement(OB,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:I},y.createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P}},y.createElement(Ve.div,_e({},i,{ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}}))))}),yS=y.forwardRef((t,e)=>{const{__scopeSelect:r,align:n="start",collisionPadding:i=_s,...s}=t,o=ux(r);return y.createElement(CL,_e({},o,s,{ref:e,align:n,collisionPadding:i,style:{boxSizing:"border-box",...s.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)"}}))}),[OB,MB]=Sc(oc,{}),mS="SelectViewport",NB=y.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=f1(mS,r),s=MB(mS,r),o=Tt(e,i.onViewportChange),a=y.useRef(0);return y.createElement(y.Fragment,null,y.createElement("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}"}}),y.createElement(c1.Slot,{scope:r},y.createElement(Ve.div,_e({"data-radix-select-viewport":"",role:"presentation"},n,{ref:o,style:{position:"relative",flex:1,overflow:"auto",...n.style},onScroll:Ce(n.onScroll,l=>{const c=l.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:u}=s;if(u!=null&&u.current&&f){const d=Math.abs(a.current-c.scrollTop);if(d>0){const h=window.innerHeight-_s*2,p=parseFloat(f.style.minHeight),m=parseFloat(f.style.height),x=Math.max(p,m);if(x0?E:0,f.style.justifyContent="flex-end")}}}a.current=c.scrollTop})}))))}),$B="SelectGroup",[DB,Ise]=Sc($B),LB=y.forwardRef((t,e)=>{const{__scopeSelect:r,...n}=t,i=jo();return y.createElement(DB,{scope:r,id:i},y.createElement(Ve.div,_e({role:"group","aria-labelledby":i},n,{ref:e})))}),By="SelectItem",[jB,FB]=Sc(By),BB=y.forwardRef((t,e)=>{const{__scopeSelect:r,value:n,disabled:i=!1,textValue:s,...o}=t,a=el(By,r),l=f1(By,r),c=a.value===n,[f,u]=y.useState(s??""),[d,h]=y.useState(!1),p=Tt(e,b=>{var w;return(w=l.itemRefCallback)===null||w===void 0?void 0:w.call(l,b,n,i)}),m=jo(),x=()=>{i||(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 y.createElement(jB,{scope:r,value:n,disabled:i,textId:m,isSelected:c,onItemTextChange:y.useCallback(b=>{u(w=>{var E;return w||((E=b==null?void 0:b.textContent)!==null&&E!==void 0?E:"").trim()})},[])},y.createElement(c1.ItemSlot,{scope:r,value:n,disabled:i,textValue:f},y.createElement(Ve.div,_e({role:"option","aria-labelledby":m,"data-highlighted":d?"":void 0,"aria-selected":c&&d,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1},o,{ref:p,onFocus:Ce(o.onFocus,()=>h(!0)),onBlur:Ce(o.onBlur,()=>h(!1)),onPointerUp:Ce(o.onPointerUp,x),onPointerMove:Ce(o.onPointerMove,b=>{if(i){var w;(w=l.onItemLeave)===null||w===void 0||w.call(l)}else b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ce(o.onPointerLeave,b=>{if(b.currentTarget===document.activeElement){var w;(w=l.onItemLeave)===null||w===void 0||w.call(l)}}),onKeyDown:Ce(o.onKeyDown,b=>{var w;((w=l.searchRef)===null||w===void 0?void 0:w.current)!==""&&b.key===" "||(gB.includes(b.key)&&x(),b.key===" "&&b.preventDefault())})}))))}),bd="SelectItemText",UB=y.forwardRef((t,e)=>{const{__scopeSelect:r,className:n,style:i,...s}=t,o=el(bd,r),a=f1(bd,r),l=FB(bd,r),c=EB(bd,r),[f,u]=y.useState(null),d=Tt(e,b=>u(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)===null||w===void 0?void 0:w.call(a,b,l.value,l.disabled)}),h=f==null?void 0:f.textContent,p=y.useMemo(()=>y.createElement("option",{key:l.value,value:l.value,disabled:l.disabled},h),[l.disabled,l.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=c;return Kn(()=>(m(p),()=>x(p)),[m,x,p]),y.createElement(y.Fragment,null,y.createElement(Ve.span,_e({id:l.textId},s,{ref:d})),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ro.createPortal(s.children,o.valueNode):null)});function v8(t){return t===""||t===void 0}const p8=y.forwardRef((t,e)=>{const{value:r,...n}=t,i=y.useRef(null),s=Tt(e,i),o=X0(r);return y.useEffect(()=>{const a=i.current,l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==r&&f){const u=new Event("change",{bubbles:!0});f.call(a,r),a.dispatchEvent(u)}},[o,r]),y.createElement(cx,{asChild:!0},y.createElement("select",_e({},n,{ref:s,defaultValue:r})))});p8.displayName="BubbleSelect";function y8(t){const e=Pn(t),r=y.useRef(""),n=y.useRef(0),i=y.useCallback(o=>{const a=r.current+o;e(a),function l(c){r.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=y.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,i,s]}function m8(t,e,r){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=r?t.indexOf(r):-1;let o=zB(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==r));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}function zB(t,e){return t.map((r,n)=>t[(e+n)%t.length])}const VB=SB,qB=AB,HB=_B,WB=TB,GB=PB,KB=NB,YB=LB,QB=BB,JB=UB;var XB="gohwum1 _1qxj1ib9 _1qxj1ibe _1qxj1ib4 fyvr11mv fyvr11eg fyvr11g0 fyvr11fs fyvr11f0 gohwum0 fyvr1t4 fyvr1v0 fyvr1ww fyvr1ys fyvr11ko fyvr11od fyvr11hc fyvr11f4 fyvr12s1 fyvr118c fyvr11jw fyvr11n4 fyvr12v7 fyvr12o1",ZB=ur({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:[]}),eU="gohwuma gohwum9 fyvr11d0 fyvr11do fyvr11bo fyvr11cc fyvr11ls fyvr11m8 fyvr11ms fyvr11tv fyvr12s1 fyvr11nl",tU="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 rU=y.forwardRef(({children:t,className:e,...r},n)=>Y.jsx(QB,{className:In(tU,e),...r,ref:n,children:Y.jsx(JB,{children:t})})),u1=y.forwardRef((t,e)=>{const{borderRadius:r="md",disabled:n=!1,id:i,label:s="",description:o,labelLocation:a="hidden",name:l,options:c,placeholder:f,...u}=t;return Y.jsx(Xa,{disabled:n,display:"grid",id:i??l,label:s,labelLocation:a,description:o,whiteSpace:"nowrap",children:Y.jsxs(VB,{disabled:n,name:l,...u,children:[Y.jsxs(qB,{id:i??l,className:In(XB,ZB({borderRadius:r})),ref:e,children:[Y.jsx(HB,{placeholder:f}),Y.jsx(G,{as:WB,display:"inline-flex",children:Y.jsx(n5,{})})]}),Y.jsx(GB,{className:eU,children:Y.jsx(KB,{children:Y.jsx(YB,{children:c.map(({value:d,label:h,...p})=>Y.jsx(rU,{value:d,...p,children:h},d))})})})]})})});y.forwardRef((t,e)=>{const{controls:r,onChange:n,placeholder:i="Search",name:s="search",value:o,...a}=t,l=o?Y.jsx(o1,{icon:eu,size:"xs",onClick:()=>n==null?void 0:n({target:{value:""}})}):void 0;return Y.jsx(Ir,{ref:e,name:s,leftIcon:X$,controls:r||l,placeholder:i,value:o,onChange:c=>n==null?void 0:n(c),...a})});var nU=ur({defaultClassName:"en4abt1",variantClassNames:{size:{sm:"en4abt2",md:"en4abt3",lg:"en4abt4"}},defaultVariants:{},compoundVariants:[]});const _n=y.forwardRef((t,e)=>{const{size:r="md",...n}=t;return Y.jsx(G,{className:nU({size:r}),color:"text50",ref:e,...n,children:Y.jsxs("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",children:[Y.jsx("circle",{cx:"12",cy:"12",fill:"none",r:"10.5",strokeDasharray:"42",strokeLinecap:"round"}),Y.jsx("circle",{cx:"12",cy:"12",fill:"none",opacity:"0.25",r:"10.5",strokeLinecap:"round"})]})})});y.forwardRef(({children:t},e)=>Y.jsx(G,{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}));const g8="Switch",[iU,Ose]=cn(g8),[sU,oU]=iU(g8),aU=y.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,...f}=t,[u,d]=y.useState(null),h=Tt(e,w=>d(w)),p=y.useRef(!1),m=u?!!u.closest("form"):!0,[x=!1,b]=Ks({prop:i,defaultProp:s,onChange:c});return y.createElement(sU,{scope:r,checked:x,disabled:a},y.createElement(Ve.button,Wt({type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":x8(x),"data-disabled":a?"":void 0,disabled:a,value:l},f,{ref:h,onClick:Ce(t.onClick,w=>{b(E=>!E),m&&(p.current=w.isPropagationStopped(),p.current||w.stopPropagation())})})),m&&y.createElement(fU,{control:u,bubbles:!p.current,name:n,value:l,checked:x,required:o,disabled:a,style:{transform:"translateX(-100%)"}}))}),lU="SwitchThumb",cU=y.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,i=oU(lU,r);return y.createElement(Ve.span,Wt({"data-state":x8(i.checked),"data-disabled":i.disabled?"":void 0},n,{ref:e}))}),fU=t=>{const{control:e,checked:r,bubbles:n=!0,...i}=t,s=y.useRef(null),o=X0(r),a=Z0(e);return y.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==r&&u){const d=new Event("click",{bubbles:n});u.call(l,r),l.dispatchEvent(d)}},[o,r,n]),y.createElement("input",Wt({type:"checkbox","aria-hidden":!0,defaultChecked:r},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function x8(t){return t?"checked":"unchecked"}const uU=aU,dU=cU;var hU="_1lp2u8e1 _1lp2u8e0 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr1ss fyvr1uo fyvr1wk fyvr1yg fyvr11t1 fyvr11hw fyvr12v7 fyvr12o1 _4efw240",vU="_1lp2u8e3 _1lp2u8e2 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ho fyvr1ko fyvr1oo fyvr1k fyvr140 fyvr11o1";const pU=t=>{const{disabled:e,label:r,labelLocation:n="left",description:i,id:s,name:o,...a}=t;return Y.jsx(Xa,{disabled:e,display:"flex",id:s??o,label:r,labelLocation:n,description:i,whiteSpace:"nowrap",children:Y.jsx(uU,{className:hU,disabled:e,...a,children:Y.jsx(G,{position:"relative",width:"full",height:"full",children:Y.jsx(dU,{className:vU})})})})};ur({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"]]});const b8="Tabs",[yU,Mse]=cn(b8,[Ec]);Ec();yU(b8);var mU="_1ppqbnx1 _1qxj1ib9 _1qxj1ibg _1qxj1ib6 fyvr11mv fyvr11e8 fyvr11fw fyvr11fs fyvr11fc _1ppqbnx0 fyvr11cw fyvr11dk fyvr11bk fyvr11c8 fyvr1wo fyvr1yk fyvr1ss fyvr1uo fyvr11hc fyvr118c fyvr11n9";y.forwardRef((t,e)=>{const{icon:r,label:n,...i}=t;return Y.jsxs(G,{className:mU,ref:e,background:"buttonGlass",color:"text80",...i,children:[r&&Y.jsx(r,{size:"xs"}),Y.jsx(me,{children:n})]})});const w8="ToastProvider",[dx,gU,xU]=t1("Toast"),[E8,Nse]=cn("Toast",[xU]),[bU,d1]=E8(w8),S8=t=>{const{__scopeToast:e,label:r="Notification",duration:n=5e3,swipeDirection:i="right",swipeThreshold:s=50,children:o}=t,[a,l]=y.useState(null),[c,f]=y.useState(0),u=y.useRef(!1),d=y.useRef(!1);return y.createElement(dx.Provider,{scope:e},y.createElement(bU,{scope:e,label:r,duration:n,swipeDirection:i,swipeThreshold:s,toastCount:c,viewport:a,onViewportChange:l,onToastAdd:y.useCallback(()=>f(h=>h+1),[]),onToastRemove:y.useCallback(()=>f(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:u,isClosePausedRef:d},o))};S8.propTypes={label(t){if(t.label&&typeof t.label=="string"&&!t.label.trim()){const e=`Invalid prop \`label\` supplied to \`${w8}\`. Expected non-empty \`string\`.`;return new Error(e)}return null}};const wU="ToastViewport",EU=["F8"],Uy="toast.viewportPause",zy="toast.viewportResume",SU=y.forwardRef((t,e)=>{const{__scopeToast:r,hotkey:n=EU,label:i="Notifications ({hotkey})",...s}=t,o=d1(wU,r),a=gU(r),l=y.useRef(null),c=y.useRef(null),f=y.useRef(null),u=y.useRef(null),d=Tt(e,u,o.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=o.toastCount>0;y.useEffect(()=>{const x=b=>{var w;n.every(P=>b[P]||b.code===P)&&((w=u.current)===null||w===void 0||w.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]),y.useEffect(()=>{const x=l.current,b=u.current;if(p&&x&&b){const w=()=>{if(!o.isClosePausedRef.current){const I=new CustomEvent(Uy);b.dispatchEvent(I),o.isClosePausedRef.current=!0}},E=()=>{if(o.isClosePausedRef.current){const I=new CustomEvent(zy);b.dispatchEvent(I),o.isClosePausedRef.current=!1}},P=I=>{!x.contains(I.relatedTarget)&&E()},N=()=>{x.contains(document.activeElement)||E()};return x.addEventListener("focusin",w),x.addEventListener("focusout",P),x.addEventListener("pointermove",w),x.addEventListener("pointerleave",N),window.addEventListener("blur",w),window.addEventListener("focus",E),()=>{x.removeEventListener("focusin",w),x.removeEventListener("focusout",P),x.removeEventListener("pointermove",w),x.removeEventListener("pointerleave",N),window.removeEventListener("blur",w),window.removeEventListener("focus",E)}}},[p,o.isClosePausedRef]);const m=y.useCallback(({tabbingDirection:x})=>{const w=a().map(E=>{const P=E.ref.current,N=[P,...BU(P)];return x==="forwards"?N:N.reverse()});return(x==="forwards"?w.reverse():w).flat()},[a]);return y.useEffect(()=>{const x=u.current;if(x){const b=w=>{const E=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!E){const L=document.activeElement,U=w.shiftKey;if(w.target===x&&U){var N;(N=c.current)===null||N===void 0||N.focus();return}const ee=m({tabbingDirection:U?"backwards":"forwards"}),M=ee.findIndex(v=>v===L);if(Mv(ee.slice(M+1)))w.preventDefault();else{var I,j;U?(I=c.current)===null||I===void 0||I.focus():(j=f.current)===null||j===void 0||j.focus()}}};return x.addEventListener("keydown",b),()=>x.removeEventListener("keydown",b)}},[a,m]),y.createElement(CD,{ref:l,role:"region","aria-label":i.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:p?void 0:"none"}},p&&y.createElement(gS,{ref:c,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"forwards"});Mv(x)}}),y.createElement(dx.Slot,{scope:r},y.createElement(Ve.ol,_e({tabIndex:-1},s,{ref:d}))),p&&y.createElement(gS,{ref:f,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"backwards"});Mv(x)}}))}),kU="ToastFocusProxy",gS=y.forwardRef((t,e)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...i}=t,s=d1(kU,r);return y.createElement(cx,_e({"aria-hidden":!0,tabIndex:0},i,{ref:e,style:{position:"fixed"},onFocus:o=>{var a;const l=o.relatedTarget;!((a=s.viewport)!==null&&a!==void 0&&a.contains(l))&&n()}}))}),h1="Toast",AU="toast.swipeStart",CU="toast.swipeMove",_U="toast.swipeCancel",TU="toast.swipeEnd",PU=y.forwardRef((t,e)=>{const{forceMount:r,open:n,defaultOpen:i,onOpenChange:s,...o}=t,[a=!0,l]=Ks({prop:n,defaultProp:i,onChange:s});return y.createElement(no,{present:r||a},y.createElement(k8,_e({open:a},o,{ref:e,onClose:()=>l(!1),onPause:Pn(t.onPause),onResume:Pn(t.onResume),onSwipeStart:Ce(t.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ce(t.onSwipeMove,c=>{const{x:f,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:Ce(t.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ce(t.onSwipeEnd,c=>{const{x:f,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})))}),[RU,IU]=E8(h1,{onClose(){}}),k8=y.forwardRef((t,e)=>{const{__scopeToast:r,type:n="foreground",duration:i,open:s,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:d,onSwipeEnd:h,...p}=t,m=d1(h1,r),[x,b]=y.useState(null),w=Tt(e,v=>b(v)),E=y.useRef(null),P=y.useRef(null),N=i||m.duration,I=y.useRef(0),j=y.useRef(N),L=y.useRef(0),{onToastAdd:U,onToastRemove:K}=m,X=Pn(()=>{var v;(x==null?void 0:x.contains(document.activeElement))&&((v=m.viewport)===null||v===void 0||v.focus()),o()}),ee=y.useCallback(v=>{!v||v===1/0||(window.clearTimeout(L.current),I.current=new Date().getTime(),L.current=window.setTimeout(X,v))},[X]);y.useEffect(()=>{const v=m.viewport;if(v){const _=()=>{ee(j.current),c==null||c()},k=()=>{const A=new Date().getTime()-I.current;j.current=j.current-A,window.clearTimeout(L.current),l==null||l()};return v.addEventListener(Uy,k),v.addEventListener(zy,_),()=>{v.removeEventListener(Uy,k),v.removeEventListener(zy,_)}}},[m.viewport,N,l,c,ee]),y.useEffect(()=>{s&&!m.isClosePausedRef.current&&ee(N)},[s,N,m.isClosePausedRef,ee]),y.useEffect(()=>(U(),()=>K()),[U,K]);const M=y.useMemo(()=>x?_8(x):null,[x]);return m.viewport?y.createElement(y.Fragment,null,M&&y.createElement(OU,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0},M),y.createElement(RU,{scope:r,onClose:X},ro.createPortal(y.createElement(dx.ItemSlot,{scope:r},y.createElement(AD,{asChild:!0,onEscapeKeyDown:Ce(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||X(),m.isFocusedToastEscapeKeyDownRef.current=!1})},y.createElement(Ve.li,_e({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":m.swipeDirection},p,{ref:w,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ce(t.onKeyDown,v=>{v.key==="Escape"&&(a==null||a(v.nativeEvent),v.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,X()))}),onPointerDown:Ce(t.onPointerDown,v=>{v.button===0&&(E.current={x:v.clientX,y:v.clientY})}),onPointerMove:Ce(t.onPointerMove,v=>{if(!E.current)return;const _=v.clientX-E.current.x,k=v.clientY-E.current.y,A=!!P.current,T=["left","right"].includes(m.swipeDirection),O=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,D=T?O(0,_):0,S=T?0:O(0,k),g=v.pointerType==="touch"?10:2,R={x:D,y:S},F={originalEvent:v,delta:R};A?(P.current=R,wd(CU,u,F,{discrete:!1})):xS(R,m.swipeDirection,g)?(P.current=R,wd(AU,f,F,{discrete:!1}),v.target.setPointerCapture(v.pointerId)):(Math.abs(_)>g||Math.abs(k)>g)&&(E.current=null)}),onPointerUp:Ce(t.onPointerUp,v=>{const _=P.current,k=v.target;if(k.hasPointerCapture(v.pointerId)&&k.releasePointerCapture(v.pointerId),P.current=null,E.current=null,_){const A=v.currentTarget,T={originalEvent:v,delta:_};xS(_,m.swipeDirection,m.swipeThreshold)?wd(TU,h,T,{discrete:!0}):wd(_U,d,T,{discrete:!0}),A.addEventListener("click",O=>O.preventDefault(),{once:!0})}})})))),m.viewport))):null});k8.propTypes={type(t){if(t.type&&!["foreground","background"].includes(t.type)){const e=`Invalid prop \`type\` supplied to \`${h1}\`. Expected \`foreground | background\`.`;return new Error(e)}return null}};const OU=t=>{const{__scopeToast:e,children:r,...n}=t,i=d1(h1,e),[s,o]=y.useState(!1),[a,l]=y.useState(!1);return jU(()=>o(!0)),y.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:y.createElement(C5,{asChild:!0},y.createElement(cx,n,s&&y.createElement(y.Fragment,null,i.label," ",r)))},MU=y.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return y.createElement(Ve.div,_e({},n,{ref:e}))}),NU=y.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t;return y.createElement(Ve.div,_e({},n,{ref:e}))}),$U="ToastAction",DU=y.forwardRef((t,e)=>{const{altText:r,...n}=t;return r?y.createElement(C8,{altText:r,asChild:!0},y.createElement(A8,_e({},n,{ref:e}))):null});DU.propTypes={altText(t){return t.altText?null:new Error(`Missing prop \`altText\` expected on \`${$U}\``)}};const LU="ToastClose",A8=y.forwardRef((t,e)=>{const{__scopeToast:r,...n}=t,i=IU(LU,r);return y.createElement(C8,{asChild:!0},y.createElement(Ve.button,_e({type:"button"},n,{ref:e,onClick:Ce(t.onClick,i.onClose)})))}),C8=y.forwardRef((t,e)=>{const{__scopeToast:r,altText:n,...i}=t;return y.createElement(Ve.div,_e({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0},i,{ref:e}))});function _8(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),FU(n)){const i=n.ariaHidden||n.hidden||n.style.display==="none",s=n.dataset.radixToastAnnounceExclude==="";if(!i)if(s){const o=n.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(..._8(n))}}),e}function wd(t,e,r,{discrete:n}){const i=r.originalEvent.currentTarget,s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&i.addEventListener(t,e,{once:!0}),n?Wg(i,s):i.dispatchEvent(s)}const xS=(t,e,r=0)=>{const n=Math.abs(t.x),i=Math.abs(t.y),s=n>i;return e==="left"||e==="right"?s&&n>r:!s&&i>r};function jU(t=()=>{}){const e=Pn(t);Kn(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[e])}function FU(t){return t.nodeType===t.ELEMENT_NODE}function BU(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function Mv(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}const UU=S8,zU=SU,VU=PU,qU=MU,HU=NU,WU=A8;var GU="_6wut8v1 _6wut8v0 fyvr12wp fyvr12wj fyvr11hs fyvr1qo fyvr1mo fyvr128 fyvr118g fyvr11i4 fyvr11h0",KU=ur({defaultClassName:"_6wut8v3",variantClassNames:{variant:{normal:"_6wut8v4",success:"_6wut8v5",error:"_6wut8v6"}},defaultVariants:{},compoundVariants:[]});const T8=y.createContext(null),YU=t=>{const{children:e,...r}=t,[n,i]=y.useState(new Set);return Y.jsxs(UU,{...r,children:[Y.jsxs(T8.Provider,{value:i,children:[e,Y.jsx(Hg,{children:Array.from(n).map(s=>Y.jsx(JU,{...s},s.id))})]}),Y.jsx(QU,{})]})},QU=()=>Y.jsx(zU,{className:GU}),JU=t=>{const{id:e,variant:r,title:n,description:i,icon:s,isDismissible:o=!0,...a}=t,l=()=>{if(s)return Y.jsx(s,{});switch(r){case"success":return Y.jsx(G,{background:"positive",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:Y.jsx(Gg,{})});case"error":return Y.jsx(G,{background:"negative",color:"black",borderRadius:"circle",width:"8",height:"8",placeItems:"center",minWidth:"0",flexShrink:"0",children:Y.jsx(eu,{})});default:return null}};return Y.jsx(VU,{className:KU({variant:r}),open:!0,forceMount:!0,asChild:!0,...a,children:Y.jsxs(T$,{as:Ta.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:[Y.jsxs(G,{gap:"3",alignItems:"center",children:[l(),Y.jsxs(G,{flexDirection:"column",gap:"1",children:[n&&Y.jsx(qU,{children:Y.jsx(me,{as:"div",variant:"normal",fontWeight:"bold",color:"text80",children:n})}),Y.jsx(HU,{children:Y.jsx(me,{as:"div",variant:"normal",fontWeight:"medium",color:"text50",children:i})})]})]}),o&&Y.jsx(WU,{"aria-label":"Close",asChild:!0,children:Y.jsx(o1,{icon:eu,size:"xs"})})]})})},P8=()=>{const t=y.useContext(T8);return e=>{const r={...e,id:Math.random().toString(36).slice(2,12),onOpenChange:n=>{n||t(i=>(i.delete(r),new Set([...i])))}};t(n=>new Set([...n,r]))}};var XU="_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",ZU="_15pztn2";y.forwardRef((t,e)=>{const{as:r="textarea",autoComplete:n="off",borderRadius:i="md",description:s,disabled:o=!1,id:a,label:l="",labelLocation:c="hidden",name:f,rows:u,resize:d=!1,...h}=t;return Y.jsx(Xa,{description:s,disabled:o,display:"grid",id:a??f,label:l,labelLocation:c,children:Y.jsx(G,{as:r,autoComplete:n,spellCheck:"false",className:In(XU,d&&ZU),disabled:o,id:a??f,name:f,ref:e,rows:u,borderRadius:i,...h})})});var ez=ur({defaultClassName:"bnrreb5 bnrreb0 fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11h0",variantClassNames:{size:{xs:"bnrreb6",sm:"bnrreb7",md:"bnrreb8",lg:"bnrreb9",xl:"bnrreba"},borderRadius:{circle:"bnrrebb bnrreb1 fyvr11dc fyvr11e0 fyvr11c0 fyvr11co",lg:"bnrrebc bnrreb2 fyvr11d8 fyvr11dw fyvr11bw fyvr11ck",md:"bnrrebd bnrreb3 fyvr11d4 fyvr11ds fyvr11bs fyvr11cg",sm:"bnrrebe bnrreb4 fyvr11d0 fyvr11do fyvr11bo fyvr11cc"}},defaultVariants:{},compoundVariants:[]}),tz="bnrrebf",rz="bnrrebh bnrrebg fyvr11dc fyvr11e0 fyvr11c0 fyvr11co fyvr11ls fyvr11m8 fyvr11jg fyvr11ko fyvr11sj fyvr128 fyvr15o fyvr11h0";const nz=y.memo(t=>{const{borderRadius:e="circle",className:r,disableAnimation:n=!1,style:i,src:s,symbol:o,size:a="md",...l}=t;return Y.jsx(G,{className:In(r,ez({borderRadius:e,size:a})),style:i,flexShrink:"0",...l,children:s?Y.jsx(iF,{className:tz,disableAnimation:n,src:s}):Y.jsx(me,{className:rz,variant:"normal",fontWeight:"medium",color:"text50",uppercase:!0,children:o==null?void 0:o.replace(/\s/,"").slice(0,4)})})}),[v1,$se]=cn("Tooltip",[wc]);wc();const iz="TooltipProvider";v1(iz);const R8="Tooltip";v1(R8);const sz="TooltipPortal";v1(sz,{forceMount:void 0});v1(R8,{isInside:!1});/** * @remix-run/router v1.19.0 * * Copyright (c) Remix Software Inc. @@ -112,7 +112,7 @@ Defaulting to \`null\`.`}const a8="Radio",[QF,l8]=cn(a8),[JF,XF]=QF(a8),ZF=y.for * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Jt(){return Jt=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Ba(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function az(){return Math.random().toString(36).substr(2,8)}function wS(t,e){return{usr:t.state,key:t.key,idx:e}}function iu(t,e,r,n){return r===void 0&&(r=null),Jt({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?gs(e):e,{state:r,key:e&&e.key||n||az()})}function Du(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function gs(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function lz(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,a=hr.Pop,l=null,c=f();c==null&&(c=0,o.replaceState(Jt({},o.state,{idx:c}),""));function f(){return(o.state||{idx:null}).idx}function u(){a=hr.Pop;let x=f(),b=x==null?null:x-c;c=x,l&&l({action:a,location:m.location,delta:b})}function d(x,b){a=hr.Push;let w=iu(m.location,x,b);r&&r(w,x),c=f()+1;let E=wS(w,c),P=m.createHref(w);try{o.pushState(E,"",P)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(P)}s&&l&&l({action:a,location:m.location,delta:1})}function h(x,b){a=hr.Replace;let w=iu(m.location,x,b);r&&r(w,x),c=f();let E=wS(w,c),P=m.createHref(w);o.replaceState(E,"",P),s&&l&&l({action:a,location:m.location,delta:0})}function p(x){let b=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof x=="string"?x:Du(x);return w=w.replace(/ $/,"%20"),Ge(b,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,b)}let m={get action(){return a},get location(){return t(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(bS,u),l=x,()=>{i.removeEventListener(bS,u),l=null}},createHref(x){return e(i,x)},createURL:p,encodeLocation(x){let b=p(x);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:d,replace:h,go(x){return o.go(x)}};return m}var At;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(At||(At={}));const cz=new Set(["lazy","caseSensitive","path","id","index","children"]);function fz(t){return t.index===!0}function su(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((i,s)=>{let o=[...r,String(s)],a=typeof i.id=="string"?i.id:o.join("-");if(Ge(i.index!==!0||!i.children,"Cannot specify children on an index route"),Ge(!n[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),fz(i)){let l=Jt({},i,e(i),{id:a});return n[a]=l,l}else{let l=Jt({},i,e(i),{id:a,children:void 0});return n[a]=l,i.children&&(l.children=su(i.children,e,o,n)),l}})}function ya(t,e,r){return r===void 0&&(r="/"),rh(t,e,r,!1)}function rh(t,e,r,n){let i=typeof e=="string"?gs(e):e,s=Lu(i.pathname||"/",r);if(s==null)return null;let o=I8(t);dz(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(Ge(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=Ra([n,l.relativePath]),f=r.concat(l);s.children&&s.children.length>0&&(Ge(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),I8(s.children,e,f,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:xz(c,s.index),routesMeta:f})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of O8(s.path))i(s,o,l)}),e}function O8(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=O8(n.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function dz(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:bz(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const hz=/^:[\w-]+$/,vz=3,pz=2,yz=1,mz=10,gz=-2,ES=t=>t==="*";function xz(t,e){let r=t.split("/"),n=r.length;return r.some(ES)&&(n+=gz),e&&(n+=pz),r.filter(i=>!ES(i)).reduce((i,s)=>i+(hz.test(s)?vz:s===""?yz:mz),n)}function bz(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function wz(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,i={},s="/",o=[];for(let a=0;a{let{paramName:d,isOptional:h}=f;if(d==="*"){let m=a[u]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const p=a[u];return h&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function Ez(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Ba(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(n.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function Sz(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ba(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Lu(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function kz(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?gs(t):t;return{pathname:r?r.startsWith("/")?r:Az(r,e):e,search:Pz(n),hash:Rz(i)}}function Az(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Nv(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function M8(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Cz(t,e){let r=M8(t);return e?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function _z(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=gs(t):(i=Jt({},t),Ge(!i.pathname||!i.pathname.includes("?"),Nv("?","pathname","search",i)),Ge(!i.pathname||!i.pathname.includes("#"),Nv("#","pathname","hash",i)),Ge(!i.search||!i.search.includes("#"),Nv("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=r;else{let u=e.length-1;if(!n&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),u-=1;i.pathname=d.join("/")}a=u>=0?e[u]:"/"}let l=kz(i,a),c=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||f)&&(l.pathname+="/"),l}const Ra=t=>t.join("/").replace(/\/\/+/g,"/"),Tz=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Pz=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Rz=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class t0{constructor(e,r,n,i){i===void 0&&(i=!1),this.status=e,this.statusText=r||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function p1(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const N8=["post","put","patch","delete"],Iz=new Set(N8),Oz=["get",...N8],Mz=new Set(Oz),Nz=new Set([301,302,303,307,308]),$z=new Set([307,308]),$v={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Dz={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Wc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},hx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lz=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),$8="remix-router-transitions";function jz(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;Ge(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(t.mapRouteProperties)i=t.mapRouteProperties;else if(t.detectErrorBoundary){let z=t.detectErrorBoundary;i=q=>({hasErrorBoundary:z(q)})}else i=Lz;let s={},o=su(t.routes,i,void 0,s),a,l=t.basename||"/",c=t.unstable_dataStrategy||Vz,f=t.unstable_patchRoutesOnMiss,u=Jt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),d=null,h=new Set,p=null,m=null,x=null,b=t.hydrationData!=null,w=ya(o,t.history.location,l),E=null;if(w==null&&!f){let z=un(404,{pathname:t.history.location.pathname}),{matches:q,route:W}=MS(o);w=q,E={[W.id]:z}}w&&!t.hydrationData&<(w,o,t.history.location.pathname).active&&(w=null);let P;if(w)if(w.some(z=>z.route.lazy))P=!1;else if(!w.some(z=>z.route.loader))P=!0;else if(u.v7_partialHydration){let z=t.hydrationData?t.hydrationData.loaderData:null,q=t.hydrationData?t.hydrationData.errors:null,W=re=>re.route.loader?typeof re.route.loader=="function"&&re.route.loader.hydrate===!0?!1:z&&z[re.route.id]!==void 0||q&&q[re.route.id]!==void 0:!0;if(q){let re=w.findIndex(fe=>q[fe.route.id]!==void 0);P=w.slice(0,re+1).every(W)}else P=w.every(W)}else P=t.hydrationData!=null;else if(P=!1,w=[],u.v7_partialHydration){let z=lt(null,o,t.history.location.pathname);z.active&&z.matches&&(w=z.matches)}let N,I={historyAction:t.history.action,location:t.history.location,matches:w,initialized:P,navigation:$v,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||E,fetchers:new Map,blockers:new Map},j=hr.Pop,L=!1,U,K=!1,X=new Map,ee=null,M=!1,v=!1,_=[],k=new Set,A=new Map,T=0,O=-1,D=new Map,S=new Set,g=new Map,R=new Map,F=new Set,C=new Map,B=new Map,V=new Map,H=!1;function Z(){if(d=t.history.listen(z=>{let{action:q,location:W,delta:re}=z;if(H){H=!1;return}Ba(B.size===0||re!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let fe=Bi({currentLocation:I.location,nextLocation:W,historyAction:q});if(fe&&re!=null){H=!0,t.history.go(re*-1),ot(fe,{state:"blocked",location:W,proceed(){ot(fe,{state:"proceeding",proceed:void 0,reset:void 0,location:W}),t.history.go(re)},reset(){let ve=new Map(I.blockers);ve.set(fe,Wc),te({blockers:ve})}});return}return sr(q,W)}),r){rV(e,X);let z=()=>nV(e,X);e.addEventListener("pagehide",z),ee=()=>e.removeEventListener("pagehide",z)}return I.initialized||sr(hr.Pop,I.location,{initialHydration:!0}),N}function le(){d&&d(),ee&&ee(),h.clear(),U&&U.abort(),I.fetchers.forEach((z,q)=>ti(q)),I.blockers.forEach((z,q)=>wt(q))}function ne(z){return h.add(z),()=>h.delete(z)}function te(z,q){q===void 0&&(q={}),I=Jt({},I,z);let W=[],re=[];u.v7_fetcherPersist&&I.fetchers.forEach((fe,ve)=>{fe.state==="idle"&&(F.has(ve)?re.push(ve):W.push(ve))}),[...h].forEach(fe=>fe(I,{deletedFetchers:re,unstable_viewTransitionOpts:q.viewTransitionOpts,unstable_flushSync:q.flushSync===!0})),u.v7_fetcherPersist&&(W.forEach(fe=>I.fetchers.delete(fe)),re.forEach(fe=>ti(fe)))}function Me(z,q,W){var re,fe;let{flushSync:ve}=W===void 0?{}:W,Ee=I.actionData!=null&&I.navigation.formMethod!=null&&Pi(I.navigation.formMethod)&&I.navigation.state==="loading"&&((re=z.state)==null?void 0:re._isRedirect)!==!0,ae;q.actionData?Object.keys(q.actionData).length>0?ae=q.actionData:ae=null:Ee?ae=I.actionData:ae=null;let ge=q.loaderData?IS(I.loaderData,q.loaderData,q.matches||[],q.errors):I.loaderData,we=I.blockers;we.size>0&&(we=new Map(we),we.forEach((Be,He)=>we.set(He,Wc)));let ye=L===!0||I.navigation.formMethod!=null&&Pi(I.navigation.formMethod)&&((fe=z.state)==null?void 0:fe._isRedirect)!==!0;a&&(o=a,a=void 0),M||j===hr.Pop||(j===hr.Push?t.history.push(z,z.state):j===hr.Replace&&t.history.replace(z,z.state));let Ae;if(j===hr.Pop){let Be=X.get(I.location.pathname);Be&&Be.has(z.pathname)?Ae={currentLocation:I.location,nextLocation:z}:X.has(z.pathname)&&(Ae={currentLocation:z,nextLocation:I.location})}else if(K){let Be=X.get(I.location.pathname);Be?Be.add(z.pathname):(Be=new Set([z.pathname]),X.set(I.location.pathname,Be)),Ae={currentLocation:I.location,nextLocation:z}}te(Jt({},q,{actionData:ae,loaderData:ge,historyAction:j,location:z,initialized:!0,navigation:$v,revalidation:"idle",restoreScrollPosition:St(z,q.matches||I.matches),preventScrollReset:ye,blockers:we}),{viewTransitionOpts:Ae,flushSync:ve===!0}),j=hr.Pop,L=!1,K=!1,M=!1,v=!1,_=[]}async function pe(z,q){if(typeof z=="number"){t.history.go(z);return}let W=Vy(I.location,I.matches,l,u.v7_prependBasename,z,u.v7_relativeSplatPath,q==null?void 0:q.fromRouteId,q==null?void 0:q.relative),{path:re,submission:fe,error:ve}=kS(u.v7_normalizeFormMethod,!1,W,q),Ee=I.location,ae=iu(I.location,re,q&&q.state);ae=Jt({},ae,t.history.encodeLocation(ae));let ge=q&&q.replace!=null?q.replace:void 0,we=hr.Push;ge===!0?we=hr.Replace:ge===!1||fe!=null&&Pi(fe.formMethod)&&fe.formAction===I.location.pathname+I.location.search&&(we=hr.Replace);let ye=q&&"preventScrollReset"in q?q.preventScrollReset===!0:void 0,Ae=(q&&q.unstable_flushSync)===!0,Be=Bi({currentLocation:Ee,nextLocation:ae,historyAction:we});if(Be){ot(Be,{state:"blocked",location:ae,proceed(){ot(Be,{state:"proceeding",proceed:void 0,reset:void 0,location:ae}),pe(z,q)},reset(){let He=new Map(I.blockers);He.set(Be,Wc),te({blockers:He})}});return}return await sr(we,ae,{submission:fe,pendingError:ve,preventScrollReset:ye,replace:q&&q.replace,enableViewTransition:q&&q.unstable_viewTransition,flushSync:Ae})}function ke(){if(ut(),te({revalidation:"loading"}),I.navigation.state!=="submitting"){if(I.navigation.state==="idle"){sr(I.historyAction,I.location,{startUninterruptedRevalidation:!0});return}sr(j||I.historyAction,I.navigation.location,{overrideNavigation:I.navigation})}}async function sr(z,q,W){U&&U.abort(),U=null,j=z,M=(W&&W.startUninterruptedRevalidation)===!0,Es(I.location,I.matches),L=(W&&W.preventScrollReset)===!0,K=(W&&W.enableViewTransition)===!0;let re=a||o,fe=W&&W.overrideNavigation,ve=ya(re,q,l),Ee=(W&&W.flushSync)===!0,ae=lt(ve,re,q.pathname);if(ae.active&&ae.matches&&(ve=ae.matches),!ve){let{error:je,notFoundMatches:Dt,route:ht}=dt(q.pathname);Me(q,{matches:Dt,loaderData:{},errors:{[ht.id]:je}},{flushSync:Ee});return}if(I.initialized&&!v&&Yz(I.location,q)&&!(W&&W.submission&&Pi(W.submission.formMethod))){Me(q,{matches:ve},{flushSync:Ee});return}U=new AbortController;let ge=ll(t.history,q,U.signal,W&&W.submission),we;if(W&&W.pendingError)we=[Ol(ve).route.id,{type:At.error,error:W.pendingError}];else if(W&&W.submission&&Pi(W.submission.formMethod)){let je=await Ze(ge,q,W.submission,ve,ae.active,{replace:W.replace,flushSync:Ee});if(je.shortCircuited)return;if(je.pendingActionResult){let[Dt,ht]=je.pendingActionResult;if(jn(ht)&&p1(ht.error)&&ht.error.status===404){U=null,Me(q,{matches:je.matches,loaderData:{},errors:{[Dt]:ht.error}});return}}ve=je.matches||ve,we=je.pendingActionResult,fe=Dv(q,W.submission),Ee=!1,ae.active=!1,ge=ll(t.history,ge.url,ge.signal)}let{shortCircuited:ye,matches:Ae,loaderData:Be,errors:He}=await ct(ge,q,ve,ae.active,fe,W&&W.submission,W&&W.fetcherSubmission,W&&W.replace,W&&W.initialHydration===!0,Ee,we);ye||(U=null,Me(q,Jt({matches:Ae||ve},OS(we),{loaderData:Be,errors:He})))}async function Ze(z,q,W,re,fe,ve){ve===void 0&&(ve={}),ut();let Ee=eV(q,W);if(te({navigation:Ee},{flushSync:ve.flushSync===!0}),fe){let we=await ri(re,q.pathname,z.signal);if(we.type==="aborted")return{shortCircuited:!0};if(we.type==="error"){let{boundaryId:ye,error:Ae}=at(q.pathname,we);return{matches:we.partialMatches,pendingActionResult:[ye,{type:At.error,error:Ae}]}}else if(we.matches)re=we.matches;else{let{notFoundMatches:ye,error:Ae,route:Be}=dt(q.pathname);return{matches:ye,pendingActionResult:[Be.id,{type:At.error,error:Ae}]}}}let ae,ge=ff(re,q);if(!ge.route.action&&!ge.route.lazy)ae={type:At.error,error:un(405,{method:z.method,pathname:q.pathname,routeId:ge.route.id})};else if(ae=(await Nn("action",z,[ge],re))[0],z.signal.aborted)return{shortCircuited:!0};if(Ea(ae)){let we;return ve&&ve.replace!=null?we=ve.replace:we=TS(ae.response.headers.get("Location"),new URL(z.url),l)===I.location.pathname+I.location.search,await st(z,ae,{submission:W,replace:we}),{shortCircuited:!0}}if(wa(ae))throw un(400,{type:"defer-action"});if(jn(ae)){let we=Ol(re,ge.route.id);return(ve&&ve.replace)!==!0&&(j=hr.Push),{matches:re,pendingActionResult:[we.route.id,ae]}}return{matches:re,pendingActionResult:[ge.route.id,ae]}}async function ct(z,q,W,re,fe,ve,Ee,ae,ge,we,ye){let Ae=fe||Dv(q,ve),Be=ve||Ee||LS(Ae),He=!M&&(!u.v7_partialHydration||!ge);if(re){if(He){let Lt=ei(ye);te(Jt({navigation:Ae},Lt!==void 0?{actionData:Lt}:{}),{flushSync:we})}let Ne=await ri(W,q.pathname,z.signal);if(Ne.type==="aborted")return{shortCircuited:!0};if(Ne.type==="error"){let{boundaryId:Lt,error:Br}=at(q.pathname,Ne);return{matches:Ne.partialMatches,loaderData:{},errors:{[Lt]:Br}}}else if(Ne.matches)W=Ne.matches;else{let{error:Lt,notFoundMatches:Br,route:kt}=dt(q.pathname);return{matches:Br,loaderData:{},errors:{[kt.id]:Lt}}}}let je=a||o,[Dt,ht]=AS(t.history,I,W,Be,q,u.v7_partialHydration&&ge===!0,u.v7_skipActionErrorRevalidation,v,_,k,F,g,S,je,l,ye);if(bi(Ne=>!(W&&W.some(Lt=>Lt.route.id===Ne))||Dt&&Dt.some(Lt=>Lt.route.id===Ne)),O=++T,Dt.length===0&&ht.length===0){let Ne=xt();return Me(q,Jt({matches:W,loaderData:{},errors:ye&&jn(ye[1])?{[ye[0]]:ye[1].error}:null},OS(ye),Ne?{fetchers:new Map(I.fetchers)}:{}),{flushSync:we}),{shortCircuited:!0}}if(He){let Ne={};if(!re){Ne.navigation=Ae;let Lt=ei(ye);Lt!==void 0&&(Ne.actionData=Lt)}ht.length>0&&(Ne.fetchers=ft(ht)),te(Ne,{flushSync:we})}ht.forEach(Ne=>{A.has(Ne.key)&&Je(Ne.key),Ne.controller&&A.set(Ne.key,Ne.controller)});let Ss=()=>ht.forEach(Ne=>Je(Ne.key));U&&U.signal.addEventListener("abort",Ss);let{loaderResults:ni,fetcherResults:Ui}=await mt(I.matches,W,Dt,ht,z);if(z.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",Ss),ht.forEach(Ne=>A.delete(Ne.key));let zi=NS([...ni,...Ui]);if(zi){if(zi.idx>=Dt.length){let Ne=ht[zi.idx-Dt.length].key;S.add(Ne)}return await st(z,zi.result,{replace:ae}),{shortCircuited:!0}}let{loaderData:Vi,errors:xn}=RS(I,W,Dt,ni,ye,ht,Ui,C);C.forEach((Ne,Lt)=>{Ne.subscribe(Br=>{(Br||Ne.done)&&C.delete(Lt)})}),u.v7_partialHydration&&ge&&I.errors&&Object.entries(I.errors).filter(Ne=>{let[Lt]=Ne;return!Dt.some(Br=>Br.route.id===Lt)}).forEach(Ne=>{let[Lt,Br]=Ne;xn=Object.assign(xn||{},{[Lt]:Br})});let oo=xt(),ao=bt(O),lo=oo||ao||ht.length>0;return Jt({matches:W,loaderData:Vi,errors:xn},lo?{fetchers:new Map(I.fetchers)}:{})}function ei(z){if(z&&!jn(z[1]))return{[z[0]]:z[1].data};if(I.actionData)return Object.keys(I.actionData).length===0?null:I.actionData}function ft(z){return z.forEach(q=>{let W=I.fetchers.get(q.key),re=Gc(void 0,W?W.data:void 0);I.fetchers.set(q.key,re)}),new Map(I.fetchers)}function rt(z,q,W,re){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");A.has(z)&&Je(z);let fe=(re&&re.unstable_flushSync)===!0,ve=a||o,Ee=Vy(I.location,I.matches,l,u.v7_prependBasename,W,u.v7_relativeSplatPath,q,re==null?void 0:re.relative),ae=ya(ve,Ee,l),ge=lt(ae,ve,Ee);if(ge.active&&ge.matches&&(ae=ge.matches),!ae){Ye(z,q,un(404,{pathname:Ee}),{flushSync:fe});return}let{path:we,submission:ye,error:Ae}=kS(u.v7_normalizeFormMethod,!0,Ee,re);if(Ae){Ye(z,q,Ae,{flushSync:fe});return}let Be=ff(ae,we);if(L=(re&&re.preventScrollReset)===!0,ye&&Pi(ye.formMethod)){bs(z,q,we,Be,ae,ge.active,fe,ye);return}g.set(z,{routeId:q,path:we}),Pt(z,q,we,Be,ae,ge.active,fe,ye)}async function bs(z,q,W,re,fe,ve,Ee,ae){ut(),g.delete(z);function ge(kt){if(!kt.route.action&&!kt.route.lazy){let $n=un(405,{method:ae.formMethod,pathname:W,routeId:q});return Ye(z,q,$n,{flushSync:Ee}),!0}return!1}if(!ve&&ge(re))return;let we=I.fetchers.get(z);Zr(z,tV(ae,we),{flushSync:Ee});let ye=new AbortController,Ae=ll(t.history,W,ye.signal,ae);if(ve){let kt=await ri(fe,W,Ae.signal);if(kt.type==="aborted")return;if(kt.type==="error"){let{error:$n}=at(W,kt);Ye(z,q,$n,{flushSync:Ee});return}else if(kt.matches){if(fe=kt.matches,re=ff(fe,W),ge(re))return}else{Ye(z,q,un(404,{pathname:W}),{flushSync:Ee});return}}A.set(z,ye);let Be=T,je=(await Nn("action",Ae,[re],fe))[0];if(Ae.signal.aborted){A.get(z)===ye&&A.delete(z);return}if(u.v7_fetcherPersist&&F.has(z)){if(Ea(je)||jn(je)){Zr(z,yo(void 0));return}}else{if(Ea(je))if(A.delete(z),O>Be){Zr(z,yo(void 0));return}else return S.add(z),Zr(z,Gc(ae)),st(Ae,je,{fetcherSubmission:ae});if(jn(je)){Ye(z,q,je.error);return}}if(wa(je))throw un(400,{type:"defer-action"});let Dt=I.navigation.location||I.location,ht=ll(t.history,Dt,ye.signal),Ss=a||o,ni=I.navigation.state!=="idle"?ya(Ss,I.navigation.location,l):I.matches;Ge(ni,"Didn't find any matches after fetcher action");let Ui=++T;D.set(z,Ui);let zi=Gc(ae,je.data);I.fetchers.set(z,zi);let[Vi,xn]=AS(t.history,I,ni,ae,Dt,!1,u.v7_skipActionErrorRevalidation,v,_,k,F,g,S,Ss,l,[re.route.id,je]);xn.filter(kt=>kt.key!==z).forEach(kt=>{let $n=kt.key,Sw=I.fetchers.get($n),x9=Gc(void 0,Sw?Sw.data:void 0);I.fetchers.set($n,x9),A.has($n)&&Je($n),kt.controller&&A.set($n,kt.controller)}),te({fetchers:new Map(I.fetchers)});let oo=()=>xn.forEach(kt=>Je(kt.key));ye.signal.addEventListener("abort",oo);let{loaderResults:ao,fetcherResults:lo}=await mt(I.matches,ni,Vi,xn,ht);if(ye.signal.aborted)return;ye.signal.removeEventListener("abort",oo),D.delete(z),A.delete(z),xn.forEach(kt=>A.delete(kt.key));let Ne=NS([...ao,...lo]);if(Ne){if(Ne.idx>=Vi.length){let kt=xn[Ne.idx-Vi.length].key;S.add(kt)}return st(ht,Ne.result)}let{loaderData:Lt,errors:Br}=RS(I,I.matches,Vi,ao,void 0,xn,lo,C);if(I.fetchers.has(z)){let kt=yo(je.data);I.fetchers.set(z,kt)}bt(Ui),I.navigation.state==="loading"&&Ui>O?(Ge(j,"Expected pending action"),U&&U.abort(),Me(I.navigation.location,{matches:ni,loaderData:Lt,errors:Br,fetchers:new Map(I.fetchers)})):(te({errors:Br,loaderData:IS(I.loaderData,Lt,ni,Br),fetchers:new Map(I.fetchers)}),v=!1)}async function Pt(z,q,W,re,fe,ve,Ee,ae){let ge=I.fetchers.get(z);Zr(z,Gc(ae,ge?ge.data:void 0),{flushSync:Ee});let we=new AbortController,ye=ll(t.history,W,we.signal);if(ve){let je=await ri(fe,W,ye.signal);if(je.type==="aborted")return;if(je.type==="error"){let{error:Dt}=at(W,je);Ye(z,q,Dt,{flushSync:Ee});return}else if(je.matches)fe=je.matches,re=ff(fe,W);else{Ye(z,q,un(404,{pathname:W}),{flushSync:Ee});return}}A.set(z,we);let Ae=T,He=(await Nn("loader",ye,[re],fe))[0];if(wa(He)&&(He=await B8(He,ye.signal,!0)||He),A.get(z)===we&&A.delete(z),!ye.signal.aborted){if(F.has(z)){Zr(z,yo(void 0));return}if(Ea(He))if(O>Ae){Zr(z,yo(void 0));return}else{S.add(z),await st(ye,He);return}if(jn(He)){Ye(z,q,He.error);return}Ge(!wa(He),"Unhandled fetcher deferred data"),Zr(z,yo(He.data))}}async function st(z,q,W){let{submission:re,fetcherSubmission:fe,replace:ve}=W===void 0?{}:W;q.response.headers.has("X-Remix-Revalidate")&&(v=!0);let Ee=q.response.headers.get("Location");Ge(Ee,"Expected a Location header on the redirect Response"),Ee=TS(Ee,new URL(z.url),l);let ae=iu(I.location,Ee,{_isRedirect:!0});if(r){let He=!1;if(q.response.headers.has("X-Remix-Reload-Document"))He=!0;else if(hx.test(Ee)){const je=t.history.createURL(Ee);He=je.origin!==e.location.origin||Lu(je.pathname,l)==null}if(He){ve?e.location.replace(Ee):e.location.assign(Ee);return}}U=null;let ge=ve===!0||q.response.headers.has("X-Remix-Replace")?hr.Replace:hr.Push,{formMethod:we,formAction:ye,formEncType:Ae}=I.navigation;!re&&!fe&&we&&ye&&Ae&&(re=LS(I.navigation));let Be=re||fe;if($z.has(q.response.status)&&Be&&Pi(Be.formMethod))await sr(ge,ae,{submission:Jt({},Be,{formAction:Ee}),preventScrollReset:L});else{let He=Dv(ae,re);await sr(ge,ae,{overrideNavigation:He,fetcherSubmission:fe,preventScrollReset:L})}}async function Nn(z,q,W,re){try{let fe=await qz(c,z,q,W,re,s,i);return await Promise.all(fe.map((ve,Ee)=>{if(Jz(ve)){let ae=ve.result;return{type:At.redirect,response:Gz(ae,q,W[Ee].route.id,re,l,u.v7_relativeSplatPath)}}return Wz(ve)}))}catch(fe){return W.map(()=>({type:At.error,error:fe}))}}async function mt(z,q,W,re,fe){let[ve,...Ee]=await Promise.all([W.length?Nn("loader",fe,W,q):[],...re.map(ae=>{if(ae.matches&&ae.match&&ae.controller){let ge=ll(t.history,ae.path,ae.controller.signal);return Nn("loader",ge,[ae.match],ae.matches).then(we=>we[0])}else return Promise.resolve({type:At.error,error:un(404,{pathname:ae.path})})})]);return await Promise.all([DS(z,W,ve,ve.map(()=>fe.signal),!1,I.loaderData),DS(z,re.map(ae=>ae.match),Ee,re.map(ae=>ae.controller?ae.controller.signal:null),!0)]),{loaderResults:ve,fetcherResults:Ee}}function ut(){v=!0,_.push(...bi()),g.forEach((z,q)=>{A.has(q)&&(k.add(q),Je(q))})}function Zr(z,q,W){W===void 0&&(W={}),I.fetchers.set(z,q),te({fetchers:new Map(I.fetchers)},{flushSync:(W&&W.flushSync)===!0})}function Ye(z,q,W,re){re===void 0&&(re={});let fe=Ol(I.matches,q);ti(z),te({errors:{[fe.route.id]:W},fetchers:new Map(I.fetchers)},{flushSync:(re&&re.flushSync)===!0})}function gt(z){return u.v7_fetcherPersist&&(R.set(z,(R.get(z)||0)+1),F.has(z)&&F.delete(z)),I.fetchers.get(z)||Dz}function ti(z){let q=I.fetchers.get(z);A.has(z)&&!(q&&q.state==="loading"&&D.has(z))&&Je(z),g.delete(z),D.delete(z),S.delete(z),F.delete(z),k.delete(z),I.fetchers.delete(z)}function Rt(z){if(u.v7_fetcherPersist){let q=(R.get(z)||0)-1;q<=0?(R.delete(z),F.add(z)):R.set(z,q)}else ti(z);te({fetchers:new Map(I.fetchers)})}function Je(z){let q=A.get(z);Ge(q,"Expected fetch controller: "+z),q.abort(),A.delete(z)}function Fi(z){for(let q of z){let W=gt(q),re=yo(W.data);I.fetchers.set(q,re)}}function xt(){let z=[],q=!1;for(let W of S){let re=I.fetchers.get(W);Ge(re,"Expected fetcher: "+W),re.state==="loading"&&(S.delete(W),z.push(W),q=!0)}return Fi(z),q}function bt(z){let q=[];for(let[W,re]of D)if(re0}function ws(z,q){let W=I.blockers.get(z)||Wc;return B.get(z)!==q&&B.set(z,q),W}function wt(z){I.blockers.delete(z),B.delete(z)}function ot(z,q){let W=I.blockers.get(z)||Wc;Ge(W.state==="unblocked"&&q.state==="blocked"||W.state==="blocked"&&q.state==="blocked"||W.state==="blocked"&&q.state==="proceeding"||W.state==="blocked"&&q.state==="unblocked"||W.state==="proceeding"&&q.state==="unblocked","Invalid blocker state transition: "+W.state+" -> "+q.state);let re=new Map(I.blockers);re.set(z,q),te({blockers:re})}function Bi(z){let{currentLocation:q,nextLocation:W,historyAction:re}=z;if(B.size===0)return;B.size>1&&Ba(!1,"A router only supports one blocker at a time");let fe=Array.from(B.entries()),[ve,Ee]=fe[fe.length-1],ae=I.blockers.get(ve);if(!(ae&&ae.state==="proceeding")&&Ee({currentLocation:q,nextLocation:W,historyAction:re}))return ve}function dt(z){let q=un(404,{pathname:z}),W=a||o,{matches:re,route:fe}=MS(W);return bi(),{notFoundMatches:re,route:fe,error:q}}function at(z,q){return{boundaryId:Ol(q.partialMatches).route.id,error:un(400,{type:"route-discovery",pathname:z,message:q.error!=null&&"message"in q.error?q.error:String(q.error)})}}function bi(z){let q=[];return C.forEach((W,re)=>{(!z||z(re))&&(W.cancel(),q.push(re),C.delete(re))}),q}function It(z,q,W){if(p=z,x=q,m=W||null,!b&&I.navigation===$v){b=!0;let re=St(I.location,I.matches);re!=null&&te({restoreScrollPosition:re})}return()=>{p=null,x=null,m=null}}function Et(z,q){return m&&m(z,q.map(re=>uz(re,I.loaderData)))||z.key}function Es(z,q){if(p&&x){let W=Et(z,q);p[W]=x()}}function St(z,q){if(p){let W=Et(z,q),re=p[W];if(typeof re=="number")return re}return null}function lt(z,q,W){if(f)if(z){let re=z[z.length-1].route;if(re.path&&(re.path==="*"||re.path.endsWith("/*")))return{active:!0,matches:rh(q,W,l,!0)}}else return{active:!0,matches:rh(q,W,l,!0)||[]};return{active:!1,matches:null}}async function ri(z,q,W){let re=z,fe=re.length>0?re[re.length-1].route:null;for(;;){let ve=a==null,Ee=a||o;try{await zz(f,q,re,Ee,s,i,V,W)}catch(ye){return{type:"error",error:ye,partialMatches:re}}finally{ve&&(o=[...o])}if(W.aborted)return{type:"aborted"};let ae=ya(Ee,q,l),ge=!1;if(ae){let ye=ae[ae.length-1].route;if(ye.index)return{type:"success",matches:ae};if(ye.path&&ye.path.length>0)if(ye.path==="*")ge=!0;else return{type:"success",matches:ae}}let we=rh(Ee,q,l,!0);if(!we||re.map(ye=>ye.route.id).join("-")===we.map(ye=>ye.route.id).join("-"))return{type:"success",matches:ge?ae:null};if(re=we,fe=re[re.length-1].route,fe.path==="*")return{type:"success",matches:re}}}function Ot(z){s={},a=su(z,i,void 0,s)}function Mt(z,q){let W=a==null;L8(z,q,a||o,s,i),W&&(o=[...o],te({}))}return N={get basename(){return l},get future(){return u},get state(){return I},get routes(){return o},get window(){return e},initialize:Z,subscribe:ne,enableScrollRestoration:It,navigate:pe,fetch:rt,revalidate:ke,createHref:z=>t.history.createHref(z),encodeLocation:z=>t.history.encodeLocation(z),getFetcher:gt,deleteFetcher:Rt,dispose:le,getBlocker:ws,deleteBlocker:wt,patchRoutes:Mt,_internalFetchControllers:A,_internalActiveDeferreds:C,_internalSetRoutes:Ot},N}function Fz(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Vy(t,e,r,n,i,s,o,a){let l,c;if(o){l=[];for(let u of e)if(l.push(u),u.route.id===o){c=u;break}}else l=e,c=e[e.length-1];let f=_z(i||".",Cz(l,s),Lu(t.pathname,r)||t.pathname,a==="path");return i==null&&(f.search=t.search,f.hash=t.hash),(i==null||i===""||i===".")&&c&&c.route.index&&!vx(f.search)&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),n&&r!=="/"&&(f.pathname=f.pathname==="/"?r:Ra([r,f.pathname])),Du(f)}function kS(t,e,r,n){if(!n||!Fz(n))return{path:r};if(n.formMethod&&!Zz(n.formMethod))return{path:r,error:un(405,{method:n.formMethod})};let i=()=>({path:r,error:un(400,{type:"invalid-body"})}),s=n.formMethod||"get",o=t?s.toUpperCase():s.toLowerCase(),a=j8(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Pi(o))return i();let d=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((h,p)=>{let[m,x]=p;return""+h+m+"="+x+` + */function Jt(){return Jt=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Ba(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function az(){return Math.random().toString(36).substr(2,8)}function wS(t,e){return{usr:t.state,key:t.key,idx:e}}function iu(t,e,r,n){return r===void 0&&(r=null),Jt({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?gs(e):e,{state:r,key:e&&e.key||n||az()})}function Du(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function gs(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function lz(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,a=vr.Pop,l=null,c=f();c==null&&(c=0,o.replaceState(Jt({},o.state,{idx:c}),""));function f(){return(o.state||{idx:null}).idx}function u(){a=vr.Pop;let x=f(),b=x==null?null:x-c;c=x,l&&l({action:a,location:m.location,delta:b})}function d(x,b){a=vr.Push;let w=iu(m.location,x,b);r&&r(w,x),c=f()+1;let E=wS(w,c),P=m.createHref(w);try{o.pushState(E,"",P)}catch(N){if(N instanceof DOMException&&N.name==="DataCloneError")throw N;i.location.assign(P)}s&&l&&l({action:a,location:m.location,delta:1})}function h(x,b){a=vr.Replace;let w=iu(m.location,x,b);r&&r(w,x),c=f();let E=wS(w,c),P=m.createHref(w);o.replaceState(E,"",P),s&&l&&l({action:a,location:m.location,delta:0})}function p(x){let b=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof x=="string"?x:Du(x);return w=w.replace(/ $/,"%20"),Ge(b,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,b)}let m={get action(){return a},get location(){return t(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(bS,u),l=x,()=>{i.removeEventListener(bS,u),l=null}},createHref(x){return e(i,x)},createURL:p,encodeLocation(x){let b=p(x);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:d,replace:h,go(x){return o.go(x)}};return m}var At;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(At||(At={}));const cz=new Set(["lazy","caseSensitive","path","id","index","children"]);function fz(t){return t.index===!0}function su(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((i,s)=>{let o=[...r,String(s)],a=typeof i.id=="string"?i.id:o.join("-");if(Ge(i.index!==!0||!i.children,"Cannot specify children on an index route"),Ge(!n[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),fz(i)){let l=Jt({},i,e(i),{id:a});return n[a]=l,l}else{let l=Jt({},i,e(i),{id:a,children:void 0});return n[a]=l,i.children&&(l.children=su(i.children,e,o,n)),l}})}function ya(t,e,r){return r===void 0&&(r="/"),rh(t,e,r,!1)}function rh(t,e,r,n){let i=typeof e=="string"?gs(e):e,s=Lu(i.pathname||"/",r);if(s==null)return null;let o=I8(t);dz(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(Ge(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=Ra([n,l.relativePath]),f=r.concat(l);s.children&&s.children.length>0&&(Ge(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),I8(s.children,e,f,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:xz(c,s.index),routesMeta:f})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of O8(s.path))i(s,o,l)}),e}function O8(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=O8(n.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function dz(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:bz(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const hz=/^:[\w-]+$/,vz=3,pz=2,yz=1,mz=10,gz=-2,ES=t=>t==="*";function xz(t,e){let r=t.split("/"),n=r.length;return r.some(ES)&&(n+=gz),e&&(n+=pz),r.filter(i=>!ES(i)).reduce((i,s)=>i+(hz.test(s)?vz:s===""?yz:mz),n)}function bz(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function wz(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,i={},s="/",o=[];for(let a=0;a{let{paramName:d,isOptional:h}=f;if(d==="*"){let m=a[u]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const p=a[u];return h&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function Ez(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),Ba(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(n.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function Sz(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ba(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Lu(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function kz(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?gs(t):t;return{pathname:r?r.startsWith("/")?r:Az(r,e):e,search:Pz(n),hash:Rz(i)}}function Az(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Nv(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function M8(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Cz(t,e){let r=M8(t);return e?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function _z(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=gs(t):(i=Jt({},t),Ge(!i.pathname||!i.pathname.includes("?"),Nv("?","pathname","search",i)),Ge(!i.pathname||!i.pathname.includes("#"),Nv("#","pathname","hash",i)),Ge(!i.search||!i.search.includes("#"),Nv("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=r;else{let u=e.length-1;if(!n&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),u-=1;i.pathname=d.join("/")}a=u>=0?e[u]:"/"}let l=kz(i,a),c=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||f)&&(l.pathname+="/"),l}const Ra=t=>t.join("/").replace(/\/\/+/g,"/"),Tz=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Pz=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Rz=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class t0{constructor(e,r,n,i){i===void 0&&(i=!1),this.status=e,this.statusText=r||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function p1(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const N8=["post","put","patch","delete"],Iz=new Set(N8),Oz=["get",...N8],Mz=new Set(Oz),Nz=new Set([301,302,303,307,308]),$z=new Set([307,308]),$v={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Dz={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Wc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},hx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lz=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),$8="remix-router-transitions";function jz(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;Ge(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(t.mapRouteProperties)i=t.mapRouteProperties;else if(t.detectErrorBoundary){let z=t.detectErrorBoundary;i=q=>({hasErrorBoundary:z(q)})}else i=Lz;let s={},o=su(t.routes,i,void 0,s),a,l=t.basename||"/",c=t.unstable_dataStrategy||Vz,f=t.unstable_patchRoutesOnMiss,u=Jt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),d=null,h=new Set,p=null,m=null,x=null,b=t.hydrationData!=null,w=ya(o,t.history.location,l),E=null;if(w==null&&!f){let z=un(404,{pathname:t.history.location.pathname}),{matches:q,route:W}=MS(o);w=q,E={[W.id]:z}}w&&!t.hydrationData&<(w,o,t.history.location.pathname).active&&(w=null);let P;if(w)if(w.some(z=>z.route.lazy))P=!1;else if(!w.some(z=>z.route.loader))P=!0;else if(u.v7_partialHydration){let z=t.hydrationData?t.hydrationData.loaderData:null,q=t.hydrationData?t.hydrationData.errors:null,W=re=>re.route.loader?typeof re.route.loader=="function"&&re.route.loader.hydrate===!0?!1:z&&z[re.route.id]!==void 0||q&&q[re.route.id]!==void 0:!0;if(q){let re=w.findIndex(fe=>q[fe.route.id]!==void 0);P=w.slice(0,re+1).every(W)}else P=w.every(W)}else P=t.hydrationData!=null;else if(P=!1,w=[],u.v7_partialHydration){let z=lt(null,o,t.history.location.pathname);z.active&&z.matches&&(w=z.matches)}let N,I={historyAction:t.history.action,location:t.history.location,matches:w,initialized:P,navigation:$v,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||E,fetchers:new Map,blockers:new Map},j=vr.Pop,L=!1,U,K=!1,X=new Map,ee=null,M=!1,v=!1,_=[],k=new Set,A=new Map,T=0,O=-1,D=new Map,S=new Set,g=new Map,R=new Map,F=new Set,C=new Map,B=new Map,V=new Map,H=!1;function Z(){if(d=t.history.listen(z=>{let{action:q,location:W,delta:re}=z;if(H){H=!1;return}Ba(B.size===0||re!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let fe=Bi({currentLocation:I.location,nextLocation:W,historyAction:q});if(fe&&re!=null){H=!0,t.history.go(re*-1),ot(fe,{state:"blocked",location:W,proceed(){ot(fe,{state:"proceeding",proceed:void 0,reset:void 0,location:W}),t.history.go(re)},reset(){let ve=new Map(I.blockers);ve.set(fe,Wc),te({blockers:ve})}});return}return sr(q,W)}),r){rV(e,X);let z=()=>nV(e,X);e.addEventListener("pagehide",z),ee=()=>e.removeEventListener("pagehide",z)}return I.initialized||sr(vr.Pop,I.location,{initialHydration:!0}),N}function le(){d&&d(),ee&&ee(),h.clear(),U&&U.abort(),I.fetchers.forEach((z,q)=>ti(q)),I.blockers.forEach((z,q)=>wt(q))}function ne(z){return h.add(z),()=>h.delete(z)}function te(z,q){q===void 0&&(q={}),I=Jt({},I,z);let W=[],re=[];u.v7_fetcherPersist&&I.fetchers.forEach((fe,ve)=>{fe.state==="idle"&&(F.has(ve)?re.push(ve):W.push(ve))}),[...h].forEach(fe=>fe(I,{deletedFetchers:re,unstable_viewTransitionOpts:q.viewTransitionOpts,unstable_flushSync:q.flushSync===!0})),u.v7_fetcherPersist&&(W.forEach(fe=>I.fetchers.delete(fe)),re.forEach(fe=>ti(fe)))}function Me(z,q,W){var re,fe;let{flushSync:ve}=W===void 0?{}:W,Ee=I.actionData!=null&&I.navigation.formMethod!=null&&Pi(I.navigation.formMethod)&&I.navigation.state==="loading"&&((re=z.state)==null?void 0:re._isRedirect)!==!0,ae;q.actionData?Object.keys(q.actionData).length>0?ae=q.actionData:ae=null:Ee?ae=I.actionData:ae=null;let ge=q.loaderData?IS(I.loaderData,q.loaderData,q.matches||[],q.errors):I.loaderData,we=I.blockers;we.size>0&&(we=new Map(we),we.forEach((Be,He)=>we.set(He,Wc)));let ye=L===!0||I.navigation.formMethod!=null&&Pi(I.navigation.formMethod)&&((fe=z.state)==null?void 0:fe._isRedirect)!==!0;a&&(o=a,a=void 0),M||j===vr.Pop||(j===vr.Push?t.history.push(z,z.state):j===vr.Replace&&t.history.replace(z,z.state));let Ae;if(j===vr.Pop){let Be=X.get(I.location.pathname);Be&&Be.has(z.pathname)?Ae={currentLocation:I.location,nextLocation:z}:X.has(z.pathname)&&(Ae={currentLocation:z,nextLocation:I.location})}else if(K){let Be=X.get(I.location.pathname);Be?Be.add(z.pathname):(Be=new Set([z.pathname]),X.set(I.location.pathname,Be)),Ae={currentLocation:I.location,nextLocation:z}}te(Jt({},q,{actionData:ae,loaderData:ge,historyAction:j,location:z,initialized:!0,navigation:$v,revalidation:"idle",restoreScrollPosition:St(z,q.matches||I.matches),preventScrollReset:ye,blockers:we}),{viewTransitionOpts:Ae,flushSync:ve===!0}),j=vr.Pop,L=!1,K=!1,M=!1,v=!1,_=[]}async function pe(z,q){if(typeof z=="number"){t.history.go(z);return}let W=Vy(I.location,I.matches,l,u.v7_prependBasename,z,u.v7_relativeSplatPath,q==null?void 0:q.fromRouteId,q==null?void 0:q.relative),{path:re,submission:fe,error:ve}=kS(u.v7_normalizeFormMethod,!1,W,q),Ee=I.location,ae=iu(I.location,re,q&&q.state);ae=Jt({},ae,t.history.encodeLocation(ae));let ge=q&&q.replace!=null?q.replace:void 0,we=vr.Push;ge===!0?we=vr.Replace:ge===!1||fe!=null&&Pi(fe.formMethod)&&fe.formAction===I.location.pathname+I.location.search&&(we=vr.Replace);let ye=q&&"preventScrollReset"in q?q.preventScrollReset===!0:void 0,Ae=(q&&q.unstable_flushSync)===!0,Be=Bi({currentLocation:Ee,nextLocation:ae,historyAction:we});if(Be){ot(Be,{state:"blocked",location:ae,proceed(){ot(Be,{state:"proceeding",proceed:void 0,reset:void 0,location:ae}),pe(z,q)},reset(){let He=new Map(I.blockers);He.set(Be,Wc),te({blockers:He})}});return}return await sr(we,ae,{submission:fe,pendingError:ve,preventScrollReset:ye,replace:q&&q.replace,enableViewTransition:q&&q.unstable_viewTransition,flushSync:Ae})}function ke(){if(ut(),te({revalidation:"loading"}),I.navigation.state!=="submitting"){if(I.navigation.state==="idle"){sr(I.historyAction,I.location,{startUninterruptedRevalidation:!0});return}sr(j||I.historyAction,I.navigation.location,{overrideNavigation:I.navigation})}}async function sr(z,q,W){U&&U.abort(),U=null,j=z,M=(W&&W.startUninterruptedRevalidation)===!0,Es(I.location,I.matches),L=(W&&W.preventScrollReset)===!0,K=(W&&W.enableViewTransition)===!0;let re=a||o,fe=W&&W.overrideNavigation,ve=ya(re,q,l),Ee=(W&&W.flushSync)===!0,ae=lt(ve,re,q.pathname);if(ae.active&&ae.matches&&(ve=ae.matches),!ve){let{error:je,notFoundMatches:Dt,route:ht}=dt(q.pathname);Me(q,{matches:Dt,loaderData:{},errors:{[ht.id]:je}},{flushSync:Ee});return}if(I.initialized&&!v&&Yz(I.location,q)&&!(W&&W.submission&&Pi(W.submission.formMethod))){Me(q,{matches:ve},{flushSync:Ee});return}U=new AbortController;let ge=ll(t.history,q,U.signal,W&&W.submission),we;if(W&&W.pendingError)we=[Ol(ve).route.id,{type:At.error,error:W.pendingError}];else if(W&&W.submission&&Pi(W.submission.formMethod)){let je=await Ze(ge,q,W.submission,ve,ae.active,{replace:W.replace,flushSync:Ee});if(je.shortCircuited)return;if(je.pendingActionResult){let[Dt,ht]=je.pendingActionResult;if(jn(ht)&&p1(ht.error)&&ht.error.status===404){U=null,Me(q,{matches:je.matches,loaderData:{},errors:{[Dt]:ht.error}});return}}ve=je.matches||ve,we=je.pendingActionResult,fe=Dv(q,W.submission),Ee=!1,ae.active=!1,ge=ll(t.history,ge.url,ge.signal)}let{shortCircuited:ye,matches:Ae,loaderData:Be,errors:He}=await ct(ge,q,ve,ae.active,fe,W&&W.submission,W&&W.fetcherSubmission,W&&W.replace,W&&W.initialHydration===!0,Ee,we);ye||(U=null,Me(q,Jt({matches:Ae||ve},OS(we),{loaderData:Be,errors:He})))}async function Ze(z,q,W,re,fe,ve){ve===void 0&&(ve={}),ut();let Ee=eV(q,W);if(te({navigation:Ee},{flushSync:ve.flushSync===!0}),fe){let we=await ri(re,q.pathname,z.signal);if(we.type==="aborted")return{shortCircuited:!0};if(we.type==="error"){let{boundaryId:ye,error:Ae}=at(q.pathname,we);return{matches:we.partialMatches,pendingActionResult:[ye,{type:At.error,error:Ae}]}}else if(we.matches)re=we.matches;else{let{notFoundMatches:ye,error:Ae,route:Be}=dt(q.pathname);return{matches:ye,pendingActionResult:[Be.id,{type:At.error,error:Ae}]}}}let ae,ge=ff(re,q);if(!ge.route.action&&!ge.route.lazy)ae={type:At.error,error:un(405,{method:z.method,pathname:q.pathname,routeId:ge.route.id})};else if(ae=(await Nn("action",z,[ge],re))[0],z.signal.aborted)return{shortCircuited:!0};if(Ea(ae)){let we;return ve&&ve.replace!=null?we=ve.replace:we=TS(ae.response.headers.get("Location"),new URL(z.url),l)===I.location.pathname+I.location.search,await st(z,ae,{submission:W,replace:we}),{shortCircuited:!0}}if(wa(ae))throw un(400,{type:"defer-action"});if(jn(ae)){let we=Ol(re,ge.route.id);return(ve&&ve.replace)!==!0&&(j=vr.Push),{matches:re,pendingActionResult:[we.route.id,ae]}}return{matches:re,pendingActionResult:[ge.route.id,ae]}}async function ct(z,q,W,re,fe,ve,Ee,ae,ge,we,ye){let Ae=fe||Dv(q,ve),Be=ve||Ee||LS(Ae),He=!M&&(!u.v7_partialHydration||!ge);if(re){if(He){let Lt=ei(ye);te(Jt({navigation:Ae},Lt!==void 0?{actionData:Lt}:{}),{flushSync:we})}let Ne=await ri(W,q.pathname,z.signal);if(Ne.type==="aborted")return{shortCircuited:!0};if(Ne.type==="error"){let{boundaryId:Lt,error:Br}=at(q.pathname,Ne);return{matches:Ne.partialMatches,loaderData:{},errors:{[Lt]:Br}}}else if(Ne.matches)W=Ne.matches;else{let{error:Lt,notFoundMatches:Br,route:kt}=dt(q.pathname);return{matches:Br,loaderData:{},errors:{[kt.id]:Lt}}}}let je=a||o,[Dt,ht]=AS(t.history,I,W,Be,q,u.v7_partialHydration&&ge===!0,u.v7_skipActionErrorRevalidation,v,_,k,F,g,S,je,l,ye);if(bi(Ne=>!(W&&W.some(Lt=>Lt.route.id===Ne))||Dt&&Dt.some(Lt=>Lt.route.id===Ne)),O=++T,Dt.length===0&&ht.length===0){let Ne=xt();return Me(q,Jt({matches:W,loaderData:{},errors:ye&&jn(ye[1])?{[ye[0]]:ye[1].error}:null},OS(ye),Ne?{fetchers:new Map(I.fetchers)}:{}),{flushSync:we}),{shortCircuited:!0}}if(He){let Ne={};if(!re){Ne.navigation=Ae;let Lt=ei(ye);Lt!==void 0&&(Ne.actionData=Lt)}ht.length>0&&(Ne.fetchers=ft(ht)),te(Ne,{flushSync:we})}ht.forEach(Ne=>{A.has(Ne.key)&&Je(Ne.key),Ne.controller&&A.set(Ne.key,Ne.controller)});let Ss=()=>ht.forEach(Ne=>Je(Ne.key));U&&U.signal.addEventListener("abort",Ss);let{loaderResults:ni,fetcherResults:Ui}=await mt(I.matches,W,Dt,ht,z);if(z.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",Ss),ht.forEach(Ne=>A.delete(Ne.key));let zi=NS([...ni,...Ui]);if(zi){if(zi.idx>=Dt.length){let Ne=ht[zi.idx-Dt.length].key;S.add(Ne)}return await st(z,zi.result,{replace:ae}),{shortCircuited:!0}}let{loaderData:Vi,errors:xn}=RS(I,W,Dt,ni,ye,ht,Ui,C);C.forEach((Ne,Lt)=>{Ne.subscribe(Br=>{(Br||Ne.done)&&C.delete(Lt)})}),u.v7_partialHydration&&ge&&I.errors&&Object.entries(I.errors).filter(Ne=>{let[Lt]=Ne;return!Dt.some(Br=>Br.route.id===Lt)}).forEach(Ne=>{let[Lt,Br]=Ne;xn=Object.assign(xn||{},{[Lt]:Br})});let oo=xt(),ao=bt(O),lo=oo||ao||ht.length>0;return Jt({matches:W,loaderData:Vi,errors:xn},lo?{fetchers:new Map(I.fetchers)}:{})}function ei(z){if(z&&!jn(z[1]))return{[z[0]]:z[1].data};if(I.actionData)return Object.keys(I.actionData).length===0?null:I.actionData}function ft(z){return z.forEach(q=>{let W=I.fetchers.get(q.key),re=Gc(void 0,W?W.data:void 0);I.fetchers.set(q.key,re)}),new Map(I.fetchers)}function rt(z,q,W,re){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");A.has(z)&&Je(z);let fe=(re&&re.unstable_flushSync)===!0,ve=a||o,Ee=Vy(I.location,I.matches,l,u.v7_prependBasename,W,u.v7_relativeSplatPath,q,re==null?void 0:re.relative),ae=ya(ve,Ee,l),ge=lt(ae,ve,Ee);if(ge.active&&ge.matches&&(ae=ge.matches),!ae){Ye(z,q,un(404,{pathname:Ee}),{flushSync:fe});return}let{path:we,submission:ye,error:Ae}=kS(u.v7_normalizeFormMethod,!0,Ee,re);if(Ae){Ye(z,q,Ae,{flushSync:fe});return}let Be=ff(ae,we);if(L=(re&&re.preventScrollReset)===!0,ye&&Pi(ye.formMethod)){bs(z,q,we,Be,ae,ge.active,fe,ye);return}g.set(z,{routeId:q,path:we}),Pt(z,q,we,Be,ae,ge.active,fe,ye)}async function bs(z,q,W,re,fe,ve,Ee,ae){ut(),g.delete(z);function ge(kt){if(!kt.route.action&&!kt.route.lazy){let $n=un(405,{method:ae.formMethod,pathname:W,routeId:q});return Ye(z,q,$n,{flushSync:Ee}),!0}return!1}if(!ve&&ge(re))return;let we=I.fetchers.get(z);Zr(z,tV(ae,we),{flushSync:Ee});let ye=new AbortController,Ae=ll(t.history,W,ye.signal,ae);if(ve){let kt=await ri(fe,W,Ae.signal);if(kt.type==="aborted")return;if(kt.type==="error"){let{error:$n}=at(W,kt);Ye(z,q,$n,{flushSync:Ee});return}else if(kt.matches){if(fe=kt.matches,re=ff(fe,W),ge(re))return}else{Ye(z,q,un(404,{pathname:W}),{flushSync:Ee});return}}A.set(z,ye);let Be=T,je=(await Nn("action",Ae,[re],fe))[0];if(Ae.signal.aborted){A.get(z)===ye&&A.delete(z);return}if(u.v7_fetcherPersist&&F.has(z)){if(Ea(je)||jn(je)){Zr(z,yo(void 0));return}}else{if(Ea(je))if(A.delete(z),O>Be){Zr(z,yo(void 0));return}else return S.add(z),Zr(z,Gc(ae)),st(Ae,je,{fetcherSubmission:ae});if(jn(je)){Ye(z,q,je.error);return}}if(wa(je))throw un(400,{type:"defer-action"});let Dt=I.navigation.location||I.location,ht=ll(t.history,Dt,ye.signal),Ss=a||o,ni=I.navigation.state!=="idle"?ya(Ss,I.navigation.location,l):I.matches;Ge(ni,"Didn't find any matches after fetcher action");let Ui=++T;D.set(z,Ui);let zi=Gc(ae,je.data);I.fetchers.set(z,zi);let[Vi,xn]=AS(t.history,I,ni,ae,Dt,!1,u.v7_skipActionErrorRevalidation,v,_,k,F,g,S,Ss,l,[re.route.id,je]);xn.filter(kt=>kt.key!==z).forEach(kt=>{let $n=kt.key,Sw=I.fetchers.get($n),x9=Gc(void 0,Sw?Sw.data:void 0);I.fetchers.set($n,x9),A.has($n)&&Je($n),kt.controller&&A.set($n,kt.controller)}),te({fetchers:new Map(I.fetchers)});let oo=()=>xn.forEach(kt=>Je(kt.key));ye.signal.addEventListener("abort",oo);let{loaderResults:ao,fetcherResults:lo}=await mt(I.matches,ni,Vi,xn,ht);if(ye.signal.aborted)return;ye.signal.removeEventListener("abort",oo),D.delete(z),A.delete(z),xn.forEach(kt=>A.delete(kt.key));let Ne=NS([...ao,...lo]);if(Ne){if(Ne.idx>=Vi.length){let kt=xn[Ne.idx-Vi.length].key;S.add(kt)}return st(ht,Ne.result)}let{loaderData:Lt,errors:Br}=RS(I,I.matches,Vi,ao,void 0,xn,lo,C);if(I.fetchers.has(z)){let kt=yo(je.data);I.fetchers.set(z,kt)}bt(Ui),I.navigation.state==="loading"&&Ui>O?(Ge(j,"Expected pending action"),U&&U.abort(),Me(I.navigation.location,{matches:ni,loaderData:Lt,errors:Br,fetchers:new Map(I.fetchers)})):(te({errors:Br,loaderData:IS(I.loaderData,Lt,ni,Br),fetchers:new Map(I.fetchers)}),v=!1)}async function Pt(z,q,W,re,fe,ve,Ee,ae){let ge=I.fetchers.get(z);Zr(z,Gc(ae,ge?ge.data:void 0),{flushSync:Ee});let we=new AbortController,ye=ll(t.history,W,we.signal);if(ve){let je=await ri(fe,W,ye.signal);if(je.type==="aborted")return;if(je.type==="error"){let{error:Dt}=at(W,je);Ye(z,q,Dt,{flushSync:Ee});return}else if(je.matches)fe=je.matches,re=ff(fe,W);else{Ye(z,q,un(404,{pathname:W}),{flushSync:Ee});return}}A.set(z,we);let Ae=T,He=(await Nn("loader",ye,[re],fe))[0];if(wa(He)&&(He=await B8(He,ye.signal,!0)||He),A.get(z)===we&&A.delete(z),!ye.signal.aborted){if(F.has(z)){Zr(z,yo(void 0));return}if(Ea(He))if(O>Ae){Zr(z,yo(void 0));return}else{S.add(z),await st(ye,He);return}if(jn(He)){Ye(z,q,He.error);return}Ge(!wa(He),"Unhandled fetcher deferred data"),Zr(z,yo(He.data))}}async function st(z,q,W){let{submission:re,fetcherSubmission:fe,replace:ve}=W===void 0?{}:W;q.response.headers.has("X-Remix-Revalidate")&&(v=!0);let Ee=q.response.headers.get("Location");Ge(Ee,"Expected a Location header on the redirect Response"),Ee=TS(Ee,new URL(z.url),l);let ae=iu(I.location,Ee,{_isRedirect:!0});if(r){let He=!1;if(q.response.headers.has("X-Remix-Reload-Document"))He=!0;else if(hx.test(Ee)){const je=t.history.createURL(Ee);He=je.origin!==e.location.origin||Lu(je.pathname,l)==null}if(He){ve?e.location.replace(Ee):e.location.assign(Ee);return}}U=null;let ge=ve===!0||q.response.headers.has("X-Remix-Replace")?vr.Replace:vr.Push,{formMethod:we,formAction:ye,formEncType:Ae}=I.navigation;!re&&!fe&&we&&ye&&Ae&&(re=LS(I.navigation));let Be=re||fe;if($z.has(q.response.status)&&Be&&Pi(Be.formMethod))await sr(ge,ae,{submission:Jt({},Be,{formAction:Ee}),preventScrollReset:L});else{let He=Dv(ae,re);await sr(ge,ae,{overrideNavigation:He,fetcherSubmission:fe,preventScrollReset:L})}}async function Nn(z,q,W,re){try{let fe=await qz(c,z,q,W,re,s,i);return await Promise.all(fe.map((ve,Ee)=>{if(Jz(ve)){let ae=ve.result;return{type:At.redirect,response:Gz(ae,q,W[Ee].route.id,re,l,u.v7_relativeSplatPath)}}return Wz(ve)}))}catch(fe){return W.map(()=>({type:At.error,error:fe}))}}async function mt(z,q,W,re,fe){let[ve,...Ee]=await Promise.all([W.length?Nn("loader",fe,W,q):[],...re.map(ae=>{if(ae.matches&&ae.match&&ae.controller){let ge=ll(t.history,ae.path,ae.controller.signal);return Nn("loader",ge,[ae.match],ae.matches).then(we=>we[0])}else return Promise.resolve({type:At.error,error:un(404,{pathname:ae.path})})})]);return await Promise.all([DS(z,W,ve,ve.map(()=>fe.signal),!1,I.loaderData),DS(z,re.map(ae=>ae.match),Ee,re.map(ae=>ae.controller?ae.controller.signal:null),!0)]),{loaderResults:ve,fetcherResults:Ee}}function ut(){v=!0,_.push(...bi()),g.forEach((z,q)=>{A.has(q)&&(k.add(q),Je(q))})}function Zr(z,q,W){W===void 0&&(W={}),I.fetchers.set(z,q),te({fetchers:new Map(I.fetchers)},{flushSync:(W&&W.flushSync)===!0})}function Ye(z,q,W,re){re===void 0&&(re={});let fe=Ol(I.matches,q);ti(z),te({errors:{[fe.route.id]:W},fetchers:new Map(I.fetchers)},{flushSync:(re&&re.flushSync)===!0})}function gt(z){return u.v7_fetcherPersist&&(R.set(z,(R.get(z)||0)+1),F.has(z)&&F.delete(z)),I.fetchers.get(z)||Dz}function ti(z){let q=I.fetchers.get(z);A.has(z)&&!(q&&q.state==="loading"&&D.has(z))&&Je(z),g.delete(z),D.delete(z),S.delete(z),F.delete(z),k.delete(z),I.fetchers.delete(z)}function Rt(z){if(u.v7_fetcherPersist){let q=(R.get(z)||0)-1;q<=0?(R.delete(z),F.add(z)):R.set(z,q)}else ti(z);te({fetchers:new Map(I.fetchers)})}function Je(z){let q=A.get(z);Ge(q,"Expected fetch controller: "+z),q.abort(),A.delete(z)}function Fi(z){for(let q of z){let W=gt(q),re=yo(W.data);I.fetchers.set(q,re)}}function xt(){let z=[],q=!1;for(let W of S){let re=I.fetchers.get(W);Ge(re,"Expected fetcher: "+W),re.state==="loading"&&(S.delete(W),z.push(W),q=!0)}return Fi(z),q}function bt(z){let q=[];for(let[W,re]of D)if(re0}function ws(z,q){let W=I.blockers.get(z)||Wc;return B.get(z)!==q&&B.set(z,q),W}function wt(z){I.blockers.delete(z),B.delete(z)}function ot(z,q){let W=I.blockers.get(z)||Wc;Ge(W.state==="unblocked"&&q.state==="blocked"||W.state==="blocked"&&q.state==="blocked"||W.state==="blocked"&&q.state==="proceeding"||W.state==="blocked"&&q.state==="unblocked"||W.state==="proceeding"&&q.state==="unblocked","Invalid blocker state transition: "+W.state+" -> "+q.state);let re=new Map(I.blockers);re.set(z,q),te({blockers:re})}function Bi(z){let{currentLocation:q,nextLocation:W,historyAction:re}=z;if(B.size===0)return;B.size>1&&Ba(!1,"A router only supports one blocker at a time");let fe=Array.from(B.entries()),[ve,Ee]=fe[fe.length-1],ae=I.blockers.get(ve);if(!(ae&&ae.state==="proceeding")&&Ee({currentLocation:q,nextLocation:W,historyAction:re}))return ve}function dt(z){let q=un(404,{pathname:z}),W=a||o,{matches:re,route:fe}=MS(W);return bi(),{notFoundMatches:re,route:fe,error:q}}function at(z,q){return{boundaryId:Ol(q.partialMatches).route.id,error:un(400,{type:"route-discovery",pathname:z,message:q.error!=null&&"message"in q.error?q.error:String(q.error)})}}function bi(z){let q=[];return C.forEach((W,re)=>{(!z||z(re))&&(W.cancel(),q.push(re),C.delete(re))}),q}function It(z,q,W){if(p=z,x=q,m=W||null,!b&&I.navigation===$v){b=!0;let re=St(I.location,I.matches);re!=null&&te({restoreScrollPosition:re})}return()=>{p=null,x=null,m=null}}function Et(z,q){return m&&m(z,q.map(re=>uz(re,I.loaderData)))||z.key}function Es(z,q){if(p&&x){let W=Et(z,q);p[W]=x()}}function St(z,q){if(p){let W=Et(z,q),re=p[W];if(typeof re=="number")return re}return null}function lt(z,q,W){if(f)if(z){let re=z[z.length-1].route;if(re.path&&(re.path==="*"||re.path.endsWith("/*")))return{active:!0,matches:rh(q,W,l,!0)}}else return{active:!0,matches:rh(q,W,l,!0)||[]};return{active:!1,matches:null}}async function ri(z,q,W){let re=z,fe=re.length>0?re[re.length-1].route:null;for(;;){let ve=a==null,Ee=a||o;try{await zz(f,q,re,Ee,s,i,V,W)}catch(ye){return{type:"error",error:ye,partialMatches:re}}finally{ve&&(o=[...o])}if(W.aborted)return{type:"aborted"};let ae=ya(Ee,q,l),ge=!1;if(ae){let ye=ae[ae.length-1].route;if(ye.index)return{type:"success",matches:ae};if(ye.path&&ye.path.length>0)if(ye.path==="*")ge=!0;else return{type:"success",matches:ae}}let we=rh(Ee,q,l,!0);if(!we||re.map(ye=>ye.route.id).join("-")===we.map(ye=>ye.route.id).join("-"))return{type:"success",matches:ge?ae:null};if(re=we,fe=re[re.length-1].route,fe.path==="*")return{type:"success",matches:re}}}function Ot(z){s={},a=su(z,i,void 0,s)}function Mt(z,q){let W=a==null;L8(z,q,a||o,s,i),W&&(o=[...o],te({}))}return N={get basename(){return l},get future(){return u},get state(){return I},get routes(){return o},get window(){return e},initialize:Z,subscribe:ne,enableScrollRestoration:It,navigate:pe,fetch:rt,revalidate:ke,createHref:z=>t.history.createHref(z),encodeLocation:z=>t.history.encodeLocation(z),getFetcher:gt,deleteFetcher:Rt,dispose:le,getBlocker:ws,deleteBlocker:wt,patchRoutes:Mt,_internalFetchControllers:A,_internalActiveDeferreds:C,_internalSetRoutes:Ot},N}function Fz(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Vy(t,e,r,n,i,s,o,a){let l,c;if(o){l=[];for(let u of e)if(l.push(u),u.route.id===o){c=u;break}}else l=e,c=e[e.length-1];let f=_z(i||".",Cz(l,s),Lu(t.pathname,r)||t.pathname,a==="path");return i==null&&(f.search=t.search,f.hash=t.hash),(i==null||i===""||i===".")&&c&&c.route.index&&!vx(f.search)&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),n&&r!=="/"&&(f.pathname=f.pathname==="/"?r:Ra([r,f.pathname])),Du(f)}function kS(t,e,r,n){if(!n||!Fz(n))return{path:r};if(n.formMethod&&!Zz(n.formMethod))return{path:r,error:un(405,{method:n.formMethod})};let i=()=>({path:r,error:un(400,{type:"invalid-body"})}),s=n.formMethod||"get",o=t?s.toUpperCase():s.toLowerCase(),a=j8(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Pi(o))return i();let d=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((h,p)=>{let[m,x]=p;return""+h+m+"="+x+` `},""):String(n.body);return{path:r,submission:{formMethod:o,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:d}}}else if(n.formEncType==="application/json"){if(!Pi(o))return i();try{let d=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:o,formAction:a,formEncType:n.formEncType,formData:void 0,json:d,text:void 0}}}catch{return i()}}}Ge(typeof FormData=="function","FormData is not available in this environment");let l,c;if(n.formData)l=qy(n.formData),c=n.formData;else if(n.body instanceof FormData)l=qy(n.body),c=n.body;else if(n.body instanceof URLSearchParams)l=n.body,c=PS(l);else if(n.body==null)l=new URLSearchParams,c=new FormData;else try{l=new URLSearchParams(n.body),c=PS(l)}catch{return i()}let f={formMethod:o,formAction:a,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(Pi(f.formMethod))return{path:r,submission:f};let u=gs(r);return e&&u.search&&vx(u.search)&&l.append("index",""),u.search="?"+l,{path:Du(u),submission:f}}function Bz(t,e){let r=t;if(e){let n=t.findIndex(i=>i.route.id===e);n>=0&&(r=t.slice(0,n))}return r}function AS(t,e,r,n,i,s,o,a,l,c,f,u,d,h,p,m){let x=m?jn(m[1])?m[1].error:m[1].data:void 0,b=t.createURL(e.location),w=t.createURL(i),E=m&&jn(m[1])?m[0]:void 0,P=E?Bz(r,E):r,N=m?m[1].statusCode:void 0,I=o&&N&&N>=400,j=P.filter((U,K)=>{let{route:X}=U;if(X.lazy)return!0;if(X.loader==null)return!1;if(s)return typeof X.loader!="function"||X.loader.hydrate?!0:e.loaderData[X.id]===void 0&&(!e.errors||e.errors[X.id]===void 0);if(Uz(e.loaderData,e.matches[K],U)||l.some(v=>v===U.route.id))return!0;let ee=e.matches[K],M=U;return CS(U,Jt({currentUrl:b,currentParams:ee.params,nextUrl:w,nextParams:M.params},n,{actionResult:x,actionStatus:N,defaultShouldRevalidate:I?!1:a||b.pathname+b.search===w.pathname+w.search||b.search!==w.search||D8(ee,M)}))}),L=[];return u.forEach((U,K)=>{if(s||!r.some(_=>_.route.id===U.routeId)||f.has(K))return;let X=ya(h,U.path,p);if(!X){L.push({key:K,routeId:U.routeId,path:U.path,matches:null,match:null,controller:null});return}let ee=e.fetchers.get(K),M=ff(X,U.path),v=!1;d.has(K)?v=!1:c.has(K)?(c.delete(K),v=!0):ee&&ee.state!=="idle"&&ee.data===void 0?v=a:v=CS(M,Jt({currentUrl:b,currentParams:e.matches[e.matches.length-1].params,nextUrl:w,nextParams:r[r.length-1].params},n,{actionResult:x,actionStatus:N,defaultShouldRevalidate:I?!1:a})),v&&L.push({key:K,routeId:U.routeId,path:U.path,matches:X,match:M,controller:new AbortController})}),[j,L]}function Uz(t,e,r){let n=!e||r.route.id!==e.route.id,i=t[r.route.id]===void 0;return n||i}function D8(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function CS(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}async function zz(t,e,r,n,i,s,o,a){let l=[e,...r.map(c=>c.route.id)].join("-");try{let c=o.get(l);c||(c=t({path:e,matches:r,patch:(f,u)=>{a.aborted||L8(f,u,n,i,s)}}),o.set(l,c)),c&&Qz(c)&&await c}finally{o.delete(l)}}function L8(t,e,r,n,i){if(t){var s;let o=n[t];Ge(o,"No route found to patch children into: routeId = "+t);let a=su(e,i,[t,"patch",String(((s=o.children)==null?void 0:s.length)||"0")],n);o.children?o.children.push(...a):o.children=a}else{let o=su(e,i,["patch",String(r.length||"0")],n);r.push(...o)}}async function _S(t,e,r){if(!t.lazy)return;let n=await t.lazy();if(!t.lazy)return;let i=r[t.id];Ge(i,"No route found in manifest");let s={};for(let o in n){let l=i[o]!==void 0&&o!=="hasErrorBoundary";Ba(!l,'Route "'+i.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!l&&!cz.has(o)&&(s[o]=n[o])}Object.assign(i,s),Object.assign(i,Jt({},e(i),{lazy:void 0}))}function Vz(t){return Promise.all(t.matches.map(e=>e.resolve()))}async function qz(t,e,r,n,i,s,o,a){let l=n.reduce((u,d)=>u.add(d.route.id),new Set),c=new Set,f=await t({matches:i.map(u=>{let d=l.has(u.route.id);return Jt({},u,{shouldLoad:d,resolve:p=>(c.add(u.route.id),d?Hz(e,r,u,s,o,p,a):Promise.resolve({type:At.data,result:void 0}))})}),request:r,params:i[0].params,context:a});return i.forEach(u=>Ge(c.has(u.route.id),'`match.resolve()` was not called for route id "'+u.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),f.filter((u,d)=>l.has(i[d].route.id))}async function Hz(t,e,r,n,i,s,o){let a,l,c=f=>{let u,d=new Promise((m,x)=>u=x);l=()=>u(),e.signal.addEventListener("abort",l);let h=m=>typeof f!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+r.route.id+"]"))):f({request:e,params:r.params,context:o},...m!==void 0?[m]:[]),p;return s?p=s(m=>h(m)):p=(async()=>{try{return{type:"data",result:await h()}}catch(m){return{type:"error",result:m}}})(),Promise.race([p,d])};try{let f=r.route[t];if(r.route.lazy)if(f){let u,[d]=await Promise.all([c(f).catch(h=>{u=h}),_S(r.route,i,n)]);if(u!==void 0)throw u;a=d}else if(await _S(r.route,i,n),f=r.route[t],f)a=await c(f);else if(t==="action"){let u=new URL(e.url),d=u.pathname+u.search;throw un(405,{method:e.method,pathname:d,routeId:r.route.id})}else return{type:At.data,result:void 0};else if(f)a=await c(f);else{let u=new URL(e.url),d=u.pathname+u.search;throw un(404,{pathname:d})}Ge(a.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(f){return{type:At.error,result:f}}finally{l&&e.signal.removeEventListener("abort",l)}return a}async function Wz(t){let{result:e,type:r}=t;if(F8(e)){let c;try{let f=e.headers.get("Content-Type");f&&/\bapplication\/json\b/.test(f)?e.body==null?c=null:c=await e.json():c=await e.text()}catch(f){return{type:At.error,error:f}}return r===At.error?{type:At.error,error:new t0(e.status,e.statusText,c),statusCode:e.status,headers:e.headers}:{type:At.data,data:c,statusCode:e.status,headers:e.headers}}if(r===At.error){if($S(e)){var n;if(e.data instanceof Error){var i;return{type:At.error,error:e.data,statusCode:(i=e.init)==null?void 0:i.status}}e=new t0(((n=e.init)==null?void 0:n.status)||500,void 0,e.data)}return{type:At.error,error:e,statusCode:p1(e)?e.status:void 0}}if(Xz(e)){var s,o;return{type:At.deferred,deferredData:e,statusCode:(s=e.init)==null?void 0:s.status,headers:((o=e.init)==null?void 0:o.headers)&&new Headers(e.init.headers)}}if($S(e)){var a,l;return{type:At.data,data:e.data,statusCode:(a=e.init)==null?void 0:a.status,headers:(l=e.init)!=null&&l.headers?new Headers(e.init.headers):void 0}}return{type:At.data,data:e}}function Gz(t,e,r,n,i,s){let o=t.headers.get("Location");if(Ge(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!hx.test(o)){let a=n.slice(0,n.findIndex(l=>l.route.id===r)+1);o=Vy(new URL(e.url),a,i,!0,o,s),t.headers.set("Location",o)}return t}function TS(t,e,r){if(hx.test(t)){let n=t,i=n.startsWith("//")?new URL(e.protocol+n):new URL(n),s=Lu(i.pathname,r)!=null;if(i.origin===e.origin&&s)return i.pathname+i.search+i.hash}return t}function ll(t,e,r,n){let i=t.createURL(j8(e)).toString(),s={signal:r};if(n&&Pi(n.formMethod)){let{formMethod:o,formEncType:a}=n;s.method=o.toUpperCase(),a==="application/json"?(s.headers=new Headers({"Content-Type":a}),s.body=JSON.stringify(n.json)):a==="text/plain"?s.body=n.text:a==="application/x-www-form-urlencoded"&&n.formData?s.body=qy(n.formData):s.body=n.formData}return new Request(i,s)}function qy(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function PS(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function Kz(t,e,r,n,i,s){let o={},a=null,l,c=!1,f={},u=n&&jn(n[1])?n[1].error:void 0;return r.forEach((d,h)=>{let p=e[h].route.id;if(Ge(!Ea(d),"Cannot handle redirect results in processLoaderData"),jn(d)){let m=d.error;if(u!==void 0&&(m=u,u=void 0),a=a||{},s)a[p]=m;else{let x=Ol(t,p);a[x.route.id]==null&&(a[x.route.id]=m)}o[p]=void 0,c||(c=!0,l=p1(d.error)?d.error.status:500),d.headers&&(f[p]=d.headers)}else wa(d)?(i.set(p,d.deferredData),o[p]=d.deferredData.data,d.statusCode!=null&&d.statusCode!==200&&!c&&(l=d.statusCode),d.headers&&(f[p]=d.headers)):(o[p]=d.data,d.statusCode&&d.statusCode!==200&&!c&&(l=d.statusCode),d.headers&&(f[p]=d.headers))}),u!==void 0&&n&&(a={[n[0]]:u},o[n[0]]=void 0),{loaderData:o,errors:a,statusCode:l||200,loaderHeaders:f}}function RS(t,e,r,n,i,s,o,a){let{loaderData:l,errors:c}=Kz(e,r,n,i,a,!1);for(let f=0;fn.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function MS(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function un(t,e){let{pathname:r,routeId:n,method:i,type:s,message:o}=e===void 0?{}:e,a="Unknown Server Error",l="Unknown @remix-run/router error";return t===400?(a="Bad Request",s==="route-discovery"?l='Unable to match URL "'+r+'" - the `unstable_patchRoutesOnMiss()` '+(`function threw the following error: `+o):i&&r&&n?l="You made a "+i+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":s==="defer-action"?l="defer() is not supported in actions":s==="invalid-body"&&(l="Unable to encode submission body")):t===403?(a="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):t===404?(a="Not Found",l='No route matches URL "'+r+'"'):t===405&&(a="Method Not Allowed",i&&r&&n?l="You made a "+i.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":i&&(l='Invalid request method "'+i.toUpperCase()+'"')),new t0(t||500,a,new Error(l),!0)}function NS(t){for(let e=t.length-1;e>=0;e--){let r=t[e];if(Ea(r))return{result:r,idx:e}}}function j8(t){let e=typeof t=="string"?gs(t):t;return Du(Jt({},e,{hash:""}))}function Yz(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function Qz(t){return typeof t=="object"&&t!=null&&"then"in t}function Jz(t){return F8(t.result)&&Nz.has(t.result.status)}function wa(t){return t.type===At.deferred}function jn(t){return t.type===At.error}function Ea(t){return(t&&t.type)===At.redirect}function $S(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Xz(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function F8(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Zz(t){return Mz.has(t.toLowerCase())}function Pi(t){return Iz.has(t.toLowerCase())}async function DS(t,e,r,n,i,s){for(let o=0;ou.route.id===l.route.id),f=c!=null&&!D8(c,l)&&(s&&s[l.route.id])!==void 0;if(wa(a)&&(i||f)){let u=n[o];Ge(u,"Expected an AbortSignal for revalidating fetcher deferred result"),await B8(a,u,i).then(d=>{d&&(r[o]=d||r[o])})}}}async function B8(t,e,r){if(r===void 0&&(r=!1),!await t.deferredData.resolveData(e)){if(r)try{return{type:At.data,data:t.deferredData.unwrappedData}}catch(i){return{type:At.error,error:i}}return{type:At.data,data:t.deferredData.data}}}function vx(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function ff(t,e){let r=typeof e=="string"?gs(e).search:e.search;if(t[t.length-1].route.index&&vx(r||""))return t[t.length-1];let n=M8(t);return n[n.length-1]}function LS(t){let{formMethod:e,formAction:r,formEncType:n,text:i,formData:s,json:o}=t;if(!(!e||!r||!n)){if(i!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:i};if(s!=null)return{formMethod:e,formAction:r,formEncType:n,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:o,text:void 0}}}function Dv(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function eV(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Gc(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function tV(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function yo(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function rV(t,e){try{let r=t.sessionStorage.getItem($8);if(r){let n=JSON.parse(r);for(let[i,s]of Object.entries(n||{}))s&&Array.isArray(s)&&e.set(i,new Set(s||[]))}}catch{}}function nV(t,e){if(e.size>0){let r={};for(let[n,i]of e)r[n]=[...i];try{t.sessionStorage.setItem($8,JSON.stringify(r))}catch(n){Ba(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/** * React Router v6.26.0 @@ -123,7 +123,7 @@ Defaulting to \`null\`.`}const a8="Radio",[QF,l8]=cn(a8),[JF,XF]=QF(a8),ZF=y.for * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function r0(){return r0=Object.assign?Object.assign.bind():function(t){for(var e=1;eObject.assign({},x,{params:Object.assign({},a,x.params),pathname:Ra([l,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:Ra([l,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,r,n);return e&&m?y.createElement(y1.Provider,{value:{location:r0({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:hr.Pop}},m):m}function oV(){let t=vV(),e=p1(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},s=null;return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),r?y.createElement("pre",{style:i},r):null,s)}const aV=y.createElement(oV,null);class lV extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?y.createElement(m1.Provider,{value:this.props.routeContext},y.createElement(q8.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function cV(t){let{routeContext:e,match:r,children:n}=t,i=y.useContext(U8);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),y.createElement(m1.Provider,{value:e},n)}function fV(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,a=(i=r)==null?void 0:i.errors;if(a!=null){let f=o.findIndex(u=>u.route.id&&(a==null?void 0:a[u.route.id])!==void 0);f>=0||Ge(!1),o=o.slice(0,Math.min(o.length,f+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((f,u,d)=>{let h,p=!1,m=null,x=null;r&&(h=a&&u.route.id?a[u.route.id]:void 0,m=u.route.errorElement||aV,l&&(c<0&&d===0?(pV("route-fallback",!1),p=!0,x=null):c===d&&(p=!0,x=u.route.hydrateFallbackElement||null)));let b=e.concat(o.slice(0,d+1)),w=()=>{let E;return h?E=m:p?E=x:u.route.Component?E=y.createElement(u.route.Component,null):u.route.element?E=u.route.element:E=f,y.createElement(cV,{match:u,routeContext:{outlet:f,matches:b,isDataRoute:r!=null},children:E})};return r&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?y.createElement(lV,{location:r.location,revalidation:r.revalidation,component:m,error:h,children:w(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):w()},null)}var Hy=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Hy||{});function uV(t){let e=y.useContext(z8);return e||Ge(!1),e}function dV(t){let e=y.useContext(m1);return e||Ge(!1),e}function hV(t){let e=dV(),r=e.matches[e.matches.length-1];return r.route.id||Ge(!1),r.route.id}function vV(){var t;let e=y.useContext(q8),r=uV(Hy.UseRouteError),n=hV(Hy.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}const jS={};function pV(t,e,r){!e&&!jS[t]&&(jS[t]=!0)}function yV(t){let{basename:e="/",children:r=null,location:n,navigationType:i=hr.Pop,navigator:s,static:o=!1,future:a}=t;px()&&Ge(!1);let l=e.replace(/^\/*/,"/"),c=y.useMemo(()=>({basename:l,navigator:s,static:o,future:r0({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof n=="string"&&(n=gs(n));let{pathname:f="/",search:u="",hash:d="",state:h=null,key:p="default"}=n,m=y.useMemo(()=>{let x=Lu(f,l);return x==null?null:{location:{pathname:x,search:u,hash:d,state:h,key:p},navigationType:i}},[l,f,u,d,h,p,i]);return m==null?null:y.createElement(V8.Provider,{value:c},y.createElement(y1.Provider,{children:r,value:m}))}new Promise(()=>{});function mV(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:y.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:y.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:y.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}/** + */function r0(){return r0=Object.assign?Object.assign.bind():function(t){for(var e=1;eObject.assign({},x,{params:Object.assign({},a,x.params),pathname:Ra([l,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:Ra([l,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,r,n);return e&&m?y.createElement(y1.Provider,{value:{location:r0({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:vr.Pop}},m):m}function oV(){let t=vV(),e=p1(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},s=null;return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),r?y.createElement("pre",{style:i},r):null,s)}const aV=y.createElement(oV,null);class lV extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?y.createElement(m1.Provider,{value:this.props.routeContext},y.createElement(q8.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function cV(t){let{routeContext:e,match:r,children:n}=t,i=y.useContext(U8);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),y.createElement(m1.Provider,{value:e},n)}function fV(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,a=(i=r)==null?void 0:i.errors;if(a!=null){let f=o.findIndex(u=>u.route.id&&(a==null?void 0:a[u.route.id])!==void 0);f>=0||Ge(!1),o=o.slice(0,Math.min(o.length,f+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((f,u,d)=>{let h,p=!1,m=null,x=null;r&&(h=a&&u.route.id?a[u.route.id]:void 0,m=u.route.errorElement||aV,l&&(c<0&&d===0?(pV("route-fallback",!1),p=!0,x=null):c===d&&(p=!0,x=u.route.hydrateFallbackElement||null)));let b=e.concat(o.slice(0,d+1)),w=()=>{let E;return h?E=m:p?E=x:u.route.Component?E=y.createElement(u.route.Component,null):u.route.element?E=u.route.element:E=f,y.createElement(cV,{match:u,routeContext:{outlet:f,matches:b,isDataRoute:r!=null},children:E})};return r&&(u.route.ErrorBoundary||u.route.errorElement||d===0)?y.createElement(lV,{location:r.location,revalidation:r.revalidation,component:m,error:h,children:w(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):w()},null)}var Hy=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Hy||{});function uV(t){let e=y.useContext(z8);return e||Ge(!1),e}function dV(t){let e=y.useContext(m1);return e||Ge(!1),e}function hV(t){let e=dV(),r=e.matches[e.matches.length-1];return r.route.id||Ge(!1),r.route.id}function vV(){var t;let e=y.useContext(q8),r=uV(Hy.UseRouteError),n=hV(Hy.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}const jS={};function pV(t,e,r){!e&&!jS[t]&&(jS[t]=!0)}function yV(t){let{basename:e="/",children:r=null,location:n,navigationType:i=vr.Pop,navigator:s,static:o=!1,future:a}=t;px()&&Ge(!1);let l=e.replace(/^\/*/,"/"),c=y.useMemo(()=>({basename:l,navigator:s,static:o,future:r0({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof n=="string"&&(n=gs(n));let{pathname:f="/",search:u="",hash:d="",state:h=null,key:p="default"}=n,m=y.useMemo(()=>{let x=Lu(f,l);return x==null?null:{location:{pathname:x,search:u,hash:d,state:h,key:p},navigationType:i}},[l,f,u,d,h,p,i]);return m==null?null:y.createElement(V8.Provider,{value:c},y.createElement(y1.Provider,{children:r,value:m}))}new Promise(()=>{});function mV(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:y.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:y.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:y.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}/** * React Router DOM v6.26.0 * * Copyright (c) Remix Software Inc. @@ -132,7 +132,7 @@ Defaulting to \`null\`.`}const a8="Radio",[QF,l8]=cn(a8),[JF,XF]=QF(a8),ZF=y.for * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function n0(){return n0=Object.assign?Object.assign.bind():function(t){for(var e=1;e{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function TV(t){let{fallbackElement:e,router:r,future:n}=t,[i,s]=y.useState(r.state),[o,a]=y.useState(),[l,c]=y.useState({isTransitioning:!1}),[f,u]=y.useState(),[d,h]=y.useState(),[p,m]=y.useState(),x=y.useRef(new Map),{v7_startTransition:b}=n||{},w=y.useCallback(L=>{b?CV(L):L()},[b]),E=y.useCallback((L,U)=>{let{deletedFetchers:K,unstable_flushSync:X,unstable_viewTransitionOpts:ee}=U;K.forEach(v=>x.current.delete(v)),L.fetchers.forEach((v,_)=>{v.data!==void 0&&x.current.set(_,v.data)});let M=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!ee||M){X?Kc(()=>s(L)):w(()=>s(L));return}if(X){Kc(()=>{d&&(f&&f.resolve(),d.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation})});let v=r.window.document.startViewTransition(()=>{Kc(()=>s(L))});v.finished.finally(()=>{Kc(()=>{u(void 0),h(void 0),a(void 0),c({isTransitioning:!1})})}),Kc(()=>h(v));return}d?(f&&f.resolve(),d.skipTransition(),m({state:L,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation})):(a(L),c({isTransitioning:!0,flushSync:!1,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation}))},[r.window,d,f,x,w]);y.useLayoutEffect(()=>r.subscribe(E),[r,E]),y.useEffect(()=>{l.isTransitioning&&!l.flushSync&&u(new _V)},[l]),y.useEffect(()=>{if(f&&o&&r.window){let L=o,U=f.promise,K=r.window.document.startViewTransition(async()=>{w(()=>s(L)),await U});K.finished.finally(()=>{u(void 0),h(void 0),a(void 0),c({isTransitioning:!1})}),h(K)}},[w,o,f,r.window]),y.useEffect(()=>{f&&o&&i.location.key===o.location.key&&f.resolve()},[f,d,i.location,o]),y.useEffect(()=>{!l.isTransitioning&&p&&(a(p.state),c({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),m(void 0))},[l.isTransitioning,p]),y.useEffect(()=>{},[]);let P=y.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:L=>r.navigate(L),push:(L,U,K)=>r.navigate(L,{state:U,preventScrollReset:K==null?void 0:K.preventScrollReset}),replace:(L,U,K)=>r.navigate(L,{replace:!0,state:U,preventScrollReset:K==null?void 0:K.preventScrollReset})}),[r]),N=r.basename||"/",I=y.useMemo(()=>({router:r,navigator:P,static:!1,basename:N}),[r,P,N]),j=y.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return y.createElement(y.Fragment,null,y.createElement(U8.Provider,{value:I},y.createElement(z8.Provider,{value:i},y.createElement(SV.Provider,{value:x.current},y.createElement(EV.Provider,{value:l},y.createElement(yV,{basename:N,location:i.location,navigationType:i.historyAction,navigator:P,future:j},i.initialized||r.future.v7_partialHydration?y.createElement(PV,{routes:r.routes,future:r.future,state:i}):e))))),null)}const PV=y.memo(RV);function RV(t){let{routes:e,future:r,state:n}=t;return sV(e,void 0,n,r)}var US;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(US||(US={}));var zS;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(zS||(zS={}));function IV(t={}){const{nonce:e,onScriptLoadSuccess:r,onScriptLoadError:n}=t,[i,s]=y.useState(!1),o=y.useRef(r);o.current=r;const a=y.useRef(n);return a.current=n,y.useEffect(()=>{const l=document.createElement("script");return l.src="https://accounts.google.com/gsi/client",l.async=!0,l.defer=!0,l.nonce=e,l.onload=()=>{var c;s(!0),(c=o.current)===null||c===void 0||c.call(o)},l.onerror=()=>{var c;s(!1),(c=a.current)===null||c===void 0||c.call(a)},document.body.appendChild(l),()=>{document.body.removeChild(l)}},[e]),i}const H8=y.createContext(null);function OV({clientId:t,nonce:e,onScriptLoadSuccess:r,onScriptLoadError:n,children:i}){const s=IV({nonce:e,onScriptLoadSuccess:r,onScriptLoadError:n}),o=y.useMemo(()=>({clientId:t,scriptLoadedSuccessfully:s}),[t,s]);return vr.createElement(H8.Provider,{value:o},i)}function W8(){const t=y.useContext(H8);if(!t)throw new Error("Google OAuth components must be used within GoogleOAuthProvider");return t}function MV(t){var e;return(e=t==null?void 0:t.clientId)!==null&&e!==void 0?e:t==null?void 0:t.client_id}const NV={large:40,medium:32,small:20};function G8({onSuccess:t,onError:e,useOneTap:r,promptMomentNotification:n,type:i="standard",theme:s="outline",size:o="large",text:a,shape:l,logo_alignment:c,width:f,locale:u,click_listener:d,containerProps:h,...p}){const m=y.useRef(null),{clientId:x,scriptLoadedSuccessfully:b}=W8(),w=y.useRef(t);w.current=t;const E=y.useRef(e);E.current=e;const P=y.useRef(n);return P.current=n,y.useEffect(()=>{var N,I,j,L,U,K,X,ee,M;if(b)return(j=(I=(N=window==null?void 0:window.google)===null||N===void 0?void 0:N.accounts)===null||I===void 0?void 0:I.id)===null||j===void 0||j.initialize({client_id:x,callback:v=>{var _;if(!(v!=null&&v.credential))return(_=E.current)===null||_===void 0?void 0:_.call(E);const{credential:k,select_by:A}=v;w.current({credential:k,clientId:MV(v),select_by:A})},...p}),(K=(U=(L=window==null?void 0:window.google)===null||L===void 0?void 0:L.accounts)===null||U===void 0?void 0:U.id)===null||K===void 0||K.renderButton(m.current,{type:i,theme:s,size:o,text:a,shape:l,logo_alignment:c,width:f,locale:u,click_listener:d}),r&&((M=(ee=(X=window==null?void 0:window.google)===null||X===void 0?void 0:X.accounts)===null||ee===void 0?void 0:ee.id)===null||M===void 0||M.prompt(P.current)),()=>{var v,_,k;r&&((k=(_=(v=window==null?void 0:window.google)===null||v===void 0?void 0:v.accounts)===null||_===void 0?void 0:_.id)===null||k===void 0||k.cancel())}},[x,b,r,i,s,o,a,l,c,f,u]),vr.createElement("div",{...h,ref:m,style:{height:NV[o],...h==null?void 0:h.style}})}function $V(){var t,e,r;(r=(e=(t=window==null?void 0:window.google)===null||t===void 0?void 0:t.accounts)===null||e===void 0?void 0:e.id)===null||r===void 0||r.disableAutoSelect()}function K8({flow:t="implicit",scope:e="",onSuccess:r,onError:n,onNonOAuthError:i,overrideScope:s,state:o,...a}){const{clientId:l,scriptLoadedSuccessfully:c}=W8(),f=y.useRef(),u=y.useRef(r);u.current=r;const d=y.useRef(n);d.current=n;const h=y.useRef(i);h.current=i,y.useEffect(()=>{var x;if(!c)return;const b=t==="implicit"?"initTokenClient":"initCodeClient",w=(x=window==null?void 0:window.google)===null||x===void 0?void 0:x.accounts.oauth2[b]({client_id:l,scope:s?e:`openid profile email ${e}`,callback:E=>{var P,N;if(E.error)return(P=d.current)===null||P===void 0?void 0:P.call(d,E);(N=u.current)===null||N===void 0||N.call(u,E)},error_callback:E=>{var P;(P=h.current)===null||P===void 0||P.call(h,E)},state:o,...a});f.current=w},[l,c,t,e,o]);const p=y.useCallback(x=>{var b;return(b=f.current)===null||b===void 0?void 0:b.requestAccessToken(x)},[]),m=y.useCallback(()=>{var x;return(x=f.current)===null||x===void 0?void 0:x.requestCode()},[]);return t==="implicit"?p:m}var Y8={},g1={},ju={};Object.defineProperty(ju,"__esModule",{value:!0});ju.default=void 0;var DV=y;function LV(t){(0,DV.useEffect)(function(){if(t){var e=document.querySelectorAll('script[src="'.concat(t,'"]'))[0];e||(e=document.createElement("script"),e.src=t,e.async=!0,document.body.appendChild(e))}},[t])}var jV=LV;ju.default=jV;var Fu={},x1={};Object.defineProperty(x1,"__esModule",{value:!0});x1.default=void 0;var FV=function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{pollFrequency:1e3,retries:100,parent:window},n=r.pollFrequency,i=n===void 0?1e3:n,s=r.retries,o=s===void 0?100:s,a=r.parent,l=a===void 0?window:a;if(l&&l.hasOwnProperty(e))return Promise.resolve(l[e]);if(!o)return Promise.resolve(void 0);var c=o-1;return new Promise(function(f){return setTimeout(f,typeof i=="function"?i({retries:c}):i)}).then(function(){return t(e,{pollFrequency:i,parent:l,retries:c})})},BV=FV;x1.default=BV;Object.defineProperty(Fu,"__esModule",{value:!0});Fu.default=void 0;var UV=zV(x1);function zV(t){return t&&t.__esModule?t:{default:t}}var VV="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",qV=function(e){var r=e.authOptions,n=e.onSuccess,i=e.onError;return(0,UV.default)("AppleID").then(function(){return window.AppleID||console.error(new Error("Error loading apple script")),window.AppleID.auth.init(r),window.AppleID.auth.signIn().then(function(s){return n&&n(s),s}).catch(function(s){return i?i(s):console.error(s),null})}).catch(function(s){return i?i(s):console.error(s),null})},HV={APPLE_SCRIPT_SRC:VV,signIn:qV};Fu.default=HV;Object.defineProperty(g1,"__esModule",{value:!0});g1.default=void 0;var Hi=yx(y),WV=yx(ju),VS=yx(Fu),GV=["onSuccess","onError","skipScript","authOptions","iconProps","render","uiType","className","noDefaultStyle","buttonExtraChildren"];function yx(t){return t&&t.__esModule?t:{default:t}}function i0(){return i0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function JV(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var XV=` + */function n0(){return n0=Object.assign?Object.assign.bind():function(t){for(var e=1;e{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function TV(t){let{fallbackElement:e,router:r,future:n}=t,[i,s]=y.useState(r.state),[o,a]=y.useState(),[l,c]=y.useState({isTransitioning:!1}),[f,u]=y.useState(),[d,h]=y.useState(),[p,m]=y.useState(),x=y.useRef(new Map),{v7_startTransition:b}=n||{},w=y.useCallback(L=>{b?CV(L):L()},[b]),E=y.useCallback((L,U)=>{let{deletedFetchers:K,unstable_flushSync:X,unstable_viewTransitionOpts:ee}=U;K.forEach(v=>x.current.delete(v)),L.fetchers.forEach((v,_)=>{v.data!==void 0&&x.current.set(_,v.data)});let M=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!ee||M){X?Kc(()=>s(L)):w(()=>s(L));return}if(X){Kc(()=>{d&&(f&&f.resolve(),d.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation})});let v=r.window.document.startViewTransition(()=>{Kc(()=>s(L))});v.finished.finally(()=>{Kc(()=>{u(void 0),h(void 0),a(void 0),c({isTransitioning:!1})})}),Kc(()=>h(v));return}d?(f&&f.resolve(),d.skipTransition(),m({state:L,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation})):(a(L),c({isTransitioning:!0,flushSync:!1,currentLocation:ee.currentLocation,nextLocation:ee.nextLocation}))},[r.window,d,f,x,w]);y.useLayoutEffect(()=>r.subscribe(E),[r,E]),y.useEffect(()=>{l.isTransitioning&&!l.flushSync&&u(new _V)},[l]),y.useEffect(()=>{if(f&&o&&r.window){let L=o,U=f.promise,K=r.window.document.startViewTransition(async()=>{w(()=>s(L)),await U});K.finished.finally(()=>{u(void 0),h(void 0),a(void 0),c({isTransitioning:!1})}),h(K)}},[w,o,f,r.window]),y.useEffect(()=>{f&&o&&i.location.key===o.location.key&&f.resolve()},[f,d,i.location,o]),y.useEffect(()=>{!l.isTransitioning&&p&&(a(p.state),c({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),m(void 0))},[l.isTransitioning,p]),y.useEffect(()=>{},[]);let P=y.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:L=>r.navigate(L),push:(L,U,K)=>r.navigate(L,{state:U,preventScrollReset:K==null?void 0:K.preventScrollReset}),replace:(L,U,K)=>r.navigate(L,{replace:!0,state:U,preventScrollReset:K==null?void 0:K.preventScrollReset})}),[r]),N=r.basename||"/",I=y.useMemo(()=>({router:r,navigator:P,static:!1,basename:N}),[r,P,N]),j=y.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return y.createElement(y.Fragment,null,y.createElement(U8.Provider,{value:I},y.createElement(z8.Provider,{value:i},y.createElement(SV.Provider,{value:x.current},y.createElement(EV.Provider,{value:l},y.createElement(yV,{basename:N,location:i.location,navigationType:i.historyAction,navigator:P,future:j},i.initialized||r.future.v7_partialHydration?y.createElement(PV,{routes:r.routes,future:r.future,state:i}):e))))),null)}const PV=y.memo(RV);function RV(t){let{routes:e,future:r,state:n}=t;return sV(e,void 0,n,r)}var US;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(US||(US={}));var zS;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(zS||(zS={}));function IV(t={}){const{nonce:e,onScriptLoadSuccess:r,onScriptLoadError:n}=t,[i,s]=y.useState(!1),o=y.useRef(r);o.current=r;const a=y.useRef(n);return a.current=n,y.useEffect(()=>{const l=document.createElement("script");return l.src="https://accounts.google.com/gsi/client",l.async=!0,l.defer=!0,l.nonce=e,l.onload=()=>{var c;s(!0),(c=o.current)===null||c===void 0||c.call(o)},l.onerror=()=>{var c;s(!1),(c=a.current)===null||c===void 0||c.call(a)},document.body.appendChild(l),()=>{document.body.removeChild(l)}},[e]),i}const H8=y.createContext(null);function OV({clientId:t,nonce:e,onScriptLoadSuccess:r,onScriptLoadError:n,children:i}){const s=IV({nonce:e,onScriptLoadSuccess:r,onScriptLoadError:n}),o=y.useMemo(()=>({clientId:t,scriptLoadedSuccessfully:s}),[t,s]);return pr.createElement(H8.Provider,{value:o},i)}function W8(){const t=y.useContext(H8);if(!t)throw new Error("Google OAuth components must be used within GoogleOAuthProvider");return t}function MV(t){var e;return(e=t==null?void 0:t.clientId)!==null&&e!==void 0?e:t==null?void 0:t.client_id}const NV={large:40,medium:32,small:20};function G8({onSuccess:t,onError:e,useOneTap:r,promptMomentNotification:n,type:i="standard",theme:s="outline",size:o="large",text:a,shape:l,logo_alignment:c,width:f,locale:u,click_listener:d,containerProps:h,...p}){const m=y.useRef(null),{clientId:x,scriptLoadedSuccessfully:b}=W8(),w=y.useRef(t);w.current=t;const E=y.useRef(e);E.current=e;const P=y.useRef(n);return P.current=n,y.useEffect(()=>{var N,I,j,L,U,K,X,ee,M;if(b)return(j=(I=(N=window==null?void 0:window.google)===null||N===void 0?void 0:N.accounts)===null||I===void 0?void 0:I.id)===null||j===void 0||j.initialize({client_id:x,callback:v=>{var _;if(!(v!=null&&v.credential))return(_=E.current)===null||_===void 0?void 0:_.call(E);const{credential:k,select_by:A}=v;w.current({credential:k,clientId:MV(v),select_by:A})},...p}),(K=(U=(L=window==null?void 0:window.google)===null||L===void 0?void 0:L.accounts)===null||U===void 0?void 0:U.id)===null||K===void 0||K.renderButton(m.current,{type:i,theme:s,size:o,text:a,shape:l,logo_alignment:c,width:f,locale:u,click_listener:d}),r&&((M=(ee=(X=window==null?void 0:window.google)===null||X===void 0?void 0:X.accounts)===null||ee===void 0?void 0:ee.id)===null||M===void 0||M.prompt(P.current)),()=>{var v,_,k;r&&((k=(_=(v=window==null?void 0:window.google)===null||v===void 0?void 0:v.accounts)===null||_===void 0?void 0:_.id)===null||k===void 0||k.cancel())}},[x,b,r,i,s,o,a,l,c,f,u]),pr.createElement("div",{...h,ref:m,style:{height:NV[o],...h==null?void 0:h.style}})}function $V(){var t,e,r;(r=(e=(t=window==null?void 0:window.google)===null||t===void 0?void 0:t.accounts)===null||e===void 0?void 0:e.id)===null||r===void 0||r.disableAutoSelect()}function K8({flow:t="implicit",scope:e="",onSuccess:r,onError:n,onNonOAuthError:i,overrideScope:s,state:o,...a}){const{clientId:l,scriptLoadedSuccessfully:c}=W8(),f=y.useRef(),u=y.useRef(r);u.current=r;const d=y.useRef(n);d.current=n;const h=y.useRef(i);h.current=i,y.useEffect(()=>{var x;if(!c)return;const b=t==="implicit"?"initTokenClient":"initCodeClient",w=(x=window==null?void 0:window.google)===null||x===void 0?void 0:x.accounts.oauth2[b]({client_id:l,scope:s?e:`openid profile email ${e}`,callback:E=>{var P,N;if(E.error)return(P=d.current)===null||P===void 0?void 0:P.call(d,E);(N=u.current)===null||N===void 0||N.call(u,E)},error_callback:E=>{var P;(P=h.current)===null||P===void 0||P.call(h,E)},state:o,...a});f.current=w},[l,c,t,e,o]);const p=y.useCallback(x=>{var b;return(b=f.current)===null||b===void 0?void 0:b.requestAccessToken(x)},[]),m=y.useCallback(()=>{var x;return(x=f.current)===null||x===void 0?void 0:x.requestCode()},[]);return t==="implicit"?p:m}var Y8={},g1={},ju={};Object.defineProperty(ju,"__esModule",{value:!0});ju.default=void 0;var DV=y;function LV(t){(0,DV.useEffect)(function(){if(t){var e=document.querySelectorAll('script[src="'.concat(t,'"]'))[0];e||(e=document.createElement("script"),e.src=t,e.async=!0,document.body.appendChild(e))}},[t])}var jV=LV;ju.default=jV;var Fu={},x1={};Object.defineProperty(x1,"__esModule",{value:!0});x1.default=void 0;var FV=function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{pollFrequency:1e3,retries:100,parent:window},n=r.pollFrequency,i=n===void 0?1e3:n,s=r.retries,o=s===void 0?100:s,a=r.parent,l=a===void 0?window:a;if(l&&l.hasOwnProperty(e))return Promise.resolve(l[e]);if(!o)return Promise.resolve(void 0);var c=o-1;return new Promise(function(f){return setTimeout(f,typeof i=="function"?i({retries:c}):i)}).then(function(){return t(e,{pollFrequency:i,parent:l,retries:c})})},BV=FV;x1.default=BV;Object.defineProperty(Fu,"__esModule",{value:!0});Fu.default=void 0;var UV=zV(x1);function zV(t){return t&&t.__esModule?t:{default:t}}var VV="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",qV=function(e){var r=e.authOptions,n=e.onSuccess,i=e.onError;return(0,UV.default)("AppleID").then(function(){return window.AppleID||console.error(new Error("Error loading apple script")),window.AppleID.auth.init(r),window.AppleID.auth.signIn().then(function(s){return n&&n(s),s}).catch(function(s){return i?i(s):console.error(s),null})}).catch(function(s){return i?i(s):console.error(s),null})},HV={APPLE_SCRIPT_SRC:VV,signIn:qV};Fu.default=HV;Object.defineProperty(g1,"__esModule",{value:!0});g1.default=void 0;var Hi=yx(y),WV=yx(ju),VS=yx(Fu),GV=["onSuccess","onError","skipScript","authOptions","iconProps","render","uiType","className","noDefaultStyle","buttonExtraChildren"];function yx(t){return t&&t.__esModule?t:{default:t}}function i0(){return i0=Object.assign||function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function JV(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s=0)&&(r[i]=t[i]);return r}var XV=` .react-apple-signin-auth-btn { background-color: transparent; border: none; @@ -158,7 +158,7 @@ Defaulting to \`null\`.`}const a8="Radio",[QF,l8]=cn(a8),[JF,XF]=QF(a8),ZF=y.for background-color: #000; color: #FFF; border-color: #FFF; -}`.replace(/ {2}|\n/g,""),ZV=function(e){var r=e.onSuccess,n=e.onError,i=e.skipScript,s=i===void 0?!1:i,o=e.authOptions,a=e.iconProps,l=e.render,c=e.uiType,f=c===void 0?"dark":c,u=e.className,d=e.noDefaultStyle,h=d===void 0?!1:d,p=e.buttonExtraChildren,m=p===void 0?"Continue with Apple":p,x=QV(e,GV);(0,WV.default)(s?null:VS.default.APPLE_SCRIPT_SRC);var b=function(P){P&&(P.preventDefault(),P.stopPropagation()),VS.default.signIn({authOptions:o,onSuccess:r,onError:n})},w=KV({children:Hi.default.createElement(Hi.default.Fragment,null,Hi.default.createElement("svg",i0({width:"24px",height:"44px",viewBox:"0 0 24 44"},a),Hi.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},Hi.default.createElement("rect",{fill:f==="light"?"#FFF":"#000",x:"0",y:"0",width:"24",height:"44"}),Hi.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:f==="light"?"#000":"#FFF",fillRule:"nonzero"}))),m),onClick:b},x);return l?l(w):Hi.default.createElement(Hi.default.Fragment,null,Hi.default.createElement("button",i0({className:"".concat(h?"":"react-apple-signin-auth-btn react-apple-signin-auth-btn-".concat(f)).concat(u?" ".concat(u):""),type:"button","aria-label":"Signin with apple ID"},w)),h?null:Hi.default.createElement("style",null,XV))},eq=ZV;g1.default=eq;(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=i(g1),r=i(Fu),n=i(ju);function i(o){return o&&o.__esModule?o:{default:o}}var s=e.default;t.default=s})(Y8);const Q8=eo(Y8);var tq="_1csw4y80 _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8";const J8=t=>{const{value:e,digits:r=6,onChange:n,disabled:i=!1}=t,s=y.useMemo(()=>HS(0,r).map(()=>y.createRef()),[]);y.useEffect(()=>{var c,f;(f=(c=s[0])==null?void 0:c.current)==null||f.focus()},[]);const o=(c,f)=>{var d,h;/^\d$/.test(f)||(f="");const u=[...e];u[c]=f,f!==""&&((h=(d=s[c+1])==null?void 0:d.current)==null||h.focus()),n(u)},a=(c,f)=>{var p,m;const u=s[c].current,d=(p=s[c-1])==null?void 0:p.current,h=(m=s[c+1])==null?void 0:m.current;switch(f.key){case"Backspace":f.preventDefault(),u&&(u.value="",o(c,"")),d==null||d.focus();break;case"ArrowLeft":f.preventDefault(),d==null||d.focus();break;case"ArrowRight":f.preventDefault(),h==null||h.focus();break;default:(u==null?void 0:u.value)===f.key&&(f.preventDefault(),o(c,f.key))}},l=(c,f)=>{var h,p;const d=f.clipboardData.getData("text/plain").replace(/\D/g,"");/^\d{6}$/.test(d)&&((p=(h=s[0])==null?void 0:h.current)==null||p.focus(),n(d.split("")),setTimeout(()=>{var m,x;(x=(m=s[s.length-1])==null?void 0:m.current)==null||x.focus()}))};return $.jsx(G,{gap:"2",children:HS(0,r).map(c=>$.jsxs(y.Fragment,{children:[c===r/2&&$.jsx("span",{}),$.jsx(G,{as:"input",className:tq,value:e[c]||"",ref:s[c],type:"text",inputMode:"numeric",maxLength:1,disabled:i,onFocus:f=>f.target.select(),onPaste:f=>l(c,f),onChange:f=>o(c,f.target.value),onKeyDown:f=>{a(c,f)}})]},c))})},HS=(t,e)=>Array.from({length:e-t},(r,n)=>n+t),X8=()=>$.jsxs(G,{gap:"2",flexDirection:"column",borderStyle:"solid",width:"1/3",padding:"4",borderWidth:"thin",borderColor:"borderNormal",borderRadius:"sm",children:[$.jsx(me,{variant:"xlarge",fontWeight:"bold",color:"gnosisLight",children:"Demo App"}),$.jsx(me,{variant:"normal",marginLeft:"auto",color:"polygonLight",children:"Showcasing WaaS"})]});var mx={exports:{}};const rq={},nq=Object.freeze(Object.defineProperty({__proto__:null,default:rq},Symbol.toStringTag,{value:"Module"})),iq=b9(nq);mx.exports;(function(t){(function(e,r){function n(M,v){if(!M)throw new Error(v||"Assertion failed")}function i(M,v){M.super_=v;var _=function(){};_.prototype=v.prototype,M.prototype=new _,M.prototype.constructor=M}function s(M,v,_){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&((v==="le"||v==="be")&&(_=v,v=10),this._init(M||0,v||10,_||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=iq.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,_){return v.cmp(_)>0?v:_},s.min=function(v,_){return v.cmp(_)<0?v:_},s.prototype._init=function(v,_,k){if(typeof v=="number")return this._initNumber(v,_,k);if(typeof v=="object")return this._initArray(v,_,k);_==="hex"&&(_=16),n(_===(_|0)&&_>=2&&_<=36),v=v.toString().replace(/\s+/g,"");var A=0;v[0]==="-"&&(A++,this.negative=1),A=0;A-=3)O=v[A]|v[A-1]<<8|v[A-2]<<16,this.words[T]|=O<>>26-D&67108863,D+=24,D>=26&&(D-=26,T++);else if(k==="le")for(A=0,T=0;A>>26-D&67108863,D+=24,D>=26&&(D-=26,T++);return this._strip()};function a(M,v){var _=M.charCodeAt(v);if(_>=48&&_<=57)return _-48;if(_>=65&&_<=70)return _-55;if(_>=97&&_<=102)return _-87;n(!1,"Invalid character in "+M)}function l(M,v,_){var k=a(M,_);return _-1>=v&&(k|=a(M,_-1)<<4),k}s.prototype._parseHex=function(v,_,k){this.length=Math.ceil((v.length-_)/6),this.words=new Array(this.length);for(var A=0;A=_;A-=2)D=l(v,_,A)<=18?(T-=18,O+=1,this.words[O]|=D>>>26):T+=8;else{var S=v.length-_;for(A=S%2===0?_+1:_;A=18?(T-=18,O+=1,this.words[O]|=D>>>26):T+=8}this._strip()};function c(M,v,_,k){for(var A=0,T=0,O=Math.min(M.length,_),D=v;D=49?T=S-49+10:S>=17?T=S-17+10:T=S,n(S>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(v,_){v=v||10,_=_|0||1;var k;if(v===16||v==="hex"){k="";for(var A=0,T=0,O=0;O>>24-A&16777215,A+=2,A>=26&&(A-=26,O--),T!==0||O!==this.length-1?k=d[6-S.length]+S+k:k=S+k}for(T!==0&&(k=T.toString(16)+k);k.length%_!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}if(v===(v|0)&&v>=2&&v<=36){var g=h[v],R=p[v];k="";var F=this.clone();for(F.negative=0;!F.isZero();){var C=F.modrn(R).toString(v);F=F.idivn(R),F.isZero()?k=C+k:k=d[g-C.length]+C+k}for(this.isZero()&&(k="0"+k);k.length%_!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,_){return this.toArrayLike(o,v,_)}),s.prototype.toArray=function(v,_){return this.toArrayLike(Array,v,_)};var m=function(v,_){return v.allocUnsafe?v.allocUnsafe(_):new v(_)};s.prototype.toArrayLike=function(v,_,k){this._strip();var A=this.byteLength(),T=k||Math.max(1,A);n(A<=T,"byte array longer than desired length"),n(T>0,"Requested array length <= 0");var O=m(v,T),D=_==="le"?"LE":"BE";return this["_toArrayLike"+D](O,A),O},s.prototype._toArrayLikeLE=function(v,_){for(var k=0,A=0,T=0,O=0;T>8&255),k>16&255),O===6?(k>24&255),A=0,O=0):(A=D>>>24,O+=2)}if(k=0&&(v[k--]=D>>8&255),k>=0&&(v[k--]=D>>16&255),O===6?(k>=0&&(v[k--]=D>>24&255),A=0,O=0):(A=D>>>24,O+=2)}if(k>=0)for(v[k--]=A;k>=0;)v[k--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var _=v,k=0;return _>=4096&&(k+=13,_>>>=13),_>=64&&(k+=7,_>>>=7),_>=8&&(k+=4,_>>>=4),_>=2&&(k+=2,_>>>=2),k+_},s.prototype._zeroBits=function(v){if(v===0)return 26;var _=v,k=0;return _&8191||(k+=13,_>>>=13),_&127||(k+=7,_>>>=7),_&15||(k+=4,_>>>=4),_&3||(k+=2,_>>>=2),_&1||k++,k},s.prototype.bitLength=function(){var v=this.words[this.length-1],_=this._countBits(v);return(this.length-1)*26+_};function x(M){for(var v=new Array(M.bitLength()),_=0;_>>A&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,_=0;_v.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var _;this.length>v.length?_=v:_=this;for(var k=0;k<_.length;k++)this.words[k]=this.words[k]&v.words[k];return this.length=_.length,this._strip()},s.prototype.iand=function(v){return n((this.negative|v.negative)===0),this.iuand(v)},s.prototype.and=function(v){return this.length>v.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var _,k;this.length>v.length?(_=this,k=v):(_=v,k=this);for(var A=0;Av.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){n(typeof v=="number"&&v>=0);var _=Math.ceil(v/26)|0,k=v%26;this._expand(_),k>0&&_--;for(var A=0;A<_;A++)this.words[A]=~this.words[A]&67108863;return k>0&&(this.words[A]=~this.words[A]&67108863>>26-k),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,_){n(typeof v=="number"&&v>=0);var k=v/26|0,A=v%26;return this._expand(k+1),_?this.words[k]=this.words[k]|1<v.length?(k=this,A=v):(k=v,A=this);for(var T=0,O=0;O>>26;for(;T!==0&&O>>26;if(this.length=k.length,T!==0)this.words[this.length]=T,this.length++;else if(k!==this)for(;Ov.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var _=this.iadd(v);return v.negative=1,_._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var k=this.cmp(v);if(k===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;k>0?(A=this,T=v):(A=v,T=this);for(var O=0,D=0;D>26,this.words[D]=_&67108863;for(;O!==0&&D>26,this.words[D]=_&67108863;if(O===0&&D>>26,F=S&67108863,C=Math.min(g,v.length-1),B=Math.max(0,g-M.length+1);B<=C;B++){var V=g-B|0;A=M.words[V]|0,T=v.words[B]|0,O=A*T+F,R+=O/67108864|0,F=O&67108863}_.words[g]=F|0,S=R|0}return S!==0?_.words[g]=S|0:_.length--,_._strip()}var w=function(v,_,k){var A=v.words,T=_.words,O=k.words,D=0,S,g,R,F=A[0]|0,C=F&8191,B=F>>>13,V=A[1]|0,H=V&8191,Z=V>>>13,le=A[2]|0,ne=le&8191,te=le>>>13,Me=A[3]|0,pe=Me&8191,ke=Me>>>13,sr=A[4]|0,Ze=sr&8191,ct=sr>>>13,ei=A[5]|0,ft=ei&8191,rt=ei>>>13,bs=A[6]|0,Pt=bs&8191,st=bs>>>13,Nn=A[7]|0,mt=Nn&8191,ut=Nn>>>13,Zr=A[8]|0,Ye=Zr&8191,gt=Zr>>>13,ti=A[9]|0,Rt=ti&8191,Je=ti>>>13,Fi=T[0]|0,xt=Fi&8191,bt=Fi>>>13,ws=T[1]|0,wt=ws&8191,ot=ws>>>13,Bi=T[2]|0,dt=Bi&8191,at=Bi>>>13,bi=T[3]|0,It=bi&8191,Et=bi>>>13,Es=T[4]|0,St=Es&8191,lt=Es>>>13,ri=T[5]|0,Ot=ri&8191,Mt=ri>>>13,z=T[6]|0,q=z&8191,W=z>>>13,re=T[7]|0,fe=re&8191,ve=re>>>13,Ee=T[8]|0,ae=Ee&8191,ge=Ee>>>13,we=T[9]|0,ye=we&8191,Ae=we>>>13;k.negative=v.negative^_.negative,k.length=19,S=Math.imul(C,xt),g=Math.imul(C,bt),g=g+Math.imul(B,xt)|0,R=Math.imul(B,bt);var Be=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Be>>>26)|0,Be&=67108863,S=Math.imul(H,xt),g=Math.imul(H,bt),g=g+Math.imul(Z,xt)|0,R=Math.imul(Z,bt),S=S+Math.imul(C,wt)|0,g=g+Math.imul(C,ot)|0,g=g+Math.imul(B,wt)|0,R=R+Math.imul(B,ot)|0;var He=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(He>>>26)|0,He&=67108863,S=Math.imul(ne,xt),g=Math.imul(ne,bt),g=g+Math.imul(te,xt)|0,R=Math.imul(te,bt),S=S+Math.imul(H,wt)|0,g=g+Math.imul(H,ot)|0,g=g+Math.imul(Z,wt)|0,R=R+Math.imul(Z,ot)|0,S=S+Math.imul(C,dt)|0,g=g+Math.imul(C,at)|0,g=g+Math.imul(B,dt)|0,R=R+Math.imul(B,at)|0;var je=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(je>>>26)|0,je&=67108863,S=Math.imul(pe,xt),g=Math.imul(pe,bt),g=g+Math.imul(ke,xt)|0,R=Math.imul(ke,bt),S=S+Math.imul(ne,wt)|0,g=g+Math.imul(ne,ot)|0,g=g+Math.imul(te,wt)|0,R=R+Math.imul(te,ot)|0,S=S+Math.imul(H,dt)|0,g=g+Math.imul(H,at)|0,g=g+Math.imul(Z,dt)|0,R=R+Math.imul(Z,at)|0,S=S+Math.imul(C,It)|0,g=g+Math.imul(C,Et)|0,g=g+Math.imul(B,It)|0,R=R+Math.imul(B,Et)|0;var Dt=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,S=Math.imul(Ze,xt),g=Math.imul(Ze,bt),g=g+Math.imul(ct,xt)|0,R=Math.imul(ct,bt),S=S+Math.imul(pe,wt)|0,g=g+Math.imul(pe,ot)|0,g=g+Math.imul(ke,wt)|0,R=R+Math.imul(ke,ot)|0,S=S+Math.imul(ne,dt)|0,g=g+Math.imul(ne,at)|0,g=g+Math.imul(te,dt)|0,R=R+Math.imul(te,at)|0,S=S+Math.imul(H,It)|0,g=g+Math.imul(H,Et)|0,g=g+Math.imul(Z,It)|0,R=R+Math.imul(Z,Et)|0,S=S+Math.imul(C,St)|0,g=g+Math.imul(C,lt)|0,g=g+Math.imul(B,St)|0,R=R+Math.imul(B,lt)|0;var ht=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(ft,xt),g=Math.imul(ft,bt),g=g+Math.imul(rt,xt)|0,R=Math.imul(rt,bt),S=S+Math.imul(Ze,wt)|0,g=g+Math.imul(Ze,ot)|0,g=g+Math.imul(ct,wt)|0,R=R+Math.imul(ct,ot)|0,S=S+Math.imul(pe,dt)|0,g=g+Math.imul(pe,at)|0,g=g+Math.imul(ke,dt)|0,R=R+Math.imul(ke,at)|0,S=S+Math.imul(ne,It)|0,g=g+Math.imul(ne,Et)|0,g=g+Math.imul(te,It)|0,R=R+Math.imul(te,Et)|0,S=S+Math.imul(H,St)|0,g=g+Math.imul(H,lt)|0,g=g+Math.imul(Z,St)|0,R=R+Math.imul(Z,lt)|0,S=S+Math.imul(C,Ot)|0,g=g+Math.imul(C,Mt)|0,g=g+Math.imul(B,Ot)|0,R=R+Math.imul(B,Mt)|0;var Ss=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Ss>>>26)|0,Ss&=67108863,S=Math.imul(Pt,xt),g=Math.imul(Pt,bt),g=g+Math.imul(st,xt)|0,R=Math.imul(st,bt),S=S+Math.imul(ft,wt)|0,g=g+Math.imul(ft,ot)|0,g=g+Math.imul(rt,wt)|0,R=R+Math.imul(rt,ot)|0,S=S+Math.imul(Ze,dt)|0,g=g+Math.imul(Ze,at)|0,g=g+Math.imul(ct,dt)|0,R=R+Math.imul(ct,at)|0,S=S+Math.imul(pe,It)|0,g=g+Math.imul(pe,Et)|0,g=g+Math.imul(ke,It)|0,R=R+Math.imul(ke,Et)|0,S=S+Math.imul(ne,St)|0,g=g+Math.imul(ne,lt)|0,g=g+Math.imul(te,St)|0,R=R+Math.imul(te,lt)|0,S=S+Math.imul(H,Ot)|0,g=g+Math.imul(H,Mt)|0,g=g+Math.imul(Z,Ot)|0,R=R+Math.imul(Z,Mt)|0,S=S+Math.imul(C,q)|0,g=g+Math.imul(C,W)|0,g=g+Math.imul(B,q)|0,R=R+Math.imul(B,W)|0;var ni=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(ni>>>26)|0,ni&=67108863,S=Math.imul(mt,xt),g=Math.imul(mt,bt),g=g+Math.imul(ut,xt)|0,R=Math.imul(ut,bt),S=S+Math.imul(Pt,wt)|0,g=g+Math.imul(Pt,ot)|0,g=g+Math.imul(st,wt)|0,R=R+Math.imul(st,ot)|0,S=S+Math.imul(ft,dt)|0,g=g+Math.imul(ft,at)|0,g=g+Math.imul(rt,dt)|0,R=R+Math.imul(rt,at)|0,S=S+Math.imul(Ze,It)|0,g=g+Math.imul(Ze,Et)|0,g=g+Math.imul(ct,It)|0,R=R+Math.imul(ct,Et)|0,S=S+Math.imul(pe,St)|0,g=g+Math.imul(pe,lt)|0,g=g+Math.imul(ke,St)|0,R=R+Math.imul(ke,lt)|0,S=S+Math.imul(ne,Ot)|0,g=g+Math.imul(ne,Mt)|0,g=g+Math.imul(te,Ot)|0,R=R+Math.imul(te,Mt)|0,S=S+Math.imul(H,q)|0,g=g+Math.imul(H,W)|0,g=g+Math.imul(Z,q)|0,R=R+Math.imul(Z,W)|0,S=S+Math.imul(C,fe)|0,g=g+Math.imul(C,ve)|0,g=g+Math.imul(B,fe)|0,R=R+Math.imul(B,ve)|0;var Ui=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,S=Math.imul(Ye,xt),g=Math.imul(Ye,bt),g=g+Math.imul(gt,xt)|0,R=Math.imul(gt,bt),S=S+Math.imul(mt,wt)|0,g=g+Math.imul(mt,ot)|0,g=g+Math.imul(ut,wt)|0,R=R+Math.imul(ut,ot)|0,S=S+Math.imul(Pt,dt)|0,g=g+Math.imul(Pt,at)|0,g=g+Math.imul(st,dt)|0,R=R+Math.imul(st,at)|0,S=S+Math.imul(ft,It)|0,g=g+Math.imul(ft,Et)|0,g=g+Math.imul(rt,It)|0,R=R+Math.imul(rt,Et)|0,S=S+Math.imul(Ze,St)|0,g=g+Math.imul(Ze,lt)|0,g=g+Math.imul(ct,St)|0,R=R+Math.imul(ct,lt)|0,S=S+Math.imul(pe,Ot)|0,g=g+Math.imul(pe,Mt)|0,g=g+Math.imul(ke,Ot)|0,R=R+Math.imul(ke,Mt)|0,S=S+Math.imul(ne,q)|0,g=g+Math.imul(ne,W)|0,g=g+Math.imul(te,q)|0,R=R+Math.imul(te,W)|0,S=S+Math.imul(H,fe)|0,g=g+Math.imul(H,ve)|0,g=g+Math.imul(Z,fe)|0,R=R+Math.imul(Z,ve)|0,S=S+Math.imul(C,ae)|0,g=g+Math.imul(C,ge)|0,g=g+Math.imul(B,ae)|0,R=R+Math.imul(B,ge)|0;var zi=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(zi>>>26)|0,zi&=67108863,S=Math.imul(Rt,xt),g=Math.imul(Rt,bt),g=g+Math.imul(Je,xt)|0,R=Math.imul(Je,bt),S=S+Math.imul(Ye,wt)|0,g=g+Math.imul(Ye,ot)|0,g=g+Math.imul(gt,wt)|0,R=R+Math.imul(gt,ot)|0,S=S+Math.imul(mt,dt)|0,g=g+Math.imul(mt,at)|0,g=g+Math.imul(ut,dt)|0,R=R+Math.imul(ut,at)|0,S=S+Math.imul(Pt,It)|0,g=g+Math.imul(Pt,Et)|0,g=g+Math.imul(st,It)|0,R=R+Math.imul(st,Et)|0,S=S+Math.imul(ft,St)|0,g=g+Math.imul(ft,lt)|0,g=g+Math.imul(rt,St)|0,R=R+Math.imul(rt,lt)|0,S=S+Math.imul(Ze,Ot)|0,g=g+Math.imul(Ze,Mt)|0,g=g+Math.imul(ct,Ot)|0,R=R+Math.imul(ct,Mt)|0,S=S+Math.imul(pe,q)|0,g=g+Math.imul(pe,W)|0,g=g+Math.imul(ke,q)|0,R=R+Math.imul(ke,W)|0,S=S+Math.imul(ne,fe)|0,g=g+Math.imul(ne,ve)|0,g=g+Math.imul(te,fe)|0,R=R+Math.imul(te,ve)|0,S=S+Math.imul(H,ae)|0,g=g+Math.imul(H,ge)|0,g=g+Math.imul(Z,ae)|0,R=R+Math.imul(Z,ge)|0,S=S+Math.imul(C,ye)|0,g=g+Math.imul(C,Ae)|0,g=g+Math.imul(B,ye)|0,R=R+Math.imul(B,Ae)|0;var Vi=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,S=Math.imul(Rt,wt),g=Math.imul(Rt,ot),g=g+Math.imul(Je,wt)|0,R=Math.imul(Je,ot),S=S+Math.imul(Ye,dt)|0,g=g+Math.imul(Ye,at)|0,g=g+Math.imul(gt,dt)|0,R=R+Math.imul(gt,at)|0,S=S+Math.imul(mt,It)|0,g=g+Math.imul(mt,Et)|0,g=g+Math.imul(ut,It)|0,R=R+Math.imul(ut,Et)|0,S=S+Math.imul(Pt,St)|0,g=g+Math.imul(Pt,lt)|0,g=g+Math.imul(st,St)|0,R=R+Math.imul(st,lt)|0,S=S+Math.imul(ft,Ot)|0,g=g+Math.imul(ft,Mt)|0,g=g+Math.imul(rt,Ot)|0,R=R+Math.imul(rt,Mt)|0,S=S+Math.imul(Ze,q)|0,g=g+Math.imul(Ze,W)|0,g=g+Math.imul(ct,q)|0,R=R+Math.imul(ct,W)|0,S=S+Math.imul(pe,fe)|0,g=g+Math.imul(pe,ve)|0,g=g+Math.imul(ke,fe)|0,R=R+Math.imul(ke,ve)|0,S=S+Math.imul(ne,ae)|0,g=g+Math.imul(ne,ge)|0,g=g+Math.imul(te,ae)|0,R=R+Math.imul(te,ge)|0,S=S+Math.imul(H,ye)|0,g=g+Math.imul(H,Ae)|0,g=g+Math.imul(Z,ye)|0,R=R+Math.imul(Z,Ae)|0;var xn=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(xn>>>26)|0,xn&=67108863,S=Math.imul(Rt,dt),g=Math.imul(Rt,at),g=g+Math.imul(Je,dt)|0,R=Math.imul(Je,at),S=S+Math.imul(Ye,It)|0,g=g+Math.imul(Ye,Et)|0,g=g+Math.imul(gt,It)|0,R=R+Math.imul(gt,Et)|0,S=S+Math.imul(mt,St)|0,g=g+Math.imul(mt,lt)|0,g=g+Math.imul(ut,St)|0,R=R+Math.imul(ut,lt)|0,S=S+Math.imul(Pt,Ot)|0,g=g+Math.imul(Pt,Mt)|0,g=g+Math.imul(st,Ot)|0,R=R+Math.imul(st,Mt)|0,S=S+Math.imul(ft,q)|0,g=g+Math.imul(ft,W)|0,g=g+Math.imul(rt,q)|0,R=R+Math.imul(rt,W)|0,S=S+Math.imul(Ze,fe)|0,g=g+Math.imul(Ze,ve)|0,g=g+Math.imul(ct,fe)|0,R=R+Math.imul(ct,ve)|0,S=S+Math.imul(pe,ae)|0,g=g+Math.imul(pe,ge)|0,g=g+Math.imul(ke,ae)|0,R=R+Math.imul(ke,ge)|0,S=S+Math.imul(ne,ye)|0,g=g+Math.imul(ne,Ae)|0,g=g+Math.imul(te,ye)|0,R=R+Math.imul(te,Ae)|0;var oo=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(oo>>>26)|0,oo&=67108863,S=Math.imul(Rt,It),g=Math.imul(Rt,Et),g=g+Math.imul(Je,It)|0,R=Math.imul(Je,Et),S=S+Math.imul(Ye,St)|0,g=g+Math.imul(Ye,lt)|0,g=g+Math.imul(gt,St)|0,R=R+Math.imul(gt,lt)|0,S=S+Math.imul(mt,Ot)|0,g=g+Math.imul(mt,Mt)|0,g=g+Math.imul(ut,Ot)|0,R=R+Math.imul(ut,Mt)|0,S=S+Math.imul(Pt,q)|0,g=g+Math.imul(Pt,W)|0,g=g+Math.imul(st,q)|0,R=R+Math.imul(st,W)|0,S=S+Math.imul(ft,fe)|0,g=g+Math.imul(ft,ve)|0,g=g+Math.imul(rt,fe)|0,R=R+Math.imul(rt,ve)|0,S=S+Math.imul(Ze,ae)|0,g=g+Math.imul(Ze,ge)|0,g=g+Math.imul(ct,ae)|0,R=R+Math.imul(ct,ge)|0,S=S+Math.imul(pe,ye)|0,g=g+Math.imul(pe,Ae)|0,g=g+Math.imul(ke,ye)|0,R=R+Math.imul(ke,Ae)|0;var ao=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(ao>>>26)|0,ao&=67108863,S=Math.imul(Rt,St),g=Math.imul(Rt,lt),g=g+Math.imul(Je,St)|0,R=Math.imul(Je,lt),S=S+Math.imul(Ye,Ot)|0,g=g+Math.imul(Ye,Mt)|0,g=g+Math.imul(gt,Ot)|0,R=R+Math.imul(gt,Mt)|0,S=S+Math.imul(mt,q)|0,g=g+Math.imul(mt,W)|0,g=g+Math.imul(ut,q)|0,R=R+Math.imul(ut,W)|0,S=S+Math.imul(Pt,fe)|0,g=g+Math.imul(Pt,ve)|0,g=g+Math.imul(st,fe)|0,R=R+Math.imul(st,ve)|0,S=S+Math.imul(ft,ae)|0,g=g+Math.imul(ft,ge)|0,g=g+Math.imul(rt,ae)|0,R=R+Math.imul(rt,ge)|0,S=S+Math.imul(Ze,ye)|0,g=g+Math.imul(Ze,Ae)|0,g=g+Math.imul(ct,ye)|0,R=R+Math.imul(ct,Ae)|0;var lo=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(lo>>>26)|0,lo&=67108863,S=Math.imul(Rt,Ot),g=Math.imul(Rt,Mt),g=g+Math.imul(Je,Ot)|0,R=Math.imul(Je,Mt),S=S+Math.imul(Ye,q)|0,g=g+Math.imul(Ye,W)|0,g=g+Math.imul(gt,q)|0,R=R+Math.imul(gt,W)|0,S=S+Math.imul(mt,fe)|0,g=g+Math.imul(mt,ve)|0,g=g+Math.imul(ut,fe)|0,R=R+Math.imul(ut,ve)|0,S=S+Math.imul(Pt,ae)|0,g=g+Math.imul(Pt,ge)|0,g=g+Math.imul(st,ae)|0,R=R+Math.imul(st,ge)|0,S=S+Math.imul(ft,ye)|0,g=g+Math.imul(ft,Ae)|0,g=g+Math.imul(rt,ye)|0,R=R+Math.imul(rt,Ae)|0;var Ne=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,S=Math.imul(Rt,q),g=Math.imul(Rt,W),g=g+Math.imul(Je,q)|0,R=Math.imul(Je,W),S=S+Math.imul(Ye,fe)|0,g=g+Math.imul(Ye,ve)|0,g=g+Math.imul(gt,fe)|0,R=R+Math.imul(gt,ve)|0,S=S+Math.imul(mt,ae)|0,g=g+Math.imul(mt,ge)|0,g=g+Math.imul(ut,ae)|0,R=R+Math.imul(ut,ge)|0,S=S+Math.imul(Pt,ye)|0,g=g+Math.imul(Pt,Ae)|0,g=g+Math.imul(st,ye)|0,R=R+Math.imul(st,Ae)|0;var Lt=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,S=Math.imul(Rt,fe),g=Math.imul(Rt,ve),g=g+Math.imul(Je,fe)|0,R=Math.imul(Je,ve),S=S+Math.imul(Ye,ae)|0,g=g+Math.imul(Ye,ge)|0,g=g+Math.imul(gt,ae)|0,R=R+Math.imul(gt,ge)|0,S=S+Math.imul(mt,ye)|0,g=g+Math.imul(mt,Ae)|0,g=g+Math.imul(ut,ye)|0,R=R+Math.imul(ut,Ae)|0;var Br=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Br>>>26)|0,Br&=67108863,S=Math.imul(Rt,ae),g=Math.imul(Rt,ge),g=g+Math.imul(Je,ae)|0,R=Math.imul(Je,ge),S=S+Math.imul(Ye,ye)|0,g=g+Math.imul(Ye,Ae)|0,g=g+Math.imul(gt,ye)|0,R=R+Math.imul(gt,Ae)|0;var kt=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(kt>>>26)|0,kt&=67108863,S=Math.imul(Rt,ye),g=Math.imul(Rt,Ae),g=g+Math.imul(Je,ye)|0,R=Math.imul(Je,Ae);var $n=(D+S|0)+((g&8191)<<13)|0;return D=(R+(g>>>13)|0)+($n>>>26)|0,$n&=67108863,O[0]=Be,O[1]=He,O[2]=je,O[3]=Dt,O[4]=ht,O[5]=Ss,O[6]=ni,O[7]=Ui,O[8]=zi,O[9]=Vi,O[10]=xn,O[11]=oo,O[12]=ao,O[13]=lo,O[14]=Ne,O[15]=Lt,O[16]=Br,O[17]=kt,O[18]=$n,D!==0&&(O[19]=D,k.length++),k};Math.imul||(w=b);function E(M,v,_){_.negative=v.negative^M.negative,_.length=M.length+v.length;for(var k=0,A=0,T=0;T<_.length-1;T++){var O=A;A=0;for(var D=k&67108863,S=Math.min(T,v.length-1),g=Math.max(0,T-M.length+1);g<=S;g++){var R=T-g,F=M.words[R]|0,C=v.words[g]|0,B=F*C,V=B&67108863;O=O+(B/67108864|0)|0,V=V+D|0,D=V&67108863,O=O+(V>>>26)|0,A+=O>>>26,O&=67108863}_.words[T]=D,k=O,O=A}return k!==0?_.words[T]=k:_.length--,_._strip()}function P(M,v,_){return E(M,v,_)}s.prototype.mulTo=function(v,_){var k,A=this.length+v.length;return this.length===10&&v.length===10?k=w(this,v,_):A<63?k=b(this,v,_):A<1024?k=E(this,v,_):k=P(this,v,_),k},s.prototype.mul=function(v){var _=new s(null);return _.words=new Array(this.length+v.length),this.mulTo(v,_)},s.prototype.mulf=function(v){var _=new s(null);return _.words=new Array(this.length+v.length),P(this,v,_)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var _=v<0;_&&(v=-v),n(typeof v=="number"),n(v<67108864);for(var k=0,A=0;A>=26,k+=T/67108864|0,k+=O>>>26,this.words[A]=O&67108863}return k!==0&&(this.words[A]=k,this.length++),_?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var _=x(v);if(_.length===0)return new s(1);for(var k=this,A=0;A<_.length&&_[A]===0;A++,k=k.sqr());if(++A<_.length)for(var T=k.sqr();A<_.length;A++,T=T.sqr())_[A]!==0&&(k=k.mul(T));return k},s.prototype.iushln=function(v){n(typeof v=="number"&&v>=0);var _=v%26,k=(v-_)/26,A=67108863>>>26-_<<26-_,T;if(_!==0){var O=0;for(T=0;T>>26-_}O&&(this.words[T]=O,this.length++)}if(k!==0){for(T=this.length-1;T>=0;T--)this.words[T+k]=this.words[T];for(T=0;T=0);var A;_?A=(_-_%26)/26:A=0;var T=v%26,O=Math.min((v-T)/26,this.length),D=67108863^67108863>>>T<O)for(this.length-=O,g=0;g=0&&(R!==0||g>=A);g--){var F=this.words[g]|0;this.words[g]=R<<26-T|F>>>T,R=F&D}return S&&R!==0&&(S.words[S.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,_,k){return n(this.negative===0),this.iushrn(v,_,k)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){n(typeof v=="number"&&v>=0);var _=v%26,k=(v-_)/26,A=1<<_;if(this.length<=k)return!1;var T=this.words[k];return!!(T&A)},s.prototype.imaskn=function(v){n(typeof v=="number"&&v>=0);var _=v%26,k=(v-_)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=k)return this;if(_!==0&&k++,this.length=Math.min(k,this.length),_!==0){var A=67108863^67108863>>>_<<_;this.words[this.length-1]&=A}return this._strip()},s.prototype.maskn=function(v){return this.clone().imaskn(v)},s.prototype.iaddn=function(v){return n(typeof v=="number"),n(v<67108864),v<0?this.isubn(-v):this.negative!==0?this.length===1&&(this.words[0]|0)<=v?(this.words[0]=v-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(v),this.negative=1,this):this._iaddn(v)},s.prototype._iaddn=function(v){this.words[0]+=v;for(var _=0;_=67108864;_++)this.words[_]-=67108864,_===this.length-1?this.words[_+1]=1:this.words[_+1]++;return this.length=Math.max(this.length,_+1),this},s.prototype.isubn=function(v){if(n(typeof v=="number"),n(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var _=0;_>26)-(S/67108864|0),this.words[T+k]=O&67108863}for(;T>26,this.words[T+k]=O&67108863;if(D===0)return this._strip();for(n(D===-1),D=0,T=0;T>26,this.words[T]=O&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,_){var k=this.length-v.length,A=this.clone(),T=v,O=T.words[T.length-1]|0,D=this._countBits(O);k=26-D,k!==0&&(T=T.ushln(k),A.iushln(k),O=T.words[T.length-1]|0);var S=A.length-T.length,g;if(_!=="mod"){g=new s(null),g.length=S+1,g.words=new Array(g.length);for(var R=0;R=0;C--){var B=(A.words[T.length+C]|0)*67108864+(A.words[T.length+C-1]|0);for(B=Math.min(B/O|0,67108863),A._ishlnsubmul(T,B,C);A.negative!==0;)B--,A.negative=0,A._ishlnsubmul(T,1,C),A.isZero()||(A.negative^=1);g&&(g.words[C]=B)}return g&&g._strip(),A._strip(),_!=="div"&&k!==0&&A.iushrn(k),{div:g||null,mod:A}},s.prototype.divmod=function(v,_,k){if(n(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var A,T,O;return this.negative!==0&&v.negative===0?(O=this.neg().divmod(v,_),_!=="mod"&&(A=O.div.neg()),_!=="div"&&(T=O.mod.neg(),k&&T.negative!==0&&T.iadd(v)),{div:A,mod:T}):this.negative===0&&v.negative!==0?(O=this.divmod(v.neg(),_),_!=="mod"&&(A=O.div.neg()),{div:A,mod:O.mod}):this.negative&v.negative?(O=this.neg().divmod(v.neg(),_),_!=="div"&&(T=O.mod.neg(),k&&T.negative!==0&&T.isub(v)),{div:O.div,mod:T}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?_==="div"?{div:this.divn(v.words[0]),mod:null}:_==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,_)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var _=this.divmod(v);if(_.mod.isZero())return _.div;var k=_.div.negative!==0?_.mod.isub(v):_.mod,A=v.ushrn(1),T=v.andln(1),O=k.cmp(A);return O<0||T===1&&O===0?_.div:_.div.negative!==0?_.div.isubn(1):_.div.iaddn(1)},s.prototype.modrn=function(v){var _=v<0;_&&(v=-v),n(v<=67108863);for(var k=(1<<26)%v,A=0,T=this.length-1;T>=0;T--)A=(k*A+(this.words[T]|0))%v;return _?-A:A},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var _=v<0;_&&(v=-v),n(v<=67108863);for(var k=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+k*67108864;this.words[A]=T/v|0,k=T%v}return this._strip(),_?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){n(v.negative===0),n(!v.isZero());var _=this,k=v.clone();_.negative!==0?_=_.umod(v):_=_.clone();for(var A=new s(1),T=new s(0),O=new s(0),D=new s(1),S=0;_.isEven()&&k.isEven();)_.iushrn(1),k.iushrn(1),++S;for(var g=k.clone(),R=_.clone();!_.isZero();){for(var F=0,C=1;!(_.words[0]&C)&&F<26;++F,C<<=1);if(F>0)for(_.iushrn(F);F-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(g),T.isub(R)),A.iushrn(1),T.iushrn(1);for(var B=0,V=1;!(k.words[0]&V)&&B<26;++B,V<<=1);if(B>0)for(k.iushrn(B);B-- >0;)(O.isOdd()||D.isOdd())&&(O.iadd(g),D.isub(R)),O.iushrn(1),D.iushrn(1);_.cmp(k)>=0?(_.isub(k),A.isub(O),T.isub(D)):(k.isub(_),O.isub(A),D.isub(T))}return{a:O,b:D,gcd:k.iushln(S)}},s.prototype._invmp=function(v){n(v.negative===0),n(!v.isZero());var _=this,k=v.clone();_.negative!==0?_=_.umod(v):_=_.clone();for(var A=new s(1),T=new s(0),O=k.clone();_.cmpn(1)>0&&k.cmpn(1)>0;){for(var D=0,S=1;!(_.words[0]&S)&&D<26;++D,S<<=1);if(D>0)for(_.iushrn(D);D-- >0;)A.isOdd()&&A.iadd(O),A.iushrn(1);for(var g=0,R=1;!(k.words[0]&R)&&g<26;++g,R<<=1);if(g>0)for(k.iushrn(g);g-- >0;)T.isOdd()&&T.iadd(O),T.iushrn(1);_.cmp(k)>=0?(_.isub(k),A.isub(T)):(k.isub(_),T.isub(A))}var F;return _.cmpn(1)===0?F=A:F=T,F.cmpn(0)<0&&F.iadd(v),F},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var _=this.clone(),k=v.clone();_.negative=0,k.negative=0;for(var A=0;_.isEven()&&k.isEven();A++)_.iushrn(1),k.iushrn(1);do{for(;_.isEven();)_.iushrn(1);for(;k.isEven();)k.iushrn(1);var T=_.cmp(k);if(T<0){var O=_;_=k,k=O}else if(T===0||k.cmpn(1)===0)break;_.isub(k)}while(!0);return k.iushln(A)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){n(typeof v=="number");var _=v%26,k=(v-_)/26,A=1<<_;if(this.length<=k)return this._expand(k+1),this.words[k]|=A,this;for(var T=A,O=k;T!==0&&O>>26,D&=67108863,this.words[O]=D}return T!==0&&(this.words[O]=T,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var _=v<0;if(this.negative!==0&&!_)return-1;if(this.negative===0&&_)return 1;this._strip();var k;if(this.length>1)k=1;else{_&&(v=-v),n(v<=67108863,"Number is too big");var A=this.words[0]|0;k=A===v?0:Av.length)return 1;if(this.length=0;k--){var A=this.words[k]|0,T=v.words[k]|0;if(A!==T){AT&&(_=1);break}}return _},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new X(v)},s.prototype.toRed=function(v){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return n(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(v){return n(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var N={k256:null,p224:null,p192:null,p25519:null};function I(M,v){this.name=M,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}I.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},I.prototype.ireduce=function(v){var _=v,k;do this.split(_,this.tmp),_=this.imulK(_),_=_.iadd(this.tmp),k=_.bitLength();while(k>this.n);var A=k0?_.isub(this.p):_.strip!==void 0?_.strip():_._strip(),_},I.prototype.split=function(v,_){v.iushrn(this.n,0,_)},I.prototype.imulK=function(v){return v.imul(this.k)};function j(){I.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(j,I),j.prototype.split=function(v,_){for(var k=4194303,A=Math.min(v.length,9),T=0;T>>22,O=D}O>>>=22,v.words[T-10]=O,O===0&&v.length>10?v.length-=10:v.length-=9},j.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var _=0,k=0;k>>=26,v.words[k]=T,_=A}return _!==0&&(v.words[v.length++]=_),v},s._prime=function(v){if(N[v])return N[v];var _;if(v==="k256")_=new j;else if(v==="p224")_=new L;else if(v==="p192")_=new U;else if(v==="p25519")_=new K;else throw new Error("Unknown prime "+v);return N[v]=_,_};function X(M){if(typeof M=="string"){var v=s._prime(M);this.m=v.p,this.prime=v}else n(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}X.prototype._verify1=function(v){n(v.negative===0,"red works only with positives"),n(v.red,"red works only with red numbers")},X.prototype._verify2=function(v,_){n((v.negative|_.negative)===0,"red works only with positives"),n(v.red&&v.red===_.red,"red works only with red numbers")},X.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(f(v,v.umod(this.m)._forceRed(this)),v)},X.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},X.prototype.add=function(v,_){this._verify2(v,_);var k=v.add(_);return k.cmp(this.m)>=0&&k.isub(this.m),k._forceRed(this)},X.prototype.iadd=function(v,_){this._verify2(v,_);var k=v.iadd(_);return k.cmp(this.m)>=0&&k.isub(this.m),k},X.prototype.sub=function(v,_){this._verify2(v,_);var k=v.sub(_);return k.cmpn(0)<0&&k.iadd(this.m),k._forceRed(this)},X.prototype.isub=function(v,_){this._verify2(v,_);var k=v.isub(_);return k.cmpn(0)<0&&k.iadd(this.m),k},X.prototype.shl=function(v,_){return this._verify1(v),this.imod(v.ushln(_))},X.prototype.imul=function(v,_){return this._verify2(v,_),this.imod(v.imul(_))},X.prototype.mul=function(v,_){return this._verify2(v,_),this.imod(v.mul(_))},X.prototype.isqr=function(v){return this.imul(v,v.clone())},X.prototype.sqr=function(v){return this.mul(v,v)},X.prototype.sqrt=function(v){if(v.isZero())return v.clone();var _=this.m.andln(3);if(n(_%2===1),_===3){var k=this.m.add(new s(1)).iushrn(2);return this.pow(v,k)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);n(!A.isZero());var O=new s(1).toRed(this),D=O.redNeg(),S=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,S).cmp(D)!==0;)g.redIAdd(D);for(var R=this.pow(g,A),F=this.pow(v,A.addn(1).iushrn(1)),C=this.pow(v,A),B=T;C.cmp(O)!==0;){for(var V=C,H=0;V.cmp(O)!==0;H++)V=V.redSqr();n(H=0;T--){for(var R=_.words[T],F=g-1;F>=0;F--){var C=R>>F&1;if(O!==A[0]&&(O=this.sqr(O)),C===0&&D===0){S=0;continue}D<<=1,D|=C,S++,!(S!==k&&(T!==0||F!==0))&&(O=this.mul(O,A[D]),S=0,D=0)}g=26}return O},X.prototype.convertTo=function(v){var _=v.umod(this.m);return _===v?_.clone():_},X.prototype.convertFrom=function(v){var _=v.clone();return _.red=null,_},s.mont=function(v){return new ee(v)};function ee(M){X.call(this,M),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ee,X),ee.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},ee.prototype.convertFrom=function(v){var _=this.imod(v.mul(this.rinv));return _.red=null,_},ee.prototype.imul=function(v,_){if(v.isZero()||_.isZero())return v.words[0]=0,v.length=1,v;var k=v.imul(_),A=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=k.isub(A).iushrn(this.shift),O=T;return T.cmp(this.m)>=0?O=T.isub(this.m):T.cmpn(0)<0&&(O=T.iadd(this.m)),O._forceRed(this)},ee.prototype.mul=function(v,_){if(v.isZero()||_.isZero())return new s(0)._forceRed(this);var k=v.mul(_),A=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=k.isub(A).iushrn(this.shift),O=T;return T.cmp(this.m)>=0?O=T.isub(this.m):T.cmpn(0)<0&&(O=T.iadd(this.m)),O._forceRed(this)},ee.prototype.invm=function(v){var _=this.imod(v._invmp(this.m).mul(this.r2));return _._forceRed(this)}})(t,hC)})(mx);var sq=mx.exports;const De=eo(sq),oq="logger/5.7.0";let WS=!1,GS=!1;const nh={debug:1,default:2,info:2,warning:3,error:4,off:5};let KS=nh.default,Lv=null;function aq(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const YS=aq();var Wy;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Wy||(Wy={}));var _i;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(_i||(_i={}));const QS="0123456789abcdef";let Q=class _r{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();nh[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(KS>nh[n])&&console.log.apply(console,r)}debug(...e){this._log(_r.levels.DEBUG,e)}info(...e){this._log(_r.levels.INFO,e)}warn(...e){this._log(_r.levels.WARNING,e)}makeError(e,r,n){if(GS)return this.makeError("censored error",r,{});r||(r=_r.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(l=>{const c=n[l];try{if(c instanceof Uint8Array){let f="";for(let u=0;u>4],f+=QS[c[u]&15];i.push(l+"=Uint8Array(0x"+f+")")}else i.push(l+"="+JSON.stringify(c))}catch{i.push(l+"="+JSON.stringify(n[l].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case _i.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case _i.CALL_EXCEPTION:case _i.INSUFFICIENT_FUNDS:case _i.MISSING_NEW:case _i.NONCE_EXPIRED:case _i.REPLACEMENT_UNDERPRICED:case _i.TRANSACTION_REPLACED:case _i.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(l){a[l]=n[l]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,_r.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){YS&&this.throwError("platform missing String.prototype.normalize",_r.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:YS})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,_r.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,_r.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,_r.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",_r.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",_r.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",_r.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Lv||(Lv=new _r(oq)),Lv}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",_r.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),WS){if(!e)return;this.globalLogger().throwError("error censorship permanent",_r.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}GS=!!e,WS=!!r}static setLogLevel(e){const r=nh[e.toLowerCase()];if(r==null){_r.globalLogger().warn("invalid log level - "+e);return}KS=r}static from(e){return new _r(e)}};Q.errors=_i;Q.levels=Wy;const lq="bytes/5.7.0",or=new Q(lq);function Z8(t){return!!t.toHexString}function Vl(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Vl(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function b1(t){return et(t)&&!(t.length%2)||kc(t)}function JS(t){return typeof t=="number"&&t==t&&t%1===0}function kc(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!JS(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function de(t,e){if(e||(e={}),typeof t=="number"){or.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Vl(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Z8(t)&&(t=t.toHexString()),et(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":or.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ide(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Vl(n)}function zs(t){let e=de(t);if(e.length===0)return e;let r=0;for(;re&&or.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Vl(r)}function et(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const jv="0123456789abcdef";function he(t,e){if(e||(e={}),typeof t=="number"){or.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=jv[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Z8(t))return t.toHexString();if(et(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":or.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(kc(t)){let r="0x";for(let n=0;n>4]+jv[i&15]}return r}return or.throwArgumentError("invalid hexlify value","value",t)}function Ua(t){if(typeof t!="string")t=he(t);else if(!et(t)||t.length%2)return null;return(t.length-2)/2}function Pr(t,e,r){return typeof t!="string"?t=he(t):(!et(t)||t.length%2)&&or.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function En(t){let e="0x";return t.forEach(r=>{e+=he(r).substring(2)}),e}function gx(t){const e=fq(he(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function fq(t){typeof t!="string"&&(t=he(t)),et(t)||or.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&or.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ac(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(b1(t)){let r=de(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=he(r.slice(0,32)),e.s=he(r.slice(32,64))):r.length===65?(e.r=he(r.slice(0,32)),e.s=he(r.slice(32,64)),e.v=r[64]):or.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:or.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=he(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=cq(de(e._vs),32);e._vs=he(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&or.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=he(i);e.s==null?e.s=o:e.s!==o&&or.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?or.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&or.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!et(e.r)?or.throwArgumentError("signature missing or invalid r","signature",t):e.r=Vt(e.r,32),e.s==null||!et(e.s)?or.throwArgumentError("signature missing or invalid s","signature",t):e.s=Vt(e.s,32);const r=de(e.s);r[0]>=128&&or.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=he(r);e._vs&&(et(e._vs)||or.throwArgumentError("signature invalid _vs","signature",t),e._vs=Vt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&or.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function XS(t){return t=Ac(t),he(wr([t.r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}const e7="bignumber/5.7.0";var s0=De.BN;const Ts=new Q(e7),Fv={},ZS=9007199254740991;function uq(t){return t!=null&&(ce.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||et(t)||typeof t=="bigint"||kc(t))}let ek=!1;class ce{constructor(e,r){e!==Fv&&Ts.throwError("cannot call constructor directly; use BigNumber.from",Q.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return bn(We(this).fromTwos(e))}toTwos(e){return bn(We(this).toTwos(e))}abs(){return this._hex[0]==="-"?ce.from(this._hex.substring(1)):this}add(e){return bn(We(this).add(We(e)))}sub(e){return bn(We(this).sub(We(e)))}div(e){return ce.from(e).isZero()&&si("division-by-zero","div"),bn(We(this).div(We(e)))}mul(e){return bn(We(this).mul(We(e)))}mod(e){const r=We(e);return r.isNeg()&&si("division-by-zero","mod"),bn(We(this).umod(r))}pow(e){const r=We(e);return r.isNeg()&&si("negative-power","pow"),bn(We(this).pow(r))}and(e){const r=We(e);return(this.isNegative()||r.isNeg())&&si("unbound-bitwise-result","and"),bn(We(this).and(r))}or(e){const r=We(e);return(this.isNegative()||r.isNeg())&&si("unbound-bitwise-result","or"),bn(We(this).or(r))}xor(e){const r=We(e);return(this.isNegative()||r.isNeg())&&si("unbound-bitwise-result","xor"),bn(We(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&si("negative-width","mask"),bn(We(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&si("negative-width","shl"),bn(We(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&si("negative-width","shr"),bn(We(this).shrn(e))}eq(e){return We(this).eq(We(e))}lt(e){return We(this).lt(We(e))}lte(e){return We(this).lte(We(e))}gt(e){return We(this).gt(We(e))}gte(e){return We(this).gte(We(e))}isNegative(){return this._hex[0]==="-"}isZero(){return We(this).isZero()}toNumber(){try{return We(this).toNumber()}catch{si("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ts.throwError("this platform does not support BigInt",Q.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?ek||(ek=!0,Ts.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ts.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Q.errors.UNEXPECTED_ARGUMENT,{}):Ts.throwError("BigNumber.toString does not accept parameters",Q.errors.UNEXPECTED_ARGUMENT,{})),We(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ce)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ce(Fv,ou(e)):e.match(/^-?[0-9]+$/)?new ce(Fv,ou(new s0(e))):Ts.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&si("underflow","BigNumber.from",e),(e>=ZS||e<=-ZS)&&si("overflow","BigNumber.from",e),ce.from(String(e));const r=e;if(typeof r=="bigint")return ce.from(r.toString());if(kc(r))return ce.from(he(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return ce.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(et(n)||n[0]==="-"&&et(n.substring(1))))return ce.from(n)}return Ts.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function ou(t){if(typeof t!="string")return ou(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ts.throwArgumentError("invalid hex","value",t),t=ou(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function bn(t){return ce.from(ou(t))}function We(t){const e=ce.from(t).toHexString();return e[0]==="-"?new s0("-"+e.substring(3),16):new s0(e.substring(2),16)}function si(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),Ts.throwError(t,Q.errors.NUMERIC_FAULT,n)}function dq(t){return new s0(t,36).toString(16)}const pn=new Q(e7),_f={},t7=ce.from(0),r7=ce.from(-1);function n7(t,e,r,n){const i={fault:e,operation:r};return n!==void 0&&(i.value=n),pn.throwError(t,Q.errors.NUMERIC_FAULT,i)}let Tf="0";for(;Tf.length<256;)Tf+=Tf;function xx(t){if(typeof t!="number")try{t=ce.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Tf.substring(0,t):pn.throwArgumentError("invalid decimal size","decimals",t)}function ih(t,e){e==null&&(e=0);const r=xx(e);t=ce.from(t);const n=t.lt(t7);n&&(t=t.mul(r7));let i=t.mod(r).toString();for(;i.length2&&pn.throwArgumentError("too many decimal points","value",t);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&n7("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.lengthe[o]==null?l:(typeof e[o]!==a&&pn.throwArgumentError("invalid fixed format ("+o+" not "+a+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&pn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&pn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new ql(_f,r,n,i)}}class Vr{constructor(e,r,n,i){e!==_f&&pn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Q.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&pn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Vr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(tk.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Vr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(tk.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&pn.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const n=Vr.from("1"+Tf.substring(0,e),this.format),i=hq.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&pn.throwArgumentError("invalid byte width","width",e);const r=ce.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Vt(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Vr.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!uq(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),Vr.fromString(ih(e,r),ql.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=ql.from(r),i=Gi(e,n.decimals);!n.signed&&i.lt(t7)&&n7("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=Vt(s,n.width/8));const o=ih(i,n.decimals);return new Vr(_f,s,o,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=ql.from(r);if(de(e).length>n.width/8)throw new Error("overflow");let i=ce.from(e);n.signed&&(i=i.fromTwos(n.width));const s=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=ih(i,n.decimals);return new Vr(_f,s,o,n)}static from(e,r){if(typeof e=="string")return Vr.fromString(e,r);if(kc(e))return Vr.fromBytes(e,r);try{return Vr.fromValue(e,0,r)}catch(n){if(n.code!==Q.errors.INVALID_ARGUMENT)throw n}return pn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const tk=Vr.from(1),hq=Vr.from("0.5"),vq="properties/5.7.0";var pq=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const o0=new Q(vq);function ie(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function is(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function pr(t){return pq(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(s=>({key:n,value:s}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function i7(t,e){(!t||typeof t!="object")&&o0.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||o0.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function Or(t){const e={};for(const r in t)e[r]=t[r];return e}const yq={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function s7(t){if(t==null||yq[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rza(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&ie(e,r,za(n))}return e}return o0.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function za(t){return mq(t)}class tl{constructor(e){for(const r in e)this[r]=za(e[r])}}const Bu="abi/5.7.0",Qe=new Q(Bu),Va={};let rk={calldata:!0,memory:!0,storage:!0},gq={calldata:!0,memory:!0};function Ed(t,e){if(t==="bytes"||t==="string"){if(rk[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&gq[e])return!0;return(rk[e]||e==="payable")&&Qe.throwArgumentError("invalid modifier","name",e),!1}function xq(t,e){let r=t;function n(a){Qe.throwArgumentError(`unexpected character at position ${a}`,"param",t)}t=t.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==it.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===it.full?", ":",")+")"):r+=this.type,e!==it.sighash&&(this.indexed===!0&&(r+=" indexed"),e===it.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?Dr.fromString(e,r):Dr.fromObject(e)}static fromObject(e){return Dr.isParamType(e)?e:new Dr(Va,{name:e.name||null,type:vl(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Dr.fromObject):null})}static fromString(e,r){function n(i){return Dr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n(xq(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function au(t,e){return Eq(t).map(r=>Dr.fromString(r,e))}class js{constructor(e,r){e!==Va&&Qe.throwError("use a static from method",Q.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),sh(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return js.isFragment(e)?e:typeof e=="string"?js.fromString(e):js.fromObject(e)}static fromObject(e){if(js.isFragment(e))return e;switch(e.type){case"function":return ts.fromObject(e);case"event":return Ms.fromObject(e);case"constructor":return es.fromObject(e);case"error":return ko.fromObject(e);case"fallback":case"receive":return null}return Qe.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Ms.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?ts.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?es.fromString(e.trim()):e.split(" ")[0]==="error"?ko.fromString(e.substring(5).trim()):Qe.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Ms extends js{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==it.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ",e!==it.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?Ms.fromString(e):Ms.fromObject(e)}static fromObject(e){if(Ms.isEventFragment(e))return e;e.type!=="event"&&Qe.throwArgumentError("invalid event object","value",e);const r={name:lu(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Dr.fromObject):[],type:"event"};return new Ms(Va,r)}static fromString(e){let r=e.match(cu);r||Qe.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Qe.warn("unknown modifier: "+i)}}),Ms.fromObject({name:r[1].trim(),anonymous:n,inputs:au(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function o7(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Qe.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Qe.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=ce.from(r[1]),r[0]):t}function a7(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function l7(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Qe.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Qe.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Qe.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Qe.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Qe.throwArgumentError("unable to determine stateMutability","value",t),e}class es extends js{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===it.sighash&&Qe.throwError("cannot format a constructor for sighash",Q.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?es.fromString(e):es.fromObject(e)}static fromObject(e){if(es.isConstructorFragment(e))return e;e.type!=="constructor"&&Qe.throwArgumentError("invalid constructor object","value",e);let r=l7(e);r.constant&&Qe.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?ce.from(e.gas):null};return new es(Va,n)}static fromString(e){let r={type:"constructor"};e=o7(e,r);let n=e.match(cu);return(!n||n[1].trim()!=="constructor")&&Qe.throwArgumentError("invalid constructor string","value",e),r.inputs=au(n[2].trim(),!1),a7(n[3].trim(),r),es.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class ts extends es{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.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?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==it.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ",e!==it.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?ts.fromString(e):ts.fromObject(e)}static fromObject(e){if(ts.isFunctionFragment(e))return e;e.type!=="function"&&Qe.throwArgumentError("invalid function object","value",e);let r=l7(e);const n={type:e.type,name:lu(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(Dr.fromObject):[],outputs:e.outputs?e.outputs.map(Dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?ce.from(e.gas):null};return new ts(Va,n)}static fromString(e){let r={type:"function"};e=o7(e,r);let n=e.split(" returns ");n.length>2&&Qe.throwArgumentError("invalid function string","value",e);let i=n[0].match(cu);if(i||Qe.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&lu(r.name),r.inputs=au(i[2],!1),a7(i[3].trim(),r),n.length>1){let s=n[1].match(cu);(s[1].trim()!=""||s[3].trim()!="")&&Qe.throwArgumentError("unexpected tokens","value",e),r.outputs=au(s[2],!1)}else r.outputs=[];return ts.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function nk(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Qe.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ko extends js{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==it.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ko.fromString(e):ko.fromObject(e)}static fromObject(e){if(ko.isErrorFragment(e))return e;e.type!=="error"&&Qe.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:lu(e.name),inputs:e.inputs?e.inputs.map(Dr.fromObject):[]};return nk(new ko(Va,r))}static fromString(e){let r={type:"error"},n=e.match(cu);return n||Qe.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&lu(r.name),r.inputs=au(n[2],!1),nk(ko.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function vl(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const wq=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function lu(t){return(!t||!t.match(wq))&&Qe.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const cu=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Eq(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&bx.throwError("value out-of-bounds",Q.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=wr([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class a0{constructor(e,r,n,i){ie(this,"_data",de(e)),ie(this,"wordSize",r||32),ie(this,"_coerceFunc",n),ie(this,"allowLoose",i),this._offset=0}get data(){return he(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):a0.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:bx.throwError("data out-of-bounds",Q.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new a0(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return ce.from(this.readBytes(this.wordSize))}}var c7={exports:{}};/** +}`.replace(/ {2}|\n/g,""),ZV=function(e){var r=e.onSuccess,n=e.onError,i=e.skipScript,s=i===void 0?!1:i,o=e.authOptions,a=e.iconProps,l=e.render,c=e.uiType,f=c===void 0?"dark":c,u=e.className,d=e.noDefaultStyle,h=d===void 0?!1:d,p=e.buttonExtraChildren,m=p===void 0?"Continue with Apple":p,x=QV(e,GV);(0,WV.default)(s?null:VS.default.APPLE_SCRIPT_SRC);var b=function(P){P&&(P.preventDefault(),P.stopPropagation()),VS.default.signIn({authOptions:o,onSuccess:r,onError:n})},w=KV({children:Hi.default.createElement(Hi.default.Fragment,null,Hi.default.createElement("svg",i0({width:"24px",height:"44px",viewBox:"0 0 24 44"},a),Hi.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},Hi.default.createElement("rect",{fill:f==="light"?"#FFF":"#000",x:"0",y:"0",width:"24",height:"44"}),Hi.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:f==="light"?"#000":"#FFF",fillRule:"nonzero"}))),m),onClick:b},x);return l?l(w):Hi.default.createElement(Hi.default.Fragment,null,Hi.default.createElement("button",i0({className:"".concat(h?"":"react-apple-signin-auth-btn react-apple-signin-auth-btn-".concat(f)).concat(u?" ".concat(u):""),type:"button","aria-label":"Signin with apple ID"},w)),h?null:Hi.default.createElement("style",null,XV))},eq=ZV;g1.default=eq;(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=i(g1),r=i(Fu),n=i(ju);function i(o){return o&&o.__esModule?o:{default:o}}var s=e.default;t.default=s})(Y8);const Q8=eo(Y8);var tq="_1csw4y80 _1qxj1ib9 _1qxj1ibc _1qxj1ib2 fyvr11mv fyvr11eo fyvr11g8 fyvr11fo fyvr11f8";const J8=t=>{const{value:e,digits:r=6,onChange:n,disabled:i=!1}=t,s=y.useMemo(()=>HS(0,r).map(()=>y.createRef()),[]);y.useEffect(()=>{var c,f;(f=(c=s[0])==null?void 0:c.current)==null||f.focus()},[]);const o=(c,f)=>{var d,h;/^\d$/.test(f)||(f="");const u=[...e];u[c]=f,f!==""&&((h=(d=s[c+1])==null?void 0:d.current)==null||h.focus()),n(u)},a=(c,f)=>{var p,m;const u=s[c].current,d=(p=s[c-1])==null?void 0:p.current,h=(m=s[c+1])==null?void 0:m.current;switch(f.key){case"Backspace":f.preventDefault(),u&&(u.value="",o(c,"")),d==null||d.focus();break;case"ArrowLeft":f.preventDefault(),d==null||d.focus();break;case"ArrowRight":f.preventDefault(),h==null||h.focus();break;default:(u==null?void 0:u.value)===f.key&&(f.preventDefault(),o(c,f.key))}},l=(c,f)=>{var h,p;const d=f.clipboardData.getData("text/plain").replace(/\D/g,"");/^\d{6}$/.test(d)&&((p=(h=s[0])==null?void 0:h.current)==null||p.focus(),n(d.split("")),setTimeout(()=>{var m,x;(x=(m=s[s.length-1])==null?void 0:m.current)==null||x.focus()}))};return $.jsx(G,{gap:"2",children:HS(0,r).map(c=>$.jsxs(y.Fragment,{children:[c===r/2&&$.jsx("span",{}),$.jsx(G,{as:"input",className:tq,value:e[c]||"",ref:s[c],type:"text",inputMode:"numeric",maxLength:1,disabled:i,onFocus:f=>f.target.select(),onPaste:f=>l(c,f),onChange:f=>o(c,f.target.value),onKeyDown:f=>{a(c,f)}})]},c))})},HS=(t,e)=>Array.from({length:e-t},(r,n)=>n+t),X8=()=>$.jsxs(G,{gap:"2",flexDirection:"column",borderStyle:"solid",width:"1/3",padding:"4",borderWidth:"thin",borderColor:"borderNormal",borderRadius:"sm",children:[$.jsx(me,{variant:"xlarge",fontWeight:"bold",color:"gnosisLight",children:"Demo App"}),$.jsx(me,{variant:"normal",marginLeft:"auto",color:"polygonLight",children:"Showcasing WaaS"})]});var mx={exports:{}};const rq={},nq=Object.freeze(Object.defineProperty({__proto__:null,default:rq},Symbol.toStringTag,{value:"Module"})),iq=b9(nq);mx.exports;(function(t){(function(e,r){function n(M,v){if(!M)throw new Error(v||"Assertion failed")}function i(M,v){M.super_=v;var _=function(){};_.prototype=v.prototype,M.prototype=new _,M.prototype.constructor=M}function s(M,v,_){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&((v==="le"||v==="be")&&(_=v,v=10),this._init(M||0,v||10,_||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=iq.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,_){return v.cmp(_)>0?v:_},s.min=function(v,_){return v.cmp(_)<0?v:_},s.prototype._init=function(v,_,k){if(typeof v=="number")return this._initNumber(v,_,k);if(typeof v=="object")return this._initArray(v,_,k);_==="hex"&&(_=16),n(_===(_|0)&&_>=2&&_<=36),v=v.toString().replace(/\s+/g,"");var A=0;v[0]==="-"&&(A++,this.negative=1),A=0;A-=3)O=v[A]|v[A-1]<<8|v[A-2]<<16,this.words[T]|=O<>>26-D&67108863,D+=24,D>=26&&(D-=26,T++);else if(k==="le")for(A=0,T=0;A>>26-D&67108863,D+=24,D>=26&&(D-=26,T++);return this._strip()};function a(M,v){var _=M.charCodeAt(v);if(_>=48&&_<=57)return _-48;if(_>=65&&_<=70)return _-55;if(_>=97&&_<=102)return _-87;n(!1,"Invalid character in "+M)}function l(M,v,_){var k=a(M,_);return _-1>=v&&(k|=a(M,_-1)<<4),k}s.prototype._parseHex=function(v,_,k){this.length=Math.ceil((v.length-_)/6),this.words=new Array(this.length);for(var A=0;A=_;A-=2)D=l(v,_,A)<=18?(T-=18,O+=1,this.words[O]|=D>>>26):T+=8;else{var S=v.length-_;for(A=S%2===0?_+1:_;A=18?(T-=18,O+=1,this.words[O]|=D>>>26):T+=8}this._strip()};function c(M,v,_,k){for(var A=0,T=0,O=Math.min(M.length,_),D=v;D=49?T=S-49+10:S>=17?T=S-17+10:T=S,n(S>=0&&T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(v,_){v=v||10,_=_|0||1;var k;if(v===16||v==="hex"){k="";for(var A=0,T=0,O=0;O>>24-A&16777215,A+=2,A>=26&&(A-=26,O--),T!==0||O!==this.length-1?k=d[6-S.length]+S+k:k=S+k}for(T!==0&&(k=T.toString(16)+k);k.length%_!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}if(v===(v|0)&&v>=2&&v<=36){var g=h[v],R=p[v];k="";var F=this.clone();for(F.negative=0;!F.isZero();){var C=F.modrn(R).toString(v);F=F.idivn(R),F.isZero()?k=C+k:k=d[g-C.length]+C+k}for(this.isZero()&&(k="0"+k);k.length%_!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,_){return this.toArrayLike(o,v,_)}),s.prototype.toArray=function(v,_){return this.toArrayLike(Array,v,_)};var m=function(v,_){return v.allocUnsafe?v.allocUnsafe(_):new v(_)};s.prototype.toArrayLike=function(v,_,k){this._strip();var A=this.byteLength(),T=k||Math.max(1,A);n(A<=T,"byte array longer than desired length"),n(T>0,"Requested array length <= 0");var O=m(v,T),D=_==="le"?"LE":"BE";return this["_toArrayLike"+D](O,A),O},s.prototype._toArrayLikeLE=function(v,_){for(var k=0,A=0,T=0,O=0;T>8&255),k>16&255),O===6?(k>24&255),A=0,O=0):(A=D>>>24,O+=2)}if(k=0&&(v[k--]=D>>8&255),k>=0&&(v[k--]=D>>16&255),O===6?(k>=0&&(v[k--]=D>>24&255),A=0,O=0):(A=D>>>24,O+=2)}if(k>=0)for(v[k--]=A;k>=0;)v[k--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var _=v,k=0;return _>=4096&&(k+=13,_>>>=13),_>=64&&(k+=7,_>>>=7),_>=8&&(k+=4,_>>>=4),_>=2&&(k+=2,_>>>=2),k+_},s.prototype._zeroBits=function(v){if(v===0)return 26;var _=v,k=0;return _&8191||(k+=13,_>>>=13),_&127||(k+=7,_>>>=7),_&15||(k+=4,_>>>=4),_&3||(k+=2,_>>>=2),_&1||k++,k},s.prototype.bitLength=function(){var v=this.words[this.length-1],_=this._countBits(v);return(this.length-1)*26+_};function x(M){for(var v=new Array(M.bitLength()),_=0;_>>A&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,_=0;_v.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var _;this.length>v.length?_=v:_=this;for(var k=0;k<_.length;k++)this.words[k]=this.words[k]&v.words[k];return this.length=_.length,this._strip()},s.prototype.iand=function(v){return n((this.negative|v.negative)===0),this.iuand(v)},s.prototype.and=function(v){return this.length>v.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var _,k;this.length>v.length?(_=this,k=v):(_=v,k=this);for(var A=0;Av.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){n(typeof v=="number"&&v>=0);var _=Math.ceil(v/26)|0,k=v%26;this._expand(_),k>0&&_--;for(var A=0;A<_;A++)this.words[A]=~this.words[A]&67108863;return k>0&&(this.words[A]=~this.words[A]&67108863>>26-k),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,_){n(typeof v=="number"&&v>=0);var k=v/26|0,A=v%26;return this._expand(k+1),_?this.words[k]=this.words[k]|1<v.length?(k=this,A=v):(k=v,A=this);for(var T=0,O=0;O>>26;for(;T!==0&&O>>26;if(this.length=k.length,T!==0)this.words[this.length]=T,this.length++;else if(k!==this)for(;Ov.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var _=this.iadd(v);return v.negative=1,_._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var k=this.cmp(v);if(k===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,T;k>0?(A=this,T=v):(A=v,T=this);for(var O=0,D=0;D>26,this.words[D]=_&67108863;for(;O!==0&&D>26,this.words[D]=_&67108863;if(O===0&&D>>26,F=S&67108863,C=Math.min(g,v.length-1),B=Math.max(0,g-M.length+1);B<=C;B++){var V=g-B|0;A=M.words[V]|0,T=v.words[B]|0,O=A*T+F,R+=O/67108864|0,F=O&67108863}_.words[g]=F|0,S=R|0}return S!==0?_.words[g]=S|0:_.length--,_._strip()}var w=function(v,_,k){var A=v.words,T=_.words,O=k.words,D=0,S,g,R,F=A[0]|0,C=F&8191,B=F>>>13,V=A[1]|0,H=V&8191,Z=V>>>13,le=A[2]|0,ne=le&8191,te=le>>>13,Me=A[3]|0,pe=Me&8191,ke=Me>>>13,sr=A[4]|0,Ze=sr&8191,ct=sr>>>13,ei=A[5]|0,ft=ei&8191,rt=ei>>>13,bs=A[6]|0,Pt=bs&8191,st=bs>>>13,Nn=A[7]|0,mt=Nn&8191,ut=Nn>>>13,Zr=A[8]|0,Ye=Zr&8191,gt=Zr>>>13,ti=A[9]|0,Rt=ti&8191,Je=ti>>>13,Fi=T[0]|0,xt=Fi&8191,bt=Fi>>>13,ws=T[1]|0,wt=ws&8191,ot=ws>>>13,Bi=T[2]|0,dt=Bi&8191,at=Bi>>>13,bi=T[3]|0,It=bi&8191,Et=bi>>>13,Es=T[4]|0,St=Es&8191,lt=Es>>>13,ri=T[5]|0,Ot=ri&8191,Mt=ri>>>13,z=T[6]|0,q=z&8191,W=z>>>13,re=T[7]|0,fe=re&8191,ve=re>>>13,Ee=T[8]|0,ae=Ee&8191,ge=Ee>>>13,we=T[9]|0,ye=we&8191,Ae=we>>>13;k.negative=v.negative^_.negative,k.length=19,S=Math.imul(C,xt),g=Math.imul(C,bt),g=g+Math.imul(B,xt)|0,R=Math.imul(B,bt);var Be=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Be>>>26)|0,Be&=67108863,S=Math.imul(H,xt),g=Math.imul(H,bt),g=g+Math.imul(Z,xt)|0,R=Math.imul(Z,bt),S=S+Math.imul(C,wt)|0,g=g+Math.imul(C,ot)|0,g=g+Math.imul(B,wt)|0,R=R+Math.imul(B,ot)|0;var He=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(He>>>26)|0,He&=67108863,S=Math.imul(ne,xt),g=Math.imul(ne,bt),g=g+Math.imul(te,xt)|0,R=Math.imul(te,bt),S=S+Math.imul(H,wt)|0,g=g+Math.imul(H,ot)|0,g=g+Math.imul(Z,wt)|0,R=R+Math.imul(Z,ot)|0,S=S+Math.imul(C,dt)|0,g=g+Math.imul(C,at)|0,g=g+Math.imul(B,dt)|0,R=R+Math.imul(B,at)|0;var je=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(je>>>26)|0,je&=67108863,S=Math.imul(pe,xt),g=Math.imul(pe,bt),g=g+Math.imul(ke,xt)|0,R=Math.imul(ke,bt),S=S+Math.imul(ne,wt)|0,g=g+Math.imul(ne,ot)|0,g=g+Math.imul(te,wt)|0,R=R+Math.imul(te,ot)|0,S=S+Math.imul(H,dt)|0,g=g+Math.imul(H,at)|0,g=g+Math.imul(Z,dt)|0,R=R+Math.imul(Z,at)|0,S=S+Math.imul(C,It)|0,g=g+Math.imul(C,Et)|0,g=g+Math.imul(B,It)|0,R=R+Math.imul(B,Et)|0;var Dt=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,S=Math.imul(Ze,xt),g=Math.imul(Ze,bt),g=g+Math.imul(ct,xt)|0,R=Math.imul(ct,bt),S=S+Math.imul(pe,wt)|0,g=g+Math.imul(pe,ot)|0,g=g+Math.imul(ke,wt)|0,R=R+Math.imul(ke,ot)|0,S=S+Math.imul(ne,dt)|0,g=g+Math.imul(ne,at)|0,g=g+Math.imul(te,dt)|0,R=R+Math.imul(te,at)|0,S=S+Math.imul(H,It)|0,g=g+Math.imul(H,Et)|0,g=g+Math.imul(Z,It)|0,R=R+Math.imul(Z,Et)|0,S=S+Math.imul(C,St)|0,g=g+Math.imul(C,lt)|0,g=g+Math.imul(B,St)|0,R=R+Math.imul(B,lt)|0;var ht=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(ft,xt),g=Math.imul(ft,bt),g=g+Math.imul(rt,xt)|0,R=Math.imul(rt,bt),S=S+Math.imul(Ze,wt)|0,g=g+Math.imul(Ze,ot)|0,g=g+Math.imul(ct,wt)|0,R=R+Math.imul(ct,ot)|0,S=S+Math.imul(pe,dt)|0,g=g+Math.imul(pe,at)|0,g=g+Math.imul(ke,dt)|0,R=R+Math.imul(ke,at)|0,S=S+Math.imul(ne,It)|0,g=g+Math.imul(ne,Et)|0,g=g+Math.imul(te,It)|0,R=R+Math.imul(te,Et)|0,S=S+Math.imul(H,St)|0,g=g+Math.imul(H,lt)|0,g=g+Math.imul(Z,St)|0,R=R+Math.imul(Z,lt)|0,S=S+Math.imul(C,Ot)|0,g=g+Math.imul(C,Mt)|0,g=g+Math.imul(B,Ot)|0,R=R+Math.imul(B,Mt)|0;var Ss=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Ss>>>26)|0,Ss&=67108863,S=Math.imul(Pt,xt),g=Math.imul(Pt,bt),g=g+Math.imul(st,xt)|0,R=Math.imul(st,bt),S=S+Math.imul(ft,wt)|0,g=g+Math.imul(ft,ot)|0,g=g+Math.imul(rt,wt)|0,R=R+Math.imul(rt,ot)|0,S=S+Math.imul(Ze,dt)|0,g=g+Math.imul(Ze,at)|0,g=g+Math.imul(ct,dt)|0,R=R+Math.imul(ct,at)|0,S=S+Math.imul(pe,It)|0,g=g+Math.imul(pe,Et)|0,g=g+Math.imul(ke,It)|0,R=R+Math.imul(ke,Et)|0,S=S+Math.imul(ne,St)|0,g=g+Math.imul(ne,lt)|0,g=g+Math.imul(te,St)|0,R=R+Math.imul(te,lt)|0,S=S+Math.imul(H,Ot)|0,g=g+Math.imul(H,Mt)|0,g=g+Math.imul(Z,Ot)|0,R=R+Math.imul(Z,Mt)|0,S=S+Math.imul(C,q)|0,g=g+Math.imul(C,W)|0,g=g+Math.imul(B,q)|0,R=R+Math.imul(B,W)|0;var ni=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(ni>>>26)|0,ni&=67108863,S=Math.imul(mt,xt),g=Math.imul(mt,bt),g=g+Math.imul(ut,xt)|0,R=Math.imul(ut,bt),S=S+Math.imul(Pt,wt)|0,g=g+Math.imul(Pt,ot)|0,g=g+Math.imul(st,wt)|0,R=R+Math.imul(st,ot)|0,S=S+Math.imul(ft,dt)|0,g=g+Math.imul(ft,at)|0,g=g+Math.imul(rt,dt)|0,R=R+Math.imul(rt,at)|0,S=S+Math.imul(Ze,It)|0,g=g+Math.imul(Ze,Et)|0,g=g+Math.imul(ct,It)|0,R=R+Math.imul(ct,Et)|0,S=S+Math.imul(pe,St)|0,g=g+Math.imul(pe,lt)|0,g=g+Math.imul(ke,St)|0,R=R+Math.imul(ke,lt)|0,S=S+Math.imul(ne,Ot)|0,g=g+Math.imul(ne,Mt)|0,g=g+Math.imul(te,Ot)|0,R=R+Math.imul(te,Mt)|0,S=S+Math.imul(H,q)|0,g=g+Math.imul(H,W)|0,g=g+Math.imul(Z,q)|0,R=R+Math.imul(Z,W)|0,S=S+Math.imul(C,fe)|0,g=g+Math.imul(C,ve)|0,g=g+Math.imul(B,fe)|0,R=R+Math.imul(B,ve)|0;var Ui=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,S=Math.imul(Ye,xt),g=Math.imul(Ye,bt),g=g+Math.imul(gt,xt)|0,R=Math.imul(gt,bt),S=S+Math.imul(mt,wt)|0,g=g+Math.imul(mt,ot)|0,g=g+Math.imul(ut,wt)|0,R=R+Math.imul(ut,ot)|0,S=S+Math.imul(Pt,dt)|0,g=g+Math.imul(Pt,at)|0,g=g+Math.imul(st,dt)|0,R=R+Math.imul(st,at)|0,S=S+Math.imul(ft,It)|0,g=g+Math.imul(ft,Et)|0,g=g+Math.imul(rt,It)|0,R=R+Math.imul(rt,Et)|0,S=S+Math.imul(Ze,St)|0,g=g+Math.imul(Ze,lt)|0,g=g+Math.imul(ct,St)|0,R=R+Math.imul(ct,lt)|0,S=S+Math.imul(pe,Ot)|0,g=g+Math.imul(pe,Mt)|0,g=g+Math.imul(ke,Ot)|0,R=R+Math.imul(ke,Mt)|0,S=S+Math.imul(ne,q)|0,g=g+Math.imul(ne,W)|0,g=g+Math.imul(te,q)|0,R=R+Math.imul(te,W)|0,S=S+Math.imul(H,fe)|0,g=g+Math.imul(H,ve)|0,g=g+Math.imul(Z,fe)|0,R=R+Math.imul(Z,ve)|0,S=S+Math.imul(C,ae)|0,g=g+Math.imul(C,ge)|0,g=g+Math.imul(B,ae)|0,R=R+Math.imul(B,ge)|0;var zi=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(zi>>>26)|0,zi&=67108863,S=Math.imul(Rt,xt),g=Math.imul(Rt,bt),g=g+Math.imul(Je,xt)|0,R=Math.imul(Je,bt),S=S+Math.imul(Ye,wt)|0,g=g+Math.imul(Ye,ot)|0,g=g+Math.imul(gt,wt)|0,R=R+Math.imul(gt,ot)|0,S=S+Math.imul(mt,dt)|0,g=g+Math.imul(mt,at)|0,g=g+Math.imul(ut,dt)|0,R=R+Math.imul(ut,at)|0,S=S+Math.imul(Pt,It)|0,g=g+Math.imul(Pt,Et)|0,g=g+Math.imul(st,It)|0,R=R+Math.imul(st,Et)|0,S=S+Math.imul(ft,St)|0,g=g+Math.imul(ft,lt)|0,g=g+Math.imul(rt,St)|0,R=R+Math.imul(rt,lt)|0,S=S+Math.imul(Ze,Ot)|0,g=g+Math.imul(Ze,Mt)|0,g=g+Math.imul(ct,Ot)|0,R=R+Math.imul(ct,Mt)|0,S=S+Math.imul(pe,q)|0,g=g+Math.imul(pe,W)|0,g=g+Math.imul(ke,q)|0,R=R+Math.imul(ke,W)|0,S=S+Math.imul(ne,fe)|0,g=g+Math.imul(ne,ve)|0,g=g+Math.imul(te,fe)|0,R=R+Math.imul(te,ve)|0,S=S+Math.imul(H,ae)|0,g=g+Math.imul(H,ge)|0,g=g+Math.imul(Z,ae)|0,R=R+Math.imul(Z,ge)|0,S=S+Math.imul(C,ye)|0,g=g+Math.imul(C,Ae)|0,g=g+Math.imul(B,ye)|0,R=R+Math.imul(B,Ae)|0;var Vi=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,S=Math.imul(Rt,wt),g=Math.imul(Rt,ot),g=g+Math.imul(Je,wt)|0,R=Math.imul(Je,ot),S=S+Math.imul(Ye,dt)|0,g=g+Math.imul(Ye,at)|0,g=g+Math.imul(gt,dt)|0,R=R+Math.imul(gt,at)|0,S=S+Math.imul(mt,It)|0,g=g+Math.imul(mt,Et)|0,g=g+Math.imul(ut,It)|0,R=R+Math.imul(ut,Et)|0,S=S+Math.imul(Pt,St)|0,g=g+Math.imul(Pt,lt)|0,g=g+Math.imul(st,St)|0,R=R+Math.imul(st,lt)|0,S=S+Math.imul(ft,Ot)|0,g=g+Math.imul(ft,Mt)|0,g=g+Math.imul(rt,Ot)|0,R=R+Math.imul(rt,Mt)|0,S=S+Math.imul(Ze,q)|0,g=g+Math.imul(Ze,W)|0,g=g+Math.imul(ct,q)|0,R=R+Math.imul(ct,W)|0,S=S+Math.imul(pe,fe)|0,g=g+Math.imul(pe,ve)|0,g=g+Math.imul(ke,fe)|0,R=R+Math.imul(ke,ve)|0,S=S+Math.imul(ne,ae)|0,g=g+Math.imul(ne,ge)|0,g=g+Math.imul(te,ae)|0,R=R+Math.imul(te,ge)|0,S=S+Math.imul(H,ye)|0,g=g+Math.imul(H,Ae)|0,g=g+Math.imul(Z,ye)|0,R=R+Math.imul(Z,Ae)|0;var xn=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(xn>>>26)|0,xn&=67108863,S=Math.imul(Rt,dt),g=Math.imul(Rt,at),g=g+Math.imul(Je,dt)|0,R=Math.imul(Je,at),S=S+Math.imul(Ye,It)|0,g=g+Math.imul(Ye,Et)|0,g=g+Math.imul(gt,It)|0,R=R+Math.imul(gt,Et)|0,S=S+Math.imul(mt,St)|0,g=g+Math.imul(mt,lt)|0,g=g+Math.imul(ut,St)|0,R=R+Math.imul(ut,lt)|0,S=S+Math.imul(Pt,Ot)|0,g=g+Math.imul(Pt,Mt)|0,g=g+Math.imul(st,Ot)|0,R=R+Math.imul(st,Mt)|0,S=S+Math.imul(ft,q)|0,g=g+Math.imul(ft,W)|0,g=g+Math.imul(rt,q)|0,R=R+Math.imul(rt,W)|0,S=S+Math.imul(Ze,fe)|0,g=g+Math.imul(Ze,ve)|0,g=g+Math.imul(ct,fe)|0,R=R+Math.imul(ct,ve)|0,S=S+Math.imul(pe,ae)|0,g=g+Math.imul(pe,ge)|0,g=g+Math.imul(ke,ae)|0,R=R+Math.imul(ke,ge)|0,S=S+Math.imul(ne,ye)|0,g=g+Math.imul(ne,Ae)|0,g=g+Math.imul(te,ye)|0,R=R+Math.imul(te,Ae)|0;var oo=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(oo>>>26)|0,oo&=67108863,S=Math.imul(Rt,It),g=Math.imul(Rt,Et),g=g+Math.imul(Je,It)|0,R=Math.imul(Je,Et),S=S+Math.imul(Ye,St)|0,g=g+Math.imul(Ye,lt)|0,g=g+Math.imul(gt,St)|0,R=R+Math.imul(gt,lt)|0,S=S+Math.imul(mt,Ot)|0,g=g+Math.imul(mt,Mt)|0,g=g+Math.imul(ut,Ot)|0,R=R+Math.imul(ut,Mt)|0,S=S+Math.imul(Pt,q)|0,g=g+Math.imul(Pt,W)|0,g=g+Math.imul(st,q)|0,R=R+Math.imul(st,W)|0,S=S+Math.imul(ft,fe)|0,g=g+Math.imul(ft,ve)|0,g=g+Math.imul(rt,fe)|0,R=R+Math.imul(rt,ve)|0,S=S+Math.imul(Ze,ae)|0,g=g+Math.imul(Ze,ge)|0,g=g+Math.imul(ct,ae)|0,R=R+Math.imul(ct,ge)|0,S=S+Math.imul(pe,ye)|0,g=g+Math.imul(pe,Ae)|0,g=g+Math.imul(ke,ye)|0,R=R+Math.imul(ke,Ae)|0;var ao=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(ao>>>26)|0,ao&=67108863,S=Math.imul(Rt,St),g=Math.imul(Rt,lt),g=g+Math.imul(Je,St)|0,R=Math.imul(Je,lt),S=S+Math.imul(Ye,Ot)|0,g=g+Math.imul(Ye,Mt)|0,g=g+Math.imul(gt,Ot)|0,R=R+Math.imul(gt,Mt)|0,S=S+Math.imul(mt,q)|0,g=g+Math.imul(mt,W)|0,g=g+Math.imul(ut,q)|0,R=R+Math.imul(ut,W)|0,S=S+Math.imul(Pt,fe)|0,g=g+Math.imul(Pt,ve)|0,g=g+Math.imul(st,fe)|0,R=R+Math.imul(st,ve)|0,S=S+Math.imul(ft,ae)|0,g=g+Math.imul(ft,ge)|0,g=g+Math.imul(rt,ae)|0,R=R+Math.imul(rt,ge)|0,S=S+Math.imul(Ze,ye)|0,g=g+Math.imul(Ze,Ae)|0,g=g+Math.imul(ct,ye)|0,R=R+Math.imul(ct,Ae)|0;var lo=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(lo>>>26)|0,lo&=67108863,S=Math.imul(Rt,Ot),g=Math.imul(Rt,Mt),g=g+Math.imul(Je,Ot)|0,R=Math.imul(Je,Mt),S=S+Math.imul(Ye,q)|0,g=g+Math.imul(Ye,W)|0,g=g+Math.imul(gt,q)|0,R=R+Math.imul(gt,W)|0,S=S+Math.imul(mt,fe)|0,g=g+Math.imul(mt,ve)|0,g=g+Math.imul(ut,fe)|0,R=R+Math.imul(ut,ve)|0,S=S+Math.imul(Pt,ae)|0,g=g+Math.imul(Pt,ge)|0,g=g+Math.imul(st,ae)|0,R=R+Math.imul(st,ge)|0,S=S+Math.imul(ft,ye)|0,g=g+Math.imul(ft,Ae)|0,g=g+Math.imul(rt,ye)|0,R=R+Math.imul(rt,Ae)|0;var Ne=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,S=Math.imul(Rt,q),g=Math.imul(Rt,W),g=g+Math.imul(Je,q)|0,R=Math.imul(Je,W),S=S+Math.imul(Ye,fe)|0,g=g+Math.imul(Ye,ve)|0,g=g+Math.imul(gt,fe)|0,R=R+Math.imul(gt,ve)|0,S=S+Math.imul(mt,ae)|0,g=g+Math.imul(mt,ge)|0,g=g+Math.imul(ut,ae)|0,R=R+Math.imul(ut,ge)|0,S=S+Math.imul(Pt,ye)|0,g=g+Math.imul(Pt,Ae)|0,g=g+Math.imul(st,ye)|0,R=R+Math.imul(st,Ae)|0;var Lt=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,S=Math.imul(Rt,fe),g=Math.imul(Rt,ve),g=g+Math.imul(Je,fe)|0,R=Math.imul(Je,ve),S=S+Math.imul(Ye,ae)|0,g=g+Math.imul(Ye,ge)|0,g=g+Math.imul(gt,ae)|0,R=R+Math.imul(gt,ge)|0,S=S+Math.imul(mt,ye)|0,g=g+Math.imul(mt,Ae)|0,g=g+Math.imul(ut,ye)|0,R=R+Math.imul(ut,Ae)|0;var Br=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(Br>>>26)|0,Br&=67108863,S=Math.imul(Rt,ae),g=Math.imul(Rt,ge),g=g+Math.imul(Je,ae)|0,R=Math.imul(Je,ge),S=S+Math.imul(Ye,ye)|0,g=g+Math.imul(Ye,Ae)|0,g=g+Math.imul(gt,ye)|0,R=R+Math.imul(gt,Ae)|0;var kt=(D+S|0)+((g&8191)<<13)|0;D=(R+(g>>>13)|0)+(kt>>>26)|0,kt&=67108863,S=Math.imul(Rt,ye),g=Math.imul(Rt,Ae),g=g+Math.imul(Je,ye)|0,R=Math.imul(Je,Ae);var $n=(D+S|0)+((g&8191)<<13)|0;return D=(R+(g>>>13)|0)+($n>>>26)|0,$n&=67108863,O[0]=Be,O[1]=He,O[2]=je,O[3]=Dt,O[4]=ht,O[5]=Ss,O[6]=ni,O[7]=Ui,O[8]=zi,O[9]=Vi,O[10]=xn,O[11]=oo,O[12]=ao,O[13]=lo,O[14]=Ne,O[15]=Lt,O[16]=Br,O[17]=kt,O[18]=$n,D!==0&&(O[19]=D,k.length++),k};Math.imul||(w=b);function E(M,v,_){_.negative=v.negative^M.negative,_.length=M.length+v.length;for(var k=0,A=0,T=0;T<_.length-1;T++){var O=A;A=0;for(var D=k&67108863,S=Math.min(T,v.length-1),g=Math.max(0,T-M.length+1);g<=S;g++){var R=T-g,F=M.words[R]|0,C=v.words[g]|0,B=F*C,V=B&67108863;O=O+(B/67108864|0)|0,V=V+D|0,D=V&67108863,O=O+(V>>>26)|0,A+=O>>>26,O&=67108863}_.words[T]=D,k=O,O=A}return k!==0?_.words[T]=k:_.length--,_._strip()}function P(M,v,_){return E(M,v,_)}s.prototype.mulTo=function(v,_){var k,A=this.length+v.length;return this.length===10&&v.length===10?k=w(this,v,_):A<63?k=b(this,v,_):A<1024?k=E(this,v,_):k=P(this,v,_),k},s.prototype.mul=function(v){var _=new s(null);return _.words=new Array(this.length+v.length),this.mulTo(v,_)},s.prototype.mulf=function(v){var _=new s(null);return _.words=new Array(this.length+v.length),P(this,v,_)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var _=v<0;_&&(v=-v),n(typeof v=="number"),n(v<67108864);for(var k=0,A=0;A>=26,k+=T/67108864|0,k+=O>>>26,this.words[A]=O&67108863}return k!==0&&(this.words[A]=k,this.length++),_?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var _=x(v);if(_.length===0)return new s(1);for(var k=this,A=0;A<_.length&&_[A]===0;A++,k=k.sqr());if(++A<_.length)for(var T=k.sqr();A<_.length;A++,T=T.sqr())_[A]!==0&&(k=k.mul(T));return k},s.prototype.iushln=function(v){n(typeof v=="number"&&v>=0);var _=v%26,k=(v-_)/26,A=67108863>>>26-_<<26-_,T;if(_!==0){var O=0;for(T=0;T>>26-_}O&&(this.words[T]=O,this.length++)}if(k!==0){for(T=this.length-1;T>=0;T--)this.words[T+k]=this.words[T];for(T=0;T=0);var A;_?A=(_-_%26)/26:A=0;var T=v%26,O=Math.min((v-T)/26,this.length),D=67108863^67108863>>>T<O)for(this.length-=O,g=0;g=0&&(R!==0||g>=A);g--){var F=this.words[g]|0;this.words[g]=R<<26-T|F>>>T,R=F&D}return S&&R!==0&&(S.words[S.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,_,k){return n(this.negative===0),this.iushrn(v,_,k)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){n(typeof v=="number"&&v>=0);var _=v%26,k=(v-_)/26,A=1<<_;if(this.length<=k)return!1;var T=this.words[k];return!!(T&A)},s.prototype.imaskn=function(v){n(typeof v=="number"&&v>=0);var _=v%26,k=(v-_)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=k)return this;if(_!==0&&k++,this.length=Math.min(k,this.length),_!==0){var A=67108863^67108863>>>_<<_;this.words[this.length-1]&=A}return this._strip()},s.prototype.maskn=function(v){return this.clone().imaskn(v)},s.prototype.iaddn=function(v){return n(typeof v=="number"),n(v<67108864),v<0?this.isubn(-v):this.negative!==0?this.length===1&&(this.words[0]|0)<=v?(this.words[0]=v-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(v),this.negative=1,this):this._iaddn(v)},s.prototype._iaddn=function(v){this.words[0]+=v;for(var _=0;_=67108864;_++)this.words[_]-=67108864,_===this.length-1?this.words[_+1]=1:this.words[_+1]++;return this.length=Math.max(this.length,_+1),this},s.prototype.isubn=function(v){if(n(typeof v=="number"),n(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var _=0;_>26)-(S/67108864|0),this.words[T+k]=O&67108863}for(;T>26,this.words[T+k]=O&67108863;if(D===0)return this._strip();for(n(D===-1),D=0,T=0;T>26,this.words[T]=O&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,_){var k=this.length-v.length,A=this.clone(),T=v,O=T.words[T.length-1]|0,D=this._countBits(O);k=26-D,k!==0&&(T=T.ushln(k),A.iushln(k),O=T.words[T.length-1]|0);var S=A.length-T.length,g;if(_!=="mod"){g=new s(null),g.length=S+1,g.words=new Array(g.length);for(var R=0;R=0;C--){var B=(A.words[T.length+C]|0)*67108864+(A.words[T.length+C-1]|0);for(B=Math.min(B/O|0,67108863),A._ishlnsubmul(T,B,C);A.negative!==0;)B--,A.negative=0,A._ishlnsubmul(T,1,C),A.isZero()||(A.negative^=1);g&&(g.words[C]=B)}return g&&g._strip(),A._strip(),_!=="div"&&k!==0&&A.iushrn(k),{div:g||null,mod:A}},s.prototype.divmod=function(v,_,k){if(n(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var A,T,O;return this.negative!==0&&v.negative===0?(O=this.neg().divmod(v,_),_!=="mod"&&(A=O.div.neg()),_!=="div"&&(T=O.mod.neg(),k&&T.negative!==0&&T.iadd(v)),{div:A,mod:T}):this.negative===0&&v.negative!==0?(O=this.divmod(v.neg(),_),_!=="mod"&&(A=O.div.neg()),{div:A,mod:O.mod}):this.negative&v.negative?(O=this.neg().divmod(v.neg(),_),_!=="div"&&(T=O.mod.neg(),k&&T.negative!==0&&T.isub(v)),{div:O.div,mod:T}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?_==="div"?{div:this.divn(v.words[0]),mod:null}:_==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,_)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var _=this.divmod(v);if(_.mod.isZero())return _.div;var k=_.div.negative!==0?_.mod.isub(v):_.mod,A=v.ushrn(1),T=v.andln(1),O=k.cmp(A);return O<0||T===1&&O===0?_.div:_.div.negative!==0?_.div.isubn(1):_.div.iaddn(1)},s.prototype.modrn=function(v){var _=v<0;_&&(v=-v),n(v<=67108863);for(var k=(1<<26)%v,A=0,T=this.length-1;T>=0;T--)A=(k*A+(this.words[T]|0))%v;return _?-A:A},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var _=v<0;_&&(v=-v),n(v<=67108863);for(var k=0,A=this.length-1;A>=0;A--){var T=(this.words[A]|0)+k*67108864;this.words[A]=T/v|0,k=T%v}return this._strip(),_?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){n(v.negative===0),n(!v.isZero());var _=this,k=v.clone();_.negative!==0?_=_.umod(v):_=_.clone();for(var A=new s(1),T=new s(0),O=new s(0),D=new s(1),S=0;_.isEven()&&k.isEven();)_.iushrn(1),k.iushrn(1),++S;for(var g=k.clone(),R=_.clone();!_.isZero();){for(var F=0,C=1;!(_.words[0]&C)&&F<26;++F,C<<=1);if(F>0)for(_.iushrn(F);F-- >0;)(A.isOdd()||T.isOdd())&&(A.iadd(g),T.isub(R)),A.iushrn(1),T.iushrn(1);for(var B=0,V=1;!(k.words[0]&V)&&B<26;++B,V<<=1);if(B>0)for(k.iushrn(B);B-- >0;)(O.isOdd()||D.isOdd())&&(O.iadd(g),D.isub(R)),O.iushrn(1),D.iushrn(1);_.cmp(k)>=0?(_.isub(k),A.isub(O),T.isub(D)):(k.isub(_),O.isub(A),D.isub(T))}return{a:O,b:D,gcd:k.iushln(S)}},s.prototype._invmp=function(v){n(v.negative===0),n(!v.isZero());var _=this,k=v.clone();_.negative!==0?_=_.umod(v):_=_.clone();for(var A=new s(1),T=new s(0),O=k.clone();_.cmpn(1)>0&&k.cmpn(1)>0;){for(var D=0,S=1;!(_.words[0]&S)&&D<26;++D,S<<=1);if(D>0)for(_.iushrn(D);D-- >0;)A.isOdd()&&A.iadd(O),A.iushrn(1);for(var g=0,R=1;!(k.words[0]&R)&&g<26;++g,R<<=1);if(g>0)for(k.iushrn(g);g-- >0;)T.isOdd()&&T.iadd(O),T.iushrn(1);_.cmp(k)>=0?(_.isub(k),A.isub(T)):(k.isub(_),T.isub(A))}var F;return _.cmpn(1)===0?F=A:F=T,F.cmpn(0)<0&&F.iadd(v),F},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var _=this.clone(),k=v.clone();_.negative=0,k.negative=0;for(var A=0;_.isEven()&&k.isEven();A++)_.iushrn(1),k.iushrn(1);do{for(;_.isEven();)_.iushrn(1);for(;k.isEven();)k.iushrn(1);var T=_.cmp(k);if(T<0){var O=_;_=k,k=O}else if(T===0||k.cmpn(1)===0)break;_.isub(k)}while(!0);return k.iushln(A)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){n(typeof v=="number");var _=v%26,k=(v-_)/26,A=1<<_;if(this.length<=k)return this._expand(k+1),this.words[k]|=A,this;for(var T=A,O=k;T!==0&&O>>26,D&=67108863,this.words[O]=D}return T!==0&&(this.words[O]=T,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var _=v<0;if(this.negative!==0&&!_)return-1;if(this.negative===0&&_)return 1;this._strip();var k;if(this.length>1)k=1;else{_&&(v=-v),n(v<=67108863,"Number is too big");var A=this.words[0]|0;k=A===v?0:Av.length)return 1;if(this.length=0;k--){var A=this.words[k]|0,T=v.words[k]|0;if(A!==T){AT&&(_=1);break}}return _},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new X(v)},s.prototype.toRed=function(v){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return n(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(v){return n(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var N={k256:null,p224:null,p192:null,p25519:null};function I(M,v){this.name=M,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}I.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},I.prototype.ireduce=function(v){var _=v,k;do this.split(_,this.tmp),_=this.imulK(_),_=_.iadd(this.tmp),k=_.bitLength();while(k>this.n);var A=k0?_.isub(this.p):_.strip!==void 0?_.strip():_._strip(),_},I.prototype.split=function(v,_){v.iushrn(this.n,0,_)},I.prototype.imulK=function(v){return v.imul(this.k)};function j(){I.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(j,I),j.prototype.split=function(v,_){for(var k=4194303,A=Math.min(v.length,9),T=0;T>>22,O=D}O>>>=22,v.words[T-10]=O,O===0&&v.length>10?v.length-=10:v.length-=9},j.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var _=0,k=0;k>>=26,v.words[k]=T,_=A}return _!==0&&(v.words[v.length++]=_),v},s._prime=function(v){if(N[v])return N[v];var _;if(v==="k256")_=new j;else if(v==="p224")_=new L;else if(v==="p192")_=new U;else if(v==="p25519")_=new K;else throw new Error("Unknown prime "+v);return N[v]=_,_};function X(M){if(typeof M=="string"){var v=s._prime(M);this.m=v.p,this.prime=v}else n(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}X.prototype._verify1=function(v){n(v.negative===0,"red works only with positives"),n(v.red,"red works only with red numbers")},X.prototype._verify2=function(v,_){n((v.negative|_.negative)===0,"red works only with positives"),n(v.red&&v.red===_.red,"red works only with red numbers")},X.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(f(v,v.umod(this.m)._forceRed(this)),v)},X.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},X.prototype.add=function(v,_){this._verify2(v,_);var k=v.add(_);return k.cmp(this.m)>=0&&k.isub(this.m),k._forceRed(this)},X.prototype.iadd=function(v,_){this._verify2(v,_);var k=v.iadd(_);return k.cmp(this.m)>=0&&k.isub(this.m),k},X.prototype.sub=function(v,_){this._verify2(v,_);var k=v.sub(_);return k.cmpn(0)<0&&k.iadd(this.m),k._forceRed(this)},X.prototype.isub=function(v,_){this._verify2(v,_);var k=v.isub(_);return k.cmpn(0)<0&&k.iadd(this.m),k},X.prototype.shl=function(v,_){return this._verify1(v),this.imod(v.ushln(_))},X.prototype.imul=function(v,_){return this._verify2(v,_),this.imod(v.imul(_))},X.prototype.mul=function(v,_){return this._verify2(v,_),this.imod(v.mul(_))},X.prototype.isqr=function(v){return this.imul(v,v.clone())},X.prototype.sqr=function(v){return this.mul(v,v)},X.prototype.sqrt=function(v){if(v.isZero())return v.clone();var _=this.m.andln(3);if(n(_%2===1),_===3){var k=this.m.add(new s(1)).iushrn(2);return this.pow(v,k)}for(var A=this.m.subn(1),T=0;!A.isZero()&&A.andln(1)===0;)T++,A.iushrn(1);n(!A.isZero());var O=new s(1).toRed(this),D=O.redNeg(),S=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new s(2*g*g).toRed(this);this.pow(g,S).cmp(D)!==0;)g.redIAdd(D);for(var R=this.pow(g,A),F=this.pow(v,A.addn(1).iushrn(1)),C=this.pow(v,A),B=T;C.cmp(O)!==0;){for(var V=C,H=0;V.cmp(O)!==0;H++)V=V.redSqr();n(H=0;T--){for(var R=_.words[T],F=g-1;F>=0;F--){var C=R>>F&1;if(O!==A[0]&&(O=this.sqr(O)),C===0&&D===0){S=0;continue}D<<=1,D|=C,S++,!(S!==k&&(T!==0||F!==0))&&(O=this.mul(O,A[D]),S=0,D=0)}g=26}return O},X.prototype.convertTo=function(v){var _=v.umod(this.m);return _===v?_.clone():_},X.prototype.convertFrom=function(v){var _=v.clone();return _.red=null,_},s.mont=function(v){return new ee(v)};function ee(M){X.call(this,M),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ee,X),ee.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},ee.prototype.convertFrom=function(v){var _=this.imod(v.mul(this.rinv));return _.red=null,_},ee.prototype.imul=function(v,_){if(v.isZero()||_.isZero())return v.words[0]=0,v.length=1,v;var k=v.imul(_),A=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=k.isub(A).iushrn(this.shift),O=T;return T.cmp(this.m)>=0?O=T.isub(this.m):T.cmpn(0)<0&&(O=T.iadd(this.m)),O._forceRed(this)},ee.prototype.mul=function(v,_){if(v.isZero()||_.isZero())return new s(0)._forceRed(this);var k=v.mul(_),A=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=k.isub(A).iushrn(this.shift),O=T;return T.cmp(this.m)>=0?O=T.isub(this.m):T.cmpn(0)<0&&(O=T.iadd(this.m)),O._forceRed(this)},ee.prototype.invm=function(v){var _=this.imod(v._invmp(this.m).mul(this.r2));return _._forceRed(this)}})(t,hC)})(mx);var sq=mx.exports;const De=eo(sq),oq="logger/5.7.0";let WS=!1,GS=!1;const nh={debug:1,default:2,info:2,warning:3,error:4,off:5};let KS=nh.default,Lv=null;function aq(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const YS=aq();var Wy;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Wy||(Wy={}));var _i;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(_i||(_i={}));const QS="0123456789abcdef";let Q=class _r{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();nh[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(KS>nh[n])&&console.log.apply(console,r)}debug(...e){this._log(_r.levels.DEBUG,e)}info(...e){this._log(_r.levels.INFO,e)}warn(...e){this._log(_r.levels.WARNING,e)}makeError(e,r,n){if(GS)return this.makeError("censored error",r,{});r||(r=_r.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(l=>{const c=n[l];try{if(c instanceof Uint8Array){let f="";for(let u=0;u>4],f+=QS[c[u]&15];i.push(l+"=Uint8Array(0x"+f+")")}else i.push(l+"="+JSON.stringify(c))}catch{i.push(l+"="+JSON.stringify(n[l].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case _i.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case _i.CALL_EXCEPTION:case _i.INSUFFICIENT_FUNDS:case _i.MISSING_NEW:case _i.NONCE_EXPIRED:case _i.REPLACEMENT_UNDERPRICED:case _i.TRANSACTION_REPLACED:case _i.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(l){a[l]=n[l]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,_r.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){YS&&this.throwError("platform missing String.prototype.normalize",_r.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:YS})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,_r.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,_r.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,_r.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",_r.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",_r.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",_r.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Lv||(Lv=new _r(oq)),Lv}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",_r.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),WS){if(!e)return;this.globalLogger().throwError("error censorship permanent",_r.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}GS=!!e,WS=!!r}static setLogLevel(e){const r=nh[e.toLowerCase()];if(r==null){_r.globalLogger().warn("invalid log level - "+e);return}KS=r}static from(e){return new _r(e)}};Q.errors=_i;Q.levels=Wy;const lq="bytes/5.7.0",or=new Q(lq);function Z8(t){return!!t.toHexString}function Vl(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Vl(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function b1(t){return et(t)&&!(t.length%2)||kc(t)}function JS(t){return typeof t=="number"&&t==t&&t%1===0}function kc(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!JS(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function de(t,e){if(e||(e={}),typeof t=="number"){or.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Vl(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Z8(t)&&(t=t.toHexString()),et(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":or.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ide(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Vl(n)}function zs(t){let e=de(t);if(e.length===0)return e;let r=0;for(;re&&or.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Vl(r)}function et(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const jv="0123456789abcdef";function he(t,e){if(e||(e={}),typeof t=="number"){or.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=jv[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Z8(t))return t.toHexString();if(et(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":or.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(kc(t)){let r="0x";for(let n=0;n>4]+jv[i&15]}return r}return or.throwArgumentError("invalid hexlify value","value",t)}function Ua(t){if(typeof t!="string")t=he(t);else if(!et(t)||t.length%2)return null;return(t.length-2)/2}function Pr(t,e,r){return typeof t!="string"?t=he(t):(!et(t)||t.length%2)&&or.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function En(t){let e="0x";return t.forEach(r=>{e+=he(r).substring(2)}),e}function gx(t){const e=fq(he(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function fq(t){typeof t!="string"&&(t=he(t)),et(t)||or.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&or.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ac(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(b1(t)){let r=de(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=he(r.slice(0,32)),e.s=he(r.slice(32,64))):r.length===65?(e.r=he(r.slice(0,32)),e.s=he(r.slice(32,64)),e.v=r[64]):or.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:or.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=he(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=cq(de(e._vs),32);e._vs=he(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&or.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=he(i);e.s==null?e.s=o:e.s!==o&&or.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?or.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&or.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!et(e.r)?or.throwArgumentError("signature missing or invalid r","signature",t):e.r=Vt(e.r,32),e.s==null||!et(e.s)?or.throwArgumentError("signature missing or invalid s","signature",t):e.s=Vt(e.s,32);const r=de(e.s);r[0]>=128&&or.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=he(r);e._vs&&(et(e._vs)||or.throwArgumentError("signature invalid _vs","signature",t),e._vs=Vt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&or.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function XS(t){return t=Ac(t),he(wr([t.r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}const e7="bignumber/5.7.0";var s0=De.BN;const Ts=new Q(e7),Fv={},ZS=9007199254740991;function uq(t){return t!=null&&(ce.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||et(t)||typeof t=="bigint"||kc(t))}let ek=!1;class ce{constructor(e,r){e!==Fv&&Ts.throwError("cannot call constructor directly; use BigNumber.from",Q.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return bn(We(this).fromTwos(e))}toTwos(e){return bn(We(this).toTwos(e))}abs(){return this._hex[0]==="-"?ce.from(this._hex.substring(1)):this}add(e){return bn(We(this).add(We(e)))}sub(e){return bn(We(this).sub(We(e)))}div(e){return ce.from(e).isZero()&&si("division-by-zero","div"),bn(We(this).div(We(e)))}mul(e){return bn(We(this).mul(We(e)))}mod(e){const r=We(e);return r.isNeg()&&si("division-by-zero","mod"),bn(We(this).umod(r))}pow(e){const r=We(e);return r.isNeg()&&si("negative-power","pow"),bn(We(this).pow(r))}and(e){const r=We(e);return(this.isNegative()||r.isNeg())&&si("unbound-bitwise-result","and"),bn(We(this).and(r))}or(e){const r=We(e);return(this.isNegative()||r.isNeg())&&si("unbound-bitwise-result","or"),bn(We(this).or(r))}xor(e){const r=We(e);return(this.isNegative()||r.isNeg())&&si("unbound-bitwise-result","xor"),bn(We(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&si("negative-width","mask"),bn(We(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&si("negative-width","shl"),bn(We(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&si("negative-width","shr"),bn(We(this).shrn(e))}eq(e){return We(this).eq(We(e))}lt(e){return We(this).lt(We(e))}lte(e){return We(this).lte(We(e))}gt(e){return We(this).gt(We(e))}gte(e){return We(this).gte(We(e))}isNegative(){return this._hex[0]==="-"}isZero(){return We(this).isZero()}toNumber(){try{return We(this).toNumber()}catch{si("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ts.throwError("this platform does not support BigInt",Q.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?ek||(ek=!0,Ts.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ts.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Q.errors.UNEXPECTED_ARGUMENT,{}):Ts.throwError("BigNumber.toString does not accept parameters",Q.errors.UNEXPECTED_ARGUMENT,{})),We(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ce)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ce(Fv,ou(e)):e.match(/^-?[0-9]+$/)?new ce(Fv,ou(new s0(e))):Ts.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&si("underflow","BigNumber.from",e),(e>=ZS||e<=-ZS)&&si("overflow","BigNumber.from",e),ce.from(String(e));const r=e;if(typeof r=="bigint")return ce.from(r.toString());if(kc(r))return ce.from(he(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return ce.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(et(n)||n[0]==="-"&&et(n.substring(1))))return ce.from(n)}return Ts.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function ou(t){if(typeof t!="string")return ou(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ts.throwArgumentError("invalid hex","value",t),t=ou(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function bn(t){return ce.from(ou(t))}function We(t){const e=ce.from(t).toHexString();return e[0]==="-"?new s0("-"+e.substring(3),16):new s0(e.substring(2),16)}function si(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),Ts.throwError(t,Q.errors.NUMERIC_FAULT,n)}function dq(t){return new s0(t,36).toString(16)}const pn=new Q(e7),_f={},t7=ce.from(0),r7=ce.from(-1);function n7(t,e,r,n){const i={fault:e,operation:r};return n!==void 0&&(i.value=n),pn.throwError(t,Q.errors.NUMERIC_FAULT,i)}let Tf="0";for(;Tf.length<256;)Tf+=Tf;function xx(t){if(typeof t!="number")try{t=ce.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Tf.substring(0,t):pn.throwArgumentError("invalid decimal size","decimals",t)}function ih(t,e){e==null&&(e=0);const r=xx(e);t=ce.from(t);const n=t.lt(t7);n&&(t=t.mul(r7));let i=t.mod(r).toString();for(;i.length2&&pn.throwArgumentError("too many decimal points","value",t);let s=i[0],o=i[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&n7("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.lengthe[o]==null?l:(typeof e[o]!==a&&pn.throwArgumentError("invalid fixed format ("+o+" not "+a+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&pn.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&pn.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new ql(_f,r,n,i)}}class Vr{constructor(e,r,n,i){e!==_f&&pn.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Q.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&pn.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Gi(this._value,this.format.decimals),n=Gi(e._value,e.format.decimals);return Vr.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Vr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(tk.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Vr.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(tk.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&pn.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const n=Vr.from("1"+Tf.substring(0,e),this.format),i=hq.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&pn.throwArgumentError("invalid byte width","width",e);const r=ce.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Vt(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Vr.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!uq(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),Vr.fromString(ih(e,r),ql.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=ql.from(r),i=Gi(e,n.decimals);!n.signed&&i.lt(t7)&&n7("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=Vt(s,n.width/8));const o=ih(i,n.decimals);return new Vr(_f,s,o,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=ql.from(r);if(de(e).length>n.width/8)throw new Error("overflow");let i=ce.from(e);n.signed&&(i=i.fromTwos(n.width));const s=i.toTwos((n.signed?0:1)+n.width).toHexString(),o=ih(i,n.decimals);return new Vr(_f,s,o,n)}static from(e,r){if(typeof e=="string")return Vr.fromString(e,r);if(kc(e))return Vr.fromBytes(e,r);try{return Vr.fromValue(e,0,r)}catch(n){if(n.code!==Q.errors.INVALID_ARGUMENT)throw n}return pn.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const tk=Vr.from(1),hq=Vr.from("0.5"),vq="properties/5.7.0";var pq=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const o0=new Q(vq);function ie(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function is(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yr(t){return pq(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(s=>({key:n,value:s}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function i7(t,e){(!t||typeof t!="object")&&o0.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||o0.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function Or(t){const e={};for(const r in t)e[r]=t[r];return e}const yq={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function s7(t){if(t==null||yq[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rza(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&ie(e,r,za(n))}return e}return o0.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function za(t){return mq(t)}class tl{constructor(e){for(const r in e)this[r]=za(e[r])}}const Bu="abi/5.7.0",Qe=new Q(Bu),Va={};let rk={calldata:!0,memory:!0,storage:!0},gq={calldata:!0,memory:!0};function Ed(t,e){if(t==="bytes"||t==="string"){if(rk[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&gq[e])return!0;return(rk[e]||e==="payable")&&Qe.throwArgumentError("invalid modifier","name",e),!1}function xq(t,e){let r=t;function n(a){Qe.throwArgumentError(`unexpected character at position ${a}`,"param",t)}t=t.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==it.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===it.full?", ":",")+")"):r+=this.type,e!==it.sighash&&(this.indexed===!0&&(r+=" indexed"),e===it.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?Dr.fromString(e,r):Dr.fromObject(e)}static fromObject(e){return Dr.isParamType(e)?e:new Dr(Va,{name:e.name||null,type:vl(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Dr.fromObject):null})}static fromString(e,r){function n(i){return Dr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n(xq(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function au(t,e){return Eq(t).map(r=>Dr.fromString(r,e))}class js{constructor(e,r){e!==Va&&Qe.throwError("use a static from method",Q.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),sh(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return js.isFragment(e)?e:typeof e=="string"?js.fromString(e):js.fromObject(e)}static fromObject(e){if(js.isFragment(e))return e;switch(e.type){case"function":return ts.fromObject(e);case"event":return Ms.fromObject(e);case"constructor":return es.fromObject(e);case"error":return ko.fromObject(e);case"fallback":case"receive":return null}return Qe.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Ms.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?ts.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?es.fromString(e.trim()):e.split(" ")[0]==="error"?ko.fromString(e.substring(5).trim()):Qe.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Ms extends js{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==it.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ",e!==it.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?Ms.fromString(e):Ms.fromObject(e)}static fromObject(e){if(Ms.isEventFragment(e))return e;e.type!=="event"&&Qe.throwArgumentError("invalid event object","value",e);const r={name:lu(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Dr.fromObject):[],type:"event"};return new Ms(Va,r)}static fromString(e){let r=e.match(cu);r||Qe.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Qe.warn("unknown modifier: "+i)}}),Ms.fromObject({name:r[1].trim(),anonymous:n,inputs:au(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function o7(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Qe.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Qe.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=ce.from(r[1]),r[0]):t}function a7(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function l7(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Qe.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Qe.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Qe.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Qe.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Qe.throwArgumentError("unable to determine stateMutability","value",t),e}class es extends js{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===it.sighash&&Qe.throwError("cannot format a constructor for sighash",Q.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?es.fromString(e):es.fromObject(e)}static fromObject(e){if(es.isConstructorFragment(e))return e;e.type!=="constructor"&&Qe.throwArgumentError("invalid constructor object","value",e);let r=l7(e);r.constant&&Qe.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?ce.from(e.gas):null};return new es(Va,n)}static fromString(e){let r={type:"constructor"};e=o7(e,r);let n=e.match(cu);return(!n||n[1].trim()!=="constructor")&&Qe.throwArgumentError("invalid constructor string","value",e),r.inputs=au(n[2].trim(),!1),a7(n[3].trim(),r),es.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class ts extends es{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.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?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==it.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ",e!==it.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?ts.fromString(e):ts.fromObject(e)}static fromObject(e){if(ts.isFunctionFragment(e))return e;e.type!=="function"&&Qe.throwArgumentError("invalid function object","value",e);let r=l7(e);const n={type:e.type,name:lu(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(Dr.fromObject):[],outputs:e.outputs?e.outputs.map(Dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?ce.from(e.gas):null};return new ts(Va,n)}static fromString(e){let r={type:"function"};e=o7(e,r);let n=e.split(" returns ");n.length>2&&Qe.throwArgumentError("invalid function string","value",e);let i=n[0].match(cu);if(i||Qe.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&lu(r.name),r.inputs=au(i[2],!1),a7(i[3].trim(),r),n.length>1){let s=n[1].match(cu);(s[1].trim()!=""||s[3].trim()!="")&&Qe.throwArgumentError("unexpected tokens","value",e),r.outputs=au(s[2],!1)}else r.outputs=[];return ts.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function nk(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Qe.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ko extends js{format(e){if(e||(e=it.sighash),it[e]||Qe.throwArgumentError("invalid format type","format",e),e===it.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==it.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===it.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ko.fromString(e):ko.fromObject(e)}static fromObject(e){if(ko.isErrorFragment(e))return e;e.type!=="error"&&Qe.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:lu(e.name),inputs:e.inputs?e.inputs.map(Dr.fromObject):[]};return nk(new ko(Va,r))}static fromString(e){let r={type:"error"},n=e.match(cu);return n||Qe.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&lu(r.name),r.inputs=au(n[2],!1),nk(ko.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function vl(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const wq=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function lu(t){return(!t||!t.match(wq))&&Qe.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const cu=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Eq(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&bx.throwError("value out-of-bounds",Q.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=wr([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class a0{constructor(e,r,n,i){ie(this,"_data",de(e)),ie(this,"wordSize",r||32),ie(this,"_coerceFunc",n),ie(this,"allowLoose",i),this._offset=0}get data(){return he(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):a0.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:bx.throwError("data out-of-bounds",Q.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new a0(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return ce.from(this.readBytes(this.wordSize))}}var c7={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 @@ -166,9 +166,9 @@ Defaulting to \`null\`.`}const a8="Radio",[QF,l8]=cn(a8),[JF,XF]=QF(a8),ZF=y.for * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=hC:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],u=[4,1024,262144,67108864],d=[1,256,65536,16777216],h=[6,1536,393216,100663296],p=[0,8,16,24],m=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],x=[224,256,384,512],b=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],E={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(C){return Object.prototype.toString.call(C)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(C){return typeof C=="object"&&C.buffer&&C.buffer.constructor===ArrayBuffer});for(var P=function(C,B,V){return function(H){return new g(C,B,C).update(H)[V]()}},N=function(C,B,V){return function(H,Z){return new g(C,B,Z).update(H)[V]()}},I=function(C,B,V){return function(H,Z,le,ne){return v["cshake"+C].update(H,Z,le,ne)[V]()}},j=function(C,B,V){return function(H,Z,le,ne){return v["kmac"+C].update(H,Z,le,ne)[V]()}},L=function(C,B,V,H){for(var Z=0;Z>5,this.byteCount=this.blockCount<<2,this.outputBlocks=V>>5,this.extraBytes=(V&31)>>3;for(var H=0;H<50;++H)this.s[H]=0}g.prototype.update=function(C){if(this.finalized)throw new Error(r);var B,V=typeof C;if(V!=="string"){if(V==="object"){if(C===null)throw new Error(e);if(l&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!Array.isArray(C)&&(!l||!ArrayBuffer.isView(C)))throw new Error(e)}else throw new Error(e);B=!0}for(var H=this.blocks,Z=this.byteCount,le=C.length,ne=this.blockCount,te=0,Me=this.s,pe,ke;te>2]|=C[te]<>2]|=ke<>2]|=(192|ke>>6)<>2]|=(128|ke&63)<=57344?(H[pe>>2]|=(224|ke>>12)<>2]|=(128|ke>>6&63)<>2]|=(128|ke&63)<>2]|=(240|ke>>18)<>2]|=(128|ke>>12&63)<>2]|=(128|ke>>6&63)<>2]|=(128|ke&63)<=Z){for(this.start=pe-Z,this.block=H[ne],pe=0;pe>8,V=C&255;V>0;)Z.unshift(V),C=C>>8,V=C&255,++H;return B?Z.push(H):Z.unshift(H),this.update(Z),Z.length},g.prototype.encodeString=function(C){var B,V=typeof C;if(V!=="string"){if(V==="object"){if(C===null)throw new Error(e);if(l&&C.constructor===ArrayBuffer)C=new Uint8Array(C);else if(!Array.isArray(C)&&(!l||!ArrayBuffer.isView(C)))throw new Error(e)}else throw new Error(e);B=!0}var H=0,Z=C.length;if(B)H=Z;else for(var le=0;le=57344?H+=3:(ne=65536+((ne&1023)<<10|C.charCodeAt(++le)&1023),H+=4)}return H+=this.encode(H*8),this.update(C),H},g.prototype.bytepad=function(C,B){for(var V=this.encode(B),H=0;H>2]|=this.padding[B&3],this.lastByteIndex===this.byteCount)for(C[0]=C[V],B=1;B>4&15]+c[te&15]+c[te>>12&15]+c[te>>8&15]+c[te>>20&15]+c[te>>16&15]+c[te>>28&15]+c[te>>24&15];le%C===0&&(F(B),Z=0)}return H&&(te=B[Z],ne+=c[te>>4&15]+c[te&15],H>1&&(ne+=c[te>>12&15]+c[te>>8&15]),H>2&&(ne+=c[te>>20&15]+c[te>>16&15])),ne},g.prototype.arrayBuffer=function(){this.finalize();var C=this.blockCount,B=this.s,V=this.outputBlocks,H=this.extraBytes,Z=0,le=0,ne=this.outputBits>>3,te;H?te=new ArrayBuffer(V+1<<2):te=new ArrayBuffer(ne);for(var Me=new Uint32Array(te);le>8&255,ne[te+2]=Me>>16&255,ne[te+3]=Me>>24&255;le%C===0&&F(B)}return H&&(te=le<<2,Me=B[Z],ne[te]=Me&255,H>1&&(ne[te+1]=Me>>8&255),H>2&&(ne[te+2]=Me>>16&255)),ne};function R(C,B,V){g.call(this,C,B,V)}R.prototype=new g,R.prototype.finalize=function(){return this.encode(this.outputBits,!0),g.prototype.finalize.call(this)};var F=function(C){var B,V,H,Z,le,ne,te,Me,pe,ke,sr,Ze,ct,ei,ft,rt,bs,Pt,st,Nn,mt,ut,Zr,Ye,gt,ti,Rt,Je,Fi,xt,bt,ws,wt,ot,Bi,dt,at,bi,It,Et,Es,St,lt,ri,Ot,Mt,z,q,W,re,fe,ve,Ee,ae,ge,we,ye,Ae,Be,He,je,Dt,ht;for(H=0;H<48;H+=2)Z=C[0]^C[10]^C[20]^C[30]^C[40],le=C[1]^C[11]^C[21]^C[31]^C[41],ne=C[2]^C[12]^C[22]^C[32]^C[42],te=C[3]^C[13]^C[23]^C[33]^C[43],Me=C[4]^C[14]^C[24]^C[34]^C[44],pe=C[5]^C[15]^C[25]^C[35]^C[45],ke=C[6]^C[16]^C[26]^C[36]^C[46],sr=C[7]^C[17]^C[27]^C[37]^C[47],Ze=C[8]^C[18]^C[28]^C[38]^C[48],ct=C[9]^C[19]^C[29]^C[39]^C[49],B=Ze^(ne<<1|te>>>31),V=ct^(te<<1|ne>>>31),C[0]^=B,C[1]^=V,C[10]^=B,C[11]^=V,C[20]^=B,C[21]^=V,C[30]^=B,C[31]^=V,C[40]^=B,C[41]^=V,B=Z^(Me<<1|pe>>>31),V=le^(pe<<1|Me>>>31),C[2]^=B,C[3]^=V,C[12]^=B,C[13]^=V,C[22]^=B,C[23]^=V,C[32]^=B,C[33]^=V,C[42]^=B,C[43]^=V,B=ne^(ke<<1|sr>>>31),V=te^(sr<<1|ke>>>31),C[4]^=B,C[5]^=V,C[14]^=B,C[15]^=V,C[24]^=B,C[25]^=V,C[34]^=B,C[35]^=V,C[44]^=B,C[45]^=V,B=Me^(Ze<<1|ct>>>31),V=pe^(ct<<1|Ze>>>31),C[6]^=B,C[7]^=V,C[16]^=B,C[17]^=V,C[26]^=B,C[27]^=V,C[36]^=B,C[37]^=V,C[46]^=B,C[47]^=V,B=ke^(Z<<1|le>>>31),V=sr^(le<<1|Z>>>31),C[8]^=B,C[9]^=V,C[18]^=B,C[19]^=V,C[28]^=B,C[29]^=V,C[38]^=B,C[39]^=V,C[48]^=B,C[49]^=V,ei=C[0],ft=C[1],Mt=C[11]<<4|C[10]>>>28,z=C[10]<<4|C[11]>>>28,Je=C[20]<<3|C[21]>>>29,Fi=C[21]<<3|C[20]>>>29,He=C[31]<<9|C[30]>>>23,je=C[30]<<9|C[31]>>>23,St=C[40]<<18|C[41]>>>14,lt=C[41]<<18|C[40]>>>14,ot=C[2]<<1|C[3]>>>31,Bi=C[3]<<1|C[2]>>>31,rt=C[13]<<12|C[12]>>>20,bs=C[12]<<12|C[13]>>>20,q=C[22]<<10|C[23]>>>22,W=C[23]<<10|C[22]>>>22,xt=C[33]<<13|C[32]>>>19,bt=C[32]<<13|C[33]>>>19,Dt=C[42]<<2|C[43]>>>30,ht=C[43]<<2|C[42]>>>30,ae=C[5]<<30|C[4]>>>2,ge=C[4]<<30|C[5]>>>2,dt=C[14]<<6|C[15]>>>26,at=C[15]<<6|C[14]>>>26,Pt=C[25]<<11|C[24]>>>21,st=C[24]<<11|C[25]>>>21,re=C[34]<<15|C[35]>>>17,fe=C[35]<<15|C[34]>>>17,ws=C[45]<<29|C[44]>>>3,wt=C[44]<<29|C[45]>>>3,Ye=C[6]<<28|C[7]>>>4,gt=C[7]<<28|C[6]>>>4,we=C[17]<<23|C[16]>>>9,ye=C[16]<<23|C[17]>>>9,bi=C[26]<<25|C[27]>>>7,It=C[27]<<25|C[26]>>>7,Nn=C[36]<<21|C[37]>>>11,mt=C[37]<<21|C[36]>>>11,ve=C[47]<<24|C[46]>>>8,Ee=C[46]<<24|C[47]>>>8,ri=C[8]<<27|C[9]>>>5,Ot=C[9]<<27|C[8]>>>5,ti=C[18]<<20|C[19]>>>12,Rt=C[19]<<20|C[18]>>>12,Ae=C[29]<<7|C[28]>>>25,Be=C[28]<<7|C[29]>>>25,Et=C[38]<<8|C[39]>>>24,Es=C[39]<<8|C[38]>>>24,ut=C[48]<<14|C[49]>>>18,Zr=C[49]<<14|C[48]>>>18,C[0]=ei^~rt&Pt,C[1]=ft^~bs&st,C[10]=Ye^~ti&Je,C[11]=gt^~Rt&Fi,C[20]=ot^~dt&bi,C[21]=Bi^~at&It,C[30]=ri^~Mt&q,C[31]=Ot^~z&W,C[40]=ae^~we&Ae,C[41]=ge^~ye&Be,C[2]=rt^~Pt&Nn,C[3]=bs^~st&mt,C[12]=ti^~Je&xt,C[13]=Rt^~Fi&bt,C[22]=dt^~bi&Et,C[23]=at^~It&Es,C[32]=Mt^~q&re,C[33]=z^~W&fe,C[42]=we^~Ae&He,C[43]=ye^~Be&je,C[4]=Pt^~Nn&ut,C[5]=st^~mt&Zr,C[14]=Je^~xt&ws,C[15]=Fi^~bt&wt,C[24]=bi^~Et&St,C[25]=It^~Es<,C[34]=q^~re&ve,C[35]=W^~fe&Ee,C[44]=Ae^~He&Dt,C[45]=Be^~je&ht,C[6]=Nn^~ut&ei,C[7]=mt^~Zr&ft,C[16]=xt^~ws&Ye,C[17]=bt^~wt>,C[26]=Et^~St&ot,C[27]=Es^~lt&Bi,C[36]=re^~ve&ri,C[37]=fe^~Ee&Ot,C[46]=He^~Dt&ae,C[47]=je^~ht&ge,C[8]=ut^~ei&rt,C[9]=Zr^~ft&bs,C[18]=ws^~Ye&ti,C[19]=wt^~gt&Rt,C[28]=St^~ot&dt,C[29]=lt^~Bi&at,C[38]=ve^~ri&Mt,C[39]=Ee^~Ot&z,C[48]=Dt^~ae&we,C[49]=ht^~ge&ye,C[0]^=m[H],C[1]^=m[H+1]};if(a)t.exports=v;else for(k=0;k<_.length;++k)i[_[k]]=v[_[k]]})()})(c7);var kq=c7.exports;const Aq=eo(kq);function Xe(t){return"0x"+Aq.keccak_256(de(t))}const Cq="rlp/5.7.0",Qi=new Q(Cq);function ik(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function sk(t,e,r){let n=0;for(let i=0;ie+1+n&&Qi.throwError("child data too short",Q.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function u7(t,e){if(t.length===0&&Qi.throwError("data too short",Q.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&Qi.throwError("data short segment too short",Q.errors.BUFFER_OVERRUN,{});const n=sk(t,e+1,r);return e+1+r+n>t.length&&Qi.throwError("data long segment too short",Q.errors.BUFFER_OVERRUN,{}),ok(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&Qi.throwError("data array too short",Q.errors.BUFFER_OVERRUN,{}),ok(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&Qi.throwError("data array too short",Q.errors.BUFFER_OVERRUN,{});const n=sk(t,e+1,r);e+1+r+n>t.length&&Qi.throwError("data array too short",Q.errors.BUFFER_OVERRUN,{});const i=he(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&Qi.throwError("data too short",Q.errors.BUFFER_OVERRUN,{});const n=he(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:he(t[e])}}function wx(t){const e=de(t),r=u7(e,0);return r.consumed!==e.length&&Qi.throwArgumentError("invalid rlp data","data",t),r.result}const _q="address/5.7.0",Ml=new Q(_q);function ak(t){et(t,20)||Ml.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=de(Xe(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Tq=9007199254740991;function Pq(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Ex={};for(let t=0;t<10;t++)Ex[String(t)]=String(t);for(let t=0;t<26;t++)Ex[String.fromCharCode(65+t)]=String(10+t);const lk=Math.floor(Pq(Tq));function Rq(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>Ex[n]).join("");for(;e.length>=lk;){let n=e.substring(0,lk);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}function ir(t){let e=null;if(typeof t!="string"&&Ml.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=ak(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ml.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Rq(t)&&Ml.throwArgumentError("bad icap checksum","address",t),e=dq(t.substring(4));e.length<40;)e="0"+e;e=ak("0x"+e)}else Ml.throwArgumentError("invalid address","address",t);return e}function Iq(t){try{return ir(t),!0}catch{}return!1}function d7(t){let e=null;try{e=ir(t.from)}catch{Ml.throwArgumentError("missing from address","transaction",t)}const r=zs(de(ce.from(t.nonce).toHexString()));return ir(Pr(Xe(ac([e,r])),12))}class Oq extends so{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=ir(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return ir(Vt(e.readValue().toHexString(),20))}}class Mq extends so{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const Nl=new Q(Bu);function h7(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let l={};n=e.map(c=>{const f=c.localName;return f||Nl.throwError("cannot encode object for signature with missing names",Q.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:r}),l[f]&&Nl.throwError("cannot encode object for signature with duplicate names",Q.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:r}),l[f]=!0,r[f]})}else Nl.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&Nl.throwArgumentError("types/value length mismatch","tuple",r);let i=new Gy(t.wordSize),s=new Gy(t.wordSize),o=[];e.forEach((l,c)=>{let f=n[c];if(l.dynamic){let u=s.length;l.encode(s,f);let d=i.writeUpdatableValue();o.push(h=>{d(h+u)})}else l.encode(i,f)}),o.forEach(l=>{l(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function v7(t,e){let r=[],n=t.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=t.readValue(),l=n.subReader(a.toNumber());try{o=s.decode(l)}catch(c){if(c.code===Q.errors.BUFFER_OVERRUN)throw c;o=c,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(t)}catch(a){if(a.code===Q.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&r.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;const l=r[o];l instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw l}}):r[a]=l});for(let s=0;s{throw o}})}return Object.freeze(r)}class Nq extends so{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",s=r===-1||e.dynamic;super("array",i,n,s),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&Nl.throwError("insufficient data length",Q.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;o++)s++;return s}return t===Fn.OVERRUN?r.length-e-1:0}function Wq(t,e,r,n,i){return t===Fn.OVERLONG?(n.push(i),0):(n.push(65533),g7(t,e,r))}const Gq=Object.freeze({error:Hq,ignore:g7,replace:Wq});function x7(t,e){e==null&&(e=Gq.error),t=de(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?n+=e(Fn.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(Fn.BAD_PREFIX,n-1,t,r);continue}if(n-1+s>=t.length){n+=e(Fn.OVERRUN,n-1,t,r);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){n+=e(Fn.OUT_OF_RANGE,n-1-s,t,r,a);continue}if(a>=55296&&a<=57343){n+=e(Fn.UTF16_SURROGATE,n-1-s,t,r,a);continue}if(a<=o){n+=e(Fn.OVERLONG,n-1-s,t,r,a);continue}r.push(a)}}return r}function _t(t,e=Ko.current){e!=Ko.current&&(m7.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return de(r)}function Kq(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Uu(t,e){return Kq(x7(t,e))}function Yq(t,e=Ko.current){return x7(_t(t,e))}class Qq extends p7{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,_t(r))}decode(e){return Uu(super.decode(e))}}class Sd extends so{constructor(e,r){let n=!1;const i=[];e.forEach(o=>{o.dynamic&&(n=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const s=i.localName;return s&&(n[s]||(n[s]=0),n[s]++),n},{});return this.coders.forEach((n,i)=>{let s=n.localName;!s||r[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,r){return h7(e,this.coders,r)}decode(e){return e.coerce(this.name,v7(e,this.coders))}}const kd=new Q(Bu),Jq=new RegExp(/^bytes([0-9]*)$/),Xq=new RegExp(/^(u?int)([0-9]*)$/);class Zq{constructor(e){ie(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new Oq(e.name);case"bool":return new $q(e.name);case"string":return new Qq(e.name);case"bytes":return new Dq(e.name);case"array":return new Nq(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Sd((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new jq(e.name)}let r=e.type.match(Xq);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&kd.throwArgumentError("invalid "+r[1]+" bit length","param",e),new Vq(n/8,r[1]==="int",e.name)}if(r=e.type.match(Jq),r){let n=parseInt(r[1]);return(n===0||n>32)&&kd.throwArgumentError("invalid bytes length","param",e),new Lq(n,e.name)}return kd.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new a0(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new Gy(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(Dr.from(i)));return new Sd(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&kd.throwError("types/values length mismatch",Q.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(o=>this._getCoder(Dr.from(o))),i=new Sd(n,"_"),s=this._getWriter();return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(o=>this._getCoder(Dr.from(o)));return new Sd(i,"_").decode(this._getReader(de(r),n))}}const eH=new Zq;function Sa(t){return Xe(_t(t))}const b7="hash/5.7.0";function w7(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(a)?i(a,o-1):r.push(a)})};return i(t,e),r}function tH(t){const e={};for(let r=0;r>--l&1}const u=31,d=Math.pow(2,u),h=d>>>1,p=h>>1,m=d-1;let x=0;for(let N=0;N1;){let K=I+j>>>1;N>>1|f(),L=L<<1^h,U=(U^h)<<1|h|1;w=L,E=1+U-L}let P=n-4;return b.map(N=>{switch(N-P){case 3:return P+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return P+256+(t[a++]<<8|t[a++]);case 1:return P+t[a++];default:return N-1}})}function nH(t){let e=0;return()=>t[e++]}function iH(t){return nH(rH(t))}function sH(t){return t&1?~t>>1:t>>1}function oH(t,e){let r=Array(t);for(let n=0;ne[o]):r}function lH(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(fH(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(uH(r,t))}return tH(S7(e))}function cH(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function k7(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[o].push(s));return n}function fH(t,e){let r=1+e(),n=e(),i=cH(e),s=k7(i.length,1+t,e);return S7(s.map((o,a)=>{const l=o[0],c=o.slice(1);return Array(i[a]).fill(void 0).map((f,u)=>{let d=u*n;return[l+u*r,c.map(h=>h+d)]})}))}function uH(t,e){let r=1+e();return k7(r,1+t,e).map(i=>[i[0],i.slice(1)])}function dH(t){let e=l0(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let c=l0(t,e);if(c.length==0)break;n.push({set:new Set(c),node:r()})}n.sort((c,f)=>f.set.size-c.set.size);let i=t(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:n,valid:s,fe0f:o,save:a,check:l}}}function hH(){return iH(w7("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const w1=hH(),vH=new Set(l0(w1)),pH=new Set(l0(w1)),yH=lH(w1),mH=dH(w1),fk=45,uk=95;function A7(t){return Yq(t)}function gH(t){return t.filter(e=>e!=65039)}function C7(t){for(let e of t.split(".")){let r=A7(e);try{for(let n=r.lastIndexOf(uk)-1;n>=0;n--)if(r[n]!==uk)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===fk&&r[3]===fk)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function xH(t){return C7(bH(t,gH))}function bH(t,e){let r=A7(t).reverse(),n=[];for(;r.length;){let i=EH(r);if(i){n.push(...e(i));continue}let s=r.pop();if(vH.has(s)){n.push(s);continue}if(pH.has(s))continue;let o=yH[s];if(o){n.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return C7(wH(String.fromCodePoint(...n)))}function wH(t){return t.normalize("NFC")}function EH(t,e){var r;let n=mH,i,s,o=[],a=t.length;for(e&&(e.length=0);a;){let l=t[--a];if(n=(r=n.branches.find(c=>c.set.has(l)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)s=l;else if(n.check&&l===s)break;o.push(l),n.fe0f&&(o.push(65039),a>0&&t[a-1]==65039&&a--),n.valid&&(i=o.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return i}const SH=new Q(b7),_7=new Uint8Array(32);_7.fill(0);function dk(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function T7(t){const e=_t(xH(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(dk(e.slice(n))),r}function oh(t){typeof t!="string"&&SH.throwArgumentError("invalid ENS name; not a string","name",t);let e=_7;const r=T7(t);for(;r.length;)e=Xe(wr([e,Xe(r.pop())]));return he(e)}function kH(t){return he(wr(T7(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}const AH=`Ethereum Signed Message: -`;function CH(t){return typeof t=="string"&&(t=_t(t)),Xe(wr([_t(AH),_t(String(t.length)),t]))}var _H=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const Qt=new Q(b7),P7=new Uint8Array(32);P7.fill(0);const TH=ce.from(-1),R7=ce.from(0),I7=ce.from(1),PH=ce.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function RH(t){const e=de(t),r=e.length%32;return r?En([e,P7.slice(r)]):he(e)}const IH=Vt(I7.toHexString(),32),OH=Vt(R7.toHexString(),32),hk={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Bv=["name","version","chainId","verifyingContract","salt"];function vk(t){return function(e){return typeof e!="string"&&Qt.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const MH={name:vk("name"),version:vk("version"),chainId:function(t){try{return ce.from(t).toString()}catch{}return Qt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return ir(t).toLowerCase()}catch{}return Qt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=de(t);if(e.length!==32)throw new Error("bad length");return he(e)}catch{}return Qt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Uv(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&&Qt.throwArgumentError("invalid numeric width","type",t);const i=PH.mask(r?n-1:n),s=r?i.add(I7).mul(TH):R7;return function(o){const a=ce.from(o);return(a.lt(s)||a.gt(i))&&Qt.throwArgumentError(`value out-of-bounds for ${t}`,"value",o),Vt(a.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&&Qt.throwArgumentError("invalid bytes width","type",t),function(n){return de(n).length!==r&&Qt.throwArgumentError(`invalid length for ${t}`,"value",n),RH(n)}}}switch(t){case"address":return function(e){return Vt(ir(e),32)};case"bool":return function(e){return e?IH:OH};case"bytes":return function(e){return Xe(e)};case"string":return function(e){return Sa(e)}}return null}function pk(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class hn{constructor(e){ie(this,"types",Object.freeze(za(e))),ie(this,"_encoderCache",{}),ie(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(a=>{r[a]={},n[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(c=>{l[c.name]&&Qt.throwArgumentError(`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(a)}`,"types",e),l[c.name]=!0;const f=c.type.match(/^([^\x5b]*)(\x5b|$)/)[1];f===a&&Qt.throwArgumentError(`circular type reference to ${JSON.stringify(f)}`,"types",e),!Uv(f)&&(n[f]||Qt.throwArgumentError(`unknown type ${JSON.stringify(f)}`,"types",e),n[f].push(a),r[a][f]=!0)})}const s=Object.keys(n).filter(a=>n[a].length===0);s.length===0?Qt.throwArgumentError("missing primary type","types",e):s.length>1&&Qt.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),ie(this,"primaryType",s[0]);function o(a,l){l[a]&&Qt.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(r[a]).forEach(c=>{n[c]&&(o(c,l),Object.keys(l).forEach(f=>{i[f][c]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=pk(a,e[a])+l.map(c=>pk(c,e[c])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=Uv(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],s=this.getEncoder(i),o=parseInt(r[3]);return a=>{o>=0&&a.length!==o&&Qt.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(Xe)),Xe(En(l))}}const n=this.types[e];if(n){const i=Sa(this._types[e]);return s=>{const o=n.map(({name:a,type:l})=>{const c=this.getEncoder(l)(s[a]);return this._types[l]?Xe(c):c});return o.unshift(i),En(o)}}return Qt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||Qt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return Xe(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(Uv(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&r.length!==a&&Qt.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(l=>this._visit(o,l,n))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,r[a],n),o),{}):Qt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new hn(e)}static getPrimaryType(e){return hn.from(e).primaryType}static hashStruct(e,r,n){return hn.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=hk[n];i||Qt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>Bv.indexOf(n.name)-Bv.indexOf(i.name)),hn.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return En(["0x1901",hn.hashDomain(e),hn.from(r).hash(n)])}static hash(e,r,n){return Xe(hn.encode(e,r,n))}static resolveNames(e,r,n,i){return _H(this,void 0,void 0,function*(){e=Or(e);const s={};e.verifyingContract&&!et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=hn.from(r);o.visit(n,(a,l)=>(a==="address"&&!et(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=o.visit(n,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:n}})}static getPayload(e,r,n){hn.hashDomain(e);const i={},s=[];Bv.forEach(l=>{const c=e[l];c!=null&&(i[l]=MH[l](c),s.push({name:l,type:hk[l]}))});const o=hn.from(r),a=Or(r);return a.EIP712Domain?Qt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):a.EIP712Domain=s,o.encode(n),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(n,(l,c)=>{if(l.match(/^bytes(\d*)/))return he(de(c));if(l.match(/^u?int/))return ce.from(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return typeof c!="string"&&Qt.throwArgumentError("invalid string","value",c),c}return Qt.throwArgumentError("unsupported type","type",l)})}}}const Yt=new Q(Bu);class NH extends tl{}class $H extends tl{}class DH extends tl{}class Ky extends tl{static isIndexed(e){return!!(e&&e._isIndexed)}}const LH={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function yk(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class mk{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,ie(this,"fragments",r.map(n=>js.from(n)).filter(n=>n!=null)),ie(this,"_abiCoder",is(new.target,"getAbiCoder")()),ie(this,"functions",{}),ie(this,"errors",{}),ie(this,"events",{}),ie(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){Yt.warn("duplicate definition - constructor");return}ie(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=n.format();if(i[s]){Yt.warn("duplicate definition - "+s);return}i[s]=n}),this.deploy||ie(this,"deploy",es.from({payable:!1,type:"constructor"})),ie(this,"_isInterface",!0)}format(e){e||(e=it.full),e===it.sighash&&Yt.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===it.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return eH}static getAddress(e){return ir(e)}static getSighash(e){return Pr(Sa(e.format()),0,4)}static getEventTopic(e){return Sa(e.format())}getFunction(e){if(et(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];Yt.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===n);return i.length===0?Yt.throwArgumentError("no matching function","name",n):i.length>1&&Yt.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[ts.fromString(e).format()];return r||Yt.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(et(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];Yt.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===n);return i.length===0?Yt.throwArgumentError("no matching event","name",n):i.length>1&&Yt.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[Ms.fromString(e).format()];return r||Yt.throwArgumentError("no matching event","signature",e),r}getError(e){if(et(e)){const n=is(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===n(s))return this.errors[i]}Yt.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===n);return i.length===0?Yt.throwArgumentError("no matching error","name",n):i.length>1&&Yt.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[ts.fromString(e).format()];return r||Yt.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return is(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),is(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=de(r);return he(n.slice(0,4))!==this.getSighash(e)&&Yt.throwArgumentError(`data signature does not match error ${e.name}.`,"data",he(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),he(wr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=de(r);return he(n.slice(0,4))!==this.getSighash(e)&&Yt.throwArgumentError(`data signature does not match function ${e.name}.`,"data",he(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),he(wr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=de(r),i=null,s="",o=null,a=null,l=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const c=he(n.slice(0,4)),f=LH[c];if(f)o=this._abiCoder.decode(f.inputs,n.slice(4)),a=f.name,l=f.signature,f.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(c);o=this._abiCoder.decode(u.inputs,n.slice(4)),a=u.name,l=u.format()}catch{}break}}return Yt.throwError("call revert exception"+s,Q.errors.CALL_EXCEPTION,{method:e.format(),data:he(r),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),he(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Yt.throwError("too many arguments for "+e.format(),Q.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?Sa(o):s.type==="bytes"?Xe(he(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=ce.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),Vt(he(o),32));for(r.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&Yt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?Yt.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?n.push(s.map(l=>i(a,l))):n.push(i(a,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],s=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&Yt.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const l=r[a];if(o.indexed)if(o.type==="string")n.push(Sa(l));else if(o.type==="bytes")n.push(Xe(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let d=this.getEventTopic(e);(!et(n[0],32)||n[0].toLowerCase()!==d)&&Yt.throwError("fragment/topic mismatch",Q.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:d,value:n[0]}),n=n.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((d,h)=>{d.indexed?d.type==="string"||d.type==="bytes"||d.baseType==="tuple"||d.baseType==="array"?(i.push(Dr.fromObject({type:"bytes32",name:d.name})),o.push(!0)):(i.push(d),o.push(!1)):(s.push(d),o.push(!1))});let a=n!=null?this._abiCoder.decode(i,wr(n)):null,l=this._abiCoder.decode(s,r,!0),c=[],f=0,u=0;e.inputs.forEach((d,h)=>{if(d.indexed)if(a==null)c[h]=new Ky({_isIndexed:!0,hash:null});else if(o[h])c[h]=new Ky({_isIndexed:!0,hash:a[u++]});else try{c[h]=a[u++]}catch(p){c[h]=p}else try{c[h]=l[f++]}catch(p){c[h]=p}if(d.name&&c[d.name]==null){const p=c[h];p instanceof Error?Object.defineProperty(c,d.name,{enumerable:!0,get:()=>{throw yk(`property ${JSON.stringify(d.name)}`,p)}}):c[d.name]=p}});for(let d=0;d{throw yk(`index ${d}`,h)}})}return Object.freeze(c)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new $H({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:ce.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new NH({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=he(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new DH({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const jH="abstract-provider/5.7.0";var FH=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const BH=new Q(jH);class UH extends tl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class zu{constructor(){BH.checkAbstract(new.target,zu),ie(this,"_isProvider",!0)}getFeeData(){return FH(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield pr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let n=null,i=null,s=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,s=ce.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const zH="abstract-signer/5.7.0";var Ei=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const oi=new Q(zH),VH=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],qH=[Q.errors.INSUFFICIENT_FUNDS,Q.errors.NONCE_EXPIRED,Q.errors.REPLACEMENT_UNDERPRICED];class Cc{constructor(){oi.checkAbstract(new.target,Cc),ie(this,"_isSigner",!0)}getBalance(e){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Ei(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield pr(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Ei(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield pr(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Ei(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Ei(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)VH.indexOf(n)===-1&&oi.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=Or(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&oi.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Ei(this,void 0,void 0,function*(){const r=yield pr(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Ei(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&oi.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?oi.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&oi.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const s=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=s,r.maxPriorityFeePerGas=s}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&oi.throwError("network does not support EIP-1559",Q.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):oi.throwError("failed to get consistent fee data",Q.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(qH.indexOf(i.code)>=0)throw i;return oi.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Q.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&oi.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield pr(r)})}_checkProvider(e){this.provider||oi.throwError("missing provider",Q.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class kx extends Cc{constructor(e,r){super(),ie(this,"address",e),ie(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{oi.throwError(e,Q.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new kx(this.address,e)}}var O7={},Ke={},Vu=M7;function M7(t,e){if(!t)throw new Error(e||"Assertion failed")}M7.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Yy={exports:{}};typeof Object.create=="function"?Yy.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Yy.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var HH=Yy.exports,WH=Vu,GH=HH;Ke.inherits=GH;function KH(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function YH(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):KH(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Ke.htonl=N7;function JH(t,e){for(var r="",n=0;n>>0}return s}Ke.join32=XH;function ZH(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Ke.split32=ZH;function eW(t,e){return t>>>e|t<<32-e}Ke.rotr32=eW;function tW(t,e){return t<>>32-e}Ke.rotl32=tW;function rW(t,e){return t+e>>>0}Ke.sum32=rW;function nW(t,e,r){return t+e+r>>>0}Ke.sum32_3=nW;function iW(t,e,r,n){return t+e+r+n>>>0}Ke.sum32_4=iW;function sW(t,e,r,n,i){return t+e+r+n+i>>>0}Ke.sum32_5=sW;function oW(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}Ke.sum64=oW;function aW(t,e,r,n){var i=e+n>>>0,s=(i>>0}Ke.sum64_hi=aW;function lW(t,e,r,n){var i=e+n;return i>>>0}Ke.sum64_lo=lW;function cW(t,e,r,n,i,s,o,a){var l=0,c=e;c=c+n>>>0,l+=c>>0,l+=c>>0,l+=c>>0}Ke.sum64_4_hi=cW;function fW(t,e,r,n,i,s,o,a){var l=e+n+s+a;return l>>>0}Ke.sum64_4_lo=fW;function uW(t,e,r,n,i,s,o,a,l,c){var f=0,u=e;u=u+n>>>0,f+=u>>0,f+=u>>0,f+=u>>0,f+=u>>0}Ke.sum64_5_hi=uW;function dW(t,e,r,n,i,s,o,a,l,c){var f=e+n+s+a+c;return f>>>0}Ke.sum64_5_lo=dW;function hW(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Ke.rotr64_hi=hW;function vW(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ke.rotr64_lo=vW;function pW(t,e,r){return t>>>r}Ke.shr64_hi=pW;function yW(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ke.shr64_lo=yW;var _c={},gk=Ke,mW=Vu;function E1(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_c.BlockHash=E1;E1.prototype.update=function(e,r){if(e=gk.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=gk.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}xs.g0_256=EW;function SW(t){return cs(t,17)^cs(t,19)^t>>>10}xs.g1_256=SW;var lc=Ke,kW=_c,AW=xs,zv=lc.rotl32,Yc=lc.sum32,CW=lc.sum32_5,_W=AW.ft_1,B7=kW.BlockHash,TW=[1518500249,1859775393,2400959708,3395469782];function vs(){if(!(this instanceof vs))return new vs;B7.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}lc.inherits(vs,B7);var PW=vs;vs.blockSize=512;vs.outSize=160;vs.hmacStrength=80;vs.padLength=64;vs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),yG(e.length<=this.blockSize);for(var r=e.length;r>8,d=f&255;u?l.push(u,d):l.push(d)}return l}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",l=0;l(d>>1)-1?m=(d>>1)-x:m=x,h.isubn(m)):m=0,u[p]=m,h.iushrn(1)}return u}r.getNAF=n;function i(l,c){var f=[[],[]];l=l.clone(),c=c.clone();for(var u=0,d=0,h;l.cmpn(-u)>0||c.cmpn(-d)>0;){var p=l.andln(3)+u&3,m=c.andln(3)+d&3;p===3&&(p=-1),m===3&&(m=-1);var x;p&1?(h=l.andln(7)+u&7,(h===3||h===5)&&m===2?x=-p:x=p):x=0,f[0].push(x);var b;m&1?(h=c.andln(7)+d&7,(h===3||h===5)&&p===2?b=-m:b=m):b=0,f[1].push(b),2*u===x+1&&(u=1-u),2*d===b+1&&(d=1-d),l.iushrn(1),c.iushrn(1)}return f}r.getJSF=i;function s(l,c,f){var u="_"+c;l.prototype[c]=function(){return this[u]!==void 0?this[u]:this[u]=f.call(this)}}r.cachedProperty=s;function o(l){return typeof l=="string"?r.toArray(l,"hex"):l}r.parseBytes=o;function a(l){return new De(l,"hex","le")}r.intFromLE=a}),c0=Zn.getNAF,xG=Zn.getJSF,f0=Zn.assert;function na(t,e){this.type=t,this.p=new De(e.p,16),this.red=e.prime?De.red(e.prime):De.mont(this.p),this.zero=new De(0).toRed(this.red),this.one=new De(1).toRed(this.red),this.two=new De(2).toRed(this.red),this.n=e.n&&new De(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var rl=na;na.prototype.point=function(){throw new Error("Not implemented")};na.prototype.validate=function(){throw new Error("Not implemented")};na.prototype._fixedNafMul=function(e,r){f0(e.precomputed);var n=e._getDoubles(),i=c0(r,1,this._bitLength),s=(1<=a;c--)l=(l<<1)+i[c];o.push(l)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),d=s;d>0;d--){for(a=0;a=0;l--){for(var c=0;l>=0&&o[l]===0;l--)c++;if(l>=0&&c++,a=a.dblp(c),l<0)break;var f=o[l];f0(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,c=0,f,u,d;for(f=0;f=1;f-=2){var p=f-1,m=f;if(o[p]!==1||o[m]!==1){l[p]=c0(n[p],o[p],this._bitLength),l[m]=c0(n[m],o[m],this._bitLength),c=Math.max(l[p].length,c),c=Math.max(l[m].length,c);continue}var x=[r[p],null,null,r[m]];r[p].y.cmp(r[m].y)===0?(x[1]=r[p].add(r[m]),x[2]=r[p].toJ().mixedAdd(r[m].neg())):r[p].y.cmp(r[m].y.redNeg())===0?(x[1]=r[p].toJ().mixedAdd(r[m]),x[2]=r[p].add(r[m].neg())):(x[1]=r[p].toJ().mixedAdd(r[m]),x[2]=r[p].toJ().mixedAdd(r[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],w=xG(n[p],n[m]);for(c=Math.max(w[0].length,c),l[p]=new Array(c),l[m]=new Array(c),u=0;u=0;f--){for(var j=0;f>=0;){var L=!0;for(u=0;u=0&&j++,N=N.dblp(j),f<0)break;for(u=0;u0?d=a[u][U-1>>1]:U<0&&(d=a[u][-U-1>>1].neg()),d.type==="affine"?N=N.mixedAdd(d):N=N.add(d))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};gi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(h=c,p=f),u.negative&&(u=u.neg(),d=d.neg()),h.negative&&(h=h.neg(),p=p.neg()),[{a:u,b:d},{a:h,b:p}]};xi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),l=o.mul(i.a),c=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(l),d=c.add(f).neg();return{k1:u,k2:d}};xi.prototype.pointFromX=function(e,r){e=new De(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};xi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};xi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Fr.prototype.isInfinity=function(){return this.inf};Fr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Fr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Fr.prototype.getX=function(){return this.x.fromRed()};Fr.prototype.getY=function(){return this.y.fromRed()};Fr.prototype.mul=function(e){return e=new De(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Fr.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Fr.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Fr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Fr.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Fr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Gr(t,e,r,n){rl.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new De(0)):(this.x=new De(e,16),this.y=new De(r,16),this.z=new De(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Cx(Gr,rl.BasePoint);xi.prototype.jpoint=function(e,r,n){return new Gr(this,e,r,n)};Gr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Gr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Gr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),l=i.redSub(s),c=o.redSub(a);if(l.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=l.redSqr(),u=f.redMul(l),d=i.redMul(f),h=c.redSqr().redIAdd(u).redISub(d).redISub(d),p=c.redMul(d.redISub(h)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,p,m)};Gr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),u=n.redMul(c),d=l.redSqr().redIAdd(f).redISub(u).redISub(u),h=l.redMul(u.redISub(d)).redISub(s.redMul(f)),p=this.z.redMul(a);return this.curve.jpoint(d,h,p)};Gr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};Gr.prototype.inspect=function(){return this.isInfinity()?"":""};Gr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ah=Rc(function(t,e){var r=e;r.base=rl,r.short=wG,r.mont=null,r.edwards=null}),lh=Rc(function(t,e){var r=e,n=Zn.assert;function i(a){a.type==="short"?this.curve=new ah.short(a):a.type==="edwards"?this.curve=new ah.edwards(a):this.curve=new ah.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,l){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(l);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ln.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ln.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ln.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ln.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ln.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ln.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ln.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ln.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Yo(t){if(!(this instanceof Yo))return new Yo(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Oi.toArray(t.entropy,t.entropyEnc||"hex"),r=Oi.toArray(t.nonce,t.nonceEnc||"hex"),n=Oi.toArray(t.pers,t.persEnc||"hex");Ax(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var X7=Yo;Yo.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Yo.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Oi.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var EG=Zn.assert;function S1(t,e){if(t instanceof S1)return t;this._importDER(t,e)||(EG(t.r&&t.s,"Signature without r or s"),this.r=new De(t.r,16),this.s=new De(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var k1=S1;function SG(){this.place=0}function Hv(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function Ek(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}S1.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Ek(r),n=Ek(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Wv(i,r.length),i=i.concat(r),i.push(2),Wv(i,n.length);var s=i.concat(n),o=[48];return Wv(o,s.length),o=o.concat(s),Zn.encode(o,e)};var kG=function(){throw new Error("unsupported")},Z7=Zn.assert;function mi(t){if(!(this instanceof mi))return new mi(t);typeof t=="string"&&(Z7(Object.prototype.hasOwnProperty.call(lh,t),"Unknown curve "+t),t=lh[t]),t instanceof lh.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var AG=mi;mi.prototype.keyPair=function(e){return new _x(this,e)};mi.prototype.keyFromPrivate=function(e,r){return _x.fromPrivate(this,e,r)};mi.prototype.keyFromPublic=function(e,r){return _x.fromPublic(this,e,r)};mi.prototype.genKeyPair=function(e){e||(e={});for(var r=new X7({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||kG(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new De(2));;){var s=new De(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};mi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};mi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new De(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new X7({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new De(1)),f=0;;f++){var u=i.k?i.k(f):new De(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(c)>=0)){var d=this.g.mul(u);if(!d.isInfinity()){var h=d.getX(),p=h.umod(this.n);if(p.cmpn(0)!==0){var m=u.invm(this.n).mul(p.mul(r.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var x=(d.getY().isOdd()?1:0)|(h.cmp(p)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),x^=1),new k1({r:p,s:m,recoveryParam:x})}}}}}};mi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new De(e,16)),n=this.keyFromPublic(n,i),r=new k1(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(l,n.getPublic(),c),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(l,n.getPublic(),c),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};mi.prototype.recoverPubKey=function(t,e,r,n){Z7((3&r)===r,"The recovery param is more than two bits"),e=new k1(e,n);var i=this.n,s=new De(t),o=e.r,a=e.s,l=r&1,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),d=a.mul(f).umod(i);return this.g.mulAdd(u,o,d)};mi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new k1(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var CG=Rc(function(t,e){var r=e;r.version="6.5.4",r.utils=Zn,r.rand=function(){throw new Error("unsupported")},r.curve=ah,r.curves=lh,r.ec=AG,r.eddsa=null}),_G=CG.ec;const TG="signing-key/5.7.0",Zy=new Q(TG);let Gv=null;function Ji(){return Gv||(Gv=new _G("secp256k1")),Gv}class Hl{constructor(e){ie(this,"curve","secp256k1"),ie(this,"privateKey",he(e)),Ua(this.privateKey)!==32&&Zy.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=Ji().keyFromPrivate(de(this.privateKey));ie(this,"publicKey","0x"+r.getPublic(!1,"hex")),ie(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ie(this,"_isSigningKey",!0)}_addPoint(e){const r=Ji().keyFromPublic(de(this.publicKey)),n=Ji().keyFromPublic(de(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=Ji().keyFromPrivate(de(this.privateKey)),n=de(e);n.length!==32&&Zy.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ac({recoveryParam:i.recoveryParam,r:Vt("0x"+i.r.toString(16),32),s:Vt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=Ji().keyFromPrivate(de(this.privateKey)),n=Ji().keyFromPublic(de(e_(e)));return Vt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function PG(t,e){const r=Ac(e),n={r:de(r.r),s:de(r.s)};return"0x"+Ji().recoverPubKey(de(t),n,r.recoveryParam).encode("hex",!1)}function e_(t,e){const r=de(t);if(r.length===32){const n=new Hl(r);return e?"0x"+Ji().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?he(r):"0x"+Ji().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+Ji().keyFromPublic(r).getPublic(!0,"hex"):he(r)}return Zy.throwArgumentError("invalid public or private key","key","[REDACTED]")}const RG="transactions/5.7.0",on=new Q(RG);var Sk;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Sk||(Sk={}));function Tx(t){return t==="0x"?null:ir(t)}function sn(t){return t==="0x"?y7:ce.from(t)}const IG=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],OG={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function Ia(t){const e=e_(t);return ir(Pr(Xe(Pr(e,1)),12))}function t_(t,e){return Ia(PG(de(t),e))}function Bn(t,e){const r=zs(ce.from(t).toHexString());return r.length>32&&on.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Kv(t,e){return{address:ir(t),storageKeys:(e||[]).map((r,n)=>(Ua(r)!==32&&on.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function Ic(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&on.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Kv(r[0],r[1])):Kv(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return Kv(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r_(t){return Ic(t).map(e=>[e.address,e.storageKeys])}function n_(t,e){if(t.gasPrice!=null){const n=ce.from(t.gasPrice),i=ce.from(t.maxFeePerGas||0);n.eq(i)||on.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[Bn(t.chainId||0,"chainId"),Bn(t.nonce||0,"nonce"),Bn(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Bn(t.maxFeePerGas||0,"maxFeePerGas"),Bn(t.gasLimit||0,"gasLimit"),t.to!=null?ir(t.to):"0x",Bn(t.value||0,"value"),t.data||"0x",r_(t.accessList||[])];if(e){const n=Ac(e);r.push(Bn(n.recoveryParam,"recoveryParam")),r.push(zs(n.r)),r.push(zs(n.s))}return En(["0x02",ac(r)])}function i_(t,e){const r=[Bn(t.chainId||0,"chainId"),Bn(t.nonce||0,"nonce"),Bn(t.gasPrice||0,"gasPrice"),Bn(t.gasLimit||0,"gasLimit"),t.to!=null?ir(t.to):"0x",Bn(t.value||0,"value"),t.data||"0x",r_(t.accessList||[])];if(e){const n=Ac(e);r.push(Bn(n.recoveryParam,"recoveryParam")),r.push(zs(n.r)),r.push(zs(n.s))}return En(["0x01",ac(r)])}function MG(t,e){i7(t,OG);const r=[];IG.forEach(function(o){let a=t[o.name]||[];const l={};o.numeric&&(l.hexPad="left"),a=de(he(a,l)),o.length&&a.length!==o.length&&a.length>0&&on.throwArgumentError("invalid length for "+o.name,"transaction:"+o.name,a),o.maxLength&&(a=zs(a),a.length>o.maxLength&&on.throwArgumentError("invalid length for "+o.name,"transaction:"+o.name,a)),r.push(he(a))});let n=0;if(t.chainId!=null?(n=t.chainId,typeof n!="number"&&on.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!b1(e)&&e.v>28&&(n=Math.floor((e.v-35)/2)),n!==0&&(r.push(he(n)),r.push("0x"),r.push("0x")),!e)return ac(r);const i=Ac(e);let s=27+i.recoveryParam;return n!==0?(r.pop(),r.pop(),r.pop(),s+=n*2+8,i.v>28&&i.v!==s&&on.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):i.v!==s&&on.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push(he(s)),r.push(zs(de(i.r))),r.push(zs(de(i.s))),ac(r)}function kk(t,e){if(t.type==null||t.type===0)return t.accessList!=null&&on.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),MG(t,e);switch(t.type){case 1:return i_(t,e);case 2:return n_(t,e)}return on.throwError(`unsupported transaction type: ${t.type}`,Q.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function s_(t,e,r){try{const n=sn(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{on.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Vt(e[1],32),t.s=Vt(e[2],32);try{const n=Xe(r(t));t.from=t_(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function NG(t){const e=wx(t.slice(1));e.length!==9&&e.length!==12&&on.throwArgumentError("invalid component count for transaction type: 2","payload",he(t));const r=sn(e[2]),n=sn(e[3]),i={type:2,chainId:sn(e[0]).toNumber(),nonce:sn(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:sn(e[4]),to:Tx(e[5]),value:sn(e[6]),data:e[7],accessList:Ic(e[8])};return e.length===9||(i.hash=Xe(t),s_(i,e.slice(9),n_)),i}function $G(t){const e=wx(t.slice(1));e.length!==8&&e.length!==11&&on.throwArgumentError("invalid component count for transaction type: 1","payload",he(t));const r={type:1,chainId:sn(e[0]).toNumber(),nonce:sn(e[1]).toNumber(),gasPrice:sn(e[2]),gasLimit:sn(e[3]),to:Tx(e[4]),value:sn(e[5]),data:e[6],accessList:Ic(e[7])};return e.length===8||(r.hash=Xe(t),s_(r,e.slice(8),i_)),r}function DG(t){const e=wx(t);e.length!==9&&e.length!==6&&on.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:sn(e[0]).toNumber(),gasPrice:sn(e[1]),gasLimit:sn(e[2]),to:Tx(e[3]),value:sn(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=ce.from(e[6]).toNumber()}catch{return r}if(r.r=Vt(e[7],32),r.s=Vt(e[8],32),ce.from(r.r).isZero()&&ce.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(he(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const s=Xe(ac(i));try{r.from=t_(s,{r:he(r.r),s:he(r.s),recoveryParam:n})}catch{}r.hash=Xe(t)}return r.type=null,r}function LG(t){const e=de(t);if(e[0]>127)return DG(e);switch(e[0]){case 1:return $G(e);case 2:return NG(e)}return on.throwError(`unsupported transaction type: ${e[0]}`,Q.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const jG="contracts/5.7.0";var Ha=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const yr=new Q(jG);function u0(t,e){return Ha(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&&yr.throwArgumentError("invalid address or ENS name","name",r);try{return ir(r)}catch{}t||yr.throwError("a provider or signer is needed to resolve ENS names",Q.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&&yr.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ch(t,e,r){return Ha(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ch(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield u0(t,e):r.type==="tuple"?yield ch(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ch(t,n,r.arrayChildren))):Promise.reject(yr.makeError("invalid value for array",Q.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function A1(t,e,r){return Ha(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=Or(r.pop())),yr.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=pr({override:u0(t.signer,n.from),signer:t.signer.getAddress()}).then(c=>Ha(this,void 0,void 0,function*(){return ir(c.signer)!==c.override&&yr.throwError("Contract with a Signer cannot override from",Q.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),c.override})):n.from=t.signer.getAddress():n.from&&(n.from=u0(t.provider,n.from));const i=yield pr({args:ch(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:pr(n)||{}}),s=t.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=ce.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=ce.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=ce.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=ce.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=ce.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Ic(a.accessList)),o.gasLimit==null&&e.gas!=null){let c=21e3;const f=de(s);for(let u=0;un[c]!=null);return l.length&&yr.throwError(`cannot override ${l.map(c=>JSON.stringify(c)).join(",")}`,Q.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function FG(t,e){return function(...r){return A1(t,e,r)}}function BG(t,e){const r=t.signer||t.provider;return function(...n){return Ha(this,void 0,void 0,function*(){r||yr.throwError("estimate require a provider or signer",Q.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield A1(t,e,n);return yield r.estimateGas(i)})}}function UG(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(s=>{let o=za(s),a=null;try{a=t.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,c)=>t.interface.decodeEventLog(a.eventFragment,l,c),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>t.provider,o.getBlock=()=>t.provider.getBlock(i.blockHash),o.getTransaction=()=>t.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function o_(t,e,r){const n=t.signer||t.provider;return function(...i){return Ha(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=Or(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}t.deployTransaction!=null&&(yield t._deployed(s));const o=yield A1(t,e,i),a=yield n.call(o,s);try{let l=t.interface.decodeFunctionResult(e,a);return r&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===Q.errors.CALL_EXCEPTION&&(l.address=t.address,l.args=i,l.transaction=o),l}})}}function zG(t,e){return function(...r){return Ha(this,void 0,void 0,function*(){t.signer||yr.throwError("sending a transaction requires a signer",Q.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield A1(t,e,r),i=yield t.signer.sendTransaction(n);return UG(t,i),i})}}function Ak(t,e,r){return e.constant?o_(t,e,r):zG(t,e)}function a_(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class fu{constructor(e,r){ie(this,"tag",e),ie(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class VG extends fu{constructor(){super("error",null)}}class Ck extends fu{constructor(e,r,n,i){const s={address:e};let o=r.getEventTopic(n);i?(o!==i[0]&&yr.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(a_(s),s),ie(this,"address",e),ie(this,"interface",r),ie(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Sq(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class _k extends fu{constructor(e,r){super("*",{address:e}),ie(this,"address",e),ie(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class qG{constructor(e,r,n){ie(this,"interface",is(new.target,"getInterface")(r)),n==null?(ie(this,"provider",null),ie(this,"signer",null)):Cc.isSigner(n)?(ie(this,"provider",n.provider||null),ie(this,"signer",n)):zu.isProvider(n)?(ie(this,"provider",n),ie(this,"signer",null)):yr.throwArgumentError("invalid signer or provider","signerOrProvider",n),ie(this,"callStatic",{}),ie(this,"estimateGas",{}),ie(this,"functions",{}),ie(this,"populateTransaction",{}),ie(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];ie(this.filters,a,(...c)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,c)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?ie(this.filters,a,this.filters[l[0]]):yr.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(ie(this,"_runningEvents",{}),ie(this,"_wrappedEmits",{}),e==null&&yr.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ie(this,"address",e),this.provider)ie(this,"resolvedAddress",u0(this.provider,e));else try{ie(this,"resolvedAddress",Promise.resolve(ir(e)))}catch{yr.throwError("provider is required to use ENS name as contract address",Q.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){yr.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&ie(this,o,Ak(this,a,!0)),this.functions[o]==null&&ie(this.functions,o,Ak(this,a,!1)),this.callStatic[o]==null&&ie(this.callStatic,o,o_(this,a,!0)),this.populateTransaction[o]==null&&ie(this.populateTransaction,o,FG(this,a)),this.estimateGas[o]==null&&ie(this.estimateGas,o,BG(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&ie(this,o,this[l])}catch{}this.functions[o]==null&&ie(this.functions,o,this.functions[l]),this.callStatic[o]==null&&ie(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&ie(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&ie(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return d7(e)}static getInterface(e){return mk.isInterface(e)?e:new mk(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&&yr.throwError("contract not deployed",Q.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||yr.throwError("sending a transactions require a signer",Q.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=Or(e||{});return["from","to"].forEach(function(n){r[n]!=null&&yr.throwError("cannot override "+n,Q.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new kx(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ie(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Ky.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new VG);if(e==="event")return this._normalizeRunningEvent(new fu("event",null));if(e==="*")return this._normalizeRunningEvent(new _k(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Ck(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Ck(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new fu(a_(r),r))}return this._normalizeRunningEvent(new _k(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=za(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||yr.throwError("events require a provider or a signer with a provider",Q.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,r);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),s=Or(i.filter);return typeof r=="string"&&et(r,32)?(n!=null&&yr.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),s.blockHash=r):(s.fromBlock=r??0,s.toBlock=n??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class HG extends qG{}class l_{constructor(e){ie(this,"alphabet",e),ie(this,"base",e.length),ie(this,"_alphabetMap",{}),ie(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;r[s]===0&&s=0;--s)i+=this.alphabet[n[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;s>0;)r.push(s&255),s>>=8}for(let n=0;e[n]===this._leader&&n>24&255,l[e.length+1]=u>>16&255,l[e.length+2]=u>>8&255,l[e.length+3]=u&255;let d=de(d0(i,t,l));s||(s=d.length,f=new Uint8Array(s),o=Math.ceil(n/s),c=n-(o-1)*s),f.set(d);for(let m=1;m256||e[2]&&e[2]!==String(n))&&Qt.throwArgumentError("invalid numeric width","type",t);const i=PH.mask(r?n-1:n),s=r?i.add(I7).mul(TH):R7;return function(o){const a=ce.from(o);return(a.lt(s)||a.gt(i))&&Qt.throwArgumentError(`value out-of-bounds for ${t}`,"value",o),Vt(a.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&&Qt.throwArgumentError("invalid bytes width","type",t),function(n){return de(n).length!==r&&Qt.throwArgumentError(`invalid length for ${t}`,"value",n),RH(n)}}}switch(t){case"address":return function(e){return Vt(ir(e),32)};case"bool":return function(e){return e?IH:OH};case"bytes":return function(e){return Xe(e)};case"string":return function(e){return Sa(e)}}return null}function pk(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class hn{constructor(e){ie(this,"types",Object.freeze(za(e))),ie(this,"_encoderCache",{}),ie(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(a=>{r[a]={},n[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(c=>{l[c.name]&&Qt.throwArgumentError(`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(a)}`,"types",e),l[c.name]=!0;const f=c.type.match(/^([^\x5b]*)(\x5b|$)/)[1];f===a&&Qt.throwArgumentError(`circular type reference to ${JSON.stringify(f)}`,"types",e),!Uv(f)&&(n[f]||Qt.throwArgumentError(`unknown type ${JSON.stringify(f)}`,"types",e),n[f].push(a),r[a][f]=!0)})}const s=Object.keys(n).filter(a=>n[a].length===0);s.length===0?Qt.throwArgumentError("missing primary type","types",e):s.length>1&&Qt.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),ie(this,"primaryType",s[0]);function o(a,l){l[a]&&Qt.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(r[a]).forEach(c=>{n[c]&&(o(c,l),Object.keys(l).forEach(f=>{i[f][c]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=pk(a,e[a])+l.map(c=>pk(c,e[c])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=Uv(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],s=this.getEncoder(i),o=parseInt(r[3]);return a=>{o>=0&&a.length!==o&&Qt.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(Xe)),Xe(En(l))}}const n=this.types[e];if(n){const i=Sa(this._types[e]);return s=>{const o=n.map(({name:a,type:l})=>{const c=this.getEncoder(l)(s[a]);return this._types[l]?Xe(c):c});return o.unshift(i),En(o)}}return Qt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||Qt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return Xe(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(Uv(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&r.length!==a&&Qt.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(l=>this._visit(o,l,n))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,r[a],n),o),{}):Qt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new hn(e)}static getPrimaryType(e){return hn.from(e).primaryType}static hashStruct(e,r,n){return hn.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=hk[n];i||Qt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>Bv.indexOf(n.name)-Bv.indexOf(i.name)),hn.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return En(["0x1901",hn.hashDomain(e),hn.from(r).hash(n)])}static hash(e,r,n){return Xe(hn.encode(e,r,n))}static resolveNames(e,r,n,i){return _H(this,void 0,void 0,function*(){e=Or(e);const s={};e.verifyingContract&&!et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=hn.from(r);o.visit(n,(a,l)=>(a==="address"&&!et(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=o.visit(n,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:n}})}static getPayload(e,r,n){hn.hashDomain(e);const i={},s=[];Bv.forEach(l=>{const c=e[l];c!=null&&(i[l]=MH[l](c),s.push({name:l,type:hk[l]}))});const o=hn.from(r),a=Or(r);return a.EIP712Domain?Qt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):a.EIP712Domain=s,o.encode(n),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(n,(l,c)=>{if(l.match(/^bytes(\d*)/))return he(de(c));if(l.match(/^u?int/))return ce.from(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return typeof c!="string"&&Qt.throwArgumentError("invalid string","value",c),c}return Qt.throwArgumentError("unsupported type","type",l)})}}}const Yt=new Q(Bu);class NH extends tl{}class $H extends tl{}class DH extends tl{}class Ky extends tl{static isIndexed(e){return!!(e&&e._isIndexed)}}const LH={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function yk(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class mk{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,ie(this,"fragments",r.map(n=>js.from(n)).filter(n=>n!=null)),ie(this,"_abiCoder",is(new.target,"getAbiCoder")()),ie(this,"functions",{}),ie(this,"errors",{}),ie(this,"events",{}),ie(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){Yt.warn("duplicate definition - constructor");return}ie(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=n.format();if(i[s]){Yt.warn("duplicate definition - "+s);return}i[s]=n}),this.deploy||ie(this,"deploy",es.from({payable:!1,type:"constructor"})),ie(this,"_isInterface",!0)}format(e){e||(e=it.full),e===it.sighash&&Yt.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===it.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return eH}static getAddress(e){return ir(e)}static getSighash(e){return Pr(Sa(e.format()),0,4)}static getEventTopic(e){return Sa(e.format())}getFunction(e){if(et(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];Yt.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===n);return i.length===0?Yt.throwArgumentError("no matching function","name",n):i.length>1&&Yt.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[ts.fromString(e).format()];return r||Yt.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(et(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];Yt.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===n);return i.length===0?Yt.throwArgumentError("no matching event","name",n):i.length>1&&Yt.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[Ms.fromString(e).format()];return r||Yt.throwArgumentError("no matching event","signature",e),r}getError(e){if(et(e)){const n=is(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===n(s))return this.errors[i]}Yt.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===n);return i.length===0?Yt.throwArgumentError("no matching error","name",n):i.length>1&&Yt.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[ts.fromString(e).format()];return r||Yt.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return is(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),is(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=de(r);return he(n.slice(0,4))!==this.getSighash(e)&&Yt.throwArgumentError(`data signature does not match error ${e.name}.`,"data",he(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),he(wr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=de(r);return he(n.slice(0,4))!==this.getSighash(e)&&Yt.throwArgumentError(`data signature does not match function ${e.name}.`,"data",he(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),he(wr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=de(r),i=null,s="",o=null,a=null,l=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const c=he(n.slice(0,4)),f=LH[c];if(f)o=this._abiCoder.decode(f.inputs,n.slice(4)),a=f.name,l=f.signature,f.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(c);o=this._abiCoder.decode(u.inputs,n.slice(4)),a=u.name,l=u.format()}catch{}break}}return Yt.throwError("call revert exception"+s,Q.errors.CALL_EXCEPTION,{method:e.format(),data:he(r),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),he(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Yt.throwError("too many arguments for "+e.format(),Q.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?Sa(o):s.type==="bytes"?Xe(he(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=ce.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),Vt(he(o),32));for(r.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&Yt.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?Yt.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?n.push(s.map(l=>i(a,l))):n.push(i(a,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],s=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&Yt.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const l=r[a];if(o.indexed)if(o.type==="string")n.push(Sa(l));else if(o.type==="bytes")n.push(Xe(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let d=this.getEventTopic(e);(!et(n[0],32)||n[0].toLowerCase()!==d)&&Yt.throwError("fragment/topic mismatch",Q.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:d,value:n[0]}),n=n.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((d,h)=>{d.indexed?d.type==="string"||d.type==="bytes"||d.baseType==="tuple"||d.baseType==="array"?(i.push(Dr.fromObject({type:"bytes32",name:d.name})),o.push(!0)):(i.push(d),o.push(!1)):(s.push(d),o.push(!1))});let a=n!=null?this._abiCoder.decode(i,wr(n)):null,l=this._abiCoder.decode(s,r,!0),c=[],f=0,u=0;e.inputs.forEach((d,h)=>{if(d.indexed)if(a==null)c[h]=new Ky({_isIndexed:!0,hash:null});else if(o[h])c[h]=new Ky({_isIndexed:!0,hash:a[u++]});else try{c[h]=a[u++]}catch(p){c[h]=p}else try{c[h]=l[f++]}catch(p){c[h]=p}if(d.name&&c[d.name]==null){const p=c[h];p instanceof Error?Object.defineProperty(c,d.name,{enumerable:!0,get:()=>{throw yk(`property ${JSON.stringify(d.name)}`,p)}}):c[d.name]=p}});for(let d=0;d{throw yk(`index ${d}`,h)}})}return Object.freeze(c)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new $H({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:ce.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new NH({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=he(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new DH({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const jH="abstract-provider/5.7.0";var FH=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const BH=new Q(jH);class UH extends tl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class zu{constructor(){BH.checkAbstract(new.target,zu),ie(this,"_isProvider",!0)}getFeeData(){return FH(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let n=null,i=null,s=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,s=ce.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const zH="abstract-signer/5.7.0";var Ei=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const oi=new Q(zH),VH=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],qH=[Q.errors.INSUFFICIENT_FUNDS,Q.errors.NONCE_EXPIRED,Q.errors.REPLACEMENT_UNDERPRICED];class Cc{constructor(){oi.checkAbstract(new.target,Cc),ie(this,"_isSigner",!0)}getBalance(e){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Ei(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yr(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Ei(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yr(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Ei(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Ei(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Ei(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)VH.indexOf(n)===-1&&oi.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=Or(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&oi.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Ei(this,void 0,void 0,function*(){const r=yield yr(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Ei(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&oi.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?oi.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&oi.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const s=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=s,r.maxPriorityFeePerGas=s}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&oi.throwError("network does not support EIP-1559",Q.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):oi.throwError("failed to get consistent fee data",Q.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(qH.indexOf(i.code)>=0)throw i;return oi.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Q.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&oi.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yr(r)})}_checkProvider(e){this.provider||oi.throwError("missing provider",Q.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class kx extends Cc{constructor(e,r){super(),ie(this,"address",e),ie(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{oi.throwError(e,Q.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new kx(this.address,e)}}var O7={},Ke={},Vu=M7;function M7(t,e){if(!t)throw new Error(e||"Assertion failed")}M7.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var Yy={exports:{}};typeof Object.create=="function"?Yy.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Yy.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var HH=Yy.exports,WH=Vu,GH=HH;Ke.inherits=GH;function KH(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function YH(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=s&63|128):KH(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Ke.htonl=N7;function JH(t,e){for(var r="",n=0;n>>0}return s}Ke.join32=XH;function ZH(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Ke.split32=ZH;function eW(t,e){return t>>>e|t<<32-e}Ke.rotr32=eW;function tW(t,e){return t<>>32-e}Ke.rotl32=tW;function rW(t,e){return t+e>>>0}Ke.sum32=rW;function nW(t,e,r){return t+e+r>>>0}Ke.sum32_3=nW;function iW(t,e,r,n){return t+e+r+n>>>0}Ke.sum32_4=iW;function sW(t,e,r,n,i){return t+e+r+n+i>>>0}Ke.sum32_5=sW;function oW(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}Ke.sum64=oW;function aW(t,e,r,n){var i=e+n>>>0,s=(i>>0}Ke.sum64_hi=aW;function lW(t,e,r,n){var i=e+n;return i>>>0}Ke.sum64_lo=lW;function cW(t,e,r,n,i,s,o,a){var l=0,c=e;c=c+n>>>0,l+=c>>0,l+=c>>0,l+=c>>0}Ke.sum64_4_hi=cW;function fW(t,e,r,n,i,s,o,a){var l=e+n+s+a;return l>>>0}Ke.sum64_4_lo=fW;function uW(t,e,r,n,i,s,o,a,l,c){var f=0,u=e;u=u+n>>>0,f+=u>>0,f+=u>>0,f+=u>>0,f+=u>>0}Ke.sum64_5_hi=uW;function dW(t,e,r,n,i,s,o,a,l,c){var f=e+n+s+a+c;return f>>>0}Ke.sum64_5_lo=dW;function hW(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Ke.rotr64_hi=hW;function vW(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ke.rotr64_lo=vW;function pW(t,e,r){return t>>>r}Ke.shr64_hi=pW;function yW(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Ke.shr64_lo=yW;var _c={},gk=Ke,mW=Vu;function E1(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_c.BlockHash=E1;E1.prototype.update=function(e,r){if(e=gk.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=gk.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}xs.g0_256=EW;function SW(t){return cs(t,17)^cs(t,19)^t>>>10}xs.g1_256=SW;var lc=Ke,kW=_c,AW=xs,zv=lc.rotl32,Yc=lc.sum32,CW=lc.sum32_5,_W=AW.ft_1,B7=kW.BlockHash,TW=[1518500249,1859775393,2400959708,3395469782];function vs(){if(!(this instanceof vs))return new vs;B7.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}lc.inherits(vs,B7);var PW=vs;vs.blockSize=512;vs.outSize=160;vs.hmacStrength=80;vs.padLength=64;vs.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),yG(e.length<=this.blockSize);for(var r=e.length;r>8,d=f&255;u?l.push(u,d):l.push(d)}return l}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",l=0;l(d>>1)-1?m=(d>>1)-x:m=x,h.isubn(m)):m=0,u[p]=m,h.iushrn(1)}return u}r.getNAF=n;function i(l,c){var f=[[],[]];l=l.clone(),c=c.clone();for(var u=0,d=0,h;l.cmpn(-u)>0||c.cmpn(-d)>0;){var p=l.andln(3)+u&3,m=c.andln(3)+d&3;p===3&&(p=-1),m===3&&(m=-1);var x;p&1?(h=l.andln(7)+u&7,(h===3||h===5)&&m===2?x=-p:x=p):x=0,f[0].push(x);var b;m&1?(h=c.andln(7)+d&7,(h===3||h===5)&&p===2?b=-m:b=m):b=0,f[1].push(b),2*u===x+1&&(u=1-u),2*d===b+1&&(d=1-d),l.iushrn(1),c.iushrn(1)}return f}r.getJSF=i;function s(l,c,f){var u="_"+c;l.prototype[c]=function(){return this[u]!==void 0?this[u]:this[u]=f.call(this)}}r.cachedProperty=s;function o(l){return typeof l=="string"?r.toArray(l,"hex"):l}r.parseBytes=o;function a(l){return new De(l,"hex","le")}r.intFromLE=a}),c0=Zn.getNAF,xG=Zn.getJSF,f0=Zn.assert;function na(t,e){this.type=t,this.p=new De(e.p,16),this.red=e.prime?De.red(e.prime):De.mont(this.p),this.zero=new De(0).toRed(this.red),this.one=new De(1).toRed(this.red),this.two=new De(2).toRed(this.red),this.n=e.n&&new De(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var rl=na;na.prototype.point=function(){throw new Error("Not implemented")};na.prototype.validate=function(){throw new Error("Not implemented")};na.prototype._fixedNafMul=function(e,r){f0(e.precomputed);var n=e._getDoubles(),i=c0(r,1,this._bitLength),s=(1<=a;c--)l=(l<<1)+i[c];o.push(l)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),d=s;d>0;d--){for(a=0;a=0;l--){for(var c=0;l>=0&&o[l]===0;l--)c++;if(l>=0&&c++,a=a.dblp(c),l<0)break;var f=o[l];f0(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};na.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,c=0,f,u,d;for(f=0;f=1;f-=2){var p=f-1,m=f;if(o[p]!==1||o[m]!==1){l[p]=c0(n[p],o[p],this._bitLength),l[m]=c0(n[m],o[m],this._bitLength),c=Math.max(l[p].length,c),c=Math.max(l[m].length,c);continue}var x=[r[p],null,null,r[m]];r[p].y.cmp(r[m].y)===0?(x[1]=r[p].add(r[m]),x[2]=r[p].toJ().mixedAdd(r[m].neg())):r[p].y.cmp(r[m].y.redNeg())===0?(x[1]=r[p].toJ().mixedAdd(r[m]),x[2]=r[p].add(r[m].neg())):(x[1]=r[p].toJ().mixedAdd(r[m]),x[2]=r[p].toJ().mixedAdd(r[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],w=xG(n[p],n[m]);for(c=Math.max(w[0].length,c),l[p]=new Array(c),l[m]=new Array(c),u=0;u=0;f--){for(var j=0;f>=0;){var L=!0;for(u=0;u=0&&j++,N=N.dblp(j),f<0)break;for(u=0;u0?d=a[u][U-1>>1]:U<0&&(d=a[u][-U-1>>1].neg()),d.type==="affine"?N=N.mixedAdd(d):N=N.add(d))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};gi.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(h=c,p=f),u.negative&&(u=u.neg(),d=d.neg()),h.negative&&(h=h.neg(),p=p.neg()),[{a:u,b:d},{a:h,b:p}]};xi.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),l=o.mul(i.a),c=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(l),d=c.add(f).neg();return{k1:u,k2:d}};xi.prototype.pointFromX=function(e,r){e=new De(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};xi.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};xi.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Fr.prototype.isInfinity=function(){return this.inf};Fr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Fr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Fr.prototype.getX=function(){return this.x.fromRed()};Fr.prototype.getY=function(){return this.y.fromRed()};Fr.prototype.mul=function(e){return e=new De(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Fr.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Fr.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Fr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Fr.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(s){return s.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Fr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Gr(t,e,r,n){rl.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new De(0)):(this.x=new De(e,16),this.y=new De(r,16),this.z=new De(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Cx(Gr,rl.BasePoint);xi.prototype.jpoint=function(e,r,n){return new Gr(this,e,r,n)};Gr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Gr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Gr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),l=i.redSub(s),c=o.redSub(a);if(l.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=l.redSqr(),u=f.redMul(l),d=i.redMul(f),h=c.redSqr().redIAdd(u).redISub(d).redISub(d),p=c.redMul(d.redISub(h)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,p,m)};Gr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),u=n.redMul(c),d=l.redSqr().redIAdd(f).redISub(u).redISub(u),h=l.redMul(u.redISub(d)).redISub(s.redMul(f)),p=this.z.redMul(a);return this.curve.jpoint(d,h,p)};Gr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}};Gr.prototype.inspect=function(){return this.isInfinity()?"":""};Gr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ah=Rc(function(t,e){var r=e;r.base=rl,r.short=wG,r.mont=null,r.edwards=null}),lh=Rc(function(t,e){var r=e,n=Zn.assert;function i(a){a.type==="short"?this.curve=new ah.short(a):a.type==="edwards"?this.curve=new ah.edwards(a):this.curve=new ah.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,l){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(l);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ln.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ln.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ln.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ln.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ln.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ln.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ln.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ln.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Yo(t){if(!(this instanceof Yo))return new Yo(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Oi.toArray(t.entropy,t.entropyEnc||"hex"),r=Oi.toArray(t.nonce,t.nonceEnc||"hex"),n=Oi.toArray(t.pers,t.persEnc||"hex");Ax(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var X7=Yo;Yo.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};Yo.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Oi.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var EG=Zn.assert;function S1(t,e){if(t instanceof S1)return t;this._importDER(t,e)||(EG(t.r&&t.s,"Signature without r or s"),this.r=new De(t.r,16),this.s=new De(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var k1=S1;function SG(){this.place=0}function Hv(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function Ek(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}S1.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Ek(r),n=Ek(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Wv(i,r.length),i=i.concat(r),i.push(2),Wv(i,n.length);var s=i.concat(n),o=[48];return Wv(o,s.length),o=o.concat(s),Zn.encode(o,e)};var kG=function(){throw new Error("unsupported")},Z7=Zn.assert;function mi(t){if(!(this instanceof mi))return new mi(t);typeof t=="string"&&(Z7(Object.prototype.hasOwnProperty.call(lh,t),"Unknown curve "+t),t=lh[t]),t instanceof lh.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var AG=mi;mi.prototype.keyPair=function(e){return new _x(this,e)};mi.prototype.keyFromPrivate=function(e,r){return _x.fromPrivate(this,e,r)};mi.prototype.keyFromPublic=function(e,r){return _x.fromPublic(this,e,r)};mi.prototype.genKeyPair=function(e){e||(e={});for(var r=new X7({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||kG(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new De(2));;){var s=new De(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};mi.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};mi.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new De(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new X7({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new De(1)),f=0;;f++){var u=i.k?i.k(f):new De(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(c)>=0)){var d=this.g.mul(u);if(!d.isInfinity()){var h=d.getX(),p=h.umod(this.n);if(p.cmpn(0)!==0){var m=u.invm(this.n).mul(p.mul(r.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var x=(d.getY().isOdd()?1:0)|(h.cmp(p)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),x^=1),new k1({r:p,s:m,recoveryParam:x})}}}}}};mi.prototype.verify=function(e,r,n,i){e=this._truncateToN(new De(e,16)),n=this.keyFromPublic(n,i),r=new k1(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(l,n.getPublic(),c),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(l,n.getPublic(),c),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};mi.prototype.recoverPubKey=function(t,e,r,n){Z7((3&r)===r,"The recovery param is more than two bits"),e=new k1(e,n);var i=this.n,s=new De(t),o=e.r,a=e.s,l=r&1,c=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),d=a.mul(f).umod(i);return this.g.mulAdd(u,o,d)};mi.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new k1(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var CG=Rc(function(t,e){var r=e;r.version="6.5.4",r.utils=Zn,r.rand=function(){throw new Error("unsupported")},r.curve=ah,r.curves=lh,r.ec=AG,r.eddsa=null}),_G=CG.ec;const TG="signing-key/5.7.0",Zy=new Q(TG);let Gv=null;function Ji(){return Gv||(Gv=new _G("secp256k1")),Gv}class Hl{constructor(e){ie(this,"curve","secp256k1"),ie(this,"privateKey",he(e)),Ua(this.privateKey)!==32&&Zy.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=Ji().keyFromPrivate(de(this.privateKey));ie(this,"publicKey","0x"+r.getPublic(!1,"hex")),ie(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ie(this,"_isSigningKey",!0)}_addPoint(e){const r=Ji().keyFromPublic(de(this.publicKey)),n=Ji().keyFromPublic(de(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=Ji().keyFromPrivate(de(this.privateKey)),n=de(e);n.length!==32&&Zy.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ac({recoveryParam:i.recoveryParam,r:Vt("0x"+i.r.toString(16),32),s:Vt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=Ji().keyFromPrivate(de(this.privateKey)),n=Ji().keyFromPublic(de(e_(e)));return Vt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function PG(t,e){const r=Ac(e),n={r:de(r.r),s:de(r.s)};return"0x"+Ji().recoverPubKey(de(t),n,r.recoveryParam).encode("hex",!1)}function e_(t,e){const r=de(t);if(r.length===32){const n=new Hl(r);return e?"0x"+Ji().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?he(r):"0x"+Ji().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+Ji().keyFromPublic(r).getPublic(!0,"hex"):he(r)}return Zy.throwArgumentError("invalid public or private key","key","[REDACTED]")}const RG="transactions/5.7.0",on=new Q(RG);var Sk;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Sk||(Sk={}));function Tx(t){return t==="0x"?null:ir(t)}function sn(t){return t==="0x"?y7:ce.from(t)}const IG=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],OG={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function Ia(t){const e=e_(t);return ir(Pr(Xe(Pr(e,1)),12))}function t_(t,e){return Ia(PG(de(t),e))}function Bn(t,e){const r=zs(ce.from(t).toHexString());return r.length>32&&on.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Kv(t,e){return{address:ir(t),storageKeys:(e||[]).map((r,n)=>(Ua(r)!==32&&on.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function Ic(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&on.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Kv(r[0],r[1])):Kv(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return Kv(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r_(t){return Ic(t).map(e=>[e.address,e.storageKeys])}function n_(t,e){if(t.gasPrice!=null){const n=ce.from(t.gasPrice),i=ce.from(t.maxFeePerGas||0);n.eq(i)||on.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[Bn(t.chainId||0,"chainId"),Bn(t.nonce||0,"nonce"),Bn(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Bn(t.maxFeePerGas||0,"maxFeePerGas"),Bn(t.gasLimit||0,"gasLimit"),t.to!=null?ir(t.to):"0x",Bn(t.value||0,"value"),t.data||"0x",r_(t.accessList||[])];if(e){const n=Ac(e);r.push(Bn(n.recoveryParam,"recoveryParam")),r.push(zs(n.r)),r.push(zs(n.s))}return En(["0x02",ac(r)])}function i_(t,e){const r=[Bn(t.chainId||0,"chainId"),Bn(t.nonce||0,"nonce"),Bn(t.gasPrice||0,"gasPrice"),Bn(t.gasLimit||0,"gasLimit"),t.to!=null?ir(t.to):"0x",Bn(t.value||0,"value"),t.data||"0x",r_(t.accessList||[])];if(e){const n=Ac(e);r.push(Bn(n.recoveryParam,"recoveryParam")),r.push(zs(n.r)),r.push(zs(n.s))}return En(["0x01",ac(r)])}function MG(t,e){i7(t,OG);const r=[];IG.forEach(function(o){let a=t[o.name]||[];const l={};o.numeric&&(l.hexPad="left"),a=de(he(a,l)),o.length&&a.length!==o.length&&a.length>0&&on.throwArgumentError("invalid length for "+o.name,"transaction:"+o.name,a),o.maxLength&&(a=zs(a),a.length>o.maxLength&&on.throwArgumentError("invalid length for "+o.name,"transaction:"+o.name,a)),r.push(he(a))});let n=0;if(t.chainId!=null?(n=t.chainId,typeof n!="number"&&on.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!b1(e)&&e.v>28&&(n=Math.floor((e.v-35)/2)),n!==0&&(r.push(he(n)),r.push("0x"),r.push("0x")),!e)return ac(r);const i=Ac(e);let s=27+i.recoveryParam;return n!==0?(r.pop(),r.pop(),r.pop(),s+=n*2+8,i.v>28&&i.v!==s&&on.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):i.v!==s&&on.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push(he(s)),r.push(zs(de(i.r))),r.push(zs(de(i.s))),ac(r)}function kk(t,e){if(t.type==null||t.type===0)return t.accessList!=null&&on.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),MG(t,e);switch(t.type){case 1:return i_(t,e);case 2:return n_(t,e)}return on.throwError(`unsupported transaction type: ${t.type}`,Q.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function s_(t,e,r){try{const n=sn(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{on.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Vt(e[1],32),t.s=Vt(e[2],32);try{const n=Xe(r(t));t.from=t_(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function NG(t){const e=wx(t.slice(1));e.length!==9&&e.length!==12&&on.throwArgumentError("invalid component count for transaction type: 2","payload",he(t));const r=sn(e[2]),n=sn(e[3]),i={type:2,chainId:sn(e[0]).toNumber(),nonce:sn(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:sn(e[4]),to:Tx(e[5]),value:sn(e[6]),data:e[7],accessList:Ic(e[8])};return e.length===9||(i.hash=Xe(t),s_(i,e.slice(9),n_)),i}function $G(t){const e=wx(t.slice(1));e.length!==8&&e.length!==11&&on.throwArgumentError("invalid component count for transaction type: 1","payload",he(t));const r={type:1,chainId:sn(e[0]).toNumber(),nonce:sn(e[1]).toNumber(),gasPrice:sn(e[2]),gasLimit:sn(e[3]),to:Tx(e[4]),value:sn(e[5]),data:e[6],accessList:Ic(e[7])};return e.length===8||(r.hash=Xe(t),s_(r,e.slice(8),i_)),r}function DG(t){const e=wx(t);e.length!==9&&e.length!==6&&on.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:sn(e[0]).toNumber(),gasPrice:sn(e[1]),gasLimit:sn(e[2]),to:Tx(e[3]),value:sn(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=ce.from(e[6]).toNumber()}catch{return r}if(r.r=Vt(e[7],32),r.s=Vt(e[8],32),ce.from(r.r).isZero()&&ce.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(he(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const s=Xe(ac(i));try{r.from=t_(s,{r:he(r.r),s:he(r.s),recoveryParam:n})}catch{}r.hash=Xe(t)}return r.type=null,r}function LG(t){const e=de(t);if(e[0]>127)return DG(e);switch(e[0]){case 1:return $G(e);case 2:return NG(e)}return on.throwError(`unsupported transaction type: ${e[0]}`,Q.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const jG="contracts/5.7.0";var Ha=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const mr=new Q(jG);function u0(t,e){return Ha(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&&mr.throwArgumentError("invalid address or ENS name","name",r);try{return ir(r)}catch{}t||mr.throwError("a provider or signer is needed to resolve ENS names",Q.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&&mr.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ch(t,e,r){return Ha(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ch(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield u0(t,e):r.type==="tuple"?yield ch(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ch(t,n,r.arrayChildren))):Promise.reject(mr.makeError("invalid value for array",Q.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function A1(t,e,r){return Ha(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=Or(r.pop())),mr.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yr({override:u0(t.signer,n.from),signer:t.signer.getAddress()}).then(c=>Ha(this,void 0,void 0,function*(){return ir(c.signer)!==c.override&&mr.throwError("Contract with a Signer cannot override from",Q.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),c.override})):n.from=t.signer.getAddress():n.from&&(n.from=u0(t.provider,n.from));const i=yield yr({args:ch(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yr(n)||{}}),s=t.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=ce.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=ce.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=ce.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=ce.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=ce.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Ic(a.accessList)),o.gasLimit==null&&e.gas!=null){let c=21e3;const f=de(s);for(let u=0;un[c]!=null);return l.length&&mr.throwError(`cannot override ${l.map(c=>JSON.stringify(c)).join(",")}`,Q.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function FG(t,e){return function(...r){return A1(t,e,r)}}function BG(t,e){const r=t.signer||t.provider;return function(...n){return Ha(this,void 0,void 0,function*(){r||mr.throwError("estimate require a provider or signer",Q.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield A1(t,e,n);return yield r.estimateGas(i)})}}function UG(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(s=>{let o=za(s),a=null;try{a=t.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,c)=>t.interface.decodeEventLog(a.eventFragment,l,c),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>t.provider,o.getBlock=()=>t.provider.getBlock(i.blockHash),o.getTransaction=()=>t.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function o_(t,e,r){const n=t.signer||t.provider;return function(...i){return Ha(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=Or(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}t.deployTransaction!=null&&(yield t._deployed(s));const o=yield A1(t,e,i),a=yield n.call(o,s);try{let l=t.interface.decodeFunctionResult(e,a);return r&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===Q.errors.CALL_EXCEPTION&&(l.address=t.address,l.args=i,l.transaction=o),l}})}}function zG(t,e){return function(...r){return Ha(this,void 0,void 0,function*(){t.signer||mr.throwError("sending a transaction requires a signer",Q.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield A1(t,e,r),i=yield t.signer.sendTransaction(n);return UG(t,i),i})}}function Ak(t,e,r){return e.constant?o_(t,e,r):zG(t,e)}function a_(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class fu{constructor(e,r){ie(this,"tag",e),ie(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class VG extends fu{constructor(){super("error",null)}}class Ck extends fu{constructor(e,r,n,i){const s={address:e};let o=r.getEventTopic(n);i?(o!==i[0]&&mr.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(a_(s),s),ie(this,"address",e),ie(this,"interface",r),ie(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Sq(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class _k extends fu{constructor(e,r){super("*",{address:e}),ie(this,"address",e),ie(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class qG{constructor(e,r,n){ie(this,"interface",is(new.target,"getInterface")(r)),n==null?(ie(this,"provider",null),ie(this,"signer",null)):Cc.isSigner(n)?(ie(this,"provider",n.provider||null),ie(this,"signer",n)):zu.isProvider(n)?(ie(this,"provider",n),ie(this,"signer",null)):mr.throwArgumentError("invalid signer or provider","signerOrProvider",n),ie(this,"callStatic",{}),ie(this,"estimateGas",{}),ie(this,"functions",{}),ie(this,"populateTransaction",{}),ie(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];ie(this.filters,a,(...c)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,c)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?ie(this.filters,a,this.filters[l[0]]):mr.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(ie(this,"_runningEvents",{}),ie(this,"_wrappedEmits",{}),e==null&&mr.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ie(this,"address",e),this.provider)ie(this,"resolvedAddress",u0(this.provider,e));else try{ie(this,"resolvedAddress",Promise.resolve(ir(e)))}catch{mr.throwError("provider is required to use ENS name as contract address",Q.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){mr.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&ie(this,o,Ak(this,a,!0)),this.functions[o]==null&&ie(this.functions,o,Ak(this,a,!1)),this.callStatic[o]==null&&ie(this.callStatic,o,o_(this,a,!0)),this.populateTransaction[o]==null&&ie(this.populateTransaction,o,FG(this,a)),this.estimateGas[o]==null&&ie(this.estimateGas,o,BG(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&ie(this,o,this[l])}catch{}this.functions[o]==null&&ie(this.functions,o,this.functions[l]),this.callStatic[o]==null&&ie(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&ie(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&ie(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return d7(e)}static getInterface(e){return mk.isInterface(e)?e:new mk(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&&mr.throwError("contract not deployed",Q.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||mr.throwError("sending a transactions require a signer",Q.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=Or(e||{});return["from","to"].forEach(function(n){r[n]!=null&&mr.throwError("cannot override "+n,Q.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new kx(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ie(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Ky.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new VG);if(e==="event")return this._normalizeRunningEvent(new fu("event",null));if(e==="*")return this._normalizeRunningEvent(new _k(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Ck(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Ck(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new fu(a_(r),r))}return this._normalizeRunningEvent(new _k(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=za(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||mr.throwError("events require a provider or a signer with a provider",Q.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,r);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),s=Or(i.filter);return typeof r=="string"&&et(r,32)?(n!=null&&mr.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),s.blockHash=r):(s.fromBlock=r??0,s.toBlock=n??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class HG extends qG{}class l_{constructor(e){ie(this,"alphabet",e),ie(this,"base",e.length),ie(this,"_alphabetMap",{}),ie(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;r[s]===0&&s=0;--s)i+=this.alphabet[n[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;s>0;)r.push(s&255),s>>=8}for(let n=0;e[n]===this._leader&&n>24&255,l[e.length+1]=u>>16&255,l[e.length+2]=u>>8&255,l[e.length+3]=u&255;let d=de(d0(i,t,l));s||(s=d.length,f=new Uint8Array(s),o=Math.ceil(n/s),c=n-(o-1)*s),f.set(d);for(let m=1;m=256)throw new Error("Depth too large!");return Pk(wr([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",he(this.depth),this.parentFingerprint,Vt(he(this.index),4),this.chainCode,this.privateKey!=null?wr(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new ci(cl,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~Jc));const n=new Uint8Array(37);if(e&Jc){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set(de(this.privateKey),1),r&&(r+="'")}else n.set(de(this.publicKey));for(let u=24;u>=0;u-=8)n[33+(u>>3)]=e>>24-u&255;const i=de(d0(du.sha512,this.chainCode,n)),s=i.slice(0,32),o=i.slice(32);let a=null,l=null;this.privateKey?a=Cd(ce.from(s).add(this.privateKey).mod(eK)):l=new Hl(he(s))._addPoint(this.publicKey);let c=r;const f=this.mnemonic;return f&&(c=Object.freeze({phrase:f.phrase,path:r,locale:f.locale||"en"})),new ci(cl,a,l,this.fingerprint,Cd(o),e,this.depth+1,c)}derivePath(e){const r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let n=this;for(let i=0;i=Jc)throw new Error("invalid path index - "+s);n=n._derive(Jc+o)}else if(s.match(/^[0-9]+$/)){const o=parseInt(s);if(o>=Jc)throw new Error("invalid path index - "+s);n=n._derive(o)}else throw new Error("invalid path component - "+s)}return n}static _fromSeed(e,r){const n=de(e);if(n.length<16||n.length>64)throw new Error("invalid seed");const i=de(d0(du.sha512,tK,n));return new ci(cl,Cd(i.slice(0,32)),null,"0x00000000",Cd(i.slice(32)),0,0,r)}static fromMnemonic(e,r,n){return n=Rx(n),e=Ix(u_(e,n),n),ci._fromSeed(nK(e,r),{phrase:e,path:"m",locale:n.locale})}static fromSeed(e){return ci._fromSeed(e,null)}static fromExtendedKey(e){const r=uu.decode(e);(r.length!==82||Pk(r.slice(0,78))!==e)&&h0.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const n=r[4],i=he(r.slice(5,9)),s=parseInt(he(r.slice(9,13)).substring(2),16),o=he(r.slice(13,45)),a=r.slice(45,78);switch(he(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new ci(cl,null,he(a),i,o,s,n,null);case"0x0488ade4":case"0x04358394 ":if(a[0]!==0)break;return new ci(cl,he(a.slice(1)),null,i,o,s,n,null)}return h0.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function nK(t,e){e||(e="");const r=_t("mnemonic"+e,Ko.NFKD);return Px(_t(t,Ko.NFKD),r,2048,64,"sha512")}function u_(t,e){e=Rx(e),h0.checkNormalize();const r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");const n=de(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let c=0;c>3]|=1<<7-i%8),i++}const s=32*r.length/3,o=r.length/3,a=f_(o);if((de(Wa(n.slice(0,s/8)))[0]&a)!==(n[n.length-1]&a))throw new Error("invalid checksum");return he(n.slice(0,s/8))}function Ix(t,e){if(e=Rx(e),t=de(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");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]&rK(8-n)),n+=3);const i=t.length/4,s=de(Wa(t))[0]&f_(i);return r[r.length-1]<<=i,r[r.length-1]|=s>>8-i,e.join(r.map(o=>e.getWord(o)))}const iK="random/5.7.0",tm=new Q(iK);function sK(){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 Rk=sK();let fh=Rk.crypto||Rk.msCrypto;(!fh||!fh.getRandomValues)&&(tm.warn("WARNING: Missing strong random number source"),fh={getRandomValues:function(t){return tm.throwError("no secure random source avaialble",Q.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function uf(t){(t<=0||t>1024||t%1||t!=t)&&tm.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return fh.getRandomValues(e),de(e)}var d_={exports:{}};(function(t,e){(function(r){function n(S){return parseInt(S)===S}function i(S){if(!n(S.length))return!1;for(var g=0;g255)return!1;return!0}function s(S,g){if(S.buffer&&ArrayBuffer.isView(S)&&S.name==="Uint8Array")return g&&(S.slice?S=S.slice():S=Array.prototype.slice.call(S)),S;if(Array.isArray(S)){if(!i(S))throw new Error("Array contains invalid value: "+S);return new Uint8Array(S)}if(n(S.length)&&i(S))return new Uint8Array(S);throw new Error("unsupported array-like object")}function o(S){return new Uint8Array(S)}function a(S,g,R,F,C){(F!=null||C!=null)&&(S.slice?S=S.slice(F,C):S=Array.prototype.slice.call(S,F,C)),g.set(S,R)}var l=function(){function S(R){var F=[],C=0;for(R=encodeURI(R);C191&&B<224?(F.push(String.fromCharCode((B&31)<<6|R[C+1]&63)),C+=2):(F.push(String.fromCharCode((B&15)<<12|(R[C+1]&63)<<6|R[C+2]&63)),C+=3)}return F.join("")}return{toBytes:S,fromBytes:g}}(),c=function(){function S(F){for(var C=[],B=0;B>4]+g[V&15])}return C.join("")}return{toBytes:S,fromBytes:R}}(),f={16:10,24:12,32:14},u=[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],d=[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],h=[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],p=[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],m=[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],x=[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],b=[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],w=[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],E=[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],P=[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],N=[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],I=[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],j=[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],L=[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],U=[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 K(S){for(var g=[],R=0;R>2,this._Ke[B][g%4]=C[g],this._Kd[S-B][g%4]=C[g];for(var V=0,H=F,Z;H>16&255]<<24^d[Z>>8&255]<<16^d[Z&255]<<8^d[Z>>24&255]^u[V]<<24,V+=1,F!=8)for(var g=1;g>8&255]<<8^d[Z>>16&255]<<16^d[Z>>24&255]<<24;for(var g=F/2+1;g>2,ne=H%4,this._Ke[le][ne]=C[g],this._Kd[S-le][ne]=C[g++],H++}for(var le=1;le>24&255]^j[Z>>16&255]^L[Z>>8&255]^U[Z&255]},X.prototype.encrypt=function(S){if(S.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var g=this._Ke.length-1,R=[0,0,0,0],F=K(S),C=0;C<4;C++)F[C]^=this._Ke[0][C];for(var B=1;B>24&255]^m[F[(C+1)%4]>>16&255]^x[F[(C+2)%4]>>8&255]^b[F[(C+3)%4]&255]^this._Ke[B][C];F=R.slice()}for(var V=o(16),H,C=0;C<4;C++)H=this._Ke[g][C],V[4*C]=(d[F[C]>>24&255]^H>>24)&255,V[4*C+1]=(d[F[(C+1)%4]>>16&255]^H>>16)&255,V[4*C+2]=(d[F[(C+2)%4]>>8&255]^H>>8)&255,V[4*C+3]=(d[F[(C+3)%4]&255]^H)&255;return V},X.prototype.decrypt=function(S){if(S.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var g=this._Kd.length-1,R=[0,0,0,0],F=K(S),C=0;C<4;C++)F[C]^=this._Kd[0][C];for(var B=1;B>24&255]^E[F[(C+3)%4]>>16&255]^P[F[(C+2)%4]>>8&255]^N[F[(C+1)%4]&255]^this._Kd[B][C];F=R.slice()}for(var V=o(16),H,C=0;C<4;C++)H=this._Kd[g][C],V[4*C]=(h[F[C]>>24&255]^H>>24)&255,V[4*C+1]=(h[F[(C+3)%4]>>16&255]^H>>16)&255,V[4*C+2]=(h[F[(C+2)%4]>>8&255]^H>>8)&255,V[4*C+3]=(h[F[(C+1)%4]&255]^H)&255;return V};var ee=function(S){if(!(this instanceof ee))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new X(S)};ee.prototype.encrypt=function(S){if(S=s(S),S.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var g=o(S.length),R=o(16),F=0;F=0;--g)this._counter[g]=S%256,S=S>>8},k.prototype.setBytes=function(S){if(S=s(S,!0),S.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=S},k.prototype.increment=function(){for(var S=15;S>=0;S--)if(this._counter[S]===255)this._counter[S]=0;else{this._counter[S]++;break}};var A=function(S,g){if(!(this instanceof A))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",g instanceof k||(g=new k(g)),this._counter=g,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new X(S)};A.prototype.encrypt=function(S){for(var g=s(S,!0),R=0;R16)throw new Error("PKCS#7 padding byte out of range");for(var R=S.length-g,F=0;F=64;){let D=b,S=w,g=E,R=P,F=N,C=I,B=j,V=L,H,Z,le,ne,te;for(Z=0;Z<16;Z++)le=T+Z*4,U[Z]=(A[le]&255)<<24|(A[le+1]&255)<<16|(A[le+2]&255)<<8|A[le+3]&255;for(Z=16;Z<64;Z++)H=U[Z-2],ne=(H>>>17|H<<32-17)^(H>>>19|H<<32-19)^H>>>10,H=U[Z-15],te=(H>>>7|H<<32-7)^(H>>>18|H<<32-18)^H>>>3,U[Z]=(ne+U[Z-7]|0)+(te+U[Z-16]|0)|0;for(Z=0;Z<64;Z++)ne=(((F>>>6|F<<32-6)^(F>>>11|F<<32-11)^(F>>>25|F<<32-25))+(F&C^~F&B)|0)+(V+(x[Z]+U[Z]|0)|0)|0,te=((D>>>2|D<<32-2)^(D>>>13|D<<32-13)^(D>>>22|D<<32-22))+(D&S^D&g^S&g)|0,V=B,B=C,C=F,F=R+ne|0,R=g,g=S,S=D,D=ne+te|0;b=b+D|0,w=w+S|0,E=E+g|0,P=P+R|0,N=N+F|0,I=I+C|0,j=j+B|0,L=L+V|0,T+=64,O-=64}}K(m);let X,ee=m.length%64,M=m.length/536870912|0,v=m.length<<3,_=ee<56?56:120,k=m.slice(m.length-ee,m.length);for(k.push(128),X=ee+1;X<_;X++)k.push(0);return k.push(M>>>24&255),k.push(M>>>16&255),k.push(M>>>8&255),k.push(M>>>0&255),k.push(v>>>24&255),k.push(v>>>16&255),k.push(v>>>8&255),k.push(v>>>0&255),K(k),[b>>>24&255,b>>>16&255,b>>>8&255,b>>>0&255,w>>>24&255,w>>>16&255,w>>>8&255,w>>>0&255,E>>>24&255,E>>>16&255,E>>>8&255,E>>>0&255,P>>>24&255,P>>>16&255,P>>>8&255,P>>>0&255,N>>>24&255,N>>>16&255,N>>>8&255,N>>>0&255,I>>>24&255,I>>>16&255,I>>>8&255,I>>>0&255,j>>>24&255,j>>>16&255,j>>>8&255,j>>>0&255,L>>>24&255,L>>>16&255,L>>>8&255,L>>>0&255]}function s(m,x,b){m=m.length<=64?m:i(m);const w=64+x.length+4,E=new Array(w),P=new Array(64);let N,I=[];for(N=0;N<64;N++)E[N]=54;for(N=0;N=w-4;L--){if(E[L]++,E[L]<=255)return;E[L]=0}}for(;b>=32;)j(),I=I.concat(i(P.concat(i(E)))),b-=32;return b>0&&(j(),I=I.concat(i(P.concat(i(E))).slice(0,b))),I}function o(m,x,b,w,E){let P;for(f(m,(2*b-1)*16,E,0,16),P=0;P<2*b;P++)c(m,P*16,E,16),l(E,w),f(E,0,m,x+P*16,16);for(P=0;P>>32-x}function l(m,x){f(m,0,x,0,16);for(let b=8;b>0;b-=2)x[4]^=a(x[0]+x[12],7),x[8]^=a(x[4]+x[0],9),x[12]^=a(x[8]+x[4],13),x[0]^=a(x[12]+x[8],18),x[9]^=a(x[5]+x[1],7),x[13]^=a(x[9]+x[5],9),x[1]^=a(x[13]+x[9],13),x[5]^=a(x[1]+x[13],18),x[14]^=a(x[10]+x[6],7),x[2]^=a(x[14]+x[10],9),x[6]^=a(x[2]+x[14],13),x[10]^=a(x[6]+x[2],18),x[3]^=a(x[15]+x[11],7),x[7]^=a(x[3]+x[15],9),x[11]^=a(x[7]+x[3],13),x[15]^=a(x[11]+x[7],18),x[1]^=a(x[0]+x[3],7),x[2]^=a(x[1]+x[0],9),x[3]^=a(x[2]+x[1],13),x[0]^=a(x[3]+x[2],18),x[6]^=a(x[5]+x[4],7),x[7]^=a(x[6]+x[5],9),x[4]^=a(x[7]+x[6],13),x[5]^=a(x[4]+x[7],18),x[11]^=a(x[10]+x[9],7),x[8]^=a(x[11]+x[10],9),x[9]^=a(x[8]+x[11],13),x[10]^=a(x[9]+x[8],18),x[12]^=a(x[15]+x[14],7),x[13]^=a(x[12]+x[15],9),x[14]^=a(x[13]+x[12],13),x[15]^=a(x[14]+x[13],18);for(let b=0;b<16;++b)m[b]+=x[b]}function c(m,x,b,w){for(let E=0;E=256)return!1}return!0}function d(m,x){if(typeof m!="number"||m%1)throw new Error("invalid "+x);return m}function h(m,x,b,w,E,P,N){if(b=d(b,"N"),w=d(w,"r"),E=d(E,"p"),P=d(P,"dkLen"),b===0||b&b-1)throw new Error("N must be power of 2");if(b>2147483647/128/w)throw new Error("N too large");if(w>2147483647/128/E)throw new Error("r too large");if(!u(m))throw new Error("password must be an array or buffer");if(m=Array.prototype.slice.call(m),!u(x))throw new Error("salt must be an array or buffer");x=Array.prototype.slice.call(x);let I=s(m,x,E*128*w);const j=new Uint32Array(E*32*w);for(let F=0;FS&&(F=S);for(let B=0;BS&&(F=S);for(let B=0;B>0&255),I.push(j[B]>>8&255),I.push(j[B]>>16&255),I.push(j[B]>>24&255);const C=s(m,I,P);return N&&N(null,1,C),C}N&&g(R)};if(!N)for(;;){const F=R();if(F!=null)return F}R()}const p={scrypt:function(m,x,b,w,E,P,N){return new Promise(function(I,j){let L=0;N&&N(0),h(m,x,b,w,E,P,function(U,K,X){if(U)j(U);else if(X)N&&L!==1&&N(1),I(new Uint8Array(X));else if(N&&K!==L)return L=K,N(K)})})},syncScrypt:function(m,x,b,w,E,P){return new Uint8Array(h(m,x,b,w,E,P))}};t.exports=p})()})(m_);var fK=m_.exports;const Mx=eo(fK);var uK=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const rm=new Q(h_);function Ik(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}class dK extends tl{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}}function hK(t,e,r){if(mr(t,"crypto/cipher")==="aes-128-ctr"){const i=Oa(mr(t,"crypto/cipherparams/iv")),s=new ss.Counter(i),o=new ss.ModeOfOperation.ctr(e,s);return de(o.decrypt(r))}return null}function g_(t,e){const r=Oa(mr(t,"crypto/ciphertext"));if(he(Xe(wr([e.slice(16,32),r]))).substring(2)!==mr(t,"crypto/mac").toLowerCase())throw new Error("invalid password");const i=hK(t,e.slice(0,16),r);i||rm.throwError("unsupported cipher",Q.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const s=e.slice(32,64),o=Ia(i);if(t.address){let l=t.address.toLowerCase();if(l.substring(0,2)!=="0x"&&(l="0x"+l),ir(l)!==o)throw new Error("address mismatch")}const a={_isKeystoreAccount:!0,address:o,privateKey:he(i)};if(mr(t,"x-ethers/version")==="0.1"){const l=Oa(mr(t,"x-ethers/mnemonicCiphertext")),c=Oa(mr(t,"x-ethers/mnemonicCounter")),f=new ss.Counter(c),u=new ss.ModeOfOperation.ctr(s,f),d=mr(t,"x-ethers/path")||hu,h=mr(t,"x-ethers/locale")||"en",p=de(u.decrypt(l));try{const m=Ix(p,h),x=ci.fromMnemonic(m,null,h).derivePath(d);if(x.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=x.mnemonic}catch(m){if(m.code!==Q.errors.INVALID_ARGUMENT||m.argument!=="wordlist")throw m}}return new dK(a)}function x_(t,e,r,n,i){return de(Px(t,e,r,n,i))}function vK(t,e,r,n,i){return Promise.resolve(x_(t,e,r,n,i))}function b_(t,e,r,n,i){const s=Ox(e),o=mr(t,"crypto/kdf");if(o&&typeof o=="string"){const a=function(l,c){return rm.throwArgumentError("invalid key-derivation function parameters",l,c)};if(o.toLowerCase()==="scrypt"){const l=Oa(mr(t,"crypto/kdfparams/salt")),c=parseInt(mr(t,"crypto/kdfparams/n")),f=parseInt(mr(t,"crypto/kdfparams/r")),u=parseInt(mr(t,"crypto/kdfparams/p"));(!c||!f||!u)&&a("kdf",o),c&c-1&&a("N",c);const d=parseInt(mr(t,"crypto/kdfparams/dklen"));return d!==32&&a("dklen",d),n(s,l,c,f,u,64,i)}else if(o.toLowerCase()==="pbkdf2"){const l=Oa(mr(t,"crypto/kdfparams/salt"));let c=null;const f=mr(t,"crypto/kdfparams/prf");f==="hmac-sha256"?c="sha256":f==="hmac-sha512"?c="sha512":a("prf",f);const u=parseInt(mr(t,"crypto/kdfparams/c")),d=parseInt(mr(t,"crypto/kdfparams/dklen"));return d!==32&&a("dklen",d),r(s,l,u,d,c)}}return rm.throwArgumentError("unsupported key-derivation function","kdf",o)}function pK(t,e){const r=JSON.parse(t),n=b_(r,e,x_,Mx.syncScrypt);return g_(r,n)}function yK(t,e,r){return uK(this,void 0,void 0,function*(){const n=JSON.parse(t),i=yield b_(n,e,vK,Mx.scrypt,r);return g_(n,i)})}function mK(t,e,r,n){try{if(ir(t.address)!==Ia(t.privateKey))throw new Error("address/privateKey mismatch");if(Ik(t)){const x=t.mnemonic;if(ci.fromMnemonic(x.phrase,null,x.locale).derivePath(x.path||hu).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(x){return Promise.reject(x)}typeof r=="function"&&!n&&(n=r,r={}),r||(r={});const i=de(t.privateKey),s=Ox(e);let o=null,a=null,l=null;if(Ik(t)){const x=t.mnemonic;o=de(u_(x.phrase,x.locale||"en")),a=x.path||hu,l=x.locale||"en"}let c=r.client;c||(c="ethers.js");let f=null;r.salt?f=de(r.salt):f=uf(32);let u=null;if(r.iv){if(u=de(r.iv),u.length!==16)throw new Error("invalid iv")}else u=uf(16);let d=null;if(r.uuid){if(d=de(r.uuid),d.length!==16)throw new Error("invalid uuid")}else d=uf(16);let h=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(h=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),Mx.scrypt(s,f,h,p,m,64,n).then(x=>{x=de(x);const b=x.slice(0,16),w=x.slice(16,32),E=x.slice(32,64),P=new ss.Counter(u),N=new ss.ModeOfOperation.ctr(b,P),I=de(N.encrypt(i)),j=Xe(wr([w,I])),L={address:t.address.substring(2).toLowerCase(),id:aK(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:he(u).substring(2)},ciphertext:he(I).substring(2),kdf:"scrypt",kdfparams:{salt:he(f).substring(2),n:h,dklen:32,p:m,r:p},mac:j.substring(2)}};if(o){const U=uf(16),K=new ss.Counter(U),X=new ss.ModeOfOperation.ctr(E,K),ee=de(X.encrypt(o)),M=new Date,v=M.getUTCFullYear()+"-"+Xc(M.getUTCMonth()+1,2)+"-"+Xc(M.getUTCDate(),2)+"T"+Xc(M.getUTCHours(),2)+"-"+Xc(M.getUTCMinutes(),2)+"-"+Xc(M.getUTCSeconds(),2)+".0Z";L["x-ethers"]={client:c,gethFilename:"UTC--"+v+"--"+L.address,mnemonicCounter:he(U).substring(2),mnemonicCiphertext:he(ee).substring(2),path:a,locale:l,version:"0.1"}}return JSON.stringify(L)})}function gK(t,e,r){if(p_(t)){r&&r(0);const n=v_(t,e);return r&&r(1),Promise.resolve(n)}return y_(t)?yK(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function xK(t,e){if(p_(t))return v_(t,e);if(y_(t))return pK(t,e);throw new Error("invalid JSON wallet")}const bK="wallet/5.7.0";var Ok=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const fl=new Q(bK);function wK(t){return t!=null&&et(t.privateKey,32)&&t.address!=null}function EK(t){const e=t.mnemonic;return e&&e.phrase}class Ns extends Cc{constructor(e,r){if(super(),wK(e)){const n=new Hl(e.privateKey);if(ie(this,"_signingKey",()=>n),ie(this,"address",Ia(this.publicKey)),this.address!==ir(e.address)&&fl.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),EK(e)){const i=e.mnemonic;ie(this,"_mnemonic",()=>({phrase:i.phrase,path:i.path||hu,locale:i.locale||"en"}));const s=this.mnemonic,o=ci.fromMnemonic(s.phrase,null,s.locale).derivePath(s.path);Ia(o.privateKey)!==this.address&&fl.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ie(this,"_mnemonic",()=>null)}else{if(Hl.isSigningKey(e))e.curve!=="secp256k1"&&fl.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ie(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);const n=new Hl(e);ie(this,"_signingKey",()=>n)}ie(this,"_mnemonic",()=>null),ie(this,"address",Ia(this.publicKey))}r&&!zu.isProvider(r)&&fl.throwArgumentError("invalid provider","provider",r),ie(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new Ns(this,e)}signTransaction(e){return pr(e).then(r=>{r.from!=null&&(ir(r.from)!==this.address&&fl.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);const n=this._signingKey().signDigest(Xe(kk(r)));return kk(r,n)})}signMessage(e){return Ok(this,void 0,void 0,function*(){return XS(this._signingKey().signDigest(CH(e)))})}_signTypedData(e,r,n){return Ok(this,void 0,void 0,function*(){const i=yield hn.resolveNames(e,r,n,s=>(this.provider==null&&fl.throwError("cannot resolve ENS names without a provider",Q.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:s}),this.provider.resolveName(s)));return XS(this._signingKey().signDigest(hn.hash(i.domain,r,i.value)))})}encrypt(e,r,n){if(typeof r=="function"&&!n&&(n=r,r={}),n&&typeof n!="function")throw new Error("invalid callback");return r||(r={}),mK(this,e,r,n)}static createRandom(e){let r=uf(16);e||(e={}),e.extraEntropy&&(r=de(Pr(Xe(wr([r,e.extraEntropy])),0,16)));const n=Ix(r,e.locale);return Ns.fromMnemonic(n,e.path,e.locale)}static fromEncryptedJson(e,r,n){return gK(e,r,n).then(i=>new Ns(i))}static fromEncryptedJsonSync(e,r){return new Ns(xK(e,r))}static fromMnemonic(e,r,n){return r||(r=hu),new Ns(ci.fromMnemonic(e,null,n).derivePath(r))}}const SK="networks/5.7.1",Mk=new Q(SK);function kK(t){return t&&typeof t.renetwork=="function"}function Is(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new r.PocketProvider(t,n.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const s=["ropsten"],o=new r.AnkrProvider(t,n.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let s=1;return n.quorum!=null?s=n.quorum:t==="homestead"&&(s=2),new r.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(r){return Is(r)},e}function v0(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return v0(t,n)},r}const Nk={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Is("homestead")},$k={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Is("ropsten")},Dk={chainId:63,name:"classicMordor",_defaultProvider:v0("https://www.ethercluster.com/mordor","classicMordor")},_d={unspecified:{chainId:0,name:"unspecified"},homestead:Nk,mainnet:Nk,morden:{chainId:2,name:"morden"},ropsten:$k,testnet:$k,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Is("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Is("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Is("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Is("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:v0("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Dk,classicTestnet:Dk,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:v0("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Is("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Is("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function AK(t){if(t==null)return null;if(typeof t=="number"){for(const n in _d){const i=_d[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=_d[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=_d[t.name];if(!e)return typeof t.chainId!="number"&&Mk.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&Mk.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(kK(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const CK="web/5.7.1";var _K=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};function TK(t,e){return _K(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const o=e.fetchOptions;o.mode&&(r.mode=o.mode),o.cache&&(r.cache=o.cache),o.credentials&&(r.credentials=o.credentials),o.redirect&&(r.redirect=o.redirect),o.referrer&&(r.referrer=o.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach((o,a)=>{s[a.toLowerCase()]=o}):n.headers.keys().forEach(o=>{s[o.toLowerCase()]=n.headers.get(o)}),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:de(new Uint8Array(i))}})}var PK=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const ki=new Q(CK);function Lk(t){return new Promise(e=>{setTimeout(e,t)})}function uo(t,e){if(t==null)return null;if(typeof t=="string")return t;if(b1(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return Uu(t)}catch{}return he(t)}return t}function RK(t){return _t(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function IK(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;ki.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,s=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;ki.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof t=="object"?!!t.errorPassThrough:!1,a={};let l=null;const c={method:"GET"};let f=!1,u=2*60*1e3;if(typeof t=="string")l=t;else if(typeof t=="object"){if((t==null||t.url==null)&&ki.throwArgumentError("missing URL","connection.url",t),l=t.url,typeof t.timeout=="number"&&t.timeout>0&&(u=t.timeout),t.headers)for(const b in t.headers)a[b.toLowerCase()]={key:b,value:String(t.headers[b])},["if-none-match","if-modified-since"].indexOf(b.toLowerCase())>=0&&(f=!0);if(c.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){l.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&ki.throwError("basic authentication requires a secure https url",Q.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:t.user,password:"[REDACTED]"});const b=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+E7(_t(b))}}t.skipFetchSetup!=null&&(c.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(c.fetchOptions=Or(t.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(d):null;if(h)try{const b={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?w7(h[3]):RK(h[3])};let w=b.body;return r&&(w=r(b.body,b)),Promise.resolve(w)}catch(b){ki.throwError("processing response error",Q.errors.SERVER_ERROR,{body:uo(h[1],h[2]),error:b,requestBody:null,requestMethod:"GET",url:l})}e&&(c.method="POST",c.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const p={};Object.keys(a).forEach(b=>{const w=a[b];p[w.key]=w.value}),c.headers=p;const m=function(){let b=null;return{promise:new Promise(function(P,N){u&&(b=setTimeout(()=>{b!=null&&(b=null,N(ki.makeError("timeout",Q.errors.TIMEOUT,{requestBody:uo(c.body,p["content-type"]),requestMethod:c.method,timeout:u,url:l})))},u))}),cancel:function(){b!=null&&(clearTimeout(b),b=null)}}}(),x=function(){return PK(this,void 0,void 0,function*(){for(let b=0;b=300)&&(m.cancel(),ki.throwError("bad response",Q.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:uo(E,w.headers?w.headers["content-type"]:null),requestBody:uo(c.body,p["content-type"]),requestMethod:c.method,url:l})),r)try{const P=yield r(E,w);return m.cancel(),P}catch(P){if(P.throttleRetry&&b{let a=null;if(s!=null)try{a=JSON.parse(Uu(s))}catch(l){ki.throwError("invalid JSON",Q.errors.SERVER_ERROR,{body:s,error:l})}return r&&(a=r(a,o)),a},i=null;if(e!=null){i=_t(e);const s=typeof t=="string"?{url:t}:Or(t);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=Or(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},t=s}return IK(t,i,n)}function df(t,e){return e||(e={}),e=Or(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&n(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function c(){return t().then(function(f){if(f!==void 0)o()&&r(f);else if(e.oncePoll)e.oncePoll.once("poll",c);else if(e.onceBlock)e.onceBlock.once("block",c);else if(!s){if(l++,l>a){o()&&n(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(c,u)}return null},function(f){o()&&n(f)})}c()})}var p0="qpzry9x8gf2tvdw0s3jn54khce6mua7l",nm={};for(var Td=0;Td>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function w_(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Wl(e)^n>>5}for(e=Wl(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=w_(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Wl(n)^o,i+=p0.charAt(o)}for(s=0;s<6;++s)n=Wl(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=p0.charAt(a)}return i}function E_(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=w_(s);if(typeof a=="string")return a;for(var l=[],c=0;c=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:l}}function MK(){var t=E_.apply(null,arguments);if(typeof t=="object")return t}function NK(t){var e=E_.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function C1(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<this.data(u,!0);return e.transaction={hash:o,type:c,accessList:be.allowNull(this.accessList.bind(this),null),blockHash:be.allowNull(o,null),blockNumber:be.allowNull(l,null),transactionIndex:be.allowNull(l,null),confirmations:be.allowNull(l,null),from:r,gasPrice:be.allowNull(n),maxPriorityFeePerGas:be.allowNull(n),maxFeePerGas:be.allowNull(n),gasLimit:n,to:be.allowNull(r,null),value:n,nonce:l,data:s,r:be.allowNull(this.uint256),s:be.allowNull(this.uint256),v:be.allowNull(l),creates:be.allowNull(r,null),raw:be.allowNull(s)},e.transactionRequest={from:be.allowNull(r),nonce:be.allowNull(l),gasLimit:be.allowNull(n),gasPrice:be.allowNull(n),maxPriorityFeePerGas:be.allowNull(n),maxFeePerGas:be.allowNull(n),to:be.allowNull(r),value:be.allowNull(n),data:be.allowNull(f),type:be.allowNull(l),accessList:be.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:r,topics:be.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:be.allowNull(this.address,null),from:be.allowNull(this.address,null),contractAddress:be.allowNull(r,null),transactionIndex:l,root:be.allowNull(a),gasUsed:n,logsBloom:be.allowNull(s),blockHash:o,transactionHash:o,logs:be.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:be.allowNull(l,null),cumulativeGasUsed:n,effectiveGasPrice:be.allowNull(n),status:be.allowNull(l),type:c},e.block={hash:be.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:be.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:be.allowNull(r),extraData:s,transactions:be.allowNull(be.arrayOf(o)),baseFeePerGas:be.allowNull(n)},e.blockWithTransactions=Or(e.block),e.blockWithTransactions.transactions=be.allowNull(be.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:be.allowNull(i,void 0),toBlock:be.allowNull(i,void 0),blockHash:be.allowNull(o,void 0),address:be.allowNull(r,void 0),topics:be.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:be.allowNull(l),blockHash:be.allowNull(o),transactionIndex:l,removed:be.allowNull(this.boolean.bind(this)),address:r,data:be.allowFalsish(s,"0x"),topics:be.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Ic(e||[])}number(e){return e==="0x"?0:ce.from(e).toNumber()}type(e){return e==="0x"||e==null?0:ce.from(e).toNumber()}bigNumber(e){return ce.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),et(e))?e.toLowerCase():Zc.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return ir(e)}callAddress(e){if(!et(e,32))return null;const r=ir(Pr(e,12));return r===Sx?null:r}contractAddress(e){return d7(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||et(e))return gx(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return Ua(n)!==32?Zc.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=ce.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!et(e))throw new Error("invalid uint256");return Vt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=be.check(r,e);return i._difficulty=n==null?null:ce.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return be.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&ce.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=be.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;et(n)&&(n=ce.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),et(n)&&(n=ce.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return LG(e)}receiptLog(e){return be.check(this.formats.receiptLog,e)}receipt(e){const r=be.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=ce.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&Zc.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):Zc.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&Zc.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return be.check(this.formats.filter,e)}filterLog(e){return be.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const s=e[i](r[i]);s!==void 0&&(n[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=r[i],s}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}var $e=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const ze=new Q($x),BK=10;function Fk(t){return t==null?"null":(Ua(t)!==32&&ze.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Bk(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Fk(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Fk(e)}).join("&")}function UK(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function ul(t){if(typeof t=="string"){if(t=t.toLowerCase(),Ua(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Bk(t);if(UH.isForkEvent(t))throw ze.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Bk(t.topics||[])}throw new Error("invalid event - "+t)}function ef(){return new Date().getTime()}function Uk(t){return new Promise(e=>{setTimeout(e,t)})}const zK=["block","network","pending","poll"];let VK=class{constructor(e,r,n){ie(this,"tag",e),ie(this,"listener",r),ie(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=UK(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||zK.indexOf(this.tag)>=0}};const qK={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Qv(t){return Vt(ce.from(t).toHexString(),32)}function zk(t){return uu.encode(wr([t,Pr(Wa(Wa(t)),0,4)]))}const S_=new RegExp("^(ipfs)://(.*)$","i"),Vk=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),S_,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function uh(t,e){try{return Uu(vu(t,e))}catch{}return null}function vu(t,e){if(t==="0x")return null;const r=ce.from(Pr(t,e,e+32)).toNumber(),n=ce.from(Pr(t,r,r+32)).toNumber();return Pr(t,r+32,r+32+n)}function Jv(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):ze.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function qk(t){const e=de(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 HK(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function k_(t){const e=[];let r=0;for(let n=0;nce.from(e).eq(1)).catch(e=>{if(e.code===Q.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return $e(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:En([e,oh(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=En(["0x9061b923",k_([kH(this.name),n.data])]));try{let s=yield this.provider.call(n);return de(s).length%32===4&&ze.throwError("resolver threw error",Q.errors.CALL_EXCEPTION,{transaction:n,data:s}),i&&(s=vu(s,0)),s}catch(s){if(s.code===Q.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,r){return $e(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?vu(n,0):null})}_getAddress(e,r){const n=qK[String(e)];if(n==null&&ze.throwError(`unsupported coin type: ${e}`,Q.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=de(r);if(n.p2pkh!=null){const s=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return zk(wr([[n.p2pkh],"0x"+s[2]]))}}if(n.p2sh!=null){const s=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return zk(wr([[n.p2sh],"0x"+s[2]]))}}if(n.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=jk.toWords(i.slice(2));return a.unshift(o),jk.encode(n.prefix,a)}}return null}getAddress(e){return $e(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===zq?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===Q.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Qv(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&ze.throwError("invalid or unsupported coin data",Q.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return $e(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;no[l])}return ze.throwError("invalid or unsupported content hash data",Q.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return $e(this,void 0,void 0,function*(){let r=_t(e);r=wr([Qv(64),Qv(r.length),r]),r.length%32!==0&&(r=wr([r,Vt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",he(r));return n==null||n==="0x"?null:Uu(n)})}}let Xv=null,WK=1;class GK extends zu{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ie(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=is(new.target,"getNetwork")(e);r?(ie(this,"_network",r),this.emit("network",r,null)):ze.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return $e(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||ze.throwError("no network detected",Q.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:ie(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return df(()=>this._ready().then(e=>e,e=>{if(!(e.code===Q.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Xv==null&&(Xv=new be),Xv}static getNetwork(e){return AK(e??"homestead")}ccipReadFetch(e,r,n){return $e(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield Nx({url:c,errorPassThrough:!0},f,(h,p)=>(h.status=p.statusCode,h));if(u.data)return u.data;const d=u.message||"unknown error";if(u.status>=400&&u.status<500)return ze.throwError(`response not found during CCIP fetch: ${d}`,Q.errors.SERVER_ERROR,{url:l,errorMessage:d});o.push(d)}return ze.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,Q.errors.SERVER_ERROR,{urls:n,errorMessages:o})})}_getInternalBlockNumber(e){return $e(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(ef()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ef(),n=pr({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),s;const o=ef();return i=ce.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return $e(this,void 0,void 0,function*(){const e=WK++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)ze.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",ze.makeError("network block skew detected",Q.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&n-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});r.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=n;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(c=>{c.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=c.blockNumber),this._emitted["b:"+c.blockHash]=c.blockNumber,this._emitted["t:"+c.transactionHash]=c.blockNumber,this.emit(s,c)})}).catch(l=>{this.emit("error",l),i._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return $e(this,void 0,void 0,function*(){return ze.throwError("provider does not support network detection",Q.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return $e(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Uk(0),this._network;const n=ze.makeError("underlying network changed",Q.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ef();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return $e(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return $e(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=r?s:new Promise((o,a)=>{const l=[];let c=!1;const f=function(){return c?!0:(c=!0,l.forEach(d=>{d()}),!1)},u=d=>{d.confirmations{this.removeListener(e,u)}),i){let d=i.startBlock,h=null;const p=m=>$e(this,void 0,void 0,function*(){c||(yield Uk(1e3),this.getTransactionCount(i.from).then(x=>$e(this,void 0,void 0,function*(){if(!c){if(x<=i.nonce)d=m;else{{const b=yield this.getTransaction(e);if(b&&b.blockNumber!=null)return}for(h==null&&(h=d-3,h{c||this.once("block",p)}))});if(c)return;this.once("block",p),l.push(()=>{this.removeListener("block",p)})}if(typeof n=="number"&&n>0){const d=setTimeout(()=>{f()||a(ze.makeError("timeout exceeded",Q.errors.TIMEOUT,{timeout:n}))},n);d.unref&&d.unref(),l.push(()=>{clearTimeout(d)})}})})}getBlockNumber(){return $e(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return ce.from(e)}catch(r){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield pr({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return ce.from(i)}catch(s){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:s})}})}getTransactionCount(e,r){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield pr({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return ce.from(i).toNumber()}catch(s){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:s})}})}getCode(e,r){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield pr({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return he(i)}catch(s){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:s})}})}getStorageAt(e,r,n){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield pr({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(o=>gx(o))}),s=yield this.perform("getStorageAt",i);try{return he(s)}catch(o){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,r,n){if(r!=null&&Ua(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&ze.throwError("Transaction hash mismatch from Provider.sendTransaction.",Q.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(s,o)=>$e(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&n!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&ze.throwError("transaction failed",Q.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(s=>he(s)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,s,i)}catch(s){throw s.transaction=n,s.transactionHash=n.hash,s}})}_getTransactionRequest(e){return $e(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?ce.from(s):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?he(s):null))}),this.formatter.transactionRequest(yield pr(n))})}_getFilter(e){return $e(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield pr(r))})}_call(e,r,n){return $e(this,void 0,void 0,function*(){n>=BK&&ze.throwError("CCIP read exceeded maximum redirections",Q.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&Ua(s)%32===4)try{const o=Pr(s,4),a=Pr(o,0,32);ce.from(a).eq(i)||ze.throwError("CCIP Read sender did not match",Q.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],c=ce.from(Pr(o,32,64)).toNumber(),f=ce.from(Pr(o,c,c+32)).toNumber(),u=Pr(o,c+32);for(let b=0;b$e(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return df(()=>$e(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return df(()=>$e(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield pr({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),be.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return $e(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return $e(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&ze.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return $e(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new Hk(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return $e(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||ze.throwError("network does not support ENS",Q.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+oh(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return $e(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(et(e))throw n}typeof e!="string"&&ze.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return $e(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=uh(yield this.call({to:n,data:"0x691f3431"+oh(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return $e(this,void 0,void 0,function*(){let r=null;if(et(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;r=new Hk(this,o,s);try{const a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==Q.errors.CALL_EXCEPTION)throw a}try{const a=uh(yield this.call({to:o,data:"0x691f3431"+oh(s).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==Q.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return ze.throwError(e+" not implemented",Q.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new VK(ul(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],s=ul(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,r)},0),n=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),n}listenerCount(e){if(!e)return this._events.length;let r=ul(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=ul(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,s=ul(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=r||i?!0:(i=!0,n.push(o),!1)),n.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=ul(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var Ps=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const Ar=new Q($x),KK=["call","estimateGas"];function Rf(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=et(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Rf(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Rf(JSON.parse(t),e)}catch{}return null}function A_(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const s=Rf(e,!0);if(s)return s.data;Ar.throwError("missing revert data in call exception; Transaction reverted without a reason string",Q.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let s=Rf(e.body,!1);s==null&&(s=Rf(e,!1)),s&&Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Q.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===Q.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Ar.throwError("insufficient funds for intrinsic transaction cost",Q.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&Ar.throwError("nonce has already been used",Q.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Ar.throwError("replacement fee too low",Q.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&Ar.throwError("legacy pre-eip-155 transactions not supported",Q.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),KK.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Q.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Wk(t){return new Promise(function(e){setTimeout(e,t)})}function YK(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function tf(t){return t&&t.toLowerCase()}const im={};class C_ extends Cc{constructor(e,r,n){if(super(),e!==im)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ie(this,"provider",r),n==null&&(n=0),typeof n=="string"?(ie(this,"_address",this.provider.formatter.address(n)),ie(this,"_index",null)):typeof n=="number"?(ie(this,"_index",n),ie(this,"_address",null)):Ar.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return Ar.throwError("cannot alter JSON-RPC Signer connection",Q.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new QK(im,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Ar.throwError("unknown account #"+this._index,Q.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=Or(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=Or(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>Ps(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),pr({tx:pr(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&Ar.throwArgumentError("from address mismatch","transaction",e):n.from=i;const s=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&Ar.throwError("user rejected transaction",Q.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),A_("sendTransaction",o,s)))})}signTransaction(e){return Ar.throwError("signing transactions is unsupported",Q.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Ps(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield df(()=>Ps(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return Ps(this,void 0,void 0,function*(){const r=typeof e=="string"?_t(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[he(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&Ar.throwError("user rejected signing",Q.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return Ps(this,void 0,void 0,function*(){const r=typeof e=="string"?_t(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),he(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&Ar.throwError("user rejected signing",Q.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return Ps(this,void 0,void 0,function*(){const i=yield hn.resolveNames(e,r,n,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(hn.getPayload(i.domain,r,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&Ar.throwError("user rejected signing",Q.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:r,value:i.value}}),o}})}unlock(e){return Ps(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class QK extends C_{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const JK={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};let __=class extends GK{constructor(e,r){let n=r;n==null&&(n=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(n),e||(e=is(this.constructor,"defaultUrl")()),typeof e=="string"?ie(this,"connection",Object.freeze({url:e})):ie(this,"connection",Object.freeze(Or(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Ps(this,void 0,void 0,function*(){yield Wk(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=is(this.constructor,"getNetwork");try{return r(ce.from(e).toNumber())}catch(n){return Ar.throwError("could not detect network",Q.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return Ar.throwError("could not detect network",Q.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new C_(im,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:za(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Nx(this.connection,JSON.stringify(n),YK).then(o=>(this.emit("debug",{action:"response",request:n,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:n,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[tf(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[tf(r.address),r.blockTag]];case"getCode":return["eth_getCode",[tf(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[tf(r.address),Vt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[is(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[is(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=tf(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return Ps(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&ce.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=Or(r),r.transaction=Or(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&Ar.throwError(e+" not implemented",Q.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return A_(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(s){if(e._pendingFilter!=r)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return Wk(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=Or(JK);if(r)for(const s in r)r[s]&&(n[s]=!0);i7(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=gx(ce.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=he(e[s]))}),e.accessList&&(i.accessList=Ic(e.accessList)),i}};const XK="units/5.7.0",ZK=new Q(XK),T_=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Dx(t,e){if(typeof e=="string"){const r=T_.indexOf(e);r!==-1&&(e=3*r)}return ih(t,e??18)}function pu(t,e){if(typeof t!="string"&&ZK.throwArgumentError("value must be a string","value",t),typeof e=="string"){const r=T_.indexOf(e);r!==-1&&(e=3*r)}return Gi(t,e??18)}function eY(t){return Dx(t,18)}function Gk(t){return pu(t,18)}const tY="1.10.11";function rY(t){var e="";return r(t),e;function r(i){if(i===null||typeof i!="object"||i.toJSON!=null)e+=JSON.stringify(i);else if(Array.isArray(i)){e+="[";var s=!1;i.forEach(function(a){s&&(e+=","),s=!0,a===void 0&&(a=null),r(a)}),e+="]"}else{e+="{";var o=Object.keys(i).filter(function(a){return i[a]!==void 0}).sort();o.forEach(function(a,l){return n(i,a,l)}),e+="}"}}function n(i,s,o){o>0&&(e+=","),e+=JSON.stringify(s),e+=":",r(i[s])}}let J=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.HARDHAT=31337]="HARDHAT",t[t.HARDHAT_2=31338]="HARDHAT_2",t}({}),Ue=function(t){return t.MAINNET="mainnet",t.TESTNET="testnet",t}({});const y0={[J.MAINNET]:{chainId:J.MAINNET,type:Ue.MAINNET,name:"mainnet",title:"Ethereum",logoURI:`https://assets.sequence.info/images/networks/medium/${J.MAINNET}.webp`,blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[J.ROPSTEN]:{chainId:J.ROPSTEN,type:Ue.TESTNET,name:"ropsten",title:"Ropsten",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.RINKEBY]:{chainId:J.RINKEBY,type:Ue.TESTNET,name:"rinkeby",title:"Rinkeby",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.GOERLI]:{chainId:J.GOERLI,type:Ue.TESTNET,name:"goerli",title:"Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.KOVAN]:{chainId:J.KOVAN,type:Ue.TESTNET,name:"kovan",title:"Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${J.KOVAN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"},nativeToken:{symbol:"kETH",name:"Kovan Ether",decimals:18},deprecated:!0},[J.SEPOLIA]:{chainId:J.SEPOLIA,type:Ue.TESTNET,name:"sepolia",title:"Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Sepolia)",rootUrl:"https://sepolia.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.POLYGON]:{chainId:J.POLYGON,type:Ue.MAINNET,name:"polygon",title:"Polygon",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON}.webp`,blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"},nativeToken:{symbol:"MATIC",name:"Polygon",decimals:18}},[J.POLYGON_MUMBAI]:{chainId:J.POLYGON_MUMBAI,type:Ue.TESTNET,name:"mumbai",title:"Polygon Mumbai",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON_MUMBAI}.webp`,testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"},nativeToken:{symbol:"mMATIC",name:"Mumbai Polygon",decimals:18},deprecated:!0},[J.POLYGON_AMOY]:{chainId:J.POLYGON_AMOY,type:Ue.TESTNET,name:"amoy",title:"Polygon Amoy",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON_AMOY}.webp`,testnet:!0,blockExplorer:{name:"OKLink (Amoy)",rootUrl:"https://www.oklink.com/amoy/"},nativeToken:{symbol:"aMATIC",name:"Amoy Polygon",decimals:18}},[J.POLYGON_ZKEVM]:{chainId:J.POLYGON_ZKEVM,type:Ue.MAINNET,name:"polygon-zkevm",title:"Polygon zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON_ZKEVM}.webp`,blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.BSC]:{chainId:J.BSC,type:Ue.MAINNET,name:"bsc",title:"BNB Smart Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BSC}.webp`,blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"},nativeToken:{symbol:"BNB",name:"BNB",decimals:18}},[J.BSC_TESTNET]:{chainId:J.BSC_TESTNET,type:Ue.TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BSC_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"},nativeToken:{symbol:"tBNB",name:"Testnet BNB",decimals:18}},[J.OPTIMISM]:{chainId:J.OPTIMISM,type:Ue.MAINNET,name:"optimism",title:"Optimism",logoURI:`https://assets.sequence.info/images/networks/medium/${J.OPTIMISM}.webp`,blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.OPTIMISM_KOVAN]:{chainId:J.OPTIMISM_KOVAN,type:Ue.TESTNET,name:"optimism-kovan",title:"Optimism Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.OPTIMISM_GOERLI]:{chainId:J.OPTIMISM_GOERLI,type:Ue.TESTNET,name:"optimism-goerli",title:"Optimism Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.OPTIMISM_SEPOLIA]:{chainId:J.OPTIMISM_SEPOLIA,type:Ue.TESTNET,name:"optimism-sepolia",title:"Optimism Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.OPTIMISM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Sepolia)",rootUrl:"https://sepolia-optimistic.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.ARBITRUM]:{chainId:J.ARBITRUM,type:Ue.MAINNET,name:"arbitrum",title:"Arbitrum One",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ARBITRUM}.webp`,blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.ARBITRUM_GOERLI]:{chainId:J.ARBITRUM_GOERLI,type:Ue.TESTNET,name:"arbitrum-goerli",title:"Arbitrum Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.ARBITRUM_SEPOLIA]:{chainId:J.ARBITRUM_SEPOLIA,type:Ue.TESTNET,name:"arbitrum-sepolia",title:"Arbitrum Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ARBITRUM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Arbiscan (Sepolia Testnet)",rootUrl:"https://sepolia.arbiscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.ARBITRUM_NOVA]:{chainId:J.ARBITRUM_NOVA,type:Ue.MAINNET,name:"arbitrum-nova",title:"Arbitrum Nova",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ARBITRUM_NOVA}.webp`,blockExplorer:{name:"Arbiscan Nova",rootUrl:"https://nova.arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.AVALANCHE]:{chainId:J.AVALANCHE,type:Ue.MAINNET,name:"avalanche",title:"Avalanche",logoURI:`https://assets.sequence.info/images/networks/medium/${J.AVALANCHE}.webp`,blockExplorer:{name:"Snowtrace",rootUrl:"https://subnets.avax.network/c-chain/"},nativeToken:{symbol:"AVAX",name:"AVAX",decimals:18}},[J.AVALANCHE_TESTNET]:{chainId:J.AVALANCHE_TESTNET,type:Ue.TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.GNOSIS]:{chainId:J.GNOSIS,type:Ue.MAINNET,name:"gnosis",title:"Gnosis Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${J.GNOSIS}.webp`,blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"},nativeToken:{symbol:"XDAI",name:"XDAI",decimals:18}},[J.BASE]:{chainId:J.BASE,type:Ue.MAINNET,name:"base",title:"Base (Coinbase)",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BASE}.webp`,blockExplorer:{name:"Base Explorer",rootUrl:"https://basescan.org/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.BASE_GOERLI]:{chainId:J.BASE_GOERLI,type:Ue.TESTNET,name:"base-goerli",title:"Base Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.BASE_SEPOLIA]:{chainId:J.BASE_SEPOLIA,type:Ue.TESTNET,name:"base-sepolia",title:"Base Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BASE_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Base Sepolia Explorer",rootUrl:"https://base-sepolia.blockscout.com/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.HOMEVERSE]:{chainId:J.HOMEVERSE,type:Ue.MAINNET,name:"homeverse",title:"Oasys Homeverse",logoURI:`https://assets.sequence.info/images/networks/medium/${J.HOMEVERSE}.webp`,blockExplorer:{name:"Oasys Homeverse Explorer",rootUrl:"https://explorer.oasys.homeverse.games/"},nativeToken:{symbol:"OAS",name:"OAS",decimals:18}},[J.HOMEVERSE_TESTNET]:{chainId:J.HOMEVERSE_TESTNET,type:Ue.TESTNET,name:"homeverse-testnet",title:"Oasys Homeverse Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.XAI]:{chainId:J.XAI,type:Ue.MAINNET,name:"xai",title:"Xai",logoURI:`https://assets.sequence.info/images/networks/medium/${J.XAI}.webp`,blockExplorer:{name:"Xai Explorer",rootUrl:"https://explorer.xai-chain.net/"},nativeToken:{symbol:"XAI",name:"XAI",decimals:18}},[J.XAI_SEPOLIA]:{chainId:J.XAI_SEPOLIA,type:Ue.TESTNET,name:"xai-sepolia",title:"Xai Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.ASTAR_ZKEVM]:{chainId:J.ASTAR_ZKEVM,type:Ue.MAINNET,name:"astar-zkevm",title:"Astar zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ASTAR_ZKEVM}.webp`,blockExplorer:{name:"Astar zkEVM Explorer",rootUrl:"https://astar-zkevm.explorer.startale.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.ASTAR_ZKYOTO]:{chainId:J.ASTAR_ZKYOTO,type:Ue.TESTNET,name:"astar-zkyoto",title:"Astar zKyoto Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ASTAR_ZKYOTO}.webp`,testnet:!0,blockExplorer:{name:"Astar zKyoto Explorer",rootUrl:"https://astar-zkyoto.blockscout.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.XR_SEPOLIA]:{chainId:J.XR_SEPOLIA,type:Ue.TESTNET,name:"xr-sepolia",title:"XR Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.B3_SEPOLIA]:{chainId:J.B3_SEPOLIA,type:Ue.TESTNET,name:"b3-sepolia",title:"B3 Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.B3_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"B3 Sepolia Explorer",rootUrl:"https://sepolia.explorer.b3.fun/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.APECHAIN_TESTNET]:{chainId:J.APECHAIN_TESTNET,type:Ue.TESTNET,name:"apechain-testnet",title:"APE Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.APECHAIN_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"APE Chain Explorer",rootUrl:"https://curtis.explorer.caldera.xyz/"},nativeToken:{symbol:"APE",name:"ApeCoin",decimals:18}},[J.BLAST]:{chainId:J.BLAST,type:Ue.MAINNET,name:"blast",title:"Blast",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BLAST}.webp`,blockExplorer:{name:"Blast Explorer",rootUrl:"https://blastscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.BLAST_SEPOLIA]:{chainId:J.BLAST_SEPOLIA,type:Ue.TESTNET,name:"blast-sepolia",title:"Blast Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BLAST_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Blast Sepolia Explorer",rootUrl:"https://sepolia.blastexplorer.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.TELOS]:{chainId:J.TELOS,type:Ue.MAINNET,name:"telos",title:"Telos",logoURI:`https://assets.sequence.info/images/networks/medium/${J.TELOS}.webp`,blockExplorer:{name:"Telos Explorer",rootUrl:"https://explorer.telos.net/network/"},nativeToken:{symbol:"TLOS",name:"TLOS",decimals:18}},[J.HARDHAT]:{chainId:J.HARDHAT,name:"hardhat",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.HARDHAT_2]:{chainId:J.HARDHAT_2,name:"hardhat2",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}}};function sm(){return sm=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 i=n.map(c=>c.chainId).sort(),s=i.filter((c,f)=>i.indexOf(c)!==f);if(s.length>0){if(e)throw new Error(`invalid network config: duplicate chainIds ${s}`);return!1}n.forEach(c=>c.name=c.name.toLowerCase());const o=n.map(c=>c.name).sort(),a=o.filter((c,f)=>o.indexOf(c)!==f);if(a.length>0){if(e)throw new Error(`invalid network config: duplicate network names ${a}`);return!1}let l=!1;for(let c=0;c(iY(t,!0,e),t),oY=t=>sY(lY(t)),aY=(t,e)=>{if(typeof e=="string")if(e.startsWith("0x")){const r=ce.from(e).toNumber();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(ce.isBigNumber(e)){const r=e.toNumber();return t.find(n=>n.chainId===r)}else return}},lY=t=>{if(!t)return[];const e=t.sort((n,i)=>n.chainId===i.chainId?0:n.chainIdn.isDefaultChain);return r>0&&e.splice(0,0,e.splice(r,1)[0]),e},Lx=(t,e)=>typeof t=="string"?(e=e||{},t.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,function(r,n){let i=e[n];return typeof i=="function"?i=i():i==null?i="":typeof i=="object"||typeof i=="symbol"?i=i.toString():i=i.valueOf(),i})):"",P_=t=>Lx("https://${network}-indexer.sequence.app",{network:t}),cY=t=>Lx("https://${network}-relayer.sequence.app",{network:t}),fY=t=>Lx("https://nodes.sequence.app/${network}",{network:t});function Kk(t){return aY(dY,t)}const nt=(t,e)=>{const r=y0[t];if(!r)throw new Error(`Network with chainId ${t} not found`);const n=fY(r.name);return uc({},r,{rpcUrl:n,indexerUrl:P_(r.name),relayer:{url:cY(r.name),provider:{url:n}}},e)},uY=[uc({},y0[J.HARDHAT],{rpcUrl:"http://localhost:8545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:8545"}}}),uc({},y0[J.HARDHAT_2],{rpcUrl:"http://localhost:9545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:9545"}}})],dY=oY([uc({},nt(J.POLYGON),{isDefaultChain:!0,isAuthChain:!0}),nt(J.MAINNET),nt(J.BSC),nt(J.AVALANCHE),nt(J.ARBITRUM),nt(J.ARBITRUM_NOVA),nt(J.OPTIMISM),nt(J.OPTIMISM_SEPOLIA),nt(J.POLYGON_ZKEVM),nt(J.GNOSIS),nt(J.RINKEBY,{disabled:!0}),nt(J.GOERLI,{disabled:!0}),nt(J.SEPOLIA),nt(J.POLYGON_MUMBAI,{disabled:!0}),nt(J.POLYGON_AMOY),nt(J.BSC_TESTNET),nt(J.ARBITRUM_SEPOLIA),nt(J.BASE),nt(J.BASE_SEPOLIA),nt(J.HOMEVERSE),nt(J.HOMEVERSE_TESTNET),nt(J.XAI),nt(J.XAI_SEPOLIA),nt(J.AVALANCHE_TESTNET),nt(J.ASTAR_ZKEVM),nt(J.ASTAR_ZKYOTO),nt(J.XR_SEPOLIA),nt(J.B3_SEPOLIA),nt(J.APECHAIN_TESTNET),nt(J.BLAST),nt(J.BLAST_SEPOLIA),nt(J.TELOS),...uY]),hY=(t,e)=>e.some(r=>t instanceof r);let Yk,Qk;function vY(){return Yk||(Yk=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function pY(){return Qk||(Qk=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const R_=new WeakMap,om=new WeakMap,I_=new WeakMap,Zv=new WeakMap,jx=new WeakMap;function yY(t){const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{r(Fo(t.result)),i()},o=()=>{n(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(r=>{r instanceof IDBCursor&&R_.set(r,t)}).catch(()=>{}),jx.set(e,t),e}function mY(t){if(om.has(t))return;const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{r(),i()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});om.set(t,e)}let am={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return om.get(t);if(e==="objectStoreNames")return t.objectStoreNames||I_.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Fo(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 gY(t){am=t(am)}function xY(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){const n=t.call(ep(this),e,...r);return I_.set(n,e.sort?e.sort():[e]),Fo(n)}:pY().includes(t)?function(...e){return t.apply(ep(this),e),Fo(R_.get(this))}:function(...e){return Fo(t.apply(ep(this),e))}}function bY(t){return typeof t=="function"?xY(t):(t instanceof IDBTransaction&&mY(t),hY(t,vY())?new Proxy(t,am):t)}function Fo(t){if(t instanceof IDBRequest)return yY(t);if(Zv.has(t))return Zv.get(t);const e=bY(t);return e!==t&&(Zv.set(t,e),jx.set(e,t)),e}const ep=t=>jx.get(t);function wY(t,e,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Fo(o);return n&&o.addEventListener("upgradeneeded",l=>{n(Fo(o.result),l.oldVersion,l.newVersion,Fo(o.transaction),l)}),r&&o.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const EY=["get","getKey","getAll","getAllKeys","count"],SY=["put","add","delete","clear"],tp=new Map;function Jk(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(tp.get(e))return tp.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,i=SY.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||EY.includes(r)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let c=l.store;return n&&(c=c.index(a.shift())),(await Promise.all([c[r](...a),i&&l.done]))[0]};return tp.set(e,s),s}gY(t=>({...t,get:(e,r,n)=>Jk(e,r)||t.get(e,r,n),has:(e,r)=>!!Jk(e,r)||t.has(e,r)}));const kY=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},AY=t=>({httpHandler:t.httpHandler()});var Xk;(function(t){t.HEADER="header",t.QUERY="query"})(Xk||(Xk={}));var Zk;(function(t){t.HEADER="header",t.QUERY="query"})(Zk||(Zk={}));var yu;(function(t){t.HTTP="http",t.HTTPS="https"})(yu||(yu={}));var m0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(m0||(m0={}));var eA;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(eA||(eA={}));const lm="__smithy_context";var tA;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(tA||(tA={}));var rA;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(rA||(rA={}));class Yn{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 Yn({...e,headers:{...e.headers}});return r.query&&(r.query=CY(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 Yn.clone(this)}}function CY(t){return Object.keys(t).reduce((e,r)=>{const n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}class g0{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 _Y=t=>e=>async r=>{if(!Yn.isInstance(r.request))return e(r);const{request:n}=r,{handlerProtocol:i=""}=t.requestHandler.metadata||{};if(i.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 s=n.hostname;n.port!=null&&(s+=`:${n.port}`),n.headers.host=s}return e(r)},TY={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},PY=t=>({applyToStack:e=>{e.add(_Y(t),TY)}}),RY=()=>(t,e)=>async r=>{var n,i;try{const s=await t(r),{clientName:o,commandName:a,logger:l,dynamoDbDocumentClientOptions:c={}}=e,{overrideInputFilterSensitiveLog:f,overrideOutputFilterSensitiveLog:u}=c,d=f??e.inputFilterSensitiveLog,h=u??e.outputFilterSensitiveLog,{$metadata:p,...m}=s.output;return(n=l==null?void 0:l.info)==null||n.call(l,{clientName:o,commandName:a,input:d(r.input),output:h(m),metadata:p}),s}catch(s){const{clientName:o,commandName:a,logger:l,dynamoDbDocumentClientOptions:c={}}=e,{overrideInputFilterSensitiveLog:f}=c,u=f??e.inputFilterSensitiveLog;throw(i=l==null?void 0:l.error)==null||i.call(l,{clientName:o,commandName:a,input:u(r.input),error:s,metadata:s.$metadata}),s}},IY={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},OY=t=>({applyToStack:e=>{e.add(RY(),IY)}}),nA="X-Amzn-Trace-Id",MY="AWS_LAMBDA_FUNCTION_NAME",NY="_X_AMZN_TRACE_ID",$Y=t=>e=>async r=>{const{request:n}=r;if(!Yn.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(nA))return e(r);const i=process.env[MY],s=process.env[NY],o=a=>typeof a=="string"&&a.length>0;return o(i)&&o(s)&&(n.headers[nA]=s),e({...r,request:n})},DY={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},LY=t=>({applyToStack:e=>{e.add($Y(t),DY)}});function jY(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}const FY=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}$"),O_=t=>FY.test(t)||t.startsWith("[")&&t.endsWith("]"),BY=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Fx=(t,e=!1)=>{if(!e)return BY.test(t);const r=t.split(".");for(const n of r)if(!Fx(n))return!1;return!0},x0={},mu="endpoints";function Qo(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Qo(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Qo).join(", ")})`:JSON.stringify(t,null,2)}class Qn extends Error{constructor(e){super(e),this.name="EndpointError"}}const UY=(t,e)=>t===e,zY=t=>{const e=t.split("."),r=[];for(const n of e){const i=n.indexOf("[");if(i!==-1){if(n.indexOf("]")!==n.length-1)throw new Qn(`Path: '${t}' does not end with ']'`);const s=n.slice(i+1,-1);if(Number.isNaN(parseInt(s)))throw new Qn(`Invalid array index: '${s}' in path: '${t}'`);i!==0&&r.push(n.slice(0,i)),r.push(s)}else r.push(n)}return r},M_=(t,e)=>zY(e).reduce((r,n)=>{if(typeof r!="object")throw new Qn(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t),VY=t=>t!=null,qY=t=>!t,rp={[yu.HTTP]:80,[yu.HTTPS]:443},HY=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:m="",query:x={}}=t,b=new URL(`${p}//${d}${h?`:${h}`:""}${m}`);return b.search=Object.entries(x).map(([w,E])=>`${w}=${E}`).join("&"),b}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:i,pathname:s,protocol:o,search:a}=e;if(a)return null;const l=o.slice(0,-1);if(!Object.values(yu).includes(l))return null;const c=O_(i),f=r.includes(`${n}:${rp[l]}`)||typeof t=="string"&&t.includes(`${n}:${rp[l]}`),u=`${n}${f?`:${rp[l]}`:""}`;return{scheme:l,authority:u,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:c}},WY=(t,e)=>t===e,GY=(t,e,r,n)=>e>=r||t.lengthencodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),YY={booleanEquals:UY,getAttr:M_,isSet:VY,isValidHostLabel:Fx,not:qY,parseURL:HY,stringEquals:WY,substring:GY,uriEncode:KY},N_=(t,e)=>{const r=[],n={...e.endpointParams,...e.referenceRecord};let i=0;for(;i({...e.endpointParams,...e.referenceRecord})[t],_1=(t,e,r)=>{if(typeof t=="string")return N_(t,r);if(t.fn)return $_(t,r);if(t.ref)return QY(t,r);throw new Qn(`'${e}': ${String(t)} is not a string, function or reference.`)},$_=({fn:t,argv:e},r)=>{const n=e.map(s=>["boolean","number"].includes(typeof s)?s:_1(s,"arg",r)),i=t.split(".");return i[0]in x0&&i[1]!=null?x0[i[0]][i[1]](...n):YY[t](...n)},JY=({assign:t,...e},r)=>{var i,s;if(t&&t in r.referenceRecord)throw new Qn(`'${t}' is already defined in Reference Record.`);const n=$_(e,r);return(s=(i=r.logger)==null?void 0:i.debug)==null||s.call(i,`${mu} evaluateCondition: ${Qo(e)} = ${Qo(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}},Bx=(t=[],e)=>{var n,i;const r={};for(const s of t){const{result:o,toAssign:a}=JY(s,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};a&&(r[a.name]=a.value,(i=(n=e.logger)==null?void 0:n.debug)==null||i.call(n,`${mu} assign: ${a.name} := ${Qo(a.value)}`))}return{result:!0,referenceRecord:r}},XY=(t,e)=>Object.entries(t).reduce((r,[n,i])=>({...r,[n]:i.map(s=>{const o=_1(s,"Header value entry",e);if(typeof o!="string")throw new Qn(`Header '${n}' value '${o}' is not a string`);return o})}),{}),D_=(t,e)=>{if(Array.isArray(t))return t.map(r=>D_(r,e));switch(typeof t){case"string":return N_(t,e);case"object":if(t===null)throw new Qn(`Unexpected endpoint property: ${t}`);return L_(t,e);case"boolean":return t;default:throw new Qn(`Unexpected endpoint property type: ${typeof t}`)}},L_=(t,e)=>Object.entries(t).reduce((r,[n,i])=>({...r,[n]:D_(i,e)}),{}),ZY=(t,e)=>{const r=_1(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 Qn(`Endpoint URL must be a string, got ${typeof r}`)},eQ=(t,e)=>{var f,u;const{conditions:r,endpoint:n}=t,{result:i,referenceRecord:s}=Bx(r,e);if(!i)return;const o={...e,referenceRecord:{...e.referenceRecord,...s}},{url:a,properties:l,headers:c}=n;return(u=(f=e.logger)==null?void 0:f.debug)==null||u.call(f,`${mu} Resolving endpoint from template: ${Qo(n)}`),{...c!=null&&{headers:XY(c,o)},...l!=null&&{properties:L_(l,o)},url:ZY(a,o)}},tQ=(t,e)=>{const{conditions:r,error:n}=t,{result:i,referenceRecord:s}=Bx(r,e);if(i)throw new Qn(_1(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...s}}))},rQ=(t,e)=>{const{conditions:r,rules:n}=t,{result:i,referenceRecord:s}=Bx(r,e);if(i)return j_(n,{...e,referenceRecord:{...e.referenceRecord,...s}})},j_=(t,e)=>{for(const r of t)if(r.type==="endpoint"){const n=eQ(r,e);if(n)return n}else if(r.type==="error")tQ(r,e);else if(r.type==="tree"){const n=rQ(r,e);if(n)return n}else throw new Qn(`Unknown endpoint rule: ${r}`);throw new Qn("Rules evaluation failed")},nQ=(t,e)=>{var c,f,u,d,h;const{endpointParams:r,logger:n}=e,{parameters:i,rules:s}=t;(f=(c=e.logger)==null?void 0:c.debug)==null||f.call(c,`${mu} Initial EndpointParams: ${Qo(r)}`);const o=Object.entries(i).filter(([,p])=>p.default!=null).map(([p,m])=>[p,m.default]);if(o.length>0)for(const[p,m]of o)r[p]=r[p]??m;const a=Object.entries(i).filter(([,p])=>p.required).map(([p])=>p);for(const p of a)if(r[p]==null)throw new Qn(`Missing required parameter: '${p}'`);const l=j_(s,{endpointParams:r,logger:n,referenceRecord:{}});if((u=e.endpointParams)!=null&&u.Endpoint)try{const p=new URL(e.endpointParams.Endpoint),{protocol:m,port:x}=p;l.url.protocol=m,l.url.port=x}catch{}return(h=(d=e.logger)==null?void 0:d.debug)==null||h.call(d,`${mu} Resolved endpoint: ${Qo(l)}`),l},F_=(t,e=!1)=>{if(e){for(const r of t.split("."))if(!F_(r))return!1;return!0}return!(!Fx(t)||t.length<3||t.length>63||t!==t.toLowerCase()||O_(t))},iA=":",sA="/",iQ=t=>{const e=t.split(iA);if(e.length<6)return null;const[r,n,i,s,o,...a]=e;if(r!=="arn"||n===""||i===""||a.join(iA)==="")return null;const l=a[0].includes(sA)?a[0].split(sA):a;return{partition:n,service:i,region:s,accountId:o,resourceId:l}},sQ=[{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)\\-\\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)"},"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:{}}],oQ="1.1",aQ={partitions:sQ,version:oQ};let lQ=aQ;const cQ=t=>{const{partitions:e}=lQ;for(const n of e){const{regions:i,outputs:s}=n;for(const[o,a]of Object.entries(i))if(o===t)return{...s,...a}}for(const n of e){const{regionRegex:i,outputs:s}=n;if(new RegExp(i).test(t))return{...s}}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}},B_={isVirtualHostableS3Bucket:F_,parseArn:iQ,partition:cQ};x0.aws=B_;const oA="user-agent",np="x-amz-user-agent",aA=" ",ip="/",fQ=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,uQ=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,lA="-",dQ=t=>(e,r)=>async n=>{var u,d;const{request:i}=n;if(!Yn.isInstance(i))return e(n);const{headers:s}=i,o=((u=r==null?void 0:r.userAgent)==null?void 0:u.map(sp))||[],a=(await t.defaultUserAgentProvider()).map(sp),l=((d=t==null?void 0:t.customUserAgent)==null?void 0:d.map(sp))||[],c=[].concat([...a,...o,...l]).join(aA),f=[...a.filter(h=>h.startsWith("aws-sdk-")),...l].join(aA);return t.runtime!=="browser"?(f&&(s[np]=s[np]?`${s[oA]} ${f}`:f),s[oA]=c):s[np]=c,e({...n,request:i})},sp=t=>{var o;const e=t[0].split(ip).map(a=>a.replace(fQ,lA)).join(ip),r=(o=t[1])==null?void 0:o.replace(uQ,lA),n=e.indexOf(ip),i=e.substring(0,n);let s=e.substring(n+1);return i==="api"&&(s=s.toLowerCase()),[i,s,r].filter(a=>a&&a.length>0).reduce((a,l,c)=>{switch(c){case 0:return l;case 1:return`${a}/${l}`;default:return`${a}#${l}`}},"")},hQ={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},vQ=t=>({applyToStack:e=>{e.add(dQ(t),hQ)}});var cA;(function(t){t.ENV="env",t.CONFIG="shared config entry"})(cA||(cA={}));const pQ=!1,yQ=!1,T1=t=>t[lm]||(t[lm]={}),Bo=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e},U_=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips")),fA=t=>U_(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t,mQ=t=>{const{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return fA(e);const n=await e();return fA(n)},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return U_(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}};function gQ(t){const e=new Map;for(const r of t)e.set(r.schemeId,r);return e}const xQ=(t,e)=>(r,n)=>async i=>{var c;const s=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,i.input)),o=gQ(t.httpAuthSchemes),a=T1(n),l=[];for(const f of s){const u=o.get(f.schemeId);if(!u){l.push(`HttpAuthScheme \`${f.schemeId}\` was not enabled for this service.`);continue}const d=u.identityProvider(await e.identityProviderConfigProvider(t));if(!d){l.push(`HttpAuthScheme \`${f.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:h={},signingProperties:p={}}=((c=f.propertiesExtractor)==null?void 0:c.call(f,t,n))||{};f.identityProperties=Object.assign(f.identityProperties||{},h),f.signingProperties=Object.assign(f.signingProperties||{},p),a.selectedHttpAuthScheme={httpAuthOption:f,identity:await d(f.identityProperties),signer:u.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(l.join(` +`)}static register(e,r){r||(r=e.locale)}}const JG="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo";let Pf=null;function Tk(t){if(Pf==null&&(Pf=JG.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),qu.check(t)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw Pf=null,new Error("BIP39 Wordlist for en (English) FAILED")}class XG extends qu{constructor(){super("en")}getWord(e){return Tk(this),Pf[e]}getWordIndex(e){return Tk(this),Pf.indexOf(e)}}const c_=new XG;qu.register(c_);const em={en:c_},ZG="hdnode/5.7.0",h0=new Q(ZG),eK=ce.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),tK=_t("Bitcoin seed"),Jc=2147483648;function f_(t){return(1<=256)throw new Error("Depth too large!");return Pk(wr([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",he(this.depth),this.parentFingerprint,Vt(he(this.index),4),this.chainCode,this.privateKey!=null?wr(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new ci(cl,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~Jc));const n=new Uint8Array(37);if(e&Jc){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set(de(this.privateKey),1),r&&(r+="'")}else n.set(de(this.publicKey));for(let u=24;u>=0;u-=8)n[33+(u>>3)]=e>>24-u&255;const i=de(d0(du.sha512,this.chainCode,n)),s=i.slice(0,32),o=i.slice(32);let a=null,l=null;this.privateKey?a=Cd(ce.from(s).add(this.privateKey).mod(eK)):l=new Hl(he(s))._addPoint(this.publicKey);let c=r;const f=this.mnemonic;return f&&(c=Object.freeze({phrase:f.phrase,path:r,locale:f.locale||"en"})),new ci(cl,a,l,this.fingerprint,Cd(o),e,this.depth+1,c)}derivePath(e){const r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let n=this;for(let i=0;i=Jc)throw new Error("invalid path index - "+s);n=n._derive(Jc+o)}else if(s.match(/^[0-9]+$/)){const o=parseInt(s);if(o>=Jc)throw new Error("invalid path index - "+s);n=n._derive(o)}else throw new Error("invalid path component - "+s)}return n}static _fromSeed(e,r){const n=de(e);if(n.length<16||n.length>64)throw new Error("invalid seed");const i=de(d0(du.sha512,tK,n));return new ci(cl,Cd(i.slice(0,32)),null,"0x00000000",Cd(i.slice(32)),0,0,r)}static fromMnemonic(e,r,n){return n=Rx(n),e=Ix(u_(e,n),n),ci._fromSeed(nK(e,r),{phrase:e,path:"m",locale:n.locale})}static fromSeed(e){return ci._fromSeed(e,null)}static fromExtendedKey(e){const r=uu.decode(e);(r.length!==82||Pk(r.slice(0,78))!==e)&&h0.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const n=r[4],i=he(r.slice(5,9)),s=parseInt(he(r.slice(9,13)).substring(2),16),o=he(r.slice(13,45)),a=r.slice(45,78);switch(he(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new ci(cl,null,he(a),i,o,s,n,null);case"0x0488ade4":case"0x04358394 ":if(a[0]!==0)break;return new ci(cl,he(a.slice(1)),null,i,o,s,n,null)}return h0.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function nK(t,e){e||(e="");const r=_t("mnemonic"+e,Ko.NFKD);return Px(_t(t,Ko.NFKD),r,2048,64,"sha512")}function u_(t,e){e=Rx(e),h0.checkNormalize();const r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");const n=de(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let c=0;c>3]|=1<<7-i%8),i++}const s=32*r.length/3,o=r.length/3,a=f_(o);if((de(Wa(n.slice(0,s/8)))[0]&a)!==(n[n.length-1]&a))throw new Error("invalid checksum");return he(n.slice(0,s/8))}function Ix(t,e){if(e=Rx(e),t=de(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");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]&rK(8-n)),n+=3);const i=t.length/4,s=de(Wa(t))[0]&f_(i);return r[r.length-1]<<=i,r[r.length-1]|=s>>8-i,e.join(r.map(o=>e.getWord(o)))}const iK="random/5.7.0",tm=new Q(iK);function sK(){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 Rk=sK();let fh=Rk.crypto||Rk.msCrypto;(!fh||!fh.getRandomValues)&&(tm.warn("WARNING: Missing strong random number source"),fh={getRandomValues:function(t){return tm.throwError("no secure random source avaialble",Q.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function uf(t){(t<=0||t>1024||t%1||t!=t)&&tm.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return fh.getRandomValues(e),de(e)}var d_={exports:{}};(function(t,e){(function(r){function n(S){return parseInt(S)===S}function i(S){if(!n(S.length))return!1;for(var g=0;g255)return!1;return!0}function s(S,g){if(S.buffer&&ArrayBuffer.isView(S)&&S.name==="Uint8Array")return g&&(S.slice?S=S.slice():S=Array.prototype.slice.call(S)),S;if(Array.isArray(S)){if(!i(S))throw new Error("Array contains invalid value: "+S);return new Uint8Array(S)}if(n(S.length)&&i(S))return new Uint8Array(S);throw new Error("unsupported array-like object")}function o(S){return new Uint8Array(S)}function a(S,g,R,F,C){(F!=null||C!=null)&&(S.slice?S=S.slice(F,C):S=Array.prototype.slice.call(S,F,C)),g.set(S,R)}var l=function(){function S(R){var F=[],C=0;for(R=encodeURI(R);C191&&B<224?(F.push(String.fromCharCode((B&31)<<6|R[C+1]&63)),C+=2):(F.push(String.fromCharCode((B&15)<<12|(R[C+1]&63)<<6|R[C+2]&63)),C+=3)}return F.join("")}return{toBytes:S,fromBytes:g}}(),c=function(){function S(F){for(var C=[],B=0;B>4]+g[V&15])}return C.join("")}return{toBytes:S,fromBytes:R}}(),f={16:10,24:12,32:14},u=[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],d=[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],h=[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],p=[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],m=[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],x=[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],b=[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],w=[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],E=[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],P=[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],N=[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],I=[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],j=[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],L=[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],U=[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 K(S){for(var g=[],R=0;R>2,this._Ke[B][g%4]=C[g],this._Kd[S-B][g%4]=C[g];for(var V=0,H=F,Z;H>16&255]<<24^d[Z>>8&255]<<16^d[Z&255]<<8^d[Z>>24&255]^u[V]<<24,V+=1,F!=8)for(var g=1;g>8&255]<<8^d[Z>>16&255]<<16^d[Z>>24&255]<<24;for(var g=F/2+1;g>2,ne=H%4,this._Ke[le][ne]=C[g],this._Kd[S-le][ne]=C[g++],H++}for(var le=1;le>24&255]^j[Z>>16&255]^L[Z>>8&255]^U[Z&255]},X.prototype.encrypt=function(S){if(S.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var g=this._Ke.length-1,R=[0,0,0,0],F=K(S),C=0;C<4;C++)F[C]^=this._Ke[0][C];for(var B=1;B>24&255]^m[F[(C+1)%4]>>16&255]^x[F[(C+2)%4]>>8&255]^b[F[(C+3)%4]&255]^this._Ke[B][C];F=R.slice()}for(var V=o(16),H,C=0;C<4;C++)H=this._Ke[g][C],V[4*C]=(d[F[C]>>24&255]^H>>24)&255,V[4*C+1]=(d[F[(C+1)%4]>>16&255]^H>>16)&255,V[4*C+2]=(d[F[(C+2)%4]>>8&255]^H>>8)&255,V[4*C+3]=(d[F[(C+3)%4]&255]^H)&255;return V},X.prototype.decrypt=function(S){if(S.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var g=this._Kd.length-1,R=[0,0,0,0],F=K(S),C=0;C<4;C++)F[C]^=this._Kd[0][C];for(var B=1;B>24&255]^E[F[(C+3)%4]>>16&255]^P[F[(C+2)%4]>>8&255]^N[F[(C+1)%4]&255]^this._Kd[B][C];F=R.slice()}for(var V=o(16),H,C=0;C<4;C++)H=this._Kd[g][C],V[4*C]=(h[F[C]>>24&255]^H>>24)&255,V[4*C+1]=(h[F[(C+3)%4]>>16&255]^H>>16)&255,V[4*C+2]=(h[F[(C+2)%4]>>8&255]^H>>8)&255,V[4*C+3]=(h[F[(C+1)%4]&255]^H)&255;return V};var ee=function(S){if(!(this instanceof ee))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new X(S)};ee.prototype.encrypt=function(S){if(S=s(S),S.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var g=o(S.length),R=o(16),F=0;F=0;--g)this._counter[g]=S%256,S=S>>8},k.prototype.setBytes=function(S){if(S=s(S,!0),S.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=S},k.prototype.increment=function(){for(var S=15;S>=0;S--)if(this._counter[S]===255)this._counter[S]=0;else{this._counter[S]++;break}};var A=function(S,g){if(!(this instanceof A))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",g instanceof k||(g=new k(g)),this._counter=g,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new X(S)};A.prototype.encrypt=function(S){for(var g=s(S,!0),R=0;R16)throw new Error("PKCS#7 padding byte out of range");for(var R=S.length-g,F=0;F=64;){let D=b,S=w,g=E,R=P,F=N,C=I,B=j,V=L,H,Z,le,ne,te;for(Z=0;Z<16;Z++)le=T+Z*4,U[Z]=(A[le]&255)<<24|(A[le+1]&255)<<16|(A[le+2]&255)<<8|A[le+3]&255;for(Z=16;Z<64;Z++)H=U[Z-2],ne=(H>>>17|H<<32-17)^(H>>>19|H<<32-19)^H>>>10,H=U[Z-15],te=(H>>>7|H<<32-7)^(H>>>18|H<<32-18)^H>>>3,U[Z]=(ne+U[Z-7]|0)+(te+U[Z-16]|0)|0;for(Z=0;Z<64;Z++)ne=(((F>>>6|F<<32-6)^(F>>>11|F<<32-11)^(F>>>25|F<<32-25))+(F&C^~F&B)|0)+(V+(x[Z]+U[Z]|0)|0)|0,te=((D>>>2|D<<32-2)^(D>>>13|D<<32-13)^(D>>>22|D<<32-22))+(D&S^D&g^S&g)|0,V=B,B=C,C=F,F=R+ne|0,R=g,g=S,S=D,D=ne+te|0;b=b+D|0,w=w+S|0,E=E+g|0,P=P+R|0,N=N+F|0,I=I+C|0,j=j+B|0,L=L+V|0,T+=64,O-=64}}K(m);let X,ee=m.length%64,M=m.length/536870912|0,v=m.length<<3,_=ee<56?56:120,k=m.slice(m.length-ee,m.length);for(k.push(128),X=ee+1;X<_;X++)k.push(0);return k.push(M>>>24&255),k.push(M>>>16&255),k.push(M>>>8&255),k.push(M>>>0&255),k.push(v>>>24&255),k.push(v>>>16&255),k.push(v>>>8&255),k.push(v>>>0&255),K(k),[b>>>24&255,b>>>16&255,b>>>8&255,b>>>0&255,w>>>24&255,w>>>16&255,w>>>8&255,w>>>0&255,E>>>24&255,E>>>16&255,E>>>8&255,E>>>0&255,P>>>24&255,P>>>16&255,P>>>8&255,P>>>0&255,N>>>24&255,N>>>16&255,N>>>8&255,N>>>0&255,I>>>24&255,I>>>16&255,I>>>8&255,I>>>0&255,j>>>24&255,j>>>16&255,j>>>8&255,j>>>0&255,L>>>24&255,L>>>16&255,L>>>8&255,L>>>0&255]}function s(m,x,b){m=m.length<=64?m:i(m);const w=64+x.length+4,E=new Array(w),P=new Array(64);let N,I=[];for(N=0;N<64;N++)E[N]=54;for(N=0;N=w-4;L--){if(E[L]++,E[L]<=255)return;E[L]=0}}for(;b>=32;)j(),I=I.concat(i(P.concat(i(E)))),b-=32;return b>0&&(j(),I=I.concat(i(P.concat(i(E))).slice(0,b))),I}function o(m,x,b,w,E){let P;for(f(m,(2*b-1)*16,E,0,16),P=0;P<2*b;P++)c(m,P*16,E,16),l(E,w),f(E,0,m,x+P*16,16);for(P=0;P>>32-x}function l(m,x){f(m,0,x,0,16);for(let b=8;b>0;b-=2)x[4]^=a(x[0]+x[12],7),x[8]^=a(x[4]+x[0],9),x[12]^=a(x[8]+x[4],13),x[0]^=a(x[12]+x[8],18),x[9]^=a(x[5]+x[1],7),x[13]^=a(x[9]+x[5],9),x[1]^=a(x[13]+x[9],13),x[5]^=a(x[1]+x[13],18),x[14]^=a(x[10]+x[6],7),x[2]^=a(x[14]+x[10],9),x[6]^=a(x[2]+x[14],13),x[10]^=a(x[6]+x[2],18),x[3]^=a(x[15]+x[11],7),x[7]^=a(x[3]+x[15],9),x[11]^=a(x[7]+x[3],13),x[15]^=a(x[11]+x[7],18),x[1]^=a(x[0]+x[3],7),x[2]^=a(x[1]+x[0],9),x[3]^=a(x[2]+x[1],13),x[0]^=a(x[3]+x[2],18),x[6]^=a(x[5]+x[4],7),x[7]^=a(x[6]+x[5],9),x[4]^=a(x[7]+x[6],13),x[5]^=a(x[4]+x[7],18),x[11]^=a(x[10]+x[9],7),x[8]^=a(x[11]+x[10],9),x[9]^=a(x[8]+x[11],13),x[10]^=a(x[9]+x[8],18),x[12]^=a(x[15]+x[14],7),x[13]^=a(x[12]+x[15],9),x[14]^=a(x[13]+x[12],13),x[15]^=a(x[14]+x[13],18);for(let b=0;b<16;++b)m[b]+=x[b]}function c(m,x,b,w){for(let E=0;E=256)return!1}return!0}function d(m,x){if(typeof m!="number"||m%1)throw new Error("invalid "+x);return m}function h(m,x,b,w,E,P,N){if(b=d(b,"N"),w=d(w,"r"),E=d(E,"p"),P=d(P,"dkLen"),b===0||b&b-1)throw new Error("N must be power of 2");if(b>2147483647/128/w)throw new Error("N too large");if(w>2147483647/128/E)throw new Error("r too large");if(!u(m))throw new Error("password must be an array or buffer");if(m=Array.prototype.slice.call(m),!u(x))throw new Error("salt must be an array or buffer");x=Array.prototype.slice.call(x);let I=s(m,x,E*128*w);const j=new Uint32Array(E*32*w);for(let F=0;FS&&(F=S);for(let B=0;BS&&(F=S);for(let B=0;B>0&255),I.push(j[B]>>8&255),I.push(j[B]>>16&255),I.push(j[B]>>24&255);const C=s(m,I,P);return N&&N(null,1,C),C}N&&g(R)};if(!N)for(;;){const F=R();if(F!=null)return F}R()}const p={scrypt:function(m,x,b,w,E,P,N){return new Promise(function(I,j){let L=0;N&&N(0),h(m,x,b,w,E,P,function(U,K,X){if(U)j(U);else if(X)N&&L!==1&&N(1),I(new Uint8Array(X));else if(N&&K!==L)return L=K,N(K)})})},syncScrypt:function(m,x,b,w,E,P){return new Uint8Array(h(m,x,b,w,E,P))}};t.exports=p})()})(m_);var fK=m_.exports;const Mx=eo(fK);var uK=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const rm=new Q(h_);function Ik(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}class dK extends tl{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}}function hK(t,e,r){if(gr(t,"crypto/cipher")==="aes-128-ctr"){const i=Oa(gr(t,"crypto/cipherparams/iv")),s=new ss.Counter(i),o=new ss.ModeOfOperation.ctr(e,s);return de(o.decrypt(r))}return null}function g_(t,e){const r=Oa(gr(t,"crypto/ciphertext"));if(he(Xe(wr([e.slice(16,32),r]))).substring(2)!==gr(t,"crypto/mac").toLowerCase())throw new Error("invalid password");const i=hK(t,e.slice(0,16),r);i||rm.throwError("unsupported cipher",Q.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const s=e.slice(32,64),o=Ia(i);if(t.address){let l=t.address.toLowerCase();if(l.substring(0,2)!=="0x"&&(l="0x"+l),ir(l)!==o)throw new Error("address mismatch")}const a={_isKeystoreAccount:!0,address:o,privateKey:he(i)};if(gr(t,"x-ethers/version")==="0.1"){const l=Oa(gr(t,"x-ethers/mnemonicCiphertext")),c=Oa(gr(t,"x-ethers/mnemonicCounter")),f=new ss.Counter(c),u=new ss.ModeOfOperation.ctr(s,f),d=gr(t,"x-ethers/path")||hu,h=gr(t,"x-ethers/locale")||"en",p=de(u.decrypt(l));try{const m=Ix(p,h),x=ci.fromMnemonic(m,null,h).derivePath(d);if(x.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=x.mnemonic}catch(m){if(m.code!==Q.errors.INVALID_ARGUMENT||m.argument!=="wordlist")throw m}}return new dK(a)}function x_(t,e,r,n,i){return de(Px(t,e,r,n,i))}function vK(t,e,r,n,i){return Promise.resolve(x_(t,e,r,n,i))}function b_(t,e,r,n,i){const s=Ox(e),o=gr(t,"crypto/kdf");if(o&&typeof o=="string"){const a=function(l,c){return rm.throwArgumentError("invalid key-derivation function parameters",l,c)};if(o.toLowerCase()==="scrypt"){const l=Oa(gr(t,"crypto/kdfparams/salt")),c=parseInt(gr(t,"crypto/kdfparams/n")),f=parseInt(gr(t,"crypto/kdfparams/r")),u=parseInt(gr(t,"crypto/kdfparams/p"));(!c||!f||!u)&&a("kdf",o),c&c-1&&a("N",c);const d=parseInt(gr(t,"crypto/kdfparams/dklen"));return d!==32&&a("dklen",d),n(s,l,c,f,u,64,i)}else if(o.toLowerCase()==="pbkdf2"){const l=Oa(gr(t,"crypto/kdfparams/salt"));let c=null;const f=gr(t,"crypto/kdfparams/prf");f==="hmac-sha256"?c="sha256":f==="hmac-sha512"?c="sha512":a("prf",f);const u=parseInt(gr(t,"crypto/kdfparams/c")),d=parseInt(gr(t,"crypto/kdfparams/dklen"));return d!==32&&a("dklen",d),r(s,l,u,d,c)}}return rm.throwArgumentError("unsupported key-derivation function","kdf",o)}function pK(t,e){const r=JSON.parse(t),n=b_(r,e,x_,Mx.syncScrypt);return g_(r,n)}function yK(t,e,r){return uK(this,void 0,void 0,function*(){const n=JSON.parse(t),i=yield b_(n,e,vK,Mx.scrypt,r);return g_(n,i)})}function mK(t,e,r,n){try{if(ir(t.address)!==Ia(t.privateKey))throw new Error("address/privateKey mismatch");if(Ik(t)){const x=t.mnemonic;if(ci.fromMnemonic(x.phrase,null,x.locale).derivePath(x.path||hu).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(x){return Promise.reject(x)}typeof r=="function"&&!n&&(n=r,r={}),r||(r={});const i=de(t.privateKey),s=Ox(e);let o=null,a=null,l=null;if(Ik(t)){const x=t.mnemonic;o=de(u_(x.phrase,x.locale||"en")),a=x.path||hu,l=x.locale||"en"}let c=r.client;c||(c="ethers.js");let f=null;r.salt?f=de(r.salt):f=uf(32);let u=null;if(r.iv){if(u=de(r.iv),u.length!==16)throw new Error("invalid iv")}else u=uf(16);let d=null;if(r.uuid){if(d=de(r.uuid),d.length!==16)throw new Error("invalid uuid")}else d=uf(16);let h=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(h=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),Mx.scrypt(s,f,h,p,m,64,n).then(x=>{x=de(x);const b=x.slice(0,16),w=x.slice(16,32),E=x.slice(32,64),P=new ss.Counter(u),N=new ss.ModeOfOperation.ctr(b,P),I=de(N.encrypt(i)),j=Xe(wr([w,I])),L={address:t.address.substring(2).toLowerCase(),id:aK(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:he(u).substring(2)},ciphertext:he(I).substring(2),kdf:"scrypt",kdfparams:{salt:he(f).substring(2),n:h,dklen:32,p:m,r:p},mac:j.substring(2)}};if(o){const U=uf(16),K=new ss.Counter(U),X=new ss.ModeOfOperation.ctr(E,K),ee=de(X.encrypt(o)),M=new Date,v=M.getUTCFullYear()+"-"+Xc(M.getUTCMonth()+1,2)+"-"+Xc(M.getUTCDate(),2)+"T"+Xc(M.getUTCHours(),2)+"-"+Xc(M.getUTCMinutes(),2)+"-"+Xc(M.getUTCSeconds(),2)+".0Z";L["x-ethers"]={client:c,gethFilename:"UTC--"+v+"--"+L.address,mnemonicCounter:he(U).substring(2),mnemonicCiphertext:he(ee).substring(2),path:a,locale:l,version:"0.1"}}return JSON.stringify(L)})}function gK(t,e,r){if(p_(t)){r&&r(0);const n=v_(t,e);return r&&r(1),Promise.resolve(n)}return y_(t)?yK(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function xK(t,e){if(p_(t))return v_(t,e);if(y_(t))return pK(t,e);throw new Error("invalid JSON wallet")}const bK="wallet/5.7.0";var Ok=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const fl=new Q(bK);function wK(t){return t!=null&&et(t.privateKey,32)&&t.address!=null}function EK(t){const e=t.mnemonic;return e&&e.phrase}class Ns extends Cc{constructor(e,r){if(super(),wK(e)){const n=new Hl(e.privateKey);if(ie(this,"_signingKey",()=>n),ie(this,"address",Ia(this.publicKey)),this.address!==ir(e.address)&&fl.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),EK(e)){const i=e.mnemonic;ie(this,"_mnemonic",()=>({phrase:i.phrase,path:i.path||hu,locale:i.locale||"en"}));const s=this.mnemonic,o=ci.fromMnemonic(s.phrase,null,s.locale).derivePath(s.path);Ia(o.privateKey)!==this.address&&fl.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ie(this,"_mnemonic",()=>null)}else{if(Hl.isSigningKey(e))e.curve!=="secp256k1"&&fl.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ie(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);const n=new Hl(e);ie(this,"_signingKey",()=>n)}ie(this,"_mnemonic",()=>null),ie(this,"address",Ia(this.publicKey))}r&&!zu.isProvider(r)&&fl.throwArgumentError("invalid provider","provider",r),ie(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new Ns(this,e)}signTransaction(e){return yr(e).then(r=>{r.from!=null&&(ir(r.from)!==this.address&&fl.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);const n=this._signingKey().signDigest(Xe(kk(r)));return kk(r,n)})}signMessage(e){return Ok(this,void 0,void 0,function*(){return XS(this._signingKey().signDigest(CH(e)))})}_signTypedData(e,r,n){return Ok(this,void 0,void 0,function*(){const i=yield hn.resolveNames(e,r,n,s=>(this.provider==null&&fl.throwError("cannot resolve ENS names without a provider",Q.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:s}),this.provider.resolveName(s)));return XS(this._signingKey().signDigest(hn.hash(i.domain,r,i.value)))})}encrypt(e,r,n){if(typeof r=="function"&&!n&&(n=r,r={}),n&&typeof n!="function")throw new Error("invalid callback");return r||(r={}),mK(this,e,r,n)}static createRandom(e){let r=uf(16);e||(e={}),e.extraEntropy&&(r=de(Pr(Xe(wr([r,e.extraEntropy])),0,16)));const n=Ix(r,e.locale);return Ns.fromMnemonic(n,e.path,e.locale)}static fromEncryptedJson(e,r,n){return gK(e,r,n).then(i=>new Ns(i))}static fromEncryptedJsonSync(e,r){return new Ns(xK(e,r))}static fromMnemonic(e,r,n){return r||(r=hu),new Ns(ci.fromMnemonic(e,null,n).derivePath(r))}}const SK="networks/5.7.1",Mk=new Q(SK);function kK(t){return t&&typeof t.renetwork=="function"}function Is(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new r.PocketProvider(t,n.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const s=["ropsten"],o=new r.AnkrProvider(t,n.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let s=1;return n.quorum!=null?s=n.quorum:t==="homestead"&&(s=2),new r.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(r){return Is(r)},e}function v0(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return v0(t,n)},r}const Nk={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Is("homestead")},$k={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Is("ropsten")},Dk={chainId:63,name:"classicMordor",_defaultProvider:v0("https://www.ethercluster.com/mordor","classicMordor")},_d={unspecified:{chainId:0,name:"unspecified"},homestead:Nk,mainnet:Nk,morden:{chainId:2,name:"morden"},ropsten:$k,testnet:$k,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Is("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Is("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Is("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Is("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:v0("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Dk,classicTestnet:Dk,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:v0("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Is("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Is("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function AK(t){if(t==null)return null;if(typeof t=="number"){for(const n in _d){const i=_d[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=_d[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=_d[t.name];if(!e)return typeof t.chainId!="number"&&Mk.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&Mk.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(kK(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const CK="web/5.7.1";var _K=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};function TK(t,e){return _K(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const o=e.fetchOptions;o.mode&&(r.mode=o.mode),o.cache&&(r.cache=o.cache),o.credentials&&(r.credentials=o.credentials),o.redirect&&(r.redirect=o.redirect),o.referrer&&(r.referrer=o.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),s={};return n.headers.forEach?n.headers.forEach((o,a)=>{s[a.toLowerCase()]=o}):n.headers.keys().forEach(o=>{s[o.toLowerCase()]=n.headers.get(o)}),{headers:s,statusCode:n.status,statusMessage:n.statusText,body:de(new Uint8Array(i))}})}var PK=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const ki=new Q(CK);function Lk(t){return new Promise(e=>{setTimeout(e,t)})}function uo(t,e){if(t==null)return null;if(typeof t=="string")return t;if(b1(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return Uu(t)}catch{}return he(t)}return t}function RK(t){return _t(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function IK(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;ki.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,s=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;ki.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof t=="object"?!!t.errorPassThrough:!1,a={};let l=null;const c={method:"GET"};let f=!1,u=2*60*1e3;if(typeof t=="string")l=t;else if(typeof t=="object"){if((t==null||t.url==null)&&ki.throwArgumentError("missing URL","connection.url",t),l=t.url,typeof t.timeout=="number"&&t.timeout>0&&(u=t.timeout),t.headers)for(const b in t.headers)a[b.toLowerCase()]={key:b,value:String(t.headers[b])},["if-none-match","if-modified-since"].indexOf(b.toLowerCase())>=0&&(f=!0);if(c.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){l.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&ki.throwError("basic authentication requires a secure https url",Q.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:t.user,password:"[REDACTED]"});const b=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+E7(_t(b))}}t.skipFetchSetup!=null&&(c.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(c.fetchOptions=Or(t.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(d):null;if(h)try{const b={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?w7(h[3]):RK(h[3])};let w=b.body;return r&&(w=r(b.body,b)),Promise.resolve(w)}catch(b){ki.throwError("processing response error",Q.errors.SERVER_ERROR,{body:uo(h[1],h[2]),error:b,requestBody:null,requestMethod:"GET",url:l})}e&&(c.method="POST",c.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const p={};Object.keys(a).forEach(b=>{const w=a[b];p[w.key]=w.value}),c.headers=p;const m=function(){let b=null;return{promise:new Promise(function(P,N){u&&(b=setTimeout(()=>{b!=null&&(b=null,N(ki.makeError("timeout",Q.errors.TIMEOUT,{requestBody:uo(c.body,p["content-type"]),requestMethod:c.method,timeout:u,url:l})))},u))}),cancel:function(){b!=null&&(clearTimeout(b),b=null)}}}(),x=function(){return PK(this,void 0,void 0,function*(){for(let b=0;b=300)&&(m.cancel(),ki.throwError("bad response",Q.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:uo(E,w.headers?w.headers["content-type"]:null),requestBody:uo(c.body,p["content-type"]),requestMethod:c.method,url:l})),r)try{const P=yield r(E,w);return m.cancel(),P}catch(P){if(P.throttleRetry&&b{let a=null;if(s!=null)try{a=JSON.parse(Uu(s))}catch(l){ki.throwError("invalid JSON",Q.errors.SERVER_ERROR,{body:s,error:l})}return r&&(a=r(a,o)),a},i=null;if(e!=null){i=_t(e);const s=typeof t=="string"?{url:t}:Or(t);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=Or(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},t=s}return IK(t,i,n)}function df(t,e){return e||(e={}),e=Or(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&n(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function c(){return t().then(function(f){if(f!==void 0)o()&&r(f);else if(e.oncePoll)e.oncePoll.once("poll",c);else if(e.onceBlock)e.onceBlock.once("block",c);else if(!s){if(l++,l>a){o()&&n(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(c,u)}return null},function(f){o()&&n(f)})}c()})}var p0="qpzry9x8gf2tvdw0s3jn54khce6mua7l",nm={};for(var Td=0;Td>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function w_(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Wl(e)^n>>5}for(e=Wl(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=w_(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Wl(n)^o,i+=p0.charAt(o)}for(s=0;s<6;++s)n=Wl(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=p0.charAt(a)}return i}function E_(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=w_(s);if(typeof a=="string")return a;for(var l=[],c=0;c=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:l}}function MK(){var t=E_.apply(null,arguments);if(typeof t=="object")return t}function NK(t){var e=E_.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function C1(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<this.data(u,!0);return e.transaction={hash:o,type:c,accessList:be.allowNull(this.accessList.bind(this),null),blockHash:be.allowNull(o,null),blockNumber:be.allowNull(l,null),transactionIndex:be.allowNull(l,null),confirmations:be.allowNull(l,null),from:r,gasPrice:be.allowNull(n),maxPriorityFeePerGas:be.allowNull(n),maxFeePerGas:be.allowNull(n),gasLimit:n,to:be.allowNull(r,null),value:n,nonce:l,data:s,r:be.allowNull(this.uint256),s:be.allowNull(this.uint256),v:be.allowNull(l),creates:be.allowNull(r,null),raw:be.allowNull(s)},e.transactionRequest={from:be.allowNull(r),nonce:be.allowNull(l),gasLimit:be.allowNull(n),gasPrice:be.allowNull(n),maxPriorityFeePerGas:be.allowNull(n),maxFeePerGas:be.allowNull(n),to:be.allowNull(r),value:be.allowNull(n),data:be.allowNull(f),type:be.allowNull(l),accessList:be.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:r,topics:be.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:be.allowNull(this.address,null),from:be.allowNull(this.address,null),contractAddress:be.allowNull(r,null),transactionIndex:l,root:be.allowNull(a),gasUsed:n,logsBloom:be.allowNull(s),blockHash:o,transactionHash:o,logs:be.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:be.allowNull(l,null),cumulativeGasUsed:n,effectiveGasPrice:be.allowNull(n),status:be.allowNull(l),type:c},e.block={hash:be.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:be.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:be.allowNull(r),extraData:s,transactions:be.allowNull(be.arrayOf(o)),baseFeePerGas:be.allowNull(n)},e.blockWithTransactions=Or(e.block),e.blockWithTransactions.transactions=be.allowNull(be.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:be.allowNull(i,void 0),toBlock:be.allowNull(i,void 0),blockHash:be.allowNull(o,void 0),address:be.allowNull(r,void 0),topics:be.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:be.allowNull(l),blockHash:be.allowNull(o),transactionIndex:l,removed:be.allowNull(this.boolean.bind(this)),address:r,data:be.allowFalsish(s,"0x"),topics:be.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Ic(e||[])}number(e){return e==="0x"?0:ce.from(e).toNumber()}type(e){return e==="0x"||e==null?0:ce.from(e).toNumber()}bigNumber(e){return ce.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),et(e))?e.toLowerCase():Zc.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return ir(e)}callAddress(e){if(!et(e,32))return null;const r=ir(Pr(e,12));return r===Sx?null:r}contractAddress(e){return d7(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||et(e))return gx(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return Ua(n)!==32?Zc.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=ce.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!et(e))throw new Error("invalid uint256");return Vt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=be.check(r,e);return i._difficulty=n==null?null:ce.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return be.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&ce.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=be.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;et(n)&&(n=ce.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),et(n)&&(n=ce.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return LG(e)}receiptLog(e){return be.check(this.formats.receiptLog,e)}receipt(e){const r=be.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=ce.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&Zc.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):Zc.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&Zc.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return be.check(this.formats.filter,e)}filterLog(e){return be.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const s=e[i](r[i]);s!==void 0&&(n[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=r[i],s}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}var $e=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const ze=new Q($x),BK=10;function Fk(t){return t==null?"null":(Ua(t)!==32&&ze.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Bk(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Fk(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Fk(e)}).join("&")}function UK(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function ul(t){if(typeof t=="string"){if(t=t.toLowerCase(),Ua(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Bk(t);if(UH.isForkEvent(t))throw ze.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Bk(t.topics||[])}throw new Error("invalid event - "+t)}function ef(){return new Date().getTime()}function Uk(t){return new Promise(e=>{setTimeout(e,t)})}const zK=["block","network","pending","poll"];let VK=class{constructor(e,r,n){ie(this,"tag",e),ie(this,"listener",r),ie(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=UK(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||zK.indexOf(this.tag)>=0}};const qK={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Qv(t){return Vt(ce.from(t).toHexString(),32)}function zk(t){return uu.encode(wr([t,Pr(Wa(Wa(t)),0,4)]))}const S_=new RegExp("^(ipfs)://(.*)$","i"),Vk=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),S_,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function uh(t,e){try{return Uu(vu(t,e))}catch{}return null}function vu(t,e){if(t==="0x")return null;const r=ce.from(Pr(t,e,e+32)).toNumber(),n=ce.from(Pr(t,r,r+32)).toNumber();return Pr(t,r+32,r+32+n)}function Jv(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):ze.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function qk(t){const e=de(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 HK(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function k_(t){const e=[];let r=0;for(let n=0;nce.from(e).eq(1)).catch(e=>{if(e.code===Q.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return $e(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:En([e,oh(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=En(["0x9061b923",k_([kH(this.name),n.data])]));try{let s=yield this.provider.call(n);return de(s).length%32===4&&ze.throwError("resolver threw error",Q.errors.CALL_EXCEPTION,{transaction:n,data:s}),i&&(s=vu(s,0)),s}catch(s){if(s.code===Q.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,r){return $e(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?vu(n,0):null})}_getAddress(e,r){const n=qK[String(e)];if(n==null&&ze.throwError(`unsupported coin type: ${e}`,Q.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=de(r);if(n.p2pkh!=null){const s=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return zk(wr([[n.p2pkh],"0x"+s[2]]))}}if(n.p2sh!=null){const s=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return zk(wr([[n.p2sh],"0x"+s[2]]))}}if(n.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=jk.toWords(i.slice(2));return a.unshift(o),jk.encode(n.prefix,a)}}return null}getAddress(e){return $e(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===zq?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===Q.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Qv(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&ze.throwError("invalid or unsupported coin data",Q.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return $e(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;no[l])}return ze.throwError("invalid or unsupported content hash data",Q.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return $e(this,void 0,void 0,function*(){let r=_t(e);r=wr([Qv(64),Qv(r.length),r]),r.length%32!==0&&(r=wr([r,Vt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",he(r));return n==null||n==="0x"?null:Uu(n)})}}let Xv=null,WK=1;class GK extends zu{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ie(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=is(new.target,"getNetwork")(e);r?(ie(this,"_network",r),this.emit("network",r,null)):ze.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return $e(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||ze.throwError("no network detected",Q.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:ie(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return df(()=>this._ready().then(e=>e,e=>{if(!(e.code===Q.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Xv==null&&(Xv=new be),Xv}static getNetwork(e){return AK(e??"homestead")}ccipReadFetch(e,r,n){return $e(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield Nx({url:c,errorPassThrough:!0},f,(h,p)=>(h.status=p.statusCode,h));if(u.data)return u.data;const d=u.message||"unknown error";if(u.status>=400&&u.status<500)return ze.throwError(`response not found during CCIP fetch: ${d}`,Q.errors.SERVER_ERROR,{url:l,errorMessage:d});o.push(d)}return ze.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,Q.errors.SERVER_ERROR,{urls:n,errorMessages:o})})}_getInternalBlockNumber(e){return $e(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(ef()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ef(),n=yr({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),s;const o=ef();return i=ce.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return $e(this,void 0,void 0,function*(){const e=WK++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)ze.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",ze.makeError("network block skew detected",Q.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&n-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});r.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=n;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(c=>{c.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=c.blockNumber),this._emitted["b:"+c.blockHash]=c.blockNumber,this._emitted["t:"+c.transactionHash]=c.blockNumber,this.emit(s,c)})}).catch(l=>{this.emit("error",l),i._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return $e(this,void 0,void 0,function*(){return ze.throwError("provider does not support network detection",Q.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return $e(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Uk(0),this._network;const n=ze.makeError("underlying network changed",Q.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ef();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return $e(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return $e(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=r?s:new Promise((o,a)=>{const l=[];let c=!1;const f=function(){return c?!0:(c=!0,l.forEach(d=>{d()}),!1)},u=d=>{d.confirmations{this.removeListener(e,u)}),i){let d=i.startBlock,h=null;const p=m=>$e(this,void 0,void 0,function*(){c||(yield Uk(1e3),this.getTransactionCount(i.from).then(x=>$e(this,void 0,void 0,function*(){if(!c){if(x<=i.nonce)d=m;else{{const b=yield this.getTransaction(e);if(b&&b.blockNumber!=null)return}for(h==null&&(h=d-3,h{c||this.once("block",p)}))});if(c)return;this.once("block",p),l.push(()=>{this.removeListener("block",p)})}if(typeof n=="number"&&n>0){const d=setTimeout(()=>{f()||a(ze.makeError("timeout exceeded",Q.errors.TIMEOUT,{timeout:n}))},n);d.unref&&d.unref(),l.push(()=>{clearTimeout(d)})}})})}getBlockNumber(){return $e(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return ce.from(e)}catch(r){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return ce.from(i)}catch(s){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:s})}})}getTransactionCount(e,r){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return ce.from(i).toNumber()}catch(s){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:s})}})}getCode(e,r){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return he(i)}catch(s){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:s})}})}getStorageAt(e,r,n){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(o=>gx(o))}),s=yield this.perform("getStorageAt",i);try{return he(s)}catch(o){return ze.throwError("bad result from backend",Q.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,r,n){if(r!=null&&Ua(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&ze.throwError("Transaction hash mismatch from Provider.sendTransaction.",Q.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(s,o)=>$e(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&n!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&ze.throwError("transaction failed",Q.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(s=>he(s)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,s,i)}catch(s){throw s.transaction=n,s.transactionHash=n.hash,s}})}_getTransactionRequest(e){return $e(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?ce.from(s):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(s=>s?he(s):null))}),this.formatter.transactionRequest(yield yr(n))})}_getFilter(e){return $e(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yr(r))})}_call(e,r,n){return $e(this,void 0,void 0,function*(){n>=BK&&ze.throwError("CCIP read exceeded maximum redirections",Q.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&Ua(s)%32===4)try{const o=Pr(s,4),a=Pr(o,0,32);ce.from(a).eq(i)||ze.throwError("CCIP Read sender did not match",Q.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],c=ce.from(Pr(o,32,64)).toNumber(),f=ce.from(Pr(o,c,c+32)).toNumber(),u=Pr(o,c+32);for(let b=0;b$e(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return df(()=>$e(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return df(()=>$e(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return $e(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yr({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),be.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return $e(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return $e(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&ze.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return $e(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new Hk(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return $e(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||ze.throwError("network does not support ENS",Q.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+oh(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return $e(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(et(e))throw n}typeof e!="string"&&ze.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return $e(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=uh(yield this.call({to:n,data:"0x691f3431"+oh(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return $e(this,void 0,void 0,function*(){let r=null;if(et(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;r=new Hk(this,o,s);try{const a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==Q.errors.CALL_EXCEPTION)throw a}try{const a=uh(yield this.call({to:o,data:"0x691f3431"+oh(s).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==Q.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return ze.throwError(e+" not implemented",Q.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new VK(ul(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],s=ul(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,r)},0),n=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),n}listenerCount(e){if(!e)return this._events.length;let r=ul(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=ul(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,s=ul(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=r||i?!0:(i=!0,n.push(o),!1)),n.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=ul(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var Ps=globalThis&&globalThis.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})};const Ar=new Q($x),KK=["call","estimateGas"];function Rf(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=et(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Rf(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Rf(JSON.parse(t),e)}catch{}return null}function A_(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const s=Rf(e,!0);if(s)return s.data;Ar.throwError("missing revert data in call exception; Transaction reverted without a reason string",Q.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let s=Rf(e.body,!1);s==null&&(s=Rf(e,!1)),s&&Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Q.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===Q.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Ar.throwError("insufficient funds for intrinsic transaction cost",Q.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&Ar.throwError("nonce has already been used",Q.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Ar.throwError("replacement fee too low",Q.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&Ar.throwError("legacy pre-eip-155 transactions not supported",Q.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),KK.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Q.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Wk(t){return new Promise(function(e){setTimeout(e,t)})}function YK(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function tf(t){return t&&t.toLowerCase()}const im={};class C_ extends Cc{constructor(e,r,n){if(super(),e!==im)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ie(this,"provider",r),n==null&&(n=0),typeof n=="string"?(ie(this,"_address",this.provider.formatter.address(n)),ie(this,"_index",null)):typeof n=="number"?(ie(this,"_index",n),ie(this,"_address",null)):Ar.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return Ar.throwError("cannot alter JSON-RPC Signer connection",Q.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new QK(im,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Ar.throwError("unknown account #"+this._index,Q.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=Or(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=Or(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>Ps(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yr({tx:yr(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&Ar.throwArgumentError("from address mismatch","transaction",e):n.from=i;const s=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&Ar.throwError("user rejected transaction",Q.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),A_("sendTransaction",o,s)))})}signTransaction(e){return Ar.throwError("signing transactions is unsupported",Q.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Ps(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield df(()=>Ps(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return Ps(this,void 0,void 0,function*(){const r=typeof e=="string"?_t(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[he(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&Ar.throwError("user rejected signing",Q.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return Ps(this,void 0,void 0,function*(){const r=typeof e=="string"?_t(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),he(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&Ar.throwError("user rejected signing",Q.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return Ps(this,void 0,void 0,function*(){const i=yield hn.resolveNames(e,r,n,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(hn.getPayload(i.domain,r,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&Ar.throwError("user rejected signing",Q.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:r,value:i.value}}),o}})}unlock(e){return Ps(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class QK extends C_{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const JK={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};let __=class extends GK{constructor(e,r){let n=r;n==null&&(n=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(n),e||(e=is(this.constructor,"defaultUrl")()),typeof e=="string"?ie(this,"connection",Object.freeze({url:e})):ie(this,"connection",Object.freeze(Or(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Ps(this,void 0,void 0,function*(){yield Wk(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=is(this.constructor,"getNetwork");try{return r(ce.from(e).toNumber())}catch(n){return Ar.throwError("could not detect network",Q.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return Ar.throwError("could not detect network",Q.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new C_(im,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:za(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Nx(this.connection,JSON.stringify(n),YK).then(o=>(this.emit("debug",{action:"response",request:n,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:n,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[tf(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[tf(r.address),r.blockTag]];case"getCode":return["eth_getCode",[tf(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[tf(r.address),Vt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[is(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[is(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=tf(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return Ps(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&ce.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=Or(r),r.transaction=Or(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&Ar.throwError(e+" not implemented",Q.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return A_(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(s){if(e._pendingFilter!=r)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return Wk(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=Or(JK);if(r)for(const s in r)r[s]&&(n[s]=!0);i7(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=gx(ce.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=he(e[s]))}),e.accessList&&(i.accessList=Ic(e.accessList)),i}};const XK="units/5.7.0",ZK=new Q(XK),T_=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Dx(t,e){if(typeof e=="string"){const r=T_.indexOf(e);r!==-1&&(e=3*r)}return ih(t,e??18)}function pu(t,e){if(typeof t!="string"&&ZK.throwArgumentError("value must be a string","value",t),typeof e=="string"){const r=T_.indexOf(e);r!==-1&&(e=3*r)}return Gi(t,e??18)}function eY(t){return Dx(t,18)}function Gk(t){return pu(t,18)}const tY="1.10.11";function rY(t){var e="";return r(t),e;function r(i){if(i===null||typeof i!="object"||i.toJSON!=null)e+=JSON.stringify(i);else if(Array.isArray(i)){e+="[";var s=!1;i.forEach(function(a){s&&(e+=","),s=!0,a===void 0&&(a=null),r(a)}),e+="]"}else{e+="{";var o=Object.keys(i).filter(function(a){return i[a]!==void 0}).sort();o.forEach(function(a,l){return n(i,a,l)}),e+="}"}}function n(i,s,o){o>0&&(e+=","),e+=JSON.stringify(s),e+=":",r(i[s])}}let J=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.HARDHAT=31337]="HARDHAT",t[t.HARDHAT_2=31338]="HARDHAT_2",t}({}),Ue=function(t){return t.MAINNET="mainnet",t.TESTNET="testnet",t}({});const y0={[J.MAINNET]:{chainId:J.MAINNET,type:Ue.MAINNET,name:"mainnet",title:"Ethereum",logoURI:`https://assets.sequence.info/images/networks/medium/${J.MAINNET}.webp`,blockExplorer:{name:"Etherscan",rootUrl:"https://etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18},ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},[J.ROPSTEN]:{chainId:J.ROPSTEN,type:Ue.TESTNET,name:"ropsten",title:"Ropsten",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.RINKEBY]:{chainId:J.RINKEBY,type:Ue.TESTNET,name:"rinkeby",title:"Rinkeby",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.GOERLI]:{chainId:J.GOERLI,type:Ue.TESTNET,name:"goerli",title:"Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.KOVAN]:{chainId:J.KOVAN,type:Ue.TESTNET,name:"kovan",title:"Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${J.KOVAN}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Kovan)",rootUrl:"https://kovan.etherscan.io/"},nativeToken:{symbol:"kETH",name:"Kovan Ether",decimals:18},deprecated:!0},[J.SEPOLIA]:{chainId:J.SEPOLIA,type:Ue.TESTNET,name:"sepolia",title:"Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Sepolia)",rootUrl:"https://sepolia.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.POLYGON]:{chainId:J.POLYGON,type:Ue.MAINNET,name:"polygon",title:"Polygon",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON}.webp`,blockExplorer:{name:"Polygonscan",rootUrl:"https://polygonscan.com/"},nativeToken:{symbol:"MATIC",name:"Polygon",decimals:18}},[J.POLYGON_MUMBAI]:{chainId:J.POLYGON_MUMBAI,type:Ue.TESTNET,name:"mumbai",title:"Polygon Mumbai",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON_MUMBAI}.webp`,testnet:!0,blockExplorer:{name:"Polygonscan (Mumbai)",rootUrl:"https://mumbai.polygonscan.com/"},nativeToken:{symbol:"mMATIC",name:"Mumbai Polygon",decimals:18},deprecated:!0},[J.POLYGON_AMOY]:{chainId:J.POLYGON_AMOY,type:Ue.TESTNET,name:"amoy",title:"Polygon Amoy",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON_AMOY}.webp`,testnet:!0,blockExplorer:{name:"OKLink (Amoy)",rootUrl:"https://www.oklink.com/amoy/"},nativeToken:{symbol:"aMATIC",name:"Amoy Polygon",decimals:18}},[J.POLYGON_ZKEVM]:{chainId:J.POLYGON_ZKEVM,type:Ue.MAINNET,name:"polygon-zkevm",title:"Polygon zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${J.POLYGON_ZKEVM}.webp`,blockExplorer:{name:"Polygonscan (zkEVM)",rootUrl:"https://zkevm.polygonscan.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.BSC]:{chainId:J.BSC,type:Ue.MAINNET,name:"bsc",title:"BNB Smart Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BSC}.webp`,blockExplorer:{name:"BSCScan",rootUrl:"https://bscscan.com/"},nativeToken:{symbol:"BNB",name:"BNB",decimals:18}},[J.BSC_TESTNET]:{chainId:J.BSC_TESTNET,type:Ue.TESTNET,name:"bsc-testnet",title:"BNB Smart Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BSC_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"BSCScan (Testnet)",rootUrl:"https://testnet.bscscan.com/"},nativeToken:{symbol:"tBNB",name:"Testnet BNB",decimals:18}},[J.OPTIMISM]:{chainId:J.OPTIMISM,type:Ue.MAINNET,name:"optimism",title:"Optimism",logoURI:`https://assets.sequence.info/images/networks/medium/${J.OPTIMISM}.webp`,blockExplorer:{name:"Etherscan (Optimism)",rootUrl:"https://optimistic.etherscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.OPTIMISM_KOVAN]:{chainId:J.OPTIMISM_KOVAN,type:Ue.TESTNET,name:"optimism-kovan",title:"Optimism Kovan",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.OPTIMISM_GOERLI]:{chainId:J.OPTIMISM_GOERLI,type:Ue.TESTNET,name:"optimism-goerli",title:"Optimism Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.OPTIMISM_SEPOLIA]:{chainId:J.OPTIMISM_SEPOLIA,type:Ue.TESTNET,name:"optimism-sepolia",title:"Optimism Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.OPTIMISM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Etherscan (Optimism Sepolia)",rootUrl:"https://sepolia-optimistic.etherscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.ARBITRUM]:{chainId:J.ARBITRUM,type:Ue.MAINNET,name:"arbitrum",title:"Arbitrum One",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ARBITRUM}.webp`,blockExplorer:{name:"Arbiscan",rootUrl:"https://arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.ARBITRUM_GOERLI]:{chainId:J.ARBITRUM_GOERLI,type:Ue.TESTNET,name:"arbitrum-goerli",title:"Arbitrum Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.ARBITRUM_SEPOLIA]:{chainId:J.ARBITRUM_SEPOLIA,type:Ue.TESTNET,name:"arbitrum-sepolia",title:"Arbitrum Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ARBITRUM_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Arbiscan (Sepolia Testnet)",rootUrl:"https://sepolia.arbiscan.io/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.ARBITRUM_NOVA]:{chainId:J.ARBITRUM_NOVA,type:Ue.MAINNET,name:"arbitrum-nova",title:"Arbitrum Nova",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ARBITRUM_NOVA}.webp`,blockExplorer:{name:"Arbiscan Nova",rootUrl:"https://nova.arbiscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.AVALANCHE]:{chainId:J.AVALANCHE,type:Ue.MAINNET,name:"avalanche",title:"Avalanche",logoURI:`https://assets.sequence.info/images/networks/medium/${J.AVALANCHE}.webp`,blockExplorer:{name:"Snowtrace",rootUrl:"https://subnets.avax.network/c-chain/"},nativeToken:{symbol:"AVAX",name:"AVAX",decimals:18}},[J.AVALANCHE_TESTNET]:{chainId:J.AVALANCHE_TESTNET,type:Ue.TESTNET,name:"avalanche-testnet",title:"Avalanche Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.GNOSIS]:{chainId:J.GNOSIS,type:Ue.MAINNET,name:"gnosis",title:"Gnosis Chain",logoURI:`https://assets.sequence.info/images/networks/medium/${J.GNOSIS}.webp`,blockExplorer:{name:"Gnosis Chain Explorer",rootUrl:"https://blockscout.com/xdai/mainnet/"},nativeToken:{symbol:"XDAI",name:"XDAI",decimals:18}},[J.BASE]:{chainId:J.BASE,type:Ue.MAINNET,name:"base",title:"Base (Coinbase)",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BASE}.webp`,blockExplorer:{name:"Base Explorer",rootUrl:"https://basescan.org/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.BASE_GOERLI]:{chainId:J.BASE_GOERLI,type:Ue.TESTNET,name:"base-goerli",title:"Base Goerli",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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},[J.BASE_SEPOLIA]:{chainId:J.BASE_SEPOLIA,type:Ue.TESTNET,name:"base-sepolia",title:"Base Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BASE_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Base Sepolia Explorer",rootUrl:"https://base-sepolia.blockscout.com/"},nativeToken:{symbol:"sETH",name:"Sepolia Ether",decimals:18}},[J.HOMEVERSE]:{chainId:J.HOMEVERSE,type:Ue.MAINNET,name:"homeverse",title:"Oasys Homeverse",logoURI:`https://assets.sequence.info/images/networks/medium/${J.HOMEVERSE}.webp`,blockExplorer:{name:"Oasys Homeverse Explorer",rootUrl:"https://explorer.oasys.homeverse.games/"},nativeToken:{symbol:"OAS",name:"OAS",decimals:18}},[J.HOMEVERSE_TESTNET]:{chainId:J.HOMEVERSE_TESTNET,type:Ue.TESTNET,name:"homeverse-testnet",title:"Oasys Homeverse Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.XAI]:{chainId:J.XAI,type:Ue.MAINNET,name:"xai",title:"Xai",logoURI:`https://assets.sequence.info/images/networks/medium/${J.XAI}.webp`,blockExplorer:{name:"Xai Explorer",rootUrl:"https://explorer.xai-chain.net/"},nativeToken:{symbol:"XAI",name:"XAI",decimals:18}},[J.XAI_SEPOLIA]:{chainId:J.XAI_SEPOLIA,type:Ue.TESTNET,name:"xai-sepolia",title:"Xai Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.ASTAR_ZKEVM]:{chainId:J.ASTAR_ZKEVM,type:Ue.MAINNET,name:"astar-zkevm",title:"Astar zkEVM",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ASTAR_ZKEVM}.webp`,blockExplorer:{name:"Astar zkEVM Explorer",rootUrl:"https://astar-zkevm.explorer.startale.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.ASTAR_ZKYOTO]:{chainId:J.ASTAR_ZKYOTO,type:Ue.TESTNET,name:"astar-zkyoto",title:"Astar zKyoto Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.ASTAR_ZKYOTO}.webp`,testnet:!0,blockExplorer:{name:"Astar zKyoto Explorer",rootUrl:"https://astar-zkyoto.blockscout.com/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.XR_SEPOLIA]:{chainId:J.XR_SEPOLIA,type:Ue.TESTNET,name:"xr-sepolia",title:"XR Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.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}},[J.B3_SEPOLIA]:{chainId:J.B3_SEPOLIA,type:Ue.TESTNET,name:"b3-sepolia",title:"B3 Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.B3_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"B3 Sepolia Explorer",rootUrl:"https://sepolia.explorer.b3.fun/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.APECHAIN_TESTNET]:{chainId:J.APECHAIN_TESTNET,type:Ue.TESTNET,name:"apechain-testnet",title:"APE Chain Testnet",logoURI:`https://assets.sequence.info/images/networks/medium/${J.APECHAIN_TESTNET}.webp`,testnet:!0,blockExplorer:{name:"APE Chain Explorer",rootUrl:"https://curtis.explorer.caldera.xyz/"},nativeToken:{symbol:"APE",name:"ApeCoin",decimals:18}},[J.BLAST]:{chainId:J.BLAST,type:Ue.MAINNET,name:"blast",title:"Blast",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BLAST}.webp`,blockExplorer:{name:"Blast Explorer",rootUrl:"https://blastscan.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.BLAST_SEPOLIA]:{chainId:J.BLAST_SEPOLIA,type:Ue.TESTNET,name:"blast-sepolia",title:"Blast Sepolia",logoURI:`https://assets.sequence.info/images/networks/medium/${J.BLAST_SEPOLIA}.webp`,testnet:!0,blockExplorer:{name:"Blast Sepolia Explorer",rootUrl:"https://sepolia.blastexplorer.io/"},nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.TELOS]:{chainId:J.TELOS,type:Ue.MAINNET,name:"telos",title:"Telos",logoURI:`https://assets.sequence.info/images/networks/medium/${J.TELOS}.webp`,blockExplorer:{name:"Telos Explorer",rootUrl:"https://explorer.telos.net/network/"},nativeToken:{symbol:"TLOS",name:"TLOS",decimals:18}},[J.HARDHAT]:{chainId:J.HARDHAT,name:"hardhat",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}},[J.HARDHAT_2]:{chainId:J.HARDHAT_2,name:"hardhat2",title:"Hardhat (local testnet)",nativeToken:{symbol:"ETH",name:"Ether",decimals:18}}};function sm(){return sm=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 i=n.map(c=>c.chainId).sort(),s=i.filter((c,f)=>i.indexOf(c)!==f);if(s.length>0){if(e)throw new Error(`invalid network config: duplicate chainIds ${s}`);return!1}n.forEach(c=>c.name=c.name.toLowerCase());const o=n.map(c=>c.name).sort(),a=o.filter((c,f)=>o.indexOf(c)!==f);if(a.length>0){if(e)throw new Error(`invalid network config: duplicate network names ${a}`);return!1}let l=!1;for(let c=0;c(iY(t,!0,e),t),oY=t=>sY(lY(t)),aY=(t,e)=>{if(typeof e=="string")if(e.startsWith("0x")){const r=ce.from(e).toNumber();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(ce.isBigNumber(e)){const r=e.toNumber();return t.find(n=>n.chainId===r)}else return}},lY=t=>{if(!t)return[];const e=t.sort((n,i)=>n.chainId===i.chainId?0:n.chainIdn.isDefaultChain);return r>0&&e.splice(0,0,e.splice(r,1)[0]),e},Lx=(t,e)=>typeof t=="string"?(e=e||{},t.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim,function(r,n){let i=e[n];return typeof i=="function"?i=i():i==null?i="":typeof i=="object"||typeof i=="symbol"?i=i.toString():i=i.valueOf(),i})):"",P_=t=>Lx("https://${network}-indexer.sequence.app",{network:t}),cY=t=>Lx("https://${network}-relayer.sequence.app",{network:t}),fY=t=>Lx("https://nodes.sequence.app/${network}",{network:t});function Kk(t){return aY(dY,t)}const nt=(t,e)=>{const r=y0[t];if(!r)throw new Error(`Network with chainId ${t} not found`);const n=fY(r.name);return uc({},r,{rpcUrl:n,indexerUrl:P_(r.name),relayer:{url:cY(r.name),provider:{url:n}}},e)},uY=[uc({},y0[J.HARDHAT],{rpcUrl:"http://localhost:8545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:8545"}}}),uc({},y0[J.HARDHAT_2],{rpcUrl:"http://localhost:9545",relayer:{url:"http://localhost:3000",provider:{url:"http://localhost:9545"}}})],dY=oY([uc({},nt(J.POLYGON),{isDefaultChain:!0,isAuthChain:!0}),nt(J.MAINNET),nt(J.BSC),nt(J.AVALANCHE),nt(J.ARBITRUM),nt(J.ARBITRUM_NOVA),nt(J.OPTIMISM),nt(J.OPTIMISM_SEPOLIA),nt(J.POLYGON_ZKEVM),nt(J.GNOSIS),nt(J.RINKEBY,{disabled:!0}),nt(J.GOERLI,{disabled:!0}),nt(J.SEPOLIA),nt(J.POLYGON_MUMBAI,{disabled:!0}),nt(J.POLYGON_AMOY),nt(J.BSC_TESTNET),nt(J.ARBITRUM_SEPOLIA),nt(J.BASE),nt(J.BASE_SEPOLIA),nt(J.HOMEVERSE),nt(J.HOMEVERSE_TESTNET),nt(J.XAI),nt(J.XAI_SEPOLIA),nt(J.AVALANCHE_TESTNET),nt(J.ASTAR_ZKEVM),nt(J.ASTAR_ZKYOTO),nt(J.XR_SEPOLIA),nt(J.B3_SEPOLIA),nt(J.APECHAIN_TESTNET),nt(J.BLAST),nt(J.BLAST_SEPOLIA),nt(J.TELOS),...uY]),hY=(t,e)=>e.some(r=>t instanceof r);let Yk,Qk;function vY(){return Yk||(Yk=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function pY(){return Qk||(Qk=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const R_=new WeakMap,om=new WeakMap,I_=new WeakMap,Zv=new WeakMap,jx=new WeakMap;function yY(t){const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{r(Fo(t.result)),i()},o=()=>{n(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(r=>{r instanceof IDBCursor&&R_.set(r,t)}).catch(()=>{}),jx.set(e,t),e}function mY(t){if(om.has(t))return;const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{r(),i()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});om.set(t,e)}let am={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return om.get(t);if(e==="objectStoreNames")return t.objectStoreNames||I_.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Fo(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 gY(t){am=t(am)}function xY(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){const n=t.call(ep(this),e,...r);return I_.set(n,e.sort?e.sort():[e]),Fo(n)}:pY().includes(t)?function(...e){return t.apply(ep(this),e),Fo(R_.get(this))}:function(...e){return Fo(t.apply(ep(this),e))}}function bY(t){return typeof t=="function"?xY(t):(t instanceof IDBTransaction&&mY(t),hY(t,vY())?new Proxy(t,am):t)}function Fo(t){if(t instanceof IDBRequest)return yY(t);if(Zv.has(t))return Zv.get(t);const e=bY(t);return e!==t&&(Zv.set(t,e),jx.set(e,t)),e}const ep=t=>jx.get(t);function wY(t,e,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Fo(o);return n&&o.addEventListener("upgradeneeded",l=>{n(Fo(o.result),l.oldVersion,l.newVersion,Fo(o.transaction),l)}),r&&o.addEventListener("blocked",l=>r(l.oldVersion,l.newVersion,l)),a.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const EY=["get","getKey","getAll","getAllKeys","count"],SY=["put","add","delete","clear"],tp=new Map;function Jk(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(tp.get(e))return tp.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,i=SY.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||EY.includes(r)))return;const s=async function(o,...a){const l=this.transaction(o,i?"readwrite":"readonly");let c=l.store;return n&&(c=c.index(a.shift())),(await Promise.all([c[r](...a),i&&l.done]))[0]};return tp.set(e,s),s}gY(t=>({...t,get:(e,r,n)=>Jk(e,r)||t.get(e,r,n),has:(e,r)=>!!Jk(e,r)||t.has(e,r)}));const kY=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},AY=t=>({httpHandler:t.httpHandler()});var Xk;(function(t){t.HEADER="header",t.QUERY="query"})(Xk||(Xk={}));var Zk;(function(t){t.HEADER="header",t.QUERY="query"})(Zk||(Zk={}));var yu;(function(t){t.HTTP="http",t.HTTPS="https"})(yu||(yu={}));var m0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(m0||(m0={}));var eA;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(eA||(eA={}));const lm="__smithy_context";var tA;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(tA||(tA={}));var rA;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(rA||(rA={}));class Yn{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 Yn({...e,headers:{...e.headers}});return r.query&&(r.query=CY(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 Yn.clone(this)}}function CY(t){return Object.keys(t).reduce((e,r)=>{const n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}class g0{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 _Y=t=>e=>async r=>{if(!Yn.isInstance(r.request))return e(r);const{request:n}=r,{handlerProtocol:i=""}=t.requestHandler.metadata||{};if(i.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 s=n.hostname;n.port!=null&&(s+=`:${n.port}`),n.headers.host=s}return e(r)},TY={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},PY=t=>({applyToStack:e=>{e.add(_Y(t),TY)}}),RY=()=>(t,e)=>async r=>{var n,i;try{const s=await t(r),{clientName:o,commandName:a,logger:l,dynamoDbDocumentClientOptions:c={}}=e,{overrideInputFilterSensitiveLog:f,overrideOutputFilterSensitiveLog:u}=c,d=f??e.inputFilterSensitiveLog,h=u??e.outputFilterSensitiveLog,{$metadata:p,...m}=s.output;return(n=l==null?void 0:l.info)==null||n.call(l,{clientName:o,commandName:a,input:d(r.input),output:h(m),metadata:p}),s}catch(s){const{clientName:o,commandName:a,logger:l,dynamoDbDocumentClientOptions:c={}}=e,{overrideInputFilterSensitiveLog:f}=c,u=f??e.inputFilterSensitiveLog;throw(i=l==null?void 0:l.error)==null||i.call(l,{clientName:o,commandName:a,input:u(r.input),error:s,metadata:s.$metadata}),s}},IY={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},OY=t=>({applyToStack:e=>{e.add(RY(),IY)}}),nA="X-Amzn-Trace-Id",MY="AWS_LAMBDA_FUNCTION_NAME",NY="_X_AMZN_TRACE_ID",$Y=t=>e=>async r=>{const{request:n}=r;if(!Yn.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(nA))return e(r);const i=process.env[MY],s=process.env[NY],o=a=>typeof a=="string"&&a.length>0;return o(i)&&o(s)&&(n.headers[nA]=s),e({...r,request:n})},DY={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},LY=t=>({applyToStack:e=>{e.add($Y(t),DY)}});function jY(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}const FY=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}$"),O_=t=>FY.test(t)||t.startsWith("[")&&t.endsWith("]"),BY=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Fx=(t,e=!1)=>{if(!e)return BY.test(t);const r=t.split(".");for(const n of r)if(!Fx(n))return!1;return!0},x0={},mu="endpoints";function Qo(t){return typeof t!="object"||t==null?t:"ref"in t?`$${Qo(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(Qo).join(", ")})`:JSON.stringify(t,null,2)}class Qn extends Error{constructor(e){super(e),this.name="EndpointError"}}const UY=(t,e)=>t===e,zY=t=>{const e=t.split("."),r=[];for(const n of e){const i=n.indexOf("[");if(i!==-1){if(n.indexOf("]")!==n.length-1)throw new Qn(`Path: '${t}' does not end with ']'`);const s=n.slice(i+1,-1);if(Number.isNaN(parseInt(s)))throw new Qn(`Invalid array index: '${s}' in path: '${t}'`);i!==0&&r.push(n.slice(0,i)),r.push(s)}else r.push(n)}return r},M_=(t,e)=>zY(e).reduce((r,n)=>{if(typeof r!="object")throw new Qn(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t),VY=t=>t!=null,qY=t=>!t,rp={[yu.HTTP]:80,[yu.HTTPS]:443},HY=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:m="",query:x={}}=t,b=new URL(`${p}//${d}${h?`:${h}`:""}${m}`);return b.search=Object.entries(x).map(([w,E])=>`${w}=${E}`).join("&"),b}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:i,pathname:s,protocol:o,search:a}=e;if(a)return null;const l=o.slice(0,-1);if(!Object.values(yu).includes(l))return null;const c=O_(i),f=r.includes(`${n}:${rp[l]}`)||typeof t=="string"&&t.includes(`${n}:${rp[l]}`),u=`${n}${f?`:${rp[l]}`:""}`;return{scheme:l,authority:u,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:c}},WY=(t,e)=>t===e,GY=(t,e,r,n)=>e>=r||t.lengthencodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),YY={booleanEquals:UY,getAttr:M_,isSet:VY,isValidHostLabel:Fx,not:qY,parseURL:HY,stringEquals:WY,substring:GY,uriEncode:KY},N_=(t,e)=>{const r=[],n={...e.endpointParams,...e.referenceRecord};let i=0;for(;i({...e.endpointParams,...e.referenceRecord})[t],_1=(t,e,r)=>{if(typeof t=="string")return N_(t,r);if(t.fn)return $_(t,r);if(t.ref)return QY(t,r);throw new Qn(`'${e}': ${String(t)} is not a string, function or reference.`)},$_=({fn:t,argv:e},r)=>{const n=e.map(s=>["boolean","number"].includes(typeof s)?s:_1(s,"arg",r)),i=t.split(".");return i[0]in x0&&i[1]!=null?x0[i[0]][i[1]](...n):YY[t](...n)},JY=({assign:t,...e},r)=>{var i,s;if(t&&t in r.referenceRecord)throw new Qn(`'${t}' is already defined in Reference Record.`);const n=$_(e,r);return(s=(i=r.logger)==null?void 0:i.debug)==null||s.call(i,`${mu} evaluateCondition: ${Qo(e)} = ${Qo(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}},Bx=(t=[],e)=>{var n,i;const r={};for(const s of t){const{result:o,toAssign:a}=JY(s,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};a&&(r[a.name]=a.value,(i=(n=e.logger)==null?void 0:n.debug)==null||i.call(n,`${mu} assign: ${a.name} := ${Qo(a.value)}`))}return{result:!0,referenceRecord:r}},XY=(t,e)=>Object.entries(t).reduce((r,[n,i])=>({...r,[n]:i.map(s=>{const o=_1(s,"Header value entry",e);if(typeof o!="string")throw new Qn(`Header '${n}' value '${o}' is not a string`);return o})}),{}),D_=(t,e)=>{if(Array.isArray(t))return t.map(r=>D_(r,e));switch(typeof t){case"string":return N_(t,e);case"object":if(t===null)throw new Qn(`Unexpected endpoint property: ${t}`);return L_(t,e);case"boolean":return t;default:throw new Qn(`Unexpected endpoint property type: ${typeof t}`)}},L_=(t,e)=>Object.entries(t).reduce((r,[n,i])=>({...r,[n]:D_(i,e)}),{}),ZY=(t,e)=>{const r=_1(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 Qn(`Endpoint URL must be a string, got ${typeof r}`)},eQ=(t,e)=>{var f,u;const{conditions:r,endpoint:n}=t,{result:i,referenceRecord:s}=Bx(r,e);if(!i)return;const o={...e,referenceRecord:{...e.referenceRecord,...s}},{url:a,properties:l,headers:c}=n;return(u=(f=e.logger)==null?void 0:f.debug)==null||u.call(f,`${mu} Resolving endpoint from template: ${Qo(n)}`),{...c!=null&&{headers:XY(c,o)},...l!=null&&{properties:L_(l,o)},url:ZY(a,o)}},tQ=(t,e)=>{const{conditions:r,error:n}=t,{result:i,referenceRecord:s}=Bx(r,e);if(i)throw new Qn(_1(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...s}}))},rQ=(t,e)=>{const{conditions:r,rules:n}=t,{result:i,referenceRecord:s}=Bx(r,e);if(i)return j_(n,{...e,referenceRecord:{...e.referenceRecord,...s}})},j_=(t,e)=>{for(const r of t)if(r.type==="endpoint"){const n=eQ(r,e);if(n)return n}else if(r.type==="error")tQ(r,e);else if(r.type==="tree"){const n=rQ(r,e);if(n)return n}else throw new Qn(`Unknown endpoint rule: ${r}`);throw new Qn("Rules evaluation failed")},nQ=(t,e)=>{var c,f,u,d,h;const{endpointParams:r,logger:n}=e,{parameters:i,rules:s}=t;(f=(c=e.logger)==null?void 0:c.debug)==null||f.call(c,`${mu} Initial EndpointParams: ${Qo(r)}`);const o=Object.entries(i).filter(([,p])=>p.default!=null).map(([p,m])=>[p,m.default]);if(o.length>0)for(const[p,m]of o)r[p]=r[p]??m;const a=Object.entries(i).filter(([,p])=>p.required).map(([p])=>p);for(const p of a)if(r[p]==null)throw new Qn(`Missing required parameter: '${p}'`);const l=j_(s,{endpointParams:r,logger:n,referenceRecord:{}});if((u=e.endpointParams)!=null&&u.Endpoint)try{const p=new URL(e.endpointParams.Endpoint),{protocol:m,port:x}=p;l.url.protocol=m,l.url.port=x}catch{}return(h=(d=e.logger)==null?void 0:d.debug)==null||h.call(d,`${mu} Resolved endpoint: ${Qo(l)}`),l},F_=(t,e=!1)=>{if(e){for(const r of t.split("."))if(!F_(r))return!1;return!0}return!(!Fx(t)||t.length<3||t.length>63||t!==t.toLowerCase()||O_(t))},iA=":",sA="/",iQ=t=>{const e=t.split(iA);if(e.length<6)return null;const[r,n,i,s,o,...a]=e;if(r!=="arn"||n===""||i===""||a.join(iA)==="")return null;const l=a[0].includes(sA)?a[0].split(sA):a;return{partition:n,service:i,region:s,accountId:o,resourceId:l}},sQ=[{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)\\-\\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)"},"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:{}}],oQ="1.1",aQ={partitions:sQ,version:oQ};let lQ=aQ;const cQ=t=>{const{partitions:e}=lQ;for(const n of e){const{regions:i,outputs:s}=n;for(const[o,a]of Object.entries(i))if(o===t)return{...s,...a}}for(const n of e){const{regionRegex:i,outputs:s}=n;if(new RegExp(i).test(t))return{...s}}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}},B_={isVirtualHostableS3Bucket:F_,parseArn:iQ,partition:cQ};x0.aws=B_;const oA="user-agent",np="x-amz-user-agent",aA=" ",ip="/",fQ=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,uQ=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,lA="-",dQ=t=>(e,r)=>async n=>{var u,d;const{request:i}=n;if(!Yn.isInstance(i))return e(n);const{headers:s}=i,o=((u=r==null?void 0:r.userAgent)==null?void 0:u.map(sp))||[],a=(await t.defaultUserAgentProvider()).map(sp),l=((d=t==null?void 0:t.customUserAgent)==null?void 0:d.map(sp))||[],c=[].concat([...a,...o,...l]).join(aA),f=[...a.filter(h=>h.startsWith("aws-sdk-")),...l].join(aA);return t.runtime!=="browser"?(f&&(s[np]=s[np]?`${s[oA]} ${f}`:f),s[oA]=c):s[np]=c,e({...n,request:i})},sp=t=>{var o;const e=t[0].split(ip).map(a=>a.replace(fQ,lA)).join(ip),r=(o=t[1])==null?void 0:o.replace(uQ,lA),n=e.indexOf(ip),i=e.substring(0,n);let s=e.substring(n+1);return i==="api"&&(s=s.toLowerCase()),[i,s,r].filter(a=>a&&a.length>0).reduce((a,l,c)=>{switch(c){case 0:return l;case 1:return`${a}/${l}`;default:return`${a}#${l}`}},"")},hQ={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},vQ=t=>({applyToStack:e=>{e.add(dQ(t),hQ)}});var cA;(function(t){t.ENV="env",t.CONFIG="shared config entry"})(cA||(cA={}));const pQ=!1,yQ=!1,T1=t=>t[lm]||(t[lm]={}),Bo=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e},U_=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips")),fA=t=>U_(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t,mQ=t=>{const{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return fA(e);const n=await e();return fA(n)},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return U_(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}};function gQ(t){const e=new Map;for(const r of t)e.set(r.schemeId,r);return e}const xQ=(t,e)=>(r,n)=>async i=>{var c;const s=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,i.input)),o=gQ(t.httpAuthSchemes),a=T1(n),l=[];for(const f of s){const u=o.get(f.schemeId);if(!u){l.push(`HttpAuthScheme \`${f.schemeId}\` was not enabled for this service.`);continue}const d=u.identityProvider(await e.identityProviderConfigProvider(t));if(!d){l.push(`HttpAuthScheme \`${f.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:h={},signingProperties:p={}}=((c=f.propertiesExtractor)==null?void 0:c.call(f,t,n))||{};f.identityProperties=Object.assign(f.identityProperties||{},h),f.signingProperties=Object.assign(f.signingProperties||{},p),a.selectedHttpAuthScheme={httpAuthOption:f,identity:await d(f.identityProperties),signer:u.signer};break}if(!a.selectedHttpAuthScheme)throw new Error(l.join(` `));return r(i)},bQ=async t=>{const e=(t==null?void 0:t.Bucket)||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),AQ(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!kQ(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},wQ=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,EQ=/(\d+\.){3}\d+/,SQ=/\.\./,kQ=t=>wQ.test(t)&&!EQ.test(t)&&!SQ.test(t),AQ=t=>{const[e,r,n,,,i]=t.split(":"),s=e==="arn"&&t.split(":").length>=6,o=!!(s&&r&&n&&i);if(s&&!o)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return o},CQ=(t,e,r)=>{const n=async()=>{const i=r[t]??r[e];return typeof i=="function"?i():i};return t==="credentialScope"||e==="CredentialScope"?async()=>{const i=typeof r.credentials=="function"?await r.credentials():r.credentials;return(i==null?void 0:i.credentialScope)??(i==null?void 0:i.CredentialScope)}:t==="accountId"||e==="AccountId"?async()=>{const i=typeof r.credentials=="function"?await r.credentials():r.credentials;return(i==null?void 0:i.accountId)??(i==null?void 0:i.AccountId)}:t==="endpoint"||e==="endpoint"?async()=>{const i=await n();if(i&&typeof i=="object"){if("url"in i)return i.url.href;if("hostname"in i){const{protocol:s,hostname:o,port:a,path:l}=i;return`${s}//${o}${a?":"+a:""}${l}`}}return i}:n},_Q=async t=>{};function TQ(t){const e={};if(t=t.replace(/^\?/,""),t)for(const r of t.split("&")){let[n,i=null]=r.split("=");n=decodeURIComponent(n),i&&(i=decodeURIComponent(i)),n in e?Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]:e[n]=i}return e}const b0=t=>{if(typeof t=="string")return b0(new URL(t));const{hostname:e,pathname:r,port:n,protocol:i,search:s}=t;let o;return s&&(o=TQ(s)),{hostname:e,port:n?parseInt(n):void 0,protocol:i,path:r,query:o}},z_=t=>typeof t=="object"?"url"in t?b0(t.url):t:b0(t),PQ=async(t,e,r,n)=>{if(!r.endpoint){const o=await _Q(r.serviceId||"");o&&(r.endpoint=()=>Promise.resolve(z_(o)))}const i=await RQ(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(i,n)},RQ=async(t,e,r)=>{var s;const n={},i=((s=e==null?void 0:e.getEndpointParameterInstructions)==null?void 0:s.call(e))||{};for(const[o,a]of Object.entries(i))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 CQ(a.name,o,r)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(a))}return Object.keys(i).length===0&&Object.assign(n,r),String(r.serviceId).toLowerCase()==="s3"&&await bQ(n),n},IQ=({config:t,instructions:e})=>(r,n)=>async i=>{var a,l,c;const s=await PQ(i.input,{getEndpointParameterInstructions(){return e}},{...t},n);n.endpointV2=s,n.authSchemes=(a=s.properties)==null?void 0:a.authSchemes;const o=(l=n.authSchemes)==null?void 0:l[0];if(o){n.signing_region=o.signingRegion,n.signing_service=o.signingName;const f=T1(n),u=(c=f==null?void 0:f.selectedHttpAuthScheme)==null?void 0:c.httpAuthOption;u&&(u.signingProperties=Object.assign(u.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return r({...i})},OQ=(t,e)=>r=>async n=>{const{response:i}=await r(n);try{const s=await e(i,t);return{response:i,output:s}}catch(s){if(Object.defineProperty(s,"$response",{value:i}),!("$metadata"in s)){const o="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";s.message+=` `+o,typeof s.$responseBodyText<"u"&&s.$response&&(s.$response.body=s.$responseBodyText)}throw s}},MQ=(t,e)=>(r,n)=>async i=>{var a;const s=(a=n.endpointV2)!=null&&a.url&&t.urlParser?async()=>t.urlParser(n.endpointV2.url):t.endpoint;if(!s)throw new Error("No valid endpoint provider available.");const o=await e(i.input,{...t,endpoint:s});return r({...i,request:o})},NQ={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Ux={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function zx(t,e,r){return{applyToStack:n=>{n.add(OQ(t,r),NQ),n.add(MQ(t,e),Ux)}}}const V_={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Ux.name},Vx=(t,e)=>({applyToStack:r=>{r.addRelativeTo(IQ({config:t,instructions:e}),V_)}}),$Q=t=>{const e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>z_(await Bo(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:Bo(t.useDualstackEndpoint??!1),useFipsEndpoint:Bo(t.useFipsEndpoint??!1)}},DQ={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:V_.name},LQ=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(xQ(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),DQ)}});Ux.name;const jQ=t=>e=>{throw e},FQ=(t,e)=>{},BQ=t=>(e,r)=>async n=>{if(!Yn.isInstance(n.request))return e(n);const s=T1(r).selectedHttpAuthScheme;if(!s)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:o={}},identity:a,signer:l}=s,c=await e({...n,request:await l.sign(n.request,a,o)}).catch((l.errorHandler||jQ)(o));return(l.successHandler||FQ)(c.response,o),c};var dc;(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(dc||(dc={}));const w0=3,UQ=dc.STANDARD,zQ=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],VQ=["TimeoutError","RequestTimeout","RequestTimeoutException"],qQ=[500,502,503,504],HQ=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],WQ=t=>{var e;return(e=t.$metadata)==null?void 0:e.clockSkewCorrected},q_=t=>{var e,r;return((e=t.$metadata)==null?void 0:e.httpStatusCode)===429||zQ.includes(t.name)||((r=t.$retryable)==null?void 0:r.throttling)==!0},H_=t=>{var e;return WQ(t)||VQ.includes(t.name)||HQ.includes((t==null?void 0:t.code)||"")||qQ.includes(((e=t.$metadata)==null?void 0:e.httpStatusCode)||0)},GQ=t=>{var e;if(((e=t.$metadata)==null?void 0:e.httpStatusCode)!==void 0){const r=t.$metadata.httpStatusCode;return 500<=r&&r<=599&&!H_(t)}return!1};class KQ{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(),q_(e)){const i=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=i,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(i),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 cm=100,W_=20*1e3,YQ=500,uA=500,QQ=5,JQ=10,XQ=1,ZQ="amz-sdk-invocation-id",eJ="amz-sdk-request",tJ=()=>{let t=cm;return{computeNextBackoffDelay:n=>Math.floor(Math.min(W_,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}},dA=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(W_,t),getRetryCost:()=>r});class G_{constructor(e){this.maxAttempts=e,this.mode=dc.STANDARD,this.capacity=uA,this.retryBackoffStrategy=tJ(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return dA({retryDelay:cm,retryCount:0})}async refreshRetryTokenForRetry(e,r){const n=await this.getMaxAttempts();if(this.shouldRetry(e,r,n)){const i=r.errorType;this.retryBackoffStrategy.setDelayBase(i==="THROTTLING"?YQ:cm);const s=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),o=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,s):s,a=this.getCapacityCost(i);return this.capacity-=a,dA({retryDelay:o,retryCount:e.getRetryCount()+1,retryCost:a})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(uA,this.capacity+(e.getRetryCost()??XQ))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${w0}`),w0}}shouldRetry(e,r,n){return e.getRetryCount()+1=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?JQ:QQ}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class rJ{constructor(e,r){this.maxAttemptsProvider=e,this.mode=dc.ADAPTIVE;const{rateLimiter:n}=r??{};this.rateLimiter=n??new KQ,this.standardRetryStrategy=new G_(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 Pd;const nJ=new Uint8Array(16);function iJ(){if(!Pd&&(Pd=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pd(nJ)}const Ur=[];for(let t=0;t<256;++t)Ur.push((t+256).toString(16).slice(1));function sJ(t,e=0){return Ur[t[e+0]]+Ur[t[e+1]]+Ur[t[e+2]]+Ur[t[e+3]]+"-"+Ur[t[e+4]]+Ur[t[e+5]]+"-"+Ur[t[e+6]]+Ur[t[e+7]]+"-"+Ur[t[e+8]]+Ur[t[e+9]]+"-"+Ur[t[e+10]]+Ur[t[e+11]]+Ur[t[e+12]]+Ur[t[e+13]]+Ur[t[e+14]]+Ur[t[e+15]]}const oJ=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hA={randomUUID:oJ};function aJ(t,e,r){if(hA.randomUUID&&!e&&!t)return hA.randomUUID();t=t||{};const n=t.random||(t.rng||iJ)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let i=0;i<16;++i)e[r+i]=n[i];return e}return sJ(n)}const lJ=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}`),cJ=t=>{const{retryStrategy:e}=t,r=Bo(t.maxAttempts??w0);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await Bo(t.retryMode)()===dc.ADAPTIVE?new rJ(r):new G_(r))}};class K_{trace(){}debug(){}info(){}warn(){}error(){}}const ca=(t,e)=>{const r=[];if(t&&r.push(t),e)for(const n of e)r.push(n);return r},ho=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,E0=()=>{let t=[],e=[],r=!1;const n=new Set,i=u=>u.sort((d,h)=>vA[h.step]-vA[d.step]||pA[h.priority||"normal"]-pA[d.priority||"normal"]),s=u=>{let d=!1;const h=p=>{const m=ca(p.name,p.aliases);if(m.includes(u)){d=!0;for(const x of m)n.delete(x);return!1}return!0};return t=t.filter(h),e=e.filter(h),d},o=u=>{let d=!1;const h=p=>{if(p.middleware===u){d=!0;for(const m of ca(p.name,p.aliases))n.delete(m);return!1}return!0};return t=t.filter(h),e=e.filter(h),d},a=u=>{var d;return t.forEach(h=>{u.add(h.middleware,{...h})}),e.forEach(h=>{u.addRelativeTo(h.middleware,{...h})}),(d=u.identifyOnResolve)==null||d.call(u,f.identifyOnResolve()),u},l=u=>{const d=[];return u.before.forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...l(h))}),d.push(u),u.after.reverse().forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...l(h))}),d},c=(u=!1)=>{const d=[],h=[],p={};return t.forEach(x=>{const b={...x,before:[],after:[]};for(const w of ca(b.name,b.aliases))p[w]=b;d.push(b)}),e.forEach(x=>{const b={...x,before:[],after:[]};for(const w of ca(b.name,b.aliases))p[w]=b;h.push(b)}),h.forEach(x=>{if(x.toMiddleware){const b=p[x.toMiddleware];if(b===void 0){if(u)return;throw new Error(`${x.toMiddleware} is not found when adding ${ho(x.name,x.aliases)} middleware ${x.relation} ${x.toMiddleware}`)}x.relation==="after"&&b.after.push(x),x.relation==="before"&&b.before.push(x)}}),i(d).map(l).reduce((x,b)=>(x.push(...b),x),[])},f={add:(u,d={})=>{const{name:h,override:p,aliases:m}=d,x={step:"initialize",priority:"normal",middleware:u,...d},b=ca(h,m);if(b.length>0){if(b.some(w=>n.has(w))){if(!p)throw new Error(`Duplicate middleware name '${ho(h,m)}'`);for(const w of b){const E=t.findIndex(N=>{var I;return N.name===w||((I=N.aliases)==null?void 0:I.some(j=>j===w))});if(E===-1)continue;const P=t[E];if(P.step!==x.step||x.priority!==P.priority)throw new Error(`"${ho(P.name,P.aliases)}" middleware with ${P.priority} priority in ${P.step} step cannot be overridden by "${ho(h,m)}" middleware with ${x.priority} priority in ${x.step} step.`);t.splice(E,1)}}for(const w of b)n.add(w)}t.push(x)},addRelativeTo:(u,d)=>{const{name:h,override:p,aliases:m}=d,x={middleware:u,...d},b=ca(h,m);if(b.length>0){if(b.some(w=>n.has(w))){if(!p)throw new Error(`Duplicate middleware name '${ho(h,m)}'`);for(const w of b){const E=e.findIndex(N=>{var I;return N.name===w||((I=N.aliases)==null?void 0:I.some(j=>j===w))});if(E===-1)continue;const P=e[E];if(P.toMiddleware!==x.toMiddleware||P.relation!==x.relation)throw new Error(`"${ho(P.name,P.aliases)}" middleware ${P.relation} "${P.toMiddleware}" middleware cannot be overridden by "${ho(h,m)}" middleware ${x.relation} "${x.toMiddleware}" middleware.`);e.splice(E,1)}}for(const w of b)n.add(w)}e.push(x)},clone:()=>a(E0()),use:u=>{u.applyToStack(f)},remove:u=>typeof u=="string"?s(u):o(u),removeByTag:u=>{let d=!1;const h=p=>{const{tags:m,name:x,aliases:b}=p;if(m&&m.includes(u)){const w=ca(x,b);for(const E of w)n.delete(E);return d=!0,!1}return!0};return t=t.filter(h),e=e.filter(h),d},concat:u=>{var h;const d=a(E0());return d.use(u),d.identifyOnResolve(r||d.identifyOnResolve()||(((h=u.identifyOnResolve)==null?void 0:h.call(u))??!1)),d},applyToStack:a,identify:()=>c(!0).map(u=>{const d=u.step??u.relation+" "+u.toMiddleware;return ho(u.name,u.aliases)+" - "+d}),identifyOnResolve(u){return typeof u=="boolean"&&(r=u),r},resolve:(u,d)=>{for(const h of c().map(p=>p.middleware).reverse())u=h(u,d);return r&&console.log(f.identify()),u}};return f},vA={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},pA={high:3,normal:2,low:1};class fJ{constructor(e){this.middlewareStack=E0(),this.config=e}send(e,r,n){const i=typeof r!="function"?r:void 0,s=typeof r=="function"?r:n,o=e.resolveMiddleware(this.middlewareStack,this.config,i);if(s)o(e).then(a=>s(null,a.output),a=>s(a)).catch(()=>{});else return o(e).then(a=>a.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}const Jo={},Oc=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);Jo[n]=t,Oc[t]=n}for(let t=0,e="a".charCodeAt(0),r="z".charCodeAt(0);t+e<=r;t++){const n=String.fromCharCode(t+e),i=t+26;Jo[n]=i,Oc[i]=n}for(let t=0;t<10;t++){Jo[t.toString(10)]=t+52;const e=t.toString(10),r=t+52;Jo[e]=r,Oc[r]=e}Jo["+"]=62;Oc[62]="+";Jo["/"]=63;Oc[63]="/";const Gl=6,If=8,uJ=63,qx=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 i=0;i>=Gl;const a=i/4*3;s>>=o%If;const l=Math.floor(o/If);for(let c=0;c>f)}}return new Uint8Array(r)},hc=t=>new TextEncoder().encode(t),Of=t=>typeof t=="string"?hc(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),Y_=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 Q_(t){let e;typeof t=="string"?e=hc(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 i="";for(let s=0;s>f]}i+="==".slice(0,4-l)}return i}function dJ(t,e="utf-8"){return e==="base64"?Q_(t):Y_(t)}function hJ(t,e){return e==="base64"?Ma.mutate(qx(t)):Ma.mutate(hc(t))}class Ma extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return hJ(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,Ma.prototype),e}transformToString(e="utf-8"){return dJ(this,e)}}const _o=t=>encodeURIComponent(t).replace(/[!'()*]/g,vJ),vJ=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`;function pJ(t){const e=[];for(let r of Object.keys(t).sort()){const n=t[r];if(r=_o(r),Array.isArray(n))for(let i=0,s=n.length;i{t&&setTimeout(()=>{const n=new Error(`Request did not complete within ${t} ms`);n.name="TimeoutError",r(n)},t)})}const op={supported:void 0};class Hx{static create(e){return typeof(e==null?void 0:e.handle)=="function"?e:new Hx(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),op.supported===void 0&&(op.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,i=this.config.keepAlive===!0,s=this.config.credentials;if(r!=null&&r.aborted){const b=new Error("Request aborted");return b.name="AbortError",Promise.reject(b)}let o=e.path;const a=pJ(e.query||{});a&&(o+=`?${a}`),e.fragment&&(o+=`#${e.fragment}`);let l="";if(e.username!=null||e.password!=null){const b=e.username??"",w=e.password??"";l=`${b}:${w}@`}const{port:c,method:f}=e,u=`${e.protocol}//${l}${e.hostname}${c?`:${c}`:""}${o}`,d=f==="GET"||f==="HEAD"?void 0:e.body,h={body:d,headers:new Headers(e.headers),method:f,credentials:s};d&&(h.duplex="half"),typeof AbortController<"u"&&(h.signal=r),op.supported&&(h.keepalive=i);let p=()=>{};const m=new Request(u,h),x=[fetch(m).then(b=>{const w=b.headers,E={};for(const N of w.entries())E[N[0]]=N[1];return b.body!=null?{response:new g0({headers:E,reason:b.statusText,statusCode:b.status,body:b.body})}:b.blob().then(N=>({response:new g0({headers:E,reason:b.statusText,statusCode:b.status,body:N})}))}),yJ(n)];return r&&x.push(new Promise((b,w)=>{const E=()=>{const P=new Error("Request aborted");P.name="AbortError",w(P)};if(typeof r.addEventListener=="function"){const P=r;P.addEventListener("abort",E,{once:!0}),p=()=>P.removeEventListener("abort",E)}else r.onabort=E})),Promise.race(x).finally(p)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}const mJ=t=>typeof Blob=="function"&&t instanceof Blob?gJ(t):xJ(t);async function gJ(t){const e=await bJ(t),r=qx(e);return new Uint8Array(r)}async function xJ(t){const e=[],r=t.getReader();let n=!1,i=0;for(;!n;){const{done:a,value:l}=await r.read();l&&(e.push(l),i+=l.length),n=a}const s=new Uint8Array(i);let o=0;for(const a of e)s.set(a,o),o+=a.length;return s}function bJ(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 i=n.result??"",s=i.indexOf(","),o=s>-1?s+1:i.length;e(i.substring(o))},n.onabort=()=>r(new Error("Read aborted")),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}const J_={},fm={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),J_[t]=e,fm[e]=t}function wJ(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 Ma.mutate(t);if(!t)return Ma.mutate(new Uint8Array);const r=e.streamCollector(t);return Ma.mutate(await r)};class P1{constructor(){this.middlewareStack=E0()}static classBuilder(){return new SJ}resolveMiddlewareWithContext(e,r,n,{middlewareFn:i,clientName:s,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:l,smithyContext:c,additionalContext:f,CommandCtor:u}){for(const x of i.bind(this)(u,e,r,n))this.middlewareStack.use(x);const d=e.concat(this.middlewareStack),{logger:h}=r,p={logger:h,clientName:s,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:l,[lm]:{commandInstance:this,...c},...f},{requestHandler:m}=r;return d.resolve(x=>m.handle(x.request,n||{}),p)}}class SJ{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 P1{static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=n??{},e._init(this)}resolveMiddleware(n,i,s){return this.resolveMiddlewareWithContext(n,i,s,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}const Lr="***SensitiveInformation***";class Wx extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,Wx.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const Le=(t,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,i])=>{(t[n]==null||t[n]==="")&&(t[n]=i)});const r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t},kJ=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{const i=CJ(t),s=i.httpStatusCode?i.httpStatusCode+"":void 0,o=new r({name:(e==null?void 0:e.code)||(e==null?void 0:e.Code)||n||s||"UnknownError",$fault:"client",$metadata:i});throw Le(o,e)},AJ=t=>({output:e,parsedBody:r,errorCode:n})=>{kJ({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},CJ=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"]}),_J=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{}}},TJ=t=>{const e=[];for(const r in m0){const n=m0[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}}},PJ=t=>{const e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},RJ=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},IJ=t=>{const e={};return e.retryStrategy=t.retryStrategy(),e},OJ=t=>({...TJ(t),...RJ(t)}),MJ=t=>({...PJ(t),...IJ(t)}),um=function(){const t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};um.prototype=Object.create(String.prototype,{constructor:{value:um,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(um,String);const Te=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(Te);if(typeof t=="object"){const e={};for(const r of Object.keys(t))t[r]!=null&&(e[r]=Te(t[r]));return e}return t},NJ=t=>(t==null?void 0:t.body)instanceof ReadableStream,$J=t=>(e,r)=>async n=>{var o;let i=await t.retryStrategy();const s=await t.maxAttempts();if(DJ(i)){i=i;let a=await i.acquireInitialRetryToken(r.partition_id),l=new Error,c=0,f=0;const{request:u}=n,d=Yn.isInstance(u);for(d&&(u.headers[ZQ]=aJ());;)try{d&&(u.headers[eJ]=`attempt=${c+1}; max=${s}`);const{response:h,output:p}=await e(n);return i.recordSuccess(a),p.$metadata.attempts=c+1,p.$metadata.totalRetryDelay=f,{response:h,output:p}}catch(h){const p=LJ(h);if(l=lJ(h),d&&NJ(u))throw(o=r.logger instanceof K_?console:r.logger)==null||o.warn("An error was encountered in a non-retryable streaming request."),l;try{a=await i.refreshRetryTokenForRetry(a,p)}catch{throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=c+1,l.$metadata.totalRetryDelay=f,l}c=a.getRetryCount();const m=a.getRetryDelay();f+=m,await new Promise(x=>setTimeout(x,m))}}else return i=i,i!=null&&i.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(e,n)},DJ=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",LJ=t=>{const e={error:t,errorType:jJ(t)},r=BJ(t.$response);return r&&(e.retryAfterHint=r),e},jJ=t=>q_(t)?"THROTTLING":H_(t)?"TRANSIENT":GQ(t)?"SERVER_ERROR":"CLIENT_ERROR",X_={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},FJ=t=>({applyToStack:e=>{e.add($J(t),X_)}}),BJ=t=>{if(!g0.isInstance(t))return;const e=Object.keys(t.headers).find(s=>s.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)},UJ={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:X_.name},zJ=t=>({applyToStack:e=>{e.addRelativeTo(BQ(),UJ)}});class VJ{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 qJ{async sign(e,r,n){return e}}const HJ=t=>e=>Z_(e)&&e.expiration.getTime()-Date.now()t.expiration!==void 0,KJ=(t,e,r)=>{if(t===void 0)return;const n=typeof t!="function"?async()=>Promise.resolve(t):t;let i,s,o,a=!1;const l=async c=>{s||(s=n(c));try{i=await s,o=!0,a=!1}finally{s=void 0}return i};return e===void 0?async c=>((!o||c!=null&&c.forceRefresh)&&(i=await l(c)),i):async c=>((!o||c!=null&&c.forceRefresh)&&(i=await l(c)),a?i:r(i)?(e(i)&&await l(c),i):(a=!0,i))},Rd=t=>{if(typeof t=="function")return t;const e=Promise.resolve(t);return()=>e},yA="content-length";function YJ(t){return e=>async r=>{const n=r.request;if(Yn.isInstance(n)){const{body:i,headers:s}=n;if(i&&Object.keys(s).map(o=>o.toLowerCase()).indexOf(yA)===-1)try{const o=t(i);n.headers={...n.headers,[yA]:String(o)}}catch{}}return e({...r,request:n})}}const QJ={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},JJ=t=>({applyToStack:e=>{e.add(YJ(t.bodyLengthChecker),QJ)}}),mA=t=>{var e,r;return g0.isInstance(t)?((e=t.headers)==null?void 0:e.date)??((r=t.headers)==null?void 0:r.Date):void 0},eT=t=>new Date(Date.now()+t),XJ=(t,e)=>Math.abs(eT(e).getTime()-t)>=3e5,gA=(t,e)=>{const r=Date.parse(t);return XJ(r,e)?r-Date.now():e},Mf=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},ZJ=async t=>{var c,f,u;const e=Mf("context",t.context),r=Mf("config",t.config),n=(u=(f=(c=e.endpointV2)==null?void 0:c.properties)==null?void 0:f.authSchemes)==null?void 0:u[0],s=await Mf("signer",r.signer)(n),o=t==null?void 0:t.signingRegion,a=t==null?void 0:t.signingRegionSet,l=t==null?void 0:t.signingName;return{config:r,signer:s,signingRegion:o,signingRegionSet:a,signingName:l}};class eX{async sign(e,r,n){var u;if(!Yn.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await ZJ(n),{config:s,signer:o}=i;let{signingRegion:a,signingName:l}=i;const c=n.context;if(((u=c==null?void 0:c.authSchemes)==null?void 0:u.length)??0>1){const[d,h]=c.authSchemes;(d==null?void 0:d.name)==="sigv4a"&&(h==null?void 0:h.name)==="sigv4"&&(a=(h==null?void 0:h.signingRegion)??a,l=(h==null?void 0:h.signingName)??l)}return await o.sign(e,{signingDate:eT(s.systemClockOffset),signingRegion:a,signingService:l})}errorHandler(e){return r=>{const n=r.ServerTime??mA(r.$response);if(n){const i=Mf("config",e.config),s=i.systemClockOffset;i.systemClockOffset=gA(n,i.systemClockOffset),i.systemClockOffset!==s&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){const n=mA(e);if(n){const i=Mf("config",r.config);i.systemClockOffset=gA(n,i.systemClockOffset)}}}const tX=(t,e,r)=>{let n,i,s,o=!1;const a=async()=>{i||(i=t());try{n=await i,s=!0,o=!1}finally{i=void 0}return n};return e===void 0?async l=>((!s||l!=null&&l.forceRefresh)&&(n=await a()),n):async l=>((!s||l!=null&&l.forceRefresh)&&(n=await a()),o?n:r&&!r(n)?(o=!0,n):(e(n)&&await a(),n))},rX="X-Amz-Algorithm",nX="X-Amz-Credential",tT="X-Amz-Date",iX="X-Amz-SignedHeaders",sX="X-Amz-Expires",rT="X-Amz-Signature",nT="X-Amz-Security-Token",iT="authorization",sT=tT.toLowerCase(),oX="date",aX=[iT,sT,oX],lX=rT.toLowerCase(),dm="x-amz-content-sha256",cX=nT.toLowerCase(),fX={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},uX=/^proxy-/,dX=/^sec-/,ap="AWS4-HMAC-SHA256",hX="AWS4-HMAC-SHA256-PAYLOAD",vX="UNSIGNED-PAYLOAD",pX=50,oT="aws4_request",yX=60*60*24*7,Id={},lp=[],cp=(t,e,r)=>`${t}/${e}/${r}/${oT}`,mX=async(t,e,r,n,i)=>{const s=await xA(t,e.secretAccessKey,e.accessKeyId),o=`${r}:${n}:${i}:${ka(s)}:${e.sessionToken}`;if(o in Id)return Id[o];for(lp.push(o);lp.length>pX;)delete Id[lp.shift()];let a=`AWS4${e.secretAccessKey}`;for(const l of[r,n,i,oT])a=await xA(t,a,l);return Id[o]=a},xA=(t,e,r)=>{const n=new t(e);return n.update(Of(r)),n.digest()},bA=({headers:t},e,r)=>{const n={};for(const i of Object.keys(t).sort()){if(t[i]==null)continue;const s=i.toLowerCase();(s in fX||e!=null&&e.has(s)||uX.test(s)||dX.test(s))&&(!r||r&&!r.has(s))||(n[s]=t[i].trim().replace(/\s+/g," "))}return n},gX=({query:t={}})=>{const e=[],r={};for(const n of Object.keys(t).sort()){if(n.toLowerCase()===lX)continue;e.push(n);const i=t[n];typeof i=="string"?r[n]=`${_o(n)}=${_o(i)}`:Array.isArray(i)&&(r[n]=i.slice(0).reduce((s,o)=>s.concat([`${_o(n)}=${_o(o)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")},xX=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]",fp=async({headers:t,body:e},r)=>{for(const n of Object.keys(t))if(n.toLowerCase()===dm)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||xX(e)){const n=new r;return n.update(Of(e)),ka(await n.digest())}return vX};class bX{format(e){const r=[];for(const s of Object.keys(e)){const o=hc(s);r.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(e[s]))}const n=new Uint8Array(r.reduce((s,o)=>s+o.byteLength,0));let i=0;for(const s of r)n.set(s,i),i+=s.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 i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,6),s.setUint16(1,e.value.byteLength,!1);const o=new Uint8Array(s.buffer);return o.set(e.value,3),o;case"string":const a=hc(e.value),l=new DataView(new ArrayBuffer(3+a.byteLength));l.setUint8(0,7),l.setUint16(1,a.byteLength,!1);const c=new Uint8Array(l.buffer);return c.set(a,3),c;case"timestamp":const f=new Uint8Array(9);return f[0]=8,f.set(Gx.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!wX.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const u=new Uint8Array(17);return u[0]=9,u.set(wJ(e.value.replace(/\-/g,"")),1),u}}}var wA;(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"})(wA||(wA={}));const wX=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Gx{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,i=Math.abs(Math.round(e));n>-1&&i>0;n--,i/=256)r[n]=i;return e<0&&EA(r),new Gx(r)}valueOf(){const e=this.bytes.slice(0),r=e[0]&128;return r&&EA(e),parseInt(ka(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}function EA(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}const EX=(t,e)=>{t=t.toLowerCase();for(const r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1},SX=(t,e={})=>{var i;const{headers:r,query:n={}}=Yn.clone(t);for(const s of Object.keys(r)){const o=s.toLowerCase();o.slice(0,6)==="x-amz-"&&!((i=e.unhoistableHeaders)!=null&&i.has(o))&&(n[s]=r[s],delete r[s])}return{...t,headers:r,query:n}},SA=t=>{t=Yn.clone(t);for(const e of Object.keys(t.headers))aX.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},kX=t=>AX(t).toISOString().replace(/\.\d{3}Z$/,"Z"),AX=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t;class kA{constructor({applyChecksum:e,credentials:r,region:n,service:i,sha256:s,uriEscapePath:o=!0}){this.headerFormatter=new bX,this.service=i,this.sha256=s,this.uriEscapePath=o,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Bo(n),this.credentialProvider=Bo(r)}async presign(e,r={}){const{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:s,unhoistableHeaders:o,signableHeaders:a,signingRegion:l,signingService:c}=r,f=await this.credentialProvider();this.validateResolvedCredentials(f);const u=l??await this.regionProvider(),{longDate:d,shortDate:h}=Od(n);if(i>yX)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const p=cp(h,u,c??this.service),m=SX(SA(e),{unhoistableHeaders:o});f.sessionToken&&(m.query[nT]=f.sessionToken),m.query[rX]=ap,m.query[nX]=`${f.accessKeyId}/${p}`,m.query[tT]=d,m.query[sX]=i.toString(10);const x=bA(m,s,a);return m.query[iX]=AA(x),m.query[rT]=await this.getSignature(d,p,this.getSigningKey(f,u,h,c),this.createCanonicalRequest(m,x,await fp(e,this.sha256))),m}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:i,signingRegion:s,signingService:o}){const a=s??await this.regionProvider(),{shortDate:l,longDate:c}=Od(n),f=cp(l,a,o??this.service),u=await fp({headers:{},body:r},this.sha256),d=new this.sha256;d.update(e);const h=ka(await d.digest()),p=[hX,c,f,i,h,u].join(` `);return this.signString(p,{signingDate:n,signingRegion:a,signingService:o})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:i,priorSignature:e.priorSignature}).then(o=>({message:e.message,signature:o}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:i}={}){const s=await this.credentialProvider();this.validateResolvedCredentials(s);const o=n??await this.regionProvider(),{shortDate:a}=Od(r),l=new this.sha256(await this.getSigningKey(s,o,a,i));return l.update(Of(e)),ka(await l.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:s,signingService:o}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const l=s??await this.regionProvider(),c=SA(e),{longDate:f,shortDate:u}=Od(r),d=cp(u,l,o??this.service);c.headers[sT]=f,a.sessionToken&&(c.headers[cX]=a.sessionToken);const h=await fp(c,this.sha256);!EX(dm,c.headers)&&this.applyChecksum&&(c.headers[dm]=h);const p=bA(c,i,n),m=await this.getSignature(f,d,this.getSigningKey(a,l,u,o),this.createCanonicalRequest(c,p,h));return c.headers[iT]=`${ap} Credential=${a.accessKeyId}/${d}, SignedHeaders=${AA(p)}, Signature=${m}`,c}createCanonicalRequest(e,r,n){const i=Object.keys(r).sort();return`${e.method} @@ -181,18 +181,18 @@ ${i.join(";")} ${n}`}async createStringToSign(e,r,n){const i=new this.sha256;i.update(Of(n));const s=await i.digest();return`${ap} ${e} ${r} -${ka(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const r=[];for(const s of e.split("/"))(s==null?void 0:s.length)!==0&&s!=="."&&(s===".."?r.pop():r.push(s));const n=`${e!=null&&e.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&(e!=null&&e.endsWith("/"))?"/":""}`;return _o(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,i){const s=await this.createStringToSign(e,r,i),o=new this.sha256(await n);return o.update(Of(s)),ka(await o.digest())}getSigningKey(e,r,n,i){return mX(this.sha256,e,n,r,i||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 Od=t=>{const e=kX(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},AA=t=>Object.keys(t).sort().join(";"),CX=t=>{let e;t.credentials&&(e=KJ(t.credentials,GJ,Z_)),e||(t.credentialDefaultProvider?e=Rd(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:i}=t;let s;return t.signer?s=Rd(t.signer):t.regionInfoProvider?s=()=>Rd(t.region)().then(async o=>[await t.regionInfoProvider(o,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},o]).then(([o,a])=>{const{signingRegion:l,signingService:c}=o;t.signingRegion=t.signingRegion||l||a,t.signingName=t.signingName||c||t.serviceId;const f={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:r},u=t.signerConstructor||kA;return new u(f)}):s=async o=>{o=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await Rd(t.region)(),properties:{}},o);const a=o.signingRegion,l=o.signingName;t.signingRegion=t.signingRegion||a,t.signingName=t.signingName||l||t.serviceId;const c={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:r},f=t.signerConstructor||kA;return new f(c)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:s}},_X=(t,e)=>EJ(t,e).then(r=>e.utf8Encoder(r)),R1=(t,e)=>_X(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{}}),TX=async(t,e)=>{const r=await R1(t,e);return r.message=r.message??r.Message,r},PX=(t,e)=>{const r=(s,o)=>Object.keys(s).find(a=>a.toLowerCase()===o.toLowerCase()),n=s=>{let o=s;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},i=r(t.headers,"x-amzn-errortype");if(i!==void 0)return n(t.headers[i]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)},RX=async(t,e,r)=>({operation:T1(e).operation,region:await Bo(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function IX(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-idp",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function jt(t){return{schemeId:"smithy.api#noAuth"}}const OX=t=>{const e=[];switch(t.operation){case"AssociateSoftwareToken":{e.push(jt());break}case"ChangePassword":{e.push(jt());break}case"ConfirmDevice":{e.push(jt());break}case"ConfirmForgotPassword":{e.push(jt());break}case"ConfirmSignUp":{e.push(jt());break}case"DeleteUser":{e.push(jt());break}case"DeleteUserAttributes":{e.push(jt());break}case"ForgetDevice":{e.push(jt());break}case"ForgotPassword":{e.push(jt());break}case"GetDevice":{e.push(jt());break}case"GetUser":{e.push(jt());break}case"GetUserAttributeVerificationCode":{e.push(jt());break}case"GlobalSignOut":{e.push(jt());break}case"InitiateAuth":{e.push(jt());break}case"ListDevices":{e.push(jt());break}case"ResendConfirmationCode":{e.push(jt());break}case"RespondToAuthChallenge":{e.push(jt());break}case"RevokeToken":{e.push(jt());break}case"SetUserMFAPreference":{e.push(jt());break}case"SetUserSettings":{e.push(jt());break}case"SignUp":{e.push(jt());break}case"UpdateAuthEventFeedback":{e.push(jt());break}case"UpdateDeviceStatus":{e.push(jt());break}case"UpdateUserAttributes":{e.push(jt());break}case"VerifySoftwareToken":{e.push(jt());break}case"VerifyUserAttribute":{e.push(jt());break}default:e.push(IX(t))}return e},MX=t=>({...CX(t)}),NX=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-idp"}),Kx={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},$X="@aws-sdk/client-cognito-identity-provider",DX="AWS SDK for JavaScript Cognito Identity Provider Client for Node.js, Browser and React Native",LX="3.631.0",jX={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"},FX="./dist-cjs/index.js",BX="./dist-types/index.d.ts",UX="./dist-es/index.js",zX=!1,VX={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.631.0","@aws-sdk/client-sts":"3.631.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.631.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.631.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.631.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.3.2","@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.14","@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.1.12","@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.14","@smithy/util-defaults-mode-node":"^3.0.14","@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"},qX={"@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"},HX={node:">=16.0.0"},WX={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},GX=["dist-*/**"],KX={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},YX="Apache-2.0",QX={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},JX="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity-provider",XX={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity-provider"},ZX={name:$X,description:DX,version:LX,scripts:jX,main:FX,types:BX,module:UX,sideEffects:zX,dependencies:VX,devDependencies:qX,engines:HX,typesVersions:WX,files:GX,author:KX,license:YX,browser:QX,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:JX,repository:XX},eZ=t=>new TextEncoder().encode(t);var tZ=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:eZ;function gu(t){return t instanceof Uint8Array?t:typeof t=="string"?tZ(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}function hm(t){return typeof t=="string"?t.length===0:t.byteLength===0}var aT={name:"SHA-256"},CA={name:"HMAC",hash:aT},rZ=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 nZ={};function dh(){return typeof window<"u"?window:typeof self<"u"?self:nZ}var iZ=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!hm(e)){var r=gu(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 dh().crypto.subtle.sign(CA,r,e.toHash).then(function(n){return new Uint8Array(n)})}):hm(this.toHash)?Promise.resolve(rZ):Promise.resolve().then(function(){return dh().crypto.subtle.digest(aT,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){dh().crypto.subtle.importKey("raw",gu(e.secret),CA,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}();function sZ(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function oZ(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(f){return l([c,f])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]fZ)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[r++],n--,this.bufferLength===li&&(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%li>=li-8){for(var i=this.bufferLength;i>>24&255,s[i*4+1]=this.state[i]>>>16&255,s[i*4+2]=this.state[i]>>>8&255,s[i*4+3]=this.state[i]>>>0&255;return s},t.prototype.hashBuffer=function(){for(var e=this,r=e.buffer,n=e.state,i=n[0],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],f=n[6],u=n[7],d=0;d>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=this.temp[d-15];var m=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(m+this.temp[d-16]|0)}var x=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&c^~l&f)|0)+(u+(lZ[d]+this.temp[d]|0)|0)|0,b=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&s^i&o^s&o)|0;u=f,f=c,c=l,l=a+x|0,a=o,o=s,s=i,i=x+b|0}n[0]+=i,n[1]+=s,n[2]+=o,n[3]+=a,n[4]+=l,n[5]+=c,n[6]+=f,n[7]+=u},t}(),uZ=function(){function t(e){this.secret=e,this.hash=new hh,this.reset()}return t.prototype.update=function(e){if(!(hm(e)||this.error))try{this.hash.update(gu(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 sZ(this,void 0,void 0,function(){return oZ(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new hh,this.secret){this.outer=new hh;var e=dZ(this.secret),r=new Uint8Array(li);r.set(e);for(var n=0;nli){var r=new hh;r.update(e),e=r.digest()}var n=new Uint8Array(li);return n.set(e),n}var hZ=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function vZ(t){if(pZ(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return yZ(e)}return!1}function pZ(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function yZ(t){return t&&hZ.every(function(e){return typeof t[e]=="function"})}var mZ=function(){function t(e){vZ(dh())?this.hash=new iZ(e):this.hash=new uZ(e)}return t.prototype.update=function(e,r){this.hash.update(gu(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}();const gZ={"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"},lT={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"},ur={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},fn={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"},mo={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class oe{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 i=oe.getVersionPrecision(e),s=oe.getVersionPrecision(r);let o=Math.max(i,s),a=0;const l=oe.map([e,r],c=>{const f=o-oe.getVersionPrecision(c),u=c+new Array(f+1).join(".0");return oe.map(u.split("."),d=>new Array(20-d.length).join("0")+d).reverse()});for(n&&(a=o-Math.min(i,s)),o-=1;o>=a;){if(l[0][o]>l[1][o])return 1;if(l[0][o]===l[1][o]){if(o===a)return 0;o-=1}else if(l[0][o]{n[l]=o[l]})}return e}static getBrowserAlias(e){return gZ[e]}static getBrowserTypeByAlias(e){return lT[e]||""}}const Nt=/version\/(\d+(\.?_?\d+)+)/i,xZ=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},r=oe.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},r=oe.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},r=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},r=oe.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},r=oe.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},r=oe.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},r=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},r=oe.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},r=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},r=oe.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,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=oe.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},r=oe.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},r=oe.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=oe.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},r=oe.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},r=oe.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},r=oe.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=oe.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},r=oe.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},r=oe.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=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},r=oe.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},r=oe.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},r=oe.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=oe.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},r=oe.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},r=oe.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},r=oe.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=oe.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=oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},r=oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},r=oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,r=/^(.*)\/(.*)[ \t]\((.*)/,i=t.search("\\(")!==-1?r:e;return{name:oe.getFirstMatch(i,t),version:oe.getSecondMatch(i,t)}}}],bZ=[{test:[/Roku\/DVP/],describe(t){const e=oe.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:fn.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=oe.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:fn.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=oe.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=oe.getWindowsVersionName(e);return{name:fn.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:fn.iOS},r=oe.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe(t){const e=oe.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=oe.getMacOSVersionName(e),n={name:fn.MacOS,version:e};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=oe.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:fn.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e=oe.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=oe.getAndroidVersionName(e),n={name:fn.Android,version:e};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=oe.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:fn.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=oe.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||oe.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||oe.getFirstMatch(/\bbb(\d+)/i,t);return{name:fn.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=oe.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:fn.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=oe.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:fn.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:fn.Linux}}},{test:[/CrOS/],describe(){return{name:fn.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=oe.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:fn.PlayStation4,version:e}}}],wZ=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(t){const e=oe.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:ur.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:ur.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:ur.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:ur.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:ur.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:ur.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:ur.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe(t){const e=oe.getFirstMatch(/(ipod|iphone)/i,t);return{type:ur.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:ur.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:ur.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:ur.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:ur.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:ur.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:ur.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:ur.mobile}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:ur.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:ur.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:ur.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:ur.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:ur.tv}}}],EZ=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:mo.Blink};const r=oe.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:mo.EdgeHTML,version:r}}},{test:[/trident/i],describe(t){const e={name:mo.Trident},r=oe.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:mo.Presto},r=oe.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:mo.Gecko},r=oe.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:mo.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:mo.WebKit},r=oe.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];class _A{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=oe.find(xZ,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=oe.find(bZ,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=oe.find(wZ,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=oe.find(EZ,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 oe.assign({},this.parsedResult)}satisfies(e){const r={};let n=0;const i={};let s=0;if(Object.keys(e).forEach(a=>{const l=e[a];typeof l=="string"?(i[a]=l,s+=1):typeof l=="object"&&(r[a]=l,n+=1)}),n>0){const a=Object.keys(r),l=oe.find(a,f=>this.isOS(f));if(l){const f=this.satisfies(r[l]);if(f!==void 0)return f}const c=oe.find(a,f=>this.isPlatform(f));if(c){const f=this.satisfies(r[c]);if(f!==void 0)return f}}if(s>0){const a=Object.keys(i),l=oe.find(a,c=>this.isBrowser(c,!0));if(l!==void 0)return this.compareVersion(i[l])}}isBrowser(e,r=!1){const n=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const s=oe.getBrowserTypeByAlias(i);return r&&s&&(i=s.toLowerCase()),i===n}compareVersion(e){let r=[0],n=e,i=!1;const s=this.getBrowserVersion();if(typeof s=="string")return e[0]===">"||e[0]==="<"?(n=e.substr(1),e[1]==="="?(i=!0,n=e.substr(2)):r=[],e[0]===">"?r.push(1):r.push(-1)):e[0]==="="?n=e.substr(1):e[0]==="~"&&(i=!0,n=e.substr(1)),r.indexOf(oe.compareVersions(s,n,i))>-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))}}/*! +${ka(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const r=[];for(const s of e.split("/"))(s==null?void 0:s.length)!==0&&s!=="."&&(s===".."?r.pop():r.push(s));const n=`${e!=null&&e.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&(e!=null&&e.endsWith("/"))?"/":""}`;return _o(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,i){const s=await this.createStringToSign(e,r,i),o=new this.sha256(await n);return o.update(Of(s)),ka(await o.digest())}getSigningKey(e,r,n,i){return mX(this.sha256,e,n,r,i||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 Od=t=>{const e=kX(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},AA=t=>Object.keys(t).sort().join(";"),CX=t=>{let e;t.credentials&&(e=KJ(t.credentials,GJ,Z_)),e||(t.credentialDefaultProvider?e=Rd(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:i}=t;let s;return t.signer?s=Rd(t.signer):t.regionInfoProvider?s=()=>Rd(t.region)().then(async o=>[await t.regionInfoProvider(o,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},o]).then(([o,a])=>{const{signingRegion:l,signingService:c}=o;t.signingRegion=t.signingRegion||l||a,t.signingName=t.signingName||c||t.serviceId;const f={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:r},u=t.signerConstructor||kA;return new u(f)}):s=async o=>{o=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await Rd(t.region)(),properties:{}},o);const a=o.signingRegion,l=o.signingName;t.signingRegion=t.signingRegion||a,t.signingName=t.signingName||l||t.serviceId;const c={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:r},f=t.signerConstructor||kA;return new f(c)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:s}},_X=(t,e)=>EJ(t,e).then(r=>e.utf8Encoder(r)),R1=(t,e)=>_X(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{}}),TX=async(t,e)=>{const r=await R1(t,e);return r.message=r.message??r.Message,r},PX=(t,e)=>{const r=(s,o)=>Object.keys(s).find(a=>a.toLowerCase()===o.toLowerCase()),n=s=>{let o=s;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},i=r(t.headers,"x-amzn-errortype");if(i!==void 0)return n(t.headers[i]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)},RX=async(t,e,r)=>({operation:T1(e).operation,region:await Bo(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function IX(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-idp",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function jt(t){return{schemeId:"smithy.api#noAuth"}}const OX=t=>{const e=[];switch(t.operation){case"AssociateSoftwareToken":{e.push(jt());break}case"ChangePassword":{e.push(jt());break}case"ConfirmDevice":{e.push(jt());break}case"ConfirmForgotPassword":{e.push(jt());break}case"ConfirmSignUp":{e.push(jt());break}case"DeleteUser":{e.push(jt());break}case"DeleteUserAttributes":{e.push(jt());break}case"ForgetDevice":{e.push(jt());break}case"ForgotPassword":{e.push(jt());break}case"GetDevice":{e.push(jt());break}case"GetUser":{e.push(jt());break}case"GetUserAttributeVerificationCode":{e.push(jt());break}case"GlobalSignOut":{e.push(jt());break}case"InitiateAuth":{e.push(jt());break}case"ListDevices":{e.push(jt());break}case"ResendConfirmationCode":{e.push(jt());break}case"RespondToAuthChallenge":{e.push(jt());break}case"RevokeToken":{e.push(jt());break}case"SetUserMFAPreference":{e.push(jt());break}case"SetUserSettings":{e.push(jt());break}case"SignUp":{e.push(jt());break}case"UpdateAuthEventFeedback":{e.push(jt());break}case"UpdateDeviceStatus":{e.push(jt());break}case"UpdateUserAttributes":{e.push(jt());break}case"VerifySoftwareToken":{e.push(jt());break}case"VerifyUserAttribute":{e.push(jt());break}default:e.push(IX(t))}return e},MX=t=>({...CX(t)}),NX=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-idp"}),Kx={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},$X="@aws-sdk/client-cognito-identity-provider",DX="AWS SDK for JavaScript Cognito Identity Provider Client for Node.js, Browser and React Native",LX="3.631.0",jX={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"},FX="./dist-cjs/index.js",BX="./dist-types/index.d.ts",UX="./dist-es/index.js",zX=!1,VX={"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.631.0","@aws-sdk/client-sts":"3.631.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.631.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.631.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.631.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.3.2","@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.14","@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.1.12","@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.14","@smithy/util-defaults-mode-node":"^3.0.14","@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"},qX={"@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"},HX={node:">=16.0.0"},WX={"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},GX=["dist-*/**"],KX={name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},YX="Apache-2.0",QX={"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},JX="https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity-provider",XX={type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity-provider"},ZX={name:$X,description:DX,version:LX,scripts:jX,main:FX,types:BX,module:UX,sideEffects:zX,dependencies:VX,devDependencies:qX,engines:HX,typesVersions:WX,files:GX,author:KX,license:YX,browser:QX,"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:JX,repository:XX},eZ=t=>new TextEncoder().encode(t);var tZ=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:eZ;function gu(t){return t instanceof Uint8Array?t:typeof t=="string"?tZ(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}function hm(t){return typeof t=="string"?t.length===0:t.byteLength===0}var aT={name:"SHA-256"},CA={name:"HMAC",hash:aT},rZ=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 nZ={};function dh(){return typeof window<"u"?window:typeof self<"u"?self:nZ}var iZ=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!hm(e)){var r=gu(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 dh().crypto.subtle.sign(CA,r,e.toHash).then(function(n){return new Uint8Array(n)})}):hm(this.toHash)?Promise.resolve(rZ):Promise.resolve().then(function(){return dh().crypto.subtle.digest(aT,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){dh().crypto.subtle.importKey("raw",gu(e.secret),CA,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}();function sZ(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function oZ(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(f){return l([c,f])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]fZ)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[r++],n--,this.bufferLength===li&&(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%li>=li-8){for(var i=this.bufferLength;i>>24&255,s[i*4+1]=this.state[i]>>>16&255,s[i*4+2]=this.state[i]>>>8&255,s[i*4+3]=this.state[i]>>>0&255;return s},t.prototype.hashBuffer=function(){for(var e=this,r=e.buffer,n=e.state,i=n[0],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],f=n[6],u=n[7],d=0;d>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=this.temp[d-15];var m=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[d]=(p+this.temp[d-7]|0)+(m+this.temp[d-16]|0)}var x=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&c^~l&f)|0)+(u+(lZ[d]+this.temp[d]|0)|0)|0,b=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&s^i&o^s&o)|0;u=f,f=c,c=l,l=a+x|0,a=o,o=s,s=i,i=x+b|0}n[0]+=i,n[1]+=s,n[2]+=o,n[3]+=a,n[4]+=l,n[5]+=c,n[6]+=f,n[7]+=u},t}(),uZ=function(){function t(e){this.secret=e,this.hash=new hh,this.reset()}return t.prototype.update=function(e){if(!(hm(e)||this.error))try{this.hash.update(gu(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 sZ(this,void 0,void 0,function(){return oZ(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new hh,this.secret){this.outer=new hh;var e=dZ(this.secret),r=new Uint8Array(li);r.set(e);for(var n=0;nli){var r=new hh;r.update(e),e=r.digest()}var n=new Uint8Array(li);return n.set(e),n}var hZ=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function vZ(t){if(pZ(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return yZ(e)}return!1}function pZ(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function yZ(t){return t&&hZ.every(function(e){return typeof t[e]=="function"})}var mZ=function(){function t(e){vZ(dh())?this.hash=new iZ(e):this.hash=new uZ(e)}return t.prototype.update=function(e,r){this.hash.update(gu(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}();const gZ={"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"},lT={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"},dr={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},fn={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"},mo={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class oe{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 i=oe.getVersionPrecision(e),s=oe.getVersionPrecision(r);let o=Math.max(i,s),a=0;const l=oe.map([e,r],c=>{const f=o-oe.getVersionPrecision(c),u=c+new Array(f+1).join(".0");return oe.map(u.split("."),d=>new Array(20-d.length).join("0")+d).reverse()});for(n&&(a=o-Math.min(i,s)),o-=1;o>=a;){if(l[0][o]>l[1][o])return 1;if(l[0][o]===l[1][o]){if(o===a)return 0;o-=1}else if(l[0][o]{n[l]=o[l]})}return e}static getBrowserAlias(e){return gZ[e]}static getBrowserTypeByAlias(e){return lT[e]||""}}const Nt=/version\/(\d+(\.?_?\d+)+)/i,xZ=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},r=oe.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},r=oe.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},r=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},r=oe.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},r=oe.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},r=oe.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},r=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},r=oe.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},r=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},r=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(Nt,t)||oe.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},r=oe.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,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=oe.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},r=oe.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},r=oe.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=oe.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},r=oe.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},r=oe.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},r=oe.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=oe.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},r=oe.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},r=oe.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=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(Nt,t)||oe.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=oe.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},r=oe.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},r=oe.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},r=oe.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=oe.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},r=oe.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},r=oe.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},r=oe.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=oe.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=oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},r=oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},r=oe.getFirstMatch(Nt,t);return r&&(e.version=r),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,r=/^(.*)\/(.*)[ \t]\((.*)/,i=t.search("\\(")!==-1?r:e;return{name:oe.getFirstMatch(i,t),version:oe.getSecondMatch(i,t)}}}],bZ=[{test:[/Roku\/DVP/],describe(t){const e=oe.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:fn.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=oe.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:fn.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=oe.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=oe.getWindowsVersionName(e);return{name:fn.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:fn.iOS},r=oe.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe(t){const e=oe.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=oe.getMacOSVersionName(e),n={name:fn.MacOS,version:e};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=oe.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:fn.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e=oe.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=oe.getAndroidVersionName(e),n={name:fn.Android,version:e};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=oe.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:fn.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=oe.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||oe.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||oe.getFirstMatch(/\bbb(\d+)/i,t);return{name:fn.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=oe.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:fn.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=oe.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:fn.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:fn.Linux}}},{test:[/CrOS/],describe(){return{name:fn.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=oe.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:fn.PlayStation4,version:e}}}],wZ=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(t){const e=oe.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:dr.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:dr.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:dr.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:dr.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:dr.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:dr.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:dr.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe(t){const e=oe.getFirstMatch(/(ipod|iphone)/i,t);return{type:dr.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:dr.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe(){return{type:dr.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:dr.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:dr.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:dr.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:dr.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:dr.mobile}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:dr.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:dr.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:dr.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:dr.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:dr.tv}}}],EZ=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:mo.Blink};const r=oe.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:mo.EdgeHTML,version:r}}},{test:[/trident/i],describe(t){const e={name:mo.Trident},r=oe.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:mo.Presto},r=oe.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:mo.Gecko},r=oe.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:mo.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:mo.WebKit},r=oe.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];class _A{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=oe.find(xZ,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=oe.find(bZ,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=oe.find(wZ,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=oe.find(EZ,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 oe.assign({},this.parsedResult)}satisfies(e){const r={};let n=0;const i={};let s=0;if(Object.keys(e).forEach(a=>{const l=e[a];typeof l=="string"?(i[a]=l,s+=1):typeof l=="object"&&(r[a]=l,n+=1)}),n>0){const a=Object.keys(r),l=oe.find(a,f=>this.isOS(f));if(l){const f=this.satisfies(r[l]);if(f!==void 0)return f}const c=oe.find(a,f=>this.isPlatform(f));if(c){const f=this.satisfies(r[c]);if(f!==void 0)return f}}if(s>0){const a=Object.keys(i),l=oe.find(a,c=>this.isBrowser(c,!0));if(l!==void 0)return this.compareVersion(i[l])}}isBrowser(e,r=!1){const n=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const s=oe.getBrowserTypeByAlias(i);return r&&s&&(i=s.toLowerCase()),i===n}compareVersion(e){let r=[0],n=e,i=!1;const s=this.getBrowserVersion();if(typeof s=="string")return e[0]===">"||e[0]==="<"?(n=e.substr(1),e[1]==="="?(i=!0,n=e.substr(2)):r=[],e[0]===">"?r.push(1):r.push(-1)):e[0]==="="?n=e.substr(1):e[0]==="~"&&(i=!0,n=e.substr(1)),r.indexOf(oe.compareVersions(s,n,i))>-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 cT{static getParser(e,r=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new _A(e,r)}static parse(e){return new _A(e).getResult()}static get BROWSER_MAP(){return lT}static get ENGINE_MAP(){return mo}static get OS_MAP(){return fn}static get PLATFORMS_MAP(){return ur}}const SZ=({serviceId:t,clientVersion:e})=>async()=>{var i,s,o,a,l;const r=typeof window<"u"&&((i=window==null?void 0:window.navigator)!=null&&i.userAgent)?cT.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${((s=r==null?void 0:r.os)==null?void 0:s.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"}_${((l=r==null?void 0:r.browser)==null?void 0:l.version)??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n},kZ=t=>()=>Promise.reject(t),TA=typeof TextEncoder=="function"?new TextEncoder:null,AZ=t=>{if(typeof t=="string"){if(TA)return TA.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}`)},fT="required",rs="fn",ns="argv",Mc="ref",PA=!0,RA="isSet",xu="booleanEquals",dl="error",rf="endpoint",ks="tree",Yx="PartitionResult",IA={[fT]:!1,type:"String"},OA={[fT]:!0,default:!1,type:"Boolean"},MA={[Mc]:"Endpoint"},uT={[rs]:xu,[ns]:[{[Mc]:"UseFIPS"},!0]},dT={[rs]:xu,[ns]:[{[Mc]:"UseDualStack"},!0]},Wi={},NA={[rs]:"getAttr",[ns]:[{[Mc]:Yx},"supportsFIPS"]},$A={[rs]:xu,[ns]:[!0,{[rs]:"getAttr",[ns]:[{[Mc]:Yx},"supportsDualStack"]}]},DA=[uT],LA=[dT],jA=[{[Mc]:"Region"}],CZ={version:"1.0",parameters:{Region:IA,UseDualStack:OA,UseFIPS:OA,Endpoint:IA},rules:[{conditions:[{[rs]:RA,[ns]:[MA]}],rules:[{conditions:DA,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:dl},{conditions:LA,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:dl},{endpoint:{url:MA,properties:Wi,headers:Wi},type:rf}],type:ks},{conditions:[{[rs]:RA,[ns]:jA}],rules:[{conditions:[{[rs]:"aws.partition",[ns]:jA,assign:Yx}],rules:[{conditions:[uT,dT],rules:[{conditions:[{[rs]:xu,[ns]:[PA,NA]},$A],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:dl}],type:ks},{conditions:DA,rules:[{conditions:[{[rs]:xu,[ns]:[NA,PA]}],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks},{error:"FIPS is enabled but this partition does not support FIPS",type:dl}],type:ks},{conditions:LA,rules:[{conditions:[$A],rules:[{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks},{error:"DualStack is enabled but this partition does not support DualStack",type:dl}],type:ks},{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks}],type:ks},{error:"Invalid Configuration: Missing Region",type:dl}]},_Z=CZ,TZ=(t,e={})=>nQ(_Z,{endpointParams:t,logger:e.logger});x0.aws=B_;const PZ=t=>({apiVersion:"2016-04-18",base64Decoder:(t==null?void 0:t.base64Decoder)??qx,base64Encoder:(t==null?void 0:t.base64Encoder)??Q_,disableHostPrefix:(t==null?void 0:t.disableHostPrefix)??!1,endpointProvider:(t==null?void 0:t.endpointProvider)??TZ,extensions:(t==null?void 0:t.extensions)??[],httpAuthSchemeProvider:(t==null?void 0:t.httpAuthSchemeProvider)??OX,httpAuthSchemes:(t==null?void 0:t.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new eX},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new qJ}],logger:(t==null?void 0:t.logger)??new K_,serviceId:(t==null?void 0:t.serviceId)??"Cognito Identity Provider",urlParser:(t==null?void 0:t.urlParser)??b0,utf8Decoder:(t==null?void 0:t.utf8Decoder)??hc,utf8Encoder:(t==null?void 0:t.utf8Encoder)??Y_}),RZ=["in-region","cross-region","mobile","standard","legacy"],IZ=({defaultsMode:t}={})=>tX(async()=>{const e=typeof t=="function"?await t():t;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve(OZ()?"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 ${RZ.join(", ")}, got ${e}`)}}),OZ=()=>{var r,n;const t=typeof window<"u"&&((r=window==null?void 0:window.navigator)!=null&&r.userAgent)?cT.parse(window.navigator.userAgent):void 0,e=(n=t==null?void 0:t.platform)==null?void 0:n.type;return e==="tablet"||e==="mobile"},MZ=t=>{const e=IZ(t),r=()=>e().then(_J),n=PZ(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:(t==null?void 0:t.bodyLengthChecker)??AZ,credentialDefaultProvider:(t==null?void 0:t.credentialDefaultProvider)??(i=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(t==null?void 0:t.defaultUserAgentProvider)??SZ({serviceId:n.serviceId,clientVersion:ZX.version}),maxAttempts:(t==null?void 0:t.maxAttempts)??w0,region:(t==null?void 0:t.region)??kZ("Region is missing"),requestHandler:Hx.create((t==null?void 0:t.requestHandler)??r),retryMode:(t==null?void 0:t.retryMode)??(async()=>(await r()).retryMode||UQ),sha256:(t==null?void 0:t.sha256)??mZ,streamCollector:(t==null?void 0:t.streamCollector)??mJ,useDualstackEndpoint:(t==null?void 0:t.useDualstackEndpoint)??(()=>Promise.resolve(pQ)),useFipsEndpoint:(t==null?void 0:t.useFipsEndpoint)??(()=>Promise.resolve(yQ))}},NZ=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}}},$Z=t=>({region:t.region()}),DZ=t=>{const e=t.httpAuthSchemes;let r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(i){const s=e.findIndex(o=>o.schemeId===i.schemeId);s===-1?e.push(i):e.splice(s,1,i)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(i){r=i},httpAuthSchemeProvider(){return r},setCredentials(i){n=i},credentials(){return n}}},LZ=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()}),Md=t=>t,jZ=(t,e)=>{const r={...Md(NZ(t)),...Md(OJ(t)),...Md(kY(t)),...Md(DZ(t))};return e.forEach(n=>n.configure(r)),{...t,...$Z(r),...MJ(r),...AY(r),...LZ(r)}};class FZ extends fJ{constructor(...[e]){const r=MZ(e||{}),n=NX(r),i=jY(n),s=cJ(i),o=mQ(s),a=o,l=$Q(a),c=MX(l),f=jZ(c,(e==null?void 0:e.extensions)||[]);super(f),this.config=f,this.middlewareStack.use(vQ(this.config)),this.middlewareStack.use(FJ(this.config)),this.middlewareStack.use(JJ(this.config)),this.middlewareStack.use(PY(this.config)),this.middlewareStack.use(OY(this.config)),this.middlewareStack.use(LY(this.config)),this.middlewareStack.use(LQ(this.config,{httpAuthSchemeParametersProvider:RX,identityProviderConfigProvider:async u=>new VJ({"aws.auth#sigv4":u.credentials})})),this.middlewareStack.use(zJ(this.config))}destroy(){super.destroy()}}class Ie extends Wx{constructor(e){super(e),Object.setPrototypeOf(this,Ie.prototype)}}class Qx extends Ie{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,Qx.prototype)}}class Jx extends Ie{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,Jx.prototype)}}class Xx extends Ie{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,Xx.prototype)}}class Zx extends Ie{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,Zx.prototype)}}class eb extends Ie{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,eb.prototype)}}class tb extends Ie{constructor(e){super({name:"UserImportInProgressException",$fault:"client",...e}),this.name="UserImportInProgressException",this.$fault="client",Object.setPrototypeOf(this,tb.prototype)}}class rb extends Ie{constructor(e){super({name:"UserNotFoundException",$fault:"client",...e}),this.name="UserNotFoundException",this.$fault="client",Object.setPrototypeOf(this,rb.prototype)}}class nb extends Ie{constructor(e){super({name:"InvalidLambdaResponseException",$fault:"client",...e}),this.name="InvalidLambdaResponseException",this.$fault="client",Object.setPrototypeOf(this,nb.prototype)}}class ib extends Ie{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ib.prototype)}}class sb extends Ie{constructor(e){super({name:"TooManyFailedAttemptsException",$fault:"client",...e}),this.name="TooManyFailedAttemptsException",this.$fault="client",Object.setPrototypeOf(this,sb.prototype)}}class ob extends Ie{constructor(e){super({name:"UnexpectedLambdaException",$fault:"client",...e}),this.name="UnexpectedLambdaException",this.$fault="client",Object.setPrototypeOf(this,ob.prototype)}}class I1 extends Ie{constructor(e){super({name:"UserLambdaValidationException",$fault:"client",...e}),this.name="UserLambdaValidationException",this.$fault="client",Object.setPrototypeOf(this,I1.prototype)}}class ab extends Ie{constructor(e){super({name:"CodeDeliveryFailureException",$fault:"client",...e}),this.name="CodeDeliveryFailureException",this.$fault="client",Object.setPrototypeOf(this,ab.prototype)}}class lb extends Ie{constructor(e){super({name:"InvalidPasswordException",$fault:"client",...e}),this.name="InvalidPasswordException",this.$fault="client",Object.setPrototypeOf(this,lb.prototype)}}class cb extends Ie{constructor(e){super({name:"InvalidSmsRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidSmsRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,cb.prototype)}}class fb extends Ie{constructor(e){super({name:"InvalidSmsRoleTrustRelationshipException",$fault:"client",...e}),this.name="InvalidSmsRoleTrustRelationshipException",this.$fault="client",Object.setPrototypeOf(this,fb.prototype)}}class ub extends Ie{constructor(e){super({name:"PreconditionNotMetException",$fault:"client",...e}),this.name="PreconditionNotMetException",this.$fault="client",Object.setPrototypeOf(this,ub.prototype)}}class db extends Ie{constructor(e){super({name:"UnsupportedUserStateException",$fault:"client",...e}),this.name="UnsupportedUserStateException",this.$fault="client",Object.setPrototypeOf(this,db.prototype)}}class hb extends Ie{constructor(e){super({name:"UsernameExistsException",$fault:"client",...e}),this.name="UsernameExistsException",this.$fault="client",Object.setPrototypeOf(this,hb.prototype)}}class vb extends Ie{constructor(e){super({name:"AliasExistsException",$fault:"client",...e}),this.name="AliasExistsException",this.$fault="client",Object.setPrototypeOf(this,vb.prototype)}}class pb extends Ie{constructor(e){super({name:"InvalidUserPoolConfigurationException",$fault:"client",...e}),this.name="InvalidUserPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,pb.prototype)}}class yb extends Ie{constructor(e){super({name:"MFAMethodNotFoundException",$fault:"client",...e}),this.name="MFAMethodNotFoundException",this.$fault="client",Object.setPrototypeOf(this,yb.prototype)}}class mb extends Ie{constructor(e){super({name:"PasswordResetRequiredException",$fault:"client",...e}),this.name="PasswordResetRequiredException",this.$fault="client",Object.setPrototypeOf(this,mb.prototype)}}class gb extends Ie{constructor(e){super({name:"UserNotConfirmedException",$fault:"client",...e}),this.name="UserNotConfirmedException",this.$fault="client",Object.setPrototypeOf(this,gb.prototype)}}class xb extends Ie{constructor(e){super({name:"UserPoolAddOnNotEnabledException",$fault:"client",...e}),this.name="UserPoolAddOnNotEnabledException",this.$fault="client",Object.setPrototypeOf(this,xb.prototype)}}class bb extends Ie{constructor(e){super({name:"InvalidEmailRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidEmailRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,bb.prototype)}}class wb extends Ie{constructor(e){super({name:"CodeMismatchException",$fault:"client",...e}),this.name="CodeMismatchException",this.$fault="client",Object.setPrototypeOf(this,wb.prototype)}}class Eb extends Ie{constructor(e){super({name:"ExpiredCodeException",$fault:"client",...e}),this.name="ExpiredCodeException",this.$fault="client",Object.setPrototypeOf(this,Eb.prototype)}}class Sb extends Ie{constructor(e){super({name:"PasswordHistoryPolicyViolationException",$fault:"client",...e}),this.name="PasswordHistoryPolicyViolationException",this.$fault="client",Object.setPrototypeOf(this,Sb.prototype)}}class kb extends Ie{constructor(e){super({name:"SoftwareTokenMFANotFoundException",$fault:"client",...e}),this.name="SoftwareTokenMFANotFoundException",this.$fault="client",Object.setPrototypeOf(this,kb.prototype)}}class Ab extends Ie{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,Ab.prototype)}}class Cb extends Ie{constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,Cb.prototype)}}class _b extends Ie{constructor(e){super({name:"GroupExistsException",$fault:"client",...e}),this.name="GroupExistsException",this.$fault="client",Object.setPrototypeOf(this,_b.prototype)}}class Tb extends Ie{constructor(e){super({name:"DuplicateProviderException",$fault:"client",...e}),this.name="DuplicateProviderException",this.$fault="client",Object.setPrototypeOf(this,Tb.prototype)}}class Pb extends Ie{constructor(e){super({name:"UserPoolTaggingException",$fault:"client",...e}),this.name="UserPoolTaggingException",this.$fault="client",Object.setPrototypeOf(this,Pb.prototype)}}class Rb extends Ie{constructor(e){super({name:"InvalidOAuthFlowException",$fault:"client",...e}),this.name="InvalidOAuthFlowException",this.$fault="client",Object.setPrototypeOf(this,Rb.prototype)}}class Ib extends Ie{constructor(e){super({name:"ScopeDoesNotExistException",$fault:"client",...e}),this.name="ScopeDoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,Ib.prototype)}}class Ob extends Ie{constructor(e){super({name:"UnsupportedIdentityProviderException",$fault:"client",...e}),this.name="UnsupportedIdentityProviderException",this.$fault="client",Object.setPrototypeOf(this,Ob.prototype)}}const FA=t=>({...t,...t.Value&&{Value:Lr}}),hT=t=>({...t,...t.AccessToken&&{AccessToken:Lr},...t.RefreshToken&&{RefreshToken:Lr},...t.IdToken&&{IdToken:Lr}}),BZ=t=>({...t,...t.AuthParameters&&{AuthParameters:Lr},...t.ClientId&&{ClientId:Lr},...t.UserContextData&&{UserContextData:Lr}}),UZ=t=>({...t,...t.Session&&{Session:Lr},...t.AuthenticationResult&&{AuthenticationResult:hT(t.AuthenticationResult)}}),zZ=t=>({...t,...t.ClientId&&{ClientId:Lr},...t.Session&&{Session:Lr},...t.ChallengeResponses&&{ChallengeResponses:Lr},...t.UserContextData&&{UserContextData:Lr}}),VZ=t=>({...t,...t.Session&&{Session:Lr},...t.AuthenticationResult&&{AuthenticationResult:hT(t.AuthenticationResult)}});class Mb extends Ie{constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),this.name="UnauthorizedException",this.$fault="client",Object.setPrototypeOf(this,Mb.prototype)}}class Nb extends Ie{constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),this.name="UnsupportedOperationException",this.$fault="client",Object.setPrototypeOf(this,Nb.prototype)}}class $b extends Ie{constructor(e){super({name:"UnsupportedTokenTypeException",$fault:"client",...e}),this.name="UnsupportedTokenTypeException",this.$fault="client",Object.setPrototypeOf(this,$b.prototype)}}class Db extends Ie{constructor(e){super({name:"EnableSoftwareTokenMFAException",$fault:"client",...e}),this.name="EnableSoftwareTokenMFAException",this.$fault="client",Object.setPrototypeOf(this,Db.prototype)}}const qZ=t=>({...t,...t.ClientId&&{ClientId:Lr},...t.SecretHash&&{SecretHash:Lr},...t.Username&&{Username:Lr},...t.Password&&{Password:Lr},...t.UserAttributes&&{UserAttributes:t.UserAttributes.map(e=>FA(e))},...t.ValidationData&&{ValidationData:t.ValidationData.map(e=>FA(e))},...t.UserContextData&&{UserContextData:Lr}}),HZ=async(t,e)=>{const r=Fb("InitiateAuth");let n;return n=JSON.stringify(Te(t)),jb(e,r,"/",void 0,n)},WZ=async(t,e)=>{const r=Fb("RespondToAuthChallenge");let n;return n=JSON.stringify(Te(t)),jb(e,r,"/",void 0,n)},GZ=async(t,e)=>{const r=Fb("SignUp");let n;return n=JSON.stringify(Te(t)),jb(e,r,"/",void 0,n)},KZ=async(t,e)=>{if(t.statusCode>=300)return Lb(t,e);const r=await R1(t.body,e);let n={};return n=Te(r),{$metadata:Oe(t),...n}},YZ=async(t,e)=>{if(t.statusCode>=300)return Lb(t,e);const r=await R1(t.body,e);let n={};return n=Te(r),{$metadata:Oe(t),...n}},QZ=async(t,e)=>{if(t.statusCode>=300)return Lb(t,e);const r=await R1(t.body,e);let n={};return n=Te(r),{$metadata:Oe(t),...n}},Lb=async(t,e)=>{const r={...t,body:await TX(t.body,e)},n=PX(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentityprovider#InternalErrorException":throw await oee(r);case"InvalidParameterException":case"com.amazonaws.cognitoidentityprovider#InvalidParameterException":throw await fee(r);case"NotAuthorizedException":case"com.amazonaws.cognitoidentityprovider#NotAuthorizedException":throw await mee(r);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentityprovider#ResourceNotFoundException":throw await wee(r);case"TooManyRequestsException":case"com.amazonaws.cognitoidentityprovider#TooManyRequestsException":throw await Aee(r);case"UserImportInProgressException":case"com.amazonaws.cognitoidentityprovider#UserImportInProgressException":throw await Oee(r);case"UserNotFoundException":case"com.amazonaws.cognitoidentityprovider#UserNotFoundException":throw await Dee(r);case"InvalidLambdaResponseException":case"com.amazonaws.cognitoidentityprovider#InvalidLambdaResponseException":throw await lee(r);case"LimitExceededException":case"com.amazonaws.cognitoidentityprovider#LimitExceededException":throw await pee(r);case"TooManyFailedAttemptsException":case"com.amazonaws.cognitoidentityprovider#TooManyFailedAttemptsException":throw await kee(r);case"UnexpectedLambdaException":case"com.amazonaws.cognitoidentityprovider#UnexpectedLambdaException":throw await _ee(r);case"UserLambdaValidationException":case"com.amazonaws.cognitoidentityprovider#UserLambdaValidationException":throw await Mee(r);case"CodeDeliveryFailureException":case"com.amazonaws.cognitoidentityprovider#CodeDeliveryFailureException":throw await XZ(r);case"InvalidPasswordException":case"com.amazonaws.cognitoidentityprovider#InvalidPasswordException":throw await uee(r);case"InvalidSmsRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleAccessPolicyException":throw await dee(r);case"InvalidSmsRoleTrustRelationshipException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleTrustRelationshipException":throw await hee(r);case"PreconditionNotMetException":case"com.amazonaws.cognitoidentityprovider#PreconditionNotMetException":throw await bee(r);case"UnsupportedUserStateException":case"com.amazonaws.cognitoidentityprovider#UnsupportedUserStateException":throw await Iee(r);case"UsernameExistsException":case"com.amazonaws.cognitoidentityprovider#UsernameExistsException":throw await Nee(r);case"AliasExistsException":case"com.amazonaws.cognitoidentityprovider#AliasExistsException":throw await JZ(r);case"InvalidUserPoolConfigurationException":case"com.amazonaws.cognitoidentityprovider#InvalidUserPoolConfigurationException":throw await vee(r);case"MFAMethodNotFoundException":case"com.amazonaws.cognitoidentityprovider#MFAMethodNotFoundException":throw await yee(r);case"PasswordResetRequiredException":case"com.amazonaws.cognitoidentityprovider#PasswordResetRequiredException":throw await xee(r);case"UserNotConfirmedException":case"com.amazonaws.cognitoidentityprovider#UserNotConfirmedException":throw await $ee(r);case"UserPoolAddOnNotEnabledException":case"com.amazonaws.cognitoidentityprovider#UserPoolAddOnNotEnabledException":throw await Lee(r);case"InvalidEmailRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidEmailRoleAccessPolicyException":throw await aee(r);case"CodeMismatchException":case"com.amazonaws.cognitoidentityprovider#CodeMismatchException":throw await ZZ(r);case"ExpiredCodeException":case"com.amazonaws.cognitoidentityprovider#ExpiredCodeException":throw await nee(r);case"PasswordHistoryPolicyViolationException":case"com.amazonaws.cognitoidentityprovider#PasswordHistoryPolicyViolationException":throw await gee(r);case"SoftwareTokenMFANotFoundException":case"com.amazonaws.cognitoidentityprovider#SoftwareTokenMFANotFoundException":throw await See(r);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentityprovider#ConcurrentModificationException":throw await eee(r);case"ForbiddenException":case"com.amazonaws.cognitoidentityprovider#ForbiddenException":throw await iee(r);case"GroupExistsException":case"com.amazonaws.cognitoidentityprovider#GroupExistsException":throw await see(r);case"DuplicateProviderException":case"com.amazonaws.cognitoidentityprovider#DuplicateProviderException":throw await tee(r);case"UserPoolTaggingException":case"com.amazonaws.cognitoidentityprovider#UserPoolTaggingException":throw await jee(r);case"InvalidOAuthFlowException":case"com.amazonaws.cognitoidentityprovider#InvalidOAuthFlowException":throw await cee(r);case"ScopeDoesNotExistException":case"com.amazonaws.cognitoidentityprovider#ScopeDoesNotExistException":throw await Eee(r);case"UnsupportedIdentityProviderException":case"com.amazonaws.cognitoidentityprovider#UnsupportedIdentityProviderException":throw await Tee(r);case"UnauthorizedException":case"com.amazonaws.cognitoidentityprovider#UnauthorizedException":throw await Cee(r);case"UnsupportedOperationException":case"com.amazonaws.cognitoidentityprovider#UnsupportedOperationException":throw await Pee(r);case"UnsupportedTokenTypeException":case"com.amazonaws.cognitoidentityprovider#UnsupportedTokenTypeException":throw await Ree(r);case"EnableSoftwareTokenMFAException":case"com.amazonaws.cognitoidentityprovider#EnableSoftwareTokenMFAException":throw await ree(r);default:const i=r.body;return Fee({output:t,parsedBody:i,errorCode:n})}},JZ=async(t,e)=>{const r=t.body,n=Te(r),i=new vb({$metadata:Oe(t),...n});return Le(i,r)},XZ=async(t,e)=>{const r=t.body,n=Te(r),i=new ab({$metadata:Oe(t),...n});return Le(i,r)},ZZ=async(t,e)=>{const r=t.body,n=Te(r),i=new wb({$metadata:Oe(t),...n});return Le(i,r)},eee=async(t,e)=>{const r=t.body,n=Te(r),i=new Ab({$metadata:Oe(t),...n});return Le(i,r)},tee=async(t,e)=>{const r=t.body,n=Te(r),i=new Tb({$metadata:Oe(t),...n});return Le(i,r)},ree=async(t,e)=>{const r=t.body,n=Te(r),i=new Db({$metadata:Oe(t),...n});return Le(i,r)},nee=async(t,e)=>{const r=t.body,n=Te(r),i=new Eb({$metadata:Oe(t),...n});return Le(i,r)},iee=async(t,e)=>{const r=t.body,n=Te(r),i=new Cb({$metadata:Oe(t),...n});return Le(i,r)},see=async(t,e)=>{const r=t.body,n=Te(r),i=new _b({$metadata:Oe(t),...n});return Le(i,r)},oee=async(t,e)=>{const r=t.body,n=Te(r),i=new Qx({$metadata:Oe(t),...n});return Le(i,r)},aee=async(t,e)=>{const r=t.body,n=Te(r),i=new bb({$metadata:Oe(t),...n});return Le(i,r)},lee=async(t,e)=>{const r=t.body,n=Te(r),i=new nb({$metadata:Oe(t),...n});return Le(i,r)},cee=async(t,e)=>{const r=t.body,n=Te(r),i=new Rb({$metadata:Oe(t),...n});return Le(i,r)},fee=async(t,e)=>{const r=t.body,n=Te(r),i=new Jx({$metadata:Oe(t),...n});return Le(i,r)},uee=async(t,e)=>{const r=t.body,n=Te(r),i=new lb({$metadata:Oe(t),...n});return Le(i,r)},dee=async(t,e)=>{const r=t.body,n=Te(r),i=new cb({$metadata:Oe(t),...n});return Le(i,r)},hee=async(t,e)=>{const r=t.body,n=Te(r),i=new fb({$metadata:Oe(t),...n});return Le(i,r)},vee=async(t,e)=>{const r=t.body,n=Te(r),i=new pb({$metadata:Oe(t),...n});return Le(i,r)},pee=async(t,e)=>{const r=t.body,n=Te(r),i=new ib({$metadata:Oe(t),...n});return Le(i,r)},yee=async(t,e)=>{const r=t.body,n=Te(r),i=new yb({$metadata:Oe(t),...n});return Le(i,r)},mee=async(t,e)=>{const r=t.body,n=Te(r),i=new Xx({$metadata:Oe(t),...n});return Le(i,r)},gee=async(t,e)=>{const r=t.body,n=Te(r),i=new Sb({$metadata:Oe(t),...n});return Le(i,r)},xee=async(t,e)=>{const r=t.body,n=Te(r),i=new mb({$metadata:Oe(t),...n});return Le(i,r)},bee=async(t,e)=>{const r=t.body,n=Te(r),i=new ub({$metadata:Oe(t),...n});return Le(i,r)},wee=async(t,e)=>{const r=t.body,n=Te(r),i=new Zx({$metadata:Oe(t),...n});return Le(i,r)},Eee=async(t,e)=>{const r=t.body,n=Te(r),i=new Ib({$metadata:Oe(t),...n});return Le(i,r)},See=async(t,e)=>{const r=t.body,n=Te(r),i=new kb({$metadata:Oe(t),...n});return Le(i,r)},kee=async(t,e)=>{const r=t.body,n=Te(r),i=new sb({$metadata:Oe(t),...n});return Le(i,r)},Aee=async(t,e)=>{const r=t.body,n=Te(r),i=new eb({$metadata:Oe(t),...n});return Le(i,r)},Cee=async(t,e)=>{const r=t.body,n=Te(r),i=new Mb({$metadata:Oe(t),...n});return Le(i,r)},_ee=async(t,e)=>{const r=t.body,n=Te(r),i=new ob({$metadata:Oe(t),...n});return Le(i,r)},Tee=async(t,e)=>{const r=t.body,n=Te(r),i=new Ob({$metadata:Oe(t),...n});return Le(i,r)},Pee=async(t,e)=>{const r=t.body,n=Te(r),i=new Nb({$metadata:Oe(t),...n});return Le(i,r)},Ree=async(t,e)=>{const r=t.body,n=Te(r),i=new $b({$metadata:Oe(t),...n});return Le(i,r)},Iee=async(t,e)=>{const r=t.body,n=Te(r),i=new db({$metadata:Oe(t),...n});return Le(i,r)},Oee=async(t,e)=>{const r=t.body,n=Te(r),i=new tb({$metadata:Oe(t),...n});return Le(i,r)},Mee=async(t,e)=>{const r=t.body,n=Te(r),i=new I1({$metadata:Oe(t),...n});return Le(i,r)},Nee=async(t,e)=>{const r=t.body,n=Te(r),i=new hb({$metadata:Oe(t),...n});return Le(i,r)},$ee=async(t,e)=>{const r=t.body,n=Te(r),i=new gb({$metadata:Oe(t),...n});return Le(i,r)},Dee=async(t,e)=>{const r=t.body,n=Te(r),i=new rb({$metadata:Oe(t),...n});return Le(i,r)},Lee=async(t,e)=>{const r=t.body,n=Te(r),i=new xb({$metadata:Oe(t),...n});return Le(i,r)},jee=async(t,e)=>{const r=t.body,n=Te(r),i=new Pb({$metadata:Oe(t),...n});return Le(i,r)},Oe=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"]}),Fee=AJ(Ie),jb=async(t,e,r,n,i)=>{const{hostname:s,protocol:o="https",port:a,path:l}=await t.endpoint(),c={protocol:o,hostname:s,port:a,method:"POST",path:l.endsWith("/")?l.slice(0,-1)+r:l+r,headers:e};return n!==void 0&&(c.hostname=n),i!==void 0&&(c.body=i),new Yn(c)};function Fb(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${t}`}}class Bee extends P1.classBuilder().ep({...Kx}).m(function(e,r,n,i){return[zx(n,this.serialize,this.deserialize),Vx(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","InitiateAuth",{}).n("CognitoIdentityProviderClient","InitiateAuthCommand").f(BZ,UZ).ser(HZ).de(KZ).build(){}class Uee extends P1.classBuilder().ep({...Kx}).m(function(e,r,n,i){return[zx(n,this.serialize,this.deserialize),Vx(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","RespondToAuthChallenge",{}).n("CognitoIdentityProviderClient","RespondToAuthChallengeCommand").f(zZ,VZ).ser(WZ).de(YZ).build(){}class zee extends P1.classBuilder().ep({...Kx}).m(function(e,r,n,i){return[zx(n,this.serialize,this.deserialize),Vx(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","SignUp",{}).n("CognitoIdentityProviderClient","SignUpCommand").f(qZ,void 0).ser(GZ).de(QZ).build(){}class hf extends Error{}hf.prototype.name="InvalidTokenError";function Vee(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 qee(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 Vee(e)}catch{return atob(e)}}function vT(t,e){if(typeof t!="string")throw new hf("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 hf(`Invalid token specified: missing part #${r+1}`);let i;try{i=qee(n)}catch(s){throw new hf(`Invalid token specified: invalid base64 for part #${r+1} (${s.message})`)}try{return JSON.parse(i)}catch(s){throw new hf(`Invalid token specified: invalid json for part #${r+1} (${s.message})`)}}function Mr(){return Mr=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}const Hee=["signatures"],Wee=1,Gee=`${Wee} (Web ${tY})`;function Yr(t,e,r){const n=Math.floor(Date.now()/1e3),i=n+e;return{version:Gee,issuedAt:n,expiresAt:i,name:t,data:r}}async function Kee(t,e){const r=Yee(e),n=await t.sign(new Uint8Array(r));return Mr({},e,{signatures:[{sessionId:await t.sessionId(),signature:n}]})}function Yee(t){const{version:e,issuedAt:r,expiresAt:n,name:i,data:s}=t,a=_t(rY({version:e,issuedAt:r,expiresAt:n,name:i,data:s}));return de(Xe(a))}function Qee(t,e){const r=Kr(t,Hee),n=t.expiresAt-t.issuedAt;return r.issuedAt=Math.floor(e.getTime()/1e3),r.expiresAt=r.issuedAt+n,r}let Qr=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}({}),Nc=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}({}),up=function(t){return t.unknown="unknown",t.erc20Token="erc20Token",t.erc1155Token="erc1155Token",t}({}),br=function(t){return t.None="None",t.Guest="Guest",t.OIDC="OIDC",t.Email="Email",t.PlayFab="PlayFab",t.Stytch="Stytch",t}({});function Jee({wallet:t,chainId:e,message:r,lifespan:n}){return Yr(Qr.signMessage,n,{wallet:t,network:e.toString(),message:r.startsWith("0x")?r:he(_t(r))})}const Xee=["lifespan"],Zee=["lifespan"],ete=["lifespan"],tte=["lifespan"],rte=["lifespan"],nte=["lifespan"],ite=["lifespan"],ste=["lifespan"],ote=["lifespan"];async function nf(t){let{lifespan:e}=t,r=Kr(t,Xee);return Yr(Qr.initiateAuth,e,r)}async function BA(t){let{lifespan:e}=t,r=Kr(t,Zee);return Yr(Qr.openSession,e,r)}async function ate(t){let{lifespan:e}=t,r=Kr(t,ete);return Yr(Qr.validateSession,e,r)}function lte(t){let{lifespan:e}=t,r=Kr(t,tte);return Yr(Qr.finishValidateSession,e,r)}function UA(t){let{lifespan:e}=t,r=Kr(t,rte);return Yr(Qr.closeSession,e,r)}function cte(t){let{lifespan:e}=t,r=Kr(t,nte);return Yr(Qr.listSessions,e,r)}function fte(t){let{lifespan:e}=t,r=Kr(t,ite);return Yr(Qr.getSession,e,r)}function ute(t){let{lifespan:e}=t,r=Kr(t,ste);return Yr(Qr.sessionAuthProof,e,r)}function dte(t){let{lifespan:e}=t,r=Kr(t,ote);return Yr(Qr.getIdToken,e,r)}const hte=["token","to","value"],vte=["token","to","id","safe","data"],pte=["token","to","values","data"],yte=["to","value","abi","func","args"];function mte({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:i}){return Yr(Qr.feeOptions,t,{identifier:r,wallet:e,network:n.toString(),transactions:i.map(s=>{if(!s.to||s.to===Sx)throw new Error("Contract creation not supported");return yT(s)?{type:"transaction",to:s.to,value:ce.from(s.value||0).toHexString(),data:he(s.data||[])}:s})})}function Hu({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:i,transactionsFeeQuote:s,transactionsFeeOption:o}){return Yr(Qr.sendTransaction,t,{identifier:r,wallet:e,network:n.toString(),transactions:gte(i,o).map(a=>{if(!a.to||a.to===Sx)throw new Error("Contract creation not supported");return yT(a)?{type:"transaction",to:a.to,value:ce.from(a.value||0).toHexString(),data:he(a.data||[])}:a}),transactionsFeeQuote:s})}function gte(t,e){const r=[...t];if(e)switch(e.token.type){case up.unknown:r.push({to:e.to,value:e.value});break;case up.erc20Token:if(!e.token.contractAddress)throw new Error("contract address is required");r.push(Bb({tokenAddress:e.token.contractAddress,to:e.to,value:e.value}));break;case up.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(Ub({tokenAddress:e.token.contractAddress,to:e.to,vals:[{id:e.token.tokenID,amount:e.value}]}));break}return r}function xte({lifespan:t,chainId:e,wallet:r,metaTxHash:n}){return Yr(Qr.getTransactionReceipt,t,{wallet:r,network:e.toString(),metaTxHash:n})}function bte(t){let{token:e,to:r,value:n}=t,i=Kr(t,hte);return Hu(Mr({transactions:[Bb({tokenAddress:e,to:r,value:n.toString()})]},i))}function wte(t){let{token:e,to:r,id:n,safe:i,data:s}=t,o=Kr(t,vte);return Hu(Mr({transactions:[kte({tokenAddress:e,to:r,id:n,data:s,safe:i})]},o))}function Ete(t){let{token:e,to:r,values:n,data:i}=t,s=Kr(t,pte);const o=n.map(a=>({id:a.id,amount:ce.from(a.amount).toString()}));return Hu(Mr({transactions:[Ub({tokenAddress:e,to:r,vals:o,data:i})]},s))}function Ste(t){let{to:e,value:r,abi:n,func:i,args:s}=t,o=Kr(t,yte);return Hu(Mr({transactions:[pT({to:e,value:ce.from(r).toString(),data:{abi:n,func:i,args:s}})]},o))}function Bb(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 Mr({type:"erc20send"},r);throw new Error("Invalid ERC20 transaction")}function kte(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 Mr({type:"erc721send"},r);throw new Error("Invalid ERC721 transaction")}function Ub(t){const e=t,r=t;if(e.values!==void 0)return{type:"erc1155send",vals:e.values.map(n=>({id:n.id,amount:ce.from(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:ce.from(n.amount).toString()})),tokenAddress:r.tokenAddress,to:r.to,data:r.data};throw new Error("Invalid ERC1155 transaction")}function pT(t){const e=t,r=t;if(e.abi!==void 0)return{type:"delayedEncode",to:e.to,value:ce.from(e.value).toString(),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 Ate(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,i=t[0].data.identifier,s=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 Yr(Qr.sendTransaction,n,{network:e,wallet:r,identifier:i,transactions:t.flatMap(o=>o.data.transactions),transactionsFeeQuote:s})}function yT(t){return!["transaction","erc20send","erc721send","erc1155send","delayedEncode"].includes(t.type)}class vh{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 mT{constructor(){this.store=void 0,S0.isAvailable()?this.store=new S0:this.store=new Cte}async get(e){return this.store.get(e)}async set(e,r){return this.store.set(e,r)}}class S0{static isAvailable(){return typeof window=="object"&&typeof window.localStorage=="object"}constructor(){if(!S0.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 Cte{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 vm="seq-waas-session-p256k1",pm="seq-waas-session";async function gT(t,e){const r=await e.get(vm,pm,t);if(!r)throw new Error("No private key found");const n=new Ns(r);return{sessionId(){return n.getAddress()},sign(i){return n.signMessage(i)},clear:async()=>{await e.delete(vm,pm,t)}}}async function _te(t,e){const n=await new Ns(t).getAddress();return await e.set(vm,pm,n,t),gT(n,e)}async function Tte(t){const e=Ns.createRandom();return _te(e.privateKey,t)}let xT=function(t){return t[t.ECDSAP256K1=0]="ECDSAP256K1",t[t.ECDSAP256R1=1]="ECDSAP256R1",t}({});const ym="seq-waas-session-p256r1",mm="seq-waas-session";async function bT(t,e,r){const n=await r.get(ym,mm,t);if(!n||!n.privateKey)throw new Error("No private key found");const i=new TextEncoder;return{sessionId:async()=>{const s=await e.exportKey("raw",n.publicKey),o=new Uint8Array(s.byteLength+1);return o[0]=xT.ECDSAP256R1,o.set(new Uint8Array(s),1),he(o)},sign:async s=>{typeof s=="string"&&(s.startsWith("0x")?(s=s.slice(2),s=de(s)):s=i.encode(s));const o=await e.sign({name:"ECDSA",hash:{name:"SHA-256"}},n.privateKey,s);return he(new Uint8Array(o))},clear:async()=>{await r.delete(ym,mm,t)}}}async function Pte(t,e,r){const n=await Ite(e,t.publicKey);return await r.set(ym,mm,n,t),bT(n,e,r)}async function Rte(t,e){const r=await t.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"]);return Pte(r,t,e)}async function Ite(t,e){const r=await t.exportKey("raw",e),n=new Uint8Array(r.byteLength+1);return n[0]=xT.ECDSAP256R1,n.set(new Uint8Array(r),1),he(n)}async function gm(t,e,r){if(!r)throw new Error("No secure store available");return e?bT(t,e,r):gT(t,r)}async function Ote(t,e){if(!e)throw new Error("No secure store available");return t?Rte(t,e):Tte(e)}const Mte=["lifespan"],Nte=["lifespan"],$te=["lifespan"];function Dte(t){let{lifespan:e}=t,r=Kr(t,Mte);return Yr(Qr.listAccounts,e,r)}function Lte(t){let{lifespan:e}=t,r=Kr(t,Nte);return Yr(Qr.federateAccount,e,r)}function jte(t){let{lifespan:e}=t,r=Kr(t,$te);return Yr(Qr.removeAccount,e,r)}const xm=Object.entries(y0).reduce((t,[e,r])=>(t[r.name]=r.chainId,t),{}),Fte=Object.entries(xm).reduce((t,[e,r])=>(t[r]=e,t),{});function dp(t){const e=typeof t=="number"?t:parseInt(t);if(e in Fte)return e;const r=t.toString().toLowerCase();if(r in xm)return xm[r];throw new Error(`Unknown network: ${t}`)}const wT=()=>ET()?new Bte:null;function ET(){return typeof window=="object"&&typeof window.crypto=="object"&&typeof window.crypto.subtle=="object"}class Bte{constructor(){if(!ET())throw new Error("window.crypto.subtle is not available")}async generateKey(e,r,n){return window.crypto.subtle.generateKey(e,r,n)}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 i=await window.crypto.subtle.sign(e,r,n);return new Uint8Array(i)}async verify(e,r,n,i){return window.crypto.subtle.verify(e,r,n,i)}getRandomValues(e){const r=new Uint8Array(e);return window.crypto.getRandomValues(r)}}const ST=()=>kT()?new Ute:null;function kT(){return typeof indexedDB=="object"}class Ute{constructor(){if(this.db=void 0,!kT())throw new Error("IndexedDB is not available");this.db=null}async openDB(e,r,n){return this.db?this.db:(this.db=await wY(e,1,{upgrade(i){i.createObjectStore(r)}}),this.db)}async get(e,r,n){const i=await this.openDB(e,r,1),s=i.transaction(r,"readonly"),o=await i.get(r,n);return await s.done,o}async set(e,r,n,i){const s=await this.openDB(e,r,1),o=s.transaction(r,"readwrite");return await s.put(r,i,n),await o.done,!0}async delete(e,r,n){const i=await this.openDB(e,r,1),s=i.transaction(r,"readwrite");return await i.delete(r,n),await s.done,!0}}const zte="@0xsequence.waas.wallet",Vte="@0xsequence.waas.session_id",qte="@0xsequence.waas.status",Sr=5*60;class Hte{constructor(e={network:1},r=new mT,n=wT(),i=ST()){this.config=e,this.store=r,this.cryptoBackend=n,this.secureStoreBackend=i,this.status=void 0,this.sessionId=void 0,this.wallet=void 0,this.sessionObservers=[],this.gettingSessionIdPromise=void 0,this.status=new vh(this.store,qte,"signed-out"),this.sessionId=new vh(this.store,Vte,void 0),this.wallet=new vh(this.store,zte,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 Mr({},e,{identifier:e==null?void 0:e.identifier,wallet:await this.getWalletAddress(),lifespan:(r=e==null?void 0:e.lifespan)!=null?r:Sr,chainId:dp(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 gm(r,this.cryptoBackend,this.secureStoreBackend);return Kee(n,e)}async signUsingSessionKey(e){const r=await this.getSessionId();if(!r)throw new Error("session not open");return(await gm(r,this.cryptoBackend,this.secureStoreBackend)).sign(e)}async getSessionId(){var e=this;if(this.gettingSessionIdPromise)return this.gettingSessionIdPromise;const r=async function(){let i=await e.sessionId.get();return i||(i=await(await Ote(e.cryptoBackend,e.secureStoreBackend)).sessionId(),await e.sessionId.set(i),e.signalObservers(e.sessionObservers,i)),e.gettingSessionIdPromise=void 0,i};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(),i=await BA({sessionId:n,identityType:br.None,idToken:e,lifespan:Sr});return await this.status.set("pending"),this.signIntent(i)}async initiateGuestAuth(){const e=await this.getSessionId(),r=await nf({sessionId:e,identityType:br.Guest,verifier:e,lifespan:Sr});return this.signIntent(r)}async initiateEmailAuth(e){const r=await this.getSessionId(),n=await nf({sessionId:r,identityType:br.Email,verifier:`${e};${r}`,lifespan:Sr});return this.signIntent(n)}async initiateIdTokenAuth(e,r){const n=await this.getSessionId(),i=Xe(_t(e)),s=await nf({sessionId:n,identityType:br.OIDC,verifier:`${i};${r}`,lifespan:Sr});return this.signIntent(s)}async initiateStytchAuth(e,r){const n=await this.getSessionId(),i=Xe(_t(e)),s=await nf({sessionId:n,identityType:br.Stytch,verifier:`${i};${r}`,lifespan:Sr});return this.signIntent(s)}async initiatePlayFabAuth(e,r){const n=await this.getSessionId(),i=Xe(_t(r)),s=await nf({sessionId:n,identityType:br.PlayFab,verifier:`${e}|${i}`,lifespan:Sr});return this.signIntent(s)}async completeAuth(e,r){const n=await this.getSessionId(),i=await BA(Mr({},r,{sessionId:n,lifespan:Sr},e));return await this.status.set("pending"),this.signIntent(i)}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=UA({lifespan:e||Sr,sessionId:r});return this.signIntent(n)}async signOutSession(e){const r=UA({lifespan:Sr,sessionId:e});return this.signIntent(r)}async listSessions(){const e=cte({lifespan:Sr,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=ute({lifespan:(r=e.lifespan)!=null?r:Sr,network:dp(e.network||this.config.network).toString(),wallet:await this.getWalletAddress(),nonce:e.nonce});return this.signIntent(n)}async signMessage(e){var r;const n=Jee(Mr({chainId:dp(e.network||this.config.network)},e,{lifespan:(r=e.lifespan)!=null?r:Sr,wallet:await this.getWalletAddress()}));return this.signIntent(n)}async sendTransaction(e){const r=Hu(await this.commonArgs(e));return this.signIntent(r)}async getTransactionReceipt(e){const r=xte(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=bte(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=wte(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=Ete(await this.commonArgs(e));return this.signIntent(r)}async callContract(e){const r=Ste(await this.commonArgs(e));return this.signIntent(r)}async feeOptions(e){const r=mte(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 ate({lifespan:Sr,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=fte({sessionId:e,wallet:await this.getWalletAddress(),lifespan:Sr});return this.signIntent(r)}async finishValidateSession(e,r){const n=await this.sessionId.get();if(!n)throw new Error("session not open");const i=await this.getWalletAddress(),s=lte({sessionId:n,wallet:i,lifespan:Sr,salt:e,challenge:r});return this.signIntent(s)}async listAccounts(){const e=Dte({wallet:await this.getWalletAddress(),lifespan:Sr});return this.signIntent(e)}async linkAccount(e){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=Lte(Mr({wallet:await this.getWalletAddress(),lifespan:Sr,sessionId:r},e));return this.signIntent(n)}async removeAccount({accountId:e}){const r=jte({wallet:await this.getWalletAddress(),lifespan:Sr,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=dte({wallet:await this.getWalletAddress(),lifespan:Sr,sessionId:r,nonce:e});return this.signIntent(n)}async batch(e){const r=Ate(e);return this.signIntent(r)}signalObservers(e,r){e.forEach(n=>n(r))}async updateIntentTime(e,r){const n=Qee(e,r);return this.signIntent(n)}}class Wte{constructor(e,r){this.hostname=void 0,this.fetch=void 0,this.path="/rpc/WaasAuthenticator/",this.registerSession=(n,i,s)=>this.fetch(this.url("RegisterSession"),hp(n,i,s)).then(o=>vp(o).then(a=>({session:a.session,response:a.response})),o=>{throw ph.new({cause:`fetch(): ${o.message||""}`})}),this.sendIntent=(n,i,s)=>this.fetch(this.url("SendIntent"),hp(n,i,s)).then(o=>vp(o).then(a=>({response:a.response})),o=>{throw ph.new({cause:`fetch(): ${o.message||""}`})}),this.chainList=(n,i)=>this.fetch(this.url("ChainList"),hp({},n,i)).then(s=>vp(s).then(o=>({chains:o.chains})),s=>{throw ph.new({cause:`fetch(): ${s.message||""}`})}),this.hostname=e,this.fetch=(n,i)=>r(n,i)}url(e){return this.hostname+this.path+e}}const hp=(t={},e={},r=null)=>({method:"POST",headers:Mr({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),vp=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let i="";throw n instanceof Error&&(i=n.message),IT.new({status:t.status,cause:`JSON.parse(): ${i}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(nre[n]||Er).new(r)}return r});let Er=class AT extends Error{constructor(e,r,n,i,s){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 i=="number"?i:0,this.cause=s,Object.setPrototypeOf(this,AT.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}},Gte=class CT extends Er{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,CT.prototype)}},ph=class _T extends Er{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,_T.prototype)}},Kte=class TT extends Er{constructor(e="WebrpcBadRoute",r=-2,n="bad route",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,TT.prototype)}},Yte=class PT extends Er{constructor(e="WebrpcBadMethod",r=-3,n="bad method",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,PT.prototype)}},Qte=class RT extends Er{constructor(e="WebrpcBadRequest",r=-4,n="bad request",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,RT.prototype)}},IT=class OT extends Er{constructor(e="WebrpcBadResponse",r=-5,n="bad response",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,OT.prototype)}},Jte=class MT extends Er{constructor(e="WebrpcServerPanic",r=-6,n="server panic",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,MT.prototype)}},Xte=class NT extends Er{constructor(e="WebrpcInternalError",r=-7,n="internal error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,NT.prototype)}},Zte=class $T extends Er{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,$T.prototype)}},ere=class DT extends Er{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,DT.prototype)}},tre=class LT extends Er{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,LT.prototype)}},rre=class jT extends Er{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,jT.prototype)}};class zb extends Er{constructor(e="TenantNotFound",r=1001,n="Tenant not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,zb.prototype)}}class bu extends Er{constructor(e="EmailAlreadyInUse",r=7e3,n="Could not create account as the email is already in use",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,bu.prototype)}}class Vb extends Er{constructor(e="AccountAlreadyLinked",r=7001,n="Could not link account as it is linked to another wallet",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Vb.prototype)}}class qb extends Er{constructor(e="ProofVerificationFailed",r=7002,n="The authentication proof could not be verified",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,qb.prototype)}}class wu extends Er{constructor(e="AnswerIncorrect",r=7003,n="The provided answer is incorrect",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,wu.prototype)}}class Hb extends Er{constructor(e="ChallengeExpired",r=7004,n="The challenge has expired",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Hb.prototype)}}class Wb extends Er{constructor(e="TooManyAttempts",r=7005,n="Too many attempts",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Wb.prototype)}}const nre={0:Gte,[-1]:ph,[-2]:Kte,[-3]:Yte,[-4]:Qte,[-5]:IT,[-6]:Jte,[-7]:Xte,[-8]:Zte,[-9]:ere,[-10]:tre,1e3:rre,1001:zb,7e3:bu,7001:Vb,7002:qb,7003:wu,7004:Hb,7005:Wb};function Nd(t){return typeof t=="object"&&t.code===Nc.authInitiated&&typeof t.data=="object"&&typeof t.data.sessionId=="string"&&typeof t.data.identityType=="string"&&typeof t.data.expiresIn=="number"}function Wu(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 FT(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 ire(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 zA(t){return Wu(t)||ire(t)||FT(t)}function sre(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 ore(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 are(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="feeOptions"&&typeof t.data=="object"&&Array.isArray(t.data.feeOptions)}function lre(t){return typeof t=="object"&&t.code===Nc.validationRequired&&typeof t.data=="object"&&typeof t.data.sessionId=="string"}function cre(t){return typeof t=="object"&&t.code===Nc.validationFinished&&typeof t.data=="object"}function fre(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="sessionClosed"}function ure(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 dre(t){return typeof t=="object"&&t.code===Nc.accountFederated&&typeof t.data=="object"&&typeof t.data.account=="object"}function hre(t){return typeof t=="object"&&t.code===Nc.accountList&&typeof t.data=="object"}function VA(t){var e,r;return!!(t instanceof Er&&((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 vre(t){return typeof t=="object"&&t.code===Nc.idToken&&typeof t.data=="object"&&typeof t.data.idToken=="string"}class pre{constructor(e,r){this.region=e,this.clientId=r,this.cognitoMemo=void 0}cognito(){return this.cognitoMemo||(this.cognitoMemo=new FZ({region:this.region})),this.cognitoMemo}signUp(e){return e=e.toLowerCase().trim(),this.cognito().send(new zee({ClientId:this.clientId,Username:e,Password:"aB1%"+yre(14),UserAttributes:[{Name:"email",Value:e}]}))}signIn(e){return e=e.toLowerCase().trim(),this.cognito().send(new Bee({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 I1&&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:i}){r=r.toLowerCase().trim();const s=await this.cognito().send(new Uee({ClientId:this.clientId,Session:e,ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:{USERNAME:r,ANSWER:n},ClientMetadata:{SESSION_HASH:i}}));if(!s.AuthenticationResult||!s.AuthenticationResult.IdToken)throw new Error("AuthenticationResult.IdToken is empty");return{idToken:s.AuthenticationResult.IdToken}}}function yre(t){return Array.from(mre(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}function mre(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{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 i=await this.waas.validateSession({deviceMetadata:(r=await this.deviceName.get())!=null?r:"Unknown device"}),s=await this.sendIntent(i);this.validationRequiredSalt=s.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(VA(n)&&this.lastDate){const i=await this.waas.updateIntentTime(e,this.lastDate);return(await this.client.sendIntent({intent:i},this.headers())).response}throw n}}async isSignedIn(){return this.waas.isSignedIn()}signIn(e,r){var n=this;const i="email"in e;return i&&this.emailAuthCodeRequiredCallback.length==0?Promise.reject("Missing emailAuthCodeRequired callback"):new Promise(async function(s,o){let a;try{a=await n.initAuth(e)}catch(c){return o(c)}const l=async function(f){try{const u=await n.completeAuth(a.withAnswer(f),{sessionName:r});s(u)}catch(u){if(u instanceof wu)throw u;if(u instanceof bu){const d=async function(){try{const m=await n.completeAuth(a.withAnswer(f),{sessionName:r,forceCreateAccount:!0});s(m)}catch(m){o(m)}},h={type:br.None,email:"",issuer:""};if(u.cause){const p=u.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(u)}};if(i)for(const c of n.emailAuthCodeRequiredCallback)c(l);else l("")})}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(!Nd(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return new gre(e,n.data.challenge)}async initIdTokenAuth(e){var r;const n=vT(e),i=((r=n.iss)==null?void 0:r.startsWith("stytch.com/"))||!1,s=i?await this.waas.initiateStytchAuth(e,n.exp):await this.waas.initiateIdTokenAuth(e,n.exp),o=await this.sendIntent(s);if(!Nd(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`);return i?new xre(e):new BT(e)}async initEmailAuth(e){const r=await this.waas.getSessionId(),n=await this.waas.initiateEmailAuth(e),i=await this.sendIntent(n);if(!Nd(i))throw new Error(`Invalid response: ${JSON.stringify(i)}`);return new Gb(e,r,i.data.challenge)}async initPlayFabAuth(e,r){const n=await this.waas.initiatePlayFabAuth(e,r),i=await this.sendIntent(n);if(!Nd(i))throw new Error(`Invalid response: ${JSON.stringify(i)}`);return new bre(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 i=await this.registerSession(n,r.sessionName);return await this.waas.completeSignIn({code:"sessionOpened",data:{sessionId:i.session.id,wallet:i.response.data.wallet}}),{sessionId:i.session.id,wallet:i.response.data.wallet,email:i.session.identity.email}}catch(i){throw!(i instanceof bu)&&!(i instanceof wu)&&await this.waas.completeSignOut(),i}}async registerSession(e,r){try{return await this.client.registerSession({intent:e,friendlyName:r},this.headers())}catch(n){if(VA(n)&&this.lastDate){const i=await this.waas.updateIntentTime(e,this.lastDate);return await this.client.registerSession({intent:i,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 Xe(_t(e))}async dropSession({sessionId:e,strict:r}={}){const n=await this.waas.getSessionId();if(!n)throw new Error("session not open");const i=e||n;try{const s=await this.waas.signOutSession(i),o=await this.sendIntent(s);if(!fre(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`)}catch(s){if(r)throw s;console.error(s)}if(i===n){if(!this.secureStoreBackend)throw new Error("No secure store available");(await gm(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(i=>Mr({},i,{isThis:i.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(!cre(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(!ure(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(i,r))}return!1}async sessionAuthProof({nonce:e,network:r,validation:n}){const i=await this.waas.sessionAuthProof({nonce:e,network:r});return await this.trySendIntent({validation:n},i,ore)}async listAccounts(){const e=await this.waas.listAccounts(),r=await this.sendIntent(e);if(!hre(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(!dre(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(!vre(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 Mr({},e,{identifier:r})}async trySendIntent(e,r,n){const i=await this.sendIntent(r);if(n(i))return i;if(lre(i)&&await this.handleValidationRequired(e.validation)){const o=await this.sendIntent(r);if(n(o))return o}throw new Error(JSON.stringify(i))}async signMessage(e){const r=await this.waas.signMessage(await this.useIdentifier(e));return this.trySendIntent(e,r,sre)}async trySendTransactionIntent(e,r){let n=await this.trySendIntent(r,e,zA);for(;FT(n);){await new Promise(o=>setTimeout(o,1e3));const i={metaTxHash:n.data.metaTxHash,network:e.data.network,identifier:e.data.identifier,validation:r.validation},s=await this.waas.getTransactionReceipt(await this.useIdentifier(i));n=await this.trySendIntent(i,s,zA)}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,are)}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 window.fetch(e,r),i=n.headers.get("date");return i&&(this.lastDate=new Date(i)),n}}const kre=t=>{if(t.type===br.PlayFab)return"PlayFab login";if(t.type===br.Email)return"Email login";if(t.type===br.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"},Are=t=>{const{onCancel:e,onConfirm:r}=t;return $.jsxs(G,{style:{maxWidth:"600px"},flexDirection:"column",paddingX:"10",paddingY:"4",alignItems:"center",gap:"4",children:[$.jsx(G,{children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Email already in use"})}),$.jsx(G,{height:"full",children:$.jsxs(me,{as:"div",variant:"normal",color:"text50",textAlign:"center",children:["Another account with this email address ",$.jsxs(me,{color:"text80",children:["(",t.info.email,")"]})," already exists with account type ",$.jsxs(me,{color:"text80",children:["(",kre(t.info),")"]}),". You can cancel this or force create a new account."]})}),$.jsxs(G,{flexDirection:"row",gap:"3",marginTop:"6",marginBottom:"2",children:[$.jsx(Ct,{label:"Cancel",onClick:e}),$.jsx(Ct,{variant:"primary",label:"Create new account",onClick:r})]})]})},Cre=({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(i=>!(i in n))?!1:Object.entries(r).filter(([i])=>!t.includes(i)).every(([i,s])=>e(s,n[i])):r===n;return e},_re=Cre(),Tre=(t,e)=>t===e?e:Object.keys(t).reduce((r,n)=>(n in e&&_re(t[n],e[n])&&(r[n]=t[n]),r),Object.assign({},e)),Pre=t=>{const e=y.useRef(!0),[r,n]=y.useState(t);y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]);const i=y.useCallback(s=>{e.current&&n(s)},[]);return[r,i]},UT=(t,e="StytchProvider")=>`${t} can only be used inside <${e}>.`,Rre="You cannot render a inside another .",Ire=`The @stytch/react library is not meant for use with serverside environments like NextJS. + */class cT{static getParser(e,r=!1){if(typeof e!="string")throw new Error("UserAgent should be a string");return new _A(e,r)}static parse(e){return new _A(e).getResult()}static get BROWSER_MAP(){return lT}static get ENGINE_MAP(){return mo}static get OS_MAP(){return fn}static get PLATFORMS_MAP(){return dr}}const SZ=({serviceId:t,clientVersion:e})=>async()=>{var i,s,o,a,l;const r=typeof window<"u"&&((i=window==null?void 0:window.navigator)!=null&&i.userAgent)?cT.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${((s=r==null?void 0:r.os)==null?void 0:s.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"}_${((l=r==null?void 0:r.browser)==null?void 0:l.version)??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n},kZ=t=>()=>Promise.reject(t),TA=typeof TextEncoder=="function"?new TextEncoder:null,AZ=t=>{if(typeof t=="string"){if(TA)return TA.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}`)},fT="required",rs="fn",ns="argv",Mc="ref",PA=!0,RA="isSet",xu="booleanEquals",dl="error",rf="endpoint",ks="tree",Yx="PartitionResult",IA={[fT]:!1,type:"String"},OA={[fT]:!0,default:!1,type:"Boolean"},MA={[Mc]:"Endpoint"},uT={[rs]:xu,[ns]:[{[Mc]:"UseFIPS"},!0]},dT={[rs]:xu,[ns]:[{[Mc]:"UseDualStack"},!0]},Wi={},NA={[rs]:"getAttr",[ns]:[{[Mc]:Yx},"supportsFIPS"]},$A={[rs]:xu,[ns]:[!0,{[rs]:"getAttr",[ns]:[{[Mc]:Yx},"supportsDualStack"]}]},DA=[uT],LA=[dT],jA=[{[Mc]:"Region"}],CZ={version:"1.0",parameters:{Region:IA,UseDualStack:OA,UseFIPS:OA,Endpoint:IA},rules:[{conditions:[{[rs]:RA,[ns]:[MA]}],rules:[{conditions:DA,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:dl},{conditions:LA,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:dl},{endpoint:{url:MA,properties:Wi,headers:Wi},type:rf}],type:ks},{conditions:[{[rs]:RA,[ns]:jA}],rules:[{conditions:[{[rs]:"aws.partition",[ns]:jA,assign:Yx}],rules:[{conditions:[uT,dT],rules:[{conditions:[{[rs]:xu,[ns]:[PA,NA]},$A],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:dl}],type:ks},{conditions:DA,rules:[{conditions:[{[rs]:xu,[ns]:[NA,PA]}],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks},{error:"FIPS is enabled but this partition does not support FIPS",type:dl}],type:ks},{conditions:LA,rules:[{conditions:[$A],rules:[{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks},{error:"DualStack is enabled but this partition does not support DualStack",type:dl}],type:ks},{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dnsSuffix}",properties:Wi,headers:Wi},type:rf}],type:ks}],type:ks},{error:"Invalid Configuration: Missing Region",type:dl}]},_Z=CZ,TZ=(t,e={})=>nQ(_Z,{endpointParams:t,logger:e.logger});x0.aws=B_;const PZ=t=>({apiVersion:"2016-04-18",base64Decoder:(t==null?void 0:t.base64Decoder)??qx,base64Encoder:(t==null?void 0:t.base64Encoder)??Q_,disableHostPrefix:(t==null?void 0:t.disableHostPrefix)??!1,endpointProvider:(t==null?void 0:t.endpointProvider)??TZ,extensions:(t==null?void 0:t.extensions)??[],httpAuthSchemeProvider:(t==null?void 0:t.httpAuthSchemeProvider)??OX,httpAuthSchemes:(t==null?void 0:t.httpAuthSchemes)??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new eX},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new qJ}],logger:(t==null?void 0:t.logger)??new K_,serviceId:(t==null?void 0:t.serviceId)??"Cognito Identity Provider",urlParser:(t==null?void 0:t.urlParser)??b0,utf8Decoder:(t==null?void 0:t.utf8Decoder)??hc,utf8Encoder:(t==null?void 0:t.utf8Encoder)??Y_}),RZ=["in-region","cross-region","mobile","standard","legacy"],IZ=({defaultsMode:t}={})=>tX(async()=>{const e=typeof t=="function"?await t():t;switch(e==null?void 0:e.toLowerCase()){case"auto":return Promise.resolve(OZ()?"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 ${RZ.join(", ")}, got ${e}`)}}),OZ=()=>{var r,n;const t=typeof window<"u"&&((r=window==null?void 0:window.navigator)!=null&&r.userAgent)?cT.parse(window.navigator.userAgent):void 0,e=(n=t==null?void 0:t.platform)==null?void 0:n.type;return e==="tablet"||e==="mobile"},MZ=t=>{const e=IZ(t),r=()=>e().then(_J),n=PZ(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:(t==null?void 0:t.bodyLengthChecker)??AZ,credentialDefaultProvider:(t==null?void 0:t.credentialDefaultProvider)??(i=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:(t==null?void 0:t.defaultUserAgentProvider)??SZ({serviceId:n.serviceId,clientVersion:ZX.version}),maxAttempts:(t==null?void 0:t.maxAttempts)??w0,region:(t==null?void 0:t.region)??kZ("Region is missing"),requestHandler:Hx.create((t==null?void 0:t.requestHandler)??r),retryMode:(t==null?void 0:t.retryMode)??(async()=>(await r()).retryMode||UQ),sha256:(t==null?void 0:t.sha256)??mZ,streamCollector:(t==null?void 0:t.streamCollector)??mJ,useDualstackEndpoint:(t==null?void 0:t.useDualstackEndpoint)??(()=>Promise.resolve(pQ)),useFipsEndpoint:(t==null?void 0:t.useFipsEndpoint)??(()=>Promise.resolve(yQ))}},NZ=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}}},$Z=t=>({region:t.region()}),DZ=t=>{const e=t.httpAuthSchemes;let r=t.httpAuthSchemeProvider,n=t.credentials;return{setHttpAuthScheme(i){const s=e.findIndex(o=>o.schemeId===i.schemeId);s===-1?e.push(i):e.splice(s,1,i)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(i){r=i},httpAuthSchemeProvider(){return r},setCredentials(i){n=i},credentials(){return n}}},LZ=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()}),Md=t=>t,jZ=(t,e)=>{const r={...Md(NZ(t)),...Md(OJ(t)),...Md(kY(t)),...Md(DZ(t))};return e.forEach(n=>n.configure(r)),{...t,...$Z(r),...MJ(r),...AY(r),...LZ(r)}};class FZ extends fJ{constructor(...[e]){const r=MZ(e||{}),n=NX(r),i=jY(n),s=cJ(i),o=mQ(s),a=o,l=$Q(a),c=MX(l),f=jZ(c,(e==null?void 0:e.extensions)||[]);super(f),this.config=f,this.middlewareStack.use(vQ(this.config)),this.middlewareStack.use(FJ(this.config)),this.middlewareStack.use(JJ(this.config)),this.middlewareStack.use(PY(this.config)),this.middlewareStack.use(OY(this.config)),this.middlewareStack.use(LY(this.config)),this.middlewareStack.use(LQ(this.config,{httpAuthSchemeParametersProvider:RX,identityProviderConfigProvider:async u=>new VJ({"aws.auth#sigv4":u.credentials})})),this.middlewareStack.use(zJ(this.config))}destroy(){super.destroy()}}class Ie extends Wx{constructor(e){super(e),Object.setPrototypeOf(this,Ie.prototype)}}class Qx extends Ie{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,Qx.prototype)}}class Jx extends Ie{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,Jx.prototype)}}class Xx extends Ie{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,Xx.prototype)}}class Zx extends Ie{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,Zx.prototype)}}class eb extends Ie{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,eb.prototype)}}class tb extends Ie{constructor(e){super({name:"UserImportInProgressException",$fault:"client",...e}),this.name="UserImportInProgressException",this.$fault="client",Object.setPrototypeOf(this,tb.prototype)}}class rb extends Ie{constructor(e){super({name:"UserNotFoundException",$fault:"client",...e}),this.name="UserNotFoundException",this.$fault="client",Object.setPrototypeOf(this,rb.prototype)}}class nb extends Ie{constructor(e){super({name:"InvalidLambdaResponseException",$fault:"client",...e}),this.name="InvalidLambdaResponseException",this.$fault="client",Object.setPrototypeOf(this,nb.prototype)}}class ib extends Ie{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ib.prototype)}}class sb extends Ie{constructor(e){super({name:"TooManyFailedAttemptsException",$fault:"client",...e}),this.name="TooManyFailedAttemptsException",this.$fault="client",Object.setPrototypeOf(this,sb.prototype)}}class ob extends Ie{constructor(e){super({name:"UnexpectedLambdaException",$fault:"client",...e}),this.name="UnexpectedLambdaException",this.$fault="client",Object.setPrototypeOf(this,ob.prototype)}}class I1 extends Ie{constructor(e){super({name:"UserLambdaValidationException",$fault:"client",...e}),this.name="UserLambdaValidationException",this.$fault="client",Object.setPrototypeOf(this,I1.prototype)}}class ab extends Ie{constructor(e){super({name:"CodeDeliveryFailureException",$fault:"client",...e}),this.name="CodeDeliveryFailureException",this.$fault="client",Object.setPrototypeOf(this,ab.prototype)}}class lb extends Ie{constructor(e){super({name:"InvalidPasswordException",$fault:"client",...e}),this.name="InvalidPasswordException",this.$fault="client",Object.setPrototypeOf(this,lb.prototype)}}class cb extends Ie{constructor(e){super({name:"InvalidSmsRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidSmsRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,cb.prototype)}}class fb extends Ie{constructor(e){super({name:"InvalidSmsRoleTrustRelationshipException",$fault:"client",...e}),this.name="InvalidSmsRoleTrustRelationshipException",this.$fault="client",Object.setPrototypeOf(this,fb.prototype)}}class ub extends Ie{constructor(e){super({name:"PreconditionNotMetException",$fault:"client",...e}),this.name="PreconditionNotMetException",this.$fault="client",Object.setPrototypeOf(this,ub.prototype)}}class db extends Ie{constructor(e){super({name:"UnsupportedUserStateException",$fault:"client",...e}),this.name="UnsupportedUserStateException",this.$fault="client",Object.setPrototypeOf(this,db.prototype)}}class hb extends Ie{constructor(e){super({name:"UsernameExistsException",$fault:"client",...e}),this.name="UsernameExistsException",this.$fault="client",Object.setPrototypeOf(this,hb.prototype)}}class vb extends Ie{constructor(e){super({name:"AliasExistsException",$fault:"client",...e}),this.name="AliasExistsException",this.$fault="client",Object.setPrototypeOf(this,vb.prototype)}}class pb extends Ie{constructor(e){super({name:"InvalidUserPoolConfigurationException",$fault:"client",...e}),this.name="InvalidUserPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,pb.prototype)}}class yb extends Ie{constructor(e){super({name:"MFAMethodNotFoundException",$fault:"client",...e}),this.name="MFAMethodNotFoundException",this.$fault="client",Object.setPrototypeOf(this,yb.prototype)}}class mb extends Ie{constructor(e){super({name:"PasswordResetRequiredException",$fault:"client",...e}),this.name="PasswordResetRequiredException",this.$fault="client",Object.setPrototypeOf(this,mb.prototype)}}class gb extends Ie{constructor(e){super({name:"UserNotConfirmedException",$fault:"client",...e}),this.name="UserNotConfirmedException",this.$fault="client",Object.setPrototypeOf(this,gb.prototype)}}class xb extends Ie{constructor(e){super({name:"UserPoolAddOnNotEnabledException",$fault:"client",...e}),this.name="UserPoolAddOnNotEnabledException",this.$fault="client",Object.setPrototypeOf(this,xb.prototype)}}class bb extends Ie{constructor(e){super({name:"InvalidEmailRoleAccessPolicyException",$fault:"client",...e}),this.name="InvalidEmailRoleAccessPolicyException",this.$fault="client",Object.setPrototypeOf(this,bb.prototype)}}class wb extends Ie{constructor(e){super({name:"CodeMismatchException",$fault:"client",...e}),this.name="CodeMismatchException",this.$fault="client",Object.setPrototypeOf(this,wb.prototype)}}class Eb extends Ie{constructor(e){super({name:"ExpiredCodeException",$fault:"client",...e}),this.name="ExpiredCodeException",this.$fault="client",Object.setPrototypeOf(this,Eb.prototype)}}class Sb extends Ie{constructor(e){super({name:"PasswordHistoryPolicyViolationException",$fault:"client",...e}),this.name="PasswordHistoryPolicyViolationException",this.$fault="client",Object.setPrototypeOf(this,Sb.prototype)}}class kb extends Ie{constructor(e){super({name:"SoftwareTokenMFANotFoundException",$fault:"client",...e}),this.name="SoftwareTokenMFANotFoundException",this.$fault="client",Object.setPrototypeOf(this,kb.prototype)}}class Ab extends Ie{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,Ab.prototype)}}class Cb extends Ie{constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,Cb.prototype)}}class _b extends Ie{constructor(e){super({name:"GroupExistsException",$fault:"client",...e}),this.name="GroupExistsException",this.$fault="client",Object.setPrototypeOf(this,_b.prototype)}}class Tb extends Ie{constructor(e){super({name:"DuplicateProviderException",$fault:"client",...e}),this.name="DuplicateProviderException",this.$fault="client",Object.setPrototypeOf(this,Tb.prototype)}}class Pb extends Ie{constructor(e){super({name:"UserPoolTaggingException",$fault:"client",...e}),this.name="UserPoolTaggingException",this.$fault="client",Object.setPrototypeOf(this,Pb.prototype)}}class Rb extends Ie{constructor(e){super({name:"InvalidOAuthFlowException",$fault:"client",...e}),this.name="InvalidOAuthFlowException",this.$fault="client",Object.setPrototypeOf(this,Rb.prototype)}}class Ib extends Ie{constructor(e){super({name:"ScopeDoesNotExistException",$fault:"client",...e}),this.name="ScopeDoesNotExistException",this.$fault="client",Object.setPrototypeOf(this,Ib.prototype)}}class Ob extends Ie{constructor(e){super({name:"UnsupportedIdentityProviderException",$fault:"client",...e}),this.name="UnsupportedIdentityProviderException",this.$fault="client",Object.setPrototypeOf(this,Ob.prototype)}}const FA=t=>({...t,...t.Value&&{Value:Lr}}),hT=t=>({...t,...t.AccessToken&&{AccessToken:Lr},...t.RefreshToken&&{RefreshToken:Lr},...t.IdToken&&{IdToken:Lr}}),BZ=t=>({...t,...t.AuthParameters&&{AuthParameters:Lr},...t.ClientId&&{ClientId:Lr},...t.UserContextData&&{UserContextData:Lr}}),UZ=t=>({...t,...t.Session&&{Session:Lr},...t.AuthenticationResult&&{AuthenticationResult:hT(t.AuthenticationResult)}}),zZ=t=>({...t,...t.ClientId&&{ClientId:Lr},...t.Session&&{Session:Lr},...t.ChallengeResponses&&{ChallengeResponses:Lr},...t.UserContextData&&{UserContextData:Lr}}),VZ=t=>({...t,...t.Session&&{Session:Lr},...t.AuthenticationResult&&{AuthenticationResult:hT(t.AuthenticationResult)}});class Mb extends Ie{constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),this.name="UnauthorizedException",this.$fault="client",Object.setPrototypeOf(this,Mb.prototype)}}class Nb extends Ie{constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),this.name="UnsupportedOperationException",this.$fault="client",Object.setPrototypeOf(this,Nb.prototype)}}class $b extends Ie{constructor(e){super({name:"UnsupportedTokenTypeException",$fault:"client",...e}),this.name="UnsupportedTokenTypeException",this.$fault="client",Object.setPrototypeOf(this,$b.prototype)}}class Db extends Ie{constructor(e){super({name:"EnableSoftwareTokenMFAException",$fault:"client",...e}),this.name="EnableSoftwareTokenMFAException",this.$fault="client",Object.setPrototypeOf(this,Db.prototype)}}const qZ=t=>({...t,...t.ClientId&&{ClientId:Lr},...t.SecretHash&&{SecretHash:Lr},...t.Username&&{Username:Lr},...t.Password&&{Password:Lr},...t.UserAttributes&&{UserAttributes:t.UserAttributes.map(e=>FA(e))},...t.ValidationData&&{ValidationData:t.ValidationData.map(e=>FA(e))},...t.UserContextData&&{UserContextData:Lr}}),HZ=async(t,e)=>{const r=Fb("InitiateAuth");let n;return n=JSON.stringify(Te(t)),jb(e,r,"/",void 0,n)},WZ=async(t,e)=>{const r=Fb("RespondToAuthChallenge");let n;return n=JSON.stringify(Te(t)),jb(e,r,"/",void 0,n)},GZ=async(t,e)=>{const r=Fb("SignUp");let n;return n=JSON.stringify(Te(t)),jb(e,r,"/",void 0,n)},KZ=async(t,e)=>{if(t.statusCode>=300)return Lb(t,e);const r=await R1(t.body,e);let n={};return n=Te(r),{$metadata:Oe(t),...n}},YZ=async(t,e)=>{if(t.statusCode>=300)return Lb(t,e);const r=await R1(t.body,e);let n={};return n=Te(r),{$metadata:Oe(t),...n}},QZ=async(t,e)=>{if(t.statusCode>=300)return Lb(t,e);const r=await R1(t.body,e);let n={};return n=Te(r),{$metadata:Oe(t),...n}},Lb=async(t,e)=>{const r={...t,body:await TX(t.body,e)},n=PX(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentityprovider#InternalErrorException":throw await oee(r);case"InvalidParameterException":case"com.amazonaws.cognitoidentityprovider#InvalidParameterException":throw await fee(r);case"NotAuthorizedException":case"com.amazonaws.cognitoidentityprovider#NotAuthorizedException":throw await mee(r);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentityprovider#ResourceNotFoundException":throw await wee(r);case"TooManyRequestsException":case"com.amazonaws.cognitoidentityprovider#TooManyRequestsException":throw await Aee(r);case"UserImportInProgressException":case"com.amazonaws.cognitoidentityprovider#UserImportInProgressException":throw await Oee(r);case"UserNotFoundException":case"com.amazonaws.cognitoidentityprovider#UserNotFoundException":throw await Dee(r);case"InvalidLambdaResponseException":case"com.amazonaws.cognitoidentityprovider#InvalidLambdaResponseException":throw await lee(r);case"LimitExceededException":case"com.amazonaws.cognitoidentityprovider#LimitExceededException":throw await pee(r);case"TooManyFailedAttemptsException":case"com.amazonaws.cognitoidentityprovider#TooManyFailedAttemptsException":throw await kee(r);case"UnexpectedLambdaException":case"com.amazonaws.cognitoidentityprovider#UnexpectedLambdaException":throw await _ee(r);case"UserLambdaValidationException":case"com.amazonaws.cognitoidentityprovider#UserLambdaValidationException":throw await Mee(r);case"CodeDeliveryFailureException":case"com.amazonaws.cognitoidentityprovider#CodeDeliveryFailureException":throw await XZ(r);case"InvalidPasswordException":case"com.amazonaws.cognitoidentityprovider#InvalidPasswordException":throw await uee(r);case"InvalidSmsRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleAccessPolicyException":throw await dee(r);case"InvalidSmsRoleTrustRelationshipException":case"com.amazonaws.cognitoidentityprovider#InvalidSmsRoleTrustRelationshipException":throw await hee(r);case"PreconditionNotMetException":case"com.amazonaws.cognitoidentityprovider#PreconditionNotMetException":throw await bee(r);case"UnsupportedUserStateException":case"com.amazonaws.cognitoidentityprovider#UnsupportedUserStateException":throw await Iee(r);case"UsernameExistsException":case"com.amazonaws.cognitoidentityprovider#UsernameExistsException":throw await Nee(r);case"AliasExistsException":case"com.amazonaws.cognitoidentityprovider#AliasExistsException":throw await JZ(r);case"InvalidUserPoolConfigurationException":case"com.amazonaws.cognitoidentityprovider#InvalidUserPoolConfigurationException":throw await vee(r);case"MFAMethodNotFoundException":case"com.amazonaws.cognitoidentityprovider#MFAMethodNotFoundException":throw await yee(r);case"PasswordResetRequiredException":case"com.amazonaws.cognitoidentityprovider#PasswordResetRequiredException":throw await xee(r);case"UserNotConfirmedException":case"com.amazonaws.cognitoidentityprovider#UserNotConfirmedException":throw await $ee(r);case"UserPoolAddOnNotEnabledException":case"com.amazonaws.cognitoidentityprovider#UserPoolAddOnNotEnabledException":throw await Lee(r);case"InvalidEmailRoleAccessPolicyException":case"com.amazonaws.cognitoidentityprovider#InvalidEmailRoleAccessPolicyException":throw await aee(r);case"CodeMismatchException":case"com.amazonaws.cognitoidentityprovider#CodeMismatchException":throw await ZZ(r);case"ExpiredCodeException":case"com.amazonaws.cognitoidentityprovider#ExpiredCodeException":throw await nee(r);case"PasswordHistoryPolicyViolationException":case"com.amazonaws.cognitoidentityprovider#PasswordHistoryPolicyViolationException":throw await gee(r);case"SoftwareTokenMFANotFoundException":case"com.amazonaws.cognitoidentityprovider#SoftwareTokenMFANotFoundException":throw await See(r);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentityprovider#ConcurrentModificationException":throw await eee(r);case"ForbiddenException":case"com.amazonaws.cognitoidentityprovider#ForbiddenException":throw await iee(r);case"GroupExistsException":case"com.amazonaws.cognitoidentityprovider#GroupExistsException":throw await see(r);case"DuplicateProviderException":case"com.amazonaws.cognitoidentityprovider#DuplicateProviderException":throw await tee(r);case"UserPoolTaggingException":case"com.amazonaws.cognitoidentityprovider#UserPoolTaggingException":throw await jee(r);case"InvalidOAuthFlowException":case"com.amazonaws.cognitoidentityprovider#InvalidOAuthFlowException":throw await cee(r);case"ScopeDoesNotExistException":case"com.amazonaws.cognitoidentityprovider#ScopeDoesNotExistException":throw await Eee(r);case"UnsupportedIdentityProviderException":case"com.amazonaws.cognitoidentityprovider#UnsupportedIdentityProviderException":throw await Tee(r);case"UnauthorizedException":case"com.amazonaws.cognitoidentityprovider#UnauthorizedException":throw await Cee(r);case"UnsupportedOperationException":case"com.amazonaws.cognitoidentityprovider#UnsupportedOperationException":throw await Pee(r);case"UnsupportedTokenTypeException":case"com.amazonaws.cognitoidentityprovider#UnsupportedTokenTypeException":throw await Ree(r);case"EnableSoftwareTokenMFAException":case"com.amazonaws.cognitoidentityprovider#EnableSoftwareTokenMFAException":throw await ree(r);default:const i=r.body;return Fee({output:t,parsedBody:i,errorCode:n})}},JZ=async(t,e)=>{const r=t.body,n=Te(r),i=new vb({$metadata:Oe(t),...n});return Le(i,r)},XZ=async(t,e)=>{const r=t.body,n=Te(r),i=new ab({$metadata:Oe(t),...n});return Le(i,r)},ZZ=async(t,e)=>{const r=t.body,n=Te(r),i=new wb({$metadata:Oe(t),...n});return Le(i,r)},eee=async(t,e)=>{const r=t.body,n=Te(r),i=new Ab({$metadata:Oe(t),...n});return Le(i,r)},tee=async(t,e)=>{const r=t.body,n=Te(r),i=new Tb({$metadata:Oe(t),...n});return Le(i,r)},ree=async(t,e)=>{const r=t.body,n=Te(r),i=new Db({$metadata:Oe(t),...n});return Le(i,r)},nee=async(t,e)=>{const r=t.body,n=Te(r),i=new Eb({$metadata:Oe(t),...n});return Le(i,r)},iee=async(t,e)=>{const r=t.body,n=Te(r),i=new Cb({$metadata:Oe(t),...n});return Le(i,r)},see=async(t,e)=>{const r=t.body,n=Te(r),i=new _b({$metadata:Oe(t),...n});return Le(i,r)},oee=async(t,e)=>{const r=t.body,n=Te(r),i=new Qx({$metadata:Oe(t),...n});return Le(i,r)},aee=async(t,e)=>{const r=t.body,n=Te(r),i=new bb({$metadata:Oe(t),...n});return Le(i,r)},lee=async(t,e)=>{const r=t.body,n=Te(r),i=new nb({$metadata:Oe(t),...n});return Le(i,r)},cee=async(t,e)=>{const r=t.body,n=Te(r),i=new Rb({$metadata:Oe(t),...n});return Le(i,r)},fee=async(t,e)=>{const r=t.body,n=Te(r),i=new Jx({$metadata:Oe(t),...n});return Le(i,r)},uee=async(t,e)=>{const r=t.body,n=Te(r),i=new lb({$metadata:Oe(t),...n});return Le(i,r)},dee=async(t,e)=>{const r=t.body,n=Te(r),i=new cb({$metadata:Oe(t),...n});return Le(i,r)},hee=async(t,e)=>{const r=t.body,n=Te(r),i=new fb({$metadata:Oe(t),...n});return Le(i,r)},vee=async(t,e)=>{const r=t.body,n=Te(r),i=new pb({$metadata:Oe(t),...n});return Le(i,r)},pee=async(t,e)=>{const r=t.body,n=Te(r),i=new ib({$metadata:Oe(t),...n});return Le(i,r)},yee=async(t,e)=>{const r=t.body,n=Te(r),i=new yb({$metadata:Oe(t),...n});return Le(i,r)},mee=async(t,e)=>{const r=t.body,n=Te(r),i=new Xx({$metadata:Oe(t),...n});return Le(i,r)},gee=async(t,e)=>{const r=t.body,n=Te(r),i=new Sb({$metadata:Oe(t),...n});return Le(i,r)},xee=async(t,e)=>{const r=t.body,n=Te(r),i=new mb({$metadata:Oe(t),...n});return Le(i,r)},bee=async(t,e)=>{const r=t.body,n=Te(r),i=new ub({$metadata:Oe(t),...n});return Le(i,r)},wee=async(t,e)=>{const r=t.body,n=Te(r),i=new Zx({$metadata:Oe(t),...n});return Le(i,r)},Eee=async(t,e)=>{const r=t.body,n=Te(r),i=new Ib({$metadata:Oe(t),...n});return Le(i,r)},See=async(t,e)=>{const r=t.body,n=Te(r),i=new kb({$metadata:Oe(t),...n});return Le(i,r)},kee=async(t,e)=>{const r=t.body,n=Te(r),i=new sb({$metadata:Oe(t),...n});return Le(i,r)},Aee=async(t,e)=>{const r=t.body,n=Te(r),i=new eb({$metadata:Oe(t),...n});return Le(i,r)},Cee=async(t,e)=>{const r=t.body,n=Te(r),i=new Mb({$metadata:Oe(t),...n});return Le(i,r)},_ee=async(t,e)=>{const r=t.body,n=Te(r),i=new ob({$metadata:Oe(t),...n});return Le(i,r)},Tee=async(t,e)=>{const r=t.body,n=Te(r),i=new Ob({$metadata:Oe(t),...n});return Le(i,r)},Pee=async(t,e)=>{const r=t.body,n=Te(r),i=new Nb({$metadata:Oe(t),...n});return Le(i,r)},Ree=async(t,e)=>{const r=t.body,n=Te(r),i=new $b({$metadata:Oe(t),...n});return Le(i,r)},Iee=async(t,e)=>{const r=t.body,n=Te(r),i=new db({$metadata:Oe(t),...n});return Le(i,r)},Oee=async(t,e)=>{const r=t.body,n=Te(r),i=new tb({$metadata:Oe(t),...n});return Le(i,r)},Mee=async(t,e)=>{const r=t.body,n=Te(r),i=new I1({$metadata:Oe(t),...n});return Le(i,r)},Nee=async(t,e)=>{const r=t.body,n=Te(r),i=new hb({$metadata:Oe(t),...n});return Le(i,r)},$ee=async(t,e)=>{const r=t.body,n=Te(r),i=new gb({$metadata:Oe(t),...n});return Le(i,r)},Dee=async(t,e)=>{const r=t.body,n=Te(r),i=new rb({$metadata:Oe(t),...n});return Le(i,r)},Lee=async(t,e)=>{const r=t.body,n=Te(r),i=new xb({$metadata:Oe(t),...n});return Le(i,r)},jee=async(t,e)=>{const r=t.body,n=Te(r),i=new Pb({$metadata:Oe(t),...n});return Le(i,r)},Oe=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"]}),Fee=AJ(Ie),jb=async(t,e,r,n,i)=>{const{hostname:s,protocol:o="https",port:a,path:l}=await t.endpoint(),c={protocol:o,hostname:s,port:a,method:"POST",path:l.endsWith("/")?l.slice(0,-1)+r:l+r,headers:e};return n!==void 0&&(c.hostname=n),i!==void 0&&(c.body=i),new Yn(c)};function Fb(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${t}`}}class Bee extends P1.classBuilder().ep({...Kx}).m(function(e,r,n,i){return[zx(n,this.serialize,this.deserialize),Vx(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","InitiateAuth",{}).n("CognitoIdentityProviderClient","InitiateAuthCommand").f(BZ,UZ).ser(HZ).de(KZ).build(){}class Uee extends P1.classBuilder().ep({...Kx}).m(function(e,r,n,i){return[zx(n,this.serialize,this.deserialize),Vx(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","RespondToAuthChallenge",{}).n("CognitoIdentityProviderClient","RespondToAuthChallengeCommand").f(zZ,VZ).ser(WZ).de(YZ).build(){}class zee extends P1.classBuilder().ep({...Kx}).m(function(e,r,n,i){return[zx(n,this.serialize,this.deserialize),Vx(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","SignUp",{}).n("CognitoIdentityProviderClient","SignUpCommand").f(qZ,void 0).ser(GZ).de(QZ).build(){}class hf extends Error{}hf.prototype.name="InvalidTokenError";function Vee(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 qee(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 Vee(e)}catch{return atob(e)}}function vT(t,e){if(typeof t!="string")throw new hf("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 hf(`Invalid token specified: missing part #${r+1}`);let i;try{i=qee(n)}catch(s){throw new hf(`Invalid token specified: invalid base64 for part #${r+1} (${s.message})`)}try{return JSON.parse(i)}catch(s){throw new hf(`Invalid token specified: invalid json for part #${r+1} (${s.message})`)}}function Mr(){return Mr=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}const Hee=["signatures"],Wee=1,Gee=`${Wee} (Web ${tY})`;function Yr(t,e,r){const n=Math.floor(Date.now()/1e3),i=n+e;return{version:Gee,issuedAt:n,expiresAt:i,name:t,data:r}}async function Kee(t,e){const r=Yee(e),n=await t.sign(new Uint8Array(r));return Mr({},e,{signatures:[{sessionId:await t.sessionId(),signature:n}]})}function Yee(t){const{version:e,issuedAt:r,expiresAt:n,name:i,data:s}=t,a=_t(rY({version:e,issuedAt:r,expiresAt:n,name:i,data:s}));return de(Xe(a))}function Qee(t,e){const r=Kr(t,Hee),n=t.expiresAt-t.issuedAt;return r.issuedAt=Math.floor(e.getTime()/1e3),r.expiresAt=r.issuedAt+n,r}let Qr=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}({}),Nc=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}({}),up=function(t){return t.unknown="unknown",t.erc20Token="erc20Token",t.erc1155Token="erc1155Token",t}({}),cr=function(t){return t.None="None",t.Guest="Guest",t.OIDC="OIDC",t.Email="Email",t.PlayFab="PlayFab",t.Stytch="Stytch",t}({});function Jee({wallet:t,chainId:e,message:r,lifespan:n}){return Yr(Qr.signMessage,n,{wallet:t,network:e.toString(),message:r.startsWith("0x")?r:he(_t(r))})}const Xee=["lifespan"],Zee=["lifespan"],ete=["lifespan"],tte=["lifespan"],rte=["lifespan"],nte=["lifespan"],ite=["lifespan"],ste=["lifespan"],ote=["lifespan"];async function nf(t){let{lifespan:e}=t,r=Kr(t,Xee);return Yr(Qr.initiateAuth,e,r)}async function BA(t){let{lifespan:e}=t,r=Kr(t,Zee);return Yr(Qr.openSession,e,r)}async function ate(t){let{lifespan:e}=t,r=Kr(t,ete);return Yr(Qr.validateSession,e,r)}function lte(t){let{lifespan:e}=t,r=Kr(t,tte);return Yr(Qr.finishValidateSession,e,r)}function UA(t){let{lifespan:e}=t,r=Kr(t,rte);return Yr(Qr.closeSession,e,r)}function cte(t){let{lifespan:e}=t,r=Kr(t,nte);return Yr(Qr.listSessions,e,r)}function fte(t){let{lifespan:e}=t,r=Kr(t,ite);return Yr(Qr.getSession,e,r)}function ute(t){let{lifespan:e}=t,r=Kr(t,ste);return Yr(Qr.sessionAuthProof,e,r)}function dte(t){let{lifespan:e}=t,r=Kr(t,ote);return Yr(Qr.getIdToken,e,r)}const hte=["token","to","value"],vte=["token","to","id","safe","data"],pte=["token","to","values","data"],yte=["to","value","abi","func","args"];function mte({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:i}){return Yr(Qr.feeOptions,t,{identifier:r,wallet:e,network:n.toString(),transactions:i.map(s=>{if(!s.to||s.to===Sx)throw new Error("Contract creation not supported");return yT(s)?{type:"transaction",to:s.to,value:ce.from(s.value||0).toHexString(),data:he(s.data||[])}:s})})}function Hu({lifespan:t,wallet:e,identifier:r,chainId:n,transactions:i,transactionsFeeQuote:s,transactionsFeeOption:o}){return Yr(Qr.sendTransaction,t,{identifier:r,wallet:e,network:n.toString(),transactions:gte(i,o).map(a=>{if(!a.to||a.to===Sx)throw new Error("Contract creation not supported");return yT(a)?{type:"transaction",to:a.to,value:ce.from(a.value||0).toHexString(),data:he(a.data||[])}:a}),transactionsFeeQuote:s})}function gte(t,e){const r=[...t];if(e)switch(e.token.type){case up.unknown:r.push({to:e.to,value:e.value});break;case up.erc20Token:if(!e.token.contractAddress)throw new Error("contract address is required");r.push(Bb({tokenAddress:e.token.contractAddress,to:e.to,value:e.value}));break;case up.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(Ub({tokenAddress:e.token.contractAddress,to:e.to,vals:[{id:e.token.tokenID,amount:e.value}]}));break}return r}function xte({lifespan:t,chainId:e,wallet:r,metaTxHash:n}){return Yr(Qr.getTransactionReceipt,t,{wallet:r,network:e.toString(),metaTxHash:n})}function bte(t){let{token:e,to:r,value:n}=t,i=Kr(t,hte);return Hu(Mr({transactions:[Bb({tokenAddress:e,to:r,value:n.toString()})]},i))}function wte(t){let{token:e,to:r,id:n,safe:i,data:s}=t,o=Kr(t,vte);return Hu(Mr({transactions:[kte({tokenAddress:e,to:r,id:n,data:s,safe:i})]},o))}function Ete(t){let{token:e,to:r,values:n,data:i}=t,s=Kr(t,pte);const o=n.map(a=>({id:a.id,amount:ce.from(a.amount).toString()}));return Hu(Mr({transactions:[Ub({tokenAddress:e,to:r,vals:o,data:i})]},s))}function Ste(t){let{to:e,value:r,abi:n,func:i,args:s}=t,o=Kr(t,yte);return Hu(Mr({transactions:[pT({to:e,value:ce.from(r).toString(),data:{abi:n,func:i,args:s}})]},o))}function Bb(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 Mr({type:"erc20send"},r);throw new Error("Invalid ERC20 transaction")}function kte(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 Mr({type:"erc721send"},r);throw new Error("Invalid ERC721 transaction")}function Ub(t){const e=t,r=t;if(e.values!==void 0)return{type:"erc1155send",vals:e.values.map(n=>({id:n.id,amount:ce.from(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:ce.from(n.amount).toString()})),tokenAddress:r.tokenAddress,to:r.to,data:r.data};throw new Error("Invalid ERC1155 transaction")}function pT(t){const e=t,r=t;if(e.abi!==void 0)return{type:"delayedEncode",to:e.to,value:ce.from(e.value).toString(),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 Ate(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,i=t[0].data.identifier,s=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 Yr(Qr.sendTransaction,n,{network:e,wallet:r,identifier:i,transactions:t.flatMap(o=>o.data.transactions),transactionsFeeQuote:s})}function yT(t){return!["transaction","erc20send","erc721send","erc1155send","delayedEncode"].includes(t.type)}class vh{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 mT{constructor(){this.store=void 0,S0.isAvailable()?this.store=new S0:this.store=new Cte}async get(e){return this.store.get(e)}async set(e,r){return this.store.set(e,r)}}class S0{static isAvailable(){return typeof window=="object"&&typeof window.localStorage=="object"}constructor(){if(!S0.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 Cte{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 vm="seq-waas-session-p256k1",pm="seq-waas-session";async function gT(t,e){const r=await e.get(vm,pm,t);if(!r)throw new Error("No private key found");const n=new Ns(r);return{sessionId(){return n.getAddress()},sign(i){return n.signMessage(i)},clear:async()=>{await e.delete(vm,pm,t)}}}async function _te(t,e){const n=await new Ns(t).getAddress();return await e.set(vm,pm,n,t),gT(n,e)}async function Tte(t){const e=Ns.createRandom();return _te(e.privateKey,t)}let xT=function(t){return t[t.ECDSAP256K1=0]="ECDSAP256K1",t[t.ECDSAP256R1=1]="ECDSAP256R1",t}({});const ym="seq-waas-session-p256r1",mm="seq-waas-session";async function bT(t,e,r){const n=await r.get(ym,mm,t);if(!n||!n.privateKey)throw new Error("No private key found");const i=new TextEncoder;return{sessionId:async()=>{const s=await e.exportKey("raw",n.publicKey),o=new Uint8Array(s.byteLength+1);return o[0]=xT.ECDSAP256R1,o.set(new Uint8Array(s),1),he(o)},sign:async s=>{typeof s=="string"&&(s.startsWith("0x")?(s=s.slice(2),s=de(s)):s=i.encode(s));const o=await e.sign({name:"ECDSA",hash:{name:"SHA-256"}},n.privateKey,s);return he(new Uint8Array(o))},clear:async()=>{await r.delete(ym,mm,t)}}}async function Pte(t,e,r){const n=await Ite(e,t.publicKey);return await r.set(ym,mm,n,t),bT(n,e,r)}async function Rte(t,e){const r=await t.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"]);return Pte(r,t,e)}async function Ite(t,e){const r=await t.exportKey("raw",e),n=new Uint8Array(r.byteLength+1);return n[0]=xT.ECDSAP256R1,n.set(new Uint8Array(r),1),he(n)}async function gm(t,e,r){if(!r)throw new Error("No secure store available");return e?bT(t,e,r):gT(t,r)}async function Ote(t,e){if(!e)throw new Error("No secure store available");return t?Rte(t,e):Tte(e)}const Mte=["lifespan"],Nte=["lifespan"],$te=["lifespan"];function Dte(t){let{lifespan:e}=t,r=Kr(t,Mte);return Yr(Qr.listAccounts,e,r)}function Lte(t){let{lifespan:e}=t,r=Kr(t,Nte);return Yr(Qr.federateAccount,e,r)}function jte(t){let{lifespan:e}=t,r=Kr(t,$te);return Yr(Qr.removeAccount,e,r)}const xm=Object.entries(y0).reduce((t,[e,r])=>(t[r.name]=r.chainId,t),{}),Fte=Object.entries(xm).reduce((t,[e,r])=>(t[r]=e,t),{});function dp(t){const e=typeof t=="number"?t:parseInt(t);if(e in Fte)return e;const r=t.toString().toLowerCase();if(r in xm)return xm[r];throw new Error(`Unknown network: ${t}`)}const wT=()=>ET()?new Bte:null;function ET(){return typeof window=="object"&&typeof window.crypto=="object"&&typeof window.crypto.subtle=="object"}class Bte{constructor(){if(!ET())throw new Error("window.crypto.subtle is not available")}async generateKey(e,r,n){return window.crypto.subtle.generateKey(e,r,n)}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 i=await window.crypto.subtle.sign(e,r,n);return new Uint8Array(i)}async verify(e,r,n,i){return window.crypto.subtle.verify(e,r,n,i)}getRandomValues(e){const r=new Uint8Array(e);return window.crypto.getRandomValues(r)}}const ST=()=>kT()?new Ute:null;function kT(){return typeof indexedDB=="object"}class Ute{constructor(){if(this.db=void 0,!kT())throw new Error("IndexedDB is not available");this.db=null}async openDB(e,r,n){return this.db?this.db:(this.db=await wY(e,1,{upgrade(i){i.createObjectStore(r)}}),this.db)}async get(e,r,n){const i=await this.openDB(e,r,1),s=i.transaction(r,"readonly"),o=await i.get(r,n);return await s.done,o}async set(e,r,n,i){const s=await this.openDB(e,r,1),o=s.transaction(r,"readwrite");return await s.put(r,i,n),await o.done,!0}async delete(e,r,n){const i=await this.openDB(e,r,1),s=i.transaction(r,"readwrite");return await i.delete(r,n),await s.done,!0}}const zte="@0xsequence.waas.wallet",Vte="@0xsequence.waas.session_id",qte="@0xsequence.waas.status",Sr=5*60;class Hte{constructor(e={network:1},r=new mT,n=wT(),i=ST()){this.config=e,this.store=r,this.cryptoBackend=n,this.secureStoreBackend=i,this.status=void 0,this.sessionId=void 0,this.wallet=void 0,this.sessionObservers=[],this.gettingSessionIdPromise=void 0,this.status=new vh(this.store,qte,"signed-out"),this.sessionId=new vh(this.store,Vte,void 0),this.wallet=new vh(this.store,zte,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 Mr({},e,{identifier:e==null?void 0:e.identifier,wallet:await this.getWalletAddress(),lifespan:(r=e==null?void 0:e.lifespan)!=null?r:Sr,chainId:dp(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 gm(r,this.cryptoBackend,this.secureStoreBackend);return Kee(n,e)}async signUsingSessionKey(e){const r=await this.getSessionId();if(!r)throw new Error("session not open");return(await gm(r,this.cryptoBackend,this.secureStoreBackend)).sign(e)}async getSessionId(){var e=this;if(this.gettingSessionIdPromise)return this.gettingSessionIdPromise;const r=async function(){let i=await e.sessionId.get();return i||(i=await(await Ote(e.cryptoBackend,e.secureStoreBackend)).sessionId(),await e.sessionId.set(i),e.signalObservers(e.sessionObservers,i)),e.gettingSessionIdPromise=void 0,i};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(),i=await BA({sessionId:n,identityType:cr.None,idToken:e,lifespan:Sr});return await this.status.set("pending"),this.signIntent(i)}async initiateGuestAuth(){const e=await this.getSessionId(),r=await nf({sessionId:e,identityType:cr.Guest,verifier:e,lifespan:Sr});return this.signIntent(r)}async initiateEmailAuth(e){const r=await this.getSessionId(),n=await nf({sessionId:r,identityType:cr.Email,verifier:`${e};${r}`,lifespan:Sr});return this.signIntent(n)}async initiateIdTokenAuth(e,r){const n=await this.getSessionId(),i=Xe(_t(e)),s=await nf({sessionId:n,identityType:cr.OIDC,verifier:`${i};${r}`,lifespan:Sr});return this.signIntent(s)}async initiateStytchAuth(e,r){const n=await this.getSessionId(),i=Xe(_t(e)),s=await nf({sessionId:n,identityType:cr.Stytch,verifier:`${i};${r}`,lifespan:Sr});return this.signIntent(s)}async initiatePlayFabAuth(e,r){const n=await this.getSessionId(),i=Xe(_t(r)),s=await nf({sessionId:n,identityType:cr.PlayFab,verifier:`${e}|${i}`,lifespan:Sr});return this.signIntent(s)}async completeAuth(e,r){const n=await this.getSessionId(),i=await BA(Mr({},r,{sessionId:n,lifespan:Sr},e));return await this.status.set("pending"),this.signIntent(i)}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=UA({lifespan:e||Sr,sessionId:r});return this.signIntent(n)}async signOutSession(e){const r=UA({lifespan:Sr,sessionId:e});return this.signIntent(r)}async listSessions(){const e=cte({lifespan:Sr,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=ute({lifespan:(r=e.lifespan)!=null?r:Sr,network:dp(e.network||this.config.network).toString(),wallet:await this.getWalletAddress(),nonce:e.nonce});return this.signIntent(n)}async signMessage(e){var r;const n=Jee(Mr({chainId:dp(e.network||this.config.network)},e,{lifespan:(r=e.lifespan)!=null?r:Sr,wallet:await this.getWalletAddress()}));return this.signIntent(n)}async sendTransaction(e){const r=Hu(await this.commonArgs(e));return this.signIntent(r)}async getTransactionReceipt(e){const r=xte(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=bte(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=wte(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=Ete(await this.commonArgs(e));return this.signIntent(r)}async callContract(e){const r=Ste(await this.commonArgs(e));return this.signIntent(r)}async feeOptions(e){const r=mte(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 ate({lifespan:Sr,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=fte({sessionId:e,wallet:await this.getWalletAddress(),lifespan:Sr});return this.signIntent(r)}async finishValidateSession(e,r){const n=await this.sessionId.get();if(!n)throw new Error("session not open");const i=await this.getWalletAddress(),s=lte({sessionId:n,wallet:i,lifespan:Sr,salt:e,challenge:r});return this.signIntent(s)}async listAccounts(){const e=Dte({wallet:await this.getWalletAddress(),lifespan:Sr});return this.signIntent(e)}async linkAccount(e){const r=await this.sessionId.get();if(!r)throw new Error("session not open");const n=Lte(Mr({wallet:await this.getWalletAddress(),lifespan:Sr,sessionId:r},e));return this.signIntent(n)}async removeAccount({accountId:e}){const r=jte({wallet:await this.getWalletAddress(),lifespan:Sr,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=dte({wallet:await this.getWalletAddress(),lifespan:Sr,sessionId:r,nonce:e});return this.signIntent(n)}async batch(e){const r=Ate(e);return this.signIntent(r)}signalObservers(e,r){e.forEach(n=>n(r))}async updateIntentTime(e,r){const n=Qee(e,r);return this.signIntent(n)}}class Wte{constructor(e,r){this.hostname=void 0,this.fetch=void 0,this.path="/rpc/WaasAuthenticator/",this.registerSession=(n,i,s)=>this.fetch(this.url("RegisterSession"),hp(n,i,s)).then(o=>vp(o).then(a=>({session:a.session,response:a.response})),o=>{throw ph.new({cause:`fetch(): ${o.message||""}`})}),this.sendIntent=(n,i,s)=>this.fetch(this.url("SendIntent"),hp(n,i,s)).then(o=>vp(o).then(a=>({response:a.response})),o=>{throw ph.new({cause:`fetch(): ${o.message||""}`})}),this.chainList=(n,i)=>this.fetch(this.url("ChainList"),hp({},n,i)).then(s=>vp(s).then(o=>({chains:o.chains})),s=>{throw ph.new({cause:`fetch(): ${s.message||""}`})}),this.hostname=e,this.fetch=(n,i)=>r(n,i)}url(e){return this.hostname+this.path+e}}const hp=(t={},e={},r=null)=>({method:"POST",headers:Mr({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),vp=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let i="";throw n instanceof Error&&(i=n.message),IT.new({status:t.status,cause:`JSON.parse(): ${i}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(nre[n]||Er).new(r)}return r});let Er=class AT extends Error{constructor(e,r,n,i,s){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 i=="number"?i:0,this.cause=s,Object.setPrototypeOf(this,AT.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}},Gte=class CT extends Er{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,CT.prototype)}},ph=class _T extends Er{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,_T.prototype)}},Kte=class TT extends Er{constructor(e="WebrpcBadRoute",r=-2,n="bad route",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,TT.prototype)}},Yte=class PT extends Er{constructor(e="WebrpcBadMethod",r=-3,n="bad method",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,PT.prototype)}},Qte=class RT extends Er{constructor(e="WebrpcBadRequest",r=-4,n="bad request",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,RT.prototype)}},IT=class OT extends Er{constructor(e="WebrpcBadResponse",r=-5,n="bad response",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,OT.prototype)}},Jte=class MT extends Er{constructor(e="WebrpcServerPanic",r=-6,n="server panic",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,MT.prototype)}},Xte=class NT extends Er{constructor(e="WebrpcInternalError",r=-7,n="internal error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,NT.prototype)}},Zte=class $T extends Er{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,$T.prototype)}},ere=class DT extends Er{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,DT.prototype)}},tre=class LT extends Er{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,LT.prototype)}},rre=class jT extends Er{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,jT.prototype)}};class zb extends Er{constructor(e="TenantNotFound",r=1001,n="Tenant not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,zb.prototype)}}class bu extends Er{constructor(e="EmailAlreadyInUse",r=7e3,n="Could not create account as the email is already in use",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,bu.prototype)}}class Vb extends Er{constructor(e="AccountAlreadyLinked",r=7001,n="Could not link account as it is linked to another wallet",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Vb.prototype)}}class qb extends Er{constructor(e="ProofVerificationFailed",r=7002,n="The authentication proof could not be verified",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,qb.prototype)}}class wu extends Er{constructor(e="AnswerIncorrect",r=7003,n="The provided answer is incorrect",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,wu.prototype)}}class Hb extends Er{constructor(e="ChallengeExpired",r=7004,n="The challenge has expired",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Hb.prototype)}}class Wb extends Er{constructor(e="TooManyAttempts",r=7005,n="Too many attempts",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Wb.prototype)}}const nre={0:Gte,[-1]:ph,[-2]:Kte,[-3]:Yte,[-4]:Qte,[-5]:IT,[-6]:Jte,[-7]:Xte,[-8]:Zte,[-9]:ere,[-10]:tre,1e3:rre,1001:zb,7e3:bu,7001:Vb,7002:qb,7003:wu,7004:Hb,7005:Wb};function Nd(t){return typeof t=="object"&&t.code===Nc.authInitiated&&typeof t.data=="object"&&typeof t.data.sessionId=="string"&&typeof t.data.identityType=="string"&&typeof t.data.expiresIn=="number"}function Wu(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 FT(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 ire(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 zA(t){return Wu(t)||ire(t)||FT(t)}function sre(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 ore(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 are(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="feeOptions"&&typeof t.data=="object"&&Array.isArray(t.data.feeOptions)}function lre(t){return typeof t=="object"&&t.code===Nc.validationRequired&&typeof t.data=="object"&&typeof t.data.sessionId=="string"}function cre(t){return typeof t=="object"&&t.code===Nc.validationFinished&&typeof t.data=="object"}function fre(t){return typeof t=="object"&&typeof t.code=="string"&&t.code==="sessionClosed"}function ure(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 dre(t){return typeof t=="object"&&t.code===Nc.accountFederated&&typeof t.data=="object"&&typeof t.data.account=="object"}function hre(t){return typeof t=="object"&&t.code===Nc.accountList&&typeof t.data=="object"}function VA(t){var e,r;return!!(t instanceof Er&&((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 vre(t){return typeof t=="object"&&t.code===Nc.idToken&&typeof t.data=="object"&&typeof t.data.idToken=="string"}class pre{constructor(e,r){this.region=e,this.clientId=r,this.cognitoMemo=void 0}cognito(){return this.cognitoMemo||(this.cognitoMemo=new FZ({region:this.region})),this.cognitoMemo}signUp(e){return e=e.toLowerCase().trim(),this.cognito().send(new zee({ClientId:this.clientId,Username:e,Password:"aB1%"+yre(14),UserAttributes:[{Name:"email",Value:e}]}))}signIn(e){return e=e.toLowerCase().trim(),this.cognito().send(new Bee({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 I1&&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:i}){r=r.toLowerCase().trim();const s=await this.cognito().send(new Uee({ClientId:this.clientId,Session:e,ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:{USERNAME:r,ANSWER:n},ClientMetadata:{SESSION_HASH:i}}));if(!s.AuthenticationResult||!s.AuthenticationResult.IdToken)throw new Error("AuthenticationResult.IdToken is empty");return{idToken:s.AuthenticationResult.IdToken}}}function yre(t){return Array.from(mre(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}function mre(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{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 i=await this.waas.validateSession({deviceMetadata:(r=await this.deviceName.get())!=null?r:"Unknown device"}),s=await this.sendIntent(i);this.validationRequiredSalt=s.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(VA(n)&&this.lastDate){const i=await this.waas.updateIntentTime(e,this.lastDate);return(await this.client.sendIntent({intent:i},this.headers())).response}throw n}}async isSignedIn(){return this.waas.isSignedIn()}signIn(e,r){var n=this;const i="email"in e;return i&&this.emailAuthCodeRequiredCallback.length==0?Promise.reject("Missing emailAuthCodeRequired callback"):new Promise(async function(s,o){let a;try{a=await n.initAuth(e)}catch(c){return o(c)}const l=async function(f){try{const u=await n.completeAuth(a.withAnswer(f),{sessionName:r});s(u)}catch(u){if(u instanceof wu)throw u;if(u instanceof bu){const d=async function(){try{const m=await n.completeAuth(a.withAnswer(f),{sessionName:r,forceCreateAccount:!0});s(m)}catch(m){o(m)}},h={type:cr.None,email:"",issuer:""};if(u.cause){const p=u.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(u)}};if(i)for(const c of n.emailAuthCodeRequiredCallback)c(l);else l("")})}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(!Nd(n))throw new Error(`Invalid response: ${JSON.stringify(n)}`);return new gre(e,n.data.challenge)}async initIdTokenAuth(e){var r;const n=vT(e),i=((r=n.iss)==null?void 0:r.startsWith("stytch.com/"))||!1,s=i?await this.waas.initiateStytchAuth(e,n.exp):await this.waas.initiateIdTokenAuth(e,n.exp),o=await this.sendIntent(s);if(!Nd(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`);return i?new xre(e):new BT(e)}async initEmailAuth(e){const r=await this.waas.getSessionId(),n=await this.waas.initiateEmailAuth(e),i=await this.sendIntent(n);if(!Nd(i))throw new Error(`Invalid response: ${JSON.stringify(i)}`);return new Gb(e,r,i.data.challenge)}async initPlayFabAuth(e,r){const n=await this.waas.initiatePlayFabAuth(e,r),i=await this.sendIntent(n);if(!Nd(i))throw new Error(`Invalid response: ${JSON.stringify(i)}`);return new bre(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 i=await this.registerSession(n,r.sessionName);return await this.waas.completeSignIn({code:"sessionOpened",data:{sessionId:i.session.id,wallet:i.response.data.wallet}}),{sessionId:i.session.id,wallet:i.response.data.wallet,email:i.session.identity.email}}catch(i){throw!(i instanceof bu)&&!(i instanceof wu)&&await this.waas.completeSignOut(),i}}async registerSession(e,r){try{return await this.client.registerSession({intent:e,friendlyName:r},this.headers())}catch(n){if(VA(n)&&this.lastDate){const i=await this.waas.updateIntentTime(e,this.lastDate);return await this.client.registerSession({intent:i,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 Xe(_t(e))}async dropSession({sessionId:e,strict:r}={}){const n=await this.waas.getSessionId();if(!n)throw new Error("session not open");const i=e||n;try{const s=await this.waas.signOutSession(i),o=await this.sendIntent(s);if(!fre(o))throw new Error(`Invalid response: ${JSON.stringify(o)}`)}catch(s){if(r)throw s;console.error(s)}if(i===n){if(!this.secureStoreBackend)throw new Error("No secure store available");(await gm(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(i=>Mr({},i,{isThis:i.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(!cre(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(!ure(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(i,r))}return!1}async sessionAuthProof({nonce:e,network:r,validation:n}){const i=await this.waas.sessionAuthProof({nonce:e,network:r});return await this.trySendIntent({validation:n},i,ore)}async listAccounts(){const e=await this.waas.listAccounts(),r=await this.sendIntent(e);if(!hre(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(!dre(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(!vre(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 Mr({},e,{identifier:r})}async trySendIntent(e,r,n){const i=await this.sendIntent(r);if(n(i))return i;if(lre(i)&&await this.handleValidationRequired(e.validation)){const o=await this.sendIntent(r);if(n(o))return o}throw new Error(JSON.stringify(i))}async signMessage(e){const r=await this.waas.signMessage(await this.useIdentifier(e));return this.trySendIntent(e,r,sre)}async trySendTransactionIntent(e,r){let n=await this.trySendIntent(r,e,zA);for(;FT(n);){await new Promise(o=>setTimeout(o,1e3));const i={metaTxHash:n.data.metaTxHash,network:e.data.network,identifier:e.data.identifier,validation:r.validation},s=await this.waas.getTransactionReceipt(await this.useIdentifier(i));n=await this.trySendIntent(i,s,zA)}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,are)}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 window.fetch(e,r),i=n.headers.get("date");return i&&(this.lastDate=new Date(i)),n}}const kre=t=>{if(t.type===cr.PlayFab)return"PlayFab login";if(t.type===cr.Email)return"Email login";if(t.type===cr.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"},Are=t=>{const{onCancel:e,onConfirm:r}=t;return $.jsxs(G,{style:{maxWidth:"600px"},flexDirection:"column",paddingX:"10",paddingY:"4",alignItems:"center",gap:"4",children:[$.jsx(G,{children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Email already in use"})}),$.jsx(G,{height:"full",children:$.jsxs(me,{as:"div",variant:"normal",color:"text50",textAlign:"center",children:["Another account with this email address ",$.jsxs(me,{color:"text80",children:["(",t.info.email,")"]})," already exists with account type ",$.jsxs(me,{color:"text80",children:["(",kre(t.info),")"]}),". You can cancel this or force create a new account."]})}),$.jsxs(G,{flexDirection:"row",gap:"3",marginTop:"6",marginBottom:"2",children:[$.jsx(Ct,{label:"Cancel",onClick:e}),$.jsx(Ct,{variant:"primary",label:"Create new account",onClick:r})]})]})};function k0(){return k0=Object.assign?Object.assign.bind():function(t){for(var e=1;ethis.fetch(this.url("Ping"),Ft({},n,i)).then(s=>Gt(s).then(o=>({status:o.status})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.version=(n,i)=>this.fetch(this.url("Version"),Ft({},n,i)).then(s=>Gt(s).then(o=>({version:o.version})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.runtimeStatus=(n,i)=>this.fetch(this.url("RuntimeStatus"),Ft({},n,i)).then(s=>Gt(s).then(o=>({status:o.status})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.getChainID=(n,i)=>this.fetch(this.url("GetChainID"),Ft({},n,i)).then(s=>Gt(s).then(o=>({chainID:o.chainID})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.getEtherBalance=(n,i,s)=>this.fetch(this.url("GetEtherBalance"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({balance:a.balance})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenBalances=(n,i,s)=>this.fetch(this.url("GetTokenBalances"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSupplies=(n,i,s)=>this.fetch(this.url("GetTokenSupplies"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,contractType:a.contractType,tokenIDs:a.tokenIDs})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSuppliesMap=(n,i,s)=>this.fetch(this.url("GetTokenSuppliesMap"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({supplies:a.supplies})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getBalanceUpdates=(n,i,s)=>this.fetch(this.url("GetBalanceUpdates"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTransactionHistory=(n,i,s)=>this.fetch(this.url("GetTransactionHistory"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.syncBalance=(n,i,s)=>this.fetch(this.url("SyncBalance"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceipt=(n,i,s)=>this.fetch(this.url("FetchTransactionReceipt"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({receipt:a.receipt})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getOrderbookOrders=(n,i,s)=>this.fetch(this.url("GetOrderbookOrders"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,orders:a.orders})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTopOrders=(n,i,s)=>this.fetch(this.url("GetTopOrders"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({orders:a.orders})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceiptWithFilter=(n,i,s)=>this.fetch(this.url("FetchTransactionReceiptWithFilter"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({receipt:a.receipt})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getAllWebhookListeners=(n,i,s)=>this.fetch(this.url("GetAllWebhookListeners"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({listeners:a.listeners})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getWebhookListener=(n,i,s)=>this.fetch(this.url("GetWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({listener:a.listener})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.addWebhookListener=(n,i,s)=>this.fetch(this.url("AddWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status,listener:a.listener})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.updateWebhookListener=(n,i,s)=>this.fetch(this.url("UpdateWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.removeWebhookListener=(n,i,s)=>this.fetch(this.url("RemoveWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.toggleWebhookListener=(n,i,s)=>this.fetch(this.url("ToggleWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({webhookListener:a.webhookListener})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.pauseAllWebhookListeners=(n,i,s)=>this.fetch(this.url("PauseAllWebhookListeners"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.resumeAllWebhookListeners=(n,i,s)=>this.fetch(this.url("ResumeAllWebhookListeners"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.subscribeReceipts=(n,i)=>{const s=()=>this.fetch(this.url("SubscribeReceipts"),Ft(n,i.headers,i.signal)).then(async function(o){await pp(o,i,s)},o=>{i.onError(o,s)});return s()},this.subscribeEvents=(n,i)=>{const s=()=>this.fetch(this.url("SubscribeEvents"),Ft(n,i.headers,i.signal)).then(async function(o){await pp(o,i,s)},o=>{i.onError(o,s)});return s()},this.subscribeBalanceUpdates=(n,i)=>{const s=()=>this.fetch(this.url("SubscribeBalanceUpdates"),Ft(n,i.headers,i.signal)).then(async function(o){await pp(o,i,s)},o=>{i.onError(o,s)});return s()},this.hostname=e,this.fetch=(n,i)=>r(n,i)}url(e){return this.hostname+this.path+e}}const pp=async(t,e,r)=>{const{onMessage:n,onOpen:i,onClose:s,onError:o}=e;if(!t.ok){try{await Gt(t)}catch(h){o(h,r)}return}if(!t.body){o(vc.new({status:t.status,cause:"Invalid response, missing body"}),r);return}i&&i();const a=t.body.getReader(),l=new TextDecoder;let c="",f=Date.now();const u=(10+1)*1e3;let d;try{for(d=setInterval(()=>{if(Date.now()-f>u)throw Kl.new({cause:"Stream timed out"})},u);;){let h,p;try{({value:h,done:p}=await a.read()),f=Date.now(),c+=l.decode(h,{stream:!0})}catch(x){let b="";x instanceof Error&&(b=x.message),x instanceof DOMException&&x.name==="AbortError"?o($t.new({message:"AbortError",cause:`AbortError: ${b}`}),()=>{throw new Error("Abort signal cannot be used to reconnect")}):o(Kl.new({cause:`reader.read(): ${b}`}),r);return}let m=c.split(` +`);for(let x=0;x({method:"POST",headers:k0({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),Gt=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let i="";throw n instanceof Error&&(i=n.message),vc.new({status:t.status,cause:`JSON.parse(): ${i}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(UT[n]||yt).new(r)}return r});class yt extends Error{constructor(e,r,n,i,s){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 i=="number"?i:0,this.cause=s,Object.setPrototypeOf(this,yt.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}}class Kb extends yt{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Kb.prototype)}}class $t extends yt{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,$t.prototype)}}class Yb extends yt{constructor(e="WebrpcBadRoute",r=-2,n="bad route",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Yb.prototype)}}class Qb extends yt{constructor(e="WebrpcBadMethod",r=-3,n="bad method",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Qb.prototype)}}class Jb extends yt{constructor(e="WebrpcBadRequest",r=-4,n="bad request",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Jb.prototype)}}class vc extends yt{constructor(e="WebrpcBadResponse",r=-5,n="bad response",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,vc.prototype)}}class Xb extends yt{constructor(e="WebrpcServerPanic",r=-6,n="server panic",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Xb.prototype)}}class Zb extends yt{constructor(e="WebrpcInternalError",r=-7,n="internal error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Zb.prototype)}}class ew extends yt{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,ew.prototype)}}class Kl extends yt{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Kl.prototype)}}class tw extends yt{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,tw.prototype)}}class rw extends yt{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,rw.prototype)}}class nw extends yt{constructor(e="PermissionDenied",r=1001,n="Permission denied",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,nw.prototype)}}class iw extends yt{constructor(e="SessionExpired",r=1002,n="Session expired",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,iw.prototype)}}class sw extends yt{constructor(e="MethodNotFound",r=1003,n="Method not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,sw.prototype)}}class ow extends yt{constructor(e="RequestConflict",r=1004,n="Conflict with target resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,ow.prototype)}}class aw extends yt{constructor(e="Aborted",r=1005,n="Request aborted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,aw.prototype)}}class lw extends yt{constructor(e="Timeout",r=2e3,n="Request timed out",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,lw.prototype)}}class cw extends yt{constructor(e="InvalidArgument",r=2001,n="Invalid argument",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,cw.prototype)}}class fw extends yt{constructor(e="Unavailable",r=2002,n="Unavailable resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,fw.prototype)}}class uw extends yt{constructor(e="QueryFailed",r=2003,n="Query failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,uw.prototype)}}class dw extends yt{constructor(e="ResourceExhausted",r=2004,n="Resource exhausted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,dw.prototype)}}class hw extends yt{constructor(e="NotFound",r=3e3,n="Resource not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,hw.prototype)}}class vw extends yt{constructor(e="ProjectNotFound",r=3002,n="Project not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,vw.prototype)}}class pw extends yt{constructor(e="MetadataCallFailed",r=3003,n="Metadata service call failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,pw.prototype)}}const UT={0:Kb,[-1]:$t,[-2]:Yb,[-3]:Qb,[-4]:Jb,[-5]:vc,[-6]:Xb,[-7]:Zb,[-8]:ew,[-9]:Kl,[-10]:tw,1e3:rw,1001:nw,1002:iw,1003:sw,1004:ow,1005:aw,2e3:lw,2001:cw,2002:fw,2003:uw,2004:dw,3e3:hw,3002:vw,3003:pw},qA=typeof global=="object"?global.fetch:window.fetch;class zT extends Cre{constructor(e,r,n){super(e.endsWith("/")?e.slice(0,-1):e,qA),this.projectAccessKey=r,this.jwtAuth=n,this._fetch=(i,s)=>{const o={},a=this.jwtAuth,l=this.projectAccessKey;return a&&a.length>0&&(o.Authorization=`BEARER ${a}`),l&&l.length>0&&(o["X-Access-Key"]=l),s.headers=k0({},s.headers,o),qA(i,s)},this.fetch=this._fetch}}const HA=[..."🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐸🐵🙈🙉🙊🐒🐔🐧🐦🐤🐣🐥🦆🦅🦉🦇🐺🐗🐴🦄🐝🐛🦋🐌🐞🐜🦟🦗🕷🕸🦂🐢🐍🦎🦖🦕🐙🦑🦐🦞🦀🐡🐠🐟🐬🐳🐋🦈🐊🐅🐆🦓🦍🦧🐘🦛🦏🐪🐫🦒🦘🐃🐂🐄🐎🐖🐏🐑🦙🐐🦌🐕🐩🦮🐈🐓🦃🦚🦜🦢🦩🕊🐇🦝🦨🦡🦦🦥🐁🐀🐿🦔🐾🐉🐲🌵🎄🌲🌳🌴🌱🌿🍀🎍🎋🍃👣🍂🍁🍄🐚🌾💐🌷🌹🥀🌺🌸🌼🌻🌞🌝🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🥭🍍🥥🥝🍅🥑🥦🥬🥒🌶🌽🥕🧄🧅🥔🍠🥐🥯🍞🥖🥨🧀🥚🍳🧈🥞🧇🥓🥩🍗🍖🦴🌭🍔🍟🍕🥪🥙🧆🌮🌯🥗🥘🥫🍝🍜🍲🍛🍣🍱🥟🦪🍤🍙🍚🍘🍥🥠🥮🍢🍡🍧🍨🍦🥧🧁🍰🎂🍮🍭🍬🍫🍿🍩🍪🌰🥜👀👂👃👄👅👆👇👈👉👊👋👌👍👎👏👐👑👒👓🎯🎰🎱🎲🎳👾👯👺👻👽🏂🏃🏄"];function wo(){const e=em.en,r=HA[Math.floor(Math.random()*HA.length)],n=e.getWord(Math.floor(Math.random()*2048)),i=e.getWord(Math.floor(Math.random()*2048));return`${r} ${n} ${i}`}function _re({onSuccess:t}){const[e,r]=y.useState(""),[n,i]=y.useState(),[s,o]=y.useState(!1),[a,l]=y.useState("");return{inProgress:s||!!a,loading:s,error:n,initiateAuth:async u=>{o(!0);try{const{instance:d}=await Re.email.initiateAuth({email:u});l(d),r(u)}catch(d){console.error(d),i(d.message||"Unknown error")}finally{o(!1)}},sendChallengeAnswer:a?async u=>{o(!0);try{const d=await Re.getSessionHash(),h=await Re.email.finalizeAuth({instance:a,answer:u,email:e,sessionHash:d});if(!("idToken"in h))throw new Error("invalid identity returned by finalizeAuth");t(h.idToken)}catch(d){i(d.message||"Unknown error")}finally{o(!1)}}:void 0}}const yh=t=>t.name==="AccountAlreadyLinked";function VT({onSuccess:t,sessionName:e,linkAccount:r=!1}){const n=P8(),[i,s]=y.useState(),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[f,u]=y.useState(),[d,h]=y.useState();return y.useEffect(()=>Re.onEmailAuthCodeRequired(async b=>{a(!1),u(()=>b)}),[Re,a,u]),{inProgress:l,initiateAuth:async b=>{a(!0),c(!0);try{if(r){const w=await Re.initAuth({email:b});h(w),a(!1)}else{const w=await Re.signIn({email:b},e);t(w)}}catch(w){s(w.message||"Unknown error")}finally{r||(a(!1),c(!1))}},loading:o,error:i,sendChallengeAnswer:l?async b=>{if(r&&d){try{await Re.linkAccount(d.withAnswer(b))}catch(w){yh(w)&&n({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}a(!1),c(!1);return}f&&await f(b)}:void 0,cancel:()=>{c(!1),a(!1),h(void 0),u(null)}}}const Tre=({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(i=>!(i in n))?!1:Object.entries(r).filter(([i])=>!t.includes(i)).every(([i,s])=>e(s,n[i])):r===n;return e},Pre=Tre(),Rre=(t,e)=>t===e?e:Object.keys(t).reduce((r,n)=>(n in e&&Pre(t[n],e[n])&&(r[n]=t[n]),r),Object.assign({},e)),Ire=t=>{const e=y.useRef(!0),[r,n]=y.useState(t);y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]);const i=y.useCallback(s=>{e.current&&n(s)},[]);return[r,i]},qT=(t,e="StytchProvider")=>`${t} can only be used inside <${e}>.`,Ore="You cannot render a inside another .",Mre=`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 k0(t,e){if(!t)throw new Error(e)}const Ore={user:null,fromCache:!1},Mre={session:null,fromCache:!1},Kb=y.createContext({isMounted:!1}),Nre=y.createContext(Ore),zT=y.createContext(Mre),VT=()=>y.useContext(Kb).isMounted,$re=()=>(k0(VT(),UT("useStytchSession")),y.useContext(zT)),Dre=()=>{const t=y.useContext(Kb);return k0(t.isMounted,UT("useStytch")),t.client},Lre=({stytch:t,children:e})=>{k0(!VT(),Rre),k0(typeof window<"u",Ire);const r=y.useMemo(()=>({client:t,isMounted:!0}),[t]),[{user:n,session:i},s]=Pre({session:t.session.getInfo(),user:t.user.getInfo()});return y.useEffect(()=>t.onStateChange(()=>{s(o=>{const a={session:t.session.getInfo(),user:t.user.getInfo()};return Tre(o,a)})}),[s,t]),vr.createElement(Kb.Provider,{value:r},vr.createElement(Nre.Provider,{value:n},vr.createElement(zT.Provider,{value:i},e)))};function A0(){return A0=Object.assign?Object.assign.bind():function(t){for(var e=1;ethis.fetch(this.url("Ping"),Ft({},n,i)).then(s=>Gt(s).then(o=>({status:o.status})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.version=(n,i)=>this.fetch(this.url("Version"),Ft({},n,i)).then(s=>Gt(s).then(o=>({version:o.version})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.runtimeStatus=(n,i)=>this.fetch(this.url("RuntimeStatus"),Ft({},n,i)).then(s=>Gt(s).then(o=>({status:o.status})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.getChainID=(n,i)=>this.fetch(this.url("GetChainID"),Ft({},n,i)).then(s=>Gt(s).then(o=>({chainID:o.chainID})),s=>{throw $t.new({cause:`fetch(): ${s.message||""}`})}),this.getEtherBalance=(n,i,s)=>this.fetch(this.url("GetEtherBalance"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({balance:a.balance})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenBalances=(n,i,s)=>this.fetch(this.url("GetTokenBalances"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSupplies=(n,i,s)=>this.fetch(this.url("GetTokenSupplies"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,contractType:a.contractType,tokenIDs:a.tokenIDs})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTokenSuppliesMap=(n,i,s)=>this.fetch(this.url("GetTokenSuppliesMap"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({supplies:a.supplies})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getBalanceUpdates=(n,i,s)=>this.fetch(this.url("GetBalanceUpdates"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,balances:a.balances})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTransactionHistory=(n,i,s)=>this.fetch(this.url("GetTransactionHistory"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.syncBalance=(n,i,s)=>this.fetch(this.url("SyncBalance"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceipt=(n,i,s)=>this.fetch(this.url("FetchTransactionReceipt"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({receipt:a.receipt})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getOrderbookOrders=(n,i,s)=>this.fetch(this.url("GetOrderbookOrders"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({page:a.page,orders:a.orders})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getTopOrders=(n,i,s)=>this.fetch(this.url("GetTopOrders"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({orders:a.orders})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.fetchTransactionReceiptWithFilter=(n,i,s)=>this.fetch(this.url("FetchTransactionReceiptWithFilter"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({receipt:a.receipt})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getAllWebhookListeners=(n,i,s)=>this.fetch(this.url("GetAllWebhookListeners"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({listeners:a.listeners})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.getWebhookListener=(n,i,s)=>this.fetch(this.url("GetWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({listener:a.listener})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.addWebhookListener=(n,i,s)=>this.fetch(this.url("AddWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status,listener:a.listener})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.updateWebhookListener=(n,i,s)=>this.fetch(this.url("UpdateWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.removeWebhookListener=(n,i,s)=>this.fetch(this.url("RemoveWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.toggleWebhookListener=(n,i,s)=>this.fetch(this.url("ToggleWebhookListener"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({webhookListener:a.webhookListener})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.pauseAllWebhookListeners=(n,i,s)=>this.fetch(this.url("PauseAllWebhookListeners"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.resumeAllWebhookListeners=(n,i,s)=>this.fetch(this.url("ResumeAllWebhookListeners"),Ft(n,i,s)).then(o=>Gt(o).then(a=>({status:a.status})),o=>{throw $t.new({cause:`fetch(): ${o.message||""}`})}),this.subscribeReceipts=(n,i)=>{const s=()=>this.fetch(this.url("SubscribeReceipts"),Ft(n,i.headers,i.signal)).then(async function(o){await pp(o,i,s)},o=>{i.onError(o,s)});return s()},this.subscribeEvents=(n,i)=>{const s=()=>this.fetch(this.url("SubscribeEvents"),Ft(n,i.headers,i.signal)).then(async function(o){await pp(o,i,s)},o=>{i.onError(o,s)});return s()},this.subscribeBalanceUpdates=(n,i)=>{const s=()=>this.fetch(this.url("SubscribeBalanceUpdates"),Ft(n,i.headers,i.signal)).then(async function(o){await pp(o,i,s)},o=>{i.onError(o,s)});return s()},this.hostname=e,this.fetch=(n,i)=>r(n,i)}url(e){return this.hostname+this.path+e}}const pp=async(t,e,r)=>{const{onMessage:n,onOpen:i,onClose:s,onError:o}=e;if(!t.ok){try{await Gt(t)}catch(h){o(h,r)}return}if(!t.body){o(vc.new({status:t.status,cause:"Invalid response, missing body"}),r);return}i&&i();const a=t.body.getReader(),l=new TextDecoder;let c="",f=Date.now();const u=(10+1)*1e3;let d;try{for(d=setInterval(()=>{if(Date.now()-f>u)throw Kl.new({cause:"Stream timed out"})},u);;){let h,p;try{({value:h,done:p}=await a.read()),f=Date.now(),c+=l.decode(h,{stream:!0})}catch(x){let b="";x instanceof Error&&(b=x.message),x instanceof DOMException&&x.name==="AbortError"?o($t.new({message:"AbortError",cause:`AbortError: ${b}`}),()=>{throw new Error("Abort signal cannot be used to reconnect")}):o(Kl.new({cause:`reader.read(): ${b}`}),r);return}let m=c.split(` -`);for(let x=0;x({method:"POST",headers:A0({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),Gt=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let i="";throw n instanceof Error&&(i=n.message),vc.new({status:t.status,cause:`JSON.parse(): ${i}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(qT[n]||yt).new(r)}return r});class yt extends Error{constructor(e,r,n,i,s){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 i=="number"?i:0,this.cause=s,Object.setPrototypeOf(this,yt.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}}class Yb extends yt{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Yb.prototype)}}class $t extends yt{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,$t.prototype)}}class Qb extends yt{constructor(e="WebrpcBadRoute",r=-2,n="bad route",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Qb.prototype)}}class Jb extends yt{constructor(e="WebrpcBadMethod",r=-3,n="bad method",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Jb.prototype)}}class Xb extends yt{constructor(e="WebrpcBadRequest",r=-4,n="bad request",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Xb.prototype)}}class vc extends yt{constructor(e="WebrpcBadResponse",r=-5,n="bad response",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,vc.prototype)}}class Zb extends yt{constructor(e="WebrpcServerPanic",r=-6,n="server panic",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Zb.prototype)}}class ew extends yt{constructor(e="WebrpcInternalError",r=-7,n="internal error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,ew.prototype)}}class tw extends yt{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,tw.prototype)}}class Kl extends yt{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Kl.prototype)}}class rw extends yt{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,rw.prototype)}}class nw extends yt{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,nw.prototype)}}class iw extends yt{constructor(e="PermissionDenied",r=1001,n="Permission denied",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,iw.prototype)}}class sw extends yt{constructor(e="SessionExpired",r=1002,n="Session expired",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,sw.prototype)}}class ow extends yt{constructor(e="MethodNotFound",r=1003,n="Method not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,ow.prototype)}}class aw extends yt{constructor(e="RequestConflict",r=1004,n="Conflict with target resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,aw.prototype)}}class lw extends yt{constructor(e="Aborted",r=1005,n="Request aborted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,lw.prototype)}}class cw extends yt{constructor(e="Timeout",r=2e3,n="Request timed out",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,cw.prototype)}}class fw extends yt{constructor(e="InvalidArgument",r=2001,n="Invalid argument",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,fw.prototype)}}class uw extends yt{constructor(e="Unavailable",r=2002,n="Unavailable resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,uw.prototype)}}class dw extends yt{constructor(e="QueryFailed",r=2003,n="Query failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,dw.prototype)}}class hw extends yt{constructor(e="ResourceExhausted",r=2004,n="Resource exhausted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,hw.prototype)}}class vw extends yt{constructor(e="NotFound",r=3e3,n="Resource not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,vw.prototype)}}class pw extends yt{constructor(e="ProjectNotFound",r=3002,n="Project not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,pw.prototype)}}class yw extends yt{constructor(e="MetadataCallFailed",r=3003,n="Metadata service call failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,yw.prototype)}}const qT={0:Yb,[-1]:$t,[-2]:Qb,[-3]:Jb,[-4]:Xb,[-5]:vc,[-6]:Zb,[-7]:ew,[-8]:tw,[-9]:Kl,[-10]:rw,1e3:nw,1001:iw,1002:sw,1003:ow,1004:aw,1005:lw,2e3:cw,2001:fw,2002:uw,2003:dw,2004:hw,3e3:vw,3002:pw,3003:yw},qA=typeof global=="object"?global.fetch:window.fetch;class HT extends jre{constructor(e,r,n){super(e.endsWith("/")?e.slice(0,-1):e,qA),this.projectAccessKey=r,this.jwtAuth=n,this._fetch=(i,s)=>{const o={},a=this.jwtAuth,l=this.projectAccessKey;return a&&a.length>0&&(o.Authorization=`BEARER ${a}`),l&&l.length>0&&(o["X-Access-Key"]=l),s.headers=A0({},s.headers,o),qA(i,s)},this.fetch=this._fetch}}const HA=[..."🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐸🐵🙈🙉🙊🐒🐔🐧🐦🐤🐣🐥🦆🦅🦉🦇🐺🐗🐴🦄🐝🐛🦋🐌🐞🐜🦟🦗🕷🕸🦂🐢🐍🦎🦖🦕🐙🦑🦐🦞🦀🐡🐠🐟🐬🐳🐋🦈🐊🐅🐆🦓🦍🦧🐘🦛🦏🐪🐫🦒🦘🐃🐂🐄🐎🐖🐏🐑🦙🐐🦌🐕🐩🦮🐈🐓🦃🦚🦜🦢🦩🕊🐇🦝🦨🦡🦦🦥🐁🐀🐿🦔🐾🐉🐲🌵🎄🌲🌳🌴🌱🌿🍀🎍🎋🍃👣🍂🍁🍄🐚🌾💐🌷🌹🥀🌺🌸🌼🌻🌞🌝🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🥭🍍🥥🥝🍅🥑🥦🥬🥒🌶🌽🥕🧄🧅🥔🍠🥐🥯🍞🥖🥨🧀🥚🍳🧈🥞🧇🥓🥩🍗🍖🦴🌭🍔🍟🍕🥪🥙🧆🌮🌯🥗🥘🥫🍝🍜🍲🍛🍣🍱🥟🦪🍤🍙🍚🍘🍥🥠🥮🍢🍡🍧🍨🍦🥧🧁🍰🎂🍮🍭🍬🍫🍿🍩🍪🌰🥜👀👂👃👄👅👆👇👈👉👊👋👌👍👎👏👐👑👒👓🎯🎰🎱🎲🎳👾👯👺👻👽🏂🏃🏄"];function wo(){const e=em.en,r=HA[Math.floor(Math.random()*HA.length)],n=e.getWord(Math.floor(Math.random()*2048)),i=e.getWord(Math.floor(Math.random()*2048));return`${r} ${n} ${i}`}function Fre(){const t=Dre(),{session:e}=$re(),[r,n]=y.useState(0),[i,s]=y.useState(""),o=y.useRef(null);y.useEffect(()=>{const l=new URLSearchParams(window.location.search);l.get("stytch_token_type")==="magic_links"&&r===0&&(n(2),(async()=>await t.magicLinks.authenticate(l.get("token")||"",{session_duration_minutes:5}))())},[t,e,r]),y.useEffect(()=>{e&&r==2&&(n(3),(async()=>{const l=t.session.getTokens(),c=await Re.signIn({idToken:l.session_jwt},wo());console.log(`Wallet address: ${c}`),n(0),Ri.navigate("/")})())},[e,t,r]);const a=async l=>{n(1),await t.magicLinks.email.loginOrCreate(l,{})};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Stytch login"})}),$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsx(G,{marginTop:"6",children:$.jsx(Ir,{name:"stytchEmail",type:"email",onChange:l=>{s(l.target.value)},ref:o,onKeyDown:l=>{i&&l.key==="Enter"&&a(i)},value:i,placeholder:"hello@example.com",disabled:r!==0,required:!0})}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(Ct,{variant:"primary",label:"Continue",onClick:()=>a(i),"data-id":"continueButton",disabled:r!==0})}),r===1&&$.jsx(G,{children:$.jsx(me,{variant:"normal",color:"text80",children:"Magic link sent to your email. Please click the link. You can close this page."})})]})]})}function Bre({onSuccess:t}){const[e,r]=y.useState(""),[n,i]=y.useState(),[s,o]=y.useState(!1),[a,l]=y.useState("");return{inProgress:s||!!a,loading:s,error:n,initiateAuth:async u=>{o(!0);try{const{instance:d}=await Re.email.initiateAuth({email:u});l(d),r(u)}catch(d){console.error(d),i(d.message||"Unknown error")}finally{o(!1)}},sendChallengeAnswer:a?async u=>{o(!0);try{const d=await Re.getSessionHash(),h=await Re.email.finalizeAuth({instance:a,answer:u,email:e,sessionHash:d});if(!("idToken"in h))throw new Error("invalid identity returned by finalizeAuth");t(h.idToken)}catch(d){i(d.message||"Unknown error")}finally{o(!1)}}:void 0}}const yh=t=>t.name==="AccountAlreadyLinked";function WT({onSuccess:t,sessionName:e,linkAccount:r=!1}){const n=P8(),[i,s]=y.useState(),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[f,u]=y.useState(),[d,h]=y.useState();return y.useEffect(()=>Re.onEmailAuthCodeRequired(async b=>{a(!1),u(()=>b)}),[Re,a,u]),{inProgress:l,initiateAuth:async b=>{a(!0),c(!0);try{if(r){const w=await Re.initAuth({email:b});h(w),a(!1)}else{const w=await Re.signIn({email:b},e);t(w)}}catch(w){s(w.message||"Unknown error")}finally{r||(a(!1),c(!1))}},loading:o,error:i,sendChallengeAnswer:l?async b=>{if(r&&d){try{await Re.linkAccount(d.withAnswer(b))}catch(w){yh(w)&&n({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}a(!1),c(!1);return}f&&await f(b)}:void 0,cancel:()=>{c(!1),a(!1),h(void 0),u(null)}}}function Ure(){var S;const[t,e]=y.useState(""),r=y.useRef(null),n=(S=r.current)==null?void 0:S.validity.valid,[i,s]=y.useState(!1),[o,a]=y.useState([]),[l,c]=y.useState(!0),[f,u]=y.useState(),[d,h]=y.useState(!1),p=y.useRef(null);Re.onEmailConflict(async(g,R)=>{p.current=R,u(g),h(!0)});const m=K8({flow:"implicit",onSuccess:g=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:g.access_token,CreateAccount:!0,TitleId:"8F854"},async(R,F)=>{if(R)try{const C=await Re.signIn({playFabTitleId:"8F854",playFabSessionTicket:R.data.SessionTicket},wo());console.log("Sequence response:",C),Ri.navigate("/")}catch{console.error("Error: "+JSON.stringify(F))}else F&&console.error("Error: "+JSON.stringify(F))})}}),{inProgress:x,loading:b,initiateAuth:w,sendChallengeAnswer:E,cancel:P}=WT({sessionName:wo(),onSuccess:async({wallet:g})=>{console.log(`Wallet address: ${g}`),Ri.navigate("/")}}),{inProgress:N,loading:I,initiateAuth:j,sendChallengeAnswer:L}=Bre({onSuccess:async g=>{const R=await Re.signIn({idToken:g},wo());console.log(`Wallet address: ${R}`),Ri.navigate("/")}}),U=l?x:N,K=l?b:I,X=l?w:j,ee=l?E:L;y.useEffect(()=>{(async()=>await Re.isSignedIn()&&Ri.navigate("/"))()},[]);const M=async g=>{const R=await Re.signIn({idToken:g.credential},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},v="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":""),_=async g=>{const R=await Re.signIn({idToken:g.authorization.id_token},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},k=async()=>{const g=await Re.signIn({guest:!0},wo());console.log(`Wallet address: ${g.wallet}`),Ri.navigate("/")},A=new URLSearchParams(window.location.search),T=A.get("env")==="dev",[O,D]=y.useState(T);return $.jsxs($.Fragment,{children:[$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsxs(G,{marginBottom:"16",flexDirection:"row",children:[$.jsx(X8,{}),$.jsx(G,{marginLeft:"auto",children:$.jsx(pU,{label:"Use dev env",checked:O,onCheckedChange:()=>{O?(A.delete("env"),window.location.search=A.toString()):(A.set("env","dev"),window.location.search=A.toString()),D(!O)}})})]}),$.jsx(G,{gap:"4",children:$.jsx(Ct,{label:"Guest login",onClick:k})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginTop:"6",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Email Login"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",checked:l,onCheckedChange:()=>{c(!l)}})})]}),ee?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"6",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(J8,{value:o,digits:6,onChange:a})}),$.jsx(G,{gap:"2",marginY:"4",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:o.includes(""),label:"Verify",onClick:()=>ee(o.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:g=>{e(g.target.value)},ref:r,onKeyDown:g=>{t&&g.key==="Enter"&&X(t)},onBlur:()=>s(!!t&&!n),value:t,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),i&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!n,label:"Continue",onClick:()=>X(t),"data-id":"continueButton"})})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{paddingY:"4",gap:"4",flexDirection:"column",width:"full",children:!U&&$.jsxs($.Fragment,{children:[$.jsx(G,{marginBottom:"2",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Social Login"})}),$.jsxs(G,{gap:"4",flexDirection:"column",width:"fit",children:[$.jsx(G,{children:$.jsx(G8,{onSuccess:M,shape:"circle",width:230},"google")}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:v,usePopup:!0},onError:g=>console.error(g),onSuccess:_,uiType:"dark"},"apple")]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Playfab login"})}),$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:m})})]}),$.jsx(Fre,{})]})})]}),d&&f&&$.jsx(i8,{size:"small",onClose:()=>h(!1),children:$.jsx(Are,{info:f,onCancel:()=>{h(!1),u(void 0),U&&(a([]),P(),e(""))},onConfirm:async()=>{var g;h(!1),u(void 0),await((g=p.current)==null?void 0:g.call(p))}})})]})}async function M1({transactions:t,network:e}){const r=await Re.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 N1(t){var s;const{feeOptions:e,onSelected:r}=t,[n,i]=y.useState();return y.useEffect(()=>{e&&e.length>0&&(i(e[0]),r(e[0]))},[e]),y.useEffect(()=>{n&&r(n)},[n]),e?$.jsxs(G,{marginTop:"5",children:[$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options:"}),$.jsx(G,{marginTop:"3"}),$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:o=>{const a=e.find(l=>l.token.name===o);a&&i(a)},value:(s=n==null?void 0:n.token)==null?void 0:s.name,options:[...e.map(o=>{var a,l,c;return{label:$.jsx(G,{alignItems:"center",gap:"2",children:$.jsxs(me,{children:[(a=o==null?void 0:o.token)==null?void 0:a.name," ",Dx(o==null?void 0:o.value,(l=o==null?void 0:o.token)==null?void 0:l.decimals)]})}),value:String((c=o==null?void 0:o.token)==null?void 0:c.name)}})]})]}):$.jsx(G,{})}const zre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Vre(t){const[e,r]=y.useState(),[n,i]=y.useState("ETH"),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(),[h,p]=y.useState(!1),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(),[j,L]=y.useState(!1);y.useEffect(()=>{U()},[]),y.useEffect(()=>{var ee,M;if(t.network){const v=Kk(t.network.name);if(v){const _=v.name in{polygon:1,mumbai:1}?"MATIC":"ETH";i(_),U(),(ee=v.blockExplorer)!=null&&ee.rootUrl&&o((M=v.blockExplorer)==null?void 0:M.rootUrl)}}},[t.network]);const U=async()=>{if(!t.network)return;const ee=Kk(t.network.name);if(!ee)return;const M=await Re.getAddress(),_=await new HT(P_(ee.name),zre).getEtherBalance({accountAddress:M});r(ce.from(_.balance.balanceWei))},K=async(ee,M)=>{const v=await M1({transactions:[{to:ee,value:Gk(M)}],network:t.network});if(v.feeQuote&&v.feeOptions){w(v.feeOptions),I(v.feeQuote),console.log("feeOptions",v);return}L(!0),console.log("tx sponsored")},X=async(ee,M)=>{var v;try{x(void 0),p(!0);const _=await Re.sendTransaction({transactions:[{to:ee,value:Gk(M)}],network:(v=t.network)==null?void 0:v.id,transactionsFeeOption:E,transactionsFeeQuote:N});Wu(_)?d(_.data.txHash):x(_.data.error),p(!1)}catch(_){console.error(_),p(!1)}finally{I(void 0),w(void 0),P(void 0),L(!1)}};return $.jsxs(G,{children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Native token balance: ",eY(e||0)," ",n]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:U}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenTo",type:"text",onChange:ee=>{l(ee.target.value)},value:a,placeholder:"To address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenAmount",type:"text",onChange:ee=>{f(ee.target.value)},value:c,placeholder:"Amount",required:!0,"data-id":"nativeTokenSendAmount"})}),m&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",m]}),$.jsx(N1,{feeOptions:b,onSelected:P}),j&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:a===""&&c==="",onClick:()=>K(a,c)}),$.jsx(Ct,{marginTop:"5",label:"Send native token",disabled:a===""&&c==="",onClick:()=>X(a,c)})]}),u&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`${s}tx/${u}`,target:"_blank",rel:"noopener noreferrer",children:u})]})]})}function qre(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState(!0),[o,a]=y.useState(),l=async c=>{s(!0),e(void 0);try{await Re.dropSession({sessionId:c}),e(await Re.listSessions())}catch(f){a(f.message),e(await Re.listSessions())}s(!1)};return y.useEffect(()=>{Promise.all([Re.listSessions(),Re.getSessionId()]).then(([c,f])=>{e(c),n(f),s(!1)}).catch(c=>{a(c.message),s(!1)})},[]),$.jsxs(G,{children:[$.jsxs(G,{marginBottom:"5",children:[$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your open sessions:"})}),t&&$.jsx($.Fragment,{children:t.map(c=>$.jsx(G,{children:$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"normal",children:[c.friendlyName,!c.isThis&&$.jsx("a",{style:{marginLeft:"7px",textDecoration:"underline",cursor:"pointer"},onClick:()=>l(c.id),children:"x"}),c.isThis&&$.jsx($.Fragment,{children:" (current)"})]})},c.id))}),i&&$.jsx(_n,{})]}),o&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading sessions: ",o]})]})}function Hre(t){const[e,r]=y.useState(""),[n,i]=y.useState(),s=async()=>{var a;const o=await Re.signMessage({message:e,network:(a=t.network)==null?void 0:a.id});i(o.data.signature)};return $.jsxs(G,{children:[$.jsx(Ir,{name:"signMessageText",type:"text",onChange:o=>{r(o.target.value),n!=""&&i("")},value:e,placeholder:"Enter a message to sign",required:!0,"data-id":"signMessageInput"}),$.jsx(Ct,{marginTop:"5",label:"Sign message",disabled:e==="",onClick:()=>s()}),n&&n!==""&&$.jsxs(G,{flexDirection:"column",marginTop:"5",children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Signature for ",e,":"]}),$.jsx(G,{children:$.jsx(me,{as:"p",wordBreak:"break-word",children:n})})]})]})}function Wre(t){const[e,r]=y.useState(""),[n,i]=y.useState(""),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(),[u,d]=y.useState(!1),[h,p]=y.useState(),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=async()=>{const U=await M1({transactions:[pT({to:e,abi:n,func:s,args:JSON.parse(a),value:"0"})],network:t.network});if(U.feeQuote&&U.feeOptions){x(U.feeOptions),P(U.feeQuote),console.log("feeOptions",U);return}I(!0),console.log("tx sponsored")},L=async()=>{var U;try{p(void 0),d(!0);const K=await Re.callContract({network:(U=t.network)==null?void 0:U.id,to:e,abi:n,func:s,args:JSON.parse(a),value:0,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(K)?f(K.data.txHash):p(K.data.error),d(!1)}catch(K){console.error(K),d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAddress",type:"text",onChange:U=>{r(U.target.value)},value:e,placeholder:"Contract address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAbi",type:"text",onChange:U=>{i(U.target.value)},value:n,placeholder:"Contract ABI or function ABI, e.g. [{...}] or [{...}, {...}] or transfer(address,uint256)",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractMethod",type:"text",onChange:U=>{o(U.target.value)},value:s,placeholder:"Method name, e.g. transfer",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractArgs",type:"text",onChange:U=>{l(U.target.value)},value:a,placeholder:'Method args, e.g. [0x..., 1000] or named { "to": "0x...", "amount": "1000" }',required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",h]}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>j()}),$.jsx(Ct,{marginTop:"5",label:"Call contract",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>L()})]}),c&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`https://polygonscan.com/tx/${c}`,target:"_blank",rel:"noopener noreferrer",children:c})]})]})}const WA=[{label:"Custom Token",value:"Custom"},{label:"USDC Old",value:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"},{label:"USDC New",value:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"},{label:"DAI",value:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"}];function Gre(t){const[e,r]=y.useState(WA[0].value),[n,i]=y.useState(""),[s,o]=y.useState(!0),[a,l]=y.useState("---"),[c,f]=y.useState(""),[u,d]=y.useState(""),[h,p]=y.useState(""),[m,x]=y.useState(""),[b,w]=y.useState(!1),[E,P]=y.useState(0),[N,I]=y.useState(),[j,L]=y.useState(),[U,K]=y.useState(),[X,ee]=y.useState(!1);y.useEffect(()=>{M(n)},[n]);const M=async A=>{var D;if(!Iq(A)){l("---");return}l("...");const T=new __(`https://nodes.sequence.app/${(D=t.network)==null?void 0:D.name}`),O=new HG(A,["function balanceOf(address) view returns (uint256)","function decimals() view returns (uint8)","function symbol() view returns (string)"],T);try{const[S,g,R]=await Promise.all([O.balanceOf(Re.getAddress()),O.decimals(),O.symbol()]);P(g),l(`${Dx(S,g)} ${R}`)}catch{l("---")}},v=async()=>{const A=await M1({transactions:[Bb({token:n,to:c,value:pu(u,E).toString()})],network:t.network});if(A.feeQuote&&A.feeOptions){I(A.feeOptions),K(A.feeQuote),console.log("feeOptions",A);return}ee(!0),console.log("tx sponsored")},_=async()=>{var A;try{x(""),w(!0);const T=await Re.sendERC20({token:n,to:c,value:pu(u,E),network:(A=t.network)==null?void 0:A.id,transactionsFeeOption:j,transactionsFeeQuote:U});Wu(T)?p(T.data.txHash):x(T.data.error)}catch(T){console.error(T)}finally{w(!1)}},k=A=>{r(A),A==="Custom"?(i(""),o(!0)):(i(A),o(!1))};return $.jsxs(G,{children:[$.jsxs(G,{marginTop:"5",children:[$.jsx(u1,{name:"token",options:WA,value:e??"",onValueChange:A=>k(A)}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:n,disabled:!s,onChange:A=>i(A.target.value),placeholder:"Custom ERC20 Contract Address"})})]}),$.jsxs(G,{marginTop:"3",children:[$.jsxs(me,{variant:"normal",color:"text100",children:["Token Balance: ",a]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:()=>M(n)})]}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:c,onChange:A=>f(A.target.value),placeholder:"Destination Address"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:u,onChange:A=>d(A.target.value),placeholder:"Amount"})}),m&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",m]})}),$.jsx(N1,{feeOptions:N,onSelected:L}),X&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),b?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:n===""&&c==="",onClick:()=>v()}),$.jsx(Ct,{marginTop:"5",label:"Send Token",onClick:_})]}),h&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${h}`,target:"_blank",rel:"noopener noreferrer",children:h})]})]})}const Kre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Yre(t){var a;const[e,r]=y.useState(""),[n,i]=y.useState("");y.useEffect(()=>{t.onChange(t.index,e,n)},[e,n]);const s={display:"flex",gap:"10px",marginBottom:"10px"},o={flex:1};return $.jsxs(G,{style:s,children:[$.jsx(G,{style:o,children:$.jsx(u1,{name:`sendERC1155TokenId${t.index}`,value:e,disabled:!t.options,onValueChange:l=>{r(l)},options:((a=t.options)==null?void 0:a.balances.map(l=>{var c;return{label:`${((c=l.tokenMetadata)==null?void 0:c.name)||"Unknown"} - ${l.balance}`,value:l.tokenID}}))||[],placeholder:"Select a token"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:e,onChange:l=>r(l.target.value),placeholder:"Token ID"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:n,onChange:l=>i(l.target.value),placeholder:"Amount"})}),$.jsx(G,{style:o,children:$.jsx(Ct,{label:"Remove",onClick:()=>t.removeTokenEntry(t.index)})})]})}function Qre(t){const[e,r]=y.useState(""),[n,i]=y.useState([]),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(!1),[h,p]=y.useState(void 0),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=()=>{i([...n,{tokenId:"",amount:""}])},L=async()=>{if(!e||!t.network)return;const M=t.network.name,v=new HT("https://"+M+"-indexer.sequence.app",Kre),_=e,k=await Re.getAddress(),A=!0;p(await v.getTokenBalances({contractAddress:_,accountAddress:k,includeMetadata:A}))};y.useEffect(()=>{L()},[e]);const U=(M,v)=>{const _=[...n];_[M]=v,i(_)},K=M=>{const v=[...n];v.splice(M,1),i(v)},X=async()=>{const M=await M1({transactions:[Ub({to:s,token:e,values:n.map(v=>({id:v.tokenId,amount:pu(v.amount,0)}))})],network:t.network});if(M.feeQuote&&M.feeOptions){x(M.feeOptions),P(M.feeQuote),console.log("feeOptions",M);return}I(!0),console.log("tx sponsored")},ee=async()=>{var M;try{f(""),d(!0);const v=await Re.sendERC1155({to:s,token:e,values:n.map(_=>({id:_.tokenId,amount:pu(_.amount,0)})),network:(M=t.network)==null?void 0:M.id,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(v)?l(v.data.txHash):f(v.data.error)}catch(v){console.error(v)}finally{d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"5",children:$.jsx(Ir,{type:"text",value:e,onChange:M=>r(M.target.value),placeholder:"Token Contract Address"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(Ct,{label:"Fetch metadata",onClick:()=>L()})}),n.map((M,v)=>$.jsx(G,{marginBottom:"3",children:$.jsx(Yre,{index:v,options:h,onChange:(_,k,A)=>U(_,{tokenId:k,amount:A}),removeTokenEntry:K})},v)),$.jsx(Ct,{label:"Add Token",onClick:j}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:s,onChange:M=>o(M.target.value),placeholder:"Destination Address"})}),c&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",c]})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&s===""&&n.length!==0,onClick:()=>X()}),$.jsx(Ct,{marginTop:"5",label:"Send Tokens",onClick:ee})]}),a&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${a}`,target:"_blank",rel:"noopener noreferrer",children:a})]})]})}function Jre(t){const[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!1),[a,l]=y.useState(),c=async()=>{var f,u;try{l(void 0),o(!0),console.log(t.walletAddress);const h=await(await fetch("https://dev-api.sequence.app/rpc/API/GenerateWaaSVerificationURL",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({walletAddress:t.walletAddress})})).json(),p=await Re.sessionAuthProof({nonce:h.nonce,network:(f=t.network)==null?void 0:f.name}),m=`https://demo-waas-wallet-link.pages.dev/?nonce=${h.nonce}&signature=${p.data.signature}&sessionId=${p.data.sessionId}&chainId=${(u=t.network)==null?void 0:u.name}`;r(m),i(h.nonce),o(!1)}catch(d){console.error(d),o(!1)}};return $.jsxs(G,{children:[a&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",a]}),s?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsx(G,{children:$.jsx(Ct,{marginTop:"5",label:"Generate EOA Link",disabled:n!==void 0,onClick:()=>c()})}),n&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Verification Link:"}),$.jsx("br",{}),$.jsx("a",{href:`${e}`,target:"_blank",rel:"noopener noreferrer",children:e})]})]})}const Fe={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},Xre={[Fe.MAINNET]:"https://assets.sequence.info/images/networks/small/1.webp",[Fe.ROPSTEN]:"https://assets.sequence.info/images/networks/small/3.webp",[Fe.GOERLI]:"https://assets.sequence.info/images/networks/small/5.webp",[Fe.KOVAN]:"https://assets.sequence.info/images/networks/small/42.webp",[Fe.OPTIMISM]:"https://assets.sequence.info/images/networks/small/10.webp",[Fe.OPTIMISM_TESTNET]:"https://assets.sequence.info/images/networks/small/69.webp",[Fe.OPTIMISM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155420.webp",[Fe.POLYGON]:"https://assets.sequence.info/images/networks/small/137.webp",[Fe.POLYGON_MUMBAI]:"https://assets.sequence.info/images/networks/small/80001.webp",[Fe.POLYGON_ZKEVM]:"https://assets.sequence.info/images/networks/small/1101.webp",[Fe.APE_CHAIN_TESTNET]:"https://assets.sequence.info/images/networks/small/33111.webp",[Fe.ARBITRUM]:"https://assets.sequence.info/images/networks/small/42161.webp",[Fe.ARBITRUM_NOVA]:"https://assets.sequence.info/images/networks/small/42170.webp",[Fe.ARBITRUM_GOERLI]:"https://assets.sequence.info/images/networks/small/421613.webp",[Fe.ARBITRUM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/421614.webp",[Fe.GNOSIS]:"https://assets.sequence.info/images/networks/small/100.webp",[Fe.BSC]:"https://assets.sequence.info/images/networks/small/56.webp",[Fe.BSC_TESTNET]:"https://assets.sequence.info/images/networks/small/97.webp",[Fe.FANTOM]:"https://assets.sequence.info/images/networks/small/250.webp",[Fe.FANTOM_TESTNET]:"https://assets.sequence.info/images/networks/small/4002.webp",[Fe.AVALANCHE]:"https://assets.sequence.info/images/networks/small/43114.webp",[Fe.AVALANCHE_TESTNET]:"https://assets.sequence.info/images/networks/small/43113.webp",[Fe.BASE]:"https://assets.sequence.info/images/networks/small/8453.webp",[Fe.BASE_SEPOLIA]:"https://assets.sequence.info/images/networks/small/84532.webp",[Fe.BORNE_TESTNET]:"https://assets.sequence.info/images/networks/small/94984.webp",[Fe.BLAST]:"https://assets.sequence.info/images/networks/small/81457.webp",[Fe.BLAST_SEPOLIA]:"https://assets.sequence.info/images/networks/small/168587773.webp",[Fe.SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155111.webp",[Fe.AMOY]:"https://assets.sequence.info/images/networks/small/80002.webp",[Fe.HOMEVERSE]:"https://assets.sequence.info/images/networks/small/19011.webp",[Fe.HOMEVERSE_TESTNET]:"https://assets.sequence.info/images/networks/small/40875.webp",[Fe.IMMUTABLE_ZKEVM]:"https://assets.sequence.info/images/networks/small/13371.webp",[Fe.IMMUTABLE_ZKEVM_TESTNET]:"https://assets.sequence.info/images/networks/small/13473.webp",[Fe.XAI]:"https://assets.sequence.info/images/networks/small/660279.webp",[Fe.XAI_SEPOLIA]:"https://assets.sequence.info/images/networks/small/37714555429.webp",[Fe.ASTAR_ZKEVM]:"https://assets.sequence.info/images/networks/small/3776.webp",[Fe.ASTAR_ZKYOTO]:"https://assets.sequence.info/images/networks/small/6038361.webp",[Fe.B3_SEPOLIA]:"https://assets.sequence.info/images/networks/small/1993.webp",[Fe.XR_SEPOLIA]:"https://assets.sequence.info/images/networks/small/2730.webp"};function Zre({onNetworkChange:t}){const[e,r]=y.useState(),[n,i]=y.useState([]);return y.useEffect(()=>{Re.networkList().then(s=>{i(s),r(s[0]),t(s[0])})},[]),n.length===0?$.jsx(G,{marginY:"5",children:$.jsx(_n,{})}):$.jsxs(G,{marginBottom:"4",children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Network to use with requests:"})}),$.jsx(G,{children:$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:s=>{const o=n==null?void 0:n.find(a=>a.name===s);o&&(r(o),t(o))},value:e==null?void 0:e.name,options:[...n.map(s=>({label:$.jsxs(G,{alignItems:"center",gap:"2",children:[$.jsx(nz,{src:Xre[s.id],size:"sm"}),$.jsx(me,{children:s.name})]}),value:String(s.name)}))]})})]})}function GT(t){var e;if(t.type===br.Email)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===br.Guest)return $.jsx(me,{variant:"normal",color:"text100",children:"Guest account"});if(t.type===br.PlayFab)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===br.OIDC&&(e=t.issuer)!=null&&e.includes("cognito-idp"))return $.jsxs(me,{variant:"normal",color:"text100",children:["Email v1 (",t.email,")"]});switch(t.issuer){case"https://accounts.google.com":return $.jsxs(G,{gap:"2",marginTop:"2",children:[$.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="}),$.jsxs(me,{variant:"normal",color:"text100",children:["Google (",t.email,")"]})]});case"https://appleid.apple.com":return $.jsxs(G,{gap:"2",children:[$.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="}),$.jsxs(me,{variant:"normal",color:"text100",children:["Apple (",t.email,")"]})]});default:return"Unknown"}}function ene(){var ee;const t=P8(),[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!0),[a,l]=y.useState(),[c,f]=y.useState(""),u=y.useRef(null),d=(ee=u.current)==null?void 0:ee.validity.valid,[h,p]=y.useState(!1),[m,x]=y.useState([]),[b,w]=y.useState(!0),{inProgress:E,loading:P,initiateAuth:N,sendChallengeAnswer:I}=WT({sessionName:wo(),onSuccess:async({wallet:M})=>{console.log(`Wallet address: ${M}`)},linkAccount:!0}),j=async M=>{o(!0),i(void 0);try{await Re.removeAccount(M);const v=await Re.listAccounts();i(v.accounts)}catch(v){l(v.message);const _=await Re.listAccounts();i(_.accounts)}o(!1)},L=async M=>{const v=await Re.initAuth({idToken:M.credential});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},U="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":"/"),K=async M=>{const v=await Re.initAuth({idToken:M.authorization.id_token});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},X=K8({flow:"implicit",onSuccess:M=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:M.access_token,CreateAccount:!0,TitleId:"8F854"},async(v,_)=>{if(v)try{const k=await Re.initAuth({playFabTitleId:"8F854",playFabSessionTicket:v.data.SessionTicket}),A=await Re.linkAccount(k);console.log("playfab account",JSON.stringify(A.account,null,2)),i(T=>[...T||[],A.account])}catch(k){console.error(k),yh(k)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}else _&&console.log("Error: "+JSON.stringify(_))})}});return y.useEffect(()=>{Re.listAccounts().then(M=>{i(M.accounts),M.currentAccountId&&r(M.accounts.find(v=>v.id===M.currentAccountId)),o(!1)}).catch(M=>{l(M.message),o(!1)})},[E]),$.jsxs(G,{children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginBottom:"5",gap:"4",flexDirection:"column",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your connected (linked) accounts"}),n&&$.jsx($.Fragment,{children:n.map(M=>$.jsxs(G,{flexDirection:"row",alignItems:"center",gap:"2",children:[$.jsx(me,{variant:"normal",color:"text100",children:GT(M)}),M.id!==(e==null?void 0:e.id)&&$.jsx(Ct,{size:"xs",label:"Remove",onClick:()=>j(M.id)}),M.id===(e==null?void 0:e.id)&&$.jsx(G,{children:$.jsx(me,{variant:"small",color:"text100",children:"(Account you logged in with)"})})]},M.id))}),s&&$.jsx(_n,{})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{flexDirection:"column",gap:"2",width:"fit",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",marginBottom:"5",children:"Connect (link) another login method"}),$.jsx(G8,{onSuccess:L,shape:"circle",width:230}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:U,usePopup:!0},onError:M=>console.error(M),onSuccess:K,uiType:"dark"}),$.jsxs($.Fragment,{children:[$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(G,{marginTop:"2",children:$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:X})})})]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{marginTop:"2",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Email"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",disabled:!0,checked:b,onChange:()=>w(!b)})})]}),I?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"3",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(zF,{value:m,digits:6,onChange:x})}),$.jsx(G,{gap:"2",marginY:"4",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:m.includes(""),label:"Verify",onClick:()=>I(m.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:M=>{f(M.target.value)},ref:u,onKeyDown:M=>{c&&M.key==="Enter"&&N(c)},onBlur:()=>p(!!c&&!d),value:c,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),h&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!d,label:"Continue",onClick:()=>N(c),"data-id":"continueButton"})})]})]}),a&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading accounts: ",a]})]})}function tne(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState([]),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[f,u]=y.useState(),[d,h]=y.useState();return y.useEffect(()=>{Re.getAddress().then(p=>{e(p)}).catch(p=>{n(p.message)}),Re.listAccounts().then(p=>{p.currentAccountId&&h(p.accounts.find(m=>m.id===p.currentAccountId))})},[]),y.useEffect(()=>{Re.isSignedIn().then(p=>{p||Ri.navigate("/login")})},[]),y.useEffect(()=>{const p=i.join("");p.length===6&&(c(!0),Re.finishValidateSession(p))},[i]),y.useEffect(()=>{const p=Re.onValidationRequired(()=>{a(!0),Re.waitForSessionValid(6e5,4e3).then(m=>{console.log("isValid",m),s([]),a(!1),c(!1)})});return()=>{p.then(m=>m())}},[]),$.jsxs($.Fragment,{children:[$.jsx(Hg,{children:o&&$.jsx(i8,{children:$.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"1.2em",height:"50vh"},children:$.jsxs(G,{flexDirection:"column",alignItems:"center",children:[$.jsx(me,{marginBottom:"7",children:"Please enter the session verification code that was sent to your email"}),$.jsx(J8,{value:i,digits:6,onChange:s}),$.jsx(G,{marginTop:"5",children:l&&$.jsx(_n,{})})]})})})}),$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsx(G,{marginBottom:"10",children:$.jsx(X8,{})}),$.jsxs(G,{marginBottom:"5",flexDirection:"row",children:[d&&$.jsxs(G,{flexDirection:"column",gap:"2",children:[$.jsxs(me,{marginTop:"1",variant:"normal",color:"text100",children:[d.type===br.Guest?"Guest account":`Logged in with account type ${d.type}`," "]}),d.type!==br.Guest&>(d)]}),$.jsx(Ct,{marginLeft:"auto",label:"Log out",size:"xs",onClick:async()=>{try{await Re.dropSession({strict:!1})}catch(p){console.warn(`Could not drop session: ${p.message}`)}$V(),Ri.navigate("/login")}})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your wallet address:"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"normal",children:t?$.jsx(G,{children:$.jsx(me,{children:t})}):$.jsx(_n,{})})}),$.jsx(G,{children:r&&$.jsxs(me,{children:["Error fetching wallet address: ",r]})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(qre,{}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(Zre,{onNetworkChange:u})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(il,{marginY:"3",label:"Send native token transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Vre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC20 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Gre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC1155 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Qre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Sign a message",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Hre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Call contracts",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Wre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"EOA Link",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Jre,{network:f,walletAddress:t})]}),$.jsx(ene,{})]})]})}function rne(t,e,r){return e=JT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bm(t,e){return sne(t)||ine(t,e)||KT(t,e)||nne()}function nne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +`;function A0(t,e){if(!t)throw new Error(e)}const Nre={user:null,fromCache:!1},$re={session:null,fromCache:!1},yw=y.createContext({isMounted:!1}),Dre=y.createContext(Nre),HT=y.createContext($re),WT=()=>y.useContext(yw).isMounted,Lre=()=>(A0(WT(),qT("useStytchSession")),y.useContext(HT)),jre=()=>{const t=y.useContext(yw);return A0(t.isMounted,qT("useStytch")),t.client},Fre=({stytch:t,children:e})=>{A0(!WT(),Ore),A0(typeof window<"u",Mre);const r=y.useMemo(()=>({client:t,isMounted:!0}),[t]),[{user:n,session:i},s]=Ire({session:t.session.getInfo(),user:t.user.getInfo()});return y.useEffect(()=>t.onStateChange(()=>{s(o=>{const a={session:t.session.getInfo(),user:t.user.getInfo()};return Rre(o,a)})}),[s,t]),pr.createElement(yw.Provider,{value:r},pr.createElement(Dre.Provider,{value:n},pr.createElement(HT.Provider,{value:i},e)))};function Bre(){const t=jre(),{session:e}=Lre(),[r,n]=y.useState(0),[i,s]=y.useState(""),o=y.useRef(null);y.useEffect(()=>{if(localStorage.getItem("stytch_auth")!=="legacy")return;const l=new URLSearchParams(window.location.search);l.get("stytch_token_type")==="magic_links"&&r===0&&(n(2),(async()=>await t.magicLinks.authenticate(l.get("token")||"",{session_duration_minutes:5}))())},[t,e,r]),y.useEffect(()=>{localStorage.getItem("stytch_auth")==="legacy"&&e&&r==2&&(n(3),(async()=>{console.log("LEGACY STYTCH FLOW");const l=t.session.getTokens(),u=await(await fetch(`https://oidc-wrapper.sequence.info/authenticate?jwt=${l.session_jwt}`,{method:"POST"})).json(),d=await Re.signIn({idToken:u.idToken},wo());console.log(`Wallet address: ${d}`),await t.session.revoke(),n(0),window.location.search="",Ri.navigate("/")})())},[e,t,r]);const a=async l=>{localStorage.setItem("stytch_auth","legacy"),n(1),await t.magicLinks.email.loginOrCreate(l,{})};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Stytch login (LEGACY)"})}),$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsx(G,{marginTop:"6",children:$.jsx(Ir,{name:"stytchEmail",type:"email",onChange:l=>{s(l.target.value)},ref:o,onKeyDown:l=>{i&&l.key==="Enter"&&a(i)},value:i,placeholder:"hello@example.com",disabled:r!==0,required:!0})}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(Ct,{variant:"primary",label:"Continue",onClick:()=>a(i),"data-id":"continueButton",disabled:r!==0})}),r===1&&$.jsx(G,{children:$.jsx(me,{variant:"normal",color:"text80",children:"Magic link sent to your email. Please click the link. You can close this page."})})]})]})}function Ure(){var S;const[t,e]=y.useState(""),r=y.useRef(null),n=(S=r.current)==null?void 0:S.validity.valid,[i,s]=y.useState(!1),[o,a]=y.useState([]),[l,c]=y.useState(!0),[f,u]=y.useState(),[d,h]=y.useState(!1),p=y.useRef(null);Re.onEmailConflict(async(g,R)=>{p.current=R,u(g),h(!0)});const m=K8({flow:"implicit",onSuccess:g=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:g.access_token,CreateAccount:!0,TitleId:"8F854"},async(R,F)=>{if(R)try{const C=await Re.signIn({playFabTitleId:"8F854",playFabSessionTicket:R.data.SessionTicket},wo());console.log("Sequence response:",C),Ri.navigate("/")}catch{console.error("Error: "+JSON.stringify(F))}else F&&console.error("Error: "+JSON.stringify(F))})}}),{inProgress:x,loading:b,initiateAuth:w,sendChallengeAnswer:E,cancel:P}=VT({sessionName:wo(),onSuccess:async({wallet:g})=>{console.log(`Wallet address: ${g}`),Ri.navigate("/")}}),{inProgress:N,loading:I,initiateAuth:j,sendChallengeAnswer:L}=_re({onSuccess:async g=>{const R=await Re.signIn({idToken:g},wo());console.log(`Wallet address: ${R}`),Ri.navigate("/")}}),U=l?x:N,K=l?b:I,X=l?w:j,ee=l?E:L;y.useEffect(()=>{(async()=>await Re.isSignedIn()&&Ri.navigate("/"))()},[]);const M=async g=>{const R=await Re.signIn({idToken:g.credential},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},v="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":""),_=async g=>{const R=await Re.signIn({idToken:g.authorization.id_token},wo());console.log(`Wallet address: ${R.wallet}`),console.log(`Email address: ${R.email}`),Ri.navigate("/")},k=async()=>{const g=await Re.signIn({guest:!0},wo());console.log(`Wallet address: ${g.wallet}`),Ri.navigate("/")},A=new URLSearchParams(window.location.search),T=A.get("env")==="dev",[O,D]=y.useState(T);return $.jsxs($.Fragment,{children:[$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsxs(G,{marginBottom:"16",flexDirection:"row",children:[$.jsx(X8,{}),$.jsx(G,{marginLeft:"auto",children:$.jsx(pU,{label:"Use dev env",checked:O,onCheckedChange:()=>{O?(A.delete("env"),window.location.search=A.toString()):(A.set("env","dev"),window.location.search=A.toString()),D(!O)}})})]}),$.jsx(G,{gap:"4",children:$.jsx(Ct,{label:"Guest login",onClick:k})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginTop:"6",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Email Login"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",checked:l,onCheckedChange:()=>{c(!l)}})})]}),ee?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"6",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(J8,{value:o,digits:6,onChange:a})}),$.jsx(G,{gap:"2",marginY:"4",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:o.includes(""),label:"Verify",onClick:()=>ee(o.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginTop:"5",marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:g=>{e(g.target.value)},ref:r,onKeyDown:g=>{t&&g.key==="Enter"&&X(t)},onBlur:()=>s(!!t&&!n),value:t,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),i&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:K?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!n,label:"Continue",onClick:()=>X(t),"data-id":"continueButton"})})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{paddingY:"4",gap:"4",flexDirection:"column",width:"full",children:!U&&$.jsxs($.Fragment,{children:[$.jsx(G,{marginBottom:"2",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Social Login"})}),$.jsxs(G,{gap:"4",flexDirection:"column",width:"fit",children:[$.jsx(G,{children:$.jsx(G8,{onSuccess:M,shape:"circle",width:230},"google")}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:v,usePopup:!0},onError:g=>console.error(g),onSuccess:_,uiType:"dark"},"apple")]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",children:"Playfab login"})}),$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:m})})]}),!1,$.jsx(Bre,{})]})})]}),d&&f&&$.jsx(i8,{size:"small",onClose:()=>h(!1),children:$.jsx(Are,{info:f,onCancel:()=>{h(!1),u(void 0),U&&(a([]),P(),e(""))},onConfirm:async()=>{var g;h(!1),u(void 0),await((g=p.current)==null?void 0:g.call(p))}})})]})}async function M1({transactions:t,network:e}){const r=await Re.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 N1(t){var s;const{feeOptions:e,onSelected:r}=t,[n,i]=y.useState();return y.useEffect(()=>{e&&e.length>0&&(i(e[0]),r(e[0]))},[e]),y.useEffect(()=>{n&&r(n)},[n]),e?$.jsxs(G,{marginTop:"5",children:[$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options:"}),$.jsx(G,{marginTop:"3"}),$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:o=>{const a=e.find(l=>l.token.name===o);a&&i(a)},value:(s=n==null?void 0:n.token)==null?void 0:s.name,options:[...e.map(o=>{var a,l,c;return{label:$.jsx(G,{alignItems:"center",gap:"2",children:$.jsxs(me,{children:[(a=o==null?void 0:o.token)==null?void 0:a.name," ",Dx(o==null?void 0:o.value,(l=o==null?void 0:o.token)==null?void 0:l.decimals)]})}),value:String((c=o==null?void 0:o.token)==null?void 0:c.name)}})]})]}):$.jsx(G,{})}const zre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Vre(t){const[e,r]=y.useState(),[n,i]=y.useState("ETH"),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(),[h,p]=y.useState(!1),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(),[j,L]=y.useState(!1);y.useEffect(()=>{U()},[]),y.useEffect(()=>{var ee,M;if(t.network){const v=Kk(t.network.name);if(v){const _=v.name in{polygon:1,mumbai:1}?"MATIC":"ETH";i(_),U(),(ee=v.blockExplorer)!=null&&ee.rootUrl&&o((M=v.blockExplorer)==null?void 0:M.rootUrl)}}},[t.network]);const U=async()=>{if(!t.network)return;const ee=Kk(t.network.name);if(!ee)return;const M=await Re.getAddress(),_=await new zT(P_(ee.name),zre).getEtherBalance({accountAddress:M});r(ce.from(_.balance.balanceWei))},K=async(ee,M)=>{const v=await M1({transactions:[{to:ee,value:Gk(M)}],network:t.network});if(v.feeQuote&&v.feeOptions){w(v.feeOptions),I(v.feeQuote),console.log("feeOptions",v);return}L(!0),console.log("tx sponsored")},X=async(ee,M)=>{var v;try{x(void 0),p(!0);const _=await Re.sendTransaction({transactions:[{to:ee,value:Gk(M)}],network:(v=t.network)==null?void 0:v.id,transactionsFeeOption:E,transactionsFeeQuote:N});Wu(_)?d(_.data.txHash):x(_.data.error),p(!1)}catch(_){console.error(_),p(!1)}finally{I(void 0),w(void 0),P(void 0),L(!1)}};return $.jsxs(G,{children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Native token balance: ",eY(e||0)," ",n]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:U}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenTo",type:"text",onChange:ee=>{l(ee.target.value)},value:a,placeholder:"To address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"sendNativeTokenAmount",type:"text",onChange:ee=>{f(ee.target.value)},value:c,placeholder:"Amount",required:!0,"data-id":"nativeTokenSendAmount"})}),m&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",m]}),$.jsx(N1,{feeOptions:b,onSelected:P}),j&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:a===""&&c==="",onClick:()=>K(a,c)}),$.jsx(Ct,{marginTop:"5",label:"Send native token",disabled:a===""&&c==="",onClick:()=>X(a,c)})]}),u&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`${s}tx/${u}`,target:"_blank",rel:"noopener noreferrer",children:u})]})]})}function qre(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState(!0),[o,a]=y.useState(),l=async c=>{s(!0),e(void 0);try{await Re.dropSession({sessionId:c}),e(await Re.listSessions())}catch(f){a(f.message),e(await Re.listSessions())}s(!1)};return y.useEffect(()=>{Promise.all([Re.listSessions(),Re.getSessionId()]).then(([c,f])=>{e(c),n(f),s(!1)}).catch(c=>{a(c.message),s(!1)})},[]),$.jsxs(G,{children:[$.jsxs(G,{marginBottom:"5",children:[$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your open sessions:"})}),t&&$.jsx($.Fragment,{children:t.map(c=>$.jsx(G,{children:$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"normal",children:[c.friendlyName,!c.isThis&&$.jsx("a",{style:{marginLeft:"7px",textDecoration:"underline",cursor:"pointer"},onClick:()=>l(c.id),children:"x"}),c.isThis&&$.jsx($.Fragment,{children:" (current)"})]})},c.id))}),i&&$.jsx(_n,{})]}),o&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading sessions: ",o]})]})}function Hre(t){const[e,r]=y.useState(""),[n,i]=y.useState(),s=async()=>{var a;const o=await Re.signMessage({message:e,network:(a=t.network)==null?void 0:a.id});i(o.data.signature)};return $.jsxs(G,{children:[$.jsx(Ir,{name:"signMessageText",type:"text",onChange:o=>{r(o.target.value),n!=""&&i("")},value:e,placeholder:"Enter a message to sign",required:!0,"data-id":"signMessageInput"}),$.jsx(Ct,{marginTop:"5",label:"Sign message",disabled:e==="",onClick:()=>s()}),n&&n!==""&&$.jsxs(G,{flexDirection:"column",marginTop:"5",children:[$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Signature for ",e,":"]}),$.jsx(G,{children:$.jsx(me,{as:"p",wordBreak:"break-word",children:n})})]})]})}function Wre(t){const[e,r]=y.useState(""),[n,i]=y.useState(""),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(),[u,d]=y.useState(!1),[h,p]=y.useState(),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=async()=>{const U=await M1({transactions:[pT({to:e,abi:n,func:s,args:JSON.parse(a),value:"0"})],network:t.network});if(U.feeQuote&&U.feeOptions){x(U.feeOptions),P(U.feeQuote),console.log("feeOptions",U);return}I(!0),console.log("tx sponsored")},L=async()=>{var U;try{p(void 0),d(!0);const K=await Re.callContract({network:(U=t.network)==null?void 0:U.id,to:e,abi:n,func:s,args:JSON.parse(a),value:0,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(K)?f(K.data.txHash):p(K.data.error),d(!1)}catch(K){console.error(K),d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAddress",type:"text",onChange:U=>{r(U.target.value)},value:e,placeholder:"Contract address 0x...",required:!0,"data-id":"nativeTokenSendAddress"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractAbi",type:"text",onChange:U=>{i(U.target.value)},value:n,placeholder:"Contract ABI or function ABI, e.g. [{...}] or [{...}, {...}] or transfer(address,uint256)",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractMethod",type:"text",onChange:U=>{o(U.target.value)},value:s,placeholder:"Method name, e.g. transfer",required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{name:"callContractArgs",type:"text",onChange:U=>{l(U.target.value)},value:a,placeholder:'Method args, e.g. [0x..., 1000] or named { "to": "0x...", "amount": "1000" }',required:!0,"data-id":"nativeTokenSendAmount"})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),h&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",h]}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>j()}),$.jsx(Ct,{marginTop:"5",label:"Call contract",disabled:e===""&&n===""&&s===""&&a==="",onClick:()=>L()})]}),c&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Send native token transaction hash:"}),$.jsx("br",{}),$.jsx("a",{href:`https://polygonscan.com/tx/${c}`,target:"_blank",rel:"noopener noreferrer",children:c})]})]})}const WA=[{label:"Custom Token",value:"Custom"},{label:"USDC Old",value:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"},{label:"USDC New",value:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"},{label:"DAI",value:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"}];function Gre(t){const[e,r]=y.useState(WA[0].value),[n,i]=y.useState(""),[s,o]=y.useState(!0),[a,l]=y.useState("---"),[c,f]=y.useState(""),[u,d]=y.useState(""),[h,p]=y.useState(""),[m,x]=y.useState(""),[b,w]=y.useState(!1),[E,P]=y.useState(0),[N,I]=y.useState(),[j,L]=y.useState(),[U,K]=y.useState(),[X,ee]=y.useState(!1);y.useEffect(()=>{M(n)},[n]);const M=async A=>{var D;if(!Iq(A)){l("---");return}l("...");const T=new __(`https://nodes.sequence.app/${(D=t.network)==null?void 0:D.name}`),O=new HG(A,["function balanceOf(address) view returns (uint256)","function decimals() view returns (uint8)","function symbol() view returns (string)"],T);try{const[S,g,R]=await Promise.all([O.balanceOf(Re.getAddress()),O.decimals(),O.symbol()]);P(g),l(`${Dx(S,g)} ${R}`)}catch{l("---")}},v=async()=>{const A=await M1({transactions:[Bb({token:n,to:c,value:pu(u,E).toString()})],network:t.network});if(A.feeQuote&&A.feeOptions){I(A.feeOptions),K(A.feeQuote),console.log("feeOptions",A);return}ee(!0),console.log("tx sponsored")},_=async()=>{var A;try{x(""),w(!0);const T=await Re.sendERC20({token:n,to:c,value:pu(u,E),network:(A=t.network)==null?void 0:A.id,transactionsFeeOption:j,transactionsFeeQuote:U});Wu(T)?p(T.data.txHash):x(T.data.error)}catch(T){console.error(T)}finally{w(!1)}},k=A=>{r(A),A==="Custom"?(i(""),o(!0)):(i(A),o(!1))};return $.jsxs(G,{children:[$.jsxs(G,{marginTop:"5",children:[$.jsx(u1,{name:"token",options:WA,value:e??"",onValueChange:A=>k(A)}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:n,disabled:!s,onChange:A=>i(A.target.value),placeholder:"Custom ERC20 Contract Address"})})]}),$.jsxs(G,{marginTop:"3",children:[$.jsxs(me,{variant:"normal",color:"text100",children:["Token Balance: ",a]}),$.jsx(Ct,{marginLeft:"2",size:"xs",label:"Fetch",onClick:()=>M(n)})]}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:c,onChange:A=>f(A.target.value),placeholder:"Destination Address"})}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:u,onChange:A=>d(A.target.value),placeholder:"Amount"})}),m&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",m]})}),$.jsx(N1,{feeOptions:N,onSelected:L}),X&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),b?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:n===""&&c==="",onClick:()=>v()}),$.jsx(Ct,{marginTop:"5",label:"Send Token",onClick:_})]}),h&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${h}`,target:"_blank",rel:"noopener noreferrer",children:h})]})]})}const Kre="3XwfKaFvrgRIZ6om79SxYoTAAAAAAAAAA";function Yre(t){var a;const[e,r]=y.useState(""),[n,i]=y.useState("");y.useEffect(()=>{t.onChange(t.index,e,n)},[e,n]);const s={display:"flex",gap:"10px",marginBottom:"10px"},o={flex:1};return $.jsxs(G,{style:s,children:[$.jsx(G,{style:o,children:$.jsx(u1,{name:`sendERC1155TokenId${t.index}`,value:e,disabled:!t.options,onValueChange:l=>{r(l)},options:((a=t.options)==null?void 0:a.balances.map(l=>{var c;return{label:`${((c=l.tokenMetadata)==null?void 0:c.name)||"Unknown"} - ${l.balance}`,value:l.tokenID}}))||[],placeholder:"Select a token"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:e,onChange:l=>r(l.target.value),placeholder:"Token ID"})}),$.jsx(G,{style:o,children:$.jsx(Ir,{type:"text",value:n,onChange:l=>i(l.target.value),placeholder:"Amount"})}),$.jsx(G,{style:o,children:$.jsx(Ct,{label:"Remove",onClick:()=>t.removeTokenEntry(t.index)})})]})}function Qre(t){const[e,r]=y.useState(""),[n,i]=y.useState([]),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,f]=y.useState(""),[u,d]=y.useState(!1),[h,p]=y.useState(void 0),[m,x]=y.useState(),[b,w]=y.useState(),[E,P]=y.useState(),[N,I]=y.useState(!1),j=()=>{i([...n,{tokenId:"",amount:""}])},L=async()=>{if(!e||!t.network)return;const M=t.network.name,v=new zT("https://"+M+"-indexer.sequence.app",Kre),_=e,k=await Re.getAddress(),A=!0;p(await v.getTokenBalances({contractAddress:_,accountAddress:k,includeMetadata:A}))};y.useEffect(()=>{L()},[e]);const U=(M,v)=>{const _=[...n];_[M]=v,i(_)},K=M=>{const v=[...n];v.splice(M,1),i(v)},X=async()=>{const M=await M1({transactions:[Ub({to:s,token:e,values:n.map(v=>({id:v.tokenId,amount:pu(v.amount,0)}))})],network:t.network});if(M.feeQuote&&M.feeOptions){x(M.feeOptions),P(M.feeQuote),console.log("feeOptions",M);return}I(!0),console.log("tx sponsored")},ee=async()=>{var M;try{f(""),d(!0);const v=await Re.sendERC1155({to:s,token:e,values:n.map(_=>({id:_.tokenId,amount:pu(_.amount,0)})),network:(M=t.network)==null?void 0:M.id,transactionsFeeOption:b,transactionsFeeQuote:E});Wu(v)?l(v.data.txHash):f(v.data.error)}catch(v){console.error(v)}finally{d(!1)}};return $.jsxs(G,{children:[$.jsx(G,{marginBottom:"5",children:$.jsx(Ir,{type:"text",value:e,onChange:M=>r(M.target.value),placeholder:"Token Contract Address"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(Ct,{label:"Fetch metadata",onClick:()=>L()})}),n.map((M,v)=>$.jsx(G,{marginBottom:"3",children:$.jsx(Yre,{index:v,options:h,onChange:(_,k,A)=>U(_,{tokenId:k,amount:A}),removeTokenEntry:K})},v)),$.jsx(Ct,{label:"Add Token",onClick:j}),$.jsx(G,{marginTop:"5",children:$.jsx(Ir,{type:"text",value:s,onChange:M=>o(M.target.value),placeholder:"Destination Address"})}),c&&$.jsx(G,{marginTop:"3",children:$.jsxs(me,{color:"error",children:["Error: ",c]})}),$.jsx(N1,{feeOptions:m,onSelected:w}),N&&$.jsx(G,{marginTop:"5",children:$.jsx(me,{variant:"normal",fontWeight:"bold",children:"Fee options: Tx Sponsored!"})}),u?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsxs(G,{children:[$.jsx(Ct,{marginTop:"5",marginRight:"2",label:"Check fee options",disabled:e===""&&s===""&&n.length!==0,onClick:()=>X()}),$.jsx(Ct,{marginTop:"5",label:"Send Tokens",onClick:ee})]}),a&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Transaction Hash:"}),$.jsx("a",{href:`https://polygonscan.com/tx/${a}`,target:"_blank",rel:"noopener noreferrer",children:a})]})]})}function Jre(t){const[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!1),[a,l]=y.useState(),c=async()=>{var f,u;try{l(void 0),o(!0),console.log(t.walletAddress);const h=await(await fetch("https://dev-api.sequence.app/rpc/API/GenerateWaaSVerificationURL",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({walletAddress:t.walletAddress})})).json(),p=await Re.sessionAuthProof({nonce:h.nonce,network:(f=t.network)==null?void 0:f.name}),m=`https://demo-waas-wallet-link.pages.dev/?nonce=${h.nonce}&signature=${p.data.signature}&sessionId=${p.data.sessionId}&chainId=${(u=t.network)==null?void 0:u.name}`;r(m),i(h.nonce),o(!1)}catch(d){console.error(d),o(!1)}};return $.jsxs(G,{children:[a&&$.jsxs(G,{marginTop:"3",children:["Transaction failed: ",a]}),s?$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:$.jsx(_n,{})}):$.jsx(G,{children:$.jsx(Ct,{marginTop:"5",label:"Generate EOA Link",disabled:n!==void 0,onClick:()=>c()})}),n&&$.jsxs(G,{marginTop:"3",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Verification Link:"}),$.jsx("br",{}),$.jsx("a",{href:`${e}`,target:"_blank",rel:"noopener noreferrer",children:e})]})]})}const Fe={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},Xre={[Fe.MAINNET]:"https://assets.sequence.info/images/networks/small/1.webp",[Fe.ROPSTEN]:"https://assets.sequence.info/images/networks/small/3.webp",[Fe.GOERLI]:"https://assets.sequence.info/images/networks/small/5.webp",[Fe.KOVAN]:"https://assets.sequence.info/images/networks/small/42.webp",[Fe.OPTIMISM]:"https://assets.sequence.info/images/networks/small/10.webp",[Fe.OPTIMISM_TESTNET]:"https://assets.sequence.info/images/networks/small/69.webp",[Fe.OPTIMISM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155420.webp",[Fe.POLYGON]:"https://assets.sequence.info/images/networks/small/137.webp",[Fe.POLYGON_MUMBAI]:"https://assets.sequence.info/images/networks/small/80001.webp",[Fe.POLYGON_ZKEVM]:"https://assets.sequence.info/images/networks/small/1101.webp",[Fe.APE_CHAIN_TESTNET]:"https://assets.sequence.info/images/networks/small/33111.webp",[Fe.ARBITRUM]:"https://assets.sequence.info/images/networks/small/42161.webp",[Fe.ARBITRUM_NOVA]:"https://assets.sequence.info/images/networks/small/42170.webp",[Fe.ARBITRUM_GOERLI]:"https://assets.sequence.info/images/networks/small/421613.webp",[Fe.ARBITRUM_SEPOLIA]:"https://assets.sequence.info/images/networks/small/421614.webp",[Fe.GNOSIS]:"https://assets.sequence.info/images/networks/small/100.webp",[Fe.BSC]:"https://assets.sequence.info/images/networks/small/56.webp",[Fe.BSC_TESTNET]:"https://assets.sequence.info/images/networks/small/97.webp",[Fe.FANTOM]:"https://assets.sequence.info/images/networks/small/250.webp",[Fe.FANTOM_TESTNET]:"https://assets.sequence.info/images/networks/small/4002.webp",[Fe.AVALANCHE]:"https://assets.sequence.info/images/networks/small/43114.webp",[Fe.AVALANCHE_TESTNET]:"https://assets.sequence.info/images/networks/small/43113.webp",[Fe.BASE]:"https://assets.sequence.info/images/networks/small/8453.webp",[Fe.BASE_SEPOLIA]:"https://assets.sequence.info/images/networks/small/84532.webp",[Fe.BORNE_TESTNET]:"https://assets.sequence.info/images/networks/small/94984.webp",[Fe.BLAST]:"https://assets.sequence.info/images/networks/small/81457.webp",[Fe.BLAST_SEPOLIA]:"https://assets.sequence.info/images/networks/small/168587773.webp",[Fe.SEPOLIA]:"https://assets.sequence.info/images/networks/small/11155111.webp",[Fe.AMOY]:"https://assets.sequence.info/images/networks/small/80002.webp",[Fe.HOMEVERSE]:"https://assets.sequence.info/images/networks/small/19011.webp",[Fe.HOMEVERSE_TESTNET]:"https://assets.sequence.info/images/networks/small/40875.webp",[Fe.IMMUTABLE_ZKEVM]:"https://assets.sequence.info/images/networks/small/13371.webp",[Fe.IMMUTABLE_ZKEVM_TESTNET]:"https://assets.sequence.info/images/networks/small/13473.webp",[Fe.XAI]:"https://assets.sequence.info/images/networks/small/660279.webp",[Fe.XAI_SEPOLIA]:"https://assets.sequence.info/images/networks/small/37714555429.webp",[Fe.ASTAR_ZKEVM]:"https://assets.sequence.info/images/networks/small/3776.webp",[Fe.ASTAR_ZKYOTO]:"https://assets.sequence.info/images/networks/small/6038361.webp",[Fe.B3_SEPOLIA]:"https://assets.sequence.info/images/networks/small/1993.webp",[Fe.XR_SEPOLIA]:"https://assets.sequence.info/images/networks/small/2730.webp"};function Zre({onNetworkChange:t}){const[e,r]=y.useState(),[n,i]=y.useState([]);return y.useEffect(()=>{Re.networkList().then(s=>{i(s),r(s[0]),t(s[0])})},[]),n.length===0?$.jsx(G,{marginY:"5",children:$.jsx(_n,{})}):$.jsxs(G,{marginBottom:"4",children:[$.jsx(G,{marginBottom:"4",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Network to use with requests:"})}),$.jsx(G,{children:$.jsx(u1,{name:"chainId",labelLocation:"top",onValueChange:s=>{const o=n==null?void 0:n.find(a=>a.name===s);o&&(r(o),t(o))},value:e==null?void 0:e.name,options:[...n.map(s=>({label:$.jsxs(G,{alignItems:"center",gap:"2",children:[$.jsx(nz,{src:Xre[s.id],size:"sm"}),$.jsx(me,{children:s.name})]}),value:String(s.name)}))]})})]})}function GT(t){var e;if(t.type===cr.Email)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===cr.Guest)return $.jsx(me,{variant:"normal",color:"text100",children:"Guest account"});if(t.type===cr.PlayFab)return $.jsxs(me,{variant:"normal",color:"text100",children:["(",t.email,")"]});if(t.type===cr.OIDC&&(e=t.issuer)!=null&&e.includes("cognito-idp"))return $.jsxs(me,{variant:"normal",color:"text100",children:["Email v1 (",t.email,")"]});if(t.type===cr.Stytch)return $.jsxs($.Fragment,{children:["Stytch account (",t.email,")"]});if({}.STYTCH_LEGACY_ISSUER&&t.issuer==={}.STYTCH_LEGACY_ISSUER)return $.jsxs($.Fragment,{children:["WRAPPED Stytch account (",t.email]});switch(t.issuer){case"https://accounts.google.com":return $.jsxs(G,{gap:"2",marginTop:"2",children:[$.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="}),$.jsxs(me,{variant:"normal",color:"text100",children:["Google (",t.email,")"]})]});case"https://appleid.apple.com":return $.jsxs(G,{gap:"2",children:[$.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="}),$.jsxs(me,{variant:"normal",color:"text100",children:["Apple (",t.email,")"]})]});default:return"Unknown"}}function ene(){var ee;const t=P8(),[e,r]=y.useState(),[n,i]=y.useState(),[s,o]=y.useState(!0),[a,l]=y.useState(),[c,f]=y.useState(""),u=y.useRef(null),d=(ee=u.current)==null?void 0:ee.validity.valid,[h,p]=y.useState(!1),[m,x]=y.useState([]),[b,w]=y.useState(!0),{inProgress:E,loading:P,initiateAuth:N,sendChallengeAnswer:I}=VT({sessionName:wo(),onSuccess:async({wallet:M})=>{console.log(`Wallet address: ${M}`)},linkAccount:!0}),j=async M=>{o(!0),i(void 0);try{await Re.removeAccount(M);const v=await Re.listAccounts();i(v.accounts)}catch(v){l(v.message);const _=await Re.listAccounts();i(_.accounts)}o(!1)},L=async M=>{const v=await Re.initAuth({idToken:M.credential});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},U="https://"+window.location.host+(window.location.host.includes("github.io")?"/demo-waas-auth":"/"),K=async M=>{const v=await Re.initAuth({idToken:M.authorization.id_token});try{const _=await Re.linkAccount(v);i(k=>[...k||[],_.account])}catch(_){yh(_)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}},X=K8({flow:"implicit",onSuccess:M=>{window.PlayFabClientSDK.LoginWithGoogleAccount({AccessToken:M.access_token,CreateAccount:!0,TitleId:"8F854"},async(v,_)=>{if(v)try{const k=await Re.initAuth({playFabTitleId:"8F854",playFabSessionTicket:v.data.SessionTicket}),A=await Re.linkAccount(k);console.log("playfab account",JSON.stringify(A.account,null,2)),i(T=>[...T||[],A.account])}catch(k){console.error(k),yh(k)&&t({title:"Account already linked",description:"This account is already linked to another wallet",variant:"error"})}else _&&console.log("Error: "+JSON.stringify(_))})}});return y.useEffect(()=>{Re.listAccounts().then(M=>{i(M.accounts),M.currentAccountId&&r(M.accounts.find(v=>v.id===M.currentAccountId)),o(!1)}).catch(M=>{l(M.message),o(!1)})},[E]),$.jsxs(G,{children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{marginBottom:"5",gap:"4",flexDirection:"column",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your connected (linked) accounts"}),n&&$.jsx($.Fragment,{children:n.map(M=>$.jsxs(G,{flexDirection:"row",alignItems:"center",gap:"2",children:[$.jsx(me,{variant:"normal",color:"text100",children:GT(M)}),M.id!==(e==null?void 0:e.id)&&$.jsx(Ct,{size:"xs",label:"Remove",onClick:()=>j(M.id)}),M.id===(e==null?void 0:e.id)&&$.jsx(G,{children:$.jsx(me,{variant:"small",color:"text100",children:"(Account you logged in with)"})})]},M.id))}),s&&$.jsx(_n,{})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(G,{flexDirection:"column",gap:"2",width:"fit",children:[$.jsx(me,{variant:"large",color:"text100",fontWeight:"bold",marginBottom:"5",children:"Connect (link) another login method"}),$.jsx(G8,{onSuccess:L,shape:"circle",width:230}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(Q8,{authOptions:{clientId:"com.horizon.sequence.waas",scope:"openid email",redirectURI:U,usePopup:!0},onError:M=>console.error(M),onSuccess:K,uiType:"dark"}),$.jsxs($.Fragment,{children:[$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsx(G,{marginTop:"2",children:$.jsx(G,{children:$.jsx(Ct,{label:"Login with Google (through Playfab)",onClick:X})})})]}),$.jsx(Nr,{background:"buttonGlass",width:"full"}),$.jsxs(G,{marginTop:"2",children:[$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Email"}),$.jsx(G,{marginTop:"4",children:$.jsx(i5,{label:"Use v2 email login",disabled:!0,checked:b,onChange:()=>w(!b)})})]}),I?$.jsxs(G,{flexDirection:"column",children:[$.jsx(G,{marginTop:"3",children:$.jsx(me,{marginTop:"5",variant:"normal",color:"text80",children:"Enter code received in email."})}),$.jsx(G,{marginTop:"4",children:$.jsx(zF,{value:m,digits:6,onChange:x})}),$.jsx(G,{gap:"2",marginY:"4",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:m.includes(""),label:"Verify",onClick:()=>I(m.join("")),"data-id":"verifyButton"})})]}):$.jsxs(G,{marginBottom:"4",children:[$.jsxs(me,{variant:"normal",color:"text80",children:["Enter your email to recieve a code to login and create your wallet. ",$.jsx("br",{}),"Please check your spam folder if you don't see it in your inbox."]}),$.jsxs(G,{marginTop:"6",children:[$.jsx(Ir,{name:"email",type:"email",onChange:M=>{f(M.target.value)},ref:u,onKeyDown:M=>{c&&M.key==="Enter"&&N(c)},onBlur:()=>p(!!c&&!d),value:c,placeholder:"hello@example.com",required:!0,"data-id":"loginEmail"}),h&&$.jsx(me,{as:"p",variant:"small",color:"negative",marginY:"2",children:"Invalid email address"})]}),$.jsx(G,{gap:"2",marginY:"4",alignItems:"center",justifyContent:"center",children:P?$.jsx(_n,{}):$.jsx(Ct,{variant:"primary",disabled:!d,label:"Continue",onClick:()=>N(c),"data-id":"continueButton"})})]})]}),a&&$.jsxs(me,{variant:"normal",color:"text100",fontWeight:"bold",children:["Error loading accounts: ",a]})]})}function tne(){const[t,e]=y.useState(),[r,n]=y.useState(),[i,s]=y.useState([]),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[f,u]=y.useState(),[d,h]=y.useState();return y.useEffect(()=>{Re.getAddress().then(p=>{e(p)}).catch(p=>{n(p.message)}),Re.listAccounts().then(p=>{p.currentAccountId&&h(p.accounts.find(m=>m.id===p.currentAccountId))})},[]),y.useEffect(()=>{Re.isSignedIn().then(p=>{p||Ri.navigate("/login")})},[]),y.useEffect(()=>{const p=i.join("");p.length===6&&(c(!0),Re.finishValidateSession(p))},[i]),y.useEffect(()=>{const p=Re.onValidationRequired(()=>{a(!0),Re.waitForSessionValid(6e5,4e3).then(m=>{console.log("isValid",m),s([]),a(!1),c(!1)})});return()=>{p.then(m=>m())}},[]),$.jsxs($.Fragment,{children:[$.jsx(Hg,{children:o&&$.jsx(i8,{children:$.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"1.2em",height:"50vh"},children:$.jsxs(G,{flexDirection:"column",alignItems:"center",children:[$.jsx(me,{marginBottom:"7",children:"Please enter the session verification code that was sent to your email"}),$.jsx(J8,{value:i,digits:6,onChange:s}),$.jsx(G,{marginTop:"5",children:l&&$.jsx(_n,{})})]})})})}),$.jsxs(G,{marginY:"0",marginX:"auto",paddingX:"6",style:{maxWidth:"720px",marginTop:"80px",marginBottom:"80px"},children:[$.jsx(G,{marginBottom:"10",children:$.jsx(X8,{})}),$.jsxs(G,{marginBottom:"5",flexDirection:"row",children:[d&&$.jsxs(G,{flexDirection:"column",gap:"2",children:[$.jsxs(me,{marginTop:"1",variant:"normal",color:"text100",children:[d.type===cr.Guest?"Guest account":`Logged in with account type ${d.type}`," "]}),d.type!==cr.Guest&>(d)]}),$.jsx(Ct,{marginLeft:"auto",label:"Log out",size:"xs",onClick:async()=>{try{await Re.dropSession({strict:!1})}catch(p){console.warn(`Could not drop session: ${p.message}`)}$V(),Ri.navigate("/login")}})]}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"bold",children:"Your wallet address:"})}),$.jsx(G,{marginBottom:"5",children:$.jsx(me,{variant:"normal",color:"text100",fontWeight:"normal",children:t?$.jsx(G,{children:$.jsx(me,{children:t})}):$.jsx(_n,{})})}),$.jsx(G,{children:r&&$.jsxs(me,{children:["Error fetching wallet address: ",r]})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(qre,{}),$.jsx(Nr,{background:"buttonGlass"}),$.jsx(G,{marginBottom:"5",children:$.jsx(Zre,{onNetworkChange:u})}),$.jsx(Nr,{background:"buttonGlass"}),$.jsxs(il,{marginY:"3",label:"Send native token transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Vre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC20 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Gre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Send ERC1155 transaction",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Qre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Sign a message",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Hre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"Call contracts",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Wre,{network:f})]}),$.jsxs(il,{marginY:"3",label:"EOA Link",children:[$.jsx(Nr,{background:"buttonGlass"}),$.jsx(Jre,{network:f,walletAddress:t})]}),$.jsx(ene,{})]})]})}function rne(t,e,r){return e=JT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bm(t,e){return sne(t)||ine(t,e)||KT(t,e)||nne()}function nne(){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 ine(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function sne(t){if(Array.isArray(t))return t}function one(t){return cne(t)||lne(t)||KT(t)||ane()}function ane(){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 KT(t,e){if(t){if(typeof t=="string")return wm(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 wm(t,e)}}function lne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function cne(t){if(Array.isArray(t))return wm(t)}function wm(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--D){var S=this.tryEntries[D],g=S.completion;if(S.tryLoc==="root")return O("end");if(S.tryLoc<=this.prev){var R=n.call(S,"catchLoc"),F=n.call(S,"finallyLoc");if(R&&F){if(this.prev=0;--O){var D=this.tryEntries[O];if(D.tryLoc<=this.prev&&n.call(D,"finallyLoc")&&this.prev=0;--T){var O=this.tryEntries[T];if(O.finallyLoc===A)return this.complete(O.completion,O.afterLoc),M(O),x}},catch:function(A){for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T];if(O.tryLoc===A){var D=O.completion;if(D.type==="throw"){var S=D.arg;M(O)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(A,T,O){return this.delegate={iterator:_(A),resultName:T,nextLoc:O},this.method==="next"&&(this.arg=t),x}},e}function $i(t){"@babel/helpers - typeof";return $i=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},$i(t)}function On(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function GA(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=0;--D){var S=this.tryEntries[D],g=S.completion;if(S.tryLoc==="root")return O("end");if(S.tryLoc<=this.prev){var R=n.call(S,"catchLoc"),F=n.call(S,"finallyLoc");if(R&&F){if(this.prev=0;--O){var D=this.tryEntries[O];if(D.tryLoc<=this.prev&&n.call(D,"finallyLoc")&&this.prev=0;--T){var O=this.tryEntries[T];if(O.finallyLoc===A)return this.complete(O.completion,O.afterLoc),M(O),x}},catch:function(A){for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T];if(O.tryLoc===A){var D=O.completion;if(D.type==="throw"){var S=D.arg;M(O)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(A,T,O){return this.delegate={iterator:_(A),resultName:T,nextLoc:O},this.method==="next"&&(this.arg=t),x}},e}function $i(t){"@babel/helpers - typeof";return $i=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},$i(t)}function On(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function GA(t,e){for(var r=0;r"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"))},Qne=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:Nne},s9=function(e){return e.includes("public-token-test")},Jne=function(){return"event-id-".concat(ww())},Xne=function(){return"app-session-id-".concat(ww())},Zne=function(){return"persistent-id-".concat(ww())},Zt=function(e){var r={isObject:function(i,s){var o=ms(s)==="object"&&!Array.isArray(s)&&s!==null;if(!o)throw new hl(e,i+" must be an object.");return r},isOptionalObject:function(i,s){return typeof s>"u"?r:r.isObject(i,s)},isString:function(i,s){if(typeof s!="string")throw new hl(e,i+" must be a string.");return r},isOptionalString:function(i,s){return typeof s>"u"?r:r.isString(i,s)},isStringArray:function(i,s){if(!Array.isArray(s))throw new hl(e,i+" must be an array of strings.");var o=e9(s),a;try{for(o.s();!(a=o.n()).done;){var l=a.value;if(typeof l!="string")throw new hl(e,i+" must be an array of strings.")}}catch(c){o.e(c)}finally{o.f()}return r},isOptionalStringArray:function(i,s){return typeof s>"u"?r:r.isStringArray(i,s)},isNumber:function(i,s){if(typeof s!="number")throw new hl(e,i+" must be a number.");return r},isOptionalNumber:function(i,s){return typeof s>"u"?r:r.isNumber(i,s)},isBoolean:function(i,s){if(typeof s!="boolean")throw new hl(e,i+" must be a boolean.");return r},isOptionalBoolean:function(i,s){return typeof s>"u"?r:r.isBoolean(i,s)}};return r},Yi=function(e){var r=n9(e,["request_id","status_code"]);return r},gr=function(e){var r=n9(e,["__user"]);return r},eie=function(){return Ew("".concat($ne,"/telemetry.js"),function(){return window.GetTelemetryID})},tie=Jr(function t(e,r,n){var i=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)};Xr(this,t),this.bootstrapPromise=n,this.isEnabled=function(){return Se(i,void 0,void 0,se().mark(function o(){return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.abrupt("return",this.state.then(function(c){return c.enabled}));case 1:case"end":return l.stop()}},o,this)}))},this.getTelemetryID=function(){return Se(i,void 0,void 0,se().mark(function o(){var a,l,c,f;return se().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,this.state;case 2:if(a=d.sent,l=a.publicToken,c=a.enabled,f=a.dfpBackendURL,c){d.next=8;break}return d.abrupt("return",void 0);case 8:return d.next=10,window.GetTelemetryID(l,"".concat(f,"/submit"));case 10:return d.abrupt("return",d.sent);case 11:case"end":return d.stop()}},o,this)}))},this.getDFPTelemetryIDAndCaptcha=function(){return Se(i,void 0,void 0,se().mark(function o(){var a,l,c,f,u,d;return se().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.state;case 2:if(a=p.sent,l=a.enabled,c=a.executeRecaptcha,f=a.mode,u=void 0,d=void 0,l){p.next=12;break}return p.next=11,c();case 11:d=p.sent;case 12:if(f!=="DECISIONING"){p.next=18;break}return p.next=15,this.getTelemetryID();case 15:u=p.sent,p.next=25;break;case 18:if(f!=="OBSERVATION"){p.next=25;break}return p.next=21,this.getTelemetryID();case 21:return u=p.sent,p.next=24,c();case 24:d=p.sent;case 25:return p.abrupt("return",{dfp_telemetry_id:u,captcha_token:d});case 26:case"end":return p.stop()}},o,this)}))},this.retryWithCaptchaAndDFP=function(o,a){return Se(i,void 0,void 0,se().mark(function l(){var c,f,u;return se().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.state;case 2:if(c=h.sent,f=c.enabled,u=c.executeRecaptcha,!(o.type===_0.RequiredCatcha&&f)){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,u();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()}},l,this)}))},this.state=n.then(function(o){return Se(i,void 0,void 0,se().mark(function a(){return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(o.runDFPProtectedAuth){c.next=2;break}return c.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!1,loaded:!1,executeRecaptcha:s});case 2:return c.next=4,eie();case 4:return c.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!0,mode:o.dfpProtectedAuthMode||"OBSERVATION",loaded:!0,executeRecaptcha:s});case 5:case"end":return c.stop()}},a)}))})}),rie=function(){function t(){Xr(this,t)}return Jr(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 i=new r(n);return Object.assign(i,n),Object.setPrototypeOf(i,r.prototype),i}},{key:"unmarshall",value:function(r){if("name"in r)switch(r.name){case"SDKAPIUnreachableError":return t.inflate(pne,r);case"StytchSDKSchemaError":return t.inflate(yne,r);case"StytchAPIUnreachableError":return t.inflate(pl,r);case"StytchAPISchemaError":return t.inflate(XT,r);case"StytchSDKAPIError":return t.inflate(mne,r);case"StytchAPIError":return t.inflate(ZT,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}(),nie=15,iie=800,sie=function(){function t(e){Xr(this,t),this.maxBatchSize=e.maxBatchSize,this.logEventURL=e.logEventURL,setInterval(this.flush.bind(this),e.intervalDurationMs),this.batch=[]}return Jr(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 Se(this,void 0,void 0,se().mark(function r(){var n;return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(this.batch.length){s.next=2;break}return s.abrupt("return");case 2:return n=this.batch,this.batch=[],s.prev=4,s.next=7,fetch(this.logEventURL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 7:s.next=11;break;case 9:s.prev=9,s.t0=s.catch(4);case 11:case"end":return s.stop()}},r,this,[[4,9]])}))}}]),t}(),sC;(function(t){t.LoginOrCreateEML="login_or_create_eml",t.LoginOrCreateOTP="login_or_create_otp",t.ResetPassword="reset_password"})(sC||(sC={}));var oie=Jr(function t(e,r){var n=this;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this.get=function(){return Se(n,void 0,void 0,se().mark(function i(){var s,o;return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/me",errorMessage:"Failed to retrieve user info.",method:"GET"});case 2:return s=l.sent,o=Yi(s),this._subscriptionService.updateUser(o),l.abrupt("return",o);case 6:case"end":return l.stop()}},i,this)}))},this.getSync=function(){return n._subscriptionService.getUser()},this.getInfo=function(){return{user:n.getSync(),fromCache:n._subscriptionService.getFromCache()}},this.update=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.user.update").isOptionalObject("untrusted_metadata",i.untrusted_metadata),c.next=3,this._networkClient.fetchSDK({url:"/users/me",body:i,errorMessage:"Failed to update user.",method:"PUT"});case 3:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",gr(o));case 7:case"end":return c.stop()}},s,this)}))},this.deleteEmail=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/emails/".concat(i),errorMessage:"Failed to delete email.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",gr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deletePhoneNumber=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/phone_numbers/".concat(i),errorMessage:"Failed to delete phone number.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",gr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteTOTP=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/totps/".concat(i),errorMessage:"Failed to delete TOTP.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",gr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteOAuthRegistration=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/oauth/".concat(i),errorMessage:"Failed to delete OAuth registration.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",gr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteWebauthnRegistration=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/webauthn_registrations/".concat(i),errorMessage:"Failed to delete WebAuthn registration.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",gr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteBiometricRegistration=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/biometric_registrations/".concat(i),errorMessage:"Failed to delete Biometric registration.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",gr(o));case 6:case"end":return c.stop()}},s,this)}))},this.onChange=function(i){var s=n._subscriptionService.getUser(),o=function(l){var c;(l==null?void 0:l.user)!==s&&(s=(c=l==null?void 0:l.user)!==null&&c!==void 0?c:null,i(s))};return n._subscriptionService.subscribeToState(o)}}),aie=function(){function t(e,r){var n=this;Xr(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(i){var s=n._subscriptionService.getSession(),o=function(l){var c;(l==null?void 0:l.session)!==s&&(s=(c=l==null?void 0:l.session)!==null&&c!==void 0?c:null,i(s))};return n._subscriptionService.subscribeToState(o)},this.revoke=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o;return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,l.next=3,this._networkClient.fetchSDK({url:"/sessions/revoke",errorMessage:"Error revoking session",method:"POST"});case 3:return o=l.sent,this._subscriptionService.destroyState(),l.abrupt("return",o);case 8:throw l.prev=8,l.t0=l.catch(0),i!=null&&i.forceClear?this._subscriptionService.destroyState():km.includes(l.t0.error_type)&&this._subscriptionService.destroyState(),l.t0;case 12:case"end":return l.stop()}},s,this,[[0,8]])}))},this.authenticate=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o=this,a,l,c,f;return se().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return a=this._subscriptionService.getSession(),l=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,c={session_duration_minutes:i==null?void 0:i.session_duration_minutes},d.next=6,this._networkClient.fetchSDK({url:"/sessions/authenticate",body:c,errorMessage:"Error authenticating session",method:"POST"});case 6:if(f=d.sent,!l()){d.next=9;break}return d.abrupt("return",this.authenticate(i));case 9:return this._subscriptionService.updateStateAndTokens({state:{session:f.session,user:f.user},session_token:f.session_token,session_jwt:f.session_jwt,intermediate_session_token:null}),d.abrupt("return",gr(f));case 13:if(d.prev=13,d.t0=d.catch(2),!l()){d.next=17;break}return d.abrupt("return",this.authenticate(i));case 17:throw km.includes(d.t0.error_type)&&this._subscriptionService.destroySession(),d.t0;case 19:case"end":return d.stop()}},s,this,[[2,13]])}))}}return Jr(t,[{key:"getTokens",value:function(){return this._subscriptionService.getTokens()}},{key:"updateSession",value:function(r){var n;Zt("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}(),lie=Promise.resolve({pkceRequiredForEmailMagicLinks:!1}),cie=function(){function t(e,r,n,i){var s=this,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:lie,a=arguments.length>5?arguments[5]:void 0;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._passwordResetPKCEManager=i,this._config=o,this.dfpProtectedAuth=a,this.email={loginOrCreate:function(c){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Se(s,void 0,void 0,se().mark(function u(){var d,h,p,m,x,b,w;return se().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,this._config;case 2:if(d=P.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){P.next=9;break}return P.next=8,this.getCodeChallenge();case 8:p=P.sent;case 9:return P.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return m=P.sent,x=m.dfp_telemetry_id,b=m.captcha_token,w=Object.assign(Object.assign({},f),{email:c,code_challenge:p,captcha_token:b,dfp_telemetry_id:x}),P.abrupt("return",this._networkClient.retriableFetchSDK({url:"/magic_links/email/login_or_create",body:w,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 16:case"end":return P.stop()}},u,this)}))},send:function(c){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Se(s,void 0,void 0,se().mark(function u(){var d,h,p,m,x,b,w,E,P;return se().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,this._config;case 2:if(d=I.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){I.next=9;break}return I.next=8,this.getCodeChallenge();case 8:p=I.sent;case 9:return I.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return m=I.sent,x=m.dfp_telemetry_id,b=m.captcha_token,w=Object.assign(Object.assign({},f),{email:c,code_challenge:p,captcha_token:b,dfp_telemetry_id:x}),E=!!this._subscriptionService.getSession(),P=E?"/magic_links/email/send/secondary":"/magic_links/email/send/primary",I.abrupt("return",this._networkClient.retriableFetchSDK({url:P,body:w,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 18:case"end":return I.stop()}},u,this)}))}},this.authenticate=function(l,c){return Se(s,void 0,void 0,se().mark(function f(){var u,d;return se().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return Zt("stytch.magicLinks.authenticate").isString("Token",l).isNumber("session_duration_minutes",c.session_duration_minutes),p.next=3,this._passwordResetPKCEManager.getPKPair();case 3:if(u=p.sent,d=null,!(u!=null&&u.code_verifier)){p.next=19;break}return p.prev=6,p.next=9,this.handlePKCEForAuthenticate(this._passwordResetPKCEManager,Object.assign(Object.assign({},c),{token:l}));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({},c),{token:l}));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",gr(d));case 25:case"end":return p.stop()}},f,this,[[6,12]])}))}}return Jr(t,[{key:"getCodeChallenge",value:function(){return Se(this,void 0,void 0,se().mark(function r(){var n;return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,this._pkceManager.getPKPair();case 2:if(n=s.sent,!n){s.next=5;break}return s.abrupt("return",n.code_challenge);case 5:return s.next=7,this._pkceManager.startPKCETransaction();case 7:return n=s.sent,s.abrupt("return",n.code_challenge);case 9:case"end":return s.stop()}},r,this)}))}},{key:"handlePKCEForAuthenticate",value:function(r,n){return Se(this,void 0,void 0,se().mark(function i(){var s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,r.getPKPair();case 2:return s=c.sent,o=Object.assign({code_verifier:s==null?void 0:s.code_verifier},n),c.next=6,this._networkClient.fetchSDK({url:"/magic_links/authenticate",body:o,errorMessage:"Failed to authenticate token.",method:"POST"});case 6:return a=c.sent,r.clearPKPair(),c.abrupt("return",a);case 9:case"end":return c.stop()}},i,this)}))}}]),t}(),fie=Jr(function t(e,r){var n=this,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return Promise.resolve(void 0)},s=arguments.length>3?arguments[3]:void 0;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this.executeRecaptcha=i,this.dfpProtectedAuth=s,this.sms={loginOrCreate:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h;return se().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=m.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,captcha_token:d,dfp_telemetry_id:u}),m.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 m.stop()}},c,this)}))},send:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p,m;return se().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=b.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,captcha_token:d,dfp_telemetry_id:u}),p=!!this._subscriptionService.getSession(),m=p?"/otps/sms/send/secondary":"/otps/sms/send/primary",b.abrupt("return",this._networkClient.retriableFetchSDK({url:m,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return b.stop()}},c,this)}))}},this.whatsapp={loginOrCreate:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h;return se().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=m.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,dfp_telemetry_id:u,captcha_token:d}),m.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 m.stop()}},c,this)}))},send:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p,m;return se().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=b.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,captcha_token:d,dfp_telemetry_id:u}),p=!!this._subscriptionService.getSession(),m=p?"/otps/whatsapp/send/secondary":"/otps/whatsapp/send/primary",b.abrupt("return",this._networkClient.retriableFetchSDK({url:m,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return b.stop()}},c,this)}))}},this.email={loginOrCreate:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u;return se().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.executeRecaptcha();case 2:return f=h.sent,u=Object.assign(Object.assign({},l),{email:a,captcha_token:f}),h.abrupt("return",this._networkClient.fetchSDK({url:"/otps/email/login_or_create",body:u,errorMessage:"Failed to send one time passcode",method:"POST"}));case 5:case"end":return h.stop()}},c,this)}))},send:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h;return se().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.executeRecaptcha();case 2:return f=m.sent,u=Object.assign(Object.assign({},l),{email:a,captcha_token:f}),d=!!this._subscriptionService.getSession(),h=d?"/otps/email/send/secondary":"/otps/email/send/primary",m.abrupt("return",this._networkClient.fetchSDK({url:h,body:u,errorMessage:"Failed to send one time passcode",method:"POST"}));case 7:case"end":return m.stop()}},c,this)}))}},this.authenticate=function(o,a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p;return se().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return Zt("stytch.otps.authenticate").isString("Code",o).isNumber("session_duration_minutes",l.session_duration_minutes),x.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return f=x.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign({token:o,method_id:a,dfp_telemetry_id:u,captcha_token:d},l),x.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=x.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}),x.abrupt("return",gr(p));case 12:case"end":return x.stop()}},c,this)}))}}),uie=function(){function t(e,r,n,i,s){Xr(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._dynamicConfig=i,this._config=s,this.google={start:this.startOAuthFlow(dr.Google)},this.apple={start:this.startOAuthFlow(dr.Apple)},this.microsoft={start:this.startOAuthFlow(dr.Microsoft)},this.github={start:this.startOAuthFlow(dr.Github)},this.gitlab={start:this.startOAuthFlow(dr.GitLab)},this.facebook={start:this.startOAuthFlow(dr.Facebook)},this.discord={start:this.startOAuthFlow(dr.Discord)},this.salesforce={start:this.startOAuthFlow(dr.Salesforce)},this.slack={start:this.startOAuthFlow(dr.Slack)},this.amazon={start:this.startOAuthFlow(dr.Amazon)},this.bitbucket={start:this.startOAuthFlow(dr.Bitbucket)},this.linkedin={start:this.startOAuthFlow(dr.LinkedIn)},this.coinbase={start:this.startOAuthFlow(dr.Coinbase)},this.twitch={start:this.startOAuthFlow(dr.Twitch)},this.twitter={start:this.startOAuthFlow(dr.Twitter)},this.tiktok={start:this.startOAuthFlow(dr.TikTok)},this.snapchat={start:this.startOAuthFlow(dr.Snapchat)},this.figma={start:this.startOAuthFlow(dr.Figma)},this.yahoo={start:this.startOAuthFlow(dr.Yahoo)}}return Jr(t,[{key:"authenticate",value:function(r,n){return Se(this,void 0,void 0,se().mark(function i(){var s,o;return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Zt("stytch.oauth.authenticate").isString("Token",r).isNumber("session_duration_minutes",n.session_duration_minutes),l.next=3,this._pkceManager.getPKPair();case 3:return s=l.sent,s||ds.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"))},Qne=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:Nne},s9=function(e){return e.includes("public-token-test")},Jne=function(){return"event-id-".concat(ww())},Xne=function(){return"app-session-id-".concat(ww())},Zne=function(){return"persistent-id-".concat(ww())},Zt=function(e){var r={isObject:function(i,s){var o=ms(s)==="object"&&!Array.isArray(s)&&s!==null;if(!o)throw new hl(e,i+" must be an object.");return r},isOptionalObject:function(i,s){return typeof s>"u"?r:r.isObject(i,s)},isString:function(i,s){if(typeof s!="string")throw new hl(e,i+" must be a string.");return r},isOptionalString:function(i,s){return typeof s>"u"?r:r.isString(i,s)},isStringArray:function(i,s){if(!Array.isArray(s))throw new hl(e,i+" must be an array of strings.");var o=e9(s),a;try{for(o.s();!(a=o.n()).done;){var l=a.value;if(typeof l!="string")throw new hl(e,i+" must be an array of strings.")}}catch(c){o.e(c)}finally{o.f()}return r},isOptionalStringArray:function(i,s){return typeof s>"u"?r:r.isStringArray(i,s)},isNumber:function(i,s){if(typeof s!="number")throw new hl(e,i+" must be a number.");return r},isOptionalNumber:function(i,s){return typeof s>"u"?r:r.isNumber(i,s)},isBoolean:function(i,s){if(typeof s!="boolean")throw new hl(e,i+" must be a boolean.");return r},isOptionalBoolean:function(i,s){return typeof s>"u"?r:r.isBoolean(i,s)}};return r},Yi=function(e){var r=n9(e,["request_id","status_code"]);return r},xr=function(e){var r=n9(e,["__user"]);return r},eie=function(){return Ew("".concat($ne,"/telemetry.js"),function(){return window.GetTelemetryID})},tie=Jr(function t(e,r,n){var i=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)};Xr(this,t),this.bootstrapPromise=n,this.isEnabled=function(){return Se(i,void 0,void 0,se().mark(function o(){return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.abrupt("return",this.state.then(function(c){return c.enabled}));case 1:case"end":return l.stop()}},o,this)}))},this.getTelemetryID=function(){return Se(i,void 0,void 0,se().mark(function o(){var a,l,c,f;return se().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,this.state;case 2:if(a=d.sent,l=a.publicToken,c=a.enabled,f=a.dfpBackendURL,c){d.next=8;break}return d.abrupt("return",void 0);case 8:return d.next=10,window.GetTelemetryID(l,"".concat(f,"/submit"));case 10:return d.abrupt("return",d.sent);case 11:case"end":return d.stop()}},o,this)}))},this.getDFPTelemetryIDAndCaptcha=function(){return Se(i,void 0,void 0,se().mark(function o(){var a,l,c,f,u,d;return se().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.state;case 2:if(a=p.sent,l=a.enabled,c=a.executeRecaptcha,f=a.mode,u=void 0,d=void 0,l){p.next=12;break}return p.next=11,c();case 11:d=p.sent;case 12:if(f!=="DECISIONING"){p.next=18;break}return p.next=15,this.getTelemetryID();case 15:u=p.sent,p.next=25;break;case 18:if(f!=="OBSERVATION"){p.next=25;break}return p.next=21,this.getTelemetryID();case 21:return u=p.sent,p.next=24,c();case 24:d=p.sent;case 25:return p.abrupt("return",{dfp_telemetry_id:u,captcha_token:d});case 26:case"end":return p.stop()}},o,this)}))},this.retryWithCaptchaAndDFP=function(o,a){return Se(i,void 0,void 0,se().mark(function l(){var c,f,u;return se().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.state;case 2:if(c=h.sent,f=c.enabled,u=c.executeRecaptcha,!(o.type===_0.RequiredCatcha&&f)){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,u();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()}},l,this)}))},this.state=n.then(function(o){return Se(i,void 0,void 0,se().mark(function a(){return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(o.runDFPProtectedAuth){c.next=2;break}return c.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!1,loaded:!1,executeRecaptcha:s});case 2:return c.next=4,eie();case 4:return c.abrupt("return",{publicToken:e,dfpBackendURL:r,enabled:!0,mode:o.dfpProtectedAuthMode||"OBSERVATION",loaded:!0,executeRecaptcha:s});case 5:case"end":return c.stop()}},a)}))})}),rie=function(){function t(){Xr(this,t)}return Jr(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 i=new r(n);return Object.assign(i,n),Object.setPrototypeOf(i,r.prototype),i}},{key:"unmarshall",value:function(r){if("name"in r)switch(r.name){case"SDKAPIUnreachableError":return t.inflate(pne,r);case"StytchSDKSchemaError":return t.inflate(yne,r);case"StytchAPIUnreachableError":return t.inflate(pl,r);case"StytchAPISchemaError":return t.inflate(XT,r);case"StytchSDKAPIError":return t.inflate(mne,r);case"StytchAPIError":return t.inflate(ZT,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}(),nie=15,iie=800,sie=function(){function t(e){Xr(this,t),this.maxBatchSize=e.maxBatchSize,this.logEventURL=e.logEventURL,setInterval(this.flush.bind(this),e.intervalDurationMs),this.batch=[]}return Jr(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 Se(this,void 0,void 0,se().mark(function r(){var n;return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(this.batch.length){s.next=2;break}return s.abrupt("return");case 2:return n=this.batch,this.batch=[],s.prev=4,s.next=7,fetch(this.logEventURL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 7:s.next=11;break;case 9:s.prev=9,s.t0=s.catch(4);case 11:case"end":return s.stop()}},r,this,[[4,9]])}))}}]),t}(),sC;(function(t){t.LoginOrCreateEML="login_or_create_eml",t.LoginOrCreateOTP="login_or_create_otp",t.ResetPassword="reset_password"})(sC||(sC={}));var oie=Jr(function t(e,r){var n=this;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this.get=function(){return Se(n,void 0,void 0,se().mark(function i(){var s,o;return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,this._networkClient.fetchSDK({url:"/users/me",errorMessage:"Failed to retrieve user info.",method:"GET"});case 2:return s=l.sent,o=Yi(s),this._subscriptionService.updateUser(o),l.abrupt("return",o);case 6:case"end":return l.stop()}},i,this)}))},this.getSync=function(){return n._subscriptionService.getUser()},this.getInfo=function(){return{user:n.getSync(),fromCache:n._subscriptionService.getFromCache()}},this.update=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.user.update").isOptionalObject("untrusted_metadata",i.untrusted_metadata),c.next=3,this._networkClient.fetchSDK({url:"/users/me",body:i,errorMessage:"Failed to update user.",method:"PUT"});case 3:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",xr(o));case 7:case"end":return c.stop()}},s,this)}))},this.deleteEmail=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/emails/".concat(i),errorMessage:"Failed to delete email.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",xr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deletePhoneNumber=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/phone_numbers/".concat(i),errorMessage:"Failed to delete phone number.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",xr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteTOTP=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/totps/".concat(i),errorMessage:"Failed to delete TOTP.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",xr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteOAuthRegistration=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/oauth/".concat(i),errorMessage:"Failed to delete OAuth registration.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",xr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteWebauthnRegistration=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/webauthn_registrations/".concat(i),errorMessage:"Failed to delete WebAuthn registration.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",xr(o));case 6:case"end":return c.stop()}},s,this)}))},this.deleteBiometricRegistration=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this._networkClient.fetchSDK({url:"/users/biometric_registrations/".concat(i),errorMessage:"Failed to delete Biometric registration.",method:"DELETE"});case 2:return o=c.sent,a=Yi(o.__user),this._subscriptionService.updateUser(a),c.abrupt("return",xr(o));case 6:case"end":return c.stop()}},s,this)}))},this.onChange=function(i){var s=n._subscriptionService.getUser(),o=function(l){var c;(l==null?void 0:l.user)!==s&&(s=(c=l==null?void 0:l.user)!==null&&c!==void 0?c:null,i(s))};return n._subscriptionService.subscribeToState(o)}}),aie=function(){function t(e,r){var n=this;Xr(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(i){var s=n._subscriptionService.getSession(),o=function(l){var c;(l==null?void 0:l.session)!==s&&(s=(c=l==null?void 0:l.session)!==null&&c!==void 0?c:null,i(s))};return n._subscriptionService.subscribeToState(o)},this.revoke=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o;return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,l.next=3,this._networkClient.fetchSDK({url:"/sessions/revoke",errorMessage:"Error revoking session",method:"POST"});case 3:return o=l.sent,this._subscriptionService.destroyState(),l.abrupt("return",o);case 8:throw l.prev=8,l.t0=l.catch(0),i!=null&&i.forceClear?this._subscriptionService.destroyState():km.includes(l.t0.error_type)&&this._subscriptionService.destroyState(),l.t0;case 12:case"end":return l.stop()}},s,this,[[0,8]])}))},this.authenticate=function(i){return Se(n,void 0,void 0,se().mark(function s(){var o=this,a,l,c,f;return se().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return a=this._subscriptionService.getSession(),l=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,c={session_duration_minutes:i==null?void 0:i.session_duration_minutes},d.next=6,this._networkClient.fetchSDK({url:"/sessions/authenticate",body:c,errorMessage:"Error authenticating session",method:"POST"});case 6:if(f=d.sent,!l()){d.next=9;break}return d.abrupt("return",this.authenticate(i));case 9:return this._subscriptionService.updateStateAndTokens({state:{session:f.session,user:f.user},session_token:f.session_token,session_jwt:f.session_jwt,intermediate_session_token:null}),d.abrupt("return",xr(f));case 13:if(d.prev=13,d.t0=d.catch(2),!l()){d.next=17;break}return d.abrupt("return",this.authenticate(i));case 17:throw km.includes(d.t0.error_type)&&this._subscriptionService.destroySession(),d.t0;case 19:case"end":return d.stop()}},s,this,[[2,13]])}))}}return Jr(t,[{key:"getTokens",value:function(){return this._subscriptionService.getTokens()}},{key:"updateSession",value:function(r){var n;Zt("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}(),lie=Promise.resolve({pkceRequiredForEmailMagicLinks:!1}),cie=function(){function t(e,r,n,i){var s=this,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:lie,a=arguments.length>5?arguments[5]:void 0;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._passwordResetPKCEManager=i,this._config=o,this.dfpProtectedAuth=a,this.email={loginOrCreate:function(c){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Se(s,void 0,void 0,se().mark(function u(){var d,h,p,m,x,b,w;return se().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,this._config;case 2:if(d=P.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){P.next=9;break}return P.next=8,this.getCodeChallenge();case 8:p=P.sent;case 9:return P.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return m=P.sent,x=m.dfp_telemetry_id,b=m.captcha_token,w=Object.assign(Object.assign({},f),{email:c,code_challenge:p,captcha_token:b,dfp_telemetry_id:x}),P.abrupt("return",this._networkClient.retriableFetchSDK({url:"/magic_links/email/login_or_create",body:w,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 16:case"end":return P.stop()}},u,this)}))},send:function(c){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Se(s,void 0,void 0,se().mark(function u(){var d,h,p,m,x,b,w,E,P;return se().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return I.next=2,this._config;case 2:if(d=I.sent,h=d.pkceRequiredForEmailMagicLinks,p=void 0,!h){I.next=9;break}return I.next=8,this.getCodeChallenge();case 8:p=I.sent;case 9:return I.next=11,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 11:return m=I.sent,x=m.dfp_telemetry_id,b=m.captcha_token,w=Object.assign(Object.assign({},f),{email:c,code_challenge:p,captcha_token:b,dfp_telemetry_id:x}),E=!!this._subscriptionService.getSession(),P=E?"/magic_links/email/send/secondary":"/magic_links/email/send/primary",I.abrupt("return",this._networkClient.retriableFetchSDK({url:P,body:w,errorMessage:"Failed to send magic link",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 18:case"end":return I.stop()}},u,this)}))}},this.authenticate=function(l,c){return Se(s,void 0,void 0,se().mark(function f(){var u,d;return se().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return Zt("stytch.magicLinks.authenticate").isString("Token",l).isNumber("session_duration_minutes",c.session_duration_minutes),p.next=3,this._passwordResetPKCEManager.getPKPair();case 3:if(u=p.sent,d=null,!(u!=null&&u.code_verifier)){p.next=19;break}return p.prev=6,p.next=9,this.handlePKCEForAuthenticate(this._passwordResetPKCEManager,Object.assign(Object.assign({},c),{token:l}));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({},c),{token:l}));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",xr(d));case 25:case"end":return p.stop()}},f,this,[[6,12]])}))}}return Jr(t,[{key:"getCodeChallenge",value:function(){return Se(this,void 0,void 0,se().mark(function r(){var n;return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,this._pkceManager.getPKPair();case 2:if(n=s.sent,!n){s.next=5;break}return s.abrupt("return",n.code_challenge);case 5:return s.next=7,this._pkceManager.startPKCETransaction();case 7:return n=s.sent,s.abrupt("return",n.code_challenge);case 9:case"end":return s.stop()}},r,this)}))}},{key:"handlePKCEForAuthenticate",value:function(r,n){return Se(this,void 0,void 0,se().mark(function i(){var s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,r.getPKPair();case 2:return s=c.sent,o=Object.assign({code_verifier:s==null?void 0:s.code_verifier},n),c.next=6,this._networkClient.fetchSDK({url:"/magic_links/authenticate",body:o,errorMessage:"Failed to authenticate token.",method:"POST"});case 6:return a=c.sent,r.clearPKPair(),c.abrupt("return",a);case 9:case"end":return c.stop()}},i,this)}))}}]),t}(),fie=Jr(function t(e,r){var n=this,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return Promise.resolve(void 0)},s=arguments.length>3?arguments[3]:void 0;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this.executeRecaptcha=i,this.dfpProtectedAuth=s,this.sms={loginOrCreate:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h;return se().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=m.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,captcha_token:d,dfp_telemetry_id:u}),m.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 m.stop()}},c,this)}))},send:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p,m;return se().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=b.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,captcha_token:d,dfp_telemetry_id:u}),p=!!this._subscriptionService.getSession(),m=p?"/otps/sms/send/secondary":"/otps/sms/send/primary",b.abrupt("return",this._networkClient.retriableFetchSDK({url:m,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return b.stop()}},c,this)}))}},this.whatsapp={loginOrCreate:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h;return se().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=m.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,dfp_telemetry_id:u,captcha_token:d}),m.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 m.stop()}},c,this)}))},send:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p,m;return se().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 2:return f=b.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign(Object.assign({},l),{phone_number:a,captcha_token:d,dfp_telemetry_id:u}),p=!!this._subscriptionService.getSession(),m=p?"/otps/whatsapp/send/secondary":"/otps/whatsapp/send/primary",b.abrupt("return",this._networkClient.retriableFetchSDK({url:m,body:h,errorMessage:"Failed to send one time passcode",method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 9:case"end":return b.stop()}},c,this)}))}},this.email={loginOrCreate:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u;return se().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,this.executeRecaptcha();case 2:return f=h.sent,u=Object.assign(Object.assign({},l),{email:a,captcha_token:f}),h.abrupt("return",this._networkClient.fetchSDK({url:"/otps/email/login_or_create",body:u,errorMessage:"Failed to send one time passcode",method:"POST"}));case 5:case"end":return h.stop()}},c,this)}))},send:function(a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h;return se().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this.executeRecaptcha();case 2:return f=m.sent,u=Object.assign(Object.assign({},l),{email:a,captcha_token:f}),d=!!this._subscriptionService.getSession(),h=d?"/otps/email/send/secondary":"/otps/email/send/primary",m.abrupt("return",this._networkClient.fetchSDK({url:h,body:u,errorMessage:"Failed to send one time passcode",method:"POST"}));case 7:case"end":return m.stop()}},c,this)}))}},this.authenticate=function(o,a,l){return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p;return se().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return Zt("stytch.otps.authenticate").isString("Code",o).isNumber("session_duration_minutes",l.session_duration_minutes),x.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return f=x.sent,u=f.dfp_telemetry_id,d=f.captcha_token,h=Object.assign({token:o,method_id:a,dfp_telemetry_id:u,captcha_token:d},l),x.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=x.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}),x.abrupt("return",xr(p));case 12:case"end":return x.stop()}},c,this)}))}}),uie=function(){function t(e,r,n,i,s){Xr(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._dynamicConfig=i,this._config=s,this.google={start:this.startOAuthFlow(hr.Google)},this.apple={start:this.startOAuthFlow(hr.Apple)},this.microsoft={start:this.startOAuthFlow(hr.Microsoft)},this.github={start:this.startOAuthFlow(hr.Github)},this.gitlab={start:this.startOAuthFlow(hr.GitLab)},this.facebook={start:this.startOAuthFlow(hr.Facebook)},this.discord={start:this.startOAuthFlow(hr.Discord)},this.salesforce={start:this.startOAuthFlow(hr.Salesforce)},this.slack={start:this.startOAuthFlow(hr.Slack)},this.amazon={start:this.startOAuthFlow(hr.Amazon)},this.bitbucket={start:this.startOAuthFlow(hr.Bitbucket)},this.linkedin={start:this.startOAuthFlow(hr.LinkedIn)},this.coinbase={start:this.startOAuthFlow(hr.Coinbase)},this.twitch={start:this.startOAuthFlow(hr.Twitch)},this.twitter={start:this.startOAuthFlow(hr.Twitter)},this.tiktok={start:this.startOAuthFlow(hr.TikTok)},this.snapchat={start:this.startOAuthFlow(hr.Snapchat)},this.figma={start:this.startOAuthFlow(hr.Figma)},this.yahoo={start:this.startOAuthFlow(hr.Yahoo)}}return Jr(t,[{key:"authenticate",value:function(r,n){return Se(this,void 0,void 0,se().mark(function i(){var s,o;return se().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return Zt("stytch.oauth.authenticate").isString("Token",r).isNumber("session_duration_minutes",n.session_duration_minutes),l.next=3,this._pkceManager.getPKPair();case 3:return s=l.sent,s||ds.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.`),l.next=7,this._networkClient.fetchSDK({url:"/oauth/authenticate",method:"POST",body:Object.assign({token:r,code_verifier:s==null?void 0:s.code_verifier},n),errorMessage:"Failed to authenticate token"});case 7:return o=l.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:o.session,user:Yi(o.__user)},session_token:o.session_token,session_jwt:o.session_jwt,intermediate_session_token:null}),l.abrupt("return",gr(o));case 11:case"end":return l.stop()}},i,this)}))}},{key:"getBaseApiUrl",value:function(){return Se(this,void 0,void 0,se().mark(function r(){var n,i;return se().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this._dynamicConfig;case 2:if(n=o.sent,i=n.cnameDomain,!i){o.next=6;break}return o.abrupt("return","https://".concat(i));case 6:if(!s9(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 i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=i.login_redirect_url,o=i.signup_redirect_url,a=i.custom_scopes,l=i.provider_params;return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p,m,x;return se().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,this._dynamicConfig;case 2:return f=w.sent,u=f.cnameDomain,d=f.pkceRequiredForOAuth,w.next=7,this.getBaseApiUrl();case 7:if(h=w.sent,this._networkClient.logEvent({name:"start_oauth_flow",details:{provider_type:r,custom_scopes:a,cname_domain:u,pkce:d,provider_params:l}}),p=new URL("".concat(h,"/v1/public/oauth/").concat(r,"/start")),p.searchParams.set("public_token",this._config.publicToken),!d){w.next=18;break}return w.next=14,this._pkceManager.startPKCETransaction();case 14:m=w.sent,p.searchParams.set("code_challenge",m.code_challenge),w.next=19;break;case 18:this._pkceManager.clearPKPair();case 19:if(a&&(Zt("startOAuthFlow").isStringArray("custom_scopes",a),p.searchParams.set("custom_scopes",a.join(" "))),l){Zt("startOAuthFlow").isOptionalObject("provider_params",l);for(x in l)p.searchParams.set("provider_"+x,l[x])}s&&p.searchParams.set("login_redirect_url",s),o&&p.searchParams.set("signup_redirect_url",o),window.location.href=p.toString();case 24:case"end":return w.stop()}},c,this)}))}}}]),t}(),die=Promise.resolve({siweRequiredForCryptoWallets:!1}),hie=function(){function t(e,r,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)},s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:die;Xr(this,t),this._networkClient=e,this._apiNetworkClient=r,this._subscriptionService=n,this.executeRecaptcha=i,this.dfpProtectedAuth=s,this._config=o}return Jr(t,[{key:"authenticateStart",value:function(r){var n;return Se(this,void 0,void 0,se().mark(function i(){var s,o,a,l,c,f,u;return se().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return Zt("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address",r.crypto_wallet_address).isString("crypto_wallet_type",r.crypto_wallet_type),r.siwe_params&&Zt("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),s=!!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,l=a.siweRequiredForCryptoWallets,c={crypto_wallet_address:r.crypto_wallet_address,crypto_wallet_type:r.crypto_wallet_type},l&&r.crypto_wallet_type=="ethereum"&&(c.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})),f=s?"/crypto_wallets/authenticate/start/secondary":"/crypto_wallets/authenticate/start/primary",u=Object.assign(Object.assign({},c),{captcha_token:o}),h.abrupt("return",this._apiNetworkClient.fetchSDK({url:f,method:"POST",errorMessage:"Failed to start wallet authentication.",body:u}));case 15:case"end":return h.stop()}},i,this)}))}},{key:"authenticate",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("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),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:Yi(a.__user)},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),c.abrupt("return",gr(a));case 11:case"end":return c.stop()}},n,this)}))}}]),t}(),vie=function(){function t(e,r,n){Xr(this,t),this._networkClient=e,this._subscriptionService=r,this.dfpProtectedAuth=n}return Jr(t,[{key:"create",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i;return se().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return Zt("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 i=o.sent,this._subscriptionService.updateUser(i.__user),o.abrupt("return",gr(i));case 6:case"end":return o.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.totps.authenticate").isNumber("session_duration_minutes",r.session_duration_minutes).isString("totp_code",r.totp_code),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",gr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"recoveryCodes",value:function(){return Se(this,void 0,void 0,se().mark(function r(){return se().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",this._networkClient.fetchSDK({url:"/totps/recovery_codes",method:"POST",errorMessage:"Failed to retrieve recovery codes"}));case 1:case"end":return i.stop()}},r,this)}))}},{key:"recover",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.totps.recover").isNumber("session_duration_minutes",r.session_duration_minutes).isString("recovery_code",r.recovery_code),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",gr(a));case 11:case"end":return c.stop()}},n,this)}))}}]),t}();function o9(t){for(var e="==".slice(0,(4-t.length%4)%4),r=t.replace(/-/g,"+").replace(/_/g,"/")+e,n=atob(r),i=new ArrayBuffer(n.length),s=new Uint8Array(i),o=0;o with `"webauthn"` in its `autocomplete` attribute was detected'),!1):!0}}return Jr(t,[{key:"register",value:function(r){var n,i;return Se(this,void 0,void 0,se().mark(function s(){var o,a,l,c,f;return se().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return Zt("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:(i=r==null?void 0:r.authenticator_type)!==null&&i!==void 0?i: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,l=JSON.parse(a),d.next=8,wie({publicKey:l});case 8:return c=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(c),session_duration_minutes:r==null?void 0:r.session_duration_minutes}});case 11:return f=d.sent,this._subscriptionService.updateStateAndTokens({state:{session:f.session,user:f.__user},session_token:f.session_token,session_jwt:f.session_jwt,intermediate_session_token:null}),d.abrupt("return",gr(f));case 14:case"end":return d.stop()}},s,this)}))}},{key:"authenticate",value:function(r){var n,i;return Se(this,void 0,void 0,se().mark(function s(){var o,a,l,c,f,u,d,h,p,m,x,b;return se().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return Zt("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),E.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:if(o=E.sent,a=o.dfp_telemetry_id,l=o.captcha_token,!r.conditional_mediation){E.next=14;break}return E.next=9,this.browserSupportsAutofill();case 9:if(E.sent){E.next=12;break}return console.error("Browser does not support WebAuthn autofill"),E.abrupt("return",null);case 12:if(this.checkEligibleInputs()){E.next=14;break}return E.abrupt("return",null);case 14:return c=!!this._subscriptionService.getSession(),f=c?"/webauthn/authenticate/start/secondary":"/webauthn/authenticate/start/primary",E.next=18,this._networkClient.fetchSDK({url:f,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 u=E.sent,d=u.public_key_credential_request_options,h=new AbortController,p={publicKey:JSON.parse(d),signal:(i=r.signal)!==null&&i!==void 0?i:h.signal},m=Object.assign(Object.assign({},p),{mediation:"conditional"}),E.next=25,kie(r.conditional_mediation?m:p);case 25:return x=E.sent,E.next=28,this._networkClient.retriableFetchSDK({url:"/webauthn/authenticate",method:"POST",errorMessage:"Failed to authenticate WebAuthn device",body:{public_key_credential:JSON.stringify(x),session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:a,captcha_token:l},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 28:return b=E.sent,this._subscriptionService.updateStateAndTokens({state:{session:b.session,user:b.__user},session_token:b.session_token,session_jwt:b.session_jwt,intermediate_session_token:null}),E.abrupt("return",gr(b));case 31:case"end":return E.stop()}},s,this)}))}},{key:"update",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i;return se().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return i="/webauthn/update/"+r.webauthn_registration_id,o.next=3,this._networkClient.fetchSDK({url:i,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 Se(this,void 0,void 0,se().mark(function r(){var n;return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(n=window.PublicKeyCredential,!(n===void 0||n.isConditionalMediationAvailable===void 0)){s.next=3;break}return s.abrupt("return",new Promise(function(o){return o(!1)}));case 3:return s.abrupt("return",n.isConditionalMediationAvailable());case 4:case"end":return s.stop()}},r)}))}}]),t}(),Cie=Promise.resolve({pkceRequiredForPasswordResets:!1}),_ie=function(){function t(e,r,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Cie,s=arguments.length>4?arguments[4]:void 0;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._config=i,this.dfpProtectedAuth=s}return Jr(t,[{key:"getCodeChallenge",value:function(){return Se(this,void 0,void 0,se().mark(function r(){var n,i,s;return se().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this._config;case 2:if(n=a.sent,i=n.pkceRequiredForPasswordResets,i){a.next=6;break}return a.abrupt("return",void 0);case 6:return a.next=8,this._pkceManager.getPKPair();case 8:if(s=a.sent,!s){a.next=11;break}return a.abrupt("return",s.code_challenge);case 11:return a.next=13,this._pkceManager.startPKCETransaction();case 13:return s=a.sent,a.abrupt("return",s.code_challenge);case 15:case"end":return a.stop()}},r,this)}))}},{key:"create",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.passwords.create").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",gr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.passwords.authenticate").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",gr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"resetByEmailStart",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("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),c.next=3,this.getCodeChallenge();case 3:return i=c.sent,c.next=6,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 6:return s=c.sent,o=s.dfp_telemetry_id,a=s.captcha_token,c.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:i,captcha_token:a,dfp_telemetry_id:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 10:case"end":return c.stop()}},n,this)}))}},{key:"resetByEmail",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a,l,c;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return Zt("stytch.passwords.resetByEmail").isString("token",r.token).isString("password",r.password).isNumber("session_duration_minutes",r.session_duration_minutes),u.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=u.sent,s=i.dfp_telemetry_id,o=i.captcha_token,u.next=8,this._pkceManager.getPKPair();case 8:return a=u.sent,l=a==null?void 0:a.code_verifier,u.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:l,dfp_telemetry_id:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 12:return c=u.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:c.session,user:c.user},session_token:c.session_token,session_jwt:c.session_jwt,intermediate_session_token:null}),u.abrupt("return",gr(c));case 16:case"end":return u.stop()}},n,this)}))}},{key:"resetByExistingPassword",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("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),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",gr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"resetBySession",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.passwords.resetBySession").isString("password",r.password),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",a);case 11:case"end":return c.stop()}},n,this)}))}},{key:"strengthCheck",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return Zt("stytch.passwords.strengthCheck").isOptionalString("email",r.email).isString("password",r.password),s.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 s.stop()}},n,this)}))}}]),t}();Promise.resolve({pkceRequiredForEmailMagicLinks:!1});Promise.resolve({pkceRequiredForPasswordResets:!1});var Tie=function(){function t(e){Xr(this,t),this.iframeURL=e,this.createIframe()}return Jr(t,[{key:"createIframe",value:function(){var r=document.querySelector('[src~="'.concat(this.iframeURL,'"]'));if(r?ds.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 Se(this,void 0,void 0,se().mark(function i(){var s=this,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.frame;case 2:return o=c.sent,a=new MessageChannel,c.abrupt("return",new Promise(function(f,u){var d;a.port1.onmessage=function(p){var m=p.data;a.port1.close(),m.success?f(m.payload):u(rie.unmarshall(m.error))};var h={method:r,args:n};(d=o.contentWindow)===null||d===void 0||d.postMessage(h,s.iframeURL,[a.port2])}));case 5:case"end":return c.stop()}},i,this)}))}}]),t}(),Pie=function(){function t(e,r){Xr(this,t),this._networkClient=e,this.dfpProtectedAuth=r}return Jr(t,[{key:"searchUser",value:function(r){var n=this;return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function(i){var s=i.dfp_telemetry_id,o=i.captcha_token;return n._networkClient.fetchSDK({url:"/users/search",method:"POST",body:{email:r,dfp_telemetry_id:s,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}(),Rie=function(e){return!!(e!=null&&e.session)},u9=function(){function t(e,r){var n=this;Xr(this,t),this._subscriptionService=e,this._headlessSessionClient=r,this._onDataChange=function(i){Rie(i)?n.scheduleBackgroundRefresh():n.cancelBackgroundRefresh()},this._reauthenticateWithBackoff=function(){return Se(n,void 0,void 0,se().mark(function i(){var s;return se().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:s=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 s++,a.next=15,new Promise(function(l){return setTimeout(l,t.timeoutForAttempt(s))});case 15:a.next=1;break;case 17:case"end":return a.stop()}},i,this,[[2,8]])}))},this.timeout=null,this._subscriptionService.subscribeToState(this._onDataChange)}return Jr(t,[{key:"performBackgroundRefresh",value:function(){var r=this;this._reauthenticateWithBackoff().then(function(){r.scheduleBackgroundRefresh()}).catch(function(n){ds.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,i=2e3*Math.pow(2,r);return n+i}},{key:"isUnrecoverableError",value:function(r){return km.includes(r.error_type)}}]),t}();u9.REFRESH_INTERVAL_MS=1e3*60*3;var Iie=Jr(function t(e,r){var n=this;Xr(this,t),this._subscriptionService=e,this.emptyState=r,this.onStateChange=function(i){return n._subscriptionService.subscribeToState(function(s){i(s??n.emptyState)})}}),oC="bootstrap",xp=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}},Oie=function(){function t(e,r,n){var i=this;On(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(s){return i._dataLayer.setItem(oC,JSON.stringify(s)),s}).catch(function(s){return ds.error(s),xp()})}return Mn(t,[{key:"getSync",value:function(){var r=this._dataLayer.getItem(oC);if(r===null)return xp();try{return JSON.parse(r)}catch{return xp()}}},{key:"getAsync",value:function(){return this._bootstrapDataPromise}}],[{key:"mapBootstrapData",value:function(r){var n,i,s=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:s,runDFPProtectedAuth:(n=r.dfp_protected_auth_enabled)!==null&&n!==void 0?n:!1,dfpProtectedAuthMode:r.dfp_protected_auth_mode,rbacPolicy:(i=r.rbac_policy)!==null&&i!==void 0?i:null,siweRequiredForCryptoWallets:r.siwe_required_for_crypto_wallets}}}]),t}();function Di(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}var Mie=function(e){return Ew("https://www.google.com/recaptcha/enterprise.js?render=".concat(e),function(){return window.grecaptcha.enterprise})},Nie=Mn(function t(e){var r=this;On(this,t),this.bootstrapPromise=e,this.executeRecaptcha=function(){return Di(r,void 0,void 0,er().mark(function n(){var i,s,o,a;return er().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.state;case 2:if(i=c.sent,s=i.captchaClient,o=i.configured,a=i.siteKey,o){c.next=8;break}return c.abrupt("return",void 0);case 8:return c.next=10,new Promise(function(f){return s.ready(f)});case 10:return c.abrupt("return",s.execute(a,{action:"LOGIN"}));case 11:case"end":return c.stop()}},n,this)}))},this.state=e.then(function(n){return Di(r,void 0,void 0,er().mark(function i(){return er().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,Mie(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()}},i)}))})}),$ie=function(){function t(e){var r=this;On(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 Mn(t,[{key:"frameClient",get:function(){var r;return this._frameClient=(r=this._frameClient)!==null&&r!==void 0?r:new Tie(this.iframeURL),this._frameClient}},{key:"call",value:function(r,n){return this.frameClient.call(r,[n])}}]),t}(),Die=function(t){D1(e,t);function e(r,n,i,s,o,a){var l;return On(this,e),l=$1(this,e,[r,n,i,s,o]),l._oneTap=a,l.startOneTap=function(c){return Di(QT(l),void 0,void 0,er().mark(function f(){var u,d,h;return er().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this._oneTap.createOneTapClient();case 2:if(u=m.sent,u.success){m.next=5;break}throw new Error("One Tap could not load: ".concat(u.reason));case 5:return d=u.client,h=this._oneTap.createOnSuccessHandler({signupRedirectUrl:c.signup_redirect_url,loginRedirectUrl:c.login_redirect_url,onSuccess:this._oneTap.RedirectOnSuccess}),m.abrupt("return",d.render({style:{position:Aa.floating},onOneTapCancelled:c.onOneTapCancelled,callback:h}));case 8:case"end":return m.stop()}},f,this)}))},l.googleOneTap={start:l.startOneTap},l}return Mn(e)}(uie),Lie="4.18.1",d9=function(){function t(e,r,n,i){On(this,t),this._publicToken=e,this._subscriptionDataLayer=r,this.baseURL=n,this.additionalTelemetryDataFn=i,this.updateSessionToken=function(){return null},this.eventLogger=new sie({maxBatchSize:nie,intervalDurationMs:iie,logEventURL:this.buildSDKUrl("/events")})}return Mn(t,[{key:"logEvent",value:function(r){var n=r.name,i=r.details,s=r.error,o=s===void 0?{}:s;this.eventLogger.logEvent(this.createTelemetryBlob(),{public_token:this._publicToken,event_name:n,details:i,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:Jne(),app_session_id:Xne(),persistent_id:Zne(),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:Lie}})}},{key:"fetchSDK",value:function(r){var n=r.url,i=r.body,s=r.errorMessage,o=r.method;return Di(this,void 0,void 0,er().mark(function a(){var l,c,f,u;return er().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return l=this._subscriptionDataLayer.readSessionCookie().session_token,c="Basic "+window.btoa(this._publicToken+":"+(l||this._publicToken)),f=window.btoa(JSON.stringify(this.createTelemetryBlob())),u=window.location.origin,h.abrupt("return",Cm({basicAuthHeader:c,body:i,errorMessage:s,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:f,xSDKParentHostHeader:u}));case 5:case"end":return h.stop()}},a,this)}))}},{key:"retriableFetchSDK",value:function(r){var n=r.url,i=r.body,s=r.errorMessage,o=r.method,a=r.retryCallback;return Di(this,void 0,void 0,er().mark(function l(){var c,f,u,d;return er().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return c=this._subscriptionDataLayer.readSessionCookie().session_token,f="Basic "+window.btoa(this._publicToken+":"+(c||this._publicToken)),u=window.btoa(JSON.stringify(this.createTelemetryBlob())),d=window.location.origin,p.abrupt("return",Lne({basicAuthHeader:f,body:i,errorMessage:s,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:u,xSDKParentHostHeader:d,retryCallback:a}));case 5:case"end":return p.stop()}},l,this)}))}},{key:"buildSDKUrl",value:function(r){return"".concat(this.baseURL,"/sdk/v1").concat(r)}}]),t}(),jie=typeof window<"u"&&"IdentityCredential"in window,h9=function(e){return e===Aa.forceLegacyEmbedded?"force":e===Aa.embeddedOnly||e===Aa.embedded||e===Aa.floatingOrEmbedded},Fie=function(e){var r=h9(e);return r==="force"||r&&!jie},Bie=function(){function t(e,r){On(this,t),this._googleClient=e,this._clientId=r}return Mn(t,[{key:"cancel",value:function(){this._googleClient.cancel()}},{key:"render",value:function(r){var n=r.callback,i=r.onOneTapCancelled,s=r.style;return Di(this,void 0,void 0,er().mark(function o(){var a=this,l,c,f;return er().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return l=h9(s.position),c=Fie(s.position),f={client_id:this._clientId,callback:n,auto_select:!1,context:"use",itp_support:!0,use_fedcm_for_prompt:l!=="force"},c&&(f.prompt_parent_id="google-parent-prompt",f.cancel_on_tap_outside=!1),this._googleClient.initialize(f),d.abrupt("return",new Promise(function(h){a._googleClient.prompt(function(p){var m,x,b,w,E;if(p.isSkippedMoment()){var P=(x=(m=p.getSkippedReason)===null||m===void 0?void 0:m.call(p))!==null&&x!==void 0?x:"unknown_reason";return P==="user_cancel"&&(i==null||i()),h({success:!1,reason:P})}if(!p.isNotDisplayed&&c||!((b=p.isNotDisplayed)===null||b===void 0)&&b.call(p))return h({success:!1,reason:(E=(w=p.getNotDisplayedReason)===null||w===void 0?void 0:w.call(p))!==null&&E!==void 0?E:"unknown_reason"});if(!p.isDismissedMoment())return a.styleFrame(c),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(r9)&&(n.style.width="100%")})}}]),t}(),Uie=function(){return Ew(Dne,function(){return window.google.accounts.id})},zie=function(){function t(e,r){var n=this;On(this,t),this._publicToken=e,this.clientsideServices=r,this.createOnSuccessHandler=function(i){var s=i.loginRedirectUrl,o=i.signupRedirectUrl,a=i.onSuccess;return function(l){return Di(n,void 0,void 0,er().mark(function c(){var f,u,d;return er().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return f=l.credential,p.next=3,this.submitGoogleOneTapToken({credential:f,loginRedirectUrl:s,signupRedirectUrl:o});case 3:u=p.sent,d=u.redirect_url,a(d);case 6:case"end":return p.stop()}},c,this)}))}},this.RedirectOnSuccess=function(i){window.location.href=i}}return Mn(t,[{key:"createOneTapClient",value:function(){return Di(this,void 0,void 0,er().mark(function r(){var n,i,s,o;return er().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,l.next=3,this.fetchGoogleStart();case 3:i=l.sent,n=i.googleClientId,l.next=11;break;case 7:return l.prev=7,l.t0=l.catch(0),s=l.t0,l.abrupt("return",{success:!1,reason:s.error_type});case 11:if(n!==""){l.next=13;break}return l.abrupt("return",{success:!1,reason:"oauth_config_not_found"});case 13:return l.t1=Bie,l.next=16,Uie();case 16:return l.t2=l.sent,l.t3=n,o=new l.t1(l.t2,l.t3),l.abrupt("return",{success:!0,client:o});case 20:case"end":return l.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,i=r.loginRedirectUrl,s=r.signupRedirectUrl;return Di(this,void 0,void 0,er().mark(function o(){var a,l;return er().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,this.fetchGoogleStart();case 2:return a=f.sent,l=a.oauthCallbackId,f.abrupt("return",this.clientsideServices.oneTapSubmit({publicToken:this._publicToken,idToken:n,loginRedirectURL:i,oauthCallbackID:l,signupRedirectURL:s}));case 5:case"end":return f.stop()}},o,this)}))}}],[{key:"WillGoogleOneTapShowBannerForUA",value:function(r){var n=function(a,l){return a.indexOf(l)!==-1},i=n(r,"iPad")||n(r,"Android")&&!n(r,"Mobile")||n(r,"Silk"),s=n(r,"iPod")||n(r,"iPhone")||n(r,"Android")||n(r,"IEMobile");return!i&&s}},{key:"WillGoogleOneTapShowEmbedded",value:function(){return!t.WillGoogleOneTapShowBannerForUA(navigator.userAgent)}}]),t}(),Vie="PKCE_VERIFIER";function qie(t){var e=t.toString(16);return e.length===1&&(e="0"+e),e}function Hie(t){var e;return btoa((e=String.fromCharCode).call.apply(e,[null].concat(one(new Uint8Array(t))))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var bp=function(){function t(e,r){On(this,t),this._dataLayer=e,this.namespace=r}return Mn(t,[{key:"key",value:function(){return Vie+":"+this.namespace}},{key:"startPKCETransaction",value:function(){return Di(this,void 0,void 0,er().mark(function r(){var n;return er().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.createProofkeyPair();case 2:return n=s.sent,this._dataLayer.setItem(this.key(),JSON.stringify(n)),s.abrupt("return",n);case 5:case"end":return s.stop()}},r,this)}))}},{key:"getPKPair",value:function(){var r=this._dataLayer.getItem(this.key());if(r!==null)try{return JSON.parse(r)}catch{ds.warn("Found malformed Proof Key pair in localstorage.");return}}},{key:"clearPKPair",value:function(){return this._dataLayer.removeItem(this.key())}}],[{key:"createProofkeyPair",value:function(){return Di(this,void 0,void 0,er().mark(function r(){var n,i,s;return er().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return n=new Uint32Array(16),window.crypto.getRandomValues(n),i=Array.from(n).map(qie).join(""),a.next=5,window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(i));case 5:return s=a.sent,a.abrupt("return",{code_challenge:Hie(s),code_verifier:i});case 7:case"end":return a.stop()}},r)}))}}]),t}(),Wie=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.KEYS_TO_EXCLUDE,n=r===void 0?[]:r,i=function s(o,a){return $i(o)!==$i(a)?!1:o===null||a===null?o===a:$i(o)==="object"?Object.keys(o).length!==Object.keys(a).length||Object.keys(o).some(function(l){return!(l in a)})?!1:Object.entries(o).filter(function(l){var c=bm(l,1),f=c[0];return!n.includes(f)}).every(function(l){var c=bm(l,2),f=c[0],u=c[1];return s(u,a[f])}):o===a};return i},Gie=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}$/))},Kie=function(e){var r,n,i,s,o,a,l,c;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:Mne,testAPIURL:(s=(i=e==null?void 0:e.endpoints)===null||i===void 0?void 0:i.testAPIURL)!==null&&s!==void 0?s:Rne,liveAPIURL:(a=(o=e==null?void 0:e.endpoints)===null||o===void 0?void 0:o.liveAPIURL)!==null&&a!==void 0?a:Ine,dfpBackendURL:Qne(e),clientsideServicesIframeURL:(c=(l=e==null?void 0:e.endpoints)===null||l===void 0?void 0:l.clientsideServicesIframeURL)!==null&&c!==void 0?c:One}}},Ld=function(e){var r=document.cookie?document.cookie.split("; "):[],n=r.filter(function(i){var s=i.split("="),o=bm(s,1),a=o[0];return e===a});return n.length>1},Yie="stytch_sdk_state_",As=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"".concat(Yie).concat(e).concat(r?"::".concat(r):"")};/*! js-cookie v3.0.1 | MIT */function jd(t){for(var e=1;e"u")){o=jd({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var l in o)o[l]&&(a+="; "+l,o[l]!==!0&&(a+="="+o[l].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+a}}function n(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],o={},a=0;a1&&arguments[1]!==void 0?arguments[1]:!1,i=this._datalayer.state,s=r===null?null:Object.assign(Object.assign({},this._datalayer.state),r);this._datalayer.state=s;var o=this.getFromCache();this.setCacheRefreshed();var a=!lC(i,s);(o||a)&&(aC(this._datalayer.subscriptions,s),a&&!n&&this._datalayer.syncToLocalStorage())}},{key:"updateTokens",value:function(r){var n=r.session_token,i=r.session_jwt,s=this._datalayer.readSessionCookie(),o=Object.assign(Object.assign({},s),{session_token:n,session_jwt:i});n||i?(this._datalayer.writeSessionCookie(o),this._datalayer.removeISTCookie()):this._datalayer.removeSessionCookie()}},{key:"subscribeToState",value:function(r){return ise(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}(),ose=function(t){D1(e,t);function e(){var r;return On(this,e),r=$1(this,e,arguments),r.updateUser=function(n){return r.updateState({user:n})},r.getUser=function(){var n,i;return(i=(n=r.getState())===null||n===void 0?void 0:n.user)!==null&&i!==void 0?i:null},r.getSession=function(){var n,i;return(i=(n=r.getState())===null||n===void 0?void 0:n.session)!==null&&i!==void 0?i:null},r}return Mn(e)}(sse),ase=Symbol.for("stytch__internal_b2c"),lse=function(e,r){Object.assign(e,rne({},ase,r))},cse=function(t){D1(e,t);function e(r,n,i,s,o){On(this,e);var a=i;return s9(r)&&(a=s),$1(this,e,[r,n,a,o])}return Mn(e)}(d9),fse=Mn(function t(e,r){var n=this;On(this,t),Yne("StytchHeadlessClient"),Kne(e);var i=r,s=Kie(i);this._dataLayer=nse(e,i),this._subscriptionService=new ose(e,this._dataLayer),this._stateChangeClient=new Iie(this._subscriptionService,{}),this.onStateChange=function(){var p;return(p=n._stateChangeClient).onStateChange.apply(p,arguments)};var o=function(){var m,x,b,w;return{stytch_user_id:(x=(m=n._dataLayer.state)===null||m===void 0?void 0:m.user)===null||x===void 0?void 0:x.user_id,stytch_session_id:(w=(b=n._dataLayer.state)===null||b===void 0?void 0:b.session)===null||w===void 0?void 0:w.session_id}},a=new bp(this._dataLayer,"passwords");this._networkClient=new d9(e,this._dataLayer,s.endpoints.sdkBackendURL,o),this._apiNetworkClient=new cse(e,this._dataLayer,s.endpoints.liveAPIURL,s.endpoints.testAPIURL,o);var l=new Oie(e,this._networkClient,this._dataLayer),c=new Nie(l.getAsync()),f=new tie(e,s.endpoints.dfpBackendURL,l.getAsync(),c.executeRecaptcha),u=new $ie(s.endpoints.clientsideServicesIframeURL),d=new zie(e,u),h=new Pie(this._networkClient,f);this.user=new oie(this._networkClient,this._subscriptionService),this.session=new aie(this._networkClient,this._subscriptionService),this.magicLinks=new cie(this._networkClient,this._subscriptionService,new bp(this._dataLayer,"magic_links"),a,l.getAsync(),f),this.otps=new fie(this._networkClient,this._subscriptionService,c.executeRecaptcha,f),this.oauth=new Die(this._networkClient,this._subscriptionService,new bp(this._dataLayer,"oauth"),l.getAsync(),{publicToken:e,testAPIURL:s.endpoints.testAPIURL,liveAPIURL:s.endpoints.liveAPIURL},d),this.cryptoWallets=new hie(this._networkClient,this._apiNetworkClient,this._subscriptionService,c.executeRecaptcha,f,l.getAsync()),this.totps=new vie(this._networkClient,this._subscriptionService,f),this.webauthn=new Aie(this._networkClient,this._subscriptionService,f),this.passwords=new _ie(this._networkClient,this._subscriptionService,a,l.getAsync(),f),this._sessionManager=new u9(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}}),lse(this,{bootstrap:l,clientsideServices:u,captcha:c,oneTap:d,searchManager:h,publicToken:e,dataLayer:this._dataLayer,networkClient:this._networkClient})});const use="public-token-test-b10ed486-70f4-44d3-8696-662052833e88";function dse({children:t}){return $.jsx(Lre,{stytch:new fse(use),children:t})}const hse="970987756660-35a6tc48hvi8cev9cnknp0iugv9poa23.apps.googleusercontent.com",cC="970987756660-6ibakd38eibf3cg9rq42hri7o0jn5va8.apps.googleusercontent.com",vse="AQAAAAAAAEGv4rUgioUNUbcdNZlvOZE72JI",pse="eyJwcm9qZWN0SWQiOjE2ODE1LCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI2N2V2NXVvc3ZxMzVmcGI2OXI3NnJoYnVoIiwicnBjU2VydmVyIjoiaHR0cHM6Ly93YWFzLnNlcXVlbmNlLmFwcCJ9",fC="AQAAAAAAAAK2JvvZhWqZ51riasWBftkrVXE",uC="eyJwcm9qZWN0SWQiOjY5NCwicnBjU2VydmVyIjoiaHR0cHM6Ly9kZXYtd2Fhcy5zZXF1ZW5jZS5hcHAiLCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI1NGF0bjV1cGk2M3FjNTlhMWVtM3ZiaHJzbiJ9";new __("https://nodes.sequence.app/polygon");const L1=new URLSearchParams(window.location.search),yse=L1.get("env")??"prod";let y9=L1.get("projectAccessKey")??vse,m9=L1.get("waasConfigKey")??pse,g9=L1.get("googleClientId")??hse;yse==="dev"&&(console.log("Using dev environment"),console.log(`Project Access Key: ${fC}`),console.log(`Waas Config Key: ${uC}`),console.log(`Google Client ID: ${cC}`),y9=fC,m9=uC,g9=cC);const Re=new Sre({network:"polygon",projectAccessKey:y9,waasConfigKey:m9}),Ri=xV([{path:"/login",element:$.jsx(Ure,{})},{path:"/",element:$.jsx(tne,{})}]);Sp.createRoot(document.getElementById("root")).render($.jsx(vr.StrictMode,{children:$.jsx(RF,{children:$.jsx(YU,{children:$.jsx(OV,{clientId:g9,children:$.jsx(dse,{children:$.jsx(TV,{router:Ri})})})})})})); +See https://stytch.com/docs/oauth#guides_pkce for more information.`),l.next=7,this._networkClient.fetchSDK({url:"/oauth/authenticate",method:"POST",body:Object.assign({token:r,code_verifier:s==null?void 0:s.code_verifier},n),errorMessage:"Failed to authenticate token"});case 7:return o=l.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:o.session,user:Yi(o.__user)},session_token:o.session_token,session_jwt:o.session_jwt,intermediate_session_token:null}),l.abrupt("return",xr(o));case 11:case"end":return l.stop()}},i,this)}))}},{key:"getBaseApiUrl",value:function(){return Se(this,void 0,void 0,se().mark(function r(){var n,i;return se().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,this._dynamicConfig;case 2:if(n=o.sent,i=n.cnameDomain,!i){o.next=6;break}return o.abrupt("return","https://".concat(i));case 6:if(!s9(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 i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=i.login_redirect_url,o=i.signup_redirect_url,a=i.custom_scopes,l=i.provider_params;return Se(n,void 0,void 0,se().mark(function c(){var f,u,d,h,p,m,x;return se().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,this._dynamicConfig;case 2:return f=w.sent,u=f.cnameDomain,d=f.pkceRequiredForOAuth,w.next=7,this.getBaseApiUrl();case 7:if(h=w.sent,this._networkClient.logEvent({name:"start_oauth_flow",details:{provider_type:r,custom_scopes:a,cname_domain:u,pkce:d,provider_params:l}}),p=new URL("".concat(h,"/v1/public/oauth/").concat(r,"/start")),p.searchParams.set("public_token",this._config.publicToken),!d){w.next=18;break}return w.next=14,this._pkceManager.startPKCETransaction();case 14:m=w.sent,p.searchParams.set("code_challenge",m.code_challenge),w.next=19;break;case 18:this._pkceManager.clearPKPair();case 19:if(a&&(Zt("startOAuthFlow").isStringArray("custom_scopes",a),p.searchParams.set("custom_scopes",a.join(" "))),l){Zt("startOAuthFlow").isOptionalObject("provider_params",l);for(x in l)p.searchParams.set("provider_"+x,l[x])}s&&p.searchParams.set("login_redirect_url",s),o&&p.searchParams.set("signup_redirect_url",o),window.location.href=p.toString();case 24:case"end":return w.stop()}},c,this)}))}}}]),t}(),die=Promise.resolve({siweRequiredForCryptoWallets:!1}),hie=function(){function t(e,r,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return Promise.resolve(void 0)},s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:die;Xr(this,t),this._networkClient=e,this._apiNetworkClient=r,this._subscriptionService=n,this.executeRecaptcha=i,this.dfpProtectedAuth=s,this._config=o}return Jr(t,[{key:"authenticateStart",value:function(r){var n;return Se(this,void 0,void 0,se().mark(function i(){var s,o,a,l,c,f,u;return se().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return Zt("stytch.cryptoWallets.authenticateStart").isString("crypto_wallet_address",r.crypto_wallet_address).isString("crypto_wallet_type",r.crypto_wallet_type),r.siwe_params&&Zt("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),s=!!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,l=a.siweRequiredForCryptoWallets,c={crypto_wallet_address:r.crypto_wallet_address,crypto_wallet_type:r.crypto_wallet_type},l&&r.crypto_wallet_type=="ethereum"&&(c.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})),f=s?"/crypto_wallets/authenticate/start/secondary":"/crypto_wallets/authenticate/start/primary",u=Object.assign(Object.assign({},c),{captcha_token:o}),h.abrupt("return",this._apiNetworkClient.fetchSDK({url:f,method:"POST",errorMessage:"Failed to start wallet authentication.",body:u}));case 15:case"end":return h.stop()}},i,this)}))}},{key:"authenticate",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("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),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.sent,this._subscriptionService.updateStateAndTokens({state:{session:a.session,user:Yi(a.__user)},session_token:a.session_token,session_jwt:a.session_jwt,intermediate_session_token:null}),c.abrupt("return",xr(a));case 11:case"end":return c.stop()}},n,this)}))}}]),t}(),vie=function(){function t(e,r,n){Xr(this,t),this._networkClient=e,this._subscriptionService=r,this.dfpProtectedAuth=n}return Jr(t,[{key:"create",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i;return se().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return Zt("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 i=o.sent,this._subscriptionService.updateUser(i.__user),o.abrupt("return",xr(i));case 6:case"end":return o.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.totps.authenticate").isNumber("session_duration_minutes",r.session_duration_minutes).isString("totp_code",r.totp_code),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",xr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"recoveryCodes",value:function(){return Se(this,void 0,void 0,se().mark(function r(){return se().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",this._networkClient.fetchSDK({url:"/totps/recovery_codes",method:"POST",errorMessage:"Failed to retrieve recovery codes"}));case 1:case"end":return i.stop()}},r,this)}))}},{key:"recover",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.totps.recover").isNumber("session_duration_minutes",r.session_duration_minutes).isString("recovery_code",r.recovery_code),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",xr(a));case 11:case"end":return c.stop()}},n,this)}))}}]),t}();function o9(t){for(var e="==".slice(0,(4-t.length%4)%4),r=t.replace(/-/g,"+").replace(/_/g,"/")+e,n=atob(r),i=new ArrayBuffer(n.length),s=new Uint8Array(i),o=0;o with `"webauthn"` in its `autocomplete` attribute was detected'),!1):!0}}return Jr(t,[{key:"register",value:function(r){var n,i;return Se(this,void 0,void 0,se().mark(function s(){var o,a,l,c,f;return se().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return Zt("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:(i=r==null?void 0:r.authenticator_type)!==null&&i!==void 0?i: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,l=JSON.parse(a),d.next=8,wie({publicKey:l});case 8:return c=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(c),session_duration_minutes:r==null?void 0:r.session_duration_minutes}});case 11:return f=d.sent,this._subscriptionService.updateStateAndTokens({state:{session:f.session,user:f.__user},session_token:f.session_token,session_jwt:f.session_jwt,intermediate_session_token:null}),d.abrupt("return",xr(f));case 14:case"end":return d.stop()}},s,this)}))}},{key:"authenticate",value:function(r){var n,i;return Se(this,void 0,void 0,se().mark(function s(){var o,a,l,c,f,u,d,h,p,m,x,b;return se().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return Zt("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),E.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:if(o=E.sent,a=o.dfp_telemetry_id,l=o.captcha_token,!r.conditional_mediation){E.next=14;break}return E.next=9,this.browserSupportsAutofill();case 9:if(E.sent){E.next=12;break}return console.error("Browser does not support WebAuthn autofill"),E.abrupt("return",null);case 12:if(this.checkEligibleInputs()){E.next=14;break}return E.abrupt("return",null);case 14:return c=!!this._subscriptionService.getSession(),f=c?"/webauthn/authenticate/start/secondary":"/webauthn/authenticate/start/primary",E.next=18,this._networkClient.fetchSDK({url:f,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 u=E.sent,d=u.public_key_credential_request_options,h=new AbortController,p={publicKey:JSON.parse(d),signal:(i=r.signal)!==null&&i!==void 0?i:h.signal},m=Object.assign(Object.assign({},p),{mediation:"conditional"}),E.next=25,kie(r.conditional_mediation?m:p);case 25:return x=E.sent,E.next=28,this._networkClient.retriableFetchSDK({url:"/webauthn/authenticate",method:"POST",errorMessage:"Failed to authenticate WebAuthn device",body:{public_key_credential:JSON.stringify(x),session_duration_minutes:r.session_duration_minutes,dfp_telemetry_id:a,captcha_token:l},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 28:return b=E.sent,this._subscriptionService.updateStateAndTokens({state:{session:b.session,user:b.__user},session_token:b.session_token,session_jwt:b.session_jwt,intermediate_session_token:null}),E.abrupt("return",xr(b));case 31:case"end":return E.stop()}},s,this)}))}},{key:"update",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i;return se().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return i="/webauthn/update/"+r.webauthn_registration_id,o.next=3,this._networkClient.fetchSDK({url:i,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 Se(this,void 0,void 0,se().mark(function r(){var n;return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(n=window.PublicKeyCredential,!(n===void 0||n.isConditionalMediationAvailable===void 0)){s.next=3;break}return s.abrupt("return",new Promise(function(o){return o(!1)}));case 3:return s.abrupt("return",n.isConditionalMediationAvailable());case 4:case"end":return s.stop()}},r)}))}}]),t}(),Cie=Promise.resolve({pkceRequiredForPasswordResets:!1}),_ie=function(){function t(e,r,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Cie,s=arguments.length>4?arguments[4]:void 0;Xr(this,t),this._networkClient=e,this._subscriptionService=r,this._pkceManager=n,this._config=i,this.dfpProtectedAuth=s}return Jr(t,[{key:"getCodeChallenge",value:function(){return Se(this,void 0,void 0,se().mark(function r(){var n,i,s;return se().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this._config;case 2:if(n=a.sent,i=n.pkceRequiredForPasswordResets,i){a.next=6;break}return a.abrupt("return",void 0);case 6:return a.next=8,this._pkceManager.getPKPair();case 8:if(s=a.sent,!s){a.next=11;break}return a.abrupt("return",s.code_challenge);case 11:return a.next=13,this._pkceManager.startPKCETransaction();case 13:return s=a.sent,a.abrupt("return",s.code_challenge);case 15:case"end":return a.stop()}},r,this)}))}},{key:"create",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.passwords.create").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",xr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"authenticate",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.passwords.authenticate").isString("password",r.password).isString("email",r.email).isNumber("session_duration_minutes",r.session_duration_minutes),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",xr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"resetByEmailStart",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("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),c.next=3,this.getCodeChallenge();case 3:return i=c.sent,c.next=6,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 6:return s=c.sent,o=s.dfp_telemetry_id,a=s.captcha_token,c.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:i,captcha_token:a,dfp_telemetry_id:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP}));case 10:case"end":return c.stop()}},n,this)}))}},{key:"resetByEmail",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a,l,c;return se().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return Zt("stytch.passwords.resetByEmail").isString("token",r.token).isString("password",r.password).isNumber("session_duration_minutes",r.session_duration_minutes),u.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=u.sent,s=i.dfp_telemetry_id,o=i.captcha_token,u.next=8,this._pkceManager.getPKPair();case 8:return a=u.sent,l=a==null?void 0:a.code_verifier,u.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:l,dfp_telemetry_id:s},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 12:return c=u.sent,this._pkceManager.clearPKPair(),this._subscriptionService.updateStateAndTokens({state:{session:c.session,user:c.user},session_token:c.session_token,session_jwt:c.session_jwt,intermediate_session_token:null}),u.abrupt("return",xr(c));case 16:case"end":return u.stop()}},n,this)}))}},{key:"resetByExistingPassword",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("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),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",xr(a));case 11:case"end":return c.stop()}},n,this)}))}},{key:"resetBySession",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){var i,s,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return Zt("stytch.passwords.resetBySession").isString("password",r.password),c.next=3,this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();case 3:return i=c.sent,s=i.dfp_telemetry_id,o=i.captcha_token,c.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:s,captcha_token:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});case 8:return a=c.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}),c.abrupt("return",a);case 11:case"end":return c.stop()}},n,this)}))}},{key:"strengthCheck",value:function(r){return Se(this,void 0,void 0,se().mark(function n(){return se().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return Zt("stytch.passwords.strengthCheck").isOptionalString("email",r.email).isString("password",r.password),s.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 s.stop()}},n,this)}))}}]),t}();Promise.resolve({pkceRequiredForEmailMagicLinks:!1});Promise.resolve({pkceRequiredForPasswordResets:!1});var Tie=function(){function t(e){Xr(this,t),this.iframeURL=e,this.createIframe()}return Jr(t,[{key:"createIframe",value:function(){var r=document.querySelector('[src~="'.concat(this.iframeURL,'"]'));if(r?ds.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 Se(this,void 0,void 0,se().mark(function i(){var s=this,o,a;return se().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.frame;case 2:return o=c.sent,a=new MessageChannel,c.abrupt("return",new Promise(function(f,u){var d;a.port1.onmessage=function(p){var m=p.data;a.port1.close(),m.success?f(m.payload):u(rie.unmarshall(m.error))};var h={method:r,args:n};(d=o.contentWindow)===null||d===void 0||d.postMessage(h,s.iframeURL,[a.port2])}));case 5:case"end":return c.stop()}},i,this)}))}}]),t}(),Pie=function(){function t(e,r){Xr(this,t),this._networkClient=e,this.dfpProtectedAuth=r}return Jr(t,[{key:"searchUser",value:function(r){var n=this;return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function(i){var s=i.dfp_telemetry_id,o=i.captcha_token;return n._networkClient.fetchSDK({url:"/users/search",method:"POST",body:{email:r,dfp_telemetry_id:s,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}(),Rie=function(e){return!!(e!=null&&e.session)},u9=function(){function t(e,r){var n=this;Xr(this,t),this._subscriptionService=e,this._headlessSessionClient=r,this._onDataChange=function(i){Rie(i)?n.scheduleBackgroundRefresh():n.cancelBackgroundRefresh()},this._reauthenticateWithBackoff=function(){return Se(n,void 0,void 0,se().mark(function i(){var s;return se().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:s=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 s++,a.next=15,new Promise(function(l){return setTimeout(l,t.timeoutForAttempt(s))});case 15:a.next=1;break;case 17:case"end":return a.stop()}},i,this,[[2,8]])}))},this.timeout=null,this._subscriptionService.subscribeToState(this._onDataChange)}return Jr(t,[{key:"performBackgroundRefresh",value:function(){var r=this;this._reauthenticateWithBackoff().then(function(){r.scheduleBackgroundRefresh()}).catch(function(n){ds.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,i=2e3*Math.pow(2,r);return n+i}},{key:"isUnrecoverableError",value:function(r){return km.includes(r.error_type)}}]),t}();u9.REFRESH_INTERVAL_MS=1e3*60*3;var Iie=Jr(function t(e,r){var n=this;Xr(this,t),this._subscriptionService=e,this.emptyState=r,this.onStateChange=function(i){return n._subscriptionService.subscribeToState(function(s){i(s??n.emptyState)})}}),oC="bootstrap",xp=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}},Oie=function(){function t(e,r,n){var i=this;On(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(s){return i._dataLayer.setItem(oC,JSON.stringify(s)),s}).catch(function(s){return ds.error(s),xp()})}return Mn(t,[{key:"getSync",value:function(){var r=this._dataLayer.getItem(oC);if(r===null)return xp();try{return JSON.parse(r)}catch{return xp()}}},{key:"getAsync",value:function(){return this._bootstrapDataPromise}}],[{key:"mapBootstrapData",value:function(r){var n,i,s=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:s,runDFPProtectedAuth:(n=r.dfp_protected_auth_enabled)!==null&&n!==void 0?n:!1,dfpProtectedAuthMode:r.dfp_protected_auth_mode,rbacPolicy:(i=r.rbac_policy)!==null&&i!==void 0?i:null,siweRequiredForCryptoWallets:r.siwe_required_for_crypto_wallets}}}]),t}();function Di(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(u){o(u)}}function l(f){try{c(n.throw(f))}catch(u){o(u)}}function c(f){f.done?s(f.value):i(f.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}var Mie=function(e){return Ew("https://www.google.com/recaptcha/enterprise.js?render=".concat(e),function(){return window.grecaptcha.enterprise})},Nie=Mn(function t(e){var r=this;On(this,t),this.bootstrapPromise=e,this.executeRecaptcha=function(){return Di(r,void 0,void 0,er().mark(function n(){var i,s,o,a;return er().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,this.state;case 2:if(i=c.sent,s=i.captchaClient,o=i.configured,a=i.siteKey,o){c.next=8;break}return c.abrupt("return",void 0);case 8:return c.next=10,new Promise(function(f){return s.ready(f)});case 10:return c.abrupt("return",s.execute(a,{action:"LOGIN"}));case 11:case"end":return c.stop()}},n,this)}))},this.state=e.then(function(n){return Di(r,void 0,void 0,er().mark(function i(){return er().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,Mie(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()}},i)}))})}),$ie=function(){function t(e){var r=this;On(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 Mn(t,[{key:"frameClient",get:function(){var r;return this._frameClient=(r=this._frameClient)!==null&&r!==void 0?r:new Tie(this.iframeURL),this._frameClient}},{key:"call",value:function(r,n){return this.frameClient.call(r,[n])}}]),t}(),Die=function(t){D1(e,t);function e(r,n,i,s,o,a){var l;return On(this,e),l=$1(this,e,[r,n,i,s,o]),l._oneTap=a,l.startOneTap=function(c){return Di(QT(l),void 0,void 0,er().mark(function f(){var u,d,h;return er().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,this._oneTap.createOneTapClient();case 2:if(u=m.sent,u.success){m.next=5;break}throw new Error("One Tap could not load: ".concat(u.reason));case 5:return d=u.client,h=this._oneTap.createOnSuccessHandler({signupRedirectUrl:c.signup_redirect_url,loginRedirectUrl:c.login_redirect_url,onSuccess:this._oneTap.RedirectOnSuccess}),m.abrupt("return",d.render({style:{position:Aa.floating},onOneTapCancelled:c.onOneTapCancelled,callback:h}));case 8:case"end":return m.stop()}},f,this)}))},l.googleOneTap={start:l.startOneTap},l}return Mn(e)}(uie),Lie="4.18.1",d9=function(){function t(e,r,n,i){On(this,t),this._publicToken=e,this._subscriptionDataLayer=r,this.baseURL=n,this.additionalTelemetryDataFn=i,this.updateSessionToken=function(){return null},this.eventLogger=new sie({maxBatchSize:nie,intervalDurationMs:iie,logEventURL:this.buildSDKUrl("/events")})}return Mn(t,[{key:"logEvent",value:function(r){var n=r.name,i=r.details,s=r.error,o=s===void 0?{}:s;this.eventLogger.logEvent(this.createTelemetryBlob(),{public_token:this._publicToken,event_name:n,details:i,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:Jne(),app_session_id:Xne(),persistent_id:Zne(),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:Lie}})}},{key:"fetchSDK",value:function(r){var n=r.url,i=r.body,s=r.errorMessage,o=r.method;return Di(this,void 0,void 0,er().mark(function a(){var l,c,f,u;return er().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return l=this._subscriptionDataLayer.readSessionCookie().session_token,c="Basic "+window.btoa(this._publicToken+":"+(l||this._publicToken)),f=window.btoa(JSON.stringify(this.createTelemetryBlob())),u=window.location.origin,h.abrupt("return",Cm({basicAuthHeader:c,body:i,errorMessage:s,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:f,xSDKParentHostHeader:u}));case 5:case"end":return h.stop()}},a,this)}))}},{key:"retriableFetchSDK",value:function(r){var n=r.url,i=r.body,s=r.errorMessage,o=r.method,a=r.retryCallback;return Di(this,void 0,void 0,er().mark(function l(){var c,f,u,d;return er().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return c=this._subscriptionDataLayer.readSessionCookie().session_token,f="Basic "+window.btoa(this._publicToken+":"+(c||this._publicToken)),u=window.btoa(JSON.stringify(this.createTelemetryBlob())),d=window.location.origin,p.abrupt("return",Lne({basicAuthHeader:f,body:i,errorMessage:s,finalURL:this.buildSDKUrl(n),method:o,xSDKClientHeader:u,xSDKParentHostHeader:d,retryCallback:a}));case 5:case"end":return p.stop()}},l,this)}))}},{key:"buildSDKUrl",value:function(r){return"".concat(this.baseURL,"/sdk/v1").concat(r)}}]),t}(),jie=typeof window<"u"&&"IdentityCredential"in window,h9=function(e){return e===Aa.forceLegacyEmbedded?"force":e===Aa.embeddedOnly||e===Aa.embedded||e===Aa.floatingOrEmbedded},Fie=function(e){var r=h9(e);return r==="force"||r&&!jie},Bie=function(){function t(e,r){On(this,t),this._googleClient=e,this._clientId=r}return Mn(t,[{key:"cancel",value:function(){this._googleClient.cancel()}},{key:"render",value:function(r){var n=r.callback,i=r.onOneTapCancelled,s=r.style;return Di(this,void 0,void 0,er().mark(function o(){var a=this,l,c,f;return er().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return l=h9(s.position),c=Fie(s.position),f={client_id:this._clientId,callback:n,auto_select:!1,context:"use",itp_support:!0,use_fedcm_for_prompt:l!=="force"},c&&(f.prompt_parent_id="google-parent-prompt",f.cancel_on_tap_outside=!1),this._googleClient.initialize(f),d.abrupt("return",new Promise(function(h){a._googleClient.prompt(function(p){var m,x,b,w,E;if(p.isSkippedMoment()){var P=(x=(m=p.getSkippedReason)===null||m===void 0?void 0:m.call(p))!==null&&x!==void 0?x:"unknown_reason";return P==="user_cancel"&&(i==null||i()),h({success:!1,reason:P})}if(!p.isNotDisplayed&&c||!((b=p.isNotDisplayed)===null||b===void 0)&&b.call(p))return h({success:!1,reason:(E=(w=p.getNotDisplayedReason)===null||w===void 0?void 0:w.call(p))!==null&&E!==void 0?E:"unknown_reason"});if(!p.isDismissedMoment())return a.styleFrame(c),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(r9)&&(n.style.width="100%")})}}]),t}(),Uie=function(){return Ew(Dne,function(){return window.google.accounts.id})},zie=function(){function t(e,r){var n=this;On(this,t),this._publicToken=e,this.clientsideServices=r,this.createOnSuccessHandler=function(i){var s=i.loginRedirectUrl,o=i.signupRedirectUrl,a=i.onSuccess;return function(l){return Di(n,void 0,void 0,er().mark(function c(){var f,u,d;return er().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return f=l.credential,p.next=3,this.submitGoogleOneTapToken({credential:f,loginRedirectUrl:s,signupRedirectUrl:o});case 3:u=p.sent,d=u.redirect_url,a(d);case 6:case"end":return p.stop()}},c,this)}))}},this.RedirectOnSuccess=function(i){window.location.href=i}}return Mn(t,[{key:"createOneTapClient",value:function(){return Di(this,void 0,void 0,er().mark(function r(){var n,i,s,o;return er().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,l.next=3,this.fetchGoogleStart();case 3:i=l.sent,n=i.googleClientId,l.next=11;break;case 7:return l.prev=7,l.t0=l.catch(0),s=l.t0,l.abrupt("return",{success:!1,reason:s.error_type});case 11:if(n!==""){l.next=13;break}return l.abrupt("return",{success:!1,reason:"oauth_config_not_found"});case 13:return l.t1=Bie,l.next=16,Uie();case 16:return l.t2=l.sent,l.t3=n,o=new l.t1(l.t2,l.t3),l.abrupt("return",{success:!0,client:o});case 20:case"end":return l.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,i=r.loginRedirectUrl,s=r.signupRedirectUrl;return Di(this,void 0,void 0,er().mark(function o(){var a,l;return er().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,this.fetchGoogleStart();case 2:return a=f.sent,l=a.oauthCallbackId,f.abrupt("return",this.clientsideServices.oneTapSubmit({publicToken:this._publicToken,idToken:n,loginRedirectURL:i,oauthCallbackID:l,signupRedirectURL:s}));case 5:case"end":return f.stop()}},o,this)}))}}],[{key:"WillGoogleOneTapShowBannerForUA",value:function(r){var n=function(a,l){return a.indexOf(l)!==-1},i=n(r,"iPad")||n(r,"Android")&&!n(r,"Mobile")||n(r,"Silk"),s=n(r,"iPod")||n(r,"iPhone")||n(r,"Android")||n(r,"IEMobile");return!i&&s}},{key:"WillGoogleOneTapShowEmbedded",value:function(){return!t.WillGoogleOneTapShowBannerForUA(navigator.userAgent)}}]),t}(),Vie="PKCE_VERIFIER";function qie(t){var e=t.toString(16);return e.length===1&&(e="0"+e),e}function Hie(t){var e;return btoa((e=String.fromCharCode).call.apply(e,[null].concat(one(new Uint8Array(t))))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var bp=function(){function t(e,r){On(this,t),this._dataLayer=e,this.namespace=r}return Mn(t,[{key:"key",value:function(){return Vie+":"+this.namespace}},{key:"startPKCETransaction",value:function(){return Di(this,void 0,void 0,er().mark(function r(){var n;return er().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.createProofkeyPair();case 2:return n=s.sent,this._dataLayer.setItem(this.key(),JSON.stringify(n)),s.abrupt("return",n);case 5:case"end":return s.stop()}},r,this)}))}},{key:"getPKPair",value:function(){var r=this._dataLayer.getItem(this.key());if(r!==null)try{return JSON.parse(r)}catch{ds.warn("Found malformed Proof Key pair in localstorage.");return}}},{key:"clearPKPair",value:function(){return this._dataLayer.removeItem(this.key())}}],[{key:"createProofkeyPair",value:function(){return Di(this,void 0,void 0,er().mark(function r(){var n,i,s;return er().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return n=new Uint32Array(16),window.crypto.getRandomValues(n),i=Array.from(n).map(qie).join(""),a.next=5,window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(i));case 5:return s=a.sent,a.abrupt("return",{code_challenge:Hie(s),code_verifier:i});case 7:case"end":return a.stop()}},r)}))}}]),t}(),Wie=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.KEYS_TO_EXCLUDE,n=r===void 0?[]:r,i=function s(o,a){return $i(o)!==$i(a)?!1:o===null||a===null?o===a:$i(o)==="object"?Object.keys(o).length!==Object.keys(a).length||Object.keys(o).some(function(l){return!(l in a)})?!1:Object.entries(o).filter(function(l){var c=bm(l,1),f=c[0];return!n.includes(f)}).every(function(l){var c=bm(l,2),f=c[0],u=c[1];return s(u,a[f])}):o===a};return i},Gie=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}$/))},Kie=function(e){var r,n,i,s,o,a,l,c;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:Mne,testAPIURL:(s=(i=e==null?void 0:e.endpoints)===null||i===void 0?void 0:i.testAPIURL)!==null&&s!==void 0?s:Rne,liveAPIURL:(a=(o=e==null?void 0:e.endpoints)===null||o===void 0?void 0:o.liveAPIURL)!==null&&a!==void 0?a:Ine,dfpBackendURL:Qne(e),clientsideServicesIframeURL:(c=(l=e==null?void 0:e.endpoints)===null||l===void 0?void 0:l.clientsideServicesIframeURL)!==null&&c!==void 0?c:One}}},Ld=function(e){var r=document.cookie?document.cookie.split("; "):[],n=r.filter(function(i){var s=i.split("="),o=bm(s,1),a=o[0];return e===a});return n.length>1},Yie="stytch_sdk_state_",As=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"".concat(Yie).concat(e).concat(r?"::".concat(r):"")};/*! js-cookie v3.0.1 | MIT */function jd(t){for(var e=1;e"u")){o=jd({},e,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var l in o)o[l]&&(a+="; "+l,o[l]!==!0&&(a+="="+o[l].split(";")[0]));return document.cookie=i+"="+t.write(s,i)+a}}function n(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var s=document.cookie?document.cookie.split("; "):[],o={},a=0;a1&&arguments[1]!==void 0?arguments[1]:!1,i=this._datalayer.state,s=r===null?null:Object.assign(Object.assign({},this._datalayer.state),r);this._datalayer.state=s;var o=this.getFromCache();this.setCacheRefreshed();var a=!lC(i,s);(o||a)&&(aC(this._datalayer.subscriptions,s),a&&!n&&this._datalayer.syncToLocalStorage())}},{key:"updateTokens",value:function(r){var n=r.session_token,i=r.session_jwt,s=this._datalayer.readSessionCookie(),o=Object.assign(Object.assign({},s),{session_token:n,session_jwt:i});n||i?(this._datalayer.writeSessionCookie(o),this._datalayer.removeISTCookie()):this._datalayer.removeSessionCookie()}},{key:"subscribeToState",value:function(r){return ise(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}(),ose=function(t){D1(e,t);function e(){var r;return On(this,e),r=$1(this,e,arguments),r.updateUser=function(n){return r.updateState({user:n})},r.getUser=function(){var n,i;return(i=(n=r.getState())===null||n===void 0?void 0:n.user)!==null&&i!==void 0?i:null},r.getSession=function(){var n,i;return(i=(n=r.getState())===null||n===void 0?void 0:n.session)!==null&&i!==void 0?i:null},r}return Mn(e)}(sse),ase=Symbol.for("stytch__internal_b2c"),lse=function(e,r){Object.assign(e,rne({},ase,r))},cse=function(t){D1(e,t);function e(r,n,i,s,o){On(this,e);var a=i;return s9(r)&&(a=s),$1(this,e,[r,n,a,o])}return Mn(e)}(d9),fse=Mn(function t(e,r){var n=this;On(this,t),Yne("StytchHeadlessClient"),Kne(e);var i=r,s=Kie(i);this._dataLayer=nse(e,i),this._subscriptionService=new ose(e,this._dataLayer),this._stateChangeClient=new Iie(this._subscriptionService,{}),this.onStateChange=function(){var p;return(p=n._stateChangeClient).onStateChange.apply(p,arguments)};var o=function(){var m,x,b,w;return{stytch_user_id:(x=(m=n._dataLayer.state)===null||m===void 0?void 0:m.user)===null||x===void 0?void 0:x.user_id,stytch_session_id:(w=(b=n._dataLayer.state)===null||b===void 0?void 0:b.session)===null||w===void 0?void 0:w.session_id}},a=new bp(this._dataLayer,"passwords");this._networkClient=new d9(e,this._dataLayer,s.endpoints.sdkBackendURL,o),this._apiNetworkClient=new cse(e,this._dataLayer,s.endpoints.liveAPIURL,s.endpoints.testAPIURL,o);var l=new Oie(e,this._networkClient,this._dataLayer),c=new Nie(l.getAsync()),f=new tie(e,s.endpoints.dfpBackendURL,l.getAsync(),c.executeRecaptcha),u=new $ie(s.endpoints.clientsideServicesIframeURL),d=new zie(e,u),h=new Pie(this._networkClient,f);this.user=new oie(this._networkClient,this._subscriptionService),this.session=new aie(this._networkClient,this._subscriptionService),this.magicLinks=new cie(this._networkClient,this._subscriptionService,new bp(this._dataLayer,"magic_links"),a,l.getAsync(),f),this.otps=new fie(this._networkClient,this._subscriptionService,c.executeRecaptcha,f),this.oauth=new Die(this._networkClient,this._subscriptionService,new bp(this._dataLayer,"oauth"),l.getAsync(),{publicToken:e,testAPIURL:s.endpoints.testAPIURL,liveAPIURL:s.endpoints.liveAPIURL},d),this.cryptoWallets=new hie(this._networkClient,this._apiNetworkClient,this._subscriptionService,c.executeRecaptcha,f,l.getAsync()),this.totps=new vie(this._networkClient,this._subscriptionService,f),this.webauthn=new Aie(this._networkClient,this._subscriptionService,f),this.passwords=new _ie(this._networkClient,this._subscriptionService,a,l.getAsync(),f),this._sessionManager=new u9(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}}),lse(this,{bootstrap:l,clientsideServices:u,captcha:c,oneTap:d,searchManager:h,publicToken:e,dataLayer:this._dataLayer,networkClient:this._networkClient})});const use="public-token-test-b10ed486-70f4-44d3-8696-662052833e88";function dse({children:t}){return $.jsx(Fre,{stytch:new fse(use),children:t})}const hse="970987756660-35a6tc48hvi8cev9cnknp0iugv9poa23.apps.googleusercontent.com",cC="970987756660-6ibakd38eibf3cg9rq42hri7o0jn5va8.apps.googleusercontent.com",vse="AQAAAAAAAEGv4rUgioUNUbcdNZlvOZE72JI",pse="eyJwcm9qZWN0SWQiOjE2ODE1LCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI2N2V2NXVvc3ZxMzVmcGI2OXI3NnJoYnVoIiwicnBjU2VydmVyIjoiaHR0cHM6Ly93YWFzLnNlcXVlbmNlLmFwcCJ9",fC="AQAAAAAAAAK2JvvZhWqZ51riasWBftkrVXE",uC="eyJwcm9qZWN0SWQiOjY5NCwicnBjU2VydmVyIjoiaHR0cHM6Ly9kZXYtd2Fhcy5zZXF1ZW5jZS5hcHAiLCJlbWFpbFJlZ2lvbiI6ImNhLWNlbnRyYWwtMSIsImVtYWlsQ2xpZW50SWQiOiI1NGF0bjV1cGk2M3FjNTlhMWVtM3ZiaHJzbiJ9";new __("https://nodes.sequence.app/polygon");const L1=new URLSearchParams(window.location.search),yse=L1.get("env")??"prod";let y9=L1.get("projectAccessKey")??vse,m9=L1.get("waasConfigKey")??pse,g9=L1.get("googleClientId")??hse;yse==="dev"&&(console.log("Using dev environment"),console.log(`Project Access Key: ${fC}`),console.log(`Waas Config Key: ${uC}`),console.log(`Google Client ID: ${cC}`),y9=fC,m9=uC,g9=cC);const Re=new Sre({network:"polygon",projectAccessKey:y9,waasConfigKey:m9}),Ri=xV([{path:"/login",element:$.jsx(Ure,{})},{path:"/",element:$.jsx(tne,{})}]);Sp.createRoot(document.getElementById("root")).render($.jsx(pr.StrictMode,{children:$.jsx(RF,{children:$.jsx(YU,{children:$.jsx(OV,{clientId:g9,children:$.jsx(dse,{children:$.jsx(TV,{router:Ri})})})})})})); diff --git a/index.html b/index.html index e2c9bc1..0d81773 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Demo Waas App - +