vendor: 7,767 bytes, lines 1-18
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/email-BhCufiDg.js","assets/index-tDtPnhrn.js","assets/swaps-NTA_ct5x.js","assets/SwapController-B78qZify.js","assets/index-Df_5etq_.js","assets/send-C2bbawkj.js","assets/index-Bk5ShzIv.js","assets/pay-with-exchange-3x0UmeGj.js","assets/index-CBPZFUep.js","assets/index-DLfJPu8a.js","assets/data-capture-3cxcdNcd.js","assets/features-D3t0a8yQ.js","assets/w3m-modal-Beg9jjTu.js","assets/PhArrowCircleDown-B305t-Sh.js","assets/property-C9JG5tag.js","assets/PhArrowClockwise-CJPxQhr_.js","assets/PhArrowDown-C4hT9BVu.js","assets/PhArrowLeft-Way4Cu-r.js","assets/PhArrowRight-Cp5ZME0F.js","assets/PhArrowSquareOut-NnrK69c5.js","assets/PhArrowsDownUp-BjBI4ckC.js","assets/PhArrowsLeftRight-CuLpbKRk.js","assets/PhArrowUp-Dph6j8rm.js","assets/PhArrowUpRight-BpJjRRRh.js","assets/PhArrowsClockwise-CFUT8X7R.js","assets/PhBank-Dchr4XQJ.js","assets/PhBrowser-dUu2TrC1.js","assets/PhCaretDown-78IuKU3V.js","assets/PhCaretLeft-_aiyH7n1.js","assets/PhCaretRight-8zJQEuDX.js","assets/PhCaretUp-CiCxKWwN.js","assets/PhCheck-CcADx8br.js","assets/PhCircleHalf-BYzSzd2h.js","assets/PhClock-UItiXeJq.js","assets/PhCompass-CUy3uA7t.js","assets/PhCopy-C-PDgSlZ.js","assets/PhCreditCard-CWRaUT6F.js","assets/PhCurrencyDollar-Cqla3AXT.js","assets/PhDesktop-BBIPrYLl.js","assets/PhDeviceMobile-BdsPaATg.js","assets/PhDotsThree-BMXCQl-0.js","assets/PhVault-l2PHF38a.js","assets/PhEnvelope-yUsis6yU.js","assets/PhFunnelSimple-Ba7BbWTp.js","assets/PhGlobe-DgLxBk5U.js","assets/PhIdentificationCard-Czjmq9Z3.js","assets/PhImage-BAJ_erz6.js","assets/PhInfo-Cr4DhVUE.js","assets/PhLightbulb-BX_7duTr.js","assets/PhMagnifyingGlass-Mygfryvz.js","assets/PhPaperPlaneRight-BeuCA660.js","assets/PhPlus-BMjcHjsT.js","assets/PhPower-CGffGmdb.js","assets/PhPuzzlePiece-wm_GpVSi.js","assets/PhQrCode-DRwRzXCH.js","assets/PhQuestion-M09j2U0T.js","assets/PhQuestionMark-BP9EMB6h.js","assets/PhSealCheck-BfG80yKn.js","assets/PhSignOut-C5YOWlPT.js","assets/PhSpinner-BXooDYzU.js","assets/PhTrash-Biq6rmmL.js","assets/PhUser-CAgZSpGe.js","assets/PhWallet-w25D16It.js","assets/PhWarning-DPEydIPw.js","assets/PhWarningCircle-BqjT745H.js","assets/PhX-s-SmVExa.js"])))=>i.map(i=>d[i]); 2var _ce=Object.defineProperty;var bB=t=>{throw TypeError(t)};var Sce=(t,e,n)=>e in t?_ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var PA=(t,e,n)=>Sce(t,typeof e!="symbol"?e+"":e,n),IA=(t,e,n)=>e.has(t)||bB("Cannot "+n);var ge=(t,e,n)=>(IA(t,e,"read from private field"),n?n.call(t):e.get(t)),an=(t,e,n)=>e.has(t)?bB("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Nt=(t,e,n,i)=>(IA(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),Xn=(t,e,n)=>(IA(t,e,"access private method"),n);var OC=(t,e,n,i)=>({set _(s){Nt(t,e,s,n)},get _(){return ge(t,e,i)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=n(s);fetch(s.href,r)}})();var yu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ya(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function VY(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}),n}var DA={exports:{}},yv={};/** 3 * @license React 4 * react-jsx-runtime.production.js 5 * 6 * Copyright (c) Meta Platforms, Inc. and affiliates. 7 * 8 * This source code is licensed under the MIT license found in the 9 * LICENSE file in the root directory of this source tree. 10 */var wB;function Ace(){if(wB)return yv;wB=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,s,r){var o=null;if(r!==void 0&&(o=""+r),s.key!==void 0&&(o=""+s.key),"key"in s){r={};for(var a in s)a!=="key"&&(r[a]=s[a])}else r=s;return s=r.ref,{$$typeof:t,type:i,key:o,ref:s!==void 0?s:null,props:r}}return yv.Fragment=e,yv.jsx=n,yv.jsxs=n,yv}var vB;function Tce(){return vB||(vB=1,DA.exports=Ace()),DA.exports}var m=Tce(),OA={exports:{}},jn={};/** 11 * @license React 12 * react.production.js 13 * 14 * Copyright (c) Meta Platforms, Inc. and affiliates. 15 * 16 * This source code is licensed under the MIT license found in the 17 * LICENSE file in the root directory of this source tree. 18 */var CB;function kce(){if(CB)return jn;CB=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),r=Symbol.for("react.consumer"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function g(D){return D===null||typeof D!="object"?null:(D=p&&D[p]||D["@@iterator"],typeof D=="function"?D:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function E(D,O,H){this.props=D,this.context=O,this.refs=C,this.updater=H||b}E.prototype.isReactComponent={},E.prototype.setState=function(D,O){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,O,"setState")},E.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function T(){}T.prototype=E.prototype;function A(D,O,H){this.props=D,this.context=O,this.refs=C,this.updater=H||b}var k=A.prototype=new T;k.constructor=A,w(k,E.prototype),k.isPureReactComponent=!0;var R=Array.isArray;function P(){}var B={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function z(D,O,H){var J=H.ref;return{$$typeof:t,type:D,key:O,ref:J!==void 0?J:null,props:H}}function K(D,O){return z(D.type,O,D.props)}function q(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function G(D){var O={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(H){return O[H]})}var I=/\/+/g;function S(D,O){return typeof D=="object"&&D!==null&&D.key!=null?G(""+D.key):O.toString(36)}function v(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(P,P):(D.status="pending",D.then(function(O){D.status==="pending"&&(D.status="fulfilled",D.value=O)},function(O){D.status==="pending"&&(D.status="rejected",D.reason=O)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function _(D,O,H,J,W){var Z=typeof D;(Z==="undefined"||Z==="boolean")&&(D=null);var Y=!1;if(D===null)Y=!0;else switch(Z){case"bigint":case"string":case"number":Y=!0;break;case"object":switch(D.$$typeof){case t:case e:Y=!0;break;case d:return Y=D._init,_(Y(D._payload),O,H,J,W)}}
vendor: 16,163 bytes, lines 18-42
18if(Y)return W=W(D),Y=J===""?"."+S(D,0):J,R(W)?(H="",Y!=null&&(H=Y.replace(I,"$&/")+"/"),_(W,O,H,"",function(ie){return ie})):W!=null&&(q(W)&&(W=K(W,H+(W.key==null||D&&D.key===W.key?"":(""+W.key).replace(I,"$&/")+"/")+Y)),O.push(W)),1;Y=0;var Q=J===""?".":J+":";if(R(D))for(var ee=0;ee<D.length;ee++)J=D[ee],Z=Q+S(J,ee),Y+=_(J,O,H,Z,W);else if(ee=g(D),typeof ee=="function")for(D=ee.call(D),ee=0;!(J=D.next()).done;)J=J.value,Z=Q+S(J,ee++),Y+=_(J,O,H,Z,W);else if(Z==="object"){if(typeof D.then=="function")return _(v(D),O,H,J,W);throw O=String(D),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.")}return Y}function N(D,O,H){if(D==null)return D;var J=[],W=0;return _(D,J,"","",function(Z){return O.call(H,Z,W++)}),J}function $(D){if(D._status===-1){var O=D._result;O=O(),O.then(function(H){(D._status===0||D._status===-1)&&(D._status=1,D._result=H)},function(H){(D._status===0||D._status===-1)&&(D._status=2,D._result=H)}),D._status===-1&&(D._status=0,D._result=O)}if(D._status===1)return D._result.default;throw D._result}var U=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var O=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(O))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},j={map:N,forEach:function(D,O,H){N(D,function(){O.apply(this,arguments)},H)},count:function(D){var O=0;return N(D,function(){O++}),O},toArray:function(D){return N(D,function(O){return O})||[]},only:function(D){if(!q(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return jn.Activity=h,jn.Children=j,jn.Component=E,jn.Fragment=n,jn.Profiler=s,jn.PureComponent=A,jn.StrictMode=i,jn.Suspense=c,jn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,jn.__COMPILER_RUNTIME={__proto__:null,c:function(D){return B.H.useMemoCache(D)}},jn.cache=function(D){return function(){return D.apply(null,arguments)}},jn.cacheSignal=function(){return null},jn.cloneElement=function(D,O,H){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var J=w({},D.props),W=D.key;if(O!=null)for(Z in O.key!==void 0&&(W=""+O.key),O)!F.call(O,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&O.ref===void 0||(J[Z]=O[Z]);var Z=arguments.length-2;if(Z===1)J.children=H;else if(1<Z){for(var Y=Array(Z),Q=0;Q<Z;Q++)Y[Q]=arguments[Q+2];J.children=Y}return z(D.type,W,J)},jn.createContext=function(D){return D={$$typeof:o,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:r,_context:D},D},jn.createElement=function(D,O,H){var J,W={},Z=null;if(O!=null)for(J in O.key!==void 0&&(Z=""+O.key),O)F.call(O,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(W[J]=O[J]);var Y=arguments.length-2;if(Y===1)W.children=H;else if(1<Y){for(var Q=Array(Y),ee=0;ee<Y;ee++)Q[ee]=arguments[ee+2];W.children=Q}if(D&&D.defaultProps)for(J in Y=D.defaultProps,Y)W[J]===void 0&&(W[J]=Y[J]);return z(D,Z,W)},jn.createRef=function(){return{current:null}},jn.forwardRef=function(D){return{$$typeof:a,render:D}},jn.isValidElement=q,jn.lazy=function(D){return{$$typeof:d,_payload:{_status:-1,_result:D},_init:$}},jn.memo=function(D,O){return{$$typeof:l,type:D,compare:O===void 0?null:O}},jn.startTransition=function(D){var O=B.T,H={};B.T=H;try{var J=D(),W=B.S;W!==null&&W(H,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(P,U)}catch(Z){U(Z)}finally{O!==null&&H.types!==null&&(O.types=H.types),B.T=O}},jn.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},jn.use=function(D){return B.H.use(D)},jn.useActionState=function(D,O,H){return B.H.useActionState(D,O,H)},jn.useCallback=function(D,O){return B.H.useCallback(D,O)},jn.useContext=function(D){return B.H.useContext(D)},jn.useDebugValue=function(){},jn.useDeferredValue=function(D,O){return B.H.useDeferredValue(D,O)},jn.useEffect=function(D,O){return B.H.useEffect(D,O)},jn.useEffectEvent=function(D){return B.H.useEffectEvent(D)},jn.useId=function(){return B.H.useId()},jn.useImperativeHandle=function(D,O,H){return B.H.useImperativeHandle(D,O,H)},jn.useInsertionEffect=function(D,O){return B.H.useInsertionEffect(D,O)},jn.useLayoutEffect=function(D,O){return B.H.useLayoutEffect(D,O)},jn.useMemo=function(D,O){return B.H.useMemo(D,O)},jn.useOptimistic=function(D,O){return B.H.useOptimistic(D,O)},jn.useReducer=function(D,O,H){return B.H.useReducer(D,O,H)},jn.useRef=function(D){return B.H.useRef(D)},jn.useState=function(D){return B.H.useState(D)},jn.useSyncExternalStore=function(D,O,H){return B.H.useSyncExternalStore(D,O,H)},jn.useTransition=function(){return B.H.useTransition()},jn.version="19.2.1",jn}var xB;function _b(){return xB||(xB=1,OA.exports=kce()),OA.exports}var M=_b();const kn=ya(M);var MA={exports:{}},bv={},LA={exports:{}},$A={};/** 19 * @license React 20 * scheduler.production.js 21 * 22 * Copyright (c) Meta Platforms, Inc. and affiliates. 23 * 24 * This source code is licensed under the MIT license found in the 25 * LICENSE file in the root directory of this source tree. 26 */var EB;function Nce(){return EB||(EB=1,(function(t){function e(_,N){var $=_.length;_.push(N);e:for(;0<$;){var U=$-1>>>1,j=_[U];if(0<s(j,N))_[U]=N,_[$]=j,$=U;else break e}}function n(_){return _.length===0?null:_[0]}function i(_){if(_.length===0)return null;var N=_[0],$=_.pop();if($!==N){_[0]=$;e:for(var U=0,j=_.length,D=j>>>1;U<D;){var O=2*(U+1)-1,H=_[O],J=O+1,W=_[J];if(0>s(H,$))J<j&&0>s(W,H)?(_[U]=W,_[J]=$,U=J):(_[U]=H,_[O]=$,U=O);else if(J<j&&0>s(W,$))_[U]=W,_[J]=$,U=J;else break e}}return N}function s(_,N){var $=_.sortIndex-N.sortIndex;return $!==0?$:_.id-N.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;t.unstable_now=function(){return r.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var c=[],l=[],d=1,h=null,p=3,g=!1,b=!1,w=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function k(_){for(var N=n(l);N!==null;){if(N.callback===null)i(l);else if(N.startTime<=_)i(l),N.sortIndex=N.expirationTime,e(c,N);else break;N=n(l)}}function R(_){if(w=!1,k(_),!b)if(n(c)!==null)b=!0,P||(P=!0,G());else{var N=n(l);N!==null&&v(R,N.startTime-_)}}var P=!1,B=-1,F=5,z=-1;function K(){return C?!0:!(t.unstable_now()-z<F)}function q(){if(C=!1,P){var _=t.unstable_now();z=_;var N=!0;try{e:{b=!1,w&&(w=!1,T(B),B=-1),g=!0;var $=p;try{t:{for(k(_),h=n(c);h!==null&&!(h.expirationTime>_&&K());){var U=h.callback;if(typeof U=="function"){h.callback=null,p=h.priorityLevel;var j=U(h.expirationTime<=_);if(_=t.unstable_now(),typeof j=="function"){h.callback=j,k(_),N=!0;break t}h===n(c)&&i(c),k(_)}else i(c);h=n(c)}if(h!==null)N=!0;else{var D=n(l);D!==null&&v(R,D.startTime-_),N=!1}}break e}finally{h=null,p=$,g=!1}N=void 0}}finally{N?G():P=!1}}}var G;if(typeof A=="function")G=function(){A(q)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,S=I.port2;I.port1.onmessage=q,G=function(){S.postMessage(null)}}else G=function(){E(q,0)};function v(_,N){B=E(function(){_(t.unstable_now())},N)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(_){_.callback=null},t.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<_?Math.floor(1e3/_):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_next=function(_){switch(p){case 1:case 2:case 3:var N=3;break;default:N=p}var $=p;p=N;try{return _()}finally{p=$}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(_,N){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var $=p;p=_;try{return N()}finally{p=$}},t.unstable_scheduleCallback=function(_,N,$){var U=t.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?U+$:U):$=U,_){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=$+j,_={id:d++,callback:N,priorityLevel:_,startTime:$,expirationTime:j,sortIndex:-1},$>U?(_.sortIndex=$,e(l,_),n(c)===null&&_===n(l)&&(w?(T(B),B=-1):w=!0,v(R,$-U))):(_.sortIndex=j,e(c,_),b||g||(b=!0,P||(P=!0,G()))),_},t.unstable_shouldYield=K,t.unstable_wrapCallback=function(_){var N=p;return function(){var $=p;p=N;try{return _.apply(this,arguments)}finally{p=$}}}})($A)),$A}var _B;function Rce(){return _B||(_B=1,LA.exports=Nce()),LA.exports}var UA={exports:{}},Po={};/** 27 * @license React 28 * react-dom.production.js 29 * 30 * Copyright (c) Meta Platforms, Inc. and affiliates. 31 * 32 * This source code is licensed under the MIT license found in the 33 * LICENSE file in the root directory of this source tree. 34 */var SB;function Pce(){if(SB)return Po;SB=1;var t=_b();function e(c){var l="https://react.dev/errors/"+c;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function r(c,l,d){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:h==null?null:""+h,children:c,containerInfo:l,implementation:d}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(c,l){if(c==="font")return"";if(typeof l=="string")return l==="use-credentials"?l:""}return Po.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Po.createPortal=function(c,l){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)throw Error(e(299));return r(c,l,null,d)},Po.flushSync=function(c){var l=o.T,d=i.p;try{if(o.T=null,i.p=2,c)return c()}finally{o.T=l,i.p=d,i.d.f()}},Po.preconnect=function(c,l){typeof c=="string"&&(l?(l=l.crossOrigin,l=typeof l=="string"?l==="use-credentials"?l:"":void 0):l=null,i.d.C(c,l))},Po.prefetchDNS=function(c){typeof c=="string"&&i.d.D(c)},Po.preinit=function(c,l){if(typeof c=="string"&&l&&typeof l.as=="string"){var d=l.as,h=a(d,l.crossOrigin),p=typeof l.integrity=="string"?l.integrity:void 0,g=typeof l.fetchPriority=="string"?l.fetchPriority:void 0;d==="style"?i.d.S(c,typeof l.precedence=="string"?l.precedence:void 0,{crossOrigin:h,integrity:p,fetchPriority:g}):d==="script"&&i.d.X(c,{crossOrigin:h,integrity:p,fetchPriority:g,nonce:typeof l.nonce=="string"?l.nonce:void 0})}},Po.preinitModule=function(c,l){if(typeof c=="string")if(typeof l=="object"&&l!==null){if(l.as==null||l.as==="script"){var d=a(l.as,l.crossOrigin);i.d.M(c,{crossOrigin:d,integrity:typeof l.integrity=="string"?l.integrity:void 0,nonce:typeof l.nonce=="string"?l.nonce:void 0})}}else l==null&&i.d.M(c)},Po.preload=function(c,l){if(typeof c=="string"&&typeof l=="object"&&l!==null&&typeof l.as=="string"){var d=l.as,h=a(d,l.crossOrigin);i.d.L(c,d,{crossOrigin:h,integrity:typeof l.integrity=="string"?l.integrity:void 0,nonce:typeof l.nonce=="string"?l.nonce:void 0,type:typeof l.type=="string"?l.type:void 0,fetchPriority:typeof l.fetchPriority=="string"?l.fetchPriority:void 0,referrerPolicy:typeof l.referrerPolicy=="string"?l.referrerPolicy:void 0,imageSrcSet:typeof l.imageSrcSet=="string"?l.imageSrcSet:void 0,imageSizes:typeof l.imageSizes=="string"?l.imageSizes:void 0,media:typeof l.media=="string"?l.media:void 0})}},Po.preloadModule=function(c,l){if(typeof c=="string")if(l){var d=a(l.as,l.crossOrigin);i.d.m(c,{as:typeof l.as=="string"&&l.as!=="script"?l.as:void 0,crossOrigin:d,integrity:typeof l.integrity=="string"?l.integrity:void 0})}else i.d.m(c)},Po.requestFormReset=function(c){i.d.r(c)},Po.unstable_batchedUpdates=function(c,l){return c(l)},Po.useFormState=function(c,l,d){return o.H.useFormState(c,l,d)},Po.useFormStatus=function(){return o.H.useHostTransitionStatus()},Po.version="19.2.1",Po}var AB;function WY(){if(AB)return UA.exports;AB=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),UA.exports=Pce(),UA.exports}/** 35 * @license React 36 * react-dom-client.production.js 37 * 38 * Copyright (c) Meta Platforms, Inc. and affiliates. 39 * 40 * This source code is licensed under the MIT license found in the 41 * LICENSE file in the root directory of this source tree. 42 */var TB;function Ice(){if(TB)return bv;TB=1;var t=Rce(),e=_b(),n=WY();function i(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)f+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function r(u){var f=u,y=u;if(u.alternate)for(;f.return;)f=f.return;else{u=f;do f=u,(f.flags&4098)!==0&&(y=f.return),u=f.return;while(u)}return f.tag===3?y:null}function o(u){if(u.tag===13){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function a(u){if(u.tag===31){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function c(u){if(r(u)!==u)throw Error(i(188))}function l(u){var f=u.alternate;if(!f){if(f=r(u),f===null)throw Error(i(188));return f!==u?null:u}for(var y=u,x=f;;){var L=y.return;if(L===null)break;var V=L.alternate;if(V===null){if(x=L.return,x!==null){y=x;continue}break}if(L.child===V.child){for(V=L.child;V;){if(V===y)return c(L),u;if(V===x)return c(L),f;V=V.sibling}throw Error(i(188))}if(y.return!==x.return)y=L,x=V;else{for(var te=!1,ce=L.child;ce;){if(ce===y){te=!0,y=L,x=V;break}if(ce===x){te=!0,x=L,y=V;break}ce=ce.sibling}if(!te){for(ce=V.child;ce;){if(ce===y){te=!0,y=V,x=L;break}if(ce===x){te=!0,x=V,y=L;break}ce=ce.sibling}if(!te)throw Error(i(189))}}if(y.alternate!==x)throw Error(i(190))}if(y.tag!==3)throw Error(i(188));return y.stateNode.current===y?u:f}function d(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u;for(u=u.child;u!==null;){if(f=d(u),f!==null)return f;u=u.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function G(u){return u===null||typeof u!="object"?null:(u=q&&u[q]||u["@@iterator"],typeof u=="function"?u:null)}var I=Symbol.for("react.client.reference");function S(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===I?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case w:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case R:return"Suspense";case P:return"SuspenseList";case z:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case b:return"Portal";case A:return u.displayName||"Context";case T:return(u._context.displayName||"Context")+".Consumer";case k:var f=u.render;
vendor: 9,157 bytes, lines 42-49
42return u=u.displayName,u||(u=f.displayName||f.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case B:return f=u.displayName||null,f!==null?f:S(u.type)||"Memo";case F:f=u._payload,u=u._init;try{return S(u(f))}catch{}}return null}var v=Array.isArray,_=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},U=[],j=-1;function D(u){return{current:u}}function O(u){0>j||(u.current=U[j],U[j]=null,j--)}function H(u,f){j++,U[j]=u.current,u.current=f}var J=D(null),W=D(null),Z=D(null),Y=D(null);function Q(u,f){switch(H(Z,f),H(W,u),H(J,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?jU(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=jU(f),u=VU(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}O(J),H(J,u)}function ee(){O(J),O(W),O(Z)}function ie(u){u.memoizedState!==null&&H(Y,u);var f=J.current,y=VU(f,u.type);f!==y&&(H(W,u),H(J,y))}function re(u){W.current===u&&(O(J),O(W)),Y.current===u&&(O(Y),fv._currentValue=$)}var oe,de;function he(u){if(oe===void 0)try{throw Error()}catch(y){var f=y.stack.trim().match(/\n( *(at )?)/);oe=f&&f[1]||"",de=-1<y.stack.indexOf(` 43 at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return` 44`+oe+u+de}var ue=!1;function be(u,f){if(!u||ue)return"";ue=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={DetermineComponentFrameRoot:function(){try{if(f){var Je=function(){throw Error()};if(Object.defineProperty(Je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Je,[])}catch(je){var Le=je}Reflect.construct(u,[],Je)}else{try{Je.call()}catch(je){Le=je}u.call(Je.prototype)}}else{try{throw Error()}catch(je){Le=je}(Je=u())&&typeof Je.catch=="function"&&Je.catch(function(){})}}catch(je){if(je&&Le&&typeof je.stack=="string")return[je.stack,Le.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var L=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");L&&L.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var V=x.DetermineComponentFrameRoot(),te=V[0],ce=V[1];if(te&&ce){var me=te.split(` 45`),De=ce.split(` 46`);for(L=x=0;x<me.length&&!me[x].includes("DetermineComponentFrameRoot");)x++;for(;L<De.length&&!De[L].includes("DetermineComponentFrameRoot");)L++;if(x===me.length||L===De.length)for(x=me.length-1,L=De.length-1;1<=x&&0<=L&&me[x]!==De[L];)L--;for(;1<=x&&0<=L;x--,L--)if(me[x]!==De[L]){if(x!==1||L!==1)do if(x--,L--,0>L||me[x]!==De[L]){var qe=` 47`+me[x].replace(" at new "," at ");return u.displayName&&qe.includes("<anonymous>")&&(qe=qe.replace("<anonymous>",u.displayName)),qe}while(1<=x&&0<=L);break}}}finally{ue=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?he(y):""}function _e(u,f){switch(u.tag){case 26:case 27:case 5:return he(u.type);case 16:return he("Lazy");case 13:return u.child!==f&&f!==null?he("Suspense Fallback"):he("Suspense");case 19:return he("SuspenseList");case 0:case 15:return be(u.type,!1);case 11:return be(u.type.render,!1);case 1:return be(u.type,!0);case 31:return he("Activity");default:return""}}function Ne(u){try{var f="",y=null;do f+=_e(u,y),y=u,u=u.return;while(u);return f}catch(x){return` 48Error generating stack: `+x.message+` 49`+x.stack}}var pe=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,ve=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Ye=t.unstable_requestPaint,ze=t.unstable_now,ft=t.unstable_getCurrentPriorityLevel,lt=t.unstable_ImmediatePriority,We=t.unstable_UserBlockingPriority,Dt=t.unstable_NormalPriority,Fe=t.unstable_LowPriority,it=t.unstable_IdlePriority,Qt=t.log,ke=t.unstable_setDisableYieldValue,nt=null,ht=null;function At(u){if(typeof Qt=="function"&&ke(u),ht&&typeof ht.setStrictMode=="function")try{ht.setStrictMode(nt,u)}catch{}}var zt=Math.clz32?Math.clz32:yn,Ln=Math.log,gn=Math.LN2;function yn(u){return u>>>=0,u===0?32:31-(Ln(u)/gn|0)|0}var bi=256,En=262144,yt=4194304;function mt(u){var f=u&42;if(f!==0)return f;switch(u&-u){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function _t(u,f,y){var x=u.pendingLanes;if(x===0)return 0;var L=0,V=u.suspendedLanes,te=u.pingedLanes;u=u.warmLanes;var ce=x&134217727;return ce!==0?(x=ce&~V,x!==0?L=mt(x):(te&=ce,te!==0?L=mt(te):y||(y=ce&~u,y!==0&&(L=mt(y))))):(ce=x&~V,ce!==0?L=mt(ce):te!==0?L=mt(te):y||(y=x&~u,y!==0&&(L=mt(y)))),L===0?0:f!==0&&f!==L&&(f&V)===0&&(V=L&-L,y=f&-f,V>=y||V===32&&(y&4194048)!==0)?f:L}function Vt(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function Yn(u,f){switch(u){case 1:case 2:case 4:case 8:case 64:return f+250;case 16:case 32: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 f+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ee(){var u=yt;return yt<<=1,(yt&62914560)===0&&(yt=4194304),u}function $e(u){for(var f=[],y=0;31>y;y++)f.push(u);return f}function Xe(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function ot(u,f,y,x,L,V){var te=u.pendingLanes;u.pendingLanes=y,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=y,u.entangledLanes&=y,u.errorRecoveryDisabledLanes&=y,u.shellSuspendCounter=0;var ce=u.entanglements,me=u.expirationTimes,De=u.hiddenUpdates;for(y=te&~y;0<y;){var qe=31-zt(y),Je=1<<qe;ce[qe]=0,me[qe]=-1;var Le=De[qe];if(Le!==null)for(De[qe]=null,qe=0;qe<Le.length;qe++){var je=Le[qe];je!==null&&(je.lane&=-536870913)}y&=~Je}x!==0&&pt(u,x,0),V!==0&&L===0&&u.tag!==0&&(u.suspendedLanes|=V&~(te&~f))}function pt(u,f,y){u.pendingLanes|=f,u.suspendedLanes&=~f;var x=31-zt(f);u.entangledLanes|=f,u.entanglements[x]=u.entanglements[x]|1073741824|y&261930}function Ot(u,f){var y=u.entangledLanes|=f;for(u=u.entanglements;y;){var x=31-zt(y),L=1<<x;L&f|u[x]&f&&(u[x]|=f),y&=~L}}function tn(u,f){var y=f&-f;return y=(y&42)!==0?1:rn(y),(y&(u.suspendedLanes|f))!==0?0:y}function rn(u){switch(u){case 2:u=1;break;case 8:u=4;break;case 32:u=16;break;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:u=128;break;case 268435456:u=134217728;break;default:u=0}return u}function Mt(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function nn(){var u=N.p;return u!==0?u:(u=window.event,u===void 0?32:dB(u.type))}function ln(u,f){var y=N.p;try{return N.p=u,f()}finally{N.p=y}}var Oi=Math.random().toString(36).slice(2),un="__reactFiber$"+Oi,_n="__reactProps$"+Oi,Cs="__reactContainer$"+Oi,Wn="__reactEvents$"+Oi,Zn="__reactListeners$"+Oi,fs="__reactHandles$"+Oi,Us="__reactResources$"+Oi,cs="__reactMarker$"+Oi;function Vr(u){delete u[un],delete u[_n],delete u[Wn],delete u[Zn],delete u[fs]}function ps(u){var f=u[un];if(f)return f;for(var y=u.parentNode;y;){if(f=y[Cs]||y[un]){if(y=f.alternate,f.child!==null||y!==null&&y.child!==null)for(u=YU(u);u!==null;){if(y=u[un])return y;u=YU(u)}return f}u=y,y=u.parentNode}return null}function ko(u){if(u=u[un]||u[Cs]){var f=u.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return u}return null}function Mi(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u.stateNode;throw Error(i(33))}function dc(u){var f=u[Us];return f||(f=u[Us]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function Ji(u){u[cs]=!0}var qu=new Set,ql={};function hc(u,f){Qc(u,f),Qc(u+"Capture",f)}function Qc(u,f){for(ql[u]=f,u=0;u<f.length;u++)qu.add(f[u])}var Qd=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),zu={},Hu={};function Xd(u){return pe.call(Hu,u)?!0:pe.call(zu,u)?!1:Qd.test(u)?Hu[u]=!0:(zu[u]=!0,!1)}function Xc(u,f,y){if(Xd(f))if(y===null)u.removeAttribute(f);else{switch(typeof y){case"undefined":case"function":case"symbol":u.removeAttribute(f);return;case"boolean":var x=f.toLowerCase().slice(0,5);if(x!=="data-"&&x!=="aria-"){u.removeAttribute(f);return}}u.setAttribute(f,""+y)}}
vendor: 6,075 bytes, line 49
49function Jc(u,f,y){if(y===null)u.removeAttribute(f);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(f);return}u.setAttribute(f,""+y)}}function Pt(u,f,y,x){if(x===null)u.removeAttribute(y);else{switch(typeof x){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(y);return}u.setAttributeNS(f,y,""+x)}}function kt(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Ge(u){var f=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function Gu(u,f,y){var x=Object.getOwnPropertyDescriptor(u.constructor.prototype,f);if(!u.hasOwnProperty(f)&&typeof x<"u"&&typeof x.get=="function"&&typeof x.set=="function"){var L=x.get,V=x.set;return Object.defineProperty(u,f,{configurable:!0,get:function(){return L.call(this)},set:function(te){y=""+te,V.call(this,te)}}),Object.defineProperty(u,f,{enumerable:x.enumerable}),{getValue:function(){return y},setValue:function(te){y=""+te},stopTracking:function(){u._valueTracker=null,delete u[f]}}}}function Jd(u){if(!u._valueTracker){var f=Ge(u)?"checked":"value";u._valueTracker=Gu(u,f,""+u[f])}}function $1(u){if(!u)return!1;var f=u._valueTracker;if(!f)return!0;var y=f.getValue(),x="";return u&&(x=Ge(u)?u.checked?"true":"false":u.value),u=x,u!==y?(f.setValue(u),!0):!1}function Qp(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var zl=/[\n"\\]/g;function hi(u){return u.replace(zl,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function U1(u,f,y,x,L,V,te,ce){u.name="",te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"?u.type=te:u.removeAttribute("type"),f!=null?te==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+kt(f)):u.value!==""+kt(f)&&(u.value=""+kt(f)):te!=="submit"&&te!=="reset"||u.removeAttribute("value"),f!=null?Xp(u,te,kt(f)):y!=null?Xp(u,te,kt(y)):x!=null&&u.removeAttribute("value"),L==null&&V!=null&&(u.defaultChecked=!!V),L!=null&&(u.checked=L&&typeof L!="function"&&typeof L!="symbol"),ce!=null&&typeof ce!="function"&&typeof ce!="symbol"&&typeof ce!="boolean"?u.name=""+kt(ce):u.removeAttribute("name")}function zn(u,f,y,x,L,V,te,ce){if(V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"&&(u.type=V),f!=null||y!=null){if(!(V!=="submit"&&V!=="reset"||f!=null)){Jd(u);return}y=y!=null?""+kt(y):"",f=f!=null?""+kt(f):y,ce||f===u.value||(u.value=f),u.defaultValue=f}x=x??L,x=typeof x!="function"&&typeof x!="symbol"&&!!x,u.checked=ce?u.checked:!!x,u.defaultChecked=!!x,te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"&&(u.name=te),Jd(u)}function Xp(u,f,y){f==="number"&&Qp(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function Ku(u,f,y,x){if(u=u.options,f){f={};for(var L=0;L<y.length;L++)f["$"+y[L]]=!0;for(y=0;y<u.length;y++)L=f.hasOwnProperty("$"+u[y].value),u[y].selected!==L&&(u[y].selected=L),L&&x&&(u[y].defaultSelected=!0)}else{for(y=""+kt(y),f=null,L=0;L<u.length;L++){if(u[L].value===y){u[L].selected=!0,x&&(u[L].defaultSelected=!0);return}f!==null||u[L].disabled||(f=u[L])}f!==null&&(f.selected=!0)}}function iw(u,f,y){if(f!=null&&(f=""+kt(f),f!==u.value&&(u.value=f),y==null)){u.defaultValue!==f&&(u.defaultValue=f);return}u.defaultValue=y!=null?""+kt(y):""}function B1(u,f,y,x){if(f==null){if(x!=null){if(y!=null)throw Error(i(92));if(v(x)){if(1<x.length)throw Error(i(93));x=x[0]}y=x}y==null&&(y=""),f=y}y=kt(f),u.defaultValue=y,x=u.textContent,x===y&&x!==""&&x!==null&&(u.value=x),Jd(u)}function Zs(u,f){if(f){var y=u.firstChild;if(y&&y===u.lastChild&&y.nodeType===3){y.nodeValue=f;return}}u.textContent=f}var F1=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Hl(u,f,y){var x=f.indexOf("--")===0;y==null||typeof y=="boolean"||y===""?x?u.setProperty(f,""):f==="float"?u.cssFloat="":u[f]="":x?u.setProperty(f,y):typeof y!="number"||y===0||F1.has(f)?f==="float"?u.cssFloat=y:u[f]=(""+y).trim():u[f]=y+"px"}function Ff(u,f,y){if(f!=null&&typeof f!="object")throw Error(i(62));if(u=u.style,y!=null){for(var x in y)!y.hasOwnProperty(x)||f!=null&&f.hasOwnProperty(x)||(x.indexOf("--")===0?u.setProperty(x,""):x==="float"?u.cssFloat="":u[x]="");for(var L in f)x=f[L],f.hasOwnProperty(L)&&y[L]!==x&&Hl(u,L,x)}else for(var V in f)f.hasOwnProperty(V)&&Hl(u,V,f[V])}function jf(u){if(u.indexOf("-")===-1)return!1;switch(u){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 v4=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
49dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),HS=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function eh(u){return HS.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function fc(){}var sw=null;function Jp(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var ct=null,Un=null;function at(u){var f=ko(u);if(f&&(u=f.stateNode)){var y=u[_n]||null;e:switch(u=f.stateNode,f.type){case"input":if(U1(u,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name),f=y.name,y.type==="radio"&&f!=null){for(y=u;y.parentNode;)y=y.parentNode;for(y=y.querySelectorAll('input[name="'+hi(""+f)+'"][type="radio"]'),f=0;f<y.length;f++){var x=y[f];if(x!==u&&x.form===u.form){var L=x[_n]||null;if(!L)throw Error(i(90));
vendor: 9,562 bytes, line 49
49U1(x,L.value,L.defaultValue,L.defaultValue,L.checked,L.defaultChecked,L.type,L.name)}}for(f=0;f<y.length;f++)x=y[f],x.form===u.form&&$1(x)}break e;case"textarea":iw(u,y.value,y.defaultValue);break e;case"select":f=y.value,f!=null&&Ku(u,!!y.multiple,f,!1)}}}var si=!1;function Bn(u,f,y){if(si)return u(f,y);si=!0;try{var x=u(f);return x}finally{if(si=!1,(ct!==null||Un!==null)&&(hC(),ct&&(f=ct,u=Un,Un=ct=null,at(f),u)))for(f=0;f<u.length;f++)at(u[f])}}function On(u,f){var y=u.stateNode;if(y===null)return null;var x=y[_n]||null;if(x===null)return null;y=x[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(u=u.type,x=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!x;break e;default:u=!1}if(u)return null;if(y&&typeof y!="function")throw Error(i(231,f,typeof y));return y}var Wr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),el=!1;if(Wr)try{var Gl={};Object.defineProperty(Gl,"passive",{get:function(){el=!0}}),window.addEventListener("test",Gl,Gl),window.removeEventListener("test",Gl,Gl)}catch{el=!1}var Kl=null,Yl=null,tl=null;function em(){if(tl)return tl;var u,f=Yl,y=f.length,x,L="value"in Kl?Kl.value:Kl.textContent,V=L.length;for(u=0;u<y&&f[u]===L[u];u++);var te=y-u;for(x=1;x<=te&&f[y-x]===L[V-x];x++);return tl=L.slice(u,1<x?1-x:void 0)}function xs(u){var f=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&f===13&&(u=13)):u=f,u===10&&(u=13),32<=u||u===13?u:0}function Yu(){return!0}function Zu(){return!1}function Qs(u){function f(y,x,L,V,te){this._reactName=y,this._targetInst=L,this.type=x,this.nativeEvent=V,this.target=te,this.currentTarget=null;for(var ce in u)u.hasOwnProperty(ce)&&(y=u[ce],this[ce]=y?y(V):V[ce]);return this.isDefaultPrevented=(V.defaultPrevented!=null?V.defaultPrevented:V.returnValue===!1)?Yu:Zu,this.isPropagationStopped=Zu,this}return h(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var y=this.nativeEvent;y&&(y.preventDefault?y.preventDefault():typeof y.returnValue!="unknown"&&(y.returnValue=!1),this.isDefaultPrevented=Yu)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=Yu)},persist:function(){},isPersistent:Yu}),f}var th={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vf=Qs(th),Qu=h({},th,{view:0,detail:0}),j1=Qs(Qu),Ki,nl,pc,va=h({},Qu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wf,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==pc&&(pc&&u.type==="mousemove"?(Ki=u.screenX-pc.screenX,nl=u.screenY-pc.screenY):nl=Ki=0,pc=u),Ki)},movementY:function(u){return"movementY"in u?u.movementY:nl}}),C4=Qs(va),tm=h({},va,{dataTransfer:0}),V1=Qs(tm),W1=h({},Qu,{relatedTarget:0}),Cn=Qs(W1),rw=h({},th,{animationName:0,elapsedTime:0,pseudoElement:0}),Pn=Qs(rw),ow=h({},th,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),x4=Qs(ow),aw=h({},th,{data:0}),cw=Qs(aw),GS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},KS={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},YS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ZS(u){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(u):(u=YS[u])?!!f[u]:!1}function Wf(){return ZS}var QS=h({},Qu,{key:function(u){if(u.key){var f=GS[u.key]||u.key;if(f!=="Unidentified")return f}return u.type==="keypress"?(u=xs(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?KS[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wf,charCode:function(u){return u.type==="keypress"?xs(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?xs(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),XS=Qs(QS),JS=h({},va,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qf=Qs(JS),lw=h({},Qu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wf}),$t=Qs(lw),E4=h({},th,{propertyName:0,elapsedTime:0,pseudoElement:0}),uw=Qs(E4),Ca=h({},va,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),dw=Qs(Ca),e9=h({},th,{newState:0,oldState:0}),t9=Qs(e9),n9=[9,13,27,32],q1=Wr&&"CompositionEvent"in window,zf=null;Wr&&"documentMode"in document&&(zf=document.documentMode);var _4=Wr&&"TextEvent"in window&&!zf,hw=Wr&&(!q1||zf&&8<zf&&11>=zf),fw=" ",pw=!1;function mw(u,f){switch(u){case"keyup":return n9.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gw(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var nh=!1;function S4(u,f){switch(u){case"compositionend":return gw(f);case"keypress":return f.which!==32?null:(pw=!0,fw);case"textInput":return u=f.data,u===fw&&pw?null:u;default:return null}}function A4(u,f){if(nh)return u==="compositionend"||!q1&&mw(u,f)?(u=em(),tl=Yl=Kl=null,nh=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return hw&&f.locale!=="ko"?null:f.data;default:return null}}var T4={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yw(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f==="input"?!!T4[u.type]:f==="textarea"}function bw(u,f,y,x){ct?Un?Un.push(x):Un=[x]:ct=x,f=wC(f,"onChange"),0<f.length&&(y=new Vf("onChange","change",null,y,x),u.push({event:y,listeners:f}))}var Hf=null,Gf=null;function k4(u){MU(u,0)}function nm(u){var f=Mi(u);if($1(f))return u}function ww(u,f){if(u==="change")return f}var vw=!1;if(Wr){var z1;if(Wr){var H1="oninput"in document;if(!H1){var Cw=document.createElement("div");Cw.setAttribute("oninput","return;"),H1=typeof Cw.oninput=="function"}z1=H1}else z1=!1;vw=z1&&(!document.documentMode||9<document.documentMode)}function xw(){Hf&&(Hf.detachEvent("onpropertychange",Ew),Gf=Hf=null)}function Ew(u){if(u.propertyName==="value"&&nm(Gf)){var f=[];bw(f,Gf,u,Jp(u)),Bn(k4,f)}}function N4(u,f,y){u==="focusin"?(xw(),Hf=f,Gf=y,Hf.attachEvent("onpropertychange",Ew)):u==="focusout"&&xw()}function R4(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return nm(Gf)}function P4(u,f){if(u==="click")return nm(f)}function I4(u,f){if(u==="input"||u==="change")return nm(f)}function D4(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var No=typeof Object.is=="function"?Object.is:D4;function Kf(u,f){if(No(u,f))return!0;if(typeof u!="object"||u===null||typeof f!="object"||f===null)return!1;var y=Object.keys(u),x=Object.keys(f);if(y.length!==x.length)return!1;for(x=0;x<y.length;x++){var L=y[x];if(!pe.call(f,L)||!No(u[L],f[L]))return!1}return!0}function _w(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function Sw(u,f){var y=_w(u);u=0;for(var x;y;){if(y.nodeType===3){if(x=u+y.textContent.length,u<=f&&x>=f)return{node:y,offset:f-u};u=x}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=_w(y)}}function Aw(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?Aw(u,f.parentNode):"contains"in u?u.contains(f):u.compareDocumentPosition?!!(u.compareDocumentPosition(f)&16):!1:!1}function Tw(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var f=Qp(u.document);f instanceof u.HTMLIFrameElement;){try{var y=typeof f.contentWindow.location.href=="string"}catch{y=!1}if(y)u=f.contentWindow;else break;f=Qp(u.document)}return f}function G1(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f&&(f==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||f==="textarea"||u.contentEditable==="true")}var O4=Wr&&"documentMode"in document&&11>=document.documentMode,ih=null,K1=null,Yf=null,Y1=!1;function kw(u,f,y){var x=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;Y1||ih==null||ih!==Qp(x)||(x=ih,"selectionStart"in x&&G1(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focu
vendor: 18,921 bytes, line 49
49sNode:x.focusNode,focusOffset:x.focusOffset}),Yf&&Kf(Yf,x)||(Yf=x,x=wC(K1,"onSelect"),0<x.length&&(f=new Vf("onSelect","select",null,f,y),u.push({event:f,listeners:x}),f.target=ih)))}function Xu(u,f){var y={};return y[u.toLowerCase()]=f.toLowerCase(),y["Webkit"+u]="webkit"+f,y["Moz"+u]="moz"+f,y}var sh={animationend:Xu("Animation","AnimationEnd"),animationiteration:Xu("Animation","AnimationIteration"),animationstart:Xu("Animation","AnimationStart"),transitionrun:Xu("Transition","TransitionRun"),transitionstart:Xu("Transition","TransitionStart"),transitioncancel:Xu("Transition","TransitionCancel"),transitionend:Xu("Transition","TransitionEnd")},Z1={},Nw={};Wr&&(Nw=document.createElement("div").style,"AnimationEvent"in window||(delete sh.animationend.animation,delete sh.animationiteration.animation,delete sh.animationstart.animation),"TransitionEvent"in window||delete sh.transitionend.transition);function Ju(u){if(Z1[u])return Z1[u];if(!sh[u])return u;var f=sh[u],y;for(y in f)if(f.hasOwnProperty(y)&&y in Nw)return Z1[u]=f[y];return u}var Rw=Ju("animationend"),Pw=Ju("animationiteration"),Iw=Ju("animationstart"),M4=Ju("transitionrun"),L4=Ju("transitionstart"),$4=Ju("transitioncancel"),Dw=Ju("transitionend"),Ow=new Map,Q1="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Q1.push("scrollEnd");function xa(u,f){Ow.set(u,f),hc(f,[u])}var fe=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},Se=[],Re=0,Be=0;function St(){for(var u=Re,f=Be=Re=0;f<u;){var y=Se[f];Se[f++]=null;var x=Se[f];Se[f++]=null;var L=Se[f];Se[f++]=null;var V=Se[f];if(Se[f++]=null,x!==null&&L!==null){var te=x.pending;te===null?L.next=L:(L.next=te.next,te.next=L),x.pending=L}V!==0&&Ea(y,L,V)}}function Ht(u,f,y,x){Se[Re++]=u,Se[Re++]=f,Se[Re++]=y,Se[Re++]=x,Be|=x,u.lanes|=x,u=u.alternate,u!==null&&(u.lanes|=x)}function qn(u,f,y,x){return Ht(u,f,y,x),oo(u)}function Ci(u,f){return Ht(u,null,null,f),oo(u)}function Ea(u,f,y){u.lanes|=y;var x=u.alternate;x!==null&&(x.lanes|=y);for(var L=!1,V=u.return;V!==null;)V.childLanes|=y,x=V.alternate,x!==null&&(x.childLanes|=y),V.tag===22&&(u=V.stateNode,u===null||u._visibility&1||(L=!0)),u=V,V=V.return;return u.tag===3?(V=u.stateNode,L&&f!==null&&(L=31-zt(y),u=V.hiddenUpdates,x=u[L],x===null?u[L]=[f]:x.push(f),f.lane=y|536870912),V):null}function oo(u){if(50<ov)throw ov=0,tA=null,Error(i(185));for(var f=u.return;f!==null;)u=f,f=u.return;return u.tag===3?u.stateNode:null}var cr={};function _r(u,f,y,x){this.tag=u,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(u,f,y,x){return new _r(u,f,y,x)}function _a(u){return u=u.prototype,!(!u||!u.isReactComponent)}function ao(u,f){var y=u.alternate;return y===null?(y=Qn(u.tag,f,u.key,u.mode),y.elementType=u.elementType,y.type=u.type,y.stateNode=u.stateNode,y.alternate=u,u.alternate=y):(y.pendingProps=f,y.type=u.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=u.flags&65011712,y.childLanes=u.childLanes,y.lanes=u.lanes,y.child=u.child,y.memoizedProps=u.memoizedProps,y.memoizedState=u.memoizedState,y.updateQueue=u.updateQueue,f=u.dependencies,y.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},y.sibling=u.sibling,y.index=u.index,y.ref=u.ref,y.refCleanup=u.refCleanup,y}function ed(u,f){u.flags&=65011714;var y=u.alternate;return y===null?(u.childLanes=0,u.lanes=f,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=y.childLanes,u.lanes=y.lanes,u.child=y.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=y.memoizedProps,u.memoizedState=y.memoizedState,u.updateQueue=y.updateQueue,u.type=y.type,f=y.dependencies,u.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),u}function Zl(u,f,y,x,L,V){var te=0;if(x=u,typeof u=="function")_a(u)&&(te=1);else if(typeof u=="string")te=hce(u,y,J.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case z:return u=Qn(31,y,f,L),u.elementType=z,u.lanes=V,u;case w:return Sa(y.children,L,V,f);case C:te=8,L|=24;break;case E:return u=Qn(12,y,f,L|2),u.elementType=E,u.lanes=V,u;case R:return u=Qn(13,y,f,L),u.elementType=R,u.lanes=V,u;case P:return u=Qn(19,y,f,L),u.elementType=P,u.lanes=V,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:te=10;break e;case T:te=9;break e;case k:te=11;break e;case B:te=14;break e;case F:te=16,x=null;break e}te=29,y=Error(i(130,u===null?"null":typeof u,"")),x=null}return f=Qn(te,y,f,L),f.elementType=u,f.type=x,f.lanes=V,f}function Sa(u,f,y,x){return u=Qn(7,u,x,f),u.lanes=y,u}function rh(u,f,y){return u=Qn(6,u,null,f),u.lanes=y,u}function Zf(u){var f=Qn(18,null,null,0);return f.stateNode=u,f}function oh(u,f,y){return f=Qn(4,u.children!==null?u.children:[],u.key,f),f.lanes=y,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}var Qf=new WeakMap;function qr(u,f){if(typeof u=="object"&&u!==null){var y=Qf.get(u);return y!==void 0?y:(f={value:u,source:f,stack:Ne(f)},Qf.set(u,f),f)}return{value:u,source:f,stack:Ne(f)}}var il=[],sl=0,Ui=null,ls=0,Bi=[],xi=0,lr=null,Is=1,Sr="";function rl(u,f){il[sl++]=ls,il[sl++]=Ui,Ui=u,ls=f}function Mw(u,f,y){Bi[xi++]=Is,Bi[xi++]=Sr,Bi[xi++]=lr,lr=u;var x=Is;u=Sr;var L=32-zt(x)-1;x&=~(1<<L),y+=1;var V=32-zt(f)+L;if(30<V){var te=L-L%5;V=(x&(1<<te)-1).toString(32),x>>=te,L-=te,Is=1<<32-zt(f)+L|y<<L|x,Sr=V+u}else Is=1<<V|y<<L|x,Sr=u}function X1(u){u.return!==null&&(rl(u,1),Mw(u,1,0))}function J1(u){for(;u===Ui;)Ui=il[--sl],il[sl]=null,ls=il[--sl],il[sl]=null;for(;u===lr;)lr=Bi[--xi],Bi[xi]=null,Sr=Bi[--xi],Bi[xi]=null,Is=Bi[--xi],Bi[xi]=null}function Lw(u,f){Bi[xi++]=Is,Bi[xi++]=Sr,Bi[xi++]=lr,Is=f.id,Sr=f.overflow,lr=u}var ur=null,Yi=null,ri=!1,Ql=null,Xo=!1,ey=Error(i(519));function Xl(u){var f=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw es(qr(f,u)),ey}function $w(u){var f=u.stateNode,y=u.type,x=u.memoizedProps;switch(f[un]=u,f[_n]=x,y){case"dialog":ai("cancel",f),ai("close",f);break;case"iframe":case"object":case"embed":ai("load",f);break;case"video":case"audio":for(y=0;y<cv.length;y++)ai(cv[y],f);break;case"source":ai("error",f);break;case"img":case"image":case"link":ai("error",f),ai("load",f);break;case"details":ai("toggle",f);break;case"input":ai("invalid",f),zn(f,x.value,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name,!0);break;case"select":ai("invalid",f);break;case"textarea":ai("invalid",f),B1(f,x.value,x.defaultValue,x.children)}y=x.children,typeof y!="string"&&typeof y!="number"&&typeof y!="bigint"||f.textContent===""+y||x.suppressHydrationWarning===!0||BU(f.textContent,y)?(x.popover!=null&&(ai("beforetoggle",f),ai("toggle",f)),x.onScroll!=null&&ai("scroll",f),x.onScrollEnd!=null&&ai("scrollend",f),x.onClick!=null&&(f.onclick=fc),f=!0):f=!1,f||Xl(u,!0)}function Uw(u){for(ur=u.return;ur;)switch(ur.tag){case 5:case 31:case 13:Xo=!1;return;case 27:case 3:Xo=!0;return;default:ur=ur.return}}function ah(u){if(u!==ur)return!1;if(!ri)return Uw(u),ri=!0,!1;var f=u.tag,y;if((y=f!==3&&f!==27)&&((y=f===5)&&(y=u.type,y=!(y!=="form"&&y!=="button")||gA(u.type,u.memoizedProps)),y=!y),y&&Yi&&Xl(u),Uw(u),f===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));Yi=KU(u)}else if(f===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));Yi=KU(u)}else f===27?(f=Yi,u0(u.type)?(u=CA,CA=null,Yi=u):Yi=f):Yi=ur?cl(u.stateNode.nextSibling):null;return!0}function td(){Yi=ur=null,ri=!1}function ty(){var u=Ql;return u!==null&&(Ra===null?Ra=u:Ra.push.apply(Ra,u),Ql=null),u}function es(u){Ql===null?Ql=[u]:Ql.push(u)}var Ro=D(null),Aa=null,mc=null;function gc(u,f,y){H(Ro,f._currentValue),f._currentValue=y}function ol(u){u._currentValue=Ro.current,O(Ro)}function Bw(u,f,y){for(;u!==null;){var x=u.alternate;if((u.childLanes&f)!==f?(u.childLanes|=f,x!==null&&(x.childLanes|=f)):x!==null&&(x.childLanes&f)!==f&&(x.childLanes|=f),u===y)break;u=u.return}}function Fw(u,f,y,x){var L=u.child;for(L!==null&&(L.return=u);L!==null;){var V=L.dependencies;if(V!==null){var te=L.child;V=V.firstContext;e:for(;V!==null;){var ce=V;V=L;for(var me=0;me<f.length;me++)if(ce.context===f[me]){V.lanes|=y,ce=V.alternate,ce!==null&&(ce.lanes|=y),Bw(V.return,y,u),x||(te=null);break e}V=ce.next}}else if(L.tag===18){if(te=L.return,te===null)throw Error(i(341));te.lanes|=y,V=te.alternate,V!==null&&(V.lanes|=y),Bw(te,y,u),te=null}else te=L.child;if(te!==null)te.return=L;else for(te=L;te!==null;){if(te===u){te=null;break}if(L=te.sibling,L!==null){L.return=te.return,te=L;break}te=te.return}L=te}}function ny(u,f,y,x){u=null;for(var L=f,V=!1;L!==null;){if(!V){if((L.flags&524288)!==0)V=!0;else if((L.flags&262144)!==0)break}if(L.tag===10){var te=L.alternate;if(te===null)throw Error(i(387));if(te=te.memoizedProps,te!==null){var ce=L.type;No(L.pendingProps.value,te.value)||(u!==null?u.push(ce):u=[ce])}}else if(L===Y.current){if(te=L.alternate,te===null)throw Error(i(387));te.memoizedState.memoizedState!==L.memoizedState.memoizedState&&(u!==null?u.push(fv):u=[fv])}L=L.return}u!==null&&Fw(f,u,y,x),f.flags|=262144}function U4(u){for(u=u.firstContext;u!==null;){if(!No(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function im(u){Aa=u,mc=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function co(u){return _L(Aa,u)}function B4(u,f){return Aa===null&&im(u),_L(u,f)}function _L(u,f){var y=f._currentValue;if(f={context:f,memoizedValue:y,next:null},mc===null){if(u===null)throw Error(i(308));mc=f,u.dependencies={lanes:0,firstContext:f},u.flags|=524288}else mc=mc.next=f;return y}var cae=typeof AbortController<"u"?AbortController:function(){var u=[],f=this.signal={aborted:!1,addEventListener:function(y,x){u.push(x)}};this.abort=function(){f.aborted=!0,u.forEach(function(y){return y()})}},lae=t.unstable_scheduleCallback,uae=t.unstable_NormalPriority,dr={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function i9(){return{controller:new cae,data:new Map,refCount:0}}function jw(u){u.refCount--,u.refCount===0&&lae(uae,function(){u.controller.abort()})}var Vw=null,s9=0,iy=0,sy=null;function dae(u,f){if(Vw===null){var y=Vw=[];s9=0,iy=aA(),sy={status:"pending",value:void 0,then:function(x){y.push(x)}}}return s9++,f.then(SL,SL),f}function SL(){if(--s9===0&&Vw!==null){sy!==null&&(sy.status="fulfilled");var u=Vw;Vw=null,iy=0,sy=null;for(var f=0;f<u.length;f++)(0,u[f])()}}function hae(u,f){var y=[],x={status:"pending",value:null,reason:null,then:function(L){y.push(L)}};return u.then(function(){x.status="fulfilled",x.value=f;for(var L=0;L<y.length;L++)(0,y[L])(f)},function(L){for(x.status="rejected",x.reason=L,L=0;L<y.length;L++)(0,y[L])(void 0)}),x}var AL=_.S;_.S=function(u,f){lU=ze(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&dae(u,f),AL!==null&&AL(u,f)};var sm=D(null);function r9(){var u=sm.current;return u!==null?u:ts.pooledCache}function F4(u,f){f===null?H(sm,sm.current):H(sm,f.pool)}function TL(){var u=r9();return u===null?null:{parent:dr._currentValue,pool:u}}var ry=Error(i(460)),o9=Error(i(474)),j4=Error(i(542)),V4={then:function(){}};function kL(u){return u=u.status,u==="fulfilled"||u==="rejected"}function NL(u,f,y){switch(y=u[y],y===void 0?u.push(f):y!==f&&(f.then(fc,fc),f=y),f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,PL(u),u;default:if(typeof f.status=="string")f.then(fc,fc);else{if(u=ts,u!==null&&100<u.shellSuspendCounter)throw Error(i(482));u=f,u.status="pending",u.then(function(x){if(f.status==="pending"){var L=f;L.status="fulfilled",L.value=x}},function(x){if(f.status==="pending"){var L=f;L.status="rejected",L.reason=x}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,PL(u),u}throw om=f,ry}}function rm(u){try{var f=u._init;return f(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(om=y,ry):y}}var om=null;function RL(){if(om===null)throw Error(i(459));var u=om;return om=null,u}function PL(u){if(u===ry||u===j4)throw Error(i(483))}var oy=null,Ww=0;function W4(u){var f=Ww;return Ww+=1,oy===null&&(oy=[]),NL(oy,u,f)}function qw(u,f){f=f.props.ref,u.ref=f!==void 0?f:null}function q4(u,f){throw f.$$typeof===p?Error(i(525)):(u=Object.prototype.toString.call(f),Error(i(31,u==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":u)))}function IL(u){function f(Ae,Ce){if(u){var Ie=Ae.deletions;Ie===null?(Ae.deletions=[Ce],Ae.flags|=16):Ie.push(Ce)}}function y(Ae,Ce){if(!u)return null;for(;Ce!==null;)f(Ae,Ce),Ce=Ce.sibling;return null}function x(Ae){for(var Ce=new Map;Ae!==null;)Ae.key!==null?Ce.set(Ae.key,Ae):Ce.set(Ae.index,Ae),Ae=Ae.sibling;return Ce}function L(Ae,Ce){return Ae=ao(Ae,Ce),Ae.index=0,Ae.sibling=null,Ae}function V(Ae,Ce,Ie){return Ae.index=Ie,u?(Ie=Ae.alternate,Ie!==null?(Ie=Ie.index,Ie<Ce?(Ae.flags|=67108866,Ce):Ie):(Ae.flags|=67108866,Ce)):(Ae.flags|=1048576,Ce)}function te(Ae){return u&&Ae.alternate===null&&(Ae.flags|=67108866),Ae}function ce(Ae,Ce,Ie,Ze){return Ce===null||Ce.tag!==6?(Ce=rh(Ie,Ae.mode,Ze),Ce.return=Ae,Ce):(Ce=L(Ce,Ie),Ce.return=Ae,Ce)}function me(Ae,Ce,Ie,Ze){var dn=Ie.type;return dn===w?qe(Ae,Ce,Ie.props.children,Ze,Ie.key):Ce!==null&&(Ce.elementType===dn||typeof dn=="object"&&dn!==null&&dn.$$typeof===F&&rm(dn)===Ce.type)?(Ce=L(Ce,Ie.props),qw(Ce,Ie),Ce.return=Ae,Ce):(Ce=Zl(Ie.type,Ie.key,Ie.props,null,Ae.mode,Ze),qw(Ce,Ie),Ce.return=Ae,Ce)}function De(Ae,Ce,Ie,Ze){return Ce===null||Ce.tag!==4||Ce.stateNode.containerInfo!==Ie.containerInfo||Ce.stateNode.implementation!==Ie.implementation?(Ce=oh(Ie,Ae.mode,Ze),Ce.return=Ae,Ce):(Ce=L(Ce,Ie.children||[]),Ce.return=Ae,Ce)}function qe(Ae,Ce,Ie,Ze,dn){return Ce===null||Ce.tag!==7?(Ce=Sa(Ie,Ae.mode,Ze,dn),Ce.return=Ae,Ce):(Ce=L(Ce,Ie),Ce.return=Ae,Ce)}function Je(Ae,Ce,Ie){if(typeof Ce=="string"&&Ce!==""||typeof Ce=="number"||typeof Ce=="bigint")return Ce=rh(""+Ce,Ae.mode,Ie),Ce.return=Ae,Ce;if(typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case g:return Ie=Zl(Ce.type,Ce.key,Ce.props,null,Ae.mode,Ie),qw(Ie,Ce),Ie.return=Ae,Ie;case b:return Ce=oh(Ce,Ae.mode,Ie),Ce.return=Ae,Ce;case F:return Ce=rm(Ce),Je(Ae,Ce,Ie)}if(v(Ce)||G(Ce))return Ce=Sa(Ce,Ae.mode,Ie,null),Ce.return=Ae,Ce;if(typeof Ce.then=="function")return Je(Ae,W4(Ce),Ie);if(Ce.$$typeof===A)return Je(Ae,B4(Ae,Ce),Ie);q4(Ae,Ce)}return null}function Le(Ae,Ce,Ie,Ze){var dn=Ce!==null?Ce.key:null;if(typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint")return dn!==null?null:ce(Ae,Ce,""+Ie,Ze);if(typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case g:return Ie.key===dn?me(Ae,Ce,Ie,Ze):null;case b:return Ie.key===dn?De(Ae,Ce,Ie,Ze):null;case F:return Ie=rm(Ie),Le(Ae,Ce,Ie,Ze)}if(v(Ie)||G(Ie))return dn!==null?null:qe(Ae,Ce,Ie,Ze,null);if(typeof Ie.then=="function")return Le(Ae,Ce,W4(Ie),Ze);if(Ie.$$typeof===A)return Le(Ae,Ce,B4(Ae,Ie),Ze);q4(Ae,Ie)}return null}function je(Ae,Ce,Ie,Ze,dn){if(typeof Ze=="string"&&Ze!==""||typeof Ze=="number"||typeof Ze=="bigint")return Ae=Ae.get(Ie)||null,ce(Ce,Ae,""+Ze,dn);if(typeof Ze=="object"&&Ze!==null){switch(Ze.$$typeof){case g:return Ae=Ae.get(Ze.key===null?Ie:Ze.key)||null,me(Ce,Ae,Ze,dn);case b:return Ae=Ae.get(Ze.key===null?Ie:Ze.key)||null,De(Ce,Ae,Ze,dn);case F:return Ze=rm(Ze),je(Ae,Ce,Ie,Ze,dn)}if(v(Ze)||G(Ze))return Ae=Ae.get(Ie)||null,qe(Ce,Ae,Ze,dn,null);if(typeof Ze.then=="function")return je(Ae,Ce,Ie,W4(Ze),dn);if(Ze.$$typeof===A)return je(Ae,Ce,Ie,B4(Ce,Ze),dn);q4(Ce,Ze)}return null}function Gt(Ae,Ce,Ie,Ze){for(var dn=null,Ai=null,Xt=Ce,Kn=Ce=0,ui=null;Xt!==null&&Kn<Ie.length;Kn++){Xt.index>Kn?(ui=Xt,Xt=null):ui=Xt.sibling;var Ti=Le(Ae,Xt,Ie[Kn],Ze);if(Ti===null){Xt===null&&(Xt=ui);break}u&&Xt&&Ti.alternate===null&&f(Ae,Xt),Ce=V(Ti,Ce,Kn),Ai===null?dn=Ti:Ai.sibling=Ti,Ai=Ti,Xt=ui}if(Kn===Ie.length)return y(Ae,Xt),ri&&rl(Ae,Kn),dn;if(Xt===null){for(;Kn<Ie.length;Kn++)Xt=Je(Ae,Ie[Kn],Ze),Xt!==null&&(Ce=V(Xt,Ce,Kn),Ai===null?dn=Xt:Ai.sibling=Xt,Ai=Xt);return ri&&rl(Ae,Kn),dn}for(Xt=x(Xt);Kn<Ie.length;Kn++)ui=je(Xt,Ae,Kn,Ie[Kn],Ze),ui!==null&&(u&&ui.alternate!==null&&Xt.delete(ui.key===null?Kn:ui.key),Ce=V(ui,Ce,Kn),Ai===null?dn=ui:Ai.sibling=ui,Ai=ui);return u&&Xt.forEach(function(m0){return f(Ae,m0)}),ri&&rl(Ae,Kn),dn}function Sn(Ae,Ce,Ie,Ze){if(Ie==null)throw Error(i(151));for(var dn=null,Ai=null,Xt=Ce,Kn=Ce=0,ui=null,Ti=Ie.next();Xt!==null&&!Ti.done;Kn++,Ti=Ie.next()){Xt.index>Kn?(ui=Xt,Xt=null):ui=Xt.sibling;var m0=Le(Ae,Xt,Ti.value,Ze);if(m0===null){Xt===null&&(Xt=ui);break}u&&Xt&&m0.alternate===null&&f(Ae,Xt),Ce=V(m0,Ce,Kn),Ai===null?dn=m0:Ai.sibling=m0,Ai=m0,Xt=ui}if(Ti.done)return y(Ae,Xt),ri&&rl(Ae,Kn),dn;if(Xt===null){for(;!Ti.done;Kn++,Ti=Ie.next())Ti=Je(Ae,Ti.value,Ze),Ti!==null&&(Ce=V(Ti,Ce,Kn),Ai===null?dn=Ti:Ai.sibling=Ti,Ai=Ti);return ri&&rl(Ae,Kn),dn}for(Xt=x(Xt);!Ti.done;Kn++,Ti=Ie.next())Ti=je(Xt,Ae,Kn,Ti.value,Ze),Ti!==null&&(u&&Ti.alternate!==null&&Xt.delete(Ti.key===null?Kn:Ti.key),Ce=V(Ti,Ce,Kn),Ai===null?dn=Ti:Ai.sibling=Ti,Ai=Ti);return u&&Xt.forEach(function(Ece){return f(Ae,Ece)}),ri&&rl(Ae,Kn),dn}function Xi(Ae,Ce,Ie,Ze){if(typeof Ie=="object"&&Ie!==null&&Ie.type===w&&Ie.key===null&&(Ie=Ie.props.children),typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case g:e:{for(var dn=Ie.key;Ce!==null;){if(Ce.key===dn){if(dn=Ie.type,dn===w){if(Ce.tag===7){y(Ae,Ce.sibling),Ze=L(Ce,Ie.props.children),Ze.return=Ae,Ae=Ze;break e}}else if(Ce.elementType===dn||typeof dn=="object"&&dn!==null&&dn.$$typeof===F&&rm(dn)===Ce.type){y(Ae,Ce.sibling),Ze=L(Ce,Ie.props),qw(Ze,Ie),Ze.return=Ae,Ae=Ze;break e}y(Ae,Ce);break}else f(Ae,Ce);Ce=Ce.sibling}Ie.type===w?(Ze=Sa(Ie.props.children,Ae.mode,Ze,Ie.key),Ze.return=Ae,Ae=Ze):(Ze=Zl(Ie.type,Ie.ke
vendor: 5,751 bytes, line 49
49y,Ie.props,null,Ae.mode,Ze),qw(Ze,Ie),Ze.return=Ae,Ae=Ze)}return te(Ae);case b:e:{for(dn=Ie.key;Ce!==null;){if(Ce.key===dn)if(Ce.tag===4&&Ce.stateNode.containerInfo===Ie.containerInfo&&Ce.stateNode.implementation===Ie.implementation){y(Ae,Ce.sibling),Ze=L(Ce,Ie.children||[]),Ze.return=Ae,Ae=Ze;break e}else{y(Ae,Ce);break}else f(Ae,Ce);Ce=Ce.sibling}Ze=oh(Ie,Ae.mode,Ze),Ze.return=Ae,Ae=Ze}return te(Ae);case F:return Ie=rm(Ie),Xi(Ae,Ce,Ie,Ze)}if(v(Ie))return Gt(Ae,Ce,Ie,Ze);if(G(Ie)){if(dn=G(Ie),typeof dn!="function")throw Error(i(150));return Ie=dn.call(Ie),Sn(Ae,Ce,Ie,Ze)}if(typeof Ie.then=="function")return Xi(Ae,Ce,W4(Ie),Ze);if(Ie.$$typeof===A)return Xi(Ae,Ce,B4(Ae,Ie),Ze);q4(Ae,Ie)}return typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint"?(Ie=""+Ie,Ce!==null&&Ce.tag===6?(y(Ae,Ce.sibling),Ze=L(Ce,Ie),Ze.return=Ae,Ae=Ze):(y(Ae,Ce),Ze=rh(Ie,Ae.mode,Ze),Ze.return=Ae,Ae=Ze),te(Ae)):y(Ae,Ce)}return function(Ae,Ce,Ie,Ze){try{Ww=0;var dn=Xi(Ae,Ce,Ie,Ze);return oy=null,dn}catch(Xt){if(Xt===ry||Xt===j4)throw Xt;var Ai=Qn(29,Xt,null,Ae.mode);return Ai.lanes=Ze,Ai.return=Ae,Ai}finally{}}}var am=IL(!0),DL=IL(!1),Xf=!1;function a9(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function c9(u,f){u=u.updateQueue,f.updateQueue===u&&(f.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function Jf(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function e0(u,f,y){var x=u.updateQueue;if(x===null)return null;if(x=x.shared,(Ii&2)!==0){var L=x.pending;return L===null?f.next=f:(f.next=L.next,L.next=f),x.pending=f,f=oo(u),Ea(u,null,y),f}return Ht(u,x,f,y),oo(u)}function zw(u,f,y){if(f=f.updateQueue,f!==null&&(f=f.shared,(y&4194048)!==0)){var x=f.lanes;x&=u.pendingLanes,y|=x,f.lanes=y,Ot(u,y)}}function l9(u,f){var y=u.updateQueue,x=u.alternate;if(x!==null&&(x=x.updateQueue,y===x)){var L=null,V=null;if(y=y.firstBaseUpdate,y!==null){do{var te={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};V===null?L=V=te:V=V.next=te,y=y.next}while(y!==null);V===null?L=V=f:V=V.next=f}else L=V=f;y={baseState:x.baseState,firstBaseUpdate:L,lastBaseUpdate:V,shared:x.shared,callbacks:x.callbacks},u.updateQueue=y;return}u=y.lastBaseUpdate,u===null?y.firstBaseUpdate=f:u.next=f,y.lastBaseUpdate=f}var u9=!1;function Hw(){if(u9){var u=sy;if(u!==null)throw u}}function Gw(u,f,y,x){u9=!1;var L=u.updateQueue;Xf=!1;var V=L.firstBaseUpdate,te=L.lastBaseUpdate,ce=L.shared.pending;if(ce!==null){L.shared.pending=null;var me=ce,De=me.next;me.next=null,te===null?V=De:te.next=De,te=me;var qe=u.alternate;qe!==null&&(qe=qe.updateQueue,ce=qe.lastBaseUpdate,ce!==te&&(ce===null?qe.firstBaseUpdate=De:ce.next=De,qe.lastBaseUpdate=me))}if(V!==null){var Je=L.baseState;te=0,qe=De=me=null,ce=V;do{var Le=ce.lane&-536870913,je=Le!==ce.lane;if(je?(li&Le)===Le:(x&Le)===Le){Le!==0&&Le===iy&&(u9=!0),qe!==null&&(qe=qe.next={lane:0,tag:ce.tag,payload:ce.payload,callback:null,next:null});e:{var Gt=u,Sn=ce;Le=f;var Xi=y;switch(Sn.tag){case 1:if(Gt=Sn.payload,typeof Gt=="function"){Je=Gt.call(Xi,Je,Le);break e}Je=Gt;break e;case 3:Gt.flags=Gt.flags&-65537|128;case 0:if(Gt=Sn.payload,Le=typeof Gt=="function"?Gt.call(Xi,Je,Le):Gt,Le==null)break e;Je=h({},Je,Le);break e;case 2:Xf=!0}}Le=ce.callback,Le!==null&&(u.flags|=64,je&&(u.flags|=8192),je=L.callbacks,je===null?L.callbacks=[Le]:je.push(Le))}else je={lane:Le,tag:ce.tag,payload:ce.payload,callback:ce.callback,next:null},qe===null?(De=qe=je,me=Je):qe=qe.next=je,te|=Le;if(ce=ce.next,ce===null){if(ce=L.shared.pending,ce===null)break;je=ce,ce=je.next,je.next=null,L.lastBaseUpdate=je,L.shared.pending=null}}while(!0);qe===null&&(me=Je),L.baseState=me,L.firstBaseUpdate=De,L.lastBaseUpdate=qe,V===null&&(L.shared.lanes=0),r0|=te,u.lanes=te,u.memoizedState=Je}}function OL(u,f){if(typeof u!="function")throw Error(i(191,u));u.call(f)}function ML(u,f){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)OL(y[u],f)}var ay=D(null),z4=D(0);function LL(u,f){u=gh,H(z4,u),H(ay,f),gh=u|f.baseLanes}function d9(){H(z4,gh),H(ay,ay.current)}function h9(){gh=z4.current,O(ay),O(z4)}var yc=D(null),al=null;function t0(u){var f=u.alternate;H(Xs,Xs.current&1),H(yc,u),al===null&&(f===null||ay.current!==null||f.memoizedState!==null)&&(al=u)}function f9(u){H(Xs,Xs.current),H(yc,u),al===null&&(al=u)}function $L(u){u.tag===22?(H(Xs,Xs.current),H(yc,u),al===null&&(al=u)):n0()}function n0(){H(Xs,Xs.current),H(yc,yc.current)}function bc(u){O(yc),al===u&&(al=null),O(Xs)}var Xs=D(0);function H4(u){for(var f=u;f!==null;){if(f.tag===13){var y=f.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||wA(y)||vA(y)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var ch=0,Hn=null,Zi=null,hr=null,G4=!1,cy=!1,cm=!1,K4=0,Kw=0,ly=null,fae=0;function Bs(){throw Error(i(321))}function p9(u,f){if(f===null)return!1;for(var y=0;y<f.length&&y<u.length;y++)if(!No(u[y],f[y]))return!1;return!0}function m9(u,f,y,x,L,V){return ch=V,Hn=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,_.H=u===null||u.memoizedState===null?v$:R9,cm=!1,V=y(x,L),cm=!1,cy&&(V=BL(f,y,x,L)),UL(u),V}function UL(u){_.H=Qw;var f=Zi!==null&&Zi.next!==null;if(ch=0,hr=Zi=Hn=null,G4=!1,Kw=0,ly=null,f)throw Error(i(300));
vendor: 17,793 bytes, line 49
49u===null||fr||(u=u.dependencies,u!==null&&U4(u)&&(fr=!0))}function BL(u,f,y,x){Hn=u;var L=0;do{if(cy&&(ly=null),Kw=0,cy=!1,25<=L)throw Error(i(301));if(L+=1,hr=Zi=null,u.updateQueue!=null){var V=u.updateQueue;V.lastEffect=null,V.events=null,V.stores=null,V.memoCache!=null&&(V.memoCache.index=0)}_.H=C$,V=f(y,x)}while(cy);return V}function pae(){var u=_.H,f=u.useState()[0];return f=typeof f.then=="function"?Yw(f):f,u=u.useState()[0],(Zi!==null?Zi.memoizedState:null)!==u&&(Hn.flags|=1024),f}function g9(){var u=K4!==0;return K4=0,u}function y9(u,f,y){f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~y}function b9(u){if(G4){for(u=u.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}G4=!1}ch=0,hr=Zi=Hn=null,cy=!1,Kw=K4=0,ly=null}function Jo(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return hr===null?Hn.memoizedState=hr=u:hr=hr.next=u,hr}function Js(){if(Zi===null){var u=Hn.alternate;u=u!==null?u.memoizedState:null}else u=Zi.next;var f=hr===null?Hn.memoizedState:hr.next;if(f!==null)hr=f,Zi=u;else{if(u===null)throw Hn.alternate===null?Error(i(467)):Error(i(310));Zi=u,u={memoizedState:Zi.memoizedState,baseState:Zi.baseState,baseQueue:Zi.baseQueue,queue:Zi.queue,next:null},hr===null?Hn.memoizedState=hr=u:hr=hr.next=u}return hr}function Y4(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yw(u){var f=Kw;return Kw+=1,ly===null&&(ly=[]),u=NL(ly,u,f),f=Hn,(hr===null?f.memoizedState:hr.next)===null&&(f=f.alternate,_.H=f===null||f.memoizedState===null?v$:R9),u}function Z4(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return Yw(u);if(u.$$typeof===A)return co(u)}throw Error(i(438,String(u)))}function w9(u){var f=null,y=Hn.updateQueue;if(y!==null&&(f=y.memoCache),f==null){var x=Hn.alternate;x!==null&&(x=x.updateQueue,x!==null&&(x=x.memoCache,x!=null&&(f={data:x.data.map(function(L){return L.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),y===null&&(y=Y4(),Hn.updateQueue=y),y.memoCache=f,y=f.data[f.index],y===void 0)for(y=f.data[f.index]=Array(u),x=0;x<u;x++)y[x]=K;return f.index++,y}function lh(u,f){return typeof f=="function"?f(u):f}function Q4(u){var f=Js();return v9(f,Zi,u)}function v9(u,f,y){var x=u.queue;if(x===null)throw Error(i(311));x.lastRenderedReducer=y;var L=u.baseQueue,V=x.pending;if(V!==null){if(L!==null){var te=L.next;L.next=V.next,V.next=te}f.baseQueue=L=V,x.pending=null}if(V=u.baseState,L===null)u.memoizedState=V;else{f=L.next;var ce=te=null,me=null,De=f,qe=!1;do{var Je=De.lane&-536870913;if(Je!==De.lane?(li&Je)===Je:(ch&Je)===Je){var Le=De.revertLane;if(Le===0)me!==null&&(me=me.next={lane:0,revertLane:0,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),Je===iy&&(qe=!0);else if((ch&Le)===Le){De=De.next,Le===iy&&(qe=!0);continue}else Je={lane:0,revertLane:De.revertLane,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},me===null?(ce=me=Je,te=V):me=me.next=Je,Hn.lanes|=Le,r0|=Le;Je=De.action,cm&&y(V,Je),V=De.hasEagerState?De.eagerState:y(V,Je)}else Le={lane:Je,revertLane:De.revertLane,gesture:De.gesture,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},me===null?(ce=me=Le,te=V):me=me.next=Le,Hn.lanes|=Je,r0|=Je;De=De.next}while(De!==null&&De!==f);if(me===null?te=V:me.next=ce,!No(V,u.memoizedState)&&(fr=!0,qe&&(y=sy,y!==null)))throw y;u.memoizedState=V,u.baseState=te,u.baseQueue=me,x.lastRenderedState=V}return L===null&&(x.lanes=0),[u.memoizedState,x.dispatch]}function C9(u){var f=Js(),y=f.queue;if(y===null)throw Error(i(311));y.lastRenderedReducer=u;var x=y.dispatch,L=y.pending,V=f.memoizedState;if(L!==null){y.pending=null;var te=L=L.next;do V=u(V,te.action),te=te.next;while(te!==L);No(V,f.memoizedState)||(fr=!0),f.memoizedState=V,f.baseQueue===null&&(f.baseState=V),y.lastRenderedState=V}return[V,x]}function FL(u,f,y){var x=Hn,L=Js(),V=ri;if(V){if(y===void 0)throw Error(i(407));y=y()}else y=f();var te=!No((Zi||L).memoizedState,y);if(te&&(L.memoizedState=y,fr=!0),L=L.queue,_9(WL.bind(null,x,L,u),[u]),L.getSnapshot!==f||te||hr!==null&&hr.memoizedState.tag&1){if(x.flags|=2048,uy(9,{destroy:void 0},VL.bind(null,x,L,y,f),null),ts===null)throw Error(i(349));V||(ch&127)!==0||jL(x,f,y)}return y}function jL(u,f,y){u.flags|=16384,u={getSnapshot:f,value:y},f=Hn.updateQueue,f===null?(f=Y4(),Hn.updateQueue=f,f.stores=[u]):(y=f.stores,y===null?f.stores=[u]:y.push(u))}function VL(u,f,y,x){f.value=y,f.getSnapshot=x,qL(f)&&zL(u)}function WL(u,f,y){return y(function(){qL(f)&&zL(u)})}function qL(u){var f=u.getSnapshot;u=u.value;try{var y=f();return!No(u,y)}catch{return!0}}function zL(u){var f=Ci(u,2);f!==null&&Pa(f,u,2)}function x9(u){var f=Jo();if(typeof u=="function"){var y=u;if(u=y(),cm){At(!0);try{y()}finally{At(!1)}}}return f.memoizedState=f.baseState=u,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:lh,lastRenderedState:u},f}function HL(u,f,y,x){return u.baseState=y,v9(u,Zi,typeof x=="function"?x:lh)}function mae(u,f,y,x,L){if(eC(u))throw Error(i(485));if(u=f.action,u!==null){var V={payload:L,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(te){V.listeners.push(te)}};_.T!==null?y(!0):V.isTransition=!1,x(V),y=f.pending,y===null?(V.next=f.pending=V,GL(f,V)):(V.next=y.next,f.pending=y.next=V)}}function GL(u,f){var y=f.action,x=f.payload,L=u.state;if(f.isTransition){var V=_.T,te={};_.T=te;try{var ce=y(L,x),me=_.S;me!==null&&me(te,ce),KL(u,f,ce)}catch(De){E9(u,f,De)}finally{V!==null&&te.types!==null&&(V.types=te.types),_.T=V}}else try{V=y(L,x),KL(u,f,V)}catch(De){E9(u,f,De)}}function KL(u,f,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(x){YL(u,f,x)},function(x){return E9(u,f,x)}):YL(u,f,y)}function YL(u,f,y){f.status="fulfilled",f.value=y,ZL(f),u.state=y,f=u.pending,f!==null&&(y=f.next,y===f?u.pending=null:(y=y.next,f.next=y,GL(u,y)))}function E9(u,f,y){var x=u.pending;if(u.pending=null,x!==null){x=x.next;do f.status="rejected",f.reason=y,ZL(f),f=f.next;while(f!==x)}u.action=null}function ZL(u){u=u.listeners;for(var f=0;f<u.length;f++)(0,u[f])()}function QL(u,f){return f}function XL(u,f){if(ri){var y=ts.formState;if(y!==null){e:{var x=Hn;if(ri){if(Yi){t:{for(var L=Yi,V=Xo;L.nodeType!==8;){if(!V){L=null;break t}if(L=cl(L.nextSibling),L===null){L=null;break t}}V=L.data,L=V==="F!"||V==="F"?L:null}if(L){Yi=cl(L.nextSibling),x=L.data==="F!";break e}}Xl(x)}x=!1}x&&(f=y[0])}}return y=Jo(),y.memoizedState=y.baseState=f,x={pending:null,lanes:0,dispatch:null,lastRenderedReducer:QL,lastRenderedState:f},y.queue=x,y=y$.bind(null,Hn,x),x.dispatch=y,x=x9(!1),V=N9.bind(null,Hn,!1,x.queue),x=Jo(),L={state:f,dispatch:null,action:u,pending:null},x.queue=L,y=mae.bind(null,Hn,L,V,y),L.dispatch=y,x.memoizedState=u,[f,y,!1]}function JL(u){var f=Js();return e$(f,Zi,u)}function e$(u,f,y){if(f=v9(u,f,QL)[0],u=Q4(lh)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var x=Yw(f)}catch(te){throw te===ry?j4:te}else x=f;f=Js();var L=f.queue,V=L.dispatch;return y!==f.memoizedState&&(Hn.flags|=2048,uy(9,{destroy:void 0},gae.bind(null,L,y),null)),[x,V,u]}function gae(u,f){u.action=f}function t$(u){var f=Js(),y=Zi;if(y!==null)return e$(f,y,u);Js(),f=f.memoizedState,y=Js();var x=y.queue.dispatch;return y.memoizedState=u,[f,x,!1]}function uy(u,f,y,x){return u={tag:u,create:y,deps:x,inst:f,next:null},f=Hn.updateQueue,f===null&&(f=Y4(),Hn.updateQueue=f),y=f.lastEffect,y===null?f.lastEffect=u.next=u:(x=y.next,y.next=u,u.next=x,f.lastEffect=u),u}function n$(){return Js().memoizedState}function X4(u,f,y,x){var L=Jo();Hn.flags|=u,L.memoizedState=uy(1|f,{destroy:void 0},y,x===void 0?null:x)}function J4(u,f,y,x){var L=Js();x=x===void 0?null:x;var V=L.memoizedState.inst;Zi!==null&&x!==null&&p9(x,Zi.memoizedState.deps)?L.memoizedState=uy(f,V,y,x):(Hn.flags|=u,L.memoizedState=uy(1|f,V,y,x))}function i$(u,f){X4(8390656,8,u,f)}function _9(u,f){J4(2048,8,u,f)}function yae(u){Hn.flags|=4;var f=Hn.updateQueue;if(f===null)f=Y4(),Hn.updateQueue=f,f.events=[u];else{var y=f.events;y===null?f.events=[u]:y.push(u)}}function s$(u){var f=Js().memoizedState;return yae({ref:f,nextImpl:u}),function(){if((Ii&2)!==0)throw Error(i(440));return f.impl.apply(void 0,arguments)}}function r$(u,f){return J4(4,2,u,f)}function o$(u,f){return J4(4,4,u,f)}function a$(u,f){if(typeof f=="function"){u=u();var y=f(u);return function(){typeof y=="function"?y():f(null)}}if(f!=null)return u=u(),f.current=u,function(){f.current=null}}function c$(u,f,y){y=y!=null?y.concat([u]):null,J4(4,4,a$.bind(null,f,u),y)}function S9(){}function l$(u,f){var y=Js();f=f===void 0?null:f;var x=y.memoizedState;return f!==null&&p9(f,x[1])?x[0]:(y.memoizedState=[u,f],u)}function u$(u,f){var y=Js();f=f===void 0?null:f;var x=y.memoizedState;if(f!==null&&p9(f,x[1]))return x[0];if(x=u(),cm){At(!0);try{u()}finally{At(!1)}}return y.memoizedState=[x,f],x}function A9(u,f,y){return y===void 0||(ch&1073741824)!==0&&(li&261930)===0?u.memoizedState=f:(u.memoizedState=y,u=dU(),Hn.lanes|=u,r0|=u,y)}function d$(u,f,y,x){return No(y,f)?y:ay.current!==null?(u=A9(u,y,x),No(u,f)||(fr=!0),u):(ch&42)===0||(ch&1073741824)!==0&&(li&261930)===0?(fr=!0,u.memoizedState=y):(u=dU(),Hn.lanes|=u,r0|=u,f)}function h$(u,f,y,x,L){var V=N.p;N.p=V!==0&&8>V?V:8;var te=_.T,ce={};_.T=ce,N9(u,!1,f,y);try{var me=L(),De=_.S;if(De!==null&&De(ce,me),me!==null&&typeof me=="object"&&typeof me.then=="function"){var qe=hae(me,x);Zw(u,f,qe,Cc(u))}else Zw(u,f,x,Cc(u))}catch(Je){Zw(u,f,{then:function(){},status:"rejected",reason:Je},Cc())}finally{N.p=V,te!==null&&ce.types!==null&&(te.types=ce.types),_.T=te}}function bae(){}function T9(u,f,y,x){if(u.tag!==5)throw Error(i(476));var L=f$(u).queue;h$(u,L,f,$,y===null?bae:function(){return p$(u),y(x)})}function f$(u){var f=u.memoizedState;if(f!==null)return f;f={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:lh,lastRenderedState:$},next:null};var y={};return f.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:lh,lastRenderedState:y},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function p$(u){var f=f$(u);f.next===null&&(f=u.alternate.memoizedState),Zw(u,f.next.queue,{},Cc())}function k9(){return co(fv)}function m$(){return Js().memoizedState}function g$(){return Js().memoizedState}function wae(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var y=Cc();u=Jf(y);var x=e0(f,u,y);x!==null&&(Pa(x,f,y),zw(x,f,y)),f={cache:i9()},u.payload=f;return}f=f.return}}function vae(u,f,y){var x=Cc();y={lane:x,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},eC(u)?b$(f,y):(y=qn(u,f,y,x),y!==null&&(Pa(y,u,x),w$(y,f,x)))}function y$(u,f,y){var x=Cc();Zw(u,f,y,x)}function Zw(u,f,y,x){var L={lane:x,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(eC(u))b$(f,L);else{var V=u.alternate;if(u.lanes===0&&(V===null||V.lanes===0)&&(V=f.lastRenderedReducer,V!==null))try{var te=f.lastRenderedState,ce=V(te,y);if(L.hasEagerState=!0,L.eagerState=ce,No(ce,te))return Ht(u,f,L,0),ts===null&&St(),!1}catch{}finally{}if(y=qn(u,f,L,x),y!==null)return Pa(y,u,x),w$(y,f,x),!0}return!1}function N9(u,f,y,x){if(x={lane:2,revertLane:aA(),gesture:null,action:x,hasEagerState:!1,eagerState:null,next:null},eC(u)){if(f)throw Error(i(479))}else f=qn(u,y,x,2),f!==null&&Pa(f,u,2)}function eC(u){var f=u.alternate;return u===Hn||f!==null&&f===Hn}function b$(u,f){cy=G4=!0;var y=u.pending;y===null?f.next=f:(f.next=y.next,y.next=f),u.pending=f}function w$(u,f,y){if((y&4194048)!==0){var x=f.lanes;x&=u.pendingLanes,y|=x,f.lanes=y,Ot(u,y)}}var Qw={readContext:co,use:Z4,useCallback:Bs,useContext:Bs,useEffect:Bs,useImperativeHandle:Bs,useLayoutEffect:Bs,useInsertionEffect:Bs,useMemo:Bs,useReducer:Bs,useRef:Bs,useState:Bs,useDebugValue:Bs,useDeferredValue:Bs,useTransition:Bs,useSyncExternalStore:Bs,useId:Bs,useHostTransitionStatus:Bs,useFormState:Bs,useActionState:Bs,useOptimistic:Bs,useMemoCache:Bs,useCacheRefresh:Bs};Qw.useEffectEvent=Bs;var v$={readContext:co,use:Z4,useCallback:function(u,f){return Jo().memoizedState=[u,f===void 0?null:f],u},useContext:co,useEffect:i$,useImperativeHandle:function(u,f,y){y=y!=null?y.concat([u]):null,X4(4194308,4,a$.bind(null,f,u),y)},useLayoutEffect:function(u,f){return X4(4194308,4,u,f)},useInsertionEffect:function(u,f){X4(4,2,u,f)},useMemo:function(u,f){var y=Jo();f=f===void 0?null:f;var x=u();if(cm){At(!0);try{u()}finally{At(!1)}}return y.memoizedState=[x,f],x},useReducer:function(u,f,y){var x=Jo();if(y!==void 0){var L=y(f);if(cm){At(!0);try{y(f)}finally{At(!1)}}}else L=f;return x.memoizedState=x.baseState=L,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:L},x.queue=u,u=u.dispatch=vae.bind(null,Hn,u),[x.memoizedState,u]},useRef:function(u){var f=Jo();return u={current:u},f.memoizedState=u},useState:function(u){u=x9(u);var f=u.queue,y=y$.bind(null,Hn,f);return f.dispatch=y,[u.memoizedState,y]},useDebugValue:S9,useDeferredValue:function(u,f){var y=Jo();return A9(y,u,f)},useTransition:function(){var u=x9(!1);return u=h$.bind(null,Hn,u.queue,!0,!1),Jo().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,y){var x=Hn,L=Jo();if(ri){if(y===void 0)throw Error(i(407));y=y()}else{if(y=f(),ts===null)throw Error(i(349));(li&127)!==0||jL(x,f,y)}L.memoizedState=y;var V={value:y,getSnapshot:f};return L.queue=V,i$(WL.bind(null,x,V,u),[u]),x.flags|=2048,uy(9,{destroy:void 0},VL.bind(null,x,V,y,f),null),y},useId:function(){var u=Jo(),f=ts.identifierPrefix;if(ri){var y=Sr,x=Is;y=(x&~(1<<32-zt(x)-1)).toString(32)+y,f="_"+f+"R_"+y,y=K4++,0<y&&(f+="H"+y.toString(32)),f+="_"}else y=fae++,f="_"+f+"r_"+y.toString(32)+"_";return u.memoizedState=f},useHostTransitionStatus:k9,useFormState:XL,useActionState:XL,useOptimistic:function(u){var f=Jo();f.memoizedState=f.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=y,f=N9.bind(null,Hn,!0,y),y.dispatch=f,[u,f]},useMemoCache:w9,useCacheRefresh:function(){return Jo().memoizedState=wae.bind(null,Hn)},useEffectEvent:function(u){var f=Jo(),y={impl:u};return f.memoizedState=y,function(){if((Ii&2)!==0)throw Error(i(440));return y.impl.apply(void 0,arguments)}}},R9={readContext:co,use:Z4,useCallback:l$,useContext:co,useEffect:_9,useImperativeHandle:c$,useInsertionEffect:r$,useLayoutEffect:o$,useMemo:u$,useReducer:Q4,useRef:n$,useState:function(){return Q4(lh)},useDebugValue:S9,useDeferredValue:function(u,f){var y=Js();return d$(y,Zi.memoizedState,u,f)},useTransition:function(){var u=Q4(lh)[0],f=Js().memoizedState;return[typeof u=="boolean"?u:Yw(u),f]},useSyncExternalStore:FL,useId:m$,useHostTransitionStatus:k9,useFormState:JL,useActionState:JL,useOptimistic:function(u,f){var y=Js();return HL(y,Zi,u,f)},useMemoCache:w9,useCacheRefresh:g$};R9.useEffectEvent=s$;var C$={readContext:co,use:Z4,useCallback:l$,useContext:co,useEffect:_9,useImperativeHandle:c$,useInsertionEffect:r$,useLayoutEffect:o$,useMemo:u$,useReducer:C9,useRef:n$,useState:function(){return C9(lh)},useDebugValue:S9,useDeferredValue:function(u,f){var y=Js();return Zi===null?A9(y,u,f):d$(y,Zi.memoizedState,u,f)},useTransition:function(){var u=C9(lh)[0],f=Js().memoizedState;return[typeof u=="boolean"?u:Yw(u),f]},useSyncExternalStore:FL,useId:m$,useHostTransitionStatus:k9,useFormState:t$,useActionState:t$,useOptimistic:function(u,f){var y=Js();return Zi!==null?HL(y,Zi,u,f):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:w9,useCacheRefresh:g$};C$.useEffectEvent=s$;function P9(u,f,y,x){f=u.memoizedState,y=y(x,f),y=y==null?f:h({},f,y),u.memoizedState=y,u.lanes===0&&(u.updateQueue.baseState=y)}var I9={enqueueSetState:function(u,f,y){u=u._reactInternals;var x=Cc(),L=Jf(x);L.payload=f,y!=null&&(L.callback=y),f=e0(u,L,x),f!==null&&(Pa(f,u,x),zw(f,u,x))},enqueueReplaceState:function(u,f,y){u=u._reactInternals;var x=Cc(),L=Jf(x);L.tag=1,L.payload=f,y!=null&&(L.callback=y),f=e0(u,L,x),f!==null&&(Pa(f,u,x),zw(f,u,x))},enqueueForceUpdate:function(u,f){u=u._reactInternals;var y=Cc(),x=Jf(y);x.tag=2,f!=null&&(x.callback=f),f=e0(u,x,y),f!==null&&(Pa(f,u,y),zw(f,u,y))}};function x$(u,f,y,x,L,V,te){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(x,V,te):f.prototype&&f.prototype.isPureReactComponent?!Kf(y,x)||!Kf(L,V):!0}function E$(u,f,y,x){u=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(y,x),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(y,x),f.state!==u&&I9.enqueueReplaceState(f,f.state,null)}function lm(u,f){var y=f;if("ref"in f){y={};for(var x in f)x!=="ref"&&(y[x]=f[x])}if(u=u.defaultProps){y===f&&(y=h({},y));for(var L in u)y[L]===void 0&&(y[L]=u[L])}return y}function _$(u){fe(u)}function S$(u){console.error(u)}function A$(u){fe(u)}function tC(u,f){try{var y=u.onUncaughtError;y(f.value,{componentStack:f.stack})}catch(x){setTimeout(function(){throw x})}}function T$(u,f,y){try{var x=u.onCaughtError;x(y.value,{componentStack:y.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(L){setTimeout(function(){throw L})}}function D9(u,f,y){return y=Jf(y),y.tag=3,y.payload={element:null},y.callback=function(){tC(u,f)},y}function k$(u){return u=Jf(u),u.tag=3,u}function N$(u,f,y,x){var L=y.type.getDerivedStateFromError;if(typeof L=="function"){var V=x.value;u.payload=function(){return L(V)},u.callback=function(){T$(f,y,x)}}var te=y.stateNode;te!==null&&typeof te.componentDidCatch=="function"&&(u.callback=function(){T$(f,y,x),typeof L!="function"&&(o0===null?o0=new Set([this]):o0.add(this));var ce=x.stack;this.componentDidCatch(x.value,{componentStack:ce!==null?ce:""})})}
vendor: 21,491 bytes, line 49
49function Cae(u,f,y,x,L){if(y.flags|=32768,x!==null&&typeof x=="object"&&typeof x.then=="function"){if(f=y.alternate,f!==null&&ny(f,y,L,!0),y=yc.current,y!==null){switch(y.tag){case 31:case 13:return al===null?fC():y.alternate===null&&Fs===0&&(Fs=3),y.flags&=-257,y.flags|=65536,y.lanes=L,x===V4?y.flags|=16384:(f=y.updateQueue,f===null?y.updateQueue=new Set([x]):f.add(x),sA(u,x,L)),!1;case 22:return y.flags|=65536,x===V4?y.flags|=16384:(f=y.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([x])},y.updateQueue=f):(y=f.retryQueue,y===null?f.retryQueue=new Set([x]):y.add(x)),sA(u,x,L)),!1}throw Error(i(435,y.tag))}return sA(u,x,L),fC(),!1}if(ri)return f=yc.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=L,x!==ey&&(u=Error(i(422),{cause:x}),es(qr(u,y)))):(x!==ey&&(f=Error(i(423),{cause:x}),es(qr(f,y))),u=u.current.alternate,u.flags|=65536,L&=-L,u.lanes|=L,x=qr(x,y),L=D9(u.stateNode,x,L),l9(u,L),Fs!==4&&(Fs=2)),!1;var V=Error(i(520),{cause:x});if(V=qr(V,y),rv===null?rv=[V]:rv.push(V),Fs!==4&&(Fs=2),f===null)return!0;x=qr(x,y),y=f;do{switch(y.tag){case 3:return y.flags|=65536,u=L&-L,y.lanes|=u,u=D9(y.stateNode,x,u),l9(y,u),!1;case 1:if(f=y.type,V=y.stateNode,(y.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||V!==null&&typeof V.componentDidCatch=="function"&&(o0===null||!o0.has(V))))return y.flags|=65536,L&=-L,y.lanes|=L,L=k$(L),N$(L,u,y,x),l9(y,L),!1}y=y.return}while(y!==null);return!1}var O9=Error(i(461)),fr=!1;function lo(u,f,y,x){f.child=u===null?DL(f,null,y,x):am(f,u.child,y,x)}function R$(u,f,y,x,L){y=y.render;var V=f.ref;if("ref"in x){var te={};for(var ce in x)ce!=="ref"&&(te[ce]=x[ce])}else te=x;return im(f),x=m9(u,f,y,te,V,L),ce=g9(),u!==null&&!fr?(y9(u,f,L),uh(u,f,L)):(ri&&ce&&X1(f),f.flags|=1,lo(u,f,x,L),f.child)}function P$(u,f,y,x,L){if(u===null){var V=y.type;return typeof V=="function"&&!_a(V)&&V.defaultProps===void 0&&y.compare===null?(f.tag=15,f.type=V,I$(u,f,V,x,L)):(u=Zl(y.type,null,x,f,f.mode,L),u.ref=f.ref,u.return=f,f.child=u)}if(V=u.child,!V9(u,L)){var te=V.memoizedProps;if(y=y.compare,y=y!==null?y:Kf,y(te,x)&&u.ref===f.ref)return uh(u,f,L)}return f.flags|=1,u=ao(V,x),u.ref=f.ref,u.return=f,f.child=u}function I$(u,f,y,x,L){if(u!==null){var V=u.memoizedProps;if(Kf(V,x)&&u.ref===f.ref)if(fr=!1,f.pendingProps=x=V,V9(u,L))(u.flags&131072)!==0&&(fr=!0);else return f.lanes=u.lanes,uh(u,f,L)}return M9(u,f,y,x,L)}function D$(u,f,y,x){var L=x.children,V=u!==null?u.memoizedState:null;if(u===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),x.mode==="hidden"){if((f.flags&128)!==0){if(V=V!==null?V.baseLanes|y:y,u!==null){for(x=f.child=u.child,L=0;x!==null;)L=L|x.lanes|x.childLanes,x=x.sibling;x=L&~V}else x=0,f.child=null;return O$(u,f,V,y,x)}if((y&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},u!==null&&F4(f,V!==null?V.cachePool:null),V!==null?LL(f,V):d9(),$L(f);else return x=f.lanes=536870912,O$(u,f,V!==null?V.baseLanes|y:y,y,x)}else V!==null?(F4(f,V.cachePool),LL(f,V),n0(),f.memoizedState=null):(u!==null&&F4(f,null),d9(),n0());return lo(u,f,L,y),f.child}function Xw(u,f){return u!==null&&u.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function O$(u,f,y,x,L){var V=r9();return V=V===null?null:{parent:dr._currentValue,pool:V},f.memoizedState={baseLanes:y,cachePool:V},u!==null&&F4(f,null),d9(),$L(f),u!==null&&ny(u,f,x,!0),f.childLanes=L,null}function nC(u,f){return f=sC({mode:f.mode,children:f.children},u.mode),f.ref=u.ref,u.child=f,f.return=u,f}function M$(u,f,y){return am(f,u.child,null,y),u=nC(f,f.pendingProps),u.flags|=2,bc(f),f.memoizedState=null,u}function xae(u,f,y){var x=f.pendingProps,L=(f.flags&128)!==0;if(f.flags&=-129,u===null){if(ri){if(x.mode==="hidden")return u=nC(f,x),f.lanes=536870912,Xw(null,u);if(f9(f),(u=Yi)?(u=GU(u,Xo),u=u!==null&&u.data==="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:lr!==null?{id:Is,overflow:Sr}:null,retryLane:536870912,hydrationErrors:null},y=Zf(u),y.return=f,f.child=y,ur=f,Yi=null)):u=null,u===null)throw Xl(f);return f.lanes=536870912,null}return nC(f,x)}var V=u.memoizedState;if(V!==null){var te=V.dehydrated;if(f9(f),L)if(f.flags&256)f.flags&=-257,f=M$(u,f,y);else if(f.memoizedState!==null)f.child=u.child,f.flags|=128,f=null;else throw Error(i(558));else if(fr||ny(u,f,y,!1),L=(y&u.childLanes)!==0,fr||L){if(x=ts,x!==null&&(te=tn(x,y),te!==0&&te!==V.retryLane))throw V.retryLane=te,Ci(u,te),Pa(x,u,te),O9;fC(),f=M$(u,f,y)}else u=V.treeContext,Yi=cl(te.nextSibling),ur=f,ri=!0,Ql=null,Xo=!1,u!==null&&Lw(f,u),f=nC(f,x),f.flags|=4096;return f}return u=ao(u.child,{mode:x.mode,children:x.children}),u.ref=f.ref,f.child=u,u.return=f,u}function iC(u,f){var y=f.ref;if(y===null)u!==null&&u.ref!==null&&(f.flags|=4194816);else{if(typeof y!="function"&&typeof y!="object")throw Error(i(284));(u===null||u.ref!==y)&&(f.flags|=4194816)}}function M9(u,f,y,x,L){return im(f),y=m9(u,f,y,x,void 0,L),x=g9(),u!==null&&!fr?(y9(u,f,L),uh(u,f,L)):(ri&&x&&X1(f),f.flags|=1,lo(u,f,y,L),f.child)}function L$(u,f,y,x,L,V){return im(f),f.updateQueue=null,y=BL(f,x,y,L),UL(u),x=g9(),u!==null&&!fr?(y9(u,f,V),uh(u,f,V)):(ri&&x&&X1(f),f.flags|=1,lo(u,f,y,V),f.child)}function $$(u,f,y,x,L){if(im(f),f.stateNode===null){var V=cr,te=y.contextType;typeof te=="object"&&te!==null&&(V=co(te)),V=new y(x,V),f.memoizedState=V.state!==null&&V.state!==void 0?V.state:null,V.updater=I9,f.stateNode=V,V._reactInternals=f,V=f.stateNode,V.props=x,V.state=f.memoizedState,V.refs={},a9(f),te=y.contextType,V.context=typeof te=="object"&&te!==null?co(te):cr,V.state=f.memoizedState,te=y.getDerivedStateFromProps,typeof te=="function"&&(P9(f,y,te,x),V.state=f.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof V.getSnapshotBeforeUpdate=="function"||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.componentWillMount!="function"||(te=V.state,typeof V.componentWillMount=="function"&&V.componentWillMount(),typeof V.UNSAFE_componentWillMount=="function"&&V.UNSAFE_componentWillMount(),te!==V.state&&I9.enqueueReplaceState(V,V.state,null),Gw(f,x,V,L),Hw(),V.state=f.memoizedState),typeof V.componentDidMount=="function"&&(f.flags|=4194308),x=!0}else if(u===null){V=f.stateNode;var ce=f.memoizedProps,me=lm(y,ce);V.props=me;var De=V.context,qe=y.contextType;te=cr,typeof qe=="object"&&qe!==null&&(te=co(qe));var Je=y.getDerivedStateFromProps;qe=typeof Je=="function"||typeof V.getSnapshotBeforeUpdate=="function",ce=f.pendingProps!==ce,qe||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(ce||De!==te)&&E$(f,V,x,te),Xf=!1;var Le=f.memoizedState;V.state=Le,Gw(f,x,V,L),Hw(),De=f.memoizedState,ce||Le!==De||Xf?(typeof Je=="function"&&(P9(f,y,Je,x),De=f.memoizedState),(me=Xf||x$(f,y,me,x,Le,De,te))?(qe||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.componentWillMount!="function"||(typeof V.componentWillMount=="function"&&V.componentWillMount(),typeof V.UNSAFE_componentWillMount=="function"&&V.UNSAFE_componentWillMount()),typeof V.componentDidMount=="function"&&(f.flags|=4194308)):(typeof V.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=x,f.memoizedState=De),V.props=x,V.state=De,V.context=te,x=me):(typeof V.componentDidMount=="function"&&(f.flags|=4194308),x=!1)}else{V=f.stateNode,c9(u,f),te=f.memoizedProps,qe=lm(y,te),V.props=qe,Je=f.pendingProps,Le=V.context,De=y.contextType,me=cr,typeof De=="object"&&De!==null&&(me=co(De)),ce=y.getDerivedStateFromProps,(De=typeof ce=="function"||typeof V.getSnapshotBeforeUpdate=="function")||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(te!==Je||Le!==me)&&E$(f,V,x,me),Xf=!1,Le=f.memoizedState,V.state=Le,Gw(f,x,V,L),Hw();var je=f.memoizedState;te!==Je||Le!==je||Xf||u!==null&&u.dependencies!==null&&U4(u.dependencies)?(typeof ce=="function"&&(P9(f,y,ce,x),je=f.memoizedState),(qe=Xf||x$(f,y,qe,x,Le,je,me)||u!==null&&u.dependencies!==null&&U4(u.dependencies))?(De||typeof V.UNSAFE_componentWillUpdate!="function"&&typeof V.componentWillUpdate!="function"||(typeof V.componentWillUpdate=="function"&&V.componentWillUpdate(x,je,me),typeof V.UNSAFE_componentWillUpdate=="function"&&V.UNSAFE_componentWillUpdate(x,je,me)),typeof V.componentDidUpdate=="function"&&(f.flags|=4),typeof V.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof V.componentDidUpdate!="function"||te===u.memoizedProps&&Le===u.memoizedState||(f.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||te===u.memoizedProps&&Le===u.memoizedState||(f.flags|=1024),f.memoizedProps=x,f.memoizedState=je),V.props=x,V.state=je,V.context=me,x=qe):(typeof V.componentDidUpdate!="function"||te===u.memoizedProps&&Le===u.memoizedState||(f.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||te===u.memoizedProps&&Le===u.memoizedState||(f.flags|=1024),x=!1)}return V=x,iC(u,f),x=(f.flags&128)!==0,V||x?(V=f.stateNode,y=x&&typeof y.getDerivedStateFromError!="function"?null:V.render(),f.flags|=1,u!==null&&x?(f.child=am(f,u.child,null,L),f.child=am(f,null,y,L)):lo(u,f,y,L),f.memoizedState=V.state,u=f.child):u=uh(u,f,L),u}function U$(u,f,y,x){return td(),f.flags|=256,lo(u,f,y,x),f.child}var L9={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $9(u){return{baseLanes:u,cachePool:TL()}}function U9(u,f,y){return u=u!==null?u.childLanes&~y:0,f&&(u|=vc),u}function B$(u,f,y){var x=f.pendingProps,L=!1,V=(f.flags&128)!==0,te;if((te=V)||(te=u!==null&&u.memoizedState===null?!1:(Xs.current&2)!==0),te&&(L=!0,f.flags&=-129),te=(f.flags&32)!==0,f.flags&=-33,u===null){if(ri){if(L?t0(f):n0(),(u=Yi)?(u=GU(u,Xo),u=u!==null&&u.data!=="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:lr!==null?{id:Is,overflow:Sr}:null,retryLane:536870912,hydrationErrors:null},y=Zf(u),y.return=f,f.child=y,ur=f,Yi=null)):u=null,u===null)throw Xl(f);return vA(u)?f.lanes=32:f.lanes=536870912,null}var ce=x.children;return x=x.fallback,L?(n0(),L=f.mode,ce=sC({mode:"hidden",children:ce},L),x=Sa(x,L,y,null),ce.return=f,x.return=f,ce.sibling=x,f.child=ce,x=f.child,x.memoizedState=$9(y),x.childLanes=U9(u,te,y),f.memoizedState=L9,Xw(null,x)):(t0(f),B9(f,ce))}var me=u.memoizedState;if(me!==null&&(ce=me.dehydrated,ce!==null)){if(V)f.flags&256?(t0(f),f.flags&=-257,f=F9(u,f,y)):f.memoizedState!==null?(n0(),f.child=u.child,f.flags|=128,f=null):(n0(),ce=x.fallback,L=f.mode,x=sC({mode:"visible",children:x.children},L),ce=Sa(ce,L,y,null),ce.flags|=2,x.return=f,ce.return=f,x.sibling=ce,f.child=x,am(f,u.child,null,y),x=f.child,x.memoizedState=$9(y),x.childLanes=U9(u,te,y),f.memoizedState=L9,f=Xw(null,x));else if(t0(f),vA(ce)){if(te=ce.nextSibling&&ce.nextSibling.dataset,te)var De=te.dgst;te=De,x=Error(i(419)),x.stack="",x.digest=te,es({value:x,source:null,stack:null}),f=F9(u,f,y)}else if(fr||ny(u,f,y,!1),te=(y&u.childLanes)!==0,fr||te){if(te=ts,te!==null&&(x=tn(te,y),x!==0&&x!==me.retryLane))throw me.retryLane=x,Ci(u,x),Pa(te,u,x),O9;wA(ce)||fC(),f=F9(u,f,y)}else wA(ce)?(f.flags|=192,f.child=u.child,f=null):(u=me.treeContext,Yi=cl(ce.nextSibling),ur=f,ri=!0,Ql=null,Xo=!1,u!==null&&Lw(f,u),f=B9(f,x.children),f.flags|=4096);return f}return L?(n0(),ce=x.fallback,L=f.mode,me=u.child,De=me.sibling,x=ao(me,{mode:"hidden",children:x.children}),x.subtreeFlags=me.subtreeFlags&65011712,De!==null?ce=ao(De,ce):(ce=Sa(ce,L,y,null),ce.flags|=2),ce.return=f,x.return=f,x.sibling=ce,f.child=x,Xw(null,x),x=f.child,ce=u.child.memoizedState,ce===null?ce=$9(y):(L=ce.cachePool,L!==null?(me=dr._currentValue,L=L.parent!==me?{parent:me,pool:me}:L):L=TL(),ce={baseLanes:ce.baseLanes|y,cachePool:L}),x.memoizedState=ce,x.childLanes=U9(u,te,y),f.memoizedState=L9,Xw(u.child,x)):(t0(f),y=u.child,u=y.sibling,y=ao(y,{mode:"visible",children:x.children}),y.return=f,y.sibling=null,u!==null&&(te=f.deletions,te===null?(f.deletions=[u],f.flags|=16):te.push(u)),f.child=y,f.memoizedState=null,y)}function B9(u,f){return f=sC({mode:"visible",children:f},u.mode),f.return=u,u.child=f}function sC(u,f){return u=Qn(22,u,null,f),u.lanes=0,u}function F9(u,f,y){return am(f,u.child,null,y),u=B9(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function F$(u,f,y){u.lanes|=f;var x=u.alternate;x!==null&&(x.lanes|=f),Bw(u.return,f,y)}function j9(u,f,y,x,L,V){var te=u.memoizedState;te===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:x,tail:y,tailMode:L,treeForkCount:V}:(te.isBackwards=f,te.rendering=null,te.renderingStartTime=0,te.last=x,te.tail=y,te.tailMode=L,te.treeForkCount=V)}function j$(u,f,y){var x=f.pendingProps,L=x.revealOrder,V=x.tail;x=x.children;var te=Xs.current,ce=(te&2)!==0;if(ce?(te=te&1|2,f.flags|=128):te&=1,H(Xs,te),lo(u,f,x,y),x=ri?ls:0,!ce&&u!==null&&(u.flags&128)!==0)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&F$(u,y,f);else if(u.tag===19)F$(u,y,f);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===f)break e;for(;u.sibling===null;){if(u.return===null||u.return===f)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(L){case"forwards":for(y=f.child,L=null;y!==null;)u=y.alternate,u!==null&&H4(u)===null&&(L=y),y=y.sibling;y=L,y===null?(L=f.child,f.child=null):(L=y.sibling,y.sibling=null),j9(f,!1,L,y,V,x);break;case"backwards":case"unstable_legacy-backwards":for(y=null,L=f.child,f.child=null;L!==null;){if(u=L.alternate,u!==null&&H4(u)===null){f.child=L;break}u=L.sibling,L.sibling=y,y=L,L=u}j9(f,!0,y,null,V,x);break;case"together":j9(f,!1,null,null,void 0,x);break;default:f.memoizedState=null}return f.child}function uh(u,f,y){if(u!==null&&(f.dependencies=u.dependencies),r0|=f.lanes,(y&f.childLanes)===0)if(u!==null){if(ny(u,f,y,!1),(y&f.childLanes)===0)return null}else return null;if(u!==null&&f.child!==u.child)throw Error(i(153));if(f.child!==null){for(u=f.child,y=ao(u,u.pendingProps),f.child=y,y.return=f;u.sibling!==null;)u=u.sibling,y=y.sibling=ao(u,u.pendingProps),y.return=f;y.sibling=null}return f.child}function V9(u,f){return(u.lanes&f)!==0?!0:(u=u.dependencies,!!(u!==null&&U4(u)))}function Eae(u,f,y){switch(f.tag){case 3:Q(f,f.stateNode.containerInfo),gc(f,dr,u.memoizedState.cache),td();break;case 27:case 5:ie(f);break;case 4:Q(f,f.stateNode.containerInfo);break;case 10:gc(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,f9(f),null;break;case 13:var x=f.memoizedState;if(x!==null)return x.dehydrated!==null?(t0(f),f.flags|=128,null):(y&f.child.childLanes)!==0?B$(u,f,y):(t0(f),u=uh(u,f,y),u!==null?u.sibling:null);t0(f);break;case 19:var L=(u.flags&128)!==0;if(x=(y&f.childLanes)!==0,x||(ny(u,f,y,!1),x=(y&f.childLanes)!==0),L){if(x)return j$(u,f,y);f.flags|=128}if(L=f.memoizedState,L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),H(Xs,Xs.current),x)break;return null;case 22:return f.lanes=0,D$(u,f,y,f.pendingProps);case 24:gc(f,dr,u.memoizedState.cache)}return uh(u,f,y)}function V$(u,f,y){if(u!==null)if(u.memoizedProps!==f.pendingProps)fr=!0;else{if(!V9(u,y)&&(f.flags&128)===0)return fr=!1,Eae(u,f,y);fr=(u.flags&131072)!==0}else fr=!1,ri&&(f.flags&1048576)!==0&&Mw(f,ls,f.index);switch(f.lanes=0,f.tag){case 16:e:{var x=f.pendingProps;if(u=rm(f.elementType),f.type=u,typeof u=="function")_a(u)?(x=lm(u,x),f.tag=1,f=$$(null,f,u,x,y)):(f.tag=0,f=M9(null,f,u,x,y));else{if(u!=null){var L=u.$$typeof;if(L===k){f.tag=11,f=R$(null,f,u,x,y);break e}else if(L===B){f.tag=14,f=P$(null,f,u,x,y);break e}}throw f=S(u)||u,Error(i(306,f,""))}}return f;case 0:return M9(u,f,f.type,f.pendingProps,y);case 1:return x=f.type,L=lm(x,f.pendingProps),$$(u,f,x,L,y);case 3:e:{if(Q(f,f.stateNode.containerInfo),u===null)throw Error(i(387));x=f.pendingProps;var V=f.memoizedState;L=V.element,c9(u,f),Gw(f,x,null,y);var te=f.memoizedState;if(x=te.cache,gc(f,dr,x),x!==V.cache&&Fw(f,[dr],y,!0),Hw(),x=te.element,V.isDehydrated)if(V={element:x,isDehydrated:!1,cache:te.cache},f.updateQueue.baseState=V,f.memoizedState=V,f.flags&256){f=U$(u,f,x,y);break e}else if(x!==L){L=qr(Error(i(424)),f),es(L),f=U$(u,f,x,y);break e}else{switch(u=f.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(Yi=cl(u.firstChild),ur=f,ri=!0,Ql=null,Xo=!0,y=DL(f,null,x,y),f.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(td(),x===L){f=uh(u,f,y);break e}lo(u,f,x,y)}f=f.child}return f;case 26:return iC(u,f),u===null?(y=JU(f.type,null,f.pendingProps,null))?f.memoizedState=y:ri||(y=f.type,u=f.pendingProps,x=vC(Z.current).createElement(y),x[un]=f,x[_n]=u,uo(x,y,u),Ji(x),f.stateNode=x):f.memoizedState=JU(f.type,u.memoizedProps,f.pendingProps,u.memoizedState),null;case 27:return ie(f),u===null&&ri&&(x=f.stateNode=ZU(f.type,f.pendingProps,Z.current),ur=f,Xo=!0,L=Yi,u0(f.type)?(CA=L,Yi=cl(x.firstChild)):Yi=L),lo(u,f,f.pendingProps.children,y),iC(u,f),u===null&&(f.flags|=4194304),f.child;case 5:return u===null&&ri&&((L=x=Yi)&&(x=Jae(x,f.type,f.pendingProps,Xo),x!==null?(f.stateNode=x,ur=f,Yi=cl(x.firstChild),Xo=!1,L=!0):L=!1),L||Xl(f)),ie(f),L=f.type,V=f.pendingProps,te=u!==null?u.memoizedProps:null,x=V.children,gA(L,V)?x=null:te!==null&&gA(L,te)&&(f.flags|=32),f.memoizedState!==null&&(L=m9(u,f,pae,null,null,y),fv._currentValue=L),iC(u,f),lo(u,f,x,y),f.child;case 6:return u===null&&ri&&((u=y=Yi)&&(y=ece(y,f.pendingProps,Xo),y!==null?(f.stateNode=y,ur=f,Yi=null,u=!0):u=!1),u||Xl(f)),null;case 13:return B$(u,f,y);case 4:return Q(f,f.stateNode.containerInfo),x=f.pendingProps,u===null?f.child=am(f,null,x,y):lo(u,f,x,y),f.child;case 11:return R$(u,f,f.type,f.pendingProps,y);case 7:return lo(u,f,f.pendingProps,y),f.child;case 8:return lo(u,f,f.pendingProps.children,y),f.child;case 12:return lo(u,f,f.pendingProps.children,y),f.child;case 10:return x=f.pendingProps,gc(f,f.type,x.value),lo(u,f,x.children,y),f.child;case 9:return L=f.type._context,x=f.pendingProps.children,im(f),L=co(L),x=x(L),f.flags|=1,lo(u,f,x,y),f.child;case 14:return P$(u,f,f.type,f.pendingProps,y);case 15:return I$(u,f,f.type,f.pendingProps,y);case 19:return j$(u,f,y);case 31:return xae(u,f,y);case 22:return D$(u,f,y,f.pendingProps);case 24:return im(f),x=co(dr),u===null?(L=r9(),L===null&&(L=ts,V=i9(),L.pooledCache=V,V.refCount++,V!==null&&(L.pooledCacheLanes|=y),L=V),f.memoizedState={parent:x,cache:L},a9(f),gc(f,dr,L)):((u.lanes&y)!==0&&(c9(u,f),Gw(f,null,null,y),Hw()),L=u.memoizedState,V=f.memoizedState,L.parent!==x?(L={parent:x,cache:x},f.memoizedState=L,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=L),gc(f,dr,x)):(x=V.cache,gc(f,dr,x),x!==L.cache&&Fw(f,[dr],y,!0))),lo(u,f,f.pendingProps.children,y),f.child;case 29:throw f.pendingProps}throw Error(i(156,f.tag))}function dh(u){u.flags|=4}function W9(u,f,y,x,L){if((f=(u.mode&32)!==0)&&(f=!1),f){if(u.flags|=16777216,(L&335544128)===L)if(u.stateNode.complete)u.flags|=8192;else if(mU())u.flags|=8192;else throw om=V4,o9}else u.flags&=-16777217}function W$(u,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!sB(f))if(mU())u.flags|=8192;else throw om=V4,o9}function rC(u,f){f!==null&&(u.flags|=4),u.flags&16384&&(f=u.tag!==22?Ee():536870912,u.lanes|=f,py|=f)}function Jw(u,f){if(!ri)switch(u.tailMode){case"hidden":f=u.tail;for(var y=null;f!==null;)f.alternate!==null&&(y=f),f=f.sibling;y===null?u.tail=null:y.sibling=null;break;case"collapsed":y=u.tail;for(var x=null;y!==null;)y.alternate!==null&&(x=y),y=y.sibling;x===null?f||u.tail===null?u.tail=null:u.tail.sibling=null:x.sibling=null}}function ms(u){var f=u.alternate!==null&&u.alternate.child===u.child,y=0,x=0;if(f)for(var L=u.child;L!==null;)y|=L.lanes|L.childLanes,x|=L.subtreeFlags&65011712,x|=L.flags&65011712,L.return=u,L=L.sibling;else for(L=u.child;L!==null;)y|=L.lanes|L.childLanes,x|=L.subtreeFlags,x|=L.flags,L.return=u,L=L.sibling;return u.subtreeFlags|=x,u.childLanes=y,f}function _ae(u,f,y){var x=f.pendingProps;switch(J1(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ms(f),null;case 1:return ms(f),null;case 3:return y=f.stateNode,x=null,u!==null&&(x=u.memoizedState.cache),f.memoizedState.cache!==x&&(f.flags|=2048),ol(dr),ee(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(ah(f)?dh(f):u===null||u.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,ty())),ms(f),null;case 26:var L=f.type,V=f.memoizedState;return u===null?(dh(f),V!==null?(ms(f),W$(f,V)):(ms(f),W9(f,L,null,x,y))):V?V!==u.memoizedState?(dh(f),ms(f),W$(f,V)):(ms(f),f.flags&=-16777217):(u=u.memoizedProps,u!==x&&dh(f),ms(f),W9(f,L,u,x,y)),null;case 27:if(re(f),y=Z.current,L=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==x&&dh(f);else{if(!x){if(f.stateNode===null)throw Error(i(166));return ms(f),null}u=J.current,ah(f)?$w(f):(u=ZU(L,x,y),f.stateNode=u,dh(f))}return ms(f),null;case 5:if(re(f),L=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==x&&dh(f);else{if(!x){if(f.stateNode===null)throw Error(i(166));return ms(f),null}if(V=J.current,ah(f))$w(f);else{var te=vC(Z.current);switch(V){case 1:V=te.createElementNS("http://www.w3.org/2000/svg",L);break;case 2:V=te.createElementNS("http://www.w3.org/1998/Math/MathML",L);break;default:switch(L){case"svg":V=te.createElementNS("http://www.w3.org/2000/svg",L);break;case"math":V=te.createElementNS("http://www.w3.org/1998/Math/MathML",L);break;case"script":V=te.createElement("div"),V.innerHTML="<script><\/script>",V=V.removeChild(V.firstChild);break;
vendor: 22,697 bytes, line 49
49case"select":V=typeof x.is=="string"?te.createElement("select",{is:x.is}):te.createElement("select"),x.multiple?V.multiple=!0:x.size&&(V.size=x.size);break;default:V=typeof x.is=="string"?te.createElement(L,{is:x.is}):te.createElement(L)}}V[un]=f,V[_n]=x;e:for(te=f.child;te!==null;){if(te.tag===5||te.tag===6)V.appendChild(te.stateNode);else if(te.tag!==4&&te.tag!==27&&te.child!==null){te.child.return=te,te=te.child;continue}if(te===f)break e;for(;te.sibling===null;){if(te.return===null||te.return===f)break e;te=te.return}te.sibling.return=te.return,te=te.sibling}f.stateNode=V;e:switch(uo(V,L,x),L){case"button":case"input":case"select":case"textarea":x=!!x.autoFocus;break e;case"img":x=!0;break e;default:x=!1}x&&dh(f)}}return ms(f),W9(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,y),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==x&&dh(f);else{if(typeof x!="string"&&f.stateNode===null)throw Error(i(166));if(u=Z.current,ah(f)){if(u=f.stateNode,y=f.memoizedProps,x=null,L=ur,L!==null)switch(L.tag){case 27:case 5:x=L.memoizedProps}u[un]=f,u=!!(u.nodeValue===y||x!==null&&x.suppressHydrationWarning===!0||BU(u.nodeValue,y)),u||Xl(f,!0)}else u=vC(u).createTextNode(x),u[un]=f,f.stateNode=u}return ms(f),null;case 31:if(y=f.memoizedState,u===null||u.memoizedState!==null){if(x=ah(f),y!==null){if(u===null){if(!x)throw Error(i(318));if(u=f.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(557));u[un]=f}else td(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;ms(f),u=!1}else y=ty(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=y),u=!0;if(!u)return f.flags&256?(bc(f),f):(bc(f),null);if((f.flags&128)!==0)throw Error(i(558))}return ms(f),null;case 13:if(x=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(L=ah(f),x!==null&&x.dehydrated!==null){if(u===null){if(!L)throw Error(i(318));if(L=f.memoizedState,L=L!==null?L.dehydrated:null,!L)throw Error(i(317));L[un]=f}else td(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;ms(f),L=!1}else L=ty(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=L),L=!0;if(!L)return f.flags&256?(bc(f),f):(bc(f),null)}return bc(f),(f.flags&128)!==0?(f.lanes=y,f):(y=x!==null,u=u!==null&&u.memoizedState!==null,y&&(x=f.child,L=null,x.alternate!==null&&x.alternate.memoizedState!==null&&x.alternate.memoizedState.cachePool!==null&&(L=x.alternate.memoizedState.cachePool.pool),V=null,x.memoizedState!==null&&x.memoizedState.cachePool!==null&&(V=x.memoizedState.cachePool.pool),V!==L&&(x.flags|=2048)),y!==u&&y&&(f.child.flags|=8192),rC(f,f.updateQueue),ms(f),null);case 4:return ee(),u===null&&dA(f.stateNode.containerInfo),ms(f),null;case 10:return ol(f.type),ms(f),null;case 19:if(O(Xs),x=f.memoizedState,x===null)return ms(f),null;if(L=(f.flags&128)!==0,V=x.rendering,V===null)if(L)Jw(x,!1);else{if(Fs!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(V=H4(u),V!==null){for(f.flags|=128,Jw(x,!1),u=V.updateQueue,f.updateQueue=u,rC(f,u),f.subtreeFlags=0,u=y,y=f.child;y!==null;)ed(y,u),y=y.sibling;return H(Xs,Xs.current&1|2),ri&&rl(f,x.treeForkCount),f.child}u=u.sibling}x.tail!==null&&ze()>uC&&(f.flags|=128,L=!0,Jw(x,!1),f.lanes=4194304)}else{if(!L)if(u=H4(V),u!==null){if(f.flags|=128,L=!0,u=u.updateQueue,f.updateQueue=u,rC(f,u),Jw(x,!0),x.tail===null&&x.tailMode==="hidden"&&!V.alternate&&!ri)return ms(f),null}else 2*ze()-x.renderingStartTime>uC&&y!==536870912&&(f.flags|=128,L=!0,Jw(x,!1),f.lanes=4194304);x.isBackwards?(V.sibling=f.child,f.child=V):(u=x.last,u!==null?u.sibling=V:f.child=V,x.last=V)}return x.tail!==null?(u=x.tail,x.rendering=u,x.tail=u.sibling,x.renderingStartTime=ze(),u.sibling=null,y=Xs.current,H(Xs,L?y&1|2:y&1),ri&&rl(f,x.treeForkCount),u):(ms(f),null);case 22:case 23:return bc(f),h9(),x=f.memoizedState!==null,u!==null?u.memoizedState!==null!==x&&(f.flags|=8192):x&&(f.flags|=8192),x?(y&536870912)!==0&&(f.flags&128)===0&&(ms(f),f.subtreeFlags&6&&(f.flags|=8192)):ms(f),y=f.updateQueue,y!==null&&rC(f,y.retryQueue),y=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==y&&(f.flags|=2048),u!==null&&O(sm),null;case 24:return y=null,u!==null&&(y=u.memoizedState.cache),f.memoizedState.cache!==y&&(f.flags|=2048),ol(dr),ms(f),null;case 25:return null;case 30:return null}throw Error(i(156,f.tag))}function Sae(u,f){switch(J1(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return ol(dr),ee(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return re(f),null;case 31:if(f.memoizedState!==null){if(bc(f),f.alternate===null)throw Error(i(340));td()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 13:if(bc(f),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(i(340));td()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return O(Xs),null;case 4:return ee(),null;case 10:return ol(f.type),null;case 22:case 23:return bc(f),h9(),u!==null&&O(sm),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return ol(dr),null;case 25:return null;default:return null}}function q$(u,f){switch(J1(f),f.tag){case 3:ol(dr),ee();break;case 26:case 27:case 5:re(f);break;case 4:ee();break;case 31:f.memoizedState!==null&&bc(f);break;case 13:bc(f);break;case 19:O(Xs);break;case 10:ol(f.type);break;case 22:case 23:bc(f),h9(),u!==null&&O(sm);break;case 24:ol(dr)}}function ev(u,f){try{var y=f.updateQueue,x=y!==null?y.lastEffect:null;if(x!==null){var L=x.next;y=L;do{if((y.tag&u)===u){x=void 0;var V=y.create,te=y.inst;x=V(),te.destroy=x}y=y.next}while(y!==L)}}catch(ce){ji(f,f.return,ce)}}function i0(u,f,y){try{var x=f.updateQueue,L=x!==null?x.lastEffect:null;if(L!==null){var V=L.next;x=V;do{if((x.tag&u)===u){var te=x.inst,ce=te.destroy;if(ce!==void 0){te.destroy=void 0,L=f;var me=y,De=ce;try{De()}catch(qe){ji(L,me,qe)}}}x=x.next}while(x!==V)}}catch(qe){ji(f,f.return,qe)}}function z$(u){var f=u.updateQueue;if(f!==null){var y=u.stateNode;try{ML(f,y)}catch(x){ji(u,u.return,x)}}}function H$(u,f,y){y.props=lm(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(x){ji(u,f,x)}}function tv(u,f){try{var y=u.ref;if(y!==null){switch(u.tag){case 26:case 27:case 5:var x=u.stateNode;break;case 30:x=u.stateNode;break;default:x=u.stateNode}typeof y=="function"?u.refCleanup=y(x):y.current=x}}catch(L){ji(u,f,L)}}function nd(u,f){var y=u.ref,x=u.refCleanup;if(y!==null)if(typeof x=="function")try{x()}catch(L){ji(u,f,L)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(L){ji(u,f,L)}else y.current=null}function G$(u){var f=u.type,y=u.memoizedProps,x=u.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":y.autoFocus&&x.focus();break e;case"img":y.src?x.src=y.src:y.srcSet&&(x.srcset=y.srcSet)}}catch(L){ji(u,u.return,L)}}function q9(u,f,y){try{var x=u.stateNode;Gae(x,u.type,y,f),x[_n]=f}catch(L){ji(u,u.return,L)}}function K$(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&u0(u.type)||u.tag===4}function z9(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||K$(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&u0(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function H9(u,f,y){var x=u.tag;if(x===5||x===6)u=u.stateNode,f?(y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y).insertBefore(u,f):(f=y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y,f.appendChild(u),y=y._reactRootContainer,y!=null||f.onclick!==null||(f.onclick=fc));else if(x!==4&&(x===27&&u0(u.type)&&(y=u.stateNode,f=null),u=u.child,u!==null))for(H9(u,f,y),u=u.sibling;u!==null;)H9(u,f,y),u=u.sibling}function oC(u,f,y){var x=u.tag;if(x===5||x===6)u=u.stateNode,f?y.insertBefore(u,f):y.appendChild(u);else if(x!==4&&(x===27&&u0(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(oC(u,f,y),u=u.sibling;u!==null;)oC(u,f,y),u=u.sibling}function Y$(u){var f=u.stateNode,y=u.memoizedProps;try{for(var x=u.type,L=f.attributes;L.length;)f.removeAttributeNode(L[0]);uo(f,x,y),f[un]=u,f[_n]=y}catch(V){ji(u,u.return,V)}}var hh=!1,pr=!1,G9=!1,Z$=typeof WeakSet=="function"?WeakSet:Set,zr=null;function Aae(u,f){if(u=u.containerInfo,pA=TC,u=Tw(u),G1(u)){if("selectionStart"in u)var y={start:u.selectionStart,end:u.selectionEnd};else e:{y=(y=u.ownerDocument)&&y.defaultView||window;var x=y.getSelection&&y.getSelection();if(x&&x.rangeCount!==0){y=x.anchorNode;var L=x.anchorOffset,V=x.focusNode;x=x.focusOffset;try{y.nodeType,V.nodeType}catch{y=null;break e}var te=0,ce=-1,me=-1,De=0,qe=0,Je=u,Le=null;t:for(;;){for(var je;Je!==y||L!==0&&Je.nodeType!==3||(ce=te+L),Je!==V||x!==0&&Je.nodeType!==3||(me=te+x),Je.nodeType===3&&(te+=Je.nodeValue.length),(je=Je.firstChild)!==null;)Le=Je,Je=je;for(;;){if(Je===u)break t;if(Le===y&&++De===L&&(ce=te),Le===V&&++qe===x&&(me=te),(je=Je.nextSibling)!==null)break;Je=Le,Le=Je.parentNode}Je=je}y=ce===-1||me===-1?null:{start:ce,end:me}}else y=null}y=y||{start:0,end:0}}else y=null;for(mA={focusedElem:u,selectionRange:y},TC=!1,zr=f;zr!==null;)if(f=zr,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,zr=u;else for(;zr!==null;){switch(f=zr,V=f.alternate,u=f.flags,f.tag){case 0:if((u&4)!==0&&(u=f.updateQueue,u=u!==null?u.events:null,u!==null))for(y=0;y<u.length;y++)L=u[y],L.ref.impl=L.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&V!==null){u=void 0,y=f,L=V.memoizedProps,V=V.memoizedState,x=y.stateNode;try{var Gt=lm(y.type,L);u=x.getSnapshotBeforeUpdate(Gt,V),x.__reactInternalSnapshotBeforeUpdate=u}catch(Sn){ji(y,y.return,Sn)}}break;case 3:if((u&1024)!==0){if(u=f.stateNode.containerInfo,y=u.nodeType,y===9)bA(u);else if(y===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":bA(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(i(163))}if(u=f.sibling,u!==null){u.return=f.return,zr=u;break}zr=f.return}}function Q$(u,f,y){var x=y.flags;switch(y.tag){case 0:case 11:case 15:ph(u,y),x&4&&ev(5,y);break;case 1:if(ph(u,y),x&4)if(u=y.stateNode,f===null)try{u.componentDidMount()}catch(te){ji(y,y.return,te)}else{var L=lm(y.type,f.memoizedProps);f=f.memoizedState;try{u.componentDidUpdate(L,f,u.__reactInternalSnapshotBeforeUpdate)}catch(te){ji(y,y.return,te)}}x&64&&z$(y),x&512&&tv(y,y.return);break;case 3:if(ph(u,y),x&64&&(u=y.updateQueue,u!==null)){if(f=null,y.child!==null)switch(y.child.tag){case 27:case 5:f=y.child.stateNode;break;case 1:f=y.child.stateNode}try{ML(u,f)}catch(te){ji(y,y.return,te)}}break;case 27:f===null&&x&4&&Y$(y);case 26:case 5:ph(u,y),f===null&&x&4&&G$(y),x&512&&tv(y,y.return);break;case 12:ph(u,y);break;case 31:ph(u,y),x&4&&eU(u,y);break;case 13:ph(u,y),x&4&&tU(u,y),x&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=Mae.bind(null,y),tce(u,y))));break;case 22:if(x=y.memoizedState!==null||hh,!x){f=f!==null&&f.memoizedState!==null||pr,L=hh;var V=pr;hh=x,(pr=f)&&!V?mh(u,y,(y.subtreeFlags&8772)!==0):ph(u,y),hh=L,pr=V}break;case 30:break;default:ph(u,y)}}function X$(u){var f=u.alternate;f!==null&&(u.alternate=null,X$(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&Vr(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var Es=null,Ta=!1;function fh(u,f,y){for(y=y.child;y!==null;)J$(u,f,y),y=y.sibling}function J$(u,f,y){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(nt,y)}catch{}switch(y.tag){case 26:pr||nd(y,f),fh(u,f,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:pr||nd(y,f);var x=Es,L=Ta;u0(y.type)&&(Es=y.stateNode,Ta=!1),fh(u,f,y),uv(y.stateNode),Es=x,Ta=L;break;case 5:pr||nd(y,f);case 6:if(x=Es,L=Ta,Es=null,fh(u,f,y),Es=x,Ta=L,Es!==null)if(Ta)try{(Es.nodeType===9?Es.body:Es.nodeName==="HTML"?Es.ownerDocument.body:Es).removeChild(y.stateNode)}catch(V){ji(y,f,V)}else try{Es.removeChild(y.stateNode)}catch(V){ji(y,f,V)}break;case 18:Es!==null&&(Ta?(u=Es,zU(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),xy(u)):zU(Es,y.stateNode));break;case 4:x=Es,L=Ta,Es=y.stateNode.containerInfo,Ta=!0,fh(u,f,y),Es=x,Ta=L;break;case 0:case 11:case 14:case 15:i0(2,y,f),pr||i0(4,y,f),fh(u,f,y);break;case 1:pr||(nd(y,f),x=y.stateNode,typeof x.componentWillUnmount=="function"&&H$(y,f,x)),fh(u,f,y);break;case 21:fh(u,f,y);break;case 22:pr=(x=pr)||y.memoizedState!==null,fh(u,f,y),pr=x;break;default:fh(u,f,y)}}function eU(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{xy(u)}catch(y){ji(f,f.return,y)}}}function tU(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{xy(u)}catch(y){ji(f,f.return,y)}}function Tae(u){switch(u.tag){case 31:case 13:case 19:var f=u.stateNode;return f===null&&(f=u.stateNode=new Z$),f;case 22:return u=u.stateNode,f=u._retryCache,f===null&&(f=u._retryCache=new Z$),f;default:throw Error(i(435,u.tag))}}function aC(u,f){var y=Tae(u);f.forEach(function(x){if(!y.has(x)){y.add(x);var L=Lae.bind(null,u,x);x.then(L,L)}})}function ka(u,f){var y=f.deletions;if(y!==null)for(var x=0;x<y.length;x++){var L=y[x],V=u,te=f,ce=te;e:for(;ce!==null;){switch(ce.tag){case 27:if(u0(ce.type)){Es=ce.stateNode,Ta=!1;break e}break;case 5:Es=ce.stateNode,Ta=!1;break e;case 3:case 4:Es=ce.stateNode.containerInfo,Ta=!0;break e}ce=ce.return}if(Es===null)throw Error(i(160));J$(V,te,L),Es=null,Ta=!1,V=L.alternate,V!==null&&(V.return=null),L.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)nU(f,u),f=f.sibling}var Jl=null;function nU(u,f){var y=u.alternate,x=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:ka(f,u),Na(u),x&4&&(i0(3,u,u.return),ev(3,u),i0(5,u,u.return));break;case 1:ka(f,u),Na(u),x&512&&(pr||y===null||nd(y,y.return)),x&64&&hh&&(u=u.updateQueue,u!==null&&(x=u.callbacks,x!==null&&(y=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=y===null?x:y.concat(x))));break;case 26:var L=Jl;if(ka(f,u),Na(u),x&512&&(pr||y===null||nd(y,y.return)),x&4){var V=y!==null?y.memoizedState:null;if(x=u.memoizedState,y===null)if(x===null)if(u.stateNode===null){e:{x=u.type,y=u.memoizedProps,L=L.ownerDocument||L;t:switch(x){case"title":V=L.getElementsByTagName("title")[0],(!V||V[cs]||V[un]||V.namespaceURI==="http://www.w3.org/2000/svg"||V.hasAttribute("itemprop"))&&(V=L.createElement(x),L.head.insertBefore(V,L.querySelector("head > title"))),uo(V,x,y),V[un]=u,Ji(V),x=V;break e;case"link":var te=nB("link","href",L).get(x+(y.href||""));if(te){for(var ce=0;ce<te.length;ce++)if(V=te[ce],V.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&V.getAttribute("rel")===(y.rel==null?null:y.rel)&&V.getAttribute("title")===(y.title==null?null:y.title)&&V.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){te.splice(ce,1);break t}}V=L.createElement(x),uo(V,x,y),L.head.appendChild(V);break;case"meta":if(te=nB("meta","content",L).get(x+(y.content||""))){for(ce=0;ce<te.length;ce++)if(V=te[ce],V.getAttribute("content")===(y.content==null?null:""+y.content)&&V.getAttribute("name")===(y.name==null?null:y.name)&&V.getAttribute("property")===(y.property==null?null:y.property)&&V.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&V.getAttribute("charset")===(y.charSet==null?null:y.charSet)){te.splice(ce,1);break t}}V=L.createElement(x),uo(V,x,y),L.head.appendChild(V);break;default:throw Error(i(468,x))}V[un]=u,Ji(V),x=V}u.stateNode=x}else iB(L,u.type,u.stateNode);else u.stateNode=tB(L,x,u.memoizedProps);else V!==x?(V===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):V.count--,x===null?iB(L,u.type,u.stateNode):tB(L,x,u.memoizedProps)):x===null&&u.stateNode!==null&&q9(u,u.memoizedProps,y.memoizedProps)}break;case 27:ka(f,u),Na(u),x&512&&(pr||y===null||nd(y,y.return)),y!==null&&x&4&&q9(u,u.memoizedProps,y.memoizedProps);break;case 5:if(ka(f,u),Na(u),x&512&&(pr||y===null||nd(y,y.return)),u.flags&32){L=u.stateNode;try{Zs(L,"")}catch(Gt){ji(u,u.return,Gt)}}x&4&&u.stateNode!=null&&(L=u.memoizedProps,q9(u,L,y!==null?y.memoizedProps:L)),x&1024&&(G9=!0);break;case 6:if(ka(f,u),Na(u),x&4){if(u.stateNode===null)throw Error(i(162));x=u.memoizedProps,y=u.stateNode;try{y.nodeValue=x}catch(Gt){ji(u,u.return,Gt)}}break;case 3:if(EC=null,L=Jl,Jl=CC(f.containerInfo),ka(f,u),Jl=L,Na(u),x&4&&y!==null&&y.memoizedState.isDehydrated)try{xy(f.containerInfo)}catch(Gt){ji(u,u.return,Gt)}G9&&(G9=!1,iU(u));break;case 4:x=Jl,Jl=CC(u.stateNode.containerInfo),ka(f,u),Na(u),Jl=x;break;case 12:ka(f,u),Na(u);break;case 31:ka(f,u),Na(u),x&4&&(x=u.updateQueue,x!==null&&(u.updateQueue=null,aC(u,x)));break;case 13:ka(f,u),Na(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(lC=ze()),x&4&&(x=u.updateQueue,x!==null&&(u.updateQueue=null,aC(u,x)));break;case 22:L=u.memoizedState!==null;var me=y!==null&&y.memoizedState!==null,De=hh,qe=pr;if(hh=De||L,pr=qe||me,ka(f,u),pr=qe,hh=De,Na(u),x&8192)e:for(f=u.stateNode,f._visibility=L?f._visibility&-2:f._visibility|1,L&&(y===null||me||hh||pr||um(u)),y=null,f=u;;){if(f.tag===5||f.tag===26){if(y===null){me=y=f;try{if(V=me.stateNode,L)te=V.style,typeof te.setProperty=="function"?te.setProperty("display","none","important"):te.display="none";else{ce=me.stateNode;var Je=me.memoizedProps.style,Le=Je!=null&&Je.hasOwnProperty("display")?Je.display:null;ce.style.display=Le==null||typeof Le=="boolean"?"":(""+Le).trim()}}catch(Gt){ji(me,me.return,Gt)}}}else if(f.tag===6){if(y===null){me=f;try{me.stateNode.nodeValue=L?"":me.memoizedProps}catch(Gt){ji(me,me.return,Gt)}}}else if(f.tag===18){if(y===null){me=f;try{var je=me.stateNode;L?HU(je,!0):HU(me.stateNode,!1)}catch(Gt){ji(me,me.return,Gt)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===u)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break e;for(;f.sibling===null;){if(f.return===null||f.return===u)break e;y===f&&(y=null),f=f.return}y===f&&(y=null),f.sibling.return=f.return,f=f.sibling}x&4&&(x=u.updateQueue,x!==null&&(y=x.retryQueue,y!==null&&(x.retryQueue=null,aC(u,y))));break;case 19:ka(f,u),Na(u),x&4&&(x=u.updateQueue,x!==null&&(u.updateQueue=null,aC(u,x)));break;case 30:break;case 21:break;default:ka(f,u),Na(u)}}function Na(u){var f=u.flags;if(f&2){try{for(var y,x=u.return;x!==null;){if(K$(x)){y=x;break}x=x.return}if(y==null)throw Error(i(160));switch(y.tag){case 27:var L=y.stateNode,V=z9(u);oC(u,V,L);break;case 5:var te=y.stateNode;y.flags&32&&(Zs(te,""),y.flags&=-33);var ce=z9(u);oC(u,ce,te);break;case 3:case 4:var me=y.stateNode.containerInfo,De=z9(u);H9(u,De,me);break;default:throw Error(i(161))}}catch(qe){ji(u,u.return,qe)}u.flags&=-3}f&4096&&(u.flags&=-4097)}function iU(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var f=u;iU(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),u=u.sibling}}function ph(u,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)Q$(u,f.alternate,f),f=f.sibling}function um(u){for(u=u.child;u!==null;){var f=u;switch(f.tag){case 0:case 11:case 14:case 15:i0(4,f,f.return),um(f);break;case 1:nd(f,f.return);var y=f.stateNode;typeof y.componentWillUnmount=="function"&&H$(f,f.return,y),um(f);break;case 27:uv(f.stateNode);case 26:case 5:nd(f,f.return),um(f);break;case 22:f.memoizedState===null&&um(f);break;case 30:um(f);break;default:um(f)}u=u.sibling}}function mh(u,f,y){for(y=y&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var x=f.alternate,L=u,V=f,te=V.flags;switch(V.tag){case 0:case 11:case 15:mh(L,V,y),ev(4,V);break;case 1:if(mh(L,V,y),x=V,L=x.stateNode,typeof L.componentDidMount=="function")try{L.componentDidMount()}catch(De){ji(x,x.return,De)}if(x=V,L=x.updateQueue,L!==null){var ce=x.stateNode;try{var me=L.shared.hiddenCallbacks;if(me!==null)for(L.shared.hiddenCallbacks=null,L=0;L<me.length;L++)OL(me[L],ce)}catch(De){ji(x,x.return,De)}}y&&te&64&&z$(V),tv(V,V.return);break;case 27:Y$(V);case 26:case 5:mh(L,V,y),y&&x===null&&te&4&&G$(V),tv(V,V.return);break;case 12:mh(L,V,y);break;case 31:mh(L,V,y),y&&te&4&&eU(L,V);break;case 13:mh(L,V,y),y&&te&4&&tU(L,V);break;case 22:V.memoizedState===null&&mh(L,V,y),tv(V,V.return);break;case 30:break;default:mh(L,V,y)}f=f.sibling}}function K9(u,f){var y=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),u=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(u=f.memoizedState.cachePool.pool),u!==y&&(u!=null&&u.refCount++,y!=null&&jw(y))}function Y9(u,f){u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&jw(u))}function eu(u,f,y,x){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)sU(u,f,y,x),f=f.sibling}function sU(u,f,y,x){var L=f.flags;switch(f.tag){case 0:case 11:case 15:eu(u,f,y,x),L&2048&&ev(9,f);break;case 1:eu(u,f,y,x);break;case 3:eu(u,f,y,x),L&2048&&(u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&jw(u)));break;case 12:if(L&2048){eu(u,f,y,x),u=f.stateNode;try{var V=f.memoizedProps,te=V.id,ce=V.onPostCommit;typeof ce=="function"&&ce(te,f.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(me){ji(f,f.return,me)}}else eu(u,f,y,x);break;case 31:eu(u,f,y,x);break;case 13:eu(u,f,y,x);break;case 23:break;case 22:V=f.stateNode,te=f.alternate,f.memoizedState!==null?V._visibility&2?eu(u,f,y,x):nv(u,f):V._visibility&2?eu(u,f,y,x):(V._visibility|=2,dy(u,f,y,x,(f.subtreeFlags&10256)!==0||!1)),L&2048&&K9(te,f);break;case 24:eu(u,f,y,x),L&2048&&Y9(f.alternate,f);break;default:eu(u,f,y,x)}}function dy(u,f,y,x,L){for(L=L&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var V=u,te=f,ce=y,me=x,De=te.flags;switch(te.tag){case 0:case 11:case 15:dy(V,te,ce,me,L),ev(8,te);break;case 23:break;case 22:var qe=te.stateNode;te.memoizedState!==null?qe._visibility&2?dy(V,te,ce,me,L):nv(V,te):(qe._visibility|=2,dy(V,te,ce,me,L)),L&&De&2048&&K9(te.alternate,te);break;case 24:dy(V,te,ce,me,L),L&&De&2048&&Y9(te.alternate,te);break;default:dy(V,te,ce,me,L)}f=f.sibling}}function nv(u,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var y=u,x=f,L=x.flags;switch(x.tag){case 22:nv(y,x),L&2048&&K9(x.alternate,x);break;case 24:nv(y,x),L&2048&&Y9(x.alternate,x);break;default:nv(y,x)}f=f.sibling}}var iv=8192;function hy(u,f,y){if(u.subtreeFlags&iv)for(u=u.child;u!==null;)rU(u,f,y),u=u.sibling}
vendor: 4,892 bytes, line 49
49function rU(u,f,y){switch(u.tag){case 26:hy(u,f,y),u.flags&iv&&u.memoizedState!==null&&fce(y,Jl,u.memoizedState,u.memoizedProps);break;case 5:hy(u,f,y);break;case 3:case 4:var x=Jl;Jl=CC(u.stateNode.containerInfo),hy(u,f,y),Jl=x;break;case 22:u.memoizedState===null&&(x=u.alternate,x!==null&&x.memoizedState!==null?(x=iv,iv=16777216,hy(u,f,y),iv=x):hy(u,f,y));break;default:hy(u,f,y)}}function oU(u){var f=u.alternate;if(f!==null&&(u=f.child,u!==null)){f.child=null;do f=u.sibling,u.sibling=null,u=f;while(u!==null)}}function sv(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var y=0;y<f.length;y++){var x=f[y];zr=x,cU(x,u)}oU(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)aU(u),u=u.sibling}function aU(u){switch(u.tag){case 0:case 11:case 15:sv(u),u.flags&2048&&i0(9,u,u.return);break;case 3:sv(u);break;case 12:sv(u);break;case 22:var f=u.stateNode;u.memoizedState!==null&&f._visibility&2&&(u.return===null||u.return.tag!==13)?(f._visibility&=-3,cC(u)):sv(u);break;default:sv(u)}}function cC(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var y=0;y<f.length;y++){var x=f[y];zr=x,cU(x,u)}oU(u)}for(u=u.child;u!==null;){switch(f=u,f.tag){case 0:case 11:case 15:i0(8,f,f.return),cC(f);break;case 22:y=f.stateNode,y._visibility&2&&(y._visibility&=-3,cC(f));break;default:cC(f)}u=u.sibling}}function cU(u,f){for(;zr!==null;){var y=zr;switch(y.tag){case 0:case 11:case 15:i0(8,y,f);break;case 23:case 22:if(y.memoizedState!==null&&y.memoizedState.cachePool!==null){var x=y.memoizedState.cachePool.pool;x!=null&&x.refCount++}break;case 24:jw(y.memoizedState.cache)}if(x=y.child,x!==null)x.return=y,zr=x;else e:for(y=u;zr!==null;){x=zr;var L=x.sibling,V=x.return;if(X$(x),x===y){zr=null;break e}if(L!==null){L.return=V,zr=L;break e}zr=V}}}var kae={getCacheForType:function(u){var f=co(dr),y=f.data.get(u);return y===void 0&&(y=u(),f.data.set(u,y)),y},cacheSignal:function(){return co(dr).controller.signal}},Nae=typeof WeakMap=="function"?WeakMap:Map,Ii=0,ts=null,oi=null,li=0,Fi=0,wc=null,s0=!1,fy=!1,Z9=!1,gh=0,Fs=0,r0=0,dm=0,Q9=0,vc=0,py=0,rv=null,Ra=null,X9=!1,lC=0,lU=0,uC=1/0,dC=null,o0=null,Ar=0,a0=null,my=null,yh=0,J9=0,eA=null,uU=null,ov=0,tA=null;function Cc(){return(Ii&2)!==0&&li!==0?li&-li:_.T!==null?aA():nn()}function dU(){if(vc===0)if((li&536870912)===0||ri){var u=En;En<<=1,(En&3932160)===0&&(En=262144),vc=u}else vc=536870912;return u=yc.current,u!==null&&(u.flags|=32),vc}function Pa(u,f,y){(u===ts&&(Fi===2||Fi===9)||u.cancelPendingCommit!==null)&&(gy(u,0),c0(u,li,vc,!1)),Xe(u,y),((Ii&2)===0||u!==ts)&&(u===ts&&((Ii&2)===0&&(dm|=y),Fs===4&&c0(u,li,vc,!1)),id(u))}function hU(u,f,y){if((Ii&6)!==0)throw Error(i(327));var x=!y&&(f&127)===0&&(f&u.expiredLanes)===0||Vt(u,f),L=x?Iae(u,f):iA(u,f,!0),V=x;do{if(L===0){fy&&!x&&c0(u,f,0,!1);break}else{if(y=u.current.alternate,V&&!Rae(y)){L=iA(u,f,!1),V=!1;continue}if(L===2){if(V=f,u.errorRecoveryDisabledLanes&V)var te=0;else te=u.pendingLanes&-536870913,te=te!==0?te:te&536870912?536870912:0;if(te!==0){f=te;e:{var ce=u;L=rv;var me=ce.current.memoizedState.isDehydrated;if(me&&(gy(ce,te).flags|=256),te=iA(ce,te,!1),te!==2){if(Z9&&!me){ce.errorRecoveryDisabledLanes|=V,dm|=V,L=4;break e}V=Ra,Ra=L,V!==null&&(Ra===null?Ra=V:Ra.push.apply(Ra,V))}L=te}if(V=!1,L!==2)continue}}if(L===1){gy(u,0),c0(u,f,0,!0);break}e:{switch(x=u,V=L,V){case 0:case 1:throw Error(i(345));case 4:if((f&4194048)!==f)break;case 6:c0(x,f,vc,!s0);break e;case 2:Ra=null;break;case 3:case 5:break;default:throw Error(i(329))}if((f&62914560)===f&&(L=lC+300-ze(),10<L)){if(c0(x,f,vc,!s0),_t(x,0,!0)!==0)break e;yh=f,x.timeoutHandle=WU(fU.bind(null,x,y,Ra,dC,X9,f,vc,dm,py,s0,V,"Throttled",-0,0),L);break e}fU(x,y,Ra,dC,X9,f,vc,dm,py,s0,V,null,-0,0)}}break}while(!0);id(u)}function fU(u,f,y,x,L,V,te,ce,me,De,qe,Je,Le,je){if(u.timeoutHandle=-1,Je=f.subtreeFlags,Je&8192||(Je&16785408)===16785408){Je={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fc},rU(f,V,Je);var Gt=(V&62914560)===V?lC-ze():(V&4194048)===V?lU-ze():0;if(Gt=pce(Je,Gt),Gt!==null){yh=V,u.cancelPendingCommit=Gt(CU.bind(null,u,f,V,y,x,L,te,ce,me,qe,Je,null,Le,je)),c0(u,V,te,!De);return}}CU(u,f,V,y,x,L,te,ce,me)}function Rae(u){for(var f=u;;){var y=f.tag;if((y===0||y===11||y===15)&&f.flags&16384&&(y=f.updateQueue,y!==null&&(y=y.stores,y!==null)))for(var x=0;x<y.length;x++){var L=y[x],V=L.getSnapshot;L=L.value;try{if(!No(V(),L))return!1}catch{return!1}}if(y=f.child,f.subtreeFlags&16384&&y!==null)y.return=f,f=y;else{if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function c0(u,f,y,x){f&=~Q9,f&=~dm,u.suspendedLanes|=f,u.pingedLanes&=~f,x&&(u.warmLanes|=f),x=u.expirationTimes;for(var L=f;0<L;){var V=31-zt(L),te=1<<V;x[V]=-1,L&=~te}y!==0&&pt(u,y,f)}function hC(){return(Ii&6)===0?(av(0),!1):!0}
vendor: 5,206 bytes, line 49
49function nA(){if(oi!==null){if(Fi===0)var u=oi.return;else u=oi,mc=Aa=null,b9(u),oy=null,Ww=0,u=oi;for(;u!==null;)q$(u.alternate,u),u=u.return;oi=null}}function gy(u,f){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,Zae(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),yh=0,nA(),ts=u,oi=y=ao(u.current,null),li=f,Fi=0,wc=null,s0=!1,fy=Vt(u,f),Z9=!1,py=vc=Q9=dm=r0=Fs=0,Ra=rv=null,X9=!1,(f&8)!==0&&(f|=f&32);var x=u.entangledLanes;if(x!==0)for(u=u.entanglements,x&=f;0<x;){var L=31-zt(x),V=1<<L;f|=u[L],x&=~V}return gh=f,St(),y}function pU(u,f){Hn=null,_.H=Qw,f===ry||f===j4?(f=RL(),Fi=3):f===o9?(f=RL(),Fi=4):Fi=f===O9?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,wc=f,oi===null&&(Fs=1,tC(u,qr(f,u.current)))}function mU(){var u=yc.current;return u===null?!0:(li&4194048)===li?al===null:(li&62914560)===li||(li&536870912)!==0?u===al:!1}function gU(){var u=_.H;return _.H=Qw,u===null?Qw:u}function yU(){var u=_.A;return _.A=kae,u}function fC(){Fs=4,s0||(li&4194048)!==li&&yc.current!==null||(fy=!0),(r0&134217727)===0&&(dm&134217727)===0||ts===null||c0(ts,li,vc,!1)}function iA(u,f,y){var x=Ii;Ii|=2;var L=gU(),V=yU();(ts!==u||li!==f)&&(dC=null,gy(u,f)),f=!1;var te=Fs;e:do try{if(Fi!==0&&oi!==null){var ce=oi,me=wc;switch(Fi){case 8:nA(),te=6;break e;case 3:case 2:case 9:case 6:yc.current===null&&(f=!0);var De=Fi;if(Fi=0,wc=null,yy(u,ce,me,De),y&&fy){te=0;break e}break;default:De=Fi,Fi=0,wc=null,yy(u,ce,me,De)}}Pae(),te=Fs;break}catch(qe){pU(u,qe)}while(!0);return f&&u.shellSuspendCounter++,mc=Aa=null,Ii=x,_.H=L,_.A=V,oi===null&&(ts=null,li=0,St()),te}function Pae(){for(;oi!==null;)bU(oi)}function Iae(u,f){var y=Ii;Ii|=2;var x=gU(),L=yU();ts!==u||li!==f?(dC=null,uC=ze()+500,gy(u,f)):fy=Vt(u,f);e:do try{if(Fi!==0&&oi!==null){f=oi;var V=wc;t:switch(Fi){case 1:Fi=0,wc=null,yy(u,f,V,1);break;case 2:case 9:if(kL(V)){Fi=0,wc=null,wU(f);break}f=function(){Fi!==2&&Fi!==9||ts!==u||(Fi=7),id(u)},V.then(f,f);break e;case 3:Fi=7;break e;case 4:Fi=5;break e;case 7:kL(V)?(Fi=0,wc=null,wU(f)):(Fi=0,wc=null,yy(u,f,V,7));break;case 5:var te=null;switch(oi.tag){case 26:te=oi.memoizedState;case 5:case 27:var ce=oi;if(te?sB(te):ce.stateNode.complete){Fi=0,wc=null;var me=ce.sibling;if(me!==null)oi=me;else{var De=ce.return;De!==null?(oi=De,pC(De)):oi=null}break t}}Fi=0,wc=null,yy(u,f,V,5);break;case 6:Fi=0,wc=null,yy(u,f,V,6);break;case 8:nA(),Fs=6;break e;default:throw Error(i(462))}}Dae();break}catch(qe){pU(u,qe)}while(!0);return mc=Aa=null,_.H=x,_.A=L,Ii=y,oi!==null?0:(ts=null,li=0,St(),Fs)}function Dae(){for(;oi!==null&&!xe();)bU(oi)}function bU(u){var f=V$(u.alternate,u,gh);u.memoizedProps=u.pendingProps,f===null?pC(u):oi=f}function wU(u){var f=u,y=f.alternate;switch(f.tag){case 15:case 0:f=L$(y,f,f.pendingProps,f.type,void 0,li);break;case 11:f=L$(y,f,f.pendingProps,f.type.render,f.ref,li);break;case 5:b9(f);default:q$(y,f),f=oi=ed(f,gh),f=V$(y,f,gh)}u.memoizedProps=u.pendingProps,f===null?pC(u):oi=f}function yy(u,f,y,x){mc=Aa=null,b9(f),oy=null,Ww=0;var L=f.return;try{if(Cae(u,L,f,y,li)){Fs=1,tC(u,qr(y,u.current)),oi=null;return}}catch(V){if(L!==null)throw oi=L,V;Fs=1,tC(u,qr(y,u.current)),oi=null;return}f.flags&32768?(ri||x===1?u=!0:fy||(li&536870912)!==0?u=!1:(s0=u=!0,(x===2||x===9||x===3||x===6)&&(x=yc.current,x!==null&&x.tag===13&&(x.flags|=16384))),vU(f,u)):pC(f)}function pC(u){var f=u;do{if((f.flags&32768)!==0){vU(f,s0);return}u=f.return;var y=_ae(f.alternate,f,gh);if(y!==null){oi=y;return}if(f=f.sibling,f!==null){oi=f;return}oi=f=u}while(f!==null);Fs===0&&(Fs=5)}function vU(u,f){do{var y=Sae(u.alternate,u);if(y!==null){y.flags&=32767,oi=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!f&&(u=u.sibling,u!==null)){oi=u;return}oi=u=y}while(u!==null);Fs=6,oi=null}function CU(u,f,y,x,L,V,te,ce,me){u.cancelPendingCommit=null;do mC();while(Ar!==0);if((Ii&6)!==0)throw Error(i(327));if(f!==null){if(f===u.current)throw Error(i(177));if(V=f.lanes|f.childLanes,V|=Be,ot(u,y,V,te,ce,me),u===ts&&(oi=ts=null,li=0),my=f,a0=u,yh=y,J9=V,eA=L,uU=x,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,$ae(Dt,function(){return AU(),null})):(u.callbackNode=null,u.callbackPriority=0),x=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||x){x=_.T,_.T=null,L=N.p,N.p=2,te=Ii,Ii|=4;try{Aae(u,f,y)}finally{Ii=te,N.p=L,_.T=x}}Ar=1,xU(),EU(),_U()}}function xU(){if(Ar===1){Ar=0;var u=a0,f=my,y=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||y){y=_.T,_.T=null;var x=N.p;N.p=2;var L=Ii;Ii|=4;try{nU(f,u);var V=mA,te=Tw(u.containerInfo),ce=V.focusedElem,me=V.selectionRange;if(te!==ce&&ce&&ce.ownerDocument&&Aw(ce.ownerDocument.documentElement,ce)){if(me!==null&&G1(ce)){var De=me.start,qe=me.end;if(qe===void 0&&(qe=De),"selectionStart"in ce)ce.selectionStart=De,ce.selectionEnd=Math.min(qe,ce.value.length);else{var Je=ce.ownerDocument||document,Le=Je&&Je.defaultView||window;if(Le.getSelection){var je=Le.getSelection(),Gt=ce.textContent.length,Sn=Math.min(me.start,Gt),Xi=me.end===void 0?Sn:Math.min(me.end,Gt);!je.extend&&Sn>Xi&&(te=Xi,Xi=Sn,Sn=te);var Ae=Sw(ce,Sn),Ce=Sw(ce,Xi);if(Ae&&Ce&&(je.rangeCount!==1||je.anchorNode!==Ae.node||je.anchorOffset!==Ae.offset||je.focu
vendor: 14,523 bytes, lines 49-50
49sNode!==Ce.node||je.focusOffset!==Ce.offset)){var Ie=Je.createRange();Ie.setStart(Ae.node,Ae.offset),je.removeAllRanges(),Sn>Xi?(je.addRange(Ie),je.extend(Ce.node,Ce.offset)):(Ie.setEnd(Ce.node,Ce.offset),je.addRange(Ie))}}}}for(Je=[],je=ce;je=je.parentNode;)je.nodeType===1&&Je.push({element:je,left:je.scrollLeft,top:je.scrollTop});for(typeof ce.focus=="function"&&ce.focus(),ce=0;ce<Je.length;ce++){var Ze=Je[ce];Ze.element.scrollLeft=Ze.left,Ze.element.scrollTop=Ze.top}}TC=!!pA,mA=pA=null}finally{Ii=L,N.p=x,_.T=y}}u.current=f,Ar=2}}function EU(){if(Ar===2){Ar=0;var u=a0,f=my,y=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||y){y=_.T,_.T=null;var x=N.p;N.p=2;var L=Ii;Ii|=4;try{Q$(u,f.alternate,f)}finally{Ii=L,N.p=x,_.T=y}}Ar=3}}function _U(){if(Ar===4||Ar===3){Ar=0,Ye();var u=a0,f=my,y=yh,x=uU;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?Ar=5:(Ar=0,my=a0=null,SU(u,u.pendingLanes));var L=u.pendingLanes;if(L===0&&(o0=null),Mt(y),f=f.stateNode,ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(nt,f,void 0,(f.current.flags&128)===128)}catch{}if(x!==null){f=_.T,L=N.p,N.p=2,_.T=null;try{for(var V=u.onRecoverableError,te=0;te<x.length;te++){var ce=x[te];V(ce.value,{componentStack:ce.stack})}}finally{_.T=f,N.p=L}}(yh&3)!==0&&mC(),id(u),L=u.pendingLanes,(y&261930)!==0&&(L&42)!==0?u===tA?ov++:(ov=0,tA=u):ov=0,av(0)}}function SU(u,f){(u.pooledCacheLanes&=f)===0&&(f=u.pooledCache,f!=null&&(u.pooledCache=null,jw(f)))}function mC(){return xU(),EU(),_U(),AU()}function AU(){if(Ar!==5)return!1;var u=a0,f=J9;J9=0;var y=Mt(yh),x=_.T,L=N.p;try{N.p=32>y?32:y,_.T=null,y=eA,eA=null;var V=a0,te=yh;if(Ar=0,my=a0=null,yh=0,(Ii&6)!==0)throw Error(i(331));var ce=Ii;if(Ii|=4,aU(V.current),sU(V,V.current,te,y),Ii=ce,av(0,!1),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(nt,V)}catch{}return!0}finally{N.p=L,_.T=x,SU(u,f)}}function TU(u,f,y){f=qr(y,f),f=D9(u.stateNode,f,2),u=e0(u,f,2),u!==null&&(Xe(u,2),id(u))}function ji(u,f,y){if(u.tag===3)TU(u,u,y);else for(;f!==null;){if(f.tag===3){TU(f,u,y);break}else if(f.tag===1){var x=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(o0===null||!o0.has(x))){u=qr(y,u),y=k$(2),x=e0(f,y,2),x!==null&&(N$(y,x,f,u),Xe(x,2),id(x));break}}f=f.return}}function sA(u,f,y){var x=u.pingCache;if(x===null){x=u.pingCache=new Nae;var L=new Set;x.set(f,L)}else L=x.get(f),L===void 0&&(L=new Set,x.set(f,L));L.has(y)||(Z9=!0,L.add(y),u=Oae.bind(null,u,f,y),f.then(u,u))}function Oae(u,f,y){var x=u.pingCache;x!==null&&x.delete(f),u.pingedLanes|=u.suspendedLanes&y,u.warmLanes&=~y,ts===u&&(li&y)===y&&(Fs===4||Fs===3&&(li&62914560)===li&&300>ze()-lC?(Ii&2)===0&&gy(u,0):Q9|=y,py===li&&(py=0)),id(u)}function kU(u,f){f===0&&(f=Ee()),u=Ci(u,f),u!==null&&(Xe(u,f),id(u))}function Mae(u){var f=u.memoizedState,y=0;f!==null&&(y=f.retryLane),kU(u,y)}function Lae(u,f){var y=0;switch(u.tag){case 31:case 13:var x=u.stateNode,L=u.memoizedState;L!==null&&(y=L.retryLane);break;case 19:x=u.stateNode;break;case 22:x=u.stateNode._retryCache;break;default:throw Error(i(314))}x!==null&&x.delete(f),kU(u,y)}function $ae(u,f){return Te(u,f)}var gC=null,by=null,rA=!1,yC=!1,oA=!1,l0=0;function id(u){u!==by&&u.next===null&&(by===null?gC=by=u:by=by.next=u),yC=!0,rA||(rA=!0,Bae())}function av(u,f){if(!oA&&yC){oA=!0;do for(var y=!1,x=gC;x!==null;){if(u!==0){var L=x.pendingLanes;if(L===0)var V=0;else{var te=x.suspendedLanes,ce=x.pingedLanes;V=(1<<31-zt(42|u)+1)-1,V&=L&~(te&~ce),V=V&201326741?V&201326741|1:V?V|2:0}V!==0&&(y=!0,IU(x,V))}else V=li,V=_t(x,x===ts?V:0,x.cancelPendingCommit!==null||x.timeoutHandle!==-1),(V&3)===0||Vt(x,V)||(y=!0,IU(x,V));x=x.next}while(y);oA=!1}}function Uae(){NU()}function NU(){yC=rA=!1;var u=0;l0!==0&&Yae()&&(u=l0);for(var f=ze(),y=null,x=gC;x!==null;){var L=x.next,V=RU(x,f);V===0?(x.next=null,y===null?gC=L:y.next=L,L===null&&(by=y)):(y=x,(u!==0||(V&3)!==0)&&(yC=!0)),x=L}Ar!==0&&Ar!==5||av(u),l0!==0&&(l0=0)}function RU(u,f){for(var y=u.suspendedLanes,x=u.pingedLanes,L=u.expirationTimes,V=u.pendingLanes&-62914561;0<V;){var te=31-zt(V),ce=1<<te,me=L[te];me===-1?((ce&y)===0||(ce&x)!==0)&&(L[te]=Yn(ce,f)):me<=f&&(u.expiredLanes|=ce),V&=~ce}if(f=ts,y=li,y=_t(u,u===f?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),x=u.callbackNode,y===0||u===f&&(Fi===2||Fi===9)||u.cancelPendingCommit!==null)return x!==null&&x!==null&&ve(x),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||Vt(u,y)){if(f=y&-y,f===u.callbackPriority)return f;switch(x!==null&&ve(x),Mt(y)){case 2:case 8:y=We;break;case 32:y=Dt;break;case 268435456:y=it;break;default:y=Dt}return x=PU.bind(null,u),y=Te(y,x),u.callbackPriority=f,u.callbackNode=y,f}return x!==null&&x!==null&&ve(x),u.callbackPriority=2,u.callbackNode=null,2}function PU(u,f){if(Ar!==0&&Ar!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(mC()&&u.callbackNode!==y)return null;var x=li;return x=_t(u,u===ts?x:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),x===0?null:(hU(u,x,f),RU(u,ze()),u.callbackNode!=null&&u.callbackNode===y?PU.bind(null,u):null)}function IU(u,f){if(mC())return null;hU(u,f,!0)}function Bae(){Qae(function(){(Ii&6)!==0?Te(lt,Uae):NU()})}function aA(){if(l0===0){var u=iy;u===0&&(u=bi,bi<<=1,(bi&261888)===0&&(bi=256)),l0=u}return l0}function DU(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:eh(""+u)}function OU(u,f){var y=f.ownerDocument.createElement("input");return y.name=f.name,y.value=f.value,u.id&&y.setAttribute("form",u.id),f.parentNode.insertBefore(y,f),u=new FormData(u),y.parentNode.removeChild(y),u}function Fae(u,f,y,x,L){if(f==="submit"&&y&&y.stateNode===L){var V=DU((L[_n]||null).action),te=x.submitter;te&&(f=(f=te[_n]||null)?DU(f.formAction):te.getAttribute("formAction"),f!==null&&(V=f,te=null));var ce=new Vf("action","action",null,x,L);u.push({event:ce,listeners:[{instance:null,listener:function(){if(x.defaultPrevented){if(l0!==0){var me=te?OU(L,te):new FormData(L);T9(y,{pending:!0,data:me,method:L.method,action:V},null,me)}}else typeof V=="function"&&(ce.preventDefault(),me=te?OU(L,te):new FormData(L),T9(y,{pending:!0,data:me,method:L.method,action:V},V,me))},currentTarget:L}]})}}for(var cA=0;cA<Q1.length;cA++){var lA=Q1[cA],jae=lA.toLowerCase(),Vae=lA[0].toUpperCase()+lA.slice(1);xa(jae,"on"+Vae)}xa(Rw,"onAnimationEnd"),xa(Pw,"onAnimationIteration"),xa(Iw,"onAnimationStart"),xa("dblclick","onDoubleClick"),xa("focusin","onFocus"),xa("focusout","onBlur"),xa(M4,"onTransitionRun"),xa(L4,"onTransitionStart"),xa($4,"onTransitionCancel"),xa(Dw,"onTransitionEnd"),Qc("onMouseEnter",["mouseout","mouseover"]),Qc("onMouseLeave",["mouseout","mouseover"]),Qc("onPointerEnter",["pointerout","pointerover"]),Qc("onPointerLeave",["pointerout","pointerover"]),hc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),hc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),hc("onBeforeInput",["compositionend","keypress","textInput","paste"]),hc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),hc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),hc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cv="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Wae=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cv));function MU(u,f){f=(f&4)!==0;for(var y=0;y<u.length;y++){var x=u[y],L=x.event;x=x.listeners;e:{var V=void 0;if(f)for(var te=x.length-1;0<=te;te--){var ce=x[te],me=ce.instance,De=ce.currentTarget;if(ce=ce.listener,me!==V&&L.isPropagationStopped())break e;V=ce,L.currentTarget=De;try{V(L)}catch(qe){fe(qe)}L.currentTarget=null,V=me}else for(te=0;te<x.length;te++){if(ce=x[te],me=ce.instance,De=ce.currentTarget,ce=ce.listener,me!==V&&L.isPropagationStopped())break e;V=ce,L.currentTarget=De;try{V(L)}catch(qe){fe(qe)}L.currentTarget=null,V=me}}}}function ai(u,f){var y=f[Wn];y===void 0&&(y=f[Wn]=new Set);var x=u+"__bubble";y.has(x)||(LU(f,u,2,!1),y.add(x))}function uA(u,f,y){var x=0;f&&(x|=4),LU(y,u,x,f)}var bC="_reactListening"+Math.random().toString(36).slice(2);function dA(u){if(!u[bC]){u[bC]=!0,qu.forEach(function(y){y!=="selectionchange"&&(Wae.has(y)||uA(y,!1,u),uA(y,!0,u))});var f=u.nodeType===9?u:u.ownerDocument;f===null||f[bC]||(f[bC]=!0,uA("selectionchange",!1,f))}}function LU(u,f,y,x){switch(dB(f)){case 2:var L=yce;break;case 8:L=bce;break;default:L=AA}y=L.bind(null,f,y,u),L=void 0,!el||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(L=!0),x?L!==void 0?u.addEventListener(f,y,{capture:!0,passive:L}):u.addEventListener(f,y,!0):L!==void 0?u.addEventListener(f,y,{passive:L}):u.addEventListener(f,y,!1)}function hA(u,f,y,x,L){var V=x;if((f&1)===0&&(f&2)===0&&x!==null)e:for(;;){if(x===null)return;var te=x.tag;if(te===3||te===4){var ce=x.stateNode.containerInfo;if(ce===L)break;if(te===4)for(te=x.return;te!==null;){var me=te.tag;if((me===3||me===4)&&te.stateNode.containerInfo===L)return;te=te.return}for(;ce!==null;){if(te=ps(ce),te===null)return;if(me=te.tag,me===5||me===6||me===26||me===27){x=V=te;continue e}ce=ce.parentNode}}x=x.return}Bn(function(){var De=V,qe=Jp(y),Je=[];e:{var Le=Ow.get(u);if(Le!==void 0){var je=Vf,Gt=u;switch(u){case"keypress":if(xs(y)===0)break e;case"keydown":case"keyup":je=XS;break;case"focusin":Gt="focus",je=Cn;break;case"focusout":Gt="blur",je=Cn;break;case"beforeblur":case"afterblur":je=Cn;break;case"click":if(y.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":je=C4;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":je=V1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":je=$t;break;case Rw:case Pw:case Iw:je=Pn;break;case Dw:je=uw;break;case"scroll":case"scrollend":je=j1;break;case"wheel":je=dw;break;case"copy":case"cut":case"paste":je=x4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":je=qf;break;case"toggle":case"beforetoggle":je=t9}var Sn=(f&4)!==0,Xi=!Sn&&(u==="scroll"||u==="scrollend"),Ae=Sn?Le!==null?Le+"Capture":null:Le;Sn=[];for(var Ce=De,Ie;Ce!==null;){var Ze=Ce;if(Ie=Ze.stateNode,Ze=Ze.tag,Ze!==5&&Ze!==26&&Ze!==27||Ie===null||Ae===null||(Ze=On(Ce,Ae),Ze!=null&&Sn.push(lv(Ce,Ze,Ie))),Xi)break;Ce=Ce.return}0<Sn.length&&(Le=new je(Le,Gt,null,y,qe),Je.push({event:Le,listeners:Sn}))}}if((f&7)===0){e:{if(Le=u==="mouseover"||u==="pointerover",je=u==="mouseout"||u==="pointerout",Le&&y!==sw&&(Gt=y.relatedTarget||y.fromElement)&&(ps(Gt)||Gt[Cs]))break e;if((je||Le)&&(Le=qe.window===qe?qe:(Le=qe.ownerDocument)?Le.defaultView||Le.parentWindow:window,je?(Gt=y.relatedTarget||y.toElement,je=De,Gt=Gt?ps(Gt):null,Gt!==null&&(Xi=r(Gt),Sn=Gt.tag,Gt!==Xi||Sn!==5&&Sn!==27&&Sn!==6)&&(Gt=null)):(je=null,Gt=De),je!==Gt)){if(Sn=C4,Ze="onMouseLeave",Ae="onMouseEnter",Ce="mouse",(u==="pointerout"||u==="pointerover")&&(Sn=qf,Ze="onPointerLeave",Ae="onPointerEnter",Ce="pointer"),Xi=je==null?Le:Mi(je),Ie=Gt==null?Le:Mi(Gt),Le=new Sn(Ze,Ce+"leave",je,y,qe),Le.target=Xi,Le.relatedTarget=Ie,Ze=null,ps(qe)===De&&(Sn=new Sn(Ae,Ce+"enter",Gt,y,qe),Sn.target=Ie,Sn.relatedTarget=Xi,Ze=Sn),Xi=Ze,je&&Gt)t:{for(Sn=qae,Ae=je,Ce=Gt,Ie=0,Ze=Ae;Ze;Ze=Sn(Ze))Ie++;Ze=0;for(var dn=Ce;dn;dn=Sn(dn))Ze++;for(;0<Ie-Ze;)Ae=Sn(Ae),Ie--;for(;0<Ze-Ie;)Ce=Sn(Ce),Ze--;for(;Ie--;){if(Ae===Ce||Ce!==null&&Ae===Ce.alternate){Sn=Ae;break t}Ae=Sn(Ae),Ce=Sn(Ce)}Sn=null}else Sn=null;je!==null&&$U(Je,Le,je,Sn,!1),Gt!==null&&Xi!==null&&$U(Je,Xi,Gt,Sn,!0)}}e:{if(Le=De?Mi(De):window,je=Le.nodeName&&Le.nodeName.toLowerCase(),je==="select"||je==="input"&&Le.type==="file")var Ai=ww;else if(yw(Le))if(vw)Ai=I4;else{Ai=R4;var Xt=N4}else je=Le.nodeName,!je||je.toLowerCase()!=="input"||Le.type!=="checkbox"&&Le.type!=="radio"?De&&jf(De.elementType)&&(Ai=ww):Ai=P4;if(Ai&&(Ai=Ai(u,De))){bw(Je,Ai,y,qe);break e}Xt&&Xt(u,Le,De),u==="focusout"&&De&&Le.type==="number"&&De.memoizedProps.value!=null&&Xp(Le,"number",Le.value)}switch(Xt=De?Mi(De):window,u){case"focusin":(yw(Xt)||Xt.contentEditable==="true")&&(ih=Xt,K1=De,Yf=null);break;case"focusout":Yf=K1=ih=null;break;case"mousedown":Y1=!0;break;case"contextmenu":case"mouseup":case"dragend":Y1=!1,kw(Je,y,qe);break;case"selectionchange":if(O4)break;case"keydown":case"keyup":kw(Je,y,qe)}var Kn;if(q1)e:{switch(u){case"compositionstart":var ui="onCompositionStart";break e;case"compositionend":ui="onCompositionEnd";break e;case"compositionupdate":ui="onCompositionUpdate";break e}ui=void 0}else nh?mw(u,y)&&(ui="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(ui="onCompositionStart");ui&&(hw&&y.locale!=="ko"&&(nh||ui!=="onCompositionStart"?ui==="onCompositionEnd"&&nh&&(Kn=em()):(Kl=qe,Yl="value"in Kl?Kl.value:Kl.textContent,nh=!0)),Xt=wC(De,ui),0<Xt.length&&(ui=new cw(ui,u,null,y,qe),Je.push({event:ui,listeners:Xt}),Kn?ui.data=Kn:(Kn=gw(y),Kn!==null&&(ui.data=Kn)))),(Kn=_4?S4(u,y):A4(u,y))&&(ui=wC(De,"onBeforeInput"),0<ui.length&&(Xt=new cw("onBeforeInput","beforeinput",null,y,qe),Je.push({event:Xt,listeners:ui}),Xt.data=Kn)),Fae(Je,u,De,y,qe)}MU(Je,f)})}function lv(u,f,y){return{instance:u,listener:f,currentTarget:y}}function wC(u,f){for(var y=f+"Capture",x=[];u!==null;){var L=u,V=L.stateNode;if(L=L.tag,L!==5&&L!==26&&L!==27||V===null||(L=On(u,y),L!=null&&x.unshift(lv(u,L,V)),L=On(u,f),L!=null&&x.push(lv(u,L,V))),u.tag===3)return x;u=u.return}return[]}function qae(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function $U(u,f,y,x,L){for(var V=f._reactName,te=[];y!==null&&y!==x;){var ce=y,me=ce.alternate,De=ce.stateNode;if(ce=ce.tag,me!==null&&me===x)break;ce!==5&&ce!==26&&ce!==27||De===null||(me=De,L?(De=On(y,V),De!=null&&te.unshift(lv(y,De,me))):L||(De=On(y,V),De!=null&&te.push(lv(y,De,me)))),y=y.return}te.length!==0&&u.push({event:f,listeners:te})}var zae=/\r\n?/g,Hae=/\u0000|\uFFFD/g;function UU(u){return(typeof u=="string"?u:""+u).replace(zae,` 50`).replace(Hae,"")}function BU(u,f){return f=UU(f),UU(u)===f}function Qi(u,f,y,x,L,V){switch(y){case"children":typeof x=="str
50ing"?f==="body"||f==="textarea"&&x===""||Zs(u,x):(typeof x=="number"||typeof x=="bigint")&&f!=="body"&&Zs(u,""+x);break;case"className":Jc(u,"class",x);break;case"tabIndex":Jc(u,"tabindex",x);break;case"dir":case"role":case"viewBox":case"width":case"height":Jc(u,y,x);break;case"style":Ff(u,x,V);break;case"data":if(f!=="object"){Jc(u,"data",x);break}case"src":case"href":if(x===""&&(f!=="a"||y!=="href")){u.removeAttribute(y);break}if(x==null||typeof x=="function"||typeof x=="symbol"||typeof x=="boolean"){u.removeAttribute(y);break}x=eh(""+x),u.setAttribute(y,x);break;case"action":case"formAction":if(typeof x=="function"){u.setAttribute(y,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof V=="function"&&(y==="formAction"?(f!=="input"&&Qi(u,f,"name",L.name,L,null),Qi(u,f,"formEncType",L.formEncType,L,null),Qi(u,f,"formMethod",L.formMethod,L,null),Qi(u,f,"formTarget",L.formTarget,L,null)):(Qi(u,f,"encType",L.encType,L,null),Qi(u,f,"method",L.method,L,null),Qi(u,f,"target",L.target,L,null)));if(x==null||typeof x=="symbol"||typeof x=="boolean"){u.removeAttribute(y);break}x=eh(""+x),u.setAttribute(y,x);break;case"onClick":x!=null&&(u.onclick=fc);break;case"onScroll":x!=null&&ai("scroll",u);break;case"onScrollEnd":x!=null&&ai("scrollend",u);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(i(61));if(y=x.__html,y!=null){if(L.children!=null)throw Error(i(60));u.innerHTML=y}}break;case"multiple":u.multiple=x&&typeof x!="function"&&typeof x!="symbol";break;case"muted":u.muted=x&&typeof x!="function"&&typeof x!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(x==null||typeof x=="function"||typeof x=="boolean"||typeof x=="symbol"){u.removeAttribute("xlink:href");break}y=eh(""+x),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",y);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":x!=null&&typeof x!="function"&&typeof x!="symbol"?u.setAttribute(y,""+x):u.removeAttribute(y);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":x&&typeof x!="function"&&typeof x!="symbol"?u.setAttribute(y,""):u.removeAttribute(y);break;case"capture":case"download":x===!0?u.setAttribute(y,""):x!==!1&&x!=null&&typeof x!="function"&&typeof x!="symbol"?u.setAttribute(y,x):u.removeAttribute(y);break;case"cols":case"rows":case"size":case"span":x!=null&&typeof x!="function"&&typeof x!="symbol"&&!isNaN(x)&&1<=x?u.setAttribute(y,x):u.removeAttribute(y);break;case"rowSpan":case"start":x==null||typeof x=="function"||typeof x=="symbol"||isNaN(x)?u.removeAttribute(y):u.setAttribute(y,x);break;case"popover":ai("beforetoggle",u),ai("toggle",u),Xc(u,"popover",x);break;case"xlinkActuate":Pt(u,"http://www.w3.org/1999/xlink","xlink:actuate",x);break;case"xlinkArcrole":Pt(u,"http://www.w3.org/1999/xlink","xlink:arcrole",x);break;case"xlinkRole":Pt(u,"http://www.w3.org/1999/xlink","xlink:role",x);break;case"xlinkShow":Pt(u,"http://www.w3.org/1999/xlink","xlink:show",x);break;case"xlinkTitle":Pt(u,"http://www.w3.org/1999/xlink","xlink:title",x);break;case"xlinkType":Pt(u,"http://www.w3.org/1999/xlink","xlink:type",x);break;case"xmlBase":Pt(u,"http://www.w3.org/XML/1998/namespace","xml:base",x);break;case"xmlLang":Pt(u,"http://www.w3.org/XML/1998/namespace","xml:lang",x);break;case"xmlSpace":Pt(u,"http://www.w3.org/XML/1998/namespace","xml:space",x);break;case"is":Xc(u,"is",x);break;case"innerText":case"textContent":break;default:(!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(y=v4.get(y)||y,Xc(u,y,x))}}function fA(u,f,y,x,L,V){switch(y){case"style":Ff(u,x,V);break;case"dangerouslySetInnerHTML":if(x!=null){if(typeof x!="object"||!("__html"in x))throw Error(i(61));if(y=x.__html,y!=null){if(L.children!=null)throw Error(i(60));u.innerHTML=y}}break;
vendor: 6,160 bytes, line 50
50case"children":typeof x=="string"?Zs(u,x):(typeof x=="number"||typeof x=="bigint")&&Zs(u,""+x);break;case"onScroll":x!=null&&ai("scroll",u);break;case"onScrollEnd":x!=null&&ai("scrollend",u);break;case"onClick":x!=null&&(u.onclick=fc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ql.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(L=y.endsWith("Capture"),f=y.slice(2,L?y.length-7:void 0),V=u[_n]||null,V=V!=null?V[y]:null,typeof V=="function"&&u.removeEventListener(f,V,L),typeof x=="function")){typeof V!="function"&&V!==null&&(y in u?u[y]=null:u.hasAttribute(y)&&u.removeAttribute(y)),u.addEventListener(f,x,L);break e}y in u?u[y]=x:x===!0?u.setAttribute(y,""):Xc(u,y,x)}}}function uo(u,f,y){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ai("error",u),ai("load",u);var x=!1,L=!1,V;for(V in y)if(y.hasOwnProperty(V)){var te=y[V];if(te!=null)switch(V){case"src":x=!0;break;case"srcSet":L=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,f));default:Qi(u,f,V,te,y,null)}}L&&Qi(u,f,"srcSet",y.srcSet,y,null),x&&Qi(u,f,"src",y.src,y,null);return;case"input":ai("invalid",u);var ce=V=te=L=null,me=null,De=null;for(x in y)if(y.hasOwnProperty(x)){var qe=y[x];if(qe!=null)switch(x){case"name":L=qe;break;case"type":te=qe;break;case"checked":me=qe;break;case"defaultChecked":De=qe;break;case"value":V=qe;break;case"defaultValue":ce=qe;break;case"children":case"dangerouslySetInnerHTML":if(qe!=null)throw Error(i(137,f));break;default:Qi(u,f,x,qe,y,null)}}zn(u,V,ce,me,De,te,L,!1);return;case"select":ai("invalid",u),x=te=V=null;for(L in y)if(y.hasOwnProperty(L)&&(ce=y[L],ce!=null))switch(L){case"value":V=ce;break;case"defaultValue":te=ce;break;case"multiple":x=ce;default:Qi(u,f,L,ce,y,null)}f=V,y=te,u.multiple=!!x,f!=null?Ku(u,!!x,f,!1):y!=null&&Ku(u,!!x,y,!0);return;case"textarea":ai("invalid",u),V=L=x=null;for(te in y)if(y.hasOwnProperty(te)&&(ce=y[te],ce!=null))switch(te){case"value":x=ce;break;case"defaultValue":L=ce;break;case"children":V=ce;break;case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(91));break;default:Qi(u,f,te,ce,y,null)}B1(u,x,L,V);return;case"option":for(me in y)if(y.hasOwnProperty(me)&&(x=y[me],x!=null))switch(me){case"selected":u.selected=x&&typeof x!="function"&&typeof x!="symbol";break;default:Qi(u,f,me,x,y,null)}return;case"dialog":ai("beforetoggle",u),ai("toggle",u),ai("cancel",u),ai("close",u);break;case"iframe":case"object":ai("load",u);break;case"video":case"audio":for(x=0;x<cv.length;x++)ai(cv[x],u);break;case"image":ai("error",u),ai("load",u);break;case"details":ai("toggle",u);break;case"embed":case"source":case"link":ai("error",u),ai("load",u);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(De in y)if(y.hasOwnProperty(De)&&(x=y[De],x!=null))switch(De){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,f));default:Qi(u,f,De,x,y,null)}return;default:if(jf(f)){for(qe in y)y.hasOwnProperty(qe)&&(x=y[qe],x!==void 0&&fA(u,f,qe,x,y,void 0));return}}for(ce in y)y.hasOwnProperty(ce)&&(x=y[ce],x!=null&&Qi(u,f,ce,x,y,null))}function Gae(u,f,y,x){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var L=null,V=null,te=null,ce=null,me=null,De=null,qe=null;for(je in y){var Je=y[je];if(y.hasOwnProperty(je)&&Je!=null)switch(je){case"checked":break;case"value":break;case"defaultValue":me=Je;default:x.hasOwnProperty(je)||Qi(u,f,je,null,x,Je)}}for(var Le in x){var je=x[Le];if(Je=y[Le],x.hasOwnProperty(Le)&&(je!=null||Je!=null))switch(Le){case"type":V=je;break;case"name":L=je;break;case"checked":De=je;break;case"defaultChecked":qe=je;break;case"value":te=je;break;case"defaultValue":ce=je;break;case"children":case"dangerouslySetInnerHTML":if(je!=null)throw Error(i(137,f));break;default:je!==Je&&Qi(u,f,Le,je,x,Je)}}U1(u,te,ce,me,De,qe,V,L);return;case"select":je=te=ce=Le=null;for(V in y)if(me=y[V],y.hasOwnProperty(V)&&me!=null)switch(V){case"value":break;case"multiple":je=me;default:x.hasOwnProperty(V)||Qi(u,f,V,null,x,me)}for(L in x)if(V=x[L],me=y[L],x.hasOwnProperty(L)&&(V!=null||me!=null))switch(L){case"value":Le=V;break;case"defaultValue":ce=V;break;case"multiple":te=V;default:V!==me&&Qi(u,f,L,V,x,me)}f=ce,y=te,x=je,Le!=null?Ku(u,!!y,Le,!1):!!x!=!!y&&(f!=null?Ku(u,!!y,f,!0):Ku(u,!!y,y?[]:"",!1));return;case"textarea":je=Le=null;for(ce in y)if(L=y[ce],y.hasOwnProperty(ce)&&L!=null&&!x.hasOwnProperty(ce))switch(ce){case"value":break;case"children":break;default:Qi(u,f,ce,null,x,L)}for(te in x)if(L=x[te],V=y[te],x.hasOwnProperty(te)&&(L!=null||V!=null))switch(te){case"value":Le=L;break;case"defaultValue":je=L;break;case"children":break;case"dangerouslySetInnerHTML":if(L!=null)throw Error(i(91));break;default:L!==V&&Qi(u,f,te,L,x,V)}iw(u,Le,je);return;case"option":for(var Gt in y)if(Le=y[Gt],y.hasOwnProperty(Gt)&&Le!=null&&!x.hasOwnProperty(Gt))switch(Gt){case"selected":u.selected=!1;break;default:Qi(u,f,Gt,null,x,Le)}for(me in x)if(Le=x[me],je=y[me],x.hasOwnProperty(me)&&Le!==je&&(Le!=null||je!=null))switch(me){case"selected":u.selected=Le&&typeof Le!="function"&&typeof Le!="symbol";break;default:Qi(u,f,me,Le,x,je)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Sn in y)Le=y[Sn],y.hasOwnProperty(Sn)&&Le!=null&&!x.hasOwnProperty(Sn)&&Qi(u,f,Sn,null,x,Le);for(De in x)if(Le=x[De],je=y[De],x.hasOwnProperty(De)&&Le!==je&&(Le!=null||je!=null))switch(De){case"children":case"dangerouslySetInnerHTML":if(Le!=null)throw Error(i(137,f));break;default:Qi(u,f,De,Le,x,je)}return;default:if(jf(f)){for(var Xi in y)Le=y[Xi],y.hasOwnProperty(Xi)&&Le!==void 0&&!x.hasOwnProperty(Xi)&&fA(u,f,Xi,void 0,x,Le);for(qe in x)Le=x[qe],je=y[qe],!x.hasOwnProperty(qe)||Le===je||Le===void 0&&je===void 0||fA(u,f,qe,Le,x,je);return}}for(var Ae in y)Le=y[Ae],y.hasOwnProperty(Ae)&&Le!=null&&!x.hasOwnProperty(Ae)&&Qi(u,f,Ae,null,x,Le);
vendor: 14,769 bytes, line 50
50for(Je in x)Le=x[Je],je=y[Je],!x.hasOwnProperty(Je)||Le===je||Le==null&&je==null||Qi(u,f,Je,Le,x,je)}function FU(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Kae(){if(typeof performance.getEntriesByType=="function"){for(var u=0,f=0,y=performance.getEntriesByType("resource"),x=0;x<y.length;x++){var L=y[x],V=L.transferSize,te=L.initiatorType,ce=L.duration;if(V&&ce&&FU(te)){for(te=0,ce=L.responseEnd,x+=1;x<y.length;x++){var me=y[x],De=me.startTime;if(De>ce)break;var qe=me.transferSize,Je=me.initiatorType;qe&&FU(Je)&&(me=me.responseEnd,te+=qe*(me<ce?1:(ce-De)/(me-De)))}if(--x,f+=8*(V+te)/(L.duration/1e3),u++,10<u)break}}if(0<u)return f/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var pA=null,mA=null;function vC(u){return u.nodeType===9?u:u.ownerDocument}function jU(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function VU(u,f){if(u===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&f==="foreignObject"?0:u}function gA(u,f){return u==="textarea"||u==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var yA=null;function Yae(){var u=window.event;return u&&u.type==="popstate"?u===yA?!1:(yA=u,!0):(yA=null,!1)}var WU=typeof setTimeout=="function"?setTimeout:void 0,Zae=typeof clearTimeout=="function"?clearTimeout:void 0,qU=typeof Promise=="function"?Promise:void 0,Qae=typeof queueMicrotask=="function"?queueMicrotask:typeof qU<"u"?function(u){return qU.resolve(null).then(u).catch(Xae)}:WU;function Xae(u){setTimeout(function(){throw u})}function u0(u){return u==="head"}function zU(u,f){var y=f,x=0;do{var L=y.nextSibling;if(u.removeChild(y),L&&L.nodeType===8)if(y=L.data,y==="/$"||y==="/&"){if(x===0){u.removeChild(L),xy(f);return}x--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")x++;else if(y==="html")uv(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,uv(y);for(var V=y.firstChild;V;){var te=V.nextSibling,ce=V.nodeName;V[cs]||ce==="SCRIPT"||ce==="STYLE"||ce==="LINK"&&V.rel.toLowerCase()==="stylesheet"||y.removeChild(V),V=te}}else y==="body"&&uv(u.ownerDocument.body);y=L}while(y);xy(f)}function HU(u,f){var y=u;u=0;do{var x=y.nextSibling;if(y.nodeType===1?f?(y._stashedDisplay=y.style.display,y.style.display="none"):(y.style.display=y._stashedDisplay||"",y.getAttribute("style")===""&&y.removeAttribute("style")):y.nodeType===3&&(f?(y._stashedText=y.nodeValue,y.nodeValue=""):y.nodeValue=y._stashedText||""),x&&x.nodeType===8)if(y=x.data,y==="/$"){if(u===0)break;u--}else y!=="$"&&y!=="$?"&&y!=="$~"&&y!=="$!"||u++;y=x}while(y)}function bA(u){var f=u.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var y=f;switch(f=f.nextSibling,y.nodeName){case"HTML":case"HEAD":case"BODY":bA(y),Vr(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function Jae(u,f,y,x){for(;u.nodeType===1;){var L=y;if(u.nodeName.toLowerCase()!==f.toLowerCase()){if(!x&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(x){if(!u[cs])switch(f){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(V=u.getAttribute("rel"),V==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(V!==L.rel||u.getAttribute("href")!==(L.href==null||L.href===""?null:L.href)||u.getAttribute("crossorigin")!==(L.crossOrigin==null?null:L.crossOrigin)||u.getAttribute("title")!==(L.title==null?null:L.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(V=u.getAttribute("src"),(V!==(L.src==null?null:L.src)||u.getAttribute("type")!==(L.type==null?null:L.type)||u.getAttribute("crossorigin")!==(L.crossOrigin==null?null:L.crossOrigin))&&V&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(f==="input"&&u.type==="hidden"){var V=L.name==null?null:""+L.name;if(L.type==="hidden"&&u.getAttribute("name")===V)return u}else return u;if(u=cl(u.nextSibling),u===null)break}return null}function ece(u,f,y){if(f==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=cl(u.nextSibling),u===null))return null;return u}function GU(u,f){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!f||(u=cl(u.nextSibling),u===null))return null;return u}function wA(u){return u.data==="$?"||u.data==="$~"}function vA(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function tce(u,f){var y=u.ownerDocument;if(u.data==="$~")u._reactRetry=f;else if(u.data!=="$?"||y.readyState!=="loading")f();else{var x=function(){f(),y.removeEventListener("DOMContentLoaded",x)};y.addEventListener("DOMContentLoaded",x),u._reactRetry=x}}function cl(u){for(;u!=null;u=u.nextSibling){var f=u.nodeType;if(f===1||f===3)break;if(f===8){if(f=u.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return u}var CA=null;function KU(u){u=u.nextSibling;for(var f=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(f===0)return cl(u.nextSibling);f--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||f++}u=u.nextSibling}return null}function YU(u){u=u.previousSibling;for(var f=0;u;){if(u.nodeType===8){var y=u.data;if(y==="$"||y==="$!"||y==="$?"||y==="$~"||y==="&"){if(f===0)return u;f--}else y!=="/$"&&y!=="/&"||f++}u=u.previousSibling}return null}function ZU(u,f,y){switch(f=vC(y),u){case"html":if(u=f.documentElement,!u)throw Error(i(452));return u;case"head":if(u=f.head,!u)throw Error(i(453));return u;case"body":if(u=f.body,!u)throw Error(i(454));return u;default:throw Error(i(451))}}function uv(u){for(var f=u.attributes;f.length;)u.removeAttributeNode(f[0]);Vr(u)}var ll=new Map,QU=new Set;function CC(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var bh=N.d;N.d={f:nce,r:ice,D:sce,C:rce,L:oce,m:ace,X:lce,S:cce,M:uce};function nce(){var u=bh.f(),f=hC();return u||f}function ice(u){var f=ko(u);f!==null&&f.tag===5&&f.type==="form"?p$(f):bh.r(u)}var wy=typeof document>"u"?null:document;function XU(u,f,y){var x=wy;if(x&&typeof f=="string"&&f){var L=hi(f);L='link[rel="'+u+'"][href="'+L+'"]',typeof y=="string"&&(L+='[crossorigin="'+y+'"]'),QU.has(L)||(QU.add(L),u={rel:u,crossOrigin:y,href:f},x.querySelector(L)===null&&(f=x.createElement("link"),uo(f,"link",u),Ji(f),x.head.appendChild(f)))}}function sce(u){bh.D(u),XU("dns-prefetch",u,null)}function rce(u,f){bh.C(u,f),XU("preconnect",u,f)}function oce(u,f,y){bh.L(u,f,y);var x=wy;if(x&&u&&f){var L='link[rel="preload"][as="'+hi(f)+'"]';f==="image"&&y&&y.imageSrcSet?(L+='[imagesrcset="'+hi(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(L+='[imagesizes="'+hi(y.imageSizes)+'"]')):L+='[href="'+hi(u)+'"]';var V=L;switch(f){case"style":V=vy(u);break;case"script":V=Cy(u)}ll.has(V)||(u=h({rel:"preload",href:f==="image"&&y&&y.imageSrcSet?void 0:u,as:f},y),ll.set(V,u),x.querySelector(L)!==null||f==="style"&&x.querySelector(dv(V))||f==="script"&&x.querySelector(hv(V))||(f=x.createElement("link"),uo(f,"link",u),Ji(f),x.head.appendChild(f)))}}function ace(u,f){bh.m(u,f);var y=wy;if(y&&u){var x=f&&typeof f.as=="string"?f.as:"script",L='link[rel="modulepreload"][as="'+hi(x)+'"][href="'+hi(u)+'"]',V=L;switch(x){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":V=Cy(u)}if(!ll.has(V)&&(u=h({rel:"modulepreload",href:u},f),ll.set(V,u),y.querySelector(L)===null)){switch(x){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(hv(V)))return}x=y.createElement("link"),uo(x,"link",u),Ji(x),y.head.appendChild(x)}}}function cce(u,f,y){bh.S(u,f,y);var x=wy;if(x&&u){var L=dc(x).hoistableStyles,V=vy(u);f=f||"default";var te=L.get(V);if(!te){var ce={loading:0,preload:null};if(te=x.querySelector(dv(V)))ce.loading=5;else{u=h({rel:"stylesheet",href:u,"data-precedence":f},y),(y=ll.get(V))&&xA(u,y);var me=te=x.createElement("link");Ji(me),uo(me,"link",u),me._p=new Promise(function(De,qe){me.onload=De,me.onerror=qe}),me.addEventListener("load",function(){ce.loading|=1}),me.addEventListener("error",function(){ce.loading|=2}),ce.loading|=4,xC(te,f,x)}te={type:"stylesheet",instance:te,count:1,state:ce},L.set(V,te)}}}function lce(u,f){bh.X(u,f);var y=wy;if(y&&u){var x=dc(y).hoistableScripts,L=Cy(u),V=x.get(L);V||(V=y.querySelector(hv(L)),V||(u=h({src:u,async:!0},f),(f=ll.get(L))&&EA(u,f),V=y.createElement("script"),Ji(V),uo(V,"link",u),y.head.appendChild(V)),V={type:"script",instance:V,count:1,state:null},x.set(L,V))}}function uce(u,f){bh.M(u,f);var y=wy;if(y&&u){var x=dc(y).hoistableScripts,L=Cy(u),V=x.get(L);V||(V=y.querySelector(hv(L)),V||(u=h({src:u,async:!0,type:"module"},f),(f=ll.get(L))&&EA(u,f),V=y.createElement("script"),Ji(V),uo(V,"link",u),y.head.appendChild(V)),V={type:"script",instance:V,count:1,state:null},x.set(L,V))}}function JU(u,f,y,x){var L=(L=Z.current)?CC(L):null;if(!L)throw Error(i(446));switch(u){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(f=vy(y.href),y=dc(L).hoistableStyles,x=y.get(f),x||(x={type:"style",instance:null,count:0,state:null},y.set(f,x)),x):{type:"void",instance:null,count:0,state:null};case"link":if(y.rel==="stylesheet"&&typeof y.href=="string"&&typeof y.precedence=="string"){u=vy(y.href);var V=dc(L).hoistableStyles,te=V.get(u);if(te||(L=L.ownerDocument||L,te={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},V.set(u,te),(V=L.querySelector(dv(u)))&&!V._p&&(te.instance=V,te.state.loading=5),ll.has(u)||(y={rel:"preload",as:"style",href:y.href,crossOrigin:y.crossOrigin,integrity:y.integrity,media:y.media,hrefLang:y.hrefLang,referrerPolicy:y.referrerPolicy},ll.set(u,y),V||dce(L,u,y,te.state))),f&&x===null)throw Error(i(528,""));return te}if(f&&x!==null)throw Error(i(529,""));return null;case"script":return f=y.async,y=y.src,typeof y=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=Cy(y),y=dc(L).hoistableScripts,x=y.get(f),x||(x={type:"script",instance:null,count:0,state:null},y.set(f,x)),x):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,u))}}function vy(u){return'href="'+hi(u)+'"'}function dv(u){return'link[rel="stylesheet"]['+u+"]"}function eB(u){return h({},u,{"data-precedence":u.precedence,precedence:null})}function dce(u,f,y,x){u.querySelector('link[rel="preload"][as="style"]['+f+"]")?x.loading=1:(f=u.createElement("link"),x.preload=f,f.addEventListener("load",function(){return x.loading|=1}),f.addEventListener("error",function(){return x.loading|=2}),uo(f,"link",y),Ji(f),u.head.appendChild(f))}function Cy(u){return'[src="'+hi(u)+'"]'}function hv(u){return"script[async]"+u}function tB(u,f,y){if(f.count++,f.instance===null)switch(f.type){case"style":var x=u.querySelector('style[data-href~="'+hi(y.href)+'"]');if(x)return f.instance=x,Ji(x),x;var L=h({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return x=(u.ownerDocument||u).createElement("style"),Ji(x),uo(x,"style",L),xC(x,y.precedence,u),f.instance=x;case"stylesheet":L=vy(y.href);var V=u.querySelector(dv(L));if(V)return f.state.loading|=4,f.instance=V,Ji(V),V;x=eB(y),(L=ll.get(L))&&xA(x,L),V=(u.ownerDocument||u).createElement("link"),Ji(V);var te=V;return te._p=new Promise(function(ce,me){te.onload=ce,te.onerror=me}),uo(V,"link",x),f.state.loading|=4,xC(V,y.precedence,u),f.instance=V;case"script":return V=Cy(y.src),(L=u.querySelector(hv(V)))?(f.instance=L,Ji(L),L):(x=y,(L=ll.get(V))&&(x=h({},y),EA(x,L)),u=u.ownerDocument||u,L=u.createElement("script"),Ji(L),uo(L,"link",x),u.head.appendChild(L),f.instance=L);case"void":return null;default:throw Error(i(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(x=f.instance,f.state.loading|=4,xC(x,y.precedence,u));return f.instance}function xC(u,f,y){for(var x=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),L=x.length?x[x.length-1]:null,V=L,te=0;te<x.length;te++){var ce=x[te];if(ce.dataset.precedence===f)V=ce;else if(V!==L)break}V?V.parentNode.insertBefore(u,V.nextSibling):(f=y.nodeType===9?y.head:y,f.insertBefore(u,f.firstChild))}function xA(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.title==null&&(u.title=f.title)}function EA(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.integrity==null&&(u.integrity=f.integrity)}var EC=null;function nB(u,f,y){if(EC===null){var x=new Map,L=EC=new Map;L.set(y,x)}else L=EC,x=L.get(y),x||(x=new Map,L.set(y,x));if(x.has(u))return x;for(x.set(u,null),y=y.getElementsByTagName(u),L=0;L<y.length;L++){var V=y[L];if(!(V[cs]||V[un]||u==="link"&&V.getAttribute("rel")==="stylesheet")&&V.namespaceURI!=="http://www.w3.org/2000/svg"){var te=V.getAttribute(f)||"";te=u+te;var ce=x.get(te);ce?ce.push(V):x.set(te,[V])}}return x}function iB(u,f,y){u=u.ownerDocument||u,u.head.insertBefore(y,f==="title"?u.querySelector("head > title"):null)}function hce(u,f,y){if(y===1||f.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return u=f.disabled,typeof f.precedence=="string"&&u==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function sB(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function fce(u,f,y,x){if(y.type==="stylesheet"&&(typeof x.media!="string"||matchMedia(x.media).matches!==!1)&&(y.state.loading&4)===0){if(y.instance===null){var L=vy(x.href),V=f.querySelector(dv(L));if(V){f=V._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=_C.bind(u),f.then(u,u)),y.state.loading|=4,y.instance=V,Ji(V);return}V=f.ownerDocument||f,x=eB(x),(L=ll.get(L))&&xA(x,L),V=V.createElement("link"),Ji(V);var te=V;te._p=new Promise(function(ce,me){te.onload=ce,te.onerror=me}),uo(V,"link",x),y.instance=V}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(y,f),(f=y.state.preload)&&(y.state.loading&3)===0&&(u.count++,y=_C.bind(u),f.addEventListener("load",y),f.addEventListener("error",y))}}var _A=0;
vendor: 4,499 bytes, line 50
50function pce(u,f){return u.stylesheets&&u.count===0&&AC(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var x=setTimeout(function(){if(u.stylesheets&&AC(u,u.stylesheets),u.unsuspend){var V=u.unsuspend;u.unsuspend=null,V()}},6e4+f);0<u.imgBytes&&_A===0&&(_A=62500*Kae());var L=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&AC(u,u.stylesheets),u.unsuspend)){var V=u.unsuspend;u.unsuspend=null,V()}},(u.imgBytes>_A?50:800)+f);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(x),clearTimeout(L)}}:null}function _C(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)AC(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var SC=null;function AC(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,SC=new Map,f.forEach(mce,u),SC=null,_C.call(u))}function mce(u,f){if(!(f.state.loading&4)){var y=SC.get(u);if(y)var x=y.get(null);else{y=new Map,SC.set(u,y);for(var L=u.querySelectorAll("link[data-precedence],style[data-precedence]"),V=0;V<L.length;V++){var te=L[V];(te.nodeName==="LINK"||te.getAttribute("media")!=="not all")&&(y.set(te.dataset.precedence,te),x=te)}x&&y.set(null,x)}L=f.instance,te=L.getAttribute("data-precedence"),V=y.get(te)||x,V===x&&y.set(null,L),y.set(te,L),this.count++,x=_C.bind(this),L.addEventListener("load",x),L.addEventListener("error",x),V?V.parentNode.insertBefore(L,V.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(L,u.firstChild)),f.state.loading|=4}}var fv={$$typeof:A,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function gce(u,f,y,x,L,V,te,ce,me){this.tag=1,this.containerInfo=u,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=$e(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$e(0),this.hiddenUpdates=$e(null),this.identifierPrefix=x,this.onUncaughtError=L,this.onCaughtError=V,this.onRecoverableError=te,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=me,this.incompleteTransitions=new Map}function rB(u,f,y,x,L,V,te,ce,me,De,qe,Je){return u=new gce(u,f,y,te,me,De,qe,Je,ce),f=1,V===!0&&(f|=24),V=Qn(3,null,null,f),u.current=V,V.stateNode=u,f=i9(),f.refCount++,u.pooledCache=f,f.refCount++,V.memoizedState={element:x,isDehydrated:y,cache:f},a9(V),u}function oB(u){return u?(u=cr,u):cr}function aB(u,f,y,x,L,V){L=oB(L),x.context===null?x.context=L:x.pendingContext=L,x=Jf(f),x.payload={element:y},V=V===void 0?null:V,V!==null&&(x.callback=V),y=e0(u,x,f),y!==null&&(Pa(y,u,f),zw(y,u,f))}function cB(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y<f?y:f}}function SA(u,f){cB(u,f),(u=u.alternate)&&cB(u,f)}function lB(u){if(u.tag===13||u.tag===31){var f=Ci(u,67108864);f!==null&&Pa(f,u,67108864),SA(u,67108864)}}function uB(u){if(u.tag===13||u.tag===31){var f=Cc();f=rn(f);var y=Ci(u,f);y!==null&&Pa(y,u,f),SA(u,f)}}var TC=!0;function yce(u,f,y,x){var L=_.T;_.T=null;var V=N.p;try{N.p=2,AA(u,f,y,x)}finally{N.p=V,_.T=L}}function bce(u,f,y,x){var L=_.T;_.T=null;var V=N.p;try{N.p=8,AA(u,f,y,x)}finally{N.p=V,_.T=L}}function AA(u,f,y,x){if(TC){var L=TA(x);if(L===null)hA(u,f,x,kC,y),hB(u,x);else if(vce(L,u,f,y,x))x.stopPropagation();else if(hB(u,x),f&4&&-1<wce.indexOf(u)){for(;L!==null;){var V=ko(L);if(V!==null)switch(V.tag){case 3:if(V=V.stateNode,V.current.memoizedState.isDehydrated){var te=mt(V.pendingLanes);if(te!==0){var ce=V;for(ce.pendingLanes|=2,ce.entangledLanes|=2;te;){var me=1<<31-zt(te);ce.entanglements[1]|=me,te&=~me}id(V),(Ii&6)===0&&(uC=ze()+500,av(0))}}break;case 31:case 13:ce=Ci(V,2),ce!==null&&Pa(ce,V,2),hC(),SA(V,2)}if(V=TA(x),V===null&&hA(u,f,x,kC,y),V===L)break;L=V}L!==null&&x.stopPropagation()}else hA(u,f,x,null,y)}}function TA(u){return u=Jp(u),kA(u)}var kC=null;function kA(u){if(kC=null,u=ps(u),u!==null){var f=r(u);if(f===null)u=null;else{var y=f.tag;if(y===13){if(u=o(f),u!==null)return u;u=null}else if(y===31){if(u=a(f),u!==null)return u;u=null}else if(y===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;u=null}else f!==u&&(u=null)}}return kC=u,null}function dB(u){switch(u){case"beforetoggle":case"cancel":case"click":case"close"
vendor: 4,369 bytes, line 50
50:case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ft()){case lt:return 2;case We:return 8;case Dt:case Fe:return 32;case it:return 268435456;default:return 32}default:return 32}}var NA=!1,d0=null,h0=null,f0=null,pv=new Map,mv=new Map,p0=[],wce="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function hB(u,f){switch(u){case"focusin":case"focusout":d0=null;break;case"dragenter":case"dragleave":h0=null;break;case"mouseover":case"mouseout":f0=null;break;case"pointerover":case"pointerout":pv.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":mv.delete(f.pointerId)}}function gv(u,f,y,x,L,V){return u===null||u.nativeEvent!==V?(u={blockedOn:f,domEventName:y,eventSystemFlags:x,nativeEvent:V,targetContainers:[L]},f!==null&&(f=ko(f),f!==null&&lB(f)),u):(u.eventSystemFlags|=x,f=u.targetContainers,L!==null&&f.indexOf(L)===-1&&f.push(L),u)}function vce(u,f,y,x,L){switch(f){case"focusin":return d0=gv(d0,u,f,y,x,L),!0;case"dragenter":return h0=gv(h0,u,f,y,x,L),!0;case"mouseover":return f0=gv(f0,u,f,y,x,L),!0;case"pointerover":var V=L.pointerId;return pv.set(V,gv(pv.get(V)||null,u,f,y,x,L)),!0;case"gotpointercapture":return V=L.pointerId,mv.set(V,gv(mv.get(V)||null,u,f,y,x,L)),!0}return!1}function fB(u){var f=ps(u.target);if(f!==null){var y=r(f);if(y!==null){if(f=y.tag,f===13){if(f=o(y),f!==null){u.blockedOn=f,ln(u.priority,function(){uB(y)});return}}else if(f===31){if(f=a(y),f!==null){u.blockedOn=f,ln(u.priority,function(){uB(y)});return}}else if(f===3&&y.stateNode.current.memoizedState.isDehydrated){u.blockedOn=y.tag===3?y.stateNode.containerInfo:null;return}}}u.blockedOn=null}function NC(u){if(u.blockedOn!==null)return!1;for(var f=u.targetContainers;0<f.length;){var y=TA(u.nativeEvent);if(y===null){y=u.nativeEvent;var x=new y.constructor(y.type,y);sw=x,y.target.dispatchEvent(x),sw=null}else return f=ko(y),f!==null&&lB(f),u.blockedOn=y,!1;f.shift()}return!0}function pB(u,f,y){NC(u)&&y.delete(f)}function Cce(){NA=!1,d0!==null&&NC(d0)&&(d0=null),h0!==null&&NC(h0)&&(h0=null),f0!==null&&NC(f0)&&(f0=null),pv.forEach(pB),mv.forEach(pB)}function RC(u,f){u.blockedOn===f&&(u.blockedOn=null,NA||(NA=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Cce)))}var PC=null;function mB(u){PC!==u&&(PC=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){PC===u&&(PC=null);for(var f=0;f<u.length;f+=3){var y=u[f],x=u[f+1],L=u[f+2];if(typeof x!="function"){if(kA(x||y)===null)continue;break}var V=ko(y);V!==null&&(u.splice(f,3),f-=3,T9(V,{pending:!0,data:L,method:y.method,action:x},x,L))}}))}function xy(u){function f(me){return RC(me,u)}d0!==null&&RC(d0,u),h0!==null&&RC(h0,u),f0!==null&&RC(f0,u),pv.forEach(f),mv.forEach(f);for(var y=0;y<p0.length;y++){var x=p0[y];x.blockedOn===u&&(x.blockedOn=null)}for(;0<p0.length&&(y=p0[0],y.blockedOn===null);)fB(y),y.blockedOn===null&&p0.shift();if(y=(u.ownerDocument||u).$$reactFormReplay,y!=null)for(x=0;x<y.length;x+=3){var L=y[x],V=y[x+1],te=L[_n]||null;if(typeof V=="function")te||mB(y);else if(te){var ce=null;if(V&&V.hasAttribute("formAction")){if(L=V,te=V[_n]||null)ce=te.formAction;else if(kA(L)!==null)continue}else ce=te.action;
50typeof ce=="function"?y[x+1]=ce:(y.splice(x,3),x-=3),mB(y)}}}function gB(){function u(V){V.canIntercept&&V.info==="react-transition"&&V.intercept({handler:function(){return new Promise(function(te){return L=te})},focusReset:"manual",scroll:"manual"})}function f(){L!==null&&(L(),L=null),x||setTimeout(y,20)}function y(){if(!x&&!navigation.transition){var V=navigation.currentEntry;V&&V.url!=null&&navigation.navigate(V.url,{state:V.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var x=!1,L=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(y,100),function(){x=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),L!==null&&(L(),L=null)}}}function RA(u){this._internalRoot=u}IC.prototype.render=RA.prototype.render=function(u){var f=this._internalRoot;if(f===null)throw Error(i(409));var y=f.current,x=Cc();aB(y,x,u,f,null,null)},IC.prototype.unmount=RA.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var f=u.containerInfo;aB(u.current,2,null,u,null,null),hC(),f[Cs]=null}};function IC(u){this._internalRoot=u}IC.prototype.unstable_scheduleHydration=function(u){if(u){var f=nn();u={blockedOn:null,target:u,priority:f};for(var y=0;y<p0.length&&f!==0&&f<p0[y].priority;y++);p0.splice(y,0,u),y===0&&fB(u)}};var yB=e.version;if(yB!=="19.2.1")throw Error(i(527,yB,"19.2.1"));N.findDOMNode=function(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(i(188)):(u=Object.keys(u).join(","),Error(i(268,u)));return u=l(f),u=u!==null?d(u):null,u=u===null?null:u.stateNode,u};var xce={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:_,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var DC=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!DC.isDisabled&&DC.supportsFiber)try{nt=DC.inject(xce),ht=DC}catch{}}return bv.createRoot=function(u,f){if(!s(u))throw Error(i(299));var y=!1,x="",L=_$,V=S$,te=A$;return f!=null&&(f.unstable_strictMode===!0&&(y=!0),f.identifierPrefix!==void 0&&(x=f.identifierPrefix),f.onUncaughtError!==void 0&&(L=f.onUncaughtError),f.onCaughtError!==void 0&&(V=f.onCaughtError),f.onRecoverableError!==void 0&&(te=f.onRecoverableError)),f=rB(u,1,!1,null,null,y,x,null,L,V,te,gB),u[Cs]=f.current,dA(u),new RA(f)},bv.hydrateRoot=function(u,f,y){if(!s(u))throw Error(i(299));var x=!1,L="",V=_$,te=S$,ce=A$,me=null;return y!=null&&(y.unstable_strictMode===!0&&(x=!0),y.identifierPrefix!==void 0&&(L=y.identifierPrefix),y.onUncaughtError!==void 0&&(V=y.onUncaughtError),y.onCaughtError!==void 0&&(te=y.onCaughtError),y.onRecoverableError!==void 0&&(ce=y.onRecoverableError),y.formState!==void 0&&(me=y.formState)),f=rB(u,1,!0,f,y??null,x,L,me,V,te,ce,gB),f.context=oB(null),y=f.current,x=Cc(),x=rn(x),L=Jf(x),L.callback=null,e0(y,L,x),y=x,f.current.lanes=y,Xe(f,y),id(f),u[Cs]=f.current,dA(u),new IC(f)},bv.version="19.2.1",bv}var kB;function Dce(){if(kB)return MA.exports;kB=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),MA.exports=Ice(),MA.exports}var Oce=Dce();const Mce=ya(Oce);var BA={exports:{}},FA={};/** 51 * @license React 52 * use-sync-external-store-with-selector.production.js 53 * 54 * Copyright (c) Meta Platforms, Inc. and affiliates. 55 * 56 * This source code is licensed under the MIT license found in the 57 * LICENSE file in the root directory of this source tree. 58 */var NB;function Lce(){if(NB)return FA;NB=1;var t=_b();function e(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var n=typeof Object.is=="function"?Object.is:e,i=t.useSyncExternalStore,s=t.useRef,r=t.useEffect,o=t.useMemo,a=t.useDebugValue;return FA.useSyncExternalStoreWithSelector=function(c,l,d,h,p){var g=s(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=o(function(){function C(R){if(!E){if(E=!0,T=R,R=h(R),p!==void 0&&b.hasValue){var P=b.value;if(p(P,R))return A=P}return A=R}if(P=A,n(T,R))return P;var B=h(R);return p!==void 0&&p(P,B)?(T=R,P):(T=R,A=B)}var E=!1,T,A,k=d===void 0?null:d;return[function(){return C(l())},k===null?void 0:function(){return C(k())}]},[l,d,h,p]);var w=i(c,g[0],g[1]);return r(function(){b.hasValue=!0,b.value=w},[w]),a(w),w},FA}var RB;function $ce(){return RB||(RB=1,BA.exports=Lce()),BA.exports}var Uce=$ce();function Bce(t){t()}function Fce(){let t=null,e=null;return{clear(){t=null,e=null},notify(){Bce(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let i=t;for(;i;)n.push(i),i=i.next;return n},subscribe(n){let i=!0;const s=e={callback:n,next:null,prev:e};return s.prev?s.prev.next=s:t=s,function(){!i||t===null||(i=!1,s.next?s.next.prev=s.prev:e=s.prev,s.prev?s.prev.next=s.next:t=s.next)}}}}var PB={notify(){},get:()=>[]};function jce(t,e){let n,i=PB,s=0,r=!1;function o(w){d();const C=i.subscribe(w);let E=!1;return()=>{E||(E=!0,C(),h())}}function a(){i.notify()}function c(){b.onStateChange&&b.onStateChange()}function l(){return r}function d(){s++,n||(n=t.subscribe(c),i=Fce())}function h(){s--,n&&s===0&&(n(),n=void 0,i.clear(),i=PB)}function p(){r||(r=!0,d())}function g(){r&&(r=!1,h())}const b={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:c,isSubscribed:l,trySubscribe:p,tryUnsubscribe:g,getListeners:()=>i};return b}var Vce=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Wce=Vce(),qce=()=>typeof navigator<"u"&&navigator.product==="ReactNative",zce=qce(),Hce=()=>Wce||zce?M.useLayoutEffect:M.useEffect,Gce=Hce(),jA=Symbol.for("react-redux-context"),VA=typeof globalThis<"u"?globalThis:{};function Kce(){if(!M.createContext)return{};const t=VA[jA]??(VA[jA]=new Map);let e=t.get(M.createContext);return e||(e=M.createContext(null),t.set(M.createContext,e)),e}var pp=Kce();function Yce(t){const{children:e,context:n,serverState:i,store:s}=t,r=M.useMemo(()=>{const c=jce(s);return{store:s,subscription:c,getServerState:i?()=>i:void 0}},[s,i]),o=M.useMemo(()=>s.getState(),[s]);Gce(()=>{const{subscription:c}=r;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==s.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[r,o]);const a=n||pp;return M.createElement(a.Provider,{value:r},e)}var Zce=Yce;function XI(t=pp){return function(){return M.useContext(t)}
58}var qY=XI();function zY(t=pp){const e=t===pp?qY:XI(t),n=()=>{const{store:i}=e();return i};return Object.assign(n,{withTypes:()=>n}),n}var Qce=zY();function Xce(t=pp){const e=t===pp?Qce:zY(t),n=()=>e().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Jce=Xce(),ele=(t,e)=>t===e;function tle(t=pp){const e=t===pp?qY:XI(t),n=(i,s={})=>{const{equalityFn:r=ele}=typeof s=="function"?{equalityFn:s}:s,o=e(),{store:a,subscription:c,getServerState:l}=o;M.useRef(!0);const d=M.useCallback({[i.name](p){return i(p)}}[i.name],[i]),h=Uce.useSyncExternalStoreWithSelector(c.addNestedSub,a.getState,l||a.getState,d,r);return M.useDebugValue(h),h};return Object.assign(n,{withTypes:()=>n}),n}var nle=tle();function go(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var ile=typeof Symbol=="function"&&Symbol.observable||"@@observable",IB=ile,WA=()=>Math.random().toString(36).substring(7).split("").join("."),sle={INIT:`@@redux/INIT${WA()}`,REPLACE:`@@redux/REPLACE${WA()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${WA()}`},AE=sle;function JI(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function HY(t,e,n){if(typeof t!="function")throw new Error(go(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(go(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(go(1));return n(HY)(t,e)}let i=t,s=e,r=new Map,o=r,a=0,c=!1;function l(){o===r&&(o=new Map,r.forEach((C,E)=>{o.set(E,C)}))}function d(){if(c)throw new Error(go(3));return s}function h(C){if(typeof C!="function")throw new Error(go(4));if(c)throw new Error(go(5));let E=!0;l();const T=a++;return o.set(T,C),function(){if(E){if(c)throw new Error(go(6));E=!1,l(),o.delete(T),r=null}}}function p(C){if(!JI(C))throw new Error(go(7));if(typeof C.type>"u")throw new Error(go(8));if(typeof C.type!="string")throw new Error(go(17));if(c)throw new Error(go(9));try{c=!0,s=i(s,C)}finally{c=!1}return(r=o).forEach(T=>{T()}),C}function g(C){if(typeof C!="function")throw new Error(go(10));i=C,p({type:AE.REPLACE})}function b(){const C=h;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(go(11));function T(){const k=E;k.next&&k.next(d())}return T(),{unsubscribe:C(T)}},[IB](){return this}}}return p({type:AE.INIT}),{dispatch:p,subscribe:h,getState:d,replaceReducer:g,[IB]:b}}function rle(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:AE.INIT})>"u")throw new Error(go(12));if(typeof n(void 0,{type:AE.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(go(13))})}function ole(t){const e=Object.keys(t),n={};for(let r=0;r<e.length;r++){const o=e[r];typeof t[o]=="function"&&(n[o]=t[o])}const i=Object.keys(n);let s;try{rle(n)}catch(r){s=r}return function(o={},a){if(s)throw s;let c=!1;const l={};for(let d=0;d<i.length;d++){const h=i[d],p=n[h],g=o[h],b=p(g,a);if(typeof b>"u")throw a&&a.type,new Error(go(14));l[h]=b,c=c||b!==g}return c=c||i.length!==Object.keys(o).length,c?l:o}}function TE(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...i)=>e(n(...i)))}function ale(...t){return e=>(n,i)=>{const s=e(n,i);let r=()=>{throw new Error(go(15))};const o={getState:s.getState,dispatch:(c,...l)=>r(c,...l)},a=t.map(c=>c(o));return r=TE(...a)(s.dispatch),{...s,dispatch:r}}}function cle(t){return JI(t)&&"type"in t&&typeof t.type=="string"}var GY=Symbol.for("immer-nothing"),DB=Symbol.for("immer-draftable"),pa=Symbol.for("immer-state");function Cu(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var $c=Object,q2=$c.getPrototypeOf,kE="constructor",w8="prototype",xN="configurable",NE="enumerable",Gx="writable",k3="value",hf=t=>!!t&&!!t[pa];function Ru(t){var e;return t?KY(t)||v8(t)||!!t[DB]||!!((e=t[kE])!=null&&e[DB])||C8(t)||x8(t):!1}var lle=$c[w8][kE].toString(),OB=new WeakMap;function KY(t){if(!t||!eD(t))return!1;const e=q2(t);if(e===null||e===$c[w8])return!0;const n=$c.hasOwnProperty.call(e,kE)&&e[kE];if(n===Object)return!0;
58if(!Fy(n))return!1;let i=OB.get(n);return i===void 0&&(i=Function.toString.call(n),OB.set(n,i)),i===lle}function r6(t,e,n=!0){o6(t)===0?(n?Reflect.ownKeys(t):$c.keys(t)).forEach(s=>{e(s,t[s],t)}):t.forEach((i,s)=>e(s,i,t))}function o6(t){const e=t[pa];return e?e.type_:v8(t)?1:C8(t)?2:x8(t)?3:0}var MB=(t,e,n=o6(t))=>n===2?t.has(e):$c[w8].hasOwnProperty.call(t,e),EN=(t,e,n=o6(t))=>n===2?t.get(e):t[e],RE=(t,e,n,i=o6(t))=>{i===2?t.set(e,n):i===3?t.add(n):t[e]=n};function ule(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var v8=Array.isArray,C8=t=>t instanceof Map,x8=t=>t instanceof Set,eD=t=>typeof t=="object",Fy=t=>typeof t=="function",qA=t=>typeof t=="boolean",Fh=t=>t.copy_||t.base_,tD=t=>t.modified_?t.copy_:t.base_;function _N(t,e){if(C8(t))return new Map(t);if(x8(t))return new Set(t);if(v8(t))return Array[w8].slice.call(t);const n=KY(t);if(e===!0||e==="class_only"&&!n){const i=$c.getOwnPropertyDescriptors(t);delete i[pa];let s=Reflect.ownKeys(i);for(let r=0;r<s.length;r++){const o=s[r],a=i[o];a[Gx]===!1&&(a[Gx]=!0,a[xN]=!0),(a.get||a.set)&&(i[o]={[xN]:!0,[Gx]:!0,[NE]:a[NE],[k3]:t[o]})}return $c.create(q2(t),i)}else{const i=q2(t);if(i!==null&&n)return{...t};const s=$c.create(i);return $c.assign(s,t)}}function nD(t,e=!1){return E8(t)||hf(t)||!Ru(t)||(o6(t)>1&&$c.defineProperties(t,{set:MC,add:MC,clear:MC,delete:MC}),$c.freeze(t),e&&r6(t,(n,i)=>{nD(i,!0)},!1)),t}function dle(){Cu(2)}var MC={[k3]:dle};function E8(t){return t===null||!eD(t)?!0:$c.isFrozen(t)}var PE="MapSet",SN="Patches",YY={};function z2(t){const e=YY[t];return e||Cu(0,t),e}var hle=t=>!!YY[t],N3,ZY=()=>N3,fle=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:hle(PE)?z2(PE):void 0});function LB(t,e){e&&(t.patchPlugin_=z2(SN),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function AN(t){TN(t),t.drafts_.forEach(ple),t.drafts_=null}function TN(t){t===N3&&(N3=t.parent_)}var $B=t=>N3=fle(N3,t);function ple(t){const e=t[pa];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function UB(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[pa].modified_&&(AN(e),Cu(4)),Ru(t)&&(t=BB(e,t));const{patchPlugin_:s}=e;s&&s.generateReplacementPatches_(n[pa].base_,t,e)}else t=BB(e,n);return mle(e,t,!0),AN(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==GY?t:void 0}function BB(t,e){if(E8(e))return e;const n=e[pa];if(!n)return iD(e,t.handledSet_,t);if(!_8(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:i}=n;if(i)for(;i.length>0;)i.pop()(t);JY(n,t)}return n.copy_}function mle(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&nD(e,n)}function QY(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var _8=(t,e)=>t.scope_===e,gle=[];function XY(t,e,n,i){const s=Fh(t),r=t.type_;if(i!==void 0&&EN(s,i,r)===e){RE(s,i,n,r);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;r6(s,(c,l)=>{if(hf(l)){const d=a.get(l)||[];d.push(c),a.set(l,d)}})}const o=t.draftLocations_.get(e)??gle;for(const a of o)RE(s,a,n,r)}function yle(t,e,n){t.callbacks_.push(function(s){var a;const r=e;if(!r||!_8(r,s))return;(a=s.mapSetPlugin_)==null||a.fixSetContents(r);const o=tD(r);XY(t,r.draft_??r,o,n),JY(r,s)})}function JY(t,e){var i;if(t.modified_&&!t.finalized_&&(t.type_===3||(((i=t.assigned_)==null?void 0:i.size)??0)>0)){const{patchPlugin_:s}=e;if(s){const r=s.getPath(t);r&&s.generatePatches_(t,r,e)}QY(t)}}function ble(t,e,n){const{scope_:i}=t;if(hf(n)){const s=n[pa];_8(s,i)&&s.callbacks_.push(function(){Kx(t);const o=tD(s);XY(t,n,o,e)})}else Ru(n)&&t.callbacks_.push(function(){const r=Fh(t);EN(r,e,t.type_)===n&&i.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&iD(EN(t.copy_,e,t.type_),i.handledSet_,i)})}function iD(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||hf(t)||e.has(t)||!Ru(t)||E8(t)||(e.add(t),r6(t,(i,s)=>{if(hf(s)){const r=s[pa];if(_8(r,n)){const o=tD(r);RE(t,i,o,t.type_),QY(r)}}else Ru(s)&&iD(s,e,n)})),t}function wle(t,e){const n=v8(t),i={type_:n?1:0,scope_:e?e.scope_:ZY(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let s=i,r=sD;n&&(s=[i],r=R3);const{revoke:o,proxy:a}=Proxy.revocable(s,r);return i.draft_=a,i.revoke_=o,[a,i]}var sD={get(t,e){if(e===pa)return t;const n=Fh(t);if(!MB(n,e,t.type_))return vle(t,n,e);const i=n[e];if(t.finalized_||!Ru(i))return i;if(i===zA(t.base_,e)){Kx(t);const s=t.type_===1?+e:e,r=NN(t.scope_,i,t,s);return t.copy_[s]=r}return i},has(t,e){return e in Fh(t)},ownKeys(t){return Reflect.ownKeys(Fh(t))},set(t,e,n){const i=eZ(Fh(t),e);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=zA(Fh(t),e),r=s==null?void 0:s[pa];if(r&&r.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(ule(n,s)&&(n!==void 0||MB(t.base_,e,t.type_)))return!0;Kx(t),kN(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),ble(t,e,n)),!0},deleteProperty(t,e){return Kx(t),zA(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),kN(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Fh(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{[Gx]:!0,[xN]:t.type_!==1||e!=="length",[NE]:i[NE],[k3]:n[e]}},defineProperty(){Cu(11)},getPrototypeOf(t){return q2(t.base_)},setPrototypeOf(){Cu(12)}},R3={};r6(sD,(t,e)=>{R3[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}});R3.deleteProperty=function(t,e){return R3.set.call(this,t,e,void 0)};R3.set=function(t,e,n){return sD.set.call(this,t[0],e,n,t[0])};function zA(t,e){const n=t[pa];return(n?Fh(n):t)[e]}function vle(t,e,n){var s;const i=eZ(e,n);return i?k3 in i?i[k3]:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function eZ(t,e){if(!(e in t))return;let n=q2(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=q2(n)}}function kN(t){t.modified_||(t.modified_=!0,t.parent_&&kN(t.parent_))}function Kx(t){t.copy_||(t.assigned_=new Map,t.copy_=_N(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Cle=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,n,i)=>{if(Fy(e)&&!Fy(n)){const r=n;n=e;const o=this;return function(c=r,...l){return o.produce(c,d=>n.call(this,d,...l))}}Fy(n)||Cu(6),i!==void 0&&!Fy(i)&&Cu(7);let s;if(Ru(e)){const r=$B(this),o=NN(r,e,void 0);let a=!0;
58try{s=n(o),a=!1}finally{a?AN(r):TN(r)}return LB(r,i),UB(s,r)}else if(!e||!eD(e)){if(s=n(e),s===void 0&&(s=e),s===GY&&(s=void 0),this.autoFreeze_&&nD(s,!0),i){const r=[],o=[];z2(SN).generateReplacementPatches_(e,s,{patches_:r,inversePatches_:o}),i(r,o)}return s}else Cu(1,e)},this.produceWithPatches=(e,n)=>{if(Fy(e))return(o,...a)=>this.produceWithPatches(o,c=>e(c,...a));let i,s;return[this.produce(e,n,(o,a)=>{i=o,s=a}),i,s]},qA(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),qA(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),qA(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ru(t)||Cu(8),hf(t)&&(t=xle(t));const e=$B(this),n=NN(e,t,void 0);return n[pa].isManual_=!0,TN(e),n}finishDraft(t,e){const n=t&&t[pa];(!n||!n.isManual_)&&Cu(9);const{scope_:i}=n;return LB(i,e),UB(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(e=e.slice(n+1));const i=z2(SN).applyPatches_;return hf(t)?i(t,e):this.produce(t,s=>i(s,e))}};function NN(t,e,n,i){const[s,r]=C8(e)?z2(PE).proxyMap_(e,n):x8(e)?z2(PE).proxySet_(e,n):wle(e,n);return((n==null?void 0:n.scope_)??ZY()).drafts_.push(s),r.callbacks_=(n==null?void 0:n.callbacks_)??[],r.key_=i,n&&i!==void 0?yle(n,r,i):r.callbacks_.push(function(c){var d;(d=c.mapSetPlugin_)==null||d.fixSetContents(r);const{patchPlugin_:l}=c;r.modified_&&l&&l.generatePatches_(r,[],c)}),s}function xle(t){return hf(t)||Cu(10,t),tZ(t)}function tZ(t){if(!Ru(t)||E8(t))return t;const e=t[pa];let n,i=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=_N(t,e.scope_.immer_.useStrictShallowCopy_),i=e.scope_.immer_.shouldUseStrictIteration()}else n=_N(t,!0);return r6(n,(s,r)=>{RE(n,s,tZ(r))},i),e&&(e.finalized_=!1),n}var Ele=new Cle,nZ=Ele.produce;function iZ(t){return({dispatch:n,getState:i})=>s=>r=>typeof r=="function"?r(n,i,t):s(r)}var _le=iZ(),Sle=iZ,Ale=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?TE:TE.apply(null,arguments)};function FB(t,e){function n(...i){if(e){let s=e(...i);if(!s)throw new Error(Jh(0));return{type:t,payload:s.payload,..."meta"in s&&{meta:s.meta},..."error"in s&&{error:s.error}}}return{type:t,payload:i[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=i=>cle(i)&&i.type===t,n}var sZ=class Zv extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Zv.prototype)}static get[Symbol.species](){return Zv}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Zv(...e[0].concat(this)):new Zv(...e.concat(this))}};function jB(t){return Ru(t)?nZ(t,()=>{}):t}function LC(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function Tle(t){return typeof t=="boolean"}var kle=()=>function(e){const{thunk:n=!0,immutableCheck:i=!0,serializableCheck:s=!0,actionCreatorCheck:r=!0}=e??{};let o=new sZ;return n&&(Tle(n)?o.push(_le):o.push(Sle(n.extraArgument))),o},Nle="RTK_autoBatch",VB=t=>e=>{setTimeout(e,t)},Rle=(t={type:"raf"})=>e=>(...n)=>{const i=e(...n);let s=!0,r=!1,o=!1;const a=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:VB(10):t.type==="callback"?t.queueNotification:VB(t.timeout),l=()=>{o=!1,r&&(r=!1,a.forEach(d=>d()))};return Object.assign({},i,{subscribe(d){const h=()=>s&&d(),p=i.subscribe(h);return a.add(d),()=>{p(),a.delete(d)}},dispatch(d){var h;try{return s=!((h=d==null?void 0:d.meta)!=null&&h[Nle]),r=!s,r&&(o||(o=!0,c(l))),i.dispatch(d)}finally{s=!0}}})},Ple=t=>function(n){const{autoBatch:i=!0}=n??{};let s=new sZ(t);return i&&s.push(Rle(typeof i=="object"?i:void 0)),s};function Ile(t){const e=kle(),{reducer:n=void 0,middleware:i,devTools:s=!0,preloadedState:r=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(JI(n))a=ole(n);else throw new Error(Jh(1));let c;typeof i=="function"?c=i(e):c=e();let l=TE;s&&(l=Ale({trace:!1,...typeof s=="object"&&s}));const d=ale(...c),h=Ple(d);
58let p=typeof o=="function"?o(h):h();const g=l(...p);return HY(a,r,g)}function rZ(t){const e={},n=[];let i;const s={addCase(r,o){const a=typeof r=="string"?r:r.type;if(!a)throw new Error(Jh(28));if(a in e)throw new Error(Jh(29));return e[a]=o,s},addAsyncThunk(r,o){return o.pending&&(e[r.pending.type]=o.pending),o.rejected&&(e[r.rejected.type]=o.rejected),o.fulfilled&&(e[r.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:r.settled,reducer:o.settled}),s},addMatcher(r,o){return n.push({matcher:r,reducer:o}),s},addDefaultCase(r){return i=r,s}};return t(s),[e,n,i]}function Dle(t){return typeof t=="function"}function Ole(t,e){let[n,i,s]=rZ(e),r;if(Dle(t))r=()=>jB(t());else{const a=jB(t);r=()=>a}function o(a=r(),c){let l=[n[c.type],...i.filter(({matcher:d})=>d(c)).map(({reducer:d})=>d)];return l.filter(d=>!!d).length===0&&(l=[s]),l.reduce((d,h)=>{if(h)if(hf(d)){const g=h(d,c);return g===void 0?d:g}else{if(Ru(d))return nZ(d,p=>h(p,c));{const p=h(d,c);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},a)}return o.getInitialState=r,o}var Mle=Symbol.for("rtk-slice-createasyncthunk");function Lle(t,e){return`${t}/${e}`}function $le({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[Mle];return function(s){const{name:r,reducerPath:o=r}=s;if(!r)throw new Error(Jh(11));const a=(typeof s.reducers=="function"?s.reducers(Ble()):s.reducers)||{},c=Object.keys(a),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(k,R){const P=typeof k=="string"?k:k.type;if(!P)throw new Error(Jh(12));if(P in l.sliceCaseReducersByType)throw new Error(Jh(13));return l.sliceCaseReducersByType[P]=R,d},addMatcher(k,R){return l.sliceMatchers.push({matcher:k,reducer:R}),d},exposeAction(k,R){return l.actionCreators[k]=R,d},exposeCaseReducer(k,R){return l.sliceCaseReducersByName[k]=R,d}};c.forEach(k=>{const R=a[k],P={reducerName:k,type:Lle(r,k),createNotation:typeof s.reducers=="function"};jle(R)?Wle(P,R,d,e):Fle(P,R,d)});function h(){const[k={},R=[],P=void 0]=typeof s.extraReducers=="function"?rZ(s.extraReducers):[s.extraReducers],B={...k,...l.sliceCaseReducersByType};return Ole(s.initialState,F=>{for(let z in B)F.addCase(z,B[z]);for(let z of l.sliceMatchers)F.addMatcher(z.matcher,z.reducer);for(let z of R)F.addMatcher(z.matcher,z.reducer);P&&F.addDefaultCase(P)})}const p=k=>k,g=new Map,b=new WeakMap;let w;function C(k,R){return w||(w=h()),w(k,R)}function E(){return w||(w=h()),w.getInitialState()}function T(k,R=!1){function P(F){let z=F[k];return typeof z>"u"&&R&&(z=LC(b,P,E)),z}function B(F=p){const z=LC(g,R,()=>new WeakMap);return LC(z,F,()=>{const K={};for(const[q,G]of Object.entries(s.selectors??{}))K[q]=Ule(G,F,()=>LC(b,F,E),R);return K})}return{reducerPath:k,getSelectors:B,get selectors(){return B(P)},selectSlice:P}}const A={name:r,reducer:C,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:E,...T(o),injectInto(k,{reducerPath:R,...P}={}){const B=R??o;return k.inject({reducerPath:B,reducer:C},P),{...A,...T(B,!0)}}};return A}}function Ule(t,e,n,i){function s(r,...o){let a=e(r);return typeof a>"u"&&i&&(a=n()),t(a,...o)}return s.unwrapped=t,s}var oZ=$le();function Ble(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function Fle({type:t,reducerName:e,createNotation:n},i,s){let r,o;if("reducer"in i){if(n&&!Vle(i))throw new Error(Jh(17));r=i.reducer,o=i.prepare}else r=i;s.addCase(t,r).exposeCaseReducer(e,r).exposeAction(e,o?FB(t,o):FB(t))}function jle(t){return t._reducerDefinitionType==="asyncThunk"}function Vle(t){return t._reducerDefinitionType==="reducerWithPrepare"}function Wle({type:t,reducerName:e},n,i,s){if(!s)throw new Error(Jh(18));const{payloadCreator:r,fulfilled:o,pending:a,rejected:c,settled:l,options:d}=n,h=s(t,r,d);i.exposeAction(e,h),o&&i.addCase(h.fulfilled,o),a&&i.addCase(h.pending,a),c&&i.addCase(h.rejected,c),l&&i.addMatcher(h.settled,l),i.exposeCaseReducer(e,{fulfilled:o||$C,pending:a||$C,rejected:c||$C,settled:l||$C})}function $C(){}function Jh(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}const qle={isConnected:!1,address:null,chainId:null,balance:"0",error:null},aZ=oZ({name:"wallet",initialState:qle,reducers:{setWalletConnected:(t,e)=>{t.isConnected=!0,t.address=e.payload.address,t.chainId=e.payload.chainId,t.error=null},setWalletDisconnected:t=>{t.isConnected=!1,t.address=null,t.chainId=null,t.balance="0",t.error=null},setBalance:(t,e)=>{t.balance=e.payload},setError:(t,e)=>{t.error=e.payload},clearWalletState:t=>{t.isConnected=!1,t.address=null,t.chainId=null,t.balance="0",t.error=null}}}),{setWalletConnected:zle,setWalletDisconnected:DJe,setBalance:WB,setError:qB,clearWalletState:zB}=aZ.actions,Hle=aZ.reducer,Gle={inputToken:null,outputToken:null,
58slippage:.5,deadline:1200,isExactInput:!0,priceImpact:null,route:null,error:null},cZ=oZ({name:"swap",initialState:Gle,reducers:{setInputToken:(t,e)=>{t.inputToken=e.payload,t.error=null},setOutputToken:(t,e)=>{t.outputToken=e.payload,t.error=null},setSlippage:(t,e)=>{t.slippage=e.payload},setDeadline:(t,e)=>{t.deadline=e.payload},setIsExactInput:(t,e)=>{t.isExactInput=e.payload},setPriceImpact:(t,e)=>{t.priceImpact=e.payload},setRoute:(t,e)=>{t.route=e.payload},setError:(t,e)=>{t.error=e.payload},resetSwap:t=>{t.inputToken=null,t.outputToken=null,t.priceImpact=null,t.route=null,t.error=null}}}),{setInputToken:OJe,setOutputToken:MJe,setSlippage:LJe,setDeadline:$Je,setIsExactInput:UJe,setPriceImpact:BJe,setRoute:FJe,setError:jJe,resetSwap:VJe}=cZ.actions,Kle=cZ.reducer,Yle=Ile({reducer:{wallet:Hle,swap:Kle},middleware:t=>t({serializableCheck:{ignoredActions:["wallet/setWalletConnected"],ignoredActionPaths:["payload.provider"],ignoredPaths:["wallet.provider"]}})});/** 59 * react-router v7.12.0 60 * 61 * Copyright (c) Remix Software Inc. 62 * 63 * This source code is licensed under the MIT license found in the 64 * LICENSE.md file in the root directory of this source tree. 65 * 66 * @license MIT 67 */var HB="popstate";function Zle(t={}){function e(i,s){let{pathname:r,search:o,hash:a}=i.location;return RN("",{pathname:r,search:o,hash:a},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(i,s){return typeof s=="string"?s:P3(s)}return Xle(e,n,null,t)}function Rs(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Vc(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Qle(){return Math.random().toString(36).substring(2,10)}function GB(t,e){return{usr:t.state,key:t.key,idx:e}}function RN(t,e,n=null,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Sb(e):e,state:n,key:e&&e.key||i||Qle()}}function P3({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Sb(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let i=t.indexOf("?");i>=0&&(e.search=t.substring(i),t=t.substring(0,i)),t&&(e.pathname=t)}return e}function Xle(t,e,n,i={}){let{window:s=document.defaultView,v5Compat:r=!1}=i,o=s.history,a="POP",c=null,l=d();l==null&&(l=0,o.replaceState({...o.state,idx:l},""));function d(){return(o.state||{idx:null}).idx}function h(){a="POP";let C=d(),E=C==null?null:C-l;l=C,c&&c({action:a,location:w.location,delta:E})}function p(C,E){a="PUSH";let T=RN(w.location,C,E);l=d()+1;let A=GB(T,l),k=w.createHref(T);try{o.pushState(A,"",k)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;s.location.assign(k)}r&&c&&c({action:a,location:w.location,delta:1})}function g(C,E){a="REPLACE";let T=RN(w.location,C,E);l=d();let A=GB(T,l),k=w.createHref(T);o.replaceState(A,"",k),r&&c&&c({action:a,location:w.location,delta:0})}function b(C){return Jle(C)}let w={get action(){return a},get location(){return t(s,o)},listen(C){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(HB,h),c=C,()=>{s.removeEventListener(HB,h),c=null}},createHref(C){return e(s,C)},createURL:b,encodeLocation(C){let E=b(C);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:p,replace:g,go(C){return o.go(C)}};return w}function Jle(t,e=!1){let n="http://localhost";
67typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Rs(n,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:P3(t);return i=i.replace(/ $/,"%20"),!e&&i.startsWith("//")&&(i=n+i),new URL(i,n)}function lZ(t,e,n="/"){return eue(t,e,n,!1)}function eue(t,e,n,i){let s=typeof e=="string"?Sb(e):e,r=ff(s.pathname||"/",n);if(r==null)return null;let o=uZ(t);tue(o);let a=null;for(let c=0;a==null&&c<o.length;++c){let l=hue(r);a=uue(o[c],l,i)}return a}function uZ(t,e=[],n=[],i="",s=!1){let r=(o,a,c=s,l)=>{let d={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(i)&&c)return;Rs(d.relativePath.startsWith(i),`Absolute route path "${d.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(i.length)}let h=ef([i,d.relativePath]),p=n.concat(d);o.children&&o.children.length>0&&(Rs(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),uZ(o.children,e,p,h,c)),!(o.path==null&&!o.index)&&e.push({path:h,score:cue(h,o.index),routesMeta:p})};return t.forEach((o,a)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))r(o,a);else for(let l of dZ(o.path))r(o,a,!0,l)}),e}function dZ(t){let e=t.split("/");if(e.length===0)return[];let[n,...i]=e,s=n.endsWith("?"),r=n.replace(/\?$/,"");if(i.length===0)return s?[r,""]:[r];let o=dZ(i.join("/")),a=[];return a.push(...o.map(c=>c===""?r:[r,c].join("/"))),s&&a.push(...o),a.map(c=>t.startsWith("/")&&c===""?"/":c)}function tue(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:lue(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var nue=/^:[\w-]+$/,iue=3,sue=2,rue=1,oue=10,aue=-2,KB=t=>t==="*";function cue(t,e){let n=t.split("/"),i=n.length;return n.some(KB)&&(i+=aue),e&&(i+=sue),n.filter(s=>!KB(s)).reduce((s,r)=>s+(nue.test(r)?iue:r===""?rue:oue),i)}function lue(t,e){return t.length===e.length&&t.slice(0,-1).every((i,s)=>i===e[s])?t[t.length-1]-e[e.length-1]:0}function uue(t,e,n=!1){let{routesMeta:i}=t,s={},r="/",o=[];for(let a=0;a<i.length;++a){let c=i[a],l=a===i.length-1,d=r==="/"?e:e.slice(r.length)||"/",h=IE({path:c.relativePath,caseSensitive:c.caseSensitive,end:l},d),p=c.route;if(!h&&l&&n&&!i[i.length-1].route.index&&(h=IE({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;
67Object.assign(s,h.params),o.push({params:s,pathname:ef([r,h.pathname]),pathnameBase:gue(ef([r,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(r=ef([r,h.pathnameBase]))}return o}function IE(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,i]=due(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let r=s[0],o=r.replace(/(.)\/+$/,"$1"),a=s.slice(1);return{params:i.reduce((l,{paramName:d,isOptional:h},p)=>{if(d==="*"){let b=a[p]||"";o=r.slice(0,r.length-b.length).replace(/(.)\/+$/,"$1")}const g=a[p];return h&&!g?l[d]=void 0:l[d]=(g||"").replace(/%2F/g,"/"),l},{}),pathname:r,pathnameBase:o,pattern:t}}function due(t,e=!1,n=!0){Vc(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 i=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,c)=>(i.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(i.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),i]}function hue(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Vc(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function ff(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,i=t.charAt(n);return i&&i!=="/"?null:t.slice(n)||"/"}var hZ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fue=t=>hZ.test(t);function pue(t,e="/"){let{pathname:n,search:i="",hash:s=""}=typeof t=="string"?Sb(t):t,r;if(n)if(fue(n))r=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Vc(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${n}`)}n.startsWith("/")?r=YB(n.substring(1),"/"):r=YB(n,e)}else r=e;return{pathname:r,search:yue(i),hash:bue(s)}}function YB(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function HA(t,e,n,i){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function mue(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function rD(t){let e=mue(t);return e.map((n,i)=>i===e.length-1?n.pathname:n.pathnameBase)}function oD(t,e,n,i=!1){let s;typeof t=="string"?s=Sb(t):(s={...t},Rs(!s.pathname||!s.pathname.includes("?"),HA("?","pathname","search",s)),Rs(!s.pathname||!s.pathname.includes("#"),HA("#","pathname","hash",s)),Rs(!s.search||!s.search.includes("#"),HA("#","search","hash",s)));let r=t===""||s.pathname==="",o=r?"/":s.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!i&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),h-=1;s.pathname=p.join("/")}a=h>=0?e[h]:"/"}let c=pue(s,a),l=o&&o!=="/"&&o.endsWith("/"),d=(r||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(l||d)&&(c.pathname+="/"),c}var ef=t=>t.join("/").replace(/\/\/+/g,"/"),gue=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),yue=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,bue=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,wue=class{constructor(t,e,n,i=!1){this.status=t,this.statusText=e||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function vue(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Cue(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var fZ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function pZ(t,e){let n=t;
67if(typeof n!="string"||!hZ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,s=!1;if(fZ)try{let r=new URL(window.location.href),o=n.startsWith("//")?new URL(r.protocol+n):new URL(n),a=ff(o.pathname,e);o.origin===r.origin&&a!=null?n=a+o.search+o.hash:s=!0}catch{Vc(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var mZ=["POST","PUT","PATCH","DELETE"];new Set(mZ);var xue=["GET",...mZ];new Set(xue);var Ab=M.createContext(null);Ab.displayName="DataRouter";var S8=M.createContext(null);S8.displayName="DataRouterState";var Eue=M.createContext(!1),gZ=M.createContext({isTransitioning:!1});gZ.displayName="ViewTransition";var _ue=M.createContext(new Map);_ue.displayName="Fetchers";var Sue=M.createContext(null);Sue.displayName="Await";var Hc=M.createContext(null);Hc.displayName="Navigation";var a6=M.createContext(null);a6.displayName="Location";var Bu=M.createContext({outlet:null,matches:[],isDataRoute:!1});Bu.displayName="Route";var aD=M.createContext(null);aD.displayName="RouteError";var yZ="REACT_ROUTER_ERROR",Aue="REDIRECT",Tue="ROUTE_ERROR_RESPONSE";function kue(t){if(t.startsWith(`${yZ}:${Aue}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function Nue(t){if(t.startsWith(`${yZ}:${Tue}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new wue(e.status,e.statusText,e.data)}catch{}}function Rue(t,{relative:e}={}){Rs(Tb(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=M.useContext(Hc),{hash:s,pathname:r,search:o}=l6(t,{relative:e}),a=r;return n!=="/"&&(a=r==="/"?n:ef([n,r])),i.createHref({pathname:a,search:o,hash:s})}function Tb(){return M.useContext(a6)!=null}function jr(){return Rs(Tb(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(a6).location}var bZ="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function wZ(t){M.useContext(Hc).static||M.useLayoutEffect(t)}function Zo(){let{isDataRoute:t}=M.useContext(Bu);return t?Wue():Pue()}function Pue(){Rs(Tb(),"useNavigate() may be used only in the context of a <Router> component.");let t=M.useContext(Ab),{basename:e,navigator:n}=M.useContext(Hc),{matches:i}=M.useContext(Bu),{pathname:s}=jr(),r=JSON.stringify(rD(i)),o=M.useRef(!1);return wZ(()=>{o.current=!0}),M.useCallback((c,l={})=>{if(Vc(o.current,bZ),!o.current)return;if(typeof c=="number"){n.go(c);return}let d=oD(c,JSON.parse(r),s,l.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:ef([e,d.pathname])),(l.replace?n.replace:n.push)(d,l.state,l)},[e,n,r,s,t])}M.createContext(null);function c6(){let{matches:t}=M.useContext(Bu),e=t[t.length-1];return e?e.params:{}}function l6(t,{relative:e}={}){let{matches:n}=M.useContext(Bu),{pathname:i}=jr(),s=JSON.stringify(rD(n));return M.useMemo(()=>oD(t,JSON.parse(s),i,e==="path"),[t,s,i,e])}function Iue(t,e){return vZ(t,e)}function vZ(t,e,n,i,s){var T;Rs(Tb(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=M.useContext(Hc),{matches:o}=M.useContext(Bu),a=o[o.length-1],c=a?a.params:{},l=a?a.pathname:"/",d=a?a.pathnameBase:"/",h=a&&a.route;{let A=h&&h.path||"";xZ(l,!h||A.endsWith("*")||A.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${A}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. 68 69Please change the parent <Route path="${A}"> to <Route path="${A==="/"?"*":`${A}/*`}">.`)}let p=jr(),g;if(e){let A=typeof e=="string"?Sb(e):e;Rs(d==="/"||((T=A.pathname)==null?void 0:T.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${A.pathname}" was given in the \`location\` prop.`),g=A}else g=p;let b=g.pathname||"/",w=b;if(d!=="/"){let A=d.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(A.length).join("/")}let C=lZ(t,{pathname:w});Vc(h||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Vc(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=$ue(C&&C.map(A=>Object.assign({},A,{params:Object.assign({},c,A.params),pathname:ef([d,r.encodeLocation?r.encodeLocation(A.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?d:ef([d,r.encodeLocation?r.encodeLocation(A.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:A.pathnameBase])})),o,n,i,s);return e&&E?M.createElement(a6.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},E):E}function Due(){let t=Vue(),e=vue(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},r={padding:"2px 4px",backgroundColor:i},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=M.createElement(M.Fragment,null,M.createElement("p",null,"ð¿ Hey developer ð"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:r},"ErrorBoundary")," or"," ",M.createElement("code",{style:r},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application
69Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},e),n?M.createElement("pre",{style:s},n):null,o)}var Oue=M.createElement(Due,null),CZ=class extends M.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=Nue(t.digest);n&&(t=n)}let e=t!==void 0?M.createElement(Bu.Provider,{value:this.props.routeContext},M.createElement(aD.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?M.createElement(Mue,{error:t},e):e}};CZ.contextType=Eue;var GA=new WeakMap;function Mue({children:t,error:e}){let{basename:n}=M.useContext(Hc);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let i=kue(e.digest);if(i){let s=GA.get(e);if(s)throw s;let r=pZ(i.location,n);if(fZ&&!GA.get(e))if(r.isExternal||i.reloadDocument)window.location.href=r.absoluteURL||r.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(r.to,{replace:i.replace}));throw GA.set(e,o),o}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${r.absoluteURL||r.to}`})}}return t}function Lue({routeContext:t,match:e,children:n}){let i=M.useContext(Ab);return i&&i.static&&i.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=e.route.id),M.createElement(Bu.Provider,{value:t},n)}function $ue(t,e=[],n=null,i=null,s=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let r=t,o=n==null?void 0:n.errors;if(o!=null){let d=r.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);Rs(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,d+1))}let a=!1,c=-1;if(n)for(let d=0;d<r.length;d++){let h=r[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(c=d),h.route.id){let{loaderData:p,errors:g}=n,b=h.route.loader&&!p.hasOwnProperty(h.route.id)&&(!g||g[h.route.id]===void 0);if(h.route.lazy||b){a=!0,c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}let l=n&&i?(d,h)=>{var p,g;i(d,{location:n.location,params:((g=(p=n.matches)==null?void 0:p[0])==null?void 0:g.params)??{},unstable_pattern:Cue(n.matches),errorInfo:h})}:void 0;return r.reduceRight((d,h,p)=>{let g,b=!1,w=null,C=null;n&&(g=o&&h.route.id?o[h.route.id]:void 0,w=h.route.errorElement||Oue,a&&(c<0&&p===0?(xZ("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,C=null):c===p&&(b=!0,C=h.route.hydrateFallbackElement||null)));let E=e.concat(r.slice(0,p+1)),T=()=>{let A;return g?A=w:b?A=C:h.route.Component?A=M.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=d,M.createElement(Lue,{match:h,routeContext:{outlet:d,matches:E,isDataRoute:n!=null},children:A})};return n&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?M.createElement(CZ,{location:n.location,revalidation:n.revalidation,component:w,error:g,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:l}):T()},null)}function cD(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Uue(t){let e=M.useContext(Ab);return Rs(e,cD(t)),e}function Bue(t){let e=M.useContext(S8);return Rs(e,cD(t)),e}function Fue(t){let e=M.useContext(Bu);return Rs(e,cD(t)),e}function lD(t){let e=Fue(t),n=e.matches[e.matches.length-1];return Rs(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function jue(){return lD("useRouteId")}function Vue(){var i;let t=M.useContext(aD),e=Bue("useRouteError"),n=lD("useRouteError");return t!==void 0?t:(i=e.errors)==null?void 0:i[n]}function Wue(){let{router:t}=Uue("useNavigate"),e=lD("useNavigate"),n=M.useRef(!1);return wZ(()=>{n.current=!0}),M.useCallback(async(s,r={})=>{Vc(n.current,bZ),n.current&&(typeof s=="number"?await t.navigate(s):await t.navigate(s,{fromRouteId:e,...r}))},[t,e])}var ZB={};function xZ(t,e,n){!e&&!ZB[t]&&(ZB[t]=!0,Vc(!1,n))}M.memo(que);function que({routes:t,future:e,state:n,onError:i}){return vZ(t,void 0,n,i,e)}function Ky({to:t,replace:e,state:n,relative:i}){Rs(Tb(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=M.useContext(Hc);Vc(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:r}=M.useContext(Bu),{pathname:o}=jr(),a=Zo(),c=oD(t,rD(r),o,i==="path"),l=JSON.stringify(c);return M.useEffect(()=>{a(JSON.parse(l),{replace:e,state:n,relative:i})},[a,l,i,e,n]),null}function Ws(t){Rs(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function zue({basename:t="/",children:e=null,location:n,navigationType:i="POP",navigator:s,static:r=!1,unstable_useTransitions:o}){Rs(!Tb(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),c=M.useMemo(()=>({basename:a,navigator:s,static:r,unstable_useTransitions:o,future:{}}),[a,s,r,o]);typeof n=="string"&&(n=Sb(n));let{pathname:l="/",search:d="",hash:h="",state:p=null,key:g="default"}=n,b=M.useMemo(()=>{let w=ff(l,a);return w==null?null:{location:{pathname:w,search:d,hash:h,state:p,key:g},navigationType:i}},[a,l,d,h,p,g,i]);
69return Vc(b!=null,`<Router basename="${a}"> is not able to match the URL "${l}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),b==null?null:M.createElement(Hc.Provider,{value:c},M.createElement(a6.Provider,{children:e,value:b}))}function Hue({children:t,location:e}){return Iue(PN(t),e)}function PN(t,e=[]){let n=[];return M.Children.forEach(t,(i,s)=>{if(!M.isValidElement(i))return;let r=[...e,s];if(i.type===M.Fragment){n.push.apply(n,PN(i.props.children,r));return}Rs(i.type===Ws,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Rs(!i.props.index||!i.props.children,"An index route cannot have child routes.");let o={id:i.props.id||r.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(o.children=PN(i.props.children,r)),n.push(o)}),n}var Yx="get",Zx="application/x-www-form-urlencoded";function A8(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Gue(t){return A8(t)&&t.tagName.toLowerCase()==="button"}function Kue(t){return A8(t)&&t.tagName.toLowerCase()==="form"}function Yue(t){return A8(t)&&t.tagName.toLowerCase()==="input"}function Zue(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Que(t,e){return t.button===0&&(!e||e==="_self")&&!Zue(t)}function IN(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let i=t[n];return e.concat(Array.isArray(i)?i.map(s=>[n,s]):[[n,i]])},[]))}function Xue(t,e){let n=IN(t);return e&&e.forEach((i,s)=>{n.has(s)||e.getAll(s).forEach(r=>{n.append(s,r)})}),n}var UC=null;function Jue(){if(UC===null)try{new FormData(document.createElement("form"),0),UC=!1}catch{UC=!0}return UC}var ede=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function KA(t){return t!=null&&!ede.has(t)?(Vc(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zx}"`),null):t}function tde(t,e){let n,i,s,r,o;
69if(Kue(t)){let a=t.getAttribute("action");i=a?ff(a,e):null,n=t.getAttribute("method")||Yx,s=KA(t.getAttribute("enctype"))||Zx,r=new FormData(t)}else if(Gue(t)||Yue(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=t.getAttribute("formaction")||a.getAttribute("action");if(i=c?ff(c,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||Yx,s=KA(t.getAttribute("formenctype"))||KA(a.getAttribute("enctype"))||Zx,r=new FormData(a,t),!Jue()){let{name:l,type:d,value:h}=t;if(d==="image"){let p=l?`${l}.`:"";r.append(`${p}x`,"0"),r.append(`${p}y`,"0")}else l&&r.append(l,h)}}else{if(A8(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Yx,i=null,s=Zx,o=t}return r&&s==="text/plain"&&(o=r,r=void 0),{action:i,method:n.toLowerCase(),encType:s,formData:r,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function uD(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function nde(t,e,n,i){let s=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:e&&ff(s.pathname,e)==="/"?s.pathname=`${e.replace(/\/$/,"")}/_root.${i}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${i}`,s}async function ide(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function sde(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function rde(t,e,n){let i=await Promise.all(t.map(async s=>{let r=e.routes[s.route.id];if(r){let o=await ide(r,n);return o.links?o.links():[]}return[]}));return lde(i.flat(1).filter(sde).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function QB(t,e,n,i,s,r){let o=(c,l)=>n[l]?c.route.id!==n[l].route.id:!0,a=(c,l)=>{var d;return n[l].pathname!==c.pathname||((d=n[l].route.path)==null?void 0:d.endsWith("*"))&&n[l].params["*"]!==c.params["*"]};return r==="assets"?e.filter((c,l)=>o(c,l)||a(c,l)):r==="data"?e.filter((c,l)=>{var h;let d=i.routes[c.route.id];if(!d||!d.hasLoader)return!1;if(o(c,l)||a(c,l))return!0;if(c.route.shouldRevalidate){let p=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(t,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function ode(t,e,{includeHydrateFallback:n}={}){return ade(t.map(i=>{let s=e.routes[i.route.id];if(!s)return[];let r=[s.module];return s.clientActionModule&&(r=r.concat(s.clientActionModule)),s.clientLoaderModule&&(r=r.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(r=r.concat(s.hydrateFallbackModule)),s.imports&&(r=r.concat(s.imports)),r}).flat(1))}function ade(t){return[...new Set(t)]}function cde(t){let e={},n=Object.keys(t).sort();for(let i of n)e[i]=t[i];return e}function lde(t,e){let n=new Set;return new Set(e),t.reduce((i,s)=>{let r=JSON.stringify(cde(s));return n.has(r)||(n.add(r),i.push({key:r,link:s})),i},[])}function EZ(){let t=M.useContext(Ab);return uD(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function ude(){let t=M.useContext(S8);return uD(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var dD=M.createContext(void 0);dD.displayName="FrameworkContext";function _Z(){let t=M.useContext(dD);return uD(t,"You must render this element inside a <HydratedRouter> element"),t}function dde(t,e){let n=M.useContext(dD),[i,s]=M.useState(!1),[r,o]=M.useState(!1),{onFocus:a,onBlur:c,onMouseEnter:l,onMouseLeave:d,onTouchStart:h}=e,p=M.useRef(null);M.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let w=E=>
69{E.forEach(T=>{o(T.isIntersecting)})},C=new IntersectionObserver(w,{threshold:.5});return p.current&&C.observe(p.current),()=>{C.disconnect()}}},[t]),M.useEffect(()=>{if(i){let w=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(w)}}},[i]);let g=()=>{s(!0)},b=()=>{s(!1),o(!1)};return n?t!=="intent"?[r,p,{}]:[r,p,{onFocus:wv(a,g),onBlur:wv(c,b),onMouseEnter:wv(l,g),onMouseLeave:wv(d,b),onTouchStart:wv(h,g)}]:[!1,p,{}]}function wv(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function hde({page:t,...e}){let{router:n}=EZ(),i=M.useMemo(()=>lZ(n.routes,t,n.basename),[n.routes,t,n.basename]);return i?M.createElement(pde,{page:t,matches:i,...e}):null}function fde(t){let{manifest:e,routeModules:n}=_Z(),[i,s]=M.useState([]);return M.useEffect(()=>{let r=!1;return rde(t,e,n).then(o=>{r||s(o)}),()=>{r=!0}},[t,e,n]),i}function pde({page:t,matches:e,...n}){let i=jr(),{future:s,manifest:r,routeModules:o}=_Z(),{basename:a}=EZ(),{loaderData:c,matches:l}=ude(),d=M.useMemo(()=>QB(t,e,l,r,i,"data"),[t,e,l,r,i]),h=M.useMemo(()=>QB(t,e,l,r,i,"assets"),[t,e,l,r,i]),p=M.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let w=new Set,C=!1;if(e.forEach(T=>{var k;let A=r.routes[T.route.id];!A||!A.hasLoader||(!d.some(R=>R.route.id===T.route.id)&&T.route.id in c&&((k=o[T.route.id])!=null&&k.shouldRevalidate)||A.hasClientLoader?C=!0:w.add(T.route.id))}),w.size===0)return[];let E=nde(t,a,s.unstable_trailingSlashAwareDataRequests,"data");return C&&w.size>0&&E.searchParams.set("_routes",e.filter(T=>w.has(T.route.id)).map(T=>T.route.id).join(",")),[E.pathname+E.search]},[a,s.unstable_trailingSlashAwareDataRequests,c,i,r,d,e,t,o]),g=M.useMemo(()=>ode(h,r),[h,r]),b=fde(h);return M.createElement(M.Fragment,null,p.map(w=>M.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),g.map(w=>M.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),b.map(({key:w,link:C})=>M.createElement("link",{key:w,nonce:n.nonce,...C})))}function mde(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var gde=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{gde&&(window.__reactRouterVersion="7.12.0")}catch{}function yde({basename:t,children:e,unstable_useTransitions:n,window:i}){let s=M.useRef();s.current==null&&(s.current=Zle({window:i,v5Compat:!0}));let r=s.current,[o,a]=M.useState({action:r.action,location:r.location}),c=M.useCallback(l=>{n===!1?a(l):M.startTransition(()=>a(l))},[n]);return M.useLayoutEffect(()=>r.listen(c),[r,c]),M.createElement(zue,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:r,unstable_useTransitions:n})}var SZ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gi=M.forwardRef(function({onClick:e,discover:n="render",prefetch:i="none",relative:s,reloadDocument:r,replace:o,state:a,target:c,to:l,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:p,...g},b){let{basename:w,unstable_useTransitions:C}=M.useContext(Hc),E=typeof l=="string"&&SZ.test(l),T=pZ(l,w);l=T.to;let A=Rue(l,{relative:s}),[k,R,P]=dde(i,g),B=Cde(l,{replace:o,state:a,target:c,preventScrollReset:d,relative:s,viewTransition:h,unstable_defaultShouldRevalidate:p,unstable_useTransitions:C});function F(K){e&&e(K),K.defaultPrevented||B(K)}let z=M.createElement("a",{...g,...P,href:T.absoluteURL||A,onClick:T.isExternal||r?e:F,ref:mde(b,R),target:c,"data-discover":!E&&n==="render"?"true":void 0});return k&&!E?M.createElement(M.Fragment,null,z,M.createElement(hde,{page:A})):z});gi.displayName="Link";var bde=M.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:i="",end:s=!1,style:r,to:o,viewTransition:a,children:c,...l},d){let h=l6(o,{relative:l.relative}),p=jr(),g=M.useContext(S8),{navigator:b,basename:w}=M.useContext(Hc),C=g!=null&&Tde(h)&&a===!0,E=b.encodeLocation?b.encodeLocation(h).pathname:h.pathname,T=p.pathname,A=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;n||(T=T.toLowerCase(),A=A?A.toLowerCase():null,E=E.toLowerCase()),A&&w&&(A=ff(A,w)||A);const k=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let R=T===E||!s&&T.startsWith(E)&&T.charAt(k)==="/",P=A!=null&&(A===E||!s&&A.startsWith(E)&&A.charAt(E.length)==="/"),B={isActive:R,isPending:P,isTransitioning:C},F=R?e:void 0,z;typeof i=="function"?z=i(B):z=[i,R?"active":null,P?"pending":null,C?"transitioning":null].filter(
69Boolean).join(" ");let K=typeof r=="function"?r(B):r;return M.createElement(gi,{...l,"aria-current":F,className:z,ref:d,style:K,to:o,viewTransition:a},typeof c=="function"?c(B):c)});bde.displayName="NavLink";var wde=M.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:i,replace:s,state:r,method:o=Yx,action:a,onSubmit:c,relative:l,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:p,...g},b)=>{let{unstable_useTransitions:w}=M.useContext(Hc),C=Sde(),E=Ade(a,{relative:l}),T=o.toLowerCase()==="get"?"get":"post",A=typeof a=="string"&&SZ.test(a),k=R=>{if(c&&c(R),R.defaultPrevented)return;R.preventDefault();let P=R.nativeEvent.submitter,B=(P==null?void 0:P.getAttribute("formmethod"))||o,F=()=>C(P||R.currentTarget,{fetcherKey:e,method:B,navigate:n,replace:s,state:r,relative:l,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:p});w&&n!==!1?M.startTransition(()=>F()):F()};return M.createElement("form",{ref:b,method:T,action:E,onSubmit:i?c:k,...g,"data-discover":!A&&t==="render"?"true":void 0})});wde.displayName="Form";function vde(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function AZ(t){let e=M.useContext(Ab);return Rs(e,vde(t)),e}function Cde(t,{target:e,replace:n,state:i,preventScrollReset:s,relative:r,viewTransition:o,unstable_defaultShouldRevalidate:a,unstable_useTransitions:c}={}){let l=Zo(),d=jr(),h=l6(t,{relative:r});return M.useCallback(p=>{if(Que(p,e)){p.preventDefault();let g=n!==void 0?n:P3(d)===P3(h),b=()=>l(t,{replace:g,state:i,preventScrollReset:s,relative:r,viewTransition:o,unstable_defaultShouldRevalidate:a});c?M.startTransition(()=>b()):b()}},[d,l,h,n,i,e,t,s,r,o,a,c])}function xde(t){Vc(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=M.useRef(IN(t)),n=M.useRef(!1),i=jr(),s=M.useMemo(()=>Xue(i.search,n.current?null:e.current),[i.search]),r=Zo(),o=M.useCallback((a,c)=>{const l=IN(typeof a=="function"?a(new URLSearchParams(s)):a);n.current=!0,r("?"+l,c)},[r,s]);return[s,o]}var Ede=0,_de=()=>`__${String(++Ede)}__`;function Sde(){let{router:t}=AZ("useSubmit"),{basename:e}=M.useContext(Hc),n=jue(),i=t.fetch,s=t.navigate;return M.useCallback(async(r,o={})=>{let{action:a,method:c,encType:l,formData:d,body:h}=tde(r,e);if(o.navigate===!1){let p=o.fetcherKey||_de();await i(p,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||c,formEncType:o.encType||l,flushSync:o.flushSync})}else await s(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||c,formEncType:o.encType||l,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[i,s,e,n])}function Ade(t,{relative:e}={}){let{basename:n}=M.useContext(Hc),i=M.useContext(Bu);Rs(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),r={...l6(t||".",{relative:e})},o=jr();if(t==null){r.search=o.search;
69let a=new URLSearchParams(r.search),c=a.getAll("index");if(c.some(d=>d==="")){a.delete("index"),c.filter(h=>h).forEach(h=>a.append("index",h));let d=a.toString();r.search=d?`?${d}`:""}}return(!t||t===".")&&s.route.index&&(r.search=r.search?r.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(r.pathname=r.pathname==="/"?n:ef([n,r.pathname])),P3(r)}function Tde(t,{relative:e}={}){let n=M.useContext(gZ);Rs(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=AZ("useViewTransitionState"),s=l6(t,{relative:e});if(!n.isTransitioning)return!1;let r=ff(n.currentLocation.pathname,i)||n.currentLocation.pathname,o=ff(n.nextLocation.pathname,i)||n.nextLocation.pathname;return IE(s.pathname,o)!=null||IE(s.pathname,r)!=null}var kde=WY();const TZ=ya(kde),hD=M.createContext({});function fD(t){const e=M.useRef(null);return e.current===null&&(e.current=t()),e.current}const pD=typeof window<"u",kZ=pD?M.useLayoutEffect:M.useEffect,T8=M.createContext(null);function mD(t,e){t.indexOf(e)===-1&&t.push(e)}function gD(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const pf=(t,e,n)=>n>e?e:n<t?t:n;let yD=()=>{};const mf={},NZ=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function RZ(t){return typeof t=="object"&&t!==null}const PZ=t=>/^0[^.\s]+$/u.test(t);function bD(t){let e;return()=>(e===void 0&&(e=t()),e)}const kl=t=>t,Nde=(t,e)=>n=>e(t(n)),u6=(...t)=>t.reduce(Nde),I3=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i};class wD{constructor(){this.subscriptions=[]}add(e){return mD(this.subscriptions,e),()=>gD(this.subscriptions,e)}notify(e,n,i){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,i);else for(let r=0;r<s;r++){const o=this.subscriptions[r];o&&o(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const xd=t=>t*1e3,Sl=t=>t/1e3;function IZ(t,e){return e?t*(1e3/e):0}const DZ=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Rde=1e-7,Pde=12;function Ide(t,e,n,i,s){let r,o,a=0;do o=e+(n-e)/2,r=DZ(o,i,s)-t,r>0?n=o:e=o;while(Math.abs(r)>Rde&&++a<Pde);return o}function d6(t,e,n,i){if(t===e&&n===i)return kl;const s=r=>Ide(r,0,1,t,n);return r=>r===0||r===1?r:DZ(s(r),e,i)}const OZ=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,MZ=t=>e=>1-t(1-e),LZ=d6(.33,1.53,.69,.99),vD=MZ(LZ),$Z=OZ(vD),UZ=t=>(t*=2)<1?.5*vD(t):.5*(2-Math.pow(2,-10*(t-1))),CD=t=>1-Math.sin(Math.acos(t)),BZ=MZ(CD),FZ=OZ(CD),Dde=d6(.42,0,1,1),Ode=d6(0,0,.58,1),jZ=d6(.42,0,.58,1),Mde=t=>Array.isArray(t)&&typeof t[0]!="number",VZ=t=>Array.isArray(t)&&typeof t[0]=="number",Lde={linear:kl,easeIn:Dde,easeInOut:jZ,easeOut:Ode,circIn:CD,circInOut:FZ,circOut:BZ,backIn:vD,backInOut:$Z,backOut:LZ,anticipate:UZ},$de=t=>typeof t=="string",XB=t=>{if(VZ(t)){yD(t.length===4);const[e,n,i,s]=t;return d6(e,n,i,s)}else if($de(t))return Lde[t];return t},BC=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Ude(t,e){let n=new Set,i=new Set,s=!1,r=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(l.schedule(d),t()),d(a)}const l={schedule:(d,h=!1,p=!1)=>{const b=p&&s?n:i;return h&&o.add(d),b.has(d)||b.add(d),d},cancel:d=>{i.delete(d),o.delete(d)},process:d=>{if(a=d,s){r=!0;return}
vendor: 19,189 bytes, line 69
69s=!0,[n,i]=[i,n],n.forEach(c),n.clear(),s=!1,r&&(r=!1,l.process(d))}};return l}const Bde=40;function WZ(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=BC.reduce((A,k)=>(A[k]=Ude(r),A),{}),{setup:a,read:c,resolveKeyframes:l,preUpdate:d,update:h,preRender:p,render:g,postRender:b}=o,w=()=>{const A=mf.useManualTiming?s.timestamp:performance.now();n=!1,mf.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(A-s.timestamp,Bde),1)),s.timestamp=A,s.isProcessing=!0,a.process(s),c.process(s),l.process(s),d.process(s),h.process(s),p.process(s),g.process(s),b.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(w))},C=()=>{n=!0,i=!0,s.isProcessing||t(w)};return{schedule:BC.reduce((A,k)=>{const R=o[k];return A[k]=(P,B=!1,F=!1)=>(n||C(),R.schedule(P,B,F)),A},{}),cancel:A=>{for(let k=0;k<BC.length;k++)o[BC[k]].cancel(A)},state:s,steps:o}}const{schedule:ks,cancel:mp,state:bo,steps:YA}=WZ(typeof requestAnimationFrame<"u"?requestAnimationFrame:kl,!0);let Qx;function Fde(){Qx=void 0}const Ga={now:()=>(Qx===void 0&&Ga.set(bo.isProcessing||mf.useManualTiming?bo.timestamp:performance.now()),Qx),set:t=>{Qx=t,queueMicrotask(Fde)}},qZ=t=>e=>typeof e=="string"&&e.startsWith(t),zZ=qZ("--"),jde=qZ("var(--"),xD=t=>jde(t)?Vde.test(t.split("/*")[0].trim()):!1,Vde=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,kb={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},D3={...kb,transform:t=>pf(0,1,t)},FC={...kb,default:1},s3=t=>Math.round(t*1e5)/1e5,ED=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Wde(t){return t==null}const qde=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,_D=(t,e)=>n=>!!(typeof n=="string"&&qde.test(n)&&n.startsWith(t)||e&&!Wde(n)&&Object.prototype.hasOwnProperty.call(n,e)),HZ=(t,e,n)=>i=>{if(typeof i!="string")return i;const[s,r,o,a]=i.match(ED);return{[t]:parseFloat(s),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},zde=t=>pf(0,255,t),ZA={...kb,transform:t=>Math.round(zde(t))},$m={test:_D("rgb","red"),parse:HZ("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+ZA.transform(t)+", "+ZA.transform(e)+", "+ZA.transform(n)+", "+s3(D3.transform(i))+")"};function Hde(t){let e="",n="",i="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const DN={test:_D("#"),parse:Hde,transform:$m.transform},h6=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),O0=h6("deg"),Ed=h6("%"),Dn=h6("px"),Gde=h6("vh"),Kde=h6("vw"),JB={...Ed,parse:t=>Ed.parse(t)/100,transform:t=>Ed.transform(t*100)},Yy={test:_D("hsl","hue"),parse:HZ("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+Ed.transform(s3(e))+", "+Ed.transform(s3(n))+", "+s3(D3.transform(i))+")"},br={test:t=>$m.test(t)||DN.test(t)||Yy.test(t),parse:t=>$m.test(t)?$m.parse(t):Yy.test(t)?Yy.parse(t):DN.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?$m.transform(t):Yy.transform(t),getAnimatableNone:t=>{const e=br.parse(t);return e.alpha=0,br.transform(e)}},Yde=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Zde(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(ED))==null?void 0:e.length)||0)+(((n=t.match(Yde))==null?void 0:n.length)||0)>0}const GZ="number",KZ="color",Qde="var",Xde="var(",eF="${}",Jde=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function O3(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let r=0;const a=e.replace(Jde,c=>(br.test(c)?(i.color.push(r),s.push(KZ),n.push(br.parse(c))):c.startsWith(Xde)?(i.var.push(r),s.push(Qde),n.push(c)):(i.number.push(r),s.push(GZ),n.push(parseFloat(c))),++r,eF)).split(eF);return{values:n,split:a,indexes:i,types:s}}function YZ(t){return O3(t).values}function ZZ(t){const{split:e,types:n}=O3(t),i=e.length;return s=>{let r="";for(let o=0;o<i;o++)if(r+=e[o],s[o]!==void 0){const a=n[o];a===GZ?r+=s3(s[o]):a===KZ?r+=br.transform(s[o]):r+=s[o]}return r}}const ehe=t=>typeof t=="number"?0:br.test(t)?br.getAnimatableNone(t):t;function the(t){const e=YZ(t);return ZZ(t)(e.map(ehe))}const gp={test:Zde,parse:YZ,createTransformer:ZZ,getAnimatableNone:the};function QA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function nhe({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let s=0,r=0,o=0;if(!e)s=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;s=QA(c,a,t+1/3),r=QA(c,a,t),o=QA(c,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:i}}function DE(t,e){return n=>n>0?e:t}const Ms=(t,e,n)=>t+(e-t)*n,XA=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},ihe=[DN,$m,Yy],she=t=>ihe.find(e=>e.test(t));function tF(t){const e=she(t);if(!e)return!1;let n=e.parse(t);return e===Yy&&(n=nhe(n)),n}const nF=(t,e)=>{const n=tF(t),i=tF(e);if(!n||!i)return DE(t,e);const s={...n};return r=>(s.red=XA(n.red,i.red,r),s.green=XA(n.green,i.green,r),s.blue=XA(n.blue,i.blue,r),s.alpha=Ms(n.alpha,i.alpha,r),$m.transform(s))},ON=new Set(["none","hidden"]);function rhe(t,e){return ON.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function ohe(t,e){return n=>Ms(t,e,n)}function SD(t){return typeof t=="number"?ohe:typeof t=="string"?xD(t)?DE:br.test(t)?nF:lhe:Array.isArray(t)?QZ:typeof t=="object"?br.test(t)?nF:ahe:DE}function QZ(t,e){const n=[...t],i=n.length,s=t.map((r,o)=>SD(r)(r,e[o]));return r=>{for(let o=0;o<i;o++)n[o]=s[o](r);return n}}function ahe(t,e){const n={...t,...e},i={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(i[s]=SD(t[s])(t[s],e[s]));return s=>{for(const r in i)n[r]=i[r](s);return n}}function che(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const r=e.types[s],o=t.indexes[r][i[r]],a=t.values[o]??0;n[s]=a,i[r]++}return n}const lhe=(t,e)=>{const n=gp.createTransformer(e),i=O3(t),s=O3(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?ON.has(t)&&!s.values.length||ON.has(e)&&!i.values.length?rhe(t,e):u6(QZ(che(i,s),s.values),n):DE(t,e)};function XZ(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Ms(t,e,n):SD(t)(t,e)}const uhe=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>ks.update(e,n),stop:()=>mp(e),now:()=>bo.isProcessing?bo.timestamp:Ga.now()}},JZ=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let r=0;r<s;r++)i+=Math.round(t(r/(s-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},OE=2e4;function AD(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<OE;)e+=n,i=t.next(e);return e>=OE?1/0:e}function dhe(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(AD(i),OE);return{type:"keyframes",ease:r=>i.next(s*r).value/e,duration:Sl(s)}}const hhe=5;function eQ(t,e,n){const i=Math.max(e-hhe,0);return IZ(n-t(i),e-i)}const Hs={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},JA=.001;function fhe({duration:t=Hs.duration,bounce:e=Hs.bounce,velocity:n=Hs.velocity,mass:i=Hs.mass}){let s,r,o=1-e;o=pf(Hs.minDamping,Hs.maxDamping,o),t=pf(Hs.minDuration,Hs.maxDuration,Sl(t)),o<1?(s=l=>{const d=l*o,h=d*t,p=d-n,g=MN(l,o),b=Math.exp(-h);return JA-p/g*b},r=l=>{const h=l*o*t,p=h*n+n,g=Math.pow(o,2)*Math.pow(l,2)*t,b=Math.exp(-h),w=MN(Math.pow(l,2),o);return(-s(l)+JA>0?-1:1)*((p-g)*b)/w}):(s=l=>{const d=Math.exp(-l*t),h=(l-n)*t+1;return-JA+d*h},r=l=>{const d=Math.exp(-l*t),h=(n-l)*(t*t);return d*h});const a=5/t,c=mhe(s,r,a);if(t=xd(t),isNaN(c))return{stiffness:Hs.stiffness,damping:Hs.damping,duration:t};{const l=Math.pow(c,2)*i;return{stiffness:l,damping:o*2*Math.sqrt(i*l),duration:t}}}const phe=12;function mhe(t,e,n){let i=n;for(let s=1;s<phe;s++)i=i-t(i)/e(i);return i}function MN(t,e){return t*Math.sqrt(1-e*e)}const ghe=["duration","bounce"],yhe=["stiffness","damping","mass"];function iF(t,e){return e.some(n=>t[n]!==void 0)}function bhe(t){let e={velocity:Hs.velocity,stiffness:Hs.stiffness,damping:Hs.damping,mass:Hs.mass,isResolvedFromDuration:!1,...t};if(!iF(t,yhe)&&iF(t,ghe))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,r=2*pf(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Hs.mass,stiffness:s,damping:r}}else{const n=fhe(t);e={...e,...n,mass:Hs.mass},e.isResolvedFromDuration=!0}return e}function ME(t=Hs.visualDuration,e=Hs.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:c,damping:l,mass:d,duration:h,velocity:p,isResolvedFromDuration:g}=bhe({...n,velocity:-Sl(n.velocity||0)}),b=p||0,w=l/(2*Math.sqrt(c*d)),C=o-r,E=Sl(Math.sqrt(c/d)),T=Math.abs(C)<5;i||(i=T?Hs.restSpeed.granular:Hs.restSpeed.default),s||(s=T?Hs.restDelta.granular:Hs.restDelta.default);let A;if(w<1){const R=MN(E,w);A=P=>{const B=Math.exp(-w*E*P);return o-B*((b+w*E*C)/R*Math.sin(R*P)+C*Math.cos(R*P))}}else if(w===1)A=R=>o-Math.exp(-E*R)*(C+(b+E*C)*R);else{const R=E*Math.sqrt(w*w-1);A=P=>{const B=Math.exp(-w*E*P),F=Math.min(R*P,300);return o-B*((b+w*E*C)*Math.sinh(F)+R*C*Math.cosh(F))/R}}const k={calculatedDuration:g&&h||null,next:R=>{const P=A(R);if(g)a.done=R>=h;else{let B=R===0?b:0;w<1&&(B=R===0?xd(b):eQ(A,R,P));const F=Math.abs(B)<=i,z=Math.abs(o-P)<=s;a.done=F&&z}return a.value=a.done?o:P,a},toString:()=>{const R=Math.min(AD(k),OE),P=JZ(B=>k.next(R*B).value,R,30);return R+"ms "+P},toTransition:()=>{}};return k}ME.applyToOptions=t=>{const e=dhe(t,100,ME);return t.ease=e.ease,t.duration=xd(e.duration),t.type="keyframes",t};function LN({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:c,restDelta:l=.5,restSpeed:d}){const h=t[0],p={done:!1,value:h},g=F=>a!==void 0&&F<a||c!==void 0&&F>c,b=F=>a===void 0?c:c===void 0||Math.abs(a-F)<Math.abs(c-F)?a:c;let w=n*e;const C=h+w,E=o===void 0?C:o(C);E!==C&&(w=E-h);const T=F=>-w*Math.exp(-F/i),A=F=>E+T(F),k=F=>{const z=T(F),K=A(F);p.done=Math.abs(z)<=l,p.value=p.done?E:K};let R,P;const B=F=>{g(p.value)&&(R=F,P=ME({keyframes:[p.value,b(p.value)],velocity:eQ(A,F,p.value),damping:s,stiffness:r,restDelta:l,restSpeed:d}))};return B(0),{calculatedDuration:null,next:F=>{let z=!1;return!P&&R===void 0&&(z=!0,k(F),B(F)),R!==void 0&&F>=R?P.next(F-R):(!z&&k(F),p)}}}function whe(t,e,n){const i=[],s=n||mf.mix||XZ,r=t.length-1;for(let o=0;o<r;o++){let a=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||kl:e;a=u6(c,a)}i.push(a)}return i}function vhe(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const r=t.length;if(yD(r===e.length),r===1)return()=>e[0];if(r===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=whe(e,i,s),c=a.length,l=d=>{if(o&&d<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(d<t[h+1]);h++);const p=I3(t[h],t[h+1],d);return a[h](p)};return n?d=>l(pf(t[0],t[r-1],d)):l}function Che(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=I3(0,e,i);t.push(Ms(n,1,s))}}function xhe(t){const e=[0];return Che(e,t.length-1),e}function Ehe(t,e){return t.map(n=>n*e)}function _he(t,e){return t.map(()=>e||jZ).splice(0,t.length-1)}function r3({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=Mde(i)?i.map(XB):XB(i),r={done:!1,value:e[0]},o=Ehe(n&&n.length===e.length?n:xhe(e),t),a=vhe(o,e,{ease:Array.isArray(s)?s:_he(e,s)});return{calculatedDuration:t,next:c=>(r.value=a(c),r.done=c>=t,r)}}const She=t=>t!==null;function TD(t,{repeat:e,repeatType:n="loop"},i,s=1){const r=t.filter(She),a=s<0||e&&n!=="loop"&&e%2===1?0:r.length-1;return!a||i===void 0?r[a]:i}const Ahe={decay:LN,inertia:LN,tween:r3,keyframes:r3,spring:ME};function tQ(t){typeof t.type=="string"&&(t.type=Ahe[t.type])}class kD{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const The=t=>t/100;class ND extends kD{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var i,s;const{motionValue:n}=this.options;n&&n.updatedAt!==Ga.now()&&this.tick(Ga.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(i=this.options).onStop)==null||s.call(i))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;tQ(e);const{type:n=r3,repeat:i=0,repeatDelay:s=0,repeatType:r,velocity:o=0}=e;let{keyframes:a}=e;const c=n||r3;c!==r3&&typeof a[0]!="number"&&(this.mixKeyframes=u6(The,XZ(a[0],a[1])),a=[0,100]);const l=c({...e,keyframes:a});r==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...a].reverse(),velocity:-o})),l.calculatedDuration===null&&(l.calculatedDuration=AD(l));const{calculatedDuration:d}=l;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(i+1)-s,this.generator=l}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:i,totalDuration:s,mixKeyframes:r,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:c}=this;if(this.startTime===null)return i.next(0);const{delay:l=0,keyframes:d,repeat:h,repeatType:p,repeatDelay:g,type:b,onUpdate:w,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const E=this.currentTime-l*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?E<0:E>s;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let A=this.currentTime,k=i;if(h){const F=Math.min(this.currentTime,s)/a;let z=Math.floor(F),K=F%1;!K&&F>=1&&(K=1),K===1&&z--,z=Math.min(z,h+1),!!(z%2)&&(p==="reverse"?(K=1-K,g&&(K-=g/a)):p==="mirror"&&(k=o)),A=pf(0,1,K)*a}const R=T?{done:!1,value:d[0]}:k.next(A);r&&(R.value=r(R.value));let{done:P}=R;!T&&c!==null&&(P=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return B&&b!==LN&&(R.value=TD(d,this.options,C,this.speed)),w&&w(R.value),B&&this.finish(),R}then(e,n){return this.finished.then(e,n)}get duration(){return Sl(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Sl(e)}get time(){return Sl(this.currentTime)}set time(e){var n;e=xd(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Ga.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Sl(this.currentTime))}play(){var s,r;if(this.isStopped)return;const{driver:e=uhe,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(r=(s=this.options).onPlay)==null||r.call(s);const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ga.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function khe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Um=t=>t*180/Math.PI,$N=t=>{const e=Um(Math.atan2(t[1],t[0]));return UN(e)},Nhe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:$N,rotateZ:$N,skewX:t=>Um(Math.atan(t[1])),skewY:t=>Um(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},UN=t=>(t=t%360,t<0&&(t+=360),t),sF=$N,rF=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),oF=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Rhe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:rF,scaleY:oF,scale:t=>(rF(t)+oF(t))/2,rotateX:t=>UN(Um(Math.atan2(t[6],t[5]))),rotateY:t=>UN(Um(Math.atan2(-t[2],t[0]))),rotateZ:sF,rotate:sF,skewX:t=>Um(Math.atan(t[4])),skewY:t=>Um(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function BN(t){return t.includes("scale")?1:0}function FN(t,e){if(!t||t==="none")return BN(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=Rhe,s=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=Nhe,s=a}if(!s)return BN(e);const r=i[e],o=s[1].split(",").map(Ihe);return typeof r=="function"?r(o):o[r]}const Phe=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return FN(n,e)};function Ihe(t){return parseFloat(t.trim())}const Nb=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Rb=new Set(Nb),aF=t=>t===kb||t===Dn,Dhe=new Set(["x","y","z"]),Ohe=Nb.filter(t=>!Dhe.has(t));function Mhe(t){const e=[];return Ohe.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const cg={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),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:(t,{transform:e})=>FN(e,"x"),y:(t,{transform:e})=>FN(e,"y")};cg.translateX=cg.x;cg.translateY=cg.y;const lg=new Set;let jN=!1,VN=!1,WN=!1;function nQ(){if(VN){const t=Array.from(lg).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>
69{const s=Mhe(i);s.length&&(n.set(i,s),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const s=n.get(i);s&&s.forEach(([r,o])=>{var a;(a=i.getValue(r))==null||a.set(o)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}VN=!1,jN=!1,lg.forEach(t=>t.complete(WN)),lg.clear()}function iQ(){lg.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(VN=!0)})}function Lhe(){WN=!0,iQ(),nQ(),WN=!1}class RD{constructor(e,n,i,s,r,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=s,this.element=r,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(lg.add(this),jN||(jN=!0,ks.read(iQ),ks.resolveKeyframes(nQ))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:s}=this;if(e[0]===null){const r=s==null?void 0:s.get(),o=e[e.length-1];if(r!==void 0)e[0]=r;else if(i&&n){const a=i.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),s&&r===void 0&&s.set(e[0])}khe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),lg.delete(this)}cancel(){this.state==="scheduled"&&(lg.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const $he=t=>t.startsWith("--");function Uhe(t,e,n){$he(e)?t.style.setProperty(e,n):t.style[e]=n}const Bhe=bD(()=>window.ScrollTimeline!==void 0),Fhe={};function jhe(t,e){const n=bD(t);return()=>Fhe[e]??n()}const sQ=jhe(()=>{try{document.createElement("div").animate({opacity:0}
69,{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Qv=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,cF={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Qv([0,.65,.55,1]),circOut:Qv([.55,0,1,.45]),backIn:Qv([.31,.01,.66,-.59]),backOut:Qv([.33,1.53,.69,.99])};function rQ(t,e){if(t)return typeof t=="function"?sQ()?JZ(t,e):"ease-out":VZ(t)?Qv(t):Array.isArray(t)?t.map(n=>rQ(n,e)||cF.easeOut):cF[t]}function Vhe(t,e,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:a="easeOut",times:c}={},l=void 0){const d={[e]:n};c&&(d.offset=c);const h=rQ(a,s);Array.isArray(h)&&(d.easing=h);const p={delay:i,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"};return l&&(p.pseudoElement=l),t.animate(d,p)}function oQ(t){return typeof t=="function"&&"applyToOptions"in t}function Whe({type:t,...e}){return oQ(t)&&sQ()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class qhe extends kD{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:i,keyframes:s,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:a,onComplete:c}=e;this.isPseudoElement=!!r,this.allowFlatten=o,this.options=e,yD(typeof e.type!="string");const l=Whe(e);this.animation=Vhe(n,i,s,l,r),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const d=TD(s,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(d):Uhe(n,i,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,n;this.isPseudoElement||(n=(e=this.animation).commitStyles)==null||n.call(e)}get duration(){var n,i;const e=((i=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:i.call(n).duration)||0;return Sl(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Sl(e)}get time(){return Sl(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=xd(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&Bhe()?(this.animation.timeline=e,kl):n(this)}}const aQ={anticipate:UZ,backInOut:$Z,circInOut:FZ};function zhe(t){return t in aQ}function Hhe(t){typeof t.ease=="string"&&zhe(t.ease)&&(t.ease=aQ[t.ease])}const lF=10;class Ghe extends qhe{constructor(e){Hhe(e),tQ(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:i,onComplete:s,element:r,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new ND({...o,autoplay:!1}),c=xd(this.finishedTime??this.time);n.setWithVelocity(a.sample(c-lF).value,a.sample(c).value,lF),a.stop()}}const uF=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(gp.test(t)||t==="0")&&!t.startsWith("url("));function Khe(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Yhe(t,e,n,i){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const r=t[t.length-1],o=uF(s,e),a=uF(r,e);return!o||!a?!1:Khe(t)||(n==="spring"||oQ(n))&&i}function qN(t){t.duration=0,t.type="keyframes"}const Zhe=new Set(["opacity","clipPath","filter","transform"]),Qhe=bD(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Xhe(t){var d;const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:r,type:o}=t;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:l}=e.owner.getProps();return Qhe()&&n&&Zhe.has(n)&&(n!=="transform"||!l)&&!c&&!i&&s!=="mirror"&&r!==0&&o!=="inertia"}const Jhe=40;class efe extends kD{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:r=0,repeatType:
69o="loop",keyframes:a,name:c,motionValue:l,element:d,...h}){var b;super(),this.stop=()=>{var w,C;this._animation&&(this._animation.stop(),(w=this.stopTimeline)==null||w.call(this)),(C=this.keyframeResolver)==null||C.cancel()},this.createdAt=Ga.now();const p={autoplay:e,delay:n,type:i,repeat:s,repeatDelay:r,repeatType:o,name:c,motionValue:l,element:d,...h},g=(d==null?void 0:d.KeyframeResolver)||RD;this.keyframeResolver=new g(a,(w,C,E)=>this.onKeyframesResolved(w,C,p,!E),c,l,d),(b=this.keyframeResolver)==null||b.scheduleResolve()}onKeyframesResolved(e,n,i,s){this.keyframeResolver=void 0;const{name:r,type:o,velocity:a,delay:c,isHandoff:l,onUpdate:d}=i;this.resolvedAt=Ga.now(),Yhe(e,r,o,a)||((mf.instantAnimations||!c)&&(d==null||d(TD(e,i,n))),e[0]=e[e.length-1],qN(i),i.repeat=0);const p={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>Jhe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},g=!l&&Xhe(p)?new Ghe({...p,element:p.motionValue.owner.current}):new ND(p);g.finished.then(()=>this.notifyFinished()).catch(kl),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Lhe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}const tfe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function nfe(t){const e=tfe.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}function cQ(t,e,n=1){const[i,s]=nfe(t);if(!i)return;const r=window.getComputedStyle(e).getPropertyValue(i);if(r){const o=r.trim();return NZ(o)?parseFloat(o):o}return xD(s)?cQ(s,e,n+1):s}function PD(t,e){return(t==null?void 0:t[e])??(t==null?void 0:t.default)??t}const lQ=new Set(["width","height","top","left","right","bottom",...Nb]),ife={test:t=>t==="auto",parse:t=>t},uQ=t=>e=>e.test(t),dQ=[kb,Dn,Ed,O0,Kde,Gde,ife],dF=t=>dQ.find(uQ(t));function sfe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||PZ(t):!0}const rfe=new Set(["brightness","contrast","saturate","opacity"]);function ofe(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(ED)||[];if(!i)return t;const s=n.replace(i,"");let r=rfe.has(e)?1:0;return i!==n&&(r*=100),e+"("+r+s+")"}const afe=/\b([a-z-]*)\(.*?\)/gu,zN={...gp,getAnimatableNone:t=>{const e=t.match(afe);return e?e.map(ofe).join(" "):t}},hF={...kb,transform:Math.round},cfe={rotate:O0,rotateX:O0,rotateY:O0,rotateZ:O0,scale:FC,scaleX:FC,scaleY:FC,scaleZ:FC,skew:O0,skewX:O0,skewY:O0,distance:Dn,translateX:Dn,translateY:Dn,translateZ:Dn,x:Dn,y:Dn,z:Dn,perspective:Dn,transformPerspective:Dn,opacity:D3,originX:JB,originY:JB,originZ:Dn},ID={borderWidth:Dn,borderTopWidth:Dn,borderRightWidth:Dn,borderBottomWidth:Dn,borderLeftWidth:Dn,borderRadius:Dn,radius:Dn,borderTopLeftRadius:Dn,borderTopRightRadius:Dn,borderBottomRightRadius:Dn,borderBottomLeftRadius:Dn,width:Dn,maxWidth:Dn,height:Dn,maxHeight:Dn,top:Dn,right:Dn,bottom:Dn,left:Dn,padding:Dn,paddingTop:Dn,paddingRight:Dn,paddingBottom:Dn,paddingLeft:Dn,margin:Dn,marginTop:Dn,marginRight:Dn,marginBottom:Dn,marginLeft:Dn,backgroundPositionX:Dn,backgroundPositionY:Dn,...cfe,zIndex:hF,fillOpacity:D3,strokeOpacity:D3,numOctaves:hF},lfe={...ID,color:br,backgroundColor:br,outlineColor:br,fill:br,stroke:br,borderColor:br,borderTopColor:br,borderRightColor:br,borderBottomColor:br,borderLeftColor:br,filter:zN,WebkitFilter:zN},hQ=t=>lfe[t];function fQ(t,e){let n=hQ(t);return n!==zN&&(n=gp),n.getAnimatableNone?n.getAnimatableNone(e):void 0}
vendor: 1,658 bytes, line 69
69const ufe=new Set(["auto","none","0"]);function dfe(t,e,n){let i=0,s;for(;i<t.length&&!s;){const r=t[i];typeof r=="string"&&!ufe.has(r)&&O3(r).values.length&&(s=t[i]),i++}if(s&&n)for(const r of e)t[r]=fQ(n,s)}class hfe extends RD{constructor(e,n,i,s,r){super(e,n,i,s,r,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let l=e[c];if(typeof l=="string"&&(l=l.trim(),xD(l))){const d=cQ(l,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!lQ.has(i)||e.length!==2)return;const[s,r]=e,o=dF(s),a=dF(r);if(o!==a)if(aF(o)&&aF(a))for(let c=0;c<e.length;c++){const l=e[c];typeof l=="string"&&(e[c]=parseFloat(l))}else cg[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let s=0;s<e.length;s++)(e[s]===null||sfe(e[s]))&&i.push(s);i.length&&dfe(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=cg[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(i,s).jump(s,!1)}measureEndState(){var a;const{element:e,name:n,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const r=i.length-1,o=i[r];i[r]=cg[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEac
69h(([c,l])=>{e.getValue(c).set(l)}),this.resolveNoneKeyframes()}}function ffe(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let i=document;const s=(n==null?void 0:n[t])??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}const pQ=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function mQ(t){return RZ(t)&&"offsetHeight"in t}const fF=30,pfe=t=>!isNaN(parseFloat(t));class mfe{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{var r;const s=Ga.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&((r=this.events.change)==null||r.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Ga.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=pfe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new wD);const i=this.events[e].add(n);return e==="change"?()=>{i(),ks.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ga.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>fF)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,fF);return IZ(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),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(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function H2(t,e){return new mfe(t,e)}const{schedule:DD}=WZ(queueMicrotask,!1),cu={x:!1,y:!1};function gQ(){return cu.x||cu.y}function gfe(t){return t==="x"||t==="y"?cu[t]?null:(cu[t]=!0,()=>{cu[t]=!1}):cu.x||cu.y?null:(cu.x=cu.y=!0,()=>{cu.x=cu.y=!1})}function yQ(t,e){const n=ffe(t),i=new AbortController,s={passive:!0,...e,signal:i.signal};return[n,s,()=>i.abort()]}function pF(t){return!(t.pointerType==="touch"||gQ())}function yfe(t,e,n={}){const[i,s,r]=yQ(t,n),o=a=>{if(!pF(a))return;const{target:c}=a,l=e(c,a);if(typeof l!="function"||!c)return;const d=h=>{pF(h)&&(l(h),c.removeEventListener("pointerleave",d))};c.addEventListener("pointerleave",d,s)};return i.forEach(a=>{a.addEventListener("pointerenter",o,s)}),r}const bQ=(t,e)=>e?t===e?!0:bQ(t,e.parentElement):!1,OD=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,bfe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function wfe(t){return bfe.has(t.tagName)||t.tabIndex!==-1}const Xx=new WeakSet;function mF(t){return e=>{e.key==="Enter"&&t(e)}}function eT(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const vfe=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=mF(()=>{if(Xx.has(n))return;eT(n,"down");const s=mF(()=>{eT(n,"up")}),r=()=>eT(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",r,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function gF(t){return OD(t)&&!gQ()}function Cfe(t,e,n={}){const[i,s,r]=yQ(t,n),o=a=>{const c=a.currentTarget;if(!gF(a))return;Xx.add(c);const l=e(c,a),d=(g,b)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",p),Xx.has(c)&&Xx.delete(c),gF(g)&&typeof l=="function"&&l(g,{success:b})},h=g=>{d(g,c===window||c===document||n.useGlobalTarget||bQ(c,g.target))},p=g=>{d(g,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",p,s)};
vendor: 9,173 bytes, lines 69-77
69return i.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),mQ(a)&&(a.addEventListener("focus",l=>vfe(l,s)),!wfe(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),r}function wQ(t){return RZ(t)&&"ownerSVGElement"in t}function xfe(t){return wQ(t)&&t.tagName==="svg"}const Vo=t=>!!(t&&t.getVelocity),Efe=[...dQ,br,gp],_fe=t=>Efe.find(uQ(t)),MD=M.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function yF(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Sfe(...t){return e=>{let n=!1;const i=t.map(s=>{const r=yF(s,e);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;s<i.length;s++){const r=i[s];typeof r=="function"?r():yF(t[s],null)}}}}function Afe(...t){return M.useCallback(Sfe(...t),t)}class Tfe extends M.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=n.offsetParent,s=mQ(i)&&i.offsetWidth||0,r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft,r.right=s-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}}function kfe({children:t,isPresent:e,anchorX:n,root:i}){const s=M.useId(),r=M.useRef(null),o=M.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=M.useContext(MD),c=Afe(r,t==null?void 0:t.ref);return M.useInsertionEffect(()=>{const{width:l,height:d,top:h,left:p,right:g}=o.current;if(e||!r.current||!l||!d)return;const b=n==="left"?`left: ${p}`:`right: ${g}`;r.current.dataset.motionPopId=s;const w=document.createElement("style");a&&(w.nonce=a);const C=i??document.head;return C.appendChild(w),w.sheet&&w.sheet.insertRule(` 70 [data-motion-pop-id="${s}"] { 71 position: absolute !important; 72 width: ${l}px !important; 73 height: ${d}px !important; 74 ${b}px !important; 75 top: ${h}px !important; 76 } 77 `),()=>{C.contains(w)&&C.removeChild(w)}},[e]),m.jsx(Tfe,{isPresent:e,childRef:r,sizeRef:o,children:M.cloneElement(t,{ref:c})})}const Nfe=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:s,presenceAffectsLayout:r,mode:o,anchorX:a,root:c})=>{const l=fD(Rfe),d=M.useId();let h=!0,p=M.useMemo(()=>(h=!1,{id:d,initial:e,isPresent:n,custom:s,onExitComplete:g=>{l.set(g,!0);for(const b of l.values())if(!b)return;i&&i()},register:g=>(l.set(g,!1),()=>l.delete(g))}),[n,l,i]);return r&&h&&(p={...p}),M.useMemo(()=>{l.forEach((g,b)=>l.set(b,!1))},[n]),M.useEffect(()=>{!n&&!l.size&&i&&i()},[n]),o==="popLayout"&&(t=m.jsx(kfe,{isPresent:n,anchorX:a,root:c,children:t})),m.jsx(T8.Provider,{value:p,children:t})};function Rfe(){return new Map}function vQ(t=!0){const e=M.useContext(T8);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=e,r=M.useId();M.useEffect(()=>{if(t)return s(r)},[t]);const o=M.useCallback(()=>t&&i&&i(r),[r,i,t]);return!n&&i?[!1,o]:[!0]}const jC=t=>t.key||"";function bF(t){const e=[];return M.Children.forEach(t,n=>{M.isValidElement(n)&&e.push(n)}),e}const Pb=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:r="sync",propagate:o=!1,anchorX:a="left",root:c})=>{const[l,d]=vQ(o),h=M.useMemo(()=>bF(t),[t]),p=o&&!l?[]:h.map(jC),g=M.useRef(!0),b=M.useRef(h),w=fD(()=>new Map),[C,E]=M.useState(h),[T,A]=M.useState(h);kZ(()=>{g.current=!1,b.current=h;for(let P=0;P<T.length;P++){const B=jC(T[P]);p.includes(B)?w.delete(B):w.get(B)!==!0&&w.set(B,!1)}},[T,p.length,p.join("-")]);const k=[];if(h!==C){let P=[...h];for(let B=0;B<T.length;B++){const F=T[B],z=jC(F);p.includes(z)||(P.splice(B,0,F),k.push(F))}return r==="wait"&&k.length&&(P=k),A(bF(P)),E(h),null}const{forceRender:R}=M.useContext(hD);return m.jsx(m.Fragment,{children:T.map(P=>{const B=jC(P),F=o&&!l?!1:h===T||p.includes(B),z=()=>{if(w.has(B))w.set(B,!0);else return;let K=!0;w.forEach(q=>{q||(K=!1)}),K&&(R==null||R(),A(b.current),o&&(d==null||d()),i&&i())};return m.jsx(Nfe,{isPresent:F,initial:!g.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:r,root:c,onExitComplete:F?void 0:z,anchorX:a,children:P},B)})})},CQ=M.createContext({strict:!1}),wF={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"]},G2={};for(const t in wF)G2[t]={isEnabled:e=>wF[t].some(n=>!!e[n])};function Pfe(t){for(const e in t)G2[e]={...G2[e],...t[e]}}const Ife=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function LE(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Ife.has(t)}let xQ=t=>!LE(t);function Dfe(t){typeof t=="function"&&(xQ=e=>e.startsWith("on")?!LE(e):t(e))}try{Dfe(require("@emotion/is-prop-valid").default)}catch{}function Ofe(t,e,n){const i={};for(const s in t)s==="values"&&typeof t.values=="object"||(xQ(s)||n===!0&&LE(s)||!e&&!LE(s)||t.draggable&&s.startsWith("onDrag"))&&(i[s]=t[s]);return i}const k8=M.createContext({});function N8(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function M3(t){return typeof t=="string"||Array.isArray(t)}const LD=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$D=["initial",...LD];function R8(t){return N8(t.animate)||$D.some(e=>M3(t[e]))}function EQ(t){return!!(R8(t)||t.variants)}function Mfe(t,e){if(R8(t)){const{initial:n,animate:i}=t;return{initial:n===!1||M3(n)?n:void 0,animate:M3(i)?i:void 0}}return t.inherit!==!1?e:{}}function Lfe(t){const{initial:e,animate:n}=Mfe(t,M.useContext(k8));return M.useMemo(()=>({initial:e,animate:n}),[vF(e),vF(n)])}function vF(t){return Array.isArray(t)?t.join(" "):t}function CF(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const vv={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Dn.test(t))t=parseFloat(t);else return t;const n=CF(t,e.target.x),i=CF(t,e.target.y);return`${n}% ${i}%`}},$fe={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,s=gp.parse(t);if(s.length>5)return i;const r=gp.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=c;const l=Ms(a,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=l),typeof s[3+o]=="number"&&(s[3+o]/=l),r(s)}},HN={borderRadius:{...vv,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:vv,borderTopRightRadius:vv,borderBottomLeftRadius:vv,borderBottomRightRadius:vv,boxShadow:$fe};function _Q(t,{layout:e,layoutId:n}){return Rb.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!HN[t]||t==="opacity")}const Ufe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Bfe=Nb.length;function Ffe(t,e,n){let i="",s=!0;for(let r=0;r<Bfe;r++){const o=Nb[r],a=t[o];if(a===void 0)continue;let c=!0;if(typeof a=="number"?c=a===(o.startsWith("scale")?1:0):c=parseFloat(a)===0,!c||n){const l=pQ(a,ID[o]);if(!c){s=!1;const d=Ufe[o]||o;i+=`${d}(${l}) `}n&&(e[o]=l)}}return i=i.trim(),n?i=n(e,s?"":i):s&&(i="none"),i}function UD(t,e,n){const{style:i,vars:s,transformOrigin:r}=t;let o=!1,a=!1;for(const c in e){const l=e[c];if(Rb.has(c)){o=!0;continue}else if(zZ(c)){s[c]=l;continue}else{const d=pQ(l,ID[c]);c.startsWith("origin")?(a=!0,r[c]=d):i[c]=d}}if(e.transform||(o||n?i.transform=Ffe(e,t.transform,n):i.transform&&(i.transform="none")),a){const{originX:c="50%",originY:l="50%",originZ:d=0}=r;i.transformOrigin=`${c} ${l} ${d}`}}const BD=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function SQ(t,e,n){for(const i in e)!Vo(e[i])&&!_Q(i,n)&&(t[i]=e[i])}function jfe({transformTemplate:t},e){return M.useMemo(()=>{const n=BD();return UD(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Vfe(t,e){const n=t.style||{},i={};return SQ(i,n,t),Object.assign(i,jfe(t,e)),i}function Wfe(t,e){const n={},i=Vfe(t,e);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 qfe={offset:"stroke-dashoffset",array:"stroke-dasharray"},zfe={offset:"strokeDashoffset",array:"strokeDasharray"};function Hfe(t,e,n=1,i=0,s=!0){t.pathLength=1;const r=s?qfe:zfe;t[r.offset]=Dn.transform(-i);const o=Dn.transform(e),a=Dn.transform(n);t[r.array]=`${o} ${a}`}function AQ(t,{attrX:e,attrY:n,attrScale:i,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...a}
77,c,l,d){if(UD(t,a,l),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p}=t;h.transform&&(p.transform=h.transform,delete h.transform),(p.transform||h.transformOrigin)&&(p.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),p.transform&&(p.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete h.transformBox),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),i!==void 0&&(h.scale=i),s!==void 0&&Hfe(h,s,r,o,!1)}const TQ=()=>({...BD(),attrs:{}}),kQ=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Gfe(t,e,n,i){const s=M.useMemo(()=>{const r=TQ();return AQ(r,e,kQ(i),t.transformTemplate,t.style),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};SQ(r,t.style,t),s.style={...r,...s.style}}return s}const Kfe=["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 FD(t){return typeof t!="string"||t.includes("-")?!1:!!(Kfe.indexOf(t)>-1||/[A-Z]/u.test(t))}function Yfe(t,e,n,{latestValues:i},s,r=!1){const a=(FD(t)?Gfe:Wfe)(e,i,s,t),c=Ofe(e,typeof t=="string",r),l=t!==M.Fragment?{...c,...a,ref:n}:{},{children:d}=e,h=M.useMemo(()=>Vo(d)?d.get():d,[d]);return M.createElement(t,{...l,children:h})}function xF(t){const e=[{},{}];return t==null||t.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function jD(t,e,n,i){if(typeof e=="function"){const[s,r]=xF(i);e=e(n!==void 0?n:t.custom,s,r)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,r]=xF(i);e=e(n!==void 0?n:t.custom,s,r)}return e}function Jx(t){return Vo(t)?t.get():t}function Zfe({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,s){return{latestValues:Qfe(n,i,s,t),renderState:e()}}function Qfe(t,e,n,i){const s={},r=i(t,{});for(const p in r)s[p]=Jx(r[p]);let{initial:o,animate:a}=t;const c=R8(t),l=EQ(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?a:o;if(h&&typeof h!="boolean"&&!N8(h)){const p=Array.isArray(h)?h:[h];for(let g=0;g<p.length;g++){const b=jD(t,p[g]);if(b){const{transitionEnd:w,transition:C,...E}=b;for(const T in E){let A=E[T];if(Array.isArray(A)){const k=d?A.length-1:0;A=A[k]}A!==null&&(s[T]=A)}for(const T in w)s[T]=w[T]}}}return s}const NQ=t=>(e,n)=>{const i=M.useContext(k8),s=M.useContext(T8),r=()=>Zfe(t,e,i,s);return n?r():fD(r)};function VD(t,e,n){var r;const{style:i}=t,s={};for(const o in i)(Vo(i[o])||e.style&&Vo(e.style[o])||_Q(o,t)||((r=n==null?void 0:n.getValue(o))==null?void 0:r.liveStyle)!==void 0)&&(s[o]=i[o]);return s}const Xfe=NQ({scrapeMotionValuesFromProps:VD,createRenderState:BD});function RQ(t,e,n){const i=VD(t,e,n);for(const s in t)if(Vo(t[s])||Vo(e[s])){const r=Nb.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[r]=t[s]}return i}const Jfe=NQ({scrapeMotionValuesFromProps:RQ,createRenderState:TQ}),e0e=Symbol.for("motionComponentSymbol");function Zy(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function t0e(t,e,n){return M.useCallback(i=>{i&&t.onMount&&t.onMount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):Zy(n)&&(n.current=i))},[e])}const WD=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),n0e="framerAppearId",PQ="data-"+WD(n0e),IQ=M.createContext({});function i0e(t,e,n,i,s){var w,C;const{visualElement:r}=M.useContext(k8),o=M.useContext(CQ),a=M.useContext(T8),c=M.useContext(MD).reducedMotion,l=M.useRef(null);i=i||o.renderer,!l.current&&i&&(l.current=i(t,{visualState:e,parent:r,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:c}));const d=l.current,h=M.useContext(IQ);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&s0e(l.current,n,s,h);const p=M.useRef(!1);M.useInsertionEffect(()=>{d&&p.current&&d.update(n,a)});const g=n[PQ],b=M.useRef(!!g&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,g))&&((C=window.MotionHasOptimisedAnimation)==null?void 0:C.call(window,g)));return kZ(()=>{d&&(p.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),b.current&&d.animationState&&d.animationState.animateChanges())}),M.useEffect(()=>{d&&(!b.current&&d.animationState&&d.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var E;(E=window.MotionHandoffMarkAsComplete)==null||E.call(window,g)}
vendor: 5,898 bytes, line 77
77),b.current=!1),d.enteringChildren=void 0)}),d}function s0e(t,e,n,i){const{layoutId:s,layout:r,drag:o,dragConstraints:a,layoutScroll:c,layoutRoot:l,layoutCrossfade:d}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:DQ(t.parent)),t.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:!!o||a&&Zy(a),visualElement:t,animationType:typeof r=="string"?r:"both",initialPromotionConfig:i,crossfade:d,layoutScroll:c,layoutRoot:l})}function DQ(t){if(t)return t.options.allowProjection!==!1?t.projection:DQ(t.parent)}function tT(t,{forwardMotionProps:e=!1}={},n,i){n&&Pfe(n);const s=FD(t)?Jfe:Xfe;function r(a,c){let l;const d={...M.useContext(MD),...a,layoutId:r0e(a)},{isStatic:h}=d,p=Lfe(a),g=s(a,h);if(!h&&pD){o0e();const b=a0e(d);l=b.MeasureLayout,p.visualElement=i0e(t,g,d,i,b.ProjectionNode)}return m.jsxs(k8.Provider,{value:p,children:[l&&p.visualElement?m.jsx(l,{visualElement:p.visualElement,...d}):null,Yfe(t,a,t0e(g,p.visualElement,c),g,h,e)]})}r.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=M.forwardRef(r);return o[e0e]=t,o}function r0e({layoutId:t}){const e=M.useContext(hD).id;return e&&t!==void 0?e+"-"+t:t}function o0e(t,e){M.useContext(CQ).strict}function a0e(t){const{drag:e,layout:n}=G2;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function c0e(t,e){if(typeof Proxy>"u")return tT;const n=new Map,i=(r,o)=>tT(r,o,t,e),s=(r,o)=>i(r,o);return new Proxy(s,{get:(r,o)=>o==="create"?i:(n.has(o)||n.set(o,tT(o,void 0,t,e)),n.get(o))})}function OQ({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function l0e({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function u0e(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function nT(t){return t===void 0||t===1}function GN({scale:t,scaleX:e,scaleY:n}){return!nT(t)||!nT(e)||!nT(n)}function Tm(t){return GN(t)||MQ(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function MQ(t){return EF(t.x)||EF(t.y)}function EF(t){return t&&t!=="0%"}function $E(t,e,n){const i=t-n,s=e*i;return n+s}function _F(t,e,n,i,s){return s!==void 0&&(t=$E(t,s,i)),$E(t,n,i)+e}function KN(t,e=0,n=1,i,s){t.min=_F(t.min,e,n,i,s),t.max=_F(t.max,e,n,i,s)}function LQ(t,{x:e,y:n}){KN(t.x,e.translate,e.scale,e.originPoint),KN(t.y,n.translate,n.scale,n.originPoint)}const SF=.999999999999,AF=1.0000000000001;function d0e(t,e,n,i=!1){const s=n.length;if(!s)return;e.x=e.y=1;let r,o;for(let a=0;a<s;a++){r=n[a],o=r.projectionDelta;const{visualElement:c}=r.options;c&&c.props.style&&c.props.style.display==="contents"||(i&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Xy(t,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,LQ(t,o)),i&&Tm(r.latestValues)&&Xy(t,r.latestValues))}e.x<AF&&e.x>SF&&(e.x=1),e.y<AF&&e.y>SF&&(e.y=1)}function Qy(t,e){t.min=t.min+e,t.max=t.max+e}function TF(t,e,n,i,s=.5){const r=Ms(t.min,t.max,s);KN(t,e,n,r,i)}function Xy(t,e){TF(t.x,e.x,e.scaleX,e.scale,e.originX),TF(t.y,e.y,e.scaleY,e.scale,e.originY)}function $Q(t,e){return OQ(u0e(t.getBoundingClientRect(),e))}function h0e(t,e,n){const i=$Q(t,n),{scroll:s}=e;return s&&(Qy(i.x,s.offset.x),Qy(i.y,s.offset.y)),i}const kF=()=>({translate:0,scale:1,origin:0,originPoint:0}),Jy=()=>({x:kF(),y:kF()}),NF=()=>({min:0,max:0}),Pr=()=>({x:NF(),y:NF()}),YN={current:null},UQ={current:!1};function f0e(){if(UQ.current=!0,!!pD)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>YN.current=t.matches;t.addEventListener("change",e),e()}else YN.current=!1}const p0e=new WeakMap;function m0e(t,e,n){for(const i in e){const s=e[i],r=n[i];if(Vo(s))t.addValue(i,s);else if(Vo(r))t.addValue(i,H2(s,{owner:t}));else if(r!==s)if(t.hasValue(i)){const o=t.getValue(i);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(i);t.addValue(i,H2(o!==void 0?o:s,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const RF=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class g0e{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:s,blockInitialAnimation:r,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=RD,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.renderScheduledAt=0,this.scheduleRender=()=>{const p=Ga.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,ks.render(this.render,!1,!0))};const{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!r,this.isControllingVariants=R8(n),this.isVariantNode=EQ(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:d,...h}=this.scrapeMotionValuesFromProps(n,{},this);for(const p in h){const g=h[p];c[p]!==void 0&&Vo(g)&&g.set(c[p])}}mount(e){var n;this.current=e,p0e.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.forEac
vendor: 7,390 bytes, line 77
77h((i,s)=>this.bindToMotionValue(s,i)),UQ.current||f0e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:YN.current,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),mp(this.notifyUpdate),mp(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const i=this.features[n];i&&(i.unmount(),i.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Rb.has(e);i&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&ks.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),r&&r(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in G2){const n=G2[e];if(!n)continue;const{isEnabled:i,Feature:s}=n;if(!this.features[e]&&s&&i(this.props)&&(this.features[e]=new s(this)),this.features[e]){const r=this.features[e];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Pr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<RF.length;i++){const s=RF[i];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const r="on"+s,o=e[r];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=m0e(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=H2(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(NZ(i)||PZ(i))?i=parseFloat(i):!_fe(i)&&gp.test(n)&&(i=fQ(e,n)),this.setBaseTarget(e,Vo(i)?i.get():i)),Vo(i)?i.get():i}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=jD(this.props,n,(r=this.presenceContext)==null?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Vo(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new wD),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){DD.render(this.render)}}class BQ extends g0e{constructor(){super(...arguments),this.KeyframeResolver=hfe}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Vo(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function FQ(t,{style:e,vars:n},i,s){const r=t.style;let o;for(o in e)r[o]=e[o];s==null||s.applyProjectionStyles(r,i);for(o in n)r.setProperty(o,n[o])}function y0e(t){return window.getComputedStyle(t)}class b0e extends BQ{constructor(){super(...arguments),this.type="html",this.renderInstance=FQ}readValueFromInstance(e,n){var i;if(Rb.has(n))return(i=this.projection)!=null&&i.isProjecting?BN(n):Phe(e,n);{const s=y0e(e),r=(zZ(n)?s.getPropertyValue(n):s[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:n}){return $Q(e,n)}build(e,n,i){UD(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return VD(e,n,i)}}const jQ=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 w0e(t,e,n,i){FQ(t,e,void 0,i);for(const s in e.attrs)t.setAttribute(jQ.has(s)?s:WD(s),e.attrs[s])}class v0e extends BQ{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Pr}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Rb.has(n)){const i=hQ(n);return i&&i.default||0}return n=jQ.has(n)?n:WD(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return RQ(e,n,i)}build(e,n,i){AQ(e,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,n,i,s){w0e(e,n,i,s)}mount(e){this.isSVGTag=kQ(e.tagName),super.mount(e)}}const C0e=(t,e)=>FD(t)?new v0e(e):new b0e(e,{allowProjection:t!==M.Fragment});function p2(t,e,n){const i=t.getProps();return jD(i,e,n!==void 0?n:i.custom,t)}const ZN=t=>Array.isArray(t);function x0e(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,H2(n))}function E0e(t){return ZN(t)?t[t.length-1]||0:t}function _0e(t,e){const n=p2(t,e);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const o in r){const a=E0e(r[o]);x0e(t,o,a)}}function S0e(t){return!!(Vo(t)&&t.add)}function QN(t,e){const n=t.getValue("willChange");if(S0e(n))return n.add(e);if(!n&&mf.WillChange){const i=new mf.WillChange("auto");
vendor: 5,489 bytes, line 77
77t.addValue("willChange",i),i.add(e)}}function VQ(t){return t.props[PQ]}const A0e=t=>t!==null;function T0e(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(A0e),r=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[r]}const k0e={type:"spring",stiffness:500,damping:25,restSpeed:10},N0e=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),R0e={type:"keyframes",duration:.8},P0e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},I0e=(t,{keyframes:e})=>e.length>2?R0e:Rb.has(t)?t.startsWith("scale")?N0e(e[1]):k0e:P0e;function D0e({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:a,from:c,elapsed:l,...d}){return!!Object.keys(d).length}const qD=(t,e,n,i={},s,r)=>o=>{const a=PD(i,t)||{},c=a.delay||i.delay||0;let{elapsed:l=0}=i;l=l-xd(c);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:p=>{e.set(p),a.onUpdate&&a.onUpdate(p)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:s};D0e(a)||Object.assign(d,I0e(t,d)),d.duration&&(d.duration=xd(d.duration)),d.repeatDelay&&(d.repeatDelay=xd(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(qN(d),d.delay===0&&(h=!0)),(mf.instantAnimations||mf.skipAnimations)&&(h=!0,qN(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,h&&!r&&e.get()!==void 0){const p=T0e(d.keyframes,a);if(p!==void 0){ks.update(()=>{d.onUpdate(p),d.onComplete()});return}}return a.isSync?new ND(d):new efe(d)};function O0e({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function WQ(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=e;i&&(r=i);const c=[],l=s&&t.animationState&&t.animationState.getState()[s];for(const d in a){const h=t.getValue(d,t.latestValues[d]??null),p=a[d];if(p===void 0||l&&O0e(l,d))continue;const g={delay:n,...PD(r||{},d)},b=h.get();if(b!==void 0&&!h.isAnimating&&!Array.isArray(p)&&p===b&&!g.velocity)continue;let w=!1;if(window.MotionHandoffAnimation){const E=VQ(t);if(E){const T=window.MotionHandoffAnimation(E,d,ks);T!==null&&(g.startTime=T,w=!0)}}QN(t,d),h.start(qD(d,h,p,t.shouldReduceMotion&&lQ.has(d)?{type:!1}:g,t,w));const C=h.animation;C&&c.push(C)}return o&&Promise.all(c).then(()=>{ks.update(()=>{o&&_0e(t,o)})}),c}function qQ(t,e,n,i=0,s=1){const r=Array.from(t).sort((l,d)=>l.sortNodePosition(d)).indexOf(e),o=t.size,a=(o-1)*i;return typeof n=="function"?n(r,o):s===1?r*i:a-r*i}function XN(t,e,n={}){var c;const i=p2(t,e,n.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const r=i?()=>Promise.all(WQ(t,i,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:p}=s;return M0e(t,e,l,d,h,p,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[l,d]=a==="beforeChildren"?[r,o]:[o,r];return l().then(()=>d())}else return Promise.all([r(),o(n.delay)])}function M0e(t,e,n=0,i=0,s=0,r=1,o){const a=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),a.push(XN(c,e,{...o,delay:n+(typeof i=="function"?0:i)+qQ(t.variantChildren,c,i,s,r)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(a)}function L0e(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const s=e.map(r=>XN(t,r,n));i=Promise.all(s)}else if(typeof e=="string")i=XN(t,e,n);else{const s=typeof e=="function"?p2(t,e,n.custom):e;i=Promise.all(WQ(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}function zQ(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const $0e=$D.length;function HQ(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?HQ(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<$0e;n++){const i=$D[n],s=t.props[i];(M3(s)||s===!1)&&(e[i]=s)}return e}const U0e=[...LD].reverse(),B0e=LD.length;function F0e(t){return e=>Promise.all(e.map(({animation:n,options:i})=>L0e(t,n,i)))}function j0e(t){let e=F0e(t),n=PF(),i=!0;const s=c=>(l,d)=>{var p;const h=p2(t,d,c==="exit"?(p=t.presenceContext)==null?void 0:p.custom:void 0);if(h){const{transition:g,transitionEnd:b,...w}=h;l={...l,...w,...b}}return l};function r(c){e=c(t)}function o(c){const{props:l}=t,d=HQ(t.parent)||{},h=[],p=new Set;let g={},b=1/0;for(let C=0;C<B0e;C++){const E=U0e[C],T=n[E],A=l[E]!==void 0?l[E]:d[E],k=M3(A),R=E===c?T.isActive:null;R===!1&&(b=C);let P=A===d[E]&&A!==l[E]&&k;if(P&&i&&t.manuallyAnimateOnMount&&(P=!1),T.protectedKeys={...g},!T.isActive&&R===null||!A&&!T.prevProp||N8(A)||typeof A=="boolean")continue;const B=V0e(T.prevProp,A);let F=B||E===c&&T.isActive&&!P&&k||C>b&&k,z=!1;const K=Array.isArray(A)?A:[A];let q=K.reduce(s(E),{});R===!1&&(q={});const{prevResolvedValues:G={}}=T,I={...G,...q},S=N=>{F=!0,p.has(N)&&(z=!0,p.delete(N)),T.needsAnimating[N]=!0;const $=t.getValue(N);$&&($.liveStyle=!1)};for(const N in I){const $=q[N],U=G[N];if(g.hasOwnProperty(N))continue;let j=!1;ZN($)&&ZN(U)?j=!zQ($,U):j=$!==U,j?$!=null?S(N):p.add(N):$!==void 0&&p.has(N)?S(N):T.protectedKeys[N]=!0}T.prevProp=A,T.prevResolvedValues=q,T.isActive&&(g={...g,...q}),i&&t.blockInitialAnimation&&(F=!1);const v=P&&B;F&&(!v||z)&&h.push(...K.map(N=>{const $={type:E}
vendor: 22,041 bytes, line 77
77;if(typeof N=="string"&&i&&!v&&t.manuallyAnimateOnMount&&t.parent){const{parent:U}=t,j=p2(U,N);if(U.enteringChildren&&j){const{delayChildren:D}=j.transition||{};$.delay=qQ(U.enteringChildren,t,D)}}return{animation:N,options:$}}))}if(p.size){const C={};if(typeof l.initial!="boolean"){const E=p2(t,Array.isArray(l.initial)?l.initial[0]:l.initial);E&&E.transition&&(C.transition=E.transition)}p.forEach(E=>{const T=t.getBaseTarget(E),A=t.getValue(E);A&&(A.liveStyle=!0),C[E]=T??null}),h.push({animation:C})}let w=!!h.length;return i&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(w=!1),i=!1,w?e(h):Promise.resolve()}function a(c,l){var h;if(n[c].isActive===l)return Promise.resolve();(h=t.variantChildren)==null||h.forEach(p=>{var g;return(g=p.animationState)==null?void 0:g.setActive(c,l)}),n[c].isActive=l;const d=o(c);for(const p in n)n[p].protectedKeys={};return d}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n,reset:()=>{n=PF()}}}function V0e(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!zQ(e,t):!1}function hm(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function PF(){return{animate:hm(!0),whileInView:hm(),whileHover:hm(),whileTap:hm(),whileDrag:hm(),whileFocus:hm(),exit:hm()}}class Bp{constructor(e){this.isMounted=!1,this.node=e}update(){}}class W0e extends Bp{constructor(e){super(e),e.animationState||(e.animationState=j0e(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();N8(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let q0e=0;class z0e extends Bp{constructor(){super(...arguments),this.id=q0e++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const H0e={animation:{Feature:W0e},exit:{Feature:z0e}};function L3(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function f6(t){return{point:{x:t.pageX,y:t.pageY}}}const G0e=t=>e=>OD(e)&&t(e,f6(e));function o3(t,e,n,i){return L3(t,e,G0e(n),i)}const GQ=1e-4,K0e=1-GQ,Y0e=1+GQ,KQ=.01,Z0e=0-KQ,Q0e=0+KQ;function la(t){return t.max-t.min}function X0e(t,e,n){return Math.abs(t-e)<=n}function IF(t,e,n,i=.5){t.origin=i,t.originPoint=Ms(e.min,e.max,t.origin),t.scale=la(n)/la(e),t.translate=Ms(n.min,n.max,t.origin)-t.originPoint,(t.scale>=K0e&&t.scale<=Y0e||isNaN(t.scale))&&(t.scale=1),(t.translate>=Z0e&&t.translate<=Q0e||isNaN(t.translate))&&(t.translate=0)}function a3(t,e,n,i){IF(t.x,e.x,n.x,i?i.originX:void 0),IF(t.y,e.y,n.y,i?i.originY:void 0)}function DF(t,e,n){t.min=n.min+e.min,t.max=t.min+la(e)}function J0e(t,e,n){DF(t.x,e.x,n.x),DF(t.y,e.y,n.y)}function OF(t,e,n){t.min=e.min-n.min,t.max=t.min+la(e)}function UE(t,e,n){OF(t.x,e.x,n.x),OF(t.y,e.y,n.y)}function gl(t){return[t("x"),t("y")]}const YQ=({current:t})=>t?t.ownerDocument.defaultView:null,MF=(t,e)=>Math.abs(t-e);function epe(t,e){const n=MF(t.x,e.x),i=MF(t.y,e.y);return Math.sqrt(n**2+i**2)}class ZQ{constructor(e,n,{transformPagePoint:i,contextWindow:s=window,dragSnapToOrigin:r=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=sT(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,b=epe(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!b)return;const{point:w}=p,{timestamp:C}=bo;this.history.push({...w,timestamp:C});const{onStart:E,onMove:T}=this.handlers;g||(E&&E(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,p)},this.handlePointerMove=(p,g)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=iT(g,this.transformPagePoint),ks.update(this.updatePoint,!0)},this.handlePointerUp=(p,g)=>{this.end();const{onEnd:b,onSessionEnd:w,resumeAnimation:C}=this.handlers;if(this.dragSnapToOrigin&&C&&C(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=sT(p.type==="pointercancel"?this.lastMoveEventInfo:iT(g,this.transformPagePoint),this.history);this.startEvent&&b&&b(p,E),w&&w(p,E)},!OD(e))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=s||window;const a=f6(e),c=iT(a,this.transformPagePoint),{point:l}=c,{timestamp:d}=bo;this.history=[{...l,timestamp:d}];const{onSessionStart:h}=n;h&&h(e,sT(c,this.history)),this.removeListeners=u6(o3(this.contextWindow,"pointermove",this.handlePointerMove),o3(this.contextWindow,"pointerup",this.handlePointerUp),o3(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),mp(this.updatePoint)}}function iT(t,e){return e?{point:e(t.point)}:t}function LF(t,e){return{x:t.x-e.x,y:t.y-e.y}}function sT({point:t},e){return{point:t,delta:LF(t,QQ(e)),offset:LF(t,tpe(e)),velocity:npe(e,.1)}}function tpe(t){return t[0]}function QQ(t){return t[t.length-1]}function npe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=QQ(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>xd(e)));)n--;if(!i)return{x:0,y:0};const r=Sl(s.timestamp-i.timestamp);if(r===0)return{x:0,y:0};const o={x:(s.x-i.x)/r,y:(s.y-i.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function ipe(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?Ms(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?Ms(n,t,i.max):Math.min(t,n)),t}function $F(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function spe(t,{top:e,left:n,bottom:i,right:s}){return{x:$F(t.x,n,s),y:$F(t.y,e,i)}}function UF(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function rpe(t,e){return{x:UF(t.x,e.x),y:UF(t.y,e.y)}}function ope(t,e){let n=.5;const i=la(t),s=la(e);return s>i?n=I3(e.min,e.max-i,t.min):i>s&&(n=I3(t.min,t.max-s,e.min)),pf(0,1,n)}function ape(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const JN=.35;function cpe(t=JN){return t===!1?t=0:t===!0&&(t=JN),{x:BF(t,"left","right"),y:BF(t,"top","bottom")}}function BF(t,e,n){return{min:FF(t,e),max:FF(t,n)}}function FF(t,e){return typeof t=="number"?t:t[e]||0}const lpe=new WeakMap;class upe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Pr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const r=h=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(f6(h).point)},o=(h,p)=>{const{drag:g,dragPropagation:b,onDragStart:w}=this.getProps();if(g&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=gfe(g),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),gl(E=>{let T=this.getAxisMotionValue(E).get()||0;if(Ed.test(T)){const{projection:A}=this.visualElement;if(A&&A.layout){const k=A.layout.layoutBox[E];k&&(T=la(k)*(parseFloat(T)/100))}}this.originPoint[E]=T}),w&&ks.postRender(()=>w(h,p)),QN(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},a=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p;const{dragPropagation:g,dragDirectionLock:b,onDirectionLock:w,onDrag:C}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:E}=p;if(b&&this.currentDirection===null){this.currentDirection=dpe(E),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",p.point,E),this.updateAxis("y",p.point,E),this.visualElement.render(),C&&C(h,p)},c=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p,this.stop(h,p),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>gl(h=>{var p;return this.getAnimationState(h)==="paused"&&((p=this.getAxisMotionValue(h).animation)==null?void 0:p.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new ZQ(e,{onSessionStart:r,onStart:o,onMove:a,onSessionEnd:c,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:i,contextWindow:YQ(this.visualElement)})}stop(e,n){const i=e||this.latestPointerEvent,s=n||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!s||!i)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&ks.postRender(()=>a(i,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:s}=this.getProps();if(!i||!VC(e,s,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=ipe(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){var r;const{dragConstraints:e,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(r=this.visualElement.projection)==null?void 0:r.layout,s=this.constraints;e&&Zy(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=spe(i.layoutBox,e):this.constraints=!1,this.elastic=cpe(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&gl(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=ape(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Zy(e))return!1;const i=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const r=h0e(i,s.root,this.visualElement.getTransformPagePoint());let o=rpe(s.layout.layoutBox,r);if(n){const a=n(l0e(o));this.hasMutatedConstraints=!!a,a&&(o=OQ(a))}return o}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=gl(d=>{if(!VC(d,n,this.currentDirection))return;let h=c&&c[d]||{};o&&(h={min:0,max:0});const p=s?200:1e6,g=s?40:1e7,b={type:"inertia",velocity:i?e[d]:0,bounceStiffness:p,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...r,...h};return this.startAxisValueAnimation(d,b)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return QN(this.visualElement,e),i.start(qD(e,i,0,n,this.visualElement,!1))}stopAnimation(){gl(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){gl(e=>{var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)==null?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),s=i[n];return s||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){gl(n=>{const{drag:i}=this.getProps();if(!VC(n,i,this.currentDirection))return;const{projection:s}=this.visualElement,r=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n];r.set(e[n]-Ms(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Zy(n)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};gl(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const c=a.get();s[o]=ope({min:c,max:c},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),gl(o=>{if(!VC(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(Ms(c,l,s[o]))})}addListeners(){if(!this.visualElement.current)return;lpe.set(this.visualElement,this);const e=this.visualElement.current,n=o3(e,"pointerdown",c=>{const{drag:l,dragListener:d=!0}=this.getProps();l&&d&&this.start(c)}),i=()=>{const{dragConstraints:c}=this.getProps();Zy(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,r=s.addEventListener("measure",i);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),ks.read(i);const o=L3(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(gl(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())}));return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:s=!1,dragConstraints:r=!1,dragElastic:o=JN,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:s,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function VC(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function dpe(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class hpe extends Bp{constructor(e){super(e),this.removeGroupControls=kl,this.removeListeners=kl,this.controls=new upe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||kl}unmount(){this.removeGroupControls(),this.removeListeners()}}const jF=t=>(e,n)=>{t&&ks.postRender(()=>t(e,n))};class fpe extends Bp{constructor(){super(...arguments),this.removePointerDownListener=kl}onPointerDown(e){this.session=new ZQ(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:YQ(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:jF(e),onStart:jF(n),onMove:i,onEnd:(r,o)=>{delete this.session,s&&ks.postRender(()=>s(r,o))}}}mount(){this.removePointerDownListener=o3(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const eE={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let rT=!1;class ppe extends M.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:s}=this.props,{projection:r}=e;r&&(n.group&&n.group.add(r),i&&i.register&&s&&i.register(r),rT&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),eE.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:s,isPresent:r}=this.props,{projection:o}=i;return o&&(o.isPresent=r,rT=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==r?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||ks.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),DD.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:s}=e;rT=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function XQ(t){const[e,n]=vQ(),i=M.useContext(hD);return m.jsx(ppe,{...t,layoutGroup:i,switchLayoutGroup:M.useContext(IQ),isPresent:e,safeToRemove:n})}function mpe(t,e,n){const i=Vo(t)?t:H2(t);return i.start(qD("",i,e,n)),i.animation}const gpe=(t,e)=>t.depth-e.depth;class ype{constructor(){this.children=[],this.isDirty=!1}add(e){mD(this.children,e),this.isDirty=!0}remove(e){gD(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(gpe),this.isDirty=!1,this.children.forEach(e)}}function bpe(t,e){const n=Ga.now(),i=({timestamp:s})=>{const r=s-n;r>=e&&(mp(i),t(r-e))};return ks.setup(i,!0),()=>mp(i)}const JQ=["TopLeft","TopRight","BottomLeft","BottomRight"],wpe=JQ.length,VF=t=>typeof t=="string"?parseFloat(t):t,WF=t=>typeof t=="number"||Dn.test(t);function vpe(t,e,n,i,s,r){s?(t.opacity=Ms(0,n.opacity??1,Cpe(i)),t.opacityExit=Ms(e.opacity??1,0,xpe(i))):r&&(t.opacity=Ms(e.opacity??1,n.opacity??1,i));for(let o=0;o<wpe;o++){const a=`border${JQ[o]}Radius`;let c=qF(e,a),l=qF(n,a);if(c===void 0&&l===void 0)continue;c||(c=0),l||(l=0),c===0||l===0||WF(c)===WF(l)?(t[a]=Math.max(Ms(VF(c),VF(l),i),0),(Ed.test(l)||Ed.test(c))&&(t[a]+="%")):t[a]=l}(e.rotate||n.rotate)&&(t.rotate=Ms(e.rotate||0,n.rotate||0,i))}function qF(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Cpe=eX(0,.5,BZ),xpe=eX(.5,.95,kl);function eX(t,e,n){return i=>i<t?0:i>e?1:n(I3(t,e,i))}function zF(t,e){t.min=e.min,t.max=e.max}function tu(t,e){zF(t.x,e.x),zF(t.y,e.y)}function HF(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function GF(t,e,n,i,s){return t-=e,t=$E(t,1/n,i),s!==void 0&&(t=$E(t,1/s,i)),t}function Epe(t,e=0,n=1,i=.5,s,r=t,o=t){if(Ed.test(e)&&(e=parseFloat(e),e=Ms(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Ms(r.min,r.max,i);t===r&&(a-=e),t.min=GF(t.min,e,n,a,s),t.max=GF(t.max,e,n,a,s)}function KF(t,e,[n,i,s],r,o){Epe(t,e[n],e[i],e[s],e.scale,r,o)}const _pe=["x","scaleX","originX"],Spe=["y","scaleY","originY"];function YF(t,e,n,i){KF(t.x,e,_pe,n?n.x:void 0,i?i.x:void 0),KF(t.y,e,Spe,n?n.y:void 0,i?i.y:void 0)}function ZF(t){return t.translate===0&&t.scale===1}function tX(t){return ZF(t.x)&&ZF(t.y)}function QF(t,e){return t.min===e.min&&t.max===e.max}function Ape(t,e){return QF(t.x,e.x)&&QF(t.y,e.y)}function XF(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function nX(t,e){return XF(t.x,e.x)&&XF(t.y,e.y)}function JF(t){return la(t.x)/la(t.y)}function ej(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Tpe{constructor(){this.members=[]}add(e){mD(this.members,e),e.scheduleRender()}remove(e){if(gD(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let i;for(let s=n;s>=0;s--){const r=this.members[s];if(r.isPresent!==!1){i=r;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function kpe(t,e,n){let i="";const s=t.x.translate/e.x,r=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||r||o)&&(i=`translate3d(${s}px, ${r}px, ${o}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:l,rotate:d,rotateX:h,rotateY:p,skewX:g,skewY:b}=n;l&&(i=`perspective(${l}px) ${i}`),d&&(i+=`rotate(${d}deg) `),h&&(i+=`rotateX(${h}deg) `),p&&(i+=`rotateY(${p}deg) `),g&&(i+=`skewX(${g}deg) `),b&&(i+=`skewY(${b}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return(a!==1||c!==1)&&(i+=`scale(${a}, ${c})`),i||"none"}const oT=["","X","Y","Z"],Npe=1e3;let Rpe=0;function aT(t,e,n,i){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),i&&(i[t]=0))}function iX(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=VQ(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",ks,!(s||r))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&iX(i)}function sX({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=Rpe++,this.animationId=0,this.animationCommitId=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.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>
vendor: 14,744 bytes, line 77
77{this.projectionUpdateScheduled=!1,this.nodes.forEach(Dpe),this.nodes.forEach($pe),this.nodes.forEach(Upe),this.nodes.forEach(Ope)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,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 c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new ype)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new wD),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const c=this.eventHandlers.get(o);c&&c.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=wQ(o)&&!xfe(o),this.instance=o;const{layoutId:a,layout:c,visualElement:l}=this.options;if(l&&!l.current&&l.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),t){let d,h=0;const p=()=>this.root.updateBlockedByResize=!1;ks.read(()=>{h=window.innerWidth}),t(o,()=>{const g=window.innerWidth;g!==h&&(h=g,this.root.updateBlockedByResize=!0,d&&d(),d=bpe(p,250),eE.hasAnimatedSinceResize&&(eE.hasAnimatedSinceResize=!1,this.nodes.forEach(ij)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&l&&(a||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||l.getDefaultTransition()||Wpe,{onLayoutAnimationStart:w,onLayoutAnimationComplete:C}=l.getProps(),E=!this.targetLayout||!nX(this.targetLayout,g),T=!h&&p;if(this.options.layoutRoot||this.resumeFrom||T||h&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const A={...PD(b,"layout"),onPlay:w,onComplete:C};(l.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A),this.setAnimationOrigin(d,T)}else h||ij(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}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,this.eventHandlers.clear(),mp(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(Bpe),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(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&iX(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const h=this.path[d];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(tj);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(nj);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Lpe),this.nodes.forEach(Ppe),this.nodes.forEach(Ipe)):this.nodes.forEach(nj),this.clearAllSnapshots();const a=Ga.now();bo.delta=pf(0,1e3/60,a-bo.timestamp),bo.timestamp=a,bo.isProcessing=!0,YA.update.process(bo),YA.preRender.process(bo),YA.render.process(bo),bo.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,DD.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Mpe),this.sharedNodes.forEach(Fpe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ks.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ks.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!la(this.snapshot.measuredBox.x)&&!la(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Pr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const c=i(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!tX(this.projectionDelta),c=this.getTransformTemplate(),l=c?c(this.latestValues,""):void 0,d=l!==this.prevTransformTemplateValue;o&&this.instance&&(a||Tm(this.latestValues)||d)&&(s(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let c=this.removeElementScroll(a);return o&&(c=this.removeTransform(c)),qpe(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var l;const{visualElement:o}=this.options;if(!o)return Pr();const a=o.measureViewportBox();if(!(((l=this.scroll)==null?void 0:l.wasRoot)||this.path.some(zpe))){const{scroll:d}=this.root;d&&(Qy(a.x,d.offset.x),Qy(a.y,d.offset.y))}return a}removeElementScroll(o){var c;const a=Pr();if(tu(a,o),(c=this.scroll)!=null&&c.wasRoot)return a;for(let l=0;l<this.path.length;l++){const d=this.path[l],{scroll:h,options:p}=d;d!==this.root&&h&&p.layoutScroll&&(h.wasRoot&&tu(a,o),Qy(a.x,h.offset.x),Qy(a.y,h.offset.y))}return a}applyTransform(o,a=!1){const c=Pr();tu(c,o);for(let l=0;l<this.path.length;l++){const d=this.path[l];!a&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Xy(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Tm(d.latestValues)&&Xy(c,d.latestValues)}return Tm(this.latestValues)&&Xy(c,this.latestValues),c}removeTransform(o){const a=Pr();tu(a,o);for(let c=0;c<this.path.length;c++){const l=this.path[c];if(!l.instance||!Tm(l.latestValues))continue;GN(l.latestValues)&&l.updateSnapshot();const d=Pr(),h=l.measurePageBox();tu(d,h),YF(a,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,d)}return Tm(this.latestValues)&&YF(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==bo.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var g;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==a;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:h}=this.options;if(!this.layout||!(d||h))return;this.resolvedRelativeTargetAt=bo.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Pr(),this.targetWithTransforms=Pr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),J0e(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):tu(this.target,this.layout.layoutBox),LQ(this.target,this.targetDelta)):tu(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||GN(this.parent.latestValues)||MQ(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,a,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Pr(),this.relativeTargetOrigin=Pr(),UE(this.relativeTargetOrigin,a,c),tu(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var b;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(b=this.parent)!=null&&b.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===bo.timestamp&&(c=!1),c)return;const{layout:l,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(l||d))return;tu(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;d0e(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=Pr());const{target:g}=o;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(HF(this.prevProjectionDelta.x,this.projectionDelta.x),HF(this.prevProjectionDelta.y,this.projectionDelta.y)),a3(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!ej(this.projectionDelta.x,this.prevProjectionDelta.x)||!ej(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Jy(),this.projectionDelta=Jy(),this.projectionDeltaWithTransform=Jy()}setAnimationOrigin(o,a=!1){const c=this.snapshot,l=c?c.latestValues:{},d={...this.latestValues},h=Jy();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const p=Pr(),g=c?c.source:void 0,b=this.layout?this.layout.source:void 0,w=g!==b,C=this.getStack(),E=!C||C.members.length<=1,T=!!(w&&!E&&this.options.crossfade===!0&&!this.path.some(Vpe));this.animationProgress=0;let A;this.mixTargetDelta=k=>{const R=k/1e3;sj(h.x,o.x,R),sj(h.y,o.y,R),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(UE(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),jpe(this.relativeTarget,this.relativeTargetOrigin,p,R),A&&Ape(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Pr()),tu(A,this.relativeTarget)),w&&(this.animationValues=d,vpe(d,l,this.latestValues,R,T,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,c,l;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(l=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||l.stop(),this.pendingAnimation&&(mp(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ks.update(()=>{eE.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=H2(0)),this.currentAnimation=mpe(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},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(Npe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:d}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&rX(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||Pr();const h=la(this.layout.layoutBox.x);
vendor: 8,565 bytes, line 77
77c.x.min=o.target.x.min,c.x.max=c.x.min+h;const p=la(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+p}tu(a,c),Xy(a,d),a3(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Tpe),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const l={};c.z&&aT("z",o,l,this.animationValues);for(let d=0;d<oT.length;d++)aT(`rotate${oT[d]}`,o,l,this.animationValues),aT(`skew${oT[d]}`,o,l,this.animationValues);o.render();for(const d in l)o.setStaticValue(d,l[d]),this.animationValues&&(this.animationValues[d]=l[d]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Jx(a==null?void 0:a.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Jx(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Tm(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=l.animationValues||l.latestValues;this.applyTransformsToTarget();let h=kpe(this.projectionDeltaWithTransform,this.treeScale,d);c&&(h=c(d,h)),o.transform=h;const{x:p,y:g}=this.projectionDelta;o.transformOrigin=`${p.origin*100}% ${g.origin*100}% 0`,l.animationValues?o.opacity=l===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=l===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const b in HN){if(d[b]===void 0)continue;const{correct:w,applyTo:C,isCSSVariable:E}=HN[b],T=h==="none"?d[b]:w(d[b],l);if(C){const A=C.length;for(let k=0;k<A;k++)o[C[k]]=T}else E?this.options.visualElement.renderState.vars[b]=T:o[b]=T}this.options.layoutId&&(o.pointerEvents=l===this?Jx(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(tj),this.root.sharedNodes.clear()}}}function Ppe(t){t.updateLayout()}function Ipe(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:s}=t.layout,{animationType:r}=t.options,o=e.source!==t.layout.source;r==="size"?gl(h=>{const p=o?e.measuredBox[h]:e.layoutBox[h],g=la(p);p.min=i[h].min,p.max=p.min+g}):rX(r,e.layoutBox,i)&&gl(h=>{const p=o?e.measuredBox[h]:e.layoutBox[h],g=la(i[h]);p.max=p.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+g)});const a=Jy();a3(a,i,e.layoutBox);const c=Jy();o?a3(c,t.applyTransform(s,!0),e.measuredBox):a3(c,i,e.layoutBox);const l=!tX(a);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:g}=h;if(p&&g){const b=Pr();UE(b,e.layoutBox,p.layoutBox);const w=Pr();UE(w,i,g.layoutBox),nX(b,w)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=b,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function Dpe(t){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 Ope(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Mpe(t){t.clearSnapshot()}function tj(t){t.clearMeasurements()}function nj(t){t.isLayoutDirty=!1}function Lpe(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function ij(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function $pe(t){t.resolveTargetDelta()}function Upe(t){t.calcProjection()}function Bpe(t){t.resetSkewAndRotation()}function Fpe(t){t.removeLeadSnapshot()}function sj(t,e,n){t.translate=Ms(e.translate,0,n),t.scale=Ms(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function rj(t,e,n,i){t.min=Ms(e.min,n.min,i),t.max=Ms(e.max,n.max,i)}function jpe(t,e,n,i){rj(t.x,e.x,n.x,i),rj(t.y,e.y,n.y,i)}function Vpe(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Wpe={duration:.45,ease:[.4,0,.1,1]},oj=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),aj=oj("applewebkit/")&&!oj("chrome/")?Math.round:kl;function cj(t){t.min=aj(t.min),t.max=aj(t.max)}function qpe(t){cj(t.x),cj(t.y)}function rX(t,e,n){return t==="position"||t==="preserve-aspect"&&!X0e(JF(e),JF(n),.2)}function zpe(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Hpe=sX({attachResizeListener:(t,e)=>L3(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),cT={current:void 0},oX=sX({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!cT.current){const t=new Hpe({});t.mount(window),t.setOptions({layoutScroll:!0}),cT.current=t}return cT.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Gpe={pan:{Feature:fpe},drag:{Feature:hpe,ProjectionNode:oX,MeasureLayout:XQ}};function lj(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,r=i[s];r&&ks.postRender(()=>r(e,f6(e)))}class Kpe extends Bp{mount(){const{current:e}=this.node;e&&(this.unmount=yfe(e,(n,i)=>(lj(this.node,i,"Start"),s=>lj(this.node,s,"End"))))}unmount(){}}class Ype extends Bp{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=u6(L3(this.node.current,"focus",()=>this.onFocus()),L3(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function uj(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),r=i[s];r&&ks.postRender(()=>r(e,f6(e)))}class Zpe extends Bp{mount(){const{current:e}=this.node;e&&(this.unmount=Cfe(e,(n,i)=>(uj(this.node,i,"Start"),(s,{success:r})=>uj(this.node,s,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const eR=new WeakMap,lT=new WeakMap,Qpe=t=>{const e=eR.get(t.target);e&&e(t)},Xpe=t=>{t.forEach(Qpe)};function Jpe({root:t,...e}){const n=t||document;lT.has(n)||lT.set(n,{});const i=lT.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(Xpe,{root:t,...e})),i[s]}function eme(t,e,n){const i=Jpe(e);return eR.set(t,n),i.observe(t),()=>{eR.delete(t),i.unobserve(t)}}const tme={some:0,all:1};
77class nme extends Bp{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:r}=e,o={root:n?n.current:void 0,rootMargin:i,threshold:typeof s=="number"?s:tme[s]},a=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,r&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),p=l?d:h;p&&p(c)};return eme(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(ime(e,n))&&this.startObserver()}unmount(){}}function ime({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const sme={inView:{Feature:nme},tap:{Feature:Zpe},focus:{Feature:Ype},hover:{Feature:Kpe}},rme={layout:{ProjectionNode:oX,MeasureLayout:XQ}},ome={...H0e,...sme,...Gpe,...rme},Wo=c0e(ome,C0e),ame=()=>Jce(),cme=nle,BE=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],tR=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],aX=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],cX=[...aX,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],lme=[...aX,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],dj=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],hj=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],lX=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],fj=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}
77],Ks=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}];function Pu(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new xme(t.type);return`${t.name}(${P8(t.inputs,{includeName:e})})`}function P8(t,{includeName:e=!1}={}){return t?t.map(n=>ume(n,{includeName:e})).join(e?", ":","):""}function ume(t,{includeName:e}){return t.type.startsWith("tuple")?`(${P8(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}function Nd(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function Ys(t){return Nd(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const uX="2.41.2";let Cv={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:n})=>e?`${t??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${uX}`},st=class nR extends Error{constructor(e,n={}){var a;const i=(()=>{var c;return n.cause instanceof nR?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof nR&&n.cause.docsPath||n.docsPath,r=(a=Cv.getDocsUrl)==null?void 0:a.call(Cv,{...n,docsPath:s}),o=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...i?[`Details: ${i}`]:[],...Cv.version?[`Version: ${Cv.version}`]:[]].join(` 78`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=i,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=uX}walk(e){return dX(this,e)}};function dX(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?dX(t.cause,e):e?null:t}class dme extends st{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` 79`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class pj extends st{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` 80`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class hX extends st{constructor({data:e,params:n,size:i}){super([`Data size of ${i} bytes is too small for given parameters.`].join(` 81`),{metaMessages:[`Params: (${P8(n,{includeName:!0})})`,`Data: ${e} (${i} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=n,this.size=i}}class p6 extends st{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class hme extends st{constructor({expectedLength:e,givenLength:n,type:i}){super([`ABI encoding array length mismatch for type ${i}.`,`Expected length: ${e}`,`Given length: ${n}`].join(`
82`),{name:"AbiEncodingArrayLengthMismatchError"})}}class fme extends st{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${Ys(n)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class pme extends st{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(` 83`),{name:"AbiEncodingLengthMismatchError"})}}class mme extends st{constructor(e,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${e}", but "${e}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(` 84`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class mj extends st{constructor(e,{docsPath:n}={}){super([`Error ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(` 85`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class fX extends st{constructor(e,{docsPath:n}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(` 86`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class gme extends st{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}}class pX extends st{constructor(e,{docsPath:n}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(` 87`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class gj extends st{constructor(e,{docsPath:n}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(` 88`),{docsPath:n,name:"AbiEventNotFoundError"})}}class K2 extends st{constructor(e,{docsPath:n}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` 89`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class mX extends st{constructor(e,{docsPath:n}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(` 90`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class yme extends st{constructor(e,{docsPath:n}){super([`Encoded function signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(` 91`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class bme extends st{constructor(e,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Pu(e.abiItem)}\`, and`,`\`${n.type}\` in \`${Pu(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let wme=class extends st{constructor({expectedSize:e,givenSize:n}){super(`Expected bytes${e}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class $3 extends st{constructor({abiItem:e,data:n,params:i,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(` 92`),{metaMessages:[`Params: (${P8(i,{includeName:!0})})`,`Data: ${n} (${s} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=n,this.params=i,this.size=s}}class I8 extends st{constructor({abiItem:e,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Pu(e,{includeName:!0})}".`].join(` 93`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class vme extends st{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` 94`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Cme extends st{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` 95`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let gX=class extends st{constructor(e){super([`Value "${e}" is not a valid array.`].join(` 96`),{name:"InvalidArrayError"})}};class xme extends st{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` 97`),{name:"InvalidDefinitionTypeError"})}}let yp=class extends st{constructor({address:e}){super(`Address "${e}
97" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},yX=class extends st{constructor({offset:e,position:n,size:i}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${i}).`,{name:"SliceOffsetOutOfBoundsError"})}},bX=class extends st{constructor({size:e,targetSize:n,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class yj extends st{constructor({size:e,targetSize:n,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} is expected to be ${n} ${i} long, but is ${e} ${i} long.`,{name:"InvalidBytesLengthError"})}}function Ib(t,{dir:e,size:n=32}={}){return typeof t=="string"?cp(t,{dir:e,size:n}):Eme(t,{dir:e,size:n})}function cp(t,{dir:e,size:n=32}={}){if(n===null)return t;const i=t.replace("0x","");if(i.length>n*2)throw new bX({size:Math.ceil(i.length/2),targetSize:n,type:"hex"});return`0x${i[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function Eme(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new bX({size:t.length,targetSize:n,type:"bytes"});const i=new Uint8Array(n);for(let s=0;s<n;s++){const r=e==="right";i[r?s:n-s-1]=t[r?s:t.length-s-1]}return i}let wX=class extends st{constructor({max:e,min:n,signed:i,size:s,value:r}){super(`Number "${r}" is not in safe ${s?`${s*8}-bit ${i?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},_me=class extends st{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class Sme extends st{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Ame=class extends st{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}};function tf(t,{dir:e="left"}={}){let n=typeof t=="string"?t.replace("0x",""):t,i=0;for(let s=0;s<n.length-1&&n[e==="left"?s:n.length-s-1].toString()==="0";s++)i++;return n=e==="left"?n.slice(i):n.slice(0,n.length-i),typeof t=="string"?(n.length===1&&e==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function $l(t,{size:e}){if(Ys(t)>e)throw new Ame({givenSize:Ys(t),maxSize:e})}function Rd(t,e={}){const{signed:n}=e;e.size&&$l(t,{size:e.size});const i=BigInt(t);if(!n)return i;const s=(t.length-2)/2,r=(1n<<BigInt(s)*8n-1n)-1n;return i<=r?i:i-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function Tme(t,e={}){let n=t;if(e.size&&($l(n,{size:e.size}),n=tf(n)),tf(n)==="0x00")return!1;if(tf(n)==="0x01")return!0;throw new Sme(n)}function gf(t,e={}){return Number(Rd(t,e))}function vX(t,e={}){let n=Du(t);return e.size&&($l(n,{size:e.size}),n=tf(n,{dir:"right"})),new TextDecoder().decode(n)}const kme=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Iu(t,e={}){return typeof t=="number"||typeof t=="bigint"?cn(t,e):typeof t=="string"?Y2(t,e):typeof t=="boolean"?CX(t,e):Fr(t,e)}function CX(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?($l(n,{size:e.size}),Ib(n,{size:e.size})):n}function Fr(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=kme[t[s]];const i=`0x${n}`;return typeof e.size=="number"?($l(i,{size:e.size}),Ib(i,{dir:"right",size:e.size})):i}function cn(t,e={}){const{signed:n,size:i}=e,s=BigInt(t);let r;i?n?r=(1n<<BigInt(i)*8n-1n)-1n:r=2n**(BigInt(i)*8n)-1n:typeof t=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&n?-r-1n:0;if(r&&s>r||s<o){const c=typeof t=="bigint"?"n":"";throw new wX({max:r?`${r}${c}`:void 0,min:`${o}${c}`,signed:n,size:i,value:`${t}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(i*8))+BigInt(s):s).toString(16)}`;return i?Ib(a,{size:i}):a}const Nme=new TextEncoder;function Y2(t,e={}){const n=Nme.encode(t);return Fr(n,e)}const Rme=new TextEncoder;function Db(t,e={}){return typeof t=="number"||typeof t=="bigint"?Ime(t,e):typeof t=="boolean"?Pme(t,e):Nd(t)?Du(t,e):ug(t,e)}function Pme(t,e={}){const n=new Uint8Array(1);return n[0]=Number(t),typeof e.size=="number"?($l(n,{size:e.size}),Ib(n,{size:e.size})):n}const wh={zero:48,nine:57,A:65,F:70,a:97,f:102};function bj(t){if(t>=wh.zero&&t<=wh.nine)return t-wh.zero;if(t>=wh.A&&t<=wh.F)return t-(wh.A-10);if(t>=wh.a&&t<=wh.f)return t-(wh.a-10)}function Du(t,e={}){let n=t;e.size&&($l(n,{size:e.size}),n=Ib(n,{dir:"right",size:e.size}));let i=n.slice(2);i.length%2&&(i=`0${i}`);const s=i.length/2,r=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=bj(i.charCodeAt(a++)),l=bj(i.charCodeAt(a++));if(c===void 0||l===void 0)throw new st(`Invalid byte sequence ("${i[a-2]}${i[a-1]}" in "${i}").`);r[o]=c*16+l}return r}function Ime(t,e){const n=cn(t,e);return Du(n)}function ug(t,e={}){const n=Rme.encode(t);return typeof e.size=="number"?($l(n,{size:e.size}),Ib(n,{dir:"right",size:e.size})):n}const WC=BigInt(2**32-1),wj=BigInt(32);function Dme(t,e=!1){return e?{h:Number(t&WC),l:Number(t>>wj&WC)}:{h:Number(t>>wj&WC)|0,l:Number(t&WC)|0}}function xX(t,e=!1){const n=t.length;let i=new Uint32Array(n),s=new Uint32Array(n);for(let r=0;r<n;r++){const{h:o,l:a}=Dme(t[r],e);[i[r],s[r]]=[o,a]}return[i,s]}const vj=(t,e,n)=>t>>>n,Cj=(t,e,n)=>t<<32-n|e>>>n,Ey=(t,e,n)=>t>>>n|e<<32-n,_y=(t,e,n)=>t<<32-n|e>>>n,qC=(t,e,n)=>t<<64-n|e>>>n-32,zC=(t,e,n)=>t>>>n-32|e<<64-n,Ome=(t,e,n)=>t<<n|e>>>32-n,Mme=(t,e,n)=>e<<n|t>>>32-n,Lme=(t,e,n)=>e<<n-32|t>>>64-n,$me=(t,e,n)=>t<<n-32|e>>>64-n;function vh(t,e,n,i){const s=(e>>>0)+(i>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const Ume=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),Bme=(t,e,n,i)=>e+n+i+(t/2**32|0)|0,Fme=(t,e,n,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),jme=(t,e,n,i,s)=>e+n+i+s+(t/2**32|0)|0,Vme=(t,e,n,i,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0)+(s>>>0),Wme=(t,e,n,i,s,r)=>e+n+i+s+r+(t/2**32|0)|0,Sy=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qme(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function U3(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function bp(t,...e){if(!qme(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function zme(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");U3(t.outputLen),U3(t.blockLen)}function Z2(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function EX(t,e){bp(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Hme(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function wp(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function uT(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function sd(t,e){return t<<32-e|t>>>e}const Gme=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Kme(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Yme(t){for(let e=0;e<t.length;e++)t[e]=Kme(t[e]);return t}const xj=Gme?t=>t:Yme,_X=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Zme=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function XJe(t){if(bp(t),_X)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=Zme[t[n]];return e}const Ch={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ej(t){if(t>=Ch._0&&t<=Ch._9)return t-Ch._0;if(t>=Ch.A&&t<=Ch.F)return t-(Ch.A-10);if(t>=Ch.a&&t<=Ch.f)return t-(Ch.a-10)}function JJe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);
97if(_X)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(n);for(let s=0,r=0;s<n;s++,r+=2){const o=Ej(t.charCodeAt(r)),a=Ej(t.charCodeAt(r+1));if(o===void 0||a===void 0){const c=t[r]+t[r+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+r)}i[s]=o*16+a}return i}function Qme(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function D8(t){return typeof t=="string"&&(t=Qme(t)),bp(t),t}function Xme(...t){let e=0;for(let i=0;i<t.length;i++){const s=t[i];bp(s),e+=s.length}const n=new Uint8Array(e);for(let i=0,s=0;i<t.length;i++){const r=t[i];n.set(r,s),s+=r.length}return n}class zD{}function O8(t){const e=i=>t().update(D8(i)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Jme(t=32){if(Sy&&typeof Sy.getRandomValues=="function")return Sy.getRandomValues(new Uint8Array(t));if(Sy&&typeof Sy.randomBytes=="function")return Uint8Array.from(Sy.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const ege=BigInt(0),xv=BigInt(1),tge=BigInt(2),nge=BigInt(7),ige=BigInt(256),sge=BigInt(113),SX=[],AX=[],TX=[];for(let t=0,e=xv,n=1,i=0;t<24;t++){[n,i]=[i,(2*n+3*i)%5],SX.push(2*(5*i+n)),AX.push((t+1)*(t+2)/2%64);let s=ege;for(let r=0;r<7;r++)e=(e<<xv^(e>>nge)*sge)%ige,e&tge&&(s^=xv<<(xv<<BigInt(r))-xv);TX.push(s)}const kX=xX(TX,!0),rge=kX[0],oge=kX[1],_j=(t,e,n)=>n>32?Lme(t,e,n):Ome(t,e,n),Sj=(t,e,n)=>n>32?$me(t,e,n):Mme(t,e,n);function age(t,e=24){const n=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],d=n[c+1],h=_j(l,d,1)^n[a],p=Sj(l,d,1)^n[a+1];for(let g=0;g<50;g+=10)t[o+g]^=h,t[o+g+1]^=p}let s=t[2],r=t[3];for(let o=0;o<24;o++){const a=AX[o],c=_j(s,r,a),l=Sj(s,r,a),d=SX[o];s=t[d],r=t[d+1],t[d]=c,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}t[0]^=rge[i],t[1]^=oge[i]}wp(n)}class HD extends zD{constructor(e,n,i,s=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=i,this.enableXOF=s,this.rounds=r,U3(i),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Hme(this.state)}clone(){return this._cloneInto()}keccak(){xj(this.state32),age(this.state32,this.rounds),xj(this.state32),this.posOut=0,this.pos=0}update(e){Z2(this),e=D8(e),bp(e);const{blockLen:n,state:i}=this,s=e.length;for(let r=0;r<s;){const o=Math.min(n-this.pos,s-r);for(let a=0;a<o;a++)i[this.pos++]^=e[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:i,blockLen:s}=this;e[i]^=n,(n&128)!==0&&i===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Z2(this,!1),bp(e),this.finish();const n=this.state,{blockLen:i}=this;for(let s=0,r=e.length;s<r;){this.posOut>=i&&this.keccak();const o=Math.min(i-this.posOut,r-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return U3(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(EX(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,wp(this.state)}_cloneInto(e){const{blockLen:n,suffix:i,outputLen:s,rounds:r,enableXOF:o}=this;return e||(e=new HD(n,i,s,o,r)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=r,e.suffix=i,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const cge=(t,e,n)=>O8(()=>new HD(e,t,n)),GD=cge(1,136,256/8);function xo(t,e){const n=e||"hex",i=GD(Nd(t,{strict:!1})?Db(t):t);return n==="bytes"?i:Iu(i)}let m6=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const i=this.keys().next().value;i&&this.delete(i)}return this}};const lge=/^0x[a-fA-F0-9]{40}$/,dT=new m6(8192);function Ja(t,e){const{strict:n=!0}=e??{},i=`${t}.${n}`;if(dT.has(i))return dT.get(i);const s=lge.test(t)?t.toLowerCase()===t?!0:n?g6(t)===t:!0:!1;return dT.set(i,s),s}const hT=new m6(8192);function g6(t,e){if(hT.has(`${t}.${e}`))return hT.get(`${t}.${e}`);const n=e?`${e}${t.toLowerCase()}`:t.substring(2).toLowerCase(),i=xo(ug(n),"bytes"),s=(e?n.substring(`${e}0x`.length):n).split("");for(let o=0;o<40;o+=2)i[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(i[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const r=`0x${s.join("")}`;return hT.set(`${t}.${e}`,r),r}function bd(t,e){if(!Ja(t,{strict:!1}))throw new yp({address:t});return g6(t,e)}let Aj=class extends st{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}},NX=class extends st{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}},uge=class extends st{constructor({count:e,limit:n}
97){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}};const dge={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new uge({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new NX({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Aj({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Aj({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const n=e??this.position;return this.assertPosition(n+t-1),this.bytes.subarray(n,n+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const n=this.inspectBytes(t);return this.position+=e??t,n},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function KD(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(dge);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}function Q2(t,e,n,{strict:i}={}){return Nd(t,{strict:!1})?hge(t,e,n,{strict:i}):IX(t,e,n,{strict:i})}function RX(t,e){if(typeof e=="number"&&e>0&&e>Ys(t)-1)throw new yX({offset:e,position:"start",size:Ys(t)})}function PX(t,e,n){if(typeof e=="number"&&typeof n=="number"&&Ys(t)!==n-e)throw new yX({offset:n,position:"end",size:Ys(t)})}function IX(t,e,n,{strict:i}={}){RX(t,e);const s=t.slice(e,n);return i&&PX(s,e,n),s}function hge(t,e,n,{strict:i}={}){RX(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return i&&PX(s,e,n),s}function fge(t,e={}){typeof e.size<"u"&&$l(t,{size:e.size});const n=Fr(t,e);return Rd(n,e)}function pge(t,e={}){let n=t;if(typeof e.size<"u"&&($l(n,{size:e.size}),n=tf(n)),n.length>1||n[0]>1)throw new _me(n);return!!n[0]}function nf(t,e={}){typeof e.size<"u"&&$l(t,{size:e.size});const n=Fr(t,e);return gf(n,e)}function mge(t,e={}){let n=t;return typeof e.size<"u"&&($l(n,{size:e.size}),n=tf(n,{dir:"right"})),new TextDecoder().decode(n)}function Pd(t){return typeof t[0]=="string"?Ob(t):gge(t)}function gge(t){let e=0;for(const s of t)e+=s.length;const n=new Uint8Array(e);let i=0;for(const s of t)n.set(s,i),i+=s.length;return n}function Ob(t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}const yge=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,DX=/^(u?int)(8|
9716|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function f1(t,e){if(t.length!==e.length)throw new pme({expectedLength:t.length,givenLength:e.length});const n=bge({params:t,values:e}),i=ZD(n);return i.length===0?"0x":i}function bge({params:t,values:e}){const n=[];for(let i=0;i<t.length;i++)n.push(YD({param:t[i],value:e[i]}));return n}function YD({param:t,value:e}){const n=QD(t.type);if(n){const[i,s]=n;return vge(e,{length:i,param:{...t,type:s}})}if(t.type==="tuple")return Sge(e,{param:t});if(t.type==="address")return wge(e);if(t.type==="bool")return xge(e);if(t.type.startsWith("uint")||t.type.startsWith("int")){const i=t.type.startsWith("int"),[,,s="256"]=DX.exec(t.type)??[];return Ege(e,{signed:i,size:Number(s)})}if(t.type.startsWith("bytes"))return Cge(e,{param:t});if(t.type==="string")return _ge(e);throw new vme(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ZD(t){let e=0;for(let r=0;r<t.length;r++){const{dynamic:o,encoded:a}=t[r];o?e+=32:e+=Ys(a)}const n=[],i=[];let s=0;for(let r=0;r<t.length;r++){const{dynamic:o,encoded:a}=t[r];o?(n.push(cn(e+s,{size:32})),i.push(a),s+=Ys(a)):n.push(a)}return Pd([...n,...i])}function wge(t){if(!Ja(t))throw new yp({address:t});return{dynamic:!1,encoded:cp(t.toLowerCase())}}function vge(t,{length:e,param:n}){const i=e===null;if(!Array.isArray(t))throw new gX(t);if(!i&&t.length!==e)throw new hme({expectedLength:e,givenLength:t.length,type:`${n.type}[${e}]`});let s=!1;const r=[];for(let o=0;o<t.length;o++){const a=YD({param:n,value:t[o]});a.dynamic&&(s=!0),r.push(a)}if(i||s){const o=ZD(r);if(i){const a=cn(r.length,{size:32});return{dynamic:!0,encoded:r.length>0?Pd([a,o]):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Pd(r.map(({encoded:o})=>o))}}function Cge(t,{param:e}){const[,n]=e.type.split("bytes"),i=Ys(t);if(!n){let s=t;return i%32!==0&&(s=cp(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Pd([cp(cn(i,{size:32})),s])}}if(i!==Number.parseInt(n,10))throw new fme({expectedSize:Number.parseInt(n,10),value:t});return{dynamic:!1,encoded:cp(t,{dir:"right"})}}function xge(t){if(typeof t!="boolean")throw new st(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:cp(CX(t))}}function Ege(t,{signed:e,size:n=256}){if(typeof n=="number"){const i=2n**(BigInt(n)-(e?1n:0n))-1n,s=e?-i-1n:0n;if(t>i||t<s)throw new wX({max:i.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:cn(t,{size:32,signed:e})}}function _ge(t){const e=Y2(t),n=Math.ceil(Ys(e)/32),i=[];for(let s=0;s<n;s++)i.push(cp(Q2(e,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Pd([cp(cn(Ys(e),{size:32})),...i])}}function Sge(t,{param:e}){let n=!1;const i=[];for(let s=0;s<e.components.length;s++){const r=e.components[s],o=Array.isArray(t)?s:r.name,a=YD({param:r,value:t[o]});i.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ZD(i):Pd(i.map(({encoded:s})=>s))}}function QD(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}function y6(t,e){const n=typeof e=="string"?Du(e):e,i=KD(n);if(Ys(n)===0&&t.length>0)throw new p6;if(Ys(e)&&Ys(e)<32)throw new hX({data:typeof e=="string"?e:Fr(e),params:t,size:Ys(e)});let s=0;const r=[];for(let o=0;o<t.length;++o){const a=t[o];i.setPosition(s);const[c,l]=m2(i,a,{staticPosition:0});s+=l,r.push(c)}return r}function m2(t,e,{staticPosition:n}){const i=QD(e.type);if(i){const[s,r]=i;return Tge(t,{...e,type:r},{length:s,staticPosition:n})}if(e.type==="tuple")return Pge(t,e,{staticPosition:n});if(e.type==="address")return Age(t);if(e.type==="bool")return kge(t);if(e.type.startsWith("bytes"))return Nge(t,e,{staticPosition:n});if(e.type.startsWith("uint")||e.type.startsWith("int"))return Rge(t,e);if(e.type==="string")return Ige(t,{staticPosition:n});throw new Cme(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Tj=32,iR=32;function Age(t){const e=t.readBytes(32);return[g6(Fr(IX(e,-20))),32]}function Tge(t,e,{length:n,staticPosition:i}
97){if(!n){const o=nf(t.readBytes(iR)),a=i+o,c=a+Tj;t.setPosition(a);const l=nf(t.readBytes(Tj)),d=B3(e);let h=0;const p=[];for(let g=0;g<l;++g){t.setPosition(c+(d?g*32:h));const[b,w]=m2(t,e,{staticPosition:c});h+=w,p.push(b)}return t.setPosition(i+32),[p,32]}if(B3(e)){const o=nf(t.readBytes(iR)),a=i+o,c=[];for(let l=0;l<n;++l){t.setPosition(a+l*32);const[d]=m2(t,e,{staticPosition:a});c.push(d)}return t.setPosition(i+32),[c,32]}let s=0;const r=[];for(let o=0;o<n;++o){const[a,c]=m2(t,e,{staticPosition:i+s});s+=c,r.push(a)}return[r,s]}function kge(t){return[pge(t.readBytes(32),{size:32}),32]}function Nge(t,e,{staticPosition:n}){const[i,s]=e.type.split("bytes");if(!s){const o=nf(t.readBytes(32));t.setPosition(n+o);const a=nf(t.readBytes(32));if(a===0)return t.setPosition(n+32),["0x",32];const c=t.readBytes(a);return t.setPosition(n+32),[Fr(c),32]}return[Fr(t.readBytes(Number.parseInt(s,10),32)),32]}function Rge(t,e){const n=e.type.startsWith("int"),i=Number.parseInt(e.type.split("int")[1]||"256",10),s=t.readBytes(32);return[i>48?fge(s,{signed:n}):nf(s,{signed:n}),32]}function Pge(t,e,{staticPosition:n}){const i=e.components.length===0||e.components.some(({name:o})=>!o),s=i?[]:{};let r=0;if(B3(e)){const o=nf(t.readBytes(iR)),a=n+o;for(let c=0;c<e.components.length;++c){const l=e.components[c];t.setPosition(a+r);const[d,h]=m2(t,l,{staticPosition:a});r+=h,s[i?c:l==null?void 0:l.name]=d}return t.setPosition(n+32),[s,32]}for(let o=0;o<e.components.length;++o){const a=e.components[o],[c,l]=m2(t,a,{staticPosition:n});s[i?o:a==null?void 0:a.name]=c,r+=l}return[s,r]}function Ige(t,{staticPosition:e}){const n=nf(t.readBytes(32)),i=e+n;t.setPosition(i);const s=nf(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const r=t.readBytes(s,32),o=mge(tf(r));return t.setPosition(e+32),[o,32]}function B3(t){var i;const{type:e}=t;if(e==="string"||e==="bytes"||e.endsWith("[]"))return!0;if(e==="tuple")return(i=t.components)==null?void 0:i.some(B3);const n=QD(t.type);return!!(n&&B3({...t,type:n[1]}))}const Dge=t=>xo(Db(t));function Oge(t){return Dge(t)}const Mge="1.1.0";let sc=class sR extends Error{constructor(e,n={}){var o;const i=n.cause instanceof sR?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof sR&&n.cause.docsPath||n.docsPath,r=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...i?[`Details: ${i}`]:[],`Version: abitype@${Mge}`].join(` 98`);super(r),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=i,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}};function Mf(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const OX=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,MX=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,LX=/^\(.+?\).*?$/,kj=/^tuple(?<array>(\[(\d*)\])*)$/;function rR(t){let e=t.type;if(kj.test(t.type)&&"components"in t){e="(";const n=t.components.length;for(let s=0;s<n;s++){const r=t.components[s];e+=rR(r),s<n-1&&(e+=", ")}const i=Mf(kj,t.type);return e+=`)${(i==null?void 0:i.array)??""}`,rR({...t,type:e})}return"indexed"in t&&t.indexed&&(e=`${e}
98 indexed`),t.name?`${e} ${t.name}`:e}function jy(t){let e="";const n=t.length;for(let i=0;i<n;i++){const s=t[i];e+=rR(s),i!==n-1&&(e+=", ")}return e}function FE(t){var e;return t.type==="function"?`function ${t.name}(${jy(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${jy(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${jy(t.inputs)})`:t.type==="error"?`error ${t.name}(${jy(t.inputs)})`:t.type==="constructor"?`constructor(${jy(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const $X=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Lge(t){return $X.test(t)}function $ge(t){return Mf($X,t)}const UX=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Uge(t){return UX.test(t)}function Bge(t){return Mf(UX,t)}const BX=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Fge(t){return BX.test(t)}function jge(t){return Mf(BX,t)}const FX=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function M8(t){return FX.test(t)}function Vge(t){return Mf(FX,t)}const jX=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Wge(t){return jX.test(t)}function qge(t){return Mf(jX,t)}const VX=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function zge(t){return VX.test(t)}function Hge(t){return Mf(VX,t)}const Gge=/^receive\(\) external payable$/;function Kge(t){return Gge.test(t)}const Nj=new Set(["memory","indexed","storage","calldata"]),Yge=new Set(["indexed"]),oR=new Set(["calldata","memory","storage"]);class Zge extends sc{constructor({signature:e}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Qge extends sc{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Xge extends sc{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Jge extends sc{constructor({params:e}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class e1e extends sc{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class t1e extends sc{constructor({param:e,name:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class n1e extends sc{constructor({param:e,type:n,modifier:i}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${i}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class i1e extends sc{constructor({param:e,type:n,modifier:i}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${i}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${i}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class s1e extends sc{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invali
98d."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Mb extends sc{constructor({signature:e,type:n}){super(`Invalid ${n} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class r1e extends sc{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class o1e extends sc{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class a1e extends sc{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class c1e extends sc{constructor({current:e,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function l1e(t,e,n){let i="";if(n)for(const s of Object.entries(n)){if(!s)continue;let r="";for(const o of s[1])r+=`[${o.type}${o.name?`:${o.name}`:""}]`;i+=`(${s[0]}{${r}})`}return e?`${e}:${t}${i}`:t}const fT=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function aR(t,e={}){if(Fge(t))return u1e(t,e);if(Uge(t))return d1e(t,e);if(Lge(t))return h1e(t,e);if(Wge(t))return f1e(t,e);if(zge(t))return p1e(t);if(Kge(t))return{type:"receive",stateMutability:"payable"};throw new r1e({signature:t})}function u1e(t,e={}){const n=jge(t);if(!n)throw new Mb({signature:t,type:"function"});const i=Mc(n.parameters),s=[],r=i.length;for(let a=0;a<r;a++)s.push(yf(i[a],{modifiers:oR,structs:e,type:"function"}));const o=[];if(n.returns){const a=Mc(n.returns),c=a.length;for(let l=0;l<c;l++)o.push(yf(a[l],{modifiers:oR,structs:e,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function d1e(t,e={}){const n=Bge(t);if(!n)throw new Mb({signature:t,type:"event"});const i=Mc(n.parameters),s=[],r=i.length;for(let o=0;o<r;o++)s.push(yf(i[o],{modifiers:Yge,structs:e,type:"event"}));return{name:n.name,type:"event",inputs:s}}function h1e(t,e={}){const n=$ge(t);if(!n)throw new Mb({signature:t,type:"error"});const i=Mc(n.parameters),s=[],r=i.length;for(let o=0;o<r;o++)s.push(yf(i[o],{structs:e,type:"error"}));return{name:n.name,type:"error",inputs:s}}function f1e(t,e={}){const n=qge(t);if(!n)throw new Mb({signature:t,type:"constructor"});const i=Mc(n.parameters),s=[],r=i.length;for(let o=0;o<r;o++)s.push(yf(i[o],{structs:e,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function p1e(t){const e=Hge(t);if(!e)throw new Mb({signature:t,type:"fallback"});return{type:"fallback",stateMutability:e.stateMutability??"nonpayable"}}const m1e=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,g1e=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,y1e=/^u?int$/;function yf(t,e){var h,p;const n=l1e(t,e==null?void 0:e.type,e==null?void 0:e.structs);if(fT.has(n))return fT.get(n);const i=LX.test(t),s=Mf(i?g1e:m1e,t);if(!s)throw new e1e({param:t});if(s.name&&w1e(s.name))throw new t1e({param:t,name:s.name});const r=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},a=(e==null?void 0:e.structs)??{};let c,l={};if(i){c="tuple";const g=Mc(s.type),b=[],w=g.length;for(let C=0;C<w;C++)b.push(yf(g[C],{structs:a}));l={components:b}}else if(s.type in a)c="tuple",l={components:a[s.type]};else if(y1e.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!WX(c))throw new Xge({type:c});if(s.modifier){if(!((p=(h=e==null?void 0:e.modifiers)==null?void 0:h.has)!=null&&p.call(h,s.modifier)))throw new n1e({param:t,type:e==null?void 0:e.type,modifier:s.modifier});if(oR.has(s.modifier)&&!v1e(c,!!s.array))throw new i1e({param:t,type:e==null?void 0:e.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...r,...o,...l};return fT.set(n,d),d}function Mc(t,e=[],n="",i=0){const s=t.trim().length;for(let r=0;r<s;r++){const o=t[r],a=t.slice(r+1);switch(o){case",":return i===0?Mc(a,[...e,n.trim()]):Mc(a,e,`${n}${o}`,i);case"(":return Mc(a,e,`${n}${o}`,i+1);case")":return Mc(a,e,`${n}${o}`,i-1);default:return Mc(a,e,`${n}${o}`,i)}}if(n==="")return e;if(i!==0)throw new c1e({current:n,depth:i});return e.push(n.trim()),e}function WX(t){return t==="address"||t==="bool"||t==="function"||t==="string"||OX.test(t)||MX.test(t)}const b1e=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function w1e(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||OX.test(t)||MX.test(t)||b1e.test(t)}function v1e(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function XD(t){const e={},n=t.length;for(let o=0;o<n;o++){const a=t[o];if(!M8(a))continue;const c=Vge(a);if(!c)throw new Mb({signature:a,type:"struct"});const l=c.properties.split(";"),d=[],h=l.length;for(let p=0;p<h;p++){const b=l[p].trim();if(!b)continue;const w=yf(b,{type:"struct"});d.push(w)}if(!d.length)throw new o1e({signature:a});e[c.name]=d}const i={},s=Object.entries(e),r=s.length;for(let o=0;o<r;o++){const[a,c]=s[o];i[a]=qX(c,e)}return i}const C1e=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function qX(t,e,n=new Set){const i=[],s=t.length;for(let r=0;r<s;r++){const o=t[r];if(LX.test(o.type))i.push(o);else{const c=Mf(C1e,o.type);if(!(c!=null&&c.type))throw new s1e({abiParameter:o});const{array:l,type:d}=c;if(d in e){if(n.has(d))throw new a1e({type:d});i.push({...o,type:`tuple${l??""}`,components:qX(e[d]??[],e,new Set([...n,d]))})}else if(WX(d))i.push(o);else throw new Qge({type:d})}}return i}function zX(t){const e=XD(t),n=[],i=t.length;for(let s=0;s<i;s++){const r=t[s];M8(r)||n.push(aR(r,e))}return n}function Rj(t){let e;if(typeof t=="string")e=aR(t);else{const n=XD(t),i=t.length;for(let s=0;s<i;s++){const r=t[s];if(!M8(r)){e=aR(r,n);break}}}if(!e)throw new Zge({signature:t});return e}function Pj(t){const e=[];
98if(typeof t=="string"){const n=Mc(t),i=n.length;for(let s=0;s<i;s++)e.push(yf(n[s],{modifiers:Nj}))}else{const n=XD(t),i=t.length;for(let s=0;s<i;s++){const r=t[s];if(M8(r))continue;const o=Mc(r),a=o.length;for(let c=0;c<a;c++)e.push(yf(o[c],{modifiers:Nj,structs:n}))}}if(e.length===0)throw new Jge({params:t});return e}function x1e(t){let e=!0,n="",i=0,s="",r=!1;for(let o=0;o<t.length;o++){const a=t[o];if(["(",")",","].includes(a)&&(e=!0),a==="("&&i++,a===")"&&i--,!!e){if(i===0){if(a===" "&&["event","function",""].includes(s))s="";else if(s+=a,a===")"){r=!0;break}continue}if(a===" "){t[o-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=a,n+=a}}if(!r)throw new st("Unable to normalize signature.");return s}const E1e=t=>{const e=typeof t=="string"?t:FE(t);return x1e(e)};function HX(t){return Oge(E1e(t))}const L8=HX,b6=t=>Q2(HX(t),0,4);function p1(t){const{abi:e,args:n=[],name:i}=t,s=Nd(i,{strict:!1}),r=e.filter(a=>s?a.type==="function"?b6(a)===i:a.type==="event"?L8(a)===i:!1:"name"in a&&a.name===i);if(r.length===0)return;if(r.length===1)return r[0];let o;for(const a of r){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((l,d)=>{const h="inputs"in a&&a.inputs[d];return h?cR(l,h):!1})){if(o&&"inputs"in o&&o.inputs){const l=GX(a.inputs,o.inputs,n);if(l)throw new bme({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||r[0]}function cR(t,e){const n=typeof t,i=e.type;switch(i){case"address":return Ja(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return i==="tuple"&&"components"in e?Object.values(e.components).every((s,r)=>cR(Object.values(t)[r],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(i)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(i)?n==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(i)?Array.isArray(t)&&t.every(s=>cR(s,{...e,type:i.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function GX(t,e,n){for(const i in t){const s=t[i],r=e[i];if(s.type==="tuple"&&r.type==="tuple"&&"components"in s&&"components"in r)return GX(s.components,r.components,n[i]);const o=[s.type,r.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Ja(n[i],{strict:!1}):o.includes("address")&&o.includes("bytes")?Ja(n[i],{strict:!1}):!1)return o}}const pT="/docs/contract/decodeFunctionResult";function m1(t){const{abi:e,args:n,functionName:i,data:s}=t;let r=e[0];if(i){const a=p1({abi:e,args:n,name:i});if(!a)throw new K2(i,{docsPath:pT});r=a}if(r.type!=="function")throw new K2(void 0,{docsPath:pT});if(!r.outputs)throw new mX(r.name,{docsPath:pT});const o=y6(r.outputs,s);if(o&&o.length>1)return o;if(o&&o.length===1)return o[0]}const Ij="/docs/contract/encodeFunctionData";function _1e(t){const{abi:e,args:n,functionName:i}=t;let s=e[0];if(i){const r=p1({abi:e,args:n,name:i});if(!r)throw new K2(i,{docsPath:Ij});s=r}if(s.type!=="function")throw new K2(void 0,{docsPath:Ij});return{abi:[s],functionName:b6(Pu(s))}}function _i(t){const{args:e}=t,{abi:n,functionName:i}=(()=>{var a;return t.abi.length===1&&((a=t.functionName)!=null&&a.startsWith("0x"))?t:_1e(t)})(),s=n[0],r=i,o="inputs"in s&&s.inputs?f1(s.inputs,e??[]):void 0;return Ob([r,o??"0x"])}class lR extends st{constructor({blockNumber:e,chain:n,contract:i}){super(`Chain "${n.name}" does not support contract "${i.name}".`,{metaMessages:["This could be due to any of the following:",...e&&i.blockCreated&&i.blockCreated>e?[`- The contract "${i.name}" was not deployed until block ${i.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${i.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class S1e extends st{constructor({chain:e,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${e.id} â ${e.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e.id} â ${e.name}`],name:"ChainMismatchError"})}}class A1e extends st{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` 99`),{name:"ChainNotFoundError"})}}class KX extends st{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}
99function Lb({blockNumber:t,chain:e,contract:n}){var s;const i=(s=e==null?void 0:e.contracts)==null?void 0:s[n];if(!i)throw new lR({chain:e,contract:{name:n}});if(t&&i.blockCreated&&i.blockCreated>t)throw new lR({blockNumber:t,chain:e,contract:{name:n,blockCreated:i.blockCreated}});return i.address}function _o(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const T1e={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},YX={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},k1e={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function N1e(t){const{abi:e,data:n}=t,i=Q2(n,0,4);if(i==="0x")throw new p6;const r=[...e||[],YX,k1e].find(o=>o.type==="error"&&i===b6(Pu(o)));if(!r)throw new fX(i,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:r,args:"inputs"in r&&r.inputs&&r.inputs.length>0?y6(r.inputs,Q2(n,4)):void 0,errorName:r.name}}const Eo=(t,e,n)=>JSON.stringify(t,(i,s)=>typeof s=="bigint"?s.toString():s,n);function ZX({abiItem:t,args:e,includeFunctionName:n=!0,includeName:i=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${n?t.name:""}(${t.inputs.map((s,r)=>`${i&&s.name?`${s.name}: `:""}${typeof e[r]=="object"?Eo(e[r]):e[r]}`).join(", ")})`}const QX={gwei:9,wei:18},R1e={ether:-9,wei:9},P1e={ether:-18,gwei:-9};function dt(t,e){let n=t.toString();const i=n.startsWith("-");i&&(n=n.slice(1)),n=n.padStart(e,"0");let[s,r]=[n.slice(0,n.length-e),n.slice(n.length-e)];return r=r.replace(/(0+)$/,""),`${i?"-":""}${s||"0"}${r?`.${r}`:""}`}function w6(t,e="wei"){return dt(t,QX[e])}function Za(t,e="wei"){return dt(t,R1e[e])}class I1e extends st{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class D1e extends st{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Dj(t){return t.reduce((e,{slot:n,value:i})=>`${e} ${n}: ${i} 100`,"")}function O1e(t){return t.reduce((e,{address:n,...i})=>{let s=`${e} ${n}: 101`;return i.nonce&&(s+=` nonce: ${i.nonce} 102`),i.balance&&(s+=` balance: ${i.balance} 103`),i.code&&(s+=` code: ${i.code} 104`),i.state&&(s+=` state: 105`,s+=Dj(i.state)),i.stateDiff&&(s+=` stateDiff: 106`,s+=Dj(i.stateDiff)),s},` State Override: 107`).slice(0,-1)}function v6(t){const e=Object.entries(t).map(([i,s])=>s===void 0||s===!1?null:[i,s]).filter(Boolean),n=e.reduce((i,[s])=>Math.max(i,s.length),0);return e.map(([i,s])=>` ${`${i}:`.padEnd(n+1)} ${s}`).join(` 108`)}class M1e extends st{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",v6(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class L1e extends st{constructor(e,{account:n,docsPath:i,chain:s,data:r,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,to:h,value:p}){var b;const g=v6({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:h,value:typeof p<"u"&&`${w6(p)} ${((b=s==null?void 0:s.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:r,gas:o,gasPrice:typeof a<"u"&&`${Za(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Za(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Za(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",g].filter(
108Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class XX extends st{constructor({blockHash:e,blockNumber:n,blockTag:i,hash:s,index:r}){let o="Transaction";i&&r!==void 0&&(o=`Transaction at block time "${i}" at index "${r}"`),e&&r!==void 0&&(o=`Transaction at block hash "${e}" at index "${r}"`),n&&r!==void 0&&(o=`Transaction at block number "${n}" at index "${r}"`),s&&(o=`Transaction with hash "${s}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}}class JX extends st{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class $1e extends st{constructor({receipt:e}){super(`Transaction with hash "${e.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=e}}class U1e extends st{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const B1e=t=>t,JD=t=>t;class eJ extends st{constructor(e,{account:n,docsPath:i,chain:s,data:r,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,to:h,value:p,stateOverride:g}){var C;const b=n?_o(n):void 0;let w=v6({from:b==null?void 0:b.address,to:h,value:typeof p<"u"&&`${w6(p)} ${((C=s==null?void 0:s.nativeCurrency)==null?void 0:C.symbol)||"ETH"}`,data:r,gas:o,gasPrice:typeof a<"u"&&`${Za(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Za(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Za(l)} gwei`,nonce:d});g&&(w+=` 109${O1e(g)}`),super(e.shortMessage,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",w].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class eO extends st{constructor(e,{abi:n,args:i,contractAddress:s,docsPath:r,functionName:o,sender:a}){const c=p1({abi:n,args:i,name:o}),l=c?ZX({abiItem:c,args:i,includeFunctionName:!1,includeName:!1}):void 0,d=c?Pu(c,{includeName:!0}):void 0,h=v6({address:s&&B1e(s),function:d,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],h&&"Contract Call:",h].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=i,this.cause=e,this.contractAddress=s,this.functionName=o,this.sender=a}}class uR extends st{constructor({abi:e,data:n,functionName:i,message:s}){let r,o,a,c;if(n&&n!=="0x")try{o=N1e({abi:e,data:n});const{abiItem:d,errorName:h,args:p}=o;if(h==="Error")c=p[0];else if(h==="Panic"){const[g]=p;c=T1e[g]}else{const g=d?Pu(d,{includeName:!0}):void 0,b=d&&p?ZX({abiItem:d,args:p,includeFunctionName:!1,includeName:!1}):void 0;a=[g?`Error: ${g}`:"",b&&b!=="()"?` ${[...Array((h==null?void 0:h.length)??0).keys()].map(()=>" ").join("")}${b}`:""]}}catch(d){r=d}else s&&(c=s);let l;r instanceof fX&&(l=r.signature,a=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(c&&c!=="execution reverted"||l?[`The contract function "${i}" reverted with the following ${l?"signature":"reason"}:`,c||l].join(` 110`):`The contract function "${i}" reverted.`,{cause:r,metaMessages:a,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.raw=n,this.reason=c,this.signature=l}}class F1e extends st{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class j1e extends st{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class $8 extends st{constructor({data:e,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}function tO(t){var n,i,s,r,o,a;if(!(t instanceof st))return!1;const e=t.walk(c=>c instanceof uR);return e instanceof uR?((n=e.data)==null?void 0:n.errorName)==="HttpError"||((i=e.data)==null?void 0:i.errorName)==="ResolverError"||((s=e.data)==null?void 0:s.errorName)==="ResolverNotContract"||((r=e.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=e.data)==null?void 0:o.errorName)==="ReverseAddressMismatch"||((a=e.data)==null?void 0:a.errorName)==="UnsupportedResolverProfile":!1}function V1e(t){const{abi:e,data:n}=t,i=Q2(n,0,4),s=e.find(r=>r.type==="function"&&i===b6(Pu(r)));if(!s)throw new yme(i,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?y6(s.inputs,Q2(n,4)):void 0}}const mT="/docs/contract/encodeErrorResult";function Oj(t){const{abi:e,errorName:n,args:i}=t;let s=e[0];if(n){const c=p1({abi:e,args:i,name:n});if(!c)throw new mj(n,{docsPath:mT});s=c}if(s.type!=="error")throw new mj(void 0,{docsPath:mT});const r=Pu(s),o=b6(r);let a="0x";if(i&&i.length>0){if(!s.inputs)throw new mme(s.name,{docsPath:mT});a=f1(s.inputs,i)}return Ob([o,a])}const gT="/docs/contract/encodeFunctionResult";function W1e(t){const{abi:e,functionName:n,result:i}=t;let s=e[0];if(n){const o=p1({abi:e,name:n});if(!o)throw new K2(n,{docsPath:gT});s=o}if(s.type!=="function")throw new K2(void 0,{docsPath:gT});if(!s.outputs)throw new mX(s.name,{docsPath:gT});const r=(()=>
110{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[i];if(Array.isArray(i))return i;throw new gX(i)})();return f1(s.outputs,r)}const U8="x-batch-gateway:true";async function q1e(t){const{data:e,ccipRequest:n}=t,{args:[i]}=V1e({abi:tR,data:e}),s=[],r=[];return await Promise.all(i.map(async(o,a)=>{try{r[a]=o.urls.includes(U8)?await q1e({data:o.data,ccipRequest:n}):await n(o),s[a]=!1}catch(c){s[a]=!0,r[a]=z1e(c)}})),W1e({abi:tR,functionName:"query",result:[s,r]})}function z1e(t){return t.name==="HttpRequestError"&&t.status?Oj({abi:tR,errorName:"HttpError",args:[t.status,t.shortMessage]}):Oj({abi:[YX],errorName:"Error",args:["shortMessage"in t?t.shortMessage:t.message]})}function tJ(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return Nd(e)?e:null}function dR(t){let e=new Uint8Array(32).fill(0);if(!t)return Fr(e);const n=t.split(".");for(let i=n.length-1;i>=0;i-=1){const s=tJ(n[i]),r=s?Db(s):xo(ug(n[i]),"bytes");e=xo(Pd([e,r]),"bytes")}return Fr(e)}function H1e(t){return`[${t.slice(2)}]`}function G1e(t){const e=new Uint8Array(32).fill(0);return t?tJ(t)||xo(ug(t)):Fr(e)}function nO(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const n=new Uint8Array(ug(e).byteLength+2);let i=0;const s=e.split(".");for(let r=0;r<s.length;r++){let o=ug(s[r]);o.byteLength>255&&(o=ug(H1e(G1e(s[r])))),n[i]=o.length,n.set(o,i+1),i+=o.length+1}return n.byteLength!==i+1?n.slice(0,i+1):n}function sn(t,e,n){const i=t[e.name];if(typeof i=="function")return i;const s=t[n];return typeof s=="function"?s:r=>e(t,r)}class c3 extends st{constructor({body:e,cause:n,details:i,headers:s,status:r,url:o}){super("HTTP request failed.",{cause:n,details:i,metaMessages:[r&&`Status: ${r}`,`URL: ${JD(o)}`,e&&`Request body: ${Eo(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=s,this.status=r,this.url=o}}class iO extends st{constructor({body:e,error:n,url:i}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${JD(i)}`,`Request body: ${Eo(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=i}}class Mj extends st{constructor({body:e,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${JD(n)}`,`Request body: ${Eo(e)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const K1e=-1;class rc extends st{constructor(e,{code:n,docsPath:i,metaMessages:s,name:r,shortMessage:o}){super(o,{cause:e,docsPath:i,metaMessages:s||(e==null?void 0:e.metaMessages),name:r||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r||e.name,this.code=e instanceof iO?e.code:n??K1e}}let Gc=class extends rc{constructor(e,n){super(e,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}};class F3 extends rc{constructor(e){super(e,{code:F3.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(F3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class j3 extends rc{constructor(e){super(e,{code:j3.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(j3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class V3 extends rc{constructor(e,{method:n}={}){super(e,{code:V3.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(V3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class W3 extends rc{constructor(e){super(e,{code:W3.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` 111`)})}}Object.defineProperty(W3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class vg extends rc{constructor(e){super(e,{code:vg.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(vg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class vp extends rc{constructor(e){super(e,{code:vp.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` 112`)})}}Object.defineProperty(vp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class q3 extends rc{constructor(e){super(e,{code:q3.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(q3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class lp extends rc{constructor(e){super(e,{code:lp.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(lp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class X2 extends rc{constructor(e){super(e,{code:X2.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(X2,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Bm extends rc{constructor(e,{method:n}={}){super(e,{code:Bm.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Bm,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class J2 extends rc{constructor(e){super(e,{code:J2.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(J2,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class z3 extends rc{constructor(e){super(e,{code:z3.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(z3,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let Dr=class nJ extends Gc{constructor(e){super(e,{code:nJ.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(Dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class H3 extends Gc{constructor(e){super(e,{code:H3.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(H3,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class G3 extends Gc{constructor(e,{method:n}={}){super(e,{code:G3.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(G3,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class K3 extends Gc{constructor(e){super(e,{code:K3.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(K3,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Y3 extends Gc{constructor(e){super(e,{code:Y3.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Y3,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Id extends Gc{constructor(e){super(e,{code:Id.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Id,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Z3 extends Gc{constructor(e){super(e,{code:Z3.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(Z3,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Q3 extends Gc{constructor(e){super(e,{code:Q3.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Q3,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class X3 extends Gc{constructor(e){super(e,{code:X3.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(X3,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class J3 extends Gc{constructor(e){super(e,{code:J3.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(J3,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class e5 extends Gc{constructor(e){super(e,{code:e5.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(e5,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class t5 extends Gc{constructor(e){super(e,{code:t5.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(t5,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
112);class n5 extends Gc{constructor(e){super(e,{code:n5.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(n5,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Y1e extends rc{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Z1e=3;function Cg(t,{abi:e,address:n,args:i,docsPath:s,functionName:r,sender:o}){const a=t instanceof $8?t:t instanceof st?t.walk(b=>"data"in b)||t.walk():{},{code:c,data:l,details:d,message:h,shortMessage:p}=a,g=t instanceof p6?new F1e({functionName:r}):[Z1e,vg.code].includes(c)&&(l||d||h||p)||c===vp.code&&d==="execution reverted"&&l?new uR({abi:e,data:typeof l=="object"?l.data:l,functionName:r,message:a instanceof iO?d:p??h}):t;return new eO(g,{abi:e,args:i,contractAddress:n,docsPath:s,functionName:r,sender:o})}const Q1e="modulepreload",X1e=function(t){return"/"+t},Lj={},Lt=function(e,n,i){let s=Promise.resolve();if(n&&n.length>0){let o=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(n.map(l=>{if(l=X1e(l),l in Lj)return;Lj[l]=!0;const d=l.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${h}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":Q1e,d||(p.as="script"),p.crossOrigin="",p.href=l,c&&p.setAttribute("nonce",c),document.head.appendChild(p),d)return new Promise((g,b)=>{p.addEventListener("load",g),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const sO=BigInt(0),hR=BigInt(1);function C6(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function rO(t){if(!C6(t))throw new Error("Uint8Array expected")}function i5(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function HC(t){const e=t.toString(16);return e.length&1?"0"+e:e}function iJ(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?sO:BigInt("0x"+t)}const sJ=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",J1e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function s5(t){if(rO(t),sJ)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=J1e[t[n]];return e}const xh={_0:48,_9:57,A:65,F:70,a:97,f:102};function $j(t){if(t>=xh._0&&t<=xh._9)return t-xh._0;if(t>=xh.A&&t<=xh.F)return t-(xh.A-10);if(t>=xh.a&&t<=xh.f)return t-(xh.a-10)}function jE(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(sJ)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(n);for(let s=0,r=0;s<n;s++,r+=2){const o=$j(t.charCodeAt(r)),a=$j(t.charCodeAt(r+1));if(o===void 0||a===void 0){const c=t[r]+t[r+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+r)}i[s]=o*16+a}return i}function dg(t){return iJ(s5(t))}function rJ(t){return rO(t),iJ(s5(Uint8Array.from(t).reverse()))}function x6(t,e){return jE(t.toString(16).padStart(e*2,"0"))}function oJ(t,e){return x6(t,e).reverse()}function wl(t,e,n){let i;if(typeof e=="string")try{i=jE(e)}catch(r){throw new Error(t+" must be hex string or Uint8Array, cause: "+r)}else if(C6(e))i=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=i.length;if(typeof n=="number"&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return i}function VE(...t){let e=0;for(let i=0;i<t.length;i++){const s=t[i];rO(s),e+=s.length}const n=new Uint8Array(e);for(let i=0,s=0;i<t.length;i++){const r=t[i];n.set(r,s),s+=r.length}return n}const yT=t=>typeof t=="bigint"&&sO<=t;function oO(t,e,n){return yT(t)&&yT(e)&&yT(n)&&e<=t&&t<n}function g2(t,e,n,i){if(!oO(e,n,i))throw new Error("expected valid "+t+": "+n+" <= n < "+i+", got "+e)}function eye(t){let e;for(e=0;t>sO;t>>=hR,e+=1);return e}const B8=t=>(hR<<BigInt(t))-hR,bT=t=>new Uint8Array(t),Uj=t=>Uint8Array.from(t);function tye(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let i=bT(t),s=bT(t),r=0;const o=()=>{i.fill(1),s.fill(0),r=0},a=(...h)=>n(s,i,...h),c=(h=bT(0))=>{s=a(Uj([0]),h),i=a(),h.length!==0&&(s=a(Uj([1]),h),i=a())},l=()=>{if(r++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const p=[];for(;h<e;){i=a();const g=i.slice();p.push(g),h+=i.length}return VE(...p)};
112return(h,p)=>{o(),c(h);let g;for(;!(g=p(l()));)c();return o(),g}}const nye={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||C6(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function F8(t,e,n={}){const i=(s,r,o)=>{const a=nye[r];if(typeof a!="function")throw new Error("invalid validator function");const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(s)+" is invalid. Expected "+r+", got "+c)};for(const[s,r]of Object.entries(e))i(s,r,!1);for(const[s,r]of Object.entries(n))i(s,r,!0);return t}function Bj(t){const e=new WeakMap;return(n,...i)=>{const s=e.get(n);if(s!==void 0)return s;const r=t(n,...i);return e.set(n,r),r}}const iye="0.1.1";function sye(){return iye}let yi=class fR extends Error{constructor(e,n={}){const i=(()=>{var c;if(n.cause instanceof fR){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof fR&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`,a=[e||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...i||s?["",i?`Details: ${i}`:void 0,s?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(` 113`);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${sye()}`}),this.cause=n.cause,this.details=i,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return aJ(this,e)}};function aJ(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?aJ(t.cause,e):e?null:t}function E6(t,e){if(e2(t)>e)throw new Cye({givenSize:e2(t),maxSize:e})}const Eh={zero:48,nine:57,A:65,F:70,a:97,f:102};function Fj(t){if(t>=Eh.zero&&t<=Eh.nine)return t-Eh.zero;if(t>=Eh.A&&t<=Eh.F)return t-(Eh.A-10);if(t>=Eh.a&&t<=Eh.f)return t-(Eh.a-10)}function rye(t,e={}){const{dir:n,size:i=32}=e;if(i===0)return t;if(t.length>i)throw new xye({size:t.length,targetSize:i,type:"Bytes"});const s=new Uint8Array(i);for(let r=0;r<i;r++){const o=n==="right";s[o?r:i-r-1]=t[o?r:t.length-r-1]}return s}function cJ(t,e={}){const{dir:n="left"}=e;let i=t,s=0;for(let r=0;r<i.length-1&&i[n==="left"?r:i.length-r-1].toString()==="0";r++)s++;return i=n==="left"?i.slice(s):i.slice(0,i.length-s),i}function j8(t,e){if(Wc(t)>e)throw new kye({givenSize:Wc(t),maxSize:e})}function oye(t,e){if(typeof e=="number"&&e>0&&e>Wc(t)-1)throw new yJ({offset:e,position:"start",size:Wc(t)})}function aye(t,e,n){if(typeof e=="number"&&typeof n=="number"&&Wc(t)!==n-e)throw new yJ({offset:n,position:"end",size:Wc(t)})}function lJ(t,e={}){const{dir:n,size:i=32}=e;if(i===0)return t;const s=t.replace("0x","");if(s.length>i*2)throw new Nye({size:Math.ceil(s.length/2),targetSize:i,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](i*2,"0")}`}const cye="#__bigint";function uJ(t,e,n){return JSON.stringify(t,(i,s)=>typeof s=="bigint"?s.toString()+cye:s,n)}const lye=new TextDecoder,uye=new TextEncoder;function dye(t){return t instanceof Uint8Array?t:typeof t=="string"?dJ(t):hye(t)}function hye(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function dJ(t,e={}){const{size:n}=e;let i=t;n&&(j8(t,n),i=Eg(t,n));let s=i.slice(2);s.length%2&&(s=`0${s}`);const r=s.length/2,o=new Uint8Array(r);for(let a=0,c=0;a<r;a++){const l=Fj(s.charCodeAt(c++)),d=Fj(s.charCodeAt(c++));if(l===void 0||d===void 0)throw new yi(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=l*16+d}return o}function fye(t,e={}){const{size:n}=e,i=uye.encode(t);return typeof n=="number"?(E6(i,n),pye(i,n)):i}function pye(t,e){return rye(t,{dir:"right",size:e})}function e2(t){return t.length}function mye(t,e,n,i={}){const{strict:s}=i;return t.slice(e,n)}function gye(t,e={}){const{size:n}=e;typeof n<"u"&&E6(t,n);const i=Mu(t,e);return pJ(i,e)}function yye(t,e={}){const{size:n}=e;let i=t;if(typeof n<"u"&&(E6(i,n),i=hJ(i)),i.length>1||i[0]>1)throw new vye(i);return!!i[0]}function sf(t,e={}){const{size:n}=e;typeof n<"u"&&E6(t,n);const i=Mu(t,e);return mJ(i,e)}function bye(t,e={}){const{size:n}=e;let i=t;return typeof n<"u"&&(E6(i,n),i=wye(i)),lye.decode(i)}function hJ(t){return cJ(t,{dir:"left"})}function wye(t){return cJ(t,{dir:"right"})}class vye extends yi{constructor(e){super(`Bytes value \`${e}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let Cye=class extends yi{constructor({givenSize:e,maxSize:n}
113){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},xye=class extends yi{constructor({size:e,targetSize:n,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const Eye=new TextEncoder,_ye=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Sye(t,e={}){const{strict:n=!1}=e;if(!t)throw new jj(t);if(typeof t!="string")throw new jj(t);if(n&&!/^0x[0-9a-fA-F]*$/.test(t))throw new Vj(t);if(!t.startsWith("0x"))throw new Vj(t)}function Ou(...t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}function Aye(t){return t instanceof Uint8Array?Mu(t):Array.isArray(t)?Mu(new Uint8Array(t)):t}function fJ(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(j8(n,e.size),xg(n,e.size)):n}function Mu(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=_ye[t[s]];const i=`0x${n}`;return typeof e.size=="number"?(j8(i,e.size),Eg(i,e.size)):i}function aa(t,e={}){const{signed:n,size:i}=e,s=BigInt(t);let r;i?n?r=(1n<<BigInt(i)*8n-1n)-1n:r=2n**(BigInt(i)*8n)-1n:typeof t=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&n?-r-1n:0;if(r&&s>r||s<o){const l=typeof t=="bigint"?"n":"";throw new gJ({max:r?`${r}${l}`:void 0,min:`${o}${l}`,signed:n,size:i,value:`${t}${l}`})}const c=`0x${(n&&s<0?(1n<<BigInt(i*8))+BigInt(s):s).toString(16)}`;return i?xg(c,i):c}function aO(t,e={}){return Mu(Eye.encode(t),e)}function xg(t,e){return lJ(t,{dir:"left",size:e})}function Eg(t,e){return lJ(t,{dir:"right",size:e})}function _d(t,e,n,i={}){const{strict:s}=i;oye(t,e);const r=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return s&&aye(r,e,n),r}function Wc(t){return Math.ceil((t.length-2)/2)}function pJ(t,e={}){const{signed:n}=e;e.size&&j8(t,e.size);const i=BigInt(t);if(!n)return i;const s=(t.length-2)/2,r=(1n<<BigInt(s)*8n)-1n,o=r>>1n;return i<=o?i:i-r-1n}function mJ(t,e={}){const{signed:n,size:i}=e;return Number(!n&&!i?t:pJ(t,e))}function Tye(t,e={}){const{strict:n=!1}=e;try{return Sye(t,{strict:n}),!0}catch{return!1}}let gJ=class extends yi{constructor({max:e,min:n,signed:i,size:s,value:r}){super(`Number \`${r}\` is not in safe${s?` ${s*8}-bit`:""}${i?" signed":" unsigned"} integer range ${e?`(\`${n}\` to \`${e}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},jj=class extends yi{constructor(e){super(`Value \`${typeof e=="object"?uJ(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},Vj=class extends yi{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},kye=class extends yi{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},yJ=class extends yi{constructor({offset:e,position:n,size:i}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${i}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},Nye=class extends yi{constructor({size:e,targetSize:n,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};function Rye(t){return{address:t.address,amount:aa(t.amount),index:aa(t.index),validatorIndex:aa(t.validatorIndex)}}function bJ(t){return{...typeof t.baseFeePerGas=="bigint"&&{baseFeePerGas:aa(t.baseFeePerGas)},...typeof t.blobBaseFee=="bigint"&&{blobBaseFee:aa(t.blobBaseFee)},...typeof t.feeRecipient=="string"&&{feeRecipient:t.feeRecipient}
113,...typeof t.gasLimit=="bigint"&&{gasLimit:aa(t.gasLimit)},...typeof t.number=="bigint"&&{number:aa(t.number)},...typeof t.prevRandao=="bigint"&&{prevRandao:aa(t.prevRandao)},...typeof t.time=="bigint"&&{time:aa(t.time)},...t.withdrawals&&{withdrawals:t.withdrawals.map(Rye)}}}const Pye="0x82ad56cb",wJ="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Iye="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Dye="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b8152
11360206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848
113603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",cO="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9
113150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033",wT="/docs/contract/encodeDeployData";function lO(t){const{abi:e,args:n,bytecode:i}=t;if(!n||n.length===0)return i;const s=e.find(o=>"type"in o&&o.type==="constructor");if(!s)throw new dme({docsPath:wT});if(!("inputs"in s))throw new pj({docsPath:wT});if(!s.inputs||s.inputs.length===0)throw new pj({docsPath:wT});const r=f1(s.inputs,n);return Ob([i,r])}class Fm extends st{constructor({cause:e,message:n}={}){var s;const i=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${i?`with reason: ${i}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Fm,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Fm,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class WE extends st{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Za(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(WE,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class pR extends st{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Za(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(pR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class mR extends st{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(mR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class gR extends st{constructor({cause:e,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` 114`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(gR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class yR extends st{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(yR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class bR extends st{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` 115`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(bR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class wR extends st{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(wR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class vR extends st{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(vR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class CR extends st{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(CR,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class qE extends st{constructor({cause:e,maxPriorityFeePerGas:n,maxFeePerGas:i}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Za(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${i?` = ${Za(i)} gwei`:""}).`].join(` 116`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(qE,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class _6 extends st{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function V8(t,e){const n=(t.details||"").toLowerCase(),i=t instanceof st?t.walk(s=>(s==null?void 0:s.code)===Fm.code):t;return i instanceof st?new Fm({cause:t,message:i.details}):Fm.nodeMessage.test(n)?new Fm({cause:t,message:t.details}):WE.nodeMessage.test(n)?new WE({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):pR.nodeMessage.test(n)?new pR({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):mR.nodeMessage.test(n)?new mR({cause:t,nonce:e==null?void 0:e.nonce}):gR.nodeMessage.test(n)?new gR({cause:t,nonce:e==null?void 0:e.nonce}):yR.nodeMessage.test(n)?new yR({cause:t,nonce:e==null?void 0:e.nonce}):bR.nodeMessage.test(n)?new bR({cause:t}):wR.nodeMessage.test(n)?new wR({cause:t,gas:e==null?void 0:e.gas}):vR.nodeMessage.test(n)?new vR({cause:t,gas:e==null?void 0:e.gas}):CR.nodeMessage.test(n)?new CR({cause:t}):qE.nodeMessage.test(n)?new qE({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new _6({cause:t})}function vJ(t,{docsPath:e,...n}){const i=(()=>{const s=V8(t,n);return s instanceof _6?t:s})();return new eJ(i,{docsPath:e,...n})}function S6(t,{format:e}){if(!e)return{};const n={};function i(r){const o=Object.keys(r);for(const a of o)a in t&&(n[a]=t[a]),r[a]&&typeof r[a]=="object"&&!Array.isArray(r[a])&&i(r[a])}const s=e(t||{});return i(s),n}const Oye={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function $b(t,e){const n={};return typeof t.authorizationList<"u"&&(n.authorizationList=Mye(t.authorizationList)),typeof t.accessList<"u"&&(n.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(n.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="str
116ing"?n.blobs=t.blobs.map(i=>Fr(i)):n.blobs=t.blobs),typeof t.data<"u"&&(n.data=t.data),t.account&&(n.from=t.account.address),typeof t.from<"u"&&(n.from=t.from),typeof t.gas<"u"&&(n.gas=cn(t.gas)),typeof t.gasPrice<"u"&&(n.gasPrice=cn(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=cn(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(n.maxFeePerGas=cn(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=cn(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(n.nonce=cn(t.nonce)),typeof t.to<"u"&&(n.to=t.to),typeof t.type<"u"&&(n.type=Oye[t.type]),typeof t.value<"u"&&(n.value=cn(t.value)),n}function Mye(t){return t.map(e=>({address:e.address,r:e.r?cn(BigInt(e.r)):e.r,s:e.s?cn(BigInt(e.s)):e.s,chainId:cn(e.chainId),nonce:cn(e.nonce),...typeof e.yParity<"u"?{yParity:cn(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:cn(e.v)}:{}}))}function CJ(){let t=()=>{},e=()=>{};return{promise:new Promise((i,s)=>{t=i,e=s}),resolve:t,reject:e}}const vT=new Map;function xJ({fn:t,id:e,shouldSplitBatch:n,wait:i=0,sort:s}){const r=async()=>{const d=c();o();const h=d.map(({args:p})=>p);h.length!==0&&t(h).then(p=>{s&&Array.isArray(p)&&p.sort(s);for(let g=0;g<d.length;g++){const{resolve:b}=d[g];b==null||b([p[g],p])}}).catch(p=>{for(let g=0;g<d.length;g++){const{reject:b}=d[g];b==null||b(p)}})},o=()=>vT.delete(e),a=()=>c().map(({args:d})=>d),c=()=>vT.get(e)||[],l=d=>vT.set(e,[...c(),d]);return{flush:o,async schedule(d){const{promise:h,resolve:p,reject:g}=CJ();return(n==null?void 0:n([...a(),d]))&&r(),c().length>0?(l({args:d,resolve:p,reject:g}),h):(l({args:d,resolve:p,reject:g}),setTimeout(r,i),h)}}}function Wj(t){if(!(!t||t.length===0))return t.reduce((e,{slot:n,value:i})=>{if(n.length!==66)throw new yj({size:n.length,targetSize:66,type:"hex"});if(i.length!==66)throw new yj({size:i.length,targetSize:66,type:"hex"});return e[n]=i,e},{})}function Lye(t){const{balance:e,nonce:n,state:i,stateDiff:s,code:r}=t,o={};if(r!==void 0&&(o.code=r),e!==void 0&&(o.balance=cn(e)),n!==void 0&&(o.nonce=cn(n)),i!==void 0&&(o.state=Wj(i)),s!==void 0){if(o.state)throw new D1e;o.stateDiff=Wj(s)}return o}function uO(t){if(!t)return;const e={};for(const{address:n,...i}of t){if(!Ja(n,{strict:!1}))throw new yp({address:n});if(e[n])throw new I1e({address:n});e[n]=Lye(i)}return e}const xR=2n**256n-1n;function g1(t){const{account:e,maxFeePerGas:n,maxPriorityFeePerGas:i,to:s}=t,r=e?_o(e):void 0;if(r&&!Ja(r.address))throw new yp({address:r.address});if(s&&!Ja(s))throw new yp({address:s});if(n&&n>xR)throw new WE({maxFeePerGas:n});if(i&&n&&i>n)throw new qE({maxFeePerGas:n,maxPriorityFeePerGas:i})}async function A6(t,e){var I,S,v,_;const{account:n=t.account,authorizationList:i,batch:s=!!((I=t.batch)!=null&&I.multicall),blockNumber:r,blockTag:o=t.experimental_blockTag??"latest",accessList:a,blobs:c,blockOverrides:l,code:d,data:h,factory:p,factoryData:g,gas:b,gasPrice:w,maxFeePerBlobGas:C,maxFeePerGas:E,maxPriorityFeePerGas:T,nonce:A,to:k,value:R,stateOverride:P,...B}=e,F=n?_o(n):void 0;if(d&&(p||g))throw new st("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(d&&k)throw new st("Cannot provide both `code` & `to` as parameters.");const z=d&&h,K=p&&g&&k&&h,q=z||K,G=z?EJ({code:d,data:h}):K?Bye({data:h,factory:p,factoryData:g,to:k}):h;try{g1(e);const $=(typeof r=="bigint"?cn(r):void 0)||o,U=l?bJ(l):void 0,j=uO(P),D=(_=(v=(S=t.chain)==null?void 0:S.formatters)==null?void 0:v.transactionRequest)==null?void 0:_.format,H=(D||$b)({...S6(B,{format:D}),accessList:a,account:F,authorizationList:i,blobs:c,data:G,gas:b,gasPrice:w,maxFeePerBlobGas:C,maxFeePerGas:E,maxPriorityFeePerGas:T,nonce:A,to:q?void 0:k,value:R},"call");if(s&&$ye({request:H})&&!j&&!U)try{return await Uye(t,{...H,blockNumber:r,blockTag:o})}catch(Z){if(!(Z instanceof KX)&&!(Z instanceof lR))throw Z}const J=(()=>{const Z=[H,$];return j&&U?[...Z,j,U]:j?[...Z,j]:U?[...Z,{},U]:Z})(),W=await t.request({method:"eth_call",params:J});return W==="0x"?{data:void 0}:{data:W}}catch(N){const $=Fye(N),{offchainLookup:U,offchainLookupSignature:j}=await Lt(async()=>{const{offchainLookup:D,offchainLookupSignature:O}=await import("./index-CKlc53wm.js").then(H=>H.c);return{offchainLookup:D,offchainLookupSignature:O}},[]);if(t.ccipRead!==!1&&($==null?void 0:$.slice(0,10))===j&&k)return{data:await U(t,{data:$,to:k})};throw q&&($==null?void 0:$.slice(0,10))==="0x101bb98d"?new j1e({factory:p}):vJ(N,{...e,account:F,chain:t.chain})}}function $ye({request:t}){const{data:e,to:n,...i}=t;return!(!e||e.startsWith(Pye)||!n||Object.values(i).filter(s=>typeof s<"u").length>0)}async function Uye(t,e){var w;const{batchSize:n=1024,deployless:i=!1,wait:s=0}=typeof((w=t.batch)==null?void 0:w.multicall)=="object"?t.batch.multicall:{},{blockNumber:r,blockTag:o=t.experimental_blockTag??"latest",data:a,to:c}=e,l=(()=>
116{if(i)return null;if(e.multicallAddress)return e.multicallAddress;if(t.chain)return Lb({blockNumber:r,chain:t.chain,contract:"multicall3"});throw new KX})(),h=(typeof r=="bigint"?cn(r):void 0)||o,{schedule:p}=xJ({id:`${t.uid}.${h}`,wait:s,shouldSplitBatch(C){return C.reduce((T,{data:A})=>T+(A.length-2),0)>n*2},fn:async C=>{const E=C.map(k=>({allowFailure:!0,callData:k.data,target:k.to})),T=_i({abi:BE,args:[E],functionName:"aggregate3"}),A=await t.request({method:"eth_call",params:[{...l===null?{data:EJ({code:cO,data:T})}:{to:l,data:T}},h]});return m1({abi:BE,args:[E],functionName:"aggregate3",data:A||"0x"})}}),[{returnData:g,success:b}]=await p({data:a,to:c});if(!b)throw new $8({data:g});return g==="0x"?{data:void 0}:{data:g}}function EJ(t){const{code:e,data:n}=t;return lO({abi:zX(["constructor(bytes, bytes)"]),bytecode:wJ,args:[e,n]})}function Bye(t){const{data:e,factory:n,factoryData:i,to:s}=t;return lO({abi:zX(["constructor(address, bytes, address, bytes)"]),bytecode:Iye,args:[s,e,n,i]})}function Fye(t){var n;if(!(t instanceof st))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(n=e.data)==null?void 0:n.data:e.data}async function Rl(t,e){const{abi:n,address:i,args:s,functionName:r,...o}=e,a=_i({abi:n,args:s,functionName:r});try{const{data:c}=await sn(t,A6,"call")({...o,data:a,to:i});return m1({abi:n,args:s,functionName:r,data:c||"0x"})}catch(c){throw Cg(c,{abi:n,address:i,args:s,docsPath:"/docs/contract/readContract",functionName:r})}}async function jye(t,e){const{blockNumber:n,blockTag:i,coinType:s,name:r,gatewayUrls:o,strict:a}=e,{chain:c}=t,l=(()=>{if(e.universalResolverAddress)return e.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Lb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),d=c==null?void 0:c.ensTlds;if(d&&!d.some(p=>r.endsWith(p)))return null;const h=s!=null?[dR(r),BigInt(s)]:[dR(r)];try{const p=_i({abi:hj,functionName:"addr",args:h}),g={address:l,abi:cX,functionName:"resolveWithGateways",args:[Iu(nO(r)),p,o??[U8]],blockNumber:n,blockTag:i},w=await sn(t,Rl,"readContract")(g);if(w[0]==="0x")return null;const C=m1({abi:hj,args:h,functionName:"addr",data:w[0]});return C==="0x"||tf(C)==="0x00"?null:C}catch(p){if(a)throw p;if(tO(p))return null;throw p}}class Vye extends st{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`],name:"EnsAvatarInvalidMetadataError"})}}class Ev extends st{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class dO extends st{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Wye extends st{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const qye=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,zye=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,Hye=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Gye=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Kye(t){try{const e=await fetch(t,{method:"HEAD"});if(e.status===200){const n=e.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const i=new Image;i.onload=()=>{n(!0)},i.onerror=()=>{n(!1)},i.src=t})}}function qj(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function _J({uri:t,gatewayUrls:e}){const n=Hye.test(t);if(n)return{uri:t,isOnChain:!0,isEncoded:n};const i=qj(e==null?void 0:e.ipfs,"https://ipfs.io"),s=qj(e==null?void 0:e.arweave,"https://arweave.net"),r=t.match(qye),{protocol:o,subpath:a,target:c,subtarget:l=""}=(r==null?void 0:r.groups)||{},d=o==="ipns:/"||a==="ipns/",h=o==="ipfs:/"||a==="ipfs/"||zye.test(t);if(t.startsWith("http")&&!d&&!h){let g=t;return e!=null&&e.arweave&&(g=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:g,isOnChain:!1,isEncoded:!1}}if((d||h)&&c)return{uri:`${i}/${d?"ipns":"ipfs"}/${c}${l}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${s}/${c}${l||""}`,isOnChain:!1,isEncoded:!1};let p=t.replace(Gye,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new dO({uri:t})}function SJ(t){if(typeof t!="object"||!("image"in t)&&!("image_url"in t)&&!("image_data"in t))throw new Vye({data:t});return t.image||t.image_url||t.image_data}async function Yye({gatewayUrls:t,uri:e}){try{const n=await fetch(e).then(s=>s.json());return await hO({gatewayUrls:t,uri:SJ(n)})}catch{throw new dO({uri:e})}}async function hO({gatewayUrls:t,uri:e}){const{uri:n,isOnChain:i}=_J({uri:e,gatewayUrls:t});if(i||await Kye(n))return n;throw new dO({uri:e})}function Zye(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[n,i,s]=e.split("/"),[r,o]=n.split(":"),[a,c]=i.split(":");if(!r||r.toLowerCase()!=="eip155")throw new Ev({reason:"Only EIP-155 supported"});if(!o)throw new Ev({reason:"Chain ID not found"});if(!c)throw new Ev({reason:"Contract address not found"});if(!s)throw new Ev({reason:"Token ID not found"});if(!a)throw new Ev({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:s}}async function Qye(t,{nft:e}){if(e.namespace==="erc721")return Rl(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}
116],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return Rl(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new Wye({namespace:e.namespace})}async function Xye(t,{gatewayUrls:e,record:n}){return/eip155:/i.test(n)?Jye(t,{gatewayUrls:e,record:n}):hO({uri:n,gatewayUrls:e})}async function Jye(t,{gatewayUrls:e,record:n}){const i=Zye(n),s=await Qye(t,{nft:i}),{uri:r,isOnChain:o,isEncoded:a}=_J({uri:s,gatewayUrls:e});if(o&&(r.includes("data:application/json;base64,")||r.startsWith("{"))){const l=a?atob(r.replace("data:application/json;base64,","")):r,d=JSON.parse(l);return hO({uri:SJ(d),gatewayUrls:e})}let c=i.tokenID;return i.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),Yye({gatewayUrls:e,uri:r.replace(/(?:0x)?{id}/,c)})}async function AJ(t,e){const{blockNumber:n,blockTag:i,key:s,name:r,gatewayUrls:o,strict:a}=e,{chain:c}=t,l=(()=>{if(e.universalResolverAddress)return e.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Lb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),d=c==null?void 0:c.ensTlds;if(d&&!d.some(h=>r.endsWith(h)))return null;try{const h={address:l,abi:cX,args:[Iu(nO(r)),_i({abi:dj,functionName:"text",args:[dR(r),s]}),o??[U8]],functionName:"resolveWithGateways",blockNumber:n,blockTag:i},g=await sn(t,Rl,"readContract")(h);if(g[0]==="0x")return null;const b=m1({abi:dj,functionName:"text",data:g[0]});return b===""?null:b}catch(h){if(a)throw h;if(tO(h))return null;throw h}}async function e2e(t,{blockNumber:e,blockTag:n,assetGatewayUrls:i,name:s,gatewayUrls:r,strict:o,universalResolverAddress:a}){const c=await sn(t,AJ,"getEnsText")({blockNumber:e,blockTag:n,key:"avatar",name:s,universalResolverAddress:a,gatewayUrls:r,strict:o});if(!c)return null;try{return await Xye(t,{record:c,gatewayUrls:i})}catch{return null}}async function t2e(t,e){const{address:n,blockNumber:i,blockTag:s,coinType:r=60n,gatewayUrls:o,strict:a}=e,{chain:c}=t,l=(()=>{if(e.universalResolverAddress)return e.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Lb({blockNumber:i,chain:c,contract:"ensUniversalResolver"})})();try{const d={address:l,abi:lme,args:[n,r,o??[U8]],functionName:"reverseWithGateways",blockNumber:i,blockTag:s},h=sn(t,Rl,"readContract"),[p]=await h(d);return p||null}catch(d){if(a)throw d;if(tO(d))return null;throw d}}async function n2e(t,e){const{blockNumber:n,blockTag:i,name:s}=e,{chain:r}=t,o=(()=>
116{if(e.universalResolverAddress)return e.universalResolverAddress;if(!r)throw new Error("client chain not configured. universalResolverAddress is required.");return Lb({blockNumber:n,chain:r,contract:"ensUniversalResolver"})})(),a=r==null?void 0:r.ensTlds;if(a&&!a.some(l=>s.endsWith(l)))throw new Error(`${s} is not a valid ENS TLD (${a==null?void 0:a.join(", ")}) for chain "${r.name}" (id: ${r.id}).`);const[c]=await sn(t,Rl,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Iu(nO(s))],blockNumber:n,blockTag:i});return c}async function TJ(t,e){var C,E,T;const{account:n=t.account,blockNumber:i,blockTag:s="latest",blobs:r,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:d,maxPriorityFeePerGas:h,to:p,value:g,...b}=e,w=n?_o(n):void 0;try{g1(e);const k=(typeof i=="bigint"?cn(i):void 0)||s,R=(T=(E=(C=t.chain)==null?void 0:C.formatters)==null?void 0:E.transactionRequest)==null?void 0:T.format,B=(R||$b)({...S6(b,{format:R}),account:w,blobs:r,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:d,maxPriorityFeePerGas:h,to:p,value:g},"createAccessList"),F=await t.request({method:"eth_createAccessList",params:[B,k]});return{accessList:F.accessList,gasUsed:BigInt(F.gasUsed)}}catch(A){throw vJ(A,{...e,account:w,chain:t.chain})}}function W8(t,{method:e}){var i,s;const n={};return t.transport.type==="fallback"&&((s=(i=t.transport).onResponse)==null||s.call(i,({method:r,response:o,status:a,transport:c})=>{a==="success"&&e===r&&(n[o]=c.request)})),(r=>n[r]||t.request)}async function i2e(t){const e=W8(t,{method:"eth_newBlockFilter"}),n=await t.request({method:"eth_newBlockFilter"});return{id:n,request:e(n),type:"block"}}class s2e extends st{constructor(e){super(`Filter type "${e}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const zj="/docs/contract/encodeEventTopics";function T6(t){var c;const{abi:e,eventName:n,args:i}=t;let s=e[0];if(n){const l=p1({abi:e,name:n});if(!l)throw new gj(n,{docsPath:zj});s=l}if(s.type!=="event")throw new gj(void 0,{docsPath:zj});const r=Pu(s),o=L8(r);let a=[];if(i&&"inputs"in s){const l=(c=s.inputs)==null?void 0:c.filter(h=>"indexed"in h&&h.indexed),d=Array.isArray(i)?i:Object.values(i).length>0?(l==null?void 0:l.map(h=>i[h.name]))??[]:[];d.length>0&&(a=(l==null?void 0:l.map((h,p)=>Array.isArray(d[p])?d[p].map((g,b)=>Hj({param:h,value:d[p][b]})):typeof d[p]<"u"&&d[p]!==null?Hj({param:h,value:d[p]}):null))??[])}return[o,...a]}function Hj({param:t,value:e}){if(t.type==="string"||t.type==="bytes")return xo(Db(e));if(t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/))throw new s2e(t.type);return f1([t],[e])}async function kJ(t,e){const{address:n,abi:i,args:s,eventName:r,fromBlock:o,strict:a,toBlock:c}=e,l=W8(t,{method:"eth_newFilter"}),d=r?T6({abi:i,args:s,eventName:r}):void 0,h=await t.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?cn(o):o,toBlock:typeof c=="bigint"?cn(c):c,topics:d}]});return{abi:i,args:s,eventName:r,id:h,request:l(h),strict:!!a,type:"event"}}async function NJ(t,{address:e,args:n,event:i,events:s,fromBlock:r,strict:o,toBlock:a}={}){const c=s??(i?[i]:void 0),l=W8(t,{method:"eth_newFilter"});let d=[];c&&(d=[c.flatMap(g=>T6({abi:[g],eventName:g.name,args:n}))],i&&(d=d[0]));const h=await t.request({method:"eth_newFilter",params:[{address:e,fromBlock:typeof r=="bigint"?cn(r):r,toBlock:typeof a=="bigint"?cn(a):a,...d.length?{topics:d}:{}}]});return{abi:c,args:n,eventName:i?i.name:void 0,fromBlock:r,id:h,request:l(h),strict:!!o,toBlock:a,type:"event"}}async function RJ(t){const e=W8(t,{method:"eth_newPendingTransactionFilter"}),n=await t.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:e(n),type:"transaction"}}function r2e(t){const e=xo(`0x${t.substring(4)}`).substring(26);return g6(`0x${e}`)}async function o2e({hash:t,signature:e}){const n=Nd(t)?t:Iu(t),{secp256k1:i}=await Lt(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>gwe);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:l,s:d,v:h,yParity:p}=e,g=Number(p??h),b=Gj(g);return new i.Signature(Rd(l),Rd(d)).addRecoveryBit(b)}const o=Nd(e)?e:Iu(e);if(Ys(o)!==65)throw new Error("invalid signature length");const a=gf(`0x${o.slice(130)}`),c=Gj(a);return i.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Gj(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function PJ({hash:t,signature:e}){return r2e(await o2e({hash:t,signature:e}))}function a2e(t,e="hex"){const n=IJ(t),i=KD(new Uint8Array(n.length));return n.encode(i),e==="hex"?Fr(i.bytes):i.bytes}function IJ(t){return Array.isArray(t)?c2e(t.map(e=>IJ(e))):l2e(t)}function c2e(t){const e=t.reduce((s,r)=>s+r.length,0),n=DJ(e);return{length:e<=55?1+e:1+n+e,encode(s){e<=55?s.pushByte(192+e):(s.pushByte(247+n),n===1?s.pushUint8(e):n===2?s.pushUint16(e):n===3?s.pushUint24(e):s.pushUint32(e));for(const{encode:r}of t)r(s)}}}function l2e(t){const e=typeof t=="string"?Du(t):t,n=DJ(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+n+e.length,encode(s){e.length===1&&e[0]<128?s.pushBytes(e):e.length<=55?(s.pushByte(128+e.length),s.pushBytes(e)):(s.pushByte(183+n),n===1?s.pushUint8(e.length):n===2?s.pushUint16(e.length):n===3?s.pushUint24(e.length):s.pushUint32(e.length),s.pushBytes(e))}}}function DJ(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;
116if(t<2**32)return 4;throw new st("Length is too large.")}function u2e(t){const{chainId:e,nonce:n,to:i}=t,s=t.contractAddress??t.address,r=xo(Ob(["0x05",a2e([e?cn(e):"0x",s,n?cn(n):"0x"])]));return i==="bytes"?Du(r):r}async function fO(t){const{authorization:e,signature:n}=t;return PJ({hash:u2e(e),signature:n??e})}class d2e extends st{constructor(e,{account:n,docsPath:i,chain:s,data:r,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,to:h,value:p}){var b;const g=v6({from:n==null?void 0:n.address,to:h,value:typeof p<"u"&&`${w6(p)} ${((b=s==null?void 0:s.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:r,gas:o,gasPrice:typeof a<"u"&&`${Za(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Za(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Za(l)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",g].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}function h2e(t,{docsPath:e,...n}){const i=(()=>{const s=V8(t,n);return s instanceof _6?t:s})();return new d2e(i,{docsPath:e,...n})}class OJ extends st{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class pO extends st{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class f2e extends st{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Za(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class MJ extends st{constructor({blockHash:e,blockNumber:n}){let i="Block";e&&(i=`Block at hash "${e}"`),n&&(i=`Block at number "${n}"`),super(`${i} could not be found.`,{name:"BlockNotFoundError"})}}const LJ={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function mO(t,e){const n={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?gf(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?gf(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?LJ[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(n.authorizationList=p2e(t.authorizationList)),n.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function p2e(t){return t.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function $J(t,e){const n=(t.transactions??[]).map(i=>typeof i=="string"?i:mO(i));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:n,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function _u(t,{blockHash:e,blockNumber:n,blockTag:i=t.experimental_blockTag??"latest",includeTransactions:s}={}){var l,d,h;const r=s??!1,o=n!==void 0?cn(n):void 0;let a=null;if(e?a=await t.request({method:"eth_getBlockByHash",params:[e,r]},{dedupe:!0}):a=await t.request({method:"eth_getBlockByNumber",params:[o||i,r]},{dedupe:!!o}),!a)throw new MJ({blockHash:e,blockNumber:n});return(((h=(d=(l=t.chain)==null?void 0:l.formatters)==null?void 0:d.block)==null?void 0:h.format)||$J)(a,"getBlock")}async function gO(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function m2e(t,e){return UJ(t,e)}async function UJ(t,e){var r,o;const{block:n,chain:i=t.chain,request:s}=e||{};try{const a=((r=i==null?void 0:i.fees)==null?void 0:r.maxPriorityFeePerGas)??((o=i==null?void 0:i.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=n||await sn(t,_u,"getBlock")({}),d=await a({block:l,client:t,request:s});if(d===null)throw new Error;return d}if(typeof a<"u")return a;const c=await t.request({method:"eth_maxPriorityFeePerGas"});return Rd(c)}catch{const[a,c]=await Promise.all([n?Promise.resolve(n):sn(t,_u,"getBlock")({}),sn(t,gO,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new pO;const l=c-a.baseFeePerGas;return l<0n?0n:l}}async function g2e(t,e){return ER(t,e)}async function ER(t,e){var p,g;const{block:n,chain:i=t.chain,request:s,type:r="eip1559"}=e||{},o=await(async()=>{var b,w;return typeof((b=i==null?void 0:i.fees)==null?void 0:b.baseFeeMultiplier)=="function"?i.fees.baseFeeMultiplier({block:n,client:t,request:s}):((w=i==null?void 0:i.fees)==null?void 0:w.baseFeeMultiplier)??1.2})();if(o<1)throw new OJ;const c=10**(((p=o.toString().split(".")[1])==null?void 0:p.length)??0),l=b=>b*BigInt(Math.ceil(o*c))/BigInt(c),d=n||await sn(t,_u,"getBlock")({});if(typeof((g=i==null?void 0:i.fees)==null?void 0:g.estimateFeesPerGas)=="function"){const b=await i.fees.estimateFeesPerGas({block:n,client:t,multiply:l,request:s,type:r});if(b!==null)return b}if(r==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new pO;const b=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await UJ(t,{block:d,chain:i,request:s}),w=l(d.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??w+b,maxPriorityFeePerGas:b}}return{gasPrice:(s==null?void 0:s.gasPrice)??l(await sn(t,gO,"getGasPrice")({}))}}async function BJ(t,{address:e,blockTag:n="latest",blockNumber:i}){const s=await t.request({method:"eth_getTransactionCount",params:[e,typeof i=="bigint"?cn(i):n]},{dedupe:!!i});return gf(s)}function FJ(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),i=typeof t.blobs[0]=="string"?t.blobs.map(r=>Du(r)):t.blobs,s=[];for(const r of i)s.push(Uint8Array.from(e.blobToKzgCommitment(r)));return n==="bytes"?s:s.map(r=>Fr(r))}function jJ(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),i=typeof t.blobs[0]=="string"?t.blobs.map(o=>Du(o)):t.blobs,s=typeof t.commitments[0]=="string"?t.commitments.map(o=>Du(o)):t.commitments,r=[];for(let o=0;o<i.length;o++){const a=i[o],c=s[o];r.push(Uint8Array.from(e.computeBlobKzgProof(a,c)))}return n==="bytes"?r:r.map(o=>Fr(o))}function y2e(t,e,n,i){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,i);const s=BigInt(32),r=BigInt(4294967295),o=Number(n>>s&r),a=Number(n&r),c=i?4:0,l=i?0:4;t.setUint32(e+c,o,i),t.setUint32(e+l,a,i)}function b2e(t,e,n){return t&e^~t&n}function w2e(t,e,n){return t&e^t&n^e&n}class VJ extends zD{constructor(e,n,i,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=i,this.isLE=s,this.buffer=new Uint8Array(e),this.view=uT(this.buffer)}update(e){Z2(this),e=D8(e),bp(e);const{view:n,buffer:i,blockLen:s}=this,r=e.length;for(let o=0;o<r;){const a=Math.min(s-this.pos,r-o);if(a===s){const c=uT(e);for(;s<=r-o;o+=s)this.process(c,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Z2(this),EX(e,this),this.finished=!0;const{buffer:n,view:i,blockLen:s,isLE:r}=this;let{pos:o}=this;n[o++]=128,wp(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(i,0),o=0);for(let h=o;h<s;h++)n[h]=0;y2e(i,s-8,BigInt(this.length*8),r),this.process(i,0);const a=uT(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)a.setUint32(4*h,d[h],r)}
vendor: 3,551 bytes, line 116
116digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const i=e.slice(0,n);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:i,length:s,finished:r,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=r,e.length=s,e.pos=a,s%n&&e.buffer.set(i),e}clone(){return this._cloneInto()}}const g0=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Io=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Do=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),v2e=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),y0=new Uint32Array(64);class C2e extends VJ{constructor(e=32){super(64,e,8,!1),this.A=g0[0]|0,this.B=g0[1]|0,this.C=g0[2]|0,this.D=g0[3]|0,this.E=g0[4]|0,this.F=g0[5]|0,this.G=g0[6]|0,this.H=g0[7]|0}get(){const{A:e,B:n,C:i,D:s,E:r,F:o,G:a,H:c}=this;return[e,n,i,s,r,o,a,c]}set(e,n,i,s,r,o,a,c){this.A=e|0,this.B=n|0,this.C=i|0,this.D=s|0,this.E=r|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,n){for(let h=0;h<16;h++,n+=4)y0[h]=e.getUint32(n,!1);for(let h=16;h<64;h++){const p=y0[h-15],g=y0[h-2],b=sd(p,7)^sd(p,18)^p>>>3,w=sd(g,17)^sd(g,19)^g>>>10;y0[h]=w+y0[h-7]+b+y0[h-16]|0}let{A:i,B:s,C:r,D:o,E:a,F:c,G:l,H:d}=this;for(let h=0;h<64;h++){const p=sd(a,6)^sd(a,11)^sd(a,25),g=d+p+b2e(a,c,l)+v2e[h]+y0[h]|0,w=(sd(i,2)^sd(i,13)^sd(i,22))+w2e(i,s,r)|0;d=l,l=c,c=a,a=o+g|0,o=r,r=s,s=i,i=g+w|0}i=i+this.A|0,s=s+this.B|0,r=r+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(i,s,r,o,a,c,l,d)}roundClean(){wp(y0)}destroy(){this.set(0,0,0,0,0,0,0,0),wp(this.buffer)}}const WJ=xX(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
1165771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),x2e=WJ[0],E2e=WJ[1],b0=new Uint32Array(80),w0=new Uint32Array(80);class qJ extends VJ{constructor(e=64){super(128,e,16,!1),this.Ah=Do[0]|0,this.Al=Do[1]|0,this.Bh=Do[2]|0,this.Bl=Do[3]|0,this.Ch=Do[4]|0,this.Cl=Do[5]|0,this.Dh=Do[6]|0,this.Dl=Do[7]|0,this.Eh=Do[8]|0,this.El=Do[9]|0,this.Fh=Do[10]|0,this.Fl=Do[11]|0,this.Gh=Do[12]|0,this.Gl=Do[13]|0,this.Hh=Do[14]|0,this.Hl=Do[15]|0}get(){const{Ah:e,Al:n,Bh:i,Bl:s,Ch:r,Cl:o,Dh:a,Dl:c,Eh:l,El:d,Fh:h,Fl:p,Gh:g,Gl:b,Hh:w,Hl:C}=this;return[e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C]}set(e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C){this.Ah=e|0,this.Al=n|0,this.Bh=i|0,this.Bl=s|0,this.Ch=r|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=d|0,this.Fh=h|0,this.Fl=p|0,this.Gh=g|0,this.Gl=b|0,this.Hh=w|0,this.Hl=C|0}process(e,n){for(let A=0;A<16;A++,n+=4)b0[A]=e.getUint32(n),w0[A]=e.getUint32(n+=4);for(let A=16;A<80;A++){const k=b0[A-15]|0,R=w0[A-15]|0,P=Ey(k,R,1)^Ey(k,R,8)^vj(k,R,7),B=_y(k,R,1)^_y(k,R,8)^Cj(k,R,7),F=b0[A-2]|0,z=w0[A-2]|0,K=Ey(F,z,19)^qC(F,z,61)^vj(F,z,6),q=_y(F,z,19)^zC(F,z,61)^Cj(F,z,6),G=Fme(B,q,w0[A-7],w0[A-16]),I=jme(G,P,K,b0[A-7],b0[A-16]);b0[A]=I|0,w0[A]=G|0}let{Ah:i,Al:s,Bh:r,Bl:o,Ch:a,Cl:c,Dh:l,Dl:d,Eh:h,El:p,Fh:g,Fl:b,Gh:w,Gl:C,Hh:E,Hl:T}=this;for(let A=0;A<80;A++){const k=Ey(h,p,14)^Ey(h,p,18)^qC(h,p,41),R=_y(h,p,14)^_y(h,p,18)^zC(h,p,41),P=h&g^~h&w,B=p&b^~p&C,F=Vme(T,R,B,E2e[A],w0[A]),z=Wme(F,E,k,P,x2e[A],b0[A]),K=F|0,q=Ey(i,s,28)^qC(i,s,34)^qC(i,s,39),G=_y(i,s,28)^zC(i,s,34)^zC(i,s,39),I=i&r^i&a^r&a,S=s&o^s&c^o&c;E=w|0,T=C|0,w=g|0,C=b|0,g=h|0,b=p|0,{h,l:p}=vh(l|0,d|0,z|0,K|0),l=a|0,d=c|0,a=r|0,c=o|0,r=i|0,o=s|0;const v=Ume(K,G,S);i=Bme(v,z,q,I),s=v|0}({h:i,l:s}=vh(this.Ah|0,this.Al|0,i|0,s|0)),{h:r,l:o}=vh(this.Bh|0,this.Bl|0,r|0,o|0),{h:a,l:c}=vh(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:d}=vh(this.Dh|0,this.Dl|0,l|0,d|0),{h,l:p}=vh(this.Eh|0,this.El|0,h|0,p|0),{h:g,l:b}=vh(this.Fh|0,this.Fl|0,g|0,b|0),{h:w,l:C}=vh(this.Gh|0,this.Gl|0,w|0,C|0),{h:E,l:T}=vh(this.Hh|0,this.Hl|0,E|0,T|0),this.set(i,s,r,o,a,c,l,d,h,p,g,b,w,C,E,T)}roundClean(){wp(b0,w0)}destroy(){wp(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class _2e extends qJ{constructor(){super(48),this.Ah=Io[0]|0,this.Al=Io[1]|0,this.Bh=Io[2]|0,this.Bl=Io[3]|0,this.Ch=Io[4]|0,this.Cl=Io[5]|0,this.Dh=Io[6]|0,this.Dl=Io[7]|0,this.Eh=Io[8]|0,this.El=Io[9]|0,this.Fh=Io[10]|0,this.Fl=Io[11]|0,this.Gh=Io[12]|0,this.Gl=Io[13]|0,this.Hh=Io[14]|0,this.Hl=Io[15]|0}}const zJ=O8(()=>new C2e),pet=O8(()=>new qJ),met=O8(()=>new _2e),S2e=zJ;function A2e(t,e){return S2e(Nd(t,{strict:!1})?Db(t):t)}function T2e(t){const{commitment:e,version:n=1}=t,i=t.to??(typeof e=="string"?"hex":"bytes"),s=A2e(e);return s.set([n],0),i==="bytes"?s:Fr(s)}function k2e(t){const{commitments:e,version:n}=t,i=t.to,s=[];for(const r of e)s.push(T2e({commitment:r,to:i,version:n}));return s}const Kj=6,HJ=32,yO=4096,GJ=HJ*yO,Yj=GJ*Kj-1-1*yO*Kj;class N2e extends st{constructor({maxSize:e,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class R2e extends st{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function P2e(t){const e=typeof t.data=="string"?Du(t.data):t.data,n=Ys(e);if(!n)throw new R2e;if(n>Yj)throw new N2e({maxSize:Yj,size:n});const i=[];let s=!0,r=0;for(;s;){const o=KD(new Uint8Array(GJ));let a=0;for(;a<yO;){const c=e.slice(r,r+(HJ-1));if(o.pushByte(0),o.pushBytes(c),c.length<31){o.pushByte(128),s=!1;break}a++,r+=31}i.push(o)}return i.map(o=>Fr(o.bytes))}function I2e(t){const{data:e,kzg:n,to:i}=t,s=t.blobs??P2e({data:e}),r=t.commitments??FJ({blobs:s,kzg:n,to:i}),o=t.proofs??jJ({blobs:s,commitments:r,kzg:n,to:i}),a=[];for(let c=0;c<s.length;c++)a.push({blob:s[c],commitment:r[c],proof:o[c]});return a}function D2e(t){if(t.type)return t.type;if(typeof t.authorizationList<"u")return"eip7702";if(typeof t.blobs<"u"||typeof t.blobVersionedHashes<"u"||typeof t.maxFeePerBlobGas<"u"||typeof t.sidecars<"u")return"eip4844";if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")return"eip1559";if(typeof t.gasPrice<"u")return typeof t.accessList<"u"?"eip2930":"legacy";throw new M1e({transaction:t})}function KJ(t,{docsPath:e,...n}){const i=(()=>{const s=V8(t,n);return s instanceof _6?t:s})();return new L1e(i,{docsPath:e,...n})}async function q8(t){const e=await t.request({method:"eth_chainId"},{dedupe:!0});return gf(e)}async function YJ(t,e){var F,z,K,q,G;const{account:n=t.account,accessList:i,authorizationList:s,chain:r=t.chain,blobVersionedHashes:o,blobs:a,data:c,gas:l,gasPrice:d,maxFeePerBlobGas:h,maxFeePerGas:p,maxPriorityFeePerGas:g,nonce:b,nonceManager:w,to:C,type:E,value:T,...A}=e,k=await(async()=>
116{if(!n||!w||typeof b<"u")return b;const I=_o(n),S=r?r.id:await sn(t,q8,"getChainId")({});return await w.consume({address:I.address,chainId:S,client:t})})();g1(e);const R=(z=(F=r==null?void 0:r.formatters)==null?void 0:F.transactionRequest)==null?void 0:z.format,B=(R||$b)({...S6(A,{format:R}),account:n?_o(n):void 0,accessList:i,authorizationList:s,blobs:a,blobVersionedHashes:o,data:c,gas:l,gasPrice:d,maxFeePerBlobGas:h,maxFeePerGas:p,maxPriorityFeePerGas:g,nonce:k,to:C,type:E,value:T},"fillTransaction");try{const I=await t.request({method:"eth_fillTransaction",params:[B]}),v=(((q=(K=r==null?void 0:r.formatters)==null?void 0:K.transaction)==null?void 0:q.format)||mO)(I.tx);delete v.blockHash,delete v.blockNumber,delete v.r,delete v.s,delete v.transactionIndex,delete v.v,delete v.yParity,v.data=v.input,v.gas&&(v.gas=e.gas??v.gas),v.gasPrice&&(v.gasPrice=e.gasPrice??v.gasPrice),v.maxFeePerBlobGas&&(v.maxFeePerBlobGas=e.maxFeePerBlobGas??v.maxFeePerBlobGas),v.maxFeePerGas&&(v.maxFeePerGas=e.maxFeePerGas??v.maxFeePerGas),v.maxPriorityFeePerGas&&(v.maxPriorityFeePerGas=e.maxPriorityFeePerGas??v.maxPriorityFeePerGas),v.nonce&&(v.nonce=e.nonce??v.nonce);const _=await(async()=>{var j,D;if(typeof((j=r==null?void 0:r.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const O=await sn(t,_u,"getBlock")({});return r.fees.baseFeeMultiplier({block:O,client:t,request:e})}return((D=r==null?void 0:r.fees)==null?void 0:D.baseFeeMultiplier)??1.2})();if(_<1)throw new OJ;const $=10**(((G=_.toString().split(".")[1])==null?void 0:G.length)??0),U=j=>j*BigInt(Math.ceil(_*$))/BigInt($);return v.maxFeePerGas&&!e.maxFeePerGas&&(v.maxFeePerGas=U(v.maxFeePerGas)),v.gasPrice&&!e.gasPrice&&(v.gasPrice=U(v.gasPrice)),{raw:I.raw,transaction:{from:B.from,...v}}}catch(I){throw KJ(I,{...e,chain:t.chain})}}const ZJ=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Zj=new Map,CT=new m6(128);async function z8(t,e){var k,R,P;let n=e;const{account:i=t.account,chain:s=t.chain,nonceManager:r,parameters:o=ZJ}=n,a=(()=>{if(typeof(s==null?void 0:s.prepareTransactionRequest)=="function")return{fn:s.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(s==null?void 0:s.prepareTransactionRequest))return{fn:s.prepareTransactionRequest[0],runAt:s.prepareTransactionRequest[1].runAt}})();let c;async function l(){return c||(typeof n.chainId<"u"?n.chainId:s?s.id:(c=await sn(t,q8,"getChainId")({}),c))}const d=i&&_o(i);let h=n.nonce;if(o.includes("nonce")&&typeof h>"u"&&d&&r){const B=await l();h=await r.consume({address:d.address,chainId:B,client:t})}a!=null&&a.fn&&((k=a.runAt)!=null&&k.includes("beforeFillTransaction"))&&(n=await a.fn(n,{phase:"beforeFillTransaction"}),h??(h=n.nonce));const g=((o.includes("blobVersionedHashes")||o.includes("sidecars"))&&n.kzg&&n.blobs||CT.get(t.uid)===!1||!["fees","gas"].some(F=>o.includes(F))?!1:!!(o.includes("chainId")&&typeof n.chainId!="number"||o.includes("nonce")&&typeof h!="number"||o.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||o.includes("gas")&&typeof n.gas!="bigint"))?await sn(t,YJ,"fillTransaction")({...n,nonce:h}).then(B=>{const{chainId:F,from:z,gas:K,gasPrice:q,nonce:G,maxFeePerBlobGas:I,maxFeePerGas:S,maxPriorityFeePerGas:v,type:_,...N}=B.transaction;return CT.set(t.uid,!0),{...n,...z?{from:z}:{},..._?{type:_}:{},...typeof F<"u"?{chainId:F}:{},...typeof K<"u"?{gas:K}:{},...typeof q<"u"?{gasPrice:q}:{},...typeof G<"u"?{nonce:G}:{},...typeof I<"u"?{maxFeePerBlobGas:I}:{},...typeof S<"u"?{maxFeePerGas:S}:{},...typeof v<"u"?{maxPriorityFeePerGas:v}:{},..."nonceKey"in N&&typeof N.nonceKey<"u"?{nonceKey:N.nonceKey}:{}}}).catch(B=>{var K;const F=B;return((K=F.walk)==null?void 0:K.call(F,q=>{const G=q;return G.name==="MethodNotFoundRpcError"||G.name==="MethodNotSupportedRpcError"}))&&CT.set(t.uid,!1),n}):n;h??(h=g.nonce),n={...g,...d?{from:d==null?void 0:d.address}:{},...h?{nonce:h}:{}};const{blobs:b,gas:w,kzg:C,type:E}=n;a!=null&&a.fn&&((R=a.runAt)!=null&&R.includes("beforeFillParameters"))&&(n=await a.fn(n,{phase:"beforeFillParameters"}));let T;async function A(){return T||(T=await sn(t,_u,"getBlock")({blockTag:"latest"}),T)}if(o.includes("nonce")&&typeof h>"u"&&d&&!r&&(n.nonce=await sn(t,BJ,"getTransactionCount")({address:d.address,blockTag:"pending"})),(o.includes("blobVersionedHashes")||o.includes("sidecars"))&&b&&C){const B=FJ({blobs:b,kzg:C});if(o.includes("blobVersionedHashes")){const F=k2e({commitments:B,to:"hex"});n.blobVersionedHashes=F}if(o.includes("sidecars")){const F=jJ({blobs:b,commitments:B,kzg:C}),z=I2e({blobs:b,commitments:B,proofs:F,to:"hex"});n.sidecars=z}}if(o.includes("chainId")&&(n.chainId=await l()),(o.includes("fees")||o.includes("type"))&&typeof E>"u")try{n.type=D2e(n)}catch{let B=Zj.get(t.uid);if(typeof B>"u"){const F=await A();B=typeof(F==null?void 0:F.baseFeePerGas)=="bigint",Zj.set(t.uid,B)}n.type=B?"eip1559":"legacy"}
116if(o.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const B=await A(),{maxFeePerGas:F,maxPriorityFeePerGas:z}=await ER(t,{block:B,chain:s,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<z)throw new f2e({maxPriorityFeePerGas:z});n.maxPriorityFeePerGas=z,n.maxFeePerGas=F}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new pO;if(typeof n.gasPrice>"u"){const B=await A(),{gasPrice:F}=await ER(t,{block:B,chain:s,request:n,type:"legacy"});n.gasPrice=F}}return o.includes("gas")&&typeof w>"u"&&(n.gas=await sn(t,H8,"estimateGas")({...n,account:d,prepare:(d==null?void 0:d.type)==="local"?[]:["blobVersionedHashes"]})),a!=null&&a.fn&&((P=a.runAt)!=null&&P.includes("afterFillParameters"))&&(n=await a.fn(n,{phase:"afterFillParameters"})),g1(n),delete n.parameters,n}async function H8(t,e){var o,a,c;const{account:n=t.account,prepare:i=!0}=e,s=n?_o(n):void 0,r=(()=>{if(Array.isArray(i))return i;if((s==null?void 0:s.type)!=="local")return["blobVersionedHashes"]})();try{const l=await(async()=>{if(e.to)return e.to;if(e.authorizationList&&e.authorizationList.length>0)return await fO({authorization:e.authorizationList[0]}).catch(()=>{throw new st("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:d,authorizationList:h,blobs:p,blobVersionedHashes:g,blockNumber:b,blockTag:w,data:C,gas:E,gasPrice:T,maxFeePerBlobGas:A,maxFeePerGas:k,maxPriorityFeePerGas:R,nonce:P,value:B,stateOverride:F,...z}=i?await z8(t,{...e,parameters:r,to:l}):e;if(E&&e.gas!==E)return E;const q=(typeof b=="bigint"?cn(b):void 0)||w,G=uO(F);g1(e);const I=(c=(a=(o=t.chain)==null?void 0:o.formatters)==null?void 0:a.transactionRequest)==null?void 0:c.format,v=(I||$b)({...S6(z,{format:I}),account:s,accessList:d,authorizationList:h,blobs:p,blobVersionedHashes:g,data:C,gasPrice:T,maxFeePerBlobGas:A,maxFeePerGas:k,maxPriorityFeePerGas:R,nonce:P,to:l,value:B},"estimateGas");return BigInt(await t.request({method:"eth_estimateGas",params:G?[v,q??t.experimental_blockTag??"latest",G]:q?[v,q]:[v]}))}catch(l){throw h2e(l,{...e,account:s,chain:t.chain})}}async function O2e(t,e){const{abi:n,address:i,args:s,functionName:r,dataSuffix:o,...a}=e,c=_i({abi:n,args:s,functionName:r});try{return await sn(t,H8,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:i,...a})}catch(l){const d=a.account?_o(a.account):void 0;throw Cg(l,{abi:n,address:i,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:r,sender:d==null?void 0:d.address})}}async function QJ(t,{address:e,blockNumber:n,blockTag:i=t.experimental_blockTag??"latest"}){const s=typeof n=="bigint"?cn(n):void 0,r=await t.request({method:"eth_getBalance",params:[e,s||i]});return BigInt(r)}async function M2e(t){const e=await t.request({method:"eth_blobBaseFee"});return BigInt(e)}const L2e=new Map,$2e=new Map;function U2e(t){const e=(s,r)=>({clear:()=>r.delete(s),get:()=>r.get(s),set:o=>r.set(s,o)}),n=e(t,L2e),i=e(t,$2e);return{clear:()=>{n.clear(),i.clear()},promise:n,response:i}}async function B2e(t,{cacheKey:e,cacheTime:n=Number.POSITIVE_INFINITY}){const i=U2e(e),s=i.response.get();if(s&&n>0&&Date.now()-s.created.getTime()<n)return s.data;let r=i.promise.get();r||(r=t(),i.promise.set(r));try{const o=await r;return i.response.set({created:new Date,data:o}),o}finally{i.promise.clear()}}const F2e=t=>`blockNumber.${t}`;async function k6(t,{cacheTime:e=t.cacheTime}={}){const n=await B2e(()=>t.request({method:"eth_blockNumber"}),{cacheKey:F2e(t.uid),cacheTime:e});return BigInt(n)}async function j2e(t,{blockHash:e,blockNumber:n,blockTag:i="latest"}={}){const s=n!==void 0?cn(n):void 0;let r;return e?r=await t.request({method:"eth_getBlockTransactionCountByHash",params:[e]},{dedupe:!0}):r=await t.request({method:"eth_getBlockTransactionCountByNumber",params:[s||i]},{dedupe:!!s}),gf(r)}async function _R(t,{address:e,blockNumber:n,blockTag:i="latest"}){const s=n!==void 0?cn(n):void 0,r=await t.request({method:"eth_getCode",params:[e,s||i]},{dedupe:!!s});if(r!=="0x")return r}function G8(t,e){if(!Ja(t,{strict:!1}))throw new yp({address:t});if(!Ja(e,{strict:!1}))throw new yp({address:e});return t.toLowerCase()===e.toLowerCase()}const Qj="/docs/contract/decodeEventLog";function bO(t){const{abi:e,data:n,strict:i,topics:s}
116=t,r=i??!0,[o,...a]=s;if(!o)throw new gme({docsPath:Qj});const c=e.find(w=>w.type==="event"&&o===L8(Pu(w)));if(!(c&&"name"in c)||c.type!=="event")throw new pX(o,{docsPath:Qj});const{name:l,inputs:d}=c,h=d==null?void 0:d.some(w=>!("name"in w&&w.name)),p=h?[]:{},g=d.map((w,C)=>[w,C]).filter(([w])=>"indexed"in w&&w.indexed);for(let w=0;w<g.length;w++){const[C,E]=g[w],T=a[w];if(!T)throw new I8({abiItem:c,param:C});p[h?E:C.name||E]=V2e({param:C,value:T})}const b=d.filter(w=>!("indexed"in w&&w.indexed));if(b.length>0){if(n&&n!=="0x")try{const w=y6(b,n);if(w)if(h)for(let C=0;C<d.length;C++)p[C]=p[C]??w.shift();else for(let C=0;C<b.length;C++)p[b[C].name]=w[C]}catch(w){if(r)throw w instanceof hX||w instanceof NX?new $3({abiItem:c,data:n,params:b,size:Ys(n)}):w}else if(r)throw new $3({abiItem:c,data:"0x",params:b,size:0})}return{eventName:l,args:Object.values(p).length>0?p:void 0}}function V2e({param:t,value:e}){return t.type==="string"||t.type==="bytes"||t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/)?e:(y6([t],e)||[])[0]}function wO(t){const{abi:e,args:n,logs:i,strict:s=!0}=t,r=(()=>{if(t.eventName)return Array.isArray(t.eventName)?t.eventName:[t.eventName]})();return i.map(o=>{var a;try{const c=e.find(d=>d.type==="event"&&o.topics[0]===L8(d));if(!c)return null;const l=bO({...o,abi:[c],strict:s});return r&&!r.includes(l.eventName)||!W2e({args:l.args,inputs:c.inputs,matchArgs:n})?null:{...l,...o}}catch(c){let l,d;if(c instanceof pX)return null;if(c instanceof $3||c instanceof I8){if(s)return null;l=c.abiItem.name,d=(a=c.abiItem.inputs)==null?void 0:a.some(h=>!("name"in h&&h.name))}return{...o,args:d?[]:{},eventName:l}}}).filter(Boolean)}function W2e(t){const{args:e,inputs:n,matchArgs:i}=t;if(!i)return!0;if(!e)return!1;function s(r,o,a){try{return r.type==="address"?G8(o,a):r.type==="string"||r.type==="bytes"?xo(Db(o))===a:o===a}catch{return!1}}return Array.isArray(e)&&Array.isArray(i)?i.every((r,o)=>{if(r==null)return!0;const a=n[o];return a?(Array.isArray(r)?r:[r]).some(l=>s(a,l,e[o])):!1}):typeof e=="object"&&!Array.isArray(e)&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).every(([r,o])=>{if(o==null)return!0;const a=n.find(l=>l.name===r);return a?(Array.isArray(o)?o:[o]).some(l=>s(a,l,e[r])):!1}):!1}function bf(t,{args:e,eventName:n}={}){return{...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,logIndex:t.logIndex?Number(t.logIndex):null,transactionHash:t.transactionHash?t.transactionHash:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,...n?{args:e,eventName:n}:{}}}async function vO(t,{address:e,blockHash:n,fromBlock:i,toBlock:s,event:r,events:o,args:a,strict:c}={}){const l=c??!1,d=o??(r?[r]:void 0);let h=[];d&&(h=[d.flatMap(w=>T6({abi:[w],eventName:w.name,args:o?void 0:a}))],r&&(h=h[0]));let p;n?p=await t.request({method:"eth_getLogs",params:[{address:e,topics:h,blockHash:n}]}):p=await t.request({method:"eth_getLogs",params:[{address:e,topics:h,fromBlock:typeof i=="bigint"?cn(i):i,toBlock:typeof s=="bigint"?cn(s):s}]});const g=p.map(b=>bf(b));return d?wO({abi:d,args:a,logs:g,strict:l}):g}async function XJ(t,e){const{abi:n,address:i,args:s,blockHash:r,eventName:o,fromBlock:a,toBlock:c,strict:l}=e,d=o?p1({abi:n,name:o}):void 0,h=d?void 0:n.filter(p=>p.type==="event");return sn(t,vO,"getLogs")({address:i,args:s,blockHash:r,event:d,events:h,fromBlock:a,toBlock:c,strict:l})}class q2e extends st{constructor({address:e}){super(`No EIP-712 domain found on contract "${e}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${e}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function z2e(t,e){const{address:n,factory:i,factoryData:s}=e;try{const[r,o,a,c,l,d,h]=await sn(t,Rl,"readContract")({abi:H2e,address:n,functionName:"eip712Domain",factory:i,factoryData:s});return{domain:{name:o,version:a,chainId:Number(c),verifyingContract:l,salt:d},extensions:h,fields:r}}catch(r){const o=r;throw o.name==="ContractFunctionExecutionError"&&o.cause.name==="ContractFunctionZeroDataError"?new q2e({address:n}):o}}const H2e=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function G2e(t){var e;return{baseFeePerGas:t.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:t.gasUsedRatio,oldestBlock:BigInt(t.oldestBlock),reward:(e=t.reward)==null?void 0:e.map(n=>n.map(i=>BigInt(i)))}}async function K2e(t,{blockCount:e,blockNumber:n,blockTag:i="latest",rewardPercentiles:s}){const r=typeof n=="bigint"?cn(n):void 0,o=await t.request({method:"eth_feeHistory",params:[cn(e),r||i,s]},{dedupe:!!r});return G2e(o)}async function K8(t,{filter:e}){const n="strict"in e&&e.strict,i=await e.request({method:"eth_getFilterChanges",params:[e.id]});if(typeof i[0]=="string")return i;const s=i.map(r=>bf(r));return!("abi"in e)||!e.abi?s:wO({abi:e.abi,logs:s,strict:n})}async function Y2e(t,{filter:e}){const n=e.strict??!1,s=(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(r=>bf(r));return e.abi?wO({abi:e.abi,logs:s,strict:n}):s}async function Z2e({address:t,authorization:e,signature:n}){return G8(bd(t),await fO({authorization:e,signature:n}))}const GC=new m6(8192);function Q2e(t,{enabled:e=!0,id:n}){if(!e||!n)return t();if(GC.get(n))return GC.get(n);const i=t().finally(()=>GC.delete(n));return GC.set(n,i),i}async function zE(t){return new Promise(e=>setTimeout(e,t))}function HE(t,{delay:e=100,retryCount:n=2,shouldRetry:i=()=>!0}={}){return new Promise((s,r)=>{const o=async({count:a=0}={})=>{const c=async({error:l})=>{const d=typeof e=="function"?e({count:a,error:l}):e;d&&await zE(d),o({count:a+1})};try{const l=await t();s(l)}catch(l){if(a<n&&await i({count:a,error:l}))return c({error:l});r(l)}};o()})}function X2e(t,e={}){return async(n,i={})=>{var h;const{dedupe:s=!1,methods:r,retryDelay:o=150,retryCount:a=3,uid:c}={...e,...i},{method:l}=n;if((h=r==null?void 0:r.exclude)!=null&&h.includes(l))throw new Bm(new Error("method not supported"),{method:l});if(r!=null&&r.include&&!r.include.includes(l))throw new Bm(new Error("method not supported"),{method:l});const d=s?Y2(`${c}.${Eo(n)}`):void 0;return Q2e(()=>HE(async()=>{try{return await t(n)}catch(p){const g=p;switch(g.code){case F3.code:throw new F3(g);case j3.code:throw new j3(g);case V3.code:throw new V3(g,{method:n.method});case W3.code:throw new W3(g);case vg.code:throw new vg(g);case vp.code:throw new vp(g);case q3.code:throw new q3(g);case lp.code:throw new lp(g);case X2.code:throw new X2(g);case Bm.code:throw new Bm(g,{method:n.method});case J2.code:throw new J2(g);case z3.code:throw new z3(g);case Dr.code:throw new Dr(g);case H3.code:throw new H3(g);case G3.code:throw new G3(g);case K3.code:throw new K3(g);case Y3.code:throw new Y3(g);case Id.code:throw new Id(g);case Z3.code:throw new Z3(g);case Q3.code:throw new Q3(g);case X3.code:throw new X3(g);case J3.code:throw new J3(g);case e5.code:throw new e5(g);case t5.code:throw new t5(g);
116case n5.code:throw new n5(g);case 5e3:throw new Dr(g);default:throw p instanceof st?p:new Y1e(g)}}},{delay:({count:p,error:g})=>{var b;if(g&&g instanceof c3){const w=(b=g==null?void 0:g.headers)==null?void 0:b.get("Retry-After");if(w!=null&&w.match(/\d/))return Number.parseInt(w,10)*1e3}return~~(1<<p)*o},retryCount:a,shouldRetry:({error:p})=>J2e(p)}),{enabled:s,id:d})}}function J2e(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===J2.code||t.code===vg.code:t instanceof c3&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function ebe({chain:t,currentChainId:e}){if(!t)throw new A1e;if(e!==t.id)throw new S1e({chain:t,currentChainId:e})}function JJ(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}const tbe={"0x0":"reverted","0x1":"success"};function eee(t,e){const n={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs?t.logs.map(i=>bf(i)):null,to:t.to?t.to:null,transactionIndex:t.transactionIndex?gf(t.transactionIndex):null,status:t.status?tbe[t.status]:null,type:t.type?LJ[t.type]||t.type:null};return t.blobGasPrice&&(n.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(n.blobGasUsed=BigInt(t.blobGasUsed)),n}function tee(t,{errorInstance:e=new Error("timed out"),timeout:n,signal:i}){return new Promise((s,r)=>{(async()=>{let o;try{const a=new AbortController;n>0&&(o=setTimeout(()=>{i?a.abort():r(e)},n)),s(await t({signal:(a==null?void 0:a.signal)||null}))}catch(a){(a==null?void 0:a.name)==="AbortError"&&r(e),r(a)}finally{clearTimeout(o)}})()})}function nbe(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Xj=nbe();function ibe(t,e={}){return{async request(n){var p;const{body:i,fetchFn:s=e.fetchFn??fetch,onRequest:r=e.onRequest,onResponse:o=e.onResponse,timeout:a=e.timeout??1e4}=n,c={...e.fetchOptions??{},...n.fetchOptions??{}},{headers:l,method:d,signal:h}=c;try{const g=await tee(async({signal:w})=>{const C={...c,body:Array.isArray(i)?Eo(i.map(k=>({jsonrpc:"2.0",id:k.id??Xj.take(),...k}))):Eo({jsonrpc:"2.0",id:i.id??Xj.take(),...i}),headers:{"Content-Type":"application/json",...l},method:d||"POST",signal:h||(a>0?w:null)},E=new Request(t,C),T=await(r==null?void 0:r(E,C))??{...C,url:t};return await s(T.url??t,T)},{errorInstance:new Mj({body:i,url:t}),timeout:a,signal:!0});o&&await o(g);let b;if((p=g.headers.get("Content-Type"))!=null&&p.startsWith("application/json"))b=await g.json();else{b=await g.text();try{b=JSON.parse(b||"{}")}catch(w){if(g.ok)throw w;b={error:b}}}if(!g.ok)throw new c3({body:i,details:Eo(b.error)||g.statusText,headers:g.headers,status:g.status,url:t});return b}catch(g){throw g instanceof c3||g instanceof Mj?g:new c3({body:i,cause:g,url:t})}}}}const sbe=`�Ethereum Signed Message: 117`;function rbe(t){const e=typeof t=="string"?Y2(t):typeof t.raw=="string"?t.raw:Fr(t.raw),n=Y2(`${sbe}${Ys(e)}`);return Pd([n,e])}function nee(t,e){return xo(rbe(t),e)}class obe extends st{constructor({domain:e}){super(`Invalid domain "${Eo(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class abe extends st{constructor({primaryType:e,types:n}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class cbe extends st{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function lbe(t){const{domain:e,message:n,primaryType:i,types:s}=t,r=(o,a)=>{for(const c of o){const{name:l,type:d}=c,h=a[l],p=d.match(DX);if(p&&(typeof h=="number"||typeof h=="bigint")){const[w,C,E]=p;cn(h,{signed:C==="int",size:Number.parseInt(E,10)/8})}if(d==="address"&&typeof h=="string"&&!Ja(h))throw new yp({address:h});const g=d.match(yge);if(g){const[w,C]=g;if(C&&Ys(h)!==Number.parseInt(C,10))throw new wme({expectedSize:Number.parseInt(C,10),givenSize:Ys(h)})}const b=s[d];b&&(dbe(d),r(b,h))}};if(s.EIP712Domain&&e){if(typeof e!="object")throw new obe({domain:e});r(s.EIP712Domain,e)}if(i!=="EIP712Domain")if(s[i])r(s[i],n);else throw new abe({primaryType:i,types:s})}function ube({domain:t}
117){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},(typeof(t==null?void 0:t.chainId)=="number"||typeof(t==null?void 0:t.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function dbe(t){if(t==="address"||t==="bool"||t==="string"||t.startsWith("bytes")||t.startsWith("uint")||t.startsWith("int"))throw new cbe({type:t})}function hbe(t){const{domain:e={},message:n,primaryType:i}=t,s={EIP712Domain:ube({domain:e}),...t.types};lbe({domain:e,message:n,primaryType:i,types:s});const r=["0x1901"];return e&&r.push(fbe({domain:e,types:s})),i!=="EIP712Domain"&&r.push(iee({data:n,primaryType:i,types:s})),xo(Pd(r))}function fbe({domain:t,types:e}){return iee({data:t,primaryType:"EIP712Domain",types:e})}function iee({data:t,primaryType:e,types:n}){const i=see({data:t,primaryType:e,types:n});return xo(i)}function see({data:t,primaryType:e,types:n}){const i=[{type:"bytes32"}],s=[pbe({primaryType:e,types:n})];for(const r of n[e]){const[o,a]=oee({types:n,name:r.name,type:r.type,value:t[r.name]});i.push(o),s.push(a)}return f1(i,s)}function pbe({primaryType:t,types:e}){const n=Iu(mbe({primaryType:t,types:e}));return xo(n)}function mbe({primaryType:t,types:e}){let n="";const i=ree({primaryType:t,types:e});i.delete(t);const s=[t,...Array.from(i).sort()];for(const r of s)n+=`${r}(${e[r].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return n}function ree({primaryType:t,types:e},n=new Set){const i=t.match(/^\w*/u),s=i==null?void 0:i[0];if(n.has(s)||e[s]===void 0)return n;n.add(s);for(const r of e[s])ree({primaryType:r.type,types:e},n);return n}function oee({types:t,name:e,type:n,value:i}){if(t[n]!==void 0)return[{type:"bytes32"},xo(see({data:i,primaryType:n,types:t}))];if(n==="bytes")return[{type:"bytes32"},xo(i)];if(n==="string")return[{type:"bytes32"},xo(Iu(i))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),r=i.map(o=>oee({name:e,type:s,types:t,value:o}));return[{type:"bytes32"},xo(f1(r.map(([o])=>o),r.map(([,o])=>o)))]}return[{type:n},i]}let gbe=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const i=this.keys().next().value;i&&this.delete(i)}return this}};const ybe={checksum:new gbe(8192)},xT=ybe.checksum;function aee(t,e={}){const{as:n=typeof t=="string"?"Hex":"Bytes"}=e,i=GD(dye(t));return n==="Bytes"?i:Mu(i)}const bbe=/^0x[a-fA-F0-9]{40}$/;function Y8(t,e={}){const{strict:n=!0}=e;if(!bbe.test(t))throw new Jj({address:t,cause:new wbe});if(n){if(t.toLowerCase()===t)return;if(cee(t)!==t)throw new Jj({address:t,cause:new vbe})}}function cee(t){if(xT.has(t))return xT.get(t);Y8(t,{strict:!1});const e=t.substring(2).toLowerCase(),n=aee(fye(e),{as:"Bytes"}),i=e.split("");for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&i[r]&&(i[r]=i[r].toUpperCase()),(n[r>>1]&15)>=8&&i[r+1]&&(i[r+1]=i[r+1].toUpperCase());const s=`0x${i.join("")}`;return xT.set(t,s),s}function SR(t,e={}){const{strict:n=!0}=e??{};try{return Y8(t,{strict:n}),!0}catch{return!1}}let Jj=class extends yi{constructor({address:e,cause:n}){super(`Address "${e}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},wbe=class extends yi{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},vbe=class extends yi{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}};const Cbe=/^(.*)\[([0-9]*)\]$/,xbe=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,lee=/^(u?int)(8|
11716|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,eV=2n**256n-1n;function y2(t,e,n){const{checksumAddress:i,staticPosition:s}=n,r=EO(e.type);if(r){const[o,a]=r;return _be(t,{...e,type:a},{checksumAddress:i,length:o,staticPosition:s})}if(e.type==="tuple")return kbe(t,e,{checksumAddress:i,staticPosition:s});if(e.type==="address")return Ebe(t,{checksum:i});if(e.type==="bool")return Sbe(t);if(e.type.startsWith("bytes"))return Abe(t,e,{staticPosition:s});if(e.type.startsWith("uint")||e.type.startsWith("int"))return Tbe(t,e);if(e.type==="string")return Nbe(t,{staticPosition:s});throw new SO(e.type)}const tV=32,AR=32;function Ebe(t,e={}){const{checksum:n=!1}=e,i=t.readBytes(32);return[(r=>n?cee(r):r)(Mu(mye(i,-20))),32]}function _be(t,e,n){const{checksumAddress:i,length:s,staticPosition:r}=n;if(!s){const c=sf(t.readBytes(AR)),l=r+c,d=l+tV;t.setPosition(l);const h=sf(t.readBytes(tV)),p=r5(e);let g=0;const b=[];for(let w=0;w<h;++w){t.setPosition(d+(p?w*32:g));const[C,E]=y2(t,e,{checksumAddress:i,staticPosition:d});g+=E,b.push(C)}return t.setPosition(r+32),[b,32]}if(r5(e)){const c=sf(t.readBytes(AR)),l=r+c,d=[];for(let h=0;h<s;++h){t.setPosition(l+h*32);const[p]=y2(t,e,{checksumAddress:i,staticPosition:l});d.push(p)}return t.setPosition(r+32),[d,32]}let o=0;const a=[];for(let c=0;c<s;++c){const[l,d]=y2(t,e,{checksumAddress:i,staticPosition:r+o});o+=d,a.push(l)}return[a,o]}function Sbe(t){return[yye(t.readBytes(32),{size:32}),32]}function Abe(t,e,{staticPosition:n}){const[i,s]=e.type.split("bytes");if(!s){const o=sf(t.readBytes(32));t.setPosition(n+o);const a=sf(t.readBytes(32));if(a===0)return t.setPosition(n+32),["0x",32];const c=t.readBytes(a);return t.setPosition(n+32),[Mu(c),32]}return[Mu(t.readBytes(Number.parseInt(s,10),32)),32]}function Tbe(t,e){const n=e.type.startsWith("int"),i=Number.parseInt(e.type.split("int")[1]||"256",10),s=t.readBytes(32);return[i>48?gye(s,{signed:n}):sf(s,{signed:n}),32]}function kbe(t,e,n){const{checksumAddress:i,staticPosition:s}=n,r=e.components.length===0||e.components.some(({name:c})=>!c),o=r?[]:{};let a=0;if(r5(e)){const c=sf(t.readBytes(AR)),l=s+c;for(let d=0;d<e.components.length;++d){const h=e.components[d];t.setPosition(l+a);const[p,g]=y2(t,h,{checksumAddress:i,staticPosition:l});a+=g,o[r?d:h==null?void 0:h.name]=p}return t.setPosition(s+32),[o,32]}for(let c=0;c<e.components.length;++c){const l=e.components[c],[d,h]=y2(t,l,{checksumAddress:i,staticPosition:s});o[r?c:l==null?void 0:l.name]=d,a+=h}return[o,a]}function Nbe(t,{staticPosition:e}){const n=sf(t.readBytes(32)),i=e+n;t.setPosition(i);const s=sf(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const r=t.readBytes(s,32),o=bye(hJ(r));return t.setPosition(e+32),[o,32]}function Rbe({checksumAddress:t,parameters:e,values:n}){const i=[];for(let s=0;s<e.length;s++)i.push(CO({checksumAddress:t,parameter:e[s],value:n[s]}));return i}function CO({checksumAddress:t=!1,parameter:e,value:n}){const i=e,s=EO(i.type);if(s){const[r,o]=s;return Ibe(n,{checksumAddress:t,length:r,parameter:{...i,type:o}})}if(i.type==="tuple")return $be(n,{checksumAddress:t,parameter:i});if(i.type==="address")return Pbe(n,{checksum:t});if(i.type==="bool")return Obe(n);if(i.type.startsWith("uint")||i.type.startsWith("int")){const r=i.type.startsWith("int"),[,,o="256"]=lee.exec(i.type)??[];return Mbe(n,{signed:r,size:Number(o)})}if(i.type.startsWith("bytes"))return Dbe(n,{type:i.type});if(i.type==="string")return Lbe(n);throw new SO(i.type)}function xO(t){let e=0;for(let r=0;r<t.length;r++){const{dynamic:o,encoded:a}=t[r];o?e+=32:e+=Wc(a)}const n=[],i=[];let s=0;for(let r=0;r<t.length;r++){const{dynamic:o,encoded:a}=t[r];o?(n.push(aa(e+s,{size:32})),i.push(a),s+=Wc(a)):n.push(a)}return Ou(...n,...i)}function Pbe(t,e){const{checksum:n=!1}=e;return Y8(t,{strict:n}),{dynamic:!1,encoded:xg(t.toLowerCase())}}function Ibe(t,e){const{checksumAddress:n,length:i,parameter:s}=e,r=i===null;if(!Array.isArray(t))throw new Hbe(t);if(!r&&t.length!==i)throw new zbe({expectedLength:i,givenLength:t.length,type:`${s.type}[${i}]`});let o=!1;const a=[];for(let c=0;c<t.length;c++){const l=CO({checksumAddress:n,parameter:s,value:t[c]});l.dynamic&&(o=!0),a.push(l)}if(r||o){const c=xO(a);if(r){const l=aa(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Ou(l,c):l}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Ou(...a.map(({encoded:c})=>c))}}function Dbe(t,{type:e}){const[,n]=e.split("bytes"),i=Wc(t);if(!n){let s=t;return i%32!==0&&(s=Eg(s,Math.ceil((t.length-2)/2/32)*32)),{dynamic:!0,encoded:Ou(xg(aa(i,{size:32})),s)}}if(i!==Number.parseInt(n,10))throw new dee({expectedSize:Number.parseInt(n,10),value:t});return{dynamic:!1,encoded:Eg(t)}}function Obe(t){if(typeof t!="boolean")throw new yi(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:xg(fJ(t))}}function Mbe(t,{signed:e,size:n}){if(typeof n=="number"){const i=2n**(BigInt(n)-(e?1n:0n))-1n,s=e?-i-1n:0n;if(t>i||t<s)throw new gJ({max:i.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:aa(t,{size:32,signed:e})}}function Lbe(t){const e=aO(t),n=Math.ceil(Wc(e)/32),i=[];for(let s=0;s<n;s++)i.push(Eg(_d(e,s*32,(s+1)*32)));return{dynamic:!0,encoded:Ou(Eg(aa(Wc(e),{size:32})),...i)}}function $be(t,e){const{checksumAddress:n,parameter:i}=e;let s=!1;const r=[];for(let o=0;o<i.components.length;o++){const a=i.components[o],c=Array.isArray(t)?o:a.name,l=CO({checksumAddress:n,parameter:a,value:t[c]});r.push(l),l.dynamic&&(s=!0)}return{dynamic:s,encoded:s?xO(r):Ou(...r.map(({encoded:o})=>o))}}function EO(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}function r5(t){var i;const{type:e}=t;if(e==="string"||e==="bytes"||e.endsWith("[]"))return!0;
117if(e==="tuple")return(i=t.components)==null?void 0:i.some(r5);const n=EO(t.type);return!!(n&&r5({...t,type:n[1]}))}const Ube={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new jbe({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new Fbe({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new nV({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new nV({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const n=e??this.position;return this.assertPosition(n+t-1),this.bytes.subarray(n,n+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const n=this.inspectBytes(t);return this.position+=e??t,n},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function Bbe(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(Ube);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}class nV extends yi{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Fbe extends yi{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class jbe extends yi{constructor({count:e,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Vbe(t,e,n={}){const{as:i="Array",checksumAddress:s=!1}=n,r=typeof e=="string"?dJ(e):e,o=Bbe(r);if(e2(r)===0&&t.length>0)throw new qbe;if(e2(r)&&e2(r)<32)throw new Wbe({data:typeof e=="string"?e:Mu(e),parameters:t,size:e2(r)});let a=0;const c=i==="Array"?[]:{};for(let l=0;l<t.length;++l){const d=t[l];o.setPosition(a);const[h,p]=y2(o,d,{checksumAddress:s,staticPosition:0});a+=p,i==="Array"?c.push(h):c[d.name??l]=h}return c}function _O(t,e,n){const{checksumAddress:i=!1}={};if(t.length!==e.length)throw new hee({expectedLength:t.length,givenLength:e.length});const s=Rbe({checksumAddress:i,parameters:t,values:e}),r=xO(s);return r.length===0?"0x":r}function TR(t,e){if(t.length!==e.length)throw new hee({expectedLength:t.length,givenLength:e.length});const n=[];for(let i=0;i<t.length;i++){const s=t[i],r=e[i];n.push(TR.encode(s,r))}return Ou(...n)}(function(t){function e(n,i,s=!1){if(n==="address"){const c=i;return Y8(c),xg(c.toLowerCase(),s?32:0)}if(n==="string")return aO(i);if(n==="bytes")return i;if(n==="bool")return xg(fJ(i),s?32:1);const r=n.match(lee);if(r){const[c,l,d="256"]=r,h=Number.parseInt(d,10)/8;return aa(i,{size:s?32:h,signed:l==="int"})}const o=n.match(xbe);if(o){const[c,l]=o;if(Number.parseInt(l,10)!==(i.length-2)/2)throw new dee({expectedSize:Number.parseInt(l,10),value:i});return Eg(i,s?32:0)}const a=n.match(Cbe);
vendor: 22,784 bytes, lines 117-118
117if(a&&Array.isArray(i)){const[c,l]=a,d=[];for(let h=0;h<i.length;h++)d.push(e(l,i[h],!0));return d.length===0?"0x":Ou(...d)}throw new SO(n)}t.encode=e})(TR||(TR={}));function uee(t){return Array.isArray(t)&&typeof t[0]=="string"||typeof t=="string"?Pj(t):t}class Wbe extends yi{constructor({data:e,parameters:n,size:i}){super(`Data size of ${i} bytes is too small for given parameters.`,{metaMessages:[`Params: (${jy(n)})`,`Data: ${e} (${i} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class qbe extends yi{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class zbe extends yi{constructor({expectedLength:e,givenLength:n,type:i}){super(`Array length mismatch for type \`${i}\`. Expected: \`${e}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class dee extends yi{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${Wc(n)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class hee extends yi{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${e}`,`Given length (values): ${n}`].join(` 118`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Hbe extends yi{constructor(e){super(`Value \`${e}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class SO extends yi{constructor(e){super(`Type \`${e}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}class fee extends zD{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,zme(e);const i=D8(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,r=new Uint8Array(s);r.set(i.length>s?e.create().update(i).digest():i);for(let o=0;o<r.length;o++)r[o]^=54;this.iHash.update(r),this.oHash=e.create();for(let o=0;o<r.length;o++)r[o]^=106;this.oHash.update(r),wp(r)}update(e){return Z2(this),this.iHash.update(e),this}digestInto(e){Z2(this),bp(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:i,finished:s,destroyed:r,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=r,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const pee=(t,e,n)=>new fee(t,e).update(n).digest();pee.create=(t,e)=>new fee(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ka=BigInt(0),ua=BigInt(1),jm=BigInt(2),Gbe=BigInt(3),mee=BigInt(4),gee=BigInt(5),yee=BigInt(8);function Va(t,e){const n=t%e;return n>=Ka?n:e+n}function ul(t,e,n){let i=t;for(;e-- >Ka;)i*=i,i%=n;return i}function kR(t,e){if(t===Ka)throw new Error("invert: expected non-zero number");if(e<=Ka)throw new Error("invert: expected positive modulus, got "+e);let n=Va(t,e),i=e,s=Ka,r=ua;for(;n!==Ka;){const a=i/n,c=i%n,l=s-r*a;i=n,n=c,s=r,r=l}if(i!==ua)throw new Error("invert: does not exist");return Va(s,e)}function bee(t,e){const n=(t.ORDER+ua)/mee,i=t.pow(e,n);if(!t.eql(t.sqr(i),e))throw new Error("Cannot find square root");return i}function Kbe(t,e){const n=(t.ORDER-gee)/yee,i=t.mul(e,jm),s=t.pow(i,n),r=t.mul(e,s),o=t.mul(t.mul(r,jm),s),a=t.mul(r,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function Ybe(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let e=t-ua,n=0;for(;e%jm===Ka;)e/=jm,n++;let i=jm;const s=AO(t);for(;iV(s,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return bee;let r=s.pow(i,e);const o=(e+ua)/jm;return function(c,l){if(c.is0(l))return l;if(iV(c,l)!==1)throw new Error("Cannot find square root");let d=n,h=c.mul(c.ONE,r),p=c.pow(l,e),g=c.pow(l,o);for(;!c.eql(p,c.ONE);){if(c.is0(p))return c.ZERO;let b=1,w=c.sqr(p);for(;!c.eql(w,c.ONE);)if(b++,w=c.sqr(w),b===d)throw new Error("Cannot find square root");const C=ua<<BigInt(d-b-1),E=c.pow(h,C);d=b,h=c.sqr(E),p=c.mul(p,h),g=c.mul(g,E)}return g}}function Zbe(t){return t%mee===Gbe?bee:t%yee===gee?Kbe:Ybe(t)}const Qbe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Xbe(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Qbe.reduce((i,s)=>(i[s]="function",i),e);return F8(t,n)}function Jbe(t,e,n){if(n<Ka)throw new Error("invalid exponent, negatives unsupported");if(n===Ka)return t.ONE;if(n===ua)return e;let i=t.ONE,s=e;for(;n>Ka;)n&ua&&(i=t.mul(i,s)),s=t.sqr(s),n>>=ua;return i}function wee(t,e,n=!1){const i=new Array(e.length).fill(n?t.ZERO:void 0),s=e.reduce((o,a,c)=>t.is0(a)?o:(i[c]=o,t.mul(o,a)),t.ONE),r=t.inv(s);return e.reduceRight((o,a,c)=>t.is0(a)?o:(i[c]=t.mul(o,i[c]),t.mul(o,a)),r),i}function iV(t,e){const n=(t.ORDER-ua)/jm,i=t.pow(e,n),s=t.eql(i,t.ONE),r=t.eql(i,t.ZERO),o=t.eql(i,t.neg(t.ONE));if(!s&&!r&&!o)throw new Error("invalid Legendre symbol result");return s?1:r?0:-1}function vee(t,e){e!==void 0&&U3(e);const n=e!==void 0?e:t.toString(2).length,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}function AO(t,e,n=!1,i={}){if(t<=Ka)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:r}=vee(t,e);if(r>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:n,BITS:s,BYTES:r,MASK:B8(s),ZERO:Ka,ONE:ua,create:c=>Va(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Ka<=c&&c<t},is0:c=>c===Ka,isOdd:c=>(c&ua)===ua,neg:c=>Va(-c,t),eql:(c,l)=>c===l,sqr:c=>Va(c*c,t),add:(c,l)=>Va(c+l,t),sub:(c,l)=>Va(c-l,t),mul:(c,l)=>Va(c*l,t),pow:(c,l)=>Jbe(a,c,l),div:(c,l)=>Va(c*kR(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>kR(c,t),sqrt:i.sqrt||(c=>(o||(o=Zbe(t)),o(a,c))),toBytes:c=>n?oJ(c,r):x6(c,r),fromBytes:c=>{if(c.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+c.length);return n?rJ(c):dg(c)},invertBatch:c=>wee(a,c),cmov:(c,l,d)=>d?l:c});return Object.freeze(a)}function Cee(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function xee(t){const e=Cee(t);return e+Math.ceil(e/2)}function ewe(t,e,n=!1){const i=t.length,s=Cee(e),r=xee(e);if(i<16||i<r||i>1024)throw new Error("expected "+r+"-1024 bytes of input, got "+i);const o=n?rJ(t):dg(t),a=Va(o,e-ua)+ua;return n?oJ(a,s):x6(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const sV=BigInt(0),NR=BigInt(1);function ET(t,e){const n=e.negate();return t?n:e}function Eee(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function _T(t,e){Eee(t,e);const n=Math.ceil(e/t)+1,i=2**(t-1),s=2**t,r=B8(t),o=BigInt(t);return{windows:n,windowSize:i,mask:r,maxNumber:s,shiftBy:o}}function rV(t,e,n){const{windowSize:i,mask:s,maxNumber:r,shiftBy:o}=n;let a=Number(t&s),c=t>>o;a>i&&(a-=r,c+=NR);const l=e*i,d=l+Math.abs(a)-1,h=a===0,p=a<0,g=e%2!==0;return{nextN:c,offset:d,isZero:h,isNeg:p,isNegF:g,offsetF:l}}function twe(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,i)=>{if(!(n instanceof e))throw new Error("invalid point at index "+i)})}function nwe(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,i)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+i)})}const ST=new WeakMap,_ee=new WeakMap;function AT(t){return _ee.get(t)||1}function iwe(t,e){return{constTimeNegate:ET,hasPrecomputes(n){return AT(n)!==1},unsafeLadder(n,i,s=t.ZERO){let r=n;for(;i>sV;)i&NR&&(s=s.add(r)),r=r.double(),i>>=NR;return s},precomputeWindow(n,i){const{windows:s,windowSize:r}=_T(i,e),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let d=1;d<r;d++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,i,s){let r=t.ZERO,o=t.BASE;const a=_T(n,e);for(let c=0;c<a.windows;c++){const{nextN:l,offset:d,isZero:h,isNeg:p,isNegF:g,offsetF:b}=rV(s,c,a);s=l,h?o=o.add(ET(g,i[b])):r=r.add(ET(p,i[d]))}return{p:r,f:o}},wNAFUnsafe(n,i,s,r=t.ZERO){const o=_T(n,e);for(let a=0;a<o.windows&&s!==sV;a++){const{nextN:c,offset:l,isZero:d,isNeg:h}=rV(s,a,o);if(s=c,!d){const p=i[l];r=r.add(h?p.negate():p)}}return r},getPrecomputes(n,i,s){let r=ST.get(i);return r||(r=this.precomputeWindow(i,n),n!==1&&ST.set(i,s(r))),r},wNAFCached(n,i,s){const r=AT(n);return this.wNAF(r,this.getPrecomputes(r,n,s),i)},wNAFCachedUnsafe(n,i,s,r){const o=AT(n);return o===1?this.unsafeLadder(n,i,r):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),i,r)},setWindowSize(n,i){Eee(i,e),_ee.set(n,i),ST.delete(n)}}}function swe(t,e,n,i){twe(n,t),nwe(i,e);const s=n.length,r=i.length;if(s!==r)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=eye(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=B8(c),d=new Array(Number(l)+1).fill(o),h=Math.floor((e.BITS-1)/c)*c;let p=o;for(let g=h;g>=0;g-=c){d.fill(o);for(let w=0;w<r;w++){const C=i[w],E=Number(C>>BigInt(g)&l);d[E]=d[E].add(n[w])}let b=o;for(let w=d.length-1,C=o;w>0;w--)C=C.add(d[w]),b=b.add(C);if(p=p.add(b),g!==0)for(let w=0;w<c;w++)p=p.double()}return p}function See(t){return Xbe(t.Fp),F8(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vee(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function oV(t){t.lowS!==void 0&&i5("lowS",t.lowS),t.prehash!==void 0&&i5("prehash",t.prehash)}function rwe(t){const e=See(t);F8(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:i,a:s}=e;if(n){if(!i.eql(s,i.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}class owe extends Error{constructor(e=""){super(e)}}const jh={Err:owe,_tlv:{encode:(t,e)=>{const{Err:n}=jh;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length&1)throw new n("tlv.encode: unpadded data");const i=e.length/2,s=HC(i);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const r=i>127?HC(s.length/2|128):"";return HC(t)+r+s+e},decode(t,e){const{Err:n}=jh;let i=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[i++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[i++],r=!!(s&128);let o=0;if(!r)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=e.subarray(i,i+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(i+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=e.subarray(i,i+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:e.subarray(i+o)}}},_int:{encode(t){const{Err:e}=jh;if(t<Gh)throw new e("integer: negative integers are not allowed");let n=HC(t);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=jh;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return dg(t)}},toSig(t){const{Err:e,_int:n,_tlv:i}=jh,s=wl("signature",t),{v:r,l:o}=i.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=i.decode(2,r),{v:l,l:d}=i.decode(2,c);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(t){const{_tlv:e,_int:n}=jh,i=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s)),r=i+s;return e.encode(48,r)}};function TT(t,e){return s5(x6(t,e))}const Gh=BigInt(0),Zr=BigInt(1);BigInt(2);const kT=BigInt(3),awe=BigInt(4);function cwe(t){const e=rwe(t),{Fp:n}=e,i=AO(e.n,e.nBitLength),s=e.toBytes||((A,k,R)=>{const P=k.toAffine();return VE(Uint8Array.from([4]),n.toBytes(P.x),n.toBytes(P.y))}),r=e.fromBytes||(A=>{const k=A.subarray(1),R=n.fromBytes(k.subarray(0,n.BYTES)),P=n.fromBytes(k.subarray(n.BYTES,2*n.BYTES));return{x:R,y:P}});function o(A){const{a:k,b:R}=e,P=n.sqr(A),B=n.mul(P,A);return n.add(n.add(B,n.mul(A,k)),R)}function a(A,k){const R=n.sqr(k),P=o(A);return n.eql(R,P)}if(!a(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(e.a,kT),awe),l=n.mul(n.sqr(e.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function d(A){return oO(A,Zr,e.n)}function h(A){const{allowedPrivateKeyLengths:k,nByteLength:R,wrapPrivateKey:P,n:B}=e;if(k&&typeof A!="bigint"){if(C6(A)&&(A=s5(A)),typeof A!="string"||!k.includes(A.length))throw new Error("invalid private key");A=A.padStart(R*2,"0")}let F;try{F=typeof A=="bigint"?A:dg(wl("private key",A,R))}catch{throw new Error("invalid private key, expected hex or "+R+" bytes, got "+typeof A)}return P&&(F=Va(F,B)),g2("private key",F,Zr,B),F}function p(A){if(!(A instanceof w))throw new Error("ProjectivePoint expected")}const g=Bj((A,k)=>{const{px:R,py:P,pz:B}=A;if(n.eql(B,n.ONE))return{x:R,y:P};const F=A.is0();k==null&&(k=F?n.ONE:n.inv(B));const z=n.mul(R,k),K=n.mul(P,k),q=n.mul(B,k);if(F)return{x:n.ZERO,y:n.ZERO};if(!n.eql(q,n.ONE))throw new Error("invZ was invalid");return{x:z,y:K}}),b=Bj(A=>{if(A.is0()){if(e.allowInfinityPoint&&!n.is0(A.py))return;throw new Error("bad point: ZERO")}const{x:k,y:R}=A.toAffine();if(!n.isValid(k)||!n.isValid(R))throw new Error("bad point: x or y not FE");if(!a(k,R))throw new Error("bad point: equation left != right");if(!A.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class w{constructor(k,R,P){if(k==null||!n.isValid(k))throw new Error("x required");if(R==null||!n.isValid(R)||n.is0(R))throw new Error("y required");if(P==null||!n.isValid(P))throw new Error("z required");this.px=k,this.py=R,this.pz=P,Object.freeze(this)}static fromAffine(k){const{x:R,y:P}=k||{};if(!k||!n.isValid(R)||!n.isValid(P))throw new Error("invalid affine point");if(k instanceof w)throw new Error("projective point not allowed");const B=F=>n.eql(F,n.ZERO);return B(R)&&B(P)?w.ZERO:new w(R,P,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(k){const R=wee(n,k.map(P=>P.pz));return k.map((P,B)=>P.toAffine(R[B])).map(w.fromAffine)}static fromHex(k){const R=w.fromAffine(r(wl("pointHex",k)));return R.assertValidity(),R}static fromPrivateKey(k){return w.BASE.multiply(h(k))}static msm(k,R){return swe(w,i,k,R)}_setWindowSize(k){T.setWindowSize(this,k)}assertValidity(){b(this)}hasEvenY(){const{y:k}=this.toAffine();if(n.isOdd)return!n.isOdd(k);throw new Error("Field doesn't support isOdd")}equals(k){p(k);const{px:R,py:P,pz:B}=this,{px:F,py:z,pz:K}=k,q=n.eql(n.mul(R,K),n.mul(F,B)),G=n.eql(n.mul(P,K),n.mul(z,B));return q&&G}negate(){return new w(this.px,n.neg(this.py),this.pz)}double(){const{a:k,b:R}=e,P=n.mul(R,kT),{px:B,py:F,pz:z}=this;let K=n.ZERO,q=n.ZERO,G=n.ZERO,I=n.mul(B,B),S=n.mul(F,F),v=n.mul(z,z),_=n.mul(B,F);return _=n.add(_,_),G=n.mul(B,z),G=n.add(G,G),K=n.mul(k,G),q=n.mul(P,v),q=n.add(K,q),K=n.sub(S,q),q=n.add(S,q),q=n.mul(K,q),K=n.mul(_,K),G=n.mul(P,G),v=n.mul(k,v),_=n.sub(I,v),_=n.mul(k,_),_=n.add(_,G),G=n.add(I,I),I=n.add(G,I),I=n.add(I,v),I=n.mul(I,_),q=n.add(q,I),v=n.mul(F,z),v=n.add(v,v),I=n.mul(v,_),K=n.sub(K,I),G=n.mul(v,S),G=n.add(G,G),G=n.add(G,G),new w(K,q,G)}add(k){p(k);const{px:R,py:P,pz:B}=this,{px:F,py:z,pz:K}=k;let q=n.ZERO,G=n.ZERO,I=n.ZERO;const S=e.a,v=n.mul(e.b,kT);let _=n.mul(R,F),N=n.mul(P,z),$=n.mul(B,K),U=n.add(R,P),j=n.add(F,z);U=n.mul(U,j),j=n.add(_,N),U=n.sub(U,j),j=n.add(R,B);let D=n.add(F,K);return j=n.mul(j,D),D=n.add(_,$),j=n.sub(j,D),D=n.add(P,B),q=n.add(z,K),D=n.mul(D,q),q=n.add(N,$),D=n.sub(D,q),I=n.mul(S,j),q=n.mul(v,$),I=n.add(q,I),q=n.sub(N,I),I=n.add(N,I),G=n.mul(q,I),N=n.add(_,_),N=n.add(N,_),$=n.mul(S,$),j=n.mul(v,j),N=n.add(N,$),$=n.sub(_,$),$=n.mul(S,$),j=n.add(j,$),_=n.mul(N,j),G=n.add(G,_),_=n.mul(D,j),q=n.mul(U,q),q=n.sub(q,_),_=n.mul(U,N),I=n.mul(D,I),I=n.add(I,_),new w(q,G,I)}subtract(k){return this.add(k.negate())}is0(){return this.equals(w.ZERO)}wNAF(k){return T.wNAFCached(this,k,w.normalizeZ)}multiplyUnsafe(k){const{endo:R,n:P}=e;g2("scalar",k,Gh,P);const B=w.ZERO;if(k===Gh)return B;if(this.is0()||k===Zr)return this;if(!R||T.hasPrecomputes(this))return T.wNAFCachedUnsafe(this,k,w.normalizeZ);let{k1neg:F,k1:z,k2neg:K,k2:q}=R.splitScalar(k),G=B,I=B,S=this;for(;z>Gh||q>Gh;)z&Zr&&(G=G.add(S)),q&Zr&&(I=I.add(S)),S=S.double(),z>>=Zr,q>>=Zr;return F&&(G=G.negate()),K&&(I=I.negate()),I=new w(n.mul(I.px,R.beta),I.py,I.pz),G.add(I)}multiply(k){const{endo:R,n:P}=e;g2("scalar",k,Zr,P);let B,F;if(R){const{k1neg:z,k1:K,k2neg:q,k2:G}=R.splitScalar(k);let{p:I,f:S}=this.wNAF(K),{p:v,f:_}=this.wNAF(G);I=T.constTimeNegate(z,I),v=T.constTimeNegate(q,v),v=new w(n.mul(v.px,R.beta),v.py,v.pz),B=I.add(v),F=S.add(_)}else{const{p:z,f:K}=this.wNAF(k);B=z,F=K}return w.normalizeZ([B,F])[0]}multiplyAndAddUnsafe(k,R,P){const B=w.BASE,F=(K,q)=>q===Gh||q===Zr||!K.equals(B)?K.multiplyUnsafe(q):K.multiply(q),z=F(this,R).add(F(k,P));return z.is0()?void 0:z}toAffine(k){return g(this,k)}isTorsionFree(){const{h:k,isTorsionFree:R}=e;if(k===Zr)return!0;if(R)return R(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:k,clearCofactor:R}=e;return k===Zr?this:R?R(w,this):this.multiplyUnsafe(e.h)}toRawBytes(k=!0){return i5("isCompressed",k),this.assertValidity(),s(w,this,k)}toHex(k=!0){return i5("isCompressed",k),s5(this.toRawBytes(k))}}w.BASE=new w(e.Gx,e.Gy,n.ONE),w.ZERO=new w(n.ZERO,n.ONE,n.ZERO);const{endo:C,nBitLength:E}=e,T=iwe(w,C?Math.ceil(E/2):E);return{CURVE:e,ProjectivePoint:w,normPrivateKeyToScalar:h,weierstrassEquation:o,isWithinCurveOrder:d}}function lwe(t){const e=See(t);return F8(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function uwe(t){const e=lwe(t),{Fp:n,n:i,nByteLength:s,nBitLength:r}=e,o=n.BYTES+1,a=2*n.BYTES+1;function c(v){return Va(v,i)}function l(v){return kR(v,i)}const{ProjectivePoint:d,normPrivateKeyToScalar:h,weierstrassEquation:p,isWithinCurveOrder:g}=cwe({...e,toBytes(v,_,N){const $=_.toAffine(),U=n.toBytes($.x),j=VE;return i5("isCompressed",N),N?j(Uint8Array.from([_.hasEvenY()?2:3]),U):j(Uint8Array.from([4]),U,n.toBytes($.y))},fromBytes(v){const _=v.length,N=v[0],$=v.subarray(1);if(_===o&&(N===2||N===3)){const U=dg($);if(!oO(U,Zr,n.ORDER))throw new Error("Point is not on curve");const j=p(U);let D;try{D=n.sqrt(j)}catch(J){const W=J instanceof Error?": "+J.message:"";throw new Error("Point is not on curve"+W)}const O=(D&Zr)===Zr;return(N&1)===1!==O&&(D=n.neg(D)),{x:U,y:D}}else if(_===a&&N===4){const U=n.fromBytes($.subarray(0,n.BYTES)),j=n.fromBytes($.subarray(n.BYTES,2*n.BYTES));return{x:U,y:j}}else{const U=o,j=a;throw new Error("invalid Point, expected length of "+U+", or uncompressed "+j+", got "+_)}}});function b(v){const _=i>>Zr;return v>_}function w(v){return b(v)?c(-v):v}const C=(v,_,N)=>dg(v.slice(_,N));class E{constructor(_,N,$){g2("r",_,Zr,i),g2("s",N,Zr,i),this.r=_,this.s=N,$!=null&&(this.recovery=$),Object.freeze(this)}static fromCompact(_){const N=s;return _=wl("compactSignature",_,N*2),new E(C(_,0,N),C(_,N,2*N))}static fromDER(_){const{r:N,s:$}=jh.toSig(wl("DER",_));return new E(N,$)}assertValidity(){}addRecoveryBit(_){return new E(this.r,this.s,_)}recoverPublicKey(_){const{r:N,s:$,recovery:U}=this,j=B(wl("msgHash",_));if(U==null||![0,1,2,3].includes(U))throw new Error("recovery id invalid");const D=U===2||U===3?N+e.n:N;if(D>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const O=(U&1)===0?"02":"03",H=d.fromHex(O+TT(D,n.BYTES)),J=l(D),W=c(-j*J),Z=c($*J),Y=d.BASE.multiplyAndAddUnsafe(H,W,Z);if(!Y)throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new E(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return jE(this.toDERHex())}toDERHex(){return jh.hexFromSig(this)}toCompactRawBytes(){return jE(this.toCompactHex())}toCompactHex(){const _=s;return TT(this.r,_)+TT(this.s,_)}}const T={isValidPrivateKey(v){try{return h(v),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const v=xee(e.n);return ewe(e.randomBytes(v),e.n)},precompute(v=8,_=d.BASE){return _._setWindowSize(v),_.multiply(BigInt(3)),_}};function A(v,_=!0){return d.fromPrivateKey(v).toRawBytes(_)}function k(v){if(typeof v=="bigint")return!1;if(v instanceof d)return!0;const N=wl("key",v).length,$=n.BYTES,U=$+1,j=2*$+1;if(!(e.allowedPrivateKeyLengths||s===U))return N===U||N===j}function R(v,_,N=!0){if(k(v)===!0)throw new Error("first arg must be private key");if(k(_)===!1)throw new Error("second arg must be public key");return d.fromHex(_).multiply(h(v)).toRawBytes(N)}const P=e.bits2int||function(v){if(v.length>8192)throw new Error("input is too large");const _=dg(v),N=v.length*8-r;return N>0?_>>BigInt(N):_},B=e.bits2int_modN||function(v){return c(P(v))},F=B8(r);function z(v){return g2("num < 2^"+r,v,Gh,F),x6(v,s)}function K(v,_,N=q){if(["recovered","canonical"].some(ee=>ee in N))throw new Error("sign() legacy options not supported");const{hash:$,randomBytes:U}=e;let{lowS:j,prehash:D,extraEntropy:O}=N;j==null&&(j=!0),v=wl("msgHash",v),oV(N),D&&(v=wl("prehashed msgHash",$(v)));const H=B(v),J=h(_),W=[z(J),z(H)];if(O!=null&&O!==!1){const ee=O===!0?U(n.BYTES):O;
118W.push(wl("extraEntropy",ee))}const Z=VE(...W),Y=H;function Q(ee){const ie=P(ee);if(!g(ie))return;const re=l(ie),oe=d.BASE.multiply(ie).toAffine(),de=c(oe.x);if(de===Gh)return;const he=c(re*c(Y+de*J));if(he===Gh)return;let ue=(oe.x===de?0:2)|Number(oe.y&Zr),be=he;return j&&b(he)&&(be=w(he),ue^=1),new E(de,be,ue)}return{seed:Z,k2sig:Q}}const q={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function I(v,_,N=q){const{seed:$,k2sig:U}=K(v,_,N),j=e;return tye(j.hash.outputLen,j.nByteLength,j.hmac)($,U)}d.BASE._setWindowSize(8);function S(v,_,N,$=G){var ue;const U=v;_=wl("msgHash",_),N=wl("publicKey",N);const{lowS:j,prehash:D,format:O}=$;if(oV($),"strict"in $)throw new Error("options.strict was renamed to lowS");if(O!==void 0&&O!=="compact"&&O!=="der")throw new Error("format must be compact or der");const H=typeof U=="string"||C6(U),J=!H&&!O&&typeof U=="object"&&U!==null&&typeof U.r=="bigint"&&typeof U.s=="bigint";if(!H&&!J)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let W,Z;try{if(J&&(W=new E(U.r,U.s)),H){try{O!=="compact"&&(W=E.fromDER(U))}catch(be){if(!(be instanceof jh.Err))throw be}!W&&O!=="der"&&(W=E.fromCompact(U))}Z=d.fromHex(N)}catch{return!1}if(!W||j&&W.hasHighS())return!1;D&&(_=e.hash(_));const{r:Y,s:Q}=W,ee=B(_),ie=l(Q),re=c(ee*ie),oe=c(Y*ie),de=(ue=d.BASE.multiplyAndAddUnsafe(Z,re,oe))==null?void 0:ue.toAffine();return de?c(de.x)===Y:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:R,sign:I,verify:S,ProjectivePoint:d,Signature:E,utils:T}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function dwe(t){return{hash:t,hmac:(e,...n)=>pee(t,e,Xme(...n)),randomBytes:Jme}}function hwe(t,e){const n=i=>uwe({...t,...dwe(i)});return{...n(e),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Aee=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),aV=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),fwe=BigInt(0),pwe=BigInt(1),RR=BigInt(2),cV=(t,e)=>(t+e/RR)/e;function mwe(t){const e=Aee,n=BigInt(3),i=BigInt(6),s=BigInt(11),r=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=t*t*t%e,d=l*l*t%e,h=ul(d,n,e)*d%e,p=ul(h,n,e)*d%e,g=ul(p,RR,e)*l%e,b=ul(g,s,e)*g%e,w=ul(b,r,e)*b%e,C=ul(w,a,e)*w%e,E=ul(C,c,e)*C%e,T=ul(E,a,e)*w%e,A=ul(T,n,e)*d%e,k=ul(A,o,e)*b%e,R=ul(k,i,e)*l%e,P=ul(R,RR,e);if(!PR.eql(PR.sqr(P),t))throw new Error("Cannot find square root");return P}const PR=AO(Aee,void 0,void 0,{sqrt:mwe}),TO=hwe({a:fwe,b:BigInt(7),Fp:PR,n:aV,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=aV,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),i=-pwe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),r=n,o=BigInt("0x100000000000000000000000000000000"),a=cV(r*t,e),c=cV(-i*t,e);let l=Va(t-a*n-c*s,e),d=Va(-a*i-c*r,e);const h=l>o,p=d>o;if(h&&(l=e-l),p&&(d=e-d),l>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:h,k1:l,k2neg:p,k2:d}}}},zJ),gwe=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:TO},Symbol.toStringTag,{value:"Module"}));function Tee(t,e={}){const{recovered:n}=e;if(typeof t.r>"u")throw new NT({signature:t});if(typeof t.s>"u")throw new NT({signature:t});if(n&&typeof t.yParity>"u")throw new NT({signature:t});if(t.r<0n||t.r>eV)throw new Ewe({value:t.r});if(t.s<0n||t.s>eV)throw new _we({value:t.s});if(typeof t.yParity=="number"&&t.yParity!==0&&t.yParity!==1)throw new NO({value:t.yParity})}function ywe(t){return kee(Mu(t))}function kee(t){if(t.length!==130&&t.length!==132)throw new xwe({signature:t});const e=BigInt(_d(t,0,32)),n=BigInt(_d(t,32,64)),i=(()=>{const s=+`0x${t.slice(130)}`;if(!Number.isNaN(s))try{return kO(s)}catch{throw new NO({value:s})}})();return typeof i>"u"?{r:e,s:n}:{r:e,s:n,yParity:i}}function bwe(t){if(!(typeof t.r>"u")&&!(typeof t.s>"u"))return wwe(t)}function wwe(t){const e=typeof t=="string"?kee(t):t instanceof Uint8Array?ywe(t):typeof t.r=="string"?Cwe(t):t.v?vwe(t):{r:t.r,s:t.s,...typeof t.yParity<"u"?{yParity:t.yParity}:{}};return Tee(e),e}function vwe(t){return{r:t.r,s:t.s,yParity:kO(t.v)}}function Cwe(t){const e=(()=>{const n=t.v?Number(t.v):void 0;let i=t.yParity?Number(t.yParity):void 0;if(typeof n=="number"&&typeof i!="number"&&(i=kO(n)),typeof i!="number")throw new NO({value:t.yParity});return i})();return{r:BigInt(t.r),s:BigInt(t.s),yParity:e}}function kO(t){if(t===0||t===27)return 0;if(t===1||t===28)return 1;if(t>=35)return t%2===0?1:0;throw new Swe({value:t})}let xwe=class extends yi{constructor({signature:e}){super(`Value \`${e}
118\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Wc(Aye(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}};class NT extends yi{constructor({signature:e}){super(`Signature \`${uJ(e)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class Ewe extends yi{constructor({value:e}){super(`Value \`${e}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class _we extends yi{constructor({value:e}){super(`Value \`${e}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}let NO=class extends yi{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},Swe=class extends yi{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function Awe(t,e={}){return typeof t.chainId=="string"?Twe(t):{...t,...e.signature}}function Twe(t){const{address:e,chainId:n,nonce:i}=t,s=bwe(t);return{address:e,chainId:Number(n),nonce:BigInt(i),...s}}const kwe="0x8010801080108010801080108010801080108010801080108010801080108010",Nwe=uee("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function Nee(t){if(typeof t=="string"){if(_d(t,-32)!==kwe)throw new Iwe(t)}else Tee(t.authorization)}function Rwe(t){Nee(t);const e=mJ(_d(t,-64,-32)),n=_d(t,-e-64,-64),i=_d(t,0,-e-64),[s,r,o]=Vbe(Nwe,n);return{authorization:Awe({address:s.delegation,chainId:Number(s.chainId),nonce:s.nonce,yParity:s.yParity,r:s.r,s:s.s}),signature:i,...o&&o!=="0x"?{data:o,to:r}:{}}}function Pwe(t){try{return Nee(t),!0}catch{return!1}}let Iwe=class extends yi{constructor(e){super(`Value \`${e}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};class Dwe extends st{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function hs(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new Dwe({value:t});let[n,i="0"]=t.split(".");const s=n.startsWith("-");if(s&&(n=n.slice(1)),i=i.replace(/(0+)$/,""),e===0)Math.round(+`.${i}`)===1&&(n=`${BigInt(n)+1n}`),i="";else if(i.length>e){const[r,o,a]=[i.slice(0,e-1),i.slice(e-1,e),i.slice(e)],c=Math.round(+`${o}.${a}`);c>9?i=`${BigInt(r)+BigInt(1)}0`.padStart(r.length+1,"0"):i=`${r}${c}`,i.length>e&&(i=i.slice(1),n=`${BigInt(n)+1n}`),i=i.slice(0,e)}else i=i.padEnd(e,"0");return BigInt(`${s?"-":""}${n}${i}`)}function Owe(t,e="wei"){return hs(t,QX[e])}function Mwe(t){return t.map(e=>({...e,value:BigInt(e.value)}))}function Lwe(t){return{...t,balance:t.balance?BigInt(t.balance):void 0,nonce:t.nonce?gf(t.nonce):void 0,storageProof:t.storageProof?Mwe(t.storageProof):void 0}}async function $we(t,{address:e,blockNumber:n,blockTag:i,storageKeys:s}){const r=i??"latest",o=n!==void 0?cn(n):void 0,a=await t.request({method:"eth_getProof",params:[e,s,o||r]});return Lwe(a)}async function Uwe(t,{address:e,blockNumber:n,blockTag:i="latest",slot:s}){const r=n!==void 0?cn(n):void 0;return await t.request({method:"eth_getStorageAt",params:[e,s,r||i]})}async function Z8(t,{blockHash:e,blockNumber:n,blockTag:i,hash:s,index:r,sender:o,nonce:a}){var p,g,b;const c=i||"latest",l=n!==void 0?cn(n):void 0;let d=null;if(s?d=await t.request({method:"eth_getTransactionByHash",params:[s]},{dedupe:!0}):e?d=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,cn(r)]},{dedupe:!0}):typeof r=="number"?d=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||c,cn(r)]},{dedupe:!!l}):o&&typeof a=="number"&&(d=await t.request({method:"eth_getTransactionBySenderAndNonce",params:[o,cn(a)]},{dedupe:!0})),!d)throw new XX({blockHash:e,blockNumber:n,blockTag:c,hash:s,index:r});return(((b=(g=(p=t.chain)==null?void 0:p.formatters)==null?void 0:g.transaction)==null?void 0:b.format)||mO)(d,"getTransaction")}async function Bwe(t,{hash:e,transactionReceipt:n}){const[i,s]=await Promise.all([sn(t,k6,"getBlockNumber")({}),e?sn(t,Z8,"getTransaction")({hash:e}):void 0]),r=(n==null?void 0:n.blockNumber)||(s==null?void 0:s.blockNumber);return r?i-r+1n:0n}async function tE(t,{hash:e}){var s,r,o;const n=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!n)throw new JX({hash:e});return(((o=(r=(s=t.chain)==null?void 0:s.formatters)==null?void 0:r.transactionReceipt)==null?void 0:o.format)||eee)(n,"getTransactionReceipt")}async function Ree(t,e){var T;
118const{account:n,authorizationList:i,allowFailure:s=!0,blockNumber:r,blockOverrides:o,blockTag:a,stateOverride:c}=e,l=e.contracts,{batchSize:d=e.batchSize??1024,deployless:h=e.deployless??!1}=typeof((T=t.batch)==null?void 0:T.multicall)=="object"?t.batch.multicall:{},p=(()=>{if(e.multicallAddress)return e.multicallAddress;if(h)return null;if(t.chain)return Lb({blockNumber:r,chain:t.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),g=[[]];let b=0,w=0;for(let A=0;A<l.length;A++){const{abi:k,address:R,args:P,functionName:B}=l[A];try{const F=_i({abi:k,args:P,functionName:B});w+=(F.length-2)/2,d>0&&w>d&&g[b].length>0&&(b++,w=(F.length-2)/2,g[b]=[]),g[b]=[...g[b],{allowFailure:!0,callData:F,target:R}]}catch(F){const z=Cg(F,{abi:k,address:R,args:P,docsPath:"/docs/contract/multicall",functionName:B,sender:n});if(!s)throw z;g[b]=[...g[b],{allowFailure:!0,callData:"0x",target:R}]}}const C=await Promise.allSettled(g.map(A=>sn(t,Rl,"readContract")({...p===null?{code:cO}:{address:p},abi:BE,account:n,args:[A],authorizationList:i,blockNumber:r,blockOverrides:o,blockTag:a,functionName:"aggregate3",stateOverride:c}))),E=[];for(let A=0;A<C.length;A++){const k=C[A];if(k.status==="rejected"){if(!s)throw k.reason;for(let P=0;P<g[A].length;P++)E.push({status:"failure",error:k.reason,result:void 0});continue}const R=k.value;for(let P=0;P<R.length;P++){const{returnData:B,success:F}=R[P],{callData:z}=g[A][P],{abi:K,address:q,functionName:G,args:I}=l[E.length];try{if(z==="0x")throw new p6;if(!F)throw new $8({data:B});const S=m1({abi:K,args:I,data:B,functionName:G});E.push(s?{result:S,status:"success"}:S)}catch(S){const v=Cg(S,{abi:K,address:q,args:I,docsPath:"/docs/contract/multicall",functionName:G});if(!s)throw v;E.push({error:v,result:void 0,status:"failure"})}}}if(E.length!==l.length)throw new st("multicall results mismatch");return E}async function IR(t,e){const{blockNumber:n,blockTag:i=t.experimental_blockTag??"latest",blocks:s,returnFullTransactions:r,traceTransfers:o,validation:a}=e;try{const c=[];for(const p of s){const g=p.blockOverrides?bJ(p.blockOverrides):void 0,b=p.calls.map(C=>{const E=C,T=E.account?_o(E.account):void 0,A=E.abi?_i(E):E.data,k={...E,account:T,data:E.dataSuffix?Pd([A||"0x",E.dataSuffix]):A,from:E.from??(T==null?void 0:T.address)};return g1(k),$b(k)}),w=p.stateOverrides?uO(p.stateOverrides):void 0;c.push({blockOverrides:g,calls:b,stateOverrides:w})}const d=(typeof n=="bigint"?cn(n):void 0)||i;return(await t.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:r,traceTransfers:o,validation:a},d]})).map((p,g)=>({...$J(p),calls:p.calls.map((b,w)=>{var K,q;const{abi:C,args:E,functionName:T,to:A}=s[g].calls[w],k=((K=b.error)==null?void 0:K.data)??b.returnData,R=BigInt(b.gasUsed),P=(q=b.logs)==null?void 0:q.map(G=>bf(G)),B=b.status==="0x1"?"success":"failure",F=C&&B==="success"&&k!=="0x"?m1({abi:C,data:k,functionName:T}):null,z=(()=>{var I;if(B==="success")return;let G;if(((I=b.error)==null?void 0:I.data)==="0x"?G=new p6:b.error&&(G=new $8(b.error)),!!G)return Cg(G,{abi:C??[],address:A??"0x",args:E,functionName:T??"<unknown>"})})();return{data:k,gasUsed:R,logs:P,status:B,...B==="success"?{result:F}:{error:z}}})}))}catch(c){const l=c,d=V8(l,{});throw d instanceof _6?l:d}}function DR(t){let e=!0,n="",i=0,s="",r=!1;for(let o=0;o<t.length;o++){const a=t[o];if(["(",")",","].includes(a)&&(e=!0),a==="("&&i++,a===")"&&i--,!!e){if(i===0){if(a===" "&&["event","function","error",""].includes(s))s="";else if(s+=a,a===")"){r=!0;break}continue}if(a===" "){t[o-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=a,n+=a}}if(!r)throw new yi("Unable to normalize signature.");return s}function OR(t,e){const n=typeof t,i=e.type;switch(i){case"address":return SR(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return i==="tuple"&&"components"in e?Object.values(e.components).every((s,r)=>OR(Object.values(t)[r],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(i)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(i)?n==="str
118ing"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(i)?Array.isArray(t)&&t.every(s=>OR(s,{...e,type:i.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Pee(t,e,n){for(const i in t){const s=t[i],r=e[i];if(s.type==="tuple"&&r.type==="tuple"&&"components"in s&&"components"in r)return Pee(s.components,r.components,n[i]);const o=[s.type,r.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?SR(n[i],{strict:!1}):o.includes("address")&&o.includes("bytes")?SR(n[i],{strict:!1}):!1)return o}}function Iee(t,e={}){const{prepare:n=!0}=e,i=Array.isArray(t)||typeof t=="string"?Rj(t):t;return{...i,...n?{hash:t2(i)}:{}}}function Q8(t,e,n){const{args:i=[],prepare:s=!0}=n??{},r=Tye(e,{strict:!1}),o=t.filter(l=>r?l.type==="function"||l.type==="error"?Dee(l)===_d(e,0,4):l.type==="event"?t2(l)===e:!1:"name"in l&&l.name===e);if(o.length===0)throw new GE({name:e});if(o.length===1)return{...o[0],...s?{hash:t2(o[0])}:{}};let a;for(const l of o){if(!("inputs"in l))continue;if(!i||i.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...s?{hash:t2(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==i.length)continue;if(i.every((h,p)=>{const g="inputs"in l&&l.inputs[p];return g?OR(h,g):!1})){if(a&&"inputs"in a&&a.inputs){const h=Pee(l.inputs,a.inputs,i);if(h)throw new jwe({abiItem:l,type:h[0]},{abiItem:a,type:h[1]})}a=l}}const c=(()=>{if(a)return a;const[l,...d]=o;return{...l,overloads:d}})();if(!c)throw new GE({name:e});return{...c,...s?{hash:t2(c)}:{}}}function Dee(...t){const e=(()=>{if(Array.isArray(t[0])){const[n,i]=t;return Q8(n,i)}return t[0]})();return _d(t2(e),0,4)}function Fwe(...t){const e=(()=>{if(Array.isArray(t[0])){const[i,s]=t;return Q8(i,s)}return t[0]})(),n=typeof e=="string"?e:FE(e);return DR(n)}function t2(...t){const e=(()=>{if(Array.isArray(t[0])){const[n,i]=t;return Q8(n,i)}return t[0]})();return typeof e!="string"&&"hash"in e&&e.hash?e.hash:aee(aO(Fwe(e)))}class jwe extends yi{constructor(e,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${DR(FE(e.abiItem))}\`, and`,`\`${n.type}\` in \`${DR(FE(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class GE extends yi{constructor({name:e,data:n,type:i="item"}){const s=e?` with name "${e}"`:n?` with data "${n}"`:"";super(`ABI ${i}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function Vwe(...t){var r;const[e,n]=(()=>{if(Array.isArray(t[0])){const[o,a]=t;return[qwe(o),a]}return t})(),{bytecode:i,args:s}=n;
118return Ou(i,(r=e.inputs)!=null&&r.length&&(s!=null&&s.length)?_O(e.inputs,s):"0x")}function Wwe(t){return Iee(t)}function qwe(t){const e=t.find(n=>n.type==="constructor");if(!e)throw new GE({name:"constructor"});return e}function zwe(...t){const[e,n=[]]=(()=>{if(Array.isArray(t[0])){const[l,d,h]=t;return[lV(l,d,{args:h}),h]}const[a,c]=t;return[a,c]})(),{overloads:i}=e,s=i?lV([e,...i],e.name,{args:n}):e,r=Hwe(s),o=n.length>0?_O(s.inputs,n):void 0;return o?Ou(r,o):r}function Ay(t,e={}){return Iee(t,e)}function lV(t,e,n){const i=Q8(t,e,n);if(i.type!=="function")throw new GE({name:e,type:"function"});return i}function Hwe(t){return Dee(t)}const Gwe="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Mn="0x0000000000000000000000000000000000000000",Kwe="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function Ywe(t,e){const{blockNumber:n,blockTag:i,calls:s,stateOverrides:r,traceAssetChanges:o,traceTransfers:a,validation:c}=e,l=e.account?_o(e.account):void 0;if(o&&!l)throw new st("`account` is required when `traceAssetChanges` is true");const d=l?Vwe(Wwe("constructor(bytes, bytes)"),{bytecode:wJ,args:[Kwe,zwe(Ay("function getBalance(address)"),[l.address])]}):void 0,h=o?await Promise.all(e.calls.map(async $=>{if(!$.data&&!$.abi)return;const{accessList:U}=await TJ(t,{account:l.address,...$,data:$.abi?_i($):$.data});return U.map(({address:j,storageKeys:D})=>D.length>0?j:null)})).then($=>$.flat().filter(Boolean)):[],p=await IR(t,{blockNumber:n,blockTag:i,blocks:[...o?[{calls:[{data:d}],stateOverrides:r},{calls:h.map(($,U)=>({abi:[Ay("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:$,from:Mn,nonce:U})),stateOverrides:[{address:Mn,nonce:0}]}]:[],{calls:[...s,{}].map($=>({...$,from:l==null?void 0:l.address})),stateOverrides:r},...o?[{calls:[{data:d}]},{calls:h.map(($,U)=>({abi:[Ay("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:$,from:Mn,nonce:U})),stateOverrides:[{address:Mn,nonce:0}]},{calls:h.map(($,U)=>({to:$,abi:[Ay("function decimals() returns (uint256)")],functionName:"decimals",from:Mn,nonce:U})),stateOverrides:[{address:Mn,nonce:0}]},{calls:h.map(($,U)=>({to:$,abi:[Ay("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Mn,nonce:U})),stateOverrides:[{address:Mn,nonce:0}]},{calls:h.map(($,U)=>({to:$,abi:[Ay("function symbol() returns (string)")],functionName:"symbol",from:Mn,nonce:U})),stateOverrides:[{address:Mn,nonce:0}]}]:[]],traceTransfers:a,validation:c}),g=o?p[2]:p[0],[b,w,,C,E,T,A,k]=o?p:[],{calls:R,...P}=g,B=R.slice(0,-1)??[],F=(b==null?void 0:b.calls)??[],z=(w==null?void 0:w.calls)??[],K=[...F,...z].map($=>$.status==="success"?Rd($.data):null),q=(C==null?void 0:C.calls)??[],G=(E==null?void 0:E.calls)??[],I=[...q,...G].map($=>$.status==="success"?Rd($.data):null),S=((T==null?void 0:T.calls)??[]).map($=>$.status==="success"?$.result:null),v=((k==null?void 0:k.calls)??[]).map($=>$.status==="success"?$.result:null),_=((A==null?void 0:A.calls)??[]).map($=>$.status==="success"?$.result:null),N=[];for(const[$,U]of I.entries()){const j=K[$];if(typeof U!="bigint"||typeof j!="bigint")continue;const D=S[$-1],O=v[$-1],H=_[$-1],J=$===0?{address:Gwe,decimals:18,symbol:"ETH"}:{address:h[$-1],decimals:H||D?Number(D??1):void 0,symbol:O??void 0};N.some(W=>W.token.address===J.address)||N.push({token:J,value:{pre:j,post:U,diff:U-j}})}return{assetChanges:N,block:P,results:B}}async function Oee(t,e){const{abi:n,address:i,args:s,dataSuffix:r,functionName:o,...a}=e,c=a.account?_o(a.account):t.account,l=_i({abi:n,args:s,functionName:o});try{const{data:d}=await sn(t,A6,"call")({batch:!1,data:`${l}${r?r.replace("0x",""):""}`,to:i,...a,account:c}),h=m1({abi:n,args:s,functionName:o,data:d||"0x"}),p=n.filter(g=>"name"in g&&g.name===e.functionName);return{result:h,request:{abi:p,address:i,args:s,dataSuffix:r,functionName:o,...a,account:c}}}
118catch(d){throw Cg(d,{abi:n,address:i,args:s,docsPath:"/docs/contract/simulateContract",functionName:o,sender:c==null?void 0:c.address})}}async function X8(t,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}const Mee="0x6492649264926492649264926492649264926492649264926492649264926492";function Zwe(t){if(_d(t,-32)!==Mee)throw new Jwe(t)}function Qwe(t){const{data:e,signature:n,to:i}=t;return Ou(_O(uee("address, bytes, bytes"),[i,e,n]),Mee)}function Xwe(t){try{return Zwe(t),!0}catch{return!1}}class Jwe extends yi{constructor(e){super(`Value \`${e}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function eve({r:t,s:e,to:n="hex",v:i,yParity:s}){const r=(()=>{if(s===0||s===1)return s;if(i&&(i===27n||i===28n||i>=35n))return i%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new TO.Signature(Rd(t),Rd(e)).toCompactHex()}${r===0?"1b":"1c"}`;return n==="hex"?o:Du(o)}async function J8(t,e){var a,c,l,d,h,p;const{address:n,hash:i,erc6492VerifierAddress:s=e.universalSignatureVerifierAddress??((l=(c=(a=t.chain)==null?void 0:a.contracts)==null?void 0:c.erc6492Verifier)==null?void 0:l.address),multicallAddress:r=e.multicallAddress??((p=(h=(d=t.chain)==null?void 0:d.contracts)==null?void 0:h.multicall3)==null?void 0:p.address)}=e,o=(()=>{const g=e.signature;return Nd(g)?g:typeof g=="object"&&"r"in g&&"s"in g?eve(g):Fr(g)})();try{return Pwe(o)?await tve(t,{...e,multicallAddress:r,signature:o}):await nve(t,{...e,verifierAddress:s,signature:o})}catch(g){try{if(G8(bd(n),await PJ({hash:i,signature:o})))return!0}catch{}if(g instanceof _g)return!1;throw g}}async function tve(t,e){var C;const{address:n,blockNumber:i,blockTag:s,hash:r,multicallAddress:o}=e,{authorization:a,data:c,signature:l,to:d}=Rwe(e.signature);if(await _R(t,{address:n,blockNumber:i,blockTag:s})===Ob(["0xef0100",a.address]))return await ive(t,{address:n,blockNumber:i,blockTag:s,hash:r,signature:l});const p={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:cn(a.r,{size:32}),s:cn(a.s,{size:32}),yParity:a.yParity};if(!await Z2e({address:n,authorization:p}))throw new _g;const b=await sn(t,Rl,"readContract")({...o?{address:o}:{code:cO},authorizationList:[p],abi:BE,blockNumber:i,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:d??n,callData:c}]:[],{allowFailure:!0,target:n,callData:_i({abi:lX,functionName:"isValidSignature",args:[r,l]})}]]}),w=(C=b[b.length-1])==null?void 0:C.returnData;if(w!=null&&w.startsWith("0x1626ba7e"))return!0;throw new _g}async function nve(t,e){const{address:n,factory:i,factoryData:s,hash:r,signature:o,verifierAddress:a,...c}=e,l=await(async()=>!i&&!s||Xwe(o)?o:Qwe({data:s,signature:o,to:i}))(),d=a?{to:a,data:_i({abi:fj,functionName:"isValidSig",args:[n,r,l]}),...c}:{data:lO({abi:fj,args:[n,r,l],bytecode:Dye}),...c},{data:h}=await sn(t,A6,"call")(d).catch(p=>{throw p instanceof eJ?new _g:p});if(Tme(h??"0x0"))return!0;throw new _g}async function ive(t,e){const{address:n,blockNumber:i,blockTag:s,hash:r,signature:o}=e;if((await sn(t,Rl,"readContract")({address:n,abi:lX,args:[r,o],blockNumber:i,blockTag:s,functionName:"isValidSignature"}).catch(c=>{throw c instanceof eO?new _g:c})).startsWith("0x1626ba7e"))return!0;throw new _g}class _g extends Error{}async function sve(t,{address:e,message:n,factory:i,factoryData:s,signature:r,...o}){const a=nee(n);return sn(t,J8,"verifyHash")({address:e,factory:i,factoryData:s,hash:a,signature:r,...o})}async function rve(t,e){const{address:n,factory:i,factoryData:s,signature:r,message:o,primaryType:a,types:c,domain:l,...d}=e,h=hbe({message:o,primaryType:a,types:c,domain:l});return sn(t,J8,"verifyHash")({address:n,factory:i,factoryData:s,hash:h,signature:r,...d})}const RT=new Map,uV=new Map;let ove=0;function Cp(t,e,n){const i=++ove,s=()=>RT.get(t)||[],r=()=>{const d=s();RT.set(t,d.filter(h=>h.id!==i))},o=()=>{const d=s();if(!d.some(p=>p.id===i))return;const h=uV.get(t);if(d.length===1&&h){const p=h();p instanceof Promise&&p.catch(()=>{})}r()},a=s();if(RT.set(t,[...a,{id:i,fns:e}]),a&&a.length>0)return o;const c={};for(const d in e)c[d]=((...h)=>{var g,b;const p=s();if(p.length!==0)for(const w of p)(b=(g=w.fns)[d])==null||b.call(g,...h)});const l=n(c);return typeof l=="function"&&uV.set(t,l),o}function N6(t,{emitOnBegin:e,initialWaitTime:n,interval:i}){let s=!0;const r=()=>s=!1;return(async()=>{let a;e&&(a=await t({unpoll:r}));const c=await(n==null?void 0:n(a))??i;await zE(c);const l=async()=>{s&&(await t({unpoll:r}),await zE(i),l())};l()})(),r}function RO(t,{emitOnBegin:e=!1,emitMissed:n=!1,onBlockNumber:i,onError:s,poll:r,pollingInterval:o=t.pollingInterval}){const a=typeof r<"u"?r:!(t.transport.type==="webSocket"||t.transport.type==="ipc"||t.transport.type==="fallback"&&(t.transport.transports[0].c
118onfig.type==="webSocket"||t.transport.transports[0].config.type==="ipc"));let c;return a?(()=>{const h=Eo(["watchBlockNumber",t.uid,e,n,o]);return Cp(h,{onBlockNumber:i,onError:s},p=>N6(async()=>{var g;try{const b=await sn(t,k6,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(b===c)return;if(b-c>1&&n)for(let w=c+1n;w<b;w++)p.onBlockNumber(w,c),c=w}(c===void 0||b>c)&&(p.onBlockNumber(b,c),c=b)}catch(b){(g=p.onError)==null||g.call(p,b)}},{emitOnBegin:e,interval:o}))})():(()=>{const h=Eo(["watchBlockNumber",t.uid,e,n]);return Cp(h,{onBlockNumber:i,onError:s},p=>{let g=!0,b=()=>g=!1;return(async()=>{try{const w=(()=>{if(t.transport.type==="fallback"){const E=t.transport.transports.find(T=>T.config.type==="webSocket"||T.config.type==="ipc");return E?E.value:t.transport}return t.transport})(),{unsubscribe:C}=await w.subscribe({params:["newHeads"],onData(E){var A;if(!g)return;const T=Rd((A=E.result)==null?void 0:A.number);p.onBlockNumber(T,c),c=T},onError(E){var T;(T=p.onError)==null||T.call(p,E)}});b=C,g||b()}catch(w){s==null||s(w)}})(),()=>b()})})()}async function Lee(t,e){const{checkReplacement:n=!0,confirmations:i=1,hash:s,onReplaced:r,retryCount:o=6,retryDelay:a=({count:R})=>~~(1<<R)*200,timeout:c=18e4}=e,l=Eo(["waitForTransactionReceipt",t.uid,s]),d=(()=>{var R;return e.pollingInterval?e.pollingInterval:(R=t.chain)!=null&&R.experimental_preconfirmationTime?t.chain.experimental_preconfirmationTime:t.pollingInterval})();let h,p,g,b=!1,w,C;const{promise:E,resolve:T,reject:A}=CJ(),k=c?setTimeout(()=>{C==null||C(),w==null||w(),A(new U1e({hash:s}))},c):void 0;return w=Cp(l,{onReplaced:r,resolve:T,reject:A},async R=>{if(g=await sn(t,tE,"getTransactionReceipt")({hash:s}).catch(()=>{}),g&&i<=1){clearTimeout(k),R.resolve(g),w==null||w();return}C=sn(t,RO,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:d,async onBlockNumber(P){const B=z=>{clearTimeout(k),C==null||C(),z(),w==null||w()};let F=P;if(!b)try{if(g){if(i>1&&(!g.blockNumber||F-g.blockNumber+1n<i))return;B(()=>R.resolve(g));return}if(n&&!h&&(b=!0,await HE(async()=>{h=await sn(t,Z8,"getTransaction")({hash:s}),h.blockNumber&&(F=h.blockNumber)},{delay:a,retryCount:o}),b=!1),g=await sn(t,tE,"getTransactionReceipt")({hash:s}),i>1&&(!g.blockNumber||F-g.blockNumber+1n<i))return;B(()=>R.resolve(g))}catch(z){if(z instanceof XX||z instanceof JX){if(!h){b=!1;return}try{p=h,b=!0;const K=await HE(()=>sn(t,_u,"getBlock")({blockNumber:F,includeTransactions:!0}),{delay:a,retryCount:o,shouldRetry:({error:I})=>I instanceof MJ});b=!1;const q=K.transactions.find(({from:I,nonce:S})=>I===p.from&&S===p.nonce);if(!q||(g=await sn(t,tE,"getTransactionReceipt")({hash:q.hash}),i>1&&(!g.blockNumber||F-g.blockNumber+1n<i)))return;let G="replaced";q.to===p.to&&q.value===p.value&&q.input===p.input?G="repriced":q.from===q.to&&q.value===0n&&(G="cancelled"),B(()=>{var I;(I=R.onReplaced)==null||I.call(R,{reason:G,replacedTransaction:p,transaction:q,transactionReceipt:g}),R.resolve(g)})}catch(K){B(()=>R.reject(K))}}else B(()=>R.reject(z))}}})}),E}function ave(t,{blockTag:e=t.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:i=!1,onBlock:s,onError:r,includeTransactions:o,poll:a,pollingInterval:c=t.pollingInterval}){const l=typeof a<"u"?a:!(t.transport.type==="webSocket"||t.transport.type==="ipc"||t.transport.type==="fallback"&&(t.transport.transports[0].c
118onfig.type==="webSocket"||t.transport.transports[0].config.type==="ipc")),d=o??!1;let h;return l?(()=>{const b=Eo(["watchBlocks",t.uid,e,n,i,d,c]);return Cp(b,{onBlock:s,onError:r},w=>N6(async()=>{var C;try{const E=await sn(t,_u,"getBlock")({blockTag:e,includeTransactions:d});if(E.number!==null&&(h==null?void 0:h.number)!=null){if(E.number===h.number)return;if(E.number-h.number>1&&n)for(let T=(h==null?void 0:h.number)+1n;T<E.number;T++){const A=await sn(t,_u,"getBlock")({blockNumber:T,includeTransactions:d});w.onBlock(A,h),h=A}}((h==null?void 0:h.number)==null||e==="pending"&&(E==null?void 0:E.number)==null||E.number!==null&&E.number>h.number)&&(w.onBlock(E,h),h=E)}catch(E){(C=w.onError)==null||C.call(w,E)}},{emitOnBegin:i,interval:c}))})():(()=>{let b=!0,w=!0,C=()=>b=!1;return(async()=>{try{i&&sn(t,_u,"getBlock")({blockTag:e,includeTransactions:d}).then(A=>{b&&w&&(s(A,void 0),w=!1)}).catch(r);const E=(()=>{if(t.transport.type==="fallback"){const A=t.transport.transports.find(k=>k.config.type==="webSocket"||k.config.type==="ipc");return A?A.value:t.transport}return t.transport})(),{unsubscribe:T}=await E.subscribe({params:["newHeads"],async onData(A){var R;if(!b)return;const k=await sn(t,_u,"getBlock")({blockNumber:(R=A.result)==null?void 0:R.number,includeTransactions:d}).catch(()=>{});b&&(s(k,h),w=!1,h=k)},onError(A){r==null||r(A)}});C=T,b||C()}catch(E){r==null||r(E)}})(),()=>C()})()}function cve(t,e){const{abi:n,address:i,args:s,batch:r=!0,eventName:o,fromBlock:a,onError:c,onLogs:l,poll:d,pollingInterval:h=t.pollingInterval,strict:p}=e;return(typeof d<"u"?d:typeof a=="bigint"?!0:!(t.transport.type==="webSocket"||t.transport.type==="ipc"||t.transport.type==="fallback"&&(t.transport.transports[0].c
118onfig.type==="webSocket"||t.transport.transports[0].config.type==="ipc")))?(()=>{const C=p??!1,E=Eo(["watchContractEvent",i,s,r,t.uid,o,h,C,a]);return Cp(E,{onLogs:l,onError:c},T=>{let A;a!==void 0&&(A=a-1n);let k,R=!1;const P=N6(async()=>{var B;if(!R){try{k=await sn(t,kJ,"createContractEventFilter")({abi:n,address:i,args:s,eventName:o,strict:C,fromBlock:a})}catch{}R=!0;return}try{let F;if(k)F=await sn(t,K8,"getFilterChanges")({filter:k});else{const z=await sn(t,k6,"getBlockNumber")({});A&&A<z?F=await sn(t,XJ,"getContractEvents")({abi:n,address:i,args:s,eventName:o,fromBlock:A+1n,toBlock:z,strict:C}):F=[],A=z}if(F.length===0)return;if(r)T.onLogs(F);else for(const z of F)T.onLogs([z])}catch(F){k&&F instanceof vp&&(R=!1),(B=T.onError)==null||B.call(T,F)}},{emitOnBegin:!0,interval:h});return async()=>{k&&await sn(t,X8,"uninstallFilter")({filter:k}),P()}})})():(()=>{const C=p??!1,E=Eo(["watchContractEvent",i,s,r,t.uid,o,h,C]);let T=!0,A=()=>T=!1;return Cp(E,{onLogs:l,onError:c},k=>((async()=>{try{const R=(()=>{if(t.transport.type==="fallback"){const F=t.transport.transports.find(z=>z.config.type==="webSocket"||z.config.type==="ipc");return F?F.value:t.transport}return t.transport})(),P=o?T6({abi:n,eventName:o,args:s}):[],{unsubscribe:B}=await R.subscribe({params:["logs",{address:i,topics:P}],onData(F){var K;if(!T)return;const z=F.result;try{const{eventName:q,args:G}=bO({abi:n,data:z.data,topics:z.topics,strict:p}),I=bf(z,{args:G,eventName:q});k.onLogs([I])}catch(q){let G,I;if(q instanceof $3||q instanceof I8){if(p)return;G=q.abiItem.name,I=(K=q.abiItem.inputs)==null?void 0:K.some(v=>!("name"in v&&v.name))}const S=bf(z,{args:I?[]:{},eventName:G});k.onLogs([S])}},onError(F){var z;(z=k.onError)==null||z.call(k,F)}});A=B,T||A()}catch(R){c==null||c(R)}})(),()=>A()))})()}function lve(t,{address:e,args:n,batch:i=!0,event:s,events:r,fromBlock:o,onError:a,onLogs:c,poll:l,pollingInterval:d=t.pollingInterval,strict:h}){const p=typeof l<"u"?l:typeof o=="bigint"?!0:!(t.transport.type==="webSocket"||t.transport.type==="ipc"||t.transport.type==="fallback"&&(t.transport.transports[0].c
118onfig.type==="webSocket"||t.transport.transports[0].config.type==="ipc")),g=h??!1;return p?(()=>{const C=Eo(["watchEvent",e,n,i,t.uid,s,d,o]);return Cp(C,{onLogs:c,onError:a},E=>{let T;o!==void 0&&(T=o-1n);let A,k=!1;const R=N6(async()=>{var P;if(!k){try{A=await sn(t,NJ,"createEventFilter")({address:e,args:n,event:s,events:r,strict:g,fromBlock:o})}catch{}k=!0;return}try{let B;if(A)B=await sn(t,K8,"getFilterChanges")({filter:A});else{const F=await sn(t,k6,"getBlockNumber")({});T&&T!==F?B=await sn(t,vO,"getLogs")({address:e,args:n,event:s,events:r,fromBlock:T+1n,toBlock:F}):B=[],T=F}if(B.length===0)return;if(i)E.onLogs(B);else for(const F of B)E.onLogs([F])}catch(B){A&&B instanceof vp&&(k=!1),(P=E.onError)==null||P.call(E,B)}},{emitOnBegin:!0,interval:d});return async()=>{A&&await sn(t,X8,"uninstallFilter")({filter:A}),R()}})})():(()=>{let C=!0,E=()=>C=!1;return(async()=>{try{const T=(()=>{if(t.transport.type==="fallback"){const P=t.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return P?P.value:t.transport}return t.transport})(),A=r??(s?[s]:void 0);let k=[];A&&(k=[A.flatMap(B=>T6({abi:[B],eventName:B.name,args:n}))],s&&(k=k[0]));const{unsubscribe:R}=await T.subscribe({params:["logs",{address:e,topics:k}],onData(P){var F;if(!C)return;const B=P.result;try{const{eventName:z,args:K}=bO({abi:A??[],data:B.data,topics:B.topics,strict:g}),q=bf(B,{args:K,eventName:z});c([q])}catch(z){let K,q;if(z instanceof $3||z instanceof I8){if(h)return;K=z.abiItem.name,q=(F=z.abiItem.inputs)==null?void 0:F.some(I=>!("name"in I&&I.name))}const G=bf(B,{args:q?[]:{},eventName:K});c([G])}},onError(P){a==null||a(P)}});E=R,C||E()}catch(T){a==null||a(T)}})(),()=>E()})()}function $ee(t,{batch:e=!0,onError:n,onTransactions:i,poll:s,pollingInterval:r=t.pollingInterval}){return(typeof s<"u"?s:t.transport.type!=="webSocket"&&t.transport.type!=="ipc")?(()=>{const l=Eo(["watchPendingTransactions",t.uid,e,r]);return Cp(l,{onTransactions:i,onError:n},d=>{let h;const p=N6(async()=>{var g;try{if(!h)try{h=await sn(t,RJ,"createPendingTransactionFilter")({});return}catch(w){throw p(),w}const b=await sn(t,K8,"getFilterChanges")({filter:h});if(b.length===0)return;if(e)d.onTransactions(b);else for(const w of b)d.onTransactions([w])}catch(b){(g=d.onError)==null||g.call(d,b)}},{emitOnBegin:!0,interval:r});return async()=>{h&&await sn(t,X8,"uninstallFilter")({filter:h}),p()}})})():(()=>{let l=!0,d=()=>l=!1;return(async()=>{try{const{unsubscribe:h}=await t.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!l)return;const g=p.result;i([g])},onError(p){n==null||n(p)}});d=h,l||d()}catch(h){n==null||n(h)}})(),()=>d()})()}class PO extends st{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` 119`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class PT extends st{constructor({docsPath:e,metaMessages:n,type:i}){super(`Account type "${i}" is not supported.`,{docsPath:e,metaMessages:n,name:"AccountTypeNotSupportedError"})}}async function Uee(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const IT=new m6(128);async function Bee(t,e){var T,A,k,R;const{account:n=t.account,chain:i=t.chain,accessList:s,authorizationList:r,blobs:o,data:a,gas:c,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:g,type:b,value:w,...C}=e;if(typeof n>"u")throw new PO({docsPath:"/docs/actions/wallet/sendTransaction"});const E=n?_o(n):null;try{g1(e);const P=await(async()=>{if(e.to)return e.to;if(e.to!==null&&r&&r.length>0)return await fO({authorization:r[0]}).catch(()=>{throw new st("`to` is required. Could not infer from `authorizationList`.")})})();if((E==null?void 0:E.type)==="json-rpc"||E===null){let B;i!==null&&(B=await sn(t,q8,"getChainId")({}),ebe({currentChainId:B,chain:i}));const F=(k=(A=(T=t.chain)==null?void 0:T.formatters)==null?void 0:A.transactionRequest)==null?void 0:k.format,K=(F||$b)({...S6(C,{format:F}),accessList:s,account:E,authorizationList:r,blobs:o,chainId:B,data:a,gas:c,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:g,to:P,type:b,value:w},"sendTransaction"),q=IT.get(t.uid),G=q?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:G,params:[K]},{retryCount:0})}
119catch(I){if(q===!1)throw I;const S=I;if(S.name==="InvalidInputRpcError"||S.name==="InvalidParamsRpcError"||S.name==="MethodNotFoundRpcError"||S.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[K]},{retryCount:0}).then(v=>(IT.set(t.uid,!0),v)).catch(v=>{const _=v;throw _.name==="MethodNotFoundRpcError"||_.name==="MethodNotSupportedRpcError"?(IT.set(t.uid,!1),S):_});throw S}}if((E==null?void 0:E.type)==="local"){const B=await sn(t,z8,"prepareTransactionRequest")({account:E,accessList:s,authorizationList:r,blobs:o,chain:i,data:a,gas:c,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:g,nonceManager:E.nonceManager,parameters:[...ZJ,"sidecars"],type:b,value:w,...C,to:P}),F=(R=i==null?void 0:i.serializers)==null?void 0:R.transaction,z=await E.signTransaction(B,{serializer:F});return await sn(t,Uee,"sendRawTransaction")({serializedTransaction:z})}throw(E==null?void 0:E.type)==="smart"?new PT({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new PT({docsPath:"/docs/actions/wallet/sendTransaction",type:E==null?void 0:E.type})}catch(P){throw P instanceof PT?P:KJ(P,{...e,account:E,chain:e.chain||void 0})}}async function uve(t,{serializedTransaction:e,throwOnReceiptRevert:n,timeout:i}){var a,c,l;const s=await t.request({method:"eth_sendRawTransactionSync",params:i?[e,cn(i)]:[e]},{retryCount:0}),o=(((l=(c=(a=t.chain)==null?void 0:a.formatters)==null?void 0:c.transactionReceipt)==null?void 0:l.format)||eee)(s);if(o.status==="reverted"&&n)throw new $1e({receipt:o});return o}async function dve(t,{account:e=t.account,message:n}){if(!e)throw new PO({docsPath:"/docs/actions/wallet/signMessage"});const i=_o(e);if(i.signMessage)return i.signMessage({message:n});const s=typeof n=="string"?Y2(n):n.raw instanceof Uint8Array?Iu(n.raw):n.raw;return t.request({method:"personal_sign",params:[s,i.address]},{retryCount:0})}async function KE(t,e){return KE.internal(t,Bee,"sendTransaction",e)}(function(t){async function e(n,i,s,r){const{abi:o,account:a=n.account,address:c,args:l,dataSuffix:d,functionName:h,...p}=r;if(typeof a>"u")throw new PO({docsPath:"/docs/contract/writeContract"});const g=a?_o(a):null,b=_i({abi:o,args:l,functionName:h});try{return await sn(n,i,s)({data:`${b}${d?d.replace("0x",""):""}`,to:c,account:g,...p})}catch(w){throw Cg(w,{abi:o,address:c,args:l,docsPath:"/docs/contract/writeContract",functionName:h,sender:g==null?void 0:g.address})}}t.internal=e})(KE||(KE={}));function Qa(t,e,n){const i=t[e.name];if(typeof i=="function")return i;const s=t[n];return typeof s=="function"?s:r=>e(t,r)}const nE="2.22.1",hve=()=>`@wagmi/core@${nE}`;var Fee=function(t,e,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(t):i?i.value:e.get(t)},YE,jee;let Lf=class MR extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return hve()}constructor(e,n={}){var r;super(),YE.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const i=n.cause instanceof MR?n.cause.details:(r=n.cause)!=null&&r.message?n.cause.message:n.details,s=n.cause instanceof MR&&n.cause.docsPath||n.docsPath;this.message=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${this.docsBaseUrl}${s}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...i?[`Details: ${i}`]:[],`Version: ${this.version}`].join(` 120`),n.cause&&(this.cause=n.cause),this.details=i,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}walk(e){return Fee(this,YE,"m",jee).call(this,this,e)}};YE=new WeakSet,jee=function t(e,n){return n!=null&&n(e)?e:e.cause?Fee(this,YE,"m",t).call(this,e.cause,n):e};class o5 extends Lf{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class fve extends Lf{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class pve extends Lf{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class mve extends Lf{constructor({address:e,connector:n}
120){super(`Account "${e}" not found for connector "${n.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class gve extends Lf{constructor({connectionChainId:e,connectorChainId:n}){super(`The current chain of the connector (id: ${n}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class yve extends Lf{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function DT(t,e){var i;let n;if(typeof e.connector=="function"?n=t._internal.connectors.setup(e.connector):n=e.connector,n.uid===t.state.current)throw new fve;try{t.setState(a=>({...a,status:"connecting"})),n.emitter.emit("message",{type:"connecting"});const{connector:s,...r}=e,o=await n.connect(r);return n.emitter.off("connect",t._internal.events.connect),n.emitter.on("change",t._internal.events.change),n.emitter.on("disconnect",t._internal.events.disconnect),await((i=t.storage)==null?void 0:i.setItem("recentConnectorId",n.id)),t.setState(a=>({...a,connections:new Map(a.connections).set(n.uid,{accounts:r.withCapabilities?o.accounts.map(c=>typeof c=="object"?c.address:c):o.accounts,chainId:o.chainId,connector:n}),current:n.uid,status:"connected"})),{accounts:r.withCapabilities?o.accounts.map(a=>typeof a=="object"?a:{address:a,capabilities:{}}):o.accounts,chainId:o.chainId}}catch(s){throw t.setState(r=>({...r,status:r.current?"connected":"disconnected"})),s}}const LR=256;let KC=LR,YC;function Vee(t=11){if(!YC||KC+t>LR*2){YC="",KC=0;for(let e=0;e<LR;e++)YC+=(256+Math.random()*256|0).toString(16).substring(1)}return YC.substring(KC,KC+++t)}function IO(t){const{batch:e,chain:n,ccipRead:i,key:s="base",name:r="Base Client",type:o="base"}=t,a=t.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),c=(n==null?void 0:n.blockTime)??12e3,l=Math.min(Math.max(Math.floor(c/2),500),4e3),d=t.pollingInterval??l,h=t.cacheTime??d,p=t.account?_o(t.account):void 0,{config:g,request:b,value:w}=t.transport({account:p,chain:n,pollingInterval:d}),C={...g,...w},E={account:p,batch:e,cacheTime:h,ccipRead:i,chain:n,key:s,name:r,pollingInterval:d,request:b,transport:C,type:o,uid:Vee(),...a?{experimental_blockTag:a}:{}};function T(A){return k=>{const R=k(A);for(const B in E)delete R[B];const P={...A,...R};return Object.assign(P,{extend:T(P)})}}return Object.assign(E,{extend:T(E)})}function bve(t){var h,p,g;const{scheme:e,statement:n,...i}=((h=t.match(wve))==null?void 0:h.groups)??{},{chainId:s,expirationTime:r,issuedAt:o,notBefore:a,requestId:c,...l}=((p=t.match(vve))==null?void 0:p.groups)??{},d=(g=t.split("Resources:")[1])==null?void 0:g.split(` 121- `).slice(1);return{...i,...l,...s?{chainId:Number(s)}:{},...r?{expirationTime:new Date(r)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...d?{resources:d}:{},...e?{scheme:e}:{},...n?{statement:n}:{}}}const wve=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,vve=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function Cve(t){const{address:e,domain:n,message:i,nonce:s,scheme:r,time:o=new Date}=t;if(n&&i.domain!==n||s&&i.nonce!==s||r&&i.scheme!==r||i.expirationTime&&o>=i.expirationTime||i.notBefore&&o<i.notBefore)return!1;try{if(!i.address||!Ja(i.address,{strict:!1})||e&&!G8(i.address,e))return!1}catch{return!1}return!0}async function xve(t,e){const{address:n,domain:i,message:s,nonce:r,scheme:o,signature:a,time:c=new Date,...l}=e,d=bve(s);if(!d.address||!Cve({address:n,domain:i,message:d,nonce:r,scheme:o,time:c}))return!1;const p=nee(s);return J8(t,{address:d.address,hash:p,signature:a,...l})}function Wee(t){return{call:e=>A6(t,e),createAccessList:e=>TJ(t,e),createBlockFilter:()=>i2e(t),createContractEventFilter:e=>kJ(t,e),createEventFilter:e=>NJ(t,e),createPendingTransactionFilter:()=>RJ(t),estimateContractGas:e=>O2e(t,e),estimateGas:e=>H8(t,e),getBalance:e=>QJ(t,e),getBlobBaseFee:()=>M2e(t),getBlock:e=>_u(t,e),getBlockNumber:e=>k6(t,e),getBlockTransactionCount:e=>j2e(t,e),getBytecode:e=>_R(t,e),getChainId:()=>q8(t),getCode:e=>_R(t,e),getContractEvents:e=>XJ(t,e),getEip712Domain:e=>z2e(t,e),getEnsAddress:e=>jye(t,e),getEnsAvatar:e=>e2e(t,e),getEnsName:e=>t2e(t,e),getEnsResolver:e=>n2e(t,e),getEnsText:e=>AJ(t,e),getFeeHistory:e=>
121K2e(t,e),estimateFeesPerGas:e=>g2e(t,e),getFilterChanges:e=>K8(t,e),getFilterLogs:e=>Y2e(t,e),getGasPrice:()=>gO(t),getLogs:e=>vO(t,e),getProof:e=>$we(t,e),estimateMaxPriorityFeePerGas:e=>m2e(t,e),fillTransaction:e=>YJ(t,e),getStorageAt:e=>Uwe(t,e),getTransaction:e=>Z8(t,e),getTransactionConfirmations:e=>Bwe(t,e),getTransactionCount:e=>BJ(t,e),getTransactionReceipt:e=>tE(t,e),multicall:e=>Ree(t,e),prepareTransactionRequest:e=>z8(t,e),readContract:e=>Rl(t,e),sendRawTransaction:e=>Uee(t,e),sendRawTransactionSync:e=>uve(t,e),simulate:e=>IR(t,e),simulateBlocks:e=>IR(t,e),simulateCalls:e=>Ywe(t,e),simulateContract:e=>Oee(t,e),verifyHash:e=>J8(t,e),verifyMessage:e=>sve(t,e),verifySiweMessage:e=>xve(t,e),verifyTypedData:e=>rve(t,e),uninstallFilter:e=>X8(t,e),waitForTransactionReceipt:e=>Lee(t,e),watchBlocks:e=>ave(t,e),watchBlockNumber:e=>RO(t,e),watchContractEvent:e=>cve(t,e),watchEvent:e=>lve(t,e),watchPendingTransactions:e=>$ee(t,e)}}function eS(t){const{key:e="public",name:n="Public Client"}=t;return IO({...t,key:e,name:n,type:"publicClient"}).extend(Wee)}function DO({key:t,methods:e,name:n,request:i,retryCount:s=3,retryDelay:r=150,timeout:o,type:a},c){const l=Vee();return{config:{key:t,methods:e,name:n,request:i,retryCount:s,retryDelay:r,timeout:o,type:a},request:X2e(i,{methods:e,retryCount:s,retryDelay:r,uid:l}),value:c}}function Eve(t,e={}){const{key:n="custom",methods:i,name:s="Custom Provider",retryDelay:r}=e;return({retryCount:o})=>DO({key:n,methods:i,name:s,request:t.request.bind(t),retryCount:e.retryCount??o,retryDelay:r,type:"custom"})}function dV(t,e={}){const{key:n="fallback",name:i="Fallback",rank:s=!1,shouldThrow:r=_ve,retryCount:o,retryDelay:a}=e;return(({chain:c,pollingInterval:l=4e3,timeout:d,...h})=>{let p=t,g=()=>{};const b=DO({key:n,name:i,async request({method:w,params:C}){let E;const T=async(A=0)=>{const k=p[A]({...h,chain:c,retryCount:0,timeout:d});try{const R=await k.request({method:w,params:C});return g({method:w,params:C,response:R,transport:k,status:"success"}),R}catch(R){if(g({error:R,method:w,params:C,transport:k,status:"error"}),r(R)||A===p.length-1||(E??(E=p.slice(A+1).some(P=>{const{include:B,exclude:F}=P({chain:c}).config.methods||{};return B?B.includes(w):F?!F.includes(w):!0})),!E))throw R;return T(A+1)}};return T()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:w=>g=w,transports:p.map(w=>w({chain:c,retryCount:0}))});if(s){const w=typeof s=="object"?s:{};Sve({chain:c,interval:w.interval??l,onTransports:C=>p=C,ping:w.ping,sampleCount:w.sampleCount,timeout:w.timeout,transports:p,weights:w.weights})}return b})}function _ve(t){return!!("code"in t&&typeof t.code=="number"&&(t.code===X2.code||t.code===Dr.code||Fm.nodeMessage.test(t.message)||t.code===5e3))}function Sve({chain:t,interval:e=4e3,onTransports:n,ping:i,sampleCount:s=10,timeout:r=1e3,transports:o,weights:a={}}){const{stability:c=.7,latency:l=.3}=a,d=[],h=async()=>{const p=await Promise.all(o.map(async w=>{const C=w({chain:t,retryCount:0,timeout:r}),E=Date.now();let T,A;try{await(i?i({transport:C}):C.request({method:"net_listening"})),A=1}catch{A=0}finally{T=Date.now()}return{latency:T-E,success:A}}));d.push(p),d.length>s&&d.shift();const g=Math.max(...d.map(w=>Math.max(...w.map(({latency:C})=>C)))),b=o.map((w,C)=>{const E=d.map(P=>P[C].latency),A=1-E.reduce((P,B)=>P+B,0)/E.length/g,k=d.map(P=>P[C].success),R=k.reduce((P,B)=>P+B,0)/k.length;return R===0?[0,C]:[l*A+c*R,C]}).sort((w,C)=>C[0]-w[0]);n(b.map(([,w])=>o[w])),await zE(e),h()};h()}class Ave extends st{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function ip(t,e={}){const{batch:n,fetchFn:i,fetchOptions:s,key:r="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:d,raw:h}=e;return({chain:p,retryCount:g,timeout:b})=>{const{batchSize:w=1e3,wait:C=0}=typeof n=="object"?n:{},E=e.retryCount??g,T=b??e.timeout??1e4,A=t||(p==null?void 0:p.rpcUrls.default.http[0]);if(!A)throw new Ave;const k=ibe(A,{fetchFn:i,fetchOptions:s,onRequest:c,onResponse:l,timeout:T});return DO({key:r,methods:o,name:a,async request({method:R,params:P}){const B={method:R,params:P},{schedule:F}=xJ({id:A,wait:C,shouldSplitBatch(G){return G.length>w},fn:G=>k.request({body:G}),sort:(G,I)=>G.id-I.id}),z=async G=>n?F(G):[await k.request({body:G})],[{error:K,result:q}]=await z(B);if(h)return{error:K,result:q};if(K)throw new iO({body:B,error:K,url:A});return q},retryCount:E,retryDelay:d,timeout:T,type:"http"},{fetchOptions:s,url:A})}}async function Ub(t,e={}){const{assertChainId:n=!0}=e;let i;if(e.connector){const{connector:d}=e;if(t.state.status==="reconnecting"&&!d.getAccounts&&!d.getChainId)throw new yve({connector:d});const[h,p]=await Promise.all([d.getAccounts().catch(g=>{if(e.account===null)return[];throw g}),d.getChainId()]);i={accounts:h,chainId:p,connector:d}}else i=t.state.connections.get(t.state.current);if(!i)throw new pve;const s=e.chainId??i.chainId,r=await i.connector.getChainId();if(n&&r!==s)throw new gve({connectionChainId:s,connectorChainId:r});const o=i.connector;if(o.getClient)return o.getClient({chainId:s});const a=_o(e.account??i.accounts[0]);if(a&&(a.address=bd(a.address)),e.account&&!i.accounts.some(d=>d.toLowerCase()===a.address.toLowerCase()))throw new mve({address:a.address,connector:o});const c=t.chains.find(d=>d.id===s),l=await i.connector.getProvider({chainId:s});return IO({account:a,chain:c,name:"Connector Client",transport:d=>Eve(l)({...d,retryCount:0})})}async function $R(t,e={}){var s,r;let n;if(e.connector)n=e.connector;else{const{connections:o,current:a}=t.state,c=o.get(a);n=c==null?void 0:c.connector}const i=t.state.connections;n&&(await n.disconnect(),n.emitter.off("change",t._internal.events.change),n.emitter.off("disconnect",t._internal.events.disconnect),n.emitter.on("connect",t._internal.events.connect),i.delete(n.uid)),t.setState(o=>{if(i.size===0)return{...o,connections:new Map,current:null,status:"disconnected"};const a=i.values().next().value;return{...o,connections:new Map(i),current:a.connector.uid}});{const o=t.state.current;if(!o)return;const a=(s=t.state.connections.get(o))==null?void 0:s.connector;if(!a)return;await((r=t.storage)==null?void 0:r.setItem("recentConnectorId",a.id
121))}}function qee(t){return typeof t=="number"?t:t==="wei"?0:Math.abs(P1e[t])}async function Tve(t,e){const{chainId:n,connector:i,...s}=e;let r;e.account?r=e.account:r=(await Ub(t,{account:e.account,assertChainId:!1,chainId:n,connector:i})).account;const o=t.getClient({chainId:n});return Qa(o,H8,"estimateGas")({...s,account:r})}function b2(t){const e=t.state.current,n=t.state.connections.get(e),i=n==null?void 0:n.accounts,s=i==null?void 0:i[0],r=t.chains.find(a=>a.id===(n==null?void 0:n.chainId)),o=t.state.status;switch(o){case"connected":return{address:s,addresses:i,chain:r,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:o};case"reconnecting":return{address:s,addresses:i,chain:r,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!!s,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:o};case"connecting":return{address:s,addresses:i,chain:r,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:o};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:o}}}async function kve(t,e){const{allowFailure:n=!0,chainId:i,contracts:s,...r}=e,o=t.getClient({chainId:i});return Qa(o,Ree,"multicall")({allowFailure:n,contracts:s,...r})}function zee(t,e){const{chainId:n,...i}=e,s=t.getClient({chainId:n});return Qa(s,Rl,"readContract")(i)}async function Hee(t,e){var a;const{allowFailure:n=!0,blockNumber:i,blockTag:s,...r}=e,o=e.contracts;try{const c={};for(const[p,g]of o.entries()){const b=g.chainId??t.state.chainId;c[b]||(c[b]=[]),(a=c[b])==null||a.push({contract:g,index:p})}const l=()=>Object.entries(c).map(([p,g])=>kve(t,{...r,allowFailure:n,blockNumber:i,blockTag:s,chainId:Number.parseInt(p,10),contracts:g.map(({contract:b})=>b)})),d=(await Promise.all(l())).flat(),h=Object.values(c).flatMap(p=>p.map(({index:g})=>g));return d.reduce((p,g,b)=>(p&&(p[h[b]]=g),p),[])}catch(c){if(c instanceof eO)throw c;const l=()=>o.map(d=>zee(t,{...d,blockNumber:i,blockTag:s}));return n?(await Promise.allSettled(l())).map(d=>d.status==="fulfilled"?{result:d.value,status:"success"}:{error:d.reason,result:void 0,status:"failure"}):await Promise.all(l())}}async function Gee(t,e){const{address:n,blockNumber:i,blockTag:s,chainId:r,token:o,unit:a="ether"}=e;if(o)try{return await hV(t,{balanceAddress:n,chainId:r,symbolType:"string",tokenAddress:o})}catch(p){if(p.name==="ContractFunctionExecutionError"){const g=await hV(t,{balanceAddress:n,chainId:r,symbolType:"bytes32",tokenAddress:o}),b=vX(tf(g.symbol,{dir:"right"}));return{...g,symbol:b}}throw p}const c=t.getClient({chainId:r}),d=await Qa(c,QJ,"getBalance")(i?{address:n,blockNumber:i}:{address:n,blockTag:s}),h=t.chains.find(p=>p.id===r)??c.chain;return{decimals:h.nativeCurrency.decimals,formatted:dt(d,qee(a)),symbol:h.nativeCurrency.symbol,value:d}}async function hV(t,e){const{balanceAddress:n,chainId:i,symbolType:s,tokenAddress:r,unit:o}=e,a={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:s}]}],address:r},[c,l,d]=await Hee(t,{allowFailure:!1,contracts:[{...a,functionName:"balanceOf",args:[n],chainId:i},{...a,functionName:"decimals",chainId:i},{...a,functionName:"symbol",chainId:i}]}),h=dt(c??"0",qee(o??l));return{decimals:l,formatted:h,symbol:d,value:c}}function fV(t){return t.state.chainId}function Sg(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,i;if(Array.isArray(t)&&Array.isArray(e)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!Sg(t[i],e[i]))return!1;return!0}if(typeof t.valueOf=="function"&&t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(typeof t.toString=="function"&&t.toString!==Object.prototype.toString)return t.toString()===e.toString();const s=Object.keys(t);if(n=s.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;
121)if(!Object.hasOwn(e,s[i]))return!1;for(i=n;i--!==0;){const r=s[i];if(r&&!Sg(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}let OT=[];function pV(t){const e=t.chains;return Sg(OT,e)?OT:(OT=e,e)}function Nve(t,e={}){try{return t.getClient(e)}catch{return}}let ZC=[];function uu(t){const e=[...t.state.connections.values()];return t.state.status==="reconnecting"||Sg(ZC,e)?ZC:(ZC=e,e)}function UR(t,e={}){const n=Nve(t,e);return n==null?void 0:n.extend(Wee)}async function Rve(t,e){const{account:n,chainId:i,...s}=e,r=n??b2(t).address,o=t.getClient({chainId:i});return Qa(o,z8,"prepareTransactionRequest")({...s,...r?{account:r}:{}})}let MT=!1;async function l3(t,e={}){var l,d;if(MT)return[];MT=!0,t.setState(h=>({...h,status:h.current?"reconnecting":"connecting"}));const n=[];if((l=e.connectors)!=null&&l.length)for(const h of e.connectors){let p;typeof h=="function"?p=t._internal.connectors.setup(h):p=h,n.push(p)}else n.push(...t.connectors);let i;try{i=await((d=t.storage)==null?void 0:d.getItem("recentConnectorId"))}catch{}const s={};for(const[,h]of t.state.connections)s[h.connector.id]=1;i&&(s[i]=0);const r=Object.keys(s).length>0?[...n].sort((h,p)=>(s[h.id]??10)-(s[p.id]??10)):n;let o=!1;const a=[],c=[];for(const h of r){const p=await h.getProvider().catch(()=>{});if(!p||c.some(w=>w===p)||!await h.isAuthorized())continue;const b=await h.connect({isReconnecting:!0}).catch(()=>null);b&&(h.emitter.off("connect",t._internal.events.connect),h.emitter.on("change",t._internal.events.change),h.emitter.on("disconnect",t._internal.events.disconnect),t.setState(w=>{const C=new Map(o?w.connections:new Map).set(h.uid,{accounts:b.accounts,chainId:b.chainId,connector:h});return{...w,current:o?w.current:h.uid,connections:C}}),a.push({accounts:b.accounts,chainId:b.chainId,connector:h}),c.push(p),o=!0)}return(t.state.status==="reconnecting"||t.state.status==="connecting")&&(o?t.setState(h=>({...h,status:"connected"})):t.setState(h=>({...h,connections:new Map,current:null,status:"disconnected"}))),MT=!1,a}async function Kee(t,e){const{account:n,chainId:i,connector:s,...r}=e;let o;return typeof n=="object"&&(n==null?void 0:n.type)==="local"?o=t.getClient({chainId:i}):o=await Ub(t,{account:n??void 0,assertChainId:!1,chainId:i,connector:s}),await Qa(o,Bee,"sendTransaction")({...r,...n?{account:n}:{},chain:i?{id:i}:null,gas:r.gas??void 0})}async function Yee(t,e){const{account:n,connector:i,...s}=e;let r;return typeof n=="object"&&n.type==="local"?r=t.getClient():r=await Ub(t,{account:n,connector:i}),Qa(r,dve,"signMessage")({...s,...n?{account:n}:{}})}async function Pve(t,e){const{abi:n,chainId:i,connector:s,...r}=e;let o;e.account?o=e.account:o=(await Ub(t,{assertChainId:!1,chainId:i,connector:s})).account;const a=t.getClient({chainId:i}),c=Qa(a,Oee,"simulateContract"),{result:l,request:d}=await c({...r,abi:n,account:o});return{chainId:a.chain.id,result:l,request:{...d,chainId:i}}}class U0 extends Lf{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class Ive extends Lf{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function BR(t,e){var o;const{addEthereumChainParameter:n,chainId:i}=e,s=t.state.connections.get(((o=e.connector)==null?void 0:o.uid)??t.state.current);if(s){const a=s.connector;if(!a.switchChain)throw new Ive({connector:a});return await a.switchChain({addEthereumChainParameter:n,chainId:i})}const r=t.chains.find(a=>a.id===i);if(!r)throw new o5;return t.setState(a=>({...a,chainId:i})),r}async function Zee(t,e){const{chainId:n,timeout:i=0,...s}=e,r=t.getClient({chainId:n}),a=await Qa(r,Lee,"waitForTransactionReceipt")({...s,timeout:i});if(a.status==="reverted"){const c=Qa(r,Z8,"getTransaction"),{from:l,...d}=await c({hash:a.transactionHash}),p=await Qa(r,A6,"call")({...d,account:l,data:d.input,gasPrice:d.type!=="eip1559"?d.gasPrice:void 0,maxFeePerGas:d.type==="eip1559"?d.maxFeePerGas:void 0,maxPriorityFeePerGas:d.type==="eip1559"?d.maxPriorityFeePerGas:void 0}),g=p!=null&&p.data?vX(`0x${p.data.substring(138)}`):"unknown reason";throw new Error(g)}return{...a,chainId:r.chain.id}}function Qee(t,e){const{onChange:n}=e;return t.subscribe(()=>b2(t),n,{equalityFn(i,s){const{connector:r,...o}=i,{connector:a,...c}=s;return Sg(o,c)&&(r==null?void 0:r.id)===(a==null?void 0:a.id)&&(r==null?void 0:r.uid)===(a==null?void 0:a.uid)}})}function Dve(t,e){const{syncConnectedChain:n=t._internal.syncConnectedChain,...i}=e;let s;const r=c=>{s&&s();const l=t.getClient({chainId:c});return s=Qa(l,RO,"watchBlockNumber")(i),s},o=r(e.chainId);let a;return n&&!e.chainId&&(a=t.subscribe(({chainId:c})=>c,async c=>r(c))),()=>{o==null||o(),a==null||a()}}function Ove(t,e){const{onChange:n}=e;return t.subscribe(i=>i.chainId,n)}function Xee(t,e){const{onChange:n}=e;return t.subscribe(()=>uu(t),n,{equalityFn:Sg})}function Mve(t,e){const{onChange:n}=e;return t._internal.connectors.subscribe((i,s)=>{n(Object.values(i),s)})}function Lve(t,e){const{syncConnectedChain:n=t._internal.syncConnectedChain,...i}=e;let s;const r=c=>{s&&s();const l=t.getClient({chainId:c});
121return s=Qa(l,$ee,"watchPendingTransactions")(i),s},o=r(e.chainId);let a;return n&&!e.chainId&&(a=t.subscribe(({chainId:c})=>c,async c=>r(c))),()=>{o==null||o(),a==null||a()}}function $ve(t,e){const{onChange:n}=e;return t.subscribe(()=>UR(t),n,{equalityFn(i,s){return(i==null?void 0:i.uid)===(s==null?void 0:s.uid)}})}async function Jee(t,e){const{account:n,chainId:i,connector:s,...r}=e;let o;return typeof n=="object"&&(n==null?void 0:n.type)==="local"?o=t.getClient({chainId:i}):o=await Ub(t,{account:n??void 0,assertChainId:!1,chainId:i,connector:s}),await Qa(o,KE,"writeContract")({...r,...n?{account:n}:{},chain:i?{id:i}:null})}function _et(t){return t}tS.type="injected";function tS(t={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:n}=t;function i(){const c=t.target;if(typeof c=="function"){const l=c();if(l)return l}return typeof c=="object"?c:typeof c=="string"?{...Uve[c]??{id:c,name:`${c[0].toUpperCase()}${c.slice(1)}`,provider:`is${c[0].toUpperCase()}${c.slice(1)}`}}:{id:"injected",name:"Injected",provider(l){return l==null?void 0:l.ethereum}}}let s,r,o,a;return c=>({get icon(){return i().icon},get id(){return i().id},get name(){return i().name},get supportsSimulation(){return!0},type:tS.type,async setup(){const l=await this.getProvider();l!=null&&l.on&&t.target&&(o||(o=this.onConnect.bind(this),l.on("connect",o)),s||(s=this.onAccountsChanged.bind(this),l.on("accountsChanged",s)))},async connect({chainId:l,isReconnecting:d,withCapabilities:h}={}){var b,w,C,E,T,A;const p=await this.getProvider();if(!p)throw new U0;let g=[];if(d)g=await this.getAccounts().catch(()=>[]);else if(e)try{g=(E=(C=(w=(b=(await p.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:b.caveats)==null?void 0:w[0])==null?void 0:C.value)==null?void 0:E.map(R=>bd(R)),g.length>0&&(g=await this.getAccounts())}catch(k){const R=k;if(R.code===Dr.code)throw new Dr(R);if(R.code===lp.code)throw R}try{!(g!=null&&g.length)&&!d&&(g=(await p.request({method:"eth_requestAccounts"})).map(P=>bd(P))),o&&(p.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),p.on("accountsChanged",s)),r||(r=this.onChainChanged.bind(this),p.on("chainChanged",r)),a||(a=this.onDisconnect.bind(this),p.on("disconnect",a));let k=await this.getChainId();if(l&&k!==l){const R=await this.switchChain({chainId:l}).catch(P=>{if(P.code===Dr.code)throw P;return{id:k}});k=(R==null?void 0:R.id)??k}return e&&await((T=c.storage)==null?void 0:T.removeItem(`${this.id}.disconnected`)),t.target||await((A=c.storage)==null?void 0:A.setItem("injected.connected",!0)),{accounts:h?g.map(R=>({address:R,capabilities:{}})):g,chainId:k}}catch(k){const R=k;throw R.code===Dr.code?new Dr(R):R.code===lp.code?new lp(R):R}},async disconnect(){var d,h;const l=await this.getProvider();if(!l)throw new U0;r&&(l.removeListener("chainChanged",r),r=void 0),a&&(l.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),l.on("connect",o));try{await tee(()=>l.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await((d=c.storage)==null?void 0:d.setItem(`${this.id}.disconnected`,!0)),t.target||await((h=c.storage)==null?void 0:h.removeItem("injected.connected"))},async getAccounts(){const l=await this.getProvider();if(!l)throw new U0;return(await l.request({method:"eth_accounts"})).map(h=>bd(h))},async getChainId(){const l=await this.getProvider();if(!l)throw new U0;const d=await l.request({method:"eth_chainId"});return Number(d)}
121,async getProvider(){if(typeof window>"u")return;let l;const d=i();return typeof d.provider=="function"?l=d.provider(window):typeof d.provider=="string"?l=iE(window,d.provider):l=d.provider,l&&!l.removeListener&&("off"in l&&typeof l.off=="function"?l.removeListener=l.off:l.removeListener=()=>{}),l},async isAuthorized(){var l,d;try{if(e&&await((l=c.storage)==null?void 0:l.getItem(`${this.id}.disconnected`))||!t.target&&!await((d=c.storage)==null?void 0:d.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const b=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",b),!!await this.getProvider()),w=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(E=>window.addEventListener("ethereum#initialized",()=>E(b()),{once:!0}))]:[],new Promise(E=>setTimeout(()=>E(b()),w))]))return!0}throw new U0}return!!(await HE(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:l,chainId:d}){var b,w,C,E;const h=await this.getProvider();if(!h)throw new U0;const p=c.chains.find(T=>T.id===d);if(!p)throw new Id(new o5);const g=new Promise(T=>{const A=(k=>{"chainId"in k&&k.chainId===d&&(c.emitter.off("change",A),T())});c.emitter.on("change",A)});try{return await Promise.all([h.request({method:"wallet_switchEthereumChain",params:[{chainId:cn(d)}]}).then(async()=>{await this.getChainId()===d&&c.emitter.emit("change",{chainId:d})}),g]),p}catch(T){const A=T;if(A.code===4902||((w=(b=A==null?void 0:A.data)==null?void 0:b.originalError)==null?void 0:w.code)===4902)try{const{default:k,...R}=p.blockExplorers??{};let P;l!=null&&l.blockExplorerUrls?P=l.blockExplorerUrls:k&&(P=[k.url,...Object.values(R).map(z=>z.url)]);let B;(C=l==null?void 0:l.rpcUrls)!=null&&C.length?B=l.rpcUrls:B=[((E=p.rpcUrls.default)==null?void 0:E.http[0])??""];const F={blockExplorerUrls:P,chainId:cn(d),chainName:(l==null?void 0:l.chainName)??p.name,iconUrls:l==null?void 0:l.iconUrls,nativeCurrency:(l==null?void 0:l.nativeCurrency)??p.nativeCurrency,rpcUrls:B};return await Promise.all([h.request({method:"wallet_addEthereumChain",params:[F]}).then(async()=>{if(await this.getChainId()===d)c.emitter.emit("change",{chainId:d});else throw new Dr(new Error("User rejected switch after adding network."))}),g]),p}catch(k){throw new Dr(k)}throw A.code===Dr.code?new Dr(A):new Id(A)}},async onAccountsChanged(l){var d;if(l.length===0)this.onDisconnect();else if(c.emitter.listenerCount("connect")){const h=(await this.getChainId()).toString();this.onConnect({chainId:h}),e&&await((d=c.storage)==null?void 0:d.removeItem(`${this.id}.disconnected`))}else c.emitter.emit("change",{accounts:l.map(h=>bd(h))})},onChainChanged(l){const d=Number(l);c.emitter.emit("change",{chainId:d})},async onConnect(l){const d=await this.getAccounts();if(d.length===0)return;const h=Number(l.chainId);c.emitter.emit("connect",{accounts:d,chainId:h});const p=await this.getProvider();p&&(o&&(p.removeListener("connect",o),o=void 0),s||(s=this.onAccountsChanged.bind(this),p.on("accountsChanged",s)),r||(r=this.onChainChanged.bind(this),p.on("chainChanged",r)),a||(a=this.onDisconnect.bind(this),p.on("disconnect",a)))},async onDisconnect(l){const d=await this.getProvider();l&&l.code===1013&&d&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),d&&(r&&(d.removeListener("chainChanged",r),r=void 0),a&&(d.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),d.on("connect",o))))}})}const Uve={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t!=null&&t.coinbaseWalletExtension?t.coinbaseWalletExtension:iE(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return iE(t,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const n=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const i of n)if(e[i])return!1;return!0})}}
121,phantom:{id:"phantom",name:"Phantom",provider(t){var e,n;return(e=t==null?void 0:t.phantom)!=null&&e.ethereum?(n=t.phantom)==null?void 0:n.ethereum:iE(t,"isPhantom")}}};function iE(t,e){function n(s){return typeof e=="function"?e(s):typeof e=="string"?s[e]:!0}const i=t.ethereum;if(i!=null&&i.providers)return i.providers.find(s=>n(s));if(i&&n(i))return i}function Bve(t){if(typeof window>"u")return;const e=n=>t(n.detail);return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}function Fve(){const t=new Set;let e=[];const n=()=>Bve(s=>{e.some(({info:r})=>r.uuid===s.info.uuid)||(e=[...e,s],t.forEach(r=>r(e,{added:[s]})))});let i=n();return{_listeners(){return t},clear(){t.forEach(s=>s([],{removed:[...e]})),e=[]},destroy(){this.clear(),t.clear(),i==null||i()},findProvider({rdns:s}){return e.find(r=>r.info.rdns===s)},getProviders(){return e},reset(){this.clear(),i==null||i(),i=n()},subscribe(s,{emitImmediately:r}={}){return t.add(s),r&&s(e,{added:e}),()=>t.delete(s)}}}const jve=t=>(e,n,i)=>{const s=i.subscribe;return i.subscribe=(o,a,c)=>{let l=o;if(a){const d=(c==null?void 0:c.equalityFn)||Object.is;let h=o(i.getState());l=p=>{const g=o(p);if(!d(h,g)){const b=h;a(h=g,b)}},c!=null&&c.fireImmediately&&a(h,h)}return s(l)},t(e,n,i)},Vve=jve;function Wve(t,e){let n;try{n=t()}catch{return}return{getItem:s=>{var r;const o=c=>c===null?null:JSON.parse(c,void 0),a=(r=n.getItem(s))!=null?r:null;return a instanceof Promise?a.then(o):o(a)},setItem:(s,r)=>n.setItem(s,JSON.stringify(r,void 0)),removeItem:s=>n.removeItem(s)}}const FR=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(i){return FR(i)(n)},catch(i){return this}}}catch(n){return{then(i){return this},catch(i){return FR(i)(n)}}}},qve=(t,e)=>(n,i,s)=>{let r={storage:Wve(()=>localStorage),partialize:w=>w,version:0,merge:(w,C)=>({...C,...w}),...e},o=!1;const a=new Set,c=new Set;let l=r.storage;if(!l)return t((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...w)},i,s);const d=()=>{const w=r.partialize({...i()});return l.setItem(r.name,{state:w,version:r.version})},h=s.setState;s.setState=(w,C)=>{h(w,C),d()};const p=t((...w)=>{n(...w),d()},i,s);s.getInitialState=()=>p;let g;const b=()=>{var w,C;if(!l)return;o=!1,a.forEach(T=>{var A;return T((A=i())!=null?A:p)});const E=((C=r.onRehydrateStorage)==null?void 0:C.call(r,(w=i())!=null?w:p))||void 0;return FR(l.getItem.bind(l))(r.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==r.version){if(r.migrate)return[!0,r.migrate(T.state,T.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var A;const[k,R]=T;if(g=r.merge(R,(A=i())!=null?A:p),n(g,!0),k)return d()}).then(()=>{E==null||E(g,void 0),g=i(),o=!0,c.forEach(T=>T(g))}).catch(T=>{E==null||E(void 0,T)})};return s.persist={setOptions:w=>{r={...r,...w},w.storage&&(l=w.storage)},clearStorage:()=>{l==null||l.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>b(),hasHydrated:()=>o,onHydrate:w=>(a.add(w),()=>{a.delete(w)}),onFinishHydration:w=>(c.add(w),()=>{c.delete(w)})},r.skipHydration||b(),g||p},zve=qve,mV=t=>{let e;const n=new Set,i=(l,d)=>{const h=typeof l=="function"?l(e):l;if(!Object.is(h,e)){const p=e;e=d??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(g=>g(e,p))}},s=()=>e,a={setState:i,getState:s,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=e=t(i,s,a);return a},LT=t=>t?mV(t):mV;var $T={exports:{}},gV;function Hve(){return gV||(gV=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(n=!1));function s(c,l,d){this.fn=c,this.context=l,this.once=d||!1}function r(c,l,d,h,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new s(d,h||c,p),b=n?n+l:l;return c._events[b]?c._events[b].fn?c._events[b]=[c._events[b],g]:c._events[b].push(g):(c._events[b]=g,c._eventsCount++),c}
121function o(c,l){--c._eventsCount===0?c._events=new i:delete c._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,h;if(this._eventsCount===0)return l;for(h in d=this._events)e.call(d,h)&&l.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=n?n+l:l,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,g=h.length,b=new Array(g);p<g;p++)b[p]=h[p].fn;return b},a.prototype.listenerCount=function(l){var d=n?n+l:l,h=this._events[d];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,d,h,p,g,b){var w=n?n+l:l;if(!this._events[w])return!1;var C=this._events[w],E=arguments.length,T,A;if(C.fn){switch(C.once&&this.removeListener(l,C.fn,void 0,!0),E){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,h),!0;case 4:return C.fn.call(C.context,d,h,p),!0;case 5:return C.fn.call(C.context,d,h,p,g),!0;case 6:return C.fn.call(C.context,d,h,p,g,b),!0}for(A=1,T=new Array(E-1);A<E;A++)T[A-1]=arguments[A];C.fn.apply(C.context,T)}else{var k=C.length,R;for(A=0;A<k;A++)switch(C[A].once&&this.removeListener(l,C[A].fn,void 0,!0),E){case 1:C[A].fn.call(C[A].context);break;case 2:C[A].fn.call(C[A].context,d);break;case 3:C[A].fn.call(C[A].context,d,h);break;case 4:C[A].fn.call(C[A].context,d,h,p);break;default:if(!T)for(R=1,T=new Array(E-1);R<E;R++)T[R-1]=arguments[R];C[A].fn.apply(C[A].context,T)}}return!0},a.prototype.on=function(l,d,h){return r(this,l,d,h,!1)},a.prototype.once=function(l,d,h){return r(this,l,d,h,!0)},a.prototype.removeListener=function(l,d,h,p){var g=n?n+l:l;if(!this._events[g])return this;if(!d)return o(this,g),this;var b=this._events[g];if(b.fn)b.fn===d&&(!p||b.once)&&(!h||b.context===h)&&o(this,g);else{for(var w=0,C=[],E=b.length;w<E;w++)(b[w].fn!==d||p&&!b[w].once||h&&b[w].context!==h)&&C.push(b[w]);C.length?this._events[g]=C.length===1?C[0]:C:o(this,g)}return this},a.prototype.removeAllListeners=function(l){var d;return l?(d=n?n+l:l,this._events[d]&&o(this,d)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a})($T)),$T.exports}var Gve=Hve();const Kve=ya(Gve);class Yve{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new Kve})}on(e,n){this._emitter.on(e,n)}once(e,n){this._emitter.once(e,n)}off(e,n){this._emitter.off(e,n)}emit(e,...n){const i=n[0];this._emitter.emit(e,{uid:this.uid,...i})}listenerCount(e){return this._emitter.listenerCount(e)}}function Zve(t){return new Yve(t)}function Qve(t,e){return JSON.parse(t,(n,i)=>{let s=i;return(s==null?void 0:s.__type)==="bigint"&&(s=BigInt(s.value)),(s==null?void 0:s.__type)==="Map"&&(s=new Map(s.value)),(e==null?void 0:e(n,s))??s})}function yV(t,e){return t.slice(0,e).join(".")||"."}function bV(t,e){const{length:n}=t;for(let i=0;i<n;++i)if(t[i]===e)return i+1;return 0}function Xve(t,e){const n=typeof t=="function",i=typeof e=="function",s=[],r=[];return function(a,c){if(typeof c=="object")if(s.length){const l=bV(s,this);l===0?s[s.length]=this:(s.splice(l),r.splice(l)),r[r.length]=a;const d=bV(s,c);if(d!==0)return i?e.call(this,a,c,yV(r,d)):`[ref=${yV(r,d)}]`}else s[0]=c,r[0]=a;return n?t.call(this,a,c):c}}function Jve(t,e,n,i){return JSON.stringify(t,Xve((s,r)=>{let o=r;return typeof o=="bigint"&&(o={__type:"bigint",value:r.toString()}),o instanceof Map&&(o={__type:"Map",value:Array.from(r.entries())}),(e==null?void 0:e(s,o))??o},i),n??void 0)}function ete(t){const{deserialize:e=Qve,key:n="wagmi",serialize:i=Jve,storage:s=tte}=t;function r(o){return o instanceof Promise?o.then(a=>a).catch(()=>null):o}return{...s,key:n,async getItem(o,a){const c=s.getItem(`${n}.${o}`),l=await r(c);return l?e(l)??null:a??null},async setItem(o,a){const c=`${n}.${o}`;a===null?await r(s.removeItem(c)):await r(s.setItem(c,i(a)))},async removeItem(o){await r(s.removeItem(`${n}.${o}`))}}}const tte={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function e3e(){const t=typeof window<"u"&&window.localStorage?window.localStorage:tte;return{getItem(e){return t.getItem(e)},removeItem(e){t.removeItem(e)},setItem(e,n){try{t.setItem(e,n)}catch{}}}}const jR=256;let QC=jR,XC;function t3e(t=11){if(!XC||QC+t>jR*2){XC="",QC=0;for(let e=0;e<jR;e++)XC+=(256+Math.random()*256|0).toString(16).substring(1)}return XC.substring(QC,QC+++t)}function n3e(t){const{multiInjectedProviderDiscovery:e=!0,storage:n=ete({storage:e3e()}),syncConnectedChain:i=!0,ssr:s=!1,...r}=t,o=typeof window<"u"&&e?Fve():void 0,a=LT(()=>r.chains),c=LT(()=>{const R=[],P=new Set;for(const B of r.connectors??[]){const F=l(B);if(R.push(F),!s&&F.rdns){const z=typeof F.rdns=="string"?[F.rdns]:
121F.rdns;for(const K of z)P.add(K)}}if(!s&&o){const B=o.getProviders();for(const F of B)P.has(F.info.rdns)||R.push(l(d(F)))}return R});function l(R){var F;const P=Zve(t3e()),B={...R({emitter:P,chains:a.getState(),storage:n,transports:r.transports}),emitter:P,uid:P.uid};return P.on("connect",A),(F=B.setup)==null||F.call(B),B}function d(R){const{info:P}=R,B=R.provider;return tS({target:{...P,id:P.rdns,provider:B}})}const h=new Map;function p(R={}){const P=R.chainId??C.getState().chainId,B=a.getState().find(z=>z.id===P);if(R.chainId&&!B)throw new o5;{const z=h.get(C.getState().chainId);if(z&&!B)return z;if(!B)throw new o5}{const z=h.get(P);if(z)return z}let F;if(r.client)F=r.client({chain:B});else{const z=B.id,K=a.getState().map(I=>I.id),q={},G=Object.entries(r);for(const[I,S]of G)if(!(I==="chains"||I==="client"||I==="connectors"||I==="transports"))if(typeof S=="object")if(z in S)q[I]=S[z];else{if(K.some(_=>_ in S))continue;q[I]=S}else q[I]=S;F=IO({...q,chain:B,batch:q.batch??{multicall:!0},transport:I=>r.transports[z]({...I,connectors:c})})}return h.set(P,F),F}function g(){return{chainId:a.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let b;const w="0.0.0-canary-";nE.startsWith(w)?b=Number.parseInt(nE.replace(w,""),10):b=Number.parseInt(nE.split(".")[0]??"0",10);const C=LT(Vve(n?zve(g,{migrate(R,P){if(P===b)return R;const B=g(),F=E(R,B.chainId);return{...B,chainId:F}},name:"store",partialize(R){return{connections:{__type:"Map",value:Array.from(R.connections.entries()).map(([P,B])=>{const{id:F,name:z,type:K,uid:q}=B.connector;return[P,{...B,connector:{id:F,name:z,type:K,uid:q}}]})},chainId:R.chainId,current:R.current}},merge(R,P){typeof R=="object"&&R&&"status"in R&&delete R.status;const B=E(R,P.chainId);return{...P,...R,chainId:B}},skipHydration:s,storage:n,version:b}):g));C.setState(g());function E(R,P){return R&&typeof R=="object"&&"chainId"in R&&typeof R.chainId=="number"&&a.getState().some(B=>B.id===R.chainId)?R.chainId:P}i&&C.subscribe(({connections:R,current:P})=>{var B;return P?(B=R.get(P))==null?void 0:B.chainId:void 0},R=>{if(a.getState().some(B=>B.id===R))return C.setState(B=>({...B,chainId:R??B.chainId}))}),o==null||o.subscribe(R=>{const P=new Set,B=new Set;for(const z of c.getState())if(P.add(z.id),z.rdns){const K=typeof z.rdns=="string"?[z.rdns]:z.rdns;for(const q of K)B.add(q)}const F=[];for(const z of R){if(B.has(z.info.rdns))continue;const K=l(d(z));P.has(K.id)||F.push(K)}n&&!C.persist.hasHydrated()||c.setState(z=>[...z,...F],!0)});function T(R){C.setState(P=>{const B=P.connections.get(R.uid);return B?{...P,connections:new Map(P.connections).set(R.uid,{accounts:R.accounts??B.accounts,chainId:R.chainId??B.chainId,connector:B.connector})}:P})}function A(R){C.getState().status==="connecting"||C.getState().status==="reconnecting"||C.setState(P=>{const B=c.getState().find(F=>F.uid===R.uid);return B?(B.emitter.listenerCount("connect")&&B.emitter.off("connect",T),B.emitter.listenerCount("change")||B.emitter.on("change",T),B.emitter.listenerCount("disconnect")||B.emitter.on("disconnect",k),{...P,connections:new Map(P.connections).set(R.uid,{accounts:R.accounts,chainId:R.chainId,connector:B}),current:R.uid,status:"connected"}):P})}function k(R){C.setState(P=>{const B=P.connections.get(R.uid);if(B){const z=B.connector;z.emitter.listenerCount("change")&&B.connector.emitter.off("change",T),z.emitter.listenerCount("disconnect")&&B.connector.emitter.off("disconnect",k),z.emitter.listenerCount("connect")||B.connector.emitter.on("connect",A)}if(P.connections.delete(R.uid),P.connections.size===0)return{...P,connections:new Map,current:null,status:"disconnected"};const F=P.connections.values().next().value;return{...P,connections:new Map(P.connections),current:F.connector.uid}})}return{get chains(){return a.getState()},get connectors(){return c.getState()},storage:n,getClient:p,get state(){return C.getState()},setState(R){let P;typeof R=="function"?P=R(C.getState()):P=R;const B=g();typeof P!="object"&&(P=B),Object.keys(B).some(z=>!(z in P))&&(P=B),C.setState(P,!0)},subscribe(R,P,B){return C.subscribe(R,P,B?{...B,fireImmediately:B.emitImmediately}:void 0)},_internal:{mipd:o,async revalidate(){const R=C.getState(),P=R.connections;let B=R.current;for(const[,F]of P){const z=F.connector;z.isAuthorized&&await z.isAuthorized()||(P.delete(z.uid),B===z.uid&&(B=null))}C.setState(F=>({...F,connections:P,current:B}))},store:C,ssr:!!s,syncConnectedChain:i,transports:r.transports,chains:{setState(R){const P=typeof R=="function"?R(a.getState()):R;if(P.length!==0)return a.setState(P,!0)},subscribe(R){return a.subscribe(R)}},connectors:{providerDetailToConnector:d,setup:l,setState(R){return c.setState(typeof R=="function"?R(c.getState()):R,!0)},subscribe(R){return c.subscribe(R)}},events:{change:T,connect:A,disconnect:k}}}}function i3e(t,e){const{initialState:n,reconnectOnMount:i}=e;return n&&!t._internal.store.persist.hasHydrated()&&t.setState({...n,chainId:t.chains.some(s=>s.id===n.chainId)?n.chainId:t.chains[0].id,connections:i?n.connections:new Map,status:i?"reconnecting":"disconnected"}),{async onMount(){t._internal.ssr&&(await t._internal.store.persist.rehydrate(),t._internal.mipd&&t._internal.connectors.setState(s=>{var c;const r=new Set;for(const l of s??[])if(l.rdns){const d=Array.isArray(l.rdns)?l.rdns:[l.rdns];for(const h of d)r.add(h)}const o=[],a=((c=t._internal.mipd)==null?void 0:c.getProviders())??[];for(const l of a){if(r.has(l.info.rdns))continue;const d=t._internal.connectors.providerDetailToConnector(l),h=t._internal.connectors.setup(d);o.push(h)}return[...s,...o]})),i?l3(t):t.storage&&t.setState(s=>({...s,connections:new Map}))}}}function s3e(t){const{children:e,config:n,initialState:i,reconnectOnMount:s=!0}=t,{onMount:r}=i3e(n,{initialState:i,reconnectOnMount:s});n._internal.ssr||r();const o=M.useRef(!0);return M.useEffect(()=>{if(o.current&&n._internal.ssr)return r(),()=>{o.current=!1}},[]),e}const nte=M.createContext(void 0);function r3e(t){const{children:e,config:n}=t,i={value:n};return M.createElement(s3e,t,M.createElement(nte.Provider,i,e))}const o3e="2.19.5",a3e=()=>`wagmi@${o3e}`;let c3e=class extends Lf{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return a3e()}};class l3e extends c3e{constructor(){super("`useConfig` must be used within `WagmiProvi
121der`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function so(t={}){const e=t.config??M.useContext(nte);if(!e)throw new l3e;return e}function u3e(t,e){const{onChange:n}=e;return t._internal.chains.subscribe((i,s)=>{n(i,s)})}var UT={exports:{}},BT={},FT={exports:{}},jT={};/** 122 * @license React 123 * use-sync-external-store-shim.production.js 124 * 125 * Copyright (c) Meta Platforms, Inc. and affiliates. 126 * 127 * This source code is licensed under the MIT license found in the 128 * LICENSE file in the root directory of this source tree. 129 */var wV;function d3e(){if(wV)return jT;wV=1;var t=_b();function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,s=t.useEffect,r=t.useLayoutEffect,o=t.useDebugValue;function a(h,p){var g=p(),b=i({inst:{value:g,getSnapshot:p}}),w=b[0].inst,C=b[1];return r(function(){w.value=g,w.getSnapshot=p,c(w)&&C({inst:w})},[h,g,p]),s(function(){return c(w)&&C({inst:w}),h(function(){c(w)&&C({inst:w})})},[h]),o(g),g}function c(h){var p=h.getSnapshot;h=h.value;try{var g=p();return!n(h,g)}catch{return!0}}function l(h,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return jT.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,jT}var vV;function h3e(){return vV||(vV=1,FT.exports=d3e()),FT.exports}/** 130 * @license React 131 * use-sync-external-store-shim/with-selector.production.js 132 * 133 * Copyright (c) Meta Platforms, Inc. and affiliates. 134 * 135 * This source code is licensed under the MIT license found in the 136 * LICENSE file in the root directory of this source tree. 137 */var CV;function f3e(){if(CV)return BT;CV=1;var t=_b(),e=h3e();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var i=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,r=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;return BT.useSyncExternalStoreWithSelector=function(l,d,h,p,g){var b=r(null);if(b.current===null){var w={hasValue:!1,value:null};b.current=w}else w=b.current;b=a(function(){function E(P){if(!T){if(T=!0,A=P,P=p(P),g!==void 0&&w.hasValue){var B=w.value;if(g(B,P))return k=B}return k=P}if(B=k,i(A,P))return B;var F=p(P);return g!==void 0&&g(B,F)?(A=P,B):(A=P,k=F)}var T=!1,A,k,R=h===void 0?null:h;return[function(){return E(d())},R===null?void 0:function(){return E(R())}]},[d,h,p,g]);var C=s(l,b[0],b[1]);return o(function(){w.hasValue=!0,w.value=C},[C]),c(C),C},BT}var xV;function p3e(){return xV||(xV=1,UT.exports=f3e()),UT.exports}var ite=p3e();const VT=t=>typeof t=="object"&&!Array.isArray(t);function m3e(t,e,n=e,i=Sg){const s=M.useRef([]),r=ite.useSyncExternalStoreWithSelector(t,e,n,o=>o,(o,a)=>{if(VT(o)&&VT(a)&&s.current.length){for(const c of s.current)if(!i(o[c],a[c]))return!1;return!0}return i(o,a)});return M.useMemo(()=>{if(VT(r)){const o={...r};let a={};for(const[c,l]of Object.entries(o))a={...a,[c]:{configurable:!1,enumerable:!0,get:()=>(s.current.includes(c)||s.current.push(c),l)}};return Object.defineProperties(o,a),o}return r},[r])}function mn(t={}){const e=so(t);return m3e(n=>Qee(e,{onChange:n}),()=>b2(e))}var Bb=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},g3e={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},K0,QI,NY,y3e=(NY=class{constructor(){an(this,K0,g3e);an(this,QI,!1)}setTimeoutProvider(t){Nt(this,K0,t)}setTimeout(t,e){return ge(this,K0).setTimeout(t,e)}clearTimeout(t){ge(this,K0).clearTimeout(t)}setInterval(t,e){return ge(this,K0).setInterval(t,e)}clearInterval(t){ge(this,K0).clearInterval(t)}},K0=new WeakMap,QI=new WeakMap,NY),Vm=new y3e;function b3e(t){setTimeout(t,0)}var Ag=typeof window>"u"||"Deno"in globalThis;function oa(){}function w3e(t,e){return typeof t=="function"?t(e):t}function VR(t){return typeof t=="number"&&t>=0&&t!==1/0}function ste(t,e){return Math.max(t+(e||0)-Date.now(),0)}function up(t,e){return typeof t=="function"?t(e):t}function El(t,e){return typeof t=="function"?t(e):t}function EV(t,e){const{type:n="all",exact:i,fetchStatus:s,predicate:r,queryKey:o,stale:a}=t;if(o){if(i){if(e.queryHash!==OO(o,e.options))return!1}else if(!a5(e.queryKey,o))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||s&&s!==e.state.fetchStatus||r&&!r(e))}function _V(t,e){const{exact:n,status:i,predicate:s,mutationKey:r}=t;if(r){if(!e.options.mutationKey)return!1;if(n){if(Tg(e.options.mutationKey)!==Tg(r))return!1}else if(!a5(e.options.mutationKey,r))return!1}return!(i&&e.state.status!==i||s&&!s(e))}function OO(t,e){return((e==null?void 0:e.queryKeyHashFn)||Tg)(t)}function Tg(t){return JSON.stringify(t,(e,n)=>WR(n)?Object.keys(n).sort().reduce((i,s)=>(i[s]=n[s],i),{}):n)}function a5(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>a5(t[n],e[n])):!1}var v3e=Object.prototype.hasOwnProperty;function MO(t,e){if(t===e)return t;const n=SV(t)&&SV(e);if(!n&&!(WR(t)&&WR(e)))return e;const s=(n?t:Object.keys(t)).length,r=n?e:Object.keys(e),o=r.length,a=n?
137new Array(o):{};let c=0;for(let l=0;l<o;l++){const d=n?l:r[l],h=t[d],p=e[d];if(h===p){a[d]=h,(n?l<s:v3e.call(t,d))&&c++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){a[d]=p;continue}const g=MO(h,p);a[d]=g,g===h&&c++}return s===o&&c===s?t:a}function ZE(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function SV(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function WR(t){if(!AV(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!AV(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function AV(t){return Object.prototype.toString.call(t)==="[object Object]"}function C3e(t){return new Promise(e=>{Vm.setTimeout(e,t)})}function qR(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?MO(t,e):e}function x3e(t,e,n=0){const i=[...t,e];return n&&i.length>n?i.slice(1):i}function E3e(t,e,n=0){const i=[e,...t];return n&&i.length>n?i.slice(0,-1):i}var LO=Symbol();function rte(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===LO?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function ote(t,e){return typeof t=="function"?t(...e):!!t}var Jm,Y0,I2,RY,_3e=(RY=class extends Bb{constructor(){super();an(this,Jm);an(this,Y0);an(this,I2);Nt(this,I2,e=>{if(!Ag&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,Y0)||this.setEventListener(ge(this,I2))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,Y0))==null||e.call(this),Nt(this,Y0,void 0))}setEventListener(e){var n;Nt(this,I2,e),(n=ge(this,Y0))==null||n.call(this),Nt(this,Y0,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){ge(this,Jm)!==e&&(Nt(this,Jm,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,Jm)=="boolean"?ge(this,Jm):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Jm=new WeakMap,Y0=new WeakMap,I2=new WeakMap,RY),$O=new _3e;function zR(){let t,e;const n=new Promise((s,r)=>{t=s,e=r});n.status="pending",n.catch(()=>{});function i(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{i({status:"fulfilled",value:s}),t(s)},n.reject=s=>{i({status:"rejected",reason:s}),e(s)},n}var S3e=b3e;function A3e(){let t=[],e=0,n=a=>{a()},i=a=>{a()},s=S3e;const r=a=>{e?t.push(a):s(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&s(()=>{i(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;e++;try{c=a()}finally{e--,e||o()}return c},batchCalls:a=>(...c)=>{r(()=>{a(...c)})},schedule:r,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{s=a}}}var Mr=A3e(),D2,Z0,O2,PY,T3e=(PY=class extends Bb{constructor(){super();an(this,D2,!0);an(this,Z0);an(this,O2);Nt(this,O2,e=>{if(!Ag&&window.addEventListener){const n=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",i)}}})}onSubscribe(){ge(this,Z0)||this.setEventListener(ge(this,O2))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,Z0))==null||e.call(this),Nt(this,Z0,void 0))}setEventListener(e){var n;Nt(this,O2,e),(n=ge(this,Z0))==null||n.call(this),Nt(this,Z0,e(this.setOnline.bind(this)))}setOnline(e){ge(this,D2)!==e&&(Nt(this,D2,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return ge(this,D2)}},D2=new WeakMap,Z0=new WeakMap,O2=new WeakMap,PY),QE=new T3e;function k3e(t){return Math.min(1e3*2**t,3e4)}function ate(t){return(t??"online")==="online"?QE.isOnline():!0}var HR=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function cte(t){let e=!1,n=0,i;const s=zR(),r=()=>s.status!=="pending",o=w=>{var C;if(!r()){const E=new HR(w);p(E),(C=t.onCancel)==null||C.call(t,E)}},a=()=>{e=!0},c=()=>{e=!1},l=()=>$O.isFocused()&&(t.networkMode==="always"||QE.isOnline())&&t.canRun(),d=()=>ate(t.networkMode)&&t.canRun(),h=w=>{r()||(i==null||i(),s.resolve(w))},p=w=>{r()||(i==null||i(),s.reject(w))},g=()=>new Promise(w=>{var C;i=E=>{(r()||l())&&w(E)},(C=t.onPause)==null||C.call(t)}).then(()=>{var w;i=void 0,r()||(w=t.onContinue)==null||w.call(t)}),b=()=>{if(r())return;let w;const C=n===0?t.initialPromise:void 0;try{w=C??t.fn()}catch(E){w=Promise.reject(E)}Promise.resolve(w).then(h).catch(E=>{var P;if(r())return;const T=t.retry??(Ag?0:3),A=t.retryDelay??k3e,k=typeof A=="function"?A(n,E):A,R=T===!0||typeof T=="number"&&n<T||typeof T=="function"&&T(n,E);if(e||!R){p(E);return}n++,(P=t.onFail)==null||P.call(t,n,E),C3e(k).then(()=>l()?void 0:g()).then(()=>{e?p(E):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(i==null||i(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?b():g().then(b),s)}}var eg,IY,lte=(IY=class{constructor(){an(this,eg)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),VR(this.gcTime)&&Nt(this,eg,Vm.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ag?1/0:300*1e3))}
137clearGcTimeout(){ge(this,eg)&&(Vm.clearTimeout(ge(this,eg)),Nt(this,eg,void 0))}},eg=new WeakMap,IY),tg,M2,vl,ng,Yr,e6,ig,pu,Dh,DY,N3e=(DY=class extends lte{constructor(e){super();an(this,pu);an(this,tg);an(this,M2);an(this,vl);an(this,ng);an(this,Yr);an(this,e6);an(this,ig);Nt(this,ig,!1),Nt(this,e6,e.defaultOptions),this.setOptions(e.options),this.observers=[],Nt(this,ng,e.client),Nt(this,vl,ge(this,ng).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Nt(this,tg,kV(this.options)),this.state=e.state??ge(this,tg),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ge(this,Yr))==null?void 0:e.promise}setOptions(e){if(this.options={...ge(this,e6),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=kV(this.options);n.data!==void 0&&(this.setState(TV(n.data,n.dataUpdatedAt)),Nt(this,tg,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,vl).remove(this)}setData(e,n){const i=qR(this.state.data,e,this.options);return Xn(this,pu,Dh).call(this,{data:i,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),i}setState(e,n){Xn(this,pu,Dh).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var i,s;const n=(i=ge(this,Yr))==null?void 0:i.promise;return(s=ge(this,Yr))==null||s.cancel(e),n?n.then(oa).catch(oa):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ge(this,tg))}isActive(){return this.observers.some(e=>El(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===LO||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>up(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!ste(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(i=>i.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,Yr))==null||n.continue()}onOnline(){var n;const e=this.observers.find(i=>i.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,Yr))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ge(this,vl).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ge(this,Yr)&&(ge(this,ig)?ge(this,Yr).cancel({revert:!0}):ge(this,Yr).cancelRetry()),this.scheduleGc()),ge(this,vl).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Xn(this,pu,Dh).call(this,{type:"invalidate"})}async fetch(e,n){var c,l,d,h,p,g,b,w,C,E,T,A;if(this.state.fetchStatus!=="idle"&&((c=ge(this,Yr))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,Yr))return ge(this,Yr).continueRetry(),ge(this,Yr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const k=this.observers.find(R=>R.options.queryFn);k&&this.setOptions(k.options)}const i=new AbortController,s=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(Nt(this,ig,!0),i.signal)})},r=()=>{const k=rte(this.options,n),P=(()=>{const B={client:ge(this,ng),queryKey:this.queryKey,meta:this.meta};return s(B),B})();return Nt(this,ig,!1),this.options.persister?this.options.persister(k,P,this):k(P)},a=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,ng),state:this.state,fetchFn:r};return s(k),k})();(l=this.options.behavior)==null||l.onFetch(a,this),Nt(this,M2,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Xn(this,pu,Dh).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta}),Nt(this,Yr,cte({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:k=>{k instanceof HR&&k.revert&&this.setState({...ge(this,M2),fetchStatus:"idle"}),i.abort()},onFail:(k,R)=>{Xn(this,pu,Dh).call(this,{type:"failed",failureCount:k,error:R})},onPause:()=>{Xn(this,pu,Dh).call(this,{type:"pause"})},onContinue:()=>{Xn(this,pu,Dh).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const k=await ge(this,Yr).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(g=(p=ge(this,vl).config).onSuccess)==null||g.call(p,k,this),(w=(b=ge(this,vl).config).onSettled)==null||w.call(b,k,this.state.error,this),k}catch(k){if(k instanceof HR){if(k.silent)return ge(this,Yr).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw Xn(this,pu,Dh).call(this,{type:"error",error:k}),(E=(C=ge(this,vl).config).onError)==null||E.call(C,k,this),(A=(T=ge(this,vl).config).onSettled)==null||A.call(T,this.state.data,k,this),k}finally{this.scheduleGc()}}},tg=new WeakMap,M2=new WeakMap,vl=new WeakMap,ng=new WeakMap,Yr=new WeakMap,e6=new WeakMap,ig=new WeakMap,pu=new WeakSet,Dh=function(e){const n=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...ute(i.data,this.options),fetchMeta:e.meta??null};case"success":const s={...i,...TV(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Nt(this,M2,e.manual?s:void 0),s;case"error":const r=e.error;
137return{...i,error:r,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=n(this.state),Mr.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),ge(this,vl).notify({query:this,type:"updated",action:e})})},DY);function ute(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ate(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function TV(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function kV(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,i=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Fa,mi,t6,na,sg,L2,Wh,Q0,n6,$2,U2,rg,og,X0,B2,$i,Xv,GR,KR,YR,ZR,QR,XR,JR,hte,OY,dte=(OY=class extends Bb{constructor(e,n){super();an(this,$i);an(this,Fa);an(this,mi);an(this,t6);an(this,na);an(this,sg);an(this,L2);an(this,Wh);an(this,Q0);an(this,n6);an(this,$2);an(this,U2);an(this,rg);an(this,og);an(this,X0);an(this,B2,new Set);this.options=n,Nt(this,Fa,e),Nt(this,Q0,null),Nt(this,Wh,zR()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,mi).addObserver(this),NV(ge(this,mi),this.options)?Xn(this,$i,Xv).call(this):this.updateResult(),Xn(this,$i,ZR).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return eP(ge(this,mi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return eP(ge(this,mi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Xn(this,$i,QR).call(this),Xn(this,$i,XR).call(this),ge(this,mi).removeObserver(this)}setOptions(e){const n=this.options,i=ge(this,mi);if(this.options=ge(this,Fa).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof El(this.options.enabled,ge(this,mi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Xn(this,$i,JR).call(this),ge(this,mi).setOptions(this.options),n._defaulted&&!ZE(this.options,n)&&ge(this,Fa).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,mi),observer:this});const s=this.hasListeners();s&&RV(ge(this,mi),i,this.options,n)&&Xn(this,$i,Xv).call(this),this.updateResult(),s&&(ge(this,mi)!==i||El(this.options.enabled,ge(this,mi))!==El(n.enabled,ge(this,mi))||up(this.options.staleTime,ge(this,mi))!==up(n.staleTime,ge(this,mi)))&&Xn(this,$i,GR).call(this);const r=Xn(this,$i,KR).call(this);s&&(ge(this,mi)!==i||El(this.options.enabled,ge(this,mi))!==El(n.enabled,ge(this,mi))||r!==ge(this,X0))&&Xn(this,$i,YR).call(this,r)}getOptimisticResult(e){const n=ge(this,Fa).getQueryCache().build(ge(this,Fa),e),i=this.createResult(n,e);return P3e(this,i)&&(Nt(this,na,i),Nt(this,L2,this.options),Nt(this,sg,ge(this,mi).state)),i}getCurrentResult(){return ge(this,na)}trackResult(e,n){return new Proxy(e,{get:(i,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ge(this,Wh).status==="pending"&&ge(this,Wh).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,s))})}trackProp(e){ge(this,B2).add(e)}getCurrentQuery(){return ge(this,mi)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ge(this,Fa).defaultQueryOptions(e),i=ge(this,Fa).getQueryCache().build(ge(this,Fa),n);return i.fetch().then(()=>this.createResult(i,n))}fetch(e){return Xn(this,$i,Xv).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,na)))}createResult(e,n){var z;const i=ge(this,mi),s=this.options,r=ge(this,na),o=ge(this,sg),a=ge(this,L2),l=e!==i?e.state:ge(this,t6),{state:d}=e;let h={...d},p=!1,g;if(n._optimisticResults){const K=this.hasListeners(),q=!K&&NV(e,n),G=K&&RV(e,i,n,s);(q||G)&&(h={...h,...ute(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:b,errorUpdatedAt:w,status:C}=h;g=h.data;let E=!1;if(n.placeholderData!==void 0&&g===void 0&&C==="pending"){let K;r!=null&&r.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(K=r.data,E=!0):K=typeof n.placeholderData=="function"?n.placeholderData((z=ge(this,U2))==null?void 0:z.state.data,ge(this,U2)):n.placeholderData,K!==void 0&&(C="success",g=qR(r==null?void 0:r.data,K,n),p=!0)}if(n.select&&g!==void 0&&!E)if(r&&g===(o==null?void 0:o.data)&&n.select===ge(this,n6))g=ge(this,$2);else try{Nt(this,n6,n.select),g=n.select(g),g=qR(r==null?void 0:r.data,g,n),Nt(this,$2,g),Nt(this,Q0,null)}catch(K){Nt(this,Q0,K)}ge(this,Q0)&&(b=ge(this,Q0),g=ge(this,$2),w=Date.now(),C="error");const T=h.fetchStatus==="fetching",A=C==="pending",k=C==="error",R=A&&T,P=g!==void 0,F={status:C,fetchStatus:h.fetchStatus,isPending:A,isSuccess:C==="success",isError:k,isInitialLoading:R,isLoading:R,data:g,dataUpdatedAt:h.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdate
vendor: 4,232 bytes, line 137
137Count:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>l.dataUpdateCount||h.errorUpdateCount>l.errorUpdateCount,isFetching:T,isRefetching:T&&!A,isLoadingError:k&&!P,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:k&&P,isStale:UO(e,n),refetch:this.refetch,promise:ge(this,Wh),isEnabled:El(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const K=I=>{F.status==="error"?I.reject(F.error):F.data!==void 0&&I.resolve(F.data)},q=()=>{const I=Nt(this,Wh,F.promise=zR());K(I)},G=ge(this,Wh);switch(G.status){case"pending":e.queryHash===i.queryHash&&K(G);break;case"fulfilled":(F.status==="error"||F.data!==G.value)&&q();break;case"rejected":(F.status!=="error"||F.error!==G.reason)&&q();break}}return F}updateResult(){const e=ge(this,na),n=this.createResult(ge(this,mi),this.options);if(Nt(this,sg,ge(this,mi).state),Nt(this,L2,this.options),ge(this,sg).data!==void 0&&Nt(this,U2,ge(this,mi)),ZE(n,e))return;Nt(this,na,n);const i=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,r=typeof s=="function"?s():s;if(r==="all"||!r&&!ge(this,B2).size)return!0;const o=new Set(r??ge(this,B2));return this.options.throwOnError&&o.add("error"),Object.keys(ge(this,na)).some(a=>{const c=a;return ge(this,na)[c]!==e[c]&&o.has(c)})};Xn(this,$i,hte).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Xn(this,$i,ZR).call(this)}},Fa=new WeakMap,mi=new WeakMap,t6=new WeakMap,na=new WeakMap,sg=new WeakMap,L2=new WeakMap,Wh=new WeakMap,Q0=new WeakMap,n6=new WeakMap,$2=new WeakMap,U2=new WeakMap,rg=new WeakMap,og=new WeakMap,X0=new WeakMap,B2=new WeakMap,$i=new WeakSet,Xv=function(e){Xn(this,$i,JR).call(this);let n=ge(this,mi).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(oa)),n},GR=function(){Xn(this,$i,QR).call(this);const e=up(this.options.staleTime,ge(this,mi));if(Ag||ge(this,na).isStale||!VR(e))return;const i=ste(ge(this,na).dataUpdatedAt,e)+1;Nt(this,rg,Vm.setTimeout(()=>{ge(this,na).isStale||this.updateResult()},i))},KR=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,mi)):this.options.refetchInterval)??!1},YR=function(e){Xn(this,$i,XR).call(this),Nt(this,X0,e),!(Ag||El(this.options.enabled,ge(this,mi))===!1||!VR(ge(this,X0))||ge(this,X0)===0)&&Nt(this,og,Vm.setInterval(()=>{(this.options.refetchIntervalInBackground||$O.isFocused())&&Xn(this,$i,Xv).call(this)},ge(this,X0)))},ZR=function(){Xn(this,$i,GR).call(this),Xn(this,$i,YR).call(this,Xn(this,$i,KR).call(this))},QR=function(){ge(this,rg)&&(Vm.clearTimeout(ge(this,rg)),Nt(this,rg,void 0))},XR=function(){ge(this,og)&&(Vm.clearInterval(ge(this,og)),Nt(this,og,void 0))},JR=function(){const e=ge(this,Fa).getQueryCache().build(ge(this,Fa),this.options);if(e===ge(this,mi))return;const n=ge(this,mi);Nt(this,mi,e),Nt(this,t6,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},hte=function(e){Mr.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,na))}),ge(this,Fa).getQueryCache().notify({query:ge(this,mi),type:"observerResultsUpdated"})})},OY);function R3e(t,e){return El(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function NV(t,e){return R3e(t,e)||t.state.data!==void 0&&eP(t,e,e.refetchOnMount)}function eP(t,e,n){if(El(e.enabled,t)!==!1&&up(e.staleTime,t)!=="static"){const i=typeof n=="function"?n(t):n;return i==="always"||i!==!1&&UO(t,e)}return!1}function RV(t,e,n,i){return(t!==e||El(i.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&UO(t,n)}function UO(t,e){return El(e.enabled,t)!==!1&&t.isStaleByTime(up(e.staleTime,t))}function P3e(t,e){return!ZE(t.getCurrentResult(),e)}function XE(t){return{onFetch:(e,n)=>{var d,h,p,g,b;const i=e.options,s=(p=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:p.direction,r=((g=e.state.data)==null?void 0:g.pages)||[],o=((b=e.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const l=async()=>{let w=!1;const C=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(e.signal.aborted?w=!0:e.signal.addEventListener("abort",()=>{w=!0}),e.signal)}
137)},E=rte(e.options,e.fetchOptions),T=async(A,k,R)=>{if(w)return Promise.reject();if(k==null&&A.pages.length)return Promise.resolve(A);const B=(()=>{const q={client:e.client,queryKey:e.queryKey,pageParam:k,direction:R?"backward":"forward",meta:e.options.meta};return C(q),q})(),F=await E(B),{maxPages:z}=e.options,K=R?E3e:x3e;return{pages:K(A.pages,F,z),pageParams:K(A.pageParams,k,z)}};if(s&&r.length){const A=s==="backward",k=A?fte:tP,R={pages:r,pageParams:o},P=k(i,R);a=await T(R,P,A)}else{const A=t??r.length;do{const k=c===0?o[0]??i.initialPageParam:tP(i,a);if(c>0&&k==null)break;a=await T(a,k),c++}while(c<A)}return a};e.options.persister?e.fetchFn=()=>{var w,C;return(C=(w=e.options).persister)==null?void 0:C.call(w,l,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=l}}}function tP(t,{pages:e,pageParams:n}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,n[i],n):void 0}function fte(t,{pages:e,pageParams:n}){var i;return e.length>0?(i=t.getPreviousPageParam)==null?void 0:i.call(t,e[0],e,n[0],n):void 0}function I3e(t,e){return e?tP(t,e)!=null:!1}function D3e(t,e){return!e||!t.getPreviousPageParam?!1:fte(t,e)!=null}var O3e=class extends dte{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:XE()})}getOptimisticResult(t){return t.behavior=XE(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var b,w;const{state:n}=t,i=super.createResult(t,e),{isFetching:s,isRefetching:r,isError:o,isRefetchError:a}=i,c=(w=(b=n.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:w.direction,l=o&&c==="forward",d=s&&c==="forward",h=o&&c==="backward",p=s&&c==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:I3e(e,n.data),hasPreviousPage:D3e(e,n.data),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:h,isFetchingPreviousPage:p,isRefetchError:a&&!l&&!h,isRefetching:r&&!d&&!p}}},i6,pd,ia,ag,md,M0,MY,M3e=(MY=class extends lte{constructor(e){super();an(this,md);an(this,i6);an(this,pd);an(this,ia);an(this,ag);Nt(this,i6,e.client),this.mutationId=e.mutationId,Nt(this,ia,e.mutationCache),Nt(this,pd,[]),this.state=e.state||pte(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ge(this,pd).includes(e)||(ge(this,pd).push(e),this.clearGcTimeout(),ge(this,ia).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Nt(this,pd,ge(this,pd).filter(n=>n!==e)),this.scheduleGc(),ge(this,ia).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,pd).length||(this.state.status==="pending"?this.scheduleGc():ge(this,ia).remove(this))}continue(){var e;return((e=ge(this,ag))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,c,l,d,h,p,g,b,w,C,E,T,A,k,R,P,B,F,z;const n=()=>{Xn(this,md,M0).call(this,{type:"continue"})},i={client:ge(this,i6),meta:this.options.meta,mutationKey:this.options.mutationKey};Nt(this,ag,cte({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(K,q)=>{Xn(this,md,M0).call(this,{type:"failed",failureCount:K,error:q})},onPause:()=>{Xn(this,md,M0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,ia).canRun(this)}));const s=this.state.status==="pending",r=!ge(this,ag).canStart();try{if(s)n();else{Xn(this,md,M0).call(this,{type:"pending",variables:e,isPaused:r}),await((a=(o=ge(this,ia).config).onMutate)==null?void 0:a.call(o,e,this,i));const q=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,e,i));q!==this.state.context&&Xn(this,md,M0).call(this,{type:"pending",context:q,variables:e,isPaused:r})}const K=await ge(this,ag).start();return await((h=(d=ge(this,ia).config).onSuccess)==null?void 0:h.call(d,K,e,this.state.context,this,i)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,K,e,this.state.context,i)),await((w=(b=ge(this,ia).config).onSettled)==null?void 0:w.call(b,K,null,this.state.variables,this.state.context,this,i)),await((E=(C=this.options).onSettled)==null?void 0:E.
137call(C,K,null,e,this.state.context,i)),Xn(this,md,M0).call(this,{type:"success",data:K}),K}catch(K){try{throw await((A=(T=ge(this,ia).config).onError)==null?void 0:A.call(T,K,e,this.state.context,this,i)),await((R=(k=this.options).onError)==null?void 0:R.call(k,K,e,this.state.context,i)),await((B=(P=ge(this,ia).config).onSettled)==null?void 0:B.call(P,void 0,K,this.state.variables,this.state.context,this,i)),await((z=(F=this.options).onSettled)==null?void 0:z.call(F,void 0,K,e,this.state.context,i)),K}finally{Xn(this,md,M0).call(this,{type:"error",error:K})}}finally{ge(this,ia).runNext(this)}}},i6=new WeakMap,pd=new WeakMap,ia=new WeakMap,ag=new WeakMap,md=new WeakSet,M0=function(e){const n=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Mr.batch(()=>{ge(this,pd).forEach(i=>{i.onMutationUpdate(e)}),ge(this,ia).notify({mutation:this,type:"updated",action:e})})},MY);function pte(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var qh,mu,s6,LY,L3e=(LY=class extends Bb{constructor(e={}){super();an(this,qh);an(this,mu);an(this,s6);this.config=e,Nt(this,qh,new Set),Nt(this,mu,new Map),Nt(this,s6,0)}build(e,n,i){const s=new M3e({client:e,mutationCache:this,mutationId:++OC(this,s6)._,options:e.defaultMutationOptions(n),state:i});return this.add(s),s}add(e){ge(this,qh).add(e);const n=JC(e);if(typeof n=="string"){const i=ge(this,mu).get(n);i?i.push(e):ge(this,mu).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,qh).delete(e)){const n=JC(e);if(typeof n=="string"){const i=ge(this,mu).get(n);if(i)if(i.length>1){const s=i.indexOf(e);s!==-1&&i.splice(s,1)}else i[0]===e&&ge(this,mu).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=JC(e);if(typeof n=="string"){const i=ge(this,mu).get(n),s=i==null?void 0:i.find(r=>r.state.status==="pending");return!s||s===e}else return!0}runNext(e){var i;const n=JC(e);if(typeof n=="string"){const s=(i=ge(this,mu).get(n))==null?void 0:i.find(r=>
vendor: 5,558 bytes, line 137
137r!==e&&r.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Mr.batch(()=>{ge(this,qh).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,qh).clear(),ge(this,mu).clear()})}getAll(){return Array.from(ge(this,qh))}find(e){const n={exact:!0,...e};return this.getAll().find(i=>_V(n,i))}findAll(e={}){return this.getAll().filter(n=>_V(e,n))}notify(e){Mr.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Mr.batch(()=>Promise.all(e.map(n=>n.continue().catch(oa))))}},qh=new WeakMap,mu=new WeakMap,s6=new WeakMap,LY);function JC(t){var e;return(e=t.options.scope)==null?void 0:e.id}var zh,J0,ja,Hh,df,sE,nP,$Y,$3e=($Y=class extends Bb{constructor(n,i){super();an(this,df);an(this,zh);an(this,J0);an(this,ja);an(this,Hh);Nt(this,zh,n),this.setOptions(i),this.bindMethods(),Xn(this,df,sE).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const i=this.options;this.options=ge(this,zh).defaultMutationOptions(n),ZE(this.options,i)||ge(this,zh).getMutationCache().notify({type:"observerOptionsUpdated",mutation:ge(this,ja),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&Tg(i.mutationKey)!==Tg(this.options.mutationKey)?this.reset():((s=ge(this,ja))==null?void 0:s.state.status)==="pending"&&ge(this,ja).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=ge(this,ja))==null||n.removeObserver(this)}onMutationUpdate(n){Xn(this,df,sE).call(this),Xn(this,df,nP).call(this,n)}getCurrentResult(){return ge(this,J0)}reset(){var n;(n=ge(this,ja))==null||n.removeObserver(this),Nt(this,ja,void 0),Xn(this,df,sE).call(this),Xn(this,df,nP).call(this)}mutate(n,i){var s;return Nt(this,Hh,i),(s=ge(this,ja))==null||s.removeObserver(this),Nt(this,ja,ge(this,zh).getMutationCache().build(ge(this,zh),this.options)),ge(this,ja).addObserver(this),ge(this,ja).execute(n)}},zh=new WeakMap,J0=new WeakMap,ja=new WeakMap,Hh=new WeakMap,df=new WeakSet,sE=function(){var i;const n=((i=ge(this,ja))==null?void 0:i.state)??pte();Nt(this,J0,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},nP=function(n){Mr.batch(()=>{var i,s,r,o,a,c,l,d;if(ge(this,Hh)&&this.hasListeners()){const h=ge(this,J0).variables,p=ge(this,J0).context,g={client:ge(this,zh),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((s=(i=ge(this,Hh)).onSuccess)==null||s.call(i,n.data,h,p,g),(o=(r=ge(this,Hh)).onSettled)==null||o.call(r,n.data,null,h,p,g)):(n==null?void 0:n.type)==="error"&&((c=(a=ge(this,Hh)).onError)==null||c.call(a,n.error,h,p,g),(d=(l=ge(this,Hh)).onSettled)==null||d.call(l,void 0,n.error,h,p,g))}this.listeners.forEach(h=>{h(ge(this,J0))})})},$Y),gd,UY,U3e=(UY=class extends Bb{constructor(e={}){super();an(this,gd);this.config=e,Nt(this,gd,new Map)}build(e,n,i){const s=n.queryKey,r=n.queryHash??OO(s,n);let o=this.get(r);return o||(o=new N3e({client:e,queryKey:s,queryHash:r,options:e.defaultQueryOptions(n),state:i,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){ge(this,gd).has(e.queryHash)||(ge(this,gd).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ge(this,gd).get(e.queryHash);n&&(e.destroy(),n===e&&ge(this,gd).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Mr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ge(this,gd).get(e)}getAll(){return[...ge(this,gd).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(i=>EV(n,i))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(i=>EV(e,i)):n}notify(e){Mr.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Mr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Mr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},gd=new WeakMap,UY),zs,ep,tp,F2,j2,np,V2,W2,BY,B3e=(BY=class{constructor(t={}){an(this,zs);an(this,ep);an(this,tp);an(this,F2);an(this,j2);an(this,np);an(this,V2);an(this,W2);Nt(this,zs,t.queryCache||new U3e),Nt(this,ep,t.mutationCache||new L3e),Nt(this,tp,t.defaultOptions||{}),Nt(this,F2,new Map),Nt(this,j2,new Map),Nt(this,np,0)}mount(){OC(this,np)._++,ge(this,np)===1&&(Nt(this,V2,$O.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,zs).onFocus())})),Nt(this,W2,QE.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,zs).onOnline())})))}unmount(){var t,e;OC(this,np)._--,ge(this,np)===0&&((t=ge(this,V2))==null||t.call(this),Nt(this,V2,void 0),(e=ge(this,W2))==null||e.call(this),Nt(this,W2,void 0))}isFetching(t){return ge(this,zs).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,ep).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,zs).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ge(this,zs).build(this,e),i=n.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(up(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return ge(this,zs).findAll(t).map(({queryKey:e,state:n})=>{const i=n.data;return[e,i]})}setQueryData(t,e,n){const i=this.defaultQueryOptions({queryKey:t}),s=ge(this,zs).get(i.queryHash),r=s==null?void 0:s.state.data,o=w3e(e,r);if(o!==void 0)return ge(this,zs).build(this,i).setData(o,{...n,manual:!0})}
137setQueriesData(t,e,n){return Mr.batch(()=>ge(this,zs).findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,zs).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,zs);Mr.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,zs);return Mr.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},i=Mr.batch(()=>ge(this,zs).findAll(t).map(s=>s.cancel(n)));return Promise.all(i).then(oa).catch(oa)}invalidateQueries(t,e={}){return Mr.batch(()=>(ge(this,zs).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},i=Mr.batch(()=>ge(this,zs).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let r=s.fetch(void 0,n);return n.throwOnError||(r=r.catch(oa)),s.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(i).then(oa)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,zs).build(this,e);return n.isStaleByTime(up(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(oa).catch(oa)}fetchInfiniteQuery(t){return t.behavior=XE(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(oa).catch(oa)}ensureInfiniteQueryData(t){return t.behavior=XE(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return QE.isOnline()?ge(this,ep).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,zs)}getMutationCache(){return ge(this,ep)}getDefaultOptions(){return ge(this,tp)}setDefaultOptions(t){Nt(this,tp,t)}setQueryDefaults(t,e){ge(this,F2).set(Tg(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,F2).values()],n={};return e.forEach(i=>{a5(t,i.queryKey)&&Object.assign(n,i.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,j2).set(Tg(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,j2).values()],n={};return e.forEach(i=>{a5(t,i.mutationKey)&&Object.assign(n,i.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,tp).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=OO(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===LO&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,tp).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,zs).clear(),ge(this,ep).clear()}},zs=new WeakMap,ep=new WeakMap,tp=new WeakMap,F2=new WeakMap,j2=new WeakMap,np=new WeakMap,V2=new WeakMap,W2=new WeakMap,BY);function mte(t,e){return MO(t,e)}function F3e(t){return JSON.stringify(t,(e,n)=>j3e(n)?Object.keys(n).sort().reduce((i,s)=>(i[s]=n[s],i),{}):typeof n=="bigint"?n.toString():n)}function j3e(t){if(!PV(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const n=e.prototype;return!(!PV(n)||!n.hasOwnProperty("isPrototypeOf"))}function PV(t){return Object.prototype.toString.call(t)==="[object Object]"}function Fb(t){const{_defaulted:e,behavior:n,gcTime:i,initialData:s,initialDataUpdatedAt:r,maxPages:o,meta:a,networkMode:c,queryFn:l,queryHash:d,queryKey:h,queryKeyHashFn:p,retry:g,retryDelay:b,structuralSharing:w,getPreviousPageParam:C,getNextPageParam:E,initialPageParam:T,_optimisticResults:A,enabled:k,notifyOnChangeProps:R,placeholderData:P,refetchInterval:B,refetchIntervalInBackground:F,refetchOnMount:z,refetchOnReconnect:K,refetchOnWindowFocus:q,retryOnMount:G,select:I,staleTime:S,suspense:v,throwOnError:_,config:N,connector:$,query:U,...j}=t;return j}function V3e(t){return{mutationFn(e){return $R(t,e)},mutationKey:["disconnect"]}}function W3e(t,e={}){return{async queryFn({queryKey:n}){const{address:i,scopeKey:s,...r}=n[1];if(!i)throw new Error("address is required");return await Gee(t,{...r,address:i})??null},queryKey:q3e(e)}}function q3e(t={}){return["balance",Fb(t)]}function z3e(t,e={}){return{gcTime:0,async queryFn({queryKey:n}){const{connector:i}=e,{connectorUid:s,scopeKey:r,...o}=n[1];return Ub(t,{...o,connector:i})},queryKey:H3e(e)}}function H3e(t={}){const{connector:e,...n}=t;return["connectorClient",{...Fb(n),connectorUid:e==null?void 0:e.uid}]}function G3e(t,e={}){return{async queryFn({queryKey:n}){const i=e.abi;if(!i)throw new Error("abi is required");const{functionName:s,scopeKey:r,...o}=n[1],a=(()=>{const c=n[1];if(c.address)return{address:c.address};
137if(c.code)return{code:c.code};throw new Error("address or code is required")})();if(!s)throw new Error("functionName is required");return zee(t,{abi:i,functionName:s,args:o.args,...a,...o})},queryKey:K3e(e)}}function K3e(t={}){const{abi:e,...n}=t;return["readContract",Fb(n)]}function Y3e(t,e={}){return{async queryFn({queryKey:n}){var a;const i=[],s=n[1].contracts.length;for(let c=0;c<s;c++){const l=n[1].contracts[c],d=((a=e.contracts)==null?void 0:a[c]).abi;i.push({...l,abi:d})}const{scopeKey:r,...o}=n[1];return Hee(t,{...o,contracts:i})},queryKey:Z3e(e)}}function Z3e(t={}){const e=[];for(const n of t.contracts??[]){const{abi:i,...s}=n;e.push({...s,chainId:s.chainId??t.chainId})}return["readContracts",Fb({...t,contracts:e})]}function Q3e(t){return{mutationFn(e){return l3(t,e)},mutationKey:["reconnect"]}}function X3e(t){return{mutationFn(e){return Kee(t,e)},mutationKey:["sendTransaction"]}}function J3e(t){return{mutationFn(e){return Yee(t,e)},mutationKey:["signMessage"]}}function e5e(t,e={}){return{async queryFn({queryKey:n}){const{abi:i,connector:s}=e;if(!i)throw new Error("abi is required");const{scopeKey:r,...o}=n[1],{address:a,functionName:c}=o;if(!a)throw new Error("address is required");if(!c)throw new Error("functionName is required");return Pve(t,{abi:i,connector:s,...o})},queryKey:t5e(e)}}function t5e(t={}){const{abi:e,connector:n,...i}=t;return["simulateContract",Fb(i)]}function n5e(t){return{mutationFn(e){return BR(t,e)},mutationKey:["switchChain"]}}function i5e(t,e={}){return{async queryFn({queryKey:n}){const{hash:i,...s}=n[1];if(!i)throw new Error("hash is required");return Zee(t,{...s,onReplaced:e.onReplaced,hash:i})},queryKey:s5e(e)}}function s5e(t={}){const{onReplaced:e,...n}=t;return["waitForTransactionReceipt",Fb(n)]}function r5e(t){return{mutationFn(e){return Jee(t,e)},mutationKey:["writeContract"]}}var gte=M.createContext(void 0),Kc=t=>{const e=M.useContext(gte);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},o5e=({client:t,children:e})=>(M.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),m.jsx(gte.Provider,{value:t,children:e})),yte=M.createContext(!1),a5e=()=>M.useContext(yte);yte.Provider;function c5e(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var l5e=M.createContext(c5e()),u5e=()=>M.useContext(l5e),d5e=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},h5e=t=>{M.useEffect(()=>{t.clearReset()},[t])},f5e=({result:t,errorResetBoundary:e,throwOnError:n,query:i,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(s&&t.data===void 0||ote(n,[t.error,i])),p5e=t=>{if(t.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...s)=>n(i(...s)):n(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},m5e=(t,e)=>t.isLoading&&t.isFetching&&!e,g5e=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,IV=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function bte(t,e,n){var h,p,g,b,w;const i=a5e(),s=u5e(),r=Kc(),o=r.defaultQueryOptions(t);(p=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||p.call(h,o),o._optimisticResults=i?"isRestoring":"optimistic",p5e(o),d5e(o,s),h5e(s);const a=!r.getQueryCache().get(o.queryHash),[c]=M.useState(()=>new e(r,o)),l=c.getOptimisticResult(o),d=!i&&t.subscribed!==!1;if(M.useSyncExternalStore(M.useCallback(C=>{const E=d?c.subscribe(Mr.batchCalls(C)):oa;return c.updateResult(),E},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setOptions(o)},[o,c]),g5e(o,l))throw IV(o,c,s);if(f5e({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((b=(g=r.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||b.call(g,o,l),o.experimental_prefetchInRender&&!Ag&&m5e(l,i)){const C=a?IV(o,c,s):(w=r.getQueryCache().get(o.queryHash))==null?void 0:w.promise;C==null||C.catch(oa).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function Zt(t,e){return bte(t,dte)}function Fp(t,e){const n=Kc(),[i]=M.useState(()=>new $3e(n,t));M.useEffect(()=>{i.setOptions(t)},[i,t]);const s=M.useSyncExternalStore(M.useCallback(o=>i.subscribe(Mr.batchCalls(o)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),r=M.useCallback((o,a)=>{i.mutate(o,a).catch(oa)},[i]);if(s.error&&ote(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:r,mutateAsync:s.mutate}}function nS(t,e){return bte(t,O3e)}function jb(t){const e=Zt({...t,queryKeyHashFn:F3e});return e.queryKey=t.queryKey,e}function y1(t={}){const e=so(t);return M.useSyncExternalStore(n=>Ove(e,{onChange:n}),()=>fV(e),()=>fV(e))}function wf(t={}){const{address:e,query:n={}}=t,i=so(t),s=y1({config:i}),r=W3e(i,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return jb({...n,...r,enabled:o})}function y5e(t={}){const{enabled:e=!0,onBlockNumber:n,config:i,...s}=t,r=so(t),o=y1({config:r}),a=t.chainId??o;M.useEffect(()=>{if(e&&n)return Dve(r,{...s,chainId:a,onBlockNumber:n})},[a,r,e,n,s.onError,s.emitMissed,s.emitOnBegin,s.poll,s.pollingInterval,s.syncConnectedChain])}function b5e(t={}){const e=so(t);return M.useSyncExternalStore(n=>u3e(e,{onChange:n}),()=>pV(e),()=>pV(e))}function w5e(t={}){const e=so(t);return M.useSyncExternalStore(n=>Xee(e,{onChange:n}),()=>uu(e),()=>uu(e))}function v5e(t={}){const{query:e={},...n}=t,i=so(n),s=Kc(),{address:r,connector:o,status:a}=mn({config:i}),c=y1({config:i}),l=t.connector??o,{queryKey:d,...h}=z3e(i,{...t,chainId:t.chainId??c,connector:l}),p=!!((a==="connected"||a==="reconnecting"&&(l!=null&&l.getProvider))&&(e.enabled??!0)),g=M.useRef(r);return M.useEffect(()=>{const b=g.current;!r&&b?(s.removeQueries({queryKey:d}),g.current=void 0):r!==b&&(s.invalidateQueries({queryKey:d}),g.current=r)},[r,s]),jb({...e,...h,queryKey:d,enabled:p,staleTime:Number.POSITIVE_INFINITY})}function C5e(t={}){const{mutation:e}=t,n=so(t),i=V3e(n),{mutate:s,mutateAsync:r,...o}=Fp({...e,...i});return{...o,connectors:w5e({config:n}).map(a=>a.connector),disconnect:s,disconnectAsync:r}}function x5e(t={}){const e=so(t);return ite.useSyncExternalStoreWithSelector(n=>$ve(e,{onChange:n}),()=>UR(e,t),()=>UR(e,t),n=>n,(n,i)=>(n==null?void 0:n.uid)===(i==null?void 0:i.uid))}function Si(t={}){const{abi:e,address:n,functionName:i,query:s={}}=t,r=t.code,o=so(t),a=y1({config:o}),c=G3e(o,{...t,chainId:t.chainId??a}),l=!!((n||r)&&e&&i&&(s.enabled??!0));return jb({...s,...c,enabled:l,structuralSharing:s.structuralSharing??mte})}function vf(t={}){const{contracts:e=[],query:n={}}=t,i=so(t),s=y1({config:i}),r=M.useMemo(()=>
137{if(e.length===0)return;const c=e[0].chainId;if(e.every(l=>l.chainId===c))return c},[e]),o=Y3e(i,{...t,chainId:r??s}),a=M.useMemo(()=>{let c=!1;for(const l of e){const{abi:d,address:h,functionName:p}=l;if(!d||!h||!p){c=!1;break}c=!0}return!!(c&&(n.enabled??!0))},[e,n.enabled]);return jb({...o,...n,enabled:a,structuralSharing:n.structuralSharing??mte})}function E5e(t={}){const{mutation:e}=t,n=so(t),i=Q3e(n),{mutate:s,mutateAsync:r,...o}=Fp({...e,...i});return{...o,connectors:n.connectors,reconnect:s,reconnectAsync:r}}function _5e(t={}){const{mutation:e}=t,n=so(t),i=X3e(n),{mutate:s,mutateAsync:r,...o}=Fp({...e,...i});return{...o,sendTransaction:s,sendTransactionAsync:r}}function wte(t={}){const{mutation:e}=t,n=so(t),i=J3e(n),{mutate:s,mutateAsync:r,...o}=Fp({...e,...i});return{...o,signMessage:s,signMessageAsync:r}}function $r(t={}){const{abi:e,address:n,connector:i,functionName:s,query:r={}}=t,o=so(t),{data:a}=v5e({config:o,connector:i,query:{enabled:t.account===void 0}}),c=y1({config:o}),l=e5e(o,{...t,account:t.account??(a==null?void 0:a.account),chainId:t.chainId??c}),d=!!(e&&n&&s&&(r.enabled??!0));return jb({...r,...l,enabled:d})}function S5e(t={}){const{mutation:e}=t,n=so(t),i=n5e(n),{mutate:s,mutateAsync:r,...o}=Fp({...e,...i});return{...o,chains:b5e({config:n}),switchChain:s,switchChainAsync:r}}function Ts(t={}){const{hash:e,query:n={}}=t,i=so(t),s=y1({config:i}),r=i5e(i,{...t,chainId:t.chainId??s}),o=!!(e&&(n.enabled??!0));return jb({...n,...r,enabled:o})}function Ls(t={}){const{mutation:e}=t,n=so(t),i=r5e(n),{mutate:s,mutateAsync:r,...o}=Fp({...e,...i});return{...o,writeContract:s,writeContractAsync:r}}const bu=JJ({id:80094,name:"Berachain",blockTime:2e3,nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0},ensRegistry:{address:"0x5b22280886a2f5e09a49bea7e320eab0e5320e28",blockCreated:877007},ensUniversalResolver:{address:"0x4D41762915F83c76EcaF6776d9b08076aA32b492",blockCreated:9310021}},rpcUrls:{default:{http:["https://rpc.berachain.com"]}},blockExplorers:{default:{name:"Berascan",url:"https://berascan.com"}},ensTlds:[".bera"],testnet:!1}),A5e=Symbol(),BO=Symbol(),Jv="a",vte="f",DV="p",Cte="c",xte="t",FO="h",u3="w",jO="o",VO="k";let T5e=(t,e)=>new Proxy(t,e);const iP=Object.getPrototypeOf,sP=new WeakMap,Ete=t=>t&&(sP.has(t)?sP.get(t):iP(t)===Object.prototype||iP(t)===Array.prototype),JE=t=>typeof t=="object"&&t!==null,k5e=t=>Object.values(Object.getOwnPropertyDescriptors(t)).some(e=>!e.configurable&&!e.writable),N5e=t=>{if(Array.isArray(t))return Array.from(t);const e=Object.getOwnPropertyDescriptors(t);return Object.values(e).forEach(n=>{n.configurable=!0}),Object.create(iP(t),e)},R5e=(t,e)=>{const n={[vte]:e};let i=!1;const s=(a,c)=>{if(!i){let l=n[Jv].get(t);if(l||(l={},n[Jv].set(t,l)),a===u3)l[u3]=!0;else{let d=l[a];d||(d=new Set,l[a]=d),d.add(c)}}},r=()=>{i=!0,n[Jv].delete(t)},o={get(a,c){return c===BO?t:(s(VO,c),_te(Reflect.get(a,c),n[Jv],n[Cte],n[xte]))},has(a,c){return c===A5e?(r(),!0):(s(FO,c),Reflect.has(a,c))},getOwnPropertyDescriptor(a,c){return s(jO,c),Reflect.getOwnPropertyDescriptor(a,c)},ownKeys(a){return s(u3),Reflect.ownKeys(a)}};return e&&(o.set=o.deleteProperty=()=>!1),[o,n]},WO=t=>t[BO]||t,_te=(t,e,n,i)=>{if(!Ete(t))return t;let s=i&&i.get(t);if(!s){const c=WO(t);k5e(c)?s=[c,N5e(c)]:s=[c],i==null||i.set(t,s)}const[r,o]=s;let a=n&&n.get(r);return(!a||a[1][vte]!==!!o)&&(a=R5e(r,!!o),a[1][DV]=T5e(o||r,a[0]),n&&n.set(r,a)),a[1][Jv]=e,a[1][Cte]=n,a[1][xte]=i,a[1][DV]},P5e=(t,e)=>{const n=Reflect.ownKeys(t),i=Reflect.ownKeys(e);return n.length!==i.length||n.some((s,r)=>s!==i[r])},Ste=(t,e,n,i,s=Object.is)=>{if(s(t,e))return!1;if(!JE(t)||!JE(e))return!0;const r=n.get(WO(t));if(!r)return!0;if(i){if(i.get(t)===e)return!1;i.set(t,e)}let o=null;for(const a of r[FO]||[])if(o=Reflect.has(t,a)!==Reflect.has(e,a),o)return o;if(r[u3]===!0){if(o=P5e(t,e),o)return o}else for(const a of r[jO]||[]){const c=!!Reflect.getOwnPropertyDescriptor(t,a),l=!!Reflect.getOwnPropertyDescriptor(e,a);if(o=c!==l,o)return o}for(const a of r[VO]||[])if(o=Ste(t[a],e[a],n,i,s),o)return o;if(o===null)throw new Error("invalid used");return o},I5e=t=>Ete(t)&&t[BO]||null,OV=(t,e=!0)=>{sP.set(t,e)},D5e=(t,e,n)=>{const i=[],s=new WeakSet,r=(o,a)=>{var c,l,d;if(s.has(o))return;JE(o)&&s.add(o);
137const h=JE(o)&&e.get(WO(o));if(h){if((c=h[FO])===null||c===void 0||c.forEach(p=>{const g=`:has(${String(p)})`;i.push(a?[...a,g]:[g])}),h[u3]===!0){const p=":ownKeys";i.push(a?[...a,p]:[p])}else(l=h[jO])===null||l===void 0||l.forEach(p=>{const g=`:hasOwn(${String(p)})`;i.push(a?[...a,g]:[g])});(d=h[VO])===null||d===void 0||d.forEach(p=>{"value"in(Object.getOwnPropertyDescriptor(o,p)||{})&&r(o[p],a?[...a,p]:[p])})}else a&&i.push(a)};return r(t),i},e_={},qO=t=>typeof t=="object"&&t!==null,O5e=t=>qO(t)&&!R6.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer)&&!(t instanceof Promise),Ate=(t,e)=>{const n=rP.get(t);if((n==null?void 0:n[0])===e)return n[1];const i=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));return OV(i,!0),rP.set(t,[e,i]),Reflect.ownKeys(t).forEach(s=>{if(Object.getOwnPropertyDescriptor(i,s))return;const r=Reflect.get(t,s),{enumerable:o}=Reflect.getOwnPropertyDescriptor(t,s),a={value:r,enumerable:o,configurable:!0};if(R6.has(r))OV(r,!1);else if(xp.has(r)){const[c,l]=xp.get(r);a.value=Ate(c,l())}Object.defineProperty(i,s,a)}),Object.preventExtensions(i)},M5e=(t,e,n,i)=>({deleteProperty(s,r){const o=Reflect.get(s,r);n(r);const a=Reflect.deleteProperty(s,r);return a&&i(["delete",[r],o]),a},set(s,r,o,a){const c=!t()&&Reflect.has(s,r),l=Reflect.get(s,r,a);if(c&&(MV(l,o)||c5.has(o)&&MV(l,c5.get(o))))return!0;n(r),qO(o)&&(o=I5e(o)||o);const d=!xp.has(o)&&$5e(o)?Hi(o):o;return e(r,d),Reflect.set(s,r,d,a),i(["set",[r],o,l]),!0}}),xp=new WeakMap,R6=new WeakSet,rP=new WeakMap,rE=[1],c5=new WeakMap;let MV=Object.is,L5e=(t,e)=>new Proxy(t,e),$5e=O5e,U5e=Ate,B5e=M5e;function Hi(t={}){if(!qO(t))throw new Error("object required");const e=c5.get(t);if(e)return e;let n=rE[0];const i=new Set,s=(C,E=++rE[0])=>{n!==E&&(r=n=E,i.forEach(T=>T(C,E)))};let r=n;const o=(C=rE[0])=>(r!==C&&(r=C,c.forEach(([E])=>{const T=E[1](C);T>n&&(n=T)})),n),a=C=>(E,T)=>{const A=[...E];A[1]=[C,...A[1]],s(A,T)},c=new Map,l=(C,E)=>{const T=!R6.has(E)&&xp.get(E);if(T){if((e_?"production":void 0)!=="production"&&c.has(C))throw new Error("prop listener already exists");if(i.size){const A=T[2](a(C));c.set(C,[T,A])}else c.set(C,[T])}},d=C=>{var E;const T=c.get(C);T&&(c.delete(C),(E=T[1])==null||E.call(T))},h=C=>(i.add(C),i.size===1&&c.forEach(([T,A],k)=>{if((e_?"production":void 0)!=="production"&&A)throw new Error("remove already exists");const R=T[2](a(k));c.set(k,[T,R])}),()=>{i.delete(C),i.size===0&&c.forEach(([T,A],k)=>{A&&(A(),c.set(k,[T]))})});let p=!0;const g=B5e(()=>p,l,d,s),b=L5e(t,g);c5.set(t,b);const w=[t,o,h];return xp.set(b,w),Reflect.ownKeys(t).forEach(C=>{const E=Object.getOwnPropertyDescriptor(t,C);"value"in E&&E.writable&&(b[C]=t[C])}),p=!1,b}function or(t,e,n){const i=xp.get(t);(e_?"production":void 0)!=="production"&&!i&&console.warn("Please use proxy object");let s;const r=[],o=i[2];let a=!1;const l=o(d=>{r.push(d),s||(s=Promise.resolve().then(()=>{s=void 0,a&&e(r.splice(0))}))});return a=!0,()=>{a=!1,l()}}function kg(t){const e=xp.get(t);(e_?"production":void 0)!=="production"&&!e&&console.warn("Please use proxy object");const[n,i]=e;return U5e(n,i())}function eb(t){return R6.add(t),t}function F5e(){return{proxyStateMap:xp,refSet:R6,snapCache:rP,versionHolder:rE,proxyCache:c5}}function ar(t,e,n,i){let s=t[e];return or(t,()=>{const r=t[e];Object.is(s,r)||n(s=r)})}const{proxyStateMap:j5e,snapCache:V5e}=F5e(),ex=t=>j5e.has(t);function W5e(t){const e=[];let n=0;const i=new Map,s=new WeakMap,r=()=>{const l=V5e.get(a),d=l==null?void 0:l[1];if(d&&!s.has(d)){const h=new Map(i);s.set(d,h)}},o=l=>s.get(l)||i,a={data:e,index:n,epoch:0,get size(){return ex(this)||r(),o(this).size},get(l){const h=o(this).get(l);if(h===void 0){this.epoch;return}return this.data[h]},has(l){const d=o(this);return this.epoch,d.has(l)},set(l,d){if(!ex(this))throw new Error("Cannot perform mutations on a snapshot");const h=i.get(l);return h===void 0?(i.set(l,this.index),this.data[this.index++]=d):this.data[h]=d,this.epoch++,this},delete(l){if(!ex(this))throw new Error("Cannot perform mutations on a snapshot");const d=i.get(l);return d===void 0?!1:(delete this.data[d],i.delete(l),this.epoch++,!0)},clear(){if(!ex(this))throw new Error("Cannot perform mutations on a snapshot");this.data.length=0,this.index=0,this.epoch++,i.clear()}
137,forEach(l){this.epoch,o(this).forEach((h,p)=>{l(this.data[h],p,this)})},*entries(){this.epoch;const l=o(this);for(const[d,h]of l)yield[d,this.data[h]]},*keys(){this.epoch;const l=o(this);for(const d of l.keys())yield d},*values(){this.epoch;const l=o(this);for(const d of l.values())yield this.data[d]},[Symbol.iterator](){return this.entries()},get[Symbol.toStringTag](){return"Map"},toJSON(){return new Map(this.entries())}},c=Hi(a);return Object.defineProperties(c,{size:{enumerable:!1},index:{enumerable:!1},epoch:{enumerable:!1},data:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(c),c}const Tte={isLowerCaseMatch(t,e){return(t==null?void 0:t.toLowerCase())===(e==null?void 0:e.toLowerCase())}};var oE={exports:{}},q5e=oE.exports,LV;function z5e(){return LV||(LV=1,(function(t,e){(function(n,i){t.exports=i()})(q5e,(function(){var n=1e3,i=6e4,s=36e5,r="millisecond",o="second",a="minute",c="hour",l="day",d="week",h="month",p="quarter",g="year",b="date",w="Invalid Date",C=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(S){var v=["th","st","nd","rd"],_=S%100;return"["+S+(v[(_-20)%10]||v[_]||v[0])+"]"}},A=function(S,v,_){var N=String(S);return!N||N.length>=v?S:""+Array(v+1-N.length).join(_)+S},k={s:A,z:function(S){var v=-S.utcOffset(),_=Math.abs(v),N=Math.floor(_/60),$=_%60;return(v<=0?"+":"-")+A(N,2,"0")+":"+A($,2,"0")},m:function S(v,_){if(v.date()<_.date())return-S(_,v);var N=12*(_.year()-v.year())+(_.month()-v.month()),$=v.clone().add(N,h),U=_-$<0,j=v.clone().add(N+(U?-1:1),h);return+(-(N+(_-$)/(U?$-j:j-$))||0)},a:function(S){return S<0?Math.ceil(S)||0:Math.floor(S)},p:function(S){return{M:h,y:g,w:d,d:l,D:b,h:c,m:a,s:o,ms:r,Q:p}[S]||String(S||"").toLowerCase().replace(/s$/,"")},u:function(S){return S===void 0}},R="en",P={};P[R]=T;var B="$isDayjsObject",F=function(S){return S instanceof G||!(!S||!S[B])},z=function S(v,_,N){var $;if(!v)return R;if(typeof v=="string"){var U=v.toLowerCase();P[U]&&($=U),_&&(P[U]=_,$=U);var j=v.split("-");if(!$&&j.length>1)return S(j[0])}else{var D=v.name;P[D]=v,$=D}return!N&&$&&(R=$),$||!N&&R},K=function(S,v){if(F(S))return S.clone();var _=typeof v=="object"?v:{};return _.date=S,_.args=arguments,new G(_)},q=k;q.l=z,q.i=F,q.w=function(S,v){return K(S,{locale:v.$L,utc:v.$u,x:v.$x,$offset:v.$offset})};var G=(function(){function S(_){this.$L=z(_.locale,null,!0),this.parse(_),this.$x=this.$x||_.x||{},this[B]=!0}var v=S.prototype;return v.parse=function(_){this.$d=(function(N){var $=N.date,U=N.utc;if($===null)return new Date(NaN);if(q.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var j=$.match(C);if(j){var D=j[2]-1||0,O=(j[7]||"0").substring(0,3);return U?new Date(Date.UTC(j[1],D,j[3]||1,j[4]||0,j[5]||0,j[6]||0,O)):new Date(j[1],D,j[3]||1,j[4]||0,j[5]||0,j[6]||0,O)}}return new Date($)})(_),this.init()},v.init=function(){var _=this.$d;this.$y=_.getFullYear(),this.$M=_.getMonth(),this.$D=_.getDate(),this.$W=_.getDay(),this.$H=_.getHours(),this.$m=_.getMinutes(),this.$s=_.getSeconds(),this.$ms=_.getMilliseconds()},v.$utils=function(){return q},v.isValid=function(){return this.$d.toString()!==w},v.isSame=function(_,N){var $=K(_);return this.startOf(N)<=$&&$<=this.endOf(N)},v.isAfter=function(_,N){return K(_)<this.startOf(N)},v.isBefore=function(_,N){return this.endOf(N)<K(_)},v.$g=function(_,N,$){return q.u(_)?this[N]:this.set($,_)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(_,N){var $=this,U=!!q.u(N)||N,j=q.p(_),D=function(ee,ie){var re=q.w($.$u?Date.UTC($.$y,ie,ee):new Date($.$y,ie,ee),$);return U?re:re.endOf(l)},O=function(ee,ie){return q.w($.toDate()[ee].apply($.toDate("s"),(U?[0,0,0,0]:[23,59,59,999]).slice(ie)),$)},H=this.$W,J=this.$M,W=this.$D,Z="set"+(this.$u?"UTC":"");switch(j){case g:return U?D(1,0):D(31,11);case h:return U?D(1,J):D(0,J+1);case d:var Y=this.$locale().weekStart||0,Q=(H<Y?H+7:H)-Y;return D(U?W-Q:W+(6-Q),J);case l:case b:return O(Z+"Hours",0);case c:return O(Z+"Minutes",1);case a:return O(Z+"Seconds",2);case o:return O(Z+"Milliseconds",3);default:return this.clone()}},v.endOf=function(_){return this.startOf(_,!1)},v.$set=function(_,N){var $,U=q.p(_),j="set"+(this.$u?"UTC":""),D=($={},$[l]=j+"Date",$[b]=j+"Date",$[h]=j+"Month",$[g]=j+"FullYear",$[c]=j+"Hours",$[a]=j+"Minutes",$[o]=j+"Seconds",$[r]=j+"Milliseconds",$)[U],O=U===l?this.$D+(N-this.$W):N;
137if(U===h||U===g){var H=this.clone().set(b,1);H.$d[D](O),H.init(),this.$d=H.set(b,Math.min(this.$D,H.daysInMonth())).$d}else D&&this.$d[D](O);return this.init(),this},v.set=function(_,N){return this.clone().$set(_,N)},v.get=function(_){return this[q.p(_)]()},v.add=function(_,N){var $,U=this;_=Number(_);var j=q.p(N),D=function(J){var W=K(U);return q.w(W.date(W.date()+Math.round(J*_)),U)};if(j===h)return this.set(h,this.$M+_);if(j===g)return this.set(g,this.$y+_);if(j===l)return D(1);if(j===d)return D(7);var O=($={},$[a]=i,$[c]=s,$[o]=n,$)[j]||1,H=this.$d.getTime()+_*O;return q.w(H,this)},v.subtract=function(_,N){return this.add(-1*_,N)},v.format=function(_){var N=this,$=this.$locale();if(!this.isValid())return $.invalidDate||w;var U=_||"YYYY-MM-DDTHH:mm:ssZ",j=q.z(this),D=this.$H,O=this.$m,H=this.$M,J=$.weekdays,W=$.months,Z=$.meridiem,Y=function(ie,re,oe,de){return ie&&(ie[re]||ie(N,U))||oe[re].slice(0,de)},Q=function(ie){return q.s(D%12||12,ie,"0")},ee=Z||function(ie,re,oe){var de=ie<12?"AM":"PM";return oe?de.toLowerCase():de};return U.replace(E,(function(ie,re){return re||(function(oe){switch(oe){case"YY":return String(N.$y).slice(-2);case"YYYY":return q.s(N.$y,4,"0");case"M":return H+1;case"MM":return q.s(H+1,2,"0");case"MMM":return Y($.monthsShort,H,W,3);case"MMMM":return Y(W,H);case"D":return N.$D;case"DD":return q.s(N.$D,2,"0");case"d":return String(N.$W);case"dd":return Y($.weekdaysMin,N.$W,J,2);case"ddd":return Y($.weekdaysShort,N.$W,J,3);case"dddd":return J[N.$W];case"H":return String(D);case"HH":return q.s(D,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return ee(D,O,!0);case"A":return ee(D,O,!1);case"m":return String(O);case"mm":return q.s(O,2,"0");case"s":return String(N.$s);case"ss":return q.s(N.$s,2,"0");case"SSS":return q.s(N.$ms,3,"0");case"Z":return j}return null})(ie)||j.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(_,N,$){var U,j=this,D=q.p(N),O=K(_),H=(O.utcOffset()-this.utcOffset())*i,J=this-O,W=function(){return q.m(j,O)};switch(D){case g:U=W()/12;break;case h:U=W();break;case p:U=W()/3;break;case d:U=(J-H)/6048e5;break;case l:U=(J-H)/864e5;break;case c:U=J/s;break;case a:U=J/i;break;case o:U=J/n;break;default:U=J}return $?U:q.a(U)},v.daysInMonth=function(){return this.endOf(h).$D},v.$locale=function(){return P[this.$L]},v.locale=function(_,N){if(!_)return this.$L;var $=this.clone(),U=z(_,N,!0);return U&&($.$L=U),$},v.clone=function(){return q.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},S})(),I=G.prototype;return K.prototype=I,[["$ms",r],["$s",o],["$m",a],["$H",c],["$W",l],["$M",h],["$y",g],["$D",b]].forEach((function(S){I[S[1]]=function(v){return this.$g(v,S[0],S[1])}})),K.extend=function(S,v){return S.$i||(S(v,G,K),S.$i=!0),K},K.locale=z,K.isDayjs=F,K.unix=function(S){return K(1e3*S)},K.en=P[R],K.Ls=P,K.p={},K}))})(oE)),oE.exports}var H5e=z5e();const w2=ya(H5e);var aE={exports:{}},G5e=aE.exports,$V;function K5e(){return $V||($V=1,(function(t,e){(function(n,i){t.exports=i()})(G5e,(function(){return{name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(n){var i=["th","st","nd","rd"],s=n%100;return"["+n+(i[(s-20)%10]||i[s]||i[0])+"]"}}}))})(aE)),aE.exports}var Y5e=K5e();const Z5e=ya(Y5e);var cE={exports:{}},Q5e=cE.exports,UV;function X5e(){return UV||(UV=1,(function(t,e){(function(n,i){t.exports=i()})(Q5e,(function(){return function(n,i,s){n=n||{};var r=i.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function a(l,d,h,p){return r.fromToBase(l,d,h,p)}s.en.relativeTime=o,r.fromToBase=function(l,d,h,p,g){for(var b,w,C,E=h.$locale().relativeTime||o,T=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],A=T.length,k=0;k<A;k+=1){var R=T[k];R.d&&(b=p?s(l).diff(h,R.d,!0):h.diff(l,R.d,!0));var P=(n.rounding||Math.round)(Math.abs(b));if(C=b>0,P<=R.r||!R.r){P<=1&&k>0&&(R=T[k-1]);var B=E[R.l];
137g&&(P=g(""+P)),w=typeof B=="string"?B.replace("%d",P):B(P,d,R.l,C);break}}if(d)return w;var F=C?E.future:E.past;return typeof F=="function"?F(w):F.replace("%s",w)},r.to=function(l,d){return a(l,d,this,!0)},r.from=function(l,d){return a(l,d,this)};var c=function(l){return l.$u?s.utc():s()};r.toNow=function(l){return this.to(c(this),l)},r.fromNow=function(l){return this.from(c(this),l)}}}))})(cE)),cE.exports}var J5e=X5e();const e6e=ya(J5e);var lE={exports:{}},t6e=lE.exports,BV;function n6e(){return BV||(BV=1,(function(t,e){(function(n,i){t.exports=i()})(t6e,(function(){return function(n,i,s){s.updateLocale=function(r,o){var a=s.Ls[r];if(a)return(o?Object.keys(o):[]).forEach((function(c){a[c]=o[c]})),a}}}))})(lE)),lE.exports}var i6e=n6e();const s6e=ya(i6e);w2.extend(e6e);w2.extend(s6e);const r6e={...Z5e,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}},o6e=["January","February","March","April","May","June","July","August","September","October","November","December"];w2.locale("en-web3-modal",r6e);const oP={getMonthNameByIndex(t){return o6e[t]},getYear(t=new Date().toISOString()){return w2(t).year()},getRelativeDateFromNow(t){return w2(t).locale("en-web3-modal").fromNow(!0)},formatDate(t,e="DD MMM"){return w2(t).format(e)}};var FV={};const we={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",BASE_ACCOUNT:"baseAccount",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122",TON:"ton"}
137,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin",cosmos:"Cosmos",sui:"Sui",stacks:"Stacks",ton:"TON"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",TON:"ton"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],SOLANA_SPL_TOKEN_ADDRESSES:{SOL:"So11111111111111111111111111111111111111112"},HTTP_STATUS_CODES:{SERVER_ERROR:500,TOO_MANY_REQUESTS:429,SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network",SECURE_SITE_SDK_ORIGIN:(typeof process<"u"&&typeof FV<"u"?FV.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",REMOTE_FEATURES_ALERTS:{MULTI_WALLET_NOT_ENABLED:{DEFAULT:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com."},CONNECTIONS_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnections hook."},CONNECTION_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnection hook."}},HEADLESS_NOT_ENABLED:{DEFAULT:{displayMessage:"",debugMessage:"Headless support is not enabled. Please enable it with the features.headless option in the AppKit configuration and make sure your current plan supports it."}}},IS_DEVELOPMENT:typeof process<"u"&&!1,DEFAULT_ALLOWED_ANCESTORS:["http://localhost:*","https://localhost:*","http://127.0.0.1:*","https://127.0.0.1:*","https://*.pages.dev","https://*.vercel.app","https://*.ngrok-free.app","https://secure-mobile.walletconnect.com","https://secure-mobile.walletconnect.org"],METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"AUTH"},l5={caipNetworkIdToNumber(t){return t?Number(t.split(":")[1]):void 0},parseEvmChainId(t){return typeof t=="string"?this.caipNetworkIdToNumber(t):t},getNetworksByNamespace(t,e){return(t==null?void 0:t.filter(n=>n.chainNamespace===e))||[]},getFirstNetworkByNamespace(t,e){return this.getNetworksByNamespace(t,e)[0]},getNetworkNameByCaipNetworkId(t,e){var s;if(!e)return;const n=t.find(r=>r.caipNetworkId===e);if(n)return n.name;const[i]=e.split(":");return((s=we.CHAIN_NAME_MAP)==null?void 0:s[i])||void 0}},kte=["eip155","solana","polkadot","bip122","cosmos","sui","stacks"];var a6e=20,c6e=1,Ng=1e6,jV=1e6,l6e=-7,u6e=21,d6e=!1,P6="[big.js] ",b1=P6+"Invalid ",iS=b1+"decimal places",h6e=b1+"rounding mode",Nte=P6+"Division by zero",zi={},Sd=void 0,f6e=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function Rte(){function t(e){var n=this;if(!(n instanceof t))return e===Sd?Rte():new t(e);if(e instanceof t)n.s=e.s,n.e=e.e,n.c=e.c.slice();else{if(typeof e!="string"){if(t.strict===!0&&typeof e!="bigint")throw TypeError(b1+"value");
137e=e===0&&1/e<0?"-0":String(e)}p6e(n,e)}n.constructor=t}return t.prototype=zi,t.DP=a6e,t.RM=c6e,t.NE=l6e,t.PE=u6e,t.strict=d6e,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}function p6e(t,e){var n,i,s;if(!f6e.test(e))throw Error(b1+"number");for(t.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(n=e.indexOf("."))>-1&&(e=e.replace(".","")),(i=e.search(/e/i))>0?(n<0&&(n=i),n+=+e.slice(i+1),e=e.substring(0,i)):n<0&&(n=e.length),s=e.length,i=0;i<s&&e.charAt(i)=="0";)++i;if(i==s)t.c=[t.e=0];else{for(;s>0&&e.charAt(--s)=="0";);for(t.e=n-i-1,t.c=[],n=0;i<=s;)t.c[n++]=+e.charAt(i++)}return t}function w1(t,e,n,i){var s=t.c;if(n===Sd&&(n=t.constructor.RM),n!==0&&n!==1&&n!==2&&n!==3)throw Error(h6e);if(e<1)i=n===3&&(i||!!s[0])||e===0&&(n===1&&s[0]>=5||n===2&&(s[0]>5||s[0]===5&&(i||s[1]!==Sd))),s.length=1,i?(t.e=t.e-e+1,s[0]=1):s[0]=t.e=0;else if(e<s.length){if(i=n===1&&s[e]>=5||n===2&&(s[e]>5||s[e]===5&&(i||s[e+1]!==Sd||s[e-1]&1))||n===3&&(i||!!s[0]),s.length=e,i){for(;++s[--e]>9;)if(s[e]=0,e===0){++t.e,s.unshift(1);break}}for(e=s.length;!s[--e];)s.pop()}return t}function v1(t,e,n){var i=t.e,s=t.c.join(""),r=s.length;if(e)s=s.charAt(0)+(r>1?"."+s.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)s="0"+s;s="0."+s}else if(i>0)if(++i>r)for(i-=r;i--;)s+="0";else i<r&&(s=s.slice(0,i)+"."+s.slice(i));else r>1&&(s=s.charAt(0)+"."+s.slice(1));return t.s<0&&n?"-"+s:s}zi.abs=function(){var t=new this.constructor(this);return t.s=1,t};zi.cmp=function(t){var e,n=this,i=n.c,s=(t=new n.constructor(t)).c,r=n.s,o=t.s,a=n.e,c=t.e;if(!i[0]||!s[0])return i[0]?r:s[0]?-o:0;if(r!=o)return r;if(e=r<0,a!=c)return a>c^e?1:-1;for(o=(a=i.length)<(c=s.length)?a:c,r=-1;++r<o;)if(i[r]!=s[r])return i[r]>s[r]^e?1:-1;return a==c?0:a>c^e?1:-1};zi.div=function(t){var e=this,n=e.constructor,i=e.c,s=(t=new n(t)).c,r=e.s==t.s?1:-1,o=n.DP;if(o!==~~o||o<0||o>Ng)throw Error(iS);if(!s[0])throw Error(Nte);if(!i[0])return t.s=r,t.c=[t.e=0],t;var a,c,l,d,h,p=s.slice(),g=a=s.length,b=i.length,w=i.slice(0,a),C=w.length,E=t,T=E.c=[],A=0,k=o+(E.e=e.e-t.e)+1;for(E.s=r,r=k<0?0:k,p.unshift(0);C++<a;)w.push(0);do{for(l=0;l<10;l++){if(a!=(C=w.length))d=a>C?1:-1;else for(h=-1,d=0;++h<a;)if(s[h]!=w[h]){d=s[h]>w[h]?1:-1;break}if(d<0){for(c=C==a?s:p;C;){if(w[--C]<c[C]){for(h=C;h&&!w[--h];)w[h]=9;--w[h],w[C]+=10}w[C]-=c[C]}for(;!w[0];)w.shift()}else break}T[A++]=d?l:++l,w[0]&&d?w[C]=i[g]||0:w=[i[g]]}while((g++<b||w[0]!==Sd)&&r--);return!T[0]&&A!=1&&(T.shift(),E.e--,k--),A>k&&w1(E,k,n.RM,w[0]!==Sd),E};zi.eq=function(t){return this.cmp(t)===0};zi.gt=function(t){return this.cmp(t)>0};zi.gte=function(t){return this.cmp(t)>-1};zi.lt=function(t){return this.cmp(t)<0};zi.lte=function(t){return this.cmp(t)<1};zi.minus=zi.sub=function(t){var e,n,i,s,r=this,o=r.constructor,a=r.s,c=(t=new o(t)).s;if(a!=c)return t.s=-c,r.plus(t);var l=r.c.slice(),d=r.e,h=t.c,p=t.e;if(!l[0]||!h[0])return h[0]?t.s=-c:l[0]?t=new o(r):t.s=1,t;if(a=d-p){for((s=a<0)?(a=-a,i=l):(p=d,i=h),i.reverse(),c=a;c--;)i.push(0);i.reverse()}else for(n=((s=l.length<h.length)?l:h).length,a=c=0;c<n;c++)if(l[c]!=h[c]){s=l[c]<h[c];break}if(s&&(i=l,l=h,h=i,t.s=-t.s),(c=(n=h.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;n>a;){if(l[--n]<h[n]){for(e=n;e&&!l[--e];)l[e]=9;--l[e],l[n]+=10}l[n]-=h[n]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--p;return l[0]||(t.s=1,l=[p=0]),t.c=l,t.e=p,t};zi.mod=function(t){var e,n=this,i=n.constructor,s=n.s,r=(t=new i(t)).s;if(!t.c[0])throw Error(Nte);return n.s=t.s=1,e=t.cmp(n)==1,n.s=s,t.s=r,e?new i(n):(s=i.DP,r=i.RM,i.DP=i.RM=0,n=n.div(t),i.DP=s,i.RM=r,this.minus(n.times(t)))};zi.neg=function(){var t=new this.constructor(this);return t.s=-t.s,t};zi.plus=zi.add=function(t){var e,n,i,s=this,r=s.constructor;if(t=new r(t),s.s!=t.s)return t.s=-t.s,s.minus(t);var o=s.e,a=s.c,c=t.e,l=t.c;if(!a[0]||!l[0])return l[0]||(a[0]?t=new r(s):t.s=s.s),t;if(a=a.slice(),e=o-c){for(e>0?(c=o,i=l):(e=-e,i=a),i.reverse();e--;)i.push(0);i.reverse()}for(a.length-l.length<0&&(i=l,l=a,a=i),e=l.length,n=0;e;a[e]%=10)n=(a[--e]=a[e]+l[e]+n)/10|0;for(n&&(a.unshift(n),++c),e=a.length;a[--e]===0;)a.pop();return t.c=a,t.e=c,t};zi.pow=function(t){var e=this,n=new e.constructor("1"),i=n,s=t<0;if(t!==~~t||t<-jV||t>jV)throw Error(b1+"exponent");for(s&&(t=-t);t&1&&(i=i.times(e)),t>>=1,!!t;)e=e.times(e);return s?n.div(i):i};zi.prec=function(t,e){if(t!==~~t||t<1||t>Ng)throw Error(b1+"precision");return w1(new this.constructor(this),t,e)};zi.round=function(t,e){if(t===Sd)t=0;else if(t!==~~t||t<-Ng||t>Ng)throw Error(iS);return w1(new this.constructor(this),t+this.e+1,e)};zi.sqrt=function(){var t,e,n,i=this,s=i.constructor,r=i.s,o=i.e,a=new s("0.5");
137if(!i.c[0])return new s(i);if(r<0)throw Error(P6+"No square root");r=Math.sqrt(+v1(i,!0,!0)),r===0||r===1/0?(e=i.c.join(""),e.length+o&1||(e+="0"),r=Math.sqrt(e),o=((o+1)/2|0)-(o<0||o&1),t=new s((r==1/0?"5e":(r=r.toExponential()).slice(0,r.indexOf("e")+1))+o)):t=new s(r+""),o=t.e+(s.DP+=4);do n=t,t=a.times(n.plus(i.div(n)));while(n.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return w1(t,(s.DP-=4)+t.e+1,s.RM)};zi.times=zi.mul=function(t){var e,n=this,i=n.constructor,s=n.c,r=(t=new i(t)).c,o=s.length,a=r.length,c=n.e,l=t.e;if(t.s=n.s==t.s?1:-1,!s[0]||!r[0])return t.c=[t.e=0],t;for(t.e=c+l,o<a&&(e=s,s=r,r=e,l=o,o=a,a=l),e=new Array(l=o+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=o+c;l>c;)a=e[l]+r[c]*s[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=a}for(a?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t};zi.toExponential=function(t,e){var n=this,i=n.c[0];if(t!==Sd){if(t!==~~t||t<0||t>Ng)throw Error(iS);for(n=w1(new n.constructor(n),++t,e);n.c.length<t;)n.c.push(0)}return v1(n,!0,!!i)};zi.toFixed=function(t,e){var n=this,i=n.c[0];if(t!==Sd){if(t!==~~t||t<0||t>Ng)throw Error(iS);for(n=w1(new n.constructor(n),t+n.e+1,e),t=t+n.e+1;n.c.length<t;)n.c.push(0)}return v1(n,!1,!!i)};zi[Symbol.for("nodejs.util.inspect.custom")]=zi.toJSON=zi.toString=function(){var t=this,e=t.constructor;return v1(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])};zi.toNumber=function(){var t=+v1(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(t.toString()))throw Error(P6+"Imprecise conversion");return t};zi.toPrecision=function(t,e){var n=this,i=n.constructor,s=n.c[0];if(t!==Sd){if(t!==~~t||t<1||t>Ng)throw Error(b1+"precision");for(n=w1(new i(n),t,e);n.c.length<t;)n.c.push(0)}return v1(n,t<=n.e||n.e<=i.NE||n.e>=i.PE,!!s)};zi.valueOf=function(){var t=this,e=t.constructor;if(e.strict===!0)throw Error(P6+"valueOf disallowed");return v1(t,t.e<=e.NE||t.e>=e.PE,!0)};var v0=Rte();const u5={bigNumber(t){return t?new v0(t):new v0(0)},multiply(t,e){if(t===void 0||e===void 0)return new v0(0);const n=new v0(t),i=new v0(e);return n.times(i)},toFixed(t,e=2){return t===void 0||t===""?new v0(0).toFixed(e):new v0(t).toFixed(e)},formatNumberToLocalString(t,e=2){return t===void 0||t===""?"0.00":typeof t=="number"?t.toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e,roundingMode:"floor"}):parseFloat(t).toLocaleString("en-US",{maximumFractionDigits:e,minimumFractionDigits:e,roundingMode:"floor"})},parseLocalStringToNumber(t){if(t===void 0||t==="")return 0;const e=t.replace(/,/gu,"");return new v0(e).toNumber()}},m6e=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],g6e=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],y6e=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],b6e={getERC20Abi:t=>we.USDT_CONTRACT_ADDRESSES.includes(t)?y6e:m6e,getSwapAbi:()=>g6e},w6e={URLS:{FAQ:"https://walletconnect.com/faq"}},ra={ConnectorExplorerIds:{[we.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[we.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[we.CONNECTOR_ID.BASE_ACCOUNT]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[we.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[we.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[we.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496
137a09c0faed0709",[we.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[we.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[we.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[we.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[we.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[we.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[we.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[we.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[we.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[we.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[we.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13",[we.OKX_CONNECTOR_NAME]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[we.BINANCE_CONNECTOR_NAME]:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25"},ConnectorImageIds:{[we.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[we.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[we.CONNECTOR_ID.BASE_ACCOUNT]:"bba2c8be-7fd1-463e-42b1-796ecb0ad200",[we.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[we.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[we.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[we.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[we.CONNECTOR_ID.INJECTED]:"Browser Wallet",[we.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[we.CONNECTOR_ID.COINBASE]:"Coinbase",[we.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[we.CONNECTOR_ID.BASE_ACCOUNT]:"Base Account",[we.CONNECTOR_ID.LEDGER]:"Ledger",[we.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[we.CONNECTOR_ID.INJECTED]:"INJECTED",[we.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[we.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[we.CONNECTOR_ID.AUTH]:"AUTH"}},Lr={validateCaipAddress(t){var e;if(((e=t.split(":"))==null?void 0:e.length)!==3)throw new Error("Invalid CAIP Address");return t},parseCaipAddress(t){const e=t.split(":");if(e.length!==3)throw new Error(`Invalid CAIP-10 address: ${t}`);const[n,i,s]=e;if(!n||!i||!s)throw new Error(`Invalid CAIP-10 address: ${t}`);return{chainNamespace:n,chainId:i,address:s}},parseCaipNetworkId(t){const e=t.split(":");if(e.length!==2)throw new Error(`Invalid CAIP-2 network id: ${t}`);const[n,i]=e;if(!n||!i)throw new Error(`Invalid CAIP-2 network id: ${t}`);return{chainNamespace:n,chainId:i}}},Ha={RPC_ERROR_CODE:{USER_REJECTED_REQUEST:4001,USER_REJECTED_METHODS:5002,USER_REJECTED:5e3},PROVIDER_RPC_ERROR_NAME:{PROVIDER_RPC:"ProviderRpcError",USER_REJECTED_REQUEST:"UserRejectedRequestError"},isRpcProviderError(t){try{if(typeof t=="object"&&t!==null){const e=t,n=typeof e.message=="string",i=typeof e.code=="number";return n&&i}return!1}catch{return!1}},isUserRejectedMessage(t){return t.toLowerCase().includes("user rejected")||t.toLowerCase().includes("user cancelled")||t.toLowerCase().includes("user canceled")},isUserRejectedRequestError(t){if(Ha.isRpcProviderError(t)){const e=t.code===Ha.RPC_ERROR_CODE.USER_REJECTED_REQUEST,n=t.code===Ha.RPC_ERROR_CODE.USER_REJECTED_METHODS;return e||n||Ha.isUserRejectedMessage(t.message)}return t instanceof Error?Ha.isUserRejectedMessage(t.message):!1}};class v6e extends Error{constructor(e,n){super(n.message,{cause:e}),this.name=Ha.PROVIDER_RPC_ERROR_NAME.PROVIDER_RPC,this.code=n.code}}class n2 extends v6e{constructor(e){super(e,{code:Ha.RPC_ERROR_CODE.USER_REJECTED_REQUEST,message:"User rejected the request"}),this.name=Ha.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST}}const Jt={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",RECENT_WALLET:"@appkit/recent_wallet",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cac
137he",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections",DISCONNECTED_CONNECTOR_IDS:"@appkit/disconnected_connector_ids",HISTORY_TRANSACTIONS_CACHE:"@appkit/history_transactions_cache",TOKEN_PRICE_CACHE:"@appkit/token_price_cache",RECENT_EMAILS:"@appkit/recent_emails",LATEST_APPKIT_VERSION:"@appkit/latest_version",TON_WALLETS_CACHE:"@appkit/ton_wallets_cache"};function WT(t){if(!t)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${t}:connected_connector_id`}const Kt={setItem(t,e){e3()&&e!==void 0&&localStorage.setItem(t,e)},getItem(t){if(e3())return localStorage.getItem(t)||void 0},removeItem(t){e3()&&localStorage.removeItem(t)},clear(){e3()&&localStorage.clear()}};function e3(){return typeof window<"u"&&typeof localStorage<"u"}function d5(t,e){const n=(t==null?void 0:t["--apkt-accent"])??(t==null?void 0:t["--w3m-accent"]);return e==="light"?{"--w3m-accent":n||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":n||"hsla(230, 100%, 67%, 1)","--w3m-background":"#202020"}}var VV={};const qT=(typeof process<"u"&&typeof VV<"u"?VV.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",Pte=[{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],C6e="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",fn={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:qT,SECURE_SITE_DASHBOARD:`${qT}/dashboard`,SECURE_SITE_FAVICON:`${qT}/images/favicon.png`,SOLANA_NATIVE_TOKEN_ADDRESS:"So11111111111111111111111111111111111111111",RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],SUGGESTED_TOKENS_BY_CHAIN:{"eip155:42161":["USDâ®0"]},BALANCE_SUPPORTED_CHAINS:[we.CHAIN.EVM,we.CHAIN.SOLANA],SEND_PARAMS_SUPPORTED_CHAINS:[we.CHAIN.EVM],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:[we.CHAIN.EVM],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:[we.CHAIN.EVM,we.CHAIN.SOLANA],PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES:[we.CHAIN.EVM,we.CHAIN.SOLANA],ACTIVITY_ENABLED_CHAIN_NAMESPACES:[we.CHAIN.EVM,we.CHAIN.TON],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x",sui:"0x",stacks:"0x",ton:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in the wallet app",WEB:"Open and continue in the wallet app"},SEND_SUPPORTED_NAMESPACES:[we.CHAIN.EVM,we.CHAIN.SOLANA],DEFAULT_REMOTE_FEATURES:{swaps:["1inch"],onramp:["meld"],email:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],activity:!0,reownBranding:!0,multiWallet:!1,emailCapture:!1,payWithExchange:!1,payments:!1,reownAuthentication:!1,headless:!1},DEFAULT_REMOTE_FEATURES_DISABLED:{email:!1,socials:!1,swaps:!1,onramp:!1,activity:!1,reownBranding:!1,emailCapture:!1,reownAuthentication:!1,headless:!1},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1,reownAuthentication:!1,headless:!1},DEFAULT_SOCIALS:["google","x","farcaster","discord","apple","github","facebook"],DEFAULT_ACCOUNT_TYPES:{b
vendor: 12,234 bytes, line 137
137ip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa",ton:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"},SIWX_DEFAULTS:{signOutOnDisconnect:!0},MANDATORY_WALLET_IDS_ON_MOBILE:[ra.ConnectorExplorerIds[we.CONNECTOR_ID.COINBASE],ra.ConnectorExplorerIds[we.CONNECTOR_ID.COINBASE_SDK],ra.ConnectorExplorerIds[we.CONNECTOR_ID.BASE_ACCOUNT],ra.ConnectorExplorerIds[we.SOLFLARE_CONNECTOR_NAME],ra.ConnectorExplorerIds[we.PHANTOM_CONNECTOR_NAME],ra.ConnectorExplorerIds[we.BINANCE_CONNECTOR_NAME]],DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"]},He={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5,transactionsHistory:15e3,tokenPrice:15e3,latestAppKitVersion:6048e5,tonWallets:864e5},isCacheExpired(t,e){return Date.now()-t>e},getActiveNetworkProps(){const t=He.getActiveNamespace(),e=He.getActiveCaipNetworkId(),n=e?e.split(":")[1]:void 0,i=n?isNaN(Number(n))?n:Number(n):void 0;return{namespace:t,caipNetworkId:e,chainId:i}},setWalletConnectDeepLink({name:t,href:e}){try{Kt.setItem(Jt.DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const t=Kt.getItem(Jt.DEEPLINK_CHOICE);if(t)return JSON.parse(t)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{Kt.removeItem(Jt.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(t){try{Kt.setItem(Jt.ACTIVE_NAMESPACE,t)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(t){try{Kt.setItem(Jt.ACTIVE_CAIP_NETWORK_ID,t),He.setActiveNamespace(t.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return Kt.getItem(Jt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{Kt.removeItem(Jt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(t){try{const e=WT(t);Kt.removeItem(e)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(t){try{const e=He.getRecentWallets();e.find(i=>i.id===t.id)||(e.unshift(t),e.length>2&&e.pop(),Kt.setItem(Jt.RECENT_WALLETS,JSON.stringify(e)),Kt.setItem(Jt.RECENT_WALLET,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const t=Kt.getItem(Jt.RECENT_WALLETS);return t?JSON.parse(t):[]}catch{console.info("Unable to get AppKit recent")}return[]},getRecentWallet(){try{const t=Kt.getItem(Jt.RECENT_WALLET);return t?JSON.parse(t):null}catch{console.info("Unable to get AppKit recent")}return null},deleteRecentWallet(){try{Kt.removeItem(Jt.RECENT_WALLET)}catch{console.info("Unable to delete AppKit recent")}},setConnectedConnectorId(t,e){try{const n=WT(t);Kt.setItem(n,e)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return Kt.getItem(Jt.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(t){if(t)try{const e=WT(t);return Kt.getItem(e)}catch{console.info("Unable to get connected connector id in namespace",t)}},setConnectedSocialProvider(t){try{Kt.setItem(Jt.CONNECTED_SOCIAL,t)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return Kt.getItem(Jt.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{Kt.removeItem(Jt.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return Kt.getItem(Jt.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){var n;const t=Kt.getItem(Jt.ACTIVE_CAIP_NETWORK_ID);return(n=t==null?void 0:t.split(":"))==null?void 0:n[1]},setConnectionStatus(t){try{Kt.setItem(Jt.CONNECTION_STATUS,t)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return Kt.getItem(Jt.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const t=Kt.getItem(Jt.CONNECTED_NAMESPACES);return t!=null&&t.length?t.split(","):[]}catch{return[]}},setConnectedNamespaces(t){try{const e=Array.from(new Set(t));Kt.setItem(Jt.CONNECTED_NAMESPACES,e.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(t){try{const e=He.getConnectedNamespaces();e.includes(t)||(e.push(t),He.setConnectedNamespaces(e))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(t){try{const e=He.getConnectedNamespaces(),n=e.indexOf(t);n>-1&&(e.splice(n,1),He.setConnectedNamespaces(e))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return Kt.getItem(Jt.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(t){try{Kt.setItem(Jt.TELEGRAM_SOCIAL_PROVIDER,t)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{Kt.removeItem(Jt.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let t={};try{const e=Kt.getItem(Jt.PORTFOLIO_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromBalanceCache(t){try{const e=He.getBalanceCache();Kt.setItem(Jt.PORTFOLIO_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getBalanceCacheForCaipAddress(t){try{const n=He.getBalanceCache()[t];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.portfolio))return n.balance;He.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateBalanceCache(t){try{const e=He.getBalanceCache();e[t.caipAddress]=t,Kt.setItem(Jt.PORTFOLIO_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getNativeBalanceCache(){let t={};try{const e=Kt.getItem(Jt.NATIVE_BALANCE_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get balance cache")}return t},removeAddressFromNativeBalanceCache(t){try{const e=He.getBalanceCache();Kt.setItem(Jt.NATIVE_BALANCE_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove address from balance cache",t)}},getNativeBalanceCacheForCaipAddress(t){try{const n=He.getNativeBalanceCache()[t];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.nativeBalance))return n;console.info("Discarding cache for address",t),He.removeAddressFromBalanceCache(t)}catch{console.info("Unable to get balance cache for address",t)}},updateNativeBalanceCache(t){try{const e=He.getNativeBalanceCache();e[t.caipAddress]=t,Kt.setItem(Jt.NATIVE_BALANCE_CACHE,JSON.stringify(e))}catch{console.info("Unable to update balance cache",t)}},getEnsCache(){let t={};try{const e=Kt.getItem(Jt.ENS_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get ens name cache")}return t},getEnsFromCacheForAddress(t){try{const n=He.getEnsCache()[t];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.ens))return n.ens;He.removeEnsFromCache(t)}catch{console.info("Unable to get ens name from cache",t)}},updateEnsCache(t){try{const e=He.getEnsCache();e[t.address]=t,Kt.setItem(Jt.ENS_CACHE,JSON.stringify(e))}catch{console.info("Unable to update ens name cache",t)}},removeEnsFromCache(t){try{const e=He.getEnsCache();Kt.setItem(Jt.ENS_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove ens name from cache",t)}},getIdentityCache(){let t={};try{const e=Kt.getItem(Jt.IDENTITY_CACHE);t=e?JSON.parse(e):{}}catch{console.info("Unable to get identity cache")}return t},getIdentityFromCacheForAddress(t){try{const n=He.getIdentityCache()[t];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.identity))return n.identity;He.removeIdentityFromCache(t)}catch{console.info("Unable to get identity from cache",t)}},updateIdentityCache(t){try{const e=He.getIdentityCache();e[t.address]={identity:t.identity,timestamp:t.timestamp},Kt.setItem(Jt.IDENTITY_CACHE,JSON.stringify(e))}catch{console.info("Unable to update identity cache",t)}},removeIdentityFromCache(t){try{const e=He.getIdentityCache();Kt.setItem(Jt.IDENTITY_CACHE,JSON.stringify({...e,[t]:void 0}))}catch{console.info("Unable to remove identity from cache",t)}},getTonWalletsCache(){try{const t=Kt.getItem(Jt.TON_WALLETS_CACHE),e=t?JSON.parse(t):void 0;if(e&&!this.isCacheExpired(e.timestamp,this.cacheExpiry.tonWallets))return e;He.removeTonWalletsCache()}catch{console.info("Unable to get ton wallets cache")}},updateTonWalletsCache(t){try{const e=He.getTonWalletsCache()||{timestamp:0,wallets:[]};e.timestamp=new Date().getTime(),e.wallets=t,Kt.setItem(Jt.TON_WALLETS_CACHE,JSON.stringify(e))}catch{console.info("Unable to update ton wallets cache",t)}},removeTonWalletsCache(){try{Kt.removeItem(Jt.TON_WALLETS_CACHE)}catch{console.info("Unable to remove ton wallets cache")}},clearAddressCache(){try{Kt.removeItem(Jt.PORTFOLIO_CACHE),Kt.removeItem(Jt.NATIVE_BALANCE_CACHE),Kt.removeItem(Jt.ENS_CACHE),Kt.removeItem(Jt.IDENTITY_CACHE),Kt.removeItem(Jt.HISTORY_TRANSACTIONS_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(t){try{Kt.setItem(Jt.PREFERRED_ACCOUNT_TYPES,JSON.stringify(t))}catch{console.info("Unable to set preferred account types",t)}},getPreferredAccountTypes(){try{const t=Kt.getItem(Jt.PREFERRED_ACCOUNT_TYPES);return t?JSON.parse(t):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(t,e){try{const n=He.getConnections(),i=n[e]??[],s=new Map;for(const o of i)s.set(o.connectorId,{...o});for(const o of t){const a=s.get(o.connectorId),c=o.connectorId===we.CONNECTOR_ID.AUTH;if(a&&!c){const l=new Set(a.accounts.map(h=>h.address.toLowerCase())),d=o.accounts.filter(h=>!l.has(h.address.toLowerCase()));a.accounts.push(...d)}else s.set(o.connectorId,{...o})}const r={...n,[e]:Array.from(s.values())};Kt.setItem(Jt.CONNECTIONS,JSON.stringify(r))}catch(n){console.error("Unable to sync connections to storage",n)}},getConnections(){try{const t=Kt.getItem(Jt.CONNECTIONS);return t?JSON.parse(t):{}}catch(t){return console.error("Unable to get connections from storage",t),{}}},deleteAddressFromConnection({connectorId:t,address:e,namespace:n}){try{const i=He.getConnections(),s=i[n]??[],r=new Map(s.map(a=>[a.connectorId,a])),o=r.get(t);o&&(o.accounts.filter(c=>c.address.toLowerCase()!==e.toLowerCase()).length===0?r.delete(t):r.set(t,{...o,accounts:o.accounts.filter(c=>c.address.toLowerCase()!==e.toLowerCase())})),Kt.setItem(Jt.CONNECTIONS,JSON.stringify({...i,[n]:Array.from(r.values())}))}catch{console.error(`Unable to remove address "${e}" from connector "${t}" in namespace "${n}"`)}},getDisconnectedConnectorIds(){try{const t=Kt.getItem(Jt.DISCONNECTED_CONNECTOR_IDS);return t?JSON.parse(t):{}}catch{console.info("Unable to get disconnected connector ids")}return{}},addDisconnectedConnectorId(t,e){try{const n=He.getDisconnectedConnectorIds(),i=n[e]??[];i.push(t),Kt.setItem(Jt.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[e]:Array.from(new Set(i))}))}catch{console.error(`Unable to set disconnected connector id "${t}" for namespace "${e}"`)}},removeDisconnectedConnectorId(t,e){try{const n=He.getDisconnectedConnectorIds();let i=n[e]??[];i=i.filter(s=>s.toLowerCase()!==t.toLowerCase()),Kt.setItem(Jt.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[e]:Array.from(new Set(i))}))}catch{console.error(`Unable to remove disconnected connector id "${t}" for namespace "${e}"`)}},isConnectorDisconnected(t,e){try{return(He.getDisconnectedConnectorIds()[e]??[]).some(s=>s.toLowerCase()===t.toLowerCase())}catch{console.info(`Unable to get disconnected connector id "${t}" for namespace "${e}"`)}return!1},getTransactionsCache(){try{const t=Kt.getItem(Jt.HISTORY_TRANSACTIONS_CACHE);return t?JSON.parse(t):{}}catch{console.info("Unable to get transactions cache")}return{}},getTransactionsCacheForAddress({address:t,chainId:e=""}){var n;try{const s=(n=He.getTransactionsCache()[t])==null?void 0:n[e];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.transactionsHistory)
137)return s.transactions;He.removeTransactionsCache({address:t,chainId:e})}catch{console.info("Unable to get transactions cache")}},updateTransactionsCache({address:t,chainId:e="",timestamp:n,transactions:i}){try{const s=He.getTransactionsCache();s[t]={...s[t],[e]:{timestamp:n,transactions:i}},Kt.setItem(Jt.HISTORY_TRANSACTIONS_CACHE,JSON.stringify(s))}catch{console.info("Unable to update transactions cache",{address:t,chainId:e,timestamp:n,transactions:i})}},removeTransactionsCache({address:t,chainId:e}){try{const n=He.getTransactionsCache(),i=(n==null?void 0:n[t])||{},{[e]:s,...r}=i;Kt.setItem(Jt.HISTORY_TRANSACTIONS_CACHE,JSON.stringify({...n,[t]:r}))}catch{console.info("Unable to remove transactions cache",{address:t,chainId:e})}},getTokenPriceCache(){try{const t=Kt.getItem(Jt.TOKEN_PRICE_CACHE);return t?JSON.parse(t):{}}catch{console.info("Unable to get token price cache")}return{}},getTokenPriceCacheForAddresses(t){try{const n=He.getTokenPriceCache()[t.join(",")];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.tokenPrice))return n.tokenPrice;He.removeTokenPriceCache(t)}catch{console.info("Unable to get token price cache for addresses",t)}},updateTokenPriceCache(t){try{const e=He.getTokenPriceCache();e[t.addresses.join(",")]={timestamp:t.timestamp,tokenPrice:t.tokenPrice},Kt.setItem(Jt.TOKEN_PRICE_CACHE,JSON.stringify(e))}catch{console.info("Unable to update token price cache",t)}},removeTokenPriceCache(t){try{const e=He.getTokenPriceCache();Kt.setItem(Jt.TOKEN_PRICE_CACHE,JSON.stringify({...e,[t.join(",")]:void 0}))}catch{console.info("Unable to remove token price cache",t)}},getLatestAppKitVersion(){try{const t=this.getLatestAppKitVersionCache(),e=t==null?void 0:t.version;return e&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.latestAppKitVersion)?e:void 0}catch{console.info("Unable to get latest AppKit version")}},getLatestAppKitVersionCache(){try{const t=Kt.getItem(Jt.LATEST_APPKIT_VERSION);return t?JSON.parse(t):{}}catch{console.info("Unable to get latest AppKit version cache")}return{}},updateLatestAppKitVersion(t){try{const e=He.getLatestAppKitVersionCache();e.timestamp=t.timestamp,e.version=t.version,Kt.setItem(Jt.LATEST_APPKIT_VERSION,JSON.stringify(e))}catch{console.info("Unable to update latest AppKit version on local storage",t)}}},Ue={getWindow(){if(!(typeof window>"u"))return window},isMobile(){var t;return this.isClient()?!!(window!=null&&window.matchMedia&&typeof window.matchMedia=="function"&&((t=window.matchMedia("(pointer:coarse)"))!=null&&t.matches)||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(t,e=""){return t==null?void 0:t.caipNetworkId.toLocaleLowerCase().includes(e.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return Ue.isMobile()&&t.includes("android")},isIos(){if(!this.isMobile())return!1;const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return t.includes("iphone")||t.includes("ipad")},isSafari(){return this.isClient()?(window==null?void 0:window.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(t){return t?t-Date.now()<=fn.TEN_SEC_MS:!0},isAllowedRetry(t,e=fn.ONE_SEC_MS){return Date.now()-t>=e},copyToClopboard(t){navigator.clipboard.writeText(t)},isIframe(){try{return(window==null?void 0:window.self)!==(window==null?void 0:window.top)}catch{return!1}},isSafeApp(){var t,e;if(Ue.isClient()&&window.self!==window.top)try{const n=(e=(t=window==null?void 0:window.location)==null?void 0:t.ancestorOrigins)==null?void 0:e[0],i="https://app.safe.global";if(n){const s=new URL(n),r=new URL(i);return s.hostname===r.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+fn.FOUR_MINUTES_MS},getNetworkId(t){return t==null?void 0:t.split(":")[1]},getPlainAddress(t){return t==null?void 0:t.split(":")[2]},async wait(t){return new Promise(e=>{setTimeout(e,t)})},debounce(t,e=500){let n;return(...i)=>{function s(){t(...i)}n&&clearTimeout(n),n=setTimeout(s,e)}},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},formatNativeUrl(t,e,n=null){if(Ue.isHttpUrl(t))return this.formatUniversalUrl(t,e);let i=t,s=n;i.includes("://")||(i=t.replaceAll("/","").replaceAll(":",""),i=`${i}://`),i.endsWith("/")||(i=`${i}/`),s&&!(s!=null&&s.endsWith("/"))&&(s=`${s}/`),this.isTelegram()&&this.isAndroid()&&(e=encodeURIComponent(e));const r=encodeURIComponent(e);return{redirect:`${i}wc?uri=${r}`,redirectUniversalLink:s?`${s}wc?uri=${r}`:void 0,href:i}},formatUniversalUrl(t,e){if(!Ue.isHttpUrl(t))return this.formatNativeUrl(t,e);let n=t;n.endsWith("/")||(n=`${n}/`);const i=encodeURIComponent(e);return{redirect:`${n}wc?uri=${i}`,href:n}},getOpenTargetForPlatform(t){return t==="popupWindow"?t:this.isTelegram()?He.getTelegramSocialProvider()?"_top":"_blank":t},openHref(t,e,n){window==null||window.open(t,this.getOpenTargetForPlatform(e),n||"noreferrer noopener")},returnOpenHref(t,e,n){return window==null?void 0:window.open(t,this.getOpenTargetForPlatform(e),n||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){var n,i;if(typeof window>"u")return!1;const t=window!=null&&window.matchMedia&&typeof window.matchMedia=="function"?(n=window.matchMedia("(display-mode: standalone)"))==null?void 0:n.matches:!1,e=(i=window==null?void 0:window.navigator)==null?void 0:i.standalone;return!!(t||e)},async preloadImage(t){const e=new Promise((n,i)=>{const s=new Image;s.onload=n,s.onerror=i,s.crossOrigin="anonymous",s.src=t});return Promise.race([e,Ue.wait(2e3)])},parseBalance(t,e){let n="0.000";if(typeof t=="string"){const c=Number(t);if(!isNaN(c)){const l=(Math.floor(c*1e3)/1e3).toFixed(3);l&&(n=l)}}const[i,s]=n.split("."),r=i||"0",o=s||"000";return{formattedText:`${r}.${o}${e?` ${e}`:""}`,value:r,decimals:o,symbol:e}},getApiUrl(){return we.W3M_API_URL},getBlockchainApiUrl(){return we.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return we.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})},parseError(t){var e,n;return typeof t=="string"?t:typeof((n=(e=t==null?void 0:t.issues)==null?void 0:e[0])==null?void 0:n.message)=="str
137ing"?t.issues[0].message:t instanceof Error?t.message:"Unknown error"},sortRequestedNetworks(t,e=[]){const n={};return e&&t&&(t.forEach((i,s)=>{n[i]=s}),e.sort((i,s)=>{const r=n[i.id],o=n[s.id];return r!==void 0&&o!==void 0?r-o:r!==void 0?-1:o!==void 0?1:0})),e},calculateBalance(t){let e=0;for(const n of t)e+=n.value??0;return e},formatTokenBalance(t){const e=t.toFixed(2),[n,i]=e.split(".");return{dollars:n,pennies:i}},isAddress(t,e="eip155"){switch(e){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(t)||/^(?:0x)?[0-9A-F]{40}$/iu.test(t))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(t);default:return!1}},uniqueBy(t,e){const n=new Set;return t.filter(i=>{const s=i[e];return n.has(s)?!1:(n.add(s),!0)})},generateSdkVersion(t,e,n){const s=t.length===0?fn.ADAPTER_TYPES.UNIVERSAL:t.map(r=>r.adapterType).join(",");return`${e}-${s}-${n}`},createAccount(t,e,n,i,s){return{namespace:t,address:e,type:n,publicKey:i,path:s}},isCaipAddress(t){if(typeof t!="string")return!1;const e=t.split(":"),n=e[0];return e.filter(Boolean).length===3&&n in we.CHAIN_NAME_MAP},getAccount(t){return t?typeof t=="string"?{address:t,chainId:void 0}:{address:t.address,chainId:t.chainId}:{address:void 0,chainId:void 0}},isMac(){const t=window==null?void 0:window.navigator.userAgent.toLowerCase();return t.includes("macintosh")&&!t.includes("safari")},formatTelegramSocialLoginUrl(t){const e=`--${encodeURIComponent(window==null?void 0:window.location.href)}`,n="state=";if(new URL(t).host==="auth.magic.link"){const s="provider_authorization_url=",r=t.substring(t.indexOf(s)+s.length),o=this.injectIntoUrl(decodeURIComponent(r),n,e);return t.replace(r,encodeURIComponent(o))}return this.injectIntoUrl(t,n,e)},injectIntoUrl(t,e,n){const i=t.indexOf(e);if(i===-1)throw new Error(`${e} parameter not found in the URL: ${t}`);const s=t.indexOf("&",i),r=e.length,o=s!==-1?s:t.length,a=t.substring(0,i+r),c=t.substring(i+r,o),l=t.substring(s),d=c+n;return a+d+l}},Ite={BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org"},x6e={validateCaipAddress(t){var e;if(((e=t.split(":"))==null?void 0:e.length)!==3)throw new Error("Invalid CAIP Address");return t},parseCaipAddress(t){const e=t.split(":");if(e.length!==3)throw new Error(`Invalid CAIP-10 address: ${t}`);const[n,i,s]=e;if(!n||!i||!s)throw new Error(`Invalid CAIP-10 address: ${t}`);return{chainNamespace:n,chainId:i,address:s}},parseCaipNetworkId(t){const e=t.split(":");if(e.length!==2)throw new Error(`Invalid CAIP-2 network id: ${t}`);const[n,i]=e;if(!n||!i)throw new Error(`Invalid CAIP-2 network id: ${t}`);return{chainNamespace:n,chainId:i}}};var tb={};const E6e="https://secure.walletconnect.org/sdk",_6e=(typeof process<"u"&&typeof tb<"u"?tb.NEXT_PUBLIC_SECURE_SITE_SDK_URL:void 0)||E6e,S6e=(typeof process<"u"&&typeof tb<"u"?tb.NEXT_PUBLIC_DEFAULT_LOG_LEVEL:void 0)||"error",A6e=(typeof process<"u"&&typeof tb<"u"?tb.NEXT_PUBLIC_SECURE_SITE_SDK_VERSION:void 0)||"4",Wt={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@appkit-wallet/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",APP_RELOAD:"@w3m-app/RELOAD",APP_RPC_ABORT:"@w3m-app/RPC_ABORT",FRAME_SWITCH_NETWORK_E
137RROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",FRAME_READY:"@w3m-frame/READY",FRAME_RELOAD_SUCCESS:"@w3m-frame/RELOAD_SUCCESS",FRAME_RELOAD_ERROR:"@w3m-frame/RELOAD_ERROR",FRAME_RPC_ABORT_SUCCESS:"@w3m-frame/RPC_ABORT_SUCCESS",FRAME_RPC_ABORT_ERROR:"@w3m-frame/RPC_ABORT_ERROR",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},Wi={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints","wallet_getAssets"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","wallet_revokePermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RP
137C_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}},WV={transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u},Rr={set(t,e){Dc.isClient&&localStorage.setItem(`${Wt.STORAGE_KEY}${t}`,e)},get(t){return Dc.isClient?localStorage.getItem(`${Wt.STORAGE_KEY}${t}`):null},delete(t,e){Dc.isClient&&(e?localStorage.removeItem(t):localStorage.removeItem(`${Wt.STORAGE_KEY}${t}`))}},tx=30*1e3,Dc={checkIfAllowedToTriggerEmail(){const t=Rr.get(Wt.LAST_EMAIL_LOGIN_TIME);if(t){const e=Date.now()-Number(t);if(e<tx){const n=Math.ceil((tx-e)/1e3);throw new Error(`Please try again after ${n} seconds`)}}},getTimeToNextEmailLogin(){const t=Rr.get(Wt.LAST_EMAIL_LOGIN_TIME);if(t){const e=Date.now()-Number(t);if(e<tx)return Math.ceil((tx-e)/1e3)}return 0},checkIfRequestExists(t){return Wi.NOT_SAFE_RPC_METHODS.includes(t.method)||Wi.SAFE_RPC_METHODS.includes(t.method)},getResponseType(t){return typeof t=="string"&&((t==null?void 0:t.match(WV.transactionHash))||(t==null?void 0:t.match(WV.signedMessage)))?Wt.RPC_RESPONSE_TYPE_TX:Wt.RPC_RESPONSE_TYPE_OBJECT},checkIfRequestIsSafe(t){return Wi.SAFE_RPC_METHODS.includes(t.method)},isClient:typeof window<"u"};var Pi;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const r={};for(const o of s)r[o]=o;return r},t.getValidEnumValues=s=>{const r=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of r)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(r){return s[r]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const r=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&r.push(o);return r},t.find=(s,r)=>{for(const o of s)if(r(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function i(s,r=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}t.joinValues=i,t.jsonStringifyReplacer=(s,r)=>typeof r=="bigint"?r.toString():r})(Pi||(Pi={}));var aP;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(aP||(aP={}));const Ut=Pi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),W0=t=>{switch(typeof t){case"undefined":return Ut.undefined;case"string":return Ut.string;case"number":return isNaN(t)?Ut.nan:Ut.number;case"boolean":return Ut.boolean;case"function":return Ut.function;case"bigint":return Ut.bigint;case"symbol":return Ut.symbol;case"object":return Array.isArray(t)?Ut.array:t===null?Ut.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ut.promise:typeof Map<"u"&&t instanceof Map?Ut.map:typeof Set<"u"&&t instanceof Set?Ut.set:typeof Date<"u"&&t instanceof Date?Ut.date:Ut.object;default:return Ut.unknown}}
vendor: 42,403 bytes, line 137
137,bt=Pi.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),T6e=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Tu extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(r){return r.message},i={_errors:[]},s=r=>{for(const o of r.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)i._errors.push(n(o));else{let a=i,c=0;for(;c<o.path.length;){const l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return s(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pi.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},i=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):i.push(e(s));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Tu.create=t=>new Tu(t);const h5=(t,e)=>{let n;switch(t.code){case bt.invalid_type:t.received===Ut.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case bt.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Pi.jsonStringifyReplacer)}`;break;case bt.unrecognized_keys:n=`Unrecognized key(s) in object: ${Pi.joinValues(t.keys,", ")}`;break;case bt.invalid_union:n="Invalid input";break;case bt.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Pi.joinValues(t.options)}`;break;case bt.invalid_enum_value:n=`Invalid enum value. Expected ${Pi.joinValues(t.options)}, received '${t.received}'`;break;case bt.invalid_arguments:n="Invalid function arguments";break;case bt.invalid_return_type:n="Invalid function return type";break;case bt.invalid_date:n="Invalid date";break;case bt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Pi.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case bt.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case bt.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case bt.custom:n="Invalid input";break;case bt.invalid_intersection_types:n="Intersection results could not be merged";break;case bt.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case bt.not_finite:n="Number must be finite";break;default:n=e.defaultError,Pi.assertNever(t)}return{message:n}};let Dte=h5;function k6e(t){Dte=t}function t_(){return Dte}const n_=t=>{const{data:e,path:n,errorMaps:i,issueData:s}=t,r=[...n,...s.path||[]],o={...s,path:r};let a="";const c=i.filter(l=>!!l).slice().reverse();for(const l of c)a=l(o,{data:e,defaultError:a}).message;return{...s,path:r,message:s.message||a}},N6e=[];function jt(t,e){const n=n_({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,t_(),h5].filter(i=>!!i)});t.common.issues.push(n)}class zo{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const s of n){if(s.status==="aborted")return Vn;s.status==="dirty"&&e.dirty(),i.push(s.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const s of n)i.push({key:await s.key,value:await s.value});return zo.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const s of n){const{key:r,value:o}=s;if(r.status==="aborted"||o.status==="aborted")return Vn;r.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(i[r.value]=o.value)}return{status:e.value,value:i}}}const Vn=Object.freeze({status:"aborted"}),Ote=t=>({status:"dirty",value:t}),ma=t=>({status:"valid",value:t}),cP=t=>t.status==="aborted",lP=t=>t.status==="dirty",f5=t=>t.status==="valid",i_=t=>typeof Promise<"u"&&t instanceof Promise;var bn;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(bn||(bn={}));class Dd{constructor(e,n,i,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const qV=(t,e)=>{if(f5(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Tu(t.common.issues);return this._error=n,this._error}}};function Gn(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:s}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>o.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:i??a.defaultError}:{message:n??a.defaultError},description:s}}class ni{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return W0(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:W0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new zo,ctx:{common:e.parent.common,data:e.data,parsedType:W0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(i_(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){var i;const s={common:{issues:[],async:(i=n==null?void 0:n.async)!==null&&i!==void 0?i:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:W0(e)},r=this._parseSync({data:e,path:s.path,parent:s});return qV(s,r)}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:W0(e)},s=this._parse({data:e,path:i.path,parent:i}),r=await(i_(s)?s:Promise.resolve(s));return qV(i,r)}refine(e,n){const i=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,r)=>{const o=e(s),a=()=>r.addIssue({code:bt.custom,...i(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((i,s)=>e(i)?!0:(s.addIssue(typeof n=="function"?n(i,s):n),!1))}_refinement(e){return new Lu({schema:this,typeName:Rn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return rf.create(this,this._def)}nullable(){return Ig.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ku.create(this,this._def)}promise(){return ib.create(this,this._def)}or(e){return y5.create([this,e],this._def)}and(e){return b5.create(this,e,this._def)}transform(e){return new Lu({...Gn(this._def),schema:this,typeName:Rn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new E5({...Gn(this._def),innerType:this,defaultValue:n,typeName:Rn.ZodDefault})}brand(){return new Lte({typeName:Rn.ZodBranded,type:this,...Gn(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new a_({...Gn(this._def),innerType:this,catchValue:n,typeName:Rn.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return I6.create(this,e)}readonly(){return l_.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const R6e=/^c[^\s-]{8,}$/i,P6e=/^[a-z][a-z0-9]*$/,I6e=/^[0-9A-HJKMNP-TV-Z]{26}$/,D6e=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,O6e=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,M6e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let zT;const L6e=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,$6e=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,U6e=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function B6e(t,e){return!!((e==="v4"||!e)&&L6e.test(t)||(e==="v6"||!e)&&$6e.test(t))}class Su extends ni{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ut.string){const r=this._getOrReturnCtx(e);return jt(r,{code:bt.invalid_type,expected:Ut.string,received:r.parsedType}),Vn}const i=new zo;let s;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="max")e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),i.dirty());else if(r.kind==="length"){const o=e.data.length>r.value,a=e.data.length<r.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?jt(s,{code:bt.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&jt(s,{code:bt.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),i.dirty())}else if(r.kind==="email")O6e.test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"email",code:bt.invalid_string,message:r.message}),i.dirty());else if(r.kind==="emoji")zT||(zT=new RegExp(M6e,"u")),zT.test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"emoji",code:bt.invalid_string,message:r.message}),i.dirty());else if(r.kind==="uuid")D6e.test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"uuid",code:bt.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid")R6e.test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"cuid",code:bt.invalid_string,message:r.message}),i.dirty());else if(r.kind==="cuid2")P6e.test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"cuid2",code:bt.invalid_string,message:r.message}),i.dirty());else if(r.kind==="ulid")I6e.test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"ulid",code:bt.invalid_string,message:r.message}),i.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),jt(s,{validation:"url",code:bt.invalid_string,message:r.message}),i.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"regex",code:bt.invalid_string,message:r.message}),i.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),i.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.invalid_string,validation:{startsWith:r.value},message:r.message}),i.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.invalid_string,validation:{endsWith:r.value},message:r.message}),i.dirty()):r.kind==="datetime"?U6e(r).test(e.data)||(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.invalid_string,validation:"datetime",message:r.message}),i.dirty()):r.kind==="ip"?B6e(e.data,r.version)||(s=this._getOrReturnCtx(e,s),jt(s,{validation:"ip",code:bt.invalid_string,message:r.message}),i.dirty()):Pi.assertNever(r);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(s=>e.test(s),{validation:n,code:bt.invalid_string,...bn.errToObj(i)})}_addCheck(e){return new Su({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...bn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...bn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...bn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...bn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...bn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...bn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...bn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...bn.errToObj(e)})}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,...bn.errToObj(e==null?void 0:e.message)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...bn.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...bn.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...bn.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...bn.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...bn.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...bn.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...bn.errToObj(n)})}nonempty(e){return this.min(1,bn.errToObj(e))}trim(){return new Su({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Su({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Su({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Su.create=t=>{var e;return new Su({checks:[],typeName:Rn.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Gn(t)})};function F6e(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,s=n>i?n:i,r=parseInt(t.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return r%o/Math.pow(10,s)}class Ep extends ni{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ut.number){const r=this._getOrReturnCtx(e);return jt(r,{code:bt.invalid_type,expected:Ut.number,received:r.parsedType}),Vn}let i;const s=new zo;for(const r of this._def.checks)r.kind==="int"?Pi.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?F6e(e.data,r.value)!==0&&(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.not_finite,message:r.message}),s.dirty()):Pi.assertNever(r);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,bn.toString(n))}gt(e,n){return this.setLimit("min",e,!1,bn.toString(n))}lte(e,n){return this.setLimit("max",e,!0,bn.toString(n))}lt(e,n){return this.setLimit("max",e,!1,bn.toString(n))}setLimit(e,n,i,s){return new Ep({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:bn.toString(s)}]})}_addCheck(e){return new Ep({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:bn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:bn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:bn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:bn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:bn.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:bn.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:bn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:bn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:bn.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Pi.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Ep.create=t=>new Ep({checks:[],typeName:Rn.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Gn(t)});class _p extends ni{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ut.bigint){const r=this._getOrReturnCtx(e);return jt(r,{code:bt.invalid_type,expected:Ut.bigint,received:r.parsedType}),Vn}let i;const s=new zo;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),jt(i,{code:bt.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):Pi.assertNever(r);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,bn.toString(n))}gt(e,n){return this.setLimit("min",e,!1,bn.toString(n))}lte(e,n){return this.setLimit("max",e,!0,bn.toString(n))}lt(e,n){return this.setLimit("max",e,!1,bn.toString(n))}setLimit(e,n,i,s){return new _p({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:bn.toString(s)}]})}_addCheck(e){return new _p({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:bn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:bn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:bn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:bn.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:bn.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}_p.create=t=>{var e;return new _p({checks:[],typeName:Rn.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Gn(t)})};class p5 extends ni{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ut.boolean){const i=this._getOrReturnCtx(e);return jt(i,{code:bt.invalid_type,expected:Ut.boolean,received:i.parsedType}),Vn}return ma(e.data)}}p5.create=t=>new p5({typeName:Rn.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Gn(t)});class Rg extends ni{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ut.date){const r=this._getOrReturnCtx(e);return jt(r,{code:bt.invalid_type,expected:Ut.date,received:r.parsedType}),Vn}if(isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return jt(r,{code:bt.invalid_date}),Vn}const i=new zo;let s;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),i.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),jt(s,{code:bt.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),i.dirty()):Pi.assertNever(r);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Rg({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:bn.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:bn.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Rg.create=t=>new Rg({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Rn.ZodDate,...Gn(t)});class s_ extends ni{_parse(e){if(this._getType(e)!==Ut.symbol){const i=this._getOrReturnCtx(e);return jt(i,{code:bt.invalid_type,expected:Ut.symbol,received:i.parsedType}),Vn}return ma(e.data)}}s_.create=t=>new s_({typeName:Rn.ZodSymbol,...Gn(t)});class m5 extends ni{_parse(e){if(this._getType(e)!==Ut.undefined){const i=this._getOrReturnCtx(e);return jt(i,{code:bt.invalid_type,expected:Ut.undefined,received:i.parsedType}),Vn}return ma(e.data)}}m5.create=t=>new m5({typeName:Rn.ZodUndefined,...Gn(t)});class g5 extends ni{_parse(e){if(this._getType(e)!==Ut.null){const i=this._getOrReturnCtx(e);return jt(i,{code:bt.invalid_type,expected:Ut.null,received:i.parsedType}),Vn}return ma(e.data)}}g5.create=t=>new g5({typeName:Rn.ZodNull,...Gn(t)});class nb extends ni{constructor(){super(...arguments),this._any=!0}_parse(e){return ma(e.data)}}nb.create=t=>new nb({typeName:Rn.ZodAny,...Gn(t)});class hg extends ni{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ma(e.data)}}hg.create=t=>new hg({typeName:Rn.ZodUnknown,...Gn(t)});class Cf extends ni{_parse(e){const n=this._getOrReturnCtx(e);return jt(n,{code:bt.invalid_type,expected:Ut.never,received:n.parsedType}),Vn}}Cf.create=t=>new Cf({typeName:Rn.ZodNever,...Gn(t)});class r_ extends ni{_parse(e){if(this._getType(e)!==Ut.undefined){const i=this._getOrReturnCtx(e);return jt(i,{code:bt.invalid_type,expected:Ut.void,received:i.parsedType}),Vn}return ma(e.data)}}r_.create=t=>new r_({typeName:Rn.ZodVoid,...Gn(t)});class ku extends ni{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),s=this._def;if(n.parsedType!==Ut.array)return jt(n,{code:bt.invalid_type,expected:Ut.array,received:n.parsedType}),Vn;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(jt(n,{code:o?bt.too_big:bt.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),i.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(jt(n,{code:bt.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),i.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(jt(n,{code:bt.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Dd(n,o,n.path,a)))).then(o=>zo.mergeArray(i,o));const r=[...n.data].map((o,a)=>s.type._parseSync(new Dd(n,o,n.path,a)));return zo.mergeArray(i,r)}get element(){return this._def.type}min(e,n){return new ku({...this._def,minLength:{value:e,message:bn.toString(n)}})}max(e,n){return new ku({...this._def,maxLength:{value:e,message:bn.toString(n)}})}length(e,n){return new ku({...this._def,exactLength:{value:e,message:bn.toString(n)}})}nonempty(e){return this.min(1,e)}}ku.create=(t,e)=>new ku({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Rn.ZodArray,...Gn(e)});function Vy(t){if(t instanceof Ds){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=rf.create(Vy(i))}return new Ds({...t._def,shape:()=>e})}else return t instanceof ku?new ku({...t._def,type:Vy(t.element)}):t instanceof rf?rf.create(Vy(t.unwrap())):t instanceof Ig?Ig.create(Vy(t.unwrap())):t instanceof Od?Od.create(t.items.map(e=>Vy(e))):t}class Ds extends ni{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Pi.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Ut.object){const l=this._getOrReturnCtx(e);return jt(l,{code:bt.invalid_type,expected:Ut.object,received:l.parsedType}),Vn}const{status:i,ctx:s}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Cf&&this._def.unknownKeys==="strip"))for(const l in s.data)o.includes(l)||a.push(l);const c=[];for(const l of o){const d=r[l],h=s.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new Dd(s,h,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof Cf){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(l==="strict")a.length>0&&(jt(s,{code:bt.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of a){const h=s.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new Dd(s,h,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of c){const h=await d.key;l.push({key:h,value:await d.value,alwaysSet:d.alwaysSet})}return l}).then(l=>zo.mergeObjectSync(i,l)):zo.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(e){return bn.errToObj,new Ds({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{var s,r,o,a;const c=(o=(r=(s=this._def).errorMap)===null||r===void 0?void 0:r.call(s,n,i).message)!==null&&o!==void 0?o:i.defaultError;return n.code==="unrecognized_keys"?{message:(a=bn.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Ds({...this._def,unknownKeys:"strip"})}passthrough(){return new Ds({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ds({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ds({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Rn.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Ds({...this._def,catchall:e})}pick(e){const n={};return Pi.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(n[i]=this.shape[i])}),new Ds({...this._def,shape:()=>n})}omit(e){const n={};return Pi.objectKeys(this.shape).forEach(i=>{e[i]||(n[i]=this.shape[i])}),new Ds({...this._def,shape:()=>n})}deepPartial(){return Vy(this)}partial(e){const n={};return Pi.objectKeys(this.shape).forEach(i=>{const s=this.shape[i];e&&!e[i]?n[i]=s:n[i]=s.optional()}),new Ds({...this._def,shape:()=>n})}required(e){const n={};return Pi.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])n[i]=this.shape[i];else{let r=this.shape[i];for(;r instanceof rf;)r=r._def.innerType;n[i]=r}}),new Ds({...this._def,shape:()=>n})}keyof(){return Mte(Pi.objectKeys(this.shape))}}Ds.create=(t,e)=>new Ds({shape:()=>t,unknownKeys:"strip",catchall:Cf.create(),typeName:Rn.ZodObject,...Gn(e)});Ds.strictCreate=(t,e)=>new Ds({shape:()=>t,unknownKeys:"strict",catchall:Cf.create(),typeName:Rn.ZodObject,...Gn(e)});Ds.lazycreate=(t,e)=>new Ds({shape:t,unknownKeys:"strip",catchall:Cf.create(),typeName:Rn.ZodObject,...Gn(e)});class y5 extends ni{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function s(r){for(const a of r)if(a.result.status==="valid")return a.result;for(const a of r)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=r.map(a=>new Tu(a.ctx.common.issues));return jt(n,{code:bt.invalid_union,unionErrors:o}),Vn}if(n.common.async)return Promise.all(i.map(async r=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await r._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let r;const o=[];for(const c of i){const l={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!r&&(r={result:d,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(r)return n.common.issues.push(...r.ctx.common.issues),r.result;const a=o.map(c=>new Tu(c));return jt(n,{code:bt.invalid_union,unionErrors:a}),Vn}}get options(){return this._def.options}}y5.create=(t,e)=>new y5({options:t,typeName:Rn.ZodUnion,...Gn(e)});const uE=t=>t instanceof v5?uE(t.schema):t instanceof Lu?uE(t.innerType()):t instanceof C5?[t.value]:t instanceof Sp?t.options:t instanceof x5?Object.keys(t.enum):t instanceof E5?uE(t._def.innerType):t instanceof m5?[void 0]:t instanceof g5?[null]:null;class sS extends ni{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ut.object)return jt(n,{code:bt.invalid_type,expected:Ut.object,received:n.parsedType}),Vn;const i=this.discriminator,s=n.data[i],r=this.optionsMap.get(s);return r?n.common.async?r._parseAsync({data:n.data,path:n.path,parent:n}):r._parseSync({data:n.data,path:n.path,parent:n}):(jt(n,{code:bt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Vn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const s=new Map;for(const r of n){const o=uE(r.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,r)}}return new sS({typeName:Rn.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Gn(i)})}}function uP(t,e){const n=W0(t),i=W0(e);if(t===e)return{valid:!0,data:t};if(n===Ut.object&&i===Ut.object){const s=Pi.objectKeys(e),r=Pi.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of r){const c=uP(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===Ut.array&&i===Ut.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let r=0;r<t.length;r++){const o=t[r],a=e[r],c=uP(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===Ut.date&&i===Ut.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class b5 extends ni{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),s=(r,o)=>{if(cP(r)||cP(o))return Vn;const a=uP(r.value,o.value);return a.valid?((lP(r)||lP(o))&&n.dirty(),{status:n.value,value:a.data}):(jt(i,{code:bt.invalid_intersection_types}),Vn)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([r,o])=>s(r,o)):s(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}b5.create=(t,e,n)=>new b5({left:t,right:e,typeName:Rn.ZodIntersection,...Gn(n)});class Od extends ni{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ut.array)return jt(i,{code:bt.invalid_type,expected:Ut.array,received:i.parsedType}),Vn;if(i.data.length<this._def.items.length)return jt(i,{code:bt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Vn;!this._def.rest&&i.data.length>this._def.items.length&&(jt(i,{code:bt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const r=[...i.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Dd(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(r).then(o=>zo.mergeArray(n,o)):zo.mergeArray(n,r)}get items(){return this._def.items}rest(e){return new Od({...this._def,rest:e})}}Od.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Od({items:t,typeName:Rn.ZodTuple,rest:null,...Gn(e)})};class w5 extends ni{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ut.object)return jt(i,{code:bt.invalid_type,expected:Ut.object,received:i.parsedType}),Vn;const s=[],r=this._def.keyType,o=this._def.valueType;for(const a in i.data)s.push({key:r._parse(new Dd(i,a,i.path,a)),value:o._parse(new Dd(i,i.data[a],i.path,a))});return i.common.async?zo.mergeObjectAsync(n,s):zo.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof ni?new w5({keyType:e,valueType:n,typeName:Rn.ZodRecord,...Gn(i)}):new w5({keyType:Su.create(),valueType:e,typeName:Rn.ZodRecord,...Gn(n)})}}class o_ extends ni{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ut.map)return jt(i,{code:bt.invalid_type,expected:Ut.map,received:i.parsedType}),Vn;const s=this._def.keyType,r=this._def.valueType,o=[...i.data.entries()].map(([a,c],l)=>({key:s._parse(new Dd(i,a,i.path,[l,"key"])),value:r._parse(new Dd(i,c,i.path,[l,"value"]))}));if(i.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return Vn;(l.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(l.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return Vn;(l.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(l.value,d.value)}return{status:n.value,value:a}}}}o_.create=(t,e,n)=>new o_({valueType:e,keyType:t,typeName:Rn.ZodMap,...Gn(n)});class Pg extends ni{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ut.set)return jt(i,{code:bt.invalid_type,expected:Ut.set,received:i.parsedType}),Vn;const s=this._def;s.minSize!==null&&i.data.size<s.minSize.value&&(jt(i,{code:bt.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&i.data.size>s.maxSize.value&&(jt(i,{code:bt.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const r=this._def.valueType;function o(c){const l=new Set;for(const d of c){if(d.status==="aborted")return Vn;d.status==="dirty"&&n.dirty(),l.add(d.value)}return{status:n.value,value:l}}const a=[...i.data.values()].map((c,l)=>r._parse(new Dd(i,c,i.path,l)));return i.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,n){return new Pg({...this._def,minSize:{value:e,message:bn.toString(n)}})}max(e,n){return new Pg({...this._def,maxSize:{value:e,message:bn.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Pg.create=(t,e)=>new Pg({valueType:t,minSize:null,maxSize:null,typeName:Rn.ZodSet,...Gn(e)});class v2 extends ni{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ut.function)return jt(n,{code:bt.invalid_type,expected:Ut.function,received:n.parsedType}),Vn;function i(a,c){return n_({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t_(),h5].filter(l=>!!l),issueData:{code:bt.invalid_arguments,argumentsError:c}})}function s(a,c){return n_({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t_(),h5].filter(l=>!!l),issueData:{code:bt.invalid_return_type,returnTypeError:c}})}const r={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ib){const a=this;return ma(async function(...c){const l=new Tu([]),d=await a._def.args.parseAsync(c,r).catch(g=>{throw l.addIssue(i(c,g)),l}),h=await Reflect.apply(o,this,d);return await a._def.returns._def.type.parseAsync(h,r).catch(g=>{throw l.addIssue(s(h,g)),l})})}else{const a=this;return ma(function(...c){const l=a._def.args.safeParse(c,r);if(!l.success)throw new Tu([i(c,l.error)]);const d=Reflect.apply(o,this,l.data),h=a._def.returns.safeParse(d,r);if(!h.success)throw new Tu([s(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new v2({...this._def,args:Od.create(e).rest(hg.create())})}returns(e){return new v2({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,i){return new v2({args:e||Od.create([]).rest(hg.create()),returns:n||hg.create(),typeName:Rn.ZodFunction,...Gn(i)})}}class v5 extends ni{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}v5.create=(t,e)=>new v5({getter:t,typeName:Rn.ZodLazy,...Gn(e)});class C5 extends ni{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return jt(n,{received:n.data,code:bt.invalid_literal,expected:this._def.value}),Vn}
137return{status:"valid",value:e.data}}get value(){return this._def.value}}C5.create=(t,e)=>new C5({value:t,typeName:Rn.ZodLiteral,...Gn(e)});function Mte(t,e){return new Sp({values:t,typeName:Rn.ZodEnum,...Gn(e)})}class Sp extends ni{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return jt(n,{expected:Pi.joinValues(i),received:n.parsedType,code:bt.invalid_type}),Vn}if(this._def.values.indexOf(e.data)===-1){const n=this._getOrReturnCtx(e),i=this._def.values;return jt(n,{received:n.data,code:bt.invalid_enum_value,options:i}),Vn}return ma(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e){return Sp.create(e)}exclude(e){return Sp.create(this.options.filter(n=>!e.includes(n)))}}Sp.create=Mte;class x5 extends ni{_parse(e){const n=Pi.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Ut.string&&i.parsedType!==Ut.number){const s=Pi.objectValues(n);return jt(i,{expected:Pi.joinValues(s),received:i.parsedType,code:bt.invalid_type}),Vn}if(n.indexOf(e.data)===-1){const s=Pi.objectValues(n);return jt(i,{received:i.data,code:bt.invalid_enum_value,options:s}),Vn}return ma(e.data)}get enum(){return this._def.values}}x5.create=(t,e)=>new x5({values:t,typeName:Rn.ZodNativeEnum,...Gn(e)});class ib extends ni{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ut.promise&&n.common.async===!1)return jt(n,{code:bt.invalid_type,expected:Ut.promise,received:n.parsedType}),Vn;const i=n.parsedType===Ut.promise?n.data:Promise.resolve(n.data);return ma(i.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ib.create=(t,e)=>new ib({type:t,typeName:Rn.ZodPromise,...Gn(e)});class Lu extends ni{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Rn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:o=>{jt(i,o),o.fatal?n.abort():n.dirty()},get path(){return i.path}};if(r.addIssue=r.addIssue.bind(r),s.type==="preprocess"){const o=s.transform(i.data,r);return i.common.issues.length?{status:"dirty",value:i.data}:i.common.async?Promise.resolve(o).then(a=>this._def.schema._parseAsync({data:a,path:i.path,parent:i})):this._def.schema._parseSync({data:o,path:i.path,parent:i})}if(s.type==="refinement"){const o=a=>{const c=s.refinement(a,r);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Vn:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?Vn:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!f5(o))return o;const a=s.transform(o.value,r);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>f5(o)?Promise.resolve(s.transform(o.value,r)).then(a=>({status:n.value,value:a})):o);Pi.assertNever(s)}}Lu.create=(t,e,n)=>new Lu({schema:t,typeName:Rn.ZodEffects,effect:e,...Gn(n)});Lu.createWithPreprocess=(t,e,n)=>new Lu({schema:e,effect:{type:"preprocess",transform:t},typeName:Rn.ZodEffects,...Gn(n)});class rf extends ni{_parse(e){return this._getType(e)===Ut.undefined?ma(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rf.create=(t,e)=>
137new rf({innerType:t,typeName:Rn.ZodOptional,...Gn(e)});class Ig extends ni{_parse(e){return this._getType(e)===Ut.null?ma(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ig.create=(t,e)=>new Ig({innerType:t,typeName:Rn.ZodNullable,...Gn(e)});class E5 extends ni{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===Ut.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}E5.create=(t,e)=>new E5({innerType:t,typeName:Rn.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Gn(e)});class a_ extends ni{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return i_(s)?s.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Tu(i.common.issues)},input:i.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Tu(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}a_.create=(t,e)=>new a_({innerType:t,typeName:Rn.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Gn(e)});class c_ extends ni{_parse(e){if(this._getType(e)!==Ut.nan){const i=this._getOrReturnCtx(e);return jt(i,{code:bt.invalid_type,expected:Ut.nan,received:i.parsedType}),Vn}return{status:"valid",value:e.data}}}c_.create=t=>new c_({typeName:Rn.ZodNaN,...Gn(t)});const j6e=Symbol("zod_brand");class Lte extends ni{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class I6 extends ni{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Vn:r.status==="dirty"?(n.dirty(),Ote(r.value)):this._def.out._parseAsync({data:r.value,path:i.path,parent:i})})();{const s=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Vn:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:i.path,parent:i})}}static create(e,n){return new I6({in:e,out:n,typeName:Rn.ZodPipeline})}}class l_ extends ni{_parse(e){const n=this._def.innerType._parse(e);return f5(n)&&(n.value=Object.freeze(n.value)),n}}l_.create=(t,e)=>new l_({innerType:t,typeName:Rn.ZodReadonly,...Gn(e)});const $te=(t,e={},n)=>t?nb.create().superRefine((i,s)=>{var r,o;if(!t(i)){const a=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,c=(o=(r=a.fatal)!==null&&r!==void 0?r:n)!==null&&o!==void 0?o:!0,l=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...l,fatal:c})}}):nb.create(),V6e={object:Ds.lazycreate};var Rn;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Rn||(Rn={}));const W6e=(t,e={message:`Input not instance of ${t.name}`})=>$te(n=>n instanceof t,e),Ute=Su.create,Bte=Ep.create,q6e=c_.create,z6e=_p.create,Fte=p5.create,H6e=Rg.create,G6e=s_.create,K6e=m5.create,Y6e=g5.create,Z6e=nb.create,Q6e=hg.create,X6e=Cf.create,J6e=r_.create,e4e=ku.create,t4e=Ds.create,n4e=Ds.strictCreate,i4e=y5.create,s4e=sS.create,r4e=b5.create,o4e=Od.create,a4e=w5.create,c4e=o_.create,l4e=Pg.create,u4e=v2.create,d4e=v5.create,h4e=C5.create,f4e=Sp.create,p4e=x5.create,m4e=ib.create,zV=Lu.create,g4e=rf.create,y4e=Ig.create,b4e=Lu.createWithPreprocess,w4e=I6.create,v4e=()=>Ute().optional(),C4e=()=>Bte().optional(),x4e=()=>Fte().optional(),E4e={string:(t=>Su.create({...t,coerce:!0})),number:(t=>Ep.create({...t,coerce:!0})),boolean:(t=>p5.create({...t,coerce:!0})),bigint:(t=>_p.create({...t,coerce:!0})),date:(t=>Rg.create({...t,coerce:!0}))},_4e=Vn;var ae=Object.freeze({__proto__:null,defaultErrorMap:h5,setErrorMap:k6e,getErrorMap:t_,makeIssue:n_,EMPTY_PATH:N6e,addIssueToContext:jt,ParseStatus:zo,INVALID:Vn,DIRTY:Ote,OK:ma,isAborted:cP,isDirty:lP,isValid:f5,isA
137sync:i_,get util(){return Pi},get objectUtil(){return aP},ZodParsedType:Ut,getParsedType:W0,ZodType:ni,ZodString:Su,ZodNumber:Ep,ZodBigInt:_p,ZodBoolean:p5,ZodDate:Rg,ZodSymbol:s_,ZodUndefined:m5,ZodNull:g5,ZodAny:nb,ZodUnknown:hg,ZodNever:Cf,ZodVoid:r_,ZodArray:ku,ZodObject:Ds,ZodUnion:y5,ZodDiscriminatedUnion:sS,ZodIntersection:b5,ZodTuple:Od,ZodRecord:w5,ZodMap:o_,ZodSet:Pg,ZodFunction:v2,ZodLazy:v5,ZodLiteral:C5,ZodEnum:Sp,ZodNativeEnum:x5,ZodPromise:ib,ZodEffects:Lu,ZodTransformer:Lu,ZodOptional:rf,ZodNullable:Ig,ZodDefault:E5,ZodCatch:a_,ZodNaN:c_,BRAND:j6e,ZodBranded:Lte,ZodPipeline:I6,ZodReadonly:l_,custom:$te,Schema:ni,ZodSchema:ni,late:V6e,get ZodFirstPartyTypeKind(){return Rn},coerce:E4e,any:Z6e,array:e4e,bigint:z6e,boolean:Fte,date:H6e,discriminatedUnion:s4e,effect:zV,enum:f4e,function:u4e,instanceof:W6e,intersection:r4e,lazy:d4e,literal:h4e,map:c4e,nan:q6e,nativeEnum:p4e,never:X6e,null:Y6e,nullable:y4e,number:Bte,object:t4e,oboolean:x4e,onumber:C4e,optional:g4e,ostring:v4e,pipeline:w4e,preprocess:b4e,promise:m4e,record:a4e,set:l4e,strictObject:n4e,string:Ute,symbol:G6e,transformer:zV,tuple:o4e,undefined:K6e,union:i4e,unknown:Q6e,void:J6e,NEVER:_4e,ZodIssueCode:bt,quotelessJson:T6e,ZodError:Tu});const js=ae.object({message:ae.string()});function Bt(t){return ae.literal(Wt[t])}const rS=ae.object({serializedMessage:ae.string().optional(),accountAddress:ae.string(),chainId:ae.string(),notBefore:ae.string().optional(),domain:ae.string(),uri:ae.string(),version:ae.string(),nonce:ae.string(),statement:ae.string().optional(),resources:ae.array(ae.string()).optional(),requestId:ae.string().optional(),issuedAt:ae.string().optional(),expirationTime:ae.string().optional()});ae.object({accessList:ae.array(ae.string()),blockHash:ae.string().nullable(),blockNumber:ae.string().nullable(),chainId:ae.string().or(ae.number()),from:ae.string(),gas:ae.string(),hash:ae.string(),input:ae.string().nullable(),maxFeePerGas:ae.string(),maxPriorityFeePerGas:ae.string(),nonce:ae.string(),r:ae.string(),s:ae.string(),to:ae.string(),transactionIndex:ae.string().nullable(),type:ae.string(),v:ae.string(),value:ae.string()});const S4e=ae.object({chainId:ae.string().or(ae.number()),rpcUrl:ae.optional(ae.string())}),A4e=ae.object({email:ae.string().email()}),T4e=ae.object({otp:ae.string()}),k4e=ae.object({uri:ae.string(),preferredAccountType:ae.optional(ae.string()),chainId:ae.optional(ae.string().or(ae.number())),siwxMessage:ae.optional(rS),rpcUrl:ae.optional(ae.string())}),N4e=ae.object({chainId:ae.optional(ae.string().or(ae.number())),preferredAccountType:ae.optional(ae.string()),socialUri:ae.optional(ae.string()),siwxMessage:ae.optional(rS),rpcUrl:ae.optional(ae.string())}),R4e=ae.object({provider:ae.enum(["google","github","apple","facebook","x","discord"])}),P4e=ae.object({email:ae.string().email()}),I4e=ae.object({otp:ae.string()}),D4e=ae.object({otp:ae.string()}),O4e=ae.object({themeMode:ae.optional(ae.enum(["light","dark"])),themeVariables:ae.optional(ae.record(ae.string(),ae.string().or(ae.number()))),w3mThemeVariables:ae.optional(ae.record(ae.string(),ae.string()))}),M4e=ae.object({metadata:ae.object({name:ae.string(),description:ae.string(),url:ae.string(),icons:ae.array(ae.string())}).optional(),sdkVersion:ae.string().optional(),sdkType:ae.string().optional(),projectId:ae.string()}),L4e=ae.object({type:ae.string()}),$4e=ae.object({action:ae.enum(["VERIFY_DEVICE","VERIFY_OTP","CONNECT"])}),U4e=ae.object({url:ae.string()}),B4e=ae.object({userName:ae.string()}),F4e=ae.object({email:ae.string().optional().nullable(),address:ae.string(),chainId:ae.string().or(ae.number()),accounts:ae.array(ae.object({address:ae.string(),type:ae.enum([Wi.ACCOUNT_TYPES.EOA,Wi.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:ae.string().optional().nullable(),preferredAccountType:ae.optional(ae.string()),signature:ae.string().optional(),message:ae.string().optional(),siwxMessage:ae.optional(rS)}),j4e=ae.object({action:ae.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),V4e=ae.object({email:ae.string().email().optional().nullable(),address:ae.string(),chainId:ae.string().or(ae.number()),smartAccountDeployed:ae.optional(ae.boolean()),accounts:ae.array(ae.object({address:ae.string(),type:ae.enum([Wi.ACCOUNT_TYPES.EOA,Wi.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:ae.optional(ae.string()),signature:ae.string().optional(),message:ae.string().optional(),siwxMessage:ae.optional(rS)}),W4e=ae.object({uri:ae.string()}),q4e=ae.object({isConnected:ae.boolean()}),z4e=ae.object({chainId:ae.string().or(ae.number())}),H4e=ae.object({chainId:ae.string().or(ae.number())}),G4e=ae.object({newEmail:ae.string().email()}),K4e=ae.object({smartAccountEnabledNetworks:ae.array(ae.number())});ae.object({address:ae.string(),isDeployed:ae.boolean()});const Y4e=ae.object({version:ae.string().optional()}),Z4e=ae.object({type:ae.string(),address:ae.string()}),Q4e=ae.any(),X4e=ae.object({method:ae.literal("eth_accounts")}),J4e=ae.object({method:ae.literal("eth_blockNumber")}),eCe=ae.object({method:ae.literal("eth_call"),params:ae.array(ae.any())}),tCe=ae.object({method:ae.literal("eth_chainId")}),nCe=ae.object({method:ae.literal("eth_estimateGas"),params:ae.array(ae.any())}),iCe=ae.object({method:ae.literal("eth_feeHistory"),params:ae.array(ae.any())}),sCe=ae.object({method:ae.literal("eth_gasPrice")}),rCe=ae.object({method:ae.literal("eth_getAccount"),params:ae.array(ae.any())}),oCe=ae.object({method:ae.literal("eth_getBalance"),params:ae.array(ae.any())}),aCe=ae.object({method:ae.literal("eth_getBlockByHash"),params:ae.array(ae.any())}),cCe=ae.object({method:ae.literal("eth_getBlockByNumber"),params:ae.array(ae.any())}),lCe=ae.object({method:ae.literal("eth_getBlockReceipts"),params:ae.array(ae.any())}),uCe=ae.object({method:ae.literal("eth_getBlockTransactionCountByHash"),params:ae.array(ae.any())}),dCe=ae.object({method:ae.literal("eth_getBlockTransactionCountByNumber"),params:ae.array(ae.any())}),hCe=ae.object({method:ae.literal("eth_getCode"),params:ae.array(ae.any())}),fCe=ae.object({method:ae.literal("eth_getFilterChanges"),params:ae.array(ae.any())}),pCe=ae.object({method:ae.literal("eth_getFilterLogs"),params:ae.array(ae.any())}),mCe=ae.object({method:ae.literal("eth_getLogs"),params:ae.array(ae.any())}),gCe=ae.object({method:ae.literal("eth_getProof"),params:ae.array(ae.any())}),yCe=ae.object({method:ae.literal("eth_getStorageAt"),params:ae.array(ae.any())}),bCe=ae.object({method:ae.literal("eth_getTransactionByBlockHashAndIndex"),params:ae.array(ae.any())}),wCe=ae.object({method:ae.literal("eth_getTransactionByBlockNumberAndIndex"),params:ae.array(ae.any())}),vCe=ae.object({method:ae.literal("eth_getTransactionByHash"),params:ae.array(ae.any())}),CCe=ae.object({method:ae.literal("eth_getTransactionCount"),params:ae.array(ae.any())}),xCe=ae.object({method:ae.literal("eth_getTransactionReceipt"),params:ae.array(ae.any())}),ECe=ae.object({method:ae.literal("eth_getUncleCountByBlockHash"),params:ae.array(ae.any())}),_Ce=ae.object({method:ae.literal("eth_getUncleCountByBlockNumber"),params:ae.array(ae.any())}
137),SCe=ae.object({method:ae.literal("eth_maxPriorityFeePerGas")}),ACe=ae.object({method:ae.literal("eth_newBlockFilter")}),TCe=ae.object({method:ae.literal("eth_newFilter"),params:ae.array(ae.any())}),kCe=ae.object({method:ae.literal("eth_newPendingTransactionFilter")}),NCe=ae.object({method:ae.literal("eth_sendRawTransaction"),params:ae.array(ae.any())}),RCe=ae.object({method:ae.literal("eth_syncing"),params:ae.array(ae.any())}),PCe=ae.object({method:ae.literal("eth_uninstallFilter"),params:ae.array(ae.any())}),HV=ae.object({method:ae.literal("personal_sign"),params:ae.array(ae.any())}),ICe=ae.object({method:ae.literal("eth_signTypedData_v4"),params:ae.array(ae.any())}),DCe=ae.object({method:ae.literal("eth_sendTransaction"),params:ae.array(ae.any())}),OCe=ae.object({method:ae.literal("solana_signMessage"),params:ae.object({message:ae.string(),pubkey:ae.string()})}),MCe=ae.object({method:ae.literal("solana_signTransaction"),params:ae.object({transaction:ae.string()})}),LCe=ae.object({method:ae.literal("solana_signAllTransactions"),params:ae.object({transactions:ae.array(ae.string())})}),$Ce=ae.object({method:ae.literal("solana_signAndSendTransaction"),params:ae.object({transaction:ae.string(),options:ae.object({skipPreflight:ae.boolean().optional(),preflightCommitment:ae.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:ae.number().optional(),minContextSlot:ae.number().optional()}).optional()})}),UCe=ae.object({method:ae.literal("wallet_sendCalls"),params:ae.array(ae.object({chainId:ae.string().or(ae.number()).optional(),from:ae.string().optional(),version:ae.string().optional(),capabilities:ae.any().optional(),calls:ae.array(ae.object({to:ae.string().startsWith("0x"),data:ae.string().startsWith("0x").optional(),value:ae.string().optional()}))}))}),BCe=ae.object({method:ae.literal("wallet_getCallsStatus"),params:ae.array(ae.string())}),FCe=ae.object({method:ae.literal("wallet_getCapabilities"),params:ae.array(ae.string().or(ae.number()).optional()).optional()}),jCe=ae.object({method:ae.literal("wallet_grantPermissions"),params:ae.array(ae.any())}),VCe=ae.object({method:ae.literal("wallet_revokePermissions"),params:ae.any()}),WCe=ae.object({method:ae.literal("wallet_getAssets"),params:ae.any()}),GV=ae.object({token:ae.string()}),Ft=ae.object({id:ae.string().optional()}),HT={appEvent:Ft.extend({type:Bt("APP_SWITCH_NETWORK"),payload:S4e}).or(Ft.extend({type:Bt("APP_CONNECT_EMAIL"),payload:A4e})).or(Ft.extend({type:Bt("APP_CONNECT_DEVICE")})).or(Ft.extend({type:Bt("APP_CONNECT_OTP"),payload:T4e})).or(Ft.extend({type:Bt("APP_CONNECT_SOCIAL"),payload:k4e})).or(Ft.extend({type:Bt("APP_GET_FARCASTER_URI")})).or(Ft.extend({type:Bt("APP_CONNECT_FARCASTER")})).or(Ft.extend({type:Bt("APP_GET_USER"),payload:ae.optional(N4e)})).or(Ft.extend({type:Bt("APP_GET_SOCIAL_REDIRECT_URI"),payload:R4e})).or(Ft.extend({type:Bt("APP_SIGN_OUT")})).or(Ft.extend({type:Bt("APP_IS_CONNECTED"),payload:ae.optional(GV)})).or(Ft.extend({type:Bt("APP_GET_CHAIN_ID")})).or(Ft.extend({type:Bt("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(Ft.extend({type:Bt("APP_INIT_SMART_ACCOUNT")})).or(Ft.extend({type:Bt("APP_SET_PREFERRED_ACCOUNT"),payload:L4e})).or(Ft.extend({type:Bt("APP_RPC_REQUEST"),payload:HV.or(WCe).or(X4e).or(J4e).or(eCe).or(tCe).or(nCe).or(iCe).or(sCe).or(rCe).or(oCe).or(aCe).or(cCe).or(lCe).or(uCe).or(dCe).or(hCe).or(fCe).or(pCe).or(mCe).or(gCe).or(yCe).or(bCe).or(wCe).or(vCe).or(CCe).or(xCe).or(ECe).or(_Ce).or(SCe).or(ACe).or(TCe).or(kCe).or(NCe).or(RCe).or(PCe).or(HV).or(ICe).or(DCe).or(OCe).or(MCe).or(LCe).or($Ce).or(BCe).or(UCe).or(FCe).or(jCe).or(VCe).and(ae.object({chainId:ae.string().or(ae.number()).optional(),chainNamespace:ae.enum(["eip155","solana","polkadot","bip122","cosmos"]).optional(),rpcUrl:ae.string().optional()}))})).or(Ft.extend({type:Bt("APP_UPDATE_EMAIL"),payload:P4e})).or(Ft.extend({type:Bt("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:I4e})).or(Ft.extend({type:Bt("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:D4e})).or(Ft.extend({type:Bt("APP_SYNC_THEME"),payload:O4e})).or(Ft.extend({type:Bt("APP_SYNC_DAPP_DATA"),payload:M4e})).or(Ft.extend({type:Bt("APP_RELOAD")})).or(Ft.extend({type:Bt("APP_RPC_ABORT")}
137)),frameEvent:Ft.extend({type:Bt("FRAME_SWITCH_NETWORK_ERROR"),payload:js}).or(Ft.extend({type:Bt("FRAME_SWITCH_NETWORK_SUCCESS"),payload:H4e})).or(Ft.extend({type:Bt("FRAME_CONNECT_EMAIL_SUCCESS"),payload:$4e})).or(Ft.extend({type:Bt("FRAME_CONNECT_EMAIL_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:U4e})).or(Ft.extend({type:Bt("FRAME_GET_FARCASTER_URI_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:B4e})).or(Ft.extend({type:Bt("FRAME_CONNECT_FARCASTER_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_CONNECT_OTP_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_CONNECT_OTP_SUCCESS")})).or(Ft.extend({type:Bt("FRAME_CONNECT_DEVICE_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_CONNECT_DEVICE_SUCCESS")})).or(Ft.extend({type:Bt("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:F4e})).or(Ft.extend({type:Bt("FRAME_CONNECT_SOCIAL_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_GET_USER_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_GET_USER_SUCCESS"),payload:V4e})).or(Ft.extend({type:Bt("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:W4e})).or(Ft.extend({type:Bt("FRAME_SIGN_OUT_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_SIGN_OUT_SUCCESS")})).or(Ft.extend({type:Bt("FRAME_IS_CONNECTED_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_IS_CONNECTED_SUCCESS"),payload:q4e})).or(Ft.extend({type:Bt("FRAME_GET_CHAIN_ID_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_GET_CHAIN_ID_SUCCESS"),payload:z4e})).or(Ft.extend({type:Bt("FRAME_RPC_REQUEST_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_RPC_REQUEST_SUCCESS"),payload:Q4e})).or(Ft.extend({type:Bt("FRAME_SESSION_UPDATE"),payload:GV})).or(Ft.extend({type:Bt("FRAME_UPDATE_EMAIL_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_UPDATE_EMAIL_SUCCESS"),payload:j4e})).or(Ft.extend({type:Bt("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(Ft.extend({type:Bt("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:G4e})).or(Ft.extend({type:Bt("FRAME_SYNC_THEME_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_SYNC_THEME_SUCCESS")})).or(Ft.extend({type:Bt("FRAME_SYNC_DAPP_DATA_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(Ft.extend({type:Bt("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:K4e})).or(Ft.extend({type:Bt("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:Z4e})).or(Ft.extend({type:Bt("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_READY"),payload:Y4e})).or(Ft.extend({type:Bt("FRAME_RELOAD_ERROR"),payload:js})).or(Ft.extend({type:Bt("FRAME_RELOAD_SUCCESS")}))};function GT(t,e={}){var n;return typeof(e==null?void 0:e.type)=="string"&&((n=e==null?void 0:e.type)==null?void 0:n.includes(t))}function qCe({projectId:t,chainId:e,enableLogger:n,rpcUrl:i=Ite.BLOCKCHAIN_API_RPC_URL,enableCloudAuthAccount:s=!1}){const r=new URL(_6e);r.searchParams.set("projectId",t),r.searchParams.set("chainId",String(e)),r.searchParams.set("version",A6e),r.searchParams.set("enableLogger",String(n)),r.searchParams.set("rpcUrl",i);const o=Rr.get("dapp_smart_account_version");return o&&(o==="v6"||o==="v7")&&(console.warn(">> AppKit - Forcing smart account version",o),r.searchParams.set("smartAccountVersion",o)),s&&r.searchParams.set("enableCloudAuthAccount","true"),r.toString()}class zCe{constructor({projectId:e,isAppClient:n=!1,chainId:i="eip155:1",enableLogger:s=!0,enableCloudAuthAccount:r=!1,rpcUrl:o=Ite.BLOCKCHAIN_API_RPC_URL}){if(this.iframe=null,this.iframeIsReady=!1,this.initFrame=()=>{const a=document.getElementById("w3m-iframe");this.iframe&&!a&&document.body.appendChild(this.iframe)},this.events={registerFrameEventHandler:(a,c,l)=>{function d({data:h}){var g;if(!GT(Wt.FRAME_EVENT_KEY,h))return;const p=HT.frameEvent.safeParse(h);if(!p.success){console.warn("W3mFrame: invalid frame event",p.error.message);return}((g=p.data)==null?void 0:g.id)===a&&(c(p.data),window.removeEventListener("message",d))}Dc.isClient&&(window.addEventListener("message",d),l.addEventListener("abort",()=>{window.removeEventListener("message",d)}))},onFrameEvent:a=>{Dc.isClient&&window.addEventListener("message",({data:c})=>{if(!GT(Wt.FRAME_EVENT_KEY,c))return;const l=HT.frameEvent.safeParse(c);l.success?a(l.data):console.warn("W3mFrame: invalid frame event",l.error.message)})},onAppEvent:a=>{Dc.isClient&&window.addEventListener("message",({data:c})=>{if(!GT(Wt.APP_EVENT_KEY,c))return;const l=HT.appEvent.safeParse(c);l.success||console.warn("W3mFrame: invalid app event",l.error.message),a(c)})},postAppEvent:a=>{var c;if(Dc.isClient){if(!((c=this.iframe)!=null&&c.contentWindow))throw new Error("W3mFrame: iframe is not set");
137this.iframe.contentWindow.postMessage(a,"*")}},postFrameEvent:a=>{if(Dc.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");parent.postMessage(a,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise((a,c)=>{this.frameLoadPromiseResolver={resolve:a,reject:c}}),this.rpcUrl=o,n&&(this.frameLoadPromise=new Promise((a,c)=>{this.frameLoadPromiseResolver={resolve:a,reject:c}}),Dc.isClient)){const a=document.createElement("iframe");a.id="w3m-iframe",a.src=qCe({projectId:e,chainId:i,enableLogger:s,rpcUrl:this.rpcUrl,enableCloudAuthAccount:r}),a.name="w3m-secure-iframe",a.style.position="fixed",a.style.zIndex="999999",a.style.display="none",a.style.border="none",a.style.animationDelay="0s, 50ms",a.style.borderBottomLeftRadius="clamp(0px, var(--apkt-borderRadius-8), 44px)",a.style.borderBottomRightRadius="clamp(0px, var(--apkt-borderRadius-8), 44px)",this.iframe=a,this.iframe.onerror=()=>{var c;(c=this.frameLoadPromiseResolver)==null||c.reject("Unable to load email login dependency")},this.events.onFrameEvent(c=>{var l;c.type==="@w3m-frame/READY"&&(this.iframeIsReady=!0,(l=this.frameLoadPromiseResolver)==null||l.resolve(void 0))})}}get networks(){const e=["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map(n=>({[n]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${n}&projectId=${this.projectId}`,chainId:n}}));return Object.assign({},...e)}}var _v={exports:{}},KT,KV;function HCe(){if(KV)return KT;KV=1;function t(n){try{return JSON.stringify(n)}catch{return'"[Circular]"'}}KT=e;function e(n,i,s){var r=s&&s.stringify||t,o=1;if(typeof n=="object"&&n!==null){var a=i.length+o;if(a===1)return n;var c=new Array(a);c[0]=r(n);for(var l=1;l<a;l++)c[l]=r(i[l]);return c.join(" ")}if(typeof n!="string")return n;var d=i.length;if(d===0)return n;for(var h="",p=1-o,g=-1,b=n&&n.length||0,w=0;w<b;){if(n.charCodeAt(w)===37&&w+1<b){switch(g=g>-1?g:0,n.charCodeAt(w+1)){case 100:case 102:if(p>=d||i[p]==null)break;g<w&&(h+=n.slice(g,w)),h+=Number(i[p]),g=w+2,w++;break;case 105:if(p>=d||i[p]==null)break;g<w&&(h+=n.slice(g,w)),h+=Math.floor(Number(i[p])),g=w+2,w++;break;case 79:case 111:case 106:if(p>=d||i[p]===void 0)break;g<w&&(h+=n.slice(g,w));var C=typeof i[p];if(C==="string"){h+="'"+i[p]+"'",g=w+2,w++;break}if(C==="function"){h+=i[p].name||"<anonymous>",g=w+2,w++;break}h+=r(i[p]),g=w+2,w++;break;case 115:if(p>=d)break;g<w&&(h+=n.slice(g,w)),h+=String(i[p]),g=w+2,w++;break;case 37:g<w&&(h+=n.slice(g,w)),h+="%",g=w+2,w++,p--;break}++p}++w}return g===-1?n:(g<b&&(h+=n.slice(g)),h)}return KT}var YV;function GCe(){if(YV)return _v.exports;YV=1;const t=HCe();_v.exports=d;const e=S().console||{},n={mapHttpRequest:B,mapHttpResponse:B,wrapRequestSerializer:F,wrapResponseSerializer:F,wrapErrorSerializer:F,req:B,res:B,err:R,errWithCause:R};function i(v,_){return v==="silent"?1/0:_.levels.values[v]}const s=Symbol("pino.logFuncs"),r=Symbol("pino.hierarchy"),o={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function a(v,_){const N={logger:_,parent:v[r]};_[r]=N}function c(v,_,N){const $={};_.forEach(U=>{$[U]=N[U]?N[U]:e[U]||e[o[U]||"log"]||z}),v[s]=$}function l(v,_){return Array.isArray(v)?v.filter(function($){return $!=="!stdSerializers.err"}):v===!0?Object.keys(_):!1}function d(v){v=v||{},v.browser=v.browser||{};const _=v.browser.transmit;if(_&&typeof _.send!="function")throw Error("pino: transmit option must have a send function");const N=v.browser.write||e;v.browser.write&&(v.browser.asObject=!0);const $=v.serializers||{},U=l(v.browser.serialize,$);let j=v.browser.serialize;Array.isArray(v.browser.serialize)&&v.browser.serialize.indexOf("!stdSerializers.err")>-1&&(j=!1);const D=Object.keys(v.customLevels||{}),O=["error","fatal","warn","info","debug","trace"].concat(D);typeof N=="function"&&O.forEach(function(ie){N[ie]=N}),(v.enabled===!1||v.browser.disabled)&&(v.level="silent");const H=v.level||"info",J=Object.create(N);J.log||(J.log=z),c(J,O,N),a({},J),Object.defineProperty(J,"levelVal",{get:Z}),Object.defineProperty(J,"level",{get:Y,set:Q});const W={transmit:_,serialize:U,asObject:v.browser.asObject,asObjectBindingsOnly:v.browser.asObjectBindingsOnly,formatters:v.browser.formatters,levels:O,timestamp:P(v),messageKey:v.messageKey||"msg",onChild:v.onChild||z};J.levels=h(v),J.level=H,J.isLevelEnabled=function(ie){return this.levels.values[ie]?this.levels.values[ie]>=this.levels.values[this.level]:!1},J.setMaxListeners=J.getMaxListeners=J.emit=J.addListener=J.on=J.prependListener=J.once=J.prependOnceListener=J.removeListener=J.removeAllListeners=J.listeners=J.listenerCount=J.eventNames=J.write=J.flush=z,J.serializers=$,J._seri
vendor: 4,110 bytes, line 137
137alize=U,J._stdErrSerialize=j,J.child=function(...ie){return ee.call(this,W,...ie)},_&&(J._logEvent=k());function Z(){return i(this.level,this)}function Y(){return this._level}function Q(ie){if(ie!=="silent"&&!this.levels.values[ie])throw Error("unknown level "+ie);this._level=ie,b(this,W,J,"error"),b(this,W,J,"fatal"),b(this,W,J,"warn"),b(this,W,J,"info"),b(this,W,J,"debug"),b(this,W,J,"trace"),D.forEach(re=>{b(this,W,J,re)})}function ee(ie,re,oe){if(!re)throw new Error("missing bindings for child Pino");oe=oe||{},U&&re.serializers&&(oe.serializers=re.serializers);const de=oe.serializers;if(U&&de){var he=Object.assign({},$,de),ue=v.browser.serialize===!0?Object.keys(he):U;delete re.serializers,T([re],ue,he,this._stdErrSerialize)}function be(Ne){this._childLevel=(Ne._childLevel|0)+1,this.bindings=re,he&&(this.serializers=he,this._serialize=ue),_&&(this._logEvent=k([].concat(Ne._logEvent.bindings,re)))}be.prototype=this;const _e=new be(this);return a(this,_e),_e.child=function(...Ne){return ee.call(this,ie,...Ne)},_e.level=oe.level||this.level,ie.onChild(_e),_e}return J}function h(v){const _=v.customLevels||{},N=Object.assign({},d.levels.values,_),$=Object.assign({},d.levels.labels,p(_));return{values:N,labels:$}}function p(v){const _={};return Object.keys(v).forEach(function(N){_[v[N]]=N}),_}d.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},d.stdSerializers=n,d.stdTimeFunctions=Object.assign({},{nullTime:K,epochTime:q,unixTime:G,isoTime:I});function g(v){const _=[];v.bindings&&_.push(v.bindings);let N=v[r];for(;N.parent;)N=N.parent,N.logger.bindings&&_.push(N.logger.bindings);return _.reverse()}function b(v,_,N,$){if(Object.defineProperty(v,$,{value:i(v.level,N)>i($,N)?z:N[s][$],writable:!0,enumerable:!0,configurable:!0}),v[$]===z){if(!_.transmit)return;const j=_.transmit.level||v.level,D=i(j,N);if(i($,N)<D)return}v[$]=C(v,_,N,$);const U=g(v);U.length!==0&&(v[$]=w(U,v[$]))}function w(v,_){return function(){return _.apply(this,[...v,...arguments])}}function C(v,_,N,$){return(function(U){return function(){const D=_.timestamp(),O=new Array(arguments.length),H=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var J=0;J<O.length;J++)O[J]=arguments[J];var W=!1;if(_.serialize&&(T(O,this._serialize,this.serializers,this._stdErrSerialize),W=!0),_.asObject||_.formatters?U.call(H,...E(this,$,O,D,_)):U.apply(H,O),_.transmit){const Z=_.transmit.level||v._level,Y=i(Z,N),Q=i($,N);if(Q<Y)return;A(this,{ts:D,methodLevel:$,methodValue:Q,transmitValue:N.levels.values[_.transmit.level||v._level],send:_.transmit.send,val:i(v._level,N)},O,W)}}})(v[s][$])}function E(v,_,N,$,U){const{level:j,log:D=Z=>Z}=U.formatters||{},O=N.slice();let H=O[0];const J={};let W=(v._childLevel|0)+1;if(W<1&&(W=1),$&&(J.time=$),j){const Z=j(_,v.levels.values[_]);Object.assign(J,Z)}else J.level=v.levels.values[_];if(U.asObjectBindingsOnly){if(H!==null&&typeof H=="object")for(;W--&&typeof O[0]=="object";)Object.assign(J,O.shift());return[D(J),...O]}else{if(H!==null&&typeof H=="object"){for(;W--&&typeof O[0]=="object";)Object.assign(J,O.shift());H=O.length?t(O.shift(),O):void 0}else typeof H=="string"&&(H=t(O.shift(),O));return H!==void 0&&(J[U.messageKey]=H),[D(J)]}}function T(v,_,N,$){for(const U in v)if($&&v[U]instanceof Error)v[U]=d.stdSerializers.err(v[U]);else if(typeof v[U]=="object"&&!Array.isArray(v[U])&&_)for(const j in v[U])_.indexOf(j)>-1&&j in N&&(v[U][j]=N[j](v[U][j]))}function A(v,_,N,$=!1){const U=_.send,j=_.ts,D=_.methodLevel,O=_.methodValue,H=_.val,J=v._logEvent.bindings;$||T(N,v._serialize||Object.keys(v.serializers),v.serializers,v._stdErrSerialize===void 0?!0:v._stdErrSerialize),v._logEvent.ts=j,v._logEvent.messages=N.filter(function(W){return J.indexOf(W)===-1}),v._logEvent.level.label=D,v._logEvent.level.value=O,U(D,v._logEvent,H),v._logEvent=k(J)}function k(v){return{ts:0,messages:[],bindings:v||[],level:{label:"",value:0}}}function R(v){const _={type:v.constructor.name,msg:v.message,stack:v.stack};for(const N in v)_[N]===void 0&&(_[N]=v[N]);return _}
137function P(v){return typeof v.timestamp=="function"?v.timestamp:v.timestamp===!1?K:q}function B(){return{}}function F(v){return v}function z(){}function K(){return!1}function q(){return Date.now()}function G(){return Math.round(Date.now()/1e3)}function I(){return new Date(Date.now()).toISOString()}function S(){function v(_){return typeof _<"u"&&_}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return v(self)||v(window)||v(this)||{}}}return _v.exports.default=d,_v.exports.pino=d,_v.exports}var Wy=GCe();const jte=ya(Wy),KCe=t=>JSON.stringify(t,(e,n)=>typeof n=="bigint"?n.toString()+"n":n),YCe=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(e,'$1"$2n"$3');return JSON.parse(n,(i,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function Dg(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return YCe(t)}catch{return t}}function xf(t){return typeof t=="string"?t:KCe(t)||""}const ZCe={level:"info"},oS="custom_context",zO=1e3*1024;var QCe=Object.defineProperty,XCe=(t,e,n)=>e in t?QCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,q0=(t,e,n)=>XCe(t,typeof e!="symbol"?e+"":e,n);let JCe=class{constructor(e){q0(this,"nodeValue"),q0(this,"sizeInBytes"),q0(this,"next"),this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},ZV=class{constructor(e){q0(this,"lengthInNodes"),q0(this,"sizeInBytes"),q0(this,"head"),q0(this,"tail"),q0(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const n=new JCe(e);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let n=this.head;for(;n!==null;)e.push(n.value),n=n.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const n=e.value;return e=e.next,{done:!1,value:n}}}}};var exe=Object.defineProperty,txe=(t,e,n)=>e in t?exe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,nx=(t,e,n)=>txe(t,typeof e!="symbol"?e+"":e,n);let Vte=class{constructor(e,n=zO){nx(this,"logs"),nx(this,"level"),nx(this,"levelValue"),nx(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=e??"error",this.levelValue=Wy.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new ZV(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,n){n===Wy.levels.values.error?console.error(e):n===Wy.levels.values.warn?console.warn(e):n===Wy.levels.values.debug?console.debug(e):n===Wy.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(xf({timestamp:new Date().toISOString(),log:e}));const n=typeof e=="string"?JSON.parse(e).level:e.level;n>=this.levelValue&&this.forwardToConsole(e,n)}getLogs(){return this.logs}clearLogs(){this.logs=new ZV(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const n=this.getLogArray();return n.push(xf({extraMetadata:e})),new Blob(n,{type:"application/json"})}};var nxe=Object.defineProperty,ixe=(t,e,n)=>e in t?nxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sxe=(t,e,n)=>ixe(t,e+"",n);let rxe=class{constructor(e,n=zO){sxe(this,"baseChunkLogger"),this.baseChunkLogger=new Vte(e,n)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const n=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=n,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n)}};var oxe=Object.defineProperty,axe=(t,e,n)=>e in t?oxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,cxe=(t,e,n)=>axe(t,e+"",n);let lxe=class{constructor(e,n=zO){cxe(this,"baseChunkLogger"),this.baseChunkLogger=new Vte(e,n)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var uxe=Object.defineProperty,dxe=Object.defineProperties,hxe=Object.getOwnPropertyDescriptors,QV=Object.getOwnPropertySymbols,fxe=Object.prototype.hasOwnProperty,pxe=Object.prototype.propertyIsEnumerable,XV=(t,e,n)=>e in t?uxe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u_=(t,e)=>{for(var n in e||(e={}))fxe.call(e,n)&&XV(t,n,e[n]);if(QV)for(var n of QV(e))pxe.call(e,n)&&XV(t,n,e[n]);return t},d_=(t,e)=>dxe(t,hxe(e));function HO(t){return d_(u_({},t),{level:(t==null?void 0:t.level)||ZCe.level})}function mxe(t,e,n=oS){return t[n]=e,t}function oc(t,e=oS){return t[e]||""}function gxe(t,e,n=oS){const i=oc(t,n);return i.trim()?`${i}/${e}`:e}function ac(t,e,n=oS){const i=gxe(t,e,n),s=t.child({context:i});return mxe(s,i,n)}function yxe(t){var e,n;const i=new rxe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:jte(d_(u_({},t.opts),{level:"trace",browser:d_(u_({},(n=t.opts)==null?void 0:n.browser),{write:s=>i.write(s)})})),chunkLoggerController:i}}function bxe(t){var e;const n=new lxe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:jte(d_(u_({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function aS(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?yxe(t):bxe(t)}class wxe{constructor(e){var r;const n=HO({level:S6e}),{logger:i,chunkLoggerController:s}=aS({opts:n}
137);this.logger=ac(i,this.constructor.name),this.chunkLoggerController=s,typeof window<"u"&&((r=this.chunkLoggerController)!=null&&r.downloadLogsBlobInBrowser)&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{var o;(o=this.chunkLoggerController)!=null&&o.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}class Wte{constructor({projectId:e,chainId:n,enableLogger:i=!0,onTimeout:s,abortController:r,getActiveCaipNetwork:o,getCaipNetworks:a,enableCloudAuthAccount:c,metadata:l,sdkVersion:d,sdkType:h}){this.openRpcRequests=new Map,this.isInitialized=!1,i&&(this.w3mLogger=new wxe(e)),this.abortController=r,this.getActiveCaipNetwork=o,this.getCaipNetworks=a;const p=this.getRpcUrl(n);this.projectId=e,this.sdkVersion=d,this.sdkType=h,this.metadata=l,this.w3mFrame=new zCe({projectId:e,isAppClient:!0,chainId:n,enableLogger:i,rpcUrl:p,enableCloudAuthAccount:c}),this.onTimeout=s,this.getLoginEmailUsed()&&this.createFrame()}async createFrame(){this.w3mFrame.initFrame(),this.initPromise=new Promise(e=>{this.w3mFrame.events.onFrameEvent(n=>{n.type===Wt.FRAME_READY&&setTimeout(()=>{e()},500)})}),await this.initPromise,await this.syncDappData({metadata:this.metadata,projectId:this.projectId,sdkVersion:this.sdkVersion,sdkType:this.sdkType}
137),await this.getSmartAccountEnabledNetworks(),this.isInitialized=!0,this.initPromise=void 0}async init(){if(!this.isInitialized){if(this.initPromise){await this.initPromise;return}await this.createFrame()}}getLoginEmailUsed(){return!!Rr.get(Wt.EMAIL_LOGIN_USED_KEY)}getEmail(){return Rr.get(Wt.EMAIL)}getUsername(){return Rr.get(Wt.SOCIAL_USERNAME)}async reload(){var e;try{await this.appEvent({type:Wt.APP_RELOAD})}catch(n){throw(e=this.w3mLogger)==null||e.logger.error({error:n},"Error reloading iframe"),n}}async connectEmail(e){var n;try{Dc.checkIfAllowedToTriggerEmail(),await this.init();const i=await this.appEvent({type:Wt.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),i}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error connecting email"),i}}async connectDevice(){var e;try{return this.appEvent({type:Wt.APP_CONNECT_DEVICE})}catch(n){throw(e=this.w3mLogger)==null||e.logger.error({error:n},"Error connecting device"),n}}async connectOtp(e){var n;try{return this.appEvent({type:Wt.APP_CONNECT_OTP,payload:e})}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error connecting otp"),i}}async isConnected(){var e;try{if(!this.getLoginEmailUsed())return{isConnected:!1};const n=await this.appEvent({type:Wt.APP_IS_CONNECTED});return n!=null&&n.isConnected||this.deleteAuthLoginCache(),n}catch(n){throw this.deleteAuthLoginCache(),(e=this.w3mLogger)==null||e.logger.error({error:n},"Error checking connection"),n}}async getChainId(){var e;try{const n=await this.appEvent({type:Wt.APP_GET_CHAIN_ID});return this.setLastUsedChainId(n.chainId),n}catch(n){throw(e=this.w3mLogger)==null||e.logger.error({error:n},"Error getting chain id"),n}}async getSocialRedirectUri(e){var n;try{return await this.init(),this.appEvent({type:Wt.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error getting social redirect uri"),i}}async updateEmail(e){var n;try{const i=await this.appEvent({type:Wt.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),i}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error updating email"),i}}async updateEmailPrimaryOtp(e){var n;try{return this.appEvent({type:Wt.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error updating email primary otp"),i}}async updateEmailSecondaryOtp(e){var n;try{const i=await this.appEvent({type:Wt.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(i.newEmail),i}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error updating email secondary otp"),i}}async syncTheme(e){var n;try{return this.appEvent({type:Wt.APP_SYNC_THEME,payload:e})}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error syncing theme"),i}}async syncDappData(e){var n;try{return this.appEvent({type:Wt.APP_SYNC_DAPP_DATA,payload:e})}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error syncing dapp data"),i}}async getSmartAccountEnabledNetworks(){var e;try{const n=await this.appEvent({type:Wt.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(n.smartAccountEnabledNetworks),n}catch(n){throw this.persistSmartAccountEnabledNetworks([]),(e=this.w3mLogger)==null||e.logger.error({error:n},"Error getting smart account enabled networks"),n}}async setPreferredAccount(e){var n;try{return this.appEvent({type:Wt.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error setting preferred account"),i}}async connect(e){var n,i;if(e!=null&&e.socialUri)try{await this.init();const s=this.getRpcUrl(e.chainId),r=await this.appEvent({type:Wt.APP_CONNECT_SOCIAL,payload:{uri:e.socialUri,preferredAccountType:e.preferredAccountType,chainId:e.chainId,siwxMessage:e.siwxMessage,rpcUrl:s}});return r.userName&&this.setSocialLoginSuccess(r.userName),this.setLoginSuccess(r.email),this.setLastUsedChainId(r.chainId),this.user=r,r}catch(s){throw(n=this.w3mLogger)==null||n.logger.error({error:s},"Error connecting social"),s}
137else try{const s=(e==null?void 0:e.chainId)||this.getLastUsedChainId()||1,r=await this.getUser({chainId:s,preferredAccountType:e==null?void 0:e.preferredAccountType,siwxMessage:e==null?void 0:e.siwxMessage,rpcUrl:this.getRpcUrl(s)});return this.setLoginSuccess(r.email),this.setLastUsedChainId(r.chainId),this.user=r,r}catch(s){throw(i=this.w3mLogger)==null||i.logger.error({error:s},"Error connecting"),s}}async getUser(e){var n;try{await this.init();const i=(e==null?void 0:e.chainId)||this.getLastUsedChainId()||1,s=await this.appEvent({type:Wt.APP_GET_USER,payload:{...e,chainId:i,rpcUrl:this.getRpcUrl(i)}});return this.user=s,s}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error connecting"),i}}async connectSocial({uri:e,chainId:n,preferredAccountType:i}){var s;try{await this.init();const r=this.getRpcUrl(n),o=await this.appEvent({type:Wt.APP_CONNECT_SOCIAL,payload:{uri:e,chainId:n,rpcUrl:r,preferredAccountType:i}});return o.userName&&this.setSocialLoginSuccess(o.userName),o}catch(r){throw(s=this.w3mLogger)==null||s.logger.error({error:r},"Error connecting social"),r}}async getFarcasterUri(){var e;try{return await this.init(),await this.appEvent({type:Wt.APP_GET_FARCASTER_URI})}catch(n){throw(e=this.w3mLogger)==null||e.logger.error({error:n},"Error getting farcaster uri"),n}}async connectFarcaster(){var e;try{const n=await this.appEvent({type:Wt.APP_CONNECT_FARCASTER});return n.userName&&this.setSocialLoginSuccess(n.userName),n}catch(n){throw(e=this.w3mLogger)==null||e.logger.error({error:n},"Error connecting farcaster"),n}}async switchNetwork({chainId:e}){var n;try{const i=this.getRpcUrl(e),s=await this.appEvent({type:Wt.APP_SWITCH_NETWORK,payload:{chainId:e,rpcUrl:i}});return this.setLastUsedChainId(s.chainId),s}catch(i){throw(n=this.w3mLogger)==null||n.logger.error({error:i},"Error switching network"),i}}async disconnect(){var e;try{return this.deleteAuthLoginCache(),await new Promise(async i=>{const s=setTimeout(()=>{i()},3e3);await this.appEvent({type:Wt.APP_SIGN_OUT}),clearTimeout(s),i()})}catch(n){throw(e=this.w3mLogger)==null||e.logger.error({error:n},"Error disconnecting"),n}}async request(e){var i,s,r,o,a;const n=e;try{if(Wi.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();const c=e.chainNamespace||"eip155",l=(i=this.getActiveCaipNetwork(c))==null?void 0:i.id;n.chainNamespace=c,n.chainId=l,n.rpcUrl=this.getRpcUrl(l),(s=this.rpcRequestHandler)==null||s.call(this,e);const d=await this.appEvent({type:Wt.APP_RPC_REQUEST,payload:n});return(r=this.rpcSuccessHandler)==null||r.call(this,d,n),d}catch(c){throw(o=this.rpcErrorHandler)==null||o.call(this,c,n),(a=this.w3mLogger)==null||a.logger.error({error:c},"Error requesting"),c}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent(n=>{n.type===Wt.FRAME_IS_CONNECTED_SUCCESS&&n.payload.isConnected&&e()})}onNotConnected(e){this.w3mFrame.events.onFrameEvent(n=>{n.type===Wt.FRAME_IS_CONNECTED_ERROR&&e(),n.type===Wt.FRAME_IS_CONNECTED_SUCCESS&&!n.payload.isConnected&&e()})}onConnect(e){this.w3mFrame.events.onFrameEvent(n=>{n.type===Wt.FRAME_GET_USER_SUCCESS&&e(n.payload)})}onSocialConnected(e){this.w3mFrame.events.onFrameEvent(n=>{n.type===Wt.FRAME_CONNECT_SOCIAL_SUCCESS&&e(n.payload)})}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent(n=>{n.type===Wt.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(n.payload):n.type===Wt.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:Wi.ACCOUNT_TYPES.EOA})})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}async rejectRpcRequests(){var e;try{await Promise.all(Array.from(this.openRpcRequests.values()).map(async({abortController:n,method:i})=>{Wi.SAFE_RPC_METHODS.includes(i)||n.abort(),await this.appEvent({type:Wt.APP_RPC_ABORT})})),this.openRpcRequests.clear()}catch(n){(e=this.w3mLogger)==null||e.logger.error({error:n},"Error aborting RPC request")}}async appEvent(e){let n,i;function s(c){return c.replace("@w3m-app/","")}const r=[Wt.APP_SYNC_DAPP_DATA,Wt.APP_SYNC_THEME,Wt.APP_SET_PREFERRED_ACCOUNT],o=s(e.type);return!this.w3mFrame.iframeIsReady&&!r.includes(e.type)&&(i=setTimeout(()=>{var c;(c=this.onTimeout)==null||c.call(this,"iframe_load_failed"),this.abortController.abort()},2e4)),await this.w3mFrame.frameLoadPromise,clearTimeout(i),[Wt.APP_CONNECT_EMAIL,Wt.APP_CONNECT_DEVICE,Wt.APP_CONNECT_OTP,Wt.APP_CONNECT_SOCIAL,Wt.APP_GET_SOCIAL_REDIRECT_URI].map(s).includes(o)&&(n=setTimeout(()=>{var c;(c=this.onTimeout)==null||c.call(this,"iframe_request_timeout"),this.abortController.abort()},12e4)),new Promise((c,l)=>{var g,b,w;const d=Math.random().toString(36).substring(7);(w=(g=this.w3mLogger)==null?void 0:(b=g.logger).info)==null||w.call(b,{event:e,id:d},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:d});const h=new AbortController;if(o==="RPC_REQUEST"){const C=e;this.openRpcRequests.set(d,{...C.payload,abortController:h})}h.signal.addEventListener("abort",()=>{o==="RPC_REQUEST"?l(new Error("Request was aborted")):o!=="GET_FARCASTER_URI"&&l(new Error("Something went wrong"))});const p=(C,E)=>{var T,A,k;C.id===d&&((A=E==null?void 0:(T=E.logger).info)==null||A.call(T,{framEvent:C,id:d},"Received frame response"),this.openRpcRequests.delete(C.id),C.type===`@w3m-frame/${o}_SUCCESS`?(n&&clearTimeout(n),i&&clearTimeout(i),"payload"in C&&c(C.payload),c(void 0)):C.type===`@w3m-frame/${o}_ERROR`&&(n&&clearTimeout(n),i&&clearTimeout(i),"payload"in C&&l(new Error(((k=C.payload)==null?void 0:k.message)||"An error occurred")),l(new Error("An error occurred"))))};this.w3mFrame.events.registerFrameEventHandler(d,C=>p(C,this.w3mLogger),this.abortController.signal)}
137)}setNewLastEmailLoginTime(){Rr.set(Wt.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){Rr.set(Wt.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&Rr.set(Wt.EMAIL,e),Rr.set(Wt.EMAIL_LOGIN_USED_KEY,"true"),Rr.delete(Wt.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){Rr.delete(Wt.EMAIL_LOGIN_USED_KEY),Rr.delete(Wt.EMAIL),Rr.delete(Wt.LAST_USED_CHAIN_KEY),Rr.delete(Wt.SOCIAL_USERNAME)}setLastUsedChainId(e){e&&Rr.set(Wt.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){const e=Rr.get(Wt.LAST_USED_CHAIN_KEY)??void 0,n=Number(e);return isNaN(n)?e:n}persistSmartAccountEnabledNetworks(e){Rr.set(Wt.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}getRpcUrl(e){var r,o;let n=e===void 0?void 0:"eip155";typeof e=="string"&&(e.includes(":")?n=(r=x6e.parseCaipNetworkId(e))==null?void 0:r.chainNamespace:Number.isInteger(Number(e))?n="eip155":n="solana");const i=this.getCaipNetworks(n),s=e?i.find(a=>String(a.id)===String(e)||a.caipNetworkId===e):i[0];return(o=s==null?void 0:s.rpcUrls.default.http)==null?void 0:o[0]}}async function Sv(...t){const e=await fetch(...t);if(!e.ok)throw new Error(`HTTP status code: ${e.status}`,{cause:e});return e}class D6{constructor({baseUrl:e,clientId:n}){this.baseUrl=e,this.clientId=n}async get({headers:e,signal:n,cache:i,...s}){const r=this.createUrl(s);return(await Sv(r,{method:"GET",headers:e,signal:n,cache:i})).json()}async getBlob({headers:e,signal:n,...i}){const s=this.createUrl(i);return(await Sv(s,{method:"GET",headers:e,signal:n})).blob()}async post({body:e,headers:n,signal:i,...s}){const r=this.createUrl(s);return(await Sv(r,{method:"POST",headers:n,body:e?JSON.stringify(e):void 0,signal:i})).json()}async put({body:e,headers:n,signal:i,...s}){const r=this.createUrl(s);return(await Sv(r,{method:"PUT",headers:n,body:e?JSON.stringify(e):void 0,signal:i})).json()}async delete({body:e,headers:n,signal:i,...s}){const r=this.createUrl(s);return(await Sv(r,{method:"DELETE",headers:n,body:e?JSON.stringify(e):void 0,signal:i})).json()}createUrl({path:e,params:n}){const i=new URL(e,this.baseUrl);return n&&Object.entries(n).forEach(([s,r])=>{r&&i.searchParams.append(s,r)}),this.clientId&&i.searchParams.append("clientId",this.clientId),i}sendBeacon({body:e,...n}){const i=this.createUrl(n);return navigator.sendBeacon(i.toString(),e?JSON.stringify(e):void 0)}}const dP={getFeatureValue(t,e){const n=e==null?void 0:e[t];return n===void 0?fn.DEFAULT_FEATURES[t]:n},filterSocialsByPlatform(t){if(!t||!t.length)return t;let e=t;return Ue.isTelegram()&&(Ue.isIos()&&(e=e.filter(n=>n!=="google")),Ue.isMac()&&(e=e.filter(n=>n!=="x")),Ue.isAndroid()&&(e=e.filter(n=>!["facebook","x"].includes(n)))),Ue.isMobile()&&(e=e.filter(n=>n!=="facebook")),e},isSocialsEnabled(){var t,e,n,i;return Array.isArray((t=ye.state.features)==null?void 0:t.socials)&&((e=ye.state.features)==null?void 0:e.socials.length)>0||Array.isArray((n=ye.state.remoteFeatures)==null?void 0:n.socials)&&((i=ye.state.remoteFeatures)==null?void 0:i.socials.length)>0},isEmailEnabled(){var t,e;return!!((t=ye.state.features)!=null&&t.email||(e=ye.state.remoteFeatures)!=null&&e.email)}},en=Hi({features:fn.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:fn.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{},enableMobileFullScreen:!1,coinbasePreference:"all"}),ye={state:en,subscribeKey(t,e){return ar(en,t,e)},setOptions(t){Object.assign(en,t)},setRemoteFeatures(t){var n,i;if(!t)return;const e={...en.remoteFeatures,...t};en.remoteFeatures=e,(n=en.remoteFeatures)!=null&&n.socials&&(en.remoteFeatures.socials=dP.filterSocialsByPlatform(en.remoteFeatures.socials)),(i=en.features)!=null&&i.pay&&(en.remoteFeatures.email=!1,en.remoteFeatures.socials=!1)},setFeatures(t){var n;if(!t)return;en.features||(en.features=fn.DEFAULT_FEATURES);const e={...en.features,...t};en.features=e,(n=en.features)!=null&&n.pay&&en.remoteFeatures&&(en.remoteFeatures.email=!1,en.remoteFeatures.socials=!1)},setProjectId(t){en.projectId=t},setCustomRpcUrls(t){en.customRpcUrls=t},setAllWallets(t){en.allWallets=t},setIncludeWalletIds(t){en.includeWalletIds=t},setExcludeWalletIds(t){en.excludeWalletIds=t},setFeaturedWalletIds(t){en.featuredWalletIds=t},setTokens(t){en.tokens=t},setTermsConditionsUrl(t){en.termsConditionsUrl=t},setPrivacyPolicyUrl(t){en.privacyPolicyUrl=t},setCustomWallets(t){en.customWallets=t},setIsSiweEnabled(t){en.isSiweEnabled=t},setIsUniversalProvider(t){en.isUniversalProvider=t},setSdkVersion(t){en.sdkVersion=t},setMetadata(t){en.metadata=t},setDisableAppend(t){en.disableAppend=t},setEIP6963Enabled(t){en.enableEIP6963=t},setDebug(t){en.debug=t},setEnableWalletGuide(t){en.enableWalletGuide=t},setEnableAuthLogger(t){en.enableAuthLogger=t},setEnableWallets(t){en.enableWallets=t},setPreferUniversalLinks(t){en.experimental_preferUniversalLinks=t},setSIWX(t){if(t)for(const[e,n]of Object.entries(fn.SIWX_DEFAULTS))t[e]??(t[e]=n);en.siwx=t},setConnectMethodsOrder(t){en.features={...en.features,connectMethodsOrder:t}},setWalletFeaturesOrder(t){en.features={...en.features,walletFeaturesOrder:t}},setSocialsOrder(t){en.remoteFeatures={...en.remoteFeatures,socials:t}},setCollapseWallets(t){en.features={...en.features,collapseWallets:t}},setEnableEmbedded(t){en.enableEmbedded=t},setAllowUnsupportedChain(t){en.allowUnsupportedChain=t},setManualWCControl(t){en.manualWCControl=t},setEnableNetworkSwitch(t){en.enableNetworkSwitch=t},setEnableMobileFullScreen(t){en.enableMobileFullScreen=Ue.isMobile()&&t},setEnableReconnect(t){en.enableReconnect=t}
137,setCoinbasePreference(t){en.coinbasePreference=t},setDefaultAccountTypes(t={}){Object.entries(t).forEach(([e,n])=>{n&&(en.defaultAccountTypes[e]=n)})},setUniversalProviderConfigOverride(t){en.universalProviderConfigOverride=t},getUniversalProviderConfigOverride(){return en.universalProviderConfigOverride},getSnapshot(){return kg(en)}},km=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),Tr=Hi({...km}),vxe={state:Tr,subscribeKey(t,e){return ar(Tr,t,e)},showLoading(t,e={}){this._showMessage({message:t,variant:"loading",...e})},showSuccess(t){this._showMessage({message:t,variant:"success"})},showSvg(t,e){this._showMessage({message:t,svg:e})},showError(t){const e=Ue.parseError(t);this._showMessage({message:e,variant:"error"})},hide(){Tr.message=km.message,Tr.variant=km.variant,Tr.svg=km.svg,Tr.open=km.open,Tr.autoClose=km.autoClose},_showMessage({message:t,svg:e,variant:n="success",autoClose:i=km.autoClose}){Tr.open?(Tr.open=!1,setTimeout(()=>{Tr.message=t,Tr.variant=n,Tr.svg=e,Tr.open=!0,Tr.autoClose=i},150)):(Tr.message=t,Tr.variant=n,Tr.svg=e,Tr.open=!0,Tr.autoClose=i)}},ti=vxe,Cxe={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},qte=Ue.getBlockchainApiUrl(),ea=Hi({clientId:null,api:new D6({baseUrl:qte,clientId:null}),supportedChains:{http:[],ws:[]}}),xn={state:ea,async get(t){const{st:e,sv:n}=xn.getSdkProperties(),i=ye.state.projectId,s={...t.params||{},st:e,sv:n,projectId:i};return ea.api.get({...t,params:s})},getSdkProperties(){const{sdkType:t,sdkVersion:e}=ye.state;return{st:t||"unknown",sv:e||"unknown"}},async isNetworkSupported(t){if(!t)return!1;try{ea.supportedChains.http.length||await xn.getSupportedNetworks()}catch{return!1}return ea.supportedChains.http.includes(t)},async getSupportedNetworks(){try{const t=await xn.get({path:"v1/supported-chains"});return ea.supportedChains=t,t}catch{return ea.supportedChains}},async fetchIdentity({address:t}){const e=He.getIdentityFromCacheForAddress(t);if(e)return e;const n=await xn.get({path:`/v1/identity/${t}`,params:{sender:ne.state.activeCaipAddress?Ue.getPlainAddress(ne.state.activeCaipAddress):void 0}});return He.updateIdentityCache({address:t,identity:n,timestamp:Date.now()}),n},async fetchTransactions({account:t,cursor:e,signal:n,cache:i,chainId:s}){var c;if(!await xn.isNetworkSupported((c=ne.state.activeCaipNetwork)==null?void 0:c.caipNetworkId))return{data:[],next:void 0};const o=He.getTransactionsCacheForAddress({address:t,chainId:s});if(o)return o;const a=await xn.get({path:`/v1/account/${t}/history`,params:{cursor:e,chainId:s},signal:n,cache:i});return He.updateTransactionsCache({address:t,chainId:s,timestamp:Date.now(),transactions:a}),a},async fetchSwapQuote({amount:t,userAddress:e,from:n,to:i,gasPrice:s}){var o;return await xn.isNetworkSupported((o=ne.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)?xn.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:t,userAddress:e,from:n,to:i,gasPrice:s}}):{quotes:[]}},async fetchSwapTokens({chainId:t}){var n;return await xn.isNetworkSupported((n=ne.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?xn.get({path:"/v1/convert/tokens",params:{chainId:t}}):{tokens:[]}},async getAddressBalance({caipNetworkId:t,address:e}){return ea.api.post({path:`/v1?chainId=${t}&projectId=${ye.state.projectId}`,body:{id:"1",jsonrpc:"2.0",method:"getAddressBalance",params:{address:e}}}).then(n=>n.result)},async fetchTokenPrice({addresses:t}){var s;if(!await xn.isNetworkSupported((s=ne.state.activeCaipNetwork)==null?void 0:s.caipNetworkId))return{fungibles:[]};const n=He.getTokenPriceCacheForAddresses(t);if(n)return n;const i=await ea.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:t,projectId:ye.state.projectId},headers:{"Content-Type":"application/json"}});return He.updateTokenPriceCache({addresses:t,timestamp:Date.now(),tokenPrice:i}),i},async fetchSwapAllowance({tokenAddress:t,userAddress:e}){var i;return await xn.isNetworkSupported((i=ne.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?xn.get({path:"/v1/convert/allowance",params:{tokenAddress:t,userAddress:e},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:t}){var s;const{st:e,sv:n}=xn.getSdkProperties();if(!await xn.isNetworkSupported((s=ne.state.activeCaipNetwork)==null?void 0:s.caipNetworkId))throw new Error("Network not supported for Gas Price");return xn.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:t,st:e,sv:n}})},async generateSwapCalldata({amount:t,from:e,to:n,userAddress:i,disableEstimate:s}){var o;if(!await xn.isNetworkSupported((o=ne.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return ea.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:t,eip155:{slippage:fn.CONVERT_SLIPPAGE_TOLERANCE},projectId:ye.state.projectId,from:e,to:n,userAddress:i,disableEstimate:s}})},async generateApproveCalldata({from:t,to:e,userAddress:n}){var o;const{st:i,sv:s}=xn.getSdkProperties();if(!await xn.isNetworkSupported((o=ne.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return xn.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:n,from:t,to:e,st:i,sv:s}})},async getBalance(t,e,n){var l;const{st:i,sv:s}=xn.getSdkProperties();if(!await xn.isNetworkSupported((l=ne.state.activeCaipNetwork)==null?void 0:l.caipNetworkId))return ti.showError("Token Balance Unavailable"),{balances:[]};const o=`${e}:${t}`,a=He.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await xn.get({path:`/v1/account/${t}/balance`,params:{currency:"usd",chainId:e,forceUpdate:n,st:i,sv:s}});return He.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(t){var n;return await xn.isNetworkSupported((n=ne.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?xn.get({path:`/v1/profile/account/${t}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:t}){var i,s;if(!await xn.isNetworkSupported((i=ne.state.activeCaipNetwork)==null?void 0:i.caipNetworkId))return[];const n=(s=ne.getAccountData())==null?void 0:s.address;return xn.get({path:`/v1/profile/reverse/${t}`,params:{sender:n,apiVersion:"2"}})},async getEnsNameSuggestions(t){var n;return await xn.isNetworkSupported((n=ne.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?xn.get({path:`/v1/profile/suggestions/${t}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:t,address:e,message:n,signature:i}){var r;return await xn.isNetworkSupported((r=ne.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?ea.api.post({path:"/v1/profile/account",body:{coin_type:t,address:e,message:n,signature:i},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:t,partnerUserId:e,defaultNetwork:n,purchaseAmount:i,paymentAmount:s}){var a;return await xn.isNetworkSupported((a=ne.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?(await ea.api.post({path:"/v1/generators/onrampurl",params:{projectId:ye.state.projectId},body:{destinationWallets:t,defaultNetwork:n,partnerUserId:e,defaultExperience:"buy",presetCryptoAmount:i,presetFiatAmount:s}}
137)).url:""},async getOnrampOptions(){var e;if(!await xn.isNetworkSupported((e=ne.state.activeCaipNetwork)==null?void 0:e.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await xn.get({path:"/v1/onramp/options"})}catch{return Cxe}},async getOnrampQuote({purchaseCurrency:t,paymentCurrency:e,amount:n,network:i}){var s;try{return await xn.isNetworkSupported((s=ne.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?await ea.api.post({path:"/v1/onramp/quote",params:{projectId:ye.state.projectId},body:{purchaseCurrency:t,paymentCurrency:e,amount:n,network:i}}):null}catch{return{networkFee:{amount:n,currency:e.id},paymentSubtotal:{amount:n,currency:e.id},paymentTotal:{amount:n,currency:e.id},purchaseAmount:{amount:n,currency:e.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(t){var n;return await xn.isNetworkSupported((n=ne.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?xn.get({path:`/v1/sessions/${t}`}):[]},async revokeSmartSession(t,e,n){var s;return await xn.isNetworkSupported((s=ne.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?ea.api.post({path:`/v1/sessions/${t}/revoke`,params:{projectId:ye.state.projectId},body:{pci:e,signature:n}}):{success:!1}},setClientId(t){ea.clientId=t,ea.api=new D6({baseUrl:qte,clientId:t})}},yl={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",url:"https://go.cb-w.com"},BINANCE:{id:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25",appId:"yFK5FCqYprrXDiVFbhyRx7",deeplink:"bnc://app.binance.com/mp/app",url:"https://app.binance.com/en/download"}},xxe={handleMobileDeeplinkRedirect(t,e){const n=window.location.href,i=encodeURIComponent(n);if(t===yl.PHANTOM.id&&!("phantom"in window)){const s=n.startsWith("https")?"https":"http",r=n.split("/")[2],o=encodeURIComponent(`${s}://${r}`);window.location.href=`${yl.PHANTOM.url}/ul/browse/${i}?ref=${o}`}if(t===yl.SOLFLARE.id&&!("solflare"in window)&&(window.location.href=`${yl.SOLFLARE.url}/ul/v1/browse/${i}?ref=${i}`),e===we.CHAIN.SOLANA&&t===yl.COINBASE.id&&!("coinbaseSolana"in window)&&(window.location.href=`${yl.COINBASE.url}/dapp?cb_url=${i}`),e===we.CHAIN.BITCOIN&&t===yl.BINANCE.id&&!("binancew3w"in window)){const s=ne.state.activeCaipNetwork,r=window.btoa("/pages/browser/index"),o=window.btoa(`url=${i}&defaultChainId=${(s==null?void 0:s.id)??1}`),a=new URL(yl.BINANCE.deeplink);a.searchParams.set("appId",yl.BINANCE.appId),a.searchParams.set("startPagePath",r),a.searchParams.set("startPageQuery",o);const c=new URL(yl.BINANCE.url);c.searchParams.set("_dp",window.btoa(a.toString())),window.location.href=c.toString()}}},Exe=Object.freeze({enabled:!0,events:[]}),_xe=new D6({baseUrl:Ue.getAnalyticsUrl(),clientId:null}),Sxe=5,Axe=60*1e3,C0=Hi({...Exe}),Txe={state:C0,subscribeKey(t,e){return ar(C0,t,e)},async sendError(t,e){if(!C0.enabled)return;const n=Date.now();if(C0.events.filter(r=>{const o=new Date(r.properties.timestamp||"").getTime();return n-o<Axe}).length>=Sxe)return;const s={type:"error",event:e,properties:{errorType:t.name,errorMessage:t.message,stackTrace:t.stack,timestamp:new Date().toISOString()}};C0.events.push(s);try{if(typeof window>"u")return;const{projectId:r,sdkType:o,sdkVersion:a}=ye.state;await _xe.post({path:"/e",params:{projectId:r,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:Ue.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:new Date().toISOString(),props:{type:"error",event:e,errorType:t.name,errorMessage:t.message,stackTrace:t.stack}}})}catch{}},enable(){C0.enabled=!0},disable(){C0.enabled=!1},clearEvents(){C0.events=[]}};class Md extends Error{constructor(e,n,i){super(e),this.originalName="AppKitError",this.name="AppKitError",this.category=n,this.originalError=i,i&&i instanceof Error&&(this.originalName=i.name),Object.setPrototypeOf(this,Md.prototype);let s=!1;
137if(i instanceof Error&&typeof i.stack=="string"&&i.stack){const r=i.stack,o=r.indexOf(` 138`);if(o>-1){const a=r.substring(o+1);this.stack=`${this.name}: ${this.message} 139${a}`,s=!0}}s||(Error.captureStackTrace?Error.captureStackTrace(this,Md):this.stack||(this.stack=`${this.name}: ${this.message}`))}}function JV(t,e){let n="";try{t instanceof Error?n=t.message:typeof t=="string"?n=t:typeof t=="object"&&t!==null?Object.keys(t).length===0?n="Unknown error":n=(t==null?void 0:t.message)||JSON.stringify(t):n=String(t)}catch(s){n="Unknown error",console.error("Error parsing error message",s)}const i=t instanceof Md?t:new Md(n,e,t);throw Txe.sendError(i,i.category),i}function Yc(t,e="INTERNAL_SDK_ERROR"){const n={};return Object.keys(t).forEach(i=>{const s=t[i];if(typeof s=="function"){let r=s;s.constructor.name==="AsyncFunction"?r=async(...o)=>{try{return await s(...o)}catch(a){return JV(a,e)}}:r=(...o)=>{try{return s(...o)}catch(a){return JV(a,e)}},n[i]=r}else n[i]=s}),n}const xc=Hi({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),kxe={state:xc,subscribeNetworkImages(t){return or(xc.networkImages,()=>t(xc.networkImages))},subscribeKey(t,e){return ar(xc,t,e)},subscribe(t){return or(xc,()=>t(xc))},setWalletImage(t,e){xc.walletImages[t]=e},setNetworkImage(t,e){xc.networkImages[t]=e},setChainImage(t,e){xc.chainImages[t]=e},setConnectorImage(t,e){xc.connectorImages={...xc.connectorImages,[t]:e}},setTokenImage(t,e){xc.tokenImages[t]=e},setCurrencyImage(t,e){xc.currencyImages[t]=e}},vr=Yc(kxe),eW={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:"",sui:"",stacks:"",ton:"20f673c0-095e-49b2-07cf-eb5049dcf600"},YT=Hi({networkImagePromises:{}}),qi={async fetchWalletImage(t){if(t)return await ut._fetchWalletImage(t),this.getWalletImageById(t)},async fetchNetworkImage(t){if(!t)return;const e=this.getNetworkImageById(t);return e||(YT.networkImagePromises[t]||(YT.networkImagePromises[t]=ut._fetchNetworkImage(t)),await YT.networkImagePromises[t],this.getNetworkImageById(t))},getWalletImageById(t){if(t)return vr.state.walletImages[t]},getWalletImage(t){if(t!=null&&t.image_url)return t==null?void 0:t.image_url;if(t!=null&&t.image_id)return vr.state.walletImages[t.image_id]},getNetworkImage(t){var e,n,i;if((e=t==null?void 0:t.assets)!=null&&e.imageUrl)return(n=t==null?void 0:t.assets)==null?void 0:n.imageUrl;if((i=t==null?void 0:t.assets)!=null&&i.imageId)return vr.state.networkImages[t.assets.imageId]},getNetworkImageById(t){if(t)return vr.state.networkImages[t]},getConnectorImage(t){var e;if(t!=null&&t.imageUrl)return t.imageUrl;if((e=t==null?void 0:t.info)!=null&&e.icon)return t.info.icon;if(t!=null&&t.imageId)return vr.state.connectorImages[t.imageId]},getChainImage(t){return vr.state.networkImages[eW[t]]},getTokenImage(t){if(t)return vr.state.tokenImages[t]},getWalletImageUrl(t){if(!t)return"";const{projectId:e,sdkType:n,sdkVersion:i}=ye.state,s=new URL(`${we.W3M_API_URL}/getWalletImage/${t}`);return s.searchParams.set("projectId",e),s.searchParams.set("st",n),s.searchParams.set("sv",i),s.toString()},getAssetImageUrl(t){if(!t)return"";const{projectId:e,sdkType:n,sdkVersion:i}=ye.state,s=new URL(`${we.W3M_API_URL}/public/getAssetImage/${t}`);return s.searchParams.set("projectId",e),s.searchParams.set("st",n),s.searchParams.set("sv",i),s.toString()},getChainNamespaceImageUrl(t){return this.getAssetImageUrl(eW[t])}},Nxe=Ue.getAnalyticsUrl(),Rxe=new D6({baseUrl:Nxe,clientId:null}),Pxe=["MODAL_CREATED"],Ixe=45,tW=1e3*10,Vs=Hi({timestamp:Date.now(),lastFlush:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"},pendingEvents:[],subscribedToVisibilityChange:!1,walletImpressions:[]}),Et={state:Vs,subscribe(t){return or(Vs,()=>t(Vs))},getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:n}=ye.state;return{projectId:t,st:e,sv:n||"html-wagmi-4.2.2"}},shouldFlushEvents(){const t=JSON.stringify(Vs.pendingEvents).length/1024>Ixe,e=Vs.lastFlush+tW<Date.now();return t||e},_setPendingEvent(t){var e,n;try{let i=(e=ne.getAccountData())==null?void 0:e.address;if("address"in t.data&&t.data.address&&(i=t.data.address),Pxe.includes(t.data.event)||typeof window>"u")return;const s=(n=ne.getActiveCaipNetwork())==null?void 0:n.caipNetworkId;this.state.pendingEvents.push({eventId:Ue.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:t.timestamp,props:{...t.data,address:i,properties:{..."properties"in t.data?t.data.properties:{},caipNetworkId:s}}}),Vs.reportedErrors.FORBIDDEN=!1,Et.shouldFlushEvents()&&Et._submitPendingEvents()}catch(i){console.warn("_setPendingEvent",i)}},sendEvent(t){var n;Vs.timestamp=Date.now(),Vs.data=t;const e=["INITIALIZE","CONNECT_SUCCESS","SOCIAL_LOGIN_SUCCESS"];((n=ye.state.features)!=null&&n.analytics||e.includes(t.event))&&Et._setPendingEvent(Vs),this.subscribeToFlushTriggers()},sendWalletImpressionEvent(t){Vs.walletImpressions.push(t)},_transformPendingEventsForBatch(t){try{return t.filter(e=>e.props.event!=="WALLET_IMPRESSION_V2")}catch{return t}},_submitPendingEvents(){if(Vs.lastFlush=Date.now(),!(Vs.pendingEvents.length===0&&Vs.walletImpressions.length===0))try{const t=Et._transformPendingEventsForBatch(Vs.pendingEvents);Vs.walletImpressions.length&&t.push({eventId:Ue.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:Date.now(),props:{type:"track",event:"WALLET_IMPRESSION_V2",items:[...Vs.walletImpressions]}}),Rxe.sendBeacon({path:"/batch",params:Et.getSdkProperties(),body:t}),Vs.reportedErrors.FORBIDDEN=!1,Vs.pendingEvents=[],Vs.walletImpressions=[]}catch{Vs.reportedErrors.FORBIDDEN=!0}},subscribeToFlushTriggers(){var t,e,n;Vs.subscribedToVisibilityChange||typeof document>"u"||(Vs.subscribedToVisibilityChange=!0,(t=document==null?void 0:document.addEventListener)==null||t.call(document,"visibilitychange",()=>{document.visibilityState==="hidden"&&Et._submitPendingEvents()}),(e=document==null?void 0:document.addEventListener)==null||e.call(document,"freeze",()=>{Et._submitPendingEvents()}),(n=window==null?void 0:window.addEventListener)==null||n.call(window,"pagehide",()=>{Et._submitPendingEvents()}),setInterval(()=>{Et._submitPendingEvents()},tW))}},Dxe=Ue.getApiUrl(),ta=new D6({baseUrl:Dxe,clientId:null}),Oxe=40,nW=4,Mxe=20,$n=Hi({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1,explorerWallets:[],explorerFilteredWallets:[],plan:{tier:"none",hasExceededUsageLimit:!1,limits:{isAboveRpcLim
139it:!1,isAboveMauLimit:!1}}}),ut={state:$n,subscribeKey(t,e){return ar($n,t,e)},_getSdkProperties(){const{projectId:t,sdkType:e,sdkVersion:n}=ye.state;return{projectId:t,st:e||"appkit",sv:n||"html-wagmi-4.2.2"}},_filterOutExtensions(t){return ye.state.isUniversalProvider?t.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):t},async _fetchWalletImage(t){const e=`${ta.baseUrl}/getWalletImage/${t}`,n=await ta.getBlob({path:e,params:ut._getSdkProperties()});vr.setWalletImage(t,URL.createObjectURL(n))},async _fetchNetworkImage(t){const e=`${ta.baseUrl}/public/getAssetImage/${t}`,n=await ta.getBlob({path:e,params:ut._getSdkProperties()});vr.setNetworkImage(t,URL.createObjectURL(n))},async _fetchConnectorImage(t){const e=`${ta.baseUrl}/public/getAssetImage/${t}`,n=await ta.getBlob({path:e,params:ut._getSdkProperties()});vr.setConnectorImage(t,URL.createObjectURL(n))},async _fetchCurrencyImage(t){const e=`${ta.baseUrl}/public/getCurrencyImage/${t}`,n=await ta.getBlob({path:e,params:ut._getSdkProperties()});vr.setCurrencyImage(t,URL.createObjectURL(n))},async _fetchTokenImage(t){const e=`${ta.baseUrl}/public/getTokenImage/${t}`,n=await ta.getBlob({path:e,params:ut._getSdkProperties()});vr.setTokenImage(t,URL.createObjectURL(n))},_filterWalletsByPlatform(t){const e=t.length,n=Ue.isMobile()?t==null?void 0:t.filter(s=>s.mobile_link||s.webapp_link?!0:Object.values(yl).map(o=>o.id).includes(s.id)):t,i=e-n.length;return{filteredWallets:n,mobileFilteredOutWalletsLength:i}},async fetchProjectConfig(){return(await ta.get({path:"/appkit/v1/config",params:ut._getSdkProperties()})).features},async fetchUsage(){try{const t=await ta.get({path:"/appkit/v1/project-limits",params:ut._getSdkProperties()}),{tier:e,isAboveMauLimit:n,isAboveRpcLimit:i}=t.planLimits,s=e==="starter",r=n||i;ut.state.plan={tier:e,hasExceededUsageLimit:s&&r,limits:{isAboveRpcLimit:i,isAboveMauLimit:n}}}catch(t){console.warn("Failed to fetch usage",t)}},async fetchAllowedOrigins(){try{const{allowedOrigins:t}=await ta.get({path:"/projects/v1/origins",params:ut._getSdkProperties()});return t}catch(t){if(t instanceof Error&&t.cause instanceof Response){const e=t.cause.status;if(e===we.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)throw new Error("RATE_LIMITED",{cause:t});if(e>=we.HTTP_STATUS_CODES.SERVER_ERROR&&e<600)throw new Error("SERVER_ERROR",{cause:t});return[]}return[]}},async fetchNetworkImages(){const t=ne.getAllRequestedCaipNetworks(),e=t==null?void 0:t.map(({assets:n})=>n==null?void 0:n.imageId).filter(Boolean).filter(n=>!qi.getNetworkImageById(n));e&&await Promise.allSettled(e.map(n=>ut._fetchNetworkImage(n)))},async fetchConnectorImages(){const{connectors:t}=Oe.state,e=t.map(({imageId:n})=>n).filter(Boolean);await Promise.allSettled(e.map(n=>ut._fetchConnectorImage(n)))},async fetchCurrencyImages(t=[]){await Promise.allSettled(t.map(e=>ut._fetchCurrencyImage(e)))},async fetchTokenImages(t=[]){await Promise.allSettled(t.map(e=>ut._fetchTokenImage(e)))},async fetchWallets(t){var o;const e=t.exclude??[];ut._getSdkProperties().sv.startsWith("html-core-")&&e.push(...Object.values(yl).map(a=>a.id));const i=await ta.get({path:"/getWallets",params:{...ut._getSdkProperties(),...t,page:String(t.page),entries:String(t.entries),include:(o=t.include)==null?void 0:o.join(","),exclude:e.join(",")}}),{filteredWallets:s,mobileFilteredOutWalletsLength:r}=ut._filterWalletsByPlatform(i==null?void 0:i.data);return{data:s||[],count:i==null?void 0:i.count,mobileFilteredOutWalletsLength:r}},async prefetchWalletRanks(){const t=Oe.state.connectors;if(!(t!=null&&t.length))return;const e={page:1,entries:20,badge:"certified"};if(e.names=t.map(s=>s.name).join(","),ne.state.activeChain===we.CHAIN.EVM){const s=[...t.flatMap(r=>{var o;return((o=r.connectors)==null?void 0:o.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}))||[]}),...t.map(r=>{var o;return(o=r.info)==null?void 0:o.rdns})].filter(r=>typeof r=="string"&&r.length>0);s.length&&(e.rdns=s.join(","))}const{data:n}=await ut.fetchWallets(e);$n.explorerWallets=n,Oe.extendConnectorsWithExplorerWallets(n);const i=ne.getRequestedCaipNetworkIds().join(",");$n.explorerFilteredWallets=n.filter(s=>{var r;return(r=s.chains)==null?void 0:r.some(o=>i.includes(o))})},async fetchFeaturedWallets(){const{featuredWalletIds:t}=ye.state;if(t!=null&&t.length){const e={...ut._getSdkProperties(),page:1,entries:(t==null?void 0:t.length)??nW,include:t},{data:n}=await ut.fetchWallets(e),i=[...n].sort((r,o)=>t.indexOf(r.id)-t.indexOf(o.id)),s=i.map(r=>
139r.image_id).filter(Boolean);await Promise.allSettled(s.map(r=>ut._fetchWalletImage(r))),$n.featured=i,$n.allFeatured=i}},async fetchRecommendedWallets(){try{$n.isFetchingRecommendedWallets=!0;const{includeWalletIds:t,excludeWalletIds:e,featuredWalletIds:n}=ye.state,i=[...e??[],...n??[]].filter(Boolean),s=ne.getRequestedCaipNetworkIds().join(","),r={page:1,entries:nW,include:t,exclude:i,chains:s},{data:o,count:a}=await ut.fetchWallets(r),c=He.getRecentWallets(),l=o.map(h=>h.image_id).filter(Boolean),d=c.map(h=>h.image_id).filter(Boolean);await Promise.allSettled([...l,...d].map(h=>ut._fetchWalletImage(h))),$n.recommended=o,$n.allRecommended=o,$n.count=a??0}catch{}finally{$n.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:t}){const{includeWalletIds:e,excludeWalletIds:n,featuredWalletIds:i}=ye.state,s=ne.getRequestedCaipNetworkIds().join(","),r=[...$n.recommended.map(({id:h})=>h),...n??[],...i??[]].filter(Boolean),o={page:t,entries:Oxe,include:e,exclude:r,chains:s},{data:a,count:c,mobileFilteredOutWalletsLength:l}=await ut.fetchWallets(o);$n.mobileFilteredOutWalletsLength=l+($n.mobileFilteredOutWalletsLength??0);const d=a.slice(0,Mxe).map(h=>h.image_id).filter(Boolean);await Promise.allSettled(d.map(h=>ut._fetchWalletImage(h))),$n.wallets=Ue.uniqueBy([...$n.wallets,...ut._filterOutExtensions(a)],"id").filter(h=>{var p;return(p=h.chains)==null?void 0:p.some(g=>s.includes(g))}),$n.count=c>$n.count?c:$n.count,$n.page=t},async initializeExcludedWallets({ids:t}){const e={page:1,entries:t.length,include:t},{data:n}=await ut.fetchWallets(e);n&&n.forEach(i=>{$n.excludedWallets.push({rdns:i.rdns,name:i.name})})},async searchWallet({search:t,badge:e}){const{includeWalletIds:n,excludeWalletIds:i}=ye.state,s=ne.getRequestedCaipNetworkIds().join(",");$n.search=[];const r={page:1,entries:100,search:t==null?void 0:t.trim(),badge_type:e,include:n,exclude:i,chains:s},{data:o}=await ut.fetchWallets(r);Et.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:e??"",search:t??""}});const a=o.map(c=>c.image_id).filter(Boolean);await Promise.allSettled([...a.map(c=>ut._fetchWalletImage(c)),Ue.wait(300)]),$n.search=ut._filterOutExtensions(o)},initPromise(t,e){const n=$n.promises[t];return n||($n.promises[t]=e())},prefetch({fetchConnectorImages:t=!0,fetchFeaturedWallets:e=!0,fetchRecommendedWallets:n=!0,fetchNetworkImages:i=!0,fetchWalletRanks:s=!0}={}){const r=[t&&ut.initPromise("connectorImages",ut.fetchConnectorImages),e&&ut.initPromise("featuredWallets",ut.fetchFeaturedWallets),n&&ut.initPromise("recommendedWallets",ut.fetchRecommendedWallets),i&&ut.initPromise("networkImages",ut.fetchNetworkImages),s&&ut.initPromise("walletRanks",ut.prefetchWalletRanks)].filter(Boolean);return Promise.allSettled(r)},prefetchAnalyticsConfig(){var t;(t=ye.state.features)!=null&&t.analytics&&ut.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:t}=await ta.get({path:"/getAnalyticsConfig",params:ut._getSdkProperties()});ye.setFeatures({analytics:t})}catch{ye.setFeatures({analytics:!1})}},filterByNamespaces(t){if(!(t!=null&&t.length)){$n.featured=$n.allFeatured,$n.recommended=$n.allRecommended;return}const e=ne.getRequestedCaipNetworkIds().join(",");$n.featured=$n.allFeatured.filter(n=>{var i;return(i=n.chains)==null?void 0:i.some(s=>e.includes(s))}),$n.recommended=$n.allRecommended.filter(n=>{var i;return(i=n.chains)==null?void 0:i.some(s=>e.includes(s))}),$n.filteredWallets=$n.wallets.filter(n=>{var i;return(i=n.chains)==null?void 0:i.some(s=>e.includes(s))})},clearFilterByNamespaces(){$n.filteredWallets=[]},setFilterByNamespace(t){if(!t){$n.featured=$n.allFeatured,$n.recommended=$n.allRecommended;return}const e=ne.getRequestedCaipNetworkIds().join(",");$n.featured=$n.allFeatured.filter(n=>{var i;return(i=n.chains)==null?void 0:i.some(s=>e.includes(s))}),$n.recommended=$n.allRecommended.filter(n=>{var i;return(i=n.chains)==null?void 0:i.some(s=>e.includes(s))}),$n.filteredWallets=$n.wallets.filter(n=>{var i;return(i=n.chains)==null?void 0:i.some(s=>e.includes(s))})}},Lxe=["ConnectingExternal","ConnectingMultiChain","ConnectingSocial","ConnectingFarcaster"],Li=Hi({view:"Connect",history:["Connect"],transactionStack:[]}),$xe={state:Li,subscribeKey(t,e){return ar(Li,t,e)},pushTransactionStack(t){Li.transactionStack.push(t)},popTransactionStack(t){const e=Li.transactionStack.pop();if(!e)return;const{onSuccess:n,onError:i,onCancel:s}=e;switch(t){case"success":n==null||n();break;case"error":i==null||i(),Pe.goBack();break;case"cancel":s==null||s(),Pe.goBack();break}},push(t,e){let n=t,i=e;ut.state.plan.hasExceededUsageLimit&&Lxe.includes(t)&&(n="UsageExceeded",i=void 0),n!==Li.view&&(Li.view=n,Li.history.push(n),Li.data=i)},reset(t,e){Li.view=t,Li.history=[t],Li.data=e},replace(t,e){Li.history.at(-1)===t||(Li.view=t,Li.history[Li.history.length-1]=t,Li.data=e)},goBack(){var i,s;const t=ne.state.activeCaipAddress,e=Pe.state.view==="ConnectingFarcaster",n=!t&&e;if(Li.history.length>1){Li.history.pop();const[r]=Li.history.slice(-1);r&&(t&&r==="Connect"?Li.view="Account":Li.view=r)}else wn.close();(i=Li.data)!=null&&i.wallet&&(Li.data.wallet=void 0),(s=Li.data)!=null&&s.redirectView&&(Li.data.redirectView=void 0),setTimeout(()=>{var r,o,a;if(n){ne.setAccountProp("farcasterUrl",void 0,ne.state.activeChain);const c=Oe.getAuthConnector();(r=c==null?void 0:c.provider)==null||r.reload();const l=kg(ye.state);(a=(o=c==null?void 0:c.provider)==null?void 0:o.syncDappData)==null||a.call(o,{metadata:l.metadata,sdkVersion:l.sdkVersion,projectId:l.projectId,sdkType:l.sdkType})}},100)},goBackToIndex(t){if(Li.history.length>1){Li.history=Li.history.slice(0,t+1);const[e]=Li.history.slice(-1);e&&(Li.view=e)}},goBackOrCloseModal(){Pe.state.history.length>1?Pe.goBack():wn.close()}},Pe=Yc($xe),_h=Hi({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),hP={state:_h,subscribe(t){return or(_h,()=>t(_h))},setThemeMode(t){_h.themeMode=t;try{const e=Oe.getAuthConnector();if(e){const n=hP.getSnapshot().themeVariables;e.provider.syncTheme({themeMode:t,themeVariables:n,w3mThemeVariables:d5(n,t)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(t){_h.themeVariables={..._h.themeVariables,...t};try{const e=Oe.getAuthConnector();if(e){const n=hP.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:n,w3mThemeVariables:d5(_h.themeVariables,_h.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return kg(_h)}},Xr=Yc(hP),zte=Object.fromEntries(kte.map(t=>[t,void 0])),Uxe=Object.fromEntries(kte.map(t=>[t,!0])),wi=Hi({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:zte,filterByNamespaceMap:Uxe}),Bxe={state:wi,subscribe(t){return or(wi,()=>{t(wi)})},subscribeKey(t,e){return ar(wi,t,e)}
139,initialize(t){t.forEach(e=>{const n=He.getConnectedConnectorId(e);n&&Oe.setConnectorId(n,e)})},setActiveConnector(t){t&&(wi.activeConnector=eb(t))},setConnectors(t){t.filter(s=>!wi.allConnectors.some(r=>r.id===s.id&&Oe.getConnectorName(r.name)===Oe.getConnectorName(s.name)&&r.chain===s.chain)).forEach(s=>{s.type!=="MULTI_CHAIN"&&wi.allConnectors.push(eb(s))});const n=Oe.getEnabledNamespaces(),i=Oe.getEnabledConnectors(n);wi.connectors=Oe.mergeMultiChainConnectors(i)},filterByNamespaces(t){Object.keys(wi.filterByNamespaceMap).forEach(e=>{wi.filterByNamespaceMap[e]=!1}),t.forEach(e=>{wi.filterByNamespaceMap[e]=!0}),Oe.updateConnectorsForEnabledNamespaces()},filterByNamespace(t,e){wi.filterByNamespaceMap[t]=e,Oe.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const t=Oe.getEnabledNamespaces(),e=Oe.getEnabledConnectors(t),n=Oe.areAllNamespacesEnabled();wi.connectors=Oe.mergeMultiChainConnectors(e),n?ut.clearFilterByNamespaces():ut.filterByNamespaces(t)},getEnabledNamespaces(){return Object.entries(wi.filterByNamespaceMap).filter(([t,e])=>e).map(([t])=>t)},getEnabledConnectors(t){return wi.allConnectors.filter(e=>t.includes(e.chain))},areAllNamespacesEnabled(){return Object.values(wi.filterByNamespaceMap).every(t=>t)},mergeMultiChainConnectors(t){const e=Oe.generateConnectorMapByName(t),n=[];return e.forEach(i=>{const s=i[0],r=(s==null?void 0:s.id)===we.CONNECTOR_ID.AUTH;i.length>1&&s?n.push({name:s.name,imageUrl:s.imageUrl,imageId:s.imageId,connectors:[...i],type:r?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(s==null?void 0:s.id)||""}):s&&n.push(s)}),n},generateConnectorMapByName(t){const e=new Map;return t.forEach(n=>{const{name:i}=n,s=Oe.getConnectorName(i);if(!s)return;const r=e.get(s)||[];r.find(a=>a.chain===n.chain)||r.push(n),e.set(s,r)}),e},getConnectorName(t){return t&&({"Trust Wallet":"Trust"}[t]||t)},getUniqueConnectorsByName(t){const e=[];return t.forEach(n=>{e.find(i=>i.chain===n.chain)||e.push(n)}),e},addConnector(t){var e,n,i;if(t.id===we.CONNECTOR_ID.AUTH){const s=t,r=kg(ye.state),o=Xr.getSnapshot().themeMode,a=Xr.getSnapshot().themeVariables;(n=(e=s==null?void 0:s.provider)==null?void 0:e.syncDappData)==null||n.call(e,{metadata:r.metadata,sdkVersion:r.sdkVersion,projectId:r.projectId,sdkType:r.sdkType}),(i=s==null?void 0:s.provider)==null||i.syncTheme({themeMode:o,themeVariables:a,w3mThemeVariables:d5(a,o)}),Oe.setConnectors([t])}else Oe.setConnectors([t])},getAuthConnector(t){var i;const e=t||ne.state.activeChain,n=wi.connectors.find(s=>s.id===we.CONNECTOR_ID.AUTH);if(n)return(i=n==null?void 0:n.connectors)!=null&&i.length?n.connectors.find(r=>r.chain===e):n},getAnnouncedConnectorRdns(){return wi.connectors.filter(t=>t.type==="ANNOUNCED").map(t=>{var e;return(e=t.info)==null?void 0:e.rdns})},getConnectorById(t){return wi.allConnectors.find(e=>e.id===t)},getConnector({id:t,namespace:e}){const n=e||ne.state.activeChain;return wi.allConnectors.filter(r=>r.chain===n).find(r=>r.id===t||r.explorerId===t)},syncIfAuthConnector(t){var r,o;if(t.id!=="AUTH")return;const e=t,n=kg(ye.state),i=Xr.getSnapshot().themeMode,s=Xr.getSnapshot().themeVariables;(o=(r=e==null?void 0:e.provider)==null?void 0:r.syncDappData)==null||o.call(r,{metadata:n.metadata,sdkVersion:n.sdkVersion,sdkType:n.sdkType,projectId:n.projectId}),e.provider.syncTheme({themeMode:i,themeVariables:s,w3mThemeVariables:d5(s,i)})},getConnectorsByNamespace(t){const e=wi.allConnectors.filter(n=>n.chain===t);return Oe.mergeMultiChainConnectors(e)},canSwitchToSmartAccount(t){return ne.checkIfSmartAccountEnabled()&&$s(t)===Wi.ACCOUNT_TYPES.EOA},selectWalletConnector(t){var s;const e=(s=Pe.state.data)==null?void 0:s.redirectView,n=ne.state.activeChain,i=n?Oe.getConnector({id:t.id,namespace:n}):void 0;xxe.handleMobileDeeplinkRedirect((i==null?void 0:i.explorerId)||t.id,ne.state.activeChain),i?Pe.push("ConnectingExternal",{connector:i,wallet:t,redirectView:e}):Pe.push("ConnectingWalletConnect",{wallet:t,redirectView:e})},getConnectors(t){return t?Oe.getConnectorsByNamespace(t):Oe.mergeMultiChainConnectors(wi.allConnectors)},setFilterByNamespace(t){wi.filterByNamespace=t,wi.connectors=Oe.getConnectors(t),ut.setFilterByNamespace(t)},setConnectorId(t,e){t&&(wi.activeConnectorIds={...wi.activeConnectorIds,[e]:t},He.setConnectedConnectorId(e,t))},removeConnectorId(t){wi.activeConnectorIds={...wi.activeConnectorIds,[t]:void 0},He.deleteConnectedConnectorId(t)},getConnectorId(t){if(t)return wi.activeConnectorIds[t]},isConnected(t){return t?!!wi.activeConnectorIds[t]:Object.values(wi.activeConnectorIds).some(e=>!!e)},resetConnectorIds(){wi.activeConnectorIds={...zte}}
139,extendConnectorsWithExplorerWallets(t){wi.allConnectors.forEach(i=>{const s=t.find(r=>{var o;return r.id===i.id||r.rdns&&r.rdns===((o=i.info)==null?void 0:o.rdns)});s&&(i.explorerWallet=s)});const e=Oe.getEnabledNamespaces(),n=Oe.getEnabledConnectors(e);wi.connectors=Oe.mergeMultiChainConnectors(n)}},Oe=Yc(Bxe),Fxe=1e3,Av={checkNamespaceConnectorId(t,e){return Oe.getConnectorId(t)===e},isSocialProvider(t){return fn.DEFAULT_REMOTE_FEATURES.socials.includes(t)},connectWalletConnect({walletConnect:t,connector:e,closeModalOnConnect:n=!0,redirectViewOnModalClose:i="Connect",onOpen:s,onConnect:r}){return new Promise((o,a)=>{if(t&&Oe.setActiveConnector(e),s==null||s(Ue.isMobile()&&t),i){const l=wn.subscribeKey("open",d=>{d||(Pe.state.view!==i&&Pe.replace(i),l(),a(new Error("Modal closed")))})}const c=ne.subscribeKey("activeCaipAddress",l=>{l&&(r==null||r(),n&&wn.close(),c(),o(Lr.parseCaipAddress(l)))})})},connectExternal(t){return new Promise((e,n)=>{const i=ne.subscribeKey("activeCaipAddress",s=>{s&&(wn.close(),i(),e(Lr.parseCaipAddress(s)))});Ve.connectExternal(t,t.chain).catch(()=>{i(),n(new Error("Connection rejected"))})})},connectSocial({social:t,namespace:e,closeModalOnConnect:n=!0,onOpenFarcaster:i,onConnect:s}){let r,o=!1,a=null;const c=e||ne.state.activeChain,l=ne.subscribeKey("activeCaipAddress",d=>{d&&(n&&wn.close(),l())});return new Promise((d,h)=>{async function p(b){var w;if((w=b.data)!=null&&w.resultUri)if(b.origin===we.SECURE_SITE_SDK_ORIGIN){window.removeEventListener("message",p,!1);try{const C=Oe.getAuthConnector(c);if(C&&!o){r&&r.close(),o=!0;const E=b.data.resultUri;Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:t}}),He.setConnectedSocialProvider(t),await Ve.connectExternal({id:C.id,type:C.type,socialUri:E},C.chain);const T=ne.state.activeCaipAddress;if(!T){h(new Error("Failed to connect"));return}d(Lr.parseCaipAddress(T)),Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:t}})}}catch(C){Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:t,message:Ue.parseError(C)}}),h(new Error("Failed to connect"))}}else Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:t,message:"Untrusted Origin"}})}async function g(){if(Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:t}}),t==="farcaster"){i==null||i();const b=wn.subscribeKey("open",C=>{!C&&t==="farcaster"&&(h(new Error("Popup closed")),s==null||s(),b())}),w=Oe.getAuthConnector();if(w){const C=ne.getAccountData(c);if(!(C!=null&&C.farcasterUrl))try{const{url:E}=await w.provider.getFarcasterUri();ne.setAccountProp("farcasterUrl",E,c)}catch{h(new Error("Failed to connect to farcaster"))}}}else{const b=Oe.getAuthConnector();a=Ue.returnOpenHref(`${we.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes");try{if(b){const{uri:w}=await b.provider.getSocialRedirectUri({provider:t});if(a&&w){a.location.href=w,r=a;const C=setInterval(()=>{r!=null&&r.closed&&!o&&(h(new Error("Popup closed")),clearInterval(C))},1e3);window.addEventListener("message",p,!1)}else a==null||a.close(),h(new Error("Failed to initiate social connection"))}}catch{h(new Error("Failed to initiate social connection")),a==null||a.close()}}}g()})},connectEmail({closeModalOnConnect:t=!0,redirectViewOnModalClose:e="Connect",onOpen:n,onConnect:i}){return new Promise((s,r)=>{if(n==null||n(),e){const a=wn.subscribeKey("open",c=>{c||(Pe.state.view!==e&&Pe.replace(e),a(),r(new Error("Modal closed")))})}const o=ne.subscribeKey("activeCaipAddress",a=>{a&&(i==null||i(),t&&wn.close(),o(),s(Lr.parseCaipAddress(a)))})})},async updateEmail(){const t=He.getConnectedConnectorId(ne.state.activeChain),e=Oe.getAuthConnector();if(!e)throw new Error("No auth connector found");if(t!==we.CONNECTOR_ID.AUTH)throw new Error("Not connected to email or social");const n=e.provider.getEmail()??"";return await wn.open({view:"UpdateEmailWallet",data:{email:n,redirectView:void 0}}),new Promise((i,s)=>{const r=setInterval(()=>{const a=e.provider.getEmail()??"";a!==n&&(wn.close(),clearInterval(r),o(),i({email:a}))},Fxe),o=wn.subscribeKey("open",a=>{a||(Pe.state.view!=="Connect"&&Pe.push("Connect"),clearInterval(r),o(),s(new Error("Modal closed")))})})},canSwitchToSmartAccount(t){return ne.checkIfSmartAccountEnabled()&&$s(t)===Wi.ACCOUNT_TYPES.EOA}};function h_(){var i,s;const t=((i=ne.state.activeCaipNetwork)==null?void 0:i.chainNamespace)||"eip155",e=((s=ne.state.activeCaipNetwork)==null?void 0:s.id)||1,n=fn.NATIVE_TOKEN_ADDRESS[t];return`${t}:${e}:${n}`}function $s(t){var n;return(n=ne.getAccountData(t))==null?void 0:n.preferredAccountType}function Yh(t){var e,n;return t?(n=(e=ne.state.chains.get(t))==null?void 0:e.networkState)==null?void 0:n.caipNetwork:ne.state.activeCaipNetwork}const Oc={getConnectionStatus(t,e){const n=Oe.state.activeConnectorIds[e],i=Ve.getConnections(e);return!!n&&t.connectorId===n?"connected":i.some(o=>o.connectorId.toLowerCase()===t.connectorId.toLowerCase())?"active":"disconnected"},excludeConnectorAddressFromConnections({connections:t,connectorId:e,addresses:n}){return t.map(i=>{if((e?i.connectorId.toLowerCase()===e.toLowerCase():!1)&&n){const r=i.accounts.filter(o=>!n.some(c=>c.toLowerCase()===o.address.toLowerCase()));return{...i,accounts:r}}return i})},excludeExistingConnections(t,e){const n=new Set(t);return e.filter(i=>!n.has(i.connectorId))},getConnectionsByConnectorId(t,e){return t.filter(n=>n.connectorId.toLowerCase()===e.toLowerCase())},getConnectionsData(t){var a;const e=!!((a=ye.state.remoteFeatures)!=null&&a.multiWallet),n=Oe.state.activeConnectorIds[t],i=Ve.getConnections(t),r=(Ve.state.recentConnections.get(t)??[]).filter(c=>Oe.getConnectorById(c.connectorId)),o=Oc.excludeExistingConnections([...i.map(c=>
139c.connectorId),...n?[n]:[]],r);return e?{connections:i,recentConnections:o}:{connections:i.filter(c=>c.connectorId.toLowerCase()===(n==null?void 0:n.toLowerCase())),recentConnections:[]}},onConnectMobile(t){const e=Ve.state.wcUri;if(t!=null&&t.mobile_link&&e)try{Ve.setWcError(!1);const{mobile_link:n,link_mode:i,name:s}=t,{redirect:r,redirectUniversalLink:o,href:a}=Ue.formatNativeUrl(n,e,i),c=r,l=o,d=Ue.isIframe()?"_top":"_self";Ve.setWcLinking({name:s,href:a}),Ve.setRecentWallet(t),ye.state.experimental_preferUniversalLinks&&l?Ue.openHref(l,d):Ue.openHref(c,d)}catch(n){Et.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:n instanceof Error?n.message:"Error parsing the deep link",uri:e,mobile_link:t.mobile_link,name:t.name}}),Ve.setWcError(!0)}}},Ty=Hi({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1,connectingWallet:void 0}),Uc={state:Ty,subscribe(t){return or(Ty,()=>t(Ty))},subscribeOpen(t){return ar(Ty,"open",t)},set(t){Object.assign(Ty,{...Ty,...t})}},_s=Hi({transactions:[],transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),jxe={state:_s,subscribe(t){return or(_s,()=>t(_s))},setLastNetworkInView(t){_s.lastNetworkInView=t},async fetchTransactions(t){var e;if(!t)throw new Error("Transactions can't be fetched without an accountAddress");_s.loading=!0;try{const n=await xn.fetchTransactions({account:t,cursor:_s.next,chainId:(e=ne.state.activeCaipNetwork)==null?void 0:e.caipNetworkId}),i=sa.filterSpamTransactions(n.data),s=sa.filterByConnectedChain(i),r=[..._s.transactions,...s];_s.loading=!1,_s.transactions=r,_s.transactionsByYear=sa.groupTransactionsByYearAndMonth(_s.transactionsByYear,s),_s.empty=r.length===0,_s.next=n.next?n.next:void 0}catch{const i=ne.state.activeChain;Et.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:t,projectId:ye.state.projectId,cursor:_s.next,isSmartAccount:$s(i)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}}),ti.showError("Failed to fetch transactions"),_s.loading=!1,_s.empty=!0,_s.next=void 0}},groupTransactionsByYearAndMonth(t={},e=[]){const n=t;return e.forEach(i=>{const s=new Date(i.metadata.minedAt).getFullYear(),r=new Date(i.metadata.minedAt).getMonth(),o=n[s]??{},c=(o[r]??[]).filter(l=>l.id!==i.id);n[s]={...o,[r]:[...c,i].sort((l,d)=>new Date(d.metadata.minedAt).getTime()-new Date(l.metadata.minedAt).getTime())}}),n},filterSpamTransactions(t){return t.filter(e=>{var i;return!((i=e.transfers)==null?void 0:i.every(s=>{var r;return((r=s.nft_info)==null?void 0:r.flags.is_spam)===!0}))})},filterByConnectedChain(t){var i;const e=(i=ne.state.activeCaipNetwork)==null?void 0:i.caipNetworkId;return t.filter(s=>s.metadata.chain===e)},clearCursor(){_s.next=void 0},resetTransactions(){_s.transactions=[],_s.transactionsByYear={},_s.lastNetworkInView=void 0,_s.loading=!1,_s.empty=!1,_s.next=void 0}},sa=Yc(jxe,"API_ERROR"),ii=Hi({connections:new Map,recentConnections:new Map,isSwitchingConnection:!1,wcError:!1,wcFetchingUri:!1,buffering:!1,status:"disconnected"});let fm;const Vxe={state:ii,subscribe(t){return or(ii,()=>t(ii))},subscribeKey(t,e){return ar(ii,t,e)},_getClient(){return ii._client},setClient(t){ii._client=eb(t)},initialize(t){const e=t.filter(n=>!!n.namespace).map(n=>n.namespace);Ve.syncStorageConnections(e)},syncStorageConnections(t){const e=He.getConnections(),n=t??Array.from(ne.state.chains.keys());for(const i of n){const s=e[i]??[],r=new Map(ii.recentConnections);r.set(i,s),ii.recentConnections=r}},getConnections(t){return t?ii.connections.get(t)??[]:[]},hasAnyConnection(t){const e=Ve.state.connections;return Array.from(e.values()).flatMap(n=>n).some(({connectorId:n})=>n===t)},async connectWalletConnect({cache:t="auto"}={}){var n,i,s,r;ii.wcFetchingUri=!0;const e=Ue.isTelegram()||Ue.isSafari()&&Ue.isIos();if(t==="always"||t==="auto"&&e){if(fm){await fm,fm=void 0;return}if(!Ue.isPairingExpired(ii==null?void 0:ii.wcPairingExpiry)){const o=ii.wcUri;ii.wcUri=o;return}fm=(i=(n=Ve._getClient())==null?void 0:n.connectWalletConnect)==null?void 0:i.call(n).catch(()=>{}),Ve.state.status="connecting",await fm,fm=void 0,ii.wcPairingExpiry=void 0,Ve.state.status="connected"}else await((r=(s=Ve._getClient())==null?void 0:s.connectWalletConnect)==null?void 0:r.call(s))},async connectExternal(t,e,n=!0){var o,a,c;const i=await((a=(o=Ve._getClient())==null?void 0:o.connectExternal)==null?void 0:a.call(o,t));n&&ne.setActiveNamespace(e);const s=Oe.state.allConnectors.find(l=>l.id===(t==null?void 0:t.id)),r=t.type==="AUTH"?"email":"browser";return Et.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:r,name:(s==null?void 0:s.name)||"Unknown",view:Pe.state.view,walletRank:(c=s==null?void 0:s.explorerWallet)==null?void 0:c.order}}),i},async reconnectExternal(t){var n,i;await((i=(n=Ve._getClient())==null?void 0:n.reconnectExternal)==null?void 0:i.call(n,t));const e=t.chain||ne.state.activeChain;e&&Oe.setConnectorId(t.id,e)},async setPreferredAccountType(t,e){var i;if(!e)return;wn.setLoading(!0,ne.state.activeChain);const n=Oe.getAuthConnector();n&&(ne.setAccountProp("preferredAccountType",t,e),await n.provider.setPreferredAccount(t),He.setPreferredAccountTypes(Object.entries(ne.state.chains).reduce((s,[r,o])=>{const a=r,c=$s(a);return c!==void 0&&(s[a]=c),s},{})),await Ve.reconnectExternal(n),wn.setLoading(!1,ne.state.activeChain),Et.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:t,network:((i=ne.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||""}}))},async signMessage(t){var e;return(e=Ve._getClient())==null?void 0:e.signMessage(t)},parseUnits(t,e){var n;return(n=Ve._getClient())==null?void 0:n.parseUnits(t,e)},formatUnits(t,e){var n;return(n=Ve._getClient())==null?void 0:n.formatUnits(t,e)},updateBalance(t){var e;return(e=Ve._getClient())==null?void 0:e.updateBalance(t)},async sendTransaction(t){var e;return(e=Ve._getClient())==null?void 0:e.sendTransaction(t)},async getCapabilities(t){var e;return(e=Ve._getClient())==null?void 0:e.getCapabilities(t)},async grantPermissions(t){var e;return(e=Ve._getClient())==null?void 0:e.grantPermissions(t)},async walletGetAssets(t){var e;return((e=Ve._getClient())==null?void 0:e.walletGetAssets(t))??{}},async estimateGas(t){var e;return(e=Ve._getClient())==null?void 0:e.estimateGas(t)},async writeContract(t){var e;return(e=Ve._getClient())==null?void 0:e.writeContract(t)},async getEnsAddress(t){var e;return(e=Ve._getClient())==null?void 0:e.getEnsAddress(t)},async getEnsAvatar(t){var e;return(e=Ve._getClient())==null?void 0:e.getEnsAvatar(t)},checkInstalled(t){var e,n;return((n=(e=Ve._getClient())==null?void 0:e.checkInstalled)==null?void 0:n.call(e,t))||!1},resetWcConnection(){ii.wcUri=void 0,ii.wcPairingExpiry=void 0,ii.wcLinking=void 0,ii.recentWallet=void 0,ii.wcFetchingUri=!1,ii.status="disconnected",sa.resetTransactions(),He.deleteWalletConnectDeepLink(),He.deleteRecentWallet(),Uc.set({connectingWallet:void 0})},resetUri(){ii.wcUri=void 0,ii.wcPairingExpiry=void 0,fm=void 0,ii.wcFetchingUri=!1,Uc.set({connectingWallet:void 0})},finalizeWcConnection(t){var i,s;const{wcLinking:e,recentWallet:n}=Ve.state;e&&He.setWalletConnectDeepLink(e),n&&He.setAppKitRecent(n),t&&Et.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:t,properties:{method:e?"mobile":"qrcode",name:((s=(i=Pe.state.data)==null?void 0:i.wallet)==null?void 0:s.name)||"Unknown",view:Pe.state.view,walletRank:n==null?void 0:n.order}})},setWcBasic(t){ii.wcBasic=t},setUri(t){ii.wcUri=t,ii.wcFetchingUri=!1,ii.wcPairingExpiry=Ue.getPairingExpiry()},setWcLinking(t){ii.wcLinking=t},setWcError(t){ii.wcError=t,ii.wcFetchingUri=!1,ii.buffering=!1},setRecentWallet(t){ii.recentWallet=t},setBuffering(t){ii.buffering=t},setStatus(t){ii.status=t},setIsSwitchingConnection(t){ii.isSwitchingConnection=t},async disconnect({id:t,namespace:e,initialDisconnect:n}={}){var i;try{await((i=Ve._getClient())==null?void 0:i.disconnect({id:t,chainNamespace:e,initialDisconnect:n}))}catch(s){throw new Md("Failed to disconnect","INTERNAL_SDK_ERROR",s)}},async disconnectConnector({id:t,namespace:e}){var n;try{await((n=Ve._getClient())==null?void 0:n.disconnectConnector({id:t,namespace:e}))}catch(i){throw new Md("Failed to disconnect connector","INTERNAL_SDK_ERROR",i)}},setConnections(t,e){const n=new Map(ii.connections);n.set(e,t),ii.connections=n},async handleAuthAccountSwitch({address:t,namespace:e}){var r,o;const n=ne.getAccountData(e),i=(o=(r=n==null?void 0:n.user)==null?void 0:r.accounts)==null?void 0:o.find(a=>a.type==="smartAccount"),s=i&&i.address.toLowerCase()===t.toLowerCase()&&Av.canSwitchToSmartAccount(e)?"smartAccount":"eoa";await Ve.setPreferredAccountType(s,e)},async handleActiveConnection({connection:t,namespace:e,address:n}){const i=Oe.getConnectorById(t.connectorId),s=t.connectorId===we.CONNECTOR_ID.AUTH;if(!i)throw new Error(`No connector found for connection: ${t.connectorId}`);if(s)n&&await Ve.handleAuthAccountSwitch({address:n,namespace:e});else{const r=await Ve.connectExternal({id:i.id,type:i.type,provider:i.provider,address:n,chain:e},e);return r==null?void 0:r.address}return n},async handleDisconnectedConnection({connection:t,namespace:e,address:n,closeModalOnConnect:i}){var l,d;
139const s=Oe.getConnectorById(t.connectorId),r=(d=(l=t.auth)==null?void 0:l.name)==null?void 0:d.toLowerCase(),o=t.connectorId===we.CONNECTOR_ID.AUTH,a=t.connectorId===we.CONNECTOR_ID.WALLET_CONNECT;if(!s)throw new Error(`No connector found for connection: ${t.connectorId}`);let c;if(o)if(r&&Av.isSocialProvider(r)){const{address:h}=await Av.connectSocial({social:r,closeModalOnConnect:i,onOpenFarcaster(){wn.open({view:"ConnectingFarcaster"})},onConnect(){Pe.replace("ProfileWallets")}});c=h}else{const{address:h}=await Av.connectEmail({closeModalOnConnect:i,onOpen(){wn.open({view:"EmailLogin"})},onConnect(){Pe.replace("ProfileWallets")}});c=h}else if(a){const{address:h}=await Av.connectWalletConnect({walletConnect:!0,connector:s,closeModalOnConnect:i,onOpen(p){const g=p?"AllWallets":"ConnectingWalletConnect";wn.state.open?Pe.push(g):wn.open({view:g})},onConnect(){Pe.replace("ProfileWallets")}});c=h}else{const h=await Ve.connectExternal({id:s.id,type:s.type,provider:s.provider,chain:e},e);h&&(c=h.address)}return o&&n&&await Ve.handleAuthAccountSwitch({address:n,namespace:e}),c},async switchConnection({connection:t,address:e,namespace:n,closeModalOnConnect:i,onChange:s}){var c;let r;const o=(c=ne.getAccountData(n))==null?void 0:c.caipAddress;if(o){const{address:l}=Lr.parseCaipAddress(o);r=l}const a=Oc.getConnectionStatus(t,n);switch(a){case"connected":case"active":{const l=await Ve.handleActiveConnection({connection:t,namespace:n,address:e});if(r&&l){const d=l.toLowerCase()!==r.toLowerCase();s==null||s({address:l,namespace:n,hasSwitchedAccount:d,hasSwitchedWallet:a==="active"})}break}case"disconnected":{const l=await Ve.handleDisconnectedConnection({connection:t,namespace:n,address:e,closeModalOnConnect:i});l&&(s==null||s({address:l,namespace:n,hasSwitchedAccount:!0,hasSwitchedWallet:!0}));break}default:throw new Error(`Invalid connection status: ${a}`)}}},Ve=Yc(Vxe),ZT={createBalance(t,e){const n={name:t.metadata.name||"",symbol:t.metadata.symbol||"",decimals:t.metadata.decimals||0,value:t.metadata.value||0,price:t.metadata.price||0,iconUrl:t.metadata.iconUrl||""};return{name:n.name,symbol:n.symbol,chainId:e,address:t.address==="native"?void 0:this.convertAddressToCAIP10Address(t.address,e),value:n.value,price:n.price,quantity:{decimals:n.decimals.toString(),numeric:this.convertHexToBalance({hex:t.balance,decimals:n.decimals})},iconUrl:n.iconUrl}},convertHexToBalance({hex:t,decimals:e}){return dt(BigInt(t),e)},convertAddressToCAIP10Address(t,e){return`${e}:${t}`},createCAIP2ChainId(t,e){return`${e}:${parseInt(t,16)}`},getChainIdHexFromCAIP2ChainId(t){const e=t.split(":");if(e.length<2||!e[1])return"0x0";const n=e[1],i=parseInt(n,10);return isNaN(i)?"0x0":`0x${i.toString(16)}`},isWalletGetAssetsResponse(t){return typeof t!="object"||t===null?!1:Object.values(t).every(e=>Array.isArray(e)&&e.every(n=>this.isValidAsset(n)))},isValidAsset(t){return typeof t=="object"&&t!==null&&typeof t.address=="string"&&typeof t.balance=="string"&&(t.type==="ERC20"||t.type==="NATIVE")&&typeof t.metadata=="object"&&t.metadata!==null&&typeof t.metadata.name=="string"&&typeof t.metadata.symbol=="string"&&typeof t.metadata.decimals=="number"&&typeof t.metadata.price=="number"&&typeof t.metadata.iconUrl=="string"}};let QT;async function iW(){if(!QT){const{createPublicClient:t,http:e,defineChain:n}=await Lt(async()=>{const{createPublicClient:i,http:s,defineChain:r}=await import("./index-CKlc53wm.js").then(o=>o.i);return{createPublicClient:i,http:s,defineChain:r}},[]);QT={createPublicClient:t,http:e,defineChain:n}}return QT}const fP={getBlockchainApiRpcUrl(t,e){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",t),n.searchParams.set("projectId",e),n.toString()},async getViemChain(t){const{defineChain:e}=await iW(),{chainId:n}=Lr.parseCaipNetworkId(t.caipNetworkId);return e({...t,id:Number(n)})},async createViemPublicClient(t){const{createPublicClient:e,http:n}=await iW(),i=ye.state.projectId,s=await fP.getViemChain(t);if(!s)throw new Error(`Chain ${t.caipNetworkId} not found in viem/chains`);return e({chain:s,transport:n(fP.getBlockchainApiRpcUrl(t.caipNetworkId,i))})}},GO={async getMyTokensWithBalance(t){var a;const e=(a=ne.getAccountData())==null?void 0:a.address,n=ne.state.activeCaipNetwork,i=Oe.getConnectorId("eip155")===we.CONNECTOR_ID.AUTH;if(!e||!n)return[];const s=`${n.caipNetworkId}:${e}`,r=He.getBalanceCacheForCaipAddress(s);if(r)return r.balances;if(n.chainNamespace===we.CHAIN.EVM&&i){const c=await this.getEIP155Balances(e,n);if(c)return this.filterLowQualityTokens(c)}const o=await xn.getBalance(e,n.caipNetworkId,t);return this.filterLowQualityTokens(o.balances)},async getEIP155Balances(t,e){var n,i;try{const s=ZT.getChainIdHexFromCAIP2ChainId(e.caipNetworkId),r=await Ve.getCapabilities(t);if(!((i=(n=r==null?void 0:r[s])==null?void 0:n.assetDiscovery)!=null&&i.supported))return null;const o=await Ve.walletGetAssets({account:t,chainFilter:[s]});if(!ZT.isWalletGetAssetsResponse(o))return null;
139const c=(o[s]||[]).map(l=>ZT.createBalance(l,e.caipNetworkId));return He.updateBalanceCache({caipAddress:`${e.caipNetworkId}:${t}`,balance:{balances:c},timestamp:Date.now()}),c}catch{return null}},filterLowQualityTokens(t){return t.filter(e=>e.quantity.decimals!=="0")},async fetchERC20Balance({caipAddress:t,assetAddress:e,caipNetwork:n}){const i=await fP.createViemPublicClient(n),{address:s}=Lr.parseCaipAddress(t),[{result:r},{result:o},{result:a},{result:c}]=await i.multicall({contracts:[{address:e,functionName:"name",args:[],abi:Ks},{address:e,functionName:"symbol",args:[],abi:Ks},{address:e,functionName:"balanceOf",args:[s],abi:Ks},{address:e,functionName:"decimals",args:[],abi:Ks}]});return{name:r,symbol:o,decimals:c,balance:a&&c?dt(a,c):"0"}}},XT={adapters:{}},Hte={state:XT,initialize(t){XT.adapters={...t}},get(t){return XT.adapters[t]}},f_={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:void 0},Ia=Hi({providers:{...f_},providerIds:{...f_}}),ss={state:Ia,subscribeKey(t,e){return ar(Ia,t,e)},subscribe(t){return or(Ia,()=>{t(Ia)})},subscribeProviders(t){return or(Ia.providers,()=>t(Ia.providers))},setProvider(t,e){t&&e&&(Ia.providers[t]=eb(e))},getProvider(t){if(t)return Ia.providers[t]},setProviderId(t,e){e&&(Ia.providerIds[t]=e)},getProviderId(t){if(t)return Ia.providerIds[t]},reset(){Ia.providers={...f_},Ia.providerIds={...f_}},resetChain(t){Ia.providers[t]=void 0,Ia.providerIds[t]=void 0}},Wxe={async getTokenList(t){var i;const e=await xn.fetchSwapTokens({chainId:t});return((i=e==null?void 0:e.tokens)==null?void 0:i.map(s=>({...s,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){var e;const t=ne.state.activeCaipNetwork;if(!t)return null;try{switch(t.chainNamespace){case"solana":const n=(e=await(Ve==null?void 0:Ve.estimateGas({chainNamespace:"solana"})))==null?void 0:e.toString();return{standard:n,fast:n,instant:n};case"eip155":default:return await xn.fetchGasPrice({chainId:t.caipNetworkId})}}catch{return null}},async fetchSwapAllowance({tokenAddress:t,userAddress:e,sourceTokenAmount:n,sourceTokenDecimals:i}){const s=await xn.fetchSwapAllowance({tokenAddress:t,userAddress:e});if(s!=null&&s.allowance&&n&&i){const r=Ve.parseUnits(n,i)||0;return BigInt(s.allowance)>=r}return!1},async getMyTokensWithBalance(t){const e=await GO.getMyTokensWithBalance(t);return ne.setAccountProp("tokenBalance",e,ne.state.activeChain),this.mapBalancesToSwapTokens(e)},mapBalancesToSwapTokens(t){return(t==null?void 0:t.map(e=>({...e,address:e!=null&&e.address?e.address:h_(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1})))||[]},async handleSwapError(t){var e,n;try{const i=t==null?void 0:t.cause;if(!(i!=null&&i.json))return;const s=await i.json(),r=(n=(e=s==null?void 0:s.reasons)==null?void 0:e[0])==null?void 0:n.description;return r!=null&&r.includes("insufficient liquidity")?"Insufficient liquidity":void 0}catch{return}}},vi=Hi({tokenBalances:[],loading:!1}),qxe={state:vi,subscribe(t){return or(vi,()=>t(vi))},subscribeKey(t,e){return ar(vi,t,e)},setToken(t){t&&(vi.token=eb(t))},setTokenAmount(t){vi.sendTokenAmount=t},setReceiverAddress(t){vi.receiverAddress=t},setReceiverProfileImageUrl(t){vi.receiverProfileImageUrl=t},setReceiverProfileName(t){vi.receiverProfileName=t},setNetworkBalanceInUsd(t){vi.networkBalanceInUSD=t},setLoading(t){vi.loading=t},getSdkEventProperties(t){var e,n;return{message:Ue.parseError(t),isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT,token:((e=vi.token)==null?void 0:e.symbol)||"",amount:vi.sendTokenAmount??0,network:((n=ne.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}},async sendToken(){var t;try{switch(ei.setLoading(!0),(t=ne.state.activeCaipNetwork)==null?void 0:t.chainNamespace){case"eip155":await ei.sendEvmToken();return;case"solana":await ei.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}catch(e){throw Ha.isUserRejectedRequestError(e)?new n2(e):e}finally{ei.setLoading(!1)}},async sendEvmToken(){var n,i,s;const t=ne.state.activeChain;if(!t)throw new Error("SendController:sendEvmToken - activeChainNamespace is required");const e=$s(t);if(!ei.state.sendTokenAmount||!ei.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!ei.state.token)throw new Error("A token is required");if((n=ei.state.token)!=null&&n.address){Et.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===Wi.A
139CCOUNT_TYPES.SMART_ACCOUNT,token:ei.state.token.address,amount:ei.state.sendTokenAmount,network:((i=ne.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||""}});const{hash:r}=await ei.sendERC20Token({receiverAddress:ei.state.receiverAddress,tokenAddress:ei.state.token.address,sendTokenAmount:ei.state.sendTokenAmount,decimals:ei.state.token.quantity.decimals});r&&(vi.hash=r)}else{Et.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:e===Wi.ACCOUNT_TYPES.SMART_ACCOUNT,token:ei.state.token.symbol||"",amount:ei.state.sendTokenAmount,network:((s=ne.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||""}});const{hash:r}=await ei.sendNativeToken({receiverAddress:ei.state.receiverAddress,sendTokenAmount:ei.state.sendTokenAmount,decimals:ei.state.token.quantity.decimals});r&&(vi.hash=r)}},async fetchTokenBalance(t){var o,a,c;vi.loading=!0;const e=ne.state.activeChain,n=(o=ne.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,i=(a=ne.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=((c=ne.getAccountData(e))==null?void 0:c.caipAddress)??ne.state.activeCaipAddress,r=s?Ue.getPlainAddress(s):void 0;if(vi.lastRetry&&!Ue.isAllowedRetry(vi.lastRetry,30*fn.ONE_SEC_MS))return vi.loading=!1,[];try{if(r&&n&&i){const l=await GO.getMyTokensWithBalance();return vi.tokenBalances=l,vi.lastRetry=void 0,l}}catch(l){vi.lastRetry=Date.now(),t==null||t(l),ti.showError("Token Balance Unavailable")}finally{vi.loading=!1}return[]},fetchNetworkBalance(){if(vi.tokenBalances.length===0)return;const t=Wxe.mapBalancesToSwapTokens(vi.tokenBalances);if(!t)return;const e=t.find(n=>n.address===h_());e&&(vi.networkBalanceInUSD=e?u5.multiply(e.quantity.numeric,e.price).toString():"0")},async sendNativeToken(t){var o,a,c,l;Pe.pushTransactionStack({});const e=t.receiverAddress,n=(o=ne.getAccountData())==null?void 0:o.address,i=Ve.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals)),r=await Ve.sendTransaction({chainNamespace:we.CHAIN.EVM,to:e,address:n,data:"0x",value:i??BigInt(0)});return Et.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:$s("eip155")===Wi.ACCOUNT_TYPES.SMART_ACCOUNT,token:((a=ei.state.token)==null?void 0:a.symbol)||"",amount:t.sendTokenAmount,network:((c=ne.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",hash:r||""}}),(l=Ve._getClient())==null||l.updateBalance("eip155"),ei.resetSend(),{hash:r}},async sendERC20Token(t){var i,s,r;Pe.pushTransactionStack({onSuccess(){Pe.replace("Account")}});const e=Ve.parseUnits(t.sendTokenAmount.toString(),Number(t.decimals)),n=(i=ne.getAccountData())==null?void 0:i.address;if(n&&t.sendTokenAmount&&t.receiverAddress&&t.tokenAddress){const o=Ue.getPlainAddress(t.tokenAddress);if(!o)throw new Error("SendController:sendERC20Token - tokenAddress is required");const a=await Ve.writeContract({fromAddress:n,tokenAddress:o,args:[t.receiverAddress,e??BigInt(0)],method:"transfer",abi:b6e.getERC20Abi(o),chainNamespace:we.CHAIN.EVM});return Et.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:$s("eip155")===Wi.ACCOUNT_TYPES.SMART_ACCOUNT,token:((s=ei.state.token)==null?void 0:s.symbol)||"",amount:t.sendTokenAmount,network:((r=ne.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||"",hash:a||""}}),ei.resetSend(),{hash:a}}return{hash:void 0}},async sendSolanaToken(){var n,i,s;if(!ei.state.sendTokenAmount||!ei.state.receiverAddress)throw new Error("An amount and receiver address are required");Pe.pushTransactionStack({onSuccess(){Pe.replace("Account")}});let t;ei.state.token&&ei.state.token.address!==fn.SOLANA_NATIVE_TOKEN_ADDRESS&&(Ue.isCaipAddress(ei.state.token.address)?t=Ue.getPlainAddress(ei.state.token.address):t=ei.state.token.address);const e=await Ve.sendTransaction({chainNamespace:"solana",tokenMint:t,to:ei.state.receiverAddress,value:ei.state.sendTokenAmount});e&&(vi.hash=e),(n=Ve._getClient())==null||n.updateBalance("solana"),Et.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:!1,token:((i=ei.state.token)==null?void 0:i.symbol)||"",amount:ei.state.sendTokenAmount,network:((s=ne.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||"",hash:e||""}}),ei.resetSend()},resetSend(){vi.token=void 0,vi.sendTokenAmount=void 0,vi.receiverAddress=void 0,vi.receiverProfileImageUrl=void 0,vi.receiverProfileName=void 0,vi.loading=!1,vi.tokenBalances=[]}},ei=Yc(qxe),JT={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,user:void 0,preferredAccountType:void 0},ix={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},Tt=Hi({chains:W5e(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter
139:{connectionControllerClient:void 0},isSwitchingNamespace:!1}),Gte={state:Tt,subscribe(t){return or(Tt,()=>{t(Tt)})},subscribeKey(t,e){return ar(Tt,t,e)},subscribeAccountStateProp(t,e,n){var s;const i=n||Tt.activeChain;return i?ar(((s=Tt.chains.get(i))==null?void 0:s.accountState)||{},t,e):()=>{}},subscribeChainProp(t,e,n){let i;return or(Tt.chains,()=>{var r;const s=n||Tt.activeChain;if(s){const o=(r=Tt.chains.get(s))==null?void 0:r[t];i!==o&&(i=o,e(o))}})},initialize(t,e,n){const{chainId:i,namespace:s}=He.getActiveNetworkProps(),r=e==null?void 0:e.find(d=>d.id.toString()===(i==null?void 0:i.toString())),a=t.find(d=>(d==null?void 0:d.namespace)===s)||(t==null?void 0:t[0]),c=t.map(d=>d.namespace).filter(d=>d!==void 0),l=ye.state.enableEmbedded?new Set([...c]):new Set([...(e==null?void 0:e.map(d=>d.chainNamespace))??[]]);((t==null?void 0:t.length)===0||!a)&&(Tt.noAdapters=!0),Tt.noAdapters||(Tt.activeChain=a==null?void 0:a.namespace,Tt.activeCaipNetwork=r,ne.setChainNetworkData(a==null?void 0:a.namespace,{caipNetwork:r}),Tt.activeChain&&Uc.set({activeChain:a==null?void 0:a.namespace})),l.forEach(d=>{const h=e==null?void 0:e.filter(b=>b.chainNamespace===d),p=He.getPreferredAccountTypes()||{},g={...ye.state.defaultAccountTypes,...p};ne.state.chains.set(d,{namespace:d,networkState:Hi({...ix,caipNetwork:h==null?void 0:h[0]}),accountState:Hi({...JT,preferredAccountType:g[d]}),caipNetworks:h??[],...n}),ne.setRequestedCaipNetworks(h??[],d)})},removeAdapter(t){var e,n;if(Tt.activeChain===t){const i=Array.from(Tt.chains.entries()).find(([s])=>s!==t);if(i){const s=(n=(e=i[1])==null?void 0:e.caipNetworks)==null?void 0:n[0];s&&ne.setActiveCaipNetwork(s)}}Tt.chains.delete(t)},addAdapter(t,{connectionControllerClient:e},n){if(!t.namespace)throw new Error("ChainController:addAdapter - adapter must have a namespace");Tt.chains.set(t.namespace,{namespace:t.namespace,networkState:{...ix,caipNetwork:n[0]},accountState:{...JT},caipNetworks:n,connectionControllerClient:e}),ne.setRequestedCaipNetworks((n==null?void 0:n.filter(i=>i.chainNamespace===t.namespace))??[],t.namespace)},addNetwork(t){var n;const e=Tt.chains.get(t.chainNamespace);if(e){const i=[...e.caipNetworks||[]];(n=e.caipNetworks)!=null&&n.find(s=>s.id===t.id)||i.push(t),Tt.chains.set(t.chainNamespace,{...e,caipNetworks:i}),ne.setRequestedCaipNetworks(i,t.chainNamespace),Oe.filterByNamespace(t.chainNamespace,!0)}},removeNetwork(t,e){var i,s,r;const n=Tt.chains.get(t);if(n){const o=((i=Tt.activeCaipNetwork)==null?void 0:i.id)===e,a=[...((s=n.caipNetworks)==null?void 0:s.filter(c=>c.id!==e))||[]];o&&((r=n==null?void 0:n.caipNetworks)!=null&&r[0])&&ne.setActiveCaipNetwork(n.caipNetworks[0]),Tt.chains.set(t,{...n,caipNetworks:a}),ne.setRequestedCaipNetworks(a||[],t),a.length===0&&Oe.filterByNamespace(t,!1)}},setAdapterNetworkState(t,e){const n=Tt.chains.get(t);n&&(n.networkState={...n.networkState||ix,...e},Tt.chains.set(t,n))},setChainAccountData(t,e,n=!0){if(!t)throw new Error("Chain is required to update chain account data");const i=Tt.chains.get(t);if(i){const s={...i.accountState||JT,...e};Tt.chains.set(t,{...i,accountState:s}),(Tt.chains.size===1||Tt.activeChain===t)&&e.caipAddress&&(Tt.activeCaipAddress=e.caipAddress)}},setChainNetworkData(t,e){if(!t)return;const n=Tt.chains.get(t);if(n){const i={...n.networkState||ix,...e};Tt.chains.set(t,{...n,networkState:i})}},setAccountProp(t,e,n,i=!0){ne.setChainAccountData(n,{[t]:e},i)},setActiveNamespace(t){var i,s;Tt.activeChain=t;const e=t?Tt.chains.get(t):void 0,n=(i=e==null?void 0:e.networkState)==null?void 0:i.caipNetwork;n!=null&&n.id&&t&&(Tt.activeCaipAddress=(s=e==null?void 0:e.accountState)==null?void 0:s.caipAddress,Tt.activeCaipNetwork=n,ne.setChainNetworkData(t,{caipNetwork:n}),He.setActiveCaipNetworkId(n==null?void 0:n.caipNetworkId),Uc.set({activeChain:t,selectedNetworkId:n==null?void 0:n.caipNetworkId}))},setActiveCaipNetwork(t){var r,o;if(!t)return;const e=Tt.activeChain===t.chainNamespace;e||ne.setIsSwitchingNamespace(!0);const n=Tt.chains.get(t.chainNamespace);Tt.activeChain=t.chainNamespace,Tt.activeCaipNetwork=t,ne.setChainNetworkData(t.chainNamespace,{caipNetwork:t});let i=(r=n==null?void 0:n.accountState)==null?void 0:r.address;if(i)Tt.activeCaipAddress=`${t.chainNamespace}:${t.id}:${i}`;else if(e&&Tt.activeCaipAddress){const{address:a}=Lr.parseCaipAddress(Tt.activeCaipAddress);i=a,Tt.activeCaipAddress=`${t.caipNetworkId}:${i}`}else Tt.activeCaipAddress=void 0;ne.setChainAccountData(t.chainNamespace,{address:i,caipAddress:Tt.activeCaipAddress}),ei.resetSend(),Uc.set({activeChain:Tt.activeChain,selectedNetworkId:(o=Tt.activeCaipNetwork)==null?void 0:o.caipNetworkId}),He.setActiveCaipNetworkId(t.caipNetworkId),!ne.checkIfSupportedNetwork(t.chainNamespace)&&ye.state.enableNetworkSwitch&&!ye.state.allowUnsupportedChain&&!Ve.state.wcBasic&&ne.showUnsupportedChainUI()},addCaipNetwork(t){var n;if(!t)return;const e=Tt.chains.get(t.chainNamespace);e&&((n=e==null?void 0:e.caipNetworks)==null||n.push(t))},async switchActiveNamespace(t){var s;if(!t)return;const e=t!==ne.state.activeChain,n=(s=ne.getNetworkData(t))==null?void 0:s.caipNetwork,i=ne.getCaipNetworkByNamespace(t,n==null?void 0:n.id);e&&i&&await ne.switchActiveNetwork(i)},async switchActiveNetwork(t,{throwOnFailure:e=!1}={}){var o;const n=ne.state.activeChain;if(!n)throw new Error("ChainController:switchActiveNetwork - namespace is required");const i=ss.getProviderId(Tt.activeChain)==="AUTH",s=(o=ne.getAccountData(n))==null?void 0:o.address,r=we.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(t.chainNamespace);try{if(s&&t.chainNamespace===n||i&&r){const a=Hte.get(t.chainNamespace);if(!a)throw new Error("Adapter not found");await a.switchNetwork({caipNetwork:t})}ne.setActiveCaipNetwork(t)}catch(a){if(e)throw a}Et.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:t.caipNetworkId}})},getConnectionControllerClient(t){const e=t||Tt.activeChain;if(!e)throw new Error("Chain is required to get connection controller client");const n=Tt.chains.get(e);if(!(n!=null&&n.connectionControllerClient))throw new Error("ConnectionController client not set");return n.connectionControllerClient},getNetworkProp(t,e){var i;const n=(i=Tt.chains.get(e))==null?void 0:i.networkState;if(n)return n[t]},getRequestedCaipNetworks(t){const e=Tt.chains.get(t),{approvedCaipNetworkIds:n=[],requestedCaipNetworks:i=[]}=(e==null?void 0:e.networkState)||{};return Ue.sortRequestedNetworks(n,i).filter(o=>o==null?void 0:o.id)},getAllRequestedCaipNetworks(){const t=[];
139return Tt.chains.forEach(e=>{if(!e.namespace)throw new Error("ChainController:getAllRequestedCaipNetworks - chainAdapter must have a namespace");const n=ne.getRequestedCaipNetworks(e.namespace);t.push(...n)}),t},setRequestedCaipNetworks(t,e){ne.setAdapterNetworkState(e,{requestedCaipNetworks:t});const i=ne.getAllRequestedCaipNetworks().map(r=>r.chainNamespace),s=Array.from(new Set(i));Oe.filterByNamespaces(s)},getAllApprovedCaipNetworkIds(){const t=[];return Tt.chains.forEach(e=>{if(!e.namespace)throw new Error("ChainController:getAllApprovedCaipNetworkIds - chainAdapter must have a namespace");const n=ne.getApprovedCaipNetworkIds(e.namespace);t.push(...n)}),t},getActiveCaipNetwork(t){var e,n;return t?(n=(e=Tt.chains.get(t))==null?void 0:e.networkState)==null?void 0:n.caipNetwork:Tt.activeCaipNetwork},getActiveCaipAddress(){return Tt.activeCaipAddress},getApprovedCaipNetworkIds(t){var i;const e=Tt.chains.get(t);return((i=e==null?void 0:e.networkState)==null?void 0:i.approvedCaipNetworkIds)||[]},setApprovedCaipNetworksData(t,e){ne.setAdapterNetworkState(t,e)},checkIfSupportedNetwork(t,e){var s;const n=e||((s=Tt.activeCaipNetwork)==null?void 0:s.caipNetworkId),i=ne.getRequestedCaipNetworks(t);return i.length?i==null?void 0:i.some(r=>r.caipNetworkId===n):!0},checkIfSupportedChainId(t){if(!Tt.activeChain)return!0;const e=ne.getRequestedCaipNetworks(Tt.activeChain);return e==null?void 0:e.some(n=>n.id===t)},checkIfSmartAccountEnabled(){var i,s;const t=l5.caipNetworkIdToNumber((i=Tt.activeCaipNetwork)==null?void 0:i.caipNetworkId);if(!Tt.activeChain||!t)return!1;const n=((s=Rr.get(Wt.SMART_ACCOUNT_ENABLED_NETWORKS))==null?void 0:s.split(","))||[];return!!(n!=null&&n.includes(t.toString()))},showUnsupportedChainUI(){wn.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const t=Tt.activeCaipNetwork;return!!(t!=null&&t.chainNamespace&&fn.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(t.chainNamespace))},resetNetwork(t){ne.setAdapterNetworkState(t,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})},resetAccount(t){var s,r;const e=t;if(!e)throw new Error("Chain is required to set account prop");const n=(r=(s=ne.state.chains.get(e))==null?void 0:s.accountState)==null?void 0:r.preferredAccountType,i=ye.state.defaultAccountTypes[e];Tt.activeCaipAddress=void 0,ne.setChainAccountData(e,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:i||n,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,user:void 0,status:"disconnected"}),Oe.removeConnectorId(e)},setIsSwitchingNamespace(t){Tt.isSwitchingNamespace=t},getFirstCaipNetworkSupportsAuthConnector(){var n,i;const t=[];let e;if(Tt.chains.forEach(s=>{we.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(r=>r===s.namespace)&&s.namespace&&t.push(s.namespace)}),t.length>0){const s=t[0];return e=s?(i=(n=Tt.chains.get(s))==null?void 0:n.caipNetworks)==null?void 0:i[0]:void 0,e}},getAccountData(t){var n;const e=t||Tt.activeChain;if(e)return(n=ne.state.chains.get(e))==null?void 0:n.accountState},getNetworkData(t){var n;const e=t||Tt.activeChain;if(e)return(n=ne.state.chains.get(e))==null?void 0:n.networkState},getCaipNetworkByNamespace(t,e){var s,r,o;if(!t)return;const n=ne.state.chains.get(t),i=(s=n==null?void 0:n.caipNetworks)==null?void 0:s.find(a=>a.id.toString()===(e==null?void 0:e.toString()));return i||((r=n==null?void 0:n.networkState)==null?void 0:r.caipNetwork)||((o=n==null?void 0:n.caipNetworks)==null?void 0:o[0])},getRequestedCaipNetworkIds(){const t=Oe.state.filterByNamespace;return(t?[Tt.chains.get(t)]:Array.from(Tt.chains.values())).flatMap(n=>(n==null?void 0:n.caipNetworks)||[]).map(n=>n.caipNetworkId)},getCaipNetworks(t){return t?ne.getRequestedCaipNetworks(t):ne.getAllRequestedCaipNetworks()},getCaipNetworkById(t,e){return Gte.getCaipNetworks(e).find(n=>n.id.toString()===t.toString()||n.caipNetworkId.toString()===t.toString())},setLastConnectedSIWECaipNetwork(t){Tt.lastConnectedSIWECaipNetwork=t},getLastConnectedSIWECaipNetwork(){return Tt.lastConnectedSIWECaipNetwork},async fetchTokenBalance(t){var o,a;const e=ne.getAccountData();if(!e)return[];const n=(o=ne.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,i=(a=ne.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=ne.state.activeCaipAddress,r=s?Ue.getPlainAddress(s):void 0;if(ne.setAccountProp("balanceLoading",!0,i),e.lastRetry&&!Ue.isAllowedRetry(e.lastRetry,30*fn.ONE_SEC_MS))return ne.setAccountProp("balanceLoading",!1,i),[];try{if(r&&n&&i){const c=await GO.getMyTokensWithBalance();return ne.setAccountProp("tokenBalance",c,i),ne.setAccountProp("lastRetry",void 0,i),ne.setAccountProp("balanceLoading",!1,i),c}}catch(c){ne.setAccountProp("lastRetry",Date.now(),i),t==null||t(c),ti.showError("Token Balance Unavailable")}finally{ne.setAccountProp("balanceLoading",!1,i)}return[]},isCaipNetworkDisabled(t){var c;const e=t.chainNamespace,n=!!((c=ne.getAccountData(e))!=null&&c.caipAddress),i=ne.getAllApprovedCaipNetworkIds(),s=ne.getNetworkProp("supportsAllNetworks",e)!==!1,r=Oe.getConnectorId(e),o=Oe.getAuthConnector(),a=r===we.CONNECTOR_ID.AUTH&&o;return!n||s||a?!1:!(i!=null&&i.includes(t.caipNetworkId))}},ne=Yc(Gte),Kte={onSwitchNetwork({network:t,ignoreSwitchConfirmation:e=!1}){var p,g;const n=ne.state.activeCaipNetwork,i=ne.state.activeChain,s=Pe.state.data;if(t.id===(n==null?void 0:n.id))return;const o=!!((p=ne.getAccountData(i))!=null&&p.address),a=!!((g=ne.getAccountData(t.chainNamespace))!=null&&g.address),c=t.chainNamespace!==i,d=Oe.getConnectorId(i)===we.CONNECTOR_ID.AUTH,h=we.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(b=>b===t.chainNamespace);e||d&&h?Pe.push("SwitchNetwork",{...s,network:t}):o&&c&&!a?Pe.push("SwitchActiveChain",{switchToChain:t.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:t}):Pe.push("SwitchNetwork",{...s,network:t})}},Da=Hi({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}
139),zxe={state:Da,subscribe(t){return or(Da,()=>t(Da))},subscribeKey(t,e){return ar(Da,t,e)},async open(t){var o,a;const e=t==null?void 0:t.namespace,n=ne.state.activeChain,i=e&&e!==n,s=(o=ne.getAccountData(t==null?void 0:t.namespace))==null?void 0:o.caipAddress,r=ne.state.noAdapters;if(Ve.state.wcBasic?ut.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1}):await ut.prefetch(),Oe.setFilterByNamespace(t==null?void 0:t.namespace),wn.setLoading(!0,e),e&&i){const c=((a=ne.getNetworkData(e))==null?void 0:a.caipNetwork)||ne.getRequestedCaipNetworks(e)[0];c&&(r?(await ne.switchActiveNetwork(c),Pe.push("ConnectingWalletConnectBasic")):Kte.onSwitchNetwork({network:c,ignoreSwitchConfirmation:!0}))}else ye.state.manualWCControl||r&&!s?Ue.isMobile()?Pe.reset("AllWallets"):Pe.reset("ConnectingWalletConnectBasic"):t!=null&&t.view?Pe.reset(t.view,t.data):s?Pe.reset("Account"):Pe.reset("Connect");Da.open=!0,Uc.set({open:!0}),Et.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!s}})},close(){const t=ye.state.enableEmbedded,e=!!ne.state.activeCaipAddress;Da.open&&Et.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:e}}),Da.open=!1,Pe.reset("Connect"),wn.clearLoading(),t?e?Pe.replace("Account"):Pe.push("Connect"):Uc.set({open:!1}),Ve.resetUri()},setLoading(t,e){e&&Da.loadingNamespaceMap.set(e,t),Da.loading=t,Uc.set({loading:t})},clearLoading(){Da.loadingNamespaceMap.clear(),Da.loading=!1,Uc.set({loading:!1})},shake(){Da.shake||(Da.shake=!0,setTimeout(()=>{Da.shake=!1},500))}},wn=Yc(zxe),d3={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},pP={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},Hxe={providers:Pte,selectedProvider:null,error:null,purchaseCurrency:d3,paymentCurrency:pP,purchaseCurrencies:[d3],paymentCurrencies:[],quotesLoading:!1},Ei=Hi(Hxe),Gxe={state:Ei,subscribe(t){return or(Ei,()=>t(Ei))},subscribeKey(t,e){return ar(Ei,t,e)},setSelectedProvider(t){var e,n;if(t&&t.name==="meld"){const i=ne.state.activeChain,s=i===we.CHAIN.SOLANA?"SOL":"USDC",r=i?((n=(e=ne.state.chains.get(i))==null?void 0:e.accountState)==null?void 0:n.address)??"":"",o=new URL(t.url);o.searchParams.append("publicKey",C6e),o.searchParams.append("destinationCurrencyCode",s),o.searchParams.append("walletAddress",r),o.searchParams.append("externalCustomerId",ye.state.projectId),Ei.selectedProvider={...t,url:o.toString()}}else Ei.selectedProvider=t},setOnrampProviders(t){if(Array.isArray(t)&&t.every(e=>typeof e=="string")){const e=t,n=Pte.filter(i=>e.includes(i.name));Ei.providers=n}else Ei.providers=[]},setPurchaseCurrency(t){Ei.purchaseCurrency=t},setPaymentCurrency(t){Ei.paymentCurrency=t},setPurchaseAmount(t){mP.state.purchaseAmount=t},setPaymentAmount(t){mP.state.paymentAmount=t},async getAvailableCurrencies(){const t=await xn.getOnrampOptions();Ei.purchaseCurrencies=t.purchaseCurrencies,Ei.paymentCurrencies=t.paymentCurrencies,Ei.paymentCurrency=t.paymentCurrencies[0]||pP,Ei.purchaseCurrency=t.purchaseCurrencies[0]||d3,await ut.fetchCurrencyImages(t.paymentCurrencies.map(e=>e.id)),await ut.fetchTokenImages(t.purchaseCurrencies.map(e=>e.symbol))},async getQuote(){var t,e;Ei.quotesLoading=!0;try{const n=await xn.getOnrampQuote({purchaseCurrency:Ei.purchaseCurrency,paymentCurrency:Ei.paymentCurrency,amount:((t=Ei.paymentAmount)==null?void 0:t.toString())||"0",network:(e=Ei.purchaseCurrency)==null?void 0:e.symbol});return Ei.quotesLoading=!1,Ei.purchaseAmount=Number(n==null?void 0:n.purchaseAmount.amount),n}catch(n){return Ei.error=n.message,Ei.quotesLoading=!1,null}finally{Ei.quotesLoading=!1}},resetState(){Ei.selectedProvider=null,Ei.error=null,Ei.purchaseCurrency=d3,Ei.paymentCurrency=pP,Ei.purchaseCurrencies=[d3],Ei.paymentCurrencies=[],Ei.paymentAmount=void 0,Ei.purchaseAmount=void 0,Ei.quotesLoading=!1}},mP=Yc(Gxe);var sx={exports:{}},sW;function Kxe(){if(sW)return sx.exports;sW=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(R,P,B){return Function.prototype.apply.call(R,P,B)},n;t&&typeof t.ownKeys=="function"?n=t.ownKeys:Object.getOwnPropertySymbols?n=function(R){return Object.getOwnPropertyNames(R).concat(Object.getOwnPropertySymbols(R)
vendor: 12,578 bytes, lines 139-152
139)}:n=function(R){return Object.getOwnPropertyNames(R)};function i(k){console&&console.warn&&console.warn(k)}var s=Number.isNaN||function(R){return R!==R};function r(){r.init.call(this)}sx.exports=r,sx.exports.once=E,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var o=10;function a(k){if(typeof k!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof k)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(k){if(typeof k!="number"||k<0||s(k))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+k+".");o=k}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(R){if(typeof R!="number"||R<0||s(R))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+R+".");return this._maxListeners=R,this};function c(k){return k._maxListeners===void 0?r.defaultMaxListeners:k._maxListeners}r.prototype.getMaxListeners=function(){return c(this)},r.prototype.emit=function(R){for(var P=[],B=1;B<arguments.length;B++)P.push(arguments[B]);var F=R==="error",z=this._events;if(z!==void 0)F=F&&z.error===void 0;else if(!F)return!1;if(F){var K;if(P.length>0&&(K=P[0]),K instanceof Error)throw K;var q=new Error("Unhandled error."+(K?" ("+K.message+")":""));throw q.context=K,q}var G=z[R];if(G===void 0)return!1;if(typeof G=="function")e(G,this,P);else for(var I=G.length,S=b(G,I),B=0;B<I;++B)e(S[B],this,P);return!0};function l(k,R,P,B){var F,z,K;if(a(P),z=k._events,z===void 0?(z=k._events=Object.create(null),k._eventsCount=0):(z.newListener!==void 0&&(k.emit("newListener",R,P.listener?P.listener:P),z=k._events),K=z[R]),K===void 0)K=z[R]=P,++k._eventsCount;else if(typeof K=="function"?K=z[R]=B?[P,K]:[K,P]:B?K.unshift(P):K.push(P),F=c(k),F>0&&K.length>F&&!K.warned){K.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+K.length+" "+String(R)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=k,q.type=R,q.count=K.length,i(q)}return k}r.prototype.addListener=function(R,P){return l(this,R,P,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(R,P){return l(this,R,P,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(k,R,P){var B={fired:!1,wrapFn:void 0,target:k,type:R,listener:P},F=d.bind(B);return F.listener=P,B.wrapFn=F,F}r.prototype.once=function(R,P){return a(P),this.on(R,h(this,R,P)),this},r.prototype.prependOnceListener=function(R,P){return a(P),this.prependListener(R,h(this,R,P)),this},r.prototype.removeListener=function(R,P){var B,F,z,K,q;if(a(P),F=this._events,F===void 0)return this;if(B=F[R],B===void 0)return this;if(B===P||B.listener===P)--this._eventsCount===0?this._events=Object.create(null):(delete F[R],F.removeListener&&this.emit("removeListener",R,B.listener||P));else if(typeof B!="function"){for(z=-1,K=B.length-1;K>=0;K--)if(B[K]===P||B[K].listener===P){q=B[K].listener,z=K;break}if(z<0)return this;z===0?B.shift():w(B,z),B.length===1&&(F[R]=B[0]),F.removeListener!==void 0&&this.emit("removeListener",R,q||P)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(R){var P,B,F;if(B=this._events,B===void 0)return this;if(B.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):B[R]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete B[R]),this;if(arguments.length===0){var z=Object.keys(B),K;for(F=0;F<z.length;++F)K=z[F],K!=="removeListener"&&this.removeAllListeners(K);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(P=B[R],typeof P=="function")this.removeListener(R,P);else if(P!==void 0)for(F=P.length-1;F>=0;F--)this.removeListener(R,P[F]);return this};function p(k,R,P){var B=k._events;if(B===void 0)return[];var F=B[R];return F===void 0?[]:typeof F=="function"?P?[F.listener||F]:[F]:P?C(F):b(F,F.length)}r.prototype.listeners=function(R){return p(this,R,!0)},r.prototype.rawListeners=function(R){return p(this,R,!1)},r.listenerCount=function(k,R){return typeof k.listenerCount=="function"?k.listenerCount(R):g.call(k,R)},r.prototype.listenerCount=g;function g(k){var R=this._events;if(R!==void 0){var P=R[k];if(typeof P=="function")return 1;if(P!==void 0)return P.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function b(k,R){for(var P=new Array(R),B=0;B<R;++B)P[B]=k[B];return P}function w(k,R){for(;R+1<k.length;R++)k[R]=k[R+1];k.pop()}function C(k){for(var R=new Array(k.length),P=0;P<R.length;++P)R[P]=k[P].listener||k[P];return R}function E(k,R){return new Promise(function(P,B){function F(K){k.removeListener(R,z),B(K)}function z(){typeof k.removeListener=="function"&&k.removeListener("error",F),P([].slice.call(arguments))}A(k,R,z,{once:!0}),R!=="error"&&T(k,F,{once:!0})})}function T(k,R,P){typeof k.on=="function"&&A(k,"error",R,P)}function A(k,R,P,B){if(typeof k.on=="function")B.once?k.once(R,P):k.on(R,P);else if(typeof k.addEventListener=="function")k.addEventListener(R,function F(z){B.once&&k.removeEventListener(R,F),P(z)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof k)}return sx.exports}var Ul=Kxe();const KO=ya(Ul);var e7={};/*! ***************************************************************************** 140Copyright (c) Microsoft Corporation. 141 142Permission to use, copy, modify, and/or distribute this software for any 143purpose with or without fee is hereby granted. 144 145THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 146REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 147AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 148INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 149LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 150OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 151PERFORMANCE OF THIS SOFTWARE. 152***************************************************************************** */var gP=function(t,e){return gP=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},gP(t,e)};function Yxe(t,e){gP(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var yP=function(){return yP=Object.assign||function(e){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yP.apply(this,arguments)};function Zxe(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]]);return n}function Qxe(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r}function Xxe(t,e){return function(n,i){e(n,i,t)}}function Jxe(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function eEe(t,e,n,i){function s(r){return r instanceof n?r:new n(function(o){o(r)})}return new(n||(n=Promise))(function(r,o){function a(d){try{l(i.next(d))}catch(h){o(h)}}function c(d){try{l(i.throw(d))}catch(h){o(h)}}function l(d){d.done?r(d.value):s(d.value).then(a,c)}l((i=i.apply(t,e||[])).next())})}function tEe(t,e){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(d){return c([l,d])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,s&&(r=l[0]&2?s.return:l[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,l[1])).done)return r;switch(s=0,r&&(l=[l[0]&2,r.value]),l[0]){case 0:case 1:r=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,s=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){n.label=l[1];break}if(l[0]===6&&n.label<r[1]){n.label=r[1],r=l;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(l);break}r[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(d){l=[6,d],s=0}finally{i=r=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function nEe(t,e,n,i){i===void 0&&(i=n),t[i]=e[n]}function iEe(t,e){for(var n in t)n!=="default"&&!e.hasOwnProperty(n)&&(e[n]=t[n])}function bP(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Yte(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),s,r=[],o;try{for(;(e===void 0||e-- >0)&&!(s=i.next()).done;)r.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return r}function sEe(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Yte(arguments[e]));return t}function rEe(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var i=Array(t),s=0,e=0;e<n;e++)for(var r=arguments[e],o=0,a=r.length;o<a;o++,s++)i[s]=r[o];return i}function _5(t){return this instanceof _5?(this.v=t,this):new _5(t)}function oEe(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n.apply(t,e||[]),s,r=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(p){i[p]&&(s[p]=function(g){return new Promise(function(b,w){r.push([p,g,b,w])>1||a(p,g)})})}function a(p,g){try{c(i[p](g))}catch(b){h(r[0][3],b)}}function c(p){p.value instanceof _5?Promise.resolve(p.value.v).then(l,d):h(r[0][2],p)}function l(p){a("next",p)}function d(p){a("throw",p)}function h(p,g){p(g),r.shift(),r.length&&a(r[0][0],r[0][1])}}function aEe(t){var e,n;return e={},i("next"),i("throw",function(s){throw s}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(s,r){e[s]=t[s]?function(o){return(n=!n)?{value:_5(t[s](o)),done:s==="return"}:r?r(o):o}:r}}function cEe(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof bP=="function"?bP(t):t[Symbol.iterator](),n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n);function i(r){n[r]=t[r]&&function(o){return new Promise(function(a,c){o=t[r](o),s(a,c,o.done,o.value)})}}function s(r,o,a,c){Promise.resolve(c).then(function(l){r({value:l,done:a})},o)}}function lEe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function uEe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function dEe(t){return t&&t.__esModule?t:{default:t}}function hEe(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function fEe(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}const pEe=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return yP},__asyncDelegator:aEe,__asyncGenerator:oEe,__asyncValues:cEe,__await:_5,__awaiter:eEe,__classPrivateFieldGet:hEe,__classPrivateFieldSet:fEe,__createBinding:nEe,__decorate:Qxe,__exportStar:iEe,__extends:Yxe,__generator:tEe,__importDefault:dEe,__importStar:uEe,__makeTemplateOb
152ject:lEe,__metadata:Jxe,__param:Xxe,__read:Yte,__rest:Zxe,__spread:sEe,__spreadArrays:rEe,__values:bP},Symbol.toStringTag,{value:"Module"})),O6=VY(pEe);var t7={},Tv={},rW;function mEe(){if(rW)return Tv;rW=1,Object.defineProperty(Tv,"__esModule",{value:!0}),Tv.delay=void 0;function t(e){return new Promise(n=>{setTimeout(()=>{n(!0)},e)})}return Tv.delay=t,Tv}var pm={},n7={},mm={},oW;function gEe(){return oW||(oW=1,Object.defineProperty(mm,"__esModule",{value:!0}),mm.ONE_THOUSAND=mm.ONE_HUNDRED=void 0,mm.ONE_HUNDRED=100,mm.ONE_THOUSAND=1e3),mm}var i7={},aW;function yEe(){return aW||(aW=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365})(i7)),i7}var cW;function Zte(){return cW||(cW=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=O6;e.__exportStar(gEe(),t),e.__exportStar(yEe(),t)})(n7)),n7}var lW;function bEe(){if(lW)return pm;lW=1,Object.defineProperty(pm,"__esModule",{value:!0}),pm.fromMiliseconds=pm.toMiliseconds=void 0;const t=Zte();function e(i){return i*t.ONE_THOUSAND}pm.toMiliseconds=e;function n(i){return Math.floor(i/t.ONE_THOUSAND)}return pm.fromMiliseconds=n,pm}var uW;function wEe(){return uW||(uW=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=O6;e.__exportStar(mEe(),t),e.__exportStar(bEe(),t)})(t7)),t7}var ky={},dW;function vEe(){if(dW)return ky;dW=1,Object.defineProperty(ky,"__esModule",{value:!0}),ky.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(n){if(this.timestamps.has(n))throw new Error(`Watch already started for label: ${n}`);this.timestamps.set(n,{started:Date.now()})}stop(n){const i=this.get(n);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${n}`);const s=Date.now()-i.started;this.timestamps.set(n,{started:i.started,elapsed:s})}get(n){const i=this.timestamps.get(n);if(typeof i>"u")throw new Error(`No timestamp found for label: ${n}`);return i}elapsed(n){const i=this.get(n);return i.elapsed||Date.now()-i.started}}return ky.Watch=t,ky.default=t,ky}var s7={},kv={},hW;function CEe(){if(hW)return kv;hW=1,Object.defineProperty(kv,"__esModule",{value:!0}),kv.IWatch=void 0;class t{}return kv.IWatch=t,kv}var fW;function xEe(){return fW||(fW=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),O6.__exportStar(CEe(),t)})(s7)),s7}var pW;function EEe(){return pW||(pW=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=O6;e.__exportStar(wEe(),t),e.__exportStar(vEe(),t),e.__exportStar(xEe(),t),e.__exportStar(Zte(),t)})(e7)),e7}var wt=EEe();class C1{}let _Ee=class extends C1{constructor(e){super()}};const mW=wt.FIVE_SECONDS,x1={pulse:"heartbeat_pulse"};let SEe=class Qte extends _Ee{constructor(e){super(e),this.events=new Ul.EventEmitter,this.interval=mW,this.interval=(e==null?void 0:e.interval)||mW}static async init(e){const n=new Qte(e);return await n.init(),n}
vendor: 19,405 bytes, line 152
152async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),wt.toMiliseconds(this.interval))}pulse(){this.events.emit(x1.pulse)}};const AEe=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,TEe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,kEe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function NEe(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){REe(t);return}return e}function REe(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function rx(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const n=t.trim();if(n.length<=9)switch(n.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!kEe.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(AEe.test(t)||TEe.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,NEe)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function PEe(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Kr(t,...e){try{return PEe(t(...e))}catch(n){return Promise.reject(n)}}function IEe(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function DEe(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function dE(t){if(IEe(t))return String(t);if(DEe(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return dE(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const wP="base64:";function OEe(t){return typeof t=="string"?t:wP+$Ee(t)}function MEe(t){return typeof t!="string"||!t.startsWith(wP)?t:LEe(t.slice(wP.length))}function LEe(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function $Ee(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ua(t){var e;return t&&((e=t.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function UEe(...t){return Ua(t.join(":"))}function ox(t){return t=Ua(t),t?t+":":""}function BEe(t,e){if(e===void 0)return!0;let n=0,i=t.indexOf(":");for(;i>-1;)n++,i=t.indexOf(":",i+1);return n<=e}function FEe(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}const jEe="memory",VEe=()=>{const t=new Map;return{name:jEe,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,n){t.set(e,n)},setItemRaw(e,n){t.set(e,n)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function WEe(t={}){const e={mounts:{"":t.driver||VEe()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=l=>{for(const d of e.mountpoints)if(l.startsWith(d))return{base:d,relativeKey:l.slice(d.length),driver:e.mounts[d]};return{base:"",relativeKey:l,driver:e.mounts[""]}},i=(l,d)=>e.mountpoints.filter(h=>h.startsWith(l)||d&&l.startsWith(h)).map(h=>({relativeBase:l.length>h.length?l.slice(h.length):void 0,mountpoint:h,driver:e.mounts[h]})),s=(l,d)=>{if(e.watching){d=Ua(d);for(const h of e.watchListeners)h(l,d)}},r=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await gW(e.mounts[l],s,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,d,h)=>{const p=new Map,g=b=>{let w=p.get(b.base);return w||(w={driver:b.driver,base:b.base,items:[]},p.set(b.base,w)),w};for(const b of l){const w=typeof b=="string",C=Ua(w?b:b.key),E=w?void 0:b.value,T=w||!b.options?d:{...d,...b.options},A=n(C);g(A).items.push({key:C,value:E,relativeKey:A.relativeKey,options:T})}return Promise.all([...p.values()].map(b=>h(b))).then(b=>b.flat())},c={hasItem(l,d={}){l=Ua(l);const{relativeKey:h,driver:p}=n(l);return Kr(p.hasItem,h,d)},getItem(l,d={}){l=Ua(l);const{relativeKey:h,driver:p}=n(l);return Kr(p.getItem,h,d).then(g=>rx(g))},getItems(l,d={}){return a(l,d,h=>h.driver.getItems?Kr(h.driver.getItems,h.items.map(p=>({key:p.relativeKey,options:p.options})),d).then(p=>p.map(g=>({key:UEe(h.base,g.key),value:rx(g.value)}))):Promise.all(h.items.map(p=>Kr(h.driver.getItem,p.relativeKey,p.options).then(g=>({key:p.key,value:rx(g)})))))},getItemRaw(l,d={}){l=Ua(l);const{relativeKey:h,driver:p}=n(l);return p.getItemRaw?Kr(p.getItemRaw,h,d):Kr(p.getItem,h,d).then(g=>MEe(g))},async setItem(l,d,h={}){if(d===void 0)return c.removeItem(l);l=Ua(l);const{relativeKey:p,driver:g}=n(l);g.setItem&&(await Kr(g.setItem,p,dE(d),h),g.watch||s("update",l))},async setItems(l,d){await a(l,d,async h=>{if(h.driver.setItems)return Kr(h.driver.setItems,h.items.map(p=>({key:p.relativeKey,value:dE(p.value),options:p.options})),d);h.driver.setItem&&await Promise.all(h.items.map(p=>Kr(h.driver.setItem,p.relativeKey,dE(p.value),p.options)))})},async setItemRaw(l,d,h={}){if(d===void 0)return c.removeItem(l,h);l=Ua(l);const{relativeKey:p,driver:g}=n(l);if(g.setItemRaw)await Kr(g.setItemRaw,p,d,h);else if(g.setItem)await Kr(g.setItem,p,OEe(d),h);else return;g.watch||s("update",l)},async removeItem(l,d={}){typeof d=="boolean"&&(d={removeMeta:d}),l=Ua(l);const{relativeKey:h,driver:p}=n(l);p.removeItem&&(await Kr(p.removeItem,h,d),(d.removeMeta||d.removeMata)&&await Kr(p.removeItem,h+"$",d),p.watch||s("remove",l))},async getMeta(l,d={}){typeof d=="boolean"&&(d={nativeOnly:d}),l=Ua(l);const{relativeKey:h,driver:p}=n(l),g=Object.create(null);if(p.getMeta&&Object.assign(g,await Kr(p.getMeta,h,d)),!d.nativeOnly){const b=await Kr(p.getItem,h+"$",d).then(w=>rx(w));b&&typeof b=="object"&&(typeof b.atime=="string"&&(b.atime=new Date(b.atime)),typeof b.mtime=="string"&&(b.mtime=new Date(b.mtime)),Object.assign(g,b))}return g},setMeta(l,d,h={}){return this.setItem(l+"$",d,h)},removeMeta(l,d={}){return this.removeItem(l+"$",d)},async getKeys(l,d={}){var C;l=ox(l);const h=i(l,!0);let p=[];const g=[];let b=!0;for(const E of h){(C=E.driver.flags)!=null&&C.maxDepth||(b=!1);const T=await Kr(E.driver.getKeys,E.relativeBase,d);for(const A of T){const k=E.mountpoint+Ua(A);p.some(R=>k.startsWith(R))||g.push(k)}p=[E.mountpoint,...p.filter(A=>!A.startsWith(E.mountpoint))]}const w=d.maxDepth!==void 0&&!b;return g.filter(E=>(!w||BEe(E,d.maxDepth))&&FEe(E,l))},async clear(l,d={}){l=ox(l),await Promise.all(i(l,!1).map(async h=>{if(h.driver.clear)return Kr(h.driver.clear,h.relativeBase,d);if(h.driver.removeItem){const p=await h.driver.getKeys(h.relativeBase||"",d);return Promise.all(p.map(g=>h.driver.removeItem(g,d)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>yW(l)))},async watch(l){return await r(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(d=>d!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,d){if(l=ox(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((h,p)=>p.length-h.length)),e.mounts[l]=d,e.watching&&Promise.resolve(gW(d,s,l)).then(h=>{e.unwatch[l]=h}).catch(console.error),c},async unmount(l,d=!0){var h,p;l=ox(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&((p=(h=e.unwatch)[l])==null||p.call(h),delete e.unwatch[l]),d&&await yW(e.mounts[l]),e.mountpoints=e.mountpoints.filter(g=>g!==l),delete e.mounts[l])},getMount(l=""){l=Ua(l)+":";const d=n(l);return{driver:d.driver,base:d.base}},getMounts(l="",d={}){return l=Ua(l),i(l,d.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(l,d={})=>c.getKeys(l,d),get:(l,d={})=>c.getItem(l,d),set:(l,d,h={})=>c.setItem(l,d,h),has:(l,d={})=>c.hasItem(l,d),del:(l,d={})=>c.removeItem(l,d),remove:(l,d={})=>c.removeItem(l,d)};return c}function gW(t,e,n){return t.watch?t.watch((i,s)=>e(i,n+s)):()=>{}}async function yW(t){typeof t.dispose=="function"&&await Kr(t.dispose)}function E1(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Xte(t,e){let n;const i=()=>{if(n)return n;const s=indexedDB.open(t);return s.onupgradeneeded=()=>s.result.createObjectStore(e),n=E1(s),n.then(r=>{r.onclose=()=>n=void 0},()=>{}),n};return(s,r)=>i().then(o=>r(o.transaction(e,s).objectStore(e)))}let r7;function M6(){return r7||(r7=Xte("keyval-store","keyval")),r7}function bW(t,e=M6()){return e("readonly",n=>E1(n.get(t)))}function qEe(t,e,n=M6()){return n("readwrite",i=>(i.put(e,t),E1(i.transaction)))}function zEe(t,e=M6()){return e("readwrite",n=>(n.delete(t),E1(n.transaction)))}function HEe(t=M6()){return t("readwrite",e=>(e.clear(),E1(e.transaction)))}function GEe(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},E1(t.transaction)}function KEe(t=M6()){return t("readonly",e=>{if(e.getAllKeys)return E1(e.getAllKeys());const n=[];return GEe(e,i=>n.push(i.key)).then(()=>n)})}const YEe="idb-keyval";var ZEe=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",n=s=>e+s;let i;return t.dbName&&t.storeName&&(i=Xte(t.dbName,t.storeName)),{name:YEe,options:t,async hasItem(s){return!(typeof await bW(n(s),i)>"u")},async getItem(s){return await bW(n(s),i)??null},setItem(s,r){return qEe(n(s),r,i)},removeItem(s){return zEe(n(s),i)},getKeys(){return KEe(i)},clear(){return HEe(i)}}};const QEe="WALLET_CONNECT_V2_INDEXED_DB",XEe="keyvaluestorage";let JEe=class{constructor(){this.indexedDb=WEe({driver:ZEe({dbName:QEe,storeName:XEe})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const n=await this.indexedDb.getItem(e);if(n!==null)return n}async setItem(e,n){await this.indexedDb.setItem(e,xf(n))}async removeItem(e){await this.indexedDb.removeItem(e)}};var o7=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},hE={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,i){this[n]=String(i)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(i){n[i]=void 0,delete n[i]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof o7<"u"&&o7.localStorage?hE.exports=o7.localStorage:typeof window<"u"&&window.localStorage?hE.exports=window.localStorage:hE.exports=new e})();function e_e(t){var e;return[t[0],Dg((e=t[1])!=null?e:"")]}let t_e=class{constructor(){this.localStorage=hE.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(e_e)}async getItem(e){const n=this.localStorage.getItem(e);if(n!==null)return Dg(n)}async setItem(e,n){this.localStorage.setItem(e,xf(n))}async removeItem(e){this.localStorage.removeItem(e)}};const n_e="wc_storage_version",wW=1,i_e=async(t,e,n)=>{const i=n_e,s=await e.getItem(i);if(s&&s>=wW){n(e);return}const r=await t.getKeys();if(!r.length){n(e);return}const o=[];for(;r.length;){const a=r.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(i,wW),n(e),s_e(t,o)},s_e=async(t,e)=>{e.length&&e.forEach(async n=>{await t.removeItem(n)})};let r_e=class{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const e=new t_e;this.storage=e;try{const n=new JEe;i_e(e,n,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,n){return await this.initialize(),this.storage.setItem(e,n)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),e())},20)})}};var o_e=Object.defineProperty,a_e=(t,e,n)=>e in t?o_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vW=(t,e,n)=>a_e(t,typeof e!="symbol"?e+"":e,n);let c_e=class extends C1{constructor(e){super(),this.opts=e,vW(this,"protocol","wc"),vW(this,"version",2)}};var l_e=Object.defineProperty,u_e=(t,e,n)=>e in t?l_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d_e=(t,e,n)=>u_e(t,e+"",n);let h_e=class extends C1{constructor(e,n){super(),this.core=e,this.logger=n,d_e(this,"records",new Map)}},f_e=class{constructor(e,n){this.logger=e,this.core=n}},p_e=class extends C1{constructor(e,n){super(),this.relayer=e,this.logger=n}},m_e=class extends C1{constructor(e){super()}},g_e=class{constructor(e,n,i,s){this.core=e,this.logger=n,this.name=i}},y_e=class extends C1{constructor(e,n){super(),this.relayer=e,this.logger=n}},b_e=class extends C1{constructor(e,n){super(),this.core=e,this.logger=n}},w_e=class{constructor(e,n,i){this.core=e,this.logger=n,this.store=i}},v_e=class{constructor(e,n){this.projectId=e,this.logger=n}},C_e=class{constructor(e,n,i){this.core=e,this.logger=n,this.telemetryEnabled=i}};var x_e=Object.defineProperty,E_e=(t,e,n)=>e in t?x_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,CW=(t,e,n)=>E_e(t,typeof e!="symbol"?e+"":e,n);let __e=class{constructor(e){this.opts=e,CW(this,"protocol","wc"),CW(this,"version",2)}},S_e=class{constructor(e){this.client=e}};function A_e(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Jte(t,...e){if(!A_e(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function xW(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function T_e(t,e){Jte(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const Ny=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const a7=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function k_e(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function ene(t){return typeof t=="string"&&(t=k_e(t)),Jte(t),t}let N_e=class{clone(){return this._cloneInto()}};function R_e(t){const e=i=>t().update(ene(i)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function tne(t=32){if(Ny&&typeof Ny.getRandomValues=="function")return Ny.getRandomValues(new Uint8Array(t));if(Ny&&typeof Ny.randomBytes=="function")return Ny.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function P_e(t,e,n,i){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,i);const s=BigInt(32),r=BigInt(4294967295),o=Number(n>>s&r),a=Number(n&r),c=i?4:0,l=i?0:4;t.setUint32(e+c,o,i),t.setUint32(e+l,a,i)}let I_e=class extends N_e{constructor(e,n,i,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=i,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=a7(this.buffer)}update(e){xW(this);const{view:n,buffer:i,blockLen:s}=this;e=ene(e);const r=e.length;for(let o=0;o<r;){const a=Math.min(s-this.pos,r-o);if(a===s){const c=a7(e);for(;s<=r-o;o+=s)this.process(c,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){xW(this),T_e(e,this),this.finished=!0;const{buffer:n,view:i,blockLen:s,isLE:r}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(i,0),o=0);for(let h=o;h<s;h++)n[h]=0;P_e(i,s-8,BigInt(this.length*8),r),this.process(i,0);const a=a7(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)a.setUint32(4*h,d[h],r)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const i=e.slice(0,n);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:i,length:s,finished:r,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=r,e.destroyed=o,s%n&&e.buffer.set(i),e}};const ax=BigInt(2**32-1),vP=BigInt(32);function nne(t,e=!1){return e?{h:Number(t&ax),l:Number(t>>vP&ax)}:{h:Number(t>>vP&ax)|0,l:Number(t&ax)|0}}function D_e(t,e=!1){let n=new Uint32Array(t.length),i=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:r,l:o}=nne(t[s],e);[n[s],i[s]]=[r,o]}return[n,i]}const O_e=(t,e)=>BigInt(t>>>0)<<vP|BigInt(e>>>0),M_e=(t,e,n)=>t>>>n,L_e=(t,e,n)=>t<<32-n|e>>>n,$_e=(t,e,n)=>t>>>n|e<<32-n,U_e=(t,e,n)=>t<<32-n|e>>>n,B_e=(t,e,n)=>t<<64-n|e>>>n-32,F_e=(t,e,n)=>t>>>n-32|e<<64-n,j_e=(t,e)=>e,V_e=(t,e)=>t,W_e=(t,e,n)=>t<<n|e>>>32-n,q_e=(t,e,n)=>e<<n|t>>>32-n,z_e=(t,e,n)=>e<<n-32|t>>>64-n,H_e=(t,e,n)=>t<<n-32|e>>>64-n;function G_e(t,e,n,i){const s=(e>>>0)+(i>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const K_e=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),Y_e=(t,e,n,i)=>e+n+i+(t/2**32|0)|0,Z_e=(t,e,n,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),Q_e=(t,e,n,i,s)=>e+n+i+s+(t/2**32|0)|0,X_e=(t,e,n,i,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0)+(s>>>0),J_e=(t,e,n,i,s,r)=>e+n+i+s+r+(t/2**32|0)|0,Jn={fromBig:nne,split:D_e,toBig:O_e,shrSH:M_e,shrSL:L_e,rotrSH:$_e,rotrSL:U_e,rotrBH:B_e,rotrBL:F_e,rotr32H:j_e,rotr32L:V_e,rotlSH:W_e,rotlSL:q_e,rotlBH:z_e,rotlBL:H_e,add:G_e,add3L:K_e,add3H:Y_e,add4L:Z_e,add4H:Q_e,add5H:J_e,add5L:X_e},[e8e,t8e]=Jn.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0
152xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),x0=new Uint32Array(80),E0=new Uint32Array(80);let n8e=class extends I_e{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:i,Bl:s,Ch:r,Cl:o,Dh:a,Dl:c,Eh:l,El:d,Fh:h,Fl:p,Gh:g,Gl:b,Hh:w,Hl:C}=this;return[e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C]}set(e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C){this.Ah=e|0,this.Al=n|0,this.Bh=i|0,this.Bl=s|0,this.Ch=r|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=d|0,this.Fh=h|0,this.Fl=p|0,this.Gh=g|0,this.Gl=b|0,this.Hh=w|0,this.Hl=C|0}process(e,n){for(let A=0;A<16;A++,n+=4)x0[A]=e.getUint32(n),E0[A]=e.getUint32(n+=4);for(let A=16;A<80;A++){const k=x0[A-15]|0,R=E0[A-15]|0,P=Jn.rotrSH(k,R,1)^Jn.rotrSH(k,R,8)^Jn.shrSH(k,R,7),B=Jn.rotrSL(k,R,1)^Jn.rotrSL(k,R,8)^Jn.shrSL(k,R,7),F=x0[A-2]|0,z=E0[A-2]|0,K=Jn.rotrSH(F,z,19)^Jn.rotrBH(F,z,61)^Jn.shrSH(F,z,6),q=Jn.rotrSL(F,z,19)^Jn.rotrBL(F,z,61)^Jn.shrSL(F,z,6),G=Jn.add4L(B,q,E0[A-7],E0[A-16]),I=Jn.add4H(G,P,K,x0[A-7],x0[A-16]);x0[A]=I|0,E0[A]=G|0}let{Ah:i,Al:s,Bh:r,Bl:o,Ch:a,Cl:c,Dh:l,Dl:d,Eh:h,El:p,Fh:g,Fl:b,Gh:w,Gl:C,Hh:E,Hl:T}=this;for(let A=0;A<80;A++){const k=Jn.rotrSH(h,p,14)^Jn.rotrSH(h,p,18)^Jn.rotrBH(h,p,41),R=Jn.rotrSL(h,p,14)^Jn.rotrSL(h,p,18)^Jn.rotrBL(h,p,41),P=h&g^~h&w,B=p&b^~p&C,F=Jn.add5L(T,R,B,t8e[A],E0[A]),z=Jn.add5H(F,E,k,P,e8e[A],x0[A]),K=F|0,q=Jn.rotrSH(i,s,28)^Jn.rotrBH(i,s,34)^Jn.rotrBH(i,s,39),G=Jn.rotrSL(i,s,28)^Jn.rotrBL(i,s,34)^Jn.rotrBL(i,s,39),I=i&r^i&a^r&a,S=s&o^s&c^o&c;E=w|0,T=C|0,w=g|0,C=b|0,g=h|0,b=p|0,{h,l:p}=Jn.add(l|0,d|0,z|0,K|0),l=a|0,d=c|0,a=r|0,c=o|0,r=i|0,o=s|0;const v=Jn.add3L(K,G,S);i=Jn.add3H(v,z,q,I),s=v|0}({h:i,l:s}=Jn.add(this.Ah|0,this.Al|0,i|0,s|0)),{h:r,l:o}=Jn.add(this.Bh|0,this.Bl|0,r|0,o|0),{h:a,l:c}=Jn.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:d}=Jn.add(this.Dh|0,this.Dl|0,l|0,d|0),{h,l:p}=Jn.add(this.Eh|0,this.El|0,h|0,p|0),{h:g,l:b}=Jn.add(this.Fh|0,this.Fl|0,g|0,b|0),{h:w,l:C}=Jn.add(this.Gh|0,this.Gl|0,w|0,C|0),{h:E,l:T}=Jn.add(this.Hh|0,this.Hl|0,E|0,T|0),this.set(i,s,r,o,a,c,l,d,h,p,g,b,w,C,E,T)}roundClean(){x0.fill(0),E0.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const i8e=R_e(()=>new n8e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const YO=BigInt(0),ine=BigInt(1),s8e=BigInt(2);function ZO(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function QO(t){if(!ZO(t))throw new Error("Uint8Array expected")}function c7(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}const r8e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function XO(t){QO(t);let e="";for(let n=0;n<t.length;n++)e+=r8e[t[n]];return e}function sne(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?YO:BigInt("0x"+t)}const Sh={_0:48,_9:57,A:65,F:70,a:97,f:102};function EW(t){if(t>=Sh._0&&t<=Sh._9)return t-Sh._0;if(t>=Sh.A&&t<=Sh.F)return t-(Sh.A-10);if(t>=Sh.a&&t<=Sh.f)return t-(Sh.a-10)}function rne(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(n);for(let s=0,r=0;
vendor: 22,361 bytes, line 152
152s<n;s++,r+=2){const o=EW(t.charCodeAt(r)),a=EW(t.charCodeAt(r+1));if(o===void 0||a===void 0){const c=t[r]+t[r+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+r)}i[s]=o*16+a}return i}function o8e(t){return sne(XO(t))}function fE(t){return QO(t),sne(XO(Uint8Array.from(t).reverse()))}function one(t,e){return rne(t.toString(16).padStart(e*2,"0"))}function CP(t,e){return one(t,e).reverse()}function Ah(t,e,n){let i;if(typeof e=="string")try{i=rne(e)}catch(r){throw new Error(t+" must be hex string or Uint8Array, cause: "+r)}else if(ZO(e))i=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=i.length;if(typeof n=="number"&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return i}function _W(...t){let e=0;for(let i=0;i<t.length;i++){const s=t[i];QO(s),e+=s.length}const n=new Uint8Array(e);for(let i=0,s=0;i<t.length;i++){const r=t[i];n.set(r,s),s+=r.length}return n}const l7=t=>typeof t=="bigint"&&YO<=t;function a8e(t,e,n){return l7(t)&&l7(e)&&l7(n)&&e<=t&&t<n}function Nv(t,e,n,i){if(!a8e(e,n,i))throw new Error("expected valid "+t+": "+n+" <= n < "+i+", got "+e)}function c8e(t){let e;for(e=0;t>YO;t>>=ine,e+=1);return e}const l8e=t=>(s8e<<BigInt(t-1))-ine,u8e={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ZO(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function JO(t,e,n={}){const i=(s,r,o)=>{const a=u8e[r];if(typeof a!="function")throw new Error("invalid validator function");const c=t[s];if(!(o&&c===void 0)&&!a(c,t))throw new Error("param "+String(s)+" is invalid. Expected "+r+", got "+c)};for(const[s,r]of Object.entries(e))i(s,r,!1);for(const[s,r]of Object.entries(n))i(s,r,!0);return t}function SW(t){const e=new WeakMap;return(n,...i)=>{const s=e.get(n);if(s!==void 0)return s;const r=t(n,...i);return e.set(n,r),r}}const no=BigInt(0),nr=BigInt(1),Im=BigInt(2),d8e=BigInt(3),xP=BigInt(4),AW=BigInt(5),TW=BigInt(8);function Or(t,e){const n=t%e;return n>=no?n:e+n}function h8e(t,e,n){if(e<no)throw new Error("invalid exponent, negatives unsupported");if(n<=no)throw new Error("invalid modulus");if(n===nr)return no;let i=nr;for(;e>no;)e&nr&&(i=i*t%n),t=t*t%n,e>>=nr;return i}function rd(t,e,n){let i=t;for(;e-- >no;)i*=i,i%=n;return i}function kW(t,e){if(t===no)throw new Error("invert: expected non-zero number");if(e<=no)throw new Error("invert: expected positive modulus, got "+e);let n=Or(t,e),i=e,s=no,r=nr;for(;n!==no;){const o=i/n,a=i%n,c=s-r*o;i=n,n=a,s=r,r=c}if(i!==nr)throw new Error("invert: does not exist");return Or(s,e)}function f8e(t){const e=(t-nr)/Im;let n,i,s;for(n=t-nr,i=0;n%Im===no;n/=Im,i++);for(s=Im;s<t&&h8e(s,e,t)!==t-nr;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(i===1){const o=(t+nr)/xP;return function(a,c){const l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const r=(n+nr)/Im;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=i,l=o.pow(o.mul(o.ONE,s),n),d=o.pow(a,r),h=o.pow(a,n);for(;!o.eql(h,o.ONE);){if(o.eql(h,o.ZERO))return o.ZERO;let p=1;for(let b=o.sqr(h);p<c&&!o.eql(b,o.ONE);p++)b=o.sqr(b);const g=o.pow(l,nr<<BigInt(c-p-1));l=o.sqr(g),d=o.mul(d,g),h=o.mul(h,l),c=p}return d}}function p8e(t){if(t%xP===d8e){const e=(t+nr)/xP;return function(n,i){const s=n.pow(i,e);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(t%TW===AW){const e=(t-AW)/TW;return function(n,i){const s=n.mul(i,Im),r=n.pow(s,e),o=n.mul(i,r),a=n.mul(n.mul(o,Im),r),c=n.mul(o,n.sub(a,n.ONE));if(!n.eql(n.sqr(c),i))throw new Error("Cannot find square root");return c}}return f8e(t)}const m8e=(t,e)=>(Or(t,e)&nr)===nr,g8e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function y8e(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=g8e.reduce((i,s)=>(i[s]="function",i),e);return JO(t,n)}function b8e(t,e,n){if(n<no)throw new Error("invalid exponent, negatives unsupported");if(n===no)return t.ONE;if(n===nr)return e;let i=t.ONE,s=e;for(;n>no;)n&nr&&(i=t.mul(i,s)),s=t.sqr(s),n>>=nr;return i}function w8e(t,e){const n=new Array(e.length),i=e.reduce((r,o,a)=>t.is0(o)?r:(n[a]=r,t.mul(r,o)),t.ONE),s=t.inv(i);return e.reduceRight((r,o,a)=>t.is0(o)?r:(n[a]=t.mul(r,n[a]),t.mul(r,o)),s),n}function ane(t,e){const n=e!==void 0?e:t.toString(2).length,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}function cne(t,e,n=!1,i={}){if(t<=no)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:r}=ane(t,e);if(r>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:n,BITS:s,BYTES:r,MASK:l8e(s),ZERO:no,ONE:nr,create:c=>Or(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return no<=c&&c<t},is0:c=>c===no,isOdd:c=>(c&nr)===nr,neg:c=>Or(-c,t),eql:(c,l)=>c===l,sqr:c=>Or(c*c,t),add:(c,l)=>Or(c+l,t),sub:(c,l)=>Or(c-l,t),mul:(c,l)=>Or(c*l,t),pow:(c,l)=>b8e(a,c,l),div:(c,l)=>Or(c*kW(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>kW(c,t),sqrt:i.sqrt||(c=>(o||(o=p8e(t)),o(a,c))),invertBatch:c=>w8e(a,c),cmov:(c,l,d)=>d?l:c,toBytes:c=>n?CP(c,r):one(c,r),fromBytes:c=>{if(c.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+c.length);return n?fE(c):o8e(c)}});return Object.freeze(a)}const NW=BigInt(0),cx=BigInt(1);function u7(t,e){const n=e.negate();return t?n:e}function lne(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function d7(t,e){lne(t,e);const n=Math.ceil(e/t)+1,i=2**(t-1);return{windows:n,windowSize:i}}function v8e(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,i)=>{if(!(n instanceof e))throw new Error("invalid point at index "+i)})}function C8e(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,i)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+i)})}const h7=new WeakMap,une=new WeakMap;function f7(t){return une.get(t)||1}function x8e(t,e){return{constTimeNegate:u7,hasPrecomputes(n){return f7(n)!==1},unsafeLadder(n,i,s=t.ZERO){let r=n;for(;i>NW;)i&cx&&(s=s.add(r)),r=r.double(),i>>=cx;return s},precomputeWindow(n,i){const{windows:s,windowSize:r}=d7(i,e),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let d=1;d<r;d++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,i,s){const{windows:r,windowSize:o}=d7(n,e);let a=t.ZERO,c=t.BASE;const l=BigInt(2**n-1),d=2**n,h=BigInt(n);for(let p=0;p<r;p++){const g=p*o;let b=Number(s&l);s>>=h,b>o&&(b-=d,s+=cx);const w=g,C=g+Math.abs(b)-1,E=p%2!==0,T=b<0;b===0?c=c.add(u7(E,i[w])):a=a.add(u7(T,i[C]))}return{p:a,f:c}},wNAFUnsafe(n,i,s,r=t.ZERO){const{windows:o,windowSize:a}=d7(n,e),c=BigInt(2**n-1),l=2**n,d=BigInt(n);for(let h=0;h<o;h++){const p=h*a;if(s===NW)break;let g=Number(s&c);if(s>>=d,g>a&&(g-=l,s+=cx),g===0)continue;let b=i[p+Math.abs(g)-1];g<0&&(b=b.negate()),r=r.add(b)}return r},getPrecomputes(n,i,s){let r=h7.get(i);return r||(r=this.precomputeWindow(i,n),n!==1&&h7.set(i,s(r))),r},wNAFCached(n,i,s){const r=f7(n);return this.wNAF(r,this.getPrecomputes(r,n,s),i)},wNAFCachedUnsafe(n,i,s,r){const o=f7(n);return o===1?this.unsafeLadder(n,i,r):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),i,r)},setWindowSize(n,i){lne(i,e),une.set(n,i),h7.delete(n)}}}function E8e(t,e,n,i){if(v8e(n,t),C8e(i,e),n.length!==i.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,r=c8e(BigInt(n.length)),o=r>12?r-3:r>4?r-2:r?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),l=Math.floor((e.BITS-1)/o)*o;let d=s;for(let h=l;h>=0;h-=o){c.fill(s);for(let g=0;g<i.length;g++){const b=i[g],w=Number(b>>BigInt(h)&BigInt(a));c[w]=c[w].add(n[g])}let p=s;for(let g=c.length-1,b=s;g>0;g--)b=b.add(c[g]),p=p.add(b);if(d=d.add(p),h!==0)for(let g=0;g<o;g++)d=d.double()}return d}function _8e(t){return y8e(t.Fp),JO(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ane(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}const nu=BigInt(0),Oa=BigInt(1),lx=BigInt(2),S8e=BigInt(8),A8e={zip215:!0};function T8e(t){const e=_8e(t);return JO(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function k8e(t){const e=T8e(t),{Fp:n,n:i,prehash:s,hash:r,randomBytes:o,nByteLength:a,h:c}=e,l=lx<<BigInt(a*8)-Oa,d=n.create,h=cne(e.n,e.nBitLength),p=e.uvRatio||((v,_)=>{try{return{isValid:!0,value:n.sqrt(v*n.inv(_))}}catch{return{isValid:!1,value:nu}}}),g=e.adjustScalarBytes||(v=>v),b=e.domain||((v,_,N)=>{if(c7("phflag",N),_.length||N)throw new Error("Contexts/pre-hash are not supported");return v});function w(v,_){Nv("coordinate "+v,_,nu,l)}function C(v){if(!(v instanceof A))throw new Error("ExtendedPoint expected")}const E=SW((v,_)=>{const{ex:N,ey:$,ez:U}=v,j=v.is0();_==null&&(_=j?S8e:n.inv(U));const D=d(N*_),O=d($*_),H=d(U*_);if(j)return{x:nu,y:Oa};if(H!==Oa)throw new Error("invZ was invalid");return{x:D,y:O}}),T=SW(v=>{const{a:_,d:N}=e;if(v.is0())throw new Error("bad point: ZERO");const{ex:$,ey:U,ez:j,et:D}=v,O=d($*$),H=d(U*U),J=d(j*j),W=d(J*J),Z=d(O*_),Y=d(J*d(Z+H)),Q=d(W+d(N*d(O*H)));if(Y!==Q)throw new Error("bad point: equation left != right (1)");const ee=d($*U),ie=d(j*D);if(ee!==ie)throw new Error("bad point: equation left != right (2)");return!0});class A{constructor(_,N,$,U){this.ex=_,this.ey=N,this.ez=$,this.et=U,w("x",_),w("y",N),w("z",$),w("t",U),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(_){if(_ instanceof A)throw new Error("extended point not allowed");const{x:N,y:$}=_||{};return w("x",N),w("y",$),new A(N,$,Oa,d(N*$))}static normalizeZ(_){const N=n.invertBatch(_.map($=>$.ez));return _.map(($,U)=>$.toAffine(N[U])).map(A.fromAffine)}static msm(_,N){return E8e(A,h,_,N)}_setWindowSize(_){P.setWindowSize(this,_)}assertValidity(){T(this)}equals(_){C(_);const{ex:N,ey:$,ez:U}=this,{ex:j,ey:D,ez:O}=_,H=d(N*O),J=d(j*U),W=d($*O),Z=d(D*U);return H===J&&W===Z}is0(){return this.equals(A.ZERO)}negate(){return new A(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){const{a:_}=e,{ex:N,ey:$,ez:U}=this,j=d(N*N),D=d($*$),O=d(lx*d(U*U)),H=d(_*j),J=N+$,W=d(d(J*J)-j-D),Z=H+D,Y=Z-O,Q=H-D,ee=d(W*Y),ie=d(Z*Q),re=d(W*Q),oe=d(Y*Z);return new A(ee,ie,oe,re)}add(_){C(_);const{a:N,d:$}=e,{ex:U,ey:j,ez:D,et:O}=this,{ex:H,ey:J,ez:W,et:Z}=_;if(N===BigInt(-1)){const pe=d((j-U)*(J+H)),Te=d((j+U)*(J-H)),ve=d(Te-pe);if(ve===nu)return this.double();const xe=d(D*lx*Z),Ye=d(O*lx*W),ze=Ye+xe,ft=Te+pe,lt=Ye-xe,We=d(ze*ve),Dt=d(ft*lt),Fe=d(ze*lt),it=d(ve*ft);return new A(We,Dt,it,Fe)}const Y=d(U*H),Q=d(j*J),ee=d(O*$*Z),ie=d(D*W),re=d((U+j)*(H+J)-Y-Q),oe=ie-ee,de=ie+ee,he=d(Q-N*Y),ue=d(re*oe),be=d(de*he),_e=d(re*he),Ne=d(oe*de);return new A(ue,be,Ne,_e)}subtract(_){return this.add(_.negate())}wNAF(_){return P.wNAFCached(this,_,A.normalizeZ)}multiply(_){const N=_;Nv("scalar",N,Oa,i);const{p:$,f:U}=this.wNAF(N);return A.normalizeZ([$,U])[0]}multiplyUnsafe(_,N=A.ZERO){const $=_;return Nv("scalar",$,nu,i),$===nu?R:this.is0()||$===Oa?this:P.wNAFCachedUnsafe(this,$,A.normalizeZ,N)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return P.unsafeLadder(this,i).is0()}toAffine(_){return E(this,_)}clearCofactor(){const{h:_}=e;return _===Oa?this:this.multiplyUnsafe(_)}static fromHex(_,N=!1){const{d:$,a:U}=e,j=n.BYTES;_=Ah("pointHex",_,j),c7("zip215",N);const D=_.slice(),O=_[j-1];D[j-1]=O&-129;const H=fE(D),J=N?l:n.ORDER;Nv("pointHex.y",H,nu,J);const W=d(H*H),Z=d(W-Oa),Y=d($*W-U);let{isValid:Q,value:ee}=p(Z,Y);if(!Q)throw new Error("Point.fromHex: invalid y coordinate");const ie=(ee&Oa)===Oa,re=(O&128)!==0;if(!N&&ee===nu&&re)throw new Error("Point.fromHex: x=0 and x_0=1");return re!==ie&&(ee=d(-ee)),A.fromAffine({x:ee,y:H})}static fromPrivateKey(_){return z(_).point}toRawBytes(){const{x:_,y:N}=this.toAffine(),$=CP(N,n.BYTES);return $[$.length-1]|=_&Oa?128:0,$}toHex(){return XO(this.toRawBytes())}}A.BASE=new A(e.Gx,e.Gy,Oa,d(e.Gx*e.Gy)),A.ZERO=new A(nu,Oa,Oa,nu);const{BASE:k,ZERO:R}=A,P=x8e(A,a*8);function B(v){return Or(v,i)}function F(v){return B(fE(v))}function z(v){const _=n.BYTES;v=Ah("private key",v,_);const N=Ah("hashed private key",r(v),2*_),$=g(N.slice(0,_)),U=N.slice(_,2*_),j=F($),D=k.multiply(j),O=D.toRawBytes();return{head:$,prefix:U,scalar:j,point:D,pointBytes:O}}function K(v){return z(v).pointBytes}function q(v=new Uint8Array,..._){const N=_W(..._);return F(r(b(N,Ah("context",v),!!s)))}function G(v,_,N={}){v=Ah("message",v),s&&(v=s(v));const{prefix:$,scalar:U,pointBytes:j}=z(_),D=q(N.context,$,v),O=k.multiply(D).toRawBytes(),H=q(N.context,O,j,v),J=B(D+H*U);Nv("signature.s",J,nu,i);const W=_W(O,CP(J,n.BYTES));return Ah("result",W,n.BYTES*2)}const I=A8e;function S(v,_,N,$=I){const{context:U,zip215:j}=$,D=n.BYTES;v=Ah("signature",v,2*D),_=Ah("message",_),N=Ah("publicKey",N,D),j!==void 0&&c7("zip215",j),s&&(_=s(_));const O=fE(v.slice(D,2*D));let H,J,W;try{H=A.fromHex(N,j),J=A.fromHex(v.slice(0,D),j),W=k.multiplyUnsafe(O)}catch{return!1}if(!j&&H.isSmallOrder())return!1;const Z=q(U,J.toRawBytes(),H.toRawBytes(),_);return J.add(H.multiplyUnsafe(Z)).subtract(W).clearCofactor().equals(A.ZERO)}return k._setWindowSize(8),{CURVE:e,getPublicKey:K,sign:G,verify:S,ExtendedPoint:A,utils:{getExtendedPublicKey:z,randomPrivateKey:()=>o(n.BYTES),precompute(v=8,_=A.BASE){return _._setWindowSize(v),_.multiply(BigInt(3)),_}}}}BigInt(0),BigInt(1);const eM=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),RW=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const N8e=BigInt(1),PW=BigInt(2);BigInt(3);const R8e=BigInt(5),P8e=BigInt(8);function I8e(t){const e=BigInt(10),n=BigInt(20),i=BigInt(40),s=BigInt(80),r=eM,o=t*t%r*t%r,a=rd(o,PW,r)*o%r,c=rd(a,N8e,r)*t%r,l=rd(c,R8e,r)*c%r,d=rd(l,e,r)*l%r,h=rd(d,n,r)*d%r,p=rd(h,i,r)*h%r,g=rd(p,s,r)*p%r,b=rd(g,s,r)*p%r,w=rd(b,e,r)*l%r;return{pow_p_5_8:rd(w,PW,r)*t%r,b2:o}}function D8e(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function O8e(t,e){const n=eM,i=Or(e*e*e,n),s=Or(i*i*e,n),r=I8e(t*s).pow_p_5_8;let o=Or(t*i*r,n);const a=Or(e*o*o,n),c=o,l=Or(o*RW,n),d=a===t,h=a===Or(-t,n),p=a===Or(-t*RW,n);return d&&(o=c),(h||p)&&(o=l),m8e(o,n)&&(o=Or(-o,n)),{isValid:d||h,value:o}}const M8e=cne(eM,void 0,!0),L8e={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:M8e,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:P8e,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:i8e,randomBytes:tne,adjustScalarBytes:D8e,uvRatio:O8e},dne=k8e(L8e),$8e="EdDSA",U8e="JWT",p_=".",cS="base64url",hne="utf8",fne="utf8",B8e=":",F8e="did",j8e="key",IW="base58btc",V8e="z",W8e="K36",q8e=32;function tM(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function pne(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?tM(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function mne(t,e){e||(e=t.reduce((s,r)=>s+r.length,0));const n=pne(e);let i=0;for(const s of t)n.set(s,i),i+=s.length;return tM(n)}function z8e(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var s=0;s<t.length;s++){var r=t.charAt(s),o=r.charCodeAt(0);if(n[o]!==255)throw new TypeError(r+" is ambiguous");n[o]=s}var a=t.length,c=t.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function h(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var w=0,C=0,E=0,T=b.length;E!==T&&b[E]===0;)E++,w++;for(var A=(T-E)*d+1>>>0,k=new Uint8Array(A);E!==T;){for(var R=b[E],P=0,B=A-1;(R!==0||P<C)&&B!==-1;B--,P++)R+=256*k[B]>>>0,k[B]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");C=P,E++}for(var F=A-C;F!==A&&k[F]===0;)F++;for(var z=c.repeat(w);F<A;++F)z+=t.charAt(k[F]);return z}function p(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var w=0;if(b[w]!==" "){for(var C=0,E=0;b[w]===c;)C++,w++;for(var T=(b.length-w)*l+1>>>0,A=new Uint8Array(T);b[w];){var k=n[b.charCodeAt(w)];if(k===255)return;for(var R=0,P=T-1;(k!==0||R<E)&&P!==-1;P--,R++)k+=a*A[P]>>>0,A[P]=k%256>>>0,k=k/256>>>0;if(k!==0)throw new Error("Non-zero carry");E=R,w++}if(b[w]!==" "){for(var B=T-E;B!==T&&A[B]===0;)B++;for(var F=new Uint8Array(C+(T-B)),z=C;B!==T;)F[z++]=A[B++];return F}}}function g(b){var w=p(b);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:p,decode:g}}var H8e=z8e,G8e=H8e;const gne=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},K8e=t=>new TextEncoder().encode(t),Y8e=t=>new TextDecoder().decode(t);let Z8e=class{constructor(e,n,i){this.name=e,this.prefix=n,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Q8e=class{constructor(e,n,i){if(this.name=e,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return yne(this,e)}},X8e=class{constructor(e){this.decoders=e}or(e){return yne(this,e)}decode(e){const n=e[0],i=this.decoders[n];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const yne=(t,e)=>new X8e({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});let J8e=class{constructor(e,n,i,s){this.name=e,this.prefix=n,this.baseEncode=i,this.baseDecode=s,this.encoder=new Z8e(e,n,i),this.decoder=new Q8e(e,n,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const lS=({name:t,prefix:e,encode:n,decode:i})=>new J8e(t,e,n,i),L6=({prefix:t,name:e,alphabet:n})=>{const{encode:i,decode:s}=G8e(n,e);return lS({prefix:t,name:e,encode:i,decode:r=>gne(s(r))})},eSe=(t,e,n,i)=>{const s={};for(let d=0;d<e.length;++d)s[e[d]]=d;let r=t.length;for(;t[r-1]==="=";)--r;const o=new Uint8Array(r*n/8|0);let a=0,c=0,l=0;for(let d=0;d<r;++d){const h=s[t[d]];if(h===void 0)throw new SyntaxError(`Non-${i} character`);c=c<<n|h,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},tSe=(t,e,n)=>{const i=e[e.length-1]==="=",s=(1<<n)-1;let r="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>n;)o-=n,r+=e[s&a>>o];if(o&&(r+=e[s&a<<n-o]),i)for(;r.length*n&7;)r+="=";return r},So=({name:t,prefix:e,bitsPerChar:n,alphabet:i})=>lS({prefix:e,name:t,encode(s){return tSe(s,i,n)},decode(s){return eSe(s,i,n,t)}}),nSe=lS({prefix:"\0",name:"identity",encode:t=>Y8e(t),decode:t=>K8e(t)});var iSe=Object.freeze({__proto__:null,identity:nSe});const sSe=So({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var rSe=Object.freeze({__proto__:null,base2:sSe});const oSe=So({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var aSe=Object.freeze({__proto__:null,base8:oSe});const cSe=L6({prefix:"9",name:"base10",alphabet:"0123456789"});var lSe=Object.freeze({__proto__:null,base10:cSe});const uSe=So({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),dSe=So({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var hSe=Object.freeze({__proto__:null,base16:uSe,base16upper:dSe});const fSe=So({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pSe=So({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mSe=So({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),gSe=So({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ySe=So({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),bSe=So({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wSe=So({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vSe=So({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),CSe=So({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var xSe=Object.freeze({__proto__:null,base32:fSe,base32upper:pSe,base32pad:mSe,base32padupper:gSe,base32hex:ySe,base32hexupper:bSe,base32hexpad:wSe,base32hexpadupper:vSe,base32z:CSe});const ESe=L6({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_Se=L6({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var SSe=Object.freeze({__proto__:null,base36:ESe,base36upper:_Se});const ASe=L6({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),TSe=L6({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var kSe=Object.freeze({__proto__:null,base58btc:ASe,base58flickr:TSe});const NSe=So({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
152+/",bitsPerChar:6}),RSe=So({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),PSe=So({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ISe=So({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var DSe=Object.freeze({__proto__:null,base64:NSe,base64pad:RSe,base64url:PSe,base64urlpad:ISe});const bne=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),OSe=bne.reduce((t,e,n)=>(t[n]=e,t),[]),MSe=bne.reduce((t,e,n)=>(t[e.codePointAt(0)]=n,t),[]);function LSe(t){return t.reduce((e,n)=>(e+=OSe[n],e),"")}function $Se(t){const e=[];for(const n of t){const i=MSe[n.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${n}`);e.push(i)}return new Uint8Array(e)}const USe=lS({prefix:"ð",name:"base256emoji",encode:LSe,decode:$Se});var BSe=Object.freeze({__proto__:null,base256emoji:USe}),FSe=wne,DW=128,jSe=-128,VSe=Math.pow(2,31);function wne(t,e,n){e=e||[],n=n||0;for(var i=n;t>=VSe;)e[n++]=t&255|DW,t/=128;for(;t&jSe;)e[n++]=t&255|DW,t>>>=7;return e[n]=t|0,wne.bytes=n-i+1,e}var WSe=EP,qSe=128,OW=127;function EP(t,i){var n=0,i=i||0,s=0,r=i,o,a=t.length;do{if(r>=a)throw EP.bytes=0,new RangeError("Could not decode varint");o=t[r++],n+=s<28?(o&OW)<<s:(o&OW)*Math.pow(2,s),s+=7}while(o>=qSe);return EP.bytes=r-i,n}var zSe=Math.pow(2,7),HSe=Math.pow(2,14),GSe=Math.pow(2,21),KSe=Math.pow(2,28),YSe=Math.pow(2,35),ZSe=Math.pow(2,42),QSe=Math.pow(2,49),XSe=Math.pow(2,56),JSe=Math.pow(2,63),e9e=function(t){return t<zSe?1:t<HSe?2:t<GSe?3:t<KSe?4:t<YSe?5:t<ZSe?6:t<QSe?7:t<XSe?8:t<JSe?9:10},t9e={encode:FSe,decode:WSe,encodingLength:e9e},vne=t9e;const MW=(t,e,n=0)=>(vne.encode(t,e,n),e),LW=t=>vne.encodingLength(t),_P=(t,e)=>{const n=e.byteLength,i=LW(t),s=i+LW(n),r=new Uint8Array(s+n);return MW(t,r,0),MW(n,r,i),r.set(e,s),new n9e(t,n,e,r)};let n9e=class{constructor(e,n,i,s){this.code=e,this.size=n,this.digest=i,this.bytes=s}};const Cne=({name:t,code:e,encode:n})=>new i9e(t,e,n);let i9e=class{constructor(e,n,i){this.name=e,this.code=n,this.encode=i}digest(e){if(e instanceof Uint8Array){const n=this.encode(e);return n instanceof Uint8Array?_P(this.code,n):n.then(i=>_P(this.code,i))}else throw Error("Unknown type, must be binary type")}};const xne=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),s9e=Cne({name:"sha2-256",code:18,encode:xne("SHA-256")}),r9e=Cne({name:"sha2-512",code:19,encode:xne("SHA-512")});var o9e=Object.freeze({__proto__:null,sha256:s9e,sha512:r9e});const Ene=0,a9e="identity",_ne=gne,c9e=t=>_P(Ene,_ne(t)),l9e={code:Ene,name:a9e,encode:_ne,digest:c9e};var u9e=Object.freeze({__proto__:null,identity:l9e});new TextEncoder,new TextDecoder;const $W={...iSe,...rSe,...aSe,...lSe,...hSe,...xSe,...SSe,...kSe,...DSe,...BSe};({...o9e,...u9e});function Sne(t,e,n,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:i}}}const UW=Sne("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),p7=Sne("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{t=t.substring(1);const e=pne(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),Ane={utf8:UW,"utf-8":UW,hex:$W.base16,latin1:p7,ascii:p7,binary:p7,...$W};function uS(t,e="utf8"){const n=Ane[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}function Vb(t,e="utf8"){const n=Ane[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?tM(globalThis.Buffer.from(t,"utf-8")):n.decoder.decode(`${n.prefix}${t}`)}function BW(t){return Dg(uS(Vb(t,cS),hne))}function m_(t){return uS(Vb(xf(t),hne),cS)}function Tne(t){const e=Vb(W8e,IW),n=V8e+uS(mne([e,t]),IW);return[F8e,j8e,n].join(B8e)}function d9e(t){return uS(t,cS)}function h9e(t){return Vb(t,cS)}function f9e(t){return Vb([m_(t.header),m_(t.payload)].join(p_),fne)}function p9e(t){return[m_(t.header),m_(t.payload),d9e(t.signature)].join(p_)}function SP(t){const e=t.split(p_),n=BW(e[0]),i=BW(e[1]),s=h9e(e[2]),r=Vb(e.slice(0,2).join(p_),fne);return{header:n,payload:i,signature:s,data:r}}function FW(t=tne(q8e)){const e=dne.getPublicKey(t);return{secretKey:mne([t,e]),publicKey:e}}async function m9e(t,e,n,i,s=wt.fromMiliseconds(Date.now())){const r={alg:$8e,typ:U8e},o=Tne(i.publicKey),a=s+n,c={iss:o,sub:t,aud:e,iat:s,exp:a},l=f9e({header:r,payload:c}),d=dne.sign(l,i.secretKey.slice(0,32));return p9e({header:r,payload:c,signature:d})}var jW=function(t,e,n){if(n||arguments.length===2)for(var i=0,s=e.length,r;i<s;i++)(r||!(i in e))&&(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},g9e=(function(){function t(e,n,i){this.name=e,this.version=n,this.os=i,this.type="browser"}return t})(),y9e=(function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t})(),b9e=(function(){function t(e,n,i,s){this.name=e,this.version=n,this.os=i,this.bot=s,this.type="bot-device"}return t})(),w9e=(function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t})(),v9e=(function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t})(),C9e=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yaho
vendor: 8,934 bytes, lines 152-153
152o!|yandex/,x9e=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,VW=3,E9e=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",C9e]],WW=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function _9e(t){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new v9e:typeof navigator<"u"?A9e(navigator.userAgent):k9e()}function S9e(t){return t!==""&&E9e.reduce(function(e,n){var i=n[0],s=n[1];if(e)return e;var r=s.exec(t);return!!r&&[i,r]},!1)}function A9e(t){var e=S9e(t);if(!e)return null;var n=e[0],i=e[1];if(n==="searchbot")return new w9e;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<VW&&(s=jW(jW([],s,!0),N9e(VW-s.length),!0)):s=[];var r=s.join("."),o=T9e(t),a=x9e.exec(t);return a&&a[1]?new b9e(n,r,o,a[1]):new g9e(n,r,o)}function T9e(t){for(var e=0,n=WW.length;e<n;e++){var i=WW[e],s=i[0],r=i[1],o=r.exec(t);if(o)return s}return null}function k9e(){var t=typeof process<"u"&&process.version;return t?new y9e(process.version.slice(1)):null}function N9e(t){for(var e=[],n=0;n<t;n++)e.push("0");return e}var ns={},qW;function kne(){if(qW)return ns;qW=1,Object.defineProperty(ns,"__esModule",{value:!0}),ns.getLocalStorage=ns.getLocalStorageOrThrow=ns.getCrypto=ns.getCryptoOrThrow=ns.getLocation=ns.getLocationOrThrow=ns.getNavigator=ns.getNavigatorOrThrow=ns.getDocument=ns.getDocumentOrThrow=ns.getFromWindowOrThrow=ns.getFromWindow=void 0;function t(p){let g;return typeof window<"u"&&typeof window[p]<"u"&&(g=window[p]),g}ns.getFromWindow=t;function e(p){const g=t(p);if(!g)throw new Error(`${p} is not defined in Window`);return g}ns.getFromWindowOrThrow=e;function n(){return e("document")}ns.getDocumentOrThrow=n;function i(){return t("document")}ns.getDocument=i;function s(){return e("navigator")}ns.getNavigatorOrThrow=s;function r(){return t("navigator")}ns.getNavigator=r;function o(){return e("location")}ns.getLocationOrThrow=o;function a(){return t("location")}ns.getLocation=a;function c(){return e("crypto")}ns.getCryptoOrThrow=c;function l(){return t("crypto")}ns.getCrypto=l;function d(){return e("localStorage")}ns.getLocalStorageOrThrow=d;function h(){return t("localStorage")}return ns.getLocalStorage=h,ns}var Ef=kne(),Rv={},zW;function R9e(){if(zW)return Rv;zW=1,Object.defineProperty(Rv,"__esModule",{value:!0}),Rv.getWindowMetadata=void 0;const t=kne();function e(){let n,i;try{n=t.getDocumentOrThrow(),i=t.getLocationOrThrow()}catch{return null}function s(){const g=n.getElementsByTagName("link"),b=[];for(let w=0;w<g.length;w++){const C=g[w],E=C.getAttribute("rel");if(E&&E.toLowerCase().indexOf("icon")>-1){const T=C.getAttribute("href");if(T)if(T.toLowerCase().indexOf("https:")===-1&&T.toLowerCase().indexOf("http:")===-1&&T.indexOf("//")!==0){let A=i.protocol+"//"+i.host;if(T.indexOf("/")===0)A+=T;else{const k=i.pathname.split("/");k.pop();const R=k.join("/");A+=R+"/"+T}b.push(A)}else if(T.indexOf("//")===0){const A=i.protocol+T;b.push(A)}else b.push(T)}}return b}function r(...g){const b=n.getElementsByTagName("meta");for(let w=0;w<b.length;w++){const C=b[w],E=["itemprop","property","name"].map(T=>C.getAttribute(T)).filter(T=>T?g.includes(T):!1);if(E.length&&E){const T=C.getAttribute("content");if(T)return T}}return""}function o(){let g=r("name","og:site_name","og:title","twitter:title");return g||(g=n.title),g}function a(){return r("description","og:description","twitter:description","keywords")}const c=o(),l=a(),d=i.origin,h=s();return{description:l,url:d,icons:h,name:c}}return Rv.getWindowMetadata=e,Rv}var P9e=R9e();const I9e="0.1.1";function D9e(){return I9e}class Ps extends Error{constructor(e,n={}){const i=(()=>{var c;if(n.cause instanceof Ps){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof Ps&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`,a=[e||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...i||s?["",i?`Details: ${i}`:void 0,s?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(` 153`);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${D9e()}`}),this.cause=n.cause,this.details=i,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return Nne(this,e)}}function Nne(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?Nne(t.cause,e):e?null:t}function O9e(t,e){if(YW(t)>e)throw new tAe({givenSize:YW(t),maxSize:e})}const Th={zero:48,nine:57,A:65,F:70,a:97,f:102};function HW(t){if(t>=Th.zero&&t<=Th.nine)return t-Th.zero;if(t>=Th.A&&t<=Th.F)return t-(Th.A-10);if(t>=Th.a&&t<=Th.f)return t-(Th.a-10)}function M9e(t,e={}){const{dir:n,size:i=32}=e;if(i===0)return t;if(t.length>i)throw new nAe({size:t.length,targetSize:i,type:"Bytes"});const s=new Uint8Array(i);for(let r=0;r<i;r++){const o=n==="right";s[o?r:i-r-1]=t[o?r:t.length-r-1]}return s}function Rne(t,e){if(Ap(t)>e)throw new z9e({givenSize:Ap(t),maxSize:e})}function L9e(t,e){if(typeof e=="number"&&e>0&&e>Ap(t)-1)throw new Dne({offset:e,position:"start",size:Ap(t)})}function $9e(t,e,n){if(typeof e=="number"&&typeof n=="number"&&Ap(t)!==n-e)throw new Dne({offset:n,position:"end",size:Ap(t)})}function Pne(t,e={}){const{dir:n,size:i=32}=e;if(i===0)return t;const s=t.replace("0x","");if(s.length>i*2)throw new H9e({size:Math.ceil(s.length/2),targetSize:i,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](i*2,"0")}`}const U9e="#__bigint";function nM(t,e,n){return JSON.stringify(t,(i,s)=>typeof s=="bigint"?s.toString()+U9e:s,n)}const B9e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function F9e(t,e={}){const{strict:n=!1}=e;if(!t)throw new GW(t);if(typeof t!="string")throw new GW(t);if(n&&!/^0x[0-9a-fA-F]*$/.test(t))throw new KW(t);if(!t.startsWith("0x"))throw new KW(t)}function j9e(...t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}function iM(t){return t instanceof Uint8Array?g_(t):Array.isArray(t)?g_(new
vendor: 8,404 bytes, line 153
153Uint8Array(t)):t}function g_(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=B9e[t[s]];const i=`0x${n}`;return typeof e.size=="number"?(Rne(i,e.size),Ine(i,e.size)):i}function m7(t,e={}){const{signed:n,size:i}=e,s=BigInt(t);let r;i?n?r=(1n<<BigInt(i)*8n-1n)-1n:r=2n**(BigInt(i)*8n)-1n:typeof t=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&n?-r-1n:0;if(r&&s>r||s<o){const l=typeof t=="bigint"?"n":"";throw new q9e({max:r?`${r}${l}`:void 0,min:`${o}${l}`,signed:n,size:i,value:`${t}${l}`})}const c=`0x${(n&&s<0?(1n<<BigInt(i*8))+BigInt(s):s).toString(16)}`;return i?V9e(c,i):c}function V9e(t,e){return Pne(t,{dir:"left",size:e})}function Ine(t,e){return Pne(t,{dir:"right",size:e})}function $h(t,e,n,i={}){const{strict:s}=i;L9e(t,e);const r=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return s&&$9e(r,e,n),r}function Ap(t){return Math.ceil((t.length-2)/2)}function W9e(t,e={}){const{strict:n=!1}=e;try{return F9e(t,{strict:n}),!0}catch{return!1}}class q9e extends Ps{constructor({max:e,min:n,signed:i,size:s,value:r}){super(`Number \`${r}\` is not in safe${s?` ${s*8}-bit`:""}${i?" signed":" unsigned"} integer range ${e?`(\`${n}\` to \`${e}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class GW extends Ps{constructor(e){super(`Value \`${typeof e=="object"?nM(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class KW extends Ps{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}let z9e=class extends Ps{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}};class Dne extends Ps{constructor({offset:e,position:n,size:i}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${i}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}let H9e=class extends Ps{constructor({size:e,targetSize:n,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};const G9e=new TextEncoder;function K9e(t){if(!(t instanceof Uint8Array)){if(!t)throw new ux(t);if(typeof t!="object")throw new ux(t);if(!("BYTES_PER_ELEMENT"in t))throw new ux(t);if(t.BYTES_PER_ELEMENT!==1||t.constructor.name!=="Uint8Array")throw new ux(t)}}function Y9e(t){return t instanceof Uint8Array?t:typeof t=="string"?Q9e(t):Z9e(t)}function Z9e(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Q9e(t,e={}){const{size:n}=e;let i=t;n&&(Rne(t,n),i=Ine(t,n));let s=i.slice(2);s.length%2&&(s=`0${s}`);const r=s.length/2,o=new Uint8Array(r);for(let a=0,c=0;a<r;a++){const l=HW(s.charCodeAt(c++)),d=HW(s.charCodeAt(c++));if(l===void 0||d===void 0)throw new Ps(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=l*16+d}return o}function X9e(t,e={}){const{size:n}=e,i=G9e.encode(t);return typeof n=="number"?(O9e(i,n),J9e(i,n)):i}function J9e(t,e){return M9e(t,{dir:"right",size:e})}function YW(t){return t.length}function eAe(t){try{return K9e(t),!0}catch{return!1}}class ux extends Ps{constructor(e){super(`Value \`${typeof e=="object"?nM(e):e}\` of type \`${typeof e}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class tAe extends Ps{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class nAe extends Ps{constructor({size:e,targetSize:n,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}function One(t,e={}){const{as:n=typeof t=="string"?"Hex":"Bytes"}=e,i=GD(Y9e(t));return n==="Bytes"?i:g_(i)}class iAe extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const i=this.keys().next().value;i&&this.delete(i)}return this}}const sAe={checksum:new iAe(8192)},g7=sAe.checksum;function Mne(t,e={}){const{compressed:n}=e,{prefix:i,x:s,y:r}=t;if(n===!1||typeof s=="bigint"&&typeof r=="bigint"){if(i!==4)throw new ZW({prefix:i,cause:new uAe});return}if(n===!0||typeof s=="bigint"&&typeof r>"u"){if(i!==3&&i!==2)throw new ZW({prefix:i,cause:new lAe});return}throw new cAe({publicKey:t})}function rAe(t){const e=(()=>{if(W9e(t))return Lne(t);if(eAe(t))return oAe(t);const{prefix:n,x:i,y:s}=t;return typeof i=="bigint"&&typeof s=="bigint"?{prefix:n??4,x:i,y:s}:{prefix:n,x:i}})();return Mne(e),e}function oAe(t){return Lne(g_(t))}function Lne(t){if(t.length!==132&&t.length!==130&&t.length!==68)throw new dAe({publicKey:t});if(t.length===130){const i=BigInt($h(t,0,32)),s=BigInt($h(t,32,64));return{prefix:4,x:i,y:s}}if(t.length===132){const i=Number($h(t,0,1)),s=BigInt($h(t,1,33)),r=BigInt($h(t,33,65));return{prefix:i,x:s,y:r}}const e=Number($h(t,0,1)),n=BigInt($h(t,1,33));return{prefix:e,x:n}}function aAe(t,e={}){Mne(t);const{prefix:n,x:i,y:s}=t,{includePrefix:r=!0}=e;return j9e(r?m7(n,{size:1}):"0x",m7(i,{size:32}),typeof s=="bigint"?m7(s,{size:32}):"0x")}class cAe extends Ps{constructor({publicKey:e}){super(`Value \`${nM(e)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class ZW extends Ps{constructor({prefix:e,cause:n}){super(`Prefix "${e}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class lAe extends Ps{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class uAe extends Ps{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let dAe=class extends Ps{constructor({publicKey:e}){super(`Value \`${e}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${Ap(iM(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const hAe=/^0x[a-fA-F0-9]{40}$/;function $ne(t,e={}){const{strict:n=!0}=e;if(!hAe.test(t))throw new QW({address:t,cause:new mAe});if(n){if(t.toLowerCase()===t)return;if(Une(t)!==t)throw new QW({address:t,cause:new gAe})}}function Une(t){if(g7.has(t))return g7.get(t);$ne(t,{strict:!1});const e=t.substring(2).toLowerCase(),n=One(X9e(e),{as:"Bytes"}),i=e.split("");for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&i[r]&&(i[r]=i[r].toUpperCase()),(n[r>>1]&15)>=8&&i[r+1]&&(i[r+1]=i[r+1].toUpperCase());const s=`0x${i.join("")}`;return g7.set(t,s),s}function fAe(t,e={}){const{checksum:n=!1}=e;return $ne(t),n?Une(t):t}function pAe(t,e={}){const n=One(`0x${aAe(t).slice(4)}`).substring(26);return fAe(`0x${n}`,e)}class QW extends Ps{constructor({address:e,cause:n}){super(`Address "${e}
153" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class mAe extends Ps{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class gAe extends Ps{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function yAe(t){if(t.length!==130&&t.length!==132)throw new wAe({signature:t});const e=BigInt($h(t,0,32)),n=BigInt($h(t,32,64)),i=(()=>{const s=+`0x${t.slice(130)}`;if(!Number.isNaN(s))try{return bAe(s)}catch{throw new vAe({value:s})}})();return typeof i>"u"?{r:e,s:n}:{r:e,s:n,yParity:i}}function bAe(t){if(t===0||t===27)return 0;if(t===1||t===28)return 1;if(t>=35)return t%2===0?1:0;throw new CAe({value:t})}class wAe extends Ps{constructor({signature:e}){super(`Value \`${e}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Ap(iM(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class vAe extends Ps{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class CAe extends Ps{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function xAe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Bne(t,e){return Array.isArray(e)?e.length===0?!0:t?e.every(n=>typeof n=="string"):e.every(n=>Number.isSafeInteger(n)):!1}function y_(t,e){if(typeof e!="string")throw new Error(`${t}: string expected`);return!0}function sM(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}function AP(t){if(!Array.isArray(t))throw new Error("array expected")}function b_(t,e){if(!Bne(!0,e))throw new Error(`${t}: array of strings expected`)}function EAe(t,e){if(!Bne(!1,e))throw new Error(`${t}: array of numbers expected`)}function _Ae(...t){const e=r=>r,n=(r,o)=>a=>r(o(a)),i=t.map(r=>r.encode).reduceRight(n,e),s=t.map(r=>r.decode).reduce(n,e);return{encode:i,decode:s}}function SAe(t){const e=typeof t=="string"?t.split(""):t,n=e.length;b_("alphabet",e);const i=new Map(e.map((s,r)=>[s,r]));return{encode:s=>(AP(s),s.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${t}`);return e[r]})),decode:s=>(AP(s),s.map(r=>{y_("alphabet.decode",r);const o=i.get(r);if(o===void 0)throw new Error(`Unknown letter: "${r}". Allowed: ${t}`);return o}))}}function AAe(t=""){return y_("join",t),{encode:e=>(b_("join.decode",e),e.join(t)),decode:e=>(y_("join.decode",e),e.split(t))}}function TAe(t,e="="){return sM(t),y_("padding",e),{encode(n){for(b_("padding.encode",n);n.length*t%8;)n.push(e);return n},decode(n){b_("padding.decode",n);let i=n.length;if(i*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;i>0&&n[i-1]===e;i--)if((i-1)*t%8===0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,i)}}}const Fne=(t,e)=>e===0?t:Fne(e,t%e),w_=(t,e)=>t+(e-Fne(t,e)),y7=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function XW(t,e,n,i){if(AP(t),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(w_(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${w_(e,n)}`);let s=0,r=0;const o=y7[e],a=y7[n]-1,c=[];for(const l of t){if(sM(l),l>=o)throw new Error(`convertRadix2: invalid data word=${l} from=${e}`);if(s=s<<e|l,r+e>32)throw new Error(`convertRadix2: carry overflow pos=${r} from=${e}`);for(r+=e;r>=n;r-=n)c.push((s>>r-n&a)>>>0);const d=y7[r];if(d===void 0)throw new Error("invalid carry");s&=d-1}if(s=s<<n-r&a,!i&&r>=e)throw new Error("Excess padding");if(!i&&s>0)throw new Error(`Non-zero padding: ${s}`);return i&&r>0&&c.push(s>>>0),c}function kAe(t,e=!1){if(sM(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(w_(8,t)>32||w_(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!xAe(n))throw new Error("radix2.encode input should be Uint8Array");return XW(Array.from(n),8,t,!e)},decode:n=>(EAe("radix2.decode",n),Uint8Array.from(XW(n,t,8,e)))}}const NAe=_Ae(kAe(5),SAe("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),TAe(5),AAe(""));function RAe(t){return pAe(PAe(t))}function PAe(t){const{payload:e,signature:n}=t,{r:i,s,yParity:r}=n,a=new TO.Signature(BigInt(i),BigInt(s)).addRecoveryBit(r).recoverPublicKey(iM(e).substring(2));return rAe(a)}function IAe(t){if(t.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let l=0;l<e.length;l++)e[l]=255;for(let l=0;l<t.length;
153l++){const d=t.charAt(l),h=d.charCodeAt(0);if(e[h]!==255)throw new TypeError(d+" is ambiguous");e[h]=l}const n=t.length,i=t.charAt(0),s=Math.log(n)/Math.log(256),r=Math.log(256)/Math.log(n);function o(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let d=0,h=0,p=0;const g=l.length;for(;p!==g&&l[p]===0;)p++,d++;const b=(g-p)*r+1>>>0,w=new Uint8Array(b);for(;p!==g;){let T=l[p],A=0;for(let k=b-1;(T!==0||A<h)&&k!==-1;k--,A++)T+=256*w[k]>>>0,w[k]=T%n>>>0,T=T/n>>>0;if(T!==0)throw new Error("Non-zero carry");h=A,p++}let C=b-h;for(;C!==b&&w[C]===0;)C++;let E=i.repeat(d);for(;C<b;++C)E+=t.charAt(w[C]);return E}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,h=0,p=0;for(;l[d]===i;)h++,d++;const g=(l.length-d)*s+1>>>0,b=new Uint8Array(g);for(;d<l.length;){const T=l.charCodeAt(d);if(T>255)return;let A=e[T];if(A===255)return;let k=0;for(let R=g-1;(A!==0||k<p)&&R!==-1;R--,k++)A+=n*b[R]>>>0,b[R]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");p=k,d++}let w=g-p;for(;w!==g&&b[w]===0;)w++;const C=new Uint8Array(h+(g-w));let E=h;for(;w!==g;)C[E++]=b[w++];return C}function c(l){const d=a(l);if(d)return d;throw new Error("Non-base"+n+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var DAe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const Wb=IAe(DAe);function OAe(t){const e=t.length;let n=0,i=0;for(;i<e;){let s=t.charCodeAt(i++);if((s&4294967168)===0){n++;continue}else if((s&4294965248)===0)n+=2;else{if(s>=55296&&s<=56319&&i<e){const r=t.charCodeAt(i);(r&64512)===56320&&(++i,s=((s&1023)<<10)+(r&1023)+65536)}(s&4294901760)===0?n+=3:n+=4}}return n}function MAe(t,e,n){const i=t.length;let s=n,r=0;for(;r<i;){let o=t.charCodeAt(r++);if((o&4294967168)===0){e[s++]=o;continue}else if((o&4294965248)===0)e[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&r<i){const a=t.charCodeAt(r);(a&64512)===56320&&(++r,o=((o&1023)<<10)+(a&1023)+65536)}(o&4294901760)===0?(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128):(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128)}e[s++]=o&63|128}}const LAe=new TextEncoder,$Ae=50;function UAe(t,e,n){LAe.encodeInto(t,e.subarray(n))}function BAe(t,e,n){t.length>$Ae?UAe(t,e,n):MAe(t,e,n)}const FAe=4096;function jne(t,e,n){let i=e;const s=i+n,r=[];let o="";for(;i<s;){const a=t[i++];if((a&128)===0)r.push(a);else if((a&224)===192){const c=t[i++]&63;r.push((a&31)<<6|c)}else if((a&240)===224){const c=t[i++]&63,l=t[i++]&63;r.push((a&31)<<12|c<<6|l)}else if((a&248)===240){const c=t[i++]&63,l=t[i++]&63,d=t[i++]&63;let h=(a&7)<<18|c<<12|l<<6|d;h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|h&1023),r.push(h)}else r.push(a);r.length>=FAe&&(o+=String.fromCharCode(...r),r.length=0)}return r.length>0&&(o+=String.fromCharCode(...r)),o}const jAe=new TextDecoder,VAe=200;function WAe(t,e,n){const i=t.subarray(e,e+n);return jAe.decode(i)}function qAe(t,e,n){return n>VAe?WAe(t,e,n):jne(t,e,n)}class dx{constructor(e,n){this.type=e,this.data=n}}class kc extends Error{constructor(e){super(e);const n=Object.create(kc.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:kc.name})}}const Pv=4294967295;function zAe(t,e,n){const i=n/4294967296,s=n;t.setUint32(e,i),t.setUint32(e+4,s)}function Vne(t,e,n){const i=Math.floor(n/4294967296),s=n;t.setUint32(e,i),t.setUint32(e+4,s)}function Wne(t,e){const n=t.getInt32(e),i=t.getUint32(e+4);return n*4294967296+i}function HAe(t,e){const n=t.getUint32(e),i=t.getUint32(e+4);return n*4294967296+i}const GAe=-1,KAe=4294967296-1,YAe=17179869184-1;function ZAe({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=YAe)if(e===0&&t<=KAe){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}else{const n=t/4294967296,i=t&4294967295,s=new Uint8Array(8),r=new DataView(s.buffer);return r.setUint32(0,e<<2|n&3),r.setUint32(4,i),s}else{const n=new Uint8Array(12),i=new DataView(n.buffer);return i.setUint32(0,e),Vne(i,4,t),n}}function QAe(t){const e=t.getTime(),n=Math.floor(e/1e3),i=(e-n*1e3)*1e6,s=Math.floor(i/1e9);return{sec:n+s,nsec:i-s*1e9}}function XAe(t){if(t instanceof Date){const e=QAe(t);return ZAe(e)}else return null}function JAe(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0),i=e.getUint32(4),s=(n&3)*4294967296+i,r=n>>>2;return{sec:s,nsec:r}}case 12:{const n=Wne(e,4),i=e.getUint32(0);return{sec:n,nsec:i}}default:throw new kc(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}function eTe(t){const e=JAe(t);return new Date(e.sec*1e3+e.nsec/1e6)}const tTe={type:GAe,encode:XAe,decode:eTe};class v_{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(tTe)}register({type:e,encode:n,decode:i}){if(e>=0)this.encoders[e]=n,this.decoders[e]=i;else{const s=-1-e;this.builtInEncoders[s]=n,this.builtInDecoders[s]=i}}tryToEncode(e,n){for(let i=0;i<this.builtInEncoders.length;i++){const s=this.builtInEncoders[i];if(s!=null){const r=s(e,n);if(r!=null){const o=-1-i;return new dx(o,r)}}}for(let i=0;i<this.encoders.length;i++){const s=this.encoders[i];if(s!=null){const r=s(e,n);if(r!=null){const o=i;return new dx(o,r)}}}return e instanceof dx?e:null}decode(e,n,i){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(e,n,i):new dx(n,e)}}v_.defaultCodec=new v_;function nTe(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function TP(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):nTe(t)?new Uint8Array(t):Uint8Array.from(t)}const iTe=100,sTe=2048;let rTe=class qne{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??v_.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??iTe,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??sTe,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new qne({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(e){const n=new ArrayBuffer(e),i=new Uint8Array(n),s=new DataView(n);i.set(this.bytes),this.view=s,this.bytes=i}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>
vendor: 17,780 bytes, line 153
153=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const i=OAe(e);this.ensureBufferSizeToWrite(5+i),this.writeStringHeader(i),BAe(e,this.bytes,this.pos),this.pos+=i}encodeObject(e,n){const i=this.extensionCodec.tryToEncode(e,this.context);if(i!=null)this.encodeExtension(i);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const i=TP(e);this.writeU8a(i)}encodeArray(e,n){const i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else if(i<4294967296)this.writeU8(221),this.writeU32(i);else throw new Error(`Too large array: ${i}`);for(const s of e)this.doEncode(s,n+1)}countWithoutUndefined(e,n){let i=0;for(const s of n)e[s]!==void 0&&i++;return i}encodeMap(e,n){const i=Object.keys(e);this.sortKeys&&i.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const r of i){const o=e[r];this.ignoreUndefined&&o===void 0||(this.encodeString(r),this.doEncode(o,n+1))}}encodeExtension(e){if(typeof e.data=="function"){const i=e.data(this.pos+6),s=i.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(e.type),this.writeU8a(i);return}const n=e.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),zAe(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),Vne(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function oTe(t,e){return new rTe(e).encodeSharedRef(t)}function b7(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}const aTe=16,cTe=16;class lTe{constructor(e=aTe,n=cTe){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=n,this.caches=[];for(let i=0;i<this.maxKeyLength;i++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,n,i){const s=this.caches[i-1];e:for(const r of s){const o=r.bytes;for(let a=0;a<i;a++)if(o[a]!==e[n+a])continue e;return r.str}return null}store(e,n){const i=this.caches[e.length-1],s={bytes:e,str:n};i.length>=this.maxLengthPerKey?i[Math.random()*i.length|0]=s:i.push(s)}decode(e,n,i){const s=this.find(e,n,i);if(s!=null)return this.hit++,s;this.miss++;const r=jne(e,n,i),o=Uint8Array.prototype.slice.call(e,n,n+i);return this.store(o,r),r}}const kP="array",h3="map_key",zne="map_value",uTe=t=>{if(typeof t=="string"||typeof t=="number")return t;throw new kc("The type of key must be string or number but "+typeof t)};class dTe{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const n=this.getUninitializedStateFromPool();n.type=kP,n.position=0,n.size=e,n.array=new Array(e)}pushMapState(e){const n=this.getUninitializedStateFromPool();n.type=h3,n.readCount=0,n.size=e,n.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===kP){const i=e;i.size=0,i.array=void 0,i.position=0,i.type=void 0}if(e.type===h3||e.type===zne){const i=e;i.size=0,i.map=void 0,i.readCount=0,i.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const Iv=-1,rM=new DataView(new ArrayBuffer(0)),hTe=new Uint8Array(rM.buffer);try{rM.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const JW=new RangeError("Insufficient data"),fTe=new lTe;let pTe=class Hne{constructor(e){this.totalPos=0,this.pos=0,this.view=rM,this.bytes=hTe,this.headByte=Iv,this.stack=new dTe,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??v_.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.rawStrings=(e==null?void 0:e.rawStrings)??!1,this.maxStrLength=(e==null?void 0:e.maxStrLength)??Pv,this.maxBinLength=(e==null?void 0:e.maxBinLength)??Pv,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??Pv,this.maxMapLength=(e==null?void 0:e.maxMapLength)??Pv,this.maxExtLength=(e==null?void 0:e.maxExtLength)??Pv,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:fTe,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??uTe}clone(){return new Hne({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=Iv,this.stack.reset()}setBuffer(e){const n=TP(e);this.bytes=n,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===Iv&&!this.hasRemaining(1))this.setBuffer(e);else{const n=this.bytes.subarray(this.pos),i=TP(e),s=new Uint8Array(n.length+i.length);s.set(n),s.set(i,n.length),this.setBuffer(s)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:n,pos:i}=this;return new RangeError(`Extra ${n.byteLength-i} of ${n.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let n=!1,i;for await(const a of e){if(n)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{i=this.doDecodeSync(),n=!0}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}if(n){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return i}const{headByte:s,pos:r,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${b7(s)} at ${o} (${r} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,n){if(this.entered){yield*this.clone().decodeMultiAsync(e,n);return}try{this.entered=!0;let i=n,s=-1;for await(const r of e){if(n&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(r),i&&(s=this.readArraySize(),i=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let n;if(e>=224)n=e-256;else if(e<192)if(e<128)n=e;else if(e<144){const s=e-128;if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(e<160){const s=e-144;if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else{const s=e-160;n=this.decodeString(s,0)}else if(e===192)n=null;else if(e===194)n=!1;else if(e===195)n=!0;else if(e===202)n=this.readF32();else if(e===203)n=this.readF64();else if(e===204)n=this.readU8();else if(e===205)n=this.readU16();else if(e===206)n=this.readU32();else if(e===207)this.useBigInt64?n=this.readU64AsBigInt():n=this.readU64();else if(e===208)n=this.readI8();else if(e===209)n=this.readI16();else if(e===210)n=this.readI32();else if(e===211)this.useBigInt64?n=this.readI64AsBigInt():n=this.readI64();else if(e===217){const s=this.lookU8();n=this.decodeString(s,1)}else if(e===218){const s=this.lookU16();n=this.decodeString(s,2)}else if(e===219){const s=this.lookU32();n=this.decodeString(s,4)}else if(e===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else if(e===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else if(e===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(e===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(e===196){const s=this.lookU8();n=this.decodeBinary(s,1)}else if(e===197){const s=this.lookU16();n=this.decodeBinary(s,2)}else if(e===198){const s=this.lookU32();n=this.decodeBinary(s,4)}else if(e===212)n=this.decodeExtension(1,0);else if(e===213)n=this.decodeExtension(2,0);else if(e===214)n=this.decodeExtension(4,0);else if(e===215)n=this.decodeExtension(8,0);else if(e===216)n=this.decodeExtension(16,0);else if(e===199){const s=this.lookU8();n=this.decodeExtension(s,1)}else if(e===200){const s=this.lookU16();n=this.decodeExtension(s,2)}else if(e===201){const s=this.lookU32();n=this.decodeExtension(s,4)}else throw new kc(`Unrecognized type byte: ${b7(e)}`);this.complete();const i=this.stack;for(;i.length>0;){const s=i.top();if(s.type===kP)if(s.array[s.position]=n,s.position++,s.position===s.size)n=s.array,i.release(s);else continue e;else if(s.type===h3){if(n==="__proto__")throw new kc("The key __proto__ is not allowed");s.key=this.mapKeyConverter(n),s.type=zne;continue e}else if(s.map[s.key]=n,s.readCount++,s.readCount===s.size)n=s.map,i.release(s);else{s.key=null,s.type=h3;continue e}}return n}}readHeadByte(){return this.headByte===Iv&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=Iv}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new kc(`Unrecognized array type byte: ${b7(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new kc(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new kc(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,n){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,n):this.decodeBinary(e,n)}decodeUtf8String(e,n){var r;if(e>this.maxStrLength)throw new kc(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+n+e)throw JW;const i=this.pos+n;let s;return this.stateIsMapKey()&&((r=this.keyDecoder)!=null&&r.canBeCached(e))?s=this.keyDecoder.decode(this.bytes,i,e):s=qAe(this.bytes,i,e),this.pos+=n+e,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===h3:!1}decodeBinary(e,n){if(e>this.maxBinLength)throw new kc(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+n))throw JW;const i=this.pos+n,s=this.bytes.subarray(i,i+e);return this.pos+=n+e,s}decodeExtension(e,n){if(e>this.maxExtLength)throw new kc(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const i=this.view.getInt8(this.pos+n),s=this.decodeBinary(e,n+1);return this.extensionCodec.decode(s,i,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=HAe(this.view,this.pos);return this.pos+=8,e}readI64(){const e=Wne(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function mTe(t,e){return new pTe(e).decode(t)}function oM(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Gne(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?oM(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function f3(t,e){e||(e=t.reduce((s,r)=>s+r.length,0));const n=Gne(e);let i=0;for(const s of t)n.set(s,i),i+=s.length;return oM(n)}function gTe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var s=0;s<t.length;s++){var r=t.charAt(s),o=r.charCodeAt(0);if(n[o]!==255)throw new TypeError(r+" is ambiguous");n[o]=s}var a=t.length,c=t.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function h(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var w=0,C=0,E=0,T=b.length;E!==T&&b[E]===0;)E++,w++;for(var A=(T-E)*d+1>>>0,k=new Uint8Array(A);E!==T;){for(var R=b[E],P=0,B=A-1;(R!==0||P<C)&&B!==-1;B--,P++)R+=256*k[B]>>>0,k[B]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");C=P,E++}for(var F=A-C;F!==A&&k[F]===0;)F++;for(var z=c.repeat(w);F<A;++F)z+=t.charAt(k[F]);return z}function p(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var w=0;if(b[w]!==" "){for(var C=0,E=0;b[w]===c;)C++,w++;for(var T=(b.length-w)*l+1>>>0,A=new Uint8Array(T);b[w];){var k=n[b.charCodeAt(w)];if(k===255)return;for(var R=0,P=T-1;(k!==0||R<E)&&P!==-1;P--,R++)k+=a*A[P]>>>0,A[P]=k%256>>>0,k=k/256>>>0;if(k!==0)throw new Error("Non-zero carry");E=R,w++}if(b[w]!==" "){for(var B=T-E;B!==T&&A[B]===0;)B++;for(var F=new Uint8Array(C+(T-B)),z=C;B!==T;)F[z++]=A[B++];return F}}}function g(b){var w=p(b);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:p,decode:g}}var yTe=gTe,bTe=yTe;const wTe=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},vTe=t=>new TextEncoder().encode(t),CTe=t=>new TextDecoder().decode(t);class xTe{constructor(e,n,i){this.name=e,this.prefix=n,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class ETe{constructor(e,n,i){if(this.name=e,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name}
153 decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Kne(this,e)}}class _Te{constructor(e){this.decoders=e}or(e){return Kne(this,e)}decode(e){const n=e[0],i=this.decoders[n];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Kne=(t,e)=>new _Te({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class STe{constructor(e,n,i,s){this.name=e,this.prefix=n,this.baseEncode=i,this.baseDecode=s,this.encoder=new xTe(e,n,i),this.decoder=new ETe(e,n,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const dS=({name:t,prefix:e,encode:n,decode:i})=>new STe(t,e,n,i),$6=({prefix:t,name:e,alphabet:n})=>{const{encode:i,decode:s}=bTe(n,e);return dS({prefix:t,name:e,encode:i,decode:r=>wTe(s(r))})},ATe=(t,e,n,i)=>{const s={};for(let d=0;d<e.length;++d)s[e[d]]=d;let r=t.length;for(;t[r-1]==="=";)--r;const o=new Uint8Array(r*n/8|0);let a=0,c=0,l=0;for(let d=0;d<r;++d){const h=s[t[d]];if(h===void 0)throw new SyntaxError(`Non-${i} character`);c=c<<n|h,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},TTe=(t,e,n)=>{const i=e[e.length-1]==="=",s=(1<<n)-1;let r="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>n;)o-=n,r+=e[s&a>>o];if(o&&(r+=e[s&a<<n-o]),i)for(;r.length*n&7;)r+="=";return r},Ao=({name:t,prefix:e,bitsPerChar:n,alphabet:i})=>dS({prefix:e,name:t,encode(s){return TTe(s,i,n)},decode(s){return ATe(s,i,n,t)}}),kTe=dS({prefix:"\0",name:"identity",encode:t=>CTe(t),decode:t=>vTe(t)}),NTe=Object.freeze(Object.defineProperty({__proto__:null,identity:kTe},Symbol.toStringTag,{value:"Module"})),RTe=Ao({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),PTe=Object.freeze(Object.defineProperty({__proto__:null,base2:RTe},Symbol.toStringTag,{value:"Module"})),ITe=Ao({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),DTe=Object.freeze(Object.defineProperty({__proto__:null,base8:ITe},Symbol.toStringTag,{value:"Module"})),OTe=$6({prefix:"9",name:"base10",alphabet:"0123456789"}),MTe=Object.freeze(Object.defineProperty({__proto__:null,base10:OTe},Symbol.toStringTag,{value:"Module"})),LTe=Ao({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$Te=Ao({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),UTe=Object.freeze(Object.defineProperty({__proto__:null,base16:LTe,base16upper:$Te},Symbol.toStringTag,{value:"Module"})),BTe=Ao({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),FTe=Ao({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),jTe=Ao({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),VTe=Ao({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),WTe=Ao({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qTe=Ao({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zTe=Ao({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),HTe=Ao({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),GTe=Ao({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),KTe=Object.freeze(Object.defineProperty({__proto__:null,base32:BTe,base32hex:WTe,base32hexpad:zTe,base32hexpadupper:HTe,base32hexupper:qTe,base32pad:jTe,base32padupper:VTe,base32upper:FTe,base32z:GTe},Symbol.toStringTag,{value:"Module"})),YTe=$6({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ZTe=$6({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),QTe=Object.freeze(Object.defineProperty({__proto__:null,base36:YTe,base36upper:ZTe},Symbol.toStringTag,{value:"Module"})),XTe=$6({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),JTe=$6({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),e7e=Object.freeze(Object.defineProperty({__proto__:null,base58btc:XTe,base58flickr:JTe},Symbol.toStringTag,{value:"Module"})),t7e=Ao({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
153+/",bitsPerChar:6}),n7e=Ao({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),i7e=Ao({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),s7e=Ao({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),r7e=Object.freeze(Object.defineProperty({__proto__:null,base64:t7e,base64pad:n7e,base64url:i7e,base64urlpad:s7e},Symbol.toStringTag,{value:"Module"})),Yne=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),o7e=Yne.reduce((t,e,n)=>(t[n]=e,t),[]),a7e=Yne.reduce((t,e,n)=>(t[e.codePointAt(0)]=n,t),[]);function c7e(t){return t.reduce((e,n)=>(e+=o7e[n],e),"")}function l7e(t){const e=[];for(const n of t){const i=a7e[n.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${n}`);e.push(i)}return new Uint8Array(e)}const u7e=dS({prefix:"ð",name:"base256emoji",encode:c7e,decode:l7e}),d7e=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:u7e},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const eq={...NTe,...PTe,...DTe,...MTe,...UTe,...KTe,...QTe,...e7e,...r7e,...d7e};function Zne(t,e,n,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:i}}}const tq=Zne("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),w7=Zne("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{t=t.substring(1);const e=Gne(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),Qne={utf8:tq,"utf-8":tq,hex:eq.base16,latin1:w7,ascii:w7,binary:w7,...eq};function Al(t,e="utf8"){const n=Qne[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?oM(globalThis.Buffer.from(t,"utf-8")):n.decoder.decode(`${n.prefix}${t}`)}function Xa(t,e="utf8"){const n=Qne[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}const h7e={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var v7,nq;function Xne(){if(nq)return v7;nq=1;const t="Input must be an string, Buffer or Uint8Array";function e(o){let a;if(o instanceof Uint8Array)a=o;
vendor: 25,901 bytes, lines 153-155
153else if(typeof o=="string")a=new TextEncoder().encode(o);else throw new Error(t);return a}function n(o){return Array.prototype.map.call(o,function(a){return(a<16?"0":"")+a.toString(16)}).join("")}function i(o){return(4294967296+o).toString(16).substring(1)}function s(o,a,c){let l=` 154`+o+" = ";for(let d=0;d<a.length;d+=2){if(c===32)l+=i(a[d]).toUpperCase(),l+=" ",l+=i(a[d+1]).toUpperCase();else if(c===64)l+=i(a[d+1]).toUpperCase(),l+=i(a[d]).toUpperCase();else throw new Error("Invalid size "+c);d%6===4?l+=` 155`+new Array(o.length+4).join(" "):d<a.length-2&&(l+=" ")}console.log(l)}function r(o,a,c){let l=new Date().getTime();const d=new Uint8Array(a);for(let p=0;p<a;p++)d[p]=p%256;const h=new Date().getTime();console.log("Generated random input in "+(h-l)+"ms"),l=h;for(let p=0;p<c;p++){const g=o(d),b=new Date().getTime(),w=b-l;l=b,console.log("Hashed in "+w+"ms: "+g.substring(0,20)+"..."),console.log(Math.round(a/(1<<20)/(w/1e3)*100)/100+" MB PER SECOND")}}return v7={normalizeInput:e,toHex:n,debugPrint:s,testSpeed:r},v7}var C7,iq;function f7e(){if(iq)return C7;iq=1;const t=Xne();function e(E,T,A){const k=E[T]+E[A];let R=E[T+1]+E[A+1];k>=4294967296&&R++,E[T]=k,E[T+1]=R}function n(E,T,A,k){let R=E[T]+A;A<0&&(R+=4294967296);let P=E[T+1]+k;R>=4294967296&&P++,E[T]=R,E[T+1]=P}function i(E,T){return E[T]^E[T+1]<<8^E[T+2]<<16^E[T+3]<<24}function s(E,T,A,k,R,P){const B=l[R],F=l[R+1],z=l[P],K=l[P+1];e(c,E,T),n(c,E,B,F);let q=c[k]^c[E],G=c[k+1]^c[E+1];c[k]=G,c[k+1]=q,e(c,A,k),q=c[T]^c[A],G=c[T+1]^c[A+1],c[T]=q>>>24^G<<8,c[T+1]=G>>>24^q<<8,e(c,E,T),n(c,E,z,K),q=c[k]^c[E],G=c[k+1]^c[E+1],c[k]=q>>>16^G<<16,c[k+1]=G>>>16^q<<16,e(c,A,k),q=c[T]^c[A],G=c[T+1]^c[A+1],c[T]=G>>>31^q<<1,c[T+1]=q>>>31^G<<1}const r=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),o=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],a=new Uint8Array(o.map(function(E){return E*2})),c=new Uint32Array(32),l=new Uint32Array(32);function d(E,T){let A=0;for(A=0;A<16;A++)c[A]=E.h[A],c[A+16]=r[A];for(c[24]=c[24]^E.t,c[25]=c[25]^E.t/4294967296,T&&(c[28]=~c[28],c[29]=~c[29]),A=0;A<32;A++)l[A]=i(E.b,4*A);for(A=0;A<12;A++)s(0,8,16,24,a[A*16+0],a[A*16+1]),s(2,10,18,26,a[A*16+2],a[A*16+3]),s(4,12,20,28,a[A*16+4],a[A*16+5]),s(6,14,22,30,a[A*16+6],a[A*16+7]),s(0,10,20,30,a[A*16+8],a[A*16+9]),s(2,12,22,24,a[A*16+10],a[A*16+11]),s(4,14,16,26,a[A*16+12],a[A*16+13]),s(6,8,18,28,a[A*16+14],a[A*16+15]);for(A=0;A<16;A++)E.h[A]=E.h[A]^c[A]^c[A+16]}const h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(E,T,A,k){if(E===0||E>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(T&&T.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(A&&A.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(k&&k.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const R={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:E};h.fill(0),h[0]=E,T&&(h[1]=T.length),h[2]=1,h[3]=1,A&&h.set(A,32),k&&h.set(k,48);for(let P=0;P<16;P++)R.h[P]=r[P]^i(h,P*4);return T&&(g(R,T),R.c=128),R}function g(E,T){for(let A=0;A<T.length;A++)E.c===128&&(E.t+=E.c,d(E,!1),E.c=0),E.b[E.c++]=T[A]}function b(E){for(E.t+=E.c;E.c<128;)E.b[E.c++]=0;d(E,!0);const T=new Uint8Array(E.outlen);for(let A=0;A<E.outlen;A++)T[A]=E.h[A>>2]>>8*(A&3);return T}function w(E,T,A,k,R){A=A||64,E=t.normalizeInput(E),k&&(k=t.normalizeInput(k)),R&&(R=t.normalizeInput(R));const P=p(A,T,k,R);return g(P,E),b(P)}function C(E,T,A,k,R){const P=w(E,T,A,k,R);return t.toHex(P)}return C7={blake2b:w,blake2bHex:C,blake2bInit:p,blake2bUpdate:g,blake2bFinal:b},C7}var x7,sq;function p7e(){if(sq)return x7;sq=1;const t=Xne();function e(b,w){return b[w]^b[w+1]<<8^b[w+2]<<16^b[w+3]<<24}function n(b,w,C,E,T,A){o[b]=o[b]+o[w]+T,o[E]=i(o[E]^o[b],16),o[C]=o[C]+o[E],o[w]=i(o[w]^o[C],12),o[b]=o[b]+o[w]+A,o[E]=i(o[E]^o[b],8),o[C]=o[C]+o[E],o[w]=i(o[w]^o[C],7)}function i(b,w){return b>>>w^b<<32-w}const s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),r=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),o=new Uint32Array(16),a=new Uint32Array(16);function c(b,w){let C=0;for(C=0;C<8;C++)o[C]=b.h[C],o[C+8]=s[C];for(o[12]^=b.t,o[13]^=b.t/4294967296,w&&(o[14]=~o[14]),C=0;C<16;C++)a[C]=e(b.b,4*C);for(C=0;C<10;C++)n(0,4,8,12,a[r[C*16+0]],a[r[C*16+1]]),n(1,5,9,13,a[r[C*16+2]],a[r[C*16+3]]),n(2,6,10,14,a[r[C*16+4]],a[r[C*16+5]]),n(3,7,11,15,a[r[C*16+6]],a[r[C*16+7]]),n(0,5,10,15,a[r[C*16+8]],a[r[C*16+9]]),n(1,6,11,12,a[r[C*16+10]],a[r[C*16+11]]),n(2,7,8,13,a[r[C*16+12]],a[r[C*16+13]]),n(3,4,9,14,a[r[C*16+14]],a[r[C*16+15]]);for(C=0;C<8;C++)b.h[C]^=o[C]^o[C+8]}function l(b,w){if(!(b>0&&b<=32))throw new Error("Incorrect output length, should be in [1, 32]");const C=w?w.length:0;if(w&&!(C>0&&C<=32))throw new Error("Incorrect key length, should be in [1, 32]");const E={h:new Uint32Array(s),b:new Uint8Array(64),c:0,t:0,outlen:b};return E.h[0]^=16842752^C<<8^b,C>0&&(d(E,w),E.c=64),E}function d(b,w){for(let C=0;C<w.length;C++)b.c===64&&(b.t+=b.c,c(b,!1),b.c=0),b.b[b.c++]=w[C]}function h(b){for(b.t+=b.c;b.c<64;)b.b[b.c++]=0;c(b,!0);const w=new Uint8Array(b.outlen);for(let C=0;C<b.outlen;C++)w[C]=b.h[C>>2]>>8*(C&3)&255;return w}function p(b,w,C){C=C||32,b=t.normalizeInput(b);const E=l(C,w);return d(E,b),h(E)}function g(b,w,C){const E=p(b,w,C);return t.toHex(E)}return x7={blake2s:p,blake2sHex:g,blake2sInit:l,blake2sUpdate:d,blake2sFinal:h},x7}var E7,rq;function m7e(){if(rq)return E7;rq=1;const t=f7e(),e=p7e();return E7={blake2b:t.blake2b,blake2bHex:t.blake2bHex,blake2bInit:t.blake2bInit,blake2bUpdate:t.blake2bUpdate,blake2bFinal:t.blake2bFinal,blake2s:e.blake2s,blake2sHex:e.blake2sHex,blake2sInit:e.blake2sInit,blake2sUpdate:e.blake2sUpdate,blake2sFinal:e.blake2sFinal},E7}var g7e=m7e(),y7e={};const b7e=":";function of(t){const[e,n]=t.split(b7e);return{namespace:e,reference:n}}function Jne(t,e){return t.includes(":")?[t]:e.chains||[]}var w7e=Object.defineProperty,v7e=Object.defineProperties,C7e=Object.getOwnPropertyDescriptors,oq=Object.getOwnPropertySymbols,x7e=Object.prototype.hasOwnProperty,E7e=Object.prototype.propertyIsEnumerable,NP=(t,e,n)=>e in t?w7e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,aq=(t,e)=>{for(var n in e||(e={}))x7e.call(e,n)&&NP(t,n,e[n]);if(oq)for(var n of oq(e))E7e.call(e,n)&&NP(t,n,e[n]);return t},_7e=(t,e)=>v7e(t,C7e(e)),cq=(t,e,n)=>NP(t,typeof e!="symbol"?e+"":e,n);const S7e="ReactNative",Bc={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},A7e="js";function C_(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function jp(){return!Ef.getDocument()&&!!Ef.getNavigator()&&navigator.product===S7e}function T7e(){return jp()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function k7e(){return jp()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function qb(){return!C_()&&!!Ef.getNavigator()&&!!Ef.getDocument()}function U6(){return jp()?Bc.reactNative:C_()?Bc.node:qb()?Bc.browser:Bc.unknown}function lq(){var t;try{return jp()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function N7e(t,e){const n=new URLSearchParams(t);return Object.entries(e).sort(([i],[s])=>i.localeCompare(s)).forEach(([i,s])=>{s!=null&&n.set(i,String(s))}),n.toString()}function R7e(t){var e,n;const i=eie();try{return t!=null&&t.url&&i.url&&new URL(t.url).host!==new URL(i.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${i.url}. This is probably unintended and can lead to issues.`),t.url=i.url),(e=t==null?void 0:t.icons)!=null&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(s=>s!=="")),_7e(aq(aq({},i),t),{url:(t==null?void 0:t.url)||i.url,name:(t==null?void 0:t.name)||i.name,description:(t==null?void 0:t.description)||i.description,icons:(n=t==null?void 0:t.icons)!=null&&n.length&&t.icons.length>0?t.icons:i.icons})}catch(s){return console.warn("Error populating app metadata",s),t||i}}function eie(){return P9e.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function P7e(){if(U6()===Bc.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:n,Version:i}=global.Platform;return[n,i].join("-")}const t=_9e();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function I7e(){var t;const e=U6();return e===Bc.browser?[e,((t=Ef.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function tie(t,e,n){const i=P7e(),s=I7e();return[[t,e].join("-"),[A7e,n].join("-"),i,s].join("/")}function D7e({protocol:t,version:e,relayUrl:n,sdkVersion:i,auth:s,projectId:r,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=n.split("?"),d=tie(t,e,i),h={auth:s,ua:d,projectId:r,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},p=N7e(l[1]||"",h);return l[0]+"?"+p}function Wm(t,e){return t.filter(n=>e.includes(n)).length===t.length}function RP(t){return Object.fromEntries(t.entries())}function PP(t){return new Map(Object.entries(t))}function Nm(t=wt.FIVE_MINUTES,e){const n=wt.toMiliseconds(t||wt.FIVE_MINUTES);let i,s,r,o;return{resolve:a=>{r&&i&&(clearTimeout(r),i(a),o=Promise.resolve(a))},reject:a=>{r&&s&&(clearTimeout(r),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);r=setTimeout(()=>{const l=new Error(e);o=Promise.reject(l),c(l)},n),i=a,s=c})}}function wd(t,e,n){return new Promise(async(i,s)=>{const r=setTimeout(()=>s(new Error(n)),e);try{const o=await t;i(o)}catch(o){s(o)}clearTimeout(r)})}function nie(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function O7e(t){return nie("topic",t)}function M7e(t){return nie("id",t)}function iie(t){const[e,n]=t.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof n=="string")i.topic=n;else if(e==="id"&&Number.isInteger(Number(n)))i.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${n}`);return i}function yr(t,e){return wt.fromMiliseconds(Date.now()+wt.toMiliseconds(t))}function yd(t){return Date.now()>=wt.toMiliseconds(t)}function Vi(t,e){return`${t}${e?`:${e}`:""}`}function Ad(t=[],e=[]){return[...new Set([...t,...e])]}async function L7e({id:t,topic:e,wcDeepLink:n}){var i;try{if(!n)return;const s=typeof n=="string"?JSON.parse(n):n,r=s==null?void 0:s.href;if(typeof r!="string")return;const o=$7e(r,t,e),a=U6();if(a===Bc.browser){if(!((i=Ef.getDocument())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}U7e(o)}else a===Bc.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(s){console.error(s)}}function $7e(t,e,n){const i=`requestId=${e}&sessionTopic=${n}`;t.endsWith("/")&&(t=t.slice(0,-1));let s=`${t}`;if(t.startsWith("https://t.me")){const r=t.includes("?")?"&startapp=":"?startapp=";s=`${s}${r}${V7e(i,!0)}`}else s=`${s}/wc?${i}`;return s}function U7e(t){let e="_self";j7e()?e="_top":(F7e()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"),window.open(t,e,"noreferrer noopener")}async function B7e(t,e){let n="";try{if(qb()&&(n=localStorage.getItem(e),n))return n;n=await t.getItem(e)}catch(i){console.error(i)}return n}function uq(t,e){if(!t.includes(e))return null;const n=t.split(/([&,?,=])/),i=n.indexOf(e);return n[i+2]}function dq(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function aM(){return typeof process<"u"&&y7e.IS_VITEST==="true"}function F7e(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function j7e(){try{return window.self!==window.top}catch{return!1}}function V7e(t,e=!1){const n=Buffer.from(t).toString("base64");return e?n.replace(/[=]/g,""):n}function sie(t){return Buffer.from(t,"base64").toString("utf-8")}function W7e(t){return new Promise(e=>setTimeout(e,t))}let q7e=class{constructor({limit:e}){cq(this,"limit"),cq(this,"set"),this.limit=e,this.set=new Set}add(e){if(!this.set.has(e)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(e)}}has(e){return this.set.has(e)}};const hx=BigInt(2**32-1),hq=BigInt(32);function rie(t,e=!1){return e?{h:Number(t&hx),l:Number(t>>hq&hx)}:{h:Number(t>>hq&hx)|0,l:Number(t&hx)|0}}function oie(t,e=!1){const n=t.length;let i=new Uint32Array(n),s=new Uint32Array(n);for(let r=0;r<n;r++){const{h:o,l:a}=rie(t[r],e);[i[r],s[r]]=[o,a]}return[i,s]}const fq=(t,e,n)=>t>>>n,pq=(t,e,n)=>t<<32-n|e>>>n,B0=(t,e,n)=>t>>>n|e<<32-n,F0=(t,e,n)=>t<<32-n|e>>>n,t3=(t,e,n)=>t<<64-n|e>>>n-32,n3=(t,e,n)=>t>>>n-32|e<<64-n,z7e=(t,e)=>e,H7e=(t,e)=>t,G7e=(t,e,n)=>t<<n|e>>>32-n,K7e=(t,e,n)=>e<<n|t>>>32-n,Y7e=(t,e,n)=>e<<n-32|t>>>64-n,Z7e=(t,e,n)=>t<<n-32|e>>>64-n;function lu(t,e,n,i){const s=(e>>>0)+(i>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const cM=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),lM=(t,e,n,i)=>e+n+i+(t/2**32|0)|0,Q7e=(t,e,n,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0),X7e=(t,e,n,i,s)=>e+n+i+s+(t/2**32|0)|0,J7e=(t,e,n,i,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(i>>>0)+(s>>>0),eke=(t,e,n,i,s,r)=>e+n+i+s+r+(t/2**32|0)|0,Ry=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function hS(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function _f(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function $u(t,...e){if(!hS(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function fS(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");_f(t.outputLen),_f(t.blockLen)}function Tp(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function uM(t,e){$u(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function S5(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Pl(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function _7(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function od(t,e){return t<<32-e|t>>>e}const aie=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function cie(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const Oh=aie?t=>t:t=>cie(t);function tke(t){for(let e=0;e<t.length;e++)t[e]=cie(t[e]);return t}const j0=aie?t=>t:tke,lie=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",nke=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function C2(t){if($u(t),lie)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=nke[t[n]];return e}const kh={_0:48,_9:57,A:65,F:70,a:97,f:102};function mq(t){if(t>=kh._0&&t<=kh._9)return t-kh._0;if(t>=kh.A&&t<=kh.F)return t-(kh.A-10);if(t>=kh.a&&t<=kh.f)return t-(kh.a-10)}function x_(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(lie)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(n);for(let s=0,r=0;s<n;s++,r+=2){const o=mq(t.charCodeAt(r)),a=mq(t.charCodeAt(r+1));if(o===void 0||a===void 0){const c=t[r]+t[r+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+r)}i[s]=o*16+a}return i}function uie(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Nu(t){return typeof t=="string"&&(t=uie(t)),$u(t),t}function z0(...t){let e=0;for(let i=0;i<t.length;i++){const s=t[i];$u(s),e+=s.length}const n=new Uint8Array(e);for(let i=0,s=0;i<t.length;i++){const r=t[i];n.set(r,s),s+=r.length}return n}let pS=class{};function B6(t){const e=i=>t().update(Nu(i)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function ike(t){const e=(i,s)=>t(s).update(Nu(i)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=i=>t(i),e}function _1(t=32){if(Ry&&typeof Ry.getRandomValues=="function")return Ry.getRandomValues(new Uint8Array(t));if(Ry&&typeof Ry.randomBytes=="function")return Uint8Array.from(Ry.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const ske=BigInt(0),Dv=BigInt(1),rke=BigInt(2),oke=BigInt(7),ake=BigInt(256),cke=BigInt(113),die=[],hie=[],fie=[];for(let t=0,e=Dv,n=1,i=0;t<24;t++){[n,i]=[i,(2*n+3*i)%5],die.push(2*(5*i+n)),hie.push((t+1)*(t+2)/2%64);let s=ske;for(let r=0;r<7;r++)e=(e<<Dv^(e>>oke)*cke)%ake,e&rke&&(s^=Dv<<(Dv<<BigInt(r))-Dv);fie.push(s)}const pie=oie(fie,!0),lke=pie[0],uke=pie[1],gq=(t,e,n)=>n>32?Y7e(t,e,n):G7e(t,e,n),yq=(t,e,n)=>n>32?Z7e(t,e,n):K7e(t,e,n);function dke(t,e=24){const n=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],d=n[c+1],h=gq(l,d,1)^n[a],p=yq(l,d,1)^n[a+1];for(let g=0;g<50;g+=10)t[o+g]^=h,t[o+g+1]^=p}let s=t[2],r=t[3];for(let o=0;o<24;o++){const a=hie[o],c=gq(s,r,a),l=yq(s,r,a),d=die[o];s=t[d],r=t[d+1],t[d]=c,t[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}t[0]^=lke[i],t[1]^=uke[i]}Pl(n)}let hke=class mie extends pS{constructor(e,n,i,s=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=i,this.enableXOF=s,this.rounds=r,_f(i),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=S5(this.state)}clone(){return this._cloneInto()}keccak(){j0(this.state32),dke(this.state32,this.rounds),j0(this.state32),this.posOut=0,this.pos=0}update(e){Tp(this),e=Nu(e),$u(e);const{blockLen:n,state:i}=this,s=e.length;for(let r=0;r<s;){const o=Math.min(n-this.pos,s-r);for(let a=0;a<o;a++)i[this.pos++]^=e[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:i,blockLen:s}=this;e[i]^=n,(n&128)!==0&&i===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Tp(this,!1),$u(e),this.finish();const n=this.state,{blockLen:i}=this;for(let s=0,r=e.length;s<r;){this.posOut>=i&&this.keccak();const o=Math.min(i-this.posOut,r-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return _f(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(uM(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Pl(this.state)}_cloneInto(e){const{blockLen:n,suffix:i,outputLen:s,rounds:r,enableXOF:o}=this;return e||(e=new mie(n,i,s,o,r)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=r,e.suffix=i,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}};const fke=(t,e,n)=>B6(()=>new hke(e,t,n)),pke=fke(1,136,256/8);function mke(t,e,n,i){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,i);const s=BigInt(32),r=BigInt(4294967295),o=Number(n>>s&r),a=Number(n&r),c=i?4:0,l=i?0:4;t.setUint32(e+c,o,i),t.setUint32(e+l,a,i)}function gke(t,e,n){return t&e^~t&n}function yke(t,e,n){return t&e^t&n^e&n}let gie=class extends pS{constructor(e,n,i,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=i,this.isLE=s,this.buffer=new Uint8Array(e),this.view=_7(this.buffer)}update(e){Tp(this),e=Nu(e),$u(e);const{view:n,buffer:i,blockLen:s}=this,r=e.length;for(let o=0;o<r;){const a=Math.min(s-this.pos,r-o);if(a===s){const c=_7(e);for(;s<=r-o;o+=s)this.process(c,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Tp(this),uM(e,this),this.finished=!0;const{buffer:n,view:i,blockLen:s,isLE:r}=this;let{pos:o}=this;n[o++]=128,Pl(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(i,0),o=0);for(let h=o;h<s;h++)n[h]=0;mke(i,s-8,BigInt(this.length*8),r),this.process(i,0);const a=_7(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)a.setUint32(4*h,d[h],r)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const i=e.slice(0,n);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:i,length:s,finished:r,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=r,e.length=s,e.pos=a,s%n&&e.buffer.set(i),e}clone(){return this._cloneInto()}};const _0=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oo=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Mo=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),bke=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),S0=new Uint32Array(64);class wke extends gie{constructor(e=32){super(64,e,8,!1),this.A=_0[0]|0,this.B=_0[1]|0,this.C=_0[2]|0,this.D=_0[3]|0,this.E=_0[4]|0,this.F=_0[5]|0,this.G=_0[6]|0,this.H=_0[7]|0}get(){const{A:e,B:n,C:i,D:s,E:r,F:o,G:a,H:c}=this;return[e,n,i,s,r,o,a,c]}set(e,n,i,s,r,o,a,c){this.A=e|0,this.B=n|0,this.C=i|0,this.D=s|0,this.E=r|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,n){for(let h=0;h<16;h++,n+=4)S0[h]=e.getUint32(n,!1);for(let h=16;h<64;h++){const p=S0[h-15],g=S0[h-2],b=od(p,7)^od(p,18)^p>>>3,w=od(g,17)^od(g,19)^g>>>10;S0[h]=w+S0[h-7]+b+S0[h-16]|0}let{A:i,B:s,C:r,D:o,E:a,F:c,G:l,H:d}=this;for(let h=0;h<64;h++){const p=od(a,6)^od(a,11)^od(a,25),g=d+p+gke(a,c,l)+bke[h]+S0[h]|0,b=(od(i,2)^od(i,13)^od(i,22))+yke(i,s,r)|0;d=l,l=c,c=a,a=o+g|0,o=r,r=s,s=i,i=g+b|0}i=i+this.A|0,s=s+this.B|0,r=r+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(i,s,r,o,a,c,l,d)}roundClean(){Pl(S0)}destroy(){this.set(0,0,0,0,0,0,0,0),Pl(this.buffer)}}const yie=oie(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
1555771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),vke=yie[0],Cke=yie[1],A0=new Uint32Array(80),T0=new Uint32Array(80);let dM=class extends gie{constructor(e=64){super(128,e,16,!1),this.Ah=Mo[0]|0,this.Al=Mo[1]|0,this.Bh=Mo[2]|0,this.Bl=Mo[3]|0,this.Ch=Mo[4]|0,this.Cl=Mo[5]|0,this.Dh=Mo[6]|0,this.Dl=Mo[7]|0,this.Eh=Mo[8]|0,this.El=Mo[9]|0,this.Fh=Mo[10]|0,this.Fl=Mo[11]|0,this.Gh=Mo[12]|0,this.Gl=Mo[13]|0,this.Hh=Mo[14]|0,this.Hl=Mo[15]|0}get(){const{Ah:e,Al:n,Bh:i,Bl:s,Ch:r,Cl:o,Dh:a,Dl:c,Eh:l,El:d,Fh:h,Fl:p,Gh:g,Gl:b,Hh:w,Hl:C}=this;return[e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C]}set(e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C){this.Ah=e|0,this.Al=n|0,this.Bh=i|0,this.Bl=s|0,this.Ch=r|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=d|0,this.Fh=h|0,this.Fl=p|0,this.Gh=g|0,this.Gl=b|0,this.Hh=w|0,this.Hl=C|0}process(e,n){for(let A=0;A<16;A++,n+=4)A0[A]=e.getUint32(n),T0[A]=e.getUint32(n+=4);for(let A=16;A<80;A++){const k=A0[A-15]|0,R=T0[A-15]|0,P=B0(k,R,1)^B0(k,R,8)^fq(k,R,7),B=F0(k,R,1)^F0(k,R,8)^pq(k,R,7),F=A0[A-2]|0,z=T0[A-2]|0,K=B0(F,z,19)^t3(F,z,61)^fq(F,z,6),q=F0(F,z,19)^n3(F,z,61)^pq(F,z,6),G=Q7e(B,q,T0[A-7],T0[A-16]),I=X7e(G,P,K,A0[A-7],A0[A-16]);A0[A]=I|0,T0[A]=G|0}let{Ah:i,Al:s,Bh:r,Bl:o,Ch:a,Cl:c,Dh:l,Dl:d,Eh:h,El:p,Fh:g,Fl:b,Gh:w,Gl:C,Hh:E,Hl:T}=this;for(let A=0;A<80;A++){const k=B0(h,p,14)^B0(h,p,18)^t3(h,p,41),R=F0(h,p,14)^F0(h,p,18)^n3(h,p,41),P=h&g^~h&w,B=p&b^~p&C,F=J7e(T,R,B,Cke[A],T0[A]),z=eke(F,E,k,P,vke[A],A0[A]),K=F|0,q=B0(i,s,28)^t3(i,s,34)^t3(i,s,39),G=F0(i,s,28)^n3(i,s,34)^n3(i,s,39),I=i&r^i&a^r&a,S=s&o^s&c^o&c;E=w|0,T=C|0,w=g|0,C=b|0,g=h|0,b=p|0,{h,l:p}=lu(l|0,d|0,z|0,K|0),l=a|0,d=c|0,a=r|0,c=o|0,r=i|0,o=s|0;const v=cM(K,G,S);i=lM(v,z,q,I),s=v|0}({h:i,l:s}=lu(this.Ah|0,this.Al|0,i|0,s|0)),{h:r,l:o}=lu(this.Bh|0,this.Bl|0,r|0,o|0),{h:a,l:c}=lu(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:d}=lu(this.Dh|0,this.Dl|0,l|0,d|0),{h,l:p}=lu(this.Eh|0,this.El|0,h|0,p|0),{h:g,l:b}=lu(this.Fh|0,this.Fl|0,g|0,b|0),{h:w,l:C}=lu(this.Gh|0,this.Gl|0,w|0,C|0),{h:E,l:T}=lu(this.Hh|0,this.Hl|0,E|0,T|0),this.set(i,s,r,o,a,c,l,d,h,p,g,b,w,C,E,T)}roundClean(){Pl(A0,T0)}destroy(){Pl(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};class xke extends dM{constructor(){super(48),this.Ah=Oo[0]|0,this.Al=Oo[1]|0,this.Bh=Oo[2]|0,this.Bl=Oo[3]|0,this.Ch=Oo[4]|0,this.Cl=Oo[5]|0,this.Dh=Oo[6]|0,this.Dl=Oo[7]|0,this.Eh=Oo[8]|0,this.El=Oo[9]|0,this.Fh=Oo[10]|0,this.Fl=Oo[11]|0,this.Gh=Oo[12]|0,this.Gl=Oo[13]|0,this.Hh=Oo[14]|0,this.Hl=Oo[15]|0}}const Lo=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Eke extends dM{constructor(){super(32),this.Ah=Lo[0]|0,this.Al=Lo[1]|0,this.Bh=Lo[2]|0,this.Bl=Lo[3]|0,this.Ch=Lo[4]|0,this.Cl=Lo[5]|0,this.Dh=Lo[6]|0,this.Dl=Lo[7]|0,this.Eh=Lo[8]|0,this.El=Lo[9]|0,this.Fh=Lo[10]|0,this.Fl=Lo[11]|0,this.Gh=Lo[12]|0,this.Gl=Lo[13]|0,this.Hh=Lo[14]|0,this.Hl=Lo[15]|0}}const mS=B6(()=>new wke),_ke=B6(()=>new dM),Ske=B6(()=>new xke),Ake=B6(()=>new Eke),Tke=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),kr=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Rt=new Uint32Array(32);function k0(t,e,n,i,s,r){const o=s[r],a=s[r+1];let c=Rt[2*t],l=Rt[2*t+1],d=Rt[2*e],h=Rt[2*e+1],p=Rt[2*n],g=Rt[2*n+1],b=Rt[2*i],w=Rt[2*i+1],C=cM(c,d,o);l=lM(C,l,h,a),c=C|0,{Dh:w,Dl:b}={Dh:w^l,Dl:b^c},{Dh:w,Dl:b}={Dh:z7e(w,b),Dl:H7e(w)},{h:g,l:p}=lu(g,p,w,b),{Bh:h,Bl:d}={Bh:h^g,Bl:d^p},{Bh:h,Bl:d}={Bh:B0(h,d,24),Bl:F0(h,d,24)},Rt[2*t]=c,Rt[2*t+1]=l,Rt[2*e]=d,Rt[2*e+1]=h,Rt[2*n]=p,Rt[2*n+1]=g,Rt[2*i]=b,Rt[2*i+1]=w}function N0(t,e,n,i,s,r){const o=s[r],a=s[r+1];let c=Rt[2*t],l=Rt[2*t+1],d=Rt[2*e],h=Rt[2*e+1],p=Rt[2*n],g=Rt[2*n+1],b=Rt[2*i],w=Rt[2*i+1],C=cM(c,d,o);l=lM(C,l,h,a),c=C|0,{Dh:w,Dl:b}={Dh:w^l,Dl:b^c},{Dh:w,Dl:b}={Dh:B0(w,b,16),Dl:F0(w,b,16)},{h:g,l:p}=lu(g,p,w,b),{Bh:h,Bl:d}={Bh:h^g,Bl:d^p},{Bh:h,Bl:d}={Bh:t3(h,d,63),Bl:n3(h,d,63)},Rt[2*t]=c,Rt[2*t+1]=l,Rt[2*e]=d,Rt[2*e+1]=h,Rt[2*n]=p,Rt[2*n+1]=g,Rt[2*i]=b,Rt[2*i+1]=w}function kke(t,e={},n,i,s){if(_f(n),t<0||t>n)throw new Error("outputLen bigger than keyLen");const{key:r,salt:o,personalization:a}=e;if(r!==void 0&&(r.length<1||r.length>n))throw new Error("key length must be undefined or 1.."+n);if(o!==void 0&&o.length!==i)throw new Error("salt must be undefined or "+i);if(a!==void 0&&a.length!==s)throw new Error("personalization must be undefined or "+s)}class Nke extends pS{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,_f(e),_f(n),this.blockLen=e,this.outputLen=n,this.buffer=new Uint8Array(e),this.buffer32=S5(this.buffer)}update(e){Tp(this),e=Nu(e),$u(e);const{blockLen:n,buffer:i,buffer32:s}=this,r=e.length,o=e.byteOffset,a=e.buffer;for(let c=0;c<r;){this.pos===n&&(j0(s),this.compress(s,0,!1),j0(s),this.pos=0);const l=Math.min(n-this.pos,r-c),d=o+c;if(l===n&&!(d%4)&&c+l<r){const h=new Uint32Array(a,d,Math.floor((r-c)/4));j0(h);for(let p=0;c+n<r;p+=s.length,c+=n)this.length+=n,this.compress(h,p,!1);j0(h);continue}i.set(e.subarray(c,c+l),this.pos),this.pos+=l,this.length+=l,c+=l}return this}digestInto(e){Tp(this),uM(e,this);const{pos:n,buffer32:i}=this;this.finished=!0,Pl(this.buffer.subarray(n)),j0(i),this.compress(i,0,!0),j0(i);const s=S5(e);
vendor: 54,527 bytes, lines 155-158
155this.get().forEach((r,o)=>s[o]=Oh(r))}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const i=e.slice(0,n);return this.destroy(),i}_cloneInto(e){const{buffer:n,length:i,finished:s,destroyed:r,outputLen:o,pos:a}=this;return e||(e=new this.constructor({dkLen:o})),e.set(...this.get()),e.buffer.set(n),e.destroyed=r,e.finished=s,e.length=i,e.pos=a,e.outputLen=o,e}clone(){return this._cloneInto()}}class Rke extends Nke{constructor(e={}){const n=e.dkLen===void 0?64:e.dkLen;super(128,n),this.v0l=kr[0]|0,this.v0h=kr[1]|0,this.v1l=kr[2]|0,this.v1h=kr[3]|0,this.v2l=kr[4]|0,this.v2h=kr[5]|0,this.v3l=kr[6]|0,this.v3h=kr[7]|0,this.v4l=kr[8]|0,this.v4h=kr[9]|0,this.v5l=kr[10]|0,this.v5h=kr[11]|0,this.v6l=kr[12]|0,this.v6h=kr[13]|0,this.v7l=kr[14]|0,this.v7h=kr[15]|0,kke(n,e,64,16,16);let{key:i,personalization:s,salt:r}=e,o=0;if(i!==void 0&&(i=Nu(i),o=i.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,r!==void 0){r=Nu(r);const a=S5(r);this.v4l^=Oh(a[0]),this.v4h^=Oh(a[1]),this.v5l^=Oh(a[2]),this.v5h^=Oh(a[3])}if(s!==void 0){s=Nu(s);const a=S5(s);this.v6l^=Oh(a[0]),this.v6h^=Oh(a[1]),this.v7l^=Oh(a[2]),this.v7h^=Oh(a[3])}if(i!==void 0){const a=new Uint8Array(this.blockLen);a.set(i),this.update(a)}}get(){let{v0l:e,v0h:n,v1l:i,v1h:s,v2l:r,v2h:o,v3l:a,v3h:c,v4l:l,v4h:d,v5l:h,v5h:p,v6l:g,v6h:b,v7l:w,v7h:C}=this;return[e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C]}set(e,n,i,s,r,o,a,c,l,d,h,p,g,b,w,C){this.v0l=e|0,this.v0h=n|0,this.v1l=i|0,this.v1h=s|0,this.v2l=r|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=l|0,this.v4h=d|0,this.v5l=h|0,this.v5h=p|0,this.v6l=g|0,this.v6h=b|0,this.v7l=w|0,this.v7h=C|0}compress(e,n,i){this.get().forEach((c,l)=>Rt[l]=c),Rt.set(kr,16);let{h:s,l:r}=rie(BigInt(this.length));Rt[24]=kr[8]^r,Rt[25]=kr[9]^s,i&&(Rt[28]=~Rt[28],Rt[29]=~Rt[29]);let o=0;const a=Tke;for(let c=0;c<12;c++)k0(0,4,8,12,e,n+2*a[o++]),N0(0,4,8,12,e,n+2*a[o++]),k0(1,5,9,13,e,n+2*a[o++]),N0(1,5,9,13,e,n+2*a[o++]),k0(2,6,10,14,e,n+2*a[o++]),N0(2,6,10,14,e,n+2*a[o++]),k0(3,7,11,15,e,n+2*a[o++]),N0(3,7,11,15,e,n+2*a[o++]),k0(0,5,10,15,e,n+2*a[o++]),N0(0,5,10,15,e,n+2*a[o++]),k0(1,6,11,12,e,n+2*a[o++]),N0(1,6,11,12,e,n+2*a[o++]),k0(2,7,8,13,e,n+2*a[o++]),N0(2,7,8,13,e,n+2*a[o++]),k0(3,4,9,14,e,n+2*a[o++]),N0(3,4,9,14,e,n+2*a[o++]);this.v0l^=Rt[0]^Rt[16],this.v0h^=Rt[1]^Rt[17],this.v1l^=Rt[2]^Rt[18],this.v1h^=Rt[3]^Rt[19],this.v2l^=Rt[4]^Rt[20],this.v2h^=Rt[5]^Rt[21],this.v3l^=Rt[6]^Rt[22],this.v3h^=Rt[7]^Rt[23],this.v4l^=Rt[8]^Rt[24],this.v4h^=Rt[9]^Rt[25],this.v5l^=Rt[10]^Rt[26],this.v5h^=Rt[11]^Rt[27],this.v6l^=Rt[12]^Rt[28],this.v6h^=Rt[13]^Rt[29],this.v7l^=Rt[14]^Rt[30],this.v7h^=Rt[15]^Rt[31],Pl(Rt)}destroy(){this.destroyed=!0,Pl(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Pke=ike(t=>new Rke(t)),Ike="https://rpc.walletconnect.org/v1";function bie(t){const e=`�Ethereum Signed Message: 156${t.length}`,n=new TextEncoder().encode(e+t);return"0x"+Buffer.from(pke(n)).toString("hex")}async function Dke(t,e,n,i,s,r){switch(n.t){case"eip191":return await Oke(t,e,n.s);case"eip1271":return await Mke(t,e,n.s,i,s,r);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function Oke(t,e,n){const i=yAe(n);return RAe({payload:bie(e),signature:i}).toLowerCase()===t.toLowerCase()}async function Mke(t,e,n,i,s,r){const o=of(i);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l=n.substring(2),d=(l.length/2).toString(16).padStart(64,"0"),h=(e.startsWith("0x")?e:bie(e)).substring(2),p=a+h+c+d+l,g=await fetch(`${r||Ike}/?chainId=${i}&projectId=${s}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Lke(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:p},"latest"]})}),{result:b}=await g.json();return b?b.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function Lke(){return Date.now()+Math.floor(Math.random()*1e3)}function $ke(t){const e=atob(t),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);const i=n[0];if(i===0)throw new Error("No signatures found");const s=1+i*64;if(n.length<s)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const r=Buffer.from(t,"base64").slice(1,65);return Wb.encode(r)}function Uke(t){const e=new Uint8Array(Buffer.from(t,"base64")),n=Array.from("TransactionData::").map(r=>r.charCodeAt(0)),i=new Uint8Array(n.length+e.length);i.set(n),i.set(e,n.length);const s=Pke(i,{dkLen:32});return Wb.encode(s)}function bq(t){const e=new Uint8Array(mS(Bke(t)));return Wb.encode(e)}function Bke(t){if(t instanceof Uint8Array)return t;if(Array.isArray(t))return new Uint8Array(t);if(typeof t=="object"&&t!=null&&t.data)return new Uint8Array(Object.values(t.data));if(typeof t=="object"&&t)return new Uint8Array(Object.values(t));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function wq(t){const e=Buffer.from(t,"base64"),n=mTe(e).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const i=oTe(n),s=Buffer.from("TX"),r=Buffer.concat([s,Buffer.from(i)]),o=Ake(r);return NAe.encode(o).replace(/=+$/,"")}function S7(t){const e=[];let n=BigInt(t);for(;n>=BigInt(128);)e.push(Number(n&BigInt(127)|BigInt(128))),n>>=BigInt(7);return e.push(Number(n)),Buffer.from(e)}function Fke(t){const e=Buffer.from(t.signed.bodyBytes,"base64"),n=Buffer.from(t.signed.authInfoBytes,"base64"),i=Buffer.from(t.signature.signature,"base64"),s=[];s.push(Buffer.from([10])),s.push(S7(e.length)),s.push(e),s.push(Buffer.from([18])),s.push(S7(n.length)),s.push(n),s.push(Buffer.from([26])),s.push(S7(i.length)),s.push(i);const r=Buffer.concat(s),o=mS(r);return Buffer.from(o).toString("hex").toUpperCase()}function jke(t){var e,n;const i=[];try{if(typeof t=="string")return i.push(t),i;if(typeof t!="object")return i;t!=null&&t.id&&i.push(t.id);const s=(n=(e=t==null?void 0:t.capabilities)==null?void 0:e.caip345)==null?void 0:n.transactionHashes;s&&i.push(...s)}catch(s){console.warn("getWalletSendCallsHashes failed: ",s)}return i}var Vke=Object.defineProperty,Wke=Object.defineProperties,qke=Object.getOwnPropertyDescriptors,vq=Object.getOwnPropertySymbols,zke=Object.prototype.hasOwnProperty,Hke=Object.prototype.propertyIsEnumerable,Cq=(t,e,n)=>e in t?Vke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gke=(t,e)=>{for(var n in e||(e={}))zke.call(e,n)&&Cq(t,n,e[n]);if(vq)for(var n of vq(e))Hke.call(e,n)&&Cq(t,n,e[n]);return t},Kke=(t,e)=>Wke(t,qke(e));const wie="did:pkh:",Yke={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},Zke=t=>t?Yke[t]||t:"",gS=t=>t==null?void 0:t.split(":"),Qke=t=>{const e=t&&gS(t);if(e)return t.includes(wie)?e[3]:e[1]},Xke=t=>{const e=t&&gS(t);if(e)return t.includes(wie)?e[2]:e[0]},IP=t=>{const e=t&&gS(t);if(e)return e[2]+":"+e[3]},E_=t=>{const e=t&&gS(t);if(e)return e.pop()};async function xq(t){const{cacao:e,projectId:n}=t,{s:i,p:s}=e,r=vie(s,s.iss),o=E_(s.iss);return await Dke(o,r,i,IP(s.iss),n)}const vie=(t,e)=>{const n=Xke(e);if(!n)throw new Error("Invalid issuer: "+e);const i=`${t.domain} wants you to sign in with your ${Zke(n)} account:`,s=E_(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let r=t.statement||void 0;const o=`URI: ${t.aud||t.uri}`,a=`Version: ${t.version}`,c=`Chain ID: ${Qke(e)}`,l=`Nonce: ${t.nonce}`,d=`Issued At: ${t.iat}`,h=t.exp?`Expiration Time: ${t.exp}`:void 0,p=t.nbf?`Not Before: ${t.nbf}`:void 0,g=t.requestId?`Request ID: ${t.requestId}`:void 0,b=t.resources?`Resources:${t.resources.map(C=>` 157- ${C}`).join("")}`:void 0,w=pE(t.resources);if(w){const C=A5(w);r=aNe(r,C)}return[i,s,"",r,"",o,a,c,l,d,h,p,g,b].filter(C=>C!=null).join(` 158`)};function Jke(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function eNe(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Og(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(n=>{const i=t.att[n];if(Array.isArray(i))throw new Error(`Resource must be an object: ${n}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(i).forEach(s=>{const r=i[s];if(!Array.isArray(r))throw new Error(`Ability limits ${s} must be an array of objects, found: ${r}`);if(!r.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);r.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function tNe(t,e,n,i={}){return n==null||n.sort((s,r)=>s.localeCompare(r)),{att:{[t]:nNe(e,n,i)}}}function nNe(t,e,n={}){e=e==null?void 0:e.sort((s,r)=>s.localeCompare(r));const i=e.map(s=>({[`${t}/${s}`]:[n]}));return Object.assign({},...i)}function Cie(t){return Og(t),`urn:recap:${Jke(t).replace(/=/g,"")}`}function A5(t){const e=eNe(t.replace("urn:recap:",""));return Og(e),e}function iNe(t,e,n){const i=tNe(t,e,n);return Cie(i)}function sNe(t){return t&&t.includes("urn:recap:")}function rNe(t,e){const n=A5(t),i=A5(e),s=oNe(n,i);return Cie(s)}function oNe(t,e){Og(t),Og(e);const n=Object.keys(t.att).concat(Object.keys(e.att)).sort((s,r)=>s.localeCompare(r)),i={att:{}};return n.forEach(s=>{var r,o;Object.keys(((r=t.att)==null?void 0:r[s])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;i.att[s]=Kke(Gke({},i.att[s]),{[a]:((c=t.att[s])==null?void 0:c[a])||((l=e.att[s])==null?void 0:l[a])})})}),i}function aNe(t="",e){Og(e);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(n))return t;const i=[];let s=0;Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(h=>({ability:h.split("/")[0],action:h.split("/")[1]}));c.sort((h,p)=>h.action.localeCompare(p.action));const l={};c.forEach(h=>{l[h.ability]||(l[h.ability]=[]),l[h.ability].push(h.action)});const d=Object.keys(l).map(h=>(s++,`(${s}) '${h}': '${l[h].join("', '")}' for '${a}'.`));i.push(d.join(", ").replace(".,","."))});const r=i.join(" "),o=`${n}${r}`;return`${t?t+" ":""}${o}`}function Eq(t){var e;const n=A5(t);Og(n);const i=(e=n.att)==null?void 0:e.eip155;return i?Object.keys(i).map(s=>s.split("/")[1]):[]}function _q(t){const e=A5(t);Og(e);const n=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(s=>{var r;(r=s==null?void 0:s[0])!=null&&r.chains&&n.push(s[0].chains)})}),[...new Set(n.flat())]}function pE(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return sNe(e)?e:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function xie(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function DP(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function A7(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Wa(t,...e){if(!xie(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Sq(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function cNe(t,e){Wa(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function dp(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function sb(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function lNe(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const uNe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function dNe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function OP(t){if(typeof t=="string")t=dNe(t);else if(xie(t))t=MP(t);else throw new Error("Uint8Array expected, got "+typeof t);return t}function hNe(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function fNe(t,e){if(t.length!==e.length)return!1;let n=0;for(let i=0;i<t.length;i++)n|=t[i]^e[i];return n===0}const pNe=(t,e)=>{function n(i,...s){if(Wa(i),!uNe)throw new Error("Non little-endian hardware is not yet supported");if(t.nonceLength!==void 0){const l=s[0];if(!l)throw new Error("nonce / iv required");t.varSizeNonce?Wa(l):Wa(l,t.nonceLength)}const r=t.tagLength;r&&s[1]!==void 0&&Wa(s[1]);const o=e(i,...s),a=(l,d)=>{if(d!==void 0){if(l!==2)throw new Error("cipher output not supported");Wa(d)}};let c=!1;return{encrypt(l,d){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,Wa(l),a(o.encrypt.length,d),o.encrypt(l,d)},decrypt(l,d){if(Wa(l),r&&l.length<r)throw new Error("invalid ciphertext length: smaller than tagLength="+r);return a(o.decrypt.length,d),o.decrypt(l,d)}}}return Object.assign(n,t),n};function Aq(t,e,n=!0){if(e===void 0)return new Uint8Array(t);if(e.length!==t)throw new Error("invalid output length, expected "+t+", got: "+e.length);if(n&&!gNe(e))throw new Error("invalid output, must be aligned");return e}function Tq(t,e,n,i){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,i);const s=BigInt(32),r=BigInt(4294967295),o=Number(n>>s&r),a=Number(n&r);t.setUint32(e+4,o,i),t.setUint32(e+0,a,i)}function mNe(t,e,n){DP(n);const i=new Uint8Array(16),s=lNe(i);return Tq(s,0,BigInt(e),n),Tq(s,8,BigInt(t),n),i}function gNe(t){return t.byteOffset%4===0}function MP(t){return Uint8Array.from(t)}const Eie=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),yNe=Eie("expand 16-byte k"),bNe=Eie("expand 32-byte k"),wNe=dp(yNe),vNe=dp(bNe);function ki(t,e){return t<<e|t>>>32-e}function LP(t){return t.byteOffset%4===0}const fx=64,CNe=16,_ie=2**32-1,kq=new Uint32Array;function xNe(t,e,n,i,s,r,o,a){const c=s.length,l=new Uint8Array(fx),d=dp(l),h=LP(s)&&LP(r),p=h?dp(s):kq,g=h?dp(r):kq;for(let b=0;b<c;o++){if(t(e,n,i,d,o,a),o>=_ie)throw new Error("arx: counter overflow");const w=Math.min(fx,c-b);if(h&&w===fx){const C=b/4;if(b%4!==0)throw new Error("arx: invalid block position");for(let E=0,T;E<CNe;E++)T=C+E,g[T]=p[T]^d[E];b+=fx;continue}for(let C=0,E;C<w;C++)E=b+C,r[E]=s[E]^l[C];b+=w}}function ENe(t,e){const{allowShortKeys:n,extendNonceFn:i,counterLength:s,counterRight:r,rounds:o}=hNe({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return A7(s),A7(o),DP(r),DP(n),(a,c,l,d,h=0)=>{Wa(a),Wa(c),Wa(l);const p=l.length;if(d===void 0&&(d=new Uint8Array(p)),Wa(d),A7(h),h<0||h>=_ie)throw new Error("arx: counter overflow");if(d.length<p)throw new Error(`arx: output (${d.length}) is shorter than data (${p})`);const g=[];let b=a.length,w,C;if(b===32)g.push(w=MP(a)),C=vNe;else if(b===16&&n)w=new Uint8Array(32),w.set(a),w.set(a,16),C=wNe,g.push(w);else throw new Error(`arx: invalid 32-byte key, got length=${b}`);LP(c)||g.push(c=MP(c));const E=dp(w);if(i){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");i(C,E,dp(c.subarray(0,16)),E),c=c.subarray(16)}const T=16-s;if(T!==c.length)throw new Error(`arx: nonce must be ${T} or 16 bytes`);if(T!==12){const k=new Uint8Array(12);k.set(c,r?0:12-c.length),c=k,g.push(c)}const A=dp(c);return xNe(t,C,E,A,l,d,h,o),sb(...g),d}}const ho=(t,e)=>t[e++]&255|(t[e++]&255)<<8;class _Ne{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=OP(e),Wa(e,32);const n=ho(e,0),i=ho(e,2),s=ho(e,4),r=ho(e,6),o=ho(e,8),a=ho(e,10),c=ho(e,12),l=ho(e,14);this.r[0]=n&8191,this.r[1]=(n>>>13|i<<3)&8191,this.r[2]=(i>>>10|s<<6)&7939,this.r[3]=(s>>>7|r<<9)&8191,this.r[4]=(r>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let d=0;d<8;d++)this.pad[d]=ho(e,16+2*d)}process(e,n,i=!1){const s=i?0:2048,{h:r,r:o}=this,a=o[0],c=o[1],l=o[2],d=o[3],h=o[4],p=o[5],g=o[6],b=o[7],w=o[8],C=o[9],E=ho(e,n+0),T=ho(e,n+2),A=ho(e,n+4),k=ho(e,n+6),R=ho(e,n+8),P=ho(e,n+10),B=ho(e,n+12),F=ho(e,n+14);let z=r[0]+(E&8191),K=r[1]+((E>>>13|T<<3)&8191),q=r[2]+((T>>>10|A<<6)&8191),G=r[3]+((A>>>7|k<<9)&8191),I=r[4]+((k>>>4|R<<12)&8191),S=r[5]+(R>>>1&8191),v=r[6]+((R>>>14|P<<2)&8191),_=r[7]+((P>>>11|B<<5)&8191),N=r[8]+((B>>>8|F<<8)&8191),$=r[9]+(F>>>5|s),U=0,j=U+z*a+K*(5*C)+q*(5*w)+G*(5*b)+I*(5*g);U=j>>>13,j&=8191,j+=S*(5*p)+v*(5*h)+_*(5*d)+N*(5*l)+$*(5*c),U+=j>>>13,j&=8191;let D=U+z*c+K*a+q*(5*C)+G*(5*w)+I*(5*b);U=D>>>13,D&=8191,D+=S*(5*g)+v*(5*p)+_*(5*h)+N*(5*d)+$*(5*l),U+=D>>>13,D&=8191;let O=U+z*l+K*c+q*a+G*(5*C)+I*(5*w);U=O>>>13,O&=8191,O+=S*(5*b)+v*(5*g)+_*(5*p)+N*(5*h)+$*(5*d),U+=O>>>13,O&=8191;let H=U+z*d+K*l+q*c+G*a+I*(5*C);U=H>>>13,H&=8191,H+=S*(5*w)+v*(5*b)+_*(5*g)+N*(5*p)+$*(5*h),U+=H>>>13,H&=8191;let J=U+z*h+K*d+q*l+G*c+I*a;U=J>>>13,J&=8191,J+=S*(5*C)+v*(5*w)+_*(5*b)+N*(5*g)+$*(5*p),U+=J>>>13,J&=8191;let W=U+z*p+K*h+q*d+G*l+I*c;U=W>>>13,W&=8191,W+=S*a+v*(5*C)+_*(5*w)+N*(5*b)+$*(5*g),U+=W>>>13,W&=8191;let Z=U+z*g+K*p+q*h+G*d+I*l;U=Z>>>13,Z&=8191,Z+=S*c+v*a+_*(5*C)+N*(5*w)+$*(5*b),U+=Z>>>13,Z&=8191;let Y=U+z*b+K*g+q*p+G*h+I*d;U=Y>>>13,Y&=8191,Y+=S*l+v*c+_*a+N*(5*C)+$*(5*w),U+=Y>>>13,Y&=8191;let Q=U+z*w+K*b+q*g+G*p+I*h;U=Q>>>13,Q&=8191,Q+=S*d+v*l+_*c+N*a+$*(5*C),U+=Q>>>13,Q&=8191;let ee=U+z*C+K*w+q*b+G*g+I*p;U=ee>>>13,ee&=8191,ee+=S*h+v*d+_*l+N*c+$*a,U+=ee>>>13,ee&=8191,U=(U<<2)+U|0,U=U+j|0,j=U&8191,U=U>>>13,D+=U,r[0]=j,r[1]=D,r[2]=O,r[3]=H,r[4]=J,r[5]=W,r[6]=Z,r[7]=Y,r[8]=Q,r[9]=ee}finalize(){const{h:e,pad:n}=this,i=new Uint16Array(10);let s=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=s,s=e[a]>>>13,e[a]&=8191;e[0]+=s*5,s=e[0]>>>13,e[0]&=8191,e[1]+=s,s=e[1]>>>13,e[1]&=8191,e[2]+=s,i[0]=e[0]+5,s=i[0]>>>13,i[0]&=8191;for(let a=1;a<10;a++)i[a]=e[a]+s,s=i[a]>>>13,i[a]&=8191;i[9]-=8192;let r=(s^1)-1;for(let a=0;a<10;a++)i[a]&=r;r=~r;for(let a=0;a<10;a++)e[a]=e[a]&r|i[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+n[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+n[a]|0)+(o>>>16)|0,e[a]=o&65535;sb(i)}update(e){Sq(this),e=OP(e),Wa(e);const{buffer:n,blockLen:i}=this,s=e.length;for(let r=0;r<s;){const o=Math.min(i-this.pos,s-r);if(o===i){for(;i<=s-r;r+=i)this.process(e,r);continue}n.set(e.subarray(r,r+o),this.pos),this.pos+=o,r+=o,this.pos===i&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){sb(this.h,this.r,this.buffer,this.pad)}digestInto(e){Sq(this),cNe(e,this),this.finished=!0;const{buffer:n,h:i}=this;let{pos:s}=this;if(s){for(n[s++]=1;s<16;s++)n[s]=0;this.process(n,0,!0)}this.finalize();let r=0;for(let o=0;o<8;o++)e[r++]=i[o]>>>0,e[r++]=i[o]>>>8;return e}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const i=e.slice(0,n);return this.destroy(),i}}function SNe(t){const e=(i,s)=>t(s).update(OP(i)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=i=>t(i),e}const ANe=SNe(t=>new _Ne(t));function TNe(t,e,n,i,s,r=20){let o=t[0],a=t[1],c=t[2],l=t[3],d=e[0],h=e[1],p=e[2],g=e[3],b=e[4],w=e[5],C=e[6],E=e[7],T=s,A=n[0],k=n[1],R=n[2],P=o,B=a,F=c,z=l,K=d,q=h,G=p,I=g,S=b,v=w,_=C,N=E,$=T,U=A,j=k,D=R;for(let H=0;H<r;H+=2)P=P+K|0,$=ki($^P,16),S=S+$|0,K=ki(K^S,12),P=P+K|0,$=ki($^P,8),S=S+$|0,K=ki(K^S,7),B=B+q|0,U=ki(U^B,16),v=v+U|0,q=ki(q^v,12),B=B+q|0,U=ki(U^B,8),v=v+U|0,q=ki(q^v,7),F=F+G|0,j=ki(j^F,16),_=_+j|0,G=ki(G^_,12),F=F+G|0,j=ki(j^F,8),_=_+j|0,G=ki(G^_,7),z=z+I|0,D=ki(D^z,16),N=N+D|0,I=ki(I^N,12),z=z+I|0,D=ki(D^z,8),N=N+D|0,I=ki(I^N,7),P=P+q|0,D=ki(D^P,16),_=_+D|0,q=ki(q^_,12),P=P+q|0,D=ki(D^P,8),_=_+D|0,q=ki(q^_,7),B=B+G|0,$=ki($^B,16),N=N+$|0,G=ki(G^N,12),B=B+G|0,$=ki($^B,8),N=N+$|0,G=ki(G^N,7),F=F+I|0,U=ki(U^F,16),S=S+U|0,I=ki(I^S,12),F=F+I|0,U=ki(U^F,8),S=S+U|0,I=ki(I^S,7),z=z+K|0,j=ki(j^z,16),v=v+j|0,K=ki(K^v,12),z=z+K|0,j=ki(j^z,8),v=v+j|0,K=ki(K^v,7);let O=0;i[O++]=o+P|0,i[O++]=a+B|0,i[O++]=c+F|0,i[O++]=l+z|0,i[O++]=d+K|0,i[O++]=h+q|0,i[O++]=p+G|0,i[O++]=g+I|0,i[O++]=b+S|0,i[O++]=w+v|0,i[O++]=C+_|0,i[O++]=E+N|0,i[O++]=T+$|0,i[O++]=A+U|0,i[O++]=k+j|0,i[O++]=R+D|0}const kNe=ENe(TNe,{counterRight:!1,counterLength:4,allowShortKeys:!1}),NNe=new Uint8Array(16),Nq=(t,e)=>{t.update(e);const n=e.length%16;n&&t.update(NNe.subarray(n))},RNe=new Uint8Array(32);function Rq(t,e,n,i,s){const r=t(e,n,RNe),o=ANe.create(r);s&&Nq(o,s),Nq(o,i);const a=mNe(i.length,s?s.length:0,!0);o.update(a);const c=o.digest();return sb(r,a),c}const PNe=t=>(e,n,i)=>({encrypt(s,r){const o=s.length;r=Aq(o+16,r,!1),r.set(s);const a=r.subarray(0,-16);t(e,n,a,a,1);const c=Rq(t,e,n,a,i);return r.set(c,o),sb(c),r},decrypt(s,r){r=Aq(s.length-16,r,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=Rq(t,e,n,o,i);if(!fNe(a,c))throw new Error("invalid tag");return r.set(s.subarray(0,-16)),t(e,n,r,r,1),sb(c),r}}),Sie=pNe({blockSize:64,nonceLength:12,tagLength:16},PNe(kNe));let Aie=class extends pS{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,fS(e);const i=Nu(n);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,r=new Uint8Array(s);r.set(i.length>s?e.create().update(i).digest():i);for(let o=0;o<r.length;o++)r[o]^=54;this.iHash.update(r),this.oHash=e.create();for(let o=0;o<r.length;o++)r[o]^=106;this.oHash.update(r),Pl(r)}update(e){return Tp(this),this.iHash.update(e),this}digestInto(e){Tp(this),$u(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:i,finished:s,destroyed:r,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=r,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const yS=(t,e,n)=>new Aie(t,e).update(n).digest();yS.create=(t,e)=>new Aie(t,e);function INe(t,e,n){return fS(t),n===void 0&&(n=new Uint8Array(t.outputLen)),yS(t,Nu(n),Nu(e))}const T7=Uint8Array.from([0]),Pq=Uint8Array.of();function DNe(t,e,n,i=32){fS(t),_f(i);const s=t.outputLen;if(i>255*s)throw new Error("Length should be <= 255*HashLen");const r=Math.ceil(i/s);n===void 0&&(n=Pq);const o=new Uint8Array(r*s),a=yS.create(t,e),c=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let d=0;d<r;d++)T7[0]=d+1,c.update(d===0?Pq:l).update(n).update(T7).digestInto(l),o.set(l,s*d),a._cloneInto(c);return a.destroy(),c.destroy(),Pl(l,T7),o.slice(0,i)}const ONe=(t,e,n,i,s)=>DNe(t,INe(t,e,n),i,s),bS=mS,hM=BigInt(0),$P=BigInt(1);function __(t,e=""){if(typeof t!="boolean"){const n=e&&`"${e}"`;throw new Error(n+"expected boolean, got type="+typeof t)}return t}function qm(t,e,n=""){const i=hS(t),s=t==null?void 0:t.length,r=e!==void 0;if(!i||r&&s!==e){const o=n&&`"${n}" `,a=r?` of length ${e}`:"",c=i?`length=${s}`:`type=${typeof t}`;throw new Error(o+"expected Uint8Array"+a+", got "+c)}return t}function px(t){const e=t.toString(16);return e.length&1?"0"+e:e}function Tie(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?hM:BigInt("0x"+t)}function wS(t){return Tie(C2(t))}function S_(t){return $u(t),Tie(C2(Uint8Array.from(t).reverse()))}function fM(t,e){return x_(t.toString(16).padStart(e*2,"0"))}function pM(t,e){return fM(t,e).reverse()}function Bo(t,e,n){let i;if(typeof e=="string")try{i=x_(e)}catch(r){throw new Error(t+" must be hex string or Uint8Array, cause: "+r)}else if(hS(e))i=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const s=i.length;if(typeof n=="number"&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return i}const k7=t=>typeof t=="bigint"&&hM<=t;function MNe(t,e,n){return k7(t)&&k7(e)&&k7(n)&&e<=t&&t<n}function UP(t,e,n,i){if(!MNe(e,n,i))throw new Error("expected valid "+t+": "+n+" <= n < "+i+", got "+e)}function kie(t){let e;for(e=0;t>hM;t>>=$P,e+=1);return e}const F6=t=>($P<<BigInt(t))-$P;function LNe(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const i=p=>new Uint8Array(p),s=p=>Uint8Array.of(p);let r=i(t),o=i(t),a=0;const c=()=>{r.fill(1),o.fill(0),a=0},l=(...p)=>n(o,r,...p),d=(p=i(0))=>{o=l(s(0),p),r=l(),p.length!==0&&(o=l(s(1),p),r=l())},h=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const g=[];for(;p<e;){r=l();const b=r.slice();g.push(b),p+=r.length}return z0(...g)};return(p,g)=>{c(),d(p);let b;for(;!(b=g(h()));)d();return c(),b}}function vS(t,e,n={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function i(s,r,o){const a=t[s];if(o&&a===void 0)return;const c=typeof a;if(c!==r||a===null)throw new Error(`param "${s}" is invalid: expected ${r}, got ${c}`)}Object.entries(e).forEach(([s,r])=>i(s,r,!1)),Object.entries(n).forEach(([s,r])=>i(s,r,!0))}function Iq(t){const e=new WeakMap;return(n,...i)=>{const s=e.get(n);if(s!==void 0)return s;const r=t(n,...i);return e.set(n,r),r}}const Ya=BigInt(0),da=BigInt(1),zm=BigInt(2),Nie=BigInt(3),Rie=BigInt(4),Pie=BigInt(5),$Ne=BigInt(7),Iie=BigInt(8),UNe=BigInt(9),Die=BigInt(16);function Nc(t,e){const n=t%e;return n>=Ya?n:e+n}function au(t,e,n){let i=t;for(;e-- >Ya;)i*=i,i%=n;return i}function Dq(t,e){if(t===Ya)throw new Error("invert: expected non-zero number");if(e<=Ya)throw new Error("invert: expected positive modulus, got "+e);let n=Nc(t,e),i=e,s=Ya,r=da;for(;n!==Ya;){const o=i/n,a=i%n,c=s-r*o;i=n,n=a,s=r,r=c}if(i!==da)throw new Error("invert: does not exist");return Nc(s,e)}function mM(t,e,n){if(!t.eql(t.sqr(e),n))throw new Error("Cannot find square root")}function Oie(t,e){const n=(t.ORDER+da)/Rie,i=t.pow(e,n);return mM(t,i,e),i}function BNe(t,e){const n=(t.ORDER-Pie)/Iie,i=t.mul(e,zm),s=t.pow(i,n),r=t.mul(e,s),o=t.mul(t.mul(r,zm),s),a=t.mul(r,t.sub(o,t.ONE));return mM(t,a,e),a}function FNe(t){const e=Vp(t),n=Mie(t),i=n(e,e.neg(e.ONE)),s=n(e,i),r=n(e,e.neg(i)),o=(t+$Ne)/Die;return(a,c)=>{let l=a.pow(c,o),d=a.mul(l,i);const h=a.mul(l,s),p=a.mul(l,r),g=a.eql(a.sqr(d),c),b=a.eql(a.sqr(h),c);l=a.cmov(l,d,g),d=a.cmov(p,h,b);const w=a.eql(a.sqr(d),c),C=a.cmov(l,d,w);return mM(a,C,c),C}}function Mie(t){if(t<Nie)throw new Error("sqrt is not defined for small field");let e=t-da,n=0;for(;e%zm===Ya;)e/=zm,n++;let i=zm;const s=Vp(t);for(;Oq(s,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Oie;let r=s.pow(i,e);const o=(e+da)/zm;return function(a,c){if(a.is0(c))return c;if(Oq(a,c)!==1)throw new Error("Cannot find square root");let l=n,d=a.mul(a.ONE,r),h=a.pow(c,e),p=a.pow(c,o);for(;!a.eql(h,a.ONE);){if(a.is0(h))return a.ZERO;let g=1,b=a.sqr(h);for(;!a.eql(b,a.ONE);)if(g++,b=a.sqr(b),g===l)throw new Error("Cannot find square root");const w=da<<BigInt(l-g-1),C=a.pow(d,w);l=g,d=a.sqr(C),h=a.mul(h,d),p=a.mul(p,C)}return p}}function jNe(t){return t%Rie===Nie?Oie:t%Iie===Pie?BNe:t%Die===UNe?FNe(t):Mie(t)}const VNe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function WNe(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=VNe.reduce((i,s)=>(i[s]="function",i),e);return vS(t,n),t}function qNe(t,e,n){if(n<Ya)throw new Error("invalid exponent, negatives unsupported");if(n===Ya)return t.ONE;if(n===da)return e;let i=t.ONE,s=e;for(;n>Ya;)n&da&&(i=t.mul(i,s)),s=t.sqr(s),n>>=da;return i}function Lie(t,e,n=!1){const i=new Array(e.length).fill(n?t.ZERO:void 0),s=e.reduce((o,a,c)=>t.is0(a)?o:(i[c]=o,t.mul(o,a)),t.ONE),r=t.inv(s);return e.reduceRight((o,a,c)=>t.is0(a)?o:(i[c]=t.mul(o,i[c]),t.mul(o,a)),r),i}function Oq(t,e){const n=(t.ORDER-da)/zm,i=t.pow(e,n),s=t.eql(i,t.ONE),r=t.eql(i,t.ZERO),o=t.eql(i,t.neg(t.ONE));if(!s&&!r&&!o)throw new Error("invalid Legendre symbol result");return s?1:r?0:-1}function $ie(t,e){e!==void 0&&_f(e);const n=e!==void 0?e:t.toString(2).length,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}function Vp(t,e,n=!1,i={}){if(t<=Ya)throw new Error("invalid field: expected ORDER > 0, got "+t);let s,r,o=!1,a;if(typeof e=="object"&&e!=null){if(i.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=e;p.BITS&&(s=p.BITS),p.sqrt&&(r=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(o=p.modFromBytes),a=p.allowedLengths}else typeof e=="number"&&(s=e),i.sqrt&&(r=i.sqrt);const{nBitLength:c,nByteLength:l}=$ie(t,s);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let d;const h=Object.freeze({ORDER:t,isLE:n,BITS:c,BYTES:l,MASK:F6(c),ZERO:Ya,ONE:da,allowedLengths:a,create:p=>Nc(p,t),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return Ya<=p&&p<t},is0:p=>p===Ya,isValidNot0:p=>!h.is0(p)&&h.isValid(p),isOdd:p=>(p&da)===da,neg:p=>Nc(-p,t),eql:(p,g)=>p===g,sqr:p=>Nc(p*p,t),add:(p,g)=>Nc(p+g,t),sub:(p,g)=>Nc(p-g,t),mul:(p,g)=>Nc(p*g,t),pow:(p,g)=>qNe(h,p,g),div:(p,g)=>Nc(p*Dq(g,t),t),sqrN:p=>p*p,addN:(p,g)=>p+g,subN:(p,g)=>p-g,mulN:(p,g)=>p*g,inv:p=>Dq(p,t),sqrt:r||(p=>(d||(d=jNe(t)),d(h,p))),toBytes:p=>n?pM(p,l):fM(p,l),fromBytes:(p,g=!0)=>{if(a){if(!a.includes(p.length)||p.length>l)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+p.length);const w=new Uint8Array(l);w.set(p,n?0:w.length-p.length),p=w}if(p.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+p.length);let b=n?S_(p):wS(p);if(o&&(b=Nc(b,t)),!g&&!h.isValid(b))throw new Error("invalid field element: outside of range 0..ORDER");return b},invertBatch:p=>Lie(h,p),cmov:(p,g,b)=>b?g:p});return Object.freeze(h)}function Uie(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Bie(t){const e=Uie(t);return e+Math.ceil(e/2)}function zNe(t,e,n=!1){const i=t.length,s=Uie(e),r=Bie(e);if(i<16||i<r||i>1024)throw new Error("expected "+r+"-1024 bytes of input, got "+i);const o=n?S_(t):wS(t),a=Nc(o,e-da)+da;return n?pM(a,s):fM(a,s)}const rb=BigInt(0),Hm=BigInt(1);function A_(t,e){const n=e.negate();return t?n:e}function N7(t,e){const n=Lie(t.Fp,e.map(i=>i.Z));return e.map((i,s)=>t.fromAffine(i.toAffine(n[s])))}function Fie(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function R7(t,e){Fie(t,e);const n=Math.ceil(e/t)+1,i=2**(t-1),s=2**t,r=F6(t),o=BigInt(t);return{windows:n,windowSize:i,mask:r,maxNumber:s,shiftBy:o}}function Mq(t,e,n){const{windowSize:i,mask:s,maxNumber:r,shiftBy:o}=n;let a=Number(t&s),c=t>>o;a>i&&(a-=r,c+=Hm);const l=e*i,d=l+Math.abs(a)-1,h=a===0,p=a<0,g=e%2!==0;return{nextN:c,offset:d,isZero:h,isNeg:p,isNegF:g,offsetF:l}}function HNe(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,i)=>{if(!(n instanceof e))throw new Error("invalid point at index "+i)})}function GNe(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,i)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+i)})}const P7=new WeakMap,jie=new WeakMap;function I7(t){return jie.get(t)||1}function Lq(t){if(t!==rb)throw new Error("invalid wNAF")}class KNe{constructor(e,n){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=n}_unsafeLadder(e,n,i=this.ZERO){let s=e;for(;n>rb;)n&Hm&&(i=i.add(s)),s=s.double(),n>>=Hm;return i}precomputeWindow(e,n){const{windows:i,windowSize:s}=R7(n,this.bits),r=[];let o=e,a=o;for(let c=0;c<i;c++){a=o,r.push(a);for(let l=1;l<s;l++)a=a.add(o),r.push(a);o=a.double()}return r}wNAF(e,n,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let s=this.ZERO,r=this.BASE;const o=R7(e,this.bits);for(let a=0;a<o.windows;a++){const{nextN:c,offset:l,isZero:d,isNeg:h,isNegF:p,offsetF:g}=Mq(i,a,o);i=c,d?r=r.add(A_(p,n[g])):s=s.add(A_(h,n[l]))}return Lq(i),{p:s,f:r}}wNAFUnsafe(e,n,i,s=this.ZERO){const r=R7(e,this.bits);for(let o=0;o<r.windows&&i!==rb;o++){const{nextN:a,offset:c,isZero:l,isNeg:d}=Mq(i,o,r);if(i=a,!l){const h=n[c];s=s.add(d?h.negate():h)}}return Lq(i),s}getPrecomputes(e,n,i){let s=P7.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&(typeof i=="function"&&(s=i(s)),P7.set(n,s))),s}cached(e,n,i){const s=I7(e);return this.wNAF(s,this.getPrecomputes(s,e,i),n)}unsafe(e,n,i,s){const r=I7(e);return r===1?this._unsafeLadder(e,n,s):this.wNAFUnsafe(r,this.getPrecomputes(r,e,i),n,s)}createCache(e,n){Fie(n,this.bits),jie.set(e,n),P7.delete(e)}hasCache(e){return I7(e)!==1}}function YNe(t,e,n,i){let s=e,r=t.ZERO,o=t.ZERO;for(;n>rb||i>rb;)n&Hm&&(r=r.add(s)),i&Hm&&(o=o.add(s)),s=s.double(),n>>=Hm,i>>=Hm;return{p1:r,p2:o}}function ZNe(t,e,n,i){HNe(n,t),GNe(i,e);const s=n.length,r=i.length;if(s!==r)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=kie(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=F6(c),d=new Array(Number(l)+1).fill(o),h=Math.floor((e.BITS-1)/c)*c;let p=o;for(let g=h;g>=0;g-=c){d.fill(o);for(let w=0;w<r;w++){const C=i[w],E=Number(C>>BigInt(g)&l);d[E]=d[E].add(n[w])}let b=o;for(let w=d.length-1,C=o;w>0;w--)C=C.add(d[w]),b=b.add(C);if(p=p.add(b),g!==0)for(let w=0;w<c;w++)p=p.double()}return p}function $q(t,e,n){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return WNe(e),e}else return Vp(t,{isLE:n})}function QNe(t,e,n={},i){if(i===void 0&&(i=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const a of["p","n","h"]){const c=e[a];if(!(typeof c=="bigint"&&c>rb))throw new Error(`CURVE.${a} must be positive bigint`)}const s=$q(e.p,n.Fp,i),r=$q(e.n,n.Fn,i),o=["Gx","Gy","a","b"];for(const a of o)if(!s.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:s,Fn:r}}BigInt(0),BigInt(1),BigInt(2),BigInt(8),uie("HashToScalar-");const Ov=BigInt(0),Py=BigInt(1),mx=BigInt(2);function XNe(t){return vS(t,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...t})}function JNe(t){const e=XNe(t),{P:n,type:i,adjustScalarBytes:s,powPminus2:r,randomBytes:o}=e,a=i==="x25519";if(!a&&i!=="x448")throw new Error("invalid type");const c=o||_1,l=a?255:448,d=a?32:56,h=BigInt(a?9:5),p=BigInt(a?121665:39081),g=a?mx**BigInt(254):mx**BigInt(447),b=a?BigInt(8)*mx**BigInt(251)-Py:BigInt(4)*mx**BigInt(445)-Py,w=g+b+Py,C=G=>Nc(G,n),E=T(h);function T(G){return pM(C(G),d)}function A(G){const I=Bo("u coordinate",G,d);return a&&(I[31]&=127),C(S_(I))}function k(G){return S_(s(Bo("scalar",G,d)))}function R(G,I){const S=F(A(I),k(G));if(S===Ov)throw new Error("invalid private or public key received");return T(S)}function P(G){return R(G,E)}function B(G,I,S){const v=C(G*(I-S));return I=C(I-v),S=C(S+v),{x_2:I,x_3:S}}function F(G,I){UP("u",G,Ov,n),UP("scalar",I,g,w);const S=I,v=G;let _=Py,N=Ov,$=G,U=Py,j=Ov;for(let O=BigInt(l-1);O>=Ov;O--){const H=S>>O&Py;j^=H,{x_2:_,x_3:$}=B(j,_,$),{x_2:N,x_3:U}=B(j,N,U),j=H;const J=_+N,W=C(J*J),Z=_-N,Y=C(Z*Z),Q=W-Y,ee=$+U,ie=$-U,re=C(ie*J),oe=C(ee*Z),de=re+oe,he=re-oe;$=C(de*de),U=C(v*C(he*he)),_=C(W*Y),N=C(Q*(W+C(p*Q)))}({x_2:_,x_3:$}=B(j,_,$)),{x_2:N,x_3:U}=B(j,N,U);const D=r(N);return C(_*D)}const z={secretKey:d,publicKey:d,seed:d},K=(G=c(d))=>($u(G,z.seed),G);function q(G){const I=K(G);return{secretKey:I,publicKey:P(I)}}return{keygen:q,getSharedSecret:(G,I)=>R(G,I),getPublicKey:G=>P(G),scalarMult:R,scalarMultBase:P,utils:{randomSecretKey:K,randomPrivateKey:K},GuBytes:E.slice(),lengths:z}}const eRe=BigInt(1),Uq=BigInt(2),tRe=BigInt(3),nRe=BigInt(5);BigInt(8);const Vie=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),iRe={p:Vie,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function sRe(t){const e=BigInt(10),n=BigInt(20),i=BigInt(40),s=BigInt(80),r=Vie,o=t*t%r*t%r,a=au(o,Uq,r)*o%r,c=au(a,eRe,r)*t%r,l=au(c,nRe,r)*c%r,d=au(l,e,r)*l%r,h=au(d,n,r)*d%r,p=au(h,i,r)*h%r,g=au(p,s,r)*p%r,b=au(g,s,r)*p%r,w=au(b,e,r)*l%r;return{pow_p_5_8:au(w,Uq,r)*t%r,b2:o}}function rRe(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const oRe=Vp(iRe.p,{isLE:!0}),BP=(()=>{const t=oRe.ORDER;return JNe({P:t,type:"x25519",powPminus2:e=>{const{pow_p_5_8:n,b2:i}=sRe(e);return Nc(au(n,tRe,t)*i,t)},adjustScalarBytes:rRe})})(),Bq=(t,e)=>(t+(t>=0?e:-e)/Wie)/e;function aRe(t,e,n){const[[i,s],[r,o]]=e,a=Bq(o*t,n),c=Bq(-s*t,n);let l=t-a*i-c*r,d=-a*s-c*o;const h=l<Zh,p=d<Zh;h&&(l=-l),p&&(d=-d);const g=F6(Math.ceil(kie(n)/2))+x2;if(l<Zh||l>=g||d<Zh||d>=g)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:h,k1:l,k2neg:p,k2:d}}function FP(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function D7(t,e){const n={};for(let i of Object.keys(e))n[i]=t[i]===void 0?e[i]:t[i];return __(n.lowS,"lowS"),__(n.prehash,"prehash"),n.format!==void 0&&FP(n.format),n}class cRe extends Error{constructor(e=""){super(e)}}const Vh={Err:cRe,_tlv:{encode:(t,e)=>{const{Err:n}=Vh;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length&1)throw new n("tlv.encode: unpadded data");const i=e.length/2,s=px(i);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const r=i>127?px(s.length/2|128):"";return px(t)+r+s+e},decode(t,e){const{Err:n}=Vh;let i=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[i++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[i++],r=!!(s&128);let o=0;if(!r)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=e.subarray(i,i+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const d of l)o=o<<8|d;if(i+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=e.subarray(i,i+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:e.subarray(i+o)}}},_int:{encode(t){const{Err:e}=Vh;if(t<Zh)throw new e("integer: negative integers are not allowed");let n=px(t);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=Vh;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return wS(t)}},toSig(t){const{Err:e,_int:n,_tlv:i}=Vh,s=Bo("signature",t),{v:r,l:o}=i.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=i.decode(2,r),{v:l,l:d}=i.decode(2,c);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(t){const{_tlv:e,_int:n}=Vh,i=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s)),r=i+s;return e.encode(48,r)}},Zh=BigInt(0),x2=BigInt(1),Wie=BigInt(2),gx=BigInt(3),lRe=BigInt(4);function i2(t,e){const{BYTES:n}=t;let i;if(typeof e=="bigint")i=e;else{let s=Bo("private key",e);try{i=t.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof e}`)}}if(!t.isValidNot0(i))throw new Error("invalid private key: out of range [1..N-1]");return i}function uRe(t,e={}){const n=QNe("weierstrass",t,e),{Fp:i,Fn:s}=n;let r=n.CURVE;const{h:o,n:a}=r;vS(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=e;if(c&&(!i.is0(r.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=zie(i,s);function d(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function h(G,I,S){const{x:v,y:_}=I.toAffine(),N=i.toBytes(v);if(__(S,"isCompressed"),S){d();const $=!i.isOdd(_);return z0(qie($),N)}else return z0(Uint8Array.of(4),N,i.toBytes(_))}function p(G){qm(G,void 0,"Point");const{publicKey:I,publicKeyUncompressed:S}=l,v=G.length,_=G[0],N=G.subarray(1);if(v===I&&(_===2||_===3)){const $=i.fromBytes(N);if(!i.isValid($))throw new Error("bad point: is not on curve, wrong x");const U=w($);let j;try{j=i.sqrt(U)}catch(O){const H=O instanceof Error?": "+O.message:"";throw new Error("bad point: is not on curve, sqrt error"+H)}d();const D=i.isOdd(j);return(_&1)===1!==D&&(j=i.neg(j)),{x:$,y:j}}else if(v===S&&_===4){const $=i.BYTES,U=i.fromBytes(N.subarray(0,$)),j=i.fromBytes(N.subarray($,$*2));if(!C(U,j))throw new Error("bad point: is not on curve");return{x:U,y:j}}else throw new Error(`bad point: got length ${v}, expected compressed=${I} or uncompressed=${S}`)}const g=e.toBytes||h,b=e.fromBytes||p;function w(G){const I=i.sqr(G),S=i.mul(I,G);return i.add(i.add(S,i.mul(G,r.a)),r.b)}function C(G,I){const S=i.sqr(I),v=w(G);return i.eql(S,v)}if(!C(r.Gx,r.Gy))throw new Error("bad curve params: generator point");const E=i.mul(i.pow(r.a,gx),lRe),T=i.mul(i.sqr(r.b),BigInt(27));if(i.is0(i.add(E,T)))throw new Error("bad curve params: a or b");function A(G,I,S=!1){if(!i.isValid(I)||S&&i.is0(I))throw new Error(`bad point coordinate ${G}`);return I}function k(G){if(!(G instanceof z))throw new Error("ProjectivePoint expected")}function R(G){if(!c||!c.basises)throw new Error("no endo");return aRe(G,c.basises,s.ORDER)}const P=Iq((G,I)=>{const{X:S,Y:v,Z:_}=G;if(i.eql(_,i.ONE))return{x:S,y:v};const N=G.is0();I==null&&(I=N?i.ONE:i.inv(_));const $=i.mul(S,I),U=i.mul(v,I),j=i.mul(_,I);if(N)return{x:i.ZERO,y:i.ZERO};if(!i.eql(j,i.ONE))throw new Error("invZ was invalid");return{x:$,y:U}}),B=Iq(G=>{if(G.is0()){if(e.allowInfinityPoint&&!i.is0(G.Y))return;throw new Error("bad point: ZERO")}const{x:I,y:S}=G.toAffine();if(!i.isValid(I)||!i.isValid(S))throw new Error("bad point: x or y not field elements");if(!C(I,S))throw new Error("bad point: equation left != right");if(!G.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function F(G,I,S,v,_){return S=new z(i.mul(S.X,G),S.Y,S.Z),I=A_(v,I),S=A_(_,S),I.add(S)}class z{constructor(I,S,v){this.X=A("x",I),this.Y=A("y",S,!0),this.Z=A("z",v),Object.freeze(this)}static CURVE(){return r}static fromAffine(I){const{x:S,y:v}=I||{};if(!I||!i.isValid(S)||!i.isValid(v))throw new Error("invalid affine point");if(I instanceof z)throw new Error("projective point not allowed");return i.is0(S)&&i.is0(v)?z.ZERO:new z(S,v,i.ONE)}static fromBytes(I){const S=z.fromAffine(b(qm(I,void 0,"point")));return S.assertValidity(),S}static fromHex(I){return z.fromBytes(Bo("pointHex",I))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(I=8,S=!0){return q.createCache(this,I),S||this.multiply(gx),this}assertValidity(){B(this)}hasEvenY(){const{y:I}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(I)}equals(I){k(I);const{X:S,Y:v,Z:_}=this,{X:N,Y:$,Z:U}=I,j=i.eql(i.mul(S,U),i.mul(N,_)),D=i.eql(i.mul(v,U),i.mul($,_));return j&&D}negate(){return new z(this.X,i.neg(this.Y),this.Z)}double(){const{a:I,b:S}=r,v=i.mul(S,gx),{X:_,Y:N,Z:$}=this;let U=i.ZERO,j=i.ZERO,D=i.ZERO,O=i.mul(_,_),H=i.mul(N,N),J=i.mul($,$),W=i.mul(_,N);return W=i.add(W,W),D=i.mul(_,$),D=i.add(D,D),U=i.mul(I,D),j=i.mul(v,J),j=i.add(U,j),U=i.sub(H,j),j=i.add(H,j),j=i.mul(U,j),U=i.mul(W,U),D=i.mul(v,D),J=i.mul(I,J),W=i.sub(O,J),W=i.mul(I,W),W=i.add(W,D),D=i.add(O,O),O=i.add(D,O),O=i.add(O,J),O=i.mul(O,W),j=i.add(j,O),J=i.mul(N,$),J=i.add(J,J),O=i.mul(J,W),U=i.sub(U,O),D=i.mul(J,H),D=i.add(D,D),D=i.add(D,D),new z(U,j,D)}add(I){k(I);const{X:S,Y:v,Z:_}=this,{X:N,Y:$,Z:U}=I;let j=i.ZERO,D=i.ZERO,O=i.ZERO;const H=r.a,J=i.mul(r.b,gx);let W=i.mul(S,N),Z=i.mul(v,$),Y=i.mul(_,U),Q=i.add(S,v),ee=i.add(N,$);Q=i.mul(Q,ee),ee=i.add(W,Z),Q=i.sub(Q,ee),ee=i.add(S,_);let ie=i.add(N,U);return ee=i.mul(ee,ie),ie=i.add(W,Y),ee=i.sub(ee,ie),ie=i.add(v,_),j=i.add($,U),ie=i.mul(ie,j),j=i.add(Z,Y),ie=i.sub(ie,j),O=i.mul(H,ee),j=i.mul(J,Y),O=i.add(j,O),j=i.sub(Z,O),O=i.add(Z,O),D=i.mul(j,O),Z=i.add(W,W),Z=i.add(Z,W),Y=i.mul(H,Y),ee=i.mul(J,ee),Z=i.add(Z,Y),Y=i.sub(W,Y),Y=i.mul(H,Y),ee=i.add(ee,Y),W=i.mul(Z,ee),D=i.add(D,W),W=i.mul(ie,ee),j=i.mul(Q,j),j=i.sub(j,W),W=i.mul(Q,Z),O=i.mul(ie,O),O=i.add(O,W),new z(j,D,O)}subtract(I){return this.add(I.negate())}is0(){return this.equals(z.ZERO)}multiply(I){const{endo:S}=e;if(!s.isValidNot0(I))throw new Error("invalid scalar: out of range");let v,_;const N=$=>q.cached(this,$,U=>N7(z,U));if(S){const{k1neg:$,k1:U,k2neg:j,k2:D}=R(I),{p:O,f:H}=N(U),{p:J,f:W}=N(D);_=H.add(W),v=F(S.beta,O,J,$,j)}else{const{p:$,f:U}=N(I);v=$,_=U}return N7(z,[v,_])[0]}multiplyUnsafe(I){const{endo:S}=e,v=this;if(!s.isValid(I))throw new Error("invalid scalar: out of range");if(I===Zh||v.is0())return z.ZERO;if(I===x2)return v;if(q.hasCache(this))return this.multiply(I);if(S){const{k1neg:_,k1:N,k2neg:$,k2:U}=R(I),{p1:j,p2:D}=YNe(z,v,N,U);return F(S.beta,j,D,_,$)}else return q.unsafe(v,I)}multiplyAndAddUnsafe(I,S,v){const _=this.multiplyUnsafe(S).add(I.multiplyUnsafe(v));return _.is0()?void 0:_}toAffine(I){return P(this,I)}isTorsionFree(){const{isTorsionFree:I}=e;return o===x2?!0:I?I(z,this):q.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:I}=e;return o===x2?this:I?I(z,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(I=!0){return __(I,"isCompressed"),this.assertValidity(),g(z,this,I)}toHex(I=!0){return C2(this.toBytes(I))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(I=!0){return this.toBytes(I)}_setWindowSize(I){this.precompute(I)}static normalizeZ(I){return N7(z,I)}static msm(I,S){return ZNe(z,s,I,S)}static fromPrivateKey(I){return z.BASE.multiply(i2(s,I))}}z.BASE=new z(r.Gx,r.Gy,i.ONE),z.ZERO=new z(i.ZERO,i.ONE,i.ZERO),z.Fp=i,z.Fn=s;const K=s.BITS,q=new KNe(z,e.endo?Math.ceil(K/2):K);return z.BASE.precompute(8),z}function qie(t){return Uint8Array.of(t?2:3)}function zie(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function dRe(t,e={}){const{Fn:n}=t,i=e.randomBytes||_1,s=Object.assign(zie(t.Fp,n),{seed:Bie(n.ORDER)});function r(p){try{return!!i2(n,p)}catch{return!1}}function o(p,g){const{publicKey:b,publicKeyUncompressed:w}=s;try{const C=p.length;return g===!0&&C!==b||g===!1&&C!==w?!1:!!t.fromBytes(p)}catch{return!1}}function a(p=i(s.seed)){return zNe(qm(p,s.seed,"seed"),n.ORDER)}function c(p,g=!0){return t.BASE.multiply(i2(n,p)).toBytes(g)}function l(p){const g=a(p);return{secretKey:g,publicKey:c(g)}}function d(p){if(typeof p=="bigint")return!1;if(p instanceof t)return!0;const{secretKey:g,publicKey:b,publicKeyUncompressed:w}=s;if(n.allowedLengths||g===b)return;const C=Bo("key",p).length;return C===b||C===w}function h(p,g,b=!0){if(d(p)===!0)throw new Error("first arg must be private key");if(d(g)===!1)throw new Error("second arg must be public key");const w=i2(n,p);return t.fromHex(g).multiply(w).toBytes(b)}return Object.freeze({getPublicKey:c,getSharedSecret:h,keygen:l,Point:t,utils:{isValidSecretKey:r,isValidPublicKey:o,randomSecretKey:a,isValidPrivateKey:r,randomPrivateKey:a,normPrivateKeyToScalar:p=>i2(n,p),precompute(p=8,g=t.BASE){return g.precompute(p,!1)}},lengths:s})}function hRe(t,e,n={}){fS(e),vS(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const i=n.randomBytes||_1,s=n.hmac||((S,...v)=>yS(e,S,z0(...v))),{Fp:r,Fn:o}=t,{ORDER:a,BITS:c}=o,{keygen:l,getPublicKey:d,getSharedSecret:h,utils:p,lengths:g}=dRe(t,n),b={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},w="compact";function C(S){const v=a>>x2;return S>v}function E(S,v){if(!o.isValidNot0(v))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return v}function T(S,v){FP(v);const _=g.signature,N=v==="compact"?_:v==="recovered"?_+1:void 0;return qm(S,N,`${v} signature`)}class A{constructor(v,_,N){this.r=E("r",v),this.s=E("s",_),N!=null&&(this.recovery=N),Object.freeze(this)}static fromBytes(v,_=w){T(v,_);let N;if(_==="der"){const{r:D,s:O}=Vh.toSig(qm(v));return new A(D,O)}_==="recovered"&&(N=v[0],_="compact",v=v.subarray(1));const $=o.BYTES,U=v.subarray(0,$),j=v.subarray($,$*2);return new A(o.fromBytes(U),o.fromBytes(j),N)}static fromHex(v,_){return this.fromBytes(x_(v),_)}addRecoveryBit(v){return new A(this.r,this.s,v)}recoverPublicKey(v){const _=r.ORDER,{r:N,s:$,recovery:U}=this;if(U==null||![0,1,2,3].includes(U))throw new Error("recovery id invalid");if(a*Wie<_&&U>1)throw new Error("recovery id is ambiguous for h>1 curve");const j=U===2||U===3?N+a:N;if(!r.isValid(j))throw new Error("recovery id 2 or 3 invalid");const D=r.toBytes(j),O=t.fromBytes(z0(qie((U&1)===0),D)),H=o.inv(j),J=R(Bo("msgHash",v)),W=o.create(-J*H),Z=o.create($*H),Y=t.BASE.multiplyUnsafe(W).add(O.multiplyUnsafe(Z));if(Y.is0())throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return C(this.s)}toBytes(v=w){if(FP(v),v==="der")return x_(Vh.hexFromSig(this));const _=o.toBytes(this.r),N=o.toBytes(this.s);if(v==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return z0(Uint8Array.of(this.recovery),_,N)}return z0(_,N)}toHex(v){return C2(this.toBytes(v))}assertValidity(){}static fromCompact(v){return A.fromBytes(Bo("sig",v),"compact")}static fromDER(v){return A.fromBytes(Bo("sig",v),"der")}normalizeS(){return this.hasHighS()?new A(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return C2(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return C2(this.toBytes("compact"))}}const k=n.bits2int||function(S){if(S.length>8192)throw new Error("input is too large");const v=wS(S),_=S.length*8-c;return _>0?v>>BigInt(_):v},R=n.bits2int_modN||function(S){return o.create(k(S))},P=F6(c);function B(S){return UP("num < 2^"+c,S,Zh,P),o.toBytes(S)}function F(S,v){return qm(S,void 0,"message"),v?qm(e(S),void 0,"prehashed message"):S}function z(S,v,_){if(["recovered","canonical"].some(Z=>Z in _))throw new Error("sign() legacy options not supported");const{lowS:N,prehash:$,extraEntropy:U}=D7(_,b);S=F(S,$);const j=R(S),D=i2(o,v),O=[B(D),B(j)];if(U!=null&&U!==!1){const Z=U===!0?i(g.secretKey):U;O.push(Bo("extraEntropy",Z))}const H=z0(...O),J=j;function W(Z){const Y=k(Z);if(!o.isValidNot0(Y))return;const Q=o.inv(Y),ee=t.BASE.multiply(Y).toAffine(),ie=o.create(ee.x);if(ie===Zh)return;const re=o.create(Q*o.create(J+ie*D));if(re===Zh)return;let oe=(ee.x===ie?0:2)|Number(ee.y&x2),de=re;return N&&C(re)&&(de=o.neg(re),oe^=1),new A(ie,de,oe)}return{seed:H,k2sig:W}}function K(S,v,_={}){S=Bo("message",S);const{seed:N,k2sig:$}=z(S,v,_);return LNe(e.outputLen,o.BYTES,s)(N,$)}function q(S){let v;const _=typeof S=="string"||hS(S),N=!_&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!_&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(N)v=new A(S.r,S.s);else if(_){try{v=A.fromBytes(Bo("sig",S),"der")}catch($){if(!($ instanceof Vh.Err))throw $}if(!v)try{v=A.fromBytes(Bo("sig",S),"compact")}catch{return!1}}return v||!1}function G(S,v,_,N={}){const{lowS:$,prehash:U,format:j}=D7(N,b);if(_=Bo("publicKey",_),v=F(Bo("message",v),U),"strict"in N)throw new Error("options.strict was renamed to lowS");const D=j===void 0?q(S):A.fromBytes(Bo("sig",S),j);if(D===!1)return!1;try{const O=t.fromBytes(_);if($&&D.hasHighS())return!1;const{r:H,s:J}=D,W=R(v),Z=o.inv(J),Y=o.create(W*Z),Q=o.create(H*Z),ee=t.BASE.multiplyUnsafe(Y).add(O.multiplyUnsafe(Q));return ee.is0()?!1:o.create(ee.x)===H}catch{return!1}}function I(S,v,_={}){const{prehash:N}=D7(_,b);return v=F(v,N),A.fromBytes(S,"recovered").recoverPublicKey(v).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:h,utils:p,lengths:g,Point:t,sign:K,verify:G,recoverPublicKey:I,Signature:A,hash:e})}function fRe(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},n=t.Fp;let i=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const s=Vp(e.n,{BITS:t.nBitLength,allowedLengths:i,modFromBytes:t.wrapPrivateKey}),r={Fp:n,Fn:s,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:r}}function pRe(t){const{CURVE:e,curveOpts:n}=fRe(t),i={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:n,hash:t.hash,ecdsaOpts:i}}function mRe(t,e){const n=e.Point;return Object.assign({},e,{ProjectivePoint:n,CURVE:Object.assign({},t,$ie(n.Fn.ORDER,n.Fn.BITS))})}function gRe(t){const{CURVE:e,curveOpts:n,hash:i,ecdsaOpts:s}=pRe(t),r=uRe(e,n),o=hRe(r,i,s);return mRe(t,o)}function jP(t,e){const n=i=>gRe({...t,hash:i});return{...n(e),create:n}}const Hie={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),G
158y:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Gie={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Kie={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},yRe=Vp(Hie.p),bRe=Vp(Gie.p),wRe=Vp(Kie.p),vRe=jP({...Hie,Fp:yRe,lowS:!1},mS);jP({...Gie,Fp:bRe,lowS:!1},Ske),jP({...Kie,Fp:wRe,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},_ke);const CRe=vRe,Yie="base10",ha="base16",qa="base64pad",H0="base64url",j6="utf8",Zie=0,af=1,V6=2,xRe=0,Fq=1,p3=12,gM=32;function ERe(){const t=BP.utils.randomPrivateKey(),e=BP.getPublicKey(t);return{privateKey:Xa(t,ha),publicKey:Xa(e,ha)}}function VP(){const t=_1(gM);return Xa(t,ha)}function _Re(t,e){const n=BP.getSharedSecret(Al(t,ha),Al(e,ha)),i=ONe(bS,n,void 0,void 0,gM);return Xa(i,ha)}function mE(t){const e=bS(Al(t,ha));return Xa(e,ha)}function Cl(t){const e=bS(Al(t,j6));return Xa(e,ha)}function Qie(t){return Al(`${t}`,Yie)}function Mg(t){return Number(Xa(t,Yie))}function Xie(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Jie(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=(4-e.length%4)%4;return e+"=".repeat(n)}function SRe(t){const e=Qie(typeof t.type<"u"?t.type:Zie);if(Mg(e)===af&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof t.senderPublicKey<"u"?Al(t.senderPublicKey,ha):void 0,i=typeof t.iv<"u"?Al(t.iv,ha):_1(p3),s=Al(t.symKey,ha),r=Sie(s,i).encrypt(Al(t.message,j6)),o=ese({type:e,sealed:r,iv:i,senderPublicKey:n});return t.encoding===H0?Xie(o):o}function ARe(t){const e=Al(t.symKey,ha),{sealed:n,iv:i}=T5({encoded:t.encoded,encoding:t.encoding}),s=Sie(e,i).decrypt(n);if(s===null)throw new Error("Failed to decrypt");return Xa(s,j6)}function TRe(t,e){const n=Qie(V6),i=_1(p3),s=Al(t,j6),r=ese({type:n,sealed:s,iv:i});return e===H0?Xie(r):r}function kRe(t,e){const{sealed:n}=T5({encoded:t,encoding:e});return Xa(n,j6)}function ese(t){if(Mg(t.type)===V6)return Xa(f3([t.type,t.sealed]),qa);if(Mg(t.type)===af){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Xa(f3([t.type,t.senderPublicKey,t.iv,t.sealed]),qa)}return Xa(f3([t.type,t.iv,t.sealed]),qa)}function T5(t){const e=(t.encoding||qa)===H0?Jie(t.encoded):t.encoded,n=Al(e,qa),i=n.slice(xRe,Fq),s=Fq;if(Mg(i)===af){const c=s+gM,l=c+p3,d=n.slice(s,c),h=n.slice(c,l),p=n.slice(l);return{type:i,sealed:p,iv:h,senderPublicKey:d}}if(Mg(i)===V6){const c=n.slice(s),l=_1(p3);return{type:i,sealed:c,iv:l}}const r=s+p3,o=n.slice(s,r),a=n.slice(r);return{type:i,sealed:a,iv:o}}function NRe(t,e){const n=T5({encoded:t,encoding:e==null?void 0:e.encoding});return tse({type:Mg(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?Xa(n.senderPublicKey,ha):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function tse(t){const e=(t==null?void 0:t.type)||Zie;if(e===af){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function jq(t){return t.type===af&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function Vq(t){return t.type===V6}function RRe(t){const e=Buffer.from(t.x,"base64"),n=Buffer.from(t.y,"base64");return f3([new Uint8Array([4]),e,n])}function PRe(t,e){const[n,i,s]=t.split("."),r=Buffer.from(Jie(s),"base64");if(r.length!==64)throw new Error("Invalid signature length");
vendor: 1,338 bytes, line 158
158const o=r.slice(0,32),a=r.slice(32,64),c=`${n}.${i}`,l=bS(c),d=RRe(e);if(!CRe.verify(f3([o,a]),l,d))throw new Error("Invalid signature");return SP(t).payload}const IRe="irn";function T_(t){return(t==null?void 0:t.relay)||{protocol:IRe}}function s2(t){const e=h7e[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var DRe=Object.defineProperty,ORe=Object.defineProperties,MRe=Object.getOwnPropertyDescriptors,Wq=Object.getOwnPropertySymbols,LRe=Object.prototype.hasOwnProperty,$Re=Object.prototype.propertyIsEnumerable,qq=(t,e,n)=>e in t?DRe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,O7=(t,e)=>{for(var n in e||(e={}))LRe.call(e,n)&&qq(t,n,e[n]);if(Wq)for(var n of Wq(e))$Re.call(e,n)&&qq(t,n,e[n]);return t},URe=(t,e)=>ORe(t,MRe(e));function BRe(t,e="-"){const n={},i="relay"+e;return Object.keys(t).forEach(s=>{if(s.startsWith(i)){const r=s.replace(i,""),o=t[s];n[r]=o}}),n}function zq(t){if(!t.includes("wc:")){const l=sie(t);l!=null&&l.includes("wc:")&&(t=l)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),n=t.indexOf("?")!==-1?t.indexOf("?"):void 0,i=t.substring(0,e),s=t.substring(e+1,n).split("@"),r=typeof n<"u"?t.substring(n):"",o=new URLSearchParams(r),a=Object.fromEntries(o.entries()),c=typeof a.methods=="str
158ing"?a.methods.split(","):void 0;return{protocol:i,topic:FRe(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:BRe(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function FRe(t){return t.startsWith("//")?t.substring(2):t}function jRe(t,e="-"){const n="relay",i={};return Object.keys(t).forEach(s=>{const r=s,o=n+e+r;t[r]&&(i[o]=t[r])}),i}function Hq(t){const e=new URLSearchParams,n=O7(O7(URe(O7({},jRe(t.relay)),{symKey:t.symKey}),t.expiryTimestamp&&{expiryTimestamp:t.expiryTimestamp.toString()}),t.methods&&{methods:t.methods.join(",")});return Object.entries(n).sort(([i],[s])=>i.localeCompare(s)).forEach(([i,s])=>{s!==void 0&&e.append(i,String(s))}),`${t.protocol}:${t.topic}@${t.version}?${e}`}function yx(t,e,n){return`${t}?wc_ev=${n}&topic=${e}`}var VRe=Object.defineProperty,WRe=Object.defineProperties,qRe=Object.getOwnPropertyDescriptors,Gq=Object.getOwnPropertySymbols,zRe=Object.prototype.hasOwnProperty,HRe=Object.prototype.propertyIsEnumerable,Kq=(t,e,n)=>e in t?VRe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,GRe=(t,e)=>{for(var n in e||(e={}))zRe.call(e,n)&&Kq(t,n,e[n]);if(Gq)for(var n of Gq(e))HRe.call(e,n)&&Kq(t,n,e[n]);return t},KRe=(t,e)=>WRe(t,qRe(e));function zb(t){const e=[];return t.forEach(n=>{const[i,s]=n.split(":");e.push(`${i}:${s}`)}),e}function nse(t){const e=[];return Object.values(t).forEach(n=>{e.push(...zb(n.accounts))}),[...new Set(e)]}function YRe(t){const e=[];return Object.values(t).forEach(n=>{e.push(...n.methods)}),[...new Set(e)]}function ZRe(t){const e=[];return Object.values(t).forEach(n=>{e.push(...n.events)}),[...new Set(e)]}function QRe(t,e){const n=[];return Object.values(t).forEach(i=>{zb(i.accounts).includes(e)&&n.push(...i.methods)}),n}function XRe(t,e){const n=[];return Object.values(t).forEach(i=>{zb(i.accounts).includes(e)&&n.push(...i.events)}),n}function CS(t){return t.includes(":")}function r2(t){return CS(t)?t.split(":")[0]:t}function Yq(t){var e,n,i;const s={};if(!Td(t))return s;for(const[r,o]of Object.entries(t)){const a=CS(r)?[r]:o.chains,c=o.methods||[],l=o.events||[],d=r2(r);s[d]=KRe(GRe({},s[d]),{chains:Ad(a,(e=s[d])==null?void 0:e.chains),methods:Ad(c,(n=s[d])==null?void 0:n.methods),events:Ad(l,(i=s[d])==null?void 0:i.events)})}return s}function JRe(t){const e={};return t==null||t.forEach(n=>{var i;const[s,r]=n.split(":");e[s]||(e[s]={accounts:[],chains:[],events:[],methods:[]}),e[s].accounts.push(n),(i=e[s].chains)==null||i.push(`${s}:${r}`)}),e}function Zq(t,e){e=e.map(i=>i.replace("did:pkh:",""));const n=JRe(e);for(const[i,s]of Object.entries(n))s.methods?s.methods=Ad(s.methods,t):s.methods=t,s.events=["chainChanged","accountsChanged"];return n}function ePe(t,e){var n,i,s,r,o,a;const c=Yq(t),l=Yq(e),d={},h=Object.keys(c).concat(Object.keys(l));for(const p of h)d[p]={chains:Ad((n=c[p])==null?void 0:n.chains,(i=l[p])==null?void 0:i.chains),methods:Ad((s=c[p])==null?void 0:s.methods,(r=l[p])==null?void 0:r.methods),events:Ad((o=c[p])==null?void 0:o.events,(a=l[p])==null?void 0:a.events)};return d}const tPe={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},nPe={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};
vendor: 5,072 bytes, lines 158-164
158function Ct(t,e){const{message:n,code:i}=nPe[t];return{message:e?`${n} ${e}`:n,code:i}}function As(t,e){const{message:n,code:i}=tPe[t];return{message:e?`${n} ${e}`:n,code:i}}function cf(t,e){return!!Array.isArray(t)}function Td(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function eo(t){return typeof t>"u"}function Cr(t,e){return e&&eo(t)?!0:typeof t=="string"&&!!t.trim().length}function yM(t,e){return typeof t=="number"&&!isNaN(t)}function iPe(t,e){const{requiredNamespaces:n}=e,i=Object.keys(t.namespaces),s=Object.keys(n);let r=!0;return Wm(s,i)?(i.forEach(o=>{const{accounts:a,methods:c,events:l}=t.namespaces[o],d=zb(a),h=n[o];(!Wm(Jne(o,h),d)||!Wm(h.methods,c)||!Wm(h.events,l))&&(r=!1)}),r):!1}function k_(t){return Cr(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function sPe(t){if(Cr(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const n=e[0]+":"+e[1];return!!e[2]&&k_(n)}}return!1}function rPe(t){function e(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(Cr(t,!1)){if(e(t))return!0;const n=sie(t);return e(n)}}catch{}return!1}function oPe(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function aPe(t){return t==null?void 0:t.topic}function cPe(t,e){let n=null;return Cr(t==null?void 0:t.publicKey,!1)||(n=Ct("MISSING_OR_INVALID",`${e} controller public key should be a string`)),n}function Qq(t){let e=!0;return cf(t)?t.length&&(e=t.every(n=>Cr(n,!1))):e=!1,e}function lPe(t,e,n){let i=null;return cf(e)&&e.length?e.forEach(s=>{i||k_(s)||(i=As("UNSUPPORTED_CHAINS",`${n}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):k_(t)||(i=As("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function uPe(t,e,n){let i=null;return Object.entries(t).forEach(([s,r])=>{if(i)return;const o=lPe(s,Jne(s,r),`${e} ${n}`);o&&(i=o)}),i}function dPe(t,e){let n=null;return cf(t)?t.forEach(i=>{n||sPe(i)||(n=As("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):n=As("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function hPe(t,e){let n=null;return Object.values(t).forEach(i=>{if(n)return;const s=dPe(i==null?void 0:i.accounts,`${e} namespace`);s&&(n=s)}),n}function fPe(t,e){let n=null;return Qq(t==null?void 0:t.methods)?Qq(t==null?void 0:t.events)||(n=As("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):n=As("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),n}function ise(t,e){let n=null;return Object.values(t).forEach(i=>{if(n)return;const s=fPe(i,`${e}, namespace`);s&&(n=s)}),n}function pPe(t,e,n){let i=null;if(t&&Td(t)){const s=ise(t,e);s&&(i=s);const r=uPe(t,e,n);r&&(i=r)}else i=Ct("MISSING_OR_INVALID",`${e}, ${n} should be an object with data`);return i}function M7(t,e){let n=null;if(t&&Td(t)){const i=ise(t,e);i&&(n=i);const s=hPe(t,e);s&&(n=s)}else n=Ct("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return n}function sse(t){return Cr(t.protocol,!0)}function mPe(t,e){let n=!1;return t?t&&cf(t)&&t.length&&t.forEach(i=>{n=sse(i)}):n=!0,n}function gPe(t){return typeof t=="number"}function Ba(t){return typeof t<"u"&&typeof t!==null}function yPe(t){return!(!t||typeof t!="object"||!t.code||!yM(t.code)||!t.message||!Cr(t.message,!1))}function bPe(t){return!(eo(t)||!Cr(t.method,!1))}function wPe(t){return!(eo(t)||eo(t.result)&&eo(t.error)||!yM(t.id)||!Cr(t.jsonrpc,!1))}function vPe(t){return!(eo(t)||!Cr(t.name,!1))}function Xq(t,e){return!(!k_(e)||!nse(t).includes(e))}function CPe(t,e,n){return Cr(n,!1)?QRe(t,e).includes(n):!1}function xPe(t,e,n){return Cr(n,!1)?XRe(t,e).includes(n):!1}function Jq(t,e,n){let i=null;const s=EPe(t),r=_Pe(e),o=Object.keys(s),a=Object.keys(r),c=ez(Object.keys(t)),l=ez(Object.keys(e)),d=c.filter(h=>!l.includes(h));return d.length&&(i=Ct("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces. 159 Required: ${d.toString()} 160 Received: ${Object.keys(e).toString()}`)),Wm(o,a)||(i=Ct("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces. 161 Required: ${o.toString()} 162 Approved: ${a.toString()}`)),Object.keys(e).forEach(h=>{if(!h.includes(":")||i)return;const p=zb(e[h].accounts);p.includes(h)||(i=Ct("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${h} 163 Required: ${h} 164 Approved: ${p.toString()}`))}),o.forEach(h=>{i||(Wm(s[h].methods,r[h].methods)?Wm(s[h].events,r[h].events)||(i=Ct("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${h}`)):i=Ct("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${h}`))}),i}function EPe(t){const e={};return Object.keys(t).forEach(n=>{var i;
164n.includes(":")?e[n]=t[n]:(i=t[n].chains)==null||i.forEach(s=>{e[s]={methods:t[n].methods,events:t[n].events}})}),e}function ez(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function _Pe(t){const e={};return Object.keys(t).forEach(n=>{if(n.includes(":"))e[n]=t[n];else{const i=zb(t[n].accounts);i==null||i.forEach(s=>{e[s]={accounts:t[n].accounts.filter(r=>r.includes(`${s}:`)),methods:t[n].methods,events:t[n].events}})}}),e}function SPe(t,e){return yM(t)&&t<=e.max&&t>=e.min}function tz(){const t=U6();return new Promise(e=>{switch(t){case Bc.browser:e(APe());break;case Bc.reactNative:e(TPe());break;case Bc.node:e(kPe());break;default:e(!0)}})}function APe(){return qb()&&(navigator==null?void 0:navigator.onLine)}async function TPe(){if(jp()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function kPe(){return!0}function NPe(t){switch(U6()){case Bc.browser:RPe(t);break;case Bc.reactNative:PPe(t);break}}function RPe(t){!jp()&&qb()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function PPe(t){jp()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}function IPe(){var t;return qb()&&Ef.getDocument()?((t=Ef.getDocument())==null?void 0:t.visibilityState)==="visible":!0}const L7={};class Mv{static get(e){return L7[e]}static set(e,n){L7[e]=n}static delete(e){delete L7[e]}}function DPe(t){const e=Wb.decode(t);if(e.length<33)throw new Error("Too short to contain a public key");return e.slice(1,33)}function OPe({publicKey:t,signature:e,payload:n}){var i;const s=WP(n.method),r=128|parseInt(((i=n.version)==null?void 0:i.toString())||"4"),o=$Pe(n.address),a=n.era==="00"?new Uint8Array([0]):WP(n.era);if(a.length!==1&&a.length!==2)throw new Error("Invalid era length");const c=parseInt(n.nonce,16),l=new Uint8Array([c&255,c>>8&255]),d=BigInt(`0x${LPe(n.tip)}`),h=BPe(d),p=new Uint8Array([0,...t,o,...e,...a,...l,...h,...s]),g=UPe(p.length+1);return new Uint8Array([...g,r,...p])}function MPe(t){const e=WP(t),n=g7e.blake2b(e,void 0,32);return"0x"+Buffer.from(n).toString("hex")}function WP(t){return new Uint8Array(t.replace(/^0x/,"").match(/.{1,2}/g).map(e=>parseInt(e,16)))}function LPe(t){return t.startsWith("0x")?t.slice(2):t}function $Pe(t){const e=Wb.decode(t)[0];return e===42?0:e===60?2:1}function UPe(t){if(t<64)return new Uint8Array([t<<2]);if(t<16384){const e=t<<2|1;return new Uint8Array([e&255,e>>8&255])}else if(t<1<<30){const e=t<<2|2;return new Uint8Array([e&255,e>>8&255,e>>16&255,e>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function BPe(t){if(t<BigInt(1)<<BigInt(6))return new Uint8Array([Number(t<<BigInt(2))]);if(t<BigInt(1)<<BigInt(14)){const e=t<<BigInt(2)|BigInt(1);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255))])}else if(t<BigInt(1)<<BigInt(30)){const e=t<<BigInt(2)|BigInt(2);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255)),Number(e>>BigInt(16)&BigInt(255)),Number(e>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function FPe(t){const e=Uint8Array.from(Buffer.from(t.signature,"hex")),n=DPe(t.transaction.address),i=OPe({publicKey:n,signature:e,payload:t.transaction}),s=Buffer.from(i).toString("hex");return MPe(s)}function bM({logger:t,name:e}){const n=typeof t=="string"?aS({opts:{level:t,name:e}}).logger:t;return n.level=typeof t=="string"?t:t.level,n}const jPe="PARSE_ERROR",VPe="INVALID_REQUEST",WPe="METHOD_NOT_FOUND",qPe="INVALID_PARAMS",rse="INTERNAL_ERROR",wM="SERVER_ERROR",zPe=[-32700,-32600,-32601,-32602,-32603],m3={[jPe]:{code:-32700,message:"Parse error"},[VPe]:{code:-32600,message:"Invalid Request"},[WPe]:{code:-32601,message:"Method not found"},[qPe]:{code:-32602,message:"Invalid params"},[rse]:{code:-32603,message:"Internal error"},[wM]:{code:-32e3,message:"Server error"}},ose=wM;function HPe(t){return zPe.includes(t)}function nz(t){return Object.keys(m3).includes(t)?m3[t]:m3[ose]}function GPe(t){const e=Object.values(m3).find(n=>n.code===t);return e||m3[ose]}function ase(t,e,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${e}`):t}var $7={},Nh={},iz;function KPe(){if(iz)return Nh;iz=1,Object.defineProperty(Nh,"__esModule",{value:!0}),Nh.isBrowserCryptoAvailable=Nh.getSubtleCrypto=Nh.getBrowerCrypto=void 0;function t(){return(yu==null?void 0:yu.crypto)||(yu==null?void 0:yu.msCrypto)||{}}Nh.getBrowerCrypto=t;function e(){const i=t();return i.subtle||i.webkitSubtle}Nh.getSubtleCrypto=e;function n(){return!!t()&&!!e()}return Nh.isBrowserCryptoAvailable=n,Nh}var Rh={},sz;function YPe(){if(sz)return Rh;sz=1,Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.isBrowser=Rh.isNode=Rh.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Rh.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Rh.isNode=e;function n(){return!t()&&!e()}return Rh.isBrowser=n,Rh}var rz;function ZPe(){return rz||(rz=1,(function(t){Object.defineProperty(t,"__esMo
164dule",{value:!0});const e=O6;e.__exportStar(KPe(),t),e.__exportStar(YPe(),t)})($7)),$7}var QPe=ZPe();function hd(t=3){const e=Date.now()*Math.pow(10,t),n=Math.floor(Math.random()*Math.pow(10,t));return e+n}function sp(t=6){return BigInt(hd(t))}function wu(t,e,n){return{id:n||hd(),jsonrpc:"2.0",method:t,params:e}}function k5(t,e){return{id:t,jsonrpc:"2.0",result:e}}function xS(t,e,n){return{id:t,jsonrpc:"2.0",error:XPe(e)}}function XPe(t,e){return typeof t>"u"?nz(rse):(typeof t=="string"&&(t=Object.assign(Object.assign({},nz(wM)),{message:t})),HPe(t.code)&&(t=GPe(t.code)),t)}let JPe=class{},eIe=class extends JPe{constructor(){super()}},tIe=class extends eIe{constructor(e){super()}};const nIe="^https?:",iIe="^wss?:";function sIe(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function cse(t,e){const n=sIe(t);return typeof n>"u"?!1:new RegExp(e).test(n)}function oz(t){return cse(t,nIe)}function az(t){return cse(t,iIe)}function rIe(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function lse(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function vM(t){return lse(t)&&"method"in t}function ES(t){return lse(t)&&(fd(t)||xl(t))}function fd(t){return"result"in t}function xl(t){return"error"in t}let CM=class extends tIe{constructor(e){super(e),this.events=new Ul.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}async request(e,n){return this.requestStrict(wu(e.method,e.params||[],e.id||sp().toString()),n)}async requestStrict(e,n){return new Promise(async(i,s)=>{if(!this.connection.connected)try{await this.open()}catch(r){s(r)}this.events.on(`${e.id}`,r=>{xl(r)?s(r.error):i(r.result)});try{await this.connection.send(e,n)}catch(r){s(r)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ES(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const oIe=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),aIe=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",cz=t=>t.split("?")[0],lz=10,cIe=oIe();let lIe=class{constructor(e){if(this.url=e,this.events=new Ul.EventEmitter,this.registering=!1,!az(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,n)=>{if(typeof this.socket>"u"){n(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(xf(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!az(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const n=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=n||this.events.listenerCount("open")>=n)&&this.events.setMaxListeners(n+1),new Promise((i,s)=>{this.events.once("register_error",r=>{this.resetMaxListeners(),s(r)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((n,i)=>{const s=QPe.isReactNative()?void 0:{rejectUnauthorized:!rIe(e)},r=new cIe(e,[],s);aIe()?r.onerror=o=>{const a=o;i(this.emitError(a.error))}:r.on("error",o=>{i(this.emitError(o))}),r.onopen=()=>{this.onOpen(r),n(r)}})}onOpen(e){e.onmessage=n=>this.onPayload(n),e.onclose=n=>this.onClose(n),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;
164const n=typeof e.data=="string"?Dg(e.data):e.data;this.events.emit("payload",n)}onError(e,n){const i=this.parseError(n),s=i.message||i.toString(),r=xS(e,s);this.events.emit("payload",r)}parseError(e,n=this.url){return ase(e,cz(n),"WS")}resetMaxListeners(){this.events.getMaxListeners()>lz&&this.events.setMaxListeners(lz)}emitError(e){const n=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${cz(this.url)}`));return this.events.emit("register_error",n),n}};var uIe={};const use="wc",dse=2,qP="core",Ld=`${use}@2:${qP}:`,dIe={logger:"error"},hIe={database:":memory:"},fIe="crypto",uz="client_ed25519_seed",pIe=wt.ONE_DAY,mIe="keychain",gIe="0.3",yIe="messages",bIe="0.3",wIe=wt.SIX_HOURS,vIe="publisher",hse="irn",CIe="error",fse="wss://relay.walletconnect.org",xIe="relayer",wr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},EIe="_subscription",dl={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},_Ie=.1,zP="2.23.0",gs={link_mode:"link_mode",relay:"relay"},gE={inbound:"inbound",outbound:"outbound"},SIe="0.3",AIe="WALLETCONNECT_CLIENT_ID",dz="WALLETCONNECT_LINK_MODE_APPS",Ac={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},TIe="subscription",kIe="0.3",NIe="pairing",RIe="0.3",Lv={wc_pairingDelete:{req:{ttl:wt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:wt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:wt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:wt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:wt.ONE_DAY,prompt:!1,tag:0},res:{ttl:wt.ONE_DAY,prompt:!1,tag:0}}},Dm={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},iu={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},PIe="history",IIe="0.3",DIe="expirer",bl={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},OIe="0.3",MIe="verify-api",LIe="https://verify.walletconnect.com",pse="https://verify.walletconnect.org",g3=pse,$Ie=`${g3}/v3`,UIe=[LIe,pse],BIe="echo",FIe="https://echo.walletconnect.com",dd={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Mh={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},su={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success",session_request_response_started:"session_request_response_started",session_request_response_validation_success:"session_request_response_validation_success",session_request_response_publish_started:"session_request_response_publish_started"},gm={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found",session_request_response_validation_failure:"session_request_response_validation_failure",session_request_response_publish_failure:"session_request_response_publish_failure"},ym={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"}
vendor: 20,539 bytes, line 164
164,$v={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},jIe=.1,VIe="event-client",WIe=86400,qIe="https://pulse.walletconnect.org/batch";function zIe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),i=0;i<n.length;i++)n[i]=255;for(var s=0;s<t.length;s++){var r=t.charAt(s),o=r.charCodeAt(0);if(n[o]!==255)throw new TypeError(r+" is ambiguous");n[o]=s}var a=t.length,c=t.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function h(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var w=0,C=0,E=0,T=b.length;E!==T&&b[E]===0;)E++,w++;for(var A=(T-E)*d+1>>>0,k=new Uint8Array(A);E!==T;){for(var R=b[E],P=0,B=A-1;(R!==0||P<C)&&B!==-1;B--,P++)R+=256*k[B]>>>0,k[B]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");C=P,E++}for(var F=A-C;F!==A&&k[F]===0;)F++;for(var z=c.repeat(w);F<A;++F)z+=t.charAt(k[F]);return z}function p(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var w=0;if(b[w]!==" "){for(var C=0,E=0;b[w]===c;)C++,w++;for(var T=(b.length-w)*l+1>>>0,A=new Uint8Array(T);b[w];){var k=n[b.charCodeAt(w)];if(k===255)return;for(var R=0,P=T-1;(k!==0||R<E)&&P!==-1;P--,R++)k+=a*A[P]>>>0,A[P]=k%256>>>0,k=k/256>>>0;if(k!==0)throw new Error("Non-zero carry");E=R,w++}if(b[w]!==" "){for(var B=T-E;B!==T&&A[B]===0;)B++;for(var F=new Uint8Array(C+(T-B)),z=C;B!==T;)F[z++]=A[B++];return F}}}function g(b){var w=p(b);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:p,decode:g}}var HIe=zIe,GIe=HIe;const mse=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},KIe=t=>new TextEncoder().encode(t),YIe=t=>new TextDecoder().decode(t);class ZIe{constructor(e,n,i){this.name=e,this.prefix=n,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class QIe{constructor(e,n,i){if(this.name=e,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return gse(this,e)}}class XIe{constructor(e){this.decoders=e}or(e){return gse(this,e)}decode(e){const n=e[0],i=this.decoders[n];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const gse=(t,e)=>new XIe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class JIe{constructor(e,n,i,s){this.name=e,this.prefix=n,this.baseEncode=i,this.baseDecode=s,this.encoder=new ZIe(e,n,i),this.decoder=new QIe(e,n,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const _S=({name:t,prefix:e,encode:n,decode:i})=>new JIe(t,e,n,i),W6=({prefix:t,name:e,alphabet:n})=>{const{encode:i,decode:s}=GIe(n,e);return _S({prefix:t,name:e,encode:i,decode:r=>mse(s(r))})},eDe=(t,e,n,i)=>{const s={};for(let d=0;d<e.length;++d)s[e[d]]=d;let r=t.length;for(;t[r-1]==="=";)--r;const o=new Uint8Array(r*n/8|0);let a=0,c=0,l=0;for(let d=0;d<r;++d){const h=s[t[d]];if(h===void 0)throw new SyntaxError(`Non-${i} character`);c=c<<n|h,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},tDe=(t,e,n)=>{const i=e[e.length-1]==="=",s=(1<<n)-1;let r="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>n;)o-=n,r+=e[s&a>>o];if(o&&(r+=e[s&a<<n-o]),i)for(;r.length*n&7;)r+="=";return r},To=({name:t,prefix:e,bitsPerChar:n,alphabet:i})=>_S({prefix:e,name:t,encode(s){return tDe(s,i,n)},decode(s){return eDe(s,i,n,t)}}),nDe=_S({prefix:"\0",name:"identity",encode:t=>YIe(t),decode:t=>KIe(t)});var iDe=Object.freeze({__proto__:null,identity:nDe});const sDe=To({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var rDe=Object.freeze({__proto__:null,base2:sDe});const oDe=To({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var aDe=Object.freeze({__proto__:null,base8:oDe});const cDe=W6({prefix:"9",name:"base10",alphabet:"0123456789"});var lDe=Object.freeze({__proto__:null,base10:cDe});const uDe=To({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),dDe=To({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var hDe=Object.freeze({__proto__:null,base16:uDe,base16upper:dDe});const fDe=To({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pDe=To({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mDe=To({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),gDe=To({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yDe=To({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),bDe=To({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wDe=To({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),vDe=To({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),CDe=To({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var xDe=Object.freeze({__proto__:null,base32:fDe,base32upper:pDe,base32pad:mDe,base32padupper:gDe,base32hex:yDe,base32hexupper:bDe,base32hexpad:wDe,base32hexpadupper:vDe,base32z:CDe});const EDe=W6({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_De=W6({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var SDe=Object.freeze({__proto__:null,base36:EDe,base36upper:_De});const ADe=W6({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),TDe=W6({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var kDe=Object.freeze({__proto__:null,base58btc:ADe,base58flickr:TDe});const NDe=To({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),RDe=To({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),PDe=To({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),IDe=To({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var DDe=Object.freeze({__proto__:null,base64:NDe,base64pad:RDe,base64url:PDe,base64urlpad:IDe});const yse=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),ODe=yse.reduce((t,e,n)=>(t[n]=e,t),[]),MDe=yse.reduce((t,e,n)=>(t[e.codePointAt(0)]=n,t),[]);function LDe(t){return t.reduce((e,n)=>(e+=ODe[n],e),"")}function $De(t){const e=[];for(const n of t){const i=MDe[n.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${n}`);e.push(i)}return new Uint8Array(e)}const UDe=_S({prefix:"ð",name:"base256emoji",encode:LDe,decode:$De});var BDe=Object.freeze({__proto__:null,base256emoji:UDe}),FDe=bse,hz=128,jDe=-128,VDe=Math.pow(2,31);function bse(t,e,n){e=e||[],n=n||0;for(var i=n;t>=VDe;)e[n++]=t&255|hz,t/=128;for(;t&jDe;)e[n++]=t&255|hz,t>>>=7;return e[n]=t|0,bse.bytes=n-i+1,e}var WDe=HP,qDe=128,fz=127;function HP(t,i){var n=0,i=i||0,s=0,r=i,o,a=t.length;do{if(r>=a)throw HP.bytes=0,new RangeError("Could not decode varint");o=t[r++],n+=s<28?(o&fz)<<s:(o&fz)*Math.pow(2,s),s+=7}while(o>=qDe);return HP.bytes=r-i,n}var zDe=Math.pow(2,7),HDe=Math.pow(2,14),GDe=Math.pow(2,21),KDe=Math.pow(2,28),YDe=Math.pow(2,35),ZDe=Math.pow(2,42),QDe=Math.pow(2,49),XDe=Math.pow(2,56),JDe=Math.pow(2,63),eOe=function(t){return t<zDe?1:t<HDe?2:t<GDe?3:t<KDe?4:t<YDe?5:t<ZDe?6:t<QDe?7:t<XDe?8:t<JDe?9:10},tOe={encode:FDe,decode:WDe,encodingLength:eOe},wse=tOe;const pz=(t,e,n=0)=>(wse.encode(t,e,n),e),mz=t=>wse.encodingLength(t),GP=(t,e)=>{const n=e.byteLength,i=mz(t),s=i+mz(n),r=new Uint8Array(s+n);return pz(t,r,0),pz(n,r,i),r.set(e,s),new nOe(t,n,e,r)};let nOe=class{constructor(e,n,i,s){this.code=e,this.size=n,this.digest=i,this.bytes=s}};const vse=({name:t,code:e,encode:n})=>new iOe(t,e,n);let iOe=class{constructor(e,n,i){this.name=e,this.code=n,this.encode=i}digest(e){if(e instanceof Uint8Array){const n=this.encode(e);return n instanceof Uint8Array?GP(this.code,n):n.then(i=>GP(this.code,i))}else throw Error("Unknown type, must be binary type")}};const Cse=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),sOe=vse({name:"sha2-256",code:18,encode:Cse("SHA-256")}),rOe=vse({name:"sha2-512",code:19,encode:Cse("SHA-512")});var oOe=Object.freeze({__proto__:null,sha256:sOe,sha512:rOe});const xse=0,aOe="identity",Ese=mse,cOe=t=>GP(xse,Ese(t)),lOe={code:xse,name:aOe,encode:Ese,digest:cOe};var uOe=Object.freeze({__proto__:null,identity:lOe});new TextEncoder,new TextDecoder;const gz={...iDe,...rDe,...aDe,...lDe,...hDe,...xDe,...SDe,...kDe,...DDe,...BDe};({...oOe,...uOe});function _se(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function dOe(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?_se(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Sse(t,e,n,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:i}}}const yz=Sse("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),U7=Sse("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{t=t.substring(1);const e=dOe(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),hOe={utf8:yz,"utf-8":yz,hex:gz.base16,latin1:U7,ascii:U7,binary:U7,...gz};function fOe(t,e="utf8"){const n=hOe[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?_se(globalThis.Buffer.from(t,"utf-8")):n.decoder.decode(`${n.prefix}${t}`)}var pOe=Object.defineProperty,mOe=(t,e,n)=>e in t?pOe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ad=(t,e,n)=>mOe(t,typeof e!="symbol"?e+"":e,n);let gOe=class{constructor(e,n){this.core=e,this.logger=n,ad(this,"keychain",new Map),ad(this,"name",mIe),ad(this,"version",gIe),ad(this,"initialized",!1),ad(this,"storagePrefix",Ld),ad(this,"init",async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}}),ad(this,"has",i=>(this.isInitialized(),this.keychain.has(i))),ad(this,"set",async(i,s)=>{this.isInitialized(),this.keychain.set(i,s),await this.persist()}),ad(this,"get",i=>{this.isInitialized();const s=this.keychain.get(i);if(typeof s>"u"){const{message:r}=Ct("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(r)}return s}),ad(this,"del",async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()}),this.core=e,this.logger=ac(n,this.name)}get context(){return oc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,RP(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?PP(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}};var yOe=Object.defineProperty,bOe=(t,e,n)=>e in t?yOe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Hr=(t,e,n)=>bOe(t,typeof e!="symbol"?e+"":e,n);let wOe=class{constructor(e,n,i){this.core=e,this.logger=n,Hr(this,"name",fIe),Hr(this,"keychain"),Hr(this,"randomSessionIdentifier",VP()),Hr(this,"initialized",!1),Hr(this,"clientId"),Hr(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Hr(this,"hasKeys",s=>(this.isInitialized(),this.keychain.has(s))),Hr(this,"getClientId",async()=>{if(this.isInitialized(),this.clientId)return this.clientId;const s=await this.getClientSeed(),r=FW(s),o=Tne(r.publicKey);return this.clientId=o,o}),Hr(this,"generateKeyPair",()=>{this.isInitialized();const s=ERe();return this.setPrivateKey(s.publicKey,s.privateKey)}),Hr(this,"signJWT",async s=>{this.isInitialized();const r=await this.getClientSeed(),o=FW(r),a=this.randomSessionIdentifier;return await m9e(a,s,pIe,o)}),Hr(this,"generateSharedKey",(s,r,o)=>{this.isInitialized();const a=this.getPrivateKey(s),c=_Re(a,r);return this.setSymKey(c,o)}),Hr(this,"setSymKey",async(s,r)=>{this.isInitialized();const o=r||mE(s);return await this.keychain.set(o,s),o}),Hr(this,"deleteKeyPair",async s=>{this.isInitialized(),await this.keychain.del(s)}),Hr(this,"deleteSymKey",async s=>{this.isInitialized(),await this.keychain.del(s)}),Hr(this,"encode",async(s,r,o)=>{this.isInitialized();const a=tse(o),c=xf(r);if(Vq(a))return TRe(c,o==null?void 0:o.encoding);if(jq(a)){const p=a.senderPublicKey,g=a.receiverPublicKey;s=await this.generateSharedKey(p,g)}const l=this.getSymKey(s),{type:d,senderPublicKey:h}=a;return SRe({type:d,symKey:l,message:c,senderPublicKey:h,encoding:o==null?void 0:o.encoding})}),Hr(this,"decode",async(s,r,o)=>{this.isInitialized();const a=NRe(r,o);if(Vq(a)){const c=kRe(r,o==null?void 0:o.encoding);return Dg(c)}if(jq(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(s),l=ARe({symKey:c,encoded:r,encoding:o==null?void 0:o.encoding});return Dg(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),Hr(this,"getPayloadType",(s,r=qa)=>{const o=T5({encoded:s,encoding:r});return Mg(o.type)}),Hr(this,"getPayloadSenderPublicKey",(s,r=qa)=>{const o=T5({encoded:s,encoding:r});return o.senderPublicKey?Xa(o.senderPublicKey,ha):void 0}),this.core=e,this.logger=ac(n,this.name),this.keychain=i||new gOe(this.core,this.logger)}get context(){return oc(this.logger)}async setPrivateKey(e,n){return await this.keychain.set(e,n),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(uz)}catch{e=VP(),await this.keychain.set(uz,e)}return fOe(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}};var vOe=Object.defineProperty,COe=Object.defineProperties,xOe=Object.getOwnPropertyDescriptors,bz=Object.getOwnPropertySymbols,EOe=Object.prototype.hasOwnProperty,_Oe=Object.prototype.propertyIsEnumerable,KP=(t,e,n)=>e in t?vOe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,SOe=(t,e)=>{for(var n in e||(e={}))EOe.call(e,n)&&KP(t,n,e[n]);if(bz)for(var n of bz(e))_Oe.call(e,n)&&KP(t,n,e[n]);return t},AOe=(t,e)=>COe(t,xOe(e)),Ec=(t,e,n)=>KP(t,typeof e!="symbol"?e+"":e,n);let TOe=class extends f_e{constructor(e,n){super(e,n),this.logger=e,this.core=n,Ec(this,"messages",new Map),Ec(this,"messagesWithoutClientAck",new Map),Ec(this,"name",yIe),Ec(this,"version",bIe),Ec(this,"initialized",!1),Ec(this,"storagePrefix",Ld),Ec(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i);const s=await this.getRelayerMessagesWithoutClientAck();typeof s<"u"&&(this.messagesWithoutClientAck=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}}),Ec(this,"set",async(i,s,r)=>{this.isInitialized();const o=Cl(s);let a=this.messages.get(i);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=s,this.messages.set(i,a),r===gE.inbound){const c=this.messagesWithoutClientAck.get(i)||{};this.messagesWithoutClientAck.set(i,AOe(SOe({},c),{[o]:s}))}return await this.persist(),o}),Ec(this,"get",i=>{this.isInitialized();let s=this.messages.get(i);return typeof s>"u"&&(s={}),s}),Ec(this,"getWithoutAck",i=>{this.isInitialized();const s={};for(const r of i){const o=this.messagesWithoutClientAck.get(r)||{};s[r]=Object.values(o)}return s}),Ec(this,"has",(i,s)=>{this.isInitialized();const r=this.get(i),o=Cl(s);return typeof r[o]<"u"}),Ec(this,"ack",async(i,s)=>{this.isInitialized();const r=this.messagesWithoutClientAck.get(i);if(typeof r>"u")return;const o=Cl(s);delete r[o],Object.keys(r).length===0?this.messagesWithoutClientAck.delete(i):this.messagesWithoutClientAck.set(i,r),await this.persist()}),Ec(this,"del",async i=>{this.isInitialized(),this.messages.delete(i),this.messagesWithoutClientAck.delete(i),await this.persist()}),this.logger=ac(e,this.name),this.core=n}get context(){return oc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,RP(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,RP(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?PP(e):void 0}async getRelayerMessagesWithoutClientAck(){const e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof e<"u"?PP(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}};var kOe=Object.defineProperty,NOe=Object.defineProperties,ROe=Object.getOwnPropertyDescriptors,wz=Object.getOwnPropertySymbols,POe=Object.prototype.hasOwnProperty,IOe=Object.prototype.propertyIsEnumerable,YP=(t,e,n)=>e in t?kOe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Iy=(t,e)=>{for(var n in e||(e={}))POe.call(e,n)&&YP(t,n,e[n]);if(wz)for(var n of wz(e))IOe.call(e,n)&&YP(t,n,e[n]);return t},vz=(t,e)=>NOe(t,ROe(e)),hl=(t,e,n)=>YP(t,typeof e!="symbol"?e+"":e,n);let DOe=class extends p_e{constructor(e,n){super(e,n),this.relayer=e,this.logger=n,hl(this,"events",new Ul.EventEmitter),hl(this,"name",vIe),hl(this,"queue",new Map),hl(this,"publishTimeout",wt.toMiliseconds(wt.ONE_MINUTE)),hl(this,"initialPublishTimeout",wt.toMiliseconds(wt.ONE_SECOND*15)),hl(this,"needsTransportRestart",!1),hl(this,"publish",async(i,s,r)=>
164{var o,a,c,l,d;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:s,opts:r}});const h=(r==null?void 0:r.ttl)||wIe,p=(r==null?void 0:r.prompt)||!1,g=(r==null?void 0:r.tag)||0,b=(r==null?void 0:r.id)||sp().toString(),w=s2(T_().protocol),C={id:b,method:(r==null?void 0:r.publishMethod)||w.publish,params:Iy({topic:i,message:s,ttl:h,prompt:p,tag:g,attestation:r==null?void 0:r.attestation},r==null?void 0:r.tvf)},E=`Failed to publish payload, please try again. id:${b} tag:${g}`;try{eo((o=C.params)==null?void 0:o.prompt)&&((a=C.params)==null||delete a.prompt),eo((c=C.params)==null?void 0:c.tag)&&((l=C.params)==null||delete l.tag);const T=new Promise(async A=>{const k=({id:P})=>{var B;((B=C.id)==null?void 0:B.toString())===P.toString()&&(this.removeRequestFromQueue(P),this.relayer.events.removeListener(wr.publish,k),A())};this.relayer.events.on(wr.publish,k);const R=wd(new Promise((P,B)=>{this.rpcPublish(C,r).then(P).catch(F=>{this.logger.warn(F,F==null?void 0:F.message),B(F)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${b} tag:${g}`);try{await R,this.events.removeListener(wr.publish,k)}catch(P){this.queue.set(b,{request:C,opts:r,attempt:1}),this.logger.warn(P,P==null?void 0:P.message)}});this.logger.trace({type:"method",method:"publish",params:{id:b,topic:i,message:s,opts:r}}),await wd(T,this.publishTimeout,E)}catch(T){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(T),(d=r==null?void 0:r.internal)!=null&&d.throwOnFailedPublish)throw T}finally{this.queue.delete(b)}}),hl(this,"publishCustom",async i=>{var s,r,o,a,c;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:i});const{payload:l,opts:d={}}=i,{attestation:h,tvf:p,publishMethod:g,prompt:b,tag:w,ttl:C=wt.FIVE_MINUTES}=d,E=d.id||sp().toString(),T=s2(T_().protocol),A=g||T.publish,k={id:E,method:A,params:Iy(vz(Iy({},l),{ttl:C,prompt:b,tag:w,attestation:h}),p)},R=`Failed to publish custom payload, please try again. id:${E} tag:${w}`;try{eo((s=k.params)==null?void 0:s.prompt)&&((r=k.params)==null||delete r.prompt),eo((o=k.params)==null?void 0:o.tag)&&((a=k.params)==null||delete a.tag);const P=new Promise(async B=>{const F=({id:K})=>{var q;((q=k.id)==null?void 0:q.toString())===K.toString()&&(this.removeRequestFromQueue(K),this.relayer.events.removeListener(wr.publish,F),B())};this.relayer.events.on(wr.publish,F);const z=wd(new Promise((K,q)=>{this.rpcPublish(k,d).then(K).catch(G=>{this.logger.warn(G,G==null?void 0:G.message),q(G)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${A} id:${E} tag:${w}`);try{await z,this.events.removeListener(wr.publish,F)}catch(K){this.queue.set(E,{request:k,opts:d,attempt:1}),this.logger.warn(K,K==null?void 0:K.message)}});this.logger.trace({type:"method",method:"publish",params:{id:E,payload:l,opts:d}}),await wd(P,this.publishTimeout,R)}catch(P){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(P),(c=d==null?void 0:d.internal)!=null&&c.throwOnFailedPublish)throw P}finally{this.queue.delete(E)}}),hl(this,"on",(i,s)=>{this.events.on(i,s)}),hl(this,"once",(i,s)=>{this.events.once(i,s)}),hl(this,"off",(i,s)=>{this.events.off(i,s)}),hl(this,"removeListener",(i,s)=>{this.events.removeListener(i,s)}),this.relayer=e,this.logger=ac(n,this.name),this.registerEventListeners()}get context(){return oc(this.logger)}async rpcPublish(e,n){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:e});const i=await this.relayer.request(e);return this.relayer.events.emit(wr.publish,Iy(Iy({},e),n)),this.logger.debug("Successfully Published Payload"),i}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,n)=>{var i;const s=e.attempt+1;this.queue.set(n,vz(Iy({},e),{attempt:s})),this.logger.warn({},`Publisher: queue->publishing: ${e.request.id}, tag: ${(i=e.request.params)==null?void 0:i.tag}, attempt: ${s}`),await this.rpcPublish(e.request,e.opts),this.logger.warn({},`Publisher: queue->published: ${e.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(x1.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(wr.connection_stalled);return}this.checkQueue()}),this.relayer.on(wr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}};var OOe=Object.defineProperty,MOe=(t,e,n)=>e in t?OOe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dy=(t,e,n)=>MOe(t,typeof e!="symbol"?e+"":e,n);let LOe=class{constructor(){Dy(this,"map",new Map),Dy(this,"set",(e,n)=>{const i=this.get(e);
vendor: 5,144 bytes, line 164
164this.exists(e,n)||this.map.set(e,[...i,n])}),Dy(this,"get",e=>this.map.get(e)||[]),Dy(this,"exists",(e,n)=>this.get(e).includes(n)),Dy(this,"delete",(e,n)=>{if(typeof n>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,n))return;const s=i.filter(r=>r!==n);if(!s.length){this.map.delete(e);return}this.map.set(e,s)}),Dy(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}};var $Oe=Object.defineProperty,UOe=Object.defineProperties,BOe=Object.getOwnPropertyDescriptors,Cz=Object.getOwnPropertySymbols,FOe=Object.prototype.hasOwnProperty,jOe=Object.prototype.propertyIsEnumerable,ZP=(t,e,n)=>e in t?$Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Uv=(t,e)=>{for(var n in e||(e={}))FOe.call(e,n)&&ZP(t,n,e[n]);if(Cz)for(var n of Cz(e))jOe.call(e,n)&&ZP(t,n,e[n]);return t},B7=(t,e)=>UOe(t,BOe(e)),is=(t,e,n)=>ZP(t,typeof e!="symbol"?e+"":e,n);let VOe=class extends y_e{constructor(e,n){super(e,n),this.relayer=e,this.logger=n,is(this,"subscriptions",new Map),is(this,"topicMap",new LOe),is(this,"events",new Ul.EventEmitter),is(this,"name",TIe),is(this,"version",kIe),is(this,"pending",new Map),is(this,"cached",[]),is(this,"initialized",!1),is(this,"storagePrefix",Ld),is(this,"subscribeTimeout",wt.toMiliseconds(wt.ONE_MINUTE)),is(this,"initialSubscribeTimeout",wt.toMiliseconds(wt.ONE_SECOND*15)),is(this,"clientId"),is(this,"batchSubscribeTopicsLimit",500),is(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),is(this,"subscribe",async(i,s)=>{var r;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}});try{const o=T_(s),a={topic:i,relay:o,transportType:s==null?void 0:s.transportType};(r=s==null?void 0:s.internal)!=null&&r.skipSubscribe||this.pending.set(i,a);const c=await this.rpcSubscribe(i,o,s);return typeof c=="string"&&(this.onSubscribe(c,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}})),c}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),is(this,"unsubscribe",async(i,s)=>{this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(i,s.id,s):await this.unsubscribeByTopic(i,s)}),is(this,"isSubscribed",i=>new Promise(s=>{s(this.topicMap.topics.includes(i))})),is(this,"isKnownTopic",i=>new Promise(s=>{s(this.topicMap.topics.includes(i)||this.pending.has(i)||this.cached.some(r=>r.topic===i))})),is(this,"on",(i,s)=>{this.events.on(i,s)}),is(this,"once",(i,s)=>{this.events.once(i,s)}),is(this,"off",(i,s)=>{this.events.off(i,s)}),is(this,"removeListener",(i,s)=>{this.events.removeListener(i,s)}),is(this,"start",async()=>{await this.onConnect()}),is(this,"stop",async()=>{await this.onDisconnect()}),is(this,"restart",async()=>{await this.restore(),await this.onRestart()}),is(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const i=[];this.pending.forEach(s=>{i.push(s)}),await this.batchSubscribe(i)}),is(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(x1.pulse,async()=>{await this.checkPending()}),this.events.on(Ac.created,async i=>{const s=Ac.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:i}),await this.persist()}),this.events.on(Ac.deleted,async i=>{const s=Ac.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:i}),await this.persist()})}),this.relayer=e,this.logger=ac(n,this.name),this.clientId=""}get context(){return oc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,n){let i=!1;try{i=this.getSubscription(e).topic===n}catch{}return i}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,n){const i=this.topicMap.get(e);await Promise.all(i.map(async s=>await this.unsubscribeById(e,s,n)))}async unsubscribeById(e,n,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:n,opts:i}});try{const s=T_(i);await this.restartToComplete({topic:e,id:n,relay:s}),await this.rpcUnsubscribe(e,n,s);const r=As("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,n,r),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:n,opts:i}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(e,n,i){var s,r;
164const o=await this.getSubscriptionId(e);if((s=i==null?void 0:i.internal)!=null&&s.skipSubscribe)return o;(!i||(i==null?void 0:i.transportType)===gs.relay)&&await this.restartToComplete({topic:e,id:e,relay:n});const a={method:s2(n.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a});const c=(r=i==null?void 0:i.internal)==null?void 0:r.throwOnFailedPublish;try{if((i==null?void 0:i.transportType)===gs.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(a).catch(h=>this.logger.warn(h))},wt.toMiliseconds(wt.ONE_SECOND)),o;const l=new Promise(async h=>{const p=g=>{g.topic===e&&(this.events.removeListener(Ac.created,p),h(g.id))};this.events.on(Ac.created,p);try{const g=await wd(new Promise((b,w)=>{this.relayer.request(a).catch(C=>{this.logger.warn(C,C==null?void 0:C.message),w(C)}).then(b)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(Ac.created,p),h(g)}catch{}}),d=await wd(l,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!d&&c)throw new Error(`Subscribing to ${e} failed, please try again`);return d?o:null}catch(l){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(wr.connection_stalled),c)throw l}return null}async rpcBatchSubscribe(e){if(!e.length)return;const n=e[0].relay,i={method:s2(n.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await wd(new Promise(s=>{this.relayer.request(i).catch(r=>this.logger.warn(r)).then(s)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(wr.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const n=e[0].relay,i={method:s2(n.protocol).batchFetchMessages,params:{topics:e.map(r=>r.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let s;try{s=await await wd(new Promise((r,o)=>{this.relayer.request(i).catch(a=>{this.logger.warn(a),o(a)}).then(r)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(wr.connection_stalled)}return s}rpcUnsubscribe(e,n,i){const s={method:s2(i.protocol).unsubscribe,params:{topic:e,id:n}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,n){this.setSubscription(e,B7(Uv({},n),{id:e})),this.pending.delete(n.topic)}onBatchSubscribe(e){e.length&&e.forEach(n=>{this.setSubscription(n.id,Uv({},n)),this.pending.delete(n.topic)})}async onUnsubscribe(e,n,i){this.events.removeAllListeners(n),this.hasSubscription(n,e)&&this.deleteSubscription(n,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,n){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:n}),this.addSubscription(e,n)}addSubscription(e,n){this.subscriptions.set(e,Uv({},n)),this.topicMap.set(n.topic,e),this.events.emit(Ac.created,n)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const n=this.subscriptions.get(e);if(!n){const{message:i}=Ct("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return n}deleteSubscription(e,n){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:n});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Ac.deleted,B7(Uv({},i),{reason:n}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Ac.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],n=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i<n;i++){const s=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(Ac.resubscribed)}
164async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size&&!e.every(n=>{var i;return n.topic===((i=this.subscriptions.get(n.id))==null?void 0:i.topic)})){const{message:n}=Ct("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(n)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async n=>B7(Uv({},n),{id:await this.getSubscriptionId(n.topic)})))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const n=await this.rpcBatchFetchMessages(e);n&&n.messages&&(await W7e(wt.toMiliseconds(wt.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(n.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return Cl(e+await this.getClientId())}};var WOe=Object.defineProperty,xz=Object.getOwnPropertySymbols,qOe=Object.prototype.hasOwnProperty,zOe=Object.prototype.propertyIsEnumerable,QP=(t,e,n)=>e in t?WOe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ez=(t,e)=>{for(var n in e||(e={}))qOe.call(e,n)&&QP(t,n,e[n]);if(xz)for(var n of xz(e))zOe.call(e,n)&&QP(t,n,e[n]);return t},Ni=(t,e,n)=>QP(t,typeof e!="symbol"?e+"":e,n);let HOe=class extends m_e{constructor(e){var n;super(e),Ni(this,"protocol","wc"),Ni(this,"version",2),Ni(this,"core"),Ni(this,"logger"),Ni(this,"events",new Ul.EventEmitter),Ni(this,"provider"),Ni(this,"messages"),Ni(this,"subscriber"),Ni(this,"publisher"),Ni(this,"name",xIe),Ni(this,"transportExplicitlyClosed",!1),Ni(this,"initialized",!1),Ni(this,"connectionAttemptInProgress",!1),Ni(this,"relayUrl"),Ni(this,"projectId"),Ni(this,"packageName"),Ni(this,"bundleId"),Ni(this,"hasExperiencedNetworkDisruption",!1),Ni(this,"pingTimeout"),Ni(this,"heartBeatTimeout",wt.toMiliseconds(wt.THIRTY_SECONDS+wt.FIVE_SECONDS)),Ni(this,"reconnectTimeout"),Ni(this,"connectPromise"),Ni(this,"reconnectInProgress",!1),Ni(this,"requestsInFlight",[]),Ni(this,"connectTimeout",wt.toMiliseconds(wt.ONE_SECOND*15)),Ni(this,"request",async i=>{var s,r;this.logger.debug("Publishing Request Payload");const o=i.id||sp().toString();await this.toEstablishConnection();try{this.logger.trace({id:o,method:i.method,topic:(s=i.params)==null?void 0:s.topic},"relayer.request - publishing...");const a=`${o}:${((r=i.params)==null?void 0:r.tag)||""}`;this.requestsInFlight.push(a);const c=await this.provider.request(i);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==a),c}catch(a){throw this.logger.debug(`Failed to Publish Request: ${o}`),a}}),Ni(this,"resetPingTimeout",()=>{C_()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var i,s,r,o;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(o=(r=(s=(i=this.provider)==null?void 0:i.connection)==null?void 0:s.socket)==null?void 0:r.terminate)==null||o.call(r)}catch(a){this.logger.warn(a,a==null?void 0:a.message)}},this.heartBeatTimeout))}),Ni(this,"onPayloadHandler",i=>{this.onProviderPayload(i),this.resetPingTimeout()}),Ni(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected ð"),this.startPingTimeout(),this.events.emit(wr.connect)}),Ni(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected ð"),this.requestsInFlight=[],this.onProviderDisconnect()}),Ni(this,"onProviderErrorHandler",i=>{this.logger.fatal(`Fatal socket error: ${i.message}`),this.events.emit(wr.error,i),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Ni(this,"registerProviderListeners",()=>{this.provider.on(dl.payload,this.onPayloadHandler),this.provider.on(dl.connect,this.onConnectHandler),this.provider.on(dl.disconnect,this.onDisconnectHandler),this.provider.on(dl.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=bM({logger:(n=e.logger)!=null?n:CIe,name:this.name}),this.messages=new TOe(this.logger,e.core),this.subscriber=new VOe(this,this.logger),this.publisher=new DOe(this,this.logger),this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||fse,T7e()?this.packageName=lq():k7e()&&(this.bundleId=lq()),this.provider={}}
164async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(e=>this.logger.warn(e,e==null?void 0:e.message))}get context(){return oc(this.logger)}get connected(){var e,n,i;return((i=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:i.readyState)===1||!1}get connecting(){var e,n,i;return((i=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:i.readyState)===0||this.connectPromise!==void 0||!1}async publish(e,n,i){this.isInitialized(),await this.publisher.publish(e,n,i),await this.recordMessageEvent({topic:e,message:n,publishedAt:Date.now(),transportType:gs.relay},gE.outbound)}async publishCustom(e){this.isInitialized(),await this.publisher.publishCustom(e)}async subscribe(e,n){var i,s,r;this.isInitialized(),(!(n!=null&&n.transportType)||(n==null?void 0:n.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;let a=((r=this.subscriber.topicMap.get(e))==null?void 0:r[0])||"",c;const l=d=>{d.topic===e&&(this.subscriber.off(Ac.created,l),c())};return await Promise.all([new Promise(d=>{c=d,this.subscriber.on(Ac.created,l)}),new Promise(async(d,h)=>{a=await this.subscriber.subscribe(e,Ez({internal:{throwOnFailedPublish:o}},n)).catch(p=>{o&&h(p)})||a,d()})]),a}async unsubscribe(e,n){this.isInitialized(),await this.subscriber.unsubscribe(e,n)}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await wd(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(n,i)=>{await this.connect(e).then(n).catch(i).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await tz())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const n=e.sort((i,s)=>i.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${n.length} message events sorted`);for(const i of n)try{await this.onMessageEvent(i)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${n.length} message events processed`)}async onLinkMessageEvent(e,n){const{topic:i}=e;if(!n.sessionExists){const s=yr(wt.FIVE_MINUTES),r={topic:i,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,r)}this.events.emit(wr.message,e),await this.recordMessageEvent(e,gE.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let n=1;for(;n<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${n}...`),await this.createProvider(),await new Promise(async(i,s)=>{const r=()=>
vendor: 4,641 bytes, line 164
164{s(new Error("Connection interrupted while trying to connect"))};this.provider.once(dl.disconnect,r),await wd(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{s(o)}).finally(()=>{this.provider.off(dl.disconnect,r),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(dl.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(dl.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,i()})}catch(i){await this.subscriber.stop();const s=i;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${n}`);break}await new Promise(i=>setTimeout(i,wt.toMiliseconds(n*1))),n++}}startPingTimeout(){var e,n,i,s,r;if(C_())try{(n=(e=this.provider)==null?void 0:e.connection)!=null&&n.socket&&((r=(s=(i=this.provider)==null?void 0:i.connection)==null?void 0:s.socket)==null||r.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new CM(new lIe(D7e({sdkVersion:zP,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,n){const{topic:i,message:s}=e;await this.messages.set(i,s,n)}async shouldIgnoreMessageEvent(e){const{topic:n,message:i}=e;if(!i||i.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isKnownTopic(n))return this.logger.warn(`Ignoring message for unknown topic ${n}`),!0;const s=this.messages.has(n,i);return s&&this.logger.warn(`Ignoring duplicate message: ${i}`),s}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),vM(e)){if(!e.method.endsWith(EIe))return;const n=e.params,{topic:i,message:s,publishedAt:r,attestation:o}=n.data,a={topic:i,message:s,publishedAt:r,transportType:gs.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ez({type:"event",event:n.id},a)),this.events.emit(n.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else ES(e)&&this.events.emit(wr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,gE.inbound),this.events.emit(wr.message,e))}async acknowledgePayload(e){const n=k5(e.id,!0);await this.provider.connection.send(n)}unregisterProviderListeners(){this.provider.off(dl.payload,this.onPayloadHandler),this.provider.off(dl.connect,this.onConnectHandler),this.provider.off(dl.disconnect,this.onDisconnectHandler),this.provider.off(dl.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await tz();NPe(async n=>{e!==n&&(e=n,n?await this.transportOpen().catch(i=>this.logger.error(i,i==null?void 0:i.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(x1.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&IPe())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(n){this.logger.warn(n,n==null?void 0:n.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(wr.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e==null?void 0:e.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},wt.toMiliseconds(_Ie)))))}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}};function GOe(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function _z(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}
vendor: 1,429 bytes, line 164
164function Sz(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const KOe="[object RegExp]",YOe="[object String]",ZOe="[object Number]",QOe="[object Boolean]",Az="[object Arguments]",XOe="[object Symbol]",JOe="[object Date]",eMe="[object Map]",tMe="[object Set]",nMe="[object Array]",iMe="[object Function]",sMe="[object ArrayBuffer]",F7="[object Object]",rMe="[object Error]",oMe="[object DataView]",aMe="[object Uint8Array]",cMe="[object Uint8ClampedArray]",lMe="[object Uint16Array]",uMe="[object Uint32Array]",dMe="[object BigUint64Array]",hMe="[object Int8Array]",fMe="[object Int16Array]",pMe="[object Int32Array]",mMe="[object BigInt64Array]",gMe="[object Float32Array]",yMe="[object Float64Array]";function bMe(){}function Tz(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(t)==="[object Object]":!1}function wMe(t,e,n){return i3(t,e,void 0,void 0,void 0,void 0,n)}function i3(t,e,n,i,s,r,o){const a=o(t,e,n,i,s,r);if(a!==void 0)return a;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return y3(t,e,r,o)}return y3(t,e,r,o)}function y3(t,e,n,i){if(Object.is(t,e))return!0;let s=Sz(t),r=Sz(e);
vendor: 14,937 bytes, line 164
164if(s===Az&&(s=F7),r===Az&&(r=F7),s!==r)return!1;switch(s){case YOe:return t.toString()===e.toString();case ZOe:{const c=t.valueOf(),l=e.valueOf();return GOe(c,l)}case QOe:case JOe:case XOe:return Object.is(t.valueOf(),e.valueOf());case KOe:return t.source===e.source&&t.flags===e.flags;case iMe:return t===e}n=n??new Map;const o=n.get(t),a=n.get(e);if(o!=null&&a!=null)return o===e;n.set(t,e),n.set(e,t);try{switch(s){case eMe:{if(t.size!==e.size)return!1;for(const[c,l]of t.entries())if(!e.has(c)||!i3(l,e.get(c),c,t,e,n,i))return!1;return!0}case tMe:{if(t.size!==e.size)return!1;const c=Array.from(t.values()),l=Array.from(e.values());for(let d=0;d<c.length;d++){const h=c[d],p=l.findIndex(g=>i3(h,g,void 0,t,e,n,i));if(p===-1)return!1;l.splice(p,1)}return!0}case nMe:case aMe:case cMe:case lMe:case uMe:case dMe:case hMe:case fMe:case pMe:case mMe:case gMe:case yMe:{if(typeof Buffer<"u"&&Buffer.isBuffer(t)!==Buffer.isBuffer(e)||t.length!==e.length)return!1;for(let c=0;c<t.length;c++)if(!i3(t[c],e[c],c,t,e,n,i))return!1;return!0}case sMe:return t.byteLength!==e.byteLength?!1:y3(new Uint8Array(t),new Uint8Array(e),n,i);case oMe:return t.byteLength!==e.byteLength||t.byteOffset!==e.byteOffset?!1:y3(new Uint8Array(t),new Uint8Array(e),n,i);case rMe:return t.name===e.name&&t.message===e.message;case F7:{if(!(y3(t.constructor,e.constructor,n,i)||Tz(t)&&Tz(e)))return!1;const c=[...Object.keys(t),..._z(t)],l=[...Object.keys(e),..._z(e)];if(c.length!==l.length)return!1;for(let d=0;d<c.length;d++){const h=c[d],p=t[h];if(!Object.hasOwn(e,h))return!1;const g=e[h];if(!i3(p,g,h,t,e,n,i))return!1}return!0}default:return!1}}finally{n.delete(t),n.delete(e)}}function vMe(t,e){return wMe(t,e,bMe)}var CMe=Object.defineProperty,kz=Object.getOwnPropertySymbols,xMe=Object.prototype.hasOwnProperty,EMe=Object.prototype.propertyIsEnumerable,XP=(t,e,n)=>e in t?CMe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Nz=(t,e)=>{for(var n in e||(e={}))xMe.call(e,n)&&XP(t,n,e[n]);if(kz)for(var n of kz(e))EMe.call(e,n)&&XP(t,n,e[n]);return t},Ma=(t,e,n)=>XP(t,typeof e!="symbol"?e+"":e,n);let S1=class extends g_e{constructor(e,n,i,s=Ld,r=void 0){super(e,n,i,s),this.core=e,this.logger=n,this.name=i,Ma(this,"map",new Map),Ma(this,"version",SIe),Ma(this,"cached",[]),Ma(this,"initialized",!1),Ma(this,"getKey"),Ma(this,"storagePrefix",Ld),Ma(this,"recentlyDeleted",[]),Ma(this,"recentlyDeletedLimit",200),Ma(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!eo(o)?this.map.set(this.getKey(o),o):oPe(o)?this.map.set(o.id,o):aPe(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Ma(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),Ma(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Ma(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>vMe(a[c],o[c]))):this.values)),Ma(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=Nz(Nz({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),Ma(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=ac(n,this.name),this.storagePrefix=s,this.getKey=r}get context(){return oc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const n=this.map.get(e);if(!n){if(this.recentlyDeleted.includes(e)){const{message:s}=Ct("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:i}=Ct("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return n}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:n}=Ct("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}};var _Me=Object.defineProperty,SMe=(t,e,n)=>e in t?_Me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fi=(t,e,n)=>SMe(t,typeof e!="symbol"?e+"":e,n);let AMe=class{constructor(e,n){this.core=e,this.logger=n,fi(this,"name",NIe),fi(this,"version",RIe),fi(this,"events",new KO),fi(this,"pairings"),fi(this,"initialized",!1),fi(this,"storagePrefix",Ld),fi(this,"ignoredPayloadTypes",[af]),fi(this,"registeredMethods",[]),fi(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),fi(this,"register",({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]}),fi(this,"create",async i=>{this.isInitialized();const s=VP(),r=await this.core.crypto.setSymKey(s),o=yr(wt.FIVE_MINUTES),a={protocol:hse},c={topic:r,expiry:o,relay:a,active:!1,methods:i==null?void 0:i.methods},l=Hq({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:s,relay:a,expiryTimestamp:o,methods:i==null?void 0:i.methods});return this.events.emit(Dm.create,c),this.core.expirer.set(r,o),await this.pairings.set(r,c),await this.core.relayer.subscribe(r,{transportType:i==null?void 0:i.transportType,internal:i==null?void 0:i.internal}),{topic:r,uri:l}}),fi(this,"pair",async i=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:i==null?void 0:i.uri,trace:[dd.pairing_started]}});this.isValidPair(i,s);const{topic:r,symKey:o,relay:a,expiryTimestamp:c,methods:l}=zq(i.uri);s.props.properties.topic=r,s.addTrace(dd.pairing_uri_validation_success),s.addTrace(dd.pairing_uri_not_expired);let d;if(this.pairings.keys.includes(r)){if(d=this.pairings.get(r),s.addTrace(dd.existing_pairing),d.active)throw s.setError(Mh.active_pairing_already_exists),new Error(`Pairing already exists: ${r}. Please try again with a new connection URI.`);s.addTrace(dd.pairing_not_expired)}const h=c||yr(wt.FIVE_MINUTES),p={topic:r,relay:a,expiry:h,active:!1,methods:l};this.core.expirer.set(r,h),await this.pairings.set(r,p),s.addTrace(dd.store_new_pairing),i.activatePairing&&await this.activate({topic:r}),this.events.emit(Dm.create,p),s.addTrace(dd.emit_inactive_pairing),this.core.crypto.keychain.has(r)||await this.core.crypto.setSymKey(o,r),s.addTrace(dd.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(Mh.no_internet_connection)}try{await this.core.relayer.subscribe(r,{relay:a})}catch(g){throw s.setError(Mh.subscribe_pairing_topic_failure),g}return s.addTrace(dd.subscribe_pairing_topic_success),p}),fi(this,"activate",async({topic:i})=>{this.isInitialized();const s=yr(wt.FIVE_MINUTES);this.core.expirer.set(i,s),await this.pairings.update(i,{active:!0,expiry:s})}),fi(this,"ping",async i=>{this.isInitialized(),await this.isValidPing(i),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:s}=i;if(this.pairings.keys.includes(s)){const r=await this.sendRequest(s,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=Nm();this.events.once(Vi("pairing_ping",r),({error:l})=>{l?c(l):a()}),await o()}}),fi(this,"updateExpiry",async({topic:i,expiry:s})=>{this.isInitialized(),await this.pairings.update(i,{expiry:s})}),fi(this,"updateMetadata",async({topic:i,metadata:s})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:s})}),fi(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),fi(this,"disconnect",async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:s}=i;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",As("USER_DISCONNECTED")),await this.deletePairing(s))}),fi(this,"formatUriFromPairing",i=>{this.isInitialized();const{topic:s,relay:r,expiry:o,methods:a}=i,c=this.core.crypto.keychain.get(s);return Hq({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:c,relay:r,expiryTimestamp:o,methods:a})}),fi(this,"sendRequest",async(i,s,r)=>{const o=wu(s,r),a=await this.core.crypto.encode(i,o),c=Lv[s].req;return this.core.history.set(i,o),this.core.relayer.publish(i,a,c),o.id}),fi(this,"sendResult",async(i,s,r)=>{const o=k5(i,r),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,i)).request.method,l=Lv[c].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),fi(this,"sendError",async(i,s,r)=>{const o=xS(i,r),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,i)).request.method,l=Lv[c]?Lv[c].res:Lv.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),fi(this,"deletePairing",async(i,s)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,As("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),s?Promise.resolve():this.core.expirer.del(i)])}),fi(this,"cleanup",async()=>{const i=this.pairings.getAll().filter(s=>yd(s.expiry));await Promise.all(i.map(s=>this.deletePairing(s.topic)))}),fi(this,"onRelayEventRequest",async i=>{const{topic:s,payload:r}=i;switch(r.method){case"wc_pairingPing":return await this.onPairingPingRequest(s,r);case"wc_pairingDelete":return await this.onPairingDeleteRequest(s,r);default:return await this.onUnknownRpcMethodRequest(s,r)}}),fi(this,"onRelayEventResponse",async i=>{const{topic:s,payload:r}=i,o=(await this.core.history.get(s,r.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(s,r);default:return this.onUnknownRpcMethodResponse(o)}}),fi(this,"onPairingPingRequest",async(i,s)=>{const{id:r}=s;try{this.isValidPing({topic:i}),await this.sendResult(r,i,!0),this.events.emit(Dm.ping,{id:r,topic:i})}catch(o){await this.sendError(r,i,o),this.logger.error(o)}}),fi(this,"onPairingPingResponse",(i,s)=>{const{id:r}=s;setTimeout(()=>{fd(s)?this.events.emit(Vi("pairing_ping",r),{}):xl(s)&&this.events.emit(Vi("pairing_ping",r),{error:s.error})},500)}),fi(this,"onPairingDeleteRequest",async(i,s)=>{const{id:r}=s;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(Dm.delete,{id:r,topic:i})}catch(o){await this.sendError(r,i,o),this.logger.error(o)}}),fi(this,"onUnknownRpcMethodRequest",async(i,s)=>{const{id:r,method:o}=s;try{if(this.registeredMethods.includes(o))return;const a=As("WC_METHOD_UNSUPPORTED",o);await this.sendError(r,i,a),this.logger.error(a)}catch(a){await this.sendError(r,i,a),this.logger.error(a)}}),fi(this,"onUnknownRpcMethodResponse",i=>{this.registeredMethods.includes(i)||this.logger.error(As("WC_METHOD_UNSUPPORTED",i))}),fi(this,"isValidPair",(i,s)=>{var r;if(!Ba(i)){const{message:a}=Ct("MISSING_OR_INVALID",`pair() params: ${i}`);throw s.setError(Mh.malformed_pairing_uri),new Error(a)}if(!rPe(i.uri)){const{message:a}=Ct("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw s.setError(Mh.malformed_pairing_uri),new Error(a)}const o=zq(i==null?void 0:i.uri);if(!((r=o==null?void 0:o.relay)!=null&&r.protocol)){const{message:a}=Ct("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(Mh.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=Ct("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(Mh.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&wt.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){s.setError(Mh.pairing_expired);const{message:a}=Ct("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),fi(this,"isValidPing",async i=>{if(!Ba(i)){const{message:r}=Ct("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(r)}const{topic:s}=i;await this.isValidPairingTopic(s)}),fi(this,"isValidDisconnect",async i=>{if(!Ba(i)){const{message:r}=Ct("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(r)}const{topic:s}=i;await this.isValidPairingTopic(s)}),fi(this,"isValidPairingTopic",async i=>{if(!Cr(i,!1)){const{message:s}=Ct("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(s)}if(!this.pairings.keys.includes(i)){const{message:s}=Ct("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(s)}if(yd(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:s}=Ct("EXPIRED",`pairing topic: ${i}`);throw new Error(s)}}),this.core=e,this.logger=ac(n,this.name),this.pairings=new S1(this.core,this.logger,this.name,this.storagePrefix)}get context(){return oc(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(wr.message,async e=>{const{topic:n,message:i,transportType:s}=e;if(this.pairings.keys.includes(n)&&s!==gs.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))try{const r=await this.core.crypto.decode(n,i);vM(r)?(this.core.history.set(n,r),await this.onRelayEventRequest({topic:n,payload:r})):ES(r)&&(await this.core.history.resolve(r),await this.onRelayEventResponse({topic:n,payload:r}),this.core.history.delete(n,r.id)),await this.core.relayer.messages.ack(n,i)}catch(r){this.logger.error(r)}})}registerExpirerEvents(){this.core.expirer.on(bl.expired,async e=>{const{topic:n}=iie(e.target);n&&this.pairings.keys.includes(n)&&(await this.deletePairing(n,!0),this.events.emit(Dm.expire,{topic:n}))})}};var TMe=Object.defineProperty,kMe=(t,e,n)=>e in t?TMe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fo=(t,e,n)=>kMe(t,typeof e!="symbol"?e+"":e,n);let NMe=class extends h_e{constructor(e,n){super(e,n),this.core=e,this.logger=n,fo(this,"records",new Map),fo(this,"events",new Ul.EventEmitter),fo(this,"name",PIe),fo(this,"version",IIe),fo(this,"cac
164hed",[]),fo(this,"initialized",!1),fo(this,"storagePrefix",Ld),fo(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),fo(this,"set",(i,s,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:s,chainId:r}),this.records.has(s.id))return;const o={id:s.id,topic:i,request:{method:s.method,params:s.params||null},chainId:r,expiry:yr(wt.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(iu.created,o)}),fo(this,"resolve",async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const s=await this.getRecord(i.id);typeof s.response>"u"&&(s.response=xl(i)?{error:i.error}:{result:i.result},this.records.set(s.id,s),this.persist(),this.events.emit(iu.updated,s))}),fo(this,"get",async(i,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:s}),await this.getRecord(s))),fo(this,"delete",(i,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(r=>{if(r.topic===i){if(typeof s<"u"&&r.id!==s)return;this.records.delete(r.id),this.events.emit(iu.deleted,r)}}),this.persist()}),fo(this,"exists",async(i,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===i:!1)),fo(this,"on",(i,s)=>{this.events.on(i,s)}),fo(this,"once",(i,s)=>{this.events.once(i,s)}),fo(this,"off",(i,s)=>{this.events.off(i,s)}),fo(this,"removeListener",(i,s)=>{this.events.removeListener(i,s)}),this.logger=ac(n,this.name)}get context(){return oc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(n=>{if(typeof n.response<"u")return;const i={topic:n.topic,request:wu(n.request.method,n.request.params,n.id),chainId:n.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const n=this.records.get(e);if(!n){const{message:i}=Ct("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return n}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(iu.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:n}=Ct("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(iu.created,e=>{const n=iu.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:e})}),this.events.on(iu.updated,e=>{const n=iu.updated;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:e})}),this.events.on(iu.deleted,e=>{const n=iu.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:e})}),this.core.heartbeat.on(x1.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(n=>{wt.toMiliseconds(n.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${n.id}`),this.records.delete(n.id),this.events.emit(iu.deleted,n,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}};var RMe=Object.defineProperty,PMe=(t,e,n)=>e in t?RMe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$o=(t,e,n)=>PMe(t,typeof e!="symbol"?e+"":e,n);let IMe=class extends b_e{constructor(e,n){super(e,n),this.core=e,this.logger=n,$o(this,"expirations",new Map),$o(this,"events",new Ul.EventEmitter),$o(this,"name",DIe),$o(this,"version",OIe),$o(this,"cac
164hed",[]),$o(this,"initialized",!1),$o(this,"storagePrefix",Ld),$o(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),$o(this,"has",i=>{try{const s=this.formatTarget(i);return typeof this.getExpiration(s)<"u"}catch{return!1}}),$o(this,"set",(i,s)=>{this.isInitialized();const r=this.formatTarget(i),o={target:r,expiry:s};this.expirations.set(r,o),this.checkExpiry(r,o),this.events.emit(bl.created,{target:r,expiration:o})}),$o(this,"get",i=>{this.isInitialized();const s=this.formatTarget(i);return this.getExpiration(s)}),$o(this,"del",i=>{if(this.isInitialized(),this.has(i)){const s=this.formatTarget(i),r=this.getExpiration(s);this.expirations.delete(s),this.events.emit(bl.deleted,{target:s,expiration:r})}}),$o(this,"on",(i,s)=>{this.events.on(i,s)}),$o(this,"once",(i,s)=>{this.events.once(i,s)}),$o(this,"off",(i,s)=>{this.events.off(i,s)}),$o(this,"removeListener",(i,s)=>{this.events.removeListener(i,s)}),this.logger=ac(n,this.name)}get context(){return oc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return O7e(e);if(typeof e=="number")return M7e(e);const{message:n}=Ct("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(n)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(bl.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:n}=Ct("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const n=this.expirations.get(e);if(!n){const{message:i}=Ct("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return n}checkExpiry(e,n){const{expiry:i}=n;wt.toMiliseconds(i)-Date.now()<=0&&this.expire(e,n)}expire(e,n){this.expirations.delete(e),this.events.emit(bl.expired,{target:e,expiration:n})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,n)=>this.checkExpiry(n,e))}registerEventListeners(){this.core.heartbeat.on(x1.pulse,()=>this.checkExpirations()),this.events.on(bl.created,e=>{const n=bl.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:e}),this.persist()}),this.events.on(bl.expired,e=>{const n=bl.expired;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:e}),this.persist()}),this.events.on(bl.deleted,e=>{const n=bl.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}};var DMe=Object.defineProperty,OMe=(t,e,n)=>e in t?DMe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mr=(t,e,n)=>OMe(t,typeof e!="symbol"?e+"":e,n);let MMe=class extends w_e{constructor(e,n,i){super(e,n,i),this.core=e,this.logger=n,this.store=i,mr(this,"name",MIe),mr(this,"abortController"),mr(this,"isDevEnv"),mr(this,"verifyUrlV3",$Ie),mr(this,"storagePrefix",Ld),mr(this,"version",dse),mr(this,"publicKey"),mr(this,"fetchPromise"),mr(this,"init",async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&wt.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),mr(this,"register",async s=>{if(!qb()||this.isDevEnv)return;const r=window.location.origin,{id:o,decryptedId:a}=s,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${r}&id=${o}&decryptedId=${a}`;try{const l=Ef.getDocument(),d=this.startAbortTimer(wt.ONE_SECOND*5),h=await new Promise((p,g)=>{const b=()=>{window.removeEventListener("message",C),l.body.removeChild(w),g("attestation aborted")};this.abortController.signal.addEventListener("abort",b);const w=l.createElement("iframe");w.src=c,w.style.display="none",w.addEventListener("error",b,{signal:this.abortController.signal});const C=E=>
vendor: 8,805 bytes, line 164
164{if(E.data&&typeof E.data=="string")try{const T=JSON.parse(E.data);if(T.type==="verify_attestation"){if(SP(T.attestation).payload.id!==o)return;clearInterval(d),l.body.removeChild(w),this.abortController.signal.removeEventListener("abort",b),window.removeEventListener("message",C),p(T.attestation===null?"":T.attestation)}}catch(T){this.logger.warn(T)}};l.body.appendChild(w),window.addEventListener("message",C,{signal:this.abortController.signal})});return this.logger.debug(h,"jwt attestation"),h}catch(l){this.logger.warn(l)}return""}),mr(this,"resolve",async s=>{if(this.isDevEnv)return"";const{attestationId:r,hash:o,encryptedId:a}=s;if(r===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(r){if(SP(r).payload.id!==a)return;const l=await this.isValidJwtAttestation(r);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(o,c)}),mr(this,"fetchAttestation",async(s,r)=>{this.logger.debug(`resolving attestation: ${s} from url: ${r}`);const o=this.startAbortTimer(wt.ONE_SECOND*5),a=await fetch(`${r}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),mr(this,"getVerifyUrl",s=>{let r=s||g3;return UIe.includes(r)||(this.logger.info(`verify url: ${r}, not included in trusted list, assigning default: ${g3}`),r=g3),r}),mr(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(wt.FIVE_SECONDS),r=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await r.json()}catch(s){this.logger.warn(s)}}),mr(this,"persistPublicKey",async s=>{this.logger.debug(s,"persisting public key to local storage"),await this.store.setItem(this.storeKey,s),this.publicKey=s}),mr(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),mr(this,"isValidJwtAttestation",async s=>{const r=await this.getPublicKey();try{if(r)return this.validateAttestation(s,r)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),mr(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),mr(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async r=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),r(o))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s}),mr(this,"validateAttestation",(s,r)=>{const o=PRe(s,r.publicKey),a={hasExpired:wt.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=ac(n,this.name),this.abortController=new AbortController,this.isDevEnv=aM(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return oc(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),wt.toMiliseconds(e))}};var LMe=Object.defineProperty,$Me=(t,e,n)=>e in t?LMe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Rz=(t,e,n)=>$Me(t,typeof e!="symbol"?e+"":e,n);let UMe=class extends v_e{constructor(e,n){super(e,n),this.projectId=e,this.logger=n,Rz(this,"context",BIe),Rz(this,"registerDeviceToken",async i=>{const{clientId:s,token:r,notificationType:o,enableEncrypted:a=!1}=i,c=`${FIe}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:o,token:r,always_raw:a})})}),this.logger=ac(n,this.context)}};var BMe=Object.defineProperty,Pz=Object.getOwnPropertySymbols,FMe=Object.prototype.hasOwnProperty,jMe=Object.prototype.propertyIsEnumerable,JP=(t,e,n)=>e in t?BMe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Bv=(t,e)=>{for(var n in e||(e={}))FMe.call(e,n)&&JP(t,n,e[n]);if(Pz)for(var n of Pz(e))jMe.call(e,n)&&JP(t,n,e[n]);return t},Gr=(t,e,n)=>JP(t,typeof e!="symbol"?e+"":e,n);let VMe=class extends C_e{constructor(e,n,i=!0){super(e,n,i),this.core=e,this.logger=n,Gr(this,"context",VIe),Gr(this,"storagePrefix",Ld),Gr(this,"storageVersion",jIe),Gr(this,"events",new Map),Gr(this,"shouldPersist",!1),Gr(this,"init",async()=>{if(!aM())try{const s={eventId:dq(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:tie(this.core.relayer.protocol,this.core.relayer.version,zP)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}}),Gr(this,"createEvent",s=>{const{event:r="ERROR",type:o="",properties:{topic:a,trace:c}}=s,l=dq(),d=this.core.projectId||"",h=Date.now(),p=Bv({eventId:l,timestamp:h,props:{event:r,type:o,properties:{topic:a,trace:c}},bundleId:d,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,p),this.shouldPersist=!0),p}),Gr(this,"getEvent",s=>{const{eventId:r,topic:o}=s;if(r)return this.events.get(r);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return Bv(Bv({},a),this.setMethods(a.eventId))}),Gr(this,"deleteEvent",s=>{const{eventId:r}=s;this.events.delete(r),this.shouldPersist=!0}),Gr(this,"setEventListeners",()=>{this.core.heartbeat.on(x1.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{wt.fromMiliseconds(Date.now())-wt.fromMiliseconds(s.timestamp)>WIe&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})}),Gr(this,"setMethods",s=>({addTrace:r=>this.addTrace(s,r),setError:r=>this.setError(s,r)})),Gr(this,"addTrace",(s,r)=>{const o=this.events.get(s);o&&(o.props.properties.trace.push(r),this.events.set(s,o),this.shouldPersist=!0)}),Gr(this,"setError",(s,r)=>{const o=this.events.get(s);o&&(o.props.type=r,o.timestamp=Date.now(),this.events.set(s,o),this.shouldPersist=!0)}),Gr(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),Gr(this,"restore",async()=>{try{const s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(r=>{this.events.set(r.eventId,Bv(Bv({},r),this.setMethods(r.eventId)))})}catch(s){this.logger.warn(s)}}),Gr(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[r,o]of this.events)o.props.type&&s.push(o);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const r of s)this.events.delete(r.eventId),this.shouldPersist=!0}catch(r){this.logger.warn(r)}}),Gr(this,"sendEvent",async s=>{const r=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${qIe}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${zP}${r}`,{method:"POST",body:JSON.stringify(s)})}),Gr(this,"getAppDomain",()=>eie().url),this.logger=ac(n,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}};var WMe=Object.defineProperty,Iz=Object.getOwnPropertySymbols,qMe=Object.prototype.hasOwnProperty,zMe=Object.prototype.propertyIsEnumerable,eI=(t,e,n)=>e in t?WMe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dz=(t,e)=>{for(var n in e||(e={}))qMe.call(e,n)&&eI(t,n,e[n]);if(Iz)for(var n of Iz(e))zMe.call(e,n)&&eI(t,n,e[n]);return t},us=(t,e,n)=>eI(t,typeof e!="symbol"?e+"":e,n);let HMe=class Ase extends c_e{constructor(e){var n;super(e),us(this,"protocol",use),us(this,"version",dse),us(this,"name",qP),us(this,"relayUrl"),us(this,"projectId"),us(this,"customStoragePrefix"),us(this,"events",new Ul.EventEmitter),us(this,"logger"),us(this,"heartbeat"),us(this,"relayer"),us(this,"crypto"),us(this,"storage"),us(this,"history"),us(this,"expirer"),us(this,"pairing"),us(this,"verify"),us(this,"echoClient"),us(this,"linkModeSupportedApps"),us(this,"eventClient"),us(this,"initialized",!1),us(this,"logChunkController"),us(this,"on",(a,c)=>this.events.on(a,c)),us(this,"once",(a,c)=>this.events.once(a,c)),us(this,"off",(a,c)=>this.events.off(a,c)),us(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),us(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:l})=>
164{if(!a||!c)return;const d={topic:a,message:c,publishedAt:Date.now(),transportType:gs.link_mode};this.relayer.onLinkMessageEvent(d,{sessionExists:l})});const i=this.getGlobalCore(e==null?void 0:e.customStoragePrefix);if(i)try{return this.customStoragePrefix=i.customStoragePrefix,this.logger=i.logger,this.heartbeat=i.heartbeat,this.crypto=i.crypto,this.history=i.history,this.expirer=i.expirer,this.storage=i.storage,this.relayer=i.relayer,this.pairing=i.pairing,this.verify=i.verify,this.echoClient=i.echoClient,this.linkModeSupportedApps=i.linkModeSupportedApps,this.eventClient=i.eventClient,this.initialized=i.initialized,this.logChunkController=i.logChunkController,i}catch(a){console.warn("Failed to copy global core",a)}this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||fse,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const s=HO({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:dIe.logger,name:qP}),{logger:r,chunkLoggerController:o}=aS({opts:s,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(n=this.logChunkController)!=null&&n.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ac(r,this.name),this.heartbeat=new SEe,this.crypto=new wOe(this,this.logger,e==null?void 0:e.keychain),this.history=new NMe(this,this.logger),this.expirer=new IMe(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new r_e(Dz(Dz({},hIe),e==null?void 0:e.storageOptions)),this.relayer=new HOe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new AMe(this,this.logger),this.verify=new MMe(this,this.logger,this.storage),this.echoClient=new UMe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new VMe(this,this.logger,e==null?void 0:e.telemetryEnabled),this.setGlobalCore(this)}static async init(e){const n=new Ase(e);await n.initialize();const i=await n.crypto.getClientId();return await n.storage.setItem(AIe,i),n}get context(){return oc(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(dz,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(dz)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(e,`Core Initialization Failure at epoch ${Date.now()}`),this.logger.error(e.message),e}}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${e}`,i=`${n}_count`;return globalThis[i]=(globalThis[i]||0)+1,globalThis[i]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[i]} times.`),globalThis[n]}catch(n){console.warn("Failed to get global WalletConnect core",n);return}}setGlobalCore(e){var n;try{if(this.isGlobalCoreDisabled())return;const i=`_walletConnectCore_${((n=e.opts)==null?void 0:n.customStoragePrefix)||""}`;globalThis[i]=e}catch(i){console.warn("Failed to set global WalletConnect core",i)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&uIe.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const GMe=HMe,Tse="wc",kse=2,Nse="client",xM=`${Tse}@${kse}:${Nse}:`,j7={name:Nse,logger:"error"},Oz="WALLETCONNECT_DEEPLINK_CHOICE",KMe="proposal",Mz="Proposal expired",YMe="session",Oy=wt.SEVEN_DAYS,ZMe="engine",po={wc_sessionPropose:{req:{ttl:wt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:wt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:wt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:wt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:wt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:wt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:wt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:wt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:wt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:wt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:wt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:wt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:wt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:wt.FIVE_MINUTES,prompt:!1,tag:1119}}},V7={min:wt.FIVE_MINUTES,max:wt.SEVEN_DAYS},cd={idle:"IDLE",active:"ACTIVE"},QMe={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""}
vendor: 39,104 bytes, line 164
164,cosmos_signDirect:{key:""}},XMe="request",JMe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],eLe="wc",tLe="auth",nLe="authKeys",iLe="pairingTopics",sLe="requests",SS=`${eLe}@${1.5}:${tLe}:`,yE=`${SS}:PUB_KEY`;var rLe=Object.defineProperty,oLe=Object.defineProperties,aLe=Object.getOwnPropertyDescriptors,Lz=Object.getOwnPropertySymbols,cLe=Object.prototype.hasOwnProperty,lLe=Object.prototype.propertyIsEnumerable,tI=(t,e,n)=>e in t?rLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Di=(t,e)=>{for(var n in e||(e={}))cLe.call(e,n)&&tI(t,n,e[n]);if(Lz)for(var n of Lz(e))lLe.call(e,n)&&tI(t,n,e[n]);return t},mo=(t,e)=>oLe(t,aLe(e)),rt=(t,e,n)=>tI(t,typeof e!="symbol"?e+"":e,n);let uLe=class extends S_e{constructor(e){super(e),rt(this,"name",ZMe),rt(this,"events",new KO),rt(this,"initialized",!1),rt(this,"requestQueue",{state:cd.idle,queue:[]}),rt(this,"sessionRequestQueue",{state:cd.idle,queue:[]}),rt(this,"emittedSessionRequests",new q7e({limit:500})),rt(this,"requestQueueDelay",wt.ONE_SECOND),rt(this,"expectedPairingMethodMap",new Map),rt(this,"recentlyDeletedMap",new Map),rt(this,"recentlyDeletedLimit",200),rt(this,"relayMessageCache",[]),rt(this,"pendingSessions",new Map),rt(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(po)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},wt.toMiliseconds(this.requestQueueDelay)))}),rt(this,"connect",async n=>{var i;this.isInitialized(),await this.confirmOnlineStateOrThrow();const s=mo(Di({},n),{requiredNamespaces:n.requiredNamespaces||{},optionalNamespaces:n.optionalNamespaces||{}});await this.isValidConnect(s),s.optionalNamespaces=ePe(s.requiredNamespaces,s.optionalNamespaces),s.requiredNamespaces={};const{pairingTopic:r,requiredNamespaces:o,optionalNamespaces:a,sessionProperties:c,scopedProperties:l,relays:d,authentication:h,walletPay:p}=s,g=((i=h==null?void 0:h[0])==null?void 0:i.ttl)||po.wc_sessionPropose.req.ttl||wt.FIVE_MINUTES;this.validateRequestExpiry(g);let b=r,w,C=!1;try{if(b){const z=this.client.core.pairing.pairings.get(b);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),C=z.active}}catch(z){throw this.client.logger.error(`connect() -> pairing.get(${b}) failed`),z}if(!b||!C){const{topic:z,uri:K}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});b=z,w=K}if(!b){const{message:z}=Ct("NO_MATCHING_KEY",`connect() pairing topic: ${b}`);throw new Error(z)}const E=await this.client.core.crypto.generateKeyPair(),T=yr(g),A=Di(mo(Di(Di({requiredNamespaces:o,optionalNamespaces:a,relays:d??[{protocol:hse}],proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:T,pairingTopic:b},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:hd()}),(h||p)&&{requests:{authentication:h==null?void 0:h.map(z=>{const{domain:K,chains:q,nonce:G,uri:I,exp:S,nbf:v,type:_,statement:N,requestId:$,resources:U,signatureTypes:j}=z;return{domain:K,chains:q,nonce:G,type:_??"caip122",aud:I,version:"1",iat:new Date().toISOString(),exp:S,nbf:v,statement:N,requestId:$,resources:U,signatureTypes:j}}),walletPay:p}}),k=Vi("session_connect",A.id),{reject:R,resolve:P,done:B}=Nm(g,Mz),F=({id:z})=>{z===A.id&&(this.client.events.off("proposal_expire",F),this.pendingSessions.delete(A.id),this.events.emit(k,{error:{message:Mz,code:0}}))};return this.client.events.on("proposal_expire",F),this.events.once(k,({error:z,session:K})=>{this.client.events.off("proposal_expire",F),z?R(z):K&&P(K)}),await this.setProposal(A.id,A),await this.sendProposeSession({proposal:A,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:A.id}}}).catch(z=>{throw this.deleteProposal(A.id),z}),{uri:w,approval:B}}),rt(this,"pair",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(n)}catch(i){throw this.client.logger.error("pair() failed"),i}}),rt(this,"approve",async n=>{var i,s,r;const o=this.client.core.eventClient.createEvent({properties:{topic:(i=n==null?void 0:n.id)==null?void 0:i.toString(),trace:[su.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(K){throw o.setError(gm.no_internet_connection),K}try{await this.isValidProposalId(n==null?void 0:n.id)}catch(K){throw this.client.logger.error(`approve() -> proposal.get(${n==null?void 0:n.id}) failed`),o.setError(gm.proposal_not_found),K}try{await this.isValidApprove(n)}catch(K){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(gm.session_approve_namespace_validation_failure),K}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:d,scopedProperties:h,sessionConfig:p,proposalRequestsResponses:g}=n,b=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:w,proposer:C,requiredNamespaces:E,optionalNamespaces:T}=b;let A=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:w});A||(A=(r=this.client.core.eventClient)==null?void 0:r.createEvent({type:su.session_approve_started,properties:{topic:w,trace:[su.session_approve_started,su.session_namespaces_validation_success]}}));const k=await this.client.core.crypto.generateKeyPair(),R=C.publicKey,P=await this.client.core.crypto.generateSharedKey(k,R),B=mo(Di(Di(Di({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:k,metadata:this.client.metadata},expiry:yr(Oy)},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),{proposalRequestsResponses:g}),F=gs.relay;A.addTrace(su.subscribing_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:F,internal:{skipSubscribe:!0}})}catch(K){throw A.setError(gm.subscribe_session_topic_failure),K}A.addTrace(su.subscribe_session_topic_success);const z=mo(Di({},B),{topic:P,requiredNamespaces:E,optionalNamespaces:T,pairingTopic:w,acknowledged:!1,self:B.controller,peer:{publicKey:C.publicKey,metadata:C.metadata},controller:k,transportType:gs.relay,authentication:g==null?void 0:g.authentication,walletPayResult:g==null?void 0:g.walletPay});await this.client.session.set(P,z),A.addTrace(su.store_session);try{await this.sendApproveSession({sessionTopic:P,proposal:b,pairingProposalResponse:{relay:{protocol:c??"irn"},responderPublicKey:k},sessionSettleRequest:B,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:Di({correlationId:a},this.getTVFApproveParams(z))}}),A.addTrace(su.session_approve_publish_success)}catch(K){throw this.client.logger.error(K),this.client.session.delete(P,As("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(P),K}return this.client.core.eventClient.deleteEvent({eventId:A.eventId}),await this.client.core.pairing.updateMetadata({topic:w,metadata:C.metadata}),await this.deleteProposal(a),await this.client.core.pairing.activate({topic:w}),await this.setExpiry(P,yr(Oy)),{topic:P,acknowledged:()=>Promise.resolve(this.client.session.get(P))}}),rt(this,"reject",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(n)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:i,reason:s}=n;let r;try{r=this.client.proposal.get(i).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),o}r&&await this.sendError({id:i,topic:r,error:s,rpcOpts:po.wc_sessionPropose.reject}),await this.deleteProposal(i)}),rt(this,"update",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(n)}catch(h){throw this.client.logger.error("update() -> isValidUpdate() failed"),h}const{topic:i,namespaces:s}=n,{done:r,resolve:o,reject:a}=Nm(wt.FIVE_MINUTES,"Session update request expired without receiving any acknowledgement"),c=hd(),l=sp().toString(),d=this.client.session.get(i).namespaces;return this.events.once(Vi("session_update",c),({error:h})=>{h?a(h):o()}),await this.client.session.update(i,{namespaces:s}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(h=>{this.client.logger.error(h),this.client.session.update(i,{namespaces:d}),a(h)}),{acknowledged:r}}),rt(this,"extend",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(n)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:i}=n,s=hd(),{done:r,resolve:o,reject:a}=Nm(wt.FIVE_MINUTES,"Session extend request expired without receiving any acknowledgement");return this.events.once(Vi("session_extend",s),({error:c})=>{c?a(c):o()}),await this.setExpiry(i,yr(Oy)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:r}}),rt(this,"request",async n=>{this.isInitialized();try{await this.isValidRequest(n)}catch(C){throw this.client.logger.error("request() -> isValidRequest() failed"),C}const{chainId:i,request:s,topic:r,expiry:o=po.wc_sessionRequest.req.ttl}=n,a=this.client.session.get(r);(a==null?void 0:a.transportType)===gs.relay&&await this.confirmOnlineStateOrThrow();const c=hd(),l=sp().toString(),{done:d,resolve:h,reject:p}=Nm(o,"Request expired. Please try again.");this.events.once(Vi("session_request",c),({error:C,result:E})=>{C?p(C):h(E)});const g="wc_sessionRequest",b=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(b)return await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:r,method:g,params:{request:mo(Di({},s),{expiryTimestamp:yr(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0,appLink:b}).catch(C=>p(C)),this.client.events.emit("session_request_sent",{topic:r,request:s,chainId:i,id:c}),await d();const w={request:mo(Di({},s),{expiryTimestamp:yr(o)}),chainId:i};return await Promise.all([new Promise(async C=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:r,method:g,params:w,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(c,w)}).catch(E=>p(E)),this.client.events.emit("session_request_sent",{topic:r,request:s,chainId:i,id:c}),C()}),new Promise(async C=>{var E;if(!((E=a.sessionConfig)!=null&&E.disableDeepLink)){const T=await B7e(this.client.core.storage,Oz);await L7e({id:c,topic:r,wcDeepLink:T})}C()}),d()]).then(C=>C[2])}),rt(this,"respond",async n=>{var i,s;this.isInitialized();const r=this.client.core.eventClient.createEvent({properties:{topic:(n==null?void 0:n.topic)||((s=(i=n==null?void 0:n.response)==null?void 0:i.id)==null?void 0:s.toString()),trace:[su.session_request_response_started]}});try{await this.isValidRespond(n)}catch(h){throw r.addTrace(h==null?void 0:h.message),r.setError(gm.session_request_response_validation_failure),h}r.addTrace(su.session_request_response_validation_success);const{topic:o,response:a}=n,{id:c}=a,l=this.client.session.get(o);l.transportType===gs.relay&&await this.confirmOnlineStateOrThrow();const d=this.getAppLinkIfEnabled(l.peer.metadata,l.transportType);try{r.addTrace(su.session_request_response_publish_started),fd(a)?await this.sendResult({id:c,topic:o,result:a.result,throwOnFailedPublish:!0,appLink:d}):xl(a)&&await this.sendError({id:c,topic:o,error:a.error,appLink:d}),this.cleanupAfterResponse(n)}catch(h){throw r.addTrace(h==null?void 0:h.message),r.setError(gm.session_request_response_publish_failure),h}}),rt(this,"ping",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(n)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:i}=n;if(this.client.session.keys.includes(i)){const s=hd(),r=sp().toString(),{done:o,resolve:a,reject:c}=Nm(wt.FIVE_MINUTES,"Ping request expired without receiving any acknowledgement");this.events.once(Vi("session_ping",s),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:r}),o()])}else this.client.core.pairing.pairings.keys.includes(i)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:i}))}),rt(this,"emit",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(n);const{topic:i,event:s,chainId:r}=n,o=sp().toString(),a=hd();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:s,chainId:r},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),rt(this,"disconnect",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(n);const{topic:i}=n;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:As("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:s}=Ct("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(s)}}),rt(this,"find",n=>(this.isInitialized(),this.client.session.getAll().filter(i=>iPe(i,n)))),rt(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),rt(this,"authenticate",async(n,i)=>{var s;this.isInitialized(),this.isValidAuthenticate(n);const r=i&&this.client.core.linkModeSupportedApps.includes(i)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),o=r?gs.link_mode:gs.relay;o===gs.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:d,nonce:h,type:p,exp:g,nbf:b,methods:w=[],expiry:C}=n,E=[...n.resources||[]],{topic:T,uri:A}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:T,uri:A}});const k=await this.client.core.crypto.generateKeyPair(),R=mE(k);if(await Promise.all([this.client.auth.authKeys.set(yE,{responseTopic:R,publicKey:k}),this.client.auth.pairingTopics.set(R,{topic:R,pairingTopic:T})]),await this.client.core.relayer.subscribe(R,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${T}`),w.length>0){const{namespace:U}=of(a[0]);let j=iNe(U,"request",w);pE(E)&&(j=rNe(j,E.pop())),E.push(j)}const P=C&&C>po.wc_sessionAuthenticate.req.ttl?C:po.wc_sessionAuthenticate.req.ttl,B={authPayload:{type:p??"caip122",chains:a,statement:c,aud:l,domain:d,version:"1",nonce:h,iat:new Date().toISOString(),exp:g,nbf:b,resources:E},requester:{publicKey:k,metadata:this.client.metadata},expiryTimestamp:yr(P)},F={eip155:{chains:a,methods:[...new Set(["personal_sign",...w])],events:["chainChanged","accountsChanged"]}},z={requiredNamespaces:{},optionalNamespaces:F,relays:[{protocol:"irn"}],pairingTopic:T,proposer:{publicKey:k,metadata:this.client.metadata},expiryTimestamp:yr(po.wc_sessionPropose.req.ttl),id:hd()},{done:K,resolve:q,reject:G}=Nm(P,"Request expired"),I=hd(),S=Vi("session_connect",z.id),v=Vi("session_request",I),_=async({error:U,session:j})=>{this.events.off(v,N),U?G(U):j&&q({session:j})},N=async U=>{var j,D,O;if(await this.deletePendingAuthRequest(I,{message:"fulfilled",code:0}),U.error){const ee=As("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return U.error.code===ee.code?void 0:(this.events.off(S,_),G(U.error.message))}await this.deleteProposal(z.id),this.events.off(S,_);const{cacaos:H,responder:J}=U.result,W=[],Z=[];for(const ee of H){await xq({cacao:ee,projectId:this.client.core.projectId})||(this.client.logger.error(ee,"Signature verification failed"),G(As("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:ie}=ee,re=pE(ie.resources),oe=[IP(ie.iss)],de=E_(ie.iss);if(re){const he=Eq(re),ue=_q(re);W.push(...he),oe.push(...ue)}for(const he of oe)Z.push(`${he}:${de}`)}const Y=await this.client.core.crypto.generateSharedKey(k,J.publicKey);let Q;W.length>0&&(Q={topic:Y,acknowledged:!0,self:{publicKey:k,metadata:this.client.metadata},peer:J,controller:J.publicKey,expiry:yr(Oy),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:T,namespaces:Zq([...new Set(W)],[...new Set(Z)]),transportType:o},await this.client.core.relayer.subscribe(Y,{transportType:o}),await this.client.session.set(Y,Q),T&&await this.client.core.pairing.updateMetadata({topic:T,metadata:J.metadata}),Q=this.client.session.get(Y)),(j=this.client.metadata.redirect)!=null&&j.linkMode&&(D=J.metadata.redirect)!=null&&D.linkMode&&(O=J.metadata.redirect)!=null&&O.universal&&i&&(this.client.core.addLinkModeSupportedApp(J.metadata.redirect.universal),this.client.session.update(Y,{transportType:gs.link_mode})),q({auths:H,session:Q})};this.events.once(S,_),this.events.once(v,N);let $;try{if(r){const U=wu("wc_sessionAuthenticate",B,I);this.client.core.history.set(T,U);const j=await this.client.core.crypto.encode("",U,{type:V6,encoding:H0});$=yx(i,T,j)}else await Promise.all([this.sendRequest({topic:T,method:"wc_sessionAuthenticate",params:B,expiry:n.expiry,throwOnFailedPublish:!0,clientRpcId:I}),this.sendRequest({topic:T,method:"wc_sessionPropose",params:z,expiry:po.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:z.id})])}catch(U){throw this.events.off(S,_),this.events.off(v,N),U}return await this.setProposal(z.id,z),await this.setAuthRequest(I,{request:mo(Di({},B),{verifyContext:{}}),pairingTopic:T,transportType:o}),{uri:$??A,response:K}}),rt(this,"approveSessionAuthenticate",async n=>{const{id:i,auths:s}=n,r=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[ym.authenticated_session_approve_started]}});try{this.isInitialized()}catch(C){throw r.setError($v.no_internet_connection),C}const o=this.getPendingAuthRequest(i);if(!o)throw r.setError($v.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const a=o.transportType||gs.relay;a===gs.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=mE(c),h={type:af,receiverPublicKey:c,senderPublicKey:l},p=[],g=[];for(const C of s){if(!await xq({cacao:C,projectId:this.client.core.projectId})){r.setError($v.invalid_cacao);const R=As("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:d,error:R,encodeOpts:h}),new Error(R.message)}r.addTrace(ym.cacaos_verified);const{p:E}=C,T=pE(E.resources),A=[IP(E.iss)],k=E_(E.iss);if(T){const R=Eq(T),P=_q(T);p.push(...R),A.push(...P)}for(const R of A)g.push(`${R}:${k}`)}const b=await this.client.core.crypto.generateSharedKey(l,c);r.addTrace(ym.create_authenticated_session_topic);let w;if((p==null?void 0:p.length)>0){w={topic:b,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:yr(Oy),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Zq([...new Set(p)],[...new Set(g)]),transportType:a},r.addTrace(ym.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:a})}catch(C){throw r.setError($v.subscribe_authenticated_session_topic_failure),C}r.addTrace(ym.subscribe_authenticated_session_topic_success),await this.client.session.set(b,w),r.addTrace(ym.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}r.addTrace(ym.publishing_authenticated_session_approve);try{await this.sendResult({topic:d,id:i,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(C){throw r.setError($v.authenticated_session_approve_publish_failure),C}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:r.eventId}),{session:w}}),rt(this,"rejectSessionAuthenticate",async n=>{this.isInitialized();const{id:i,reason:s}=n,r=this.getPendingAuthRequest(i);if(!r)throw new Error(`Could not find pending auth request with id ${i}`);r.transportType===gs.relay&&await this.confirmOnlineStateOrThrow();const o=r.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=mE(o),l={type:af,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:i,topic:c,error:s,encodeOpts:l,rpcOpts:po.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(r.requester.metadata,r.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.deleteProposal(i)}),rt(this,"formatAuthMessage",n=>{this.isInitialized();const{request:i,iss:s}=n;return vie(i,s)}),rt(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const n=this.relayMessageCache.shift();n&&await this.onRelayMessage(n)}catch(n){this.client.logger.error(n)}},50)}),rt(this,"cleanupDuplicatePairings",async n=>{if(n.pairingTopic)try{const i=this.client.core.pairing.pairings.get(n.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(r=>{var o,a;return((o=r.peerMetadata)==null?void 0:o.url)&&((a=r.peerMetadata)==null?void 0:a.url)===n.peer.metadata.url&&r.topic&&r.topic!==i.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(r=>this.client.core.pairing.disconnect({topic:r.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}}),rt(this,"deleteSession",async n=>{var i;const{topic:s,expirerHasDeleted:r=!1,emitEvent:o=!0,id:a=0}=n,{self:c}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,As("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),r||this.client.core.expirer.del(s),this.client.core.storage.removeItem(Oz).catch(l=>this.client.logger.warn(l)),s===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=cd.idle),await Promise.all(this.getPendingSessionRequests().filter(l=>l.topic===s).map(l=>this.deletePendingSessionRequest(l.id,As("USER_DISCONNECTED")))),o&&this.client.events.emit("session_delete",{id:a,topic:s})}),rt(this,"deleteProposal",async(n,i)=>{if(i)try{const s=this.client.proposal.get(n),r=this.client.core.eventClient.getEvent({topic:s.pairingTopic});r==null||r.setError(gm.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(n,As("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"proposal")}),rt(this,"deletePendingSessionRequest",async(n,i,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(n,i),s?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(r=>r.id!==n),s&&(this.sessionRequestQueue.state=cd.idle,this.client.events.emit("session_request_expire",{id:n}))}),rt(this,"deletePendingAuthRequest",async(n,i,s=!1)=>{await Promise.all([this.client.auth.requests.delete(n,i),s?Promise.resolve():this.client.core.expirer.del(n)])}),rt(this,"setExpiry",async(n,i)=>{this.client.session.keys.includes(n)&&(this.client.core.expirer.set(n,i),await this.client.session.update(n,{expiry:i}))}),rt(this,"setProposal",async(n,i)=>{this.client.core.expirer.set(n,yr(po.wc_sessionPropose.req.ttl)),await this.client.proposal.set(n,i)}),rt(this,"setAuthRequest",async(n,i)=>{const{request:s,pairingTopic:r,transportType:o=gs.relay}=i;this.client.core.expirer.set(n,s.expiryTimestamp),await this.client.auth.requests.set(n,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:n,pairingTopic:r,verifyContext:s.verifyContext,transportType:o})}),rt(this,"setPendingSessionRequest",async n=>{const{id:i,topic:s,params:r,verifyContext:o}=n,a=r.request.expiryTimestamp||yr(po.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,a),await this.client.pendingRequest.set(i,{id:i,topic:s,params:r,verifyContext:o})}),rt(this,"sendRequest",async n=>{const{topic:i,method:s,params:r,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:d,tvf:h,publishOpts:p={}}=n,g=wu(s,r,c);let b;const w=!!d;try{const T=w?H0:qa;b=await this.client.core.crypto.encode(i,g,{encoding:T})}catch(T){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),T}let C;if(JMe.includes(s)){const T=Cl(JSON.stringify(g)),A=Cl(b);C=await this.client.core.verify.register({id:A,decryptedId:T})}const E=Di(Di({},po[s].req),p);if(E.attestation=C,o&&(E.ttl=o),a&&(E.id=a),this.client.core.history.set(i,g),w){const T=yx(d,i,b);await global.Linking.openURL(T,this.client.name)}else E.tvf=mo(Di({},h),{correlationId:g.id}),l?(E.internal=mo(Di({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,b,E)):this.client.core.relayer.publish(i,b,E).catch(T=>this.client.logger.error(T));return g.id}),rt(this,"sendProposeSession",async n=>{const{proposal:i,publishOpts:s}=n,r=wu("wc_sessionPropose",i,i.id);this.client.core.history.set(i.pairingTopic,r);const o=await this.client.core.crypto.encode(i.pairingTopic,r,{encoding:qa}),a=Cl(JSON.stringify(r)),c=Cl(o),l=await this.client.core.verify.register({id:c,decryptedId:a});await this.client.core.relayer.publishCustom({payload:{pairingTopic:i.pairingTopic,sessionProposal:o},opts:mo(Di({},s),{publishMethod:"wc_proposeSession",attestation:l})})}),rt(this,"sendApproveSession",async n=>{const{sessionTopic:i,pairingProposalResponse:s,proposal:r,sessionSettleRequest:o,publishOpts:a}=n,c=k5(r.id,s),l=await this.client.core.crypto.encode(r.pairingTopic,c,{encoding:qa}),d=wu("wc_sessionSettle",o,a==null?void 0:a.id),h=await this.client.core.crypto.encode(i,d,{encoding:qa});this.client.core.history.set(i,d),await this.client.core.relayer.publishCustom({payload:{sessionTopic:i,pairingTopic:r.pairingTopic,sessionProposalResponse:l,sessionSettlementRequest:h},opts:mo(Di({},a),{publishMethod:"wc_approveSession"})})}),rt(this,"sendResult",async n=>{const{id:i,topic:s,result:r,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=n,l=k5(i,r);let d;const h=c&&typeof(global==null?void 0:global.Linking)<"u";try{const b=h?H0:qa;d=await this.client.core.crypto.encode(s,l,mo(Di({},a||{}),{encoding:b}))}catch(b){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),b}let p,g;try{p=await this.client.core.history.get(s,i);const b=p.request;try{g=this.getTVFParams(i,b.params,r)}catch(w){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${w==null?void 0:w.message}`)}}catch(b){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${i}) failed`),b}if(h){const b=yx(c,s,d);await global.Linking.openURL(b,this.client.name)}else{const b=p.request.method,w=po[b].res;w.tvf=mo(Di({},g),{correlationId:i}),o?(w.internal=mo(Di({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,d,w)):this.client.core.relayer.publish(s,d,w).catch(C=>this.client.logger.error(C))}await this.client.core.history.resolve(l)}),rt(this,"sendError",async n=>{const{id:i,topic:s,error:r,encodeOpts:o,rpcOpts:a,appLink:c}=n,l=xS(i,r);let d;const h=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=h?H0:qa;d=await this.client.core.crypto.encode(s,l,mo(Di({},o||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),g}let p;try{p=await this.client.core.history.get(s,i)}catch(g){throw this.client.logger.error(`sendError() -> history.get(${s}, ${i}) failed`),g}if(h){const g=yx(c,s,d);await global.Linking.openURL(g,this.client.name)}else{const g=p.request.method,b=a||po[g].res;this.client.core.relayer.publish(s,d,b)}await this.client.core.history.resolve(l)}),rt(this,"cleanup",async()=>{const n=[],i=[];this.client.session.getAll().forEach(s=>{let r=!1;yd(s.expiry)&&(r=!0),this.client.core.crypto.keychain.has(s.topic)||(r=!0),r&&n.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{yd(s.expiryTimestamp)&&i.push(s.id)}),await Promise.all([...n.map(s=>this.deleteSession({topic:s})),...i.map(s=>this.deleteProposal(s))])}),rt(this,"onProviderMessageEvent",async n=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(n):await this.onRelayMessage(n)}),rt(this,"onRelayEventRequest",async n=>{this.requestQueue.queue.push(n),await this.processRequestsQueue()}),rt(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===cd.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=cd.active;const n=this.requestQueue.queue.shift();if(n)try{await this.processRequest(n)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=cd.idle}),rt(this,"processRequest",async n=>{const{topic:i,payload:s,attestation:r,transportType:o,encryptedId:a}=n,c=s.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:s,attestation:r,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,s);case"wc_sessionPing":return await this.onSessionPingRequest(i,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:s,attestation:r,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(i,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:s,attestation:r,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),rt(this,"onRelayEventResponse",async n=>{const{topic:i,payload:s,transportType:r}=n,o=(await this.client.core.history.get(i,s.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(i,s,r);case"wc_sessionSettle":return this.onSessionSettleResponse(i,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,s);case"wc_sessionExtend":return this.onSessionExtendResponse(i,s);case"wc_sessionPing":return this.onSessionPingResponse(i,s);case"wc_sessionRequest":return this.onSessionRequestResponse(i,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,s);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),rt(this,"onRelayEventUnknownPayload",n=>{const{topic:i}=n,{message:s}=Ct("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)}),rt(this,"shouldIgnorePairingRequest",n=>{const{topic:i,requestMethod:s}=n,r=this.expectedPairingMethodMap.get(i);return!r||r.includes(s)?!1:!!(r.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),rt(this,"onSessionProposeRequest",async n=>{const{topic:i,payload:s,attestation:r,encryptedId:o}=n,{params:a,id:c}=s;try{const l=this.client.core.eventClient.getEvent({topic:i});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Mh.proposal_listener_not_found)),this.isValidConnect(Di({},s.params));const d=a.expiryTimestamp||yr(po.wc_sessionPropose.req.ttl),h=Di({id:c,pairingTopic:i,expiryTimestamp:d,attestation:r,encryptedId:o},a);await this.setProposal(c,h);const p=await this.getVerifyContext({attestationId:r,hash:Cl(JSON.stringify(s)),encryptedId:o,metadata:h.proposer.metadata});l==null||l.addTrace(dd.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:h,verifyContext:p})}catch(l){await this.sendError({id:c,topic:i,error:l,rpcOpts:po.wc_sessionPropose.autoReject}),this.client.logger.error(l)}}),rt(this,"onSessionProposeResponse",async(n,i,s)=>{const{id:r}=i;if(fd(i)){const{result:o}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const d=await this.client.core.crypto.generateSharedKey(c,l);this.pendingSessions.set(r,{sessionTopic:d,pairingTopic:n,proposalId:r,publicKey:c});const h=await this.client.core.relayer.subscribe(d,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:n})}else if(xl(i)){await this.deleteProposal(r);const o=Vi("session_connect",r);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:i.error})}}),rt(this,"onSessionSettleRequest",async(n,i)=>{const{id:s,params:r}=i;try{this.isValidSessionSettleRequest(r);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:d,scopedProperties:h,sessionConfig:p,proposalRequestsResponses:g}=i.params,b=[...this.pendingSessions.values()].find(E=>E.sessionTopic===n);if(!b)return this.client.logger.error(`Pending session not found for topic ${n}`);const w=this.client.proposal.get(b.proposalId),C=mo(Di(Di(Di({topic:n,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:b.pairingTopic,requiredNamespaces:w.requiredNamespaces,optionalNamespaces:w.optionalNamespaces,controller:a.publicKey,self:{publicKey:b.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},d&&{sessionProperties:d}),h&&{scopedProperties:h}),p&&{sessionConfig:p}),{transportType:gs.relay,authentication:g==null?void 0:g.authentication,walletPayResult:g==null?void 0:g.walletPay});await this.client.session.set(C.topic,C),await this.setExpiry(C.topic,C.expiry),await this.client.core.pairing.updateMetadata({topic:b.pairingTopic,metadata:C.peer.metadata}),this.pendingSessions.delete(b.proposalId),this.deleteProposal(b.proposalId,!1),this.cleanupDuplicatePairings(C),await this.sendResult({id:i.id,topic:n,throwOnFailedPublish:!0,result:!0}),this.client.events.emit("session_connect",{session:C}),this.events.emit(Vi("session_connect",b.proposalId),{session:C})}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),rt(this,"onSessionSettleResponse",async(n,i)=>{const{id:s}=i;fd(i)?(await this.client.session.update(n,{acknowledged:!0}),this.events.emit(Vi("session_approve",s),{})):xl(i)&&(await this.client.session.delete(n,As("USER_DISCONNECTED")),this.events.emit(Vi("session_approve",s),{error:i.error}))}),rt(this,"onSessionUpdateRequest",async(n,i)=>{const{params:s,id:r}=i;try{const o=`${n}_session_update`,a=Mv.get(o);if(a&&this.isRequestOutOfSync(a,r)){this.client.logger.warn(`Discarding out of sync request - ${r}`),this.sendError({id:r,topic:n,error:As("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Di({topic:n},s));try{Mv.set(o,r),await this.client.session.update(n,{namespaces:s.namespaces}),await this.sendResult({id:r,topic:n,result:!0})}catch(c){throw Mv.delete(o),c}this.client.events.emit("session_update",{id:r,topic:n,params:s})}catch(o){await this.sendError({id:r,topic:n,error:o}),this.client.logger.error(o)}}),rt(this,"isRequestOutOfSync",(n,i)=>i.toString().slice(0,-3)<n.toString().slice(0,-3)),rt(this,"onSessionUpdateResponse",(n,i)=>{const{id:s}=i,r=Vi("session_update",s);if(this.events.listenerCount(r)===0)throw new Error(`emitting ${r} without any listeners`);fd(i)?this.events.emit(Vi("session_update",s),{}):xl(i)&&this.events.emit(Vi("session_update",s),{error:i.error})}),rt(this,"onSessionExtendRequest",async(n,i)=>{const{id:s}=i;try{this.isValidExtend({topic:n}),await this.setExpiry(n,yr(Oy)),await this.sendResult({id:s,topic:n,result:!0}),this.client.events.emit("session_extend",{id:s,topic:n})}catch(r){await this.sendError({id:s,topic:n,error:r}),this.client.logger.error(r)}}),rt(this,"onSessionExtendResponse",(n,i)=>{const{id:s}=i,r=Vi("session_extend",s);if(this.events.listenerCount(r)===0)throw new Error(`emitting ${r} without any listeners`);fd(i)?this.events.emit(Vi("session_extend",s),{}):xl(i)&&this.events.emit(Vi("session_extend",s),{error:i.error})}),rt(this,"onSessionPingRequest",async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult({id:s,topic:n,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:n})}catch(r){await this.sendError({id:s,topic:n,error:r}),this.client.logger.error(r)}}),rt(this,"onSessionPingResponse",(n,i)=>{const{id:s}=i,r=Vi("session_ping",s);setTimeout(()=>{if(this.events.listenerCount(r)===0)throw new Error(`emitting ${r} without any listeners 2176`);fd(i)?this.events.emit(Vi("session_ping",s),{}):xl(i)&&this.events.emit(Vi("session_ping",s),{error:i.error})},500)}),rt(this,"onSessionDeleteRequest",async(n,i)=>{const{id:s}=i;try{await this.isValidDisconnect({topic:n,reason:i.params}),this.cleanupPendingSentRequestsForTopic({topic:n,error:As("USER_DISCONNECTED")}),await this.deleteSession({topic:n,id:s})}catch(r){this.client.logger.error(r)}}),rt(this,"onSessionRequest",async n=>{var i,s,r;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:d}=n,{id:h,params:p}=a;try{await this.isValidRequest(Di({topic:o},p));const g=this.client.session.get(o),b=await this.getVerifyContext({attestationId:c,hash:Cl(JSON.stringify(wu("wc_sessionRequest",p,h))),encryptedId:l,metadata:g.peer.metadata,transportType:d}),w={id:h,topic:o,params:p,verifyContext:b};await this.setPendingSessionRequest(w),d===gs.link_mode&&(i=g.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((s=g.peer.metadata.redirect)==null?void 0:s.universal),(r=this.client.signConfig)!=null&&r.disableRequestQueue?this.emitSessionRequest(w):(this.addSessionRequestToSessionRequestQueue(w),this.processSessionRequestQueue())}catch(g){await this.sendError({id:h,topic:o,error:g}),this.client.logger.error(g)}}),rt(this,"onSessionRequestResponse",(n,i)=>{const{id:s}=i,r=Vi("session_request",s);if(this.events.listenerCount(r)===0)throw new Error(`emitting ${r}
164 without any listeners`);fd(i)?this.events.emit(Vi("session_request",s),{result:i.result}):xl(i)&&this.events.emit(Vi("session_request",s),{error:i.error})}),rt(this,"onSessionEventRequest",async(n,i)=>{const{id:s,params:r}=i;try{const o=`${n}_session_event_${r.event.name}`,a=Mv.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(Di({topic:n},r)),this.client.events.emit("session_event",{id:s,topic:n,params:r}),Mv.set(o,s)}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),rt(this,"onSessionAuthenticateResponse",(n,i)=>{const{id:s}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:n,payload:i}),fd(i)?this.events.emit(Vi("session_request",s),{result:i.result}):xl(i)&&this.events.emit(Vi("session_request",s),{error:i.error})}),rt(this,"onSessionAuthenticateRequest",async n=>{var i;const{topic:s,payload:r,attestation:o,encryptedId:a,transportType:c}=n;try{const{requester:l,authPayload:d,expiryTimestamp:h}=r.params,p=await this.getVerifyContext({attestationId:o,hash:Cl(JSON.stringify(r)),encryptedId:a,metadata:l.metadata,transportType:c}),g={requester:l,pairingTopic:s,id:r.id,authPayload:d,verifyContext:p,expiryTimestamp:h};await this.setAuthRequest(r.id,{request:g,pairingTopic:s,transportType:c}),c===gs.link_mode&&(i=l.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:r.params,id:r.id,verifyContext:p})}catch(l){this.client.logger.error(l);const d=r.params.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(r.params.requester.metadata,c),g={type:af,receiverPublicKey:d,senderPublicKey:h};await this.sendError({id:r.id,topic:s,error:l,encodeOpts:g,rpcOpts:po.wc_sessionAuthenticate.autoReject,appLink:p})}}),rt(this,"addSessionRequestToSessionRequestQueue",n=>{this.sessionRequestQueue.queue.push(n)}),rt(this,"cleanupAfterResponse",n=>{this.deletePendingSessionRequest(n.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=cd.idle,this.processSessionRequestQueue()},wt.toMiliseconds(this.requestQueueDelay))}),rt(this,"cleanupPendingSentRequestsForTopic",({topic:n,error:i})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(r=>r.topic===n&&r.request.method==="wc_sessionRequest").forEach(r=>{this.events.emit(Vi("session_request",r.request.id),{error:i})})}),rt(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===cd.active){this.client.logger.info("session request queue is already active.");return}const n=this.sessionRequestQueue.queue[0];if(!n){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(n)}catch(i){this.client.logger.error(i)}}),rt(this,"emitSessionRequest",n=>{if(this.emittedSessionRequests.has(n.id)){this.client.logger.warn({id:n.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${n.id}`);return}this.sessionRequestQueue.state=cd.active,this.emittedSessionRequests.add(n.id),this.client.events.emit("session_request",n)}),rt(this,"onPairingCreated",n=>{if(n.methods&&this.expectedPairingMethodMap.set(n.topic,n.methods),n.active)return;const i=this.client.proposal.getAll().find(s=>s.pairingTopic===n.topic);
vendor: 17,375 bytes, line 164
164i&&this.onSessionProposeRequest({topic:n.topic,payload:wu("wc_sessionPropose",mo(Di({},i),{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties,scopedProperties:i.scopedProperties}),i.id),attestation:i.attestation,encryptedId:i.encryptedId})}),rt(this,"isValidConnect",async n=>{if(!Ba(n)){const{message:l}=Ct("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(n)}`);throw new Error(l)}const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:r,sessionProperties:o,scopedProperties:a,relays:c}=n;if(eo(i)||await this.isValidPairingTopic(i),!mPe(c)){const{message:l}=Ct("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(l)}if(s&&!eo(s)&&Td(s)!==0){const l="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(l):this.client.logger.warn(l),this.validateNamespaces(s,"requiredNamespaces")}if(r&&!eo(r)&&Td(r)!==0&&this.validateNamespaces(r,"optionalNamespaces"),o&&!eo(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!eo(a)){this.validateSessionProps(a,"scopedProperties");const l=Object.keys(s||{}).concat(Object.keys(r||{}));if(!Object.keys(a).every(d=>l.includes(d.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(l)}`)}}),rt(this,"validateNamespaces",(n,i)=>{const s=pPe(n,"connect()",i);if(s)throw new Error(s.message)}),rt(this,"isValidApprove",async n=>{if(!Ba(n))throw new Error(Ct("MISSING_OR_INVALID",`approve() params: ${n}`).message);const{id:i,namespaces:s,relayProtocol:r,sessionProperties:o,scopedProperties:a}=n;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const c=this.client.proposal.get(i),l=M7(s,"approve()");if(l)throw new Error(l.message);const d=Jq(c.requiredNamespaces,s,"approve()");if(d)throw new Error(d.message);if(!Cr(r,!0)){const{message:h}=Ct("MISSING_OR_INVALID",`approve() relayProtocol: ${r}`);throw new Error(h)}if(o&&!eo(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!eo(a)){this.validateSessionProps(a,"scopedProperties");const h=new Set(Object.keys(s));if(!Object.keys(a).every(p=>h.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(h).join(", ")}`)}}),rt(this,"isValidReject",async n=>{if(!Ba(n)){const{message:r}=Ct("MISSING_OR_INVALID",`reject() params: ${n}`);throw new Error(r)}const{id:i,reason:s}=n;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!yPe(s)){const{message:r}=Ct("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(r)}}),rt(this,"isValidSessionSettleRequest",n=>{if(!Ba(n)){const{message:l}=Ct("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${n}`);throw new Error(l)}const{relay:i,controller:s,namespaces:r,expiry:o}=n;if(!sse(i)){const{message:l}=Ct("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=cPe(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=M7(r,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(yd(o)){const{message:l}=Ct("EXPIRED","onSessionSettleRequest()");throw new Error(l)}}),rt(this,"isValidUpdate",async n=>{if(!Ba(n)){const{message:c}=Ct("MISSING_OR_INVALID",`update() params: ${n}`);throw new Error(c)}const{topic:i,namespaces:s}=n;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const r=this.client.session.get(i),o=M7(s,"update()");if(o)throw new Error(o.message);const a=Jq(r.requiredNamespaces,s,"update()");if(a)throw new Error(a.message)}),rt(this,"isValidExtend",async n=>{if(!Ba(n)){const{message:s}=Ct("MISSING_OR_INVALID",`extend() params: ${n}`);throw new Error(s)}const{topic:i}=n;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)}),rt(this,"isValidRequest",async n=>{if(!Ba(n)){const{message:c}=Ct("MISSING_OR_INVALID",`request() params: ${n}`);throw new Error(c)}const{topic:i,request:s,chainId:r,expiry:o}=n;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!Xq(a,r)){const{message:c}=Ct("MISSING_OR_INVALID",`request() chainId: ${r}`);throw new Error(c)}if(!bPe(s)){const{message:c}=Ct("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(c)}if(!CPe(a,r,s.method)){const{message:c}=Ct("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(c)}this.validateRequestExpiry(o)}),rt(this,"isValidRespond",async n=>{var i;if(!Ba(n)){const{message:a}=Ct("MISSING_OR_INVALID",`respond() params: ${n}`);throw new Error(a)}const{topic:s,response:r}=n;try{await this.isValidSessionTopic(s)}catch(a){throw(i=n==null?void 0:n.response)!=null&&i.id&&this.cleanupAfterResponse(n),a}if(!wPe(r)){const{message:a}=Ct("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(r)}`);throw new Error(a)}const o=this.client.pendingRequest.get(r.id);if(o.topic!==s){const{message:a}=Ct("MISMATCHED_TOPIC",`Request response topic mismatch. reqId: ${r.id}, expected topic: ${o.topic}, received topic: ${s}`);throw new Error(a)}}),rt(this,"isValidPing",async n=>{if(!Ba(n)){const{message:s}=Ct("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidSessionOrPairingTopic(i)}),rt(this,"isValidEmit",async n=>{if(!Ba(n)){const{message:a}=Ct("MISSING_OR_INVALID",`emit() params: ${n}`);throw new Error(a)}const{topic:i,event:s,chainId:r}=n;await this.isValidSessionTopic(i);const{namespaces:o}=this.client.session.get(i);if(!Xq(o,r)){const{message:a}=Ct("MISSING_OR_INVALID",`emit() chainId: ${r}`);throw new Error(a)}if(!vPe(s)){const{message:a}=Ct("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}if(!xPe(o,r,s.name)){const{message:a}=Ct("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}}),rt(this,"isValidDisconnect",async n=>{if(!Ba(n)){const{message:s}=Ct("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidSessionOrPairingTopic(i)}),rt(this,"isValidAuthenticate",n=>{const{chains:i,uri:s,domain:r,nonce:o}=n;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!Cr(s,!1))throw new Error("uri is required parameter");if(!Cr(r,!1))throw new Error("domain is required parameter");if(!Cr(o,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(c=>of(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=of(i[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),rt(this,"getVerifyContext",async n=>{const{attestationId:i,hash:s,encryptedId:r,metadata:o,transportType:a}=n,c={verified:{verifyUrl:o.verifyUrl||g3,validation:"UNKNOWN",origin:o.url||""}};try{if(a===gs.link_mode){const d=this.getAppLinkIfEnabled(o,a);return c.verified.validation=d&&new URL(d).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:i,hash:s,encryptedId:r,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),rt(this,"validateSessionProps",(n,i)=>{Object.values(n).forEach((s,r)=>{if(s==null){const{message:o}=Ct("MISSING_OR_INVALID",`${i} must contain an existing value for each key. Received: ${s} for key ${Object.keys(n)[r]}`);throw new Error(o)}})}),rt(this,"getPendingAuthRequest",n=>{const i=this.client.auth.requests.get(n);return typeof i=="object"?i:void 0}),rt(this,"addToRecentlyDeleted",(n,i)=>{if(this.recentlyDeletedMap.set(n,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const r=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(s++>=r)break;this.recentlyDeletedMap.delete(o)}}}),rt(this,"checkRecentlyDeleted",n=>{const i=this.recentlyDeletedMap.get(n);if(i){const{message:s}=Ct("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${n}`);throw new Error(s)}}),rt(this,"isLinkModeEnabled",(n,i)=>{var s,r,o,a,c,l,d,h,p;return!n||i!==gs.link_mode?!1:((r=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:r.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((d=n==null?void 0:n.redirect)==null?void 0:d.universal)!==void 0&&((h=n==null?void 0:n.redirect)==null?void 0:h.universal)!==""&&((p=n==null?void 0:n.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(n.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"}),rt(this,"getAppLinkIfEnabled",(n,i)=>{var s;return this.isLinkModeEnabled(n,i)?(s=n==null?void 0:n.redirect)==null?void 0:s.universal:void 0}),rt(this,"handleLinkModeMessage",({url:n})=>{if(!n||!n.includes("wc_ev")||!n.includes("topic"))return;const i=uq(n,"topic")||"",s=decodeURIComponent(uq(n,"wc_ev")||""),r=this.client.session.keys.includes(i);r&&this.client.session.update(i,{transportType:gs.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:s,sessionExists:r})}),rt(this,"registerLinkModeListeners",async()=>{var n;if(aM()||jp()&&(n=this.client.metadata.redirect)!=null&&n.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await i.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}),rt(this,"getTVFApproveParams",n=>{try{const i=nse(n.namespaces),s=YRe(n.namespaces),r=ZRe(n.namespaces),o=n.sessionProperties,a=n.scopedProperties;return{approvedChains:i,approvedMethods:s,approvedEvents:r,sessionProperties:o,scopedProperties:a}}catch(i){return this.client.logger.warn(i,"Error getting TVF approve params"),{}}}),rt(this,"getTVFParams",(n,i,s)=>{var r,o,a;if(!((r=i.request)!=null&&r.method))return{};const c={correlationId:n,rpcMethods:[i.request.method],chainId:i.chainId};try{const l=this.extractTxHashesFromResult(i.request,s);c.txHashes=l,c.contractAddresses=this.isValidContractData(i.request.params)?[(a=(o=i.request.params)==null?void 0:o[0])==null?void 0:a.to]:[]}catch(l){this.client.logger.warn(l,"Error getting TVF params")}return c}),rt(this,"isValidContractData",n=>{var i;if(!n)return!1;try{const s=(n==null?void 0:n.data)||((i=n==null?void 0:n[0])==null?void 0:i.data);if(!s.startsWith("0x"))return!1;const r=s.slice(2);return/^[0-9a-fA-F]*$/.test(r)?r.length%2===0:!1}catch{}return!1}),rt(this,"extractTxHashesFromResult",(n,i)=>{var s;try{if(!i)return[];const r=n.method,o=QMe[r];if(r==="sui_signTransaction")return[Uke(i.transactionBytes)];if(r==="near_signTransaction")return[bq(i)];if(r==="near_signTransactions")return i.map(c=>bq(c));if(r==="xrpl_signTransactionFor"||r==="xrpl_signTransaction")return[(s=i.tx_json)==null?void 0:s.hash];if(r==="polkadot_signTransaction")return[FPe({transaction:n.params.transactionPayload,signature:i.signature})];if(r==="algo_signTxn")return cf(i)?i.map(c=>wq(c)):[wq(i)];if(r==="cosmos_signDirect")return[Fke(i)];if(r==="wallet_sendCalls")return jke(i);if(typeof i=="string")return[i];const a=i[o.key];if(cf(a))return r==="solana_signAllTransactions"?a.map(c=>$ke(c)):a;if(typeof a=="string")return[a]}catch(r){this.client.logger.warn(r,"Error extracting tx hashes from result")}return[]})}async processPendingMessageEvents(){try{const e=this.client.session.keys,n=this.client.core.relayer.messages.getWithoutAck(e);for(const[i,s]of Object.entries(n))for(const r of s)try{await this.onProviderMessageEvent({topic:i,message:r,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${i}, message: ${r}`)}}catch(e){this.client.logger.warn(e,"processPendingMessageEvents failed")}}isInitialized(){if(!this.initialized){const{message:e}=Ct("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(wr.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){const{topic:n,message:i,attestation:s,transportType:r}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(yE)?this.client.auth.authKeys.get(yE):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(n,i,{receiverPublicKey:o,encoding:r===gs.link_mode?H0:qa});vM(a)?(this.client.core.history.set(n,a),await this.onRelayEventRequest({topic:n,payload:a,attestation:s,transportType:r,encryptedId:Cl(i)})):ES(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:n,payload:a,transportType:r}),this.client.core.history.delete(n,a.id)):(this.client.logger.error(`onRelayMessage() -> unknown payload: ${JSON.stringify(a)}`),await this.onRelayEventUnknownPayload({topic:n,payload:a,transportType:r})),await this.client.core.relayer.messages.ack(n,i)}catch(a){this.client.logger.error(`onRelayMessage() -> failed to process an inbound message: ${i}`),this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(bl.expired,async e=>{const{topic:n,id:i}=iie(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,Ct("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,Ct("EXPIRED"),!0);n?this.client.session.keys.includes(n)&&(await this.deleteSession({topic:n,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:n})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(Dm.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Dm.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!Cr(e,!1)){const{message:n}=Ct("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(n)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:n}=Ct("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(n)}if(yd(this.client.core.pairing.pairings.get(e).expiry)){const{message:n}=Ct("EXPIRED",`pairing topic: ${e}`);throw new Error(n)}}async isValidSessionTopic(e){if(!Cr(e,!1)){const{message:n}=Ct("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(n)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:n}=Ct("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(n)}if(yd(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:n}=Ct("EXPIRED",`session topic: ${e}`);throw new Error(n)}if(!this.client.core.crypto.keychain.has(e)){const{message:n}=Ct("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(n)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(Cr(e,!1)){const{message:n}=Ct("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(n)}else{const{message:n}=Ct("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(n)}}async isValidProposalId(e){if(!gPe(e)){const{message:n}=Ct("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(n)}if(!this.client.proposal.keys.includes(e)){const{message:n}=Ct("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(n)}if(yd(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:n}=Ct("EXPIRED",`proposal id: ${e}`);throw new Error(n)}}validateRequestExpiry(e){if(e&&!SPe(e,V7)){const{message:n}=Ct("MISSING_OR_INVALID",`request() expiry: ${e}. Expiry must be a number (in seconds) between ${V7.min} and ${V7.max}`);throw new Error(n)}}},dLe=class extends S1{constructor(e,n){super(e,n,KMe,xM),this.core=e,this.logger=n}},hLe=class extends S1{constructor(e,n){super(e,n,YMe,xM),this.core=e,this.logger=n}},fLe=class extends S1{constructor(e,n){super(e,n,XMe,xM,i=>i.id),this.core=e,this.logger=n}},pLe=class extends S1{constructor(e,n){super(e,n,nLe,SS,()=>yE),this.core=e,this.logger=n}},mLe=class extends S1{constructor(e,n){super(e,n,iLe,SS),this.core=e,this.logger=n}},gLe=class extends S1{constructor(e,n){super(e,n,sLe,SS,i=>i.id),this.core=e,this.logger=n}};var yLe=Object.defineProperty,bLe=(t,e,n)=>e in t?yLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,W7=(t,e,n)=>bLe(t,typeof e!="symbol"?e+"":e,n);let wLe=class{constructor(e,n){this.core=e,this.logger=n,W7(this,"authKeys"),W7(this,"pairingTopics"),W7(this,"requests"),this.authKeys=new pLe(this.core,this.logger),this.pairingTopics=new mLe(this.core,this.logger),this.requests=new gLe(this.core,this.logger)}
164async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}};var vLe=Object.defineProperty,CLe=(t,e,n)=>e in t?vLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pi=(t,e,n)=>CLe(t,typeof e!="symbol"?e+"":e,n);class EM extends __e{constructor(e){super(e),pi(this,"protocol",Tse),pi(this,"version",kse),pi(this,"name",j7.name),pi(this,"metadata"),pi(this,"core"),pi(this,"logger"),pi(this,"events",new Ul.EventEmitter),pi(this,"engine"),pi(this,"session"),pi(this,"proposal"),pi(this,"pendingRequest"),pi(this,"auth"),pi(this,"signConfig"),pi(this,"on",(i,s)=>this.events.on(i,s)),pi(this,"once",(i,s)=>this.events.once(i,s)),pi(this,"off",(i,s)=>this.events.off(i,s)),pi(this,"removeListener",(i,s)=>this.events.removeListener(i,s)),pi(this,"removeAllListeners",i=>this.events.removeAllListeners(i)),pi(this,"connect",async i=>{try{return await this.engine.connect(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"pair",async i=>{try{return await this.engine.pair(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"approve",async i=>{try{return await this.engine.approve(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"reject",async i=>{try{return await this.engine.reject(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"update",async i=>{try{return await this.engine.update(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"extend",async i=>{try{return await this.engine.extend(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"request",async i=>{try{return await this.engine.request(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"respond",async i=>{try{return await this.engine.respond(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"ping",async i=>{try{return await this.engine.ping(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"emit",async i=>{try{return await this.engine.emit(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"disconnect",async i=>{try{return await this.engine.disconnect(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"find",i=>{try{return this.engine.find(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}}),pi(this,"authenticate",async(i,s)=>{try{return await this.engine.authenticate(i,s)}catch(r){throw this.logger.error(r.message),r}}),pi(this,"formatAuthMessage",i=>{try{return this.engine.formatAuthMessage(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"approveSessionAuthenticate",async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(s){throw this.logger.error(s.message),s}}),pi(this,"rejectSessionAuthenticate",async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(s){throw this.logger.error(s.message),s}}),this.name=(e==null?void 0:e.name)||j7.name,this.metadata=R7e(e==null?void 0:e.metadata),this.signConfig=e==null?void 0:e.signConfig;const n=bM({logger:(e==null?void 0:e.logger)||j7.logger,name:this.name});this.logger=n,this.core=(e==null?void 0:e.core)||new GMe(e),this.session=new hLe(this.core,this.logger),this.proposal=new dLe(this.core,this.logger),this.pendingRequest=new fLe(this.core,this.logger),this.engine=new uLe(this),this.auth=new wLe(this.core,this.logger)}static async init(e){const n=new EM(e);return await n.initialize(),n}get context(){return oc(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const xLe=EM;var bx={exports:{}},$z;function ELe(){return $z||($z=1,(function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof yu<"u"&&yu,i=(function(){function r(){this.fetch=!1,this.DOMException=n.DOMException}return r.prototype=n,new r})();(function(r){(function(o){var a=typeof r<"u"&&r||typeof self<"u"&&self||typeof yu<"u"&&yu||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(v){return v&&DataView.prototype.isPrototypeOf(v)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array
164]"],h=ArrayBuffer.isView||function(v){return v&&d.indexOf(Object.prototype.toString.call(v))>-1};function p(v){if(typeof v!="string"&&(v=String(v)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(v)||v==="")throw new TypeError('Invalid character in header field name: "'+v+'"');return v.toLowerCase()}function g(v){return typeof v!="string"&&(v=String(v)),v}function b(v){var _={next:function(){var N=v.shift();return{done:N===void 0,value:N}}};return c.iterable&&(_[Symbol.iterator]=function(){return _}),_}function w(v){this.map={},v instanceof w?v.forEach(function(_,N){this.append(N,_)},this):Array.isArray(v)?v.forEach(function(_){if(_.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+_.length);this.append(_[0],_[1])},this):v&&Object.getOwnPropertyNames(v).forEach(function(_){this.append(_,v[_])},this)}w.prototype.append=function(v,_){v=p(v),_=g(_);var N=this.map[v];this.map[v]=N?N+", "+_:_},w.prototype.delete=function(v){delete this.map[p(v)]},w.prototype.get=function(v){return v=p(v),this.has(v)?this.map[v]:null},w.prototype.has=function(v){return this.map.hasOwnProperty(p(v))},w.prototype.set=function(v,_){this.map[p(v)]=g(_)},w.prototype.forEach=function(v,_){for(var N in this.map)this.map.hasOwnProperty(N)&&v.call(_,this.map[N],N,this)},w.prototype.keys=function(){var v=[];return this.forEach(function(_,N){v.push(N)}),b(v)},w.prototype.values=function(){var v=[];return this.forEach(function(_){v.push(_)}),b(v)},w.prototype.entries=function(){var v=[];return this.forEach(function(_,N){v.push([N,_])}),b(v)},c.iterable&&(w.prototype[Symbol.iterator]=w.prototype.entries);function C(v){if(!v._noBody){if(v.bodyUsed)return Promise.reject(new TypeError("Already read"));v.bodyUsed=!0}}function E(v){return new Promise(function(_,N){v.onload=function(){_(v.result)},v.onerror=function(){N(v.error)}})}function T(v){var _=new FileReader,N=E(_);return _.readAsArrayBuffer(v),N}function A(v){var _=new FileReader,N=E(_),$=/charset=([A-Za-z0-9_-]+)/.exec(v.type),U=$?$[1]:"utf-8";return _.readAsText(v,U),N}function k(v){for(var _=new Uint8Array(v),N=new Array(_.length),$=0;$<_.length;$++)N[$]=String.fromCharCode(_[$]);return N.join("")}function R(v){if(v.slice)return v.slice(0);var _=new Uint8Array(v.byteLength);return _.set(new Uint8Array(v)),_.buffer}function P(){return this.bodyUsed=!1,this._initBody=function(v){this.bodyUsed=this.bodyUsed,this._bodyInit=v,v?typeof v=="string"?this._bodyText=v:c.blob&&Blob.prototype.isPrototypeOf(v)?this._bodyBlob=v:c.formData&&FormData.prototype.isPrototypeOf(v)?this._bodyFormData=v:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(v)?this._bodyText=v.toString():c.arrayBuffer&&c.blob&&l(v)?(this._bodyArrayBuffer=R(v.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(v)||h(v))?this._bodyArrayBuffer=R(v):this._bodyText=v=Object.prototype.toString.call(v):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof v=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(v)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var v=C(this);if(v)return v;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var v=C(this);return v||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(T);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var v=C(this);if(v)return v;if(this._bodyBlob)return A(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(k(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(K)}),this.json=function(){return this.text().then(JSON.parse)},this}var B=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(v){var _=v.toUpperCase();return B.indexOf(_)>-1?_:v}function z(v,_){if(!(this instanceof z))throw new TypeError('Please use the "new" operator, this DOM object c
164onstructor cannot be called as a function.');_=_||{};var N=_.body;if(v instanceof z){if(v.bodyUsed)throw new TypeError("Already read");this.url=v.url,this.credentials=v.credentials,_.headers||(this.headers=new w(v.headers)),this.method=v.method,this.mode=v.mode,this.signal=v.signal,!N&&v._bodyInit!=null&&(N=v._bodyInit,v.bodyUsed=!0)}else this.url=String(v);if(this.credentials=_.credentials||this.credentials||"same-origin",(_.headers||!this.headers)&&(this.headers=new w(_.headers)),this.method=F(_.method||this.method||"GET"),this.mode=_.mode||this.mode||null,this.signal=_.signal||this.signal||(function(){if("AbortController"in a){var j=new AbortController;return j.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&N)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(N),(this.method==="GET"||this.method==="HEAD")&&(_.cache==="no-store"||_.cache==="no-cache")){var $=/([?&])_=[^&]*/;if($.test(this.url))this.url=this.url.replace($,"$1_="+new Date().getTime());else{var U=/\?/;this.url+=(U.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}z.prototype.clone=function(){return new z(this,{body:this._bodyInit})};function K(v){var _=new FormData;return v.trim().split("&").forEach(function(N){if(N){var $=N.split("="),U=$.shift().replace(/\+/g," "),j=$.join("=").replace(/\+/g," ");_.append(decodeURIComponent(U),decodeURIComponent(j))}}),_}function q(v){var _=new w,N=v.replace(/\r?\n[\t ]+/g," ");return N.split("\r").map(function($){return $.indexOf(` 165`)===0?$.substr(1,$.length):$}
vendor: 5,909 bytes, line 165
165).forEach(function($){var U=$.split(":"),j=U.shift().trim();if(j){var D=U.join(":").trim();try{_.append(j,D)}catch(O){console.warn("Response "+O.message)}}}),_}P.call(z.prototype);function G(v,_){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(_||(_={}),this.type="default",this.status=_.status===void 0?200:_.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=_.statusText===void 0?"":""+_.statusText,this.headers=new w(_.headers),this.url=_.url||"",this._initBody(v)}P.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new w(this.headers),url:this.url})},G.error=function(){var v=new G(null,{status:200,statusText:""});return v.ok=!1,v.status=0,v.type="error",v};var I=[301,302,303,307,308];G.redirect=function(v,_){if(I.indexOf(_)===-1)throw new RangeError("Invalid status code");return new G(null,{status:_,headers:{location:v}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(_,N){this.message=_,this.name=N;var $=Error(_);this.stack=$.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function S(v,_){return new Promise(function(N,$){var U=new z(v,_);if(U.signal&&U.signal.aborted)return $(new o.DOMException("Aborted","AbortError"));var j=new XMLHttpRequest;function D(){j.abort()}j.onload=function(){var J={statusText:j.statusText,headers:q(j.getAllResponseHeaders()||"")};U.url.indexOf("file://")===0&&(j.status<200||j.status>599)?J.status=200:J.status=j.status,J.url="responseURL"in j?j.responseURL:J.headers.get("X-Request-URL");var W="response"in j?j.response:j.responseText;setTimeout(function(){N(new G(W,J))},0)},j.onerror=function(){setTimeout(function(){$(new TypeError("Network request failed"))},0)},j.ontimeout=function(){setTimeout(function(){$(new TypeError("Network request timed out"))},0)},j.onabort=function(){setTimeout(function(){$(new o.DOMException("Aborted","AbortError"))},0)};function O(J){try{return J===""&&a.location.href?a.location.href:J}catch{return J}}if(j.open(U.method,O(U.url),!0),U.credentials==="include"?j.withCredentials=!0:U.credentials==="omit"&&(j.withCredentials=!1),"responseType"in j&&(c.blob?j.responseType="blob":c.arrayBuffer&&(j.responseType="arraybuffer")),_&&typeof _.headers=="object"&&!(_.headers instanceof w||a.Headers&&_.headers instanceof a.Headers)){var H=[];Object.getOwnPropertyNames(_.headers).forEach(function(J){H.push(p(J)),j.setRequestHeader(J,g(_.headers[J]))}),U.headers.forEach(function(J,W){H.indexOf(W)===-1&&j.setRequestHeader(W,J)})}else U.headers.forEach(function(J,W){j.setRequestHeader(W,J)});U.signal&&(U.signal.addEventListener("abort",D),j.onreadystatechange=function(){j.readyState===4&&U.signal.removeEventListener("abort",D)}),j.send(typeof U._bodyInit>"u"?null:U._bodyInit)})}return S.polyfill=!0,a.fetch||(a.fetch=S,a.Headers=w,a.Request=z,a.Response=G),o.Headers=w,o.Request=z,o.Response=G,o.fetch=S,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var s=n.fetch?n:i;e=s.fetch,e.default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,t.exports=e})(bx,bx.exports)),bx.exports}var _Le=ELe();const Uz=ya(_Le);var SLe=Object.defineProperty,ALe=Object.defineProperties,TLe=Object.getOwnPropertyDescriptors,Bz=Object.getOwnPropertySymbols,kLe=Object.prototype.hasOwnProperty,NLe=Object.prototype.propertyIsEnumerable,Fz=(t,e,n)=>e in t?SLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jz=(t,e)=>{for(var n in e||(e={}))kLe.call(e,n)&&Fz(t,n,e[n]);if(Bz)for(var n of Bz(e))NLe.call(e,n)&&Fz(t,n,e[n]);return t},Vz=(t,e)=>ALe(t,TLe(e));const RLe={Accept:"application/json","Content-Type":"application/json"},PLe="POST",Wz={headers:RLe,method:PLe},qz=10;let Rse=class{constructor(e,n=!1){if(this.url=e,this.disableProviderPing=n,this.events=new Ul.EventEmitter,this.isAvailable=!1,this.registering=!1,!oz(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=n}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const n=xf(e),i=await(await Uz(this.url,Vz(jz({},Wz),{body:n}))).json();this.onPayload({data:i})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!oz(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const n=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=n||this.events.listenerCount("open")>=n)&&this.events.setMaxListeners(n+1),new Promise((i,s)=>{this.events.once("register_error",r=>{this.resetMaxListeners(),s(r)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const n=xf({id:1,jsonrpc:"2.0",method:"test",params:[]});await Uz(e,Vz(jz({},Wz),{body:n}))}this.onOpen()}catch(n){const i=this.parseError(n);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;
165const n=typeof e.data=="string"?Dg(e.data):e.data;this.events.emit("payload",n)}onError(e,n){const i=this.parseError(n),s=i.message||i.toString(),r=xS(e,s);this.events.emit("payload",r)}parseError(e,n=this.url){return ase(e,n,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>qz&&this.events.setMaxListeners(qz)}};function _M(t){return t==null||typeof t!="object"&&typeof t!="function"}function Pse(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Ise(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const ILe="[object RegExp]",Dse="[object String]",Ose="[object Number]",Mse="[object Boolean]",Lse="[object Arguments]",DLe="[object Symbol]",OLe="[object Date]",MLe="[object Map]",LLe="[object Set]",$Le="[object Array]",ULe="[object ArrayBuffer]",BLe="[object Object]",FLe="[object DataView]",jLe="[object Uint8Array]",VLe="[object Uint8ClampedArray]",WLe="[object Uint16Array]",qLe="[object Uint32Array]",zLe="[object Int8Array]",HLe="[object Int16Array]",GLe="[object Int32Array]",KLe="[object Float32Array]",YLe="[object Float64Array]";function SM(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ZLe(t,e){return o2(t,void 0,t,new Map,e)}function o2(t,e,n,i=new Map,s=void 0){const r=s==null?void 0:s(t,e,n,i);if(r!=null)return r;if(_M(t))return t;if(i.has(t))return i.get(t);if(Array.isArray(t)){const o=new Array(t.length);i.set(t,o);for(let a=0;a<t.length;a++)o[a]=o2(t[a],a,n,i,s);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;i.set(t,o);for(const[a,c]of t)o.set(a,o2(c,a,n,i,s));return o}if(t instanceof Set){const o=new Set;i.set(t,o);for(const a of t)o.add(o2(a,void 0,n,i,s));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(t))return t.subarray();if(SM(t)){const o=new(Object.getPrototypeOf(t)).constructor(t.length);i.set(t,o);for(let a=0;a<t.length;a++)o[a]=o2(t[a],a,n,i,s);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return i.set(t,o),Om(o,t,n,i,s),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return i.set(t,o),Om(o,t,n,i,s),o}if(t instanceof Blob){const o=new Blob([t],{type:t.type});return i.set(t,o),Om(o,t,n,i,s),o}if(t instanceof Error){const o=new t.constructor;return i.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,Om(o,t,n,i,s),o}if(typeof t=="object"&&QLe(t)){const o=Object.create(Object.getPrototypeOf(t));return i.set(t,o),Om(o,t,n,i,s),o}return t}function Om(t,e,n=t,i,s){const r=[...Object.keys(e),...Pse(e)];for(let o=0;o<r.length;o++){const a=r[o],c=Object.getOwnPropertyDescriptor(t,a);(c==null||c.writable)&&(t[a]=o2(e[a],a,n,i,s))}}function QLe(t){switch(Ise(t)){case Lse:case $Le:case ULe:case FLe:case Mse:case OLe:case KLe:case YLe:case zLe:case HLe:case GLe:case MLe:case Ose:case BLe:case ILe:case LLe:case Dse:case DLe:case jLe:case VLe:case WLe:case qLe:return!0;default:return!1}}function XLe(t,e){return ZLe(t,(n,i,s,r)=>{if(typeof t=="object")switch(Object.prototype.toString.call(t)){case Ose:case Dse:case Mse:{const o=new t.constructor(t==null?void 0:t.valueOf());return Om(o,t),o}case Lse:{const o={};return Om(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}})}function zz(t){return XLe(t)}function Hz(t){return t!==null&&typeof t=="object"&&Ise(t)==="[object Arguments]"}function Gz(t){return typeof t=="object"&&t!==null}function JLe(){}function e$e(t){return SM(t)}function t$e(t){var n;if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(Object.prototype.toString.call(t)!=="[object Object]"){const i=t[Symbol.toStringTag];return i==null||!((n=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag))!=null&&n.writable)?!1:t.toString()===`[object ${i}]`}let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function n$e(t){if(_M(t))return t;if(Array.isArray(t)||SM(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t),n=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new n(t);if(t instanceof RegExp){const i=new n(t);return i.lastIndex=t.lastIndex,i}if(t instanceof DataView)return new n(t.buffer.slice(0));if(t instanceof Error){const i=new n(t.message);return i.stack=t.stack,i.name=t.name,i.cause=t.cause,i}if(typeof File<"u"&&t instanceof File)return new n([t],t.name,{type:t.type,lastModified:t.lastModified});if(typeof t=="object"){const i=Object.create(e);return Object.assign(i,t)}return t}function i$e(t,...e){const n=e.slice(0,-1),i=e[e.length-1];let s=t;for(let r=0;r<n.length;r++){const o=n[r];s=nI(s,o,i,new Map)}return s}function nI(t,e,n,i){if(_M(t)&&(t=Object(t)),e==null||typeof e!="object")return t;if(i.has(e))return n$e(i.get(e));if(i.set(e,t),Array.isArray(e)){e=e.slice();for(let r=0;r<e.length;r++)e[r]=e[r]??void 0}const s=[...Object.keys(e),...Pse(e)];for(let r=0;r<s.length;r++){const o=s[r];let a=e[o],c=t[o];if(Hz(a)&&(a={...a}),Hz(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=zz(a)),Array.isArray(a))if(typeof c=="object"&&c!=null){const d=[],h=Reflect.ownKeys(c);for(let p=0;p<h.length;p++){const g=h[p];d[g]=c[g]}c=d}else c=[];const l=n(c,a,o,t,e,i);l!=null?t[o]=l:Array.isArray(a)||Gz(c)&&Gz(a)?t[o]=nI(c,a,n,i):c==null&&t$e(a)?t[o]=nI({},a,n,i):c==null&&e$e(a)?t[o]=zz(a):(c===void 0||a!==void 0)&&(t[o]=a)}return t}function s$e(t,...e){return i$e(t,...e,JLe)}const Kz="error",r$e="wss://relay.walletconnect.org",o$e="wc",$se="universal_provider",wx=`${o$e}@2:${$se}:`,Use="https://rpc.walletconnect.org/v1/",Bse="generic",a$e=`${Use}bundler`,E2="call_status",c$e=86400,AM={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var l$e=Object.defineProperty,u$e=Object.defineProperties,d$e=Object.getOwnPropertyDescriptors,Yz=Object.getOwnPropertySymbols,h$e=Object.prototype.hasOwnProperty,f$e=Object.prototype.propertyIsEnumerable,Zz=(t,e,n)=>e in t?l$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vx=(t,e)=>{for(var n in e||(e={}))h$e.call(e,n)&&Zz(t,n,e[n]);if(Yz)for(var n of Yz(e))f$e.call(e,n)&&Zz(t,n,e[n]);return t},p$e=(t,e)=>u$e(t,d$e(e));function Fse(t,e,n){var i;const s=of(t);return((i=e.rpcMap)==null?void 0:i[s.reference])||`${Use}?chainId=${s.namespace}:${s.reference}&projectId=${n}`}function m$e(t){return t.includes(":")?t.split(":")[1]:t}function jse(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function g$e(t,e){const n=Object.keys(e.namespaces).filter(s=>s.includes(t));if(!n.length)return[];const i=[];
vendor: 10,319 bytes, line 165
165return n.forEach(s=>{const r=e.namespaces[s].accounts;i.push(...r)}),i}function Qz(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>{var i,s;return((i=n==null?void 0:n.chains)==null?void 0:i.length)&&((s=n==null?void 0:n.chains)==null?void 0:s.length)>0}))}function Cx(t={},e={}){const n=Qz(Xz(t)),i=Qz(Xz(e));return s$e(n,i)}function Xz(t){var e,n,i,s,r;const o={};if(!Td(t))return o;for(const[a,c]of Object.entries(t)){const l=CS(a)?[a]:c.chains,d=c.methods||[],h=c.events||[],p=c.rpcMap||{},g=r2(a);o[g]=p$e(vx(vx({},o[g]),c),{chains:Ad(l,(e=o[g])==null?void 0:e.chains),methods:Ad(d,(n=o[g])==null?void 0:n.methods),events:Ad(h,(i=o[g])==null?void 0:i.events)}),(Td(p)||Td(((s=o[g])==null?void 0:s.rpcMap)||{}))&&(o[g].rpcMap=vx(vx({},p),(r=o[g])==null?void 0:r.rpcMap))}return o}function Jz(t){return t.includes(":")?t.split(":")[2]:t}function eH(t){const e={};for(const[n,i]of Object.entries(t)){const s=i.methods||[],r=i.events||[],o=i.accounts||[],a=CS(n)?[n]:i.chains?i.chains:jse(i.accounts);e[n]={chains:a,methods:s,events:r,accounts:o}}return e}function q7(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}function y$e(t){try{const e=JSON.parse(t);return typeof e=="object"&&e!==null&&!Array.isArray(e)}catch{return!1}}const Vse={},_2=t=>Vse[t],z7=(t,e)=>{Vse[t]=e};var b$e=Object.defineProperty,tH=Object.getOwnPropertySymbols,w$e=Object.prototype.hasOwnProperty,v$e=Object.prototype.propertyIsEnumerable,nH=(t,e,n)=>e in t?b$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,iH=(t,e)=>{for(var n in e||(e={}))w$e.call(e,n)&&nH(t,n,e[n]);if(tH)for(var n of tH(e))v$e.call(e,n)&&nH(t,n,e[n]);return t};const sH="eip155",C$e=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],x$e=t=>t&&t.startsWith("0x")?BigInt(t).toString(10):t,H7=t=>t&&t.startsWith("0x")?t:`0x${BigInt(t).toString(16)}`,rH=t=>Object.keys(t).filter(e=>C$e.includes(e)).reduce((e,n)=>(e[n]=E$e(t[n]),e),{}),E$e=t=>typeof t=="string"&&y$e(t)?JSON.parse(t):t,_$e=(t,e,n)=>{const{sessionProperties:i={},scopedProperties:s={}}=t,r={};if(!Td(s)&&!Td(i))return;const o=rH(i);for(const a of n){const c=x$e(a);if(!c)continue;r[H7(c)]=o;const l=s==null?void 0:s[`${sH}:${c}`];if(l){const d=l==null?void 0:l[`${sH}:${c}:${e}`];r[H7(c)]=iH(iH({},r[H7(c)]),rH(d||l))}}for(const[a,c]of Object.entries(r))Object.keys(c).length===0&&delete r[a];return Object.keys(r).length>0?r:void 0};var S$e=Object.defineProperty,A$e=(t,e,n)=>e in t?S$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T$e=(t,e,n)=>A$e(t,e+"",n);let G7,k$e=class Wse{constructor(e){T$e(this,"storage"),this.storage=e}async getItem(e){return await this.storage.getItem(e)}async setItem(e,n){return await this.storage.setItem(e,n)}async removeItem(e){return await this.storage.removeItem(e)}static getStorage(e){return G7||(G7=new Wse(e)),G7}};var N$e=Object.defineProperty,R$e=Object.defineProperties,P$e=Object.getOwnPropertyDescriptors,oH=Object.getOwnPropertySymbols,I$e=Object.prototype.hasOwnProperty,D$e=Object.prototype.propertyIsEnumerable,aH=(t,e,n)=>e in t?N$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,O$e=(t,e)=>{for(var n in e||(e={}))I$e.call(e,n)&&aH(t,n,e[n]);if(oH)for(var n of oH(e))D$e.call(e,n)&&aH(t,n,e[n]);return t},M$e=(t,e)=>R$e(t,P$e(e));async function L$e(t,e){const n=of(t.result.capabilities.caip345.caip2),i=t.result.capabilities.caip345.transactionHashes,s=await Promise.allSettled(i.map(h=>$$e(n.reference,h,e))),r=s.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);s.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const o=!r.length||r.some(h=>!h),a=r.every(h=>(h==null?void 0:h.status)==="0x1"),c=r.every(h=>(h==null?void 0:h.status)==="0x0"),l=r.some(h=>(h==null?void 0:h.status)==="0x0");let d;return o?d=100:a?d=200:c?d=500:l&&(d=600),{id:t.result.id,version:t.request.version,atomic:t.request.atomicRequired,chainId:t.request.chainId,capabilities:t.result.capabilities,receipts:r,status:d}}async function $$e(t,e,n){return await n(parseInt(t)).request(wu("eth_getTransactionReceipt",[e]))}async function U$e({sendCalls:t,storage:e}){const n=await e.getItem(E2);await e.setItem(E2,M$e(O$e({},n),{[t.result.id]:{request:t.request,result:t.result,expiry:yr(c$e)}}))}async function B$e({resultId:t,storage:e}){const n=await e.getItem(E2);if(n){delete n[t],await e.setItem(E2,n);for(const i in n)yd(n[i].expiry)&&delete n[i];await e.setItem(E2,n)}}async function F$e({resultId:t,storage:e}){const n=await e.getItem(E2),i=n==null?void 0:n[t];if(i&&!yd(i.expiry))return i;await B$e({resultId:t,storage:e})}var j$e=Object.defineProperty,V$e=Object.defineProperties,W$e=Object.getOwnPropertyDescriptors,cH=Object.getOwnPropertySymbols,q$e=Object.prototype.hasOwnProperty,z$e=Object.prototype.propertyIsEnumerable,iI=(t,e,n)=>e in t?j$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,K7=(t,e)=>{for(var n in e||(e={}))q$e.call(e,n)&&iI(t,n,e[n]);if(cH)for(var n of cH(e))z$e.call(e,n)&&iI(t,n,e[n]);return t},Y7=(t,e)=>V$e(t,W$e(e)),bm=(t,e,n)=>iI(t,typeof e!="symbol"?e+"":e,n);let H$e=class{constructor(e){bm(this,"name","eip155"),bm(this,"client"),bm(this,"chainId"),bm(this,"namespace"),bm(this,"httpProviders"),bm(this,"events"),bm(this,"storage"),this.namespace=e.namespace,this.events=_2("events"),this.client=_2("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=k$e.getStorage(this.client.core.storage)}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e);case"wallet_sendCalls":return await this.sendCalls(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,n){this.httpProviders[e]||this.setHttpProvider(parseInt(e),n);const i=this.chainId;this.chainId=parseInt(e),this.events.emit(AM.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${i}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,n){const i=n||Fse(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new CM(new Rse(i,_2("disableProviderPing")))}setHttpProvider(e,n){const i=this.createHttpProvider(e,n);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(n=>{var i;const s=parseInt(m$e(n));e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[n])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}getHttpProvider(e){const n=e||this.chainId;return this.httpProviders[n]||(this.httpProviders=Y7(K7({},this.httpProviders),{[n]:this.createHttpProvider(n)}),this.httpProviders[n])}async handleSwitchChain(e){var n,i;let s=e.request.params?(n=e.request.params[0])==null?void 0:n.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const r=parseInt(s,16);if(this.isChainApproved(r))this.setDefaultChain(`${r}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:s}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${r}`);else throw new Error(`Failed to switch to chain 'eip155:${r}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var n,i,s,r,o;const a=(i=(n=e.request)==null?void 0:n.params)==null?void 0:i[0],c=((r=(s=e.request)==null?void 0:s.params)==null?void 0:r[1])||[];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const l=this.client.session.get(e.topic),d=((o=l==null?void 0:l.sessionProperties)==null?void 0:o.capabilities)||{},h=`${a}${c.join(",")}`,p=d==null?void 0:d[h];if(p)return p;let g;try{g=_$e(l,a,c)}catch(w){console.warn("Failed to extract capabilities from session",w)}if(g)return g;const b=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Y7(K7({},l.sessionProperties||{}),{capabilities:Y7(K7({},d||{}),{[h]:b})})})}catch(w){console.warn("Failed to update session with capabilities",w)}return b}async getCallStatus(e){var n,i,s;const r=this.client.session.get(e.topic),o=(n=r.sessionProperties)==null?void 0:n.bundler_name;if(o){const l=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(l,e)}catch(d){console.warn("Failed to fetch call status from bundler",d,l)}}const a=(i=r.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(l){console.warn("Failed to fetch call status from custom bundler",l,a)}const c=await F$e({resultId:(s=e.request.params)==null?void 0:s[0],storage:this.storage});if(c)try{return await L$e(c,this.getHttpProvider.bind(this))}catch(l){console.warn("Failed to fetch call status from stored send calls",l,c)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,n){var i;const s=new URL(e),r=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wu("eth_getUserOperationReceipt",[(i=n.request.params)==null?void 0:i[0]]))});if(!r.ok)throw new Error(`Failed to fetch user operation receipt - ${r.status}`);return await r.json()}
165getBundlerUrl(e,n){return`${a$e}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${n}`}async sendCalls(e){var n,i,s;const r=await this.client.request(e),o=(n=e.request.params)==null?void 0:n[0],a=r==null?void 0:r.id,c=(r==null?void 0:r.capabilities)||{},l=(i=c==null?void 0:c.caip345)==null?void 0:i.caip2,d=(s=c==null?void 0:c.caip345)==null?void 0:s.transactionHashes;return!a||!l||!(d!=null&&d.length)||await U$e({sendCalls:{request:o,result:r},storage:this.storage}),r}};var G$e=Object.defineProperty,K$e=(t,e,n)=>e in t?G$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,My=(t,e,n)=>K$e(t,typeof e!="symbol"?e+"":e,n);let Y$e=class{constructor(e){My(this,"name",Bse),My(this,"client"),My(this,"httpProviders"),My(this,"events"),My(this,"namespace"),My(this,"chainId"),this.namespace=e.namespace,this.events=_2("events"),this.client=_2("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,n){this.httpProviders[e]||this.setHttpProvider(e,n);const i=this.chainId;this.chainId=e,this.events.emit(AM.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${i}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getNamespaceName(){const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return of(e).namespace}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){var e,n;const i={};return(n=(e=this.namespace)==null?void 0:e.accounts)==null||n.forEach(s=>{var r,o;const a=of(s),c=(o=(r=this.namespace)==null?void 0:r.rpcMap)==null?void 0:o[`${a.namespace}:${a.reference}`];i[a.reference]=this.createHttpProvider(s,c)}),i}getHttpProvider(e){const n=of(e).reference,i=this.httpProviders[n];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,n){const i=this.createHttpProvider(e,n);i&&(this.httpProviders[e]=i)}createHttpProvider(e,n){const i=n||Fse(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new CM(new Rse(i,_2("disableProviderPing")))}};var Z$e=Object.defineProperty,Q$e=Object.defineProperties,X$e=Object.getOwnPropertyDescriptors,lH=Object.getOwnPropertySymbols,J$e=Object.prototype.hasOwnProperty,eUe=Object.prototype.propertyIsEnumerable,sI=(t,e,n)=>e in t?Z$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fv=(t,e)=>{for(var n in e||(e={}))J$e.call(e,n)&&sI(t,n,e[n]);if(lH)for(var n of lH(e))eUe.call(e,n)&&sI(t,n,e[n]);return t},xx=(t,e)=>Q$e(t,X$e(e)),_c=(t,e,n)=>sI(t,typeof e!="symbol"?e+"":e,n);let tUe=class qse{constructor(e){_c(this,"client"),_c(this,"namespaces"),_c(this,"optionalNamespaces"),_c(this,"sessionProperties"),_c(this,"scopedProperties"),_c(this,"events",new KO),_c(this,"rpcProviders",{}),_c(this,"session"),_c(this,"providerOpts"),_c(this,"logger"),_c(this,"uri"),_c(this,"disableProviderPing",!1),_c(this,"connectParams");var n,i;this.providerOpts=e,this.logger=bM({logger:(n=e.logger)!=null?n:Kz,name:(i=this.providerOpts.name)!=null?i:$se}),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const n=new qse(e);return await n.initialize(),n}async request(e,n,i){const[s,r]=this.validateChain(n);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Fv({},e),chainId:`${s}:${r}`,topic:this.session.topic,expiry:i})}sendAsync(e,n,i,s){const r=new Date().getTime();this.request(e,i,s).then(o=>n(null,k5(r,o))).catch(o=>n(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");
vendor: 13,994 bytes, line 165
165return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:As("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.connectParams=e,this.setNamespaces(e),this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,n){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:s}=await this.client.authenticate(e,n);i&&(this.uri=i,this.events.emit("display_uri",i));const r=await s();if(this.session=r.session,this.session){const o=eH(this.session.namespaces);this.namespaces=Cx(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return r}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}removeListener(e,n){this.events.removeListener(e,n)}off(e,n){this.events.off(e,n)}get isWalletConnect(){return!0}async pair(e){var n,i;const{uri:s,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties,authentication:(n=this.connectParams)==null?void 0:n.authentication,walletPay:(i=this.connectParams)==null?void 0:i.walletPay});s&&(this.uri=s,this.events.emit("display_uri",s));const o=await r();this.session=o;const a=eH(o.namespaces);return this.namespaces=Cx(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,n){try{if(!this.session)return;const[i,s]=this.validateChain(e);this.getProvider(i).setDefaultChain(s,n)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){try{this.logger.info("Cleaning up inactive pairings...");const n=this.client.pairing.getAll();if(!cf(n))return;for(const i of n)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${n.length}`)}catch(n){this.logger.warn(n,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,n;if(this.client=this.providerOpts.client||await xLe.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Kz,relayUrl:this.providerOpts.relayUrl||r$e,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(i){throw this.logger.error(i,"Failed to get session"),new Error(`The provided session: ${(n=(e=this.providerOpts)==null?void 0:e.session)==null?void 0:n.topic} doesn't exist in the Sign client`)}else{const i=this.client.session.getAll();this.session=i[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(n=>r2(n)))];z7("client",this.client),z7("events",this.events),z7("disableProviderPing",this.disableProviderPing),e.forEach(n=>{if(!this.session)return;const i=g$e(n,this.session);if((i==null?void 0:i.length)===0)return;const s=jse(i),r=Cx(this.namespaces,this.optionalNamespaces),o=xx(Fv({},r[n]),{accounts:i,chains:s});switch(n){case"eip155":this.rpcProviders[n]=new H$e({namespace:o});break;default:this.rpcProviders[n]=new Y$e({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var n;const{topic:i}=e;i===((n=this.session)==null?void 0:n.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var n;const{params:i,topic:s}=e;if(s!==((n=this.session)==null?void 0:n.topic))return;const{event:r}=i;if(r.name==="accountsChanged"){const o=r.data;o&&cf(o)&&this.events.emit("accountsChanged",o.map(Jz))}else if(r.name==="chainChanged"){const o=i.chainId,a=i.event.data,c=r2(o),l=q7(o)!==q7(a)?`${c}:${q7(a)}`:o;this.onChainChanged({currentCaipChainId:l})}else this.events.emit(r.name,r.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:n})=>{var i,s;if(e!==((i=this.session)==null?void 0:i.topic))return;const{namespaces:r}=n,o=(s=this.client)==null?void 0:s.session.get(e);this.session=xx(Fv({},o),{namespaces:r}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:n})}),this.client.on("session_delete",async e=>{var n;e.topic===((n=this.session)==null?void 0:n.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",xx(Fv({},As("USER_DISCONNECTED")),{data:e.topic})))}),this.on(AM.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(xx(Fv({},e),{internal:!0}))})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Bse]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var n;this.getProvider(e).updateNamespace((n=this.session)==null?void 0:n.namespaces[e])})}setNamespaces(e){const{namespaces:n={},optionalNamespaces:i={},sessionProperties:s,scopedProperties:r}=e;this.optionalNamespaces=Cx(n,i),this.sessionProperties=s,this.scopedProperties=r}validateChain(e){const[n,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[n,i];if(n&&!Object.keys(this.namespaces||{}).map(o=>r2(o)).includes(n))throw new Error(`Namespace '${n}' is not configured. Please call connect() first with namespace config.`);if(n&&i)return[n,i];const s=r2(Object.keys(this.namespaces)[0]),r=this.rpcProviders[s].getDefaultChain();return[s,r]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged({currentCaipChainId:e,previousCaipChainId:n,internal:i=!1}){if(!this.namespaces)return;const[s,r]=this.validateChain(e);r&&(this.updateNamespaceChain(s,r),i?(this.events.emit("chainChanged",r),this.emitAccountsChangedOnChainChange({namespace:s,currentCaipChainId:e,previousCaipChainId:n})):this.getProvider(s).setDefaultChain(r),await this.persist("namespaces",this.namespaces))}emitAccountsChangedOnChainChange({namespace:e,currentCaipChainId:n,previousCaipChainId:i}){var s,r;try{if(i===n)return;const o=(r=(s=this.session)==null?void 0:s.namespaces[e])==null?void 0:r.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${n}:`)).map(Jz);if(!cf(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn(o,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(e,n){if(!this.namespaces)return;const i=this.namespaces[e]?e:`${e}:${n}`,s={chains:[],methods:[],events:[],defaultChain:n};this.namespaces[i]?this.namespaces[i]&&(this.namespaces[i].defaultChain=n):this.namespaces[i]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.connectParams=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,n){var i;const s=((i=this.session)==null?void 0:i.topic)||"";await this.client.core.storage.setItem(`${wx}/${e}${s}`,n)}async getFromStore(e){var n;const i=((n=this.session)==null?void 0:n.topic)||"";return await this.client.core.storage.getItem(`${wx}/${e}${i}`)}async deleteFromStore(e){var n;const i=((n=this.session)==null?void 0:n.topic)||"";await this.client.core.storage.removeItem(`${wx}/${e}${i}`)}async cleanupStorage(){var e;try{if(((e=this.client)==null?void 0:e.session.length)>0)return;const n=await this.client.core.storage.getKeys();for(const i of n)i.startsWith(wx)&&await this.client.core.storage.removeItem(i)}catch(n){this.logger.warn(n,"Failed to cleanup storage")}}};const uH=2147483648,nUe={convertEVMChainIdToCoinType(t){if(t>=uH)throw new Error("Invalid chainId");return(uH|t)>>>0}},fl=Hi({suggestions:[],loading:!1}),iUe={state:fl,subscribe(t){return or(fl,()=>t(fl))},subscribeKey(t,e){return ar(fl,t,e)},async resolveName(t){var e,n;try{return await xn.lookupEnsName(t)}catch(i){const s=i;throw new Error(((n=(e=s==null?void 0:s.reasons)==null?void 0:e[0])==null?void 0:n.description)||"Error resolving name")}},async isNameRegistered(t){try{return await xn.lookupEnsName(t),!0}catch{return!1}},async getSuggestions(t){try{fl.loading=!0,fl.suggestions=[];const e=await xn.getEnsNameSuggestions(t);return fl.suggestions=e.suggestions||[],fl.suggestions}catch(e){const n=b3.parseEnsApiError(e,"Error fetching name suggestions");throw new Error(n)}finally{fl.loading=!1}},async getNamesForAddress(t){try{if(!ne.state.activeCaipNetwork)return[];const n=He.getEnsFromCacheForAddress(t);if(n)return n;const i=await xn.reverseLookupEnsName({address:t});return He.updateEnsCache({address:t,ens:i,timestamp:Date.now()}),i}catch(e){const n=b3.parseEnsApiError(e,"Error fetching names for address");throw new Error(n)}},async registerName(t){var s;const e=ne.state.activeCaipNetwork,n=(s=ne.getAccountData(e==null?void 0:e.chainNamespace))==null?void 0:s.address,i=Oe.getAuthConnector();if(!e)throw new Error("Network not found");if(!n||!i)throw new Error("Address or auth connector not found");fl.loading=!0;try{const r=JSON.stringify({name:t,attributes:{},timestamp:Math.floor(Date.now()/1e3)});Pe.pushTransactionStack({onCancel(){Pe.replace("RegisterAccountName")}});const o=await Ve.signMessage(r);fl.loading=!1;const a=e.id;if(!a)throw new Error("Network not found");const c=nUe.convertEVMChainIdToCoinType(Number(a));await xn.registerEnsName({coinType:c,address:n,signature:o,message:r}),ne.setAccountProp("profileName",t,e.chainNamespace),He.updateEnsCache({address:n,ens:[{name:t,registered_at:new Date().toISOString(),updated_at:void 0,addresses:{},attributes:[]}],timestamp:Date.now()}),Pe.replace("RegisterAccountNameSuccess")}catch(r){const o=b3.parseEnsApiError(r,`Error registering name ${t}`);throw Pe.replace("RegisterAccountName"),new Error(o)}finally{fl.loading=!1}},validateName(t){return/^[a-zA-Z0-9-]{4,}$/u.test(t)},parseEnsApiError(t,e){var i,s;const n=t;return((s=(i=n==null?void 0:n.reasons)==null?void 0:i[0])==null?void 0:s.description)||e}},b3=Yc(iUe);function rI(t){try{return new URL(t)}catch{return null}}function sUe(t){const e=t.split("/"),n=e.length>0&&e[0]!==void 0?e[0]:"",i=n.lastIndexOf(":");return i===-1?{host:n}:{host:n.slice(0,i),port:n.slice(i+1)}}function rUe(t){const e=t.indexOf("://");if(e===-1)return null;const n=t.slice(0,e),i=e+3;let s=t.indexOf("/",i);s===-1&&(s=t.length);const r=t.slice(i,s),o=r.lastIndexOf(":");return o===-1?{scheme:n,host:r}:{scheme:n,host:r.slice(0,o),port:r.slice(o+1)}}function oUe(t,e){if(e.includes("://")){const o=rI(e);return o?o.origin===t:!1}const{host:n,port:i}=sUe(e),s=t.indexOf("://");if(s!==-1){const o=s+3;let a=t.indexOf("/",o);a===-1&&(a=t.length);const c=t.slice(o,a);if(i!==void 0)return`${n}:${i}`===c;const l=c.split(":")[0];return n===l}const r=rI(t);return r?i!==void 0?n===r.hostname&&i===(r.port||void 0):n===r.hostname:!1}function aUe(t,e,n){let i=n,s;const r=i.indexOf("://");r!==-1&&(s=i.slice(0,r),i=i.slice(r+3));const o=i.indexOf("/");o!==-1&&(i=i.slice(0,o));let a=i,c;const l=a.lastIndexOf(":");l!==-1&&(c=a.slice(l+1),a=a.slice(0,l));const d=a.split(".");for(const w of d)if(w.includes("*")&&w!=="*")return!1;const h=t.protocol.replace(/:$/u,"");if(s&&s!==h||c!==void 0&&c!=="*"&&c!==t.port)return!1;const p=rUe(e),b=(p?p.host:t.hostname).split(".");if(d.length!==b.length)return!1;for(let w=d.length-1;w>=0;w-=1){const C=d[w],E=b[w];if(C!=="*"&&C!==E)return!1}return!0}const cUe={ton:["ton_sendMessage","ton_signData"],solana:["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"],eip155:["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],bip122:["sendTransfer","signMessage","signPsbt","getAccountAddresses"]},lf={RPC_ERROR_CODE:{USER_REJECTED:5e3,USER_REJECTED_METHODS:5002},getMethodsByChainNamespace(t){return cUe[t]||[]},createDefaultNamespace(t){return{methods:this.getMethodsByChainNamespace(t),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(t,e){if(!e)return{...t};const n={...t},i=new Set;
165if(e.methods&&Object.keys(e.methods).forEach(s=>i.add(s)),e.chains&&Object.keys(e.chains).forEach(s=>i.add(s)),e.events&&Object.keys(e.events).forEach(s=>i.add(s)),e.rpcMap&&Object.keys(e.rpcMap).forEach(s=>{const[r]=s.split(":");r&&i.add(r)}),i.forEach(s=>{n[s]||(n[s]=this.createDefaultNamespace(s))}),e.methods&&Object.entries(e.methods).forEach(([s,r])=>{n[s]&&(n[s].methods=r)}),e.chains&&Object.entries(e.chains).forEach(([s,r])=>{n[s]&&(n[s].chains=r)}),e.events&&Object.entries(e.events).forEach(([s,r])=>{n[s]&&(n[s].events=r)}),e.rpcMap){const s=new Set;Object.entries(e.rpcMap).forEach(([r,o])=>{const[a,c]=r.split(":");!a||!c||!n[a]||(n[a].rpcMap||(n[a].rpcMap={}),s.has(a)||(n[a].rpcMap={},s.add(a)),n[a].rpcMap[c]=o)})}return n},createNamespaces(t,e){const n=t.reduce((i,s)=>{const{id:r,chainNamespace:o,rpcUrls:a}=s,c=a.default.http[0];i[o]||(i[o]=this.createDefaultNamespace(o));const l=`${o}:${r}`,d=i[o];switch(d.chains.push(l),l){case"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":d.chains.push("solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ");break;case"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":d.chains.push("solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K");break}return d!=null&&d.rpcMap&&c&&(d.rpcMap[r]=c),i},{});return this.applyNamespaceOverrides(n,e)},resolveReownName:async t=>{var i;const e=await b3.resolveName(t);return((i=(e!=null&&e.addresses?Object.values(e.addresses):[])[0])==null?void 0:i.address)||!1},getChainsFromNamespaces(t={}){return Object.values(t).flatMap(e=>{const n=e.chains||[],i=e.accounts.map(s=>{const[r,o]=s.split(":");return`${r}:${o}`});return Array.from(new Set([...n,...i]))})},isSessionEventData(t){return typeof t=="object"&&t!==null&&"id"in t&&"topic"in t&&"params"in t&&typeof t.params=="object"&&t.params!==null&&"chainId"in t.params&&"event"in t.params&&typeof t.params.event=="object"&&t.params.event!==null},isUserRejectedRequestError(t){try{if(typeof t=="object"&&t!==null){const e=t,n=typeof e.code=="number",i=n&&e.code===lf.RPC_ERROR_CODE.USER_REJECTED_METHODS,s=n&&e.code===lf.RPC_ERROR_CODE.USER_REJECTED;return i||s}return!1}catch{return!1}},isOriginAllowed(t,e,n){const i=[...e,...n];if(e.length===0)return!0;const s=rI(t);if(!s)return i.some(r=>!r.includes("*")&&r===t);if(s.hostname==="localhost"||s.hostname==="127.0.0.1")return!0;for(const r of i)if(r.includes("*")){if(aUe(s,t,r))return!0}else if(oUe(t,r))return!0;return!1},listenWcProvider({universalProvider:t,namespace:e,onConnect:n,onDisconnect:i,onAccountsChanged:s,onChainChanged:r,onDisplayUri:o}){n&&t.on("connect",()=>{const a=lf.getWalletConnectAccounts(t,e);n(a)}),i&&t.on("disconnect",()=>{i()}),s&&t.on("accountsChanged",a=>{var c,l,d,h,p;try{const g=((d=(l=(c=t.session)==null?void 0:c.namespaces)==null?void 0:l[e])==null?void 0:d.accounts)||[],b=(p=(h=t.rpcProviders)==null?void 0:h[e])==null?void 0:p.getDefaultChain(),w=a.map(C=>{const E=g.find(k=>k.includes(`${e}:${b}:${C}`));if(!E)return;const{chainId:T,chainNamespace:A}=Lr.parseCaipAddress(E);return{address:C,chainId:T,chainNamespace:A}}).filter(C=>C!==void 0);w.length>0&&s(w)}catch(g){console.warn("Failed to parse accounts for namespace on accountsChanged event",e,a,g)}}),r&&t.on("chainChanged",a=>{r(a)}),o&&t.on("display_uri",a=>{o(a)})},getWalletConnectAccounts(t,e){var s,r,o,a;const n=new Set,i=(a=(o=(r=(s=t==null?void 0:t.session)==null?void 0:s.namespaces)==null?void 0:r[e])==null?void 0:o.accounts)==null?void 0:a.map(c=>Lr.parseCaipAddress(c)).filter(({address:c})=>n.has(c.toLowerCase())?!1:(n.add(c.toLowerCase()),!0));return i&&i.length>0?i:[]}},lUe=[we.CONNECTOR_ID.AUTH,we.CONNECTOR_ID.WALLET_CONNECT];class zse{constructor(e){this.availableConnectors=[],this.availableConnections=[],this.providerHandlers={},this.eventListeners=new Map,this.getCaipNetworks=n=>ne.getCaipNetworks(n),this.getConnectorId=n=>Oe.getConnectorId(n),e&&this.construct(e)}construct(e){this.projectId=e.projectId,this.namespace=e.namespace,this.adapterType=e.adapterType}get connectors(){return this.availableConnectors}get connections(){return this.availableConnections}get networks(){return this.getCaipNetworks(this.namespace)}onAuthConnected({accounts:e,chainId:n}){const i=this.getCaipNetworks().filter(s=>s.chainNamespace===this.namespace).find(s=>s.id.toString()===(n==null?void 0:n.toString()));e&&i&&this.addConnection({connectorId:we.CONNECTOR_ID.AUTH,accounts:e,caipNetwork:i})}setAuthProvider(e){e.onConnect(this.onAuthConnected.bind(this)),e.onSocialConnected(this.onAuthConnected.bind(this)),this.addConnector({id:we.CONNECTOR_ID.AUTH,type:"AUTH",
165name:we.CONNECTOR_NAMES.AUTH,provider:e,imageId:void 0,chain:this.namespace,chains:[]})}addConnector(...e){const n=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(i=>n.has(i.id)?!1:(n.add(i.id),!0)),this.emit("connectors",this.availableConnectors)}addConnection(...e){const n=new Set;this.availableConnections=[...e,...this.availableConnections].filter(i=>n.has(i.connectorId.toLowerCase())?!1:(n.add(i.connectorId.toLowerCase()),!0)),this.emit("connections",this.availableConnections)}deleteConnection(e){this.availableConnections=this.availableConnections.filter(n=>n.connectorId.toLowerCase()!==e.toLowerCase()),this.emit("connections",this.availableConnections)}clearConnections(e=!1){this.availableConnections=[],e&&this.emit("connections",this.availableConnections)}setStatus(e,n){ne.setAccountProp("status",e,n)}on(e,n){var i;this.eventListeners.has(e)||this.eventListeners.set(e,new Set),(i=this.eventListeners.get(e))==null||i.add(n)}off(e,n){const i=this.eventListeners.get(e);i&&i.delete(n)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,n){const i=this.eventListeners.get(e);i&&i.forEach(s=>s(n))}async connectWalletConnect(e){try{return{clientId:(await this.getWalletConnectConnector().connectWalletConnect()).clientId}}catch(n){throw lf.isUserRejectedRequestError(n)?new n2(n):n}}async switchNetwork(e){var r;const{caipNetwork:n}=e,i=ss.getProviderId(n.chainNamespace),s=ss.getProvider(n.chainNamespace);if(!s)throw new Error("Provider not found");if(i==="WALLET_CONNECT"){s.setDefaultChain(n.caipNetworkId);return}if(i==="AUTH"){const o=(r=Oe.getAuthConnector())==null?void 0:r.provider;if(!o)throw new Error("Auth provider not found");const a=$s(n.chainNamespace);await o.switchNetwork({chainId:n.caipNetworkId});const c=await o.getUser({chainId:n.caipNetworkId,preferredAccountType:a});this.emit("switchNetwork",c)}}getWalletConnectConnector(){const e=this.connectors.find(n=>n.id==="walletConnect");if(!e)throw new Error("WalletConnectConnector not found");return e}onConnect(e,n){if(e.length>0){const{address:i,chainId:s}=Ue.getAccount(e[0]),r=this.getCaipNetworks().filter(a=>a.chainNamespace===this.namespace).find(a=>a.id.toString()===(s==null?void 0:s.toString())),o=this.connectors.find(a=>a.id===n);i&&(this.emit("accountChanged",{address:i,chainId:s,connector:o}),this.addConnection({connectorId:n,accounts:e.map(a=>{const{address:c}=Ue.getAccount(a);return{address:c}}),caipNetwork:r}))}}onAccountsChanged(e,n,i=!0){var s,r;if(e.length>0){const{address:o}=Ue.getAccount(e[0]),a=this.getConnection({connectorId:n,connections:this.connections,connectors:this.connectors});o&&((s=this.getConnectorId(we.CHAIN.EVM))==null?void 0:s.toLowerCase())===n.toLowerCase()&&this.emit("accountChanged",{address:o,chainId:(r=a==null?void 0:a.caipNetwork)==null?void 0:r.id,connector:a==null?void 0:a.connector}),this.addConnection({connectorId:n,accounts:e.map(c=>{const{address:l}=Ue.getAccount(c);return{address:l}}),caipNetwork:a==null?void 0:a.caipNetwork})}else i&&this.onDisconnect(n)}onDisconnect(e){var n;this.removeProviderListeners(e),this.deleteConnection(e),((n=this.getConnectorId(we.CHAIN.EVM))==null?void 0:n.toLowerCase())===e.toLowerCase()&&this.emitFirstAvailableConnection(),this.connections.length===0&&this.emit("disconnect")}onChainChanged(e,n){var o;const i=typeof e=="string"&&e.startsWith("0x")?parseInt(e,16).toString():e.toString(),s=this.getConnection({connectorId:n,connections:this.connections,connectors:this.connectors}),r=this.getCaipNetworks().filter(a=>a.chainNamespace===this.namespace).find(a=>a.id.toString()===i);s&&this.addConnection({connectorId:n,accounts:s.accounts,caipNetwork:r}),((o=this.getConnectorId(we.CHAIN.EVM))==null?void 0:o.toLowerCase())===n.toLowerCase()&&this.emit("switchNetwork",{chainId:i})}listenProviderEvents(e,n){if(lUe.includes(e))return;const i=o=>this.onAccountsChanged(o,e),s=o=>this.onChainChanged(o,e),r=()=>this.onDisconnect(e);this.providerHandlers[e]||(n.on("disconnect",r),n.on("accountsChanged",i),n.on("chainChanged",s),this.providerHandlers[e]={provider:n,disconnect:r,accountsChanged:i,chainChanged:s})}removeProviderListeners(e){if(this.providerHandlers[e]){const{provider:n,disconnect:i,accountsChanged:s,chainChanged:r}=this.providerHandlers[e];n.removeListener("disconnect",i),n.removeListener("accountsChanged",s),n.removeListener("chainChanged",r),this.providerHandlers[e]=null}}emitFirstAvailableConnection(){var n;const e=this.getConnection({connections:this.connections,connectors:this.connectors});if(e){const[i]=e.accounts;
165this.emit("accountChanged",{address:i==null?void 0:i.address,chainId:(n=e.caipNetwork)==null?void 0:n.id,connector:e.connector})}}getConnection({address:e,connectorId:n,connections:i,connectors:s}){if(n){const o=i.find(l=>l.connectorId.toLowerCase()===n.toLowerCase());if(!o)return null;const a=s.find(l=>l.id.toLowerCase()===o.connectorId.toLowerCase()),c=e?o.accounts.find(l=>l.address.toLowerCase()===e.toLowerCase()):o.accounts[0];return{...o,account:c,connector:a}}const r=i.find(o=>o.accounts.length>0&&s.some(a=>a.id.toLowerCase()===o.connectorId.toLowerCase()));if(r){const[o]=r.accounts,a=s.find(c=>c.id.toLowerCase()===r.connectorId.toLowerCase());return{...r,account:o,connector:a}}return null}}let wm=null;const jo={getSIWX(){return ye.state.siwx},async initializeIfEnabled(t=ne.getActiveCaipAddress()){var r,o,a;const e=ye.state.siwx;if(!(e&&t))return;const[n,i,s]=t.split(":");if(ne.checkIfSupportedNetwork(n,`${n}:${i}`))try{if((r=ye.state.remoteFeatures)!=null&&r.emailCapture){const l=(o=ne.getAccountData(n))==null?void 0:o.user;await wn.open({view:"DataCapture",data:{email:(l==null?void 0:l.email)??void 0}});return}if(wm&&await wm,(await e.getSessions(`${n}:${i}`,s)).length)return;await wn.open({view:"SIWXSignMessage"})}catch(c){console.error("SIWXUtil:initializeIfEnabled",c),Et.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(c)}),await((a=Ve._getClient())==null?void 0:a.disconnect().catch(console.error)),Pe.reset("Connect"),ti.showError("A problem occurred while trying initialize authentication")}},async isAuthenticated(t=ne.getActiveCaipAddress()){if(!ye.state.siwx||!t)return!0;const{chainNamespace:n,chainId:i,address:s}=Lr.parseCaipAddress(t),r=`${n}:${i}`;return(await jo.getSessions({address:s,caipNetworkId:r})).length>0},async requestSignMessage(){const t=ye.state.siwx,e=Ue.getPlainAddress(ne.getActiveCaipAddress()),n=Yh();if(!t)throw new Error("SIWX is not enabled");if(!e)throw new Error("No ActiveCaipAddress found");if(!n)throw new Error("No ActiveCaipNetwork or client found");try{const i=await t.createMessage({chainId:n.caipNetworkId,accountAddress:e}),s=i.toString();let r="";t.signMessage?r=await t.signMessage({message:s,chainId:n.caipNetworkId,accountAddress:e}):(Oe.getConnectorId(n.chainNamespace)===we.CONNECTOR_ID.AUTH&&Pe.pushTransactionStack({}),r=await Ve.signMessage(s)||""),await t.addSession({data:i,message:s,signature:r}),ne.setLastConnectedSIWECaipNetwork(n),wn.close(),Et.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(i){(!wn.state.open||Pe.state.view==="ApproveTransaction")&&await wn.open({view:"SIWXSignMessage"}),ti.showError("Error signing message"),Et.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(i)}),console.error("SWIXUtil:requestSignMessage",i)}},async cancelSignMessage(){var t;try{const e=this.getSIWX();if((t=e==null?void 0:e.getRequired)==null?void 0:t.call(e)){const i=ne.getLastConnectedSIWECaipNetwork();if(i){const s=await(e==null?void 0:e.getSessions(i==null?void 0:i.caipNetworkId,Ue.getPlainAddress(ne.getActiveCaipAddress())||""));s&&s.length>0?await ne.switchActiveNetwork(i):await Ve.disconnect()}else await Ve.disconnect()}else wn.close();wn.close(),Et.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(e){console.error("SIWXUtil:cancelSignMessage",e)}},async getAllSessions(){const t=this.getSIWX(),e=ne.getAllRequestedCaipNetworks(),n=[];return await Promise.all(e.map(async i=>{const s=await(t==null?void 0:t.getSessions(i.caipNetworkId,Ue.getPlainAddress(ne.getActiveCaipAddress())||""));s&&n.push(...s)})),n},async getSessions(t){const e=ye.state.siwx;let n=t==null?void 0:t.address;if(!n){const s=ne.getActiveCaipAddress();n=Ue.getPlainAddress(s)}let i=t==null?void 0:t.caipNetworkId;if(!i){const s=ne.getActiveCaipNetwork();i=s==null?void 0:s.caipNetworkId}return e&&n&&i?e.getSessions(i,n):[]},async isSIWXCloseDisabled(){var e;const t=this.getSIWX();if(t){const n=Pe.state.view==="ApproveTransaction",i=Pe.state.view==="SIWXSignMessage";if(n||i)return((e=t.getRequired)==null?void 0:e.call(t))&&(await this.get
165Sessions()).length===0}return!1},async authConnectorAuthenticate({authConnector:t,chainId:e,socialUri:n,preferredAccountType:i,chainNamespace:s}){var h;const r=jo.getSIWX(),o=Yh();if(!r||!s.includes(we.CHAIN.EVM)||(h=ye.state.remoteFeatures)!=null&&h.emailCapture){const p=await t.connect({chainId:e,socialUri:n,preferredAccountType:i});return{address:p.address,chainId:p.chainId,accounts:p.accounts}}const a=`${s}:${e}`,c=await r.createMessage({chainId:a,accountAddress:"<<AccountAddress>>"}),l={accountAddress:c.accountAddress,chainId:c.chainId,domain:c.domain,uri:c.uri,version:c.version,nonce:c.nonce,notBefore:c.notBefore,statement:c.statement,resources:c.resources,requestId:c.requestId,issuedAt:c.issuedAt,expirationTime:c.expirationTime,serializedMessage:c.toString()},d=await t.connect({chainId:e,socialUri:n,siwxMessage:l,preferredAccountType:i});return l.accountAddress=d.address,l.serializedMessage=d.message||"",d.signature&&d.message&&await jo.addEmbeddedWalletSession(l,d.message,d.signature),ne.setLastConnectedSIWECaipNetwork(o),{address:d.address,chainId:d.chainId,accounts:d.accounts}},async addEmbeddedWalletSession(t,e,n){if(wm)return wm;const i=jo.getSIWX();return i?(wm=i.addSession({data:t,message:e,signature:n}).finally(()=>{wm=null}),wm):Promise.resolve()},async universalProviderAuthenticate({universalProvider:t,chains:e,methods:n}){var l,d,h;const i=jo.getSIWX(),s=Yh(),r=new Set(e.map(p=>p.split(":")[0]));if(!i||r.size!==1||!r.has("eip155"))return!1;const o=await i.createMessage({chainId:((l=Yh())==null?void 0:l.caipNetworkId)||"",accountAddress:""}),a=await t.authenticate({nonce:o.nonce,domain:o.domain,uri:o.uri,exp:o.expirationTime,iat:o.issuedAt,nbf:o.notBefore,requestId:o.requestId,version:o.version,resources:o.resources,statement:o.statement,chainId:o.chainId,methods:n,chains:[o.chainId,...e.filter(p=>p!==o.chainId)]});ti.showLoading("Authenticating...",{autoClose:!1});const c={...a.session.peer.metadata,name:a.session.peer.metadata.name,icon:(d=a.session.peer.metadata.icons)==null?void 0:d[0],type:"WALLET_CONNECT"};if(ne.setAccountProp("connectedWalletInfo",c,Array.from(r)[0]),(h=a==null?void 0:a.auths)!=null&&h.length){const p=a.auths.map(g=>{const b=t.client.formatAuthMessage({request:g.p,iss:g.p.iss});return{data:{...g.p,accountAddress:g.p.iss.split(":").slice(-1).join(""),chainId:g.p.iss.split(":").slice(2,4).join(":"),uri:g.p.aud??"",version:g.p.version||o.version,expirationTime:g.p.exp,issuedAt:g.p.iat,notBefore:g.p.nbf},message:b,signature:g.s.s,cacao:g}});try{await i.setSessions(p),s&&ne.setLastConnectedSIWECaipNetwork(s),Et.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:jo.getSIWXEventProperties()})}catch(g){throw console.error("SIWX:universalProviderAuth - failed to set sessions",g),Et.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:jo.getSIWXEventProperties(g)}),await t.disconnect().catch(console.error),g}finally{ti.hide()}}return!0},getSIWXEventProperties(t){var n;const e=ne.state.activeChain;if(!e)throw new Error("SIWXUtil:getSIWXEventProperties - namespace is required");return{network:((n=ne.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||"",isSmartAccount:$s(e)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT,message:t?Ue.parseError(t):void 0}},async clearSessions(){const t=this.getSIWX();t&&await t.setSessions([])}};class Hse{constructor({provider:e,namespace:n}){this.id=we.CONNECTOR_ID.WALLET_CONNECT,this.name="WalletConnect",this.type="WALLET_CONNECT",this.imageId="ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",this.getCaipNetworks=ne.getCaipNetworks.bind(ne),this.caipNetworks=this.getCaipNetworks(),this.provider=e,this.chain=n}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){const n=this.getCaipNetworks(),i=ye.state.universalProviderConfigOverride,s=lf.createNamespaces(n,i);await this.provider.connect({optionalNamespaces:s})}return{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){const e=this.chains.map(n=>n.caipNetworkId);return jo.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:uUe})}}const uUe=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],ru=Hi({message:"",variant:"info",open:!1}),dUe={state:ru,subscribeKey(t,e){return ar(ru,t,e)},open(t,e){const{debug:n}=ye.state,{code:i,displayMessage:s,debugMessage:r}=t;s&&n&&(ru.message=s,ru.variant=e,ru.open=!0),r&&console.error(typeof r=="function"?r():r,i?{code:i}
165:void 0)},warn(t,e,n){ru.open=!0,ru.message=t,ru.variant="warning",e&&console.warn(e,n)},close(){ru.open=!1,ru.message="",ru.variant="info"}},Ss=Yc(dUe),ou=Hi({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),hUe={state:ou,subscribe(t){return or(ou,()=>t(ou))},subscribeKey(t,e){return ar(ou,t,e)},showTooltip({message:t,triggerRect:e,variant:n}){ou.open=!0,ou.message=t,ou.triggerRect=e,ou.variant=n},hide(){ou.open=!1,ou.message="",ou.triggerRect={width:0,height:0,top:0,left:0}}},_l=Yc(hUe),jv=Hi({isLegalCheckboxChecked:!1}),fg={state:jv,subscribe(t){return or(jv,()=>t(jv))},subscribeKey(t,e){return ar(jv,t,e)},setIsLegalCheckboxChecked(t){jv.isLegalCheckboxChecked=t}},fUe={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}};class pUe extends Error{}function mUe(){const{sdkType:t,sdkVersion:e,projectId:n}=ye.getSnapshot(),i=new URL("https://rpc.walletconnect.org/v1/json-rpc");return i.searchParams.set("projectId",n),i.searchParams.set("st",t),i.searchParams.set("sv",e),i.searchParams.set("source","fund-wallet"),i.toString()}async function TM(t,e){const n=mUe(),{projectId:i}=ye.getSnapshot(),s={jsonrpc:"2.0",id:1,method:t,params:{...e||{},projectId:i}},o=await(await fetch(n,{method:"POST",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}})).json();if(o.error)throw new pUe(o.error.message);return o}async function gUe(t){return(await TM("reown_getExchanges",t)).result}async function yUe(t){return(await TM("reown_getExchangePayUrl",t)).result}async function bUe(t){return(await TM("reown_getExchangeBuyStatus",t)).result}function dH(t,e){const{chainNamespace:n,chainId:i}=Lr.parseCaipNetworkId(t),s=fUe[n];if(!s)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${n}`);let r=s.native.assetNamespace,o=s.native.assetReference;return e!=="native"&&(r=s.defaultTokenNamespace,o=e),`${`${n}:${i}`}/${r}:${o}`}const wUe={network:"eip155:1",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},vUe={network:"eip155:8453",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},Gse={network:"eip155:8453",asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},CUe={asset:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"},xUe={network:"eip155:84532",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},EUe={network:"eip155:1",asset:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},_Ue={network:"eip155:42161",asset:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},SUe={network:"eip155:137",asset:"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},AUe={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},TUe={network:"eip155:1",asset:"0xdAC17F958D2ee523a2206206994597C13D831ec7",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},kUe={network:"eip155:10",asset:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},NUe={network:"eip155:42161",asset:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}}
165,RUe={network:"eip155:137",asset:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},PUe={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},IUe={network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"native",metadata:{name:"Solana",symbol:"SOL",decimals:9}},DUe={ethereumETH:wUe,baseETH:vUe,baseUSDC:Gse,baseSepoliaETH:xUe,ethereumUSDC:EUe,arbitrumUSDC:_Ue,polygonUSDC:SUe,solanaUSDC:AUe,ethereumUSDT:TUe,optimismUSDT:kUe,arbitrumUSDT:NUe,polygonUSDT:RUe,solanaUSDT:PUe,solanaSOL:IUe};function OUe(t){return Object.values(DUe).filter(e=>e.network===t)}const MUe=0,Kse={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},hn=Hi(Kse),Ir={state:hn,subscribe(t){return or(hn,()=>t(hn))},subscribeKey(t,e){return ar(hn,t,e)},resetState(){Object.assign(hn,{...Kse})},async getAssetsForNetwork(t){const e=OUe(t),n=await Ir.getAssetsImageAndPrice(e),i=e.map(s=>{var a,c,l,d;const r=s.asset==="native"?h_():`${s.network}:${s.asset}`,o=n.find(h=>{var p,g,b;return((b=(g=(p=h.fungibles)==null?void 0:p[0])==null?void 0:g.address)==null?void 0:b.toLowerCase())===r.toLowerCase()});return{...s,price:((c=(a=o==null?void 0:o.fungibles)==null?void 0:a[0])==null?void 0:c.price)||1,metadata:{...s.metadata,iconUrl:(d=(l=o==null?void 0:o.fungibles)==null?void 0:l[0])==null?void 0:d.iconUrl}}});return hn.assets=i,i},async getAssetsImageAndPrice(t){const e=t.map(i=>i.asset==="native"?h_():`${i.network}:${i.asset}`);return await Promise.all(e.map(i=>xn.fetchTokenPrice({addresses:[i]})))},getTokenAmount(){var n;if(!((n=hn==null?void 0:hn.paymentAsset)!=null&&n.price))throw new Error("Cannot get token price");const t=u5.bigNumber(hn.amount??0).round(8),e=u5.bigNumber(hn.paymentAsset.price).round(8);return t.div(e).round(8).toNumber()},setAmount(t){var e;hn.amount=t,(e=hn.paymentAsset)!=null&&e.price&&(hn.tokenAmount=Ir.getTokenAmount())},setPaymentAsset(t){hn.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=ye.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return Ir.isPayWithExchangeEnabled()&&ne.state.activeCaipNetwork&&fn.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(ne.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const e=Ir.isPayWithExchangeSupported();if(!hn.paymentAsset||!e){hn.exchanges=[],hn.isLoading=!1;return}hn.isLoading=!0;const n=await gUe({page:MUe,asset:dH(hn.paymentAsset.network,hn.paymentAsset.asset),amount:((t=hn.amount)==null?void 0:t.toString())??"0"});hn.exchanges=n.exchanges.slice(0,2)}catch{throw ti.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{hn.isLoading=!1}},async getPayUrl(t,e){try{const n=Number(e.amount),i=await yUe({exchangeId:t,asset:dH(e.network,e.asset),amount:n.toString(),recipient:`${e.network}:${e.recipient}`});return Et.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:e.network,asset:e.asset,recipient:e.recipient,amount:n},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),i}catch(n){throw n instanceof Error&&n.message.includes("is not supported")?new Error("Asset not supported"):new Error(n.message)}},async handlePayWithExchange(t){var e;try{const n=(e=ne.getAccountData())==null?void 0:e.address;if(!n)throw new Error("No account connected");if(!hn.paymentAsset)throw new Error("No payment asset selected");const i=Ue.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!i)throw new Error("Could not create popup window");hn.isPaymentInProgress=!0,hn.paymentId=crypto.randomUUID(),hn.currentPayment={type:"exchange",exchangeId:t};const{network:s,asset:r}=hn.paymentAsset,o={network:s,asset:r,amount:hn.tokenAmount,recipient:n},a=await Ir.getPayUrl(t,o);if(!a){try{i.close()}catch(c){console.error("Unable to close popup window",c)}throw new Error("Unable to initiate payment")}hn.currentPayment.sessionId=a.sessionId,hn.currentPayment.status="IN_PROGRESS",hn.
165currentPayment.exchangeId=t,i.location.href=a.url}catch{hn.error="Unable to initiate payment",ti.showError(hn.error)}},async waitUntilComplete({exchangeId:t,sessionId:e,paymentId:n,retries:i=20}){const s=await Ir.getBuyStatus(t,e,n);if(s.status==="SUCCESS"||s.status==="FAILED")return s;if(i===0)throw new Error("Unable to get deposit status");return await new Promise(r=>{setTimeout(r,5e3)}),Ir.waitUntilComplete({exchangeId:t,sessionId:e,paymentId:n,retries:i-1})},async getBuyStatus(t,e,n){var i,s,r,o,a;try{if(!hn.currentPayment)throw new Error("No current payment");const c=await bUe({sessionId:e,exchangeId:t});if(hn.currentPayment.status=c.status,c.status==="SUCCESS"||c.status==="FAILED"){const l=(i=ne.getAccountData())==null?void 0:i.address;hn.currentPayment.result=c.txHash,hn.isPaymentInProgress=!1,Et.sendEvent({type:"track",event:c.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:c.status==="FAILED"?Ue.parseError(hn.error):void 0,source:"fund-from-exchange",paymentId:n,configuration:{network:((s=hn.paymentAsset)==null?void 0:s.network)||"",asset:((r=hn.paymentAsset)==null?void 0:r.asset)||"",recipient:l||"",amount:hn.amount??0},currentPayment:{type:"exchange",exchangeId:(o=hn.currentPayment)==null?void 0:o.exchangeId,sessionId:(a=hn.currentPayment)==null?void 0:a.sessionId,result:c.txHash}}})}return c}catch{return{status:"UNKNOWN",txHash:""}}},reset(){hn.currentPayment=void 0,hn.isPaymentInProgress=!1,hn.paymentId="",hn.paymentAsset=null,hn.amount=0,hn.tokenAmount=0,hn.priceLoading=!1,hn.error=null,hn.exchanges=[],hn.isLoading=!1}},za={getConnectorsByType(t,e,n){const{customWallets:i}=ye.state,s=He.getRecentWallets(),r=Fc.filterOutDuplicateWallets(e),o=Fc.filterOutDuplicateWallets(n),a=t.filter(h=>h.type==="MULTI_CHAIN"),c=t.filter(h=>h.type==="ANNOUNCED"),l=t.filter(h=>h.type==="INJECTED"),d=t.filter(h=>h.type==="EXTERNAL");return{custom:i,recent:s,external:d,multiChain:a,announced:c,injected:l,recommended:r,featured:o}},showConnector(t){var s;const e=(s=t.info)==null?void 0:s.rdns,n=!!e&&ut.state.excludedWallets.some(r=>!!r.rdns&&r.rdns===e),i=!!t.name&&ut.state.excludedWallets.some(r=>Tte.isLowerCaseMatch(r.name,t.name));return!(t.type==="INJECTED"&&(t.name==="Browser Wallet"&&(!Ue.isMobile()||Ue.isMobile()&&!e&&!Ve.checkInstalled())||n||i)||(t.type==="ANNOUNCED"||t.type==="EXTERNAL")&&(n||i))},getIsConnectedWithWC(){return Array.from(ne.state.chains.values()).some(n=>Oe.getConnectorId(n.namespace)===we.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:t,featured:e,custom:n,recent:i,announced:s,injected:r,multiChain:o,external:a,overriddenConnectors:c=(l=>(l=ye.state.features)==null?void 0:l.connectorTypeOrder)()??[]}){const h=[{type:"walletConnect",isEnabled:!0},{type:"recent",isEnabled:i.length>0},{type:"injected",isEnabled:[...r,...s,...o].length>0},{type:"featured",isEnabled:e.length>0},{type:"custom",isEnabled:n&&n.length>0},{type:"external",isEnabled:a.length>0},{type:"recommended",isEnabled:t.length>0}].filter(w=>w.isEnabled),p=new Set(h.map(w=>w.type)),g=c.filter(w=>p.has(w)).map(w=>({type:w,isEnabled:!0})),b=h.filter(({type:w})=>!g.some(({type:E})=>E===w));return Array.from(new Set([...g,...b].map(({type:w})=>w)))},sortConnectorsByExplorerWallet(t){return[...t].sort((e,n)=>e.explorerWallet&&n.explorerWallet?(e.explorerWallet.order??0)-(n.explorerWallet.order??0):e.explorerWallet?-1:n.explorerWallet?1:0)},getAuthName({email:t,socialUsername:e,socialProvider:n}){return e?n&&n==="discord"&&e.endsWith("0")?e.slice(0,-1):e:t.length>30?`${t.slice(0,-3)}...`:t},async fetchProviderData(t){var e,n;try{if(t.name==="Browser Wallet"&&!Ue.isMobile())return{accounts:[],chainId:void 0};if(t.id===we.CONNECTOR_ID.AUTH)return{accounts:[],chainId:void 0};const[i,s]=await Promise.all([(e=t.provider)==null?void 0:e.request({method:"eth_accounts"}),(n=t.provider)==null?void 0:n.request({method:"eth_chainId"}).then(r=>Number(r))]);return{accounts:i,chainId:s}}catch(i){return console.warn(`Failed to fetch provider data for ${t.name}`,i),{accounts:[],chainId:void 0}}},getFilteredCustomWallets(t){const e=He.getRecentWallets(),n=Oe.state.connectors.map(o=>{var a;return(a=o.info)==null?void 0:a.rdns}
165).filter(Boolean),i=e.map(o=>o.rdns).filter(Boolean),s=n.concat(i);if(s.includes("io.metamask.mobile")&&Ue.isMobile()){const o=s.indexOf("io.metamask.mobile");s[o]="io.metamask"}return t.filter(o=>!s.includes(String(o==null?void 0:o.rdns)))},hasWalletConnector(t){return Oe.state.connectors.some(e=>e.id===t.id||e.name===t.name)},isWalletCompatibleWithCurrentChain(t){const e=ne.state.activeChain;return e&&t.chains?t.chains.some(n=>{const i=n.split(":")[0];return e===i}):!0},getFilteredRecentWallets(){return He.getRecentWallets().filter(n=>!Fc.isExcluded(n)).filter(n=>!this.hasWalletConnector(n)).filter(n=>this.isWalletCompatibleWithCurrentChain(n))},getCappedRecommendedWallets(t){const{connectors:e}=Oe.state,{customWallets:n,featuredWalletIds:i}=ye.state,s=e.find(T=>T.id==="walletConnect"),r=e.filter(T=>T.type==="INJECTED"||T.type==="ANNOUNCED"||T.type==="MULTI_CHAIN");if(!s&&!r.length&&!(n!=null&&n.length))return[];const o=dP.isEmailEnabled(),a=dP.isSocialsEnabled(),c=r.filter(T=>T.name!=="Browser Wallet"&&T.name!=="WalletConnect"),l=(i==null?void 0:i.length)||0,d=(n==null?void 0:n.length)||0,h=c.length||0,p=o?1:0,g=a?1:0,b=l+d+h+p+g,C=Math.max(0,4-b);return C<=0?[]:Fc.filterOutDuplicateWallets(t).slice(0,C)},processConnectorsByType(t,e=!0){const n=za.sortConnectorsByExplorerWallet([...t]);return e?n.filter(za.showConnector):n},connectorList(){const t=za.getConnectorsByType(Oe.state.connectors,ut.state.recommended,ut.state.featured),e=this.processConnectorsByType(t.announced.filter(g=>g.id!=="walletConnect")),n=this.processConnectorsByType(t.injected),i=this.processConnectorsByType(t.multiChain.filter(g=>g.name!=="WalletConnect"),!1),s=t.custom,r=t.recent,o=this.processConnectorsByType(t.external.filter(g=>g.id!==we.CONNECTOR_ID.COINBASE_SDK&&g.id!==we.CONNECTOR_ID.BASE_ACCOUNT)),a=t.recommended,c=t.featured,l=za.getConnectorTypeOrder({custom:s,recent:r,announced:e,injected:n,multiChain:i,recommended:a,featured:c,external:o}),d=Oe.state.connectors.find(g=>g.id==="walletConnect"),h=Ue.isMobile(),p=[];for(const g of l)switch(g){case"walletConnect":{!h&&d&&p.push({kind:"connector",subtype:"walletConnect",connector:d});break}case"recent":{za.getFilteredRecentWallets().forEach(w=>p.push({kind:"wallet",subtype:"recent",wallet:w}));break}case"injected":{i.forEach(b=>p.push({kind:"connector",subtype:"multiChain",connector:b})),e.forEach(b=>p.push({kind:"connector",subtype:"announced",connector:b})),n.forEach(b=>p.push({kind:"connector",subtype:"injected",connector:b}));break}
165case"featured":{c.forEach(b=>p.push({kind:"wallet",subtype:"featured",wallet:b}));break}case"custom":{za.getFilteredCustomWallets(s??[]).forEach(w=>p.push({kind:"wallet",subtype:"custom",wallet:w}));break}case"external":{o.forEach(b=>p.push({kind:"connector",subtype:"external",connector:b}));break}case"recommended":{za.getCappedRecommendedWallets(a).forEach(w=>p.push({kind:"wallet",subtype:"recommended",wallet:w}));break}default:console.warn(`Unknown connector type: ${g}`)}return p},hasInjectedConnectors(){return Oe.state.connectors.filter(t=>(t.type==="INJECTED"||t.type==="ANNOUNCED"||t.type==="MULTI_CHAIN")&&t.name!=="Browser Wallet"&&t.name!=="WalletConnect").length}},Fc={filterOutDuplicatesByRDNS(t){const e=ye.state.enableEIP6963?Oe.state.connectors:[],n=He.getRecentWallets(),i=e.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),s=n.map(a=>a.rdns).filter(Boolean),r=i.concat(s);if(r.includes("io.metamask.mobile")&&Ue.isMobile()){const a=r.indexOf("io.metamask.mobile");r[a]="io.metamask"}return t.filter(a=>!(a!=null&&a.rdns&&r.includes(String(a.rdns))||!(a!=null&&a.rdns)&&e.some(l=>l.name===a.name)))},filterOutDuplicatesByIds(t){const e=Oe.state.connectors.filter(a=>a.type==="ANNOUNCED"||a.type==="INJECTED"||a.type==="MULTI_CHAIN"),n=He.getRecentWallets(),i=e.map(a=>{var c;return a.explorerId||((c=a.explorerWallet)==null?void 0:c.id)||a.id}),s=n.map(a=>a.id),r=i.concat(s);return t.filter(a=>!r.includes(a==null?void 0:a.id))},filterOutDuplicateWallets(t){const e=this.filterOutDuplicatesByRDNS(t);return this.filterOutDuplicatesByIds(e)},markWalletsAsInstalled(t){const{connectors:e}=Oe.state,{featuredWalletIds:n}=ye.state,i=e.filter(o=>o.type==="ANNOUNCED").reduce((o,a)=>{var c;return(c=a.info)!=null&&c.rdns&&(o[a.info.rdns]=!0),o},{});return t.map(o=>({...o,installed:!!o.rdns&&!!i[o.rdns??""]})).sort((o,a)=>{const c=Number(a.installed)-Number(o.installed);if(c!==0)return c;if(n!=null&&n.length){const l=n.indexOf(o.id),d=n.indexOf(a.id);if(l!==-1&&d!==-1)return l-d;if(l!==-1)return-1;if(d!==-1)return 1}return 0})},getConnectOrderMethod(t,e){var c;const n=(t==null?void 0:t.connectMethodsOrder)||((c=ye.state.features)==null?void 0:c.connectMethodsOrder),i=e||Oe.state.connectors;if(n)return n;const{injected:s,announced:r}=za.getConnectorsByType(i,ut.state.recommended,ut.state.featured),o=s.filter(za.showConnector),a=r.filter(za.showConnector);return o.length||a.length?["wallet","email","social"]:fn.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(t){const e=!!t.rdns&&ut.state.excludedWallets.some(i=>i.rdns===t.rdns),n=!!t.name&&ut.state.excludedWallets.some(i=>Tte.isLowerCaseMatch(i.name,t.name));return e||n},markWalletsWithDisplayIndex(t){return t.map((e,n)=>({...e,display_index:n}))},filterWalletsByWcSupport(t){return Ve.state.wcBasic?t.filter(e=>e.supports_wc):Ue.isMobile()?t.filter(e=>e.supports_wc||fn.MANDATORY_WALLET_IDS_ON_MOBILE.includes(e.id)):t},getWalletConnectWallets(t){var r;const e=[...ut.state.featured,...ut.state.recommended];((r=ut.state.filteredWallets)==null?void 0:r.length)>0?e.push(...ut.state.filteredWallets):e.push(...t);const n=Ue.uniqueBy(e,"id"),i=Fc.markWalletsAsInstalled(n),s=Fc.filterWalletsByWcSupport(i);return Fc.markWalletsWithDisplayIndex(s)}},LUe={},$Ue=(t,e)=>{const n=M.useRef(void 0);M.useEffect(()=>{n.current=D5e(t,e)}),M.useDebugValue(n.current)},UUe=$Ue,BUe=new WeakMap;function oI(t,e){const i=M.useMemo(()=>t&&new WeakMap,[t]),s=M.useRef(void 0);let r=!0;const o=M.useSyncExternalStore(M.useCallback(c=>{const l=or(t,c);return c(),l},[t,void 0]),()=>{const c=kg(t);try{if(!r&&s.current&&!Ste(s.current,c,i,new WeakMap))return s.current}catch{}return c},()=>kg(t));r=!1,M.useLayoutEffect(()=>{s.current=o}),(LUe?"production":void 0)!=="production"&&UUe(o,i);const a=M.useMemo(()=>new WeakMap,[]);return _te(o,i,a,BUe)}function FUe(){try{return Ue.returnOpenHref(`${we.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes")}catch{throw new Error("Could not open social popup")}}async function jUe(){Pe.push("ConnectingFarcaster");const t=Oe.getAuthConnector();if(t){const e=ne.getAccountData();if(!(e!=null&&e.farcasterUrl))try{const{url:n}=await t.provider.getFarcasterUri();ne.setAccountProp("farcasterUrl",n,ne.state.activeChain)}catch(n){Pe.goBack(),ti.showError(n)}}}async function VUe(t){Pe.push("ConnectingSocial");const e=Oe.getAuthConnector();let n=null;try{const i=setTimeout(()=>{throw new Error("Social login timed out. Please try again.")},45e3);if(e&&t){if(Ue.isTelegram()||(n=FUe()),n)ne.setAccountProp("socialWindow",eb(n),ne.state.activeChain);else if(!Ue.isTelegram())throw new Error("Could not create social popup");const{uri:s}=await e.provider.getSocialRedirectUri({provider:t});if(!s)throw n==null||n.close(),new Error("Could not fetch the social redirect uri");if(n&&(n.location.href=s),Ue.isTelegram()){He.setTelegramSocialProvider(t);const r=Ue.formatTelegramSocialLoginUrl(s);Ue.openHref(r,"_top")}clearTimeout(i)}}catch(i){n==null||n.close();const s=Ue.parseError(i);ti.showError(s),Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:t,message:s}})}}async function WUe(t){ne.setAccountProp("socialProvider",t,ne.state.activeChain),Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:t}}),t==="farcaster"?await jUe():await VUe(t)}function qUe(){const{activeCaipNetwork:t}
165=oI(ne.state);return{caipNetwork:t,chainId:t==null?void 0:t.id,caipNetworkId:t==null?void 0:t.caipNetworkId}}function zUe(t){var l;const e=oI(ne.state),{activeConnectorIds:n}=oI(Oe.state),i=e.activeChain;if(!i)return{allAccounts:[],address:void 0,caipAddress:void 0,status:void 0,isConnected:!1,embeddedWalletInfo:void 0};const s=(l=e.chains.get(i))==null?void 0:l.accountState,r=Oe.getAuthConnector(i),o=n[i];return{allAccounts:Ve.getConnections(i).flatMap(d=>d.accounts.map(({address:h,type:p,publicKey:g})=>Ue.createAccount(i,h,p||"eoa",g))),caipAddress:s==null?void 0:s.caipAddress,address:Ue.getPlainAddress(s==null?void 0:s.caipAddress),isConnected:!!(s!=null&&s.caipAddress),status:s==null?void 0:s.status,embeddedWalletInfo:r&&o===we.CONNECTOR_ID.AUTH?{user:s!=null&&s.user?{...s.user,username:He.getConnectedSocialUsername()}:void 0,authProvider:(s==null?void 0:s.socialProvider)||"email",accountType:s==null?void 0:s.preferredAccountType,isSmartAccountDeployed:!!(s!=null&&s.smartAccountDeployed)}:void 0}}const Fo={METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:we.CHAIN.EVM,ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"AUTH",getSDKVersionWarningMessage(t,e){return` 166 @@@@@@@ @@@@@@@@@@@@@@@@@@ 167 @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@ 168 @@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ 169 @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@ 170 @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@ @@@@@@@@@@@ 171 @@@@@@@@@@@@@@@ @@@@@@@@@@@@@ @@@@@@@@@@@@ 172 @@@@@@@@@@@@@@@ @@@@@@@@@@@@@ @@@@@@@@@@@@@ 173 @@@@@@@@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@@@@@@ 174 @@@@@@ @@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@ 175 @@@@@@ @@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@@ 176 @@@@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@@@@@@ 177 @@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@ 178 @@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ 179 @@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@ 180 @@@@@ @@@@@@@@@@@@@@@@@@ 181 182AppKit SDK version ${t} is outdated. Latest version is ${e}. Please update to the latest version for bug fixes and new features. 183 184Changelog: https://github.com/reown-com/appkit/releases 185NPM Registry: https://www.npmjs.com/package/@reown/appkit`}},HUe={NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900",2741:"fc2427d1-5af9-4a9c-8da5-6f94627cd900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200","00000008819873e925422c1ff0f99f7c":"b3406e4a-bbfc-44fb-e3a6-89673c78b700","-239":"20f673c0-095e-49b2-07cf-eb5049dcf600","-3":"20f673c0-095e-49b2-07cf-eb5049dcf600"}},tr={getCaipTokens(t){if(!t)return;const e={};return Object.entries(t).forEach(([n,i])=>{e[`${Fo.EIP155}:${n}`]=i}),e},isLowerCaseMatch(t,e){return(t==null?void 0:t.toLowerCase())===(e==null?void 0:e.toLowerCase())},getActiveNamespaceConnectedToAuth(){const t=ne.state.activeChain;return we.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(e=>Oe.getConnectorId(e)===we.CONNECTOR_ID.AUTH&&e===t)},withRetry({conditionFn:t,intervalMs:e,maxRetries:n}){let i=0;return new Promise(s=>{async function r(){return i+=1,await t()?s(!0):i>=n?s(!1):(setTimeout(r,e),null)}r()})},userChainIdToChainNamespace(t){if(typeof t=="number")return we.CHAIN.EVM;const[e]=t.split(":");return e},getOtherAuthNamespaces(t){return t?we.AUTH_CONNECTOR_SUPPORTED_CHAINS.filter(i=>i!==t):[]},getConnectorStorageInfo(t,e){const i=He.getConnections()[e]??[];return{hasDisconnected:He.isConnectorDisconnected(t,e),hasConnected:i.some(s=>tr.isLowerCaseMatch(s.connectorId,t))}}},GUe=new AbortController,ys={EmbeddedWalletAbortController:GUe,UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"ORIGIN_NOT_ALLOWED"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"}
185,INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{code:"APKT001",displayMessage:"Network Not Found",debugMessage:"The specified network is not recognized. Please ensure it is included in the `networks` array of your `createAppKit` configuration."},ORIGIN_NOT_ALLOWED:{code:"APKT002",displayMessage:"Invalid App Configuration",debugMessage:()=>`The origin ${e3()?window.origin:"unknown"} is not in your allow list. Please update your allowed domains at https://dashboard.reown.com. [PID: ${ye.state.projectId}]`},IFRAME_LOAD_FAILED:{code:"APKT003",displayMessage:"Network Error: Wallet Load Failed",debugMessage:()=>"Failed to load the embedded wallet. This may be due to network issues or server downtime. Please check your network connection and try again shortly. Contact support if the issue persists."},IFRAME_REQUEST_TIMEOUT:{code:"APKT004",displayMessage:"Wallet Request Timeout",debugMessage:()=>"The request to the embedded wallet timed out. Please check your network connection and try again shortly. Contact support if the issue persists."},UNVERIFIED_DOMAIN:{code:"APKT005",displayMessage:"Unverified Domain",debugMessage:()=>"Embedded wallet load failed. Ensure your domain is verified in https://dashboard.reown.com."},JWT_TOKEN_NOT_VALID:{code:"APKT006",displayMessage:"Session Expired",debugMessage:"Your session is invalid or expired. Please check your systemâs date and time settings, then reconnect."},INVALID_PROJECT_ID:{code:"APKT007",displayMessage:"Invalid Project ID",debugMessage:"The specified project ID is invali
185d. Please visit https://dashboard.reown.com to obtain a valid project ID."},PROJECT_ID_NOT_CONFIGURED:{code:"APKT008",displayMessage:"Project ID Missing",debugMessage:"No project ID is configured. You can create and configure a project ID at https://dashboard.reown.com."},SERVER_ERROR_APP_CONFIGURATION:{code:"APKT009",displayMessage:"Server Error",debugMessage:t=>`Unable to fetch App Configuration. ${t}. Please check your network connection and try again shortly. Contact support if the issue persists.`},RATE_LIMITED_APP_CONFIGURATION:{code:"APKT010",displayMessage:"Rate Limited",debugMessage:"You have been rate limited while retrieving App Configuration. Please wait a few minutes and try again. Contact support if the issue persists."}},ALERT_WARNINGS:{LOCAL_CONFIGURATION_IGNORED:{debugMessage:t=>`[Reown Config Notice] ${t}`},INACTIVE_NAMESPACE_NOT_CONNECTED:{code:"APKTW001",displayMessage:"Inactive Namespace Not Connected",debugMessage:(t,e)=>`An error occurred while connecting an inactive namespace ${t}: "${e}"`},INVALID_EMAIL:{code:"APKTW002",displayMessage:"Invalid Email Address",debugMessage:"Please enter a valid email address"}}},Yse={TOKEN_ADDRESSES_BY_SYMBOL:{USDC:{8453:Gse.asset,84532:CUe.asset}},getTokenSymbolByAddress(t){if(!t)return;const[e]=Object.entries(Yse.TOKEN_ADDRESSES_BY_SYMBOL).find(([n,i])=>Object.values(i).includes(t))??[];return e}},KUe={createLogger(t,e="error"){const n=HO({level:e}),{logger:i}=aS({opts:n});return i.error=(...s)=>{for(const r of s)if(r instanceof Error){t(r,...s);return}t(void 0,...s)},i}},YUe="rpc.walletconnect.org";function hH(t,e){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",t),n.searchParams.set("projectId",e),n.toString()}const Z7=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:56","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","eip155:80094","eip155:80069","eip155:560048","eip155:31","eip155:2818","eip155:57054","eip155:911867","eip155:534351","eip155:1112","eip155:534352","eip155:1111","eip155:146","eip155:130","eip155:1284","eip155:30","eip155:2810","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],xu={extendRpcUrlWithProjectId(t,e){let n=!1;try{n=new URL(t).host===YUe}catch{n=!1}if(n){const i=new URL(t);return i.searchParams.has("projectId")||i.searchParams.set("projectId",e),i.toString()}return t},isCaipNetwork(t){return"chainNamespace"in t&&"caipNetworkId"in t},getChainNamespace(t){return this.isCaipNetwork(t)?t.chainNamespace:we.CHAIN.EVM},getCaipNetworkId(t){return this.isCaipNetwork(t)?t.caipNetworkId:`${we.CHAIN.EVM}:${t.id}`},getDefaultRpcUrl(t,e,n){var s,r,o;const i=(o=(r=(s=t.rpcUrls)==null?void 0:s.default)==null?void 0:r.http)==null?void 0:o[0];return Z7.includes(e)?hH(e,n):i||""},extendCaipNetwork(t,{customNetworkImageUrls:e,projectId:n,customRpcUrls:i}){var p,g,b,w,C,E,T;const s=this.getChainNamespace(t),r=this.getCaipNetworkId(t),o=(b=(g=(p=t.rpcUrls)==null?void 0:p.default)==null?void 0:g.http)==null?void 0:b[0],a=this.getDefaultRpcUrl(t,r,n),c=((E=(C=(w=t==null?void 0:t.rpcUrls)==null?void 0:w.chainDefault)==null?void 0:C.http)==null?void 0:E[0])||o,l=((T=i==null?void 0:i[r])==null?void 0:T.map(A=>A.url))||[],d=[...l,...a?[a]:[]],h=[...l];return c&&!h.includes(c)&&h.push(c),{...t,chainNamespace:s,caipNetworkId:r,assets:{imageId:HUe.NetworkImageIds[t.id],imageUrl:e==null?void 0:e[t.id]},rpcUrls:{...t.rpcUrls,default:{http:d},chainDefault:{http:h}}}},extendCaipNetworks(t,{customNetworkImageUrls:e,projectId:n,customRpcUrls:i}){return t.map(s=>xu.extendCaipNetwork(s,{customNetworkImageUrls:e,customRpcUrls:i,projectId:n}))}
185,getViemTransport(t,e,n){var s,r,o;const i=[];return n==null||n.forEach(a=>{i.push(ip(a.url,a.config))}),Z7.includes(t.caipNetworkId)&&i.push(ip(hH(t.caipNetworkId,e),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),(o=(r=(s=t==null?void 0:t.rpcUrls)==null?void 0:s.default)==null?void 0:r.http)==null||o.forEach(a=>{i.push(ip(a))}),dV(i)},extendWagmiTransports(t,e,n){if(Z7.includes(t.caipNetworkId)){const i=this.getDefaultRpcUrl(t,t.caipNetworkId,e);return dV([n,ip(i)])}return n},getUnsupportedNetwork(t){return{id:t.split(":")[1],caipNetworkId:t,name:we.UNSUPPORTED_NETWORK_NAME,chainNamespace:t.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}},getCaipNetworkFromStorage(t){var c;const e=He.getActiveCaipNetworkId(),n=ne.getAllRequestedCaipNetworks(),i=Array.from(((c=ne.state.chains)==null?void 0:c.keys())||[]),s=e==null?void 0:e.split(":")[0],r=s?i.includes(s):!1,o=n==null?void 0:n.find(l=>l.caipNetworkId===e);return r&&!o&&e?this.getUnsupportedNetwork(e):o||t||(n==null?void 0:n[0])}};class pg{constructor(){}static getInstance({projectId:e,chainId:n,enableLogger:i,onTimeout:s,abortController:r,getActiveCaipNetwork:o,getCaipNetworks:a}){var h;const{metadata:c,sdkVersion:l,sdkType:d}=ye.getSnapshot();return pg.instance||(pg.instance=new Wte({projectId:e,chainId:n,enableLogger:i,onTimeout:s,abortController:r,getActiveCaipNetwork:o,getCaipNetworks:a,enableCloudAuthAccount:!!((h=ye.state.remoteFeatures)!=null&&h.emailCapture),metadata:c,sdkVersion:l,sdkType:d})),pg.instance}}const N_={interpolate(t,e,n){if(t.length!==2||e.length!==2)throw new Error("inputRange and outputRange must be an array of length 2");const i=t[0]||0,s=t[1]||0,r=e[0]||0,o=e[1]||0;return n<i?r:n>s?o:(o-r)/(s-i)*(n-i)+r}};/** 186 * @license 187 * Copyright 2019 Google LLC 188 * SPDX-License-Identifier: BSD-3-Clause 189 */const bE=globalThis,kM=bE.ShadowRoot&&(bE.ShadyCSS===void 0||bE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,NM=Symbol(),fH=new WeakMap;let Zse=class{constructor(e,n,i){if(this._$cssResult$=!0,i!==NM)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o;const n=this.t;if(kM&&e===void 0){const i=n!==void 0&&n.length===1;i&&(e=fH.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&fH.set(n,e))}return e}toString(){return this.cssText}};const du=t=>new Zse(typeof t=="string"?t:t+"",void 0,NM),os=(t,...e)=>{const n=t.length===1?t[0]:e.reduce(((i,s,r)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1]),t[0]);return new Zse(n,t,NM)},ZUe=(t,e)=>{if(kM)t.adoptedStyleSheets=e.map((n=>n instanceof CSSStyleSheet?n:n.styleSheet));else for(const n of e){const i=document.createElement("style"),s=bE.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=n.cssText,t.appendChild(i)}},pH=kM?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(const i of e.cssRules)n+=i.cssText;return du(n)})(t):t;/** 190 * @license 191 * Copyright 2017 Google LLC 192 * SPDX-License-Identifier: BSD-3-Clause 193 */const{is:QUe,defineProperty:XUe,getOwnPropertyDescriptor:JUe,getOwnPropertyNames:eBe,getOwnPropertySymbols:tBe,getPrototypeOf:nBe}=Object,hp=globalThis,mH=hp.trustedTypes,iBe=mH?mH.emptyScript:"",Q7=hp.reactiveElementPolyfillSupport,w3=(t,e)=>t,R_={toAttribute(t,e){switch(e){case Boolean:t=t?iBe:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},RM=(t,e)=>!QUe(t,e),gH={attribute:!0,type:String,converter:R_,reflect:!1,useDefault:!1,hasChanged:RM};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),hp.litPropertyMetadata??(hp.litPropertyMetadata=new WeakMap);let qy=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}
vendor: 2,040 bytes, line 193
193static createProperty(e,n=gH){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,n);s!==void 0&&XUe(this.prototype,e,s)}}static getPropertyDescriptor(e,n,i){const{get:s,set:r}=JUe(this.prototype,e)??{get(){return this[n]},set(o){this[n]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);r==null||r.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??gH}static _$Ei(){if(this.hasOwnProperty(w3("elementProperties")))return;const e=nBe(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(w3("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(w3("properties"))){const n=this.properties,i=[...eBe(n),...tBe(n)];for(const s of i)this.createProperty(s,n[s])}const e=this[Symbol.metadata];if(e!==null){const n=litPropertyMetadata.get(e);if(n!==void 0)for(const[i,s]of n)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[n,i]of this.elementProperties){const s=this._$Eu(n,i);s!==void 0&&this._$Eh.set(s,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const n=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const s of i)n.unshift(pH(s))}else e!==void 0&&n.push(pH(e));return n}static _$Eu(e,n){const i=n.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise((n=>this.enableUpdating=n)),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach((n=>n(this)))}addController(e){var n;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)==null||n.call(e))}
vendor: 4,297 bytes, lines 193-199
193removeController(e){var n;(n=this._$EO)==null||n.delete(e)}_$E_(){const e=new Map,n=this.constructor.elementProperties;for(const i of n.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ZUe(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach((n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)}))}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach((n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)}))}attributeChangedCallback(e,n,i){this._$AK(e,i)}_$ET(e,n){var r;const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:R_).toAttribute(n,i.type);this._$Em=e,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,n){var r,o;const i=this.constructor,s=i._$Eh.get(e);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((r=a.converter)==null?void 0:r.fromAttribute)!==void 0?a.converter:R_;this._$Em=s;const l=c.fromAttribute(n,a.type);this[s]=l??((o=this._$Ej)==null?void 0:o.get(s))??l,this._$Em=null}}requestUpdate(e,n,i){var s;if(e!==void 0){const r=this.constructor,o=this[e];if(i??(i=r.getPropertyOptions(e)),!((i.hasChanged??RM)(o,n)||i.useDefault&&i.reflect&&o===((s=this._$Ej)==null?void 0:s.get(e))&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,o??n??this[e]),r!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||i||(n=void 0),this._$AL.set(e,n)),s===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s){const{wrapped:a}=o,c=this[r];a!==!0||this._$AL.has(r)||c===void 0||this.C(r,void 0,o,c)}}let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),(i=this._$EO)==null||i.forEach((s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)})),this.update(n)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(n)}willUpdate(e){}_$AE(e){var n;(n=this._$EO)==null||n.forEach((i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach((n=>this._$ET(n,this[n])))),this._$EM()}updated(e){}firstUpdated(e){}};qy.elementStyles=[],qy.shadowRootOptions={mode:"open"},qy[w3("elementProperties")]=new Map,qy[w3("finalized")]=new Map,Q7==null||Q7({ReactiveElement:qy}),(hp.reactiveElementVersions??(hp.reactiveElementVersions=[])).push("2.1.1");/** 194 * @license 195 * Copyright 2017 Google LLC 196 * SPDX-License-Identifier: BSD-3-Clause 197 */const v3=globalThis,P_=v3.trustedTypes,yH=P_?P_.createPolicy("lit-html",{createHTML:t=>t}):void 0,Qse="$lit$",G0=`lit$${Math.random().toFixed(9).slice(2)}$`,Xse="?"+G0,sBe=`<${Xse}>`,Lg=document,N5=()=>Lg.createComment(""),R5=t=>t===null||typeof t!="object"&&typeof t!="function",PM=Array.isArray,rBe=t=>PM(t)||typeof(t==null?void 0:t[Symbol.iterator])=="function",X7=`[ 198\f\r]`,Vv=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bH=/-->/g,wH=/>/g,vm=RegExp(`>|${X7}(?:([^\\s"'>=/]+)(${X7}*=${X7}*(?:[^ 199\f\r"'\`<>=]|("|')|))|$)`,"g"),vH=/'/g,CH=/"/g,Jse=/^(?:script|style|textarea|title)$/i,ere=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}
vendor: 14,509 bytes, lines 199-203
199),se=ere(1),Tn=ere(2),$g=Symbol.for("lit-noChange"),ir=Symbol.for("lit-nothing"),xH=new WeakMap,Gm=Lg.createTreeWalker(Lg,129);function tre(t,e){if(!PM(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return yH!==void 0?yH.createHTML(e):e}const oBe=(t,e)=>{const n=t.length-1,i=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=Vv;for(let a=0;a<n;a++){const c=t[a];let l,d,h=-1,p=0;for(;p<c.length&&(o.lastIndex=p,d=o.exec(c),d!==null);)p=o.lastIndex,o===Vv?d[1]==="!--"?o=bH:d[1]!==void 0?o=wH:d[2]!==void 0?(Jse.test(d[2])&&(s=RegExp("</"+d[2],"g")),o=vm):d[3]!==void 0&&(o=vm):o===vm?d[0]===">"?(o=s??Vv,h=-1):d[1]===void 0?h=-2:(h=o.lastIndex-d[2].length,l=d[1],o=d[3]===void 0?vm:d[3]==='"'?CH:vH):o===CH||o===vH?o=vm:o===bH||o===wH?o=Vv:(o=vm,s=void 0);const g=o===vm&&t[a+1].startsWith("/>")?" ":"";r+=o===Vv?c+sBe:h>=0?(i.push(l),c.slice(0,h)+Qse+c.slice(h)+G0+g):c+G0+(h===-2?a:g)}return[tre(t,r+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};let aI=class nre{constructor({strings:e,_$litType$:n},i){let s;this.parts=[];let r=0,o=0;const a=e.length-1,c=this.parts,[l,d]=oBe(e,n);if(this.el=nre.createElement(l,i),Gm.currentNode=this.el.content,n===2||n===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(s=Gm.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const h of s.getAttributeNames())if(h.endsWith(Qse)){const p=d[o++],g=s.getAttribute(h).split(G0),b=/([.?@])?(.*)/.exec(p);c.push({type:1,index:r,name:b[2],strings:g,ctor:b[1]==="."?cBe:b[1]==="?"?lBe:b[1]==="@"?uBe:AS}),s.removeAttribute(h)}else h.startsWith(G0)&&(c.push({type:6,index:r}),s.removeAttribute(h));if(Jse.test(s.tagName)){const h=s.textContent.split(G0),p=h.length-1;if(p>0){s.textContent=P_?P_.emptyScript:"";for(let g=0;g<p;g++)s.append(h[g],N5()),Gm.nextNode(),c.push({type:2,index:++r});s.append(h[p],N5())}}}else if(s.nodeType===8)if(s.data===Xse)c.push({type:2,index:r});else{let h=-1;for(;(h=s.data.indexOf(G0,h+1))!==-1;)c.push({type:7,index:r}),h+=G0.length-1}r++}}static createElement(e,n){const i=Lg.createElement("template");return i.innerHTML=e,i}};function ob(t,e,n=t,i){var o,a;if(e===$g)return e;let s=i!==void 0?(o=n._$Co)==null?void 0:o[i]:n._$Cl;const r=R5(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(t),s._$AT(t,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=s:n._$Cl=s),s!==void 0&&(e=ob(t,s._$AS(t,e.values),s,i)),e}let aBe=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:n},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??Lg).importNode(n,!0);Gm.currentNode=s;let r=Gm.nextNode(),o=0,a=0,c=i[0];for(;c!==void 0;){if(o===c.index){let l;c.type===2?l=new IM(r,r.nextSibling,this,e):c.type===1?l=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(l=new dBe(r,this,e)),this._$AV.push(l),c=i[++a]}o!==(c==null?void 0:c.index)&&(r=Gm.nextNode(),o++)}return Gm.currentNode=Lg,s}p(e){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,n),n+=i.strings.length-2):i._$AI(e[n])),n++}},IM=class ire{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,n,i,s){this.type=2,this._$AH=ir,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=ob(this,e,n),R5(e)?e===ir||e==null||e===""?(this._$AH!==ir&&this._$AR(),this._$AH=ir):e!==this._$AH&&e!==$g&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):rBe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ir&&R5(this._$AH)?this._$AA.nextSibling.data=e:this.T(Lg.createTextNode(e)),this._$AH=e}$(e){var r;const{values:n,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=aI.createElement(tre(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(n);else{const o=new aBe(s,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}_$AC(e){let n=xH.get(e.strings);return n===void 0&&xH.set(e.strings,n=new aI(e)),n}k(e){PM(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,s=0;for(const r of e)s===n.length?n.push(i=new ire(this.O(N5()),this.O(N5()),this,this.options)):i=n[s],i._$AI(r),s++;s<n.length&&(this._$AR(i&&i._$AB.nextSibling,s),n.length=s)}_$AR(e=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var n;this._$AM===void 0&&(this._$Cv=e,(n=this._$AP)==null||n.call(this,e))}},AS=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,i,s,r){this.type=1,this._$AH=ir,this._$AN=void 0,this.element=e,this.name=n,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=ir}_$AI(e,n=this,i,s){const r=this.strings;let o=!1;if(r===void 0)e=ob(this,e,n,0),o=!R5(e)||e!==this._$AH&&e!==$g,o&&(this._$AH=e);else{const a=e;let c,l;for(e=r[0],c=0;c<r.length-1;c++)l=ob(this,a[i+c],n,c),l===$g&&(l=this._$AH[c]),o||(o=!R5(l)||l!==this._$AH[c]),l===ir?e=ir:e!==ir&&(e+=(l??"")+r[c+1]),this._$AH[c]=l}o&&!s&&this.j(e)}j(e){e===ir?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},cBe=class extends AS{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ir?void 0:e}},lBe=class extends AS{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ir)}},uBe=class extends AS{constructor(e,n,i,s,r){super(e,n,i,s,r),this.type=5}_$AI(e,n=this){if((e=ob(this,e,n,0)??ir)===$g)return;const i=this._$AH,s=e===ir&&i!==ir||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==ir&&(i===ir||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,e):this._$AH.handleEvent(e)}},dBe=class{constructor(e,n,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){ob(this,e)}};const J7=v3.litHtmlPolyfillSupport;J7==null||J7(aI,IM),(v3.litHtmlVersions??(v3.litHtmlVersions=[])).push("3.3.1");const hBe=(t,e,n)=>{const i=(n==null?void 0:n.renderBefore)??e;let s=i._$litPart$;if(s===void 0){const r=(n==null?void 0:n.renderBefore)??null;i._$litPart$=s=new IM(e.insertBefore(N5(),r),r,void 0,n??{})}return s._$AI(t),s};/** 200 * @license 201 * Copyright 2017 Google LLC 202 * SPDX-License-Identifier: BSD-3-Clause 203 */const mg=globalThis;let tt=class extends qy{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const e=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=e.firstChild),e}update(e){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=hBe(n,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return $g}};var FY;tt._$litElement$=!0,tt.finalized=!0,(FY=mg.litElementHydrateSupport)==null||FY.call(mg,{LitElement:tt});const ek=mg.litElementPolyfillSupport;ek==null||ek({LitElement:tt});(mg.litElementVersions??(mg.litElementVersions=[])).push("4.2.1");const fBe={black:"#202020",white:"#FFFFFF",white010:"rgba(255, 255, 255, 0.1)",accent010:"rgba(9, 136, 240, 0.1)",accent020:"rgba(9, 136, 240, 0.2)",accent030:"rgba(9, 136, 240, 0.3)",accent040:"rgba(9, 136, 240, 0.4)",accent050:"rgba(9, 136, 240, 0.5)",accent060:"rgba(9, 136, 240, 0.6)",accent070:"rgba(9, 136, 240, 0.7)",accent080:"rgba(9, 136, 240, 0.8)",accent090:"rgba(9, 136, 240, 0.9)",accent100:"rgba(9, 136, 240, 1.0)",accentSecondary010:"rgba(199, 185, 148, 0.1)",accentSecondary020:"rgba(199, 185, 148, 0.2)",accentSecondary030:"rgba(199, 185, 148, 0.3)",accentSecondary040:"rgba(199, 185, 148, 0.4)",accentSecondary050:"rgba(199, 185, 148, 0.5)",accentSecondary060:"rgba(199, 185, 148, 0.6)",accentSecondary070:"rgba(199, 185, 148, 0.7)",accentSecondary080:"rgba(199, 185, 148, 0.8)",accentSecondary090:"rgba(199, 185, 148, 0.9)",accentSecondary100:"rgba(199, 185, 148, 1.0)",productWalletKit:"#FFB800",productAppKit:"#FF573B",productCloud:"#0988F0",productDocumentation:"#008847",neutrals050:"#F6F6F6",neutrals100:"#F3F3F3",neutrals200:"#E9E9E9",neutrals300:"#D0D0D0",neutrals400:"#BBB",neutrals500:"#9A9A9A",neutrals600:"#6C6C6C",neutrals700:"#4F4F4F",neutrals800:"#363636",neutrals900:"#2A2A2A",neutrals1000:"#252525",semanticSuccess010:"rgba(48, 164, 107, 0.1)",semanticSuccess020:"rgba(48, 164, 107, 0.2)",semanticSuccess030:"rgba(48, 164, 107, 0.3)",semanticSuccess040:"rgba(48, 164, 107, 0.4)",semanticSuccess050:"rgba(48, 164, 107, 0.5)",semanticSuccess060:"rgba(48, 164, 107, 0.6)",semanticSuccess070:"rgba(48, 164, 107, 0.7)",semanticSuccess080:"rgba(48, 164, 107, 0.8)",semanticSuccess090:"rgba(48, 164, 107, 0.9)",semanticSuccess100:"rgba(48, 164, 107, 1.0)",semanticError010:"rgba(223, 74, 52, 0.1)",semanticError020:"rgba(223, 74, 52, 0.2)",semanticError030:"rgba(223, 74, 52, 0.3)",semanticError040:"rgba(223, 74, 52, 0.4)",semanticError050:"rgba(223, 74, 52, 0.5)",semanticError060:"rgba(223, 74, 52, 0.6)",semanticError070:"rgba(223, 74, 52, 0.7)",semanticError080:"rgba(223, 74, 52, 0.8)",semanticError090:"rgba(223, 74, 52, 0.9)",semanticError100:"rgba(223, 74, 52, 1.0)",semanticWarning010:"rgba(243, 161, 63, 0.1)",semanticWarning020:"rgba(243, 161, 63, 0.2)",semanticWarning030:"rgba(243, 161, 63, 0.3)",semanticWarning040:"rgba(243, 161, 63, 0.4)",semanticWarning050:"rgba(243, 161, 63, 0.5)",semanticWarning060:"rgba(243, 161, 63, 0.6)",semanticWarning070:"rgba(243, 161, 63, 0.7)",semanticWarning080:"rgba(243, 161, 63, 0.8)",semanticWarning090:"rgba(243, 161, 63, 0.9)",semanticWarning100:"rgba(243, 161, 63, 1.0)"},I_={core:{backgroundAccentPrimary:"#0988F0",backgroundAccentCertified:"#C7B994",backgroundWalletKit:"#FFB800",backgroundAppKit:"#FF573B",backgroundCloud:"#0988F0",backgroundDocumentation:"#008847",backgroundSuccess:"rgba(48, 164, 107, 0.20)",backgroundError:"rgba(223, 74, 52, 0.20)",backgroundWarning:"rgba(243, 161, 63, 0.20)",textAccentPrimary:"#0988F0",textAccentCertified:"#C7B994",textWalletKit:"#FFB800",textAppKit:"#FF573B",textCloud:"#0988F0",textDocumentation:"#008847",textSuccess:"#30A46B",textError:"#DF4A34",textWarning:"#F3A13F",borderAccentPrimary:"#0988F0",borderSecondary:"#C7B994",borderSuccess:"#30A46B",borderError:"#DF4A34",borderWarning:"#F3A13F",foregroundAccent010:"rgba(9, 136, 240, 0.1)",foregroundAccent020:"rgba(9, 136, 240, 0.2)",foregroundAccent040:"rgba(9, 136, 240, 0.4)",foregroundAccent060:"rgba(9, 136, 240, 0.6)",foregroundSecondary020:"rgba(199, 185, 148, 0.2)",foregroundSecondary040:"rgba(199, 185, 148, 0.4)",foregroundSecondary060:"rgba(199, 185, 148, 0.6)",iconAccentPrimary:"#0988F0",iconAccentCertified:"#C7B994",iconSuccess:"#30A46B",iconError:"#DF4A34",iconWarning:"#F3A13F",glass010:"rgba(255, 255, 255, 0.1)",zIndex:"9999"},dark:{overlay:"rgba(0, 0, 0, 0.50)",backgroundPrimary:"#202020",backgroundInvert:"#FFFFFF",textPrimary:"#FFFFFF",textSecondary:"#9A9A9A",textTertiary:"#BBBBBB",textInvert:"#202020",borderPrimary:"#2A2A2A",borderPrimaryDark:"#363636",borderSecondary:"#4F4F4F",foregroundPrimary:"#252525",foregroundSecondary:"#2A2A2A",foregroundTertiary:"#363636",iconDefault:"#9A9A9A",iconInverse:"#FFFFFF"},light:{overlay:"rgba(230 , 230, 230, 0.5)",backgroundPrimary:"#FFFFFF",borderPrimaryDark:"#E9E9E9",backgroundInvert:"#202020",textPrimary:"#202020",textSecondary:"#9A9A9A",textTertiary:"#6C6C6C",textInvert:"#FFFFFF",borderPrimary:"#E9E9E9",borderSecondary:"#D0D0D0",foregroundPrimary:"#F3F3F3",foregroundSecondary:"#E9E9E9",foregroundTertiary:"#D0D0D0",iconDefault:"#9A9A9A",iconInverse:"#202020"}},pBe={1:"4px",2:"8px",10:"10px",3:"12px",4:"16px",6:"24px",5:"20px",8:"32px",16:"64px",20:"80px",32:"128px",64:"256px",128:"512px",round:"9999px"},mBe={0:"0px","01":"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",12:"48px",14:"56px",16:"64px",20:"80px",32:"128px",64:"256px"},gBe={regular:"KHTeka",mono:"KHTekaMono"},yBe={regular:"400",medium:"500"},bBe={h1:"50px",h2:"44px",h3:"38px",h4:"32px",h5:"26px",h6:"20px",large:"16px",medium:"14px",small:"12px"},wBe={"h1-regular-mono":{lineHeight:"50px",letterSpacing:"-3px"},"h1-regular":{lineHeight:"50px",letterSpacing:"-1px"},"h1-medium":{lineHeight:"50px",letterSpacing:"-0.84px"},"h2-regular-mono":{lineHeight:"44px",letterSpacing:"-2.64px"},"h2-regular":{lineHeight:"44px",letterSpacing:"-0.88px"},"h2-medium":{lineHeight:"44px",letterSpacing:"-0.88px"},"h3-regular-mono":{lineHeight:"38px",letterSpacing:"-2.28px"},"h3-regular":{lineHeight:"38px",letterSpacing:"-0.76px"},"h3-medium":{lineHeight:"38px",letterSpacing:"-0.76px"},"h4-regular-mono":{lineHeight:"32px",letterSpacing:"-1.92px"},"h4-regular":{lineHeight:"32px",letterSpacing:"-0.32px"},"h4-medium":{lineHeight:"32px",letterSpacing:"-0.32px"},"h5-regular-mono":{lineHeight:"26px",letterSpacing:"-1.56px"},"h5-regular":{lineHeight:"26px",letterSpacing:"-0.26px"},"h5-medium":{lineHeight:"26px",letterSpacing:"-0.26px"},"h6-regular-mono":{lineHeight:"20px",letterSpacing:"-1.2px"},"h6-regular":{lineHeight:"20px",letterSpacing:"-0.6px"},"h6-medium":{lineHeight:"20px",letterSpacing:"-0.6px"},"lg-regular-mono":{lineHeight:"16px",letterSpacing:"-0.96px"},"lg-regular":{lineHeight:"18px",letterSpacing:"-0.16px"},"lg-medium":{lineHeight:"18px",letterSpacing:"-0.16px"},"md-regular-mono":{lineHeight:"14px",letterSpacing:"-0.84px"},"md-regular":{lineHeight:"16px",letterSpacing:"-0.14px"},"md-medium":{lineHeight:"16px",letterSpacing:"-0.14px"},"sm-regular-mono":{lineHeight:"12px",letterSpacing:"-0.72px"},"sm-regular":{lineHeight:"14px",letterSpacing:"-0.12px"},"sm-medium":{lineHeight:"14px",letterSpacing:"-0.12px"}}
vendor: 9,007 bytes, lines 203-207
203,vBe={"ease-out-power-2":"cubic-bezier(0.23, 0.09, 0.08, 1.13)","ease-out-power-1":"cubic-bezier(0.12, 0.04, 0.2, 1.06)","ease-in-power-2":"cubic-bezier(0.92, -0.13, 0.77, 0.91)","ease-in-power-1":"cubic-bezier(0.88, -0.06, 0.8, 0.96)","ease-inout-power-2":"cubic-bezier(0.77, 0.09, 0.23, 1.13)","ease-inout-power-1":"cubic-bezier(0.88, 0.04, 0.12, 1.06)"},CBe={xl:"400ms",lg:"200ms",md:"125ms",sm:"75ms"},cI={colors:fBe,fontFamily:gBe,fontWeight:yBe,textSize:bBe,typography:wBe,tokens:{core:I_.core,theme:I_.dark},borderRadius:pBe,spacing:mBe,durations:CBe,easings:vBe},EH="--apkt";function Ex(t){if(!t)return{};const e={};return e["font-family"]=t["--apkt-font-family"]??t["--w3m-font-family"]??"KHTeka",e.accent=t["--apkt-accent"]??t["--w3m-accent"]??"#0988F0",e["color-mix"]=t["--apkt-color-mix"]??t["--w3m-color-mix"]??"#000",e["color-mix-strength"]=t["--apkt-color-mix-strength"]??t["--w3m-color-mix-strength"]??0,e["font-size-master"]=t["--apkt-font-size-master"]??t["--w3m-font-size-master"]??"10px",e["border-radius-master"]=t["--apkt-border-radius-master"]??t["--w3m-border-radius-master"]??"4px",t["--apkt-z-index"]!==void 0?e["z-index"]=t["--apkt-z-index"]:t["--w3m-z-index"]!==void 0&&(e["z-index"]=t["--w3m-z-index"]),e}const Uh={createCSSVariables(t){const e={},n={};function i(r,o,a=""){for(const[c,l]of Object.entries(r)){const d=a?`${a}-${c}`:c;l&&typeof l=="object"&&Object.keys(l).length?(o[c]={},i(l,o[c],d)):typeof l=="string"&&(o[c]=`${EH}-${d}`)}}function s(r,o){for(const[a,c]of Object.entries(r))c&&typeof c=="object"?(o[a]={},s(c,o[a])):typeof c=="string"&&(o[a]=`var(${c})`)}return i(t,e),s(e,n),{cssVariables:e,cssVariablesVarPrefix:n}},assignCSSVariables(t,e){const n={};function i(s,r,o){for(const[a,c]of Object.entries(s)){const l=o?`${o}-${a}`:a,d=r[a];c&&typeof c=="object"?i(c,d,l):typeof d=="string"&&(n[`${EH}-${l}`]=d)}}return i(t,e),n},createRootStyles(t,e){const n={...cI,tokens:{...cI.tokens,theme:t==="light"?I_.light:I_.dark}},{cssVariables:i}=Uh.createCSSVariables(n),s=Uh.assignCSSVariables(i,n),r=Uh.generateW3MVariables(e),o=Uh.generateW3MOverrides(e),a=Uh.generateScaledVariables(e),c=Uh.generateBaseVariables(s),l={...s,...c,...r,...o,...a},d=Uh.applyColorMixToVariables(e,l),h={...l,...d};return`:root {${Object.entries(h).map(([g,b])=>`${g}:${b.replace("/[:;{}</>]/g","")};`).join("")}}`},generateW3MVariables(t){if(!t)return{};const e=Ex(t),n={};return n["--w3m-font-family"]=e["font-family"],n["--w3m-accent"]=e.accent,n["--w3m-color-mix"]=e["color-mix"],n["--w3m-color-mix-strength"]=`${e["color-mix-strength"]}%`,n["--w3m-font-size-master"]=e["font-size-master"],n["--w3m-border-radius-master"]=e["border-radius-master"],n},generateW3MOverrides(t){if(!t)return{};const e=Ex(t),n={};if(t["--apkt-accent"]||t["--w3m-accent"]){const i=e.accent;n["--apkt-tokens-core-iconAccentPrimary"]=i,n["--apkt-tokens-core-borderAccentPrimary"]=i,n["--apkt-tokens-core-textAccentPrimary"]=i,n["--apkt-tokens-core-backgroundAccentPrimary"]=i}return(t["--apkt-font-family"]||t["--w3m-font-family"])&&(n["--apkt-fontFamily-regular"]=e["font-family"]),e["z-index"]!==void 0&&(n["--apkt-tokens-core-zIndex"]=`${e["z-index"]}`),n},generateScaledVariables(t){if(!t)return{};const e=Ex(t),n={};if(t["--apkt-font-size-master"]||t["--w3m-font-size-master"]){const i=parseFloat(e["font-size-master"].replace("px",""));n["--apkt-textSize-h1"]=`${Number(i)*5}px`,n["--apkt-textSize-h2"]=`${Number(i)*4.4}px`,n["--apkt-textSize-h3"]=`${Number(i)*3.8}px`,n["--apkt-textSize-h4"]=`${Number(i)*3.2}px`,n["--apkt-textSize-h5"]=`${Number(i)*2.6}px`,n["--apkt-textSize-h6"]=`${Number(i)*2}px`,n["--apkt-textSize-large"]=`${Number(i)*1.6}px`,n["--apkt-textSize-medium"]=`${Number(i)*1.4}px`,n["--apkt-textSize-small"]=`${Number(i)*1.2}px`}if(t["--apkt-border-radius-master"]||t["--w3m-border-radius-master"]){const i=parseFloat(e["border-radius-master"].replace("px",""));n["--apkt-borderRadius-1"]=`${Number(i)}px`,n["--apkt-borderRadius-2"]=`${Number(i)*2}px`,n["--apkt-borderRadius-3"]=`${Number(i)*3}px`,n["--apkt-borderRadius-4"]=`${Number(i)*4}px`,n["--apkt-borderRadius-5"]=`${Number(i)*5}px`,n["--apkt-borderRadius-6"]=`${Number(i)*6}px`,n["--apkt-borderRadius-8"]=`${Number(i)*8}px`,n["--apkt-borderRadius-16"]=`${Number(i)*16}px`,n["--apkt-borderRadius-20"]=`${Number(i)*20}px`,n["--apkt-borderRadius-32"]=`${Number(i)*32}px`,n["--apkt-borderRadius-64"]=`${Number(i)*64}px`,n["--apkt-borderRadius-128"]=`${Number(i)*128}px`}return n},generateColorMixCSS(t,e){if(!(t!=null&&t["--w3m-color-mix"])||!t["--w3m-color-mix-strength"])return"";const n=t["--w3m-color-mix"],i=t["--w3m-color-mix-strength"];if(!i||i===0)return"";const s=Object.keys(e||{}).filter(o=>{const a=o.includes("-tokens-core-background")||o.includes("-tokens-core-text")||o.includes("-tokens-core-border")||o.includes("-tokens-core-foreground")||o.includes("-tokens-core-icon")||o.includes("-tokens-theme-background")||o.includes("-tokens-theme-text")||o.includes("-tokens-theme-border")||o.includes("-tokens-theme-foreground")||o.includes("-tokens-theme-icon"),c=o.includes("-borderRadius-")||o.includes("-spacing-")||o.includes("-textSize-")||o.includes("-fontFamily-")||o.includes("-fontWeight-")||o.includes("-typography-")||o.includes("-duration-")||o.includes("-ease-")||o.includes("-path-")||o.includes("-width-")||o.includes("-height-")||o.includes("-visual-size-")||o.includes("-modal-width")||o.includes("-cover");return a&&!c});return s.length===0?"":` @supports (background: color-mix(in srgb, white 50%, black)) { 204 :root { 205 ${s.map(o=>{const a=(e==null?void 0:e[o])||"";return a.includes("color-mix")||a.startsWith("#")||a.startsWith("rgb")?`${o}: color-mix(in srgb, ${n} ${i}%, ${a});`:`${o}: color-mix(in srgb, ${n} ${i}%, var(${o}-base, ${a}));`}).join("")} 206 } 207 }`},generateBaseVariables(t){const e={},n=t["--apkt-tokens-theme-backgroundPrimary"];n&&(e["--apkt-tokens-theme-backgroundPrimary-base"]=n);const i=t["--apkt-tokens-core-backgroundAccentPrimary"];return i&&(e["--apkt-tokens-core-backgroundAccentPrimary-base"]=i),e},applyColorMixToVariables(t,e){const n={};e!=null&&e["--apkt-tokens-theme-backgroundPrimary"]&&(n["--apkt-tokens-theme-backgroundPrimary"]="var(--apkt-tokens-theme-backgroundPrimary-base)"),e!=null&&e["--apkt-tokens-core-backgroundAccentPrimary"]&&(n["--apkt-tokens-core-backgroundAccentPrimary"]="var(--apkt-tokens-core-backgroundAccentPrimary-base)");const i=Ex(t),s=i["color-mix"],r=i["color-mix-strength"];if(!r||r===0)return n;const o=Object.keys(e||{}).filter(a=>{const c=a.includes("-tokens-core-background")||a.includes("-tokens-core-text")||a.includes("-tokens-core-border")||a.includes("-tokens-core-foreground")||a.includes("-tokens-core-icon")||a.includes("-tokens-theme-background")||a.includes("-tokens-theme-text")||a.includes("-tokens-theme-border")||a.includes("-tokens-theme-foreground")||a.includes("-tokens-theme-icon")||a.includes("-tokens-theme-overlay"),l=a.includes("-borderRadius-")||a.includes("-spacing-")||a.includes("-textSize-")||a.includes("-fontFamily-")||a.includes("-fontWeight-")||a.includes("-typography-")||a.includes("-duration-")||a.includes("-ease-")||a.includes("-path-")||a.includes("-width-")||a.includes("-height-")||a.includes("-visual-size-")||a.includes("-modal-width")||a.includes("-cover");return c&&!l});return o.length===0||o.forEach(a=>{const c=(e==null?void 0:e[a])||"";a.endsWith("-base")||(a==="--apkt-tokens-theme-backgroundPrimary"||a==="--apkt-tokens-core-backgroundAccentPrimary"?n[a]=`color-mix(in srgb, ${s} ${r}%, var(${a}-base))`:c.includes("color-mix")||c.startsWith("#")||c.startsWith("rgb")?n[a]=`color-mix(in srgb, ${s} ${r}%, ${c})`:n[a]=`color-mix(in srgb, ${s} ${r}%, var(${a}-base, ${c}))`)}),n}},{cssVariablesVarPrefix:Gs}=Uh.createCSSVariables(cI);function It(t,...e){return os(t,...e.map(n=>du(typeof n=="function"?n(Gs):n)))}let Mm,Km,vd,Rc,D_;const Lh={"KHTeka-500-woff2":"https://fonts.reown.com/KHTeka-Medium.woff2","KHTeka-400-woff2":"https://fonts.reown.com/KHTeka-Regular.woff2","KHTeka-300-woff2":"https://fonts.reown.com/KHTeka-Light.woff2","KHTekaMono-400-woff2":"https://fonts.reown.com/KHTekaMono-Regular.woff2","KHTeka-500-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTeka-400-woff":"https://fonts.reown.com/KHTeka-Regular.woff","KHTeka-300-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTekaMono-400-woff":"https://fonts.reown.com/KHTekaMono-Regular.woff"};function O_(t,e="dark"){Mm&&document.head.removeChild(Mm),Mm=document.createElement("style"),Mm.textContent=Uh.createRootStyles(e,t),document.head.appendChild(Mm)}function ent(t,e="dark"){if(D_=t,Km=document.createElement("style"),vd=document.createElement("style"),Rc=document.createElement("style"),Km.textContent=S2(t).core.cssText,vd.textContent=S2(t).dark.cssText,Rc.textContent=S2(t).light.cssText,document.head.appendChild(Km),document.head.appendChild(vd),document.head.appendChild(Rc),O_(t,e),lI(e),!((t==null?void 0:t["--apkt-font-family"])||(t==null?void 0:t["--w3m-font-family"]))
207)for(const[i,s]of Object.entries(Lh)){const r=document.createElement("link");r.rel="preload",r.href=s,r.as="font",r.type=i.includes("woff2")?"font/woff2":"font/woff",r.crossOrigin="anonymous",document.head.appendChild(r)}lI(e)}function lI(t="dark"){vd&&Rc&&Mm&&(t==="light"?(O_(D_,t),vd.removeAttribute("media"),Rc.media="enabled"):(O_(D_,t),Rc.removeAttribute("media"),vd.media="enabled"))}function xBe(t){var e,n,i;if(D_=t,Km&&vd&&Rc){Km.textContent=S2(t).core.cssText,vd.textContent=S2(t).dark.cssText,Rc.textContent=S2(t).light.cssText;const s=(t==null?void 0:t["--apkt-font-family"])||(t==null?void 0:t["--w3m-font-family"]);s&&(Km.textContent=(e=Km.textContent)==null?void 0:e.replace("font-family: KHTeka",`font-family: ${s}`),vd.textContent=(n=vd.textContent)==null?void 0:n.replace("font-family: KHTeka",`font-family: ${s}`),Rc.textContent=(i=Rc.textContent)==null?void 0:i.replace("font-family: KHTeka",`font-family: ${s}`))}if(Mm){const s=(Rc==null?void 0:Rc.media)==="enabled"?"light":"dark";O_(t,s)}}function S2(t){const e=!!(t!=null&&t["--apkt-font-family"]||t!=null&&t["--w3m-font-family"]);return{core:os` 208 ${e?os``:os` 209 @font-face { 210 font-family: 'KHTeka'; 211 src: 212 url(${du(Lh["KHTeka-400-woff2"])}) format('woff2'), 213 url(${du(Lh["KHTeka-400-woff"])}) format('woff'); 214 font-weight: 400; 215 font-style: normal; 216 font-display: swap; 217 } 218 219 @font-face { 220 font-family: 'KHTeka'; 221 src: 222 url(${du(Lh["KHTeka-300-woff2"])}) format('woff2'), 223 url(${du(Lh["KHTeka-300-woff"])}) format('woff'); 224 font-weight: 300; 225 font-style: normal; 226 } 227 228 @font-face { 229 font-family: 'KHTekaMono'; 230 src: 231 url(${du(Lh["KHTekaMono-400-woff2"])}) format('woff2'), 232 url(${du(Lh["KHTekaMono-400-woff"])}) format('woff'); 233 font-weight: 400; 234 font-style: normal; 235 } 236 237 @font-face { 238 font-family: 'KHTeka'; 239 src: 240 url(${du(Lh["KHTeka-400-woff2"])}) format('woff2'), 241 url(${du(Lh["KHTeka-400-woff"])}) format('woff'); 242 font-weight: 400; 243 font-style: normal; 244 } 245 `} 246 247 @keyframes w3m-shake { 248 0% { 249 transform: scale(1) rotate(0deg); 250 } 251 20% { 252 transform: scale(1) rotate(-1deg); 253 } 254 40% { 255 transform: scale(1) rotate(1.5deg); 256 } 257 60% { 258 transform: scale(1) rotate(-1.5deg); 259 } 260 80% { 261 transform: scale(1) rotate(1deg); 262 } 263 100% { 264 transform: scale(1) rotate(0deg); 265 } 266 } 267 @keyframes w3m-iframe-fade-out { 268 0% { 269 opacity: 1; 270 } 271 100% { 272 opacity: 0; 273 } 274 } 275 @keyframes w3m-iframe-zoom-in { 276 0% { 277 transform: translateY(50px); 278 opacity: 0; 279 } 280 100% { 281 transform: translateY(0px); 282 opacity: 1; 283 } 284 } 285 @keyframes w3m-iframe-zoom-in-mobile { 286 0% { 287 transform: scale(0.95); 288 opacity: 0; 289 } 290 100% { 291 transform: scale(1); 292 opacity: 1; 293 } 294 } 295 :root { 296 --apkt-modal-width: 370px; 297 298 --apkt-visual-size-inherit: inherit; 299 --apkt-visual-size-sm: 40px; 300 --apkt-visual-size-md: 55px; 301 --apkt-visual-size-lg: 80px; 302 303 --apkt-path-network-sm: path( 304 'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z' 305 ); 306 307 --apkt-path-network-md: path( 308 'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z' 309 ); 310 311 --apkt-path-network-lg: path( 312 'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z' 313 ); 314 315 --apkt-width-network-sm: 36px; 316 --apkt-width-network-md: 48px; 317 --apkt-width-network-lg: 86px; 318 319 --apkt-duration-dynamic: 0ms; 320 --apkt-height-network-sm: 40px; 321 --apkt-height-network-md: 54px; 322 --apkt-height-network-lg: 96px; 323 } 324 `,dark:os` 325 :root { 326 } 327 `,light:os` 328 :root { 329 } 330 `}}const vn=os` 331 div, 332 span, 333 iframe, 334 a, 335 img, 336 form, 337 button, 338 label, 339 *::after, 340 *::before { 341 margin: 0; 342 padding: 0; 343 box-sizing: border-box; 344 font-style: normal; 345 text-rendering: optimizeSpeed; 346 -webkit-font-smoothing: antialiased; 347 -moz-osx-font-smoothing: grayscale; 348 -webkit-tap-highlight-color: transparent; 349 backface-visibility: hidden; 350 } 351 352 :host { 353 font-family: var(--apkt-fontFamily-regular); 354 } 355`,Gi=os` 356 button, 357 a { 358 cursor: pointer; 359 display: flex; 360 justify-content: center;
361 align-items: center; 362 position: relative; 363 364 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 365 outline: none; 366 border: none; 367 text-decoration: none; 368 transition: 369 background-color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 370 color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 371 border var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 372 box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 373 width var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 374 height var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 375 transform var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 376 opacity var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 377 scale var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 378 border-radius var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2); 379 will-change: 380 background-color, color, border, box-shadow, width, height, transform, opacity, scale, 381 border-radius; 382 } 383 384 a:active:not([disabled]), 385 button:active:not([disabled]) { 386 scale: 0.975; 387 transform-origin: center; 388 } 389 390 button:disabled { 391 cursor: default; 392 } 393 394 input { 395 border: none; 396 outline: none; 397 appearance: none; 398 } 399`,_x=".",ds={getSpacingStyles(t,e){if(Array.isArray(t))return t[e]?`var(--apkt-spacing-${t[e]})`:void 0;if(typeof t=="string")return`var(--apkt-spacing-${t})`},getFormattedDate(t){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(t)},formatCurrency(t=0,e={}){const n=Number(t);return isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2,...e}).format(n)},getHostName(t){try{return new URL(t).hostname}catch{return""}},getTruncateString({string:t,charsStart:e,charsEnd:n,truncate:i}){return t.length<=e+n?t:i==="end"?`${t.substring(0,e)}...`:i==="start"?`...${t.substring(t.length-n)}`:`${t.substring(0,Math.floor(e))}...${t.substring(t.length-Math.floor(n))}`},generateAvatarColors(t){const n=t.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),i=this.hexToRgb(n),s=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),o=100-3*Number(s==null?void 0:s.replace("px","")),a=`${o}% ${o}% at 65% 40%`,c=[];for(let l=0;l<5;l+=1){const d=this.tintColor(i,.15*l);c.push(`rgb(${d[0]}, ${d[1]}, ${d[2]})`)}return` 400 --local-color-1: ${c[0]}; 401 --local-color-2: ${c[1]}; 402 --local-color-3: ${c[2]}; 403 --local-color-4: ${c[3]}; 404 --local-color-5: ${c[4]}; 405 --local-radial-circle: ${a} 406 `},hexToRgb(t){const e=parseInt(t,16),n=e>>16&255,i=e>>8&255,s=e&255;return[n,i,s]},tintColor(t,e){const[n,i,s]=t,r=Math.round(n+(255-n)*e),o=Math.round(i+(255-i)*e),a=Math.round(s+(255-s)*e);return[r,o,a]},isNumber(t){return{number:/^[0-9]+$/u}.number.test(t)},getColorTheme(t){var e;return t||(typeof window<"u"&&window.matchMedia&&typeof window.matchMedia=="function"?(e=window.matchMedia("(prefers-color-scheme: dark)"))!=null&&e.matches?"dark":"light":"dark")},splitBalance(t){const e=t.split(".");return e.length===2?[e[0],e[1]]:["0","00"]},roundNumber(t,e,n){return t.toString().length>=e?Number(t).toFixed(n):t},cssDurationToNumber(t){return t.endsWith("s")?Number(t.replace("s",""))*1e3:t.endsWith("ms")?Number(t.replace("ms","")):0},maskInput({value:t,decimals:e,integers:n}){if(t=t.replace(",","."),t===_x)return`0${_x}`;const[i="",s]=t.split(_x).map(d=>d.replace(/[^0-9]/gu,"")),r=n?i.substring(0,n):i,o=r.length===2?String(Number(r)):r,a=typeof e=="number"?s==null?void 0:s.substring(0,e):s,c=typeof e!="number"||e>0;return(typeof a=="string"&&c?[o,a].join(_x):o)??""},capitalize(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""}},EBe=3,Sx=.1,_Be=["receive","deposit","borrow","claim"],SBe=["withdraw","repay","burn"],a2={getTransactionGroupTitle(t,e){const n=oP.getYear(),i=oP.getMonthNameByIndex(e);return t===n?i:`${i} ${t}`},getTransactionImages(t){const[e]=t;return(t==null?void 0:t.length)>1?t.map(i=>this.getTransactionImage(i)):[this.getTransactionImage(e)]},getTransactionImage(t){return{type:a2.getTransactionTransferTokenType(t),url:a2.getTransactionImageURL(t)}},getTransactionImageURL(t){var s,r,o,a,c;let e;const n=!!(t!=null&&t.nft_info),i=!!(t!=null&&t.fungible_info);return t&&n?e=(o=(r=(s=t==null?void 0:t.nft_info)==null?void 0:s.content)==null?void 0:r.preview)==null?void 0:o.url:t&&i&&(e=(c=(a=t==null?void 0:t.fungible_info)==null?void 0:a.icon)==null?void 0:c.url),e},getTransactionTransferTokenType(t){if(t!=null&&t.fungible_info)return"FUNGIBLE";if(t!=null&&t.nft_info)return"NFT"},getTransactionDescriptions(t,e){var p;const n=(p=t==null?void 0:t.metadata)==null?void 0:p.operationType,i=e||(t==null?void 0:t.transfers),s=i&&i.length>0,r=i&&i.length>1,o=s&&i.every(g=>!!(g!=null&&g.fungible_info)),[a,c]=i||[];let l=this.getTransferDescription(a),d=this.getTransferDescription(c);if(!s)return(n==="send"||n==="receive")&&o?(l=ds.getTruncateString({string:t==null?void 0:t.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),d=ds.getTruncateString({string:t==null?void 0:t.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"}),[l,d]):[t.metadata.status];if(r)return i==null?void 0:i.map(g=>this.getTransferDescription(g));let h="";return _Be.includes(n)?h="+":SBe.includes(n)&&(h="-"),l=h.concat(l),[l]},getTransferDescription(t){var n;let e="";return t&&(t!=null&&t.nft_info?e=((n=t==null?void 0:t.nft_info)==null?void 0:n.name)||"-":t!=null&&t.fungible_info&&(e=this.getFungibleTransferDescription(t)||"
406-")),e},getFungibleTransferDescription(t){var i;return t?[this.getQuantityFixedValue(t==null?void 0:t.quantity.numeric),(i=t==null?void 0:t.fungible_info)==null?void 0:i.symbol].join(" ").trim():null},mergeTransfers(t){if((t==null?void 0:t.length)<=1)return t;const n=this.filterGasFeeTransfers(t).reduce((s,r)=>{var c;const o=(c=r==null?void 0:r.fungible_info)==null?void 0:c.name,a=s.find(({fungible_info:l,direction:d})=>o&&o===(l==null?void 0:l.name)&&d===r.direction);if(a){const l=Number(a.quantity.numeric)+Number(r.quantity.numeric);a.quantity.numeric=l.toString(),a.value=(a.value||0)+(r.value||0)}else s.push(r);return s},[]);let i=n;return n.length>2&&(i=n.sort((s,r)=>(r.value||0)-(s.value||0)).slice(0,2)),i=i.sort((s,r)=>s.direction==="out"&&r.direction==="in"?-1:s.direction==="in"&&r.direction==="out"?1:0),i},filterGasFeeTransfers(t){const e=t==null?void 0:t.reduce((i,s)=>{var o;const r=(o=s==null?void 0:s.fungible_info)==null?void 0:o.name;return r&&(i[r]||(i[r]=[]),i[r].push(s)),i},{}),n=[];return Object.values(e??{}).forEach(i=>{if(i.length===1){const s=i[0];s&&n.push(s)}else{const s=i.filter(o=>o.direction==="in"),r=i.filter(o=>o.direction==="out");if(s.length===1&&r.length===1){const o=s[0],a=r[0];let c=!1;if(o&&a){const l=Number(o.quantity.numeric),d=Number(a.quantity.numeric);d<l*Sx?(n.push(o),c=!0):l<d*Sx&&(n.push(a),c=!0)}c||n.push(...i)}else{const o=this.filterGasFeesFromTokenGroup(i);n.push(...o)}}}),t==null||t.forEach(i=>{var s;(s=i==null?void 0:i.fungible_info)!=null&&s.name||n.push(i)}),n},filterGasFeesFromTokenGroup(t){if(t.length<=1)return t;const e=t==null?void 0:t.map(a=>Number(a.quantity.numeric)),n=Math.max(...e),i=Math.min(...e),s=.01;if(i<n*s)return t==null?void 0:t.filter(c=>Number(c.quantity.numeric)>=n*s);const r=t==null?void 0:t.filter(a=>a.direction==="in"),o=t==null?void 0:t.filter(a=>a.direction==="out");if(r.length===1&&o.length===1){const a=r[0],c=o[0];if(a&&c){const l=Number(a.quantity.numeric),d=Number(c.quantity.numeric);if(d<l*Sx)return[a];if(l<d*Sx)return[c]}}return t},getQuantityFixedValue(t){return t?parseFloat(t).toFixed(EBe):null}};function ABe(t,e){const{kind:n,elements:i}=e;return{kind:n,elements:i,finisher(s){customElements.get(t)||customElements.define(t,s)}}}function TBe(t,e){return customElements.get(t)||customElements.define(t,e),e}function Qe(t){return function(n){return typeof n=="function"?TBe(t,n):ABe(t,n)}}const Ax={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603};class kBe extends zse{async setUniversalProvider(e){if(!this.namespace)throw new Error("UniversalAdapter:setUniversalProvider - namespace is required");return this.addConnector(new Hse({provider:e,caipNetworks:this.getCaipNetworks(),namespace:this.namespace})),Promise.resolve()}async connect(e){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(e.chainId),provider:this.provider,address:""})}async disconnect(){try{await this.getWalletConnectConnector().disconnect(),this.emit("disconnect")}catch(e){console.warn("UniversalAdapter:disconnect - error",e)}return{connections:[]}}syncConnections(){return Promise.resolve()}async getAccounts({namespace:e}){var s,r,o,a;const n=this.provider,i=((a=(o=(r=(s=n==null?void 0:n.session)==null?void 0:s.namespaces)==null?void 0:r[e])==null?void 0:o.accounts)==null?void 0:a.map(c=>{const[,,l]=c.split(":");return l}).filter((c,l,d)=>d.indexOf(c)===l))||[];return Promise.resolve({accounts:i.map(c=>Ue.createAccount(e,c,e==="bip122"?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){var o,a,c,l,d;if(!(e.caipNetwork&&fn.BALANCE_SUPPORTED_CHAINS.includes((o=e.caipNetwork)==null?void 0:o.chainNamespace))||(a=e.caipNetwork)!=null&&a.testnet)return{balance:"0.00",symbol:((c=e.caipNetwork)==null?void 0:c.nativeCurrency.symbol)||""};const i=ne.getAccountData();if(i!=null&&i.balanceLoading&&e.chainId===((l=ne.state.activeCaipNetwork)==null?void 0:l.id))return{balance:(i==null?void 0:i.balance)||"0.00",symbol:(i==null?void 0:i.balanceSymbol)||""};const r=(await ne.fetchTokenBalance()).find(h=>{var p,g;return h.chainId===`${(p=e.caipNetwork)==null?void 0:p.chainNamespace}:${e.chainId}`&&h.symbol===((g=e.caipNetwork)==null?void 0:g.nativeCurrency.symbol)});return{balance:(r==null?void 0:r.quantity.numeric)||"0.00",symbol:(r==null?void 0:r.symbol)||((d=e.caipNetwork)==null?void 0:d.nativeCurrency.symbol)||""}}async signMessage(e){var o,a,c;const{provider:n,message:i,address:s}=e;
406if(!n)throw new Error("UniversalAdapter:signMessage - provider is undefined");let r="";return((o=ne.state.activeCaipNetwork)==null?void 0:o.chainNamespace)===we.CHAIN.SOLANA?r=(await n.request({method:"solana_signMessage",params:{message:Wb.encode(new TextEncoder().encode(i)),pubkey:s}},(a=ne.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)).signature:r=await n.request({method:"personal_sign",params:[i,s]},(c=ne.state.activeCaipNetwork)==null?void 0:c.caipNetworkId),{signature:r}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(e){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}emitFirstAvailableConnection(){}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(e){var s,r,o,a,c,l;const{caipNetwork:n}=e,i=this.getWalletConnectConnector();if(n.chainNamespace===we.CHAIN.EVM)try{await((s=i.provider)==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Iu(n.id)}]}))}catch(d){if(d.code===Ax.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||d.code===Ax.ERROR_INVALID_CHAIN_ID||d.code===Ax.ERROR_CODE_DEFAULT||((o=(r=d==null?void 0:d.data)==null?void 0:r.originalError)==null?void 0:o.code)===Ax.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await((l=i.provider)==null?void 0:l.request({method:"wallet_addEthereumChain",params:[{chainId:Iu(n.id),rpcUrls:[(a=n==null?void 0:n.rpcUrls.chainDefault)==null?void 0:a.http],chainName:n.name,nativeCurrency:n.nativeCurrency,blockExplorerUrls:[(c=n.blockExplorers)==null?void 0:c.default.url]}]}))}catch{throw new Error("Chain is not supported")}}i.provider.setDefaultChain(n.caipNetworkId)}getWalletConnectProvider(){const e=this.connectors.find(i=>i.type==="WALLET_CONNECT");return e==null?void 0:e.provider}}const NBe=["email","socials","swaps","onramp","activity","reownBranding","multiWallet","emailCapture","payWithExchange","payments","reownAuthentication","headless"],Tx={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return!!t.isEnabled&&e.includes("email")},processFallback:t=>t===void 0?fn.DEFAULT_REMOTE_FEATURES.email:!!t},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e.filter(n=>n!=="email"):!1},processFallback:t=>t===void 0?fn.DEFAULT_REMOTE_FEATURES.socials:typeof t=="boolean"?t?fn.DEFAULT_REMOTE_FEATURES.socials:!1:t},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?fn.DEFAULT_REMOTE_FEATURES.swaps:typeof t=="boolean"?t?fn.DEFAULT_REMOTE_FEATURES.swaps:!1:t},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>{if(!(t!=null&&t.config))return!1;const e=t.config;return t.isEnabled&&e.length>0?e:!1},processFallback:t=>t===void 0?fn.DEFAULT_REMOTE_FEATURES.onramp:typeof t=="boolean"?t?fn.DEFAULT_REMOTE_FEATURES.onramp:!1:t},activity:{apiFeatureName:"activity",localFeatureName:"history",returnType:!1,isLegacy:!0,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>t===void 0?fn.DEFAULT_REMOTE_FEATURES.activity:!!t},reownBranding:{apiFeatureName:"reown_branding",localFeatureName:"reownBranding",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>t===void 0?fn.DEFAULT_REMOTE_FEATURES.reownBranding:!!t},emailCapture:{apiFeatureName:"email_capture",localFeatureName:"emailCapture",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>t.isEnabled&&(t.config??[]),processFallback:t=>!1},multiWallet:{apiFeatureName:"multi_wallet",localFeatureName:"multiWallet",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>fn.DEFAULT_REMOTE_FEATURES.multiWallet},payWithExchange:{apiFeatureName:"fund_from_exchange",localFeatureName:"payWithExchange",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>fn.DEFAULT_REMOTE_FEATURES.payWithExchange},payments:{apiFeatureName:"payments",localFeatureName:"payments",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>fn.DEFAULT_REMOTE_FEATURES.payments},reownAuthentication:{apiFeatureName:"reown_authentication",localFeatureName:"reownAuthentication",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:t=>typeof t>"u"?fn.DEFAULT_REMOTE_FEATURES.reownAuthentication:!!t},headless:{apiFeatureName:"headless",localFeatureName:"headless",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:t=>!!t.isEnabled,processFallback:()=>fn.DEFAULT_REMOTE_FEATURES.headless}},RBe={localSettingsOverridden:new Set,getApiConfig(t,e){return e==null?void 0:e.find(n=>n.id===t)},addWarning(t,e){if(t!==void 0){const n=Tx[e],i=n.isLegacy?`"features.${n.localFeatureName}" (now "${e}")`:`"features.${e}"`;this.localSettingsOverridden.add(i)}},processFeature(t,e,n,i,s){const r=Tx[t],o=e[r.localFeatureName];if(s&&!r.isAvailableOnBasic)return!1;if(i){const a=this.getApiConfig(r.apiFeatureName,n);return(a==null?void 0:a.config)===null?this.processFallbackFeature(t,o):a!=null&&a.config?(o!==void 0&&this.addWarning(o,t),this.processApiFeature(t,a)):!1}return this.processFallbackFeature(t,o)},processApiFeature(t,e){return Tx[t].processApi(e)},processFallbackFeature(t,e){return Tx[t].processFallback(e)},async fetchRemoteFeatures(t){const e=t.basic??!1,n=t.features||{};this.localSettingsOverridden.clear();let i=null,s=!1;try{i=await ut.fetchProjectConfig(),s=i!=null}catch(o){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",o)}const r=s&&!e?fn.DEFAULT_REMOTE_FEATURES:fn.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const o of NBe){const a=this.processFeature(o,n,i,s,e);Object.assign(r,{[o]:a})}}catch(o){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",o),fn.DEFAULT_REMOTE_FEATURES}if(s&&this.localSettingsOverridden.size>0){const o=`Your local configuration for ${Array.from(this.localSettingsOverridden).join(", ")} was ignored because a remote configuration was successfully fetched. Please manage these features via your project dashboard on dashboard.reown.com.`;Ss.open({debugMessage:ys.ALERT_WARNINGS.LOCAL_CONFIGURATION_IGNORED.debugMessage(o)},"warning")}return r}};class PBe{constructor(e){this.chainNamespaces=[],this.features={},this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(n,i)=>{var s,r,o;
406if(n){const a=(s=ne.getCaipNetworks(n))==null?void 0:s.find(d=>d.id===i);if(a)return a;const c=(r=ne.getNetworkData(n))==null?void 0:r.caipNetwork;return c||((o=ne.getRequestedCaipNetworks(n).filter(d=>d.chainNamespace===n))==null?void 0:o[0])}return ne.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const n=this.getCaipNetwork();if(n)return n.id},this.getCaipNetworks=n=>ne.getCaipNetworks(n),this.getActiveChainNamespace=()=>ne.state.activeChain,this.setRequestedCaipNetworks=(n,i)=>{ne.setRequestedCaipNetworks(n,i)},this.getApprovedCaipNetworkIds=()=>ne.getAllApprovedCaipNetworkIds(),this.getCaipAddress=n=>{var i,s;return ne.state.activeChain===n||!n?ne.state.activeCaipAddress:(s=(i=ne.state.chains.get(n))==null?void 0:i.accountState)==null?void 0:s.caipAddress},this.setClientId=n=>{xn.setClientId(n)},this.getProvider=n=>ss.getProvider(n),this.getProviderType=n=>ss.getProviderId(n),this.getPreferredAccountType=n=>$s(n),this.setCaipAddress=(n,i,s=!1)=>{ne.setAccountProp("caipAddress",n,i,s),ne.setAccountProp("address",Ue.getPlainAddress(n),i,s)},this.setBalance=(n,i,s)=>{ne.setAccountProp("balance",n,s),ne.setAccountProp("balanceSymbol",i,s)},this.setProfileName=(n,i)=>{ne.setAccountProp("profileName",n,i)},this.setProfileImage=(n,i)=>{ne.setAccountProp("profileImage",n,i)},this.setUser=(n,i)=>{ne.setAccountProp("user",n,i)},this.resetAccount=n=>{ne.resetAccount(n)},this.setCaipNetwork=n=>{ne.setActiveCaipNetwork(n)},this.setCaipNetworkOfNamespace=(n,i)=>{ne.setChainNetworkData(i,{caipNetwork:n})},this.setStatus=(n,i)=>{ne.setAccountProp("status",n,i),Oe.isConnected()?He.setConnectionStatus("connected"):He.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=n=>{var i;return(i=ne.getAccountData(n))==null?void 0:i.address},this.setConnectors=n=>{const i=[...Oe.state.allConnectors,...n];Oe.setConnectors(i)},this.setConnections=(n,i)=>{He.setConnections(n,i),Ve.setConnections(n,i)},this.fetchIdentity=n=>xn.fetchIdentity(n),this.getReownName=n=>b3.getNamesForAddress(n),this.getConnectors=()=>Oe.getConnectors(),this.getConnectorImage=n=>qi.getConnectorImage(n),this.getConnections=n=>this.remoteFeatures.multiWallet?Oc.getConnectionsData(n).connections:(Ss.open(we.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.getRecentConnections=n=>this.remoteFeatures.multiWallet?Oc.getConnectionsData(n).recentConnections:(Ss.open(we.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.switchConnection=async n=>{if(!this.remoteFeatures.multiWallet){Ss.open(we.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info");return}await Ve.switchConnection(n)},this.deleteConnection=n=>{if(!this.remoteFeatures.multiWallet){Ss.open(we.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info");return}He.deleteAddressFromConnection(n),Ve.syncStorageConnections()},this.setConnectedWalletInfo=(n,i)=>{const s=ss.getProviderId(i),r=n?{...n,type:s}:void 0;ne.setAccountProp("connectedWalletInfo",r,i)},this.getIsConnectedState=()=>!!ne.state.activeCaipAddress,this.addAddressLabel=(n,i,s)=>{var o;const r=((o=ne.getAccountData(s))==null?void 0:o.addressLabels)||{};ne.setAccountProp("addressLabels",{...r,[n]:i},s)},this.removeAddressLabel=(n,i)=>{var r;const s=((r=ne.getAccountData(i))==null?void 0:r.addressLabels)||{};ne.setAccountProp("addressLabels",{...s,[n]:void 0},i)},this.getAddress=n=>{var s;const i=n||ne.state.activeChain;return(s=ne.getAccountData(i))==null?void 0:s.address},this.resetNetwork=n=>{ne.resetNetwork(n)},this.addConnector=n=>{Oe.addConnector(n)},this.resetWcConnection=()=>{Ve.resetWcConnection()},this.setAddressExplorerUrl=(n,i)=>{ne.setAccountProp("addressExplorerUrl",n,i)},this.setSmartAccountDeployed=(n,i)=>{ne.setAccountProp("smartAccountDeployed",n,i)},this.setPreferredAccountType=(n,i)=>{ne.setAccountProp("preferredAccountType",n,i)},this.setEIP6963Enabled=n=>{ye.setEIP6963Enabled(n)},this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.options=e,this.version=e.sdkVersion,this.caipNetworks=this.extendCaipNetworks(e),this.chainNamespaces=this.getChainNamespacesSet(e.adapters,this.caipNetworks),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.chainAdapters=this.createAdapters(e.adapters),this.readyPromise=this.initialize(e)}getChainNamespacesSet(e,n){const i=e==null?void 0:e.map(r=>r.namespace).filter(r=>!!r);if(i!=null&&i.length)return[...new Set(i)];const s=n==null?void 0:n.map(r=>r.chainNamespace);return[...new Set(s)]}async initialize(e){var n,i,s,r,o,a;if(this.initializeProjectSettings(e),this.initControllers(e),await this.initChainAdapters(),this.sendInitializeEvent(e),(n=e.features)!=null&&n.headless&&!za.hasInjectedConnectors()&&ut.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1,fetchRecommendedWallets:!0}),ye.state.enableReconnect?(await this.syncExistingConnection(),await this.syncAdapterConnections()):await this.unSyncExistingConnection(),!e.basic&&!e.manualWCControl&&(this.remoteFeatures=await RBe.fetchRemoteFeatures(e)),await ut.fetchUsage(),ye.setRemoteFeatures(this.remoteFeatures),this.remoteFeatures.onramp&&mP.setOnrampProviders(this.remoteFeatures.onramp),((i=ye.state.remoteFeatures)!=null&&i.email||Array.isArray((s=ye.state.remoteFeatures)==null?void 0:s.socials)&&((r=ye.state.remoteFeatures)==null?void 0:r.socials.length)>0)&&await this.checkAllowedOrigins(),(o=ye.state.features)!=null&&o.reownAuthentication||(a=ye.state.remoteFeatures)!=null&&a.reownAuthentication){const{ReownAuthentication:c}=await Lt(async()=>{const{ReownAuthentication:d}=await import("./features-D3t0a8yQ.js");return{ReownAuthentication:d}},[]),l=ye.state.siwx;l instanceof c||(l&&console.warn("ReownAuthentication option is enabled, SIWX configuration will be overridden."),ye.setSIWX(new c))}}async openSend(e){var r;const n=e.namespace||ne.state.activeChain,i=this.getCaipAddress(n),s=(r=this.getCaipNetwork(n))==null?void 0:r.id;if(!i)throw new Error("openSend: caipAddress not found");if((s==null?void 0:s.toString())!==e.chainId.toString()){const o=ne.getCaipNetworkById(e.chainId,n);if(!o)throw new Error(`openSend: caipNetwork with chainId ${e.chainId} not found`);await this.switchNetwork(o,{throwOnFailure:!0})}try{const o=Yse.getTokenSymbolByAddress(e.assetAddress);o&&await ut.fetchTokenImages([o])}catch{}return await wn.open({view:"WalletSend",data:{send:e}}),new Promise((o,a)=>{const c=ei.subscribeKey("hash",h=>{h&&(d(),o({hash:h}))}),l=wn.subscribe(h=>{h.open||(d(),a(new Error("Modal closed")))}),d=this.createCleanupHandler([c,l])})}toModalOptions(){function e(i){return(i==null?void 0:i.view)==="Swap"}function n(i){return(i==null?void 0:i.view)==="WalletSend"}return{isSwap:e,isSend:n}}async checkAllowedOrigins(){try{const e=await ut.fetchAllowedOrigins();if(!Ue.isClient())return;const n=window.location.origin;lf.isOriginAllowed(n,e,we.DEFAULT_ALLOWED_ANCESTORS)||Ss.open(ys.ALERT_ERRORS.ORIGIN_NOT_ALLOWED,"error")}catch(e){if(!(e instanceof Error))return;switch(e.message){case"RATE_LIMITED":Ss.open(ys.ALERT_ERRORS.RATE_LIMITED_APP_CONFIGURATION,"error");break;case"SERVER_ERROR":{const n=e.cause instanceof Error?e.cause:e;Ss.open({displayMessage:ys.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.displayMessage,debugMessage:ys.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.debugMessage(n.message)},"error");break}}}}createCleanupHandler(e){return()=>{e.forEach(n=>{try{n()}catch{}})}}sendInitializeEvent(e){var i;const{...n}=e;delete n.adapters,delete n.universalProvider,Et.sendEvent({type:"track",event:"INITIALIZE",properties:{...n,networks:e.networks.map(s=>s.id),siweConfig:{options:((i=e.siweConfig)==null?void 0:i.options)||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initAdapterController(){Hte.initialize(this.chainAdapters)}initializeThemeController(e){e.themeMode&&Xr.setThemeMode(e.themeMode),e.themeVariables&&Xr.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient)throw new Error("ConnectionControllerClient must be set");ne.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient});const n=this.getDefaultNetwork();n&&ne.setActiveCaipNetwork(n)}initializeConnectionController(e){Ve.initialize(e.adapters??[]),Ve.setWcBasic(e.basic??!1)}initializeConnectorController(){Oe.initialize(this.chainNamespaces)}initializeProjectSettings(e){ye.setProjectId(e.projectId),ye.setSdkVersion(e.sdkVersion)}initializeOptionsController(e){var s;ye.setDebug(e.debug!==!1),ye.setEnableWalletGuide(e.enableWalletGuide!==!1),ye.setEnableWallets(e.enableWallets!==!1),ye.setEIP6963Enabled(e.enableEIP6963!==!1),ye.setEnableNetworkSwitch(e.enableNetworkSwitch!==!1),ye.setEnableReconnect(e.enableReconnect!==!1),ye.setEnableMobileFullScreen(e.enableMobileFullScreen===!0),ye.setCoinbasePreference(e.coinbasePreference),ye.setEnableAuthLogger(e.enableAuthLogger!==!1),ye.setCustomRpcUrls(e.customRpcUrls),ye.setEnableEmbedded(e.enableEmbedded),ye.setAllWallets(e.allWallets),ye.setIncludeWalletIds(e.includeWalletIds),ye.setExcludeWalletIds(e.excludeWalletIds),ye.setFeaturedWalletIds(e.featuredWalletIds),ye.setTokens(e.tokens),ye.setTermsConditionsUrl(e.termsConditionsUrl),ye.setPrivacyPolicyUrl(e.privacyPolicyUrl),ye.setCustomWallets(e.customWallets),ye.setFeatures(e.features),ye.setAllowUnsupportedChain(e.allowUnsupportedChain),ye.setUniversalProviderConfigOverride(e.universalProviderConfigOverride),ye.setPreferUniversalLinks(e.experimental_preferUniversalLinks),ye.setDefaultAccountTypes(e.defaultAccountTypes);const n=this.getDefaultMetaData();if(!e.metadata&&n&&(e.metadata=n),ye.setMetadata(e.metadata),ye.setDisableAppend(e.disableAppend),ye.setEnableEmbedded(e.enableEmbedded),ye.setSIWX(e.siwx),this.features=ye.state.features??{},!e.projectId){Ss.open(ys.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(((s=e.adapters)==null?void 0:s.find(r=>r.namespace===we.CHAIN.EVM))&&e.siweConfig){if(e.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");ye.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){var e,n,i,s;return Ue.isClient()?{name:((n=(e=document.getElementsByTagName("title"))==null?void 0:e[0])==null?void 0:n.textContent)||"",description:((i=document.querySelector('meta[property="og:description"]'))==null?void 0:i.content)||"",url:window.location.origin,icons:[((s=document.querySelector('link[rel~="icon"]'))==null?void 0:s.href)||""]}:null}setUnsupportedNetwork(e){const n=this.getActiveChainNamespace();if(n){const i=xu.getUnsupportedNetwork(`${n}:${e}`);ne.setActiveCaipNetwork(i)}}getDefaultNetwork(){return xu.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(e,n){return xu.extendCaipNetwork(e,{customNetworkImageUrls:n.chainImages,projectId:n.projectId})}extendCaipNetworks(e){return xu.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){const n=e.networks.find(s=>{var r;return s.id===((r=e.defaultNetwork)==null?void 0:r.id)});return n?xu.extendCaipNetwork(n,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}async disconnectConnector(e,n){var i,s;try{this.setLoading(!0,e);let r={connections:[]};const o=this.getAdapter(e);return(((s=(i=ne.state.chains.get(e))==null?void 0:i.accountState)==null?void 0:s.caipAddress)||!ye.state.enableReconnect)&&(o!=null&&o.disconnect)&&(r=await o.disconnect({id:n})),this.setLoading(!1,e),r}catch(r){throw this.setLoading(!1,e),new Error(`Failed to disconnect chains: ${r.message}`)}}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{var l;const e=ne.state.activeChain,n=this.getAdapter(e),i=(l=this.getCaipNetwork(e))==null?void 0:l.id,s=Ve.getConnections(e),r=this.remoteFeatures.multiWallet,o=s.length>0;if(!n)throw new Error("Adapter not found");const a=await n.connectWalletConnect(i);(!o||!r)&&this.close(),this.setClientId((a==null?void 0:a.clientId)||null),He.setConnectedNamespaces([...ne.state.chains.keys()]),await this.syncWalletConnectAccount(),await jo.initializeIfEnabled()},connectExternal:async e=>{const n=await this.onConnectExternal(e);return await this.connectInactiveNamespaces(e,n),n?{address:n.address}:void 0},reconnectExternal:async({id:e,info:n,type:i,provider:s})=>{var a;const r=ne.state.activeChain,o=this.getAdapter(r);if(!r)throw new Error("reconnectExternal: namespace not found");if(!o)throw new Error("reconnectExternal: adapter not found");o!=null&&o.reconnect&&(await(o==null?void 0:o.reconnect({id:e,info:n,type:i,provider:s,chainId:(a=this.getCaipNetwork())==null?void 0:a.id})),He.addConnectedNamespace(r),this.syncConnectedWalletInfo(r))},disconnectConnector:async e=>{await this.disconnectConnector(e.namespace,e.id)},disconnect:async e=>{var l;const{id:n,chainNamespace:i,initialDisconnect:s}=e||{},r=i||ne.state.activeChain,o=Oe.getConnectorId(r),a=n===we.CONNECTOR_ID.AUTH||o===we.CONNECTOR_ID.AUTH,c=n===we.CONNECTOR_ID.WALLET_CONNECT||o===we.CONNECTOR_ID.WALLET_CONNECT;try{const d=Array.from(ne.state.chains.keys());let h=i?[i]:d;(c||a)&&(h=d);const p=h.map(async w=>{const C=Oe.getConnectorId(w),E=n||C,T=await this.disconnectConnector(w,E);T&&(a&&He.deleteConnectedSocialProvider(),T.connections.forEach(A=>{He.addDisconnectedConnectorId(A.connectorId,w)})),s&&this.onDisconnectNamespace({chainNamespace:w,closeModal:!1})}),g=await Promise.allSettled(p);ei.resetSend(),Ve.resetWcConnection(),(l=jo.getSIWX())!=null&&l.signOutOnDisconnect&&await jo.clearSessions(),Oe.setFilterByNamespace(void 0),Ve.syncStorageConnections();const b=g.filter(w=>w.status==="rejected");if(b.length>0)throw new Error(b.map(w=>w.reason.message).join(", "));Et.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:i||"all"}})}catch(d){throw new Error(`Failed to disconnect chains: ${d.message}`)}},checkInstalled:e=>e?e.some(n=>{var i;return!!((i=window.ethereum)!=null&&i[String(n)])}):!!window.ethereum,signMessage:async e=>{const n=ne.state.activeChain,i=this.getAdapter(ne.state.activeChain);if(!n)throw new Error("signMessage: namespace not found");if(!i)throw new Error("signMessage: adapter not found");const s=this.getAddress(n);if(!s)throw new Error("signMessage: address not found");const r=await(i==null?void 0:i.signMessage({message:e,address:s,provider:ss.getProvider(n)}));return(r==null?void 0:r.signature)||""},sendTransaction:async e=>{const n=e.chainNamespace;if(!n)throw new Error("sendTransaction: namespace not found");if(fn.SEND_SUPPORTED_NAMESPACES.includes(n)){const i=this.getAdapter(n);if(!i)throw new Error("sendTransaction: adapter not found");const s=ss.getProvider(n),r=await(i==null?void 0:i.sendTransaction({...e,caipNetwork:this.getCaipNetwork(),provider:s}));return(r==null?void 0:r.hash)||""}return""},estimateGas:async e=>{const n=e.chainNamespace;if(n===we.CHAIN.EVM){const i=this.getAdapter(n);if(!i)throw new Error("estimateGas: adapter is required but got undefined");const s=ss.getProvider(n),r=this.getCaipNetwork();if(!r)throw new Error("estimateGas: caipNetwork is required but got undefined");const o=await(i==null?void 0:i.estimateGas({...e,provider:s,caipNetwork:r}));return(o==null?void 0:o.gas)||0n}return 0n},getEnsAvatar:async()=>{var s;const e=ne.state.activeChain;if(!e)throw new Error("getEnsAvatar: namespace is required but got undefined");const n=this.getAddress(e);if(!n)throw new Error("getEnsAvatar: address not found");await this.syncIdentity({address:n,chainId:Number((s=this.getCaipNetwork())==null?void 0:s.id),chainNamespace:e});const i=ne.getAccountData();return(i==null?void 0:i.profileImage)||!1},getEnsAddress:async e=>await lf.resolveReownName(e),writeContract:async e=>{const n=ne.state.activeChain,i=this.getAdapter(n);if(!n)throw new Error("writeContract: namespace is required but got undefined");if(!i)throw new Error("writeContract: adapter is required but got undefined");const s=this.getCaipNetwork(),r=this.getCaipAddress(),o=ss.getProvider(n);if(!s||!r)throw new Error("writeContract: caipNetwork or caipAddress is required but got
406 undefined");const a=await(i==null?void 0:i.writeContract({...e,caipNetwork:s,provider:o,caipAddress:r}));return a==null?void 0:a.hash},parseUnits:(e,n)=>{const i=this.getAdapter(ne.state.activeChain);if(!i)throw new Error("parseUnits: adapter is required but got undefined");return(i==null?void 0:i.parseUnits({value:e,decimals:n}))??0n},formatUnits:(e,n)=>{const i=this.getAdapter(ne.state.activeChain);if(!i)throw new Error("formatUnits: adapter is required but got undefined");return(i==null?void 0:i.formatUnits({value:e,decimals:n}))??"0"},getCapabilities:async e=>{const n=this.getAdapter(ne.state.activeChain);if(!n)throw new Error("getCapabilities: adapter is required but got undefined");return await(n==null?void 0:n.getCapabilities(e))},grantPermissions:async e=>{const n=this.getAdapter(ne.state.activeChain);if(!n)throw new Error("grantPermissions: adapter is required but got undefined");return await(n==null?void 0:n.grantPermissions(e))},revokePermissions:async e=>{const n=this.getAdapter(ne.state.activeChain);if(!n)throw new Error("revokePermissions: adapter is required but got undefined");return n!=null&&n.revokePermissions?await n.revokePermissions(e):"0x"},walletGetAssets:async e=>{const n=this.getAdapter(ne.state.activeChain);if(!n)throw new Error("walletGetAssets: adapter is required but got undefined");return await(n==null?void 0:n.walletGetAssets(e))??{}},updateBalance:e=>{const n=this.getAddress(e),i=this.getCaipNetwork(e);!i||!n||this.updateNativeBalance(n,i==null?void 0:i.id,e)}},Ve.setClient(this.connectionControllerClient)}async onConnectExternal(e){var l,d,h,p,g,b,w,C;const n=ne.state.activeChain,i=e.chain||n,s=this.getAdapter(i);let r=!0;if(e.type===Fo.CONNECTOR_TYPE_AUTH&&we.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(A=>Oe.getConnectorId(A)===we.CONNECTOR_ID.AUTH)&&e.chain!==n&&(r=!1),e.chain&&e.chain!==n&&!e.caipNetwork){const E=this.getCaipNetworks().find(T=>T.chainNamespace===e.chain);E&&r&&this.setCaipNetwork(E)}if(!i)throw new Error("connectExternal: namespace not found");if(!s)throw new Error("connectExternal: adapter not found");const o=this.getCaipNetwork(i),a=e.caipNetwork||o,c=await s.connect({id:e.id,address:e.address,info:e.info,type:e.type,provider:e.provider,socialUri:e.socialUri,chainId:((l=e.caipNetwork)==null?void 0:l.id)||(o==null?void 0:o.id),rpcUrl:((g=(p=(h=(d=e.caipNetwork)==null?void 0:d.rpcUrls)==null?void 0:h.default)==null?void 0:p.http)==null?void 0:g[0])||((C=(w=(b=o==null?void 0:o.rpcUrls)==null?void 0:b.default)==null?void 0:w.http)==null?void 0:C[0])});if(c)return He.addConnectedNamespace(i),this.syncProvider({...c,chainNamespace:i}),this.setStatus("connected",i),this.syncConnectedWalletInfo(i),He.removeDisconnectedConnectorId(e.id,i),{address:c.address,connectedCaipNetwork:a}}async connectInactiveNamespaces(e,n){var a;const i=e.type===Fo.CONNECTOR_TYPE_AUTH,s=tr.getOtherAuthNamespaces((a=n==null?void 0:n.connectedCaipNetwork)==null?void 0:a.chainNamespace),r=ne.state.activeCaipNetwork,o=this.getAdapter(r==null?void 0:r.chainNamespace);i&&(await Promise.all(s.map(async c=>{var l,d,h;try{const p=ss.getProvider(c),g=this.getCaipNetwork(c),b=this.getAdapter(c);await(b==null?void 0:b.connect({...e,provider:p,socialUri:void 0,chainId:g==null?void 0:g.id,rpcUrl:(h=(d=(l=g==null?void 0:g.rpcUrls)==null?void 0:l.default)==null?void 0:d.http)==null?void 0:h[0]}))&&(He.addConnectedNamespace(c),He.removeDisconnectedConnectorId(e.id,c),this.setStatus("connected",c),this.syncConnectedWalletInfo(c))}catch(p){Ss.warn(ys.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.displayMessage,ys.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.debugMessage(c,p instanceof Error?p.message:void 0),ys.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.code)}})),r&&await(o==null?void 0:o.switchNetwork({caipNetwork:r})))}getApprovedCaipNetworksData(){var n,i,s,r,o;
406if(ss.getProviderId(ne.state.activeChain)===Fo.CONNECTOR_TYPE_WALLET_CONNECT){const a=(i=(n=this.universalProvider)==null?void 0:n.session)==null?void 0:i.namespaces;return{supportsAllNetworks:((o=(r=(s=this.universalProvider)==null?void 0:s.session)==null?void 0:r.peer)==null?void 0:o.metadata.name)==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(a)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){const n=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){const s=ss.getProviderId(n);if(e.chainNamespace===ne.state.activeChain){const r=this.getAdapter(n);await(r==null?void 0:r.switchNetwork({caipNetwork:e}))}else if(this.setCaipNetwork(e),s===Fo.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{const r=this.getAddressByChainNamespace(n);r&&this.syncAccount({address:r,chainId:e.id,chainNamespace:n})}}else this.setCaipNetwork(e)}getChainsFromNamespaces(e={}){return Object.values(e).flatMap(n=>{const i=n.chains||[],s=n.accounts.map(r=>{const{chainId:o,chainNamespace:a}=Lr.parseCaipAddress(r);return`${a}:${o}`});return Array.from(new Set([...i,...s]))})}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((n,i)=>{var r,o;const s=e==null?void 0:e.find(a=>a.namespace===i);return s?(s.construct({namespace:i,projectId:(r=this.options)==null?void 0:r.projectId,networks:(o=this.caipNetworks)==null?void 0:o.filter(({chainNamespace:a})=>a===i)}),n[i]=s):n[i]=new kBe({namespace:i,networks:this.getCaipNetworks()}),n},{})}async initChainAdapter(e){this.onConnectors(e),this.listenAdapter(e);const n=this.getAdapter(e);if(!n)throw new Error("adapter not found");await n.syncConnectors(),await this.createUniversalProviderForAdapter(e)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async e=>{await this.initChainAdapter(e)})),this.initAdapterController()}onConnectors(e){const n=this.getAdapter(e);n==null||n.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){const n=this.getAdapter(e);if(!n)return;const i=He.getConnectionStatus();ye.state.enableReconnect===!1?this.setStatus("disconnected",e):i==="connected"?this.setStatus("connecting",e):i==="disconnected"?(He.clearAddressCache(),this.setStatus(i,e)):this.setStatus(i,e),n.on("switchNetwork",({address:s,chainId:r})=>{var l,d;const o=this.getCaipNetworks().find(h=>h.id.toString()===r.toString()||h.caipNetworkId.toString()===r.toString()),a=ne.state.activeChain===e,c=(d=(l=ne.state.chains.get(e))==null?void 0:l.accountState)==null?void 0:d.address;if(o){const h=a&&s?s:c;h&&this.syncAccount({address:h,chainId:o.id,chainNamespace:e})}else this.setUnsupportedNetwork(r)}),n.on("disconnect",()=>{const s=this.remoteFeatures.multiWallet,r=Array.from(Ve.state.connections.values()).flat();this.onDisconnectNamespace({chainNamespace:e,closeModal:!s||r.length===0})}),n.on("connections",s=>{this.setConnections(s,e)}),n.on("pendingTransactions",()=>{const s=this.getAddress(e),r=ne.state.activeCaipNetwork;!s||!(r!=null&&r.id)||this.updateNativeBalance(s,r.id,r.chainNamespace)}),n.on("accountChanged",({address:s,chainId:r,connector:o})=>{var d,h;this.handlePreviousConnectorConnection(o);const a=ne.state.activeChain===e;o!=null&&o.provider&&(this.syncProvider({id:o.id,type:o.type,provider:o==null?void 0:o.provider,chainNamespace:e}),this.syncConnectedWalletInfo(e));const c=(h=(d=ne.getNetworkData(e))==null?void 0:d.caipNetwork)==null?void 0:h.id,l=r||c;a&&l?this.syncAccount({address:s,chainId:l,chainNamespace:e}):!a&&l?(this.syncAccountInfo(s,l,e),this.syncBalance({address:s,chainId:l,chainNamespace:e})):this.syncAccountInfo(s,r,e),He.addConnectedNamespace(e)})}async handlePreviousConnectorConnection(e){var c;const n=e==null?void 0:e.chain,i=e==null?void 0:e.id,s=Oe.getConnectorId(n),r=(c=ye.state.remoteFeatures)==null?void 0:c.multiWallet,a=n&&i&&s&&s!==i&&!r;try{a&&await Ve.disconnect({id:s,namespace:n})}catch(l){console.warn("Error disconnecting previous connector",l)}}async createUniversalProviderForAdapter(e){var n,i,s;await this.getUniversalProvider(),this.universalProvider&&await((s=(i=(n=this.chainAdapters)==null?void 0:n[e])==null?void 0:i.setUniversalProvider)==null?void 0:s.call(i,this.universalProvider))}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async unSyncExistingConnection(){try{await Promise.allSettled(this.chainNamespaces.map(e=>
406Ve.disconnect({namespace:e,initialDisconnect:!0})))}catch(e){console.error("Error disconnecting existing connections:",e)}}async reconnectWalletConnect(){await this.syncWalletConnectAccount();const e=this.getAddress();this.getCaipAddress()||He.deleteRecentWallet();const n=He.getRecentWallet();Et.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:e,properties:{method:Ue.isMobile()?"mobile":"qrcode",name:(n==null?void 0:n.name)||"Unknown",reconnect:!0,view:Pe.state.view,walletRank:n==null?void 0:n.order}})}async syncNamespaceConnection(e){try{e===we.CHAIN.EVM&&Ue.isSafeApp()&&Oe.setConnectorId(we.CONNECTOR_ID.SAFE,e);const n=Oe.getConnectorId(e);switch(this.setStatus("connecting",e),n){case we.CONNECTOR_ID.WALLET_CONNECT:await this.reconnectWalletConnect();break;case we.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(n){console.warn("AppKit couldn't sync existing connection",n),this.setStatus("disconnected",e)}}onDisconnectNamespace(e){const{chainNamespace:n,closeModal:i}=e||{};ne.resetAccount(n),ne.resetNetwork(n),He.removeConnectedNamespace(n);const s=Array.from(ne.state.chains.keys());
406(n?[n]:s).forEach(o=>He.addDisconnectedConnectorId(Oe.getConnectorId(o)||"",o)),Oe.removeConnectorId(n),ss.resetChain(n),this.setUser(null,n),this.setStatus("disconnected",n),this.setConnectedWalletInfo(null,n),i!==!1&&wn.close()}async syncAdapterConnections(){await Promise.allSettled(this.chainNamespaces.map(e=>{const n=this.getAdapter(e),i=this.getCaipAddress(e),s=this.getCaipNetwork(e);return n==null?void 0:n.syncConnections({connectToFirstConnector:!i,caipNetwork:s})}))}async syncAdapterConnection(e){var a,c,l,d,h;const n=this.getAdapter(e),i=this.getCaipNetwork(e),s=Oe.getConnectorId(e),o=Oe.getConnectors(e).find(p=>p.id===s);try{if(!n||!o)throw new Error(`Adapter or connector not found for namespace ${e}`);if(!(i!=null&&i.id))throw new Error("CaipNetwork not found");const p=await(n==null?void 0:n.syncConnection({namespace:e,id:o.id,chainId:i.id,rpcUrl:(l=(c=(a=i==null?void 0:i.rpcUrls)==null?void 0:a.default)==null?void 0:c.http)==null?void 0:l[0]}));p?(this.syncProvider({...p,chainNamespace:e}),await this.syncAccount({...p,chainNamespace:e}),this.setStatus("connected",e),Et.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:p.address,properties:{method:"browser",name:((d=o.info)==null?void 0:d.name)||o.name||"Unknown",reconnect:!0,view:Pe.state.view,walletRank:(h=o==null?void 0:o.explorerWallet)==null?void 0:h.order}})):this.setStatus("disconnected",e)}catch{this.onDisconnectNamespace({chainNamespace:e,closeModal:!1})}}async syncWalletConnectAccount(){var i,s;const e=Object.keys(((s=(i=this.universalProvider)==null?void 0:i.session)==null?void 0:s.namespaces)||{}),n=this.chainNamespaces.map(async r=>{var h,p,g,b,w;const o=this.getAdapter(r);if(!o)return;const a=((b=(g=(p=(h=this.universalProvider)==null?void 0:h.session)==null?void 0:p.namespaces)==null?void 0:g[r])==null?void 0:b.accounts)||[],c=(w=ne.state.activeCaipNetwork)==null?void 0:w.id,l=a.find(C=>{const{chainId:E}=Lr.parseCaipAddress(C);return E===(c==null?void 0:c.toString())})||a[0];if(l){const C=Lr.validateCaipAddress(l),{chainId:E,address:T}=Lr.parseCaipAddress(C);if(ss.setProviderId(r,Fo.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&ne.state.activeCaipNetwork&&o.namespace!==we.CHAIN.EVM){const A=o.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:ne.state.activeCaipNetwork});ss.setProvider(r,A)}else ss.setProvider(r,this.universalProvider);Oe.setConnectorId(we.CONNECTOR_ID.WALLET_CONNECT,r),He.addConnectedNamespace(r),await this.syncAccount({address:T,chainId:E,chainNamespace:r})}else e.includes(r)&&this.setStatus("disconnected",r);const d=this.getApprovedCaipNetworksData();this.syncConnectedWalletInfo(r),ne.setApprovedCaipNetworksData(r,{approvedCaipNetworkIds:d.approvedCaipNetworkIds,supportsAllNetworks:d.supportsAllNetworks})});await Promise.all(n)}syncProvider({type:e,provider:n,id:i,chainNamespace:s}){ss.setProviderId(s,e),ss.setProvider(s,n),Oe.setConnectorId(i,s)}async syncAccount(e){var h,p;const n=e.chainNamespace===ne.state.activeChain,i=ne.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:s,chainId:r,chainNamespace:o}=e,{chainId:a}=He.getActiveNetworkProps(),c=(i==null?void 0:i.id)||a,l=((h=ne.state.activeCaipNetwork)==null?void 0:h.name)===we.UNSUPPORTED_NETWORK_NAME,d=ne.getNetworkProp("supportsAllNetworks",o);if(this.setStatus("connected",o),!(l&&!d)&&c){let g=this.getCaipNetworks().find(E=>E.id.toString()===c.toString()),b=this.getCaipNetworks().find(E=>E.chainNamespace===o);if(!d&&!g&&!b){const E=this.getApprovedCaipNetworkIds()||[],T=E.find(k=>{var R;return((R=Lr.parseCaipNetworkId(k))==null?void 0:R.chainId)===c.toString()}),A=E.find(k=>{var R;return((R=Lr.parseCaipNetworkId(k))==null?void 0:R.chainNamespace)===o});g=this.getCaipNetworks().find(k=>k.caipNetworkId===T),b=this.getCaipNetworks().find(k=>k.caipNetworkId===A||"deprecatedCaipNetworkId"in k&&k.deprecatedCaipNetworkId===A)}const w=g||b;(w==null?void 0:w.chainNamespace)===ne.state.activeChain?ye.state.enableNetworkSwitch&&!ye.state.allowUnsupportedChain&&((p=ne.state.activeCaipNetwork)==null?void 0:p.name)===we.UNSUPPORTED_NETWORK_NAME?ne.showUnsupportedChainUI():this.setCaipNetwork(w):n||i&&this.setCaipNetworkOfNamespace(i,o),this.syncConnectedWalletInfo(o);const C=this.getAddress(o);tr.isLowerCaseMatch(s,C)||this.syncAccountInfo(s,w==null?void 0:w.id,o),n?await this.syncBalance({address:s,chainId:w==null?void 0:w.id,chainNamespace:o}):await this.syncBalance({address:s,chainId:i==null?void 0:i.id,chainNamespace:o}),this.syncIdentity({address:s,chainId:r,chainNamespace:o})}}async syncAccountInfo(e,n,i){const s=this.getCaipAddress(i),r=n||(s==null?void 0:s.split(":")[1]);if(!r)return;const o=`${i}:${r}:${e}`;this.setCaipAddress(o,i,!0),await this.syncIdentity({address:e,chainId:r,chainNamespace:i})}async syncReownName(e,n){try{const i=await this.getReownName(e);
406if(i[0]){const s=i[0];this.setProfileName(s.name,n)}else this.setProfileName(null,n)}catch{this.setProfileName(null,n)}}syncConnectedWalletInfo(e){var s;const n=Oe.getConnectorId(e),i=ss.getProviderId(e);if(i===Fo.CONNECTOR_TYPE_ANNOUNCED||i===Fo.CONNECTOR_TYPE_INJECTED){if(n){const o=this.getConnectors().find(a=>{var h,p;const c=a.id===n,l=((h=a.info)==null?void 0:h.rdns)===n,d=(p=a.connectors)==null?void 0:p.some(g=>{var b;return g.id===n||((b=g.info)==null?void 0:b.rdns)===n});return c||l||!!d});if(o){const{info:a,name:c,imageUrl:l}=o,d=l||this.getConnectorImage(o);this.setConnectedWalletInfo({name:c,icon:d,...a},e)}}}else if(i===Fo.CONNECTOR_TYPE_WALLET_CONNECT){const r=ss.getProvider(e);r!=null&&r.session&&this.setConnectedWalletInfo({...r.session.peer.metadata,name:r.session.peer.metadata.name,icon:(s=r.session.peer.metadata.icons)==null?void 0:s[0]},e)}else if(n&&(n===we.CONNECTOR_ID.COINBASE_SDK||n===we.CONNECTOR_ID.COINBASE)){const r=this.getConnectors().find(l=>l.id===n),o=(r==null?void 0:r.name)||"Coinbase Wallet",a=(r==null?void 0:r.imageUrl)||this.getConnectorImage(r),c=r==null?void 0:r.info;this.setConnectedWalletInfo({...c,name:o,icon:a},e)}}async syncBalance(e){!l5.getNetworksByNamespace(this.getCaipNetworks(),e.chainNamespace).find(i=>{var s;return i.id.toString()===((s=e.chainId)==null?void 0:s.toString())})||!e.chainId||await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async ready(){await this.readyPromise}async updateNativeBalance(e,n,i){const s=this.getAdapter(i),r=ne.getCaipNetworkByNamespace(i,n);if(s){const o=await s.getBalance({address:e,chainId:n,caipNetwork:r,tokens:this.options.tokens});return this.setBalance(o.balance,o.symbol,i),o}}async initializeUniversalAdapter(){var s,r,o,a,c,l,d,h,p,g;const e=KUe.createLogger((b,...w)=>{b&&this.handleAlertError(b),console.error(...w)}),n={projectId:(s=this.options)==null?void 0:s.projectId,metadata:{name:(r=this.options)!=null&&r.metadata?(o=this.options)==null?void 0:o.metadata.name:"",description:(a=this.options)!=null&&a.metadata?(c=this.options)==null?void 0:c.metadata.description:"",url:(l=this.options)!=null&&l.metadata?(d=this.options)==null?void 0:d.metadata.url:"",icons:(h=this.options)!=null&&h.metadata?(p=this.options)==null?void 0:p.metadata.icons:[""]},logger:e};ye.setManualWCControl(!!((g=this.options)!=null&&g.manualWCControl)),this.universalProvider=this.options.universalProvider??await tUe.init(n);const i=this.universalProvider.disconnect.bind(this.universalProvider);this.universalProvider.disconnect=async()=>{try{return await i()}catch(b){if(b instanceof Error&&b.message.includes("Missing or invalid. Record was recently deleted"))return;throw b}},ye.state.enableReconnect===!1&&this.universalProvider.session&&await this.universalProvider.disconnect(),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&this.chainNamespaces.forEach(e=>{lf.listenWcProvider({universalProvider:this.universalProvider,namespace:e,onDisplayUri:n=>{Ve.setUri(n)},onConnect:n=>{const{address:i}=Ue.getAccount(n[0]);Ve.finalizeWcConnection(i)},onDisconnect:()=>{ne.state.noAdapters&&this.resetAccount(e),Ve.resetWcConnection()},onChainChanged:n=>{const i=ne.state.activeChain,s=i&&Oe.state.activeConnectorIds[i]===we.CONNECTOR_ID.WALLET_CONNECT;if(i===e&&(ne.state.noAdapters||s)){const r=this.getCaipNetworks().find(a=>a.id.toString()===n.toString()||a.caipNetworkId.toString()===n.toString()),o=this.getCaipNetwork();if(!r){this.setUnsupportedNetwork(n);return}(o==null?void 0:o.id.toString())!==(r==null?void 0:r.id.toString())&&(o==null?void 0:o.chainNamespace)===(r==null?void 0:r.chainNamespace)&&this.setCaipNetwork(r)}},onAccountsChanged:n=>{const i=ne.state.activeChain,s=i&&Oe.state.activeConnectorIds[i]===we.CONNECTOR_ID.WALLET_CONNECT;if(i===e&&(ne.state.noAdapters||s)){const r=n==null?void 0:n[0];r&&this.syncAccount({address:r.address,chainId:r.chainId,chainNamespace:r.chainNamespace})}}})})}createUniversalProvider(){var e;return!this.universalProviderInitPromise&&Ue.isClient()&&((e=this.options)!=null&&e.projectId)&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}
406async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){Et.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:e instanceof Error?e.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",e)}return this.universalProvider}getDisabledCaipNetworks(){const e=ne.getAllApprovedCaipNetworkIds(),n=ne.getAllRequestedCaipNetworks();return Ue.sortRequestedNetworks(e,n).filter(s=>ne.isCaipNetworkDisabled(s))}handleAlertError(e){const n=Object.entries(ys.UniversalProviderErrors).find(([,{message:a}])=>e.message.includes(a)),[i,s]=n??[],{message:r,alertErrorKey:o}=s??{};if(i&&r&&!this.reportedAlertErrors[i]){const a=ys.ALERT_ERRORS[o];a&&(Ss.open(a,"error"),this.reportedAlertErrors[i]=!0)}}getAdapter(e){var n;if(e)return(n=this.chainAdapters)==null?void 0:n[e]}createAdapter(e){var s,r;if(!e)return;const n=e.namespace;if(!n)return;this.createClients();const i=e;i.namespace=n,i.construct({namespace:n,projectId:(s=this.options)==null?void 0:s.projectId,networks:(r=this.caipNetworks)==null?void 0:r.filter(({chainNamespace:o})=>o===n)}),this.chainNamespaces.includes(n)||this.chainNamespaces.push(n),this.chainAdapters&&(this.chainAdapters[n]=i)}async open(e){await this.injectModalUi(),e!=null&&e.uri&&Ve.setUri(e.uri);const{isSwap:n,isSend:i}=this.toModalOptions();return n(e)?wn.open({...e,data:{swap:e.arguments}}):i(e)&&e.arguments?this.openSend(e.arguments):wn.open(e)}async close(){await this.injectModalUi(),wn.close()}setLoading(e,n){wn.setLoading(e,n)}async disconnect(e){await Ve.disconnect({namespace:e})}getSIWX(){return ye.state.siwx}getError(){return""}getChainId(){var e;return(e=ne.state.activeCaipNetwork)==null?void 0:e.id}async switchNetwork(e,{throwOnFailure:n=!1}={}){const i=this.getCaipNetworks().find(s=>s.id===e.id);if(!i){Ss.open(ys.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await ne.switchActiveNetwork(i,{throwOnFailure:n})}getWalletProvider(){return ne.state.activeChain?ss.state.providers[ne.state.activeChain]:null}getWalletProviderType(){return ss.getProviderId(ne.state.activeChain)}subscribeProviders(e){return ss.subscribeProviders(e)}getThemeMode(){return Xr.state.themeMode}getThemeVariables(){return Xr.state.themeVariables}setThemeMode(e){Xr.setThemeMode(e),lI(Xr.state.themeMode)}setTermsConditionsUrl(e){ye.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){ye.setPrivacyPolicyUrl(e)}setThemeVariables(e){Xr.setThemeVariables(e),xBe(Xr.state.themeVariables)}subscribeTheme(e){return Xr.subscribe(e)}subscribeConnections(e){return this.remoteFeatures.multiWallet?Ve.subscribe(e):(Ss.open(we.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),()=>{})}getWalletInfo(e){var i,s;if(e)return(s=(i=ne.state.chains.get(e))==null?void 0:i.accountState)==null?void 0:s.connectedWalletInfo;const n=ne.getAccountData();return n==null?void 0:n.connectedWalletInfo}getAccount(e){const n=e||ne.state.activeChain,i=Oe.getAuthConnector(n),s=ne.getAccountData(n),r=He.getConnectedConnectorId(ne.state.activeChain),o=Ve.getConnections(n);if(!n)throw new Error("AppKit:getAccount - namespace is required");const a=o.flatMap(c=>c.accounts.map(({address:l,type:d,publicKey:h})=>Ue.createAccount(n,l,d||"eoa",h)));if(s)return{allAccounts:a,caipAddress:s.caipAddress,address:Ue.getPlainAddress(s.caipAddress),isConnected:!!s.caipAddress,status:s.status,embeddedWalletInfo:i&&r===we.CONNECTOR_ID.AUTH?{user:s.user?{...s.user,username:He.getConnectedSocialUsername()}:void 0,authProvider:s.socialProvider||"email",accountType:$s(n),isSmartAccountDeployed:!!s.smartAccountDeployed}:void 0}}subscribeAccount(e,n){const i=()=>{const s=this.getAccount(n);s&&e(s)};n?ne.subscribeChainProp("accountState",i,n):ne.subscribe(i),Oe.subscribe(i)}subscribeNetwork(e){return ne.subscribe(({activeCaipNetwork:n})=>{e({caipNetwork:n,chainId:n==null?void 0:n.id,caipNetworkId:n==null?void 0:n.caipNetworkId})})}subscribeWalletInfo(e,n){return n?ne.subscribeChainProp("accountState",i=>e(i==null?void 0:i.connectedWalletInfo),n):ne.subscribeChainProp("accountState",i=>e(i==null?void 0:i.connectedWalletInfo))}subscribeShouldUpdateToAddress(e){ne.subscribeChainProp("accountState",n=>e(n==null?void 0:n.shouldUpdateToAddress))}subscribeCaipNetworkChange(e){ne.subscribeKey("activeCaipNetwork",e)}getState(){return Uc.state}getRemoteFeatures(){return ye.state.remoteFeatures}subscribeState(e){return Uc.subscribe(e)}subscribeRemoteFeatures(e){return ye.subscribeKey("remoteFeatures",e)}showErrorMessage(e){ti.showError(e)}showSuccessMessage(e){ti.showSuccess(e)}getEvent(){return{...Et.state}}subscribeEvents(e){return Et.subscribe(e)}replace(e){Pe.replace(e)}redirect(e){Pe.push(e)}popTransactionStack(e){Pe.popTransactionStack(e)}isOpen(){return wn.state.open}isTransactionStackEmpty(){return Pe.state.transactionStack.length===0}static getInstance(){return this.instance}updateFeatures(e){ye.setFeatures(e)}updateRemoteFeatures(e){ye.setRemoteFeatures(e)}updateOptions(e){const i={...ye.state||{},...e};ye.setOptions(i)}setConnectMethodsOrder(e){ye.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){ye.setWalletFeaturesOrder(e)}setCollapseWallets(e){ye.setCollapseWallets(e)}setSocialsOrder(e){ye.setSocialsOrder(e)}getConnectMethodsOrder(){return Fc.getConnectOrderMethod(ye.state.features,Oe.getConnectors())}addNetwork(e,n){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);const i=this.extendCaipNetwork(n,this.options);this.getCaipNetworks().find(s=>s.id===i.id)||ne.addNetwork(i)}removeNetwork(e,n){if(this.chainAdapters&&!this.chainAdapters[e])throw new Error(`Adapter for namespace ${e} doesn't exist`);this.getCaipNetworks().find(s=>s.id===n)&&ne.removeNetwork(e,n)}}let _H=!1;class IBe extends PBe{async onAuthProviderConnected(e){const n=tr.userChainIdToChainNamespace(e==null?void 0:e.chainId);if(e.message&&e.signature&&e.siwxMessage&&await jo.addEmbeddedWalletSession({chainId:e.siwxMessage.chainId,accountAddress:e.address,notBefore:e.siwxMessage.notBefore,statement:e.siwxMessage.statement,resources:e.siwxMessage.resources,requestId:e.siwxMessage.requestId,issuedAt:e.siwxMessage.issuedAt,domain:e.siwxMessage.domain,uri:e.siwxMessage.uri,version:e.siwxMessage.version,nonce:e.siwxMessage.nonce},e.message,e.signature),!n)throw new Error("AppKit:onAuthProviderConnected - namespace is required");const i=n===we.CHAIN.EVM?`eip155:${e.chainId}:${e.address}`:`${e.chainId}:${e.address}`,s=ye.state.defaultAccountTypes[n],r=$s(n),o=e.preferredAccountType||r||s;this.setCaipAddress(i,n);const{signature:a,siwxMessage:c,message:l,...d}=e,h=ne.getAccountData(n);this.setUser({...(h==null?void 0:h.user)||{},...d},n),this.setSmartAccountDeployed(!!e.smartAccountDeployed,n),this.setPreferredAccountType(o,n),await Promise.all([this.syncAuthConnectorTheme(this.authProvider),this.syncAccount({address:e.address,chainId:e.chainId,chainNamespace:n})]),this.setLoading(!1,n)}setupAuthConnectorListeners(e){e.onRpcRequest(n=>{Dc.checkIfRequestExists(n)?Dc.checkIfRequestIsSafe(n)||this.handleUnsafeRPCRequest():(this.open(),console.error(Wi.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:n.method}),setTimeout(()=>{this.showErrorMessage(Wi.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),e.rejectRpcRequests())}),e.onRpcError(()=>{this.isOpen()&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack("error"))}),e.onRpcSuccess((n,i)=>{const s=Dc.checkIfRequestIsSafe(i),r=this.getAddress(),o=ne.state.activeCaipNetwork;s||(r&&(o!=null&&o.id)&&this.updateNativeBalance(r,o.id,o.chainNamespace),this.isTransactionStackEmpty()?this.close():this.popTransactionStack("success"))}),e.onNotConnected(()=>{const n=ne.state.activeChain;if(!n)throw new Error("AppKit:onNotConnected - namespace is required");Oe.getConnectorId(n)===we.CONNECTOR_ID.AUTH&&(this.setCaipAddress(null,n),this.setLoading(!1,n))}),e.onConnect(this.onAuthProviderConnected.bind(this)),e.onSocialConnected(this.onAuthProviderConnected.bind(this)),e.onSetPreferredAccount(({address:n,type:i})=>{const s=ne.state.activeChain;if(!s)throw new Error("AppKit:onSetPreferredAccount - namespace is required");n&&this.setPreferredAccountType(i,s)})}async syncAuthConnectorTheme(e){if(!e)return;const n=Xr.getSnapshot();await e.syncTheme({themeMode:n.themeMode,themeVariables:n.themeVariables,w3mThemeVariables:d5(n.themeVariables,n.themeMode)})}async syncAuthConnector(e,n){var d,h,p,g,b,w,C,E,T;const i=we.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(n),s=n===ne.state.activeChain;if(!i)return;this.setLoading(!0,n);const r=e.getLoginEmailUsed();this.setLoading(r,n),r&&this.setStatus("connecting",n);const o=e.getEmail(),a=e.getUsername(),c=((d=ne.getAccountData(n))==null?void 0:d.user)||{};this.setUser({...c,username:a,email:o},n),this.setupAuthConnectorListeners(e);const{isConnected:l}=await e.isConnected();if(n&&i&&s)if(l&&((h=this.connectionControllerClient)!=null&&h.connectExternal)){await e.init(
406),await this.syncAuthConnectorTheme(e),await((b=this.connectionControllerClient)==null?void 0:b.connectExternal({id:we.CONNECTOR_ID.AUTH,info:{name:we.CONNECTOR_ID.AUTH},type:Fo.CONNECTOR_TYPE_AUTH,provider:e,chainId:(g=(p=ne.getNetworkData(n))==null?void 0:p.caipNetwork)==null?void 0:g.id,chain:n})),this.setStatus("connected",n);const A=He.getConnectedSocialProvider();A?Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",address:this.getAddress(),properties:{provider:A,reconnect:!0}}):Et.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:this.getAddress(),properties:{method:"email",name:((T=(E=(C=(w=this.universalProvider)==null?void 0:w.session)==null?void 0:C.peer)==null?void 0:E.metadata)==null?void 0:T.name)||"Unknown",reconnect:!0,view:Pe.state.view,walletRank:void 0}})}else Oe.getConnectorId(n)===we.CONNECTOR_ID.AUTH&&(this.setStatus("disconnected",n),He.removeConnectedNamespace(n));this.setLoading(!1,n)}async checkExistingTelegramSocialConnection(e){var n;try{if(!Ue.isTelegram())return;const i=He.getTelegramSocialProvider();if(!i||!Ue.isClient())return;const r=new URL(window.location.href).searchParams.get("result_uri");if(!r)return;i&&ne.setAccountProp("socialProvider",i,e),await((n=this.authProvider)==null?void 0:n.init());const o=Oe.getAuthConnector();i&&o&&(this.setLoading(!0,e),await Ve.connectExternal({id:o.id,type:o.type,socialUri:r},o.chain),He.setConnectedSocialProvider(i),He.removeTelegramSocialProvider(),Et.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:i}}))}catch(i){this.setLoading(!1,e),console.error("checkExistingSTelegramocialConnection error",i)}try{const i=new URL(window.location.href);i.searchParams.delete("result_uri"),window.history.replaceState({},document.title,i.toString())}catch(i){console.error("tma social login failed",i)}}createAuthProvider(e){var l,d,h,p;if(!we.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e))return;const i=(l=this.remoteFeatures)==null?void 0:l.email,s=Array.isArray((d=this.remoteFeatures)==null?void 0:d.socials)&&this.remoteFeatures.socials.length>0,r=i||s,a=tr.getActiveNamespaceConnectedToAuth()||e;!this.authProvider&&((h=this.options)!=null&&h.projectId)&&r&&(this.authProvider=pg.getInstance({projectId:this.options.projectId,enableLogger:this.options.enableAuthLogger,chainId:(p=this.getCaipNetwork(a))==null?void 0:p.caipNetworkId,abortController:ys.EmbeddedWalletAbortController,onTimeout:g=>{g==="iframe_load_failed"?Ss.open(ys.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):g==="iframe_request_timeout"?Ss.open(ys.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):g==="unverified_domain"&&Ss.open(ys.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:g=>Yh(g),getCaipNetworks:g=>ne.getCaipNetworks(g)}),Uc.subscribeOpen(g=>{var b;!g&&this.isTransactionStackEmpty()&&((b=this.authProvider)==null||b.rejectRpcRequests())}));const c=e===ne.state.activeChain&&ye.state.enableReconnect;ye.state.enableReconnect===!1?this.syncAuthConnectorTheme(this.authProvider):this.authProvider&&c&&(this.syncAuthConnector(this.authProvider,e),this.checkExistingTelegramSocialConnection(e))}createAuthProviderForAdapter(e){var n,i,s;this.createAuthProvider(e),this.authProvider&&((s=(i=(n=this.chainAdapters)==null?void 0:n[e])==null?void 0:i.setAuthProvider)==null||s.call(i,this.authProvider))}initControllers(e){super.initControllers(e),this.options.excludeWalletIds&&ut.initializeExcludedWallets({ids:this.options.excludeWalletIds})}async switchCaipNetwork(e){var o,a,c;if(!e)return;const n=ne.state.activeChain,i=e.chainNamespace,s=this.getAddressByChainNamespace(i);if(i===n&&((o=ne.getAccountData(i))!=null&&o.caipAddress)){const l=this.getAdapter(i);await(l==null?void 0:l.switchNetwork({caipNetwork:e})),this.setCaipNetwork(e)}else{const d=ss.getProviderId(n)===Fo.CONNECTOR_TYPE_AUTH,h=ss.getProviderId(i),p=h===Fo.CONNECTOR_TYPE_AUTH,g=we.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(i);if(!i)throw new Error("AppKit:switchCaipNetwork - networkNamespace is required");if((d&&h===void 0||p)&&g)try{if(ne.state.activeChain=e.chainNamespace,s){const b=this.getAdapter(i);await(b==null?void 0:b.switchNetwork({caipNetwork:e}))}else await((c=(a=this.connectionControllerClient)==null?void 0:a.connectExternal)==null?void 0:c.call(a,{id:we.CONNECTOR_ID.AUTH,provider:this.authProvider,chain:i,chainId:e.id,type:Fo.CONNECTOR_TYPE_AUTH,caipNetwork:e}));this.setCaipNetwork(e)}catch{const w=this.getAdapter(i);await(w==null?void 0:w.switchNetwork({caipNetwork:e}))}else if(h===Fo.CONNECTOR_TYPE_WALLET_CONNECT){if(!ne.state.noAdapters){const b=this.getAdapter(i);await(b==null?void 0:b.switchNetwork({caipNetwork:e}))}this.setCaipNetwork(e),this.syncWalletConnectAccount()}else this.setCaipNetwork(e),s&&this.syncAccount({address:s,chainId:e.id,chainNamespace:i})}}async initialize(e){var n;await super.initialize(e),(n=this.chainNamespaces)==null||n.forEac
406h(i=>{this.createAuthProviderForAdapter(i)}),await this.injectModalUi(),Uc.set({initialized:!0})}async syncIdentity({address:e,chainId:n,chainNamespace:i}){var a;const s=`${i}:${n}`,r=(a=this.caipNetworks)==null?void 0:a.find(c=>c.caipNetworkId===s);if(r!=null&&r.testnet){this.setProfileName(null,i),this.setProfileImage(null,i);return}const o=Oe.getConnectorId(i)===we.CONNECTOR_ID.AUTH;try{const{name:c,avatar:l}=await this.fetchIdentity({address:e});!c&&o?await this.syncReownName(e,i):(this.setProfileName(c,i),this.setProfileImage(l,i))}catch{n!==1&&this.setProfileImage(null,i)}}syncConnectedWalletInfo(e){const n=ss.getProviderId(e);if(n===Fo.CONNECTOR_TYPE_AUTH){const i=this.authProvider;if(i){const s=He.getConnectedSocialProvider()??"email",r=i.getEmail()??i.getUsername();this.setConnectedWalletInfo({name:n,identifier:r,social:s},e)}}else super.syncConnectedWalletInfo(e)}async injectModalUi(){if(Ue.isClient()&&!_H)try{const e={...fn.DEFAULT_FEATURES,...this.options.features},n=this.remoteFeatures;if(await this.loadModalComponents(e,n),Ue.isClient()&&!document.querySelector("w3m-modal")){const s=document.createElement("w3m-modal");!ye.state.disableAppend&&!ye.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",s)}_H=!0}catch(e){console.error("Error injecting modal UI:",e)}}async loadModalComponents(e,n){if(!Ue.isClient())return;const i=[];(n.email||n.socials&&n.socials.length>0)&&i.push(Lt(()=>import("./embedded-wallet-BpOP4x5e.js"),[])),n.email&&i.push(Lt(()=>import("./email-BhCufiDg.js"),__vite__mapDeps([0,1]))),n.socials&&i.push(Lt(()=>import("./socials-D-RtqOri.js"),[])),n.swaps&&n.swaps.length>0&&i.push(Lt(()=>import("./swaps-NTA_ct5x.js"),__vite__mapDeps([2,3,4]))),e.send&&i.push(Lt(()=>import("./send-C2bbawkj.js"),__vite__mapDeps([5,6,4,3]))),e.receive&&i.push(Lt(()=>import("./receive-Br33ZOnt.js"),[])),n.onramp&&n.onramp.length>0&&i.push(Lt(()=>import("./onramp-CQ8eE_3n.js"),[])),n.payWithExchange&&i.push(Lt(()=>import("./pay-with-exchange-3x0UmeGj.js"),__vite__mapDeps([7,6]))),n.activity&&i.push(Lt(()=>import("./transactions-DIzYToip.js"),[])),(e.pay||n.payments)&&i.push(Lt(()=>import("./index-CBPZFUep.js"),__vite__mapDeps([8,9]))),n.emailCapture&&i.push(Lt(()=>import("./data-capture-3cxcdNcd.js"),__vite__mapDeps([10,1,11]))),await Promise.all([...i,Lt(()=>Promise.resolve().then(()=>DWe),void 0),Lt(()=>import("./w3m-modal-Beg9jjTu.js"),__vite__mapDeps([12,9,3]))])}}let L0;function DBe(t){t&&(L0=t)}function OBe(){if(!L0)throw new Error('Please call "createAppKit" before using "useAppKit" hook');async function t(n){return L0==null?void 0:L0.open(n)}async function e(){await(L0==null?void 0:L0.close())}return{open:t,close:e}}const MBe="1.8.15";/** 407 * @license 408 * Copyright 2018 Google LLC 409 * SPDX-License-Identifier: BSD-3-Clause 410 */const LBe=new Set(["children","localName","ref","style","className"]),SH=new WeakMap,AH=(t,e,n,i,s)=>{const r=s==null?void 0:s[e];r===void 0?(t[e]=n,n==null&&e in HTMLElement.prototype&&t.removeAttribute(e)):n!==i&&((o,a,c)=>{let l=SH.get(o);l===void 0&&SH.set(o,l=new Map);let d=l.get(a);c!==void 0?d===void 0?(l.set(a,d={handleEvent:c}),o.addEventListener(a,d)):d.handleEvent=c:d!==void 0&&(l.delete(a),o.removeEventListener(a,d))})(t,r,n)},TS=({react:t,tagName:e,elementClass:n,events:i,displayName:s})=>{const r=new Set(Object.keys(i??{})),o=t.forwardRef(((a,c)=>{const l=t.useRef(new Map),d=t.useRef(null),h={},p={};for(const[g,b]of Object.entries(a))LBe.has(g)?h[g==="className"?"class":g]=b:r.has(g)||g in n.prototype?p[g]=b:h[g]=b;return t.useLayoutEffect((()=>{if(d.current===null)return;const g=new Map;for(const b in p)AH(d.current,b,a[b],l.current.get(b),i),l.current.delete(b),g.set(b,a[b]);for(const[b,w]of l.current)AH(d.current,b,void 0,w,i);l.current=g})),t.useLayoutEffect((()=>{var g;(g=d.current)==null||g.removeAttribute("defer-hydration")}),[]),h.suppressHydrationWarning=!0,t.createElement(e,{...h,ref:t.useCallback((g=>{d.current=g,typeof c=="function"?c(g):c!==null&&(c.current=g)}),[c])})}));return o.displayName=s??n.name,o};/** 411 * @license 412 * Copyright 2017 Google LLC 413 * SPDX-License-Identifier: BSD-3-Clause 414 */const $Be={attribute:!0,type:String,converter:R_,reflect:!1,hasChanged:RM},UBe=(t=$Be,e,n)=>{const{kind:i,metadata:s}=n;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),i==="setter"&&((t=Object.create(t)).wrapped=!0),r.set(n.name,t),i==="accessor"){const{name:o}=n;return{set(a){const c=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,c,t)},init(a){return a!==void 0&&this.C(o,void 0,t,a),a}}}if(i==="setter"){const{name:o}=n;return function(a){const c=this[o];e.call(this,a),this.requestUpdate(o,c,t)}}throw Error("Unsupported decorator location: "+i)};function le(t){return(e,n)=>typeof n=="object"?UBe(t,e,n):((i,s,r)=>
vendor: 1,191 bytes, lines 414-428
414{const o=s.hasOwnProperty(r);return s.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(s,r):void 0})(t,e,n)}/** 415 * @license 416 * Copyright 2017 Google LLC 417 * SPDX-License-Identifier: BSD-3-Clause 418 */function Me(t){return le({...t,state:!0,attribute:!1})}/** 419 * @license 420 * Copyright 2018 Google LLC 421 * SPDX-License-Identifier: BSD-3-Clause 422 */const xt=t=>t??ir;/** 423 * @license 424 * Copyright 2020 Google LLC 425 * SPDX-License-Identifier: BSD-3-Clause 426 */const sre=Symbol.for(""),BBe=t=>{if((t==null?void 0:t.r)===sre)return t==null?void 0:t._$litStatic$},FBe=t=>({_$litStatic$:t,r:sre}),TH=new Map,jBe=t=>(e,...n)=>{const i=n.length;let s,r;const o=[],a=[];let c,l=0,d=!1;for(;l<i;){for(c=e[l];l<i&&(r=n[l],(s=BBe(r))!==void 0);)c+=s+e[++l],d=!0;l!==i&&a.push(r),o.push(c),l++}if(l===i&&o.push(e[i]),d){const h=o.join("$$lit$$");(e=TH.get(h))===void 0&&(o.raw=o,TH.set(h,e=o)),n=a}return t(e,...n)},kH=jBe(se),VBe=Tn`<svg width="30" height="30" viewBox="0 0 30 30" fill="none"> 427 <g clip-path="url(#clip0_87_33)"> 428 <path d="M23.9367 2.29447e-07H6.05917C5.26333 -0.000218805 4.47526 0.156384 3.73997 0.46086C3.00469 0.765337 2.33661 1.21172 1.77391 1.7745C1.21121 2.33727 0.7649
42817 3.00542 0.460542 3.74074C0.156167 4.47607 -0.000327963 5.26417 5.16031e-07 6.06V23.9433C4.48257e-07 24.7389 0.156744 25.5267 0.461276 26.2617C0.765808 26.9967 1.21216 27.6645 1.77484 28.2269C2.33752 28.7894 3.0055 29.2355 3.74061 29.5397C4.47573 29.8439 5.26358 30.0003 6.05917 30H23.9417C25.5486 29.9996 27.0895 29.3609 28.2257 28.2245C29.3618 27.0881 30 25.5469 30 23.94V6.06C29.9993 4.45241 29.3602 2.91091 28.2232 1.77449C27.0861 0.638064 25.5443 -0.000220881 23.9367 2.29447e-07Z" fill="url(#paint0_linear_87_33)"/> 429 <path d="M14.8708 6.89259L15.4783 5.84259C15.5679 5.68703 15.6873 5.55064 15.8296 5.44122C15.9719 5.3318 16.1344 5.25148 16.3078 5.20486C16.4812 5.15824 16.662 5.14622 16.8401 5.1695C17.0181 5.19277 17.1898 5.25088 17.3453 5.34051C17.5009 5.43013 17.6373 5.54952 17.7467 5.69186C17.8561 5.83419 17.9364 5.99669 17.9831 6.17006C18.0297 6.34344 18.0417 6.5243 18.0184 6.70232C17.9952 6.88034 17.9371 7.05203 17.8474 7.20759L11.9949 17.3401H16.2283C17.5999 17.3401 18.3691 18.9526 17.7724 20.0701H5.36159C5.18215 20.0707 5.00436 20.0359 4.83845 19.9675C4.67254 19.8992 4.5218 19.7986 4.39492 19.6718C4.26803 19.5449 4.16751 19.3941 4.09915 19.2282C4.03079 19.0623 3.99593 18.8845 3.99659 18.7051C3.99659 17.9476 4.60492 17.3401 5.36159 17.3401H8.84159L13.2958 9.61926L11.9041 7.20426C11.738 6.89096 11.7 6.52543 11.7982 6.18469C11.8963 5.84395 12.1229 5.5546 12.4301 5.37763C12.7374 5.20065 13.1014 5.14987 13.4454 5.23599C13.7893 5.3221 14.0864 5.53838 14.2741 5.83926L14.8708 6.89259ZM9.60659 21.4759L8.29409 23.7526C8.20446 23.9082 8.08506 24.0446 7.94271 24.1541C7.80035 24.2636 7.63783 24.344 7.46441 24.3906C7.291 24.4373 7.11009 24.4493 6.93202 24.4261C6.75395 24.4028 6.58221 24.3447 6.42659 24.2551C6.27097 24.1655 6.13454 24.0461 6.02506 23.9037C5.91559 23.7613 5.83523 23.5988 5.78857 23.4254C5.74191 23.252 5.72986 23.0711 5.75311 22.893C5.77637 22.715 5.83446 22.5432 5.92409 22.3876L6.89909 20.7001C8.00159 20.3584 8.89742 20.6209 9.60659 21.4759ZM20.9066 17.3476H24.4583C25.2158 17.3476 25.8233 17.9551 25.8233 18.7126C25.8233 19.4701 25.2149 20.0776 24.4583 20.0776H22.4858L23.8166 22.3876C24.1916 23.0443 23.9708 23.8726 23.3149 24.2551C23.0006 24.4359 22.6274 24.4845 22.2772 24.3903C21.927 24.2961 21.6286 24.0667 21.4474 23.7526C19.2058 19.8643 17.5216 16.9534 16.4041 15.0151C15.2608 13.0426 16.0783 11.0626 16.8841 10.3909C17.7799 11.9293 19.1191 14.2501 20.9074 17.3476H20.9066Z" fill="white"/> 430 </g> 431 <defs> 432 <linearGradient id="paint0_linear_87_33" x1="15" y1="2.29447e-07" x2="15" y2="30" gradientUnits="userSpaceOnUse"> 433 <stop stop-color="#18BFFB"/> 434 <stop offset="1" stop-color="#2072F3"/> 435 </linearGradient> 436 <clipPath id="clip0_87_33"> 437 <rect width="30" height="30" fill="white"/> 438 </clipPath> 439 </defs> 440</svg>`,WBe=Tn`<svg fill="none" viewBox="0 0 40 40"> 441 <g clip-path="url(#a)"> 442 <g clip-path="url(#b)"> 443 <circle cx="20" cy="19.89" r="20" fill="#000" /> 444 <g clip-path="url(#c)"> 445 <path 446 fill="#fff" 447 d="M28.77 23.3c-.69 1.99-2.75 5.52-4.87 5.56-1.4.03-1.86-.84-3.46-.84-1.61 0-2.12.81-3.45.86-2.25.1-5.72-5.1-5.72-9.62 0-4.15 2.9-6.2 5.42-6.25 1.36-.02 2.64.92 3.47.92.83 0 2.38-1.13 4.02-.97.68.03 2.6.28 3.84 2.08-3.27 2.14-2.76 6.61.75 8.25ZM24.2 7.88c-2.47.1-4.49 2.69-4.2 4.84 2.28.17 4.47-2.39 4.2-4.84Z" 448 /> 449 </g> 450 </g> 451 </g> 452 <defs> 453 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 454 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 455 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 456 </defs> 457</svg>`,qBe=Tn` 458 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 8 11"> 459 <path 460 fill="var(--apkt-tokens-theme-textPrimary)" 461 d="M7.862 4.86c.159-1.064-.652-1.637-1.76-2.018l.36-1.443-.879-.218-.35 1.404c-.23-.058-.468-.112-.703-.166l.352-1.413-.877-.219-.36 1.442a29.02 29.02 0 0 1-.56-.132v-.005l-1.21-.302-.234.938s.652.15.638.158c.356.089.42.324.41.51l-.41 1.644a.715.715 0 0 1 .09.03l-.092-.024-.574 2.302c-.044.108-.154.27-.402.208.008.013-.639-.16-.639-.16L.227 8.403l1.142.285c.213.053.42.109.626.161l-.363 1.459.877.218.36-1.443c.239.065.472.125.7.
461182l-.36 1.436.879.219.363-1.456c1.497.283 2.623.17 3.097-1.185.381-1.09-.02-1.719-.807-2.129.574-.132 1.006-.51 1.12-1.289ZM5.856 7.673c-.272 1.09-2.107.5-2.702.353l.482-1.933c.595.149 2.503.443 2.22 1.58Zm.271-2.829c-.247.992-1.775.488-2.27.365l.436-1.753c.496.124 2.092.354 1.834 1.388Z" 462 /> 463 </svg> 464`,zBe=Tn`<svg width="30" height="30" viewBox="0 0 30 30" fill="none"> 465<path d="M14.9978 7.80003H27.4668C26.2032 5.61107 24.3857 3.79333 22.1968 2.52955C20.008 1.26577 17.525 0.600485 14.9975 0.600586C12.47 0.600687 9.98712 1.26617 7.79838 2.53012C5.60964 3.79408 3.79221 5.61197 2.52881 7.80103L8.76281 18.599L8.76881 18.598C8.13412 17.5044 7.79906 16.2628 7.79743 14.9983C7.79579 13.7339 8.12764 12.4914 8.7595 11.3961C9.39136 10.3008 10.3009 9.39159 11.3963 8.76005C12.4918 8.12851 13.7344 7.79702 14.9988 7.79903L14.9978 7.80003Z" fill="url(#paint0_linear_87_32)"/> 466<path d="M21.237 18.5981L15.003 29.3961C17.5305 29.3961 20.0134 28.7308 22.2022 27.467C24.391 26.2032 26.2086 24.3854 27.4721 22.1965C28.7356 20.0075 29.4006 17.5245 29.4003 14.997C29.3999 12.4695 28.7342 9.9867 27.47 7.7981H15.002L15 7.8041C16.2642 7.80168 17.5067 8.13257 18.6022 8.76342C19.6977 9.39428 20.6076 10.3028 21.2401 11.3974C21.8726 12.492 22.2053 13.734 22.2048 14.9982C22.2042 16.2623 21.8704 17.504 21.237 18.5981Z" fill="url(#paint1_linear_87_32)"/> 467<path d="M8.76502 18.601L2.53102 7.80298C1.26664 9.99172 0.600848 12.4748 0.600586 15.0025C0.600324 17.5302 1.2656 20.0134 2.52953 22.2024C3.79345 24.3914 5.61145 26.209 7.80071 27.4725C9.98998 28.736 12.4733 29.4008 15.001 29.4L21.236 18.602L21.232 18.598C20.6022 19.6941 19.6944 20.6049 18.6003 21.2383C17.5062 21.8717 16.2644 22.2055 15.0002 22.2059C13.7359 22.2063 12.4939 21.8733 11.3994 21.2406C10.3049 20.6079 9.39657 19.6977 8.76602 18.602L8.76502 18.601Z" fill="url(#paint2_linear_87_32)"/> 468<path d="M14.9998 22.2C16.9094 22.2 18.7407 21.4415 20.091 20.0912C21.4412 18.741 22.1998 16.9096 22.1998 15C22.1998 13.0905 21.4412 11.2591 20.091 9.90888C18.7407 8.55862 16.9094 7.80005 14.9998 7.80005C13.0902 7.80005 11.2589 8.55862 9.90864 9.90888C8.55837 11.2591 7.7998 13.0905 7.7998 15C7.7998 16.9096 8.55837 18.741 9.90864 20.0912C11.2589 21.4415 13.0902 22.2 14.9998 22.2Z" fill="white"/> 469<path d="M14.9998 20.7C16.5115 20.7 17.9614 20.0995 19.0303 19.0306C20.0993 17.9616 20.6998 16.5118 20.6998 15C20.6998 13.4883 20.0993 12.0385 19.0303 10.9695C17.9614 9.90058 16.5115 9.30005 14.9998 9.30005C13.4881 9.30005 12.0383 9.90058 10.9693 10.9695C9.90034 12.0385 9.2998 13.4883 9.2998 15C9.2998 16.5118 9.90034 17.9616 10.9693 19.0306C12.0383 20.0995 13.4881 20.7 14.9998 20.7Z" fill="#1A73E8"/> 470<defs> 471 <linearGradient id="paint0_linear_87_32" x1="3.29381" y1="2.99503" x2="38.0998" y2="2.99503" gradientUnits="userSpaceOnUse"> 472 <stop stop-color="#D93025"/> 473 <stop offset="1" stop-color="#EA4335"/> 474 </linearGradient> 475 <linearGradient id="paint1_linear_87_32" x1="17.953" y1="29.1431" x2="34.194" y2="-0.298904" gradientUnits="userSpaceOnUse"> 476 <stop stop-color="#FCC934"/> 477 <stop offset="1" stop-color="#FBBC04"/> 478 </linearGradient> 479 <linearGradient id="paint2_linear_87_32" x1="22.873" y1="28.2" x2="6.63202" y2="-1.24102" gradientUnits="userSpaceOnUse"> 480 <stop stop-color="#1E8E3E"/> 481 <stop offset="1" stop-color="#34A853"/> 482 </linearGradient> 483</defs> 484</svg>`,HBe=Tn` <svg fill="none" viewBox="0 0 13 4"> 485 <path fill="currentColor" d="M.5 0h12L8.9 3.13a3.76 3.76 0 0 1-4.8 0L.5 0Z" /> 486</svg>`,GBe=Tn`<svg fill="none" viewBox="0 0 40 40"> 487 <g clip-path="url(#a)"> 488 <g clip-path="url(#b)"> 489 <circle cx="20" cy="19.89" r="20" fill="#5865F2" /> 490 <path 491 fill="#fff" 492 fill-rule="evenodd" 493 d="M25.71 28.15C30.25 28 32 25.02 32 25.02c0-6.61-2.96-11.98-2.96-11.98-2.96-2.22-5.77-2.15-5.77-2.15l-.29.32c3.5 1.07 5.12 2.61 5.12 2.61a16.75 16.75 0 0 0-10.34-1.93l-.35.04a15.43 15.43 0 0 0-5.88 1.9s1.71-1.63 5.4-2.7l-.2-.24s-2.81-.07-5.77 2.15c0 0-2.96 5.37-2.96 11.98 0 0 1.73 2.98 6.27 3.13l1.37-1.7c-2.6-.79-3.6-2.43-3.6-2.43l.58.35.09.06.08.04.02.01.08.05a17.25 17.25 0 0 0 4.52 1.58 14.4 14.4 0 0 0 8.3-.86c.72-.27 1.52-.66 2.37-1.21 0 0-1.03 1.68-3.72 2.44.61.78 1.35 1.67 1.35 1.67Zm-9.55-9.6c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28.01-1.25-.93-2.28-2.1-2.28Zm7.5 0c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28 0-1.25-.93-2.28-2.1-2.28Z" 494 clip-rule="evenodd" 495 /> 496 </g> 497 </g>
498 <defs> 499 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 500 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 501 </defs> 502</svg>`,KBe=Tn`<svg 503 xmlns="http://www.w3.org/2000/svg" 504 fill="none" 505 viewBox="0 0 9 12" 506> 507 <path 508 fill="var(--apkt-tokens-theme-textPrimary)" 509 d="M4.666.001v4.435l3.748 1.675L4.666.001Zm0 0L.917 6.111l3.749-1.675V.001Zm0 8.984V12l3.75-5.19-3.75 2.176Zm0 3.014V8.985L.917 6.81 4.666 12Zm0-3.712 3.748-2.176-3.748-1.675v3.851Z" 510 /> 511 <path fill="var(--apkt-tokens-theme-textPrimary)" d="m.917 6.111 3.749 2.176v-3.85L.917 6.11Z" /> 512</svg>`,YBe=Tn`<svg fill="none" viewBox="0 0 16 16"> 513 <path 514 fill="currentColor" 515 d="M4.25 7a.63.63 0 0 0-.63.63v3.97c0 .28-.2.51-.47.54l-.75.07a.93.93 0 0 1-.9-.47A7.51 7.51 0 0 1 5.54.92a7.5 7.5 0 0 1 9.54 4.62c.12.35.06.72-.16 1-.74.97-1.68 1.78-2.6 2.44V4.44a.64.64 0 0 0-.63-.64h-1.06c-.35 0-.63.3-.63.64v5.5c0 .23-.12.42-.32.5l-.52.23V6.05c0-.36-.3-.64-.64-.64H7.45c-.35 0-.64.3-.64.64v4.97c0 .25-.17.46-.4.52a5.8 5.8 0 0 0-.45.11v-4c0-.36-.3-.65-.64-.65H4.25ZM14.07 12.4A7.49 7.49 0 0 1 3.6 14.08c4.09-.58 9.14-2.5 11.87-6.6v.03a7.56 7.56 0 0 1-1.41 4.91Z" 516 /> 517</svg>`,ZBe=Tn`<svg fill="none" viewBox="0 0 40 40"> 518 <g clip-path="url(#a)"> 519 <g clip-path="url(#b)"> 520 <circle cx="20" cy="19.89" r="20" fill="#1877F2" /> 521 <g clip-path="url(#c)"> 522 <path 523 fill="#fff" 524 d="M26 12.38h-2.89c-.92 0-1.61.38-1.61 1.34v1.66H26l-.36 4.5H2
5241.5v12H17v-12h-3v-4.5h3V12.5c0-3.03 1.6-4.62 5.2-4.62H26v4.5Z" 525 /> 526 </g> 527 </g> 528 <path 529 fill="#1877F2" 530 d="M40 20a20 20 0 1 0-23.13 19.76V25.78H11.8V20h5.07v-4.4c0-5.02 3-7.79 7.56-7.79 2.19 0 4.48.4 4.48.4v4.91h-2.53c-2.48 0-3.25 1.55-3.25 3.13V20h5.54l-.88 5.78h-4.66v13.98A20 20 0 0 0 40 20Z" 531 /> 532 <path 533 fill="#fff" 534 d="m27.79 25.78.88-5.78h-5.55v-3.75c0-1.58.78-3.13 3.26-3.13h2.53V8.2s-2.3-.39-4.48-.39c-4.57 0-7.55 2.77-7.55 7.78V20H11.8v5.78h5.07v13.98a20.15 20.15 0 0 0 6.25 0V25.78h4.67Z" 535 /> 536 </g> 537 <defs> 538 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 539 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 540 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 541 </defs> 542</svg>`,QBe=Tn`<svg style="border-radius: 9999px; overflow: hidden;" fill="none" viewBox="0 0 1000 1000"> 543 <rect width="1000" height="1000" rx="9999" ry="9999" fill="#855DCD"/> 544 <path fill="#855DCD" d="M0 0h1000v1000H0V0Z" /> 545 <path 546 fill="#fff" 547 d="M320 248h354v504h-51.96V521.13h-.5c-5.76-63.8-59.31-113.81-124.54-113.81s-118.78 50-124.53 113.81h-.5V752H320V248Z" 548 /> 549 <path 550 fill="#fff" 551 d="m225 320 21.16 71.46h17.9v289.09a16.29 16.29 0 0 0-16.28 16.24v19.49h-3.25a16.3 16.3 0 0 0-16.28 16.24V752h182.26v-19.48a16.22 16.22 0 0 0-16.28-16.24h-3.25v-19.5a16.22 16.22 0 0 0-16.28-16.23h-19.52V320H225Zm400.3 360.55a16.3 16.3 0 0 0-15.04 10.02 16.2 16.2 0 0 0-1.24 6.22v19.49h-3.25a16.29 16.29 0 0 0-16.27 16.24V752h182.24v-19.48a16.23 16.23 0 0 0-16.27-16.24h-3.25v-19.5a16.2 16.2 0 0 0-10.04-15 16.3 16.3 0 0 0-6.23-1.23v-289.1h17.9L775 320H644.82v360.55H625.3Z" 552 /> 553</svg>`,XBe=Tn`<svg fill="none" viewBox="0 0 40 40"> 554 <g clip-path="url(#a)"> 555 <g clip-path="url(#b)"> 556 <circle cx="20" cy="19.89" r="20" fill="#1B1F23" /> 557 <g clip-path="url(#c)"> 558 <path 559 fill="#fff" 560 d="M8 19.89a12 12 0 1 1 15.8 11.38c-.6.12-.8-.26-.8-.57v-3.3c0-1.12-.4-1.85-.82-2.22 2.67-.3 5.48-1.31 5.48-5.92 0-1.31-.47-2.38-1.24-3.22.13-.3.54-1.52-.12-3.18 0 0-1-.32-3.3 1.23a11.54 11.54 0 0 0-6 0c-2.3-1.55-3.3-1.23-3.3-1.23a4.32 4.32 0 0 0-.12 3.18 4.64 4.64 0 0 0-1.24 3.22c0 4.6 2.8 5.63 5.47 5.93-.34.3-.65.83-.76 1.6-.69.31-2.42.84-3.5-1 0 0-.63-1.15-1.83-1.23 0 0-1.18-.02-.09.73 0 0 .8.37 1.34 1.76 0 0 .7 2.14 4.03 1.41v2.24c0 .31-.2.68-.8.57A12 12 0 0 1 8 19.9Z" 561 /> 562 </g> 563 </g> 564 </g> 565 <defs> 566 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 567 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 568 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 569 </defs> 570</svg>`,JBe=Tn`<svg fill="none" viewBox="0 0 40 40"> 571 <path 572 fill="#4285F4" 573 d="M32.74 20.3c0-.93-.08-1.81-.24-2.66H20.26v5.03h7a6 6 0 0 1-2.62 3.91v3.28h4.22c2.46-2.27 3.88-5.6 3.88-9.56Z" 574 /> 575 <path 576 fill="#34A853" 577 d="M20.26 33a12.4 12.4 0 0 0 8.6-3.14l-4.22-3.28a7.74 7.74 0 0 1-4.38 1.26 7.76 7.76 0 0 1-7.28-5.36H8.65v3.36A12.99 12.99 0 0 0 20.26 33Z" 578 /> 579 <path 580 fill="#FBBC05" 581 d="M12.98 22.47a7.79 7.79 0 0 1 0-4.94v-3.36H8.65a12.84 12.84 0 0 0 0 11.66l3.37-2.63.96-.73Z" 582 /> 583 <path 584 fill="#EA4335" 585 d="M20.26 12.18a7.1 7.1 0 0 1 4.98 1.93l3.72-3.72A12.47 12.47 0 0 0 20.26 7c-5.08 0-9.47 2.92-11.6 7.17l4.32 3.36a7.76 7.76 0 0 1 7.28-5.35Z" 586 /> 587</svg>`,eFe=Tn` <svg width="27" height="30" viewBox="0 0 27 30" fill="none"> 588 <path d="M12.5395 14.3237L0.116699 27.5049V27.5188C0.251527 28.0177 0.49972 28.4788 0.841941 28.866C1.18416 29.2533 1.61117 29.5563 2.0897 29.7515C2.56823 29.9467 3.08536 30.0287 3.60081 29.9913C4.11625 29.9538 4.61609 29.7979 5.06139 29.5356L5.0975 29.512L19.0718 21.4519L12.5395 14.3237Z" fill="#EA4335"/> 589 <path d="M25.103 12.0833L25.0919 12.0722L19.0611 8.57202L12.2607 14.6279L19.0847 21.4504L25.0919 17.9864C25.6229 17.6983 26.0665 17.2725 26.376 16.7537C26.6854 16.2349 26.8493 15.6422 26.8505 15.0381C26.8516 14.434 26.6899 13.8408 26.3824 13.3208C26.0749 12.8008 25.633 12.3734 25.103 12.0833Z" fill="#FBBC04"/> 590 <path d="M0.116672 2.49553C0.047224 2.7761 0 3.05528 0 3.35946V26.6537C0 26.9565 0.0347234 27.237 0.116672 27.5162L12.959 14.6725L0.116672 2.49553Z" fill="#4285F4"/> 591 <path d="M12.634 15.0001L19.0607 8.57198L5.0975 0.477133C4.65115 0.210463 4.14916 0.0506574 3.63079 0.0102139C3.11242 -0.0302296 2.59172 0.0497852 2.10941 0.244001C1.6271 0.438216 1.19625 0.741368 0.850556 1.12975C0.504864 1.51813
5910.253698 1.98121 0.116699 2.48279L12.634 15.0001Z" fill="#34A853"/> 592</svg>`,tFe=Tn`<svg width="75" height="20" viewBox="0 0 75 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 593<path d="M11.6666 5.83334C11.6666 2.61168 14.2783 0 17.5 0H25.8334C29.055 0 31.6666 2.61168 31.6666 5.83334V14.1666C31.6666 17.3883 29.055 20 25.8334 20H17.5C14.2783 20 11.6666 17.3883 11.6666 14.1666V5.83334Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 594<path d="M19.5068 13.7499L22.4309 5.83331H23.2895L20.3654 13.7499H19.5068Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 595<path d="M0 5.41666C0 2.42513 2.42513 0 5.41666 0C8.40821 0 10.8334 2.42513 10.8334 5.41666V14.5833C10.8334 17.5748 8.40821 20 5.41666 20C2.42513 20 0 17.5748 0 14.5833V5.41666Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 596<path d="M4.89581 12.4997V11.458H5.93747V12.4997H4.89581Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 597<path d="M32.5 10C32.5 4.47715 36.6896 0 41.8578 0H65.6422C70.8104 0 75 4.47715 75 10C75 15.5229 70.8104 20 65.6422 20H41.8578C36.6896 20 32.5 15.5229 32.5 10Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 598<path d="M61.7108 12.4475V7.82751H62.5266V8.52418C62.8199 8.01084 63.4157 7.70834 64.0757 7.70834C65.0749 7.70834 65.7715 8.34084 65.7715 9.56918V12.4475H64.9649V9.61503C64.9649 8.80831 64.5066 8.38668 63.8374 8.38668C63.1132 8.38668 62.5266 8.9642 62.5266 9.78001V12.4475H61.7108Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 599<path d="M56.5671 12.4475L55.7147 7.82748H56.4846L57.0896 11.6409L57.8871 9.12916H58.6479L59.4363 11.6134L60.0505 7.82748H60.8204L59.9679 12.4475H59.0513L58.2721 10.0458L57.4838 12.4475H56.5671Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 600<path d="M52.9636 12.5666C51.5611 12.5666 50.7361 11.5217 50.7361 10.1375C50.7361 8.76254 51.5611 7.70834 52.9636 7.70834C54.3661 7.70834 55.1911 8.76254 55.1911 10.1375C55.1911 11.5217 54.3661 12.5666 52.9636 12.5666ZM52.9636 11.8883C53.9719 11.8883 54.357 11.0266 54.357 10.1283C54.357 9.23914 53.9719 8.38668 52.9636 8.38668C51.9552 8.38668 51.5702 9.23914 51.5702 10.1283C51.5702 11.0266 51.9552 11.8883 52.9636 11.8883Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 601<path d="M47.8507 12.5666C46.494 12.5666 45.6415 11.5308 45.6415 10.1375C45.6415 8.75337 46.494 7.70834 47.8507 7.70834C48.9965 7.70834 50.0048 8.35917 49.8948 10.3483H46.4756C46.5398 11.2009 46.934 11.8975 47.8507 11.8975C48.4648 11.8975 48.8681 11.5217 49.0057 11.0908H49.8123C49.684 11.8609 48.9598 12.5666 47.8507 12.5666ZM46.494 9.73416H49.1065C49.0423 8.80831 48.6114 8.37751 47.8507 8.37751C47.0165 8.37751 46.604 8.98254 46.494 9.73416Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 602<path d="M41.7284 12.4475V7.82748H42.5625V8.60665C42.8559 8.09332 43.3601 7.82748 43.8825 7.82748H44.9917V8.60665H43.8184C43.0851 8.60665 42.5625 9.08331 42.5625 10.0092V12.4475H41.7284Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 603</svg> 604 605`,nFe=Tn` 606 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 8"> 607 <path 608 fill="var(--apkt-tokens-theme-textPrimary)" 609 d="m9.524 6.307-1.51 1.584A.35.35 0 0 1 7.76 8H.604a.178.178 0 0 1-.161-.103.168.168 0 0 1 .033-.186l1.51-1.583a.35.35 0 0 1 .256-.11h7.154c.034 0 .068.01.096.029a.168.168 0 0 1 .032.26Zm-1.51-3.189a.35.35 0 0 0-.255-.109H.604a.178.178 0 0 0-.161.103.168.168 0 0 0 .033.186l1.51 1.583a.35.35 0 0 0 .256.11h7.154a.178.178 0 0 0 .16-.104.168.168 0 0 0-.032-.185l-1.51-1.584ZM.605 1.981H7.76a.357.357 0 0 0 .256-.11L9.525.289a.17.17 0 0 0 .032-.185.173.173 0 0 0-.16-.103H2.241a.357.357 0 0 0-.256.109L.476 1.692a.17.17 0 0 0-.033.185.178.178 0 0 0 .16.103Z" 610 /> 611 </svg> 612`,iFe=Tn`<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"> 613 <g clip-path="url(#a)"> 614 <path fill="url(#b)" d="M0 0h32v32H0z"/> 615 <path fill-rule="evenodd" clip-rule="evenodd" d="M7.034 15.252c4.975-2.167 8.293-3.596 9.953-4.287 4.74-1.971 5.725-2.314 6.366-2.325.142-.002.457.033.662.198.172.14.22.33.243.463.022.132.05.435.028.671-.257 2.7-1.368 9.248-1.933 12.27-.24 1.28-.71 1.708-1.167 1.75-.99.091-1.743-.655-2.703-1.284-1.502-.985-2.351-1.598-3.81-2.558-1.684-1.11-.592-1.721.368-2.718.252-.261 4.619-4.233 4.703-4.594.01-.045.02-.213-.08-.301-.1-.09-.246-.059-.353-.035-.15.034-2.55 1.62-7.198 4.758-.682.468-1.298.696-1.851.684-.61-.013-1.782-.344-2.653-.628-1.069-.347-1.918-.53-1.845-1.12.039-.308.462-.623 1.27-.944Z" fill="#fff"/> 616 </g> 617 <path d="M.5 16C.5 7.44 7.44.5 16 .5 24.56.5 31.5 7.44 31.5 16c0 8.56-6.94 15.5-15.5 15.5C7.44 31.5.5 24.56.5 16Z" stroke="#141414" stroke-opacity=".05"/> 618 <defs> 619 <linearGradient id="b" x1="1600" y1="0" x2="1600" y2="3176.27" gradientUnits="userSpaceOnUse"> 620 <stop stop-color="#2AABEE"/> 621 <stop offset="1" stop-color="#229ED9"/> 622 </linearGradient> 623 <clipPath id="a"> 624 <path d="M0 16C0 7.163 7.163 0 16 0s16 7.163 16 16-7.163 16-16 16S0 24.837 0 16Z" fill="#fff"/> 625 </clipPath> 626 </defs> 627</svg>`,rre=Tn` 628 <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewB
628ox="0 0 10 10"> 629 <path d="M8.37651 0H1.62309C0.381381 0 -0.405611 1.33944 0.219059 2.42225L4.38701 9.64649C4.659 10.1182 5.3406 10.1182 5.61259 9.64649L9.78139 2.42225C10.4052 1.34117 9.61822 0 8.37736 0H8.37651ZM4.38362 7.48005L3.47591 5.72329L1.2857 1.80606C1.14121 1.55534 1.31968 1.23405 1.62225 1.23405H4.38278V7.4809L4.38362 7.48005ZM8.71221 1.80521L6.52284 5.72414L5.61513 7.48005V1.2332H8.37566C8.67823 1.2332 8.85669 1.55449 8.71221 1.80521Z" fill="var(--apkt-tokens-theme-textPrimary)" /> 630</svg> 631`,sFe=Tn`<svg fill="none" viewBox="0 0 40 40"> 632 <g clip-path="url(#a)"> 633 <g clip-path="url(#b)"> 634 <circle cx="20" cy="19.89" r="20" fill="#5A3E85" /> 635 <g clip-path="url(#c)"> 636 <path 637 fill="#fff" 638 d="M18.22 25.7 20 23.91h3.34l2.1-2.1v-6.68H15.4v8.78h2.82v1.77Zm3.87-8.16h1.25v3.66H22.1v-3.66Zm-3.34 0H20v3.66h-1.25v-3.66ZM20 7.9a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.69 14.56-3.66 3.66h-2.72l-1.77 1.78h-1.88V26.1H13.3v-9.82l.94-2.4H26.7v8.56Z" 639 /> 640 </g> 641 </g> 642 </g> 643 <defs> 644 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 645 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 646 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 647 </defs> 648</svg>`,rFe=Tn`<svg fill="none" viewBox="0 0 16 16"> 649 <path 650 fill="currentColor" 651 d="m14.36 4.74.01.42c0 4.34-3.3 9.34-9.34 9.34A9.3 9.3 0 0 1 0 13.03a6.6 6.6 0 0 0 4.86-1.36 3.29 3.29 0 0 1-3.07-2.28c.5.1 1 .07 1.48-.06A3.28 3.28 0 0 1 .64 6.11v-.04c.46.26.97.4 1.49.41A3.29 3.29 0 0 1 1.11 2.1a9.32 9.32 0 0 0 6.77 3.43 3.28 3.28 0 0 1 5.6-3 6.59 6.59 0 0 0 2.08-.8 3.3 3.3 0 0 1-1.45 1.82A6.53 6.53 0 0 0 16 3.04c-.44.66-1 1.23-1.64 1.7Z" 652 /> 653</svg>`,oFe=Tn` 654<svg xmlns="http://www.w3.org/2000/svg" width="89" height="89" viewBox="0 0 89 89" fill="none"> 655<path d="M60.0468 39.2502L65.9116 33.3854C52.6562 20.13 36.1858 20.13 22.9304 33.3854L28.7952 39.2502C38.8764 29.169 49.9725 29.169 60.0536 39.2502H60.0468Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 656<path d="M58.0927 52.9146L44.415 39.2369L30.7373 52.9146L17.0596 39.2369L11.2017 45.0949L30.7373 64.6374L44.415 50.9597L58.0927 64.6374L77.6284 45.0949L71.7704 39.2369L58.0927 52.9146Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 657</svg>`,aFe=Tn` 658<svg xmlns="http://www.w3.org/2000/svg" width="89" height="89" viewBox="0 0 89 89" fill="none"> 659<path d="M60.0468 39.2502L65.9116 33.3854C52.6562 20.13 36.1858 20.13 22.9304 33.3854L28.7952 39.2502C38.8764 29.169 49.9725 29.169 60.0536 39.2502H60.0468Z" fill="var(--apkt-tokens-theme-textInvert)"/> 660<path d="M58.0927 52.9146L44.415 39.2369L30.7373 52.9146L17.0596 39.2369L11.2017 45.0949L30.7373 64.6374L44.415 50.9597L58.0927 64.6374L77.6284 45.0949L71.7704 39.2369L58.0927 52.9146Z" fill="var(--apkt-tokens-theme-textInvert)"/> 661</svg>`,cFe=Tn` 662<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> 663<g clip-path="url(#clip0_22274_4692)"> 664<path d="M0 6.64C0 4.17295 0 2.93942 0.525474 2.01817C0.880399 1.39592 1.39592 0.880399 2.01817 0.525474C2.93942 0 4.17295 0 6.64 0H9.36C11.8271 0 13.0606 0 13.9818 0.525474C14.6041 0.880399 15.1196 1.39592 15.4745 2.01817C16 2.93942 16 4.17295 16 6.64V9.36C16 11.8271 16 13.0606 15.4745 13.9818C15.1196 14.6041 14.6041 15.1196 13.9818 15.4745C13.0606 16 11.8271 16 9.36 16H6.64C4.17295 16 2.93942 16 2.01817 15.4745C1.39592 15.1196 0.880399 14.6041 0.525474 13.9818C0 13.0606 0 11.8271 0 9.36V6.64Z" fill="#C7B994"/> 665<path d="M4.49038 5.76609C6.42869 3.86833 9.5713 3.86833 11.5096 5.76609L11.7429 5.99449C11.8398 6.08938 11.8398 6.24323 11.7429 6.33811L10.9449 7.11942C10.8964 7.16686 10.8179 7.16686 10.7694 7.11942L10.4484 6.80512C9.09617 5.48119 6.90381 5.48119 5.5516 6.80512L5.20782 7.14171C5.15936 7.18915 5.08079 7.18915 5.03234 7.14171L4.23434 6.3604C4.13742 6.26552 4.13742 6.11167 4.23434 6.01678L4.49038 5.76609ZM13.1599 7.38192L13.8702 8.07729C13.9671 8.17217 13.9671 8.32602 13.8702 8.4209L10.6677 11.5564C10.5708 11.6513 10.4137 11.6513 10.3168 11.5564L8.04388 9.33105C8.01965 9.30733 7.98037 9.30733 7.95614 9.33105L5.6833 11.5564C5.58638 11.6513 5.42925 11.6513 5.33234 11.5564L2.12982 8.42087C2.0329 8.32598 2.0329 8.17213 2.12982 8.07724L2.84004 7.38188C2.93695 7.28699 3.09408 7.28699 3.191 7.38188L5.46392 9.60726C5.48815 9.63098 5.52743 9.63098 5.55166 9.60726L7.82447 7.38188C7.92138 7.28699 8.07851 7.28699 8.17543 7.38187L10.4484 9.60726C10.4726 9.63098 10.5119 9.63098 10.5361 9.60726L12.809 7.38192C12.9059 7.28703 13.063 7.28703 13.1599 7.38192Z" fill="currentColor"/> 666</g> 667<defs> 668<clipPath id="clip0_22274_4692"> 669<path d="M0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8Z" fill="white"/> 670</clipPath> 671</defs> 672</svg> 673`,lFe=Tn` 674<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 675<circle cx="11" cy="11" r="11" transform="matrix(-1 0 0 1 23 1)" fill="#202020"/> 676<circle cx="11" cy="11" r="11.5" transform="matrix(-1 0 0 1 23 1)" stroke="#C7B994" stroke-opacity="0.7"/> 677<path d="M15.4523 11.0686L16.7472 9.78167C13.8205 6.87297 10.1838 6.87297 7.25708 9.78167L8.55201 11.0686C10.7779 8.85645 13.2279 8.85645 15.4538 11.0686H15.4523Z" fill="#C7B994"/> 678<path d="M15.0199 14.067L12 11.0656L8.98 14.067L5.96004 11.0656L4.66663 12.3511L8.98 16.6393L12 13.638L15.0199 16.6393L19.3333 12.3511L18.0399 11.0656L15.0199 14.067Z" fill="#C7B994"/> 679</svg> 680`,NH=Tn`<svg fill="none" viewBox="0 0 41 40"> 681 <g clip-path="url(#a)"> 682 <path fill="#000" d="M.8 0h40v40H.8z" /> 683 <path 684 fill="#fff" 685 d="m22.63 18.46 7.14-8.3h-1.69l-6.2 7.2-4.96-7.2H11.2l7.5 10.9-7.5 8.71h1.7l6.55-7.61 5.23 7.61h5.72l-7.77-11.31Zm-9.13-7.03h2.6l11.98 17.13h-2.6L13.5 11.43Z" 686 /> 687 </g>
688 <defs> 689 <clipPath id="a"><path fill="#fff" d="M.8 20a20 20 0 1 1 40 0 20 20 0 0 1-40 0Z" /></clipPath> 690 </defs> 691</svg>`,uFe=os` 692 :host { 693 display: flex; 694 justify-content: center; 695 align-items: center; 696 aspect-ratio: 1 / 1; 697 color: var(--local-color); 698 width: var(--local-width); 699 } 700 701 svg { 702 height: inherit; 703 width: inherit; 704 object-fit: contain; 705 object-position: center; 706 } 707`;var q6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const dFe={add:"ph-plus",allWallets:"ph-dots-three",arrowBottom:"ph-arrow-down",arrowBottomCircle:"ph-arrow-circle-down",arrowClockWise:"ph-arrow-clockwise",arrowLeft:"ph-arrow-left",arrowRight:"ph-arrow-right",arrowTop:"ph-arrow-up",arrowTopRight:"ph-arrow-up-right",bank:"ph-bank",bin:"ph-trash",browser:"ph-browser",card:"ph-credit-card",checkmark:"ph-check",checkmarkBold:"ph-check",chevronBottom:"ph-caret-down",chevronLeft:"ph-caret-left",chevronRight:"ph-caret-right",chevronTop:"ph-caret-up",clock:"ph-clock",close:"ph-x",coinPlaceholder:"ph-circle-half",compass:"ph-compass",copy:"ph-copy",desktop:"ph-desktop",dollar:"ph-currency-dollar",download:"ph-vault",exclamationCircle:"ph-warning-circle",extension:"ph-puzzle-piece",externalLink:"ph-arrow-square-out",filters:"ph-funnel-simple",helpCircle:"ph-question",id:"ph-identification-card",image:"ph-image",info:"ph-info",lightbulb:"ph-lightbulb",mail:"ph-envelope",mobile:"ph-device-mobile",more:"ph-dots-three",networkPlaceholder:"ph-globe",nftPlaceholder:"ph-image",plus:"ph-plus",power:"ph-power",qrCode:"ph-qr-code",questionMark:"ph-question",refresh:"ph-arrow-clockwise",recycleHorizontal:"ph-arrows-clockwise",search:"ph-magnifying-glass",sealCheck:"ph-seal-check",send:"ph-paper-plane-right",signOut:"ph-sign-out",spinner:"ph-spinner",swapHorizontal:"ph-arrows-left-right",swapVertical:"ph-arrows-down-up",threeDots:"ph-dots-three",user:"ph-user",verify:"ph-seal-check",verifyFilled:"ph-seal-check",wallet:"ph-wallet",warning:"ph-warning",warningCircle:"ph-warning-circle",appStore:"",apple:"",bitcoin:"",chromeStore:"",cursor:"",discord:"",ethereum:"",etherscan:"",facebook:"",farcaster:"",github:"",google:"",playStore:"",reown:"",solana:"",ton:"",telegram:"",twitch:"",twitterIcon:"",twitter:"",walletConnect:"",walletConnectBrown:"",walletConnectLightBrown:"",x:""},hFe={"ph-arrow-circle-down":()=>Lt(()=>import("./PhArrowCircleDown-B305t-Sh.js"),__vite__mapDeps([13,14])),"ph-arrow-clockwise":()=>Lt(()=>import("./PhArrowClockwise-CJPxQhr_.js"),__vite__mapDeps([15,14])),"ph-arrow-down":()=>Lt(()=>import("./PhArrowDown-C4hT9BVu.js"),__vite__mapDeps([16,14])),"ph-arrow-left":()=>Lt(()=>import("./PhArrowLeft-Way4Cu-r.js"),__vite__mapDeps([17,14])),"ph-arrow-right":()=>Lt(()=>import("./PhArrowRight-Cp5ZME0F.js"),__vite__mapDeps([18,14])),"ph-arrow-square-out":()=>Lt(()=>import("./PhArrowSquareOut-NnrK69c5.js"),__vite__mapDeps([19,14])),"ph-arrows-down-up":()=>Lt(()=>import("./PhArrowsDownUp-BjBI4ckC.js"),__vite__mapDeps([20,14])),"ph-arrows-left-right":()=>Lt(()=>import("./PhArrowsLeftRight-CuLpbKRk.js"),__vite__mapDeps([21,14])),"ph-arrow-up":()=>Lt(()=>import("./PhArrowUp-Dph6j8rm.js"),__vite__mapDeps([22,14])),"ph-arrow-up-right":()=>Lt(()=>import("./PhArrowUpRight-BpJjRRRh.js"),__vite__mapDeps([23,14])),"ph-arrows-clockwise":()=>Lt(()=>import("./PhArrowsClockwise-CFUT8X7R.js"),__vite__mapDeps([24,14])),"ph-bank":()=>Lt(()=>import("./PhBank-Dchr4XQJ.js"),__vite__mapDeps([25,14])),"ph-browser":()=>Lt(()=>import("./PhBrowser-dUu2TrC1.js"),__vite__mapDeps([26,14])),"ph-caret-down":()=>Lt(()=>import("./PhCaretDown-78IuKU3V.js"),__vite__mapDeps([27,14])),"ph-caret-left":()=>Lt(()=>import("./PhCaretLeft-_aiyH7n1.js"),__vite__mapDeps([28,14])),"ph-caret-right":()=>Lt(()=>import("./PhCaretRight-8zJQEuDX.js"),__vite__mapDeps([29,14])),"ph-caret-up":()=>Lt(()=>import("./PhCaretUp-CiCxKWwN.js"),__vite__mapDeps([30,14])),"ph-check":()=>Lt(()=>import("./PhCheck-CcADx8br.js"),__vite__mapDeps([31,14])),"ph-circle-half":()=>Lt(()=>import("./PhCircleHalf-BYzSzd2h.js"),__vite__mapDeps([32,14])),"ph-clock":()=>Lt(()=>import("./PhClock-UItiXeJq.js"),__vite__mapDeps([33,14])),"ph-compass":()=>Lt(()=>import("./PhCompass-CUy3uA7t.js"),__vite__mapDeps([34,14])),"ph-copy":()=>Lt(()=>import("./PhCopy-C-PDgSlZ.js"),__vite__mapDeps([35,14])),"ph-credit-card":()=>Lt(()=>import("./PhCreditCard-CWRaUT6F.js"),__vite__mapDeps([36,14])),"ph-currency-dollar":()=>Lt(()=>import("./PhCurrencyDollar-Cqla3AXT.js"),__vite__mapDeps([37,14])),"ph-desktop":()=>Lt(()=>import("./PhDesktop-BBIPrYLl.js"),__vite__mapDeps([38,14])),"ph-device-mobile":()=>Lt(()=>import("./PhDeviceMobile-BdsPaATg.js"),__vite__mapDeps([39,14])),"ph-dots-three":()=>Lt(()=>import("./PhDotsThree-BMXCQl-0.js"),__vite__mapDeps([40,14])),"ph-vault":()=>Lt(()=>import("./PhVault-l2PHF38a.js"),__vite__mapDeps([41,14])),"ph-envelope":()=>Lt(()=>import("./PhEnvelope-yUsis6yU.js"),__vite__mapDeps([42,14])),"ph-funnel-simple":()=>Lt(()=>import("./PhFunnelSimple-Ba7BbWTp.js"),__vite__mapDeps([43,14])),"ph-globe":()=>Lt(()=>import("./PhGlobe-DgLxBk5U.js"),__vite__mapDeps([44,14])),"ph-identification-card":()=>Lt(()=>import("./PhIdentificationCard-Czjmq9Z3.js"),__vite__mapDeps([45,14])),"ph-image":()=>Lt(()=>import("./PhImage-BAJ_erz6.js"),__vite__mapDeps([46,14])),"ph-info":()=>Lt(()=>
707import("./PhInfo-Cr4DhVUE.js"),__vite__mapDeps([47,14])),"ph-lightbulb":()=>Lt(()=>import("./PhLightbulb-BX_7duTr.js"),__vite__mapDeps([48,14])),"ph-magnifying-glass":()=>Lt(()=>import("./PhMagnifyingGlass-Mygfryvz.js"),__vite__mapDeps([49,14])),"ph-paper-plane-right":()=>Lt(()=>import("./PhPaperPlaneRight-BeuCA660.js"),__vite__mapDeps([50,14])),"ph-plus":()=>Lt(()=>import("./PhPlus-BMjcHjsT.js"),__vite__mapDeps([51,14])),"ph-power":()=>Lt(()=>import("./PhPower-CGffGmdb.js"),__vite__mapDeps([52,14])),"ph-puzzle-piece":()=>Lt(()=>import("./PhPuzzlePiece-wm_GpVSi.js"),__vite__mapDeps([53,14])),"ph-qr-code":()=>Lt(()=>import("./PhQrCode-DRwRzXCH.js"),__vite__mapDeps([54,14])),"ph-question":()=>Lt(()=>import("./PhQuestion-M09j2U0T.js"),__vite__mapDeps([55,14])),"ph-question-circle":()=>Lt(()=>import("./PhQuestionMark-BP9EMB6h.js"),__vite__mapDeps([56,14])),"ph-seal-check":()=>Lt(()=>import("./PhSealCheck-BfG80yKn.js"),__vite__mapDeps([57,14])),"ph-sign-out":()=>Lt(()=>import("./PhSignOut-C5YOWlPT.js"),__vite__mapDeps([58,14])),"ph-spinner":()=>Lt(()=>import("./PhSpinner-BXooDYzU.js"),__vite__mapDeps([59,14])),"ph-trash":()=>Lt(()=>import("./PhTrash-Biq6rmmL.js"),__vite__mapDeps([60,14])),"ph-user":()=>Lt(()=>import("./PhUser-CAgZSpGe.js"),__vite__mapDeps([61,14])),"ph-wallet":()=>Lt(()=>import("./PhWallet-w25D16It.js"),__vite__mapDeps([62,14])),"ph-warning":()=>Lt(()=>import("./PhWarning-DPEydIPw.js"),__vite__mapDeps([63,14])),"ph-warning-circle":()=>Lt(()=>import("./PhWarningCircle-BqjT745H.js"),__vite__mapDeps([64,14])),"ph-x":()=>Lt(()=>import("./PhX-s-SmVExa.js"),__vite__mapDeps([65,14]))},fFe={appStore:VBe,apple:WBe,bitcoin:qBe,chromeStore:zBe,cursor:HBe,discord:GBe,ethereum:KBe,etherscan:YBe,facebook:ZBe,farcaster:QBe,github:XBe,google:JBe,playStore:eFe,reown:tFe,solana:nFe,ton:rre,telegram:iFe,twitch:sFe,twitter:NH,twitterIcon:rFe,walletConnect:oFe,walletConnectInvert:aFe,walletConnectBrown:lFe,walletConnectLightBrown:cFe,x:NH},pFe={"accent-primary":Gs.tokens.core.iconAccentPrimary,"accent-certified":Gs.tokens.core.iconAccentCertified,default:Gs.tokens.theme.iconDefault,success:Gs.tokens.core.iconSuccess,error:Gs.tokens.core.iconError,warning:Gs.tokens.core.iconWarning,inverse:Gs.tokens.theme.iconInverse};let Ug=class extends tt{constructor(){super(...arguments),this.size="md",this.name="copy",this.weight="bold",this.color="inherit"}render(){const e={xxs:"2",xs:"3",sm:"3",md:"4",mdl:"5",lg:"5",xl:"6",xxl:"7",inherit:"inherit"};this.style.cssText=` 708 --local-width: ${this.size==="inherit"?"inherit":`var(--apkt-spacing-${e[this.size]})`}; 709 --local-color: ${this.color==="inherit"?"inherit":pFe[this.color]} 710 `;const n=dFe[this.name];if(n&&n!==""){const i=hFe[n];i&&i();const s=FBe(n);return kH`<${s} size=${{xxs:"0.5em",xs:"0.75em",sm:"0.75em",md:"1em",mdl:"1.25em",lg:"1.25em",xl:"1.5em",xxl:"1.75em"}[this.size]} weight="${this.weight}"></${s}>`}return fFe[this.name]||kH``}};Ug.styles=[vn,uFe];q6([le()],Ug.prototype,"size",void 0);q6([le()],Ug.prototype,"name",void 0);q6([le()],Ug.prototype,"weight",void 0);q6([le()],Ug.prototype,"color",void 0);Ug=q6([Qe("wui-icon")],Ug);const mFe=It` 711 :host { 712 display: block; 713 width: var(--local-width); 714 height: var(--local-height); 715 } 716 717 img { 718 display: block; 719 width: 100%; 720 height: 100%; 721 object-fit: cover; 722 object-position: center center; 723 border-radius: inherit; 724 user-select: none; 725 user-drag: none; 726 -webkit-user-drag: none; 727 -khtml-user-drag: none; 728 -moz-user-drag: none; 729 -o-user-drag: none; 730 } 731 732 :host([data-boxed='true']) { 733 width: 40px; 734 height: 40px; 735 display: flex; 736 align-items: center; 737 justify-content: center; 738 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 739 border-radius: ${({borderRadius:t})=>t[2]}; 740 } 741 742 :host([data-boxed='true']) img { 743 width: 20px; 744 height: 20px; 745 border-radius: ${({borderRadius:t})=>t[16]}; 746 } 747 748 :host([data-full='true']) img { 749 width: 100%; 750 height: 100%; 751 } 752 753 :host([data-boxed='true']) wui-icon { 754 width: 20px; 755 height: 20px; 756 } 757 758 :host([data-icon='error']) { 759 background-color: ${({tokens:t})=>t.core.backgroundError}; 760 } 761 762 :host([data-rounded='true']) { 763 border-radius: ${({borderRadius:t})=>t[16]}; 764 } 765`;var zd=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
765a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Il=class extends tt{constructor(){super(...arguments),this.src="./path/to/image.jpg",this.alt="Image",this.size=void 0,this.boxed=!1,this.rounded=!1,this.fullSize=!1}render(){const e={inherit:"inherit",xxs:"2",xs:"3",sm:"4",md:"4",mdl:"5",lg:"5",xl:"6",xxl:"7","3xl":"8","4xl":"9","5xl":"10"};return this.style.cssText=` 766 --local-width: ${this.size?`var(--apkt-spacing-${e[this.size]});`:"100%"}; 767 --local-height: ${this.size?`var(--apkt-spacing-${e[this.size]});`:"100%"}; 768 `,this.dataset.boxed=this.boxed?"true":"false",this.dataset.rounded=this.rounded?"true":"false",this.dataset.full=this.fullSize?"true":"false",this.dataset.icon=this.iconColor||"inherit",this.icon?se`<wui-icon 769 color=${this.iconColor||"inherit"} 770 name=${this.icon} 771 size="lg" 772 ></wui-icon> `:this.logo?se`<wui-icon size="lg" color="inherit" name=${this.logo}></wui-icon> `:se`<img src=${xt(this.src)} alt=${this.alt} @error=${this.handleImageError} />`}handleImageError(){this.dispatchEvent(new CustomEvent("onLoadError",{bubbles:!0,composed:!0}))}};Il.styles=[vn,mFe];zd([le()],Il.prototype,"src",void 0);zd([le()],Il.prototype,"logo",void 0);zd([le()],Il.prototype,"icon",void 0);zd([le()],Il.prototype,"iconColor",void 0);zd([le()],Il.prototype,"alt",void 0);zd([le()],Il.prototype,"size",void 0);zd([le({type:Boolean})],Il.prototype,"boxed",void 0);zd([le({type:Boolean})],Il.prototype,"rounded",void 0);zd([le({type:Boolean})],Il.prototype,"fullSize",void 0);Il=zd([Qe("wui-image")],Il);const gFe=os` 773 :host { 774 display: flex; 775 } 776 777 :host([data-size='sm']) > svg { 778 width: 12px; 779 height: 12px; 780 } 781 782 :host([data-size='md']) > svg { 783 width: 16px; 784 height: 16px; 785 } 786 787 :host([data-size='lg']) > svg { 788 width: 24px; 789 height: 24px; 790 } 791 792 :host([data-size='xl']) > svg { 793 width: 32px; 794 height: 32px; 795 } 796 797 svg { 798 animation: rotate 1.4s linear infinite; 799 color: var(--local-color); 800 } 801 802 :host([data-size='md']) > svg > circle { 803 stroke-width: 6px; 804 } 805 806 :host([data-size='sm']) > svg > circle { 807 stroke-width: 8px; 808 } 809 810 @keyframes rotate { 811 100% { 812 transform: rotate(360deg); 813 } 814 } 815`;var DM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let P5=class extends tt{constructor(){super(...arguments),this.color="primary",this.size="lg"}render(){const e={primary:Gs.tokens.theme.textPrimary,secondary:Gs.tokens.theme.textSecondary,tertiary:Gs.tokens.theme.textTertiary,invert:Gs.tokens.theme.textInvert,error:Gs.tokens.core.textError,warning:Gs.tokens.core.textWarning,"accent-primary":Gs.tokens.core.textAccentPrimary};return this.style.cssText=` 816 --local-color: ${this.color==="inherit"?"inherit":e[this.color]}; 817 `,this.dataset.size=this.size,se`<svg viewBox="0 0 16 17" fill="none"> 818 <path 819 d="M8.75 2.65625V4.65625C8.75 4.85516 8.67098 5.04593 8.53033 5.18658C8.38968 5.32723 8.19891 5.40625 8 5.40625C7.80109 5.40625 7.61032 5.32723 7.46967 5.18658C7.32902 5.04593 7.25 4.85516 7.25 4.65625V2.65625C7.25 2.45734 7.32902 2.26657 7.46967 2.12592C7.61032 1.98527 7.80109 1.90625 8 1.90625C8.19891 1.90625 8.38968 1.98527 8.53033 2.12592C8.67098 2.26657 8.75 2.45734 8.75 2.65625ZM14 7.90625H12C11.8011 7.90625 11.6103 7.98527 11.4697 8.12592C11.329 8.26657 11.25 8.45734 11.25 8.65625C11.25 8.85516 11.329 9.04593 11.4697 9.18658C11.6103 9.32723 11.8011 9.40625 12 9.40625H14C14.1989 9.40625 14.3897 9.32723 14.5303 9.18658C14.671 9.04593 14.75 8.85516 14.75 8.65625C14.75 8.45734 14.671 8.26657 14.5303 8.12592C14.3897 7.98527 14.1989 7.90625 14 7.90625ZM11.3588 10.9544C11.289 10.8846 11.2062 10.8293 11.115 10.7915C11.0239 10.7538 10.9262 10.7343 10.8275 10.7343C10.7288 10.7343 10.6311 10.7538 10.54 10.7915C10.4488 10.8293 10.366 10.8846 10.2963 10.9544C10.2265 11.0241 10.1711 11.107 10.1334 11.1981C10.0956 11.2893 10.0762 11.387 10.0762 11.4856C10.0762 11.5843 10.0956 11.682 10.1334 11.7731C10.1711 11.8643 10.2265 11.9471 10.2963 12.0169L11.7106 13.4312C11.8515 13.5721 12.0426 13.6513 12.2419 13.6513C12.4411 13.6513 12.6322 13.5721 12.7731 13.4312C12.914 13.2904 12.9932 13.0993 12.9932 12.9C12.9932 12.7007 12.914 12.5096 12.7731 12.3687L11.3588 10.9544ZM8 11.9062C7.80109 11.9062 7.61032 11.9853 7.46967 12.1259C7.32902 12.2666 7.25 12.4573 7.25 12.6562V14.6562C7.25 14.8552 7.32902 15.0459 7.46967 15.1866C7.61032 15.3272 7.80109 15.4062 8 15.4062C8.19891 15.4062 8.38968 15.3272 8.53033 15.1866C8.67098 15.0459 8.75 14.8552 8.75 14.6562V12.6562C8.75 12.4573 8.67098 12.2666 8.53033 12.1259C8.38968 11.9853 8.19891 11.9062 8 11.9062ZM4.64125 10.9544L3.22688 12.3687C3.08598 12.5096 3.00682 12.7007 3.00682 12.9C3.00682 13.0993 3.08598 13.2904 3.22688 13.4312C3.36777 13.5721 3.55887 13.6513 3.75813 13.6513C3.95738 13.6513 4.14848 13.5721 4.28937 13.4312L5.70375 12.0169C5.84465 11.876 5.9238 11.6849 5.9238 11.4856C5.9238 11.2864 5.84465 11.0953 5.70375 10.9544C5.56285 10.8135 5.37176 10.7343 5.1725 10.7343C4.97324 10.7343 4.78215 10.8135 4.64125 10.9544ZM4.75 8.65625C4.75 8.45734 4.67098 8.26657 4.53033 8.12592C4.38968 7.98527 4.19891 7.90625 4 7.90625H2C1.80109 7.90625 1.61032 7.98527 1.46967 8.12592C1.32902 8.26657 1.25 8.45734 1.25 8.65625C1.25 8.85516 1.32902 9.04593 1.46967 9.18658C1.61032 9.32723 1.80109 9.40625 2 9.40625H4C4.19891 9.40625 4.38968 9.32723 4.53033 9.18658C4.67098 9.04593 4.75 8.85516 4.75 8.65625ZM4.2875 3.88313C4.1466 3.74223 3.95551 3.66307 3.75625 3.66307C3.55699 3.66307 3.3659 3.74223 3.225 3.88313C3.0841 4.02402 3.00495 4.21512 3.00495 4.41438C3.00495 4.61363 3.0841 4.80473 3.225 4.94562L4.64125 6.35813C4.78215 6.49902 4.97324 6.57818 5.1725 6.57818C5.37176 6.57818 5.56285 6.49902 5.70375 6.35813C5.84465 6.21723 5.9238 6.02613 5.9238 5.82688C5.9238 5.62762 5.84465 5.43652 5.70375 5.29563L4.2875 3.88313Z" 820 fill="currentColor" 821 /> 822 </svg>`}};P5.styles=[vn,gFe];DM([le()],P5.prototype,"color",void 0);DM([le()],P5.prototype,"size",void 0);P5=DM([Qe("wui-loading-spinner")],P5);/** 823 * @license 824 * Copyright 2017 Google LLC 825 * SPDX-License-Identifier: BSD-3-Clause 826 */const ore={ATTRIBUTE:1,CHILD:2},are=t=>(...e)=>({_$litDirective$:t,values:e});class cre{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,n,i){this._$Ct=e,this._$AM=n,this._$Ci=i}_$AS(e,n){return this.update(e,n)}update(e,n){return this.render(...n)}}/** 827 * @license 828 * Copyright 2018 Google LLC 829 * SPDX-License-Identifier: BSD-3-Clause 830 */const OM=are(class extends cre{constructor(t){var e;if(super(t),t.type!==ore.ATTRIBUTE||t.name!=="class"||((e=t.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){var i,s;
830if(this.st===void 0){this.st=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((r=>r!==""))));for(const r in e)e[r]&&!((i=this.nt)!=null&&i.has(r))&&this.st.add(r);return this.render(e)}const n=t.element.classList;for(const r of this.st)r in e||(n.remove(r),this.st.delete(r));for(const r in e){const o=!!e[r];o===this.st.has(r)||(s=this.nt)!=null&&s.has(r)||(o?(n.add(r),this.st.add(r)):(n.remove(r),this.st.delete(r)))}return $g}}),yFe=It` 831 slot { 832 width: 100%; 833 display: inline-block; 834 font-style: normal; 835 overflow: inherit; 836 text-overflow: inherit; 837 text-align: var(--local-align); 838 color: var(--local-color); 839 } 840 841 .wui-line-clamp-1 { 842 overflow: hidden; 843 display: -webkit-box; 844 -webkit-box-orient: vertical; 845 -webkit-line-clamp: 1; 846 } 847 848 .wui-line-clamp-2 { 849 overflow: hidden; 850 display: -webkit-box; 851 -webkit-box-orient: vertical; 852 -webkit-line-clamp: 2; 853 } 854 855 /* -- Headings --------------------------------------------------- */ 856 .wui-font-h1-regular-mono { 857 font-size: ${({textSize:t})=>t.h1}; 858 line-height: ${({typography:t})=>t["h1-regular-mono"].lineHeight}; 859 letter-spacing: ${({typography:t})=>t["h1-regular-mono"].letterSpacing}; 860 font-weight: ${({fontWeight:t})=>t.regular}; 861 font-family: ${({fontFamily:t})=>t.mono}; 862 } 863 864 .wui-font-h1-regular { 865 font-size: ${({textSize:t})=>t.h1}; 866 line-height: ${({typography:t})=>t["h1-regular"].lineHeight}; 867 letter-spacing: ${({typography:t})=>t["h1-regular"].letterSpacing}; 868 font-weight: ${({fontWeight:t})=>t.regular}; 869 font-family: ${({fontFamily:t})=>t.regular}; 870 font-feature-settings: 871 'liga' off, 872 'clig' off; 873 } 874 875 .wui-font-h1-medium { 876 font-size: ${({textSize:t})=>t.h1}; 877 line-height: ${({typography:t})=>t["h1-medium"].lineHeight}; 878 letter-spacing: ${({typography:t})=>t["h1-medium"].letterSpacing}; 879 font-weight: ${({fontWeight:t})=>t.medium}; 880 font-family: ${({fontFamily:t})=>t.regular}; 881 font-feature-settings: 882 'liga' off, 883 'clig' off; 884 } 885 886 .wui-font-h2-regular-mono { 887 font-size: ${({textSize:t})=>t.h2}; 888 line-height: ${({typography:t})=>t["h2-regular-mono"].lineHeight}; 889 letter-spacing: ${({typography:t})=>t["h2-regular-mono"].letterSpacing}; 890 font-weight: ${({fontWeight:t})=>t.regular}; 891 font-family: ${({fontFamily:t})=>t.mono}; 892 } 893 894 .wui-font-h2-regular { 895 font-size: ${({textSize:t})=>t.h2}; 896 line-height: ${({typography:t})=>t["h2-regular"].lineHeight}; 897 letter-spacing: ${({typography:t})=>t["h2-regular"].letterSpacing}; 898 font-weight: ${({fontWeight:t})=>t.regular}; 899 font-family: ${({fontFamily:t})=>t.regular}; 900 font-feature-settings: 901 'liga' off, 902 'clig' off; 903 } 904 905 .wui-font-h2-medium { 906 font-size: ${({textSize:t})=>t.h2}; 907 line-height: ${({typography:t})=>t["h2-medium"].lineHeight}; 908 letter-spacing: ${({typography:t})=>t["h2-medium"].letterSpacing}; 909 font-weight: ${({fontWeight:t})=>t.medium}; 910 font-family: ${({fontFamily:t})=>t.regular}; 911 font-feature-settings: 912 'liga' off, 913 'clig' off; 914 } 915 916 .wui-font-h3-regular-mono { 917 font-size: ${({textSize:t})=>t.h3}; 918 line-height: ${({typography:t})=>t["h3-regular-mono"].lineHeight}; 919 letter-spacing: ${({typography:t})=>t["h3-regular-mono"].letterSpacing}; 920 font-weight: ${({fontWeight:t})=>t.regular}; 921 font-family: ${({fontFamily:t})=>t.mono}; 922 } 923 924 .wui-font-h3-regular { 925 font-size: ${({textSize:t})=>t.h3}; 926 line-height: ${({typography:t})=>t["h3-regular"].lineHeight}; 927 letter-spacing: ${({typography:t})=>t["h3-regular"].letterSpacing}; 928 font-weight: ${({fontWeight:t})=>t.regular}; 929 font-family: ${({fontFamily:t})=>t.regular}; 930 font-feature-settings: 931 'liga' off, 932 'clig' off; 933 } 934 935 .wui-font-h3-medium { 936 font-size: ${({textSize:t})=>t.h3}; 937 line-height: ${({typography:t})=>t["h3-medium"].lineHeight}; 938 letter-spacing: ${({typography:t})=>t["h3-medium"].letterSpacing}; 939 font-weight: ${({fontWeight:t})=>t.medium}; 940 font-family: ${({fontFamily:t})=>t.regular}; 941 font-feature-settings: 942 'liga' off, 943 'clig' off; 944 } 945 946 .wui-font-h4-regular-mono { 947 font-size: ${({textSize:t})=>t.h4}; 948 line-height: ${({typography:t})=>t["h4-regular-mono"].lineHeight}; 949 letter-spacing: ${({typography:t})=>t["h4-regular-mono"].letterSpacing}; 950 font-weight: ${({fontWeight:t})=>t.regular}; 951 font-family: ${({fontFamily:t})=>t.mono}; 952 } 953 954 .wui-font-h4-regular { 955 font-size: ${({textSize:t})=>t.h4}; 956 line-height: ${({typography:t})=>t["h4-regular"].lineHeight}; 957 letter-spacing: ${({typography:t})=>t["h4-regular"].letterSpacing}; 958 font-weight: ${({fontWeight:t})=>t.regular}; 959 font-family: ${({fontFamily:t})=>t.regular}; 960 font-feature-settings: 961 'liga' off, 962 'clig' off; 963 } 964 965 .wui-font-h4-medium { 966 font-size: ${({textSize:t})=>t.h4}; 967 line-height: ${({typography:t})=>t["h4-medium"].lineHeight}; 968 letter-spacing: ${({typography:t})=>t["h4-medium"].letterSpacing}; 969 font-weight: ${({fontWeight:t})=>t.medium}; 970 font-family: ${({fontFamily:t})=>t.regular}; 971 font-feature-settings: 972 'liga' off, 973 'clig' off; 974 } 975 976 .wui-font-h5-regular-mono { 977 font-size: ${({textSize:t})=>t.h5}; 978 line-height: ${({typography:t})=>t["h5-regular-mono"].lineHeight}; 979 letter-spacing: ${({typography:t})=>t["h5-regular-mono"].letterSpacing}; 980 font-weight: ${({fontWeight:t})=>t.regular}; 981 font-family: ${({fontFamily:t})=>t.mono}; 982 } 983 984 .wui-font-h5-regular { 985 font-size: ${({textSize:t})=>t.h5}; 986 line-height: ${({typography:t})=>t["h5-regular"].lineHeight}; 987 letter-spacing: ${({typography:t})=>t["h5-regular"].letterSpacing}; 988 font-weight: ${({fontWeight:t})=>t.regular}; 989 font-family: ${({fontFamily:t})=>t.regular}; 990 font-feature-settings: 991 'liga' off, 992 'clig' off; 993 } 994 995 .wui-font-h5-medium { 996 font-size: ${({textSize:t})=>t.h5}; 997 line-height: ${({typography:t})=>t["h5-medium"].lineHeight}; 998 letter-spacing: ${({typography:t})=>t["h5-medium"].letterSpacing}; 999 font-weight: ${({fontWeight:t})=>t.medium}; 1000 font-family: ${({fontFamily:t})=>t.regular}; 1001 font-feature-settings: 1002 'liga' off, 1003 'clig' off; 1004 } 1005 1006 .wui-font-h6-regular-mono { 1007 font-size: ${({textSize:t})=>t.h6}; 1008 line-height: ${({typography:t})=>t["h6-regular-mono"].lineHeight}; 1009 letter-spacing: ${({typography:t})=>t["h6-regular-mono"].letterSpacing}; 1010 font-weight: ${({fontWeight:t})=>t.regular}; 1011 font-family: ${({fontFamily:t})=>t.mono}; 1012 } 1013 1014 .wui-font-h6-regular { 1015 font-size: ${({textSize:t})=>t.h6}; 1016 line-height: ${({typography:t})=>t["h6-regular"].lineHeight}; 1017 letter-spacing: ${({typography:t})=>t["h6-regular"].letterSpacing}; 1018 font-weight: ${({fontWeight:t})=>t.regular}; 1019 font-family: ${({fontFamily:t})=>t.regular}; 1020 font-feature-settings: 1021 'liga' off, 1022 'clig' off; 1023 } 1024 1025 .wui-font-h6-medium { 1026 font-size: ${({textSize:t})=>t.h6}; 1027 line-height: ${({typography:t})=>t["h6-medium"].lineHeight}; 1028 letter-spacing: ${({typography:t})=>t["h6-medium"].letterSpacing}; 1029 font-weight: ${({fontWeight:t})=>t.medium}; 1030 font-family: ${({fontFamily:t})=>t.regular}; 1031 font-feature-settings: 1032 'liga' off, 1033 'clig' off; 1034 } 1035 1036 .wui-font-lg-regular-mono { 1037 font-size: ${({textSize:t})=>t.large}; 1038 line-height: ${({typography:t})=>t["lg-regular-mono"].lineHeight}; 1039 letter-spacing: ${({typography:t})=>t["lg-regular-mono"].letterSpacing}; 1040 font-weight: ${({fontWeight:t})=>t.regular}; 1041 font-family: ${({fontFamily:t})=>t.mono}; 1042 } 1043 1044 .wui-font-lg-regular { 1045 font-size: ${({textSize:t})=>t.large}; 1046 line-height: ${({typography:t})=>t["lg-regular"].lineHeight}; 1047 letter-spacing: ${({typography:t})=>t["lg-regular"].letterSpacing}; 1048 font-weight: ${({fontWeight:t})=>t.regular}; 1049 font-family: ${({fontFamily:t})=>t.regular}; 1050 font-feature-settings: 1051 'liga' off, 1052 'clig' off; 1053 } 1054 1055 .wui-font-lg-medium { 1056 font-size: ${({textSize:t})=>t.large}; 1057 line-height: ${({typography:t})=>t["lg-medium"].lineHeight}; 1058 letter-spacing: ${({typography:t})=>t["lg-medium"].letterSpacing}; 1059 font-weight: ${({fontWeight:t})=>t.medium}; 1060 font-family: ${({fontFamily:t})=>t.regular}; 1061 font-feature-settings: 1062 'liga' off, 1063 'clig' off; 1064 } 1065 1066 .wui-font-md-regular-mono { 1067 font-size: ${({textSize:t})=>t.medium}; 1068 line-height: ${({typography:t})=>t["md-regular-mono"].lineHeight}; 1069 letter-spacing: ${({typography:t})=>t["md-regular-mono"].letterSpacing}; 1070 font-weight: ${({fontWeight:t})=>t.regular}; 1071 font-family: ${({fontFamily:t})=>t.mono}; 1072 } 1073 1074 .wui-font-md-regular { 1075 font-size: ${({textSize:t})=>t.medium}; 1076 line-height: ${({typography:t})=>t["md-regular"].lineHeight}; 1077 letter-spacing: ${({typography:t})=>t["md-regular"].letterSpacing}; 1078 font-weight: ${({fontWeight:t})=>t.regular}; 1079 font-family: ${({fontFamily:t})=>t.regular}; 1080 font-feature-settings: 1081 'liga' off, 1082 'clig' off; 1083 } 1084 1085 .wui-font-md-medium { 1086 font-size: ${({textSize:t})=>t.medium}; 1087 line-height: ${({typography:t})=>t["md-medium"].lineHeight}; 1088 letter-spacing: ${({typography:t})=>t["md-medium"].letterSpacing}; 1089 font-weight: ${({fontWeight:t})=>t.medium}; 1090 font-family: ${({fontFamily:t})=>t.regular}; 1091 font-feature-settings: 1092 'liga' off, 1093 'clig' off; 1094 } 1095 1096 .wui-font-sm-regular-mono { 1097 font-size: ${({textSize:t})=>t.small}; 1098 line-height: ${({typography:t})=>t["sm-regular-mono"].lineHeight}; 1099 letter-spacing: ${({typography:t})=>t["sm-regular-mono"].letterSpacing}; 1100 font-weight: ${({fontWeight:t})=>t.regular}; 1101 font-family: ${({fontFamily:t})=>t.mono}; 1102 } 1103 1104 .wui-font-sm-regular { 1105 font-size: ${({textSize:t})=>t.small}; 1106 line-height: ${({typography:t})=>t["sm-regular"].lineHeight}; 1107 letter-spacing: ${({typography:t})=>t["sm-regular"].letterSpacing}; 1108 font-weight: ${({fontWeight:t})=>t.regular}; 1109 font-family: ${({fontFamily:t})=>t.regular}; 1110 font-feature-settings: 1111 'liga' off, 1112 'clig' off; 1113 } 1114 1115 .wui-font-sm-medium { 1116 font-size: ${({textSize:t})=>t.small}; 1117 line-height: ${({typography:t})=>t["sm-medium"].lineHeight}; 1118 letter-spacing: ${({typography:t})=>t["sm-medium"].letterSpacing}; 1119 font-weight: ${({fontWeight:t})=>t.medium}; 1120 font-family: ${({fontFamily:t})=>t.regular}; 1121 font-feature-settings: 1122 'liga' off, 1123 'clig' off; 1124 } 1125`;var Hb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
1125a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const bFe={primary:Gs.tokens.theme.textPrimary,secondary:Gs.tokens.theme.textSecondary,tertiary:Gs.tokens.theme.textTertiary,invert:Gs.tokens.theme.textInvert,error:Gs.tokens.core.textError,warning:Gs.tokens.core.textWarning,"accent-primary":Gs.tokens.core.textAccentPrimary};let kp=class extends tt{constructor(){super(...arguments),this.variant="md-regular",this.color="inherit",this.align="left",this.lineClamp=void 0,this.display="inline-flex"}render(){const e={[`wui-font-${this.variant}`]:!0,[`wui-line-clamp-${this.lineClamp}`]:!!this.lineClamp};return this.style.cssText=` 1126 display: ${this.display}; 1127 --local-align: ${this.align}; 1128 --local-color: ${this.color==="inherit"?"inherit":bFe[this.color??"primary"]}; 1129 `,se`<slot class=${OM(e)}></slot>`}};kp.styles=[vn,yFe];Hb([le()],kp.prototype,"variant",void 0);Hb([le()],kp.prototype,"color",void 0);Hb([le()],kp.prototype,"align",void 0);Hb([le()],kp.prototype,"lineClamp",void 0);Hb([le()],kp.prototype,"display",void 0);kp=Hb([Qe("wui-text")],kp);const wFe=os` 1130 :host { 1131 display: flex; 1132 width: inherit; 1133 height: inherit; 1134 box-sizing: border-box; 1135 } 1136`;var cc=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Ho=class extends tt{render(){return this.style.cssText=` 1137 flex-direction: ${this.flexDirection}; 1138 flex-wrap: ${this.flexWrap}; 1139 flex-basis: ${this.flexBasis}; 1140 flex-grow: ${this.flexGrow}; 1141 flex-shrink: ${this.flexShrink}; 1142 align-items: ${this.alignItems}; 1143 justify-content: ${this.justifyContent}; 1144 column-gap: ${this.columnGap&&`var(--apkt-spacing-${this.columnGap})`}; 1145 row-gap: ${this.rowGap&&`var(--apkt-spacing-${this.rowGap})`}; 1146 gap: ${this.gap&&`var(--apkt-spacing-${this.gap})`}; 1147 padding-top: ${this.padding&&ds.getSpacingStyles(this.padding,0)}; 1148 padding-right: ${this.padding&&ds.getSpacingStyles(this.padding,1)}; 1149 padding-bottom: ${this.padding&&ds.getSpacingStyles(this.padding,2)}; 1150 padding-left: ${this.padding&&ds.getSpacingStyles(this.padding,3)}; 1151 margin-top: ${this.margin&&ds.getSpacingStyles(this.margin,0)}; 1152 margin-right: ${this.margin&&ds.getSpacingStyles(this.margin,1)}; 1153 margin-bottom: ${this.margin&&ds.getSpacingStyles(this.margin,2)}; 1154 margin-left: ${this.margin&&ds.getSpacingStyles(this.margin,3)}; 1155 width: ${this.width}; 1156 `,se`<slot></slot>`}};Ho.styles=[vn,wFe];cc([le()],Ho.prototype,"flexDirection",void 0);cc([le()],Ho.prototype,"flexWrap",void 0);cc([le()],Ho.prototype,"flexBasis",void 0);cc([le()],Ho.prototype,"flexGrow",void 0);cc([le()],Ho.prototype,"flexShrink",void 0);cc([le()],Ho.prototype,"alignItems",void 0);cc([le()],Ho.prototype,"justifyContent",void 0);cc([le()],Ho.prototype,"columnGap",void 0);cc([le()],Ho.prototype,"rowGap",void 0);cc([le()],Ho.prototype,"gap",void 0);cc([le()],Ho.prototype,"padding",void 0);cc([le()],Ho.prototype,"margin",void 0);cc([le()],Ho.prototype,"width",void 0);Ho=cc([Qe("wui-flex")],Ho);const vFe=It` 1157 :host { 1158 display: block; 1159 width: var(--local-width); 1160 height: var(--local-height); 1161 border-radius: ${({borderRadius:t})=>t[16]}; 1162 overflow: hidden; 1163 position: relative; 1164 } 1165 1166 :host([data-variant='generated']) { 1167 --mixed-local-color-1: var(--local-color-1); 1168 --mixed-local-color-2: var(--local-color-2); 1169 --mixed-local-color-3: var(--local-color-3); 1170 --mixed-local-color-4: var(--local-color-4); 1171 --mixed-local-color-5: var(--local-color-5); 1172 } 1173 1174 :host([data-variant='generated']) { 1175 background: radial-gradient( 1176 var(--local-radial-circle), 1177 #fff 0.52%, 1178 var(--mixed-local-color-5) 31.25%, 1179 var(--mixed-local-color-3) 51.56%, 1180 var(--mixed-local-color-2) 65.63%, 1181 var(--mixed-local-color-1) 82.29%, 1182 var(--mixed-local-color-4) 100% 1183 ); 1184 } 1185 1186 :host([data-variant='default']) { 1187 background: radial-gradient( 1188 75.29% 75.29% at 64.96% 24.36%, 1189 #fff 0.52%, 1190 #f5ccfc 31.25%, 1191 #dba4f5 51.56%, 1192 #9a8ee8 65.63%, 1193 #6493da 82.29%, 1194 #6ebdea 100% 1195 ); 1196 } 1197`;var z6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
1197a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Bg=class extends tt{constructor(){super(...arguments),this.imageSrc=void 0,this.alt=void 0,this.address=void 0,this.size="xl"}render(){const e={inherit:"inherit",xxs:"3",xs:"5",sm:"6",md:"8",mdl:"8",lg:"10",xl:"16",xxl:"20"};return this.style.cssText=` 1198 --local-width: var(--apkt-spacing-${e[this.size??"xl"]}); 1199 --local-height: var(--apkt-spacing-${e[this.size??"xl"]}); 1200 `,se`${this.visualTemplate()}`}visualTemplate(){if(this.imageSrc)return this.dataset.variant="image",se`<wui-image src=${this.imageSrc} alt=${this.alt??"avatar"}></wui-image>`;if(this.address){this.dataset.variant="generated";const e=ds.generateAvatarColors(this.address);return this.style.cssText+=` 1201 ${e}`,null}return this.dataset.variant="default",null}};Bg.styles=[vn,vFe];z6([le()],Bg.prototype,"imageSrc",void 0);z6([le()],Bg.prototype,"alt",void 0);z6([le()],Bg.prototype,"address",void 0);z6([le()],Bg.prototype,"size",void 0);Bg=z6([Qe("wui-avatar")],Bg);const CFe=It` 1202 :host { 1203 display: block; 1204 } 1205 1206 button { 1207 border-radius: ${({borderRadius:t})=>t[20]}; 1208 background: ${({tokens:t})=>t.theme.foregroundPrimary}; 1209 display: flex; 1210 gap: ${({spacing:t})=>t[1]}; 1211 padding: ${({spacing:t})=>t[1]}; 1212 color: ${({tokens:t})=>t.theme.textSecondary}; 1213 border-radius: ${({borderRadius:t})=>t[16]}; 1214 height: 32px; 1215 transition: box-shadow ${({durations:t})=>t.lg} 1216 ${({easings:t})=>t["ease-out-power-2"]}; 1217 will-change: box-shadow; 1218 } 1219 1220 button wui-flex.avatar-container { 1221 width: 28px; 1222 height: 24px; 1223 position: relative; 1224 1225 wui-flex.network-image-container { 1226 position: absolute; 1227 bottom: 0px; 1228 right: 0px; 1229 width: 12px; 1230 height: 12px; 1231 } 1232 1233 wui-flex.network-image-container wui-icon { 1234 background: ${({tokens:t})=>t.theme.foregroundPrimary}; 1235 } 1236 1237 wui-avatar { 1238 width: 24px; 1239 min-width: 24px; 1240 height: 24px; 1241 } 1242 1243 wui-icon { 1244 width: 12px; 1245 height: 12px; 1246 } 1247 } 1248 1249 wui-image, 1250 wui-icon { 1251 border-radius: ${({borderRadius:t})=>t[16]}; 1252 } 1253 1254 wui-text { 1255 white-space: nowrap; 1256 } 1257 1258 button wui-flex.balance-container { 1259 height: 100%; 1260 border-radius: ${({borderRadius:t})=>t[16]}; 1261 padding-left: ${({spacing:t})=>t[1]}; 1262 padding-right: ${({spacing:t})=>t[1]}; 1263 background: ${({tokens:t})=>t.theme.foregroundSecondary}; 1264 color: ${({tokens:t})=>t.theme.textPrimary}; 1265 transition: background-color ${({durations:t})=>t.lg} 1266 ${({easings:t})=>t["ease-out-power-2"]}; 1267 will-change: background-color; 1268 } 1269 1270 /* -- Hover & Active states ----------------------------------------------------------- */ 1271 button:hover:enabled, 1272 button:focus-visible:enabled, 1273 button:active:enabled { 1274 box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.2); 1275 1276 wui-flex.balance-container { 1277 background: ${({tokens:t})=>t.theme.foregroundTertiary}; 1278 } 1279 } 1280 1281 /* -- Disabled states --------------------------------------------------- */ 1282 button:disabled wui-text, 1283 button:disabled wui-flex.avatar-container { 1284 opacity: 0.3; 1285 } 1286`;var Fu=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let qc=class extends tt{constructor(){super(...arguments),this.networkSrc=void 0,this.avatarSrc=void 0,this.balance=void 0,this.isUnsupportedChain=void 0,this.disabled=!1,this.loading=!1,this.address="",this.profileName="",this.charsStart=4,this.charsEnd=6}render(){return se` 1287 <button 1288 ?disabled=${this.disabled} 1289 class=${xt(this.balance?void 0:"local-no-balance")} 1290 data-error=${xt(this.isUnsupportedChain)} 1291 > 1292 ${this.imageTemplate()} ${this.addressTemplate()} ${this.balanceTemplate()} 1293 </button> 1294 `}imageTemplate(){const e=this.networkSrc?se`<wui-image src=${this.networkSrc}></wui-image>`:se` <wui-icon size="inherit" color="inherit" name="networkPlaceholder"></wui-icon> `;return se`<wui-flex class="avatar-container"> 1295 <wui-avatar 1296 .imageSrc=${this.avatarSrc} 1297 alt=${this.address} 1298 address=${this.address} 1299 ></wui-avatar> 1300 1301 <wui-flex class="network-image-container">${e}</wui-flex> 1302 </wui-flex>`}addressTemplate(){return se`<wui-text variant="md-regular" color="inherit"> 1303 ${this.address?ds.getTruncateString({string:this.profileName||this.address,charsStart:this.profileName?18:this.charsStart,charsEnd:this.profileName?0:this.charsEnd,truncate:this.profileName?"end":"middle"}):null} 1304 </wui-text>`}balanceTemplate(){if(this.balance){const e=this.loading?se`<wui-loading-spinner size="md" color="inherit"></wui-loading-spinner>`:se`<wui-text variant="md-regular" color="inherit"> ${this.balance}</wui-text>`;return se`<wui-flex alignItems="center" justifyContent="center" class="balance-container" 1305 >${e}</wui-flex 1306 >`}return null}};qc.styles=[vn,Gi,CFe];Fu([le()],qc.prototype,"networkSrc",void 0);Fu([le()],qc.prototype,"avatarSrc",void 0);Fu([le()],qc.prototype,"balance",void 0);Fu([le({type:Boolean})],qc.prototype,"isUnsupportedChain",void 0);Fu([le({type:Boolean})],qc.prototype,"disabled",void 0);Fu([le({type:Boolean})],qc.prototype,"loading",void 0);Fu([le()],qc.prototype,"address",void 0);Fu([le()],qc.prototype,"profileName",void 0);Fu([le()],qc.prototype,"charsStart",void 0);Fu([le()],qc.prototype,"charsEnd",void 0);qc=Fu([Qe("wui-account-button")],qc);var ba=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
1306a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};class wa extends tt{constructor(){super(...arguments),this.unsubscribe=[],this.disabled=!1,this.balance="show",this.charsStart=4,this.charsEnd=6,this.namespace=void 0,this.isSupported=ye.state.allowUnsupportedChain?!0:ne.state.activeChain?ne.checkIfSupportedNetwork(ne.state.activeChain):!0}connectedCallback(){super.connectedCallback(),this.setAccountData(ne.getAccountData(this.namespace)),this.setNetworkData(ne.getNetworkData(this.namespace))}firstUpdated(){const e=this.namespace;e?this.unsubscribe.push(ne.subscribeChainProp("accountState",n=>{this.setAccountData(n)},e),ne.subscribeChainProp("networkState",n=>{var i;this.setNetworkData(n),this.isSupported=ne.checkIfSupportedNetwork(e,(i=n==null?void 0:n.caipNetwork)==null?void 0:i.caipNetworkId)},e)):this.unsubscribe.push(vr.subscribeNetworkImages(()=>{this.networkImage=qi.getNetworkImage(this.network)}),ne.subscribeKey("activeCaipAddress",n=>{this.caipAddress=n}),ne.subscribeChainProp("accountState",n=>{this.setAccountData(n)}),ne.subscribeKey("activeCaipNetwork",n=>{this.network=n,this.networkImage=qi.getNetworkImage(n),this.isSupported=n!=null&&n.chainNamespace?ne.checkIfSupportedNetwork(n==null?void 0:n.chainNamespace):!0,this.fetchNetworkImage(n)}))}updated(){this.fetchNetworkImage(this.network)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!ne.state.activeChain)return null;const e=this.balance==="show",n=typeof this.balanceVal!="string",{formattedText:i}=Ue.parseBalance(this.balanceVal,this.balanceSymbol);return se` 1307 <wui-account-button 1308 .disabled=${!!this.disabled} 1309 .isUnsupportedChain=${ye.state.allowUnsupportedChain?!1:!this.isSupported} 1310 address=${xt(Ue.getPlainAddress(this.caipAddress))} 1311 profileName=${xt(this.profileName)} 1312 networkSrc=${xt(this.networkImage)} 1313 avatarSrc=${xt(this.profileImage)} 1314 balance=${e?i:""} 1315 @click=${this.onClick.bind(this)} 1316 data-testid=${`account-button${this.namespace?`-${this.namespace}`:""}`} 1317 .charsStart=${this.charsStart} 1318 .charsEnd=${this.charsEnd} 1319 ?loading=${n} 1320 > 1321 </wui-account-button> 1322 `}onClick(){this.isSupported||ye.state.allowUnsupportedChain?wn.open({namespace:this.namespace}):wn.open({view:"UnsupportedChain"})}async fetchNetworkImage(e){var n,i;(n=e==null?void 0:e.assets)!=null&&n.imageId&&(this.networkImage=await qi.fetchNetworkImage((i=e==null?void 0:e.assets)==null?void 0:i.imageId))}setAccountData(e){e&&(this.caipAddress=e.caipAddress,this.balanceVal=e.balance,this.balanceSymbol=e.balanceSymbol,this.profileName=e.profileName,this.profileImage=e.profileImage)}setNetworkData(e){e&&(this.network=e.caipNetwork,this.networkImage=qi.getNetworkImage(e.caipNetwork))}}ba([le({type:Boolean})],wa.prototype,"disabled",void 0);ba([le()],wa.prototype,"balance",void 0);ba([le()],wa.prototype,"charsStart",void 0);ba([le()],wa.prototype,"charsEnd",void 0);ba([le()],wa.prototype,"namespace",void 0);ba([Me()],wa.prototype,"caipAddress",void 0);ba([Me()],wa.prototype,"balanceVal",void 0);ba([Me()],wa.prototype,"balanceSymbol",void 0);ba([Me()],wa.prototype,"profileName",void 0);ba([Me()],wa.prototype,"profileImage",void 0);ba([Me()],wa.prototype,"network",void 0);ba([Me()],wa.prototype,"networkImage",void 0);ba([Me()],wa.prototype,"isSupported",void 0);let uI=class extends wa{};uI=ba([Qe("w3m-account-button")],uI);let M_=class extends wa{};M_=ba([Qe("appkit-account-button")],M_);const xFe=os` 1323 :host { 1324 display: block; 1325 width: max-content; 1326 } 1327`;var ju=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};class Bl extends tt{constructor(){super(...arguments),this.unsubscribe=[],this.disabled=!1,this.balance=void 0,this.size=void 0,this.label=void 0,this.loadingLabel=void 0,this.charsStart=4,this.charsEnd=6,this.namespace=void 0}firstUpdated(){var e;
1327this.caipAddress=this.namespace?(e=ne.getAccountData(this.namespace))==null?void 0:e.caipAddress:ne.state.activeCaipAddress,this.namespace?this.unsubscribe.push(ne.subscribeChainProp("accountState",n=>{this.caipAddress=n==null?void 0:n.caipAddress},this.namespace)):this.unsubscribe.push(ne.subscribeKey("activeCaipAddress",n=>this.caipAddress=n))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return this.caipAddress?se` 1328 <appkit-account-button 1329 .disabled=${!!this.disabled} 1330 balance=${xt(this.balance)} 1331 .charsStart=${xt(this.charsStart)} 1332 .charsEnd=${xt(this.charsEnd)} 1333 namespace=${xt(this.namespace)} 1334 > 1335 </appkit-account-button> 1336 `:se` 1337 <appkit-connect-button 1338 size=${xt(this.size)} 1339 label=${xt(this.label)} 1340 loadingLabel=${xt(this.loadingLabel)} 1341 namespace=${xt(this.namespace)} 1342 ></appkit-connect-button> 1343 `}}Bl.styles=xFe;ju([le({type:Boolean})],Bl.prototype,"disabled",void 0);ju([le()],Bl.prototype,"balance",void 0);ju([le()],Bl.prototype,"size",void 0);ju([le()],Bl.prototype,"label",void 0);ju([le()],Bl.prototype,"loadingLabel",void 0);ju([le()],Bl.prototype,"charsStart",void 0);ju([le()],Bl.prototype,"charsEnd",void 0);ju([le()],Bl.prototype,"namespace",void 0);ju([Me()],Bl.prototype,"caipAddress",void 0);let dI=class extends Bl{};dI=ju([Qe("w3m-button")],dI);let L_=class extends Bl{};L_=ju([Qe("appkit-button")],L_);const EFe=It` 1344 :host { 1345 position: relative; 1346 display: block; 1347 } 1348 1349 button { 1350 border-radius: ${({borderRadius:t})=>t[2]}; 1351 } 1352 1353 button[data-size='sm'] { 1354 padding: ${({spacing:t})=>t[2]}; 1355 } 1356 1357 button[data-size='md'] { 1358 padding: ${({spacing:t})=>t[3]}; 1359 } 1360 1361 button[data-size='lg'] { 1362 padding: ${({spacing:t})=>t[4]}; 1363 } 1364 1365 button[data-variant='primary'] { 1366 background: ${({tokens:t})=>t.core.backgroundAccentPrimary}; 1367 } 1368 1369 button[data-variant='secondary'] { 1370 background: ${({tokens:t})=>t.core.foregroundAccent010}; 1371 } 1372 1373 button:hover:enabled { 1374 border-radius: ${({borderRadius:t})=>t[3]}; 1375 } 1376 1377 button:disabled { 1378 cursor: not-allowed; 1379 } 1380 1381 button[data-loading='true'] { 1382 cursor: not-allowed; 1383 } 1384 1385 button[data-loading='true'][data-size='sm'] { 1386 border-radius: ${({borderRadius:t})=>t[32]}; 1387 padding: ${({spacing:t})=>t[2]} ${({spacing:t})=>t[3]}; 1388 } 1389 1390 button[data-loading='true'][data-size='md'] { 1391 border-radius: ${({borderRadius:t})=>t[20]}; 1392 padding: ${({spacing:t})=>t[3]} ${({spacing:t})=>t[4]}; 1393 } 1394 1395 button[data-loading='true'][data-size='lg'] { 1396 border-radius: ${({borderRadius:t})=>t[16]}; 1397 padding: ${({spacing:t})=>t[4]} ${({spacing:t})=>t[5]}; 1398 } 1399`;var H6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Fg=class extends tt{constructor(){super(...arguments),this.size="md",this.variant="primary",this.loading=!1,this.text="Connect Wallet"}render(){return se` 1400 <button 1401 data-loading=${this.loading} 1402 data-variant=${this.variant} 1403 data-size=${this.size} 1404 ?disabled=${this.loading} 1405 > 1406 ${this.contentTemplate()} 1407 </button> 1408 `}contentTemplate(){const e={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},n={primary:"invert",secondary:"accent-primary"};return this.loading?se`<wui-loading-spinner 1409 color=${n[this.variant]} 1410 size=${this.size} 1411 ></wui-loading-spinner>`:se` <wui-text variant=${e[this.size]} color=${n[this.variant]}> 1412 ${this.text} 1413 </wui-text>`}};Fg.styles=[vn,Gi,EFe];H6([le()],Fg.prototype,"size",void 0);H6([le()],Fg.prototype,"variant",void 0);H6([le({type:Boolean})],Fg.prototype,"loading",void 0);H6([le()],Fg.prototype,"text",void 0);Fg=H6([Qe("wui-connect-button")],Fg);var Wp=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
1413a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};class qp extends tt{constructor(){super(),this.unsubscribe=[],this.size="md",this.label="Connect Wallet",this.loadingLabel="Connecting...",this.open=wn.state.open,this.loading=this.namespace?wn.state.loadingNamespaceMap.get(this.namespace):wn.state.loading,this.unsubscribe.push(wn.subscribe(e=>{this.open=e.open,this.loading=this.namespace?e.loadingNamespaceMap.get(this.namespace):e.loading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se` 1414 <wui-connect-button 1415 size=${xt(this.size)} 1416 .loading=${this.loading} 1417 @click=${this.onClick.bind(this)} 1418 data-testid=${`connect-button${this.namespace?`-${this.namespace}`:""}`} 1419 > 1420 ${this.loading?this.loadingLabel:this.label} 1421 </wui-connect-button> 1422 `}onClick(){this.open?wn.close():this.loading||wn.open({view:"Connect",namespace:this.namespace})}}Wp([le()],qp.prototype,"size",void 0);Wp([le()],qp.prototype,"label",void 0);Wp([le()],qp.prototype,"loadingLabel",void 0);Wp([le()],qp.prototype,"namespace",void 0);Wp([Me()],qp.prototype,"open",void 0);Wp([Me()],qp.prototype,"loading",void 0);let hI=class extends qp{};hI=Wp([Qe("w3m-connect-button")],hI);let $_=class extends qp{};$_=Wp([Qe("appkit-connect-button")],$_);const _Fe=It` 1423 :host { 1424 display: inline-flex; 1425 justify-content: center; 1426 align-items: center; 1427 border-radius: ${({borderRadius:t})=>t[2]}; 1428 padding: ${({spacing:t})=>t[1]} !important; 1429 background-color: ${({tokens:t})=>t.theme.backgroundPrimary}; 1430 position: relative; 1431 } 1432 1433 :host([data-padding='2']) { 1434 padding: ${({spacing:t})=>t[2]} !important; 1435 } 1436 1437 :host:after { 1438 content: ''; 1439 position: absolute; 1440 top: 0; 1441 left: 0; 1442 width: 100%; 1443 height: 100%; 1444 border-radius: ${({borderRadius:t})=>t[2]}; 1445 } 1446 1447 :host > wui-icon { 1448 z-index: 10; 1449 } 1450 1451 /* -- Colors --------------------------------------------------- */ 1452 :host([data-color='accent-primary']) { 1453 color: ${({tokens:t})=>t.core.iconAccentPrimary}; 1454 } 1455 1456 :host([data-color='accent-primary']):after { 1457 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 1458 } 1459 1460 :host([data-color='default']), 1461 :host([data-color='secondary']) { 1462 color: ${({tokens:t})=>t.theme.iconDefault}; 1463 } 1464 1465 :host([data-color='default']):after { 1466 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 1467 } 1468 1469 :host([data-color='secondary']):after { 1470 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 1471 } 1472 1473 :host([data-color='success']) { 1474 color: ${({tokens:t})=>t.core.iconSuccess}; 1475 } 1476 1477 :host([data-color='success']):after { 1478 background-color: ${({tokens:t})=>t.core.backgroundSuccess}; 1479 } 1480 1481 :host([data-color='error']) { 1482 color: ${({tokens:t})=>t.core.iconError}; 1483 } 1484 1485 :host([data-color='error']):after { 1486 background-color: ${({tokens:t})=>t.core.backgroundError}; 1487 } 1488 1489 :host([data-color='warning']) { 1490 color: ${({tokens:t})=>t.core.iconWarning}; 1491 } 1492 1493 :host([data-color='warning']):after { 1494 background-color: ${({tokens:t})=>t.core.backgroundWarning}; 1495 } 1496 1497 :host([data-color='inverse']) { 1498 color: ${({tokens:t})=>t.theme.iconInverse}; 1499 } 1500 1501 :host([data-color='inverse']):after { 1502 background-color: transparent; 1503 } 1504`;var G6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let jg=class extends tt{constructor(){super(...arguments),this.icon="copy",this.size="md",this.padding="1",this.color="default"}render(){return this.dataset.padding=this.padding,this.dataset.color=this.color,se` 1505 <wui-icon size=${xt(this.size)} name=${this.icon} color="inherit"></wui-icon> 1506 `}};jg.styles=[vn,Gi,_Fe];G6([le()],jg.prototype,"icon",void 0);G6([le()],jg.prototype,"size",void 0);G6([le()],jg.prototype,"padding",void 0);G6([le()],jg.prototype,"color",void 0);
1506jg=G6([Qe("wui-icon-box")],jg);const SFe=It` 1507 :host { 1508 display: block; 1509 } 1510 1511 button { 1512 border-radius: ${({borderRadius:t})=>t[32]}; 1513 display: flex; 1514 gap: ${({spacing:t})=>t[1]}; 1515 padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]} 1516 ${({spacing:t})=>t[1]} ${({spacing:t})=>t[1]}; 1517 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 1518 } 1519 1520 button:disabled { 1521 opacity: 0.5; 1522 cursor: not-allowed; 1523 } 1524 1525 @media (hover: hover) { 1526 button:hover:enabled { 1527 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 1528 } 1529 } 1530 1531 button[data-size='sm'] > wui-icon-box, 1532 button[data-size='sm'] > wui-image { 1533 width: 16px; 1534 height: 16px; 1535 } 1536 1537 button[data-size='md'] > wui-icon-box, 1538 button[data-size='md'] > wui-image { 1539 width: 20px; 1540 height: 20px; 1541 } 1542 1543 button[data-size='lg'] > wui-icon-box, 1544 button[data-size='lg'] > wui-image { 1545 width: 24px; 1546 height: 24px; 1547 } 1548 1549 wui-image, 1550 wui-icon-box { 1551 border-radius: ${({borderRadius:t})=>t[32]}; 1552 } 1553`;var K6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Vg=class extends tt{constructor(){super(...arguments),this.imageSrc=void 0,this.isUnsupportedChain=void 0,this.disabled=!1,this.size="lg"}render(){const e={sm:"sm-regular",md:"md-regular",lg:"lg-regular"};return se` 1554 <button data-size=${this.size} data-testid="wui-network-button" ?disabled=${this.disabled}> 1555 ${this.visualTemplate()} 1556 <wui-text variant=${e[this.size]} color="primary"> 1557 <slot></slot> 1558 </wui-text> 1559 </button> 1560 `}visualTemplate(){return this.isUnsupportedChain?se` <wui-icon-box color="error" icon="warningCircle"></wui-icon-box> `:this.imageSrc?se`<wui-image src=${this.imageSrc}></wui-image>`:se` <wui-icon size="xl" color="default" name="networkPlaceholder"></wui-icon> `}};Vg.styles=[vn,Gi,SFe];K6([le()],Vg.prototype,"imageSrc",void 0);K6([le({type:Boolean})],Vg.prototype,"isUnsupportedChain",void 0);K6([le({type:Boolean})],Vg.prototype,"disabled",void 0);K6([le()],Vg.prototype,"size",void 0);Vg=K6([Qe("wui-network-button")],Vg);const AFe=os` 1561 :host { 1562 display: block; 1563 width: max-content; 1564 } 1565`;var $f=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};class Hd extends tt{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.network=ne.state.activeCaipNetwork,this.networkImage=qi.getNetworkImage(this.network),this.caipAddress=ne.state.activeCaipAddress,this.loading=wn.state.loading,this.isSupported=ye.state.allowUnsupportedChain?!0:ne.state.activeChain?ne.checkIfSupportedNetwork(ne.state.activeChain):!0,this.unsubscribe.push(vr.subscribeNetworkImages(()=>{this.networkImage=qi.getNetworkImage(this.network)}),ne.subscribeKey("activeCaipAddress",e=>{this.caipAddress=e}),ne.subscribeKey("activeCaipNetwork",e=>{var n;this.network=e,this.networkImage=qi.getNetworkImage(e),this.isSupported=e!=null&&e.chainNamespace?ne.checkIfSupportedNetwork(e.chainNamespace):!0,qi.fetchNetworkImage((n=e==null?void 0:e.assets)==null?void 0:n.imageId)}),wn.subscribeKey("loading",e=>this.loading=e))}firstUpdated(){var e,n;qi.fetchNetworkImage((n=(e=this.network)==null?void 0:e.assets)==null?void 0:n.imageId)}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.network?ne.checkIfSupportedNetwork(this.network.chainNamespace):!0;return se` 1566 <wui-network-button 1567 .disabled=${!!(this.disabled||this.loading)} 1568 .isUnsupportedChain=${ye.state.allowUnsupportedChain?!1:!e} 1569 imageSrc=${xt(this.networkImage)} 1570 @click=${this.onClick.bind(this)} 1571 data-testid="w3m-network-button" 1572 > 1573 ${this.getLabel()} 1574 <slot></slot> 1575 </wui-network-button>
1575 1576 `}getLabel(){return this.network?!this.isSupported&&!ye.state.allowUnsupportedChain?"Switch Network":this.network.name:this.label?this.label:this.caipAddress?"Unknown Network":"Select Network"}onClick(){this.loading||(Et.sendEvent({type:"track",event:"CLICK_NETWORKS"}),wn.open({view:"Networks"}))}}Hd.styles=AFe;$f([le({type:Boolean})],Hd.prototype,"disabled",void 0);$f([le({type:String})],Hd.prototype,"label",void 0);$f([Me()],Hd.prototype,"network",void 0);$f([Me()],Hd.prototype,"networkImage",void 0);$f([Me()],Hd.prototype,"caipAddress",void 0);$f([Me()],Hd.prototype,"loading",void 0);$f([Me()],Hd.prototype,"isSupported",void 0);let fI=class extends Hd{};fI=$f([Qe("w3m-network-button")],fI);let U_=class extends Hd{};U_=$f([Qe("appkit-network-button")],U_);const TFe="https://reown.com",kFe=It` 1577 .reown-logo { 1578 height: 24px; 1579 } 1580 1581 a { 1582 text-decoration: none; 1583 cursor: pointer; 1584 color: ${({tokens:t})=>t.theme.textSecondary}; 1585 } 1586 1587 a:hover { 1588 opacity: 0.9; 1589 } 1590`;var NFe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let pI=class extends tt{render(){return se` 1591 <a 1592 data-testid="ux-branding-reown" 1593 href=${TFe} 1594 rel="noreferrer" 1595 target="_blank" 1596 style="text-decoration: none;" 1597 > 1598 <wui-flex 1599 justifyContent="center" 1600 alignItems="center" 1601 gap="1" 1602 .padding=${["01","0","3","0"]} 1603 > 1604 <wui-text variant="sm-regular" color="inherit"> UX by </wui-text> 1605 <wui-icon name="reown" size="inherit" class="reown-logo"></wui-icon> 1606 </wui-flex> 1607 </a> 1608 `}};pI.styles=[vn,Gi,kFe];pI=NFe([Qe("wui-ux-by-reown")],pI);const RFe=It` 1609 :host wui-ux-by-reown { 1610 padding-top: 0; 1611 } 1612 1613 :host wui-ux-by-reown.branding-only { 1614 padding-top: ${({spacing:t})=>t[3]}; 1615 } 1616 1617 a { 1618 text-decoration: none; 1619 color: ${({tokens:t})=>t.core.textAccentPrimary}; 1620 font-weight: 500; 1621 } 1622`;var lre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let B_=class extends tt{constructor(){super(),this.unsubscribe=[],this.remoteFeatures=ye.state.remoteFeatures,this.unsubscribe.push(ye.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var r;const{termsConditionsUrl:e,privacyPolicyUrl:n}=ye.state,i=(r=ye.state.features)==null?void 0:r.legalCheckbox;return!e&&!n||i?se` 1623 <wui-flex flexDirection="column"> ${this.reownBrandingTemplate(!0)} </wui-flex> 1624 `:se` 1625 <wui-flex flexDirection="column"> 1626 <wui-flex .padding=${["4","3","3","3"]} justifyContent="center"> 1627 <wui-text color="secondary" variant="md-regular" align="center"> 1628 By connecting your wallet, you agree to our <br /> 1629 ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()} 1630 </wui-text> 1631 </wui-flex> 1632 ${this.reownBrandingTemplate()} 1633 </wui-flex> 1634 `}andTemplate(){const{termsConditionsUrl:e,privacyPolicyUrl:n}=ye.state;return e&&n?"and":""}termsTemplate(){const{termsConditionsUrl:e}=ye.state;return e?se`<a href=${e} target="_blank" rel="noopener noreferrer" 1635 >Terms of Service</a 1636 >`:null}privacyTemplate(){const{privacyPolicyUrl:e}=ye.state;return e?se`<a href=${e} target="_blank" rel="noopener noreferrer" 1637 >Privacy Policy</a 1638 >`:null}reownBrandingTemplate(e=!1){var n;return(n=this.remoteFeatures)!=null&&n.reownBranding?e?se`<wui-ux-by-reown class="branding-only"></wui-ux-by-reown>`:se`<wui-ux-by-reown></wui-ux-by-reown>`:null}};B_.styles=[RFe];lre([Me()],B_.prototype,"remoteFeatures",void 0);B_=lre([Qe("w3m-legal-footer")],B_);const PFe=It` 1639 button { 1640 border: none; 1641 background: transparent; 1642 height: 20px; 1643 padding: ${({spacing:t})=>t[2]}; 1644 column-gap: ${({spacing:t})=>t[1]}; 1645 border-radius: ${({borderRadius:t})=>t[1]}; 1646 padding: 0 ${({spacing:t})=>t[1]}; 1647 border-radius: ${({spacing:t})=>t[1]}; 1648 } 1649 1650 /* -- Variants --------------------------------------------------------- */ 1651 button[data-variant='accent'] { 1652 color: ${({tokens:t})=>t.core.textAccentPrimary}; 1653 } 1654 1655 button[data-variant='secondary'] { 1656 color: ${({tokens:t})=>t.theme.textSecondary}; 1657 } 1658 1659 /* -- Focus states --------------------------------------------------- */ 1660 button:focus-visible:enabled { 1661 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 1662 } 1663 1664 button[data-variant='accent']:focus-visible:enabled { 1665 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 1666 } 1667 1668 button[data-variant='secondary']:focus-visible:enabled { 1669 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 1670 } 1671 1672 /* -- Hover & Active states ----------------------------------------------------------- */ 1673 button[data-variant='accent']:hover:enabled { 1674 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 1675 } 1676 1677 button[data-variant='secondary']:hover:enabled { 1678 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 1679 } 1680 1681 button[data-variant='accent']:focus-visible { 1682 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 1683 } 1684 1685 button[data-variant='secondary']:focus-visible { 1686 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 1687 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 1688 } 1689 1690 button[disabled] { 1691 opacity: 0.5;
1692 cursor: not-allowed; 1693 } 1694`;var Y6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const IFe={sm:"sm-medium",md:"md-medium"},DFe={accent:"accent-primary",secondary:"secondary"};let Wg=class extends tt{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.variant="accent",this.icon=void 0}render(){return se` 1695 <button ?disabled=${this.disabled} data-variant=${this.variant}> 1696 <slot name="iconLeft"></slot> 1697 <wui-text 1698 color=${DFe[this.variant]} 1699 variant=${IFe[this.size]} 1700 > 1701 <slot></slot> 1702 </wui-text> 1703 ${this.iconTemplate()} 1704 </button> 1705 `}iconTemplate(){return this.icon?se`<wui-icon name=${this.icon} size="sm"></wui-icon>`:null}};Wg.styles=[vn,Gi,PFe];Y6([le()],Wg.prototype,"size",void 0);Y6([le({type:Boolean})],Wg.prototype,"disabled",void 0);Y6([le()],Wg.prototype,"variant",void 0);Y6([le()],Wg.prototype,"icon",void 0);Wg=Y6([Qe("wui-link")],Wg);const OFe=os``;var MFe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let mI=class extends tt{render(){const{termsConditionsUrl:e,privacyPolicyUrl:n}=ye.state;return!e&&!n?null:se` 1706 <wui-flex 1707 .padding=${["4","3","3","3"]} 1708 flexDirection="column" 1709 alignItems="center" 1710 justifyContent="center" 1711 gap="3" 1712 > 1713 <wui-text color="secondary" variant="md-regular" align="center"> 1714 We work with the best providers to give you the lowest fees and best support. More options 1715 coming soon! 1716 </wui-text> 1717 1718 ${this.howDoesItWorkTemplate()} 1719 </wui-flex> 1720 `}howDoesItWorkTemplate(){return se` <wui-link @click=${this.onWhatIsBuy.bind(this)}> 1721 <wui-icon size="xs" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon> 1722 How does it work? 1723 </wui-link>`}onWhatIsBuy(){Et.sendEvent({type:"track",event:"SELECT_WHAT_IS_A_BUY",properties:{isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}}),Pe.push("WhatIsABuy")}};mI.styles=[OFe];mI=MFe([Qe("w3m-onramp-providers-footer")],mI);var RH={};const kx={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],SECURE_SITE_ORIGIN:(typeof process<"u"&&typeof RH<"u"?RH.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120},VIEWS_WITH_LEGAL_FOOTER:["Connect","ConnectWallets","OnRampTokenSelect","OnRampFiatSelect","OnRampProviders"],VIEWS_WITH_DEFAULT_FOOTER:["Networks"]},A2={getTabsByNamespace(t){var n;return!!t&&t===we.CHAIN.EVM?((n=ye.state.remoteFeatures)==null?void 0:n.activity)===!1?kx.ACCOUNT_TABS.filter(i=>i.label!=="Activity"):kx.ACCOUNT_TABS:[]},isValidReownName(t){return/^[a-zA-Z0-9]+$/gu.test(t)},isValidEmail(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/gu.test(t)},validateReownName(t){return t.replace(/\^/gu,"").toLowerCase().replace(/[^a-zA-Z0-9]/gu,"")},hasFooter(){var e;const t=Pe.state.view;if(kx.VIEWS_WITH_LEGAL_FOOTER.includes(t)){const{termsConditionsUrl:n,privacyPolicyUrl:i}=ye.state,s=(e=ye.state.features)==null?void 0:e.legalCheckbox;return!(!n&&!i||s)}return kx.VIEWS_WITH_DEFAULT_FOOTER.includes(t)}},LFe=It` 1724 :host { 1725 display: block; 1726 } 1727 1728 div.container { 1729 position: absolute; 1730 bottom: 0; 1731 left: 0; 1732 right: 0; 1733 overflow: hidden; 1734 height: auto; 1735 display: block; 1736 } 1737 1738 div.container[status='hide'] { 1739 animation: fade-out; 1740 animation-duration: var(--apkt-duration-dynamic); 1741 animation-timing-function: ${({easings:t})=>t["ease-out-power-2"]}; 1742 animation-fill-mode: both; 1743 animation-delay: 0s; 1744 } 1745 1746 div.container[status='show'] { 1747 animation: fade-in; 1748 animation-duration: var(--apkt-duration-dynamic); 1749 animation-timing-function: ${({easings:t})=>t["ease-out-power-2"]}; 1750 animation-fill-mode: both; 1751 animation-delay: var(--apkt-duration-dynamic); 1752 } 1753 1754 @keyframes fade-in { 1755 from { 1756 opacity: 0; 1757 filter: blur(6px); 1758 } 1759 to { 1760 opacity: 1; 1761 filter: blur(0px); 1762 } 1763 } 1764 1765 @keyframes fade-out { 1766 from { 1767 opacity: 1; 1768 filter: blur(0px); 1769 } 1770 to { 1771 opacity: 0; 1772 filter: blur(6px); 1773 } 1774 } 1775`;var MM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
1775a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let ab=class extends tt{constructor(){super(...arguments),this.resizeObserver=void 0,this.unsubscribe=[],this.status="hide",this.view=Pe.state.view}firstUpdated(){this.status=A2.hasFooter()?"show":"hide",this.unsubscribe.push(Pe.subscribeKey("view",e=>{this.view=e,this.status=A2.hasFooter()?"show":"hide",this.status==="hide"&&document.documentElement.style.setProperty("--apkt-footer-height","0px")})),this.resizeObserver=new ResizeObserver(e=>{for(const n of e)if(n.target===this.getWrapper()){const i=`${n.contentRect.height}px`;document.documentElement.style.setProperty("--apkt-footer-height",i)}}),this.resizeObserver.observe(this.getWrapper())}render(){return se` 1776 <div class="container" status=${this.status}>${this.templatePageContainer()}</div> 1777 `}templatePageContainer(){return A2.hasFooter()?se` ${this.templateFooter()}`:null}templateFooter(){switch(this.view){case"Networks":return this.templateNetworksFooter();case"Connect":case"ConnectWallets":case"OnRampFiatSelect":case"OnRampTokenSelect":return se`<w3m-legal-footer></w3m-legal-footer>`;case"OnRampProviders":return se`<w3m-onramp-providers-footer></w3m-onramp-providers-footer>`;default:return null}}templateNetworksFooter(){return se` <wui-flex 1778 class="footer-in" 1779 padding="3" 1780 flexDirection="column" 1781 gap="3" 1782 alignItems="center" 1783 > 1784 <wui-text variant="md-regular" color="secondary" align="center"> 1785 Your connected wallet may not support some of the networks available for this dApp 1786 </wui-text> 1787 <wui-link @click=${this.onNetworkHelp.bind(this)}> 1788 <wui-icon size="sm" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon> 1789 What is a network 1790 </wui-link> 1791 </wui-flex>`}onNetworkHelp(){Et.sendEvent({type:"track",event:"CLICK_NETWORK_HELP"}),Pe.push("WhatIsANetwork")}getWrapper(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("div.container")}};ab.styles=[LFe];MM([Me()],ab.prototype,"status",void 0);MM([Me()],ab.prototype,"view",void 0);ab=MM([Qe("w3m-footer")],ab);const $Fe=It` 1792 :host { 1793 display: block; 1794 width: inherit; 1795 } 1796`;var LM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let cb=class extends tt{constructor(){super(),this.unsubscribe=[],this.viewState=Pe.state.view,this.history=Pe.state.history.join(","),this.unsubscribe.push(Pe.subscribeKey("view",()=>{this.history=Pe.state.history.join(","),document.documentElement.style.setProperty("--apkt-duration-dynamic","var(--apkt-durations-lg)")}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),document.documentElement.style.setProperty("--apkt-duration-dynamic","0s")}render(){return se`${this.templatePageContainer()}`}templatePageContainer(){return se`<w3m-router-container 1797 history=${this.history} 1798 .setView=${()=>{this.viewState=Pe.state.view}} 1799 > 1800 ${this.viewTemplate(this.viewState)} 1801 </w3m-router-container>`}viewTemplate(e){switch(e){case"AccountSettings":return se`<w3m-account-settings-view></w3m-account-settings-view>`;case"Account":return se`<w3m-account-view></w3m-account-view>`;case"AllWallets":return se`<w3m-all-wallets-view></w3m-all-wallets-view>`;case"ApproveTransaction":return se`<w3m-approve-transaction-view></w3m-approve-transaction-view>`;case"BuyInProgress":return se`<w3m-buy-in-progress-view></w3m-buy-in-progress-view>`;case"ChooseAccountName":return se`<w3m-choose-account-name-view></w3m-choose-account-name-view>`;case"Connect":return se`<w3m-connect-view></w3m-connect-view>`;case"Create":return se`<w3m-connect-view walletGuide="explore"></w3m-connect-view>`;case"ConnectingWalletConnect":return se`<w3m-connecting-wc-view></w3m-connecting-wc-view>`;case"ConnectingWalletConnectBasic":return se`<w3m-connecting-wc-basic-view></w3m-connecting-wc-basic-view>`;
1801case"ConnectingExternal":return se`<w3m-connecting-external-view></w3m-connecting-external-view>`;case"ConnectingSiwe":return se`<w3m-connecting-siwe-view></w3m-connecting-siwe-view>`;case"ConnectWallets":return se`<w3m-connect-wallets-view></w3m-connect-wallets-view>`;case"ConnectSocials":return se`<w3m-connect-socials-view></w3m-connect-socials-view>`;case"ConnectingSocial":return se`<w3m-connecting-social-view></w3m-connecting-social-view>`;case"DataCapture":return se`<w3m-data-capture-view></w3m-data-capture-view>`;case"DataCaptureOtpConfirm":return se`<w3m-data-capture-otp-confirm-view></w3m-data-capture-otp-confirm-view>`;case"Downloads":return se`<w3m-downloads-view></w3m-downloads-view>`;case"EmailLogin":return se`<w3m-email-login-view></w3m-email-login-view>`;case"EmailVerifyOtp":return se`<w3m-email-verify-otp-view></w3m-email-verify-otp-view>`;case"EmailVerifyDevice":return se`<w3m-email-verify-device-view></w3m-email-verify-device-view>`;case"GetWallet":return se`<w3m-get-wallet-view></w3m-get-wallet-view>`;case"Networks":return se`<w3m-networks-view></w3m-networks-view>`;case"SwitchNetwork":return se`<w3m-network-switch-view></w3m-network-switch-view>`;case"ProfileWallets":return se`<w3m-profile-wallets-view></w3m-profile-wallets-view>`;case"Transactions":return se`<w3m-transactions-view></w3m-transactions-view>`;case"OnRampProviders":return se`<w3m-onramp-providers-view></w3m-onramp-providers-view>`;case"OnRampTokenSelect":return se`<w3m-onramp-token-select-view></w3m-onramp-token-select-view>`;case"OnRampFiatSelect":return se`<w3m-onramp-fiat-select-view></w3m-onramp-fiat-select-view>`;case"UpgradeEmailWallet":return se`<w3m-upgrade-wallet-view></w3m-upgrade-wallet-view>`;case"UpdateEmailWallet":return se`<w3m-update-email-wallet-view></w3m-update-email-wallet-view>`;case"UpdateEmailPrimaryOtp":return se`<w3m-update-email-primary-otp-view></w3m-update-email-primary-otp-view>`;case"UpdateEmailSecondaryOtp":return se`<w3m-update-email-secondary-otp-view></w3m-update-email-secondary-otp-view>`;case"UnsupportedChain":return se`<w3m-unsupported-chain-view></w3m-unsupported-chain-view>`;case"Swap":return se`<w3m-swap-view></w3m-swap-view>`;case"SwapSelectToken":return se`<w3m-swap-select-token-view></w3m-swap-select-token-view>`;case"SwapPreview":return se`<w3m-swap-preview-view></w3m-swap-preview-view>`;case"WalletSend":return se`<w3m-wallet-send-view></w3m-wallet-send-view>`;case"WalletSendSelectToken":return se`<w3m-wallet-send-select-token-view></w3m-wallet-send-select-token-view>`;case"WalletSendPreview":return se`<w3m-wallet-send-preview-view></w3m-wallet-send-preview-view>`;case"WalletSendConfirmed":return se`<w3m-send-confirmed-view></w3m-send-confirmed-view>`;case"WhatIsABuy":return se`<w3m-what-is-a-buy-view></w3m-what-is-a-buy-view>`;case"WalletReceive":return se`<w3m-wallet-receive-view></w3m-wallet-receive-view>`;case"WalletCompatibleNetworks":return se`<w3m-wallet-compatible-networks-view></w3m-wallet-compatible-networks-view>`;case"WhatIsAWallet":return se`<w3m-what-is-a-wallet-view></w3m-what-is-a-wallet-view>`;case"ConnectingMultiChain":return se`<w3m-connecting-multi-chain-view></w3m-connecting-multi-chain-view>`;case"WhatIsANetwork":return se`<w3m-what-is-a-network-view></w3m-what-is-a-network-view>`;case"ConnectingFarcaster":return se`<w3m-connecting-farcaster-view></w3m-connecting-farcaster-view>`;case"SwitchActiveChain":return se`<w3m-switch-active-chain-view></w3m-switch-active-chain-view>`;case"RegisterAccountName":return se`<w3m-register-account-name-view></w3m-register-account-name-view>`;case"RegisterAccountNameSuccess":return se`<w3m-register-account-name-success-view></w3m-register-account-name-success-view>`;case"SmartSessionCreated":return se`<w3m-smart-session-created-view></w3m-smart-session-created-view>`;case"SmartSessionList":return se`<w3m-smart-session-list-view></w3m-smart-session-list-view>`;case"SIWXSignMessage":return se`<w3m-siwx-sign-message-view></w3m-siwx-sign-message-view>`;case"Pay":return se`<w3m-pay-view></w3m-pay-view>`;case"PayLoading":return se`<w3m-pay-loading-view></w3m-pay-loading-view>`;case"FundWallet":return se`<w3m-fund-wallet-view></w3m-fund-wallet-view>`;case"PayWithExchange":return se`<w3m-deposit-from-exchange-view></w3m-deposit-from-exchange-view>`;case"PayWithExchangeSelectAsset":return se`<w3m-deposit-from-exchange-select-asset-view></w3m-deposit-from-exchange-select-asset-view>`;case"UsageExceeded":return se`<w3m-usage-exceeded-view></w3m-usage-exceeded-view>`;case"SmartAccountSettings":return se`<w3m-smart-account-settings-view></w3m-smart-account-settings-view>`;default:return se`<w3m-connect-view></w3m-connect-view>`}}};cb.styles=[$Fe];LM([Me()],cb.prototype,"viewState",void 0);LM([Me()],cb.prototype,"history",void 0);cb=LM([Qe("w3m-router")],cb);const UFe=It` 1802 button { 1803 background-color: transparent; 1804 padding: ${({spacing:t})=>t[1]}; 1805 } 1806 1807 button:focus-visible { 1808 box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020}; 1809 } 1810 1811 button[data-variant='accent']:hover:enabled, 1812 button[data-variant='accent']:focus-visible { 1813 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 1814 } 1815 1816 button[data-variant='primary']:hover:enabled, 1817 button[data-variant='primary']:focus-visible, 1818 button[data-variant='secondary']:hover:enabled, 1819 button[data-variant='secondary']:focus-visible { 1820 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 1821 } 1822 1823 button[data-size='xs'] > wui-icon { 1824 width: 8px; 1825 height: 8px; 1826 } 1827 1828 button[data-size='sm'] > wui-icon { 1829 width: 12px; 1830 height: 12px; 1831 } 1832 1833 button[data-size='xs'], 1834 button[data-size='sm'] { 1835 border-radius: ${({borderRadius:t})=>t[1]}; 1836 } 1837 1838 button[data-size='md'], 1839 button[data-size='lg'] { 1840 border-radius: ${({borderRadius:t})=>t[2]}; 1841 } 1842 1843 button[data-size='md'] > wui-icon { 1844 width: 16px; 1845 height: 16px; 1846 } 1847 1848 button[data-size='lg'] > wui-icon {
1849 width: 20px; 1850 height: 20px; 1851 } 1852 1853 button:disabled { 1854 background-color: transparent; 1855 cursor: not-allowed; 1856 opacity: 0.5; 1857 } 1858 1859 button:hover:not(:disabled) { 1860 background-color: var(--wui-color-accent-glass-015); 1861 } 1862 1863 button:focus-visible:not(:disabled) { 1864 background-color: var(--wui-color-accent-glass-015); 1865 box-shadow: 1866 inset 0 0 0 1px var(--wui-color-accent-100), 1867 0 0 0 4px var(--wui-color-accent-glass-020); 1868 } 1869`;var Gb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Np=class extends tt{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.icon="copy",this.iconColor="default",this.variant="accent"}render(){const e={accent:"accent-primary",primary:"inverse",secondary:"default"};return se` 1870 <button data-variant=${this.variant} ?disabled=${this.disabled} data-size=${this.size}> 1871 <wui-icon 1872 color=${e[this.variant]||this.iconColor} 1873 size=${this.size} 1874 name=${this.icon} 1875 ></wui-icon> 1876 </button> 1877 `}};Np.styles=[vn,Gi,UFe];Gb([le()],Np.prototype,"size",void 0);Gb([le({type:Boolean})],Np.prototype,"disabled",void 0);Gb([le()],Np.prototype,"icon",void 0);Gb([le()],Np.prototype,"iconColor",void 0);Gb([le()],Np.prototype,"variant",void 0);Np=Gb([Qe("wui-icon-link")],Np);const BFe=It` 1878 :host { 1879 width: 100%; 1880 } 1881 1882 button { 1883 display: flex; 1884 align-items: center; 1885 justify-content: space-between; 1886 padding: ${({spacing:t})=>t[3]}; 1887 width: 100%; 1888 background-color: ${({tokens:t})=>t.theme.backgroundPrimary}; 1889 border-radius: ${({borderRadius:t})=>t[4]}; 1890 transition: 1891 background-color ${({durations:t})=>t.lg} 1892 ${({easings:t})=>t["ease-out-power-2"]}, 1893 scale ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}; 1894 will-change: background-color, scale; 1895 } 1896 1897 wui-text { 1898 text-transform: capitalize; 1899 } 1900 1901 wui-image { 1902 color: ${({tokens:t})=>t.theme.textPrimary}; 1903 } 1904 1905 @media (hover: hover) { 1906 button:hover:enabled { 1907 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 1908 } 1909 } 1910 1911 button:disabled { 1912 opacity: 0.5; 1913 cursor: not-allowed; 1914 } 1915`;var Gd=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Dl=class extends tt{constructor(){super(...arguments),this.imageSrc="google",this.loading=!1,this.disabled=!1,this.rightIcon=!0,this.rounded=!1,this.fullSize=!1}render(){return this.dataset.rounded=this.rounded?"true":"false",se` 1916 <button 1917 ?disabled=${this.loading?!0:!!this.disabled} 1918 data-loading=${this.loading} 1919 tabindex=${xt(this.tabIdx)} 1920 > 1921 <wui-flex gap="2" alignItems="center"> 1922 ${this.templateLeftIcon()} 1923 <wui-flex gap="1"> 1924 <slot></slot> 1925 </wui-flex> 1926 </wui-flex> 1927 ${this.templateRightIcon()} 1928 </button> 1929 `}templateLeftIcon(){return this.icon?se`<wui-image 1930 icon=${this.icon} 1931 iconColor=${xt(this.iconColor)} 1932 ?boxed=${!0} 1933 ?rounded=${this.rounded} 1934 ></wui-image>`:se`<wui-image 1935 ?boxed=${!0} 1936 ?rounded=${this.rounded} 1937 ?fullSize=${this.fullSize} 1938 src=${this.imageSrc} 1939 ></wui-image>`}templateRightIcon(){return this.rightIcon?this.loading?se`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:se`<wui-icon name="chevronRight" size="lg" color="default"></wui-icon>`:null}};Dl.styles=[vn,Gi,BFe];Gd([le()],Dl.prototype,"imageSrc",void 0);Gd([le()],Dl.prototype,"icon",void 0);Gd([le()],Dl.prototype,"iconColor",void 0);Gd([le({type:Boolean})],Dl.prototype,"loading",void 0);Gd([le()],Dl.prototype,"tabIdx",void 0);Gd([le({type:Boolean})],Dl.prototype,"disabled",void 0);Gd([le({type:Boolean})],Dl.prototype,"rightIcon",void 0);Gd([le({type:Boolean})],Dl.prototype,"rounded",void 0);Gd([le({type:Boolean})],Dl.prototype,"fullSize",void 0);
1939Dl=Gd([Qe("wui-list-item")],Dl);const FFe=It` 1940 :host { 1941 width: var(--local-width); 1942 } 1943 1944 button { 1945 width: var(--local-width); 1946 white-space: nowrap; 1947 column-gap: ${({spacing:t})=>t[2]}; 1948 transition: 1949 scale ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-1"]}, 1950 background-color ${({durations:t})=>t.lg} 1951 ${({easings:t})=>t["ease-out-power-2"]}, 1952 border-radius ${({durations:t})=>t.lg} 1953 ${({easings:t})=>t["ease-out-power-1"]}; 1954 will-change: scale, background-color, border-radius; 1955 cursor: pointer; 1956 } 1957 1958 /* -- Sizes --------------------------------------------------- */ 1959 button[data-size='sm'] { 1960 border-radius: ${({borderRadius:t})=>t[2]}; 1961 padding: 0 ${({spacing:t})=>t[2]}; 1962 height: 28px; 1963 } 1964 1965 button[data-size='md'] { 1966 border-radius: ${({borderRadius:t})=>t[3]}; 1967 padding: 0 ${({spacing:t})=>t[4]}; 1968 height: 38px; 1969 } 1970 1971 button[data-size='lg'] { 1972 border-radius: ${({borderRadius:t})=>t[4]}; 1973 padding: 0 ${({spacing:t})=>t[5]}; 1974 height: 48px; 1975 } 1976 1977 /* -- Variants --------------------------------------------------------- */ 1978 button[data-variant='accent-primary'] { 1979 background-color: ${({tokens:t})=>t.core.backgroundAccentPrimary}; 1980 color: ${({tokens:t})=>t.theme.textInvert}; 1981 } 1982 1983 button[data-variant='accent-secondary'] { 1984 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 1985 color: ${({tokens:t})=>t.core.textAccentPrimary}; 1986 } 1987 1988 button[data-variant='neutral-primary'] { 1989 background-color: ${({tokens:t})=>t.theme.backgroundInvert}; 1990 color: ${({tokens:t})=>t.theme.textInvert}; 1991 } 1992 1993 button[data-variant='neutral-secondary'] { 1994 background-color: transparent; 1995 border: 1px solid ${({tokens:t})=>t.theme.borderSecondary}; 1996 color: ${({tokens:t})=>t.theme.textPrimary}; 1997 } 1998 1999 button[data-variant='neutral-tertiary'] { 2000 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 2001 color: ${({tokens:t})=>t.theme.textPrimary}; 2002 } 2003 2004 button[data-variant='error-primary'] { 2005 background-color: ${({tokens:t})=>t.core.textError}; 2006 color: ${({tokens:t})=>t.theme.textInvert}; 2007 } 2008 2009 button[data-variant='error-secondary'] { 2010 background-color: ${({tokens:t})=>t.core.backgroundError}; 2011 color: ${({tokens:t})=>t.core.textError}; 2012 } 2013 2014 button[data-variant='shade'] { 2015 background: var(--wui-color-gray-glass-002); 2016 color: var(--wui-color-fg-200); 2017 border: none; 2018 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); 2019 } 2020 2021 /* -- Focus states --------------------------------------------------- */ 2022 button[data-size='sm']:focus-visible:enabled { 2023 border-radius: 28px; 2024 } 2025 2026 button[data-size='md']:focus-visible:enabled { 2027 border-radius: 38px; 2028 } 2029 2030 button[data-size='lg']:focus-visible:enabled { 2031 border-radius: 48px; 2032 } 2033 button[data-variant='shade']:focus-visible:enabled { 2034 background: var(--wui-color-gray-glass-005); 2035 box-shadow: 2036 inset 0 0 0 1px var(--wui-color-gray-glass-010), 2037 0 0 0 4px var(--wui-color-gray-glass-002); 2038 } 2039 2040 /* -- Hover & Active states ----------------------------------------------------------- */ 2041 @media (hover: hover) { 2042 button[data-size='sm']:hover:enabled { 2043 border-radius: 28px; 2044 } 2045 2046 button[data-size='md']:hover:enabled { 2047 border-radius: 38px; 2048 } 2049 2050 button[data-size='lg']:hover:enabled { 2051 border-radius: 48px; 2052 } 2053 2054 button[data-variant='shade']:hover:enabled { 2055 background: var(--wui-color-gray-glass-002); 2056 } 2057 2058 button[data-variant='shade']:active:enabled { 2059 background: var(--wui-color-gray-glass-005); 2060 } 2061 } 2062 2063 button[data-size='sm']:active:enabled { 2064 border-radius: 28px; 2065 } 2066 2067 button[data-size='md']:active:enabled { 2068 border-radius: 38px; 2069 } 2070 2071 button[data-size='lg']:active:enabled { 2072 border-radius: 48px; 2073 } 2074 2075 /* -- Disabled states --------------------------------------------------- */ 2076 button:disabled { 2077 opacity: 0.3; 2078 } 2079`;var A1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
2079a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const jFe={lg:"lg-regular-mono",md:"md-regular-mono",sm:"sm-regular-mono"},VFe={lg:"md",md:"md",sm:"sm"};let Sf=class extends tt{constructor(){super(...arguments),this.size="lg",this.disabled=!1,this.fullWidth=!1,this.loading=!1,this.variant="accent-primary"}render(){this.style.cssText=` 2080 --local-width: ${this.fullWidth?"100%":"auto"}; 2081 `;const e=this.textVariant??jFe[this.size];return se` 2082 <button data-variant=${this.variant} data-size=${this.size} ?disabled=${this.disabled}> 2083 ${this.loadingTemplate()} 2084 <slot name="iconLeft"></slot> 2085 <wui-text variant=${e} color="inherit"> 2086 <slot></slot> 2087 </wui-text> 2088 <slot name="iconRight"></slot> 2089 </button> 2090 `}loadingTemplate(){if(this.loading){const e=VFe[this.size],n=this.variant==="neutral-primary"||this.variant==="accent-primary"?"invert":"primary";return se`<wui-loading-spinner color=${n} size=${e}></wui-loading-spinner>`}return null}};Sf.styles=[vn,Gi,FFe];A1([le()],Sf.prototype,"size",void 0);A1([le({type:Boolean})],Sf.prototype,"disabled",void 0);A1([le({type:Boolean})],Sf.prototype,"fullWidth",void 0);A1([le({type:Boolean})],Sf.prototype,"loading",void 0);A1([le()],Sf.prototype,"variant",void 0);A1([le()],Sf.prototype,"textVariant",void 0);Sf=A1([Qe("wui-button")],Sf);const WFe=It` 2091 :host { 2092 display: block; 2093 } 2094 2095 button { 2096 width: 100%; 2097 display: flex; 2098 align-items: center; 2099 justify-content: space-between; 2100 gap: ${({spacing:t})=>t[4]}; 2101 padding: ${({spacing:t})=>t[3]}; 2102 border-radius: ${({borderRadius:t})=>t[4]}; 2103 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 2104 } 2105 2106 wui-flex > wui-icon { 2107 padding: ${({spacing:t})=>t[2]}; 2108 color: ${({tokens:t})=>t.theme.textInvert}; 2109 background-color: ${({tokens:t})=>t.core.backgroundAccentPrimary}; 2110 border-radius: ${({borderRadius:t})=>t[2]}; 2111 align-items: center; 2112 } 2113 2114 @media (hover: hover) { 2115 button:hover:enabled { 2116 background-color: ${({tokens:t})=>t.core.foregroundAccent020}; 2117 } 2118 } 2119`;var kS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let lb=class extends tt{constructor(){super(...arguments),this.label="",this.description="",this.icon="wallet"}render(){return se` 2120 <button> 2121 <wui-flex gap="2" alignItems="center"> 2122 <wui-icon weight="fill" size="lg" name=${this.icon} color="inherit"></wui-icon> 2123 <wui-flex flexDirection="column" gap="1"> 2124 <wui-text variant="md-medium" color="primary">${this.label}</wui-text> 2125 <wui-text variant="md-regular" color="tertiary">${this.description}</wui-text> 2126 </wui-flex> 2127 </wui-flex> 2128 <wui-icon size="lg" color="accent-primary" name="chevronRight"></wui-icon> 2129 </button> 2130 `}};lb.styles=[vn,Gi,WFe];kS([le()],lb.prototype,"label",void 0);kS([le()],lb.prototype,"description",void 0);kS([le()],lb.prototype,"icon",void 0);lb=kS([Qe("wui-notice-card")],lb);var ure=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let gI=class extends tt{constructor(){super(),this.unsubscribe=[],this.socialProvider=He.getConnectedSocialProvider(),this.socialUsername=He.getConnectedSocialUsername(),this.namespace=ne.state.activeChain,this.unsubscribe.push(ne.subscribeKey("activeChain",e=>{this.namespace=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=Oe.getConnectorId(this.namespace),n=Oe.getAuthConnector();if(!n||e!==we.CONNECTOR_ID.AUTH)return this.style.cssText="display: none",null;const i=n.provider.getEmail()??"";return!i&&!this.socialUsername?(this.style.cssText="display: none",null):se` 2131 <wui-list-item 2132 ?rounded=${!0} 2133 icon=${this.socialProvider??"mail"} 2134 data-testid="w3m-account-email-update" 2135 ?chevron=${!this.socialProvider} 2136 @click=${()=>{this.onGoToUpdateEmail(i,this.socialProvider)}} 2137 > 2138 <wui-text variant="lg-regular" color="primary">${this.getAuthName(i)}</wui-text> 2139 </wui-list-item> 2140 `}onGoToUpdateEmail(e,n){n||Pe.push("UpdateEmailWallet",{email:e,redirectView:"Account"})}getAuthName(e){return this.socialUsername?this.socialProvider==="discord"&&this.socialUsername.endsWith("0")?this.socialUsername.slice(0,-1):this.socialUsername:e.length>30?`${e.slice(0,-3)}...`:e}};ure([Me()],gI.prototype,"namespace",void 0);gI=ure([Qe("w3m-account-auth-button")],gI);var T1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
2140a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Af=class extends tt{constructor(){var e,n,i;super(),this.usubscribe=[],this.networkImages=vr.state.networkImages,this.address=(e=ne.getAccountData())==null?void 0:e.address,this.profileImage=(n=ne.getAccountData())==null?void 0:n.profileImage,this.profileName=(i=ne.getAccountData())==null?void 0:i.profileName,this.network=ne.state.activeCaipNetwork,this.disconnecting=!1,this.remoteFeatures=ye.state.remoteFeatures,this.usubscribe.push(ne.subscribeChainProp("accountState",s=>{s&&(this.address=s.address,this.profileImage=s.profileImage,this.profileName=s.profileName)}),ne.subscribeKey("activeCaipNetwork",s=>{s!=null&&s.id&&(this.network=s)}),ye.subscribeKey("remoteFeatures",s=>{this.remoteFeatures=s}))}disconnectedCallback(){this.usubscribe.forEach(e=>e())}render(){var n,i,s;if(!this.address)throw new Error("w3m-account-settings-view: No account provided");const e=this.networkImages[((i=(n=this.network)==null?void 0:n.assets)==null?void 0:i.imageId)??""];return se` 2141 <wui-flex 2142 flexDirection="column" 2143 alignItems="center" 2144 gap="4" 2145 .padding=${["0","5","3","5"]} 2146 > 2147 <wui-avatar 2148 alt=${this.address} 2149 address=${this.address} 2150 imageSrc=${xt(this.profileImage)} 2151 size="lg" 2152 ></wui-avatar> 2153 <wui-flex flexDirection="column" alignItems="center"> 2154 <wui-flex gap="1" alignItems="center" justifyContent="center"> 2155 <wui-text variant="h5-medium" color="primary" data-testid="account-settings-address"> 2156 ${ds.getTruncateString({string:this.address,charsStart:4,charsEnd:6,truncate:"middle"})} 2157 </wui-text> 2158 <wui-icon-link 2159 size="md" 2160 icon="copy" 2161 iconColor="default" 2162 @click=${this.onCopyAddress} 2163 ></wui-icon-link> 2164 </wui-flex> 2165 </wui-flex> 2166 </wui-flex> 2167 <wui-flex flexDirection="column" gap="4"> 2168 <wui-flex flexDirection="column" gap="2" .padding=${["6","4","3","4"]}> 2169 ${this.authCardTemplate()} 2170 <w3m-account-auth-button></w3m-account-auth-button> 2171 <wui-list-item 2172 imageSrc=${xt(e)} 2173 ?chevron=${this.isAllowedNetworkSwitch()} 2174 ?fullSize=${!0} 2175 ?rounded=${!0} 2176 @click=${this.onNetworks.bind(this)} 2177 data-testid="account-switch-network-button" 2178 > 2179 <wui-text variant="lg-regular" color="primary"> 2180 ${((s=this.network)==null?void 0:s.name)??"Unknown"} 2181 </wui-text> 2182 </wui-list-item> 2183 ${this.smartAccountSettingsTemplate()} ${this.chooseNameButtonTemplate()} 2184 <wui-list-item 2185 ?rounded=${!0} 2186 icon="power" 2187 iconColor="error" 2188 ?chevron=${!1} 2189 .loading=${this.disconnecting} 2190 @click=${this.onDisconnect.bind(this)} 2191 data-testid="disconnect-button" 2192 > 2193 <wui-text variant="lg-regular" color="primary">Disconnect</wui-text> 2194 </wui-list-item> 2195 </wui-flex> 2196 </wui-flex> 2197 `}chooseNameButtonTemplate(){var r;const e=(r=this.network)==null?void 0:r.chainNamespace,n=Oe.getConnectorId(e),i=Oe.getAuthConnector();return!ne.checkIfNamesSupported()||!i||n!==we.CONNECTOR_ID.AUTH||this.profileName?null:se` 2198 <wui-list-item 2199 icon="id" 2200 ?rounded=${!0} 2201 ?chevron=${!0} 2202 @click=${this.onChooseName.bind(this)} 2203 data-testid="account-choose-name-button" 2204 > 2205 <wui-text variant="lg-regular" color="primary">Choose account name </wui-text> 2206 </wui-list-item> 2207 `}authCardTemplate(){var s;const e=Oe.getConnectorId((s=this.network)==null?void 0:s.chainNamespace),n=Oe.getAuthConnector(),{origin:i}=location;return!n||e!==we.CONNECTOR_ID.AUTH||i.includes(fn.SECURE_SITE)?null:se` 2208 <wui-notice-card 2209 @click=${this.onGoToUpgradeView.bind(this)} 2210 label="Upgrade your wallet" 2211 description="Transition to a self-custodial wallet" 2212 icon="wallet" 2213 data-testid="w3m-wallet-upgrade-card" 2214 ></wui-notice-card> 2215 `}isAllowedNetworkSwitch(){const e=ne.getAllRequestedCaipNetworks(),n=e?e.length>1:!1,i=e==null?void 0:e.find(({id:s})=>{var r;return s===((r=this.network)==null?void 0:r.id)});return n||!i}onCopyAddress(){try{this.address&&(Ue.copyToClopboard(this.address),ti.showSuccess("Address copied"))}catch{ti.showError("Failed to copy")}}smartAccountSettingsTemplate(){var r;const e=(r=this.network)==null?void 0:r.chainNamespace,n=ne.checkIfSmartAccountEnabled(),i=Oe.getConnectorId(e);return!Oe.getAuthConnector()||i!==we.CONNECTOR_ID.AUTH||!n?null:se` 2216 <wui-list-item 2217 icon="user" 2218 ?rounded=${!0} 2219 ?chevron=${!0} 2220 @click=${this.onSmartAccountSettings.bind(this)} 2221 data-testid="account-smart-account-settings-button" 2222 > 2223 <wui-text variant="lg-regular" color="primary">Smart Account Settings</wui-text> 2224 </wui-list-item> 2225 `}onChooseName(){Pe.push("ChooseAccountName")}onNetworks(){this.isAllowedNetworkSwitch()&&Pe.push("Networks")}async onDisconnect(){var e,n;try{this.disconnecting=!0;const i=(e=this.network)==null?void 0:e.chainNamespace,r=Ve.getConnections(i).length>0,o=i&&Oe.state.activeConnectorIds[i],a=(n=this.remoteFeatures)==null?void 0:n.multiWallet;await Ve.disconnect(a?{id:o,namespace:i}:{}),r&&a&&(Pe.push("ProfileWallets"),ti.showSuccess("Wallet deleted"))}catch{Et.sendEvent({type:"track",event:"DISCONNECT_ERROR",properties:{message:"Failed to disconnect"}}),ti.showError("Failed to disconnect")}finally{this.disconnecting=!1}}onGoToUpgradeView(){Et.sendEvent({type:"track",event:"EMAIL_UPGRADE_FROM_MODAL"}),Pe.push("UpgradeEmailWallet")}onSmartAccountSettings(){Pe.push("SmartAccountSettings")}};T1([Me()],Af.prototype,"address",void 0);T1([Me()],Af.prototype,"profileImage",void 0);T1([Me()],Af.prototype,"profileName",void 0);T1([Me()],Af.prototype,"network",void 0);T1([Me()],Af.prototype,"disconnecting",void 0);T1([Me()],Af.prototype,"remoteFeatures",void 0);Af=T1([Qe("w3m-account-settings-view")],Af);const qFe=It` 2226 :host { 2227 flex: 1; 2228 height: 100%; 2229 } 2230 2231 button { 2232 width: 100%; 2233 height: 100%; 2234 display: inline-flex; 2235 align-items: center; 2236 padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]}; 2237 column-gap: ${({spacing:t})=>t[1]}; 2238 color: ${({tokens:t})=>t.theme.textSecondary}; 2239 border-radius: ${({borderRadius:t})=>t[20]}; 2240 background-color: transparent; 2241 transition: background-color ${({durations:t})=>t.lg} 2242 ${({easings:t})=>t["ease-out-power-2"]}; 2243 will-change: background-color; 2244 } 2245 2246 /* -- Hover & Active states ----------------------------------------------------------- */ 2247 button[data-active='true'] { 2248 color: ${({tokens:t})=>t.theme.textPrimary}; 2249 background-color: ${({tokens:t})=>t.theme.foregroundTertiary}; 2250 } 2251 2252 button:hover:enabled:not([data-active='true']), 2253 button:active:enabled:not([data-active='true']) { 2254 wui-text, 2255 wui-icon { 2256 color: ${({tokens:t})=>t.theme.textPrimary}; 2257 } 2258 } 2259`;var Z6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
2259a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const zFe={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},HFe={lg:"md",md:"sm",sm:"sm"};let qg=class extends tt{constructor(){super(...arguments),this.icon="mobile",this.size="md",this.label="",this.active=!1}render(){return se` 2260 <button data-active=${this.active}> 2261 ${this.icon?se`<wui-icon size=${HFe[this.size]} name=${this.icon}></wui-icon>`:""} 2262 <wui-text variant=${zFe[this.size]}> ${this.label} </wui-text> 2263 </button> 2264 `}};qg.styles=[vn,Gi,qFe];Z6([le()],qg.prototype,"icon",void 0);Z6([le()],qg.prototype,"size",void 0);Z6([le()],qg.prototype,"label",void 0);Z6([le({type:Boolean})],qg.prototype,"active",void 0);qg=Z6([Qe("wui-tab-item")],qg);const GFe=It` 2265 :host { 2266 display: inline-flex; 2267 align-items: center; 2268 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 2269 border-radius: ${({borderRadius:t})=>t[32]}; 2270 padding: ${({spacing:t})=>t["01"]}; 2271 box-sizing: border-box; 2272 } 2273 2274 :host([data-size='sm']) { 2275 height: 26px; 2276 } 2277 2278 :host([data-size='md']) { 2279 height: 36px; 2280 } 2281`;var Q6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let zg=class extends tt{constructor(){super(...arguments),this.tabs=[],this.onTabChange=()=>null,this.size="md",this.activeTab=0}render(){return this.dataset.size=this.size,this.tabs.map((e,n)=>{var s;const i=n===this.activeTab;return se` 2282 <wui-tab-item 2283 @click=${()=>this.onTabClick(n)} 2284 icon=${e.icon} 2285 size=${this.size} 2286 label=${e.label} 2287 ?active=${i} 2288 data-active=${i} 2289 data-testid="tab-${(s=e.label)==null?void 0:s.toLowerCase()}" 2290 ></wui-tab-item> 2291 `})}onTabClick(e){this.activeTab=e,this.onTabChange(e)}};zg.styles=[vn,Gi,GFe];Q6([le({type:Array})],zg.prototype,"tabs",void 0);Q6([le()],zg.prototype,"onTabChange",void 0);Q6([le()],zg.prototype,"size",void 0);Q6([Me()],zg.prototype,"activeTab",void 0);zg=Q6([Qe("wui-tabs")],zg);const KFe=It` 2292 :host { 2293 display: flex; 2294 justify-content: center; 2295 align-items: center; 2296 gap: ${({spacing:t})=>t[1]}; 2297 text-transform: uppercase; 2298 white-space: nowrap; 2299 } 2300 2301 :host([data-variant='accent']) { 2302 background-color: ${({tokens:t})=>t.core.foregroundAccent010}; 2303 color: ${({tokens:t})=>t.core.textAccentPrimary}; 2304 } 2305 2306 :host([data-variant='info']) { 2307 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 2308 color: ${({tokens:t})=>t.theme.textSecondary}; 2309 } 2310 2311 :host([data-variant='success']) { 2312 background-color: ${({tokens:t})=>t.core.backgroundSuccess}; 2313 color: ${({tokens:t})=>t.core.textSuccess}; 2314 } 2315 2316 :host([data-variant='warning']) { 2317 background-color: ${({tokens:t})=>t.core.backgroundWarning}; 2318 color: ${({tokens:t})=>t.core.textWarning}; 2319 } 2320 2321 :host([data-variant='error']) { 2322 background-color: ${({tokens:t})=>t.core.backgroundError}; 2323 color: ${({tokens:t})=>t.core.textError}; 2324 } 2325 2326 :host([data-variant='certified']) { 2327 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 2328 color: ${({tokens:t})=>t.theme.textSecondary}; 2329 } 2330 2331 :host([data-size='md']) { 2332 height: 30px; 2333 padding: 0 ${({spacing:t})=>t[2]}; 2334 border-radius: ${({borderRadius:t})=>t[2]}; 2335 } 2336 2337 :host([data-size='sm']) { 2338 height: 20px; 2339 padding: 0 ${({spacing:t})=>t[1]}; 2340 border-radius: ${({borderRadius:t})=>t[1]}; 2341 } 2342`;var NS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let ub=class extends tt{constructor(){super(...arguments),this.variant="accent",this.size="md",this.icon=void 0}render(){this.dataset.variant=this.variant,this.dataset.size=this.size;const e=this.size==="md"?"md-medium":"sm-medium",n=this.size==="md"?"md":"sm";return se` 2343 ${this.icon?se`<wui-icon size=${n} name=${this.icon}></wui-icon>`:null} 2344 <wui-text 2345 display="inline" 2346 data-variant=${this.variant} 2347 variant=${e} 2348 color="inherit" 2349 > 2350 <slot></slot> 2351 </wui-text> 2352 `}};ub.styles=[vn,KFe];NS([le()],ub.prototype,"variant",void 0);NS([le()],ub.prototype,"size",void 0);NS([le()],ub.prototype,"icon",void 0);ub=NS([Qe("wui-tag")],ub);const YFe=It` 2353 button { 2354 display: flex; 2355 align-items: center; 2356 height: 40px; 2357 padding: ${({spacing:t})=>t[2]}; 2358 border-radius: ${({borderRadius:t})=>t[4]}; 2359 column-gap: ${({spacing:t})=>t[1]}; 2360 background-color: transparent; 2361 transition: background-color ${({durations:t})=>t.lg} 2362 ${({easings:t})=>t["ease-out-power-2"]}; 2363 will-change: background-color; 2364 } 2365 2366 wui-image, 2367 .icon-box { 2368 width: ${({spacing:t})=>t[6]}; 2369 height: ${({spacing:t})=>t[6]}; 2370 border-radius: ${({borderRadius:t})=>t[4]}; 2371 } 2372 2373 wui-text { 2374 flex: 1; 2375 } 2376 2377 .icon-box { 2378 position: relative; 2379 } 2380 2381 .icon-box[data-active='true'] { 2382 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 2383 } 2384 2385 .circle { 2386 position: absolute; 2387 left: 16px; 2388 top: 15px; 2389 width: 8px; 2390 height: 8px; 2391 background-color: ${({tokens:t})=>t.core.textSuccess}; 2392 box-shadow: 0 0 0 2px ${({tokens:t})=>t.theme.foregroundPrimary}; 2393 border-radius: 50%; 2394 } 2395 2396 /* -- Hover & Active states ----------------------------------------------------------- */ 2397 @media (hover: hover) { 2398 button:hover:enabled, 2399 button:active:enabled { 2400 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 2401 } 2402 } 2403`;var Kd=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
2403a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Ol=class extends tt{constructor(){super(...arguments),this.address="",this.profileName="",this.alt="",this.imageSrc="",this.icon=void 0,this.iconSize="md",this.loading=!1,this.charsStart=4,this.charsEnd=6}render(){return se` 2404 <button> 2405 ${this.leftImageTemplate()} ${this.textTemplate()} ${this.rightImageTemplate()} 2406 </button> 2407 `}leftImageTemplate(){const e=this.icon?se`<wui-icon 2408 size=${xt(this.iconSize)} 2409 color="default" 2410 name=${this.icon} 2411 class="icon" 2412 ></wui-icon>`:se`<wui-image src=${this.imageSrc} alt=${this.alt}></wui-image>`;return se` 2413 <wui-flex 2414 alignItems="center" 2415 justifyContent="center" 2416 class="icon-box" 2417 data-active=${!!this.icon} 2418 > 2419 ${e} 2420 <wui-flex class="circle"></wui-flex> 2421 </wui-flex> 2422 `}textTemplate(){return se` 2423 <wui-text variant="lg-regular" color="primary"> 2424 ${ds.getTruncateString({string:this.profileName||this.address,charsStart:this.profileName?16:this.charsStart,charsEnd:this.profileName?0:this.charsEnd,truncate:this.profileName?"end":"middle"})} 2425 </wui-text> 2426 `}rightImageTemplate(){return se`<wui-icon name="chevronBottom" size="sm" color="default"></wui-icon>`}};Ol.styles=[vn,Gi,YFe];Kd([le()],Ol.prototype,"address",void 0);Kd([le()],Ol.prototype,"profileName",void 0);Kd([le()],Ol.prototype,"alt",void 0);Kd([le()],Ol.prototype,"imageSrc",void 0);Kd([le()],Ol.prototype,"icon",void 0);Kd([le()],Ol.prototype,"iconSize",void 0);Kd([le({type:Boolean})],Ol.prototype,"loading",void 0);Kd([le({type:Number})],Ol.prototype,"charsStart",void 0);Kd([le({type:Number})],Ol.prototype,"charsEnd",void 0);Ol=Kd([Qe("wui-wallet-switch")],Ol);const ZFe=It` 2427 wui-icon-link { 2428 margin-right: calc(${({spacing:t})=>t[8]} * -1); 2429 } 2430 2431 wui-notice-card { 2432 margin-bottom: ${({spacing:t})=>t[1]}; 2433 } 2434 2435 wui-list-item > wui-text { 2436 flex: 1; 2437 } 2438 2439 w3m-transactions-view { 2440 max-height: 200px; 2441 } 2442 2443 .balance-container { 2444 display: inline; 2445 } 2446 2447 .tab-content-container { 2448 height: 300px; 2449 overflow-y: auto; 2450 overflow-x: hidden; 2451 scrollbar-width: none; 2452 } 2453 2454 .symbol { 2455 transform: translateY(-2px); 2456 } 2457 2458 .tab-content-container::-webkit-scrollbar {
2459 display: none; 2460 } 2461 2462 .account-button { 2463 width: auto; 2464 border: none; 2465 display: flex; 2466 align-items: center; 2467 justify-content: center; 2468 gap: ${({spacing:t})=>t[3]}; 2469 height: 48px; 2470 padding: ${({spacing:t})=>t[2]}; 2471 padding-right: ${({spacing:t})=>t[3]}; 2472 box-shadow: inset 0 0 0 1px ${({tokens:t})=>t.theme.foregroundPrimary}; 2473 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 2474 border-radius: ${({borderRadius:t})=>t[6]}; 2475 transition: background-color ${({durations:t})=>t.lg} 2476 ${({easings:t})=>t["ease-out-power-2"]}; 2477 } 2478 2479 .account-button:hover { 2480 background-color: ${({tokens:t})=>t.core.glass010}; 2481 } 2482 2483 .avatar-container { 2484 position: relative; 2485 } 2486 2487 wui-avatar.avatar { 2488 width: 32px; 2489 height: 32px; 2490 box-shadow: 0 0 0 2px ${({tokens:t})=>t.core.glass010}; 2491 } 2492 2493 wui-wallet-switch { 2494 margin-top: ${({spacing:t})=>t[2]}; 2495 } 2496 2497 wui-avatar.network-avatar { 2498 width: 16px; 2499 height: 16px; 2500 position: absolute; 2501 left: 100%; 2502 top: 100%; 2503 transform: translate(-75%, -75%); 2504 box-shadow: 0 0 0 2px ${({tokens:t})=>t.core.glass010}; 2505 } 2506 2507 .account-links { 2508 display: flex; 2509 justify-content: space-between; 2510 align-items: center; 2511 } 2512 2513 .account-links wui-flex { 2514 cursor: pointer; 2515 display: flex; 2516 align-items: center; 2517 justify-content: center; 2518 flex: 1; 2519 background: red; 2520 align-items: center; 2521 justify-content: center; 2522 height: 48px; 2523 padding: 10px; 2524 flex: 1 0 0; 2525 border-radius: var(--XS, 16px); 2526 border: 1px solid var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1)); 2527 background: var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1)); 2528 transition: 2529 background-color ${({durations:t})=>t.md} 2530 ${({easings:t})=>t["ease-out-power-1"]}, 2531 opacity ${({durations:t})=>t.md} ${({easings:t})=>t["ease-out-power-1"]}; 2532 will-change: background-color, opacity; 2533 } 2534 2535 .account-links wui-flex:hover { 2536 background: var(--dark-accent-glass-015, rgba(71, 161, 255, 0.15)); 2537 } 2538 2539 .account-links wui-flex wui-icon { 2540 width: var(--S, 20px); 2541 height: var(--S, 20px); 2542 } 2543 2544 .account-links wui-flex wui-icon svg path { 2545 stroke: #667dff; 2546 } 2547`;var Fl=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let ec=class extends tt{constructor(){var e,n,i,s,r,o;super(),this.unsubscribe=[],this.caipAddress=(e=ne.getAccountData())==null?void 0:e.caipAddress,this.address=Ue.getPlainAddress((n=ne.getAccountData())==null?void 0:n.caipAddress),this.profileImage=(i=ne.getAccountData())==null?void 0:i.profileImage,this.profileName=(s=ne.getAccountData())==null?void 0:s.profileName,this.disconnecting=!1,this.balance=(r=ne.getAccountData())==null?void 0:r.balance,this.balanceSymbol=(o=ne.getAccountData())==null?void 0:o.balanceSymbol,this.features=ye.state.features,this.remoteFeatures=ye.state.remoteFeatures,this.namespace=ne.state.activeChain,this.activeConnectorIds=Oe.state.activeConnectorIds,this.unsubscribe.push(ne.subscribeChainProp("accountState",a=>{this.address=Ue.getPlainAddress(a==null?void 0:a.caipAddress),this.caipAddress=a==null?void 0:a.caipAddress,this.balance=a==null?void 0:a.balance,this.balanceSymbol=a==null?void 0:a.balanceSymbol,this.profileName=a==null?void 0:a.profileName,this.profileImage=a==null?void 0:a.profileImage}),ye.subscribeKey("features",a=>this.features=a),ye.subscribeKey("remoteFeatures",a=>this.remoteFeatures=a),Oe.subscribeKey("activeConnectorIds",a=>{this.activeConnectorIds=a}),ne.subscribeKey("activeChain",a=>this.namespace=a),ne.subscribeKey("activeCaipNetwork",a=>{a!=null&&a.chainNamespace&&(this.namespace=a==null?void 0:a.chainNamespace)}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!this.caipAddress||!this.namespace)return null;const e=this.activeConnectorIds[this.namespace],n=e?Oe.getConnectorById(e):void 0,i=qi.getConnectorImage(n),{value:s,decimals:r,symbol:o}=Ue.parseBalance(this.balance,this.balanceSymbol);return se`<wui-flex 2548 flexDirection="column" 2549 .padding=${["0","5","4","5"]} 2550 alignItems="center" 2551 gap="3" 2552 > 2553 <wui-avatar 2554 alt=${xt(this.caipAddress)} 2555 address=${xt(Ue.getPlainAddress(this.caipAddress))} 2556 imageSrc=${xt(this.profileImage===null?void 0:this.profileImage)} 2557 data-testid="single-account-avatar" 2558 ></wui-avatar> 2559 <wui-wallet-switch 2560 profileName=${this.profileName} 2561 address=${this.address} 2562 imageSrc=${i} 2563 alt=${n==null?void 0:n.name} 2564 @click=${this.onGoToProfileWalletsView.bind(this)} 2565 data-testid="wui-wallet-switch" 2566 ></wui-wallet-switch> 2567 <div class="balance-container"> 2568 <wui-text variant="h3-regular" color="primary">${s}</wui-text> 2569 <wui-text variant="h3-regular" color="secondary">.${r}</wui-text> 2570 <wui-text variant="h6-medium" color="primary" class="symbol">${o}</wui-text> 2571 </div> 2572 ${this.explorerBtnTemplate()} 2573 </wui-flex> 2574 2575 <wui-flex flexDirection="column" gap="2" .padding=${["0","3","3","3"]}> 2576 ${this.authCardTemplate()} <w3m-account-auth-button></w3m-account-auth-button> 2577 ${this.orderedFeaturesTemplate()} ${this.activityTemplate()} 2578 <wui-list-item 2579 .rounded=${!0} 2580 icon="power" 2581 iconColor="error" 2582 ?chevron=${!1} 2583 .loading=${this.disconnecting} 2584 .rightIcon=${!1} 2585 @click=${this.onDisconnect.bind(this)} 2586 data-testid="disconnect-button" 2587 > 2588 <wui-text variant="lg-regular" color="primary">Disconnect</wui-text> 2589 </wui-list-item> 2590 </wui-flex>`}fundWalletTemplate(){var r,o;
2590if(!this.namespace)return null;const e=fn.ONRAMP_SUPPORTED_CHAIN_NAMESPACES.includes(this.namespace),n=!!((r=this.features)!=null&&r.receive),i=((o=this.remoteFeatures)==null?void 0:o.onramp)&&e,s=Ir.isPayWithExchangeEnabled();return!i&&!n&&!s?null:se` 2591 <wui-list-item 2592 .rounded=${!0} 2593 data-testid="w3m-account-default-fund-wallet-button" 2594 iconVariant="blue" 2595 icon="dollar" 2596 ?chevron=${!0} 2597 @click=${this.handleClickFundWallet.bind(this)} 2598 > 2599 <wui-text variant="lg-regular" color="primary">Fund wallet</wui-text> 2600 </wui-list-item> 2601 `}orderedFeaturesTemplate(){var n;return(((n=this.features)==null?void 0:n.walletFeaturesOrder)||fn.DEFAULT_FEATURES.walletFeaturesOrder).map(i=>{switch(i){case"onramp":return this.fundWalletTemplate();case"swaps":return this.swapsTemplate();case"send":return this.sendTemplate();default:return null}})}activityTemplate(){var n;return this.namespace&&((n=this.remoteFeatures)==null?void 0:n.activity)&&fn.ACTIVITY_ENABLED_CHAIN_NAMESPACES.includes(this.namespace)?se` <wui-list-item 2602 .rounded=${!0} 2603 icon="clock" 2604 ?chevron=${!0} 2605 @click=${this.onTransactions.bind(this)} 2606 data-testid="w3m-account-default-activity-button" 2607 > 2608 <wui-text variant="lg-regular" color="primary">Activity</wui-text> 2609 </wui-list-item>`:null}swapsTemplate(){var i;const e=(i=this.remoteFeatures)==null?void 0:i.swaps,n=ne.state.activeChain===we.CHAIN.EVM;return!e||!n?null:se` 2610 <wui-list-item 2611 .rounded=${!0} 2612 icon="recycleHorizontal" 2613 ?chevron=${!0} 2614 @click=${this.handleClickSwap.bind(this)} 2615 data-testid="w3m-account-default-swaps-button" 2616 > 2617 <wui-text variant="lg-regular" color="primary">Swap</wui-text> 2618 </wui-list-item> 2619 `}sendTemplate(){var s;const e=(s=this.features)==null?void 0:s.send,n=ne.state.activeChain;if(!n)throw new Error("SendController:sendTemplate - namespace is required");const i=fn.SEND_SUPPORTED_NAMESPACES.includes(n);return!e||!i?null:se` 2620 <wui-list-item 2621 .rounded=${!0} 2622 icon="send" 2623 ?chevron=${!0} 2624 @click=${this.handleClickSend.bind(this)} 2625 data-testid="w3m-account-default-send-button" 2626 > 2627 <wui-text variant="lg-regular" color="primary">Send</wui-text> 2628 </wui-list-item> 2629 `}authCardTemplate(){const e=ne.state.activeChain;if(!e)throw new Error("AuthCardTemplate:authCardTemplate - namespace is required");const n=Oe.getConnectorId(e),i=Oe.getAuthConnector(),{origin:s}=location;return!i||n!==we.CONNECTOR_ID.AUTH||s.includes(fn.SECURE_SITE)?null:se` 2630 <wui-notice-card 2631 @click=${this.onGoToUpgradeView.bind(this)} 2632 label="Upgrade your wallet" 2633 description="Transition to a self-custodial wallet" 2634 icon="wallet" 2635 data-testid="w3m-wallet-upgrade-card" 2636 ></wui-notice-card> 2637 `}handleClickFundWallet(){Pe.push("FundWallet")}handleClickSwap(){Pe.push("Swap")}handleClickSend(){Pe.push("WalletSend")}explorerBtnTemplate(){var n;return((n=ne.getAccountData())==null?void 0:n.addressExplorerUrl)?se` 2638 <wui-button size="md" variant="accent-primary" @click=${this.onExplorer.bind(this)}> 2639 <wui-icon size="sm" color="inherit" slot="iconLeft" name="compass"></wui-icon> 2640 Block Explorer 2641 <wui-icon size="sm" color="inherit" slot="iconRight" name="externalLink"></wui-icon> 2642 </wui-button> 2643 `:null}onTransactions(){Et.sendEvent({type:"track",event:"CLICK_TRANSACTIONS",properties:{isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}}),Pe.push("Transactions")}async onDisconnect(){var e;try{this.disconnecting=!0;const i=Ve.getConnections(this.namespace).length>0,s=this.namespace&&Oe.state.activeConnectorIds[this.namespace],r=(e=this.remoteFeatures)==null?void 0:e.multiWallet;await Ve.disconnect(r?{id:s,namespace:this.namespace}:{}),i&&r&&(Pe.push("ProfileWallets"),ti.showSuccess("Wallet deleted"))}catch{Et.sendEvent({type:"track",event:"DISCONNECT_ERROR",properties:{message:"Failed to disconnect"}}),ti.showError("Failed to disconnect")}finally{this.disconnecting=!1}}onExplorer(){var n;const e=(n=ne.getAccountData())==null?void 0:n.addressExplorerUrl;e&&Ue.openHref(e,"_blank")}onGoToUpgradeView(){Et.sendEvent({type:"track",event:"EMAIL_UPGRADE_FROM_MODAL"}),Pe.push("UpgradeEmailWallet")}onGoToProfileWalletsView(){Pe.push("ProfileWallets")}};ec.styles=ZFe;Fl([Me()],ec.prototype,"caipAddress",void 0);Fl([Me()],ec.prototype,"address",void 0);Fl([Me()],ec.prototype,"profileImage",void 0);Fl([Me()],ec.prototype,"profileName",void 0);Fl([Me()],ec.prototype,"disconnecting",void 0);Fl([Me()],ec.prototype,"balance",void 0);Fl([Me()],ec.prototype,"balanceSymbol",void 0);Fl([Me()],ec.prototype,"features",void 0);Fl([Me()],ec.prototype,"remoteFeatures",void 0);Fl([Me()],ec.prototype,"namespace",void 0);Fl([Me()],ec.prototype,"activeConnectorIds",void 0);ec=Fl([Qe("w3m-account-default-widget")],ec);const QFe=It` 2644 span { 2645 font-weight: 500; 2646 font-size: 38px; 2647 color: ${({tokens:t})=>t.theme.textPrimary}; 2648 line-height: 38px; 2649 letter-spacing: -2%; 2650 text-align: center; 2651 font-family: var(--apkt-fontFamily-regular); 2652 } 2653 2654 .pennies { 2655 color: ${({tokens:t})=>t.theme.textSecondary}; 2656 } 2657`;var $M=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
2657a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let I5=class extends tt{constructor(){super(...arguments),this.dollars="0",this.pennies="00"}render(){return se`<span>$${this.dollars}<span class="pennies">.${this.pennies}</span></span>`}};I5.styles=[vn,QFe];$M([le()],I5.prototype,"dollars",void 0);$M([le()],I5.prototype,"pennies",void 0);I5=$M([Qe("wui-balance")],I5);const XFe=It` 2658 :host { 2659 display: inline-flex; 2660 justify-content: center; 2661 align-items: center; 2662 position: relative; 2663 } 2664 2665 wui-icon { 2666 position: absolute; 2667 width: 12px !important; 2668 height: 4px !important; 2669 } 2670 2671 /* -- Variants --------------------------------------------------------- */ 2672 :host([data-variant='fill']) { 2673 background-color: ${({colors:t})=>t.neutrals100}; 2674 } 2675 2676 :host([data-variant='shade']) { 2677 background-color: ${({colors:t})=>t.neutrals900}; 2678 } 2679 2680 :host([data-variant='fill']) > wui-text { 2681 color: ${({colors:t})=>t.black}; 2682 } 2683 2684 :host([data-variant='shade']) > wui-text { 2685 color: ${({colors:t})=>t.white}; 2686 } 2687 2688 :host([data-variant='fill']) > wui-icon { 2689 color: ${({colors:t})=>t.neutrals100}; 2690 } 2691 2692 :host([data-variant='shade']) > wui-icon { 2693 color: ${({colors:t})=>t.neutrals900}; 2694 } 2695 2696 /* -- Sizes --------------------------------------------------------- */ 2697 :host([data-size='sm']) { 2698 padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]}; 2699 border-radius: ${({borderRadius:t})=>t[2]}; 2700 } 2701 2702 :host([data-size='md']) { 2703 padding: ${({spacing:t})=>t[2]} ${({spacing:t})=>t[3]}; 2704 border-radius: ${({borderRadius:t})=>t[3]}; 2705 } 2706 2707 /* -- Placements --------------------------------------------------------- */ 2708 wui-icon[data-placement='top'] { 2709 bottom: 0px; 2710 left: 50%; 2711 transform: translate(-50%, 95%); 2712 } 2713 2714 wui-icon[data-placement='bottom'] { 2715 top: 0; 2716 left: 50%; 2717 transform: translate(-50%, -95%) rotate(180deg); 2718 } 2719 2720 wui-icon[data-placement='right'] { 2721 top: 50%; 2722 left: 0; 2723 transform: translate(-65%, -50%) rotate(90deg); 2724 } 2725 2726 wui-icon[data-placement='left'] { 2727 top: 50%; 2728 right: 0%; 2729 transform: translate(65%, -50%) rotate(270deg); 2730 } 2731`;var X6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const JFe={sm:"sm-regular",md:"md-regular"};let Hg=class extends tt{constructor(){super(...arguments),this.placement="top",this.variant="fill",this.size="md",this.message=""}render(){return this.dataset.variant=this.variant,this.dataset.size=this.size,se`<wui-icon data-placement=${this.placement} size="inherit" name="cursor"></wui-icon> 2732 <wui-text variant=${JFe[this.size]}>${this.message}</wui-text>`}};Hg.styles=[vn,Gi,XFe];X6([le()],Hg.prototype,"placement",void 0);X6([le()],Hg.prototype,"variant",void 0);X6([le()],Hg.prototype,"size",void 0);X6([le()],Hg.prototype,"message",void 0);Hg=X6([Qe("wui-tooltip")],Hg);var yI;(function(t){t.approve="approved",t.bought="bought",t.borrow="borrowed",t.burn="burnt",t.cancel="canceled",t.claim="claimed",t.deploy="deployed",t.deposit="deposited",t.execute="executed",t.mint="minted",t.receive="received",t.repay="repaid",t.send="sent",t.sell="sold",t.stake="staked",t.trade="swapped",t.unstake="unstaked",t.withdraw="withdrawn"})(yI||(yI={}));const eje=It` 2733 :host > wui-flex { 2734 display: flex; 2735 justify-content: center; 2736 align-items: center; 2737 position: relative; 2738 width: 40px; 2739 height: 40px; 2740 box-shadow: inset 0 0 0 1px ${({tokens:t})=>t.core.glass010}; 2741 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 2742 } 2743 2744 :host([data-no-images='true']) > wui-flex { 2745 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 2746 border-radius: ${({borderRadius:t})=>t[3]} !important; 2747 } 2748 2749 :host > wui-flex wui-image { 2750 display: block; 2751 } 2752 2753 :host > wui-flex, 2754 :host > wui-flex wui-image, 2755 .swap-images-container, 2756 .swap-images-container.nft, 2757 wui-image.nft { 2758 border-top-left-radius: var(--local-left-border-radius); 2759 border-top-right-radius: var(--local-right-border-radius); 2760 border-bottom-left-radius: var(--local-left-border-radius); 2761 border-bottom-right-radius: var(--local-right-border-radius); 2762 } 2763 2764 .swap-images-container { 2765 position: relative; 2766 width: 40px; 2767 height: 40px; 2768 overflow: hidden; 2769 } 2770 2771 .swap-images-container wui-image:first-child { 2772 position: absolute; 2773 width: 40px; 2774 height: 40px; 2775 top: 0; 2776 left: 0%; 2777 clip-path: inset(0px calc(50% + 2px) 0px 0%); 2778 } 2779 2780 .swap-images-container wui-image:last-child { 2781 clip-path: inset(0px 0px 0px calc(50% + 2px)); 2782 } 2783 2784 .swap-fallback-container { 2785 position: absolute; 2786 inset: 0; 2787 width: 40px; 2788 height: 40px; 2789 display: flex; 2790 align-items: center; 2791 justify-content: center; 2792 } 2793 2794 .swap-fallback-container.first { 2795 clip-path: inset(0px calc(50% + 2px) 0px 0%); 2796 } 2797 2798 .swap-fallback-container.last { 2799 clip-path: inset(0px 0px 0px calc(50% + 2px)); 2800 } 2801 2802 wui-flex.status-box { 2803 position: absolute; 2804 right: 0; 2805 bottom: 0; 2806 transform: translate(20%, 20%); 2807 border-radius: ${({borderRadius:t})=>t[4]}; 2808 background-color: ${({tokens:t})=>t.theme.backgroundPrimary}; 2809 box-shadow: 0 0 0 2px ${({tokens:t})=>t.theme.backgroundPrimary}; 2810 overflow: hidden; 2811 width: 16px; 2812 height: 16px; 2813 } 2814`;var zp=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
2814a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let $d=class extends tt{constructor(){super(...arguments),this.images=[],this.secondImage={type:void 0,url:""},this.failedImageUrls=new Set}handleImageError(e){return n=>{n.stopPropagation(),this.failedImageUrls.add(e),this.requestUpdate()}}render(){const[e,n]=this.images;this.images.length||(this.dataset.noImages="true");const i=(e==null?void 0:e.type)==="NFT",s=n!=null&&n.url?n.type==="NFT":i,r=i?"var(--apkt-borderRadius-3)":"var(--apkt-borderRadius-5)",o=s?"var(--apkt-borderRadius-3)":"var(--apkt-borderRadius-5)";return this.style.cssText=` 2815 --local-left-border-radius: ${r}; 2816 --local-right-border-radius: ${o}; 2817 `,se`<wui-flex> ${this.templateVisual()} ${this.templateIcon()} </wui-flex>`}templateVisual(){const[e,n]=this.images;return this.images.length===2&&(e!=null&&e.url||n!=null&&n.url)?this.renderSwapImages(e,n):e!=null&&e.url&&!this.failedImageUrls.has(e.url)?this.renderSingleImage(e):(e==null?void 0:e.type)==="NFT"?this.renderPlaceholderIcon("nftPlaceholder"):this.renderPlaceholderIcon("coinPlaceholder")}renderSwapImages(e,n){return se`<div class="swap-images-container"> 2818 ${e!=null&&e.url?this.renderImageOrFallback(e,"first",!0):null} 2819 ${n!=null&&n.url?this.renderImageOrFallback(n,"last",!0):null} 2820 </div>`}renderSingleImage(e){return this.renderImageOrFallback(e,void 0,!1)}renderImageOrFallback(e,n,i=!1){return e.url?this.failedImageUrls.has(e.url)?i&&n?this.renderFallbackIconInContainer(n):this.renderFallbackIcon():se`<wui-image 2821 src=${e.url} 2822 alt="Transaction image" 2823 @onLoadError=${this.handleImageError(e.url)} 2824 ></wui-image>`:null}renderFallbackIconInContainer(e){return se`<div class="swap-fallback-container ${e}">${this.renderFallbackIcon()}</div>`}renderFallbackIcon(){return se`<wui-icon 2825 size="xl" 2826 weight="regular" 2827 color="default" 2828 name="networkPlaceholder" 2829 ></wui-icon>`}renderPlaceholderIcon(e){return se`<wui-icon size="xl" weight="regular" color="default" name=${e}></wui-icon>`}templateIcon(){let e="accent-primary",n;return n=this.getIcon(),this.status&&(e=this.getStatusColor()),n?se` 2830 <wui-flex alignItems="center" justifyContent="center" class="status-box"> 2831 <wui-icon-box size="sm" color=${e} icon=${n}></wui-icon-box> 2832 </wui-flex> 2833 `:null}getDirectionIcon(){switch(this.direction){case"in":return"arrowBottom";case"out":return"arrowTop";default:return}}getIcon(){return this.onlyDirectionIcon?this.getDirectionIcon():this.type==="trade"?"swapHorizontal":this.type==="approve"?"checkmark":this.type==="cancel"?"close":this.getDirectionIcon()}getStatusColor(){switch(this.status){case"confirmed":return"success";case"failed":return"error";case"pending":return"inverse";default:return"accent-primary"}}};$d.styles=[eje];zp([le()],$d.prototype,"type",void 0);zp([le()],$d.prototype,"status",void 0);zp([le()],$d.prototype,"direction",void 0);zp([le({type:Boolean})],$d.prototype,"onlyDirectionIcon",void 0);zp([le({type:Array})],$d.prototype,"images",void 0);zp([le({type:Object})],$d.prototype,"secondImage",void 0);zp([Me()],$d.prototype,"failedImageUrls",void 0);$d=zp([Qe("wui-transaction-visual")],$d);const tje=It` 2834 :host { 2835 width: 100%; 2836 } 2837 2838 :host > wui-flex:first-child { 2839 align-items: center; 2840 column-gap: ${({spacing:t})=>t[2]}; 2841 padding: ${({spacing:t})=>t[1]} ${({spacing:t})=>t[2]}; 2842 width: 100%; 2843 } 2844 2845 :host > wui-flex:first-child wui-text:nth-child(1) { 2846 text-transform: capitalize; 2847 } 2848 2849 wui-transaction-visual { 2850 width: 40px; 2851 height: 40px; 2852 } 2853 2854 wui-flex { 2855 flex: 1; 2856 } 2857 2858 :host wui-flex wui-flex { 2859 overflow: hidden; 2860 } 2861 2862 :host .description-container wui-text span { 2863 word-break: break-all; 2864 } 2865 2866 :host .description-container wui-text { 2867 overflow: hidden; 2868 } 2869 2870 :host .description-separator-icon { 2871 margin: 0px 6px; 2872 } 2873 2874 :host wui-text > span { 2875 overflow: hidden; 2876 display: -webkit-box; 2877 -webkit-box-orient: vertical; 2878 -webkit-line-clamp: 1; 2879 } 2880`;var Hp=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
2880a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Ud=class extends tt{constructor(){super(...arguments),this.type="approve",this.onlyDirectionIcon=!1,this.images=[]}render(){return se` 2881 <wui-flex> 2882 <wui-transaction-visual 2883 .status=${this.status} 2884 direction=${xt(this.direction)} 2885 type=${this.type} 2886 .onlyDirectionIcon=${this.onlyDirectionIcon} 2887 .images=${this.images} 2888 ></wui-transaction-visual> 2889 <wui-flex flexDirection="column" gap="1"> 2890 <wui-text variant="lg-medium" color="primary"> 2891 ${yI[this.type]||this.type} 2892 </wui-text> 2893 <wui-flex class="description-container"> 2894 ${this.templateDescription()} ${this.templateSecondDescription()} 2895 </wui-flex> 2896 </wui-flex> 2897 <wui-text variant="sm-medium" color="secondary"><span>${this.date}</span></wui-text> 2898 </wui-flex> 2899 `}templateDescription(){var n;const e=(n=this.descriptions)==null?void 0:n[0];return e?se` 2900 <wui-text variant="md-regular" color="secondary"> 2901 <span>${e}</span> 2902 </wui-text> 2903 `:null}templateSecondDescription(){var n;const e=(n=this.descriptions)==null?void 0:n[1];return e?se` 2904 <wui-icon class="description-separator-icon" size="sm" name="arrowRight"></wui-icon> 2905 <wui-text variant="md-regular" color="secondary"> 2906 <span>${e}</span> 2907 </wui-text> 2908 `:null}};Ud.styles=[vn,tje];Hp([le()],Ud.prototype,"type",void 0);Hp([le({type:Array})],Ud.prototype,"descriptions",void 0);Hp([le()],Ud.prototype,"date",void 0);Hp([le({type:Boolean})],Ud.prototype,"onlyDirectionIcon",void 0);Hp([le()],Ud.prototype,"status",void 0);Hp([le()],Ud.prototype,"direction",void 0);Hp([le({type:Array})],Ud.prototype,"images",void 0);Ud=Hp([Qe("wui-transaction-list-item")],Ud);const nje=It` 2909 :host { 2910 display: block; 2911 background: linear-gradient( 2912 90deg, 2913 ${({tokens:t})=>t.theme.foregroundPrimary} 0%, 2914 ${({tokens:t})=>t.theme.foregroundSecondary} 50%, 2915 ${({tokens:t})=>t.theme.foregroundPrimary} 100% 2916 ); 2917 background-size: 200% 100%; 2918 animation: shimmer 2s linear infinite; 2919 border-radius: ${({borderRadius:t})=>t[2]}; 2920 } 2921 2922 :host([data-rounded='true']) { 2923 border-radius: ${({borderRadius:t})=>t[16]}; 2924 } 2925 2926 @keyframes shimmer { 2927 0% { 2928 background-position: 100% 0; 2929 } 2930 100% { 2931 background-position: -100% 0; 2932 } 2933 } 2934`;var J6=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Gg=class extends tt{constructor(){super(...arguments),this.width="",this.height="",this.variant="default",this.rounded=!1}render(){return this.style.cssText=` 2935 width: ${this.width}; 2936 height: ${this.height}; 2937 `,this.dataset.rounded=this.rounded?"true":"false",se`<slot></slot>`}};Gg.styles=[nje];J6([le()],Gg.prototype,"width",void 0);J6([le()],Gg.prototype,"height",void 0);J6([le()],Gg.prototype,"variant",void 0);J6([le({type:Boolean})],Gg.prototype,"rounded",void 0);Gg=J6([Qe("wui-shimmer")],Gg);const ije=It` 2938 wui-flex { 2939 position: relative; 2940 display: inline-flex; 2941 justify-content: center; 2942 align-items: center; 2943 } 2944 2945 wui-image { 2946 border-radius: ${({borderRadius:t})=>t[128]}; 2947 } 2948 2949 .fallback-icon { 2950 color: ${({tokens:t})=>t.theme.iconInverse}; 2951 border-radius: ${({borderRadius:t})=>t[3]}; 2952 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 2953 } 2954 2955 .direction-icon, 2956 .status-image { 2957 position: absolute; 2958 right: 0; 2959 bottom: 0; 2960 border-radius: ${({borderRadius:t})=>t[128]}; 2961 border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 2962 } 2963 2964 .direction-icon { 2965 padding: ${({spacing:t})=>t["01"]}; 2966 color: ${({tokens:t})=>t.core.iconSuccess}; 2967 2968 background-color: color-mix( 2969 in srgb, 2970 ${({tokens:t})=>t.core.textSuccess} 30%, 2971 ${({tokens:t})=>t.theme.backgroundPrimary} 70% 2972 ); 2973 } 2974 2975 /* -- Sizes --------------------------------------------------- */ 2976 :host([data-size='sm']) > wui-image:not(.status-image), 2977 :host([data-size='sm']) > wui-flex { 2978 width: 24px; 2979 height: 24px; 2980 } 2981 2982 :host([data-size='lg']) > wui-image:not(.status-image), 2983 :host([data-size='lg']) > wui-flex { 2984 width: 40px; 2985 height: 40px; 2986 } 2987 2988 :host([data-size='sm']) .fallback-icon { 2989 height: 16px; 2990 width: 16px; 2991 padding: ${({spacing:t})=>t[1]}; 2992 } 2993 2994 :host([data-size='lg']) .fallback-icon { 2995 height: 32px; 2996 width: 32px; 2997 padding: ${({spacing:t})=>t[1]}; 2998 } 2999 3000 :host([data-size='sm']) .direction-icon, 3001 :host([data-size='sm']) .status-image { 3002 transform: translate(40%, 30%); 3003 } 3004 3005 :host([data-size='lg']) .direction-icon, 3006 :host([data-size='lg']) .status-image { 3007 transform: translate(40%, 10%); 3008 } 3009 3010 :host([data-size='sm']) .status-image { 3011 height: 14px; 3012 width: 14px; 3013 } 3014 3015 :host([data-size='lg']) .status-image { 3016 height: 20px;
3017 width: 20px; 3018 } 3019 3020 /* -- Crop effects --------------------------------------------------- */ 3021 .swap-crop-left-image, 3022 .swap-crop-right-image { 3023 position: absolute; 3024 top: 0; 3025 bottom: 0; 3026 } 3027 3028 .swap-crop-left-image { 3029 left: 0; 3030 clip-path: inset(0px calc(50% + 1.5px) 0px 0%); 3031 } 3032 3033 .swap-crop-right-image { 3034 right: 0; 3035 clip-path: inset(0px 0px 0px calc(50% + 1.5px)); 3036 } 3037`;var e4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const tk={sm:"xxs",lg:"md"};let Kg=class extends tt{constructor(){super(...arguments),this.type="approve",this.size="lg",this.statusImageUrl="",this.images=[]}render(){return se`<wui-flex>${this.templateVisual()} ${this.templateIcon()}</wui-flex>`}templateVisual(){switch(this.dataset.size=this.size,this.type){case"trade":return this.swapTemplate();case"fiat":return this.fiatTemplate();case"unknown":return this.unknownTemplate();default:return this.tokenTemplate()}}swapTemplate(){const[e,n]=this.images;return this.images.length===2&&(e||n)?se` 3038 <wui-image class="swap-crop-left-image" src=${e} alt="Swap image"></wui-image> 3039 <wui-image class="swap-crop-right-image" src=${n} alt="Swap image"></wui-image> 3040 `:e?se`<wui-image src=${e} alt="Swap image"></wui-image>`:null}fiatTemplate(){return se`<wui-icon 3041 class="fallback-icon" 3042 size=${tk[this.size]} 3043 name="dollar" 3044 ></wui-icon>`}unknownTemplate(){return se`<wui-icon 3045 class="fallback-icon" 3046 size=${tk[this.size]} 3047 name="questionMark" 3048 ></wui-icon>`}tokenTemplate(){const[e]=this.images;return e?se`<wui-image src=${e} alt="Token image"></wui-image> `:se`<wui-icon 3049 class="fallback-icon" 3050 name=${this.type==="nft"?"image":"coinPlaceholder"} 3051 ></wui-icon>`}templateIcon(){return this.statusImageUrl?se`<wui-image 3052 class="status-image" 3053 src=${this.statusImageUrl} 3054 alt="Status image" 3055 ></wui-image>`:se`<wui-icon 3056 class="direction-icon" 3057 size=${tk[this.size]} 3058 name=${this.getTemplateIcon()} 3059 ></wui-icon>`}getTemplateIcon(){return this.type==="trade"?"arrowClockWise":"arrowBottom"}};Kg.styles=[ije];e4([le()],Kg.prototype,"type",void 0);e4([le()],Kg.prototype,"size",void 0);e4([le()],Kg.prototype,"statusImageUrl",void 0);e4([le({type:Array})],Kg.prototype,"images",void 0);Kg=e4([Qe("wui-transaction-thumbnail")],Kg);const sje=It` 3060 :host > wui-flex:first-child { 3061 gap: ${({spacing:t})=>t[2]}; 3062 padding: ${({spacing:t})=>t[3]}; 3063 width: 100%; 3064 } 3065 3066 wui-flex { 3067 display: flex; 3068 flex: 1; 3069 } 3070`;var rje=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let bI=class extends tt{render(){return se` 3071 <wui-flex alignItems="center" .padding=${["1","2","1","2"]}> 3072 <wui-shimmer width="40px" height="40px" rounded></wui-shimmer> 3073 <wui-flex flexDirection="column" gap="1"> 3074 <wui-shimmer width="124px" height="16px" rounded></wui-shimmer> 3075 <wui-shimmer width="60px" height="14px" rounded></wui-shimmer> 3076 </wui-flex> 3077 <wui-shimmer width="24px" height="12px" rounded></wui-shimmer> 3078 </wui-flex> 3079 `}};bI.styles=[vn,sje];bI=rje([Qe("wui-transaction-list-item-loader")],bI);const oje=It` 3080 :host { 3081 min-height: 100%; 3082 } 3083 3084 .group-container[last-group='true'] { 3085 padding-bottom: ${({spacing:t})=>t[3]}; 3086 } 3087 3088 .contentContainer { 3089 height: 280px; 3090 } 3091 3092 .contentContainer > wui-icon-box { 3093 width: 40px; 3094 height: 40px; 3095 border-radius: ${({borderRadius:t})=>t[3]}; 3096 } 3097 3098 .contentContainer > .textContent { 3099 width: 65%; 3100 } 3101 3102 .emptyContainer { 3103 height: 100%; 3104 } 3105`;var k1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
3105a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const PH="last-transaction",aje=7;let Tf=class extends tt{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.page="activity",this.caipAddress=ne.state.activeCaipAddress,this.transactionsByYear=sa.state.transactionsByYear,this.loading=sa.state.loading,this.empty=sa.state.empty,this.next=sa.state.next,sa.clearCursor(),this.unsubscribe.push(ne.subscribeKey("activeCaipAddress",e=>{e&&this.caipAddress!==e&&(sa.resetTransactions(),sa.fetchTransactions(e)),this.caipAddress=e}),ne.subscribeKey("activeCaipNetwork",()=>{this.updateTransactionView()}),sa.subscribe(e=>{this.transactionsByYear=e.transactionsByYear,this.loading=e.loading,this.empty=e.empty,this.next=e.next}))}firstUpdated(){this.updateTransactionView(),this.createPaginationObserver()}updated(){this.setPaginationObserver()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se` ${this.empty?null:this.templateTransactionsByYear()} 3106 ${this.loading?this.templateLoading():null} 3107 ${!this.loading&&this.empty?this.templateEmpty():null}`}updateTransactionView(){sa.resetTransactions(),this.caipAddress&&sa.fetchTransactions(Ue.getPlainAddress(this.caipAddress))}templateTransactionsByYear(){return Object.keys(this.transactionsByYear).sort().reverse().map(n=>{const i=parseInt(n,10),s=new Array(12).fill(null).map((r,o)=>{var l;const a=a2.getTransactionGroupTitle(i,o),c=(l=this.transactionsByYear[i])==null?void 0:l[o];return{groupTitle:a,transactions:c}}).filter(({transactions:r})=>r).reverse();return s.map(({groupTitle:r,transactions:o},a)=>{const c=a===s.length-1;return o?se` 3108 <wui-flex 3109 flexDirection="column" 3110 class="group-container" 3111 last-group="${c?"true":"false"}" 3112 data-testid="month-indexes" 3113 > 3114 <wui-flex 3115 alignItems="center" 3116 flexDirection="row" 3117 .padding=${["2","3","3","3"]} 3118 > 3119 <wui-text variant="md-medium" color="secondary" data-testid="group-title"> 3120 ${r} 3121 </wui-text> 3122 </wui-flex> 3123 <wui-flex flexDirection="column" gap="2"> 3124 ${this.templateTransactions(o,c)} 3125 </wui-flex> 3126 </wui-flex> 3127 `:null})})}templateRenderTransaction(e,n){const{date:i,descriptions:s,direction:r,images:o,status:a,type:c,transfers:l,isAllNFT:d}=this.getTransactionListItemProps(e);return se` 3128 <wui-transaction-list-item 3129 date=${i} 3130 .direction=${r} 3131 id=${n&&this.next?PH:""} 3132 status=${a} 3133 type=${c} 3134 .images=${o} 3135 .onlyDirectionIcon=${d||l.length===1} 3136 .descriptions=${s} 3137 ></wui-transaction-list-item> 3138 `}templateTransactions(e,n){return e.map((i,s)=>{const r=n&&s===e.length-1;return se`${this.templateRenderTransaction(i,r)}`})}emptyStateActivity(){return se`<wui-flex 3139 class="emptyContainer" 3140 flexGrow="1" 3141 flexDirection="column" 3142 justifyContent="center" 3143 alignItems="center" 3144 .padding=${["10","5","10","5"]} 3145 gap="5" 3146 data-testid="empty-activity-state" 3147 > 3148 <wui-icon-box color="default" icon="wallet" size="xl"></wui-icon-box> 3149 <wui-flex flexDirection="column" alignItems="center" gap="2"> 3150 <wui-text align="center" variant="lg-medium" color="primary">No Transactions yet</wui-text> 3151 <wui-text align="center" variant="lg-regular" color="secondary" 3152 >Start trading on dApps <br /> 3153 to grow your wallet!</wui-text 3154 > 3155 </wui-flex> 3156 </wui-flex>`}emptyStateAccount(){return se`<wui-flex 3157 class="contentContainer" 3158 alignItems="center" 3159 justifyContent="center" 3160 flexDirection="column" 3161 gap="4" 3162 data-testid="empty-account-state" 3163 > 3164 <wui-icon-box icon="swapHorizontal" size="lg" color="default"></wui-icon-box> 3165 <wui-flex 3166 class="textContent" 3167 gap="2" 3168 flexDirection="column" 3169 justifyContent="center" 3170 flexDirection="column" 3171 > 3172 <wui-text variant="md-regular" align="center" color="primary">No activity yet</wui-text> 3173 <wui-text variant="sm-regular" align="center" color="secondary" 3174 >Your next transactions will appear here</wui-text 3175 > 3176 </wui-flex> 3177 <wui-link @click=${this.onReceiveClick.bind(this)}>Trade</wui-link> 3178 </wui-flex>`}templateEmpty(){return this.page==="account"?se`${this.emptyStateAccount()}`:se`${this.emptyStateActivity()}`}templateLoading(){return this.page==="activity"?se` <wui-flex flexDirection="column" width="100%"> 3179 <wui-flex .padding=${["2","3","3","3"]}>
3180 <wui-shimmer width="70px" height="16px" rounded></wui-shimmer> 3181 </wui-flex> 3182 <wui-flex flexDirection="column" gap="2" width="100%"> 3183 ${Array(aje).fill(se` <wui-transaction-list-item-loader></wui-transaction-list-item-loader> `).map(e=>e)} 3184 </wui-flex> 3185 </wui-flex>`:null}onReceiveClick(){Pe.push("WalletReceive")}createPaginationObserver(){const{projectId:e}=ye.state;this.paginationObserver=new IntersectionObserver(([n])=>{n!=null&&n.isIntersecting&&!this.loading&&(sa.fetchTransactions(Ue.getPlainAddress(this.caipAddress)),Et.sendEvent({type:"track",event:"LOAD_MORE_TRANSACTIONS",properties:{address:Ue.getPlainAddress(this.caipAddress),projectId:e,cursor:this.next,isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}}))},{}),this.setPaginationObserver()}setPaginationObserver(){var n,i,s;(n=this.paginationObserver)==null||n.disconnect();const e=(i=this.shadowRoot)==null?void 0:i.querySelector(`#${PH}`);e&&((s=this.paginationObserver)==null||s.observe(e))}getTransactionListItemProps(e){var c,l,d;const n=oP.formatDate((c=e==null?void 0:e.metadata)==null?void 0:c.minedAt),i=a2.mergeTransfers((e==null?void 0:e.transfers)||[]),s=a2.getTransactionDescriptions(e,i),r=i==null?void 0:i[0],o=!!r&&(i==null?void 0:i.every(h=>!!h.nft_info)),a=a2.getTransactionImages(i);return{date:n,direction:r==null?void 0:r.direction,descriptions:s,isAllNFT:o,images:a,status:(l=e.metadata)==null?void 0:l.status,transfers:i,type:(d=e.metadata)==null?void 0:d.operationType}}};Tf.styles=oje;k1([le()],Tf.prototype,"page",void 0);k1([Me()],Tf.prototype,"caipAddress",void 0);k1([Me()],Tf.prototype,"transactionsByYear",void 0);k1([Me()],Tf.prototype,"loading",void 0);k1([Me()],Tf.prototype,"empty",void 0);k1([Me()],Tf.prototype,"next",void 0);Tf=k1([Qe("w3m-activity-list")],Tf);const cje=os` 3186 :host { 3187 width: 100%; 3188 max-height: 280px; 3189 overflow: scroll; 3190 scrollbar-width: none; 3191 } 3192 3193 :host::-webkit-scrollbar {
3194 display: none; 3195 } 3196`;var lje=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let wI=class extends tt{render(){return se`<w3m-activity-list page="account"></w3m-activity-list>`}};wI.styles=cje;wI=lje([Qe("w3m-account-activity-widget")],wI);const uje=It` 3197 :host { 3198 width: 100%; 3199 } 3200 3201 button { 3202 width: 100%; 3203 display: flex; 3204 justify-content: space-between; 3205 align-items: center; 3206 gap: ${({spacing:t})=>t[4]}; 3207 padding: ${({spacing:t})=>t[4]}; 3208 background-color: transparent; 3209 border-radius: ${({borderRadius:t})=>t[4]}; 3210 } 3211 3212 wui-text { 3213 max-width: 174px; 3214 } 3215 3216 .tag-container { 3217 width: fit-content; 3218 } 3219 3220 @media (hover: hover) { 3221 button:hover:enabled { 3222 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3223 } 3224 } 3225`;var Kb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Rp=class extends tt{constructor(){super(...arguments),this.icon="card",this.text="",this.description="",this.tag=void 0,this.disabled=!1}render(){return se` 3226 <button ?disabled=${this.disabled}> 3227 <wui-flex alignItems="center" gap="3"> 3228 <wui-icon-box padding="2" color="secondary" icon=${this.icon} size="lg"></wui-icon-box> 3229 <wui-flex flexDirection="column" gap="1"> 3230 <wui-text variant="md-medium" color="primary">${this.text}</wui-text> 3231 ${this.description?se`<wui-text variant="md-regular" color="secondary"> 3232 ${this.description}</wui-text 3233 >`:null} 3234 </wui-flex> 3235 </wui-flex> 3236 3237 <wui-flex class="tag-container" alignItems="center" gap="1" justifyContent="flex-end"> 3238 ${this.tag?se`<wui-tag tagType="main" size="sm">${this.tag}</wui-tag>`:null} 3239 <wui-icon size="md" name="chevronRight" color="default"></wui-icon> 3240 </wui-flex> 3241 </button> 3242 `}};Rp.styles=[vn,Gi,uje];Kb([le()],Rp.prototype,"icon",void 0);Kb([le()],Rp.prototype,"text",void 0);Kb([le()],Rp.prototype,"description",void 0);Kb([le()],Rp.prototype,"tag",void 0);Kb([le({type:Boolean})],Rp.prototype,"disabled",void 0);Rp=Kb([Qe("wui-list-description")],Rp);const dje=It` 3243 :host { 3244 width: 100%; 3245 } 3246 3247 button { 3248 padding: ${({spacing:t})=>t[3]}; 3249 display: flex; 3250 gap: ${({spacing:t})=>t[3]}; 3251 justify-content: space-between; 3252 width: 100%; 3253 border-radius: ${({borderRadius:t})=>t[4]}; 3254 background-color: transparent; 3255 } 3256 3257 @media (hover: hover) { 3258 button:hover:enabled { 3259 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 3260 } 3261 } 3262 3263 button:focus-visible:enabled { 3264 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 3265 box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent040}; 3266 } 3267 3268 button[data-clickable='false'] { 3269 pointer-events: none; 3270 background-color: transparent; 3271 } 3272 3273 wui-image, 3274 wui-icon { 3275 width: ${({spacing:t})=>t[10]}; 3276 height: ${({spacing:t})=>t[10]}; 3277 } 3278 3279 wui-image { 3280 border-radius: ${({borderRadius:t})=>t[16]}; 3281 } 3282 3283 .token-name-container { 3284 flex: 1; 3285 } 3286`;var N1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let kf=class extends tt{constructor(){super(...arguments),this.tokenName="",this.tokenImageUrl="",this.tokenValue=0,this.tokenAmount="0.0",this.tokenCurrency="",this.clickable=!1}render(){return se` 3287 <button data-clickable=${String(this.clickable)}> 3288 <wui-flex gap="2" alignItems="center"> 3289 ${this.visualTemplate()} 3290 <wui-flex 3291 flexDirection="column" 3292 justifyContent="space-between" 3293 gap="1" 3294 class="token-name-container" 3295 > 3296 <wui-text variant="md-regular" color="primary" lineClamp="1"> 3297 ${this.tokenName} 3298 </wui-text> 3299 <wui-text variant="sm-regular-mono" color="secondary"> 3300 ${u5.formatNumberToLocalString(this.tokenAmount,4)} ${this.tokenCurrency} 3301 </wui-text> 3302 </wui-flex> 3303 </wui-flex> 3304 <wui-flex 3305 flexDirection="column" 3306 justifyContent="space-between" 3307 gap="1" 3308 alignItems="flex-end" 3309 width="auto" 3310 > 3311 <wui-text variant="md-regular-mono" color="primary" 3312 >$${this.tokenValue.toFixed(2)}</wui-text 3313 > 3314 <wui-text variant="sm-regular-mono" color="secondary"> 3315 ${u5.formatNumberToLocalString(this.tokenAmount,4)} 3316 </wui-text> 3317 </wui-flex> 3318 </button> 3319 `}visualTemplate(){return this.tokenName&&this.tokenImageUrl?se`<wui-image alt=${this.tokenName} src=${this.tokenImageUrl}></wui-image>`:se`<wui-icon name="coinPlaceholder" color="default"></wui-icon>`}};kf.styles=[vn,Gi,dje];N1([le()],kf.prototype,"tokenName",void 0);N1([le()],kf.prototype,"tokenImageUrl",void 0);N1([le({type:Number})],kf.prototype,"tokenValue",void 0);N1([le()],kf.prototype,"tokenAmount",void 0);N1([le()],kf.prototype,"tokenCurrency",void 0);N1([le({type:Boolean})],kf.prototype,"clickable",void 0);
3319kf=N1([Qe("wui-list-token")],kf);const hje=os` 3320 :host { 3321 width: 100%; 3322 } 3323 3324 wui-flex { 3325 width: 100%; 3326 } 3327 3328 .contentContainer { 3329 max-height: 280px; 3330 overflow: scroll; 3331 scrollbar-width: none; 3332 } 3333 3334 .contentContainer::-webkit-scrollbar { 3335 display: none; 3336 } 3337`;var UM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let D5=class extends tt{constructor(){var e;super(),this.unsubscribe=[],this.tokenBalance=(e=ne.getAccountData())==null?void 0:e.tokenBalance,this.remoteFeatures=ye.state.remoteFeatures,this.unsubscribe.push(ne.subscribeChainProp("accountState",n=>{this.tokenBalance=n==null?void 0:n.tokenBalance}),ye.subscribeKey("remoteFeatures",n=>{this.remoteFeatures=n}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se`${this.tokenTemplate()}`}tokenTemplate(){var e;return this.tokenBalance&&((e=this.tokenBalance)==null?void 0:e.length)>0?se`<wui-flex class="contentContainer" flexDirection="column" gap="2"> 3338 ${this.tokenItemTemplate()} 3339 </wui-flex>`:se` <wui-flex flexDirection="column"> 3340 ${this.onRampTemplate()} 3341 <wui-list-description 3342 @click=${this.onReceiveClick.bind(this)} 3343 text="Receive funds" 3344 description="Scan the QR code and receive funds" 3345 icon="qrCode" 3346 iconColor="fg-200" 3347 iconBackgroundColor="fg-200" 3348 data-testid="w3m-account-receive-button" 3349 ></wui-list-description 3350 ></wui-flex>`}onRampTemplate(){var e;return(e=this.remoteFeatures)!=null&&e.onramp?se`<wui-list-description 3351 @click=${this.onBuyClick.bind(this)} 3352 text="Buy Crypto" 3353 description="Easy with card or bank account" 3354 icon="card" 3355 iconColor="success-100" 3356 iconBackgroundColor="success-100" 3357 tag="popular" 3358 data-testid="w3m-account-onramp-button" 3359 ></wui-list-description>`:se``}tokenItemTemplate(){var e;return(e=this.tokenBalance)==null?void 0:e.map(n=>se`<wui-list-token 3360 tokenName=${n.name} 3361 tokenImageUrl=${n.iconUrl} 3362 tokenAmount=${n.quantity.numeric} 3363 tokenValue=${n.value} 3364 tokenCurrency=${n.symbol} 3365 ></wui-list-token>`)}onReceiveClick(){Pe.push("WalletReceive")}onBuyClick(){Et.sendEvent({type:"track",event:"SELECT_BUY_CRYPTO",properties:{isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}}),Pe.push("OnRampProviders")}};D5.styles=hje;UM([Me()],D5.prototype,"tokenBalance",void 0);UM([Me()],D5.prototype,"remoteFeatures",void 0);D5=UM([Qe("w3m-account-tokens-widget")],D5);const fje=os` 3366 :host { 3367 width: 100%; 3368 display: block; 3369 } 3370`;var BM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let O5=class extends tt{constructor(){super(),this.unsubscribe=[],this.text="",this.open=_l.state.open,this.unsubscribe.push(Pe.subscribeKey("view",()=>{_l.hide()}),wn.subscribeKey("open",e=>{e||_l.hide()}),_l.subscribeKey("open",e=>{this.open=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),_l.hide()}render(){return se` 3371 <div 3372 @pointermove=${this.onMouseEnter.bind(this)} 3373 @pointerleave=${this.onMouseLeave.bind(this)} 3374 > 3375 ${this.renderChildren()} 3376 </div> 3377 `}renderChildren(){return se`<slot></slot> `}onMouseEnter(){const e=this.getBoundingClientRect();if(!this.open){const n=document.querySelector("w3m-modal"),i={width:e.width,height:e.height,left:e.left,top:e.top};if(n){const s=n.getBoundingClientRect();i.left=e.left-(window.innerWidth-s.width)/2,i.top=e.top-(window.innerHeight-s.height)/2}_l.showTooltip({message:this.text,triggerRect:i,variant:"shade"})}}onMouseLeave(e){this.contains(e.relatedTarget)||_l.hide()}};O5.styles=[fje];BM([le()],O5.prototype,"text",void 0);BM([Me()],O5.prototype,"open",void 0);O5=BM([Qe("w3m-tooltip-trigger")],O5);
3377const pje=It` 3378 :host { 3379 pointer-events: none; 3380 } 3381 3382 :host > wui-flex { 3383 display: var(--w3m-tooltip-display); 3384 opacity: var(--w3m-tooltip-opacity); 3385 padding: 9px ${({spacing:t})=>t[3]} 10px ${({spacing:t})=>t[3]}; 3386 border-radius: ${({borderRadius:t})=>t[3]}; 3387 color: ${({tokens:t})=>t.theme.backgroundPrimary}; 3388 position: absolute; 3389 top: var(--w3m-tooltip-top); 3390 left: var(--w3m-tooltip-left); 3391 transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px)); 3392 max-width: calc(var(--apkt-modal-width) - ${({spacing:t})=>t[5]}); 3393 transition: opacity ${({durations:t})=>t.lg} 3394 ${({easings:t})=>t["ease-out-power-2"]}; 3395 will-change: opacity; 3396 opacity: 0; 3397 animation-duration: ${({durations:t})=>t.xl}; 3398 animation-timing-function: ${({easings:t})=>t["ease-out-power-2"]}; 3399 animation-name: fade-in; 3400 animation-fill-mode: forwards; 3401 } 3402 3403 :host([data-variant='shade']) > wui-flex { 3404 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3405 } 3406 3407 :host([data-variant='shade']) > wui-flex > wui-text { 3408 color: ${({tokens:t})=>t.theme.textSecondary}; 3409 } 3410 3411 :host([data-variant='fill']) > wui-flex { 3412 background-color: ${({tokens:t})=>t.theme.textPrimary}; 3413 border: none; 3414 } 3415 3416 wui-icon { 3417 position: absolute; 3418 width: 12px !important; 3419 height: 4px !important; 3420 color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3421 } 3422 3423 wui-icon[data-placement='top'] { 3424 bottom: 0px; 3425 left: 50%; 3426 transform: translate(-50%, 95%); 3427 } 3428 3429 wui-icon[data-placement='bottom'] { 3430 top: 0; 3431 left: 50%; 3432 transform: translate(-50%, -95%) rotate(180deg); 3433 } 3434 3435 wui-icon[data-placement='right'] { 3436 top: 50%; 3437 left: 0; 3438 transform: translate(-65%, -50%) rotate(90deg); 3439 } 3440 3441 wui-icon[data-placement='left'] { 3442 top: 50%; 3443 right: 0%; 3444 transform: translate(65%, -50%) rotate(270deg); 3445 } 3446 3447 @keyframes fade-in { 3448 from { 3449 opacity: 0; 3450 } 3451 to { 3452 opacity: 1; 3453 } 3454 } 3455`;var t4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Yg=class extends tt{constructor(){super(),this.unsubscribe=[],this.open=_l.state.open,this.message=_l.state.message,this.triggerRect=_l.state.triggerRect,this.variant=_l.state.variant,this.unsubscribe.push(_l.subscribe(e=>{this.open=e.open,this.message=e.message,this.triggerRect=e.triggerRect,this.variant=e.variant}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){this.dataset.variant=this.variant;const e=this.triggerRect.top,n=this.triggerRect.left;return this.style.cssText=` 3456 --w3m-tooltip-top: ${e}px; 3457 --w3m-tooltip-left: ${n}px; 3458 --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px; 3459 --w3m-tooltip-display: ${this.open?"flex":"none"}; 3460 --w3m-tooltip-opacity: ${this.open?1:0}; 3461 `,se`<wui-flex> 3462 <wui-icon data-placement="top" size="inherit" name="cursor"></wui-icon> 3463 <wui-text color="primary" variant="sm-regular">${this.message}</wui-text> 3464 </wui-flex>`}};Yg.styles=[pje];t4([Me()],Yg.prototype,"open",void 0);t4([Me()],Yg.prototype,"message",void 0);t4([Me()],Yg.prototype,"triggerRect",void 0);t4([Me()],Yg.prototype,"variant",void 0);Yg=t4([Qe("w3m-tooltip")],Yg);const mje=It` 3465 wui-flex { 3466 width: 100%; 3467 } 3468 3469 wui-promo { 3470 position: absolute; 3471 top: -32px; 3472 } 3473 3474 wui-profile-button { 3475 margin-top: calc(-1 * ${({spacing:t})=>t[4]}); 3476 } 3477 3478 wui-promo + wui-profile-button { 3479 margin-top: ${({spacing:t})=>t[4]}; 3480 } 3481 3482 wui-tabs { 3483 width: 100%; 3484 } 3485 3486 .contentContainer { 3487 height: 280px; 3488 } 3489 3490 .contentContainer > wui-icon-box { 3491 width: 40px; 3492 height: 40px; 3493 border-radius: ${({borderRadius:t})=>t[3]}; 3494 } 3495 3496 .contentContainer > .textContent { 3497 width: 65%; 3498 } 3499`;var Vu=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
3499a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let zc=class extends tt{constructor(){var e,n,i,s;super(...arguments),this.unsubscribe=[],this.network=ne.state.activeCaipNetwork,this.profileName=(e=ne.getAccountData())==null?void 0:e.profileName,this.address=(n=ne.getAccountData())==null?void 0:n.address,this.currentTab=(i=ne.getAccountData())==null?void 0:i.currentTab,this.tokenBalance=(s=ne.getAccountData())==null?void 0:s.tokenBalance,this.features=ye.state.features,this.namespace=ne.state.activeChain,this.activeConnectorIds=Oe.state.activeConnectorIds,this.remoteFeatures=ye.state.remoteFeatures}firstUpdated(){ne.fetchTokenBalance(),this.unsubscribe.push(ne.subscribeChainProp("accountState",e=>{e!=null&&e.address?(this.address=e.address,this.profileName=e.profileName,this.currentTab=e.currentTab,this.tokenBalance=e.tokenBalance):wn.close()}),Oe.subscribeKey("activeConnectorIds",e=>{this.activeConnectorIds=e}),ne.subscribeKey("activeChain",e=>this.namespace=e),ne.subscribeKey("activeCaipNetwork",e=>this.network=e),ye.subscribeKey("features",e=>this.features=e),ye.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e)),this.watchSwapValues()}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),clearInterval(this.watchTokenBalance)}render(){if(!this.address)throw new Error("w3m-account-features-widget: No account provided");if(!this.namespace)return null;const e=this.activeConnectorIds[this.namespace],n=e?Oe.getConnectorById(e):void 0,{icon:i,iconSize:s}=this.getAuthData();return se`<wui-flex 3500 flexDirection="column" 3501 .padding=${["0","3","4","3"]} 3502 alignItems="center" 3503 gap="4" 3504 data-testid="w3m-account-wallet-features-widget" 3505 > 3506 <wui-flex flexDirection="column" justifyContent="center" alignItems="center" gap="2"> 3507 <wui-wallet-switch 3508 profileName=${this.profileName} 3509 address=${this.address} 3510 icon=${i} 3511 iconSize=${s} 3512 alt=${n==null?void 0:n.name} 3513 @click=${this.onGoToProfileWalletsView.bind(this)} 3514 data-testid="wui-wallet-switch" 3515 ></wui-wallet-switch> 3516 3517 ${this.tokenBalanceTemplate()} 3518 </wui-flex> 3519 ${this.orderedWalletFeatures()} ${this.tabsTemplate()} ${this.listContentTemplate()} 3520 </wui-flex>`}orderedWalletFeatures(){var r;const e=((r=this.features)==null?void 0:r.walletFeaturesOrder)||fn.DEFAULT_FEATURES.walletFeaturesOrder;if(e.every(o=>{var a,c;return o==="send"||o==="receive"?!((a=this.features)!=null&&a[o]):o==="swaps"||o==="onramp"?!((c=this.remoteFeatures)!=null&&c[o]):!0}))return null;const i=e.map(o=>o==="receive"||o==="onramp"?"fund":o),s=[...new Set(i)];return se`<wui-flex gap="2"> 3521 ${s.map(o=>{switch(o){case"fund":return this.fundWalletTemplate();case"swaps":return this.swapsTemplate();case"send":return this.sendTemplate();default:return null}})} 3522 </wui-flex>`}fundWalletTemplate(){var r,o;if(!this.namespace)return null;const e=fn.ONRAMP_SUPPORTED_CHAIN_NAMESPACES.includes(this.namespace),n=(r=this.features)==null?void 0:r.receive,i=((o=this.remoteFeatures)==null?void 0:o.onramp)&&e,s=Ir.isPayWithExchangeEnabled();return!i&&!n&&!s?null:se` 3523 <w3m-tooltip-trigger text="Fund wallet"> 3524 <wui-button 3525 data-testid="wallet-features-fund-wallet-button" 3526 @click=${this.onFundWalletClick.bind(this)} 3527 variant="accent-secondary" 3528 size="lg" 3529 fullWidth 3530 > 3531 <wui-icon name="dollar"></wui-icon> 3532 </wui-button> 3533 </w3m-tooltip-trigger> 3534 `}swapsTemplate(){var i;const e=(i=this.remoteFeatures)==null?void 0:i.swaps,n=ne.state.activeChain===we.CHAIN.EVM;return!e||!n?null:se` 3535 <w3m-tooltip-trigger text="Swap"> 3536 <wui-button 3537 fullWidth 3538 data-testid="wallet-features-swaps-button" 3539 @click=${this.onSwapClick.bind(this)} 3540 variant="accent-secondary" 3541 size="lg" 3542 > 3543 <wui-icon name="recycleHorizontal"></wui-icon> 3544 </wui-button> 3545 </w3m-tooltip-trigger> 3546 `}sendTemplate(){var s;const e=(s=this.features)==null?void 0:s.send,n=ne.state.activeChain,i=fn.SEND_SUPPORTED_NAMESPACES.includes(n);return!e||!i?null:se` 3547 <w3m-tooltip-trigger text="Send"> 3548 <wui-button 3549 fullWidth 3550 data-testid="wallet-features-send-button" 3551 @click=${this.onSendClick.bind(this)} 3552 variant="accent-secondary" 3553 size="lg" 3554 > 3555 <wui-icon name="send"></wui-icon> 3556 </wui-button>
3556 3557 </w3m-tooltip-trigger> 3558 `}watchSwapValues(){this.watchTokenBalance=setInterval(()=>ne.fetchTokenBalance(e=>this.onTokenBalanceError(e)),1e4)}onTokenBalanceError(e){e instanceof Error&&e.cause instanceof Response&&e.cause.status===we.HTTP_STATUS_CODES.SERVICE_UNAVAILABLE&&clearInterval(this.watchTokenBalance)}listContentTemplate(){return this.currentTab===0?se`<w3m-account-tokens-widget></w3m-account-tokens-widget>`:this.currentTab===1?se`<w3m-account-activity-widget></w3m-account-activity-widget>`:se`<w3m-account-tokens-widget></w3m-account-tokens-widget>`}tokenBalanceTemplate(){var e;if(this.tokenBalance&&((e=this.tokenBalance)==null?void 0:e.length)>=0){const n=Ue.calculateBalance(this.tokenBalance),{dollars:i="0",pennies:s="00"}=Ue.formatTokenBalance(n);return se`<wui-balance dollars=${i} pennies=${s}></wui-balance>`}return se`<wui-balance dollars="0" pennies="00"></wui-balance>`}tabsTemplate(){const e=A2.getTabsByNamespace(ne.state.activeChain);return e.length===0?null:se`<wui-tabs 3559 .onTabChange=${this.onTabChange.bind(this)} 3560 .activeTab=${this.currentTab} 3561 .tabs=${e} 3562 ></wui-tabs>`}onTabChange(e){ne.setAccountProp("currentTab",e,this.namespace)}onFundWalletClick(){Pe.push("FundWallet")}onSwapClick(){var e,n,i;(e=this.network)!=null&&e.caipNetworkId&&!fn.SWAP_SUPPORTED_NETWORKS.includes((n=this.network)==null?void 0:n.caipNetworkId)?Pe.push("UnsupportedChain",{swapUnsupportedChain:!0}):(Et.sendEvent({type:"track",event:"OPEN_SWAP",properties:{network:((i=this.network)==null?void 0:i.caipNetworkId)||"",isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}}),Pe.push("Swap"))}getAuthData(){const e=He.getConnectedSocialProvider(),n=He.getConnectedSocialUsername(),i=Oe.getAuthConnector(),s=(i==null?void 0:i.provider.getEmail())??"";return{name:za.getAuthName({email:s,socialUsername:n,socialProvider:e}),icon:e??"mail",iconSize:e?"xl":"md"}}onGoToProfileWalletsView(){Pe.push("ProfileWallets")}onSendClick(){var e;Et.sendEvent({type:"track",event:"OPEN_SEND",properties:{network:((e=this.network)==null?void 0:e.caipNetworkId)||"",isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}}),Pe.push("WalletSend")}};zc.styles=mje;Vu([Me()],zc.prototype,"watchTokenBalance",void 0);Vu([Me()],zc.prototype,"network",void 0);Vu([Me()],zc.prototype,"profileName",void 0);Vu([Me()],zc.prototype,"address",void 0);Vu([Me()],zc.prototype,"currentTab",void 0);Vu([Me()],zc.prototype,"tokenBalance",void 0);Vu([Me()],zc.prototype,"features",void 0);Vu([Me()],zc.prototype,"namespace",void 0);Vu([Me()],zc.prototype,"activeConnectorIds",void 0);Vu([Me()],zc.prototype,"remoteFeatures",void 0);zc=Vu([Qe("w3m-account-wallet-features-widget")],zc);var dre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let F_=class extends tt{constructor(){super(),this.unsubscribe=[],this.namespace=ne.state.activeChain,this.unsubscribe.push(ne.subscribeKey("activeChain",e=>{this.namespace=e}))}render(){if(!this.namespace)return null;const e=Oe.getConnectorId(this.namespace),n=Oe.getAuthConnector();return se` 3563 ${n&&e===we.CONNECTOR_ID.AUTH?this.walletFeaturesTemplate():this.defaultTemplate()} 3564 `}walletFeaturesTemplate(){return se`<w3m-account-wallet-features-widget></w3m-account-wallet-features-widget>`}defaultTemplate(){return se`<w3m-account-default-widget></w3m-account-default-widget>`}};dre([Me()],F_.prototype,"namespace",void 0);F_=dre([Qe("w3m-account-view")],F_);const gje=It` 3565 :host { 3566 position: relative; 3567 background-color: ${({tokens:t})=>t.theme.foregroundTertiary}; 3568 display: flex; 3569 justify-content: center; 3570 align-items: center; 3571 border-radius: inherit; 3572 border-radius: var(--local-border-radius); 3573 } 3574 3575 :host([data-image='true']) { 3576 background-color: transparent; 3577 } 3578 3579 :host > wui-flex { 3580 overflow: hidden; 3581 border-radius: inherit; 3582 border-radius: var(--local-border-radius); 3583 } 3584 3585 :host([data-size='sm']) { 3586 width: 32px; 3587 height: 32px; 3588 } 3589 3590 :host([data-size='md']) { 3591 width: 40px; 3592 height: 40px; 3593 } 3594 3595 :host([data-size='lg']) { 3596 width: 56px; 3597 height: 56px; 3598 } 3599 3600 :host([name='Extension'])::after { 3601 border: 1px solid ${({colors:t})=>t.accent010}; 3602 } 3603 3604 :host([data-wallet-icon='allWallets'])::after { 3605 border: 1px solid ${({colors:t})=>t.accent010}; 3606 } 3607 3608 wui-icon[data-parent-size='inherit'] { 3609 width: 75%; 3610 height: 75%; 3611 align-items: center; 3612 } 3613 3614 wui-icon { 3615 color: ${({tokens:t})=>t.theme.iconDefault}; 3616 } 3617 3618 wui-icon[data-parent-size='sm'] { 3619 width: 24px; 3620 height: 24px; 3621 } 3622 3623 wui-icon[data-parent-size='md'] { 3624 width: 32px; 3625 height: 32px; 3626 } 3627 3628 :host > wui-icon-box { 3629 position: absolute; 3630 overflow: hidden; 3631 right: -1px; 3632 bottom: -2px; 3633 z-index: 1; 3634 border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 3635 padding: 1px; 3636 } 3637`;var R1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
3637a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Nf=class extends tt{constructor(){super(...arguments),this.size="md",this.name="",this.installed=!1,this.badgeSize="xs"}render(){let e="1";return this.size==="lg"?e="4":this.size==="md"?e="2":this.size==="sm"&&(e="1"),this.style.cssText=` 3638 --local-border-radius: var(--apkt-borderRadius-${e}); 3639 `,this.dataset.size=this.size,this.imageSrc&&(this.dataset.image="true"),this.walletIcon&&(this.dataset.walletIcon=this.walletIcon),se` 3640 <wui-flex justifyContent="center" alignItems="center"> ${this.templateVisual()} </wui-flex> 3641 `}templateVisual(){return this.imageSrc?se`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:this.walletIcon?se`<wui-icon size="md" color="default" name=${this.walletIcon}></wui-icon>`:se`<wui-icon 3642 data-parent-size=${this.size} 3643 size="inherit" 3644 color="inherit" 3645 name="wallet" 3646 ></wui-icon>`}};Nf.styles=[vn,gje];R1([le()],Nf.prototype,"size",void 0);R1([le()],Nf.prototype,"name",void 0);R1([le()],Nf.prototype,"imageSrc",void 0);R1([le()],Nf.prototype,"walletIcon",void 0);R1([le({type:Boolean})],Nf.prototype,"installed",void 0);R1([le()],Nf.prototype,"badgeSize",void 0);Nf=R1([Qe("wui-wallet-image")],Nf);const yje=It` 3647 wui-image { 3648 width: 24px; 3649 height: 24px; 3650 border-radius: ${({borderRadius:t})=>t[2]}; 3651 } 3652 3653 wui-image, 3654 .icon-box { 3655 width: 32px; 3656 height: 32px; 3657 border-radius: ${({borderRadius:t})=>t[2]}; 3658 } 3659 3660 wui-icon:not(.custom-icon, .icon-badge) { 3661 cursor: pointer; 3662 } 3663 3664 .icon-box { 3665 position: relative; 3666 border-radius: ${({borderRadius:t})=>t[2]}; 3667 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 3668 } 3669 3670 .icon-badge { 3671 position: absolute; 3672 top: 18px; 3673 left: 23px; 3674 z-index: 3; 3675 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3676 border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 3677 border-radius: 50%; 3678 padding: ${({spacing:t})=>t["01"]}; 3679 } 3680 3681 .icon-badge { 3682 width: 8px; 3683 height: 8px; 3684 } 3685`;var lc=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Go=class extends tt{constructor(){super(...arguments),this.address="",this.profileName="",this.content=[],this.alt="",this.imageSrc="",this.icon=void 0,this.iconSize="md",this.iconBadge=void 0,this.iconBadgeSize="md",this.buttonVariant="neutral-primary",this.enableMoreButton=!1,this.charsStart=4,this.charsEnd=6}render(){return se` 3686 <wui-flex flexDirection="column" rowgap="2"> 3687 ${this.topTemplate()} ${this.bottomTemplate()} 3688 </wui-flex> 3689 `}topTemplate(){return se` 3690 <wui-flex alignItems="flex-start" justifyContent="space-between"> 3691 ${this.imageOrIconTemplate()} 3692 <wui-icon-link 3693 variant="secondary" 3694 size="md" 3695 icon="copy" 3696 @click=${this.dispatchCopyEvent} 3697 ></wui-icon-link> 3698 <wui-icon-link 3699 variant="secondary" 3700 size="md" 3701 icon="externalLink" 3702 @click=${this.dispatchExternalLinkEvent} 3703 ></wui-icon-link> 3704 ${this.enableMoreButton?se`<wui-icon-link 3705 variant="secondary" 3706 size="md" 3707 icon="threeDots" 3708 @click=${this.dispatchMoreButtonEvent} 3709 data-testid="wui-active-profile-wallet-item-more-button" 3710 ></wui-icon-link>`:null} 3711 </wui-flex> 3712 `}bottomTemplate(){return se` <wui-flex flexDirection="column">${this.contentTemplate()}</wui-flex> `}imageOrIconTemplate(){return this.icon?se` 3713 <wui-flex flexGrow="1" alignItems="center"> 3714 <wui-flex alignItems="center" justifyContent="center" class="icon-box"> 3715 <wui-icon size="lg" color="default" name=${this.icon} class="custom-icon"></wui-icon> 3716 3717 ${this.iconBadge?se`<wui-icon 3718 color="accent-primary" 3719 size="inherit" 3720 name=${this.iconBadge} 3721 class="icon-badge" 3722 ></wui-icon>`:null} 3723 </wui-flex> 3724 </wui-flex> 3725 `:se` 3726 <wui-flex flexGrow="1" alignItems="center"> 3727 <wui-image objectFit="contain" src=${this.imageSrc} alt=${this.alt}></wui-image> 3728 </wui-flex> 3729 `}contentTemplate(){return this.content.length===0?null:se` 3730 <wui-flex flexDirection="column" rowgap="3"> 3731 ${this.content.map(e=>this.labelAndTagTemplate(e))} 3732 </wui-flex> 3733 `}labelAndTagTemplate({address:e,profileName:n,label:i,description:s,enableButton:r,buttonType:o,buttonLabel:a,buttonVariant:c,tagVariant:l,tagLabel:d,alignItems:h="flex-end"}){return se` 3734 <wui-flex justifyContent="space-between" alignItems=${h} columngap="1"> 3735 <wui-flex flexDirection="column" rowgap="01"> 3736 ${i?se`<wui-text variant="sm-medium" color="secondary">${i}</wui-text>`:null} 3737 3738 <wui-flex alignItems="center" columngap="1"> 3739 <wui-text variant="md-regular" color="primary"> 3740 ${ds.getTruncateString({string:n||e,charsStart:n?16:this.charsStart,charsEnd:n?0:this.charsEnd,truncate:n?"end":"middle"})} 3741 </wui-text> 3742 3743 ${l&&d?se`<wui-tag variant=${l} size="sm">${d}</wui-tag>`:null} 3744 </wui-flex> 3745 3746 ${s?se`<wui-text variant="sm-regular" color="secondary">${s}</wui-text>`:null} 3747 </wui-flex> 3748 3749 ${r?this.buttonTemplate({buttonType:o,buttonLabel:a,buttonVariant:c}):null} 3750 </wui-flex> 3751 `}buttonTemplate({buttonType:e,buttonLabel:n,buttonVariant:i}){return se` 3752 <wui-button 3753 size="sm" 3754 variant=${i} 3755 @click=${e==="disconnect"?this.dispatchDisconnectEvent.bind(this):this.dispatchSwitchEvent.bind(this)} 3756 data-testid=${e==="disconnect"?"wui-active-profile-wallet-item-disconnect-button":"wui-active-profile-wallet-item-switch-button"} 3757 > 3758 ${n} 3759 </wui-button>
3759 3760 `}dispatchDisconnectEvent(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}dispatchSwitchEvent(){this.dispatchEvent(new CustomEvent("switch",{bubbles:!0,composed:!0}))}dispatchExternalLinkEvent(){this.dispatchEvent(new CustomEvent("externalLink",{bubbles:!0,composed:!0}))}dispatchMoreButtonEvent(){this.dispatchEvent(new CustomEvent("more",{bubbles:!0,composed:!0}))}dispatchCopyEvent(){this.dispatchEvent(new CustomEvent("copy",{bubbles:!0,composed:!0}))}};Go.styles=[vn,Gi,yje];lc([le()],Go.prototype,"address",void 0);lc([le()],Go.prototype,"profileName",void 0);lc([le({type:Array})],Go.prototype,"content",void 0);lc([le()],Go.prototype,"alt",void 0);lc([le()],Go.prototype,"imageSrc",void 0);lc([le()],Go.prototype,"icon",void 0);lc([le()],Go.prototype,"iconSize",void 0);lc([le()],Go.prototype,"iconBadge",void 0);lc([le()],Go.prototype,"iconBadgeSize",void 0);lc([le()],Go.prototype,"buttonVariant",void 0);lc([le({type:Boolean})],Go.prototype,"enableMoreButton",void 0);lc([le({type:Number})],Go.prototype,"charsStart",void 0);lc([le({type:Number})],Go.prototype,"charsEnd",void 0);Go=lc([Qe("wui-active-profile-wallet-item")],Go);const bje=It` 3761 wui-image, 3762 .icon-box { 3763 width: 32px; 3764 height: 32px; 3765 border-radius: ${({borderRadius:t})=>t[2]}; 3766 } 3767 3768 .right-icon { 3769 cursor: pointer; 3770 } 3771 3772 .icon-box { 3773 position: relative; 3774 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3775 } 3776 3777 .icon-badge { 3778 position: absolute; 3779 top: 18px; 3780 left: 23px; 3781 z-index: 3; 3782 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3783 border: 2px solid ${({tokens:t})=>t.theme.backgroundPrimary}; 3784 border-radius: 50%; 3785 padding: ${({spacing:t})=>t["01"]}; 3786 } 3787 3788 .icon-badge { 3789 width: 8px; 3790 height: 8px; 3791 } 3792`;var Qo=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let io=class extends tt{constructor(){super(...arguments),this.address="",this.profileName="",this.alt="",this.buttonLabel="",this.buttonVariant="accent-primary",this.imageSrc="",this.icon=void 0,this.iconSize="md",this.iconBadgeSize="md",this.rightIcon="signOut",this.rightIconSize="md",this.loading=!1,this.charsStart=4,this.charsEnd=6}render(){return se` 3793 <wui-flex alignItems="center" columngap="2"> 3794 ${this.imageOrIconTemplate()} ${this.labelAndDescriptionTemplate()} 3795 ${this.buttonActionTemplate()} 3796 </wui-flex> 3797 `}imageOrIconTemplate(){return this.icon?se` 3798 <wui-flex alignItems="center" justifyContent="center" class="icon-box"> 3799 <wui-flex alignItems="center" justifyContent="center" class="icon-box"> 3800 <wui-icon size="lg" color="default" name=${this.icon} class="custom-icon"></wui-icon> 3801 3802 ${this.iconBadge?se`<wui-icon 3803 color="default" 3804 size="inherit" 3805 name=${this.iconBadge} 3806 class="icon-badge" 3807 ></wui-icon>`:null} 3808 </wui-flex> 3809 </wui-flex> 3810 `:se`<wui-image objectFit="contain" src=${this.imageSrc} alt=${this.alt}></wui-image>`}labelAndDescriptionTemplate(){return se` 3811 <wui-flex 3812 flexDirection="column" 3813 flexGrow="1" 3814 justifyContent="flex-start" 3815 alignItems="flex-start" 3816 > 3817 <wui-text variant="lg-regular" color="primary"> 3818 ${ds.getTruncateString({string:this.profileName||this.address,charsStart:this.profileName?16:this.charsStart,charsEnd:this.profileName?0:this.charsEnd,truncate:this.profileName?"end":"middle"})} 3819 </wui-text> 3820 </wui-flex> 3821 `}buttonActionTemplate(){return se` 3822 <wui-flex columngap="1" alignItems="center" justifyContent="center"> 3823 <wui-button 3824 size="sm" 3825 variant=${this.buttonVariant} 3826 .loading=${this.loading} 3827 @click=${this.handleButtonClick} 3828 data-testid="wui-inactive-profile-wallet-item-button" 3829 > 3830 ${this.buttonLabel} 3831 </wui-button>
3831 3832 3833 <wui-icon-link 3834 variant="secondary" 3835 size="md" 3836 icon=${xt(this.rightIcon)} 3837 class="right-icon" 3838 @click=${this.handleIconClick} 3839 ></wui-icon-link> 3840 </wui-flex> 3841 `}handleButtonClick(){this.dispatchEvent(new CustomEvent("buttonClick",{bubbles:!0,composed:!0}))}handleIconClick(){this.dispatchEvent(new CustomEvent("iconClick",{bubbles:!0,composed:!0}))}};io.styles=[vn,Gi,bje];Qo([le()],io.prototype,"address",void 0);Qo([le()],io.prototype,"profileName",void 0);Qo([le()],io.prototype,"alt",void 0);Qo([le()],io.prototype,"buttonLabel",void 0);Qo([le()],io.prototype,"buttonVariant",void 0);Qo([le()],io.prototype,"imageSrc",void 0);Qo([le()],io.prototype,"icon",void 0);Qo([le()],io.prototype,"iconSize",void 0);Qo([le()],io.prototype,"iconBadge",void 0);Qo([le()],io.prototype,"iconBadgeSize",void 0);Qo([le()],io.prototype,"rightIcon",void 0);Qo([le()],io.prototype,"rightIconSize",void 0);Qo([le({type:Boolean})],io.prototype,"loading",void 0);Qo([le({type:Number})],io.prototype,"charsStart",void 0);Qo([le({type:Number})],io.prototype,"charsEnd",void 0);io=Qo([Qe("wui-inactive-profile-wallet-item")],io);const wje=It` 3842 :host { 3843 position: relative; 3844 display: flex; 3845 width: 100%; 3846 height: 1px; 3847 background-color: ${({tokens:t})=>t.theme.borderPrimary}; 3848 justify-content: center; 3849 align-items: center; 3850 } 3851 3852 :host > wui-text { 3853 position: absolute; 3854 padding: 0px 8px; 3855 background-color: ${({tokens:t})=>t.theme.backgroundPrimary}; 3856 transition: background-color ${({durations:t})=>t.lg} 3857 ${({easings:t})=>t["ease-out-power-2"]}; 3858 will-change: background-color; 3859 } 3860`;var hre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let j_=class extends tt{constructor(){super(...arguments),this.text=""}render(){return se`${this.template()}`}template(){return this.text?se`<wui-text variant="md-regular" color="secondary">${this.text}</wui-text>`:null}};j_.styles=[vn,wje];hre([le()],j_.prototype,"text",void 0);j_=hre([Qe("wui-separator")],j_);const nk={getAuthData(t){var o,a;const e=t.connectorId===we.CONNECTOR_ID.AUTH;if(!e)return{isAuth:!1,icon:void 0,iconSize:void 0,name:void 0};const n=((o=t==null?void 0:t.auth)==null?void 0:o.name)??He.getConnectedSocialProvider(),i=((a=t==null?void 0:t.auth)==null?void 0:a.username)??He.getConnectedSocialUsername(),s=Oe.getAuthConnector(),r=(s==null?void 0:s.provider.getEmail())??"";return{isAuth:!0,icon:n??"mail",iconSize:n?"xl":"md",name:e?za.getAuthName({email:r,socialUsername:i,socialProvider:n}):void 0}}},vje=It` 3861 :host { 3862 --connect-scroll--top-opacity: 0; 3863 --connect-scroll--bottom-opacity: 0; 3864 } 3865 3866 .balance-amount { 3867 flex: 1; 3868 } 3869 3870 .wallet-list { 3871 scrollbar-width: none; 3872 overflow-y: scroll; 3873 overflow-x: hidden; 3874 transition: opacity ${({easings:t})=>t["ease-out-power-1"]} 3875 ${({durations:t})=>t.md}; 3876 will-change: opacity; 3877 mask-image: linear-gradient( 3878 to bottom, 3879 rgba(0, 0, 0, calc(1 - var(--connect-scroll--top-opacity))) 0px, 3880 rgba(200, 200, 200, calc(1 - var(--connect-scroll--top-opacity))) 1px, 3881 black 40px, 3882 black calc(100% - 40px), 3883 rgba(155, 155, 155, calc(1 - var(--connect-scroll--bottom-opacity))) calc(100% - 1px), 3884 rgba(0, 0, 0, calc(1 - var(--connect-scroll--bottom-opacity))) 100% 3885 ); 3886 } 3887 3888 .active-wallets { 3889 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3890 border-radius: ${({borderRadius:t})=>t[4]}; 3891 } 3892 3893 .active-wallets-box { 3894 height: 330px; 3895 } 3896 3897 .empty-wallet-list-box { 3898 height: 400px; 3899 } 3900 3901 .empty-box { 3902 width: 100%; 3903 padding: ${({spacing:t})=>t[4]}; 3904 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 3905 border-radius: ${({borderRadius:t})=>t[4]}; 3906 } 3907 3908 wui-separator { 3909 margin: ${({spacing:t})=>t[2]} 0 ${({spacing:t})=>t[2]} 0; 3910 } 3911 3912 .active-connection { 3913 padding: ${({spacing:t})=>t[2]}; 3914 } 3915 3916 .recent-connection { 3917 padding: ${({spacing:t})=>t[2]} 0 ${({spacing:t})=>t[2]} 0; 3918 } 3919 3920 @media (max-width: 430px) { 3921 .active-wallets-box, 3922 .empty-wallet-list-box { 3923 height: auto; 3924 max-height: clamp(360px, 470px, 80vh); 3925 } 3926 } 3927`;var Zc=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
3927a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const pl={ADDRESS_DISPLAY:{START:4,END:6},BADGE:{SIZE:"md",ICON:"lightbulb"},SCROLL_THRESHOLD:50,OPACITY_RANGE:[0,1]},c2={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},Cje=[{namespace:"eip155",icon:c2.eip155,label:"EVM"},{namespace:"solana",icon:c2.solana,label:"Solana"},{namespace:"bip122",icon:c2.bip122,label:"Bitcoin"},{namespace:"ton",icon:c2.ton,label:"Ton"}],xje={eip155:{title:"Add EVM Wallet",description:"Add your first EVM wallet"},solana:{title:"Add Solana Wallet",description:"Add your first Solana wallet"},bip122:{title:"Add Bitcoin Wallet",description:"Add your first Bitcoin wallet"},ton:{title:"Add TON Wallet",description:"Add your first TON wallet"}};let Ko=class extends tt{constructor(){var e,n,i;super(),this.unsubscribers=[],this.currentTab=0,this.namespace=ne.state.activeChain,this.namespaces=Array.from(ne.state.chains.keys()),this.caipAddress=void 0,this.profileName=void 0,this.activeConnectorIds=Oe.state.activeConnectorIds,this.lastSelectedAddress="",this.lastSelectedConnectorId="",this.isSwitching=!1,this.caipNetwork=ne.state.activeCaipNetwork,this.user=(e=ne.getAccountData())==null?void 0:e.user,this.remoteFeatures=ye.state.remoteFeatures,this.currentTab=this.namespace?this.namespaces.indexOf(this.namespace):0,this.caipAddress=(n=ne.getAccountData(this.namespace))==null?void 0:n.caipAddress,this.profileName=(i=ne.getAccountData(this.namespace))==null?void 0:i.profileName,this.unsubscribers.push(Ve.subscribeKey("connections",()=>this.onConnectionsChange()),Ve.subscribeKey("recentConnections",()=>this.requestUpdate()),Oe.subscribeKey("activeConnectorIds",s=>{this.activeConnectorIds=s}),ne.subscribeKey("activeCaipNetwork",s=>this.caipNetwork=s),ne.subscribeChainProp("accountState",s=>{this.user=s==null?void 0:s.user}),ye.subscribeKey("remoteFeatures",s=>this.remoteFeatures=s)),this.chainListener=ne.subscribeChainProp("accountState",s=>{this.caipAddress=s==null?void 0:s.caipAddress,this.profileName=s==null?void 0:s.profileName},this.namespace)}disconnectedCallback(){var e,n;this.unsubscribers.forEach(i=>i()),(e=this.resizeObserver)==null||e.disconnect(),this.removeScrollListener(),(n=this.chainListener)==null||n.call(this)}firstUpdated(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".wallet-list");if(!e)return;const n=()=>this.updateScrollOpacity(e);requestAnimationFrame(n),e.addEventListener("scroll",n),this.resizeObserver=new ResizeObserver(n),this.resizeObserver.observe(e),n()}render(){const e=this.namespace;if(!e)throw new Error("Namespace is not set");return se` 3928 <wui-flex flexDirection="column" .padding=${["0","4","4","4"]} gap="4"> 3929 ${this.renderTabs()} ${this.renderHeader(e)} ${this.renderConnections(e)} 3930 ${this.renderAddConnectionButton(e)} 3931 </wui-flex> 3932 `}renderTabs(){const e=this.namespaces.map(i=>Cje.find(s=>s.namespace===i)).filter(Boolean);return e.length>1?se` 3933 <wui-tabs 3934 .onTabChange=${i=>this.handleTabChange(i)} 3935 .activeTab=${this.currentTab} 3936 .tabs=${e} 3937 ></wui-tabs> 3938 `:null}renderHeader(e){const i=this.getActiveConnections(e).flatMap(({accounts:s})=>s).length+(this.caipAddress?1:0);return se` 3939 <wui-flex alignItems="center" columngap="1"> 3940 <wui-icon 3941 size="sm" 3942 name=${c2[e]??c2.eip155} 3943 ></wui-icon> 3944 <wui-text color="secondary" variant="lg-regular" 3945 >${i>1?"Wallets":"Wallet"}</wui-text 3946 > 3947 <wui-text 3948 color="primary" 3949 variant="lg-regular" 3950 class="balance-amount" 3951 data-testid="balance-amount" 3952 > 3953 ${i} 3954 </wui-text> 3955 <wui-link 3956 color="secondary" 3957 variant="secondary" 3958 @click=${()=>Ve.disconnect({namespace:e})} 3959 ?disabled=${!this.hasAnyConnections(e)} 3960 data-testid="disconnect-all-button" 3961 > 3962 Disconnect All 3963 </wui-link> 3964 </wui-flex> 3965 `}renderConnections(e){const n=this.hasAnyConnections(e);return se` 3966 <wui-flex flexDirection="column" class=${OM({"wallet-list":!0,"active-wallets-box":n,"empty-wallet-list-box":!n})} rowgap="3"> 3967 ${n?this.renderActiveConnections(e):this.renderEmptyState(e)} 3968 </wui-flex> 3969 `}renderActiveConnections(e){const n=this.getActiveConnections(e),i=this.activeConnectorIds[e],s=this.getPlainAddress();return se` 3970 ${s||i||n.length>0?se`<wui-flex 3971 flexDirection="column" 3972 .padding=${["4","0","4","0"]} 3973 class="active-wallets" 3974 > 3975 ${this.renderActiveProfile(e)} ${this.renderActiveConnectionsList(e)} 3976 </wui-flex>`:null} 3977 ${this.renderRecentConnections(e)} 3978 `}renderActiveProfile(e){const n=this.activeConnectorIds[e];if(!n)return null;const{connections:i}=Oc.getConnectionsData(e),s=Oe.getConnectorById(n),r=qi.getConnectorImage(s),o=this.getPlainAddress();if(!o)return null;const a=e===we.CHAIN.BITCOIN,c=nk.getAuthData({connectorId:n,accounts:[]}),l=this.getActiveConnections(e).flatMap(p=>p.accounts).length>0,d=i.find(p=>p.connectorId===n),h=d==null?void 0:d.accounts.filter(p=>!tr.isLowerCaseMatch(p.address,o));return se` 3979 <wui-flex flexDirection="column" .padding=${["0","4","0","4"]}> 3980 <wui-active-profile-wallet-item 3981 address=${o} 3982 alt=${s==null?void 0:s.name} 3983 .content=${this.getProfileContent({address:o,connections:i,connectorId:n,namespace:e})} 3984 .charsStart=${pl.ADDRESS_DISPLAY.START} 3985 .charsEnd=${pl.ADDRESS_DISPLAY.END} 3986 .icon=${c.icon} 3987 .iconSize=${c.iconSize} 3988 .iconBadge=${this.isSmartAccount(o)?pl.BADGE.ICON:void 0} 3989 .iconBadgeSize=${this.isSmartAccount(o)?pl.BADGE.SIZE:void 0} 3990 imageSrc=${r} 3991 ?enableMoreButton=${c.isAuth} 3992 @copy=${()=>this.handleCopyAddress(o)} 3993 @disconnect=${()=>this.handleDisconnect(e,n)} 3994 @switch=${()=>{a&&d&&(h!=null&&h[0])&&this.handleSwitchWallet(d,h[0].address,e)}} 3995 @externalLink=${()=>this.handleExternalLink(o)} 3996 @more=${()=>this.handleMore()} 3997 data-testid="wui-active-profile-wallet-item" 3998 ></wui-active-profile-wallet-item> 3999 ${l?se`<wui-separator></wui-separator>`:null} 4000 </wui-flex> 4001 `}renderActiveConnectionsList(e){const n=this.getActiveConnections(e);return n.length===0?null:se` 4002 <wui-flex flexDirection="column" .padding=${["0","2","0","2"]}> 4003 ${this.renderConnectionList(n,!1,e)} 4004 </wui-flex> 4005 `}renderRecentConnections(e){const{recentConnections:n}=Oc.getConnectionsData(e);return n.flatMap(s=>s.accounts).length===0?null:se` 4006 <wui-flex flexDirection="column" .padding=${["0","2","0","2"]} rowGap="2"> 4007 <wui-text color="secondary" variant="sm-medium" data-testid="recently-connected-text" 4008 >RECENTLY CONNECTED</wui-text 4009 > 4010 <wui-flex flexDirection="column" .padding=${["0","2","0","2"]}> 4011 ${this.renderConnectionList(n,!0,e)} 4012 </wui-flex> 4013 </wui-flex> 4014 `}renderConnectionList(e,n,i){return e.filter(s=>s.accounts.length>0).map((s,r)=>{const o=Oe.getConnectorById(s.connectorId),a=qi.getConnectorImage(o)??"",c=nk.getAuthData(s);return s.accounts.map((l,d)=>{const h=r!==0||d!==0,p=this.isAccountLoading(s.connectorId,l.address);return se` 4015 <wui-flex flexDirection="column"> 4016 ${h?se`<wui-separator></wui-separator>`:null} 4017 <wui-inactive-profile-wallet-item 4018 address=${l.address} 4019 alt=${s.connectorId} 4020 buttonLabel=${n?"Connect":"Switch"} 4021 buttonVariant=${n?"neutral-secondary":"accent-secondary"} 4022 rightIcon=${n?"bin":"power"} 4023 rightIconSize="sm" 4024 class=${n?"recent-connection":"active-connection"} 4025 data-testid=${n?"recent-connection":"active-connection"} 4026 imageSrc=${a} 4027 .iconBadge=${this.isSmartAccount(l.address)?pl.BADGE.ICON:void 0} 4028 .iconBadgeSize=${this.isSmartAccount(l.address)?pl.BADGE.SIZE:void 0} 4029 .icon=${c.icon} 4030 .iconSize=${c.iconSize} 4031 .loading=${p} 4032 .showBalance=${!1} 4033 .charsStart=${pl.ADDRESS_DISPLAY.START} 4034 .charsEnd=${pl.ADDRESS_DISPLAY.END} 4035 @buttonClick=${()=>this.handleSwitchWallet(s,l.address,i)} 4036 @iconClick=${()=>this.handleWalletAction({connection:s,address:l.address,isRecentConnection:n,namespace:i})} 4037 ></wui-inactive-profile-wallet-item> 4038 </wui-flex> 4039 `})})}renderAddConnectionButton(e){if(!this.isMultiWalletEnabled()&&this.caipAddress||!this.hasAnyConnections(e))return null;const{title:n}=this.getChainLabelInfo(e);return se` 4040 <wui-list-item 4041 variant="icon" 4042 iconVariant="overlay" 4043 icon="plus" 4044 iconSize="sm" 4045 ?chevron=${!0} 4046 @click=${()=>this.handleAddConnection(e)} 4047 data-testid="add-connection-button" 4048 > 4049 <wui-text variant="md-medium" color="secondary">${n}</wui-text> 4050 </wui-list-item> 4051 `}renderEmptyState(e){const{title:n,description:i}=this.getChainLabelInfo(e);return se` 4052 <wui-flex alignItems="flex-start" class="empty-template" data-testid="empty-template"> 4053 <wui-flex 4054 flexDirection="column" 4055 alignItems="center" 4056 justifyContent="center" 4057 rowgap="3" 4058 class="empty-box" 4059 > 4060 <wui-icon-box size="xl" icon="wallet" color="secondary"></wui-icon-box> 4061 4062 <wui-flex flexDirection="column" alignItems="center" justifyContent="center" gap="1"> 4063 <wui-text color="primary" variant="lg-regular" data-testid="empty-state-text" 4064 >No wallet connected</wui-text 4065 > 4066 <wui-text color="secondary" variant="md-regular" data-testid="empty-state-description" 4067 >${i}</wui-text 4068 > 4069 </wui-flex> 4070 4071 <wui-link 4072 @click=${()=>this.handleAddConnection(e)} 4073 data-testid="empty-state-button" 4074 icon="plus" 4075 > 4076 ${n} 4077 </wui-link> 4078 </wui-flex> 4079 </wui-flex> 4080 `}handleTabChange(e){var i,s,r;const n=this.namespaces[e];n&&((i=this.chainListener)==null||i.call(this),this.currentTab=this.namespaces.indexOf(n),this.namespace=n,this.caipAddress=(s=ne.getAccountData(n))==null?void 0:s.caipAddress,this.profileName=(r=ne.getAccountData(n))==null?void 0:r.profileName,this.chainListener=ne.subscribeChainProp("accountState",o=>{this.caipAddress=o==null?void 0:o.caipAddress},n))}async handleSwitchWallet(e,n,i){var s;try{this.isSwitching=!0,this.lastSelectedConnectorId=e.connectorId,this.lastSelectedAddress=n,((s=this.caipNetwork)==null?void 0:s.chainNamespace)!==i&&(e!=null&&e.caipNetwork)&&(Oe.setFilterByNamespace(i),await ne.switchActiveNetwork(e==null?void 0:e.caipNetwork)),await Ve.switchConnection({connection:e,address:n,namespace:i,closeModalOnConnect:!1,onChange({hasSwitchedAccount:o,hasSwitchedWallet:
4080a}){a?ti.showSuccess("Wallet switched"):o&&ti.showSuccess("Account switched")}})}catch{ti.showError("Failed to switch wallet")}finally{this.isSwitching=!1}}handleWalletAction(e){const{connection:n,address:i,isRecentConnection:s,namespace:r}=e;s?(He.deleteAddressFromConnection({connectorId:n.connectorId,address:i,namespace:r}),Ve.syncStorageConnections(),ti.showSuccess("Wallet deleted")):this.handleDisconnect(r,n.connectorId)}async handleDisconnect(e,n){try{await Ve.disconnect({id:n,namespace:e}),ti.showSuccess("Wallet disconnected")}catch{ti.showError("Failed to disconnect wallet")}}handleCopyAddress(e){Ue.copyToClopboard(e),ti.showSuccess("Address copied")}handleMore(){Pe.push("AccountSettings")}handleExternalLink(e){var i,s;const n=(s=(i=this.caipNetwork)==null?void 0:i.blockExplorers)==null?void 0:s.default.url;n&&Ue.openHref(`${n}/address/${e}`,"_blank")}handleAddConnection(e){Oe.setFilterByNamespace(e),Pe.push("Connect",{addWalletForNamespace:e})}getChainLabelInfo(e){return xje[e]??{title:"Add Wallet",description:"Add your first wallet"}}isSmartAccount(e){var i,s;if(!this.namespace)return!1;const n=(s=(i=this.user)==null?void 0:i.accounts)==null?void 0:s.find(r=>r.type==="smartAccount");return n&&e?tr.isLowerCaseMatch(n.address,e):!1}getPlainAddress(){return this.caipAddress?Ue.getPlainAddress(this.caipAddress):void 0}getActiveConnections(e){const n=this.activeConnectorIds[e],{connections:i}=Oc.getConnectionsData(e),[s]=i.filter(c=>tr.isLowerCaseMatch(c.connectorId,n));if(!n)return i;const r=e===we.CHAIN.BITCOIN,{address:o}=this.caipAddress?Lr.parseCaipAddress(this.caipAddress):{};let a=[...o?[o]:[]];return r&&s&&(a=s.accounts.map(c=>c.address)||[]),Oc.excludeConnectorAddressFromConnections({connectorId:n,addresses:a,connections:i})}hasAnyConnections(e){const n=this.getActiveConnections(e),{recentConnections:i}=Oc.getConnectionsData(e);return!!this.caipAddress||n.length>0||i.length>0}isAccountLoading(e,n){return tr.isLowerCaseMatch(this.lastSelectedConnectorId,e)&&tr.isLowerCaseMatch(this.lastSelectedAddress,n)&&this.isSwitching}getProfileContent(e){const{address:n,connections:i,connectorId:s,namespace:r}=e,[o]=i.filter(c=>tr.isLowerCaseMatch(c.connectorId,s));if(r===we.CHAIN.BITCOIN&&(o!=null&&o.accounts.every(c=>typeof c.type=="string")))return this.getBitcoinProfileContent(o.accounts,n);const a=nk.getAuthData({connectorId:s,accounts:[]});return[{address:n,tagLabel:"Active",tagVariant:"success",enableButton:!0,profileName:this.profileName,buttonType:"disconnect",buttonLabel:"Disconnect",buttonVariant:"neutral-secondary",...a.isAuth?{description:this.isSmartAccount(n)?"Smart Account":"EOA Account"}:{}}]}getBitcoinProfileContent(e,n){const i=e.length>1,s=this.getPlainAddress();return e.map(r=>{const o=tr.isLowerCaseMatch(r.address,s);let a="PAYMENT";return r.type==="ordinal"&&(a="ORDINALS"),{address:r.address,tagLabel:tr.isLowerCaseMatch(r.address,n)?"Active":void 0,tagVariant:tr.isLowerCaseMatch(r.address,n)?"success":void 0,enableButton:!0,...i?{label:a,alignItems:"flex-end",buttonType:o?"disconnect":"switch",buttonLabel:o?"Disconnect":"Switch",buttonVariant:o?"neutral-secondary":"accent-secondary"}:{alignItems:"center",buttonType:"disconnect",buttonLabel:"Disconnect",buttonVariant:"neutral-secondary"}}})}removeScrollListener(){var n;const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".wallet-list");e&&e.removeEventListener("scroll",()=>this.handleConnectListScroll())}handleConnectListScroll(){var n;const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".wallet-list");e&&this.updateScrollOpacity(e)}isMultiWalletEnabled(){var e;return!!((e=this.remoteFeatures)!=null&&e.multiWallet)}updateScrollOpacity(e){e.style.setProperty("--connect-scroll--top-opacity",N_.interpolate([0,pl.SCROLL_THRESHOLD],pl.OPACITY_RANGE,e.scrollTop).toString()),e.style.setProperty("--connect-scroll--bottom-opacity",N_.interpolate([0,pl.SCROLL_THRESHOLD],pl.OPACITY_RANGE,e.scrollHeight-e.scrollTop-e.offsetHeight).toString())}onConnectionsChange(){if(this.isMultiWalletEnabled()&&this.namespace){const{connections:e}=Oc.getConnectionsData(this.namespace);e.length===0&&Pe.reset("ProfileWallets")}this.requestUpdate()}};Ko.styles=vje;Zc([Me()],Ko.prototype,"currentTab",void 0);Zc([Me()],Ko.prototype,"namespace",void 0);Zc([Me()],Ko.prototype,"namespaces",void 0);Zc([Me()],Ko.prototype,"caipAddress",void 0);Zc([Me()],Ko.prototype,"profileName",void 0);Zc([Me()],Ko.prototype,"activeConnectorIds",void 0);Zc([Me()],Ko.prototype,"lastSelectedAddress",void 0);Zc([Me()],Ko.prototype,"lastSelectedConnectorId",void 0);Zc([Me()],Ko.prototype,"isSwitching",void 0);Zc([Me()],Ko.prototype,"caipNetwork",void 0);Zc([Me()],Ko.prototype,"user",void 0);Zc([Me()],Ko.prototype,"remoteFeatures",void 0);Ko=Zc([Qe("w3m-profile-wallets-view")],Ko);var Yb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
4080a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Pp=class extends tt{constructor(){super(),this.unsubscribe=[],this.activeCaipNetwork=ne.state.activeCaipNetwork,this.features=ye.state.features,this.remoteFeatures=ye.state.remoteFeatures,this.exchangesLoading=Ir.state.isLoading,this.exchanges=Ir.state.exchanges,this.unsubscribe.push(ye.subscribeKey("features",e=>this.features=e),ye.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e),ne.subscribeKey("activeCaipNetwork",e=>{this.activeCaipNetwork=e,this.setDefaultPaymentAsset()}),Ir.subscribeKey("isLoading",e=>this.exchangesLoading=e),Ir.subscribeKey("exchanges",e=>this.exchanges=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}async firstUpdated(){Ir.isPayWithExchangeSupported()&&(await this.setDefaultPaymentAsset(),await Ir.fetchExchanges())}render(){return se` 4081 <wui-flex flexDirection="column" .padding=${["1","3","3","3"]} gap="2"> 4082 ${this.onrampTemplate()} ${this.receiveTemplate()} ${this.depositFromExchangeTemplate()} 4083 </wui-flex> 4084 `}async setDefaultPaymentAsset(){if(!this.activeCaipNetwork)return;const e=await Ir.getAssetsForNetwork(this.activeCaipNetwork.caipNetworkId),n=e.find(i=>i.metadata.symbol==="USDC")||e[0];n&&Ir.setPaymentAsset(n)}onrampTemplate(){var i;if(!this.activeCaipNetwork)return null;const e=(i=this.remoteFeatures)==null?void 0:i.onramp,n=fn.ONRAMP_SUPPORTED_CHAIN_NAMESPACES.includes(this.activeCaipNetwork.chainNamespace);return!e||!n?null:se` 4085 <wui-list-item 4086 @click=${this.onBuyCrypto.bind(this)} 4087 icon="card" 4088 data-testid="wallet-features-onramp-button" 4089 > 4090 <wui-text variant="lg-regular" color="primary">Buy crypto</wui-text> 4091 </wui-list-item> 4092 `}depositFromExchangeTemplate(){return!this.activeCaipNetwork||!Ir.isPayWithExchangeSupported()?null:se` 4093 <wui-list-item 4094 @click=${this.onDepositFromExchange.bind(this)} 4095 icon="arrowBottomCircle" 4096 data-testid="wallet-features-deposit-from-exchange-button" 4097 ?loading=${this.exchangesLoading} 4098 ?disabled=${this.exchangesLoading||!this.exchanges.length} 4099 > 4100 <wui-text variant="lg-regular" color="primary">Deposit from exchange</wui-text> 4101 </wui-list-item> 4102 `}receiveTemplate(){var n;return!((n=this.features)!=null&&n.receive)?null:se` 4103 <wui-list-item 4104 @click=${this.onReceive.bind(this)} 4105 icon="qrCode" 4106 data-testid="wallet-features-receive-button" 4107 > 4108 <wui-text variant="lg-regular" color="primary">Receive funds</wui-text> 4109 </wui-list-item> 4110 `}onBuyCrypto(){Pe.push("OnRampProviders")}onReceive(){Pe.push("WalletReceive")}onDepositFromExchange(){var e;Ir.reset(),Pe.push("PayWithExchange",{redirectView:(e=Pe.state.data)==null?void 0:e.redirectView})}};Yb([Me()],Pp.prototype,"activeCaipNetwork",void 0);Yb([Me()],Pp.prototype,"features",void 0);Yb([Me()],Pp.prototype,"remoteFeatures",void 0);Yb([Me()],Pp.prototype,"exchangesLoading",void 0);Yb([Me()],Pp.prototype,"exchanges",void 0);Pp=Yb([Qe("w3m-fund-wallet-view")],Pp);/** 4111 * @license 4112 * Copyright 2020 Google LLC 4113 * SPDX-License-Identifier: BSD-3-Clause 4114 */const Eje=t=>t.strings===void 0;/** 4115 * @license 4116 * Copyright 2017 Google LLC 4117 * SPDX-License-Identifier: BSD-3-Clause 4118 */const C3=(t,e)=>{var i;const n=t._$AN;if(n===void 0)return!1;for(const s of n)(i=s._$AO)==null||i.call(s,e,!1),C3(s,e);return!0},V_=t=>{let e,n;do{if((e=t._$AM)===void 0)break;n=e._$AN,n.delete(t),t=e}while((n==null?void 0:n.size)===0)},fre=t=>{for(let e;e=t._$AM;t=e){let n=e._$AN;if(n===void 0)e._$AN=n=new Set;else if(n.has(t))break;n.add(t),Aje(e)}};function _je(t){this._$AN!==void 0?(V_(this),this._$AM=t,fre(this)):this._$AM=t}function Sje(t,e=!1,n=0){const i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(i))for(let r=n;r<i.length;r++)C3(i[r],!1),V_(i[r]);else i!=null&&(C3(i,!1),V_(i));else C3(this,t)}const Aje=t=>{t.type==ore.CHILD&&(t._$AP??(t._$AP=Sje),t._$AQ??(t._$AQ=_je))};let Tje=class extends cre{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,n,i){super._$AT(e,n,i),fre(this),this.isConnected=e._$AU}_$AO(e,n=!0){var i,s;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(s=this.disconnected)==null||s.call(this)),n&&(C3(this,e),V_(this))}setValue(e){if(Eje(this._$Ct))this._$Ct._$AI(e,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=e,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}};/** 4119 * @license 4120 * Copyright 2020 Google LLC 4121 * SPDX-License-Identifier: BSD-3-Clause 4122 */const n4=()=>new kje;let kje=class{};const ik=new WeakMap,i4=are(class extends Tje{render(t){return ir}update(t,[e]){var i;const n=e!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=e,this.ht=(i=t.options)==null?void 0:i.host,this.rt(this.ct=t.element)),ir}rt(t){if(this.isConnected||(t=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let n=ik.get(e);n===void 0&&(n=new WeakMap,ik.set(e,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,t),t!==void 0&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){var t,e;return typeof this.G=="function"?(t=ik.get(this.ht??globalThis))==null?void 0:t.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Nje=It` 4123 :host { 4124 display: flex; 4125 align-items: center; 4126 justify-content: center; 4127 } 4128 4129 label { 4130 position: relative; 4131 display: inline-block; 4132 user-select: none; 4133 transition: 4134 background-color ${({durations:t})=>t.lg} 4135 ${({easings:t})=>t["ease-out-power-2"]}, 4136 color ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4137 border ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4138 box-shadow ${({durations:t})=>t.lg} 4139 ${({easings:t})=>t["ease-out-power-2"]}, 4140 width ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4141 height ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4142 transform ${({durations:t})=>t.lg} 4143 ${({easings:t})=>t["ease-out-power-2"]}, 4144 opacity ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}; 4145 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 4146 } 4147 4148 input { 4149 width: 0; 4150 height: 0; 4151 opacity: 0; 4152 } 4153 4154 span { 4155 position: absolute; 4156 cursor: pointer; 4157 top: 0; 4158 left: 0; 4159 right: 0; 4160 bottom: 0; 4161 background-color: ${({colors:t})=>t.neutrals300}; 4162 border-radius: ${({borderRadius:t})=>t.round}; 4163 border: 1px solid transparent; 4164 will-change: border; 4165 transition: 4166 background-color ${({durations:t})=>t.lg} 4167 ${({easings:t})=>t["ease-out-power-2"]}, 4168 color ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4169 border ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4170 box-shadow ${({durations:t})=>t.lg} 4171 ${({easings:t})=>t["ease-out-power-2"]}, 4172 width ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4173 height ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 4174 transform ${({durations:t})=>t.lg} 4175 ${({easings:t})=>t["ease-out-power-2"]}, 4176 opacity ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}; 4177 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 4178 } 4179 4180 span:before { 4181 content: ''; 4182 position: absolute; 4183 background-color: ${({colors:t})=>t.white}; 4184 border-radius: 50%; 4185 } 4186 4187 /* -- Sizes --------------------------------------------------------- */ 4188 label[data-size='lg'] { 4189 width: 48px; 4190 height: 32px; 4191 } 4192 4193 label[data-size='md'] { 4194 width: 40px; 4195 height: 28px; 4196 } 4197 4198 label[data-size='sm'] { 4199 width: 32px; 4200 height: 22px; 4201 } 4202 4203 label[data-size='lg'] > span:before { 4204 height: 24px; 4205 width: 24px; 4206 left: 4px; 4207 top: 3px; 4208 } 4209 4210 label[data-size='md'] > span:before { 4211 height: 20px;
4212 width: 20px; 4213 left: 4px; 4214 top: 3px; 4215 } 4216 4217 label[data-size='sm'] > span:before { 4218 height: 16px; 4219 width: 16px; 4220 left: 3px; 4221 top: 2px; 4222 } 4223 4224 /* -- Focus states --------------------------------------------------- */ 4225 input:focus-visible:not(:checked) + span, 4226 input:focus:not(:checked) + span { 4227 border: 1px solid ${({tokens:t})=>t.core.iconAccentPrimary}; 4228 background-color: ${({tokens:t})=>t.theme.textTertiary}; 4229 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 4230 } 4231 4232 input:focus-visible:checked + span, 4233 input:focus:checked + span { 4234 border: 1px solid ${({tokens:t})=>t.core.iconAccentPrimary}; 4235 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 4236 } 4237 4238 /* -- Checked states --------------------------------------------------- */ 4239 input:checked + span { 4240 background-color: ${({tokens:t})=>t.core.iconAccentPrimary}; 4241 } 4242 4243 label[data-size='lg'] > input:checked + span:before { 4244 transform: translateX(calc(100% - 9px)); 4245 } 4246 4247 label[data-size='md'] > input:checked + span:before { 4248 transform: translateX(calc(100% - 9px)); 4249 } 4250 4251 label[data-size='sm'] > input:checked + span:before { 4252 transform: translateX(calc(100% - 7px)); 4253 } 4254 4255 /* -- Hover states ------------------------------------------------------- */ 4256 label:hover > input:not(:checked):not(:disabled) + span { 4257 background-color: ${({colors:t})=>t.neutrals400}; 4258 } 4259 4260 label:hover > input:checked:not(:disabled) + span { 4261 background-color: ${({colors:t})=>t.accent080}; 4262 } 4263 4264 /* -- Disabled state --------------------------------------------------- */ 4265 label:has(input:disabled) { 4266 pointer-events: none; 4267 user-select: none; 4268 } 4269 4270 input:not(:checked):disabled + span { 4271 background-color: ${({colors:t})=>t.neutrals700}; 4272 } 4273 4274 input:checked:disabled + span { 4275 background-color: ${({colors:t})=>t.neutrals700}; 4276 } 4277 4278 input:not(:checked):disabled + span::before { 4279 background-color: ${({colors:t})=>t.neutrals400}; 4280 } 4281 4282 input:checked:disabled + span::before { 4283 background-color: ${({tokens:t})=>t.theme.textTertiary}; 4284 } 4285`;var RS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let db=class extends tt{constructor(){super(...arguments),this.inputElementRef=n4(),this.checked=!1,this.disabled=!1,this.size="md"}render(){return se` 4286 <label data-size=${this.size}> 4287 <input 4288 ${i4(this.inputElementRef)} 4289 type="checkbox" 4290 ?checked=${this.checked} 4291 ?disabled=${this.disabled} 4292 @change=${this.dispatchChangeEvent.bind(this)} 4293 /> 4294 <span></span> 4295 </label> 4296 `}dispatchChangeEvent(){var e;this.dispatchEvent(new CustomEvent("switchChange",{detail:(e=this.inputElementRef.value)==null?void 0:e.checked,bubbles:!0,composed:!0}))}};db.styles=[vn,Gi,Nje];RS([le({type:Boolean})],db.prototype,"checked",void 0);RS([le({type:Boolean})],db.prototype,"disabled",void 0);RS([le()],db.prototype,"size",void 0);db=RS([Qe("wui-toggle")],db);const Rje=It` 4297 :host { 4298 height: auto; 4299 } 4300 4301 :host > wui-flex { 4302 height: 100%; 4303 display: flex; 4304 align-items: center; 4305 justify-content: center; 4306 column-gap: ${({spacing:t})=>t[2]}; 4307 padding: ${({spacing:t})=>t[2]} ${({spacing:t})=>t[3]}; 4308 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 4309 border-radius: ${({borderRadius:t})=>t[4]}; 4310 box-shadow: inset 0 0 0 1px ${({tokens:t})=>t.theme.foregroundPrimary}; 4311 transition: background-color ${({durations:t})=>t.lg} 4312 ${({easings:t})=>t["ease-out-power-2"]}; 4313 will-change: background-color; 4314 cursor: pointer; 4315 } 4316 4317 wui-switch { 4318 pointer-events: none; 4319 } 4320`;var pre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
4320a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let W_=class extends tt{constructor(){super(...arguments),this.checked=!1}render(){return se` 4321 <wui-flex> 4322 <wui-icon size="xl" name="walletConnectBrown"></wui-icon> 4323 <wui-toggle 4324 ?checked=${this.checked} 4325 size="sm" 4326 @switchChange=${this.handleToggleChange.bind(this)} 4327 ></wui-toggle> 4328 </wui-flex> 4329 `}handleToggleChange(e){e.stopPropagation(),this.checked=e.detail,this.dispatchSwitchEvent()}dispatchSwitchEvent(){this.dispatchEvent(new CustomEvent("certifiedSwitchChange",{detail:this.checked,bubbles:!0,composed:!0}))}};W_.styles=[vn,Gi,Rje];pre([le({type:Boolean})],W_.prototype,"checked",void 0);W_=pre([Qe("wui-certified-switch")],W_);const Pje=It` 4330 :host { 4331 position: relative; 4332 width: 100%; 4333 display: inline-flex; 4334 flex-direction: column; 4335 gap: ${({spacing:t})=>t[3]}; 4336 color: ${({tokens:t})=>t.theme.textPrimary}; 4337 caret-color: ${({tokens:t})=>t.core.textAccentPrimary}; 4338 } 4339 4340 .wui-input-text-container { 4341 position: relative; 4342 display: flex; 4343 } 4344 4345 input { 4346 width: 100%; 4347 border-radius: ${({borderRadius:t})=>t[4]}; 4348 color: inherit; 4349 background: transparent; 4350 border: 1px solid ${({tokens:t})=>t.theme.borderPrimary}; 4351 caret-color: ${({tokens:t})=>t.core.textAccentPrimary}; 4352 padding: ${({spacing:t})=>t[3]} ${({spacing:t})=>t[3]} 4353 ${({spacing:t})=>t[3]} ${({spacing:t})=>t[10]}; 4354 font-size: ${({textSize:t})=>t.large}; 4355 line-height: ${({typography:t})=>t["lg-regular"].lineHeight}; 4356 letter-spacing: ${({typography:t})=>t["lg-regular"].letterSpacing}; 4357 font-weight: ${({fontWeight:t})=>t.regular}; 4358 font-family: ${({fontFamily:t})=>t.regular}; 4359 } 4360 4361 input[data-size='lg'] { 4362 padding: ${({spacing:t})=>t[4]} ${({spacing:t})=>t[3]} 4363 ${({spacing:t})=>t[4]} ${({spacing:t})=>t[10]}; 4364 } 4365 4366 @media (hover: hover) and (pointer: fine) { 4367 input:hover:enabled { 4368 border: 1px solid ${({tokens:t})=>t.theme.borderSecondary}; 4369 } 4370 } 4371 4372 input:disabled { 4373 cursor: unset; 4374 border: 1px solid ${({tokens:t})=>t.theme.borderPrimary}; 4375 } 4376 4377 input::placeholder { 4378 color: ${({tokens:t})=>t.theme.textSecondary}; 4379 } 4380 4381 input:focus:enabled { 4382 border: 1px solid ${({tokens:t})=>t.theme.borderSecondary}; 4383 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 4384 -webkit-box-shadow: 0px 0px 0px 4px ${({tokens:t})=>t.core.foregroundAccent040}; 4385 -moz-box-shadow: 0px 0px 0px 4px ${({tokens:t})=>t.core.foregroundAccent040}; 4386 box-shadow: 0px 0px 0px 4px ${({tokens:t})=>t.core.foregroundAccent040}; 4387 } 4388 4389 div.wui-input-text-container:has(input:disabled) { 4390 opacity: 0.5; 4391 } 4392 4393 wui-icon.wui-input-text-left-icon { 4394 position: absolute; 4395 top: 50%; 4396 transform: translateY(-50%); 4397 pointer-events: none; 4398 left: ${({spacing:t})=>t[4]}; 4399 color: ${({tokens:t})=>t.theme.iconDefault}; 4400 } 4401 4402 button.wui-input-text-submit-button { 4403 position: absolute; 4404 top: 50%; 4405 transform: translateY(-50%); 4406 right: ${({spacing:t})=>t[3]}; 4407 width: 24px; 4408 height: 24px; 4409 border: none; 4410 background: transparent; 4411 border-radius: ${({borderRadius:t})=>t[2]}; 4412 color: ${({tokens:t})=>t.core.textAccentPrimary}; 4413 } 4414 4415 button.wui-input-text-submit-button:disabled { 4416 opacity: 1; 4417 } 4418 4419 button.wui-input-text-submit-button.loading wui-icon { 4420 animation: spin 1s linear infinite; 4421 } 4422 4423 button.wui-input-text-submit-button:hover { 4424 background: ${({tokens:t})=>t.core.foregroundAccent010}; 4425 } 4426 4427 input:has(+ .wui-input-text-submit-button) { 4428 padding-right: ${({spacing:t})=>t[12]}; 4429 } 4430 4431 input[type='number'] { 4432 -moz-appearance: textfield; 4433 } 4434 4435 input[type='search']::-webkit-search-decoration, 4436 input[type='search']::-webkit-search-cancel-button, 4437 input[type='search']::-webkit-search-results-button, 4438 input[type='search']::-webkit-search-results-decoration { 4439 -webkit-appearance: none; 4440 } 4441 4442 /* -- Keyframes --------------------------------------------------- */ 4443 @keyframes spin { 4444 from { 4445 transform: rotate(0deg); 4446 } 4447 to { 4448 transform: rotate(360deg); 4449 } 4450 } 4451`;var jl=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
4451a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let tc=class extends tt{constructor(){super(...arguments),this.inputElementRef=n4(),this.disabled=!1,this.loading=!1,this.placeholder="",this.type="text",this.value="",this.size="md"}render(){return se` <div class="wui-input-text-container"> 4452 ${this.templateLeftIcon()} 4453 <input 4454 data-size=${this.size} 4455 ${i4(this.inputElementRef)} 4456 data-testid="wui-input-text" 4457 type=${this.type} 4458 enterkeyhint=${xt(this.enterKeyHint)} 4459 ?disabled=${this.disabled} 4460 placeholder=${this.placeholder} 4461 @input=${this.dispatchInputChangeEvent.bind(this)} 4462 @keydown=${this.onKeyDown} 4463 .value=${this.value||""} 4464 /> 4465 ${this.templateSubmitButton()} 4466 <slot class="wui-input-text-slot"></slot> 4467 </div> 4468 ${this.templateError()} ${this.templateWarning()}`}templateLeftIcon(){return this.icon?se`<wui-icon 4469 class="wui-input-text-left-icon" 4470 size="md" 4471 data-size=${this.size} 4472 color="inherit" 4473 name=${this.icon} 4474 ></wui-icon>`:null}templateSubmitButton(){var e;return this.onSubmit?se`<button 4475 class="wui-input-text-submit-button ${this.loading?"loading":""}" 4476 @click=${(e=this.onSubmit)==null?void 0:e.bind(this)} 4477 ?disabled=${this.disabled||this.loading} 4478 > 4479 ${this.loading?se`<wui-icon name="spinner" size="md"></wui-icon>`:se`<wui-icon name="chevronRight" size="md"></wui-icon>`} 4480 </button>`:null}templateError(){return this.errorText?se`<wui-text variant="sm-regular" color="error">${this.errorText}</wui-text>`:null}templateWarning(){return this.warningText?se`<wui-text variant="sm-regular" color="warning">${this.warningText}</wui-text>`:null}dispatchInputChangeEvent(){var e;this.dispatchEvent(new CustomEvent("inputChange",{detail:(e=this.inputElementRef.value)==null?void 0:e.value,bubbles:!0,composed:!0}))}};tc.styles=[vn,Gi,Pje];jl([le()],tc.prototype,"icon",void 0);jl([le({type:Boolean})],tc.prototype,"disabled",void 0);jl([le({type:Boolean})],tc.prototype,"loading",void 0);jl([le()],tc.prototype,"placeholder",void 0);jl([le()],tc.prototype,"type",void 0);jl([le()],tc.prototype,"value",void 0);jl([le()],tc.prototype,"errorText",void 0);jl([le()],tc.prototype,"warningText",void 0);jl([le()],tc.prototype,"onSubmit",void 0);jl([le()],tc.prototype,"size",void 0);jl([le({attribute:!1})],tc.prototype,"onKeyDown",void 0);tc=jl([Qe("wui-input-text")],tc);const Ije=It` 4481 :host { 4482 position: relative; 4483 display: inline-block; 4484 width: 100%; 4485 } 4486 4487 wui-icon { 4488 position: absolute; 4489 top: 50%; 4490 transform: translateY(-50%); 4491 right: ${({spacing:t})=>t[3]}; 4492 color: ${({tokens:t})=>t.theme.iconDefault}; 4493 cursor: pointer; 4494 padding: ${({spacing:t})=>t[2]}; 4495 background-color: transparent; 4496 border-radius: ${({borderRadius:t})=>t[4]}; 4497 transition: background-color ${({durations:t})=>t.lg} 4498 ${({easings:t})=>t["ease-out-power-2"]}; 4499 } 4500 4501 @media (hover: hover) { 4502 wui-icon:hover { 4503 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 4504 } 4505 } 4506`;var mre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let q_=class extends tt{constructor(){super(...arguments),this.inputComponentRef=n4(),this.inputValue=""}render(){return se` 4507 <wui-input-text 4508 ${i4(this.inputComponentRef)} 4509 placeholder="Search wallet" 4510 icon="search" 4511 type="search" 4512 enterKeyHint="search" 4513 size="sm" 4514 @inputChange=${this.onInputChange} 4515 > 4516 ${this.inputValue?se`<wui-icon 4517 @click=${this.clearValue} 4518 color="inherit" 4519 size="sm" 4520 name="close" 4521 ></wui-icon>`:null} 4522 </wui-input-text> 4523 `}onInputChange(e){this.inputValue=e.detail||""}clearValue(){const e=this.inputComponentRef.value,n=e==null?void 0:e.inputElementRef.value;n&&(n.value="",this.inputValue="",n.focus(),n.dispatchEvent(new Event("input")))}};q_.styles=[vn,Ije];mre([le()],q_.prototype,"inputValue",void 0);q_=mre([Qe("wui-search-bar")],q_);const gre=Tn`<svg viewBox="0 0 48 54" fill="none"> 4524 <path 4525 d="M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.951
45255 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z" 4526 /> 4527</svg>`,Dje=It` 4528 :host { 4529 display: flex; 4530 flex-direction: column; 4531 justify-content: center; 4532 align-items: center; 4533 height: 104px; 4534 width: 104px; 4535 row-gap: ${({spacing:t})=>t[2]}; 4536 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 4537 border-radius: ${({borderRadius:t})=>t[5]}; 4538 position: relative; 4539 } 4540 4541 wui-shimmer[data-type='network'] { 4542 border: none; 4543 -webkit-clip-path: var(--apkt-path-network); 4544 clip-path: var(--apkt-path-network); 4545 } 4546 4547 svg { 4548 position: absolute; 4549 width: 48px; 4550 height: 54px; 4551 z-index: 1; 4552 } 4553 4554 svg > path { 4555 stroke: ${({tokens:t})=>t.theme.foregroundSecondary}; 4556 stroke-width: 1px; 4557 } 4558 4559 @media (max-width: 350px) { 4560 :host { 4561 width: 100%; 4562 } 4563 } 4564`;var yre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let z_=class extends tt{constructor(){super(...arguments),this.type="wallet"}render(){return se` 4565 ${this.shimmerTemplate()} 4566 <wui-shimmer width="80px" height="20px"></wui-shimmer> 4567 `}shimmerTemplate(){return this.type==="network"?se` <wui-shimmer data-type=${this.type} width="48px" height="54px"></wui-shimmer> 4568 ${gre}`:se`<wui-shimmer width="56px" height="56px"></wui-shimmer>`}};z_.styles=[vn,Gi,Dje];yre([le()],z_.prototype,"type",void 0);z_=yre([Qe("wui-card-select-loader")],z_);const Oje=os` 4569 :host { 4570 display: grid; 4571 width: inherit; 4572 height: inherit; 4573 } 4574`;var Vl=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let nc=class extends tt{render(){return this.style.cssText=` 4575 grid-template-rows: ${this.gridTemplateRows}; 4576 grid-template-columns: ${this.gridTemplateColumns}; 4577 justify-items: ${this.justifyItems}; 4578 align-items: ${this.alignItems}; 4579 justify-content: ${this.justifyContent}; 4580 align-content: ${this.alignContent}; 4581 column-gap: ${this.columnGap&&`var(--apkt-spacing-${this.columnGap})`}; 4582 row-gap: ${this.rowGap&&`var(--apkt-spacing-${this.rowGap})`}; 4583 gap: ${this.gap&&`var(--apkt-spacing-${this.gap})`}; 4584 padding-top: ${this.padding&&ds.getSpacingStyles(this.padding,0)}; 4585 padding-right: ${this.padding&&ds.getSpacingStyles(this.padding,1)}; 4586 padding-bottom: ${this.padding&&ds.getSpacingStyles(this.padding,2)}; 4587 padding-left: ${this.padding&&ds.getSpacingStyles(this.padding,3)}; 4588 margin-top: ${this.margin&&ds.getSpacingStyles(this.margin,0)}; 4589 margin-right: ${this.margin&&ds.getSpacingStyles(this.margin,1)}; 4590 margin-bottom: ${this.margin&&ds.getSpacingStyles(this.margin,2)}; 4591 margin-left: ${this.margin&&ds.getSpacingStyles(this.margin,3)}; 4592 `,se`<slot></slot>`}};nc.styles=[vn,Oje];Vl([le()],nc.prototype,"gridTemplateRows",void 0);Vl([le()],nc.prototype,"gridTemplateColumns",void 0);Vl([le()],nc.prototype,"justifyItems",void 0);Vl([le()],nc.prototype,"alignItems",void 0);Vl([le()],nc.prototype,"justifyContent",void 0);Vl([le()],nc.prototype,"alignContent",void 0);Vl([le()],nc.prototype,"columnGap",void 0);Vl([le()],nc.prototype,"rowGap",void 0);Vl([le()],nc.prototype,"gap",void 0);Vl([le()],nc.prototype,"padding",void 0);Vl([le()],nc.prototype,"margin",void 0);nc=Vl([Qe("wui-grid")],nc);const Mje=It` 4593 button { 4594 display: flex; 4595 flex-direction: column; 4596 justify-content: center;
4597 align-items: center; 4598 cursor: pointer; 4599 width: 104px; 4600 row-gap: ${({spacing:t})=>t[2]}; 4601 padding: ${({spacing:t})=>t[3]} ${({spacing:t})=>t[0]}; 4602 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 4603 border-radius: clamp(0px, ${({borderRadius:t})=>t[4]}, 20px); 4604 transition: 4605 color ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-1"]}, 4606 background-color ${({durations:t})=>t.lg} 4607 ${({easings:t})=>t["ease-out-power-1"]}, 4608 border-radius ${({durations:t})=>t.lg} 4609 ${({easings:t})=>t["ease-out-power-1"]}; 4610 will-change: background-color, color, border-radius; 4611 outline: none; 4612 border: none; 4613 } 4614 4615 button > wui-flex > wui-text { 4616 color: ${({tokens:t})=>t.theme.textPrimary}; 4617 max-width: 86px; 4618 white-space: nowrap; 4619 overflow: hidden; 4620 text-overflow: ellipsis; 4621 justify-content: center; 4622 } 4623 4624 button > wui-flex > wui-text.certified { 4625 max-width: 66px; 4626 } 4627 4628 @media (hover: hover) and (pointer: fine) { 4629 button:hover:enabled { 4630 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 4631 } 4632 } 4633 4634 button:disabled > wui-flex > wui-text { 4635 color: ${({tokens:t})=>t.core.glass010}; 4636 } 4637 4638 [data-selected='true'] { 4639 background-color: ${({colors:t})=>t.accent020}; 4640 } 4641 4642 @media (hover: hover) and (pointer: fine) { 4643 [data-selected='true']:hover:enabled { 4644 background-color: ${({colors:t})=>t.accent010}; 4645 } 4646 } 4647 4648 [data-selected='true']:active:enabled { 4649 background-color: ${({colors:t})=>t.accent010}; 4650 } 4651 4652 @media (max-width: 350px) { 4653 button { 4654 width: 100%; 4655 } 4656 } 4657`;var Yd=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Ml=class extends tt{constructor(){super(),this.observer=new IntersectionObserver(()=>{}),this.visible=!1,this.imageSrc=void 0,this.imageLoading=!1,this.isImpressed=!1,this.explorerId="",this.walletQuery="",this.certified=!1,this.displayIndex=0,this.wallet=void 0,this.observer=new IntersectionObserver(e=>{e.forEach(n=>{n.isIntersecting?(this.visible=!0,this.fetchImageSrc(),this.sendImpressionEvent()):this.visible=!1})},{threshold:.01})}firstUpdated(){this.observer.observe(this)}disconnectedCallback(){this.observer.disconnect()}render(){var n,i;const e=((n=this.wallet)==null?void 0:n.badge_type)==="certified";return se` 4658 <button> 4659 ${this.imageTemplate()} 4660 <wui-flex flexDirection="row" alignItems="center" justifyContent="center" gap="1"> 4661 <wui-text 4662 variant="md-regular" 4663 color="inherit" 4664 class=${xt(e?"certified":void 0)} 4665 >${(i=this.wallet)==null?void 0:i.name}</wui-text 4666 > 4667 ${e?se`<wui-icon size="sm" name="walletConnectBrown"></wui-icon>`:null} 4668 </wui-flex> 4669 </button> 4670 `}imageTemplate(){var e,n;return!this.visible&&!this.imageSrc||this.imageLoading?this.shimmerTemplate():se` 4671 <wui-wallet-image 4672 size="lg" 4673 imageSrc=${xt(this.imageSrc)} 4674 name=${xt((e=this.wallet)==null?void 0:e.name)} 4675 .installed=${((n=this.wallet)==null?void 0:n.installed)??!1} 4676 badgeSize="sm" 4677 > 4678 </wui-wallet-image> 4679 `}shimmerTemplate(){return se`<wui-shimmer width="56px" height="56px"></wui-shimmer>`}async fetchImageSrc(){this.wallet&&(this.imageSrc=qi.getWalletImage(this.wallet),!this.imageSrc&&(this.imageLoading=!0,this.imageSrc=await qi.fetchWalletImage(this.wallet.image_id),this.imageLoading=!1))}sendImpressionEvent(){!this.wallet||this.isImpressed||(this.isImpressed=!0,Et.sendWalletImpressionEvent({name:this.wallet.name,walletRank:this.wallet.order,explorerId:this.explorerId,view:Pe.state.view,query:this.walletQuery,certified:this.certified,displayIndex:this.displayIndex}))}};Ml.styles=Mje;Yd([Me()],Ml.prototype,"visible",void 0);Yd([Me()],Ml.prototype,"imageSrc",void 0);Yd([Me()],Ml.prototype,"imageLoading",void 0);Yd([Me()],Ml.prototype,"isImpressed",void 0);Yd([le()],Ml.prototype,"explorerId",void 0);Yd([le()],Ml.prototype,"walletQuery",void 0);Yd([le()],Ml.prototype,"certified",void 0);Yd([le()],Ml.prototype,"displayIndex",void 0);Yd([le({type:Object})],Ml.prototype,"wallet",void 0);Ml=Yd([Qe("w3m-all-wallets-list-item")],Ml);const Lje=It` 4680 wui-grid { 4681 max-height: clamp(360px, 400px, 80vh); 4682 overflow: scroll; 4683 scrollbar-width: none; 4684 grid-auto-rows: min-content; 4685 grid-template-columns: repeat(auto-fill, 104px); 4686 } 4687 4688 :host([data-mobile-fullscreen='true']) wui-grid { 4689 max-height: none; 4690 } 4691 4692 @media (max-width: 350px) { 4693 wui-grid { 4694 grid-template-columns: repeat(2, 1fr); 4695 } 4696 } 4697 4698 wui-grid[data-scroll='false'] { 4699 overflow: hidden; 4700 } 4701 4702 wui-grid::-webkit-scrollbar {
4703 display: none; 4704 } 4705 4706 w3m-all-wallets-list-item { 4707 opacity: 0; 4708 animation-duration: ${({durations:t})=>t.xl}; 4709 animation-timing-function: ${({easings:t})=>t["ease-inout-power-2"]}; 4710 animation-name: fade-in; 4711 animation-fill-mode: forwards; 4712 } 4713 4714 @keyframes fade-in { 4715 from { 4716 opacity: 0; 4717 } 4718 to { 4719 opacity: 1; 4720 } 4721 } 4722 4723 wui-loading-spinner { 4724 padding-top: ${({spacing:t})=>t[4]}; 4725 padding-bottom: ${({spacing:t})=>t[4]}; 4726 justify-content: center; 4727 grid-column: 1 / span 4; 4728 } 4729`;var s4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const IH="local-paginator";let Zg=class extends tt{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.loading=!ut.state.wallets.length,this.wallets=ut.state.wallets,this.mobileFullScreen=ye.state.enableMobileFullScreen,this.unsubscribe.push(ut.subscribeKey("wallets",e=>this.wallets=e))}firstUpdated(){this.initialFetch(),this.createPaginationObserver()}disconnectedCallback(){var e;this.unsubscribe.forEach(n=>n()),(e=this.paginationObserver)==null||e.disconnect()}render(){return this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),se` 4730 <wui-grid 4731 data-scroll=${!this.loading} 4732 .padding=${["0","3","3","3"]} 4733 gap="2" 4734 justifyContent="space-between" 4735 > 4736 ${this.loading?this.shimmerTemplate(16):this.walletsTemplate()} 4737 ${this.paginationLoaderTemplate()} 4738 </wui-grid> 4739 `}async initialFetch(){var n;this.loading=!0;const e=(n=this.shadowRoot)==null?void 0:n.querySelector("wui-grid");e&&(await ut.fetchWalletsByPage({page:1}),await e.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.loading=!1,e.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}shimmerTemplate(e,n){return[...Array(e)].map(()=>se` 4740 <wui-card-select-loader type="wallet" id=${xt(n)}></wui-card-select-loader> 4741 `)}walletsTemplate(){return Fc.getWalletConnectWallets(this.wallets).map((e,n)=>se` 4742 <w3m-all-wallets-list-item 4743 data-testid="wallet-search-item-${e.id}" 4744 @click=${()=>this.onConnectWallet(e)} 4745 .wallet=${e} 4746 explorerId=${e.id} 4747 certified=${this.badge==="certified"} 4748 displayIndex=${n} 4749 ></w3m-all-wallets-list-item> 4750 `)}paginationLoaderTemplate(){const{wallets:e,recommended:n,featured:i,count:s,mobileFilteredOutWalletsLength:r}=ut.state,o=window.innerWidth<352?3:4,a=e.length+n.length;let l=Math.ceil(a/o)*o-a+o;return l-=e.length?i.length%o:0,s===0&&i.length>0?null:s===0||[...i,...e,...n].length<s-(r??0)?this.shimmerTemplate(l,IH):null}createPaginationObserver(){var n;const e=(n=this.shadowRoot)==null?void 0:n.querySelector(`#${IH}`);e&&(this.paginationObserver=new IntersectionObserver(([i])=>{if(i!=null&&i.isIntersecting&&!this.loading){const{page:s,count:r,wallets:o}=ut.state;o.length<r&&ut.fetchWalletsByPage({page:s+1})}}),this.paginationObserver.observe(e))}onConnectWallet(e){Oe.selectWalletConnector(e)}};Zg.styles=Lje;s4([Me()],Zg.prototype,"loading",void 0);s4([Me()],Zg.prototype,"wallets",void 0);s4([Me()],Zg.prototype,"badge",void 0);s4([Me()],Zg.prototype,"mobileFullScreen",void 0);Zg=s4([Qe("w3m-all-wallets-list")],Zg);const $je=os` 4751 wui-grid, 4752 wui-loading-spinner, 4753 wui-flex { 4754 height: 360px; 4755 } 4756 4757 wui-grid { 4758 overflow: scroll; 4759 scrollbar-width: none; 4760 grid-auto-rows: min-content; 4761 grid-template-columns: repeat(auto-fill, 104px); 4762 } 4763 4764 :host([data-mobile-fullscreen='true']) wui-grid { 4765 max-height: none; 4766 height: auto; 4767 } 4768 4769 wui-grid[data-scroll='false'] { 4770 overflow: hidden; 4771 } 4772 4773 wui-grid::-webkit-scrollbar {
4774 display: none; 4775 } 4776 4777 wui-loading-spinner { 4778 justify-content: center; 4779 align-items: center; 4780 } 4781 4782 @media (max-width: 350px) { 4783 wui-grid { 4784 grid-template-columns: repeat(2, 1fr); 4785 } 4786 } 4787`;var r4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Qg=class extends tt{constructor(){super(...arguments),this.prevQuery="",this.prevBadge=void 0,this.loading=!0,this.mobileFullScreen=ye.state.enableMobileFullScreen,this.query=""}render(){return this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),this.onSearch(),this.loading?se`<wui-loading-spinner color="accent-primary"></wui-loading-spinner>`:this.walletsTemplate()}async onSearch(){(this.query.trim()!==this.prevQuery.trim()||this.badge!==this.prevBadge)&&(this.prevQuery=this.query,this.prevBadge=this.badge,this.loading=!0,await ut.searchWallet({search:this.query,badge:this.badge}),this.loading=!1)}walletsTemplate(){const{search:e}=ut.state,n=Fc.markWalletsAsInstalled(e),i=Fc.filterWalletsByWcSupport(n);return i.length?se` 4788 <wui-grid 4789 data-testid="wallet-list" 4790 .padding=${["0","3","3","3"]} 4791 rowGap="4" 4792 columngap="2" 4793 justifyContent="space-between" 4794 > 4795 ${i.map((s,r)=>se` 4796 <w3m-all-wallets-list-item 4797 @click=${()=>this.onConnectWallet(s)} 4798 .wallet=${s} 4799 data-testid="wallet-search-item-${s.id}" 4800 explorerId=${s.id} 4801 certified=${this.badge==="certified"} 4802 walletQuery=${this.query} 4803 displayIndex=${r} 4804 ></w3m-all-wallets-list-item> 4805 `)} 4806 </wui-grid> 4807 `:se` 4808 <wui-flex 4809 data-testid="no-wallet-found" 4810 justifyContent="center" 4811 alignItems="center" 4812 gap="3" 4813 flexDirection="column" 4814 > 4815 <wui-icon-box size="lg" color="default" icon="wallet"></wui-icon-box> 4816 <wui-text data-testid="no-wallet-found-text" color="secondary" variant="md-medium"> 4817 No Wallet found 4818 </wui-text> 4819 </wui-flex> 4820 `}onConnectWallet(e){Oe.selectWalletConnector(e)}};Qg.styles=$je;r4([Me()],Qg.prototype,"loading",void 0);r4([Me()],Qg.prototype,"mobileFullScreen",void 0);r4([le()],Qg.prototype,"query",void 0);r4([le()],Qg.prototype,"badge",void 0);Qg=r4([Qe("w3m-all-wallets-search")],Qg);var FM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let M5=class extends tt{constructor(){super(...arguments),this.search="",this.badge=void 0,this.onDebouncedSearch=Ue.debounce(e=>{this.search=e})}render(){const e=this.search.length>=2;return se` 4821 <wui-flex .padding=${["1","3","3","3"]} gap="2" alignItems="center"> 4822 <wui-search-bar @inputChange=${this.onInputChange.bind(this)}></wui-search-bar> 4823 <wui-certified-switch 4824 ?checked=${this.badge==="certified"} 4825 @certifiedSwitchChange=${this.onCertifiedSwitchChange.bind(this)} 4826 data-testid="wui-certified-switch" 4827 ></wui-certified-switch> 4828 ${this.qrButtonTemplate()} 4829 </wui-flex> 4830 ${e||this.badge?se`<w3m-all-wallets-search 4831 query=${this.search} 4832 .badge=${this.badge} 4833 ></w3m-all-wallets-search>`:se`<w3m-all-wallets-list .badge=${this.badge}></w3m-all-wallets-list>`} 4834 `}onInputChange(e){this.onDebouncedSearch(e.detail)}onCertifiedSwitchChange(e){e.detail?(this.badge="certified",ti.showSvg("Only WalletConnect certified",{icon:"walletConnectBrown",iconColor:"accent-100"})):this.badge=void 0}qrButtonTemplate(){return Ue.isMobile()?se` 4835 <wui-icon-box 4836 size="xl" 4837 iconSize="xl" 4838 color="accent-primary" 4839 icon="qrCode" 4840 border 4841 borderColor="wui-accent-glass-010" 4842 @click=${this.onWalletConnectQr.bind(this)} 4843 ></wui-icon-box> 4844 `:null}onWalletConnectQr(){Pe.push("ConnectingWalletConnect")}};FM([Me()],M5.prototype,"search",void 0);FM([Me()],M5.prototype,"badge",void 0);M5=FM([Qe("w3m-all-wallets-view")],M5);const Uje=It` 4845 button { 4846 display: flex; 4847 gap: ${({spacing:t})=>t[1]}; 4848 padding: ${({spacing:t})=>t[4]}; 4849 width: 100%; 4850 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 4851 border-radius: ${({borderRadius:t})=>t[4]}; 4852 justify-content: center;
4853 align-items: center; 4854 } 4855 4856 :host([data-size='sm']) button { 4857 padding: ${({spacing:t})=>t[2]}; 4858 border-radius: ${({borderRadius:t})=>t[2]}; 4859 } 4860 4861 :host([data-size='md']) button { 4862 padding: ${({spacing:t})=>t[3]}; 4863 border-radius: ${({borderRadius:t})=>t[3]}; 4864 } 4865 4866 button:hover { 4867 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 4868 } 4869 4870 button:disabled { 4871 opacity: 0.5; 4872 } 4873`;var Zb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Ip=class extends tt{constructor(){super(...arguments),this.text="",this.disabled=!1,this.size="lg",this.icon="copy",this.tabIdx=void 0}render(){this.dataset.size=this.size;const e=`${this.size}-regular`;return se` 4874 <button ?disabled=${this.disabled} tabindex=${xt(this.tabIdx)}> 4875 <wui-icon name=${this.icon} size=${this.size} color="default"></wui-icon> 4876 <wui-text align="center" variant=${e} color="primary">${this.text}</wui-text> 4877 </button> 4878 `}};Ip.styles=[vn,Gi,Uje];Zb([le()],Ip.prototype,"text",void 0);Zb([le({type:Boolean})],Ip.prototype,"disabled",void 0);Zb([le()],Ip.prototype,"size",void 0);Zb([le()],Ip.prototype,"icon",void 0);Zb([le()],Ip.prototype,"tabIdx",void 0);Ip=Zb([Qe("wui-list-button")],Ip);const Bje=os` 4879 :host { 4880 position: relative; 4881 display: inline-block; 4882 width: 100%; 4883 } 4884`;var o4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Xg=class extends tt{constructor(){super(...arguments),this.disabled=!1}render(){return se` 4885 <wui-input-text 4886 type="email" 4887 placeholder="Email" 4888 icon="mail" 4889 size="lg" 4890 .disabled=${this.disabled} 4891 .value=${this.value} 4892 data-testid="wui-email-input" 4893 tabIdx=${xt(this.tabIdx)} 4894 ></wui-input-text> 4895 ${this.templateError()} 4896 `}templateError(){return this.errorMessage?se`<wui-text variant="sm-regular" color="error">${this.errorMessage}</wui-text>`:null}};Xg.styles=[vn,Bje];o4([le()],Xg.prototype,"errorMessage",void 0);o4([le({type:Boolean})],Xg.prototype,"disabled",void 0);o4([le()],Xg.prototype,"value",void 0);o4([le()],Xg.prototype,"tabIdx",void 0);Xg=o4([Qe("wui-email-input")],Xg);const Fje=It` 4897 wui-separator { 4898 margin: ${({spacing:t})=>t[3]} calc(${({spacing:t})=>t[3]} * -1); 4899 width: calc(100% + ${({spacing:t})=>t[3]} * 2); 4900 } 4901 4902 wui-email-input { 4903 width: 100%; 4904 } 4905 4906 form { 4907 width: 100%; 4908 display: block; 4909 position: relative; 4910 } 4911 4912 wui-icon-link, 4913 wui-loading-spinner { 4914 position: absolute; 4915 top: 50%; 4916 transform: translateY(-50%); 4917 } 4918 4919 wui-icon-link { 4920 right: ${({spacing:t})=>t[2]}; 4921 } 4922 4923 wui-loading-spinner { 4924 right: ${({spacing:t})=>t[3]}; 4925 } 4926 4927 wui-text { 4928 margin: ${({spacing:t})=>t[2]} ${({spacing:t})=>t[3]} 4929 ${({spacing:t})=>t[0]} ${({spacing:t})=>t[3]}; 4930 } 4931`;var P1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Rf=class extends tt{constructor(){super(),this.unsubscribe=[],this.formRef=n4(),this.email="",this.loading=!1,this.error="",this.remoteFeatures=ye.state.remoteFeatures,this.hasExceededUsageLimit=ut.state.plan.hasExceededUsageLimit,this.unsubscribe.push(ye.subscribeKey("remoteFeatures",e=>{this.remoteFeatures=e}),ut.subscribeKey("plan",e=>this.hasExceededUsageLimit=e.hasExceededUsageLimit))}
4931disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){var e;(e=this.formRef.value)==null||e.addEventListener("keydown",n=>{n.key==="Enter"&&this.onSubmitEmail(n)})}render(){const e=Ve.hasAnyConnection(we.CONNECTOR_ID.AUTH);return se` 4932 <form ${i4(this.formRef)} @submit=${this.onSubmitEmail.bind(this)}> 4933 <wui-email-input 4934 @focus=${this.onFocusEvent.bind(this)} 4935 .disabled=${this.loading} 4936 @inputChange=${this.onEmailInputChange.bind(this)} 4937 tabIdx=${xt(this.tabIdx)} 4938 ?disabled=${e||this.hasExceededUsageLimit} 4939 > 4940 </wui-email-input> 4941 4942 ${this.submitButtonTemplate()}${this.loadingTemplate()} 4943 <input type="submit" hidden /> 4944 </form> 4945 ${this.templateError()} 4946 `}submitButtonTemplate(){return!this.loading&&this.email.length>3?se` 4947 <wui-icon-link 4948 size="sm" 4949 icon="chevronRight" 4950 iconcolor="accent-100" 4951 @click=${this.onSubmitEmail.bind(this)} 4952 > 4953 </wui-icon-link> 4954 `:null}loadingTemplate(){return this.loading?se`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:null}templateError(){return this.error?se`<wui-text variant="sm-medium" color="error">${this.error}</wui-text>`:null}onEmailInputChange(e){this.email=e.detail.trim(),this.error=""}async onSubmitEmail(e){var i;if(!A2.isValidEmail(this.email)){Ss.open({displayMessage:ys.ALERT_WARNINGS.INVALID_EMAIL.displayMessage},"warning");return}if(!we.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(s=>s===ne.state.activeChain)){const s=ne.getFirstCaipNetworkSupportsAuthConnector();if(s){Pe.push("SwitchNetwork",{network:s});return}}try{if(this.loading)return;this.loading=!0,e.preventDefault();const s=Oe.getAuthConnector();if(!s)throw new Error("w3m-email-login-widget: Auth connector not found");const{action:r}=await s.provider.connectEmail({email:this.email});if(Et.sendEvent({type:"track",event:"EMAIL_SUBMITTED"}),r==="VERIFY_OTP")Et.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}),Pe.push("EmailVerifyOtp",{email:this.email});else if(r==="VERIFY_DEVICE")Pe.push("EmailVerifyDevice",{email:this.email});else if(r==="CONNECT"){const o=(i=this.remoteFeatures)==null?void 0:i.multiWallet;await Ve.connectExternal(s,ne.state.activeChain),o?(Pe.replace("ProfileWallets"),ti.showSuccess("New Wallet Added")):Pe.replace("Account")}}catch(s){const r=Ue.parseError(s);r!=null&&r.includes("Invalid email")?this.error="Invalid email. Try again.":ti.showError(s)}finally{this.loading=!1}}onFocusEvent(){Et.sendEvent({type:"track",event:"EMAIL_LOGIN_SELECTED"})}};Rf.styles=Fje;P1([le()],Rf.prototype,"tabIdx",void 0);P1([Me()],Rf.prototype,"email",void 0);P1([Me()],Rf.prototype,"loading",void 0);P1([Me()],Rf.prototype,"error",void 0);P1([Me()],Rf.prototype,"remoteFeatures",void 0);P1([Me()],Rf.prototype,"hasExceededUsageLimit",void 0);Rf=P1([Qe("w3m-email-login-widget")],Rf);const jje=It` 4955 label { 4956 display: inline-flex; 4957 align-items: center; 4958 cursor: pointer; 4959 user-select: none; 4960 column-gap: ${({spacing:t})=>t[2]}; 4961 } 4962 4963 label > input[type='checkbox'] { 4964 height: 0; 4965 width: 0; 4966 opacity: 0; 4967 position: absolute; 4968 } 4969 4970 label > span { 4971 display: flex; 4972 align-items: center; 4973 justify-content: center; 4974 height: 100%; 4975 width: 100%; 4976 border: 1px solid ${({colors:t})=>t.neutrals400}; 4977 color: ${({colors:t})=>t.white}; 4978 background-color: transparent; 4979 will-change: border-color, background-color; 4980 } 4981 4982 label > span > wui-icon { 4983 opacity: 0; 4984 will-change: opacity; 4985 } 4986 4987 label > input[type='checkbox']:checked + span > wui-icon { 4988 color: ${({colors:t})=>t.white}; 4989 } 4990 4991 label > input[type='checkbox']:not(:checked) > span > wui-icon { 4992 color: ${({colors:t})=>t.neutrals900}; 4993 } 4994 4995 label > input[type='checkbox']:checked + span > wui-icon { 4996 opacity: 1; 4997 } 4998 4999 /* -- Sizes --------------------------------------------------- */ 5000 label[data-size='lg'] > span { 5001 width: 24px; 5002 height: 24px; 5003 min-width: 24px; 5004 min-height: 24px; 5005 border-radius: ${({borderRadius:t})=>t[10]}; 5006 } 5007 5008 label[data-size='md'] > span {
5009 width: 20px; 5010 height: 20px; 5011 min-width: 20px; 5012 min-height: 20px; 5013 border-radius: ${({borderRadius:t})=>t[2]}; 5014 } 5015 5016 label[data-size='sm'] > span { 5017 width: 16px; 5018 height: 16px; 5019 min-width: 16px; 5020 min-height: 16px; 5021 border-radius: ${({borderRadius:t})=>t[1]}; 5022 } 5023 5024 /* -- Focus states --------------------------------------------------- */ 5025 label > input[type='checkbox']:focus-visible + span, 5026 label > input[type='checkbox']:focus + span { 5027 border: 1px solid ${({tokens:t})=>t.core.borderAccentPrimary}; 5028 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 5029 } 5030 5031 /* -- Checked states --------------------------------------------------- */ 5032 label > input[type='checkbox']:checked + span { 5033 background-color: ${({tokens:t})=>t.core.iconAccentPrimary}; 5034 border: 1px solid transparent; 5035 } 5036 5037 /* -- Hover states --------------------------------------------------- */ 5038 input[type='checkbox']:not(:checked):not(:disabled) + span:hover { 5039 border: 1px solid ${({colors:t})=>t.neutrals700}; 5040 background-color: ${({colors:t})=>t.neutrals800}; 5041 box-shadow: none; 5042 } 5043 5044 input[type='checkbox']:checked:not(:disabled) + span:hover { 5045 border: 1px solid transparent; 5046 background-color: ${({colors:t})=>t.accent080}; 5047 box-shadow: none; 5048 } 5049 5050 /* -- Disabled state --------------------------------------------------- */ 5051 label > input[type='checkbox']:checked:disabled + span { 5052 border: 1px solid transparent; 5053 opacity: 0.3; 5054 } 5055 5056 label > input[type='checkbox']:not(:checked):disabled + span { 5057 border: 1px solid ${({colors:t})=>t.neutrals700}; 5058 } 5059 5060 label:has(input[type='checkbox']:disabled) { 5061 cursor: auto; 5062 } 5063 5064 label > input[type='checkbox']:disabled + span { 5065 cursor: not-allowed; 5066 } 5067`;var PS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const Vje={lg:"md",md:"sm",sm:"sm"};let hb=class extends tt{constructor(){super(...arguments),this.inputElementRef=n4(),this.checked=void 0,this.disabled=!1,this.size="md"}render(){const e=Vje[this.size];return se` 5068 <label data-size=${this.size}> 5069 <input 5070 ${i4(this.inputElementRef)} 5071 ?checked=${xt(this.checked)} 5072 ?disabled=${this.disabled} 5073 type="checkbox" 5074 @change=${this.dispatchChangeEvent} 5075 /> 5076 <span> 5077 <wui-icon name="checkmarkBold" size=${e}></wui-icon> 5078 </span> 5079 <slot></slot> 5080 </label> 5081 `}dispatchChangeEvent(){var e;this.dispatchEvent(new CustomEvent("checkboxChange",{detail:(e=this.inputElementRef.value)==null?void 0:e.checked,bubbles:!0,composed:!0}))}};hb.styles=[vn,jje];PS([le({type:Boolean})],hb.prototype,"checked",void 0);PS([le({type:Boolean})],hb.prototype,"disabled",void 0);PS([le()],hb.prototype,"size",void 0);hb=PS([Qe("wui-checkbox")],hb);const Wje=It` 5082 :host { 5083 display: flex; 5084 align-items: center; 5085 justify-content: center; 5086 } 5087 wui-checkbox { 5088 padding: ${({spacing:t})=>t[3]}; 5089 } 5090 a { 5091 text-decoration: none; 5092 color: ${({tokens:t})=>t.theme.textSecondary}; 5093 font-weight: 500; 5094 } 5095`;var bre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let H_=class extends tt{constructor(){super(),this.unsubscribe=[],this.checked=fg.state.isLegalCheckboxChecked,this.unsubscribe.push(fg.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var s;const{termsConditionsUrl:e,privacyPolicyUrl:n}=ye.state,i=(s=ye.state.features)==null?void 0:s.legalCheckbox;return!e&&!n||!i?null:se` 5096 <wui-checkbox 5097 ?checked=${this.checked} 5098 @checkboxChange=${this.onCheckboxChange.bind(this)} 5099 data-testid="wui-checkbox" 5100 > 5101 <wui-text color="secondary" variant="sm-regular" align="left"> 5102 I agree to our ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()} 5103 </wui-text> 5104 </wui-checkbox> 5105 `}andTemplate(){const{termsConditionsUrl:e,privacyPolicyUrl:n}=ye.state;return e&&n?"and":""}termsTemplate(){const{termsConditionsUrl:e}=ye.state;return e?se`<a rel="noreferrer" target="_blank" href=${e}>terms of service</a>`:null}privacyTemplate(){const{privacyPolicyUrl:e}=ye.state;return e?se`<a rel="noreferrer" target="_blank" href=${e}>privacy policy</a>`:null}onCheckboxChange(){fg.setIsLegalCheckboxChecked(!this.checked)}};H_.styles=[Wje];bre([Me()],H_.prototype,"checked",void 0);H_=bre([Qe("w3m-legal-checkbox")],H_);const qje=It` 5106 :host { 5107 display: flex; 5108 justify-content: center;
5109 align-items: center; 5110 width: 40px; 5111 height: 40px; 5112 border-radius: ${({borderRadius:t})=>t[20]}; 5113 overflow: hidden; 5114 } 5115 5116 wui-icon { 5117 width: 100%; 5118 height: 100%; 5119 } 5120`;var wre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let G_=class extends tt{constructor(){super(...arguments),this.logo="google"}render(){return se`<wui-icon color="inherit" size="inherit" name=${this.logo}></wui-icon> `}};G_.styles=[vn,qje];wre([le()],G_.prototype,"logo",void 0);G_=wre([Qe("wui-logo")],G_);const zje=It` 5121 :host { 5122 width: 100%; 5123 } 5124 5125 button { 5126 display: flex; 5127 align-items: center; 5128 justify-content: space-between; 5129 padding: ${({spacing:t})=>t[3]}; 5130 width: 100%; 5131 background-color: transparent; 5132 border-radius: ${({borderRadius:t})=>t[4]}; 5133 } 5134 5135 wui-text { 5136 text-transform: capitalize; 5137 } 5138 5139 @media (hover: hover) { 5140 button:hover:enabled { 5141 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 5142 } 5143 } 5144 5145 button:disabled { 5146 opacity: 0.5; 5147 cursor: not-allowed; 5148 } 5149`;var a4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Jg=class extends tt{constructor(){super(...arguments),this.logo="google",this.name="Continue with google",this.disabled=!1}render(){return se` 5150 <button ?disabled=${this.disabled} tabindex=${xt(this.tabIdx)}> 5151 <wui-flex gap="2" alignItems="center"> 5152 <wui-image ?boxed=${!0} logo=${this.logo}></wui-image> 5153 <wui-text variant="lg-regular" color="primary">${this.name}</wui-text> 5154 </wui-flex> 5155 <wui-icon name="chevronRight" size="lg" color="default"></wui-icon> 5156 </button> 5157 `}};Jg.styles=[vn,Gi,zje];a4([le()],Jg.prototype,"logo",void 0);a4([le()],Jg.prototype,"name",void 0);a4([le()],Jg.prototype,"tabIdx",void 0);a4([le({type:Boolean})],Jg.prototype,"disabled",void 0);Jg=a4([Qe("wui-list-social")],Jg);const Hje=It` 5158 :host { 5159 display: block; 5160 width: 100%; 5161 } 5162 5163 button { 5164 width: 100%; 5165 height: 52px; 5166 display: flex; 5167 align-items: center; 5168 justify-content: center; 5169 background: ${({tokens:t})=>t.theme.foregroundPrimary}; 5170 border-radius: ${({borderRadius:t})=>t[4]}; 5171 } 5172 5173 @media (hover: hover) { 5174 button:hover:enabled { 5175 background: ${({tokens:t})=>t.theme.foregroundSecondary}; 5176 } 5177 } 5178 5179 button:disabled { 5180 cursor: not-allowed; 5181 opacity: 0.5; 5182 } 5183`;var IS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let fb=class extends tt{constructor(){super(...arguments),this.logo="google",this.disabled=!1,this.tabIdx=void 0}render(){return se` 5184 <button ?disabled=${this.disabled} tabindex=${xt(this.tabIdx)}> 5185 <wui-icon size="xxl" name=${this.logo}></wui-icon> 5186 </button> 5187 `}};fb.styles=[vn,Gi,Hje];IS([le()],fb.prototype,"logo",void 0);IS([le({type:Boolean})],fb.prototype,"disabled",void 0);IS([le()],fb.prototype,"tabIdx",void 0);fb=IS([Qe("wui-logo-select")],fb);const Gje=It` 5188 wui-separator { 5189 margin: ${({spacing:t})=>t[3]} calc(${({spacing:t})=>t[3]} * -1) 5190 ${({spacing:t})=>t[3]} calc(${({spacing:t})=>t[3]} * -1); 5191 width: calc(100% + ${({spacing:t})=>t[3]} * 2); 5192 } 5193`;var Gp=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
5193a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const DH=2,OH=6;let Bd=class extends tt{constructor(){super(),this.unsubscribe=[],this.walletGuide="get-started",this.tabIdx=void 0,this.connectors=Oe.state.connectors,this.remoteFeatures=ye.state.remoteFeatures,this.authConnector=this.connectors.find(e=>e.type==="AUTH"),this.isPwaLoading=!1,this.hasExceededUsageLimit=ut.state.plan.hasExceededUsageLimit,this.unsubscribe.push(Oe.subscribeKey("connectors",e=>{this.connectors=e,this.authConnector=this.connectors.find(n=>n.type==="AUTH")}),ye.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e),ut.subscribeKey("plan",e=>this.hasExceededUsageLimit=e.hasExceededUsageLimit))}connectedCallback(){super.connectedCallback(),this.handlePwaFrameLoad()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se` 5194 <wui-flex 5195 class="container" 5196 flexDirection="column" 5197 gap="2" 5198 data-testid="w3m-social-login-widget" 5199 > 5200 ${this.topViewTemplate()}${this.bottomViewTemplate()} 5201 </wui-flex> 5202 `}topViewTemplate(){var i;const e=this.walletGuide==="explore";let n=(i=this.remoteFeatures)==null?void 0:i.socials;return!n&&e?(n=fn.DEFAULT_SOCIALS,this.renderTopViewContent(n)):n?this.renderTopViewContent(n):null}renderTopViewContent(e){return e.length===2?se` <wui-flex gap="2"> 5203 ${e.slice(0,DH).map(n=>se`<wui-logo-select 5204 data-testid=${`social-selector-${n}`} 5205 @click=${()=>{this.onSocialClick(n)}} 5206 logo=${n} 5207 tabIdx=${xt(this.tabIdx)} 5208 ?disabled=${this.isPwaLoading||this.hasConnection()} 5209 ></wui-logo-select>`)} 5210 </wui-flex>`:se` <wui-list-button 5211 data-testid=${`social-selector-${e[0]}`} 5212 @click=${()=>{this.onSocialClick(e[0])}} 5213 size="lg" 5214 icon=${xt(e[0])} 5215 text=${`Continue with ${ds.capitalize(e[0])}`} 5216 tabIdx=${xt(this.tabIdx)} 5217 ?disabled=${this.isPwaLoading||this.hasConnection()} 5218 ></wui-list-button>`}bottomViewTemplate(){var s;let e=(s=this.remoteFeatures)==null?void 0:s.socials;const n=this.walletGuide==="explore";return(!this.authConnector||!e||e.length===0)&&n&&(e=fn.DEFAULT_SOCIALS),!e||e.length<=DH?null:e&&e.length>OH?se`<wui-flex gap="2"> 5219 ${e.slice(1,OH-1).map(r=>se`<wui-logo-select 5220 data-testid=${`social-selector-${r}`} 5221 @click=${()=>{this.onSocialClick(r)}} 5222 logo=${r} 5223 tabIdx=${xt(this.tabIdx)} 5224 ?focusable=${this.tabIdx!==void 0&&this.tabIdx>=0} 5225 ?disabled=${this.isPwaLoading||this.hasConnection()} 5226 ></wui-logo-select>`)} 5227 <wui-logo-select 5228 logo="more" 5229 tabIdx=${xt(this.tabIdx)} 5230 @click=${this.onMoreSocialsClick.bind(this)} 5231 ?disabled=${this.isPwaLoading||this.hasConnection()} 5232 data-testid="social-selector-more" 5233 ></wui-logo-select> 5234 </wui-flex>`:e?se`<wui-flex gap="2"> 5235 ${e.slice(1,e.length).map(r=>se`<wui-logo-select 5236 data-testid=${`social-selector-${r}`} 5237 @click=${()=>{this.onSocialClick(r)}} 5238 logo=${r} 5239 tabIdx=${xt(this.tabIdx)} 5240 ?focusable=${this.tabIdx!==void 0&&this.tabIdx>=0} 5241 ?disabled=${this.isPwaLoading||this.hasConnection()} 5242 ></wui-logo-select>`)} 5243 </wui-flex>`:null}onMoreSocialsClick(){Pe.push("ConnectSocials")}async onSocialClick(e){if(this.hasExceededUsageLimit){Pe.push("UsageExceeded");return}if(!we.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(i=>i===ne.state.activeChain)){const i=ne.getFirstCaipNetworkSupportsAuthConnector();if(i){Pe.push("SwitchNetwork",{network:i});return}}e&&await WUe(e)}async handlePwaFrameLoad(){var e;if(Ue.isPWA()){this.isPwaLoading=!0;try{((e=this.authConnector)==null?void 0:e.provider)instanceof Wte&&await this.authConnector.provider.init()}catch(n){Ss.open({displayMessage:"Error loading embedded wallet in PWA",debugMessage:n.message},"error")}finally{this.isPwaLoading=!1}}}hasConnection(){return Ve.hasAnyConnection(we.CONNECTOR_ID.AUTH)}};Bd.styles=Gje;Gp([le()],Bd.prototype,"walletGuide",void 0);Gp([le()],Bd.prototype,"tabIdx",void 0);Gp([Me()],Bd.prototype,"connectors",void 0);Gp([Me()],Bd.prototype,"remoteFeatures",void 0);Gp([Me()],Bd.prototype,"authConnector",void 0);Gp([Me()],Bd.prototype,"isPwaLoading",void 0);Gp([Me()],Bd.prototype,"hasExceededUsageLimit",void 0);Bd=Gp([Qe("w3m-social-login-widget")],Bd);const Kje=It` 5244 :host { 5245 position: relative; 5246 border-radius: ${({borderRadius:t})=>t[2]}; 5247 width: 40px; 5248 height: 40px; 5249 overflow: hidden; 5250 background: ${({tokens:t})=>t.theme.foregroundPrimary}; 5251 display: flex; 5252 justify-content: center;
5253 align-items: center; 5254 flex-wrap: wrap; 5255 column-gap: ${({spacing:t})=>t[1]}; 5256 padding: ${({spacing:t})=>t[1]}; 5257 } 5258 5259 :host > wui-wallet-image { 5260 width: 14px; 5261 height: 14px; 5262 border-radius: 2px; 5263 } 5264`;var vre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const sk=4;let K_=class extends tt{constructor(){super(...arguments),this.walletImages=[]}render(){const e=this.walletImages.length<sk;return se`${this.walletImages.slice(0,sk).map(({src:n,walletName:i})=>se` 5265 <wui-wallet-image 5266 size="sm" 5267 imageSrc=${n} 5268 name=${xt(i)} 5269 ></wui-wallet-image> 5270 `)} 5271 ${e?[...Array(sk-this.walletImages.length)].map(()=>se` <wui-wallet-image size="sm" name=""></wui-wallet-image>`):null} `}};K_.styles=[vn,Kje];vre([le({type:Array})],K_.prototype,"walletImages",void 0);K_=vre([Qe("wui-all-wallets-image")],K_);const Yje=It` 5272 :host { 5273 width: 100%; 5274 } 5275 5276 button { 5277 column-gap: ${({spacing:t})=>t[2]}; 5278 padding: ${({spacing:t})=>t[3]}; 5279 width: 100%; 5280 background-color: transparent; 5281 border-radius: ${({borderRadius:t})=>t[4]}; 5282 color: ${({tokens:t})=>t.theme.textPrimary}; 5283 } 5284 5285 button > wui-wallet-image { 5286 background: ${({tokens:t})=>t.theme.foregroundSecondary}; 5287 } 5288 5289 button > wui-text:nth-child(2) { 5290 display: flex; 5291 flex: 1; 5292 } 5293 5294 button:hover:enabled { 5295 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 5296 } 5297 5298 button[data-all-wallets='true'] { 5299 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 5300 } 5301 5302 button[data-all-wallets='true']:hover:enabled { 5303 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 5304 } 5305 5306 button:focus-visible:enabled { 5307 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 5308 box-shadow: 0 0 0 4px ${({tokens:t})=>t.core.foregroundAccent020}; 5309 } 5310 5311 button:disabled { 5312 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 5313 opacity: 0.5; 5314 cursor: not-allowed; 5315 } 5316 5317 button:disabled > wui-tag { 5318 background-color: ${({tokens:t})=>t.core.glass010}; 5319 color: ${({tokens:t})=>t.theme.foregroundTertiary}; 5320 } 5321 5322 wui-flex.namespace-icon { 5323 width: 16px; 5324 height: 16px; 5325 border-radius: ${({borderRadius:t})=>t.round}; 5326 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 5327 box-shadow: 0 0 0 2px ${({tokens:t})=>t.theme.backgroundPrimary}; 5328 transition: box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2); 5329 } 5330 5331 button:hover:enabled wui-flex.namespace-icon { 5332 box-shadow: 0 0 0 2px ${({tokens:t})=>t.theme.foregroundPrimary}; 5333 } 5334 5335 wui-flex.namespace-icon > wui-icon { 5336 width: 10px; 5337 height: 10px; 5338 } 5339 5340 wui-flex.namespace-icon:not(:first-child) { 5341 margin-left: -4px; 5342 } 5343`;var uc=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const Zje={eip155:"ethereum",solana:"solana",bip122:"bitcoin",polkadot:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:"ton"};let Yo=class extends tt{constructor(){super(...arguments),this.walletImages=[],this.imageSrc="",this.name="",this.size="md",this.tabIdx=void 0,this.namespaces=[],this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100"}render(){return this.dataset.size=this.size,se` 5344 <button 5345 ?disabled=${this.disabled} 5346 data-all-wallets=${this.showAllWallets} 5347 tabindex=${xt(this.tabIdx)} 5348 > 5349 ${this.templateAllWallets()} ${this.templateWalletImage()} 5350 <wui-flex flexDirection="column" justifyContent="center" alignItems="flex-start" gap="1"> 5351 <wui-text variant="lg-regular" color="inherit">${this.name}</wui-text> 5352 ${this.templateNamespaces()} 5353 </wui-flex> 5354 ${this.templateStatus()} 5355 <wui-icon name="chevronRight" size="lg" color="default"></wui-icon> 5356 </button> 5357 `}templateNamespaces(){var e;return(e=this.namespaces)!=null&&e.length?se`<wui-flex alignItems="center" gap="0"> 5358 ${this.namespaces.map((n,i)=>{var s;return se`<wui-flex 5359 alignItems="center" 5360 justifyContent="center" 5361 zIndex=${(((s=this.namespaces)==null?void 0:s.length)??0)*2-i} 5362 class="namespace-icon" 5363 > 5364 <wui-icon 5365 name=${xt(Zje[n])} 5366 size="sm" 5367 color="default" 5368 ></wui-icon> 5369 </wui-flex>`})} 5370 </wui-flex>`:null}templateAllWallets(){return this.showAllWallets&&this.imageSrc?se` <wui-all-wallets-image .imageeSrc=${this.imageSrc}> </wui-all-wallets-image> `:this.showAllWallets&&this.walletIcon?se` <wui-wallet-image .walletIcon=${this.walletIcon} size="sm"> </wui-wallet-image> `:null}templateWalletImage(){return!this.showAllWallets&&this.imageSrc?se`<wui-wallet-image 5371 size=${xt(this.size==="sm"?"sm":"md")} 5372 imageSrc=${this.imageSrc} 5373 name=${this.name} 5374 ></wui-wallet-image>`:!this.showAllWallets&&!this.imageSrc?se`<wui-wallet-image size="sm" name=${this.name}></wui-wallet-image>`:null}templateStatus(){return this.loading?se`<wui-loading-spinner size="lg" color="accent-primary"></wui-loading-spinner>`:this.tagLabel&&this.tagVariant?se`<wui-tag size="sm" variant=${this.tagVariant}>${this.tagLabel}</wui-tag>`:null}};Yo.styles=[vn,Gi,Yje];uc([le({type:Array})],Yo.prototype,"walletImages",void 0);uc([le()],Yo.prototype,"imageSrc",void 0);uc([le()],Yo.prototype,"name",void 0);uc([le()],Yo.prototype,"size",void 0);uc([le()],Yo.prototype,"tagLabel",void 0);uc([le()],Yo.prototype,"tagVariant",void 0);uc([le()],Yo.prototype,"walletIcon",void 0);uc([le()],Yo.prototype,"tabIdx",void 0);uc([le({type:Array})],Yo.prototype,"namespaces",void 0);uc([le({type:Boolean})],Yo.prototype,"disabled",void 0);uc([le({type:Boolean})],Yo.prototype,"showAllWallets",void 0);uc([le({type:Boolean})],Yo.prototype,"loading",void 0);uc([le({type:String})],Yo.prototype,"loadingSpinnerColor",void 0);
5374Yo=uc([Qe("wui-list-wallet")],Yo);var Qb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let e1=class extends tt{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Oe.state.connectors,this.count=ut.state.count,this.filteredCount=ut.state.filteredWallets.length,this.isFetchingRecommendedWallets=ut.state.isFetchingRecommendedWallets,this.unsubscribe.push(Oe.subscribeKey("connectors",e=>this.connectors=e),ut.subscribeKey("count",e=>this.count=e),ut.subscribeKey("filteredWallets",e=>this.filteredCount=e.length),ut.subscribeKey("isFetchingRecommendedWallets",e=>this.isFetchingRecommendedWallets=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.connectors.find(l=>l.id==="walletConnect"),{allWallets:n}=ye.state;if(!e||n==="HIDE"||n==="ONLY_MOBILE"&&!Ue.isMobile())return null;const i=ut.state.featured.length,s=this.count+i,r=s<10?s:Math.floor(s/10)*10,o=this.filteredCount>0?this.filteredCount:r;let a=`${o}`;this.filteredCount>0?a=`${this.filteredCount}`:o<s&&(a=`${o}+`);const c=Ve.hasAnyConnection(we.CONNECTOR_ID.WALLET_CONNECT);return se` 5375 <wui-list-wallet 5376 name="Search Wallet" 5377 walletIcon="search" 5378 showAllWallets 5379 @click=${this.onAllWallets.bind(this)} 5380 tagLabel=${a} 5381 tagVariant="info" 5382 data-testid="all-wallets" 5383 tabIdx=${xt(this.tabIdx)} 5384 .loading=${this.isFetchingRecommendedWallets} 5385 ?disabled=${c} 5386 size="sm" 5387 ></wui-list-wallet> 5388 `}onAllWallets(){var e;Et.sendEvent({type:"track",event:"CLICK_ALL_WALLETS"}),Pe.push("AllWallets",{redirectView:(e=Pe.state.data)==null?void 0:e.redirectView})}};Qb([le()],e1.prototype,"tabIdx",void 0);Qb([Me()],e1.prototype,"connectors",void 0);Qb([Me()],e1.prototype,"count",void 0);Qb([Me()],e1.prototype,"filteredCount",void 0);Qb([Me()],e1.prototype,"isFetchingRecommendedWallets",void 0);e1=Qb([Qe("w3m-all-wallets-widget")],e1);const Qje=It` 5389 :host { 5390 margin-top: ${({spacing:t})=>t[1]}; 5391 } 5392 wui-separator { 5393 margin: ${({spacing:t})=>t[3]} calc(${({spacing:t})=>t[3]} * -1) 5394 ${({spacing:t})=>t[2]} calc(${({spacing:t})=>t[3]} * -1); 5395 width: calc(100% + ${({spacing:t})=>t[3]} * 2); 5396 } 5397`;var Xb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Dp=class extends tt{constructor(){super(),this.unsubscribe=[],this.explorerWallets=ut.state.explorerWallets,this.connections=Ve.state.connections,this.connectorImages=vr.state.connectorImages,this.loadingTelegram=!1,this.unsubscribe.push(Ve.subscribeKey("connections",e=>this.connections=e),vr.subscribeKey("connectorImages",e=>this.connectorImages=e),ut.subscribeKey("explorerFilteredWallets",e=>{this.explorerWallets=e!=null&&e.length?e:ut.state.explorerWallets}),ut.subscribeKey("explorerWallets",e=>{var n;(n=this.explorerWallets)!=null&&n.length||(this.explorerWallets=e)})),Ue.isTelegram()&&Ue.isIos()&&(this.loadingTelegram=!Ve.state.wcUri,this.unsubscribe.push(Ve.subscribeKey("wcUri",e=>this.loadingTelegram=!e)))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se` 5398 <wui-flex flexDirection="column" gap="2"> ${this.connectorListTemplate()} </wui-flex> 5399 `}connectorListTemplate(){return za.connectorList().map((e,n)=>e.kind==="connector"?this.renderConnector(e,n):this.renderWallet(e,n))}getConnectorNamespaces(e){var n;return e.subtype==="walletConnect"?[]:e.subtype==="multiChain"?((n=e.connector.connectors)==null?void 0:n.map(i=>i.chain))||[]:[e.connector.chain]}renderConnector(e,n){var h,p;const i=e.connector,s=qi.getConnectorImage(i)||this.connectorImages[(i==null?void 0:i.imageId)??""],o=(this.connections.get(i.chain)??[]).some(g=>tr.isLowerCaseMatch(g.connectorId,i.id));let a,c;e.subtype==="walletConnect"?(a="qr code",c="accent"):e.subtype==="injected"||e.subtype==="announced"?(a=o?"connected":"installed",c=o?"info":"success"):(a=void 0,c=void 0);const l=Ve.hasAnyConnection(we.CONNECTOR_ID.WALLET_CONNECT),d=e.subtype==="walletConnect"||e.subtype==="external"?l:!1;return se` 5400 <w3m-list-wallet 5401 displayIndex=${n} 5402 imageSrc=${xt(s)} 5403 .installed=${!0} 5404 name=${i.name??"Unknown"} 5405 .tagVariant=${c} 5406 tagLabel=${xt(a)} 5407 data-testid=${`wallet-selector-${i.id.toLowerCase()}`} 5408 size="sm" 5409 @click=${()=>this.onClickConnector(e)} 5410 tabIdx=${xt(this.tabIdx)} 5411 ?disabled=${d} 5412 rdnsId=${xt(((h=i.explorerWallet)==null?void 0:h.rdns)||void 0)} 5413 walletRank=${xt((p=i.explorerWallet)==null?void 0:p.order)} 5414 .namespaces=${this.getConnectorNamespaces(e)} 5415 > 5416 </w3m-list-wallet> 5417 `}onClickConnector(e){var i;const n=(i=Pe.state.data)==null?void 0:i.redirectView;if(e.subtype==="walletConnect"){Oe.setActiveConnector(e.connector),Ue.isMobile()?Pe.push("AllWallets"):Pe.push("ConnectingWalletConnect",{redirectView:n});return}if(e.subtype==="multiChain"){Oe.setActiveConnector(e.connector),Pe.push("ConnectingMultiChain",{redirectView:n});return}if(e.subtype==="injected"){Oe.setActiveConnector(e.connector),Pe.push("ConnectingExter
5417nal",{connector:e.connector,redirectView:n,wallet:e.connector.explorerWallet});return}if(e.subtype==="announced"){if(e.connector.id==="walletConnect"){Ue.isMobile()?Pe.push("AllWallets"):Pe.push("ConnectingWalletConnect",{redirectView:n});return}Pe.push("ConnectingExternal",{connector:e.connector,redirectView:n,wallet:e.connector.explorerWallet});return}Pe.push("ConnectingExternal",{connector:e.connector,redirectView:n})}renderWallet(e,n){const i=e.wallet,s=qi.getWalletImage(i),o=Ve.hasAnyConnection(we.CONNECTOR_ID.WALLET_CONNECT),a=this.loadingTelegram,c=e.subtype==="recent"?"recent":void 0,l=e.subtype==="recent"?"info":void 0;return se` 5418 <w3m-list-wallet 5419 displayIndex=${n} 5420 imageSrc=${xt(s)} 5421 name=${i.name??"Unknown"} 5422 @click=${()=>this.onClickWallet(e)} 5423 size="sm" 5424 data-testid=${`wallet-selector-${i.id}`} 5425 tabIdx=${xt(this.tabIdx)} 5426 ?loading=${a} 5427 ?disabled=${o} 5428 rdnsId=${xt(i.rdns||void 0)} 5429 walletRank=${xt(i.order)} 5430 tagLabel=${xt(c)} 5431 .tagVariant=${l} 5432 > 5433 </w3m-list-wallet> 5434 `}onClickWallet(e){var r;const n=(r=Pe.state.data)==null?void 0:r.redirectView,i=ne.state.activeChain;if(e.subtype==="featured"){Oe.selectWalletConnector(e.wallet);return}if(e.subtype==="recent"){if(this.loadingTelegram)return;Oe.selectWalletConnector(e.wallet);return}if(e.subtype==="custom"){if(this.loadingTelegram)return;Pe.push("ConnectingWalletConnect",{wallet:e.wallet,redirectView:n});return}if(this.loadingTelegram)return;const s=i?Oe.getConnector({id:e.wallet.id,namespace:i}):void 0;s?Pe.push("ConnectingExternal",{connector:s,redirectView:n}):Pe.push("ConnectingWalletConnect",{wallet:e.wallet,redirectView:n})}};Dp.styles=Qje;Xb([le({type:Number})],Dp.prototype,"tabIdx",void 0);Xb([Me()],Dp.prototype,"explorerWallets",void 0);Xb([Me()],Dp.prototype,"connections",void 0);Xb([Me()],Dp.prototype,"connectorImages",void 0);Xb([Me()],Dp.prototype,"loadingTelegram",void 0);Dp=Xb([Qe("w3m-connector-list")],Dp);var Cre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let vI=class extends tt{constructor(){super(...arguments),this.tabIdx=void 0}render(){return se` 5435 <wui-flex flexDirection="column" gap="2"> 5436 <w3m-connector-list tabIdx=${xt(this.tabIdx)}></w3m-connector-list> 5437 <w3m-all-wallets-widget tabIdx=${xt(this.tabIdx)}></w3m-all-wallets-widget> 5438 </wui-flex> 5439 `}};Cre([le()],vI.prototype,"tabIdx",void 0);vI=Cre([Qe("w3m-wallet-login-list")],vI);const Xje=It` 5440 :host { 5441 --connect-scroll--top-opacity: 0; 5442 --connect-scroll--bottom-opacity: 0; 5443 --connect-mask-image: none; 5444 } 5445 5446 .connect { 5447 max-height: clamp(360px, 470px, 80vh); 5448 scrollbar-width: none; 5449 overflow-y: scroll; 5450 overflow-x: hidden; 5451 transition: opacity ${({durations:t})=>t.lg} 5452 ${({easings:t})=>t["ease-out-power-2"]}; 5453 will-change: opacity; 5454 mask-image: var(--connect-mask-image); 5455 } 5456 5457 .guide { 5458 transition: opacity ${({durations:t})=>t.lg} 5459 ${({easings:t})=>t["ease-out-power-2"]}; 5460 will-change: opacity; 5461 } 5462 5463 .connect::-webkit-scrollbar {
5464 display: none; 5465 } 5466 5467 .all-wallets { 5468 flex-flow: column; 5469 } 5470 5471 .connect.disabled, 5472 .guide.disabled { 5473 opacity: 0.3; 5474 pointer-events: none; 5475 user-select: none; 5476 } 5477 5478 wui-separator { 5479 margin: ${({spacing:t})=>t[3]} calc(${({spacing:t})=>t[3]} * -1); 5480 width: calc(100% + ${({spacing:t})=>t[3]} * 2); 5481 } 5482`;var Wl=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const Jje=470;let ga=class extends tt{constructor(){var e,n;super(),this.unsubscribe=[],this.connectors=Oe.state.connectors,this.authConnector=this.connectors.find(i=>i.type==="AUTH"),this.features=ye.state.features,this.remoteFeatures=ye.state.remoteFeatures,this.enableWallets=ye.state.enableWallets,this.noAdapters=ne.state.noAdapters,this.walletGuide="get-started",this.checked=fg.state.isLegalCheckboxChecked,this.isEmailEnabled=((e=this.remoteFeatures)==null?void 0:e.email)&&!ne.state.noAdapters,this.isSocialEnabled=((n=this.remoteFeatures)==null?void 0:n.socials)&&this.remoteFeatures.socials.length>0&&!ne.state.noAdapters,this.isAuthEnabled=this.checkIfAuthEnabled(this.connectors),this.unsubscribe.push(Oe.subscribeKey("connectors",i=>{this.connectors=i,this.authConnector=this.connectors.find(s=>s.type==="AUTH"),this.isAuthEnabled=this.checkIfAuthEnabled(this.connectors)}),ye.subscribeKey("features",i=>{this.features=i}),ye.subscribeKey("remoteFeatures",i=>{this.remoteFeatures=i,this.setEmailAndSocialEnableCheck(this.noAdapters,this.remoteFeatures)}),ye.subscribeKey("enableWallets",i=>this.enableWallets=i),ne.subscribeKey("noAdapters",i=>this.setEmailAndSocialEnableCheck(i,this.remoteFeatures)),fg.subscribeKey("isLegalCheckboxChecked",i=>this.checked=i))}disconnectedCallback(){var n,i;this.unsubscribe.forEach(s=>s()),(n=this.resizeObserver)==null||n.disconnect();const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".connect");e==null||e.removeEventListener("scroll",this.handleConnectListScroll.bind(this))}firstUpdated(){var n,i;const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".connect");e&&(requestAnimationFrame(this.handleConnectListScroll.bind(this)),e==null||e.addEventListener("scroll",this.handleConnectListScroll.bind(this)),this.resizeObserver=new ResizeObserver(()=>{this.handleConnectListScroll()}),(i=this.resizeObserver)==null||i.observe(e),this.handleConnectListScroll())}render(){var p;const{termsConditionsUrl:e,privacyPolicyUrl:n}=ye.state,i=(p=ye.state.features)==null?void 0:p.legalCheckbox,o=!!(e||n)&&!!i&&this.walletGuide==="get-started"&&!this.checked,a={connect:!0,disabled:o},c=ye.state.enableWalletGuide,l=this.enableWallets,d=this.isSocialEnabled||this.authConnector,h=o?-1:void 0;return se` 5483 <wui-flex flexDirection="column"> 5484 ${this.legalCheckboxTemplate()} 5485 <wui-flex 5486 data-testid="w3m-connect-scroll-view" 5487 flexDirection="column" 5488 .padding=${["0","0","4","0"]} 5489 class=${OM(a)} 5490 > 5491 <wui-flex 5492 class="connect-methods" 5493 flexDirection="column" 5494 gap="2" 5495 .padding=${d&&l&&c&&this.walletGuide==="get-started"?["0","3","0","3"]:["0","3","3","3"]} 5496 > 5497 ${this.renderConnectMethod(h)} 5498 </wui-flex> 5499 </wui-flex> 5500 ${this.reownBrandingTemplate()} 5501 </wui-flex> 5502 `}reownBrandingTemplate(){var e;return A2.hasFooter()||!((e=this.remoteFeatures)!=null&&e.reownBranding)?null:se`<wui-ux-by-reown></wui-ux-by-reown>`}setEmailAndSocialEnableCheck(e,n){this.isEmailEnabled=(n==null?void 0:n.email)&&!e,this.isSocialEnabled=(n==null?void 0:n.socials)&&n.socials.length>0&&!e,this.remoteFeatures=n,this.noAdapters=e}checkIfAuthEnabled(e){const n=e.filter(s=>s.type===Fo.CONNECTOR_TYPE_AUTH).map(s=>s.chain);return we.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(s=>n.includes(s))}renderConnectMethod(e){const n=Fc.getConnectOrderMethod(this.features,this.connectors);return se`${n.map((i,s)=>{switch(i){case"email":return se`${this.emailTemplate(e)} ${this.separatorTemplate(s,"email")}`;case"social":return se`${this.socialListTemplate(e)} 5503 ${this.separatorTemplate(s,"social")}`;case"wallet":return se`${this.walletListTemplate(e)} 5504 ${this.separatorTemplate(s,"wallet")}`;default:return null}})}`}checkMethodEnabled(e){switch(e){case"wallet":return this.enableWallets;case"social":return this.isSocialEnabled&&this.isAuthEnabled;case"email":return this.isEmailEnabled&&this.isAuthEnabled;default:return null}}checkIsThereNextMethod(e){const i=Fc.getConnectOrderMethod(this.features,this.connectors)[e+1];return i?this.checkMethodEnabled(i)?i:this.checkIsThereNextMethod(e+1):void 0}separatorTemplate(e,n){const i=this.checkIsThereNextMethod(e),s=this.walletGuide==="explore";switch(n){case"wallet":return this.enableWallets&&i&&!s?se`<wui-separator data-testid="wui-separator" text="or"></wui-separator>`:null;case"email":{const r=i==="social";return this.isAuthEnabled&&this.isEmailEnabled&&!r&&i?se`<wui-separator 5505 data-testid="w3m-email-login-or-separator" 5506 text="or" 5507 ></wui-separator>`:null}case"social":{const r=i==="email";return this.isAuthEnabled&&this.isSocialEnabled&&!r&&i?se`<wui-separator data-testid="wui-separator" text="or"></wui-separator>`:null}default:return null}}emailTemplate(e){return!this.isEmailEnabled||!this.isAuthEnabled?null:se`<w3m-email-login-widget tabIdx=${xt(e)}></w3m-email-login-widget>`}socialListTemplate(e){return!this.isSocialEnabled||!this.isAuthEnabled?null:se`<w3m-social-login-widget 5508 walletGuide=${this.walletGuide} 5509 tabIdx=${xt(e)} 5510 ></w3m-social-login-widget>`}walletListTemplate(e){var a,c;const n=this.enableWallets,i=((a=this.features)==null?void 0:a.emailShowWallets)===!1,s=(c=this.features)==null?void 0:c.collapseWallets,r=i||s;return!n||(Ue.isTelegram()&&(Ue.isSafari()||Ue.isIos())&&Ve.connectWalletConnect().catch(l=>({})),this.walletGuide==="explore")?null:this.isAuthEnabled&&(this.isEmailEnabled||this.isSocialEnabled)&&r?se`<wui-list-button 5511 data-testid="w3m-collapse-wallets-button" 5512 tabIdx=${xt(e)} 5513 @click=${this.onContinueWalletClick.bind(this)} 5514 text="Continue with a wallet" 5515 ></wui-list-button>`:se`<w3m-wallet-login-list tabIdx=${xt(e)}></w3m-wallet-login-list>`}legalCheckboxTemplate(){return this.walletGuide==="explore"?null:se`<w3m-legal-checkbox data-testid="w3m-legal-checkbox"></w3m-legal-checkbox>`}handleConnectListScroll(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".connect");
5515if(!e)return;e.scrollHeight>Jje?(e.style.setProperty("--connect-mask-image",`linear-gradient( 5516 to bottom, 5517 rgba(0, 0, 0, calc(1 - var(--connect-scroll--top-opacity))) 0px, 5518 rgba(200, 200, 200, calc(1 - var(--connect-scroll--top-opacity))) 1px, 5519 black 100px, 5520 black calc(100% - 100px), 5521 rgba(155, 155, 155, calc(1 - var(--connect-scroll--bottom-opacity))) calc(100% - 1px), 5522 rgba(0, 0, 0, calc(1 - var(--connect-scroll--bottom-opacity))) 100% 5523 )`),e.style.setProperty("--connect-scroll--top-opacity",N_.interpolate([0,50],[0,1],e.scrollTop).toString()),e.style.setProperty("--connect-scroll--bottom-opacity",N_.interpolate([0,50],[0,1],e.scrollHeight-e.scrollTop-e.offsetHeight).toString())):(e.style.setProperty("--connect-mask-image","none"),e.style.setProperty("--connect-scroll--top-opacity","0"),e.style.setProperty("--connect-scroll--bottom-opacity","0"))}onContinueWalletClick(){Pe.push("ConnectWallets")}};ga.styles=Xje;Wl([Me()],ga.prototype,"connectors",void 0);Wl([Me()],ga.prototype,"authConnector",void 0);Wl([Me()],ga.prototype,"features",void 0);Wl([Me()],ga.prototype,"remoteFeatures",void 0);Wl([Me()],ga.prototype,"enableWallets",void 0);Wl([Me()],ga.prototype,"noAdapters",void 0);Wl([le()],ga.prototype,"walletGuide",void 0);Wl([Me()],ga.prototype,"checked",void 0);Wl([Me()],ga.prototype,"isEmailEnabled",void 0);Wl([Me()],ga.prototype,"isSocialEnabled",void 0);Wl([Me()],ga.prototype,"isAuthEnabled",void 0);ga=Wl([Qe("w3m-connect-view")],ga);const eVe=It` 5524 :host { 5525 display: block; 5526 width: 100px; 5527 height: 100px; 5528 } 5529 5530 svg { 5531 width: 100px; 5532 height: 100px; 5533 } 5534 5535 rect { 5536 fill: none; 5537 stroke: ${t=>t.colors.accent100}; 5538 stroke-width: 3px; 5539 stroke-linecap: round; 5540 animation: dash 1s linear infinite; 5541 } 5542 5543 @keyframes dash { 5544 to { 5545 stroke-dashoffset: 0px; 5546 } 5547 } 5548`;var xre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Y_=class extends tt{constructor(){super(...arguments),this.radius=36}render(){return this.svgLoaderTemplate()}svgLoaderTemplate(){const e=this.radius>50?50:this.radius,i=36-e,s=116+i,r=245+i,o=360+i*1.75;return se` 5549 <svg viewBox="0 0 110 110" width="110" height="110"> 5550 <rect 5551 x="2" 5552 y="2" 5553 width="106" 5554 height="106" 5555 rx=${e} 5556 stroke-dasharray="${s} ${r}" 5557 stroke-dashoffset=${o} 5558 /> 5559 </svg> 5560 `}};Y_.styles=[vn,eVe];xre([le({type:Number})],Y_.prototype,"radius",void 0);Y_=xre([Qe("wui-loading-thumbnail")],Y_);const tVe=It` 5561 wui-flex { 5562 width: 100%; 5563 height: 52px; 5564 box-sizing: border-box; 5565 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 5566 border-radius: ${({borderRadius:t})=>t[5]}; 5567 padding-left: ${({spacing:t})=>t[3]}; 5568 padding-right: ${({spacing:t})=>t[3]}; 5569 display: flex; 5570 align-items: center; 5571 justify-content: space-between; 5572 gap: ${({spacing:t})=>t[6]}; 5573 } 5574 5575 wui-text { 5576 color: ${({tokens:t})=>t.theme.textSecondary}; 5577 } 5578 5579 wui-icon { 5580 width: 12px; 5581 height: 12px; 5582 } 5583`;var DS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let pb=class extends tt{constructor(){super(...arguments),this.disabled=!1,this.label="",this.buttonLabel=""}render(){return se` 5584 <wui-flex justifyContent="space-between" alignItems="center"> 5585 <wui-text variant="lg-regular" color="inherit">${this.label}</wui-text> 5586 <wui-button variant="accent-secondary" size="sm"> 5587 ${this.buttonLabel} 5588 <wui-icon name="chevronRight" color="inherit" size="inherit" slot="iconRight"></wui-icon> 5589 </wui-button>
5589 5590 </wui-flex> 5591 `}};pb.styles=[vn,Gi,tVe];DS([le({type:Boolean})],pb.prototype,"disabled",void 0);DS([le()],pb.prototype,"label",void 0);DS([le()],pb.prototype,"buttonLabel",void 0);pb=DS([Qe("wui-cta-button")],pb);const nVe=It` 5592 :host { 5593 display: block; 5594 padding: 0 ${({spacing:t})=>t[5]} ${({spacing:t})=>t[5]}; 5595 } 5596`;var Ere=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Z_=class extends tt{constructor(){super(...arguments),this.wallet=void 0}render(){if(!this.wallet)return this.style.display="none",null;const{name:e,app_store:n,play_store:i,chrome_store:s,homepage:r}=this.wallet,o=Ue.isMobile(),a=Ue.isIos(),c=Ue.isAndroid(),l=[n,i,r,s].filter(Boolean).length>1,d=ds.getTruncateString({string:e,charsStart:12,charsEnd:0,truncate:"end"});return l&&!o?se` 5597 <wui-cta-button 5598 label=${`Don't have ${d}?`} 5599 buttonLabel="Get" 5600 @click=${()=>Pe.push("Downloads",{wallet:this.wallet})} 5601 ></wui-cta-button> 5602 `:!l&&r?se` 5603 <wui-cta-button 5604 label=${`Don't have ${d}?`} 5605 buttonLabel="Get" 5606 @click=${this.onHomePage.bind(this)} 5607 ></wui-cta-button> 5608 `:n&&a?se` 5609 <wui-cta-button 5610 label=${`Don't have ${d}?`} 5611 buttonLabel="Get" 5612 @click=${this.onAppStore.bind(this)} 5613 ></wui-cta-button> 5614 `:i&&c?se` 5615 <wui-cta-button 5616 label=${`Don't have ${d}?`} 5617 buttonLabel="Get" 5618 @click=${this.onPlayStore.bind(this)} 5619 ></wui-cta-button> 5620 `:(this.style.display="none",null)}onAppStore(){var e;(e=this.wallet)!=null&&e.app_store&&Ue.openHref(this.wallet.app_store,"_blank")}onPlayStore(){var e;(e=this.wallet)!=null&&e.play_store&&Ue.openHref(this.wallet.play_store,"_blank")}onHomePage(){var e;(e=this.wallet)!=null&&e.homepage&&Ue.openHref(this.wallet.homepage,"_blank")}};Z_.styles=[nVe];Ere([le({type:Object})],Z_.prototype,"wallet",void 0);Z_=Ere([Qe("w3m-mobile-download-links")],Z_);const iVe=It` 5621 @keyframes shake { 5622 0% { 5623 transform: translateX(0); 5624 } 5625 25% { 5626 transform: translateX(3px); 5627 } 5628 50% { 5629 transform: translateX(-3px); 5630 } 5631 75% { 5632 transform: translateX(3px); 5633 } 5634 100% { 5635 transform: translateX(0); 5636 } 5637 } 5638 5639 wui-flex:first-child:not(:only-child) { 5640 position: relative; 5641 } 5642 5643 wui-wallet-image { 5644 width: 56px; 5645 height: 56px; 5646 } 5647 5648 wui-loading-thumbnail { 5649 position: absolute; 5650 } 5651 5652 wui-icon-box { 5653 position: absolute; 5654 right: calc(${({spacing:t})=>t[1]} * -1); 5655 bottom: calc(${({spacing:t})=>t[1]} * -1); 5656 opacity: 0; 5657 transform: scale(0.5); 5658 transition-property: opacity, transform; 5659 transition-duration: ${({durations:t})=>t.lg}; 5660 transition-timing-function: ${({easings:t})=>t["ease-out-power-2"]}; 5661 will-change: opacity, transform; 5662 } 5663 5664 wui-text[align='center'] { 5665 width: 100%; 5666 padding: 0px ${({spacing:t})=>t[4]}; 5667 } 5668 5669 [data-error='true'] wui-icon-box { 5670 opacity: 1; 5671 transform: scale(1); 5672 } 5673 5674 [data-error='true'] > wui-flex:first-child { 5675 animation: shake 250ms ${({easings:t})=>t["ease-out-power-2"]} both; 5676 } 5677 5678 [data-retry='false'] wui-link { 5679 display: none; 5680 } 5681 5682 [data-retry='true'] wui-link { 5683 display: block; 5684 opacity: 1; 5685 } 5686 5687 w3m-mobile-download-links { 5688 padding: 0px; 5689 width: 100%; 5690 } 5691`;var Wu=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};class ro extends tt{constructor(){var e,n,i,s,r;super(),this.wallet=(e=Pe.state.data)==null?void 0:e.wallet,this.connector=(n=Pe.state.data)==null?void 0:n.connector,this.timeout=void 0,this.secondaryBtnIcon="refresh",this.onConnect=void 0,this.onRender=void 0,this.onAutoConnect=void 0,this.isWalletConnect=!0,this.unsubscribe=[],this.imageSrc=qi.getConnectorImage(this.connector)??qi.getWalletImage(this.wallet),this.name=((i=this.wallet)==null?void 0:i.name)??((s=this.connector)==null?void 0:s.name)??"Wallet",this.isRetrying=!1,this.uri=Ve.state.wcUri,this.error=Ve.state.wcError,this.ready=!1,this.showRetry=!1,this.label=void 0,this.secondaryBtnLabel="Try again",this.secondaryLabel="Accept connection request in the wallet",this.isLoading=!1,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(Ve.subscribeKey("wcUri",o=>{var a;this.uri=o,this.isRetrying&&this.onRetry&&(this.isRetrying=!1,(a=this.onConnect)==null||a.call(this))}),Ve.subscribeKey("wcError",o=>this.error=o)),(Ue.isTelegram()||Ue.isSafari())&&Ue.isIos()&&Ve.state.wcUri&&((r=this.onConnect)==null||r.call(this))}firstUpdated(){var e;(e=this.onAutoConnect)==null||e.call(this),this.showRetry=!this.onAutoConnect}
5691disconnectedCallback(){this.unsubscribe.forEach(e=>e()),Ve.setWcError(!1),clearTimeout(this.timeout)}render(){var i;(i=this.onRender)==null||i.call(this),this.onShowRetry();const e=this.error?"Connection can be declined if a previous request is still active":this.secondaryLabel;let n="";return this.label?n=this.label:(n=`Continue in ${this.name}`,this.error&&(n="Connection declined")),se` 5692 <wui-flex 5693 data-error=${xt(this.error)} 5694 data-retry=${this.showRetry} 5695 flexDirection="column" 5696 alignItems="center" 5697 .padding=${["10","5","5","5"]} 5698 gap="6" 5699 > 5700 <wui-flex gap="2" justifyContent="center" alignItems="center"> 5701 <wui-wallet-image size="lg" imageSrc=${xt(this.imageSrc)}></wui-wallet-image> 5702 5703 ${this.error?null:this.loaderTemplate()} 5704 5705 <wui-icon-box 5706 color="error" 5707 icon="close" 5708 size="sm" 5709 border 5710 borderColor="wui-color-bg-125" 5711 ></wui-icon-box> 5712 </wui-flex> 5713 5714 <wui-flex flexDirection="column" alignItems="center" gap="6"> <wui-flex 5715 flexDirection="column" 5716 alignItems="center" 5717 gap="2" 5718 .padding=${["2","0","0","0"]} 5719 > 5720 <wui-text align="center" variant="lg-medium" color=${this.error?"error":"primary"}> 5721 ${n} 5722 </wui-text> 5723 <wui-text align="center" variant="lg-regular" color="secondary">${e}</wui-text> 5724 </wui-flex> 5725 5726 ${this.secondaryBtnLabel?se` 5727 <wui-button 5728 variant="neutral-secondary" 5729 size="md" 5730 ?disabled=${this.isRetrying||this.isLoading} 5731 @click=${this.onTryAgain.bind(this)} 5732 data-testid="w3m-connecting-widget-secondary-button" 5733 > 5734 <wui-icon 5735 color="inherit" 5736 slot="iconLeft" 5737 name=${this.secondaryBtnIcon} 5738 ></wui-icon> 5739 ${this.secondaryBtnLabel} 5740 </wui-button> 5741 `:null} 5742 </wui-flex> 5743 5744 ${this.isWalletConnect?se` 5745 <wui-flex .padding=${["0","5","5","5"]} justifyContent="center"> 5746 <wui-link 5747 @click=${this.onCopyUri} 5748 variant="secondary" 5749 icon="copy" 5750 data-testid="wui-link-copy" 5751 > 5752 Copy link 5753 </wui-link> 5754 </wui-flex> 5755 `:null} 5756 5757 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links></wui-flex> 5758 </wui-flex> 5759 `}onShowRetry(){var e;if(this.error&&!this.showRetry){this.showRetry=!0;const n=(e=this.shadowRoot)==null?void 0:e.querySelector("wui-button");n==null||n.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}onTryAgain(){var e,n;Ve.setWcError(!1),this.onRetry?(this.isRetrying=!0,(e=this.onRetry)==null||e.call(this)):(n=this.onConnect)==null||n.call(this)}loaderTemplate(){const e=Xr.state.themeVariables["--w3m-border-radius-master"],n=e?parseInt(e.replace("px",""),10):4;return se`<wui-loading-thumbnail radius=${n*9}></wui-loading-thumbnail>`}onCopyUri(){try{this.uri&&(Ue.copyToClopboard(this.uri),ti.showSuccess("Link copied"))}catch{ti.showError("Failed to copy")}}}ro.styles=iVe;Wu([Me()],ro.prototype,"isRetrying",void 0);Wu([Me()],ro.prototype,"uri",void 0);Wu([Me()],ro.prototype,"error",void 0);Wu([Me()],ro.prototype,"ready",void 0);Wu([Me()],ro.prototype,"showRetry",void 0);Wu([Me()],ro.prototype,"label",void 0);Wu([Me()],ro.prototype,"secondaryBtnLabel",void 0);Wu([Me()],ro.prototype,"secondaryLabel",void 0);Wu([Me()],ro.prototype,"isLoading",void 0);Wu([le({type:Boolean})],ro.prototype,"isMobile",void 0);Wu([le()],ro.prototype,"onRetry",void 0);var sVe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>
57593?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let CI=class extends ro{constructor(){var n,i,s,r,o;if(super(),this.externalViewUnsubscribe=[],this.connectionsByNamespace=Ve.getConnections((n=this.connector)==null?void 0:n.chain),this.hasMultipleConnections=this.connectionsByNamespace.length>0,this.remoteFeatures=ye.state.remoteFeatures,this.currentActiveConnectorId=Oe.state.activeConnectorIds[(i=this.connector)==null?void 0:i.chain],!this.connector)throw new Error("w3m-connecting-view: No connector provided");const e=(s=this.connector)==null?void 0:s.chain;this.isAlreadyConnected(this.connector)&&(this.secondaryBtnLabel=void 0,this.label=`This account is already linked, change your account in ${this.connector.name}`,this.secondaryLabel=`To link a new account, open ${this.connector.name} and switch to the account you want to link`),Et.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.connector.name??"Unknown",platform:"browser",displayIndex:(r=this.wallet)==null?void 0:r.display_index,walletRank:(o=this.wallet)==null?void 0:o.order,view:Pe.state.view}}),this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),this.isWalletConnect=!1,this.externalViewUnsubscribe.push(Oe.subscribeKey("activeConnectorIds",a=>{var h;const c=a[e],l=(h=this.remoteFeatures)==null?void 0:h.multiWallet,{redirectView:d}=Pe.state.data??{};c!==this.currentActiveConnectorId&&(this.hasMultipleConnections&&l?(Pe.replace("ProfileWallets"),ti.showSuccess("New Wallet Added")):d?Pe.replace(d):wn.close())}),Ve.subscribeKey("connections",this.onConnectionsChange.bind(this)))}disconnectedCallback(){this.externalViewUnsubscribe.forEach(e=>e())}async onConnectProxy(){try{if(this.error=!1,this.connector){if(this.isAlreadyConnected(this.connector))return;(this.connector.id!==we.CONNECTOR_ID.COINBASE_SDK||!this.error)&&await Ve.connectExternal(this.connector,this.connector.chain)}}catch(e){e instanceof Md&&e.originalName===Ha.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST?Et.sendEvent({type:"track",event:"USER_REJECTED",properties:{message:e.message}}):Et.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(e==null?void 0:e.message)??"Unknown"}}),this.error=!0}}onConnectionsChange(e){var n,i;if((n=this.connector)!=null&&n.chain&&e.get(this.connector.chain)&&this.isAlreadyConnected(this.connector)){const s=e.get(this.connector.chain)??[],r=(i=this.remoteFeatures)==null?void 0:i.multiWallet;if(s.length===0)Pe.replace("Connect");else{const o=Oc.getConnectionsByConnectorId(this.connectionsByNamespace,this.connector.id).flatMap(c=>c.accounts),a=Oc.getConnectionsByConnectorId(s,this.connector.id).flatMap(c=>c.accounts);a.length===0?this.hasMultipleConnections&&r?(Pe.replace("ProfileWallets"),ti.showSuccess("Wallet deleted")):wn.close():!o.every(l=>a.some(d=>tr.isLowerCaseMatch(l.address,d.address)))&&r&&Pe.replace("ProfileWallets")}}}isAlreadyConnected(e){return!!e&&this.connectionsByNamespace.some(n=>tr.isLowerCaseMatch(n.connectorId,e.id))}};CI=sVe([Qe("w3m-connecting-external-view")],CI);const rVe=os` 5760 wui-flex, 5761 wui-list-wallet { 5762 width: 100%; 5763 } 5764`;var _re=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let L5=class extends tt{constructor(){super(),this.unsubscribe=[],this.activeConnector=Oe.state.activeConnector,this.unsubscribe.push(Oe.subscribeKey("activeConnector",e=>this.activeConnector=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var e;return se` 5765 <wui-flex 5766 flexDirection="column" 5767 alignItems="center" 5768 .padding=${["3","5","5","5"]} 5769 gap="5" 5770 > 5771 <wui-flex justifyContent="center" alignItems="center"> 5772 <wui-wallet-image 5773 size="lg" 5774 imageSrc=${xt(qi.getConnectorImage(this.activeConnector))} 5775 ></wui-wallet-image> 5776 </wui-flex> 5777 <wui-flex 5778 flexDirection="column" 5779 alignItems="center" 5780 gap="2" 5781 .padding=${["0","3","0","3"]} 5782 > 5783 <wui-text variant="lg-medium" color="primary"> 5784 Select Chain for ${(e=this.activeConnector)==null?void 0:e.name} 5785 </wui-text> 5786 <wui-text align="center" variant="lg-regular" color="secondary" 5787 >Select which chain to connect to your multi chain wallet</wui-text 5788 > 5789 </wui-flex> 5790 <wui-flex 5791 flexGrow="1" 5792 flexDirection="column" 5793 alignItems="center" 5794 gap="2" 5795 .padding=${["2","0","2","0"]} 5796 > 5797 ${this.networksTemplate()} 5798 </wui-flex> 5799 </wui-flex> 5800 `}networksTemplate(){var e,n;return(n=(e=this.activeConnector)==null?void 0:e.connectors)==null?void 0:n.map((i,s)=>{var r;return i.name?se` 5801 <w3m-list-wallet 5802 displayIndex=${s} 5803 imageSrc=${xt(qi.getChainImage(i.chain))} 5804 name=${we.CHAIN_NAME_MAP[i.chain]} 5805 @click=${()=>this.onConnector(i)} 5806 size="sm" 5807 data-testid="wui-list-chain-${i.chain}" 5808 rdnsId=${(r=i.explorerWallet)==null?void 0:r.rdns} 5809 ></w3m-list-wallet> 5810 `:null})}onConnector(e){var s,r,o,a;const n=(r=(s=this.activeConnector)==null?void 0:s.connectors)==null?void 0:r.find(c=>c.chain===e.chain),i=(o=Pe.state.data)==null?void 0:o.redirectView;if(!n){ti.showError("Failed to find connector");return}n.id==="walletConnect"?Ue.isMobile()?Pe.push("AllWallets"):Pe.push("ConnectingWalletConnect",{redirectView:i}
5810):Pe.push("ConnectingExternal",{connector:n,redirectView:i,wallet:(a=this.activeConnector)==null?void 0:a.explorerWallet})}};L5.styles=rVe;_re([Me()],L5.prototype,"activeConnector",void 0);L5=_re([Qe("w3m-connecting-multi-chain-view")],L5);var jM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Q_=class extends tt{constructor(){super(...arguments),this.platformTabs=[],this.unsubscribe=[],this.platforms=[],this.onSelectPlatfrom=void 0}disconnectCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.generateTabs();return se` 5811 <wui-flex justifyContent="center" .padding=${["0","0","4","0"]}> 5812 <wui-tabs .tabs=${e} .onTabChange=${this.onTabChange.bind(this)}></wui-tabs> 5813 </wui-flex> 5814 `}generateTabs(){const e=this.platforms.map(n=>n==="browser"?{label:"Browser",icon:"extension",platform:"browser"}:n==="mobile"?{label:"Mobile",icon:"mobile",platform:"mobile"}:n==="qrcode"?{label:"Mobile",icon:"mobile",platform:"qrcode"}:n==="web"?{label:"Webapp",icon:"browser",platform:"web"}:n==="desktop"?{label:"Desktop",icon:"desktop",platform:"desktop"}:{label:"Browser",icon:"extension",platform:"unsupported"});return this.platformTabs=e.map(({platform:n})=>n),e}onTabChange(e){var i;const n=this.platformTabs[e];n&&((i=this.onSelectPlatfrom)==null||i.call(this,n))}};jM([le({type:Array})],Q_.prototype,"platforms",void 0);jM([le()],Q_.prototype,"onSelectPlatfrom",void 0);Q_=jM([Qe("w3m-connecting-header")],Q_);var oVe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let MH=class extends ro{constructor(){var e;if(super(),!this.wallet)throw new Error("w3m-connecting-wc-browser: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),Et.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser",displayIndex:(e=this.wallet)==null?void 0:e.display_index,walletRank:this.wallet.order,view:Pe.state.view}})}async onConnectProxy(){try{this.error=!1;const{connectors:e}=Oe.state,n=e.find(i=>{var s,r,o;return i.type==="ANNOUNCED"&&((s=i.info)==null?void 0:s.rdns)===((r=this.wallet)==null?void 0:r.rdns)||i.type==="INJECTED"||i.name===((o=this.wallet)==null?void 0:o.name)});if(n)await Ve.connectExternal(n,n.chain);else throw new Error("w3m-connecting-wc-browser: No connector found");wn.close()}catch(e){e instanceof Md&&e.originalName===Ha.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST?Et.sendEvent({type:"track",event:"USER_REJECTED",properties:{message:e.message}}):Et.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(e==null?void 0:e.message)??"Unknown"}}),this.error=!0}}};MH=oVe([Qe("w3m-connecting-wc-browser")],MH);var aVe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let LH=class extends ro{constructor(){var e;if(super(),!this.wallet)throw new Error("w3m-connecting-wc-desktop: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onRender=this.onRenderProxy.bind(this),Et.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"desktop",displayIndex:(e=this.wallet)==null?void 0:e.display_index,walletRank:this.wallet.order,view:Pe.state.view}})}onRenderProxy(){var e;!this.ready&&this.uri&&(this.ready=!0,(e=this.onConnect)==null||e.call(this))}onConnectProxy(){var e;if((e=this.wallet)!=null&&e.desktop_link&&this.uri)try{this.error=!1;const{desktop_link:n,name:i}=this.wallet,{redirect:s,href:r}=Ue.formatNativeUrl(n,this.uri);Ve.setWcLinking({name:i,href:r}),Ve.setRecentWallet(this.wallet),Ue.openHref(s,"_blank")}catch{this.error=!0}}};LH=aVe([Qe("w3m-connecting-wc-desktop")],LH);var Jb=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
5814a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let t1=class extends ro{constructor(){var e;if(super(),this.btnLabelTimeout=void 0,this.redirectDeeplink=void 0,this.redirectUniversalLink=void 0,this.target=void 0,this.preferUniversalLinks=ye.state.experimental_preferUniversalLinks,this.isLoading=!0,this.onConnect=()=>{Oc.onConnectMobile(this.wallet)},!this.wallet)throw new Error("w3m-connecting-wc-mobile: No wallet provided");this.secondaryBtnLabel="Open",this.secondaryLabel=fn.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.onHandleURI(),this.unsubscribe.push(Ve.subscribeKey("wcUri",()=>{this.onHandleURI()})),Et.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"mobile",displayIndex:(e=this.wallet)==null?void 0:e.display_index,walletRank:this.wallet.order,view:Pe.state.view}})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.btnLabelTimeout)}onHandleURI(){var e;this.isLoading=!this.uri,!this.ready&&this.uri&&(this.ready=!0,(e=this.onConnect)==null||e.call(this))}onTryAgain(){var e;Ve.setWcError(!1),(e=this.onConnect)==null||e.call(this)}};Jb([Me()],t1.prototype,"redirectDeeplink",void 0);Jb([Me()],t1.prototype,"redirectUniversalLink",void 0);Jb([Me()],t1.prototype,"target",void 0);Jb([Me()],t1.prototype,"preferUniversalLinks",void 0);Jb([Me()],t1.prototype,"isLoading",void 0);t1=Jb([Qe("w3m-connecting-wc-mobile")],t1);var Ly={},rk,$H;function cVe(){return $H||($H=1,rk=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),rk}var ok={},R0={},UH;function I1(){if(UH)return R0;UH=1;let t;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return R0.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},R0.getSymbolTotalCodewords=function(i){return e[i]},R0.getBCHDigit=function(n){let i=0;for(;n!==0;)i++,n>>>=1;return i},R0.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');t=i},R0.isKanjiModeEnabled=function(){return typeof t<"u"},R0.toSJIS=function(i){return t(i)},R0}var ak={},BH;function VM(){return BH||(BH=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+n)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,s){if(t.isValid(i))return i;try{return e(i)}catch{return s}}})(ak)),ak}var ck,FH;function lVe(){if(FH)return ck;FH=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(e){const n=Math.floor(e/8);return(this.buffer[n]>>>7-e%8&1)===1},put:function(e,n){for(let i=0;i<n;i++)this.putBit((e>>>n-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),e&&(this.buffer[n]|=128>>>this.length%8),this.length++}},ck=t,ck}var lk,jH;function uVe(){if(jH)return lk;jH=1;function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}return t.prototype.set=function(e,n,i,s){const r=e*this.size+n;this.data[r]=i,s&&(this.reservedBit[r]=!0)},t.prototype.get=function(e,n){return this.data[e*this.size+n]},t.prototype.xor=function(e,n,i){this.data[e*this.size+n]^=i},t.prototype.isReserved=function(e,n){return this.reservedBit[e*this.size+n]},lk=t,lk}var uk={},VH;function dVe(){return VH||(VH=1,(function(t){const e=I1().getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];const s=Math.floor(i/7)+2,r=e(i),o=r===145?26:Math.ceil((r-13)/(2*s-2))*2,a=[r-7];for(let c=1;c<s-1;c++)a[c]=a[c-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){const s=[],r=t.getRowColCoords(i),o=r.length;for(let a=0;a<o;a++)for(let c=0;c<o;
vendor: 19,196 bytes, lines 5814-5820
5814c++)a===0&&c===0||a===0&&c===o-1||a===o-1&&c===0||s.push([r[a],r[c]]);return s}})(uk)),uk}var dk={},WH;function hVe(){if(WH)return dk;WH=1;const t=I1().getSymbolSize,e=7;return dk.getPositions=function(i){const s=t(i);return[[0,0],[s-e,0],[0,s-e]]},dk}var hk={},qH;function fVe(){return qH||(qH=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},t.from=function(s){return t.isValid(s)?parseInt(s,10):void 0},t.getPenaltyN1=function(s){const r=s.size;let o=0,a=0,c=0,l=null,d=null;for(let h=0;h<r;h++){a=c=0,l=d=null;for(let p=0;p<r;p++){let g=s.get(h,p);g===l?a++:(a>=5&&(o+=e.N1+(a-5)),l=g,a=1),g=s.get(p,h),g===d?c++:(c>=5&&(o+=e.N1+(c-5)),d=g,c=1)}a>=5&&(o+=e.N1+(a-5)),c>=5&&(o+=e.N1+(c-5))}return o},t.getPenaltyN2=function(s){const r=s.size;let o=0;for(let a=0;a<r-1;a++)for(let c=0;c<r-1;c++){const l=s.get(a,c)+s.get(a,c+1)+s.get(a+1,c)+s.get(a+1,c+1);(l===4||l===0)&&o++}return o*e.N2},t.getPenaltyN3=function(s){const r=s.size;let o=0,a=0,c=0;for(let l=0;l<r;l++){a=c=0;for(let d=0;d<r;d++)a=a<<1&2047|s.get(l,d),d>=10&&(a===1488||a===93)&&o++,c=c<<1&2047|s.get(d,l),d>=10&&(c===1488||c===93)&&o++}return o*e.N3},t.getPenaltyN4=function(s){let r=0;const o=s.data.length;for(let c=0;c<o;c++)r+=s.data[c];return Math.abs(Math.ceil(r*100/o/5)-10)*e.N4};function n(i,s,r){switch(i){case t.Patterns.PATTERN000:return(s+r)%2===0;case t.Patterns.PATTERN001:return s%2===0;case t.Patterns.PATTERN010:return r%3===0;case t.Patterns.PATTERN011:return(s+r)%3===0;case t.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(r/3))%2===0;case t.Patterns.PATTERN101:return s*r%2+s*r%3===0;case t.Patterns.PATTERN110:return(s*r%2+s*r%3)%2===0;case t.Patterns.PATTERN111:return(s*r%3+(s+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(s,r){const o=r.size;for(let a=0;a<o;a++)for(let c=0;c<o;c++)r.isReserved(c,a)||r.xor(c,a,n(s,c,a))},t.getBestMask=function(s,r){const o=Object.keys(t.Patterns).length;let a=0,c=1/0;for(let l=0;l<o;l++){r(l),t.applyMask(l,s);const d=t.getPenaltyN1(s)+t.getPenaltyN2(s)+t.getPenaltyN3(s)+t.getPenaltyN4(s);t.applyMask(l,s),d<c&&(c=d,a=l)}return a}})(hk)),hk}var Nx={},zH;function Sre(){if(zH)return Nx;zH=1;const t=VM(),e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Nx.getBlocksCount=function(s,r){switch(r){case t.L:return e[(s-1)*4+0];case t.M:return e[(s-1)*4+1];case t.Q:return e[(s-1)*4+2];case t.H:return e[(s-1)*4+3];default:return}},Nx.getTotalCodewordsCount=function(s,r){switch(r){case t.L:return n[(s-1)*4+0];case t.M:return n[(s-1)*4+1];case t.Q:return n[(s-1)*4+2];case t.H:return n[(s-1)*4+3];default:return}},Nx}var fk={},Wv={},HH;function pVe(){if(HH)return Wv;HH=1;const t=new Uint8Array(512),e=new Uint8Array(256);return(function(){let i=1;for(let s=0;s<255;s++)t[s]=i,e[i]=s,i<<=1,i&256&&(i^=285);for(let s=255;s<512;s++)t[s]=t[s-255]})(),Wv.log=function(i){if(i<1)throw new Error("log("+i+")");return e[i]},Wv.exp=function(i){return t[i]},Wv.mul=function(i,s){return i===0||s===0?0:t[e[i]+e[s]]},Wv}var GH;function mVe(){return GH||(GH=1,(function(t){const e=pVe();t.mul=function(i,s){const r=new Uint8Array(i.length+s.length-1);for(let o=0;o<i.length;o++)for(let a=0;a<s.length;a++)r[o+a]^=e.mul(i[o],s[a]);return r},t.mod=function(i,s){let r=new Uint8Array(i);for(;r.length-s.length>=0;){const o=r[0];for(let c=0;c<s.length;c++)r[c]^=e.mul(s[c],o);let a=0;for(;a<r.length&&r[a]===0;)a++;r=r.slice(a)}return r},t.generateECPolynomial=function(i){let s=new Uint8Array([1]);for(let r=0;r<i;r++)s=t.mul(s,new Uint8Array([1,e.exp(r)]));return s}})(fk)),fk}var pk,KH;function gVe(){if(KH)return pk;KH=1;const t=mVe();function e(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return e.prototype.initialize=function(i){this.degree=i,this.genPoly=t.generateECPolynomial(this.degree)},e.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(i.length+this.degree);s.set(i);const r=t.mod(s,this.genPoly),o=this.degree-r.length;if(o>0){const a=new Uint8Array(this.degree);return a.set(r,o),a}return r},pk=e,pk}var mk={},gk={},yk={},YH;function Are(){return YH||(YH=1,yk.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),yk}var ld={},ZH;function Tre(){if(ZH)return ld;ZH=1;const t="[0-9]+",e="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r 5815]))+`;ld.KANJI=new RegExp(n,"g"),ld.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),ld.BYTE=new RegExp(i,"g"),ld.NUMERIC=new RegExp(t,"g"),ld.ALPHANUMERIC=new RegExp(e,"g");const s=new RegExp("^"+n+"$"),r=new RegExp("^"+t+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return ld.testKanji=function(c){return s.test(c)},ld.testNumeric=function(c){return r.test(c)},ld.testAlphanumeric=function(c){return o.test(c)},ld}var QH;function D1(){return QH||(QH=1,(function(t){const e=Are(),n=Tre();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(r,o){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?r.ccBits[0]:o<27?r.ccBits[1]:r.ccBits[2]},t.getBestModeForData=function(r){return n.testNumeric(r)?t.NUMERIC:n.testAlphanumeric(r)?t.ALPHANUMERIC:n.testKanji(r)?t.KANJI:t.BYTE},t.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},t.isValid=function(r){return r&&r.bit&&r.ccBits};function i(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+s)}}t.from=function(r,o){if(t.isValid(r))return r;try{return i(r)}catch{return o}}})(gk)),gk}var XH;function yVe(){return XH||(XH=1,(function(t){const e=I1(),n=Sre(),i=VM(),s=D1(),r=Are(),o=7973,a=e.getBCHDigit(o);function c(p,g,b){for(let w=1;w<=40;w++)if(g<=t.getCapacity(w,b,p))return w}function l(p,g){return s.getCharCountIndicator(p,g)+4}function d(p,g){let b=0;return p.forEach(function(w){const C=l(w.mode,g);b+=C+w.getBitsLength()}),b}function h(p,g){for(let b=1;b<=40;b++)if(d(p,b)<=t.getCapacity(b,g,s.MIXED))return b}t.from=function(g,b){return r.isValid(g)?parseInt(g,10):b},t.getCapacity=function(g,b,w){if(!r.isValid(g))throw new Error("Invalid QR Code version");typeof w>"u"&&(w=s.BYTE);const C=e.getSymbolTotalCodewords(g),E=n.getTotalCodewordsCount(g,b),T=(C-E)*8;if(w===s.MIXED)return T;const A=T-l(w,g);switch(w){case s.NUMERIC:return Math.floor(A/10*3);case s.ALPHANUMERIC:return Math.floor(A/11*2);case s.KANJI:return Math.floor(A/13);case s.BYTE:default:return Math.floor(A/8)}},t.getBestVersionForData=function(g,b){let w;const C=i.from(b,i.M);if(Array.isArray(g)){if(g.length>1)return h(g,C);if(g.length===0)return 1;w=g[0]}else w=g;return c(w.mode,w.getLength(),C)},t.getEncodedBits=function(g){if(!r.isValid(g)||g<7)throw new Error("Invalid QR Code version");let b=g<<12;for(;e.getBCHDigit(b)-a>=0;)b^=o<<e.getBCHDigit(b)-a;return g<<12|b}})(mk)),mk}var bk={},JH;function bVe(){if(JH)return bk;JH=1;const t=I1(),e=1335,n=21522,i=t.getBCHDigit(e);return bk.getEncodedBits=function(r,o){const a=r.bit<<3|o;let c=a<<10;for(;t.getBCHDigit(c)-i>=0;)c^=e<<t.getBCHDigit(c)-i;return(a<<10|c)^n},bk}var wk={},vk,eG;function wVe(){if(eG)return vk;eG=1;const t=D1();function e(n){this.mode=t.NUMERIC,this.data=n.toString()}return e.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(i){let s,r,o;for(s=0;s+3<=this.data.length;s+=3)r=this.data.substr(s,3),o=parseInt(r,10),i.put(o,10);const a=this.data.length-s;a>0&&(r=this.data.substr(s),o=parseInt(r,10),i.put(o,a*3+1))},vk=e,vk}var Ck,tG;function vVe(){if(tG)return Ck;tG=1;const t=D1(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(i){this.mode=t.ALPHANUMERIC,this.data=i}return n.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){let r;for(r=0;r+2<=this.data.length;r+=2){let o=e.indexOf(this.data[r])*45;o+=e.indexOf(this.data[r+1]),s.put(o,11)}this.data.length%2&&s.put(e.indexOf(this.data[r]),6)},Ck=n,Ck}var xk,nG;function CVe(){return nG||(nG=1,xk=function(e){for(var n=[],i=e.length,s=0;s<i;s++){var r=e.charCodeAt(s);if(r>=55296&&r<=56319&&i>s+1){var o=e.charCodeAt(s+1);o>=56320&&o<=57343&&(r=(r-55296)*1024+o-56320+65536,s+=1)}if(r<128){n.push(r);continue}if(r<2048){n.push(r>>6|192),n.push(r&63|128);continue}if(r<55296||r>=57344&&r<65536){n.push(r>>12|224),n.push(r>>6&63|128),n.push(r&63|128);continue}if(r>=65536&&r<=1114111){n.push(r>>18|240),n.push(r>>12&63|128),n.push(r>>6&63|128),n.push(r&63|128);continue}n.push(239,191,189)}return new Uint8Array(n).buffer}),xk}var Ek,iG;function xVe(){if(iG)return Ek;iG=1;const t=CVe(),e=D1();function n(i){this.mode=e.BYTE,typeof i=="string"&&(i=t(i)),this.data=new Uint8Array(i)}return n.getBitsLength=function(s){return s*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){for(let s=0,r=this.data.length;s<r;s++)i.put(this.data[s],8)},Ek=n,Ek}var _k,sG;function EVe(){if(sG)return _k;sG=1;const t=D1(),e=I1();function n(i){this.mode=t.KANJI,this.data=i}return n.getBitsLength=function(s){return s*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){let s;for(s=0;s<this.data.length;s++){let r=e.toSJIS(this.data[s]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+` 5816Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},_k=n,_k}var Sk={exports:{}},rG;function _Ve(){return rG||(rG=1,(function(t){var e={single_source_shortest_paths:function(n,i,s){var r={},o={};o[i]=0;var a=e.PriorityQueue.make();a.push(i,0);for(var c,l,d,h,p,g,b,w,C;!a.empty();){c=a.pop(),l=c.value,h=c.cost,p=n[l]||{};for(d in p)p.hasOwnProperty(d)&&(g=p[d],b=h+g,w=o[d],C=typeof o[d]>"u",(C||w>b)&&(o[d]=b,a.push(d,b),r[d]=l))}if(typeof s<"u"&&typeof o[s]>"u"){var E=["Could not find a path from ",i," to ",s,"."].join("");throw new Error(E)}return r},extract_shortest_path_from_predecessor_list:function(n,i){for(var s=[],r=i;r;)s.push(r),n[r],r=n[r];return s.reverse(),s},find_path:function(n,i,s){var r=e.single_source_shortest_paths(n,i,s);return e.extract_shortest_path_from_predecessor_list(r,s)},PriorityQueue:{make:function(n){var i=e.PriorityQueue,s={},r;n=n||{};for(r in i)i.hasOwnProperty(r)&&(s[r]=i[r]);return s.queue=[],s.sorter=n.sorter||i.default_sorter,s},default_sorter:function(n,i){return n.cost-i.cost},push:function(n,i){var s={value:n,cost:i};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(Sk)),Sk.exports}var oG;function SVe(){return oG||(oG=1,(function(t){const e=D1(),n=wVe(),i=vVe(),s=xVe(),r=EVe(),o=Tre(),a=I1(),c=_Ve();function l(E){return unescape(encodeURIComponent(E)).length}function d(E,T,A){const k=[];let R;for(;(R=E.exec(A))!==null;)k.push({data:R[0],index:R.index,mode:T,length:R[0].length});return k}function h(E){const T=d(o.NUMERIC,e.NUMERIC,E),A=d(o.ALPHANUMERIC,e.ALPHANUMERIC,E);let k,R;return a.isKanjiModeEnabled()?(k=d(o.BYTE,e.BYTE,E),R=d(o.KANJI,e.KANJI,E)):(k=d(o.BYTE_KANJI,e.BYTE,E),R=[]),T.concat(A,k,R).sort(function(B,F){return B.index-F.index}).map(function(B){return{data:B.data,mode:B.mode,length:B.length}})}function p(E,T){switch(T){case e.NUMERIC:return n.getBitsLength(E);case e.ALPHANUMERIC:return i.getBitsLength(E);case e.KANJI:return r.getBitsLength(E);case e.BYTE:return s.getBitsLength(E)}}function g(E){return E.reduce(function(T,A){const k=T.length-1>=0?T[T.length-1]:null;return k&&k.mode===A.mode?(T[T.length-1].data+=A.data,T):(T.push(A),T)},[])}function b(E){const T=[];for(let A=0;A<E.length;A++){const k=E[A];switch(k.mode){case e.NUMERIC:T.push([k,{data:k.data,mode:e.ALPHANUMERIC,length:k.length},{data:k.data,mode:e.BYTE,length:k.length}]);break;case e.ALPHANUMERIC:T.push([k,{data:k.data,mode:e.BYTE,length:k.length}]);break;case e.KANJI:T.push([k,{data:k.data,mode:e.BYTE,length:l(k.data)}]);break;case e.BYTE:T.push([{data:k.data,mode:e.BYTE,length:l(k.data)}])}}return T}function w(E,T){const A={},k={start:{}};let R=["start"];for(let P=0;P<E.length;P++){const B=E[P],F=[];for(let z=0;z<B.length;z++){const K=B[z],q=""+P+z;F.push(q),A[q]={node:K,lastCount:0},k[q]={};for(let G=0;G<R.length;G++){const I=R[G];A[I]&&A[I].node.mode===K.mode?(k[I][q]=p(A[I].lastCount+K.length,K.mode)-p(A[I].lastCount,K.mode),A[I].lastCount+=K.length):(A[I]&&(A[I].lastCount=K.length),k[I][q]=p(K.length,K.mode)+4+e.getCharCountIndicator(K.mode,T))}}R=F}for(let P=0;P<R.length;P++)k[R[P]].end=0;return{map:k,table:A}}function C(E,T){let A;const k=e.getBestModeForData(E);if(A=e.from(T,k),A!==e.BYTE&&A.bit<k.bit)throw new Error('"'+E+'" cannot be encoded with mode '+e.toString(A)+`. 5817 Suggested mode is: `+e.toString(k));switch(A===e.KANJI&&!a.isKanjiModeEnabled()&&(A=e.BYTE),A){case e.NUMERIC:return new n(E);case e.ALPHANUMERIC:return new i(E);case e.KANJI:return new r(E);case e.BYTE:return new s(E)}}t.fromArray=function(T){return T.reduce(function(A,k){return typeof k=="string"?A.push(C(k,null)):k.data&&A.push(C(k.data,k.mode)),A},[])},t.fromString=function(T,A){const k=h(T,a.isKanjiModeEnabled()),R=b(k),P=w(R,A),B=c.find_path(P.map,"start","end"),F=[];for(let z=1;z<B.length-1;z++)F.push(P.table[B[z]].node);return t.fromArray(g(F))},t.rawSplit=function(T){return t.fromArray(h(T,a.isKanjiModeEnabled()))}})(wk)),wk}var aG;function AVe(){if(aG)return ok;aG=1;const t=I1(),e=VM(),n=lVe(),i=uVe(),s=dVe(),r=hVe(),o=fVe(),a=Sre(),c=gVe(),l=yVe(),d=bVe(),h=D1(),p=SVe();function g(P,B){const F=P.size,z=r.getPositions(B);for(let K=0;K<z.length;K++){const q=z[K][0],G=z[K][1];for(let I=-1;I<=7;I++)if(!(q+I<=-1||F<=q+I))for(let S=-1;S<=7;S++)G+S<=-1||F<=G+S||(I>=0&&I<=6&&(S===0||S===6)||S>=0&&S<=6&&(I===0||I===6)||I>=2&&I<=4&&S>=2&&S<=4?P.set(q+I,G+S,!0,!0):P.set(q+I,G+S,!1,!0))}}function b(P){const B=P.size;for(let F=8;F<B-8;F++){const z=F%2===0;P.set(F,6,z,!0),P.set(6,F,z,!0)}}function w(P,B){const F=s.getPositions(B);for(let z=0;z<F.length;z++){const K=F[z][0],q=F[z][1];for(let G=-2;G<=2;G++)for(let I=-2;I<=2;I++)G===-2||G===2||I===-2||I===2||G===0&&I===0?P.set(K+G,q+I,!0,!0):P.set(K+G,q+I,!1,!0)}}function C(P,B){const F=P.size,z=l.getEncodedBits(B);let K,q,G;for(let I=0;I<18;I++)K=Math.floor(I/3),q=I%3+F-8-3,G=(z>>I&1)===1,P.set(K,q,G,!0),P.set(q,K,G,!0)}function E(P,B,F){const z=P.size,K=d.getEncodedBits(B,F);let q,G;for(q=0;q<15;q++)G=(K>>q&1)===1,q<6?P.set(q,8,G,!0):q<8?P.set(q+1,8,G,!0):P.set(z-15+q,8,G,!0),q<8?P.set(8,z-q-1,G,!0):q<9?P.set(8,15-q-1+1,G,!0):P.set(8,15-q-1,G,!0);P.set(z-8,8,1,!0)}function T(P,B){const F=P.size;let z=-1,K=F-1,q=7,G=0;for(let I=F-1;I>0;I-=2)for(I===6&&I--;;){for(let S=0;S<2;S++)if(!P.isReserved(K,I-S)){let v=!1;G<B.length&&(v=(B[G]>>>q&1)===1),P.set(K,I-S,v),q--,q===-1&&(G++,q=7)}if(K+=z,K<0||F<=K){K-=z,z=-z;break}}}function A(P,B,F){const z=new n;F.forEach(function(S){z.put(S.mode.bit,4),z.put(S.getLength(),h.getCharCountIndicator(S.mode,P)),S.write(z)});const K=t.getSymbolTotalCodewords(P),q=a.getTotalCodewordsCount(P,B),G=(K-q)*8;for(z.getLengthInBits()+4<=G&&z.put(0,4);z.getLengthInBits()%8!==0;)z.putBit(0);const I=(G-z.getLengthInBits())/8;for(let S=0;S<I;S++)z.put(S%2?17:236,8);return k(z,P,B)}function k(P,B,F){const z=t.getSymbolTotalCodewords(B),K=a.getTotalCodewordsCount(B,F),q=z-K,G=a.getBlocksCount(B,F),I=z%G,S=G-I,v=Math.floor(z/G),_=Math.floor(q/G),N=_+1,$=v-_,U=new c($);let j=0;const D=new Array(G),O=new Array(G);let H=0;const J=new Uint8Array(P.buffer);for(let ee=0;ee<G;ee++){const ie=ee<S?_:N;D[ee]=J.slice(j,j+ie),O[ee]=U.encode(D[ee]),j+=ie,H=Math.max(H,ie)}const W=new Uint8Array(z);let Z=0,Y,Q;for(Y=0;Y<H;Y++)for(Q=0;Q<G;Q++)Y<D[Q].length&&(W[Z++]=D[Q][Y]);for(Y=0;Y<$;Y++)for(Q=0;Q<G;Q++)W[Z++]=O[Q][Y];return W}function R(P,B,F,z){let K;if(Array.isArray(P))K=p.fromArray(P);else if(typeof P=="string"){let v=B;if(!v){const _=p.rawSplit(P);v=l.getBestVersionForData(_,F)}K=p.fromString(P,v||40)}else throw new Error("Invalid data");const q=l.getBestVersionForData(K,F);if(!q)throw new Error("The amount of data is too big to be stored in a QR Code");if(!B)B=q;else if(B<q)throw new Error(` 5818The chosen QR Code version cannot contain this amount of data. 5819Minimum version required to store current data is: `+q+`. 5820`);const G=A(B,F,K),I=t.getSymbolSize(B),S=new i(I);return g(S,B),b(S),w(S,B),E(S,F,0),B>=7&&C(S,B),T(S,G),isNaN(z)&&(z=o.getBestMask(S,E.bind(null,S,F))),o.applyMask(z,S),E(S,F,z),{modules:S,version:B,errorCorrectionLevel:F,maskPattern:z,segments:K}}return ok.create=function(B,F){if(typeof B>"u"||B==="")throw new Error("No input text");let z=e.M,K,q;return typeof F<"u"&&(z=e.from(F.errorCorrectionLevel,e.M),K=l.from(F.version),q=o.from(F.maskPattern),F.toSJISFunc&&t.setToSJISFunction(F.toSJISFunc)),R(B,K,z,q)},ok}var Ak={},Tk={},cG;function kre(){return cG||(cG=1,(function(t){function e(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="str
5820ing")throw new Error("Color should be defined as hex string");let i=n.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+n);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const s=parseInt(i.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+i.slice(0,6).join("")}}t.getOptions=function(i){i||(i={}),i.color||(i.color={});const s=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,o=i.scale||4;return{width:r,scale:r?4:o,margin:s,color:{dark:e(i.color.dark||"#000000ff"),light:e(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},t.getScale=function(i,s){return s.width&&s.width>=i+s.margin*2?s.width/(i+s.margin*2):s.scale},t.getImageWidth=function(i,s){const r=t.getScale(i,s);return Math.floor((i+s.margin*2)*r)},t.qrToImageData=function(i,s,r){const o=s.modules.size,a=s.modules.data,c=t.getScale(o,r),l=Math.floor((o+r.margin*2)*c),d=r.margin*c,h=[r.color.light,r.color.dark];for(let p=0;p<l;p++)for(let g=0;g<l;g++){let b=(p*l+g)*4,w=r.color.light;if(p>=d&&g>=d&&p<l-d&&g<l-d){const C=Math.floor((p-d)/c),E=Math.floor((g-d)/c);w=h[a[C*o+E]?1:0]}i[b++]=w.r,i[b++]=w.g,i[b++]=w.b,i[b]=w.a}}})(Tk)),Tk}var lG;function TVe(){return lG||(lG=1,(function(t){const e=kre();function n(s,r,o){s.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=o,r.width=o,r.style.height=o+"px",r.style.width=o+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(r,o,a){let c=a,l=o;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(l=i()),c=e.getOptions(c);const d=e.getImageWidth(r.modules.size,c),h=l.getContext("2d"),p=h.createImageData(d,d);return e.qrToImageData(p.data,r,c),n(h,l,d),h.putImageData(p,0,0),l},t.renderToDataURL=function(r,o,a){let c=a;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const l=t.render(r,o,c),d=c.type||"image/png",h=c.rendererOpts||{};return l.toDataURL(d,h.quality)}})(Ak)),Ak}var kk={},uG;function kVe(){if(uG)return kk;uG=1;const t=kre();function e(s,r){const o=s.a/255,a=r+'="'+s.hex+'"';return o<1?a+" "+r+'-opacity="'+o.toFixed(2).slice(1)+'"':a}function n(s,r,o){let a=s+r;return typeof o<"u"&&(a+=" "+o),a}function i(s,r,o){let a="",c=0,l=!1,d=0;for(let h=0;h<s.length;h++){const p=Math.floor(h%r),g=Math.floor(h/r);!p&&!l&&(l=!0),s[h]?(d++,h>0&&p>0&&s[h-1]||(a+=l?n("M",p+o,.5+g+o):n("m",c,0),c=0,l=!1),p+1<r&&s[h+1]||(a+=n("h",d),d=0)):c++}return a}return kk.render=function(r,o,a){const c=t.getOptions(o),l=r.modules.size,d=r.modules.data,h=l+c.margin*2,p=c.color.light.a?"<path "+e(c.color.light,"fill")+' d="M0 0h'+h+"v"+h+'H0z"/>':"",g="<path "+e(c.color.dark,"stroke")+' d="'+i(d,l,c.margin)+'"/>',b='viewBox="0 0 '+h+" "+h+'"',C='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+b+' shape-rendering="crispEdges">'+p+g+`</svg> 5821`;return typeof a=="function"&&a(null,C),C},kk}var dG;function NVe(){if(dG)return Ly;dG=1;const t=cVe(),e=AVe(),n=TVe(),i=kVe();function s(r,o,a,c,l){const d=[].slice.call(arguments,1),h=d.length,p=typeof d[h-1]=="function";if(!p&&!t())throw new Error("Callback required as last argument");if(p){if(h<2)throw new Error("Too few arguments provided");h===2?(l=a,a=o,o=c=void 0):h===3&&(o.getContext&&typeof l>"u"?(l=c,c=void 0):(l=c,c=a,a=o,o=void 0))}else{if(h<1)throw new Error("Too few arguments provided");return h===1?(a=o,o=c=void 0):h===2&&!o.getContext&&(c=a,a=o,o=void 0),new Promise(function(g,b){try{const w=e.create(a,c);g(r(w,o,c))}catch(w){b(w)}})}try{const g=e.create(a,c);l(null,r(g,o,c))}catch(g){l(g)}}return Ly.create=e.create,Ly.toCanvas=s.bind(null,n.render),Ly.toDataURL=s.bind(null,n.renderToDataURL),Ly.toString=s.bind(null,function(r,o,a){return i.render(r,a)}),Ly}var RVe=NVe();const PVe=ya(RVe),IVe=.1,hG=2.5,Ph=7;function Nk(t,e,n){return t===e?!1:(t-e<0?e-t:t-e)<=n+IVe}function DVe(t,e){const n=Array.prototype.slice.call(PVe.create(t,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(n.length);return n.reduce((s,r,o)=>(o%i===0?s.push([r]):s[s.length-1].push(r))&&s,[])}const OVe={generate({uri:t,size:e,logoSize:n,padding:i=8,dotColor:s="var(--apkt-colors-black)"}){const o=[],a=DVe(t,"Q"),c=(e-2*i)/a.length,l=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];l.forEach(({x:w,y:C})=>{const E=(a.length-Ph)*c*w+i,T=(a.length-Ph)*c*C+i,A=.45;for(let k=0;k<l.length;k+=1){const R=c*(Ph-k*2);o.push(Tn` 5822 <rect 5823 fill=${k===2?"var(--apkt-colors-black)":"var(--apkt-colors-white)"} 5824 width=${k===0?R-10:R} 5825 rx= ${k===0?(R-10)*A:R*A} 5826 ry= ${k===0?(R-10)*A:R*A} 5827 stroke=${s} 5828 stroke-width=${k===0?10:0} 5829 height=${k===0?R-10:R} 5830 x= ${k===0?T+c*k+10/2:T+c*k} 5831 y= ${k===0?E+c*k+10/2:E+c*k} 5832 /> 5833 `)}});const d=Math.floor((n+25)/c),h=a.length/2-d/2,p=a.length/2+d/2-1,g=[];a.forEach((w,C)=>
5833{w.forEach((E,T)=>{if(a[C][T]&&!(C<Ph&&T<Ph||C>a.length-(Ph+1)&&T<Ph||C<Ph&&T>a.length-(Ph+1))&&!(C>h&&C<p&&T>h&&T<p)){const A=C*c+c/2+i,k=T*c+c/2+i;g.push([A,k])}})});const b={};return g.forEach(([w,C])=>{var E;b[w]?(E=b[w])==null||E.push(C):b[w]=[C]}),Object.entries(b).map(([w,C])=>{const E=C.filter(T=>C.every(A=>!Nk(T,A,c)));return[Number(w),E]}).forEach(([w,C])=>{C.forEach(E=>{o.push(Tn`<circle cx=${w} cy=${E} fill=${s} r=${c/hG} />`)})}),Object.entries(b).filter(([w,C])=>C.length>1).map(([w,C])=>{const E=C.filter(T=>C.some(A=>Nk(T,A,c)));return[Number(w),E]}).map(([w,C])=>{C.sort((T,A)=>T<A?-1:1);const E=[];for(const T of C){const A=E.find(k=>k.some(R=>Nk(T,R,c)));A?A.push(T):E.push([T])}return[w,E.map(T=>[T[0],T[T.length-1]])]}).forEach(([w,C])=>{C.forEach(([E,T])=>{o.push(Tn` 5834 <line 5835 x1=${w} 5836 x2=${w} 5837 y1=${E} 5838 y2=${T} 5839 stroke=${s} 5840 stroke-width=${c/(hG/2)} 5841 stroke-linecap="round" 5842 /> 5843 `)})}),o}},MVe=It` 5844 :host { 5845 position: relative; 5846 user-select: none; 5847 display: block; 5848 overflow: hidden; 5849 aspect-ratio: 1 / 1; 5850 width: 100%; 5851 height: 100%; 5852 background-color: ${({colors:t})=>t.white}; 5853 border: 1px solid ${({tokens:t})=>t.theme.borderPrimary}; 5854 } 5855 5856 :host { 5857 border-radius: ${({borderRadius:t})=>t[4]}; 5858 display: flex; 5859 align-items: center; 5860 justify-content: center; 5861 } 5862 5863 :host([data-clear='true']) > wui-icon { 5864 display: none; 5865 } 5866 5867 svg:first-child, 5868 wui-image, 5869 wui-icon { 5870 position: absolute; 5871 top: 50%; 5872 left: 50%; 5873 transform: translateY(-50%) translateX(-50%); 5874 background-color: ${({tokens:t})=>t.theme.backgroundPrimary}; 5875 box-shadow: inset 0 0 0 4px ${({tokens:t})=>t.theme.backgroundPrimary}; 5876 border-radius: ${({borderRadius:t})=>t[6]}; 5877 } 5878 5879 wui-image { 5880 width: 25%; 5881 height: 25%; 5882 border-radius: ${({borderRadius:t})=>t[2]}; 5883 } 5884 5885 wui-icon { 5886 width: 100%; 5887 height: 100%; 5888 color: #3396ff !important; 5889 transform: translateY(-50%) translateX(-50%) scale(0.25); 5890 } 5891 5892 wui-icon > svg { 5893 width: inherit; 5894 height: inherit; 5895 } 5896`;var Kp=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Fd=class extends tt{constructor(){super(...arguments),this.uri="",this.size=500,this.theme="dark",this.imageSrc=void 0,this.alt=void 0,this.arenaClear=void 0,this.farcaster=void 0}render(){return this.dataset.theme=this.theme,this.dataset.clear=String(this.arenaClear),se`<wui-flex 5897 alignItems="center" 5898 justifyContent="center" 5899 class="wui-qr-code" 5900 direction="column" 5901 gap="4" 5902 width="100%" 5903 style="height: 100%" 5904 > 5905 ${this.templateVisual()} ${this.templateSvg()} 5906 </wui-flex>`}templateSvg(){return Tn` 5907 <svg viewBox="0 0 ${this.size} ${this.size}" width="100%" height="100%"> 5908 ${OVe.generate({uri:this.uri,size:this.size,logoSize:this.arenaClear?0:this.size/4})} 5909 </svg> 5910 `}templateVisual(){return this.imageSrc?se`<wui-image src=${this.imageSrc} alt=${this.alt??"logo"}></wui-image>`:this.farcaster?se`<wui-icon 5911 class="farcaster" 5912 size="inherit" 5913 color="inherit" 5914 name="farcaster" 5915 ></wui-icon>`:se`<wui-icon size="inherit" color="inherit" name="walletConnect"></wui-icon>`}};Fd.styles=[vn,MVe];Kp([le()],Fd.prototype,"uri",void 0);Kp([le({type:Number})],Fd.prototype,"size",void 0);Kp([le()],Fd.prototype,"theme",void 0);Kp([le()],Fd.prototype,"imageSrc",void 0);Kp([le()],Fd.prototype,"alt",void 0);Kp([le({type:Boolean})],Fd.prototype,"arenaClear",void 0);Kp([le({type:Boolean})],Fd.prototype,"farcaster",void 0);Fd=Kp([Qe("wui-qr-code")],Fd);const LVe=It` 5916 wui-shimmer { 5917 width: 100%; 5918 aspect-ratio: 1 / 1; 5919 border-radius: ${({borderRadius:t})=>t[4]}; 5920 } 5921 5922 wui-qr-code { 5923 opacity: 0; 5924 animation-duration: ${({durations:t})=>t.xl}; 5925 animation-timing-function: ${({easings:t})=>t["ease-out-power-2"]}; 5926 animation-name: fade-in; 5927 animation-fill-mode: forwards; 5928 } 5929 5930 @keyframes fade-in { 5931 from { 5932 opacity: 0; 5933 } 5934 to { 5935 opacity: 1; 5936 } 5937 } 5938`;var Nre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
5938a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let X_=class extends ro{constructor(){super(),this.basic=!1}firstUpdated(){var e,n,i;this.basic||Et.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:((e=this.wallet)==null?void 0:e.name)??"WalletConnect",platform:"qrcode",displayIndex:(n=this.wallet)==null?void 0:n.display_index,walletRank:(i=this.wallet)==null?void 0:i.order,view:Pe.state.view}})}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.unsubscribe)==null||e.forEach(n=>n())}render(){return this.onRenderProxy(),se` 5939 <wui-flex 5940 flexDirection="column" 5941 alignItems="center" 5942 .padding=${["0","5","5","5"]} 5943 gap="5" 5944 > 5945 <wui-shimmer width="100%"> ${this.qrCodeTemplate()} </wui-shimmer> 5946 <wui-text variant="lg-medium" color="primary"> Scan this QR Code with your phone </wui-text> 5947 ${this.copyTemplate()} 5948 </wui-flex> 5949 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links> 5950 `}onRenderProxy(){!this.ready&&this.uri&&(this.ready=!0)}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const e=this.wallet?this.wallet.name:void 0;Ve.setWcLinking(void 0),Ve.setRecentWallet(this.wallet);const n=Xr.state.themeVariables["--apkt-qr-color"]??Xr.state.themeVariables["--w3m-qr-color"];return se` <wui-qr-code 5951 theme=${Xr.state.themeMode} 5952 uri=${this.uri} 5953 imageSrc=${xt(qi.getWalletImage(this.wallet))} 5954 color=${xt(n)} 5955 alt=${xt(e)} 5956 data-testid="wui-qr-code" 5957 ></wui-qr-code>`}copyTemplate(){const e=!this.uri||!this.ready;return se`<wui-button 5958 .disabled=${e} 5959 @click=${this.onCopyUri} 5960 variant="neutral-secondary" 5961 size="sm" 5962 data-testid="copy-wc2-uri" 5963 > 5964 Copy link 5965 <wui-icon size="sm" color="inherit" name="copy" slot="iconRight"></wui-icon> 5966 </wui-button>`}};X_.styles=LVe;Nre([le({type:Boolean})],X_.prototype,"basic",void 0);X_=Nre([Qe("w3m-connecting-wc-qrcode")],X_);var $Ve=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let fG=class extends tt{constructor(){var e,n,i;if(super(),this.wallet=(e=Pe.state.data)==null?void 0:e.wallet,!this.wallet)throw new Error("w3m-connecting-wc-unsupported: No wallet provided");Et.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser",displayIndex:(n=this.wallet)==null?void 0:n.display_index,walletRank:(i=this.wallet)==null?void 0:i.order,view:Pe.state.view}})}render(){return se` 5967 <wui-flex 5968 flexDirection="column" 5969 alignItems="center" 5970 .padding=${["10","5","5","5"]} 5971 gap="5" 5972 > 5973 <wui-wallet-image 5974 size="lg" 5975 imageSrc=${xt(qi.getWalletImage(this.wallet))} 5976 ></wui-wallet-image> 5977 5978 <wui-text variant="md-regular" color="primary">Not Detected</wui-text> 5979 </wui-flex> 5980 5981 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links> 5982 `}};fG=$Ve([Qe("w3m-connecting-wc-unsupported")],fG);var Rre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let xI=class extends ro{constructor(){var e,n;if(super(),this.isLoading=!0,!this.wallet)throw new Error("w3m-connecting-wc-web: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.secondaryBtnLabel="Open",this.secondaryLabel=fn.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.updateLoadingState(),this.unsubscribe.push(Ve.subscribeKey("wcUri",()=>{this.updateLoadingState()})),Et.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"web",displayIndex:(e=this.wallet)==null?void 0:e.display_index,walletRank:(n=this.wallet)==null?void 0:n.order,view:Pe.state.view}})}updateLoadingState(){this.isLoading=!this.uri}onConnectProxy(){var e;if((e=this.wallet)!=null&&e.webapp_link&&this.uri)try{this.error=!1;const{webapp_link:n,name:i}=this.wallet,{redirect:s,href:r}=Ue.formatUniversalUrl(n,this.uri);Ve.setWcLinking({name:i,href:r}),Ve.setRecentWallet(this.wallet),Ue.openHref(s,"_blank")}catch{this.error=!0}}};Rre([Me()],xI.prototype,"isLoading",void 0);xI=Rre([Qe("w3m-connecting-wc-web")],xI);const UVe=It` 5983 :host([data-mobile-fullscreen='true']) { 5984 height: 100%; 5985 display: flex; 5986 flex-direction: column; 5987 } 5988 5989 :host([data-mobile-fullscreen='true']) wui-ux-by-reown { 5990 margin-top: auto; 5991 } 5992`;var O1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
5992a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let jd=class extends tt{constructor(){var e;super(),this.wallet=(e=Pe.state.data)==null?void 0:e.wallet,this.unsubscribe=[],this.platform=void 0,this.platforms=[],this.isSiwxEnabled=!!ye.state.siwx,this.remoteFeatures=ye.state.remoteFeatures,this.displayBranding=!0,this.basic=!1,this.determinePlatforms(),this.initializeConnection(),this.unsubscribe.push(ye.subscribeKey("remoteFeatures",n=>this.remoteFeatures=n))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return ye.state.enableMobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),se` 5993 ${this.headerTemplate()} 5994 <div class="platform-container">${this.platformTemplate()}</div> 5995 ${this.reownBrandingTemplate()} 5996 `}reownBrandingTemplate(){var e;return!((e=this.remoteFeatures)!=null&&e.reownBranding)||!this.displayBranding?null:se`<wui-ux-by-reown></wui-ux-by-reown>`}async initializeConnection(e=!1){var n,i;if(!(this.platform==="browser"||ye.state.manualWCControl&&!e))try{const{wcPairingExpiry:s,status:r}=Ve.state,{redirectView:o}=Pe.state.data??{};if(e||ye.state.enableEmbedded||Ue.isPairingExpired(s)||r==="connecting"){const a=Ve.getConnections(ne.state.activeChain),c=(n=this.remoteFeatures)==null?void 0:n.multiWallet,l=a.length>0;await Ve.connectWalletConnect({cache:"never"}),this.isSiwxEnabled||(l&&c?(Pe.replace("ProfileWallets"),ti.showSuccess("New Wallet Added")):o?Pe.replace(o):wn.close())}}catch(s){if(s instanceof Error&&s.message.includes("An error occurred when attempting to switch chain")&&!ye.state.enableNetworkSwitch&&ne.state.activeChain){ne.setActiveCaipNetwork(xu.getUnsupportedNetwork(`${ne.state.activeChain}:${(i=ne.state.activeCaipNetwork)==null?void 0:i.id}`)),ne.showUnsupportedChainUI();return}s instanceof Md&&s.originalName===Ha.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST?Et.sendEvent({type:"track",event:"USER_REJECTED",properties:{message:s.message}}):Et.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(s==null?void 0:s.message)??"Unknown"}}),Ve.setWcError(!0),ti.showError(s.message??"Connection error"),Ve.resetWcConnection(),Pe.goBack()}}determinePlatforms(){if(!this.wallet){this.platforms.push("qrcode"),this.platform="qrcode";return}if(this.platform)return;const{mobile_link:e,desktop_link:n,webapp_link:i,injected:s,rdns:r}=this.wallet,o=s==null?void 0:s.map(({injected_id:b})=>b).filter(Boolean),a=[...r?[r]:o??[]],c=ye.state.isUniversalProvider?!1:a.length,l=e,d=i,h=Ve.checkInstalled(a),p=c&&h,g=n&&!Ue.isMobile();p&&!ne.state.noAdapters&&this.platforms.push("browser"),l&&this.platforms.push(Ue.isMobile()?"mobile":"qrcode"),d&&this.platforms.push("web"),g&&this.platforms.push("desktop"),!p&&c&&!ne.state.noAdapters&&this.platforms.push("unsupported"),this.platform=this.platforms[0]}platformTemplate(){switch(this.platform){case"browser":return se`<w3m-connecting-wc-browser></w3m-connecting-wc-browser>`;case"web":return se`<w3m-connecting-wc-web></w3m-connecting-wc-web>`;case"desktop":return se` 5997 <w3m-connecting-wc-desktop .onRetry=${()=>this.initializeConnection(!0)}> 5998 </w3m-connecting-wc-desktop> 5999 `;case"mobile":return se` 6000 <w3m-connecting-wc-mobile isMobile .onRetry=${()=>this.initializeConnection(!0)}> 6001 </w3m-connecting-wc-mobile> 6002 `;case"qrcode":return se`<w3m-connecting-wc-qrcode ?basic=${this.basic}></w3m-connecting-wc-qrcode>`;default:return se`<w3m-connecting-wc-unsupported></w3m-connecting-wc-unsupported>`}}headerTemplate(){return this.platforms.length>1?se` 6003 <w3m-connecting-header 6004 .platforms=${this.platforms} 6005 .onSelectPlatfrom=${this.onSelectPlatform.bind(this)} 6006 > 6007 </w3m-connecting-header> 6008 `:null}async onSelectPlatform(e){var i;const n=(i=this.shadowRoot)==null?void 0:i.querySelector("div");n&&(await n.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.platform=e,n.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}};jd.styles=UVe;O1([Me()],jd.prototype,"platform",void 0);O1([Me()],jd.prototype,"platforms",void 0);O1([Me()],jd.prototype,"isSiwxEnabled",void 0);O1([Me()],jd.prototype,"remoteFeatures",void 0);O1([le({type:Boolean})],jd.prototype,"displayBranding",void 0);O1([le({type:Boolean})],jd.prototype,"basic",void 0);jd=O1([Qe("w3m-connecting-wc-view")],jd);var WM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
6008a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let $5=class extends tt{constructor(){super(),this.unsubscribe=[],this.isMobile=Ue.isMobile(),this.remoteFeatures=ye.state.remoteFeatures,this.unsubscribe.push(ye.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(this.isMobile){const{featured:e,recommended:n}=ut.state,{customWallets:i}=ye.state,s=He.getRecentWallets(),r=e.length||n.length||(i==null?void 0:i.length)||s.length;return se`<wui-flex flexDirection="column" gap="2" .margin=${["1","3","3","3"]}> 6009 ${r?se`<w3m-connector-list></w3m-connector-list>`:null} 6010 <w3m-all-wallets-widget></w3m-all-wallets-widget> 6011 </wui-flex>`}return se`<wui-flex flexDirection="column" .padding=${["0","0","4","0"]}> 6012 <w3m-connecting-wc-view ?basic=${!0} .displayBranding=${!1}></w3m-connecting-wc-view> 6013 <wui-flex flexDirection="column" .padding=${["0","3","0","3"]}> 6014 <w3m-all-wallets-widget></w3m-all-wallets-widget> 6015 </wui-flex> 6016 </wui-flex> 6017 ${this.reownBrandingTemplate()} `}reownBrandingTemplate(){var e;return(e=this.remoteFeatures)!=null&&e.reownBranding?se` <wui-flex flexDirection="column" .padding=${["1","0","1","0"]}> 6018 <wui-ux-by-reown></wui-ux-by-reown> 6019 </wui-flex>`:null}};WM([Me()],$5.prototype,"isMobile",void 0);WM([Me()],$5.prototype,"remoteFeatures",void 0);$5=WM([Qe("w3m-connecting-wc-basic-view")],$5);const BVe=os` 6020 .continue-button-container { 6021 width: 100%; 6022 } 6023`;var Pre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let U5=class extends tt{constructor(){super(...arguments),this.loading=!1}render(){return se` 6024 <wui-flex 6025 flexDirection="column" 6026 alignItems="center" 6027 gap="6" 6028 .padding=${["0","0","4","0"]} 6029 > 6030 ${this.onboardingTemplate()} ${this.buttonsTemplate()} 6031 <wui-link 6032 @click=${()=>{Ue.openHref(w6e.URLS.FAQ,"_blank")}} 6033 > 6034 Learn more about names 6035 <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon> 6036 </wui-link> 6037 </wui-flex> 6038 `}onboardingTemplate(){return se` <wui-flex 6039 flexDirection="column" 6040 gap="6" 6041 alignItems="center" 6042 .padding=${["0","6","0","6"]} 6043 > 6044 <wui-flex gap="3" alignItems="center" justifyContent="center"> 6045 <wui-icon-box icon="id" size="xl" iconSize="xxl" color="default"></wui-icon-box> 6046 </wui-flex> 6047 <wui-flex flexDirection="column" alignItems="center" gap="3"> 6048 <wui-text align="center" variant="lg-medium" color="primary"> 6049 Choose your account name 6050 </wui-text> 6051 <wui-text align="center" variant="md-regular" color="primary"> 6052 Finally say goodbye to 0x addresses, name your account to make it easier to exchange 6053 assets 6054 </wui-text> 6055 </wui-flex> 6056 </wui-flex>`}buttonsTemplate(){return se`<wui-flex 6057 .padding=${["0","8","0","8"]} 6058 gap="3" 6059 class="continue-button-container" 6060 > 6061 <wui-button 6062 fullWidth 6063 .loading=${this.loading} 6064 size="lg" 6065 borderRadius="xs" 6066 @click=${this.handleContinue.bind(this)} 6067 >Choose name 6068 </wui-button> 6069 </wui-flex>`}handleContinue(){Pe.push("RegisterAccountName"),Et.sendEvent({type:"track",event:"OPEN_ENS_FLOW",properties:{isSmartAccount:$s(ne.state.activeChain)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT}})}};U5.styles=BVe;Pre([Me()],U5.prototype,"loading",void 0);U5=Pre([Qe("w3m-choose-account-name-view")],U5);var FVe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
6069a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let EI=class extends tt{constructor(){var e;super(...arguments),this.wallet=(e=Pe.state.data)==null?void 0:e.wallet}render(){if(!this.wallet)throw new Error("w3m-downloads-view");return se` 6070 <wui-flex gap="2" flexDirection="column" .padding=${["3","3","4","3"]}> 6071 ${this.chromeTemplate()} ${this.iosTemplate()} ${this.androidTemplate()} 6072 ${this.homepageTemplate()} 6073 </wui-flex> 6074 `}chromeTemplate(){var e;return(e=this.wallet)!=null&&e.chrome_store?se`<wui-list-item 6075 variant="icon" 6076 icon="chromeStore" 6077 iconVariant="square" 6078 @click=${this.onChromeStore.bind(this)} 6079 chevron 6080 > 6081 <wui-text variant="md-medium" color="primary">Chrome Extension</wui-text> 6082 </wui-list-item>`:null}iosTemplate(){var e;return(e=this.wallet)!=null&&e.app_store?se`<wui-list-item 6083 variant="icon" 6084 icon="appStore" 6085 iconVariant="square" 6086 @click=${this.onAppStore.bind(this)} 6087 chevron 6088 > 6089 <wui-text variant="md-medium" color="primary">iOS App</wui-text> 6090 </wui-list-item>`:null}androidTemplate(){var e;return(e=this.wallet)!=null&&e.play_store?se`<wui-list-item 6091 variant="icon" 6092 icon="playStore" 6093 iconVariant="square" 6094 @click=${this.onPlayStore.bind(this)} 6095 chevron 6096 > 6097 <wui-text variant="md-medium" color="primary">Android App</wui-text> 6098 </wui-list-item>`:null}homepageTemplate(){var e;return(e=this.wallet)!=null&&e.homepage?se` 6099 <wui-list-item 6100 variant="icon" 6101 icon="browser" 6102 iconVariant="square-blue" 6103 @click=${this.onHomePage.bind(this)} 6104 chevron 6105 > 6106 <wui-text variant="md-medium" color="primary">Website</wui-text> 6107 </wui-list-item> 6108 `:null}openStore(e){e.href&&this.wallet&&(Et.sendEvent({type:"track",event:"GET_WALLET",properties:{name:this.wallet.name,walletRank:this.wallet.order,explorerId:this.wallet.id,type:e.type}}),Ue.openHref(e.href,"_blank"))}onChromeStore(){var e;(e=this.wallet)!=null&&e.chrome_store&&this.openStore({href:this.wallet.chrome_store,type:"chrome_store"})}onAppStore(){var e;(e=this.wallet)!=null&&e.app_store&&this.openStore({href:this.wallet.app_store,type:"app_store"})}onPlayStore(){var e;(e=this.wallet)!=null&&e.play_store&&this.openStore({href:this.wallet.play_store,type:"play_store"})}onHomePage(){var e;(e=this.wallet)!=null&&e.homepage&&this.openStore({href:this.wallet.homepage,type:"homepage"})}};EI=FVe([Qe("w3m-downloads-view")],EI);var jVe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const VVe="https://walletconnect.com/explorer";let _I=class extends tt{render(){return se` 6109 <wui-flex flexDirection="column" .padding=${["0","3","3","3"]} gap="2"> 6110 ${this.recommendedWalletsTemplate()} 6111 <w3m-list-wallet 6112 name="Explore all" 6113 showAllWallets 6114 walletIcon="allWallets" 6115 icon="externalLink" 6116 size="sm" 6117 @click=${()=>{Ue.openHref("https://walletconnect.com/explorer?type=wallet","_blank")}} 6118 ></w3m-list-wallet> 6119 </wui-flex> 6120 `}recommendedWalletsTemplate(){const{recommended:e,featured:n}=ut.state,{customWallets:i}=ye.state;return[...n,...i??[],...e].slice(0,4).map((r,o)=>se` 6121 <w3m-list-wallet 6122 displayIndex=${o} 6123 name=${r.name??"Unknown"} 6124 tagVariant="accent" 6125 size="sm" 6126 imageSrc=${xt(qi.getWalletImage(r))} 6127 @click=${()=>{this.onWalletClick(r)}} 6128 ></w3m-list-wallet> 6129 `)}onWalletClick(e){Et.sendEvent({type:"track",event:"GET_WALLET",properties:{name:e.name,walletRank:void 0,explorerId:e.id,type:"homepage"}}),Ue.openHref(e.homepage??VVe,"_blank")}};_I=jVe([Qe("w3m-get-wallet-view")],_I);const WVe=Tn`<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"> 6130 <rect width="64" height="64" fill="#F7931A"/> 6131 <g clip-path="url(#clip0_1045_17)"> 6132 <path d="M63.0394 39.7409C58.7654 56.8839 41.4024 67.3169 24.2574 63.0419C7.11937 58.7679 -3.31363 41.4039 0.962367 24.2619C5.23437 7.11686 22.5974 -3.31714 39.7374 0.956863C56.8814 5.23086 67.3134 22.5969 63.0394 39.7409Z" fill="#F7931A"/> 6133 <path d="M46.1092 27.4409C46.7462 23.1829 43.5042 20.8939 39.0712 19.3669L40.5092 13.5989L36.9982
613312.7239L35.5982 18.3399C34.6752 18.1099 33.7272 17.8929 32.7852 17.6779L34.1952 12.0249L30.6862 11.1499L29.2472 16.9159C28.4832 16.7419 27.7332 16.5699 27.0052 16.3889L27.0092 16.3709L22.1672 15.1619L21.2332 18.9119C21.2332 18.9119 23.8382 19.5089 23.7832 19.5459C25.2052 19.9009 25.4622 20.8419 25.4192 21.5879L23.7812 28.1589C23.8792 28.1839 24.0062 28.2199 24.1462 28.2759C24.0292 28.2469 23.9042 28.2149 23.7752 28.1839L21.4792 37.3889C21.3052 37.8209 20.8642 38.4689 19.8702 38.2229C19.9052 38.2739 17.3182 37.5859 17.3182 37.5859L15.5752 41.6049L20.1442 42.7439C20.9942 42.9569 21.8272 43.1799 22.6472 43.3899L21.1942 49.2239L24.7012 50.0989L26.1402 44.3269C27.0982 44.5869 28.0282 44.8269 28.9382 45.0529L27.5042 50.7979L31.0152 51.6729L32.4682 45.8499C38.4552 46.9829 42.9572 46.5259 44.8522 41.1109C46.3792 36.7509 44.7762 34.2359 41.6262 32.5959C43.9202 32.0669 45.6482 30.5579 46.1092 27.4409ZM38.0872 38.6899C37.0022 43.0499 29.6612 40.6929 27.2812 40.1019L29.2092 32.3729C31.5892 32.9669 39.2212 34.1429 38.0872 38.6899ZM39.1732 27.3779C38.1832 31.3439 32.0732 29.3289 30.0912 28.8349L31.8392 21.8249C33.8212 22.3189 40.2042 23.2409 39.1732 27.3779Z" fill="white"/> 6134 </g> 6135 <defs> 6136 <clipPath id="clip0_1045_17"> 6137 <rect width="64" height="64" fill="white"/> 6138 </clipPath> 6139 </defs> 6140</svg> 6141`,qVe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6142 <rect width="60" height="60" fill="#1DC956" rx="30" /> 6143 <circle cx="30" cy="30" r="3" fill="#fff" /> 6144 <path 6145 fill="#2BEE6C" 6146 stroke="#fff" 6147 stroke-width="2" 6148 d="m45.32 17.9-.88-.42.88.42.02-.05c.1-.2.21-.44.26-.7l-.82-.15.82.16a2 2 0 0 0-.24-1.4c-.13-.23-.32-.42-.47-.57a8.42 8.42 0 0 1-.04-.04l-.04-.04a2.9 2.9 0 0 0-.56-.47l-.51.86.5-.86a2 2 0 0 0-1.4-.24c-.26.05-.5.16-.69.26l-.05.02-15.05 7.25-.1.05c-1.14.55-1.85.89-2.46 1.37a7 7 0 0 0-1.13 1.14c-.5.6-.83 1.32-1.38 2.45l-.05.11-7.25 15.05-.02.05c-.1.2-.21.43-.26.69a2 2 0 0 0 .24 1.4l.85-.5-.85.5c.13.23.32.42.47.57l.04.04.04.04c.15.15.34.34.56.47a2 2 0 0 0 1.41.24l-.2-.98.2.98c.25-.05.5-.17.69-.26l.05-.02-.42-.87.42.87 15.05-7.25.1-.05c1.14-.55 1.85-.89 2.46-1.38a7 7 0 0 0 1.13-1.13 12.87 12.87 0 0 0 1.43-2.56l7.25-15.05Z" 6149 /> 6150 <path 6151 fill="#1DC956" 6152 d="M33.38 32.72 30.7 29.3 15.86 44.14l.2.2a1 1 0 0 0 1.14.2l15.1-7.27a3 3 0 0 0 1.08-4.55Z" 6153 /> 6154 <path 6155 fill="#86F999" 6156 d="m26.62 27.28 2.67 3.43 14.85-14.85-.2-.2a1 1 0 0 0-1.14-.2l-15.1 7.27a3 3 0 0 0-1.08 4.55Z" 6157 /> 6158 <circle cx="30" cy="30" r="3" fill="#fff" transform="rotate(45 30 30)" /> 6159 <rect width="59" height="59" x=".5" y=".5" stroke="#062B2B" stroke-opacity=".1" rx="29.5" /> 6160</svg> `,zVe=Tn`<svg viewBox="0 0 60 60" fill="none"> 6161 <g clip-path="url(#clip0_7734_50402)"> 6162 <path 6163 d="M0 24.9C0 15.6485 0 11.0228 1.97053 7.56812C3.3015 5.23468 5.23468 3.3015 7.56812 1.97053C11.0228 0 15.6485 0 24.9 0H35.1C44.3514 0 48.9772 0 52.4319 1.97053C54.7653 3.3015 56.6985 5.23468 58.0295 7.56812C60 11.0228 60 15.6485 60 24.9V35.1C60 44.3514 60 48.9772 58.0295 52.4319C56.6985 54.7653 54.7653 56.6985 52.4319 58.0295C48.9772 60 44.3514 60 35.1 60H24.9C15.6485 60 11.0228 60 7.56812 58.0295C5.23468 56.6985 3.3015 54.7653 1.97053 52.4319C0 48.9772 0 44.3514 0 35.1V24.9Z" 6164 fill="#EB8B47" 6165 /> 6166 <path 6167 d="M0.5 24.9C0.5 20.2652 0.50047 16.8221 0.744315 14.105C0.987552 11.3946 1.46987 9.45504 2.40484 7.81585C3.69145 5.56019 5.56019 3.69145 7.81585 2.40484C9.45504 1.46987 11.3946 0.987552 14.105 0.744315C16.8221 0.50047 20.2652 0.5 24.9 0.5H35.1C39.7348 0.5 43.1779 0.50047 45.895 0.744315C48.6054 0.987552 50.545 1.46987 52.1841 2.40484C54.4398 3.69145 56.3086 5.56019 57.5952 7.81585C58.5301 9.45504 59.0124 11.3946 59.2557 14.105C59.4995 16.8221 59.5 20.2652 59.5 24.9V35.1C59.5 39.7348 59.4995 43.1779 59.2557 45.895C59.0124 48.6054 58.5301 50.545 57.5952 52.1841C56.3086 54.4398 54.4398 56.3086 52.1841 57.5952C50.545 58.5301 48.6054 59.0124 45.895 59.2557C43.1779 59.4995 39.7348 59.5 35.1 59.5H24.9C20.2652 59.5 16.8221 59.4995 14.105 59.2557C11.3946 59.0124 9.45504 58.5301 7.81585 57.5952C5.56019 56.3086 3.69145 54.4398 2.40484 52.1841C1.46987 50.545 0.987552 48.6054 0.744315 45.895C0.50047 43.1779 0.5 39.7348 0.5 35.1V24.9Z" 6168 stroke="#062B2B" 6169 stroke-opacity="0.1" 6170 /> 6171 <path 6172 d="M19 52C24.5228 52 29 47.5228 29 42C29 36.4772 24.5228 32
617219 32C13.4772 32 9 36.4772 9 42C9 47.5228 13.4772 52 19 52Z" 6173 fill="#FF974C" 6174 stroke="white" 6175 stroke-width="2" 6176 /> 6177 <path 6178 fill-rule="evenodd" 6179 clip-rule="evenodd" 6180 d="M42.8437 8.3264C42.4507 7.70891 41.5493 7.70891 41.1564 8.32641L28.978 27.4638C28.5544 28.1295 29.0326 29.0007 29.8217 29.0007H54.1783C54.9674 29.0007 55.4456 28.1295 55.022 27.4638L42.8437 8.3264Z" 6181 fill="white" 6182 /> 6183 <path 6184 fill-rule="evenodd" 6185 clip-rule="evenodd" 6186 d="M42.3348 11.6456C42.659 11.7608 42.9061 12.1492 43.4005 12.926L50.7332 24.4488C51.2952 25.332 51.5763 25.7737 51.5254 26.1382C51.4915 26.3808 51.3698 26.6026 51.1833 26.7614C50.9031 27 50.3796 27 49.3327 27H34.6673C33.6204 27 33.0969 27 32.8167 26.7614C32.6302 26.6026 32.5085 26.3808 32.4746 26.1382C32.4237 25.7737 32.7048 25.332 33.2669 24.4488L40.5995 12.926C41.0939 12.1492 41.341 11.7608 41.6652 11.6456C41.8818 11.5687 42.1182 11.5687 42.3348 11.6456ZM35.0001 26.999C38.8661 26.999 42.0001 23.865 42.0001 19.999C42.0001 23.865 45.1341 26.999 49.0001 26.999H35.0001Z" 6187 fill="#FF974C" 6188 /> 6189 <path 6190 d="M10.1061 9.35712C9.9973 9.67775 9.99867 10.0388 9.99978 10.3323C9.99989 10.3611 10 10.3893 10 10.4167V25.5833C10 25.6107 9.99989 25.6389 9.99978 25.6677C9.99867 25.9612 9.9973 26.3222 10.1061 26.6429C10.306 27.2317 10.7683 27.694 11.3571 27.8939C11.6777 28.0027 12.0388 28.0013 12.3323 28.0002C12.3611 28.0001 12.3893 28 12.4167 28H19C24.5228 28 29 23.5228 29 18C29 12.4772 24.5228 8 19 8H12.4167C12.3893 8 12.3611 7.99989 12.3323 7.99978C12.0388 7.99867 11.6778 7.9973 11.3571 8.10614C10.7683 8.306 10.306 8.76834 10.1061 9.35712Z" 6191 fill="#FF974C" 6192 stroke="white" 6193 stroke-width="2" 6194 /> 6195 <circle cx="19" cy="18" r="4" fill="#EB8B47" stroke="white" stroke-width="2" /> 6196 <circle cx="19" cy="42" r="4" fill="#EB8B47" stroke="white" stroke-width="2" /> 6197 </g> 6198 <defs> 6199 <clipPath id="clip0_7734_50402"> 6200 <rect width="60" height="60" fill="white" /> 6201 </clipPath> 6202 </defs> 6203</svg> `,HVe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6204 <g clip-path="url(#a)"> 6205 <path 6206 fill="#1DC956" 6207 d="M0 25.01c0-9.25 0-13.88 1.97-17.33a15 15 0 0 1 5.6-5.6C11.02.11 15.65.11 24.9.11h10.2c9.25 0 13.88 0 17.33 1.97a15 15 0 0 1 5.6 5.6C60 11.13 60 15.76 60 25v10.2c0 9.25 0 13.88-1.97 17.33a15 15 0 0 1-5.6 5.6c-3.45 1.97-8.08 1.97-17.33 1.97H24.9c-9.25 0-13.88 0-17.33-1.97a15 15 0 0 1-5.6-5.6C0 49.1 0 44.46 0 35.21v-10.2Z" 6208 /> 6209 <path 6210 fill="#2BEE6C" 6211 d="M16.1 60c-3.82-.18-6.4-.64-8.53-1.86a15 15 0 0 1-5.6-5.6C.55 50.06.16 46.97.04 41.98L4.2 40.6a4 4 0 0 0 2.48-2.39l4.65-12.4a2 2 0 0 1 2.5-1.2l2.53.84a2 2 0 0 0 2.43-1l2.96-5.94a2 2 0 0 1 3.7.32l3.78 12.58a2 2 0 0 0 3.03 1.09l3.34-2.23a2 2 0 0 0 .65-.7l5.3-9.72a2 2 0 0 1 1.42-1.01l4.14-.69a2 2 0 0 1 1.6.44l3.9 3.24a2 2 0 0 0 2.7-.12l4.62-4.63c.08 2.2.08 4.8.08 7.93v10.2c0 9.25 0 13.88-1.97 17.33a15 15 0 0 1-5.6 5.6c-2.13 1.22-4.7 1.68-8.54 1.86H16.11Z" 6212 /> 6213 <path 6214 fill="#fff" 6215 d="m.07 43.03-.05-2.1 3.85-1.28a3 3 0 0 0 1.86-1.79l4.66-12.4a3 3 0 0 1 3.75-1.8l2.53.84a1 1 0 0 0 1.21-.5l2.97-5.94a3 3 0 0 1 5.56.48l3.77 12.58a1 1 0 0 0 1.51.55l3.34-2.23a1 1 0 0 0 .33-.35l5.3-9.71a3 3 0 0 1 2.14-1.53l4.13-.69a3 3 0 0 1 2.41.66l3.9 3.24a1 1 0 0 0 1.34-.06l5.28-5.28c.05.85.08 1.75.1 2.73L56 22.41a3 3 0 0 1-4.04.19l-3.9-3.25a1 1 0 0 0-.8-.21l-4.13.69a1 1 0 0 0-.72.5l-5.3 9.72a3 3 0 0 1-.97 1.05l-3.34 2.23a3 3 0 0 1-4.53-1.63l-3.78-12.58a1 1 0 0 0-1.85-.16l-2.97 5.94a3 3 0 0 1-3.63 1.5l-2.53-.84a1 1 0 0 0-1.25.6l-4.65 12.4a5 5 0 0 1-3.1 3L.07 43.02Z" 6216 /> 6217 <path 6218 fill="#fff" 6219 fill-rule="evenodd" 6220 d="M49.5 19a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Z" 6221 clip-rule="evenodd" 6222 /> 6223 <path fill="#fff" d="M45 .28v59.66l-2 .1V.19c.7.02 1.37.05 2 .1Z" /> 6224 <path fill="#2BEE6C" d="M47.5 19a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z" /> 6225 <path 6226 stroke="#fff" 6227 stroke-opacity=".1" 6228 d="M.5 25.01c0-4.63 0-8.08.24-10.8.25-2.7.73-4.64 1.66-6.28a14.5 14.5 0 0 1 5.42-5.41C9.46 1.58 11.39 1.1 14.1.85A133 133 0 0 1 24.9.61h10.2c4.63 0 8.08 0 10.8.24 2.7.25 4.65.73 6.28 1.67a14.5 14.5 0 0 1 5.42 5.4c.93 1.65 1.41 3.58 1.66 6.3.24 2.71.24 6.16.24 10.79v10.2c0 4.64 0 8.08-.24 10.8-.25 2.7-.73 4.65-1.66 6.28a14.5 14.5 0 0 1-5.42 5.42c-1.63.93-3.57 1.41-6.28 1.66-2.72.24-6.17.24-10.8.24H24.9c-4.63 0-8.08 0-10.8-.24-2.7-.25-4.64-.73-6.28-1.66a14.5 14.5 0 0 1-5.42-5.42C1.47 50.66 1 48.72.74 46.01A133 133 0 0 1 .5 35.2v-10.2Z" 6229 /> 6230 </g>
6231 <defs> 6232 <clipPath id="a"><path fill="#fff" d="M0 0h60v60H0z" /></clipPath> 6233 </defs> 6234</svg>`,GVe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6235 <g clip-path="url(#a)"> 6236 <rect width="60" height="60" fill="#C653C6" rx="30" /> 6237 <path 6238 fill="#E87DE8" 6239 d="M57.98.01v19.5a4.09 4.09 0 0 0-2.63 2.29L50.7 34.2a2 2 0 0 1-2.5 1.2l-2.53-.84a2 2 0 0 0-2.42 1l-2.97 5.94a2 2 0 0 1-3.7-.32L32.8 28.6a2 2 0 0 0-3.02-1.09l-3.35 2.23a2 2 0 0 0-.64.7l-5.3 9.72a2 2 0 0 1-1.43 1.01l-4.13.69a2 2 0 0 1-1.61-.44l-3.9-3.24a2 2 0 0 0-2.69.12L2.1 42.93.02 43V.01h57.96Z" 6240 /> 6241 <path 6242 fill="#fff" 6243 d="m61.95 16.94.05 2.1-3.85 1.28a3 3 0 0 0-1.86 1.79l-4.65 12.4a3 3 0 0 1-3.76 1.8l-2.53-.84a1 1 0 0 0-1.2.5l-2.98 5.94a3 3 0 0 1-5.55-.48l-3.78-12.58a1 1 0 0 0-1.5-.55l-3.35 2.23a1 1 0 0 0-.32.35l-5.3 9.72a3 3 0 0 1-2.14 1.52l-4.14.69a3 3 0 0 1-2.41-.66l-3.9-3.24a1 1 0 0 0-1.34.06l-5.28 5.28c-.05-.84-.08-1.75-.1-2.73l3.97-3.96a3 3 0 0 1 4.04-.19l3.89 3.25a1 1 0 0 0 .8.21l4.14-.68a1 1 0 0 0 .71-.51l5.3-9.71a3 3 0 0 1 .97-1.06l3.34-2.23a3 3 0 0 1 4.54 1.63l3.77 12.58a1 1 0 0 0 1.86.16l2.96-5.93a3 3 0 0 1 3.64-1.5l2.52.83a1 1 0 0 0 1.25-.6l4.66-12.4a5 5 0 0 1 3.1-2.99l4.43-1.48Z" 6244 /> 6245 <path 6246 fill="#fff" 6247 fill-rule="evenodd" 6248 d="M35.5 27a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Z" 6249 clip-rule="evenodd" 6250 /> 6251 <path fill="#fff" d="M31 0v60h-2V0h2Z" /> 6252 <path fill="#E87DE8" d="M33.5 27a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z" /> 6253 </g> 6254 <rect width="59" height="59" x=".5" y=".5" stroke="#fff" stroke-opacity=".1" rx="29.5" /> 6255 <defs> 6256 <clipPath id="a"><rect width="60" height="60" fill="#fff" rx="30" /></clipPath> 6257 </defs> 6258</svg> `,KVe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6259 <g clip-path="url(#a)"> 6260 <rect width="60" height="60" fill="#987DE8" rx="30" /> 6261 <path 6262 fill="#fff" 6263 fill-rule="evenodd" 6264 d="m15.48 28.37 11.97-19.3a3 3 0 0 1 5.1 0l11.97 19.3a6 6 0 0 1 .9 3.14v.03a6 6 0 0 1-1.16 3.56L33.23 50.2a4 4 0 0 1-6.46 0L15.73 35.1a6 6 0 0 1-1.15-3.54v-.03a6 6 0 0 1 .9-3.16Z" 6265 clip-rule="evenodd" 6266 /> 6267 <path 6268 fill="#643CDD" 6269 d="M30.84 10.11a1 1 0 0 0-.84-.46V24.5l12.6 5.53a2 2 0 0 0-.28-1.4L30.84 10.11Z" 6270 /> 6271 <path 6272 fill="#BDADEB" 6273 d="M30 9.65a1 1 0 0 0-.85.46L17.66 28.64a2 2 0 0 0-.26 1.39L30 24.5V9.65Z" 6274 /> 6275 <path 6276 fill="#643CDD" 6277 d="M30 50.54a1 1 0 0 0 .8-.4l11.24-15.38c.3-.44-.2-1-.66-.73l-9.89 5.68a3 3 0 0 1-1.5.4v10.43Z" 6278 /> 6279 <path 6280 fill="#BDADEB" 6281 d="m17.97 34.76 11.22 15.37c.2.28.5.41.8.41V40.11a3 3 0 0 1-1.49-.4l-9.88-5.68c-.47-.27-.97.3-.65.73Z" 6282 /> 6283 <path 6284 fill="#401AB3" 6285 d="M42.6 30.03 30 24.5v13.14a3 3 0 0 0 1.5-.4l10.14-5.83a2 2 0 0 0 .95-1.38Z" 6286 /> 6287 <path 6288 fill="#7C5AE2" 6289 d="M30 37.64V24.46l-12.6 5.57a2 2 0 0 0 .97 1.39l10.13 5.82a3 3 0 0 0 1.5.4Z" 6290 /> 6291 </g> 6292 <rect width="59" height="59" x=".5" y=".5" stroke="#fff" stroke-opacity=".1" rx="29.5" /> 6293 <defs> 6294 <clipPath id="a"><rect width="60" height="60" fill="#fff" rx="30" /></clipPath> 6295 </defs> 6296</svg> `,YVe=Tn`<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"> 6297 <rect width="64" height="64" rx="30" fill="#1DC956"/> 6298 <rect x="0.5" y="0.5" width="63" height="63" rx="29.5" stroke="#141414" stroke-opacity="0.1"/> 6299 <path d="M32.4053 19.8031C35.3901 19.8031 38.0431 20.8349 40.1619 22.8247L45.9656 17.0211C42.4465 13.7416 37.8773 11.7333 32.4053 11.7333C24.4829 11.7333 17.6475 16.2841 14.3127 22.9168L21.056 28.1493C22.6589 23.359 27.136 19.8031 32.4053 19.8031Z" fill="#1DC956" stroke="white" stroke-width="2" stroke-linejoin="round"/> 6300 <path d="M32.4053 52.2667C37.8773 52.2667 42.465 50.4611 45.8182 47.3658L39.2407 42.2623C37.4351 43.4783 35.1321 44.2153 32.4053 44.2153C27.136 44.2153 22.6589 40.6594 21.056 35.8691L14.3127 41.1016C17.6475 47.7159 24.4829 52.2667 32.4053 52.2667Z" fill="#2BEE6C"/> 6301 <path d="M21.056 35.8507L19.5636 36.993L14.3127 41.0832M39.2407 42.2623L45.8182 47.3658C42.465 50.4611 37.8773 52.2667 32.4053 52.2667C24.4829 52.2667 17.6475 47.7159 14.3127 41.1016L21.056 35.8691C22.6589 40.6594 27.136 44.2153 32.4053 44.2153C35.1321 44.2153 37.4351 43.4783 39.2407 42.2623Z" stroke="white" stroke-width="2" stroke-linejoin="round"/> 6302 <path d="M51.8613 32.4606C51.8613 31.0235 51.7323 29.6417 51.4928 28.3151H32.4053V36.1638H43.3124C42.8334 38.688 41.3963 40.8252 39.2407 42.2623L45.8181 47.3658C49.6503 43.8283 51.8613 38.6327 51.8613 32.4606Z" fill="#1FAD7E" stroke="white" stroke-width="2" stroke-linejoin="round"/> 6303 <path d="M21.056 35.8507C20.6507 34.6347 20.4111 33.345 20.4111 32C20.4111 30.655 20.6507 29.3
6303653 21.056 28.1493L14.3127 22.9169C12.9309 25.6437 12.1387 28.7205 12.1387 32C12.1387 35.2795 12.9309 38.3564 14.3127 41.0831L19.5636 36.993L21.056 35.8507Z" fill="#86F999"/> 6304 <path d="M21.056 35.8691L14.3127 41.1016M21.056 35.8507C20.6507 34.6347 20.4111 33.345 20.4111 32C20.4111 30.655 20.6507 29.3653 21.056 28.1493L14.3127 22.9169C12.9309 25.6437 12.1387 28.7205 12.1387 32C12.1387 35.2795 12.9309 38.3564 14.3127 41.0831L19.5636 36.993L21.056 35.8507Z" stroke="white" stroke-width="2" stroke-linejoin="round"/> 6305</svg> 6306`,ZVe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6307 <rect width="60" height="60" fill="#1DC956" rx="3" /> 6308 <path 6309 fill="#1FAD7E" 6310 stroke="#fff" 6311 stroke-width="2" 6312 d="m30.49 29.13-.49-.27-.49.27-12.77 7.1-.05.02c-.86.48-1.58.88-2.1 1.24-.54.37-1.04.81-1.28 1.45a3 3 0 0 0 0 2.12c.24.63.74 1.08 1.27 1.45.53.36 1.25.76 2.11 1.24l.05.03 6.33 3.51.17.1c2.33 1.3 3.72 2.06 5.22 2.32a9 9 0 0 0 3.08 0c1.5-.26 2.9-1.03 5.22-2.32l.18-.1 6.32-3.51.05-.03a26.9 26.9 0 0 0 2.1-1.24 3.21 3.21 0 0 0 1.28-1.45l-.94-.35.94.35a3 3 0 0 0 0-2.12l-.94.35.94-.35a3.21 3.21 0 0 0-1.27-1.45c-.53-.36-1.25-.76-2.11-1.24l-.05-.03-12.77-7.1Z" 6313 /> 6314 <path 6315 fill="#2BEE6C" 6316 stroke="#fff" 6317 stroke-width="2" 6318 d="m30.49 19.13-.49-.27-.49.27-12.77 7.1-.05.02c-.86.48-1.58.88-2.1 1.24-.54.37-1.04.81-1.28 1.45a3 3 0 0 0 0 2.12c.24.63.74 1.08 1.27 1.45.53.36 1.25.76 2.11 1.24l.05.03 6.33 3.51.17.1c2.33 1.3 3.72 2.06 5.22 2.32a9 9 0 0 0 3.08 0c1.5-.26 2.9-1.03 5.22-2.32l.18-.1 6.32-3.51.05-.03a26.9 26.9 0 0 0 2.1-1.24 3.21 3.21 0 0 0 1.28-1.45l-.94-.35.94.35a3 3 0 0 0 0-2.12l-.94.35.94-.35a3.21 3.21 0 0 0-1.27-1.45c-.53-.36-1.25-.76-2.11-1.24l-.05-.03-12.77-7.1Z" 6319 /> 6320 <path 6321 fill="#86F999" 6322 stroke="#fff" 6323 stroke-width="2" 6324 d="m46.69 21.06-.94-.35.94.35a3 3 0 0 0 0-2.12l-.94.35.94-.35a3.21 3.21 0 0 0-1.27-1.45c-.53-.36-1.25-.76-2.11-1.24l-.05-.03-6.32-3.51-.18-.1c-2.33-1.3-3.72-2.06-5.22-2.33a9 9 0 0 0-3.08 0c-1.5.27-2.9 1.04-5.22 2.33l-.17.1-6.33 3.51-.05.03c-.86.48-1.58.88-2.1 1.24-.54.37-1.04.81-1.28 1.45a3 3 0 0 0 0 2.12c.24.63.74 1.08 1.27 1.45.53.36 1.25.76 2.11 1.24l.05.03 6.33 3.51.17.1c2.33 1.3 3.72 2.06 5.22 2.32a9 9 0 0 0 3.08 0c1.5-.26 2.9-1.03 5.22-2.32l.18-.1 6.32-3.51.05-.03a26.9 26.9 0 0 0 2.1-1.24 3.21 3.21 0 0 0 1.28-1.45Z" 6325 /> 6326 <rect width="59" height="59" x=".5" y=".5" stroke="#fff" stroke-opacity=".1" rx="2.5" /> 6327</svg>`,QVe=Tn`<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"> 6328 <g clip-path="url(#clip0_241_31636)"> 6329 <path d="M0 26.5595C0 16.6913 0 11.7572 2.1019 8.07217C3.5216 5.58318 5.58366 3.52111 8.07266 2.10141C11.7577 -0.000488281 16.6918 -0.000488281 26.56 -0.000488281H37.44C47.3082 -0.000488281 52.2423 -0.000488281 55.9273 2.10141C58.4163 3.52111 60.4784 5.58318 61.8981 8.07217C64 11.7572 64 16.6913 64 26.5595V37.4395C64 47.3077 64 52.2418 61.8981 55.9269C60.4784 58.4159 58.4163 60.4779 55.9273 61.8976C52.2423 63.9995 47.3082 63.9995 37.44 63.9995H26.56C16.6918 63.9995 11.7577 63.9995 8.07266 61.8976C5.58366 60.4779 3.5216 58.4159 2.1019 55.9269C0 52.2418 0 47.3077 0 37.4395V26.5595Z" fill="#794CFF"/> 6330 <path d="M0.5 26.5595C0.5 21.6163 0.50047 17.942 0.760736 15.0418C1.02039 12.1485 1.53555 10.0742 2.53621 8.3199C3.91155 5.90869 5.90917 3.91106 8.32039 2.53572C10.0747 1.53506 12.1489 1.01991 15.0423 0.760247C17.9425 0.499981 21.6168 0.499512 26.56 0.499512H37.44C42.3832 0.499512 46.0575 0.499981 48.9577 0.760247C51.8511 1.01991 53.9253 1.53506 55.6796 2.53572C58.0908 3.91106 60.0885 5.90869 61.4638 8.3199C62.4645 10.0742 62.9796 12.1485 63.2393 15.0418C63.4995 17.942 63.5 21.6163 63.5 26.5595V37.4395C63.5 42.3827 63.4995 46.057 63.2393 48.9572C62.9796 51.8506 62.4645 53.9248 61.4638 55.6791C60.0885 58.0903 58.0908 60.088 55.6796 61.4633C53.9253 62.464 51.8511 62.9791 48.9577 63.2388C46.0575 63.499 42.3832 63.4995 37.44 63.4995H26.56C21.6168 63.4995 17.9425 63.499 15.0423 63.2388C12.1489 62.9791 10.0747 62.464 8.32039 61.4633C5.90917 60.088 3.91155 58.0903 2.53621 55.6791C1.53555 53.9248 1.02039 51.8506 0.760736 48.9572C0.50047 46.057 0.5 42.3827 0.5 37.4395V26.5595Z" stroke="#141414" stroke-opacity="0.1"/> 6331 <path d="M40 39.4595C44.7824 36.693 48 31.5222 48 25.6C48 16.7634 40.8366 9.59998 32 9.59998C23.1634 9.59998 16 16.7634 16 25.6C16 31.5222 19.2176 36.693 24 39.4595V45.8144H40V39.4595Z" fill="#906EF7"/> 6332 <path d="M24 49.9689C24 51.8192 24 52.7444 24.3941 53.4353C24.6603 53.902 25.0469 54.2886 25.5136 54.5548C26.2046 54.9489 27.1297 54.9489 28.98 54.9489H35.02C36.8703 54.9489 37.7954 54.9489 38.4864 54.5548C38.9531 54.2886 39.3397 53.902 39.6059 53.4353C40 52.7444 40 51.8192 40 49.9689V45.8144H24V49.9689Z" fill="#906EF7"/> 6333 <path d="M24 45.8144V39.4595C19.2176 36.693 16 31.5222 16 25.6C16 16.7634 23.1634 9.59998 32 9.59998C40.8366 9.59998 48 16.7634 48 25.6C48 31.5222 44.7824 36.693 40 39.4595V45.8144M24 45.8144H40M24 45.8144V49.9689C24 51.8192 24 52.7444 24.3941 53.4353C24.6603 53.902 25.0469 54.2886 25.5136 54.5548C26.2046 54.9489 27.1297 54.9489 28.98 54.9489H35.02C36.8703 54.9489 37.7954 54.9489 38.4864 54.5548C38.9531 54.2886 39.3397 53.902 39.6059 53.4353C40 52.7444 40 51.8192 40 49.9689V45.8144" stroke="white" stroke-width="2" stroke-linejoin="round"/> 6334 <path d="M24 49.9689C24 51.8192 24 52.7444 24.3941 53.4353C24.6603 53.902 25.0469 54.2886 25.5136 54.5548C26.2046 54.9489 27.1297 54.9489 28.98 54.9489H35.02C36.8703 54.9489 37.7954 54.9489 38.4864 54.5548C38.9531 54.2886 39.3397 53.902 39.6059 53.4353C40 52.7444 40 51.8192 40 49.9689V45.8144H24V49.9689Z" fill="#643CDD" stroke="white" stroke-width="2" stroke-linejoin="round"/> 6335 <path d="M29.6735 26.9101V29.1109H34.0753V26.9101C34.0753 25.6945 35.0607 24.7092 36.2762 24.7092C37.4917 24.7092 38.4771 25.6945 38.4771 26.9101C38.4771 28.1256 37.4917 29.1109 36.2762 29.1109H34.0753H29.6735H27.4726C26.2571 29.1109 25.2717 28.1256 25.2717 26.9101C25.2717 25.6945 26.2571 24.7092 27.4726 24.7092C28.6881 24.7092 29.6735 25.6945 29.6735 26.9101Z" fill="#906EF7"/> 6336 <path d="M29.6735 45.3183V26.9101C29.6735 25.6945 28.6881 24.7092 27.4726 24.7092V24.7092C26.2571 24.7092 25.2717 25.6945 25.2717 26.9101V26.9101C25.2717 28.1256 26.2571 29.1109 27.4726 29.1109H36.2762C37.4917 29.1109 38.4771 28.1256 38.4771 26.9101V26.9101C38.4771 25.6945 37.4917 24.7092 36.2762 24.7092V24.7092C35.0607 24.7092 34.0753 25.6945 34.0753 26.9101V45.3183" stroke="white" stroke-width="2" stroke-linejoin="round"/> 6337 </g>
6338 <defs> 6339 <clipPath id="clip0_241_31636"> 6340 <rect width="64" height="64" fill="white"/> 6341 </clipPath> 6342 </defs> 6343</svg> 6344`,XVe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6345 <rect width="60" height="60" fill="#C653C6" rx="3" /> 6346 <path 6347 fill="#fff" 6348 d="M20.03 15.22C20 15.6 20 16.07 20 17v2.8c0 1.14 0 1.7-.2 2.12-.15.31-.3.5-.58.71-.37.28-1.06.42-2.43.7-.59.12-1.11.29-1.6.51a9 9 0 0 0-4.35 4.36C10 30 10 32.34 10 37c0 4.66 0 7 .84 8.8a9 9 0 0 0 4.36 4.36C17 51 19.34 51 24 51h12c4.66 0 7 0 8.8-.84a9 9 0 0 0 4.36-4.36C50 44 50 41.66 50 37c0-4.66 0-7-.84-8.8a9 9 0 0 0-4.36-4.36c-.48-.22-1-.39-1.6-.5-1.36-.29-2.05-.43-2.42-.7-.27-.22-.43-.4-.58-.72-.2-.42-.2-.98-.2-2.11V17c0-.93 0-1.4-.03-1.78a9 9 0 0 0-8.19-8.19C31.4 7 30.93 7 30 7s-1.4 0-1.78.03a9 9 0 0 0-8.19 8.19Z" 6349 /> 6350 <path 6351 fill="#E87DE8" 6352 d="M22 17c0-.93 0-1.4.04-1.78a7 7 0 0 1 6.18-6.18C28.6 9 29.07 9 30 9s1.4 0 1.78.04a7 7 0 0 1 6.18 6.18c.04.39.04.85.04 1.78v4.5a1.5 1.5 0 0 1-3 0V17c0-.93 0-1.4-.08-1.78a4 4 0 0 0-3.14-3.14C31.39 12 30.93 12 30 12s-1.4 0-1.78.08a4 4 0 0 0-3.14 3.14c-.08.39-.08.85-.08 1.78v4.5a1.5 1.5 0 0 1-3 0V17Z" 6353 /> 6354 <path 6355 fill="#E87DE8" 6356 fill-rule="evenodd" 6357 d="M12 36.62c0-4.32 0-6.48.92-8.09a7 7 0 0 1 2.61-2.61C17.14 25 19.3 25 23.62 25h6.86c.46 0 .7 0 .9.02 2.73.22 4.37 2.43 4.62 4.98.27-2.7 2.11-5 5.02-5A6.98 6.98 0 0 1 48 31.98v5.4c0 4.32 0 6.48-.92 8.09a7 7 0 0 1-2.61 2.61c-1.61.92-3.77.92-8.09.92h-5.86c-.46 0-.7 0-.9-.02-2.73-.22-4.37-2.43-4.62-4.98-.26 2.58-1.94 4.82-4.71 4.99l-.7.01c-.55 0-.82 0-1.05-.02a7 7 0 0 1-6.52-6.52c-.02-.23-.02-.5-.02-1.05v-4.79Zm21.24-.27a4 4 0 1 0-6.48 0 31.28 31.28 0 0 1 1.57 2.23c.17.4.17.81.17 1.24V42.5a1.5 1.5 0 0 0 3 0V39.82c0-.43 0-.85.17-1.24.09-.2.58-.87 1.57-2.23Z" 6358 clip-rule="evenodd" 6359 /> 6360 <rect width="59" height="59" x=".5" y=".5" stroke="#fff" stroke-opacity=".1" rx="2.5" /> 6361</svg>`,JVe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6362 <g clip-path="url(#a)"> 6363 <path 6364 fill="#EB8B47" 6365 d="M0 24.9c0-9.25 0-13.88 1.97-17.33a15 15 0 0 1 5.6-5.6C11.02 0 15.65 0 24.9 0h10.2c9.25 0 13.88 0 17.33 1.97a15 15 0 0 1 5.6 5.6C60 11.02 60 15.65 60 24.9v10.2c0 9.25 0 13.88-1.97 17.33a15 15 0 0 1-5.6 5.6C48.98 60 44.35 60 35.1 60H24.9c-9.25 0-13.88 0-17.33-1.97a15 15 0 0 1-5.6-5.6C0 48.98 0 44.35 0 35.1V24.9Z" 6366 /> 6367 <path 6368 stroke="#062B2B" 6369 stroke-opacity=".1" 6370 d="M.5 24.9c0-4.64 0-8.08.24-10.8.25-2.7.73-4.65 1.66-6.28A14.5 14.5 0 0 1 7.82 2.4C9.46 1.47 11.39 1 14.1.74A133 133 0 0 1 24.9.5h10.2c4.63 0 8.08 0 10.8.24 2.7.25 4.65.73 6.28 1.66a14.5 14.5 0 0 1 5.42 5.42c.93 1.63 1.41 3.57 1.66 6.28.24 2.72.24 6.16.24 10.8v10.2c0 4.63 0 8.08-.24 10.8-.25 2.7-.73 4.64-1.66 6.28a14.5 14.5 0 0 1-5.42 5.41c-1.63.94-3.57 1.42-6.28 1.67-2.72.24-6.17.24-10.8.24H24.9c-4.63 0-8.08 0-10.8-.24-2.7-.25-4.64-.73-6.28-1.67a14.5 14.5 0 0 1-5.42-5.4C1.47 50.53 1 48.6.74 45.88A133 133 0 0 1 .5 35.1V24.9Z" 6371 /> 6372 <path 6373 fill="#FF974C" 6374 stroke="#fff" 6375 stroke-width="2" 6376 d="M39.2 29.2a13 13 0 1 0-18.4 0l1.3 1.28a12.82 12.82 0 0 1 2.1 2.39 6 6 0 0 1 .6 1.47c.2.76.2 1.56.2 3.17v11.24c0 1.08 0 1.61.13 2.12a4 4 0 0 0 .41.98c.26.45.64.83 1.4 1.6l.3.29c.65.65.98.98 1.36 1.09.26.07.54.07.8 0 .38-.11.7-.44 1.36-1.1l3.48-3.47c.65-.65.98-.98 1.09-1.36a1.5 1.5 0 0 0 0-.8c-.1-.38-.44-.7-1.1-1.36l-.47-.48c-.
637665-.65-.98-.98-1.09-1.36a1.5 1.5 0 0 1 0-.8c.1-.38.44-.7 1.1-1.36l.47-.48c.65-.65.98-.98 1.09-1.36a1.5 1.5 0 0 0 0-.8c-.1-.38-.44-.7-1.1-1.36l-.48-.5c-.65-.64-.98-.97-1.08-1.35a1.5 1.5 0 0 1 0-.79c.1-.38.42-.7 1.06-1.36l5.46-5.55Z" 6377 /> 6378 <circle cx="30" cy="17" r="4" fill="#EB8B47" stroke="#fff" stroke-width="2" /> 6379 </g> 6380 <defs> 6381 <clipPath id="a"><path fill="#fff" d="M0 0h60v60H0z" /></clipPath> 6382 </defs> 6383</svg> `,eWe=Tn`<svg width="40" height="42" viewBox="0 0 40 42" fill="none"> 6384<path opacity="0.7" d="M19.9526 41.9076L7.3877 34.655V26.1226L19.9526 33.3751V41.9076Z" fill="url(#paint0_linear_2113_32117)"/> 6385<path opacity="0.7" d="M19.9521 41.9076L32.5171 34.655V26.1226L19.9521 33.3751V41.9076Z" fill="url(#paint1_linear_2113_32117)"/> 6386<path opacity="0.7" d="M39.9095 7.34521V21.8562L32.5166 26.1225V11.6114L39.9095 7.34521Z" fill="url(#paint2_linear_2113_32117)"/> 6387<path d="M39.9099 7.34536L27.345 0.0927734L19.9521 4.359L32.5171 11.6116L39.9099 7.34536Z" fill="url(#paint3_linear_2113_32117)"/> 6388<path d="M0 7.34536L12.5649 0.0927734L19.9519 4.359L7.387 11.6116L0 7.34536Z" fill="#F969D3"/> 6389<path opacity="0.7" d="M0 7.34521V21.8562L7.387 26.1225V11.6114L0 7.34521Z" fill="url(#paint4_linear_2113_32117)"/> 6390<defs> 6391<linearGradient id="paint0_linear_2113_32117" x1="18.6099" y1="41.8335" x2="7.73529" y2="8.31842" gradientUnits="userSpaceOnUse"> 6392<stop stop-color="#E98ADA"/> 6393<stop offset="1" stop-color="#7E4DBD"/> 6394</linearGradient> 6395<linearGradient id="paint1_linear_2113_32117" x1="26.2346" y1="26.1226" x2="26.2346" y2="41.9076" gradientUnits="userSpaceOnUse"> 6396<stop stop-color="#719DED"/> 6397<stop offset="1" stop-color="#2545BE"/> 6398</linearGradient> 6399<linearGradient id="paint2_linear_2113_32117" x1="36.213" y1="7.34521" x2="36.213" y2="26.1225" gradientUnits="userSpaceOnUse"> 6400<stop stop-color="#93EBFF"/> 6401<stop offset="1" stop-color="#197DDB"/> 6402</linearGradient> 6403<linearGradient id="paint3_linear_2113_32117" x1="29.931" y1="0.0927734" x2="38.2156" y2="14.8448" gradientUnits="userSpaceOnUse"> 6404<stop stop-color="#F969D3"/> 6405<stop offset="1" stop-color="#4F51C0"/> 6406</linearGradient> 6407<linearGradient id="paint4_linear_2113_32117" x1="18.1251" y1="44.2539" x2="-7.06792" y2="15.2763" gradientUnits="userSpaceOnUse"> 6408<stop stop-color="#E98ADA"/> 6409<stop offset="1" stop-color="#7E4DBD"/> 6410</linearGradient> 6411</defs> 6412</svg>`,tWe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6413 <g clip-path="url(#a)"> 6414 <rect width="60" height="60" fill="#00ACE6" rx="30" /> 6415 <circle cx="64" cy="39" r="50" fill="#1AC6FF" stroke="#fff" stroke-width="2" /> 6416 <circle cx="78" cy="30" r="50" fill="#4DD2FF" stroke="#fff" stroke-width="2" /> 6417 <circle cx="72" cy="15" r="35" fill="#80DFFF" stroke="#fff" stroke-width="2" /> 6418 <circle cx="34" cy="-17" r="45" stroke="#fff" stroke-width="2" /> 6419 <circle cx="34" cy="-5" r="50" stroke="#fff" stroke-width="2" /> 6420 <circle cx="30" cy="45" r="4" fill="#4DD2FF" stroke="#fff" stroke-width="2" /> 6421 <circle cx="39.5" cy="27.5" r="4" fill="#80DFFF" stroke="#fff" stroke-width="2" /> 6422 <circle cx="16" cy="24" r="4" fill="#19C6FF" stroke="#fff" stroke-width="2" /> 6423 </g> 6424 <rect width="59" height="59" x=".5" y=".5" stroke="#062B2B" stroke-opacity=".1" rx="29.5" /> 6425 <defs> 6426 <clipPath id="a"><rect width="60" height="60" fill="#fff" rx="30" /></clipPath> 6427 </defs> 6428</svg>`,nWe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6429 <g clip-path="url(#a)"> 6430 <rect width="60" height="60" fill="#C653C6" rx="3" /> 6431 <path 6432 fill="#E87DE8" 6433 stroke="#fff" 6434 stroke-width="2" 6435 d="M52.1 47.34c0-4.24-1.44-9.55-5.9-12.4a2.86 2.86 0 0 0-1.6-3.89v-.82c0-1.19-.52-2.26-1.35-3a4.74 4.74 0 0 0-2.4-6.26v-5.5a11.31 11.31 0 1 0-22.63 0v2.15a3.34 3.34 0 0 0-1.18 5.05 4.74 4.74 0 0 0-.68 6.44A5.22 5.22 0 0 0 14 35.92c-3.06 4.13-6.1 8.3-6.1 15.64 0 2.67.37 4.86.74 6.39a20.3 20.3 0 0 0 .73 2.39l.02.04v.01l.92-.39-.92.4.26.6h38.26l.3-.49-.87-.51.86.5.02-.01.03-.07a16.32 16.32 0 0 0 .57-1.05c.36-.72.85-1.74 1.33-2.96a25.51 25.51 0 0 0 1.94-9.07Z" 6436 /> 6437 <path 6438 fill="#fff" 6439 fill-rule="evenodd" 6440 d="M26.5 29.5c-3-.5-5.5-3-5.5-7v-7c0-.47 0-.7.03-.9a3 3 0 0 1 2.58-2.57c.2-.03.42-.03.89-.03 2 0 2.5-2.5 2.5-2.5s0 2.5 2.5 2.5c1.4 0 2.1 0 2.65.23a3 3 0 0 1 1.62 1.62c.23.55.23 1.25.23 2.65v6c0 4-3 7-6.5 7 1.35.23 4 0 6.5-2v9.53C34 38.5 31.5 40 28 40s-6-1.5-6-2.97L24 34l2.5 1.5v-6ZM26 47h4.5c2.5 0 3 4 3 5.5h-3l-1-1.5H26v-4Zm-6.25 5.5H24V57h-8c0-1 1-4.5 3.75-4.5Z" 6441 clip-rule="evenodd" 6442 /> 6443 </g> 6444 <rect width="59" height="59" x=".5" y=".5" stroke="#fff" stroke-opacity=".1" rx="2.5" /> 6445 <defs> 6446 <clipPath id="a"><rect width="60" height="60" fill="#fff" rx="3" /></clipPath> 6447 </defs> 6448</svg> `,iWe=Tn`<svg fill="none" viewBox="0 0 60 60"> 6449 <rect width="60" height="60" fill="#794CFF" rx="3" /> 6450 <path 6451 fill="#987DE8" 6452 stroke="#fff" 6453 stroke-width="2" 6454 d="M33 22.5v-1H16v5H8.5V36H13v-5h3v7.5h17V31h1v7.5h17v-17H34v5h-1v-4Z" 6455 /> 6456 <path fill="#fff" d="M37.5 25h10v10h-10z" /> 6457 <path fill="#4019B2" d="M42.5 25h5v10h-5z" /> 6458 <path fill="#fff" d="M19.5 25h10v10h-10z" /> 6459 <path fill="#4019B2" d="M24.5 25h5v10h-5z" /> 6460 <path fill="#fff" d="M12 30.5h4V37h-4v-6.5Z" /> 6461 <rect width="59" height="59" x=".5" y=".5" stroke="#fff" stroke-opacity=".1" rx="2.5" /> 6462</svg>
6462`,sWe=Tn`<svg width="60" height="60" viewBox="0 0 60 60" fill="none"> 6463<g clip-path="url(#clip0_13859_31161)"> 6464 <path d="M0 24.8995C0 15.6481 0 11.0223 1.97053 7.56763C3.3015 5.2342 5.23468 3.30101 7.56812 1.97004C11.0228 -0.000488281 15.6485 -0.000488281 24.9 -0.000488281H35.1C44.3514 -0.000488281 48.9772 -0.000488281 52.4319 1.97004C54.7653 3.30101 56.6985 5.2342 58.0295 7.56763C60 11.0223 60 15.6481 60 24.8995V35.0995C60 44.351 60 48.9767 58.0295 52.4314C56.6985 54.7648 54.7653 56.698 52.4319 58.029C48.9772 59.9995 44.3514 59.9995 35.1 59.9995H24.9C15.6485 59.9995 11.0228 59.9995 7.56812 58.029C5.23468 56.698 3.3015 54.7648 1.97053 52.4314C0 48.9767 0 44.351 0 35.0995V24.8995Z" fill="#EB8B47"/> 6465 <path d="M0.5 24.8995C0.5 20.2647 0.50047 16.8216 0.744315 14.1045C0.987552 11.3941 1.46987 9.45455 2.40484 7.81536C3.69145 5.55971 5.56019 3.69096 7.81585 2.40435C9.45504 1.46938 11.3946 0.987064 14.105 0.743826C16.8221 0.499981 20.2652 0.499512 24.9 0.499512H35.1C39.7348 0.499512 43.1779 0.499981 45.895 0.743826C48.6054 0.987064 50.545 1.46938 52.1841 2.40435C54.4398 3.69096 56.3086 5.55971 57.5952 7.81536C58.5301 9.45455 59.0124 11.3941 59.2557 14.1045C59.4995 16.8216 59.5 20.2647 59.5 24.8995V35.0995C59.5 39.7343 59.4995 43.1774 59.2557 45.8945C59.0124 48.6049 58.5301 50.5445 57.5952 52.1837C56.3086 54.4393 54.4398 56.3081 52.1841 57.5947C50.545 58.5296 48.6054 59.012 45.895 59.2552C43.1779 59.499 39.7348 59.4995 35.1 59.4995H24.9C20.2652 59.4995 16.8221 59.499 14.105 59.2552C11.3946 59.012 9.45504 58.5296 7.81585 57.5947C5.56019 56.3081 3.69145 54.4393 2.40484 52.1837C1.46987 50.5445 0.987552 48.6049 0.744315 45.8945C0.50047 43.1774 0.5 39.7343 0.5 35.0995V24.8995Z" stroke="#141414" stroke-opacity="0.1"/> 6466 <path d="M13 26.0335C13 21.7838 13 19.659 14.0822 18.1694C14.4318 17.6883 14.8548 17.2653 15.3359 16.9157C16.8255 15.8335 18.9503 15.8335 23.2 15.8335H36.8C41.0497 15.8335 43.1745 15.8335 44.6641 16.9157C45.1452 17.2653 45.5682 17.6883 45.9178 18.1694C47 19.659 47 21.7838 47 26.0335V33.9668C47 38.2165 47 40.3414 45.9178 41.831C45.5682 42.312 45.1452 42.7351 44.6641 43.0846C43.1745 44.1668 41.0497 44.1668 36.8 44.1668H23.2C18.9503 44.1668 16.8255 44.1668 15.3359 43.0846C14.8548 42.7351 14.4318 42.312 14.0822 41.831C13 40.3414 13 38.2165 13 33.9668V26.0335Z" fill="#FF974C" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6467 <path d="M39.5 36.667H36.6666" stroke="white" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/> 6468 <path d="M45.2 23.0645H14.8C14.0501 23.0645 13.6751 23.0645 13.4122 23.2554C13.3273 23.3171 13.2527 23.3918 13.191 23.4767C13 23.7395 13 24.1145 13 24.8645V27.2645C13 28.0144 13 28.3894 13.191 28.6522C13.2527 28.7371 13.3273 28.8118 13.4122 28.8735C13.6751 29.0645 14.0501 29.0645 14.8 29.0645H45.2C45.9499 29.0645 46.3249 29.0645 46.5878 28.8735C46.6727 28.8118 46.7473 28.7371 46.809 28.6522C47 28.3894 47 28.0144 47 27.2645V24.8645C47 24.1145 47 23.7395 46.809 23.4767C46.7473 23.3918 46.6727 23.3171 46.5878 23.2554C46.3249 23.0645 45.9499 23.0645 45.2 23.0645Z" fill="white" fill-opacity="0.4" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6469</g> 6470<defs> 6471 <clipPath id="clip0_13859_31161"> 6472 <rect width="60" height="60" fill="white"/> 6473 </clipPath> 6474</defs> 6475</svg>`,rWe=Tn`<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"> 6476 <g clip-path="url(#clip0_241_31635)"> 6477 <path d="M0 26.5595C0 16.6913 0 11.7572 2.1019 8.07217C3.5216 5.58317 5.58366 3.52111 8.07266 2.10141C11.7577 -0.000488281 16.6918 -0.000488281 26.56 -0.000488281H37.44C47.3082 -0.000488281 52.2423 -0.000488281 55.9273 2.10141C58.4163 3.52111 60.4784 5.58317 61.8981 8.07217C64 11.7572 64 16.6913 64 26.5595V37.4395C64 47.3077 64 52.2418 61.8981 55.9268C60.4784 58.4158 58.4163 60.4779 55.9273 61.8976C52.2423 63.9995 47.3082 63.9995 37.44 63.9995H26.56C16.6918 63.9995 11.7577 63.9995 8.07266 61.8976C5.58366 60.4779 3.5216 58.4158 2.1019 55.9268C0 52.2418 0 47.3077 0 37.4395V26.5595Z" fill="#EB8B47"/> 6478 <path d="M0.5 26.5595C0.5 21.6163 0.50047 17.942 0.760736 15.0418C1.02039 12.1485 1.53555 10.0742 2.53621 8.3199
6478C3.91155 5.90869 5.90917 3.91106 8.32039 2.53572C10.0747 1.53506 12.1489 1.01991 15.0423 0.760247C17.9425 0.499981 21.6168 0.499512 26.56 0.499512H37.44C42.3832 0.499512 46.0575 0.499981 48.9577 0.760247C51.8511 1.01991 53.9253 1.53506 55.6796 2.53572C58.0908 3.91106 60.0885 5.90869 61.4638 8.3199C62.4645 10.0742 62.9796 12.1485 63.2393 15.0418C63.4995 17.942 63.5 21.6163 63.5 26.5595V37.4395C63.5 42.3827 63.4995 46.057 63.2393 48.9572C62.9796 51.8506 62.4645 53.9248 61.4638 55.6791C60.0885 58.0903 58.0908 60.088 55.6796 61.4633C53.9253 62.464 51.8511 62.9791 48.9577 63.2388C46.0575 63.499 42.3832 63.4995 37.44 63.4995H26.56C21.6168 63.4995 17.9425 63.499 15.0423 63.2388C12.1489 62.9791 10.0747 62.464 8.32039 61.4633C5.90917 60.088 3.91155 58.0903 2.53621 55.6791C1.53555 53.9248 1.02039 51.8506 0.760736 48.9572C0.50047 46.057 0.5 42.3827 0.5 37.4395V26.5595Z" stroke="#141414" stroke-opacity="0.1"/> 6479 <path d="M28.1042 49.2329L13.1024 51.2077L15.0772 36.2059L37.1015 14.1815C39.2441 12.039 40.3154 10.9677 41.5718 10.624C42.4205 10.3918 43.3159 10.3918 44.1645 10.624C45.421 10.9677 46.4922 12.039 48.6348 14.1815L50.1286 15.6753C52.2711 17.8179 53.3424 18.8891 53.6861 20.1456C53.9183 20.9942 53.9183 21.8896 53.6861 22.7383C53.3424 23.9947 52.2711 25.066 50.1286 27.2086L28.1042 49.2329Z" fill="#FF974C" stroke="#E4E7E7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6480 <path d="M38.5962 20.5376L22.4199 36.7139" stroke="#E4E7E7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6481 <path d="M43.7727 25.714L27.5964 41.8903" stroke="#E4E7E7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6482 <path d="M22.3703 36.7635C19.3258 39.808 16.0198 36.6395 16.2616 35.0324" stroke="#E4E7E7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6483 <path d="M27.5466 41.9399C24.5034 44.9831 28.155 48.7098 29.2738 48.0475" stroke="#E4E7E7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6484 <path d="M27.5468 41.9398C23.428 46.0586 18.2516 40.8822 22.3704 36.7634" stroke="#E4E7E7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6485 <path d="M15.8191 50.5214C15.4711 49.5823 14.728 48.8392 13.7889 48.4912" stroke="#E4E7E7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> 6486 <path d="M49.2862 29.5805L34.7275 15.0219" stroke="#E4E7E7" stroke-width="2" stroke-linejoin="round"/> 6487 </g> 6488 <defs> 6489 <clipPath id="clip0_241_31635"> 6490 <rect width="64" height="64" fill="white"/> 6491 </clipPath> 6492 </defs> 6493</svg> 6494`,oWe=Tn`<svg 6495 viewBox="0 0 60 60" 6496 fill="none" 6497> 6498 <g clip-path="url(#1)"> 6499 <rect width="60" height="60" rx="30" fill="#00ACE6" /> 6500 <path 6501 d="M59 73C59 89.0163 46.0163 102 30 102C13.9837 102 1 89.0163 1 73C1 56.9837 12 44 30 44C48 44 59 56.9837 59 73Z" 6502 fill="#1AC6FF" 6503 stroke="white" 6504 stroke-width="2" 6505 /> 6506 <path 6507 d="M18.6904 19.9015C19.6264 15.3286 23.3466 11.8445 27.9708 11.2096C29.3231 11.024 30.6751 11.0238 32.0289 11.2096C36.6532 11.8445 40.3733 15.3286 41.3094 19.9015C41.4868 20.7681 41.6309 21.6509 41.7492 22.5271C41.8811 23.5041 41.8811 24.4944 41.7492 25.4715C41.6309 26.3476 41.4868 27.2304 41.3094 28.097C40.3733 32.6699 36.6532 36.154 32.0289 36.7889C30.6772 36.9744 29.3216 36.9743 27.9708 36.7889C23.3466 36.154 19.6264 32.6699 18.6904 28.097C18.513 27.2304 18.3689 26.3476 18.2506 25.4715C18.1186 24.4944 18.1186 23.5041 18.2506 22.5271C18.3689 21.6509 18.513 20.7681 18.6904 19.9015Z" 6508 fill="#1AC6FF" 6509 stroke="white" 6510 stroke-width="2" 6511 /> 6512 <circle cx="24.5" cy="23.5" r="1.5" fill="white" /> 6513 <circle cx="35.5" cy="23.5" r="1.5" fill="white" /> 6514 <path 6515 d="M31 20L28 28H32" 6516 stroke="white" 6517 stroke-width="2" 6518 stroke-linecap="round" 6519 stroke-linejoin="round" 6520 /> 6521 </g> 6522 <rect x="0.5" y="0.5" width="59" height="59" rx="29.5" stroke="white" stroke-opacity="0.1" /> 6523 <defs> 6524 <clipPath id="1"> 6525 <rect width="60" height="60" rx="30" fill="white" /> 6526 </clipPath> 6527 </defs> 6528</svg> `,aWe=Tn`<svg fill="none" viewBox="0 0 80 80"> 6529 <g clip-path="url(#a)"> 6530 <path fill="url(#b)" d="M40 80a40 40 0 1 0 0-80 40 40 0 0 0 0 80Z" /> 6531 <path 6532 stroke="#fff" 6533 stroke-opacity=".1" 6534 d="M79.5 40a39.5 39.5 0 1 1-79 0 39.5 39.5 0 0 1 79 0Z" 6535 /> 6536 <path 6537 fill="#fff" 6538 d="m62.62 51.54-7.54 7.91a1.75 1.75 0 0 1-1.29.55H18.02a.9.9 0 0 1-.8-.52.84.84 0 0 1 .16-.92l7.55-7.92a1.75 1.75 0 0 1 1.28-.55h35.77a.87.87 0 0 1 .8.52.84.84 0 0 1-.16.93Zm-7.54-15.95a1.75 1.75 0 0 0-1.29-.54H18.02a.89.89 0 0 0-.8.51.84.84 0 0 0 .16.93l7.55 7.92a1.75 1.75 0 0 0 1.28.54h35.77a.89.89 0 0 0 .8-.51.84.84 0 0 0-.16-.93l-7.54-7.92ZM18.02 29.9h35.77a1.79 1.79 0 0 0 1.29-.54l7.54-7.92a.85.85 0 0 0 .16-.93.87.87 0 0 0-.8-.51H26.21a1.79 1.79 0 0 0-1.28.54l-7.55 7.92a.85.85 0 0 0-.16.93.89.89 0 0 0 .8.52Z" 6539 /> 6540 </g>
6541 <defs> 6542 <linearGradient id="b" x1="6.75" x2="80.68" y1="81.91" y2="7.37" gradientUnits="userSpaceOnUse"> 6543 <stop offset=".08" stop-color="#9945FF" /> 6544 <stop offset=".3" stop-color="#8752F3" /> 6545 <stop offset=".5" stop-color="#5497D5" /> 6546 <stop offset=".6" stop-color="#43B4CA" /> 6547 <stop offset=".72" stop-color="#28E0B9" /> 6548 <stop offset=".97" stop-color="#19FB9B" /> 6549 </linearGradient> 6550 <clipPath id="a"><path fill="#fff" d="M0 0h80v80H0z" /></clipPath> 6551 </defs> 6552</svg> `,cWe=Tn`<svg viewBox="0 0 60 60" fill="none"> 6553 <g clip-path="url(#1)"> 6554 <path 6555 d="M0 24.9C0 15.6485 0 11.0228 1.97053 7.56812C3.3015 5.23468 5.23468 3.3015 7.56812 1.97053C11.0228 0 15.6485 0 24.9 0H35.1C44.3514 0 48.9772 0 52.4319 1.97053C54.7653 3.3015 56.6985 5.23468 58.0295 7.56812C60 11.0228 60 15.6485 60 24.9V35.1C60 44.3514 60 48.9772 58.0295 52.4319C56.6985 54.7653 54.7653 56.6985 52.4319 58.0295C48.9772 60 44.3514 60 35.1 60H24.9C15.6485 60 11.0228 60 7.56812 58.0295C5.23468 56.6985 3.3015 54.7653 1.97053 52.4319C0 48.9772 0 44.3514 0 35.1V24.9Z" 6556 fill="#794CFF" 6557 /> 6558 <path 6559 d="M0.5 24.9C0.5 20.2652 0.50047 16.8221 0.744315 14.105C0.987552 11.3946 1.46987 9.45504 2.40484 7.81585C3.69145 5.56019 5.56019 3.69145 7.81585 2.40484C9.45504 1.46987 11.3946 0.987552 14.105 0.744315C16.8221 0.50047 20.2652 0.5 24.9 0.5H35.1C39.7348 0.5 43.1779 0.50047 45.895 0.744315C48.6054 0.987552 50.545 1.46987 52.1841 2.40484C54.4398 3.69145 56.3086 5.56019 57.5952 7.81585C58.5301 9.45504 59.0124 11.3946 59.2557 14.105C59.4995 16.8221 59.5 20.2652 59.5 24.9V35.1C59.5 39.7348 59.4995 43.1779 59.2557 45.895C59.0124 48.6054 58.5301 50.545 57.5952 52.1841C56.3086 54.4398 54.4398 56.3086 52.1841 57.5952C50.545 58.5301 48.6054 59.0124 45.895 59.2557C43.1779 59.4995 39.7348 59.5 35.1 59.5H24.9C20.2652 59.5 16.8221 59.4995 14.105 59.2557C11.3946 59.0124 9.45504 58.5301 7.81585 57.5952C5.56019 56.3086 3.69145 54.4398 2.40484 52.1841C1.46987 50.545 0.987552 48.6054 0.744315 45.895C0.50047 43.1779 0.5 39.7348 0.5 35.1V24.9Z" 6560 stroke="#062B2B" 6561 stroke-opacity="0.1" 6562 /> 6563 <path 6564 d="M35.1403 31.5016C35.1193 30.9637 35.388 30.4558 35.8446 30.1707C36.1207 29.9982 36.4761 29.8473 36.7921 29.7685C37.3143 29.6382 37.8664 29.7977 38.2386 30.1864C38.8507 30.8257 39.3004 31.6836 39.8033 32.408C40.2796 33.0942 41.4695 33.2512 41.9687 32.5047C42.4839 31.7341 42.9405 30.8229 43.572 30.1399C43.9375 29.7447 44.4866 29.5756 45.0111 29.6967C45.3283 29.7701 45.6863 29.9147 45.9655 30.0823C46.4269 30.3595 46.7045 30.8626 46.6928 31.4008C46.6731 32.3083 46.3764 33.2571 46.2158 34.1473C46.061 35.0048 46.9045 35.8337 47.7592 35.664C48.6464 35.4878 49.5899 35.1747 50.497 35.1391C51.0348 35.1181 51.5427 35.3868 51.8279 35.8433C52.0004 36.1195 52.1513 36.4749 52.2301 36.7908C52.3604 37.3131 52.2009 37.8651 51.8121 38.2374C51.1729 38.8495 50.3151 39.2991 49.5908 39.8019C48.9046 40.2782 48.7473 41.4683 49.4939 41.9675C50.2644 42.4827 51.1757 42.9393 51.8587 43.5708C52.2539 43.9362 52.423 44.4854 52.3018 45.0099C52.2285 45.3271 52.0839 45.6851 51.9162 45.9642C51.6391 46.4257 51.1359 46.7032 50.5978 46.6916C49.6903 46.6719 48.7417 46.3753 47.8516 46.2146C46.9939 46.0598 46.1648 46.9035 46.3346 47.7583C46.5108 48.6454 46.8239 49.5888 46.8594 50.4958C46.8805 51.0336 46.6117 51.5415 46.1552 51.8267C45.879 51.9992 45.5236 52.15 45.2077 52.2289C44.6854 52.3592 44.1334 52.1997 43.7611 51.8109C43.1491 51.1718 42.6996 50.314 42.1968 49.5897C41.7203 48.9034 40.5301 48.7463 40.0309 49.493C39.5157 50.2634 39.0592 51.1746 38.4278 51.8574C38.0623 52.2527 37.5132 52.4218 36.9887 52.3006C36.6715 52.2273 36.3135 52.0826 36.0343 51.915C35.5729 51.6379 35.2953 51.1347 35.307 50.5966C35.3267 49.6891 35.6233 48.7405 35.7839 47.8505C35.9388 46.9928 35.0951 46.1636 34.2402 46.3334C33.3531 46.5096 32.4098 46.8227 31.5028 46.8582C30.9649 46.8793 30.457 46.6105 30.1719 46.154C29.9994 45.8778 29.8485 45.5224 29.7697 45.2065C29.6394 44.6842 29.7989 44.1322 30.1877 43.7599C30.8269 43.1479 31.6847 42.6982 32.4091 42.1954C33.0954 41.7189 33.2522 40.5289 32.5056 40.0297C31.7351 39.5145 30.824 39.058 30.1411 38.4265C29.7459 38.0611 29.5768 37.5119 29.698 36.9875C29.7713 36.6702 29.9159 36.3122 30.0836 36.0331C30.3607 35.5
6564717 30.8638 35.2941 31.402 35.3058C32.3095 35.3255 33.2583 35.6221 34.1485 35.7828C35.006 35.9376 35.8349 35.094 35.6652 34.2393C35.489 33.3521 35.1759 32.4087 35.1403 31.5016Z" 6565 fill="#906EF7" 6566 stroke="white" 6567 stroke-width="2" 6568 /> 6569 <path 6570 d="M20.7706 8.22357C20.9036 7.51411 21.5231 7 22.2449 7H23.7551C24.4769 7 25.0964 7.51411 25.2294 8.22357C25.5051 9.69403 25.4829 11.6321 27.1202 12.2606C27.3092 12.3331 27.4958 12.4105 27.6798 12.4926C29.2818 13.2072 30.6374 11.8199 31.8721 10.9752C32.4678 10.5676 33.2694 10.6421 33.7798 11.1525L34.8477 12.2204C35.3581 12.7308 35.4326 13.5323 35.025 14.128C34.1802 15.3627 32.7931 16.7183 33.5077 18.3202C33.5898 18.5043 33.6672 18.6909 33.7398 18.88C34.3683 20.5171 36.3061 20.4949 37.7764 20.7706C38.4859 20.9036 39 21.5231 39 22.2449V23.7551C39 24.4769 38.4859 25.0964 37.7764 25.2294C36.3061 25.5051 34.3685 25.483 33.7401 27.1201C33.6675 27.3093 33.59 27.4961 33.5079 27.6803C32.7934 29.282 34.1803 30.6374 35.025 31.8719C35.4326 32.4677 35.3581 33.2692 34.8477 33.7796L33.7798 34.8475C33.2694 35.3579 32.4678 35.4324 31.8721 35.0248C30.6376 34.1801 29.2823 32.7934 27.6806 33.508C27.4962 33.5903 27.3093 33.6678 27.12 33.7405C25.483 34.3688 25.5051 36.3062 25.2294 37.7764C25.0964 38.4859 24.4769 39 23.7551 39H22.2449C21.5231 39 20.9036 38.4859 20.7706 37.7764C20.4949 36.3062 20.517 34.3688 18.88 33.7405C18.6908 33.6678 18.5039 33.5903 18.3196 33.5081C16.7179 32.7936 15.3625 34.1804 14.1279 35.0251C13.5322 35.4327 12.7307 35.3582 12.2203 34.8478L11.1524 33.7799C10.642 33.2695 10.5675 32.4679 10.9751 31.8722C11.8198 30.6376 13.2067 29.2822 12.4922 27.6804C12.41 27.4962 12.3325 27.3093 12.2599 27.1201C11.6315 25.483 9.69392 25.5051 8.22357 25.2294C7.51411 25.0964 7 24.4769 7 23.7551V22.2449C7 21.5231 7.51411 20.9036 8.22357 20.7706C9.69394 20.4949 11.6317 20.5171 12.2602 18.88C12.3328 18.6909 12.4103 18.5042 12.4924 18.3201C13.207 16.7181 11.8198 15.3625 10.975 14.1278C10.5674 13.5321 10.6419 12.7305 11.1523 12.2201L12.2202 11.1522C12.7306 10.6418 13.5322 10.5673 14.1279 10.9749C15.3626 11.8197 16.7184 13.2071 18.3204 12.4925C18.5044 12.4105 18.6909 12.3331 18.8799 12.2606C20.5171 11.6321 20.4949 9.69403 20.7706 8.22357Z" 6571 fill="#906EF7" 6572 stroke="white" 6573 stroke-width="2" 6574 /> 6575 <circle cx="23" cy="23" r="6" fill="#794CFF" stroke="white" stroke-width="2" /> 6576 <circle cx="41" cy="41" r="4" fill="#794CFF" stroke="white" stroke-width="2" /> 6577 </g> 6578 <defs> 6579 <clipPath id="1"> 6580 <rect width="60" height="60" fill="white" /> 6581 </clipPath> 6582 </defs> 6583</svg> `,lWe=os` 6584 :host { 6585 display: block; 6586 width: var(--local-size); 6587 height: var(--local-size); 6588 } 6589 6590 :host svg { 6591 width: 100%; 6592 height: 100%; 6593 } 6594`;var qM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const uWe={browser:qVe,dao:zVe,defi:HVe,defiAlt:GVe,eth:KVe,layers:ZVe,lock:XVe,login:JVe,network:tWe,nft:nWe,noun:iWe,profile:oWe,system:cWe,meld:eWe,onrampCard:sWe,google:YVe,pencil:rWe,lightbulb:QVe,solana:aWe,ton:rre,bitcoin:WVe};let B5=class extends tt{constructor(){super(...arguments),this.name="browser",this.size="md"}render(){return this.style.cssText=` 6595 --local-size: var(--apkt-visual-size-${this.size}); 6596 `,se`${uWe[this.name]}`}};B5.styles=[vn,lWe];qM([le()],B5.prototype,"name",void 0);qM([le()],B5.prototype,"size",void 0);B5=qM([Qe("wui-visual")],B5);var Ire=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let SI=class extends tt{constructor(){super(...arguments),this.data=[]}render(){return se` 6597 <wui-flex flexDirection="column" alignItems="center" gap="4"> 6598 ${this.data.map(e=>se` 6599 <wui-flex flexDirection="column" alignItems="center" gap="5"> 6600 <wui-flex flexDirection="row" justifyContent="center" gap="1"> 6601 ${e.images.map(n=>se`<wui-visual size="sm" name=${n}></wui-visual>`)} 6602 </wui-flex> 6603 </wui-flex> 6604 <wui-flex flexDirection="column" alignItems="center" gap="1"> 6605 <wui-text variant="md-regular" color="primary" align="center">${e.title}</wui-text> 6606 <wui-text variant="sm-regular" color="secondary" align="center" 6607 >${e.text}</wui-text 6608 > 6609 </wui-flex> 6610 `)} 6611 </wui-flex> 6612 `}};Ire([le({type:Array})],SI.prototype,"data",void 0);SI=Ire([Qe("w3m-help-widget")],SI);var dWe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
6612a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const hWe=[{images:["login","profile","lock"],title:"One login for all of web3",text:"Log in to any app by connecting your wallet. Say goodbye to countless passwords!"},{images:["defi","nft","eth"],title:"A home for your digital assets",text:"A wallet lets you store, send and receive digital assets like cryptocurrencies and NFTs."},{images:["browser","noun","dao"],title:"Your gateway to a new web",text:"With your wallet, you can explore and interact with DeFi, NFTs, DAOs, and much more."}];let AI=class extends tt{render(){return se` 6613 <wui-flex 6614 flexDirection="column" 6615 .padding=${["6","5","5","5"]} 6616 alignItems="center" 6617 gap="5" 6618 > 6619 <w3m-help-widget .data=${hWe}></w3m-help-widget> 6620 <wui-button variant="accent-primary" size="md" @click=${this.onGetWallet.bind(this)}> 6621 <wui-icon color="inherit" slot="iconLeft" name="wallet"></wui-icon> 6622 Get a wallet 6623 </wui-button> 6624 </wui-flex> 6625 `}onGetWallet(){Et.sendEvent({type:"track",event:"CLICK_GET_WALLET_HELP"}),Pe.push("GetWallet")}};AI=dWe([Qe("w3m-what-is-a-wallet-view")],AI);const fWe=It` 6626 wui-flex { 6627 max-height: clamp(360px, 540px, 80vh); 6628 overflow: scroll; 6629 scrollbar-width: none; 6630 transition: opacity ${({durations:t})=>t.lg} 6631 ${({easings:t})=>t["ease-out-power-2"]}; 6632 will-change: opacity; 6633 } 6634 wui-flex::-webkit-scrollbar {
6635 display: none; 6636 } 6637 wui-flex.disabled { 6638 opacity: 0.3; 6639 pointer-events: none; 6640 user-select: none; 6641 } 6642`;var Dre=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let F5=class extends tt{constructor(){super(),this.unsubscribe=[],this.checked=fg.state.isLegalCheckboxChecked,this.unsubscribe.push(fg.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var c;const{termsConditionsUrl:e,privacyPolicyUrl:n}=ye.state,i=(c=ye.state.features)==null?void 0:c.legalCheckbox,r=!!(e||n)&&!!i,o=r&&!this.checked,a=o?-1:void 0;return se` 6643 <w3m-legal-checkbox></w3m-legal-checkbox> 6644 <wui-flex 6645 flexDirection="column" 6646 .padding=${r?["0","3","3","3"]:"3"} 6647 gap="2" 6648 class=${xt(o?"disabled":void 0)} 6649 > 6650 <w3m-wallet-login-list tabIdx=${xt(a)}></w3m-wallet-login-list> 6651 </wui-flex> 6652 `}};F5.styles=fWe;Dre([Me()],F5.prototype,"checked",void 0);F5=Dre([Qe("w3m-connect-wallets-view")],F5);const pWe=It` 6653 :host { 6654 display: block; 6655 width: 120px; 6656 height: 120px; 6657 } 6658 6659 svg { 6660 width: 120px; 6661 height: 120px; 6662 fill: none; 6663 stroke: transparent; 6664 stroke-linecap: round; 6665 } 6666 6667 use { 6668 stroke: ${t=>t.colors.accent100}; 6669 stroke-width: 2px; 6670 stroke-dasharray: 54, 118; 6671 stroke-dashoffset: 172; 6672 animation: dash 1s linear infinite; 6673 } 6674 6675 @keyframes dash { 6676 to { 6677 stroke-dashoffset: 0px; 6678 } 6679 } 6680`;var mWe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let TI=class extends tt{render(){return se` 6681 <svg viewBox="0 0 54 59"> 6682 <path 6683 id="wui-loader-path" 6684 d="M17.22 5.295c3.877-2.277 5.737-3.363 7.72-3.726a11.44 11.44 0 0 1 4.12 0c1.983.363 3.844 1.45 7.72 3.726l6.065 3.562c3.876 2.276 5.731 3.372 7.032 4.938a11.896 11.896 0 0 1 2.06 3.63c.683 1.928.688 4.11.688 8.663v7.124c0 4.553-.005 6.735-.688 8.664a11.896 11.896 0 0 1-2.06 3.63c-1.3 1.565-3.156 2.66-7.032 4.937l-6.065 3.563c-3.877 2.276-5.737 3.362-7.72 3.725a11.46 11.46 0 0 1-4.12 0c-1.983-.363-3.844-1.449-7.72-3.726l-6.065-3.562c-3.876-2.276-5.731-3.372-7.032-4.938a11.885 11.885 0 0 1-2.06-3.63c-.682-1.928-.688-4.11-.688-8.663v-7.124c0-4.553.006-6.735.688-8.664a11.885 11.885 0 0 1 2.06-3.63c1.3-1.565 3.156-2.66 7.032-4.937l6.065-3.562Z" 6685 /> 6686 <use xlink:href="#wui-loader-path"></use> 6687 </svg> 6688 `}};TI.styles=[vn,pWe];TI=mWe([Qe("wui-loading-hexagon")],TI);const gWe=Tn`<svg width="86" height="96" fill="none"> 6689 <path 6690 d="M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z" 6691 /> 6692</svg>`,yWe=Tn` 6693 <svg fill="none" viewBox="0 0 36 40"> 6694 <path 6695 d="M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z" 6696 /> 6697 </svg> 6698`,bWe=It` 6699 :host { 6700 position: relative; 6701 border-radius: inherit; 6702 display: flex; 6703 justify-content: center; 6704 align-items: center; 6705 width: var(--local-width); 6706 height: var(--local-height); 6707 } 6708 6709 :host([data-round='true']) { 6710 background: ${({tokens:t})=>t.theme.foregroundPrimary}; 6711 border-radius: 100%; 6712 outline: 1px solid ${({tokens:t})=>t.core.glass010}; 6713 } 6714 6715 svg { 6716 position: absolute; 6717 top: 0; 6718 left: 0; 6719 width: 100%; 6720 height: 100%; 6721 z-index: 1; 6722 } 6723 6724 svg > path { 6725 stroke: var(--local-stroke); 6726 } 6727 6728 wui-image { 6729 width: 100%; 6730 height: 100%; 6731 -webkit-clip-path: var(--local-path); 6732 clip-path: var(--local-path); 6733 background: ${({tokens:t})=>t.theme.foregroundPrimary}; 6734 } 6735 6736 wui-icon { 6737 transform: translateY(-5%); 6738 width: var(--local-icon-size); 6739 height: var(--local-icon-size); 6740 } 6741`;var M1=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
6741a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Pf=class extends tt{constructor(){super(...arguments),this.size="md",this.name="uknown",this.networkImagesBySize={sm:yWe,md:gre,lg:gWe},this.selected=!1,this.round=!1}render(){const e={sm:"4",md:"6",lg:"10"};return this.round?(this.dataset.round="true",this.style.cssText=` 6742 --local-width: var(--apkt-spacing-10); 6743 --local-height: var(--apkt-spacing-10); 6744 --local-icon-size: var(--apkt-spacing-4); 6745 `):this.style.cssText=` 6746 6747 --local-path: var(--apkt-path-network-${this.size}); 6748 --local-width: var(--apkt-width-network-${this.size}); 6749 --local-height: var(--apkt-height-network-${this.size}); 6750 --local-icon-size: var(--apkt-spacing-${e[this.size]}); 6751 `,se`${this.templateVisual()} ${this.svgTemplate()} `}svgTemplate(){return this.round?null:this.networkImagesBySize[this.size]}templateVisual(){return this.imageSrc?se`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:se`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`}};Pf.styles=[vn,bWe];M1([le()],Pf.prototype,"size",void 0);M1([le()],Pf.prototype,"name",void 0);M1([le({type:Object})],Pf.prototype,"networkImagesBySize",void 0);M1([le()],Pf.prototype,"imageSrc",void 0);M1([le({type:Boolean})],Pf.prototype,"selected",void 0);M1([le({type:Boolean})],Pf.prototype,"round",void 0);Pf=M1([Qe("wui-network-image")],Pf);const wWe=os` 6752 @keyframes shake { 6753 0% { 6754 transform: translateX(0); 6755 } 6756 25% { 6757 transform: translateX(3px); 6758 } 6759 50% { 6760 transform: translateX(-3px); 6761 } 6762 75% { 6763 transform: translateX(3px); 6764 } 6765 100% { 6766 transform: translateX(0); 6767 } 6768 } 6769 6770 wui-flex:first-child:not(:only-child) { 6771 position: relative; 6772 } 6773 6774 wui-loading-hexagon { 6775 position: absolute; 6776 } 6777 6778 wui-icon-box { 6779 position: absolute; 6780 right: 4px; 6781 bottom: 0; 6782 opacity: 0; 6783 transform: scale(0.5); 6784 z-index: 1; 6785 } 6786 6787 wui-button { 6788 display: none; 6789 } 6790 6791 [data-error='true'] wui-icon-box { 6792 opacity: 1; 6793 transform: scale(1); 6794 } 6795 6796 [data-error='true'] > wui-flex:first-child { 6797 animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; 6798 } 6799 6800 wui-button[data-retry='true'] { 6801 display: block; 6802 opacity: 1; 6803 } 6804`;var zM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let mb=class extends tt{constructor(){var e;super(),this.network=(e=Pe.state.data)==null?void 0:e.network,this.unsubscribe=[],this.showRetry=!1,this.error=!1}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){this.onSwitchNetwork()}render(){if(!this.network)throw new Error("w3m-network-switch-view: No network provided");this.onShowRetry();const e=this.getLabel(),n=this.getSubLabel();return se` 6805 <wui-flex 6806 data-error=${this.error} 6807 flexDirection="column" 6808 alignItems="center" 6809 .padding=${["10","5","10","5"]} 6810 gap="7" 6811 > 6812 <wui-flex justifyContent="center" alignItems="center"> 6813 <wui-network-image 6814 size="lg" 6815 imageSrc=${xt(qi.getNetworkImage(this.network))} 6816 ></wui-network-image> 6817 6818 ${this.error?null:se`<wui-loading-hexagon></wui-loading-hexagon>`} 6819 6820 <wui-icon-box color="error" icon="close" size="sm"></wui-icon-box> 6821 </wui-flex> 6822 6823 <wui-flex flexDirection="column" alignItems="center" gap="2"> 6824 <wui-text align="center" variant="h6-regular" color="primary">${e}</wui-text> 6825 <wui-text align="center" variant="md-regular" color="secondary">${n}</wui-text> 6826 </wui-flex> 6827 6828 <wui-button 6829 data-retry=${this.showRetry} 6830 variant="accent-primary" 6831 size="md" 6832 .disabled=${!this.error} 6833 @click=${this.onSwitchNetwork.bind(this)} 6834 > 6835 <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon> 6836 Try again 6837 </wui-button>
6837 6838 </wui-flex> 6839 `}getSubLabel(){const e=Oe.getConnectorId(ne.state.activeChain);return Oe.getAuthConnector()&&e===we.CONNECTOR_ID.AUTH?"":this.error?"Switch can be declined if chain is not supported by a wallet or previous request is still active":"Accept connection request in your wallet"}getLabel(){var i;const e=Oe.getConnectorId(ne.state.activeChain);return Oe.getAuthConnector()&&e===we.CONNECTOR_ID.AUTH?`Switching to ${((i=this.network)==null?void 0:i.name)??"Unknown"} network...`:this.error?"Switch declined":"Approve in wallet"}onShowRetry(){var e;if(this.error&&!this.showRetry){this.showRetry=!0;const n=(e=this.shadowRoot)==null?void 0:e.querySelector("wui-button");n==null||n.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}async onSwitchNetwork(){var e;try{this.error=!1,ne.state.activeChain!==((e=this.network)==null?void 0:e.chainNamespace)&&ne.setIsSwitchingNamespace(!0),this.network&&(await ne.switchActiveNetwork(this.network),await jo.isAuthenticated()&&Pe.goBack())}catch{this.error=!0}}};mb.styles=wWe;zM([Me()],mb.prototype,"showRetry",void 0);zM([Me()],mb.prototype,"error",void 0);mb=zM([Qe("w3m-network-switch-view")],mb);const vWe=It` 6840 :host { 6841 width: 100%; 6842 } 6843 6844 button { 6845 display: flex; 6846 align-items: center; 6847 justify-content: space-between; 6848 padding: ${({spacing:t})=>t[3]}; 6849 width: 100%; 6850 background-color: transparent; 6851 border-radius: ${({borderRadius:t})=>t[4]}; 6852 } 6853 6854 wui-text { 6855 text-transform: capitalize; 6856 } 6857 6858 @media (hover: hover) { 6859 button:hover:enabled { 6860 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 6861 } 6862 } 6863 6864 button:disabled { 6865 opacity: 0.5; 6866 cursor: not-allowed; 6867 } 6868`;var c4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let n1=class extends tt{constructor(){super(...arguments),this.imageSrc=void 0,this.name="Ethereum",this.disabled=!1}render(){return se` 6869 <button ?disabled=${this.disabled} tabindex=${xt(this.tabIdx)}> 6870 <wui-flex gap="2" alignItems="center"> 6871 ${this.imageTemplate()} 6872 <wui-text variant="lg-regular" color="primary">${this.name}</wui-text> 6873 </wui-flex> 6874 <wui-icon name="chevronRight" size="lg" color="default"></wui-icon> 6875 </button> 6876 `}imageTemplate(){return this.imageSrc?se`<wui-image ?boxed=${!0} src=${this.imageSrc}></wui-image>`:se`<wui-image 6877 ?boxed=${!0} 6878 icon="networkPlaceholder" 6879 size="lg" 6880 iconColor="default" 6881 ></wui-image>`}};n1.styles=[vn,Gi,vWe];c4([le()],n1.prototype,"imageSrc",void 0);c4([le()],n1.prototype,"name",void 0);c4([le()],n1.prototype,"tabIdx",void 0);c4([le({type:Boolean})],n1.prototype,"disabled",void 0);n1=c4([Qe("wui-list-network")],n1);const CWe=os` 6882 .container { 6883 max-height: 360px; 6884 overflow: auto; 6885 } 6886 6887 .container::-webkit-scrollbar {
6888 display: none; 6889 } 6890`;var l4=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let Op=class extends tt{constructor(){super(),this.unsubscribe=[],this.network=ne.state.activeCaipNetwork,this.requestedCaipNetworks=ne.getCaipNetworks(),this.search="",this.onDebouncedSearch=Ue.debounce(e=>{this.search=e},100),this.unsubscribe.push(vr.subscribeNetworkImages(()=>this.requestUpdate()),ne.subscribeKey("activeCaipNetwork",e=>this.network=e),ne.subscribe(()=>{this.requestedCaipNetworks=ne.getAllRequestedCaipNetworks()}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se` 6891 ${this.templateSearchInput()} 6892 <wui-flex 6893 class="container" 6894 .padding=${["0","3","3","3"]} 6895 flexDirection="column" 6896 gap="2" 6897 > 6898 ${this.networksTemplate()} 6899 </wui-flex> 6900 `}templateSearchInput(){return se` 6901 <wui-flex gap="2" .padding=${["0","3","3","3"]}> 6902 <wui-input-text 6903 @inputChange=${this.onInputChange.bind(this)} 6904 class="network-search-input" 6905 size="md" 6906 placeholder="Search network" 6907 icon="search" 6908 ></wui-input-text> 6909 </wui-flex> 6910 `}onInputChange(e){this.onDebouncedSearch(e.detail)}networksTemplate(){var i;const e=ne.getAllApprovedCaipNetworkIds(),n=Ue.sortRequestedNetworks(e,this.requestedCaipNetworks);return this.search?this.filteredNetworks=n==null?void 0:n.filter(s=>{var r;return(r=s==null?void 0:s.name)==null?void 0:r.toLowerCase().includes(this.search.toLowerCase())}):this.filteredNetworks=n,(i=this.filteredNetworks)==null?void 0:i.map(s=>{var r;return se` 6911 <wui-list-network 6912 .selected=${((r=this.network)==null?void 0:r.id)===s.id} 6913 imageSrc=${xt(qi.getNetworkImage(s))} 6914 type="network" 6915 name=${s.name??s.id} 6916 @click=${()=>this.onSwitchNetwork(s)} 6917 .disabled=${ne.isCaipNetworkDisabled(s)} 6918 data-testid=${`w3m-network-switch-${s.name??s.id}`} 6919 ></wui-list-network> 6920 `})}onSwitchNetwork(e){Kte.onSwitchNetwork({network:e})}};Op.styles=CWe;l4([Me()],Op.prototype,"network",void 0);l4([Me()],Op.prototype,"requestedCaipNetworks",void 0);l4([Me()],Op.prototype,"filteredNetworks",void 0);l4([Me()],Op.prototype,"search",void 0);Op=l4([Qe("w3m-networks-view")],Op);const xWe=It` 6921 @keyframes shake { 6922 0% { 6923 transform: translateX(0); 6924 } 6925 25% { 6926 transform: translateX(3px); 6927 } 6928 50% { 6929 transform: translateX(-3px); 6930 } 6931 75% { 6932 transform: translateX(3px); 6933 } 6934 100% { 6935 transform: translateX(0); 6936 } 6937 } 6938 6939 wui-flex:first-child:not(:only-child) { 6940 position: relative; 6941 } 6942 6943 wui-loading-thumbnail { 6944 position: absolute; 6945 } 6946 6947 wui-visual { 6948 border-radius: calc( 6949 ${({borderRadius:t})=>t[1]} * 9 - ${({borderRadius:t})=>t[3]} 6950 ); 6951 position: relative; 6952 overflow: hidden; 6953 } 6954 6955 wui-visual::after { 6956 content: ''; 6957 display: block; 6958 width: 100%; 6959 height: 100%; 6960 position: absolute; 6961 inset: 0; 6962 border-radius: calc( 6963 ${({borderRadius:t})=>t[1]} * 9 - ${({borderRadius:t})=>t[3]} 6964 ); 6965 box-shadow: inset 0 0 0 1px ${({tokens:t})=>t.core.glass010}; 6966 } 6967 6968 wui-icon-box { 6969 position: absolute; 6970 right: calc(${({spacing:t})=>t[1]} * -1); 6971 bottom: calc(${({spacing:t})=>t[1]} * -1); 6972 opacity: 0; 6973 transform: scale(0.5); 6974 transition: 6975 opacity ${({durations:t})=>t.lg} ${({easings:t})=>t["ease-out-power-2"]}, 6976 transform ${({durations:t})=>t.lg} 6977 ${({easings:t})=>t["ease-out-power-2"]}; 6978 will-change: opacity, transform; 6979 } 6980 6981 wui-text[align='center'] { 6982 width: 100%; 6983 padding: 0px ${({spacing:t})=>t[4]}; 6984 } 6985 6986 [data-error='true'] wui-icon-box { 6987 opacity: 1; 6988 transform: scale(1); 6989 } 6990 6991 [data-error='true'] > wui-flex:first-child { 6992 animation: shake 250ms ${({easings:t})=>t["ease-out-power-2"]} both; 6993 } 6994 6995 [data-retry='false'] wui-link { 6996 display: none; 6997 } 6998 6999 [data-retry='true'] wui-link { 7000 display: block; 7001 opacity: 1; 7002 } 7003 7004 wui-link { 7005 padding: ${({spacing:t})=>t["01"]} ${({spacing:t})=>t[2]}; 7006 } 7007 7008 .capitalize { 7009 text-transform: capitalize; 7010 } 7011`;var Ore=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
7011a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const EWe={eip155:"eth",solana:"solana",bip122:"bitcoin",polkadot:void 0};let j5=class extends tt{constructor(){var e,n;super(...arguments),this.unsubscribe=[],this.switchToChain=(e=Pe.state.data)==null?void 0:e.switchToChain,this.caipNetwork=(n=Pe.state.data)==null?void 0:n.network,this.activeChain=ne.state.activeChain}firstUpdated(){this.unsubscribe.push(ne.subscribeKey("activeChain",e=>this.activeChain=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){const e=this.switchToChain?we.CHAIN_NAME_MAP[this.switchToChain]:"supported";if(!this.switchToChain)return null;const n=we.CHAIN_NAME_MAP[this.switchToChain];return se` 7012 <wui-flex 7013 flexDirection="column" 7014 alignItems="center" 7015 .padding=${["4","2","2","2"]} 7016 gap="4" 7017 > 7018 <wui-flex justifyContent="center" flexDirection="column" alignItems="center" gap="2"> 7019 <wui-visual 7020 size="md" 7021 name=${xt(EWe[this.switchToChain])} 7022 ></wui-visual> 7023 <wui-flex gap="2" flexDirection="column" alignItems="center"> 7024 <wui-text 7025 data-testid=${`w3m-switch-active-chain-to-${n}`} 7026 variant="lg-regular" 7027 color="primary" 7028 align="center" 7029 >Switch to <span class="capitalize">${n}</span></wui-text 7030 > 7031 <wui-text variant="md-regular" color="secondary" align="center"> 7032 Connected wallet doesn't support connecting to ${e} chain. You 7033 need to connect with a different wallet. 7034 </wui-text> 7035 </wui-flex> 7036 <wui-button 7037 data-testid="w3m-switch-active-chain-button" 7038 size="md" 7039 @click=${this.switchActiveChain.bind(this)} 7040 >Switch</wui-button 7041 > 7042 </wui-flex> 7043 </wui-flex> 7044 `}async switchActiveChain(){this.switchToChain&&(ne.setIsSwitchingNamespace(!0),Oe.setFilterByNamespace(this.switchToChain),this.caipNetwork?await ne.switchActiveNetwork(this.caipNetwork):ne.setActiveNamespace(this.switchToChain),Pe.reset("Connect"))}};j5.styles=xWe;Ore([le()],j5.prototype,"activeChain",void 0);j5=Ore([Qe("w3m-switch-active-chain-view")],j5);var _We=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};const SWe=[{images:["network","layers","system"],title:"The systemâs nuts and bolts",text:"A network is what brings the blockchain to life, as this technical infrastructure allows apps to access the ledger and smart contract services."},{images:["noun","defiAlt","dao"],title:"Designed for different uses",text:"Each network is designed differently, and may therefore suit certain apps and experiences."}];let kI=class extends tt{render(){return se` 7045 <wui-flex 7046 flexDirection="column" 7047 .padding=${["6","5","5","5"]} 7048 alignItems="center" 7049 gap="5" 7050 > 7051 <w3m-help-widget .data=${SWe}></w3m-help-widget> 7052 <wui-button 7053 variant="accent-primary" 7054 size="md" 7055 @click=${()=>{Ue.openHref("https://ethereum.org/en/developers/docs/networks/","_blank")}} 7056 > 7057 Learn more 7058 <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon> 7059 </wui-button> 7060 </wui-flex> 7061 `}};kI=_We([Qe("w3m-what-is-a-network-view")],kI);const AWe=os` 7062 :host > wui-flex { 7063 max-height: clamp(360px, 540px, 80vh); 7064 overflow: scroll; 7065 scrollbar-width: none; 7066 } 7067 7068 :host > wui-flex::-webkit-scrollbar {
7069 display: none; 7070 } 7071`;var HM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let gb=class extends tt{constructor(){var e;super(),this.swapUnsupportedChain=(e=Pe.state.data)==null?void 0:e.swapUnsupportedChain,this.unsubscribe=[],this.disconnecting=!1,this.remoteFeatures=ye.state.remoteFeatures,this.unsubscribe.push(vr.subscribeNetworkImages(()=>this.requestUpdate()),ye.subscribeKey("remoteFeatures",n=>{this.remoteFeatures=n}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se` 7072 <wui-flex class="container" flexDirection="column" gap="0"> 7073 <wui-flex 7074 class="container" 7075 flexDirection="column" 7076 .padding=${["3","5","2","5"]} 7077 alignItems="center" 7078 gap="5" 7079 > 7080 ${this.descriptionTemplate()} 7081 </wui-flex> 7082 7083 <wui-flex flexDirection="column" padding="3" gap="2"> ${this.networksTemplate()} </wui-flex> 7084 7085 <wui-separator text="or"></wui-separator> 7086 <wui-flex flexDirection="column" padding="3" gap="2"> 7087 <wui-list-item 7088 variant="icon" 7089 iconVariant="overlay" 7090 icon="signOut" 7091 ?chevron=${!1} 7092 .loading=${this.disconnecting} 7093 @click=${this.onDisconnect.bind(this)} 7094 data-testid="disconnect-button" 7095 > 7096 <wui-text variant="md-medium" color="secondary">Disconnect</wui-text> 7097 </wui-list-item> 7098 </wui-flex> 7099 </wui-flex> 7100 `}descriptionTemplate(){return this.swapUnsupportedChain?se` 7101 <wui-text variant="sm-regular" color="secondary" align="center"> 7102 The swap feature doesnât support your current network. Switch to an available option to 7103 continue. 7104 </wui-text> 7105 `:se` 7106 <wui-text variant="sm-regular" color="secondary" align="center"> 7107 This app doesnât support your current network. Switch to an available option to continue. 7108 </wui-text> 7109 `}networksTemplate(){const e=ne.getAllRequestedCaipNetworks(),n=ne.getAllApprovedCaipNetworkIds(),i=Ue.sortRequestedNetworks(n,e);return(this.swapUnsupportedChain?i.filter(r=>fn.SWAP_SUPPORTED_NETWORKS.includes(r.caipNetworkId)):i).map(r=>se` 7110 <wui-list-network 7111 imageSrc=${xt(qi.getNetworkImage(r))} 7112 name=${r.name??"Unknown"} 7113 @click=${()=>this.onSwitchNetwork(r)} 7114 > 7115 </wui-list-network> 7116 `)}async onDisconnect(){var e;try{this.disconnecting=!0;const n=ne.state.activeChain,s=Ve.getConnections(n).length>0,r=n&&Oe.state.activeConnectorIds[n],o=(e=this.remoteFeatures)==null?void 0:e.multiWallet;await Ve.disconnect(o?{id:r,namespace:n}:{}),s&&o&&(Pe.push("ProfileWallets"),ti.showSuccess("Wallet deleted"))}catch{Et.sendEvent({type:"track",event:"DISCONNECT_ERROR",properties:{message:"Failed to disconnect"}}),ti.showError("Failed to disconnect")}finally{this.disconnecting=!1}}async onSwitchNetwork(e){const n=ne.getActiveCaipAddress(),i=ne.getAllApprovedCaipNetworkIds(),s=ne.getNetworkProp("supportsAllNetworks",e.chainNamespace),r=Pe.state.data;n?i!=null&&i.includes(e.caipNetworkId)?await ne.switchActiveNetwork(e):s?Pe.push("SwitchNetwork",{...r,network:e}):Pe.push("SwitchNetwork",{...r,network:e}):n||(ne.setActiveCaipNetwork(e),Pe.push("Connect"))}};gb.styles=AWe;HM([Me()],gb.prototype,"disconnecting",void 0);HM([Me()],gb.prototype,"remoteFeatures",void 0);gb=HM([Qe("w3m-unsupported-chain-view")],gb);const TWe=It` 7117 wui-flex { 7118 width: 100%; 7119 display: flex; 7120 align-items: center; 7121 justify-content: center; 7122 gap: ${({spacing:t})=>t[2]}; 7123 border-radius: ${({borderRadius:t})=>t[4]}; 7124 padding: ${({spacing:t})=>t[3]}; 7125 } 7126 7127 /* -- Types --------------------------------------------------------- */ 7128 wui-flex[data-type='info'] { 7129 color: ${({tokens:t})=>t.theme.textSecondary}; 7130 background-color: ${({tokens:t})=>t.theme.foregroundPrimary}; 7131 } 7132 7133 wui-flex[data-type='success'] { 7134 color: ${({tokens:t})=>t.core.textSuccess}; 7135 background-color: ${({tokens:t})=>t.core.backgroundSuccess}; 7136 } 7137 7138 wui-flex[data-type='error'] { 7139 color: ${({tokens:t})=>t.core.textError}; 7140 background-color: ${({tokens:t})=>t.core.backgroundError}; 7141 } 7142 7143 wui-flex[data-type='warning'] { 7144 color: ${({tokens:t})=>t.core.textWarning}; 7145 background-color: ${({tokens:t})=>t.core.backgroundWarning}; 7146 } 7147 7148 wui-flex[data-type='info'] wui-icon-box { 7149 background-color: ${({tokens:t})=>t.theme.foregroundSecondary}; 7150 } 7151 7152 wui-flex[data-type='success'] wui-icon-box { 7153 background-color: ${({tokens:t})=>t.core.backgroundSuccess}; 7154 } 7155 7156 wui-flex[data-type='error'] wui-icon-box { 7157 background-color: ${({tokens:t})=>t.core.backgroundError}; 7158 } 7159 7160 wui-flex[data-type='warning'] wui-icon-box { 7161 background-color: ${({tokens:t})=>t.core.backgroundWarning}; 7162 } 7163 7164 wui-text { 7165 flex: 1; 7166 } 7167`;var OS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
7167a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let yb=class extends tt{constructor(){super(...arguments),this.icon="externalLink",this.text="",this.type="info"}render(){return se` 7168 <wui-flex alignItems="center" data-type=${this.type}> 7169 <wui-icon-box size="sm" color="inherit" icon=${this.icon}></wui-icon-box> 7170 <wui-text variant="md-regular" color="inherit">${this.text}</wui-text> 7171 </wui-flex> 7172 `}};yb.styles=[vn,Gi,TWe];OS([le()],yb.prototype,"icon",void 0);OS([le()],yb.prototype,"text",void 0);OS([le()],yb.prototype,"type",void 0);yb=OS([Qe("wui-banner")],yb);const kWe=os` 7173 :host > wui-flex { 7174 max-height: clamp(360px, 540px, 80vh); 7175 overflow: scroll; 7176 scrollbar-width: none; 7177 } 7178 7179 :host > wui-flex::-webkit-scrollbar { 7180 display: none; 7181 } 7182`;var NWe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let J_=class extends tt{constructor(){super(),this.unsubscribe=[]}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return se` <wui-flex flexDirection="column" .padding=${["2","3","3","3"]} gap="2"> 7183 <wui-banner 7184 icon="warningCircle" 7185 text="You can only receive assets on these networks" 7186 ></wui-banner> 7187 ${this.networkTemplate()} 7188 </wui-flex>`}networkTemplate(){const e=ne.getAllRequestedCaipNetworks(),n=ne.getAllApprovedCaipNetworkIds(),i=ne.state.activeCaipNetwork,s=ne.checkIfSmartAccountEnabled();let r=Ue.sortRequestedNetworks(n,e);if(s&&$s(i==null?void 0:i.chainNamespace)===Wi.ACCOUNT_TYPES.SMART_ACCOUNT){if(!i)return null;r=[i]}return r.filter(a=>a.chainNamespace===(i==null?void 0:i.chainNamespace)).map(a=>se` 7189 <wui-list-network 7190 imageSrc=${xt(qi.getNetworkImage(a))} 7191 name=${a.name??"Unknown"} 7192 ?transparent=${!0} 7193 > 7194 </wui-list-network> 7195 `)}};J_.styles=kWe;J_=NWe([Qe("w3m-wallet-compatible-networks-view")],J_);const RWe=It` 7196 :host { 7197 display: flex; 7198 justify-content: center; 7199 align-items: center; 7200 width: 56px; 7201 height: 56px; 7202 box-shadow: 0 0 0 8px ${({tokens:t})=>t.theme.borderPrimary}; 7203 border-radius: ${({borderRadius:t})=>t[4]}; 7204 overflow: hidden; 7205 } 7206 7207 :host([data-border-radius-full='true']) { 7208 border-radius: 50px; 7209 } 7210 7211 wui-icon { 7212 width: 32px; 7213 height: 32px; 7214 } 7215`;var MS=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let bb=class extends tt{render(){return this.dataset.borderRadiusFull=this.borderRadiusFull?"true":"false",se`${this.templateVisual()}`}templateVisual(){return this.imageSrc?se`<wui-image src=${this.imageSrc} alt=${this.alt??""}></wui-image>`:se`<wui-icon 7216 data-parent-size="md" 7217 size="inherit" 7218 color="inherit" 7219 name="wallet" 7220 ></wui-icon>`}};bb.styles=[vn,RWe];MS([le()],bb.prototype,"imageSrc",void 0);MS([le()],bb.prototype,"alt",void 0);MS([le({type:Boolean})],bb.prototype,"borderRadiusFull",void 0);bb=MS([Qe("wui-visual-thumbnail")],bb);const PWe=It` 7221 :host { 7222 display: flex; 7223 justify-content: center; 7224 gap: ${({spacing:t})=>t[4]}; 7225 } 7226 7227 wui-visual-thumbnail:nth-child(1) { 7228 z-index: 1; 7229 } 7230`;var IWe=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let NI=class extends tt{constructor(){var e,n,i;super(...arguments),this.dappImageUrl=(e=ye.state.metadata)==null?void 0:e.icons,this.walletImageUrl=(i=(n=ne.getAccountData())==null?void 0:n.connectedWalletInfo)==null?void 0:i.icon}firstUpdated(){var n;const e=(n=this.shadowRoot)==null?void 0:n.querySelectorAll("wui-visual-thumbnail");e!=null&&e[0]&&this.createAnimation(e[0],"translate(18px)"),e!=null&&e[1]&&this.createAnimation(e[1],"translate(-18px)")}render(){var e;return se` 7231 <wui-visual-thumbnail 7232 ?borderRadiusFull=${!0} 7233 .imageSrc=${(e=this.dappImageUrl)==null?void 0:e[0]} 7234 ></wui-visual-thumbnail> 7235 <wui-visual-thumbnail .imageSrc=${this.walletImageUrl}></wui-visual-thumbnail> 7236 `}createAnimation(e,n){e.animate([{transform:"translateX(0px)"},{transform:n}],{duration:1600,easing:"cubic-bezier(0.56, 0, 0.48, 1)",direction:"alternate",iterations:1/0})}};NI.styles=PWe;NI=IWe([Qe("w3m-siwx-sign-message-thumbnails")],NI);var GM=function(t,e,n,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;
7236a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r};let V5=class extends tt{constructor(){var e;super(...arguments),this.dappName=(e=ye.state.metadata)==null?void 0:e.name,this.isCancelling=!1,this.isSigning=!1}render(){return se` 7237 <wui-flex justifyContent="center" .padding=${["8","0","6","0"]}> 7238 <w3m-siwx-sign-message-thumbnails></w3m-siwx-sign-message-thumbnails> 7239 </wui-flex> 7240 <wui-flex .padding=${["0","20","5","20"]} gap="3" justifyContent="space-between"> 7241 <wui-text variant="lg-medium" align="center" color="primary" 7242 >${this.dappName??"Dapp"} needs to connect to your wallet</wui-text 7243 > 7244 </wui-flex> 7245 <wui-flex .padding=${["0","10","4","10"]} gap="3" justifyContent="space-between"> 7246 <wui-text variant="md-regular" align="center" color="secondary" 7247 >Sign this message to prove you own this wallet and proceed. Canceling will disconnect 7248 you.</wui-text 7249 > 7250 </wui-flex> 7251 <wui-flex .padding=${["4","5","5","5"]} gap="3" justifyContent="space-between"> 7252 <wui-button 7253 size="lg" 7254 borderRadius="xs" 7255 fullWidth 7256 variant="neutral-secondary" 7257 ?loading=${this.isCancelling} 7258 @click=${this.onCancel.bind(this)} 7259 data-testid="w3m-connecting-siwe-cancel" 7260 > 7261 ${this.isCancelling?"Cancelling...":"Cancel"} 7262 </wui-button> 7263 <wui-button 7264 size="lg" 7265 borderRadius="xs" 7266 fullWidth 7267 variant="neutral-primary" 7268 @click=${this.onSign.bind(this)} 7269 ?loading=${this.isSigning} 7270 data-testid="w3m-connecting-siwe-sign" 7271 > 7272 ${this.isSigning?"Signing...":"Sign"} 7273 </wui-button> 7274 </wui-flex> 7275 `}async onSign(){this.isSigning=!0;try{await jo.requestSignMessage()}catch(e){if(e instanceof Error&&e.message.includes("OTP is required")){ti.showError({message:"Something went wrong. We need to verify your account again."}),Pe.replace("DataCapture");return}throw e}finally{this.isSigning=!1}}async onCancel(){this.isCancelling=!0,await jo.cancelSignMessage().finally(()=>this.isCancelling=!1)}};GM([Me()],V5.prototype,"isCancelling",void 0);GM([Me()],V5.prototype,"isSigning",void 0);V5=GM([Qe("w3m-siwx-sign-message-view")],V5);const DWe=Object.freeze(Object.defineProperty({__proto__:null,get AppKitAccountButton(){return M_},get AppKitButton(){return L_},get AppKitConnectButton(){return $_},get AppKitNetworkButton(){return U_},get W3mAccountButton(){return uI},get W3mAccountSettingsView(){return Af},get W3mAccountView(){return F_},get W3mAllWalletsView(){return M5},get W3mButton(){return dI},get W3mChooseAccountNameView(){return U5},get W3mConnectButton(){return hI},get W3mConnectView(){return ga},get W3mConnectWalletsView(){return F5},get W3mConnectingExternalView(){return CI},get W3mConnectingMultiChainView(){return L5},get W3mConnectingWcBasicView(){return $5},get W3mConnectingWcView(){return jd},get W3mDownloadsView(){return EI},get W3mFooter(){return ab},get W3mFundWalletView(){return Pp},get W3mGetWalletView(){return _I},get W3mNetworkButton(){return fI},get W3mNetworkSwitchView(){return mb},get W3mNetworksView(){return Op},get W3mProfileWalletsView(){return Ko},get W3mRouter(){return cb},get W3mSIWXSignMessageView(){return V5},get W3mSwitchActiveChainView(){return j5},get W3mUnsupportedChainView(){return gb},get W3mWalletCompatibleNetworksView(){return J_},get W3mWhatIsANetworkView(){return kI},get W3mWhatIsAWalletView(){return AI}},Symbol.toStringTag,{value:"Module"}));TS({tagName:"appkit-button",elementClass:L_,react:kn});TS({tagName:"appkit-network-button",elementClass:U_,react:kn});TS({tagName:"appkit-connect-button",elementClass:$_,react:kn});TS({tagName:"appkit-account-button",elementClass:M_,react:kn});let Ym;function OWe(t){return Ym||(Ym=new IBe({...t,sdkVersion:Ue.generateSdkVersion(t.adapters??[],"react",MBe)}),DBe(Ym)),Ym}function MWe(){const{caipNetwork:t,caipNetworkId:e,chainId:n}=qUe();async function i(s){await(Ym==null?void 0:Ym.switchNetwork(s))}return{caipNetwork:t,caipNetworkId:e,chainId:n,switchNetwork:i}}function LWe(t){let e=[],n,i;function s(a){var d,h;const c=ne.getCaipNetworks(we.CHAIN.EVM);let l=Number(l5.parseEvmChainId(a));if(!c.some(p=>String(p.id)===String(a))){const p=((d=ne.getActiveCaipNetwork(we.CHAIN.EVM))==null?void 0:d.id)||((h=c[0])==null?void 0:h.id);p&&Number.isInteger(Number(p))&&(l=Number(p))}if(!l)throw new Error("ChainId not found in networks");return l}function r(){var a;return n||(n=pg.getInstance({projectId:t.options.projectId,chainId:(a=Yh())==null?void 0:a.caipNetworkId,enableLogger:t.options.enableAuthLogger,onTimeout:c=>{c==="iframe_load_failed"?Ss.open(ys.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):c==="iframe_request_timeout"?Ss.open(ys.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):c==="unverified_domain"&&Ss.open(ys.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},abortController:ys.EmbeddedWalletAbortController,getActiveCaipNetwork:c=>Yh(c),getCaipNetworks:c=>ne.getCaipNetworks(c)})),n}async function o(a={}){var w;const c=r();let l=a.chainId;
7275if(a.isReconnecting){const C=l5.parseEvmChainId(c.getLastUsedChainId()||""),E=(w=t.chains)==null?void 0:w[0].id;if(l=C||E,!l)throw new Error("ChainId not found in provider")}const d=$s("eip155"),{address:h,chainId:p,accounts:g}=await jo.authConnectorAuthenticate({authConnector:c,chainId:l,preferredAccountType:d,socialUri:a.socialUri,chainNamespace:we.CHAIN.EVM});e=(g==null?void 0:g.map(C=>C.address))||[h];const b=s(p);return{accounts:e,account:h,chainId:b,chain:{id:b,unsupported:!1}}}return a=>({id:we.CONNECTOR_ID.AUTH,name:we.CONNECTOR_NAMES.AUTH,type:"AUTH",chain:we.CHAIN.EVM,async connect(c={}){if(i){const d=await i;return{accounts:c.withCapabilities?d.accounts.map(h=>({address:h,capabilities:{}})):d.accounts,chainId:d.chainId}}i||(i=new Promise(d=>{d(o(c))}));const l=await i;return i=void 0,{accounts:c.withCapabilities?l.accounts.map(d=>({address:d,capabilities:{}})):l.accounts,chainId:l.chainId}},async disconnect(){await(await this.getProvider()).disconnect()},getAccounts(){return e!=null&&e.length?(a.emitter.emit("change",{accounts:e}),Promise.resolve(e)):Promise.resolve([])},async getProvider(){var c;return this.provider||(this.provider=pg.getInstance({projectId:t.options.projectId,chainId:(c=Yh())==null?void 0:c.caipNetworkId,enableLogger:t.options.enableAuthLogger,abortController:ys.EmbeddedWalletAbortController,onTimeout:l=>{l==="iframe_load_failed"?Ss.open(ys.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):l==="iframe_request_timeout"?Ss.open(ys.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):l==="unverified_domain"&&Ss.open(ys.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:l=>Yh(l),getCaipNetworks:l=>ne.getCaipNetworks(l)})),Promise.resolve(this.provider)},async getChainId(){const c=await this.getProvider(),{chainId:l}=await c.getChainId();return s(l)},async isAuthorized(){const l=ne.state.activeChain===we.CHAIN.EVM;if(we.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(p=>Oe.getConnectorId(p)===we.CONNECTOR_ID.AUTH)&&!l)return!1;const h=await this.getProvider();return Promise.resolve(h.getLoginEmailUsed())},async switchChain({chainId:c}){var l;try{const d=a.chains.find(b=>b.id===c);if(!d)throw new Id(new Error("chain not found on connector."));const h=await this.getProvider(),p=$s("eip155"),g=await h.connect({chainId:c,preferredAccountType:p});return e=((l=g==null?void 0:g.accounts)==null?void 0:l.map(b=>b.address))||[g.address],a.emitter.emit("change",{chainId:Number(c),accounts:e}),d}catch(d){throw d instanceof Error?new Id(d):d}},onAccountsChanged(c){c.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:c.map(bd)})},onChainChanged(c){const l=Number(c);a.emitter.emit("change",{chainId:l})},async onDisconnect(c){await(await this.getProvider()).disconnect()}})}KM.type="walletConnect";function KM(t){const e=t.isNewChainsStale??!0;let n,i,s,r,o,a,c;return l=>({id:"walletConnect",name:"WalletConnect",type:KM.type,provider:t.universalProvider,async setup(){const d=await this.getProvider().catch(()=>null);d&&(r||(r=this.onConnect.bind(this),d.on("connect",r)),a||(a=this.onSessionDelete.bind(this),d.on("session_delete",a)))},async connect({...d}={}){var h,p,g;try{const b=ne.getCaipNetworks(),w=await this.getProvider();if(!w)throw new U0;o||(o=this.onDisplayUri,w.on("display_uri",o));const C=await this.isChainsStale();w.session&&C&&await w.disconnect();const E=ye.state.universalProviderConfigOverride;if(!w.session||C){const F=lf.createNamespaces(b,E);await w.connect({optionalNamespaces:F,..."pairingTopic"in d?{pairingTopic:d.pairingTopic}:{}}),this.setRequestedChainsIds(b.map(z=>Number(z.id)))}const T=await this.getAccounts(),A=await this.getChainId(),k=(g=(p=(h=w.session)==null?void 0:h.namespaces)==null?void 0:p.eip155)==null?void 0:g.chains,R=k==null?void 0:k.some(F=>Number(F.split(":")[1])===A);let P=1;R?P=A:k!=null&&k[0]&&(P=Number(k[0].split(":")[1])),o&&(w.removeListener("display_uri",o),o=void 0),r&&(w.removeListener("connect",r),r=void 0),i||(i=this.onAccountsChanged.bind(this),w.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),w.on("chainChanged",s)),c||(c=this.onDisconnect.bind(this),w.on("disconnect",c)),a||(a=this.onSessionDelete.bind(this),w.on("session_delete",a));const B=E==null?void 0:E.defaultChain;return w.setDefaultChain(B??`eip155:${P}`),{accounts:T,chainId:P}}catch(b){throw/(user rejected|connection request reset)/i.test(b==null?void 0:b.message)?new Dr(b):b}},async disconnect(){const d=await this.getProvider();try{await(d==null?void 0:d.disconnect())}catch(h){if(!/No matching key/i.test(h.message))throw h}
7275finally{s&&(d==null||d.removeListener("chainChanged",s),s=void 0),c&&(d==null||d.removeListener("disconnect",c),c=void 0),r||(r=this.onConnect.bind(this),d==null||d.on("connect",r)),i&&(d==null||d.removeListener("accountsChanged",i),i=void 0),a&&(d==null||d.removeListener("session_delete",a),a=void 0),this.setRequestedChainsIds([])}},async getAccounts(){var w,C,E;const d=await this.getProvider();if(!((w=d==null?void 0:d.session)!=null&&w.namespaces))return[];const h=(E=(C=d==null?void 0:d.session)==null?void 0:C.namespaces[we.CHAIN.EVM])==null?void 0:E.accounts,p=(h==null?void 0:h.map(T=>T.split(":")[2]))??[],g=new Set;return p.filter(T=>{const A=T==null?void 0:T.toLowerCase();return g.has(A)?!1:(g.add(A),!0)})},async getProvider({chainId:d}={}){var g,b;n||(n=t.universalProvider,n==null||n.events.setMaxListeners(Number.POSITIVE_INFINITY));const h=He.getActiveNamespace(),p=(g=ne.getActiveCaipNetwork())==null?void 0:g.id;if(d&&p!==d&&h){const w=He.getStoredActiveCaipNetworkId(),C=h?ne.getCaipNetworks(h):[],E=C==null?void 0:C.find(T=>T.id===w);E&&E.chainNamespace===we.CHAIN.EVM&&await((b=this.switchChain)==null?void 0:b.call(this,{chainId:Number(E.id)}))}return n},async getChainId(){var b,w,C,E;const d=(b=ne.getActiveCaipNetwork(we.CHAIN.EVM))==null?void 0:b.id;if(d)return d;const p=(E=(C=(w=(await this.getProvider()).session)==null?void 0:w.namespaces[we.CHAIN.EVM])==null?void 0:C.chains)==null?void 0:E[0],g=ne.getCaipNetworks().find(T=>T.id===p);return g==null?void 0:g.id},async isAuthorized(){try{const[d,h]=await Promise.all([this.getAccounts(),this.getProvider()]);return d.length?await this.isChainsStale()&&h.session?(await h.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:d,chainId:h}){var b,w,C,E;const p=await this.getProvider();if(!p)throw new U0;const g=ne.getCaipNetworks().find(T=>T.id===h);if(!g)throw new Id(new o5);try{await p.request({method:"wallet_switchEthereumChain",params:[{chainId:cn(h)}]}),g!=null&&g.caipNetworkId&&p.setDefaultChain(g==null?void 0:g.caipNetworkId),l.emitter.emit("change",{chainId:Number(h)});const T=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...T,h]),{...g,id:g.id}}catch(T){const A=T;if(/(?:user rejected)/iu.test(A.message))throw new Dr(A);try{let k;d!=null&&d.blockExplorerUrls?k=d.blockExplorerUrls:k=(b=g.blockExplorers)!=null&&b.default.url?[(w=g.blockExplorers)==null?void 0:w.default.url]:[];const R=((E=(C=g.rpcUrls)==null?void 0:C.chainDefault)==null?void 0:E.http)||[],P={blockExplorerUrls:k,chainId:cn(h),chainName:g.name,iconUrls:d==null?void 0:d.iconUrls,nativeCurrency:g.nativeCurrency,rpcUrls:R};await p.request({method:"wallet_addEthereumChain",params:[P]});const B=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...B,h]),{...g,id:g.id}}catch(k){throw new Dr(k)}}},onAccountsChanged(d){d.length===0?this.onDisconnect():l.emitter.emit("change",{accounts:d.map(h=>bd(h))})},onChainChanged(d){const h=Number(d);l.emitter.emit("change",{chainId:h})},onConnect(d){this.setRequestedChainsIds(ne.getCaipNetworks().map(h=>Number(h.id)))},async onDisconnect(d){this.setRequestedChainsIds([]),l.emitter.emit("disconnect");const h=await this.getProvider();i&&(h.removeListener("accountsChanged",i),i=void 0),s&&(h.removeListener("chainChanged",s),s=void 0),c&&(h.removeListener("disconnect",c),c=void 0),a&&(h.removeListener("session_delete",a),a=void 0),r||(r=this.onConnect.bind(this),h.on("connect",r))},onDisplayUri(d){l.emitter.emit("message",{type:"display_uri",data:d})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var p,g,b;if(!((p=n==null?void 0:n.session)!=null&&p.namespaces))return[];const d=(b=(g=n==null?void 0:n.session)==null?void 0:g.namespaces[we.CHAIN.EVM])==null?void 0:b.accounts;return(d==null?void 0:d.map(w=>Number.parseInt(w.split(":")[1]??"")))??[]},async getRequestedChainsIds(){var h;const d=await((h=l.storage)==null?void 0:h.getItem(this.requestedChainsStorageKey))??[];return[...new Set(d)]},async isChainsStale(){if(!e)return!1;const d=l.chains.map(g=>g.id),h=this.getNamespaceChainsIds();if(h.length&&!h.some(g=>d.includes(g)))return!1;const p=await this.getRequestedChainsIds();return!d.every(g=>p.includes(Number(g)))},async setRequestedChainsIds(d){var h;await((h=l.storage)==null?void 0:h.setItem(this.requestedChainsStorageKey,d))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}const qv=Hi({pendingTransactions:0}),pG={state:qv,subscribeKey(t,e){return ar(qv,t,e)},increase(t){qv[t]+=1},decrease(t){qv[t]-=1},reset(t){qv[t]=0}};async function $We(t){if(Ue.isSafeApp()){const{safe:e}=await Lt(async()=>{const{safe:n}=await import("./index-szU6dTKr.js");return{safe:n}},[]);if(e&&!t.some(n=>n.type==="safe"))return e()}return null}async function UWe(t){try{const{baseAccount:e}=await Lt(async()=>{const{baseAccount:n}=await import("./index-szU6dTKr.js");return{baseAccount:n}},[]);if(e&&!t.some(n=>n.id==="baseAccount"))return e()}catch(e){console.error("Failed to import Coinbase Wallet SDK:",e)}return null}const BWe={enable:!1,pollingInterval:3e4};class FWe extends zse{constructor(e){const n=xu.extendCaipNetworks(e.networks,{projectId:e.projectId,customNetworkImageUrls:{},customRpcUrls:e.customRpcUrls});super(),this.balancePromises={},this.namespace=we.CHAIN.EVM,this.adapterType=we.ADAPTER_TYPES.WAGMI,this.projectId=e.projectId,this.pendingTransactionsFilter={...BWe,...e.pendingTransactionsFilter??{}},this.createConfig({...e,networks:n}),this.checkChainId()}construct(e){this.checkChainId(),this.setupWatchers()}async getAccounts(e){const n=this.getWagmiConnector(e.id);if(!n)return{accounts:[]};if(n.id===we.CONNECTOR_ID.AUTH){const r=await n.getProvider();if(!(r!=null&&r.user))return{accounts:[]};const{address:o,accounts:a}=r.user;return Promise.resolve({accounts:(a||[{address:o,type:"eoa"}]).map(c=>Ue.createAccount("eip155",c.address,c.type))})}const{addresses:i,address:s}=b2(this.wagmiConfig);return Promise.resolve({accounts:[...new Set(i||[s])].map(r=>Ue.createAccount("eip155",r||"","eoa"))})}checkChainId(){const{chainId:e}=b2(this.wagmiConfig);
7275e&&this.emit("switchNetwork",{chainId:e})}getWagmiConnector(e){return this.wagmiConfig.connectors.find(n=>n.id===e)}createConfig(e){this.wagmiChains=e.networks.filter(s=>s.chainNamespace===we.CHAIN.EVM);const n={},i=[...e.connectors??[]];this.wagmiChains.forEach(s=>{var a,c;const r=(a=e.transports)==null?void 0:a[s.id],o=xu.getCaipNetworkId(s);r?n[s.id]=xu.extendWagmiTransports(s,e.projectId,r):n[s.id]=xu.getViemTransport(s,e.projectId,(c=e.customRpcUrls)==null?void 0:c[o])}),this.wagmiConfig=n3e({...e,chains:this.wagmiChains,connectors:i,transports:n})}setupWatchPendingTransactions(){if(!this.pendingTransactionsFilter.enable||this.unwatchPendingTransactions)return;this.unwatchPendingTransactions=Lve(this.wagmiConfig,{pollingInterval:this.pendingTransactionsFilter.pollingInterval,onError:()=>{},onTransactions:()=>{this.emit("pendingTransactions"),pG.increase("pendingTransactions")}});const e=pG.subscribeKey("pendingTransactions",n=>{var i;n>=we.LIMITS.PENDING_TRANSACTIONS&&((i=this.unwatchPendingTransactions)==null||i.call(this),e())})}setupWatchers(){Xee(this.wagmiConfig,{onChange:e=>{this.clearConnections(),this.addConnection(...e.map(n=>{const i=this.getCaipNetworks().find(r=>r.id===n.chainId),s=n.connector.id===we.CONNECTOR_ID.AUTH;return{accounts:n.accounts.map(r=>({address:this.toChecksummedAddress(r)})),caipNetwork:i,connectorId:n.connector.id,auth:s?{name:He.getConnectedSocialProvider(),username:He.getConnectedSocialUsername()}:void 0}}))}}),Qee(this.wagmiConfig,{onChange:(e,n)=>{var i;if(e.status==="disconnected"&&n.address&&this.emit("disconnect"),e!=null&&e.chainId&&(e==null?void 0:e.chainId)!==(n==null?void 0:n.chainId)&&this.emit("switchNetwork",{chainId:e.chainId}),e.status==="connected"){const s=e.address!==(n==null?void 0:n.address),r=e.connector.id!==((i=n.connector)==null?void 0:i.id),o=n.status!=="connected";(s||r||o)&&(this.setupWatchPendingTransactions(),this.handleAccountChanged({address:e.address,chainId:e.chainId,connector:e.connector}))}}})}async addThirdPartyConnectors(){const e=[],{enableCoinbase:n}=ye.state||{};if(n!==!1){const s=await UWe(this.wagmiConfig.connectors);s&&e.push(s)}const i=await $We(this.wagmiConfig.connectors);i&&e.push(i),await Promise.all(e.map(s=>{const r=this.configureInternalConnector(s);return this.addWagmiConnector(r)}))}addWagmiConnectors(){const e=[];ye.state.enableInjected!==!1&&e.push(tS({shimDisconnect:!0}));const{features:n,remoteFeatures:i,projectId:s,enableAuthLogger:r}=ye.state,o=(i==null?void 0:i.email)??(n==null?void 0:n.email)??!0,a=(i==null?void 0:i.socials)??(n==null?void 0:n.socials),c=Array.isArray(a)&&(a==null?void 0:a.length)>0;(o||c)&&e.push(LWe({chains:this.wagmiChains,options:{projectId:s,enableAuthLogger:r}})),e.forEach(l=>{this.configureInternalConnector(l)})}configureInternalConnector(e){const n=this.wagmiConfig._internal.connectors.setup(e);return this.wagmiConfig._internal.connectors.setState(i=>[...i,n]),n}async handleAccountChanged({address:e,chainId:n,connector:i}){if(!this.namespace)throw new Error("WagmiAdapter:handleAccountChanged - namespace is required");const s=await i.getProvider().catch(()=>{});this.emit("accountChanged",{address:this.toChecksummedAddress(e),chainId:n,connector:{id:i.id,name:ra.ConnectorNamesMap[i.id]??i.name,imageId:ra.ConnectorImageIds[i.id],type:ra.ConnectorTypesMap[i.type]??"EXTERNAL",info:i.id===we.CONNECTOR_ID.INJECTED?void 0:{rdns:i.id},provider:s,chain:this.namespace,chains:[]}})}async signMessage(e){try{return{signature:await Yee(this.wagmiConfig,{message:e.message,account:e.address})}}catch{throw new Error("WagmiAdapter:signMessage - Sign message failed")}}async sendTransaction(e){var a;const{chainId:n,address:i}=b2(this.wagmiConfig),s=(a=this.wagmiChains)==null?void 0:a.find(c=>c.id===n),r={account:i,to:e.to,value:Number.isNaN(Number(e.value))?BigInt(0):BigInt(e.value),gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,data:e.data,chain:s,type:"legacy",parameters:["nonce"]};await Rve(this.wagmiConfig,r);const o=await Kee(this.wagmiConfig,r);return await Zee(this.wagmiConfig,{hash:o,timeout:25e3}),{hash:o}}async writeContract(e){var a;const{caipNetwork:n,...i}=e,s=Number(l5.caipNetworkIdToNumber(n.caipNetworkId)),r=(a=this.wagmiChains)==null?void 0:a.find(c=>c.id===s);return{hash:await Jee(this.wagmiConfig,{chain:r,address:i.tokenAddress,account:i.fromAddress,abi:i.abi,functionName:i.method,args:i.args,__mode:"prepared"})}}async estimateGas(e){try{return{gas:await Tve(this.wagmiConfig,{account:e.address,to:e.to,data:e.data,type:"legacy"})}}catch{throw new Error("WagmiAdapter:estimateGas - error estimating gas")}}parseUnits(e){return hs(e.value,e.decimals)}formatUnits(e){return dt(e.value,e.decimals)}async addWagmiConnector(e){if(!this.namespace)throw new Error("WagmiAdapter:addWagmiConnector - namespace is required");const{enableEIP6963:n}=ye.state||{};if(e.type===we.CONNECTOR_ID.INJECTED&&n===!1||e.id===we.CONNECTOR_ID.AUTH||e.id===we.CONNECTOR_ID.WALLET_CONNECT)return;let i;e.id!==we.CONNECTOR_ID.BASE_ACCOUNT&&(i=await e.getProvider().catch(()=>{}));const s=vr.state.connectorImages;this.addConnector({id:e.id,explorerId:ra.ConnectorExplorerIds[e.id]??ra.ConnectorExplorerIds[e.name],imageUrl:(s==null?void 0:s[e.id])??e.icon,name:ra.ConnectorNamesMap[e.id]??e.name,imageId:ra.ConnectorImageIds[e.id],type:ra.ConnectorTypesMap[e.type]??"EXTERNAL",info:e.id===we.CONNECTOR_ID.INJECTED?void 0:{rdns:e.id},provider:i,chain:this.namespace,chains:[]})}async syncConnectors(){Mve(this.wagmiConfig,{onChange:e=>{e.forEach(n=>this.addWagmiConnector(n))}}),this.addWagmiConnectors(),await Promise.all(this.wagmiConfig.connectors.map(e=>this.addWagmiConnector(e))),await this.addThirdPartyConnectors()}async syncConnections(){const e=this.connectors.filter(n=>{const{hasDisconnected:i,hasConnected:s}=tr.getConnectorStorageInfo(n.id,this.namespace);return!i&&s}).map(n=>
7275this.getWagmiConnector(n.id)).filter(Boolean);await l3(this.wagmiConfig,{connectors:e})}async syncConnection(e){var l,d;const{id:n,chainId:i}=e,r=uu(this.wagmiConfig).find(h=>h.connector.id===n),o=this.getWagmiConnector(n),a=await(o==null?void 0:o.getProvider());if(Ue.isSafeApp()&&n===we.CONNECTOR_ID.SAFE&&!(r!=null&&r.accounts.length)){const h=this.getWagmiConnector("safe");if(h){const p=await DT(this.wagmiConfig,{connector:h,chainId:Number(i)}),g=await h.getProvider();return{chainId:Number(i),address:this.toChecksummedAddress(p.accounts[0]),provider:g,type:(l=r==null?void 0:r.connector.type)==null?void 0:l.toUpperCase(),id:r==null?void 0:r.connector.id}}}return{chainId:Number(r==null?void 0:r.chainId),address:this.toChecksummedAddress(r==null?void 0:r.accounts[0]),provider:a,type:(d=r==null?void 0:r.connector.type)==null?void 0:d.toUpperCase(),id:r==null?void 0:r.connector.id}}async connectWalletConnect(e){try{const n=this.getWalletConnectConnector();await n.authenticate();const i=this.getWagmiConnector("walletConnect");if(!i)throw new Error("UniversalAdapter:connectWalletConnect - connector not found");const s=await DT(this.wagmiConfig,{connector:i,chainId:e?Number(e):void 0});return s.chainId!==Number(e)&&await BR(this.wagmiConfig,{chainId:s.chainId}),{clientId:await n.provider.client.core.crypto.getClientId()}}catch(n){throw n instanceof Dr?new n2(n):Ha.isUserRejectedRequestError(n)?new n2(n):n}}async connect(e){var n,i,s,r,o;try{const{id:a,address:c,provider:l,type:d,info:h,chainId:p,socialUri:g}=e,b=this.getWagmiConnector(a);if(!b)throw new Error("connectionControllerClient:connectExternal - connector is undefined");l&&h&&b.id===we.CONNECTOR_ID.EIP6963&&((n=b.setEip6963Wallet)==null||n.call(b,{provider:l,info:h}));const w=(s=(i=this.wagmiConfig.state)==null?void 0:i.connections)==null?void 0:s.get(b.uid);if(w){await((r=this.wagmiConfig.storage)==null?void 0:r.setItem("recentConnectorId",b.id));const T=[...w.accounts].sort((A,k)=>tr.isLowerCaseMatch(A,c)?-1:tr.isLowerCaseMatch(k,c)?1:0);return(o=this.wagmiConfig)==null||o.setState(A=>({...A,connections:new Map(A.connections).set(b.uid,{accounts:T,chainId:w.chainId,connector:w.connector}),current:b.uid,status:"connected"})),{address:this.toChecksummedAddress(T[0]),chainId:w.chainId,provider:l,type:d,id:a}}const C=await DT(this.wagmiConfig,{connector:b,chainId:p?Number(p):void 0,socialUri:g}),E=l??await b.getProvider();return{address:this.toChecksummedAddress(C.accounts[0]),chainId:C.chainId,provider:E,type:d,id:a}}catch(a){throw a instanceof Dr?new n2(a):Ha.isUserRejectedRequestError(a)?new n2(a):a}}get connections(){return Array.from(this.wagmiConfig.state.connections.values()).map(e=>({accounts:e.accounts.map(n=>({address:this.toChecksummedAddress(n)})),connectorId:e.connector.id}))}async reconnect(e){const{id:n}=e,i=this.getWagmiConnector(n);if(!i)throw new Error("connectionControllerClient:connectExternal - connector is undefined");await l3(this.wagmiConfig,{connectors:[i]})}async getBalance(e){const n=e.address,i=this.getCaipNetworks().find(s=>s.id===e.chainId);if(!n)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(i&&this.wagmiConfig){const s=`${i.caipNetworkId}:${e.address}`,r=this.balancePromises[s];if(r)return r;const o=He.getNativeBalanceCacheForCaipAddress(s);return o?{balance:o.balance,symbol:o.symbol}:(this.balancePromises[s]=new Promise(async a=>{var c,l;try{const d=Number(e.chainId),h=await Gee(this.wagmiConfig,{address:e.address,chainId:d,token:(l=(c=e.tokens)==null?void 0:c[i.caipNetworkId])==null?void 0:l.address});He.updateNativeBalanceCache({caipAddress:s,balance:h.formatted,symbol:h.symbol,timestamp:Date.now()}),a({balance:h.formatted,symbol:h.symbol})}catch(d){console.warn("Appkit:WagmiAdapter:getBalance - Error getting balance",d),a({balance:"0.00",symbol:"ETH"})}}).finally(()=>{delete this.balancePromises[s]}),this.balancePromises[s]||{balance:"0.00",symbol:"ETH"})}return{balance:"",symbol:""}}getWalletConnectProvider(){var e;return(e=this.getWagmiConnector("walletConnect"))==null?void 0:e.provider}async disconnect(e){if(e.id){const n=this.getWagmiConnector(e.id),s=uu(this.wagmiConfig).find(r=>tr.isLowerCaseMatch(r.connector.id,e.id));return await $R(this.wagmiConfig,{connector:n}),ye.state.enableReconnect===!1&&this.deleteConnection(e.id),s?{connections:[{accounts:s.accounts.map(r=>({address:this.toChecksummedAddress(r)})),connectorId:s.connector.id}]}:{connections:[]}}return this.disconnectAll()}async disconnectAll(){const e=uu(this.wagmiConfig),n=await Promise.allSettled(e.map(async i=>{const s=this.getWagmiConnector(i.connector.id);return s&&await $R(this.wagmiConfig,{connector:s}),i}));return this.wagmiConfig.state.connections.clear(),{connections:n.filter(i=>i.status==="fulfilled").map(({value:i})=>({accounts:i.accounts.map(s=>({address:this.toChecksummedAddress(s)})),connectorId:i.connector.id}))}}async switchNetwork(e){var g,b,w,C,E;const{caipNetwork:n}=e,i=this.wagmiConfig.chains.find(T=>T.id.toString()===n.id.toString());if(!i)throw new Error("connectionControllerClient:switchNetwork - wagmiChain is undefined");const{name:s,nativeCurrency:r,rpcUrls:o,blockExplorers:a,id:c}=i,l=((w=(b=(g=n.rpcUrls)==null?void 0:g.chainDefault)==null?void 0:b.http)==null?void 0:w[0])??o.default.http[0]??"",d=(a==null?void 0:a.default.url)??((E=(C=n.blockExplorers)==null?void 0:C.default)==null?void 0:E.url)??"",h=r??n.nativeCurrency,p=s??n.name;await BR(this.wagmiConfig,{chainId:c,addEthereumChainParameter:{chainName:p,nativeCurrency:h,rpcUrls:[l],blockExplorerUrls:[d]}}),await super.switchNetwork(e)}async getCapabilities(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:getCapabilities - wagmiConfig is undefined");const i=uu(this.wagmiConfig)[0],s=i?this.getWagmiConnector(i.connector.id):null;if(!s)throw new Error("connectionControllerClient:getCapabilities - connector is undefined");const r=await s.getProvider();if(!r)throw new Error("connectionControllerClient:getCapabilities - provider is undefined");return await r.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:grantPermissions - wagmiConfig is undefined");const i=uu(this.wagmiConfig)[0],s=i?this.getWagmiConnector(i.connector.id):null;if(!s)throw new Error("connectionControllerClient:grantPermissions - connector is undefined");const r=await s.getProvider();if(!r)throw new Error("connectionControllerClient:grantPermissions - provider is undefined");return r.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:revokePermissions - wagmiConfig is undefined");const i=uu(this.wagmiConfig)[0],s=i?this.getWagmiConnector(i.connector.id):null;if(!s)throw new Error("connectionControllerClient:revokePermissions - connector is undefined");const r=await s.getProvider();if(!r)throw new Error("connectionControllerClient:revokePermissions - provider is undefined");return r.request({method:"wallet_revokePermissions",params:e})}async walletGetAssets(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:walletGetAssets - wagmiConfig is undefined");const i=uu(this.wagmiConfig)[0],s=i?this.getWagmiConnector(i.connector.id):null;if(!s)throw new Error("connectionControllerClient:walletGetAssets - connector is undefined");const r=await s.getProvider();if(!r)throw new Error("connectionControllerClient:walletGetAssets - provider is undefined");return r.request({method:"wallet_getAssets",params:[e]})}setAuthProvider(e){if(!this.namespace)throw new Error("WagmiAdapter:setAuthProvider - namespace is required");
7275this.addConnector({id:we.CONNECTOR_ID.AUTH,type:"AUTH",name:we.CONNECTOR_NAMES.AUTH,provider:e,imageId:ra.ConnectorImageIds[we.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}async setUniversalProvider(e){e.on("connect",()=>{const i=uu(this.wagmiConfig),s=this.getWagmiConnector("walletConnect");if(s&&!i.find(r=>r.connector.id===s.id)){if(ne.state.activeChain==="eip155")return;l3(this.wagmiConfig,{connectors:[s]})}});const n=KM({universalProvider:e});return this.configureInternalConnector(n),this.addConnector(new Hse({provider:e,caipNetworks:this.getCaipNetworks(),namespace:"eip155"})),Promise.resolve()}toChecksummedAddress(e){return g6(e.toLowerCase())}}const Nn=bu,Mre="f5f6f0d2a4bb55b22ce05e9e92a4e95e",jWe={name:"WinnieSwap",description:"WinnieSwap - DeFi Protocol on Berachain",url:"https://www.winnieswap.com",icons:["https://www.winnieswap.com/logo.png"]},Lre=JJ({id:bu.id,name:bu.name,chainNamespace:"eip155",caipNetworkId:`eip155:${bu.id}`,nativeCurrency:bu.nativeCurrency,rpcUrls:{default:{http:["https://partners.rpc-mainnet.berachain.com/?apikey=OMxUxBb9r39hhIkIu8WMXYm"]},public:{http:["https://partners.rpc-mainnet.berachain.com/?apikey=OMxUxBb9r39hhIkIu8WMXYm"]}},blockExplorers:bu.blockExplorers,testnet:bu.testnet}),$re=[Lre],VWe="https://partners.rpc-mainnet.berachain.com/?apikey=OMxUxBb9r39hhIkIu8WMXYm",YM=eS({chain:bu,transport:ip(VWe,{batch:{multicall:!0},retryCount:3,retryDelay:1e3})}),Ure=new FWe({networks:$re,projectId:Mre,storage:ete({storage:typeof window<"u"?window.localStorage:void 0}),ssr:!1}),WWe=Ure.wagmiConfig;OWe({adapters:[Ure],networks:$re,projectId:Mre,metadata:jWe,themeMode:"dark",themeVariables:{"--w3m-color-mix":"#171410","--w3m-color-mix-strength":40,"--w3m-accent":"#ffa42d","--w3m-font-family":"inherit","--w3m-border-radius-master":"16px"},features:{analytics:!0,email:!1,socials:[],onramp:!1}});function qWe({children:t}){const e=new B3e({defaultOptions:{queries:{staleTime:3e5,gcTime:864e5,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!0,retry:2,retryDelay:n=>Math.min(1e3*2**n,1e4)},mutations:{retry:1}}});return kn.createElement(r3e,{config:WWe},kn.createElement(o5e,{client:e},t))}const zWe=t=>t?["safe","gnosis","multisig","walletconnect"].some(n=>t.toLowerCase().includes(n)):!1,HWe=()=>{const{isConnected:t,chainId:e,connector:n}=mn(),{switchChain:i}=S5e(),{switchNetwork:s}=MWe(),r=e===Nn.id,o=Lre;return M.useEffect(()=>{const a=zWe(n==null?void 0:n.name);if(t&&!r&&!a){console.log("[BerachainForce] Auto-switching to Berachain...",{currentChain:e,targetChain:Nn.id,connector:n==null?void 0:n.name});try{s(o)}catch(c){console.warn("[BerachainForce] AppKit auto-switch failed, trying Wagmi:",c);try{i({chainId:Nn.id})}catch(l){console.warn("[BerachainForce] Wagmi auto-switch also failed:",l)}}}else a&&console.log("[BerachainForce] Safe wallet detected, skipping auto-switch to prevent connection issues")},[t,r,s,i,o,e,n]),{isCorrectNetwork:r,currentChainId:e,targetChainId:Nn.id,targetChainName:Nn.name}},ZM=()=>{const t=ame(),{address:e,isConnected:n,chainId:i}=mn(),{disconnect:s}=C5e(),{isCorrectNetwork:r}=HWe(),{open:o}=OBe();M.useEffect(()=>{n&&e&&i?(t(zle({address:e,chainId:Number(i)})),eS({chain:bu,transport:ip("https://partners.rpc-mainnet.berachain.com/?apikey=OMxUxBb9r39hhIkIu8WMXYm")}).getBalance({address:e}).then(h=>{t(WB(w6(h)))}).catch(h=>{console.error("[useWallet] Error fetching balance:",h),t(WB("0"))})):n||t(zB())},[n,e,i,t,r]);const a=M.useCallback(()=>{try{o()}catch(l){console.error("[useWallet] Connection error:",l),t(qB(l instanceof Error?l.message:"Connection error"))}},[o,t]),c=M.useCallback(async()=>{try{await s(),t(zB())}catch(l){console.error("[useWallet] Disconnection error:",l),t(qB(l instanceof Error?l.message:"Disconnection error"))}},[s,t]);return{connect:a,disconnect:c,address:e,chainId:i,isConnected:n,isConnecting:!1,connectors:[],isCorrectNetwork:r}},GWe="https://partners.rpc-mainnet.berachain.com/?apikey=OMxUxBb9r39hhIkIu8WMXYm",KWe=eS({chain:bu,transport:ip(GWe)}),YWe=t=>{const[e,n]=M.useState(null),[i,s]=M.useState(!1),[r,o]=M.useState(null),a=M.useCallback(async c=>{if(c){s(!0),o(null);try{const l=bd(c),d=await KWe.getEnsName({address:l});n(d?d.replace(".bera",".ð»âï¸"):null)}catch(l){o(l instanceof Error?l:new Error("Unknown error")),n(null)}finally{s(!1)}}},[]);return M.useEffect(()=>{t?a(t):n(null)},[t,a]),{beraname:e,isLoading:i,error:r}},ZWe="/assets/Ambire-CTMPUAA8.svg",QWe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9568)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M13.7754%205.89197H10.2242C10.1057%205.89197%2010.0104%205.98744%2010.0079%206.10618C9.93613%209.44108%208.1913%2012.6064%205.1881%2014.8485C5.09284%2014.9198%205.0710
72755%2015.0534%205.14068%2015.1497L7.21846%2018.0227C7.28916%2018.1205%207.42696%2018.1425%207.5239%2018.0707C9.40165%2016.6782%2010.9121%2014.9979%2011.9999%2013.1356C13.0875%2014.9979%2014.598%2016.6782%2016.476%2018.0707C16.5727%2018.1425%2016.7105%2018.1205%2016.7812%2018.0227L18.859%2015.1497C18.9286%2015.0534%2018.907%2014.9198%2018.8116%2014.8485C15.8083%2012.6064%2014.0635%209.44108%2013.9918%206.10618C13.9892%205.98744%2013.8942%205.89197%2013.7754%205.89197Z'%20fill='%23FF875B'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9568'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",XWe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9615)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.9118%205.10081C13.4207%205.10081%2013.898%205.16902%2014.3399%205.29553C13.9073%204.28715%2013.0089%204%2012.0091%204C11.0074%204%2010.1075%204.28828%209.67581%205.30147C10.1145%205.17051%2010.5898%205.10081%2011.0969%205.10081H12.9118ZM10.9805%206.11319C8.5642%206.11319%207.1875%208.01405%207.1875%2010.3589V12.7676C7.1875%2013.0021%207.38338%2013.1876%207.62501%2013.1876H16.3751C16.6167%2013.1876%2016.8126%2013.0021%2016.8126%2012.7676V10.3589
7275C16.8126%208.01405%2015.2117%206.11319%2012.7954%206.11319H10.9805ZM11.9966%2010.3797C12.8423%2010.3797%2013.5279%209.69414%2013.5279%208.84845C13.5279%208.00275%2012.8423%207.31718%2011.9966%207.31718C11.1509%207.31718%2010.4654%208.00275%2010.4654%208.84845C10.4654%209.69414%2011.1509%2010.3797%2011.9966%2010.3797ZM7.1875%2014.6034C7.1875%2014.369%207.38338%2014.1788%207.62501%2014.1788H16.3751C16.6167%2014.1788%2016.8126%2014.369%2016.8126%2014.6034V17.1508C16.8126%2017.6198%2016.4209%2018%2015.9376%2018H8.06251C7.57926%2018%207.1875%2017.6198%207.1875%2017.1508V14.6034Z'%20fill='%23E33E3F'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9615'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",JWe="/assets/Bitget-RH7i4pHD.svg",eqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9628)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M5.37528%209.88672L4.64376%2010.6189C3.80729%2011.4138%203.78681%2012.7309%204.58104%2013.5674C4.60216%2013.5885%204.62264%2013.609%204.64376%2013.6301L10.5196%2019.5686C10.6661%2019.7152%2010.8121%2019.8406%2011.0002%2019.9238V12.7098L5.37528%209.88672Z'%20fill='%233D89F5'/%3e%3cpath%20d='M18.6322%209.88672L19.3643%2010.6189C20.1797%2011.4138%2020.2213%2012.7309%2019.4271%2013.5674C19.4059%2013.5885%2019.3855%2013.609%2019.3643%2013.6301L13.4674%2019.5475C13.3208%2019.6941%2013.1749%2019.8195%2012.9868%2019.9034V12.7098L18.6322%209.88672Z'%20fill='%231656B9'/%3e%3cpath%20d='M17.2101%208.38144L13.5301%204.70144C12.7148%203.88608%2011.397%203.86496%2010.5817%204.65984C10.5605%204.68096%2010.5401%204.68096%2010.5401%204.70144L6.83895%208.38144L12.0037%2010.9536L17.2101%208.38144Z'%20fill='%2385B5F8'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9628'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",tqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9564)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M14.3581%204.29131C14.3818%204.33138%2014.3505%204.38091%2014.304%204.38091C13.3619%204.38091%2012.5961%205.12675%2012.5782%206.05354C12.2556%205.99332%2011.9213%205.98879%2011.5912%206.04443C11.5683%205.12186%2010.8045%204.38091%209.86553%204.38091C9.81898%204.38091%209.78766%204.33134%209.81131%204.29125C10.2673%203.51894%2011.1147%203%2012.0847%203C13.0547%203%2013.9021%203.51897%2014.3581%204.29131Z'%20fill='url(%23paint0_linear_1_9564)'/%3e%3cpath%20d='M17.3317%2010.0791C17.5693%2010.151%2017.7943%209.94252%2017.7149%209.70734C16.8872%207.25573%2014.1425%206.256%2012.0715%206.256C9.99724%206.256%207.1913%207.28746%206.42896%209.71832C6.35572%209.95191%206.58001%2010.1534%206.81406%2010.0817L11.8872%208.52711C11.9907%208.49538%2012.1014%208.4952%2012.2051%208.52661L17.3317%2010.0791Z'%20fill='url(%23paint1_linear_1_9564)'/%3e%3cpath%20d='M6.44178%2010.4702L11.8909%208.81754C11.9938%208.78634%2012.1037%208.78624%2012.2067%208.81729L17.6898%2010.471C18.143%2010.6077%2018.4532%2011.0252%2018.4532%2011.4986V16.431C18.4322%2017.635%2017.3506%2018.6%2016.1471%2018.6H14.148C13.9504%2018.6%2013.7904%2018.4402%2013.7904%2018.2426V16.5132C13.7904%2015.8323%2014.1934%2015.2159%2014.817%2014.9432C15.6529%2014.5775%2016.
72756419%2014.0829%2016.8279%2013.0903C16.8879%2012.77%2016.679%2012.461%2016.3595%2012.3975C15.5515%2012.2369%2014.6558%2012.2989%2013.8983%2012.6377C13.0384%2013.0223%2012.8135%2013.6621%2012.7302%2014.5213L12.6293%2015.4469C12.5984%2015.7298%2012.3332%2015.9465%2012.0488%2015.9465C11.7545%2015.9465%2011.5339%2015.7224%2011.502%2015.4297L11.4029%2014.5213C11.3316%2013.7853%2011.2023%2013.0704%2010.4414%2012.7301C9.57356%2012.3419%208.70141%2012.213%207.77362%2012.3975C7.45407%2012.461%207.24519%2012.77%207.30523%2013.0903C7.49285%2014.0915%208.47405%2014.5748%209.31613%2014.9432C9.93978%2015.2159%2010.3428%2015.8323%2010.3428%2016.5132V18.2422C10.3428%2018.4399%2010.1828%2018.6%209.98521%2018.6H7.98609C6.78251%2018.6%205.70095%2017.635%205.67993%2016.431V11.4974C5.67993%2011.0245%205.98932%2010.6074%206.44178%2010.4702Z'%20fill='url(%23paint2_linear_1_9564)'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9564'%20x1='11.6659'%20y1='-1.30363'%20x2='53.7656'%20y2='66.7241'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F5D45E'/%3e%3cstop%20offset='1'%20stop-color='%23FF9600'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1_9564'%20x1='11.918'%20y1='-13.6478'%20x2='48.5914'%20y2='16.4043'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F5D45E'/%3e%3cstop%20offset='1'%20stop-color='%23FF9600'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1_9564'%20x1='11.9413'%20y1='2.15771'%20x2='17.542'%20y2='18.6741'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F5D45E'/%3e%3cstop%20offset='1'%20stop-color='%23FF9600'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1_9564'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",nqe="/assets/Brave-tQwARxAR.svg",iqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9625)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M17.3126%2010.1175C16.5417%207.93244%2014.4584%206.35062%2011.9997%206.35062C8.87457%206.35062%206.35419%208.86889%206.35419%2011.9909C6.35342%2012.7322%206.49897%2013.4665%206.78248%2014.1515C7.06599%2014.8365%207.48189%2015.4588%208.00635%2015.9827C8.53081%2016.5067%209.15351%2016.922%209.83877%2017.2049C10.524%2017.4878%2011.2584%2017.6326%2011.9997%2017.6312C13.1652%2017.6347%2014.302%2017.2704%2015.2484%2016.5903C16.1948%2015.9102%2016.9026%2014.9489%2017.2709%2013.8432C17.3748%2013.5105%2017.5831%2013.2606%2017.9163%2013.2606C18.2501%2013.2606%2018.4789%2013.5105%2018.4789%2013.8432V17.444C18.4789%2017.9022%2018.104%2018.2976%2017.6247%2018.2976H6.35419C5.89546%2018.2976%205.5%2017.9227%205.5%2017.444V6.51671C5.5%206.05903%205.89546%205.66357%206.35419%205.66357H17.6458C18.104%205.66357%2018.5%206.03847%2018.5%206.51671V10.1175C18.5%2010.4713%2018.2084%2010.5962%2017.9163%2010.5962C17.6247%2010.5962%2017.3959%2010.3885%2017.3126%2010.1175Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9625'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",sqe="/assets/Coin98-E2fyhaXp.svg",rqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9445)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M20.524%2012C20.524%207.29215%2016.708%203.47615%2012.0002%203.47615C7.29232%203.47615%203.47632%207.29215%203.47632%2012C3.47632%2016.7078%207.29232%2020.5238%2012.0002%2020.5238
7275C16.708%2020.5238%2020.524%2016.7078%2020.524%2012ZM14.0987%209.27554H9.9006C9.55595%209.27554%209.27563%209.57698%209.27563%209.94754V14.0515C9.27563%2014.4221%209.555%2014.7235%209.9006%2014.7235H14.0987C14.4433%2014.7235%2014.7236%2014.4231%2014.7236%2014.0515V9.94754C14.7236%209.57698%2014.4443%209.27554%2014.0987%209.27554Z'%20fill='%230052FF'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9445'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",oqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9439)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M9.48082%2016.1166L6.68682%2011.2773C6.61717%2011.1566%206.58052%2011.0198%206.58052%2010.8805C6.58052%2010.7412%206.61717%2010.6044%206.68682%2010.4837L9.48082%205.64678C9.55047%205.52614%209.65064%205.42596%209.77129%205.35631C9.89194%205.28666%2010.0288%205.25%2010.1681%205.25H15.7537C15.893%205.25%2016.0299%205.28666%2016.1505%205.35631C16.2712%205.42596%2016.3714%205.52614%2016.441%205.64678L19.2444%2010.4884L17.8699%2011.282L15.305%206.84184H10.6357L8.29993%2010.8852L10.8648%2015.3277L9.48082%2016.1166Z'%20fill='%239C6CFF'/%3e%3cpath%20d='M13.5764%2018.75H7.97893C7.83963%2018.75%207.70275%2018.7133%207.58211%2018.6437C7.46147%2018.574%207.3613%2018.4738%207.29165%2018.3532L4.5%2013.5186L5.87221%2012.7251L8.4371%2017.1676H13.104L15.4374%2013.1218L12.8749%208.6817L14.2471%207.88813L17.0411%2012.7251C17.1108%2012.8457%2017.1474%2012.9826%2017.1474%2013.1218C17.1474%2013.2611%2017.1108%2013.398%2017.0411%2013.5186L14.2471%2018.3579C14.1786%2018.4756%2014.0809%2018.5736%2013.9633%2018.6422C13.8458%2018.7109%2013.7125%2018.7481%2013.5764%2018.75Z'%20fill='%2305D2DD'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9439'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",aqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9637)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M4.24695%207.5V16.4996L12.001%2021L19.7533%2016.4996V7.5L12.001%203L4.24695%207.5ZM4.92944%2016.105V7.89628L12.001%203.78997L19.0729%207.89628V16.105L12.001%2020.2096L4.92944%2016.105Z'%20fill='%23FEFEFE'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.0391%206.88544H8.94643L8.24013%2010.0081H15.7735L15.0391%206.88544Z'%20fill='%23FEFEFE'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.0273%2014.3055V12.2306L8.22269%2011.0773L6.18032%2012.6033L8.96428%2017.4701H10.0762L11.3915%2016.2394V15.6209L10.0273%2014.3055Z'%20fill='%23FEFEFE'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.9794%2010.4793H10.0342L10.6988%2012.2238L10.4964%2014.1786H12L13.518%2014.1718L13.3289%2012.2238L13.9794%2010.4793Z'%20fill='%23FEFEFE'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M15.7841%2011.0632L14.0003%2012.2306V14.3055L12.6366%2015.6209V16.2394L13.9514%2017.4565H15.0493L17.8197%2012.6034L15.7841%2011.0632Z'%20fill='%23FEFEFE'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9637'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",cqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9484)'%3e%3cpath%20d='M24%200H0V24.1935H24V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M9.33318%2015.7811V19.1646C9.33318%2019.716%209.7763%2020.1613%2010.3219%2020.1613H13.6778C14.2247%2020.1613%2014.6665%2019.7147%2014.6665%2019.1646V17.4729C14.6665%2016.7296%2014.9646%2016.0575%2015.4476%2015.5719C15.9307%2015.0849%2016.5973%2014.7843%2017.3332%2014.7843H19.0111C19.5581%2014.7843%2019.9998%2014.3376%2019.9998%2013.7876V10.4055C19.9998%209.85409%2019.5568%209.40869%2019.0111%209.40869H15.6565C15.1096%209.40869%2014.6679%209.85542%2014.6679%2010.4055V12.179C14.6679%2013.6185%2013.5102%2
7275014.7843%2012.0837%2014.7843H10.3245C9.77763%2014.7843%209.33585%2015.2311%209.33585%2015.7811H9.33318Z'%20fill='%23ECEFEC'/%3e%3cpath%20d='M3.99988%2010.4053V13.7884C3.99988%2014.3397%204.443%2014.785%204.98857%2014.785H8.34451C8.89143%2014.785%209.33322%2014.3383%209.33322%2013.7884V12.0969C9.33322%2011.3537%209.63129%2010.6817%2010.1143%2010.1961C10.5973%209.70915%2011.264%209.40869%2011.9999%209.40869H13.6779C14.2248%209.40869%2014.6665%208.962%2014.6665%208.41203V5.029C14.6665%204.47768%2014.2234%204.03235%2013.6779%204.03235H10.3232C9.77632%204.03235%209.33453%204.47903%209.33453%205.029V6.80234C9.33453%208.24167%208.17685%209.40734%206.75037%209.40734H4.98857C4.44167%209.40734%203.99988%209.85537%203.99988%2010.4053Z'%20fill='%23ECEFEC'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9484'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",lqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9517)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M20.0002%208.40271L13.062%203.85356V6.39701L17.5129%209.28928L16.9893%2010.9462H13.062V13.0536H16.9893L17.5129%2014.7105L13.062%2017.6027V20.1462L20.0002%2015.6116L18.8656%2012.0072L20.0002%208.40271Z'%20fill='url(%23paint0_linear_1_9517)'/%3e%3cpath%20d='M7.02545%2013.0536H10.9382V10.9462H7.0109L6.50181%209.28928L10.9382%206.39701V3.85356L4%208.40271L5.13455%2012.0072L4%2015.6116L10.9527%2020.1462V17.6027L6.50181%2014.7105L7.02545%2013.0536Z'%20fill='url(%23paint1_linear_1_9517)'/%3e%3cmask%20id='mask0_1_9517'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='4'%20y='3'%20width='17'%20height='18'%3e%3cpath%20d='M20.0002%208.40271L13.062%203.85356V6.39701L17.5129%209.28928L16.9893%2010.9462H13.062V13.0536H16.9893L17.5129%2014.7105L13.062%2017.6027V20.1462L20.0002%2015.6116L18.8657%2012.0072L20.0002%208.40271Z'%20fill='url(%23paint2_linear_1_9517)'/%3e%3cpath%20d='M7.02544%2013.0536H10.9382V10.9462H7.0109L6.50182%209.28928L10.9382%206.39701V3.85356L4%208.40271L5.13454%2012.0072L4%2015.6116L10.9527%2020.1462V17.6027L6.50182%2014.7105L7.02544%2013.0536Z'%20fill='url(%23paint3_linear_1_9517)'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1_9517)'%3e%3cpath%20d='M19.8936%203.85356H4.0083V20.1462H19.8936V3.85356Z'%20fill='url(%23paint4_linear_1_9517)'/%3e%3c/g%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9517'%20x1='17.7557'%20y1='21.2663'%20x2='13.1082'%20y2='2.06431'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230B46F9'/%3e%3cstop%20offset='1'%20stop-color='%23BBFBE0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1_9517'%20x1='17.7555'%20y1='21.2663'%20x2='13.108'%20y2='2.06431'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230B46F9'/%3e%3cstop%20offset='1'%20stop-color='%23BBFBE0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1_9517'%20x1='17.7557'%20y1='21.2663'%20x2='13.1082'%20y2='2.06431'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230B46F9'/%3e%3cstop%20offset='1'%20stop-color='%23BBFBE0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1_9517'%20x1='17.7555'%20y1='21.2663'%20x2='13.1079'%20y2='2.06431'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%230B46F9'/%3e%3cstop%20offset='1'%20stop-color='%23BBFBE0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_1_9517'%20x1='5.02659'%20y1='7.51941'%20x2='13.071'%20y2='13.5273'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.119792'%20stop-color='%238952FF'%20stop-opacity='0.87'/%3e%3cstop%20offset='1'%20stop-color='%23DABDFF'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1_9517'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",uqe="/assets/Family-BN79TTCl.svg",dqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9580)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M17.6108%2017.7027C16.1158%2019.1772%2014.0997%2020.0027%2012%2020C9.90505%2020.0031%207.8931%2019.1813%206.39949%2017.7123C9.67552%2015.1319%2014.3311%2015.129%2017.6108%2017.7027ZM1
72757.7027%2017.6108C19.1772%2016.1159%2020.0027%2014.0997%2020%2012C20%209.81965%2019.1279%207.84374%2017.7138%206.40023C15.1319%209.68582%2015.129%2014.3318%2017.7027%2017.6108ZM17.6226%206.30904C14.3384%208.89604%209.66817%208.89236%206.38699%206.29948C7.88204%204.82353%209.89914%203.99718%2012%204.00001C14.1914%204.00001%2016.1776%204.88171%2017.6226%206.30904ZM6.29948%206.38699C4.82353%207.88204%203.99718%209.89914%204.00001%2012C4.00001%2014.1921%204.88171%2016.1776%206.30904%2017.6226C8.89604%2014.3384%208.89236%209.66817%206.29948%206.38699Z'%20fill='url(%23paint0_linear_1_9580)'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9580'%20x1='5.8384'%20y1='6.57376'%20x2='17.9719'%20y2='18.3395'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%239514ED'/%3e%3cstop%20offset='1'%20stop-color='%23CB4EEB'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1_9580'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",hqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9420)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cmask%20id='mask0_1_9420'%20style='mask-type:alpha'%20maskUnits='userSpaceOnUse'%20x='7'%20y='5'%20width='12'%20height='14'%3e%3cpath%20d='M9.85861%2018.4352V12.8682L15.2677%2018.4352H18.2771V18.2903L12.0551%2011.9499L17.7982%205.9348V5.86377H14.7694L9.85861%2011.1793V5.86377H7.41992V18.4352H9.85861Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1_9420)'%3e%3cpath%20d='M18.5454%200H5.45454C2.44209%200%200%202.44209%200%205.45454V18.5454C0%2021.5579%202.44209%2024%205.45454%2024H18.5454C21.5579%2024%2024%2021.5579%2024%2018.5454V5.45454C24%202.44209%2021.5579%200%2018.5454%200Z'%20fill='url(%23paint0_linear_1_9420)'/%3e%3cpath%20d='M18.5454%200H5.45454C2.44209%200%200%202.44209%200%205.45454V18.5454C0%2021.5579%202.44209%2024%205.45454%2024H18.5454C21.5579%2024%2024%2021.5579%2024%2018.5454V5.45454C24%202.44209%2021.5579%200%2018.5454%200Z'%20fill='url(%23paint1_radial_1_9420)'/%3e%3cpath%20d='M18.5454%200H5.45454C2.44209%200%200%202.44209%200%205.45454V18.5454C0%2021.5579%202.44209%2024%205.45454%2024H18.5454C21.5579%2024%2024%2021.5579%2024%2018.5454V5.45454C24%202.44209%2021.5579%200%2018.5454%200Z'%20fill='url(%23paint2_radial_1_9420)'/%3e%3cpath%20d='M18.5454%200H5.45454C2.44209%200%200%202.44209%200%205.45454V18.5454C0%2021.5579%202.44209%2024%205.45454%2024H18.5454C21.5579%2024%2024%2021.5579%2024%2018.5454V5.45454C24%202.44209%2021.5579%200%2018.5454%200Z'%20fill='url(%23paint3_radial_1_9420)'/%3e%3c/g%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9420'%20x1='12'%20y1='0'%20x2='12'%20y2='24'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231FD1FF'/%3e%3cstop%20offset='1'%20stop-color='%231BB8FF'/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint1_radial_1_9420'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(1.14642%2023.0906)%20rotate(-45.1556)%20scale(38.4884%2039.0642)'%3e%3cstop%20stop-color='%23232DE3'/%3e%3cstop%20offset='1'%20stop-color='%23232DE3'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint2_radial_1_9420'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(22.7074%2023.863)%20rotate(-138.45)%20scale(24.065%2036.6923)'%3e%3cstop%20stop-color='%238B4DFF'/%3e%3cstop%20offset='1'%20stop-color='%238B4DFF'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint3_radial_1_9420'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(11.8001%200.177999)%20rotate(90)%20scale(18.922%2045.9099)'%3e%3cstop%20stop-color='%2324D5FF'/%3e%3cstop%20offset='1'%20stop-color='%231BB8FF'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cclipPath%20id='clip0_1_9420'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",fqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9417)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M18.6161%2014.0406C18.6161%2016.4002%2015.7356%2017.3591%2012.1565%2017.3591C8.5775%2017.3591%205.65539%2016.4002%205.65539%2014.0406C5.65539%2011.681%208.55863%209.77068%2012.1339%209.77068C15.7129%209.77068%2018.6161%2011.6848%2018.6161%2014.0406Z'%20fill='%234BAF74'/%3e%3cpath%20d='M17.9555%208.8948C17.9555%207.65271%2016.9399%206.64091%2015.6903%206.64091C14.9843%206.64091%2014.3576%206.96182%2013.9423%207.46394C13.376%207.33935%2012.772%207.26762%2012.149%207.26762C11.5223%207.26762%2010.922%207.33558%2010.3557%207.46394C9.93667%206.96182%209.30619%206.64091%208.60775%206.64091C7.35811%206.64091%206.34254%207.64893%206.34254%208.8948C6.34254%209.3
72750253%206.45203%209.68384%206.6408%2010.0123C6.45958%2010.3974%206.3652%2010.8051%206.3652%2011.2317C6.3652%2013.4214%208.95886%2015.1958%2012.1528%2015.1958C15.3467%2015.1958%2017.9404%2013.4214%2017.9404%2011.2317C17.9404%2010.8051%2017.8422%2010.3974%2017.6648%2010.0123C17.846%209.68384%2017.9555%209.30253%2017.9555%208.8948Z'%20fill='%2332DA6D'/%3e%3cpath%20d='M8.42271%2010.1445C9.18533%2010.1445%209.80826%209.52907%209.80826%208.76646C9.80826%208.00761%209.18911%207.38845%208.42271%207.38845C7.66009%207.38845%207.03716%208.00384%207.03716%208.76646C7.04093%209.52907%207.66009%2010.1445%208.42271%2010.1445Z'%20fill='%23F1F1E8'/%3e%3cpath%20d='M15.8073%2010.1445C16.5699%2010.1445%2017.1929%209.52907%2017.1929%208.76646C17.1929%208.00761%2016.5737%207.38845%2015.8073%207.38845C15.0409%207.38845%2014.4218%208.00384%2014.4218%208.76646C14.4218%209.52907%2015.0409%2010.1445%2015.8073%2010.1445Z'%20fill='%23F1F1E8'/%3e%3cpath%20d='M7.68651%2017.1968C7.98476%2017.1968%208.21884%2016.94%208.18486%2016.6456C8.06405%2015.6111%207.54682%2013.3723%205.27784%2012.0245C2.25757%2010.2312%204.64736%2016.4039%204.64736%2016.4039L4.02065%2016.7626C3.80923%2016.8834%203.89984%2017.1968%204.13769%2017.1968H7.68651Z'%20fill='%2332DA6D'/%3e%3cpath%20d='M16.6983%2017.1968C16.4302%2017.1968%2016.2188%2016.94%2016.249%2016.6456C16.3547%2015.6149%2016.8229%2013.3723%2018.8691%2012.0245C21.5987%2010.2312%2019.4392%2016.4039%2019.4392%2016.4039L20.0055%2016.7626C20.1943%2016.8834%2020.115%2017.1968%2019.8998%2017.1968H16.6983Z'%20fill='%2332DA6D'/%3e%3cpath%20d='M8.42277%209.01939C8.56245%209.01939%208.67571%208.90613%208.67571%208.77022C8.67571%208.63053%208.56245%208.52105%208.42277%208.52105C8.28308%208.52105%208.16982%208.63431%208.16982%208.77022C8.17359%208.90613%208.28685%209.01939%208.42277%209.01939Z'%20fill='%230D0D0D'/%3e%3cpath%20d='M15.8072%209.01939C15.9469%209.01939%2016.0602%208.90613%2016.0602%208.77022C16.0602%208.63053%2015.9469%208.52105%2015.8072%208.52105C15.6675%208.52105%2015.5543%208.63431%2015.5543%208.77022C15.5543%208.90613%2015.6675%209.01939%2015.8072%209.01939Z'%20fill='%230D0D0D'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9417'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",pqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9548)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M13.5195%209.97464C14.7646%209.78183%2016.5653%208.47067%2016.5653%207.44876C16.5653%207.14026%2016.3162%206.92816%2015.9523%206.92816C15.2627%206.92816%2014.0942%207.96936%2013.5195%209.97464ZM7.75365%2015.0457C6.12543%2015.0457%205.99134%2016.6653%207.61956%2016.6653C8.34748%2016.6653%209.22865%2016.3761%209.68839%2015.8555C9.01794%2015.2771%208.46242%2015.0457%207.75365%2015.0457ZM18.1169%2014.3515C18.2126%2017.0702%2016.8334%2018.5935%2014.4965%2018.5935C13.1172%2018.5935%2012.4276%2018.0729%2010.9527%2017.1088C10.1864%2017.9572%208.7306%2018.5935%207.52378%2018.5935C3.36701%2018.5935%203.53941%2013.2911%207.77281%2013.2911C8.65398%2013.2911%209.40105%2013.5224%2010.3588%2014.1202L10.991%2011.9028C8.38579%2011.1894%207.0832%209.1841%208.36664%206.31114H10.4354C9.28612%208.22002%2010.0715%209.8011%2011.5273%209.97464C12.3127%207.17882%2013.9984%205%2016.2396%205C17.5039%205%2018.5%205.82912%2018.5%207.33307C18.5%209.74326%2015.3585%2011.71%2012.9831%2011.9028L12.0062%2015.3542C13.1172%2016.646%2016.2013%2017.8993%2016.2013%2014.3515H18.1169Z'%20fill='%23F5F1ED'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9548'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",mqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9514)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M5%2014.6348V18.0956H10.264V1
72757.3284H5.7672V14.6348H5ZM18.2328%2014.6348V17.3284H13.736V18.0956H19V14.6348H18.2328ZM10.2752%2014.6348H13.736V13.9404H11.0424V9.3652H10.2752V14.6348ZM5%205.91V9.3708H5.7672V6.6772H10.264V5.91H5ZM13.736%205.91V6.6772H18.2328V9.3708H19V5.91H13.736Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9514'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",gqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9631)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.6266%2011.6986C11.4101%2010.5009%208.71329%208.94768%206.68356%207.68167C6.08469%207.25024%206.38864%206.33453%207.11244%206.33453H17.1555C17.7157%206.33453%2018.0904%206.95917%2017.8098%207.43183C17.1348%208.59738%2016.1497%2010.0772%2015.3266%2011.2504C14.8848%2011.8802%2014.1649%2011.9884%2013.6266%2011.6986ZM10.394%2012.0876C12.5371%2013.2299%2015.5405%2014.9673%2017.6745%2016.2809C18.3339%2016.6879%2018.0712%2017.6642%2017.3011%2017.6642C16.0407%2017.6642%2013.9928%2017.6645%2011.9556%2017.6648C9.93935%2017.6651%207.93354%2017.6655%206.7119%2017.6655C6.09629%2017.6655%205.78075%2017.0267%206.04219%2016.581C6.92569%2015.0755%207.91866%2013.5558%208.74421%2012.4211C9.11126%2011.915%209.85824%2011.8016%2010.394%2012.0876Z'%20fill='%232461ED'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9631'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",yqe="/assets/Math%20Wallet-BKJo9-Jl.svg",bqe="/assets/MetaMask-Bg8aeI_0.svg",wqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9455)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M14.0891%209.59583H9.9264C9.7497%209.59583%209.60484%209.74068%209.60484%209.91738V14.0801C9.60484%2014.2568%209.7497%2014.4016%209.9264%2014.4016H14.0891C14.2658%2014.4016%2014.4107%2014.2568%2014.4107%2014.0801V9.91738C14.4107%209.74068%2014.2658%209.59583%2014.0891%209.59583Z'%20fill='white'/%3e%3cpath%20d='M9.28432%204.80644H5.1216C4.9449%204.80644%204.80005%204.9513%204.80005%205.128V9.29071C4.80005%209.46741%204.9449%209.61226%205.1216%209.61226H9.28432C9.46102%209.61226%209.60587%209.46741%209.60587%209.29071V5.128C9.60484%204.9513%209.46102%204.80644%209.28432%204.80644Z'%20fill='white'/%3e%3cpath%20d='M18.8785%204.80644H14.7158C14.5391%204.80644%2014.3942%204.9513%2014.3942%205.128V9.29071C14.3942%209.46741%2014.5391%209.61226%2014.7158%209.61226H18.8785C19.0552%209.61226%2019.2%209.46741%2019.2%209.29071V5.128C19.2%204.9513%2019.0552%204.80644%2018.8785%204.80644Z'%20fill='white'/%3e%3cpath%20d='M9.28432%2014.3852H5.1216C4.9449%2014.3852%204.80005%2014.5301%204.80005%2014.7068V18.8695C4.80005%2019.0462%204.9449%2019.191%205.1216%2019.191H9.28432C9.46102%2019.191%209.60587%2019.0462%209.60587%2018.8695V14.7068C9.60484%2014.5301%209.46102%2014.3852%209.28432%2014.3852Z'%20fill='white'/%3e%3cpath%20d='M18.8785%2014.3852H14.7158C14.5391%2014.3852%2014.3942%2014.5301%2014.3942%2014.7068V18.8695C14.3942%2019.0462%2014.5391%2019.191%2014.7158%2019.191H18.8785C19.0552%2019.191%2019.2%2019.0462%2019.2%2018.8695V14.7068C19.2%2014.5301%2019.0552%2014.3852%2018.8785%2014.3852Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M12%2
727500.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9455'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",vqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9448)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M5.39843%2019.19C7.58057%2019.19%209.22047%2017.2922%2010.1991%2015.7926C10.0801%2016.1244%2010.014%2016.4561%2010.014%2016.7747C10.014%2017.6506%2010.5165%2018.2744%2011.5084%2018.2744C12.8706%2018.2744%2014.3253%2017.0799%2015.0792%2015.7926C15.0263%2015.9784%2014.9998%2016.1509%2014.9998%2016.3102C14.9998%2016.9207%2015.3437%2017.3055%2016.0446%2017.3055C18.2532%2017.3055%2020.475%2013.3905%2020.475%209.96653C20.475%207.29901%2019.126%204.95%2015.7404%204.95C9.78912%204.95%203.375%2012.2227%203.375%2016.9207C3.375%2018.7654%204.36688%2019.19%205.39843%2019.19ZM13.6905%209.67456C13.6905%209.011%2014.0608%208.5465%2014.6031%208.5465C15.1321%208.5465%2015.5024%209.011%2015.5024%209.67456C15.5024%2010.3381%2015.1321%2010.8159%2014.6031%2010.8159C14.0608%2010.8159%2013.6905%2010.3381%2013.6905%209.67456ZM16.5207%209.67456C16.5207%209.011%2016.891%208.5465%2017.4332%208.5465C17.9622%208.5465%2018.3325%209.011%2018.3325%209.67456C18.3325%2010.3381%2017.9622%2010.8159%2017.4332%2010.8159C16.891%2010.8159%2016.5207%2010.3381%2016.5207%209.67456Z'%20fill='%23AB9FF2'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9448'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Cqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9618)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M20.9089%2012.9151C21.6124%2011.3371%2018.1142%206.90742%2014.7682%205.08231C12.6579%203.65644%2010.4716%203.84655%2010.0153%204.47393C9.04569%205.84277%2013.2473%207.02149%2016.061%208.37132C15.4526%208.63748%2014.8823%209.11277%2014.5591%209.70213C13.5134%208.56143%2011.213%207.57283%208.51337%208.37132C6.68825%208.90364%205.18633%2010.1774%204.59697%2012.0786C4.46389%2012.0215%204.29279%2011.9835%204.1407%2011.9835C3.51331%2011.9835%203%2012.4968%203%2013.1242C3%2013.7516%203.51331%2014.2649%204.1407%2014.2649C4.25477%2014.2649%204.61599%2014.1889%204.61599%2014.1889L10.4716%2014.2269C8.13314%2017.9532%206.27%2018.4855%206.27%2019.1319C6.27%2019.7783%208.03808%2019.6072%208.70348%2019.36C11.8974%2018.2193%2015.3195%2014.6261%2015.9089%2013.5995C18.3804%2013.9227%2020.4527%2013.9417%2020.9089%2012.9151Z'%20fill='url(%23paint0_linear_1_9618)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M16.0799%208.37171C16.213%208.31468%2016.194%208.12456%2016.1559%207.97247C16.0799%207.63026%2014.654%206.2234%2013.3232%205.59601C11.4981%204.74049%2010.1673%204.77852%209.97
7275717%205.17776C10.3384%205.93822%2012.0685%206.64165%2013.8555%207.40212C14.597%207.7063%2015.3765%208.0295%2016.0799%208.37171Z'%20fill='url(%23paint1_linear_1_9618)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M13.7606%2016.0144C13.3994%2015.8813%2012.9811%2015.7482%2012.5058%2015.6342C13.0001%2014.7406%2013.1142%2013.3908%2012.6389%2012.5543C11.9735%2011.3756%2011.137%2010.7482%209.17881%2010.7482C8.11416%2010.7482%205.22439%2011.1094%205.16736%2013.5239C5.16736%2013.771%205.16736%2013.9992%205.18637%2014.2273H10.4716C9.76817%2015.349%209.10276%2016.1855%208.5134%2016.8129C9.21683%2016.984%209.78718%2017.1361%2010.3195%2017.2882C10.8138%2017.4212%2011.2891%2017.5353%2011.7644%2017.6684C12.4868%2017.1361%2013.1712%2016.5657%2013.7606%2016.0144Z'%20fill='url(%23paint2_linear_1_9618)'/%3e%3cpath%20d='M4.52095%2013.9421C4.73008%2015.7672%205.77571%2016.4897%207.90501%2016.6988C10.0343%2016.9079%2011.2511%2016.7748%2012.867%2016.9079C14.2169%2017.022%2015.4336%2017.7254%2015.8709%2017.4783C16.2701%2017.2691%2016.042%2016.4897%2015.5097%2015.9954C14.8062%2015.349%2013.8366%2014.9117%2012.1446%2014.7406C12.4868%2013.809%2012.3918%2012.4972%2011.8594%2011.7938C11.099%2010.7672%209.69211%2010.3109%207.90501%2010.501C6.04188%2010.7292%204.25479%2011.6607%204.52095%2013.9421Z'%20fill='url(%23paint3_linear_1_9618)'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9618'%20x1='8.31996'%20y1='11.4428'%20x2='20.7814'%20y2='14.9766'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%238797FF'/%3e%3cstop%20offset='1'%20stop-color='%23AAA8FF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1_9618'%20x1='18.2202'%20y1='11.7222'%20x2='9.22878'%20y2='2.70874'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%233B22A0'/%3e%3cstop%20offset='1'%20stop-color='%235156D8'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_1_9618'%20x1='14.0087'%20y1='16.3402'%20x2='5.37141'%20y2='11.3743'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%233B1E8F'/%3e%3cstop%20offset='1'%20stop-color='%236A6FFB'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_1_9618'%20x1='7.71802'%20y1='12.4681'%20x2='13.5562'%20y2='19.8861'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%238898FF'/%3e%3cstop%20offset='0.9839'%20stop-color='%235F47F1'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1_9618'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",xqe="/assets/Rainbow-Cv_avBAx.svg",Eqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9574)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M11.1375%205C10.7115%205%2010.3028%205.16927%2010.0015%205.47056L5.26888%2010.2033C5.08962%2010.3826%205%2010.6175%205%2010.8524C5%2011.0874%205.08963%2011.3223%205.26888%2011.5016L8.37033%2014.603V9.11233C8.37033%208.70257%208.69991%208.37039%209.10968%208.37039C10.8408%208.37039%2015.0547%208.37039%2015.6295%208.37039L18.9998%205.00005L11.1375%205Z'%20fill='white'/%3e%3cpath%20d='M8.37048%2015.6296H14.8877C15.2975%2015.6296%2015.6297%2015.2974%2015.6297%2014.8877V9.39693L18.7311%2012.4984C18.9104%2012.6777%2019%2012.9126%2019%2013.1476C19%2013.3825%2018.9104%2013.6174%2018.7311%2013.7967L13.9985%2018.5294C13.6972%2018.8307%2013.2885%2019%2012.8625%2019L5.00015%2018.9999L8.37048%2015.6296Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9574'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",_qe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_510_206805)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M18.9033%205.46471C18.9033%205.20654%2018.6976%205%2018.4405%205C18.1834%205%2018.3376%205%2018.2862%205.02582H18.2605L14.2754%206.70395H9.77609L5.73956%205.02582C5.68814%205.02582%205.63672%205%205.55959%205C5.30249%205%205.0968%205.20654%205.0968%205.46471C5.0968%205.72289%205.0968%205.49053%205.0968%205.51635C5.0968%205.54217%206.02238%2011.1962%206.02238%2011.1962L5.12251%2014.2685C5.12251%2014.3459%205.12251%2014.3718%205.12251%2014.4234C5.12251%2014.6041%205.22535%2014.759%205.35391%2014.8365L8.28489%2016.3339C9.46757%2017.0568%209.95605%2017.8829%2010.8559%2018.9415L11.6272%2019.8193V19.8709C11.7558%2019.9483%2011.8586%2020%2011.9872%2020C12.1157%2020%2012.2443%2019.9483%2012.3214%2019.8451L13.0927%2018.9415C13.9926%2017.8829%2014.4811%2017.0568%2015.6638%2016.3339L18.5947%2014.8365C18.749%2014.759%2018.8262%2014.6041%2018.8262%2014.4234C18.8262%2014.2427%2018.8262%2014.3459%2018.8262%2014.2943L17.9263%2011.222L18.8518%205.54217C18.8518%205.54217%2018.8518%205.51635%2018.8518%205.49053L18.9033%205.46471ZM17.5406%206.62652L17.0264%209.80206L15.3295%207.58173L17.5663%206.65234L17.5406%206.62652ZM9.90463%207.89158H14.0697L16.1523%2010.6282H7.8221L9.90463%207.89158ZM12.0129%2015.1463L8.13063%2011.8158H15.8952L12.0129%2015.1463ZM8.69625%207.55595L6.99937%209.77623L6.48516%206.60069L8.72196%207.53013L8.69625%207.55595ZM6.45945%2013.9587L6.94795%2012.4871L10.2646%2015.4561L6.45945%2013.9587ZM12.0129%2018.1411L10.5474%2016.3856L12.0129%2016.5921L13.4784%2016.3856L12.0129%2018.1411ZM13.735
72755%2015.4561L17.0521%2012.4871L17.5406%2013.9587L13.7355%2015.4561Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_510_206805'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Sqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9584)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M13.4677%202.45419L6%209.92188L9.99988%2014.0776L13.9998%209.92188V2.67458C13.9998%202.3969%2013.664%202.25784%2013.4677%202.45419Z'%20fill='url(%23paint0_linear_1_9584)'/%3e%3cpath%20d='M10.5311%2021.5458L17.9988%2014.0781L13.9989%209.92242L9.99902%2014.0781L9.99902%2021.3254C9.99902%2021.6031%2010.3347%2021.7422%2010.5311%2021.5458Z'%20fill='url(%23paint1_linear_1_9584)'/%3e%3cpath%20d='M6%209.92242H8.96095C9.53473%209.92242%209.99988%2010.3876%209.99988%2010.9614V14.0781H7.03893C6.46514%2014.0781%206%2013.613%206%2013.0392V9.92242Z'%20fill='%238C8CFF'/%3e%3cpath%20d='M14.0005%209.92242H16.9614C17.5352%209.92242%2018.0004%2010.3876%2018.0004%2010.9614V14.0781H15.0394C14.4656%2014.0781%2014.0005%2013.613%2014.0005%2013.0392V9.92242Z'%20fill='%238C8CFF'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9584'%20x1='13.8178'%20y1='2.12981'%20x2='7.844'%20y2='11.7399'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23777EFF'/%3e%3cstop%20offset='1'%20stop-color='%23C5C8FF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1_9584'%20x1='17.9726'%20y1='9.9223'%20x2='10.1806'%20y2='21.87'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%236E66FA'/%3e%3cstop%20offset='1'%20stop-color='%233828DF'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1_9584'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Aqe="/assets/Solflare-BFQTRW7s.svg",Tqe="/assets/Talisman-v2gReeIx.svg",kqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9592)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cmask%20id='mask0_1_9592'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='3'%20y='6'%20width='18'%20height='12'%3e%3cpath%20d='M21%206.14999H3V17.7637H21V6.14999Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_1_9592)'%3e%3cpath%20d='M8.90039%2010.1441H8.90367C8.90039%2010.1246%208.90039%2010.102%208.90039%2010.0826V10.1441Z'%20fill='%2329AEFF'/%3e%3cpath%20d='M15.3455%2010.7591H11.7786V17.1972C11.7786%2017.5015%2012.0246%2017.7475%2012.3288%2017.7475H14.7953C15.0995%2017.7475%2015.3455%2017.5015%2015.3455%2017.1972V10.7591Z'%20fill='%232980FE'/%3e%3cpath%20d='M10.0563%206.14999H9.9365H3.55022C3.24599%206.14999%203%206.39599%203%206.7003V8.93367C3%209.23798%203.24599%209.48397%203.55022%209.48397H5.04889H5.64448V10.1443V17.2135C5.64448%2017.5177%205.89047%2017.7637%206.19478%2017.7637H8.53823C8.84246%2017.7637%209.08845%2017.5177%209.08845%2017.2135V10.1443V10.0828V9.48397H9.68403H9.92683H10.0466C10.9658%209.48397%2011.7135%208.73623%2011.7135%207.81698C11.7232%206.89773%2010.9755%206.14999%2010.0563%206.14999Z'%20fill='%232980FE'/%3e%3cpath%20d='M15.3484%2010.7591V15.2519C15.4714%2015.281%2015.5977%2015.3036%2015.7272%2015.3231C15.9084%2015.349%2016.0961%2015.3651%2016.2839%2015.3684C16.2936%2015.3684%2016.3033%2015.3684%2016.3163%2015.3684V11.7949C15.7757%2011.7593%2015.3484%2011.3094%2015.3484%2010.7591Z'%20fill='url(%23paint0_linear_1_9592)'/%3e%3cpath%20d='M16.3878%206.14999C13.8436%206.14999%2011.7786%208.21513%2011.7786%2010.7593C11.7786%2012.9474%2013.3031%2014.7794%2015.3488%2015.252V10.7593C15.3488%2010.1863%2015.8148%209.7202%2016.3878%209.7202C16.9607%209.7202%2017.4268%2010.1863%2017.4268%2010.7593C17.4268%2011.2415%2017.0998%2011.6461%2016.6532%2011.7627C16.5691%2011.7853%2016.4784%2011.7983%2016.3878%2011.7983V15.3685C16.4784%2015.3685%2016.5658%2015.3652%2016.6532%2015.362C19.0743%2015.2228%2020.997%2013.216%2020.997%2010.7593C21.0003%208.21513%2018.9351%206.14999%2016.3878%206.14999Z'%20fill='%232980FE'/%3e%3cpath%20d='M16.3877%2015.3684V11.7981C16.3618%2011.7981%2016.3392%2011.7981%2016.3132%2011.7949V15.3684C16.3392%2015.3684%2016.3651%2015.3684%2016.3877%2015.3684Z'%20fill='%232980FE'/%3e%3c/g%3e%3c/g%3e%3cpath%20d='M12%2
727500.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9592'%20x1='16.3889'%20y1='13.0644'%20x2='15.3489'%20y2='13.0644'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%232980FE'/%3e%3cstop%20offset='0.9667'%20stop-color='%236CA8FF'/%3e%3cstop%20offset='1'%20stop-color='%232980FE'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1_9592'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Nqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9487)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M4.79004%206.58474L12.0049%204.25V20.4127C6.85136%2018.2575%204.79004%2014.127%204.79004%2011.7928V6.58474Z'%20fill='%230500FF'/%3e%3cpath%20d='M19.2202%206.58474L12.0054%204.25V20.4127C17.1589%2018.2575%2019.2202%2014.127%2019.2202%2011.7928V6.58474Z'%20fill='url(%23paint0_linear_1_9487)'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9487'%20x1='17.3038'%20y1='3.11818'%20x2='11.8973'%20y2='20.2056'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.02'%20stop-color='%230000FF'/%3e%3cstop%20offset='0.08'%20stop-color='%230094FF'/%3e%3cstop%20offset='0.16'%20stop-color='%2348FF91'/%3e%3cstop%20offset='0.42'%20stop-color='%230094FF'/%3e%3cstop%20offset='0.68'%20stop-color='%230038FF'/%3e%3cstop%20offset='0.9'%20stop-color='%230500FF'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_1_9487'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Rqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9528)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M14.5757%205.43967L17.8591%208.69167C18.1386%208.96791%2018.2762%209.24739%2018.2718%209.52904C18.2675%209.8107%2018.1473%2010.0674%2017.9122%2010.3003C17.6663%2010.5441%2017.4009%2010.6676%2017.1171%2010.673C16.8333%2010.6773%2016.5516%2010.5408%2016.2721%2010.2646L12.914%206.93893C12.5326%206.56087%2012.1643%206.2933%2011.8101%206.13622C11.4559%205.97915%2011.0832%205.95423%2010.6932%206.06256C10.3022%206.1698%209.88295%206.44604%209.43339%206.89018C8.81376%207.5044%208.51802%208.0807%208.54836%208.61909C8.57869%209.15748%208.88634%209.71645%209.47023%2010.2938L12.8555%2013.6477C13.1382%2013.9271%2013.2769%2014.2066%2013.2725%2014.484C13.2682%2014.7624%2013.1469%2015.0191%2012.9075%2015.2563C12.6691%2015.4925%2012.4059%2015.616%2012.1199%2015.6257C11.8339%2015.6355%2011.549%2015.5001%2011.2674%2015.2206L7.98397%2011.9686C7.44991%2011.4399%207.06427%2010.9395%206.82703%2010.4672C6.58979%209.99485%206.50096%209.4608%206.56271%208.865C6.61796%208.35477%206.78153%207.8608%207.05452%207.38199C7.32642%206.90318%207.7164%206.41354%208.22229%205.91198C8.82459%205.3151%209.39981%204.85795%209.94795%204.53947C10.495%204.22099%2011.0247%204.04441%2011.536%204.00758C12.0484%203.97075%2012.5532%204.07258%2013.0526%204.31307C13.552%204.55355%2014.059%204.92837%2014.5746%205.43967H14.5757Z'%20fill='url(%23paint0_linear_1_9528)'/%3e%3cpath%20d='M9.42477%2018.5614L6.14244%2015.3094C5.86296%2015.0321%205.72538%2014.7537%205.72971%2014.472C5.73405%2014.1904%205.85429%2013.9337%206.08936%2013.7007C6.33527%2013.457%206.60067%2013.3335%206.88449%2013.3281C7.16831%2013.3238%207.44996%2013.4592%207.72944%2013.7365L11.0865%2017.0622C11.4689%2017.4402%2011.8361%2017.7078%2012.1904%2017.8649C12.5446%2018.0219%2012.9173%2018.0458%2013.3083%2017.9385C13.6994%2017.8313%2014.1186%2017.555%2014.5682%2017.1098C15.1878%2016.4956%2015.4835%2015.9193%2015.4532%2015.3809C15.4229%2014.8425%2015.1152%2014.2836%2014.5313%2013.7051L12.7277%2011.9339C12.4449%2011.6544%2012.3063%2011.375%2012.3106%2011.0976C12.315%2010.8192%2012.4363%2010.5625%2012.6757%2010.3253C12.914%2010.0891%2013.1772%209.96561%2013.4632%209.95586C13.7492%209.94611%2014.0341%2010.0815%2014.3158%2010.361L16.0165%2012.0303C16.5506%2012.559%2016.9362%2013.0594%2017.1734%2013.5318C17.4107%2014.0041%2017.4995%2014.5381%2017.4378%2015.1339C17.3825%2015.6441%2017.2189%2016.1381%2016.946%2016.
72756169C16.6741%2017.0957%2016.2841%2017.5854%2015.7782%2018.0869C15.1759%2018.6838%2014.6007%2019.141%2014.0525%2019.4594C13.5044%2019.7779%2012.9747%2019.9556%2012.4623%2019.9924C11.9499%2020.0293%2011.4451%2019.9274%2010.9457%2019.6869C10.4463%2019.4464%209.93933%2019.0716%209.42369%2018.5603L9.42477%2018.5614Z'%20fill='url(%23paint1_linear_1_9528)'/%3e%3cpath%20d='M11.4722%2010.1703C12.138%2010.1703%2012.6779%209.63054%2012.6779%208.96466C12.6779%208.29878%2012.138%207.75897%2011.4722%207.75897C10.8063%207.75897%2010.2665%208.29878%2010.2665%208.96466C10.2665%209.63054%2010.8063%2010.1703%2011.4722%2010.1703Z'%20fill='url(%23paint2_radial_1_9528)'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_1_9528'%20x1='17.3191'%20y1='7.33431'%20x2='7.14367'%20y2='11.8563'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23201C1B'/%3e%3cstop%20offset='0.36'%20stop-color='%2377390D'/%3e%3cstop%20offset='0.67'%20stop-color='%23EA8101'/%3e%3cstop%20offset='1'%20stop-color='%23F4B852'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_1_9528'%20x1='6.96262'%20y1='16.8008'%20x2='18.7541'%20y2='13.2914'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231F1D1C'/%3e%3cstop%20offset='0.37'%20stop-color='%2377390D'/%3e%3cstop%20offset='0.67'%20stop-color='%23EA8101'/%3e%3cstop%20offset='1'%20stop-color='%23F4FB52'/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint2_radial_1_9528'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(11.4722%208.96574)%20scale(1.20569)'%3e%3cstop%20stop-color='%23F4B852'/%3e%3cstop%20offset='0.33'%20stop-color='%23EA8101'/%3e%3cstop%20offset='0.64'%20stop-color='%2377390D'/%3e%3cstop%20offset='1'%20stop-color='%23211C1D'/%3e%3c/radialGradient%3e%3cclipPath%20id='clip0_1_9528'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Pqe="/assets/Uniswap-BfT3OVvd.svg",Iqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_320_181087)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M5.04488%2016.4022L3.94995%2015.3073L4.03259%2015.2523L9.91354%2011.2994L11.883%2012.4426L11.7591%2012.5114L5.04488%2016.4022Z'%20fill='url(%23paint0_linear_320_181087)'/%3e%3cpath%20d='M5.50647%2018L5.10706%2016.5056L5.16215%2016.4712L11.9521%2012.5597V14.8391L11.9108%2014.8598L5.50647%2018Z'%20fill='url(%23paint1_linear_320_181087)'/%3e%3cpath%20d='M18.4939%2018L18.4044%2017.9586L12.0414%2014.8391V12.5597L18.8933%2016.4987L18.4939%2017.9931V18Z'%20fill='url(%23paint2_linear_320_181087)'/%3e%3cpath%20d='M18.9551%2016.4022L18.9%2016.3679L12.1169%2012.4426L14.0864%2011.2994L20.05%2015.3073L18.9551%2016.4022Z'%20fill='url(%23paint3_linear_320_181087)'/%3e%3cpath%20d='M12.0482%2012.2981V4.39941L13.5357%204L14.0246%2011.1687L12.0482%2012.2981Z'%20fill='url(%23paint4_linear_320_181087)'/%3e%3cpath%20d='M11.9106%2012.2981L9.9342%2011.1687V11.1136L10.4231%204L11.9174%204.39941V12.2981H11.9106Z'%20fill='url(%23paint5_linear_320_181087)'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_320_181087'%20x1='7.91649'%20y1='4.1101'%20x2='7.91649'%20y2='17.876'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2333E6BF'/%3e%3cstop%20offset='1'%20stop-color='%230439C7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_320_181087'%20x1='8.52958'%20y1='4.11017'%20x2='8.52958'%20y2='17.876'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2333E6BF'/%3e%3cstop%20offset='1'%20stop-color='%230439C7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_320_181087'%20x1='15.4708'%20y1='4.10329'%20x2='15.4708'%20y2='17.876'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2333E6BF'/%3e%3cstop%20offset='1'%20stop-color='%230439C7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_320_181087'%20x1='16.0835'%20y1='4.1101'%20x2='16.0835'%20y2='17.876'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2333E6BF'/%3e%3cstop%20offset='1'%20stop-color='%230439C7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_320_181087'%20x1='13.033'%20y1='4.11018'%20x2='13.033'%20y2='17.876'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2333E6BF'/%3e%3cstop%20offset='1'%20stop-color='%230439C7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_320_181087'%20x1='10.9327'%20y1='4.11018'%20x2='10.9327'%20y2='17.876'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%2333E6BF'/%3e%3cstop%20offset='1'%20stop-color='%230439C7'/%3e%3c/linearGradient%3e%3cclipPath%20id='clip0_320_181087'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Dqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9492)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M7.12788%208.72587C9.81869%206.09138%2014.1813%206.09138%2016.8721%208.72587L17.196%209.04295C17.3305%209.17467%2017.3305%209.38825%2017.196%209.51997L16.0882%2010.6046C16.0209%2010.6705%2015.9118%2010.6705%2015.8446%2010.6046L15.3989%2010.1683C13.5217%208.33039%2010.4783%208.33039%208.60109%2010.1683L8.12383%2010.6355C8.05659%2010.7014%207.94752%2010.7014%207.88025%2010.6355L6.77245%209.55091C6.6379%209.41918%206.6379%209.20561%206.77245%209.07389L7.12788%208.72587ZM19.1631%2010.969L20.1491%2011.9343C20.2836%2012.0661%2020.2836%2012.2796%2020.1491%2012.4114L15.7034%2016.7641C15.5689%2016.8958%2015.3507%2016.8958%2015.2162%2016.7641L12.0609%2013.6748C12.0273%2013.6419%2011.9728%2013.6419%2011.9391%2013.6748L8.78393%2016.7641C8.64939%2016.8958%208.43125%2016.8958%208.2967%2016.7641L3.8509%2012.4113C3.71637%2012.2796%203.71637%2012.066%203.8509%2011.9343L4.83686%2010.9689C4.9714%2010.8372%205.18951%2010.8372%205.32406%2010.9689L8.47937%2014.0583C8.51302%2014.0912%208.56754%2014.0912%208.60116%2014.0583L11.7563%2010.9689C11.8909%2010.8372%2012.109%2010.8372%2012.2435%2010.9689L15.3989%2014.0583C15.4325%2014.0912%2015.487%2014.0912%2015.5207%2014.0583L18.6759%2010.969C18.8105%2010.8373%2019.0286%2010.8373%2019.1631%2010.969Z'%20fill='%233B99FC'/%3e%3c/g%3e%3cpath%20d='M12%2
727500.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9492'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Oqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9432)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M19.1806%2011.4893C19.0881%2010.2393%2018.6663%209.03479%2017.9569%207.994C17.2477%206.95339%2016.2754%206.11255%2015.1355%205.55448C13.9957%204.99655%2012.7281%204.74048%2011.4573%204.81164C10.1864%204.88281%208.9563%205.27858%207.88815%205.96031C6.82%206.64189%205.95064%207.58585%205.36561%208.69893L5.33783%208.75506C5.15303%209.1313%205.02809%209.53347%204.96762%209.94719C4.7947%2011.17%205.06285%2012.2582%205.76331%2013.0962C6.52943%2014.0124%207.77672%2014.5574%209.27288%2014.6289C11.0942%2014.7192%2012.9052%2014.2304%2014.1903%2013.3312L14.9523%2013.7776C14.2244%2014.3985%2012.5413%2015.5167%209.75391%2015.6695C6.62494%2015.8399%205.32075%2014.8385%205.30857%2014.8283L5.08915%2015.0947L4.80005%2015.4364C4.85546%2015.4823%206.10604%2016.477%209.04307%2016.477C9.28344%2016.477%209.53599%2016.477%209.79892%2016.4566C13.1726%2016.2712%2015.0281%2014.8238%2015.6773%2014.2025L16.3146%2014.5836C15.886%2015.1382%2015.3586%2015.6115%2014.7579%2015.9802C12.6406%2017.3255%209.94765%2017.4993%208.06228%2017.4056L8.02259%2018.1903C8.3392%2018.2056%208.64356%2018.2125%208.93935%2018.2125C14.2517%2018.2125%2016.4008%2015.8326%2017.0033%2014.9791L17.5013%2015.2707C17.024%2016.0709%2016.3752%2016.7619%2015.5977%2017.294C14.6666%2017.9312%2013.5832%2018.3186%2012.454%2018.4182L12.5232%2019.2C13.791%2019.0888%2015.0077%2018.6543%2016.0531%2017.9393C17.0985%2017.2244%2017.9369%2016.2536%2018.4852%2015.1226C19.0334%2013.9914%2019.2733%2012.7393%2019.1806%2011.4893ZM16.1127%2011.6102C15.7602%2011.6102%2015.4743%2011.3289%2015.4743%2010.9818C15.4743%2010.6348%2015.76%2010.3535%2016.1127%2010.3535C16.4651%2010.3535%2016.7509%2010.6348%2016.7509%2010.9818C16.7509%2011.3289%2016.4652%2011.6102%2016.1127%2011.6102Z'%20fill='%23ECECEC'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9432'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Mqe="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_1_9481)'%3e%3cpath%20d='M0%200H24V24H0V0Z'%20fill='%23FFDBDF'%20fill-opacity='0.08'/%3e%3cpath%20d='M17.5916%206.14999H15.4105C15.3626%206.14999%2015.3167%206.16901%2015.2829%206.20285L12.8691%208.61662C12.7554%208.73031%2012.8359%208.9247%2012.9967%208.9247H14.9973V10.8802C14.9973%2011.041%2015.1917%2011.1215%2015.3054%2011.0078L17.7192%208.59406C17.753%208.56022%2017.772%208.51432%2017.772%208.46645V6.33046C17.772%206.23079%2017.6912%206.14999%2017.5916%206.14999Z'%20fill='%23EE7D35'/%3e%3cpath%20d='M17.6741%2015.1657L8.71123%206.20285C8.67739%206.16901%208.63148%206.14999%208.58362%206.14999H6.40251C6.30284%206.14999%206.22205%206.23079%206.22205%206.33046V8.3311C6.22205%208.37896%206.24106%208.42487%206.2749%208.45871L9.50078%2011.6846C9.57126%2011.7551%209.57126%2011.8693%209.50078%2011.9398L6.2749%2015.1657C6.24106%2015.1995%206.22205%2015.2454%206.22205%2015.2933V17.4744C6.22205%2017.5741%206.30284%2017.6549%206.40251%201
72757.6549H9.94421C10.0439%2017.6549%2010.1247%2017.5741%2010.1247%2017.4744V16.1956C10.1247%2016.1478%2010.1437%2016.1019%2010.1775%2016.068L11.892%2014.3536C11.9625%2014.2831%2012.0767%2014.2831%2012.1472%2014.3536L15.3957%2017.602C15.4295%2017.6359%2015.4754%2017.6549%2015.5233%2017.6549H17.5465C17.6461%2017.6549%2017.7269%2017.5741%2017.7269%2017.4744V15.2933C17.7269%2015.2454%2017.7079%2015.1995%2017.6741%2015.1657Z'%20fill='white'/%3e%3c/g%3e%3cpath%20d='M12%200.5C18.3513%200.5%2023.5%205.64873%2023.5%2012C23.5%2018.3513%2018.3513%2023.5%2012%2023.5C5.64873%2023.5%200.5%2018.3513%200.5%2012C0.5%205.64873%205.64873%200.5%2012%200.5Z'%20stroke='%23FFDBDF'%20stroke-opacity='0.02'/%3e%3cdefs%3e%3cclipPath%20id='clip0_1_9481'%3e%3cpath%20d='M0%2012C0%205.37258%205.37258%200%2012%200C18.6274%200%2024%205.37258%2024%2012C24%2018.6274%2018.6274%2024%2012%2024C5.37258%2024%200%2018.6274%200%2012Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Lqe=Object.assign({"../assets/wallets/Ambire.svg":ZWe,"../assets/wallets/Argent.svg":QWe,"../assets/wallets/Backpack.svg":XWe,"../assets/wallets/Bitget.svg":JWe,"../assets/wallets/Blockchain.com.svg":eqe,"../assets/wallets/Braavos.svg":tqe,"../assets/wallets/Brave.svg":nqe,"../assets/wallets/Citadel One.svg":iqe,"../assets/wallets/Coin98.svg":sqe,"../assets/wallets/Coinbase Wallet.svg":rqe,"../assets/wallets/Cosmostation.svg":oqe,"../assets/wallets/Crypto.com.svg":aqe,"../assets/wallets/Ctrl.svg":cqe,"../assets/wallets/Exodus.svg":lqe,"../assets/wallets/Family.svg":uqe,"../assets/wallets/Glow.svg":dqe,"../assets/wallets/Keplr.svg":hqe,"../assets/wallets/Leap.svg":fqe,"../assets/wallets/Leather.svg":pqe,"../assets/wallets/Ledger.svg":mqe,"../assets/wallets/Logo.svg":gqe,"../assets/wallets/Math Wallet.svg":yqe,"../assets/wallets/MetaMask.svg":bqe,"../assets/wallets/OKX.svg":wqe,"../assets/wallets/Phantom.svg":vqe,"../assets/wallets/Rabby.svg":Cqe,"../assets/wallets/Rainbow.svg":xqe,"../assets/wallets/SafePal.svg":Eqe,"../assets/wallets/ShapeShift.svg":_qe,"../assets/wallets/Slope.svg":Sqe,"../assets/wallets/Solflare.svg":Aqe,"../assets/wallets/Talisman.svg":Tqe,"../assets/wallets/TokenPocket.svg":kqe,"../assets/wallets/Trust.svg":Nqe,"../assets/wallets/UniSat.svg":Rqe,"../assets/wallets/Uniswap.svg":Pqe,"../assets/wallets/Vultisig.svg":Iqe,"../assets/wallets/WalletConnect.svg":Dqe,"../assets/wallets/XDEFI.svg":Oqe,"../assets/wallets/Xverse.svg":Mqe});function mG(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"")}function $qe(t){var n;if(!t)return null;const e=mG(t);for(const[i,s]of Object.entries(Lqe)){const r=((n=i.split("/").pop())==null?void 0:n.replace(".svg",""))||"",o=mG(r);if(o===e||(o.includes(e)||e.includes(o))&&e.length>=3&&o.length>=3)return s}return null}const Uo={metamask:{name:"MetaMask",iconUrl:"https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96"},"io.metamask":{name:"MetaMask",iconUrl:"https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96"},trust:{name:"Trust Wallet",iconUrl:"https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0"},trustwallet:{name:"Trust Wallet",iconUrl:"https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0"},coinbase:{name:"Coinbase Wallet",iconUrl:"https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/fd20dc426fb9d66cd4f1e06b6b43561c"},coinbasewallet:{name:"Coinbase Wallet",iconUrl:"https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/fd20dc426fb9d66cd4f1e06b6b43561c"},coinbaseWalletSDK:{name:"Coinbase Wallet",iconUrl:"https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/fd20dc426fb9d66cd4f1e06b6b43561c"},walletconnect:{name:"WalletConnect",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/walletconnect.svg"},safe:{name:"Safe",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/safe.svg"},gnosis:{name:"Safe",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/safe.svg"},rabby:{name:"Rabby",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/rabby.svg"},rainbow:{name:"Rainbow",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/rainbow.svg"},frame:{name:"Frame",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/frame.svg"},zerion:{name:"Zerion",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/zerion.svg"},imtoken:{name:"imToken",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/imtoken.svg"},tokenpocket:{name:"TokenPocket",iconUrl:"https://raw.githubusercontent.com/walletconnect/walletconnect-assets/master/wallet-icons/tokenpocket.svg"},keplr:{name:"Keplr",iconUrl:"https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/keplr/chain.png"},"app.keplr":{name:"Keplr",iconUrl:"https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/keplr/chain.png"},injected:{name:"Browser Wallet"}};function W5(t){return t?t.toLowerCase().trim():""}function Bre(t,e){if(!t&&!e)return null;if(t){const n=W5(t);if(Uo[n])return Uo[n];for(const[i,s]of Object.entries(Uo))if(n.includes(i)||i.includes(n))return s;if(n.includes("metamask")||n.includes("meta mask"))return Uo.metamask;if(n.includes("trust"))return Uo.trust;if(n.includes("coinbase"))return Uo.coinbase;if(n.includes("walletconnect")||n.includes("wallet connect"))return Uo.walletconnect;if(n.includes("safe")||n.includes("gnosis"))return Uo.safe;if(n.includes("rabby"))return Uo.rabby;if(n.includes("rainbow"))return Uo.rainbow;if(n.includes("keplr"))return Uo.keplr}if(e){const n=W5(e);if(Uo[n])return Uo[n];for(const[i,s]of Object.entries(Uo))if(n.includes(i)||i.includes(n))return s}return null}const gG={metamask:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",trust:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",coinbase:"fd20dc426fb9d66cd4f1e06b6b43561c",keplr:"app.keplr","app.keplr":"app.keplr"};function Uqe(){if(typeof window>"u"||!window.ethereum)return null;const t=window.ethereum;if(t.isMetaMask)return"metamask";if(t.isTrust)return"trust";if(t.isCoinbaseWallet)return"coinbase";if(t.providerName){const e=W5(t.providerName);if(e.includes("metamask"))return"metamask";if(e.includes("trust"))return"trust";if(e.includes("coinbase"))return"coinbase"}return null}function Bqe(t,e){var s;if((e==="injected"||!t)&&typeof window<"u"){const r=Uqe();if(r){const o=Uo[r];if(o!=null&&o.iconUrl)return o.iconUrl}}const n=Bre(t,e),i=[e,t,(s=n==null?void 0:n.name)==null?void 0:s.toLowerCase()].filter(
7275Boolean);for(const r of i){const o=$qe(r);if(o)return o}if(n!=null&&n.iconPath)return n.iconPath;if(n!=null&&n.iconUrl)return n.iconUrl;if(t){const r=W5(t),o=gG[r];if(o)return`https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/${o}`}if(e){const r=W5(e),o=Uo[r];if(o!=null&&o.iconUrl)return o.iconUrl;if(r.match(/^[a-f0-9]{64}$/i)&&!r.startsWith("app."))return`https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/${e}`;const a=gG[r];if(a&&!a.startsWith("app."))return`https://explorer-api.walletconnect.com/w3m/v1/getWalletImage/${a}`}return null}function Fqe(t,e){const n=Bre(t,e);return(n==null?void 0:n.name)||t||"Wallet"}const jqe=()=>m.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("path",{d:"M15.8333 5.83333H4.16667C3.24619 5.83333 2.5 6.57952 2.5 7.5V15.8333C2.5 16.7538 3.24619 17.5 4.16667 17.5H15.8333C16.7538 17.5 17.5 16.7538 17.5 15.8333V7.5C17.5 6.57952 16.7538 5.83333 15.8333 5.83333Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M2.5 8.33333H17.5M13.3333 12.5H15.8333",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M5.83333 5.83333V4.16667C5.83333 3.24619 6.57952 2.5 7.5 2.5H12.5C13.4205 2.5 14.1667 3.24619 14.1667 4.16667V5.83333",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Vqe=()=>m.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("path",{d:"M18.36 6.64C19.6184 7.89879 20.4753 9.50244 20.8223 11.2482C21.1693 12.9939 20.9969 14.8034 20.3266 16.4638C19.6564 18.1241 18.5122 19.5712 17.0137 20.63C15.5152 21.6888 13.7229 22.3153 11.8721 22.4389C10.0213 22.5626 8.18359 22.1782 6.55595 21.3347C4.92831 20.4912 3.5741 19.2209 2.64218 17.6706C1.71026 16.1203 1.23691 14.351 1.27768 12.5609C1.31846 10.7708 1.86178 9.02568 2.84443 7.51091C3.82708 5.99614 5.21232 4.76919 6.84996 3.96124",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M12 2V12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Wqe=()=>m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block"},children:[m.jsx("circle",{cx:"10",cy:"10",r:"9",stroke:"#00FFA3",strokeWidth:"1.5",fill:"none"}),m.jsx("path",{d:"M7 10L9 12L13 8",stroke:"#00FFA3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),yG=({onClick:t,customClassName:e=""})=>{const{connect:n,disconnect:i,isConnecting:s}=ZM(),{isConnected:r,address:o,connector:a}=mn();zUe();const{beraname:c}=YWe(o),l=a==null?void 0:a.name,d=a==null?void 0:a.id,h=M.useMemo(()=>Bqe(l,d),[l,d]),p=M.useMemo(()=>Fqe(l,d),[l,d]),[g,b]=M.useState(!1),[w,C]=M.useState(!1),[E,T]=M.useState(!1),[A,k]=M.useState(!1);M.useEffect(()=>{r&&h&&(k(!1),b(!1),T(!1))},[l,d,r,h]);const R=z=>{if(!z)return"";const K=z.substring(0,6),q=z.substring(z.length-4);return`${K}...${q}`},P=M.useCallback(()=>{n(),t&&t()},[n,t]),B=M.useCallback(async()=>{try{await i(),t&&t()}catch(z){console.error("Error when disconnecting:",z)}},[i,t]),F=M.useCallback(()=>{o&&(navigator.clipboard.writeText(o),T(!0),b(!1),C(!1),setTimeout(()=>{T(!1),b(!1)},2e3))},[o]);return!r||!o?m.jsx("button",{className:`btn btn--small btn__navbar-connect btn__navbar-connect--download-style ${e}`.trim(),onClick:P,disabled:s,children:"Connect"}):m.jsx("div",{style:{position:"relative"},children:m.jsxs("button",{className:`btn btn--small btn__navbar-connect btn__navbar-connect--with-wallet ${e}`.trim(),style:{display:"flex",alignItems:"center",gap:"0.75rem",padding:"0.625rem 1rem 0.625rem 0.875rem"},children:[m.jsx("div",{style:{position:"relative",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:E?"default":"pointer",marginLeft:"0",marginRight:"0"},onMouseEnter:()=>{E||b(!0)},onMouseLeave:()=>{b(!1)},onClick:z=>{E||(z.stopPropagation(),B())},children:m.jsx(Pb,{mode:"wait",children:E?m.jsx(Wo.div,{initial:{opacity:0,scale:.3,rotate:-180}
7275,animate:{opacity:1,scale:1,rotate:0},exit:{opacity:0,scale:.3,rotate:0},transition:{duration:.5,rotate:{duration:.5,ease:[.34,1.56,.64,1]},scale:{duration:.5,ease:[.34,1.56,.64,1]},opacity:{duration:.3,ease:"easeOut"}},style:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",transformOrigin:"center center"},children:m.jsx(Wo.div,{animate:{scale:[1,1.15,1]},transition:{duration:.6,ease:"easeOut",times:[0,.3,1],delay:.2},style:{transformOrigin:"center center"},children:m.jsx(Wqe,{})})},"confirmation"):g?m.jsx(Wo.div,{initial:{opacity:0,scale:0,rotate:-90},animate:{opacity:1,scale:1,rotate:0},exit:{opacity:0,scale:0,rotate:90},transition:{duration:.3,ease:[.4,0,.2,1]},style:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:m.jsx(Vqe,{})},"disconnect"):m.jsx(Wo.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:[.4,0,.2,1]},style:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",top:0,left:0},children:h&&!A?m.jsx("img",{src:h,alt:p,style:{width:"20px",height:"20px",objectFit:"contain",display:"block",flexShrink:0,pointerEvents:"none",maxWidth:"100%",maxHeight:"100%",visibility:"visible"},onError:z=>{console.error("[NavbarConnectButton] â Failed to load wallet icon:",{url:h,walletName:l,walletId:d,error:"Image load failed - will show generic icon",imgElement:z.currentTarget}),setTimeout(()=>{k(!0)},100)},onLoad:()=>{k(!1)},crossOrigin:"anonymous",loading:"eager"},`wallet-icon-${h}`):m.jsx(jqe,{})},"wallet")})}),m.jsx("div",{style:{position:"relative",flex:1,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),onClick:F,children:m.jsx("span",{style:{opacity:w?1:.75,transition:"opacity 0.2s ease",cursor:"pointer"},children:c||R(o)})})]})})},wb=({searchValue:t,setSearchValue:e,networksList:n=!1,mode:i="default",activeTab:s,autoFocus:r=!1,hideSlashIcon:o=!1})=>{const[a,c]=M.useState(i==="expanded"||i==="default"),l=M.useRef(null),d=()=>e("");M.useEffect(()=>{if(r&&l.current){const T=setTimeout(()=>{var A;(A=l.current)==null||A.focus()},100);return()=>clearTimeout(T)}},[r]),M.useEffect(()=>{const T=A=>{var k,R,P;if(A.key==="/"&&((k=document.activeElement)==null?void 0:k.tagName)!=="INPUT"&&((R=document.activeElement)==null?void 0:R.tagName)!=="TEXTAREA"&&!((P=document.activeElement)!=null&&P.hasAttribute("contenteditable"))){const B=l.current;if(!B||!(B.offsetParent!==null))return;A.preventDefault(),B.focus(),i==="compact"&&!a&&c(!0)}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[i,a]);const h=()=>{i==="compact"&&!a&&c(!0),setTimeout(()=>{var T;(T=l.current)==null||T.focus()},50)},p=(()=>{switch(s){case"Transactions":return"Search transactions";case"Pools":return"Search pools";case"Tokens":return"Search tokens";case"Vaults":return"Search vaults";default:return"Search"}})(),b=(()=>{let T="SearchBar";return i==="compact"?(T+=" SearchBar__compact",a&&(T+=" expanded")):i==="expanded"&&(T+=" expanded"),T})(),w=i==="compact"?n?"Search networks":"Search tokens":n?"Search tokens, pools, transactions":s?p:"Search",C=!(i==="compact"&&!a),E=T=>{T.preventDefault()};return m.jsxs("form",{className:b,onSubmit:E,children:[m.jsxs("div",{className:"SearchBar__Content",onClick:h,children:[m.jsx("svg",{className:"SearchBar__iconSearch",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:m.jsx("path",{d:"M13.3333 13.3333L16.6666 16.6666M15 9.16665C15 12.3883 12.3883 15 9.16665 15C5.94499 15 3.33331 12.3883 3.33331 9.16665C3.33331 5.94499 5.94499 3.33331 9.16665 3.33331C12.3883 3.33331 15 5.94499 15 9.16665Z",stroke:"currentColor",strokeWidth:"1.6"})}),m.jsx("input",{ref:l,type:"text",className:"SearchBar__input",placeholder:i==="compact"?p:w,value:t,onChange:T=>e(T.target.value),onClick:T=>T.stopPropagation(),onBlur:()=>{!t&&i==="compact"&&c(!1)}})]}),C&&m.jsxs("div",{className:"SearchBar__RightContent",children:[t===""&&!n&&i!=="compact"&&!o&&m.jsx("span",{className:"SearchBar__iconSlas
7275h",children:"/"}),t!==""&&m.jsx("span",{className:"SearchBar__icon",onClick:d,children:m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M4.66652 4.66666L11.3332 11.3333M11.3332 4.66666L4.6665 11.3333",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"square"})})})]})]})},e8=({content:t,className:e,style:n,width:i=32,height:s=32,onClick:r})=>m.jsxs("svg",{width:i,height:s,viewBox:"0 0 100 100",className:e,style:{shapeRendering:"geometricPrecision",imageRendering:"auto",...n},onClick:r,children:[m.jsx("circle",{cx:"50",cy:"50",r:"50",fill:"#1f1f1f",stroke:"rgba(255,255,255,0.12)",strokeWidth:"4"}),m.jsx("text",{x:"50",y:"50",textAnchor:"middle",dominantBaseline:"central",fill:"#ffffff",fontSize:28,fontWeight:"bold",fontFamily:"Arial, sans-serif",style:{textRendering:"optimizeLegibility"},children:t})]});function qqe(t){if(!t||typeof t!="string")return"";const e=t.trim();if(e.startsWith("/"))return e;if(e.startsWith("http://")||e.startsWith("https://"))try{return new URL(e),e}catch{return console.warn(`Invalid image URL: ${t}`),""}return e}function zqe(t){return t.includes("cloudinary.com")}const Hqe=({src:t,alt:e,fallbackContent:n,width:i=24,height:s=24,style:r,className:o,onClick:a})=>{const[c,l]=M.useState(!1),[d,h]=M.useState(!0),[p,g]=M.useState("");if(M.useEffect(()=>{if(t){const A=qqe(t);g(A),l(!1),h(!0)}else g(""),l(!0),h(!1)},[t]),!p||c)return m.jsx(e8,{content:n,width:i,height:s,style:r,className:o,onClick:a});const b=(o==null?void 0:o.includes("tokens-marquee"))||(o==null?void 0:o.includes("TokenLogo")),w={...r,opacity:d&&!b?0:1,transition:"opacity 0.2s ease-in-out"},C=()=>{console.warn(`Image failed to load: ${p}`),zqe(p)&&console.warn("This appears to be a Cloudinary URL that returned 404"),l(!0),h(!1)},E=()=>{h(!1)},T=!(o!=null&&o.includes("tokens-marquee"));return m.jsx("img",{src:p,alt:e,width:i,height:s,style:w,className:o,onClick:a,onLoad:E,onError:C,loading:T?"lazy":"eager",decoding:"async"})};function bG(t){return!t||typeof t!="string"?"":t.toLowerCase().trim().replace(/[^a-z0-9-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").substring(0,50)}const P0={bera:"/assets/components/berachain.png",berachain:"/assets/components/berachain.png",wbera:"/assets/components/wrappedberachain.png",wrappedberachain:"/assets/components/wrappedberachain.png","wrapped-bera":"/assets/components/wrappedberachain.png",honey:"/assets/components/honey.png",ibgt:"/assets/components/infraredbgt.png",infraredbgt:"/assets/components/infraredbgt.png","infrared-bgt":"/assets/components/infraredbgt.png",osbgt:"/assets/components/openstatebgt.png",openstatebgt:"/assets/components/openstatebgt.png","openstate-bgt":"/assets/components/openstatebgt.png",liquidbgt:"/assets/components/liquidbgt.png","liquid-bgt":"/assets/components/liquidbgt.png",lbgt:"/assets/components/liquidbgt.png","l-bgt":"/assets/components/liquidbgt.png",nect:"/assets/components/nectar.png",nectar:"/assets/components/nectar.png",ewbera:"/assets/components/evkvaultewbera-4.png","ewbera-4":"/assets/components/evkvaultewbera-4.png",evkvaultewbera:"/assets/components/evkvaultewbera-4.png","evkvaultewbera-4":"/assets/components/evkvaultewbera-4.png",pawbera:"/assets/components/pawbera.png","paw-bera":"/assets/components/pawbera.png",stakedwrappedberachain:"/assets/components/stakedwrappedberachain.png","staked-wrapped-berachain":"/assets/components/stakedwrappedberachain.png",swbera:"/assets/components/stakedwrappedberachain.png",stakewrappedberachain:"/assets/components/stakedwrappedberachain.png",wrappedgberachain:"/assets/components/wrappedgberachain.png",wrappedgbera:"/assets/components/wrappedgberachain.png",wgbera:"/assets/components/wrappedgberachain.png","wrapped-gbera":"/assets/components/wrappedgberachain.png",susde:"/assets/components/susde.png","s-usde":"/assets/components/susde.png",usdc:"/assets/components/usdcoin.png",usdcoin:"/assets/components/usdcoin.png","usd-coin":"/assets/components/usdcoin.png","usdc.e":"/assets/components/usdce.png",usdce:"/assets/components/usdce.png","usdc-e":"/assets/components/usdce.png","usdc e":"/assets/components/usdce.png",usdt:"/assets/components/usdtether.png",usdtether:"/assets/components/usdtether.png","usd-tether":"/assets/components/usdtether.png",usdt
72750:"/assets/components/usdt0.png",usd0:"/assets/components/usdt0.png",usde:"/assets/components/usde.png","usd-e":"/assets/components/usde.png",weth:"/assets/components/wrappedethereum.png",wrappedethereum:"/assets/components/wrappedethereum.png","wrapped-ethereum":"/assets/components/wrappedethereum.png",eth:"/assets/components/wrappedethereum.png",wbtc:"/assets/components/wrappedbitcoin.png",wrappedbitcoin:"/assets/components/wrappedbitcoin.png","wrapped-bitcoin":"/assets/components/wrappedbitcoin.png",btc:"/assets/components/wrappedbitcoin.png",bedrockbitcoin:"/assets/components/bedrockbitcoin.png","bedrock-bitcoin":"/assets/components/bedrockbitcoin.png",brbtc:"/assets/components/bedrockbitcoin.png","br-btc":"/assets/components/bedrockbitcoin.png",br:"/assets/components/bedrockbitcoin.png",universalbitcoin:"/assets/components/universalbitcoin.png","universal-bitcoin":"/assets/components/universalbitcoin.png",unibtc:"/assets/components/universalbitcoin.png","uni-btc":"/assets/components/universalbitcoin.png",qia:"/assets/components/quodinaltum.png",quodinaltum:"/assets/components/quodinaltum.png","quodin-altum":"/assets/components/quodinaltum.png",ooga:"/assets/components/ooga.png",bedrock:"/assets/components/bedrock.png",dolomite:"/assets/components/dolomite.png",holdstation:"/assets/components/holdstation.png","hold-station":"/assets/components/holdstation.png",hyperliquid:"/assets/components/hyperliquid.png","hyper-liquid":"/assets/components/hyperliquid.png",pendle:"/assets/components/pendle.png",pollen:"/assets/components/pollen.jpg",smilee:"/assets/components/smilee.png",ir:"/assets/components/infrared.png",infrared:"/assets/components/infrared.png",infraredberachain:"/assets/components/infraredberachain.png","infrared-berachain":"/assets/components/infraredberachain.png",ibera:"/assets/components/infraredberachain.png"},Rk={"0x0435c32c79e8341e44047493ba371b502b8c90af":"/assets/components/0x0435c32c79e8341e44047493ba371b502b8c90af.png","0xa5b3ecafbfcc7946c11a28252c6f2bdb73d30388":"/assets/components/0xa5b3ecafbfcc7946c11a28252c6f2bdb73d30388.png","0xd352dc6e5f0c45e2f2b38eb5565eb286a1ea4087":"/assets/components/bedrock.png","0xcaa70d2aa873ef057980844e18d9a9560bdffcc0":"/assets/components/evkvaultewbera-4.png","0x656b95e550c07a9ffe548bd4085c72418ceb1dba":"/assets/components/beragovernancetoken.png","0xa1b644aec990ad6023811ced36e6a2d6d128c7c9":"/assets/components/infrared.png"};function wG(t,e){if(t&&typeof t=="string"){let n=t.toLowerCase().trim();if(n=n.replace(/\s+/g,""),P0[n])return P0[n];const i=[n,n.replace(/\./g,"-"),n.replace(/-/g,"."),n.replace(/\./g,""),n.replace(/-/g,""),n.replace(/[^a-z0-9]/g,"")],s=[...new Set(i)];for(const r of s)if(P0[r])return P0[r]}if(e&&typeof e=="string"){let n=e.toLowerCase().trim();if(n=n.replace(/\s+/g,""),P0[n])return P0[n];const i=[n,n.replace(/\./g,"-"),n.replace(/-/g,"."),n.replace(/\./g,""),n.replace(/-/g,""),n.replace(/[^a-z0-9]/g,"")],s=[...new Set(i)];for(const r of s)if(P0[r])return P0[r]}return null}function xr(t,e,n,i){if(n){const a=n.toLowerCase();if(Rk[a])return Rk[a]}const s=wG(t,e);if(s)return s;if(i)if(i.startsWith("/assets/components/")){if(n){const c=n.toLowerCase();if(Rk[c]===i)return i}if(wG(t,e)===i)return i}else return i;if(t&&typeof t=="string"){const a=t.toLowerCase().trim();if(a!=="unknown")return`https://images.oogabooga.io/${a}.png`}const r=t&&typeof t=="string"?bG(t):"",o=e?bG(e):"";return r?`/assets/components/${r}.png`:o?`/assets/components/${o}.png`:n?`/assets/components/${n.toLowerCase()}.png`:"/assets/components/iconbear.png"}const Gqe={small:20,medium:24,large:28,xlarge:40},ws=({logoUri:t,symbol:e,name:n,id:i,size:s="medium",className:r="",style:o,onClick:a,noBorder:c=!1,skipProcessing:l=!1})=>{const d=typeof s=="number"?s:Gqe[s],h=0,p=l?t||xr(e,n,i,null):xr(e,n,i,t),g=typeof e=="string"?e:e!=null?String(e):"",b=g.toUpperCase().includes("STICKY")||g.toUpperCase().startsWith("AW-")||g.toUpperCase().includes("AW-STICKY")||p&&(p.toLowerCase().includes("sticky")||p.toLowerCase().includes("vault")),w=!c&&!b,C=`TokenLogo TokenLogo--${typeof s=="string"?s:"custom"} ${b?"TokenLogo--no-border":""} ${r}`.trim(),E={width:d,height:d,borderRadius:"50%",...w&&{border:`${h}px solid rgb(255, 193, 100)`,boxSizing:"border-box"},...o};return p?m.jsx(Hqe,{src:p,alt:g,fallbackContent:g.charAt(0).toUpperCase()||"?",width:d,height:d,className:`${C} ${r||""}`.trim(),style:E,onClick:a}):m.jsx(e8,{content:g.charAt(0).toUpperCase()||"?",width:d,height:d,className:C,style:E,onClick:a})},Fre="0x0000000000000000000000000000000000000000",wE="0x6969696969696969696969696969696969696969",Kqe={[Fre]:{displaySymbol:"BERA",dis
7275playName:"Bera",statsTokenAddress:wE,isNative:!0,logoUri:"https://res.cloudinary.com/duv0g402y/raw/upload/v1717773645/src/assets/bera.png"},[wE]:{displaySymbol:"WBERA",displayName:"Wrapped Bera",statsTokenAddress:wE,isNative:!1,logoUri:"https://res.cloudinary.com/duv0g402y/raw/upload/v1717773645/src/assets/wbera.png"}};function RI(t){const e=Kqe[t];return(e==null?void 0:e.statsTokenAddress)||t}function Yqe(t){return t.toLowerCase()===wE.toLowerCase()?{address:Fre,originalAddress:t,symbol:"BERA",name:"Bera",logoUri:"https://res.cloudinary.com/duv0g402y/raw/upload/v1717773645/src/assets/bera.png"}:{address:t,originalAddress:t,symbol:null,name:null,logoUri:null}}const If=({token0:t,token1:e,size:n=40,gap:i=6,borderWidth:s,separatorWidth:r})=>{const[o,a]=M.useState({token0:!1,token1:!1}),c=T=>{const A=!T.address&&T.id.startsWith("0x")?T.id:T.address,k=Yqe(A),R=(k==null?void 0:k.logoUri)||T.logoUri;return{logoUri:xr((k==null?void 0:k.symbol)||T.symbol,T.name||void 0,A,R||void 0),symbol:(k==null?void 0:k.symbol)||T.symbol}},l=c(t),d=c(e),h=typeof s=="number"?s:3,p=typeof r=="number"?r:3,g={position:"relative",display:"inline-block",width:`${n}px`,height:`${n}px`,borderRadius:"1000px",border:`${h}px solid #FFC164`,background:"#FFC164",overflow:"hidden",verticalAlign:"middle",flexShrink:0,boxSizing:"border-box"},b={position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1},w={width:"100%",height:"100%",objectFit:"contain",imageRendering:"auto"},C={...w,paddingRight:"5%",transform:"scale(1.05)"},E={...w,paddingLeft:"5%",transform:"scale(1.05)"};return m.jsxs("div",{style:g,children:[m.jsx("div",{style:{...b,clipPath:"polygon(0 0, 50% 0, 50% 100%, 0% 100%)"},children:o.token0?m.jsx(e8,{content:l.symbol,style:C}):m.jsx("img",{src:l.logoUri,style:C,alt:l.symbol,onError:()=>{a(T=>({...T,token0:!0}))}})}),m.jsx("div",{style:{...b,clipPath:"polygon(50% 0, 100% 0, 100% 100%, 50% 100%)"},children:o.token1?m.jsx(e8,{content:d.symbol,style:E}):m.jsx("img",{src:d.logoUri,style:E,alt:d.symbol,onError:()=>{a(T=>({...T,token1:!0}))}})}),m.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:`calc(50% - ${p/2}px)`,width:`${p}px`,background:"#FFC164",zIndex:2}})]})};function An(t){if(t==null||isNaN(t))return"-";const e=typeof t=="number"?t:Number(t);if(isNaN(e))return"-";const n=Math.abs(e),i=e<0?"-":"",s=[{value:1e15,suffix:"Q"},{value:1e12,suffix:"T"},{value:1e9,suffix:"B"},{value:1e6,suffix:"M"},{value:1e3,suffix:"K"}];for(const{value:r,suffix:o}of s)if(n>=r){const a=(n/r).toFixed(2),c=parseFloat(a).toString();return`${i}${c}${o}`}return parseFloat(e.toFixed(2)).toString()}const Zqe=` 7276 query SearchTokens($limit: Int!) { 7277 tokens( 7278 limit: $limit 7279 orderBy: "volumeUSD" 7280 orderDirection: "desc" 7281 ) { 7282 items { 7283 id 7284 symbol 7285 name 7286 logoUri 7287 volumeUSD 7288 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7289 items { 7290 priceUSD 7291 oneDayEvo 7292 } 7293 } 7294 } 7295 } 7296 } 7297`,Qqe=` 7298 query SearchPools($limit: Int!) { 7299 pools( 7300 limit: $limit 7301 orderBy: "totalValueLockedUSD" 7302 orderDirection: "desc" 7303 ) { 7304 items { 7305 id 7306 token0Ref { 7307 id 7308 symbol 7309 logoUri 7310 } 7311 token1Ref { 7312 id 7313 symbol 7314 logoUri 7315 } 7316 totalValueLockedUSD 7317 volumeUSD 7318 poolDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7319 items { 7320 apr 7321 } 7322 } 7323 } 7324 } 7325 } 7326`,Xqe=` 7327 query SearchVaults($limit: Int!) { 7328 stickyVaults(limit: $limit, orderBy: "totalValueLockedUSD", orderDirection: "desc") { 7329 items { 7330 id 7331 name 7332 totalValueLockedUSD 7333 autoWinVault 7334 autoWinVaultRef { 7335 estimatedAPR 7336 } 7337 poolRef { 7338 id 7339 token0Ref { 7340 id 7341 symbol 7342 name 7343 logoUri 7344 } 7345 token1Ref { 7346 id 7347 symbol 7348 name 7349 logoUri 7350 } 7351 } 7352 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 7353 items { 7354 apr 7355 maxPotentialAPR 7356 } 7357 } 7358 } 7359 } 7360 } 7361`,vG=({searchValue:t,onResultClick:e,isMobileMenu:n=!1})=>{const i=t.toLowerCase().trim(),s=i.length>=2,{data:r}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{const P=await fetch("https://api.winnieswap.com/token/list");if(!P.ok)return[];const B=await P.json();return Array.isArray(B)?B:(B==null?void 0:B.data)||[]},staleTime:300*1e3}),{data:o,isLoading:a}=Zt({queryKey:["navbar-search-tokens",i],queryFn:async()=>{var F,z;return((z=(F=(await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Zqe,variables:{limit:50}})})).json()).data)==null?void 0:F.tokens)==null?void 0:z.items)||[]},enabled:s,staleTime:3e4}),{data:c,isLoading:l}=Zt({queryKey:["navbar-search-pools",i],queryFn:async()=>{var F,z;return((z=(F=(await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Qqe,variables:{limit:50}})})).json()).data)==null?void 0:F.pools)==null?void 0:z.items)||[]},enabled:s,staleTime:3e4}),{data:d,isLoading:h}=Zt({queryKey:["navbar-search-vaults",i],queryFn:async()=>{var F,z;return((z=(F=(await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Xqe,variables:{limit:50}})})).json()).data)==null?void 0:F.stickyVaults)==null?void 0:z.items)||[]},enabled:s,staleTime:3e4}),g=M.useMemo(()=>{const P=r||[],B=new Map;return P.forEach(F=>{F.symbol&&(B.set(F.symbol.toUpperCase(),F.logoUri||null),(F.symbol.toUpperCase()==="WBERA"||F.symbol.toUpperCase()==="EWBERA")&&(B.set("EWBERA",F.logoUri||null),B.set("WBERA",F.logoUri||null)))}),(o||[]).map(F=>{var K;const z=B.get((K=F.symbol)==null?void 0:K.toUpperCase())||F.logoUri||null;return{...F,logoUri:xr(F.symbol,F.name||void 0,F.id,z||void 0)}})},[o,r]).filter(P=>{const B=(P.symbol||"").toLowerCase(),F=(P.name||"").toLowerCase(),z=(P.id||"").toLowerCase();return B.includes(i)||F.includes(i)||z.includes(i)}).slice(0,5),w=M.useMemo(()=>{const P=r||[],B=new Map;return P.forEach(F=>{F.symbol&&(B.set(F.symbol.toUpperCase(),F.logoUri||null),(F.symbol.toUpperCase()==="WBERA"||F.symbol.toUpperCase()==="EWBERA")&&(B.set("EWBERA",F.logoUri||null),B.set("WBERA",F.logoUri||null)))}),(c||[]).map(F=>{var z,K,q,G,I,S,v,_;return{...F,token0Ref:{...F.token0Ref,logoUri:xr((z=F.token0Ref)==null?void 0:z.symbol,void 0,void 0,B.get((q=(K=F.token0Ref)==null?void 0:K.symbol)==null?void 0:q.toUpperCase())||((G=F.token0Ref)==null?void 0:G.logoUri)||void 0)},token1Ref:{...F.token1Ref,logoUri:xr((I=F.token1Ref)==null?void 0:I.symbol,void 0,void 0,B.get((v=(S=F.token1Ref)==null?void 0:S.symbol)==null?void 0:v.toUpperCase())||((_=F.token1Ref)==null?void 0:_.logoUri)||void 0)}}})},[c,r]).filter(P=>{var G,I,S,v;const B=(P.id||"").toLowerCase(),F=(((G=P.token0Ref)==null?void 0:G.symbol)||"").toLowerCase(),z=(((I=P.token1Ref)==null?void 0:I.symbol)||"").toLowerCase(),K=(((S=P.token0Ref)==null?void 0:S.id)||"").toLowerCase(),q=(((v=P.token1Ref)==null?void 0:v.id)||"").toLowerCase();return B.includes(i)||F.includes(i)||z.includes(i)||K.includes(i)||q.includes(i)}).slice(0,5),E=M.useMemo(()=>{const P=r||[],B=new Map;return P.forEach(F=>{F.symbol&&(B.set(F.symbol.toUpperCase(),F.logoUri||null),(F.symbol.toUpperCase()==="WBERA"||F.symbol.toUpperCase()==="EWBERA")&&(B.set("EWBERA",F.logoUri||null),B.set("WBERA",F.logoUri||null)))}),(d||[]).map(F=>{var z,K,q,G,I,S,v,_,N,$,U,j,D,O,H,J,W,Z,Y,Q,ee,ie,re,oe;return{...F,poolRef:{...F.poolRef,token0Ref:{...(z=F.poolRef)==null?void 0:z.token0Ref,logoUri:xr((q=(K=F.poolRef)==null?void 0:K.token0Ref)==null?void 0:q.symbol,((I=(G=F.poolRef)==null?void 0:G.token0Ref)==null?void 0:I.name)||void 0,(v=(S=F.poolRef)==null?void 0:S.token0Ref)==null?void 0:v.id,B.get(($=(N=(_=F.poolRef)==null?void 0:_.token0Ref)==null?void 0:N.symbol)==null?void 0:$.toUpperCase())||((j=(U=F.poolRef)==null?void 0:U.token0Ref)==null?void 0:j.logoUri)||void 0)},token1Ref:{...(D=F.poolRef)==null?void 0:D.token1Ref,logoUri:xr((H=(O=F.poolRef)==null?void 0:O.token1Ref)==null?void 0:H.symbol,((W=(J=F.poolRef)==null?void 0:J.token1Ref)==null?void 0:W.name)||void 0,(Y=(Z=F.poolRef)==null?void 0:Z.token1Ref)==null?void 0:Y.id,B.get((ie=(ee=(Q=F.poolRef)==null?void 0:Q.token1Ref)==null?void 0:ee.symbol)==null?void 0:ie.toUpperCase())||((oe=(re=F.poolRef)==null?void 0:re.token1Ref)==null?void 0:oe.logoUri)||void 0)}}}})},[d,r]).filter(P=>{var S,v,_,N,$,U,j,D,O;if(!P.poolRef||!P.poolRef.token0Ref||!P.poolRef.token1Ref)return!1;const B=(P.id||"").toLowerCase(),F=(P.name||"").toLowerCase(),z=(((v=(S=P.poolRef)==null?void 0:S.token0Ref)==null?void 0:v.symbol)||"").toLowerCase(),K=(((N=(_=P.poolRef)==null?void 0:_.token1Ref)==null?void 0:N.symbol)||"").toLowerCase(),q=(((U=($=P.poolRef)==null?void 0:$.token0Ref)==null?void 0:U.id)||"").toLowerCase(),G=(((D=(j=P.poolRef)==null?void 0:j.token1Ref)==null?void 0:D.id)||"").toLowerCase(),I=(((O=P.poolRef)==null?void 0:O.id)||"").toLowerCase();return B.includes(i)||F.includes(i)||z.includes(i)||K.includes(i)||q.includes(i)||G.includes(i)||I.includes(i)}).slice(0,5),T=a||l||h,A=g.length>0||w.length>0||E.length>0;if(!s)return null;const R={display:"flex",flexDirection:"column",background:n?"transparent":"rgba(23, 20, 16, 0.95)",backdropFilter:n?"none":"blur(20px) saturate(200%)",WebkitBackdropFilter:n?"none":"blur(20px) saturate(200%)",border:n?"none":"0.5px solid rgba(255, 255, 255, 0.12)",boxShadow:n?"none":"0 8px 32px rgba(0, 0, 0, 0.4)",...n?{position:"relative",top:0,left:0,right:0,maxWidth:"100%",minWidth:"auto",maxHeight:"calc(100vh - 200px)",marginTop:"8px",marginLeft:"-24px",marginRight:"-24px",width:"calc(100% + 48px)",borderRadius:"0",border:"none",boxShadow:"none"}:{position:"absolute",top:"calc(100% + 20px)",left:0,right:0,zIndex:100,width:"500px",maxWidth:"calc(100vw - 200px)",minWidth:"300px",maxHeight:"60vh"}};return!T&&!A?m.jsx(Wo.div,{initial:{opacity:0,y:-10}
7361,animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"navbar-search-results",style:R,children:m.jsx("div",{className:"navbar-search-results__empty",children:"No results found"})}):m.jsx(Pb,{children:m.jsx(Wo.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:"navbar-search-results",style:R,children:m.jsxs("div",{className:"navbar-search-results__content",children:[T&&m.jsxs("div",{className:"navbar-search-results__loading",children:[m.jsxs("div",{className:"navbar-search-results__skeleton",children:[m.jsxs("div",{className:"navbar-search-results__skeleton-left",children:[m.jsx("div",{className:"navbar-search-results__skeleton-logo"}),m.jsxs("div",{className:"navbar-search-results__skeleton-text",children:[m.jsx("div",{className:"navbar-search-results__skeleton-line"}),m.jsx("div",{className:"navbar-search-results__skeleton-line"})]})]}),m.jsx("div",{className:"navbar-search-results__skeleton-right",children:m.jsx("div",{className:"navbar-search-results__skeleton-price"})})]}),m.jsxs("div",{className:"navbar-search-results__skeleton",children:[m.jsxs("div",{className:"navbar-search-results__skeleton-left",children:[m.jsx("div",{className:"navbar-search-results__skeleton-logo"}),m.jsxs("div",{className:"navbar-search-results__skeleton-text",children:[m.jsx("div",{className:"navbar-search-results__skeleton-line"}),m.jsx("div",{className:"navbar-search-results__skeleton-line"})]})]}),m.jsx("div",{className:"navbar-search-results__skeleton-right",children:m.jsx("div",{className:"navbar-search-results__skeleton-price"})})]}),m.jsxs("div",{className:"navbar-search-results__skeleton",children:[m.jsxs("div",{className:"navbar-search-results__skeleton-left",children:[m.jsx("div",{className:"navbar-search-results__skeleton-logo"}),m.jsxs("div",{className:"navbar-search-results__skeleton-text",children:[m.jsx("div",{className:"navbar-search-results__skeleton-line"}),m.jsx("div",{className:"navbar-search-results__skeleton-line"})]})]}),m.jsx("div",{className:"navbar-search-results__skeleton-right",children:m.jsx("div",{className:"navbar-search-results__skeleton-price"})})]})]}),!T&&m.jsxs(m.Fragment,{children:[g.length>0&&m.jsxs("div",{className:"navbar-search-results__section",children:[m.jsx("div",{className:"navbar-search-results__section-title",children:"Tokens"}),g.map(P=>{var q,G;const B=(G=(q=P.tokenDayData)==null?void 0:q.items)==null?void 0:G[0],F=B!=null&&B.priceUSD?parseFloat(B.priceUSD):0,z=B!=null&&B.oneDayEvo?parseFloat(B.oneDayEvo):0,K=z>=0;return m.jsxs(gi,{to:`/tokens/${P.id}`,className:"navbar-search-results__item",onClick:e,children:[m.jsxs("div",{className:"navbar-search-results__item-left",children:[m.jsx(ws,{logoUri:P.logoUri,symbol:P.symbol,size:32}),m.jsxs("div",{className:"navbar-search-results__item-info",children:[m.jsx("div",{className:"navbar-search-results__item-name",children:P.symbol}),m.jsx("div",{className:"navbar-search-results__item-subtitle",children:P.name})]})]}),m.jsxs("div",{className:"navbar-search-results__item-right",children:[F>0&&m.jsxs("div",{className:"navbar-search-results__item-price",children:["$",An(F)]}),z!==0&&m.jsxs("div",{className:`navbar-search-results__item-change ${K?"positive":"negative"}`,children:[m.jsx("img",{src:K?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:K?"up":"down",className:"navbar-search-results__item-change-icon",width:12,height:12}),m.jsxs("span",{children:[Math.abs(z).toFixed(2),"%"]})]})]})]},P.id)})]}),w.length>0&&m.jsxs("div",{className:"navbar-search-results__section",children:[m.jsx("div",{className:"navbar-search-results__section-title",children:"Pools"}),w.map(P=>{var z,K,q,G,I,S,v,_,N;const B=parseFloat(P.totalValueLockedUSD||"0");parseFloat(P.volumeUSD||"0");const F=(q=(K=(z=P.poolDayData)==null?void 0:z.items)==null?void 0:K[0])!=null&&q.apr?parseFloat(P.poolDayData.items[0].apr):0;return m.jsxs(gi,{to:`/pools/${P.id}`,className:"navbar-search-results__item",onClick:e,children:[m.jsxs("div",{className:"navbar-search-results__item-left",children:[m.jsxs("div",{className:"navbar-search-results__pool-logos",children:[m.jsx(ws,{logoUri:(G=P.token0Ref)==null?void 0:G.logoUri,symbol:((I=P.token0Ref)==null?void 0:I.symbol)||"",size:24}),m.jsx(ws,{logoUri:(S=P.token1Ref)==null?void 0:S.logoUri,symbol:((v=P.token1Ref)==null?void 0:v.symbol)||"",size:24,style:{marginLeft:"-8px"}})]}),m.jsxs("div",{className:"navbar-search-results__item-info",children:[m.jsxs("div",{className:"navbar-search-results__item-name",children:[(_=P.token0Ref)==null?void 0:_.symbol," / ",(N=P.token1Ref)==null?void 0:N.symbol]}),m.jsx("div",{className:"navbar-search-results__item-subtitle",children:"Pool"})]})]}),m.jsxs("div",{className:"navbar-search-results__item-right",children:[B>0&&m.jsxs("div",{className:"navbar-search-results__item-price",children:["$",An(B)]}),F>0&&m.jsxs("div",{className:"navbar-search-results__item-apy",children:[F.toFixed(2),"% APY"]})]})]},P.id)})]}),E.length>0&&m.jsxs("div",{className:"navbar-search-results__section",children:[m.jsx("div",{className:"navbar-search-results__section-title",children:"Vaults"}),E.map(P=>{var S,v;const B=parseFloat(P.totalValueLockedUSD||"0"),F=(S=P==null?void 0:P.vaultDayData)!=null&&S.items&&P.vaultDayData.items.length>0?P.vaultDayData.items[0]:null,z=parseFloat((F==null?void 0:F.apr)||"0"),K=parseFloat((F==null?void 0:F.maxPotentialAPR)||"0"),q=P.autoWinVault&&P.autoWinVault!=="0x0000000000000000000000000000000000000000",G=q?parseFloat(((v=P.autoWinVaultRef)==null?void 0:v.estimatedAPR)||"0"):0,I=q&&G>0?K+G:K||z;return!P.poolRef||!P.poolRef.token0Ref||!P.poolRef.token1Ref?null:m.jsxs(gi,{to:`/vaults/${P.id}`,className:"navbar-search-results__item",onClick:e,children:[m.jsxs("div",{className:"navbar-search-results__item-left",children:[m.jsx(If,{token0:{id:P.poolRef.token0Ref.id||"0x0",address:P.poolRef.token0Ref.id||"0x0",symbol:P.poolRef.token0Ref.symbol||"",logoUri:P.poolRef.token0Ref.logoUri,name:P.poolRef.token0Ref.name},token1:{id:P.poolRef.token1Ref.id||"0x0",address:P.poolRef.token1Ref.id||"0x0",symbol:P.poolRef.token1Ref.symbol||"",logoUri:P.poolRef.token1Ref.logoUri,name:P.poolRef.token1Ref.name},size:32}),m.jsxs("div",{className:"navbar-search-results__item-info",children:[m.jsx("div",{className:"navbar-search-results__item-name",children:P.name}),m.jsx("div",{className:"navbar-search-results__item-subtitle",children:"Vault"})]})]}),m.jsxs("div",{className:"navbar-search-results__item-right",children:[B>0&&m.jsxs("div",{className:"navbar-search-results__item-price",children:["$",An(B)]}),F&&(I!==0||z!==0)&&m.jsxs("div",{className:"navbar-search-results__item-apy",children:[I.toFixed(2),"% APY"]})]})]},P.id)})]})]})]})})})},PI=[{path:"/",label:"Swap"},{path:"/earn?tab=vaults",label:"Earn"},{path:"/explore?tab=tokens",label:"Explore"},{path:"/portfolio",label:"Portfolio"},{path:"/leaderboard",label:"Leaderboard"}],Pk=(t,e)=>{const n=PI.find(i=>{const s=i.path.split("?")[0];return t===s});return n?n.path.includes("/explore")?"/explore?tab=tokens":n.path:t.startsWith("/tokens/")||t.startsWith("/pools/")||t==="/explore"||t.startsWith("/explore/")?"/explore?tab=tokens":t.startsWith("/vaults/")||t==="/earn"||t.startsWith("/earn/")?"/earn?tab=vaults":t==="/portfolio"||t==="/porfolio"||t==="/porfolio/"?"/portfolio":t==="/"?"/":null},Jqe=()=>{const t=jr(),[e,n]=M.useState(!1),[i,s]=M.useState(!1),[r,o]=M.useState(""),[a,c]=M.useState(!1),l=M.useRef(null),d=M.useRef(!1),h=M.useRef(null),p=M.useRef({}),g=M.useRef(null),b=()=>{window.scrollTo({top:0,behavior:"smooth"})};M.useLayoutEffect(()=>{const E=T=>{var F,z,K;
7361const A=T.key==="/",k=T.key===":",R=T.metaKey||T.ctrlKey,P=R&&(A||k)||!R&&(A||k),B=((F=document.activeElement)==null?void 0:F.tagName)==="INPUT"||((z=document.activeElement)==null?void 0:z.tagName)==="TEXTAREA"||((K=document.activeElement)==null?void 0:K.hasAttribute("contenteditable"));P&&(!B||i)&&(T.preventDefault(),i?(s(!1),o("")):s(!0))};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[i]),M.useEffect(()=>{if(i){const E=setTimeout(()=>{let T=document.querySelector(".new-navbar-search-wrapper .SearchBar__input");T||(T=document.querySelector(".new-navbar-menu-container .SearchBar__input")),T||(T=document.querySelector("input.SearchBar__input")),T?(T.focus(),setTimeout(()=>{document.activeElement!==T&&T.focus()},50)):console.log("Search input not found")},350);return()=>clearTimeout(E)}},[i]),M.useEffect(()=>{const E=T=>{i&&l.current&&!l.current.contains(T.target)&&(s(!1),o(""))};if(i)return document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[i]);const w=M.useRef(!1),C=M.useRef(null);return M.useEffect(()=>{var z;if(i)return;let E=!1;const T=Pk(t.pathname,t.search);if(!T)return;const A=PI.find(K=>K.path===T);if(!A)return;const k=C.current!==T;C.current=T;const R=(K=0)=>{E||requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(E)return;const q=p.current[A.path],G=g.current,I=h.current;if(q&&I&&G){const S=I.getBoundingClientRect(),v=q.getBoundingClientRect(),_=window.getComputedStyle(I),N=parseFloat(_.paddingLeft)||0,$=v.left-S.left-N,U=v.width,j=!w.current;j?(G.style.transition="none",w.current=!0):k&&(G.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)"),G.style.transform=`translateX(${$}px) translateY(-50%)`,G.style.width=`${U}px`,j&&setTimeout(()=>{G&&!E&&(G.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)")},50)}else K<10&&setTimeout(()=>R(K+1),20)})})};k&&w.current?(setTimeout(()=>R(),50),setTimeout(()=>R(),200),setTimeout(()=>R(),400)):R();const P=setTimeout(()=>R(),250),B=setTimeout(()=>R(),600);(z=document.fonts)!=null&&z.ready&&document.fonts.ready.then(()=>{E||R()});const F=()=>R();return window.addEventListener("resize",F),()=>{E=!0,clearTimeout(P),clearTimeout(B),window.removeEventListener("resize",F)}},[t.pathname,t.search,i]),m.jsxs("header",{className:"new-navbar-header",children:[m.jsxs("nav",{className:"new-navbar-desktop",children:[m.jsx(gi,{to:"/",className:"new-navbar-logo",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:E=>{t.pathname==="/"&&(E.preventDefault(),b())},children:m.jsx("img",{src:"/assets/components/header-winnieswap.svg",alt:"WinnieSwap",width:180,height:40,style:{opacity:a?1:.75,transition:"opacity 0.2s ease"}})}),m.jsx("div",{className:"new-navbar-menu-container",children:m.jsx(Pb,{mode:"wait",children:i?m.jsx(Wo.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.3,ease:[.4,0,.2,1]},className:"new-navbar-search-wrapper",ref:l,children:m.jsxs("div",{className:"new-navbar-search-container",children:[m.jsx(wb,{searchValue:r,setSearchValue:o,mode:"expanded",autoFocus:!0}),m.jsx(vG,{searchValue:r,onResultClick:()=>{s(!1),o("")}})]})},"search"):m.jsxs(Wo.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.3,ease:[.4,0,.2,1]},className:"new-navbar-menu-tabs",ref:h,children:[m.jsx("div",{ref:g,className:"new-navbar-menu-tabs-background"}),PI.map(E=>{const T=Pk(t.pathname,t.search),A=E.path.split("?")[0],k=T===E.path||A==="/explore"&&(t.pathname==="/explore"||t.pathname.startsWith("/explore/")||t.pathname.startsWith("/tokens/")||t.pathname.startsWith("/pools/"))||A==="/earn"&&(t.pathname==="/earn"||t.pathname.startsWith("/earn/")||t.pathname.startsWith("/vaults/"))||A==="/portfolio"&&(t.pathname==="/portfolio"||t.pathname==="/porfolio"||t.pathname==="/porfolio/");return m.jsx(gi,{to:E.path,ref:R=>{p.current[E.path]=R},className:`new-navbar-tab ${k?"new-navbar-tab--active":""}`,onClick:R=>{const P=Pk(t.pathname,t.search);A==="/explore"&&t.pathname!=="/explore"&&!t.pathname.startsWith("/explore/")||P===E.path&&t.pathname===A&&(R.preventDefault(),b())},children:E.label},E.path)})]},"menu")})}),m.jsxs("div",{className:"new-navbar-right-actions",children:[m.jsx("button",{onMouseDown:E=>{const T=E.target;
7361if(T.closest(".new-navbar-close-icon")||T.closest(".new-navbar-close-line")){E.preventDefault(),E.stopPropagation(),d.current=!0,s(!1),o(""),setTimeout(()=>{d.current=!1},300);return}},onClick:E=>{if(d.current){E.preventDefault(),E.stopPropagation();return}const T=E.target;if(T.closest(".new-navbar-close-icon")||T.closest(".new-navbar-close-line")){E.preventDefault(),E.stopPropagation();return}s(!i),i&&o("")},className:"new-navbar-search-button","aria-label":"Toggle search",children:m.jsxs("div",{className:"new-navbar-search-icon",children:[m.jsx(Wo.svg,{className:"new-navbar-search-svg",width:"22",height:"22",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",initial:{opacity:1,scale:1,rotate:0},animate:{opacity:i?0:1,scale:i?0:1,rotate:i?90:0},transition:{duration:.3,ease:[.4,0,.2,1]},style:{position:"absolute"},children:m.jsx("path",{d:"M13.3333 13.3333L16.6666 16.6666M15 9.16665C15 12.3883 12.3883 15 9.16665 15C5.94499 15 3.33331 12.3883 3.33331 9.16665C3.33331 5.94499 5.94499 3.33331 9.16665 3.33331C12.3883 3.33331 15 5.94499 15 9.16665Z",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),m.jsxs(Wo.div,{className:"new-navbar-close-icon",initial:{opacity:0,scale:0,rotate:-90},animate:{opacity:i?1:0,scale:i?1:0,rotate:i?0:-90},transition:{duration:.3,ease:[.4,0,.2,1]},style:{position:"absolute",cursor:"pointer",pointerEvents:i?"auto":"none"},children:[m.jsx("span",{className:"new-navbar-close-line"}),m.jsx("span",{className:"new-navbar-close-line"})]})]})}),m.jsx("div",{className:"new-navbar-connect",children:m.jsx(yG,{})})]})]}),m.jsxs("nav",{className:"new-navbar-mobile",children:[m.jsx(gi,{to:"/",className:"new-navbar-logo-mobile",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:E=>{t.pathname==="/"&&(E.preventDefault(),b())},children:m.jsx("img",{src:"/assets/components/header-winnieswap.svg",alt:"WinnieSwap",width:247,height:40,style:{opacity:a?1:.75,transition:"opacity 0.2s ease"}})}),m.jsxs("div",{className:"new-navbar-mobile-right",children:[m.jsx("div",{className:"new-navbar-connect-mobile",children:m.jsx(yG,{})}),m.jsx("button",{onClick:()=>n(E=>!E),className:"new-navbar-burger",children:m.jsxs("div",{className:"new-navbar-burger-lines",children:[m.jsx("span",{className:e?"open":""}),m.jsx("span",{className:e?"open":""}),m.jsx("span",{className:e?"open":""})]})})]}),e&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"new-navbar-backdrop",onClick:()=>n(!1)}),m.jsxs("div",{className:"new-navbar-mobile-menu",children:[m.jsxs("div",{className:"new-navbar-mobile-search",children:[m.jsx(wb,{searchValue:r,setSearchValue:o,mode:"expanded"}),m.jsx(vG,{searchValue:r,onResultClick:()=>{n(!1),o("")},isMobileMenu:!0})]}),!r.trim()&&m.jsxs(m.Fragment,{children:[m.jsx(gi,{to:"/",className:"new-navbar-mobile-item",onClick:E=>{t.pathname==="/"&&(E.preventDefault(),b()),n(!1)},children:"Swap"}),m.jsx(gi,{to:"/earn?tab=vaults",className:"new-navbar-mobile-item",onClick:()=>n(!1),children:"Earn"}),m.jsx(gi,{to:"/explore?tab=tokens",className:"new-navbar-mobile-item",onClick:()=>n(!1),children:"Explore"}),m.jsx(gi,{to:"/portfolio",className:"new-navbar-mobile-item",onClick:()=>n(!1),children:"Portfolio"}),m.jsx(gi,{to:"/leaderboard",className:"new-navbar-mobile-item",onClick:()=>n(!1),children:"Leaderboard"})]})]})]})]})]})},eze=` 7362 query GetTrendingTokens { 7363 tokens( 7364 orderBy: "volumeUSD" 7365 orderDirection: "desc" 7366 limit: 50 7367 ) { 7368 items { 7369 id 7370 symbol 7371 name 7372 logoUri 7373 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7374 items { 7375 priceUSD 7376 oneDayEvo 7377 } 7378 } 7379 } 7380 } 7381 } 7382`,LS=({onTokenClick:t})=>{const e=Zo(),{data:n,isLoading:i,error:s}=Zt({queryKey:["trendingTokens"],queryFn:async()=>{const h="https://sub.winnieswap.com";try{const g=await(await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:eze})})).json();return g.errors?(console.error("GraphQL errors:",g.errors),{tokens:{items:[]}}):g.data}
7382catch(p){return p instanceof TypeError||p instanceof Error&&(p.message.includes("fetch failed")||p.message.includes("ECONNREFUSED")||p.message.includes("Connection refused")||p.message.includes("Failed to fetch"))?(console.warn("[TokensMarquee] GraphQL service is not available, returning empty array"),{tokens:{items:[]}}):{tokens:{items:[]}}}},staleTime:3e4,refetchInterval:6e4,retry:3,retryDelay:1e3}),{data:r}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{try{const h="https://api.winnieswap.com",p=await fetch(`${h}/token/list`);if(!p.ok)return[];const g=await p.json();return Array.isArray(g)?g:(g==null?void 0:g.data)||[]}catch(h){return console.warn("[TokensMarquee] Failed to fetch token list, using GraphQL data only:",h),[]}},staleTime:300*1e3,retry:!1}),o=M.useMemo(()=>{var b;const h=((b=n==null?void 0:n.tokens)==null?void 0:b.items)||[],p=r||[],g=new Map;return p.forEach(w=>{w.symbol&&g.set(w.symbol.toUpperCase(),w.logoUri||null)}),h.map(w=>{const C=g.get(w.symbol.toUpperCase())||w.logoUri||null,E=xr(w.symbol,w.name||void 0,w.id,C||void 0);return{...w,logoUri:E}})},[n,r]),a=i,c=s,l=[...o,...o,...o],d=h=>{t?t(h):e(`/tokens/${h}`)};return a?m.jsx("div",{className:"tokens-marquee",children:m.jsx("div",{className:"tokens-marquee__container",children:m.jsx("div",{className:"tokens-marquee__track",children:Array.from({length:20}).map((h,p)=>m.jsxs("div",{className:"tokens-marquee__item tokens-marquee__item--skeleton",children:[m.jsx("div",{className:"tokens-marquee__logo-skeleton"}),m.jsx("div",{className:"tokens-marquee__symbol-skeleton"}),m.jsx("div",{className:"tokens-marquee__price-skeleton"}),m.jsx("div",{className:"tokens-marquee__change-skeleton"})]},`skeleton-${p}`))})})}):!a&&(o.length===0||c)?m.jsx("div",{className:"tokens-marquee",children:m.jsx("div",{className:"tokens-marquee__container",children:m.jsx("div",{className:"tokens-marquee__track",children:Array.from({length:10}).map((h,p)=>m.jsxs("div",{className:"tokens-marquee__item tokens-marquee__item--skeleton",children:[m.jsx("div",{className:"tokens-marquee__logo-skeleton"}),m.jsx("div",{className:"tokens-marquee__symbol-skeleton"}),m.jsx("div",{className:"tokens-marquee__price-skeleton"}),m.jsx("div",{className:"tokens-marquee__change-skeleton"})]},`fallback-${p}`))})})}):m.jsx("div",{className:"tokens-marquee",children:m.jsx("div",{className:"tokens-marquee__container",children:m.jsx("div",{className:"tokens-marquee__track",children:l.map((h,p)=>{var E,T;const g=(T=(E=h.tokenDayData)==null?void 0:E.items)==null?void 0:T[0],b=g!=null&&g.priceUSD?parseFloat(g.priceUSD):0,w=g!=null&&g.oneDayEvo?parseFloat(g.oneDayEvo):0,C=w>=0;return p<3&&console.log("[TokensMarquee] Token data:",{symbol:h.symbol,logoUri:h.logoUri,hasLogoUri:!!h.logoUri}),m.jsxs("div",{className:"tokens-marquee__item",onClick:()=>d(h.id),children:[m.jsx("div",{className:"tokens-marquee__logo",children:h.logoUri?m.jsx("img",{src:h.logoUri,alt:h.symbol,width:32,height:32,style:{width:"32px",height:"32px",borderRadius:"50%",objectFit:"contain",display:"block"},onError:A=>{console.error("[TokensMarquee] Image failed to load:",h.logoUri),A.currentTarget.style.display="none"}}):m.jsx(ws,{logoUri:void 0,symbol:h.symbol,size:32,className:"tokens-marquee__token-logo"})}),m.jsx("div",{className:"tokens-marquee__symbol",children:h.symbol}),m.jsx("div",{className:"tokens-marquee__price",children:b>0?`$${An(b)}`:"-"}),w!==0&&m.jsxs("div",{className:`tokens-marquee__change ${C?"tokens-marquee__change--positive":"tokens-marquee__change--negative"}`,children:[m.jsx("img",{src:C?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:C?"up":"down",width:12,height:12,className:"tokens-marquee__change-icon"}),m.jsxs("span",{children:[Math.abs(w).toFixed(2),"%"]})]})]},`${h.id}-${p}`)})})})})},Uu=({children:t,className:e=""})=>{const[n,i]=M.useState(!1);return M.useEffect(()=>{const s=setTimeout(()=>{i(!0)},100);return()=>clearTimeout(s)},[]),m.jsx(Wo.div,{initial:{opacity:0,y:10},animate:{opacity:n?1:0,y:n?0:10},transition:{duration:.4,ease:"easeOut",opacity:{duration:.3},y:{duration:.4}},className:e,children:t})},tze={desktop:"desktopLoader",mobile:"mobileLoader",small:"smallLoader",panel:"panelLoader",mini:"miniLoader"},u4=({className:t="",size:e="desktop",color:n="#FFB648"})=>
7382{const s=["Loader",tze[e]||"",t].filter(Boolean).join(" ");return m.jsx("div",{className:s,children:m.jsxs("svg",{className:"circular",viewBox:"25 25 50 50",children:[m.jsx("circle",{opacity:"0.2",cx:"50",cy:"50",r:"20",fill:"none",stroke:n,strokeLinecap:"round"}),m.jsx("circle",{className:"path",cx:"50",cy:"50",r:"20",fill:"none",stroke:n,strokeLinecap:"round"})]})})},nze=({children:t,size:e="large",variant:n="main",onClick:i,disabled:s=!1,loading:r=!1,type:o="button",className:a="",dominantColor:c,secondaryColor:l,customClassName:d="",style:h,"aria-label":p,title:g})=>{const b=s||r,w=`btn btn--${e} btn__${n} ${d} ${a}`.trim(),C={...h};c&&(C.color=c),l&&(C.backgroundColor=l);const E=()=>{switch(n){case"main":return"btn__main-loader";case"accent":return"btn__accent-loader";case"shade":return"btn__shade-loader";case"disabled":return"btn__disabled-loader";default:return""}};return m.jsx("button",{type:o,className:w,onClick:i,disabled:b,style:C,"aria-label":p,title:g,children:r?m.jsx(u4,{size:"small",className:E()}):t})},QM=({size:t="large",dominantColor:e,secondaryColor:n,customClassName:i="",variant:s="shade"})=>{const{connect:r,isConnecting:o}=ZM(),a=M.useCallback(()=>{r()},[r]);return m.jsx(nze,{size:t,variant:s,onClick:a,loading:o,dominantColor:e,secondaryColor:n,customClassName:i,children:"Connect Wallet"})},jre="/assets/confirmationcircle-Bv4ZqWuz.png";function XM(t){return t&&(t.replace(/^Sticky\s*Vault\s*/i,"").trim()||t)}function ize(t){return t&&(t.replace(/^Sticky/i,"").trim()||t)}function sze(t){return t?/sticky\s*vault/i.test(t):!1}const rze={"0xd352dc6e5f0c45e2f2b38eb5565eb286a1ea4087":{name:"Bedrock",symbol:"BR"},"0xcaa70d2aa873ef057980844e18d9a9560bdffcc0":{name:"eWBERA-4",symbol:"eWBERA-4"},"0x656b95e550c07a9ffe548bd4085c72418ceb1dba":{name:"Bera Governance Token",symbol:"BGT"},"0xb2a12db2691fc05dca47b2be9a087077afaa0800":{name:"SMILEE",symbol:"SMILEE"},"0xa1b644aec990ad6023811ced36e6a2d6d128c7c9":{name:"Infrared",symbol:"IR"},"0x59a61b8d3064a51a95a5d6393c03e2152b1a2770":{name:"Sail Restaked",symbol:"SAIL.r"}};function oze(t){return t&&rze[t.toLowerCase()]||null}function d4(t){var r,o;if(!t)return t;const e=((r=t.address)==null?void 0:r.toLowerCase())==="0xcaa70d2aa873ef057980844e18d9a9560bdffcc0"||((o=t.symbol)==null?void 0:o.toLowerCase().includes("ewbera"));e&&console.log("[formatTokenForDisplay] eWBERA-4 token input:",{name:t.name,symbol:t.symbol,address:t.address});const n=oze(t.address);if(n)return e&&console.log("[formatTokenForDisplay] eWBERA-4 found in mapping:",n),{name:n.name,symbol:n.symbol};const i=t.name?sze(t.name):!1,s={name:i?XM(t.name||""):t.name||"Unknown Token",symbol:i?ize(t.symbol||""):t.symbol||"UNKNOWN"};return e&&console.log("[formatTokenForDisplay] eWBERA-4 final result:",s),s}const aze="https://berascan.com/token/",cze=({token:t,isSelected:e,onSelect:n})=>{const[i]=M.useState(!1),s=t.balance||"",r=t.balanceUSD||0,o=t.priceUSD||t.lastPrice||0,a=M.useMemo(()=>{if(r>0)return r;const l=s?parseFloat(s):0;return l>0&&o>0?l*o:0},[s,r,o]);s&&parseFloat(s)>0&&console.log("[TokenItem] Token data:",{symbol:t.symbol,balance:s,balanceUSD:t.balanceUSD,calculatedBalanceUSD:a,priceUSD:t.priceUSD,lastPrice:t.lastPrice,finalPriceUSD:o,willDisplay:a>0});const c=d4({...t,address:t.address});return m.jsxs("div",{className:`Modal__Item${e?" selected":""}`,onClick:n,tabIndex:0,children:[m.jsx("div",{className:"Modal__ItemLogo",children:m.jsx(ws,{logoUri:i?null:t.logoUri,symbol:c.symbol,name:c.name,id:t.address,size:40,className:"Modal__ItemImage"})}),m.jsxs("div",{className:"Modal__ItemInfo",children:[m.jsx("span",{className:"Modal__ItemName",children:c.name}),m.jsxs("div",{className:"Modal__ItemDetails",children:[m.jsx("span",{className:"Modal__ItemSymbol",children:c.symbol}),t.address&&m.jsx("a",{href:`${aze}${t.address}`,target:"_blank",onClick:l=>l.stopPropagation(),children:m.jsx("span",{className:"Modal__ItemAddress",children:t.address.slice(0,6)+"..."+t.address.slice(-4)})})]})]}),m.jsx("div",{className:"Modal__ItemBalanceContainer",children:m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"Modal__ItemBalance",children:s&&parseFloat(s)>0?`${parseFloat(s).toFixed(4)}`:""}),m.jsx("span",{className:"Modal__ItemPrice",children:a>0?`$${a.toFixed(2)}`:""})]})})]})},lze=[{symbol:"BERA",priority:1,enabled:!0},{symbol:"WBTC",priority:2,enabled:!0},{symbol:"WETH",priority:3,enabled:!0},{symbol:"HONEY",priority:4,enabled:!0},{symbol:"NECT",priority:5,enabled:!0},{symbol:"USDT0",address:"0x779ded0c9e1022225f8e0630b35a9b54be713736",priority:6,enabled:!0},{symbol:"SMILEE",address:"0xb2a12db2691fc05dca47b2be9a087077afaa0800",priority:7,enabled:!0},{symbol:"IR",address:"0xa1b644aec990ad6023811ced36e6a2d6d128c7c9",priority:8,enabled:!0},{symbol:"SAIL.r",address:"0x59a61B8d3064A51a95a5D6393c03e2152b1a2770",priority:9,enabled:!0}],Vre=(t,e,n=6)=>M.useMemo(()=>{const i=lze,s=new Map,r=new Map;console.log("[usePopularTokens] All tokens received:",t.length,t.map(d=>
7382({symbol:d.symbol,address:d.address||d.id,hasAddress:!!d.address,hasId:!!d.id}))),t.forEach(d=>{if(d.symbol){const h=d.symbol.toUpperCase();if(s.set(h,d),s.set(d.symbol,d),h.includes("USDC")&&(s.set("USDC.E",d),s.set("USDCE",d),s.set("USDC.e",d),s.set("USDCe",d),(d.symbol.includes(".e")||d.symbol.includes(".E"))&&(s.set("USDC.E",d),s.set("USDC.e",d))),d.symbol.includes(".")){const p=d.symbol.replace(/\./g,"").toUpperCase(),g=d.symbol.replace(/\./g,".").toUpperCase();s.set(p,d),s.set(g,d)}}d.address&&r.set(d.address.toLowerCase(),d),d.id&&d.id.startsWith("0x")&&r.set(d.id.toLowerCase(),d)});const o="0xa1b644aec990ad6023811ced36e6a2d6d128c7c9",a="0x59a61B8d3064A51a95a5D6393c03e2152b1a2770";console.log("[usePopularTokens] IR address in map:",r.has(o.toLowerCase())),console.log("[usePopularTokens] SAIL.r address in map:",r.has(a.toLowerCase())),console.log("[usePopularTokens] IR symbol in map:",s.has("IR")),console.log("[usePopularTokens] SAIL.r symbol in map:",s.has("SAIL.R"),s.has("SAILR"));const l=i.filter(d=>d.enabled).sort((d,h)=>d.priority-h.priority).map(d=>{if(d.address){const h=d.address.toLowerCase(),p=r.get(h);if(p)return console.log(`[usePopularTokens] â
Found ${d.symbol||"token"} by address: ${h}`),p}if(d.symbol){const h=d.symbol.toUpperCase(),p=[d.symbol,h,d.symbol.replace(/\./g,"").toUpperCase(),d.symbol.replace(/\./g,".").toUpperCase(),d.symbol.replace(".e","E").toUpperCase(),d.symbol.replace(".e","e").toUpperCase(),d.symbol.replace(/\./g,""),d.symbol.replace(/\./g,".")];for(const g of p){const b=s.get(g);if(b)return console.log(`[usePopularTokens] â
Found ${d.symbol} by symbol variant: ${g}`),b}}if(d.symbol||d.address){const h=t.find(p=>{if(d.symbol&&p.symbol){const g=p.symbol.toUpperCase(),b=d.symbol.toUpperCase(),w=b.replace(/\./g,""),C=g.replace(/\./g,"");if(g===b||C===w||g===b.replace(".E","E")||g===b.replace(".e","E"))return!0}return!!(d.address&&(p.address||p.id)&&(p.address||p.id||"").toLowerCase()===d.address.toLowerCase())});if(h)return console.log(`[usePopularTokens] â
Found ${d.symbol||"token"} by exhaustive search`),h}return console.log(`[usePopularTokens] â Token not found: ${d.symbol} (${d.address})`),console.log("[usePopularTokens] Available tokens with similar symbol:",t.filter(h=>{if(!h.symbol||!d.symbol)return!1;const p=h.symbol.toUpperCase(),g=d.symbol.toUpperCase(),b=Math.min(3,Math.min(g.length,p.length));return p.substring(0,b)===g.substring(0,b)||g.substring(0,b)===p.substring(0,b)}).slice(0,5).map(h=>({symbol:h.symbol,address:h.address||h.id}))),null}).filter(d=>!!d).filter((d,h,p)=>h===p.findIndex(g=>{var b,w;return((b=g.address)==null?void 0:b.toLowerCase())===((w=d.address)==null?void 0:w.toLowerCase())||g.id&&d.id&&g.id.toLowerCase()===d.id.toLowerCase()}));return l.length<i.filter(d=>d.enabled).length&&(console.log("[usePopularTokens] Some tokens not found. Found:",l.length,"Expected:",i.filter(d=>d.enabled).length),console.log("[usePopularTokens] Found tokens:",l.map(d=>d.symbol))),l.slice(0,n)},[t,e,n]),uze=({tokens:t,onTokenSelect:e,selectedToken:n,isOutputSelector:i=!1})=>{const s=Vre(t),r=i?s.filter(o=>{var a,c;return((a=o.symbol)==null?void 0:a.toUpperCase())!=="BGT"&&((c=o.address)==null?void 0:c.toLowerCase())!=="0x656b95e550c07a9ffe548bd4085c72418ceb1dba"}):s;return r.length===0?null:m.jsxs("div",{className:"PopularTokens",children:[m.jsx("div",{className:"PopularTokens__Label",children:"Popular tokens"}),m.jsx("div",{className:"PopularTokens__List",children:r.map((o,a)=>{const c=d4({name:o.name,symbol:o.symbol,address:o.address});return m.jsx("button",{className:`PopularTokens__Button ${(n==null?void 0:n.address)===o.address?"PopularTokens__Button--selected":""}`,onClick:()=>e(o),type:"button",children:m.jsx("div",{className:"PopularTokens__ButtonContent",children:m.jsx("div",{className:"PopularTokens__ButtonLogo",children:m.jsx(ws,{logoUri:o.logoUri,symbol:c.symbol,size:40})})})},`popular-${o.address||o.symbol}-${a}`)})})]})},L1=()=>{const{address:t,isConnected:e}=mn(),n=Kc();M.useEffect(()=>{n.invalidateQueries({queryKey:["tokens-in-pool"]})},[e,n]);const i=Zt({queryKey:["tokens-in-pool-no-balances",t],queryFn:async()=>{try{const a=await fetch("https://api.winnieswap.com/token/list-with-balances",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}catch(o){const a=(o==null?void 0:o.message)||String(o);if(o instanceof TypeError||a.includes("ERR_CONNECTION_REFUSED")||a.includes("Failed to fetch")||a.includes("NetworkError")){const c=new Error("Backend server is not accessible");
7382throw c.isConnectionError=!0,c}throw o}},enabled:!0,staleTime:300*1e3,gcTime:600*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,placeholderData:o=>o}),s=Zt({queryKey:["tokens-in-pool",t],queryFn:async()=>{try{const a=await fetch("https://api.winnieswap.com/token/list-with-balances",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({walletAddress:t||void 0})});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}catch(o){const a=(o==null?void 0:o.message)||String(o);if(o instanceof TypeError||a.includes("ERR_CONNECTION_REFUSED")||a.includes("Failed to fetch")||a.includes("NetworkError")){const c=new Error("Backend server is not accessible");throw c.isConnectionError=!0,c}throw o}},enabled:!!t,staleTime:300*1e3,gcTime:600*1e3,refetchInterval:!1,retry:(o,a)=>{var c,l;return a!=null&&a.isConnectionError||(c=a==null?void 0:a.message)!=null&&c.includes("not accessible")||(l=a==null?void 0:a.message)!=null&&l.includes("ERR_CONNECTION_REFUSED")?!1:o<1},retryDelay:1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,placeholderData:o=>o});return{...M.useMemo(()=>{const o=i.data,a=s.data;return a&&a.success?{...s,data:a}:o&&o.success?{...i,data:o}:i},[i.data,s.data]),isLoading:i.isLoading||!!t&&s.isLoading,isError:i.isError||s.isError,error:i.error||s.error}},dze=t=>t.map(e=>({address:e.address,symbol:e.symbol,name:e.name,decimals:e.decimals,logoUri:e.logoUri||null,status:e.status,totalSupply:"0",lastPrice:e.priceUSD||0,balance:e.balance,priceUSD:e.priceUSD,balanceUSD:e.balanceUSD})),CG=[{address:"0x0000000000000000000000000000000000000000",symbol:"BERA",name:"Bera",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL"},{address:"0x6969696969696969696969696969696969696969",symbol:"wBERA",name:"Wrapped Bera",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL"},{address:"0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",symbol:"HONEY",name:"Honey",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL"}],h4=()=>{const t=Kc();kn.useEffect(()=>{t.invalidateQueries({queryKey:["tokens"]})},[t]);const{data:e,isLoading:n,error:i}=Zt({queryKey:["tokens"],queryFn:async()=>{try{const s=await fetch("https://api.winnieswap.com/token/list");if(!s.ok)throw new Error("Failed to fetch tokens");const r=await s.json(),o=Array.isArray(r)?r:(r==null?void 0:r.data)||[];return o.length===0?CG:o}catch{return CG}},staleTime:300*1e3,gcTime:600*1e3,retry:(s,r)=>{const o=(r==null?void 0:r.message)||String(r);return o.includes("ERR_CONNECTION_REFUSED")||o.includes("Failed to fetch")||o.includes("NetworkError")||r instanceof TypeError?!1:s<1},retryDelay:1e3,refetchOnWindowFocus:!1});return{data:e,isLoading:n,error:i}},gg="0x656b95E550C07a9ffe548bd4085c72418Ceb1dba",hze="98111a6ee569f1be005551d8c76e042aabcb5bf4c491d177445a2b5fb30dedc7bf6db39e387831c6739bde4129c6ada5",fze="https://api.goldsky.com/api/public/project_clq1h5ct0g4a201x18tfte5iv/subgraphs/pol-subgraph/mainnet-1.7.0/gn",xG=[{name:"redeem",type:"function",stateMutability:"payable",inputs:[{name:"receiver",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]}];function JM(){const{address:t}=mn(),[e,n]=M.useState(0n),{data:i,refetch:s}=Si({address:gg,abi:xG,functionName:"balanceOf",args:t?[t]:void 0,query:{enabled:!!t}}),{data:r}=Zt({queryKey:["bgt-boost-data",t],queryFn:async()=>{var A;if(!t)return null;const E=`0x${hze}`,T=` 7383 query GetUserBoostData($userAddress: Bytes!, $validatorPublicKey: Bytes!) { 7384 userBoosts( 7385 where: { 7386 user: $userAddress, 7387 validator_: { publicKey: $validatorPublicKey } 7388 }, 7389 first: 1 7390 ) { 7391 id 7392 activeBoostAmount 7393 queuedBoostAmount 7394 queuedDropBoostAmount 7395 } 7396 } 7397 `;try{const k=await fetch(fze,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:T,variables:{userAddress:t,validatorPublicKey:E}})});if(!k.ok)return console.warn("[useBgtRedeem] Failed to fetch boost data:",k.status),null;const R=await k.json();if(R.errors)return console.warn("[useBgtRedeem] GraphQL errors:",R.errors),null;const P=((A=R.data)==null?void 0:A.userBoosts)||[];let B=0,F=0;for(const z of P)B+=parseFloat(z.activeBoostAmount||"0"),F+=parseFloat(z.queuedBoostAmount||"0");return{activeBoosted:B,queuedBoostAmount:F}}catch(k){return console.warn("[useBgtRedeem] Error fetching boost data:",k),null}},enabled:!!t,staleTime:3e4,refetchInterval:6e4});M.useEffect(()=>{if(!i){n(0n);return}const E=typeof i=="bigint"?i:BigInt(i||0);if(!r){n(E);return}try{const T=hs(r.activeBoosted.toString(),18),A=hs(r.queuedBoostAmount.toString(),18),k=E>T+A?E-T-A:0n;n(k),console.log("[useBgtRedeem] Balance calculation:",{total:dt(E,18),activeBoosted:r.activeBoosted,queuedBoostAmount:r.queuedBoostAmount,available:dt(k,18)})}catch(T){console.error("[useBgtRedeem] Error calculating available balance:",T),n(E)}},[i,r]);const{data:o,writeContract:a,isPending:c,error:l,reset:d}=Ls(),{isLoading:h,isSuccess:p,error:g}=Ts({hash:o}),b=M.useMemo(()=>E=>{if(!t)throw new Error("Wallet not connected");const T=E.receiver||t;let A=hs(E.amount,18);const k=1000000n;A=A/k*k,console.log("ð Redeeming BGT â BERA:",{amount:E.amount,amountOriginal:hs(E.amount,18).toString(),amountRounded:A.toString(),receiver:T,bgtAddress:gg}),a({address:gg,abi:xG,functionName:"redeem",args:[T,A]})},[t,a]),w=M.useMemo(()=>()=>{d()},[d]);return{bgtBalance:M.useMemo(()=>
7397e==null?0n:typeof e=="bigint"?e:BigInt(e||0),[e]),bgtBalanceTotal:i,refetchBalance:s,redeem:b,hash:o,isLoading:c||h,isSuccess:p,error:l||g,reset:w,isPending:c,isConfirming:h}}function pze(t,e){return M.useMemo(()=>{var c,l,d,h;if(!t||!e)return!1;const n=(c=t.symbol)==null?void 0:c.toUpperCase(),i=(l=e.symbol)==null?void 0:l.toUpperCase(),s=(d=t.address)==null?void 0:d.toLowerCase(),r=(h=e.address)==null?void 0:h.toLowerCase();return(n==="BGT"||s===gg.toLowerCase())&&(i==="BERA"||r==="0x0000000000000000000000000000000000000000")},[t,e])}function mze(t){return M.useMemo(()=>{var i,s;if(!t)return!1;const e=(i=t.symbol)==null?void 0:i.toUpperCase(),n=(s=t.address)==null?void 0:s.toLowerCase();return e==="BGT"||n===gg.toLowerCase()},[t])}const gze=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],type:"function"}];function yze(t){const{address:e}=mn(),n=M.useMemo(()=>!e||!t||t.length===0?[]:t.filter(a=>a.address&&a.address.toLowerCase()!=="0x0000000000000000000000000000000000000000").map(a=>({address:a.address,abi:gze,functionName:"balanceOf",args:[e]})),[t,e]),{data:i,isLoading:s,refetch:r}=vf({contracts:n,query:{enabled:!!e&&n.length>0,refetchInterval:3e4,staleTime:15e3,refetchOnMount:!1,refetchOnWindowFocus:!1}});return{balances:M.useMemo(()=>{if(!i||!t)return{};const a={};let c=0;return t.forEach(l=>{var p;const d=(p=l.address)==null?void 0:p.toLowerCase();if(!d||d==="0x0000000000000000000000000000000000000000")return;const h=i[c];if(c++,(h==null?void 0:h.status)==="success"&&h.result!==void 0){const g=l.decimals||18;a[d]=dt(h.result,g)}else a[d]="0"}),a},[i,t]),isLoading:s,refetch:r}}const eL=({open:t,onClose:e,children:n,className:i="",overlayClassName:s=""})=>{const[r,o]=M.useState(t),[a,c]=M.useState(t),[l,d]=M.useState(t),h=M.useRef(null);if(M.useEffect(()=>{console.log("[Modal] open changed:",t),t?(o(!0),d(!0),c(!0)):(c(!1),d(!1))},[t]),M.useEffect(()=>{const w=()=>{t||(d(!1),o(!1))},C=h.current;return C&&C.addEventListener("transitionend",w),()=>{C&&C.removeEventListener("transitionend",w)}},[t]),!r)return null;const p=typeof window<"u"?document.getElementById("modal-root"):null,g=`ModalOverlay${l?" open":""} ${s}`,b=`ModalBox${a?" open":""} ${i}`;return TZ.createPortal(m.jsx("div",{className:g,onClick:e,children:m.jsx("div",{className:b,onClick:w=>w.stopPropagation(),ref:h,children:n})}),p||document.body)},bze=` 7398 query GetTrendingTokens { 7399 tokens( 7400 orderBy: "volumeUSD" 7401 orderDirection: "desc" 7402 limit: 50 7403 ) { 7404 items { 7405 id 7406 symbol 7407 name 7408 logoUri 7409 decimals 7410 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7411 items { 7412 priceUSD 7413 oneDayEvo 7414 } 7415 } 7416 } 7417 } 7418 } 7419`,Ik=[{address:"0x0000000000000000000000000000000000000000",symbol:"BERA",name:"Bera",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL"},{address:"0x6969696969696969696969696969696969696969",symbol:"wBERA",name:"Wrapped Bera",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL"},{address:"0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",symbol:"HONEY",name:"Honey",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL"}],wze=({isOpen:t,onClose:e,onSelect:n,selectedToken:i,showAllTokens:s=!1,excludeToken:r,isOutputSelector:o=!1})=>{var W,Z,Y;const[a,c]=M.useState(""),l=M.useRef(null),{data:d,isLoading:h}=h4(),{data:p,isLoading:g,isError:b}=L1(),{bgtBalance:w,bgtBalanceTotal:C}=JM(),{address:E}=mn(),{data:T}=wf({address:E,query:{enabled:!!E}}),{data:A,isLoading:k}=Zt({queryKey:["trendingTokensForModal"],queryFn:async()=>{const ee=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:bze})})).json();return ee.errors?(console.error("GraphQL errors:",ee.errors),{tokens:{items:[]}}):ee.data},staleTime:3e4,retry:3,retryDelay:1e3,refetchOnMount:!0}),R=M.useCallback(Q=>{var re,oe;const ee=(oe=(re=Q.tokenDayData)==null?void 0:re.items)==null?void 0:oe[0],ie=ee!=null&&ee.priceUSD?parseFloat(ee.priceUSD):0;
7419return{address:Q.id,symbol:Q.symbol,name:Q.name||Q.symbol,decimals:Q.decimals||18,logoUri:Q.logoUri||null,totalSupply:"0",lastPrice:ie,status:"IN_POOL",priceUSD:ie,balance:"",balanceUSD:0}},[]),P=s?h:g,B=((W=p==null?void 0:p.data)==null?void 0:W.tokens)&&p.data.tokens.length>0,F=(P||!p)&&!B,z=M.useMemo(()=>{var oe,de,he,ue;let Q=[];if(s){if(Q=Array.isArray(d)&&d.length>0?d:Ik,(oe=p==null?void 0:p.data)!=null&&oe.tokens&&p.data.tokens.length>0){const be=new Map;p.data.tokens.forEach(_e=>{be.set(_e.address.toLowerCase(),{balance:_e.balance||"",balanceUSD:_e.balanceUSD||0,priceUSD:_e.priceUSD||0})}),Q=Q.map(_e=>{const Ne=be.get(_e.address.toLowerCase());return Ne?{..._e,balance:Ne.balance,balanceUSD:Ne.balanceUSD,priceUSD:Ne.priceUSD>0?Ne.priceUSD:_e.priceUSD||_e.lastPrice||0,lastPrice:Ne.priceUSD>0?Ne.priceUSD:_e.lastPrice||_e.priceUSD||0}:_e})}}else b||!((de=p==null?void 0:p.data)!=null&&de.tokens)||p.data.tokens.length===0?(Q=Array.isArray(d)&&d.length>0?d:Ik,console.log("[TokenList] Using fallback tokens:",Q.length,"symbols:",Q.map(be=>be.symbol),"from allTokensData:",(d==null?void 0:d.length)||0)):(Q=dze(p.data.tokens),console.log("[TokenList] Using tokens from tokensInPoolData:",Q.length,"symbols:",Q.map(be=>be.symbol)));if((Q.length<=3||((he=A==null?void 0:A.tokens)==null?void 0:he.items)&&A.tokens.items.length>0)&&((ue=A==null?void 0:A.tokens)==null?void 0:ue.items)&&A.tokens.items.length>0){const be=A.tokens.items,_e=new Map;Q.forEach(Ne=>{Ne.address&&_e.set(Ne.address.toLowerCase(),!0)}),be.forEach(Ne=>{const pe=Ne.id.toLowerCase();_e.has(pe)||Q.push(R(Ne))}),console.log("[TokenList] Added GraphQL tokens. Total tokens:",Q.length,"from GraphQL:",be.length,"isLoadingGraphQL:",k)}Q.length===0&&(console.warn("[TokenList] No tokens found, using DEFAULT_TOKENS"),Q=Ik);const ie="0x0000000000000000000000000000000000000000";if(!Q.some(be=>{var _e,Ne,pe;return((_e=be.address)==null?void 0:_e.toLowerCase())===ie.toLowerCase()||((Ne=be.symbol)==null?void 0:Ne.toUpperCase())==="BERA"&&((pe=be.address)==null?void 0:pe.toLowerCase())!=="0x6969696969696969696969696969696969696969"})){const be=Q.find(Ne=>{var pe,Te;return((pe=Ne.address)==null?void 0:pe.toLowerCase())==="0x6969696969696969696969696969696969696969"||((Te=Ne.symbol)==null?void 0:Te.toUpperCase())==="WBERA"}),_e={address:ie,symbol:"BERA",name:"Berachain",decimals:18,logoUri:"https://res.cloudinary.com/duv0g402y/raw/upload/v1717773645/src/assets/bera.png",totalSupply:"0",lastPrice:(be==null?void 0:be.priceUSD)||(be==null?void 0:be.lastPrice)||0,priceUSD:(be==null?void 0:be.priceUSD)||(be==null?void 0:be.lastPrice)||0,status:"IN_POOL",balance:"",balanceUSD:0};Q.unshift(_e),console.log("[TokenList] Added BERA native token (not found in backend response)")}return Q},[s,d,p,b,A,R]),K=((Y=(Z=p==null?void 0:p.data)==null?void 0:Z.tokens)==null?void 0:Y.some(Q=>Q.balance&&parseFloat(Q.balance)>0))||!1,{balances:q,isLoading:G}=yze(K?[]:z),I=M.useMemo(()=>{const Q=C?dt(w,18):"0",ee=gg.toLowerCase(),ie=Mn.toLowerCase(),re=z.find(ue=>{var be,_e,Ne;return((be=ue.symbol)==null?void 0:be.toUpperCase())==="BERA"||((_e=ue.address)==null?void 0:_e.toLowerCase())===ie||((Ne=ue.symbol)==null?void 0:Ne.toUpperCase())==="WBERA"}),oe=(re==null?void 0:re.priceUSD)||(re==null?void 0:re.lastPrice)||0,de=T!=null&&T.value?dt(T.value,18):"0",he=z.map(ue=>{var pe,Te,ve;const be=(pe=ue.address)==null?void 0:pe.toLowerCase();if(be===ee||((Te=ue.symbol)==null?void 0:Te.toUpperCase())==="BGT"){const xe=parseFloat(Q),Ye=oe>0?xe*oe:0;return{...ue,balance:Q,balanceUSD:Ye,priceUSD:oe}}if(be===ie||((ve=ue.symbol)==null?void 0:ve.toUpperCase())==="BERA"&&be!=="0x6969696969696969696969696969696969696969"){const xe=ue.balance||"",ze=(xe?parseFloat(xe):0)>0?xe:de,ft=parseFloat(ze);if(ft>0){const lt=ue.priceUSD||ue.lastPrice||oe||0,We=lt>0?ft*lt:0;return{...ue,balance:ze,balanceUSD:We,priceUSD:lt,lastPrice:lt}}return{...ue,balance:"",balanceUSD:0,priceUSD:ue.priceUSD||ue.lastPrice||oe||0,lastPrice:ue.priceUSD||ue.lastPrice||oe||0}}const _e=ue.balance||"",Ne=_e?parseFloat(_e):0;if(Ne>0){if(ue.balanceUSD&&ue.balanceUSD>0)return{...ue,priceUSD:ue.priceUSD||ue.lastPrice||0,lastPrice:ue.priceUSD||ue.lastPrice||0};const xe=ue.priceUSD||ue.lastPrice||0,Ye=xe>0?Ne*xe:0;return{...ue,balanceUSD:Ye,priceUSD:xe,lastPrice:xe}}if(be&&q[be]){const xe=q[be],Ye=parseFloat(xe),ze=ue.priceUSD||ue.lastPrice||0,ft=Ye>0&&ze>0?Ye*ze:0;return{...ue,balance:xe,balanceUSD:ft,priceUSD:ze}}return{...ue,priceUSD:ue.priceUSD||ue.lastPrice||0,lastPrice:ue.priceUSD||ue.lastPrice||0}});return console.log("[TokenList] Balances injected:",{totalTokens:he.length,tokensWithBalance:he.filter(ue=>parseFloat(ue.balance||"0")>0).length,multicallBalancesCount:Object.keys(q).length,sampleTokens:he.slice(0,5).map(ue=>
7419({symbol:ue.symbol,balance:ue.balance,priceUSD:ue.priceUSD,balanceUSD:ue.balanceUSD}))}),he},[z,w,C,q,T]),S=Vre(I,void 0,7),v=I.find(Q=>{var ee,ie;return((ee=Q.address)==null?void 0:ee.toLowerCase())==="0xa1b644aec990ad6023811ced36e6a2d6d128c7c9"||((ie=Q.symbol)==null?void 0:ie.toUpperCase())==="IR"}),_=I.find(Q=>{var ee,ie,re;return((ee=Q.address)==null?void 0:ee.toLowerCase())==="0x59a61b8d3064a51a95a5d6393c03e2152b1a2770"||((ie=Q.symbol)==null?void 0:ie.toUpperCase())==="SAIL.R"||((re=Q.symbol)==null?void 0:re.toUpperCase())==="SAILR"});console.log("[TokenList] tokensWithBalances:",I.length,I.map(Q=>Q.symbol)),console.log("[TokenList] popularTokens:",S.length,S.map(Q=>Q.symbol)),console.log("[TokenList] excludeToken:",r==null?void 0:r.symbol,r==null?void 0:r.address),console.log("[TokenList] IR token in list:",v?{symbol:v.symbol,address:v.address}:"NOT FOUND"),console.log("[TokenList] SAIL.r token in list:",_?{symbol:_.symbol,address:_.address}:"NOT FOUND");const N=M.useMemo(()=>{let Q=I;if(o){const ie=gg.toLowerCase();Q=Q.filter(re=>{var oe,de;return((oe=re.address)==null?void 0:oe.toLowerCase())!==ie&&((de=re.symbol)==null?void 0:de.toUpperCase())!=="BGT"}),console.log("[TokenList] Excluded BGT from output selector")}if(r&&r.address){const ie=Q.length;Q=Q.filter(re=>re.address&&re.address.toLowerCase()!==r.address.toLowerCase()),console.log("[TokenList] After excludeToken filter:",ie,"->",Q.length,"excluded:",r.symbol)}if(a!==""){const ie=a.toLowerCase();Q=Q.filter(re=>re.symbol&&re.symbol.toLowerCase().includes(ie)||re.name&&re.name.toLowerCase().includes(ie)||re.address&&re.address.toLowerCase().includes(ie))}return Q.sort((ie,re)=>{const oe=parseFloat(ie.balance||"0"),de=parseFloat(re.balance||"0"),he=oe>0,ue=de>0;if(he&&!ue)return-1;if(!he&&ue)return 1;const be=ie.balanceUSD||0,_e=re.balanceUSD||0;return he&&ue?be>0&&_e>0?_e-be:be>0&&_e===0?-1:be===0&&_e>0?1:de-oe:be===0&&_e===0?0:be===0?1:_e===0?-1:_e-be})},[I,a,r,o]),$=Q=>{n(Q),e()},U=M.useCallback(Q=>{const ee=l.current;if(!ee)return;const{scrollTop:ie,scrollHeight:re,clientHeight:oe}=ee,de=ie===0,he=ie+oe>=re-1;if(Q.deltaY<0&&de){Q.preventDefault(),Q.stopPropagation();return}if(Q.deltaY>0&&he){Q.preventDefault(),Q.stopPropagation();return}},[]),j=M.useRef(null),D=M.useCallback(Q=>{const ee=Q.touches[0];j.current=ee.clientY},[]),O=M.useCallback(Q=>{const ee=l.current;if(!ee||j.current===null)return;const re=Q.touches[0].clientY-j.current,{scrollTop:oe,scrollHeight:de,clientHeight:he}=ee,ue=oe===0,be=oe+he>=de-1;if(re>0&&ue){Q.preventDefault(),Q.stopPropagation();return}if(re<0&&be){Q.preventDefault(),Q.stopPropagation();return}},[]),H=M.useCallback(()=>{j.current=null},[]),J=M.useMemo(()=>{if(a!=="")return[];if(!r||!r.address)return console.log("[TokenList] availableTokensForPopular (no exclude):",S.length,S.map(ee=>ee.symbol)),S;const Q=S.filter(ee=>ee.address&&ee.address.toLowerCase()!==r.address.toLowerCase());return console.log("[TokenList] availableTokensForPopular (with exclude):",Q.length,"from",S.length,"excluded:",r.symbol),Q},[S,a,r]);return m.jsxs(eL,{open:t,onClose:e,className:"Modal",overlayClassName:"NetworksList",children:[m.jsx("div",{className:"Modal__Header",children:m.jsxs("div",{className:"Modal__HeaderContent",children:[m.jsx("span",{className:"Modal__HeaderTitle",children:"Select a token"}),m.jsx("button",{className:"Modal__HeaderClose",onClick:e,tabIndex:0,"aria-label":"Close",children:m.jsx("svg",{viewBox:"0 0 16 16",fill:"none",strokeWidth:"8",style:{width:"24px",height:"24px",color:"rgba(255, 255, 255, 0.65)"},children:m.jsx("path",{d:"M12.5303 4.53033C12.8232 4.23744 12.8232 3.76256 12.5303 3.46967C12.2374 3.17678 11.7626 3.17678 11.4697 3.46967L12.5303 4.53033ZM3.46967 11.4697C3.17678 11.7626 3.17678 12.2374 3.46967 12.5303C3.76256 12.8232 4.23744 12.8232 4.53033 12.5303L3.46967 11.4697ZM4.53033 3.46967C4.23744 3.17678 3.76256 3.17678 3.46967 3.46967C3.17678 3.76256 3.17678 4.23744 3.46967 4.53033L4.53033 3.46967ZM11.4697 12.5303C11.7626 12.8232 12.2374 12.8232 12.5303 12.5303C12.8232 12.2374 12.8232 11.7626 12.5303 11.4697L11.4697 12.5303ZM11.4697 3.46967L3.46967 11.4697L4.53033 12.5303L12.5303 4.53033L11.4697 3.46967ZM3.46967 4.53033L11.4697 12.5303L12.5303 11.4697L4.53033 3.46967L3.46967 4.53033Z",fill:"currentColor"})})})]})}),m.jsx(wb,{searchValue:a,setSearchValue:c,networksList:!0}),a===""&&J.length>0&&m.jsx(uze,{tokens:J,onTokenSelect:$,selectedToken:i,isOutputSelector:o}),m.jsx("div",{className:"Modal__Content",ref:l,onWheel:U,onTouchStart:D,onTouchMove:O,onTouchEnd:H,children:F?m.jsx("div",{className:"Modal__Loading",children:Array.from({length:8}).map((Q,ee)=>m.jsxs("div",{className:"Modal__Item Modal__Item--skeleton",children:[m.jsx("div",{className:"Modal__ItemLogo",children:m.jsx("div",{className:"Modal__ItemImage--skeleton"})}),m.jsxs("div",{className:"Modal__ItemInfo",children:[m.jsx("div",{className:"Modal__ItemName--skeleton"}),m.jsx("div",{className:"Modal__ItemDetails",children:m.jsx("div",{className:"Modal__ItemSymbol--skeleton"})})]}),m.jsxs("div",{className:"Modal__ItemBalanceContainer",children:[m.jsx("div",{className:"Modal__ItemBalance--skeleton"}),m.jsx("div",{className:"Modal__ItemPrice--skeleton"})]})]},`skeleton-${ee}`))}):N.length>0?m.jsxs(m.Fragment,{children:[N.map((Q,ee)=>m.jsx(cze,{token:Q,isSelected:(i==null?void 0:i.address)===Q.address,onSelect:$.bind(null,Q)},`${Q.address||Q.symbol}-${ee}`)),G&&!K&&N.length>0&&m.jsx("div",{className:"Modal__LoadingIndicator",children:m.jsx("div",{className:"Modal__LoadingText",children:"Loading balances..."})})]}):m.jsx("div",{className:"Modal__Empty",children:m.jsx("div",{className:"Modal__EmptyText",children:"No tokens found"})})})]})},Ke=({width:t="100%",height:e="20px",borderRadius:n="6px",className:i="",style:s={}})=>{const r={width:typeof t=="number"?`${t}px`:t,height:typeof e=="number"?`${e}px`:e,borderRadius:typeof n=="number"?`${n}px`:n,...s};return m.jsx("div",{className:`shimmer ${i}`,style:r})},t8=({preSelected:t,onSelect:e,onToggleNetworkList:n,onForceOpen:i,forceListOpen:s,showAllTokens:r=!1,excludeToken:o,isOutputSelector:a=!1})=>{const[c,l]=M.useState(!1),[d,h]=M.useState(t||null),{isLoading:p,isError:g,isSuccess:b}=L1(),w=b&&!g;M.useEffect(()=>{h(t||null)},[t]),M.useEffect(()=>{s&&(l(!0),n&&n(!0))},[s,n]);const C=M.useCallback(()=>
7419{if(!e)return;if(c){l(!1),n&&n(!1);return}const A=!0;l(A),n&&n(A),i&&i()},[c,n,i,p,e]),E=M.useCallback(A=>{h(A),l(!1),e&&e(A),n&&n(!1)},[e,n]),T=m.jsx("button",{className:`networkSelector${d?" has-token":""}${c?" open":""}${p||!w?" loading":""}${e?"":" disabled"}`,onClick:C,style:e?{}:{cursor:"default",pointerEvents:"none",opacity:.6},disabled:!e,children:d?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"networkSelector__logoWrapper",children:m.jsx(ws,{logoUri:d.logoUri,symbol:d.symbol,name:d.name,id:d.address,size:40})}),m.jsx("span",{className:"networkSelector__symbol",children:d4({name:d.name,symbol:d.symbol,address:d.address}).symbol})]}):p||!w?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"networkSelector__logoWrapper",children:m.jsx(Ke,{width:40,height:40,borderRadius:"50%",className:"shimmer--circle"})}),m.jsx("span",{className:"networkSelector__symbol",children:m.jsx(Ke,{width:60,height:20,borderRadius:6})})]}):m.jsx("span",{className:"networkSelector__symbol",children:"Select"})});return m.jsxs(m.Fragment,{children:[T,c&&m.jsx(wze,{isOpen:c,onClose:C,onSelect:E,selectedToken:d||t,showAllTokens:r,excludeToken:o,isOutputSelector:a})]})};function i1(t){const e=typeof t=="string"?parseFloat(t):t;if(e===0)return"0";let n="";if(e>=1)n=e.toFixed(2);else if(e>=.01)n=e.toFixed(4);else if(e>=1e-4)n=e.toFixed(6);else return e>0?"<0.0001":"0";return n.replace(/\.?0+$/,"")}const vze=t=>{if(!t||t==="0"||t==="")return 48;const e=t.replace(/[^\d]/g,"").length;if(e<=9){const n=Math.floor((e-1)/3)*7;return Math.max(48-n,34)}else{const n=e-9,i=Math.floor((n-1)/3)+1;return Math.max(34-i*3,16)}},zy=({onToggleNetworkList:t,disabled:e,minimized:n,dominantColor:i,secondaryColor:s,isHomePage:r,selectedToken:o,onAmountChange:a,onTokenSelect:c,value:l,showLabel:d=!0,labelOverride:h,onInputClick:p,onBlur:g,isListOpen:b,excludeToken:w,priceUSDOverride:C})=>{var re;const{address:E}=mn(),T=M.useRef(null),A=M.useRef(!1),k=M.useRef(""),R=JM(),P="0x656b95E550C07a9ffe548bd4085c72418Ceb1dba".toLowerCase(),B=M.useMemo(()=>{var oe,de;return o?((oe=o.address)==null?void 0:oe.toLowerCase())===P||((de=o.symbol)==null?void 0:de.toUpperCase())==="BGT":!1},[o]),F=B?R.bgtBalance:void 0,z=(o==null?void 0:o.address)===Mn,{data:K,isLoading:q,error:G}=wf({address:E,token:!z&&(o!=null&&o.address)?o.address:void 0,query:{enabled:!!o&&
7419!!E&&!!(o!=null&&o.address)&&!B}}),{data:I}=L1(),S=M.useMemo(()=>{var oe;return!o||!((oe=I==null?void 0:I.data)!=null&&oe.tokens)?null:I.data.tokens.find(de=>de.address.toLowerCase()===o.address.toLowerCase())},[o,I]),v=M.useMemo(()=>{var de;if(!B||!((de=I==null?void 0:I.data)!=null&&de.tokens))return 0;const oe=I.data.tokens.find(he=>{var ue,be;return((ue=he.symbol)==null?void 0:ue.toUpperCase())==="BERA"||he.address.toLowerCase()===Mn.toLowerCase()||((be=he.symbol)==null?void 0:be.toUpperCase())==="WBERA"});return(oe==null?void 0:oe.priceUSD)||0},[B,I]),_=M.useMemo(()=>{try{if(B){const oe=F!=null?typeof F=="bigint"?F:BigInt(F||0):0n;let de="0";try{de=dt(oe,18)}catch(he){console.error("[FromInput] Error formatting BGT balance:",he),de=oe.toString()}return{value:oe,decimals:18,symbol:"BGT",formatted:de}}return K||null}catch(oe){return console.error("[FromInput] Error in balance useMemo:",oe),null}},[B,F,K]),N=M.useMemo(()=>C!=null&&C>0?C:B?v:(S==null?void 0:S.priceUSD)||0,[C,B,v,S==null?void 0:S.priceUSD]),$=B?!1:q;B&&console.log("[FromInput] BGT balance:",{bgtAvailableBalance:F==null?void 0:F.toString(),bgtPriceUSD:v,finalBalance:((re=_==null?void 0:_.value)==null?void 0:re.toString())||"0",usdValue:N});const[U,j]=M.useState(""),[D,O]=M.useState(!1),H=M.useRef(""),J=M.useMemo(()=>l===0n?0:(N*+dt(l,(o==null?void 0:o.decimals)||18)).toFixed(2),[N,l,o==null?void 0:o.decimals]),W=M.useMemo(()=>vze(U),[U]),Z=M.useMemo(()=>W+8,[W]),Y=M.useMemo(()=>!_||_.value===void 0?!1:l>_.value,[l,_]);M.useEffect(()=>{if(!A.current){const oe=l===0n?"":dt(l,(o==null?void 0:o.decimals)||18);if(k.current&&l>0n)try{if(hs(k.current,(o==null?void 0:o.decimals)||18)===l){j(k.current),H.current=k.current;return}}catch{}if(U==="0."&&l===0n)return;j(oe),H.current=oe}},[l,o==null?void 0:o.decimals,U]);const Q=oe=>{const de=oe.target.value;let he=de.replace(",",".");he=he.replace(/[^\d.]/g,"");const ue=H.current||U;if(he===""){j(""),H.current="",A.current=!0,k.current="",a(0n);return}if(he==="0."&&ue&&ue.startsWith("0.")&&ue.length>2&&de.length<ue.length){he="",j(""),H.current="",A.current=!0,k.current="",a(0n);return}he==="0"&&ue!=="0."&&de.length>=ue.length&&(he="0.");const be=he.split(".");if(be.length>2&&(he=be[0]+"."+be.slice(1).join("")),be.length===2&&be[1].length>18&&(he=be[0]+"."+be[1].substring(0,18)),j(he),A.current=!0,k.current=he,H.current=he,/^\d*(\.\d*)?$/.test(he)&&he!=="")try{a(hs(he==="0."?"0":he,(o==null?void 0:o.decimals)||18))}catch{console.warn("Invalid input amount:",he)}else he===""&&(k.current="",a(0n))},ee=()=>{A.current=!1,k.current="",U!=="0."&&(j(l===0n?"":dt(l,(o==null?void 0:o.decimals)||18)),H.current=l===0n?"":dt(l,(o==null?void 0:o.decimals)||18))},ie=()=>{if(T.current){if(!_||_.value===void 0||!o){console.warn("[FromInput] Cannot set max: balance or token not available");return}const oe=_.value,de=o.address===Mn?hs("0.001",o.decimals||18):0n,he=o.address===Mn?oe>de?oe-de:0n:oe;T.current.value=dt(he,o.decimals||18),a(he)}};return m.jsxs("div",{className:`Inputs__From From From--${Y?"error":"idle"}`,children:[d&&m.jsx("div",{className:"From__Label",children:m.jsx("p",{children:h||"You pay"})}),m.jsxs("div",{className:"From__AmountsAndChain",children:[m.jsx("div",{className:"From__Amounts",style:{position:"relative",width:"100%",overflow:"hidden",minWidth:0},children:m.jsx("input",{ref:T,className:"From__Input",type:"text",inputMode:"decimal",placeholder:"0",value:U,onChange:Q,onFocus:()=>O(!0),onBlur:()=>{O(!1),ee(),typeof g=="function"&&g()},min:0,style:{color:Y?"#FF7456":void 0,fontSize:`${W}px`,lineHeight:`${Z}px`,height:`${Z}px`,verticalAlign:"middle",boxSizing:"border-box",width:"100%",textAlign:"left",overflow:"hidden"},readOnly:e,onClick:oe=>{e&&p&&(oe.stopPropagation(),p())}})}),m.jsx("div",{className:"From__LogosAndBalance",children:m.jsx("div",{className:`From__Logos${e?" From__disabled":""}`,children:m.jsx(t8,{preSelected:o,onToggleNetworkList:t,minimized:n,dominantColor:i,secondaryColor:s,isHomePage:r,onSelect:c,onForceOpen:p,forceListOpen:b,excludeToken:w,showAllTokens:!0})})})]}),m.jsxs("div",{className:"From__Details",children:[m.jsxs("p",{className:"From__Convertion",children:["$",J]}
7419),m.jsx("div",{className:"From__Balance",children:o&&m.jsx(m.Fragment,{children:$?m.jsx(Ke,{width:60,height:20,borderRadius:6}):_&&_.value!==void 0?m.jsx("p",{className:`From__Amount${Y?" From__Amount--error":""} From__Amount--clickable`,onClick:ie,style:{cursor:"pointer"},children:i1(dt(_.value,(o==null?void 0:o.decimals)||18))}):m.jsx("p",{className:"From__Amount",children:"-"})})})]})]})};zy.displayName="FromInput";function q5(t,e,n=6){const i=dt(t,e),[s,r]=i.split(".");let o;try{const l=parseFloat(s);isFinite(l)&&l<Number.MAX_SAFE_INTEGER?o=l.toLocaleString("en-US",{maximumFractionDigits:0,useGrouping:!0}):o=s.replace(/\B(?=(\d{3})+(?!\d))/g,",")}catch{o=s}if(!r)return o;const c=r.slice(0,n).replace(/0+$/,"");return c===""?o:`${o}.${c}`}const Cze=t=>{if(!t||t==="0"||t==="")return 48;const e=t.replace(/[^\d]/g,"").length;if(e<=9){const n=Math.floor((e-1)/3)*7;return Math.max(48-n,34)}else{const n=e-9,i=Math.floor((n-1)/3)+1;return Math.max(34-i*3,16)}},II=kn.memo(({preSelected:t,onSelect:e,onToggleNetworkList:n,dominantColor:i,secondaryColor:s,isHomePage:r,inputValue:o,onInputChange:a,disabled:c=!1,onInputClick:l,onBlur:d,excludeToken:h,labelOverride:p,isOverBalance:g=!1,isLoadingRoute:b=!1,priceUSDOverride:w})=>{const C=M.useRef(null),[E,T]=M.useState(""),[A,k]=M.useState(!1),[R,P]=M.useState(!1),[B,F]=M.useState(!1),z=M.useRef(null),K=M.useRef(""),q=M.useRef(0n),{address:G}=mn(),{data:I,isLoading:S}=wf({address:G,token:(t==null?void 0:t.address)!==Mn?t==null?void 0:t.address:void 0,query:{enabled:!!t}}),{data:v}=L1(),_=M.useMemo(()=>{var Q;return!t||!((Q=v==null?void 0:v.data)!=null&&Q.tokens)?null:v.data.tokens.find(ee=>ee.address.toLowerCase()===t.address.toLowerCase())},[t,v]),N=I,$=w!=null&&w>0?w:(_==null?void 0:_.priceUSD)||0,U=S;M.useEffect(()=>{T(""),k(!1)},[]),M.useEffect(()=>{if(o>0n&&(q.current=o),o===0n){if(A||q.current>0n)return;E!==""&&T("");return}const Q={USDT0:6,"USDâ®0":6,USDT:6,USDC:6,"USDC.E":6,"USDC.e":6},ee=(t==null?void 0:t.symbol)||"",ie=Q[ee],re=ie||(t!=null&&t.decimals&&t.decimals>0&&t.decimals<=18?t.decimals:18);console.log("[SwapToInput] Decimals calculation:",{tokenSymbol:ee,overrideDecimals:ie,tokenDecimals:t==null?void 0:t.decimals,finalDecimals:re,inputValue:o.toString()});const oe=q5(o,re,6);(!A||oe!==E)&&(console.log("[SwapToInput] Updating display value:",{inputValue:o.toString(),formattedValue:oe,decimals:re,isUserTyping:A,currentDisplay:E}),T(oe))},[o,t==null?void 0:t.decimals,A,E]),M.useEffect(()=>{o===0n&&(T(""),k(!1))},[o]);const j=Q=>Q?{USDT0:6,"USDâ®0":6,USDT:6,USDC:6,"USDC.E":6,"USDC.e":6}[Q.symbol||""]||(Q.decimals&&Q.decimals>0&&Q.decimals<=18?Q.decimals:18):18,D=M.useMemo(()=>{if(o===0n)return 0;const Q=j(t);return($*+dt(o,Q)).toFixed(2)},[$,o,t]),O=M.useMemo(()=>Cze(E),[E]),H=M.useMemo(()=>O+8,[O]);M.useEffect(()=>{if(z.current&&C.current&&E){const Q=z.current.offsetWidth,ee=C.current.offsetWidth;F(Q>ee)}else F(!1)},[E,O]);const J=M.useMemo(()=>{var re;if(!B||!E)return{showRightEllipsis:!1};const Q=((re=C.current)==null?void 0:re.offsetWidth)||200,ee=O*.6,ie=Math.max(10,Math.floor(Q/ee)-3);return{showRightEllipsis:!R&&E.length>ie}},[E,B,R,O]),W=E,Z=M.useCallback(Q=>{let ee=Q.target.value;if(ee=ee.replace(/\.\.\./g,""),ee=ee.replace(",","."),ee=ee.replace(/[^\d.]/g,""),R&&A&&B&&E&&W&&W.startsWith("...")){const oe=W.replace(/^\.\.\./,"");if(ee.length>oe.length){const de=ee.slice(oe.length);ee=E+de}else if(ee.length===oe.length&&ee!==oe)if(E.includes(".")){const[de,he]=E.split(".");ee.includes(".")?ee=de+"."+ee.split(".")[1]:ee=E.slice(0,-oe.length)+ee+(he?"."+he:"")}else ee=E.slice(0,-oe.length)+ee;else if(ee.length<oe.length)if(E.includes(".")){const[de,he]=E.split(".");if(ee.includes("."))ee=de+"."+ee.split(".")[1];else{const ue=ee;ee=E.slice(0,-oe.length)+ue+(he?"."+he:"")}}else ee=E.slice(0,-oe.length)+ee;ee===oe&&E.length>oe.length&&(ee=E)}ee.startsWith(".")&&E&&E.includes(".")?ee=E.split(".")[0]+ee:ee.startsWith(".")&&E&&!E.includes(".")&&(ee=E+ee);const ie=K.current||E;ee==="0"&&ie!=="0."&&(ee="0.");const re=ee.split(".");if(re.length>2&&(ee=re[0]+"."+re.slice(1).join("")),re.length===2&&re[1].length>18&&(ee=re[0]+"."+re[1].substring(0,18)),K.current=E,T(ee),k(!0),ee==="")a(0n);else if(/^\d*(\.\d*)?$/.test(ee))try{const de=hs(ee==="0."?"0":ee,(t==null?void 0:t.decimals)||18);de>=0n&&a(de)}catch{console.warn("Invalid input amount:",ee)}},[a,t==null?void 0:t.decimals,E,R,A,B,W]),Y=M.useCallback(()=>{P(!1),k(!1);const Q=j(t),ee=o===0n?"":dt(o,Q);ee!==""&&ee!==E&&o>0n&&T(ee),E===""&&o===0n&&T(""),d&&d()},[o,t,d,E]);return m.jsxs("div",{className:"Inputs__To To",children:[m.jsx("div",{className:"From__Label",children:m.jsx("p",{children:p||"You receive"})}),m.jsxs("div",{className:"From__AmountsAndChain",children:[m.jsxs("div",{className:"From__Amounts",style:{position:"relative",width:"100%",overflow:"hidden",minWidth:0},children:[m.jsx("span",{ref:z,style:{position:"absolute",visibility:"hidden",
7419whiteSpace:"nowrap",fontSize:`${O}px`,fontFamily:'"TT Hoves", system-ui, sans-serif',fontWeight:400,top:"-9999px",left:"-9999px"},children:E||"0"}),b&&o===0n?m.jsx("div",{style:{width:"100%",height:`${H}px`,display:"flex",alignItems:"center"},children:m.jsx(Ke,{width:"100%",height:O,borderRadius:4})}):m.jsx("input",{ref:C,className:g?"From__Input From__Input--error":"From__Input",value:W,type:"text",inputMode:"decimal",placeholder:"0",style:{color:g?"#FF7456":void 0,fontSize:`${O}px`,lineHeight:`${H}px`,height:`${H}px`,verticalAlign:"middle",boxSizing:"border-box",width:"100%",textAlign:"left",overflow:"hidden",textOverflow:J.showRightEllipsis?"ellipsis":"clip",paddingRight:J.showRightEllipsis?"24px":"0"},onChange:Z,onFocus:()=>P(!0),onBlur:Y,readOnly:c,onClick:c?l:void 0})]}),m.jsx("div",{className:"From__LogosAndBalance",children:m.jsx("div",{className:"To__Logos",children:m.jsx(t8,{preSelected:t,onSelect:e,onToggleNetworkList:n,dominantColor:i,secondaryColor:s,isHomePage:r,excludeToken:h,showAllTokens:!0,isOutputSelector:!0})})})]}),m.jsxs("div",{className:"From__Details",children:[m.jsxs("p",{className:"From__Convertion",children:["$",D]}),m.jsx("div",{className:"From__Balance",style:{display:"flex",alignItems:"baseline"},children:t&&(U?m.jsx(Ke,{width:80,height:20,borderRadius:6}):m.jsx("p",{className:"From__Amount From__Amount--clickable",style:{margin:0,fontWeight:500},onClick:()=>{try{if(!t||!(N!=null&&N.value)){console.warn("[SwapToInput] Cannot set max: token or balance not available");return}const Q={USDT0:6,"USDâ®0":6,USDT:6,USDC:6,"USDC.E":6,"USDC.e":6},ee=t.symbol||"",ie=Q[ee],re=ie||(t.decimals&&t.decimals>0&&t.decimals<=18?t.decimals:18),oe=t.address===Mn?N.value*99n/100n:N.value,de=dt(oe,re);q.current=oe,k(!0),T(de),a(oe),setTimeout(()=>{k(!1)},300)}catch(Q){console.error("[SwapToInput] Error in balance click:",Q)}},children:(()=>{try{if(!(N!=null&&N.value))return"0.0000";const ie={USDT0:6,"USDâ®0":6,USDT:6,USDC:6,"USDC.E":6,"USDC.e":6}[t.symbol||""]||(t.decimals&&t.decimals>0&&t.decimals<=18?t.decimals:18);return(+dt(N.value,ie)).toFixed(4)}catch(Q){return console.error("[SwapToInput] Error formatting balance:",Q),"0.0000"}})()}))})]})]})});II.displayName="SwapToInput";const DI=({onClick:t,isActive:e,mode:n="swap"})=>{const i=n==="deposit";return m.jsx("div",{className:"Divider",onClick:t,style:{cursor:t&&e?"pointer":"default"},children:m.jsx("div",{className:"Divider__imgWrapper",style:i?{width:"28px",height:"28px"}:void 0,children:i?m.jsx("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{filter:"brightness(0) invert(1)"},children:m.jsx("path",{d:"M14 8V20M8 14H20",stroke:"#FFFFFF",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}):m.jsx("img",{src:"/assets/components/buttonswapnew.png",alt:"Swap",style:{width:"22px",height:"22px",objectFit:"contain",filter:"brightness(0) invert(1)"}})})})},n8=(t,e)=>{if(t.length!==e.length+1)throw new Error("Invalid path: tokens length must be fees length + 1");let n="0x";for(let i=0;i<e.length;i++)n=n+t[i].slice(2)+e[i].toString(16).padStart(6,"0");return n=n+t[t.length-1].slice(2),n},vE=(t,e)=>{if(t===0n)return 0n;const n=1-e,i=10n**18n,s=BigInt(Math.floor(n*1e18));return t*s/i},Au="0x6969696969696969696969696969696969696969",EG=["0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce","0x0000000000000000000000000000000000000000","0x6969696969696969696969696969696969696969"],Dk=[100,500,3e3,1e4],_G=Owe("100"),SG=1000000000n,xze=3,sr=t=>t===Mn,AG=t=>t===Au,Eze=t=>sr(t)?Au:t,i8=t=>Eze(t),_ze=(t,e)=>{const n=sr(t)&&AG(e),i=AG(t)&&sr(e);return{isWrap:n,isUnwrap:i,normalizedTokenIn:sr(t)&&!n?Au:t,normalizedTokenOut:sr(e)&&!i?Au:e}},OI=(t,e)=>{if(t===e)return!0;const n=i8(t),i=i8(e);return n===i},l2=(t,e=!0)=>t?sr(t)?e:!0:!1,Sze={v3CoreFactory:"0x76fD9D07d5e4D889CAbED96884F15f7ebdcd6B63",quoterV2:"0x35E02133b7Ee5E4cDE7cb7FF278a19c35d4cd965",swapRouter02:"0x86e02f3D4Cb55974B7EE7E7c98c199e65F9023a4",multicall2:"0x2B35c459e86fABd62b9C37fb652091671C5aA3ad",positionManager:"0xEf089afF769bC068520a1A90f0773037eF31fbBC",universalRouter:"0x66a9893cc07d91d95644aedd05d03f95e1dba8af",STICKYVAULT_FACTORY:"0x18B9ABf2E821E2fE7A08Dc255d5a7e77fFc0b844",STICKYVAULT_IMPLEMNTATION:"0x32a56Da6f958BBFB24797DD47C7d1146D55C4052",STICKYVAULT_ROUTER:"0xbb962d8805e2B4AF087C4702F088Cf9BE9862F30",AUTOWIN_ROUTER:"0x674FC8955E28207E12156622DdeB875c7678A15c",AUTOWIN_FACTORY:"0x21b35a3dcF462540cb8EEA0e5d8594FF9e93C2e1",swapFeeRouter:"0x12a32bD76E1a1e41C2E2A90F7B2402a38b9E4e25",feeCollectionAddress:"0x6aa0757bc4ffdC9f0DEB5E9fA08173c07EF2afCc"},vt=Sze,Cm=new Set(["BERA-WBERA","WBERA-BERA","BERA-WGBERA","WGBERA-BERA","WBERA-WGBERA","WGBERA-WBERA","BERA-EWBERA","EWBERA-BERA","WBERA-EWBERA","EWBERA-WBERA","WGBERA-EWBERA","EWBERA-WGBERA","BERA-EWBERA-4","EWBERA-4-BERA","WBERA-EWBERA-4","EWBERA-4-WBERA","WGBERA-EWBERA-4","EWBERA-4-WGBERA","HONEY-NECT","NECT-HONEY","BERA-HONEY","HONEY-BERA","BERA-NECT","NECT-BERA","WBERA-HONEY","HONEY-WBERA","WBERA-NECT","NECT-WBERA","WGBERA-HONEY","HONEY-WGBERA","WGBERA-NECT","NECT-WGBERA","
7419EWBERA-HONEY","HONEY-EWBERA","EWBERA-NECT","NECT-EWBERA","EWBERA-4-HONEY","HONEY-EWBERA-4","EWBERA-4-NECT","NECT-EWBERA-4"]);function Aze(t,e,n,i){const s=d=>d==null?void 0:d.toUpperCase().trim(),r=s(t),o=s(e),a=`${r}-${o}`,c=`${o}-${r}`,l=Cm.has(a)||Cm.has(c);return(r==="USDT0"||o==="USDT0"||r==="USDE"||o==="USDE")&&console.log("[shouldUseLocalRoute] USDT0/USDE routing check:",{symbolA:r,symbolB:o,pairKey:a,reversePairKey:c,hasPairKey:Cm.has(a),hasReversePairKey:Cm.has(c),result:l,LOCAL_ROUTE_PAIRS_SIZE:Cm.size,LOCAL_ROUTE_PAIRS_HAS_USDT0:Array.from(Cm).some(d=>d.includes("USDT0")),LOCAL_ROUTE_PAIRS_HAS_USDE:Array.from(Cm).some(d=>d.includes("USDE"))}),l}const TG=[{constant:!0,inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],type:"function"}],Tze=({tokens:t,maxTokens:e=10})=>{const[n,i]=M.useState({}),[s,r]=M.useState({}),[o,a]=M.useState(!1),{address:c,isConnected:l}=mn(),d=M.useMemo(()=>!t||t.length===0?[]:t.filter(g=>g.symbol==="BERA"||g.symbol==="wBERA"||g.symbol==="WBERA"||g.symbol==="HONEY"||g.symbol==="iBERA"||g.symbol==="POLLEN"||g.symbol==="WBTC"||g.symbol==="DOLO"||g.symbol==="USDâ®0"||g.symbol==="USDC"||g.symbol==="USDT"||g.symbol==="WETH"||g.symbol==="NECT").slice(0,e),[t,e]),h=M.useMemo(()=>d.map(p=>({address:p.address==="0x0000000000000000000000000000000000000000"?void 0:p.address,symbol:p.symbol,decimals:p.decimals})),[d]);return M.useEffect(()=>{if(!c||!l||!h.length){i({}),r({}),a(!1);return}let p=!1;a(!0);const b=eS({chain:bu,transport:ip("https://partners.rpc-mainnet.berachain.com/?apikey=OMxUxBb9r39hhIkIu8WMXYm")});async function w(){try{const C=await Promise.all(h.map(async E=>{try{let T;if(E.address){let A=E.decimals;if(A==null)try{A=Number(await b.readContract({address:E.address,abi:TG,functionName:"decimals"}))}catch{A=18}const k=await b.readContract({address:E.address,abi:TG,functionName:"balanceOf",args:[c]});T=dt(k,A)}else{const A=await b.getBalance({address:c});T=w6(A)}return{symbol:E.symbol,balance:T,address:E.address||"0x0000000000000000000000000000000000000000"}}catch(T){return console.warn(`Failed to fetch balance for ${E.symbol}:`,T),{symbol:E.symbol,balance:"0",address:E.address||"0x0000000000000000000000000000000000000000"}}}));if(!p){const E={};C.forEach(({symbol:T,balance:A})=>{E[T]=A}),i(E),a(!1)}}catch(C){console.error("Error fetching token balances:",C),p||a(!1)}}return w(),()=>{p=!0}},[c,l,h]),{balances:n,balancesUSD:s,loading:o,limitedTokens:d}},kze=` 7420 query GetTokensData { 7421 tokens( 7422 orderBy: "totalValueLockedUSD" 7423 orderDirection: "desc" 7424 limit: 100 7425 ) { 7426 items { 7427 id 7428 symbol 7429 name 7430 decimals 7431 logoUri 7432 totalValueLockedUSD 7433 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7434 items { 7435 priceUSD 7436 marketCap 7437 volume24hUSD 7438 oneDayEvo 7439 oneMonthEvo 7440 fdv 7441 } 7442 } 7443 } 7444 } 7445 } 7446`,Nze=()=>Zt({queryKey:["tokensDataGraphQL"],queryFn:async()=>{const e=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:kze})})).json();if(e.errors)throw new Error(e.errors[0].message);return e.data},staleTime:3e4,enabled:!0}),Ok=(t,e)=>{if(t)return t.find(n=>n.id.toLowerCase()===e.toLowerCase())},kG=t=>{var e,n,i;return(i=(n=(e=t==null?void 0:t.tokenDayData)==null?void 0:e.items)==null?void 0:n[0])!=null&&i.priceUSD?parseFloat(t.tokenDayData.items[0].priceUSD):0},Rx=t=>t!=null&&t.totalValueLockedUSD?parseFloat(t.totalValueLockedUSD):0;function Mk(t,e=[]){return Array.isArray(t)?t:e}const Lk=new Map,Rze=300*1e3,tL=({onlyPoolToken:t=!1,searchValue:e=""}={})=>{const[n,i]=M.useState(!1),[s,r]=M.useState(!1),{data:o,isLoading:a,error:c}=h4(),{isConnected:l}=mn(),{data:d,error:h}=Nze(),{data:p,isLoading:g}=Zt({queryKey:["tokensStatsForList"],queryFn:async()=>{const q=await fetch("https://api.winnieswap.com/token/list");return q.ok?q.json():{data:[]}},staleTime:6e4,enabled:!0}),b=Mk(o),w=M.useMemo(()=>{var _;if(!o||a)return[];const q=Mk(o),S=(t?q.filter(N=>N.status==="IN_POOL"||N.address===Mn):q).filter(N=>N.symbol!=="BGT").reduce((N,$)=>{const U=$.address.toLowerCase();return N.has(U)||N.set(U,$),N},new Map);let v=Array.from(S.values());if((_=d==null?void 0:d.tokens)!=null&&_.items){const N=d.tokens.items,$=new Map(N.map(U=>[U.id.toLowerCase(),U]));v=v.sort((U,j)=>{const D=$.get(U.address.toLowerCase()),O=$.get(j.address.toLowerCase());return!D&&!O?0:D?O?Rx(O)-Rx(D):-1:1})}return e===""?v:v.filter(N=>N.name.toLowerCase().includes(e.toLowerCase())||N.symbol.toLowerCase().includes(e.toLowerCase())||N.address.toLowerCase().includes(e.toLowerCase()))},[e,o,a,t,d]),C=M.useMemo(()=>{var I,S,v;const q=new Map,G=((I=d==null?void 0:d.tokens)==null?void 0:I.items)||[];for(const _ of G){const N=Rx(_);N>
74460&&q.set(_.id.toLowerCase(),N)}if(q.size===0&&p){const _=p||[];for(const N of _){const $=N.address,U=((v=(S=N==null?void 0:N.TokenDailyStats)==null?void 0:S[0])==null?void 0:v.marketCap)||0;$&&q.set(String($).toLowerCase(),Number(U)||0)}}return q},[d,p]),{balances:E,loading:T}=Tze({tokens:b,maxTokens:15}),A=M.useCallback(q=>{var S,v,_,N,$,U;let G=0;const I=Ok((S=d==null?void 0:d.tokens)==null?void 0:S.items,q.address);if(G=kG(I),G===0&&q.address===Mn){const j=Ok((v=d==null?void 0:d.tokens)==null?void 0:v.items,"0x6969696969696969696969696969696969696969");G=kG(j)}if(G===0){const j=p==null?void 0:p.find(D=>{var O,H;return((O=D.address)==null?void 0:O.toLowerCase())===((H=q.address)==null?void 0:H.toLowerCase())});if(G=((N=(_=j==null?void 0:j.TokenDailyStats)==null?void 0:_[0])==null?void 0:N.price)||0,G===0&&q.address===Mn){const D=p==null?void 0:p.find(O=>{var H;return O.symbol==="wBERA"||((H=O.address)==null?void 0:H.toLowerCase())==="0x6969696969696969696969696969696969696969"});G=((U=($=D==null?void 0:D.TokenDailyStats)==null?void 0:$[0])==null?void 0:U.price)||0}G===0&&(G=q.lastPrice||0)}return G},[d,p]),k=M.useCallback(q=>{var S;const G=Ok((S=d==null?void 0:d.tokens)==null?void 0:S.items,q.address);if(G)return Rx(G);let I=C.get(q.address.toLowerCase())||0;return q.symbol==="WBERA"&&I===0&&(I=1e6),I},[d,C]),R=M.useCallback(q=>{if(!q.length)return q;const G=I=>{const S=E[I.symbol];if(!S)return 0;const v=parseFloat(S);if(!v||!isFinite(v)||v<=0)return 0;const _=A(I);return v*_};if(l){const I=[],S=[];for(const v of q)G(v)>0?I.push(v):S.push(v);return I.sort((v,_)=>{const N=G(v);return G(_)-N}),S.sort((v,_)=>{const N=k(v);return k(_)-N}),[...I,...S]}return[...q].sort((I,S)=>{const v=k(I);return k(S)-v})},[E,A,k,l]),P=M.useMemo(()=>{if(!o||a)return[];const q=Mk(o);return t?q.filter(I=>I.status==="IN_POOL"||I.address===Mn):q},[o,a,t]);M.useEffect(()=>{const q=`${t}-${l}-${e}`,G=Lk.get(q),I=Date.now();if(G&&I-G.timestamp<Rze&&G.isConnected===l){r(!0),i(!1);return}if(!a&&!g&&!T&&b.length>0){i(!0);const S=setTimeout(()=>{const v=R(w);Lk.set(q,{tokens:v,popularTokens:P,timestamp:I,isConnected:l}),r(!0),i(!1)},100);return()=>clearTimeout(S)}},[a,g,T,b.length,t,l,e]);const B=()=>{const q=`${t}-${l}-${e}`,G=Lk.get(q);return G&&s?{tokens:G.tokens,popularTokens:G.popularTokens}:{tokens:R(w),popularTokens:P}},{tokens:F,popularTokens:z}=B(),K=M.useCallback(q=>{if(q)return b.find(G=>G.address&&G.address.toLowerCase()===q.toLowerCase())},[b]);return{tokens:F,popularTokens:z,isLoading:n||!s,hasError:!!c||!!h,hasTokens:b.length>0,isReady:s,getTokenInfo:K}},Pze=t=>{const{tokenIn:e,tokenOut:n}=t;return M.useMemo(()=>{const i=_ze(e,n),s=i8(e),r=i8(n),o={isWrap:i.isWrap,isUnwrap:i.isUnwrap,needsWrapBefore:sr(e)&&!i.isWrap,needsUnwrapAfter:sr(n)&&!i.isUnwrap};let a=!0,c;return l2(e)?l2(n)?OI(e,n)&&(a=!1,c="Input and output tokens cannot be the same"):(a=!1,c="Invalid output token address"):(a=!1,c="Invalid input token address"),{normalizedTokenIn:s,normalizedTokenOut:r,originalTokenIn:e,originalTokenOut:n,wrapInfo:o,displayTokenIn:e,displayTokenOut:n,isValidPair:a,pairError:c}},[e,n])},z5=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint24",name:"fee",type:"uint24"},{indexed:!0,internalType:"int24",name:"tickSpacing",type:"int24"}],name:"FeeAmountEnabled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token0",type:"address"},{indexed:!0,internalType:"address",name:"token1",type:"address"},{indexed:!0,internalType:"uint24",name:"fee",type:"uint24"},{indexed:!1,internalType:"int24",name:"tickSpacing",type:"int24"},{indexed:!1,internalType:"address",name:"pool",type:"address"}],name:"PoolCreated",type:"event"},{inputs:[{internalType:"address",name:"tokenA",type:"address"},{internalType:"address",name:"tokenB",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"}],name:"createPool",outputs:[{internalType:"address",name:"pool",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickSpacing",type:"int24"}],name:"enableFeeAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint24",name:"",type:"uint24"}],name:"feeAmountTickSpacing",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint24",name:"",type:"uint24"}],name:"getPool",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"parameters",outputs:[{internalType:"address",name:"factory",type:"address"},{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickSpacing",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_owner",type:"address"}],name:"setOwner",outputs:[],stateMutability:"nonpayable",type:"function"}],Ize=["0xc06aD7fF55D1d53Ed9371C17eDC557C9E1A06B2E".toLowerCase(),"0xb27ab73220602b7dcd7daeba83f64659e747aca4".toLowerCase(),"0x01716554a6125db2e140e01a4dc6412813aaf048".toLowerCase()],Mp=t=>Ize.includes(t.toLowerCase()),Dze=t=>{const{tokenIn:e,tokenOut:n,enabled:i=!0}=t,s=YM,[r,o]=M.useState({routes:[],isLoading:!1,error:null}),a=M.useCallback(async(h,p,g)=>{if(!s)return null;try{const b=await s.readContract({address:vt.v3CoreFactory,abi:z5,functionName:"getPool",args:[h,p,g]});return b===Mn||Mp(b)?null:b}catch{return null}},[s]),c=M.useCallback(async(h,p,g=xze)=>{const b=[];try{const w=Dk.map(async E=>await a(h,p,E)?{tokens:[h,p],fees:[E]}:null),C=(await Promise.all(w)).filter(E=>E!==null);if(b.push(...C),g>=2){const T=EG.filter(k=>
7446k!==h&&k!==p).map(async k=>{const R=[],P=Dk.map(async F=>{if(!await a(h,k,F))return[];const K=Dk.map(async G=>await a(k,p,G)?{tokens:[h,k,p],fees:[F,G]}:null);return(await Promise.all(K)).filter(G=>G!==null)}),B=await Promise.all(P);return R.push(...B.flat()),R}),A=await Promise.all(T);b.push(...A.flat())}if(g>=3&&b.length===0){const E=EG.filter(T=>T!==h&&T!==p);for(let T=0;T<E.length&&b.length===0;T++)for(let A=0;A<E.length&&b.length===0;A++){if(T===A)continue;const k=E[T],R=E[A],[P,B,F]=await Promise.all([a(h,k,3e3),a(k,R,500),a(R,p,3e3)]);if(P&&B&&F){b.push({tokens:[h,k,R,p],fees:[3e3,500,3e3]});break}}}return b}catch(w){throw console.error("Route discovery failed:",w),new Error(w instanceof Error?w.message:"Failed to discover routes")}},[a]),l=M.useCallback(async()=>{if(!i||!e||!n||!s){o(h=>({...h,routes:[],error:null}));return}if(e===n){o(h=>({...h,routes:[],error:null}));return}o(h=>({...h,isLoading:!0,error:null}));try{const h=await c(e,n);o({routes:h,isLoading:!1,error:null})}catch(h){console.error("Failed to load routes:",h),o({routes:[],isLoading:!1,error:h instanceof Error?h:new Error("Route loading failed")})}},[i,e,n,s,c]),d=M.useCallback(()=>{l()},[l]);return M.useEffect(()=>{l()},[l]),{routes:r.routes,isLoading:r.isLoading,error:r.error,refresh:d}},s8=[{name:"quoteExactInput",type:"function",inputs:[{name:"path",type:"bytes"},{name:"amountIn",type:"uint256"}],outputs:[{name:"amountOut",type:"uint256"},{name:"sqrtPriceX96AfterList",type:"uint160[]"},{name:"initializedTicksCrossedList",type:"uint32[]"},{name:"gasEstimate",type:"uint256"}],stateMutability:"nonpayable"},{name:"quoteExactInputSingle",type:"function",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"amountIn",type:"uint256"},{name:"fee",type:"uint24"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountOut",type:"uint256"},{name:"sqrtPriceX96After",type:"uint160"},{name:"initializedTicksCrossed",type:"uint32"},{name:"gasEstimate",type:"uint256"}],stateMutability:"nonpayable"}],Zm=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Burn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"Collect",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint128",name:"amount0",type:"uint128"},{indexed:!1,internalType:"uint128",name:"amount1",type:"uint128"}],name:"CollectProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"paid1",type:"uint256"}],name:"Flash",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"observationCardinalityNextOld",type:"uint16"},{indexed:!1,internalType:"uint16",name:"observationCardinalityNextNew",type:"uint16"}],name:"IncreaseObservationCardinalityNext",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Initialize",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"int24",name:"tickLower",type:"int24"},{indexed:!0,internalType:"int24",name:"tickUpper",type:"int24"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Mint",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"feeProtocol0Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1Old",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol0New",type:"uint8"},{indexed:!1,internalType:"uint8",name:"feeProtocol1New",type:"uint8"}],name:"SetFeeProtocol",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"int256",name:"amount0",type:"int256"},{indexed:!1,internalType:"int256",name:"amount1",type:"int256"},{indexed:!1,internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"int24",name:"tick",type:"int24"}],name:"Swap",type:"event"},{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collect",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint128",name:"amount0Requested",type:"uint128"},{internalType:"uint128",name:"amount1Requested",type:"uint128"}],name:"collectProtocol",outputs:[{internalType:"uint128",name:"amount0",type:"uint128"},{internalType:"uint128",name:"amount1",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"fee",outputs:[{internalType:"uint24",name:"",type:"uint24"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeGrowthGlobal0X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"feeGrowthGlobal1X128",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"flash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"}],name:"increaseObservationCardinalityNext",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"liquidity",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxLiquidityPerTick",outputs:[{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"bytes",name:"data",type:"bytes"}],name:"mint",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"observations",outputs:[{internalType:"uint32",name:"blockTimestamp",type:"uint32"},{internalType:"int56",name:"tickCumulative",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityCumulativeX128",type:"uint160"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32[]",name:"secondsAgos",type:"uint32[]"}],name:"observe",outputs:[{internalType:"int56[]",name:"tickCumulatives",type:"int56[]"},{internalType:"uint160[]",name:"secondsPerLiquidityCumulativeX128s",type:"uint160[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"positions",outputs:[{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"feeGrowthInside0LastX128",type:"uint256"},{internalType:"uint256",name:"feeGrowthInside1LastX128",type:"uint256"},{internalType:"uint128",name:"tokensOwed0",type:"uint128"},{internalType:"uint128",name:"tokensOwed1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFees",outputs:[{internalType:"uint128",name:"token0",type:"uint128"},{internalType:"uint128",name:"token1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint8",name:"feeProtocol0",type:"uint8"},{internalType:"uint8",name:"feeProtocol1",type:"uint8"}],name:"setFeeProtocol",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"slot0",outputs:[{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"},{internalType:"int24",name:"tick",type:"int24"},{internalType:"uint16",name:"observationIndex",type:"uint16"},{internalType:"uint16",name:"observationCardinality",type:"uint16"},{internalType:"uint16",name:"observationCardinalityNext",type:"uint16"},{internalType:"uint8",name:"feeProtocol",type:"uint8"},{internalType:"bool",name:"unlocked",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"}],name:"snapshotCumulativesInside",outputs:[{internalType:"int56",name:"tickCumulativeInside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityInsideX128",type:"uint160"},{internalType:"uint32",name:"secondsInside",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"int256",name:"amountSpecified",type:"int256"},{internalType:"uint160",name:"sqrtPriceLimitX96",type:"uint160"},{internalType:"bytes",name:"data",type:"bytes"}],name:"swap",outputs:[{internalType:"int256",name:"amount0",type:"int256"},{internalType:"int256",name:"amount1",type:"int256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int16",name:"",type:"int16"}],name:"tickBitmap",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tickSpacing",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"",type:"int24"}],name:"ticks",outputs:[{internalType:"uint128",name:"liquidityGross",type:"uint128"},{internalType:"int128",name:"liquidityNet",type:"int128"},{internalType:"uint256",name:"feeGrowthOutside0X128",type:"uint256"},{internalType:"uint256",name:"feeGrowthOutside1X128",type:"uint256"},{internalType:"int56",name:"tickCumulativeOutside",type:"int56"},{internalType:"uint160",name:"secondsPerLiquidityOutsideX128",type:"uint160"},{internalType:"uint32",name:"secondsOutside",type:"uint32"},{internalType:"bool",name:"initialized",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"token0",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"token1",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],Oze=t=>{const{routes:e,amountIn:n,enabled:i=!0}=t,s=YM,{getTokenInfo:r}=tL(),[o,a]=M.useState({quotedRoutes:[],isLoading:!1,error:null}),c=M.useCallback(async(b,w,C)=>{if(!s)return null;try{const E=await s.readContract({address:vt.v3CoreFactory,abi:z5,functionName:"getPool",args:[b,w,C]});return E===Mn?null:E}catch(E){const T=(E==null?void 0:E.message)||String(E);return T.includes("CORS")||T.includes("429")||T.includes("Too Many Requests")||T.includes("ERR_FAILED")||T.includes("rpc.walletconnect.org")||console.debug("Failed to check pool existence:",E),null}},[s]),l=M.useCallback(async(b,w)=>{if(!s)return null;try{const[C,E,T,A]=await Promise.all([s.readContract({address:b,abi:Zm,functionName:"slot0"}),s.readContract({address:b,abi:Zm,functionName:"liquidity"}),s.readContract({address:b,abi:Zm,functionName:"token0"}),s.readContract({address:b,abi:Zm,functionName:"token1"})]);return{token0:T,token1:A,fee:w,liquidity:E,sqrtPriceX96:C[0]}}catch(C){const E=(C==null?void 0:C.message)||String(C),T=(C==null?void 0:C.code)||(C==null?void 0:C.status)||"";return E.includes("CORS")||E.includes("Access-Control-Allow-Origin")||E.includes("429")||E.includes("Too Many Requests")||E.includes("ERR_FAILED")||T===429||T==="429"||E.includes("rpc.walletconnect.org")||console.debug("Failed to get pool info:",C),null}},[s]),d=M.useCallback(async(b,w,C)=>{if(!s||!C||C===0n)return null;try{if(b.length===2){const E=await s.readContract({address:vt.quoterV2,abi:s8,functionName:"quoteExactInputSingle",args:[{tokenIn:b[0],tokenOut:b[1],amountIn:C,fee:w[0],sqrtPriceLimitX96:0n}]});return{quote:E[0],gasEstimate:E[3]}}else{const E=n8(b,w),T=await s.readContract({address:vt.quoterV2,abi:s8,functionName:"quoteExactInput",args:[E,C]});return{quote:T[0],gasEstimate:T[3]}}}catch(E){const T=(E==null?void 0:E.message)||String(E),A=(E==null?void 0:E.
7446code)||(E==null?void 0:E.status)||"",k=T.includes("CORS")||T.includes("Access-Control-Allow-Origin")||T.includes("429")||T.includes("Too Many Requests")||T.includes("ERR_FAILED")||A===429||A==="429"||T.includes("rpc.walletconnect.org"),R=T.includes("STF")||T.includes("pool does not exist");return!k&&!R&&console.debug("Quote failed for route:",{tokens:b,fees:w,error:T}),null}},[s]),h=M.useCallback(async()=>{if(!i||!s||e.length===0||!n||n===0n)return[];try{const b=e.map(async E=>{try{const T=await d(E.tokens,E.fees,n);if(!T||T.quote===0n)return null;const A=[],k=E.fees.map(async(B,F)=>{const z=await c(E.tokens[F],E.tokens[F+1],B);return z?l(z,B):null});if((await Promise.all(k)).forEach(B=>{B&&A.push(B)}),A.length!==E.fees.length)return null;const P=await Promise.all(E.tokens.map(B=>r(B)));return P.some(B=>!B)?null:{path:P,fees:E.fees,pools:A,quote:T.quote,gasEstimate:T.gasEstimate}}catch(T){const A=(T==null?void 0:T.message)||String(T);return A.includes("CORS")||A.includes("429")||A.includes("Too Many Requests")||A.includes("ERR_FAILED")||A.includes("rpc.walletconnect.org")||console.error("Failed to quote route:",E,T),null}});return(await Promise.all(b)).filter(E=>E!==null&&E.quote>0n).sort((E,T)=>{const A=1000000000n,k=E.quote-E.gasEstimate*A,R=T.quote-T.gasEstimate*A;return k>R?-1:1})}catch(b){throw console.error("Failed to quote routes:",b),new Error(b instanceof Error?b.message:"Failed to get route quotes")}},[i,s,e,n,d,c,l,r]),p=M.useCallback(async()=>{if(!i||e.length===0){a(b=>({...b,quotedRoutes:[],error:null}));return}if(!n||n===0n){a(b=>({...b,quotedRoutes:[],error:null}));return}a(b=>({...b,isLoading:!0,error:null}));try{const b=await h();a({quotedRoutes:b,isLoading:!1,error:null})}catch(b){console.error("Failed to load quotes:",b),a({quotedRoutes:[],isLoading:!1,error:b instanceof Error?b:new Error("Quote loading failed")})}},[i,e,n,h]),g=M.useCallback(()=>{p()},[p]);return M.useEffect(()=>{p()},[p]),{quotedRoutes:o.quotedRoutes,isLoading:o.isLoading,error:o.error,refresh:g}},Mze=t=>{const{routes:e,amountIn:n,enabled:i=!0}=t,s=YM,{getTokenInfo:r}=tL(),[o,a]=M.useState({optimizedRoute:null,isLoading:!1,error:null}),c=M.useCallback(async(p,g,b)=>{if(!s||!b||b===0n)return null;try{if(p.length===2){const w=await s.readContract({address:vt.quoterV2,abi:s8,functionName:"quoteExactInputSingle",args:[{tokenIn:p[0],tokenOut:p[1],amountIn:b,fee:g[0],sqrtPriceLimitX96:0n}]});return{quote:w[0],gasEstimate:w[3]}}else{const w=n8(p,g),C=await s.readContract({address:vt.quoterV2,abi:s8,functionName:"quoteExactInput",args:[w,b]});return{quote:C[0],gasEstimate:C[3]}}}catch(w){return console.error("Quote failed for route optimization:",{tokens:p,fees:g,error:w}),null}},[s]),l=M.useCallback(async(p,g)=>{if(p.length<2||g<_G)return[];const b=[],w=p.slice(0,3),C=[[70,30],[60,40],[50,50],[80,20],[40,60]];for(const E of C){if(w.length<2)break;try{const T=g*BigInt(E[0])/100n,A=g*BigInt(E[1])/100n,[k,R]=await Promise.all([c(w[0].path.map(P=>P.address),w[0].fees,T),c(w[1].path.map(P=>P.address),w[1].fees,A)]);if(k&&R&&k.quote>0n&&R.quote>0n){const P=k.quote+R.quote,B=k.gasEstimate+R.gasEstimate,F=w[0].path[w[0].path.length-1],z=w[0].path[0],q={type:"split",totalQuote:P,totalGasEstimate:B,quoteFormatted:dt(P,F.decimals),priceImpact:0,routes:[{route:w[0],percentage:E[0],amount:T,quote:k.quote},{route:w[1],percentage:E[1],amount:A,quote:R.quote}],transactionData:null};b.push(q)}}catch(T){console.error("Split route calculation failed:",T)}}return b},[c]),d=M.useCallback(async(p,g)=>{if(p.length===0||!g||g===0n)return null;try{const b=p[0],w=await r(b.path[b.path.length-1].address);if(!w)throw new Error("Cannot resolve output token information");const C={type:"single",totalQuote:b.quote,totalGasEstimate:b.gasEstimate,quoteFormatted:dt(b.quote,w.decimals),priceImpact:0,routes:[{route:b,percentage:100,amount:g,quote:b.quote}],transactionData:null};let E=[];g>=_G&&(E=await l(p,g));const A=[C,...E].reduce((k,R)=>{const P=k.totalQuote-k.totalGasEstimate*SG;return R.totalQuote-R.totalGasEstimate*SG>P?R:k});return console.log("[useSwapOptimizer] Selected best route:",{type:A.type,totalQuote:A.totalQuote.toString()}),A}catch(b){throw console.error("Route optimization failed:",b),new Error(b instanceof Error?b.message:"Failed to optimize routes")}},[r,l]),h=M.useCallback(async()=>
7446{if(!i||e.length===0||!n||n===0n){a(p=>({...p,optimizedRoute:null,error:null}));return}a(p=>({...p,isLoading:!0,error:null}));try{const p=await d(e,n);a({optimizedRoute:p,isLoading:!1,error:null})}catch(p){console.error("Failed to optimize routes:",p),a({optimizedRoute:null,isLoading:!1,error:p instanceof Error?p:new Error("Route optimization failed")})}},[i,e,n,d]);return M.useEffect(()=>{h()},[h]),{optimizedRoute:o.optimizedRoute,isLoading:o.isLoading,error:o.error}},Lze=t=>{const{tokenIn:e,tokenOut:n,amountIn:i,optimizedRoute:s,userBalance:r,isConnected:o=!1}=t;return M.useMemo(()=>{const a=[];if(!e||e===Mn?a.push({field:"tokenIn",message:"Please select an input token",code:"MISSING_TOKEN_IN"}):l2(e)||a.push({field:"tokenIn",message:"Invalid input token address",code:"INVALID_TOKEN_IN"}),!n||n===Mn?a.push({field:"tokenOut",message:"Please select an output token",code:"MISSING_TOKEN_OUT"}):l2(n)||a.push({field:"tokenOut",message:"Invalid output token address",code:"INVALID_TOKEN_OUT"}),e&&n&&OI(e,n)&&a.push({field:"general",message:"Input and output tokens cannot be the same",code:"SAME_TOKENS"}),i<=0n&&a.push({field:"amount",message:"Please enter an amount to swap",code:"INVALID_AMOUNT"}),o!==void 0&&(o||a.push({field:"general",message:"Please connect your wallet to continue",code:"WALLET_NOT_CONNECTED"}),o&&i>0n&&r!==void 0)){const b=i>1000n?i*1n/1000n:1n;r<i-b&&a.push({field:"amount",message:"Insufficient balance for this transaction",code:"INSUFFICIENT_BALANCE"})}const c=e&&n&&!OI(e,n)&&i>0n&&l2(e)&&l2(n);c&&!s&&a.push({field:"general",message:"No trading route found for this pair",code:"NO_ROUTE_FOUND"});const l=a.length===0,d=!!c,h=l&&s!==null&&(o===void 0||o)&&(r===void 0||i>0n&&r>=i);return{isValid:l,errors:a,canEstimate:d,canExecute:h,getFieldError:b=>a.find(w=>w.field===b),hasError:b=>b?a.some(w=>w.field===b):a.length>0}},[e,n,i,s,r,o])},$ze=({tokenAddress:t,spenderAddress:e,amountNeeded:n,enabled:i=!0})=>{const{address:s}=mn(),{data:r=0n,refetch:o}=Si({address:t,abi:Ks,functionName:"allowance",args:s&&e?[s,e]:void 0,query:{enabled:!!s&&!!t&&!!e&&i,refetchInterval:2e3}}),a=M.useMemo(()=>i&&r<n&&n>0n,[r,n,i]),{writeContract:c,data:l,isPending:d,error:h,reset:p}=Ls(),{isLoading:g,isSuccess:b}=Ts({hash:l});M.useEffect(()=>{if(b&&l){const A=setTimeout(()=>{o()},1e3);return()=>clearTimeout(A)}},[b,l,o]);const w=(d||g)&&!b,C=M.useCallback(async()=>{if(!s)throw new Error("Cannot approve: wallet not connected");if(!a)throw new Error("Cannot approve: no approval needed");if(!t)throw new Error("Cannot approve: missing token address");if(!e)throw new Error("Cannot approve: missing spender address (route not ready)");try{await c({address:t,abi:Ks,functionName:"approve",args:[e,2n**256n-1n]})}catch(A){throw new Error(A instanceof Error?A.message:"Token approval failed")}},[s,a,t,e,c]),E=M.useCallback(()=>{o()},[o]),T=M.useCallback(()=>{p()},[p]);return{allowance:r,needsApproval:a,approve:C,reset:T,isApproving:w,approveTxHash:l,isApproveSuccess:b,approveError:h,refresh:E}},NG=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"ETHTransferFailed",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"result",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],Uze=({amount:t,enabled:e=!0})=>{const{address:n}=mn(),{data:i}=$r({address:Au,abi:NG,functionName:"deposit",value:t,query:{enabled:e&&!!n&&t>0n}}),{writeContract:s,isPending:r,data:o,error:a,reset:c}=Ls(),{isLoading:l,isSuccess:d}
7446=Ts({hash:o}),{data:h}=$r({address:Au,abi:NG,functionName:"withdraw",args:[t],query:{enabled:e&&!!n&&t>0n}}),{writeContract:p,isPending:g,data:b,error:w,reset:C}=Ls(),{isLoading:E,isSuccess:T}=Ts({hash:b}),A=r||l,k=g||E,R=M.useCallback(async()=>{if(!(i!=null&&i.request)||!n)throw new Error("Cannot wrap: missing configuration or wallet not connected");if(t<=0n)throw new Error("Cannot wrap: amount must be greater than 0");try{await s(i.request)}catch(F){throw new Error(F instanceof Error?F.message:"BERA wrapping failed")}},[i,n,t,s]),P=M.useCallback(async()=>{if(!(h!=null&&h.request)||!n)throw new Error("Cannot unwrap: missing configuration or wallet not connected");if(t<=0n)throw new Error("Cannot unwrap: amount must be greater than 0");try{await p(h.request)}catch(F){throw new Error(F instanceof Error?F.message:"BERA unwrapping failed")}},[h,n,t,p]),B=M.useCallback(()=>{c(),C()},[c,C]);return{wrap:R,unwrap:P,reset:B,isWrapping:A,isUnwrapping:k,wrapTxHash:o,unwrapTxHash:b,wrapError:a,unwrapError:w,isWrapSuccess:d,isUnwrapSuccess:T}},Sc=[{name:"exactInput",type:"function",inputs:[{name:"params",type:"tuple",components:[{name:"path",type:"bytes"},{name:"recipient",type:"address"},{name:"amountIn",type:"uint256"},{name:"amountOutMinimum",type:"uint256"}]}],outputs:[{name:"amountOut",type:"uint256"}],stateMutability:"payable"},{name:"exactInputSingle",type:"function",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"recipient",type:"address"},{name:"amountIn",type:"uint256"},{name:"amountOutMinimum",type:"uint256"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountOut",type:"uint256"}],stateMutability:"payable"},{name:"unwrapWETH9",type:"function",inputs:[{name:"amountMinimum",type:"uint256"},{name:"recipient",type:"address"}],outputs:[],stateMutability:"payable"},{name:"multicall",type:"function",inputs:[{name:"deadline",type:"uint256"},{name:"data",type:"bytes[]"}],outputs:[{name:"results",type:"bytes[]"}],stateMutability:"payable"}],La=[{name:"swapWithFeesOnInput",type:"function",stateMutability:"payable",inputs:[{name:"inAsset_",type:"address"},{name:"swapAmount_",type:"uint256"},{name:"feeBasisPoints_",type:"uint256"},{name:"swapContract_",type:"address"},{name:"tokenPuller_",type:"address"},{name:"swapCallData_",type:"bytes"}],outputs:[]},{name:"swapFromEthWithFeesOnInput",type:"function",stateMutability:"payable",inputs:[{name:"feeBasisPoints_",type:"uint256"},{name:"swapContract_",type:"address"},{name:"swapCallData_",type:"bytes"}],outputs:[]},{name:"swapFromEthWithFeesOnOutput",type:"function",stateMutability:"payable",inputs:[{name:"outAsset_",type:"address"},{name:"feeBasisPoints_",type:"uint256"},{name:"swapContract_",type:"address"},{name:"swapCallData_",type:"bytes"}],outputs:[]},{name:"swapToEthWithFeesOnInput",type:"function",stateMutability:"nonpayable",inputs:[{name:"inAsset_",type:"address"},{name:"swapAmount_",type:"uint256"},{name:"feeBasisPoints_",type:"uint256"},{name:"swapContract_",type:"address"},{name:"tokenPuller_",type:"address"},{name:"swapCallData_",type:"bytes"}],outputs:[]},{name:"isWhitelisted",type:"function",stateMutability:"view",inputs:[{name:"contract_",type:"address"}],outputs:[{name:"",type:"bool"}]},{name:"feeBasisPoints",type:"function",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{name:"ETHTransferFailed",type:"error",inputs:[{name:"errorData",type:"bytes"}]},{name:"FeeBasisPointsNotRespected",type:"error",inputs:[{name:"expectedFeeBasisPoints_",type:"uint256"},{name:"actualFeeBasisPoints_",type:"uint256"}]},{name:"ContractNotWhitelisted",type:"error",inputs:[{name:"callee",type:"address"}]},{name:"RenterAttempted",type:"error",inputs:[]},{name:"SwapCallFailed",type:"error",inputs:[{name:"errorData",type:"bytes"}]},{name:"InsufficientBalance",type:"error",inputs:[{name:"required",type:"uint256"},{name:"available",type:"uint256"}]},{name:"InsufficientAllowance",type:"error",inputs:[{name:"required",type:"uint256"},{name:"available",type:"uint256"}]},{name:"InvalidAmount",type:"error",inputs:[]},{name:"InvalidCallData",type:"error",inputs:[]},{name:"InsufficientInputAmount",type:"error",inputs:[]},{name:"InsufficientOutputAmount",type:"error",inputs:[]},{name:"InvalidPrice",type:"error",inputs:[]},{name:"InvalidPath",type:"error",inputs:[]},{name:"AmountTooLarge",type:"error",inputs:[]},{name:"AmountTooSmall",type:"error",inputs:[]},{name:"InsufficientLiquidity",type:"error",inputs:[]},{name:"STF",type:"error",inputs:[]},{name:"SPL",type:"error",inputs:[]},{name:"InsufficientBalance",type:"error",inputs:[]},{name:"InsufficientBalanceWithParams",type:"error",inputs:[{name:"required",type:"uint256"},{name:"available",type:"uint256"}]},{name:"InsufficientOutputAmount",type:"error",inputs:[{name:"amountOutMinimum",type:"uint256"},{name:"amountOut",type:"uint256"}]},{name:"InsufficientOutputAmount",type:"error",inputs:[]}],T2=t=>
7446{if(t==null)return t;if(typeof t=="bigint")return t.toString();if(typeof t=="object"){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack,...t.cause?{cause:T2(t.cause)}:{}};if(Array.isArray(t))return t.map(T2);const e={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n))try{e[n]=T2(t[n])}catch{e[n]="[Unable to serialize]"}return e}return t},Bze=({optimizedRoute:t,amountIn:e,totalAmountIn:n,slippageTolerance:i,deadline:s,recipient:r,enabled:o=!0,originalTokenIn:a,originalTokenOut:c})=>{const{address:l}=mn(),d=M.useMemo(()=>{var U;return(t==null?void 0:t.transactionData)&&t.transactionData.functionName==="swap"&&((U=t.transactionData.abi)==null?void 0:U.length)===0&&Array.isArray(t.transactionData.args)&&t.transactionData.args.length>0&&typeof t.transactionData.args[0]=="string"},[t]),h=M.useMemo(()=>d&&(t!=null&&t.transactionData)?t.transactionData.to:null,[d,t]),{data:p,isLoading:g}=Si({address:vt.swapFeeRouter,abi:La,functionName:"isWhitelisted",args:h?[h]:void 0,query:{enabled:!!h&&!!l&&o}}),{data:b}=Si({address:vt.swapFeeRouter,abi:La,functionName:"isWhitelisted",args:[vt.swapRouter02],query:{enabled:!!l&&o}}),{data:w}=Si({address:vt.swapFeeRouter,abi:La,functionName:"feeBasisPoints",query:{enabled:o&&!0}}),C=M.useMemo(()=>w??BigInt(10),[w]),E=M.useMemo(()=>!d||g?!1:p===!0,[d,p,g]),T=M.useMemo(()=>{var j,D,O,H,J,W;if(!t||!o)return null;const U=l||r||Mn;try{if(E&&t.transactionData){const Z=t.transactionData,Y=Z.to,Q=(j=Z.args)==null?void 0:j[0],ee=Z.value||0n,ie=Z.aggregatedRaw,re=Z.routerParams,oe=Z.raw;if(!Q)return console.error("[useSwapExecution] Missing callData for ooga booga route"),null;const de=Y;return a&&sr(a)?{to:vt.swapFeeRouter,abi:La,functionName:"swapWithFeesOnInput",args:[Au,e,C,Y,Y,Q],value:0n,swapCallData:Q,swapRouter:Y,needsWrap:!0}:c&&sr(c)?ee>0n?{to:vt.swapFeeRouter,abi:La,functionName:"swapToEthWithFeesOnInput",args:[a||t.routes[0].route.path[0].address,e,C,Y,de,Q],value:ee,swapCallData:Q,swapRouter:Y}:{to:vt.swapFeeRouter,abi:La,functionName:"swapToEthWithFeesOnInput",args:[a||t.routes[0].route.path[0].address,e,C,Y,de,Q],value:0n,swapCallData:Q,swapRouter:Y}:ee>0n?{to:vt.swapFeeRouter,abi:La,functionName:"swapWithFeesOnInput",args:[a||t.routes[0].route.path[0].address,e,C,Y,de,Q],value:ee,swapCallData:Q,swapRouter:Y}:{to:vt.swapFeeRouter,abi:La,functionName:"swapWithFeesOnInput",args:[a||t.routes[0].route.path[0].address,e,C,Y,de,Q],value:0n,swapCallData:Q,swapRouter:Y}}else if(t.type==="single"){if(!t.routes||t.routes.length===0)return console.error("[useSwapExecution] Missing routes in optimizedRoute:",{type:t.type,hasRoutes:!!t.routes,routesLength:((D=t.routes)==null?void 0:D.length)||0}),null;const Z=t.routes[0];if(!Z||!Z.route)return console.error("[useSwapExecution] Missing route data in first route:",{hasFirstRoute:!!Z,hasRoute:!!(Z!=null&&Z.route)}),null;const Y=Z.route;if(!Y.path||Y.path.length<2)return console.error("[useSwapExecution] Invalid route path:",{hasPath:!!Y.path,pathLength:((O=Y.path)==null?void 0:O.length)||0}),null;let Q;if(typeof t.totalQuote=="string")Q=BigInt(t.totalQuote);else if(typeof t.totalQuote=="bigint")Q=t.totalQuote;else return console.error("[useSwapExecution] Invalid totalQuote type:",{totalQuote:t.totalQuote,type:typeof t.totalQuote}),null;if(!Q||Q===0n)return console.error("[useSwapExecution] Invalid totalQuote:",Q),null;const ee=vE(Q,i),ie=a&&sr(a),re=c&&sr(c),oe=Y.path.length>2,de=e;let he;if(oe){const be=ie?[Au,...Y.path.slice(1).map(Ne=>Ne.address)]:Y.path.map(Ne=>Ne.address),_e=n8(be,Y.fees);if(re){const Ne={path:_e,recipient:vt.swapRouter02,amountIn:de,amountOutMinimum:ee},pe=_i({abi:Sc,functionName:"exactInput",args:[Ne]}),Te=_i({abi:Sc,functionName:"unwrapWETH9",args:[ee,U]});he=_i({abi:Sc,functionName:"multicall",args:[BigInt(Math.floor(Date.now()/1e3)+s*60),[pe,Te]]})}else he=_i({abi:Sc,functionName:"exactInput",args:[{path:_e,recipient:U,amountIn:de,amountOutMinimum:ee}]})}else{const _e={tokenIn:ie?Au:Y.path[0].address,tokenOut:Y.path[1].address,fee:Y.fees[0],recipient:re?vt.swapRouter02:U,amountIn:de,amountOutMinimum:ee,sqrtPriceLimitX96:0n};if(re){const Ne=_i({abi:Sc,functionName:"exactInputSingle",args:[_e]}),pe=_i({abi:Sc,functionName:"unwrapWETH9",args:[ee,U]});he=_i({abi:Sc,functionName:"multicall",args:[BigInt(Math.floor(Date.now()/1e3)+s*60),[Ne,pe]]})}else he=_i({abi:Sc,functionName:"exactInputSingle",args:[_e]})}const ue=a||Y.path[0].address;return ie?{to:vt.swapFeeRouter,abi:La,functionName:"swapWithFeesOnInput",args:[Au,e,C,vt.swapRouter02,vt.swapRouter02,he],value:0n,swapCallData:he,swapRouter:vt.swapRouter02,needsWrap:!0}:re?{to:vt.swapFeeRouter,abi:La,functionName:"swapToEthWithFeesOnInput",args:[ue,e,C,vt.swapRouter02,vt.swapRouter02,he],value:0n,swapCallData:he,swapRouter:vt.swapRouter02}:{to:vt.swapFeeRouter,abi:La,functionName:"swapWithFeesOnInput",args:[ue,e,C,vt.swapRouter02,vt.swapRouter02,he],value:0n,swapCallData:he,swapRouter:vt.swapRouter02}}else if(t.type==="split"){if(!t.routes||t.routes.length===0)return console.error("[useSwapExecution] Missing routes in split optimizedRoute"),null;let Z;if(typeof t.totalQuote=="string")Z=BigInt(t.totalQuote);else if(typeof t.totalQuote=="bigint")Z=t.totalQuote;else return console.error("[useSwapExecution] Invalid totalQuote type for split route:",{totalQuote:t.totalQuote,type:typeof t.totalQuote}),null;if(!Z||Z===0n)return console.error("[useSwapExecution] Invalid totalQuote for split route:",Z),null;const Y=a&&sr(a),Q=c&&sr(c),ee=l||r||Mn,ie=n||e,re=[];let oe=0n;for(const ue of t.routes){if(!ue.route||!ue.route.path||ue.route.path.length<2){console.error("[useSwapExecution] Invalid route in split:",ue);continue}const be=ue.route;if(!((H=be.path[0])!=null&&H.address)||!((J=be.path[1])!=null&&J.address)){console.error("[useSwapExecution] Missing token addresses in route:",be);continue}if(!be.fees||be.fees.length===0){console.error("[useSwapExecution] Missing fees in route:",be);continue}if(typeof ue.percentage!="number"||ue.percentage<=0){console.error("[useSwapExecution] Invalid percentage in route item:",ue);continue}if(!ue.quote||typeof ue.quote!="bigint"){console.error("[useSwapExecution] Invalid quote in route item:",ue);continue}const _e=ie*BigInt(ue.percentage)/100n,Ne=vE(ue.quote,i);if(be.path.length>2){const Te=be.path.map(xe=>
7446xe==null?void 0:xe.address).filter(Boolean);if(Te.length!==be.path.length){console.error("[useSwapExecution] Missing addresses in multi-hop path:",be.path);continue}if(!be.fees||be.fees.length!==be.path.length-1){console.error("[useSwapExecution] Fee count mismatch in multi-hop route:",{pathLength:be.path.length,feesLength:((W=be.fees)==null?void 0:W.length)||0});continue}const ve=n8(Te,be.fees);if(Q){const xe={path:ve,recipient:vt.swapRouter02,amountIn:_e,amountOutMinimum:Ne},Ye=_i({abi:Sc,functionName:"exactInput",args:[xe]});re.push(Ye)}else{const Ye=_i({abi:Sc,functionName:"exactInput",args:[{path:ve,recipient:ee,amountIn:_e,amountOutMinimum:Ne}]});re.push(Ye)}}else{if(!be.fees[0]&&be.fees[0]!==0){console.error("[useSwapExecution] Missing fee for single hop route:",be);continue}const Te={tokenIn:be.path[0].address,tokenOut:be.path[1].address,fee:be.fees[0],recipient:Q?vt.swapRouter02:ee,deadline:BigInt(Math.floor(Date.now()/1e3)+s*60),amountIn:_e,amountOutMinimum:Ne,sqrtPriceLimitX96:0n},ve=_i({abi:Sc,functionName:"exactInputSingle",args:[Te]});re.push(ve)}oe+=ue.quote}if(re.length===0)return console.error("[useSwapExecution] No valid swap calls generated for split route"),null;if(Q){const ue=vE(Z,i),be=_i({abi:Sc,functionName:"unwrapWETH9",args:[ue,ee]});re.push(be)}const de=_i({abi:Sc,functionName:"multicall",args:[BigInt(Math.floor(Date.now()/1e3)+s*60),re]}),he=a||t.routes[0].route.path[0].address;if(Y){const ue=n||e;return{to:vt.swapFeeRouter,abi:La,functionName:"swapFromEthWithFeesOnInput",args:[C,vt.swapRouter02,de],value:ue,swapCallData:de,swapRouter:vt.swapRouter02}}else return Q?{to:vt.swapFeeRouter,abi:La,functionName:"swapToEthWithFeesOnInput",args:[he,e,C,vt.swapRouter02,vt.swapRouter02,de],value:0n,swapCallData:de,swapRouter:vt.swapRouter02}:{to:vt.swapFeeRouter,abi:La,functionName:"swapWithFeesOnInput",args:[he,e,C,vt.swapRouter02,vt.swapRouter02,de],value:0n,swapCallData:de,swapRouter:vt.swapRouter02}}}catch(Z){return console.error("[useSwapExecution] Failed to generate transaction data:",Z),null}return null},[t,l,o,s,i,r,e,a,c,E,C]),A=M.useMemo(()=>!!T&&!!T.to&&!!T.functionName&&!!T.abi&&Array.isArray(T.abi)&&T.abi.length>0&&!!l&&o&&!g,[T,l,o,g]),k=M.useMemo(()=>[{type:"function",name:"noop",inputs:[],outputs:[],stateMutability:"nonpayable"}],[]),{data:R,error:P,refetch:B}=$r(A&&T?{address:T.to,abi:T.abi,functionName:T.functionName,args:T.args,value:T.value||0n,query:{enabled:!0}}:{address:Mn,abi:k,functionName:"noop",args:void 0,value:0n,query:{enabled:!1}});M.useEffect(()=>{var U,j,D,O;if(P){const H=P,J=H.message||String(P),W=H.shortMessage||J,Z=H.name,Y=H.code,Q=H.data,ee=H.cause,ie=H.args;let re;if(Q){const de=typeof Q=="string"?Q:(Q==null?void 0:Q.errorName)||(Q==null?void 0:Q.data)||String(Q);de&&typeof de=="string"&&de.startsWith("0x")&&(re=de.slice(0,10))}const oe={message:J,shortMessage:W,name:Z,code:Y,signature:re,args:ie?Array.isArray(ie)?ie.map(de=>typeof de=="bigint"?de.toString():typeof de=="object"&&de!==null?JSON.stringify(de):String(de)):String(ie):void 0,data:Q?typeof Q=="string"?Q.substring(0,200):String(Q).substring(0,200):void 0,cause:ee?{name:ee.name,message:ee.message,data:ee.data?typeof ee.data=="string"?ee.data.substring(0,200):String(ee.data).substring(0,200):void 0}:void 0,transactionData:T?{to:T.to,functionName:T.functionName,argsLength:(U=T.args)==null?void 0:U.length,value:(j=T.value)==null?void 0:j.toString(),args:T.args?T.args.map((de,he)=>typeof de=="bigint"?`arg[${he}]: ${de.toString()}`:typeof de=="string"?`arg[${he}]: ${de.substring(0,50)}${de.length>50?"...":""}`:`arg[${he}]: ${JSON.stringify(de).substring(0,100)}`):[]}:null};if(re)if(re==="0x1a8856b4"&&ie&&ie.length>=2){const de=((D=ie[0])==null?void 0:D.toString())||"unknown",he=((O=ie[1])==null?void 0:O.toString())||"unknown";oe.userFriendlyMessage=`FeeBasisPointsNotRespected - Les frais fournis (${he} bps) sont inférieurs au minimum requis (${de}
7446 bps)`,oe.suggestedAction=`Le contrat requiert au minimum ${de} basis points. Utilisez une valeur >= ${de} bps.`,oe.expectedFeeBasisPoints=de,oe.actualFeeBasisPoints=he}else{const de={"0x1a8856b4":{message:"FeeBasisPointsNotRespected - Les frais fournis sont inférieurs au minimum requis",action:"Vérifiez que les frais de service sont correctement configurés"},"0x08c379a0":{message:"Error(string) - Erreur générique avec message",action:"Vérifiez les détails de l'erreur dans les logs"},"0xf4d678b8":{message:"Solde insuffisant pour le swap - Le montant après les frais est peut-être trop petit",action:"Vérifiez que vous avez suffisamment de tokens (y compris les frais). Pour les dépôts single-sided avec BERA, assurez-vous que BERA est wrappé en WBERA et que le montant est suffisant après déduction des frais."},"0xfb8f41b2":{message:"Montant de sortie insuffisant - Le swap ne peut pas fournir le montant minimum attendu (slippage)",action:"Le montant de sortie est inférieur au minimum attendu. Cela peut être dû à un slippage trop élevé, une liquidité insuffisante, ou un changement de prix. Pour les dépôts single-sided, utilisez Enso qui ne passe pas par SwapFeeRouter."}};de[re]?(oe.userFriendlyMessage=de[re].message,de[re].action&&(oe.suggestedAction=de[re].action)):(oe.userFriendlyMessage=`Erreur personnalisée non reconnue (signature: ${re})`,oe.suggestedAction="Vérifiez les logs pour plus de détails ou contactez le support")}console.error("[useSwapExecution] Simulation error:",T2({...oe,fullError:P})),console.error("[useSwapExecution] Simulation error summary:",{message:J,shortMessage:W,name:Z,code:Y,signature:re,functionName:T==null?void 0:T.functionName,contractAddress:T==null?void 0:T.to})}},[P,T]);const F=M.useMemo(()=>!T||!l||g||E&&p===!1?!1:!!T,[R,T,l,E,p,g,P,t,o]),{writeContract:z,data:K,isPending:q,error:G,reset:I}=Ls();M.useEffect(()=>{var U;if(G){const j={message:G==null?void 0:G.message,name:G==null?void 0:G.name,shortMessage:G==null?void 0:G.shortMessage,hasTransactionData:!!T,functionName:T==null?void 0:T.functionName,to:T==null?void 0:T.to,args:T!=null&&T.args?T.args.map((D,O)=>typeof D=="bigint"?`arg[${O}]: ${D.toString()}
7446`:typeof D=="string"?`arg[${O}]: ${D.substring(0,50)}${D.length>50?"...":""}`:`arg[${O}]: ${JSON.stringify(D).substring(0,100)}`):[],value:(U=T==null?void 0:T.value)==null?void 0:U.toString()};"cause"in G&&G.cause&&(j.cause=T2(G.cause)),"data"in G&&G.data&&(j.data=G.data),console.error("[useSwapExecution] Write contract error:",T2(j)),console.error("[useSwapExecution] Full error object:",G)}},[G,T]);const{isLoading:S,isSuccess:v}=Ts({hash:K}),_=q||S,N=M.useCallback(async()=>{var U,j,D,O,H,J,W,Z,Y,Q,ee,ie;if(!l)throw new Error("Cannot execute swap: wallet not connected");if(!T)throw console.error("[useSwapExecution] Missing transaction data:",{hasOptimizedRoute:!!t,enabled:o,routeType:t==null?void 0:t.type,hasRoutes:!!(t!=null&&t.routes),routesLength:((U=t==null?void 0:t.routes)==null?void 0:U.length)||0,hasFirstRoute:!!((j=t==null?void 0:t.routes)!=null&&j[0]),hasRoute:!!((O=(D=t==null?void 0:t.routes)==null?void 0:D[0])!=null&&O.route),hasPath:!!((W=(J=(H=t==null?void 0:t.routes)==null?void 0:H[0])==null?void 0:J.route)!=null&&W.path),pathLength:((ee=(Q=(Y=(Z=t==null?void 0:t.routes)==null?void 0:Z[0])==null?void 0:Y.route)==null?void 0:Q.path)==null?void 0:ee.length)||0,totalQuote:((ie=t==null?void 0:t.totalQuote)==null?void 0:ie.toString())||"undefined",amountIn:e.toString(),originalTokenIn:a,originalTokenOut:c,effectiveFeeBasisPoints:C.toString()}),new Error("Cannot execute swap: missing transaction configuration");if(e<=0n)throw new Error("Cannot execute swap: amount must be greater than 0");if(g)throw new Error("Cannot execute swap: checking whitelist status");if(E&&p===!1)throw new Error("Cannot execute swap: ooga booga router is not whitelisted");try{await z({address:T.to,abi:T.abi,functionName:T.functionName,args:T.args,value:T.value||0n})}catch(re){throw console.error("[useSwapExecution] Swap execution error:",re),new Error(re instanceof Error?re.message:"Token swap execution failed")}},[R,l,T,e,z,t,o,E,p,g]),$=M.useCallback(()=>{I()},[I]);return{transactionData:T,executeSwap:N,reset:$,refetchSimu:B,isExecuting:_,executeTxHash:K,simulateError:P,executeError:G,isExecuteSuccess:v,simulationConfig:R,canExecute:F,isWhitelistChecked:!g&&(E?p!==void 0:!0)}};function MI(t){if(t==null)return t;const e=["totalQuote","totalGasEstimate","amount","quote","gasEstimate","value","amountOut"];if(Array.isArray(t))return t.map(MI);if(typeof t=="object"){const n={};for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const s=t[i];e.includes(i)&&typeof s=="string"&&/^\d+$/.test(s)?n[i]=BigInt(s):n[i]=MI(s)}return n}return t}async function RG(t){var n,i,s,r,o,a,c,l,d,h,p,g,b;const e="https://api.winnieswap.com";try{const w=`${e}/swap/best-route`;console.log("[sharedRouting] Requesting route from backend:",{url:w,tokenIn:t.tokenIn,tokenOut:t.tokenOut,amountIn:t.amountIn.toString()});const C="0xd2c41bf4033a83c0fc3a7f58a392bf37d6dcdb58",E="0xbaadcc2962417c01af99fb2b7c75706b9bd6babe",T=((n=t.tokenIn)==null?void 0:n.toLowerCase())===C||((i=t.tokenOut)==null?void 0:i.toLowerCase())===C||((s=t.tokenIn)==null?void 0:s.toLowerCase())===E||((r=t.tokenOut)==null?void 0:r.toLowerCase())===E;T&&console.log("[sharedRouting] Special token route request:",{tokenIn:t.tokenIn,tokenOut:t.tokenOut,amountIn:t.amountIn.toString(),chainId:t.chainId,isOsBgt:((o=t.tokenIn)==null?void 0:o.toLowerCase())===C||((a=t.tokenOut)==null?void 0:a.toLowerCase())===C,isLbgt:((c=t.tokenIn)==null?void 0:c.toLowerCase())===E||((l=t.tokenOut)==null?void 0:l.toLowerCase())===E});const A=await fetch(w,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,amountIn:t.amountIn.toString(),recipient:t.recipient||void 0})});if(!A.ok){const P=await A.text();throw new Error(`Backend error: ${A.status} ${P}`)}const k=await A.json(),R=MI(k);
7446return T&&console.log("[sharedRouting] Special token route response:",{tokenIn:t.tokenIn,tokenOut:t.tokenOut,hasOptimizedRoute:!!R.optimizedRoute,routeDescription:R.routeDescription,amountOut:(d=R.amountOut)==null?void 0:d.toString(),frontEndFeeBps:R.frontEndFeeBps,isOsBgt:((h=t.tokenIn)==null?void 0:h.toLowerCase())===C||((p=t.tokenOut)==null?void 0:p.toLowerCase())===C,isLbgt:((g=t.tokenIn)==null?void 0:g.toLowerCase())===E||((b=t.tokenOut)==null?void 0:b.toLowerCase())===E,fullResponse:R}),{client:R.client,optimizedRoute:R.optimizedRoute,amountOut:R.amountOut,frontEndFeeBps:R.frontEndFeeBps,routeDescription:R.routeDescription}}catch(w){if(w instanceof TypeError&&w.message.includes("Failed to fetch")){const C="https://api.winnieswap.com";throw console.error("[sharedRouting] â Backend connection failed:",{apiUrl:C,error:w.message,hint:"Make sure the backend server is running. Check VITE_API_URL in your .env file."}),new Error(`Cannot connect to backend at ${C}. Please ensure the backend server is running.`)}throw console.error("[sharedRouting] Failed to get best route from backend:",w),w instanceof Error?w:new Error("Failed to get best route from backend")}}const $y={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_URL:"https://api.winnieswap.com",VITE_BERACHAIN_API_URL:"https://partners.rpc-mainnet.berachain.com/?apikey=OMxUxBb9r39hhIkIu8WMXYm",VITE_ENABLE_SHARED_ROUTER:"true",VITE_ENSO_API_KEY:"dfaf3fb4-8442-433a-8a4d-1099762457e6a",VITE_GRAPHQL_URL:"https://sub.winnieswap.com",VITE_NODE_ENV:"production",VITE_OOGA_BOOGA_API_KEY:"aZSa9agcNrWwTpOD3PbV6QJxSplyECouqg1efrTnhnE"},CE=t=>{const{address:e}=mn(),n=Kc(),[i,s]=M.useState(null),[r,o]=M.useState(!1),a=!0,c=10,{tokenIn:l,tokenOut:d,amountIn:h,slippageTolerance:p=.01,deadline:g=5,recipient:b,enabled:w=!0,overrideUserBalance:C}=t,E=M.useMemo(()=>h===0n?0n:h*10000n/10010n,[h]),T=Pze({tokenIn:l,tokenOut:d}),A=Dze({tokenIn:T.normalizedTokenIn,tokenOut:T.normalizedTokenOut,enabled:w&&!!T.normalizedTokenIn&&!!T.normalizedTokenOut}),k=Oze({routes:A.routes,amountIn:E,enabled:w&&A.routes.length>0}),R=Mze({routes:k.quotedRoutes,amountIn:E,enabled:w&&k.quotedRoutes.length>0});M.useEffect(()=>{if(!w||!a){s(null),o(!1);return}if(!T.normalizedTokenIn||!T.normalizedTokenOut||E<=0n){s(null),o(!1);return}let re=!1;return(async()=>{var oe;o(!0);try{const de=await RG({client:"web",chainId:Number(($y==null?void 0:$y.VITE_CHAIN_ID)||80084),tokenIn:T.normalizedTokenIn,tokenOut:T.normalizedTokenOut,amountIn:E,slippageTolerance:p,deadlineMinutes:g,recipient:b||e||Mn});if(!re){const he=!de.optimizedRoute||((oe=de.routeDescription)==null?void 0:oe.includes("Stub route"))||!de.routeDescription&&!de.optimizedRoute;s(he?null:de)}}catch{re||s(null)}finally{re||o(!1)}})(),()=>{re=!0,o(!1)}},[w,a,T.normalizedTokenIn,T.normalizedTokenOut,E,p,g,b,e]);const{getTokenInfo:P}=tL(),B=M.useMemo(()=>{var re,oe,de,he;if(!T.originalTokenIn||!T.originalTokenOut)return!1;try{const ue=P(T.originalTokenIn),be=P(T.originalTokenOut),_e=(ve,xe)=>ve?ve.toUpperCase():xe&&sr(xe)?"BERA":void 0,Ne=_e(ue==null?void 0:ue.symbol,T.originalTokenIn),pe=_e(be==null?void 0:be.symbol,T.originalTokenOut);if(!Ne||!pe)return!1;const Te=Aze(Ne,pe,T.originalTokenIn,T.originalTokenOut);return(Ne==="USDT0"||pe==="USDT0"||Ne==="USDE"||pe==="USDE"||Ne==="OSBGT"||pe==="OSBGT"||((re=T.originalTokenIn)==null?void 0:re.toLowerCase())==="0xd2c41bf4033a83c0fc3a7f58a392bf37d6dcdb58"||((oe=T.originalTokenOut)==null?void 0:oe.toLowerCase())==="0xd2c41bf4033a83c0fc3a7f58a392bf37d6dcdb58")&&console.log("[useSwap] Routing check:",{symbolIn:Ne,symbolOut:pe,tokenIn:T.originalTokenIn,tokenOut:T.originalTokenOut,tokenInInfo:ue,tokenOutInfo:be,shouldUseLocal:Te,pairKey:`${Ne}-${pe}`,reversePairKey:`${pe}-${Ne}`,inLocalRoutePairs:Te,LOCAL_ROUTE_PAIRS_HAS_USDT0:Ne==="USDT0"||pe==="USDT0"?"checking...":"N/A",LOCAL_ROUTE_PAIRS_HAS_USDE:Ne==="USDE"||pe==="USDE"?"checking...":"N/A",isOsBGT:Ne==="OSBGT"||pe==="OSBGT"||((de=T.originalTokenIn)==null?void 0:de.toLowerCase())==="0xd2c41bf4033a83c0fc3a7f58a392bf37d6dcdb58"||((he=T.originalTokenOut)==null?void 0:he.toLowerCase())==="0xd2c41bf4033a83c0fc3a7f58a392bf37d6dcdb58"}),Te}catch{return!1}},[T.originalTokenIn,T.originalTokenOut]),F=M.useMemo(()=>{var be;if(!w)return null;
7446const re=i==null?void 0:i.optimizedRoute,oe=R.optimizedRoute;if(!re&&!oe)return null;if(B)return oe||null;const de=!re||((be=i==null?void 0:i.routeDescription)==null?void 0:be.includes("Stub route"))||!(i!=null&&i.routeDescription)&&!re,he=P(T.originalTokenIn),ue=P(T.originalTokenOut);if(re||oe){const _e=!!(re&&(i!=null&&i.amountOut)&&re.transactionData&&!de),Ne=!!(oe&&!_e);console.log("[useSwap] Route selection:",{tokenIn:T.originalTokenIn,tokenOut:T.originalTokenOut,tokenInSymbol:he==null?void 0:he.symbol,tokenOutSymbol:ue==null?void 0:ue.symbol,hasSharedRoute:!!re,hasLocalRoute:!!oe,sharedRouteDescription:i==null?void 0:i.routeDescription,isStubRoute:de,shouldUseLocal:B,willUseOogaBooga:_e,willUseLocal:Ne,finalDecision:_e?"OogaBooga":Ne?"Local":"None",reason:re?de?"Stub route - using local fallback":i!=null&&i.amountOut?re.transactionData?_e?"Using OogaBooga route":"Using local route":"No transactionData - using local fallback":"No amountOut - using local fallback":"No shared route from backend - using local fallback"})}return re&&(i!=null&&i.amountOut)&&re.transactionData&&!de?re:oe||(re&&!de?re:null)},[w,i==null?void 0:i.optimizedRoute,i==null?void 0:i.amountOut,R.optimizedRoute,B,r,T.originalTokenIn,T.originalTokenOut,P]),z=sr(T.originalTokenIn),{data:K,isLoading:q}=wf({address:e,query:{enabled:!!e&&z}}),{data:G,isLoading:I}=Si({address:z?void 0:T.originalTokenIn,abi:Ks,functionName:"balanceOf",args:e?[e]:void 0,query:{enabled:!!e&&!z&&!!T.originalTokenIn}}),S=z?q:I,v=M.useMemo(()=>{if(C!==void 0)return C;if(e&&!S)return z?K==null?void 0:K.value:G},[e,z,K==null?void 0:K.value,G,S,C]),_=Lze({tokenIn:T.normalizedTokenIn,tokenOut:T.normalizedTokenOut,amountIn:h,optimizedRoute:F,userBalance:v,isConnected:!!e}),N=Bze({optimizedRoute:F,amountIn:E,totalAmountIn:h,slippageTolerance:p,deadline:g,recipient:b,enabled:w&&!!F,originalTokenIn:T.originalTokenIn,originalTokenOut:T.originalTokenOut}),$=M.useMemo(()=>h,[h]),U=M.useMemo(()=>N.transactionData?N.transactionData.functionName==="swapWithFeesOnInput"&&N.transactionData.needsWrap===!0&&sr(T.originalTokenIn):!1,[N.transactionData,T.originalTokenIn]),j=M.useMemo(()=>U?Au:T.normalizedTokenIn,[U,T.normalizedTokenIn]),D=$ze({tokenAddress:j,spenderAddress:N.transactionData?vt.swapFeeRouter:void 0,amountNeeded:$,enabled:!!e&&!!N.transactionData&&(U||!sr(T.originalTokenIn))}),O=M.useMemo(()=>U?h:E,[U,h,E]),H=Uze({amount:O,enabled:!!e}),J=M.useMemo(()=>N.isExecuteSuccess||H.isWrapSuccess||H.isUnwrapSuccess?"success":D.isApproving?"approving":N.isExecuting?"swapping":H.isWrapping?"wrapping":H.isUnwrapping?"unwrapping":A.error||k.error||R.error||D.approveError||N.executeError||H.wrapError||H.unwrapError||!D.needsApproval&&N.simulateError&&!N.canExecute?"error":A.isLoading?"loading-routes":k.isLoading?"quoting":R.isLoading?"optimizing":!A.isLoading&&A.routes.length===0&&k.quotedRoutes.length===0&&!R.optimizedRoute&&!(i!=null&&i.optimizedRoute)&&T.normalizedTokenIn&&T.normalizedTokenOut&&E>0n?"error":F&&_.canExecute&&N.canExecute?"ready":"idle",[D.isApproving,N.isExecuting,H.isWrapping,H.isUnwrapping,N.isExecuteSuccess,H.isWrapSuccess,H.isUnwrapSuccess,A.error,k.error,R.error,D.approveError,N.executeError,N.simulateError,H.wrapError,H.unwrapError,A.isLoading,k.isLoading,R.isLoading,A.routes.length,k.quotedRoutes.length,i==null?void 0:i.optimizedRoute,F,_.canExecute,N.canExecute,D.needsApproval,T.normalizedTokenIn,T.normalizedTokenOut,E]),W=M.useMemo(()=>{var oe,de;const re=A.error||k.error||R.error||D.approveError||N.simulateError||N.executeError||H.wrapError||H.unwrapError;if(re){const he={routerError:A.error?{message:A.error instanceof Error?A.error.message:String(A.error),name:A.error instanceof Error?A.error.name:typeof A.error}:null,quoterError:k.error?{message:k.error instanceof Error?k.error.message:String(k.error),name:k.error instanceof Error?k.error.name:typeof k.error}:null,optimizerError:R.error?{message:R.error instanceof Error?R.error.message:String(R.error),name:R.error instanceof Error?R.error.name:typeof R.error}:null,approvalError:D.approveError?{message:D.approveError instanceof Error?D.approveError.message:String(D.approveError),name:D.approveError instanceof Error?D.approveError.name:typeof D.approveError}:null,simulateError:N.simulateError?{message:N.simulateError instanceof Error?N.simulateError.message:String(N.simulateError),name:N.simulateError instanceof Error?N.simulateError.name:typeof N.simulateError,shortMessage:(oe=N.simulateError)==null?void 0:oe.shortMessage}:null,executeError:N.executeError?{message:N.executeError instanceof Error?N.executeError.message:String(N.executeError),name:N.executeError instanceof Error?N.executeError.name:typeof N.executeError,shortMessage:(de=N.executeError)==null?void 0:de.shortMessage}:null,wrapError:H.wrapError?{message:H.wrapError instanceof Error?H.wrapError.message:String(H.wrapError),name:H.wrapError instanceof Error?H.wrapError.name:typeof H.wrapError}:null,unwrapError:H.unwrapError?{message:H.unwrapError instanceof Error?H.unwrapError.message:String(H.unwrapError),name:H.unwrapError instanceof Error?H.unwrapError.name:typeof H.unwrapError}:null,consolidatedErrorMessage:re instanceof Error?re.message:String(re),consolidatedErrorName:re instanceof Error?re.name:typeof re};console.error("[useSwap] Consolidated error detected:",he),A.error?console.error("[useSwap] Router error details:",A.error):k.error?console.error("[useSwap] Quoter error details:",k.error):R.error?console.error("[useSwap] Optimizer error details:",R.error):D.approveError?console.error("[useSwap] Approval error details:",D.approveError):N.simulateError?console.error("[useSwap] Simulation error details:",N.simulateError):N.executeError?console.error("[useSwap] Execution error details:",N.executeError):H.wrapError?console.error("[useSwap] Wrap error details:",H.wrapError):H.unwrapError&&c
7446onsole.error("[useSwap] Unwrap error details:",H.unwrapError)}return re},[A.error,k.error,R.error,D.approveError,N.executeError,N.simulateError,H.wrapError,H.unwrapError,A.isLoading,A.routes.length,k.quotedRoutes.length,R.optimizedRoute,i==null?void 0:i.optimizedRoute,T.normalizedTokenIn,T.normalizedTokenOut,E,k.isLoading,R.isLoading]),Z=M.useMemo(()=>N.executeTxHash||H.wrapTxHash||H.unwrapTxHash,[N.executeTxHash,H.wrapTxHash,H.unwrapTxHash]),Y=M.useCallback(async()=>{var re,oe,de,he;if(T.wrapInfo.isWrap)await H.wrap();else if(T.wrapInfo.isUnwrap)await H.unwrap();else{if(U){if(await H.wrap(),await new Promise(be=>setTimeout(be,2e3)),D.needsApproval){await D.approve();return}await N.executeSwap();return}if(((re=F==null?void 0:F.transactionData)==null?void 0:re.functionName)==="swap"&&((de=(oe=F==null?void 0:F.transactionData)==null?void 0:oe.abi)==null?void 0:de.length)===0&&i)try{const be=await RG({client:"web",chainId:Number(($y==null?void 0:$y.VITE_CHAIN_ID)||80084),tokenIn:T.normalizedTokenIn,tokenOut:T.normalizedTokenOut,amountIn:E,slippageTolerance:p,deadlineMinutes:g,recipient:b||e||Mn});be.optimizedRoute&&!((he=be.routeDescription)!=null&&he.includes("Stub route"))&&(s(be),await new Promise(_e=>setTimeout(_e,100)))}catch{}if(D.needsApproval){await D.approve();return}await N.executeSwap()}},[T.wrapInfo.isWrap,T.wrapInfo.isUnwrap,U,i==null?void 0:i.optimizedRoute,F,T.normalizedTokenIn,T.normalizedTokenOut,E,p,g,b,e,D.needsApproval,D.approve,H.wrap,H.unwrap,N.executeSwap]),Q=M.useMemo(()=>{var _e,Ne,pe,Te,ve;if(!F)return null;const re=(i==null?void 0:i.optimizedRoute)===F;let oe;re&&(i!=null&&i.amountOut)?oe=i.amountOut:oe=F.totalQuote*(10000n-BigInt(c))/10000n;const de=P(T.originalTokenOut),he=de!=null&&de.decimals&&de.decimals>0&&de.decimals<=18?de.decimals:((Te=(pe=(Ne=(_e=F.routes[0])==null?void 0:_e.route)==null?void 0:Ne.path)==null?void 0:pe[F.routes[0].route.path.length-1])==null?void 0:Te.decimals)||18,ue=vE(oe,p);let be=ue;if(re&&((ve=i==null?void 0:i.optimizedRoute)!=null&&ve.transactionData)){const xe=i.optimizedRoute.transactionData.minimumAmountOut;if(xe){const Ye=BigInt(xe),ze=Ye-Ye*BigInt(c)/10000n;if(be=ze<ue?ze:ue,E>0n){const ft=oe*1000000n/E,lt=be*1000000n/E,We=Number((oe-be)*10000n/oe);console.log("[useSwap] Quote analysis:",{amountIn:E.toString(),amountOutAfterFees:oe.toString(),amountOutMinimum:ue.toString(),oogaMinimumAmountOut:Ye.toString(),oogaMinAfterFee:ze.toString(),actualMinimumAmountOut:be.toString(),pricePerUnit:ft.toString(),minPricePerUnit:lt.toString(),slippageBps:We,expectedSlippageBps:Math.floor(p*1e4),isOogaBooga:re})}}}return{amountOut:oe,amountOutFormatted:dt(oe,he),amountOutMinimum:be,priceImpact:0,gasEstimate:F.totalGasEstimate,routeType:F.type,routeDetails:F.type==="split"?`Split: ${F.routes.map(xe=>`${xe.percentage}%`).join(" + ")}`:`Single: ${F.routes[0].route.path.map(xe=>xe.symbol).join(" â ")}`,potentialSavings:k.quotedRoutes.length>0&&F.type==="split"?F.totalQuote-k.quotedRoutes[0].quote:0n}},[F,p,k.quotedRoutes,i,T.originalTokenOut,P,E]),ee=M.useCallback(()=>{J==="success"&&n.invalidateQueries({queryKey:["balance"]})},[J,n]),ie=M.useCallback(()=>{D.reset(),N.reset(),H.reset(),n.invalidateQueries({queryKey:["balance"]})},[D.reset,N.reset,H.reset,n]);return M.useEffect(()=>{J==="success"&&n.invalidateQueries({queryKey:["balance"]})},[J,n]),M.useEffect(()=>{w&&F&&(["loading-routes","quoting","optimizing","approving","swapping"].includes(J)||N==null||N.refetchSimu())},[D.needsApproval,w,N,F,J]),{status:J,error:W?{message:W.message||"Unknown error",originalError:W,code:W.code,context:W.context}:void 0,routes:k.quotedRoutes,optimizedRoute:F?{...F,transactionData:N.transactionData||F.transactionData}:null,txhash:Z,slippageTolerance:p,needsApproval:D.needsApproval,approveTxHash:D.approveTxHash,isApproveSuccess:D.isApproveSuccess,isLoading:["loading-routes","quoting","optimizing","approving","swapping","wrapping","unwrapping"].includes(J),isReady:J==="ready"&&!!N.transactionData,isWrap:T.wrapInfo.isWrap,isUnWrap:T.wrapInfo.isUnwrap,needsWrapBefore:T.wrapInfo.needsWrapBefore,needsUnwrapAfter:T.wrapInfo.needsUnwrapAfter,validation:{isValid:_.isValid,errors:_.errors,canEstimate:_.canEstimate,canExecute:_.canExecute,hasError:_.hasError,getFieldError:_.getFieldError},quote:Q,swap:Y,approve:D.approve,wrap:H.wrap,unwrap:H.unwrap,refresh:ee,reset:ie,cache:{isEnabled:!1,isFromCac
7446he:!1,isDataFresh:!0,isStale:!1,timestamp:0,cacheKey:null,invalidateCache:()=>{},invalidateCacheForAmount:()=>{},prefetchPopularRoutes:async()=>{},metrics:{dataUpdatedAt:0,errorUpdatedAt:0,failureCount:0,isFetching:!1}}}},Fze="0x76fD9D07d5e4D889CAbED96884F15f7ebdcd6B63",jze=(t,e,n=3e3)=>{const[i,s]=M.useState(null),[r,o]=M.useMemo(()=>!t||!e?[void 0,void 0]:[t,e].sort((l,d)=>l.toLowerCase().localeCompare(d.toLowerCase())),[t,e]),{data:a,isError:c}=Si({address:Fze,abi:z5,functionName:"getPool",args:r&&o?[r,o,n]:void 0,query:{enabled:!!r&&!!o}});return M.useEffect(()=>{a&&a!=="0x0000000000000000000000000000000000000000"?(console.log("[Pool Address Found]",{tokenA:t,tokenB:e,fee:n,poolAddress:a}),s(a)):s(null)},[a,t,e,n]),{poolAddress:i,isError:c}},Vze=({swap:t,fromToken:e,toToken:n,fromAmount:i,toAmount:s,slippageConfig:r,onSlippageChange:o})=>{const{quote:a}=t,[c,l]=M.useState(!1),[d,h]=M.useState(r.display),p=M.useRef(null),g=M.useRef(null),b=M.useMemo(()=>{if(!(a!=null&&a.amountOutMinimum)||a.amountOutMinimum===0n){if(s>0n){const k=s*BigInt(Math.floor((1-r.real)*1e6))/1000000n;return i1(dt(k,(n==null?void 0:n.decimals)||18))}return"-"}return i1(dt(a.amountOutMinimum,(n==null?void 0:n.decimals)||18))},[a,s,n==null?void 0:n.decimals,r.real]),w=["loading-routes","quoting"].includes(t.status);M.useEffect(()=>{h(r.display)},[r.display]),M.useEffect(()=>{c&&p.current&&(p.current.focus(),p.current.select())},[c]),M.useEffect(()=>{const k=R=>{g.current&&!g.current.contains(R.target)&&T()};if(c)return document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[c,T]);const C=M.useCallback(()=>{o&&l(!0)},[o]),E=M.useCallback(k=>{let R=k.target.value.replace(/[^\d.,]/g,"");if(R=R.replace(",","."),R.includes(".")){const P=R.split(".");P[1]&&P[1].length>2&&(R=P[0]+"."+P[1].substring(0,2))}h(R)},[]),T=M.useCallback(()=>{const k=d.trim()===""?"1":d,R=parseFloat(k);if(R<0||R>100||isNaN(R)){o&&o({real:.01,display:"1",isAuto:!1}),l(!1);return}const P=R/100;o&&o({real:P,display:k,isAuto:!1}),l(!1)},[d,o]),A=M.useCallback(k=>{k.key==="Enter"?(k.preventDefault(),T()):k.key==="Escape"&&(h(r.display),l(!1))},[T,r.display]);return!e||!n?null:m.jsxs("div",{className:"SwapMetrics",children:[m.jsxs("div",{className:"SwapMetrics__row",children:[m.jsx("span",{className:"SwapMetrics__label",children:"Slippage tolerance"}),c?m.jsxs("div",{className:"SwapMetrics__slippageEditor",ref:g,children:[m.jsx("input",{ref:p,type:"text",value:d,onChange:E,onKeyDown:A,onBlur:T,className:"SwapMetrics__slippageInput",placeholder:"1"}),m.jsx("span",{className:"SwapMetrics__slippagePercent",children:"%"})]}):m.jsxs("span",{className:`SwapMetrics__value ${o?"SwapMetrics__value--clickable":""}`,onClick:C,title:o?"Cliquez pour modifier":void 0,children:[r.display,"%"]})]}),m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:"Minimum received"}),w?m.jsx(Ke,{width:100,height:16,borderRadius:4}):m.jsxs("span",{className:"SwapMetrics__value",children:[b," ",n.symbol]})]})]})},PG=({minShares:t,expectedShares:e,isQuoteLoading:n=!1,priceImpact:i,isPriceImpactLoading:s=!1,vaultToken0Symbol:r,vaultToken1Symbol:o,isAutoWin:a=!1,slippageBps:c})=>{const l=t||e,d=M.useMemo(()=>!l||l===0n?"-":i1(dt(l,18)),[l]),h=M.useMemo(()=>!r||!o?"Vault":a?`AW-${r}-${o}`:`STICKY ${r}-${o}`,[r,o,a]),p=M.useMemo(()=>`${(c/100).toFixed(2)}%`,[c]);return M.useMemo(()=>i==null||s?null:`${i.toFixed(2)}%`,[i,s]),m.jsxs("div",{className:"SwapMetrics",children:[m.jsxs("div",{className:"SwapMetrics__row",children:[m.jsx("span",{className:"SwapMetrics__label",children:"Slippage tolerance"}),m.jsx("span",{className:"SwapMetrics__value",children:p})]}),m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:"Minimum received"}),n?m.jsx(Ke,{width:100,height:16,borderRadius:4}):m.jsxs("span",{className:"SwapMetrics__value",children:[d," ",h]})]})]})},k2=({segments:t,selectedKey:e,onChange:n,style:i})=>{const s=M.useRef(null),r=M.useRef(null),o=M.useRef({}),a=M.useRef(!1),c=M.useRef(""),l=t.map(h=>h.key).join(","),d=c.current!==l;return M.useEffect(()=>{if(d&&(a.current=!1,c.current=l),!e||e==="0"){const g=r.current;g&&(g.style.opacity="0");return}const h=t.find(g=>g.key===e&&g.key!=="ellipsis");
7446if(!h)return;const p=(g=0)=>{requestAnimationFrame(()=>{const b=o.current[h.key],w=r.current,C=s.current;if(b&&C&&w){const E=C.getBoundingClientRect(),T=b.getBoundingClientRect(),A=T.left-E.left,k=T.width;w.style.transition="none",w.style.opacity="1",w.style.transform=`translateX(${A}px)`,w.style.width=`${k}px`,setTimeout(()=>{w&&(w.style.transition="transform 0.25s ease-out, width 0.25s ease-out, opacity 0.25s ease-out",a.current=!0)},50)}else g<20&&setTimeout(()=>p(g+1),10)})};if(d||!a.current){const g=setTimeout(()=>p(0),0);return()=>clearTimeout(g)}},[l,d,e,t]),M.useEffect(()=>{if(!e||e==="0"){const g=r.current;g&&(g.style.opacity="0");return}const h=t.find(g=>g.key===e&&g.key!=="ellipsis");if(!h)return;const p=(g=0)=>{requestAnimationFrame(()=>{const b=o.current[h.key],w=r.current,C=s.current;if(b&&C&&w){const E=C.getBoundingClientRect(),T=b.getBoundingClientRect(),A=T.left-E.left,k=T.width;a.current?(w.style.transition="transform 0.25s ease-out, width 0.25s ease-out, opacity 0.25s ease-out",w.style.opacity="1"):(w.style.transition="none",w.style.opacity="1",a.current=!0,setTimeout(()=>{w&&(w.style.transition="transform 0.25s ease-out, width 0.25s ease-out, opacity 0.25s ease-out")},50)),w.style.transform=`translateX(${A}px)`,w.style.width=`${k}px`}else g<10&&setTimeout(()=>p(g+1),10)})};p(0)},[e,t]),!t||t.length===0?null:m.jsxs("div",{ref:s,className:"FormTab",style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"8px",flexWrap:"wrap",width:"auto",position:"relative",...i},children:[m.jsx("div",{ref:r,className:"FormTab__Background",style:{height:"32px",opacity:e&&e!=="0"?1:0,transition:"opacity 0.25s ease-out"}}),t.map(h=>{const p=h.key==="ellipsis",g=h.key===e,b=h.key==="deposit-liquidity";return h.key==="add-pool-liquidity"||h.key,m.jsx("button",{ref:w=>{p||(o.current[h.key]=w)},onClick:()=>!p&&n(h.key),disabled:p,className:`Tab ${g?"selected":""} ${p?"disabled":""}`,style:{padding:p?"8px 4px":b?"4px 10px":"1px 12px 0px 12px",color:p?"rgba(255, 255, 255, 0.4)":b?"#171410":void 0,cursor:p?"default":"pointer",pointerEvents:p?"none":"auto",fontSize:b?"12px":"14px",fontWeight:"500",background:b?"#FFB648":"transparent",borderRadius:b?"999px":void 0,border:b?"none":void 0,boxShadow:"none",transition:b?"all 0.2s ease":void 0},onMouseEnter:w=>{b&&!p&&(w.currentTarget.style.background="#FFC968")},onMouseLeave:w=>{b&&!p&&(w.currentTarget.style.background="#FFB648")},children:h.label},h.key)})]})},Eu=[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_WETH9",type:"address"},{internalType:"address",name:"_tokenDescriptor_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"address",name:"recipient",type:"address"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"Collect",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"DecreaseLiquidity",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"liquidity",type:"uint128"},{indexed:!1,internalType:"uint256",name:"amount0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1",type:"uint256"}],name:"IncreaseLiquidity",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PERMIT_TYPEHASH",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WETH9",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"baseURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"burn",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint128",name:"amount0Max",type:"uint128"},{internalType:"uint128",name:"amount1Max",type:"uint128"}],internalType:"struct INonfungiblePositionManager.CollectParams",name:"params",type:"tuple"}],name:"collect",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"uint160",name:"sqrtPriceX96",type:"uint160"}],name:"createAndInitializePoolIfNecessary",outputs:[{internalType:"address",name:"pool",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct INonfungiblePositionManager.DecreaseLiquidityParams",name:"params",type:"tuple"}],name:"decreaseLiquidity",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"amount0Desired",type:"uint256"},{internalType:"uint256",name:"amount1Desired",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct INonfungiblePositionManager.IncreaseLiquidityParams",name:"params",type:"tuple"}],name:"increaseLiquidity",outputs:[{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint256",name:"amount0Desired",type:"uint256"},{internalType:"uint256",name:"amount1Desired",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"deadline",type:"uint256"}],internalType:"struct INonfungiblePositionManager.MintParams",name:"params",type:"tuple"}],name:"mint",outputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"positions",outputs:[{internalType:"uint96",name:"nonce",type:"uint96"},{internalType:"address",name:"operator",type:"address"},{internalType:"address",name:"token0",type:"address"},{internalType:"address",name:"token1",type:"address"},{internalType:"uint24",name:"fee",type:"uint24"},{internalType:"int24",name:"tickLower",type:"int24"},{internalType:"int24",name:"tickUpper",type:"int24"},{internalType:"uint128",name:"liquidity",type:"uint128"},{internalType:"uint256",name:"feeGrowthInside0LastX128",type:"uint256"},{internalType:"uint256",name:"feeGrowthInside1LastX128",type:"uint256"},{internalType:"uint128",name:"tokensOwed0",type:"uint128"},{internalType:"uint128",name:"tokensOwed1",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[],name:"refundETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowed",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"expiry",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitAllowedIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"selfPermitIfNecessary",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"sweepToken",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount0Owed",type:"uint256"},{internalType:"uint256",name:"amount1Owed",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"uniswapV3MintCallback",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amountMinimum",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"unwrapWETH9",outputs:[],stateMutability:"payable",type:"function"},{stateMutability:"payable",type:"receive"}];class X extends Array{constructor(e,n){if(super(e),this.sign=n,e>X.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded")}static BigInt(e){var n=Math.floor,i=Number.isFinite;if(typeof e=="number"){if(e===0)return X.__zero();if(X.__isOneDigitInt(e))return 0>e?X.__oneDigit(-e,!0):X.__oneDigit(e,!1);if(!i(e)||n(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return X.__fromDouble(e)}if(typeof e=="string"){const s=X.__fromString(e);if(s===null)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return s}
7446if(typeof e=="boolean")return e===!0?X.__oneDigit(1,!1):X.__zero();if(typeof e=="object"){if(e.constructor===X)return e;const s=X.__toPrimitive(e);return X.BigInt(s)}throw new TypeError("Cannot convert "+e+" to a BigInt")}toDebugString(){const e=["BigInt["];for(const n of this)e.push((n&&(n>>>0).toString(16))+", ");return e.push("]"),e.join("")}toString(e=10){if(2>e||36<e)throw new RangeError("toString() radix argument must be between 2 and 36");return this.length===0?"0":(e&e-1)==0?X.__toStringBasePowerOfTwo(this,e):X.__toStringGeneric(this,e,!1)}static toNumber(e){const n=e.length;if(n===0)return 0;if(n===1){const C=e.__unsignedDigit(0);return e.sign?-C:C}const i=e.__digit(n-1),s=X.__clz30(i),r=30*n-s;if(1024<r)return e.sign?-1/0:1/0;let o=r-1,a=i,c=n-1;const l=s+3;let d=l===32?0:a<<l;d>>>=12;const h=l-12;let p=12<=l?0:a<<20+l,g=20+l;for(0<h&&0<c&&(c--,a=e.__digit(c),d|=a>>>30-h,p=a<<h+2,g=h+2);0<g&&0<c;)c--,a=e.__digit(c),p|=30<=g?a<<g-30:a>>>30-g,g-=30;const b=X.__decideRounding(e,g,c,a);if((b===1||b===0&&(1&p)==1)&&(p=p+1>>>0,p===0&&(d++,d>>>20!=0&&(d=0,o++,1023<o))))return e.sign?-1/0:1/0;const w=e.sign?-2147483648:0;return o=o+1023<<20,X.__kBitConversionInts[1]=w|o|d,X.__kBitConversionInts[0]=p,X.__kBitConversionDouble[0]}static unaryMinus(e){if(e.length===0)return e;const n=e.__copy();return n.sign=!e.sign,n}static bitwiseNot(e){return e.sign?X.__absoluteSubOne(e).__trim():X.__absoluteAddOne(e,!0)}static exponentiate(e,n){if(n.sign)throw new RangeError("Exponent must be positive");if(n.length===0)return X.__oneDigit(1,!1);if(e.length===0)return e;if(e.length===1&&e.__digit(0)===1)return e.sign&&(1&n.__digit(0))==0?X.unaryMinus(e):e;if(1<n.length)throw new RangeError("BigInt too big");let i=n.__unsignedDigit(0);if(i===1)return e;if(i>=X.__kMaxLengthBits)throw new RangeError("BigInt too big");if(e.length===1&&e.__digit(0)===2){const o=1+(0|i/30),a=e.sign&&(1&i)!=0,c=new X(o,a);c.__initializeDigits();const l=1<<i%30;return c.__setDigit(o-1,l),c}let s=null,r=e;for((1&i)!=0&&(s=e),i>>=1;i!==0;i>>=1)r=X.multiply(r,r),(1&i)!=0&&(s===null?s=r:s=X.multiply(s,r));return s}static multiply(e,n){if(e.length===0)return e;if(n.length===0)return n;let i=e.length+n.length;30<=e.__clzmsd()+n.__clzmsd()&&i--;const s=new X(i,e.sign!==n.sign);s.__initializeDigits();for(let r=0;r<e.length;r++)X.__multiplyAccumulate(n,e.__digit(r),s,r);return s.__trim()}static divide(e,n){if(n.length===0)throw new RangeError("Division by zero");if(0>X.__absoluteCompare(e,n))return X.__zero();const i=e.sign!==n.sign,s=n.__unsignedDigit(0);let r;if(n.length===1&&32767>=s){if(s===1)return i===e.sign?e:X.unaryMinus(e);r=X.__absoluteDivSmall(e,s,null)}else r=X.__absoluteDivLarge(e,n,!0,!1);return r.sign=i,r.__trim()}static remainder(e,n){if(n.length===0)throw new RangeError("Division by zero");if(0>X.__absoluteCompare(e,n))return e;const i=n.__unsignedDigit(0);if(n.length===1&&32767>=i){if(i===1)return X.__zero();const r=X.__absoluteModSmall(e,i);return r===0?X.__zero():X.__oneDigit(r,e.sign)}const s=X.__absoluteDivLarge(e,n,!1,!0);return s.sign=e.sign,s.__trim()}static add(e,n){const i=e.sign;return i===n.sign?X.__absoluteAdd(e,n,i):0<=X.__absoluteCompare(e,n)?X.__absoluteSub(e,n,i):X.__absoluteSub(n,e,!i)}static subtract(e,n){const i=e.sign;return i===n.sign?0<=X.__absoluteCompare(e,n)?X.__absoluteSub(e,n,i):X.__absoluteSub(n,e,!i):X.__absoluteAdd(e,n,i)}static leftShift(e,n){return n.length===0||e.length===0?e:n.sign?X.__rightShiftByAbsolute(e,n):X.__leftShiftByAbsolute(e,n)}static signedRightShift(e,n){return n.length===0||e.length===0?e:n.sign?X.__leftShiftByAbsolute(e,n):X.__rightShiftByAbsolute(e,n)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(e,n){return 0>X.__compareToBigInt(e,n)}static lessThanOrEqual(e,n){return 0>=X.__compareToBigInt(e,n)}static greaterThan(e,n){return 0<X.__compareToBigInt(e,n)}static greaterThanOrEqual(e,n){return 0<=X.__compareToBigInt(e,n)}static equal(e,n){if(e.sign!==n.sign||e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e.__digit(i)!==n.__digit(i))return!1;return!0}static notEqual(e,n){return!X.equal(e,n)}static bitwiseAnd(e,n){var i=Math.max;if(!e.sign&&!n.sign)return X.__absoluteAnd(e,n).__trim();if(e.sign&&n.sign){const s=i(e.length,n.length)+1;let r=X.__absoluteSubOne(e,s);const o=X.__absoluteSubOne(n);return r=X.__absoluteOr(r,o,r),X.__absoluteAddOne(r,!0,r).__trim()}return e.sign&&([e,n]=[n,e]),X.__absoluteAndNot(e,X.__absoluteSubOne(n)).__trim()}static bitwiseXor(e,n){var i=Math.max;if(!e.sign&&!n.sign)return X.__absoluteXor(e,n).__trim();if(e.sign&&n.sign){const o=i(e.length,n.length),a=X.__absoluteSubOne(e,o),c=X.__absoluteSubOne(n);return X.__absoluteXor(a,c,a).__trim()}const s=i(e.length,n.length)+1;e.sign&&([e,n]=[n,e]);let r=X.__absoluteSubOne(n,s);return r=X.__absoluteXor(r,e,r),X.__absoluteAddOne(r,!0,r).__trim()}static bitwiseOr(e,n){var i=Math.max;const s=i(e.length,n.length);if(!e.sign&&!n.sign)return X.__absoluteOr(e,n).__trim();if(e.sign&&n.sign){let o=X.__absoluteSubOne(e,s);const a=X.__absoluteSubOne(n);return o=X.__absoluteAnd(o,a,o),X.__absoluteAddOne(o,!0,o).__trim()}e.sign&&([e,n]=[n,e]);let r=X.__absoluteSubOne(n,s);return r=X.__absoluteAndNot(r,e,r),X.__absoluteAddOne(r,!0,r).__trim()}static asIntN(e,n){var i=Math.floor;if(n.length===0)return n;if(e=i(e),0>
7446e)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(e===0)return X.__zero();if(e>=X.__kMaxLengthBits)return n;const s=0|(e+29)/30;if(n.length<s)return n;const r=n.__unsignedDigit(s-1),o=1<<(e-1)%30;if(n.length===s&&r<o)return n;if((r&o)!==o)return X.__truncateToNBits(e,n);if(!n.sign)return X.__truncateAndSubFromPowerOfTwo(e,n,!0);if((r&o-1)==0){for(let a=s-2;0<=a;a--)if(n.__digit(a)!==0)return X.__truncateAndSubFromPowerOfTwo(e,n,!1);return n.length===s&&r===o?n:X.__truncateToNBits(e,n)}return X.__truncateAndSubFromPowerOfTwo(e,n,!1)}static asUintN(e,n){var i=Math.floor;if(n.length===0)return n;if(e=i(e),0>e)throw new RangeError("Invalid value: not (convertible to) a safe integer");if(e===0)return X.__zero();if(n.sign){if(e>X.__kMaxLengthBits)throw new RangeError("BigInt too big");return X.__truncateAndSubFromPowerOfTwo(e,n,!1)}if(e>=X.__kMaxLengthBits)return n;const s=0|(e+29)/30;if(n.length<s)return n;const r=e%30;return n.length==s&&(r===0||!(n.__digit(s-1)>>>r))?n:X.__truncateToNBits(e,n)}static ADD(e,n){if(e=X.__toPrimitive(e),n=X.__toPrimitive(n),typeof e=="string")return typeof n!="string"&&(n=n.toString()),e+n;if(typeof n=="string")return e.toString()+n;if(e=X.__toNumeric(e),n=X.__toNumeric(n),X.__isBigInt(e)&&X.__isBigInt(n))return X.add(e,n);if(typeof e=="number"&&typeof n=="number")return e+n;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(e,n){return X.__compare(e,n,0)}static LE(e,n){return X.__compare(e,n,1)}static GT(e,n){return X.__compare(e,n,2)}static GE(e,n){return X.__compare(e,n,3)}static EQ(e,n){for(;;){if(X.__isBigInt(e))return X.__isBigInt(n)?X.equal(e,n):X.EQ(n,e);if(typeof e=="number"){if(X.__isBigInt(n))return X.__equalToNumber(n,e);if(typeof n!="object")return e==n;n=X.__toPrimitive(n)}else if(typeof e=="string"){if(X.__isBigInt(n))return e=X.__fromString(e),e!==null&&X.equal(e,n);if(typeof n!="object")return e==n;n=X.__toPrimitive(n)}else if(typeof e=="boolean"){if(X.__isBigInt(n))return X.__equalToNumber(n,+e);if(typeof n!="object")return e==n;n=X.__toPrimitive(n)}else if(typeof e=="symbol"){if(X.__isBigInt(n))return!1;if(typeof n!="object")return e==n;n=X.__toPrimitive(n)}else if(typeof e=="object"){if(typeof n=="object"&&n.constructor!==X)return e==n;e=X.__toPrimitive(e)}else return e==n}}static NE(e,n){return!X.EQ(e,n)}static __zero(){return new X(0,!1)}static __oneDigit(e,n){const i=new X(1,n);return i.__setDigit(0,e),i}__copy(){const e=new X(this.length,this.sign);for(let n=0;n<this.length;n++)e[n]=this[n];return e}__trim(){let e=this.length,n=this[e-1];for(;n===0;)e--,n=this[e-1],this.pop();return e===0&&(this.sign=!1),this}__initializeDigits(){for(let e=0;e<this.length;e++)this[e]=0}static __decideRounding(e,n,i,s){if(0<n)return-1;let r;if(0>n)r=-n-1;else{if(i===0)return-1;i--,s=e.__digit(i),r=29}let o=1<<r;if((s&o)==0)return-1;if(o-=1,(s&o)!=0)return 1;for(;0<i;)if(i--,e.__digit(i)!==0)return 1;return 0}static __fromDouble(e){X.__kBitConversionDouble[0]=e;const n=2047&X.__kBitConversionInts[1]>>>20,i=n-1023,s=(0|i/30)+1,r=new X(s,0>e);let o=1048575&X.__kBitConversionInts[1]|1048576,a=X.__kBitConversionInts[0];const c=20,l=i%30;let d,h=0;if(l<20){const p=c-l;h=p+32,d=o>>>p,o=o<<32-p|a>>>p,a<<=32-p}else if(l===20)h=32,d=o,o=a,a=0;else{const p=l-c;h=32-p,d=o<<p|a>>>32-p,o=a<<p,a=0}r.__setDigit(s-1,d);for(let p=s-2;0<=p;p--)0<h?(h-=30,d=o>>>2,o=o<<30|a>>>2,a<<=30):d=0,r.__setDigit(p,d);return r.__trim()}static __isWhitespace(e){return 13>=e&&9<=e||(159>=e?e==32:131071>=e?e==160||e==5760:196607>=e?(e&=131071,10>=e||e==40||e==41||e==47||e==95||e==4096):e==65279)}static __fromString(e,n=0){let i=0;const s=e.length;let r=0;if(r===s)return X.__zero();let o=e.charCodeAt(r);for(;X.__isWhitespace(o);){if(++r===s)return X.__zero();o=e.charCodeAt(r)}if(o===43){if(++r===s)return null;o=e.charCodeAt(r),i=1}else if(o===45){if(++r===s)return null;o=e.charCodeAt(r),i=-1}if(n===0){if(n=10,o===48){if(++r===s)return X.__zero();if(o=e.charCodeAt(r),o===88||o===120){if(n=16,++r===s)return null;o=e.charCodeAt(r)}else if(o===79||o===111){if(n=8,++r===s)return null;o=e.charCodeAt(r)}else if(o===66||o===98){if(n=2,++r===s)return null;o=e.charCodeAt(r)}}}else if(n===16&&o===48){if(++r===s)return X.__zero();if(o=e.charCodeAt(r),o===88||o===120){if(++r===s)return null;o=e.charCodeAt(r)}}if(i!=0&&n!==10)return null;for(;o===48;){if(++r===s)return X.__zero();o=e.charCodeAt(r)}const a=s-r;let c=X.__kMaxBitsPerChar[n],l=X.__kBitsPerCharTableMultiplier-1;if(a>1073741824/c)return null;const d=c*a+l>>>X.__kBitsPerCharTableShift,h=new X(0|(d+29)/30,!1),p=10>n?n:10,g=10<n?n-10:0;if((n&n-1)==0){c>>
7446=X.__kBitsPerCharTableShift;const b=[],w=[];let C=!1;do{let E=0,T=0;for(;;){let A;if(o-48>>>0<p)A=o-48;else if((32|o)-97>>>0<g)A=(32|o)-87;else{C=!0;break}if(T+=c,E=E<<c|A,++r===s){C=!0;break}if(o=e.charCodeAt(r),30<T+c)break}b.push(E),w.push(T)}while(!C);X.__fillFromParts(h,b,w)}else{h.__initializeDigits();let b=!1,w=0;do{let C=0,E=1;for(;;){let A;if(o-48>>>0<p)A=o-48;else if((32|o)-97>>>0<g)A=(32|o)-87;else{b=!0;break}const k=E*n;if(1073741823<k)break;if(E=k,C=C*n+A,w++,++r===s){b=!0;break}o=e.charCodeAt(r)}l=30*X.__kBitsPerCharTableMultiplier-1;const T=0|(c*w+l>>>X.__kBitsPerCharTableShift)/30;h.__inplaceMultiplyAdd(E,C,T)}while(!b)}if(r!==s){if(!X.__isWhitespace(o))return null;for(r++;r<s;r++)if(o=e.charCodeAt(r),!X.__isWhitespace(o))return null}return h.sign=i==-1,h.__trim()}static __fillFromParts(e,n,i){let s=0,r=0,o=0;for(let a=n.length-1;0<=a;a--){const c=n[a],l=i[a];r|=c<<o,o+=l,o===30?(e.__setDigit(s++,r),o=0,r=0):30<o&&(e.__setDigit(s++,1073741823&r),o-=30,r=c>>>l-o)}if(r!==0){if(s>=e.length)throw new Error("implementation bug");e.__setDigit(s++,r)}for(;s<e.length;s++)e.__setDigit(s,0)}static __toStringBasePowerOfTwo(e,n){const i=e.length;let s=n-1;s=(85&s>>>1)+(85&s),s=(51&s>>>2)+(51&s),s=(15&s>>>4)+(15&s);const r=s,o=n-1,a=e.__digit(i-1),c=X.__clz30(a);let l=0|(30*i-c+r-1)/r;if(e.sign&&l++,268435456<l)throw new Error("string too long");const d=Array(l);let h=l-1,p=0,g=0;for(let w=0;w<i-1;w++){const C=e.__digit(w),E=(p|C<<g)&o;d[h--]=X.__kConversionChars[E];const T=r-g;for(p=C>>>T,g=30-T;g>=r;)d[h--]=X.__kConversionChars[p&o],p>>>=r,g-=r}const b=(p|a<<g)&o;for(d[h--]=X.__kConversionChars[b],p=a>>>r-g;p!==0;)d[h--]=X.__kConversionChars[p&o],p>>>=r;if(e.sign&&(d[h--]="-"),h!=-1)throw new Error("implementation bug");return d.join("")}static __toStringGeneric(e,n,i){const s=e.length;if(s===0)return"";if(s===1){let w=e.__unsignedDigit(0).toString(n);return i===!1&&e.sign&&(w="-"+w),w}const r=30*s-X.__clz30(e.__digit(s-1)),o=X.__kMaxBitsPerChar[n],a=o-1;let c=r*X.__kBitsPerCharTableMultiplier;c+=a-1,c=0|c/a;const l=c+1>>1,d=X.exponentiate(X.__oneDigit(n,!1),X.__oneDigit(l,!1));let h,p;const g=d.__unsignedDigit(0);if(d.length===1&&32767>=g){h=new X(e.length,!1),h.__initializeDigits();let w=0;for(let C=2*e.length-1;0<=C;C--){const E=w<<15|e.__halfDigit(C);h.__setHalfDigit(C,0|E/g),w=0|E%g}p=w.toString(n)}else{const w=X.__absoluteDivLarge(e,d,!0,!0);h=w.quotient;const C=w.remainder.__trim();p=X.__toStringGeneric(C,n,!0)}h.__trim();let b=X.__toStringGeneric(h,n,!0);for(;p.length<l;)p="0"+p;return i===!1&&e.sign&&(b="-"+b),b+p}static __unequalSign(e){return e?-1:1}static __absoluteGreater(e){return e?-1:1}static __absoluteLess(e){return e?1:-1}static __compareToBigInt(e,n){const i=e.sign;if(i!==n.sign)return X.__unequalSign(i);const s=X.__absoluteCompare(e,n);return 0<s?X.__absoluteGreater(i):0>s?X.__absoluteLess(i):0}static __compareToNumber(e,n){if(X.__isOneDigitInt(n)){const i=e.sign,s=0>n;if(i!==s)return X.__unequalSign(i);if(e.length===0){if(s)throw new Error("implementation bug");return n===0?0:-1}if(1<e.length)return X.__absoluteGreater(i);const r=Math.abs(n),o=e.__unsignedDigit(0);return o>r?X.__absoluteGreater(i):o<r?X.__absoluteLess(i):0}return X.__compareToDouble(e,n)}static __compareToDouble(e,n){if(n!==n)return n;if(n===1/0)return-1;if(n===-1/0)return 1;const i=e.sign;if(i!==0>n)return X.__unequalSign(i);if(n===0)throw new Error("implementation bug: should be handled elsewhere");if(e.length===0)return-1;X.__kBitConversionDouble[0]=n;const s=2047&X.__kBitConversionInts[1]>>>20;if(s==2047)throw new Error("implementation bug: handled elsewhere");const r=s-1023;if(0>r)return X.__absoluteGreater(i);const o=e.length;let a=e.__digit(o-1);const c=X.__clz30(a),l=30*o-c,d=r+1;if(l<d)return X.__absoluteLess(i);if(l>d)return X.__absoluteGreater(i);let h=1048576|1048575&X.__kBitConversionInts[1],p=X.__kBitConversionInts[0];const g=20,b=29-c;if(b!==(0|(l-1)%30))throw new Error("implementation bug");let w,C=0;if(20>b){const E=g-b;C=E+32,w=h>>>E,h=h<<32-E|p>>>E,p<<=32-E}else if(b===20)C=32,w=h,h=p,p=0;else{const E=b-g;C=32-E,w=h<<E|p>>>32-E,h=p<<E,p=0}if(a>>>=0,w>>>=0,a>w)return X.__absoluteGreater(i);if(a<w)return X.__absoluteLess(i);for(let E=o-2;0<=E;E--){0<C?(C-=30,w=h>>>2,h=h<<30|p>>>2,p<<=30):w=0;const T=e.__unsignedDigit(E);if(T>w)return X.__absoluteGreater(i);if(T<w)return X.__absoluteLess(i)}if(h!==0||p!==0){if(C===0)throw new Error("implementation bug");return X.__absoluteLess(i)}return 0}static __equalToNumber(e,n){var i=Math.abs;return X.__isOneDigitInt(n)?n===0?e.length===0:e.length===1&&e.sign===0>n&&e.__unsignedDigit(0)===i(n):X.__compareToDouble(e,n)===0}static __comparisonResultToBool(e,n){return n===0?0>e:n===1?0>=e:n===2?0<e:n===3?0<=e:void 0}static __compare(e,n,i){if(e=X.__toPrimitive(e),n=X.__toPrimitive(n),typeof e=="string"&&typeof n=="string")switch(i){case 0:return e<n;case 1:return e<=n;case 2:return e>n;case 3:return e>=n}if(X.__isBigInt(e)&&typeof n=="string")return n=X.__fromString(n),n!==null&&X.__comparisonResultToBool(X.__compareToBigInt(e,n),i);if(typeof e=="string"&&X.__isBigInt(n))return e=X.__fromString(e),e!==null&&X.__comparisonResultToBool(X.__compareToBigInt(e,n),i);if(e=X.__toNumeric(e),n=X.__toNumeric(n),X.__isBigInt(e)){if(X.__isBigInt(n))return X.__comparisonResultToBool(X.__compareToBigInt(e,n),i);if(typeof n!="number")throw new Error("implementation bug");return X.__comparisonResultToBool(X.__compareToNumber(e,n),i)}if(typeof e!="number")throw new Error("implementation bug");if(X.__isBigInt(n))return X.__comparisonResultToBool(X.__compareToNumber(n,e),2^i);if(typeof n!="number")throw new Error("implementation bug");return i===0?e<n:i===1?e<=n:i===2?e>n:i===3?e>=n:void 0}__clzmsd(){return X.__clz30(this.__digit(this.length-1))}static __absoluteAdd(e,n,i){if(e.length<n.length)return X.__absoluteAdd(n,e,i);if(e.length===0)return e;if(n.length===0)return e.sign===i?e:X.unaryMinus(e);let s=e.length;(e.__clzmsd()===0||n.length===e.length&&n.__clzmsd()===0)&&s++;const r=new X(s,i);let o=0,a=0;for(;a<n.length;a++){const c=e.__digit(a)+n.__digit(a)+o;o=c>>>30,r.__setDigit(a,1073741823&c)}for(;a<e.length;a++){const c=e.__digit(a)+o;o=c>>>30,r.__setDigit(a,1073741823&c)}return a<r.length&&r.__setDigit(a,o),r.__trim()}static __absoluteSub(e,n,i){if(e.length===0)return e;if(n.length===0)return e.sign===i?e:X.unaryMinus(e);const s=new X(e.length,i);let r=0,o=0;for(;o<n.length;o++){const a=e.__digit(o)-n.__digit(o)-r;r=1&a>>>30,s.__setDigit(o,1073741823&a)}for(;o<e.length;o++){const a=e.__digit(o)-r;r=1&a>>>30,s.__setDigit(o,1073741823&a)}return s.__trim()}static __absoluteAddOne(e,n,i=null){const s=e.length;i===null?i=new X(s,n):i.sign=n;let r=1;for(let o=0;o<s;o++){const a=e.__digit(o)+r;
7446r=a>>>30,i.__setDigit(o,1073741823&a)}return r!=0&&i.__setDigitGrow(s,1),i}static __absoluteSubOne(e,n){const i=e.length;n=n||i;const s=new X(n,!1);let r=1;for(let o=0;o<i;o++){const a=e.__digit(o)-r;r=1&a>>>30,s.__setDigit(o,1073741823&a)}if(r!=0)throw new Error("implementation bug");for(let o=i;o<n;o++)s.__setDigit(o,0);return s}static __absoluteAnd(e,n,i=null){let s=e.length,r=n.length,o=r;if(s<r){o=s;const l=e,d=s;e=n,s=r,n=l,r=d}let a=o;i===null?i=new X(a,!1):a=i.length;let c=0;for(;c<o;c++)i.__setDigit(c,e.__digit(c)&n.__digit(c));for(;c<a;c++)i.__setDigit(c,0);return i}static __absoluteAndNot(e,n,i=null){const s=e.length,r=n.length;let o=r;s<r&&(o=s);let a=s;i===null?i=new X(a,!1):a=i.length;let c=0;for(;c<o;c++)i.__setDigit(c,e.__digit(c)&~n.__digit(c));for(;c<s;c++)i.__setDigit(c,e.__digit(c));for(;c<a;c++)i.__setDigit(c,0);return i}static __absoluteOr(e,n,i=null){let s=e.length,r=n.length,o=r;if(s<r){o=s;const l=e,d=s;e=n,s=r,n=l,r=d}let a=s;i===null?i=new X(a,!1):a=i.length;let c=0;for(;c<o;c++)i.__setDigit(c,e.__digit(c)|n.__digit(c));for(;c<s;c++)i.__setDigit(c,e.__digit(c));for(;c<a;c++)i.__setDigit(c,0);return i}static __absoluteXor(e,n,i=null){let s=e.length,r=n.length,o=r;if(s<r){o=s;const l=e,d=s;e=n,s=r,n=l,r=d}let a=s;i===null?i=new X(a,!1):a=i.length;let c=0;for(;c<o;c++)i.__setDigit(c,e.__digit(c)^n.__digit(c));for(;c<s;c++)i.__setDigit(c,e.__digit(c));for(;c<a;c++)i.__setDigit(c,0);return i}static __absoluteCompare(e,n){const i=e.length-n.length;if(i!=0)return i;let s=e.length-1;for(;0<=s&&e.__digit(s)===n.__digit(s);)s--;return 0>s?0:e.__unsignedDigit(s)>n.__unsignedDigit(s)?1:-1}static __multiplyAccumulate(e,n,i,s){if(n===0)return;const r=32767&n,o=n>>>15;let a=0,c=0;for(let l,d=0;d<e.length;d++,s++){l=i.__digit(s);const h=e.__digit(d),p=32767&h,g=h>>>15,b=X.__imul(p,r),w=X.__imul(p,o),C=X.__imul(g,r),E=X.__imul(g,o);l+=c+b+a,a=l>>>30,l&=1073741823,l+=((32767&w)<<15)+((32767&C)<<15),a+=l>>>30,c=E+(w>>>15)+(C>>>15),i.__setDigit(s,1073741823&l)}for(;a!=0||c!==0;s++){let l=i.__digit(s);l+=a+c,c=0,a=l>>>30,i.__setDigit(s,1073741823&l)}}static __internalMultiplyAdd(e,n,i,s,r){let o=i,a=0;for(let c=0;c<s;c++){const l=e.__digit(c),d=X.__imul(32767&l,n),h=X.__imul(l>>>15,n),p=d+((32767&h)<<15)+a+o;o=p>>>30,a=h>>>15,r.__setDigit(c,1073741823&p)}if(r.length>s)for(r.__setDigit(s++,o+a);s<r.length;)r.__setDigit(s++,0);else if(o+a!==0)throw new Error("implementation bug")}__inplaceMultiplyAdd(e,n,i){i>this.length&&(i=this.length);const s=32767&e,r=e>>>15;let o=0,a=n;for(let c=0;c<i;c++){const l=this.__digit(c),d=32767&l,h=l>>>15,p=X.__imul(d,s),g=X.__imul(d,r),b=X.__imul(h,s),w=X.__imul(h,r);let C=a+p+o;o=C>>>30,C&=1073741823,C+=((32767&g)<<15)+((32767&b)<<15),o+=C>>>30,a=w+(g>>>15)+(b>>>15),this.__setDigit(c,1073741823&C)}if(o!=0||a!==0)throw new Error("implementation bug")}static __absoluteDivSmall(e,n,i=null){i===null&&(i=new X(e.length,!1));let s=0;for(let r,o=2*e.length-1;0<=o;o-=2){r=(s<<15|e.__halfDigit(o))>>>0;const a=0|r/n;s=0|r%n,r=(s<<15|e.__halfDigit(o-1))>>>0;const c=0|r/n;s=0|r%n,i.__setDigit(o>>>1,a<<15|c)}return i}static __absoluteModSmall(e,n){let i=0;for(let s=2*e.length-1;0<=s;s--)i=0|((i<<15|e.__halfDigit(s))>>>0)%n;return i}static __absoluteDivLarge(e,n,i,s){const r=n.__halfDigitLength(),o=n.length,a=e.__halfDigitLength()-r;let c=null;i&&(c=new X(a+2>>>1,!1),c.__initializeDigits());const l=new X(r+2>>>1,!1);l.__initializeDigits();const d=X.__clz15(n.__halfDigit(r-1));0<d&&(n=X.__specialLeftShift(n,d,0));const h=X.__specialLeftShift(e,d,1),p=n.__halfDigit(r-1);let g=0;for(let b,w=a;0<=w;w--){b=32767;const C=h.__halfDigit(w+r);if(C!==p){const T=(C<<15|h.__halfDigit(w+r-1))>>>0;b=0|T/p;let A=0|T%p;const k=n.__halfDigit(r-2),R=h.__halfDigit(w+r-2);for(;X.__imul(b,k)>>>0>(A<<16|R)>>>0&&(b--,A+=p,!(32767<A)););}X.__internalMultiplyAdd(n,b,0,o,l);let E=h.__inplaceSub(l,w,r+1);E!==0&&(E=h.__inplaceAdd(n,w,r),h.__setHalfDigit(w+r,32767&h.__halfDigit(w+r)+E),b--),i&&(1&w?g=b<<15:c.__setDigit(w>>>1,g|b))}if(s)return h.__inplaceRightShift(d),i?{quotient:c,remainder:h}:h;if(i)return c;throw new Error("unreachable")}static __clz15(e){return X.__clz30(e)-15}__inplaceAdd(e,n,i){let s=0;for(let r=0;r<i;r++){const o=this.__halfDigit(n+r)+e.__halfDigit(r)+s;s=o>>>15,this.__setHalfDigit(n+r,32767&o)}return s}__inplaceSub(e,n,i){let s=0;if(1&n){n>>=1;let r=this.__digit(n),o=32767&r,a=0;for(;a<i-1>>>1;a++){const d=e.__digit(a),h=(r>>>15)-(32767&d)-s;s=1&h>>>15,this.__setDigit(n+a,(32767&h)<<15|32767&o),r=this.__digit(n+a+1),o=(32767&r)-(d>>>15)-s,s=1&o>>>15}const c=e.__digit(a),l=(r>>>15)-(32767&c)-s;if(s=1&l>>>15,this.__setDigit(n+a,(32767&l)<<15|32767&o),n+a+1>=this.length)throw new RangeError("out of bounds");(1&i)==0&&(r=this.__digit(n+a+1),o=(32767&r)-(c>>>15)-s,s=1&o>>>15,this.__setDigit(n+e.length,1073709056&r|32767&o))}else{n>>=1;let r=0;for(;r<e.length-1;r++){const d=this.__digit(n+r),h=e.__digit(r),p=(32767&d)-(32767&h)-s;s=1&p>>>15;const g=(d>>>15)-(h>>>15)-s;s=1&g>>>15,this.__setDigit(n+r,(32767&g)<<15|32767&p)}
7446const o=this.__digit(n+r),a=e.__digit(r),c=(32767&o)-(32767&a)-s;s=1&c>>>15;let l=0;(1&i)==0&&(l=(o>>>15)-(a>>>15)-s,s=1&l>>>15),this.__setDigit(n+r,(32767&l)<<15|32767&c)}return s}__inplaceRightShift(e){if(e===0)return;let n=this.__digit(0)>>>e;const i=this.length-1;for(let s=0;s<i;s++){const r=this.__digit(s+1);this.__setDigit(s,1073741823&r<<30-e|n),n=r>>>e}this.__setDigit(i,n)}static __specialLeftShift(e,n,i){const s=e.length,r=new X(s+i,!1);if(n===0){for(let a=0;a<s;a++)r.__setDigit(a,e.__digit(a));return 0<i&&r.__setDigit(s,0),r}let o=0;for(let a=0;a<s;a++){const c=e.__digit(a);r.__setDigit(a,1073741823&c<<n|o),o=c>>>30-n}return 0<i&&r.__setDigit(s,o),r}static __leftShiftByAbsolute(e,n){const i=X.__toShiftAmount(n);if(0>i)throw new RangeError("BigInt too big");const s=0|i/30,r=i%30,o=e.length,a=r!==0&&e.__digit(o-1)>>>30-r!=0,c=o+s+(a?1:0),l=new X(c,e.sign);if(r===0){let d=0;for(;d<s;d++)l.__setDigit(d,0);for(;d<c;d++)l.__setDigit(d,e.__digit(d-s))}else{let d=0;for(let h=0;h<s;h++)l.__setDigit(h,0);for(let h=0;h<o;h++){const p=e.__digit(h);l.__setDigit(h+s,1073741823&p<<r|d),d=p>>>30-r}if(a)l.__setDigit(o+s,d);else if(d!==0)throw new Error("implementation bug")}return l.__trim()}static __rightShiftByAbsolute(e,n){const i=e.length,s=e.sign,r=X.__toShiftAmount(n);if(0>r)return X.__rightShiftByMaximum(s);const o=0|r/30,a=r%30;let c=i-o;if(0>=c)return X.__rightShiftByMaximum(s);let l=!1;if(s){if((e.__digit(o)&(1<<a)-1)!=0)l=!0;else for(let h=0;h<o;h++)if(e.__digit(h)!==0){l=!0;break}}l&&a===0&&~e.__digit(i-1)==0&&c++;let d=new X(c,s);if(a===0){d.__setDigit(c-1,0);for(let h=o;h<i;h++)d.__setDigit(h-o,e.__digit(h))}else{let h=e.__digit(o)>>>a;const p=i-o-1;for(let g=0;g<p;g++){const b=e.__digit(g+o+1);d.__setDigit(g,1073741823&b<<30-a|h),h=b>>>a}d.__setDigit(p,h)}return l&&(d=X.__absoluteAddOne(d,!0,d)),d.__trim()}static __rightShiftByMaximum(e){return e?X.__oneDigit(1,!0):X.__zero()}static __toShiftAmount(e){if(1<e.length)return-1;const n=e.__unsignedDigit(0);return n>X.__kMaxLengthBits?-1:n}static __toPrimitive(e,n="default"){if(typeof e!="object"||e.constructor===X)return e;if(typeof Symbol<"u"&&typeof Symbol.toPrimitive=="symbol"){const r=e[Symbol.toPrimitive];if(r){const o=r(n);if(typeof o!="object")return o;throw new TypeError("Cannot convert object to primitive value")}}const i=e.valueOf;if(i){const r=i.call(e);if(typeof r!="object")return r}const s=e.toString;if(s){const r=s.call(e);if(typeof r!="object")return r}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(e){return X.__isBigInt(e)?e:+e}static __isBigInt(e){return typeof e=="object"&&e!==null&&e.constructor===X}static __truncateToNBits(e,n){const i=0|(e+29)/30,s=new X(i,n.sign),r=i-1;for(let a=0;a<r;a++)s.__setDigit(a,n.__digit(a));let o=n.__digit(r);if(e%30!=0){const a=32-e%30;o=o<<a>>>a}return s.__setDigit(r,o),s.__trim()}static __truncateAndSubFromPowerOfTwo(e,n,i){var s=Math.min;const r=0|(e+29)/30,o=new X(r,i);let a=0;const c=r-1;let l=0;for(const g=s(c,n.length);a<g;a++){const b=0-n.__digit(a)-l;l=1&b>>>30,o.__setDigit(a,1073741823&b)}for(;a<c;a++)o.__setDigit(a,0|1073741823&-l);let d=c<n.length?n.__digit(c):0;const h=e%30;let p;if(h==0)p=0-d-l,p&=1073741823;else{const g=32-h;d=d<<g>>>g;const b=1<<32-g;p=b-d-l,p&=b-1}return o.__setDigit(c,p),o.__trim()}__digit(e){return this[e]}__unsignedDigit(e){return this[e]>>>0}__setDigit(e,n){this[e]=0|n}__setDigitGrow(e,n){this[e]=0|n}__halfDigitLength(){const e=this.length;return 32767>=this.__unsignedDigit(e-1)?2*e-1:2*e}__halfDigit(e){return 32767&this[e>>>1]>>>15*(1&e)}__setHalfDigit(e,n){const i=e>>>1,s=this.__digit(i),r=1&e?32767&s|n<<15:1073709056&s|32767&n;this.__setDigit(i,r)}static __digitPow(e,n){let i=1;for(;0<n;)1&n&&(i*=e),n>>>=1,e*=e;return i}static __isOneDigitInt(e){return(1073741823&e)===e}}X.__kMaxLength=33554432,X.__kMaxLengthBits=X.__kMaxLength<<5,X.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],X.__kBitsPerCharTableShift=5,X.__kBitsPerCharTableMultiplier=1<<X.__kBitsPerCharTableShift,X.__kConversionChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],X.__kBitConversionBuffer=new ArrayBuffer(8),X.__kBitConversionDouble=new Float64Array(X.__kBitConversionBuffer),X.__kBitConversionInts=new Int32Array(X.__kBitConversionBuffer),X.__clz30=Math.clz32?function(t){return Math.clz32(t)-2}:function(t){return t===0?30:0|29-(0|Math.log(t>>>0)/Math.LN2)},X.__imul=Math.imul||function(t,e){return 0|t*e};var Wze="Invariant failed";function pn(t,e){throw new Error(Wze)}
vendor: 11,595 bytes, line 7446
7446var ew=1e9,qze={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},iL,Ns=!0,Ll="[DecimalError] ",yg=Ll+"Invalid argument: ",nL=Ll+"Exponent out of range: ",tw=Math.floor,Rm=Math.pow,zze=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Lc,Jr=1e7,bs=7,Wre=9007199254740991,r8=tw(Wre/bs),qt={};qt.absoluteValue=qt.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};qt.comparedTo=qt.cmp=function(t){var e,n,i,s,r=this;if(t=new r.constructor(t),r.s!==t.s)return r.s||-t.s;if(r.e!==t.e)return r.e>t.e^r.s<0?1:-1;for(i=r.d.length,s=t.d.length,e=0,n=i<s?i:s;e<n;++e)if(r.d[e]!==t.d[e])return r.d[e]>t.d[e]^r.s<0?1:-1;return i===s?0:i>s^r.s<0?1:-1};qt.decimalPlaces=qt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*bs;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};qt.dividedBy=qt.div=function(t){return uf(this,new this.constructor(t))};qt.dividedToIntegerBy=qt.idiv=function(t){var e=this,n=e.constructor;return as(uf(e,new n(t),0,1),n.precision)};qt.equals=qt.eq=function(t){return!this.cmp(t)};qt.exponent=function(){return Er(this)};qt.greaterThan=qt.gt=function(t){return this.cmp(t)>0};qt.greaterThanOrEqualTo=qt.gte=function(t){return this.cmp(t)>=0};qt.isInteger=qt.isint=function(){return this.e>this.d.length-2};qt.isNegative=qt.isneg=function(){return this.s<0};qt.isPositive=qt.ispos=function(){return this.s>0};qt.isZero=function(){return this.s===0};qt.lessThan=qt.lt=function(t){return this.cmp(t)<0};qt.lessThanOrEqualTo=qt.lte=function(t){return this.cmp(t)<1};qt.logarithm=qt.log=function(t){var e,n=this,i=n.constructor,s=i.precision,r=s+5;if(t===void 0)t=new i(10);else if(t=new i(t),t.s<1||t.eq(Lc))throw Error(Ll+"NaN");if(n.s<1)throw Error(Ll+(n.s?"NaN":"-Infinity"));return n.eq(Lc)?new i(0):(Ns=!1,e=uf(H5(n,r),H5(t,r),r),Ns=!0,as(e,s))};qt.minus=qt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Hre(e,t):qre(e,(t.s=-t.s,t))};qt.modulo=qt.mod=function(t){var e,n=this,i=n.constructor,s=i.precision;if(t=new i(t),!t.s)throw Error(Ll+"NaN");return n.s?(Ns=!1,e=uf(n,t,0,1).times(t),Ns=!0,n.minus(e)):as(new i(n),s)};qt.naturalExponential=qt.exp=function(){return zre(this)};qt.naturalLogarithm=qt.ln=function(){return H5(this)};qt.negated=qt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};qt.plus=qt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?qre(e,t):Hre(e,(t.s=-t.s,t))};qt.precision=qt.sd=function(t){var e,n,i,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(yg+t);if(e=Er(s)+1,i=s.d.length-1,n=i*bs+1,i=s.d[i],i){for(;i%10==0;i/=10)n--;for(i=s.d[0];i>=10;i/=10)n++}return t&&e>n?e:n};qt.squareRoot=qt.sqrt=function(){var t,e,n,i,s,r,o,a=this,c=a.constructor;if(a.s<1){if(!a.s)return new c(0);throw Error(Ll+"NaN")}for(t=Er(a),Ns=!1,s=Math.sqrt(+a),s==0||s==1/0?(e=Cd(a.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=tw((t+1)/2)-(t<0||t%2),s==1/0?e="5e"+t:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),i=new c(e)):i=new c(s.toString()),n=c.precision,s=o=n+3;;)if(r=i,i=r.plus(uf(a,r,o+2)).times(.5),Cd(r.d).slice(0,o)===(e=Cd(i.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(as(r,n+1,0),r.times(r).eq(a)){i=r;break}}else if(e!="9999")break;o+=4}return Ns=!0,as(i,n)};qt.times=qt.mul=function(t){var e,n,i,s,r,o,a,c,l,d=this,h=d.constructor,p=d.d,g=(t=new h(t)).d;if(!d.s||!t.s)return new h(0);for(t.s*=d.s,n=d.e+t.e,c=p.length,l=g.length,c<l&&(r=p,p=g,g=r,o=c,c=l,l=o),r=[],o=c+l,i=o;i--;)r.push(0);for(i=l;--i>=0;){for(e=0,s=c+i;s>i;)a=r[s]+g[i]*p[s-i-1]+e,r[s--]=a%Jr|0,e=a/Jr|0;r[s]=(r[s]+e)%Jr|0}for(;!r[--o];)r.pop();return e?++n:r.shift(),t.d=r,t.e=n,Ns?as(t,h.precision):t};qt.toDecimalPlaces=qt.todp=function(t,e){var n=this,i=n.constructor;return n=new i(n),t===void 0?n:(Vd(t,0,ew),e===void 0?e=i.rounding:Vd(e,0,8),as(n,t+Er(n)+1,e))};qt.toExponential=function(t,e){var n,i=this,s=i.constructor;return t===void 0?n=s1(i,!0):(Vd(t,0,ew),e===void 0?e=s.rounding:Vd(e,0,8),i=as(new s(i),t+1,e),n=s1(i,!0,t+1)),n};qt.toFixed=function(t,e){var n,i,s=this,r=s.constructor;return t===void 0?s1(s):(Vd(t,0,ew),e===void 0?e=r.rounding:Vd(e,0,8),i=as(new r(s),t+Er(s)+1,e),n=s1(i.abs(),!1,t+Er(i)+1),s.isneg()&&!s.isZero()?"-"+n:n)};qt.toInteger=qt.toint=function(){var t=this,e=t.constructor;return as(new e(t),Er(t)+1,e.rounding)};qt.toNumber=function(){return+this};qt.toPower=qt.pow=function(t){var e,n,i,s,r,o,a=this,c=a.constructor,l=12,d=+(t=new c(t));if(!t.s)return new c(Lc);if(a=new c(a),!a.s){if(t.s<1)throw Error(Ll+"Infinity");return a}if(a.eq(Lc))return a;if(i=c.precision,t.eq(Lc))return as(a,i);if(e=t.e,n=t.d.length-1,o=e>=n,r=a.s,o){if((n=d<0?-d:d)<=Wre){for(s=new c(Lc),e=Math.ceil(i/bs+4),Ns=!1;n%2&&(s=s.times(a),DG(s.d,e)),n=tw(n/2),n!==0;)a=a.times(a),DG(a.d,e);return Ns=!0,t.s<0?new c(Lc).div(s):as(s,i)}}else if(r<0)throw Error(Ll+"NaN");return r=r<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,Ns=!1,s=t.times(H5(a,i+l)),Ns=!0,s=zre(s),s.s=r,s};qt.toPrecision=function(t,e){var n,i,s=this,r=s.constructor;return t===void 0?(n=Er(s),i=s1(s,n<=r.toExpNeg||n>=r.toExpPos)):(Vd(t,1,ew),e===void 0?e=r.rounding:Vd(e,0,8),s=as(new r(s),t,e),n=Er(s),i=s1(s,t<=n||n<=r.toExpNeg,t)),i};qt.toSignificantDigits=qt.tosd=function(t,e){var n=this,i=n.constructor;return t===void 0?(t=i.precision,e=i.rounding):(Vd(t,1,ew),e===void 0?e=i.rounding:Vd(e,0,8)),as(new i(n),t,e)};qt.toString=qt.valueOf=qt.val=qt.toJSON=qt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Er(t),n=t.constructor;return s1(t,e<=n.toExpNeg||e>=n.toExpPos)};function qre(t,e){var n,i,s,r,o,a,c,l,d=t.constructor,h=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Ns?as(e,h):e;if(c=t.d,l=e.d,o=t.e,s=e.e,c=c.slice(),r=o-s,r){for(r<0?(i=c,r=-r,a=l.length):(i=l,s=o,a=c.length),o=Math.ceil(h/bs),a=o>a?o+1:a+1,r>a&&(r=a,i.length=1),i.reverse();r--;)i.push(0);i.reverse()}for(a=c.length,r=l.length,a-r<0&&(r=a,i=l,l=c,c=i),n=0;r;)n=(c[--r]=c[r]+l[r]+n)/Jr|0,c[r]%=Jr;for(n&&(c.unshift(n),++s),a=c.length;c[--a]==0;)c.pop();return e.d=c,e.e=s,Ns?as(e,h):e}function Vd(t,e,n){if(t!==~~t||t<e||t>n)throw Error(yg+t)}function Cd(t){var e,n,i,s=t.length-1,r="",o=t[0];if(s>0){for(r+=o,e=1;e<s;e++)i=t[e]+"",n=bs-i.length,n&&(r+=V0(n)),r+=i;o=t[e],i=o+"",n=bs-i.length,n&&(r+=V0(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return r+o}var uf=(function(){function t(i,s){var r,o=0,a=i.length;for(i=i.slice();a--;)r=i[a]*s+o,i[a]=r%Jr|0,o=r/Jr|0;return o&&i.unshift(o),i}function e(i,s,r,o){var a,c;if(r!=o)c=r>o?1:-1;else for(a=c=0;a<r;a++)if(i[a]!=s[a]){c=i[a]>s[a]?1:-1;break}return c}function n(i,s,r){for(var o=0;r--;)i[r]-=o,o=i[r]<s[r]?1:0,i[r]=o*Jr+i[r]-s[r];for(;!i[0]&&i.length>1;)i.shift()}return function(i,s,r,o){var a,c,l,d,h,p,g,b,w,C,E,T,A,k,R,P,B,F,z=i.constructor,K=i.s==s.s?1:-1,q=i.d,G=s.d;if(!i.s)return new z(i);if(!s.s)throw Error(Ll+"Division by zero");for(c=i.e-s.e,B=G.length,R=q.length,g=new z(K),b=g.d=[],l=0;G[l]==(q[l]||0);)++l;if(G[l]>(q[l]||0)&&--c,r==null?T=r=z.precision:o?T=r+(Er(i)-Er(s))+1:T=r,T<0)return new z(0);if(T=T/bs+2|0,l=0,B==1)for(d=0,G=G[0],T++;(l<R||d)&&T--;l++)A=d*Jr+(q[l]||0),b[l]=A/G|0,d=A%G|0;else{for(d=Jr/(G[0]+1)|0,d>1&&(G=t(G,d),q=t(q,d),B=G.length,R=q.length),k=B,w=q.slice(0,B),C=w.length;C<B;)w[C++]=0;F=G.slice(),F.unshift(0),P=G[0],G[1]>=Jr/2&&++P;do d=0,a=e(G,w,B,C),a<0?(E=w[0],B!=C&&(E=E*Jr+(w[1]||0)),d=E/P|0,d>1?(d>=Jr&&(d=Jr-1),h=t(G,d),p=h.length,C=w.length,a=e(h,w,p,C),a==1&&(d--,n(h,B<p?F:G,p))):(d==0&&(a=d=1),h=G.slice()),p=h.length,p<C&&h.unshift(0),n(w,h,C),a==-1&&(C=w.length,a=e(G,w,B,C),a<1&&(d++,n(w,B<C?F:G,C))),C=w.length):a===0&&(d++,w=[0]),b[l++]=d,a&&w[0]?w[C++]=q[k]||0:(w=[q[k]],C=1);while((k++<R||w[0]!==void 0)&&T--)}return b[0]||b.shift(),g.e=c,as(g,o?r+Er(g)+1:r)}})();function zre(t,e){var n,i,s,r,o,a,c=0,l=0,d=t.constructor,h=d.precision;if(Er(t)>16)throw Error(nL+Er(t));if(!t.s)return new d(Lc);for(Ns=!1,a=h,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),l+=5;for(i=Math.log(Rm(2,l))/Math.LN10*2+5|0,a+=i,n=s=r=new d(Lc),d.precision=a;;){if(s=as(s.times(t),a),n=n.times(++c),o=r.plus(uf(s,n,a)),Cd(o.d).slice(0,a)===Cd(r.d).slice(0,a)){for(;l--;)r=as(r.times(r),a);return d.precision=h,e==null?(Ns=!0,as(r,h)):r}r=o}}function Er(t){for(var e=t.e*bs,n=t.d[0];n>=10;n/=10)e++;return e}function $k(t,e,n){if(e>t.LN10.sd())throw Ns=!0,n&&(t.precision=n),Error(Ll+"LN10 precision limit exceeded");return as(new t(t.LN10),e)}function V0(t){for(var e="";t--;)e+="0";return e}function H5(t,e){var n,i,s,r,o,a,c,l,d,h=1,p=10,g=t,b=g.d,w=g.constructor,C=w.precision;if(g.s<1)throw Error(Ll+(g.s?"NaN":"-Infinity"));if(g.eq(Lc))return new w(0);if(e==null?(Ns=!1,l=C):l=e,g.eq(10))return e==null&&(Ns=!0),$k(w,l);if(l+=p,w.precision=l,n=Cd(b),i=n.charAt(0),r=Er(g),Math.abs(r)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)g=g.times(t),n=Cd(g.d),i=n.charAt(0),h++;r=Er(g),i>1?(g=new w("0."+n),r++):g=new w(i+"."+n.slice(1))}else return c=$k(w,l+2,C).times(r+""),g=H5(new w(i+"."+n.slice(1)),l-p).plus(c),w.precision=C,e==null?(Ns=!0,as(g,C)):g;for(a=o=g=uf(g.minus(Lc),g.plus(Lc),l),d=as(g.times(g),l),s=3;;){if(o=as(o.times(d),l),c=a.plus(uf(o,new w(s),l)),Cd(c.d).slice(0,l)===Cd(a.d).slice(0,l))return a=a.times(2),r!==0&&(a=a.plus($k(w,l+2,C).times(r+""))),a=uf(a,new w(h),l),w.precision=C,e==null?(Ns=!0,as(a,C)):a;a=c,s+=2}}function IG(t,e){var n,i,s;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(i=e.search(/e/i))>0?(n<0&&(n=i),n+=+e.slice(i+1),e=e.substring(0,i)):n<0&&(n=e.length),i=0;e.charCodeAt(i)===48;)++i;for(s=e.length;e.charCodeAt(s-1)===48;)--s;if(e=e.slice(i,s),e){if(s-=i,n=n-i-1,t.e=tw(n/bs),t.d=[],i=(n+1)%bs,n<0&&(i+=bs),i<s){for(i&&t.d.push(+e.slice(0,i)),s-=bs;i<s;)t.d.push(+e.slice(i,i+=bs));e=e.slice(i),i=bs-e.length}else i-=s;for(;i--;)e+="0";if(t.d.push(+e),Ns&&(t.e>r8||t.e<-r8))throw Error(nL+n)}else t.s=0,t.e=0,t.d=[0];return t}function as(t,e,n){var i,s,r,o,a,c,l,d,h=t.d;for(o=1,r=h[0];r>=10;r/=10)o++;if(i=e-o,i<0)i+=bs,s=e,l=h[d=0];else{if(d=Math.ceil((i+1)/bs),r=h.length,d>=r)return t;for(l=r=h[d],o=1;r>=10;r/=10)o++;i%=bs,s=i-bs+o}if(n!==void 0&&(r=Rm(10,o-s-1),a=l/r%10|0,c=e<0||h[d+1]!==void 0||l%r,c=n<4?(a||c)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||c||n==6&&(i>0?s>0?l/Rm(10,o-s):0:h[d-1])%10&1||n==(t.s<0?8:7))),e<1||!h[0])return c?(r=Er(t),h.length=1,e=e-r-1,h[0]=Rm(10,(bs-e%bs)%bs),t.e=tw(-e/bs)||0):(h.length=1,h[0]=t.e=t.s=0),t;if(i==0?(h.length=d,r=1,d--):(h.length=d+1,r=Rm(10,bs-i),h[d]=s>0?(l/Rm(10,o-s)%Rm(10,s)|0)*r:0),c)for(;;)if(d==0){(h[0]+=r)==Jr&&(h[0]=1,++t.e);break}else{if(h[d]+=r,h[d]!=Jr)break;h[d--]=0,r=1}for(i=h.length;h[--i]===0;)h.pop();if(Ns&&(t.e>r8||t.e<-r8))throw Error(nL+Er(t));return t}function Hre(t,e){var n,i,s,r,o,a,c,l,d,h,p=t.constructor,g=p.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new p(t),Ns?as(e,g):e;if(c=t.d,h=e.d,i=e.e,l=t.e,c=c.slice(),o=l-i,o){for(d=o<0,d?(n=c,o=-o,a=h.length):(n=h,i=l,a=c.length),s=Math.max(Math.ceil(g/bs),a)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,a=h.length,d=s<a,d&&(a=s),s=0;s<a;s++)if(c[s]!=h[s]){d=c[s]<h[s];break}o=0}for(d&&(n=c,c=h,h=n,e.s=-e.s),a=c.length,s=h.length-a;s>0;--s)c[a++]=0;for(s=h.length;s>o;){if(c[--s]<h[s]){for(r=s;r&&c[--r]===0;)c[r]=Jr-1;--c[r],c[s]+=Jr}c[s]-=h[s]}for(;c[--a]===0;)c.pop();for(;c[0]===0;c.shift())--i;return c[0]?(e.d=c,e.e=i,Ns?as(e,g):e):new p(0)}function s1(t,e,n){var i,s=Er(t),r=Cd(t.d),o=r.length;return e?(n&&(i=n-o)>0?r=r.charAt(0)+"."+r.slice(1)+V0(i):o>1&&(r=r.charAt(0)+"."+r.slice(1)),r=r+(s<0?"e":"e+")+s):s<0?(r="0."+V0(-s-1)+r,n&&(i=n-o)>
74460&&(r+=V0(i))):s>=o?(r+=V0(s+1-o),n&&(i=n-s-1)>0&&(r=r+"."+V0(i))):((i=s+1)<o&&(r=r.slice(0,i)+"."+r.slice(i)),n&&(i=n-o)>0&&(s+1===o&&(r+="."),r+=V0(i))),t.s<0?"-"+r:r}function DG(t,e){if(t.length>e)return t.length=e,!0}function Gre(t){var e,n,i;function s(r){var o=this;if(!(o instanceof s))return new s(r);if(o.constructor=s,r instanceof s){o.s=r.s,o.e=r.e,o.d=(r=r.d)?r.slice():r;return}if(typeof r=="number"){if(r*0!==0)throw Error(yg+r);if(r>0)o.s=1;else if(r<0)r=-r,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(r===~~r&&r<1e7){o.e=0,o.d=[r];return}return IG(o,r.toString())}else if(typeof r!="string")throw Error(yg+r);if(r.charCodeAt(0)===45?(r=r.slice(1),o.s=-1):o.s=1,zze.test(r))IG(o,r);else throw Error(yg+r)}if(s.prototype=qt,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=Gre,s.config=s.set=Hze,t===void 0&&(t={}),t)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<i.length;)t.hasOwnProperty(n=i[e++])||(t[n]=this[n]);return s.config(t),s}function Hze(t){if(!t||typeof t!="object")throw Error(Ll+"Object expected");var e,n,i,s=["precision",1,ew,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<s.length;e+=3)if((i=t[n=s[e]])!==void 0)if(tw(i)===i&&i>=s[e+1]&&i<=s[e+2])this[n]=i;else throw Error(yg+n+": "+i);if((i=t[n="LN10"])!==void 0)if(i==Math.LN10)this[n]=new this(i);else throw Error(yg+n+": "+i);return this}var iL=Gre(qze);Lc=new iL(1);const Gze=iL;var Kze=20,Yze=1,o8=1e6,OG=1e6,Zze=-7,Qze=21,sL="[big.js] ",f4=sL+"Invalid ",rL=f4+"decimal places",MG=f4+"rounding mode",Kre=sL+"Division by zero",vs={},r1=void 0,Xze=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function Yre(){function t(e){var n=this;if(!(n instanceof t))return e===r1?Yre():new t(e);e instanceof t?(n.s=e.s,n.e=e.e,n.c=e.c.slice()):Jze(n,e),n.constructor=t}return t.prototype=vs,t.DP=Kze,t.RM=Yze,t.NE=Zze,t.PE=Qze,t.version="5.2.2",t}function Jze(t,e){var n,i,s;if(e===0&&1/e<0)e="-0";else if(!Xze.test(e+=""))throw Error(f4+"number");for(t.s=e.charAt(0)=="-"?(e=e.slice(1),-1):1,(n=e.indexOf("."))>-1&&(e=e.replace(".","")),(i=e.search(/e/i))>0?(n<0&&(n=i),n+=+e.slice(i+1),e=e.substring(0,i)):n<0&&(n=e.length),s=e.length,i=0;i<s&&e.charAt(i)=="0";)++i;if(i==s)t.c=[t.e=0];else{for(;s>0&&e.charAt(--s)=="0";);for(t.e=n-i-1,t.c=[],n=0;i<=s;)t.c[n++]=+e.charAt(i++)}return t}function $S(t,e,n,i){var s=t.c,r=t.e+e+1;if(r<s.length){if(n===1)i=s[r]>=5;else if(n===2)i=s[r]>5||s[r]==5&&(i||r<0||s[r+1]!==r1||s[r-1]&1);else if(n===3)i=i||!!s[0];else if(i=!1,n!==0)throw Error(MG);if(r<1)s.length=1,i?(t.e=-e,s[0]=1):s[0]=t.e=0;else{if(s.length=r--,i)for(;++s[r]>9;)s[r]=0,r--||(++t.e,s.unshift(1));for(r=s.length;!s[--r];)s.pop()}}else if(n<0||n>3||n!==~~n)throw Error(MG);return t}function p4(t,e,n,i){var s,r,o=t.constructor,a=!t.c[0];if(n!==r1){if(n!==~~n||n<(e==3)||n>o8)throw Error(e==3?f4+"precision":rL);for(t=new o(t),n=i-t.e,t.c.length>++i&&$S(t,n,o.RM),e==2&&(i=t.e+n+1);t.c.length<i;)t.c.push(0)}if(s=t.e,r=t.c.join(""),n=r.length,e!=2&&(e==1||e==3&&i<=s||s<=o.NE||s>=o.PE))r=r.charAt(0)+(n>1?"."+r.slice(1):"")+(s<0?"e":"e+")+s;else if(s<0){for(;++s;)r="0"+r;r="0."+r}else if(s>0)if(++s>n)for(s-=n;s--;)r+="0";else s<n&&(r=r.slice(0,s)+"."+r.slice(s));else n>1&&(r=r.charAt(0)+"."+r.slice(1));return t.s<0&&(!a||e==4)?"-"+r:r}vs.abs=function(){var t=new this.constructor(this);return t.s=1,t};vs.cmp=function(t){var e,n=this,i=n.c,s=(t=new n.constructor(t)).c,r=n.s,o=t.s,a=n.e,c=t.e;if(!i[0]||!s[0])return i[0]?r:s[0]?-o:0;if(r!=o)return r;if(e=r<0,a!=c)return a>c^e?1:-1;for(o=(a=i.length)<(c=s.length)?a:c,r=-1;++r<o;)if(i[r]!=s[r])return i[r]>s[r]^e?1:-1;return a==c?0:a>c^e?1:-1};vs.div=function(t){var e=this,n=e.constructor,i=e.c,s=(t=new n(t)).c,r=e.s==t.s?1:-1,o=n.DP;if(o!==~~o||o<0||o>o8)throw Error(rL);if(!s[0])throw Error(Kre);if(!i[0])return new n(r*0);var a,c,l,d,h,p=s.slice(),g=a=s.length,b=i.length,w=i.slice(0,a),C=w.length,E=t,T=E.c=[],A=0,k=o+(E.e=e.e-t.e)+1;for(E.s=r,r=k<0?0:k,p.unshift(0);C++<a;)w.push(0);do{for(l=0;l<10;l++){if(a!=(C=w.length))d=a>C?1:-1;else for(h=-1,d=0;++h<a;)if(s[h]!=w[h]){d=s[h]>w[h]?1:-1;break}if(d<0){for(c=C==a?s:p;C;){if(w[--C]<c[C]){for(h=C;h&&!w[--h];)w[h]=9;--w[h],w[C]+=10}
7446w[C]-=c[C]}for(;!w[0];)w.shift()}else break}T[A++]=d?l:++l,w[0]&&d?w[C]=i[g]||0:w=[i[g]]}while((g++<b||w[0]!==r1)&&r--);return!T[0]&&A!=1&&(T.shift(),E.e--),A>k&&$S(E,o,n.RM,w[0]!==r1),E};vs.eq=function(t){return!this.cmp(t)};vs.gt=function(t){return this.cmp(t)>0};vs.gte=function(t){return this.cmp(t)>-1};vs.lt=function(t){return this.cmp(t)<0};vs.lte=function(t){return this.cmp(t)<1};vs.minus=vs.sub=function(t){var e,n,i,s,r=this,o=r.constructor,a=r.s,c=(t=new o(t)).s;if(a!=c)return t.s=-c,r.plus(t);var l=r.c.slice(),d=r.e,h=t.c,p=t.e;if(!l[0]||!h[0])return h[0]?(t.s=-c,t):new o(l[0]?r:0);if(a=d-p){for((s=a<0)?(a=-a,i=l):(p=d,i=h),i.reverse(),c=a;c--;)i.push(0);i.reverse()}else for(n=((s=l.length<h.length)?l:h).length,a=c=0;c<n;c++)if(l[c]!=h[c]){s=l[c]<h[c];break}if(s&&(i=l,l=h,h=i,t.s=-t.s),(c=(n=h.length)-(e=l.length))>0)for(;c--;)l[e++]=0;for(c=e;n>a;){if(l[--n]<h[n]){for(e=n;e&&!l[--e];)l[e]=9;--l[e],l[n]+=10}l[n]-=h[n]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--p;return l[0]||(t.s=1,l=[p=0]),t.c=l,t.e=p,t};vs.mod=function(t){var e,n=this,i=n.constructor,s=n.s,r=(t=new i(t)).s;if(!t.c[0])throw Error(Kre);return n.s=t.s=1,e=t.cmp(n)==1,n.s=s,t.s=r,e?new i(n):(s=i.DP,r=i.RM,i.DP=i.RM=0,n=n.div(t),i.DP=s,i.RM=r,this.minus(n.times(t)))};vs.plus=vs.add=function(t){var e,n=this,i=n.constructor,s=n.s,r=(t=new i(t)).s;if(s!=r)return t.s=-r,n.minus(t);var o=n.e,a=n.c,c=t.e,l=t.c;if(!a[0]||!l[0])return l[0]?t:new i(a[0]?n:s*0);if(a=a.slice(),s=o-c){for(s>0?(c=o,e=l):(s=-s,e=a),e.reverse();s--;)e.push(0);e.reverse()}for(a.length-l.length<0&&(e=l,l=a,a=e),s=l.length,r=0;s;a[s]%=10)r=(a[--s]=a[s]+l[s]+r)/10|0;for(r&&(a.unshift(r),++c),s=a.length;a[--s]===0;)a.pop();return t.c=a,t.e=c,t};vs.pow=function(t){var e=this,n=new e.constructor(1),i=n,s=t<0;if(t!==~~t||t<-OG||t>OG)throw Error(f4+"exponent");for(s&&(t=-t);t&1&&(i=i.times(e)),t>>=1,!!t;)e=e.times(e);return s?n.div(i):i};vs.round=function(t,e){var n=this.constructor;if(t===r1)t=0;else if(t!==~~t||t<-o8||t>o8)throw Error(rL);return $S(new n(this),t,e===r1?n.RM:e)};vs.sqrt=function(){var t,e,n,i=this,s=i.constructor,r=i.s,o=i.e,a=new s(.5);if(!i.c[0])return new s(i);if(r<0)throw Error(sL+"No square root");r=Math.sqrt(i+""),r===0||r===1/0?(e=i.c.join(""),e.length+o&1||(e+="0"),r=Math.sqrt(e),o=((o+1)/2|0)-(o<0||o&1),t=new s((r==1/0?"1e":(r=r.toExponential()).slice(0,r.indexOf("e")+1))+o)):t=new s(r),o=t.e+(s.DP+=4);do n=t,t=a.times(n.plus(i.div(n)));while(n.c.slice(0,o).join("")!==t.c.slice(0,o).join(""));return $S(t,s.DP-=4,s.RM)};vs.times=vs.mul=function(t){var e,n=this,i=n.constructor,s=n.c,r=(t=new i(t)).c,o=s.length,a=r.length,c=n.e,l=t.e;if(t.s=n.s==t.s?1:-1,!s[0]||!r[0])return new i(t.s*0);for(t.e=c+l,o<a&&(e=s,s=r,r=e,l=o,o=a,a=l),e=new Array(l=o+a);l--;)e[l]=0;for(c=a;c--;){for(a=0,l=o+c;l>c;)a=e[l]+r[c]*s[l-c-1]+a,e[l--]=a%10,a=a/10|0;e[l]=(e[l]+a)%10}for(a?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t};vs.toExponential=function(t){return p4(this,1,t,t)};vs.toFixed=function(t){return p4(this,2,t,this.e+t)};vs.toPrecision=function(t){return p4(this,3,t,t-1)};vs.toString=function(){return p4(this)};vs.valueOf=vs.toJSON=function(){return p4(this,4)};var Zre=Yre(),Uk={exports:{}},LG;function eHe(){return LG||(LG=1,(function(t){function e(n){return n.prototype.toFormat=function(s,r,o){if(!this.e&&this.e!==0)return this.toString();var a,c,l,d,h,p,g,b,w,C,E,T,A,k,R,P=this.format||{},B=this.constructor.format||{};if(s!=h?typeof s=="object"?(o=s,s=h):r!=h?typeof r=="object"?(o=r,r=h):typeof o!="object"&&(o={}):o={}:o={},a=this.toFixed(s,r).split("."),b=a[0],w=a[1],g=this.s<0?b.slice(1):b,p=g.length,C=o.decimalSeparator,C==h&&(C=P.decimalSeparator,C==h&&(C=B.decimalSeparator,C==h&&(C="."))),E=o.groupSeparator,E==h&&(E=P.groupSeparator,E==h&&(E=B.groupSeparator)),E&&(T=o.groupSize,T==h&&(T=P.groupSize,T==h&&(T=B.groupSize,T==h&&(T=0))),A=o.secondaryGroupSize,A==h&&(A=P.secondaryGroupSize,A==h&&(A=B.secondaryGroupSize,A==h&&(A=0))),A?(c=+A,l=+T,p-=l):(c=+T,l=+A),c>0&&p>0)){for(d=p%c||c,b=g.substr(0,d);d<p;d+=c)b+=E+g.substr(d,c);l>0&&(b+=E+g.slice(d)),this.s<0&&(b="-"+b)}return w?(k=o.fractionGroupSeparator,k==h&&(k=P.fractionGroupSeparator,k==h&&(k=B.fractionGroupSeparator)),k&&(R=o.fractionGroupSize,R==h&&(R=P.fractionGroupSize,R==h&&(R=B.fractionGroupSize,R==h&&(R=0))),R=+R,R&&(w=w.replace(new RegExp("\\d{"+R+"}\\B","g"),"$&"+k))),b+C+w):b},n.format={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n}t.exports&&(t.exports=e)})(Uk)),Uk.exports}var tHe=eHe();const oL=ya(tHe);var xE={exports:{}};const nHe={},iHe=Object.freeze(Object.defineProperty({__proto__:null,default:nHe},Symbol.toStringTag,{value:"Module"})),sHe=VY(iHe);var rHe=xE.exports,$G;function oHe(){return $G||($G=1,(function(t){(function(e,n){function i(I,S){if(!I)throw new Error(S||"Assertion failed")}function s(I,S){I.super_=S;var v=function(){};v.prototype=S.prototype,I.prototype=new v,I.prototype.constructor=I}function r(I,S,v){if(r.isBN(I))return I;this.negative=0,this.words=null,this.length=0,this.red=null,I!==null&&((S==="le"||S==="be")&&(v=S,S=10),this._init(I||0,S||10,v||"be"))}
vendor: 15,650 bytes, line 7446
7446typeof e=="object"?e.exports=r:n.BN=r,r.BN=r,r.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=sHe.Buffer}catch{}r.isBN=function(S){return S instanceof r?!0:S!==null&&typeof S=="object"&&S.constructor.wordSize===r.wordSize&&Array.isArray(S.words)},r.max=function(S,v){return S.cmp(v)>0?S:v},r.min=function(S,v){return S.cmp(v)<0?S:v},r.prototype._init=function(S,v,_){if(typeof S=="number")return this._initNumber(S,v,_);if(typeof S=="object")return this._initArray(S,v,_);v==="hex"&&(v=16),i(v===(v|0)&&v>=2&&v<=36),S=S.toString().replace(/\s+/g,"");var N=0;S[0]==="-"&&(N++,this.negative=1),N<S.length&&(v===16?this._parseHex(S,N,_):(this._parseBase(S,v,N),_==="le"&&this._initArray(this.toArray(),v,_)))},r.prototype._initNumber=function(S,v,_){S<0&&(this.negative=1,S=-S),S<67108864?(this.words=[S&67108863],this.length=1):S<4503599627370496?(this.words=[S&67108863,S/67108864&67108863],this.length=2):(i(S<9007199254740992),this.words=[S&67108863,S/67108864&67108863,1],this.length=3),_==="le"&&this._initArray(this.toArray(),v,_)},r.prototype._initArray=function(S,v,_){if(i(typeof S.length=="number"),S.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(S.length/3),this.words=new Array(this.length);for(var N=0;N<this.length;N++)this.words[N]=0;var $,U,j=0;if(_==="be")for(N=S.length-1,$=0;N>=0;N-=3)U=S[N]|S[N-1]<<8|S[N-2]<<16,this.words[$]|=U<<j&67108863,this.words[$+1]=U>>>26-j&67108863,j+=24,j>=26&&(j-=26,$++);else if(_==="le")for(N=0,$=0;N<S.length;N+=3)U=S[N]|S[N+1]<<8|S[N+2]<<16,this.words[$]|=U<<j&67108863,this.words[$+1]=U>>>26-j&67108863,j+=24,j>=26&&(j-=26,$++);return this._strip()};function a(I,S){var v=I.charCodeAt(S);if(v>=48&&v<=57)return v-48;if(v>=65&&v<=70)return v-55;if(v>=97&&v<=102)return v-87;i(!1,"Invalid character in "+I)}function c(I,S,v){var _=a(I,v);return v-1>=S&&(_|=a(I,v-1)<<4),_}r.prototype._parseHex=function(S,v,_){this.length=Math.ceil((S.length-v)/6),this.words=new Array(this.length);for(var N=0;N<this.length;N++)this.words[N]=0;var $=0,U=0,j;if(_==="be")for(N=S.length-1;N>=v;N-=2)j=c(S,v,N)<<$,this.words[U]|=j&67108863,$>=18?($-=18,U+=1,this.words[U]|=j>>>26):$+=8;else{var D=S.length-v;for(N=D%2===0?v+1:v;N<S.length;N+=2)j=c(S,v,N)<<$,this.words[U]|=j&67108863,$>=18?($-=18,U+=1,this.words[U]|=j>>>26):$+=8}this._strip()};function l(I,S,v,_){for(var N=0,$=0,U=Math.min(I.length,v),j=S;j<U;j++){var D=I.charCodeAt(j)-48;N*=_,D>=49?$=D-49+10:D>=17?$=D-17+10:$=D,i(D>=0&&$<_,"Invalid character"),N+=$}return N}r.prototype._parseBase=function(S,v,_){this.words=[0],this.length=1;for(var N=0,$=1;$<=67108863;$*=v)N++;N--,$=$/v|0;for(var U=S.length-_,j=U%N,D=Math.min(U,U-j)+_,O=0,H=_;H<D;H+=N)O=l(S,H,H+N,v),this.imuln($),this.words[0]+O<67108864?this.words[0]+=O:this._iaddn(O);if(j!==0){var J=1;for(O=l(S,H,S.length,v),H=0;H<j;H++)J*=v;this.imuln(J),this.words[0]+O<67108864?this.words[0]+=O:this._iaddn(O)}this._strip()},r.prototype.copy=function(S){S.words=new Array(this.length);for(var v=0;v<this.length;v++)S.words[v]=this.words[v];S.length=this.length,S.negative=this.negative,S.red=this.red};function d(I,S){I.words=S.words,I.length=S.length,I.negative=S.negative,I.red=S.red}if(r.prototype._move=function(S){d(S,this)},r.prototype.clone=function(){var S=new r(null);return this.copy(S),S},r.prototype._expand=function(S){for(;this.length<S;)this.words[this.length++]=0;return this},r.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},r.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{r.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch{r.prototype.inspect=h}else r.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var p=["","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"],g=[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],b=[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];r.prototype.toString=function(S,v){S=S||10,v=v|0||1;var _;if(S===16||S==="hex"){_="";for(var N=0,$=0,U=0;U<this.length;U++){var j=this.words[U],D=((j<<N|$)&16777215).toString(16);$=j>>>24-N&16777215,N+=2,N>=26&&(N-=26,U--),$!==0||U!==this.length-1?_=p[6-D.length]+D+_:_=D+_}for($!==0&&(_=$.toString(16)+_);_.length%v!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}if(S===(S|0)&&S>=2&&S<=36){var O=g[S],H=b[S];_="";var J=this.clone();for(J.negative=0;!J.isZero();){var W=J.modrn(H).toString(S);J=J.idivn(H),J.isZero()?_=W+_:_=p[O-W.length]+W+_}for(this.isZero()&&(_="0"+_);_.length%v!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}i(!1,"Base should be between 2 and 36")},r.prototype.toNumber=function(){var S=this.words[0];return this.length===2?S+=this.words[1]*67108864:this.length===3&&this.words[2]===1?S+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-S:S},r.prototype.toJSON=function(){return this.toString(16,2)},o&&(r.prototype.toBuffer=function(S,v){return this.toArrayLike(o,S,v)}),r.prototype.toArray=function(S,v){return this.toArrayLike(Array,S,v)};var w=function(S,v){return S.allocUnsafe?S.allocUnsafe(v):new S(v)};r.prototype.toArrayLike=function(S,v,_){this._strip();var N=this.byteLength(),$=_||Math.max(1,N);i(N<=$,"byte array longer than desired length"),i($>0,"Requested array length <= 0");var U=w(S,$),j=v==="le"?"LE":"BE";return this["_toArrayLike"+j](U,N),U},r.prototype._toArrayLikeLE=function(S,v){for(var _=0,N=0,$=0,U=0;$<this.length;$++){var j=this.words[$]<<U|N;S[_++]=j&255,_<S.length&&(S[_++]=j>>8&255),_<S.length&&(S[_++]=j>>16&255),U===6?(_<S.length&&(S[_++]=j>>24&255),N=0,U=0):(N=j>>>24,U+=2)}if(_<S.length)for(S[_++]=N;_<S.length;)S[_++]=0},r.prototype._toArrayLikeBE=function(S,v){for(var _=S.length-1,N=0,$=0,U=0;$<this.length;$++){var j=this.words[$]<<U|N;S[_--]=j&255,_>=0&&(S[_--]=j>>8&255),_>=0&&(S[_--]=j>>16&255),U===6?(_>=0&&(S[_--]=j>>24&255),N=0,U=0):(N=j>>>24,U+=2)}if(_>=0)for(S[_--]=N;_>=0;)S[_--]=0},Math.clz32?r.prototype._countBits=function(S){return 32-Math.clz32(S)}:r.prototype._countBits=function(S){var v=S,_=0;return v>=4096&&(_+=13,v>>>=13),v>=64&&(_+=7,v>>>=7),v>=8&&(_+=4,v>>>=4),v>=2&&(_+=2,v>>>=2),_+v},r.prototype._zeroBits=function(S){if(S===0)return 26;var v=S,_=0;return(v&8191)===0&&(_+=13,v>>>=13),(v&127)===0&&(_+=7,v>>>=7),(v&15)===0&&(_+=4,v>>>=4),(v&3)===0&&(_+=2,v>>>=2),(v&1)===0&&_++,_},r.prototype.bitLength=function(){var S=this.words[this.length-1],v=this._countBits(S);return(this.length-1)*26+v};function C(I){for(var S=new Array(I.bitLength()),v=0;v<S.length;v++){var _=v/26|0,N=v%26;S[v]=I.words[_]>>>N&1}return S}r.prototype.zeroBits=function(){if(this.isZero())return 0;for(var S=0,v=0;v<this.length;v++){var _=this._zeroBits(this.words[v]);if(S+=_,_!==26)break}return S},r.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},r.prototype.toTwos=function(S){return this.negative!==0?this.abs().inotn(S).iaddn(1):this.clone()},r.prototype.fromTwos=function(S){return this.testn(S-1)?this.notn(S).iaddn(1).ineg():this.clone()},r.prototype.isNeg=function(){return this.negative!==0},r.prototype.neg=function(){return this.clone().ineg()},r.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},r.prototype.iuor=function(S){for(;this.length<S.length;)this.words[this.length++]=0;for(var v=0;v<S.length;v++)this.words[v]=this.words[v]|S.words[v];return this._strip()},r.prototype.ior=function(S){return i((this.negative|S.negative)===0),this.iuor(S)},r.prototype.or=function(S){return this.length>S.length?this.clone().ior(S):S.clone().ior(this)},r.prototype.uor=function(S){return this.length>S.length?this.clone().iuor(S):S.clone().iuor(this)},r.prototype.iuand=function(S){var v;this.length>S.length?v=S:v=this;for(var _=0;_<v.length;_++)this.words[_]=this.words[_]&S.words[_];return this.length=v.length,this._strip()},r.prototype.iand=function(S){return i((this.negative|S.negative)===0),this.iuand(S)},r.prototype.and=function(S){return this.length>S.length?this.clone().iand(S):S.clone().iand(this)},r.prototype.uand=function(S){return this.length>S.length?this.clone().iuand(S):S.clone().iuand(this)},r.prototype.iuxor=function(S){var v,_;this.length>S.length?(v=this,_=S):(v=S,_=this);for(var N=0;N<_.length;N++)this.words[N]=v.words[N]^_.words[N];if(this!==v)for(;N<v.length;N++)this.words[N]=v.words[N];return this.length=v.length,this._strip()},r.prototype.ixor=function(S){return i((this.negative|S.negative)===0),this.iuxor(S)},r.prototype.xor=function(S){return this.length>S.length?this.clone().ixor(S):S.clone().ixor(this)},r.prototype.uxor=function(S){return this.length>S.length?this.clone().iuxor(S):S.clone().iuxor(this)},r.prototype.inotn=function(S){i(typeof S=="number"&&S>=0);var v=Math.ceil(S/26)|0,_=S%26;this._expand(v),_>0&&v--;for(var N=0;N<v;N++)this.words[N]=~this.words[N]&67108863;return _>0&&(this.words[N]=~this.words[N]&67108863>>26-_),this._strip()},r.prototype.notn=function(S){return this.clone().inotn(S)},r.prototype.setn=function(S,v){i(typeof S=="number"&&S>=0);var _=S/26|0,N=S%26;return this._expand(_+1),v?this.words[_]=this.words[_]|1<<N:this.words[_]=this.words[_]&~(1<<N),this._strip()},r.prototype.iadd=function(S){var v;if(this.negative!==0&&S.negative===0)return this.negative=0,v=this.isub(S),this.negative^=1,this._normSign();if(this.negative===0&&S.negative!==0)return S.negative=0,v=this.isub(S),S.negative=1,v._normSign();var _,N;this.length>S.length?(_=this,N=S):(_=S,N=this);for(var $=0,U=0;U<N.length;U++)v=(_.words[U]|0)+(N.words[U]|0)+$,this.words[U]=v&67108863,$=v>>>26;for(;$!==0&&U<_.length;U++)v=(_.words[U]|0)+$,this.words[U]=v&67108863,$=v>>>26;if(this.length=_.length,$!==0)this.words[this.length]=$,this.length++;else if(_!==this)for(;U<_.length;U++)this.words[U]=_.words[U];return this},r.prototype.add=function(S){var v;return S.negative!==0&&this.negative===0?(S.negative=0,v=this.sub(S),S.negative^=1,v):S.negative===0&&this.negative!==0?(this.negative=0,v=S.sub(this),this.negative=1,v):this.length>S.length?this.clone().iadd(S):S.clone().iadd(this)},r.prototype.isub=function(S){if(S.negative!==0){S.negative=0;var v=this.iadd(S);return S.negative=1,v._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(S),this.negative=1,this._normSign();var _=this.cmp(S);if(_===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,$;_>0?(N=this,$=S):(N=S,$=this);for(var U=0,j=0;j<$.length;j++)v=(N.words[j]|0)-($.words[j]|0)+U,U=v>>26,this.words[j]=v&67108863;for(;U!==0&&j<N.length;j++)v=(N.words[j]|0)+U,U=v>>26,this.words[j]=v&67108863;if(U===0&&j<N.length&&N!==this)for(;j<N.length;j++)this.words[j]=N.words[j];return this.length=Math.max(this.length,j),N!==this&&(this.negative=1),this._strip()},r.prototype.sub=function(S){return this.clone().isub(S)};function E(I,S,v){v.negative=S.negative^I.negative;var _=I.length+S.length|0;v.length=_,_=_-1|0;var N=I.words[0]|0,$=S.words[0]|0,U=N*$,j=U&67108863,D=U/67108864|0;v.words[0]=j;for(var O=1;O<_;O++){for(var H=D>>>26,J=D&67108863,W=Math.min(O,S.length-1),Z=Math.max(0,O-I.length+1);Z<=W;Z++){var Y=O-Z|0;N=I.words[Y]|0,$=S.words[Z]|0,U=N*$+J,H+=U/67108864|0,J=U&67108863}v.words[O]=J|0,D=H|0}return D!==0?v.words[O]=D|0:v.length--,v._strip()}var T=function(S,v,_){var N=S.words,$=v.words,U=_.words,j=0,D,O,H,J=N[0]|0,W=J&8191,Z=J>>>13,Y=N[1]|0,Q=Y&8191,ee=Y>>>13,ie=N[2]|0,re=ie&8191,oe=ie>>>13,de=N[3]|0,he=de&8191,ue=de>>>13,be=N[4]|0,_e=be&8191,Ne=be>>>13,pe=N[5]|0,Te=pe&8191,ve=pe>>>13,xe=N[6]|0,Ye=xe&8191,ze=xe>>>13,ft=N[7]|0,lt=ft&8191,We=ft>>>13,Dt=N[8]|0,Fe=Dt&8191,it=Dt>>>13,Qt=N[9]|0,ke=Qt&8191,nt=Qt>>>13,ht=$[0]|0,At=ht&8191,zt=ht>>>13,Ln=$[1]|0,gn=Ln&8191,yn=Ln>>>13,bi=$[2]|0,En=bi&8191,yt=bi>>>13,mt=$[3]|0,_t=mt&8191,Vt=mt>>>13,Yn=$[4]|0,Ee=Yn&8191,$e=Yn>>>13,Xe=$[5]|0,ot=Xe&8191,pt=Xe>>>13,Ot=$[6]|0,tn=Ot&8191,rn=Ot>>>13,Mt=$[7]|0,nn=Mt&8191,ln=Mt>>>13,Oi=$[8]|0,un=Oi&8191,_n=Oi>>>13,Cs=$[9]|0,Wn=Cs&8191,Zn=Cs>>>13;_.negative=S.negative^v.negative,_.length=19,D=Math.imul(W,At),O=Math.imul(W,zt),O=O+Math.imul(Z,At)|0,H=Math.imul(Z,zt);var fs=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(fs>>>26)|0,fs&=67108863,D=Math.imul(Q,At),O=Math.imul(Q,zt),O=O+Math.imul(ee,At)|0,H=Math.imul(ee,zt),D=D+Math.imul(W,gn)|0,O=O+Math.imul(W,yn)|0,O=O+Math.imul(Z,gn)|0,H=H+Math.imul(Z,yn)|0;var Us=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Us>>>26)|0,Us&=67108863,D=Math.imul(re,At),O=Math.imul(re,zt),O=O+Math.imul(oe,At)|0,H=Math.imul(oe,zt),D=D+Math.imul(Q,gn)|0,O=O+Math.imul(Q,yn)|0,O=O+Math.imul(ee,gn)|0,H=H+Math.imul(ee,yn)|0,D=D+Math.imul(W,En)|0,O=O+Math.imul(W,yt)|0,O=O+Math.imul(Z,En)|0,H=H+Math.imul(Z,yt)|0;var cs=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(cs>>>26)|0,cs&=67108863,D=Math.imul(he,At),O=Math.imul(he,zt),O=O+Math.imul(ue,At)|0,H=Math.imul(ue,zt),D=D+Math.imul(re,gn)|0,O=O+Math.imul(re,yn)|0,O=O+Math.imul(oe,gn)|0,H=H+Math.imul(oe,yn)|0,D=D+Math.imul(Q,En)|0,O=O+Math.imul(Q,yt)|0,O=O+Math.imul(ee,En)|0,H=H+Math.imul(ee,yt)|0,D=D+Math.imul(W,_t)|0,O=O+Math.imul(W,Vt)|0,O=O+Math.imul(Z,_t)|0,H=H+Math.imul(Z,Vt)|0;var Vr=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,D=Math.imul(_e,At),O=Math.imul(_e,zt),O=O+Math.imul(Ne,At)|0,H=Math.imul(Ne,zt),D=D+Math.imul(he,gn)|0,O=O+Math.imul(he,yn)|0,O=O+Math.imul(ue,gn)|0,H=H+Math.imul(ue,yn)|0,D=D+Math.imul(re,En)|0,O=O+Math.imul(re,yt)|0,O=O+Math.imul(oe,En)|0,H=H+Math.imul(oe,yt)|0,D=D+Math.imul(Q,_t)|0,O=O+Math.imul(Q,Vt)|0,O=O+Math.imul(ee,_t)|0,H=H+Math.imul(ee,Vt)|0,D=D+Math.imul(W,Ee)|0,O=O+Math.imul(W,$e)|0,O=O+Math.imul(Z,Ee)|0,H=H+Math.imul(Z,$e)|0;var ps=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(ps>>>26)|0,ps&=67108863,D=Math.imul(Te,At),O=Math.imul(Te,zt),O=O+Math.imul(ve,At)|0,H=Math.imul(ve,zt),D=D+Math.imul(_e,gn)|0,O=O+Math.imul(_e,yn)|0,O=O+Math.imul(Ne,gn)|0,H=H+Math.imul(Ne,yn)|0,D=D+Math.imul(he,En)|0,O=O+Math.imul(he,yt)|0,O=O+Math.imul(ue,En)|0,H=H+Math.imul(ue,yt)|0,D=D+Math.imul(re,_t)|0,O=O+Math.imul(re,Vt)|0,O=O+Math.imul(oe,_t)|0,H=H+Math.imul(oe,Vt)|0,D=D+Math.imul(Q,Ee)|0,O=O+Math.imul(Q,$e)|0,O=O+Math.imul(ee,Ee)|0,H=H+Math.imul(ee,$e)|0,D=D+Math.imul(W,ot)|0,O=O+Math.imul(W,pt)|0,O=O+Math.imul(Z,ot)|0,H=H+Math.imul(Z,pt)|0;var ko=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(ko>>>26)|0,ko&=67108863,D=Math.imul(Ye,At),O=Math.imul(Ye,zt),O=O+Math.imul(ze,At)|0,H=Math.imul(ze,zt),D=D+Math.imul(Te,gn)|0,O=O+Math.imul(Te,yn)|0,O=O+Math.imul(ve,gn)|0,H=H+Math.imul(ve,yn)|0,D=D+Math.imul(_e,En)|0,O=O+Math.imul(_e,yt)|0,O=O+Math.imul(Ne,En)|0,H=H+Math.imul(Ne,yt)|0,D=D+Math.imul(he,_t)|0,O=O+Math.imul(he,Vt)|0,O=O+Math.imul(ue,_t)|0,H=H+Math.imul(ue,Vt)|0,D=D+Math.imul(re,Ee)|0,O=O+Math.imul(re,$e)|0,O=O+Math.imul(oe,Ee)|0,H=H+Math.imul(oe,$e)|0,D=D+Math.imul(Q,ot)|0,O=O+Math.imul(Q,pt)|0,O=O+Math.imul(ee,ot)|0,H=H+Math.imul(ee,pt)|0,D=D+Math.imul(W,tn)|0,O=O+Math.imul(W,rn)|0,O=O+Math.imul(Z,tn)|0,H=H+Math.imul(Z,rn)|0;var Mi=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Mi>>>
744626)|0,Mi&=67108863,D=Math.imul(lt,At),O=Math.imul(lt,zt),O=O+Math.imul(We,At)|0,H=Math.imul(We,zt),D=D+Math.imul(Ye,gn)|0,O=O+Math.imul(Ye,yn)|0,O=O+Math.imul(ze,gn)|0,H=H+Math.imul(ze,yn)|0,D=D+Math.imul(Te,En)|0,O=O+Math.imul(Te,yt)|0,O=O+Math.imul(ve,En)|0,H=H+Math.imul(ve,yt)|0,D=D+Math.imul(_e,_t)|0,O=O+Math.imul(_e,Vt)|0,O=O+Math.imul(Ne,_t)|0,H=H+Math.imul(Ne,Vt)|0,D=D+Math.imul(he,Ee)|0,O=O+Math.imul(he,$e)|0,O=O+Math.imul(ue,Ee)|0,H=H+Math.imul(ue,$e)|0,D=D+Math.imul(re,ot)|0,O=O+Math.imul(re,pt)|0,O=O+Math.imul(oe,ot)|0,H=H+Math.imul(oe,pt)|0,D=D+Math.imul(Q,tn)|0,O=O+Math.imul(Q,rn)|0,O=O+Math.imul(ee,tn)|0,H=H+Math.imul(ee,rn)|0,D=D+Math.imul(W,nn)|0,O=O+Math.imul(W,ln)|0,O=O+Math.imul(Z,nn)|0,H=H+Math.imul(Z,ln)|0;var dc=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(dc>>>26)|0,dc&=67108863,D=Math.imul(Fe,At),O=Math.imul(Fe,zt),O=O+Math.imul(it,At)|0,H=Math.imul(it,zt),D=D+Math.imul(lt,gn)|0,O=O+Math.imul(lt,yn)|0,O=O+Math.imul(We,gn)|0,H=H+Math.imul(We,yn)|0,D=D+Math.imul(Ye,En)|0,O=O+Math.imul(Ye,yt)|0,O=O+Math.imul(ze,En)|0,H=H+Math.imul(ze,yt)|0,D=D+Math.imul(Te,_t)|0,O=O+Math.imul(Te,Vt)|0,O=O+Math.imul(ve,_t)|0,H=H+Math.imul(ve,Vt)|0,D=D+Math.imul(_e,Ee)|0,O=O+Math.imul(_e,$e)|0,O=O+Math.imul(Ne,Ee)|0,H=H+Math.imul(Ne,$e)|0,D=D+Math.imul(he,ot)|0,O=O+Math.imul(he,pt)|0,O=O+Math.imul(ue,ot)|0,H=H+Math.imul(ue,pt)|0,D=D+Math.imul(re,tn)|0,O=O+Math.imul(re,rn)|0,O=O+Math.imul(oe,tn)|0,H=H+Math.imul(oe,rn)|0,D=D+Math.imul(Q,nn)|0,O=O+Math.imul(Q,ln)|0,O=O+Math.imul(ee,nn)|0,H=H+Math.imul(ee,ln)|0,D=D+Math.imul(W,un)|0,O=O+Math.imul(W,_n)|0,O=O+Math.imul(Z,un)|0,H=H+Math.imul(Z,_n)|0;var Ji=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,D=Math.imul(ke,At),O=Math.imul(ke,zt),O=O+Math.imul(nt,At)|0,H=Math.imul(nt,zt),D=D+Math.imul(Fe,gn)|0,O=O+Math.imul(Fe,yn)|0,O=O+Math.imul(it,gn)|0,H=H+Math.imul(it,yn)|0,D=D+Math.imul(lt,En)|0,O=O+Math.imul(lt,yt)|0,O=O+Math.imul(We,En)|0,H=H+Math.imul(We,yt)|0,D=D+Math.imul(Ye,_t)|0,O=O+Math.imul(Ye,Vt)|0,O=O+Math.imul(ze,_t)|0,H=H+Math.imul(ze,Vt)|0,D=D+Math.imul(Te,Ee)|0,O=O+Math.imul(Te,$e)|0,O=O+Math.imul(ve,Ee)|0,H=H+Math.imul(ve,$e)|0,D=D+Math.imul(_e,ot)|0,O=O+Math.imul(_e,pt)|0,O=O+Math.imul(Ne,ot)|0,H=H+Math.imul(Ne,pt)|0,D=D+Math.imul(he,tn)|0,O=O+Math.imul(he,rn)|0,O=O+Math.imul(ue,tn)|0,H=H+Math.imul(ue,rn)|0,D=D+Math.imul(re,nn)|0,O=O+Math.imul(re,ln)|0,O=O+Math.imul(oe,nn)|0,H=H+Math.imul(oe,ln)|0,D=D+Math.imul(Q,un)|0,O=O+Math.imul(Q,_n)|0,O=O+Math.imul(ee,un)|0,H=H+Math.imul(ee,_n)|0,D=D+Math.imul(W,Wn)|0,O=O+Math.imul(W,Zn)|0,O=O+Math.imul(Z,Wn)|0,H=H+Math.imul(Z,Zn)|0;var qu=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(qu>>>26)|0,qu&=67108863,D=Math.imul(ke,gn),O=Math.imul(ke,yn),O=O+Math.imul(nt,gn)|0,H=Math.imul(nt,yn),D=D+Math.imul(Fe,En)|0,O=O+Math.imul(Fe,yt)|0,O=O+Math.imul(it,En)|0,H=H+Math.imul(it,yt)|0,D=D+Math.imul(lt,_t)|0,O=O+Math.imul(lt,Vt)|0,O=O+Math.imul(We,_t)|0,H=H+Math.imul(We,Vt)|0,D=D+Math.imul(Ye,Ee)|0,O=O+Math.imul(Ye,$e)|0,O=O+Math.imul(ze,Ee)|0,H=H+Math.imul(ze,$e)|0,D=D+Math.imul(Te,ot)|0,O=O+Math.imul(Te,pt)|0,O=O+Math.imul(ve,ot)|0,H=H+Math.imul(ve,pt)|0,D=D+Math.imul(_e,tn)|0,O=O+Math.imul(_e,rn)|0,O=O+Math.imul(Ne,tn)|0,H=H+Math.imul(Ne,rn)|0,D=D+Math.imul(he,nn)|0,O=O+Math.imul(he,ln)|0,O=O+Math.imul(ue,nn)|0,H=H+Math.imul(ue,ln)|0,D=D+Math.imul(re,un)|0,O=O+Math.imul(re,_n)|0,O=O+Math.imul(oe,un)|0,H=H+Math.imul(oe,_n)|0,D=D+Math.imul(Q,Wn)|0,O=O+Math.imul(Q,Zn)|0,O=O+Math.imul(ee,Wn)|0,H=H+Math.imul(ee,Zn)|0;var ql=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(ql>>>26)|0,ql&=67108863,D=Math.imul(ke,En),O=Math.imul(ke,yt),O=O+Math.imul(nt,En)|0,H=Math.imul(nt,yt),D=D+Math.imul(Fe,_t)|0,O=O+Math.imul(Fe,Vt)|0,O=O+Math.imul(it,_t)|0,H=H+Math.imul(it,Vt)|0,D=D+Math.imul(lt,Ee)|0,O=O+Math.imul(lt,$e)|0,O=O+Math.imul(We,Ee)|0,H=H+Math.imul(We,$e)|0,D=D+Math.imul(Ye,ot)|0,O=O+Math.imul(Ye,pt)|0,O=O+Math.imul(ze,ot)|0,H=H+Math.imul(ze,pt)|0,D=D+Math.imul(Te,tn)|0,O=O+Math.imul(Te,rn)|0,O=O+Math.imul(ve,tn)|0,H=H+Math.imul(ve,rn)|0,D=D+Math.imul(_e,nn)|0,O=O+Math.imul(_e,ln)|0,O=O+Math.imul(Ne,nn)|0,H=H+Math.imul(Ne,ln)|0,D=D+Math.imul(he,un)|0,O=O+Math.imul(he,_n)|0,O=O+Math.imul(ue,un)|0,H=H+Math.imul(ue,_n)|0,D=D+Math.imul(re,Wn)|0,O=O+Math.imul(re,Zn)|0,O=O+Math.imul(oe,Wn)|0,H=H+Math.imul(oe,Zn)|0;var hc=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(hc>>>26)|0,hc&=67108863,D=Math.imul(ke,_t),O=Math.imul(ke,Vt),O=O+Math.imul(nt,_t)|0,H=Math.imul(nt,Vt),D=D+Math.imul(Fe,Ee)|0,O=O+Math.imul(Fe,$e)|0,O=O+Math.imul(it,Ee)|0,H=H+Math.imul(it,$e)|0,D=D+Math.imul(lt,ot)|0,O=O+Math.imul(lt,pt)|0,O=O+Math.imul(We,ot)|0,H=H+Math.imul(We,pt)|0,D=D+Math.imul(Ye,tn)|0,O=O+Math.imul(Ye,rn)|0,O=O+Math.imul(ze,tn)|0,H=H+Math.imul(ze,rn)|0,D=D+Math.imul(Te,nn)|0,O=O+Math.imul(Te,ln)|0,O=O+Math.imul(ve,nn)|0,H=H+Math.imul(ve,ln)|0,D=D+Math.imul(_e,un)|0,O=O+Math.imul(_e,_n)|0,O=O+Math.imul(Ne,un)|0,H=H+Math.imul(Ne,_n)|0,D=D+Math.imul(he,Wn)|0,O=O+Math.imul(he,Zn)|0,O=O+Math.imul(ue,Wn)|0,H=H+Math.imul(ue,Zn)|0;var Qc=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Qc>>>26)|0,Qc&=67108863,D=Math.imul(ke,Ee),O=Math.imul(ke,$e),O=O+Math.imul(nt,Ee)|0,H=Math.imul(nt,$e),D=D+Math.imul(Fe,ot)|0,O=O+Math.imul(Fe,pt)|0,O=O+Math.imul(it,ot)|0,H=H+Math.imul(it,pt)|0,D=D+Math.imul(lt,tn)|0,O=O+Math.imul(lt,rn)|0,O=O+Math.imul(We,tn)|0,H=H+Math.imul(We,rn)|0,D=D+Math.imul(Ye,nn)|0,O=O+Math.imul(Ye,ln)|0,O=O+Math.imul(ze,nn)|0,H=H+Math.imul(ze,ln)|0,D=D+Math.imul(Te,un)|0,O=O+Math.imul(Te,_n)|0,O=O+Math.imul(ve,un)|0,H=H+Math.imul(ve,_n)|0,D=D+Math.imul(_e,Wn)|0,O=O+Math.imul(_e,Zn)|0,O=O+Math.imul(Ne,Wn)|0,H=H+Math.imul(Ne,Zn)|0;var Qd=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Qd>>>26)|0,Qd&=67108863,D=Math.imul(ke,ot),O=Math.imul(ke,pt),O=O+Math.imul(nt,ot)|0,H=Math.imul(nt,pt),D=D+Math.imul(Fe,tn)|0,O=O+Math.imul(Fe,rn)|0,O=O+Math.imul(it,tn)|0,H=H+Math.imul(it,rn
vendor: 21,047 bytes, line 7446
7446)|0,D=D+Math.imul(lt,nn)|0,O=O+Math.imul(lt,ln)|0,O=O+Math.imul(We,nn)|0,H=H+Math.imul(We,ln)|0,D=D+Math.imul(Ye,un)|0,O=O+Math.imul(Ye,_n)|0,O=O+Math.imul(ze,un)|0,H=H+Math.imul(ze,_n)|0,D=D+Math.imul(Te,Wn)|0,O=O+Math.imul(Te,Zn)|0,O=O+Math.imul(ve,Wn)|0,H=H+Math.imul(ve,Zn)|0;var zu=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(zu>>>26)|0,zu&=67108863,D=Math.imul(ke,tn),O=Math.imul(ke,rn),O=O+Math.imul(nt,tn)|0,H=Math.imul(nt,rn),D=D+Math.imul(Fe,nn)|0,O=O+Math.imul(Fe,ln)|0,O=O+Math.imul(it,nn)|0,H=H+Math.imul(it,ln)|0,D=D+Math.imul(lt,un)|0,O=O+Math.imul(lt,_n)|0,O=O+Math.imul(We,un)|0,H=H+Math.imul(We,_n)|0,D=D+Math.imul(Ye,Wn)|0,O=O+Math.imul(Ye,Zn)|0,O=O+Math.imul(ze,Wn)|0,H=H+Math.imul(ze,Zn)|0;var Hu=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Hu>>>26)|0,Hu&=67108863,D=Math.imul(ke,nn),O=Math.imul(ke,ln),O=O+Math.imul(nt,nn)|0,H=Math.imul(nt,ln),D=D+Math.imul(Fe,un)|0,O=O+Math.imul(Fe,_n)|0,O=O+Math.imul(it,un)|0,H=H+Math.imul(it,_n)|0,D=D+Math.imul(lt,Wn)|0,O=O+Math.imul(lt,Zn)|0,O=O+Math.imul(We,Wn)|0,H=H+Math.imul(We,Zn)|0;var Xd=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Xd>>>26)|0,Xd&=67108863,D=Math.imul(ke,un),O=Math.imul(ke,_n),O=O+Math.imul(nt,un)|0,H=Math.imul(nt,_n),D=D+Math.imul(Fe,Wn)|0,O=O+Math.imul(Fe,Zn)|0,O=O+Math.imul(it,Wn)|0,H=H+Math.imul(it,Zn)|0;var Xc=(j+D|0)+((O&8191)<<13)|0;j=(H+(O>>>13)|0)+(Xc>>>26)|0,Xc&=67108863,D=Math.imul(ke,Wn),O=Math.imul(ke,Zn),O=O+Math.imul(nt,Wn)|0,H=Math.imul(nt,Zn);var Jc=(j+D|0)+((O&8191)<<13)|0;return j=(H+(O>>>13)|0)+(Jc>>>26)|0,Jc&=67108863,U[0]=fs,U[1]=Us,U[2]=cs,U[3]=Vr,U[4]=ps,U[5]=ko,U[6]=Mi,U[7]=dc,U[8]=Ji,U[9]=qu,U[10]=ql,U[11]=hc,U[12]=Qc,U[13]=Qd,U[14]=zu,U[15]=Hu,U[16]=Xd,U[17]=Xc,U[18]=Jc,j!==0&&(U[19]=j,_.length++),_};Math.imul||(T=E);function A(I,S,v){v.negative=S.negative^I.negative,v.length=I.length+S.length;for(var _=0,N=0,$=0;$<v.length-1;$++){var U=N;N=0;for(var j=_&67108863,D=Math.min($,S.length-1),O=Math.max(0,$-I.length+1);O<=D;O++){var H=$-O,J=I.words[H]|0,W=S.words[O]|0,Z=J*W,Y=Z&67108863;U=U+(Z/67108864|0)|0,Y=Y+j|0,j=Y&67108863,U=U+(Y>>>26)|0,N+=U>>>26,U&=67108863}v.words[$]=j,_=U,U=N}return _!==0?v.words[$]=_:v.length--,v._strip()}function k(I,S,v){return A(I,S,v)}r.prototype.mulTo=function(S,v){var _,N=this.length+S.length;return this.length===10&&S.length===10?_=T(this,S,v):N<63?_=E(this,S,v):N<1024?_=A(this,S,v):_=k(this,S,v),_},r.prototype.mul=function(S){var v=new r(null);return v.words=new Array(this.length+S.length),this.mulTo(S,v)},r.prototype.mulf=function(S){var v=new r(null);return v.words=new Array(this.length+S.length),k(this,S,v)},r.prototype.imul=function(S){return this.clone().mulTo(S,this)},r.prototype.imuln=function(S){var v=S<0;v&&(S=-S),i(typeof S=="number"),i(S<67108864);for(var _=0,N=0;N<this.length;N++){var $=(this.words[N]|0)*S,U=($&67108863)+(_&67108863);_>>=26,_+=$/67108864|0,_+=U>>>26,this.words[N]=U&67108863}return _!==0&&(this.words[N]=_,this.length++),this.length=S===0?1:this.length,v?this.ineg():this},r.prototype.muln=function(S){return this.clone().imuln(S)},r.prototype.sqr=function(){return this.mul(this)},r.prototype.isqr=function(){return this.imul(this.clone())},r.prototype.pow=function(S){var v=C(S);if(v.length===0)return new r(1);for(var _=this,N=0;N<v.length&&v[N]===0;N++,_=_.sqr());if(++N<v.length)for(var $=_.sqr();N<v.length;N++,$=$.sqr())v[N]!==0&&(_=_.mul($));return _},r.prototype.iushln=function(S){i(typeof S=="number"&&S>=0);var v=S%26,_=(S-v)/26,N=67108863>>>26-v<<26-v,$;if(v!==0){var U=0;for($=0;$<this.length;$++){var j=this.words[$]&N,D=(this.words[$]|0)-j<<v;this.words[$]=D|U,U=j>>>26-v}U&&(this.words[$]=U,this.length++)}if(_!==0){for($=this.length-1;$>=0;$--)this.words[$+_]=this.words[$];for($=0;$<_;$++)this.words[$]=0;this.length+=_}return this._strip()},r.prototype.ishln=function(S){return i(this.negative===0),this.iushln(S)},r.prototype.iushrn=function(S,v,_){i(typeof S=="number"&&S>=0);var N;v?N=(v-v%26)/26:N=0;var $=S%26,U=Math.min((S-$)/26,this.length),j=67108863^67108863>>>$<<$,D=_;if(N-=U,N=Math.max(0,N),D){for(var O=0;O<U;O++)D.words[O]=this.words[O];D.length=U}if(U!==0)if(this.length>U)for(this.length-=U,O=0;O<this.length;O++)this.words[O]=this.words[O+U];else this.words[0]=0,this.length=1;var H=0;for(O=this.length-1;O>=0&&(H!==0||O>=N);O--){var J=this.words[O]|0;this.words[O]=H<<26-$|J>>>$,H=J&j}return D&&H!==0&&(D.words[D.length++]=H),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},r.prototype.ishrn=function(S,v,_){return i(this.negative===0),this.iushrn(S,v,_)},r.prototype.shln=function(S){return this.clone().ishln(S)},r.prototype.ushln=function(S){return this.clone().iushln(S)},r.prototype.shrn=function(S){return this.clone().ishrn(S)},r.prototype.ushrn=function(S){return this.clone().iushrn(S)},r.prototype.testn=function(S){i(typeof S=="number"&&S>=0);var v=S%26,_=(S-v)/26,N=1<<v;if(this.length<=_)return!1;var $=this.words[_];return!!($&N)},r.prototype.imaskn=function(S){i(typeof S=="number"&&S>=0);var v=S%26,_=(S-v)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=_)return this;if(v!==0&&_++,this.length=Math.min(_,this.length),v!==0){var N=67108863^67108863>>>v<<v;this.words[this.length-1]&=N}return this._strip()},r.prototype.maskn=function(S){return this.clone().imaskn(S)},r.prototype.iaddn=function(S){return i(typeof S=="number"),i(S<67108864),S<0?this.isubn(-S):this.negative!==0?this.length===1&&(this.words[0]|0)<=S?(this.words[0]=S-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(S),this.negative=1,this):this._iaddn(S)},r.prototype._iaddn=function(S){this.words[0]+=S;for(var v=0;v<this.length&&this.words[v]>=67108864;v++)this.words[v]-=67108864,v===this.length-1?this.words[v+1]=1:this.words[v+1]++;return this.length=Math.max(this.length,v+1),this},r.prototype.isubn=function(S){if(i(typeof S=="number"),i(S<67108864),S<0)return this.iaddn(-S);if(this.negative!==0)return this.negative=0,this.iaddn(S),this.negative=1,this;if(this.words[0]-=S,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var v=0;v<this.length&&this.words[v]<0;v++)this.words[v]+=67108864,this.words[v+1]-=1;return this._strip()},r.prototype.addn=function(S){return this.clone().iaddn(S)},r.prototype.subn=function(S){return this.clone().isubn(S)},r.prototype.iabs=function(){return this.negative=0,this},r.prototype.abs=function(){return this.clone().iabs()},r.prototype._ishlnsubmul=function(S,v,_){var N=S.length+_,$;this._expand(N);var U,j=0;for($=0;$<S.length;$++){U=(this.words[$+_]|0)+j;var D=(S.words[$]|0)*v;U-=D&67108863,j=(U>>26)-(D/67108864|0),this.words[$+_]=U&67108863}for(;$<this.length-_;$++)U=(this.words[$+_]|0)+j,j=U>>26,this.words[$+_]=U&67108863;if(j===0)return this._strip();for(i(j===-1),j=0,$=0;$<this.length;$++)U=-(this.words[$]|0)+j,j=U>>26,this.words[$]=U&67108863;return this.negative=1,this._strip()},r.prototype._wordDiv=function(S,v){var _=this.length-S.length,N=this.clone(),$=S,U=$.words[$.length-1]|0,j=this._countBits(U);_=26-j,_!==0&&($=$.ushln(_),N.iushln(_),U=$.words[$.length-1]|0);var D=N.length-$.length,O;if(v!=="mod"){O=new r(null),O.length=D+1,O.words=new Array(O.length);for(var H=0;H<O.length;H++)O.words[H]=0}var J=N.clone()._ishlnsubmul($,1,D);J.negative===0&&(N=J,O&&(O.words[D]=1));for(var W=D-1;W>=0;W--){var Z=(N.words[$.length+W]|0)*67108864+(N.words[$.length+W-1]|0);for(Z=Math.min(Z/U|0,67108863),N._ishlnsubmul($,Z,W);N.negative!==0;)Z--,N.negative=0,N._ishlnsubmul($,1,W),N.isZero()||(N.negative^=1);O&&(O.words[W]=Z)}return O&&O._strip(),N._strip(),v!=="div"&&_!==0&&N.iushrn(_),{div:O||null,mod:N}},r.prototype.divmod=function(S,v,_){if(i(!S.isZero()),this.isZero())return{div:new r(0),mod:new r(0)};var N,$,U;return this.negative!==0&&S.negative===0?(U=this.neg().divmod(S,v),v!=="mod"&&(N=U.div.neg()),v!=="div"&&($=U.mod.neg(),_&&$.negative!==0&&$.iadd(S)),{div:N,mod:$}):this.negative===0&&S.negative!==0?(U=this.divmod(S.neg(),v),v!=="mod"&&(N=U.div.neg()),{div:N,mod:U.mod}):(this.negative&S.negative)!==0?(U=this.neg().divmod(S.neg(),v),v!=="div"&&($=U.mod.neg(),_&&$.negative!==0&&$.isub(S)),{div:U.div,mod:$}):S.length>this.length||this.cmp(S)<0?{div:new r(0),mod:this}:S.length===1?v==="div"?{div:this.divn(S.words[0]),mod:null}:v==="mod"?{div:null,mod:new r(this.modrn(S.words[0]))}:{div:this.divn(S.words[0]),mod:new r(this.modrn(S.words[0]))}:this._wordDiv(S,v)},r.prototype.div=function(S){return this.divmod(S,"div",!1).div},r.prototype.mod=function(S){return this.divmod(S,"mod",!1).mod},r.prototype.umod=function(S){return this.divmod(S,"mod",!0).mod},r.prototype.divRound=function(S){var v=this.divmod(S);if(v.mod.isZero())return v.div;var _=v.div.negative!==0?v.mod.isub(S):v.mod,N=S.ushrn(1),$=S.andln(1),U=_.cmp(N);return U<0||$===1&&U===0?v.div:v.div.negative!==0?v.div.isubn(1):v.div.iaddn(1)},r.prototype.modrn=function(S){var v=S<0;v&&(S=-S),i(S<=67108863);for(var _=(1<<26)%S,N=0,$=this.length-1;$>=0;$--)N=(_*N+(this.words[$]|0))%S;return v?-N:N},r.prototype.modn=function(S){return this.modrn(S)},r.prototype.idivn=function(S){var v=S<0;v&&(S=-S),i(S<=67108863);for(var _=0,N=this.length-1;N>=0;N--){var $=(this.words[N]|0)+_*67108864;this.words[N]=$/S|0,_=$%S}return this._strip(),v?this.ineg():this},r.prototype.divn=function(S){return this.clone().idivn(S)},r.prototype.egcd=function(S){i(S.negative===0),i(!S.isZero());var v=this,_=S.clone();v.negative!==0?v=v.umod(S):v=v.clone();for(var N=new r(1),$=new r(0),U=new r(0),j=new r(1),D=0;v.isEven()&&_.isEven();)v.iushrn(1),_.iushrn(1),++D;for(var O=_.clone(),H=v.clone();!v.isZero();){for(var J=0,W=1;(v.words[0]&W)===0&&J<26;++J,W<<=1);if(J>0)for(v.iushrn(J);J-- >0;)(N.isOdd()||$.isOdd())&&(N.iadd(O),$.isub(H)),N.iushrn(1),$.iushrn(1);for(var Z=0,Y=1;(_.words[0]&Y)===0&&Z<26;++Z,Y<<=1);if(Z>0)for(_.iushrn(Z);Z-- >0;)(U.isOdd()||j.isOdd())&&(U.iadd(O),j.isub(H)),U.iushrn(1),j.iushrn(1);v.cmp(_)>=0?(v.isub(_),N.isub(U),$.isub(j)):(_.isub(v),U.isub(N),j.isub($))}return{a:U,b:j,gcd:_.iushln(D)}},r.prototype._invmp=function(S){i(S.negative===0),i(!S.isZero());var v=this,_=S.clone();v.negative!==0?v=v.umod(S):v=v.clone();for(var N=new r(1),$=new r(0),U=_.clone();v.cmpn(1)>0&&_.cmpn(1)>0;){for(var j=0,D=1;(v.words[0]&D)===0&&j<26;++j,D<<=1);if(j>0)for(v.iushrn(j);j-- >0;)N.isOdd()&&N.iadd(U),N.iushrn(1);for(var O=0,H=1;(_.words[0]&H)===0&&O<26;++O,H<<=1);if(O>0)for(_.iushrn(O);O-- >0;)$.isOdd()&&$.iadd(U),$.iushrn(1);v.cmp(_)>=0?(v.isub(_),N.isub($)):(_.isub(v),$.isub(N))}var J;return v.cmpn(1)===0?J=N:J=$,J.cmpn(0)<0&&J.iadd(S),J},r.prototype.gcd=function(S){if(this.isZero())return S.abs();if(S.isZero())return this.abs();var v=this.clone(),_=S.clone();v.negative=0,_.negative=0;for(var N=0;v.isEven()&&_.isEven();N++)v.iushrn(1),_.iushrn(1);do{for(;v.isEven();)v.iushrn(1);for(;_.isEven();)_.iushrn(1);var $=v.cmp(_);if($<0){var U=v;v=_,_=U}else if($===0||_.cmpn(1)===0)break;v.isub(_)}while(!0);return _.iushln(N)},r.prototype.invm=function(S){return this.egcd(S).a.umod(S)},r.prototype.isEven=function(){return(this.words[0]&1)===0},r.prototype.isOdd=function(){return(this.words[0]&1)===1},r.prototype.andln=function(S){return this.words[0]&S},r.prototype.bincn=function(S){i(typeof S=="number");var v=S%26,_=(S-v)/26,N=1<<v;if(this.length<=_)return this._expand(_+1),this.words[_]|=N,this;for(var $=N,U=_;$!==0&&U<this.length;U++){var j=this.words[U]|0;j+=$,$=j>>>26,j&=67108863,this.words[U]=j}return $!==0&&(this.words[U]=$,this.length++),this},r.prototype.isZero=function(){return this.length===1&&this.words[0]===0},r.prototype.cmpn=function(S){var v=S<0;if(this.negative!==0&&!v)return-1;if(this.negative===0&&v)return 1;this._strip();var _;if(this.length>1)_=1;else{v&&(S=-S),i(S<=67108863,"Number is too big");var N=this.words[0]|0;_=N===S?0:N<S?-1:1}return this.negative!==0?-_|0:_},r.prototype.cmp=function(S){if(this.negative!==0&&S.negative===0)return-1;if(this.negative===0&&S.negative!==0)return 1;var v=this.ucmp(S);return this.negative!==0?-v|0:v},r.prototype.ucmp=function(S){if(this.length>S.length)return 1;if(this.length<S.length)return-1;for(var v=0,_=this.length-1;_>=0;_--){var N=this.words[_]|0,$=S.words[_]|0;if(N!==$){N<$?v=-1:N>$&&(v=1);break}}return v},r.prototype.gtn=function(S){return this.cmpn(S)===1},r.prototype.gt=function(S){return this.cmp(S)===1},r.prototype.gten=function(S){return this.cmpn(S)>=0},r.prototype.gte=function(S){return this.cmp(S)>=0},r.prototype.ltn=function(S){return this.cmpn(S)===-1},r.prototype.lt=function(S){return this.cmp(S)===-1},r.prototype.lten=function(S){return this.cmpn(S)<=0},r.prototype.lte=function(S){return this.cmp(S)<=0},r.prototype.eqn=function(S){return this.cmpn(S)===0},r.prototype.eq=function(S){return this.cmp(S)===0},r.red=function(S){return new q(S)},r.prototype.toRed=function(S){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),S.convertTo(this)._forceRed(S)},r.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},r.prototype._forceRed=function(S){return this.red=S,this},r.prototype.forceRed=function(S){return i(!this.red,"Already a number in reduction context"),this._forceRed(S)},r.prototype.redAdd=function(S){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,S)},r.prototype.redIAdd=function(S){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,S)},r.prototype.redSub=function(S){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,S)},r.prototype.redISub=function(S){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,S)},r.prototype.redShl=function(S){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,S)},r.prototype.redMul=function(S){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.mul(this,S)},r.prototype.redIMul=function(S){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.imul(this,S)},r.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},r.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},r.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},r.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},r.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},r.prototype.redPow=function(S){return i(this.red&&!S.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,S)};var R={k256:null,p224:null,p192:null,p25519:null};function P(I,S){this.name=I,this.p=new r(S,16),this.n=this.p.bitLength(),this.k=new r(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}P.prototype._tmp=function(){var S=new r(null);return S.words=new Array(Math.ceil(this.n/13)),S},P.prototype.ireduce=function(S){var v=S,_;do this.split(v,this.tmp),v=this.imulK(v),v=v.iadd(this.tmp),_=v.bitLength();while(_>this.n);var N=_<this.n?-1:v.ucmp(this.p);return N===0?(v.words[0]=0,v.length=1):N>0?v.isub(this.p):v.strip!==void 0?v.strip():v._strip(),v},P.prototype.split=function(S,v){S.iushrn(this.n,0,v)},P.prototype.imulK=function(S){return S.imul(this.k)};function B(){P.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(B,P),B.prototype.split=function(S,v){for(var _=4194303,N=Math.min(S.length,9),$=0;$<N;$++)v.words[$]=S.words[$];if(v.length=N,S.length<=9){S.words[0]=0,S.length=1;return}var U=S.words[9];for(v.words[v.length++]=U&_,$=10;$<S.length;$++){var j=S.words[$]|0;S.words[$-10]=(j&_)<<4|U>>>22,U=j}U>>>=22,S.words[$-10]=U,U===0&&S.length>10?S.length-=10:S.length-=9},B.prototype.imulK=function(S){S.words[S.length]=0,S.words[S.length+1]=0,S.length+=2;for(var v=0,_=0;_<S.length;_++){var N=S.words[_]|0;v+=N*977,S.words[_]=v&67108863,v=N*64+(v/67108864|0)}return S.words[S.length-1]===0&&(S.length--,S.words[S.length-1]===0&&S.length--),S};function F(){P.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(F,P);function z(){P.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(z,P);function K(){P.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(K,P),K.prototype.imulK=function(S){for(var v=0,_=0;_<S.length;_++){var N=(S.words[_]|0)*19+v,$=N&67108863;N>>>=26,S.words[_]=$,v=N}return v!==0&&(S.words[S.length++]=v),S},r._prime=function(S){if(R[S])return R[S];var v;if(S==="k256")v=new B;else if(S==="p224")v=new F;else if(S==="p192")v=new z;else if(S==="p25519")v=new K;else throw new Error("Unknown prime "+S);return R[S]=v,v};function q(I){if(typeof I=="string"){var S=r._prime(I);this.m=S.p,this.prime=S}else i(I.gtn(1),"modulus must be greater than 1"),this.m=I,this.prime=null}q.prototype._verify1=function(S){i(S.negative===0,"red works only with positives"),i(S.red,"red works only with red numbers")},q.prototype._verify2=function(S,v){i((S.negative|v.negative)===0,"red works only with positives"),i(S.red&&S.red===v.red,"red works only with red numbers")},q.prototype.imod=function(S){return this.prime?this.prime.ireduce(S)._forceRed(this):(d(S,S.umod(this.m)._forceRed(this)),S)},q.prototype.neg=function(S){return S.isZero()?S.clone():this.m.sub(S)._forceRed(this)},q.prototype.add=function(S,v){this._verify2(S,v);var _=S.add(v);return _.cmp(this.m)>=0&&_.isub(this.m),_._forceRed(this)},q.prototype.iadd=function(S,v){this._verify2(S,v);var _=S.iadd(v);return _.cmp(this.m)>=0&&_.isub(this.m),_},q.prototype.sub=function(S,v){this._verify2(S,v);var _=S.sub(v);return _.cmpn(0)<0&&_.iadd(this.m),_._forceRed(this)},q.prototype.isub=function(S,v){this._verify2(S,v);var _=S.isub(v);return _.cmpn(0)<0&&_.iadd(this.m),_},q.prototype.shl=function(S,v){return this._verify1(S),this.imod(S.ushln(v))},q.prototype.imul=function(S,v){return this._verify2(S,v),this.imod(S.imul(v))},q.prototype.mul=function(S,v){return this._verify2(S,v),this.imod(S.mul(v))},q.prototype.isqr=function(S){return this.imul(S,S.clone())},q.prototype.sqr=function(S){return this.mul(S,S)},q.prototype.sqrt=function(S){if(S.isZero())return S.clone();var v=this.m.andln(3);if(i(v%2===1),v===3){var _=this.m.add(new r(1)).iushrn(2);return this.pow(S,_)}for(var N=this.m.subn(1),$=0;!N.isZero()&&N.andln(1)===0;)$++,N.iushrn(1);i(!N.isZero());var U=new r(1).toRed(this),j=U.redNeg(),D=this.m.subn(1).iushrn(1),O=this.m.bitLength();for(O=new r(2*O*O).toRed(this);this.pow(O,D).cmp(j)!==0;)O.redIAdd(j);for(var H=this.pow(O,N),J=this.pow(S,N.addn(1).iushrn(1)),W=this.pow(S,N),Z=$;W.cmp(U)!==0;){for(var Y=W,Q=0;Y.cmp(U)!==0;Q++)Y=Y.redSqr();i(Q<Z);var ee=this.pow(H,new r(1).iushln(Z-Q-1));J=J.redMul(ee),H=ee.redSqr(),W=W.redMul(H),Z=Q}return J},q.prototype.invm=function(S){var v=S._invmp(this.m);return v.negative!==0?(v.negative=0,this.imod(v).redNeg()):this.imod(v)},q.prototype.pow=function(S,v){if(v.isZero())return new r(1).toRed(this);if(v.cmpn(1)===0)return S.clone();var _=4,N=new Array(1<<_);N[0]=new r(1).toRed(this),N[1]=S;for(var $=2;$<N.length;$++)N[$]=this.mul(N[$-1],S);var U=N[0],j=0,D=0,O=v.bitLength()%26;for(O===0&&(O=26),$=v.length-1;$>=0;$--){for(var H=v.words[$],J=O-1;J>=0;J--){var W=H>>J&1;if(U!==N[0]&&(U=this.sqr(U)),W===0&&j===0){D=0;continue}j<<=1,j|=W,D++,!(D!==_&&($!==0||J!==0))&&(U=this.mul(U,N[j]),D=0,j=0)}O=26}return U},q.prototype.convertTo=function(S){var v=S.umod(this.m);return v===S?v.clone():v},q.prototype.convertFrom=function(S){var v=S.clone();return v.red=null,v},r.mont=function(S){return new G(S)};function G(I){q.call(this,I),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new r(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)}s(G,q),G.prototype.convertTo=function(S){return this.imod(S.ushln(this.shift))},G.prototype.convertFrom=function(S){var v=this.imod(S.mul(this.rinv));return v.red=null,v},G.prototype.imul=function(S,v){if(S.isZero()||v.isZero())return S.words[0]=0,S.length=1,S;var _=S.imul(v),N=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$=_.isub(N).iushrn(this.shift),U=$;return $.cmp(this.m)>=0?U=$.isub(this.m):$.cmpn(0)<0&&(U=$.iadd(this.m)),U._forceRed(this)},G.prototype.mul=function(S,v){if(S.isZero()||v.isZero())return new r(0)._forceRed(this);var _=S.mul(v),N=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),$=_.isub(N).iushrn(this.shift),U=$;return $.cmp(this.m)>=0?U=$.isub(this.m):$.cmpn(0)<0&&(U=$.iadd(this.m)),U._forceRed(this)},G.prototype.invm=function(S){var v=this.imod(S._invmp(this.m).mul(this.r2));return v._forceRed(this)}})(t,rHe)})(xE)),xE.exports}var aHe=oHe();
7446const cHe=ya(aHe),lHe="logger/5.8.0";let UG=!1,BG=!1;const EE={debug:1,default:2,info:2,warning:3,error:4,off:5};let FG=EE.default,Bk=null;function uHe(){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("é".normalize("NFD")!=="eÌ")throw new Error("broken implementation")}catch(t){return t.message}return null}const jG=uHe();var LI;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(LI||(LI={}));var hu;(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"})(hu||(hu={}));const VG="0123456789abcdef";class Fn{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,n){const i=e.toLowerCase();EE[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(FG>EE[i])&&console.log.apply(console,n)}debug(...e){this._log(Fn.levels.DEBUG,e)}info(...e){this._log(Fn.levels.INFO,e)}warn(...e){this._log(Fn.levels.WARNING,e)}makeError(e,n,i){if(BG)return this.makeError("censored error",n,{});n||(n=Fn.errors.UNKNOWN_ERROR),i||(i={});const s=[];
7446Object.keys(i).forEach(c=>{const l=i[c];try{if(l instanceof Uint8Array){let d="";for(let h=0;h<l.length;h++)d+=VG[l[h]>>4],d+=VG[l[h]&15];s.push(c+"=Uint8Array(0x"+d+")")}else s.push(c+"="+JSON.stringify(l))}catch{s.push(c+"="+JSON.stringify(i[c].toString()))}}),s.push(`code=${n}`),s.push(`version=${this.version}`);const r=e;let o="";switch(n){case hu.NUMERIC_FAULT:{o="NUMERIC_FAULT";const c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":o+="-"+c;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case hu.CALL_EXCEPTION:case hu.INSUFFICIENT_FUNDS:case hu.MISSING_NEW:case hu.NONCE_EXPIRED:case hu.REPLACEMENT_UNDERPRICED:case hu.TRANSACTION_REPLACED:case hu.UNPREDICTABLE_GAS_LIMIT:o=n;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),s.length&&(e+=" ("+s.join(", ")+")");const a=new Error(e);return a.reason=r,a.code=n,Object.keys(i).forEach(function(c){a[c]=i[c]}),a}throwError(e,n,i){throw this.makeError(e,n,i)}throwArgumentError(e,n,i){return this.throwError(e,Fn.errors.INVALID_ARGUMENT,{argument:n,value:i})}assert(e,n,i,s){e||this.throwError(n,i,s)}assertArgument(e,n,i,s){e||this.throwArgumentError(n,i,s)}checkNormalize(e){jG&&this.throwError("platform missing String.prototype.normalize",Fn.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:jG})}checkSafeUint53(e,n){typeof e=="number"&&(n==null&&(n="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(n,Fn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(n,Fn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,n,i){i?i=": "+i:i="",e<n&&this.throwError("missing argument"+i,Fn.errors.MISSING_ARGUMENT,{count:e,expectedCount:n}),e>n&&this.throwError("too many arguments"+i,Fn.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:n})}checkNew(e,n){(e===Object||e==null)&&this.throwError("missing new",Fn.errors.MISSING_NEW,{name:n.name})}checkAbstract(e,n){e===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",Fn.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Fn.errors.MISSING_NEW,{name:n.name})}static globalLogger(){return Bk||(Bk=new Fn(lHe)),Bk}static setCensorship(e,n){if(!e&&n&&this.globalLogger().throwError("cannot permanently disable censorship",Fn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),UG){if(!e)return;this.globalLogger().throwError("error censorship permanent",Fn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}BG=!!e,UG=!!n}static setLogLevel(e){const n=EE[e.toLowerCase()];if(n==null){Fn.globalLogger().warn("invalid log level - "+e);return}FG=n}static from(e){return new Fn(e)}}Fn.errors=hu;Fn.levels=LI;const dHe="bytes/5.8.0",kd=new Fn(dHe);function Qre(t){return!!t.toHexString}function N2(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return N2(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function WG(t){return typeof t=="number"&&t==t&&t%1===0}function aL(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!WG(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const n=t[e];if(!WG(n)||n<0||n>=256)return!1}return!0}function Ur(t,e){if(e||(e={}),typeof t=="number"){kd.checkSafeUint53(t,"invalid arrayify value");const n=[];for(;t;)n.unshift(t&255),t=parseInt(String(t/256));return n.length===0&&n.push(0),N2(new Uint8Array(n))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),Qre(t)&&(t=t.toHexString()),Lp(t)){let n=t.substring(2);n.length%2&&(e.hexPad==="left"?n="0"+n:e.hexPad==="right"?n+="0":kd.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let s=0;s<n.length;s+=2)i.push(parseInt(n.substring(s,s+2),16));return N2(new Uint8Array(i))}return aL(t)?N2(new Uint8Array(t)):kd.throwArgumentError("invalid arrayify value","value",t)}function bg(t){const e=t.map(s=>Ur(s)),n=e.reduce((s,r)=>s+r.length,0),i=new Uint8Array(n);return e.reduce((s,r)=>(i.set(r,s),s+r.length),0),N2(i)}function Fk(t,e){t=Ur(t),t.length>e&&kd.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(e);return n.set(t,e-t.length),N2(n)}function Lp(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const jk="0123456789abcdef";function Uf(t,e){if(e||(e={}
7446),typeof t=="number"){kd.checkSafeUint53(t,"invalid hexlify value");let n="";for(;t;)n=jk[t&15]+n,t=Math.floor(t/16);return n.length?(n.length%2&&(n="0"+n),"0x"+n):"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),Qre(t))return t.toHexString();if(Lp(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":kd.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(aL(t)){let n="0x";for(let i=0;i<t.length;i++){let s=t[i];n+=jk[(s&240)>>4]+jk[s&15]}return n}return kd.throwArgumentError("invalid hexlify value","value",t)}function qG(t){if(typeof t!="string")t=Uf(t);else if(!Lp(t)||t.length%2)return null;return(t.length-2)/2}function hHe(t,e,n){return typeof t!="string"?t=Uf(t):(!Lp(t)||t.length%2)&&kd.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function fHe(t){let e="0x";return t.forEach(n=>{e+=Uf(n).substring(2)}),e}function Xre(t,e){for(typeof t!="string"?t=Uf(t):Lp(t)||kd.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&kd.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}const pHe="bignumber/5.8.0";var a8=cHe.BN;const Bh=new Fn(pHe),Vk={},zG=9007199254740991;let HG=!1;class Os{constructor(e,n){e!==Vk&&Bh.throwError("cannot call constructor directly; use BigNumber.from",Fn.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=n,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return $a(di(this).fromTwos(e))}toTwos(e){return $a(di(this).toTwos(e))}abs(){return this._hex[0]==="-"?Os.from(this._hex.substring(1)):this}add(e){return $a(di(this).add(di(e)))}sub(e){return $a(di(this).sub(di(e)))}div(e){return Os.from(e).isZero()&&ml("division-by-zero","div"),$a(di(this).div(di(e)))}mul(e){return $a(di(this).mul(di(e)))}mod(e){const n=di(e);return n.isNeg()&&ml("division-by-zero","mod"),$a(di(this).umod(n))}pow(e){const n=di(e);return n.isNeg()&&ml("negative-power","pow"),$a(di(this).pow(n))}and(e){const n=di(e);return(this.isNegative()||n.isNeg())&&ml("unbound-bitwise-result","and"),$a(di(this).and(n))}or(e){const n=di(e);return(this.isNegative()||n.isNeg())&&ml("unbound-bitwise-result","or"),$a(di(this).or(n))}xor(e){const n=di(e);return(this.isNegative()||n.isNeg())&&ml("unbound-bitwise-result","xor"),$a(di(this).xor(n))}mask(e){return(this.isNegative()||e<0)&&ml("negative-width","mask"),$a(di(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ml("negative-width","shl"),$a(di(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ml("negative-width","shr"),$a(di(this).shrn(e))}eq(e){return di(this).eq(di(e))}lt(e){return di(this).lt(di(e))}lte(e){return di(this).lte(di(e))}gt(e){return di(this).gt(di(e))}gte(e){return di(this).gte(di(e))}isNegative(){return this._hex[0]==="-"}isZero(){return di(this).isZero()}toNumber(){try{return di(this).toNumber()}catch{ml("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Bh.throwError("this platform does not support BigInt",Fn.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?HG||(HG=!0,Bh.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Bh.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Fn.errors.UNEXPECTED_ARGUMENT,{}):Bh.throwError("BigNumber.toString does not accept parameters",Fn.errors.UNEXPECTED_ARGUMENT,{})),di(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Os)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Os(Vk,G5(e)):e.match(/^-?[0-9]+$/)?new Os(Vk,G5(new a8(e))):Bh.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ml("underflow","BigNumber.from",e),(e>=zG||e<=-zG)&&ml("overflow","BigNumber.from",e),Os.from(String(e));const n=e;if(typeof n=="bigint")return Os.from(n.toString());if(aL(n))return Os.from(Uf(n));if(n)if(n.toHexString){const i=n.toHexString();if(typeof i=="string")return Os.from(i)}else{let i=n._hex;if(i==null&&n.type==="BigNumber"&&(i=n.hex),typeof i=="string"&&(Lp(i)||i[0]==="-"&&Lp(i.substring(1))))return Os.from(i)}return Bh.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function G5(t){if(typeof t!="string")return G5(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Bh.throwArgumentError("invalid hex","value",t),t=G5(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 $a(t){return Os.from(G5(t))}function di(t){const e=Os.from(t).toHexString();return e[0]==="-"?new a8("-"+e.substring(3),16):new a8(e.substring(2),16)}function ml(t,e,n){const i={fault:t,operation:e};return n!=null&&(i.value=n),Bh.throwError(t,Fn.errors.NUMERIC_FAULT,i)}function mHe(t){return new a8(t,36).toString(16)}
7446var Wk={exports:{}};/** 7447 * [js-sha3]{@link https://github.com/emn178/js-sha3} 7448 * 7449 * @version 0.8.0 7450 * @author Chen, Yi-Cyuan [[email protected]] 7451 * @copyright Chen, Yi-Cyuan 2015-2018 7452 * @license MIT 7453 */var GG;function gHe(){return GG||(GG=1,(function(t){(function(){var e="input is invalid type",n="finalize already called",i=typeof window=="object",s=i?window:{};s.JS_SHA3_NO_WINDOW&&(i=!1);var r=!i&&typeof self=="object",o=!s.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?s=yu:r&&(s=self);var a=!s.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,c=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],h=[4,1024,262144,67108864],p=[1,256,65536,16777216],g=[6,1536,393216,100663296],b=[0,8,16,24],w=[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],C=[224,256,384,512],E=[128,256],T=["hex","buffer","arrayBuffer","array","digest"],A={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(W){return Object.prototype.toString.call(W)==="[object Array]"}),c&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(W){return typeof W=="object"&&W.buffer&&W.buffer.constructor===ArrayBuffer});for(var k=function(W,Z,Y){return function(Q){return new O(W,Z,W).update(Q)[Y]()}},R=function(W,Z,Y){return function(Q,ee){return new O(W,Z,ee).update(Q)[Y]()}},P=function(W,Z,Y){return function(Q,ee,ie,re){return S["cshake"+W].update(Q,ee,ie,re)[Y]()}},B=function(W,Z,Y){return function(Q,ee,ie,re){return S["kmac"+W].update(Q,ee,ie,re)[Y]()}},F=function(W,Z,Y,Q){for(var ee=0;ee<T.length;++ee){var ie=T[ee];W[ie]=Z(Y,Q,ie)}return W},z=function(W,Z){var Y=k(W,Z,"hex");return Y.create=function(){return new O(W,Z,W)},Y.update=function(Q){return Y.create().update(Q)},F(Y,k,W,Z)},K=function(W,Z){var Y=R(W,Z,"hex");return Y.create=function(Q){return new O(W,Z,Q)},Y.update=function(Q,ee){return Y.create(ee).update(Q)},F(Y,R,W,Z)},q=function(W,Z){var Y=A[W],Q=P(W,Z,"hex");return Q.create=function(ee,ie,re){return!ie&&!re?S["shake"+W].create(ee):new O(W,Z,ee).bytepad([ie,re],Y)},Q.update=function(ee,ie,re,oe){return Q.create(ie,re,oe).update(ee)},F(Q,P,W,Z)},G=function(W,Z){var Y=A[W],Q=B(W,Z,"hex");return Q.create=function(ee,ie,re){return new H(W,Z,ie).bytepad(["KMAC",re],Y).bytepad([ee],Y)},Q.update=function(ee,ie,re,oe){return Q.create(ee,re,oe).update(ie)},F(Q,B,W,Z)},I=[{name:"keccak",padding:p,bits:C,createMethod:z},{name:"sha3",padding:g,bits:C,createMethod:z},{name:"shake",padding:d,bits:E,createMethod:K},{name:"cshake",padding:h,bits:E,createMethod:q},{name:"kmac",padding:h,bits:E,createMethod:G}],S={},v=[],_=0;_<I.length;++_)for(var N=I[_],$=N.bits,U=0;U<$.length;++U){var j=N.name+"_"+$[U];if(v.push(j),S[j]=N.createMethod($[U],N.padding),N.name!=="sha3"){var D=N.name+$[U];v.push(D),S[D]=S[j]}}function O(W,Z,Y){this.blocks=[],this.s=[],this.padding=Z,this.outputBits=Y,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(W<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Y>>5,this.extraBytes=(Y&31)>>3;for(var Q=0;Q<50;++Q)this.s[Q]=0}O.prototype.update=function(W){if(this.finalized)throw new Error(n);var Z,Y=typeof W;if(Y!=="string"){if(Y==="object"){if(W===null)throw new Error(e);
7453if(c&&W.constructor===ArrayBuffer)W=new Uint8Array(W);else if(!Array.isArray(W)&&(!c||!ArrayBuffer.isView(W)))throw new Error(e)}else throw new Error(e);Z=!0}for(var Q=this.blocks,ee=this.byteCount,ie=W.length,re=this.blockCount,oe=0,de=this.s,he,ue;oe<ie;){if(this.reset)for(this.reset=!1,Q[0]=this.block,he=1;he<re+1;++he)Q[he]=0;if(Z)for(he=this.start;oe<ie&&he<ee;++oe)Q[he>>2]|=W[oe]<<b[he++&3];else for(he=this.start;oe<ie&&he<ee;++oe)ue=W.charCodeAt(oe),ue<128?Q[he>>2]|=ue<<b[he++&3]:ue<2048?(Q[he>>2]|=(192|ue>>6)<<b[he++&3],Q[he>>2]|=(128|ue&63)<<b[he++&3]):ue<55296||ue>=57344?(Q[he>>2]|=(224|ue>>12)<<b[he++&3],Q[he>>2]|=(128|ue>>6&63)<<b[he++&3],Q[he>>2]|=(128|ue&63)<<b[he++&3]):(ue=65536+((ue&1023)<<10|W.charCodeAt(++oe)&1023),Q[he>>2]|=(240|ue>>18)<<b[he++&3],Q[he>>2]|=(128|ue>>12&63)<<b[he++&3],Q[he>>2]|=(128|ue>>6&63)<<b[he++&3],Q[he>>2]|=(128|ue&63)<<b[he++&3]);if(this.lastByteIndex=he,he>=ee){for(this.start=he-ee,this.block=Q[re],he=0;he<re;++he)de[he]^=Q[he];J(de),this.reset=!0}else this.start=he}return this},O.prototype.encode=function(W,Z){var Y=W&255,Q=1,ee=[Y];for(W=W>>8,Y=W&255;Y>0;)ee.unshift(Y),W=W>>8,Y=W&255,++Q;return Z?ee.push(Q):ee.unshift(Q),this.update(ee),ee.length},O.prototype.encodeString=function(W){var Z,Y=typeof W;if(Y!=="string"){if(Y==="object"){if(W===null)throw new Error(e);
7453if(c&&W.constructor===ArrayBuffer)W=new Uint8Array(W);else if(!Array.isArray(W)&&(!c||!ArrayBuffer.isView(W)))throw new Error(e)}else throw new Error(e);Z=!0}var Q=0,ee=W.length;if(Z)Q=ee;else for(var ie=0;ie<W.length;++ie){var re=W.charCodeAt(ie);re<128?Q+=1:re<2048?Q+=2:re<55296||re>=57344?Q+=3:(re=65536+((re&1023)<<10|W.charCodeAt(++ie)&1023),Q+=4)}return Q+=this.encode(Q*8),this.update(W),Q},O.prototype.bytepad=function(W,Z){for(var Y=this.encode(Z),Q=0;Q<W.length;++Q)Y+=this.encodeString(W[Q]);var ee=Z-Y%Z,ie=[];return ie.length=ee,this.update(ie),this},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var W=this.blocks,Z=this.lastByteIndex,Y=this.blockCount,Q=this.s;if(W[Z>>2]|=this.padding[Z&3],this.lastByteIndex===this.byteCount)for(W[0]=W[Y],Z=1;Z<Y+1;++Z)W[Z]=0;for(W[Y-1]|=2147483648,Z=0;Z<Y;++Z)Q[Z]^=W[Z];J(Q)}},O.prototype.toString=O.prototype.hex=function(){this.finalize();for(var W=this.blockCount,Z=this.s,Y=this.outputBlocks,Q=this.extraBytes,ee=0,ie=0,re="",oe;ie<Y;){for(ee=0;ee<W&&ie<Y;++ee,++ie)oe=Z[ee],re+=l[oe>>4&15]+l[oe&15]+l[oe>>12&15]+l[oe>>8&15]+l[oe>>20&15]+l[oe>>16&15]+l[oe>>28&15]+l[oe>>24&15];ie%W===0&&(J(Z),ee=0)}return Q&&(oe=Z[ee],re+=l[oe>>4&15]+l[oe&15],Q>1&&(re+=l[oe>>12&15]+l[oe>>8&15]),Q>2&&(re+=l[oe>>20&15]+l[oe>>16&15])),re},O.prototype.arrayBuffer=function(){this.finalize();var W=this.blockCount,Z=this.s,Y=this.outputBlocks,Q=this.extraBytes,ee=0,ie=0,re=this.outputBits>>3,oe;Q?oe=new ArrayBuffer(Y+1<<2):oe=new ArrayBuffer(re);for(var de=new Uint32Array(oe);ie<Y;){for(ee=0;ee<W&&ie<Y;++ee,++ie)de[ie]=Z[ee];ie%W===0&&J(Z)}return Q&&(de[ee]=Z[ee],oe=oe.slice(0,re)),oe},O.prototype.buffer=O.prototype.arrayBuffer,O.prototype.digest=O.prototype.array=function(){this.finalize();for(var W=this.blockCount,Z=this.s,Y=this.outputBlocks,Q=this.extraBytes,ee=0,ie=0,re=[],oe,de;ie<Y;){for(ee=0;ee<W&&ie<Y;
7453++ee,++ie)oe=ie<<2,de=Z[ee],re[oe]=de&255,re[oe+1]=de>>8&255,re[oe+2]=de>>16&255,re[oe+3]=de>>24&255;ie%W===0&&J(Z)}return Q&&(oe=ie<<2,de=Z[ee],re[oe]=de&255,Q>1&&(re[oe+1]=de>>8&255),Q>2&&(re[oe+2]=de>>16&255)),re};function H(W,Z,Y){O.call(this,W,Z,Y)}H.prototype=new O,H.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var J=function(W){var Z,Y,Q,ee,ie,re,oe,de,he,ue,be,_e,Ne,pe,Te,ve,xe,Ye,ze,ft,lt,We,Dt,Fe,it,Qt,ke,nt,ht,At,zt,Ln,gn,yn,bi,En,yt,mt,_t,Vt,Yn,Ee,$e,Xe,ot,pt,Ot,tn,rn,Mt,nn,ln,Oi,un,_n,Cs,Wn,Zn,fs,Us,cs,Vr,ps;for(Q=0;Q<48;Q+=2)ee=W[0]^W[10]^W[20]^W[30]^W[40],ie=W[1]^W[11]^W[21]^W[31]^W[41],re=W[2]^W[12]^W[22]^W[32]^W[42],oe=W[3]^W[13]^W[23]^W[33]^W[43],de=W[4]^W[14]^W[24]^W[34]^W[44],he=W[5]^W[15]^W[25]^W[35]^W[45],ue=W[6]^W[16]^W[26]^W[36]^W[46],be=W[7]^W[17]^W[27]^W[37]^W[47],_e=W[8]^W[18]^W[28]^W[38]^W[48],Ne=W[9]^W[19]^W[29]^W[39]^W[49],Z=_e^(re<<1|oe>>>31),Y=Ne^(oe<<1|re>>>31),W[0]^=Z,W[1]^=Y,W[10]^=Z,W[11]^=Y,W[20]^=Z,W[21]^=Y,W[30]^=Z,W[31]^=Y,W[40]^=Z,W[41]^=Y,Z=ee^(de<<1|he>>>31),Y=ie^(he<<1|de>>>31),W[2]^=Z,W[3]^=Y,W[12]^=Z,W[13]^=Y,W[22]^=Z,W[23]^=Y,W[32]^=Z,W[33]^=Y,W[42]^=Z,W[43]^=Y,Z=re^(ue<<1|be>>>31),Y=oe^(be<<1|ue>>>31),W[4]^=Z,W[5]^=Y,W[14]^=Z,W[15]^=Y,W[24]^=Z,W[25]^=Y,W[34]^=Z,W[35]^=Y,W[44]^=Z,W[45]^=Y,Z=de^(_e<<1|Ne>>>31),Y=he^(Ne<<1|_e>>>31),W[6]^=Z,W[7]^=Y,W[16]^=Z,W[17]^=Y,W[26]^=Z,W[27]^=Y,W[36]^=Z,W[37]^=Y,W[46]^=Z,W[47]^=Y,Z=ue^(ee<<1|ie>>>31),Y=be^(ie<<1|ee>>>31),W[8]^=Z,W[9]^=Y,W[18]^=Z,W[19]^=Y,W[28]^=Z,W[29]^=Y,W[38]^=Z,W[39]^=Y,W[48]^=Z,W[49]^=Y,pe=W[0],Te=W[1],pt=W[11]<<4|W[10]>>>28,Ot=W[10]<<4|W[11]>>>28,nt=W[20]<<3|W[21]>>>29,ht=W[21]<<3|W[20]>>>29,Us=W[31]<<9|W[30]>>>23,cs=W[30]<<9|W[31]>>>23,Ee=W[40]<<18|W[41]>>>14,$e=W[41]<<18|W[40]>>>14,yn=W[2]<<1|W[3]>>>31,bi=W[3]<<1|W[2]>>>31,ve=W[13]<<12|W[12]>>>20,xe=W[12]<<12|W[13]>>>20,tn=W[22]<<10|W[23]>>>22,rn=W[23]<<10|W[22]>>>22,At=W[33]<<13|W[32]>>>19,zt=W[32]<<13|W[33]>>>19,Vr=W[42]<<2|W[43]>>>30,ps=W[43]<<2|W[42]>>>30,un=W[5]<<30|W[4]>>>2,_n=W[4]<<30|W[5]>>>2,En=W[14]<<6|W[15]>>>26,yt=W[15]<<6|W[14]>>>26,Ye=W[25]<<11|W[24]>>>21,ze=W[24]<<11|W[25]>>>21,Mt=W[34]<<15|W[35]>>>17,nn=W[35]<<15|W[34]>>>17,Ln=W[45]<<29|W[44]>>>3,gn=W[44]<<29|W[45]>>>3,Fe=W[6]<<28|W[7]>>>4,it=W[7]<<28|W[6]>>>4,Cs=W[17]<<23|W[16]>>>9,Wn=W[16]<<23|W[17]>>>9,mt=W[26]<<25|W[27]>>>7,_t=W[27]<<25|W[26]>>>7,ft=W[36]<<21|W[37]>>>11,lt=W[37]<<21|W[36]>>>11,ln=W[47]<<24|W[46]>>>8,Oi=W[46]<<24|W[47]>>>8,Xe=W[8]<<27|W[9]>>>5,ot=W[9]<<27|W[8]>>>5,Qt=W[18]<<20|W[19]>>>12,ke=W[19]<<20|W[18]>>>12,Zn=W[29]<<7|W[28]>>>25,fs=W[28]<<7|W[29]>>>25,Vt=W[38]<<8|W[39]>>>24,Yn=W[39]<<8|W[38]>>>24,We=W[48]<<14|W[49]>>>18,Dt=W[49]<<14|W[48]>>>18,W[0]=pe^~ve&Ye,W[1]=Te^~xe&ze,W[10]=Fe^~Qt&nt,W[11]=it^~ke&ht,W[20]=yn^~En&mt,W[21]=bi^~yt&_t,W[30]=Xe^~pt&tn,W[31]=ot^~Ot&rn,W[40]=un^~Cs&Zn,W[41]=_n^~Wn&fs,W[2]=ve^~Ye&ft,W[3]=xe^~ze<,W[12]=Qt^~nt&At,W[13]=ke^~ht&zt,W[22]=En^~mt&Vt,W[23]=yt^~_t&Yn,W[32]=pt^~tn&Mt,W[33]=Ot^~rn&nn,W[42]=Cs^~Zn&Us,W[43]=Wn^~fs&cs,W[4]=Ye^~ft&We,W[5]=ze^~lt&Dt,W[14]=nt^~At&Ln,W[15]=ht^~zt&gn,W[24]=mt^~Vt&Ee,W[25]=_t^~Yn&$e,W[34]=tn^~Mt&ln,W[35]=rn^~nn&Oi,W[44]=Zn^~Us&Vr,W[45]=fs^~cs&ps,W[6]=ft^~We&pe,W[7]=lt^~Dt&Te,W[16]=At^~Ln&Fe,W[17]=zt^~gn&it,W[26]=Vt^~Ee&yn,W[27]=Yn^~$e&bi,W[36]=Mt^~ln&Xe,W[37]=nn^~Oi&ot,W[46]=Us^~Vr&un,W[47]=cs^~ps&_n,W[8]=We^~pe&ve,W[9]=Dt^~Te&xe,W[18]=Ln^~Fe&Qt,W[19]=gn^~it&ke,W[28]=Ee^~yn&En,W[29]=$e^~bi&yt,W[38]=ln^~Xe&pt,W[39]=Oi^~ot&Ot,W[48]=Vr^~un&Cs,W[49]=ps^~_n&Wn,W[0]^=w[Q],W[1]^=w[Q+1]};if(a)t.exports=S;else for(_=0;_<v.length;++_)s[v[_]]=S[v[_]]})()})(Wk)),Wk.exports}var yHe=gHe();const Jre=ya(yHe);function cL(t){return"0x"+Jre.keccak_256(Ur(t))}const bHe="address/5.8.0",Qm=new Fn(bHe);function KG(t){Lp(t,20)||Qm.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),n=new Uint8Array(40);for(let s=0;s<40;s++)n[s]=e[s].charCodeAt(0);const i=Ur(cL(n));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(i[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const wHe=9007199254740991;function vHe(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const lL={};for(let t=0;t<10;t++)lL[String(t)]=String(t);for(let t=0;t<26;t++)lL[String.fromCharCode(65+t)]=String(10+t);const YG=Math.floor(vHe(wHe));function CHe(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>lL[i]).join("");for(;e.length>=YG;){let i=e.substring(0,YG);e=parseInt(i,10)%97+e.substring(i.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}function vb(t){let e=null;if(typeof t!="string"&&Qm.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=KG(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Qm.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)!==CHe(t)&&Qm.throwArgumentError("bad icap checksum","address",t),e=mHe(t.substring(4));e.length<40;)e="0"+e;e=KG("0x"+e)}else Qm.throwArgumentError("invalid address","address",t);return e}function xHe(t,e,n){return qG(e)!==32&&Qm.throwArgumentError("salt must be 32 bytes","salt",e),qG(n)!==32&&Qm.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",n),vb(hHe(cL(bg(["0xff",vb(t),e,n])),12))}function qk(t){return"0x"+Jre.keccak_256(Ur(t))}const EHe=Os.from(-1),_He=Os.from(0),SHe=Os.from(1),AHe=Os.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),THe="strings/5.7.0",kHe=new Fn(THe);var c8;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(c8||(c8={}));var ZG;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(ZG||(ZG={}));function NHe(t,e=c8.current){e!=c8.current&&(kHe.checkNormalize(),t=t.normalize(e));let n=[];for(let i=0;i<t.length;i++){const s=t.charCodeAt(i);if(s<128)n.push(s);else if(s<2048)n.push(s>>6|192),n.push(s&63|128);else if((s&64512)==55296){i++;const r=t.charCodeAt(i);if(i>=t.length||(r&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((s&1023)<<10)+(r&1023);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(s&63|128)}return Ur(n)}function RHe(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,IHe(i.key),i)}}function m4(t,e,n){return e&&RHe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function o1(){return o1=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},o1.apply(null,arguments)}function nw(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,$I(t,e)}
7453function $I(t,e){return $I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},$I(t,e)}function PHe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function IHe(t){var e=PHe(t,"string");return typeof e=="symbol"?e:e+""}var et;(function(t){t[t.MAINNET=1]="MAINNET",t[t.GOERLI=5]="GOERLI",t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.OPTIMISM_SEPOLIA=11155420]="OPTIMISM_SEPOLIA",t[t.ARBITRUM_ONE=42161]="ARBITRUM_ONE",t[t.ARBITRUM_GOERLI=421613]="ARBITRUM_GOERLI",t[t.ARBITRUM_SEPOLIA=421614]="ARBITRUM_SEPOLIA",t[t.POLYGON=137]="POLYGON",t[t.POLYGON_MUMBAI=80001]="POLYGON_MUMBAI",t[t.CELO=42220]="CELO",t[t.CELO_ALFAJORES=44787]="CELO_ALFAJORES",t[t.GNOSIS=100]="GNOSIS",t[t.MOONBEAM=1284]="MOONBEAM",t[t.BNB=56]="BNB",t[t.AVALANCHE=43114]="AVALANCHE",t[t.BASE_GOERLI=84531]="BASE_GOERLI",t[t.BASE_SEPOLIA=84532]="BASE_SEPOLIA",t[t.BASE=8453]="BASE",t[t.ZORA=7777777]="ZORA",t[t.ZORA_SEPOLIA=999999999]="ZORA_SEPOLIA",t[t.ROOTSTOCK=30]="ROOTSTOCK",t[t.BLAST=81457]="BLAST",t[t.ZKSYNC=324]="ZKSYNC",t[t.WORLDCHAIN=480]="WORLDCHAIN",t[t.UNICHAIN_SEPOLIA=1301]="UNICHAIN_SEPOLIA",t[t.UNICHAIN=130]="UNICHAIN",t[t.MONAD_TESTNET=10143]="MONAD_TESTNET",t[t.SONEIUM=1868]="SONEIUM",t[t.MONAD=143]="MONAD",t[t.XLAYER=196]="XLAYER"})(et||(et={}));et.MAINNET,et.OPTIMISM,et.OPTIMISM_GOERLI,et.OPTIMISM_SEPOLIA,et.ARBITRUM_ONE,et.ARBITRUM_GOERLI,et.ARBITRUM_SEPOLIA,et.POLYGON,et.POLYGON_MUMBAI,et.GOERLI,et.SEPOLIA,et.CELO_ALFAJORES,et.CELO,et.BNB,et.AVALANCHE,et.BASE,et.BASE_GOERLI,et.BASE_SEPOLIA,et.ZORA,et.ZORA_SEPOLIA,et.ROOTSTOCK,et.BLAST,et.ZKSYNC,et.WORLDCHAIN,et.UNICHAIN_SEPOLIA,et.UNICHAIN,et.MONAD_TESTNET,et.SONEIUM,et.MONAD,et.XLAYER;var QG;(function(t){t.ETHER="ETH",t.MATIC="MATIC",t.CELO="CELO",t.GNOSIS="XDAI",t.MOONBEAM="GLMR",t.BNB="BNB",t.AVAX="AVAX",t.ROOTSTOCK="RBTC"})(QG||(QG={}));var er,gr,Ri,zk,Hk,Gk,Kk,Yk,DHe=[et.MAINNET,et.GOERLI,et.SEPOLIA];function OHe(t,e){return e===void 0&&(e=[]),DHe.concat(e).reduce(function(n,i){return n[i]=t,n},{})}et.OPTIMISM,et.ARBITRUM_ONE,et.POLYGON,et.POLYGON_MUMBAI,et.SEPOLIA;er={},er[et.MAINNET]="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",er[et.GOERLI]="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",er[et.SEPOLIA]="0xF62c03E08ada871A0bEb309762E260a7a6a880E6",er[et.OPTIMISM]="0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf",er[et.ARBITRUM_ONE]="0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9",er[et.AVALANCHE]="0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C",er[et.BASE_SEPOLIA]="0x7Ae58f10f7849cA6F5fB71b7f45CB416c9204b1e",er[et.BASE]="0x8909dc15e40173ff4699343b6eb8132c65e18ec6",er[et.BNB]="0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6",er[et.POLYGON]="0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C",er[et.CELO]="0x79a530c8e2fA8748B7B40dd3629C0520c2cCf03f",er[et.BLAST]="0x5C346464d33F90bABaf70dB6388507CC889C1070",er[et.WORLDCHAIN]="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",er[et.UNICHAIN_SEPOLIA]="0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",er[et.UNICHAIN]="0x1f98400000000000000000000000000000000002",er[et.MONAD_TESTNET]="0x733e88f248b742db6c14c0b1713af5ad7fdd59d0",er[et.SONEIUM]="0x97febbc2adbd5644ba22736e962564b23f5828ce",er[et.MONAD]="0x182a927119d56008d921126764bf884221b10f59",er[et.XLAYER]="0xdf38f24fe153761634be942f9d859f3dba857e95";gr={},gr[et.MAINNET]="0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",gr[et.GOERLI]="0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",gr[et.SEPOLIA]="0xeE567Fe1712Faf6149d80dA1E6934E354124CfE3",gr[et.ARBITRUM_ONE]="0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24",gr[et.OPTIMISM]="0x4a7b5da61326a6379179b40d00f57e5bbdc962c2",gr[et.BASE_SEPOLIA]="0x1689E7B1F10000AE47eBfE339a4f69dECd19F602",gr[et.BASE]="0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24",gr[et.AVALANCHE]="0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24",gr[et.BNB]="0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24",gr[et.POLYGON]="0xedf6066a2b290c185783862c7f4776a2c8077ad1",gr[et.BLAST]="0xBB66Eb1c5e875933D44DAe661dbD80e5D9B03035",gr[et.WORLDCHAIN]="0x541aB7c31A119441eF3575F6973277DE0eF460bd",gr[et.UNICHAIN_SEPOLIA]="0x920b806E40A00E02E7D2b94fFc89860fDaEd3640",gr[et.UNICHAIN]="0x284f11109359a7e1306c3e447ef14d38400063ff",gr[et.MONAD_TESTNET]="0xfb8e1c3b833f9e67a71c859a132cf783b645e436",gr[et.SONEIUM]="0x273f68c234fa55b550b40e563c4a488e0d334320",gr[et.MONAD]="0x4b2ab38dbf28d31d467aa8993f6c2585981
7453d6804",gr[et.XLAYER]="0x182a927119d56008d921126764bf884221b10f59";var g4={v3CoreFactoryAddress:"0x1F98431c8aD98523631AE4a59f267346ea31F984",multicallAddress:"0x1F98415757620B543A52E61c46B32eB19261F984",quoterAddress:"0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6",v3MigratorAddress:"0xA5644E29708357803b5A882D272c41cC0dF92B34",nonfungiblePositionManagerAddress:"0xC36442b4a4522E871399CD717aBDD847Ab11FE88"},MHe=o1({},g4,{mixedRouteQuoterV1Address:"0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E",v4PoolManagerAddress:"0x000000000004444c5dc75cB358380D2e3dE08A90",v4PositionManagerAddress:"0xbd216513d74c8cf14cf4747e6aaa6420ff64ee9e",v4StateView:"0x7ffe42c4a5deea5b0fec41c94c136cf115597227",v4QuoterAddress:"0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203"}),LHe=o1({},g4,{mixedRouteQuoterV1Address:"0xBa60b6e6fF25488308789E6e0A65D838be34194e"}),$He=o1({},g4,{v4PoolManagerAddress:"0x9a13f98cb987694c9f086b1f5eb990eea8264ec3",v4PositionManagerAddress:"0x3c3ea4b57a46241e54610e5f022e5c45859a1017",v4StateView:"0xc18a3169788f4f75a170290584eca6395c75ecdb",v4QuoterAddress:"0x1f3131a13296fb91c90870043742c3cdbff1a8d7"}),UHe=o1({},g4,{multicallAddress:"0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB",tickLensAddress:"0xbfd8137f7d1516D3ea5cA83523914859ec47F573",v4PoolManagerAddress:"0x360e68faccca8ca495c1b759fd9eee466db9fb32",v4PositionManagerAddress:"0xd88f38f930b7952f2db2432cb002e7abbf3dd869",v4StateView:"0x76fd297e2d437cd7f76d50f01afe6160f86e9990",v4QuoterAddress:"0x3972c00f7ed4885e145823eb7c655375d275a1c5"}),XG=o1({},g4,{v4PoolManagerAddress:"0x67366782805870060151383f4bbff9dab53e5cd6",v4PositionManagerAddress:"0x1ec2ebf4f37e7363fdfe3551602425af0b3ceef9",v4StateView:"0x5ea1bd7974c8a611cbab0bdcafcb1d9cc9b3ba5a",v4QuoterAddress:"0xb3d5c3dfc3a7aebff71895a7191796bffc2c81b9"}),JG={v3CoreFactoryAddress:"0xAfE208a311B21f13EF87E33A90049fC17A7acDEc",multicallAddress:"0x633987602DE5C4F337e3DbF265303A1080324204",quoterAddress:"0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8",v3MigratorAddress:"0x3cFd4d48EDfDCC53D3f173F596f621064614C582",nonfungiblePositionManagerAddress:"0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A",tickLensAddress:"0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D",v4PoolManagerAddress:"0x288dc841A52FCA2707c6947B3A777c5E56cd87BC",v4PositionManagerAddress:"0xf7965f3981e4d5bc383bfbcb61501763e9068ca9",v4StateView:"0xbc21f8720babf4b20d195ee5c6e99c52b76f2bfb",v4QuoterAddress:"0x28566da1093609182dff2cb2a91cfd72e61d66cd"},BHe={v3CoreFactoryAddress:"0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7",multicallAddress:"0x963Df249eD09c358A4819E39d9Cd5736c3087184",quoterAddress:"0x78D78E420Da98ad378D7799bE8f4AF69033EB077",v3MigratorAddress:"0x32681814957e0C13117ddc0c2aba232b5c9e760f",nonfungiblePositionManagerAddress:"0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613",tickLensAddress:"0xD9270014D396281579760619CCf4c3af0501A47C",swapRouter02Address:"0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2",v4PoolManagerAddress:"0x28e2ea090877bf75740558f6bfb36a5ffee9e9df",v4PositionManagerAddress:"0x7a4a5c919ae2541aed11041a1aeee68f1287f95b",v4StateView:"0xd13dd3d6e93f276fafc9db9e6bb47c1180aee0c4",v4QuoterAddress:"0x9f75dd27d6664c475b90e105573e550ff69437b0"},FHe={v3CoreFactoryAddress:"0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10",multicallAddress:"0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd",quoterAddress:"0x9569CbA925c8ca2248772A9A4976A516743A246F",v3MigratorAddress:"0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8",nonfungiblePositionManagerAddress:"0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6",tickLensAddress:"0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e"},jHe={v3CoreFactoryAddress:"0x8CE191193D15ea94e11d327b4c7ad8bbE520f6aF",multicallAddress:"0x80e4e06841bb76AA9735E0448cB8d003C0EF009a",quoterAddress:"0x0FBEa6cf957d95ee9313490050F6A0DA68039404",v3MigratorAddress:"0xE7EcbAAaA54D007A00dbb6c1d2f150066D69dA07",nonfungiblePositionManagerAddress:"0xdA75cEf1C93078e8b736FCA5D5a30adb97C8957d",tickLensAddress:"0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5",swapRouter02Address:"0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4"},VHe={v3CoreFactoryAddress:"0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6",multicallAddress:"0x8260CB40247290317a4c062F3542622367F206Ee",quoterAddress:"0x1dd92b83591781D0C6d98d07391eea4b9a6008FA",v3MigratorAddress:"0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3",nonfungiblePositionManagerAddress:"0x622e4726a167799826d1E1D150b076A7725f5D81",tickLensAddress:"0xb52429333da969a0C79a60930a4Bf0020E5D1DE8"},WHe={v3CoreFactoryAddress:"0x248AB79Bbb9bC29bB72f7Cd42F17e054Fc40188e",multicallAddress:"0x2B718b475e385eD29F56775a66aAB1F5cC6B2A0A",quoterAddress:"0x2779a0CC1c3e0E44D2542EC3e79e3864Ae93Ef
74530B",v3MigratorAddress:"0x398f43ef2c67B941147157DA1c5a868E906E043D",nonfungiblePositionManagerAddress:"0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65",tickLensAddress:"0x0fd18587734e5C2dcE2dccDcC7DD1EC89ba557d9",swapRouter02Address:"0x101F443B4d1b059569D643917553c771E1b9663E",v4PoolManagerAddress:"0xFB3e0C6F74eB1a21CC1Da29aeC80D2Dfe6C9a317",v4PositionManagerAddress:"0xAc631556d3d4019C95769033B5E719dD77124BAc",v4StateView:"0x9d467fa9062b6e9b1a46e26007ad82db116c67cb",v4QuoterAddress:"0x7de51022d70a725b508085468052e25e22b5c4c9"},qHe={v3CoreFactoryAddress:"0x0227628f3F023bb0B980b67D528571c95c6DaC1c",multicallAddress:"0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07",quoterAddress:"0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3",v3MigratorAddress:"0x729004182cF005CEC8Bd85df140094b6aCbe8b15",nonfungiblePositionManagerAddress:"0x1238536071E1c677A632429e3655c799b22cDA52",tickLensAddress:"0xd7f33bcdb21b359c8ee6f0251d30e94832baad07",swapRouter02Address:"0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E",mixedRouteQuoterV2Address:"0x4745f77b56a0e2294426e3936dc4fab68d9543cd",v4PoolManagerAddress:"0xE03A1074c86CFeDd5C142C4F04F1a1536e203543",v4PositionManagerAddress:"0x429ba70129df741B2Ca2a85BC3A2a3328e5c09b4",v4StateView:"0xe1dd9c3fa50edb962e442f60dfbc432e24537e4c",v4QuoterAddress:"0x61b3f2011a92d183c7dbadbda940a7555ccf9227"},zHe={v3CoreFactoryAddress:"0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD",multicallAddress:"0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2",quoterAddress:"0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F",v3MigratorAddress:"0x44f5f1f5E452ea8d29C890E8F6e893fC0f1f0f97",nonfungiblePositionManagerAddress:"0x655C406EBFa14EE2006250925e54ec43AD184f8B",tickLensAddress:"0xEB9fFC8bf81b4fFd11fb6A63a6B0f098c6e21950",swapRouter02Address:"0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE",v4PoolManagerAddress:"0x06380c0e0912312b5150364b9dc4542ba0dbbc85",v4PositionManagerAddress:"0xb74b1f14d2754acfcbbe1a221023a5cf50ab8acd",v4StateView:"0xc3c9e198c735a4b97e3e683f391ccbdd60b69286",v4QuoterAddress:"0xbe40675bb704506a3c2ccfb762dcfd1e979845c2"},HHe={v3CoreFactoryAddress:"0x33128a8fC17869897dcE68Ed026d694621f6FDfD",multicallAddress:"0x091e99cb1C49331a94dD62755D168E941AbD0693",quoterAddress:"0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",v3MigratorAddress:"0x23cF10b1ee3AdfCA73B0eF17C07F7577e7ACd2d7",nonfungiblePositionManagerAddress:"0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",tickLensAddress:"0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d",swapRouter02Address:"0x2626664c2603336E57B271c5C0b26F421741e481",mixedRouteQuoterV1Address:"0xe544efae946f0008ae9a8d64493efa7886b73776",v4PoolManagerAddress:"0x498581ff718922c3f8e6a244956af099b2652b2b",v4PositionManagerAddress:"0x7c5f5a4bbd8fd63184577525326123b519429bdc",v4StateView:"0xa3c0c9b65bad0b08107aa264b0f3db444b867a71",v4QuoterAddress:"0x0d5e0f971ed27fbff6c2837bf31316121532048d"},GHe={v3CoreFactoryAddress:"0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2",multicallAddress:"0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439",quoterAddress:"0xedf539058e28E5937dAef3f69cEd0b25fbE66Ae9",v3MigratorAddress:"0x3efe5d02a04b7351D671Db7008ec6eBA9AD9e3aE",nonfungiblePositionManagerAddress:"0x3c61369ef0D1D2AFa70d8feC2F31C5D6Ce134F30",tickLensAddress:"0x1acB873Ee909D0c98adB18e4474943249F931b92",swapRouter02Address:"0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d"},KHe={v3CoreFactoryAddress:"0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",multicallAddress:"0xd867e273eAbD6c853fCd0Ca0bFB6a3aE6491d2C1",quoterAddress:"0xC5290058841028F1614F3A6F0F5816cAd0df5E27",v3MigratorAddress:"0xCbf8b7f80800bd4888Fbc7bf1713B80FE4E23E10",nonfungiblePositionManagerAddress:"0x27F971cb582BF9E50F397e4d29a5C7A34f11faA2",tickLensAddress:"0xedf6066a2b290C185783862C7F4776A2C8077AD1",swapRouter02Address:"0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4",v4PoolManagerAddress:"0x05E73354cFDd6745C338b50BcFDfA3Aa6fA03408",v4PositionManagerAddress:"0x4b2c77d209d3405f41a037ec6c77f7f5b8e2ca80",v4StateView:"0x571291b572ed32ce6751a2cb2486ebee8defb9b4",v4QuoterAddress:"0x4a6513c898fe1b2d0e78d3b0e0a4a151589b1cba"},YHe={v3CoreFactoryAddress:"0x7145F8aeef1f6510E92164038E1B6F8cB2c42Cbb",multicallAddress:"0xA51c76bEE6746cB487a7e9312E43e2b8f4A37C15",quoterAddress:"0x11867e1b3348F3ce4FcC170BC5af3d23E07E64Df",v3MigratorAddress:"0x048352d8dCF13686982C799da63fA6426a9D0b60",nonfungiblePositionManagerAddress:"0xbC91e8DfA3fF18De43853372A3d7dfe585137D78",tickLensAddress:"0x209AAda09D74Ad3B8D0E92910Eaf85D2357e3044",swapRouter02Address:"0x7De04c96BE5159c3b5CeffC82aa176dc81281557",v4PoolManagerAddress:"0x0575338e4c17006ae181b47900a84404247ca30f",v4PositionManagerAddress:"0xf66c7b99e2040f0d9b326b3b7c152e9663543d63",v4StateView:"0x385785af07d63b50d0a0ea57c4ff89d06adf7328",v4QuoterAddress:"0x5edaccc0660e0a2
7453c44b06e07ce8b915e625dc2c6"},ZHe={v3CoreFactoryAddress:"0x4324A677D74764f46f33ED447964252441aA8Db6",multicallAddress:"0xA1E7e3A69671C4494EC59Dbd442de930a93F911A",quoterAddress:"0xC195976fEF0985886E37036E2DF62bF371E12Df0",v3MigratorAddress:"0x65ef259b31bf1d977c37e9434658694267674897",nonfungiblePositionManagerAddress:"0xB8458EaAe43292e3c1F7994EFd016bd653d23c20",tickLensAddress:"0x23C0F71877a1Fc4e20A78018f9831365c85f3064"},QHe={v3CoreFactoryAddress:"0xaF37EC98A00FD63689CF3060BF3B6784E00caD82",multicallAddress:"0x996a9858cDfa45Ad68E47c9A30a7201E29c6a386",quoterAddress:"0xb51727c996C68E60F598A923a5006853cd2fEB31",v3MigratorAddress:"0x16678977CA4ec3DAD5efc7b15780295FE5f56162",nonfungiblePositionManagerAddress:"0x9d9386c042F194B460Ec424a1e57ACDE25f5C4b1",tickLensAddress:"0x55B9dF5bF68ADe972191a91980459f48ecA16afC",swapRouter02Address:"0x0B14ff67f0014046b4b99057Aec4509640b3947A"},XHe={v3CoreFactoryAddress:"0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd",multicallAddress:"0xdC7f370de7631cE9e2c2e1DCDA6B3B5744Cf4705",quoterAddress:"0x6Cdcd65e03c1CEc3730Aee
7453Cd45bc140D57A25C77",v3MigratorAddress:"0x15CA7043CD84C5D21Ae76Ba0A1A967d42c40ecE0",nonfungiblePositionManagerAddress:"0xB218e4f7cF0533d4696fDfC419A0023D33345F28",tickLensAddress:"0x2E95185bCdD928a3e984B7e2D6560Ab1b17d7274",swapRouter02Address:"0x549FEB8c9bd4c12Ad2AB27022dA12492aC452B66",v4PoolManagerAddress:"0x1631559198a9e474033433b2958dabc135ab6446",v4PositionManagerAddress:"0x4ad2f4cca2682cbb5b950d660dd458a1d3f1baad",v4StateView:"0x12a88ae16f46dce4e8b15368008ab3380885df30",v4QuoterAddress:"0x6f71cdcb0d119ff72c6eb501abceb576fbf62bcf"},JHe={v3CoreFactoryAddress:"0x8FdA5a7a8dCA67BBcDd10F02Fa0649A937215422",multicallAddress:"0x0c68a7C72f074d1c45C16d41fa74eEbC6D16a65C",quoterAddress:"0x8Cb537fc92E26d8EBBb760E632c95484b6Ea3e28",v3MigratorAddress:"0x611841b24E43C4ACfd290B427a3D6cf1A59dac8E",nonfungiblePositionManagerAddress:"0x0616e5762c1E7Dc3723c50663dF10a162D690a86",tickLensAddress:"0xe10FF11b809f8EE07b056B452c3B2caa7FE24f89",swapRouter02Address:"0x99c56385daBCE3E81d8499d0b8d0257aBC07E8A3"},eGe={v3CoreFactoryAddress:"0x7a5028BDa40e7B173C278C5342087826455ea25a",multicallAddress:"0x0a22c04215c97E3F532F4eF30e0aD9458792dAB9",quoterAddress:"0x10158D43e6cc414deE1Bd1eB0EfC6a5cBCfF244c",v3MigratorAddress:"0x9EBDdCBa71C9027E1eB45135672a30bcFEec9de3",nonfungiblePositionManagerAddress:"0xec12a9F9a09f50550686363766Cc153D03c27b5e",tickLensAddress:"0xE61df0CaC9d85876aCE5E3037005D80943570623",swapRouter02Address:"0x091AD9e2e6e5eD44c1c66dB50e49A601F9f36cF6",v4PoolManagerAddress:"0xb1860d529182ac3bc1f51fa2abd56662b7d13f33",v4PositionManagerAddress:"0xc585e0f504613b5fbf874f21af14c65260fb41fa",v4StateView:"0x51d394718bc09297262e368c1a481217fdeb71eb",v4QuoterAddress:"0x55d235b3ff2daf7c3ede0defc9521f1d6fe6c5c0"},tGe={v3CoreFactoryAddress:"0x1F98431c8aD98523631AE4a59f267346ea31F984",multicallAddress:"0x9D0F15f2cf58655fDDcD1EE6129C547fDaeD01b1",quoterAddress:"0x6Dd37329A1A225a6Fca658265D460423DCafBF89",v3MigratorAddress:"0xb5FA244C9d6D04B2FBac84418b3c4910ED1Ae5f2",nonfungiblePositionManagerAddress:"0xB7F724d6dDDFd008eFf5cc2834edDE5F9eF0d075",tickLensAddress:"0x5f739c790a48E97eec0efb81bab5D152c0A0ecA0",swapRouter02Address:"0xd1AAE39293221B77B0C71fBD6dCb7Ea29Bb5B166",v4PoolManagerAddress:"0x00b036b58a818b1bc34d502d3fe730db729e62ac",v4PositionManagerAddress:"0xf969aee60879c54baaed9f3ed26147db216fd664",v4StateView:"0xc199f1072a74d4e905aba1a84d9a45e2546b6222",v4QuoterAddress:"0x56dcd40a3f2d466f48e7f48bdbe5cc9b92ae4472"},nGe={v3CoreFactoryAddress:"0x1f98400000000000000000000000000000000003",multicallAddress:"0xb7610f9b733e7d45184be3a1bc966960ccc54f0b",quoterAddress:"0x565ac8c7863d9bb16d07e809ff49fe5cd467634c",v3MigratorAddress:"0xb9d0c246f306b1aaf02ae6ba112d5ef25e5b60dc",nonfungiblePositionManagerAddress:"0x943e6e07a7e8e791dafc44083e54041d743c46e9",tickLensAddress:"0xd5d76fa166ab8d8ad4c9f61aaa81457b66cbe443",swapRouter02Address:"0x73855d06de49d0fe4a9c42636ba96c62da12ff9c",v4PoolManagerAddress:"0x1f98400000000000000000000000000000000004",v4PositionManagerAddress:"0x4529a01c7a0410167c5740c487a8de60232617bf",v4StateView:"0x86e8631a016f9068c3f085faf484ee3f5fdee8f2",v4QuoterAddress:"0x333e3c607b141b18ff6de9f258db6e77fe7491e0"},iGe={v3CoreFactoryAddress:"0x961235a9020b05c44df1026d956d1f4d78014276",multicallAddress:"0xa707ceb989cc3728551ed0e6e44b718dd114cf44",quoterAddress:"0x1ba215c17565de7b0cb7ecab971bcf540c24a862",v3MigratorAddress:"0x0a78348b71f8ae8caff2f8f9d4d74a2f36516661",nonfungiblePositionManagerAddress:"0x3dcc735c74f10fe2b9db2bb55c40fbbbf24490f7",tickLensAddress:"0x337478eb6058455ecb3696184b30dd6a29e3a893",swapRouter02Address:"0x4c4eabd5fb1d1a7234a48692551eaecff8194ca7"},sGe={v3CoreFactoryAddress:"0x204faca1764b154221e35c0d20abb3c525710498",multicallAddress:"0xd1b797d92d87b688193a2b976efc8d577d204343",quoterAddress:"0x2d01411773c8c24805306e89a41f7855c3c4fe65",v3MigratorAddress:"0x7078c4537c04c2b2e52ddba06074dbdacf23ca15",nonfungiblePositionManagerAddress:"0x7197e214c0b767cfb76fb734ab638e2c192f4e53",tickLensAddress:"0xf025e0fe9e331a0ef05c2ad3c4e9c64b625cda6f",swapRouter02Address:"0xfe31f71c1b106eac32f1a19239c9a9a72ddfb900",v4PoolManagerAddress:"0x188d586ddcf52439676ca21a244753fa19f9ea8e",v4PositionManagerAddress:"0x5b7ec4a94ff9bedb700fb82ab09d5846972f4016",v4StateView:"0x77395f3b2e73ae90843717371294fa97cc419d64",v4QuoterAddress:"0xa222dd357a9076d1091ed6aa2e16c9742dd26891"},rGe={v3CoreFactoryAddress:"0x42ae7ec7ff020412639d443e245d936429fbe717",multicallAddress:"0x8ad5ef2f2508288d2de66f04dd883ad5f4ef62b2",quoterAddress:"0x3e6c707d0125226ff60f291b6bd1404634f00aba",v3MigratorAddress:"0xa107580f73bd797bd8b87ff24e98346d99f93ddb",nonfungiblePositionManagerAddress:"0x56c1205b0244332011c1e866f4ea5384eb6bfa2c",tickLensAddress:"0xcd08eefb928c86499e6235ac155906bb7c4dc41a",swapR
7453outer02Address:"0x7e40db01736f88464e5f4e42394f3d5bbb6705b9",v4PoolManagerAddress:"0x360e68faccca8ca495c1b759fd9eee466db9fb32",v4PositionManagerAddress:"0x1b35d13a2e2528f192637f14b05f0dc0e7deb566",v4StateView:"0x76fd297e2d437cd7f76d50f01afe6160f86e9990",v4QuoterAddress:"0x3972c00f7ed4885e145823eb7c655375d275a1c5"},oGe={v3CoreFactoryAddress:"0x4b2ab38dbf28d31d467aa8993f6c2585981d6804",multicallAddress:"0xe2023f3fa515cf070e07fd9d51c1d236e07843f4",quoterAddress:"0x976183ac3d09840d243a88c0268badb3b3e3259f",v3MigratorAddress:"0x7197e214c0b767cfb76fb734ab638e2c192f4e53",nonfungiblePositionManagerAddress:"0x315e413a11ab0df498ef83873012430ca36638ae",tickLensAddress:"0x661e93cca42afacb172121ef892830ca3b70f08d",swapRouter02Address:"0x4f0c28f5926afda16bf2506d5d9e57ea190f9bca",mixedRouteQuoterV2Address:"0x2d01411773c8c24805306e89a41f7855c3c4fe65",v4PoolManagerAddress:"0x360e68faccca8ca495c1b759fd9eee466db9fb32",v4PositionManagerAddress:"0xbc9f3a5d767dd46e040f1ca48ab17f29f59dc806",v4StateView:"0x76fd297e2d437cd7f76d50f01afe6160f86e9990",v4QuoterAddress:"0x8928074ca1b241d8ec02815881c1af11e8bc5219"};Ri={},Ri[et.MAINNET]=MHe,Ri[et.OPTIMISM]=$He,Ri[et.ARBITRUM_ONE]=UHe,Ri[et.POLYGON]=XG,Ri[et.POLYGON_MUMBAI]=XG,Ri[et.GOERLI]=LHe,Ri[et.CELO]=JG,Ri[et.CELO_ALFAJORES]=JG,Ri[et.BNB]=BHe,Ri[et.OPTIMISM_GOERLI]=FHe,Ri[et.OPTIMISM_SEPOLIA]=jHe,Ri[et.ARBITRUM_GOERLI]=VHe,Ri[et.ARBITRUM_SEPOLIA]=WHe,Ri[et.SEPOLIA]=qHe,Ri[et.AVALANCHE]=zHe,Ri[et.BASE]=HHe,Ri[et.BASE_GOERLI]=GHe,Ri[et.BASE_SEPOLIA]=KHe,Ri[et.ZORA]=YHe,Ri[et.ZORA_SEPOLIA]=ZHe,Ri[et.ROOTSTOCK]=QHe,Ri[et.BLAST]=XHe,Ri[et.ZKSYNC]=JHe,Ri[et.WORLDCHAIN]=eGe,Ri[et.UNICHAIN_SEPOLIA]=tGe,Ri[et.UNICHAIN]=nGe,Ri[et.MONAD_TESTNET]=iGe,Ri[et.SONEIUM]=rGe,Ri[et.MONAD]=sGe,Ri[et.XLAYER]=oGe;zk={},zk[et.MAINNET]="0xC4e172459f1E7939D522503B81AFAaC1014CE6F6";Hk={},Hk[et.MAINNET]="0x408ED6354d4973f66138C91495F2f2FCbd8724C3";Gk={},Gk[et.MAINNET]="0x090D4613473dEE047c3f2706764f49E0821D256e";Kk={},Kk[et.MAINNET]="0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8";Yk={},Yk[et.MAINNET]="0x65770b5283117639760beA3F867b69b3697a91dd";var eK;(function(t){t[t.EXACT_INPUT=0]="EXACT_INPUT",t[t.EXACT_OUTPUT=1]="EXACT_OUTPUT"})(eK||(eK={}));var Nl;(function(t){t[t.ROUND_DOWN=0]="ROUND_DOWN",t[t.ROUND_HALF_UP=1]="ROUND_HALF_UP",t[t.ROUND_UP=2]="ROUND_UP"})(Nl||(Nl={}));var a1=X.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),zv,Hv,x3=oL(Gze),Zk=oL(Zre),aGe=(zv={},zv[Nl.ROUND_DOWN]=x3.ROUND_DOWN,zv[Nl.ROUND_HALF_UP]=x3.ROUND_HALF_UP,zv[Nl.ROUND_UP]=x3.ROUND_UP,zv),cGe=(Hv={},Hv[Nl.ROUND_DOWN]=0,Hv[Nl.ROUND_HALF_UP]=1,Hv[Nl.ROUND_UP]=3,Hv),K5=(function(){function t(n,i){i===void 0&&(i=X.BigInt(1)),this.numerator=X.BigInt(n),this.denominator=X.BigInt(i)}t.tryParseFraction=function(i){if(i instanceof X||typeof i=="number"||typeof i=="string")return new t(i);if("numerator"in i&&"denominator"in i)return i;throw new Error("Could not parse fraction")};var e=t.prototype;return e.invert=function(){return new t(this.denominator,this.numerator)},e.add=function(i){var s=t.tryParseFraction(i);return X.equal(this.denominator,s.denominator)?new t(X.add(this.numerator,s.numerator),this.denominator):new t(X.add(X.multiply(this.numerator,s.denominator),X.multiply(s.numerator,this.denominator)),X.multiply(this.denominator,s.denominator))},e.subtract=function(i){var s=t.tryParseFraction(i);return X.equal(this.denominator,s.denominator)?new t(X.subtract(this.numerator,s.numerator),this.denominator):new t(X.subtract(X.multiply(this.numerator,s.denominator),X.multiply(s.numerator,this.denominator)),X.multiply(this.denominator,s.denominator))},e.lessThan=function(i){var s=t.tryParseFraction(i);return X.lessThan(X.multiply(this.numerator,s.denominator),X.multiply(s.numerator,this.denominator))},e.equalTo=function(i){var s=t.tryParseFraction(i);return X.equal(X.multiply(this.numerator,s.denominator),X.multiply(s.numerator,this.denominator))},e.greaterThan=function(i){var s=t.tryParseFraction(i);return X.greaterThan(X.multiply(this.numerator,s.denominator),X.multiply(s.numerator,this.denominator))},e.multiply=function(i){var s=t.tryParseFraction(i);return new t(X.multiply(this.numerator,s.numerator),X.multiply(this.denominator,s.denominator))},e.divide=function(i){var s=t.tryParseFraction(i);return new t(X.multiply(this.numerator,s.denominator),X.multiply(this.denominator,s.numerator))},e.toSignificant=function(i,s,r){s===void 0&&(s={groupSeparator:""}),r===void 0&&(r=Nl.ROUND_HALF_UP),Number.isInteger(i)||pn(),i>0||pn(),x3.set({precision:i+1,rounding:aGe[r]});var o=new x3(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(i);return o.toFormat(o.decimalPlaces(),s)},e.toFixed=function(i,s,r){return s===void 0&&(s={groupSeparator:""}),r===void 0&&(r=Nl.ROUND_HALF_UP),Number.isInteger(i)||pn(),i>=0||pn(),Zk.DP=i,Zk.RM=cGe[r],new Zk(this.numerator.toString()).div(this.denominator.toString()).toFormat(i,s)},m4(t,[{key:"quotient",get:function(){return X.divide(this.numerator,this.denominator)}},{key:"remainder",get:function(){return new t(X.remainder(this.numerator,this.denominator),this.denominator)}},{key:"asFraction",get:function(){return new t(this.numerator,this.denominator)}}])})(),tK=oL(Zre),vu=(function(t){function e(i,s,r){var o;return o=t.call(this,s,r)||this,X.lessThanOrEqual(o.quotient,a1)||pn(),o.currency=i,o.decimalScale=X.exponentiate(X.BigInt(10),X.BigInt(i.decimals)),o}nw(e,t),e.fromRawAmount=function(s,r){return new e(s,r)},e.fromFractionalAmount=function(s,r,o){return new e(s,r,o)};var n=e.prototype;return n.add=function(s){this.currency.equals(s.currency)||pn();var r=t.prototype.add.call(this,s);return e.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.subtract=function(s){this.currency.equals(s.currency)||pn();var r=t.prototype.subtract.call(this,s);return e.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.multiply=function(s){var r=t.prototype.multiply.call(this,s);return e.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.divide=function(s){var r=t.prototype.divide.call(this,s);return e.fromFractionalAmount(this.currency,r.numerator,r.denominator)},n.toSignificant=function(s,r,o){return s===void 0&&(s=6),o===void 0&&(o=Nl.ROUND_DOWN),t.prototype.divide.call(this,this.decimalScale).toSignificant(s,r,o)},n.toFixed=function(s,r,o){return s===void 0&&(s=this.currency.decimals),o===void 0&&(o=Nl.ROUND_DOWN),s<=this.currency.decimals||pn(),t.prototype.divide.call(this,this.decimalScale).toFixed(s,r,o)},n.toExact=function(s){return s===void 0&&(s={groupSeparator:""}),tK.DP=this.currency.decimals,new tK(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(s)},m4(e,[{key:"wrapped",get:function(){return this.currency.isToken?this:e.fromFractionalAmount(this.currency.wrapped,this.numerator,this.denominator)}}])})(K5),nK=new K5(X.BigInt(100));
7453function Px(t){return new eoe(t.numerator,t.denominator)}var eoe=(function(t){function e(){var i;return i=t.apply(this,arguments)||this,i.isPercent=!0,i}nw(e,t);var n=e.prototype;return n.add=function(s){return Px(t.prototype.add.call(this,s))},n.subtract=function(s){return Px(t.prototype.subtract.call(this,s))},n.multiply=function(s){return Px(t.prototype.multiply.call(this,s))},n.divide=function(s){return Px(t.prototype.divide.call(this,s))},n.toSignificant=function(s,r,o){return s===void 0&&(s=5),t.prototype.multiply.call(this,nK).toSignificant(s,r,o)},n.toFixed=function(s,r,o){return s===void 0&&(s=2),t.prototype.multiply.call(this,nK).toFixed(s,r,o)},e})(K5),Y5=(function(t){function e(){for(var i,s,r,o,a,c=arguments.length,l=new Array(c),d=0;d<c;d++)l[d]=arguments[d];if(l.length===4)s=l[0],r=l[1],o=l[2],a=l[3];else{var h=l[0].quoteAmount.divide(l[0].baseAmount),p=[l[0].baseAmount.currency,l[0].quoteAmount.currency,h.denominator,h.numerator];s=p[0],r=p[1],o=p[2],a=p[3]}return i=t.call(this,a,o)||this,i.baseCurrency=s,i.quoteCurrency=r,i.scalar=new K5(X.exponentiate(X.BigInt(10),X.BigInt(s.decimals)),X.exponentiate(X.BigInt(10),X.BigInt(r.decimals))),i}nw(e,t);var n=e.prototype;return n.invert=function(){return new e(this.quoteCurrency,this.baseCurrency,this.numerator,this.denominator)},n.multiply=function(s){this.quoteCurrency.equals(s.baseCurrency)||pn();var r=t.prototype.multiply.call(this,s);return new e(this.baseCurrency,s.quoteCurrency,r.denominator,r.numerator)},n.quote=function(s){s.currency.equals(this.baseCurrency)||pn();var r=t.prototype.multiply.call(this,s);return vu.fromFractionalAmount(this.quoteCurrency,r.numerator,r.denominator)},n.toSignificant=function(s,r,o){return s===void 0&&(s=6),this.adjustedForDecimals.toSignificant(s,r,o)},n.toFixed=function(s,r,o){return s===void 0&&(s=4),this.adjustedForDecimals.toFixed(s,r,o)},m4(e,[{key:"adjustedForDecimals",get:function(){return t.prototype.multiply.call(this,this.scalar)}}])})(K5),toe=(function(e,n,i,s){Number.isSafeInteger(e)||pn(),n>=0&&n<255&&Number.isInteger(n)||pn(),this.chainId=e,this.decimals=n,this.symbol=i,this.name=s}),lGe=(function(t){function e(){var n;return n=t.apply(this,arguments)||this,n.isNative=!0,n.isToken=!1,n}return nw(e,t),e})(toe);function uGe(t){try{return vb(t)}catch{throw new Error(t+" is not a valid address.")}}var dGe=/^0x[0-9a-fA-F]{40}$/;function hGe(t){if(dGe.test(t))return t;throw new Error(t+" is not a valid address.")}var on=(function(t){function e(i,s,r,o,a,c,l,d){var h;return h=t.call(this,i,r,o,a)||this,h.isNative=!1,h.isToken=!0,c?h.address=hGe(s):h.address=uGe(s),l&&(l.gte(Os.from(0))||pn()),d&&(d.gte(Os.from(0))||pn()),h.buyFeeBps=l,h.sellFeeBps=d,h}nw(e,t);var n=e.prototype;return n.equals=function(s){return s.isToken&&this.chainId===s.chainId&&this.address.toLowerCase()===s.address.toLowerCase()},n.sortsBefore=function(s){return this.chainId!==s.chainId&&pn(),this.address.toLowerCase()===s.address.toLowerCase()&&pn(),this.address.toLowerCase()<s.address.toLowerCase()},m4(e,[{key:"wrapped",get:function(){return this}}])})(toe),fGe={1:new on(1,"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",18,"WETH","Wrapped Ether"),11155111:new on(11155111,"0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",18,"WETH","Wrapped Ether"),3:new on(3,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),4:new on(4,"0xc778417E063141139Fce010982780140Aa0cD5Ab",18,"WETH","Wrapped Ether"),5:new on(5,"0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",18,"WETH","Wrapped Ether"),42:new on(42,"0xd0A1E359811322d97991E03f863a0C30C2cF029C",18,"WETH","Wrapped Ether"),10:new on(10,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),69:new on(69,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),11155420:new on(11155420,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),42161:new on(42161,"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",18,"WETH","Wrapped Ether"),421611:new on(421611,"0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681",18,"WETH","Wrapped Ether"),421614:new on(421614,"0x980B62Da83eFf3D4576C647993b0c1D7faf17c73",18,"WETH","Wrapped Ether"),8453:new on(8453,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),84532:new on(84532,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),56:new on(56,"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",18,"WBNB","Wrapped BNB"),137:new on(137,"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",18,"WMATIC","Wrapped MATIC"),43114:new on(43114,"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",18,"WAVAX","Wrapped AVAX"),7777777:new on(7777777,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),81457:new on(81457,"0x4300000000000000000000000000000000000004",18,"WETH","Wrapped Ether"),324:new on(324,"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91",18,"WETH","Wrapped Ether"),480:new on(480,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),1301:new on(1301,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),130:new on(130,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),10143:new on(10143,"0x760AfE86e5de5fa0Ee542fc7B7B713e1c5425701",18,"WMON","Wrapped Monad"),1868:new on(1868,"0x4200000000000000000000000000000000000006",18,"WETH","Wrapped Ether"),143:new on(143,"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A",18,"WMON","Wrapped Monad")},pGe=(function(t){function e(i){return t.call(this,i,18,"ETH","Ether")||this}nw(e,t),e.onChain=function(s){var r;return(r=this._etherCache[s])!=null?r:this._etherCache[s]=new e(s)};var n=e.prototype;return n.equals=function(s){return s.isNative&&s.chainId===this.chainId},m4(e,[{key:"wrapped",get:function(){var s=fGe[this.chainId];return s||pn(),s}}])})(lGe);pGe._etherCache={};function mGe(t,e,n,i){i===void 0&&(i="0x");var s=qk(NHe("zksyncCreate2")),r=qk(i),o=qk(bg([s,Xre(t,32),n,e,r])).slice(26);return vb(o)}var gGe=X.BigInt(Number.MAX_SAFE_INTEGER),yGe=X.BigInt(0),bGe=X.BigInt(1),iK=X.BigInt(2);function wGe(t){if(X.greaterThanOrEqual(t,yGe)||pn(),X.lessThan(t,gGe))return X.BigInt(Math.floor(Math.sqrt(X.toNumber(t))));var e,n;for(e=t,n=X.add(X.divide(t,iK),bGe);X.lessThan(n,e);)e=n,n=X.divide(X.add(X.divide(t,n),n),iK);return e}function Xm(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}const US="abi/5.8.0",Z5=new Fn(US),sK={};let rK={calldata:!0,memory:!0,storage:!0},vGe={calldata:!0,memory:!0};function Ix(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")&&vGe[e])return!0;return(rK[e]||e==="payable")&&Z5.throwArgumentError("invalid modifier","name",e),!1}function CGe(t,e){let n=t;function i(a){Z5.throwArgumentError(`unexpected character at position ${a}`,"param",t)}t=t.replace(/\s/g," ");function s(a){let c={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(c.indexed=!1),c}let r={type:"",name:"",state:{allowType:!0}},o=r;for(let a=0;a<t.length;a++){let c=t[a];switch(c){case"(":o.state.allowType&&o.type===""?o.type="tuple":o.state.allowParams||i(a),o.state.allowType=!1,o.type=Hy(o.type),o.components=[s(o)],o=o.components[0];break;case")":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),Ix(o.type,o.name)&&(o.name=""),o.type=Hy(o.type);let l=o;o=o.parent,o||i(a),delete l.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),Ix(o.type,o.name)&&(o.name=""),o.type=Hy(o.type);let d=s(o.parent);o.parent.components.push(d),delete o.parent,o=d;break;case" ":o.state.allowType&&o.type!==""&&(o.type=Hy(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&o.name!==""&&(o.name==="indexed"?(e||i(a),o.indexed&&i(a),o.indexed=!0,o.name=""):Ix(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||i(a),o.type+=c,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||i(a),o.type+=c,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=c,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=c,delete o.state.allowArray):o.state.readArray?o.type+=c:i(a)}}return o.parent&&Z5.throwArgumentError("unexpected eof","param",t),delete r.state,o.name==="indexed"?(e||i(n.length-7),o.indexed&&i(n.length-7),o.indexed=!0,o.name=""):Ix(o.type,o.name)&&(o.name=""),r.type=Hy(r.type),r}function Qk(t,e){for(let n in e)Xm(t,n,e[n])}const xm=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),xGe=new RegExp(/^(.*)\[([0-9]*)\]$/);class gu{constructor(e,n){e!==sK&&Z5.throwError("use fromString",Fn.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Qk(this,n);let i=this.type.match(xGe);i?Qk(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:gu.fromObject({type:i[1],components:this.components}),baseType:"array"}):Qk(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.t
7453ype}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=xm.sighash),xm[e]||Z5.throwArgumentError("invalid format type","format",e),e===xm.json){let i={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.components&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let n="";return this.baseType==="array"?(n+=this.arrayChildren.format(e),n+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==xm.sighash&&(n+=this.type),n+="("+this.components.map(i=>i.format(e)).join(e===xm.full?", ":",")+")"):n+=this.type,e!==xm.sighash&&(this.indexed===!0&&(n+=" indexed"),e===xm.full&&this.name&&(n+=" "+this.name)),n}static from(e,n){return typeof e=="string"?gu.fromString(e,n):gu.fromObject(e)}static fromObject(e){return gu.isParamType(e)?e:new gu(sK,{name:e.name||null,type:Hy(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(gu.fromObject):null})}static fromString(e,n){function i(s){return gu.fromObject({name:s.name,type:s.type,indexed:s.indexed,components:s.components})}return i(CGe(e,!!n))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function Hy(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const uL=new Fn(US);class Bf{constructor(e,n,i,s){this.name=e,this.type=n,this.localName=i,this.dynamic=s}_throwError(e,n){uL.throwArgumentError(e,this.localName,n)}}class UI{constructor(e){Xm(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return fHe(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(bg(e._data))}writeBytes(e){let n=Ur(e);const i=n.length%this.wordSize;return i&&(n=bg([n,this._padding.slice(i)])),this._writeData(n)}_getValue(e){let n=Ur(Os.from(e));return n.length>this.wordSize&&uL.throwError("value out-of-bounds",Fn.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:n.length}),n.length%this.wordSize&&(n=bg([this._padding.slice(n.length%this.wordSize),n])),n}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,n=>{this._data[e]=this._getValue(n)}}}class l8{constructor(e,n,i,s){Xm(this,"_data",Ur(e)),Xm(this,"wordSize",n||32),Xm(this,"_coerceFunc",i),Xm(this,"allowLoose",s),this._offset=0}get data(){return Uf(this._data)}get consumed(){return this._offset}static coerce(e,n){let i=e.match("^u?int([0-9]+)$");return i&&parseInt(i[1])<=48&&(n=n.toNumber()),n}coerce(e,n){return this._coerceFunc?this._coerceFunc(e,n):l8.coerce(e,n)}_peekBytes(e,n,i){let s=Math.ceil(n/this.wordSize)*this.wordSize;return this._offset+s>this._data.length&&(this.allowLoose&&i&&this._offset+n<=this._data.length?s=n:uL.throwError("data out-of-bounds",Fn.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+s})),this._data.slice(this._offset,this._offset+s)}subReader(e){return new l8(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,n){let i=this._peekBytes(0,e,!!n);return this._offset+=i.length,i.slice(0,e)}readValue(){return Os.from(this.readBytes(this.wordSize))}}class EGe extends Bf{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){try{n=vb(n)}catch(i){this._throwError(i.message,n)}return e.writeValue(n)}decode(e){return vb(Xre(e.readValue().toHexString(),20))}}class _Ge extends Bf{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,n){return this.coder.encode(e,n)}decode(e){return this.coder.decode(e)}}const u2=new Fn(US);function noe(t,e,n){let i=null;if(Array.isArray(n))i=n;else if(n&&typeof n=="object"){let c={};i=e.map(l=>{const d=l.localName;return d||u2.throwError("cannot encode object for signature with missing names",Fn.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:n}),c[d]&&u2.throwError("cannot encode object for signature with duplicate names",Fn.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:n}),c[d]=!0,n[d]})}else u2.throwArgumentError("invalid tuple value","tuple",n);e.length!==i.length&&u2.throwArgumentError("types/value length mismatch","tuple",n);let s=new UI(t.wordSize),r=new UI(t.wordSize),o=[];e.forEach((c,l)=>{let d=i[l];if(c.dynamic){let h=r.length;c.encode(r,d);let p=s.writeUpdatableValue();o.push(g=>{p(g+h)})}else c.encode(s,d)}),o.forEach(c=>{c(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(r),a}function ioe(t,e){let n=[],i=t.subReader(0);e.forEach(r=>{let o=null;if(r.dynamic){let a=t.readValue(),c=i.subReader(a.toNumber());try{o=r.decode(c)}catch(l){if(l.code===Fn.errors.BUFFER_OVERRUN)throw l;o=l,o.baseType=r.name,o.name=r.localName,o.type=r.type}}else try{o=r.decode(t)}catch(a){if(a.code===Fn.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=r.name,o.name=r.localName,o.type=r.type}o!=null&&n.push(o)});const s=e.reduce((r,o)=>{const a=o.localName;return a&&(r[a]||(r[a]=0),r[a]++),r},{});e.forEach((r,o)=>{let a=r.localName;
7453if(!a||s[a]!==1||(a==="length"&&(a="_length"),n[a]!=null))return;const c=n[o];c instanceof Error?Object.defineProperty(n,a,{enumerable:!0,get:()=>{throw c}}):n[a]=c});for(let r=0;r<n.length;r++){const o=n[r];o instanceof Error&&Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}})}return Object.freeze(n)}class SGe extends Bf{constructor(e,n,i){const s=e.type+"["+(n>=0?n:"")+"]",r=n===-1||e.dynamic;super("array",s,i,r),this.coder=e,this.length=n}defaultValue(){const e=this.coder.defaultValue(),n=[];for(let i=0;i<this.length;i++)n.push(e);return n}encode(e,n){Array.isArray(n)||this._throwError("expected array value",n);let i=this.length;i===-1&&(i=n.length,e.writeValue(n.length)),u2.checkArgumentCount(n.length,i,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let r=0;r<n.length;r++)s.push(this.coder);return noe(e,s,n)}decode(e){let n=this.length;n===-1&&(n=e.readValue().toNumber(),n*32>e._data.length&&u2.throwError("insufficient data length",Fn.errors.BUFFER_OVERRUN,{length:e._data.length,count:n}));let i=[];for(let s=0;s<n;s++)i.push(new _Ge(this.coder));return e.coerce(this.name,ioe(e,i))}}class AGe extends Bf{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){return e.writeValue(n?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class soe extends Bf{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=Ur(n);let i=e.writeValue(n.length);return i+=e.writeBytes(n),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class TGe extends soe{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,Uf(super.decode(e)))}}class kGe extends Bf{constructor(e,n){let i="bytes"+String(e);super(i,i,n,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,n){let i=Ur(n);return i.length!==this.size&&this._throwError("incorrect data length",n),e.writeBytes(i)}decode(e){return e.coerce(this.name,Uf(e.readBytes(this.size)))}}class NGe extends Bf{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}class RGe extends Bf{constructor(e,n,i){const s=(n?"int":"uint")+e*8;super(s,s,i,!1),this.size=e,this.signed=n}defaultValue(){return 0}encode(e,n){let i=Os.from(n),s=AHe.mask(e.wordSize*8);if(this.signed){let r=s.mask(this.size*8-1);(i.gt(r)||i.lt(r.add(SHe).mul(EHe)))&&this._throwError("value out-of-bounds",n)}else(i.lt(_He)||i.gt(s.mask(this.size*8)))&&this._throwError("value out-of-bounds",n);return i=i.toTwos(this.size*8).mask(this.size*8),this.signed&&(i=i.fromTwos(this.size*8).toTwos(8*e.wordSize)),e.writeValue(i)}decode(e){let n=e.readValue().mask(this.size*8);return this.signed&&(n=n.fromTwos(this.size*8)),e.coerce(this.name,n)}}const PGe="strings/5.8.0",roe=new Fn(PGe);var u8;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(u8||(u8={}));var Pc;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Pc||(Pc={}));function IGe(t,e,n,i,s){return roe.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function ooe(t,e,n,i,s){if(t===Pc.BAD_PREFIX||t===Pc.UNEXPECTED_CONTINUE){let r=0;for(let o=e+1;o<n.length&&n[o]>>6===2;o++)r++;return r}return t===Pc.OVERRUN?n.length-e-1:0}function DGe(t,e,n,i,s){return t===Pc.OVERLONG?(i.push(s),0):(i.push(65533),ooe(t,e,n))}const OGe=Object.freeze({error:IGe,ignore:ooe,replace:DGe});function MGe(t,e){e==null&&(e=OGe.error),t=Ur(t);const n=[];let i=0;for(;i<t.length;){const s=t[i++];if(s>>7===0){n.push(s);continue}let r=null,o=null;if((s&224)===192)r=1,o=127;else if((s&240)===224)r=2,o=2047;else if((s&248)===240)r=3,o=65535;else{(s&192)===128?i+=e(Pc.UNEXPECTED_CONTINUE,i-1,t,n):i+=e(Pc.BAD_PREFIX,i-1,t,n);continue}if(i-1+r>=t.length){i+=e(Pc.OVERRUN,i-1,t,n);continue}let a=s&(1<<8-r-1)-1;for(let c=0;c<r;c++){let l=t[i];if((l&192)!=128){i+=e(Pc.MISSING_CONTINUE,i,t,n),a=null;break}a=a<<6|l&63,i++}if(a!==null){if(a>1114111){i+=e(Pc.OUT_OF_RANGE,i-1-r,t,n,a);continue}if(a>=55296&&a<=57343){i+=e(Pc.UTF16_SURROGATE,i-1-r,t,n,a);continue}if(a<=o){i+=e(Pc.OVERLONG,i-1-r,t,n,a);continue}n.push(a)}}return n}function aoe(t,e=u8.current){e!=u8.current&&(roe.checkNormalize(),t=t.normalize(e));let n=[];for(let i=0;i<t.length;i++){const s=t.charCodeAt(i);if(s<128)n.push(s);else if(s<2048)n.push(s>>6|192),n.push(s&63|128);else if((s&64512)==55296){i++;const r=t.charCodeAt(i);if(i>=t.length||(r&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((s&1023)<<10)+(r&1023);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128)}else n.push(s>>12|224),n.push(s>>6&63|128),n.push(s&63|128)}return Ur(n)}function LGe(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function $Ge(t,e){return LGe(MGe(t,e))}class UGe extends soe{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,aoe(n))}decode(e){return $Ge(super.decode(e))}}class Dx extends Bf{constructor(e,n){let i=!1;const s=[];e.forEach(o=>{o.dynamic&&(i=!0),s.push(o.type)});const r="tuple("+s.join(",")+")";super("tuple",r,n,i),this.coders=e}defaultValue(){const e=[];
7453this.coders.forEach(i=>{e.push(i.defaultValue())});const n=this.coders.reduce((i,s)=>{const r=s.localName;return r&&(i[r]||(i[r]=0),i[r]++),i},{});return this.coders.forEach((i,s)=>{let r=i.localName;!r||n[r]!==1||(r==="length"&&(r="_length"),e[r]==null&&(e[r]=e[s]))}),Object.freeze(e)}encode(e,n){return noe(e,this.coders,n)}decode(e){return e.coerce(this.name,ioe(e,this.coders))}}const Ox=new Fn(US),BGe=new RegExp(/^bytes([0-9]*)$/),FGe=new RegExp(/^(u?int)([0-9]*)$/);class jGe{constructor(e){Xm(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new EGe(e.name);case"bool":return new AGe(e.name);case"string":return new UGe(e.name);case"bytes":return new TGe(e.name);case"array":return new SGe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Dx((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new NGe(e.name)}let n=e.type.match(FGe);if(n){let i=parseInt(n[2]||"256");return(i===0||i>256||i%8!==0)&&Ox.throwArgumentError("invalid "+n[1]+" bit length","param",e),new RGe(i/8,n[1]==="int",e.name)}if(n=e.type.match(BGe),n){let i=parseInt(n[1]);return(i===0||i>32)&&Ox.throwArgumentError("invalid bytes length","param",e),new kGe(i,e.name)}return Ox.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,n){return new l8(e,this._getWordSize(),this.coerceFunc,n)}_getWriter(){return new UI(this._getWordSize())}getDefaultValue(e){const n=e.map(s=>this._getCoder(gu.from(s)));return new Dx(n,"_").defaultValue()}encode(e,n){e.length!==n.length&&Ox.throwError("types/values length mismatch",Fn.errors.INVALID_ARGUMENT,{count:{types:e.length,values:n.length},value:{types:e,values:n}});const i=e.map(o=>this._getCoder(gu.from(o))),s=new Dx(i,"_"),r=this._getWriter();return s.encode(r,n),r.data}decode(e,n,i){const s=e.map(o=>this._getCoder(gu.from(o)));return new Dx(s,"_").decode(this._getReader(Ur(n),i))}}const VGe=new jGe,WGe="solidity/5.8.0",qGe=new RegExp("^bytes([0-9]+)$"),zGe=new RegExp("^(u?int)([0-9]*)$"),HGe=new RegExp("^(.*)\\[([0-9]*)\\]$"),GGe="0000000000000000000000000000000000000000000000000000000000000000",Gy=new Fn(WGe);function coe(t,e,n){switch(t){case"address":return n?Fk(e,32):Ur(e);case"string":return aoe(e);case"bytes":return Ur(e);case"bool":return e=e?"0x01":"0x00",n?Fk(e,32):Ur(e)}let i=t.match(zGe);if(i){let s=parseInt(i[2]||"256");return(i[2]&&String(s)!==i[2]||s%8!==0||s===0||s>256)&&Gy.throwArgumentError("invalid number type","type",t),n&&(s=256),e=Os.from(e).toTwos(s),Fk(e,s/8)}if(i=t.match(qGe),i){const s=parseInt(i[1]);return(String(s)!==i[1]||s===0||s>32)&&Gy.throwArgumentError("invalid bytes type","type",t),Ur(e).byteLength!==s&&Gy.throwArgumentError(`invalid value for ${t}`,"value",e),n?Ur((e+GGe).substring(0,66)):e}if(i=t.match(HGe),i&&Array.isArray(e)){const s=i[1];parseInt(i[2]||String(e.length))!=e.length&&Gy.throwArgumentError(`invalid array length for ${t}`,"value",e);const o=[];return e.forEach(function(a){o.push(coe(s,a,!0))}),bg(o)}return Gy.throwArgumentError("invalid type","type",t)}function KGe(t,e){t.length!=e.length&&Gy.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const n=[];return t.forEach(function(i,s){n.push(coe(i,e[s]))}),Uf(bg(n))}function YGe(t,e){return cL(KGe(t,e))}function oK(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function aK(t,e,n,i,s,r,o){try{var a=t[r](o),c=a.value}catch(l){return void n(l)}a.done?e(c):Promise.resolve(c).then(i,s)}function fp(t){return function(){var e=this,n=arguments;return new Promise(function(i,s){var r=t.apply(e,n);function o(c){aK(r,i,s,o,a,"next",c)}function a(c){aK(r,i,s,o,a,"throw",c)}o(void 0)})}}function ZGe(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,JGe(i.key),i)}}function loe(t,e,n){return e&&ZGe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function QGe(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=eKe(t))||e){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 7454In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BI(){return BI=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},BI.apply(null,arguments)}function Co(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n=typeof Symbol=="function"?Symbol:{},i=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function r(g,b,w,C){var E=b&&b.prototype instanceof a?b:a,T=Object.create(E.prototype);return Tc(T,"_invoke",(function(A,k,R){var P,B,F,z=0,K=R||[],q=!1,G={p:0,n:0,v:t,a:I,f:I.bind(t,4),d:function(S,v){return P=S,B=0,F=t,G.n=v,o}};function I(S,v){for(B=S,F=v,e=0;!q&&z&&!_&&e<K.length;e++){var _,N=K[e],$=G.p,U=N[2];S>3?(_=U===v)&&(F=N[(B=N[4])?5:(B=3,3)],N[4]=N[5]=t):N[0]<=$&&((_=S<2&&$<N[1])?(B=0,G.v=v,G.n=N[1]):$<U&&(_=S<3||N[0]>v||v>U)&&(N[4]=S,N[5]=v,G.n=U,B=0))}if(_||S>1)return o;throw q=!0,v}return function(S,v,_){if(z>1)throw TypeError("Generator is already running");for(q&&v===1&&I(v,_),B=v,F=_;(e=B<2?t:F)||!q;){P||(B?B<3?(B>1&&(G.n=-1),I(B,F)):G.n=F:G.v=F);
7454try{if(z=2,P){if(B||(S="next"),e=P[S]){if(!(e=e.call(P,F)))throw TypeError("iterator result is not an object");if(!e.done)return e;F=e.value,B<2&&(B=0)}else B===1&&(e=P.return)&&e.call(P),B<2&&(F=TypeError("The iterator does not provide a '"+S+"' method"),B=1);P=t}else if((e=(q=G.n<0)?F:A.call(k,G))!==o)break}catch(N){P=t,B=1,F=N}finally{z=1}}return{value:e,done:q}}})(g,w,C),!0),T}var o={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var d=[][i]?e(e([][i]())):(Tc(e={},i,function(){return this}),e),h=l.prototype=a.prototype=Object.create(d);function p(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,l):(g.__proto__=l,Tc(g,s,"GeneratorFunction")),g.prototype=Object.create(h),g}return c.prototype=l,Tc(h,"constructor",l),Tc(l,"constructor",c),c.displayName="GeneratorFunction",Tc(l,s,"GeneratorFunction"),Tc(h),Tc(h,s,"Generator"),Tc(h,i,function(){return this}),Tc(h,"toString",function(){return"[object Generator]"}),(Co=function(){return{w:r,m:p}})()}function Tc(t,e,n,i){var s=Object.defineProperty;try{s({},"",{})}catch{s=0}Tc=function(r,o,a,c){function l(d,h){Tc(r,d,function(p){return this._invoke(d,h,p)})}o?s?s(r,o,{value:a,enumerable:!c,configurable:!c,writable:!c}):r[o]=a:(l("next",0),l("throw",1),l("return",2))},Tc(t,e,n,i)}function XGe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function JGe(t){var e=XGe(t,"string");return typeof e=="symbol"?e:e+""}function eKe(t,e){if(t){if(typeof t=="string")return oK(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oK(t,e):void 0}}var Ih,tKe="0x1F98431c8aD98523631AE4a59f267346ea31F984",nKe="0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54";function iKe(t){switch(t){case et.ZKSYNC:return"0x010013f177ea1fcbc4520f9a3ca7cd2d1d77959e05aa66484027cb38e712aeed";default:return nKe}}var Ic;(function(t){t[t.LOWEST=100]="LOWEST",t[t.LOW_200=200]="LOW_200",t[t.LOW_300=300]="LOW_300",t[t.LOW_400=400]="LOW_400",t[t.LOW=500]="LOW",t[t.MEDIUM=3e3]="MEDIUM",t[t.HIGH=1e4]="HIGH"})(Ic||(Ic={}));var d8=(Ih={},Ih[Ic.LOWEST]=1,Ih[Ic.LOW_200]=4,Ih[Ic.LOW_300]=6,Ih[Ic.LOW_400]=8,Ih[Ic.LOW]=10,Ih[Ic.MEDIUM]=60,Ih[Ic.HIGH]=200,Ih),rp=X.BigInt(-1),Br=X.BigInt(0),c1=X.BigInt(1),op=X.exponentiate(X.BigInt(2),X.BigInt(96)),h8=X.exponentiate(op,X.BigInt(2));function uoe(t){var e=t.factoryAddress,n=t.tokenA,i=t.tokenB,s=t.fee,r=t.initCodeHashManualOverride,o=t.chainId,a=n.sortsBefore(i)?[n,i]:[i,n],c=a[0],l=a[1],d=YGe(["bytes"],[VGe.encode(["address","address","uint24"],[c.address,l.address,s])]),h=r??iKe(o);switch(o){case et.ZKSYNC:return mGe(e,h,d);default:return xHe(e,d,h)}}var $0=(function(){function t(){}return t.mulDivRoundingUp=function(n,i,s){var r=X.multiply(n,i),o=X.divide(r,s);return X.notEqual(X.remainder(r,s),Br)&&(o=X.add(o,c1)),o},t})(),sKe=X.subtract(X.exponentiate(X.BigInt(2),X.BigInt(160)),c1);function cK(t,e){var n=X.multiply(t,e);return X.bitwiseAnd(n,a1)}function rKe(t,e){var n=X.add(t,e);return X.bitwiseAnd(n,a1)}var Qr=(function(){function t(){}return t.getAmount0Delta=function(n,i,s,r){if(X.greaterThan(n,i)){var o=[i,n];n=o[0],i=o[1]}var a=X.leftShift(s,X.BigInt(96)),c=X.subtract(i,n);return r?$0.mulDivRoundingUp($0.mulDivRoundingUp(a,c,i),c1,n):X.divide(X.divide(X.multiply(a,c),i),n)},t.getAmount1Delta=function(n,i,s,r){if(X.greaterThan(n,i)){var o=[i,n];n=o[0],i=o[1]}return r?$0.mulDivRoundingUp(s,X.subtract(i,n),op):X.divide(X.multiply(s,X.subtract(i,n)),op)},t.getNextSqrtPriceFromInput=function(n,i,s,r){return X.greaterThan(n,Br)||pn(),X.greaterThan(i,Br)||pn(),r?this.getNextSqrtPriceFromAmount0RoundingUp(n,i,s,!0):this.getNextSqrtPriceFromAmount1RoundingDown(n,i,s,!0)},t.getNextSqrtPriceFromOutput=function(n,i,s,r){return X.greaterThan(n,Br)||pn(),X.greaterThan(i,Br)||pn(),r?this.getNextSqrtPriceFromAmount1RoundingDown(n,i,s,!1):this.getNextSqrtPriceFromAmount0RoundingUp(n,i,s,!1)},t.getNextSqrtPriceFromAmount0RoundingUp=function(n,i,s,r){if(X.equal(s,Br))return n;var o=X.leftShift(i,X.BigInt(96));if(r){var a=cK(s,n);if(X.equal(X.divide(a,s),n)){var c=rKe(o,a);if(X.greaterThanOrEqual(c,o))return $0.mulDivRoundingUp(o,n,c)}return $0.mulDivRoundingUp(o,c1,X.add(X.divide(o,n),s))}else{var l=cK(s,n);X.equal(X.divide(l,s),n)||pn(),X.greaterThan(o,l)||pn();var d=X.subtract(o,l);return $0.mulDivRoundingUp(o,n,d)}},t.getNextSqrtPriceFromAmount1RoundingDown=function(n,i,s,r){if(r){var o=X.lessThanOrEqual(s,sKe)?X.divide(X.leftShift(s,X.BigInt(96)),i):X.divide(X.multiply(s,op),i);return X.add(n,o)}else{var a=$0.mulDivRoundingUp(s,op,i);return X.greaterThan(n,a)||pn(),X.subtract(n,a)}},t})(),Xk=X.exponentiate(X.BigInt(10),X.BigInt(6)),oKe=(function(){function t(){}return t.computeSwapStep=function(n,i,s,r,o){var a={};o=X.BigInt(o);var c=X.greaterThanOrEqual(n,i),l=X.greaterThanOrEqual(r,Br);if(l){var d=X.divide(X.multiply(r,X.subtract(Xk,o)),Xk);
7454a.amountIn=c?Qr.getAmount0Delta(i,n,s,!0):Qr.getAmount1Delta(n,i,s,!0),X.greaterThanOrEqual(d,a.amountIn)?a.sqrtRatioNextX96=i:a.sqrtRatioNextX96=Qr.getNextSqrtPriceFromInput(n,s,d,c)}else a.amountOut=c?Qr.getAmount1Delta(i,n,s,!1):Qr.getAmount0Delta(n,i,s,!1),X.greaterThanOrEqual(X.multiply(r,rp),a.amountOut)?a.sqrtRatioNextX96=i:a.sqrtRatioNextX96=Qr.getNextSqrtPriceFromOutput(n,s,X.multiply(r,rp),c);var h=X.equal(i,a.sqrtRatioNextX96);return c?(a.amountIn=h&&l?a.amountIn:Qr.getAmount0Delta(a.sqrtRatioNextX96,n,s,!0),a.amountOut=h&&!l?a.amountOut:Qr.getAmount1Delta(a.sqrtRatioNextX96,n,s,!1)):(a.amountIn=h&&l?a.amountIn:Qr.getAmount1Delta(n,a.sqrtRatioNextX96,s,!0),a.amountOut=h&&!l?a.amountOut:Qr.getAmount0Delta(n,a.sqrtRatioNextX96,s,!1)),!l&&X.greaterThan(a.amountOut,X.multiply(r,rp))&&(a.amountOut=X.multiply(r,rp)),l&&X.notEqual(a.sqrtRatioNextX96,i)?a.feeAmount=X.subtract(r,a.amountIn):a.feeAmount=$0.mulDivRoundingUp(a.amountIn,o,X.subtract(Xk,o)),[a.sqrtRatioNextX96,a.amountIn,a.amountOut,a.feeAmount]},t})(),aKe=(function(){function t(){}return t.addDelta=function(n,i){return X.lessThan(i,Br)?X.subtract(n,X.multiply(i,rp)):X.add(n,i)},t})(),cKe=X.BigInt(2),lKe=[128,64,32,16,8,4,2,1].map(function(t){return[t,X.exponentiate(cKe,X.BigInt(t))]});function uKe(t){X.greaterThan(t,Br)||pn(),X.lessThanOrEqual(t,a1)||pn();for(var e=0,n=QGe(lKe),i;!(i=n()).done;){var s=i.value,r=s[0],o=s[1];X.greaterThanOrEqual(t,o)&&(t=X.signedRightShift(t,X.BigInt(r)),e+=r)}return e}function Nr(t,e){return X.signedRightShift(X.multiply(t,X.BigInt(e)),X.BigInt(128))}var Jk=X.exponentiate(X.BigInt(2),X.BigInt(32)),Yt=(function(){function t(){}return t.getSqrtRatioAtTick=function(n){n>=t.MIN_TICK&&n<=t.MAX_TICK&&Number.isInteger(n)||pn();var i=n<0?n*-1:n,s=(i&1)!==0?X.BigInt("0xfffcb933bd6fad37aa2d162d1a594001"):X.BigInt("0x100000000000000000000000000000000");return(i&2)!==0&&(s=Nr(s,"0xfff97272373d413259a46990580e213a")),(i&4)!==0&&(s=Nr(s,"0xfff2e50f5f656932ef12357cf3c7fdcc")),(i&8)!==0&&(s=Nr(s,"0xffe5caca7e10e4e61c3624eaa0941cd0")),(i&16)!==0&&(s=Nr(s,"0xffcb9843d60f6159c9db58835c926644")),(i&32)!==0&&(s=Nr(s,"0xff973b41fa98c081472e6896dfb254c0")),(i&64)!==0&&(s=Nr(s,"0xff2ea16466c96a3843ec78b326b52861")),(i&128)!==0&&(s=Nr(s,"0xfe5dee046a99a2a811c461f1969c3053")),(i&256)!==0&&(s=Nr(s,"0xfcbe86c7900a88aedcffc83b479aa3a4")),(i&512)!==0&&(s=Nr(s,"0xf987a7253ac413176f2b074cf7815e54")),(i&1024)!==0&&(s=Nr(s,"0xf3392b0822b70005940c7a398e4b70f3")),(i&2048)!==0&&(s=Nr(s,"0xe7159475a2c29b7443b29c7fa6e889d9")),(i&4096)!==0&&(s=Nr(s,"0xd097f3bdfd2022b8845ad8f792aa5825")),(i&8192)!==0&&(s=Nr(s,"0xa9f746462d870fdf8a65dc1f90e061e5")),(i&16384)!==0&&(s=Nr(s,"0x70d869a156d2a1b890bb3df62baf32f7")),(i&32768)!==0&&(s=Nr(s,"0x31be135f97d08fd981231505542fcfa6")),(i&65536)!==0&&(s=Nr(s,"0x9aa508b5b7a84e1c677de54f3e99bc9")),(i&131072)!==0&&(s=Nr(s,"0x5d6af8dedb81196699c329225ee604")),(i&262144)!==0&&(s=Nr(s,"0x2216e584f5fa1ea926041bedfe98")),(i&524288)!==0&&(s=Nr(s,"0x48a170391f7dc42444e8fa2")),n>0&&(s=X.divide(a1,s)),X.greaterThan(X.remainder(s,Jk),Br)?X.add(X.divide(s,Jk),c1):X.divide(s,Jk)},t.getTickAtSqrtRatio=function(n){X.greaterThanOrEqual(n,t.MIN_SQRT_RATIO)&&X.lessThan(n,t.MAX_SQRT_RATIO)||pn();var i=X.leftShift(n,X.BigInt(32)),s=uKe(i),r;X.greaterThanOrEqual(X.BigInt(s),X.BigInt(128))?r=X.signedRightShift(i,X.BigInt(s-127)):r=X.leftShift(i,X.BigInt(127-s));for(var o=X.leftShift(X.subtract(X.BigInt(s),X.BigInt(128)),X.BigInt(64)),a=0;a<14;a++){r=X.signedRightShift(X.multiply(r,r),X.BigInt(127));var c=X.signedRightShift(r,X.BigInt(128));o=X.bitwiseOr(o,X.leftShift(c,X.BigInt(63-a))),r=X.signedRightShift(r,c)}var l=X.multiply(o,X.BigInt("255738958999603826347141")),d=X.toNumber(X.signedRightShift(X.subtract(l,X.BigInt("3402992956809132418596140100660247210")),X.BigInt(128))),h=X.toNumber(X.signedRightShift(X.add(l,X.BigInt("291339464771989622907027621153398088495")),X.BigInt(128)));return d===h?d:X.lessThanOrEqual(t.getSqrtRatioAtTick(h),n)?h:d},t})();Yt.MIN_TICK=-887272;Yt.MAX_TICK=-Yt.MIN_TICK;Yt.MIN_SQRT_RATIO=X.BigInt("4295128739");Yt.MAX_SQRT_RATIO=X.BigInt("1461446703485210103287273052203988822378723970342");function dKe(t,e,n,i,s,r,o,a,c){return FI.apply(this,arguments)}function FI(){return FI=fp(Co().m(function t(e,n,i,s,r,o,a,c,l){var d,h,p,g,b,w,C;return Co().w(function(E){for(;;
7454)switch(E.n){case 0:l||(l=a?X.add(Yt.MIN_SQRT_RATIO,c1):X.subtract(Yt.MAX_SQRT_RATIO,c1)),a?(X.greaterThan(l,Yt.MIN_SQRT_RATIO)||pn(),X.lessThan(l,n)||pn()):(X.lessThan(l,Yt.MAX_SQRT_RATIO)||pn(),X.greaterThan(l,n)||pn()),d=X.greaterThanOrEqual(c,Br),h={amountSpecifiedRemaining:c,amountCalculated:Br,sqrtPriceX96:n,tick:i,liquidity:s};case 1:if(!(X.notEqual(h.amountSpecifiedRemaining,Br)&&h.sqrtPriceX96!==l)){E.n=7;break}return p={},p.sqrtPriceStartX96=h.sqrtPriceX96,E.n=2,o.nextInitializedTickWithinOneWord(h.tick,a,r);case 2:if(g=E.v,p.tickNext=g[0],p.initialized=g[1],p.tickNext<Yt.MIN_TICK?p.tickNext=Yt.MIN_TICK:p.tickNext>Yt.MAX_TICK&&(p.tickNext=Yt.MAX_TICK),p.sqrtPriceNextX96=Yt.getSqrtRatioAtTick(p.tickNext),b=oKe.computeSwapStep(h.sqrtPriceX96,(a?X.lessThan(p.sqrtPriceNextX96,l):X.greaterThan(p.sqrtPriceNextX96,l))?l:p.sqrtPriceNextX96,h.liquidity,h.amountSpecifiedRemaining,e),h.sqrtPriceX96=b[0],p.amountIn=b[1],p.amountOut=b[2],p.feeAmount=b[3],d?(h.amountSpecifiedRemaining=X.subtract(h.amountSpecifiedRemaining,X.add(p.amountIn,p.feeAmount)),h.amountCalculated=X.subtract(h.amountCalculated,p.amountOut)):(h.amountSpecifiedRemaining=X.add(h.amountSpecifiedRemaining,p.amountOut),h.amountCalculated=X.add(h.amountCalculated,X.add(p.amountIn,p.feeAmount))),!X.equal(h.sqrtPriceX96,p.sqrtPriceNextX96)){E.n=5;break}if(!p.initialized){E.n=4;break}return C=X,E.n=3,o.getTick(p.tickNext);case 3:w=C.BigInt.call(C,E.v.liquidityNet),a&&(w=X.multiply(w,rp)),h.liquidity=aKe.addDelta(h.liquidity,w);case 4:h.tick=a?p.tickNext-1:p.tickNext,E.n=6;break;case 5:X.notEqual(h.sqrtPriceX96,p.sqrtPriceStartX96)&&(h.tick=Yt.getTickAtSqrtRatio(h.sqrtPriceX96));case 6:E.n=1;break;case 7:return E.a(2,{amountCalculated:h.amountCalculated,sqrtRatioX96:h.sqrtPriceX96,liquidity:h.liquidity,tickCurrent:h.tick})}},t)})),FI.apply(this,arguments)}var doe=(function(){function t(){}var e=t.prototype;return e.getTick=(function(){var n=fp(Co().m(function s(r){return Co().w(function(o){for(;;)switch(o.n){case 0:throw new Error(t.ERROR_MESSAGE);case 1:return o.a(2)}},s)}));function i(s){return n.apply(this,arguments)}return i})(),e.nextInitializedTickWithinOneWord=(function(){var n=fp(Co().m(function s(r,o,a){return Co().w(function(c){for(;;)switch(c.n){case 0:throw new Error(t.ERROR_MESSAGE);case 1:return c.a(2)}},s)}));function i(s,r,o){return n.apply(this,arguments)}return i})(),t})();doe.ERROR_MESSAGE="No tick data provider was given";function hKe(t,e){for(var n=0;n<t.length-1;n++)if(e(t[n],t[n+1])>0)return!1;return!0}function fKe(t,e){return t.index-e.index}var eN=(function(){function t(){}return t.validateList=function(n,i){i>0||pn(),n.every(function(s){var r=s.index;return r%i===0})||pn(),X.equal(n.reduce(function(s,r){var o=r.liquidityNet;return X.add(s,o)},Br),Br)||pn(),hKe(n,fKe)||pn()},t.isBelowSmallest=function(n,i){return n.length>0||pn(),i<n[0].index},t.isAtOrAboveLargest=function(n,i){return n.length>0||pn(),i>=n[n.length-1].index},t.getTick=function(n,i){var s=n[this.binarySearch(n,i)];return s.index!==i&&pn(),s},t.binarySearch=function(n,i){this.isBelowSmallest(n,i)&&pn();for(var s=0,r=n.length-1,o;;){if(o=Math.floor((s+r)/2),n[o].index<=i&&(o===n.length-1||n[o+1].index>i))return o;n[o].index<i?s=o+1:r=o-1}},t.nextInitializedTick=function(n,i,s){if(s){if(t.isBelowSmallest(n,i)&&pn(),t.isAtOrAboveLargest(n,i))return n[n.length-1];var r=this.binarySearch(n,i);return n[r]}else{if(this.isAtOrAboveLargest(n,i)&&pn(),this.isBelowSmallest(n,i))return n[0];var o=this.binarySearch(n,i);return n[o+1]}},t.nextInitializedTickWithinOneWord=function(n,i,s,r){var o=Math.floor(i/r);if(s){var a=o>>8,c=(a<<8)*r;if(t.isBelowSmallest(n,i))return[c,!1];var l=t.nextInitializedTick(n,i,s).index,d=Math.max(c,l);return[d,d===l]}else{var h=o+1>>8,p=((h+1<<8)-1)*r;if(this.isAtOrAboveLargest(n,i))return[p,!1];var g=this.nextInitializedTick(n,i,s).index,b=Math.min(p,g);return[b,b===g]}},t})();function E3(t,e){var n=X.leftShift(X.BigInt(t),X.BigInt(192)),i=X.BigInt(e),s=X.divide(n,i);return wGe(s)}function pKe(t,e,n){if(X.greaterThan(t,e)){var i=[e,t];t=i[0],e=i[1]}var s=X.divide(X.multiply(t,e),op);return X.divide(X.multiply(X.BigInt(n),s),X.subtract(e,t))}function mKe(t,e,n){if(X.greaterThan(t,e)){var i=[e,t];t=i[0],e=i[1]}var s=X.multiply(X.multiply(X.BigInt(n),t),e),r=X.multiply(op,X.subtract(e,t));return X.divide(s,r)}function lK(t,e,n){if(X.greaterThan(t,e)){var i=[e,t];t=i[0],e=i[1]}return X.divide(X.multiply(X.BigInt(n),op),X.subtract(e,t))}function gKe(t,e,n,i,s,r){if(X.greaterThan(e,n)){var o=[n,e];e=o[0],n=o[1]}var a=r?mKe:pKe;if(X.lessThanOrEqual(t,e))return a(e,n,i);if(X.lessThan(t,n)){var c=a(t,n,i),l=lK(e,t,s);return X.lessThan(c,l)?c:l}else return lK(e,n,s)}function Uy(t,e){Number.isInteger(t)&&Number.isInteger(e)||pn(),e>0||pn(),t>=Yt.MIN_TICK&&t<=Yt.MAX_TICK||pn();var n=Math.round(t/e)*e;return n<Yt.MIN_TICK?n+e:n>Yt.MAX_TICK?n-e:n}function uK(t,e,n){var i=Yt.getSqrtRatioAtTick(n),s=X.multiply(i,i);return t.sortsBefore(e)?new Y5(t,e,h8,s):new Y5(t,e,s,h8)}var dK=function(e){var n=e.index,i=e.liquidityGross,s=e.liquidityNet;n>=Yt.MIN_TICK&&n<=Yt.MAX_TICK||pn(),this.index=n,this.liquidityGross=X.BigInt(i),this.liquidityNet=X.BigInt(s)},yKe=(function(){function t(n,i){var s=n.map(function(r){return r instanceof dK?r:new dK(r)});
7454eN.validateList(s,i),this.ticks=s}var e=t.prototype;return e.getTick=(function(){var n=fp(Co().m(function s(r){return Co().w(function(o){for(;;)switch(o.n){case 0:return o.a(2,eN.getTick(this.ticks,r))}},s,this)}));function i(s){return n.apply(this,arguments)}return i})(),e.nextInitializedTickWithinOneWord=(function(){var n=fp(Co().m(function s(r,o,a){return Co().w(function(c){for(;;)switch(c.n){case 0:return c.a(2,eN.nextInitializedTickWithinOneWord(this.ticks,r,o,a))}},s,this)}));function i(s,r,o){return n.apply(this,arguments)}return i})(),t})(),bKe=new doe,to=(function(){function t(n,i,s,r,o,a,c){c===void 0&&(c=bKe),Number.isInteger(s)&&s<1e6||pn();var l=Yt.getSqrtRatioAtTick(a),d=Yt.getSqrtRatioAtTick(a+1);X.greaterThanOrEqual(X.BigInt(r),l)&&X.lessThanOrEqual(X.BigInt(r),d)||pn();var h=n.sortsBefore(i)?[n,i]:[i,n];this.token0=h[0],this.token1=h[1],this.fee=s,this.sqrtRatioX96=X.BigInt(r),this.liquidity=X.BigInt(o),this.tickCurrent=a,this.tickDataProvider=Array.isArray(c)?new yKe(c,d8[s]):c}t.getAddress=function(i,s,r,o,a){return uoe({factoryAddress:a??tKe,fee:r,tokenA:i,tokenB:s,initCodeHashManualOverride:o})};var e=t.prototype;return e.involvesToken=function(i){return i.equals(this.token0)||i.equals(this.token1)},e.priceOf=function(i){return this.involvesToken(i)||pn(),i.equals(this.token0)?this.token0Price:this.token1Price},e.getOutputAmount=(function(){var n=fp(Co().m(function s(r,o){var a,c,l,d,h,p,g;return Co().w(function(b){for(;;)switch(b.n){case 0:return this.involvesToken(r.currency)||pn(),a=r.currency.equals(this.token0),b.n=1,this.swap(a,r.quotient,o);case 1:return c=b.v,l=c.amountCalculated,d=c.sqrtRatioX96,h=c.liquidity,p=c.tickCurrent,g=a?this.token1:this.token0,b.a(2,[vu.fromRawAmount(g,X.multiply(l,rp)),new t(this.token0,this.token1,this.fee,d,h,p,this.tickDataProvider)])}},s,this)}));function i(s,r){return n.apply(this,arguments)}return i})(),e.getInputAmount=(function(){var n=fp(Co().m(function s(r,o){var a,c,l,d,h,p,g;return Co().w(function(b){for(;;)switch(b.n){case 0:return r.currency.isToken&&this.involvesToken(r.currency)||pn(),a=r.currency.equals(this.token1),b.n=1,this.swap(a,X.multiply(r.quotient,rp),o);case 1:return c=b.v,l=c.amountCalculated,d=c.sqrtRatioX96,h=c.liquidity,p=c.tickCurrent,g=a?this.token0:this.token1,b.a(2,[vu.fromRawAmount(g,l),new t(this.token0,this.token1,this.fee,d,h,p,this.tickDataProvider)])}},s,this)}));function i(s,r){return n.apply(this,arguments)}return i})(),e.swap=(function(){var n=fp(Co().m(function s(r,o,a){return Co().w(function(c){for(;;)switch(c.n){case 0:return c.a(2,dKe(X.BigInt(this.fee),this.sqrtRatioX96,this.tickCurrent,this.liquidity,this.tickSpacing,this.tickDataProvider,r,o,a))}},s,this)}));function i(s,r,o){return n.apply(this,arguments)}return i})(),loe(t,[{key:"token0Price",get:function(){var i;return(i=this._token0Price)!=null?i:this._token0Price=new Y5(this.token0,this.token1,h8,X.multiply(this.sqrtRatioX96,this.sqrtRatioX96))}},{key:"token1Price",get:function(){var i;return(i=this._token1Price)!=null?i:this._token1Price=new Y5(this.token1,this.token0,X.multiply(this.sqrtRatioX96,this.sqrtRatioX96),h8)}},{key:"chainId",get:function(){return this.token0.chainId}},{key:"tickSpacing",get:function(){return d8[this.fee]}}])})(),ca=(function(){function t(n){var i=n.pool,s=n.liquidity,r=n.tickLower,o=n.tickUpper;this._token0Amount=null,this._token1Amount=null,this._mintAmounts=null,r<o||pn(),r>=Yt.MIN_TICK&&r%i.tickSpacing===0||pn(),o<=Yt.MAX_TICK&&o%i.tickSpacing===0||pn(),this.pool=i,this.tickLower=r,this.tickUpper=o,this.liquidity=X.BigInt(s)}var e=t.prototype;return e.ratiosAfterSlippage=function(i){var s=this.pool.token0Price.asFraction.multiply(new eoe(1).subtract(i)),r=this.pool.token0Price.asFraction.multiply(i.add(1)),o=E3(s.numerator,s.denominator);X.lessThanOrEqual(o,Yt.MIN_SQRT_RATIO)&&(o=X.add(Yt.MIN_SQRT_RATIO,X.BigInt(1)));var a=E3(r.numerator,r.denominator);return X.greaterThanOrEqual(a,Yt.MAX_SQRT_RATIO)&&(a=X.subtract(Yt.MAX_SQRT_RATIO,X.BigInt(1))),{sqrtRatioX96Lower:o,sqrtRatioX96Upper:a}},e.mintAmountsWithSlippage=function(i){var s=this.ratiosAfterSlippage(i),r=s.sqrtRatioX96Upper,o=s.sqrtRatioX96Lower,a=new to(this.pool.token0,this.pool.token1,this.pool.fee,o,0,Yt.getTickAtSqrtRatio(o)),c=new to(this.pool.token0,this.pool.token1,this.pool.fee,r,0,Yt.getTickAtSqrtRatio(r)),l=t.fromAmounts(BI({pool:this.pool,tickLower:this.tickLower,tickUpper:this.tickUpper}
7454,this.mintAmounts,{useFullPrecision:!1})),d=new t({pool:c,liquidity:l.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount0,h=new t({pool:a,liquidity:l.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).mintAmounts.amount1;return{amount0:d,amount1:h}},e.burnAmountsWithSlippage=function(i){var s=this.ratiosAfterSlippage(i),r=s.sqrtRatioX96Upper,o=s.sqrtRatioX96Lower,a=new to(this.pool.token0,this.pool.token1,this.pool.fee,o,0,Yt.getTickAtSqrtRatio(o)),c=new to(this.pool.token0,this.pool.token1,this.pool.fee,r,0,Yt.getTickAtSqrtRatio(r)),l=new t({pool:c,liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount0,d=new t({pool:a,liquidity:this.liquidity,tickLower:this.tickLower,tickUpper:this.tickUpper}).amount1;return{amount0:l.quotient,amount1:d.quotient}},t.fromAmounts=function(i){var s=i.pool,r=i.tickLower,o=i.tickUpper,a=i.amount0,c=i.amount1,l=i.useFullPrecision,d=Yt.getSqrtRatioAtTick(r),h=Yt.getSqrtRatioAtTick(o);return new t({pool:s,tickLower:r,tickUpper:o,liquidity:gKe(s.sqrtRatioX96,d,h,a,c,l)})},t.fromAmount0=function(i){var s=i.pool,r=i.tickLower,o=i.tickUpper,a=i.amount0,c=i.useFullPrecision;return t.fromAmounts({pool:s,tickLower:r,tickUpper:o,amount0:a,amount1:a1,useFullPrecision:c})},t.fromAmount1=function(i){var s=i.pool,r=i.tickLower,o=i.tickUpper,a=i.amount1;return t.fromAmounts({pool:s,tickLower:r,tickUpper:o,amount0:a1,amount1:a,useFullPrecision:!0})},loe(t,[{key:"token0PriceLower",get:function(){return uK(this.pool.token0,this.pool.token1,this.tickLower)}},{key:"token0PriceUpper",get:function(){return uK(this.pool.token0,this.pool.token1,this.tickUpper)}},{key:"amount0",get:function(){return this._token0Amount===null&&(this.pool.tickCurrent<this.tickLower?this._token0Amount=vu.fromRawAmount(this.pool.token0,Qr.getAmount0Delta(Yt.getSqrtRatioAtTick(this.tickLower),Yt.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1)):this.pool.tickCurrent<this.tickUpper?this._token0Amount=vu.fromRawAmount(this.pool.token0,Qr.getAmount0Delta(this.pool.sqrtRatioX96,Yt.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1)):this._token0Amount=vu.fromRawAmount(this.pool.token0,Br)),this._token0Amount}},{key:"amount1",get:function(){return this._token1Amount===null&&(this.pool.tickCurrent<this.tickLower?this._token1Amount=vu.fromRawAmount(this.pool.token1,Br):this.pool.tickCurrent<this.tickUpper?this._token1Amount=vu.fromRawAmount(this.pool.token1,Qr.getAmount1Delta(Yt.getSqrtRatioAtTick(this.tickLower),this.pool.sqrtRatioX96,this.liquidity,!1)):this._token1Amount=vu.fromRawAmount(this.pool.token1,Qr.getAmount1Delta(Yt.getSqrtRatioAtTick(this.tickLower),Yt.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!1))),this._token1Amount}},{key:"mintAmounts",get:function(){return this._mintAmounts===null?this.pool.tickCurrent<this.tickLower?{amount0:Qr.getAmount0Delta(Yt.getSqrtRatioAtTick(this.tickLower),Yt.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:Br}:this.pool.tickCurrent<this.tickUpper?{amount0:Qr.getAmount0Delta(this.pool.sqrtRatioX96,Yt.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0),amount1:Qr.getAmount1Delta(Yt.getSqrtRatioAtTick(this.tickLower),this.pool.sqrtRatioX96,this.liquidity,!0)}:{amount0:Br,amount1:Qr.getAmount1Delta(Yt.getSqrtRatioAtTick(this.tickLower),Yt.getSqrtRatioAtTick(this.tickUpper),this.liquidity,!0)}:this._mintAmounts}}])})();const wKe=({position:t,pool:e,isModalOpen:n})=>{var yn,bi,En,yt,mt,_t,Vt,Yn;const{address:i}=mn(),s=Kc(),[r,o]=M.useState(!1),[a,c]=M.useState([]),l=!!e,[d,h]=M.useState("0"),[p,g]=M.useState("0"),[b,w]=M.useState(5),[C,E]=M.useState(null);M.useEffect(()=>{n||(h("0"),g("0"),w(5))},[n]);const T=e&&e.token0Ref?e.token0Ref.id:"0x0",A=e&&e.token1Ref?e.token1Ref.id:"0x0",{data:k,refetch:R}=vf({contracts:[{address:T,abi:Ks,functionName:"balanceOf",args:i?[i]:void 0},{address:A,abi:Ks,functionName:"balanceOf",args:i?[i]:void 0}],query:{enabled:l&&!!i}}),P=(k==null?void 0:k[0].status)==="success"?k[0].result:0n,B=(k==null?void 0:k[1].status)==="success"?k[1].result:0n;M.useEffect(()=>{var Ee,$e,Xe,ot,pt,Ot;k&&console.log("[useIncreasePosition] Balance status:",{token0Status:(Ee=k[0])==null?void 0:Ee.status,token0Result:(Xe=($e=k[0])==null?void 0:$e.result)==null?void 0:Xe.toString(),token0Balance:P.toString(),token1Status:(ot=k[1])==null?void 0:ot.status,token1Result:(Ot=(pt=k[1])==null?void 0:pt.result)==null?void 0:Ot.toString(),token1Balance:B.toString(),token0Address:T,token1Address:A,address:i})},[k,P,B,T,A,i]);const{data:F,refetch:z}=vf({contracts:[{address:T,abi:Ks,functionName:"allowance",args:i?[i,vt.positionManager]:void 0},{address:A,abi:Ks,functionName:"allowance",args:i?[i,vt.positionManager]:void 0}],query:{enabled:!!i}}),K=(F==null?void 0:F[0].status)==="success"?F[0].result:0n,q=(F==null?void 0:F[1].status)==="success"?F[1].result:0n,G=M.useMemo(()=>{var Ee,$e;if(!e||!e.token0Ref||!e.token1Ref)return console.warn("[useIncreasePosition] Cannot create SDK pool: missing pool or token refs",{hasPool:!!e,hasToken0Ref:!!(e!=null&&e.token0Ref),hasToken1Ref:!!(e!=null&&e.token1Ref)}),null;try{console.log("[useIncreasePosition] Creating SDK pool with data:",{token0:e.token0Ref.id,token1:e.token1Ref.id,feeTier:e.feeTier,sqrtPrice:e.sqrtPrice,liquidity:e.liquidity,tick:e.tick});const Xe=new to(new on(Nn.id,e.token0Ref.id,e.token0Ref.decimals,e.token0Ref.symbol,e.token0Ref.name),new on(Nn.id,e.token1Ref.id,e.token1Ref.decimals,e.token1Ref.symbol,e.token1Ref.name),e.feeTier,e.sqrtPrice,e.liquidity,e.tick||0);return console.log("[useIncreasePosition] SDK pool created successfully"),Xe}catch(Xe){return console.error("[useIncreasePosition] Error creating SDK pool:",Xe,{poolData:{token0:(Ee=e.token0Ref)==null?void 0:Ee.id,token1:($e=e.token1Ref)==null?void 0:$e.id,feeTier:e.feeTier,sqrtPrice:e.sqrtPrice,liquidity:e.liquidity,tick:e.tick}}),null}},[e]),I=M.useCallback(Ee=>{if(!Ee||Ee==="0"||!G||!e||!e.token0Ref||!e.token1Ref)return"0";try{let $e,Xe;const ot=Ee==="0."?"0":Ee.trim();try{$e=hs(ot,e.token0Ref.decimals),Xe=ot}catch(Ot){return console.error("[useIncreasePosition] Error parsing token0Amount:",Ot,{token0Amount:Ee,normalizedToken0:ot}),"0"}let pt;if(t&&t.tickLower!==void 0&&t.tickUpper!==void 0)try{const Ot=ca.fromAmount0({pool:G,tickLower:t.tickLower,tickUpper:t.tickUpper,amount0:$e.toString(),useFullPrecision:!0});pt=BigInt(Ot.amount1.quotient.toString()),console.log("[useIncreasePosition] calculateToken1FromToken0 - SDK result (using quotient):",{token0Input:$e.toString(),token0Decimal:Xe,token1Quotient:Ot.amount1.quotient.toString(),token1Amount:pt.toString(),token1Exact:Ot.amount1.toExact(),token1Significant:Ot.amount1.toSignificant(18),token1Currency:Ot.amount1.currency.decimals,formattedBack:dt(pt,e.token1Ref.decimals)})}catch(Ot){return console.error("[useIncreasePosition] SDK Position.fromAmount0 error:",Ot,{token0Decimal:Xe,token0BigInt:$e.toString(),tickLower:t.tickLower,tickUpper:t.tickUpper}),"0"}else try{const Ot=G.token0Price,tn=vu.fromRawAmount(new on(Nn.id,e.token0Ref.id,e.token0Ref.decimals,e.token0Ref.symbol,e.token0Ref.name),$e.toString()),rn=Ot.quote(tn);pt=BigInt(rn.quotient.toString()),console.log("[useIncreasePosition] calculateToken1FromToken0 - Price calculation result (using quotient):",{token0Input:$e.toString(),token1Quotient:rn.quotient.toString(),token1Amount:pt.toString(),token1Exact:rn.toExact(),formattedBack:dt(pt,e.token1Ref.decimals)})}catch(Ot){return console.error("[useIncreasePosition] Price calculation error:",Ot,{token0BigInt:$e.toString(),token0Decimal:Xe}),"0"}return console.log("[useIncreasePosition] Calculated token1 from token0 using SDK:",{token0Amount:Ee,token0Display:Xe,token1Amount:pt.toString(),token1Display:dt(pt,e.token1Ref.decimals),hasPosition:!!t,tickLower:t==null?void 0:t.t
7454ickLower,tickUpper:t==null?void 0:t.tickUpper}),pt.toString()}catch($e){return console.error("Error calculating token1 from token0:",$e,{token0Amount:Ee}),"0"}},[G,t==null?void 0:t.tickLower,t==null?void 0:t.tickUpper,(yn=e==null?void 0:e.token0Ref)==null?void 0:yn.id,(bi=e==null?void 0:e.token0Ref)==null?void 0:bi.decimals,(En=e==null?void 0:e.token1Ref)==null?void 0:En.id,(yt=e==null?void 0:e.token1Ref)==null?void 0:yt.decimals]),S=M.useCallback(Ee=>{if(!Ee||Ee==="0"||!G||!e||!e.token0Ref||!e.token1Ref)return"0";try{let $e,Xe;const ot=Ee==="0."?"0":Ee.trim();try{$e=hs(ot,e.token1Ref.decimals),Xe=ot}catch(Ot){return console.error("[useIncreasePosition] Error parsing token1Amount:",Ot,{token1Amount:Ee,normalizedToken1:ot}),"0"}console.log("[useIncreasePosition] calculateToken0FromToken1 called:",{token1Amount:Ee,token1Decimal:Xe,sdkPool:!!G,hasPosition:!!t,tickLower:t==null?void 0:t.tickLower,tickUpper:t==null?void 0:t.tickUpper});let pt;if(t&&t.tickLower!==void 0&&t.tickUpper!==void 0)try{const Ot=ca.fromAmount1({pool:G,tickLower:t.tickLower,tickUpper:t.tickUpper,amount1:$e.toString(),useFullPrecision:!0});pt=BigInt(Ot.amount0.quotient.toString()),console.log("[useIncreasePosition] calculateToken0FromToken1 - SDK result (using quotient):",{token1Input:$e.toString(),token1Decimal:Xe,token0Quotient:Ot.amount0.quotient.toString(),token0Amount:pt.toString(),token0Exact:Ot.amount0.toExact(),token0Significant:Ot.amount0.toSignificant(18),token0Currency:Ot.amount0.currency.decimals,formattedBack:dt(pt,e.token0Ref.decimals)})}catch(Ot){return console.error("[useIncreasePosition] SDK Position.fromAmount1 error:",Ot,{token1Decimal:Xe,token1BigInt:$e.toString(),tickLower:t.tickLower,tickUpper:t.tickUpper}),"0"}else try{const Ot=G.token1Price,tn=vu.fromRawAmount(new on(Nn.id,e.token1Ref.id,e.token1Ref.decimals,e.token1Ref.symbol,e.token1Ref.name),$e.toString()),rn=Ot.quote(tn);pt=BigInt(rn.quotient.toString()),console.log("[useIncreasePosition] calculateToken0FromToken1 - Price calculation result (using quotient):",{token1Input:$e.toString(),token0Quotient:rn.quotient.toString(),token0Amount:pt.toString(),token0Exact:rn.toExact(),formattedBack:dt(pt,e.token0Ref.decimals)})}catch(Ot){return console.error("[useIncreasePosition] Price calculation error:",Ot,{token1BigInt:$e.toString(),token1Decimal:Xe}),"0"}return console.log("[useIncreasePosition] Calculated token0 from token1 using SDK:",{token1Amount:Ee,token1Display:Xe,token0Amount:pt.toString(),token0Display:dt(pt,e.token0Ref.decimals),hasPosition:!!t,tickLower:t==null?void 0:t.tickLower,tickUpper:t==null?void 0:t.tickUpper}),pt.toString()}catch($e){return console.error("Error calculating token0 from token1:",$e,{token1Amount:Ee}),"0"}},[G,t==null?void 0:t.tickLower,t==null?void 0:t.tickUpper,(mt=e==null?void 0:e.token0Ref)==null?void 0:mt.id,(_t=e==null?void 0:e.token0Ref)==null?void 0:_t.decimals,(Vt=e==null?void 0:e.token1Ref)==null?void 0:Vt.id,(Yn=e==null?void 0:e.token1Ref)==null?void 0:Yn.decimals]),v=M.useMemo(()=>{try{return BigInt(d||"0")}catch{return 0n}},[d]),_=M.useMemo(()=>{try{return BigInt(p||"0")}catch{return 0n}},[p]),N=M.useMemo(()=>v===0n?!1:K<v*105n/100n,[K,v]),$=M.useMemo(()=>_===0n?!1:q<_*105n/100n,[q,_]),U=M.useRef(null),j=M.useMemo(()=>{if(!G||!e||!t||v===0n&&_===0n){const Ee={amount0:v,amount1:_};return U.current&&U.current.amount0===Ee.amount0&&U.current.amount1===Ee.amount1?U.current:(U.current=Ee,Ee)}try{let Ee;if(C==="token0"&&v>0n){const $e=I(v.toString()),Xe=BigInt($e||"0");Ee={amount0:v,amount1:Xe,shouldUpdateToken1:Xe>0n&&$e!=="0"&&_===0n}}else if(C==="token1"&&_>0n){const $e=S(_.toString()),Xe=BigInt($e||"0");Ee={amount0:Xe,amount1:_,shouldUpdateToken0:Xe>0n&&$e!=="0"&&v===0n}}else if(v>0n&&_>0n){const $e=I(v.toString()),Xe=BigInt($e||"0");Ee={amount0:v,amount1:Xe,shouldUpdateToken1:Xe>0n&&$e!=="0"}}else if(v>0n&&_===0n){const $e=I(v.toString()),Xe=BigInt($e||"0");Ee={amount0:v,amount1:Xe,shouldUpdateToken1:Xe>0n&&$e!=="0"}}else if(_>0n&&v===0n){const $e=S(_.toString()),Xe=BigInt($e||"0");Ee={amount0:Xe,amount1:_,shouldUpdateToken0:Xe>0n&&$e!=="0"}}else Ee={amount0:v,amount1:_};return U.current&&U.current.amount0===Ee.amount0&&U.current.amount1===Ee.amount1?U.current:(U.current={amount0:Ee.amount0,amount1:Ee.amount1},Ee)}catch(Ee){console.error("[useIncreasePosition] Error recalculating amounts:",Ee);const $e={amount0:v,amount1:_};return U.current=$e,$e}},[G,e==null?void 0:e.id,t==null?void 0:t.tokenId,t==null?void 0:t.t
7454ickLower,t==null?void 0:t.tickUpper,v,_,C,I,S]),D=j.amount0,O=j.amount1,H=M.useMemo(()=>{var nn,ln,Oi,un,_n,Cs,Wn,Zn,fs,Us,cs,Vr,ps,ko;console.log("[useIncreasePosition] Validation starting:",{hasAddress:!!i,hasPool:!!e,parsedToken0Amount:v.toString(),parsedToken1Amount:_.toString(),token0Balance:P.toString(),token1Balance:B.toString()});const Ee=[];if(!i)return console.log("[useIncreasePosition] Validation: No address"),Ee.push({field:"general",message:"Please connect your wallet"}),Ee;if(!e)return console.log("[useIncreasePosition] Validation: No pool"),Ee;if(v===0n&&_===0n)return console.log("[useIncreasePosition] Validation: No amounts entered"),Ee.push({field:"general",message:"Enter token amounts"}),Ee;const $e=D,Xe=O,ot=((nn=k==null?void 0:k[0])==null?void 0:nn.status)==="success",pt=((ln=k==null?void 0:k[1])==null?void 0:ln.status)==="success",Ot=$e>100n?$e*10n/1000n:1n,tn=Xe>100n?Xe*10n/1000n:1n,rn=v>0n&&v<$e?v:$e,Mt=_>0n&&_<Xe?_:Xe;if(console.log("[useIncreasePosition] Balance validation check:",{parsedToken0Amount:v.toString(),parsedToken1Amount:_.toString(),finalAmount0:$e.toString(),finalAmount1:Xe.toString(),validationAmount0:rn.toString(),validationAmount1:Mt.toString(),token0Balance:P.toString(),token1Balance:B.toString(),tolerance0:Ot.toString(),tolerance1:tn.toString(),token0BalanceStatus:(Oi=k==null?void 0:k[0])==null?void 0:Oi.status,token1BalanceStatus:(un=k==null?void 0:k[1])==null?void 0:un.status,token0BalanceResult:(Cs=(_n=k==null?void 0:k[0])==null?void 0:_n.result)==null?void 0:Cs.toString(),token1BalanceResult:(Zn=(Wn=k==null?void 0:k[1])==null?void 0:Wn.result)==null?void 0:Zn.toString(),token0Symbol:(fs=e.token0Ref)==null?void 0:fs.symbol,token1Symbol:(Us=e.token1Ref)==null?void 0:Us.symbol,token0Required:(rn-Ot).toString(),token1Required:(Mt-tn).toString()}),e.token0Ref&&ot&&rn>0n){const Mi=rn>Ot?rn-Ot:0n;P<Mi?(console.log("[useIncreasePosition] Insufficient token0 balance:",{validationAmount0:rn.toString(),finalAmount0:$e.toString(),parsedToken0Amount:v.toString(),token0Balance:P.toString(),tolerance0:Ot.toString(),required:Mi.toString(),symbol:e.token0Ref.symbol,comparison:`${P.toString()} < ${Mi.toString()}`,difference:(Mi-P).toString()}),Ee.push({field:"token0",message:`Insufficient ${e.token0Ref.symbol} balance`})):console.log("[useIncreasePosition] Token0 balance is sufficient:",{validationAmount0:rn.toString(),token0Balance:P.toString(),tolerance0:Ot.toString(),required:Mi.toString(),comparison:`${P.toString()} >= ${Mi.toString()}`})}if(e.token1Ref&&pt&&Mt>0n){const Mi=Mt>tn?Mt-tn:0n;B<Mi?(console.log("[useIncreasePosition] Insufficient token1 balance:",{validationAmount1:Mt.toString(),finalAmount1:Xe.toString(),parsedToken1Amount:_.toString(),token1Balance:B.toString(),tolerance1:tn.toString(),required:Mi.toString(),symbol:e.token1Ref.symbol,balanceStatus:(cs=k==null?void 0:k[1])==null?void 0:cs.status,balanceResult:(ps=(Vr=k==null?void 0:k[1])==null?void 0:Vr.result)==null?void 0:ps.toString(),comparison:`${B.toString()} < ${Mi.toString()}`,difference:(Mi-B).toString()}),Ee.push({field:"token1",message:`Insufficient ${e.token1Ref.symbol} balance`})):console.log("[useIncreasePosition] Token1 balance is sufficient:",{validationAmount1:Mt.toString(),token1Balance:B.toString(),tolerance1:tn.toString(),required:Mi.toString(),comparison:`${B.toString()} >= ${Mi.toString()}`})}return t&&((ko=t.owner)==null?void 0:ko.toLowerCase())!==(i==null?void 0:i.toLowerCase())&&Ee.push({field:"general",message:"Position does not belong to you"}),Ee},[i,v,_,P,B,e,t,D,O,k]),J=M.useMemo(()=>{const Ee=[...H,...a];return Ee.length>0&&console.log("[useIncreasePosition] Validation errors found:",{validationErrors:H.map($e=>({field:$e.field,message:$e.message})),simulationErrors:a.map($e=>({field:$e.field,message:$e.message})),allErrors:Ee.map($e=>({field:$e.field,message:$e.message})),validationErrorsCount:H.length,simulationErrorsCount:a.length}),Ee},[H,a]),W=D>0n&&O>0n,Z=M.useMemo(()=>J.length===0&&W&&!!e&&!!t,[J.length,W,e,t]);if(!Z&&(v>0n||_>0n)){const Ee=J.map($e=>`${$e.field}: ${$e.message}`).join(", ");console.log("[useIncreasePosition] canSubmit is false:",{allValidationErrorsLength:J.length,errorMessages:Ee,allValidationErrors:J.map($e=>({field:$e.field,message:$e.message})),parsedToken0Amount:v.toString(),parsedToken1Amount:_.toString(),hasAmounts:v>0n||_>0n}
7454),J.forEach(($e,Xe)=>{console.log(`[useIncreasePosition] Error ${Xe+1}:`,$e.field,"-",$e.message)})}const{data:Y,writeContract:Q,isPending:ee,error:ie}=Ls(),{isLoading:re,status:oe}=Ts({hash:Y}),de=M.useCallback(()=>{!i||v===0n||Q({address:T,abi:Ks,functionName:"approve",args:[vt.positionManager,v*105n/100n]})},[i,v,T,Q]),{data:he,writeContract:ue,isPending:be,error:_e}=Ls(),{isLoading:Ne,status:pe}=Ts({hash:he}),Te=M.useCallback(()=>{!i||_===0n||ue({address:A,abi:Ks,functionName:"approve",args:[vt.positionManager,_*105n/100n]})},[i,_,A,ue]);if(M.useEffect(()=>{(oe==="success"||pe==="success")&&z()},[oe,pe,z]),!l)return{parsedToken0Amount:0n,parsedToken1Amount:0n,slippageTolerance:3,token0Balance:0n,token1Balance:0n,token0NeedsApproval:!1,token1NeedsApproval:!1,validationErrors:[],canSubmit:!1,status:"idle",isLoading:!1,isSuccess:!1,setToken0Amount:Ee=>{},setToken1Amount:Ee=>{},setSlippageTolerance:Ee=>{},approveToken0:()=>{},approveToken1:()=>{},increaseLiquidity:()=>{},reset:()=>{},increaseLiquidityHash:void 0,increaseLiquidityReceipt:void 0,errors:{approveToken0:void 0,approveToken1:void 0,simulate:void 0,increase:void 0},canApproveToken0:!1,canApproveToken1:!1,canIncrease:!1};const ve=M.useRef({token0:0n,token1:0n,token0String:"0",token1String:"0"});M.useEffect(()=>{const Ee=j,$e=D,Xe=O,ot=Xe!==ve.current.token1,pt=$e!==ve.current.token0;if(ot&&Xe>0n&&_!==Xe&&C!=="token1"&&(Ee.shouldUpdateToken1||_===0n)){const tn=Xe.toString();tn!==p&&tn!==ve.current.token1String&&(g(tn),ve.current.token1=Xe,ve.current.token1String=tn)}if(pt&&$e>0n&&v!==$e&&C!=="token0"&&(Ee.shouldUpdateToken0||v===0n)){const tn=$e.toString();tn!==d&&tn!==ve.current.token0String&&(h(tn),ve.current.token0=$e,ve.current.token0String=tn)}},[D,O,_,v,C,p,d]);const{data:xe,isLoading:Ye,error:ze}=$r({address:vt.positionManager,abi:Eu,functionName:"increaseLiquidity",args:M.useMemo(()=>{const Ee=D,$e=O;if(!Z||N||$||!e||!t||!t.tokenId||Ee===0n||$e===0n)return;const Xe=0n,ot=0n;return console.log("[useIncreasePosition] Slippage calculation (using 0 min like mint):",{slippageTolerance:b,finalAmount0:Ee.toString(),finalAmount1:$e.toString(),amount0Min:Xe.toString(),amount1Min:ot.toString(),note:"Using 0 min amounts like mint - contract adjusts to exact position ratio"}),[{tokenId:BigInt(t.tokenId),amount0Desired:Ee,amount1Desired:$e,amount0Min:Xe,amount1Min:ot,deadline:BigInt(Math.floor(Date.now()/1e3)+1200)}]},[Z,N,$,e==null?void 0:e.id,t==null?void 0:t.tokenId,D,O,b]),query:{enabled:Z&&!N&&!$&&D>0n&&O>0n&&!!e&&!!t&&!!t.tokenId,retry:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,refetchInterval:!1}});M.useEffect(()=>{const Ee=[],$e=D>0n&&O>0n;if(ze&&!Ye&&$e){const Xe=ze instanceof Error?ze.message:String(ze),ot=ze,pt=(ot==null?void 0:ot.shortMessage)||Xe;console.error("[useIncreasePosition] Simulation error:",{error:Xe,shortMessage:ot==null?void 0:ot.shortMessage,cause:ot==null?void 0:ot.cause,data:ot==null?void 0:ot.data,parsedToken0Amount:v.toString(),parsedToken1Amount:_.toString(),recalculatedAmount0:D.toString(),recalculatedAmount1:O.toString(),positionTokenId:t==null?void 0:t.tokenId,tickLower:t==null?void 0:t.tickLower,tickUpper:t==null?void 0:t.tickUpper}),Xe.includes("execution reverted")||Xe.includes("revert")?Xe.includes("STF")||Xe.includes("slippage")||Xe.includes("Slippage")?Ee.push({field:"general",message:"Slippage tolerance exceeded. Try adjusting amounts or increasing slippage tolerance."}):Xe.includes("ratio")||Xe.includes("amount")||Xe.includes("Ratio")?Ee.push({field:"general",message:"Token amounts are not in the correct ratio for this position. Try entering only one amount."}):Xe.includes("out of range")||Xe.includes("Out of range")?Ee.push({field:"general",message:"Position is out of range. Cannot add liquidity to this position."}):Xe.includes("liquidity")||Xe.includes("Liquidity")?Ee.push({field:"general",message:"Cannot add liquidity. Please check amounts and position status."}):Ee.push({field:"general",message:"Cannot add liquidity. Please check amounts and try again."}):pt&&pt!==Xe?Ee.push({field:"general",message:pt}
7454):Xe&&!Xe.includes("User rejected")&&Ee.push({field:"general",message:"Cannot add liquidity. Please verify amounts and position."})}c(Ee),!ze&&xe?(console.log("[useIncreasePosition] Simulation success:",{hasRequest:!!xe.request}),Ee.length>0&&c([])):!ze&&!Ye&&c([])},[ze,Ye,xe,D,O,t==null?void 0:t.tokenId]);const{data:ft,writeContract:lt,isPending:We,error:Dt,reset:Fe}=Ls(),{data:it,isLoading:Qt}=Ts({hash:ft});M.useEffect(()=>{if(Dt){const Ee=Dt.message||Dt.toString();(Ee.includes("User rejected")||Ee.includes("user rejected")||Ee.includes("User denied")||Ee.includes("user denied")||Ee.includes("rejected"))&&(console.log("[useIncreasePosition] Transaction cancelled by user, resetting state"),o(!0),Fe(),setTimeout(()=>{o(!1),Fe()},6e3))}},[Dt,Fe]),M.useEffect(()=>{n||(o(!1),Fe())},[n,Fe]),M.useEffect(()=>{it&&it.status==="success"&&(R(),e!=null&&e.id&&i&&s.invalidateQueries({queryKey:["position",e.id.toLowerCase(),i.toLowerCase()]}))},[it,R,s,e==null?void 0:e.id,i]);const ke=M.useCallback(()=>{if(!(xe!=null&&xe.request)){if(ze){const Ee=ze instanceof Error?ze.message:String(ze);console.error("[useIncreasePosition] Cannot increase liquidity: simulation failed",{error:Ee,hasConfig:!!xe,hasRequest:!!(xe!=null&&xe.request),isSimulating:Ye,canSubmit:Z,token0NeedsApproval:N,token1NeedsApproval:$,parsedToken0Amount:v.toString(),parsedToken1Amount:_.toString(),positionTokenId:t==null?void 0:t.tokenId})}else console.error("[useIncreasePosition] Cannot increase liquidity: no request available",{hasConfig:!!xe,hasRequest:!!(xe!=null&&xe.request),simulateError:ze,isSimulating:Ye,canSubmit:Z,token0NeedsApproval:N,token1NeedsApproval:$,parsedToken0Amount:v.toString(),parsedToken1Amount:_.toString()});return}console.log("[useIncreasePosition] Calling increaseLiquidity with request"),lt(xe.request)},[xe,lt,ze,Ye,Z,N,$,v,_,t]),nt=M.useCallback(Ee=>{var Xe;console.log("[useIncreasePosition] setToken0Amount called:",{amount:Ee,hasSdkPool:!!G,hasPool:!!e,poolSqrtPrice:e==null?void 0:e.sqrtPrice,poolLiquidity:e==null?void 0:e.liquidity,lastEditedField:C});let $e;try{$e=BigInt(Ee).toString(),console.log("[useIncreasePosition] setToken0Amount: amount is already in wei:",$e)}catch{try{const ot=((Xe=e==null?void 0:e.token0Ref)==null?void 0:Xe.decimals)||18;$e=hs(Ee,ot).toString(),console.log("[useIncreasePosition] setToken0Amount: converted decimal to wei:",{decimal:Ee,wei:$e,decimals:ot})}catch(ot){console.error("[useIncreasePosition] setToken0Amount: failed to parse amount:",ot,{amount:Ee}),$e="0"}}if(h($e),E("token0"),Ee&&Ee!=="0"&&G&&e&&e.token0Ref&&e.token1Ref)try{const ot=I(Ee);console.log("[useIncreasePosition] setToken0Amount: calculated token1:",ot,{inputAmount:Ee,calculatedAmount:ot,isZero:ot==="0"}),ot&&ot!=="0"?g(ot):console.warn("[useIncreasePosition] setToken0Amount: calculation returned 0, keeping current token1AmountString")}catch(ot){console.error("[useIncreasePosition] setToken0Amount: error calculating token1:",ot)}else!Ee||Ee==="0"?g("0"):console.warn("[useIncreasePosition] setToken0Amount: cannot calculate, missing dependencies:",{hasPool:!!e,hasToken0Ref:!!(e!=null&&e.token0Ref),hasToken1Ref:!!(e!=null&&e.token1Ref),hasSdkPool:!!G,sqrtPrice:e==null?void 0:e.sqrtPrice,liquidity:e==null?void 0:e.liquidity,feeTier:e==null?void 0:e.feeTier,tick:e==null?void 0:e.tick})},[I,G,e]),ht=M.useCallback(Ee=>{var Xe;console.log("[useIncreasePosition] setToken1Amount called:",{amount:Ee,hasSdkPool:!!G,hasPool:!!e,poolSqrtPrice:e==null?void 0:e.sqrtPrice,poolLiquidity:e==null?void 0:e.liquidity,lastEditedField:C});let $e;try{$e=BigInt(Ee).toString(),console.log("[useIncreasePosition] setToken1Amount: amount is already in wei:",$e)}catch{try{const ot=((Xe=e==null?void 0:e.token1Ref)==null?void 0:Xe.decimals)||18;$e=hs(Ee,ot).toString(),console.log("[useIncreasePosition] setToken1Amount: converted decimal to wei:",{decimal:Ee,wei:$e,decimals:ot})}catch(ot){console.error("[useIncreasePosition] setToken1Amount: failed to parse amount:",ot,{amount:Ee}),$e="0"}}if(g($e),E("token1"),Ee&&Ee!=="0"&&G){const ot=S(Ee);console.log("[useIncreasePosition] setToken1Amount: calculated token0:",ot),h(ot)}else!Ee||Ee==="0"?h("0"):console.warn("[useIncreasePosition] setToken1Amount: cannot calculate, sdkPool is null. Pool data:",{hasPool:!!e,hasToken0Ref:!!(e!=null&&e.token0Ref),hasToken1Ref:!!(e!=null&&e.token1Ref),sqrtPrice:e==null?void 0:e.sqrtPrice,liquidity:e==null?void 0:e.liquidity,feeTier:e==null?void 0:e.feeTier,tick:e==null?void 0:e.tick})},[S,G,e]),At=M.useCallback(Ee=>{w(Ee)},[]),zt=M.useCallback(()=>{Fe(),h("0"),g("0"),w(.5),o(!1)},[Fe]),Ln=M.useRef("idle"),gn=M.useMemo(()=>{var $e,Xe,ot,pt,Ot;return r&&Dt&&((($e=Dt.message)==null?void 0:$e.includes("User rejected"))||((Xe=Dt.message)==null?void 0:Xe.includes("user rejected"))||((ot=Dt.message)==null?void 0:ot.includes("User denied"))||((pt=Dt.message)==null?void 0:pt.includes("user denied"))||((Ot=Dt.message)==null?void 0:Ot.includes("rejected")))||r?"cancelled":re||Ne?(Ln.
7454current="waitingApproval","waitingApproval"):ee||be?(Ln.current="approving","approving"):Qt?(Ln.current="waitingIncrease","waitingIncrease"):We?(Ln.current="increasing","increasing"):it?(Ln.current="success","success"):Ye?(Ln.current="simulating","simulating"):(Ln.current="idle","idle")},[re,Ne,ee,be,Qt,We,Ye,it,Dt,r]);return{parsedToken0Amount:v,parsedToken1Amount:_,recalculatedAmounts:j,slippageTolerance:b,token0Balance:P,token1Balance:B,token0NeedsApproval:N,token1NeedsApproval:$,validationErrors:J,canSubmit:Z,status:gn,isLoading:gn!=="idle"&&gn!=="success"&&gn!=="cancelled",isSuccess:gn==="success",setToken0Amount:nt,setToken1Amount:ht,setSlippageTolerance:At,approveToken0:de,approveToken1:Te,increaseLiquidity:ke,reset:zt,increaseLiquidityHash:ft,increaseLiquidityReceipt:it,errors:{approveToken0:ie,approveToken1:_e,simulate:ze,increase:Dt},canApproveToken0:!!i&&v>0n&&N,canApproveToken1:!!i&&_>0n&&$,canIncrease:!!(xe!=null&&xe.request)}},vKe=({position:t,pool:e,isModalOpen:n})=>{const{address:i}=mn(),s=x5e(),[r,o]=M.useState(!1),{data:a,refetch:c}=Si({address:vt.positionManager,abi:Eu,functionName:"positions",args:t?[BigInt(t.tokenId)]:void 0,query:{enabled:!!t&&n,refetchInterval:!1,refetchOnWindowFocus:!1}}),l=M.useMemo(()=>t?a&&Array.isArray(a)?a[7]:BigInt(t.liquidity):0n,[a,t]),[d,h]=M.useState(0),[p,g]=M.useState(3);M.useEffect(()=>{n||(h(0),g(3))},[n]),M.useEffect(()=>{n&&c()},[n,c]);const b=M.useMemo(()=>d===0?0n:l*BigInt(d)/100n,[d,l]),[w,C]=M.useState({token0Amount:0n,token1Amount:0n});M.useEffect(()=>{(async()=>{if(!s||!i||!t||b===0n){C({token0Amount:0n,token1Amount:0n});return}try{const D=await s.simulateContract({address:vt.positionManager,abi:Eu,functionName:"decreaseLiquidity",args:[{tokenId:BigInt(t.tokenId),liquidity:b,amount0Min:0n,amount1Min:0n,deadline:BigInt(Math.floor(Date.now()/1e3)+1200)}],account:i});D.result&&Array.isArray(D.result)&&C({token0Amount:D.result[0],token1Amount:D.result[1]})}catch(D){console.error("Failed to simulate decreaseLiquidity:",D),C({token0Amount:0n,token1Amount:0n})}})()},[s,i,b,t]);const E=w,T=M.useMemo(()=>{var D;const j=[];return t?i?d===0?(j.push({field:"percentage",message:"Select percentage to withdraw"}),j):d<0||d>100?(j.push({field:"percentage",message:"Percentage must be between 0 and 100"}),j):(((D=t.owner)==null?void 0:D.toLowerCase())!==(i==null?void 0:i.toLowerCase())&&j.push({field:"general",message:"Position does not belong to you"}),l===0n&&j.push({field:"general",message:"Position has no liquidity to withdraw"}),j):(j.push({field:"general",message:"Please connect your wallet"}),j):j},[i,d,t,l]),A=Array.isArray(T)&&T.length===0&&d>0,k=M.useMemo(()=>{if(!t||!A||b===0n)return;const j=BigInt(Math.floor((100-p)*100)),D=w.token0Amount*j/10000n,O=w.token1Amount*j/10000n;console.log("ð Decrease position:",{percentage:d,liquidityToWithdraw:b.toString(),currentLiquidity:l.toString(),cachedLiquidity:t.liquidity,exactToken0Amount:w.token0Amount.toString(),exactToken1Amount:w.token1Amount.toString(),amount0Min:D.toString(),amount1Min:O.toString(),slippageTolerance:p});const H=_i({abi:Eu,functionName:"decreaseLiquidity",args:[{tokenId:BigInt(t.tokenId),liquidity:b,amount0Min:D,amount1Min:O,deadline:BigInt(Math.floor(Date.now()/1e3)+1200)}]}),J=_i({abi:Eu,functionName:"collect",args:[{tokenId:BigInt(t.tokenId),recipient:i,amount0Max:BigInt("340282366920938463463374607431768211455"),amount1Max:BigInt("340282366920938463463374607431768211455")}]});return[H,J]},[A,b,w,p,t,i,d,l]),{data:R,isLoading:P,error:B}=$r({address:vt.positionManager,abi:Eu,functionName:"multicall",args:k?[k]:void 0,query:{enabled:A&&!!k,retry:!1}}),{data:F,writeContract:z,isPending:K,error:q,reset:G}=Ls(),{data:I,isLoading:S}=Ts({hash:F}),v=M.useCallback(()=>{R!=null&&R.request&&z(R.request)},[R,z]),_=M.useCallback(j=>{h(Math.max(0,Math.min(100,j)))},[]),N=M.useCallback(j=>{g(j)},[]),$=M.useCallback(()=>{G(),h(0),g(3),o(!1)},[G]);M.useEffect(()=>{if(q){const j=q.message||q.toString();(j.includes("User rejected")||j.includes("user rejected")||j.includes("User denied")||j.includes("user denied")||j.includes("rejected"))&&(console.log("[useDecreasePosition] Transaction cancelled by user, resetting state"),o(!0),G(),setTimeout(()=>{o(!1),G()},6e3))}},[q,G]),M.useEffect(()=>{n||(o(!1),G())},[n,G]);const U=M.useMemo(()=>{var D,O,H,J,W;return r&&q&&(((D=q.message)==null?void 0:D.includes("User rejected"))||((O=q.message)==null?void 0:O.includes("user rejected"))||((H=q.message)==null?void 0:H.includes("User denied"))||((J=q.message)==null?void 0:J.includes("user denied"))||((W=q.message)==null?void 0:W.includes("rejected")))||r?"cancelled":S?"waitingDecrease":K?"decreasing":P?"simulating":I?"success":"idle"},[S,K,P,I,q,r]);return t?{percentage:d,slippageTolerance:p,liquidityToWithdraw:b,estimatedAmounts:E,validationErrors:T,canSubmit:A,status:U,isLoading:U!=="idle"&&U!=="success"&&U!=="cancelled",isSuccess:U==="success",setPercentage:_,setSlippageTolerance:N,decreaseLiquidity:v,reset:$,decreaseHash:F,decreaseReceipt:I,errors:{simulate:B,decrease:q},canDecrease:!!(R!=null&&R.request)}:{percentage:0,slippageTolerance:3,liquidityToWithdraw:0n,estimatedAmounts:{token0Amount:0n,token1Amount:0n},validationErrors:[],canSubmit:!1,status:"idle",isLoading:!1,isSuccess:!1,setPercentage:_,setSlippageTolerance:N,decreaseLiquidity:()=>{},reset:$,decreaseHash:void 0,decreaseReceipt:void 0,errors:{simulate:void 0,decrease:void 0},canDecrease:!1}},Tl=[{inputs:[{internalType:"contract IWETH",name:"_wBera",type:"address"},{internalType:"address",name:"_winnieRouter",type:"address"},{internalType:"address",name:"_autoWinFactory",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"amount0Max",type:"uint256"},{internalType:"uint256",name:"amount1Max",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquidity",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}
7454,{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"amount0Max",type:"uint256"},{internalType:"uint256",name:"amount1Max",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquidityNative",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"totalAmountIn",type:"uint256"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"uint256",name:"maxStakingSlippageBPS",type:"uint256"},{components:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"minAmountOut",type:"uint256"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"bytes",name:"routeData",type:"bytes"}],internalType:"struct RouterSwapParams",name:"swapData",type:"tuple"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquiditySingle",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"uint256",name:"maxStakingSlippageBPS",type:"uint256"},{components:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"minAmountOut",type:"uint256"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"bytes",name:"routeData",type:"bytes"}],internalType:"struct RouterSwapParams",name:"swapData",type:"tuple"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquiditySingleNative",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[],name:"autoWinFactory",outputs:[{internalType:"contract IAutoWinFactory",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"autoWin",type:"address"},{internalType:"uint256",name:"assets",type:"uint256"},{internalType:"uint256",name:"minSharesOut",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"depositIntoAutoWin",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"autoWin",type:"address"},{internalType:"uint256",name:"minSharesOut",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"depositIntoAutoWinSelf",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"autoWin",type:"address"},{internalType:"uint256",name:"shares",type:"uint256"},{internalType:"uint256",name:"minAssetsOut",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"redeemFromAutoWin",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"burnAmount",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"removeLiquidity",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint128",name:"liquidityBurned",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"burnAmount",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address payable",name:"receiver",type:"address"}],name:"removeLiquidityNative",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint128",name:"liquidityBurned",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wBera",outputs:[{internalType:"contract IWETH",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"winnieRouter",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],$p=({tokenAddress:t,spenderAddress:e,amount:n,enabled:i=!0})=>{const{address:s}=mn(),r=M.useRef(!1),{data:o,isLoading:a,refetch:c}=Si({address:t,abi:Ks,functionName:"allowance",args:s&&t?[s,e]:void 0,query:{enabled:i&&!!s&&!!t,refetchInterval:k=>k.state.data===void 0?!1:2e3}}),l=(o||0n)<n,{data:d,isLoading:h,error:p}=$r({address:t,abi:Ks,functionName:"approve",args:t?[e,2n**256n-1n]:void 0,chainId:Nn.id,query:{enabled:i&&l&&!!t}}),{data:g,writeContract:b,isPending:w,error:C,reset:E}=Ls(),{status:T}=Ts({hash:g,query:{enabled:!!g}});return M.useEffect(()=>{T==="success"&&!r.current&&(r.current=!0,setTimeout(()=>{c(),setTimeout(()=>{E(),r.current=!1},500)},1e3))},[T,c,E]),M.useEffect(()=>{(T==="idle"||T==="error")&&(r.current=!1)},[T]),{allowance:o,isNeedApproval:l,isLoading:a,isApproving:w,approveHash:g,approveStatus:T,approveError:C??null,approve:()=>{if(d!=null&&d.request)try{b(d.request)}catch{}},refetch:c,reset:E,isApproveReady:!!(d!=null&&d.request)&&!h}},Wd=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"Reentrancy",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"receiver",type:"address"},{indexed:!1,internalType:"uint256",name:"burnAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount0Out",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1Out",type:"uint256"},{indexed:!1,internalType:"uint128",name:"liquidityBurned",type:"uint128"}],name:"Burned",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"feesEarned0",type:"uint256"},{indexed:!1,internalType:"uint256",name:"feesEarned1",type:"uint256"}],name:"FeesEarned",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"receiver",type:"address"}
7454,{indexed:!1,internalType:"uint256",name:"mintAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount0In",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount1In",type:"uint256"},{indexed:!1,internalType:"uint128",name:"liquidityMinted",type:"uint128"}],name:"Minted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousManager",type:"address"},{indexed:!0,internalType:"address",name:"newManager",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pauser",type:"address"},{indexed:!1,internalType:"bool",name:"status",type:"bool"}],name:"PauserSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"compounder",type:"address"},{indexed:!1,internalType:"int24",name:"lowerTick_",type:"int24"},{indexed:!1,internalType:"int24",name:"upperTick_",type:"int24"},{indexed:!1,internalType:"uint128",name:"liquidityBefore",type:"uint128"},{indexed:!1,internalType:"uint128",name:"liquidityAfter",type:"uint128"}],name:"Rebalance",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"status",type:"bool"}],name:"RestrictedMintSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"router",type:"address"},{indexed:!1,internalType:"bool",name:"status",type:"bool"}],name:"RouterSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"managerFeeBPS",type:"uint16"},{indexed:!1,internalType:"address",name:"managerTreasury",type:"address"},{indexed:!1,internalType:"uint16",name:"compounderSlippageBPS",type:"uint16"},{indexed:!1,internalType:"uint32",name:"compounderSlippageInterval",type:"uint32"}],name:"UpdateManagerParams",type:"event"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"result",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"burnAmount",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"burn",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint128",name:"liquidityBurned",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"compounderSlippageBPS",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"compounderSlippageInterval",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"int24",name:"newLowerTick",type:"int24"},{internalType:"int24",name:"newUpperTick",type:"int24"},{internalType:"uint160",name:"swapThresholdPrice",type:"uint160"},{internalType:"uint256",name:"swapAmountBPS",type:"uint256"},{internalType:"bool",name:"zeroForOne",type:"bool"}],name:"executiveRebalance",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int24",name:"newLowerTick",type:"int24"},{internalType:"int24",name:"newUpperTick",type:"int24"},{components:[{internalType:"address",name:"router",type:"address"},{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"minAmountOut",type:"uint256"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"bytes",name:"routeData",type:"bytes"}],internalType:"struct SwapData",name:"swapData",type:"tuple"}],name:"executiveRebalanceWithRouter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint32",name:"interval",type:"uint32"}],name:"getAvgPrice",outputs:[{internalType:"uint160",name:"avgSqrtPriceX96",type:"uint160"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"amount0Max",type:"uint256"},{internalType:"uint256",name:"amount1Max",type:"uint256"}],name:"getMintAmounts",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}
7454,{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getPositionID",outputs:[{internalType:"bytes32",name:"positionID",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getUnderlyingBalances",outputs:[{internalType:"uint256",name:"amount0Current",type:"uint256"},{internalType:"uint256",name:"amount1Current",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint160",name:"sqrtRatioX96",type:"uint160"}],name:"getUnderlyingBalancesAtPrice",outputs:[{internalType:"uint256",name:"amount0Current",type:"uint256"},{internalType:"uint256",name:"amount1Current",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"_name",type:"string"},{internalType:"string",name:"_symbol",type:"string"},{internalType:"address",name:"_pool",type:"address"},{internalType:"uint16",name:"_managerFeeBPS",type:"uint16"},{internalType:"int24",name:"_lowerTick",type:"int24"},{internalType:"int24",name:"_upperTick",type:"int24"},{internalType:"address",name:"_manager_",type:"address"},{internalType:"address",name:"_managerTreasury",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isManaged",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"lowerTick",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[],name:"manager",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"managerBalance0",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"managerBalance1",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"managerFeeBPS",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"managerTreasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"mintAmount",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"mint",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint128",name:"liquidityMinted",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"pauser",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pool",outputs:[{internalType:"contract IUniswapV3Pool",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"rebalance",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"restrictedMint",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_pauser",type:"address"},{internalType:"bool",name:"_status",type:"bool"}],name:"setPauser",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"_status",type:"bool"}],name:"setRestrictedMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_router",type:"address"},{internalType:"bool",name:"_status",type:"bool"}],name:"setRouter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stickyVaultFactory",outputs:[{internalType:"contract IStickyVaultFactory",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"swapRouter",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"syncToFactory",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"token0",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"token1",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount0Owed",type:"uint256"},{internalType:"uint256",name:"amount1Owed",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"uniswapV3MintCallback",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int256",name:"amount0Delta",type:"int256"},{internalType:"int256",name:"amount1Delta",type:"int256"},{internalType:"bytes",name:"",type:"bytes"}],name:"uniswapV3SwapCallback",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"int16",name:"newManagerFeeBPS",type:"int16"},{internalType:"address",name:"newManagerTreasury",type:"address"},{internalType:"int16",name:"newSlippageBPS",type:"int16"},{internalType:"int32",name:"newSlippageInterval",type:"int32"}],name:"updateManagerParams",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"upperTick",outputs:[{internalType:"int24",name:"",type:"int24"}],stateMutability:"view",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"withdrawManagerBalance",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint16",name:"slippageBPS",type:"uint16"},{internalType:"uint160",name:"avgSqrtPriceX96",type:"uint160"},{internalType:"bool",name:"zeroForOne",type:"bool"}],name:"worstAmountOut",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"}],hoe=({vaultAddress:t,amount0:e,amount1:n,enabled:i=!0})=>{const s=i&&!!t&&e>0n&&n>0n,{data:r,isLoading:o,isError:a,refetch:c}=Si({address:t,abi:Wd,functionName:"getMintAmounts",args:[e,n],query:{enabled:s}});return{quote:r?{amount0:r[0],amount1:r[1],shares:r[2]}:void 0,isLoading:o,isError:a,refetch:c}},y4=(t=100)=>{const e=M.useMemo(()=>(s,r=t)=>s===0n?0n:s*BigInt(1e4-r)/10000n,[t]),n=M.useMemo(()=>(s,r=t)=>e(s,r),[e,t]),i=M.useMemo(()=>(s,r=t)=>s===0n?0n:s*BigInt(1e4+r)/10000n,[t]);return{applySlippage:e,calculateMinAmount:n,calculateMaxAmount:i}},Df=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"DepositMoreThanMax",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"MintMoreThanMax",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"RedeemMoreThanMax",type:"error"},{inputs:[],name:"Reentrancy",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{inputs:[],name:"WithdrawMoreThanMax",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"_bgtWrapper",type:"address"}],name:"AllowedBgtWrapperUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"bountySender",type:"address"},{indexed:!0,internalType:"address",name:"bgtRecipient",type:"address"},{indexed:!0,internalType:"uint256",name:"compoundAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"compoundFee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenToRecipient",type:"uint256"}],name:"BgtClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"bountySender",type:"address"},{indexed:!0,internalType:"address",name:"bgtRecipient",type:"address"},{indexed:!0,internalType:"uint256",name:"compoundAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"compoundFee",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenToRecipient",type:"uint256"},{indexed:!1,internalType:"address",name:"bgtWrapper",type:"address"}],name:"BgtWrapperClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"bounty",type:"uint256"}],name:"BountyUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"compoundFeeBps",type:"uint256"}],name:"CompoundFeeBpsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"by",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint256",name:"assets",type:"uint256"},{indexed:!1,internalType:"uint256",name:"shares",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"ExitFeeBpsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"assets",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"ExitFeePaid",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"by",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint256",name:"assets",type:"uint256"},{indexed:!1,internalType:"uint256",name:"shares",type:"uint256"}],name:"Withdraw",type:"event"},{inputs:[],name:"BGT",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"BPS_DENOMINATOR",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"result",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"asset",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"bounty",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"bgtRecipient",type:"address"},{internalType:"uint256",name:"minAmountOut",type:"uint256"}],name:"claimBgt",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"bgtWrapper",type:"address"},{internalType:"address",name:"bgtRecipient",type:"address"},{internalType:"uint256",name:"minAmountOut",type:"uint256"}],name:"claimBgtWrapper",outputs:[{internalType:"uint256",name:"bgtWrapperMinted",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"compoundFeeBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"}],name:"convertToShares",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"},{internalType:"address",name:"to",type:"address"}],name:"deposit",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"earned",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"exitFeeBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"factory",outputs:[{internalType:"contract IAutoWinFactory",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"address",name:"_stakingToken",type:"address"},{internalType:"address",name:"_rewardVault",type:"address"},{internalType:"uint256",name:"_bounty",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lastClaim",outputs:[{internalType:"uint256",name:"bgt",type:"uint256"},{internalType:"uint256",name:"bountyPaid",type:"uint256"},{internalType:"uint256",name:"compoundFee",type:"uint256"},{internalType:"uint256",name:"claimTimestamp",type:"uint256"},{internalType:"address",name:"wrapper",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"maxDeposit",outputs:[{internalType:"uint256",name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"}],name:"maxMint",outputs:[{internalType:"uint256",name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"maxRedeem",outputs:[{internalType:"uint256",name:"maxShares",type:"uint256"}],stateMutabili
7454ty:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"maxWithdraw",outputs:[{internalType:"uint256",name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"},{internalType:"address",name:"to",type:"address"}],name:"mint",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"onlyAllowedBgtWrapper",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"bgtWrapper",type:"address"}],name:"previewClaimBgtWrapper",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"}],name:"previewDeposit",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"}],name:"previewMint",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"}],name:"previewRedeem",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"}],name:"previewWithdraw",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"to",type:"address"}],name:"recoverErc20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"},{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"redeem",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rewardVault",outputs:[{internalType:"contract IRewardVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_bgtWrapper",type:"address"}],name:"setAllowedBgtWrapper",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_bounty",type:"uint256"}],name:"setBounty",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_compoundFeeBps",type:"uint256"}],name:"setCompoundFeeBps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_exitFeeBps",type:"uint256"}],name:"setExitFeeBps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stakingToken",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalAssets",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"},{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"withdraw",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"}];function dL({autoWinVault:t,stickyShares:e,slippageBps:n}){const{data:i,isLoading:s}=Si({address:t,abi:Df,functionName:"previewDeposit",args:e?[e]:void 0,query:{enabled:!!t&&!!e&&e>0n}});
7454return{minShares:M.useMemo(()=>{if(!i||i===0n)return;const o=BigInt(1e4-n);return i*o/10000n},[i,n]),isLoading:s}}const Mx="https://api.enso.finance",Lm=class Lm{constructor(){PA(this,"apiKey");let e="dfaf3fb4-8442-433a-8a4d-1099762457e6a";if(e&&e.endsWith("a")&&e.length>1&&(e=e.slice(0,-1),console.log('ð§ Fixed Enso API key: removed trailing "a"')),this.apiKey=e,this.apiKey&&this.apiKey.trim().length>0){const n=this.apiKey.length>8?`${this.apiKey.substring(0,4)}...${this.apiKey.substring(this.apiKey.length-4)}`:"***";console.log(`â
Enso API key loaded (${n})`)}else console.warn("â ï¸ Enso API key not set. Set VITE_ENSO_API_KEY in your .env file for authenticated requests.")}static getInstance(){return Lm.instance||(Lm.instance=new Lm),Lm.instance}getHeaders(){const e={"Content-Type":"application/json"};return this.apiKey&&typeof this.apiKey=="string"&&this.apiKey.trim().length>0&&(e.Authorization=`Bearer ${this.apiKey.trim()}`),e}addApiKeyToQuery(e){if(this.apiKey&&typeof this.apiKey=="string"&&this.apiKey.trim().length>0){const n=e.includes("?")?"&":"?";return`${e}${n}apikey=${encodeURIComponent(this.apiKey.trim())}`}return e}async getRouteData(e){var i,s;const n=[`${Mx}/api/v1/shortcuts/route`,`${Mx}/api/v1/route`,`${Mx}/shortcuts/route`,`${Mx}/route`];if(this.apiKey){const r=this.apiKey.length>8?`${this.apiKey.substring(0,4)}...${this.apiKey.substring(this.apiKey.length-4)}`:"***";console.log(`[EnsoService] Using API key: ${r} (length: ${this.apiKey.length})`)}else console.warn("[EnsoService] â ï¸ No API key available - requests may be rate-limited or fail");for(let r of n)try{const o=r;if(r=this.addApiKeyToQuery(r),r!==o){const l=new URL(r),d=l.searchParams.get("apikey");if(d){const h=d.length>8?`${d.substring(0,4)}...${d.substring(d.length-4)}`:"***";console.log(`[EnsoService] Calling endpoint: ${l.pathname} with apikey: ${h}`)}}const a=await fetch(r,{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if(a.ok){const l=await a.json();if(e.routingStrategy&&e.routingStrategy!=="router"&&console.warn(`â ï¸ routingStrategy in request is '${e.routingStrategy}', not 'router'`),((i=l.tx)==null?void 0:i.operationType)===1)throw console.error("â Route returned operationType: 1 (delegatecall)"),new Error("Route returned delegatecall, but we requested router strategy. This route cannot be used with EOA wallets.");return l}if(a.status===404)continue;const c=await a.text();throw new Error(`Enso route error (${a.status}): ${c}`)}catch(o){if(n.indexOf(r)===n.length-1||!((s=o.message)!=null&&s.includes("404")))throw console.error(`â Error calling Enso Route API at ${r}:`,o),o;continue}throw new Error("All Enso route endpoints failed")}async zapIntoVault(e){var A,k;const{fromAddress:n,receiver:i=n,tokenInAddress:s,tokenInDecimals:r,vaultAddress:o,amount:a,chainId:c=Nn.id,slippageBps:l=200,routingStrategy:d="router"}=e;if(!n)throw new Error("fromAddress is required to build an Enso route");if(!s)throw new Error("tokenInAddress is required to build an Enso route");if(!o)throw new Error("vaultAddress is required to build an Enso route");const h=s.toLowerCase(),p=o.toLowerCase(),g=a.trim(),b=hs(g,r).toString(),w={fromAddress:n,receiver:i,...d==="delegate"&&{spender:n},chainId:c,amountIn:[b],tokenIn:[h],tokenOut:[p],slippage:l.toString(),routingStrategy:d},C=d||"router";if(C!=="router")throw new Error(`Invalid routingStrategy: ${C}. For EOA wallets, routingStrategy must be 'router'.`);let E=await this.getRouteData(w);if(((A=E.tx)==null?void 0:A.operationType)===1)if(d==="delegate"){if(w.routingStrategy="router",delete w.spender,E=await this.getRouteData(w),((k=E.tx)==null?void 0:k.operationType)===1)throw new Error("Enso route requires delegatecall which is not supported from external wallets.")}else throw new Error("Enso API returned a delegatecall route even with router strategy. This is not supported for external wallets.");return E}};PA(Lm,"instance");let jI=Lm;function CKe(t,e){const[n,i]=M.useState(t),s=M.useRef(void 0);return M.useEffect(()=>(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{i(t)},e),()=>{s.current&&clearTimeout(s.current)}),[t,e]),M.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),n}const xKe=({tokenIn:t,tokenInDecimals:e,vaultAddress:n,amount:i,slippageBps:s=200,enabled:r=!0})=>{var N;const{address:o}=mn(),a=jI.getInstance(),c=r&&!!o&&!!t&&!!n&&i>0n,l=i>0n?dt(i,e):"0",d=CKe(l,500),h="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",p="0x0000000000000000000000000000000000000000",g=M.useMemo(()=>
7454{if(t)return t.toLowerCase()===p.toLowerCase()||t.toLowerCase()===Mn.toLowerCase()?h:t},[t]),b=M.useRef(null),w=M.useRef(null);M.useEffect(()=>{},[r,o,t,g,n,i,l,d,c]);const C=M.useMemo(()=>`${g}-${n}-${d}-${s}-${o}`,[g,n,d,s,o]),{data:E,isLoading:T,error:A,refetch:k}=Zt({queryKey:["ensoRoute",g,n,d,s,o],queryFn:async()=>{var $,U,j,D,O,H,J;if(b.current===C)throw console.warn("[useEnsoZap] Duplicate request detected, skipping:",C),new Error("Duplicate request");if(w.current===C&&b.current)throw console.warn("[useEnsoZap] Same request already in progress, skipping:",C),new Error("Request already in progress");if(b.current=C,w.current=C,!o||!g||!n||i===0n||d==="0"){b.current=null;const W=new Error("Missing required parameters for Enso route");throw console.error("[useEnsoZap] Missing parameters:",{address:!!o,normalizedTokenIn:!!g,vaultAddress:!!n,amount:i.toString(),debouncedAmountDecimal:d}),W}try{const W=await a.zapIntoVault({fromAddress:o,receiver:o,tokenInAddress:g,tokenInDecimals:e,vaultAddress:n,amount:d,chainId:Nn.id,slippageBps:s,routingStrategy:"router"}),Z="0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf",Y=(U=($=W==null?void 0:W.tx)==null?void 0:$.to)==null?void 0:U.toLowerCase(),Q=Z.toLowerCase(),ee="0xb94c3609",ie=(D=(j=W==null?void 0:W.tx)==null?void 0:j.data)==null?void 0:D.substring(0,10);return Y!==Q&&console.error("[useEnsoZap] â Route router mismatch!",{expected:Z,actual:(O=W==null?void 0:W.tx)==null?void 0:O.to,route:W}),ie!==ee&&console.error("[useEnsoZap] â Route selector mismatch!",{expected:ee,actual:ie,dataPreview:(J=(H=W==null?void 0:W.tx)==null?void 0:H.data)==null?void 0:J.substring(0,100)}),b.current=null,W}catch(W){throw b.current=null,W}},enabled:c&&!!g&&d!=="0",staleTime:30*1e3,retry:1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),R=(N=E==null?void 0:E.tx)==null?void 0:N.to,P=$p({tokenAddress:t,spenderAddress:R||"0x0000000000000000000000000000000000000000",amount:i,enabled:c&&!!R}),B=!P.isNeedApproval,F=M.useMemo(()=>{if(!(!(E!=null&&E.tx)||!R||!B))return{to:R,data:E.tx.data,value:E.tx.value?BigInt(E.tx.value):0n,gas:E.tx.gas?BigInt(E.tx.gas):void 0,gasPrice:E.tx.gasPrice?BigInt(E.tx.gasPrice):void 0,maxFeePerGas:E.tx.maxFeePerGas?BigInt(E.tx.maxFeePerGas):void 0,maxPriorityFeePerGas:E.tx.maxPriorityFeePerGas?BigInt(E.tx.maxPriorityFeePerGas):void 0}},[E,R,B]),{sendTransaction:z,data:K,isPending:q,error:G,reset:I}=_5e(),{isLoading:S,isSuccess:v}=Ts({hash:K,query:{enabled:!!K}}),_=()=>{var D,O,H,J,W;const $="0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf",U="0xb94c3609";if(!F){console.error("[useEnsoZap] Cannot execute zap: missing transaction request",{hasRouteData:!!E,hasEnsoRouterAddress:!!R,isAllow:B,routeData:E?{hasTx:!!E.tx,hasData:!!((D=E.tx)!=null&&D.data),router:(O=E.tx)==null?void 0:O.to}:null});return}if(((H=F.to)==null?void 0:H.toLowerCase())!==$.toLowerCase()){console.error("[useEnsoZap] â Transaction NOT going to Enso Router!",{expected:$,actual:F.to,transactionRequest:F});return}const j=(J=F.data)==null?void 0:J.substring(0,10);if(j!==U){console.error("[useEnsoZap] â Transaction NOT using routeSingle!",{expected:U,actual:j,dataPreview:(W=F.data)==null?void 0:W.substring(0,100)});return}z(F)};return{route:{data:E,isLoading:T,error:A,refetch:k},allowance:{isNeed:P.isNeedApproval,allow:P.approve,isLoading:P.isLoading,isApprove:P.isApproving,isApproveReady:!!R&&P.isApproveReady,hash:P.approveHash,error:P.approveError,reset:P.reset},isAllow:B,zap:{execute:_,isPending:q,isLoading:S,isSuccess:v,hash:K,error:G,reset:I}}},EKe=({vault:t,tokenIn:e,tokenOut:n,amount:i,isToken0:s,slippageBps:r,autoWin:o,useEnso:a=!0,tokenInDecimals:c=18})=>{var Q,ee,ie,re,oe,de,he,ue,be;const{address:l}=mn(),{calculateMinAmount:d}=y4(r),h=!!l&&!!t&&!!e&&i>0n;M.useEffect(()=>{},[a,h,t,e,n,i,c]);const p=xKe({tokenIn:e,tokenInDecimals:c,vaultAddress:(o==null?void 0:o.vaultAddress)||t,amount:i,slippageBps:r,enabled:a&&h}),g=M.useMemo(()=>{if(!a||!p.route.data)return null;const _e=p.route.data;let Ne=null;if(typeof _e.priceImpact=="number")Ne=_e.priceImpact;else if(typeof _e.priceImpact=="string"){const pe=parseFloat(_e.priceImpact);isNaN(pe)||(Ne=pe)}if(Ne===null&&_e.route&&Array.isArray(_e.route)&&_e.route.length>0){const pe=_e.route[0];if(typeof pe.priceImpact=="number")Ne=pe.priceImpact;else if(typeof pe.priceImpact=="string"){const Te=parseFloat(pe.priceImpact);isNaN(Te)||(Ne=Te)}}if(Ne===null&&_e.amountOut&&i>0n)try{const pe=BigInt(_e.amountOut);if(pe>0n){const Te=Number((i-pe)*10000n/i)/100;Te>0&&Te<100&&(Ne=Te)}}catch{}return Ne},[a,p.route.data,i]),b=M.useMemo(()=>{var _e;if(!a||!((_e=p.route.data)!=null&&_e.amountOut))return null;try{return BigInt(p.route.data.amountOut)}catch{return null}},[a,p.route.data]),w=M.useMemo(()=>b?d(b,r):null,[b,d,r]);M.useEffect(()=>{h&&!a&&e&&t&&(e.toLowerCase(),n!=null&&n.toLowerCase())},[h,a,e,n,t]);const C=h&&!!n&&!a,E=i/2n,T=i-E,A=!a&&C,k=CE({tokenIn:e,tokenOut:n,amountIn:E,enabled:A}),R=M.useMemo(()=>{var xe,Ye,ze,ft;if(a||k.status!=="ready"||!((xe=k==null?void 0:k.quote)!=null&&xe.amountOut)||!((Ye=k.optimizedRoute)!=null&&Ye.transactionData))return null;const _e=k.optimizedRoute.transactionData,Ne=_e.functionName==="swap"&&((ze=_e.abi)==null?void 0:ze.length)===0&&((ft=_e.args)==null?void 0:ft.length)>0;let pe=_e.swapCallData,Te=_e.swapRouter||vt.swapRouter02;const ve=vt.swapFeeRouter;if(Te.toLowerCase()===ve.toLowerCase()&&(console.error("[useSingleDeposit] â SwapFeeRouter détecté dans swapData pour un dépôt! Utilisation du router sous-jacent à la place."),Te=vt.swapRouter02),!pe&&_e.args){if(Ne)pe=_e.args[0];else if(_e.args.length>0){const lt=_e.args[_e.args.length-1];typeof lt=="string"&<.startsWith("0x")&&(pe=lt)}}return pe?{router:Te,amountIn:E,minAmountOut:d(k.quote.amountOutMinimum,100),zeroForOne:s,routeData:pe}:null},[a,k,E,s,d]),{quote:P}=hoe({vaultAddress:t,amount0:s?T:((Q=k.quote)==null?void 0:Q.amountOut)??0n,amount1:s?((ee=k.quote)==null?void 0:ee.amountOut)??0n:T,enabled:!a&&h&&!!k.quote&&!!R}),B=P?d(P.shares,r):null,F=!a&&!!(P!=null&&P.shares)&&!!R;M.useEffect(()=>{!a&&k.status},[a,k.status,R,P,B,F,(ie=k.quote)==null?void 0:ie.amountOut,k.optimizedRoute,A]);const{minShares:z}=dL({autoWinVault:o==null?void 0:o.vaultAddress,stickyShares:B||void 0,slippageBps:(o==null?void 0:o.slippageBps)||100}),K=a&&((oe=(re=p.route.data)==null?void 0:re.tx)==null?void 0:oe.to)||vt.AUTOWIN_ROUTER,q=a&&((he=(de=p.route.data)==null?void 0:de.tx)!=null&&he.to)?p.route.data.tx.to:void 0,G=$p({tokenAddress:e,spenderAddress:a&&q?q:K,amount:i,enabled:h}),I=a?p.isAllow:!G.isNeedApproval,S=M.useMemo(()=>
7454{if(a||!F||!I||!l||!R||!B)return null;if(o&&o.vaultAddress&&z){const _e=_i({abi:Tl,functionName:"addLiquiditySingle",args:[t,i,(P==null?void 0:P.shares)||0n,BigInt(r),R,vt.AUTOWIN_ROUTER]}),Ne=_i({abi:Tl,functionName:"depositIntoAutoWinSelf",args:[o.vaultAddress,z,l]});return{address:vt.AUTOWIN_ROUTER,abi:Tl,functionName:"multicall",args:[[_e,Ne]]}}else return{address:vt.AUTOWIN_ROUTER,abi:Tl,functionName:"addLiquiditySingle",args:[t,i,(P==null?void 0:P.shares)||0n,BigInt(r),R,l]}},[a,F,I,l,o,z,t,i,P==null?void 0:P.shares,r,R]),{data:v,error:_,isLoading:N}=$r({address:(S==null?void 0:S.address)||Mn,abi:(S==null?void 0:S.abi)||[],functionName:(S==null?void 0:S.functionName)||"",args:S==null?void 0:S.args,query:{enabled:!a&&!!S&&!!S.address&&!!S.functionName&&!!S.abi&&Array.isArray(S.abi)&&S.abi.length>0}});M.useEffect(()=>{var _e;if(F&&I&&S&&_){const Ne=_,pe=(Ne==null?void 0:Ne.message)||"",Te=(Ne==null?void 0:Ne.shortMessage)||"",ve=(Ne==null?void 0:Ne.name)||"",xe=(Ne==null?void 0:Ne.code)||"";let Ye;if((_e=Ne==null?void 0:Ne.data)!=null&&_e.errorName)Ye=Ne.data.errorName;else if(Ne!=null&&Ne.data){const lt=Ne.data;typeof lt=="string"&<.startsWith("0x")?Ye=lt.slice(0,10):lt!=null&<.signature&&(Ye=lt.signature)}const ze={"0xf4d678b8":{message:"Solde insuffisant pour le swap - Le montant après les frais est peut-être trop petit",action:"Vérifiez que vous avez suffisamment de tokens (y compris les frais). Pour les dépôts single-sided avec BERA, assurez-vous que BERA est wrappé en WBERA et que le montant est suffisant après déduction des frais. Le swap peut aussi échouer s'il n'y a pas assez de liquidité."},"0xfb8f41b2":{message:"Montant de sortie insuffisant - Le swap ne peut pas fournir le montant minimum attendu (slippage)",action:"Le montant de sortie est inférieur au minimum attendu. Cela peut être dû à un slippage trop élevé, une liquidité insuffisante, ou un changement de prix. Pour les dépôts single-sided, utilisez Enso qui ne passe pas par SwapFeeRouter."},"0x1a8856b4":{message:"FeeBasisPointsNotRespected - Les frais fournis sont inférieurs au minimum requis",action:"Vérifiez que les frais de service sont correctement configurés"},"0x08c379a0":{message:"Erreur générique avec message",action:"Vérifiez les détails de l'erreur dans les logs"}},ft={message:pe,shortMessage:Te,name:ve,code:xe,signature:Ye,functionName:S==null?void 0:S.functionName,contractAddress:S==null?void 0:S.address};Ye&&ze[Ye]&&(ft.userFriendlyMessage=ze[Ye].message,ze[Ye].action&&(ft.suggestedAction=ze[Ye].action)),console.error("[useSingleDeposit] Simulation error details:",ft)}},[F,I,S,v,N,_]);const{data:$,writeContract:U,isPending:j,error:D,reset:O}=Ls(),{isLoading:H,isSuccess:J}=Ts({hash:$,query:{enabled:!!$}}),W=M.useRef(!1),Z=()=>{if(!W.current&&!(j||H||$)){W.current=!0;try{if(v!=null&&v.request)U(v.request);else if(S)U({address:S.address,abi:S.abi,functionName:S.functionName,args:S.args});else{console.error("[useSingleDeposit] Cannot execute deposit: missing both depositConfig.request and transactionConfig",{hasDepositConfig:!!v,hasRequest:!!(v!=null&&v.request),hasTransactionConfig:!!S,transactionConfig:S,isQuoted:F,isAllow:I}),W.current=!1;return}setTimeout(()=>{W.current=!1},1e3)}catch(_e){console.error("[useSingleDeposit] Error executing deposit:",_e),W.current=!1}}},Y=()=>{W.current=!1,O()};return M.useEffect(()=>{(J||D)&&(W.current=!1)},[J,D]),a?{swapQuote:{amountIn:i,amountOut:(ue=p.route.data)!=null&&ue.amountOut?BigInt(p.route.data.amountOut):void 0,isLoading:p.route.isLoading},priceImpact:g,vaultQuote:{minShares:w,expectedShares:b},isQuoted:!!p.route.data,allowance:p.allowance,isAllow:p.isAllow,deposit:{execute:p.zap.execute,isPending:p.zap.isPending,isLoading:p.zap.isLoading,isSimulating:p.route.isLoading,isSuccess:p.zap.isSuccess,hash:p.zap.hash,error:p.zap.error,reset:p.zap.reset}}:{swapQuote:{amountIn:E,amountOut:(be=k.quote)==null?void 0:be.amountOut,isLoading:k.status==="loading-routes"||k.status==="quoting"||k.status==="optimizing"},priceImpact:null,vaultQuote:{minShares:B,expectedShares:(P==null?void 0:P.shares)||null},isQuoted:F,allowance:{isNeed:G.isNeedApproval,current:G.allowance,allow:G.approve,isLoading:G.isLoading,isApprove:G.isApproving,isApproveReady:G.isApproveReady,hash:G.approveHash,error:G.approveError,refetch:G.refetch,reset:G.reset},isAllow:I,deposit:{execute:Z,isPending:j,isLoading:H,isSimulating:N,isSuccess:J,hash:$,error:_||D,reset:Y}}},_Ke=({vault:t,token0:e,token1:n,amount0:i,amount1:s,slippageBps:r,autoWin:o})=>{const{address:a}=mn(),{calculateMinAmount:c}=y4(r),l=!!a&&!!t&&!!e&&!!n&&i>0n&&s>0n,{quote:d,isLoading:h}=hoe({vaultAddress:t,amount0:i,amount1:s,enabled:l}),[p,g,b]=M.useMemo(()=>d?[c(d.amount0,r),c(d.amount1,r),c(d.shares,r)]:[null,null,null],[d,c,r]),w=!!p&&!!g&&!!b,{minShares:C}=dL({autoWinVault:o==null?void 0:o.vaultAddress,stickyShares:b||void 0,slippageBps:(o==null?void 0:o.slippageBps)||100}),E=vt.AUTOWIN_ROUTER,T=$p({tokenAddress:e,spenderAddress:E,amount:i,enabled:w}),A=$p({tokenAddress:n,spenderAddress:E,amount:s,enabled:w}),k=!T.isNeedApproval&&!A.isNeedApproval,R=M.useMemo(()=>
7454{if(!w||!k||!a)return null;if(o&&o.vaultAddress&&C){const N=_i({abi:Tl,functionName:"addLiquidity",args:[t,i,s,p,g,b,vt.AUTOWIN_ROUTER]}),$=_i({abi:Tl,functionName:"depositIntoAutoWinSelf",args:[o.vaultAddress,C,a]});return{address:vt.AUTOWIN_ROUTER,abi:Tl,functionName:"multicall",args:[[N,$]]}}else return{address:vt.AUTOWIN_ROUTER,abi:Tl,functionName:"addLiquidity",args:[t,i,s,p,g,b,a]}},[w,k,a,o,C,t,i,s,p,g,b]),{data:P}=$r({address:(R==null?void 0:R.address)||Mn,abi:(R==null?void 0:R.abi)||[],functionName:(R==null?void 0:R.functionName)||"",args:R==null?void 0:R.args,chainId:Nn.id,query:{enabled:!!R&&!!R.address&&!!R.functionName&&!!R.abi&&Array.isArray(R.abi)&&R.abi.length>0}}),{data:B,writeContract:F,isPending:z,error:K,reset:q}=Ls(),{isLoading:G,isSuccess:I}=Ts({hash:B,query:{enabled:!!B}}),S=M.useRef(!1),v=()=>{if(!S.current&&!(z||G||B)){if(!(P!=null&&P.request)){console.error("[useDoubleDeposit] Cannot execute deposit: missing depositConfig.request");return}S.current=!0;try{F(P.request),setTimeout(()=>{S.current=!1},1e3)}catch(N){console.error("[useDoubleDeposit] Error executing deposit:",N),S.current=!1}}},_=()=>{S.current=!1,q()};return M.useEffect(()=>{(I||K)&&(S.current=!1)},[I,K]),{quote:{amount0Max:(d==null?void 0:d.amount0)||i,amount0Min:p,amount1Max:(d==null?void 0:d.amount1)||s,amount1Min:g,minShares:b,expectedShares:(d==null?void 0:d.shares)||null},isQuoted:w,isQuoteLoading:h,t0Allowance:{isNeed:T.isNeedApproval,current:T.allowance,allow:T.approve,isLoading:T.isLoading,isApprove:T.isApproving,isApproveReady:T.isApproveReady,hash:T.approveHash,error:T.approveError,refetch:T.refetch,reset:T.reset},t1Allowance:{isNeed:A.isNeedApproval,current:A.allowance,allow:A.approve,isLoading:A.isLoading,isApprove:A.isApproving,isApproveReady:A.isApproveReady,hash:A.approveHash,error:A.approveError,refetch:A.refetch,reset:A.reset},isAllow:k,deposite:{depose:v,isPending:z,isLoading:G,isSuccess:I,hash:B,error:K,reset:_}}},hK=[{inputs:[{internalType:"contract IWETH",name:"_wBera",type:"address"},{internalType:"address",name:"_winnieRouter",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"amount0Max",type:"uint256"},{internalType:"uint256",name:"amount1Max",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquidity",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"amount0Max",type:"uint256"},{internalType:"uint256",name:"amount1Max",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquidityNative",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"totalAmountIn",type:"uint256"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"uint256",name:"maxStakingSlippageBPS",type:"uint256"},{components:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"minAmountOut",type:"uint256"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"bytes",name:"routeData",type:"bytes"}],internalType:"struct RouterSwapParams",name:"swapData",type:"tuple"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquiditySingle",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"}
7454,{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"amountSharesMin",type:"uint256"},{internalType:"uint256",name:"maxStakingSlippageBPS",type:"uint256"},{components:[{internalType:"uint256",name:"amountIn",type:"uint256"},{internalType:"uint256",name:"minAmountOut",type:"uint256"},{internalType:"bool",name:"zeroForOne",type:"bool"},{internalType:"bytes",name:"routeData",type:"bytes"}],internalType:"struct RouterSwapParams",name:"swapData",type:"tuple"},{internalType:"address",name:"receiver",type:"address"}],name:"addLiquiditySingleNative",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint256",name:"mintAmount",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"burnAmount",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"removeLiquidity",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint128",name:"liquidityBurned",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IStickyVault",name:"stickyVault",type:"address"},{internalType:"uint256",name:"burnAmount",type:"uint256"},{internalType:"uint256",name:"amount0Min",type:"uint256"},{internalType:"uint256",name:"amount1Min",type:"uint256"},{internalType:"address payable",name:"receiver",type:"address"}],name:"removeLiquidityNative",outputs:[{internalType:"uint256",name:"amount0",type:"uint256"},{internalType:"uint256",name:"amount1",type:"uint256"},{internalType:"uint128",name:"liquidityBurned",type:"uint128"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wBera",outputs:[{internalType:"contract IWETH",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"winnieRouter",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],SKe=({vaultAddress:t,burnAmount:e,slippageBps:n,enabled:i=!0})=>{const{address:s}=mn(),{calculateMinAmount:r}=y4(n),o=i&&!!s&&!!t&&e>0n,a=$p({tokenAddress:t,spenderAddress:vt.STICKYVAULT_ROUTER,amount:e,enabled:o}),c=!a.isNeedApproval,{data:l}=$r({address:vt.STICKYVAULT_ROUTER,abi:hK,functionName:"removeLiquidity",args:[t,e,0n,0n,s],chainId:Nn.id,query:{enabled:o&&c}}),d=l!=null&&l.result?{amount0:l.result[0],amount1:l.result[1]}:void 0,{data:h,writeContract:p,isPending:g,error:b,reset:w}=Ls(),{isLoading:C,isSuccess:E}=Ts({hash:h,query:{enabled:!!h}}),T=()=>{if(!(l!=null&&l.request)||!d)return;const k=r(d.amount0,n),R=r(d.amount1,n);p({address:vt.STICKYVAULT_ROUTER,abi:hK,functionName:"removeLiquidity",args:[t,e,k,R,s]})},A=()=>{w()};return{estimatedAmounts:d,allowance:{isNeed:a.isNeedApproval,current:a.allowance,allow:a.approve,isLoading:a.isLoading,isApprove:a.isApproving,hash:a.approveHash,error:a.approveError,refetch:a.refetch},isAllow:c,withdraw:{execute:T,isPending:g,isLoading:C,isSuccess:E,hash:h,error:b,reset:A}}},AKe=({autoWinVault:t,burnAmount:e,slippageBps:n,enabled:i=!0})=>{const{address:s}=mn(),{calculateMinAmount:r}=y4(n),o=i&&!!s&&!!t&&e>0n,a=$p({tokenAddress:t,spenderAddress:vt.AUTOWIN_ROUTER,amount:e,enabled:o}),c=!a.isNeedApproval,{data:l}=Si({address:t,abi:Df,functionName:"previewRedeem",args:[e],query:{enabled:o&&c}}),{data:d}=$r({address:vt.AUTOWIN_ROUTER,abi:Tl,functionName:"redeemFromAutoWin",args:[t,e,0n,s],chainId:Nn.id,query:{enabled:o&&c&&!!l}}),{data:h,writeContract:p,isPending:g,error:b,reset:w}=Ls(),{isLoading:C,isSuccess:E}=Ts({hash:h,query:{enabled:!!h}}),T=()=>{if(!(d!=null&&d.request)||!l)return;const k=r(l,n);p({address:vt.AUTOWIN_ROUTER,abi:Tl,functionName:"redeemFromAutoWin",args:[t,e,k,s]})},A=()=>{w()};return{estimatedAmount:l,allowance:{isNeed:a.isNeedApproval,current:a.allowance,allow:a.approve,isLoading:a.isLoading,isApprove:a.isApproving,hash:a.approveHash,error:a.approveError,refetch:a.refetch},isAllow:c,withdraw:{execute:T,isPending:g,isLoading:C,isSuccess:E,hash:h,error:b,reset:A}}},Kh=[{inputs:[],name:"asset",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"}],name:"convertToShares",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"},{internalType:"address",name:"receiver",type:"address"}],name:"deposit",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"}],name:"previewDeposit",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"}],name:"previewRedeem",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"shares",type:"uint256"},{internalType:"address",name:"receiver",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"redeem",outputs:[{internalType:"uint256",name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalAssets",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"},{internalType:"address",name:"receiver",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"withdraw",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"assets",type:"uint256"}],name:"previewWithdraw",outputs:[{internalType:"uint256",name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"}],TKe="0x456c957454dCF68F75af885905Faaac35C14EeCe",kKe=({vaultAddress:t=TKe,assetAddress:e,amount:n,enabled:i=!0})=>{const{address:s}=mn(),r=M.useRef(!1),o=i&&!!s&&!!e&&n>0n,a=n>0n?n:2n**256n-1n,c=$p({tokenAddress:e,spenderAddress:t,amount:a,enabled:!!s&&!!e}),{data:l,isLoading:d}=Si({address:t,abi:Kh,functionName:"previewDeposit",args:[n],query:{enabled:o&&!c.isNeedApproval}}),{data:h}=$r({address:t,abi:Kh,functionName:"deposit",args:[n,s],query:{enabled:o&&!c.isNeedApproval}}),{data:p,writeContract:g,isPending:b,error:w,reset:C}=Ls(),{isLoading:E,isSuccess:T}=Ts({hash:p}),A=()=>{if(!r.current&&!(b||E||p)&&h!=null&&h.request){r.current=!0;try{g(h.request),setTimeout(()=>{r.current=!1},1e3)}catch{r.current=!1}}};return M.useEffect(()=>{(T||w)&&(r.current=!1)},[T,w]),{deposit:{execute:A,isPending:b,isLoading:E,isSuccess:T,error:w,hash:p,reset:C},allowance:{isNeed:c.isNeedApproval,isApprove:c.isApproving,isSuccess:c.approveStatus==="success",isLoading:c.isLoading,error:c.approveError,hash:c.approveHash,allow:c.approve,isReady:c.isApproveReady},preview:{shares:l,isLoading:d},isReady:o}},NKe="0x456c957454dCF68F75af885905Faaac35C14EeCe",RKe=({vaultAddress:t=NKe,shares:e,enabled:n=!0})=>{const{address:i}=mn(),s=M.useRef(!1),r=n&&!!i&&e>0n,{data:o,isLoading:a}=Si({address:t,abi:Kh,functionName:"previewRedeem",args:[e],query:{enabled:r}}),{data:c}=$r({address:t,abi:Kh,functionName:"redeem",args:[e,i,i],query:{enabled:r}}),{data:l,writeContract:d,isPending:h,error:p,reset:g}=Ls(),{isLoading:b,isSuccess:w}=Ts({hash:l}),C=()=>
7454{if(!s.current&&!(h||b||l)&&c!=null&&c.request){s.current=!0;try{d(c.request),setTimeout(()=>{s.current=!1},1e3)}catch{s.current=!1}}};return M.useEffect(()=>{(w||p)&&(s.current=!1)},[w,p]),{withdraw:{execute:C,isPending:h,isLoading:b,isSuccess:w,error:p,hash:l,reset:g},allowance:{isNeed:!1,isApprove:!1,isSuccess:!1,isLoading:!1,error:null,hash:void 0,allow:()=>{}},preview:{assets:o,isLoading:a},isReady:r}},fK=t=>({id:t.id,TokenPrice:[],address:t.id,coingeckoId:"",createdAt:new Date().toISOString(),decimals:t.decimals,description:"",discoveredAt:new Date().toISOString(),isStableCoin:!1,isVerifiedManually:!1,lastActivityAt:new Date().toISOString(),lastEnrichmentAt:new Date().toISOString(),logoUri:t.logoUri||"",metadata:{},name:t.name,status:"active",symbol:t.symbol,totalSupply:"0",twitter:"",updatedAt:new Date().toISOString(),website:""}),PKe="/assets/cancellation-DyHEJNdy.png";let IKe=0;const fu=new Map,VI=new Set,Pm=()=>{VI.forEach(t=>t())},DKe=()=>{const[t,e]=M.useState([]);M.useEffect(()=>{const i=()=>{e(Array.from(fu.values()).filter(s=>s.isVisible))};return VI.add(i),i(),()=>{VI.delete(i)}},[]);const n=M.useCallback(i=>{const s=fu.get(i);s&&(s.onClose&&s.onClose(),s.isVisible=!1,fu.delete(i),Pm())},[]);return{toasts:t,removeToast:n}},In=({isVisible:t,message:e,type:n="info",icon:i,link:s,onClose:r,duration:o=3e3,position:a="top-center"})=>{const c=M.useRef(null);return M.useEffect(()=>{if(t){const l=c.current||`toast-${++IKe}`;c.current=l;const d=fu.get(l);if(d?(d.isVisible=!0,d.message=e,d.type=n,d.icon=i,d.link=s,d.duration=o,d.position=a,d.onClose=r,Pm()):(fu.set(l,{id:l,message:e,type:n,icon:i,link:s,duration:o,position:a,onClose:r,isVisible:!0}),Pm()),o>0){const h=setTimeout(()=>{const p=fu.get(l);p&&(p.isVisible=!1,fu.delete(l),Pm(),p.onClose&&p.onClose())},o);return()=>clearTimeout(h)}}else if(c.current){const l=fu.get(c.current);if(l&&(!l.duration||l.duration===0)){const d=setTimeout(()=>{const h=fu.get(c.current);h&&!h.isVisible&&(fu.delete(c.current),Pm(),c.current=null)},500);return l.isVisible=!1,Pm(),()=>clearTimeout(d)}else l&&(l.isVisible=!1,fu.delete(c.current),Pm()),c.current=null}},[t,e,n,i,s,o,a,r]),null},OKe=({position:t="top-right"})=>{const{toasts:e,removeToast:n}=DKe(),i=c=>
7454{switch(c){case"success":return m.jsx("img",{src:jre,alt:"Success",className:"ToastBlur__IconImage ToastBlur__IconImage--success"});case"error":return m.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("circle",{cx:"10",cy:"10",r:"10",fill:"#FF7456"}),m.jsx("path",{d:"M6 6L14 14M14 6L6 14",stroke:"#171410",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});case"cancelled":return m.jsx("img",{src:PKe,alt:"Cancelled",className:"ToastBlur__IconImage ToastBlur__IconImage--cancelled"});case"loading":return m.jsx("div",{className:"ToastBlur__Loader",children:m.jsx("div",{className:"ToastBlur__Spinner"})});default:return null}},s={"top-center":"ToastBlur--top-center","top-right":"ToastBlur--top-right","top-left":"ToastBlur--top-left"},r={success:"ToastBlur--success",error:"ToastBlur--error",loading:"ToastBlur--loading",info:"ToastBlur--info",cancelled:"ToastBlur--cancelled"};if(typeof window>"u")return null;const o=e.reduce((c,l)=>{const d=l.position||t;return c[d]||(c[d]=[]),c[d].push(l),c},{}),a=m.jsx(m.Fragment,{children:Object.entries(o).map(([c,l])=>m.jsx("div",{className:`ToastContainer ToastContainer--${c}`,children:m.jsx(Pb,{children:l.map((d,h)=>{const b=0+h*48;return m.jsx(Wo.div,{className:`ToastBlur ${s[c]} ${r[d.type||"info"]} ${d.link?"ToastBlur--clickable":""}`,initial:{opacity:0,y:-50,scale:.9},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-50,scale:.9},transition:{duration:.3,ease:[.4,0,.2,1]},style:{top:`${b}px`},onClick:()=>{d.link&&window.open(d.link.href,"_blank","noopener,noreferrer")},children:m.jsxs("div",{className:"ToastBlur__Content",children:[m.jsxs("div",{className:"ToastBlur__ContentRow",children:[(d.icon||i(d.type))&&m.jsx("div",{className:"ToastBlur__Icon",children:d.icon||i(d.type)}),m.jsx("span",{className:"ToastBlur__Message",children:d.message})]}),m.jsx("button",{className:"ToastBlur__CloseButton",onClick:w=>{w.stopPropagation(),n(d.id)},"aria-label":"Close notification",children:m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M12 4L4 12M4 4L12 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})},d.id)})})},c))});return TZ.createPortal(a,document.body)},MKe=async t=>{const e=`https://api.coingecko.com/api/v3/simple/price?ids=${t}&vs_currencies=usd`,n=await fetch(e);if(!n.ok)throw Error(n.statusText);return await n.json()},WI=t=>{const e=!!t&&("coingeckoId"in t?!!t.coingeckoId:!!t.address);return Zt({queryKey:e?["prices","coingeckoId"in t?t.coingeckoId:t.address]:["prices","no-token"],queryFn:e?()=>"coingeckoId"in t&&t.coingeckoId?MKe(t.coingeckoId):Promise.resolve({}):()=>Promise.resolve({}),select:n=>{var i;return e&&"coingeckoId"in t&&t.coingeckoId&&((i=n[t.coingeckoId])==null?void 0:i.usd)||0},staleTime:1/0,enabled:e})},LKe=t=>{if(!t||t==="0"||t==="")return 48;const e=t.replace(/[^\d]/g,"").length;if(e<=9){const n=Math.floor((e-1)/3)*7;return Math.max(48-n,34)}else{const n=e-9,i=Math.floor((n-1)/3)+1;return Math.max(34-i*3,16)}},$Ke={USDT0:6,"USDâ®0":6,USDT:6,USDC:6,"USDC.E":6,"USDC.e":6};function UKe(t){if(!t)return 18;const e=$Ke[t.symbol||""];if(e!==void 0)return e;const n=t.decimals;return typeof n=="number"&&n>0&&n<=18?n:18}const pK=M.forwardRef(({selectedToken:t,onAmountChange:e,value:n,isOverBalance:i,disabled:s=!1,disableTokenSelector:r=!1,showMaxButton:o=!0,customUsdValue:a,customBalance:c},l)=>{const d=M.useRef(null),h=M.useRef(!1),p=M.useRef(""),g=M.useRef(""),[b,w]=M.useState(""),{address:C}=mn(),{data:E=0}=WI(t),{data:T,isLoading:A}=wf({address:C,token:(t==null?void 0:t.address)!==Mn?t==null?void 0:t.address:void 0,query:{enabled:!!C&&!c}}),k=c!==void 0?{value:c}:T,R=c!==void 0?!1:A,P=UKe(t),B=M.useMemo(()=>n===0n?0:a!==void 0?(a*+dt(n,P)).toFixed(2):(E*+dt(n,P)).toFixed(2),[E,n,a,P]),F=M.useMemo(()=>LKe(b),[b]),z=M.useMemo(()=>F+8,[F]);M.useEffect(()=>{if(!h.current){const S=n===0n?"":dt(n,P);if(p.current&&n>0n)try{if(hs(p.current,P)===n){w(p.current),g.current=p.current;return}}catch{}if(b==="0."&&n===0n)return;w(S),g.current=S}},[n,P,b]);const K=S=>{const v=S.target.value;let _=v.replace(",",".");_=_.replace(/[^\d.]/g,"");const N=g.current||b;if(_===""){w(""),g.current="",h.current=!0,p.current="",e(0n);return}if(_==="0."&&N&&N.startsWith("0.")&&N.length>2&&v.length<N.length){_="",w(""),g.current="",h.current=!0,p.current="",e(0n);return}_==="0"&&N!=="0."&&v.length>=N.length&&(_="0.");const $=_.split(".");if($.length>2&&(_=$[0]+"."+$.slice(1).join("")),$.length===2&&$[1].length>18&&(_=$[0]+"."+$[1].substring(0,18)),w(_),h.current=!0,p.current=_,g.current=_,/^\d*(\.\d*)?$/.test(_)&&_!=="")try{e(hs(_==="0."?"0":_,P))}catch{console.warn("Invalid input amount:",_)}else _===""&&(p.current="",e(0n))},q=()=>{h.current=!1,p.current="",b!=="0."&&(w(n===0n?"":dt(n,P)),g.current=n===0n?"":dt(n,P))},G=()=>{d.current&&(d.current.value=dt((k==null?void 0:k.value)||0n,P),e((k==null?void 0:k.value)||0n))},I=()=>{w(""),e(0n),h.current=!1,p.current="",d.current&&(d.current.value="")};return M.useImperativeHandle(l,()=>({refresh:I}),[]),m.jsx("div",{className:"LiquidityInput",children:m.jsx("div",{className:"Inputs",children:m.jsx("div",{className:"LiquidityInput__InputWrapper",children:m.jsxs("div",{className:`Inputs__From From From--${i?"error":"idle"}`,children:[m.jsxs("div",{className:"From__AmountsAndChain",children:[m.jsx("div",{className:"From__Amounts",style:{position:"relative",display:"flex",alignItems:"center",width:"100%",overflow:"hidden",minWidth:0},children:m.jsx("input",{ref:d,className:i?"From__Input From__Input--error":"From__Input",type:"text",inputMode:"decimal",placeholder:"0",value:b,onChange:K,onBlur:q,min:0,style:{color:i?"#FF7456":void 0,fontSize:`${F}px`,lineHeight:`${z}px`,height:`${z}px`,verticalAlign:"middle",boxSizing:"border-box",width:"100%",textAlign:"left"},readOnly:s})}),m.jsx("div",{className:"From__LogosAndBalance",children:m.jsx("div",{className:`From__Logos${r?" From__disabled":""}`,children:m.jsxs("button",{className:`networkSelector has-token${r?" disabled":""}`,disabled:r,style:r?{cursor:"default",pointerEvents:"none",opacity:.6}:{},children:[m.jsx("span",{className:"networkSelector__logoWrapper",children:m.jsx(ws,{logoUri:t==null?void 0:t.logoUri,symbol:(t==null?void 0:t.symbol)||"",size:"large"})}),m.jsx("span",{className:"networkSelector__symbol",children:t==null?void 0:t.symbol})]})})})]}),m.jsxs("div",{className:"From__Details",children:[m.jsxs("p",{className:"From__Convertion",children:["$",B]}),m.jsx("div",{className:"From__Balance",children:t&&m.jsx(m.Fragment,{children:m.jsx("p",{className:`From__Amount${i?" From__Amount--error":""} ${o?"From__Amount--clickable":""}`,onClick:o?G:void 0,style:o?{cursor:"pointer"}:void 0,children:R?"...":i1(dt((k==null?void 0:k.value)||0n,P))})})})]})]})})})})}
7454),BKe=t=>{const{data:e,isLoading:n,isError:i}=Si({address:t,abi:Wd,functionName:"getUnderlyingBalances",query:{enabled:!!t,staleTime:3e4,refetchInterval:3e4}});return{amount0Current:e==null?void 0:e[0],amount1Current:e==null?void 0:e[1],isLoading:n,isError:i,hasRatio:!!e&&e[0]>0n&&e[1]>0n}};function hL({vaultAddress:t,userAddress:e,vaultTVL_USD:n,refreshInterval:i=30*1e3}){const{data:s,isLoading:r,refetch:o}=Si({address:t,abi:Wd,functionName:"balanceOf",args:e?[e]:void 0,query:{enabled:!!t&&!!e,refetchInterval:i}}),{data:a,isLoading:c,refetch:l}=Si({address:t,abi:Wd,functionName:"totalSupply",query:{enabled:!!t,refetchInterval:i}}),{valueInUSD:d,pricePerShare:h}=M.useMemo(()=>{if(!s||s===0n||!a||a===0n||!n)return{valueInUSD:0,pricePerShare:0};const g=parseFloat(dt(s,18)),b=parseFloat(dt(a,18)),w=parseFloat(n),E=g/b*w,T=w/b;return{valueInUSD:E,pricePerShare:T}},[s,a,n]);return{shares:s||0n,valueInUSD:d,pricePerShare:h,isLoading:r||c,refetch:()=>{o(),l()}}}function fL({autoWinVault:t,userAddress:e,sharesFromIndexer:n,stickyVaultAddress:i,vaultTVL_USD:s,refreshKey:r=0,refreshInterval:o=30*1e3}){const a=M.useMemo(()=>{if(n)try{return hs(n,18)}catch{return}},[n]),{data:c,isLoading:l,refetch:d}=Si({address:t,abi:Df,functionName:"balanceOf",args:e?[e]:void 0,query:{enabled:!!t&&!!e,refetchInterval:o}}),{data:h,isLoading:p,refetch:g}=Si({address:t,abi:Df,functionName:"convertToAssets",args:a?[c||a]:void 0,query:{enabled:!!t&&(!!c&&c>0n||!!a&&a>0n),refetchInterval:o}}),{data:b,isLoading:w,refetch:C}=Si({address:i,abi:Wd,functionName:"totalSupply",query:{enabled:!!i,refetchInterval:o}});M.useEffect(()=>{r>0&&(d(),g(),C())},[r,d,g,C]);const E=M.useMemo(()=>{if(!h||!b||!s||b===0n)return 0;const k=parseFloat(dt(h,18)),R=parseFloat(dt(b,18)),P=parseFloat(s);return k/R*P},[h,b,s]),T=()=>{d(),g(),C()};return{shares:M.useMemo(()=>c!==void 0?c:a||0n,[c,a]),valueInAssets:h,valueInUSD:E,isLoading:l||p||w,error:null,refetch:T}}const foe="/assets/sticky_vault-CiE9V1y8.png",poe="/assets/auto-win-vault-l9AQXDSI.png",FKe=` 7455 query GetTokenPrices($ids: [String!]!) { 7456 tokens(where: { id_in: $ids }) { 7457 items { 7458 id 7459 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7460 items { 7461 priceUSD 7462 } 7463 } 7464 } 7465 } 7466 } 7467`;function jKe(t){const e=t.filter(s=>!!s&&s!=="").map(s=>s.toLowerCase()==="0x0000000000000000000000000000000000000000"?"0x6969696969696969696969696969696969696969":s),{data:n,isLoading:i}=Zt({queryKey:["token-prices-graphql",e.sort().join(",")],queryFn:async()=>{var c,l,d,h,p;if(e.length===0)return{};const o=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:FKe,variables:{ids:e}})})).json();if(o.errors||!((l=(c=o.data)==null?void 0:c.tokens)!=null&&l.items))return{};const a={};for(const g of o.data.tokens.items){const b=(p=(h=(d=g.tokenDayData)==null?void 0:d.items)==null?void 0:h[0])==null?void 0:p.priceUSD;b!=null&&Number(b)>0&&(a[g.id.toLowerCase()]=parseFloat(b))}return a["0x6969696969696969696969696969696969696969"]&&(a["0x0000000000000000000000000000000000000000"]=a["0x6969696969696969696969696969696969696969"]),a},enabled:e.length>0,staleTime:60*1e3,refetchInterval:60*1e3});return{priceMap:n??{},isLoading:i}}const Of=kn.memo(({dominantColor:t,secondaryColor:e,customClassName:n,isHomePage:i,isSticky:s=!1,showTitle:r=!1,hideMetrics:o=!1,onPoolChange:a,initialFromToken:c,initialToToken:l,initialMode:d="swap",enableDepositWithdraw:h=!1,showDepositLiquidityTab:p=!1,depositLiquidityUrl:g,showLiquidityTabs:b,position:w=null,pool:C=null,vault:E=null,vaultPosition:T=null,autoWinVault:A,selectedVaultPositionType:k=null,showUnstakeHint:R=!1,isERC4626:P=!1,erc4626VaultAddress:B,onSuccess:F})=>{var q1,zf,_4,hw,fw,pw,mw,gw,nh,S4,A4,T4,yw,bw,Hf,Gf,k4,nm,ww,vw,z1,H1,Cw,xw,Ew,N4,R4,P4,I4,D4,No,Kf,_w,Sw,Aw,Tw,G1,O4,ih,K1,Yf,Y1,kw,Xu,sh,Z1,Nw,Ju,Rw,Pw,Iw,M4,L4,$4,Dw,Ow,Q1,xa;const{isConnected:z,address:K}=mn(),q=Kc(),G=Zo(),[I,S]=M.useState(c||null),[v,_]=M.useState(l||null),[N,$]=M.useState(0n),[U,j]=M.useState(0n),[D,O]=M.use
7467State(!1),H=M.useRef(null),[J,W]=M.useState({real:.01,display:"1",isAuto:!0}),[Z,Y]=M.useState({real:20,display:"20"}),[Q,ee]=M.useState("from"),[ie,re]=M.useState(null),oe=M.useRef(!1),de=M.useRef(!1),he=M.useRef(null),{data:ue,isLoading:be}=h4(),[_e,Ne]=M.useState(!1),[pe,Te]=M.useState(d);M.useEffect(()=>{Te(h?P&&d==="swap"?"deposit":d:"swap")},[d,h,P]),M.useEffect(()=>{if(!c&&!l&&!be&&ue&&ue.length>0){const fe=ue.find(Re=>{var Be,St;return((Be=Re.symbol)==null?void 0:Be.toUpperCase())==="HONEY"||((St=Re.address)==null?void 0:St.toLowerCase())==="0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce"}),Se=ue.find(Re=>{var Be,St;return((Be=Re.symbol)==null?void 0:Be.toUpperCase())==="WBERA"||((St=Re.address)==null?void 0:St.toLowerCase())==="0x6969696969696969696969696969696969696969"});fe&&Se&&fe.address!==Se.address&&(I||S(Se),v||_(fe))}},[ue,be,c,l,I,v]);const ve=P&&!!B,xe=CE({tokenIn:(I==null?void 0:I.address)||Mn,tokenOut:(v==null?void 0:v.address)||Mn,amountIn:N,slippageTolerance:J.real,deadline:Z.real,enabled:!ve&&Q!=="to"}),Ye=I?sr(I.address):!1,{data:ze}=wf({address:K,query:{enabled:!!K&&!!I&&Ye&&Q==="to"}}),{data:ft}=Si({address:I&&!Ye&&Ja(I.address)?I.address:void 0,abi:Ks,functionName:"balanceOf",args:K?[K]:void 0,query:{enabled:!!K&&!!I&&!Ye&&Q==="to"}}),lt=Q==="to"?Ye?ze==null?void 0:ze.value:ft:void 0,We=CE({tokenIn:(v==null?void 0:v.address)||Mn,tokenOut:(I==null?void 0:I.address)||Mn,amountIn:U,slippageTolerance:J.real,deadline:Z.real,enabled:!ve&&Q==="to",overrideUserBalance:lt}),{poolAddress:Dt}=jze(I==null?void 0:I.address,v==null?void 0:v.address),Fe=!!E&&!!T,it=pe==="deposit"&&(C||w&&C||Fe||ve),Qt=pe==="withdraw"&&(w&&C||Fe||ve),ke=wKe({position:(Fe?null:w)||null,pool:(Fe?null:C)||null,isModalOpen:it&&!Fe}),nt=vKe({position:(Fe?null:w)||null,pool:(Fe?null:C)||null,isModalOpen:Qt&&!Fe}),[ht,At]=M.useState(P?"single":"double"),[zt,Ln]=M.useState("sticky"),gn=k||zt,[yn,bi]=M.useState(0n),[En,yt]=M.useState(!!A),[mt,_t]=M.useState(!1),[Vt,Yn]=M.useState(!1),[Ee,$e]=M.useState(!1),[Xe,ot]=M.useState(!1),[pt,Ot]=M.use
7467State(!1),[tn,rn]=M.useState(!1),[Mt,nn]=M.useState(!1),[ln,Oi]=M.useState(!1),[un,_n]=M.useState(null),[Cs,Wn]=M.useState(!1),[Zn,fs]=M.useState(!1),[Us,cs]=M.useState(!1),[Vr,ps]=M.useState(!1),[ko,Mi]=M.useState(!1),[dc,Ji]=M.useState(!1),[qu,ql]=M.useState(!1),[hc,Qc]=M.useState(!1),[Qd,zu]=M.useState(!1),[Hu,Xd]=M.useState(!1),[Xc,Jc]=M.useState(!1),Pt=M.useMemo(()=>{var fe,Se,Re,Be;return(fe=E==null?void 0:E.poolRef)!=null&&fe.token0Ref?{id:E.poolRef.token0Ref.id,address:E.poolRef.token0Ref.id,symbol:E.poolRef.token0Ref.symbol,name:E.poolRef.token0Ref.name,decimals:E.poolRef.token0Ref.decimals||18,logoUri:E.poolRef.token0Ref.logoUri,priceUSD:((Be=(Re=(Se=E.poolRef.token0Ref.tokenDayData)==null?void 0:Se.items)==null?void 0:Re[0])==null?void 0:Be.priceUSD)||(I==null?void 0:I.priceUSD)||0}:null},[E,I==null?void 0:I.priceUSD]),kt=M.useMemo(()=>{var fe,Se,Re,Be;return(fe=E==null?void 0:E.poolRef)!=null&&fe.token1Ref?{id:E.poolRef.token1Ref.id,address:E.poolRef.token1Ref.id,symbol:E.poolRef.token1Ref.symbol,name:E.poolRef.token1Ref.name,decimals:E.poolRef.token1Ref.decimals||18,logoUri:E.poolRef.token1Ref.logoUri,priceUSD:((Be=(Re=(Se=E.poolRef.token1Ref.tokenDayData)==null?void 0:Se.items)==null?void 0:Re[0])==null?void 0:Be.priceUSD)||(v==null?void 0:v.priceUSD)||0}:null},[E,v==null?void 0:v.priceUSD]),Ge=_Ke({vault:E==null?void 0:E.id,token0:Pt==null?void 0:Pt.id,token1:kt==null?void 0:kt.id,amount0:it&&Fe&&ht==="double"?N:0n,amount1:it&&Fe&&ht==="double"?U:0n,slippageBps:100,autoWin:En&&A?{vaultAddress:A,slippageBps:100}:void 0}),Gu=M.useMemo(()=>{var fe,Se;return!ht||ht!=="single"||!I||!Pt?!1:((fe=I.address)==null?void 0:fe.toLowerCase())===((Se=Pt.address)==null?void 0:Se.toLowerCase())},[ht,I,Pt]),Jd=M.useMemo(()=>{var fe,Se;return!ht||ht!=="single"||!I||!kt?!1:((fe=I.address)==null?void 0:fe.toLowerCase())===((Se=kt.address)==null?void 0:Se.toLowerCase())},[ht,I,kt]),$1=Gu||Jd,Qp=!!Pt&&!!kt,zl=ht==="single"&&it&&Fe&&!!I&&Qp,hi=!ve&&pze(I,v),U1=!ve&&mze(I),zn=JM(),[Xp,Ku]=M.useState(!1),[iw,B1]=M.useState(null);M.useEffect(()=>{},[hi,pe,I,v,N]),M.useEffect(()=>{!hi||pe!=="swap"||Q!=="to"&&(N>0n?U!==N&&j(N):N===0n&&U!==0n&&j(0n))},[hi,pe,N,Q,U]);const Zs=M.useMemo(()=>{var Be,St;if(!U1||!v||hi)return!1;const fe=(Be=v.symbol)==null?void 0:Be.toUpperCase(),Se=(St=v.address)==null?void 0:St.toLowerCase();return!(fe==="BERA"||Se==="0x0000000000000000000000000000000000000000")},[U1,v,hi]),F1=M.useMemo(()=>ue==null?void 0:ue.find(fe=>{var Se,Re;return((Se=fe.symbol)==null?void 0:Se.toUpperCase())==="BERA"&&((Re=fe.address)==null?void 0:Re.toLowerCase())==="0x0000000000000000000000000000000000000000"}),[ue]),Hl=CE({tokenIn:(F1==null?void 0:F1.address)||Mn,tokenOut:(v==null?void 0:v.address)||Mn,amountIn:N,slippageTolerance:J.real,deadline:Z.real,enabled:!ve&&Zs&&!!F1&&!!v&&N>0n&&Q!=="to"&&pe==="swap"});M.useEffect(()=>{var fe;!Zs||pe!=="swap"||Q==="to"||oe.current||((fe=Hl==null?void 0:Hl.quote)!=null&&fe.amountOut&&N>0n?Hl.quote.amountOut!==U&&(oe.current=!0,j(Hl.quote.amountOut),setTimeout(()=>{oe.current=!1},0)):N===0n&&U!==0n&&j(0n))},[Zs,(q1=Hl==null?void 0:Hl.quote)==null?void 0:q1.amountOut,N,U,pe,Q]),M.useEffect(()=>{if(!Xp||!zn.isSuccess||!iw)return;const fe=setTimeout(()=>{const Se=ue==null?void 0:ue.find(Re=>{var Be,St,Ht,qn;return((Be=Re.symbol)==null?void 0:Be.toUpperCase())==="WBERA"&&((St=Re.address)==null?void 0:St.toLowerCase())==="0x6969696969696969696969696969696969696969"||((Ht=Re.symbol)==null?void 0:Ht.toUpperCase())==="WBERA"&&((qn=Re.address)==null?void 0:qn.toLowerCase())!=="0x0000000000000000000000000000000000000000"});Se&&(S(Se),Ku(!1),B1(null),q.invalidateQueries({predicate:Re=>{var St;const Be=Re.queryKey;return Be[0]==="balance"||Be[0]==="readContract"&&typeof Be[1]=="object"&&((St=Be[1])==null?void 0:St.functionName)==="balanceOf"}}),setTimeout(()=>{setTimeout(()=>{setTimeout(()=>{he.current&&he.current()},100)},3e3)},2e3))},2e3);return()=>clearTimeout(fe)},[Xp,zn.isSuccess,iw,ue,q]),M.useEffect(()=>{},[Fe,it,ht,$1,Gu,Jd,I,Qp,zl,Pt,kt]);const Ff=M.useMemo(()=>{var Re;if(!zl||!I)return;const fe="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return sr(I.address)||((Re=I.address)==null?void 0:Re.toLowerCase())==="0x0000000000000000000000000000000000000000".toLowerCase()?fe:I.address},[zl,I]),jf=M.useMemo(()=>
7467{if(zl)return Ff||(I==null?void 0:I.address);if(ht==="single"){if(Gu&&(Pt!=null&&Pt.id))return Pt.id;if(Jd&&(kt!=null&&kt.id))return kt.id}return I==null?void 0:I.address},[zl,Ff,ht,Gu,Jd,Pt==null?void 0:Pt.id,kt==null?void 0:kt.id,I==null?void 0:I.address]);M.useEffect(()=>{},[ht,zl,$1,Gu,Jd,I==null?void 0:I.address,Ff,jf,N,E==null?void 0:E.id]);const v4=zl&&!!jf;M.useEffect(()=>{},[ht,it,Fe,zl,v4,$1,Ff,jf,Pt,kt]);const HS=M.useMemo(()=>ht==="single"&&Pt&&kt?Gu&&(kt!=null&&kt.id)?kt.id:Pt.id:Pt==null?void 0:Pt.id,[ht,Gu,Pt==null?void 0:Pt.id,kt==null?void 0:kt.id]),eh=ve&&I?sr(I.address):!1,{data:fc}=wf({address:K,query:{enabled:ve&&it&&!!K&&!!I&&eh}}),{data:sw}=Si({address:ve&&I&&!eh&&Ja(I.address)?I.address:void 0,abi:Ks,functionName:"balanceOf",args:K?[K]:void 0,query:{enabled:ve&&it&&!!K&&!!I&&!eh}}),Jp=ve&&it?eh?fc==null?void 0:fc.value:sw:void 0,ct=kKe({vaultAddress:B,assetAddress:I==null?void 0:I.address,amount:it&&ve?N:0n,enabled:it&&ve&&!!(I!=null&&I.address)}),Un=RKe({vaultAddress:B,shares:Qt&&ve?N:0n,enabled:Qt&&ve}),at=EKe({vault:ve||E==null?void 0:E.id,tokenIn:jf,tokenOut:HS,amount:it&&Fe&&!ve&&ht==="single"?N:0n,isToken0:Gu,slippageBps:100,autoWin:En&&A?{vaultAddress:A,slippageBps:100}:void 0,useEnso:v4,tokenInDecimals:(I==null?void 0:I.decimals)||18}),si=A?gn:"sticky",Bn=SKe({vaultAddress:ve||E==null?void 0:E.id,burnAmount:yn,slippageBps:100,enabled:Qt&&Fe&&!ve&&si==="sticky"}),On=AKe({autoWinVault:A,burnAmount:yn,slippageBps:100,enabled:Qt&&Fe&&!ve&&si==="autowin"}),Wr=hL({vaultAddress:E==null?void 0:E.id,userAddress:K,vaultTVL_USD:E==null?void 0:E.totalValueLockedUSD}),el=fL({autoWinVault:A,userAddress:K,sharesFromIndexer:(fw=(hw=(_4=(zf=E==null?void 0:E.autoWinVaultRef)==null?void 0:zf.positions)==null?void 0:_4.items)==null?void 0:hw.find(fe=>fe.user===(K==null?void 0:K.toLowerCase())))==null?void 0:fw.shares,stickyVaultAddress:E==null?void 0:E.id,vaultTVL_USD:(pw=E==null?void 0:E.totalValueLockedUSD)==null?void 0:pw.toString()}),Gl=M.useMemo(()=>{var Re,Be;const fe=pe==="deposit"&&C?(Re=C.token0Ref)==null?void 0:Re.id:I==null?void 0:I.address,Se=pe==="deposit"&&C?(Be=C.token1Ref)==null?void 0:Be.id:v==null?void 0:v.address;return[fe??null,Se??null]},[pe,C,I==null?void 0:I.address,v==null?void 0:v.address]),{priceMap:Kl}=jKe(Gl),{amount0Current:Yl,amount1Current:tl,hasRatio:em}=BKe(E==null?void 0:E.id),[xs,Yu]=M.useState(0),[Zu,Qs]=M.useState(""),[th,Vf]=M.useState(!1),Qu=M.useRef(null),j1=M.useRef(!1),[Ki,nl]=M.useState(0),[pc,va]=M.useState(""),[C4,tm]=M.useState(!1),V1=M.useRef(null),W1=M.useRef(!1),Cn=M.useRef(!1),[rw,Pn]=M.useState(!1),ow=M.useMemo(()=>{if(!Zu||Zu==="0"||Zu==="")return 48;const fe=Zu.replace(/[^\d]/g,"").length;return fe<=2?48:fe===3?41:34},[Zu]),x4=M.useMemo(()=>ow+8,[ow]),aw=M.useMemo(()=>{if(!pc||pc==="0"||pc==="")return 48;const fe=pc.replace(/[^\d]/g,"").length;return fe<=2?48:fe===3?41:34},[pc]),cw=M.useMemo(()=>aw+8,[aw]);M.useEffect(()=>{Qt&&nt&&(nt.setPercentage(xs),j1.current&&Qu.current&&requestAnimationFrame(()=>{Qu.current&&Qu.current.focus()}))},[xs,Qt,nt]),M.useEffect(()=>{Qt||(Yu(0),Qs(""),Vf(!1))},[Qt]);const GS=M.useCallback(fe=>{if(!fe||fe===0n||!Pt||!kt)return 0n;try{if(em&&Yl&&tl&&Yl>0n)return fe*tl/Yl;if(Pt.priceUSD===0||kt.priceUSD===0)return 0n;const Re=Number(fe)/Math.pow(10,Pt.decimals)*Pt.priceUSD/kt.priceUSD;return BigInt(Math.floor(Re*Math.pow(10,kt.decimals)))}catch{return 0n}},[Pt,kt,em,Yl,tl]),KS=M.useCallback(fe=>{if(!fe||fe===0n||!Pt||!kt)return 0n;try{if(em&&Yl&&tl&&tl>0n)return fe*Yl/tl;if(Pt.priceUSD===0||kt.priceUSD===0)return 0n;const Re=Number(fe)/Math.pow(10,kt.decimals)*kt.priceUSD/Pt.priceUSD;return BigInt(Math.floor(Re*Math.pow(10,Pt.decimals)))}catch{return 0n}},[Pt,kt,em,Yl,tl]);M.useCallback(fe=>{const Se=si==="sticky"?Wr.shares:el.shares;if(!Se||Se===0n)return;let Re;fe===100?Re=Se:Re=Se*BigInt(fe)/100n,bi(Re),nl(fe),va(fe.toString()),tm(!0)},[si,Wr.shares,el.shares]),M.useEffect(()=>{if(Qt&&Fe){const fe=si==="sticky"?Wr.shares:el.shares;if(fe&&fe>0n&&Ki>0){let Se;Ki===100?Se=fe:Se=fe*BigInt(Ki)/100n,bi(Se)}else Ki===0&&bi(0n);W1.current&&V1.current&&requestAnimationFrame(()=>{V1.current&&V1.current.focus()})}},[Ki,Qt,Fe,si,Wr.shares,el.shares]),M.useEffect(()=>{var Be,St,Ht,qn,Ci;if(!Fe)return;const Se=[(Be=Ge.t0Allowance)==null?void 0:Be.error,(St=Ge.t1Allowance)==null?void 0:St.error,(Ht=at.allowance)==null?void 0:Ht.error,(qn=Bn.allowance)==null?void 0:qn.error,(Ci=On.allowance)==null?void 0:Ci.error].find(Boolean);if(!Se)return;const Re=Se.message||Se.toString();(Re.includes("User rejected")||Re.toLowerCase().includes("user rejected")||Re.includes("User denied")||Re.toLowerCase().includes("user denied")||Re.toLowerCase().includes("rejected the request"))&&(Ot(!0),setTimeout(()=>{Ot(!1)},5e3))},[Fe,(mw=Ge.t0Allowance)==null?void 0:mw.error,(gw=Ge.t1Allowance)==null?void 0:gw.error,(nh=at.allowance)==null?void 0:nh.error,(S4=Bn.allowance)==null?void 0:S4.error,(A4=On.allowance)==null?void 0:A4.error]);const YS=M.useMemo(()=>
7467{if(!Qt||!Fe||Ki===0)return"0.00";const fe=si==="sticky"?Wr.valueInUSD:el.valueInUSD;return!fe||fe===0?"0.00":(fe*Ki/100).toFixed(2)},[Qt,Fe,Ki,si,Wr.valueInUSD,el.valueInUSD]),ZS=M.useMemo(()=>{var Re,Be,St,Ht,qn,Ci,Ea,oo;if(!Qt||Fe||!w||!C||xs===0)return"0.00";const fe=parseFloat(((Ht=(St=(Be=(Re=C.token0Ref)==null?void 0:Re.tokenDayData)==null?void 0:Be.items)==null?void 0:St[0])==null?void 0:Ht.priceUSD)||"0"),Se=parseFloat(((oo=(Ea=(Ci=(qn=C.token1Ref)==null?void 0:qn.tokenDayData)==null?void 0:Ci.items)==null?void 0:Ea[0])==null?void 0:oo.priceUSD)||"0");if(nt!=null&&nt.exactAmounts){const cr=parseFloat(dt(nt.exactAmounts.token0Amount,C.token0Ref.decimals||18)),_r=parseFloat(dt(nt.exactAmounts.token1Amount,C.token1Ref.decimals||18));return(cr*fe+_r*Se).toFixed(2)}try{const cr=parseFloat(w.depositedToken0||"0"),_r=parseFloat(w.depositedToken1||"0"),Qn=parseFloat(w.withdrawnToken0||"0"),_a=parseFloat(w.withdrawnToken1||"0"),ao=cr-Qn,ed=_r-_a;return((ao*fe+ed*Se)*xs/100).toFixed(2)}catch{return"0.00"}},[Qt,Fe,w,C,xs,nt==null?void 0:nt.exactAmounts]);M.useEffect(()=>{(!it||!Fe)&&($(0n),j(0n)),(!Qt||!Fe)&&(bi(0n),nl(0),va(""),tm(!1))},[it,Qt,Fe]),M.useEffect(()=>{it&&ve&&ct.deposit.isSuccess&&($(0n),j(0n),F==null||F(),q.invalidateQueries({queryKey:["balance"]}),q.invalidateQueries({queryKey:["honeyPrice"]}),q.invalidateQueries({predicate:fe=>{const Se=fe.queryKey;return Array.isArray(Se)&&(Se[0]==="readContract"||Se[0]==="balance")}}))},[it,ve,ct.deposit.isSuccess,F,q]),M.useEffect(()=>{Qt&&ve&&Un.withdraw.isSuccess&&($(0n),j(0n),F==null||F())},[Qt,ve,Un.withdraw.isSuccess,F]);const Wf=M.useRef(!1);M.useEffect(()=>{var fe,Se;if(it&&Fe&&!ve){const Re=ht==="double"?Ge.deposite.isSuccess:at.deposit.isSuccess,Be=ht==="double"?!!((fe=Ge.deposite)!=null&&fe.hash):!!((Se=at.deposit)!=null&&Se.hash);Re&&Be&&!Wf.current?(Wf.current=!0,$(0n),j(0n),q.invalidateQueries({predicate:St=>{var qn;const Ht=St.queryKey;return Ht[0]==="balance"||Ht[0]==="readContract"&&typeof Ht[1]=="object"&&((qn=Ht[1])==null?void 0:qn.functionName)==="balanceOf"}}),F==null||F(),setTimeout(()=>{var St,Ht,qn,Ci;ht==="double"?(Ht=(St=Ge.deposite)==null?void 0:St.reset)==null||Ht.call(St):(Ci=(qn=at.deposit)==null?void 0:qn.reset)==null||Ci.call(qn),Wf.current=!1},5e3)):!Re&&!Be&&(Wf.current=!1)}},[it,Fe,ve,ht,Ge.deposite.isSuccess,(T4=Ge.deposite)==null?void 0:T4.hash,at.deposit.isSuccess,(yw=at.deposit)==null?void 0:yw.hash,F,q]),M.useEffect(()=>{Qt&&Fe&&!ve&&(si==="sticky"?Bn.withdraw.isSuccess:On.withdraw.isSuccess)&&(bi(0n),nl(0),va(""),tm(!1),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="balance"||Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}}),F==null||F())},[Qt,Fe,ve,si,Bn.withdraw.isSuccess,On.withdraw.isSuccess,F,q]),M.useEffect(()=>{var qn,Ci,Ea,oo,cr,_r,Qn,_a,ao,ed,Zl,Sa,rh,Zf,oh,Qf,qr,il,sl;const fe=(ht==="double"?(qn=Ge.deposite)==null?void 0:qn.isPending:(Ci=at.deposit)==null?void 0:Ci.isPending)||!1,Se=(ht==="double"?(Ea=Ge.deposite)==null?void 0:Ea.isSuccess:(oo=at.deposit)==null?void 0:oo.isSuccess)||!1,Re=(ht==="double"?!!((cr=Ge.deposite)!=null&&cr.hash):!!((_r=at.deposit)!=null&&_r.hash))||!1,Be=ht==="double"?(Qn=Ge.deposite)==null?void 0:Qn.error:(_a=at.deposit)==null?void 0:_a.error,St=ht==="double"?((ao=Ge.t0Allowance)==null?void 0:ao.error)||((ed=Ge.t1Allowance)==null?void 0:ed.error):(Zl=at.allowance)==null?void 0:Zl.error,Ht=ht==="double"?((Sa=Ge.t0Allowance)==null?void 0:Sa.isApprove)||((rh=Ge.t1Allowance)==null?void 0:rh.isApprove):(Zf=at.allowance)==null?void 0:Zf.isApprove;if(Be){const Ui=Be.message||Be.toString()||"";if(Ui.includes("User rejected")||Ui.includes("user rejected")||Ui.includes("User denied")||Ui.includes("user denied")||Ui.includes("rejected")){$e(!0),_t(!1),Cn.current=!1,Pn(!1),setTimeout(()=>{var ls,Bi,xi,lr;$e(!1),ht==="double"?(Bi=(ls=Ge.deposite)==null?void 0:ls.reset)==null||Bi.call(ls):(lr=(xi=at.deposit)==null?void 0:xi.reset)==null||lr.call(xi)},5e3);return}}if(St){const Ui=St.message||St.toString()||"";if(Ui.includes("User rejected")||Ui.includes("user rejected")||Ui.includes("User denied")||Ui.includes("user denied")||Ui.includes("rejected")){Ot(!0),rn(!1),Cn.current=!1,Pn(!1),setTimeout(()=>{var ls,Bi,xi,lr,Is,Sr;Ot(!1),ht==="double"?((Bi=(ls=Ge.t0Allowance)==null?void 0:ls.reset)==null||Bi.call(ls),(lr=(xi=Ge.t1Allowance)==null?void 0:xi.reset)==null||lr.call(xi)):(Sr=(Is=at.allowance)==null?void 0:Is.reset)==null||Sr.call(Is)},5e3);return}}if(Ht?rn(!0):tn&&!Ht&&((ht==="double"?!!((oh=Ge.t0Allowance)!=null&&oh.hash)||!!((Qf=Ge.t1Allowance)!=null&&Qf.hash):!!((qr=at.allowance)!=null&&qr.hash))?rn(!1):(Ot(!0),rn(!1),setTimeout(()=>{var ls,Bi,xi,lr,Is,Sr;Ot(!1),ht==="double"?((Bi=(ls=Ge.t0Allowance)==null?void 0:ls.reset)==null||Bi.call(ls),(lr=(xi=Ge.t1Allowance)==null?void 0:xi.reset)==null||lr.call(xi)):(Sr=(Is=at.allowance)==null?void 0:Is.reset)==null||Sr.call(Is)},5e3))),fe)_t(!0),$e(!1),Oi(!1),_n(null);else if(mt&&!Se&&!Re)$e(!0),_t(!1),setTimeout(()=>{var Ui,ls,Bi,xi;$e(!1),Cn.current=!1,Pn(!1),ht==="double"?(ls=(Ui=Ge.deposite)==null?void 0:Ui.reset)==null||ls.call(Ui):(xi=(Bi=at.deposit)==null?void 0:Bi.reset)==null||xi.call(Bi)},5e3);else if(Se&&Re){const Ui=ht==="double"?(il=Ge.deposite)==null?void 0:il.hash:(sl=at.deposit)==null?void 0:sl.hash;Ui&&Ui!==un&&($e(!1),Ot(!1),nn(!1),Oi(!0),_n(Ui),Cn.current=!1,Pn(!1),setTimeout(()=>{_t(!1)},500),setTimeout(()=>{Oi(!1)},3e3))}else Re&&!Se&&($e(!1),Ot(!1),nn(!1),Cn.current=!1,Pn(!1))},[ht,(bw=Ge.deposite)==null?void 0:bw.isPending,(Hf=Ge.deposite)==null?void 0:Hf.isSuccess,(Gf=Ge.deposite)==null?void 0:Gf.hash,(k4=Ge.deposite)==null?void 0:k4.error,(nm=Ge.t0Allowance)==null?void 0:nm.error,(ww=Ge.t1Allowance)==null?void 0:ww.error,(vw=Ge.t0Allowance)==null?void 0:vw.isApprove,(z1=Ge.t1Allowance)==null?void 0:z1.isApprove,(H1=Ge.t0Allowance)==null?void 0:H1.hash,(Cw=Ge.t1Allowance)==null?void 0:Cw.hash,(xw=at.deposit)==null?void 0:xw.isPending,(Ew=at.deposit)==null?void 0:Ew.isSuccess,(N4=at.deposit)==null?void 0:N4.hash,(R4=at.deposit)==null?void 0:R4.error,(P4=at.allowance)==null?void 0:P4.error,(I4=at.allowance)==null?void 0:I4.isApprove,(D4=at.allowance)==null?void 0:D4.hash,mt,tn,ln]),M.useEffect(()=>{const fe=si==="sticky"?Bn:On,Se=fe.withdraw.isPending,Re=fe.withdraw.isSuccess,Be=!!fe.withdraw.hash,St=fe.withdraw.error;if(St){const Ht=St.message||St.toString()||"";if(Ht.includes("User rejected")||Ht.includes("user rejected")||Ht.includes("User denied")||Ht.includes("user denied")||Ht.includes("rejected")){ot(!0),Yn(!1),setTimeout(()=>{ot(!1),fe.withdraw.reset()},5e3);return}}Se?(Yn(!0),ot(!1),Wn(!1)):Vt&&!Re&&!Be?(ot(!0),Yn(!1),Cn.current=!1,Pn(!1),setTimeout(()=>{ot(!1),fe.withdraw.reset()},5e3)):Re&&Be&&!Cs?(Yn(!1),ot(!1),Wn(!0),Cn.current=!1,Pn(!1),setTimeout(()=>{Wn(!1)},3e3)):Be&&!Re&&(ot(!1),Cn.current=!1,Pn(!1))},[si,Bn.withdraw.isPending,Bn.withdraw.isSuccess,Bn.withdraw.hash,Bn.withdraw.error,On.withdraw.isPending,On.withdraw.isSuccess,On.withdraw.hash,On.withdraw.error,Vt,Cs]),M.useEffect(()=>{if(!ve)return;const fe=ct.allowance.isApprove||ct.allowance.isLoading,Se=!!ct.allowance.hash,Re=ct.allowance.isSuccess,Be=ct.allowance.error;if(Be){const Qn=(Be==null?void 0:Be.message)||(Be==null?void 0:Be.toString())||"";(Qn.includes("User rejected")||Qn.includes("user rejected")||Qn.includes("User denied")||Qn.includes("user denied")||Qn.includes("rejected"))&&(Ji(!0),ql(!1),setTimeout(()=>{Ji(!1)},3e3))}fe&&Se&&ct.allowance.isNeed?(ql(!0),Jc(!1)):qu&&!Re&&!Se&&!fe?(Ji(!0),ql(!1),setTimeout(()=>{Ji(!1)},3e3)):Re&&Se&&!Xc&&(ql(!1),Jc(!0),setTimeout(()=>{Jc(!1)},3e3));const St=ct.deposit.isPending||ct.deposit.isLoading,Ht=!!ct.deposit.hash,qn=ct.deposit.isSuccess,Ci=ct.deposit.error;if(Ci){const Qn=(Ci==null?void 0:Ci.message)||(Ci==null?void 0:Ci.toString())||"";(Qn.includes("User rejected")||Qn.includes("user rejected")||Qn.includes("User denied")||Qn.includes("user denied")||Qn.includes("rejected"))&&(ps(!0),fs(!1),setTimeout(()=>{ps(!1)},3e3))}St&&Ht?(fs(!0),ps(!1),zu(!1)):Zn&&!qn&&!Ht&&!St?(ps(!0),fs(!1),setTimeout(()=>{ps(!1)},3e3)):qn&&Ht&&!Qd&&(ps(!1),zu(!0),setTimeout(()=>{fs(!1)},1e3),setTimeout(()=>{zu(!1)},3e3));const Ea=Un.withdraw.isPending||Un.withdraw.isLoading,oo=!!Un.withdraw.hash,cr=Un.withdraw.isSuccess,_r=Un.withdraw.error;if(_r){const Qn=(_r==null?void 0:_r.message)||(_r==null?void 0:_r.toString())||"";(Qn.includes("User rejected")||Qn.includes("user rejected")||Qn.includes("User denied")||Qn.includes("user denied")||Qn.includes("rejected"))&&(Mi(!0),cs(!1),setTimeout(()=>{Mi(!1)},3e3))}Ea&&oo?(cs(!0),Mi(!1),Xd(!1)):Us&&!cr&&!oo&&!Ea?(Mi(!0),cs(!1),setTimeout(()=>{Mi(!1)},3e3)):cr&&oo&&!Hu&&(cs(!1),Mi(!1),Xd(!0),setTimeout(()=>{Xd(!1)},3e3))},[ve,ct.allowance.isApprove,ct.allowance.isLoading,ct.allowance.isSuccess,ct.allowance.hash,ct.allowance.error,ct.deposit.isPending,ct.deposit.isLoading,ct.deposit.isSuccess,ct.deposit.hash,ct.deposit.error,Un.withdraw.isPending,Un.withdraw.isLoading,Un.withdraw.isSuccess,Un.withdraw.hash,Un.withdraw.error,qu,Zn,Us,Xc,Qd,Hu]);const QS=M.useCallback(fe=>{if(de.current=!0,(v==null?void 0:v.address)===fe.address){const Se=I,Re=N,Be=U;S(v),_(Se),$(Be),j(Re),ee(null);return}S(fe)},[v,I,N,U]),XS=M.useCallback(fe=>{if(de.current=!0,(I==null?void 0:I.address)===fe.address){const Se=I,Re=N,Be=U;S(v),_(Se),$(Be),j(Re),ee(null);return}_(fe)},[I,v,N,U]),JS=M.useCallback(()=>
7467{if(!I||!v)return;de.current=!0;const fe=I,Se=v,Re=N,Be=U;S(Se),_(fe),$(Be),j(Re),ee(null)},[I,v,N,U]);M.useCallback(()=>{O(!0)},[]),M.useCallback(()=>{O(!D)},[D]);const qf=M.useMemo(()=>!ve||!it||N===0n||!Jp?!1:N>Jp,[ve,it,N,Jp]),lw=M.useMemo(()=>{if(ve&&pe==="deposit")return qf?!1:ct.allowance.isNeed?N>0n&&!!(I!=null&&I.address)&&ct.allowance.isReady&&!ct.allowance.isApprove&&!ct.allowance.isLoading:N>0n&&ct.isReady&&!ct.deposit.isPending&&!ct.deposit.isLoading;if(ve&&pe==="withdraw")return N>0n&&Un.isReady&&!Un.withdraw.isPending&&!Un.withdraw.isLoading;if(Fe&&!ve&&pe==="deposit"){if(Ee||pt)return!1;if(ht==="double")return Pt&&kt&&N>0n&&U>0n&&Ge.isQuoted&&(Ge.isAllow||Ge.t0Allowance.allow||Ge.t1Allowance.allow);{const fe=at.swapQuote.amountOut!==void 0||at.isQuoted;return N>0n&&fe&&at.isQuoted&&(at.isAllow||at.allowance.allow)}}if(Fe&&!ve&&pe==="withdraw"){if(Xe)return!1;const fe=si==="sticky"?Bn:On;return Ki>0&&Ki<=100&&yn>0n&&!fe.withdraw.isLoading&&!fe.withdraw.isPending&&(fe.isAllow||fe.allowance.allow)}if(pe==="deposit"&&ke&&!Fe)return ke.canSubmit&&!ke.isLoading&&(ke.parsedToken0Amount>0n||ke.parsedToken1Amount>0n);if(pe==="withdraw"&&nt&&!Fe)return nt.canSubmit&&!nt.isLoading&&xs>0&&xs<=100;if(pe==="swap"){const fe=!!(I&&v),Se=N>0n;if(hi||Zs){const St=zn.bgtBalance!==void 0&&N<=zn.bgtBalance;return fe&&Se&&St&&!zn.isLoading&&!zn.isPending}const Re=Q==="to"?We:xe,Be=!["loading-routes","quoting"].includes(Re.status);return fe&&Se&&Be}return!1},[Fe,pe,ht,Pt,kt,N,U,Ge.isQuoted,Ge.isAllow,at.swapQuote.amountOut,at.isQuoted,at.isAllow,at.allowance.allow,zl,Ee,pt,Xe,yn,si,Bn.withdraw.isLoading,Bn.withdraw.isPending,Bn.isAllow,Bn.allowance.allow,On.withdraw.isLoading,On.withdraw.isPending,On.isAllow,On.allowance.allow,ke==null?void 0:ke.canSubmit,ke==null?void 0:ke.isLoading,ke==null?void 0:ke.parsedToken0Amount,ke==null?void 0:ke.parsedToken1Amount,nt==null?void 0:nt.canSubmit,nt==null?void 0:nt.isLoading,xs,I,v,xe.status,We.status,Q,hi,zn.isLoading,zn.isPending,zn.bgtBalance,Ki]),$t=M.useMemo(()=>Q==="to"?We:xe,[Q,xe,We]),E4=M.useMemo(()=>{var fe,Se,Re,Be;if(ve&&pe==="deposit")return ct.deposit.isLoading||ct.deposit.isPending?"Depositing...":ct.deposit.isSuccess?"Deposit Successful":ct.allowance.isApprove||ct.allowance.isLoading?"Approving...":N===0n?"Enter an amount":qf?"Insufficient balance":ct.allowance.isNeed?`Approve ${(I==null?void 0:I.symbol)||"Token"}`:"Deposit";if(ve&&pe==="withdraw")return Un.withdraw.isLoading||Un.withdraw.isPending?"Withdrawing...":Un.withdraw.isSuccess?"Withdraw Successful":N===0n?"Enter an amount":"Withdraw";if(Fe&&!ve&&pe==="deposit")return ht==="double"?Ge.deposite.isLoading?"Depositing...":Ge.deposite.isSuccess?"Deposit Successful":Ge.isQuoted?Ge.t0Allowance.isApprove||Ge.t0Allowance.isLoading||Ge.t1Allowance.isApprove||Ge.t1Allowance.isLoading?"Approving...":Ge.t0Allowance.isNeed?`Approve ${(Pt==null?void 0:Pt.symbol)||"Token"}`:Ge.t1Allowance.isNeed?`Approve ${(kt==null?void 0:kt.symbol)||"Token"}`:N===0n||U===0n?"Enter amounts":"Deposit":"Calculating...":at.deposit.isLoading?"Depositing...":at.deposit.isSuccess?"Deposit Successful":at.swapQuote.isLoading?"Calculating swap...":at.isQuoted?at.allowance.isApprove||at.allowance.isLoading?"Approving...":at.allowance.isNeed?`Approve ${(I==null?void 0:I.symbol)||"Token"}`:N===0n?"Enter an amount":"Deposit":"Calculating...";if(Fe&&!ve&&pe==="withdraw"){const St=si==="sticky"?Bn:On;return St.withdraw.isLoading||St.withdraw.isPending?"Withdrawing...":St.withdraw.isSuccess?"Withdraw Successful":St.allowance.isApprove||St.allowance.isLoading?"Approving...":St.allowance.isNeed?"Approve tokens":Ki>100?"Maximum is 100%":yn===0n||Ki===0?"Enter an amount":"Withdraw"}if(pe==="deposit"&&ke&&!Fe){if(ke.status==="simulating")return"Simulating...";if(ke.status==="increasing")return"Adding Liquidity...";if(ke.status==="waitingIncrease")return"Confirming...";if(ke.status==="approving"||ke.status==="waitingApproval"){if(ke.token0NeedsApproval)return`Approve ${(C==null?void 0:C.token0Ref.symbol)||"Token"}`;if(ke.token1NeedsApproval)return`Approve ${(C==null?void 0:C.token1Ref.symbol)||"Token"}`}if(ke.isSuccess)return"Liquidity Added Successfully";if(ke.validationErrors&&ke.validationErrors.length>0){const St=ke.validationErrors.find(qn=>qn.field==="token0"||qn.field==="token1");if(St)return St.message||"Insufficient balance";const Ht=ke.validationErrors[0];if(Ht.message)return Ht.message.length>40?Ht.message.substring(0,40)+"...":Ht.message}if((fe=ke.errors)!=null&&fe.simulate&&!ke.canIncrease&&ke.canSubmit){const St=ke.errors.simulate instanceof Error?ke.errors.simulate.message:String(ke.errors.simulate);return St.includes("STF")||St.includes("slippage")?"Slippage exceeded - adjust amounts":St.includes("ratio")||St.includes("amount")?"Invalid ratio - enter one amount":St.includes("execution reverted")?"Transaction would fail - check amounts":"C
7467annot add liquidity"}return ke.canSubmit?ke.token0NeedsApproval||ke.token1NeedsApproval?"Approve tokens":ke.isLoading?"Calculating...":"Add Liquidity":"Enter amounts"}if(pe==="withdraw"&&nt&&!Fe)return nt.status==="simulating"?"Simulating...":nt.status==="decreasing"?"Withdrawing Liquidity...":nt.status==="waitingDecrease"?"Confirming...":nt.isSuccess?"Liquidity Withdrawn Successfully":xs>100?"Maximum is 100%":!nt.canSubmit||xs===0?"Select percentage":"Withdraw Liquidity";if(pe==="swap"){if(!I||!v)return"Select a token";if(!N||N===0n)return"Enter an amount";if(hi||Zs)return zn.isLoading||zn.isPending?"Redeeming...":zn.isConfirming?"Confirming...":zn.isSuccess?Zs?"Swapping...":"Redeem Successful":"Redeem";if($t.isWrap)return"Wrap";if($t.isUnWrap)return"Unwrap";const St=(Se=$t.quote)==null?void 0:Se.priceImpact;if(St&&St>10)return"Price impact too high";if((Re=$t.validation)!=null&&Re.errors&&$t.validation.errors.length>0){if($t.validation.errors.find(Ci=>Ci.code==="INSUFFICIENT_BALANCE"||Ci.message.toLowerCase().includes("insufficient")))return"Insufficient balance";const qn=$t.validation.errors[0];if(qn.message)return qn.message.length>30?qn.message.substring(0,30)+"...":qn.message}return $t.status==="ready"&&$t.quote&&!$t.needsApproval?"Swap":$t.status==="ready"&&$t.needsApproval?`Approve ${(I==null?void 0:I.symbol)||"Token"}`:$t.status==="success"?"Success":_e&&$t.status==="error"?(Be=$t.error)!=null&&Be.message?$t.error.message.length>30?$t.error.message.substring(0,30)+"...":$t.error.message:"Error":["loading-routes","quoting"].includes($t.status)||["approving","confirming","swapping"].includes($t.status)?null:"Swap"}return"Select a token"},[$t.status,I,v,N,U,$t.isWrap,$t.isUnWrap,$t.error,$t.validation,$t.needsApproval,$t.quote,_e,pe,ke,nt,xs,C,Fe,ve,ct,Un,ht,Ge,at,Pt,kt,En,si,Bn,On,Ki,yn]),uw=M.useMemo(()=>{var Se;if(ve||pe!=="swap"||hi)return!1;const fe=!!((Se=$t.quote)!=null&&Se.amountOut)&&$t.quote.amountOut>0n;return["loading-routes","quoting","optimizing"].includes($t.status)&&!fe},[ve,pe,hi,$t.status,(No=$t.quote)==null?void 0:No.amountOut]),Ca=M.useMemo(()=>{var fe,Se,Re,Be;if(pe==="deposit"&&ve){const St=ct.allowance.isApprove||ct.allowance.isLoading,Ht=ct.deposit.isPending||ct.deposit.isLoading;return St||Ht}return pe==="withdraw"&&ve?Un.withdraw.isPending||Un.withdraw.isLoading:pe==="swap"&&!hi&&!Zs&&["approving","confirming","swapping"].includes($t.status)||pe==="swap"&&(hi||Zs)&&(zn.isLoading||zn.isPending)||pe==="deposit"&&!Fe&&!ve&&(ke==null?void 0:ke.isLoading)||pe==="deposit"&&Fe&&!ve&&!Ee&&(ht==="double"&&(((fe=Ge.deposite)==null?void 0:fe.isPending)||((Se=Ge.deposite)==null?void 0:Se.isLoading)||Ge.t0Allowance.isApprove||Ge.t1Allowance.isApprove)||ht==="single"&&(((Re=at.deposit)==null?void 0:Re.isPending)||((Be=at.deposit)==null?void 0:Be.isLoading)||at.allowance.isApprove))||pe==="withdraw"&&!Fe&&!ve&&(nt==null?void 0:nt.isLoading)||pe==="withdraw"&&Fe&&!ve&&!Xe&&(si==="sticky"?Bn.withdraw.isLoading||Bn.withdraw.isPending||Bn.allowance.isLoading||Bn.allowance.isApprove:On.withdraw.isLoading||On.withdraw.isPending||On.allowance.isLoading||On.allowance.isApprove)},[pe,ve,ct.allowance.isApprove,ct.allowance.isLoading,ct.deposit.isPending,ct.deposit.isLoading,Un.withdraw.isPending,Un.withdraw.isLoading,hi,Zs,$t.status,zn.isLoading,zn.isPending,ke==null?void 0:ke.isLoading,Fe,Ee,ht,(Kf=Ge.deposite)==null?void 0:Kf.isPending,(_w=Ge.deposite)==null?void 0:_w.isLoading,Ge.t0Allowance.isApprove,Ge.t1Allowance.isApprove,(Sw=at.deposit)==null?void 0:Sw.isPending,(Aw=at.deposit)==null?void 0:Aw.isLoading,at.allowance.isApprove,nt==null?void 0:nt.isLoading,Xe,si,Bn.withdraw.isLoading,Bn.withdraw.isPending,Bn.allowance.isLoading,Bn.allowance.isApprove,On.withdraw.isLoading,On.withdraw.isPending,On.allowance.isLoading,On.allowance.isApprove]);pe==="deposit"&&!Fe&&!ve&&(ke!=null&&ke.isLoading)||pe==="deposit"&&Fe&&!ve&&!Ee&&(ht==="double"&&((Tw=Ge.deposite)!=null&&Tw.isPending||(G1=Ge.deposite)!=null&&G1.isLoading||Ge.t0Allowance.isApprove||Ge.t1Allowance.isApprove)||ht==="single"&&((O4=at.deposit)!=null&&O4.isPending||(ih=at.deposit)!=null&&ih.isLoading||at.allowance.isApprove))||pe==="withdraw"&&!Fe&&!ve&&(nt!=null&&nt.isLoading)||pe==="withdraw"&&Fe&&!ve&&!Xe&&(si==="sticky"?Bn.withdraw.isLoading||Bn.withdraw.isPending||Bn.allowance.isLoading||Bn.allowance.isApprove:On.withdraw.isLoading||On.withdraw.isPending||On.allowance.isLoading||On.allowance.isApprove);const dw=M.useCallback(async()=>{var Re,Be,St,Ht,qn,Ci,Ea,oo,cr,_r,Qn,_a,ao,ed,Zl,Sa,rh,Zf,oh,Qf,qr,il,sl,Ui,ls,Bi,xi,lr,Is,Sr,rl,Mw,X1,J1,Lw,ur,Yi,ri,Ql,Xo,ey,Xl,$w,Uw,ah,td,ty;const fe=pe==="swap",Se=fe&&($t.status==="idle"||$t.status==="ready");if(!((Cn.current||rw)&&!Se)){if(fe&&Se&&(Cn.current||rw)&&(Cn.current=!1,Pn(!1)),Cn.current=!0,Pn(!0),Ca){Cn.current=!1,Pn(!1);return}if(Fe&&pe==="deposit"&&!ve){const es=ht==="double"?((Re=Ge.deposite)==null?void 0:Re.isPending)||((Be=Ge.deposite)==null?void 0:Be.isLoading):((St=at.deposit)==null?void 0:St.isPending)||((Ht=at.deposit)==null?void 0:Ht.isLoading),Ro=ht==="double"?(qn=Ge.deposite)==null?void 0:qn.hash:(Ci=at.deposit)==null?void 0:Ci.hash;if(es||Ro){Cn.current=!1,Pn(!1);return}}if(Fe&&pe==="deposit"&&!ve&&(Ee||pt)){Cn.current=!1,Pn(!1);return}if(Fe&&pe==="withdraw"&&!ve&&Xe){Cn.current=!1,Pn(!1);return}if(ve&&pe==="deposit"){if(ct.deposit.isSuccess){F==null||F(),q.invali
7467dateQueries({queryKey:["balance"]}),q.invalidateQueries({queryKey:["honeyPrice"]}),q.invalidateQueries({predicate:es=>{const Ro=es.queryKey;return Array.isArray(Ro)&&(Ro[0]==="readContract"||Ro[0]==="balance")}}),ct.deposit.reset(),Cn.current=!1,Pn(!1);return}if(ct.allowance.isNeed&&ct.allowance.allow){ct.allowance.allow(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);return}if(N>0n&&ct.deposit.execute&&ct.isReady){ct.deposit.execute(),setTimeout(()=>{Cn.current=!1,Pn(!1)},2e3);return}Cn.current=!1,Pn(!1);return}if(Fe&&pe==="deposit"&&!ve)if(ht==="double"){if(Ge.deposite.isSuccess){F==null||F(),(oo=(Ea=Ge.deposite).reset)==null||oo.call(Ea);return}if(Ge.t0Allowance.isNeed&&Ge.t0Allowance.isApproveReady&&Ge.t0Allowance.allow&&!Ee&&!pt){Ge.t0Allowance.allow();return}if(Ge.t1Allowance.isNeed&&Ge.t1Allowance.isApproveReady&&Ge.t1Allowance.allow&&!Ee&&!pt){Ge.t1Allowance.allow();return}const es=Ge.t0Allowance.isApprove||Ge.t0Allowance.isLoading,Ro=Ge.t1Allowance.isApprove||Ge.t1Allowance.isLoading,Aa=!!Ge.t0Allowance.error,mc=!!Ge.t1Allowance.error,gc=Aa&&(((_r=(cr=Ge.t0Allowance.error)==null?void 0:cr.message)==null?void 0:_r.includes("User rejected"))||((_a=(Qn=Ge.t0Allowance.error)==null?void 0:Qn.message)==null?void 0:_a.includes("user rejected"))||((ed=(ao=Ge.t0Allowance.error)==null?void 0:ao.message)==null?void 0:ed.includes("User denied"))||((Sa=(Zl=Ge.t0Allowance.error)==null?void 0:Zl.message)==null?void 0:Sa.includes("user denied"))||((Zf=(rh=Ge.t0Allowance.error)==null?void 0:rh.message)==null?void 0:Zf.includes("rejected"))),ol=mc&&(((Qf=(oh=Ge.t1Allowance.error)==null?void 0:oh.message)==null?void 0:Qf.includes("User rejected"))||((il=(qr=Ge.t1Allowance.error)==null?void 0:qr.message)==null?void 0:il.includes("user rejected"))||((Ui=(sl=Ge.t1Allowance.error)==null?void 0:sl.message)==null?void 0:Ui.includes("User denied"))||((Bi=(ls=Ge.t1Allowance.error)==null?void 0:ls.message)==null?void 0:Bi.includes("user denied"))||((lr=(xi=Ge.t1Allowance.error)==null?void 0:xi.message)==null?void 0:lr.includes("rejected")));if(es||Ro||gc||ol||pt)return;const Bw=((Is=Ge.deposite)==null?void 0:Is.isPending)||((Sr=Ge.deposite)==null?void 0:Sr.isLoading),Fw=!!((rl=Ge.deposite)!=null&&rl.hash);if(Bw||Fw)return;if(Ge.isAllow&&((Mw=Ge.deposite)!=null&&Mw.depose)&&!Ee&&!pt){Ge.deposite.depose(),setTimeout(()=>{Cn.current=!1,Pn(!1)},2e3);return}return}else{if(at.deposit.isSuccess){F==null||F(),(J1=(X1=at.deposit).reset)==null||J1.call(X1);return}if(at.allowance.isNeed&&at.allowance.allow&&!Ee&&!pt){at.allowance.allow();return}const es=at.allowance.isApprove||at.allowance.isLoading,Aa=!!at.allowance.error&&(((ur=(Lw=at.allowance.error)==null?void 0:Lw.message)==null?void 0:ur.includes("User rejected"))||((ri=(Yi=at.allowance.error)==null?void 0:Yi.message)==null?void 0:ri.includes("user rejected"))||((Xo=(Ql=at.allowance.error)==null?void 0:Ql.message)==null?void 0:Xo.includes("User denied"))||((Xl=(ey=at.allowance.error)==null?void 0:ey.message)==null?void 0:Xl.includes("user denied"))||((Uw=($w=at.allowance.error)==null?void 0:$w.message)==null?void 0:Uw.includes("rejected")));if(es||Aa||pt)return;const mc=at.deposit.isPending||at.deposit.isLoading,gc=!!at.deposit.hash;if(mc||gc)return;if(at.isQuoted&&at.isAllow&&!at.deposit.isLoading&&!at.deposit.isPending&&!Ee&&!pt&&!gc&&((ah=at.deposit)==null?void 0:ah.execute)){at.deposit.execute(),setTimeout(()=>{Cn.current=!1,Pn(!1)},2e3);return}return}if(ve&&pe==="deposit"){if(ct.deposit.isSuccess){F==null||F(),ct.deposit.reset(),Cn.current=!1,Pn(!1);return}if(ct.allowance.isNeed&&ct.allowance.allow){ct.allowance.allow(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);return}if(N>0n&&ct.deposit.execute&&ct.isReady){ct.deposit.execute(),setTimeout(()=>{Cn.current=!1,Pn(!1)},2e3);return}Cn.current=!1,Pn(!1);return}if(ve&&pe==="withdraw"){if(Un.withdraw.isSuccess){F==null||F(),Un.withdraw.reset(),Cn.current=!1,Pn(!1);return}if(N>0n&&Un.withdraw.execute&&Un.isReady){Un.withdraw.execute(),setTimeout(()=>{Cn.current=!1,Pn(!1)},2e3);return}Cn.current=!1,Pn(!1);return}if(Fe&&pe==="withdraw"){const es=si==="sticky"?Bn:On;if(es.withdraw.isSuccess){F==null||F(),es.withdraw.reset(),Cn.current=!1,Pn(!1);return}if(es.allowance.isNeed&&es.allowance.allow&&!Xe){es.allowance.allow(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);return}if(yn>0n&&es.withdraw.execute&&!Xe){es.withdraw.execute(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);return}Cn.current=!1,Pn(!1);return}if(pe==="deposit"&&ke&&!Fe){if(ke.isSuccess){F==null||F(),ke.reset(),Cn.current=!1,Pn(!1);return}if(ke.token0NeedsApproval&&ke.canApproveToken0){ke.approveToken0(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);return}if(ke.token1NeedsApproval&&ke.canApproveToken1){ke.approveToken1(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);return}if(ke.canIncrease){ke.increaseLiquidity(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);return}if(ke.canSubmit&&!ke.canIncrease){console.error("[SwapForm] Cannot increase liquidity: simulation failed or not ready",{canSubmit:ke.canSubmit,canIncrease:ke.canIncrease,isSimulating:ke.isLoading,simulateError:(td=ke.errors)==null?void 0:td.simulate,parsedToken0Amount:ke.parsedToken0Amount.toString(),parsedToken1Amount:ke.parsedToken1Amount.toString()}),Cn.current=!1,Pn(!1);return}console.error("[SwapForm] Cannot execute deposit action",{canSubmit:ke.canSubmit,canIncrease:ke.canIncrease,token0NeedsApproval:ke.token0NeedsApproval,token1NeedsApproval:ke.token1NeedsApproval,parsedToken0Amount:ke.parsedToken0Amount.toString(),parsedToken1Amount:ke.parsedToken1Amount.toString(),val
7467idationErrors:ke.validationErrors}),Cn.current=!1,Pn(!1)}if(pe==="withdraw"&&nt&&!Fe){if(nt.isSuccess){F==null||F(),nt.reset();return}if(nt.canDecrease){nt.decreaseLiquidity();return}}if(pe==="swap"){if((hi||Zs)&&N>0n){if(hi&&zn.isSuccess){q.invalidateQueries({queryKey:["balance"]}),q.invalidateQueries({predicate:es=>{var Aa;const Ro=es.queryKey;return Ro[0]==="readContract"&&typeof Ro[1]=="object"&&((Aa=Ro[1])==null?void 0:Aa.functionName)==="balanceOf"}}),F==null||F(),zn.reset(),$(0n),j(0n);return}if(Zs&&zn.isSuccess)return;if(!zn.isLoading)try{Zs&&!Xp&&(B1(v),Ku(!0)),zn.redeem({amount:dt(N,18),receiver:K})}catch(es){console.error("[SwapForm] BGT redeem execution failed:",es),Ku(!1),B1(null)}return}if($t.isWrap)await $t.wrap(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);else if($t.isUnWrap)await $t.unwrap(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);else{if($t.status!=="ready"){Cn.current=!1,Pn(!1);return}if(!$t.optimizedRoute){console.error("[SwapForm] Cannot execute swap: no optimizedRoute available despite ready status",{status:$t.status,hasQuote:!!$t.quote,hasRoutes:((ty=$t.routes)==null?void 0:ty.length)>0}),Cn.current=!1,Pn(!1);return}if($t.needsApproval&&!$t.isApproveSuccess)await $t.approve(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3);else try{await $t.swap(),setTimeout(()=>{Cn.current=!1,Pn(!1)},1e3)}catch(es){console.error("[SwapForm] Swap execution failed:",es),Cn.current=!1,Pn(!1)}}}}},[rw,Ca,Fe,pe,ht,Ge,at,Ee,pt,Xe,Bn,On,si,ke,nt,$t,N,U,F,hi,zn,K,q]);M.useEffect(()=>{he.current=dw},[dw]),y5e({onBlockNumber(){$t.status==="ready"&&N>0n&&U>0n&&($t==null||$t.refresh())}}),M.useEffect(()=>{var fe;Q==="to"||oe.current||pe!=="swap"||hi||Zs||Q!=="to"&&((xe!=null&&xe.isWrap||xe!=null&&xe.isUnWrap)&&N>0n&&I&&v?U!==N&&(oe.current=!0,j(N),setTimeout(()=>{oe.current=!1},0)):(fe=xe==null?void 0:xe.quote)!=null&&fe.amountOut&&I&&v&&N>0n?xe.quote.amountOut!==U&&(oe.current=!0,j(xe.quote.amountOut),setTimeout(()=>{oe.current=!1},0)):N===0n&&U!==0n&&j(0n))},[(K1=xe==null?void 0:xe.quote)==null?void 0:K1.amountOut,xe==null?void 0:xe.isWrap,xe==null?void 0:xe.isUnWrap,xe==null?void 0:xe.status,Q,I,v,N,pe,U,xe]),M.useEffect(()=>{var fe;(We!=null&&We.isWrap||We!=null&&We.isUnWrap)&&Q==="to"&&U>0n&&I&&v&&!oe.current?N!==U&&(oe.current=!0,$(U),setTimeout(()=>{oe.current=!1},0)):(fe=We==null?void 0:We.quote)!=null&&fe.amountOut&&Q==="to"&&I&&v&&U>0n&&!oe.current?(oe.current=!0,$(We.quote.amountOut),setTimeout(()=>{oe.current=!1},0)):U===0n&&Q==="to"&&$(0n)},[(Yf=We==null?void 0:We.quote)==null?void 0:Yf.amountOut,We==null?void 0:We.isWrap,We==null?void 0:We.isUnWrap,Q,I,v,U,N]),M.useEffect(()=>{var fe,Se;oe.current||(ie==="from"&&Q==="from"&&N>0n&&I&&v&&xe.status==="ready"&&((fe=xe.quote)!=null&&fe.amountOut)&&Q!=="to"&&j(xe.quote.amountOut),ie==="to"&&Q==="to"&&U>0n&&I&&v&&We.status==="ready"&&((Se=We.quote)!=null&&Se.amountOut)&&$(We.quote.amountOut))},[ie,Q,N,U,I,v,xe.status,(Y1=xe.quote)==null?void 0:Y1.amountOut,We.status,(kw=We.quote)==null?void 0:kw.amountOut]),M.useEffect(()=>{var fe;if(it&&ke&&!Fe&&(ke.isSuccess||ke.status==="cancelled"||(fe=ke.errors)!=null&&fe.increase&&!ke.isLoading)){const Se=setTimeout(()=>{Cn.current=!1,Pn(!1)},500);return()=>clearTimeout(Se)}},[it,Fe,ke==null?void 0:ke.isSuccess,ke==null?void 0:ke.status,(Xu=ke==null?void 0:ke.errors)==null?void 0:Xu.increase,ke==null?void 0:ke.isLoading]),M.useEffect(()=>{if(it&&(ke!=null&&ke.isSuccess)){C!=null&&C.id&&K&&(q.invalidateQueries({queryKey:["user-positions",C.id,K]}),q.invalidateQueries({queryKey:["position",K]}),q.invalidateQueries({queryKey:["pool",C.id]})),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="balance"||Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}}),F==null||F();const fe=setTimeout(()=>{ke.reset(),$(0n),j(0n)},3e3);return()=>clearTimeout(fe)}if(Qt&&(nt!=null&&nt.isSuccess)){C!=null&&C.id&&K&&(q.invalidateQueries({queryKey:["user-positions",C.id,K]}),q.invalidateQueries({queryKey:["position",K]}),q.invalidateQueries({queryKey:["pool",C.id]}
7467)),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="balance"||Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}}),F==null||F();const fe=setTimeout(()=>{nt.reset(),Yu(0),Qs("")},3e3);return()=>clearTimeout(fe)}},[it,Qt,ke==null?void 0:ke.isSuccess,nt==null?void 0:nt.isSuccess,F,C==null?void 0:C.id,K,q]),M.useEffect(()=>{var Re;if(ve){pe==="deposit"&&(ct.allowance.isNeed&&N>0n&&(I!=null&&I.address)&&ct.allowance.isReady&&!ct.allowance.isApprove&&!ct.allowance.isLoading&&!qf||!ct.allowance.isNeed&&N>0n&&ct.isReady&&!ct.deposit.isPending&&!ct.deposit.isLoading&&!qf)&&Ne(!1);return}if(pe==="swap"&&$t.status==="success"){re(null),Ne(!1),Cn.current=!1,Pn(!1);const Be=setTimeout(()=>{$t.reset()},2e3);return()=>clearTimeout(Be)}if((hi||Zs)&&pe==="swap"){Ne(!1);return}const fe=((Re=$t.validation)==null?void 0:Re.errors)&&$t.validation.errors.length>0,Se=fe&&$t.validation.errors.some(Be=>Be.code==="INSUFFICIENT_BALANCE"||Be.code==="NO_ROUTE_FOUND"||Be.message.toLowerCase().includes("insufficient")||Be.message.toLowerCase().includes("balance")||Be.message.toLowerCase().includes("no route"));if($t.status==="error")if(Se)Ne(!0);else{Ne(!0);const Be=setTimeout(()=>{Ne(!1),$t.reset()},2e3);return()=>clearTimeout(Be)}else Se?Ne(!0):$t.status!=="error"&&!fe&&Ne(!1)},[ve,pe,ct.allowance.isNeed,ct.allowance.isReady,ct.allowance.isApprove,ct.allowance.isLoading,ct.isReady,ct.deposit.isPending,ct.deposit.isLoading,N,I==null?void 0:I.address,qf,$t.status,$t.error,$t.validation,hi,$t.reset]),M.useEffect(()=>{if(hi&&pe==="swap"&&zn.isSuccess){q.invalidateQueries({queryKey:["balance"]}),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}});const fe=setTimeout(()=>{zn.reset(),$(0n),j(0n)},2e3);return()=>clearTimeout(fe)}},[hi,pe,zn.isSuccess,zn.reset,q]),M.useEffect(()=>{a&&a(Dt||null,I,v)},[Dt,I,v,a]),M.useEffect(()=>{const fe=Se=>{H.current&&!H.current.contains(Se.target)&&(Se.target.closest(".iconLink")||O(!1))};return D&&document.addEventListener("mousedown",fe),()=>{document.removeEventListener("mousedown",fe)}},[D]),M.useEffect(()=>{c&&!I&&!de.current&&S(c)},[c==null?void 0:c.address,I==null?void 0:I.address]),M.useEffect(()=>{var fe,Se;if(l){const Re=(fe=v==null?void 0:v.address)==null?void 0:fe.toLowerCase(),Be=(Se=l.address)==null?void 0:Se.toLowerCase();Re!==Be&&_(l)}},[l==null?void 0:l.address,v==null?void 0:v.address]);const e9=M.useCallback(fe=>{de.current=!0,ee("from"),$(fe)},[]),t9=M.useCallback(fe=>{de.current=!0,ee("to"),j(fe)},[]),n9=["Form",s?"Form--sticky":"",n||""].filter(Boolean).join(" ");return m.jsxs("div",{className:n9,children:[m.jsx("div",{className:"Form__box",children:be?m.jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",gap:"16px"},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r&&m.jsx(Ke,{width:60,height:24,borderRadius:6}),m.jsx(Ke,{width:24,height:24,borderRadius:6})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[m.jsx(Ke,{width:80,height:14,borderRadius:6}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"12px"},children:[m.jsx(Ke,{width:"60%",height:28,borderRadius:14}),m.jsx(Ke,{width:120,height:52,borderRadius:14})]}),m.jsx(Ke,{width:100,height:12,borderRadius:6})]}),m.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0"},children:m.jsx(Ke,{width:28,height:28,borderRadius:14})}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[m.jsx(Ke,{width:80,height:14,borderRadius:6}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"12px"},children:[m.jsx(Ke,{width:"60%",height:28,borderRadius:14}),m.jsx(Ke,{width:120,height:52,borderRadius:14})]}),m.jsx(Ke,{width:100,height:12,borderRadius:6})]})]}),m.jsx(Ke,{width:"100%",height:52,borderRadius:14})]}):m.jsxs(m.Fragment,{children:[r&&m.jsx("div",{className:"Form__head Form__head--with-title",children:m.jsx("h3",{className:"Form__title",children:"Swap"})}),m.jsx("div",{style:{marginBottom:"12px"},children:m.jsx(k2,{style:{justifyContent:"flex-start"},segments:h?[{key:"deposit",label:"Deposit"},{key:"withdraw",label:"Withdraw"},...P?[]:[{key:"swap",label:"Swap"}]]:b&&b.length>0?[{key:"swap",label:"Swap"},...b.map(fe=>({key:fe.key,label:fe.label}))]:p?[{key:"swap",label:"Swap"},{key:"deposit-liquidity",label:"Add liquidity"}]:[{key:"swap",label:"Swap"}],selectedKey:pe,onChange:fe=>{if(b&&b.length>0){const Se=b.find(Re=>Re.key===fe);if(Se){G(Se.url);return}}if(fe==="deposit-liquidity"&&g){G(g);return}if(!h&&!p&&!b)Te("swap");else if(h){if(P&&fe==="swap")return;Te(fe)}else Te("swap")}})}),it&&Fe&&!ve&&Pt&&kt?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{marginBottom:"12px",display:"flex",alignItems:"center",gap:"8px"},children:m.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",userSelect:"none"},children:[m.jsxs("div",{style:{position:"relative",width:"18px",height:"18px"},children:[m.jsx("input",{type:"checkbox",checked:ht==="single",onCh
7467ange:fe=>{At(fe.target.checked?"single":"double"),fe.target.checked&&($(0n),j(0n),S(Pt))},style:{width:"18px",height:"18px",cursor:"pointer",borderRadius:"50%",appearance:"none",WebkitAppearance:"none",MozAppearance:"none",border:ht==="single"?"2px solid #FFB648":"2px solid rgba(255, 255, 255, 0.3)",backgroundColor:ht==="single"?"#FFB648":"transparent",position:"relative",transition:"all 0.2s ease",margin:0,padding:0},onMouseEnter:fe=>{ht!=="single"&&(fe.currentTarget.style.borderColor="rgba(255, 255, 255, 0.5)")},onMouseLeave:fe=>{ht!=="single"&&(fe.currentTarget.style.borderColor="rgba(255, 255, 255, 0.3)")}}),ht==="single"&&m.jsx("img",{src:jre,alt:"Checked",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",pointerEvents:"none",filter:"brightness(0) saturate(100%) invert(0%)",objectFit:"contain"}})]}),m.jsx("span",{style:{fontSize:"14px",color:"rgba(255, 255, 255, 0.9)"},children:"Single-sided deposit"})]})}),ht==="double"?m.jsxs("div",{className:"Inputs",children:[m.jsx(zy,{selectedToken:Pt,onSelect:void 0,onTokenSelect:void 0,onAmountChange:fe=>{if($(fe),fe>0n){const Se=GS(fe);j(Se)}else j(0n)},value:N,dominantColor:t,secondaryColor:e,isHomePage:i,disabled:!1,labelOverride:"Deposit amount"}),m.jsx(DI,{dominantColor:t,secondaryColor:e,onClick:()=>{},isActive:!1,mode:"deposit"}),m.jsx(II,{steps:{totalRatio:0,steps:[]},preSelected:kt,onSelect:void 0,inputValue:U,onInputChange:fe=>{if(j(fe),fe>0n){const Se=KS(fe);$(Se)}else $(0n)},dominantColor:t,secondaryColor:e,isHomePage:i,disabled:!1,labelOverride:"Deposit amount"})]}):m.jsx("div",{className:"Inputs",children:m.jsx(zy,{selectedToken:I||Pt,onSelect:fe=>{S(fe),$(0n),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="balance"||Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}})},onTokenSelect:fe=>{S(fe),$(0n),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="balance"||Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}})},onAmountChange:$,value:N,dominantColor:t,secondaryColor:e,isHomePage:i,disabled:!1,labelOverride:"Deposit amount",excludeToken:void 0,showAllTokens:!0})})]}):null,it&&ve&&m.jsxs("div",{className:"Inputs",children:[m.jsx(zy,{selectedToken:I,onSelect:fe=>{S(fe),$(0n),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="balance"||Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}})},onTokenSelect:fe=>{S(fe),$(0n),q.invalidateQueries({predicate:Se=>{var Be;const Re=Se.queryKey;return Re[0]==="balance"||Re[0]==="readContract"&&typeof Re[1]=="object"&&((Be=Re[1])==null?void 0:Be.functionName)==="balanceOf"}})},onAmountChange:$,value:N,dominantColor:t,secondaryColor:e,isHomePage:i,disabled:!1,labelOverride:"Deposit amount",excludeToken:void 0,showAllTokens:!0}),ct.preview.shares&&N>0n&&m.jsx("div",{className:"SwapMetrics",style:{marginTop:"12px"},children:m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:"You will receive"}),m.jsxs("span",{className:"SwapMetrics__value",children:[An(parseFloat(dt(ct.preview.shares,18)))," shares"]})]})})]}),Qt&&ve&&m.jsxs("div",{className:"Inputs",children:[m.jsx(zy,{selectedToken:B?{address:B,symbol:"WinHONEY",name:"Win HONEY",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL",priceUSD:0}:I,onSelect:void 0,onTokenSelect:void 0,onAmountChange:$,value:N,dominantColor:t,secondaryColor:e,isHomePage:i,disabled:!1,labelOverride:"Amount to withdraw (shares)",excludeToken:void 0,showAllTokens:!1}),Un.preview.assets&&N>0n&&m.jsxs("div",{className:"SwapMetrics",style:{marginTop:"12px"},children:[m.jsxs("div",{className:"SwapMetrics__row",children:[m.jsx("span",{className:"SwapMetrics__label",children:"You are removing"}),m.jsxs("span",{className:"SwapMetrics__value",children:[An(parseFloat(dt(N,18)))," WinHONEY"]})]}),m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:"You will receive"}),m.jsxs("span",{className:"SwapMetrics__value",children:[An(parseFloat(dt(Un.preview.assets,18)))," ",(I==null?void 0:I.symbol)||"HONEY"]})]})]})]}),it&&Fe&&!ve&&!o&&m.jsxs(m.Fragment,{children:[ht==="double"&&N>0n&&U>0n&&m.jsx(PG,{minShares:Ge.quote.minShares,expectedShares:Ge.quote.expectedShares,isQuoteLoading:Ge.isQuoteLoading,vaultToken0Symbol:Pt==null?void 0:Pt.symbol,vaultToken1Symbol:kt==null?void 0:kt.symbol,isAutoWin:En,slippageBps:100}),ht==="single"&&N>0n&&m.jsx(PG,{minShares:at.vaultQuote.minShares,expectedShares:at.vaultQuote.expectedShares,isQuoteLoading:at.swapQuote.isLoading,priceImpact:at.priceImpact,isPriceImpactLoading:at.swapQuote.isLoading,vaultToken0Symbol:Pt==null?void 0:Pt.symbol,vaultToken1Symbol:kt==null?void 0:kt.symbol,isAutoWin:En,slippageBps:100})]}),Qt&&Fe&&!ve&&Pt&&kt?m.jsxs("div",{className:"Inputs",children:[A&&!k&&m.jsxs("div",{style:{marginBottom:"12px",display:"flex",gap:"8px"},children:[m.jsxs("button",{className:`btn btn--tiny ${si==="sticky"?"btn__main btn__tab-active":"btn__shade"}`,onClick:()=>{Ln("sticky"),nl(0),va(""),bi(0n)},type:"button",children:[m.jsx("img",{src:foe,alt:"Sticky",style:{marginRight:"6px",width:"16px",height:"16px"}})," Sticky-Token"]}),m.jsxs("button",{className:`btn btn--tiny ${si==="autowin"?"btn__main btn__tab-active":"btn__shade"}`,onClick:()=>{Ln("autowin"),nl(0),va(""),bi(0n)},type:"button",children:[m.jsx("img",{src:poe,alt:"AutoWin",style:{marginRight:"6px",width:"16px",height:"16px"}})," AW-Sticky-Token"]})]}),m.jsxs("div",{className:`Inputs__From From From--${Ki>100?"error":"idle"}`,children:[m.jsx("div",{className:"From__Label",children:m.jsx("p",{children:"Amount to withdraw"})}),m.jsxs("div",{className:"From__AmountsAndChain",children:[m.jsx("div",{className:"From__Amounts",style:{position:"relative",width:"100%",overflow:"hidden",minWidth:0},children:m.jsx("input",{ref:V1,className:"From__Input",type:"text",inputMode:"numeric",placeholder:"0",value:pc,onFocus:()=>{W1.current=!0},onChange:fe=>{const Se=fe.target.value;if(Se===""||/^\d{0,3}$/.test(Se))if(va(Se),tm(!1),W1.current=!0,Se==="")nl(0);else{const Re=parseInt(Se);Re>=0&&nl(Re)}},onBlur:()=>{W1.current=!1,Ki===0?va(""):pc!==Ki.toString()&&va(Ki.toString())},disabled:Ca,style:{fontSize:`${aw}px`,lineHeight:`${cw}px`,height:`${cw}px`,verticalAlign:"middle",boxSizing:"border-box",width:"100%",textAlign:"left",overflow:"hidden",textOverflow:"clip",paddingRight:"0",color:Ki>100?"#FF7456":void 0}})}),m.jsx("div",{className:"From__LogosAndBalance",children:m.jsx("div",{className:`From__Logos${Ca?" From__disabled":""}`,children:m.jsx("div",{style:{background:"rgba(26, 26, 26, 0.5)",backdropFilter:"blur(20px) saturate(200%)",WebkitBackdropFilter:"blur(20px) saturate(200%)",borderRadius:"999px",border:"0.5px solid rgba(255, 255, 255, 0.12)",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.05)",padding:"0 16px",fontSize:"14px",fontWeight:"600",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",minWidth:"60px",height:"40px",boxSizing:"border-box",fontFamily:'"TT Hoves", system-ui, sans-serif',lineHeight:"24px",transition:"all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)"},children:"%"})})})]}),m.jsxs("div",{className:"From__Details",children:[m.jsxs("p",{className:"From__Convertion",children:["$",YS]}),m.jsx("div",{className:"From__Balance",style:{display:"flex",alignItems:"center",justifyContent:"flex-end",width:"100%"},children:m.jsx("div",{style:{fontSize:"14px",fontWeight:"500"},children:m.jsx(k2,{segments:[{key:"25",label:"25%"},{key:"50",label:"50%"},{key:"75",label:"75%"},{key:"100",label:"100%"}],selectedKey:C4&&["25","50","75","100"].includes(Ki.toString())?Ki.toString():"0",onChange:fe=>{if(!Ca){const Se=parseInt(fe);nl(Se),va(fe),tm(!0)}},style:{justifyContent:"flex-end",gap:"4px",width:"auto"}})})})]})]})]}):null,Qt&&Fe&&!ve&&Ki>0&&m.jsxs("div",{className:"SwapMetrics",style:{marginTop:"12px"},children:[m.jsxs("div",{className:"SwapMetrics__row",children:[m.jsx("span",{className:"SwapMetrics__label",children:"You are removing"}),m.jsxs("span",{className:"SwapMetrics__value",children:[si==="sticky"&&Wr&&(()=>{const Se=(Wr.shares||0n)*BigInt(Ki)/100n;if(Se===0n)return m.jsxs("span",{children:["No balance in wallet",R&&" â unstake from Infrared/Berahub first to withdraw here"]});const Re=parseFloat(dt(Se,18));return`${i1(Re)} Sticky Vault`})(),si==="autowin"&&el&&(()=>{const Se=(el.shares||0n)*BigInt(Ki)/100n;if(Se===0n)return m.jsxs("span",{children:["No balance in wallet",R&&" â unstake from Infrared/Berahub first to withdraw here"]});const Re=parseFloat(dt(Se,18));return`${i1(Re)} AW-${Pt==null?void 0:Pt.symbol}-${kt==null?void 0:kt.symbol}`})()]})]}),m.jsxs("div",{className:"SwapMetrics__row",style:{marginTop:"4px"},children:[m.jsx("span",{className:"SwapMetrics__label",children:"You will receive (estimated)"}),m.jsx("span",{className:"SwapMetrics__value"})]}),si==="sticky"&&Bn.estimatedAmounts&&Pt&&kt&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"SwapMetrics__row",children:[m.jsx("span",{className:"SwapMetrics__label",children:Pt.symbol}),m.jsx("span",{className:"SwapMetrics__value",children:`${parseFloat(dt(Bn.estimatedAmounts.amount0,Pt.decimals||18)).toFixed(6)}`})]}),m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:kt.symbol}),m.jsx("span",{className:"SwapMetrics__value",children:`${parseFloat(dt(Bn.estimatedAmounts.amount1,kt.decimals||18)).toFixed(6)}`})]})]}),si==="autowin"&&On.estimatedAmount&&Pt&&kt&&m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:`STICKY ${Pt.symbol}-${kt.symbol}`}),m.jsx("span",{className:"SwapMetrics__value",children:`${parseFloat(dt(On.estimatedAmount,18)).toFixed(6)}`})]})]}),Qt&&C&&nt&&!Fe?m.jsxs("div",{className:"Inputs",children:[m.jsxs("div",{className:`Inputs__From From From--${xs>100?"error":"idle"}`,children:[m.jsx("div",{className:"From__Label",children:m.jsx("p",{children:"Amount to withdraw"})}),m.jsxs("div",{className:"From__AmountsAndChain",children:[m.jsx("div",{className:"From__Amounts",style:{position:"relative",width:"100%",overflow:"hidden",minWidth:0},children:m.jsx("input",{ref:Qu,className:"From__Input",type:"text",inputMode:"numeric",placeholder:"0",value:Zu,onFocus:()=>{j1.current=!0},onChange:fe=>{const Se=fe.target.value;if(Se===""||/^\d{0,3}$/.test(Se))if(Qs(Se),Vf(!1),j1.current=!0,Se==="")Yu(0);else{const Re=parseInt(Se);Re>=0&&Yu(Re)}},onBlur:()=>{j1.current=!1,xs===0?Qs(""):Zu!==xs.toString()&&Qs(xs.toString())},disabled:Ca,style:{fontSize:`${ow}px`,lineHeight:`${x4}px`,height:`${x4}px`,verticalAlign:"middle",boxSizing:"border-box",width:"100%",textAlign:"left",overflow:"hidden",textOverflow:"clip",paddingRight:"0",color:xs>100?"#FF7456":void 0}})}),m.jsx("div",{className:"From__LogosAndBalance",children:m.jsx("div",{className:`From__Logos${Ca?" From__disabled":""}`,children:m.jsx("div",{style:{background:"rgba(26, 26, 26, 0.5)",backdropFilter:"blur(20px) saturate(200%)",WebkitBackdropFilter:"blur(20px) saturate(200%)",borderRadius:"999px",border:"0.5px solid rgba(255, 255, 255, 0.12)",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.05)",padding:"0 16px",fontSize:"14px",fontWeight:"600",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",minWidth:"60px",height:"40px",boxSizing:"border-box",fontFamily:'"TT Hoves", system-ui, sans-serif',lineHeight:"24px",transition:"all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)"},children:"%"})})})]}),m.jsxs("div",{className:"From__Details",children:[m.jsxs("p",{className:"From__Convertion",children:["$",ZS]}),m.jsx("div",{className:"From__Balance",style:{display:"flex",alignItems:"center",justifyContent:"flex-end",width:"100%"},children:m.jsx("div",{style:{fontSize:"14px",fontWeight:"500"},children:m.jsx(k2,{segments:[{key:"25",label:"25%"},{key:"50",label:"50%"},{key:"75",label:"75%"},{key:"100",label:"100%"}],selectedKey:th&&["25","50","75","100"].includes(xs.toString())?xs.toString():"0",onChange:fe=>{if(!Ca){const Se=parseInt(fe);Yu(Se),Qs(fe),Vf(!0)}},style:{justifyContent:"flex-end",gap:"4px",width:"auto"}})})})]})]}),xs>0&&nt.estimatedAmounts&&m.jsxs("div",{className:"SwapMetrics",style:{marginTop:"0"},children:[m.jsxs("div",{className:"SwapMetrics__row",children:[m.jsx("span",{className:"SwapMetrics__label",children:"You will receive (estimated)"}),m.jsx("span",{className:"SwapMetrics__value"})]}),m.jsxs("div",{className:"SwapMetrics__row",children:[m.jsx("span",{className:"SwapMetrics__label",children:C.token0Ref.symbol}),m.jsx("span",{className:"SwapMetrics__value",children:nt.estimatedAmounts.token0Amount>0n?parseFloat(dt(nt.estimatedAmounts.token0Amount,C.token0Ref.decimals)).toFixed(6):"0"})]}),m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:C.token1Ref.symbol}),m.jsx("span",{className:"SwapMetrics__value",children:nt.estimatedAmounts.token1Amount>0n?parseFloat(dt(nt.estimatedAmounts.token1Amount,C.token1Ref.decimals)).toFixed(6):"0"})]})]})]}):pe==="swap"||!Fe&&pe==="deposit"&&C?m.jsxs("div",{className:"Inputs",children:[m.jsx(zy,{selectedToken:it&&C?fK(C.token0Ref):I,onTokenSelect:it?void 0:QS,onAmountChange:fe=>{var Se;if(it&&ke){const Re=((Se=C==null?void 0:C.token0Ref)==null?void 0:Se.decimals)||18,Be
7467=dt(fe,Re);ke.setToken0Amount(Be)}else e9(fe)},value:it&&ke?ke.parsedToken0Amount:N,dominantColor:t,secondaryColor:e,isHomePage:i,disabled:it?!1:!I,onBlur:()=>{},excludeToken:I,labelOverride:pe==="deposit"?"Deposit amount":void 0,priceUSDOverride:Gl[0]?Kl[Gl[0].toLowerCase()]:void 0},it&&C?`deposit-${C.token0Ref.id}`:`swap-${I==null?void 0:I.address}`),m.jsx(DI,{dominantColor:t,secondaryColor:e,onClick:JS,isActive:!!I&&!!v&&!it,mode:pe}),m.jsx(II,{steps:{totalRatio:0,steps:[]},preSelected:it&&C?fK(C.token1Ref):v,onSelect:it?void 0:XS,inputValue:it&&ke?ke.parsedToken1Amount:U,isLoadingRoute:!it&&uw,onInputChange:fe=>{var Se;if(it&&ke){const Re=((Se=C==null?void 0:C.token1Ref)==null?void 0:Se.decimals)||18,Be=dt(fe,Re);ke.setToken1Amount(Be)}else t9(fe)},dominantColor:t,secondaryColor:e,isHomePage:i,disabled:it?!1:!v,priceUSDOverride:Gl[1]?Kl[Gl[1].toLowerCase()]:void 0})]}):null,!o&&pe==="swap"&&I&&v&&N>0n&&m.jsx(Vze,{swap:$t,fromToken:I,toToken:v,fromAmount:N,toAmount:U,slippageConfig:J,onSlippageChange:W}),it&&w&&m.jsx("div",{className:"SwapMetrics",children:m.jsxs("div",{className:"SwapMetrics__row SwapMetrics__row--last",children:[m.jsx("span",{className:"SwapMetrics__label",children:"Depositing into position"}),m.jsxs("span",{className:"SwapMetrics__value",children:["#",w.tokenId]})]})}),m.jsx("div",{className:"Form__ConnectBtnWrapper",children:z?m.jsx("div",{className:"Form__ConnectBtn",children:m.jsx("button",{"data-swap-button":!0,className:`btn btn--large btn__${lw&&!Ca&&!_e?"main":"disabled"}`,onClick:fe=>{fe.preventDefault(),fe.stopPropagation(),!(!lw||Ca)&&(Fe&&pe==="deposit"&&(Ee||pt)||Fe&&pe==="withdraw"&&Xe||dw())},disabled:!lw||Ca||uw||Fe&&pe==="deposit"&&(Ee||pt)||Fe&&pe==="withdraw"&&Xe,children:Ca||uw?m.jsx(u4,{size:"small",color:"#171410"}):E4===null?m.jsx(Ke,{width:80,height:20,borderRadius:6}):m.jsx("span",{className:_e?"SwapForm__errorText":"",children:E4})})}):m.jsx("div",{className:"Form__ConnectBtn",children:m.jsx(QM,{size:"large",dominantColor:t,secondaryColor:e,variant:"main"})})})]})}),ke&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:(ke.status==="approving"||ke.status==="increasing"||ke.status==="waitingIncrease"||ke.status==="waitingApproval")&&ke.status!=="cancelled",message:(ke.status==="approving"||ke.status==="waitingApproval")&&(I!=null&&I.symbol)?`${I.symbol} approval is pending`:"Deposit is pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:ke.status==="success"&&!!ke.increaseLiquidityHash,message:"Deposit is confirmed",type:"success",link:ke.increaseLiquidityHash?{href:`https://berascan.com/tx/${ke.increaseLiquidityHash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:ke.status==="cancelled",message:"Deposit is cancelled",type:"cancelled",duration:3e3,position:"top-right"})]}),nt&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:(nt.status==="decreasing"||nt.status==="waitingDecrease")&&nt.status!=="cancelled",message:"Withdraw is pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:nt.status==="success"&&!!nt.decreaseHash,message:"Withdraw is confirmed",type:"success",link:nt.decreaseHash?{href:`https://berascan.com/tx/${nt.decreaseHash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:nt.status==="cancelled",message:"Withdraw is cancelled",type:"cancelled",duration:3e3,position:"top-right"})]}),(xe||We)&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:xe.status==="approving"||xe.status==="swapping"||xe.status==="wrapping"||xe.status==="unwrapping"||We.status==="approving"||We.status==="swapping"||We.status==="wrapping"||We.status==="unwrapping",message:xe.status==="approving"||We.status==="approving"?"Approval pending":xe.status==="wrapping"||We.status==="wrapping"?"Wrapping pending":xe.status==="unwrapping"||We.status==="unwrapping"?"Unwrapping pending":"Swap is pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:(xe.isApproveSuccess&&!!xe.approveTxHash||We.isApproveSuccess&&!!We.approveTxHash)&&!(xe.status==="success"&&xe.txhash||We.status==="success"&&We.txhash),message:"Approval confirmed",type:"success",link:xe.isApproveSuccess&&xe.approveTxHash?{href:`https://berascan.com/tx/${xe.approveTxHash}`,text:"View"}:We.isApproveSuccess&&We.approveTxHash?{href:`https://berascan.com/tx/${We.approveTxHash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:xe.status==="success"&&!!xe.txhash||We.status==="success"&&!!We.txhash,message:"Swap is confirmed",type:"success",link:xe.status==="success"&&xe.txhash?{href:`https://berascan.com/tx/${xe.txhash}`,text:"View"}:We.status==="success"&&We.txhash?{href:`https://berascan.com/tx/${We.txhash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:xe.status==="error"&&!!xe.error||We.status==="error"&&!!We.error,message:(()=>{const fe=xe.status==="error"&&xe.error||We.status==="error"&&We.error,Se=(fe==null?void 0:fe.message)||"",Re=(fe==null?void 0:fe.toString())||"",Be=Se||Re;if(Be.includes("User rejected")||Be.includes("user rejected")||Be.includes("User denied")||Be.includes("user denied")||Be.includes("rejected"))return xe!=null&&xe.isWrap||We!=null&&We.isWrap?"Wrap cancelled":xe!=null&&xe.isUnWrap||We!=null&&We.isUnWrap?"Unwrap cancelled":"Swap cancelled";const Ht=Se||Re||"Transaction failed";return Ht.length>100?Ht.substring(0,100)+"...":Ht})(),type:(()=>{const fe=xe.status==="error"&&xe.error||We.status==="error"&&We.error,Se=(fe==null?void 0:fe.message)||"",Re=(fe==null?void 0:fe.toString())||"",Be=Se||Re;return Be.includes("User rejected")||Be.includes("user rejected")||Be.includes("User denied")||Be.includes("user denied")||Be.includes("rejected")?"cancelled":"error"})(),duration:3e3,position:"top-right"})]}),hi&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:zn.isPending||zn.isConfirming,message:zn.isPending?"Redeem is pending":"Confirming redeem...",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:zn.isSuccess&&!!zn.hash,message:"Redeem is confirmed",type:"success",link:zn.hash?{href:`https://berascan.com/tx/${zn.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:!!zn.error,message:(()=>{var Ht,qn;const fe=((Ht=zn.error)==null?void 0:Ht.message)||"",Se=((qn=zn.error)==null?void 0:qn.toString())||"",Re=fe||Se;if(Re.includes("User rejected")||Re.includes("user rejected")||Re.includes("User denied")||Re.includes("user denied")||Re.includes("rejected"))return"Redeem cancelled";const St=fe||Se||"Redeem failed";return St.length>100?St.substring(0,100)+"...":St})(),type:(()=>{var St,Ht;const fe=((St=zn.error)==null?void 0:St.message)||"",Se=((Ht=zn.error)==null?void 0:Ht.toString())||"",Re=fe||Se;return Re.includes("User rejected")||Re.includes("user rejected")||Re.includes("User denied")||Re.includes("user denied")||Re.includes("rejected")?"cancelled":"error"})(),duration:3e3,position:"top-right"})]}),Fe&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:pt,message:"Approval is cancelled",type:"cancelled",duration:3e3,position:"top-right"}),ht==="double"&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:(mt||((sh=Ge.deposite)==null?void 0:sh.isPending)||((Z1=Ge.deposite)==null?void 0:Z1.isLoading)||Ge.t0Allowance.isApprove||Ge.t0Allowance.isLoading||Ge.t1Allowance.isApprove||Ge.t1Allowance.isLoading)&&!Ee&&!Mt&&!((Nw=Ge.deposite)!=null&&Nw.isSuccess&&((Ju=Ge.deposite)!=null&&Ju.hash)),message:Ge.t0Allowance.isApprove||Ge.t1Allowance.isApprove?`${[Ge.t0Allowance.isApprove?Pt==null?void 0:Pt.symbol
7467:null,Ge.t1Allowance.isApprove?kt==null?void 0:kt.symbol:null].filter(Boolean).join(" / ")} approval is pending`:"Deposit is pending",type:"loading",duration:0,onClose:()=>nn(!0),position:"top-right"}),m.jsx(In,{isVisible:((Rw=Ge.deposite)==null?void 0:Rw.isSuccess)&&!!((Pw=Ge.deposite)!=null&&Pw.hash)&&ln,message:"Deposit is confirmed",type:"success",link:(Iw=Ge.deposite)!=null&&Iw.hash?{href:`https://berascan.com/tx/${Ge.deposite.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:Ee,message:"Deposit is cancelled",type:"cancelled",duration:3e3,position:"top-right"})]}),ht==="single"&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:(mt||((M4=at.deposit)==null?void 0:M4.isPending)||((L4=at.deposit)==null?void 0:L4.isLoading)||at.allowance.isApprove||at.allowance.isLoading)&&!Ee&&!Mt&&!(($4=at.deposit)!=null&&$4.isSuccess&&((Dw=at.deposit)!=null&&Dw.hash)),message:at.allowance.isApprove&&(I!=null&&I.symbol)?`${I.symbol} approval is pending`:"Deposit is pending",type:"loading",duration:0,onClose:()=>nn(!0),position:"top-right"}),m.jsx(In,{isVisible:((Ow=at.deposit)==null?void 0:Ow.isSuccess)&&!!((Q1=at.deposit)!=null&&Q1.hash)&&ln,message:"Deposit is confirmed",type:"success",link:(xa=at.deposit)!=null&&xa.hash?{href:`https://berascan.com/tx/${at.deposit.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:Ee,message:"Deposit is cancelled",type:"cancelled",duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:(()=>{var Ht,qn;const fe=(Ht=at.deposit)==null?void 0:Ht.error;if(!fe||!(mt||(qn=at.deposit)!=null&&qn.isPending)||Ee)return!1;const Se=(fe==null?void 0:fe.message)||(fe==null?void 0:fe.toString())||"",Re=String(fe||""),Be=Se||Re;return!(Be.includes("functionName is required")||Be.includes("address is required")||Be.includes("abi is required")||Be.includes("Function name is required")||Be.includes("Swap: swap failed")||Be.includes("ContractFunctionExecutionError")&&Be.includes("multicall")&&Be.includes("reverted"))})(),message:(()=>{var Ht;
7467const fe=(Ht=at.deposit)==null?void 0:Ht.error,Se=(fe==null?void 0:fe.message)||(fe==null?void 0:fe.toString())||"",Re=String(fe||""),Be=Se||Re;return Be.includes("User rejected")||Be.includes("user rejected")||Be.includes("User denied")||Be.includes("user denied")||Be.includes("rejected")?"Deposit cancelled":Se||Re||"Transaction failed"})(),type:(()=>{var Ht;const fe=(Ht=at.deposit)==null?void 0:Ht.error,Se=(fe==null?void 0:fe.message)||(fe==null?void 0:fe.toString())||"",Re=String(fe||""),Be=Se||Re;return Be.includes("User rejected")||Be.includes("user rejected")||Be.includes("User denied")||Be.includes("user denied")||Be.includes("rejected")?"cancelled":"error"})(),duration:3e3,position:"top-right"})]})]}),Fe&&!ve&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:((si==="sticky"?Bn.withdraw.isPending||Bn.withdraw.isLoading:On.withdraw.isPending||On.withdraw.isLoading)||(si==="sticky"?Bn.allowance.isApprove||Bn.allowance.isLoading:On.allowance.isApprove||On.allowance.isLoading))&&!Xe,message:(si==="sticky"?Bn.allowance.isApprove:On.allowance.isApprove)?"Approval pending":"Withdraw is pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:(si==="sticky"?Bn.withdraw.isSuccess:On.withdraw.isSuccess)&&!!(si==="sticky"?Bn.withdraw.hash:On.withdraw.hash)&&Cs,message:"Withdraw is confirmed",type:"success",link:(si==="sticky"?Bn.withdraw.hash:On.withdraw.hash)?{href:`https://berascan.com/tx/${si==="sticky"?Bn.withdraw.hash:On.withdraw.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:Xe,message:"Withdraw is cancelled",type:"cancelled",duration:3e3,position:"top-right"})]}),ve&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:qu&&!!ct.allowance.hash&&!dc&&!hc&&!(ct.allowance.isSuccess&&ct.allowance.hash),message:`${(I==null?void 0:I.symbol)||"Token"} approval is pending`,type:"loading",duration:0,onClose:()=>Qc(!0),position:"top-right"}),m.jsx(In,{isVisible:ct.allowance.isSuccess&&!!ct.allowance.hash&&Xc,message:`${(I==null?void 0:I.symbol)||"Token"} approval is confirmed`,type:"success",link:ct.allowance.hash?{href:`https://berascan.com/tx/${ct.allowance.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:dc,message:"Approval is cancelled",type:"cancelled",duration:3e3,position:"top-right"}),pe==="deposit"&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:(Zn||ct.deposit.isPending||ct.deposit.isLoading)&&!Vr&&!(ct.deposit.isSuccess&&ct.deposit.hash),message:"Deposit is pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:ct.deposit.isSuccess&&!!ct.deposit.hash&&Qd,message:"Deposit is confirmed",type:"success",link:ct.deposit.hash?{href:`https://berascan.com/tx/${ct.deposit.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:Vr,message:"Deposit is cancelled",type:"cancelled",duration:3e3,position:"top-right"})]}),pe==="withdraw"&&m.jsxs(m.Fragment,{children:[m.jsx(In,{isVisible:(Us||Un.withdraw.isPending||Un.withdraw.isLoading)&&!ko&&!(Un.withdraw.isSuccess&&Un.withdraw.hash),message:"Withdraw is pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:Un.withdraw.isSuccess&&!!Un.withdraw.hash&&Hu,message:"Withdraw is confirmed",type:"success",link:Un.withdraw.hash?{href:`https://berascan.com/tx/${Un.withdraw.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:ko,message:"Withdraw is cancelled",type:"cancelled",duration:3e3,position:"top-right"})]})]})]})});Of.displayName="SwapForm";function rs(t){var e=t.width,n=t.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(n<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:n}}function wg(t,e){return t.width===e.width&&t.height===e.height}var VKe=(function(){function t(e){var n=this;this._resolutionListener=function(){return n._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return t.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(t.prototype,"value",{get:function(){return this._window.devicePixelRatio}
7467,enumerable:!1,configurable:!0}),t.prototype.subscribe=function(e){var n=this,i={next:e};return this._observers.push(i),{unsubscribe:function(){n._observers=n._observers.filter(function(s){return s!==i})}}},t.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(n){return n.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},t})();function WKe(t){return new VKe(t)}var qKe=(function(){function t(e,n,i){var s;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=rs({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=n??(function(r){return r}),this._allowResizeObserver=(s=i==null?void 0:i.allowResizeObserver)!==null&&s!==void 0?s:!0,this._chooseAndInitObserver()}return t.prototype.dispose=function(){var e,n;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(n=this._devicePixelRatioObservable)===null||n===void 0||n.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(t.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bitmapSize",{get:function(){return rs({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),t.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=rs(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},t.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},t.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(n){return n!==e})},Object.defineProperty(t.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),t.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},t.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(n){return n!==e})},t.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},t.prototype._resizeBitmap=function(e){var n=this.bitmapSize;wg(n,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(n,e))},t.prototype._emitBitmapSizeChanged=function(e,n){var i=this;
7467this._bitmapSizeChangedListeners.forEach(function(s){return s.call(i,e,n)})},t.prototype._suggestNewBitmapSize=function(e){var n=this._suggestedBitmapSize,i=rs(this._transformBitmapSize(e,this._canvasElementClientSize)),s=wg(this.bitmapSize,i)?null:i;n===null&&s===null||n!==null&&s!==null&&wg(n,s)||(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(n,s))},t.prototype._emitSuggestedBitmapSizeChanged=function(e,n){var i=this;this._suggestedBitmapSizeChangedListeners.forEach(function(s){return s.call(i,e,n)})},t.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}HKe().then(function(n){return n?e._initResizeObserver():e._initDevicePixelRatioObservable()})},t.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var n=mK(this._canvasElement);if(n===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=WKe(n),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},t.prototype._invalidateBitmapSize=function(){var e,n;if(this._canvasElement!==null){var i=mK(this._canvasElement);if(i!==null){var s=(n=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&n!==void 0?n:i.devicePixelRatio,r=this._canvasElement.getClientRects(),o=r[0]!==void 0?GKe(r[0],s):rs({width:this._canvasElementClientSize.width*s,height:this._canvasElementClientSize.height*s});this._suggestNewBitmapSize(o)}}},t.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(n){var i=n.find(function(o){return o.target===e._canvasElement});if(!(!i||!i.devicePixelContentBoxSize||!i.devicePixelContentBoxSize[0])){var s=i.devicePixelContentBoxSize[0],r=rs({width:s.inlineSize,height:s.blockSize});e._suggestNewBitmapSize(r)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},t})();function zKe(t,e){return new qKe(t,e.transform,e.options)}function mK(t){return t.ownerDocument.defaultView}function HKe(){return new Promise(function(t){var e=new ResizeObserver(function(n){t(n.every(function(i){return"devicePixelContentBoxSize"in i})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function GKe(t,e){return rs({width:Math.round(t.left*e+t.width*e)-Math.round(t.left*e),height:Math.round(t.top*e+t.height*e)-Math.round(t.top*e)})}var KKe=(function(){function t(e,n,i){if(n.width===0||n.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=n,i.width===0||i.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=i,this._context=e}return t.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},t.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(t.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),t})();function l1(t,e){var n=t.canvasElementClientSize;if(n.width===0||n.height===0)return null;var i=t.bitmapSize;if(i.width===0||i.height===0)return null;var s=t.canvasElement.getContext("2d",e);return s===null?null:new KKe(s,n,i)}/*! 7468 * @license 7469 * TradingView Lightweight Charts⢠v5.0.9 7470 * Copyright (c) 2025 TradingView, Inc. 7471 * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0 7472 */const moe={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var gK,yK;function Up(t,e){const n={0:[],1:[t.lineWidth,t.lineWidth],2:[2*t.lineWidth,2*t.lineWidth],3:[6*t.lineWidth,6*t.lineWidth],4:[t.lineWidth,4*t.lineWidth]}[e];t.setLineDash(n)}function goe(t,e,n,i){t.beginPath();const s=t.lineWidth%2?.5:0;t.moveTo(n,e+s),t.lineTo(i,e+s),t.stroke()}function vo(t,e){if(!t)throw new Error("Assertion failed"+(e?": "+e:""))}function ic(t){if(t===void 0)throw new Error("Value is undefined");return t}function gt(t){if(t===null)throw new Error("Value is null");return t}function ap(t){return gt(ic(t))}
7472(function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps",t[t.Curved=2]="Curved"})(gK||(gK={})),(function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"})(yK||(yK={}));class rr{constructor(){this.t=[]}i(e,n,i){const s={h:e,l:n,o:i===!0};this.t.push(s)}_(e){const n=this.t.findIndex((i=>e===i.h));n>-1&&this.t.splice(n,1)}u(e){this.t=this.t.filter((n=>n.l!==e))}p(e,n,i){const s=[...this.t];this.t=this.t.filter((r=>!r.o)),s.forEach((r=>r.h(e,n,i)))}v(){return this.t.length>0}m(){this.t=[]}}function jc(t,...e){for(const n of e)for(const i in n)n[i]!==void 0&&Object.prototype.hasOwnProperty.call(n,i)&&!["__proto__","constructor","prototype"].includes(i)&&(typeof n[i]!="object"||t[i]===void 0||Array.isArray(n[i])?t[i]=n[i]:jc(t[i],n[i]));return t}function Cb(t){return typeof t=="number"&&isFinite(t)}function Q5(t){return typeof t=="number"&&t%1==0}function b4(t){return typeof t=="string"}function Lx(t){return typeof t=="boolean"}function Qh(t){const e=t;if(!e||typeof e!="object")return e;let n,i,s;for(i in n=Array.isArray(e)?[]:{},e)e.hasOwnProperty(i)&&(s=e[i],n[i]=s&&typeof s=="object"?Qh(s):s);return n}function YKe(t){return t!==null}function X5(t){return t===null?void 0:t}const pL="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function J5(t,e,n){return e===void 0&&(e=pL),`${n=n!==void 0?`${n} `:""}${t}px ${e}`}class ZKe{constructor(e){this.M={S:1,C:5,P:NaN,k:"",T:"",R:"",D:"",V:0,B:0,I:0,A:0,L:0},this.O=e}N(){const e=this.M,n=this.F(),i=this.W();return e.P===n&&e.T===i||(e.P=n,e.T=i,e.k=J5(n,i),e.A=2.5/12*n,e.V=e.A,e.B=n/12*e.C,e.I=n/12*e.C,e.L=0),e.R=this.H(),e.D=this.U(),this.M}H(){return this.O.N().layout.textColor}U(){return this.O.$()}F(){return this.O.N().layout.fontSize}W(){return this.O.N().layout.fontFamily}}function tN(t){return t<0?0:t>255?255:Math.round(t)||0}function bK(t){return .199*t[0]+.687*t[1]+.114*t[2]}class QKe{constructor(e,n){this.q=new Map,this.Y=e,n&&(this.q=n)}j(e,n){if(e==="transparent")return e;const i=this.K(e),s=i[3];return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${n*s})`}X(e){const n=this.K(e);return{Z:`rgb(${n[0]}, ${n[1]}, ${n[2]})`,G:bK(n)>160?"black":"white"}}J(e){return bK(this.K(e))}tt(e,n,i){const[s,r,o,a]=this.K(e),[c,l,d,h]=this.K(n),p=[tN(s+i*(c-s)),tN(r+i*(l-r)),tN(o+i*(d-o)),(g=a+i*(h-a),g<=0||g>1?Math.min(Math.max(g,0),1):Math.round(1e4*g)/1e4)];var g;return`rgba(${p[0]}, ${p[1]}, ${p[2]}, ${p[3]})`}K(e){const n=this.q.get(e);if(n)return n;const i=(function(o){const a=document.createElement("div");a.style.display="none",document.body.appendChild(a),a.style.color=o;const c=window.getComputedStyle(a).color;return document.body.removeChild(a),c})(e),s=i.match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);if(!s){if(this.Y.length)for(const o of this.Y){const a=o(e);if(a)return this.q.set(e,a),a}throw new Error(`Failed to parse color: ${e}`)}const r=[parseInt(s[1],10),parseInt(s[2],10),parseInt(s[3],10),s[4]?parseFloat(s[4]):1];return this.q.set(e,r),r}}class yoe{constructor(){this.it=[]}st(e){this.it=e}nt(e,n,i){this.it.forEach((s=>{s.nt(e,n,i)}))}}class Yp{nt(e,n,i){e.useBitmapCoordinateSpace((s=>this.et(s,n,i)))}}class XKe extends Yp{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et({context:e,horizontalPixelRatio:n,verticalPixelRatio:i}){if(this.rt===null||this.rt.lt===null)return;const s=this.rt.lt,r=this.rt,o=Math.max(1,Math.floor(n))%2/2,a=c=>{e.beginPath();for(let l=s.to-1;l>=s.from;--l){const d=r.ot[l],h=Math.round(d._t*n)+o,p=d.ut*i,g=c*i+o;e.moveTo(h,p),e.arc(h,p,g,0,2*Math.PI)}e.fill()};r.ct>0&&(e.fillStyle=r.dt,a(r.ft+r.ct)),e.fillStyle=r.vt,a(r.ft)}}function JKe(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:"",dt:"",ft:0,ct:0,lt:null}}const eYe={from:0,to:1};class tYe{constructor(e,n,i){this.Mt=new yoe,this.bt=[],this.St=[],this.xt=!0,this.O=e,this.Ct=n,this.Pt=i,this.Mt.st(this.bt)}yt(e){this.kt(),this.xt=!0}Tt(){return this.xt&&(this.Rt(),this.xt=!1),this.Mt}kt(){const e=this.Pt.Dt();e.length!==this.bt.length&&(this.St=e.map(JKe),this.bt=this.St.map((n=>{const i=new XKe;return i.ht(n),i})),this.Mt.st(this.bt))}Rt(){const e=this.Ct.N().mode===2||!this.Ct.Vt(),n=this.Pt.Bt(),i=this.Ct.It(),s=this.O.Et();
vendor: 12,539 bytes, line 7472
7472this.kt(),n.forEach(((r,o)=>{const a=this.St[o],c=r.At(i),l=r.zt();!e&&c!==null&&r.Vt()&&l!==null?(a.vt=c.Lt,a.ft=c.ft,a.ct=c.Ot,a.ot[0].gt=c.gt,a.ot[0].ut=r.Ft().Nt(c.gt,l.Wt),a.dt=c.Ht??this.O.Ut(a.ot[0].ut/r.Ft().$t()),a.ot[0].wt=i,a.ot[0]._t=s.qt(i),a.lt=eYe):a.lt=null}))}}class nYe extends Yp{constructor(e){super(),this.Yt=e}et({context:e,bitmapSize:n,horizontalPixelRatio:i,verticalPixelRatio:s}){if(this.Yt===null)return;const r=this.Yt.jt.Vt,o=this.Yt.Kt.Vt;if(!r&&!o)return;const a=Math.round(this.Yt._t*i),c=Math.round(this.Yt.ut*s);e.lineCap="butt",r&&a>=0&&(e.lineWidth=Math.floor(this.Yt.jt.ct*i),e.strokeStyle=this.Yt.jt.R,e.fillStyle=this.Yt.jt.R,Up(e,this.Yt.jt.Xt),(function(l,d,h,p){l.beginPath();const g=l.lineWidth%2?.5:0;l.moveTo(d+g,h),l.lineTo(d+g,p),l.stroke()})(e,a,0,n.height)),o&&c>=0&&(e.lineWidth=Math.floor(this.Yt.Kt.ct*s),e.strokeStyle=this.Yt.Kt.R,e.fillStyle=this.Yt.Kt.R,Up(e,this.Yt.Kt.Xt),goe(e,c,0,n.width))}}class iYe{constructor(e,n){this.xt=!0,this.Zt={jt:{ct:1,Xt:0,R:"",Vt:!1},Kt:{ct:1,Xt:0,R:"",Vt:!1},_t:0,ut:0},this.Gt=new nYe(this.Zt),this.Jt=e,this.Pt=n}yt(){this.xt=!0}Tt(e){return this.xt&&(this.Rt(),this.xt=!1),this.Gt}Rt(){const e=this.Jt.Vt(),n=this.Pt.Qt().N().crosshair,i=this.Zt;if(n.mode===2)return i.Kt.Vt=!1,void(i.jt.Vt=!1);i.Kt.Vt=e&&this.Jt.ti(this.Pt),i.jt.Vt=e&&this.Jt.ii(),i.Kt.ct=n.horzLine.width,i.Kt.Xt=n.horzLine.style,i.Kt.R=n.horzLine.color,i.jt.ct=n.vertLine.width,i.jt.Xt=n.vertLine.style,i.jt.R=n.vertLine.color,i._t=this.Jt.si(),i.ut=this.Jt.ni()}}function sYe(t,e,n,i,s,r){t.fillRect(e+r,n,i-2*r,r),t.fillRect(e+r,n+s-r,i-2*r,r),t.fillRect(e,n,r,s),t.fillRect(e+i-r,n,r,s)}function BS(t,e,n,i,s,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(e,n,i,s),t.restore()}function wK(t,e,n,i,s,r){t.beginPath(),t.roundRect?t.roundRect(e,n,i,s,r):(t.lineTo(e+i-r[1],n),r[1]!==0&&t.arcTo(e+i,n,e+i,n+r[1],r[1]),t.lineTo(e+i,n+s-r[2]),r[2]!==0&&t.arcTo(e+i,n+s,e+i-r[2],n+s,r[2]),t.lineTo(e+r[3],n+s),r[3]!==0&&t.arcTo(e,n+s,e,n+s-r[3],r[3]),t.lineTo(e,n+r[0]),r[0]!==0&&t.arcTo(e,n,e+r[0],n,r[0]))}function vK(t,e,n,i,s,r,o=0,a=[0,0,0,0],c=""){if(t.save(),!o||!c||c===r)return wK(t,e,n,i,s,a),t.fillStyle=r,t.fill(),void t.restore();const l=o/2;var d;wK(t,e+l,n+l,i-o,s-o,(d=-l,a.map((h=>h===0?h:h+d)))),r!=="transparent"&&(t.fillStyle=r,t.fill()),c!=="transparent"&&(t.lineWidth=o,t.strokeStyle=c,t.closePath(),t.stroke()),t.restore()}function boe(t,e,n,i,s,r,o){t.save(),t.globalCompositeOperation="copy";const a=t.createLinearGradient(0,0,0,s);a.addColorStop(0,r),a.addColorStop(1,o),t.fillStyle=a,t.fillRect(e,n,i,s),t.restore()}class CK{constructor(e,n){this.ht(e,n)}ht(e,n){this.Yt=e,this.ei=n}$t(e,n){return this.Yt.Vt?e.P+e.A+e.V:0}nt(e,n,i,s){if(!this.Yt.Vt||this.Yt.ri.length===0)return;const r=this.Yt.R,o=this.ei.Z,a=e.useBitmapCoordinateSpace((c=>{const l=c.context;l.font=n.k;const d=this.hi(c,n,i,s),h=d.ai;return d.li?vK(l,h.oi,h._i,h.ui,h.ci,o,h.di,[h.ft,0,0,h.ft],o):vK(l,h.fi,h._i,h.ui,h.ci,o,h.di,[0,h.ft,h.ft,0],o),this.Yt.pi&&(l.fillStyle=r,l.fillRect(h.fi,h.mi,h.wi-h.fi,h.gi)),this.Yt.Mi&&(l.fillStyle=n.D,l.fillRect(d.li?h.bi-h.di:0,h._i,h.di,h.Si-h._i)),d}));e.useMediaCoordinateSpace((({context:c})=>{const l=a.xi;c.font=n.k,c.textAlign=a.li?"right":"left",c.textBaseline="middle",c.fillStyle=r,c.fillText(this.Yt.ri,l.Ci,(l._i+l.Si)/2+l.Pi)}))}hi(e,n,i,s){const{context:r,bitmapSize:o,mediaSize:a,horizontalPixelRatio:c,verticalPixelRatio:l}=e,d=this.Yt.pi||!this.Yt.yi?n.C:0,h=this.Yt.ki?n.S:0,p=n.A+this.ei.Ti,g=n.V+this.ei.Ri,b=n.B,w=n.I,C=this.Yt.ri,E=n.P,T=i.Di(r,C),A=Math.ceil(i.Vi(r,C)),k=E+p+g,R=n.S+b+w+A+d,P=Math.max(1,Math.floor(l));let B=Math.round(k*l);B%2!=P%2&&(B+=1);const F=h>0?Math.max(1,Math.floor(h*c)):0,z=Math.round(R*c),K=Math.round(d*c),q=this.ei.Bi??this.ei.Ii,G=Math.round(q*l)-Math.floor(.5*l),I=Math.floor(G+P/2-B/2),S=I+B,v=s==="right",_=v?a.width-h:h,N=v?o.width-F:F;let $,U,j;return v?($=N-z,U=N-K,j=_-d-b-h):($=N+z,U=N+K,j=_+d+b),{li:v,ai:{_i:I,mi:G,Si:S,ui:z,ci:B,ft:2*c,di:F,oi:$,fi:N,wi:U,gi:P,bi:o.width},xi:{_i:I/l,Si:S/l,Ci:j,Pi:T}}}}class FS{constructor(e){this.Ei={Ii:0,Z:"#000",Ri:0,Ti:0},this.Ai={ri:"",Vt:!1,pi:!0,yi:!1,Ht:"",R:"#FFF",Mi:!1,ki:!1},this.zi={ri:"",Vt:!1,pi:!1,yi:!0,Ht:"",R:"#FFF",Mi:!0,ki:!0},this.xt=!0,this.Li=new(e||CK)(this.Ai,this.Ei),this.Oi=new(e||CK)(this.zi,this.Ei)}ri(){return this.Ni(),this.Ai.ri}Ii(){return this.Ni(),this.Ei.Ii}yt(){this.xt=!0}$t(e,n=!1){return Math.max(this.Li.$t(e,n),this.Oi.$t(e,n))}Fi(){return this.Ei.Bi||0}Wi(e){this.Ei.Bi=e}Hi(){return this.Ni(),this.Ai.Vt||this.zi.Vt}Ui(){return this.Ni(),this.Ai.Vt}Tt(e){return this.Ni(),this.Ai.pi=this.Ai.pi&&e.N().ticksVisible,this.zi.pi=this.zi.pi&&e.N().ticksVisible,this.Li.ht(this.Ai,this.Ei),this.Oi.ht(this.zi,this.Ei),this.Li}$i(){return this.Ni(),this.Li.ht(this.Ai,this.Ei),this.Oi.ht(this.zi,this.Ei),this.Oi}Ni(){this.xt&&(this.Ai.pi=!0,this.zi.pi=!1,this.qi(this.Ai,this.zi,this.Ei))}}class rYe extends FS{constructor(e,n,i){super(),this.Jt=e,this.Yi=n,this.ji=i}qi(e,n,i){if(e.Vt=!1,this.Jt.N().mode===2)return;const s=this.Jt.N().horzLine;if(!s.labelVisible)return;const r=this.Yi.zt();if(!this.Jt.Vt()||this.Yi.Ki()||r===null)return;const o=this.Yi.Xi().X(s.labelBackgroundColor);i.Z=o.Z,e.R=o.G;const a=2/12*this.Yi.P();i.Ti=a,i.Ri=a;const c=this.ji(this.Yi);i.Ii=c.Ii,e.ri=this.Yi.Zi(c.gt,r),e.Vt=!0}}const oYe=/[1-9]/g;class woe{constructor(){this.Yt=null}ht(e){this.Yt=e}nt(e,n){if(this.Yt===null||this.Yt.Vt===!1||this.Yt.ri.length===0)return;const i=e.useMediaCoordinateSpace((({context:p})=>(p.font=n.k,Math.round(n.Gi.Vi(p,gt(this.Yt).ri,oYe)))));if(i<=0)return;const s=n.Ji,r=i+2*s,o=r/2,a=this.Yt.Qi;let c=this.Yt.Ii,l=Math.floor(c-o)+.5;l<0?(c+=Math.abs(0-l),l=Math.floor(c-o)+.5):l+r>a&&(c-=Math.abs(a-(l+r)),l=Math.floor(c-o)+.5);const d=l+r,h=Math.ceil(0+n.S+n.C+n.A+n.P+n.V);e.useBitmapCoordinateSpace((({context:p,horizontalPixelRatio:g,verticalPixelRatio:b})=>{const w=gt(this.Yt);p.fillStyle=w.Z;const C=Math.round(l*g),E=Math.round(0*b),T=Math.round(d*g),A=Math.round(h*b),k=Math.round(2*g);if(p.beginPath(),p.moveTo(C,E),p.lineTo(C,A-k),p.arcTo(C,A,C+k,A,k),p.lineTo(T-k,A),p.arcTo(T,A,T,A-k,k),p.lineTo(T,E),p.fill(),w.pi){const R=Math.round(w.Ii*g),P=E,B=Math.round((P+n.C)*b);p.fillStyle=w.R;const F=Math.max(1,Math.floor(g)),z=Math.floor(.5*g);p.fillRect(R-z,P,F,B-P)}})),e.useMediaCoordinateSpace((({context:p})=>{const g=gt(this.Yt),b=0+n.S+n.C+n.A+n.P/2;p.font=n.k,p.textAlign="left",p.textBaseline="middle",p.fillStyle=g.R;const w=n.Gi.Di(p,"Apr0");p.translate(l+s,b+w),p.fillText(g.ri,0,0)}))}}class aYe{constructor(e,n,i){this.xt=!0,this.Gt=new woe,this.Zt={Vt:!1,Z:"#4c525e",R:"white",ri:"",Qi:0,Ii:NaN,pi:!0},this.Ct=e,this.ts=n,this.ji=i}yt(){this.xt=!0}Tt(){return this.xt&&(this.Rt(),this.xt=!1),this.Gt.ht(this.Zt),this.Gt}Rt(){const e=this.Zt;if(e.Vt=!1,this.Ct.N().mode===2)return;const n=this.Ct.N().vertLine;if(!n.labelVisible)return;const i=this.ts.Et();if(i.Ki())return;e.Qi=i.Qi();const s=this.ji();if(s===null)return;e.Ii=s.Ii;const r=i.ss(this.Ct.It());e.ri=i.ns(gt(r)),e.Vt=!0;const o=this.ts.Xi().X(n.labelBackgroundColor);e.Z=o.Z,e.R=o.G,e.pi=i.N().ticksVisible}}class voe{constructor(){this.es=null,this.rs=0}hs(){return this.rs}ls(e){this.rs=e}Ft(){return this.es}_s(e){this.es=e}us(e){return[]}cs(){return[]}Vt(){return!0}}var xK;(function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet",t[t.Hidden=2]="Hidden",t[t.MagnetOHLC=3]="MagnetOHLC"})(xK||(xK={}));class cYe extends voe{constructor(e,n){super(),this.Pt=null,this.ds=NaN,this.fs=0,this.ps=!1,this.vs=new Map,this.ws=!1,this.gs=new WeakMap,this.Ms=new WeakMap,this.bs=NaN,this.Ss=NaN,this.xs=NaN,this.Cs=NaN,this.ts=e,this.Ps=n,this.ys=((s,r)=>o=>{const a=r(),c=s();if(o===gt(this.Pt).ks())return{gt:c,Ii:a};{const l=gt(o.zt());return{gt:o.Ts(a,l),Ii:a}}})((()=>this.ds),(()=>this.Ss));const i=((s,r)=>()=>{const o=this.ts.Et().Rs(s()),a=r();return o&&Number.isFinite(a)?{wt:o,Ii:a}:null})((()=>this.fs),(()=>this.si()));this.Ds=new aYe(this,e,i)}N(){return this.Ps}Vs(e,n){this.xs=e,this.Cs=n}Bs(){this.xs=NaN,this.Cs=NaN}Is(){return this.xs}Es(){return this.Cs}As(e,n,i){this.ws||(this.ws=!0),this.ps=!0,this.zs(e,n,i)}It(){return this.fs}si(){return this.bs}ni(){return this.Ss}Vt(){return this.ps}Ls(){this.ps=!1,this.Os(),this.ds=NaN,this.bs=NaN,this.Ss=NaN,this.Pt=null,this.Bs(),this.Ns()}Fs(e){let n=this.gs.get(e);n||(n=new iYe(this,e),this.gs.set(e,n));let i=this.Ms.get(e);return i||(i=new tYe(this.ts,this,e),this.Ms.set(e,i)),[n,i]}ti(e){return e===this.Pt&&this.Ps.horzLine.visible}ii(){return this.Ps.vertLine.visible}Ws(e,n){this.ps&&this.Pt===e||this.vs.clear();const i=[];return this.Pt===e&&i.push(this.Hs(this.vs,n,this.ys)),i}cs(){return this.ps?[this.Ds]:[]}Us(){return this.Pt}Ns(){this.ts.$s().forEach((e=>{var n,i;(n=this.gs.get(e))==null||n.yt(),(i=this.Ms.get(e))==null||i.yt()})),this.vs.forEach((e=>e.yt())),this.Ds.yt()}qs(e){return e&&!e.ks().Ki()?e.ks():null}zs(e,n,i){this.Ys(e,n,i)&&this.Ns()}Ys(e,n,i){const s=this.bs,r=this.Ss,o=this.ds,a=this.fs,c=this.Pt,l=this.qs(i);this.fs=e,this.bs=isNaN(e)?NaN:this.ts.Et().qt(e),this.Pt=i;const d=l!==null?l.zt():null;return l!==null&&d!==null?(this.ds=n,this.Ss=l.Nt(n,d)):(this.ds=NaN,this.Ss=NaN),s!==this.bs||r!==this.Ss||a!==this.fs||o!==this.ds||c!==this.Pt}Os(){const e=this.ts.js().map((i=>i.Xs().Ks())).filter(YKe),n=e.length===0?null:Math.max(...e);this.fs=n!==null?n:NaN}Hs(e,n,i){let s=e.get(n);return s===void 0&&(s=new rYe(this,n,i),e.set(n,s)),s}}function jS(t){return t==="left"||t==="right"}class yo{constructor(e){this.Zs=new Map,this.Gs=[],this.Js=e}Qs(e,n){const i=(function(s,r){return s===void 0?r:{tn:Math.max(s.tn,r.tn),sn:s.sn||r.sn}})(this.Zs.get(e),n);this.Zs.set(e,i)}nn(){return this.Js}en(e){const n=this.Zs.get(e);return n===void 0?{tn:this.Js}:{tn:Math.max(this.Js,n.tn),sn:n.sn}}rn(){this.hn(),this.Gs=[{an:0}]}ln(e){this.hn(),this.Gs=[{an:1,Wt:e}]}_n(e){this.un(),this.Gs.push({an:5,Wt:e})}hn(){this.un(),this.Gs.push({an:6})}cn(){this.hn(),this.Gs=[{an:4}]}dn(e){this.hn(),this.Gs.push({an:2,Wt:e})}fn(e){this.hn(),this.Gs.push({an:3,Wt:e})}pn(){return this.Gs}vn(e){for(const n of e.Gs)this.mn(n);this.Js=Math.max(this.Js,e.Js),e.Zs.forEach(((n,i)=>{this.Qs(i,n)}))}static wn(){return new yo(2)}static gn(){return new yo(3)}mn(e){switch(e.an){case 0:this.rn();break;case 1:this.ln(e.Wt);break;case 2:this.dn(e.Wt);break;case 3:this.fn(e.Wt);break;case 4:this.cn();break;case 5:this._n(e.Wt);break;case 6:this.un()}}un(){const e=this.Gs.findIndex((n=>n.an===5));e!==-1&&this.Gs.splice(e,1)}}class Coe{formatTickmarks(e){return e.map((n=>this.format(n)))}}const EK=".";function Xh(t,e){if(!Cb(t))return"n/a";if(!Q5(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?t.toString():("0000000000000000"+t.toString()).slice(-e)}class VS extends Coe{constructor(e,n){if(super(),n||(n=1),Cb(e)&&Q5(e)||(e=100),e<0)throw new TypeError("invalid base");this.Yi=e,this.Mn=n,this.bn()}format(e){const n=e<0?"â":"";return e=Math.abs(e),n+this.Sn(e)}bn(){if(this.xn=0,this.Yi>0&&this.Mn>0){let e=this.Yi;for(;e>1;)e/=10,this.xn++}}Sn(e){const n=this.Yi/this.Mn;let i=Math.floor(e),s="";const r=this.xn!==void 0?this.xn:NaN;if(n>1){let o=+(Math.round(e*n)-i*n).toFixed(this.xn);o>=n&&(o-=n,i+=1),s=EK+Xh(+o.toFixed(this.xn)*this.Mn,r)}else i=Math.round(i*n)/n,r>0&&(s=EK+Xh(0,r));return i.toFixed(0)+s}}class xoe extends VS{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class lYe extends Coe{constructor(e){super(),this.Cn=e}format(e){let n="";return e<0&&(n="-",e=-e),e<995?n+this.Pn(e):e<999995?n+this.Pn(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),n+this.Pn(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),n+this.Pn(e/1e9)+"B")}Pn(e){let n;const i=Math.pow(10,this.Cn);return n=(e=Math.round(e*i)/i)>=1e-15&&e<1?e.toFixed(this.Cn).replace(/\.?0+$/,""):String(e),n.replace(/(\.[1-9]*)0+$/,((s,r)=>r))}}const uYe=/[2-9]/g;class f8{constructor(e=50){this.yn=0,this.kn=1,this.Tn=1,this.Rn={},this.Dn=new Map,this.Vn=e}Bn(){this.yn=0,this.Dn.clear(),this.kn=1,this.Tn=1,this.Rn={}}Vi(e,n,i){return this.In(e,n,i).width}Di(e,n,i){const s=this.In(e,n,i);return((s.actualBoundingBoxAscent||0)-(s.actualBoundingBoxDescent||0))/2}In(e,n,i){const s=i||uYe,r=String(n).replace(s,"0");if(this.Dn.has(r))return ic(this.Dn.get(r)).En;if(this.yn===this.Vn){const a=this.Rn[this.Tn];delete this.Rn[this.Tn],this.Dn.delete(a),this.Tn++,this.yn--}e.save(),e.textBaseline="middle";const o=e.measureText(r);
7472return e.restore(),o.width===0&&n.length||(this.Dn.set(r,{En:o,An:this.kn}),this.Rn[this.kn]=r,this.yn++,this.kn++),o}}class dYe{constructor(e){this.zn=null,this.M=null,this.Ln="right",this.On=e}Nn(e,n,i){this.zn=e,this.M=n,this.Ln=i}nt(e){this.M!==null&&this.zn!==null&&this.zn.nt(e,this.M,this.On,this.Ln)}}class Eoe{constructor(e,n,i){this.Fn=e,this.On=new f8(50),this.Wn=n,this.O=i,this.F=-1,this.Gt=new dYe(this.On)}Tt(){const e=this.O.Hn(this.Wn);if(e===null)return null;const n=e.Un(this.Wn)?e.$n():this.Wn.Ft();if(n===null)return null;const i=e.qn(n);if(i==="overlay")return null;const s=this.O.Yn();return s.P!==this.F&&(this.F=s.P,this.On.Bn()),this.Gt.Nn(this.Fn.$i(),s,i),this.Gt}}class hYe extends Yp{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}jn(e,n){var o;if(!((o=this.Yt)!=null&&o.Vt))return null;const{ut:i,ct:s,Kn:r}=this.Yt;return n>=i-s-7&&n<=i+s+7?{Xn:this.Yt,Kn:r}:null}et({context:e,bitmapSize:n,horizontalPixelRatio:i,verticalPixelRatio:s}){if(this.Yt===null||this.Yt.Vt===!1)return;const r=Math.round(this.Yt.ut*s);r<0||r>n.height||(e.lineCap="butt",e.strokeStyle=this.Yt.R,e.lineWidth=Math.floor(this.Yt.ct*i),Up(e,this.Yt.Xt),goe(e,r,0,n.width))}}class mL{constructor(e){this.Zn={ut:0,R:"rgba(0, 0, 0, 0)",ct:1,Xt:0,Vt:!1},this.Gn=new hYe,this.xt=!0,this.Jn=e,this.Qn=e.Qt(),this.Gn.ht(this.Zn)}yt(){this.xt=!0}Tt(){return this.Jn.Vt()?(this.xt&&(this.te(),this.xt=!1),this.Gn):null}}class fYe extends mL{constructor(e){super(e)}te(){this.Zn.Vt=!1;const e=this.Jn.Ft(),n=e.ie().ie;if(n!==2&&n!==3)return;const i=this.Jn.N();if(!i.baseLineVisible||!this.Jn.Vt())return;const s=this.Jn.zt();s!==null&&(this.Zn.Vt=!0,this.Zn.ut=e.Nt(s.Wt,s.Wt),this.Zn.R=i.baseLineColor,this.Zn.ct=i.baseLineWidth,this.Zn.Xt=i.baseLineStyle)}}class pYe extends Yp{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}se(){return this.Yt}et({context:e,horizontalPixelRatio:n,verticalPixelRatio:i}){const s=this.Yt;if(s===null)return;const r=Math.max(1,Math.floor(n)),o=r%2/2,a=Math.round(s.ne.x*n)+o,c=s.ne.y*i;e.fillStyle=s.ee,e.beginPath();const l=Math.max(2,1.5*s.re)*n;e.arc(a,c,l,0,2*Math.PI,!1),e.fill(),e.fillStyle=s.he,e.beginPath(),e.arc(a,c,s.ft*n,0,2*Math.PI,!1),e.fill(),e.lineWidth=r,e.strokeStyle=s.ae,e.beginPath(),e.arc(a,c,s.ft*n+r/2,0,2*Math.PI,!1),e.stroke()}}const mYe=[{le:0,oe:.25,_e:4,ue:10,ce:.25,de:0,fe:.4,pe:.8},{le:.25,oe:.525,_e:10,ue:14,ce:0,de:0,fe:.8,pe:0},{le:.525,oe:1,_e:14,ue:14,ce:0,de:0,fe:0,pe:0}];class gYe{constructor(e){this.Gt=new pYe,this.xt=!0,this.ve=!0,this.me=performance.now(),this.we=this.me-1,this.ge=e}Me(){this.we=this.me-1,this.yt()}be(){if(this.yt(),this.ge.N().lastPriceAnimation===2){const e=performance.now(),n=this.we-e;if(n>0)return void(n<650&&(this.we+=2600));this.me=e,this.we=e+2600}}yt(){this.xt=!0}Se(){this.ve=!0}Vt(){return this.ge.N().lastPriceAnimation!==0}xe(){switch(this.ge.N().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.we}}Tt(){return this.xt?(this.Rt(),this.xt=!1,this.ve=!1):this.ve&&(this.Ce(),this.ve=!1),this.Gt}Rt(){this.Gt.ht(null);const e=this.ge.Qt().Et(),n=e.Pe(),i=this.ge.zt();if(n===null||i===null)return;const s=this.ge.ye(!0);if(s.ke||!n.Te(s.Re))return;const r={x:e.qt(s.Re),y:this.ge.Ft().Nt(s.gt,i.Wt)},o=s.R,a=this.ge.N().lineWidth,c=this.De(this.Ve(),o);this.Gt.ht({ee:o,re:a,he:c.he,ae:c.ae,ft:c.ft,ne:r})}Ce(){const e=this.Gt.se();if(e!==null){const n=this.De(this.Ve(),e.ee);e.he=n.he,e.ae=n.ae,e.ft=n.ft}}Ve(){return this.xe()?performance.now()-this.me:2599}Be(e,n,i,s){const r=i+(s-i)*n;return this.ge.Qt().Xi().j(e,r)}De(e,n){const i=e%2600/2600;let s;for(const l of mYe)if(i>=l.le&&i<=l.oe){s=l;break}vo(s!==void 0,"Last price animation internal logic error");const r=(i-s.le)/(s.oe-s.le);return{he:this.Be(n,r,s.ce,s.de),ae:this.Be(n,r,s.fe,s.pe),ft:(o=r,a=s._e,c=s.ue,a+(c-a)*o)};var o,a,c}}class yYe extends mL{constructor(e){super(e)}te(){const e=this.Zn;e.Vt=!1;const n=this.Jn.N();if(!n.priceLineVisible||!this.Jn.Vt())return;const i=this.Jn.ye(n.priceLineSource===0);i.ke||(e.Vt=!0,e.ut=i.Ii,e.R=this.Jn.Ie(i.R),e.ct=n.priceLineWidth,e.Xt=n.priceLineStyle)}
7472}class bYe extends FS{constructor(e){super(),this.Jt=e}qi(e,n,i){e.Vt=!1,n.Vt=!1;const s=this.Jt;if(!s.Vt())return;const r=s.N(),o=r.lastValueVisible,a=s.Ee()!=="",c=r.seriesLastValueMode===0,l=s.ye(!1);if(l.ke)return;o&&(e.ri=this.Ae(l,o,c),e.Vt=e.ri.length!==0),(a||c)&&(n.ri=this.ze(l,o,a,c),n.Vt=n.ri.length>0);const d=s.Ie(l.R),h=this.Jt.Qt().Xi().X(d);i.Z=h.Z,i.Ii=l.Ii,n.Ht=s.Qt().Ut(l.Ii/s.Ft().$t()),e.Ht=d,e.R=h.G,n.R=h.G}ze(e,n,i,s){let r="";const o=this.Jt.Ee();return i&&o.length!==0&&(r+=`${o} `),n&&s&&(r+=this.Jt.Ft().Le()?e.Oe:e.Ne),r.trim()}Ae(e,n,i){return n?i?this.Jt.Ft().Le()?e.Ne:e.Oe:e.ri:""}}function _K(t,e,n,i){const s=Number.isFinite(e),r=Number.isFinite(n);return s&&r?t(e,n):s||r?s?e:n:i}class fa{constructor(e,n){this.Fe=e,this.We=n}He(e){return e!==null&&this.Fe===e.Fe&&this.We===e.We}Ue(){return new fa(this.Fe,this.We)}$e(){return this.Fe}qe(){return this.We}Ye(){return this.We-this.Fe}Ki(){return this.We===this.Fe||Number.isNaN(this.We)||Number.isNaN(this.Fe)}vn(e){return e===null?this:new fa(_K(Math.min,this.$e(),e.$e(),-1/0),_K(Math.max,this.qe(),e.qe(),1/0))}je(e){if(!Cb(e)||this.We-this.Fe===0)return;const n=.5*(this.We+this.Fe);let i=this.We-n,s=this.Fe-n;i*=e,s*=e,this.We=n+i,this.Fe=n+s}Ke(e){Cb(e)&&(this.We+=e,this.Fe+=e)}Xe(){return{minValue:this.Fe,maxValue:this.We}}static Ze(e){return e===null?null:new fa(e.minValue,e.maxValue)}}class p8{constructor(e,n){this.Ge=e,this.Je=n||null}Qe(){return this.Ge}tr(){return this.Je}Xe(){return{priceRange:this.Ge===null?null:this.Ge.Xe(),margins:this.Je||void 0}}static Ze(e){return e===null?null:new p8(fa.Ze(e.priceRange),e.margins)}}class wYe extends mL{constructor(e,n){super(e),this.ir=n}te(){const e=this.Zn;e.Vt=!1;const n=this.ir.N();if(!this.Jn.Vt()||!n.lineVisible)return;const i=this.ir.sr();i!==null&&(e.Vt=!0,e.ut=i,e.R=n.color,e.ct=n.lineWidth,e.Xt=n.lineStyle,e.Kn=this.ir.N().id)}}class vYe extends FS{constructor(e,n){super(),this.ge=e,this.ir=n}qi(e,n,i){e.Vt=!1,n.Vt=!1;const s=this.ir.N(),r=s.axisLabelVisible,o=s.title!=="",a=this.ge;if(!r||!a.Vt())return;const c=this.ir.sr();if(c===null)return;o&&(n.ri=s.title,n.Vt=!0),n.Ht=a.Qt().Ut(c/a.Ft().$t()),e.ri=this.nr(s.price),e.Vt=!0;const l=this.ge.Qt().Xi().X(s.axisLabelColor||s.color);i.Z=l.Z;const d=s.axisLabelTextColor||l.G;e.R=d,n.R=d,i.Ii=c}nr(e){const n=this.ge.zt();return n===null?"":this.ge.Ft().Zi(e,n.Wt)}}class CYe{constructor(e,n){this.ge=e,this.Ps=n,this.er=new wYe(e,this),this.Fn=new vYe(e,this),this.rr=new Eoe(this.Fn,e,e.Qt())}hr(e){jc(this.Ps,e),this.yt(),this.ge.Qt().ar()}N(){return this.Ps}lr(){return this.er}_r(){return this.rr}ur(){return this.Fn}yt(){this.er.yt(),this.Fn.yt()}sr(){const e=this.ge,n=e.Ft();if(e.Qt().Et().Ki()||n.Ki())return null;const i=e.zt();return i===null?null:n.Nt(this.Ps.price,i.Wt)}}class xYe extends voe{constructor(e){super(),this.ts=e}Qt(){return this.ts}}const EYe={Bar:(t,e,n,i)=>{const s=e.upColor,r=e.downColor,o=gt(t(n,i)),a=ap(o.Wt[0])<=ap(o.Wt[3]);return{cr:o.R??(a?s:r)}},Candlestick:(t,e,n,i)=>{const s=e.upColor,r=e.downColor,o=e.borderUpColor,a=e.borderDownColor,c=e.wickUpColor,l=e.wickDownColor,d=gt(t(n,i)),h=ap(d.Wt[0])<=ap(d.Wt[3]);return{cr:d.R??(h?s:r),dr:d.Ht??(h?o:a),pr:d.vr??(h?c:l)}},Custom:(t,e,n,i)=>({cr:gt(t(n,i)).R??e.color}),Area:(t,e,n,i)=>{const s=gt(t(n,i));return{cr:s.vt??e.lineColor,vt:s.vt??e.lineColor,mr:s.mr??e.topColor,wr:s.wr??e.bottomColor}},Baseline:(t,e,n,i)=>{const s=gt(t(n,i));return{cr:s.Wt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,gr:s.gr??e.topLineColor,Mr:s.Mr??e.bottomLineColor,br:s.br??e.topFillColor1,Sr:s.Sr??e.topFillColor2,Cr:s.Cr??e.bottomFillColor1,Pr:s.Pr??e.bottomFillColor2}},Line:(t,e,n,i)=>{const s=gt(t(n,i));return{cr:s.R??e.color,vt:s.R??e.color}},Histogram:(t,e,n,i)=>({cr:gt(t(n,i)).R??e.color})};class _Ye{constructor(e){this.yr=(n,i)=>i!==void 0?i.Wt:this.ge.Xs().kr(n),this.ge=e,this.Tr=EYe[e.Rr()]}Dr(e,n){return this.Tr(this.yr,this.ge.N(),e,n)}}function _oe(t,e,n,i,s=0,r=e.length){let o=r-s;for(;0<o;){const a=o>>1,c=s+a;i(e[c],n)===t?(s=c+1,o-=a+1):o=a}return s}const xb=_oe.bind(null,!0),Soe=_oe.bind(null,!1);var SK;(function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.None=0]="None",t[t.NearestRight=1]="NearestRight"})(SK||(SK={}));const I0=30;class SYe{constructor(){this.Vr=[],this.Br=new Map,this.Ir=new Map,this.Er=[]}Ar(){return this.zr()>0?this.Vr[this.Vr.length-1]:null}Lr(){return this.zr()>0?this.Or(0):null}Ks(){return this.zr()>0?this.Or(this.Vr.length-1):null}zr(){return this.Vr.length}Ki(){return this.zr()===0}Te(e){return this.Nr(e,0)!==null}kr(e){return this.Fr(e)}Fr(e,n=0){const i=this.Nr(e,n);return i===null?null:{...this.Wr(i),Re:this.Or(i)}}Hr(){return this.Vr}Ur(e,n,i){if(this.Ki())return null;let s=null;for(const r of i)s=$x(s,this.$r(e,n,r));return s}ht(e){this.Ir.clear(),this.Br.clear(),this.Vr=e,this.Er=e.map((n=>n.Re))}qr(){return this.Er}Or(e){return this.Vr[e].Re}Wr(e){return this.Vr[e]}Nr(e,n){const i=this.Yr(e);if(i===null&&n!==0)switch(n){case-1:return this.jr(e);case 1:return this.Kr(e);default:throw new TypeError("Unknown search mode")}return i}jr(e){let n=this.Xr(e);return n>0&&(n-=1),n!==this.Vr.length&&this.Or(n)<e?n:null}Kr(e){const n=this.Zr(e);return n!==this.Vr.length&&e<this.Or(n)?n:null}Yr(e){const n=this.Xr(e);return n===this.Vr.length||e<this.Vr[n].Re?null:n}Xr(e){return xb(this.Vr,e,((n,i)=>n.Re<i))}Zr(e){return Soe(this.Vr,e,((n,i)=>n.Re>i))}Gr(e,n,i){let s=null;for(let r=e;r<n;r++){const o=this.Vr[r].Wt[i];Number.isNaN(o)||(s===null?s={Jr:o,Qr:o}:(o<s.Jr&&(s.Jr=o),o>s.Qr&&(s.Qr=o)))}return s}$r(e,n,i){if(this.Ki())return null;let s=null;const r=gt(this.Lr()),o=gt(this.Ks()),a=Math.max(e,r),c=Math.min(n,o),l=Math.ceil(a/I0)*I0,d=Math.max(l,Math.floor(c/I0)*I0);{const p=this.Xr(a),g=this.Zr(Math.min(c,l,n));s=$x(s,this.Gr(p,g,i))}let h=this.Br.get(i);h===void 0&&(h=new Map,this.Br.set(i,h));for(let p=Math.max(l+1,a);p<d;p+=I0){const g=Math.floor(p/I0);let b=h.get(g);if(b===void 0){const w=this.Xr(g*I0),C=this.Zr((g+1)*I0-1);b=this.Gr(w,C,i),h.set(g,b)}s=$x(s,b)}{const p=this.Xr(d),g=this.Zr(c);s=$x(s,this.Gr(p,g,i))}return s}}function $x(t,e){return t===null?e:e===null?t:{Jr:Math.min(t.Jr,e.Jr),Qr:Math.max(t.Qr,e.Qr)}}const m8={setLineStyle:Up};class AYe{constructor(e){this.th=e}nt(e,n,i){this.th.draw(e,m8)}ih(e,n,i){var s,r;
7472(r=(s=this.th).drawBackground)==null||r.call(s,e,m8)}}class TYe{constructor(e){this.Dn=null,this.sh=e}Tt(){var i;const e=this.sh.renderer();if(e===null)return null;if(((i=this.Dn)==null?void 0:i.nh)===e)return this.Dn.eh;const n=new AYe(e);return this.Dn={nh:e,eh:n},n}rh(){var e,n;return((n=(e=this.sh).zOrder)==null?void 0:n.call(e))??"normal"}}class Aoe{constructor(e){this.hh=null,this.ah=e}oh(){return this.ah}Ns(){var e,n;(n=(e=this.ah).updateAllViews)==null||n.call(e)}Fs(){var i,s,r;const e=((s=(i=this.ah).paneViews)==null?void 0:s.call(i))??[];if(((r=this.hh)==null?void 0:r.nh)===e)return this.hh.eh;const n=e.map((o=>new TYe(o)));return this.hh={nh:e,eh:n},n}jn(e,n){var i,s;return((s=(i=this.ah).hitTest)==null?void 0:s.call(i,e,n))??null}}let kYe=class extends Aoe{us(){return[]}};class NYe{constructor(e){this.th=e}nt(e,n,i){this.th.draw(e,m8)}ih(e,n,i){var s,r;(r=(s=this.th).drawBackground)==null||r.call(s,e,m8)}}class AK{constructor(e){this.Dn=null,this.sh=e}Tt(){var i;const e=this.sh.renderer();if(e===null)return null;if(((i=this.Dn)==null?void 0:i.nh)===e)return this.Dn.eh;const n=new NYe(e);return this.Dn={nh:e,eh:n},n}rh(){var e,n;return((n=(e=this.sh).zOrder)==null?void 0:n.call(e))??"normal"}}function Toe(t){var e,n,i;return{ri:t.text(),Ii:t.coordinate(),Bi:(e=t.fixedCoordinate)==null?void 0:e.call(t),R:t.textColor(),Z:t.backColor(),Vt:((n=t.visible)==null?void 0:n.call(t))??!0,pi:((i=t.tickVisible)==null?void 0:i.call(t))??!0}}class RYe{constructor(e,n){this.Gt=new woe,this._h=e,this.uh=n}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...Toe(this._h)}),this.Gt}}class PYe extends FS{constructor(e,n){super(),this._h=e,this.Yi=n}qi(e,n,i){const s=Toe(this._h);i.Z=s.Z,e.R=s.R;const r=2/12*this.Yi.P();i.Ti=r,i.Ri=r,i.Ii=s.Ii,i.Bi=s.Bi,e.ri=s.ri,e.Vt=s.Vt,e.pi=s.pi}}class IYe extends Aoe{constructor(e,n){super(e),this.dh=null,this.fh=null,this.ph=null,this.mh=null,this.ge=n}cs(){var s,r,o;const e=((r=(s=this.ah).timeAxisViews)==null?void 0:r.call(s))??[];if(((o=this.dh)==null?void 0:o.nh)===e)return this.dh.eh;const n=this.ge.Qt().Et(),i=e.map((a=>new RYe(a,n)));return this.dh={nh:e,eh:i},i}Ws(){var s,r,o;const e=((r=(s=this.ah).priceAxisViews)==null?void 0:r.call(s))??[];if(((o=this.fh)==null?void 0:o.nh)===e)return this.fh.eh;const n=this.ge.Ft(),i=e.map((a=>new PYe(a,n)));return this.fh={nh:e,eh:i},i}wh(){var i,s,r;const e=((s=(i=this.ah).priceAxisPaneViews)==null?void 0:s.call(i))??[];if(((r=this.ph)==null?void 0:r.nh)===e)return this.ph.eh;const n=e.map((o=>new AK(o)));return this.ph={nh:e,eh:n},n}gh(){var i,s,r;const e=((s=(i=this.ah).timeAxisPaneViews)==null?void 0:s.call(i))??[];if(((r=this.mh)==null?void 0:r.nh)===e)return this.mh.eh;const n=e.map((o=>new AK(o)));return this.mh={nh:e,eh:n},n}Mh(e,n){var i,s;return((s=(i=this.ah).autoscaleInfo)==null?void 0:s.call(i,e,n))??null}}function nN(t,e,n,i){t.forEach((s=>{e(s).forEach((r=>{r.rh()===n&&i.push(r)}))}))}function iN(t){return t.Fs()}function DYe(t){return t.wh()}function OYe(t){return t.gh()}const MYe=["Area","Line","Baseline"];class WS extends xYe{constructor(e,n,i,s,r){super(e),this.Yt=new SYe,this.er=new yYe(this),this.bh=[],this.Sh=new fYe(this),this.xh=null,this.Ch=null,this.Ph=null,this.yh=[],this.Ps=i,this.kh=n;const o=new bYe(this);this.vs=[o],this.rr=new Eoe(o,this,e),MYe.includes(this.kh)&&(this.xh=new gYe(this)),this.Th(),this.sh=s(this,this.Qt(),r)}m(){this.Ph!==null&&clearTimeout(this.Ph)}Ie(e){return this.Ps.priceLineColor||e}ye(e){const n={ke:!0},i=this.Ft();if(this.Qt().Et().Ki()||i.Ki()||this.Yt.Ki())return n;const s=this.Qt().Et().Pe(),r=this.zt();if(s===null||r===null)return n;let o,a;if(e){const h=this.Yt.Ar();if(h===null)return n;o=h,a=h.Re}else{const h=this.Yt.Fr(s.bi(),-1);if(h===null||(o=this.Yt.kr(h.Re),o===null))return n;a=h.Re}const c=o.Wt[3],l=this.Rh().Dr(a,{Wt:o}),d=i.Nt(c,r.Wt);return{ke:!1,gt:c,ri:i.Zi(c,r.Wt),Oe:i.Dh(c),Ne:i.Vh(c,r.Wt),R:l.cr,Ii:d,Re:a}}Rh(){return this.Ch!==null||(this.Ch=new _Ye(this)),this.Ch}N(){return this.Ps}hr(e){const n=e.priceScaleId;n!==void 0&&n!==this.Ps.priceScaleId&&this.Qt().Bh(this,n),jc(this.Ps,e),e.priceFormat!==void 0&&(this.Th(),this.Qt().Ih()),this.Qt().Eh(this),this.Qt().Ah(),this.sh.yt("options")}ht(e,n){this.Yt.ht(e),this.sh.yt("data"),this.xh!==null&&(n&&n.zh?this.xh.be():e.length===0&&this.xh.Me());const i=this.Qt().Hn(this);this.Qt().Lh(i),this.Qt().Eh(this),this.Qt().Ah(),this.Qt().ar()}Oh(e){const n=new CYe(this,e);return this.bh.push(n),this.Qt().Eh(this),n}Nh(e){const n=this.bh.indexOf(e);n!==-1&&this.bh.splice(n,1),this.Qt().Eh(this)}Fh(){return this.bh}Rr(){return this.kh}zt(){const e=this.Wh();return e===null?null:{Wt:e.Wt[3],Hh:e.wt}}Wh(){const e=this.Qt().Et().Pe();if(e===null)return null;const n=e.Uh();return this.Yt.Fr(n,1)}Xs(){return this.Yt}$h(e){const n=this.Yt.kr(e);return n===null?null:this.kh==="Bar"||this.kh==="Candlestick"||this.kh==="Custom"?{qh:n.Wt[0],Yh:n.Wt[1],jh:n.Wt[2],Kh:n.Wt[3]}:n.Wt[3]}Xh(e){const n=[];nN(this.yh,iN,"top",n);const i=this.xh;return i!==null&&i.Vt()&&(this.Ph===null&&i.xe()&&(this.Ph=setTimeout((()=>{this.Ph=null,this.Qt().Zh()}),0)),i.Se(),n.unshift(i)),n}Fs(){const e=[];this.Gh()||e.push(this.Sh),e.push(this.sh,this.er);const n=this.bh.map((i=>i.lr()));return e.push(...n),nN(this.yh,iN,"normal",e),e}Jh(){return this.Qh(iN,"bottom")}ta(e){return this.Qh(DYe,e)}ia(e){return this.Qh(OYe,e)}sa(e,n){return this.yh.map((i=>i.jn(e,n))).filter((i=>i!==null))}us(){return[this.rr,...this.bh.map((e=>e._r()))]}Ws(e,n){if(n!==this.es&&!this.Gh())return[];const i=[...this.vs];for(const s of this.bh)i.push(s.ur());
7472return this.yh.forEach((s=>{i.push(...s.Ws())})),i}cs(){const e=[];return this.yh.forEach((n=>{e.push(...n.cs())})),e}Mh(e,n){if(this.Ps.autoscaleInfoProvider!==void 0){const i=this.Ps.autoscaleInfoProvider((()=>{const s=this.na(e,n);return s===null?null:s.Xe()}));return p8.Ze(i)}return this.na(e,n)}nh(){const e=this.Ps.priceFormat;return e.base??1/e.minMove}ea(){return this.ra}Ns(){var e;this.sh.yt();for(const n of this.vs)n.yt();for(const n of this.bh)n.yt();this.er.yt(),this.Sh.yt(),(e=this.xh)==null||e.yt(),this.yh.forEach((n=>n.Ns()))}Ft(){return gt(super.Ft())}At(e){if(!((this.kh==="Line"||this.kh==="Area"||this.kh==="Baseline")&&this.Ps.crosshairMarkerVisible))return null;const n=this.Yt.kr(e);return n===null?null:{gt:n.Wt[3],ft:this.ha(),Ht:this.aa(),Ot:this.la(),Lt:this.oa(e)}}Ee(){return this.Ps.title}Vt(){return this.Ps.visible}_a(e){this.yh.push(new IYe(e,this))}ua(e){this.yh=this.yh.filter((n=>n.oh()!==e))}ca(){if(this.kh==="Custom")return e=>this.sh.da(e)}fa(){if(this.kh==="Custom")return e=>this.sh.pa(e)}va(){return this.Yt.qr()}Gh(){return!jS(this.Ft().ma())}na(e,n){if(!Q5(e)||!Q5(n)||this.Yt.Ki())return null;const i=this.kh==="Line"||this.kh==="Area"||this.kh==="Baseline"||this.kh==="Histogram"?[3]:[2,1],s=this.Yt.Ur(e,n,i);let r=s!==null?new fa(s.Jr,s.Qr):null,o=null;if(this.Rr()==="Histogram"){const a=this.Ps.base,c=new fa(a,a);r=r!==null?r.vn(c):c}return this.yh.forEach((a=>{const c=a.Mh(e,n);if(c!=null&&c.priceRange){const l=new fa(c.priceRange.minValue,c.priceRange.maxValue);r=r!==null?r.vn(l):l}c!=null&&c.margins&&(o=c.margins)})),new p8(r,o)}ha(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.Ps.crosshairMarkerRadius}return 0}aa(){switch(this.kh){case"Line":case"Area":case"Baseline":{const e=this.Ps.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}la(){switch(this.kh){case"Line":case"Area":case"Baseline":return this.Ps.crosshairMarkerBorderWidth}return 0}oa(e){switch(this.kh){case"Line":case"Area":case"Baseline":{const n=this.Ps.crosshairMarkerBackgroundColor;if(n.length!==0)return n}}return this.Rh().Dr(e).cr}Th(){switch(this.Ps.priceFormat.type){case"custom":{const e=this.Ps.priceFormat.formatter;this.ra={format:e,formatTickmarks:this.Ps.priceFormat.tickmarksFormatter??(n=>n.map(e))};break}case"volume":this.ra=new lYe(this.Ps.priceFormat.precision);break;case"percent":this.ra=new xoe(this.Ps.priceFormat.precision);break;default:{const e=Math.pow(10,this.Ps.priceFormat.precision);this.ra=new VS(e,this.Ps.priceFormat.minMove*e)}}this.es!==null&&this.es.wa()}Qh(e,n){const i=[];return nN(this.yh,e,n,i),i}}const LYe=[3],$Ye=[0,1,2,3];class UYe{constructor(e){this.Ps=e}ga(e,n,i){let s=e;if(this.Ps.mode===0)return s;const r=i.ks(),o=r.zt();if(o===null)return s;const a=r.Nt(e,o),c=i.Ma().filter((d=>d instanceof WS)).reduce(((d,h)=>{if(i.Un(h)||!h.Vt())return d;const p=h.Ft(),g=h.Xs();if(p.Ki()||!g.Te(n))return d;const b=g.kr(n);if(b===null)return d;const w=ap(h.zt()),C=this.Ps.mode===3?$Ye:LYe;return d.concat(C.map((E=>p.Nt(b.Wt[E],w.Wt))))}),[]);if(c.length===0)return s;c.sort(((d,h)=>Math.abs(d-a)-Math.abs(h-a)));const l=c[0];return s=r.Ts(l,o),s}}function R2(t,e,n){return Math.min(Math.max(t,e),n)}function Ux(t,e,n){return e-t<=n}class BYe extends Yp{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}et({context:e,bitmapSize:n,horizontalPixelRatio:i,verticalPixelRatio:s}){if(this.Yt===null)return;const r=Math.max(1,Math.floor(i));e.lineWidth=r,(function(o,a){o.save(),o.lineWidth%2&&o.translate(.5,.5),a(),o.restore()})(e,(()=>{const o=gt(this.Yt);if(o.ba){e.strokeStyle=o.Sa,Up(e,o.xa),e.beginPath();for(const a of o.Ca){const c=Math.round(a.Pa*i);e.moveTo(c,-r),e.lineTo(c,n.height+r)}e.stroke()}if(o.ya){e.strokeStyle=o.ka,Up(e,o.Ta),e.beginPath();for(const a of o.Ra){const c=Math.round(a.Pa*s);e.moveTo(-r,c),e.lineTo(n.width+r,c)}e.stroke()}}))}}class FYe{constructor(e){this.Gt=new BYe,this.xt=!0,this.Pt=e}yt(){this.xt=!0}Tt(){if(this.xt){const e=this.Pt.Qt().N().grid,n={ya:e.horzLines.visible,ba:e.vertLines.visible,ka:e.horzLines.color,Sa:e.vertLines.color,Ta:e.horzLines.style,xa:e.vertLines.style,Ra:this.Pt.ks().Da(),Ca:(this.Pt.Qt().Et().Da()||[]).map((i=>({Pa:i.coord})))};this.Gt.ht(n),this.xt=!1}return this.Gt}}class jYe{constructor(e){this.sh=new FYe(e)}lr(){return this.sh}}const sN={Va:4,Ba:1e-4};function d2(t,e){const n=100*(t-e)/e;return e<0?-n:n}function VYe(t,e){const n=d2(t.$e(),e),i=d2(t.qe(),e);return new fa(n,i)}function _3(t,e){const n=100*(t-e)/e+100;return e<0?-n:n}function WYe(t,e){const n=_3(t.$e(),e),i=_3(t.qe(),e);return new fa(n,i)}function g8(t,e){const n=Math.abs(t);if(n<1e-15)return 0;const i=Math.log10(n+e.Ba)+e.Va;return t<0?-i:i}function S3(t,e){const n=Math.abs(t);if(n<1e-15)return 0;const i=Math.pow(10,n-e.Va)-e.Ba;return t<0?-i:i}function Gv(t,e){if(t===null)return null;const n=g8(t.$e(),e),i=g8(t.qe(),e);return new fa(n,i)}function h2(t,e){if(t===null)return null;const n=S3(t.$e(),e),i=S3(t.qe(),e);return new fa(n,i)}function rN(t){if(t===null)return sN;const e=Math.abs(t.qe()-t.$e());if(e>=1||e<1e-15)return sN;const n=Math.ceil(Math.abs(Math.log10(e))),i=sN.Va+n;return{Va:i,Ba:1/Math.pow(10,i)}}class oN{constructor(e,n){if(this.Ia=e,this.Ea=n,(function(i){if(i<0)return!1;if(i>1e18)return!0;for(let s=i;s>1;s/=10)if(s%10!=0)return!1;return!0})(this.Ia))this.Aa=[2,2.5,2];else{this.Aa=[];for(let i=this.Ia;i!==1;){if(i%2==0)this.Aa.push(2),i/=2;else{if(i%5!=0)throw new Error("unexpected base");this.Aa.push(2,2.5),i/=5}if(this.Aa.length>100)throw new Error("something wrong with base")}}}za(e,n,i){const s=this.Ia===0?0:1/this.Ia;let r=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-n)))),o=0,a=this.Ea[0];for(;;){const h=Ux(r,s,1e-14)&&r>s+1e-14,p=Ux(r,i*a,1e-14),g=Ux(r,1,1e-14);if(!(h&&p&&g))break;r/=a,a=this.Ea[++o%this.Ea.length]}
7472if(r<=s+1e-14&&(r=s),r=Math.max(1,r),this.Aa.length>0&&(c=r,l=1,d=1e-14,Math.abs(c-l)<d))for(o=0,a=this.Aa[0];Ux(r,i*a,1e-14)&&r>s+1e-14;)r/=a,a=this.Aa[++o%this.Aa.length];var c,l,d;return r}}class TK{constructor(e,n,i,s){this.La=[],this.Yi=e,this.Ia=n,this.Oa=i,this.Na=s}za(e,n){if(e<n)throw new Error("high < low");const i=this.Yi.$t(),s=(e-n)*this.Fa()/i,r=new oN(this.Ia,[2,2.5,2]),o=new oN(this.Ia,[2,2,2.5]),a=new oN(this.Ia,[2.5,2,2]),c=[];return c.push(r.za(e,n,s),o.za(e,n,s),a.za(e,n,s)),(function(l){if(l.length<1)throw Error("array is empty");let d=l[0];for(let h=1;h<l.length;++h)l[h]<d&&(d=l[h]);return d})(c)}Wa(){const e=this.Yi,n=e.zt();if(n===null)return void(this.La=[]);const i=e.$t(),s=this.Oa(i-1,n),r=this.Oa(0,n),o=this.Yi.N().entireTextOnly?this.Ha()/2:0,a=o,c=i-1-o,l=Math.max(s,r),d=Math.min(s,r);if(l===d)return void(this.La=[]);const h=this.za(l,d);if(this.Ua(n,h,l,d,a,c),e.$a()&&this.qa(h,d,l)){const b=this.Yi.Ya();this.ja(n,h,a,c,b,2*b)}const p=this.La.map((b=>b.Ka)),g=this.Yi.Xa(p);for(let b=0;b<this.La.length;b++)this.La[b].Za=g[b]}Da(){return this.La}Ha(){return this.Yi.P()}Fa(){return Math.ceil(2.5*this.Ha())}Ua(e,n,i,s,r,o){const a=this.La,c=this.Yi;let l=i%n;l+=l<0?n:0;const d=i>=s?1:-1;let h=null,p=0;for(let g=i-l;g>s;g-=n){const b=this.Na(g,e,!0);h!==null&&Math.abs(b-h)<this.Fa()||b<r||b>o||(p<a.length?(a[p].Pa=b,a[p].Za=c.Ga(g),a[p].Ka=g):a.push({Pa:b,Za:c.Ga(g),Ka:g}),p++,h=b,c.Ja()&&(n=this.za(g*d,s)))}a.length=p}ja(e,n,i,s,r,o){const a=this.La,c=this.Qa(e,i,r,o),l=this.Qa(e,s,-o,-r),d=this.Na(0,e,!0)-this.Na(n,e,!0);a.length>0&&a[0].Pa-c.Pa<d/2&&a.shift(),a.length>0&&l.Pa-a[a.length-1].Pa<d/2&&a.pop(),a.unshift(c),a.push(l)}Qa(e,n,i,s){const r=(i+s)/2,o=this.Oa(n+i,e),a=this.Oa(n+s,e),c=Math.min(o,a),l=Math.max(o,a),d=Math.max(.1,this.za(l,c)),h=this.Oa(n+r,e),p=h-h%d,g=this.Na(p,e,!0);return{Za:this.Yi.Ga(p),Pa:g,Ka:p}}qa(e,n,i){let s=ap(this.Yi.Qe());return this.Yi.Ja()&&(s=h2(s,this.Yi.tl())),s.$e()-n<e&&i-s.qe()<e}}function koe(t){return t.slice().sort(((e,n)=>gt(e.hs())-gt(n.hs())))}var kK;(function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"})(kK||(kK={}));const NK=new xoe,RK=new VS(100,1);class qYe{constructor(e,n,i,s,r){this.il=0,this.sl=null,this.Ge=null,this.nl=null,this.el={rl:!1,hl:null},this.al=!1,this.ll=0,this.ol=0,this._l=new rr,this.ul=new rr,this.cl=[],this.dl=null,this.fl=null,this.pl=null,this.vl=null,this.ml=null,this.ra=RK,this.wl=rN(null),this.gl=e,this.Ps=n,this.Ml=i,this.bl=s,this.Sl=r,this.xl=new TK(this,100,this.Cl.bind(this),this.Pl.bind(this))}ma(){return this.gl}N(){return this.Ps}hr(e){if(jc(this.Ps,e),this.wa(),e.mode!==void 0&&this.yl({ie:e.mode}),e.scaleMargins!==void 0){const n=ic(e.scaleMargins.top),i=ic(e.scaleMargins.bottom);if(n<0||n>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${n}`);if(i<0||i>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${i}`);if(n+i>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${n+i}`);this.kl(),this.pl=null}}Tl(){return this.Ps.autoScale}Rl(){return this.al}Ja(){return this.Ps.mode===1}Le(){return this.Ps.mode===2}Dl(){return this.Ps.mode===3}tl(){return this.wl}ie(){return{sn:this.Ps.autoScale,Vl:this.Ps.invertScale,ie:this.Ps.mode}}yl(e){const n=this.ie();let i=null;e.sn!==void 0&&(this.Ps.autoScale=e.sn),e.ie!==void 0&&(this.Ps.mode=e.ie,e.ie!==2&&e.ie!==3||(this.Ps.autoScale=!0),this.el.rl=!1),n.ie===1&&e.ie!==n.ie&&((function(r,o){if(r===null)return!1;const a=S3(r.$e(),o),c=S3(r.qe(),o);return isFinite(a)&&isFinite(c)})(this.Ge,this.wl)?(i=h2(this.Ge,this.wl),i!==null&&this.Bl(i)):this.Ps.autoScale=!0),e.ie===1&&e.ie!==n.ie&&(i=Gv(this.Ge,this.wl),i!==null&&this.Bl(i));const s=n.ie!==this.Ps.mode;s&&(n.ie===2||this.Le())&&this.wa(),s&&(n.ie===3||this.Dl())&&this.wa(),e.Vl!==void 0&&n.Vl!==e.Vl&&(this.Ps.invertScale=e.Vl,this.Il()),this.ul.p(n,this.ie())}El(){return this.ul}P(){return this.Ml.fontSize}$t(){return this.il}Al(e){this.il!==e&&(this.il=e,this.kl(),this.pl=null)}zl(){if(this.sl)return this.sl;const e=this.$t()-this.Ll()-this.Ol();return this.sl=e,e}Qe(){return this.Nl(),this.Ge}Bl(e,n){const i=this.Ge;(n||i===null&&e!==null||i!==null&&!i.He(e))&&(this.pl=null,this.Ge=e)}Fl(e){this.Bl(e),this.Wl(e!==null)}Ki(){return this.Nl(),this.il===0||!this.Ge||this.Ge.Ki()}Hl(e){return this.Vl()?e:this.$t()-1-e}Nt(e,n){return this.Le()?e=d2(e,n):this.Dl()&&(e=_3(e,n)),this.Pl(e,n)}Ul(e,n,i){this.Nl();const s=this.Ol(),r=gt(this.Qe()),o=r.$e(),a=r.qe(),c=this.zl()-1,l=this.Vl(),d=c/(a-o),h=i===void 0?0:i.from,p=i===void 0?e.length:i.to,g=this.$l();for(let b=h;b<p;b++){const w=e[b],C=w.gt;if(isNaN(C))continue;let E=C;g!==null&&(E=g(w.gt,n));const T=s+d*(E-o),A=l?T:this.il-1-T;w.ut=A}}ql(e,n,i){this.Nl();const s=this.Ol(),r=gt(this.Qe()),o=r.$e(),a=r.qe(),c=this.zl()-1,l=this.Vl(),d=c/(a-o),h=i===void 0?0:i.from,p=i===void 0?e.length:i.to,g=this.$l();for(let b=h;b<p;b++){const w=e[b];let C=w.qh,E=w.Yh,T=w.jh,A=w.Kh;g!==null&&(C=g(w.qh,n),E=g(w.Yh,n),T=g(w.jh,n),A=g(w.Kh,n));let k=s+d*(C-o),R=l?k:this.il-1-k;w.Yl=R,k=s+d*(E-o),R=l?k:this.il-1-k,w.jl=R,k=s+d*(T-o),R=l?k:this.il-1-k,w.Kl=R,k=s+d*(A-o),R=l?k:this.il-1-k,w.Xl=R}}Ts(e,n){const i=this.Cl(e,n);return this.Zl(i,n)}Zl(e,n){let i=e;return this.Le()?i=(function(s,r){return r<0&&(s=-s),s/100*r+r})(i,n):this.Dl()&&(i=(function(s,r){return s-=100,r<0&&(s=-s),s/100*r+r})(i,n)),i}Ma(){return this.cl}Dt(){return this.fl||(this.fl=koe(this.cl)),this.fl}Gl(e){this.cl.indexOf(e)===-1&&(this.cl.push(e),this.wa(),this.Jl())}Ql(e){const n=this.cl.indexOf(e);if(n===-1)throw new Error("source is not attached to scale");this.cl.splice(n,1),this.cl.length===0&&(this.yl({sn:!0}),this.Bl(null)),this.wa(),this.Jl()}zt(){let e=null;for(const n of this.cl){const i=n.zt();i!==null&&(e===null||i.Hh<e.Hh)&&(e=i)}return e===null?null:e.Wt}Vl(){return this.Ps.invertScale}Da(){const e=this.zt()===null;if(this.pl!==null&&(e||this.pl.io===e))return this.pl.Da;this.xl.Wa();const n=this.xl.Da();return this.pl={Da:n,io:e},this._l.p(),n}so(){return this._l}no(e){this.Le()||this.Dl()||this.vl===null&&this.nl===null&&(this.Ki()||(this.vl=this.il-e,this.nl=gt(this.Qe()).Ue()))}eo(e){if(this.Le()||this.Dl()||this.vl===null)return;this.yl({sn:!1}),(e=this.il-e)<0&&(e=0);let n=(this.vl+.2*(this.il-1))/(e+.2*(this.il-1));const i=gt(this.nl).Ue();n=Math.max(n,.1),i.je(n),this.Bl(i)}ro(){this.Le()||this.Dl()||(this.vl=null,this.nl=null)}ho(e){this.Tl()||this.ml===null&&this.nl===null&&(this.Ki()||(this.ml=e,this.nl=gt(this.Qe()).Ue()))}ao(e){if(this.Tl()||this.ml===null)return;
7472const n=gt(this.Qe()).Ye()/(this.zl()-1);let i=e-this.ml;this.Vl()&&(i*=-1);const s=i*n,r=gt(this.nl).Ue();r.Ke(s),this.Bl(r,!0),this.pl=null}lo(){this.Tl()||this.ml!==null&&(this.ml=null,this.nl=null)}ea(){return this.ra||this.wa(),this.ra}Zi(e,n){switch(this.Ps.mode){case 2:return this.oo(d2(e,n));case 3:return this.ea().format(_3(e,n));default:return this.nr(e)}}Ga(e){switch(this.Ps.mode){case 2:return this.oo(e);case 3:return this.ea().format(e);default:return this.nr(e)}}Xa(e){switch(this.Ps.mode){case 2:return this._o(e);case 3:return this.ea().formatTickmarks(e);default:return this.uo(e)}}Dh(e){return this.nr(e,gt(this.dl).ea())}Vh(e,n){return e=d2(e,n),this.oo(e,NK)}co(){return this.cl}do(e){this.el={hl:e,rl:!1}}Ns(){this.cl.forEach((e=>e.Ns()))}$a(){return this.Ps.ensureEdgeTickMarksVisible&&this.Tl()}Ya(){return this.P()/2}wa(){this.pl=null;let e=1/0;this.dl=null;for(const i of this.cl)i.hs()<e&&(e=i.hs(),this.dl=i);let n=100;this.dl!==null&&(n=Math.round(this.dl.nh())),this.ra=RK,this.Le()?(this.ra=NK,n=100):this.Dl()?(this.ra=new VS(100,1),n=100):this.dl!==null&&(this.ra=this.dl.ea()),this.xl=new TK(this,n,this.Cl.bind(this),this.Pl.bind(this)),this.xl.Wa()}Jl(){this.fl=null}fo(){return this.dl===null||this.Le()||this.Dl()?1:1/this.dl.nh()}Xi(){return this.Sl}Wl(e){this.al=e}Ll(){return this.Vl()?this.Ps.scaleMargins.bottom*this.$t()+this.ol:this.Ps.scaleMargins.top*this.$t()+this.ll}Ol(){return this.Vl()?this.Ps.scaleMargins.top*this.$t()+this.ll:this.Ps.scaleMargins.bottom*this.$t()+this.ol}Nl(){this.el.rl||(this.el.rl=!0,this.po())}kl(){this.sl=null}Pl(e,n){if(this.Nl(),this.Ki())return 0;e=this.Ja()&&e?g8(e,this.wl):e;const i=gt(this.Qe()),s=this.Ol()+(this.zl()-1)*(e-i.$e())/i.Ye();return this.Hl(s)}Cl(e,n){if(this.Nl(),this.Ki())return 0;const i=this.Hl(e),s=gt(this.Qe()),r=s.$e()+s.Ye()*((i-this.Ol())/(this.zl()-1));return this.Ja()?S3(r,this.wl):r}Il(){this.pl=null,this.xl.Wa()}po(){if(this.Rl()&&!this.Tl())return;const e=this.el.hl;if(e===null)return;let n=null;const i=this.co();let s=0,r=0;for(const c of i){if(!c.Vt())continue;const l=c.zt();if(l===null)continue;const d=c.Mh(e.Uh(),e.bi());let h=d&&d.Qe();if(h!==null){switch(this.Ps.mode){case 1:h=Gv(h,this.wl);break;case 2:h=VYe(h,l.Wt);break;case 3:h=WYe(h,l.Wt)}if(n=n===null?h:n.vn(gt(h)),d!==null){const p=d.tr();p!==null&&(s=Math.max(s,p.above),r=Math.max(r,p.below))}}}if(this.$a()&&(s=Math.max(s,this.Ya()),r=Math.max(r,this.Ya())),s===this.ll&&r===this.ol||(this.ll=s,this.ol=r,this.pl=null,this.kl()),n!==null){if(n.$e()===n.qe()){const c=5*this.fo();this.Ja()&&(n=h2(n,this.wl)),n=new fa(n.$e()-c,n.qe()+c),this.Ja()&&(n=Gv(n,this.wl))}if(this.Ja()){const c=h2(n,this.wl),l=rN(c);if(o=l,a=this.wl,o.Va!==a.Va||o.Ba!==a.Ba){const d=this.nl!==null?h2(this.nl,this.wl):null;this.wl=l,n=Gv(c,l),d!==null&&(this.nl=Gv(d,l))}}this.Bl(n)}else this.Ge===null&&(this.Bl(new fa(-.5,.5)),this.wl=rN(null));var o,a}$l(){return this.Le()?d2:this.Dl()?_3:this.Ja()?e=>g8(e,this.wl):null}vo(e,n,i){return n===void 0?(i===void 0&&(i=this.ea()),i.format(e)):n(e)}mo(e,n,i){return n===void 0?(i===void 0&&(i=this.ea()),i.formatTickmarks(e)):n(e)}nr(e,n){return this.vo(e,this.bl.priceFormatter,n)}uo(e,n){const i=this.bl.priceFormatter;return this.mo(e,this.bl.tickmarksPriceFormatter??(i?s=>s.map(i):void 0),n)}oo(e,n){return this.vo(e,this.bl.percentageFormatter,n)}_o(e,n){const i=this.bl.percentageFormatter;return this.mo(e,this.bl.tickmarksPercentageFormatter??(i?s=>s.map(i):void 0),n)}}function PK(t){return t instanceof WS}class IK{constructor(e,n){this.cl=[],this.wo=new Map,this.il=0,this.Mo=0,this.bo=1,this.fl=null,this.So=!1,this.xo=new rr,this.yh=[],this.uh=e,this.ts=n,this.Co=new jYe(this);const i=n.N();this.Po=this.yo("left",i.leftPriceScale),this.ko=this.yo("right",i.rightPriceScale),this.Po.El().i(this.To.bind(this,this.Po),this),this.ko.El().i(this.To.bind(this,this.ko),this),this.Ro(i)}Ro(e){if(e.leftPriceScale&&this.Po.hr(e.leftPriceScale),e.rightPriceScale&&this.ko.hr(e.rightPriceScale),e.localization&&(this.Po.wa(),this.ko.wa()),e.overlayPriceScales){const n=Array.from(this.wo.values());for(const i of n){const s=gt(i[0].Ft());s.hr(e.overlayPriceScales),e.localization&&s.wa()}}}Do(e){switch(e){case"left":return this.Po;case"right":return this.ko}return this.wo.has(e)?ic(this.wo.get(e))[0].Ft():null}m(){this.Qt().Vo().u(this),this.Po.El().u(this),this.ko.El().u(this),this.cl.forEach((e=>{e.m&&e.m()})),this.yh=this.yh.filter((e=>{const n=e.oh();return n.detached&&n.detached(),!1})),this.xo.p()}Bo(){return this.bo}Io(e){this.bo=e}Qt(){return this.ts}Qi(){return this.Mo}$t(){return this.il}Eo(e){this.Mo=e,this.Ao()}Al(e){this.il=e,this.Po.Al(e),this.ko.Al(e),this.cl.forEach((n=>{if(this.Un(n)){const i=n.Ft();i!==null&&i.Al(e)}})),this.Ao()}zo(e){this.So=e}Lo(){return this.So}Oo(){return this.cl.filter(PK)}Ma(){return this.cl}Un(e){const n=e.Ft();return n===null||this.Po!==n&&this.ko!==n}Gl(e,n,i){this.No(e,n,i?e.hs():this.cl.length)}Ql(e,n){const i=this.cl.indexOf(e);vo(i!==-1,"removeDataSource: invalid data source"),this.cl.splice(i,1),n||this.cl.forEach(((o,a)=>o.ls(a)));const s=gt(e.Ft()).ma();if(this.wo.has(s)){const o=ic(this.wo.get(s)),a=o.indexOf(e);a!==-1&&(o.splice(a,1),o.length===0&&this.wo.delete(s))}const r=e.Ft();r&&r.Ma().indexOf(e)>=0&&(r.Ql(e),this.Fo(r)),this.fl=null}qn(e){return e===this.Po?"left":e===this.ko?"right":"overlay"}Wo(){return this.Po}Ho(){return this.ko}Uo(e,n){e.no(n)}$o(e,n){e.eo(n),this.Ao()}qo(e){e.ro()}Yo(e,n){e.ho(n)}jo(e,n){e.ao(n),this.Ao()}Ko(e){e.lo()}Ao(){this.cl.forEach((e=>{e.Ns()}))}ks(){let e=null;return this.ts.N().rightPriceScale.visible&&this.ko.Ma().length!==0?e=this.ko:this.ts.N().leftPriceScale.visible&&this.Po.Ma().length!==0?e=this.Po:this.cl.length!==0&&(e=this.cl[0].Ft()),e===null&&(e=this.ko),e}$n(){let e=null;return this.ts.N().rightPriceScale.visible?e=this.ko:this.ts.N().leftPriceScale.visible&&(e=this.Po),e}Fo(e){e!==null&&e.Tl()&&this.Xo(e)}Zo(e){const n=this.uh.Pe();e.yl({sn:!0}),n!==null&&e.do(n),this.Ao()}Go(){this.Xo(this.Po),this.Xo(this.ko)}Jo(){this.Fo(this.Po),this.Fo(this.ko),this.cl.forEach((e=>{this.Un(e)&&this.Fo(e.Ft())})),this.Ao(),this.ts.ar()}Dt(){return this.fl===null&&(this.fl=koe(this.cl)),this.fl}Qo(e,n){n=R2(n,0,this.cl.length-1);const i=this.cl.indexOf(e);vo(i!==-1,"setSeriesOrder: invalid data source"),this.cl.splice(i,1),this.cl.splice(n,0,e),this.cl.forEach(((s,r)=>s.ls(r))),this.fl=null;for(const s of[this.Po,this.ko])s.Jl(),s.wa();this.ts.ar()}Bt(){return this.Dt().filter(PK)}t_(){return this.xo}i_(){return this.Co}_a(e){this.yh.push(new kYe(e))}ua(e){this.yh=this.yh.filter((n=>n.oh()!==e)),e.detached&&e.detached(),this.ts.ar()}s_(){return this.yh}sa(e,n){return this.yh.map((i=>i.jn(e,n))).filter((i=>i!==null))}Xo(e){const n=e.co();if(n&&n.length>0&&!this.uh.Ki()){const i=this.uh.Pe();i!==null&&e.do(i)}e.Ns()}No(e,n,i){let s=this.Do(n);if(s===null&&(s=this.yo(n,this.ts.N().overlayPriceScales)),this.cl.splice(i,0,e),!jS(n)){const r=this.wo.get(n)||[];r.push(e),this.wo.set(n,r)}e.ls(i),s.Gl(e),e._s(s),this.Fo(s),this.fl=null}To(e,n,i){n.ie!==i.ie&&this.Xo(e)}yo(e,n){const i={visible:!0,autoScale:!0,...Qh(n)},s=new qYe(e,i,this.ts.N().layout,this.ts.N().localization,this.ts.Xi());return s.Al(this.$t()),s}}function Bx(t){return{n_:t.n_,e_:{Kn:t.r_.externalId},h_:t.r_.cursorStyle}}function zYe(t,e,n,i){for(const s of t){const r=s.Tt(i);if(r!==null&&r.jn){const o=r.jn(e,n);if(o!==null)return{a_:s,e_:o}}}return null}function HYe(t){return t.Fs!==void 0}function Noe(t,e,n){const i=[t,...t.Dt()],s=(function(r,o,a){var p;let c,l;
7472for(const g of r){const b=((p=g.sa)==null?void 0:p.call(g,o,a))??[];for(const w of b)d=w.zOrder,h=c==null?void 0:c.zOrder,(!h||d==="top"&&h!=="top"||d==="normal"&&h==="bottom")&&(c=w,l=g)}var d,h;return c&&l?{r_:c,n_:l}:null})(i,e,n);if((s==null?void 0:s.r_.zOrder)==="top")return Bx(s);for(const r of i){if(s&&s.n_===r&&s.r_.zOrder!=="bottom"&&!s.r_.isBackground)return Bx(s);if(HYe(r)){const o=zYe(r.Fs(t),e,n,t);if(o!==null)return{n_:r,a_:o.a_,e_:o.e_}}if(s&&s.n_===r&&s.r_.zOrder!=="bottom"&&s.r_.isBackground)return Bx(s)}return s!=null&&s.r_?Bx(s):null}class GYe{constructor(e,n,i=50){this.yn=0,this.kn=1,this.Tn=1,this.Dn=new Map,this.Rn=new Map,this.l_=e,this.o_=n,this.Vn=i}__(e){const n=e.time,i=this.o_.cacheKey(n),s=this.Dn.get(i);if(s!==void 0)return s.u_;if(this.yn===this.Vn){const o=this.Rn.get(this.Tn);this.Rn.delete(this.Tn),this.Dn.delete(ic(o)),this.Tn++,this.yn--}const r=this.l_(e);return this.Dn.set(i,{u_:r,An:this.kn}),this.Rn.set(this.kn,i),this.yn++,this.kn++,r}}class A3{constructor(e,n){vo(e<=n,"right should be >= left"),this.c_=e,this.d_=n}Uh(){return this.c_}bi(){return this.d_}f_(){return this.d_-this.c_+1}Te(e){return this.c_<=e&&e<=this.d_}He(e){return this.c_===e.Uh()&&this.d_===e.bi()}}function DK(t,e){return t===null||e===null?t===e:t.He(e)}class KYe{constructor(){this.p_=new Map,this.Dn=null,this.v_=!1}m_(e){this.v_=e,this.Dn=null}w_(e,n){this.g_(n),this.Dn=null;for(let i=n;i<e.length;++i){const s=e[i];let r=this.p_.get(s.timeWeight);r===void 0&&(r=[],this.p_.set(s.timeWeight,r)),r.push({index:i,time:s.time,weight:s.timeWeight,originalTime:s.originalTime})}}M_(e,n,i,s,r){const o=Math.ceil(n/e);return this.Dn!==null&&this.Dn.b_===o&&r===this.Dn.S_&&i===this.Dn.x_||(this.Dn={S_:r,x_:i,Da:this.C_(o,i,s),b_:o}),this.Dn.Da}g_(e){if(e===0)return void this.p_.clear();const n=[];this.p_.forEach(((i,s)=>{e<=i[0].index?n.push(s):i.splice(xb(i,e,(r=>r.index<e)),1/0)}));for(const i of n)this.p_.delete(i)}C_(e,n,i){let s=[];const r=o=>!n||i.has(o.index);for(const o of Array.from(this.p_.keys()).sort(((a,c)=>c-a))){if(!this.p_.get(o))continue;const a=s;s=[];const c=a.length;let l=0;const d=ic(this.p_.get(o)),h=d.length;let p=1/0,g=-1/0;for(let b=0;b<h;b++){const w=d[b],C=w.index;for(;l<c;){const E=a[l],T=E.index;if(!(T<C&&r(E))){p=T;break}l++,s.push(E),g=T,p=1/0}if(p-C>=e&&C-g>=e&&r(w))s.push(w),g=C;else if(this.v_)return a}for(;l<c;l++)r(a[l])&&s.push(a[l])}return s}}class P2{constructor(e){this.P_=e}y_(){return this.P_===null?null:new A3(Math.floor(this.P_.Uh()),Math.ceil(this.P_.bi()))}k_(){return this.P_}static T_(){return new P2(null)}}function YYe(t,e){return t.weight>e.weight?t:e}class ZYe{constructor(e,n,i,s){this.Mo=0,this.R_=null,this.D_=[],this.ml=null,this.vl=null,this.V_=new KYe,this.B_=new Map,this.I_=P2.T_(),this.E_=!0,this.A_=new rr,this.z_=new rr,this.L_=new rr,this.O_=null,this.N_=null,this.F_=new Map,this.W_=-1,this.H_=[],this.Ps=n,this.bl=i,this.U_=n.rightOffset,this.q_=n.barSpacing,this.ts=e,this.Y_(n),this.o_=s,this.j_(),this.V_.m_(n.uniformDistribution),this.K_()}N(){return this.Ps}X_(e){jc(this.bl,e),this.Z_(),this.j_()}hr(e,n){jc(this.Ps,e),this.Ps.fixLeftEdge&&this.G_(),this.Ps.fixRightEdge&&this.J_(),e.barSpacing!==void 0&&this.ts.dn(e.barSpacing),e.rightOffset!==void 0&&this.ts.fn(e.rightOffset),this.Y_(e),e.minBarSpacing===void 0&&e.maxBarSpacing===void 0||this.ts.dn(e.barSpacing??this.q_),e.ignoreWhitespaceIndices!==void 0&&e.ignoreWhitespaceIndices!==this.Ps.ignoreWhitespaceIndices&&this.K_(),this.Z_(),this.j_(),this.L_.p()}Rs(e){var n;return((n=this.D_[e])==null?void 0:n.time)??null}ss(e){return this.D_[e]??null}Q_(e,n){if(this.D_.length<1)return null;if(this.o_.key(e)>this.o_.key(this.D_[this.D_.length-1].time))return n?this.D_.length-1:null;const i=xb(this.D_,this.o_.key(e),((s,r)=>this.o_.key(s.time)<r));return this.o_.key(e)<this.o_.key(this.D_[i].time)?n?i:null:i}Ki(){return this.Mo===0||this.D_.length===0||this.R_===null}tu(){return this.D_.length>0}Pe(){return this.iu(),this.I_.y_()}su(){return this.iu(),this.I_.k_()}nu(){const e=this.Pe();if(e===null)return null;const n={from:e.Uh(),to:e.bi()};return this.eu(n)}eu(e){const n=Math.round(e.from),i=Math.round(e.to),s=gt(this.ru()),r=gt(this.hu());return{from:gt(this.ss(Math.max(s,n))),to:gt(this.ss(Math.min(r,i)))}}au(e){return{from:gt(this.Q_(e.from,!0)),to:gt(this.Q_(e.to,!0))}}Qi(){return this.Mo}Eo(e){if(!isFinite(e)||e<=0||this.Mo===e)return;const n=this.su(),i=this.Mo;if(this.Mo=e,this.E_=!0,this.Ps.lockVisibleTimeRangeOnResize&&i!==0){const s=this.q_*e/i;this.q_=s}if(this.Ps.fixLeftEdge&&n!==null&&n.Uh()<=0){const s=i-e;this.U_-=Math.round(s/this.q_)+1,this.E_=!0}this.lu(),this.ou()}qt(e){if(this.Ki()||!Q5(e))return 0;const n=this._u()+this.U_-e;return this.Mo-(n+.5)*this.q_-1}uu(e,n){const i=this._u(),s=n===void 0?0:n.from,r=n===void 0?e.length:n.to;for(let o=s;o<r;o++){const a=e[o].wt,c=i+this.U_-a,l=this.Mo-(c+.5)*this.q_-1;e[o]._t=l}}cu(e,n){const i=Math.ceil(this.du(e));return n&&this.Ps.ignoreWhitespaceIndices&&!this.fu(i)?this.pu(i):i}fn(e){this.E_=!0,this.U_=e,this.ou(),this.ts.vu(),this.ts.ar()}mu(){return this.q_}dn(e){const n=this.q_;if(this.wu(e),this.Ps.rightOffsetPixels!==void 0&&n!==0){const i=this.U_*n/this.q_;this.U_=i}this.ou(),this.ts.vu(),this.ts.ar()}gu(){return this.U_}Da(){if(this.Ki())return null;if(this.N_!==null)return this.N_;const e=this.q_,n=5*(this.ts.N().layout.fontSize+4)/8*(this.Ps.tickMarkMaxCharacterLength||8),i=Math.round(n/e),s=gt(this.Pe()),r=Math.max(s.Uh(),s.Uh()-i),o=Math.max(s.bi(),s.bi()-i),a=this.V_.M_(e,n,this.Ps.ignoreWhitespaceIndices,this.F_,this.W_),c=this.ru()+i,l=this.hu()-i,d=this.Mu(),h=this.Ps.fixLeftEdge||d,p=this.Ps.fixRightEdge||d;let g=0;for(const b of a){if(!(r<=b.index&&b.index<=o))continue;let w;g<this.H_.length?(w=this.H_[g],w.coord=this.qt(b.index),w.label=this.bu(b),w.weight=b.weight):(w={needAlignCoordinate:!1,coord:this.qt(b.index),label:this.bu(b),weight:b.weight},this.H_.push(w)),this.q_>n/2&&!d?w.needAlignCoordinate=!1:w.needAlignCoordinate=h&&b.index<=c||p&&b.index>=l,g++}return this.H_.length=g,this.N_=this.H_,this.H_}Su(){let e;this.E_=!0,this.dn(this.Ps.barSpacing),e=this.Ps.rightOffsetPixels!==void 0?this.Ps.rightOffsetPixels/this.mu():this.Ps.rightOffset,this.fn(e)}xu(e){this.E_=!0,this.R_=e,this.ou(),this.G_()}Cu(e,n){const i=this.du(e),s=this.mu(),r=s+n*(s/10);this.dn(r),this.Ps.rightBarStaysOnScroll||this.fn(this.gu()+(i-this.du(e)))}no(e){this.ml&&this.lo(),this.vl===null&&this.O_===null&&(this.Ki()||(this.vl=e,this.Pu()))}eo(e){if(this.O_===null)return;const n=R2(this.Mo-e,0,this.Mo),i=R2(this.Mo-gt(this.vl),0,this.Mo);n!==0&&i!==0&&this.dn(this.O_.mu*n/i)}ro(){this.vl!==null&&(this.vl=null,this.yu())}ho(e){this.ml===null&&this.O_===null&&(this.Ki()||(this.ml=e,this.Pu()))}ao(e){if(this.ml===null)return;const n=(this.ml-e)/this.mu();this.U_=gt(this.O_).gu+n,this.E_=!0,this.ou()}lo(){this.ml!==null&&(this.ml=null,this.yu())}ku(){this.Tu(this.Ps.rightOffset)}Tu(e,n=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(n)||n<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const i=this.U_,s=performance.now();this.ts._n({Ru:r=>(r-s)/n>=1,Du:r=>{const o=(r-s)/n;return o>
7472=1?e:i+(e-i)*o}})}yt(e,n){this.E_=!0,this.D_=e,this.V_.w_(e,n),this.ou()}Vu(){return this.A_}Bu(){return this.z_}Iu(){return this.L_}_u(){return this.R_||0}Eu(e,n){const i=e.f_(),s=n&&this.Ps.rightOffsetPixels||0;this.wu((this.Mo-s)/i),this.U_=e.bi()-this._u(),n&&(this.U_=s?s/this.mu():this.Ps.rightOffset),this.ou(),this.E_=!0,this.ts.vu(),this.ts.ar()}Au(){const e=this.ru(),n=this.hu();e!==null&&n!==null&&this.Eu(new A3(e,n),!0)}zu(e){const n=new A3(e.from,e.to);this.Eu(n)}ns(e){return this.bl.timeFormatter!==void 0?this.bl.timeFormatter(e.originalTime):this.o_.formatHorzItem(e.time)}K_(){if(!this.Ps.ignoreWhitespaceIndices)return;this.F_.clear();const e=this.ts.js();for(const n of e)for(const i of n.va())this.F_.set(i,!0);this.W_++}Mu(){const e=this.ts.N().handleScroll,n=this.ts.N().handleScale;return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||n.axisDoubleClickReset.time||n.axisPressedMouseMove.time||n.mouseWheel||n.pinch)}ru(){return this.D_.length===0?null:0}hu(){return this.D_.length===0?null:this.D_.length-1}Lu(e){return(this.Mo-1-e)/this.q_}du(e){const n=this.Lu(e),i=this._u()+this.U_-n;return Math.round(1e6*i)/1e6}wu(e){const n=this.q_;this.q_=e,this.lu(),n!==this.q_&&(this.E_=!0,this.Ou())}iu(){if(!this.E_)return;if(this.E_=!1,this.Ki())return void this.Nu(P2.T_());const e=this._u(),n=this.Mo/this.q_,i=this.U_+e,s=new A3(i-n+1,i);this.Nu(new P2(s))}lu(){const e=R2(this.q_,this.Fu(),this.Wu());this.q_!==e&&(this.q_=e,this.E_=!0)}Wu(){return this.Ps.maxBarSpacing>0?this.Ps.maxBarSpacing:.5*this.Mo}Fu(){return this.Ps.fixLeftEdge&&this.Ps.fixRightEdge&&this.D_.length!==0?this.Mo/this.D_.length:this.Ps.minBarSpacing}ou(){const e=this.Hu();e!==null&&this.U_<e&&(this.U_=e,this.E_=!0);const n=this.Uu();this.U_>n&&(this.U_=n,this.E_=!0)}Hu(){const e=this.ru(),n=this.R_;return e===null||n===null?null:e-n-1+(this.Ps.fixLeftEdge?this.Mo/this.q_:Math.min(2,this.D_.length))}Uu(){return this.Ps.fixRightEdge?0:this.Mo/this.q_-Math.min(2,this.D_.length)}Pu(){this.O_={mu:this.mu(),gu:this.gu()}}yu(){this.O_=null}bu(e){let n=this.B_.get(e.weight);return n===void 0&&(n=new GYe((i=>this.$u(i)),this.o_),this.B_.set(e.weight,n)),n.__(e)}$u(e){return this.o_.formatTickmark(e,this.bl)}Nu(e){const n=this.I_;this.I_=e,DK(n.y_(),this.I_.y_())||this.A_.p(),DK(n.k_(),this.I_.k_())||this.z_.p(),this.Ou()}Ou(){this.N_=null}Z_(){this.Ou(),this.B_.clear()}j_(){this.o_.updateFormatter(this.bl)}G_(){if(!this.Ps.fixLeftEdge)return;const e=this.ru();if(e===null)return;const n=this.Pe();if(n===null)return;const i=n.Uh()-e;if(i<0){const s=this.U_-i-1;this.fn(s)}this.lu()}J_(){this.ou(),this.lu()}fu(e){return!this.Ps.ignoreWhitespaceIndices||this.F_.get(e)||!1}pu(e){const n=(function*(s){const r=Math.round(s),o=r<s;let a=1;for(;;)o?(yield r+a,yield r-a):(yield r-a,yield r+a),a++})(e),i=this.hu();for(;i;){const s=n.next().value;if(this.F_.get(s))return s;if(s<0||s>i)break}return e}Y_(e){if(e.rightOffsetPixels!==void 0){const n=e.rightOffsetPixels/(e.barSpacing||this.q_);this.ts.fn(n)}}}var OK,MK,LK,y8,$K;(function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"})(OK||(OK={}));class QYe{constructor(e,n,i){this.qu=[],this.Yu=[],this.Mo=0,this.ju=null,this.Ku=new rr,this.Xu=new rr,this.Zu=null,this.Gu=e,this.Ps=n,this.o_=i,this.Sl=new QKe(this.Ps.layout.colorParsers),this.Ju=new ZKe(this),this.uh=new ZYe(this,n.timeScale,this.Ps.localization,i),this.Ct=new cYe(this,n.crosshair),this.Qu=new UYe(n.crosshair),n.addDefaultPane&&(this.tc(0),this.qu[0].Io(2)),this.sc=this.nc(0),this.ec=this.nc(1)}Ih(){this.rc(yo.gn())}ar(){this.rc(yo.wn())}Zh(){this.rc(new yo(1))}Eh(e){const n=this.hc(e);this.rc(n)}ac(){return this.ju}lc(e){var i,s,r,o;
7472if(((i=this.ju)==null?void 0:i.n_)===(e==null?void 0:e.n_)&&((r=(s=this.ju)==null?void 0:s.e_)==null?void 0:r.Kn)===((o=e==null?void 0:e.e_)==null?void 0:o.Kn))return;const n=this.ju;this.ju=e,n!==null&&this.Eh(n.n_),e!==null&&e.n_!==(n==null?void 0:n.n_)&&this.Eh(e.n_)}N(){return this.Ps}hr(e){jc(this.Ps,e),this.qu.forEach((n=>n.Ro(e))),e.timeScale!==void 0&&this.uh.hr(e.timeScale),e.localization!==void 0&&this.uh.X_(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Ku.p(),this.sc=this.nc(0),this.ec=this.nc(1),this.Ih()}oc(e,n,i=0){const s=this.qu[i];if(s===void 0)return;if(e==="left")return jc(this.Ps,{leftPriceScale:n}),s.Ro({leftPriceScale:n}),this.Ku.p(),void this.Ih();if(e==="right")return jc(this.Ps,{rightPriceScale:n}),s.Ro({rightPriceScale:n}),this.Ku.p(),void this.Ih();const r=this._c(e,i);r!==null&&(r.Ft.hr(n),this.Ku.p())}_c(e,n){const i=this.qu[n];if(i===void 0)return null;const s=i.Do(e);return s!==null?{Us:i,Ft:s}:null}Et(){return this.uh}$s(){return this.qu}uc(){return this.Ct}cc(){return this.Xu}dc(e,n){e.Al(n),this.vu()}Eo(e){this.Mo=e,this.uh.Eo(this.Mo),this.qu.forEach((n=>n.Eo(e))),this.vu()}fc(e){this.qu.length!==1&&(vo(e>=0&&e<this.qu.length,"Invalid pane index"),this.qu.splice(e,1),this.Ih())}vc(e,n){if(this.qu.length<2)return;vo(e>=0&&e<this.qu.length,"Invalid pane index");const i=this.qu[e],s=this.qu.reduce(((h,p)=>h+p.Bo()),0),r=this.qu.reduce(((h,p)=>h+p.$t()),0),o=r-30*(this.qu.length-1);n=Math.min(o,Math.max(30,n));const a=s/r,c=i.$t();i.Io(n*a);let l=n-c,d=this.qu.length-1;for(const h of this.qu)if(h!==i){const p=Math.min(o,Math.max(30,h.$t()-l/d));l-=h.$t()-p,d-=1;
7472const g=p*a;h.Io(g)}this.Ih()}mc(e,n){vo(e>=0&&e<this.qu.length&&n>=0&&n<this.qu.length,"Invalid pane index");const i=this.qu[e],s=this.qu[n];this.qu[e]=s,this.qu[n]=i,this.Ih()}wc(e,n){if(vo(e>=0&&e<this.qu.length&&n>=0&&n<this.qu.length,"Invalid pane index"),e===n)return;const[i]=this.qu.splice(e,1);this.qu.splice(n,0,i),this.Ih()}Uo(e,n,i){e.Uo(n,i)}$o(e,n,i){e.$o(n,i),this.Ah(),this.rc(this.gc(e,2))}qo(e,n){e.qo(n),this.rc(this.gc(e,2))}Yo(e,n,i){n.Tl()||e.Yo(n,i)}jo(e,n,i){n.Tl()||(e.jo(n,i),this.Ah(),this.rc(this.gc(e,2)))}Ko(e,n){n.Tl()||(e.Ko(n),this.rc(this.gc(e,2)))}Zo(e,n){e.Zo(n),this.rc(this.gc(e,2))}Mc(e){this.uh.no(e)}bc(e,n){const i=this.Et();if(i.Ki()||n===0)return;const s=i.Qi();e=Math.max(1,Math.min(e,s)),i.Cu(e,n),this.vu()}Sc(e){this.xc(0),this.Cc(e),this.Pc()}yc(e){this.uh.eo(e),this.vu()}kc(){this.uh.ro(),this.ar()}xc(e){this.uh.ho(e)}Cc(e){this.uh.ao(e),this.vu()}Pc(){this.uh.lo(),this.ar()}js(){return this.Yu}Tc(e,n,i,s,r){this.Ct.Vs(e,n);let o=NaN,a=this.uh.cu(e,!0);const c=this.uh.Pe();c!==null&&(a=Math.min(Math.max(c.Uh(),a),c.bi()));const l=s.ks(),d=l.zt();if(d!==null&&(o=l.Ts(n,d)),o=this.Qu.ga(o,a,s),this.Ct.As(a,o,s),this.Zh(),!r){const h=Noe(s,e,n);this.lc(h&&{n_:h.n_,e_:h.e_,h_:h.h_||null}),this.Xu.p(this.Ct.It(),{x:e,y:n},i)}}Rc(e,n,i){const s=i.ks(),r=s.zt(),o=s.Nt(e,gt(r)),a=this.uh.Q_(n,!0),c=this.uh.qt(gt(a));this.Tc(c,o,null,i,!0)}Dc(e){this.uc().Ls(),this.Zh(),e||this.Xu.p(null,null,null)}Ah(){const e=this.Ct.Us();if(e!==null){const n=this.Ct.Is(),i=this.Ct.Es();this.Tc(n,i,null,e)}this.Ct.Ns()}Vc(e,n,i){const s=this.uh.Rs(0);n!==void 0&&i!==void 0&&this.uh.yt(n,i);const r=this.uh.Rs(0),o=this.uh._u(),a=this.uh.Pe();if(a!==null&&s!==null&&r!==null){const c=a.Te(o),l=this.o_.key(s)>this.o_.key(r),d=e!==null&&e>o&&!l,h=this.uh.N().allowShiftVisibleRangeOnWhitespaceReplacement,p=c&&(i!==void 0||h)&&this.uh.N().shiftVisibleRangeOnNewBar;if(d&&!p){const g=e-o;this.uh.fn(this.uh.gu()-g)}}this.uh.xu(e)}Lh(e){e!==null&&e.Jo()}Hn(e){if((function(i){return i instanceof IK})(e))return e;const n=this.qu.find((i=>i.Dt().includes(e)));return n===void 0?null:n}vu(){this.qu.forEach((e=>e.Jo())),this.Ah()}m(){this.qu.forEach((e=>e.m())),this.qu.length=0,this.Ps.localization.priceFormatter=void 0,this.Ps.localization.percentageFormatter=void 0,this.Ps.localization.timeFormatter=void 0}Bc(){return this.Ju}Yn(){return this.Ju.N()}Vo(){return this.Ku}Ic(e,n){const i=this.tc(n);this.Ec(e,i),this.Yu.push(e),this.Yu.length===1?this.Ih():this.ar()}Ac(e){const n=this.Hn(e),i=this.Yu.indexOf(e);vo(i!==-1,"Series not found");const s=gt(n);this.Yu.splice(i,1),s.Ql(e),e.m&&e.m(),this.uh.K_(),this.zc(s)}Bh(e,n){const i=gt(this.Hn(e));i.Ql(e,!0),i.Gl(e,n,!0)}Au(){const e=yo.wn();e.rn(),this.rc(e)}Lc(e){const n=yo.wn();n.ln(e),this.rc(n)}cn(){const e=yo.wn();e.cn(),this.rc(e)}dn(e){const n=yo.wn();n.dn(e),this.rc(n)}fn(e){const n=yo.wn();n.fn(e),this.rc(n)}_n(e){const n=yo.wn();n._n(e),this.rc(n)}hn(){const e=yo.wn();e.hn(),this.rc(e)}Oc(){return this.Ps.rightPriceScale.visible?"right":"left"}Nc(e,n){if(vo(n>=0,"Index should be greater or equal to 0"),n===this.Fc(e))return;const i=gt(this.Hn(e));i.Ql(e);const s=this.tc(n);this.Ec(e,s),i.Ma().length===0&&this.zc(i),this.Ih()}Wc(){return this.ec}$(){return this.sc}Ut(e){const n=this.ec,i=this.sc;if(n===i)return n;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Zu===null||this.Zu.mr!==i||this.Zu.wr!==n)this.Zu={mr:i,wr:n,Hc:new Map};else{const r=this.Zu.Hc.get(e);if(r!==void 0)return r}const s=this.Sl.tt(i,n,e/100);return this.Zu.Hc.set(e,s),s}Uc(e){return this.qu.indexOf(e)}Xi(){return this.Sl}$c(){return this.qc()}qc(e){const n=new IK(this.uh,this);this.qu.push(n);const i=e??this.qu.length-1,s=yo.gn();return s.Qs(i,{tn:0,sn:!0}),this.rc(s),n}tc(e){return vo(e>=0,"Index should be greater or equal to 0"),(e=Math.min(this.qu.length,e))<this.qu.length?this.qu[e]:this.qc(e)}Fc(e){return this.qu.findIndex((n=>n.Oo().includes(e)))}gc(e,n){const i=new yo(n);if(e!==null){const s=this.qu.indexOf(e);i.Qs(s,{tn:n})}return i}hc(e,n){return n===void 0&&(n=2),this.gc(this.Hn(e),n)}rc(e){this.Gu&&this.Gu(e),this.qu.forEach((n=>n.i_().lr().yt()))}Ec(e,n){const i=e.N().priceScaleId,s=i!==void 0?i:this.Oc();n.Gl(e,s),jS(s)||e.hr(e.N())}nc(e){const n=this.Ps.layout;return n.background.type==="gradient"?e===0?n.background.topColor:n.background.bottomColor:n.background.color}zc(e){!e.Lo()&&e.Ma().length===0&&this.qu.length>1&&this.qu.splice(this.Uc(e),1)}}function Roe(t){if(t>=1)return 0;let e=0;for(;e<8;e++){const n=Math.round(t);if(Math.abs(n-t)<1e-8)return e;t*=10}return e}function qI(t){return!Cb(t)&&!b4(t)}function Poe(t){return Cb(t)}(function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataU
7472pdate=2]="OnDataUpdate"})(MK||(MK={})),(function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"})(LK||(LK={})),(function(t){t.Solid="solid",t.VerticalGradient="gradient"})(y8||(y8={})),(function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"})($K||($K={}));const UK=t=>t.getUTCFullYear();function XYe(t,e,n){return e.replace(/yyyy/g,(i=>Xh(UK(i),4))(t)).replace(/yy/g,(i=>Xh(UK(i)%100,2))(t)).replace(/MMMM/g,((i,s)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(s,{month:"long"}))(t,n)).replace(/MMM/g,((i,s)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(s,{month:"short"}))(t,n)).replace(/MM/g,(i=>Xh((s=>s.getUTCMonth()+1)(i),2))(t)).replace(/dd/g,(i=>Xh((s=>s.getUTCDate())(i),2))(t))}class Ioe{constructor(e="yyyy-MM-dd",n="default"){this.Yc=e,this.jc=n}__(e){return XYe(e,this.Yc,this.jc)}}class JYe{constructor(e){this.Kc=e||"%h:%m:%s"}__(e){return this.Kc.replace("%h",Xh(e.getUTCHours(),2)).replace("%m",Xh(e.getUTCMinutes(),2)).replace("%s",Xh(e.getUTCSeconds(),2))}}const eZe={Xc:"yyyy-MM-dd",Zc:"%h:%m:%s",Gc:" ",Jc:"default"};class tZe{constructor(e={}){const n={...eZe,...e};this.Qc=new Ioe(n.Xc,n.Jc),this.td=new JYe(n.Zc),this.sd=n.Gc}__(e){return`${this.Qc.__(e)}${this.sd}${this.td.__(e)}`}}function Fx(t){return 60*t*60*1e3}function aN(t){return 60*t*1e3}const jx=[{nd:(BK=1,1e3*BK),ed:10},{nd:aN(1),ed:20},{nd:aN(5),ed:21},{nd:aN(30),ed:22},{nd:Fx(1),ed:30},{nd:Fx(3),ed:31},{nd:Fx(6),ed:32},{nd:Fx(12),ed:33}];var BK;function FK(t,e){if(t.getUTCFullYear()!==e.getUTCFullYear())return 70;if(t.getUTCMonth()!==e.getUTCMonth())return 60;if(t.getUTCDate()!==e.getUTCDate())return 50;for(let n=jx.length-1;n>=0;--n)if(Math.floor(e.getTime()/jx[n].nd)!==Math.floor(t.getTime()/jx[n].nd))return jx[n].ed;return 0}function cN(t){let e=t;if(b4(t)&&(e=gL(t)),!qI(e))throw new Error("time must be of type BusinessDay");const n=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{rd:Math.round(n.getTime()/1e3),hd:e}}function jK(t){if(!Poe(t))throw new Error("time must be of type isUTCTimestamp");return{rd:t}}function gL(t){const e=new Date(t);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${t}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function VK(t){b4(t.time)&&(t.time=gL(t.time))}class WK{options(){return this.Ps}setOptions(e){this.Ps=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(n){n.forEach(VK)})(e):VK(e)}createConverterToInternalObj(e){return gt((function(n){return n.length===0?null:qI(n[0].time)||b4(n[0].time)?cN:jK})(e))}key(e){return typeof e=="object"&&"rd"in e?e.rd:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const n=e;return n.hd===void 0?new Date(1e3*n.rd).getTime():new Date(Date.UTC(n.hd.year,n.hd.month-1,n.hd.day)).getTime()}convertHorzItemToInternal(e){return Poe(n=e)?jK(n):qI(n)?cN(n):cN(gL(n));var n}updateFormatter(e){if(!this.Ps)return;const n=e.dateFormat;this.Ps.timeScale.timeVisible?this.ad=new tZe({Xc:n,Zc:this.Ps.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",Gc:" ",Jc:e.locale}):this.ad=new Ioe(n,e.locale)}formatHorzItem(e){const n=e;return this.ad.__(new Date(1e3*n.rd))}formatTickmark(e,n){const i=(function(r,o,a){switch(r){case 0:case 10:return o?a?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return o?3:2;case 50:return 2;case 60:return 1;case 70:return 0}})(e.weight,this.Ps.timeScale.timeVisible,this.Ps.timeScale.secondsVisible),s=this.Ps.timeScale;if(s.tickMarkFormatter!==void 0){const r=s.tickMarkFormatter(e.originalTime,i,n.locale);if(r!==null)return r}return(function(r,o,a){const c={};switch(o){case 0:c.year="numeric";break;case 1:c.month="short";break;case 2:c.day="numeric";break;case 3:c.hour12=!1,c.hour="2-digit",c.minute="2-digit";break;case 4:c.hour12=!1,c.hour="2-digit",c.minute="2-digit",c.second="2-digit"}const l=r.hd===void 0?new Date(1e3*r.rd):new Date(Date.UTC(r.hd.year,r.hd.month-1,r.hd.day));return new Date(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()).toLocaleStr
7472ing(a,c)})(e.time,i,n.locale)}maxTickMarkWeight(e){let n=e.reduce(YYe,e[0]).weight;return n>30&&n<50&&(n=30),n}fillWeightsForPoints(e,n){(function(i,s=0){if(i.length===0)return;let r=s===0?null:i[s-1].time.rd,o=r!==null?new Date(1e3*r):null,a=0;for(let c=s;c<i.length;++c){const l=i[c],d=new Date(1e3*l.time.rd);o!==null&&(l.timeWeight=FK(d,o)),a+=l.time.rd-(r||l.time.rd),r=l.time.rd,o=d}if(s===0&&i.length>1){const c=Math.ceil(a/(i.length-1)),l=new Date(1e3*(i[0].time.rd-c));i[0].timeWeight=FK(new Date(1e3*i[0].time.rd),l)}})(e,n)}static ld(e){return jc({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const Eb=typeof window<"u";function qK(){return!!Eb&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function lN(){return!!Eb&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function zI(t){return t+t%2}function nZe(t){Eb&&window.chrome!==void 0&&t.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class qS{constructor(e,n,i){this.od=0,this._d=null,this.ud={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.dd=0,this.fd=null,this.pd={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY},this.vd=null,this.md=!1,this.wd=null,this.gd=null,this.Md=!1,this.bd=!1,this.Sd=!1,this.xd=null,this.Cd=null,this.Pd=null,this.yd=null,this.kd=null,this.Td=null,this.Rd=null,this.Dd=0,this.Vd=!1,this.Bd=!1,this.Id=!1,this.Ed=0,this.Ad=null,this.zd=!lN(),this.Ld=s=>{this.Od(s)},this.Nd=s=>{if(this.Fd(s)){const r=this.Wd(s);if(++this.dd,this.fd&&this.dd>1){const{Hd:o}=this.Ud(ud(s),this.pd);o<30&&!this.Sd&&this.$d(r,this.Yd.qd),this.jd()}}else{const r=this.Wd(s);if(++this.od,this._d&&this.od>1){const{Hd:o}=this.Ud(ud(s),this.ud);o<5&&!this.bd&&this.Kd(r,this.Yd.Xd),this.Zd()}}},this.Gd=e,this.Yd=n,this.Ps=i,this.Jd()}m(){this.xd!==null&&(this.xd(),this.xd=null),this.Cd!==null&&(this.Cd(),this.Cd=null),this.yd!==null&&(this.yd(),this.yd=null),this.kd!==null&&(this.kd(),this.kd=null),this.Td!==null&&(this.Td(),this.Td=null),this.Pd!==null&&(this.Pd(),this.Pd=null),this.Qd(),this.Zd()}tf(e){this.yd&&this.yd();const n=this.if.bind(this);if(this.yd=()=>{this.Gd.removeEventListener("mousemove",n)},this.Gd.addEventListener("mousemove",n),this.Fd(e))return;const i=this.Wd(e);this.Kd(i,this.Yd.sf),this.zd=!0}Zd(){this._d!==null&&clearTimeout(this._d),this.od=0,this._d=null,this.ud={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}jd(){this.fd!==null&&clearTimeout(this.fd),this.dd=0,this.fd=null,this.pd={_t:Number.NEGATIVE_INFINITY,ut:Number.POSITIVE_INFINITY}}if(e){if(this.Id||this.gd!==null||this.Fd(e))return;const n=this.Wd(e);this.Kd(n,this.Yd.nf),this.zd=!0}ef(e){const n=uN(e.changedTouches,gt(this.Ad));if(n===null||(this.Ed=Vx(e),this.Rd!==null)||this.Bd)return;this.Vd=!0;const i=this.Ud(ud(n),gt(this.gd)),{rf:s,hf:r,Hd:o}=i;if(this.Md||!(o<5)){if(!this.Md){const a=.5*s,c=r>=a&&!this.Ps.af(),l=a>r&&!this.Ps.lf();c||l||(this.Bd=!0),this.Md=!0,this.Sd=!0,this.Qd(),this.jd()}if(!this.Bd){const a=this.Wd(e,n);this.$d(a,this.Yd._f),By(e)}}}uf(e){if(e.button!==0)return;const n=this.Ud(ud(e),gt(this.wd)),{Hd:i}=n;if(i>=5&&(this.bd=!0,this.Zd()),this.bd){const s=this.Wd(e);this.Kd(s,this.Yd.cf)}}Ud(e,n){const i=Math.abs(n._t-e._t),s=Math.abs(n.ut-e.ut);return{rf:i,hf:s,Hd:i+s}}df(e){let n=uN(e.changedTouches,gt(this.Ad));if(n===null&&e.touches.length===0&&(n=e.changedTouches[0]),n===null)return;this.Ad=null,this.Ed=Vx(e),this.Qd(),this.gd=null,this.Td&&(this.Td(),this.Td=null);const i=this.Wd(e,n);if(this.$d(i,this.Yd.ff),++this.dd,this.fd&&this.dd>1){const{Hd:s}=this.Ud(ud(n),this.pd);s<30&&!this.Sd&&this.$d(i,this.Yd.qd),this.jd()}else this.Sd||(this.$d(i,this.Yd.pf),this.Yd.pf&&By(e));this.dd===0&&By(e),e.touches.length===0&&this.md&&(this.md=!1,By(e))}Od(e){if(e.button!==0)return;const n=this.Wd(e);if(this.wd=null,this.Id=!1,this.kd&&(this.kd(),this.kd=null),qK()&&this.Gd.ownerDocument.documentElement.removeEventListener("mouseleave",this.Ld),!this.Fd(e))if(this.Kd(n,this.Yd.vf),++this.od,this._d&&this.od>1){const{Hd:i}=this.Ud(ud(e),this.ud);i<5&&!this.bd&&this.Kd(n,this.Yd.Xd),this.Zd()}else this.bd||this.Kd(n,this.Yd.mf)}Qd(){this.vd!==null&&(clearTimeout(this.vd),this.vd=null)}wf(e){if(this.Ad!==null)return;const n=e.changedTouches[0];this.Ad=n.identifier,this.Ed=Vx(e);const i=this.Gd.ownerDocument.documentElement;this.Sd=!1,this.Md=!1,this.Bd=!1,this.gd=ud(n),this.Td&&(this.Td(),this.Td=null);{const r=this.ef.bind(this),o=this.df.bind(this);this.Td=()=>{i.removeEventListener("touchmove",r),i.removeEventListener("touchend",o)},i.addEventListener("touchmove",r,{passive:!1}),i.addEventListener("touchend",o,{passive:!1}),this.Qd(),this.vd=setTimeout(this.gf.bind(this,e),240)}const s=this.Wd(e,n);this.$d(s,this.Yd.Mf),this.fd||(this.dd=0,this.fd=setTimeout(this.jd.bind(this),500),this.pd=ud(n))}bf(e){if(e.button!==0)return;const n=this.Gd.ownerDocument.documentElement;qK()&&n.addEventListener("mouseleave",this.Ld),this.bd=!1,this.wd=ud(e),this.kd&&(this.kd(),this.kd=null);{const s=this.uf.bind(this),r=this.Od.bind(this);this.kd=()=>{n.removeEventListener("mousemove",s),n.removeEventListener("mouseup",r)},n.addEventListener("mousemove",s),n.addEventListener("mouseup",r)}if(this.Id=!0,this.Fd(e))return;const i=this.Wd(e);this.Kd(i,this.Yd.Sf),this._d||(this.od=0,this._d=setTimeout(this.Zd.bind(this),500),this.ud=ud(e))}Jd(){this.Gd.addEventListener("mouseenter",this.tf.bind(this)),this.Gd.addEventListener("touchcancel",this.Qd.bind(this));{const e=this.Gd.ownerDocument,n=i=>
7472{this.Yd.xf&&(i.composed&&this.Gd.contains(i.composedPath()[0])||i.target&&this.Gd.contains(i.target)||this.Yd.xf())};this.Cd=()=>{e.removeEventListener("touchstart",n)},this.xd=()=>{e.removeEventListener("mousedown",n)},e.addEventListener("mousedown",n),e.addEventListener("touchstart",n,{passive:!0})}lN()&&(this.Pd=()=>{this.Gd.removeEventListener("dblclick",this.Nd)},this.Gd.addEventListener("dblclick",this.Nd)),this.Gd.addEventListener("mouseleave",this.Cf.bind(this)),this.Gd.addEventListener("touchstart",this.wf.bind(this),{passive:!0}),nZe(this.Gd),this.Gd.addEventListener("mousedown",this.bf.bind(this)),this.Pf(),this.Gd.addEventListener("touchmove",(()=>{}),{passive:!1})}Pf(){this.Yd.yf===void 0&&this.Yd.kf===void 0&&this.Yd.Tf===void 0||(this.Gd.addEventListener("touchstart",(e=>this.Rf(e.touches)),{passive:!0}),this.Gd.addEventListener("touchmove",(e=>{if(e.touches.length===2&&this.Rd!==null&&this.Yd.kf!==void 0){const n=zK(e.touches[0],e.touches[1])/this.Dd;this.Yd.kf(this.Rd,n),By(e)}}),{passive:!1}),this.Gd.addEventListener("touchend",(e=>{this.Rf(e.touches)})))}Rf(e){e.length===1&&(this.Vd=!1),e.length!==2||this.Vd||this.md?this.Df():this.Vf(e)}Vf(e){const n=this.Gd.getBoundingClientRect()||{left:0,top:0};this.Rd={_t:(e[0].clientX-n.left+(e[1].clientX-n.left))/2,ut:(e[0].clientY-n.top+(e[1].clientY-n.top))/2},this.Dd=zK(e[0],e[1]),this.Yd.yf!==void 0&&this.Yd.yf(),this.Qd()}Df(){this.Rd!==null&&(this.Rd=null,this.Yd.Tf!==void 0&&this.Yd.Tf())}Cf(e){if(this.yd&&this.yd(),this.Fd(e)||!this.zd)return;const n=this.Wd(e);this.Kd(n,this.Yd.Bf),this.zd=!lN()}gf(e){const n=uN(e.touches,gt(this.Ad));if(n===null)return;const i=this.Wd(e,n);this.$d(i,this.Yd.If),this.Sd=!0,this.md=!0}Fd(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:Vx(e)<this.Ed+500}$d(e,n){n&&n.call(this.Yd,e)}Kd(e,n){n&&n.call(this.Yd,e)}Wd(e,n){const i=n||e,s=this.Gd.getBoundingClientRect()||{left:0,top:0};return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,localX:i.clientX-s.left,localY:i.clientY-s.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Ef:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Af:e.type,zf:i.target,a_:e.view,Lf:()=>{e.type!=="touchstart"&&By(e)}}}}function zK(t,e){const n=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.sqrt(n*n+i*i)}function By(t){t.cancelable&&t.preventDefault()}function ud(t){return{_t:t.pageX,ut:t.pageY}}function Vx(t){return t.timeStamp||performance.now()}function uN(t,e){for(let n=0;n<t.length;++n)if(t[n].identifier===e)return t[n];return null}class iZe{constructor(e,n,i){this.Of=null,this.Nf=null,this.Ff=!0,this.Wf=null,this.Hf=e,this.Uf=e.$f()[n],this.qf=e.$f()[i],this.Yf=document.createElement("tr"),this.Yf.style.height="1px",this.jf=document.createElement("td"),this.jf.style.position="relative",this.jf.style.padding="0",this.jf.style.margin="0",this.jf.setAttribute("colspan","3"),this.Kf(),this.Yf.appendChild(this.jf),this.Ff=this.Hf.N().layout.panes.enableResize,this.Ff?this.Xf():(this.Of=null,this.Nf=null)}m(){this.Nf!==null&&this.Nf.m()}Zf(){return this.Yf}Gf(){return rs({width:this.Uf.Gf().width,height:1})}Jf(){return rs({width:this.Uf.Jf().width,height:1*window.devicePixelRatio})}Qf(e,n,i){const s=this.Jf();e.fillStyle=this.Hf.N().layout.panes.separatorColor,e.fillRect(n,i,s.width,s.height)}yt(){this.Kf(),this.Hf.N().layout.panes.enableResize!==this.Ff&&(this.Ff=this.Hf.N().layout.panes.enableResize,this.Ff?this.Xf():(this.Of!==null&&(this.jf.removeChild(this.Of.tp),this.jf.removeChild(this.Of.ip),this.Of=null),this.Nf!==null&&(this.Nf.m(),this.Nf=null)))}Xf(){const e=document.createElement("div"),n=e.style;n.position="fixed",n.display="none",n.zIndex="49",n.top="0",n.left="0",n.width="100%",n.height="100%",n.cursor="row-resize",this.jf.appendChild(e);const i=document.createElement("div"),s=i.style;s.position="absolute",s.zIndex="50",s.top="-4px",s.height="9px",s.width="100%",s.backgroundColor="",s.cursor="row-resize",this.jf.appendChild(i);const r={sf:this.sp.bind(this),Bf:this.np.bind(this),Sf:this.ep.bind(this),Mf:this.ep.bind(this),cf:this.rp.bind(this),_f:this.rp.bind(this),vf:this.hp.bind(this),ff:this.hp.bind(this)};this.Nf=new qS(i,r,{af:()=>!1,lf:()=>!0}),this.Of={ip:i,tp:e}}Kf(){this.jf.style.background=this.Hf.N().layout.panes.separatorColor}sp(e){this.Of!==null&&(this.Of.ip.style.backgroundColor=this.Hf.N().layout.panes.separatorHoverColor)}np(e){this.Of!==null&&this.Wf===null&&(this.Of.ip.style.backgroundColor="")}ep(e){if(this.Of===null)return;const n=this.Uf.ap().Bo()+this.qf.ap().Bo(),i=n/(this.Uf.Gf().height+this.qf.Gf().height),s=30*i;n<=2*s||(this.Wf={lp:e.pageY,op:this.Uf.ap().Bo(),_p:n-s,up:n,cp:i,dp:s},this.Of.tp.style.display="block")}rp(e){const n=this.Wf;if(n===null)return;const i=(e.pageY-n.lp)*n.cp,s=R2(n.op+i,n.dp,n._p);this.Uf.ap().Io(s),this.qf.ap().Io(n.up-s),this.Hf.Qt().Ih()}hp(e){this.Wf!==null&&this.Of!==null&&(this.Wf=null,this.Of.tp.style.display="none")}}function dN(t,e){return t.fp-e.fp}function hN(t,e,n){const i=(t.fp-e.fp)/(t.wt-e.wt);return Math.sign(i)*Math.min(Math.abs(i),n)}class sZe{constructor(e,n,i,s){this.pp=null,this.vp=null,this.mp=null,this.wp=null,this.gp=null,this.Mp=0,this.bp=0,this.Sp=e,this.xp=n,this.Cp=i,this.Mn=s}Pp(e,n){if(this.pp!==null){if(this.pp.wt===n)return void(this.pp.fp=e);if(Math.abs(this.pp.fp-e)<this.Mn)return}this.wp=this.mp,this.mp=this.vp,this.vp=this.pp,this.pp={wt:n,fp:e}}le(e,n){if(this.pp===null||this.vp===null||n-this.pp.wt>50)return;let i=0;const s=hN(this.pp,this.vp,this.xp),r=dN(this.pp,this.vp),o=[s],a=[r];if(i+=r,this.mp!==null){const l=hN(this.vp,this.mp,this.xp);if(Math.sign(l)===Math.sign(s)){const d=dN(this.vp,this.mp);if(o.push(l),a.push(d),i+=d,this.wp!==null){const h=hN(this.mp,this.wp,this.xp);if(Math.sign(h)===Math.sign(s)){const p=dN(this.mp,this.wp);o.push(h),a.push(p),i+=p}}}}let c=0;for(let l=0;l<o.length;++l)c+=a[l]/i*o[l];Math.abs(c)<this.Sp||(this.gp={fp:e,wt:n},this.bp=c,this.Mp=(function(l,d){const h=Math.log(d);return Math.log(1*h/-l)/h})(Math.abs(c),this.Cp))}Du(e){const n=gt(this.gp),i=e-n.wt;return n.fp+this.bp*(Math.pow(this.Cp,i)-1)/Math.log(this.Cp)}Ru(e){return this.gp===null||this.yp(e)===this.Mp}yp(e){const n=e-gt(this.gp).wt;return Math.min(n,this.Mp)}}class rZe{constructor(e,n){this.kp=void 0,this.Tp=void 0,this.Rp=void 0,this.ps=!1,this.Dp=e,this.Vp=n,this.Bp()}yt(){this.Bp()}Ip(){this.kp&&this.Dp.removeChild(this.kp),this.Tp&&this.Dp.removeChild(this.Tp),this.kp=void 0,this.Tp=void 0}Ep(){return this.ps!==this.Ap()||this.Rp!==this.zp()}zp(){return this.Vp.Qt().Xi().J(this.Vp.N().layout.textColor)>160?"dark":"light"}Ap(){return this.Vp.N().layout.attributionLogo}Lp(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.pathname:""}Bp(){this.Ep()&&(this.Ip(),this.ps=this.Ap(),this.ps&&(this.Rp=this.zp(),this.Tp=document.createElement("style"),this.Tp.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;
7472left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.kp=document.createElement("a"),this.kp.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.Lp()}`,this.kp.title="Charting by TradingView",this.kp.id="tv-attr-logo",this.kp.target="_blank",this.kp.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.kp.toggleAttribute("data-dark",this.Rp==="dark"),this.Dp.appendChild(this.Tp),this.Dp.appendChild(this.kp)))}}function u1(t,e){const n=gt(t.ownerDocument).createElement("canvas");t.appendChild(n);const i=zKe(n,{options:{allowResizeObserver:!0},transform:(s,r)=>({width:Math.max(s.width,r.width),height:Math.max(s.height,r.height)})});return i.resizeCanvasElement(e),i}function d1(t){var e;t.width=1,t.height=1,(e=t.getContext("2d"))==null||e.clearRect(0,0,1,1)}function HI(t,e,n,i){t.ih&&t.ih(e,n,i)}function _E(t,e,n,i){t.nt(e,n,i)}function GI(t,e,n,i){const s=t(n,i);for(const r of s){const o=r.Tt(i);o!==null&&e(o)}}function fN(t,e){return n=>{var i,s;return(function(r){return r.Ft!==void 0})(n)?(((i=n.Ft())==null?void 0:i.ma())??"")!==e?[]:((s=n.ta)==null?void 0:s.call(n,t))??[]:[]}}function HK(t,e,n,i){if(!t.length)return;let s=0;const r=t[0].$t(i,!0);let o=e===1?n/2-(t[0].Fi()-r/2):t[0].Fi()-r/2-n/2;o=Math.max(0,o);for(let a=1;a<t.length;a++){const c=t[a],l=t[a-1],d=l.$t(i,!1),h=c.Fi(),p=l.Fi();if(e===1?h>p-d:h<p+d){const g=p-d*e;c.Wi(g);const b=g-e*d/2;if((e===1?b<0:b>n)&&o>0){const w=e===1?-1-b:b-n,C=Math.min(w,o);for(let E=s;E<t.length;E++)t[E].Wi(t[E].Fi()+e*C);o-=C}}else s=a,o=e===1?p-d-h:h-(p+d)}}class GK{constructor(e,n,i,s){this.Yi=null,this.Op=null,this.Np=!1,this.Fp=new f8(200),this.Wp=null,this.Hp=0,this.Up=!1,this.$p=()=>{this.Up||this.Pt.qp().Qt().ar()},this.Yp=()=>{this.Up||this.Pt.qp().Qt().ar()},this.Pt=e,this.Ps=n,this.Ml=n.layout,this.Ju=i,this.jp=s==="left",this.Kp=fN("normal",s),this.Xp=fN("top",s),this.Zp=fN("bottom",s),this.jf=document.createElement("div"),this.jf.style.height="100%",this.jf.style.overflow="hidden",this.jf.style.width="25px",this.jf.style.left="0",this.jf.style.position="relative",this.Gp=u1(this.jf,rs({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p);const r=this.Gp.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jp=u1(this.jf,rs({width:16,height:16})),this.Jp.subscribeSuggestedBitmapSizeChanged(this.Yp);const o=this.Jp.canvasElement;o.style.position="absolute",o.style.zIndex="2",o.style.left="0",o.style.top="0";const a={Sf:this.ep.bind(this),Mf:this.ep.bind(this),cf:this.rp.bind(this),_f:this.rp.bind(this),xf:this.Qp.bind(this),vf:this.hp.bind(this),ff:this.hp.bind(this),Xd:this.tv.bind(this),qd:this.tv.bind(this),sf:this.iv.bind(this),Bf:this.np.bind(this)};this.Nf=new qS(this.Jp.canvasElement,a,{af:()=>!this.Ps.handleScroll.vertTouchDrag,lf:()=>!0})}m(){this.Nf.m(),this.Jp.unsubscribeSuggestedBitmapSizeChanged(this.Yp),d1(this.Jp.canvasElement),this.Jp.dispose(),this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),d1(this.Gp.canvasElement),this.Gp.dispose(),this.Yi!==null&&this.Yi.so().u(this),this.Yi=null}Zf(){return this.jf}P(){return this.Ml.fontSize}sv(){const e=this.Ju.N();return this.Wp!==e.k&&(this.Fp.Bn(),this.Wp=e.k),e}nv(){if(this.Yi===null)return 0;let e=0;const n=this.sv(),i=gt(this.Gp.canvasElement.getContext("2d",{colorSpace:this.Pt.qp().N().layout.colorSpace}));i.save();const s=this.Yi.Da();i.font=this.ev(),s.length>0&&(e=Math.max(this.Fp.Vi(i,s[0].Za),this.Fp.Vi(i,s[s.length-1].Za)));const r=this.rv();for(let l=r.length;l--;){const d=this.Fp.Vi(i,r[l].ri());d>e&&(e=d)}const o=this.Yi.zt();if(o!==null&&this.Op!==null&&(a=this.Ps.crosshair).mode!==2&&a.horzLine.visible&&a.horzLine.labelVisible){const l=this.Yi.Ts(1,o),d=this.Yi.Ts(this.Op.height-2,o);e=Math.max(e,this.Fp.Vi(i,this.Yi.Zi(Math.floor(Math.min(l,d))+.11111111111111,o)),this.Fp.Vi(i,this.Yi.Zi(Math.ceil(Math.max(l,d))-.11111111111111,o)))}var a;
7472i.restore();const c=e||34;return zI(Math.ceil(n.S+n.C+n.B+n.I+5+c))}hv(e){this.Op!==null&&wg(this.Op,e)||(this.Op=e,this.Up=!0,this.Gp.resizeCanvasElement(e),this.Jp.resizeCanvasElement(e),this.Up=!1,this.jf.style.width=`${e.width}px`,this.jf.style.height=`${e.height}px`)}av(){return gt(this.Op).width}_s(e){this.Yi!==e&&(this.Yi!==null&&this.Yi.so().u(this),this.Yi=e,e.so().i(this._l.bind(this),this))}Ft(){return this.Yi}Bn(){const e=this.Pt.ap();this.Pt.qp().Qt().Zo(e,gt(this.Ft()))}lv(e){if(this.Op===null)return;const n={colorSpace:this.Pt.qp().N().layout.colorSpace};if(e!==1){this.ov(),this.Gp.applySuggestedBitmapSize();const s=l1(this.Gp,n);s!==null&&(s.useBitmapCoordinateSpace((r=>{this._v(r),this.uv(r)})),this.Pt.cv(s,this.Zp),this.dv(s),this.Pt.cv(s,this.Kp),this.fv(s))}this.Jp.applySuggestedBitmapSize();const i=l1(this.Jp,n);i!==null&&(i.useBitmapCoordinateSpace((({context:s,bitmapSize:r})=>{s.clearRect(0,0,r.width,r.height)})),this.pv(i),this.Pt.cv(i,this.Xp))}Jf(){return this.Gp.bitmapSize}Qf(e,n,i,s){const r=this.Jf();if(r.width>0&&r.height>0&&(e.drawImage(this.Gp.canvasElement,n,i),s)){const o=this.Jp.canvasElement;e.drawImage(o,n,i)}}yt(){var e;(e=this.Yi)==null||e.Da()}ep(e){if(this.Yi===null||this.Yi.Ki()||!this.Ps.handleScale.axisPressedMouseMove.price)return;const n=this.Pt.qp().Qt(),i=this.Pt.ap();this.Np=!0,n.Uo(i,this.Yi,e.localY)}rp(e){if(this.Yi===null||!this.Ps.handleScale.axisPressedMouseMove.price)return;const n=this.Pt.qp().Qt(),i=this.Pt.ap(),s=this.Yi;n.$o(i,s,e.localY)}Qp(){if(this.Yi===null||!this.Ps.handleScale.axisPressedMouseMove.price)return;const e=this.Pt.qp().Qt(),n=this.Pt.ap(),i=this.Yi;this.Np&&(this.Np=!1,e.qo(n,i))}hp(e){if(this.Yi===null||!this.Ps.handleScale.axisPressedMouseMove.price)return;const n=this.Pt.qp().Qt(),i=this.Pt.ap();this.Np=!1,n.qo(i,this.Yi)}tv(e){this.Ps.handleScale.axisDoubleClickReset.price&&this.Bn()}iv(e){this.Yi!==null&&(!this.Pt.qp().Qt().N().handleScale.axisPressedMouseMove.price||this.Yi.Le()||this.Yi.Dl()||this.vv(1))}np(e){this.vv(0)}rv(){const e=[],n=this.Yi===null?void 0:this.Yi;return(i=>{for(let s=0;s<i.length;++s){const r=i[s].Ws(this.Pt.ap(),n);for(let o=0;o<r.length;o++)e.push(r[o])}})(this.Pt.ap().Dt()),e}_v({context:e,bitmapSize:n}){const{width:i,height:s}=n,r=this.Pt.ap().Qt(),o=r.$(),a=r.Wc();o===a?BS(e,0,0,i,s,o):boe(e,0,0,i,s,o,a)}uv({context:e,bitmapSize:n,horizontalPixelRatio:i}){if(this.Op===null||this.Yi===null||!this.Yi.N().borderVisible)return;e.fillStyle=this.Yi.N().borderColor;const s=Math.max(1,Math.floor(this.sv().S*i));let r;r=this.jp?n.width-s:0,e.fillRect(r,0,s,n.height)}dv(e){if(this.Op===null||this.Yi===null)return;
7472const n=this.Yi.Da(),i=this.Yi.N(),s=this.sv(),r=this.jp?this.Op.width-s.C:0;i.borderVisible&&i.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:a,verticalPixelRatio:c})=>{o.fillStyle=i.borderColor;const l=Math.max(1,Math.floor(c)),d=Math.floor(.5*c),h=Math.round(s.C*a);o.beginPath();for(const p of n)o.rect(Math.floor(r*a),Math.round(p.Pa*c)-d,h,l);o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{o.font=this.ev(),o.fillStyle=i.textColor??this.Ml.textColor,o.textAlign=this.jp?"right":"left",o.textBaseline="middle";const a=this.jp?Math.round(r-s.B):Math.round(r+s.C+s.B),c=n.map((l=>this.Fp.Di(o,l.Za)));for(let l=n.length;l--;){const d=n[l];o.fillText(d.Za,a,d.Pa+c[l])}}))}ov(){if(this.Op===null||this.Yi===null)return;let e=this.Op.height/2;const n=[],i=this.Yi.Dt().slice(),s=this.Pt.ap(),r=this.sv();this.Yi===s.$n()&&this.Pt.ap().Dt().forEach((c=>{s.Un(c)&&i.push(c)}));const o=this.Yi.Ma()[0],a=this.Yi;i.forEach((c=>{const l=c.Ws(s,a);l.forEach((d=>{d.Wi(null),d.Hi()&&n.push(d)})),o===c&&l.length>0&&(e=l[0].Ii())})),n.forEach((c=>c.Wi(c.Ii()))),this.Yi.N().alignLabels&&this.mv(n,r,e)}mv(e,n,i){if(this.Op===null)return;const s=e.filter((o=>o.Ii()<=i)),r=e.filter((o=>o.Ii()>i));s.sort(((o,a)=>a.Ii()-o.Ii())),s.length&&r.length&&r.push(s[0]),r.sort(((o,a)=>o.Ii()-a.Ii()));for(const o of e){const a=Math.floor(o.$t(n)/2),c=o.Ii();c>-a&&c<a&&o.Wi(a),c>this.Op.height-a&&c<this.Op.height+a&&o.Wi(this.Op.height-a)}HK(s,1,this.Op.height,n),HK(r,-1,this.Op.height,n)}fv(e){if(this.Op===null)return;const n=this.rv(),i=this.sv(),s=this.jp?"right":"left";n.forEach((r=>{r.Ui()&&r.Tt(gt(this.Yi)).nt(e,i,this.Fp,s)}))}pv(e){if(this.Op===null||this.Yi===null)return;const n=this.Pt.qp().Qt(),i=[],s=this.Pt.ap(),r=n.uc().Ws(s,this.Yi);r.length&&i.push(r);const o=this.sv(),a=this.jp?"right":"left";i.forEach((c=>{c.forEach((l=>{l.Tt(gt(this.Yi)).nt(e,o,this.Fp,a)}))}))}vv(e){this.jf.style.cursor=e===1?"ns-resize":"default"}_l(){const e=this.nv();this.Hp<e&&this.Pt.qp().Qt().Ih(),this.Hp=e}ev(){return J5(this.Ml.fontSize,this.Ml.fontFamily)}}function oZe(t,e){var n;return((n=t.Jh)==null?void 0:n.call(t,e))??[]}function KK(t,e){var n;return((n=t.Fs)==null?void 0:n.call(t,e))??[]}function YK(t,e){var n;return((n=t.us)==null?void 0:n.call(t,e))??[]}function aZe(t,e){var n;return((n=t.Xh)==null?void 0:n.call(t,e))??[]}class yL{constructor(e,n){this.Op=rs({width:0,height:0}),this.wv=null,this.gv=null,this.Mv=null,this.bv=null,this.Sv=!1,this.xv=new rr,this.Cv=new rr,this.Pv=0,this.yv=!1,this.kv=null,this.Tv=!1,this.Rv=null,this.Dv=null,this.Up=!1,this.$p=()=>{this.Up||this.Vv===null||this.ts().ar()},this.Yp=()=>{this.Up||this.Vv===null||this.ts().ar()},this.Vp=e,this.Vv=n,this.Vv.t_().i(this.Bv.bind(this),this,!0),this.Iv=document.createElement("td"),this.Iv.style.padding="0",this.Iv.style.position="relative";const i=document.createElement("div");i.style.width="100%",i.style.height="100%",i.style.position="relative",i.style.overflow="hidden",this.Ev=document.createElement("td"),this.Ev.style.padding="0",this.Av=document.createElement("td"),this.Av.style.padding="0",this.Iv.appendChild(i),this.Gp=u1(i,rs({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p);const s=this.Gp.canvasElement;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Jp=u1(i,rs({width:16,height:16})),this.Jp.subscribeSuggestedBitmapSizeChanged(this.Yp);const r=this.Jp.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Yf=document.createElement("tr"),this.Yf.appendChild(this.Ev),this.Yf.appendChild(this.Iv),this.Yf.appendChild(this.Av),this.zv(),this.Nf=new qS(this.Jp.canvasElement,this,{af:()=>this.kv===null&&!this.Vp.N().handleScroll.vertTouchDrag,lf:()=>this.kv===null&&!this.Vp.N().handleScroll.horzTouchDrag})}m(){this.wv!==null&&this.wv.m(),this.gv!==null&&this.gv.m(),this.Mv=null,this.Jp.unsubscribeSuggestedBitmapSizeChanged(this.Yp),d1(this.Jp.canvasElement),this.Jp.dispose(),this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),d1(this.Gp.canvasElement),this.Gp.dispose(),this.Vv!==null&&(this.Vv.t_().u(this),this.Vv.m()),this.Nf.m()}ap(){return gt(this.Vv)}Lv(e){var n;this.Vv!==null&&this.Vv.t_().u(this),this.Vv=e,this.Vv!==null&&this.Vv.t_().i(yL.prototype.Bv.bind(this),this,!0),this.zv(),this.Vp.$f().indexOf(this)===this.Vp.$f().length-1?(this.Mv=this.Mv??new rZe(this.Iv,this.Vp),this.Mv.yt()):((n=this.Mv)==null||n.Ip(),this.Mv=null)}qp(){return this.Vp}Zf(){return this.Yf}zv(){if(this.Vv!==null&&(this.Ov(),this.ts().js().length!==0)){if(this.wv!==null){const e=this.Vv.Wo();this.wv._s(gt(e))}if(this.gv!==null){const e=this.Vv.Ho();this.gv._s(gt(e))}}}Nv(){this.wv!==null&&this.wv.yt(),this.gv!==null&&this.gv.yt()}Bo(){return this.Vv!==null?this.Vv.Bo():0}Io(e){this.Vv&&this.Vv.Io(e)}sf(e){if(!this.Vv)return;this.Fv();const n=e.localX,i=e.localY;this.Wv(n,i,e)}Sf(e){this.Fv(),this.Hv(),this.Wv(e.localX,e.localY,e)}nf(e){if(!this.Vv)return;this.Fv();const n=e.localX,i=e.localY;this.Wv(n,i,e)}mf(e){this.Vv!==null&&(this.Fv(),this.Uv(e))}Xd(e){this.Vv!==null&&this.$v(this.Cv,e)}qd(e){this.Xd(e)}cf(e){this.Fv(),this.qv(e),this.Wv(e.localX,e.localY,e)}vf(e){this.Vv!==null&&(this.Fv(),this.yv=!1,this.Yv(e))}pf(e){this.Vv!==null&&this.Uv(e)}If(e){if(this.yv=!0,this.kv===null){const n={x:e.localX,y:e.localY};this.jv(n,n,e)}}Bf(e){this.Vv!==null&&(this.Fv(),this.Vv.Qt().lc(null),this.Kv())}Xv(){return this.xv}Zv(){return this.Cv}yf(){this.Pv=1,this.ts().hn()}kf(e,n){if(!this.Vp.N().handleScale.pinch)return;const i=5*(n-this.Pv);this.Pv=n,this.ts().bc(e._t,i)}Mf(e){this.yv=!1,this.Tv=this.kv!==null,this.Hv();const n=this.ts().uc();this.kv!==null&&n.Vt()&&(this.Rv={x:n.si(),y:n.ni()},this.kv={x:e.localX,y:e.localY})}_f(e){if(this.Vv===null)return;const n=e.localX,i=e.localY;if(this.kv===null)this.qv(e);else{this.Tv=!1;const s=gt(this.Rv),r=s.x+(n-this.kv.x),o=s.y+(i-this.kv.y);this.Wv(r,o,e)}}ff(e){this.qp().N().trackingMode.exitMode===0&&(this.Tv=!0),this.Gv(),this.Yv(e)}jn(e,n){const i=this.Vv;return i===null?null:Noe(i,e,n)}Jv(e,n){gt(n==="left"?this.wv:this.gv).hv(rs({width:e,height:this.Op.height}))}Gf(){return this.Op}hv(e){wg(this.Op,e)||(this.Op=e,this.Up=!0,this.Gp.resizeCanvasElement(e),this.Jp.resizeCanvasElement(e),this.Up=!1,this.Iv.style.width=e.width+"px",this.Iv.style.height=e.height+"px")}Qv(){const e=gt(this.Vv);e.Fo(e.Wo()),e.Fo(e.Ho());for(const n of e.Ma())if(e.Un(n)){const i=n.Ft();i!==null&&e.Fo(i),n.Ns()}for(const n of e.s_())n.Ns()}Jf(){return this.Gp.bitmapSize}Qf(e,n,i,s){const r=this.Jf();if(r.width>0&&r.height>0&&(e.drawImage(this.Gp.canvasElement,n,i),s)){const o=this.Jp.canvasElement;e!==null&&e.drawImage(o,n,i)}}lv(e){if(e===0||this.Vv===null)return;e>1&&this.Qv(),this.wv!==null&&this.wv.lv(e),this.gv!==null&&this.gv.lv(e);const n={colorSpace:this.Vp.N().layout.colorSpace};if(e!==1){this.Gp.applySuggestedBitmapSize();const s=l1(this.Gp,n);s!==null&&(s.useBitmapCoordinateSpace((r=>{this._v(r)})),this.Vv&&(this.tm(s,oZe),this.im(s),this.tm(s,KK),this.tm(s,YK)))}this.Jp.applySuggestedBitmapSize();const i=l1(this.Jp,n);i!==null&&(i.useBitmapCoordinateSpace((({context:s,bitmapSize:r})=>{s.clearRect(0,0,r.width,r.height)})),this.sm(i),this.tm(i,aZe),this.tm(i,YK))}nm(){return this.wv}rm(){return this.gv}cv(e,n){this.tm(e,n)}Bv(){this.Vv!==null&&this.Vv.t_().u(this),this.Vv=null}Uv(e){this.$v(this.xv,e)}$v(e,n){const i=n.localX,s=n.localY;e.v()&&e.p(this.ts().Et().cu(i),{x:i,y:s},n)}_v({context:e,bitmapSize:n}){const{width:i,height:s}=n,r=this.ts(),o=r.$(),a=r.Wc();o===a?BS(e,0,0,i,s,a):boe(e,0,0,i,s,o,a)}im(e){const n=gt(this.Vv),i=n.i_().lr().Tt(n);i!==null&&i.nt(e,!1)}sm(e){this.hm(e,KK,_E,this.ts().uc())}tm(e,n){const i=gt(this.Vv),s=i.Dt(),r=i.s_();for(const o of r)this.hm(e,n,HI,o);for(const o of s)this.hm(e,n,HI,o);for(const o of r)this.hm(e,n,_E,o);for(const o of s)this.hm(e,n,_E,o)}hm(e,n,i,s){const r=gt(this.Vv),o=r.Qt().ac(),a=o!==null&&o.n_===s,c=o!==null&&a&&o.e_!==void 0?o.e_.Xn:void 0;GI(n,(l=>i(l,e,a,c)),s,r)}Ov(){if(this.Vv===null)return;const e=this.Vp,n=this.Vv.Wo().N().visible,i=this.Vv.Ho().N().visible;
7472n||this.wv===null||(this.Ev.removeChild(this.wv.Zf()),this.wv.m(),this.wv=null),i||this.gv===null||(this.Av.removeChild(this.gv.Zf()),this.gv.m(),this.gv=null);const s=e.Qt().Bc();n&&this.wv===null&&(this.wv=new GK(this,e.N(),s,"left"),this.Ev.appendChild(this.wv.Zf())),i&&this.gv===null&&(this.gv=new GK(this,e.N(),s,"right"),this.Av.appendChild(this.gv.Zf()))}am(e){return e.Ef&&this.yv||this.kv!==null}lm(e){return Math.max(0,Math.min(e,this.Op.width-1))}om(e){return Math.max(0,Math.min(e,this.Op.height-1))}Wv(e,n,i){this.ts().Tc(this.lm(e),this.om(n),i,gt(this.Vv))}Kv(){this.ts().Dc()}Gv(){this.Tv&&(this.kv=null,this.Kv())}jv(e,n,i){this.kv=e,this.Tv=!1,this.Wv(n.x,n.y,i);const s=this.ts().uc();this.Rv={x:s.si(),y:s.ni()}}ts(){return this.Vp.Qt()}Yv(e){if(!this.Sv)return;const n=this.ts(),i=this.ap();if(n.Ko(i,i.ks()),this.bv=null,this.Sv=!1,n.Pc(),this.Dv!==null){const s=performance.now(),r=n.Et();this.Dv.le(r.gu(),s),this.Dv.Ru(s)||n._n(this.Dv)}}Fv(){this.kv=null}Hv(){if(this.Vv){if(this.ts().hn(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)gt(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Vv.ks().Ki()&&this.ts().Et().Ki()}}qv(e){if(this.Vv===null)return;const n=this.ts(),i=n.Et();if(i.Ki())return;const s=this.Vp.N(),r=s.handleScroll,o=s.kineticScroll;if((!r.pressedMouseMove||e.Ef)&&(!r.horzTouchDrag&&!r.vertTouchDrag||!e.Ef))return;const a=this.Vv.ks(),c=performance.now();if(this.bv!==null||this.am(e)||(this.bv={x:e.clientX,y:e.clientY,rd:c,_m:e.localX,um:e.localY}),this.bv!==null&&!this.Sv&&(this.bv.x!==e.clientX||this.bv.y!==e.clientY)){if(e.Ef&&o.touch||!e.Ef&&o.mouse){const l=i.mu();this.Dv=new sZe(.2/l,7/l,.997,15/l),this.Dv.Pp(i.gu(),this.bv.rd)}else this.Dv=null;a.Ki()||n.Yo(this.Vv,a,e.localY),n.xc(e.localX),this.Sv=!0}this.Sv&&(a.Ki()||n.jo(this.Vv,a,e.localY),n.Cc(e.localX),this.Dv!==null&&this.Dv.Pp(i.gu(),c))}}class ZK{constructor(e,n,i,s,r){this.xt=!0,this.Op=rs({width:0,height:0}),this.$p=()=>this.lv(3),this.jp=e==="left",this.Ju=i.Bc,this.Ps=n,this.dm=s,this.fm=r,this.jf=document.createElement("div"),this.jf.style.width="25px",this.jf.style.height="100%",this.jf.style.overflow="hidden",this.Gp=u1(this.jf,rs({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p)}m(){this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),d1(this.Gp.canvasElement),this.Gp.dispose()}Zf(){return this.jf}Gf(){return this.Op}hv(e){wg(this.Op,e)||(this.Op=e,this.Gp.resizeCanvasElement(e),this.jf.style.width=`${e.width}px`,this.jf.style.height=`${e.height}px`,this.xt=!0)}lv(e){if(e<3&&!this.xt||this.Op.width===0||this.Op.height===0)return;this.xt=!1,this.Gp.applySuggestedBitmapSize();const n=l1(this.Gp,{colorSpace:this.Ps.layout.colorSpace});n!==null&&n.useBitmapCoordinateSpace((i=>{this._v(i),this.uv(i)}))}Jf(){return this.Gp.bitmapSize}Qf(e,n,i){const s=this.Jf();s.width>0&&s.height>0&&e.drawImage(this.Gp.canvasElement,n,i)}uv({context:e,bitmapSize:n,horizontalPixelRatio:i,verticalPixelRatio:s}){if(!this.dm())return;e.fillStyle=this.Ps.timeScale.borderColor;const r=Math.floor(this.Ju.N().S*i),o=Math.floor(this.Ju.N().S*s),a=this.jp?n.width-r:0;e.fillRect(a,0,r,o)}_v({context:e,bitmapSize:n}){BS(e,0,0,n.width,n.height,this.fm())}}function bL(t){return e=>{var n;return((n=e.ia)==null?void 0:n.call(e,t))??[]}}const cZe=bL("normal"),lZe=bL("top"),uZe=bL("bottom");class dZe{constructor(e,n){this.pm=null,this.vm=null,this.M=null,this.wm=!1,this.Op=rs({width:0,height:0}),this.gm=new rr,this.Fp=new f8(5),this.Up=!1,this.$p=()=>{this.Up||this.Vp.Qt().ar()},this.Yp=()=>{this.Up||this.Vp.Qt().ar()},this.Vp=e,this.o_=n,this.Ps=e.N().layout,this.kp=document.createElement("tr"),this.Mm=document.createElement("td"),this.Mm.style.padding="0",this.bm=document.createElement("td"),this.bm.style.padding="0",this.jf=document.createElement("td"),this.jf.style.height="25px",this.jf.style.padding="0",this.Sm=document.createElement("div"),this.Sm.style.width="100%",this.Sm.style.height="100%",this.Sm.style.position="relative",this.Sm.style.overflow="hidden",this.jf.appendChild(this.Sm),this.Gp=u1(this.Sm,rs({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p);const i=this.Gp.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jp=u1(this.Sm,rs({width:16,height:16})),this.Jp.subscribeSuggestedBitmapSizeChanged(this.Yp);const s=this.Jp.canvasElement;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.kp.appendChild(this.Mm),this.kp.appendChild(this.jf),this.kp.appendChild(this.bm),this.xm(),this.Vp.Qt().Vo().i(this.xm.bind(this),this),this.Nf=new qS(this.Jp.canvasElement,this,{af:()=>!0,lf:()=>!this.Vp.N().handleScroll.horzTouchDrag})}m(){this.Nf.m(),this.pm!==null&&this.pm.m(),this.vm!==null&&this.vm.m(),this.Jp.unsubscribeSuggestedBitmapSizeChanged(this.Yp),d1(this.Jp.canvasElement),this.Jp.dispose(),this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),d1(this.Gp.canvasElement),this.Gp.dispose()}Zf(){return this.kp}Cm(){return this.pm}Pm(){return this.vm}Sf(e){if(this.wm)return;this.wm=!0;const n=this.Vp.Qt();!n.Et().Ki()&&this.Vp.N().handleScale.axisPressedMouseMove.time&&n.Mc(e.localX)}Mf(e){this.Sf(e)}xf(){const e=this.Vp.Qt();!e.Et().Ki()&&this.wm&&(this.wm=!1,this.Vp.N().handleScale.axisPressedMouseMove.time&&e.kc())}cf(e){const n=this.Vp.Qt();!n.Et().Ki()&&this.Vp.N().handleScale.axisPressedMouseMove.time&&n.yc(e.localX)}_f(e){this.cf(e)}vf(){this.wm=!1;const e=this.Vp.Qt();e.Et().Ki()&&!this.Vp.N().handleScale.axisPressedMouseMove.time||e.kc()}ff(){this.vf()}Xd(){this.Vp.N().handleScale.axisDoubleClickReset.time&&this.Vp.Qt().cn()}qd(){this.Xd()}
7472sf(){this.Vp.Qt().N().handleScale.axisPressedMouseMove.time&&this.vv(1)}Bf(){this.vv(0)}Gf(){return this.Op}ym(){return this.gm}km(e,n,i){wg(this.Op,e)||(this.Op=e,this.Up=!0,this.Gp.resizeCanvasElement(e),this.Jp.resizeCanvasElement(e),this.Up=!1,this.jf.style.width=`${e.width}px`,this.jf.style.height=`${e.height}px`,this.gm.p(e)),this.pm!==null&&this.pm.hv(rs({width:n,height:e.height})),this.vm!==null&&this.vm.hv(rs({width:i,height:e.height}))}Tm(){const e=this.Rm();return Math.ceil(e.S+e.C+e.P+e.A+e.V+e.Dm)}yt(){this.Vp.Qt().Et().Da()}Jf(){return this.Gp.bitmapSize}Qf(e,n,i,s){const r=this.Jf();if(r.width>0&&r.height>0&&(e.drawImage(this.Gp.canvasElement,n,i),s)){const o=this.Jp.canvasElement;e.drawImage(o,n,i)}}lv(e){if(e===0)return;const n={colorSpace:this.Ps.colorSpace};if(e!==1){this.Gp.applySuggestedBitmapSize();const s=l1(this.Gp,n);s!==null&&(s.useBitmapCoordinateSpace((r=>{this._v(r),this.uv(r),this.Vm(s,uZe)})),this.dv(s),this.Vm(s,cZe)),this.pm!==null&&this.pm.lv(e),this.vm!==null&&this.vm.lv(e)}this.Jp.applySuggestedBitmapSize();const i=l1(this.Jp,n);i!==null&&(i.useBitmapCoordinateSpace((({context:s,bitmapSize:r})=>{s.clearRect(0,0,r.width,r.height)})),this.Bm([...this.Vp.Qt().js(),this.Vp.Qt().uc()],i),this.Vm(i,lZe))}Vm(e,n){const i=this.Vp.Qt().js();for(const s of i)GI(n,(r=>HI(r,e,!1,void 0)),s,void 0);for(const s of i)GI(n,(r=>_E(r,e,!1,void 0)),s,void 0)}_v({context:e,bitmapSize:n}){BS(e,0,0,n.width,n.height,this.Vp.Qt().Wc())}uv({context:e,bitmapSize:n,verticalPixelRatio:i}){if(this.Vp.N().timeScale.borderVisible){e.fillStyle=this.Im();const s=Math.max(1,Math.floor(this.Rm().S*i));e.fillRect(0,0,n.width,s)}}dv(e){const n=this.Vp.Qt().Et(),i=n.Da();if(!i||i.length===0)return;const s=this.o_.maxTickMarkWeight(i),r=this.Rm(),o=n.N();o.borderVisible&&o.ticksVisible&&e.useBitmapCoordinateSpace((({context:a,horizontalPixelRatio:c,verticalPixelRatio:l})=>{a.strokeStyle=this.Im(),a.fillStyle=this.Im();const d=Math.max(1,Math.floor(c)),h=Math.floor(.5*c);a.beginPath();const p=Math.round(r.C*l);for(let g=i.length;g--;){const b=Math.round(i[g].coord*c);a.rect(b-h,0,d,p)}a.fill()})),e.useMediaCoordinateSpace((({context:a})=>{const c=r.S+r.C+r.A+r.P/2;a.textAlign="center",a.textBaseline="middle",a.fillStyle=this.H(),a.font=this.ev();for(const l of i)if(l.weight<s){const d=l.needAlignCoordinate?this.Em(a,l.coord,l.label):l.coord;a.fillText(l.label,d,c)}this.Vp.N().timeScale.allowBoldLabels&&(a.font=this.Am());for(const l of i)if(l.weight>=s){const d=l.needAlignCoordinate?this.Em(a,l.coord,l.label):l.coord;a.fillText(l.label,d,c)}}))}Em(e,n,i){const s=this.Fp.Vi(e,i),r=s/2,o=Math.floor(n-r)+.5;return o<0?n+=Math.abs(0-o):o+s>this.Op.width&&(n-=Math.abs(this.Op.width-(o+s))),n}Bm(e,n){const i=this.Rm();for(const s of e)for(const r of s.cs())r.Tt().nt(n,i)}Im(){return this.Vp.N().timeScale.borderColor}H(){return this.Ps.textColor}F(){return this.Ps.fontSize}ev(){return J5(this.F(),this.Ps.fontFamily)}Am(){return J5(this.F(),this.Ps.fontFamily,"bold")}Rm(){this.M===null&&(this.M={S:1,L:NaN,A:NaN,V:NaN,Ji:NaN,C:5,P:NaN,k:"",Gi:new f8,Dm:0});const e=this.M,n=this.ev();if(e.k!==n){const i=this.F();e.P=i,e.k=n,e.A=3*i/12,e.V=3*i/12,e.Ji=9*i/12,e.L=0,e.Dm=4*i/12,e.Gi.Bn()}return this.M}vv(e){this.jf.style.cursor=e===1?"ew-resize":"default"}xm(){const e=this.Vp.Qt(),n=e.N();n.leftPriceScale.visible||this.pm===null||(this.Mm.removeChild(this.pm.Zf()),this.pm.m(),this.pm=null),n.rightPriceScale.visible||this.vm===null||(this.bm.removeChild(this.vm.Zf()),this.vm.m(),this.vm=null);const i={Bc:this.Vp.Qt().Bc()},s=()=>n.leftPriceScale.borderVisible&&e.Et().N().borderVisible,r=()=>e.Wc();n.leftPriceScale.visible&&this.pm===null&&(this.pm=new ZK("left",n,i,s,r),this.Mm.appendChild(this.pm.Zf())),n.rightPriceScale.visible&&this.vm===null&&(this.vm=new ZK("right",n,i,s,r),this.bm.appendChild(this.vm.Zf()))}}var jY;const hZe=!!Eb&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((t=>t.brand.includes("Chromium")))&&!!Eb&&((jY=navigator==null?void 0:navigator.userAgentData)!=null&&jY.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);class fZe{constructor(e,n,i){var s;this.zm=[],this.Lm=[],this.Om=0,this.il=0,this.Mo=0,this.Nm=0,this.Fm=0,this.Wm=null,this.Hm=!1,this.xv=new rr,this.Cv=new rr,this.Xu=new rr,this.Um=null,this.$m=null,this.Dp=e,this.Ps=n,this.o_=i,this.kp=document.createElement("div"),this.kp.classList.add("tv-lightweight-charts"),this.kp.style.overflow="hidden",this.kp.style.direction="ltr",this.kp.style.width="100%",this.kp.style.height="100%",(s=this.kp).style.userSelect="none",s.style.webkitUserSelect="none",s.style.msUserSelect="none",s.style.MozUserSelect="none",s.style.webkitTapHighlightColor="transparent",this.qm=document.createElement("table"),this.qm.setAttribute("cellspacing","0"),this.kp.appendChild(this.qm),this.Ym=this.jm.bind(this),pN(this.Ps)&&this.Km(!0),this.ts=new QYe(this.Gu.bind(this),this.Ps,i),this.Qt().cc().i(this.Xm.bind(this),this),this.Zm=new dZe(this,this.o_),this.qm.appendChild(this.Zm.Zf());const r=n.autoSize&&this.Gm();let o=this.Ps.width,a=this.Ps.height;if(r||o===0||a===0){const c=e.getBoundingClientRect();o=o||c.width,a=a||c.height}this.Jm(o,a),this.Qm(),e.appendChild(this.kp),this.tw(),this.ts.Et().Iu().i(this.ts.Ih.bind(this.ts),this),this.ts.Vo().i(this.ts.Ih.bind(this.ts),this)}Qt(){return this.ts}N(){return this.Ps}$f(){return this.zm}iw(){return this.Zm}m(){this.Km(!1),this.Om!==0&&window.cancelAnimationFrame(this.Om),this.ts.cc().u(this),this.ts.Et().Iu().u(this),this.ts.Vo().u(this),this.ts.m();for(const e of this.zm)this.qm.removeChild(e.Zf()),e.Xv().u(this),e.Zv().u(this),e.m();this.zm=[];for(const e of this.Lm)this.sw(e);this.Lm=[],gt(this.Zm).m(),this.kp.parentElement!==null&&this.kp.parentElement.removeChild(this.kp),this.Xu.m(),this.xv.m(),this.Cv.m(),this.nw()}Jm(e,n,i=!1){if(this.il===n&&this.Mo===e)return;const s=(function(a){const c=Math.floor(a.width),l=Math.floor(a.height);return rs({width:c-c%2,height:l-l%2})})(rs({width:e,height:n}));this.il=s.height,this.Mo=s.width;const r=this.il+"px",o=this.Mo+"px";gt(this.kp).style.height=r,gt(this.kp).style.width=o,this.qm.style.height=r,this.qm.style.width=o,i?this.ew(yo.gn(),performance.now()):this.ts.Ih()}lv(e){e===void 0&&(e=yo.gn());for(let n=0;n<this.zm.length;n++)this.zm[n].lv(e.en(n).tn);this.Ps.timeScale.visible&&this.Zm.lv(e.nn())}hr(e){var s;const n=pN(this.Ps);this.ts.hr(e);const i=pN(this.Ps);i!==n&&this.Km(i),(s=e.layout)!=null&&s.panes&&this.rw(),this.tw(),this.hw(e)}Xv(){return this.xv}Zv(){return this.Cv}cc(){return this.Xu}aw(e=!1){this.Wm!==null&&(this.ew(this.Wm,performance.now()),this.Wm=null);const n=this.lw(null),i=document.createElement("canvas");i.width=n.width,i.height=n.height;const s=gt(i.getContext("2d"));return this.lw(s,e),i}ow(e){return e==="left"&&!this._w()||e==="right"&&!this.uw()||this.zm.length===0?0:gt(e==="left"?this.zm[0].nm():this.zm[0].rm()).av()}cw(){return this.Ps.autoSize&&this.Um!==null}ip(){return this.kp}dw(e){this.$m=e,this.$m?this.ip().style.setProperty("cursor",e):this.ip().style.removeProperty("cursor")}fw(){return this.$m}pw(e){return ic(this.zm[e]).Gf()}rw(){this.Lm.forEach((e=>{e.yt()}
7472))}hw(e){(e.autoSize!==void 0||!this.Um||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.Um&&this.Gm(),e.autoSize===!1&&this.Um!==null&&this.nw(),e.autoSize||e.width===void 0&&e.height===void 0||this.Jm(e.width||this.Mo,e.height||this.il))}lw(e,n){let i=0,s=0;const r=this.zm[0],o=(c,l)=>{let d=0;for(let h=0;h<this.zm.length;h++){const p=this.zm[h],g=gt(c==="left"?p.nm():p.rm()),b=g.Jf();if(e!==null&&g.Qf(e,l,d,n),d+=b.height,h<this.zm.length-1){const w=this.Lm[h],C=w.Jf();e!==null&&w.Qf(e,l,d),d+=C.height}}};this._w()&&(o("left",0),i+=gt(r.nm()).Jf().width);for(let c=0;c<this.zm.length;c++){const l=this.zm[c],d=l.Jf();if(e!==null&&l.Qf(e,i,s,n),s+=d.height,c<this.zm.length-1){const h=this.Lm[c],p=h.Jf();e!==null&&h.Qf(e,i,s),s+=p.height}}i+=r.Jf().width,this.uw()&&(o("right",i),i+=gt(r.rm()).Jf().width);const a=(c,l,d)=>{gt(c==="left"?this.Zm.Cm():this.Zm.Pm()).Qf(gt(e),l,d)};if(this.Ps.timeScale.visible){const c=this.Zm.Jf();if(e!==null){let l=0;this._w()&&(a("left",l,s),l=gt(r.nm()).Jf().width),this.Zm.Qf(e,l,s,n),l+=c.width,this.uw()&&a("right",l,s)}s+=c.height}return rs({width:i,height:s})}mw(){let e=0,n=0,i=0;for(const C of this.zm)this._w()&&(n=Math.max(n,gt(C.nm()).nv(),this.Ps.leftPriceScale.minimumWidth)),this.uw()&&(i=Math.max(i,gt(C.rm()).nv(),this.Ps.rightPriceScale.minimumWidth)),e+=C.Bo();n=zI(n),i=zI(i);const s=this.Mo,r=this.il,o=Math.max(s-n-i,0),a=1*this.Lm.length,c=this.Ps.timeScale.visible;let l=c?Math.max(this.Zm.Tm(),this.Ps.timeScale.minimumHeight):0;var d;l=(d=l)+d%2;const h=a+l,p=r<h?0:r-h,g=p/e;let b=0;const w=window.devicePixelRatio||1;for(let C=0;C<this.zm.length;++C){const E=this.zm[C];E.Lv(this.ts.$s()[C]);let T=0,A=0;A=C===this.zm.length-1?Math.ceil((p-b)*w)/w:Math.round(E.Bo()*g*w)/w,T=Math.max(A,2),b+=T,E.hv(rs({width:o,height:T})),this._w()&&E.Jv(n,"left"),this.uw()&&E.Jv(i,"right"),E.ap()&&this.ts.dc(E.ap(),T)}this.Zm.km(rs({width:c?o:0,height:l}),c?n:0,c?i:0),this.ts.Eo(o),this.Nm!==n&&(this.Nm=n),this.Fm!==i&&(this.Fm=i)}Km(e){e?this.kp.addEventListener("wheel",this.Ym,{passive:!1}):this.kp.removeEventListener("wheel",this.Ym)}ww(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return hZe?1/window.devicePixelRatio:1}jm(e){if(!(e.deltaX!==0&&this.Ps.handleScroll.mouseWheel||e.deltaY!==0&&this.Ps.handleScale.mouseWheel))return;const n=this.ww(e),i=n*e.deltaX/100,s=-n*e.deltaY/100;if(e.cancelable&&e.preventDefault(),s!==0&&this.Ps.handleScale.mouseWheel){const r=Math.sign(s)*Math.min(1,Math.abs(s)),o=e.clientX-this.kp.getBoundingClientRect().left;this.Qt().bc(o,r)}i!==0&&this.Ps.handleScroll.mouseWheel&&this.Qt().Sc(-80*i)}ew(e,n){var s;const i=e.nn();i===3&&this.gw(),i!==3&&i!==2||(this.Mw(e),this.bw(e,n),this.Zm.yt(),this.zm.forEach((r=>{r.Nv()})),((s=this.Wm)==null?void 0:s.nn())===3&&(this.Wm.vn(e),this.gw(),this.Mw(this.Wm),this.bw(this.Wm,n),e=this.Wm,this.Wm=null)),this.lv(e)}bw(e,n){for(const i of e.pn())this.mn(i,n)}Mw(e){const n=this.ts.$s();for(let i=0;i<n.length;i++)e.en(i).sn&&n[i].Go()}mn(e,n){const i=this.ts.Et();switch(e.an){case 0:i.Au();break;case 1:i.zu(e.Wt);break;case 2:i.dn(e.Wt);break;case 3:i.fn(e.Wt);break;case 4:i.Su();break;case 5:e.Wt.Ru(n)||i.fn(e.Wt.Du(n))}}Gu(e){this.Wm!==null?this.Wm.vn(e):this.Wm=e,this.Hm||(this.Hm=!0,this.Om=window.requestAnimationFrame((n=>{if(this.Hm=!1,this.Om=0,this.Wm!==null){const i=this.Wm;this.Wm=null,this.ew(i,n);for(const s of i.pn())if(s.an===5&&!s.Wt.Ru(n)){this.Qt()._n(s.Wt);break}}})))}gw(){this.Qm()}sw(e){this.qm.removeChild(e.Zf()),e.m()}Qm(){const e=this.ts.$s(),n=e.length,i=this.zm.length;for(let s=n;s<i;s++){const r=ic(this.zm.pop());this.qm.removeChild(r.Zf()),r.Xv().u(this),r.Zv().u(this),r.m();const o=this.Lm.pop();o!==void 0&&this.sw(o)}for(let s=i;s<n;s++){const r=new yL(this,e[s]);if(r.Xv().i(this.Sw.bind(this,r),this),r.Zv().i(this.xw.bind(this,r),this),this.zm.push(r),s>0){const o=new iZe(this,s-1,s);this.Lm.push(o),this.qm.insertBefore(o.Zf(),this.Zm.Zf())}this.qm.insertBefore(r.Zf(),this.Zm.Zf())}for(let s=0;s<n;s++){const r=e[s],o=this.zm[s];o.ap()!==r?o.Lv(r):o.zv()}this.tw(),this.mw()}Cw(e,n,i,s){var h;const r=new Map;
7472e!==null&&this.ts.js().forEach((p=>{const g=p.Xs().Fr(e);g!==null&&r.set(p,g)}));let o;if(e!==null){const p=(h=this.ts.Et().ss(e))==null?void 0:h.originalTime;p!==void 0&&(o=p)}const a=this.Qt().ac(),c=a!==null&&a.n_ instanceof WS?a.n_:void 0,l=a!==null&&a.e_!==void 0?a.e_.Kn:void 0,d=this.Pw(s);return{yw:o,Re:e??void 0,kw:n??void 0,Tw:d!==-1?d:void 0,Rw:c,Dw:r,Vw:l,Bw:i??void 0}}Pw(e){let n=-1;if(e)n=this.zm.indexOf(e);else{const i=this.Qt().uc().Us();i!==null&&(n=this.Qt().$s().indexOf(i))}return n}Sw(e,n,i,s){this.xv.p((()=>this.Cw(n,i,s,e)))}xw(e,n,i,s){this.Cv.p((()=>this.Cw(n,i,s,e)))}Xm(e,n,i){var s;this.dw(((s=this.Qt().ac())==null?void 0:s.h_)??null),this.Xu.p((()=>this.Cw(e,n,i)))}tw(){const e=this.Ps.timeScale.visible?"":"none";this.Zm.Zf().style.display=e}_w(){return this.zm[0].ap().Wo().N().visible}uw(){return this.zm[0].ap().Ho().N().visible}Gm(){return"ResizeObserver"in window&&(this.Um=new ResizeObserver((e=>{const n=e[e.length-1];n&&this.Jm(n.contentRect.width,n.contentRect.height)})),this.Um.observe(this.Dp,{box:"border-box"}),!0)}nw(){this.Um!==null&&this.Um.disconnect(),this.Um=null}}function pN(t){return!!(t.handleScroll.mouseWheel||t.handleScale.mouseWheel)}function pZe(t){return t.open===void 0&&t.value===void 0}function mZe(t){return(function(e){return e.open!==void 0})(t)||(function(e){return e.value!==void 0})(t)}function QK(t,e,n,i){const s=n.value,r={Re:e,wt:t,Wt:[s,s,s,s],yw:i};return n.color!==void 0&&(r.R=n.color),r}function gZe(t,e,n,i){const s=n.value,r={Re:e,wt:t,Wt:[s,s,s,s],yw:i};return n.lineColor!==void 0&&(r.vt=n.lineColor),n.topColor!==void 0&&(r.mr=n.topColor),n.bottomColor!==void 0&&(r.wr=n.bottomColor),r}function yZe(t,e,n,i){const s=n.value,r={Re:e,wt:t,Wt:[s,s,s,s],yw:i};return n.topLineColor!==void 0&&(r.gr=n.topLineColor),n.bottomLineColor!==void 0&&(r.Mr=n.bottomLineColor),n.topFillColor1!==void 0&&(r.br=n.topFillColor1),n.topFillColor2!==void 0&&(r.Sr=n.topFillColor2),n.bottomFillColor1!==void 0&&(r.Cr=n.bottomFillColor1),n.bottomFillColor2!==void 0&&(r.Pr=n.bottomFillColor2),r}function bZe(t,e,n,i){const s={Re:e,wt:t,Wt:[n.open,n.high,n.low,n.close],yw:i};return n.color!==void 0&&(s.R=n.color),s}function wZe(t,e,n,i){const s={Re:e,wt:t,Wt:[n.open,n.high,n.low,n.close],yw:i};return n.color!==void 0&&(s.R=n.color),n.borderColor!==void 0&&(s.Ht=n.borderColor),n.wickColor!==void 0&&(s.vr=n.wickColor),s}function vZe(t,e,n,i,s){const r=ic(s)(n),o=Math.max(...r),a=Math.min(...r),c=r[r.length-1],l=[c,o,a,c],{time:d,color:h,...p}=n;return{Re:e,wt:t,Wt:l,yw:i,se:p,R:h}}function Kv(t){return t.Wt!==void 0}function XK(t,e){return e.customValues!==void 0&&(t.Iw=e.customValues),t}function Em(t){return(e,n,i,s,r,o)=>(function(a,c){return c?c(a):pZe(a)})(i,o)?XK({wt:e,Re:n,yw:s},i):XK(t(e,n,i,s,r),i)}function JK(t){return{Candlestick:Em(wZe),Bar:Em(bZe),Area:Em(gZe),Baseline:Em(yZe),Histogram:Em(QK),Line:Em(QK),Custom:Em(vZe)}[t]}function eY(t){return{Re:0,Ew:new Map,Hh:t}}function tY(t,e){if(t!==void 0&&t.length!==0)return{Aw:e.key(t[0].wt),zw:e.key(t[t.length-1].wt)}}function nY(t){let e;return t.forEach((n=>{e===void 0&&(e=n.yw)})),ic(e)}class CZe{constructor(e){this.Lw=new Map,this.Ow=new Map,this.Nw=new Map,this.Fw=[],this.o_=e}m(){this.Lw.clear(),this.Ow.clear(),this.Nw.clear(),this.Fw=[]}Ww(e,n){let i=this.Lw.size!==0,s=!1;const r=this.Ow.get(e);if(r!==void 0)if(this.Ow.size===1)i=!1,s=!0,this.Lw.clear();else for(const c of this.Fw)c.pointData.Ew.delete(e)&&(s=!0);let o=[];if(n.length!==0){const c=n.map((g=>g.time)),l=this.o_.createConverterToInternalObj(n),d=JK(e.Rr()),h=e.ca(),p=e.fa();o=n.map(((g,b)=>{const w=l(g.time),C=this.o_.key(w);let E=this.Lw.get(C);E===void 0&&(E=eY(w),this.Lw.set(C,E),s=!0);const T=d(w,E.Re,g,c[b],h,p);return E.Ew.set(e,T),T}))}i&&this.Hw(),this.Uw(e,o);let a=-1;if(s){const c=[];this.Lw.forEach((l=>{c.push({timeWeight:0,time:l.Hh,pointData:l,originalTime:nY(l.Ew)})})),c.sort(((l,d)=>this.o_.key(l.time)-this.o_.key(d.time))),a=this.$w(c)}return this.qw(e,a,(function(c,l,d){const h=tY(c,d),p=tY(l,d);if(h!==void 0&&p!==void 0)return{Yw:!1,zh:h.zw>=p.zw&&h.Aw>=p.Aw}})(this.Ow.get(e),r,this.o_))}Ac(e){return this.Ww(e,[])}jw(e,n,i){const s=n;(function(C){C.yw===void 0&&(C.yw=C.time)})(s),this.o_.preprocessData(n);const r=this.o_.createConverterToInternalObj([n])(n.time),o=this.Nw.get(e);if(!i&&o!==void 0&&this.o_.key(r)<this.o_.key(o))throw new Error(`Cannot update oldest data, last time=${o}, new time=${r}`);let a=this.Lw.get(this.o_.key(r));if(i&&a===void 0)throw new Error("Cannot update non-existing data point when historicalUpdate is true");const c=a===void 0;a===void 0&&(a=eY(r),this.Lw.set(this.o_.key(r),a));const l=JK(e.Rr()),d=e.ca(),h=e.fa(),p=l(r,a.Re,n,s.yw,d,h);a.Ew.set(e,p),i?this.Kw(e,p,a.Re):this.Xw(e,p);const g={zh:Kv(p),Yw:i};if(!c)return this.qw(e,-1,g);const b={timeWeight:0,time:a.Hh,pointData:a,originalTime:nY(a.Ew)}
7472,w=xb(this.Fw,this.o_.key(b.time),((C,E)=>this.o_.key(C.time)<E));this.Fw.splice(w,0,b);for(let C=w;C<this.Fw.length;++C)Wx(this.Fw[C].pointData,C);return this.o_.fillWeightsForPoints(this.Fw,w),this.qw(e,w,g)}Zw(e,n){const i=this.Ow.get(e);if(i===void 0||n<=0)return[[],this.Gw()];n=Math.min(n,i.length);const s=i.splice(-n).reverse();i.length===0?this.Nw.delete(e):this.Nw.set(e,i[i.length-1].wt);for(const r of s){const o=this.Lw.get(this.o_.key(r.wt));if(o&&(o.Ew.delete(e),o.Ew.size===0)){this.Lw.delete(this.o_.key(o.Hh)),this.Fw.splice(o.Re,1);for(let a=o.Re;a<this.Fw.length;++a)Wx(this.Fw[a].pointData,a)}}return[s,this.qw(e,this.Fw.length-1,{Yw:!1,zh:!1})]}Xw(e,n){let i=this.Ow.get(e);i===void 0&&(i=[],this.Ow.set(e,i));const s=i.length!==0?i[i.length-1]:null;s===null||this.o_.key(n.wt)>this.o_.key(s.wt)?Kv(n)&&i.push(n):Kv(n)?i[i.length-1]=n:i.splice(-1,1),this.Nw.set(e,n.wt)}Kw(e,n,i){const s=this.Ow.get(e);if(s===void 0)return;const r=xb(s,i,((o,a)=>o.Re<a));Kv(n)?s[r]=n:s.splice(r,1)}Uw(e,n){n.length!==0?(this.Ow.set(e,n.filter(Kv)),this.Nw.set(e,n[n.length-1].wt)):(this.Ow.delete(e),this.Nw.delete(e))}Hw(){for(const e of this.Fw)e.pointData.Ew.size===0&&this.Lw.delete(this.o_.key(e.time))}$w(e){let n=-1;for(let i=0;i<this.Fw.length&&i<e.length;++i){const s=this.Fw[i],r=e[i];if(this.o_.key(s.time)!==this.o_.key(r.time)){n=i;break}r.timeWeight=s.timeWeight,Wx(r.pointData,i)}if(n===-1&&this.Fw.length!==e.length&&(n=Math.min(this.Fw.length,e.length)),n===-1)return-1;for(let i=n;i<e.length;++i)Wx(e[i].pointData,i);return this.o_.fillWeightsForPoints(e,n),this.Fw=e,n}Jw(){if(this.Ow.size===0)return null;let e=0;return this.Ow.forEach((n=>{n.length!==0&&(e=Math.max(e,n[n.length-1].Re))})),e}qw(e,n,i){const s=this.Gw();if(n!==-1)this.Ow.forEach(((r,o)=>{s.Oo.set(o,{se:r,Qw:o===e?i:void 0})})),this.Ow.has(e)||s.Oo.set(e,{se:[],Qw:i}),s.Et.tg=this.Fw,s.Et.ig=n;else{const r=this.Ow.get(e);s.Oo.set(e,{se:r||[],Qw:i})}return s}Gw(){return{Oo:new Map,Et:{_u:this.Jw()}}}}function Wx(t,e){t.Re=e,t.Ew.forEach((n=>{n.Re=e}))}function xZe(t,e){return t.wt<e}function EZe(t,e){return e<t.wt}function _Ze(t,e,n){const i=e.Uh(),s=e.bi(),r=xb(t,i,xZe),o=Soe(t,s,EZe);if(!n)return{from:r,to:o};let a=r,c=o;return r>0&&r<t.length&&t[r].wt>=i&&(a=r-1),o>0&&o<t.length&&t[o-1].wt<=s&&(c=o+1),{from:a,to:c}}class wL{constructor(e,n,i){this.sg=!0,this.ng=!0,this.eg=!0,this.rg=[],this.hg=null,this.Jn=e,this.Qn=n,this.ag=i}yt(e){this.sg=!0,e==="data"&&(this.ng=!0),e==="options"&&(this.eg=!0)}Tt(){return this.Jn.Vt()?(this.lg(),this.hg===null?null:this.og):null}_g(){this.rg=this.rg.map((e=>({...e,...this.Jn.Rh().Dr(e.wt)})))}ug(){this.hg=null}lg(){this.ng&&(this.cg(),this.ng=!1),this.eg&&(this._g(),this.eg=!1),this.sg&&(this.dg(),this.sg=!1)}dg(){const e=this.Jn.Ft(),n=this.Qn.Et();if(this.ug(),n.Ki()||e.Ki())return;const i=n.Pe();if(i===null||this.Jn.Xs().zr()===0)return;const s=this.Jn.zt();s!==null&&(this.hg=_Ze(this.rg,i,this.ag),this.fg(e,n,s.Wt),this.pg())}}class SZe{constructor(e,n){this.vg=e,this.Yi=n}nt(e,n,i){this.vg.draw(e,this.Yi,n,i)}}class AZe extends wL{constructor(e,n,i){super(e,n,!1),this.sh=i,this.og=new SZe(this.sh.renderer(),(s=>{const r=e.zt();return r===null?null:e.Ft().Nt(s,r.Wt)}))}da(e){return this.sh.priceValueBuilder(e)}pa(e){return this.sh.isWhitespace(e)}cg(){const e=this.Jn.Rh();this.rg=this.Jn.Xs().Hr().map((n=>({wt:n.Re,_t:NaN,...e.Dr(n.Re),mg:n.se})))}fg(e,n){n.uu(this.rg,X5(this.hg))}pg(){this.sh.update({bars:this.rg.map(TZe),barSpacing:this.Qn.Et().mu(),visibleRange:this.hg},this.Jn.N())}}function TZe(t){return{x:t._t,time:t.wt,originalData:t.mg,barColor:t.cr}}const kZe={color:"#2196f3"},NZe=(t,e,n)=>{const i=ap(n);return new AZe(t,e,i)};function vL(t){const e={value:t.Wt[3],time:t.yw};return t.Iw!==void 0&&(e.customValues=t.Iw),e}function iY(t){const e=vL(t);return t.R!==void 0&&(e.color=t.R),e}function RZe(t){const e=vL(t);return t.vt!==void 0&&(e.lineColor=t.vt),t.mr!==void 0&&(e.topColor=t.mr),t.wr!==void 0&&(e.bottomColor=t.wr),e}function PZe(t){const e=vL(t);
7472return t.gr!==void 0&&(e.topLineColor=t.gr),t.Mr!==void 0&&(e.bottomLineColor=t.Mr),t.br!==void 0&&(e.topFillColor1=t.br),t.Sr!==void 0&&(e.topFillColor2=t.Sr),t.Cr!==void 0&&(e.bottomFillColor1=t.Cr),t.Pr!==void 0&&(e.bottomFillColor2=t.Pr),e}function Doe(t){const e={open:t.Wt[0],high:t.Wt[1],low:t.Wt[2],close:t.Wt[3],time:t.yw};return t.Iw!==void 0&&(e.customValues=t.Iw),e}function IZe(t){const e=Doe(t);return t.R!==void 0&&(e.color=t.R),e}function DZe(t){const e=Doe(t),{R:n,Ht:i,vr:s}=t;return n!==void 0&&(e.color=n),i!==void 0&&(e.borderColor=i),s!==void 0&&(e.wickColor=s),e}function SE(t){return{Area:RZe,Line:iY,Baseline:PZe,Histogram:iY,Bar:IZe,Candlestick:DZe,Custom:OZe}[t]}function OZe(t){const e=t.yw;return{...t.se,time:e}}const MZe={vertLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},horzLine:{color:"#9598A1",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#131722"},mode:1},LZe={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},$Ze={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:pL,panes:{enableResize:!0,separatorColor:"#E0E3EB",separatorHoverColor:"rgba(178, 181, 189, 0.2)"},attributionLogo:!0,colorSpace:"srgb",colorParsers:[]},mN={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0,ensureEdgeTickMarksVisible:!1},UZe={rightOffset:0,barSpacing:6,minBarSpacing:.5,maxBarSpacing:0,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0,ignoreWhitespaceIndices:!1};function sY(){return{addDefaultPane:!0,width:0,height:0,autoSize:!1,layout:$Ze,crosshair:MZe,grid:LZe,overlayPriceScales:{...mN},leftPriceScale:{...mN,visible:!1},rightPriceScale:{...mN,visible:!0},timeScale:UZe,localization:{locale:Eb?navigator.language:"",dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}class Ooe{constructor(e,n,i){this.Hf=e,this.wg=n,this.gg=i??0}applyOptions(e){this.Hf.Qt().oc(this.wg,e,this.gg)}options(){return this.Yi().N()}width(){return jS(this.wg)?this.Hf.ow(this.wg):0}setVisibleRange(e){this.setAutoScale(!1),this.Yi().Fl(new fa(e.from,e.to))}getVisibleRange(){let e,n,i=this.Yi().Qe();if(i===null)return null;if(this.Yi().Ja()){const s=this.Yi().fo(),r=Roe(s);i=h2(i,this.Yi().tl()),e=Number((Math.round(i.$e()/s)*s).toFixed(r)),n=Number((Math.round(i.qe()/s)*s).toFixed(r))}else e=i.$e(),n=i.qe();return{from:e,to:n}}setAutoScale(e){this.applyOptions({autoScale:e})}Yi(){return gt(this.Hf.Qt()._c(this.wg,this.gg)).Ft}}class BZe{constructor(e,n,i,s){this.Hf=e,this.Pt=i,this.Mg=n,this.bg=s}getHeight(){return this.Pt.$t()}setHeight(e){const n=this.Hf.Qt(),i=n.Uc(this.Pt);n.vc(i,e)}getStretchFactor(){return this.Pt.Bo()}setStretchFactor(e){this.Pt.Io(e),this.Hf.Qt().Ih()}paneIndex(){return this.Hf.Qt().Uc(this.Pt)}moveTo(e){const n=this.paneIndex();n!==e&&(vo(e>=0&&e<this.Hf.$f().length,"Invalid pane index"),this.Hf.Qt().wc(n,e))}getSeries(){return this.Pt.Oo().map((e=>this.Mg(e)))??[]}getHTMLElement(){const e=this.Hf.$f();return e&&e.length!==0&&e[this.paneIndex()]?e[this.paneIndex()].Zf():null}attachPrimitive(e){this.Pt._a(e),e.attached&&e.attached({chart:this.bg,requestUpdate:()=>this.Pt.Qt().Ih()})}detachPrimitive(e){this.Pt.ua(e)}priceScale(e){if(this.Pt.Do(e)===null)throw new Error(`Cannot find price scale with id: ${e}`);return new Ooe(this.Hf,e,this.paneIndex())}setPreserveEmptyPane(e){this.Pt.zo(e)}preserveEmptyPane(){return this.Pt.Lo()}addCustomSeries(e,n={},i=0){return this.bg.addCustomSeries(e,n,i)}addSeries(e,n={}){return this.bg.addSeries(e,n,this.paneIndex())}}const FZe={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class rY{constructor(e){this.ir=e}applyOptions(e){this.ir.hr(e)}options(){return this.ir.N()}Sg(){return this.ir}}class jZe{constructor(e,n,i,s,r,o){this.xg=new rr,this.Jn=e,this.Cg=n,this.Pg=i,this.o_=r,this.bg=s,this.yg=o}m(){this.xg.m()}priceFormatter(){return this.Jn.ea()}priceToCoordinate(e){const n=this.Jn.zt();return n===null?null:this.Jn.Ft().Nt(e,n.Wt)}coordinateToPrice(e){const n=this.Jn.zt();return n===null?null:this.Jn.Ft().Ts(e,n.Wt)}barsInLogicalRange(e){if(e===null)return null;const n=new P2(new A3(e.from,e.to)).y_(),i=this.Jn.Xs();if(i.Ki())return null;const s=i.Fr(n.Uh(),1),r=i.Fr(n.bi(),-1),o=gt(i.Lr()),a=gt(i.Ks());if(s!==null&&r!==null&&s.Re>r.Re)return{barsBefore:e.from-o,barsAfter:a-e.to};const c={barsBefore:s===null||s.Re===o?e.from-o:s.Re-o,barsAfter:r===null||r.Re===a?a-e.to:a-r.Re};return s!==null&&r!==null&&(c.from=s.yw,c.to=r.yw),c}setData(e){this.o_,this.Jn.Rr(),this.Cg.kg(this.Jn,e),this.Tg("full")}update(e,n=!1){this.Jn.Rr(),this.Cg.Rg(this.Jn,e,n),this.Tg("update")}pop(e=1){const n=this.Cg.Dg(this.Jn,e);n.length!==0&&this.Tg("update");const i=SE(this.seriesType());return n.map((s=>i(s)))}dataByIndex(e,n){const i=this.Jn.Xs().Fr(e,n);return i===null?null:SE(this.seriesType())(i)}data(){const e=SE(this.seriesType());return this.Jn.Xs().Hr().map((n=>e(n)))}subscribeDataChanged(e){this.xg.i(e)}unsubscribeDataChanged(e){this.xg._(e)}
7472applyOptions(e){this.Jn.hr(e)}options(){return Qh(this.Jn.N())}priceScale(){return this.Pg.priceScale(this.Jn.Ft().ma(),this.getPane().paneIndex())}createPriceLine(e){const n=jc(Qh(FZe),e),i=this.Jn.Oh(n);return new rY(i)}removePriceLine(e){this.Jn.Nh(e.Sg())}priceLines(){return this.Jn.Fh().map((e=>new rY(e)))}seriesType(){return this.Jn.Rr()}lastValueData(e){const n=this.Jn.ye(e);return n.ke?{noData:!0}:{noData:!1,price:n.gt,color:n.R}}attachPrimitive(e){this.Jn._a(e),e.attached&&e.attached({chart:this.bg,series:this,requestUpdate:()=>this.Jn.Qt().Ih(),horzScaleBehavior:this.o_})}detachPrimitive(e){this.Jn.ua(e),e.detached&&e.detached(),this.Jn.Qt().Ih()}getPane(){const e=this.Jn,n=gt(this.Jn.Qt().Hn(e));return this.yg(n)}moveToPane(e){this.Jn.Qt().Nc(this.Jn,e)}seriesOrder(){const e=this.Jn.Qt().Hn(this.Jn);return e===null?-1:e.Oo().indexOf(this.Jn)}setSeriesOrder(e){const n=this.Jn.Qt().Hn(this.Jn);n!==null&&n.Qo(this.Jn,e)}Tg(e){this.xg.v()&&this.xg.p(e)}}class VZe{constructor(e,n,i){this.Vg=new rr,this.z_=new rr,this.gm=new rr,this.ts=e,this.uh=e.Et(),this.Zm=n,this.uh.Vu().i(this.Bg.bind(this)),this.uh.Bu().i(this.Ig.bind(this)),this.Zm.ym().i(this.Eg.bind(this)),this.o_=i}m(){this.uh.Vu().u(this),this.uh.Bu().u(this),this.Zm.ym().u(this),this.Vg.m(),this.z_.m(),this.gm.m()}scrollPosition(){return this.uh.gu()}
7472scrollToPosition(e,n){n?this.uh.Tu(e,1e3):this.ts.fn(e)}scrollToRealTime(){this.uh.ku()}getVisibleRange(){const e=this.uh.nu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const n={from:this.o_.convertHorzItemToInternal(e.from),to:this.o_.convertHorzItemToInternal(e.to)},i=this.uh.au(n);this.ts.Lc(i)}getVisibleLogicalRange(){const e=this.uh.su();return e===null?null:{from:e.Uh(),to:e.bi()}}setVisibleLogicalRange(e){vo(e.from<=e.to,"The from index cannot be after the to index."),this.ts.Lc(e)}resetTimeScale(){this.ts.cn()}fitContent(){this.ts.Au()}logicalToCoordinate(e){const n=this.ts.Et();return n.Ki()?null:n.qt(e)}coordinateToLogical(e){return this.uh.Ki()?null:this.uh.cu(e)}timeToIndex(e,n){const i=this.o_.convertHorzItemToInternal(e);return this.uh.Q_(i,n)}timeToCoordinate(e){const n=this.timeToIndex(e,!1);return n===null?null:this.uh.qt(n)}coordinateToTime(e){const n=this.ts.Et(),i=n.cu(e),s=n.ss(i);return s===null?null:s.originalTime}width(){return this.Zm.Gf().width}height(){return this.Zm.Gf().height}subscribeVisibleTimeRangeChange(e){this.Vg.i(e)}unsubscribeVisibleTimeRangeChange(e){this.Vg._(e)}subscribeVisibleLogicalRangeChange(e){this.z_.i(e)}unsubscribeVisibleLogicalRangeChange(e){this.z_._(e)}subscribeSizeChange(e){this.gm.i(e)}unsubscribeSizeChange(e){this.gm._(e)}applyOptions(e){this.uh.hr(e)}options(){return{...Qh(this.uh.N()),barSpacing:this.uh.mu()}}Bg(){this.Vg.v()&&this.Vg.p(this.getVisibleRange())}Ig(){this.z_.v()&&this.z_.p(this.getVisibleLogicalRange())}Eg(e){this.gm.p(e.width,e.height)}}function oY(t){return(function(e){if(Lx(e.handleScale)){const i=e.handleScale;e.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:i,axisDoubleClickReset:s}=e.handleScale;Lx(i)&&(e.handleScale.axisPressedMouseMove={time:i,price:i}),Lx(s)&&(e.handleScale.axisDoubleClickReset={time:s,price:s})}const n=e.handleScroll;Lx(n)&&(e.handleScroll={horzTouchDrag:n,vertTouchDrag:n,mouseWheel:n,pressedMouseMove:n})})(t),t}class WZe{constructor(e,n,i){this.Ag=new Map,this.zg=new Map,this.Lg=new rr,this.Og=new rr,this.Ng=new rr,this.qu=new WeakMap,this.Fg=new CZe(n);const s=i===void 0?Qh(sY()):jc(Qh(sY()),oY(i));this.Wg=n,this.Hf=new fZe(e,s,n),this.Hf.Xv().i((o=>{this.Lg.v()&&this.Lg.p(this.Hg(o()))}),this),this.Hf.Zv().i((o=>{this.Og.v()&&this.Og.p(this.Hg(o()))}),this),this.Hf.cc().i((o=>{this.Ng.v()&&this.Ng.p(this.Hg(o()))}),this);const r=this.Hf.Qt();this.Ug=new VZe(r,this.Hf.iw(),this.Wg)}remove(){this.Hf.Xv().u(this),this.Hf.Zv().u(this),this.Hf.cc().u(this),this.Ug.m(),this.Hf.m(),this.Ag.clear(),this.zg.clear(),this.Lg.m(),this.Og.m(),this.Ng.m(),this.Fg.m()}resize(e,n,i){this.autoSizeActive()||this.Hf.Jm(e,n,i)}addCustomSeries(e,n={},i=0){const s=(r=>({type:"Custom",isBuiltIn:!1,defaultOptions:{...kZe,...r.defaultOptions()},$g:NZe,qg:r}))(ap(e));return this.Yg(s,n,i)}addSeries(e,n={},i=0){return this.Yg(e,n,i)}removeSeries(e){const n=ic(this.Ag.get(e)),i=this.Fg.Ac(n);this.Hf.Qt().Ac(n),this.jg(i),this.Ag.delete(e),this.zg.delete(n)}kg(e,n){this.jg(this.Fg.Ww(e,n))}Rg(e,n,i){this.jg(this.Fg.jw(e,n,i))}Dg(e,n){const[i,s]=this.Fg.Zw(e,n);return i.length!==0&&this.jg(s),i}subscribeClick(e){this.Lg.i(e)}unsubscribeClick(e){this.Lg._(e)}subscribeCrosshairMove(e){this.Ng.i(e)}unsubscribeCrosshairMove(e){this.Ng._(e)}subscribeDblClick(e){this.Og.i(e)}unsubscribeDblClick(e){this.Og._(e)}priceScale(e,n=0){return new Ooe(this.Hf,e,n)}timeScale(){return this.Ug}applyOptions(e){this.Hf.hr(oY(e))}options(){return this.Hf.N()}takeScreenshot(e=!1,n=!1){let i,s;try{n||(i=this.Hf.Qt().N().crosshair.mode,this.Hf.hr({crosshair:{mode:2}})),s=this.Hf.aw(e)}finally{n||i===void 0||this.Hf.Qt().hr({crosshair:{mode:i}})}return s}addPane(e=!1){const n=this.Hf.Qt().$c();return n.zo(e),this.Kg(n)}removePane(e){this.Hf.Qt().fc(e)}swapPanes(e,n){this.Hf.Qt().mc(e,n)}autoSizeActive(){return this.Hf.cw()}chartElement(){return this.Hf.ip()}panes(){return this.Hf.Qt().$s().map((e=>this.Kg(e)))}paneSize(e=0){const n=this.Hf.pw(e);return{height:n.height,width:n.width}}setCrosshairPosition(e,n,i){const s=this.Ag.get(i);if(s===void 0)return;const r=this.Hf.Qt().Hn(s);r!==null&&this.Hf.Qt().Rc(e,n,r)}clearCrosshairPosition(){this.Hf.Qt().Dc(!0)}horzBehaviour(){return this.Wg}Yg(e,n={},i=0){vo(e.$g!==void 0),(function(c){if(c===void 0||c.type==="custom")return;const l=c;l.minMove!==void 0&&l.precision===void 0&&(l.precision=Roe(l.minMove))})(n.priceFormat),e.type==="Candlestick"&&(function(c){c.borderColor!==void 0&&(c.borderUpColor=c.borderColor,c.borderDownColor=c.borderColor),c.wickColor!==void 0&&(c.wickUpColor=c.wickColor,c.wickDownColor=c.wickColor)})(n);const s=jc(Qh(moe),Qh(e.defaultOptions),n),r=e.$g,o=new WS(this.Hf.Qt(),e.type,s,r,e.qg);this.Hf.Qt().Ic(o,i);const a=new jZe(o,this,this,this,this.Wg,(c=>this.Kg(c)));return this.Ag.set(a,o),this.zg.set(o,a),a}jg(e){const n=this.Hf.Qt();n.Vc(e.Et._u,e.Et.tg,e.Et.ig),e.Oo.forEach(((i,s)=>s.ht(i.se,i.Qw))),n.Et().K_(),n.vu()}Xg(e){return ic(this.zg.get(e))}Hg(e){const n=new Map;e.Dw.forEach(((s,r)=>{const o=r.Rr(),a=SE(o)(s);if(o!=="Custom")vo(mZe(a));else{const c=r.fa();
7472vo(!c||c(a)===!1)}n.set(this.Xg(r),a)}));const i=e.Rw!==void 0&&this.zg.has(e.Rw)?this.Xg(e.Rw):void 0;return{time:e.yw,logical:e.Re,point:e.kw,paneIndex:e.Tw,hoveredSeries:i,hoveredObjectId:e.Vw,seriesData:n,sourceEvent:e.Bw}}Kg(e){let n=this.qu.get(e);return n||(n=new BZe(this.Hf,(i=>this.Xg(i)),e,this),this.qu.set(e,n)),n}}function qZe(t){if(b4(t)){const e=document.getElementById(t);return vo(e!==null,`Cannot find element in DOM with id=${t}`),e}return t}function zZe(t,e,n){const i=qZe(t),s=new WZe(i,e,n);return e.setOptions(s.options()),s}function Moe(t,e){return zZe(t,new WK,WK.ld(e))}class Loe extends wL{constructor(e,n){super(e,n,!0)}fg(e,n,i){n.uu(this.rg,X5(this.hg)),e.Ul(this.rg,i,X5(this.hg))}Zg(e,n){return{wt:e,gt:n,_t:NaN,ut:NaN}}cg(){const e=this.Jn.Rh();this.rg=this.Jn.Xs().Hr().map((n=>{const i=n.Wt[3];return this.Gg(n.Re,i,e)}))}}function $oe(t,e,n,i,s,r,o){if(e.length===0||i.from>=e.length||i.to<=0)return;const{context:a,horizontalPixelRatio:c,verticalPixelRatio:l}=t,d=e[i.from];let h=r(t,d),p=d;if(i.to-i.from<2){const g=s/2;a.beginPath();const b={_t:d._t-g,ut:d.ut},w={_t:d._t+g,ut:d.ut};a.moveTo(b._t*c,b.ut*l),a.lineTo(w._t*c,w.ut*l),o(t,h,b,w)}else{const g=(w,C)=>{o(t,h,p,C),a.beginPath(),h=w,p=C};let b=p;a.beginPath(),a.moveTo(d._t*c,d.ut*l);for(let w=i.from+1;w<i.to;++w){b=e[w];const C=r(t,b);switch(n){case 0:a.lineTo(b._t*c,b.ut*l);break;case 1:a.lineTo(b._t*c,e[w-1].ut*l),C!==h&&(g(C,b),a.lineTo(b._t*c,e[w-1].ut*l)),a.lineTo(b._t*c,b.ut*l);break;case 2:{const[E,T]=HZe(e,w-1,w);a.bezierCurveTo(E._t*c,E.ut*l,T._t*c,T.ut*l,b._t*c,b.ut*l);break}}n!==1&&C!==h&&(g(C,b),a.moveTo(b._t*c,b.ut*l))}(p!==b||p===b&&n===1)&&o(t,h,p,b)}}const aY=6;function gN(t,e){return{_t:t._t-e._t,ut:t.ut-e.ut}}function cY(t,e){return{_t:t._t/e,ut:t.ut/e}}function HZe(t,e,n){const i=Math.max(0,e-1),s=Math.min(t.length-1,n+1);var r,o;return[(r=t[e],o=cY(gN(t[n],t[i]),aY),{_t:r._t+o._t,ut:r.ut+o.ut}),gN(t[n],cY(gN(t[s],t[e]),aY))]}function GZe(t,e){const n=t.context;n.strokeStyle=e,n.stroke()}class KZe extends Yp{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et(e){if(this.rt===null)return;const{ot:n,lt:i,Jg:s,Qg:r,ct:o,Xt:a,tM:c}=this.rt;if(i===null)return;const l=e.context;l.lineCap="butt",l.lineWidth=o*e.verticalPixelRatio,Up(l,a),l.lineJoin="round";const d=this.iM.bind(this);r!==void 0&&$oe(e,n,r,i,s,d,GZe),c&&(function(h,p,g,b,w){if(b.to-b.from<=0)return;const{horizontalPixelRatio:C,verticalPixelRatio:E,context:T}=h;let A=null;const k=Math.max(1,Math.floor(C))%2/2,R=g*E+k;for(let P=b.to-1;P>=b.from;--P){const B=p[P];if(B){const F=w(h,B);F!==A&&(T.beginPath(),A!==null&&T.fill(),T.fillStyle=F,A=F);const z=Math.round(B._t*C)+k,K=B.ut*E;T.moveTo(z,K),T.arc(z,K,R,0,2*Math.PI)}}T.fill()})(e,n,c,i,d)}}class Uoe extends KZe{iM(e,n){return n.vt}}class YZe extends Loe{constructor(){super(...arguments),this.og=new Uoe}Gg(e,n,i){return{...this.Zg(e,n),...i.Dr(e)}}pg(){const e=this.Jn.N(),n={ot:this.rg,Xt:e.lineStyle,Qg:e.lineVisible?e.lineType:void 0,ct:e.lineWidth,tM:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,lt:this.hg,Jg:this.Qn.Et().mu()};this.og.ht(n)}}const ZZe={type:"Line",isBuiltIn:!0,defaultOptions:{color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},$g:(t,e)=>new YZe(t,e)};function QZe(t,e,n,i,s){const{context:r,horizontalPixelRatio:o,verticalPixelRatio:a}=e;r.lineTo(s._t*o,t*a),r.lineTo(i._t*o,t*a),r.closePath(),r.fillStyle=n,r.fill()}class XZe extends Yp{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et(e){if(this.rt===null)return;const{ot:n,lt:i,Jg:s,ct:r,Xt:o,Qg:a}=this.rt,c=this.rt.lM??(this.rt.oM?0:e.mediaSize.height);if(i===null)return;const l=e.context;l.lineCap="butt",l.lineJoin="round",l.lineWidth=r,Up(l,o),l.lineWidth=1,$oe(e,n,a,i,s,this._M.bind(this),QZe.bind(null,c))}}class JZe{uM(e,n){const i=this.cM,{dM:s,fM:r,pM:o,vM:a,lM:c,mM:l,wM:d}=n;if(this.gM===void 0||i===void 0||i.dM!==s||i.fM!==r||i.pM!==o||i.vM!==a||i.lM!==c||i.mM!==l||i.wM!==d){const{verticalPixelRatio:h}=e,p=c||l>0?h:1,g=l*p,b=d===e.bitmapSize.height?d:d*p,w=(c??0)*p,C=e.context.createLinearGradient(0,g,0,b);if(C.addColorStop(0,s),c!=null){const E=R2((w-g)/(b-g),0,1);C.addColorStop(E,r),C.addColorStop(E,o)}C.addColorStop(1,a),this.gM=C,this.cM=n}return this.gM}}class eQe extends XZe{constructor(){super(...arguments),this.MM=new JZe}_M(e,n){var i;return this.MM.uM(e,{dM:n.mr,fM:"",pM:"",vM:n.wr,mM:((i=this.rt)==null?void 0:i.mM)??0,wM:e.bitmapSize.height})}}class tQe extends Loe{constructor(e,n){super(e,n),this.og=new yoe,this.CM=new eQe,this.PM=new Uoe,this.og.st([this.CM,this.PM])}Gg(e,n,i){return{...this.Zg(e,n),...i.Dr(e)}}pg(){const e=this.Jn.N();if(this.hg===null||this.rg.length===0)return;let n;if(e.relativeGradient){n=this.rg[this.hg.from].ut;for(let i=this.hg.from;i<this.hg.to;i++){const s=this.rg[i];s.ut<n&&(n=s.ut)}}this.CM.ht({Qg:e.lineType,ot:this.rg,Xt:e.lineStyle,ct:e.lineWidth,lM:null,mM:n,oM:e.invertFilledArea,lt:this.hg,Jg:this.Qn.Et().mu()}),this.PM.ht({Qg:e.lineVisible?e.lineType:void 0,ot:this.rg,Xt:e.lineStyle,ct:e.lineWidth,lt:this.hg,Jg:this.Qn.Et().mu(),tM:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}}const Boe={type:"Area",isBuiltIn:!0,defaultOptions:{topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,relativeGradient:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroun
7472dColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},$g:(t,e)=>new tQe(t,e)};class nQe extends wL{constructor(e,n){super(e,n,!1)}fg(e,n,i){n.uu(this.rg,X5(this.hg)),e.ql(this.rg,i,X5(this.hg))}VM(e,n,i){return{wt:e,qh:n.Wt[0],Yh:n.Wt[1],jh:n.Wt[2],Kh:n.Wt[3],_t:NaN,Yl:NaN,jl:NaN,Kl:NaN,Xl:NaN}}cg(){const e=this.Jn.Rh();this.rg=this.Jn.Xs().Hr().map((n=>this.Gg(n.Re,n,e)))}}class iQe extends Yp{constructor(){super(...arguments),this.Yt=null,this.yM=0}ht(e){this.Yt=e}et(e){if(this.Yt===null||this.Yt.Xs.length===0||this.Yt.lt===null)return;const{horizontalPixelRatio:n}=e;this.yM=(function(r,o){if(r>=2.5&&r<=4)return Math.floor(3*o);const a=1-.2*Math.atan(Math.max(4,r)-4)/(.5*Math.PI),c=Math.floor(r*a*o),l=Math.floor(r*o),d=Math.min(c,l);return Math.max(Math.floor(o),d)})(this.Yt.mu,n),this.yM>=2&&Math.floor(n)%2!=this.yM%2&&this.yM--;const i=this.Yt.Xs;this.Yt.BM&&this.IM(e,i,this.Yt.lt),this.Yt.Mi&&this.uv(e,i,this.Yt.lt);const s=this.EM(n);(!this.Yt.Mi||this.yM>2*s)&&this.AM(e,i,this.Yt.lt)}IM(e,n,i){if(this.Yt===null)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:o}=e;let a="",c=Math.min(Math.floor(r),Math.floor(this.Yt.mu*r));c=Math.max(Math.floor(r),Math.min(c,this.yM));const l=Math.floor(.5*c);let d=null;for(let h=i.from;h<i.to;h++){const p=n[h];p.pr!==a&&(s.fillStyle=p.pr,a=p.pr);const g=Math.round(Math.min(p.Yl,p.Xl)*o),b=Math.round(Math.max(p.Yl,p.Xl)*o),w=Math.round(p.jl*o),C=Math.round(p.Kl*o);let E=Math.round(r*p._t)-l;const T=E+c-1;d!==null&&(E=Math.max(d+1,E),E=Math.min(E,T));const A=T-E+1;s.fillRect(E,w,A,g-w),s.fillRect(E,b+1,A,C-b),d=T}}EM(e){let n=Math.floor(1*e);this.yM<=2*n&&(n=Math.floor(.5*(this.yM-1)));const i=Math.max(Math.floor(e),n);return this.yM<=2*i?Math.max(Math.floor(e),Math.floor(1*e)):i}uv(e,n,i){if(this.Yt===null)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:o}=e;let a="";const c=this.EM(r);let l=null;for(let d=i.from;d<i.to;d++){const h=n[d];h.dr!==a&&(s.fillStyle=h.dr,a=h.dr);let p=Math.round(h._t*r)-Math.floor(.5*this.yM);const g=p+this.yM-1,b=Math.round(Math.min(h.Yl,h.Xl)*o),w=Math.round(Math.max(h.Yl,h.Xl)*o);if(l!==null&&(p=Math.max(l+1,p),p=Math.min(p,g)),this.Yt.mu*r>2*c)sYe(s,p,b,g-p+1,w-b+1,c);else{const C=g-p+1;s.fillRect(p,b,C,w-b+1)}l=g}}AM(e,n,i){if(this.Yt===null)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:o}=e;let a="";const c=this.EM(r);for(let l=i.from;l<i.to;l++){const d=n[l];let h=Math.round(Math.min(d.Yl,d.Xl)*o),p=Math.round(Math.max(d.Yl,d.Xl)*o),g=Math.round(d._t*r)-Math.floor(.5*this.yM),b=g+this.yM-1;if(d.cr!==a){const w=d.cr;s.fillStyle=w,a=w}this.Yt.Mi&&(g+=c,h+=c,b-=c,p-=c),h>p||s.fillRect(g,h,b-g+1,p-h+1)}}}class sQe extends nQe{constructor(){super(...arguments),this.og=new iQe}Gg(e,n,i){return{...this.VM(e,n,i),...i.Dr(e)}}pg(){const e=this.Jn.N();this.og.ht({Xs:this.rg,mu:this.Qn.Et().mu(),BM:e.wickVisible,Mi:e.borderVisible,lt:this.hg})}}const rQe={type:"Candlestick",isBuiltIn:!0,defaultOptions:{upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},$g:(t,e)=>new sQe(t,e)};class oQe{constructor(e,n){this.Pt=e,this.FM=n,this.WM()}detach(){this.Pt.detachPrimitive(this.FM)}getPane(){return this.Pt}applyOptions(e){var n,i;(i=(n=this.FM).hr)==null||i.call(n,e)}WM(){this.Pt.attachPrimitive(this.FM)}}const aQe={visible:!0,horzAlign:"center",vertAlign:"center",lines:[]},cQe={color:"rgba(0, 0, 0, 0.5)",fontSize:48,fontFamily:pL,fontStyle:"",text:""};class lQe{constructor(e){this.HM=new Map,this.Yt=e}draw(e){e.useMediaCoordinateSpace((n=>{if(!this.Yt.visible)return;const{context:i,mediaSize:s}=n;let r=0;for(const a of this.Yt.lines){if(a.text.length===0)continue;i.font=a.k;const c=this.UM(i,a.text);c>s.width?a.Cu=s.width/c:a.Cu=1,r+=a.lineHeight*a.Cu}let o=0;switch(this.Yt.vertAlign){case"top":o=0;break;case"center":o=Math.max((s.height-r)/2,0);break;case"bottom":o=Math.max(s.height-r,0)}for(const a of this.Yt.lines){i.save(),i.fillStyle=a.color;let c=0;switch(this.Yt.horzAlign){case"left":i.textAlign="left",c=a.lineHeight/2;break;case"center":i.textAlign="center",c=s.width/2;break;case"right":i.textAlign="right",c=s.width-1-a.lineHeight/2}i.translate(c,o),i.textBaseline="top",i.font=a.k,i.scale(a.Cu,a.Cu),i.fillText(a.text,0,a.$M),i.restore(
7472),o+=a.lineHeight*a.Cu}}))}UM(e,n){const i=this.qM(e.font);let s=i.get(n);return s===void 0&&(s=e.measureText(n).width,i.set(n,s)),s}qM(e){let n=this.HM.get(e);return n===void 0&&(n=new Map,this.HM.set(e,n)),n}}class uQe{constructor(e){this.Ps=lY(e)}yt(e){this.Ps=lY(e)}renderer(){return new lQe(this.Ps)}}function dQe(t){return{...t,k:J5(t.fontSize,t.fontFamily,t.fontStyle),lineHeight:t.lineHeight||1.2*t.fontSize,$M:0,Cu:0}}function lY(t){return{...t,lines:t.lines.map(dQe)}}function hQe(t){return{...cQe,...t}}function uY(t){var e;return{...aQe,...t,lines:((e=t.lines)==null?void 0:e.map(hQe))??[]}}class fQe{constructor(e){this.Ps=uY(e),this.YM=[new uQe(this.Ps)]}updateAllViews(){this.YM.forEach((e=>e.yt(this.Ps)))}paneViews(){return this.YM}attached({requestUpdate:e}){this.jM=e}detached(){this.jM=void 0}hr(e){this.Ps=uY({...this.Ps,...e}),this.jM&&this.jM()}}function pQe(t,e){return new oQe(t,new fQe(e))}({...moe});const Zd={"1H":{period:"hour",limit:168,groupBy:1,sampling:1,staleTime:60*1e3,refetchInterval:60*1e3},"4H":{period:"hour",limit:168,groupBy:4,sampling:1,staleTime:300*1e3,refetchInterval:300*1e3},"1D":{period:"hour",limit:720,groupBy:1,sampling:1,staleTime:600*1e3,refetchInterval:600*1e3},"1W":{period:"hour",limit:1e3,groupBy:4,sampling:4,staleTime:1800*1e3,refetchInterval:1800*1e3},"1M":{period:"day",limit:365,groupBy:1,sampling:1,staleTime:3600*1e3,refetchInterval:3600*1e3},"1Y":{period:"day",limit:365,groupBy:1,sampling:1,staleTime:3600*1e3,refetchInterval:3600*1e3},ALL:{period:"day",limit:1e3,groupBy:1,sampling:1,staleTime:3600*1e3,refetchInterval:3600*1e3}},dY=(t,e,n,i)=>{const s=Zd[n],r=s.period==="hour"?"poolHourDatas":"poolDayDatas",o=s.period==="hour"?"periodStartUnix":"date";return` 7473 query GetPoolChartData { 7474 ${r}( 7475 where: { pool: "${t}" } 7476 orderBy: "${o}" 7477 orderDirection: "desc" 7478 limit: ${i} 7479 ) { 7480 items { 7481 id 7482 ${o} 7483 pool { 7484 id 7485 token0 7486 token1 7487 feeTier 7488 token0Ref { 7489 symbol 7490 name 7491 } 7492 token1Ref { 7493 symbol 7494 name 7495 } 7496 } 7497 tvlUSD 7498 volumeUSD 7499 feesUSD 7500 token0Price 7501 token1Price 7502 t0open 7503 t0high 7504 t0low 7505 t0close 7506 t1open 7507 t1high 7508 t1low 7509 t1close 7510 } 7511 } 7512 } 7513 `},mQe=(t,e,n,i)=>{const s=Zd[n],r=s.period==="hour"?"tokenHourDatas":"tokenDayDatas",o=s.period==="hour"?"periodStartUnix":"date",a=t.toLowerCase();return` 7514 query GetTokenChartData { 7515 ${r}( 7516 where: { token: "${a}" } 7517 orderBy: "${o}" 7518 orderDirection: "desc" 7519 limit: ${i} 7520 ) { 7521 items { 7522 id 7523 ${o} 7524 token { 7525 id 7526 symbol 7527 name 7528 } 7529 priceUSD 7530 volumeUSD 7531 totalValueLockedUSD 7532 feesUSD 7533 open 7534 high 7535 low 7536 close 7537 } 7538 } 7539 } 7540 `},Foe=["0x456c957454dCF68F75af885905Faaac35C14EeCe".toLowerCase()],gQe=(t,e,n,i)=>{const s=Zd[n],r=Foe.includes(t.toLowerCase()),o=r?s.period==="hour"?"erc4626HourDatas":"erc4626DayDatas":s.period==="hour"?"vaultHourDatas":"vaultDayDatas",a=s.period==="hour"?"periodStartUnix":"date",c=r?"erc4626Vault":"vault",l=s.period==="day"?` 7541 volumeUSD1D 7542 volumeUSD30D`:"";return r?` 7543 query GetERC4626VaultChartData { 7544 ${o}( 7545 where: { ${c}: "${t}" } 7546 orderBy: "${a}" 7547 orderDirection: "desc" 7548 limit: ${i} 7549 ) { 7550 items { 7551 id 7552 ${a} 7553 totalValueLockedUSD${l} 7554 } 7555 } 7556 } 7557 `:` 7558 query GetVaultChartData { 7559 ${o}( 7560 where: { ${c}: "${t}" } 7561 orderBy: "${a}" 7562 orderDirection: "desc" 7563 limit: ${i} 7564 ) { 7565 items { 7566 id 7567 ${a} 7568 totalValueLockedUSD 7569 collectedFeesUSD 7570 tradingVolumeUSD 7571 depositWithdrawVolumeUSD${l} 7572 } 7573 } 7574 } 7575 `},yQe=(t,e)=>{const n=Zd[e];if(n.groupBy===1)return t;if(n.period==="hour"){const i=t,s=[];for(let r=0;r<i.length;r+=n.groupBy){const o=i.slice(r,r+n.groupBy);if(o.length===0)continue;const a=o[o.length-1],c=o.reduce((l,d)=>{const h="tradingVolumeUSD"in d?parseFloat(d.tradingVolumeUSD||"0"):0,p="depositWithdrawVolumeUSD"in d?parseFloat(d.depositWithdrawVolumeUSD||"0"):0;return l+h+p},0);s.push({...a,tradingVolumeUSD:"tradingVolumeUSD"in a?c.toString():"0",depositWithdrawVolumeUSD:("depositWithdrawVolumeUSD"in a,"0")})}return s}else{const i=t,s=[];for(let r=0;r<i.length;r+=n.groupBy){const o=i.slice(r,r+n.groupBy);if(o.length===0)continue;const a=o[o.length-1],c=o.reduce((l,d)=>{const h="tradingVolumeUSD"in d?parseFloat(d.tradingVolumeUSD||"0"):0,p="depositWithdrawVolumeUSD"in d?parseFloat(d.depositWithdrawVolumeUSD||"0"):0;return l+h+p},0);s.push({...a,tradingVolumeUSD:"tradingVolumeUSD"in a?c.toString():"0",depositWithdrawVolumeUSD:("depositWithdrawVolumeUSD"in a,"0")})}return s}},bQe=(t,e)=>{const n=Zd[e];if(n.groupBy===1)return t;const i=[],s=[...t].sort((r,o)=>{const a="periodStartUnix"in r?r.periodStartUnix:r.date,c="periodStartUnix"in o?o.periodStartUnix:o.date;return a-c});for(let r=0;r<s.length;r+=n.groupBy){const o=s.slice(r,r+n.groupBy);if(o.length===0)continue;const a={...o[0]};if("periodStartUnix"in a){if(n.period==="hour"&&n.groupBy===4){const c=Math.floor(a.periodStartUnix/3600),l=Math.floor(c/4)*4;
7575a.periodStartUnix=l*3600}}else if("date"in a&&n.period==="day"){if(n.groupBy===7){const c=new Date(a.date*1e3),l=c.getDay(),d=l===0?6:l-1;c.setDate(c.getDate()-d),a.date=Math.floor(c.getTime()/1e3)}else if(n.groupBy===30){const c=new Date(a.date*1e3);c.setDate(1),a.date=Math.floor(c.getTime()/1e3)}}a.tvlUSD=(o.reduce((c,l)=>c+parseFloat(l.tvlUSD),0)/o.length).toString(),a.volumeUSD=(o.reduce((c,l)=>c+parseFloat(l.volumeUSD),0)/o.length).toString(),a.feesUSD=(o.reduce((c,l)=>c+parseFloat(l.feesUSD),0)/o.length).toString(),a.token0Price=(o.reduce((c,l)=>c+parseFloat(l.token0Price),0)/o.length).toString(),a.token1Price=(o.reduce((c,l)=>c+parseFloat(l.token1Price),0)/o.length).toString(),a.t0open=o[0].t0open,a.t0high=Math.max(...o.map(c=>parseFloat(c.t0high))).toString(),a.t0low=Math.min(...o.map(c=>parseFloat(c.t0low))).toString(),a.t0close=o[o.length-1].t0close,a.t1open=o[0].t1open,a.t1high=Math.max(...o.map(c=>parseFloat(c.t1high))).toString(),a.t1low=Math.min(...o.map(c=>parseFloat(c.t1low))).toString(),a.t1close=o[o.length-1].t1close,i.push(a)}return i},wQe=(t,e)=>{const n=Zd[e];if(n.groupBy===1)return t;const i=[],s=[...t].sort((r,o)=>{const a="periodStartUnix"in r?r.periodStartUnix:r.date,c="periodStartUnix"in o?o.periodStartUnix:o.date;return a-c});for(let r=0;r<s.length;r+=n.groupBy){const o=s.slice(r,r+n.groupBy);if(o.length===0)continue;const a={...o[0]};if("periodStartUnix"in a){if(n.period==="hour"&&n.groupBy===4){const c=Math.floor(a.periodStartUnix/3600),l=Math.floor(c/4)*4;a.periodStartUnix=l*3600}}else if("date"in a&&n.period==="day"){if(n.groupBy===7){const c=new Date(a.date*1e3),l=c.getDay(),d=l===0?6:l-1;c.setDate(c.getDate()-d),a.date=Math.floor(c.getTime()/1e3)}else if(n.groupBy===30){const c=new Date(a.date*1e3);c.setDate(1),a.date=Math.floor(c.getTime()/1e3)}}a.priceUSD=(o.reduce((c,l)=>c+parseFloat(l.priceUSD),0)/o.length).toString(),a.volumeUSD=(o.reduce((c,l)=>c+parseFloat(l.volumeUSD),0)/o.length).toString(),a.totalValueLockedUSD=(o.reduce((c,l)=>c+parseFloat(l.totalValueLockedUSD),0)/o.length).toString(),a.feesUSD=(o.reduce((c,l)=>c+parseFloat(l.feesUSD),0)/o.length).toString(),a.open=o[0].open,a.high=Math.max(...o.map(c=>parseFloat(c.high))).toString(),a.low=Math.min(...o.map(c=>parseFloat(c.low))).toString(),a.close=o[o.length-1].close,i.push(a)}return i},hY=(t,e,n,i,s,r)=>{var p,g;if(!t||t.length===0)return[];const c=[...bQe(t,i)].sort((b,w)=>{const C="periodStartUnix"in b?b.periodStartUnix:b.date,E="periodStartUnix"in w?w.periodStartUnix:w.date;return C-E}).reduce((b,w)=>{const C="periodStartUnix"in w?w.periodStartUnix:w.date,E=b.findIndex(T=>("periodStartUnix"in T?T.periodStartUnix:T.date)===C);return E===-1?b.push(w):b[E]=w,b},[]),l=Zd[i];let d=c;l.sampling&&l.sampling>1&&(d=c.filter((b,w)=>w%l.sampling===0));let h=!1;if(s&&r&&d.length>0&&d[0].pool){const b=(p=d[0].pool.token0)==null?void 0:p.toLowerCase(),w=(g=d[0].pool.token1)==null?void 0:g.toLowerCase(),C=s.toLowerCase(),E=r.toLowerCase();if(!b||!w)console.warn("[Chart Price Direction] Pool tokens not found in data");else{const T=C===b,A=C===w,k=E===b,R=E===w;if(h=A&&k,e==="price"&&d.length>0){const P=d[0],B=parseFloat(P.token1Price),F=parseFloat(P.token0Price),z=h&&B>0?1/B:B;console.log("[Chart Price Direction]",{fromToken:C,toToken:E,poolToken0:b,poolToken1:w,isFromToken0:T,isFromToken1:A,isToToken0:k,isToToken1:R,shouldInvertPrice:h,token0Price:F,token1Price:B,calculatedPrice:z,firstDataPoint:{token0Price:P.token0Price,token1Price:P.token1Price,pool:P.pool?{token0:P.pool.token0,token1:P.pool.token1}:null}})}}}else e==="price"&&console.warn("[Chart Price Direction] Missing data:",{hasFromToken:!!s,hasToToken:!!r,hasData:d.length>0,hasPool:d.length>0?!!d[0].pool:!1});return n==="candlestick"?d.map(b=>{let w,C,E,T;const A=parseFloat(b.t1open),k=parseFloat(b.t1high),R=parseFloat(b.t1low),P=parseFloat(b.t1close);return h&&A>0&&k>0&&R>0&&P>0?(w=1/A,C=1/R,E=1/k,T=1/P):(w=A,C=k,E=R,T=P),{time:"periodStartUnix"in b?b.periodStartUnix:b.date,open:w,high:C,low:E,close:T}}):d.map(b=>{let w=0;switch(e){case"tvl":w=parseFloat(b.tvlUSD);break;case"volume":w=parseFloat(b.volumeUSD);break;case"fees":w=parseFloat(b.feesUSD);break;case"price":default:const C=parseFloat(b.token1Price);C<=0||isNaN(C)?w=0:h?w=1/C:w=C,e==="price"&&d.indexOf(b)===d.length-1&&
7575console.log("[Chart Price Calculation]",{token1Price:C,shouldInvertPrice:h,calculatedValue:w,fromToken:s,toToken:r,item:{token0Price:b.token0Price,token1Price:b.token1Price,pool:b.pool?{token0:b.pool.token0,token1:b.pool.token1}:null}});break}return{time:"periodStartUnix"in b?b.periodStartUnix:b.date,value:w}})},vQe=(t,e,n,i)=>{if(!t||t.length===0)return[];const r=[...yQe(t,i)].sort((c,l)=>{const d="periodStartUnix"in c?c.periodStartUnix:c.date,h="periodStartUnix"in l?l.periodStartUnix:l.date;return d-h}),o=Zd[i];let a=r;return o.sampling&&o.sampling>1&&(a=r.filter((c,l)=>l%o.sampling===0)),a.map(c=>{let l=0;switch(e){case"tvl":l=parseFloat(c.totalValueLockedUSD);break;case"volume":if("volumeUSD1D"in c&&c.volumeUSD1D!==void 0)l=parseFloat(c.volumeUSD1D||"0");else{const d="tradingVolumeUSD"in c?parseFloat(c.tradingVolumeUSD||"0"):0,h="depositWithdrawVolumeUSD"in c?parseFloat(c.depositWithdrawVolumeUSD||"0"):0;l=d+h}break;case"fees":l="collectedFeesUSD"in c?parseFloat(c.collectedFeesUSD||"0"):0;break;case"price":default:l=parseFloat(c.totalValueLockedUSD);break}return{time:"periodStartUnix"in c?c.periodStartUnix:c.date,value:l}})},CQe=(t,e,n,i)=>{if(!t||t.length===0)return[];const o=[...wQe(t,i)].sort((l,d)=>{const h="periodStartUnix"in l?l.periodStartUnix:l.date,p="periodStartUnix"in d?d.periodStartUnix:d.date;return h-p}).reduce((l,d)=>{const h="periodStartUnix"in d?d.periodStartUnix:d.date,p=l.findIndex(g=>("periodStartUnix"in g?g.periodStartUnix:g.date)===h);return p===-1?l.push(d):l[p]=d,l},[]),a=Zd[i];let c=o;return a.sampling&&a.sampling>1&&(c=o.filter((l,d)=>d%a.sampling===0)),n==="candlestick"?c.map(l=>({time:"periodStartUnix"in l?l.periodStartUnix:l.date,open:parseFloat(l.open),high:parseFloat(l.high),low:parseFloat(l.low),close:parseFloat(l.close)})):c.map(l=>{let d=0;switch(e){case"tvl":d=parseFloat(l.totalValueLockedUSD);break;case"volume":d=parseFloat(l.volumeUSD);break;case"fees":d=parseFloat(l.feesUSD);break;case"price":default:d=parseFloat(l.priceUSD);break}return{time:"periodStartUnix"in l?l.periodStartUnix:l.date,value:d}})},xQe=t=>{if(!t||t.length===0)return null;const e=t.map(l=>"value"in l?l.value:l.close),n=Math.min(...e),i=Math.max(...e),s=e.reduce((l,d)=>l+d,0)/e.length,r=e[0],a=e[e.length-1]-r,c=r!==0?a/r*100:0;return{min:n,max:i,avg:s,change:a,changePercent:c}};function EQe(t,e,n,i="price",s="area",r="1D",o,a,c,l,d){const h=Zd[r],p=!!n,g=!!t&&!p,b=n||t||e,w=Zt({queryKey:["ponder-chart-data",b,i,s,r,o,a,c,l,d],enabled:!!b,queryFn:async()=>{var B,F,z,K,q,G,I,S,v,_,N,$,U,j,D,O;if(!b)throw new Error("Address is required");const T="https://sub.winnieswap.com",A=p?gQe(b,i,r,h.limit):g?dY(b,i,r,h.limit):mQe(b,i,r,h.limit);let k;try{const H=await fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:A})});if(!H.ok)throw new Error(`GraphQL error: ${H.status} ${H.statusText}`);if(k=await H.json(),k.errors)throw console.error("GraphQL Errors:",k.errors),console.error("GraphQL Query:",A),console.error("GraphQL URL:",T),console.error("Full GraphQL Response:",JSON.stringify(k,null,2)),new Error(k.errors[0].message||"GraphQL query failed")}catch(H){if(H instanceof TypeError||((B=H==null?void 0:H.message)==null?void 0:B.includes("fetch failed"))||((F=H==null?void 0:H.message)==null?void 0:F.includes("ECONNREFUSED"))||((z=H==null?void 0:H.message)==null?void 0:z.includes("Connection refused"))||((K=H==null?void 0:H.message)==null?void 0:K.includes("Failed to fetch")))return console.warn(`[usePonderChartData] Ponder GraphQL service is not available (${T}). This is normal if the Ponder indexer is not running. The chart will use fallback data.`),[];throw H}const R=p&&Foe.includes(b.toLowerCase()),P=p?R?((q=k.data.erc4626DayDatas)==null?void 0:q.items)||((G=k.data.erc4626HourDatas)==null?void 0:G.items)||[]:((I=k.data.vaultDayDatas)==null?void 0:I.items)||((S=k.data.vaultHourDatas)==null?void 0:S.items)||[]:g?((v=k.data.poolDayDatas)==null?void 0:v.items)||((_=k.data.poolHourDatas)==null?void 0:_.items)||[]:((N=k.data.tokenDayDatas)==null?void 0:N.items)||(($=k.data.tokenHourDatas)==null?void 0:$.items)||[];if(p&&(console.log(`[Vault Chart Debug] Interval: ${r}, Data type: ${h.period}, Data length: ${P.length}`),P.length>0&&(console.log("[Vault Chart Debug] First item:",P[0]),console.log("[Vault Chart Debug] Last item:",P[P.length-1]))),!p&&!g&&(!P||P.length===0)&&c&&l&&d){const H=dY(c,i,r,h.limit);try{const J=await fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:H})});if(!J.ok)return[];const W=await J.json();if(W.errors)return[];const Z=((j=(U=W.data)==null?void 0:U.poolDayDatas)==null?void 0:j.items)||((O=(D=W.data)==null?void 0:D.poolHourDatas)==null?void 0:O.items)||[];return Z.length===0?[]:hY(Z,i,s,r,l,d)}catch{return[]}}return p?vQe(P,i,s,r):g?hY(P,i,s,r,o,a):CQe(P,i,s,r)},staleTime:h.staleTime||300*1e3,gcTime:1440*60*1e3,refetchInterval:!1,retry:1,retryDelay:E=>Math.min(300*2**E,2e3),refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!0,placeholderData:E=>E,networkMode:"offlineFirst"}),C=M.useMemo(()=>w.data?xQe(w.data):null,[w.data]);return{...w,stats:C}}function CL(t,e,n){return Zt({queryKey:["pool-by-tokens",t,e,n],enabled:!!(t&&e),queryFn:async()=>
7575{if(!t||!e)return null;const s="https://sub.winnieswap.com",r=t.toLowerCase(),o=e.toLowerCase(),[a,c]=[r,o].sort((p,g)=>p.localeCompare(g)),l=` 7576 query GetPoolByTokens { 7577 pools( 7578 where: { 7579 OR: [ 7580 { token0: "${a}", token1: "${c}" }, 7581 { token0: "${c}", token1: "${a}" } 7582 ] 7583 7584 } 7585 limit: 1 7586 ) { 7587 items { 7588 id 7589 token0 7590 token1 7591 feeTier 7592 totalValueLockedUSD 7593 volumeUSD 7594 feesUSD 7595 token0Ref { 7596 symbol 7597 name 7598 } 7599 token1Ref { 7600 symbol 7601 name 7602 } 7603 } 7604 } 7605 } 7606 `,d=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:l})});if(!d.ok)throw new Error(`GraphQL error: ${d.status}`);const h=await d.json();if(h.errors)throw new Error(h.errors[0].message);return h.data.pools.items[0]||null},staleTime:300*1e3})}const _Qe=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:[m.jsx("path",{d:"M0 16V4l4-2 4 3 4-1 4-2v14H0z",opacity:"0.6"}),m.jsx("path",{d:"M0 4l4-2 4 3 4-1 4-2",stroke:"currentColor",strokeWidth:"2",fill:"none"})]}),SQe=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",children:m.jsx("path",{d:"M0 12l4-6 4 2 4-4 4-2",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),AQe=()=>m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:[m.jsx("rect",{x:"2",y:"4",width:"2",height:"8"}),m.jsx("rect",{x:"7",y:"2",width:"2",height:"12"}),m.jsx("rect",{x:"12",y:"6",width:"2",height:"6"}),m.jsx("line",{x1:"3",y1:"2",x2:"3",y2:"4",stroke:"currentColor",strokeWidth:"1"}),m.jsx("line",{x1:"3",y1:"12",x2:"3",y2:"14",stroke:"currentColor",strokeWidth:"1"}),m.jsx("line",{x1:"8",y1:"1",x2:"8",y2:"2",stroke:"currentColor",strokeWidth:"1"}),m.jsx("line",{x1:"8",y1:"14",x2:"8",y2:"15",stroke:"currentColor",strokeWidth:"1"}),m.jsx("line",{x1:"13",y1:"4",x2:"13",y2:"6",stroke:"currentColor",strokeWidth:"1"}),m.jsx("line",{x1:"13",y1:"12",x2:"13",y2:"14",stroke:"currentColor",strokeWidth:"1"})]}),fY={area:_Qe,line:SQe,candlestick:AQe},_m={price:"Price",tvl:"TVL",volume:"Volume",fees:"Fees"},TQe=({chartType:t,interval:e,metric:n,onChartTypeChange:i,onIntervalChange:s,onMetricChange:r,availableIntervals:o=["1H","4H","1D","1W","1M"],availableMetrics:a,isLoading:c=!1,hideMetricsDropdown:l=!1})=>{const[d,h]=kn.useState(null),[p,g]=kn.useState(null),[b,w]=kn.useState(!1),[C,E]=M.useState(!1),[T,A]=M.useState(!1),[k,R]=M.useState(!1),[P,B]=M.useState(!1),F=M.useRef(null),z=M.useRef(null),K=M.useRef(null),q=M.useRef(null),G=_=>{_!==e&&(g(e),w(d===_),s(_),h(null))};kn.useEffect(()=>{if(b){const _=setTimeout(()=>w(!1),200);return()=>clearTimeout(_)}},[b]),M.useEffect(()=>{const _=N=>{F.current&&!F.current.contains(N.target)&&A(!1),K.current&&!K.current.contains(N.target)&&E(!1),q.current&&!q.current.contains(N.target)&&B(!1),z.current&&!z.current.contains(N.target)&&R(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const I=_=>{r(_),E(!1),B(!1)},S=_=>{i(_),A(!1)},v=_=>{G(_),R(!1)};return m.jsxs("div",{className:"chart-toolbar",children:[m.jsx("div",{className:"chart-toolbar__desktop",children:m.jsxs("div",{className:"chart-toolbar__section chart-toolbar__section--left",children:[!l&&m.jsx("div",{className:"chart-toolbar__separator"}),!l&&m.jsxs("div",{className:"chart-toolbar__metrics-dropdown",ref:K,children:[m.jsxs("button",{className:`btn btn--tiny btn__accent ${C?"btn__main":""} ${c?"btn__disabled":""}`,onClick:()=>!c&&E(!C),disabled:c,children:[m.jsx("span",{className:"chart-toolbar__metrics-trigger-label",children:_m[n]}),m.jsx("svg",{className:`chart-toolbar__metrics-trigger-arrow ${C?"chart
7606-toolbar__metrics-trigger-arrow--open":""}`,width:"8",height:"8",viewBox:"0 0 12 8",fill:"none",children:m.jsx("path",{d:"M1 1.5L6 6.5L11 1.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),C&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"chart-toolbar__mobile-overlay",onClick:()=>E(!1)}),m.jsx("div",{className:"chart-toolbar__metrics-menu",children:(a||Object.keys(_m)).map(_=>{const N=n===_,$=_!=="price"&&t==="candlestick";return m.jsx("button",{className:`btn btn--tiny ${N?"btn__main":"btn__shade"} ${$?"btn__disabled":""}`,onClick:()=>!$&&I(_),disabled:$,title:$?"Candlestick only available for Price metric":_m[_],children:m.jsx("span",{className:"chart-toolbar__metrics-option-label",children:_m[_]})},_)})})]})]})]})}),m.jsx("div",{className:"chart-toolbar__mobile",children:m.jsxs("div",{className:"chart-toolbar__mobile-row",children:[m.jsxs("div",{className:"chart-toolbar__mobile-dropdown",ref:F,children:[m.jsxs("button",{className:`btn btn--small btn__accent ${T?"btn__main":""} ${c?"btn__disabled":""}`,onClick:()=>!c&&A(!T),disabled:c,children:[m.jsx("span",{className:"chart-toolbar__mobile-trigger-icon",children:kn.createElement(fY[t])}),m.jsx("svg",{className:`chart-toolbar__mobile-trigger-arrow ${T?"chart-toolbar__mobile-trigger-arrow--open":""}`,width:"12",height:"8",viewBox:"0 0 12 8",fill:"none",children:m.jsx("path",{d:"M1 1.5L6 6.5L11 1.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),T&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"chart-toolbar__mobile-overlay",onClick:()=>A(!1)}),m.jsx("div",{className:"chart-toolbar__mobile-menu chart-toolbar__mobile-menu--open",children:["area","line","candlestick"].map(_=>{const N=fY[_],$=t===_,U=_==="candlestick"&&n!=="price";return m.jsx("button",{className:`btn btn--small ${$?"btn__main":"btn__shade"} ${U?"btn__disabled":""}`,onClick:()=>!U&&S(_),disabled:U,children:m.jsx("span",{className:"chart-toolbar__mobile-option-icon",children:m.jsx(N,{})})},_)})})]})]}),m.jsxs("div",{className:"chart-toolbar__mobile-dropdown",ref:q,children:[m.jsxs("button",{className:`btn btn--small btn__accent ${P?"btn__main":""} ${c?"btn__disabled":""}`,onClick:()=>!c&&B(!P),disabled:c,children:[m.jsx("span",{className:"chart-toolbar__mobile-trigger-label",children:_m[n]}),m.jsx("svg",{className:`chart-toolbar__mobile-trigger-arrow ${P?"chart-toolbar__mobile-trigger-arrow--open":""}`,width:"12",height:"8",viewBox:"0 0 12 8",fill:"none",children:m.jsx("path",{d:"M1 1.5L6 6.5L11 1.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),P&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"chart-toolbar__mobile-overlay",onClick:()=>B(!1)}),m.jsx("div",{className:"chart-toolbar__mobile-menu chart-toolbar__mobile-menu--open",children:(a||Object.keys(_m)).map(_=>{const N=n===_,$=_!=="price"&&t==="candlestick";return m.jsx("button",{className:`btn btn--small ${N?"btn__main":"btn__shade"} ${$?"btn__disabled":""}`,onClick:()=>!$&&I(_),disabled:$,children:m.jsx("span",{className:"chart-toolbar__mobile-option-label",children:_m[_]})},_)})})]})]}),m.jsxs("div",{className:"chart-toolbar__mobile-dropdown",ref:z,children:[m.jsxs("button",{className:`btn btn--small btn__accent ${k?"btn__main":""} ${c?"btn__disabled":""}`,onClick:()=>!c&&R(!k),disabled:c,children:[m.jsx("span",{className:"chart-toolbar__mobile-trigger-label",children:e}),m.jsx("svg",{className:`chart-toolbar__mobile-trigger-arrow ${k?"chart-toolbar__mobile-trigger-arrow--open":""}`,width:"12",height:"8",viewBox:"0 0 12 8",fill:"none",children:m.jsx("path",{d:"M1 1.5L6 6.5L11 1.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),k&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"chart-toolbar__mobile-overlay",onClick:()=>R(!1)}),m.jsx("div",{className:"chart-toolbar__mobile-menu chart-toolbar__mobile-menu--open",children:o.map(_=>m.jsx("button",{className:`btn btn--small ${e===_?"btn__main":"btn__shade"}`,onClick:()=>v(_),children:m.jsx("span",{className:"chart-toolbar__mobile-option-label",children:_})},_))})]})]})]})})]})},kQe=({segments:t,selectedKey:e,onChange:n,style:i})=>
7606{const[s,r]=M.useState(null),o=M.useRef(null),a=M.useRef(null),c=M.useRef({}),l=M.useRef(!1),d=M.useRef(""),h=t.map(g=>g.key).join(","),p=d.current!==h;return M.useEffect(()=>{if(p&&(l.current=!1,d.current=h),l.current&&!p)return;const g=t.find(C=>C.key===e&&C.key!=="ellipsis");if(!g)return;const b=()=>{requestAnimationFrame(()=>{const C=c.current[g.key],E=a.current,T=o.current;if(C&&T&&E){const A=T.getBoundingClientRect(),k=C.getBoundingClientRect(),R=k.left-A.left,P=k.width;E.style.transition="none",E.style.transform=`translateX(${R}px)`,E.style.width=`${P}px`,setTimeout(()=>{E&&(E.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",l.current=!0)},50)}else setTimeout(b,10)})},w=setTimeout(b,0);return()=>clearTimeout(w)},[h,p,e,t]),M.useEffect(()=>{if(!l.current)return;const g=t.find(b=>b.key===e&&b.key!=="ellipsis");g&&requestAnimationFrame(()=>{const b=c.current[g.key],w=a.current,C=o.current;if(b&&C&&w){const E=C.getBoundingClientRect(),T=b.getBoundingClientRect(),A=T.left-E.left,k=T.width;w.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",w.style.transform=`translateX(${A}px)`,w.style.width=`${k}px`}})},[e,t]),!t||t.length===0?null:m.jsxs("div",{ref:o,className:"FormTab",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",flexWrap:"wrap",width:"100%",position:"relative",...i},children:[m.jsx("div",{ref:a,className:"FormTab__Background",style:{height:"32px"}}),t.map(g=>{const b=g.key==="ellipsis",w=g.key===e;return m.jsx("button",{ref:C=>{b||(c.current[g.key]=C)},onClick:()=>!b&&n(g.key),onMouseEnter:()=>!b&&r(g.key),onMouseLeave:()=>!b&&r(null),disabled:b,className:`Tab ${w?"selected":""} ${b?"disabled":""}`,style:{padding:b?"8px 4px":"1px 12px 0px 12px",color:b?"rgba(255, 255, 255, 0.4)":void 0,cursor:b?"default":"pointer",pointerEvents:b?"none":"auto"},children:g.label},g.key)})]})},NQe=(t=null)=>{try{return t?Yt.getTickAtSqrtRatio(t):null}catch(e){return console.error("Error calculating tick from price:",e),null}},T3=(t,e,n)=>{const i=Yt.getSqrtRatioAtTick(t),s=new Y5(e,n,"1",i.toString());return parseFloat(s.toSignificant(6))},RQe="#FFB648",PQe=RQe,IQe="transparent",DQe=t=>{const e=new Date(t*1e3),n=e.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),i=e.toLocaleDateString("en-US",{month:"short",day:"numeric"});return`${n}, ${i}`},w4=({tokenAddress:t,poolAddress:e,vaultAddress:n,fromTokenAddress:i,toTokenAddress:s,chartType:r="candlestick",interval:o="1D",metric:a="price",height:c=500,showToolbar:l=!0,backgroundColor:d=IQe,lineColor:h=PQe,priceFormatter:p,onChartTypeChange:g,onIntervalChange:b,onMetricChange:w,showNoDataOverlay:C=!1,noDataMessage:E="No data available",dataType:T,hideMetricsDropdown:A=!1,positions:k=[],poolToken0:R,poolToken1:P,fallbackPoolAddress:B=null,fallbackFromTokenAddress:F=null,fallbackToTokenAddress:z=null})=>{const K=M.useRef(null),q=M.useRef(null),G=M.useRef(null),I=M.useRef(!0),[S,v]=M.useState(r),[_,N]=M.useState(o),[$,U]=M.useState(a),[j,D]=M.useState(null),[O,H]=M.useState(null),[J,W]=M.use
7606State(null);M.useEffect(()=>{v(r)},[r]),M.useEffect(()=>{N(o),I.current=!0},[o]),M.useEffect(()=>{U(a)},[a]),M.useEffect(()=>{T==="vault"&&$==="price"&&(U("tvl"),w==null||w("tvl"),S==="candlestick"&&(v("area"),g==null||g("area")))},[T]);const{data:Z,isLoading:Y,error:Q}=EQe(e||null,t||null,n||null,$,S,_,i||null,s||null,B??null,F??null,z??null),ee=M.useMemo(()=>{const Te=Math.floor(Date.now()/1e3);return Array.from({length:30},(ve,xe)=>({time:Te-(30-xe)*3600,value:100+Math.sin(xe/5)*10+Math.random()*5}))},[]),ie=!e&&!t&&!n||Q&&Q.message.includes("environment variable"),re=ie?ee:Z||[],oe=(Te,ve)=>{try{switch(ve){case"area":G.current=Te.addSeries(Boe,{lineColor:h,topColor:"rgba(255, 182, 72, 0.2)",bottomColor:"rgba(255, 182, 72, 0.0)",lineWidth:2,priceFormat:{type:"custom",minMove:.01,formatter:p||(xe=>xe.toFixed(2))},priceLineVisible:!1,lastValueVisible:!1});break;case"line":G.current=Te.addSeries(ZZe,{color:h,lineWidth:2,priceFormat:{type:"custom",minMove:.01,formatter:p||(xe=>xe.toFixed(2))},priceLineVisible:!1,lastValueVisible:!1});break;case"candlestick":G.current=Te.addSeries(rQe,{upColor:"#4CAF50",downColor:"#F44336",borderUpColor:"#4CAF50",borderDownColor:"#F44336",wickUpColor:"#4CAF50",wickDownColor:"#F44336",priceFormat:{type:"custom",minMove:.01,formatter:p||(xe=>xe.toFixed(2))},priceLineVisible:!1,lastValueVisible:!1});break;default:console.warn(`Unknown chart type: ${ve}`);break}}catch(xe){console.error("Error creating series:",xe),G.current=null}};M.useEffect(()=>{if(!K.current||q.current)return;const Te=Moe(K.current,{width:K.current.clientWidth,height:c,layout:{background:{type:y8.Solid,color:d},textColor:"#fff"},grid:{vertLines:{visible:!1},horzLines:{visible:!1,style:0}},timeScale:{borderColor:"transparent",timeVisible:!0,secondsVisible:!1,minBarSpacing:10,rightOffset:0,barSpacing:6},rightPriceScale:{borderColor:"transparent",entireTextOnly:!1},crosshair:{mode:0,vertLine:{visible:!1,labelVisible:!1},horzLine:{visible:!1,labelVisible:!1}},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!1,axisPressedMouseMove:!0},handleScale:{axisPressedMouseMove:!0,mouseWheel:!0,pinch:!0,axisDoubleClickReset:!0}});q.current=Te;const ve=()=>{K.current&&K.current.querySelectorAll('a[href*="tradingview"], a[href*="trading-view"], img[src*="tradingview"], img[src*="trading-view"]').forEach(lt=>{const We=lt,Dt=We.getAttribute("href"),Fe=We.getAttribute("src");(Dt!=null&&Dt.includes("tradingview")||Dt!=null&&Dt.includes("trading-view")||Fe!=null&&Fe.includes("tradingview")||Fe!=null&&Fe.includes("trading-view"))&&(We.style.display="none",We.style.visibility="hidden",We.style.opacity="0")})};ve();const xe=new MutationObserver(()=>{ve()});if(K.current&&xe.observe(K.current,{childList:!0,subtree:!0,attributes:!0}),oe(Te,S),G.current)try{G.current.applyOptions({priceLineVisible:!1,lastValueVisible:!1})}catch(ft){console.warn("Error applying series options:",ft)}const Ye=ft=>{if(ft===null||ft.time===void 0){D(null),H(null),W(null);return}let lt;typeof ft.time=="number"?lt=ft.time>1e12?ft.time/1e3:ft.time:typeof ft.time=="string"?lt=new Date(ft.time).getTime()/1e3:(lt=ft.time.timestamp||ft.time||0,lt>1e12&&(lt=lt/1e3)),D(lt);let We=null;if(ft.seriesData&&G.current){const Dt=ft.seriesData.get(G.current);Dt&&(Dt.close!==void 0?We=Dt.close:Dt.value!==void 0?We=Dt.value:Dt.high!==void 0&&(We=Dt.high))}if(W(We),K.current&&q.current){const Fe=q.current.timeScale().timeToCoordinate(ft.time);Fe!==null&&H(Fe)}};Te.subscribeCrosshairMove(Ye);const ze=()=>{if(q.current&&K.current)try{q.current.applyOptions({width:K.current.clientWidth})}catch(ft){console.warn("Error resizing chart:",ft)}};return window.addEventListener("resize",ze),()=>{if(window.removeEventListener("resize",ze),xe.disconnect(),q.current)try{q.current.unsubscribeCrosshairMove(Ye),q.current.remove()}catch(ft){console.warn("Error cleaning up chart:",ft)}finally{q.current=null,G.current=null}D(null),H(null),W(null)}},[]),M.useEffect(()=>{if(!(!q.current||!K.current)){if(G.current){const Te=G.current.seriesType();if(!(S==="candlestick"&&Te!=="Candlestick"||S==="area"&&Te!=="Area"||S==="line"&&Te!=="Line"))return;try{q.current.removeSeries(G.current)}catch(xe){console.warn("Error removing series:",xe)}G.current=null}oe(q.current,S)}},[S]),M.useEffect(()=>
7606{if(G.current&&!(!re||!Array.isArray(re)||re.length===0))try{if(S==="candlestick")if(ie){const Te=re.map(ve=>({time:ve.time,open:ve.value*.98,high:ve.value*1.02,low:ve.value*.96,close:ve.value}));G.current.setData(Te)}else G.current.setData(re);else if(ie)G.current.setData(re);else if(re.length>0&&"close"in re[0]){const Te=re.map(ve=>({time:ve.time,value:ve.close}));G.current.setData(Te)}else G.current.setData(re);if(q.current)try{const Te=q.current.timeScale();I.current&&(Te.fitContent(),I.current=!1)}catch(Te){console.warn("Error fitting chart content:",Te)}if(G.current)try{G.current.applyOptions({priceLineVisible:!1,lastValueVisible:!1})}catch(Te){console.warn("Error applying series options after data update:",Te)}}catch(Te){console.warn("Error setting chart data:",Te)}},[re,S,ie,e,t,i,s]),M.useEffect(()=>{if(!(!G.current||!k||k.length===0||!R||!P||a!=="price")){try{const Te=new on(Nn.id,R.id,R.decimals,R.symbol,R.name),ve=new on(Nn.id,P.id,P.decimals,P.symbol,P.name);G.current.priceLines().forEach(Ye=>{var ze;try{(ze=G.current)==null||ze.removePriceLine(Ye)}catch{}}),k.forEach(Ye=>{var ze,ft;try{const lt=T3(Ye.tickLower,Te,ve),We=T3(Ye.tickUpper,Te,ve),Dt={price:lt,color:"rgba(255, 182, 72, 0.5)",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:"Min"};
7606(ze=G.current)==null||ze.createPriceLine(Dt);const Fe={price:We,color:"rgba(255, 182, 72, 0.5)",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:"Max"};(ft=G.current)==null||ft.createPriceLine(Fe)}catch(lt){console.warn(`Error creating price lines for position ${Ye.id}:`,lt)}})}catch(Te){console.warn("Error adding position lines to chart:",Te)}return()=>{if(G.current)try{G.current.priceLines().forEach(ve=>{var xe;try{(xe=G.current)==null||xe.removePriceLine(ve)}catch{}})}catch{}}}},[k,R,P,a,G.current]),M.useEffect(()=>{if(!K.current)return;const Te=()=>{['a[href*="tradingview"]','a[href*="trading-view"]','img[src*="tradingview"]','img[src*="trading-view"]'].forEach(lt=>{var Dt;const We=(Dt=K.current)==null?void 0:Dt.querySelectorAll(lt);We==null||We.forEach(Fe=>{const it=Fe,Qt=it.getAttribute("href"),ke=it.getAttribute("src");(it.tagName==="A"&&(Qt!=null&&Qt.includes("tradingview")||Qt!=null&&Qt.includes("trading-view"))||it.tagName==="IMG"&&(ke!=null&&ke.includes("tradingview")||ke!=null&&ke.includes("trading-view")))&&(it.style.display="none",it.style.visibility="hidden",it.style.opacity="0")})})};Te();const ve=setTimeout(Te,200);let xe=0;const Ye=()=>{const ft=Date.now();ft-xe>100&&(xe=ft,Te())},ze=new MutationObserver(Ye);return K.current&&ze.observe(K.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src"]}),()=>{clearTimeout(ve),ze.disconnect()}},[]);const de=Te=>{v(Te),g==null||g(Te)},he=Te=>{N(Te),b==null||b(Te)},ue=Te=>{U(Te),Te!=="price"&&S==="candlestick"&&(v("area"),g==null||g("area")),w==null||w(Te)},be=Y||Q&&!ie,_e=!Y&&!Q&&(!re||!Array.isArray(re)||re.length===0),Ne=C&&!be||_e&&!ie,pe=_e&&!ie?"No chart data available":E;return m.jsxs("div",{className:"chart-widget",children:[l&&m.jsx(TQe,{chartType:S,interval:_,metric:$,onChartTypeChange:de,onIntervalChange:he,onMetricChange:ue,availableMetrics:T==="vault"?["tvl","volume","fees"]:T==="pool"?["price","tvl","volume","fees"]:void 0,isLoading:Y,hideMetricsDropdown:A}),m.jsxs("div",{className:"chart-widget__container",style:{position:"relative"},children:[m.jsx("div",{ref:K,className:"chart-widget__chart",style:{height:c,width:"100%",opacity:be?0:1,pointerEvents:be?"none":"auto"}}),O!==null&&K.current&&!be&&m.jsx("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:5},children:m.jsx("line",{x1:O,y1:0,x2:O,y2:c,stroke:"rgba(255, 182, 72, 0.3)",strokeWidth:"1",strokeDasharray:"4 4"})}),j!==null&&O!==null&&K.current&&m.jsxs("div",{style:{position:"absolute",top:"-5px",left:(()=>{var Ye;const Te=((Ye=K.current)==null?void 0:Ye.clientWidth)||0;return O<Te/2?`${O+8}px`:"auto"})(),right:(()=>{var Ye;const Te=((Ye=K.current)==null?void 0:Ye.clientWidth)||0;return O<Te/2?"auto":`${Te-O+8}px`})(),paddingLeft:"6px",paddingRight:"6px",paddingTop:"3px",paddingBottom:"3px",pointerEvents:"none",zIndex:10,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"2px"},children:[m.jsx("span",{style:{color:"#999999",fontSize:"10px",fontWeight:400},children:DQe(j)}),J!==null&&m.jsx("span",{style:{color:"#FFFFFF",fontSize:"10px",fontWeight:500},children:p?p(J):`$${J<.01?J.toFixed(6):J<1?J.toFixed(4):J.toFixed(2)}`})]}),be&&m.jsx("div",{className:"chart-widget__shimmer-overlay",children:m.jsx("div",{className:"chart-widget__shimmer-content",children:m.jsx("div",{style:{position:"relative",width:"100%",flex:1,padding:"20px",minHeight:"300px",display:"flex",alignItems:"flex-end",justifyContent:"center"},children:m.jsx("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"flex-end",gap:"1%"},children:Array.from({length:20}).map((Te,ve)=>m.jsx(Ke,{width:"4%",height:`${30+ve%5*10}%`},ve))})})})}),Ne&&!be&&m.jsx("div",{className:"chart-widget__overlay",children:m.jsx("div",{className:"chart-widget__overlay-content",children:pe==null?m.jsx(u4,{size:"desktop",color:"#FFB648"}):typeof pe=="string"?m.jsx("p",{className:"chart-widget__overlay-message",children:pe}):m.jsx("div",{className:"chart-widget__overlay-message",children:pe})})})]}),l&&m.jsx("div",{className:"chart-widget__timerange-container",style:{marginTop:"20px",marginBottom:"32px",display:"flex",justifyContent:"flex-start"},children:m.jsx(kQe,{segments:["1H","1D","1W","1M","1Y","ALL"].map(Te=>({key:Te,label:Te})),selectedKey:_,onChange:Te=>he(Te)})})]})};function OQe(t,e){const{data:n,isLoading:i,error:s}=CL((t==null?void 0:t.address)||null,(e==null?void 0:e.address)||null);return M.useMemo(()=>{var o,a;return!t||!e?{poolAddress:null,isLoading:!1,error:null,poolInfo:null}:i?{poolAddress:null,isLoading:!0,error:null,poolInfo:null}:s?{poolAddress:null,isLoading:!1,error:s.message||"Erreur lors de la recherche de la pool",poolInfo:null}
7606:n?Mp(n.id)?{poolAddress:null,isLoading:!1,error:`La pool ${t.symbol}/${e.symbol} n'est pas disponible`,poolInfo:null}:{poolAddress:n.id,isLoading:!1,error:null,poolInfo:{token0Symbol:((o=n.token0Ref)==null?void 0:o.symbol)||"Unknown",token1Symbol:((a=n.token1Ref)==null?void 0:a.symbol)||"Unknown",feeTier:n.feeTier,tvlUSD:n.totalValueLockedUSD,volumeUSD:n.volumeUSD,feesUSD:n.feesUSD}}:{poolAddress:null,isLoading:!1,error:`Aucune pool trouvée pour ${t.symbol}/${e.symbol}`,poolInfo:null}},[t,e,n,i,s])}function MQe(t,e){const n=OQe(t,e),i="0x6969696969696969696969696969696969696969",s="0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",{data:r}=CL(i,s),o=M.useMemo(()=>!n.poolAddress&&!n.isLoading&&r&&!Mp(r.id),[n.poolAddress,n.isLoading,r]);return{...n,isUsingFallback:o,fallbackPoolAddress:r!=null&&r.id&&!Mp(r.id)?r.id:null}}const LQe=` 7607 query GetTrendingTokens { 7608 tokens( 7609 orderBy: "volumeUSD" 7610 orderDirection: "desc" 7611 limit: 50 7612 ) { 7613 items { 7614 id 7615 symbol 7616 name 7617 logoUri 7618 decimals 7619 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7620 items { 7621 priceUSD 7622 oneDayEvo 7623 } 7624 } 7625 } 7626 } 7627 } 7628`,$Qe=t=>`$${t.toFixed(2)}`,UQe=({className:t="",onToggleSidebar:e})=>{const[n,i]=M.useState(null),[s,r]=M.useState(null),[o,a]=M.useState("area"),[c,l]=M.useState("1D"),[d,h]=M.useState("price"),[p,g]=M.useState(null),{data:b}=h4(),{data:w}=Zt({queryKey:["trendingTokensForSwap"],queryFn:async()=>{const j=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:LQe})})).json();return j.errors?(console.error("GraphQL errors:",j.errors),{tokens:{items:[]}}):j.data},staleTime:3e4,retry:3,retryDelay:1e3}),C=M.useCallback(U=>{var O,H;const j=(H=(O=U.tokenDayData)==null?void 0:O.items)==null?void 0:H[0],D=j!=null&&j.priceUSD?parseFloat(j.priceUSD):0;return{address:U.id,symbol:U.symbol,name:U.name||U.symbol,decimals:U.decimals||18,logoUri:U.logoUri||null,totalSupply:"0",lastPrice:D,status:"IN_POOL",priceUSD:D}},[]),E=M.useMemo(()=>{var H;const U=b||[],j=((H=w==null?void 0:w.tokens)==null?void 0:H.items)||[],D=new Map;U.forEach(J=>{J.address&&D.set(J.address.toLowerCase(),J)});const O=[...U];return j.forEach(J=>{const W=J.id.toLowerCase();D.has(W)||O.push(C(J))}),O},[b,w,C]),T=M.useCallback((U,j,D)=>{i(j),r(D)},[]),A=MQe(n,s),k="0x6969696969696969696969696969696969696969",R="0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",P="0x0000000000000000000000000000000000000000",{data:B}=CL(k,R),F=["0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce".toLowerCase(),"0x779Ded0c9e1022225f8E0630b35a9b54bE713736".toLowerCase(),"0x549943e04f40284185054145c6E4e9568C1D3241".toLowerCase(),"0x1cE0a25D13CE4d52071aE7e02Cf1F6606F4C79d3".toLowerCase()],z=["HONEY","USDT","USDT0","USDC","USDC.E","NECT","NECTAR"],K=M.useCallback(U=>{var O,H;if(!U)return!1;const j=((O=U.address)==null?void 0:O.toLowerCase())||"",D=((H=U.symbol)==null?void 0:H.toUpperCase())||"";return F.includes(j)||z.includes(D)},[]),q=M.useCallback(U=>U?U.toLowerCase()===P.toLowerCase()?k:U:null,[]),G=M.useMemo(()=>{const U=K(n),j=K(s);if(n&&s&&U!==j){const D=U?s:n;return{type:"token",tokenAddress:q(D.address),message:`Données de ${D.symbol==="BERA"?"WBERA":D.symbol} en USD`,showOverlay:!1,dataType:"token"}}return n?{type:"token",tokenAddress:q(n.address),message:`Données de ${n.symbol==="BERA"?"WBERA":n.symbol} en USD`,showOverlay:!1,dataType:"token"}:s?{type:"token",tokenAddress:q(s.address),message:`Données de ${s.symbol==="BERA"?"WBERA":s.symbol} en USD`,showOverlay:!1,dataType:"token"}:{type:"waiting",message:null,showOverlay:!0,dataType:"token"}},[n,s,q,K]),I=U=>{a(U)},S=U=>{l(U)},v=U=>{h(U)},_=M.useMemo(()=>{var O,H;const U=n&&s,j=!A.poolAddress&&!A.isLoading&&!((O=A.error)!=null&&O.includes("fallback")),D=s&&(((H=s.address)==null?void 0:H.toLowerCase())===P.toLowerCase()||s.symbol==="BERA");return U&&j&&!D},[n,s,A.poolAddress,A.isLoading,A.error]),N=()=>{if(_&&s){const U="0x6969696969696969696969696969696969696969",j=s.address,D=s.symbol,O=`/liquidity/create?token0=${U}&token1=${j}&fee=300`;return m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[m.jsxs("p",{style:{margin:0,color:"#FFFFFF",fontSize:"16px",fontWeight:500},children:["Create a pool for ",D]}),m.jsx(gi,{to:O,className:"btn btn--small btn__main",style:{textDecoration:"none"},children:"Create Pool"})]})}return G.message},$=M.useCallback(U=>{var D,O;
7628if(console.log("[SwapPageLayout] handleTokenFromMarquee called with tokenId:",U),!E||E.length===0){console.warn("[SwapPageLayout] No tokens available");return}const j=E.find(H=>{var J;return((J=H.address)==null?void 0:J.toLowerCase())===U.toLowerCase()});if(console.log("[SwapPageLayout] Found token:",j,"in",E.length,"tokens"),j)console.log("[SwapPageLayout] Setting selectedToToken and toToken"),g(j),r(j);else{console.warn(`[SwapPageLayout] Token not found in token list: ${U}`);const H=(O=(D=w==null?void 0:w.tokens)==null?void 0:D.items)==null?void 0:O.find(J=>J.id.toLowerCase()===U.toLowerCase());if(H){const J=C(H);console.log("[SwapPageLayout] Created token from GraphQL:",J),g(J),r(J)}}},[E,w,C]);return m.jsxs(Uu,{className:`swap-page-layout ${t}`,children:[m.jsx("div",{className:"swap-page-layout__banner",children:m.jsx(LS,{onTokenClick:$})}),m.jsxs("div",{className:"swap-page-layout__container",children:[m.jsx("div",{className:"swap-page-layout__chart",children:m.jsx(w4,{tokenAddress:G.type==="token"?G.tokenAddress:null,poolAddress:null,fromTokenAddress:(n==null?void 0:n.address)||null,toTokenAddress:(s==null?void 0:s.address)||null,chartType:o,interval:c,metric:d,height:500,showToolbar:!0,priceFormatter:$Qe,onChartTypeChange:I,onIntervalChange:S,onMetricChange:v,showNoDataOverlay:G.showOverlay??(A.isLoading||_),noDataMessage:N(),dataType:G.dataType,hideMetricsDropdown:!0})}),m.jsx("div",{className:"swap-page-layout__swap",children:m.jsx(Of,{toggleSidebar:e,isSticky:!0,isHomePage:!1,enableDepositWithdraw:!1,showTitle:!1,hideMetrics:!0,onPoolChange:T,initialToToken:p})})]})]})},BQe=()=>{const{address:t,isConnected:e}=cme(s=>s.wallet),{disconnect:n}=ZM(),i=s=>{if(!s)return"";const r=s.substring(0,6),o=s.substring(s.length-4);return`${r}...${o}`};return!e||!t?null:m.jsxs("div",{className:"wallet-connect",children:[m.jsx("div",{className:"wallet-info",children:m.jsxs("div",{className:"wallet-address",children:[m.jsx("span",{className:"label",children:"Adresse :"}),m.jsx("span",{className:"value",children:i(t)})]})}),m.jsx("button",{className:"disconnect-button",onClick:()=>n(),children:"Déconnecter"})]})},qo=()=>m.jsx("svg",{className:"Token__BreadcrumbsChevron",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("path",{d:"M9.04264 6.99932H9.04039L4.95825 2.91718L9.04039 7.0017L4.95825 11.0838",stroke:"#8A8984",strokeWidth:"1.4"})}),joe=()=>m.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"#FFFFFF",xmlns:"http://www.w3.org/2000/svg",stroke:"transparent",children:[m.jsx("path",{d:"M5.08042 8.66148C5.08043 8.58693 5.09517 8.51313 5.12378 8.44429C5.1524 8.37546 5.19432 8.31297 5.24716 8.26038C5.30001 8.2078 5.3627 8.16617 5.43167 8.13788C5.50064 8.1096 5.57452 8.09522 5.64907 8.09557L6.59187 8.09865C6.74218 8.09865 6.88635 8.15836 6.99263 8.26465C7.09893 8.37094 7.15865 8.5151 7.15865 8.66543V12.2303C7.26478 12.1988 7.4011 12.1652 7.55026 12.1301C7.65387 12.1058 7.74621 12.0471 7.8123 11.9637C7.87839 11.8803 7.91434 11.777 7.91432 11.6705V7.24848C7.91432 7.09814 7.97403 6.95397 8.08032 6.84766C8.1866 6.74135 8.33077 6.68162 8.4811 6.68158H9.42577C9.57609 6.68162 9.72026 6.74135 9.82655 6.84766C9.93284 6.95397 9.99255 7.09814 9.99255 7.24848V11.3526C9.99255 11.3526 10.2291 11.2569 10.4595 11.1596C10.545 11.1234 10.6181 11.0629 10.6694 10.9854C10.7208 10.908 10.7482 10.8172 10.7483 10.7242V5.83152C10.7483 5.68122 10.808 5.53707 10.9143 5.43078C11.0206 5.32449 11.1647 5.26478 11.315 5.26474H12.2597C12.41 5.26474 12.5542 5.32445 12.6604 5.43075C12.7667 5.53704 12.8265 5.6812 12.8265 5.83152V9.86056C13.6455 9.267 14.4754 8.55315 15.1341 7.69474C15.2297 7.57015 15.2929 7.42383 15.3181 7.26887C15.3434 7.1139 15.3299 6.95509 15.2788 6.8066C14.9739 5.9294 14.4894 5.12551 13.856 4.44636C13.2226 3.76722 12.4544 3.22777 11.6005 2.86256C10.7467 2.49734 9.82602 2.31439 8.89742 2.32542C7.96882 2.33645 7.05275 2.54121 6.20783 2.9266C5.36291 3.31199 4.60774 3.86952 3.99066 4.56352C3.37358 5.25751 2.90817 6.07269 2.62422 6.95689C2.34027 7.84107 2.24403 8.7748 2.34166 9.69832C2.43929 10.6218 2.72863 11.5148 3.19118 12.3201C3.27176 12.459 3.39031 12.572 3.53289 12.6459C3.67548 12.7198 3.83618 12.7514 3.99614 12.7372C4.17482 12.7215 4.3973 12.6992 4.66181 12.6681C4.77695 12.655 4.88326 12.6001 4.96048 12.5137C
76285.0377 12.4273 5.08043 12.3155 5.08053 12.1996L5.08042 8.66148Z",fill:"#FFFFFF"}),m.jsx("path",{d:"M5.05957 14.3792C6.05531 15.1036 7.23206 15.5384 8.45961 15.6356C9.68716 15.7326 10.9176 15.4883 12.0149 14.9294C13.1122 14.3705 14.0334 13.519 14.6768 12.4691C15.3201 11.4191 15.6605 10.2116 15.6601 8.98024C15.6601 8.82658 15.653 8.67457 15.6428 8.52344C13.2041 12.1605 8.70139 13.8609 5.05978 14.3786",fill:"#FFFFFF"})]}),FQe=()=>m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"#FFFFFF",xmlns:"http://www.w3.org/2000/svg",stroke:"transparent",children:m.jsx("path",{d:"M5.12245 9.5625C5.23495 11.8725 6.01495 14.2275 7.37245 16.32C4.19245 15.615 1.76996 12.8925 1.52246 9.5625H5.12245ZM7.37245 1.67999C4.19245 2.38499 1.76996 5.1075 1.52246 8.4375H5.12245C5.23495 6.1275 6.01495 3.77249 7.37245 1.67999ZM9.14997 1.5H8.84995L8.62496 1.82249C7.19996 3.84749 6.36745 6.1725 6.24745 8.4375H11.7525C11.6325 6.1725 10.8 3.84749 9.37496 1.82249L9.14997 1.5ZM6.24745 9.5625C6.36745 11.8275 7.19996 14.1525 8.62496 16.1775L8.84995 16.5H9.14997L9.37496 16.1775C10.8 14.1525 11.6325 11.8275 11.7525 9.5625H6.24745ZM12.8775 9.5625C12.765 11.8725 11.985 14.2275 10.6275 16.32C13.8075 15.615 16.23 12.8925 16.4775 9.5625H12.8775ZM16.4775 8.4375C16.23 5.1075 13.8075 2.38499 10.6275 1.67999C11.985 3.77249 12.765 6.1275 12.8775 8.4375H16.4775Z",fill:"#FFFFFF"})}),Voe=()=>m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"#FFFFFF",xmlns:"http://www.w3.org/2000/svg",stroke:"transparent",children:m.jsx("path",{d:"M12.8761 3H14.9451L10.4251 8.16609L15.7425 15.196H11.579L8.31797 10.9324L4.58662 15.196H2.51644L7.35104 9.67026L2.25 3H6.51922L9.46689 6.89708L12.8761 3ZM12.15 13.9576H13.2964L5.89628 4.17332H4.66605L12.15 13.9576Z",fill:"#FFFFFF"})}),jQe=()=>m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M13 4.99092C13 4.09592 14.094 3.66096 14.709 4.31196L20.637 10.582C21.121 11.094 21.121 11.894 20.637 12.406L14.709 18.676C14.094 19.326 13 18.89
76281 13 17.997V14.4919C5.437 14.4919 4.93602 16.962 4.96802 19.529C4.97402 20.019 4.32501 20.1811 4.08301 19.7561C3.46701 18.6751 3 17.1999 3 15.4909C3 8.99592 10 8.49702 13 8.49702V4.99092Z",fill:"currentColor"})}),VQe=async t=>{var s,r,o;const e=`https://api.coingecko.com/api/v3/coins/${t}`,n=await fetch(e);if(!n.ok)throw Error(n.statusText);const i=await n.json();return{description:((s=i==null?void 0:i.description)==null?void 0:s.en)||"",circulating_supply:((r=i==null?void 0:i.market_data)==null?void 0:r.circulating_supply)??null,total_supply:((o=i==null?void 0:i.market_data)==null?void 0:o.total_supply)??null,market_data:(i==null?void 0:i.market_data)??{}}},WQe=t=>{const e=!!t;return Zt({queryKey:e?["coingecko-token-data",t]:["coingecko-token-data","no-id"],queryFn:e?()=>VQe(t):()=>Promise.resolve({description:"",circulating_supply:null,total_supply:null,market_data:{}}),enabled:e,staleTime:1e3*60*60*24,select:n=>n})},qQe={initial:{opacity:0,y:20,scale:1},in:{opacity:1,y:0,scale:1},out:{opacity:0,y:-20,scale:1}},zQe=t=>t==="/"||t.startsWith("/explore")||t.startsWith("/vaults")?{type:"tween",duration:.25}:t.includes("/pools")||t.includes("/token")||t.includes("/vaults/")?{type:"spring",stiffness:300,damping:30}:{type:"tween",duration:.3},HQe=({children:t,isLoading:e=!1})=>{const n=jr(),i=zQe(n.pathname);return m.jsx(Pb,{mode:"wait",initial:!1,children:m.jsx(Wo.div,{initial:"initial",animate:"in",exit:"out",variants:qQe,transition:{...i,delay:0},style:{width:"100%",minHeight:"100%"},children:m.jsx(Wo.div,{initial:{opacity:0}
7628,animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},children:t})},n.pathname)})},qd=({pools:t=[],vaults:e=[]})=>{const n=Zo(),i=M.useMemo(()=>{const o=t.map(c=>{var l,d,h;return{type:"pool",id:c.id,token0:c.token0Ref,token1:c.token1Ref,feeTier:c.feeTier,tvl:c.totalValueLockedUSD,apr:(h=(d=(l=c.poolDayData)==null?void 0:l.items)==null?void 0:d[0])==null?void 0:h.apr}}),a=e.map(c=>{var l,d,h;return{type:"vault",id:c.id,token0:c.poolRef.token0Ref,token1:c.poolRef.token1Ref,feeTier:c.poolRef.feeTier,tvl:c.totalValueLockedUSD,apr:(h=(d=(l=c.vaultDayData)==null?void 0:l.items)==null?void 0:d[0])==null?void 0:h.maxPotentialAPR,autoWin:c.autoWinVault}});return[...o,...a]},[t,e]),s=[...i,...i,...i],r=(o,a)=>{n(o==="pool"?`/pools/${a}`:`/vaults/${a}`)};return i.length===0?null:m.jsx("div",{className:"tokens-marquee pools-vaults-marquee",children:m.jsx("div",{className:"tokens-marquee__container",children:m.jsx("div",{className:"tokens-marquee__track",children:s.map((o,a)=>{const c=parseFloat(o.tvl||"0"),l=o.apr?parseFloat(o.apr):null;return m.jsxs("div",{className:"tokens-marquee__item pools-vaults-marquee__item",onClick:()=>r(o.type,o.id),children:[m.jsx("div",{className:"tokens-marquee__logo pools-vaults-marquee__logo",children:m.jsx(If,{token0:{id:o.token0.id,address:o.token0.id,symbol:o.token0.symbol,name:o.token0.name,logoUri:o.token0.logoUri||void 0},token1:{id:o.token1.id,address:o.token1.id,symbol:o.token1.symbol,name:o.token1.name,logoUri:o.token1.logoUri||void 0},size:32,gap:2,borderWidth:2,separatorWidth:1})}),m.jsxs("div",{className:"tokens-marquee__symbol pools-vaults-marquee__pair",children:[o.token0.symbol,"/",o.token1.symbol]}),m.jsxs("div",{className:"tokens-marquee__price pools-vaults-marquee__fee",children:[(o.feeTier/1e4).toFixed(2),"%"]}),m.jsxs("div",{className:"pools-vaults-marquee__tvl",children:["$",An(c)]}),l!==null&&m.jsxs("div",{className:"pools-vaults-marquee__apr",children:[l.toFixed(2),"%"]})]},`${o.type}-${o.id}-${a}`)})})})})},pY=()=>{var W,Z;const{tokenAddress:t}=c6();Zo();const[e,n]=kn.useState("area"),[i,s]=kn.useState("1D"),[r,o]=kn.useState("price"),[a,c]=M.useState(null),[l,d]=M.useState(null),h=M.useRef(null),p=M.useRef(null),{data:g,isLoading:b}=Zt({queryKey:["tokensStats"],queryFn:async()=>{const Y=await fetch("https://api.winnieswap.com/token/list");return Y.ok?Y.json():[]},staleTime:300*1e3,gcTime:1800*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:Y=>Y});L1();const w=M.useMemo(()=>t?RI(t):null,[t]),{data:C,isLoading:E}=Zt({queryKey:["pools-for-token",w],enabled:!!w,staleTime:120*1e3,gcTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:Y=>Y,queryFn:async()=>{var ee,ie;if(!w)return{data:[]};const Y=w.toLowerCase(),Q=` 7629 query GetPoolsForToken { 7630 pools( 7631 where: { 7632 OR: [ 7633 { token0: "${Y}" } 7634 { token1: "${Y}" } 7635 ] 7636 } 7637 orderBy: "totalValueLockedUSD" 7638 orderDirection: "desc" 7639 limit: 5 7640 ) { 7641 items { 7642 id 7643 token0 7644 token1 7645 totalValueLockedUSD 7646 volumeUSD 7647 feeTier 7648 token0Ref { 7649 id 7650 symbol 7651 name 7652 decimals 7653 logoUri 7654 } 7655 token1Ref { 7656 id 7657 symbol 7658 name 7659 decimals 7660 logoUri 7661 } 7662 poolDayData( 7663 orderBy: "date" 7664 orderDirection: "desc" 7665 limit: 1 7666 ) { 7667 items { 7668 date 7669 volumeUSD 7670 volumeUSD1D 7671 tvlUSD 7672 apr 7673 } 7674 } 7675 } 7676 } 7677 } 7678 `;try{const re=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Q})});if(!re.ok)return{data:[]};const oe=await re.json();return oe.errors?{data:[]}:{data:(((ie=(ee=oe.data)==null?void 0:ee.pools)==null?void 0:ie.items)||[]).filter(ue=>!Mp(ue.id))}}catch{return{data:[]}}}}),{data:T}=Zt({queryKey:["vaults-for-token",w],enabled:!!w,staleTime:120*1e3,gcTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:Y=>Y,queryFn:async()=>{var ee,ie;if(!w)return{data:[]};const Y=w.toLowerCase(),Q=` 7679 query GetVaultsForToken { 7680 stickyVaults( 7681 where: { 7682 OR: [ 7683 { poolRef: { token0: "${Y}" } } 7684 { poolRef: { token1: "${Y}" } } 7685 ] 7686 } 7687 orderBy: "totalValueLockedUSD" 7688 orderDirection: "desc" 7689 limit: 5 7690 ) { 7691 items { 7692 id 7693 name 7694 totalValueLockedUSD 7695 autoWinVault 7696 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 7697 items { 7698 maxPotentialAPR 7699 } 7700 } 7701 poolRef { 7702 feeTier 7703 token0Ref { 7704 id 7705 symbol 7706 logoUri 7707 } 7708 token1Ref { 7709 id 7710 symbol 7711 logoUri 7712 } 7713 } 7714 } 7715 } 7716 } 7717 `;try{const re=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Q})});if(!re.ok)return{data:[]};const oe=await re.json();return oe.errors?{data:[]}:{data:((ie=(ee=oe.data)==null?void 0:ee.stickyVaults)==null?void 0:ie.items)||[]}}catch{return{data:[]}}}}),A=M.useMemo(()=>
7717{if(!g||!t)return null;const Y=g.find(ee=>{var ie;return((ie=ee.address)==null?void 0:ie.toLowerCase())===t.toLowerCase()});if(!Y)return null;const Q=d4({name:Y.name,symbol:Y.symbol,address:Y.address});return{...Y,name:Q.name,symbol:Q.symbol}},[g,t]),k=M.useMemo(()=>!A||!w?A:(t==null?void 0:t.toLowerCase())==="0x0000000000000000000000000000000000000000"&&(w==null?void 0:w.toLowerCase())==="0x6969696969696969696969696969696969696969"&&(g==null?void 0:g.find(Q=>{var ee;return((ee=Q.address)==null?void 0:ee.toLowerCase())===w.toLowerCase()}))||A,[A,w,t,g]),R="0x6969696969696969696969696969696969696969",P="0x0000000000000000000000000000000000000000",B="0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce",F="0xcaa70d2aa873ef057980844e18d9a9560bdffcc0",z=M.useMemo(()=>{var ee,ie,re,oe;if(!g||!A)return null;const Y=((ee=A.symbol)==null?void 0:ee.toUpperCase())==="BERA"||((ie=A.address)==null?void 0:ie.toLowerCase())===P.toLowerCase(),Q=((re=A.symbol)==null?void 0:re.toUpperCase())==="WBERA"||((oe=A.address)==null?void 0:oe.toLowerCase())===R.toLowerCase();return Y||Q?g.find(de=>{var he,ue;return((he=de.symbol)==null?void 0:he.toUpperCase())==="HONEY"||((ue=de.address)==null?void 0:ue.toLowerCase())==="0xfcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce"})||null:g.find(de=>{var he,ue;return((he=de.symbol)==null?void 0:he.toUpperCase())==="WBERA"||((ue=de.address)==null?void 0:ue.toLowerCase())===R.toLowerCase()})||null},[g,A,R,P]),K=M.useMemo(()=>{var re,oe,de,he,ue,be,_e;const Y=(re=w||t)==null?void 0:re.toLowerCase(),Q=(oe=C==null?void 0:C.data)==null?void 0:oe[0];if(!Y||!(Q!=null&&Q.id)||!((de=Q==null?void 0:Q.token0Ref)!=null&&de.id)||!((he=Q==null?void 0:Q.token1Ref)!=null&&he.id))return null;const ee=(ue=Q.token0Ref.id)==null?void 0:ue.toLowerCase();(be=Q.token1Ref.id)==null||be.toLowerCase();const ie=ee===Y?Q.token1Ref.id:Q.token0Ref.id;return{fallbackPoolAddress:Q.id,fallbackFromTokenAddress:Y,fallbackToTokenAddress:((_e=ie==null?void 0:ie.toLowerCase)==null?void 0:_e.call(ie))??ie}},[C==null?void 0:C.data,w,t]),q=M.useMemo(()=>{var ee,ie,re,oe;if(!A)return;const Y=((ee=A.symbol)==null?void 0:ee.toUpperCase())==="BERA"||((ie=A.address)==null?void 0:ie.toLowerCase())===P.toLowerCase(),Q=((re=A.symbol)==null?void 0:re.toUpperCase())==="WBERA"||((oe=A.address)==null?void 0:oe.toLowerCase())===R.toLowerCase();return Y||Q?`/liquidity/create?token0=${R}&token1=${B}&fee=3000`:`/liquidity/create?token0=${R}&token1=${A.address||A.id}&fee=3000`},[A,R,P,B]),{data:G}=WQe((k==null?void 0:k.coingeckoId)||(A==null?void 0:A.coingeckoId)),I=((W=k==null?void 0:k.TokenDailyStats)==null?void 0:W[0])||((Z=A==null?void 0:A.TokenDailyStats)==null?void 0:Z[0]),{data:S}=Zt({queryKey:["tokenDayData",w],enabled:!!w,staleTime:60*1e3,queryFn:async()=>{var Q,ee,ie;if(!w)return null;const Y=` 7718 query GetTokenDayData { 7719 tokens(where: { id: "${w.toLowerCase()}" }) { 7720 items { 7721 id 7722 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7723 items { 7724 priceUSD 7725 oneDayEvo 7726 } 7727 } 7728 tokenHourData(limit: 25, orderBy: "periodStartUnix", orderDirection: "desc") { 7729 items { 7730 periodStartUnix 7731 priceUSD 7732 } 7733 } 7734 } 7735 } 7736 } 7737 `;try{const re=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Y})});if(!re.ok)return null;const oe=await re.json();return oe.errors?null:((ie=(ee=(Q=oe.data)==null?void 0:Q.tokens)==null?void 0:ee.items)==null?void 0:ie[0])||null}catch{return null}}}),v=M.useMemo(()=>g?g.find(Y=>{var Q,ee,ie,re;return((Q=Y.address)==null?void 0:Q.toLowerCase())===P.toLowerCase()||((ee=Y.address)==null?void 0:ee.toLowerCase())===R.toLowerCase()||((ie=Y.symbol)==null?void 0:ie.toUpperCase())==="BERA"||((re=Y.symbol)==null?void 0:re.toUpperCase())==="WBERA"}):null,[g,P,R]),_=M.useMemo(()=>{var Q,ee,ie,re,oe,de,he,ue,be;if((t==null?void 0:t.toLowerCase())===F.toLowerCase()){if((ee=(Q=v==null?void 0:v.TokenDailyStats)==null?void 0:Q[0])!=null&&ee.priceUSD){const _e=v.TokenDailyStats[0].priceUSD;return typeof _e=="string"?parseFloat(_e):_e}return(re=(ie=G==null?void 0:G.market_data)==null?void 0:ie.current_price)!=null&&re.usd?G.market_data.current_price.usd:null}const Y=(he=(de=(oe=S==null?void 0:S.tokenDayData)==null?void 0:oe.items)==null?void 0:de[0])==null?void 0:he.priceUSD;return Y?typeof Y=="string"?parseFloat(Y):Y:(be=(ue=G==null?void 0:G.market_data)==null?void 0:ue.current_price)!=null&&be.usd?G.market_data.current_price.usd:I!=null&&I.priceUSD?typeof I.priceUSD=="string"?parseFloat(I.priceUSD):I.priceUSD:null},[G,I,t,v,S]),N=M.useMemo(()=>{var ee,ie,re,oe,de,he;const Y=(re=(ie=(ee=S==null?void 0:S.tokenDayData)==null?void 0:ee.items)==null?void 0:ie[0])==null?void 0:re.oneDayEvo;if(Y!=null)return typeof Y=="string"?parseFloat(Y):Y;if((oe=G==null?void 0:G.market_data)!=null&&oe.price_change_percentage_24h)return G.market_data.price_change_percentage_24h;
7737if(I!=null&&I.change24h)return typeof I.change24h=="string"?parseFloat(I.change24h):I.change24h;const Q=((de=S==null?void 0:S.tokenHourData)==null?void 0:de.items)||[];if(Q.length>=24&&_){const ue=_,be=(he=Q[23])!=null&&he.priceUSD?parseFloat(Q[23].priceUSD):null;if(be&&be>0)return(ue-be)/be*100}return null},[G,I,S,_]);M.useEffect(()=>{_!==null&&a===null&&c(_),N!==null&&l===null&&d(N)},[_,N,a,l]),M.useEffect(()=>{const Y=ee=>{let ie=!1,re,oe,de=!1;const he=pe=>{ie=!0,de=!1,ee.style.cursor="grabbing",re=pe.pageX-ee.offsetLeft,oe=ee.scrollLeft},ue=()=>{ie=!1,ee.style.cursor="grab"},be=()=>{ie=!1,ee.style.cursor="grab"},_e=pe=>{if(!ie)return;pe.preventDefault();const ve=(pe.pageX-ee.offsetLeft-re)*2;Math.abs(ve)>5&&(de=!0),ee.scrollLeft=oe-ve},Ne=pe=>{de&&(pe.preventDefault(),pe.stopPropagation())};return ee.addEventListener("mousedown",he),ee.addEventListener("mouseleave",ue),ee.addEventListener("mouseup",be),ee.addEventListener("mousemove",_e),ee.addEventListener("click",Ne,!0),()=>{ee.removeEventListener("mousedown",he),ee.removeEventListener("mouseleave",ue),ee.removeEventListener("mouseup",be),ee.removeEventListener("mousemove",_e),ee.removeEventListener("click",Ne,!0)}},Q=[];return h.current&&Q.push(Y(h.current)),p.current&&Q.push(Y(p.current)),()=>{Q.forEach(ee=>ee())}},[C==null?void 0:C.data,T==null?void 0:T.data]);const $=M.useMemo(()=>{var Q;if(!C||!A||!C.data||!Array.isArray(C.data))return null;let Y=0;for(const ee of C.data)if(!(!ee||typeof ee!="object")&&ee.totalValueLockedUSD){const ie=typeof ee.totalValueLockedUSD=="string"?parseFloat(ee.totalValueLockedUSD):Number(ee.totalValueLockedUSD);!isNaN(ie)&&ie>0&&(Y+=ie)}return Y===0&&((Q=G==null?void 0:G.market_data)!=null&&Q.total_value_locked_usd)?G.market_data.total_value_locked_usd:Y},[C,A,G]),U=M.useMemo(()=>{var Y,Q;return I!=null&&I.marketCap&&I.marketCap>0?I.marketCap:(Q=(Y=G==null?void 0:G.market_data)==null?void 0:Y.market_cap)!=null&&Q.usd&&G.market_data.market_cap.usd>0?G.market_data.market_cap.usd:null},[I,G]),j=M.useMemo(()=>{var Q,ee,ie,re,oe,de;if(!C||!A||!C.data||!Array.isArray(C.data))return I!=null&&I.volumeUSD24h&&I.volumeUSD24h>0?I.volumeUSD24h:(ee=(Q=G==null?void 0:G.market_data)==null?void 0:Q.total_volume)!=null&&ee.usd?G.market_data.total_volume.usd:0;let Y=0;for(const he of C.data){if(!he||typeof he!="object")continue;const ue=(re=(ie=he.poolDayData)==null?void 0:ie.items)==null?void 0:re[0];if(ue!=null&&ue.volumeUSD1D){const be=typeof ue.volumeUSD1D=="string"?parseFloat(ue.volumeUSD1D):Number(ue.volumeUSD1D);!isNaN(be)&&be>0&&(Y+=be)}}return Y===0&&(I!=null&&I.volumeUSD24h)&&I.volumeUSD24h>0?I.volumeUSD24h:Y===0&&((de=(oe=G==null?void 0:G.market_data)==null?void 0:oe.total_volume)!=null&&de.usd)?G.market_data.total_volume.usd:Y},[C,A,I,G]),D=Y=>{n(Y)},O=Y=>{s(Y)},H=Y=>{o(Y)},J=Y=>`$${Y.toFixed(2)}`;return b?m.jsxs(Uu,{className:"Token",children:[m.jsx("div",{className:"Token__Banner",children:m.jsx(qd,{pools:[],vaults:[]})}),m.jsxs("div",{className:"Token__Breadcrumbs",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:80,height:16,borderRadius:4})]}),m.jsxs("div",{className:"Token__Content",children:[m.jsxs("div",{className:"Token__Left",children:[m.jsx("div",{className:"Token__Header",children:m.jsxs("div",{className:"Token__HeaderTop",children:[m.jsxs("div",{className:"Token__HeaderLogoName",children:[m.jsx(Ke,{width:64,height:64,borderRadius:12}),m.jsxs("div",{className:"Token__HeaderNameTicker",style:{marginLeft:"16px"},children:[m.jsx(Ke,{width:200,height:28,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:80,height:20,borderRadius:4})]})]}),m.jsxs("div",{className:"Token__HeaderLinks",children:[m.jsx(Ke,{width:32,height:32,borderRadius:8,style:{marginRight:"8px"}}),m.jsx(Ke,{width:32,height:32,borderRadius:8,style:{marginRight:"8px"}}),m.jsx(Ke,{width:32,height:32,borderRadius:8,style:{marginRight:"8px"}}),m.jsx(Ke,{width:32,height:32,borderRadius:8})]})]})}),m.jsx("div",{className:"Token__Chart",style:{minHeight:340},children:m.jsx(Ke,{width:"100%",height:340,borderRadius:12})}),m.jsxs("div",{className:"Token__DetailSection",children:[m.jsx(Ke,{width:100,height:24,borderRadius:4,style:{marginBottom:"16
7737px"}}),m.jsxs("div",{className:"Token__StatsCarousel",children:[m.jsxs("div",{className:"Token__StatCard",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:120,height:24,borderRadius:4})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx(Ke,{width:100,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:80,height:24,borderRadius:4})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx(Ke,{width:40,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:80,height:24,borderRadius:4})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx(Ke,{width:90,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:100,height:24,borderRadius:4})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx(Ke,{width:80,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:90,height:24,borderRadius:4})]})]})]})]}),m.jsx("div",{className:"Token__Right",children:m.jsx("div",{className:"Token__SwapForm",children:m.jsx(Ke,{width:"100%",height:500,borderRadius:12})})})]})]}):A?m.jsxs(Uu,{className:"Token",children:[m.jsx("div",{className:"Token__Banner",children:m.jsx(qd,{pools:(C==null?void 0:C.data)||[],vaults:(T==null?void 0:T.data)||[]})}),m.jsxs("div",{className:"Token__Breadcrumbs",children:[m.jsx(gi,{to:"/explore?tab=tokens",className:"Token__BreadcrumbsLink",children:"Explore"}),m.jsx(qo,{}),m.jsx(gi,{to:"/explore?tab=tokens",className:"Token__BreadcrumbsLink",children:"Tokens"}),m.jsx(qo,{}),m.jsx("span",{className:"Token__BreadcrumbsLink__3",children:A.symbol})]}),m.jsxs("div",{className:"Token__Content",children:[m.jsxs("div",{className:"Token__Left",children:[m.jsx("div",{className:"Token__Header",children:m.jsxs("div",{className:"Token__HeaderTop",children:[m.jsxs("div",{className:"Token__HeaderLogoName",children:[m.jsx(ws,{logoUri:A.logoUri,symbol:A.symbol,name:A.name,id:A.address,size:64,className:"Token__HeaderLogo"}),m.jsxs("div",{className:"Token__HeaderNameTicker",children:[m.jsx("a",{href:A.address?`https://berascan.com/address/${A.address}`:"#",target:"_blank",rel:"noopener noreferrer",className:"Token__HeaderName Token__HeaderNameLink",title:`${A.name||A.symbol} - View on Berascan`,children:A.name||A.symbol}),m.jsx("p",{className:"Token__HeaderTicker",children:A.symbol})]})]}),m.jsxs("div",{className:"Token__HeaderLinks",children:[m.jsx("a",{href:A.address?`https://berascan.com/address/${A.address}`:"#",target:"_blank",rel:"noopener noreferrer",title:"View on explorer",className:"Token__IconLink",children:m.jsx(joe,{})}),A.website&&m.jsx("a",{href:A.website,target:"_blank",rel:"noopener noreferrer",title:"Project website",className:"Token__IconLink",children:m.jsx(FQe,{})}),A.twitter&&m.jsx("a",{href:`https://x.com/${A.twitter}`,target:"_blank",rel:"noopener noreferrer",title:"Project Twitter",className:"Token__IconLink",children:m.jsx(Voe,{})}),m.jsx("a",{href:"#",onClick:Y=>{Y.preventDefault(),navigator.clipboard.writeText(window.location.href)},title:"Share this page","aria-label":"Share this page",className:"Token__IconLink",children:m.jsx(jQe,{})})]})]})}),m.jsx("div",{className:"Token__Chart",style:{minHeight:340},children:m.jsx(w4,{tokenAddress:w||t,chartType:e,interval:i,metric:r,height:340,showToolbar:!0,priceFormatter:J,onChartTypeChange:D,onIntervalChange:O,onMetricChange:H,dataType:"token",fallbackPoolAddress:(K==null?void 0:K.fallbackPoolAddress)??null,fallbackFromTokenAddress:(K==null?void 0:K.fallbackFromTokenAddress)??null,fallbackToTokenAddress:(K==null?void 0:K.fallbackToTokenAddress)??null})}),m.jsx("div",{className:"Token__SwapForm--mobile",children:m.jsx(Of,{toggleSidebar:()=>{},initialFromToken:z,initialToToken:A,enableDepositWithdraw:!1,showDepositLiquidityTab:!!A,depositLiquidityUrl:q,showTitle:!1,hideMetrics:!0,isSticky:!1})}),m.jsxs("div",{className:"Token__DetailSection",children:[m.jsx("h2",{className:"Token__DetailSectionTitle",children:"Metrics"}),m.jsxs("div",{className:"Token__StatsCarousel",children:[m.jsxs("div",{className:"Token__StatCard",children:[m.jsx("h4",{className:"Token__StatCardTitle",children:"Price"}),m.jsx("div",{className:"Token__StatCardLabel",children:_!==null?`$${(a!==null?a:_).toFixed(4)}`:m.jsx(Ke,{width:120,height:24,borderRadius:4})})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx("h4",{className:"Token__StatCardTitle",children:"24h Variation"}),m.jsx("div",{className:`Token__StatCardLabel ${N!==null?N>=0?"Token__StatCardLabel--positive":"Token__StatCardLabel--negative":""}`,children:N!==null?m.jsxs("div",{className:"Token__StatCardChange",children:[m.jsx("img",{src:N>=0?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:N>=0?"up":"down",width:14,height:14,className:"Token__StatCardChangeIcon"}),m.jsxs("span",{children:[Math.abs(l!==null?l:N).toFixed(2),"%"]})]}):m.jsx(Ke,{width:80,height:24,borderRadius:4})})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx("h4",{className:"Token__StatCardTitle",children:"TVL"}),m.jsx("div",{className:"Token__StatCardLabel",children:E?m.jsx(Ke,{width:80,height:20}):$===null||$===0||isNaN($)?"N/A":`$${An($)}`})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx("h4",{className:"Token__StatCardTitle",children:"Market Cap"}),m.jsx("div",{className:"Token__StatCardLabel",children:U===null||isNaN(U)?"N/A":`$${An(U)}`})]}),m.jsxs("div",{className:"Token__StatCard",children:[m.jsx("h4",{className:"Token__StatCardTitle",children:"24h Volume"}),m.jsx("div",{className:"Token__StatCardLabel",children:E?m.jsx(Ke,{width:80,height:20}):j===null||isNaN(j)?"N/A":`$${An(j)}`})]})]})]})]}),m.jsx("div",{className:"Token__Right",children:m.jsx("div",{className:"Token__SwapForm",children:m.jsx(Of,{toggleSidebar:()=>{},initialFromToken:z,initialToToken:A,enableDepositWithdraw:!1,showDepositLiquidityTab:!!A,depositLiquidityUrl:q,showTitle:!1,hideMetrics:!0,isSticky:!0})})})]})]}):m.jsx("div",{className:"Token__Wrapper",children:m.jsxs("div",{className:"Token__Error",children:[m.jsx("h2",{children:"Token not found"}),m.jsx("p",{children:"The requested token does not exist or has been removed"}),m.jsx(gi,{to:"/explore/tokens",className:"button button--primary",children:"Back to tokens"})]})})},GQe=({currentPage:t,totalPages:e,itemsPerPage:n,totalItems:i,onPageChange:s})=>{if(e<=1)return null;const r=M.useMemo(()=>{const o=[];if(e<=1)return o;const a=Math.min(3,e);for(let c=1;c<=a;c++)o.push({key:String(c),label:String(c)});return t>
77373&&t<=e&&(o.some(c=>c.key===String(t))||o.push({key:String(t),label:String(t)})),e>3&&t<e&&o.push({key:"next",label:"â"}),o},[e,t]);return m.jsx("div",{style:{marginTop:"20px",marginBottom:"20px",display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:m.jsx(k2,{segments:r,selectedKey:String((t>3,t)),onChange:o=>{if(o==="next"){const a=Math.min(t+1,e);s(a)}else o!=="ellipsis"&&o!=="next"&&s(parseInt(o))}})})};function Zp({columns:t,data:e,className:n="",emptyMessage:i="No data",tableClassName:s="Table",wrapperClassName:r="Table__Wrapper",scrollClassName:o="Table__Scroll",getRowClassName:a,getRowRef:c,isLoading:l=!1,pagination:d,infiniteLoad:h,defaultSortKey:p,defaultSortDirection:g=null,itemLabel:b="items",onRowClick:w,onRowMouseEnter:C,itemsPerPage:E=10,onSort:T,currentSortKey:A,currentSortDirection:k}){const[R,P]=M.useState(p||null),[B,F]=M.useState(g),z=T?A||null:(h==null?void 0:h.currentSortKey)||R,K=T?k||null:(h==null?void 0:h.currentSortDirection)||B,q=v=>{const _=t.find(N=>N.key===v);if(_!=null&&_.sortable){if(T){let N="asc";z===v&&(K==="asc"?N="desc":K==="desc"?N=null:N="asc"),T(v,N);return}if(h!=null&&h.onSort){let N="asc";z===v&&(K==="asc"?N="desc":K==="desc"?N=null:N="asc"),h.onSort(v,N);return}R===v?B==="asc"?F("desc"):B==="desc"?(F(null),P(null)):F("asc"):(P(v),F("asc"))}},G=M.useMemo(()=>{if(h!=null&&h.onSort||T||!R||!B)return e;const v=t.find(_=>_.key===R);return v!=null&&v.sortable?[...e].sort((_,N)=>{let $,U;if(v.sortValue?($=v.sortValue(_),U=v.sortValue(N)):($=_[R],U=N[R]),$==null&&U==null)return 0;if($==null)return B==="asc"?1:-1;if(U==null)return B==="asc"?-1:1;const j=typeof $=="string"?parseFloat($.replace(/[$,]/g,"")):$,D=typeof U=="string"?parseFloat(U.replace(/[$,]/g,"")):U;if(!isNaN(j)&&!isNaN(D))return B==="asc"?j-D:D-j;const O=String($).toLowerCase(),H=String(U).toLowerCase();return B==="asc"?O.localeCompare(H):H.localeCompare(O)}):e},[e,R,B,t,h]),I=M.useMemo(()=>{if(!d||T)return G;const v=(d.currentPage-1)*d.itemsPerPage;return G.slice(v,v+d.itemsPerPage)},[G,d,T]),S=[r,n,d?"Table__Wrapper--with-pagination":"",h?"Table__Wrapper--with-infinite-load":""].filter(Boolean).join(" ");return m.jsxs(M.Fragment,{children:[m.jsx("div",{className:S,children:m.jsx("div",{className:o,children:m.jsxs("table",{className:`${s} Table--bordered`,children:[m.jsx("thead",{children:m.jsx("tr",{children:t.map(v=>m.jsx("th",{className:`${v.className||""} ${v.sortable?"Table__SortableHeader":""}`.trim(),onClick:()=>q(v.key),style:{cursor:v.sortable?"pointer":"default",width:v.width,userSelect:"none"},title:v.sortable?"Click to sort":void 0,children:v.label},v.key))})}),m.jsx("tbody",{children:l?Array.from({length:10}).map((v,_)=>m.jsx("tr",{children:t.map(N=>m.jsx("td",{className:typeof N.className=="function"?"":N.className,style:{padding:"20px 24px"},children:m.jsx(Ke,{width:"100%",height:"20px"})},N.key))},`skeleton-${_}`)):I.length===0?m.jsx("tr",{className:"Table__EmptyRow",children:m.jsx("td",{colSpan:t.length,className:"Table__Empty",style:{textAlign:"center",padding:"20px 24px",color:"rgba(255, 255, 255, 0.6)",fontSize:"14px",fontWeight:400,lineHeight:"1.5"},children:i})}):I.map((v,_)=>{let N=!1;const $=t.find(U=>U.key==="size");return $&&$.render&&$.render(v,_)===null?null:m.jsx("tr",{ref:U=>c==null?void 0:c(v,U),className:`${a?a(v,_):""} ${w?"group":""}`.trim(),onClick:()=>w==null?void 0:w(v,_),onMouseEnter:()=>C==null?void 0:C(v,_),style:{cursor:w?"pointer":"default"},children:t.map((U,j)=>{const D=U.colSpan?U.colSpan(v,_):void 0,O=typeof U.className=="function"?U.className(v,_):U.className,H=O&&(O==="Table__Empty"||typeof O=="string"&&O.includes("Table__Empty"));return D&&D>1&&!N?(N=!0,m.jsx("td",{className:O,colSpan:D,style:H?{textAlign:"center",padding:"20px 24px",color:"rgba(255, 255, 255, 0.6)",fontSize:"14px",fontWeight:400}:void 0,children:U.render?U.render(v,_):v[U.key]},U.key)):N&&j>0?null:m.jsx("td",{className:O,children:U.render?U.render(v,_):v[U.key]},U.key)})},_)}).filter(Boolean)})]})})}),d&&m.jsx(GQe,{...d})]})}const KQe=({address:t,type:e="address",children:n,showIcon:i=!0,className:s="Table__Icon",title:r})=>{const a=`https://berascan.com/${e}/${t}`,c=l=>{l.stopPropagation()};return m.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:s,title:r||t,onClick:c,children:n||(i?m.jsx(joe,{}):null)})}
7737,YQe=({searchValue:t=""})=>{var T;const[n,i]=M.useState(1),{data:s,isLoading:r}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{const A=await fetch("https://api.winnieswap.com/token/list");if(!A.ok)return[];const k=await A.json();return Array.isArray(k)?k:(k==null?void 0:k.data)||[]},staleTime:300*1e3,refetchOnMount:!0,refetchOnWindowFocus:!1}),o=t&&t.trim()!=="",{data:a,isLoading:c,isFetchingNextPage:l,hasNextPage:d,fetchNextPage:h}=nS({queryKey:["transactions",t],queryFn:async({pageParam:A})=>{var F,z;const k="https://api.winnieswap.com",R=o?100:25,P=o?null:A||null,B=new URLSearchParams;B.set("limit",String(R)),P&&B.set("cursor",P);try{const K=await fetch(`${k}/transactions?${B.toString()}`);if(!K.ok){console.error("[TransactionsTable] API error:",K.status,K.statusText);const G=await K.text();return console.error("[TransactionsTable] API error response:",G),{items:[],pageInfo:{hasNextPage:!1,endCursor:null}}}const q=await K.json();return console.log("[TransactionsTable] API response:",{itemsCount:((F=q==null?void 0:q.items)==null?void 0:F.length)||0,hasPageInfo:!!(q!=null&&q.pageInfo),firstItem:(z=q==null?void 0:q.items)==null?void 0:z[0],resultKeys:Object.keys(q||{})}),!q.items&&!Array.isArray(q)&&console.warn("[TransactionsTable] Unexpected API response format:",q),Array.isArray(q)?{items:q,pageInfo:{hasNextPage:!1,endCursor:null}}:q}catch(K){return console.error("[TransactionsTable] Fetch error:",K),{items:[],pageInfo:{hasNextPage:!1,endCursor:null}}}},getNextPageParam:A=>{var k,R;if(!(o&&(((k=A==null?void 0:A.items)==null?void 0:k.length)||0)>=500))return(R=A==null?void 0:A.pageInfo)!=null&&R.hasNextPage?A.pageInfo.endCursor:void 0},initialPageParam:null,staleTime:300*1e3,gcTime:1440*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:30*1e3,refetchIntervalInBackground:!0,placeholderData:A=>A}),p=M.useMemo(()=>{if(!(a!=null&&a.pages))return[];const A=s||[],k=new Map,R=new Map,P=new Map;A.forEach(F=>{const z=(F.address||F.id||"").toLowerCase();z&&(P.set(z,F),F.logoUri&&R.set(z,F.logoUri)),F.symbol&&(k.set(F.symbol.toUpperCase(),F.logoUri||null),(F.symbol.toUpperCase()==="WBERA"||F.symbol.toUpperCase()==="EWBERA")&&(k.set("EWBERA",F.logoUri||null),k.set("WBERA",F.logoUri||null)))});let B=a.pages.flatMap(F=>{const z=F.items||[];return console.log("[TransactionsTable] Processing page with",z.length,"items"),z.map(K=>{var G,I,S,v,_,N,$,U,j,D,O,H,J,W,Z,Y,Q,ee,ie,re,oe,de,he,ue,be,_e,Ne,pe,Te,ve,xe,Ye,ze,ft,lt,We,Dt,Fe,it,Qt,ke,nt,ht;if((G=K.swaps)!=null&&G.items&&Array.isArray(K.swaps.items)){const At=K.swaps.items[0];if(!At||!At.pool)return console.warn("Transaction with swaps structure missing pool:",K==null?void 0:K.id),null;K={...K,...At,pool:At.pool}}if(!K||!K.pool)return console.warn("Transaction missing pool:",K==null?void 0:K.id,"structure:",Object.keys(K||{})),null;if(!K.pool.token0Ref)return console.warn("Transaction missing token0Ref:",K.id,"pool structure:",Object.keys(K.pool||{}),"full swap:",K),null;const q=At=>{if(!At)return{id:"unknown",symbol:"UNKNOWN",name:"Unknown Token",decimals:18,logoUri:null};const zt=(At.id||"").toLowerCase();if(zt&&zt!=="unknown"&&P.has(zt)){const Ln=P.get(zt);return{id:Ln.address||Ln.id||At.id,symbol:typeof Ln.symbol=="string"?Ln.symbol:typeof At.symbol=="string"?At.symbol:"UNKNOWN",name:typeof Ln.name=="string"?Ln.name:typeof At.name=="string"?At.name:"Unknown Token",decimals:Ln.decimals||At.decimals||18,logoUri:Ln.logoUri||At.logoUri||null}}return{id:At.id||"unknown",symbol:typeof At.symbol=="string"&&At.symbol.trim()!==""?At.symbol:"UNKNOWN",name:typeof At.name=="string"&&At.name.trim()!==""?At.name:"Unknown Token",decimals:At.decimals||18,logoUri:At.logoUri||null}};if(K.pool.token0Ref=q(K.pool.token0Ref),K.pool.token1Ref=q(K.pool.token1Ref),BigInt(K.amount0)>0n){const At=typeof((I=K.pool.token0Ref)==null?void 0:I.symbol)=="string"?K.pool.token0Ref.symbol.toUpperCase():null,zt=typeof((S=K.pool.token1Ref)==null?void 0:S.symbol)=="string"?K.pool.token1Ref.symbol.toUpperCase():null,Ln=(((v=K.pool.token0Ref)==null?void 0:v.id)||"").toLowerCase(),gn=(((_=K.pool.token1Ref)==null?void 0:_.id)||"").toLowerCase(),yn=At&&At!=="UNKNOWN"?k.get(At)||null:Ln&&Ln!=="unknown"&&R.get(Ln)||null,bi=zt&&zt!=="UNKNOWN"?k.get(zt)||null:gn&&gn!=="unknown"&&R.get(gn)||null,En=yn||((N=K.pool.token0Ref)==null?void 0:N.logoUri)||null,yt=bi||(($=K.pool.token1Ref)==null?void 0:$.logoUri)||null,mt=(U=K.pool.token0Ref)!=null&&U.symbol&&K.pool.token0Ref.symbol!=="UNKNOWN"?K.pool.token0Ref.symbol
7737:void 0,_t=(j=K.pool.token1Ref)!=null&&j.symbol&&K.pool.token1Ref.symbol!=="UNKNOWN"?K.pool.token1Ref.symbol:void 0,Vt=xr(mt,(D=K.pool.token0Ref)!=null&&D.name&&K.pool.token0Ref.name!=="Unknown Token"?K.pool.token0Ref.name:void 0,(O=K.pool.token0Ref)!=null&&O.id&&K.pool.token0Ref.id!=="unknown"?K.pool.token0Ref.id:void 0,En||((H=K.pool.token0Ref)==null?void 0:H.logoUri)||void 0),Yn=xr(_t,(J=K.pool.token1Ref)!=null&&J.name&&K.pool.token1Ref.name!=="Unknown Token"?K.pool.token1Ref.name:void 0,(W=K.pool.token1Ref)!=null&&W.id&&K.pool.token1Ref.id!=="unknown"?K.pool.token1Ref.id:void 0,yt||((Z=K.pool.token1Ref)==null?void 0:Z.logoUri)||void 0);return{...K,tokenIn:{id:((Y=K.pool.token0Ref)==null?void 0:Y.id)||"",symbol:typeof((Q=K.pool.token0Ref)==null?void 0:Q.symbol)=="string"?K.pool.token0Ref.symbol:"UNKNOWN",name:typeof((ee=K.pool.token0Ref)==null?void 0:ee.name)=="string"?K.pool.token0Ref.name:"",decimals:((ie=K.pool.token0Ref)==null?void 0:ie.decimals)||18,logoUri:Vt},tokenOut:{id:((re=K.pool.token1Ref)==null?void 0:re.id)||"",symbol:typeof((oe=K.pool.token1Ref)==null?void 0:oe.symbol)=="string"?K.pool.token1Ref.symbol:"UNKNOWN",name:typeof((de=K.pool.token1Ref)==null?void 0:de.name)=="string"?K.pool.token1Ref.name:"",decimals:((he=K.pool.token1Ref)==null?void 0:he.decimals)||18,logoUri:Yn},amountIn:BigInt(K.amount0),amountOut:BigInt(K.amount1)}}else{const At=typeof((ue=K.pool.token1Ref)==null?void 0:ue.symbol)=="string"?K.pool.token1Ref.symbol.toUpperCase():null,zt=typeof((be=K.pool.token0Ref)==null?void 0:be.symbol)=="string"?K.pool.token0Ref.symbol.toUpperCase():null,Ln=(((_e=K.pool.token1Ref)==null?void 0:_e.id)||"").toLowerCase(),gn=(((Ne=K.pool.token0Ref)==null?void 0:Ne.id)||"").toLowerCase(),yn=At&&At!=="UNKNOWN"?k.get(At)||null:Ln&&Ln!=="unknown"&&R.get(Ln)||null,bi=zt&&zt!=="UNKNOWN"?k.get(zt)||null:gn&&gn!=="unknown"&&R.get(gn)||null,En=yn||((pe=K.pool.token1Ref)==null?void 0:pe.logoUri)||null,yt=bi||((Te=K.pool.token0Ref)==null?void 0:Te.logoUri)||null,mt=(ve=K.pool.token1Ref)!=null&&ve.symbol&&K.pool.token1Ref.symbol!=="UNKNOWN"?K.pool.token1Ref.symbol:void 0,_t=(xe=K.pool.token0Ref)!=null&&xe.symbol&&K.pool.token0Ref.symbol!=="UNKNOWN"?K.pool.token0Ref.symbol:void 0,Vt=xr(mt,(Ye=K.pool.token1Ref)!=null&&Ye.name&&K.pool.token1Ref.name!=="Unknown Token"?K.pool.token1Ref.name:void 0,(ze=K.pool.token1Ref)!=null&&ze.id&&K.pool.token1Ref.id!=="unknown"?K.pool.token1Ref.id:void 0,En||void 0),Yn=xr(_t,(ft=K.pool.token0Ref)!=null&&ft.name&&K.pool.token0Ref.name!=="Unknown Token"?K.pool.token0Ref.name:void 0,(lt=K.pool.token0Ref)!=null&<.id&&K.pool.token0Ref.id!=="unknown"?K.pool.token0Ref.id:void 0,yt||void 0);return{...K,tokenIn:{id:((We=K.pool.token1Ref)==null?void 0:We.id)||"",symbol:typeof((Dt=K.pool.token1Ref)==null?void 0:Dt.symbol)=="string"?K.pool.token1Ref.symbol:"UNKNOWN",name:typeof((Fe=K.pool.token1Ref)==null?void 0:Fe.name)=="string"?K.pool.token1Ref.name:"",decimals:((it=K.pool.token1Ref)==null?void 0:it.decimals)||18,logoUri:Vt},tokenOut:{id:((Qt=K.pool.token0Ref)==null?void 0:Qt.id)||"",symbol:typeof((ke=K.pool.token0Ref)==null?void 0:ke.symbol)=="string"?K.pool.token0Ref.symbol:"UNKNOWN",name:typeof((nt=K.pool.token0Ref)==null?void 0:nt.name)=="string"?K.pool.token0Ref.name:"",decimals:((ht=K.pool.token0Ref)==null?void 0:ht.decimals)||18,logoUri:Yn},amountIn:BigInt(K.amount1),amountOut:BigInt(K.amount0)}}}).filter(Boolean)});if(console.log("[TransactionsTable] Total transactions after processing:",B.length),o){const F=t.toLowerCase();B=B.filter(z=>{var K,q,G,I;return z.id&&typeof z.id=="string"&&z.id.toLowerCase().includes(F)||z.recipient&&typeof z.recipient=="string"&&z.recipient.toLowerCase().includes(F)||((K=z.tokenIn)==null?void 0:K.symbol)&&typeof z.tokenIn.symbol=="string"&&z.tokenIn.symbol.toLowerCase().includes(F)||((q=z.tokenOut)==null?void 0:q.symbol)&&typeof z.tokenOut.symbol=="string"&&z.tokenOut.symbol.toLowerCase().includes(F)||((G=z.tokenIn)==null?void 0:G.name)&&typeof z.tokenIn.name=="string"&&z.tokenIn.name.toLowerCase().includes(F)||((I=z.tokenOut)==null?void 0:I.name)&&typeof z.tokenOut.name=="string"&&z.tokenOut.name.toLowerCase().includes(F)})}return B},[a,s,t,o]),g=Math.ceil(p.length/25);M.useEffect(()=>{i(1)},[t]);const b=M.useRef(!1);M.useEffect(()=>{var R;if(o){b.current=!1;return}const A=((R=a==null?void 0:a.pages)==null?void 0:R.length)||0,k=10;if(A>=k){b.current=!1;return}b.current||c||l||A>0&&A<k&&d&&(b.current=!0,h().finally(()=>{setTimeout(()=>{b.current=!1},100)}))},[(T=a==null?void 0:a.pages)==null?void 0:T.length,d,h,o,c,l]);const w=M.useMemo(()=>
7737{if(p.length!==0)return{currentPage:n,totalPages:g,itemsPerPage:25,totalItems:p.length,hasNextPage:n<g,hasPreviousPage:n>1,onPageChange:i,itemLabel:"transactions"}},[n,g,25,p.length]),C=[{label:"Time",key:"time",render:A=>{const k=new Date,R=new Date(Number(A.timestamp)*1e3),P=k.getTime()-R.getTime(),B=Math.floor(P/6e4),F=Math.floor(B/60),z=Math.floor(F/24);let K;return B<1?K="Just now":B<60?K=`${B}m ago`:F<24?K=`${F}h ago`:K=`${z}d ago`,m.jsx(KQe,{address:A.id||"",type:"tx",showIcon:!1,className:"Table__Address",children:K})}},{label:"Type",key:"type",render:A=>m.jsxs("span",{children:["Swap",m.jsx(ws,{logoUri:A.tokenIn.logoUri,symbol:A.tokenIn.symbol,name:A.tokenIn.name,id:A.tokenIn.id,size:"medium",skipProcessing:!1}),"for",m.jsx(ws,{logoUri:A.tokenOut.logoUri,symbol:A.tokenOut.symbol,name:A.tokenOut.name,id:A.tokenOut.id,size:"medium",skipProcessing:!1})]})},{label:"USD",key:"usd",render:A=>{const k=parseFloat(A.amountUSD||"0");return k<.01?"<$0.01":m.jsxs("span",{children:["$",k.toFixed(2)]})}},{label:"Sent",key:"amount1",render:A=>{const k=A.amountIn<0n?-A.amountIn:A.amountIn,R=parseFloat(dt(k,A.tokenIn.decimals||18));return m.jsxs("span",{children:[R<.01?"<0.01":R.toFixed(2),m.jsx(ws,{logoUri:A.tokenIn.logoUri,symbol:A.tokenIn.symbol,name:A.tokenIn.name,id:A.tokenIn.id,size:"medium",skipProcessing:!1})]})}},{label:"Received",key:"amount2",render:A=>{const k=parseFloat(dt(BigInt(A.amountOut)*-1n,A.tokenOut.decimals||18));return m.jsxs("span",{children:[k<.01?"<0.01":k.toFixed(2),m.jsx(ws,{logoUri:A.tokenOut.logoUri,symbol:A.tokenOut.symbol,name:A.tokenOut.name,id:A.tokenOut.id,size:"medium",skipProcessing:!1})]})}}],E=A=>{A.id&&window.open(`https://berascan.com/tx/${A.id}`,"_blank","noopener,noreferrer")};return m.jsx(Zp,{columns:C,data:p,isLoading:c&&!p.length,tableClassName:"Table Table--bordered",wrapperClassName:"Table__Wrapper",scrollClassName:"Table__Scroll",pagination:w,itemLabel:"transactions",emptyMessage:"No transactions found",onRowClick:E})},ZQe=` 7738 query GetUserPositions($owner: String!) { 7739 positions(where: { owner: $owner }) { 7740 totalCount 7741 pageInfo { 7742 endCursor 7743 hasNextPage 7744 hasPreviousPage 7745 startCursor 7746 } 7747 items { 7748 id 7749 owner 7750 token0 7751 token1 7752 tickLower 7753 tickUpper 7754 liquidity 7755 depositedToken0 7756 depositedToken1 7757 withdrawnToken0 7758 withdrawnToken1 7759 collectedFeesToken0 7760 collectedFeesToken1 7761 tokenId 7762 poolRef { 7763 id 7764 token0 7765 token1 7766 feeTier 7767 liquidity 7768 sqrtPrice 7769 tick 7770 totalValueLockedUSD 7771 token0Ref { 7772 id 7773 symbol 7774 name 7775 decimals 7776 logoUri 7777 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7778 items { 7779 priceUSD 7780 } 7781 } 7782 } 7783 token1Ref { 7784 id 7785 symbol 7786 name 7787 decimals 7788 logoUri 7789 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7790 items { 7791 priceUSD 7792 } 7793 } 7794 } 7795 poolDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7796 items { 7797 apr 7798 volumeUSD 7799 } 7800 } 7801 } 7802 } 7803 } 7804 } 7805`,QQe=t=>{var c,l;const e=t.depositedToken0,n=t.depositedToken1,i=((c=t.poolRef.token0Ref.tokenDayData.items[0])==null?void 0:c.priceUSD)||0,s=((l=t.poolRef.token1Ref.tokenDayData.items[0])==null?void 0:l.priceUSD)||0,r=t.poolRef.poolDayData.items[0],o={amount0:e,amount1:n,createdAt:new Date().toISOString(),liquidity:t.liquidity,owner:t.owner,poolAddress:t.poolRef.id,tickLower:parseInt(t.tickLower),tickUpper:parseInt(t.tickUpper),tokenId:t.tokenId,updatedAt:new Date().toISOString()},a={address:t.poolRef.id,apr:typeof(r==null?void 0:r.apr)=="number"?r.apr:typeof(r==null?void 0:r.apr)=="string"?parseFloat(r.apr):0,createdAt:new Date().toISOString(),fee:t.poolRef.feeTier/1e4,liquidity:t.poolRef.liquidity,sqrtPriceX96:t.poolRef.sqrtPrice,tick:t.poolRef.tick,token0:{TokenPrice:i>0?[{createdAt:new Date().toISOString(),price:i,priceSource:"ponder",tokenAddress:t.poolRef.token0Ref.id,volumeUSD:0}]:[],address:t.poolRef.token0Ref.id,symbol:t.poolRef.token0Ref.symbol,n
7805ame:t.poolRef.token0Ref.name,decimals:t.poolRef.token0Ref.decimals,logoUri:t.poolRef.token0Ref.logoUri},token1:{TokenPrice:s>0?[{createdAt:new Date().toISOString(),price:s,priceSource:"ponder",tokenAddress:t.poolRef.token1Ref.id,volumeUSD:0}]:[],address:t.poolRef.token1Ref.id,symbol:t.poolRef.token1Ref.symbol,name:t.poolRef.token1Ref.name,decimals:t.poolRef.token1Ref.decimals,logoUri:t.poolRef.token1Ref.logoUri},totalValueLockedUSD:t.poolRef.totalValueLockedUSD,volumeUSD:(r==null?void 0:r.volumeUSD)||0};return{position:o,pool:a}},Woe=()=>{const{address:t}=mn(),{data:e,isLoading:n,error:i,refetch:s}=Zt({queryKey:["positions-ponder",t],queryFn:async()=>{if(!t)throw new Error("No address");const o="https://sub.winnieswap.com";try{const c=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:ZQe,variables:{owner:t.toLowerCase()}})})).json();if(c.errors)throw new Error(c.errors[0].message);return c.data}catch(a){if(a instanceof TypeError||a instanceof Error&&(a.message.includes("fetch failed")||a.message.includes("ECONNREFUSED")||a.message.includes("Connection refused")||a.message.includes("Failed to fetch")))return console.warn("[usePositionsGraphQL] GraphQL service is not available, returning empty positions"),{positions:{items:[]}};throw a}},enabled:!!t,staleTime:3e4});return{positions:(e==null?void 0:e.positions.items.map(o=>QQe(o)))||[],isLoading:n,error:i,refetch:s}},zS=()=>{const t=Kc(),{address:e}=mn();return{prefetchTokenPage:async r=>{if(!r)return;const o="https://sub.winnieswap.com",a="https://api.winnieswap.com";t.getQueryData(["tokensStats"])||t.prefetchQuery({queryKey:["tokensStats"],queryFn:async()=>{const l=await fetch(`${a}/token/list`);return l.ok?l.json():[]},staleTime:300*1e3}).catch(()=>{});const c=r.toLowerCase();t.prefetchQuery({queryKey:["pools-for-token",r],queryFn:async()=>{var p,g;const l=` 7806 query GetPoolsForToken { 7807 pools( 7808 where: { 7809 OR: [ 7810 { token0: "${c}" } 7811 { token1: "${c}" } 7812 ] 7813 } 7814 orderBy: "totalValueLockedUSD" 7815 orderDirection: "desc" 7816 limit: 5 7817 ) { 7818 items { 7819 id 7820 token0 7821 token1 7822 totalValueLockedUSD 7823 volumeUSD 7824 feeTier 7825 token0Ref { 7826 id 7827 symbol 7828 name 7829 decimals 7830 logoUri 7831 } 7832 token1Ref { 7833 id 7834 symbol 7835 name 7836 decimals 7837 logoUri 7838 } 7839 poolDayData( 7840 orderBy: "date" 7841 orderDirection: "desc" 7842 limit: 1 7843 ) { 7844 items { 7845 date 7846 volumeUSD 7847 volumeUSD1D 7848 tvlUSD 7849 apr 7850 } 7851 } 7852 } 7853 } 7854 } 7855 `,d=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:l})});if(!d.ok)return{data:[]};const h=await d.json();return h.errors?{data:[]}:{data:((g=(p=h.data)==null?void 0:p.pools)==null?void 0:g.items)||[]}},staleTime:120*1e3}).catch(()=>{}),t.prefetchQuery({queryKey:["vaults-for-token",r],queryFn:async()=>{var p,g;const l=` 7856 query GetVaultsForToken { 7857 stickyVaults( 7858 where: { 7859 OR: [ 7860 { poolRef: { token0: "${c}" } } 7861 { poolRef: { token1: "${c}" } } 7862 ] 7863 } 7864 orderBy: "totalValueLockedUSD" 7865 orderDirection: "desc" 7866 limit: 5 7867 ) { 7868 items { 7869 id 7870 name 7871 totalValueLockedUSD 7872 autoWinVault 7873 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 7874 items { 7875 maxPotentialAPR 7876 } 7877 } 7878 poolRef { 7879 feeTier 7880 token0Ref { 7881 id 7882 symbol 7883 logoUri 7884 } 7885 token1Ref { 7886 id 7887 symbol 7888 logoUri 7889 } 7890 } 7891 } 7892 } 7893 } 7894 `,d=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:l})});if(!d.ok)return{data:[]};const h=await d.json();return h.errors?{data:[]}:{data:((g=(p=h.data)==null?void 0:p.stickyVaults)==null?void 0:g.items)||[]}},staleTime:120*1e3}).catch(()=>{})},prefetchPoolPage:async r=>{if(!r)return;const o="https://sub.winnieswap.com";t.prefetchQuery({queryKey:["pool",r],queryFn:async()=>{const l=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 7895 query GetTokensStats($id: String = "") { 7896 pool(id: $id) { 7897 collectedFeesUSD 7898 feeTier 7899 feesUSD 7900 id 7901 liquidity 7902 liquidityProviderCount 7903 sqrtPrice 7904 tick 7905 totalValueLockedUSD 7906 txCount 7907 volumeUSD 7908 feeGrowthGlobal0X128 7909 feeGrowthGlobal1X128 7910 poolDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 7911 items { 7912 apr 7913 date 7914 feesUSD 7915 tvlUSD 7916 txCount 7917 volumeUSD 7918 volumeUSD30D 7919 volumeUSD1D 7920 } 7921 } 7922 token0Ref { 7923 decimals 7924 id 7925 logoUri 7926 name 7927 symbol 7928 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7929 items { 7930 priceUSD 7931 } 7932 } 7933 } 7934 token1Ref { 7935 id 7936 logoUri 7937 name 7938 symbol 7939 decimals 7940 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7941 items { 7942 priceUSD 7943 } 7944 } 7945 } 7946 }, 7947 stickyVaults(where: {pool: $id}) { 7948 items { 7949 collectedFeesUSD 7950 id 7951 name 7952 totalValueLockedUSD 7953 vaultDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7954 items { 7955 apr 7956 maxPotentialAPR 7957 volumeUSD1D 7958 } 7959 } 7960 } 7961 } 7962 } 7963 `,variables:{id:r}})})).json();if(l.errors)throw new Error(l.errors[0].message);return{pool:l.data.pool,vault:l.data.stickyVaults.items[0],positions:[]}},staleTime:120*1e3}).catch(()=>{}),e&&t.prefetchQuery({queryKey:["user-positions",r,e],queryFn:async()=>{var d;const l=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 7964 query GetUserPositions($pool: String!, $owner: String!) { 7965 positions(where: {pool: $pool, owner: $owner}) { 7966 items { 7967 id 7968 pool 7969 tokenId 7970 tickLower 7971 tickUpper 7972 liquidity 7973 depositedToken0 7974 depositedToken1 7975 withdrawnToken0 7976 withdrawnToken1 7977 poolRef { 7978 id 7979 sqrtPrice 7980 tick 7981 liquidity 7982 token0Ref { 7983 logoUri 7984 id 7985 name 7986 symbol 7987 decimals 7988 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 7989 items { 7990 priceUSD 7991 } 7992 } 7993 } 7994 token1Ref { 7995 id 7996 logoUri 7997 name 7998 symbol 7999 decimals 8000 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8001 items { 8002 priceUSD 8003 } 8004 } 8005 } 8006 feeTier 8007 } 8008 } 8009 } 8010 } 8011 `,variables:{pool:r,owner:e}})})).json();return l.errors?[]:((d=l.data.positions)==null?void 0:d.items)||[]},staleTime:300*1e3}).catch(()=>{})},prefetchVaultPage:async r=>{if(!r)return;const o="https://sub.winnieswap.com";t.prefetchQuery({queryKey:["stickyVault",r],queryFn:async()=>{const l=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 8012 query GetStickyVaults($id: String = "", $user: String = "") { 8013 stickyVault(id: $id) { 8014 id 8015 name 8016 createdAtTimestamp 8017 createdAtBlockNumber 8018 totalValueLockedUSD 8019 txCount 8020 autoWinVault 8021 autoWinVaultRef { 8022 id 8023 totalBgtClaimed 8024 estimatedAPR 8025 positions(where: {user: $user}) { 8026 items { 8027 user 8028 shares 8029 firstDepositAt 8030 lastUpdateAt 8031 } 8032 } 8033 } 8034 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8035 items { 8036 apr 8037 maxPotentialAPR 8038 volumeUSD1D 8039 volumeUSD30D 8040 totalValueLockedUSD 8041 totalSupply 8042 } 8043 } 8044 positions(where: {user: $user}) { 8045 items { 8046 id 8047 user 8048 shares 8049 currentValueUSD 8050 feesEarnedUSD 8051 realizedPnLUSD 8052 initialValueUSD 8053 totalPnLUSD 8054 } 8055 } 8056 poolRef { 8057 id 8058 feeTier 8059 token1Ref { 8060 id 8061 name 8062 symbol 8063 logoUri 8064 decimals 8065 tokenDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8066 items { 8067 priceUSD 8068 } 8069 } 8070 } 8071 token0Ref { 8072 id 8073 name 8074 symbol 8075 logoUri 8076 decimals 8077 tokenDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8078 items { 8079 priceUSD 8080 } 8081 } 8082 } 8083 } 8084 } 8085 } 8086 `,variables:{id:r,user:(e==null?void 0:e.toLowerCase())||""}})})).json();if(l.errors)throw new Error(l.errors[0].message);return l.data.stickyVault},staleTime:120*1e3}).catch(()=>{})}}},XQe=` 8087 query GetPoolsStats($limit: Int!, $after: String, $orderBy: String!, $orderDirection: String!) { 8088 pools( 8089 limit: $limit 8090 after: $after 8091 orderBy: $orderBy 8092 orderDirection: $orderDirection 8093 ) { 8094 totalCount 8095 pageInfo { 8096 endCursor 8097 hasNextPage 8098 hasPreviousPage 8099 startCursor 8100 } 8101 items { 8102 feeTier 8103 id 8104 liquidity 8105 poolDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8106 items { 8107 tvlUSD 8108 volumeUSD 8109 apr 8110 activeRangeAPR 8111 volumeUSD1D 8112 volumeUSD30D 8113 } 8114 } 8115 token0Ref { 8116 name 8117 id 8118 symbol 8119 logoUri 8120 } 8121 token1Ref { 8122 id 8123 name 8124 symbol 8125 logoUri 8126 } 8127 totalValueLockedBERA 8128 totalValueLockedUSD 8129 volumeUSD 8130 } 8131 } 8132 }`,yN={SERVER_SORTABLE:{tvl:"totalValueLockedUSD",fee:"feeTier",pool:"totalValueLockedUSD"},CLIENT_SORTABLE:{apr_global:t=>{var n,i;const e=(i=(n=t.poolDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.apr)||"0")},vol1d:t=>{var n,i;const e=(i=(n=t.poolDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.volumeUSD1D)||"0")},vol30d:t=>{var n,i;const e=(i=(n=t.poolDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.volumeUSD30D)||"0")}}},JQe=({searchValue:t})=>{const n=Zo(),{address:i}=mn(),{positions:s}=Woe(),[r,o]=M.useState(1);zS();const{data:a}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{const I=await fetch("https://api.winnieswap.com/token/list");if(!I.ok)return[];const S=await I.json();return Array.isArray(S)?S:(S==null?void 0:S.data)||[]},staleTime:300*1e3}),c=M.useMemo(()=>I=>{if(!i||!s||s.length===0)return 0;const S=s.filter(v=>v.pool.address.toLowerCase()===I.toLowerCase());return S.length===0?0:S.reduce((v,_)=>{var N,$,U,j,D,O;try{const H=_.position,J=_.pool,W=BigInt(H.liquidity||"0");if(W===0n)return v;const Z=new on(Nn.id,J.token0.address,J.token0.decimals,J.token0.symbol,J.token0.name),Y=new on(Nn.id,J.token1.address,J.token1.decimals,J.token1.symbol,J.token1.name),Q=new to(Z,Y,J.fee*1e4,J.sqrtPriceX96,J.liquidity,J.tick),ee=new ca({pool:Q,tickLower:H.tickLower,tickUpper:H.tickUpper,liquidity:W.toString()}),ie=((U=($=(N=J.token0)==null?void 0:N.TokenPrice)==null?void 0:$[0])==null?void 0:U.price)||0,re=((O=(D=(j=J.token1)==null?void 0:j.TokenPrice)==null?void 0:D[0])==null?void 0:O.price)||0,oe=parseFloat(ee.amount0.toExact()),de=parseFloat(ee.amount1.toExact()),he=oe*ie,ue=de*re,be=he+ue;return v+be}catch(H){return console.warn("Error calculating position value with SDK:",H),v}},0)},[i,s]),[l,d]=M.useState("server"),[h,p]=M.useState({field:"totalValueLockedUSD",direction:"desc"}
8132),[g,b]=M.useState(null),w=t&&t.trim()!=="",{data:C,isLoading:E,isFetchingNextPage:T,hasNextPage:A,fetchNextPage:k}=nS({queryKey:["poolStats",t,l,h.field,h.direction,g==null?void 0:g.key,g==null?void 0:g.direction],queryFn:async({pageParam:I})=>{var _,N,$;const S=l==="client"||w?200:50,v=l==="client"||w?null:I||null;try{const U="https://sub.winnieswap.com";console.log("[PoolsTable] Fetching from GraphQL URL:",U);const j=await fetch(U,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:XQe,variables:{limit:S,after:v,orderBy:h.field,orderDirection:h.direction}})}),D=j.headers.get("content-type");if(!D||!D.includes("application/json")){const ee=await j.text();throw console.error("[PoolsTable] GraphQL returned non-JSON response:",{status:j.status,statusText:j.statusText,contentType:D,url:U,preview:ee.substring(0,200)}),new Error(`GraphQL endpoint returned ${D} instead of JSON. Status: ${j.status}`)}const O=await j.json();if(O.errors)throw console.error("[PoolsTable] GraphQL errors:",O.errors),new Error(O.errors[0].message);if((($=(N=(_=O.data)==null?void 0:_.pools)==null?void 0:N.items)==null?void 0:$.length)>0)return console.log("[PoolsTable] GraphQL returned pools:",O.data.pools.items.length),O.data.pools;console.log("[PoolsTable] GraphQL returned no pools, falling back to REST API");const H="https://api.winnieswap.com",J=`${H}/pool`;console.log("[PoolsTable] Fetching from REST API URL:",J);const W=await fetch(J);if(!W.ok){const ee=await W.text();throw console.error("[PoolsTable] REST API error response:",{status:W.status,statusText:W.statusText,url:J,preview:ee.substring(0,200)}),new Error(`REST API failed: ${W.statusText}`)}const Z=W.headers.get("content-type");if(!Z||!Z.includes("application/json")){const ee=await W.text();throw console.error("[PoolsTable] REST API returned non-JSON response:",{status:W.status,statusText:W.statusText,contentType:Z,url:J,preview:ee.substring(0,200)}),new Error(`REST API endpoint returned ${Z} instead of JSON. Status: ${W.status}`)}const Q=(await W.json()).map(ee=>({id:ee.address||ee.id,feeTier:ee.fee,liquidity:ee.liquidity,totalValueLockedUSD:ee.tvl||"0",totalValueLockedBERA:"0",volumeUSD:ee.volume24h||"0",token0Ref:{id:ee.token0.address,symbol:ee.token0.symbol||"UNKNOWN",name:ee.token0.name||"Unknown Token",logoUri:ee.token0.logoUri||null},token1Ref:{id:ee.token1.address,symbol:ee.token1.symbol||"UNKNOWN",name:ee.token1.name||"Unknown Token",logoUri:ee.token1.logoUri||null},poolDayData:{items:[{tvlUSD:ee.tvl||"0",volumeUSD:ee.volume24h||"0",apr:ee.apr||"0",activeRangeAPR:"0",volumeUSD1D:ee.volume24h||"0",volumeUSD30D:"0"}]}}));return{totalCount:Q.length,pageInfo:{endCursor:null,hasNextPage:!1,hasPreviousPage:!1,startCursor:null},items:Q}}catch(U){U instanceof TypeError||U instanceof Error&&(U.message.includes("fetch failed")||U.message.includes("ECONNREFUSED")||U.message.includes("Connection refused")||U.message.includes("Failed to fetch"))?console.warn("[PoolsTable] GraphQL service is not available, trying REST API fallback"):console.error("[PoolsTable] Error fetching pools from GraphQL, trying REST API:",U);try{const O="https://api.winnieswap.com/pool";console.log("[PoolsTable] Fetching from REST API URL (fallback):",O);const H=await fetch(O);if(!H.ok){const Y=await H.text();return console.warn("[PoolsTable] REST API failed:",{status:H.status,statusText:H.statusText,url:O,preview:Y.substring(0,200)}),{totalCount:0,pageInfo:{endCursor:null,hasNextPage:!1,hasPreviousPage:!1,startCursor:null},items:[]}}const J=H.headers.get("content-type");if(!J||!J.includes("application/json")){const Y=await H.text();throw console.error("[PoolsTable] REST API returned non-JSON response:",{status:H.status,statusText:H.statusText,contentType:J,url:O,preview:Y.substring(0,200)}),new Error(`REST API endpoint returned ${J} instead of JSON. Status: ${H.status}`)}const W=await H.json();console.log("[PoolsTable] REST API returned pools (fallback):",W.length,W);const Z=W.map(Y=>({id:Y.address||Y.id,feeTier:Y.fee,liquidity:Y.liquidity,totalValueLockedUSD:Y.tvl||"0",totalValueLockedBERA:"0",volumeUSD:Y.volume24h||"0",token0Ref:{id:Y.token0.address,symbol:Y.token0.symbol||"UNKNOWN",name:Y.token0.name||"Unknown Token",logoUri:Y.token0.logoUri||null},token1Ref:{id:Y.token1.address,symbol:Y.token1.symbol||"UNKNOWN",name:Y.token1.name||"Unknown Token",logoUri:Y.token1.logoUri||null},poolDayData:{items:[{tvlUSD:Y.tvl||"0",volumeUSD:Y.volume24h||"0",apr:Y.apr||"0",activeRangeAPR:"0",volumeUSD1D:Y.volume24h||"0",volumeUSD30D:"0"}]}}));return{totalCount:Z.length,pageInfo:{endCursor:null,hasNextPage:!1,hasPreviousPage:!1,startCursor:null},items:Z}}catch(D){return console.warn("Error fetching pools from REST API, returning empty array:",D),{totalCount:0,pageInfo:{endCursor:null,hasNextPage:!1,hasPreviousPage:!1,startCursor:null},items:[]}}}},getNextPageParam:I=>{var S;if(!(l==="client"||w))return(S=I==null?void 0:I.pageInfo)!=null&&S.hasNextPage?I.pageInfo.endCursor:void 0},initialPageParam:null,staleTime:300*1e3,gcTime:1440*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:!1,refetchIntervalInBackgroun
8132d:!1,placeholderData:I=>I}),R=M.useMemo(()=>{if(!(C!=null&&C.pages))return console.log("[PoolsTable] No data pages available"),[];let I=C.pages.flatMap(N=>N.items||[]);console.log("[PoolsTable] Total pools from data:",I.length);const S=a||[],v=new Map;S.forEach(N=>{N.symbol&&(v.set(N.symbol.toUpperCase(),N.logoUri||null),(N.symbol.toUpperCase()==="WBERA"||N.symbol.toUpperCase()==="EWBERA")&&(v.set("EWBERA",N.logoUri||null),v.set("WBERA",N.logoUri||null)))}),I=I.map(N=>{var O,H,J,W,Z,Y,Q,ee,ie,re,oe,de;const $=v.get((H=(O=N.token0Ref)==null?void 0:O.symbol)==null?void 0:H.toUpperCase())||((J=N.token0Ref)==null?void 0:J.logoUri)||null,U=v.get((Z=(W=N.token1Ref)==null?void 0:W.symbol)==null?void 0:Z.toUpperCase())||((Y=N.token1Ref)==null?void 0:Y.logoUri)||null,j=xr((Q=N.token0Ref)==null?void 0:Q.symbol,((ee=N.token0Ref)==null?void 0:ee.name)||void 0,(ie=N.token0Ref)==null?void 0:ie.id,$||void 0),D=xr((re=N.token1Ref)==null?void 0:re.symbol,((oe=N.token1Ref)==null?void 0:oe.name)||void 0,(de=N.token1Ref)==null?void 0:de.id,U||void 0);return{...N,token0Ref:{...N.token0Ref,logoUri:j},token1Ref:{...N.token1Ref,logoUri:D}}});const _=I.length;if(I=I.filter(N=>!Mp(N.id)),_!==I.length&&console.log(`[PoolsTable] Filtered out ${_-I.length} blacklisted pools`),console.log("[PoolsTable] Pools after blacklist filter:",I.length),w){const N=t.toLowerCase();I=I.filter($=>{var U,j,D,O;return $.id&&typeof $.id=="string"&&$.id.toLowerCase().includes(N)||((U=$.token0Ref)==null?void 0:U.symbol)&&typeof $.token0Ref.symbol=="string"&&$.token0Ref.symbol.toLowerCase().includes(N)||((j=$.token1Ref)==null?void 0:j.symbol)&&typeof $.token1Ref.symbol=="string"&&$.token1Ref.symbol.toLowerCase().includes(N)||((D=$.token0Ref)==null?void 0:D.name)&&typeof $.token0Ref.name=="string"&&$.token0Ref.name.toLowerCase().includes(N)||((O=$.token1Ref)==null?void 0:O.name)&&typeof $.token1Ref.name=="string"&&$.token1Ref.name.toLowerCase().includes(N)})}return l==="client"&&g?I=[...I].sort((N,$)=>{const U=g.sortFn(N),j=g.sortFn($);return g.direction==="asc"?U-j:j-U}):l==="server"&&!w&&h.field==="totalValueLockedUSD"&&h.direction==="desc"&&i&&(I=[...I].sort(($,U)=>{const j=c($.id),D=c(U.id);if(j>0&&D===0)return-1;if(j===0&&D>0)return 1;if(j>0&&D>0){const J=D-j;if(J!==0)return J}const O=parseFloat($.totalValueLockedUSD||"0");return parseFloat(U.totalValueLockedUSD||"0")-O})),I},[C,a,t,w,l,g,i,c]),P=()=>{if(l==="client"&&g)return g.key;for(const[I,S]of Object.entries(yN.SERVER_SORTABLE))if(S===h.field)return I;return"tvl"},B=()=>l==="client"&&g?g.direction:h.direction,F=(I,S)=>{const v=S||"desc";if(I==="holdings"){d("client"),b({key:I,direction:v,sortFn:N=>c(N.id)}),p({field:"totalValueLockedUSD",direction:"desc"});return}const _=yN.SERVER_SORTABLE[I];if(_)d("server"),b(null),p({field:_,direction:v});else{const N=yN.CLIENT_SORTABLE[I];N?(d("client"),b({key:I,direction:v,sortFn:N}),p({field:"totalValueLockedUSD",direction:"desc"})):(d("server"),b(null),p({field:"totalValueLockedUSD",direction:v}))}},z=R.length===0?0:Math.ceil(R.length/25);M.useEffect(()=>{o(1)},[t,l,h.field,h.direction,g==null?void 0:g.key,g==null?void 0:g.direction]);const K=M.useMemo(()=>{if(!R.length)return[];const I=(r-1)*25;return R.slice(I,I+25)},[R,r,25]),q=M.useMemo(()=>{if(R.length!==0)return{currentPage:r,totalPages:z,itemsPerPage:25,totalItems:R.length,hasNextPage:r<z,hasPreviousPage:r>1,onPageChange:o,itemLabel:"pools"}},[r,z,25,R.length]),G=[{label:"Pool name",key:"pool",className:"PoolsTable__PoolTd",sortable:!0,sortValue:I=>`${I.token0Ref.symbol}/${I.token1Ref.symbol}`,render:I=>{var D,O;const S=((D=I.token0Ref)==null?void 0:D.symbol)||"",v=((O=I.token1Ref)==null?void 0:O.symbol)||"";let _=S,N=v,$=I.token0Ref,U=I.token1Ref;S.toUpperCase()==="WBERA"||v.toUpperCase()==="WBERA"?v.toUpperCase()==="WBERA"&&(_=v,N=S,$=I.token1Ref,U=I.token0Ref):(S.toUpperCase()==="HONEY"||v.toUpperCase()==="HONEY")&&v.toUpperCase()==="HONEY"&&(_=v,N=S,$=I.token1Ref,U=I.token0Ref);const j=`${_}/${N}`;return m.jsxs("span",{className:"PoolsTable__PoolCell",children:[m.jsx("span",{className:"PoolsTable__LogoWrapper",children:m.jsx(If,{token0:{id:$.id,address:$.id,logoUri:$.logoUri,symbol:$.symbol},token1:{id:U.id,address:U.id,logoUri:U.logoUri,symbol:U.symbol},borderWidth:2,separatorWidth:1.5,size:28})}),m.jsx("span",{className:"PoolsTable__PoolName",children:j})]})}},{label:"Fee tier",key:"fee",className:"PoolsTable__FeeTd",sortable:!0,sortValue:I=>I.feeTier,render:I=>m.jsx("span",{className:"PoolsTable__FeeCell",children:`${I.feeTier/1e4}%`})},{label:"TVL",key:"tvl",className:"PoolsTable__TvlTd",sortable:!0,sortValue:I=>I.totalValueLockedUSD,render:I=>m.jsx("span",{className:"PoolsTable__TvlCell",children:I.totalValueLockedUSD!==0?`$${An(Number(I.totalValueLockedUSD))}`:"-"})},{label:"APY",key:"apr_global",className:"PoolsTable__AprTd",sortable:!0,sortValue:I=>{var S,v,_;return((_=(v=(S=I.poolDayData)==null?void 0:S.items)==null?void 0:v[0])==null?void 0:_.apr)||"0"},render:I=>{var S,v;return m.jsx("span",{className:"PoolsTable__AprCell",children:((v=(S=I.poolDayData)==null?void 0:S.items)==null?void 0:v.length)>0&&Number(I.poolDayData.items[0].apr)>0?`${I.poolDayData.items[0].apr}%`:"-"})}}
8132,{label:"Vol. 1d",key:"vol1d",className:"PoolsTable__Vol1dTd",sortable:!0,sortValue:I=>{var S,v,_;return((_=(v=(S=I.poolDayData)==null?void 0:S.items)==null?void 0:v[0])==null?void 0:_.volumeUSD1D)||0},render:I=>{var S,v;return m.jsx("span",{className:"PoolsTable__Vol1dCell",children:((v=(S=I.poolDayData)==null?void 0:S.items)==null?void 0:v.length)>0&&Number(I.poolDayData.items[0].volumeUSD1D)>0?`$${An(parseFloat(I.poolDayData.items[0].volumeUSD1D))}`:"-"})}},{label:"Vol. 30d",key:"vol30d",className:"PoolsTable__Vol30dTd",sortable:!0,sortValue:I=>I.monthVolumeUSD,render:I=>{var S,v;return m.jsx("span",{className:"PoolsTable__Vol30dCell",children:((v=(S=I.poolDayData)==null?void 0:S.items)==null?void 0:v.length)>0&&Number(I.poolDayData.items[0].volumeUSD30D)>0?`$${An(parseFloat(I.poolDayData.items[0].volumeUSD30D))}`:"-"})}},{label:"Holdings",key:"holdings",className:"PoolsTable__HoldingsTd",sortable:!0,sortValue:I=>i?c(I.id):0,render:I=>{if(!i)return m.jsx("span",{className:"PoolsTable__HoldingsCell",children:"-"});const S=c(I.id);return m.jsxs("span",{className:"PoolsTable__HoldingsCell",children:["$",An(S)]})}}];return m.jsx(Zp,{columns:G,data:K,isLoading:E&&!R.length,tableClassName:"Table Table--bordered",wrapperClassName:"Table__Wrapper",scrollClassName:"Table__Scroll",pagination:q,onSort:F,currentSortKey:P(),currentSortDirection:B(),itemLabel:"pools",onRowClick:I=>n(`/pools/${I.id||""}`),emptyMessage:"No pools found"})},bN={SERVER_SORTABLE:{name:"name",symbol:"symbol",volume:"volumeUSD"},CLIENT_SORTABLE:{price:t=>{var n,i;const e=(i=(n=t.tokenDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.priceUSD)||"0")},"1h":t=>{var n,i;const e=(i=(n=t.tokenDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.oneDayEvo)||"0")},"1d":t=>{var n,i;const e=(i=(n=t.tokenDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.oneMonthEvo)||"0")},"7d":t=>{var n,i;const e=(i=(n=t.tokenDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.oneWeekEvo)||"0")},mcap:t=>{var n,i;const e=(i=(n=t.tokenDayData)==null?void 0:n.items)==null?void 0:i[0];return parseFloat((e==null?void 0:e.marketCap)||"0")}}},eXe=` 8133 query GetTokensStats($limit: Int!, $after: String, $orderBy: String!, $orderDirection: String!) { 8134 tokens( 8135 limit: $limit 8136 after: $after 8137 orderBy: $orderBy 8138 orderDirection: $orderDirection 8139 ) { 8140 totalCount 8141 pageInfo { 8142 endCursor 8143 hasNextPage 8144 hasPreviousPage 8145 startCursor 8146 } 8147 items { 8148 feesUSD 8149 id 8150 name 8151 totalSupply 8152 volumeUSD 8153 symbol 8154 logoUri 8155 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8156 items { 8157 priceUSD 8158 close 8159 high 8160 low 8161 open 8162 oneDayEvo 8163 oneMonthEvo 8164 oneWeekEvo 8165 marketCap 8166 fdv 8167 volume24hUSD 8168 } 8169 } 8170 } 8171 } 8172 } 8173`,tXe=({searchValue:t})=>{const n=Zo(),[i,s]=M.useState(1),{prefetchTokenPage:r}=zS(),{data:o}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{const q=await fetch("https://api.winnieswap.com/token/list");if(!q.ok)return[];const G=await q.json();return Array.isArray(G)?G:(G==null?void 0:G.data)||[]},staleTime:300*1e3}),[a,c]=M.useState("server"),[l,d]=M.useState({field:"volumeUSD",direction:"desc"}),[h,p]=M.useState(null),g=t&&t.trim()!=="",{data:b,isLoading:w,isFetchingNextPage:C,hasNextPage:E,fetchNextPage:T}=nS({queryKey:["tokensStats",t,a,l.field,l.direction,h==null?void 0:h.key,h==null?void 0:h.direction],queryFn:async({pageParam:q})=>{var v,_;const G=a==="client"||g?200:50,I=a==="client"||g?null:q||null,S="https://sub.winnieswap.com";console.log("[TokensTable] Fetching from GraphQL URL:",S);try{const N=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:eXe,variables:{limit:G,after:I,orderBy:l.field,orderDirection:l.direction}})}),$=N.headers.get("content-type");if(!$||!$.includes("application/json")){const j=await N.text();throw console.error("[TokensTable] GraphQL returned non-JSON response:",{status:N.status,statusText:N.statusText,contentType:$,url:S,preview:j.substring(0,200)}),new Error(`GraphQL endpoint returned ${$} instead of JSON. Status: ${N.status}`)}const U=await N.json();if(U.errors)throw console.error("[TokensTable] GraphQL errors:",U.errors),new Error(U.errors[0].message);return console.log("[TokensTable] GraphQL returned tokens:",((_=(v=U.data.tokens)==null?void 0:v.items)==null?void 0:_.length)||0),U.data.tokens}catch(N){if(N instanceof TypeError||N instanceof Error&&(N.message.includes("fetch failed")||N.message.includes("ECONNREFUSED")||N.message.includes("Connection refused")||N.message.includes("Failed to fetch")))return console.warn("[TokensTable] GraphQL service is not available, returning empty array"),{totalCount:0,pageInfo:{endCursor:null,hasNextPage:!1,hasPreviousPage:!1,startCursor:null},items:[]};throw N}}
8173,getNextPageParam:q=>{var G;if(!(a==="client"||g))return(G=q==null?void 0:q.pageInfo)!=null&&G.hasNextPage?q.pageInfo.endCursor:void 0},initialPageParam:null,staleTime:300*1e3,gcTime:1440*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:!1,refetchIntervalInBackground:!1,placeholderData:q=>q}),A=M.useMemo(()=>{var D,O,H,J,W;if(!(b!=null&&b.pages))return console.log("[TokensTable] No data pages available"),[];let q=b.pages.flatMap(Z=>Z.items||[]);console.log("[TokensTable] Total tokens from data:",q.length);const G="0x0000000000000000000000000000000000000000",I="0x6969696969696969696969696969696969696969",S=q.some(Z=>{var Y,Q,ee;return((Y=Z.id)==null?void 0:Y.toLowerCase())===G.toLowerCase()||((Q=Z.symbol)==null?void 0:Q.toUpperCase())==="BERA"&&((ee=Z.id)==null?void 0:ee.toLowerCase())!==I.toLowerCase()}),v=q.find(Z=>{var Y,Q;return((Y=Z.id)==null?void 0:Y.toLowerCase())===I.toLowerCase()||((Q=Z.symbol)==null?void 0:Q.toUpperCase())==="WBERA"});!S&&v&&(q=[{...v,id:G,symbol:"BERA",name:"Berachain",logoUri:"https://res.cloudinary.com/duv0g402y/raw/upload/v1717773645/src/assets/bera.png"},...q],console.log("[TokensTable] Added BERA native token"));const _=o||[],N=new Map;_.forEach(Z=>{Z.symbol&&(N.set(Z.symbol.toUpperCase(),Z.logoUri||null),(Z.symbol.toUpperCase()==="WBERA"||Z.symbol.toUpperCase()==="EWBERA")&&(N.set("EWBERA",Z.logoUri||null),N.set("WBERA",Z.logoUri||null)))});const $="0xcaa70d2aa873ef057980844e18d9a9560bdffcc0",U=q.find(Z=>{var Y,Q,ee,ie;return((Y=Z.id)==null?void 0:Y.toLowerCase())===G.toLowerCase()||((Q=Z.id)==null?void 0:Q.toLowerCase())===I.toLowerCase()||((ee=Z.symbol)==null?void 0:ee.toUpperCase())==="BERA"||((ie=Z.symbol)==null?void 0:ie.toUpperCase())==="WBERA"});let j=((H=(O=(D=U==null?void 0:U.tokenDayData)==null?void 0:D.items)==null?void 0:O[0])==null?void 0:H.priceUSD)||null;if(!j&&o){const Z=o.find(Y=>{var Q,ee,ie,re;return((Q=Y.address)==null?void 0:Q.toLowerCase())===G.toLowerCase()||((ee=Y.address)==null?void 0:ee.toLowerCase())===I.toLowerCase()||((ie=Y.symbol)==null?void 0:ie.toUpperCase())==="BERA"||((re=Y.symbol)==null?void 0:re.toUpperCase())==="WBERA"});j=(Z==null?void 0:Z.priceUSD)||((W=(J=Z==null?void 0:Z.TokenDailyStats)==null?void 0:J[0])==null?void 0:W.priceUSD)||null}if(j?console.log("[TokensTable] BERA price found for ewBERA-4 fallback:",j):console.warn("[TokensTable] BERA price not found for ewBERA-4 fallback. BERA token from GraphQL:",U==null?void 0:U.symbol,U==null?void 0:U.name),q=q.map(Z=>{var re,oe,de,he,ue,be,_e,Ne,pe,Te,ve;const Y=N.get((re=Z.symbol)==null?void 0:re.toUpperCase())||Z.logoUri||null,Q=xr(Z.symbol,Z.name||void 0,Z.id,Y||void 0),ee=((oe=Z.id)==null?void 0:oe.toLowerCase())===$.toLowerCase()||((de=Z.symbol)==null?void 0:de.toUpperCase())==="EWBERA-4"||((he=Z.symbol)==null?void 0:he.toUpperCase())==="EWBERA4"||((ue=Z.name)==null?void 0:ue.toUpperCase())==="EWBERA-4"||((be=Z.name)==null?void 0:be.toUpperCase())==="EWBERA4";let ie=Z.tokenDayData;if(ee){const xe=(pe=(Ne=(_e=Z.tokenDayData)==null?void 0:_e.items)==null?void 0:Ne[0])==null?void 0:pe.priceUSD,Ye=xe&&parseFloat(xe)>0;!Ye&&j?(console.log("[TokensTable] Applying BERA price fallback to ewBERA-4:",j,"Token:",Z.symbol,Z.name),ie={items:[{...((ve=(Te=Z.tokenDayData)==null?void 0:Te.items)==null?void 0:ve[0])||{},priceUSD:j}]}):Ye?console.log("[TokensTable] ewBERA-4 has valid price:",xe):console.warn("[TokensTable] ewBERA-4 has no price and BERA fallback not available. Token:",Z.symbol,Z.name,"BERA token:",U==null?void 0:U.symbol,U==null?void 0:U.name)}return{...Z,logoUri:Q,tokenDayData:ie||Z.tokenDayData}}),g){const Z=t.toLowerCase();q=q.filter(Y=>Y.name&&typeof Y.name=="string"&&Y.name.toLowerCase().includes(Z)||Y.symbol&&typeof Y.symbol=="string"&&Y.symbol.toLowerCase().includes(Z)||Y.id&&typeof Y.id=="string"&&Y.id.toLowerCase().includes(Z))}return a==="client"&&h&&(q=[...q].sort((Z,Y)=>{const Q=h.sortFn(Z),ee=h.sortFn(Y);return h.direction==="asc"?Q-ee:ee-Q})),q=[...q].sort((Z,Y)=>{var ie,re,oe,de,he,ue;const Q=((ie=Z.symbol)==null?void 0:ie.toUpperCase())==="BERA"||((re=Z.id)==null?void 0:re.toLowerCase())===G.toLowerCase()||((oe=Z.id)==null?void 0:oe.toLowerCase())===I.toLowerCase(),ee=((de=Y.symbol)==null?void 0:de.toUpperCase())==="BERA"||((he=Y.id)==null?void 0:he.toLowerCase())===G.toLowerCase()||((ue=Y.id)==null?void 0:ue.toLowerCase())===I.toLowerCase();return Q&&!ee?-1:!Q&&ee?1:0}),q},[b,o,t,g,a,h]),k=()=>
8173{if(a==="client"&&h)return h.key;for(const[q,G]of Object.entries(bN.SERVER_SORTABLE))if(G===l.field)return q;return"volume"},R=()=>a==="client"&&h?h.direction:l.direction,P=(q,G)=>{const I=G||"desc",S=bN.SERVER_SORTABLE[q];if(S)c("server"),p(null),d({field:S,direction:I});else{const v=bN.CLIENT_SORTABLE[q];v?(c("client"),p({key:q,direction:I,sortFn:v}),d({field:"volumeUSD",direction:"desc"})):(c("server"),p(null),d({field:"volumeUSD",direction:I}))}},B=A.length===0?0:Math.ceil(A.length/25);M.useEffect(()=>{s(1)},[t,a,l.field,l.direction,h==null?void 0:h.key,h==null?void 0:h.direction]);const F=M.useMemo(()=>{if(!A.length)return[];const q=(i-1)*25;return A.slice(q,q+25)},[A,i,25]),z=M.useMemo(()=>{if(A.length!==0)return{currentPage:i,totalPages:B,itemsPerPage:25,totalItems:A.length,hasNextPage:i<B,hasPreviousPage:i>1,onPageChange:s,itemLabel:"tokens"}},[i,B,25,A.length]),K=[{label:"Token name",key:"name",className:"TokensTable__NameTd",width:"250px",sortable:!0,sortValue:q=>q.name||q.symbol||"",render:q=>{const G=d4(q),I=`${G.symbol} - ${G.name}`,S=v=>{v.stopPropagation(),n(`/tokens/${q.id||""}`)};return m.jsx("span",{className:"TokensTable__NameCell",children:m.jsxs("button",{type:"button",className:"TokensTable__NameButton",onClick:S,children:[m.jsx("span",{className:"TokensTable__LogoWrapper",children:m.jsx(ws,{logoUri:q.logoUri,symbol:q.symbol,name:q.name,id:q.id,size:"large",className:"TokensTable__Logo",skipProcessing:!0})}),m.jsx("span",{className:"TokensTable__NameText",children:I})]})})}},{label:"Price",key:"price",className:"TokensTable__PriceTd",sortable:!0,sortValue:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0?parseFloat(q.tokenDayData.items[0].priceUSD):0},render:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0?`$${An(parseFloat(q.tokenDayData.items[0].priceUSD))}`:"-"}},{label:"1h",key:"1h",className:"TokensTable__1hTd",sortable:!0,sortValue:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0?parseFloat(q.tokenDayData.items[0].oneDayEvo):0},render:q=>{var S,v;const G=((v=(S=q.tokenDayData)==null?void 0:S.items)==null?void 0:v.length)>0?parseFloat(q.tokenDayData.items[0].oneDayEvo):0;if(!G||G===0)return"-";const I=G>0;return m.jsxs("span",{style:{color:I?"#00FFA3":"#FF4D4D",display:"flex",alignItems:"center",gap:"4px"},children:[m.jsx("img",{src:I?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:I?"up":"down",style:{width:"12px",height:"12px"}}),m.jsxs("span",{children:[Math.abs(G).toFixed(2),"%"]})]})}},{label:"1d",key:"1d",className:"TokensTable__1dTd",sortable:!0,sortValue:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0?parseFloat(q.tokenDayData.items[0].oneMonthEvo):0},render:q=>{var S,v;const G=((v=(S=q.tokenDayData)==null?void 0:S.items)==null?void 0:v.length)>0?parseFloat(q.tokenDayData.items[0].oneMonthEvo):0;if(!G||G===0)return"-";const I=G>0;return m.jsxs("span",{style:{color:I?"#00FFA3":"#FF4D4D",display:"flex",alignItems:"center",gap:"4px"},children:[m.jsx("img",{src:I?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:I?"up":"down",style:{width:"12px",height:"12px"}}),m.jsxs("span",{children:[Math.abs(G).toFixed(2),"%"]})]})}},{label:"7d",key:"7d",className:"TokensTable__7dTd",sortable:!0,sortValue:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0?parseFloat(q.tokenDayData.items[0].oneWeekEvo):0},render:q=>{var S,v;const G=((v=(S=q.tokenDayData)==null?void 0:S.items)==null?void 0:v.length)>0?parseFloat(q.tokenDayData.items[0].oneWeekEvo):0;if(!G||G===0)return"-";const I=G>0;return m.jsxs("span",{style:{color:I?"#00FFA3":"#FF4D4D",display:"flex",alignItems:"center",gap:"4px"},children:[m.jsx("img",{src:I?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:I?"up":"down",style:{width:"12px",height:"12px"}}),m.jsxs("span",{children:[Math.abs(G).toFixed(2),"%"]})]})}},{label:"Market Cap",key:"mcap",className:"TokensTable__McapTd",sortable:!0,sortValue:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0&&q.tokenDayData.items[0].marketCap?q.tokenDayData.items[0].marketCap:0},render:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0&&q.tokenDayData.items[0].marketCap!==0?`$${An(parseFloat(q.tokenDayData.items[0].marketCap))}`:"-"}}
8173,{label:"Volume",key:"volume",className:"TokensTable__VolumeTd",sortable:!0,sortValue:q=>{var G,I;return((I=(G=q.tokenDayData)==null?void 0:G.items)==null?void 0:I.length)>0&&q.tokenDayData.items[0].volume24hUSD?parseFloat(q.tokenDayData.items[0].volume24hUSD):0},render:q=>parseFloat(q.volumeUSD)!==0?`$${An(parseFloat(q.volumeUSD))}`:"-"}];return m.jsx(Zp,{columns:K,data:F,isLoading:w&&!(b!=null&&b.pages&&b.pages.length>0),tableClassName:"Table Table--bordered",wrapperClassName:"Table__Wrapper",scrollClassName:"Table__Scroll",pagination:z,onSort:P,currentSortKey:k(),currentSortDirection:R(),itemLabel:"tokens",onRowClick:q=>n(`/tokens/${q.id||""}`),onRowMouseEnter:q=>{q.id&&r(q.id)},emptyMessage:"No tokens found"})},xL=({tabs:t,defaultTab:e,value:n,onChange:i,className:s})=>{const[r,o]=M.useState(n||e),[a,c]=M.useState({transform:"translateX(0)",width:"88px"}),l=M.useRef(null),d=M.useRef({}),h=M.useRef(null),p=s||"FormTab";M.useEffect(()=>{n!==void 0&&o(n)},[n]),M.useEffect(()=>{n===void 0&&o(e)},[e,n]),M.useEffect(()=>{const w=()=>{const T=d.current[r],A=h.current;if(T&&l.current&&A){const k=l.current.getBoundingClientRect(),R=T.getBoundingClientRect(),P=R.left-k.left,B=R.width;A.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",A.style.transform=`translateX(${P}px)`,A.style.width=`${B}px`}};w();const C=setTimeout(w,200),E=()=>w();return window.addEventListener("resize",E),()=>{clearTimeout(C),window.removeEventListener("resize",E)}},[r,t]),M.useEffect(()=>{const w=()=>{requestAnimationFrame(()=>{const C=d.current[r],E=h.current;if(C&&l.current&&E){const T=l.current.getBoundingClientRect(),A=C.getBoundingClientRect(),k=A.left-T.left,R=A.width;E.style.transition="none",E.style.transform=`translateX(${k}px)`,E.style.width=`${R}px`,setTimeout(()=>{E&&(E.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)")},50)}else setTimeout(w,10)})};w()},[]);const g=w=>{o(w),i(w)},b=()=>t.findIndex(w=>w===r);return m.jsxs("div",{ref:l,className:p,"data-selected":b(),children:[m.jsx("div",{ref:h,className:"FormTab__Background"}),t.map(w=>m.jsx("div",{ref:C=>{d.current[w]=C},className:`Tab ${w===r?"selected":""}`,onClick:()=>g(w),children:m.jsx("span",{children:w})},w))]})},Yv=[{key:"tokens",label:"Tokens",path:"/explore?tab=tokens"},{key:"pools",label:"Pools",path:"/explore?tab=pools"},{key:"transactions",label:"Transactions",path:"/explore?tab=transactions"}],wN=()=>{var d;const t=jr(),e=Zo(),n=new URLSearchParams(t.search);M.useEffect(()=>{t.pathname==="/explore"&&!n.get("tab")&&e("/explore?tab=tokens",{replace:!0})},[t.pathname,t.search,e,n]);const i=()=>{const h=n.get("tab");return h&&Yv.some(p=>p.key===h)?h:"tokens"},[s,r]=M.useState(i()),[o,a]=M.useState("");M.useEffect(()=>{const h=i();r(h)},[t.pathname,t.search]);const c=()=>{var h;return((h=Yv.find(p=>p.key===s))==null?void 0:h.label)||"Tokens"},l=h=>{const p=Yv.find(g=>g.label===h);p&&(r(p.key),e(`/explore?tab=${p.key}`))};return m.jsxs(Uu,{className:"ExplorePage",children:[m.jsx(LS,{}),m.jsxs("div",{className:"ExplorePage__Header",children:[m.jsx(xL,{tabs:Yv.map(h=>h.label),defaultTab:c(),value:c(),onChange:l}),m.jsx("div",{className:"ExplorePage__SearchWrapper",children:m.jsx(wb,{searchValue:o,setSearchValue:a,mode:"expanded",activeTab:(d=Yv.find(h=>h.key===s))==null?void 0:d.label,hideSlashIcon:!0})})]}),m.jsxs("div",{className:"ExplorePage__TablesWrapper",children:[m.jsx("div",{style:{display:s==="tokens"?"block":"none"},children:m.jsx(tXe,{searchValue:o})}),m.jsx("div",{style:{display:s==="pools"?"block":"none"},children:m.jsx(JQe,{searchValue:o})}),m.jsx("div",{style:{display:s==="transactions"?"block":"none"},children:m.jsx(YQe,{searchValue:o})})]})]})},nXe=` 8174 query GetStickyVaults($user: String = "") { 8175 stickyVaults { 8176 items { 8177 id 8178 name 8179 totalValueLockedUSD 8180 totalSupply 8181 txCount 8182 autoWinVault 8183 positions(where: {user: $user}) { 8184 items { 8185 currentValueUSD 8186 shares 8187 } 8188 } 8189 autoWinVaultRef { 8190 id 8191 estimatedAPR 8192 positions(where: {user: $user}) { 8193 items { 8194 shares 8195 } 8196 } 8197 } 8198 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8199 items { 8200 apr 8201 maxPotentialAPR 8202 volumeUSD1D 8203 volumeUSD30D 8204 totalValueLockedUSD 8205 } 8206 } 8207 poolRef { 8208 feeTier 8209 token1Ref { 8210 id 8211 logoUri 8212 name 8213 symbol 8214 } 8215 token0Ref { 8216 id 8217 logoUri 8218 name 8219 symbol 8220 } 8221 } 8222 } 8223 } 8224} 8225`,iXe=["0xfe68ef4370be9977f006d0ecf9a3676c8bdd7303","0x01716554a6125db2e140e01a4dc6412813aaf048"].map(t=>t.toLowerCase()),sXe=({searchValue:t})=>{const n=Zo(),{address:i}
8225=mn(),[s,r]=M.useState(1),{prefetchVaultPage:o}=zS(),[a,c]=M.useState(null),[l,d]=M.useState(null),{data:h}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{const v=await fetch("https://api.winnieswap.com/token/list");if(!v.ok)return[];const _=await v.json();return Array.isArray(_)?_:(_==null?void 0:_.data)||[]},staleTime:300*1e3}),{data:p,isLoading:g,isFetching:b}=Zt({queryKey:["vaults",i||""],queryFn:async()=>{const _=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:nXe,variables:{user:(i==null?void 0:i.toLowerCase())||""}})})).json();if(_.errors)throw new Error(_.errors[0].message);return _.data.stickyVaults.items},staleTime:300*1e3,gcTime:1440*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:!1,refetchIntervalInBackground:!1,placeholderData:v=>v}),{balanceContracts:w,vaultIndexMap:C}=M.useMemo(()=>{if(!i||!p||p.length===0)return{balanceContracts:[],vaultIndexMap:new Map};const v=[],_=new Map;return p.forEach(N=>{const $=N.id.toLowerCase(),U=v.length;v.push({address:N.id,abi:Wd,functionName:"balanceOf",args:[i]});const j=v.length;v.push({address:N.id,abi:Wd,functionName:"totalSupply"});let D;N.autoWinVault&&N.autoWinVault!=="0x0000000000000000000000000000000000000000"&&(D=v.length,v.push({address:N.autoWinVault,abi:Df,functionName:"balanceOf",args:[i]})),_.set($,{stickyIndex:U,totalSupplyIndex:j,autoWinIndex:D})}),{balanceContracts:v,vaultIndexMap:_}},[i,p]),{data:E}=vf({contracts:w,query:{enabled:!!i&&w.length>0,staleTime:3e4}}),{convertContracts:T,convertIndexMap:A}=M.useMemo(()=>{if(!E||!i||!p||p.length===0||C.size===0)return{convertContracts:[],convertIndexMap:new Map};const v=[],_=new Map;return p.forEach(N=>{var D;const $=N.id.toLowerCase(),U=C.get($);if(!U||U.autoWinIndex===void 0)return;const j=(D=E[U.autoWinIndex])==null?void 0:D.result;j&&j>0n&&(_.set($,v.length),v.push({address:N.autoWinVault,abi:Df,functionName:"convertToAssets",args:[j]}))}),{convertContracts:v,convertIndexMap:_}},[E,i,p,C]),{data:k}=vf({contracts:T,query:{enabled:T.length>0,staleTime:3e4}}),R=M.useMemo(()=>v=>{var J,W,Z,Y;if(!i||!p||!E||C.size===0)return 0;const _=v.toLowerCase(),N=C.get(_);if(!N)return 0;const $=p.find(Q=>Q.id.toLowerCase()===_);if(!$)return 0;const U=parseFloat($.totalValueLockedUSD||"0"),j=(J=E[N.stickyIndex])==null?void 0:J.result,D=(W=E[N.totalSupplyIndex])==null?void 0:W.result,O=N.autoWinIndex!==void 0?(Z=E[N.autoWinIndex])==null?void 0:Z.result:void 0;let H=0;if(j&&j>0n&&D&&D>0n){const Q=parseFloat(dt(j,18)),ee=parseFloat(dt(D,18)),ie=Q/ee;H+=ie*U}if(O&&O>0n&&D&&D>0n){const Q=A.get(_);if(Q!==void 0&&k&&k[Q]){const ee=(Y=k[Q])==null?void 0:Y.result;if(ee){const ie=parseFloat(dt(ee,18)),re=parseFloat(dt(D,18)),oe=ie/re;H+=oe*U}}}return H},[i,p,E,k,C,A]),P=M.useMemo(()=>{if(!p)return[];const v=h||[],_=new Map;v.forEach(D=>{D.symbol&&(_.set(D.symbol.toUpperCase(),D.logoUri||null),(D.symbol.toUpperCase()==="WBERA"||D.symbol.toUpperCase()==="EWBERA")&&(_.set("EWBERA",D.logoUri||null),_.set("WBERA",D.logoUri||null)))});const $=p.map(D=>{var Z,Y,Q,ee,ie,re,oe,de,he,ue,be,_e;const O=_.get((Y=(Z=D.poolRef.token0Ref)==null?void 0:Z.symbol)==null?void 0:Y.toUpperCase())||((Q=D.poolRef.token0Ref)==null?void 0:Q.logoUri)||null,H=_.get((ie=(ee=D.poolRef.token1Ref)==null?void 0:ee.symbol)==null?void 0:ie.toUpperCase())||((re=D.poolRef.token1Ref)==null?void 0:re.logoUri)||null,J=xr((oe=D.poolRef.token0Ref)==null?void 0:oe.symbol,((de=D.poolRef.token0Ref)==null?void 0:de.name)||void 0,(he=D.poolRef.token0Ref)==null?void 0:he.id,O||void 0),W=xr((ue=D.poolRef.token1Ref)==null?void 0:ue.symbol,((be=D.poolRef.token1Ref)==null?void 0:be.name)||void 0,(_e=D.poolRef.token1Ref)==null?void 0:_e.id,H||void 0);return{...D,poolRef:{...D.poolRef,token0Ref:{...D.poolRef.token0Ref,logoUri:J},token1Ref:{...D.poolRef.token1Ref,logoUri:W}}}}).filter(D=>!iXe.includes(D.id.toLowerCase())),U=(D,O)=>{var H,J,W,Z,Y,Q,ee,ie,re;switch(O){case"vault":return`${D.poolRef.token0Ref.symbol}/${D.poolRef.token1Ref.symbol}`;case"fees":return((H=D.poolRef)==null?void 0:H.feeTier)||0;case"tvl":return parseFloat(D.totalValueLockedUSD||"0");case"apr":const oe=(J=D==null?void 0:D.vaultDayData)!=null&&J.items&&D.vaultDayData.items.length>0?D.vaultDayData.items[0]:null,de=parseFloat((oe==null?void 0:oe.maxPotentialAPR)||"0"),he=parseFloat((oe==null?void 0:oe.apr)||"0"),ue=D.autoWinVault&&D.autoWinVault!=="0x0000000000000000000000000000000000000000",be=ue?parseFloat(((W=D.autoWinVaultRef)==null?void 0:W.estimatedAPR)||"0"):0;return ue&&be>0?de+be:de||he;case"vol1d":return parseFloat(((Q=(Y=(Z=D==null?void 0:D.vaultDayData)==null?void 0:Z.items)==null?void 0:Y[0])==null?void 0:Q.volumeUSD1D)||"0");case"vol30d":return parseFloat(((re=(ie=(ee=D==null?void 0:D.vaultDayData)==null?void 0:ee.items)==null?void 0:ie[0])==null?void 0:re.volumeUSD30D)||"0");case"holdings":return i?R(D.id):0;default:return 0}};let j;return a&&l?j=[...$].sort((D,O)=>{const H=U(D,a),J=U(O,a);if(H==null&&J==null)return 0;if(H==null)return l==="asc"?1:-1;if(J==null)return l==="asc"?-1:1;const W=typeof H=="string"?parseFloat(H.toString().replace(/[$,]/g,"")):Number(H),Z=typeof J=="string"?parseFloat(J.toString().replace(/[$,]/g,"")):Number(J);if(!isNaN(W)&&!isNaN(Z))return l==="asc"?W-Z:Z-W;const Y=String(H).toLowerCase(),Q=String(J).toLowerCase();return l==="asc"?Y.localeCompare(Q):Q.localeCompare(Y)}):j=[...$].sort((D,O)=>{const H=i?R(D.id):0,J=i?R(O.id):0;if(H>0&&J===0)return-1;if(H===0&&J>0)return 1;if(H>0&&J>0){const Y=J-H;if(Y!==0)return Y}const W=parseFloat(D.totalValueLockedUSD||"0");return parseFloat(O.totalValueLockedUSD||"0")-W}),t?j.filter(D=>{var O,H,J,W;return D.id&&typeof D.id=="string"&&D.id.toLowerCase().includes(t.toLowerCase())||((H=(O=D.poolRef)==null?void 0:O.token0Ref)==null?void 0:H.symbol)&&typeof D.poolRef.token0Ref.symbol=="string"&&D.poolRef.token0Ref.symbol.toLowerCase().includes(t.toLowerCase())||((W=(J=D.poolRef)==null?void 0:J.token1Ref)==null?void 0:W.symbol)&&typeof D.poolRef.token1Ref.symbol=="string"&&D.poolRef.token1Ref.symbol.toLowerCase().includes(t.toLowerCase())}):j},[p,h,t,i,R,a,l]),B=M.useMemo(()=>P.length===0?0:Math.ceil(P.length/50),[P.length,50]);M.useEffect(()=>{t?r(1):B>0&&s>B?r(B):B===0&&s>1&&r(1)},[t,B,s]);const F=M.useMemo(()=>B===0?1:Math.max(1,Math.min(s,B)),[s,B]),z=M.useMemo(()=>
8225{if(!P.length)return[];const v=(F-1)*50,_=v+50,N=P.slice(v,_);return N.length===0&&P.length>0&&F<=B&&console.warn(`[VaultsTable] Page ${F} is empty but should have items. Total: ${P.length}, Items per page: 50, Total pages: ${B}, Start index: ${v}, End index: ${_}, Current page: ${s}`),N},[P,F,50,B,s]),K=M.useMemo(()=>{if(P.length!==0&&!(B<=1||P.length<=50))return{currentPage:F,totalPages:B,itemsPerPage:50,totalItems:P.length,hasNextPage:F<B,hasPreviousPage:F>1,onPageChange:r,itemLabel:"vaults"}},[F,B,50,P.length]),q=v=>{n(`/vaults/${v.id}`)},G=(v,_)=>{_===null?(c(null),d(null)):(c(v),d(_))},I=(v,_,N)=>{if(!v)return"";let $=v;if($=$.replace(/sticky\s+vault/gi,""),$=$.replace(/\s*[-ââ]\s*\d+\.?\d*%\s*/gi," "),$=$.replace(/\s*\d+\.?\d*%\s*/gi," "),_&&N){const U=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),D="___TOKEN0___",O="___TOKEN1___";$=$.replace(new RegExp(U,"gi"),D),$=$.replace(new RegExp(j,"gi"),O),$=$.replace(/-/g," "),$=$.replace(new RegExp(D,"g"),_),$=$.replace(new RegExp(O,"g"),N),_.toUpperCase(),N.toUpperCase();const H=new RegExp(`(${U})\\s+(${j})`,"gi");$=$.replace(H,"$1/$2")}else $=$.replace(/-/g," ");return $=$.replace(/\s+/g," ").trim(),$},S=[{label:"Vault name",key:"vault",className:"VaultsTable__VaultTd",sortable:!0,sortValue:v=>`${v.poolRef.token0Ref.symbol}/${v.poolRef.token1Ref.symbol}`,render:v=>{const _=v.poolRef.token0Ref.symbol,N=v.poolRef.token1Ref.symbol;let $=_,U=N,j=v.poolRef.token0Ref,D=v.poolRef.token1Ref,O=!1;_.toUpperCase()==="WBERA"||N.toUpperCase()==="WBERA"?N.toUpperCase()==="WBERA"&&($=N,U=_,j=v.poolRef.token1Ref,D=v.poolRef.token0Ref,O=!0):(_.toUpperCase()==="HONEY"||N.toUpperCase()==="HONEY")&&N.toUpperCase()==="HONEY"&&($=N,U=_,j=v.poolRef.token1Ref,D=v.poolRef.token0Ref,O=!0);let H;if(v!=null&&v.name){let J=I(v.name,$,U);if(O){const W=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Z=N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`(${W})\\s*/\\s*(${Z})`,"gi"),Q=new RegExp(`(${Z})\\s*/\\s*(${W})`,"gi");if(Y.test(J))J=J.replace(Y,`${$}/${U}`);else if(!Q.test(J)){_.toUpperCase(),N.toUpperCase();const ee=new RegExp(`(${W})\\s+(${Z})`,"gi"),ie=new RegExp(`(${Z})\\s+(${W})`,"gi");ee.test(J)?J=J.replace(ee,`${$}/${U}`):ie.test(J)&&(J=J.replace(ie,`${$}/${U}`))}}H=J}else H=`${$}/${U}`;return m.jsxs("span",{className:"VaultsTable__VaultCell",children:[m.jsx("span",{className:"VaultsTable__LogoWrapper",children:m.jsx(If,{token0:{id:j.id,address:j.id,logoUri:j.logoUri,symbol:j.symbol},token1:{id:D.id,address:D.id,logoUri:D.logoUri,symbol:D.symbol},borderWidth:2,separatorWidth:1.5,size:28})}),m.jsx("span",{className:"VaultsTable__VaultName",children:H})]})}},{label:"Fee tier",key:"fees",className:"VaultsTable__FeesTd",sortable:!0,sortValue:v=>{var _;return((_=v.poolRef)==null?void 0:_.feeTier)||0},render:v=>{var $;const _=($=v.poolRef)==null?void 0:$.feeTier;if(!_)return m.jsx("span",{className:"VaultsTable__FeesCell",children:"-"});const N=(_/1e4).toFixed(2);return m.jsxs("span",{className:"VaultsTable__FeesCell",children:[N,"%"]})}},{label:"TVL",key:"tvl",className:"VaultsTable__TvlTd",sortable:!0,sortValue:v=>v.totalValueLockedUSD||0,render:v=>m.jsx("span",{className:"VaultsTable__TvlCell",children:v.totalValueLockedUSD!==0?`$${An(v.totalValueLockedUSD)}`:"-"})},{label:"APY",key:"apr",className:"VaultsTable__AprTd",sortable:!0,sortValue:v=>{var O,H;const _=(O=v==null?void 0:v.vaultDayData)!=null&&O.items&&v.vaultDayData.items.length>0?v.vaultDayData.items[0]:null,N=parseFloat((_==null?void 0:_.maxPotentialAPR)||"0"),$=parseFloat((_==null?void 0:_.apr)||"0"),U=v.autoWinVault&&v.autoWinVault!=="0x0000000000000000000000000000000000000000",j=U?parseFloat(((H=v.autoWinVaultRef)==null?void 0:H.estimatedAPR)||"0"):0;return(U&&j>0?N+j:N||$)||0},render:v=>{var O,H;const _=(O=v==null?void 0:v.vaultDayData)!=null&&O.items&&v.vaultDayData.items.length>0?v.vaultDayData.items[0]:null,N=parseFloat((_==null?void 0:_.apr)||"0"),$=parseFloat((_==null?void 0:_.maxPotentialAPR)||"0"),U=v.autoWinVault&&v.autoWinVault!=="0x0000000000000000000000000000000000000000",j=U?parseFloat(((H=v.autoWinVaultRef)==null?void 0:H.estimatedAPR)||"0"):0,D=U&&j>0?$+j:$||N;return m.jsx("span",{className:"VaultsTable__AprCell",children:_&&(D!==0||N!==0)?m.jsx("div",{className:"VaultsTable__AprWrapper",children:m.jsxs("div",{className:"VaultsTable__CurrentApr",children:[Number(D).toFixed(2),"%"]})}):"-"})}}
8225,{label:"Vol. 1d",key:"vol1d",className:"VaultsTable__Vol1dTd",sortable:!0,sortValue:v=>v.dayVolumeUSD||0,render:v=>{var _;return m.jsx("span",{className:"VaultsTable__Vol1dCell",children:(_=v==null?void 0:v.vaultDayData)!=null&&_.items&&v.vaultDayData.items.length>0&&v.vaultDayData.items[0].volumeUSD1D!=="0"?`$${An(v.vaultDayData.items[0].volumeUSD1D)}`:"-"})}},{label:"Vol. 30d",key:"vol30d",className:"VaultsTable__Vol30dTd",sortable:!0,sortValue:v=>v.monthVolumeUSD||0,render:v=>{var _;return m.jsx("span",{className:"VaultsTable__Vol30dCell",children:(_=v==null?void 0:v.vaultDayData)!=null&&_.items&&v.vaultDayData.items.length>0&&v.vaultDayData.items[0].volumeUSD30D!=="0"?`$${An(v.vaultDayData.items[0].volumeUSD30D)}`:"-"})}},{label:"Holdings",key:"holdings",className:"VaultsTable__HoldingsTd",sortable:!0,sortValue:v=>i?R(v.id):0,render:v=>{if(!i)return m.jsx("span",{className:"VaultsTable__HoldingsCell",children:"-"});const _=R(v.id);return m.jsxs("span",{className:"VaultsTable__HoldingsCell",children:["$",An(_)]})}}];return m.jsx(m.Fragment,{children:m.jsx(Zp,{columns:S,data:z,isLoading:g&&!(p&&Array.isArray(p)&&p.length>0),tableClassName:"Table Table--bordered",wrapperClassName:"Table__Wrapper",scrollClassName:"Table__Scroll",pagination:K,onSort:G,currentSortKey:a||void 0,currentSortDirection:l||void 0,onRowClick:q,onRowMouseEnter:v=>{v.id&&o(v.id)},emptyMessage:"No vaults found"})})},rXe="0x456c957454dCF68F75af885905Faaac35C14EeCe",mY="0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",qoe=(t=rXe)=>{var T,A,k;const{address:e}=mn(),{data:n,error:i}=Si({address:t,abi:Kh,functionName:"asset",query:{retry:1,retryDelay:1e3}}),{data:s,error:r}=Si({address:t,abi:Kh,functionName:"totalAssets",query:{enabled:!!n,retry:1,retryDelay:1e3}}),{data:o,error:a}=Si({address:t,abi:Kh,functionName:"totalSupply",query:{enabled:!!n,retry:1,retryDelay:1e3}});M.useEffect(()=>{},[i]);const{data:c}=Si({address:t,abi:Kh,functionName:"balanceOf",args:e?[e]:void 0,query:{enabled:!!e}}),{data:l}=Zt({queryKey:["honeyPrice"],queryFn:async()=>{var R;try{const P=await fetch("https://api.winnieswap.com/token/list");if(!P.ok)return 0;const B=await P.json(),F=Array.isArray(B)?B.find(z=>{var K;return((K=z.address)==null?void 0:K.toLowerCase())===mY.toLowerCase()}):(R=B==null?void 0:B.data)==null?void 0:R.find(z=>{var K;return((K=z.address)==null?void 0:K.toLowerCase())===mY.toLowerCase()});return parseFloat((F==null?void 0:F.priceUSD)||"0")}catch{return 0}},staleTime:300*1e3}),{data:d}=Si({address:t,abi:Kh,functionName:"convertToAssets",args:c?[c]:void 0,query:{enabled:!!c&&c>0n}}),h=M.useMemo(()=>{if(!s||!o||o===0n)return 0;const R=parseFloat(dt(s,18)),P=parseFloat(dt(o,18));return P>0?R/P:0},[s,o]),p=M.useMemo(()=>!s||!l?0:parseFloat(dt(s,18))*l,[s,l]),{data:g}=Zt({queryKey:["erc4626VaultAPR",t],queryFn:async()=>{var R,P,B,F,z,K,q;try{const G=` 8226 query GetERC4626VaultAPR { 8227 erc4626Vault(id: "${t.toLowerCase()}") { 8228 id 8229 apr 8230 dayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8231 items { 8232 apr 8233 } 8234 } 8235 } 8236 } 8237 `,I=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:G})});if(!I.ok)return 0;const S=await I.json(),v=((P=(R=S==null?void 0:S.data)==null?void 0:R.erc4626Vault)==null?void 0:P.apr)||((q=(K=(z=(F=(B=S==null?void 0:S.data)==null?void 0:B.erc4626Vault)==null?void 0:F.dayData)==null?void 0:z.items)==null?void 0:K[0])==null?void 0:q.apr)||"0";return parseFloat(v)}catch(G){return console.error("[useERC4626Vault] Error fetching APR:",G),0}},staleTime:300*1e3}),b=Kc(),w=i&&(((T=i.message)==null?void 0:T.includes("execution reverted"))||((A=i.message)==null?void 0:A.includes("HTTP request failed"))||((k=i.message)==null?void 0:k.includes("Failed to fetch"))),C=(!n||s===void 0||o===void 0)&&!w,E=M.useCallback(()=>{b.invalidateQueries({queryKey:["honeyPrice"]}),b.invalidateQueries({predicate:R=>{var B;const P=R.queryKey;return Array.isArray(P)&&(P[0]==="readContract"||P[0]==="balance"&&((B=P[1])==null?void 0:B.address)===e)}})},[b,e]);return{vaultAddress:t,assetAddress:n,totalAssets:s||0n,totalSupply:o||0n,userBalance:c||0n,userAssets:d||0n,pricePerShare:h,tvlUSD:p,honeyPrice:l||0,apr:g||0,isLoading:C,refetch:E}},gY="0x456c957454dCF68F75af885905Faaac35C14EeCe",Sm="0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",oXe=({searchValue:t})=>{const e=Zo(),{address:n}=mn(),i=qoe(gY),{prefetchVaultPage:s}=zS(),{data:r}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{const g=await fetch("https://api.winnieswap.com/token/list");if(!g.ok)return[];const b=await g.json();return Array.isArray(b)?b:(b==null?void 0:b.data)||[]},staleTime:300*1e3}),o=M.useMemo(()=>{const b=(r||[]).find(w=>{var C,E;return((C=w.address)==null?void 0:C.toLowerCase())===Sm.toLowerCase()||((E=w.symbol)==null?void 0:E.toUpperCase())==="HONEY"});return parseFloat((b==null?void 0:b.priceUSD)||"0")},[r]),{data:a}=Zt({queryKey:["honeyPriceGraphQL",Sm],queryFn:async()=>{var g,b,w,C,E;try{const T=` 8238 query GetHoneyPrice { 8239 token(id: "${Sm.toLowerCase()}") { 8240 id 8241 symbol 8242 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8243 items { 8244 priceUSD 8245 } 8246 } 8247 } 8248 } 8249 `,A=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:T})});if(!A.ok)return 0;const k=await A.json(),R=(E=(C=(w=(b=(g=k==null?void 0:k.data)==null?void 0:g.token)==null?void 0:b.tokenDayData)==null?void 0:w.items)==null?void 0:C[0])==null?void 0:E.priceUSD;return parseFloat(R||"0")}catch(T){return console.error("[LendingVaultsTable] Error fetching honeyPrice from GraphQL:",T),0}},staleTime:300*1e3,enabled:!i.honeyPrice||i.honeyPrice===0}),c=i.honeyPrice||o||a||0,l=M.useMemo(()=>!n||!i.userBalance||i.userBalance===0n?0:i.userAssets&&i.userAssets>0n&&c>0?parseFloat(dt(i.userAssets,18))*c:i.pricePerShare>
82490&&c>0?parseFloat(dt(i.userBalance,18))*i.pricePerShare*c:0,[n,i.userBalance,i.userAssets,i.pricePerShare,c]),d=M.useMemo(()=>{if(i.isLoading)return[];const b=(r||[]).find(T=>{var A,k;return((A=T.address)==null?void 0:A.toLowerCase())===Sm.toLowerCase()||((k=T.symbol)==null?void 0:k.toUpperCase())==="HONEY"}),w=parseFloat(dt(i.totalSupply||0n,18));let C=0;i.totalAssets&&i.totalAssets>0n&&c>0?C=parseFloat(dt(i.totalAssets,18))*c:i.pricePerShare>0&&c>0?C=w*i.pricePerShare*c:C=i.tvlUSD||0;const E={id:gY,name:"Win HONEY",totalValueLockedUSD:C,totalSupply:w,poolRef:{token0Ref:{id:Sm,symbol:"HONEY",name:"Honey",logoUri:(b==null?void 0:b.logoUri)||null},token1Ref:{id:Sm,symbol:"HONEY",name:"Honey",logoUri:(b==null?void 0:b.logoUri)||null},feeTier:null},vaultDayData:{items:[{apr:i.apr||0,maxPotentialAPR:i.apr||0,volumeUSD1D:"0",volumeUSD30D:"0"}]},apr:i.apr||0,userHoldingsUSD:l};if(t){const T=t.toLowerCase();return E.id.toLowerCase().includes(T)||E.name.toLowerCase().includes(T)||E.poolRef.token0Ref.symbol.toLowerCase().includes(T)?[E]:[]}return[E]},[i,r,t,l,c,o,a]),h=g=>{e(`/vaults/${g.id}`)},p=[{label:"Vault name",key:"vault",className:"VaultsTable__VaultTd",sortable:!0,sortValue:g=>g.name,render:g=>m.jsxs("span",{className:"VaultsTable__VaultCell",children:[m.jsx("span",{className:"VaultsTable__LogoWrapper",children:m.jsx(ws,{logoUri:g.poolRef.token0Ref.logoUri,symbol:"HONEY",name:"Honey",id:Sm,size:28})}),m.jsx("span",{className:"VaultsTable__VaultName",children:g.name})]})},{label:"Curator",key:"curator",className:"VaultsTable__CuratorTd",sortable:!1,render:()=>m.jsxs("span",{className:"VaultsTable__CuratorCell",children:[m.jsx("span",{className:"VaultsTable__LogoWrapper",style:{marginRight:"8px"},children:m.jsx("img",{src:"/assets/components/philidorlabs.jpg",alt:"Philidorlabs",style:{width:"28px",height:"28px",borderRadius:"50%",objectFit:"cover"},onError:g=>{console.error("[LendingVaults] Failed to load philidorlabs.jpg"),g.currentTarget.style.display="none"}})}),"Philidorlabs"]})},{label:"TVL",key:"tvl",className:"VaultsTable__TvlTd",sortable:!0,sortValue:g=>g.totalValueLockedUSD||0,render:g=>m.jsx("span",{className:"VaultsTable__TvlCell",children:g.totalValueLockedUSD>0?`$${An(g.totalValueLockedUSD)}`:"-"})},{label:"APY",key:"apr",className:"VaultsTable__AprTd",sortable:!0,sortValue:g=>g.apr||0,render:g=>{if(i.isLoading)return m.jsx("span",{className:"VaultsTable__AprCell",children:"-"});const b=g.apr||0;return m.jsx("span",{className:"VaultsTable__AprCell",children:b>0?`${An(b)}%`:"-"})}},{label:"Holdings",key:"holdings",className:"VaultsTable__HoldingsTd",sortable:!0,sortValue:g=>g.userHoldingsUSD||0,render:g=>{if(!n)return m.jsx("span",{className:"VaultsTable__HoldingsCell",children:"-"});const b=g.userHoldingsUSD||0;return m.jsxs("span",{className:"VaultsTable__HoldingsCell",children:["$",An(b)]})}}];return m.jsx(Zp,{columns:p,data:d,isLoading:i.isLoading,tableClassName:"Table Table--bordered",wrapperClassName:"Table__Wrapper",scrollClassName:"Table__Scroll",onRowClick:h,onRowMouseEnter:g=>{g.id&&s(g.id)},emptyMessage:"No lending vaults found"})},qx=[{key:"dex-vaults",label:"DEX Vaults",path:"/earn?tab=dex-vaults"},{key:"lending-vaults",label:"Lending Vaults",path:"/earn?tab=lending-vaults"}],aXe=()=>{var h;const t=jr(),e=Zo(),n=new URLSearchParams(t.search);M.useEffect(()=>{t.pathname==="/earn"&&!n.get("tab")&&e("/earn?tab=dex-vaults",{replace:!0})},[t.pathname,t.search,e,n]);const i=()=>{const p=n.get("tab");return p==="dex-vaults"||p==="vaults"?"dex-vaults":p==="lending-vaults"?"lending-vaults":"dex-vaults"},[s,r]=M.useState(i()),[o,a]=M.useState("");M.useEffect(()=>{const p=i();r(p)},[t.pathname,t.search]);const{data:c}=Zt({queryKey:["vaults-for-marquee"],staleTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchInterval:300*1e3,queryFn:async()=>{var g,b;const p=` 8250 query GetVaultsForMarquee { 8251 stickyVaults( 8252 orderBy: "totalValueLockedUSD" 8253 orderDirection: "desc" 8254 limit: 30 8255 ) { 8256 items { 8257 id 8258 name 8259 totalValueLockedUSD 8260 autoWinVault 8261 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8262 items { 8263 maxPotentialAPR 8264 } 8265 } 8266 poolRef { 8267 feeTier 8268 token0Ref { 8269 id 8270 symbol 8271 name 8272 logoUri 8273 } 8274 token1Ref { 8275 id 8276 symbol 8277 name 8278 logoUri 8279 } 8280 } 8281 } 8282 } 8283 } 8284 `;try{const w=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:p})});if(!w.ok)throw new Error("Failed to fetch vaults");const C=await w.json();return C.errors?(console.error("GraphQL errors:",C.errors),{data:[]}):{data:((b=(g=C.data)==null?void 0:g.stickyVaults)==null?void 0:b.items)||[]}}catch(w){return console.error("Error fetching vaults for marquee:",w),{data:[]}}}}),l=()=>{var p;return((p=qx.find(g=>g.key===s))==null?void 0:p.label)||"DEX Vaults"},d=p=>{const g=qx.find(b=>b.label===p);g&&(r(g.key),e(`/earn?tab=${g.key}`))};return m.jsxs(Uu,{className:"EarnPage",children:[(c==null?void 0:c.data)&&c.data.length>0&&m.jsx(qd,{vaults:c.data,pools:[]}),m.jsxs("div",{className:"ExplorePage__Header",children:[m.jsx(xL,{tabs:qx.map(p=>p.label),defaultTab:l(),value:l(),onChange:d}
8284),m.jsx("div",{className:"ExplorePage__SearchWrapper",children:m.jsx(wb,{searchValue:o,setSearchValue:a,mode:"expanded",activeTab:(h=qx.find(p=>p.key===s))==null?void 0:h.label,hideSlashIcon:!0})})]}),m.jsxs("div",{className:"ExplorePage__TablesWrapper",children:[m.jsx("div",{style:{display:s==="dex-vaults"?"block":"none"},children:m.jsx(sXe,{searchValue:o})}),m.jsx("div",{style:{display:s==="lending-vaults"?"block":"none"},children:m.jsx(oXe,{searchValue:o})})]})]})},cXe=({height:t=16,width:e=16,className:n=""})=>m.jsx("img",{src:foe,alt:"STICKY",width:e,height:t,className:`StickyIcon ${n}`,style:{display:"inline-block",verticalAlign:"middle"}}),lXe=({width:t=24,height:e=24,className:n=""})=>m.jsx("img",{src:poe,alt:"AutoWin Vault",width:t,height:e,className:`StickyIcon ${n}`});function KI(t){return Zt({queryKey:["leaderboard-wallet",t],queryFn:async()=>{if(!t)return null;const e="https://api.winnieswap.com",n=t.toLowerCase();try{const i=await fetch(`${e}/leaderboard/${n}`);if(!i.ok){if(i.status===404)return console.log(`[useLeaderboardWallet] Wallet ${n} not found in leaderboard`),null;let s=`Failed to fetch leaderboard data: ${i.status} ${i.statusText}`;try{const r=await i.json();r.message&&(s=r.message)}catch{}throw new Error(s)}return i.json()}catch(i){if(i instanceof Error&&i.message.includes("404"))return null;throw i}},enabled:!!t,retry:(e,n)=>n instanceof Error&&n.message.includes("not found")?!1:e<1,staleTime:300*1e3,gcTime:3e5,refetchOnWindowFocus:!1,refetchInterval:30*1e3,refetchIntervalInBackground:!0})}const uXe=` 8285 query GetStickyVaults($user: String = "") { 8286 stickyVaults { 8287 items { 8288 id 8289 totalValueLockedUSD 8290 autoWinVault 8291 positions(where: {user: $user}) { 8292 items { 8293 currentValueUSD 8294 shares 8295 } 8296 } 8297 autoWinVaultRef { 8298 id 8299 estimatedAPR 8300 positions(where: {user: $user}) { 8301 items { 8302 shares 8303 } 8304 } 8305 } 8306 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8307 items { 8308 apr 8309 maxPotentialAPR 8310 totalValueLockedUSD 8311 } 8312 } 8313 poolRef { 8314 token1Ref { 8315 id 8316 logoUri 8317 name 8318 symbol 8319 } 8320 token0Ref { 8321 id 8322 logoUri 8323 name 8324 symbol 8325 } 8326 } 8327 } 8328 } 8329} 8330`;function EL(){const{address:t}=mn(),{positions:e,isLoading:n}=Woe(),{data:i,isLoading:s}=Zt({queryKey:["stickyVaults",t],queryFn:async()=>{const T=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:uXe,variables:{user:(t==null?void 0:t.toLowerCase())||""}})})).json();if(T.errors)throw new Error(T.errors[0].message);return T.data.stickyVaults.items},enabled:!!t,staleTime:120*1e3,refetchInterval:30*1e3,refetchIntervalInBackground:!0}),{balanceContracts:r,vaultIndexMap:o}=M.useMemo(()=>{if(!t||!i||i.length===0)return{balanceContracts:[],vaultIndexMap:new Map};const E=[],T=new Map;return i.forEach(A=>{const k=A.id.toLowerCase(),R=E.length;E.push({address:A.id,abi:Wd,functionName:"balanceOf",args:[t]});const P=E.length;E.push({address:A.id,abi:Wd,functionName:"totalSupply"});let B;A.autoWinVault&&A.autoWinVault!=="0x0000000000000000000000000000000000000000"&&(B=E.length,E.push({address:A.autoWinVault,abi:Df,functionName:"balanceOf",args:[t]})),T.set(k,{stickyIndex:R,totalSupplyIndex:P,autoWinIndex:B})}),{balanceContracts:E,vaultIndexMap:T}},[t,i]),{data:a,isLoading:c}=vf({contracts:r,query:{enabled:!!t&&r.length>0,staleTime:3e4,refetchInterval:30*1e3}}),{convertContracts:l,convertIndexMap:d}=M.useMemo(()=>{if(!a||!t||!i||i.length===0||o.size===0)return{convertContracts:[],convertIndexMap:new Map};const E=[],T=new Map;return i.forEach(A=>{var B;const k=A.id.toLowerCase(),R=o.get(k);if(!R||R.autoWinIndex===void 0)return;const P=(B=a[R.autoWinIndex])==null?void 0:B.result;P&&P>0n&&(T.set(k,E.length),E.push({address:A.autoWinVault,abi:Df,functionName:"convertToAssets",args:[P]}))}),{convertContracts:E,convertIndexMap:T}},[a,t,i,o]),{data:h,isLoading:p}=vf({contracts:l,query:{enabled:l.length>0,staleTime:3e4,refetchInterval:30*1e3}}),g=M.useMemo(()=>!t||!e||e.length===0?0:e.reduce((E,T)=>{var A,k,R,P,B,F;
8330try{const z=T.position,K=T.pool,q=BigInt(z.liquidity||"0");if(q===0n)return E;const G=new on(Nn.id,K.token0.address,K.token0.decimals,K.token0.symbol,K.token0.name),I=new on(Nn.id,K.token1.address,K.token1.decimals,K.token1.symbol,K.token1.name),S=new to(G,I,K.fee*1e4,K.sqrtPriceX96,K.liquidity,K.tick),v=new ca({pool:S,tickLower:z.tickLower,tickUpper:z.tickUpper,liquidity:q.toString()}),_=((R=(k=(A=K.token0)==null?void 0:A.TokenPrice)==null?void 0:k[0])==null?void 0:R.price)||0,N=((F=(B=(P=K.token1)==null?void 0:P.TokenPrice)==null?void 0:B[0])==null?void 0:F.price)||0,$=parseFloat(v.amount0.toExact()),U=parseFloat(v.amount1.toExact()),j=$*_,D=U*N,O=j+D;return E+O}catch(z){return console.warn("Error calculating pool position value:",z),E}},0),[t,e]),b=M.useMemo(()=>{if(!t||!i||o.size===0)return 0;let E=0;return i.forEach(T=>{var P,B,F,z,K,q,G,I,S;const A=T.id.toLowerCase(),k=o.get(A);if(!k)return;const R=parseFloat(T.totalValueLockedUSD||"0");if(a){const v=(P=a[k.stickyIndex])==null?void 0:P.result,_=(B=a[k.totalSupplyIndex])==null?void 0:B.result,N=k.autoWinIndex!==void 0?(F=a[k.autoWinIndex])==null?void 0:F.result:void 0;if(v&&v>0n&&_&&_>0n){const $=parseFloat(dt(v,18)),U=parseFloat(dt(_,18)),j=$/U;E+=j*R}if(N&&N>0n&&_&&_>0n){const $=d.get(A);if($!==void 0&&h&&h[$]){const U=(z=h[$])==null?void 0:z.result;if(U){const j=parseFloat(dt(U,18)),D=parseFloat(dt(_,18)),O=j/D;E+=O*R}}}}else{const v=(q=(K=T.positions)==null?void 0:K.items)==null?void 0:q.find(N=>N.user===t.toLowerCase());v&&parseFloat(v.currentValueUSD||"0")>0&&(E+=parseFloat(v.currentValueUSD));const _=(S=(I=(G=T.autoWinVaultRef)==null?void 0:G.positions)==null?void 0:I.items)==null?void 0:S.find(N=>N.user===t.toLowerCase());if(_&&T.autoWinVault&&T.autoWinVault!=="0x0000000000000000000000000000000000000000"){const N=parseFloat(_.shares||"0");N>0&&R>0&&(E+=N/1e6*R)}}}),E},[t,i,a,h,o,d]);return{totalHoldings:M.useMemo(()=>g+b,[g,b]),isLoading:n||s||c||p}}const dXe=` 8331query GetTransactions($owner: String) { 8332 positions(where: {owner: $owner}) { 8333 items { 8334 id 8335 pool 8336 poolRef { 8337 id 8338 sqrtPrice 8339 tick 8340 liquidity 8341 token0Ref { 8342 logoUri 8343 id 8344 name 8345 symbol 8346 decimals 8347 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8348 items { 8349 priceUSD 8350 } 8351 } 8352 } 8353 token1Ref { 8354 id 8355 logoUri 8356 name 8357 symbol 8358 decimals 8359 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8360 items { 8361 priceUSD 8362 } 8363 } 8364 } 8365 feeTier 8366 poolDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8367 items { 8368 apr 8369 } 8370 } 8371 } 8372 tokenId 8373 tickLower 8374 tickUpper 8375 withdrawnToken1 8376 withdrawnToken0 8377 depositedToken0 8378 depositedToken1 8379 liquidity 8380 } 8381 } 8382} 8383`,hXe=` 8384query GetUserVaultPositions($user: String) { 8385 stickyVaults { 8386 items { 8387 id 8388 name 8389 totalValueLockedUSD 8390 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8391 items { 8392 apr 8393 maxPotentialAPR 8394 } 8395 } 8396 poolRef { 8397 feeTier 8398 token0Ref { 8399 id 8400 name 8401 symbol 8402 logoUri 8403 decimals 8404 } 8405 token1Ref { 8406 id 8407 name 8408 symbol 8409 logoUri 8410 decimals 8411 } 8412 } 8413 positions(where: {user: $user}) { 8414 items { 8415 id 8416 user 8417 shares 8418 currentValueUSD 8419 feesEarnedUSD 8420 realizedPnLUSD 8421 initialValueUSD 8422 totalPnLUSD 8423 } 8424 } 8425 } 8426 } 8427} 8428`;function zoe(){const{address:t}=mn(),{data:e,isLoading:n}=KI(t),{totalHoldings:i,isLoading:s}=EL(),r=e!=null,{data:o,isLoading:a}=Zt({queryKey:["portfolio-positions",t],queryFn:async()=>{if(!t)return null;const p=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:dXe,variables:{owner:t}})});return p.ok?(await p.json()).data.positions.items:null},enabled:!!t,staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:30*1e3,refetchIntervalInBackgroun
8428d:!0}),{data:c,isLoading:l}=Zt({queryKey:["portfolio-vault-positions",t],queryFn:async()=>{if(!t)return null;const p=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:hXe,variables:{user:t.toLowerCase()}})});return p.ok?(await p.json()).data.stickyVaults.items:null},enabled:!!t,staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:30*1e3,refetchIntervalInBackground:!0});return{stats:M.useMemo(()=>{if(!t)return null;let p=0,g=0,b=0,w=0,C=0,E=0;o&&o.forEach(G=>{var I,S,v,_,N,$,U,j;try{const D=G.poolRef,O=G;if(O.liquidity==="0"||!D.sqrtPrice)return;const H=D.tick?Number(D.tick):Yt.getTickAtSqrtRatio(X.BigInt(D.sqrtPrice)),J=new to(new on(Nn.id,D.token0Ref.id,D.token0Ref.decimals||18,D.token0Ref.symbol,D.token0Ref.name),new on(Nn.id,D.token1Ref.id,D.token1Ref.decimals||18,D.token1Ref.symbol,D.token1Ref.name),D.feeTier,D.sqrtPrice,D.liquidity,H),W=new ca({pool:J,tickLower:O.tickLower,tickUpper:O.tickUpper,liquidity:O.liquidity}),Z=parseFloat(W.amount0.toExact()),Y=parseFloat(W.amount1.toExact()),Q=Math.max(0,Z),ee=Math.max(0,Y),ie=((_=(v=(S=(I=D.token0Ref)==null?void 0:I.tokenDayData)==null?void 0:S.items)==null?void 0:v[0])==null?void 0:_.priceUSD)||0,re=((j=(U=($=(N=D.token1Ref)==null?void 0:N.tokenDayData)==null?void 0:$.items)==null?void 0:U[0])==null?void 0:j.priceUSD)||0,oe=Q*parseFloat(ie),de=ee*parseFloat(re);oe+de>=.5&&(w++,C++)}catch(D){console.error("Error calculating pool position value:",D)}}),c&&c.forEach(G=>{G.positions.items.forEach(I=>{const S=parseFloat(I.currentValueUSD||"0"),v=parseFloat(I.feesEarnedUSD||"0");S>=.5&&(b+=v,p+=v,w++,E++)})});const T=(e==null?void 0:e.rank)??0,A=Math.max(0,(e==null?void 0:e.totalPoints)??0),k=Math.max(0,(e==null?void 0:e.volumePoints)??0),R=Math.max(0,(e==null?void 0:e.liquidityPoints)??0),P=Math.max(0,(e==null?void 0:e.referralPoints)??0),B=Math.max(0,(e==null?void 0:e.totalVolumeUSD)??0),F=e==null?void 0:e.rankChange,z=i,K=Math.floor(Math.random()*50),q=1+K*.01;return{totalValueUSD:z,poolValueUSD:0,vaultValueUSD:0,totalFeesEarned:p,poolFeesEarned:g,vaultFeesEarned:b,activePositions:w,poolPositions:C,vaultPositions:E,rank:T,points:A,volumePoints:k,liquidityPoints:R,referralPoints:P,totalVolumeUSD:B||0,currentLiquidityUSD:i,rankChange:F,referrals:K,multiplier:q}},[t,o,c,e,i]),isLoading:a||l||n||s,isWalletInLeaderboard:r}}function fXe(t){return Zt({queryKey:["referral",t],queryFn:async()=>{if(!t)throw new Error("Wallet address is required");const e="https://api.winnieswap.com",n=t.toLowerCase(),i=await fetch(`${e}/referral/${n}`);if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.message||`Failed to fetch referral code: ${i.status}`)}return i.json()},enabled:!!t,staleTime:6e4,gcTime:3e5,refetchOnWindowFocus:!1})}function pXe(){const t=Kc(),{address:e}=mn();return Fp({mutationFn:async({referralCode:n,signature:i})=>{if(!e)throw new Error("Wallet address is required");const s="https://api.winnieswap.com",r=e.toLowerCase(),o=await fetch(`${s}/referral/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({referralCode:n,signature:i})});if(!o.ok){const a=await o.json().catch(()=>({}));throw new Error(a.message||`Failed to update referral code: ${o.status}`)}return o.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["referral",e]})}})}function mXe(){const t=Kc(),{address:e}=mn();return Fp({mutationFn:async({referralCode:n,signature:i})=>{if(!e)throw new Error("Wallet address is required");const s="https://api.winnieswap.com",r=e.toLowerCase(),o=await fetch(`${s}/referral/${r}/use`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({referralCode:n,signature:i})});if(!o.ok){const a=await o.json().catch(()=>({}));throw new Error(a.message||`Failed to apply referral code: ${o.status}`)}return o.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["leaderboard"]}),t.invalidateQueries({queryKey:["portfolio-stats"]})}})}function gXe(t){return Zt({queryKey:["referral-count",t],queryFn:async()=>{if(!t)throw new Error("Referral code is required");const n=await fetch(`https://api.winnieswap.com/referral/count/${t}`);if(!n.ok){const i=await n.json().catch(()=>({}));throw new Error(i.message||`Failed to fetch referral count: ${n.status}`)}return n.json()},enabled:!!t,staleTime:6e4,gcTime:3e5,refetchOnWindowFocus:!1})}const yXe=()=>{const{address:t,isConnected:e}=mn(),{stats:n,isLoading:i}=zoe(),{totalHoldings:s}=EL(),{data:r,isLoading:o}=L1(),a=kn.useMemo(()=>{var h;return!((h=r==null?void 0:r.data)!=null&&h.tokens)||o?0:r.data.tokens.reduce((p,g)=>{const b=g.balanceUSD||0;return p+b},0)},[r,o]),c=kn.useMemo(()=>s!==void 0&&s>0?s:n&&(n.currentLiquidityUSD||n.totalValueUSD)||0,[s,n]),l=kn.useMemo(()=>a+c,[a,c]),d=kn.useMemo(()=>null,[l]);return e?i||o?m.jsxs("div",{className:"PortfolioPage__StatCard",children:[m.jsxs("div",{className:"PortfolioPage__StatCardHeader",children:[m.jsx(Ke,{width:"80px",height:"14px",style:{marginBottom:"12px"}}),m.jsx(Ke,{width:"120px",height:"28px"})]}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdown",children:[m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx(Ke,{width:"60px",height:"12px",style:{marginBottom:"8px"}}),m.jsx(Ke,{width:"100px",height:"18px"})]}),m.jsx("div",{className:"PortfolioPage__StatCardBreakdownDivider"}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx(Ke,{width:"60px",height:"12px",style:{marginBottom:"8px"}}),m.jsx(Ke,{width:"100px",height:"18px"})]})]})]}):m.jsxs("div",{className:"PortfolioPage__StatCard",children:[m.jsxs("div",{className:"PortfolioPage__StatCardHeader",children:[m.jsx("span",{className:"PortfolioPage__StatCardLabel",children:"Balances"}),m.jsxs("span",{className:"PortfolioPage__StatCardValue",children:["$",An(l)]})]}),d!==null&&typeof d=="number"&&m.jsx("div",{className:"PortfolioPage__StatCardSubtext",children:m.jsxs("div",{className:`PortfolioPage__StatCardChange ${d>=0?"PortfolioPage__StatCardChange--positive":"PortfolioPage__StatCardChange--negative"}`,children:[m.jsx("img",{src:d>=0?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:d>=0?"up":"down",width:12,height:12,className:"PortfolioPage__StatCardChangeIcon"}),m.jsxs("span",{children:[Math.abs(d).toFixed(2),"%"]})]})}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdown",children:[m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx("span",{className:"PortfolioPage__StatCardBreakdownLabel",children:"Available"}),m.jsxs("span",{className:"PortfolioPage__StatCardBreakdownValue",children:["$",An(a)]})]}),m.jsx("div",{className:"PortfolioPage__StatCardBreakdownDivider"}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx("span",{className:"PortfolioPage__StatCardBreakdownLabel",children:"Earning"}),m.jsxs("span",{className:"PortfolioPage__StatCardBreakdownValue",children:["$",An(c)]})]})]})]}):m.jsx("div",{className:"PortfolioPage__StatCard",children:m.jsx("div",{className:"PortfolioPage__StatCardContent",children:m.jsx("p",{className:"PortfolioPage__StatCardEmpty",children:"Connect your wallet"})})})},bXe=()=>{const{address:t,isConnected:e}=mn(),{stats:n,isLoading:i,isWalletInLeaderboard:s}=zoe(),r=kn.useMemo(()=>
8428{if(!s||!n)return 0;const d=n.volumePoints!==void 0?n.volumePoints:n.points?Math.floor(n.points*.54):0;return Math.max(0,d)},[n,s]),o=kn.useMemo(()=>{if(!s||!n)return 0;const d=n.liquidityPoints!==void 0?n.liquidityPoints:n.points?Math.floor(n.points*.46):0;return Math.max(0,d)},[n,s]),a=kn.useMemo(()=>{if(!s||!n)return 0;const d=n.referralPoints!==void 0?n.referralPoints:0;return Math.max(0,d)},[n,s]),c=kn.useMemo(()=>!s||!n?0:n.points||r+o+a,[n,s,r,o,a]),l=kn.useMemo(()=>null,[c]);return e?i?m.jsxs("div",{className:"PortfolioPage__StatCard",children:[m.jsxs("div",{className:"PortfolioPage__StatCardHeader",children:[m.jsx(Ke,{width:"80px",height:"14px",style:{marginBottom:"12px"}}),m.jsx(Ke,{width:"120px",height:"28px"})]}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdown",children:[m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx(Ke,{width:"60px",height:"12px",style:{marginBottom:"8px"}}),m.jsx(Ke,{width:"100px",height:"18px"})]}),m.jsx("div",{className:"PortfolioPage__StatCardBreakdownDivider"}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx(Ke,{width:"60px",height:"12px",style:{marginBottom:"8px"}}),m.jsx(Ke,{width:"100px",height:"18px"})]})]})]}):m.jsxs("div",{className:"PortfolioPage__StatCard",children:[m.jsxs("div",{className:"PortfolioPage__StatCardHeader",children:[m.jsx("span",{className:"PortfolioPage__StatCardLabel",children:"Points"}),m.jsx("span",{className:"PortfolioPage__StatCardValue",children:s?An(c):"---"})]}),l!==null&&typeof l=="number"&&l!==0&&m.jsx("div",{className:"PortfolioPage__StatCardSubtext",children:m.jsx("div",{className:`PortfolioPage__StatCardChange ${l>=0?"PortfolioPage__StatCardChange--positive":"PortfolioPage__StatCardChange--negative"}`,children:m.jsxs("span",{children:[l>0?"+":"",An(l)]})})}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdown",children:[m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx("span",{className:"PortfolioPage__StatCardBreakdownLabel",children:"Volume"}),m.jsx("span",{className:"PortfolioPage__StatCardBreakdownValue",children:s?An(r):"---"})]}),m.jsx("div",{className:"PortfolioPage__StatCardBreakdownDivider"}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx("span",{className:"PortfolioPage__StatCardBreakdownLabel",children:"Liquidity"}),m.jsx("span",{className:"PortfolioPage__StatCardBreakdownValue",children:s?An(o):"---"})]}),m.jsx("div",{className:"PortfolioPage__StatCardBreakdownDivider"}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx("span",{className:"PortfolioPage__StatCardBreakdownLabel",children:"Referral"}),m.jsx("span",{className:"PortfolioPage__StatCardBreakdownValue",children:s?An(a):"---"})]})]})]}):m.jsx("div",{className:"PortfolioPage__StatCard",children:m.jsx("div",{className:"PortfolioPage__StatCardContent",children:m.jsx("p",{className:"PortfolioPage__StatCardEmpty",children:"Connect your wallet"})})})},wXe=()=>{const{address:t,isConnected:e}=mn(),{data:n,isLoading:i}=fXe(t),{data:s,isLoading:r}=gXe(n==null?void 0:n.referralCode);pXe();const[o,a]=M.useState(!1),[c,l]=M.useState(""),[d,h]=M.useState(!1),[p,g]=M.useState(!1),[b,w]=M.useState(!1),C=M.useRef(null);wte();const E=M.useMemo(()=>!(n!=null&&n.referralCode)||!t?"":`https://winnieswap.com/porfolio/?ref=${n.referralCode}`,[n==null?void 0:n.referralCode,t]),T=s==null?void 0:s.count,A=typeof T=="number"?An(T):i||r?"...":"---",k=M.useMemo(()=>null,[T]),R=async()=>{if(E)try{await navigator.clipboard.writeText(E),h(!0),setTimeout(()=>h(!1),2e3)}catch(I){console.error("Failed to copy:",I)}},P="Trading and Earning got an upgrade! Join me and others Winniers on @WinnieSwap!",B="Trading and Earning got an upgrade! Join me and others Winniers on @winnie_swap!",F=()=>{w(!b)},z=()=>{if(!E)return;const I=`https://twitter.com/intent/tweet?text=${encodeURIComponent(P)}&url=${encodeURIComponent(E)}`;window.open(I,"_blank","noopener,noreferrer"),w(!1)},K=()=>{if(!E)return;const I=`https://t.me/share/url?url=${encodeURIComponent(E)}&text=${encodeURIComponent(B)}`;window.open(I,"_blank","noopener,noreferrer"),w(!1)},q=()=>{if(!E)return;const I=`https://wa.me/?text=${encodeURIComponent(`${P} ${E}`)}`;window.open(I,"_blank","noopener,noreferrer"),w(!1)},G=async()=>
8428{if(E)try{navigator.share?(await navigator.share({title:P,text:P,url:E}),w(!1)):(await navigator.clipboard.writeText(E),g(!0),setTimeout(()=>g(!1),2e3),w(!1))}catch(I){console.error("Failed to share:",I),w(!1)}};return M.useEffect(()=>{const I=S=>{C.current&&!C.current.contains(S.target)&&w(!1)};return b&&document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}},[b]),e?i||r?m.jsxs("div",{className:"PortfolioPage__StatCard",children:[m.jsxs("div",{className:"PortfolioPage__StatCardHeader",children:[m.jsx(Ke,{width:"80px",height:"14px",style:{marginBottom:"12px"}}),m.jsx(Ke,{width:"100px",height:"20px"})]}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdown",children:[m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx(Ke,{width:"60px",height:"12px",style:{marginBottom:"8px"}}),m.jsx(Ke,{width:"100px",height:"20px"})]}),m.jsx("div",{className:"PortfolioPage__StatCardBreakdownDivider"}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",children:[m.jsx(Ke,{width:"60px",height:"12px",style:{marginBottom:"8px"}}),m.jsx(Ke,{width:"100px",height:"20px"})]})]})]}):m.jsxs("div",{className:"PortfolioPage__StatCard",children:[m.jsxs("div",{className:"PortfolioPage__StatCardHeader",children:[m.jsx("span",{className:"PortfolioPage__StatCardLabel",children:"Referrals"}),m.jsx("span",{className:"PortfolioPage__StatCardValue",children:A})]}),k!==null&&typeof k=="number"&&k!==0&&m.jsx("div",{className:"PortfolioPage__StatCardSubtext",children:m.jsx("div",{className:`PortfolioPage__StatCardChange ${k>=0?"PortfolioPage__StatCardChange--positive":"PortfolioPage__StatCardChange--negative"}`,children:m.jsxs("span",{children:[k>0?"+":"",An(k)]})})}),(n==null?void 0:n.referralCode)&&m.jsxs("div",{className:"PortfolioPage__StatCardBreakdown",children:[m.jsx("div",{className:"PortfolioPage__StatCardBreakdownItem",style:{flex:1},children:m.jsx("button",{onClick:R,className:"btn btn--tiny btn__shade",style:{fontSize:"12px",padding:"6px 12px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%"},title:d?"Link copied!":"Copy referral link",children:d?"Copied!":"Copy"})}),m.jsx("div",{className:"PortfolioPage__StatCardBreakdownDivider"}),m.jsxs("div",{className:"PortfolioPage__StatCardBreakdownItem",style:{flex:1,position:"relative"},children:[m.jsx("button",{onClick:F,className:"btn btn--tiny btn__shade",style:{fontSize:"12px",padding:"6px 12px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%"},title:"Share link",children:"Share"}),b&&m.jsxs("div",{ref:C,className:"PortfolioPage__ShareMenu",style:{position:"absolute",bottom:"100%",right:0,marginBottom:"8px",background:"rgba(20, 20, 20, 0.98)",border:"1px solid rgba(255, 255, 255, 0.12)",borderRadius:"8px",padding:"8px",minWidth:"160px",zIndex:1e3,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},children:[m.jsxs("button",{onClick:z,style:{width:"100%",padding:"8px 12px",background:"transparent",border:"none",color:"#fff",fontSize:"14px",textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",borderRadius:"4px",transition:"background 0.2s"},onMouseEnter:I=>I.currentTarget.style.background="rgba(255, 255, 255, 0.08)",onMouseLeave:I=>I.currentTarget.style.background="transparent",children:[m.jsx(Voe,{}),"X (Twitter)"]}),m.jsxs("button",{onClick:K,style:{width:"100%",padding:"8px 12px",background:"transparent",border:"none",color:"#fff",fontSize:"14px",textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",borderRadius:"4px",transition:"background 0.2s"},onMouseEnter:I=>I.currentTarget.style.background="rgba(255, 255, 255, 0.08)",onMouseLeave:I=>I.currentTarget.style.background="transparent",children:[m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.14.18-.357.295-.6.295-.002 0-.003 0-.005 0l.213-3.054 5.56-5.022c.24-.213-.054-.334-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Telegram"]}),m.jsxs("button",{onClick:q,style:{width:"100%",padding:"8px 12px",background:"transparent",border:"none",color:"#fff",fontSize:"14px",textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",borderRadius:"4px",transition:"background 0.2s"},onMouseEnter:I=>I.currentTarget.style.background="rgba(255, 255, 255, 0.08)",onMouseLeave:I=>I.currentTarget.style.background="transparent",children:[m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"
8428currentColor",children:m.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.98 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})}),"WhatsApp"]}),"share"in navigator&&m.jsxs("button",{onClick:G,style:{width:"100%",padding:"8px 12px",background:"transparent",border:"none",color:"#fff",fontSize:"14px",textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",borderRadius:"4px",transition:"background 0.2s",borderTop:"1px solid rgba(255, 255, 255, 0.08)",marginTop:"4px",paddingTop:"12px"},onMouseEnter:I=>I.currentTarget.style.background="rgba(255, 255, 255, 0.08)",onMouseLeave:I=>I.currentTarget.style.background="transparent",children:[m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"})}),"More options"]})]})]})]})]}):m.jsx("div",{className:"PortfolioPage__StatCard",children:m.jsx("div",{className:"PortfolioPage__StatCardContent",children:m.jsx("p",{className:"PortfolioPage__StatCardEmpty",children:"Connect your wallet"})})})},vN=({text:t,maxLength:e=12,className:n=""})=>{const[i,s]=M.useState(!1),r=t.length>e,o=r?`${t.slice(0,e)}...`:t;return r?m.jsxs("span",{className:`TruncatedTextWithTooltip ${n}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{cursor:"help"},children:[o,i&&m.jsx("div",{className:"TruncatedTextWithTooltip__Content",children:t})]}):m.jsx("span",{className:n,children:t})},vXe=` 8429query GetTransactions($owner: String) { 8430 positions(where: {owner: $owner}) { 8431 items { 8432 id 8433 pool 8434 poolRef { 8435 id 8436 sqrtPrice 8437 tick 8438 liquidity 8439 token0Ref { 8440 logoUri 8441 id 8442 name 8443 symbol 8444 decimals 8445 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8446 items { 8447 priceUSD 8448 } 8449 } 8450 } 8451 token1Ref { 8452 id 8453 logoUri 8454 name 8455 symbol 8456 decimals 8457 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8458 items { 8459 priceUSD 8460 } 8461 } 8462 } 8463 feeTier 8464 poolDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8465 items { 8466 apr 8467 } 8468 } 8469 } 8470 tokenId 8471 tickLower 8472 tickUpper 8473 withdrawnToken1 8474 withdrawnToken0 8475 depositedToken0 8476 depositedToken1 8477 liquidity 8478 } 8479 } 8480} 8481`,CXe=` 8482query GetUserVaultPositions($user: String) { 8483 stickyVaults { 8484 items { 8485 id 8486 name 8487 totalValueLockedUSD 8488 autoWinVault 8489 autoWinVaultRef { 8490 id 8491 estimatedAPR 8492 positions(where: {user: $user}) { 8493 items { 8494 user 8495 shares 8496 firstDepositAt 8497 lastUpdateAt 8498 } 8499 } 8500 } 8501 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8502 items { 8503 apr 8504 maxPotentialAPR 8505 } 8506 } 8507 poolRef { 8508 feeTier 8509 token0Ref { 8510 id 8511 name 8512 symbol 8513 logoUri 8514 decimals 8515 } 8516 token1Ref { 8517 id 8518 name 8519 symbol 8520 logoUri 8521 decimals 8522 } 8523 } 8524 positions(where: {user: $user}) { 8525 items { 8526 id 8527 user 8528 shares 8529 currentValueUSD 8530 feesEarnedUSD 8531 realizedPnLUSD 8532 initialValueUSD 8533 totalPnLUSD 8534 } 8535 } 8536 } 8537 } 8538} 8539`,yY=.5,xXe=(t,e)=>{const n=t.vaultDayData.items[0],i=(n==null?void 0:n.maxPotentialAPR)||(n==null?void 0:n.apr);return{id:e.id,vaultId:t.id,vaultName:XM(t.name)||`${t.poolRef.token0Ref.symbol}/${t.poolRef.token1Ref.symbol}`,token0Symbol:t.poolRef.token0Ref.symbol,token1Symbol:t.poolRef.token1Ref.symbol,token0LogoUri:t.poolRef.token0Ref.logoUri,token1LogoUri:t.poolRef.token1Ref.logoUri,shares:e.shares,currentValueUSD:e.currentValueUSD,feesEarnedUSD:e.feesEarnedUSD,feeTier:t.poolRef.feeTier,apr:typeof i=="number"?i:typeof i=="string"?parseFloat(i):0,type:"vault"}},EXe=({row:t,vaultTVL_USD:e})=>{const{address:n}=mn(),i=hL({vaultAddress:t.vaultId,userAddress:n,vaultTVL_USD:e});if(i.shares===0n)return null;const s=i.shares>0n?parseFloat(dt(i.shares,18)):parseFloat(t.shares),r=i.shares>0n?i.valueInUSD||parseFloat(t.currentValueUSD||"0"):0;return m.jsxs("div",{children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[m.jsx("span",{style:{fontSize:"14px",fontWeight:"500"},children:s.toFixed(4)}),m.jsx(cXe,{width:24,height:24,className:"PortfolioPage__VaultStickyIcon"})]}),m.jsxs("div",{style:{fontSize:"12px",color:"#aaa",marginTop:"4px"},children:["$",r.toFixed(2)]})]})},_Xe=({row:t,vaultTVL_USD:e})=>{const{address:n}=mn(),i=fL({autoWinVault:t.autoWinVault,userAddress:n,sharesFromIndexer:t.shares,stickyVaultAddress:t.vaultId,vaultTVL_USD:e});if(i.shares===0n)return null;const s=i.shares>0n?parseFloat(dt(i.shares,18)):parseFloat(t.shares),r=i.shares>0n?i.valueInUSD||parseFloat(t.currentValueUSD||"0"):0;return m.jsxs("div",{children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[m.jsx("span",{style:{fontSize:"14px",fontWeight:"500"},children:s.toFixed(4)}),m.jsx(lXe,{width:24,height:24})]}),m.jsxs("div",{style:{fontSize:"12px",color:"#aaa",marginTop:"4px"},children:["$",r.toFixed(2)]})]})},SXe=({columns:t,positions:e,vaultPositionsData:n,isLoading:i,onRowClick:s,defaultSortKey:r,defaultSortDirection:o})=>m.jsx(Zp,{columns:t,data:e,tableClassName:"Table",wrapperClassName:"Table__Wrapper",scrollClassName:"Table__Scroll",emptyMessage:"No positions foun
8539d",isLoading:i,onRowClick:s,defaultSortKey:r,defaultSortDirection:o}),AXe=({row:t})=>{const{data:e}=Si({address:vt.positionManager,abi:Eu,functionName:"positions",args:[BigInt(t.tokenId||"0")],query:{enabled:!!t.tokenId,staleTime:3e4}}),n=M.useMemo(()=>{var c,l,d,h,p,g,b,w,C,E,T,A,k,R,P,B,F,z,K,q,G,I,S;try{const v=t.poolRef,_=t;let N=_.liquidity;if(e&&Array.isArray(e)){const he=e[7];he>0n&&(N=he.toString())}if(e&&Array.isArray(e)&&e[7]===0n)return{amount0:"0.00",amount1:"0.00",totalValue:"0.00"};if(N==="0"||N===0n||!v.sqrtPrice)return{amount0:"0.00",amount1:"0.00",totalValue:"0.00"};const $=v.tick?Number(v.tick):Yt.getTickAtSqrtRatio(X.BigInt(v.sqrtPrice)),U=new to(new on(Nn.id,v.token0Ref.id,v.token0Ref.decimals||18,v.token0Ref.symbol,v.token0Ref.name),new on(Nn.id,v.token1Ref.id,v.token1Ref.decimals||18,v.token1Ref.symbol,v.token1Ref.name),v.feeTier,v.sqrtPrice,v.liquidity,$),j=new ca({pool:U,tickLower:_.tickLower,tickUpper:_.tickUpper,liquidity:N.toString()}),D=j.amount0,O=j.amount1,H=parseFloat(D.toExact()),J=parseFloat(O.toExact()),W=Math.max(0,H).toFixed(2),Z=Math.max(0,J).toFixed(2),Y=((d=(l=(c=v.token0Ref.tokenDayData)==null?void 0:c.items)==null?void 0:l[0])==null?void 0:d.priceUSD)||0,Q=((g=(p=(h=v.token1Ref.tokenDayData)==null?void 0:h.items)==null?void 0:p[0])==null?void 0:g.priceUSD)||0,ee=Math.max(0,H),ie=Math.max(0,J),re=ee*parseFloat(String(Y)),oe=ie*parseFloat(String(Q)),de=(re+oe).toFixed(2);return parseFloat(de)>5e4&&console.warn("[PositionSizeCell] High position value detected:",{poolId:v.id,token0:v.token0Ref.symbol,token1:v.token1Ref.symbol,amount0:W,amount1:Z,token0Price:Y,token1Price:Q,value0:re,value1:oe,totalValue:de,positionLiquidity:_.liquidity,poolLiquidity:v.liquidity}),{amount0:W,amount1:Z,totalValue:de}}
8539catch(v){console.error("[PositionSizeCell] Error calculating position amounts:",v,{poolId:(b=t.poolRef)==null?void 0:b.id,token0:(C=(w=t.poolRef)==null?void 0:w.token0Ref)==null?void 0:C.symbol,token1:(T=(E=t.poolRef)==null?void 0:E.token1Ref)==null?void 0:T.symbol,liquidity:t.liquidity,sqrtPrice:(A=t.poolRef)==null?void 0:A.sqrtPrice,tickLower:t.tickLower,tickUpper:t.tickUpper});const _=(parseFloat(t.depositedToken0||0)-parseFloat(t.withdrawnToken0||0)).toFixed(2),N=(parseFloat(t.depositedToken1||0)-parseFloat(t.withdrawnToken1||0)).toFixed(2),$=((P=(R=(k=t.poolRef.token0Ref.tokenDayData)==null?void 0:k.items)==null?void 0:R[0])==null?void 0:P.priceUSD)||0,U=((z=(F=(B=t.poolRef.token1Ref.tokenDayData)==null?void 0:B.items)==null?void 0:F[0])==null?void 0:z.priceUSD)||0,j=(parseFloat(_)*parseFloat($)+parseFloat(N)*parseFloat(U)).toFixed(2);return parseFloat(_)===0&&parseFloat(N)===0&&console.warn("[PositionSizeCell] Both amounts are zero after fallback:",{poolId:(K=t.poolRef)==null?void 0:K.id,token0:(G=(q=t.poolRef)==null?void 0:q.token0Ref)==null?void 0:G.symbol,token1:(S=(I=t.poolRef)==null?void 0:I.token1Ref)==null?void 0:S.symbol,depositedToken0:t.depositedToken0,withdrawnToken0:t.withdrawnToken0,depositedToken1:t.depositedToken1,withdrawnToken1:t.withdrawnToken1}),{amount0:_,amount1:N,totalValue:j}}},[t,e]),i=xr(t.poolRef.token0Ref.symbol,t.poolRef.token0Ref.name,t.poolRef.token0Ref.id,t.poolRef.token0Ref.logoUri),s=xr(t.poolRef.token1Ref.symbol,t.poolRef.token1Ref.name,t.poolRef.token1Ref.id,t.poolRef.token1Ref.logoUri),r=!isNaN(parseFloat(n.amount0)),o=!isNaN(parseFloat(n.amount1)),a=r&&o;return m.jsx("div",{children:a?m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.amount0,m.jsx(ws,{logoUri:i,symbol:t.poolRef.token0Ref.symbol,name:t.poolRef.token0Ref.name,id:t.poolRef.token0Ref.id,size:16,skipProcessing:!1})]}),m.jsx("span",{style:{opacity:.6},children:"·"}),m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.amount1,m.jsx(ws,{logoUri:s,symbol:t.poolRef.token1Ref.symbol,name:t.poolRef.token1Ref.name,id:t.poolRef.token1Ref.id,size:16,skipProcessing:!1})]})]}),m.jsx("div",{style:{fontSize:"12px",color:"#aaa",marginTop:"4px"},children:parseFloat(n.totalValue)>0?`$${n.totalValue}`:""})]}):m.jsx("div",{style:{fontSize:"12px",color:"#aaa"},children:"Calculating position..."})})},bY=()=>{const{address:t,isConnected:e}=mn(),[n,i]=M.useState("open"),[s,r]=M.useState("positions"),o=Zo(),a=jr(),[c,l]=M.useState(!1);M.useEffect(()=>{const v=new URLSearchParams(a.search).get("ref"),_=a.pathname==="/porfolio"||a.pathname==="/porfolio/";v&&_&&!e?l(!0):e&&c&&l(!1)},[a.pathname,a.search,e,c]);const{data:d,isLoading:h}=L1(),{data:p}=Zt({queryKey:["tokenListForLogos"],queryFn:async()=>{const S=await fetch("https://api.winnieswap.com/token/list");if(!S.ok)return[];const v=await S.json();return Array.isArray(v)?v:(v==null?void 0:v.data)||[]},staleTime:300*1e3}),{data:g,isLoading:b}=Zt({queryKey:["positions",t],queryFn:async()=>{const S=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:vXe,variables:{owner:t}})});return S.ok?(await S.json()).data.positions.items:null},enabled:!!t,staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:30*1e3,refetchIntervalInBackground:!0}),{data:w,isLoading:C}=Zt({queryKey:["vaultPositions",t],queryFn:async()=>{const S=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:CXe,variables:{user:t==null?void 0:t.toLowerCase()}})});return S.ok?(await S.json()).data.stickyVaults.items:null},enabled:!!t,staleTime:30*1e3,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchInterval:30*1e3,refetchIntervalInBackground:!0,placeholderData:S=>S}),E=M.useMemo(()=>{if(!w)return[];const S=[];return w.forEach(v=>{var _;if(v.positions.items.filter(N=>{const $=parseFloat(N.shares||"0"),U=parseFloat(N.currentValueUSD||"0");return $>0&&U>0}
8539).forEach(N=>{S.push(xXe(v,N))}),v.autoWinVault&&v.autoWinVaultRef&&((_=v.autoWinVaultRef.positions)!=null&&_.items)&&v.autoWinVaultRef.positions.items.length>0){const N=v.vaultDayData.items[0],$=typeof(N==null?void 0:N.maxPotentialAPR)=="string"?parseFloat(N.maxPotentialAPR):(N==null?void 0:N.maxPotentialAPR)||0,U=parseFloat(v.autoWinVaultRef.estimatedAPR||"0"),j=$+U;v.autoWinVaultRef.positions.items.forEach(D=>{parseFloat(D.shares||"0")>0&&S.push({id:`${v.id}-autowin-${D.user}`,vaultId:v.id,vaultName:XM(v.name)||`${v.poolRef.token0Ref.symbol}/${v.poolRef.token1Ref.symbol}`,token0Symbol:v.poolRef.token0Ref.symbol,token1Symbol:v.poolRef.token1Ref.symbol,token0LogoUri:v.poolRef.token0Ref.logoUri,token1LogoUri:v.poolRef.token1Ref.logoUri,shares:D.shares,currentValueUSD:"0",feesEarnedUSD:"0",feeTier:v.poolRef.feeTier,apr:j,type:"autowin",autoWinVault:v.autoWinVault})})}}),S},[w]),T=M.useMemo(()=>{const S=g||[],v=E||[],_=new Map;return p&&Array.isArray(p)&&p.forEach(U=>{if(U.address||U.id){const j=(U.address||U.id).toLowerCase();_.set(j,U.logoUri||null)}}),[...S.map(U=>{var J,W,Z,Y,Q,ee,ie,re,oe,de;const j=(Z=(W=(J=U.poolRef)==null?void 0:J.token0Ref)==null?void 0:W.id)==null?void 0:Z.toLowerCase(),D=(ee=(Q=(Y=U.poolRef)==null?void 0:Y.token1Ref)==null?void 0:Q.id)==null?void 0:ee.toLowerCase(),O=((re=(ie=U.poolRef)==null?void 0:ie.token0Ref)==null?void 0:re.logoUri)||(j?_.get(j):null),H=((de=(oe=U.poolRef)==null?void 0:oe.token1Ref)==null?void 0:de.logoUri)||(D?_.get(D):null);return{...U,type:"pool",poolRef:{...U.poolRef,token0Ref:{...U.poolRef.token0Ref,logoUri:O},token1Ref:{...U.poolRef.token1Ref,logoUri:H}}}}),...v].sort((U,j)=>{var H,J,W,Z,Y,Q,ee,ie,re,oe,de,he,ue,be,_e,Ne;let D=0,O=0;if(U.type==="autowin"){const pe=w==null?void 0:w.find(Te=>Te.id===U.vaultId);if(pe){const Te=parseFloat(U.shares||"0"),ve=parseFloat(pe.totalValueLockedUSD||"0");D=Te>0&&ve>0?Te/1e6*ve:0}}else if(U.type==="vault")D=parseFloat(U.currentValueUSD||"0");else try{const pe=U.poolRef,Te=U;if(Te.liquidity==="0"||!pe.sqrtPrice)D=0;else{const ve=pe.tick?Number(pe.tick):Yt.getTickAtSqrtRatio(X.BigInt(pe.sqrtPrice)),xe=new to(new on(Nn.id,pe.token0Ref.id,pe.token0Ref.decimals||18,pe.token0Ref.symbol,pe.token0Ref.name),new on(Nn.id,pe.token1Ref.id,pe.token1Ref.decimals||18,pe.token1Ref.symbol,pe.token1Ref.name),pe.feeTier,pe.sqrtPrice,pe.liquidity,ve),Ye=new ca({pool:xe,tickLower:Te.tickLower,tickUpper:Te.tickUpper,liquidity:Te.liquidity}),ze=parseFloat(Ye.amount0.toExact()),ft=parseFloat(Ye.amount1.toExact()),lt=((Z=(W=(J=(H=pe.token0Ref)==null?void 0:H.tokenDayData)==null?void 0:J.items)==null?void 0:W[0])==null?void 0:Z.priceUSD)||0,We=((ie=(ee=(Q=(Y=pe.token1Ref)==null?void 0:Y.tokenDayData)==null?void 0:Q.items)==null?void 0:ee[0])==null?void 0:ie.priceUSD)||0,Dt=ze*parseFloat(lt),Fe=ft*parseFloat(We);D=Dt+Fe}}catch{D=0}if(j.type==="autowin"){const pe=w==null?void 0:w.find(Te=>Te.id===j.vaultId);if(pe){const Te=parseFloat(j.shares||"0"),ve=parseFloat(pe.totalValueLockedUSD||"0");O=Te>0&&ve>0?Te/1e6*ve:0}}else if(j.type==="vault")O=parseFloat(j.currentValueUSD||"0");else try{const pe=j.poolRef,Te=j;if(Te.liquidity==="0"||!pe.sqrtPrice)O=0;else{const ve=pe.tick?Number(pe.tick):Yt.getTickAtSqrtRatio(X.BigInt(pe.sqrtPrice)),xe=new to(new on(Nn.id,pe.token0Ref.id,pe.token0Ref.decimals||18,pe.token0Ref.symbol,pe.token0Ref.name),new on(Nn.id,pe.token1Ref.id,pe.token1Ref.decimals||18,pe.token1Ref.symbol,pe.token1Ref.name),pe.feeTier,pe.sqrtPrice,pe.liquidity,ve),Ye=new ca({pool:xe,tickLower:Te.tickLower,tickUpper:Te.tickUpper,liquidity:Te.liquidity}),ze=parseFloat(Ye.amount0.toExact()),ft=parseFloat(Ye.amount1.toExact()),lt=((he=(de=(oe=(re=pe.token0Ref)==null?void 0:re.tokenDayData)==null?void 0:oe.items)==null?void 0:de[0])==null?void 0:he.priceUSD)||0,We=((Ne=(_e=(be=(ue=pe.token1Ref)==null?void 0:ue.tokenDayData)==null?void 0:be.items)==null?void 0:_e[0])==null?void 0:Ne.priceUSD)||0,Dt=ze*parseFloat(lt),Fe=ft*parseFloat(We);O=Dt+Fe}}catch{O=0}return O-D})},[g,E,p]),A=M.useMemo(()=>(T==null?void 0:T.filter(S=>S.type==="vault"||S.type==="autowin"))||[],[T]),k=M.useMemo(()=>
8539{if(!t||A.length===0)return[];const S=[];return A.forEach(v=>{v.type==="vault"?S.push({address:v.vaultId,abi:Wd,functionName:"balanceOf",args:[t]}):v.type==="autowin"&&v.autoWinVault&&S.push({address:v.autoWinVault,abi:Df,functionName:"balanceOf",args:[t]})}),S},[t,A]),{data:R}=vf({contracts:k,query:{enabled:!!t&&k.length>0,staleTime:3e4,refetchInterval:30*1e3}}),P=M.useMemo(()=>{const S=new Map;return!R||!A||R.forEach((v,_)=>{const N=A[_];if(N){const $=N.type==="autowin"?`autowin-${N.vaultId}-${N.autoWinVault}`:`vault-${N.vaultId}`;S.set($,v.result||0n)}}),S},[R,A]),B=M.useMemo(()=>T?T.filter(v=>{var N,$,U,j,D,O,H,J,W,Z,Y,Q,ee;let _=0;if(v.type==="autowin"){const ie=`autowin-${v.vaultId}-${v.autoWinVault}`,re=P.get(ie);if(re!==void 0&&re===0n)return n==="closed";const oe=w==null?void 0:w.find(de=>de.id===v.vaultId);if(oe){const de=parseFloat(v.shares||"0"),he=parseFloat(oe.totalValueLockedUSD||"0");_=de>0&&he>0?de/1e6*he:0}}else if(v.type==="vault"){const ie=`vault-${v.vaultId}`,re=P.get(ie);if(re!==void 0&&re===0n)return n==="closed";const oe=parseFloat(v.shares||"0"),de=parseFloat(v.currentValueUSD||"0");_=oe>0?de:0}else try{const ie=v.poolRef,re=v;if(re.liquidity==="0"||!ie.sqrtPrice)_=0;else{const oe=ie.tick?Number(ie.tick):Yt.getTickAtSqrtRatio(X.BigInt(ie.sqrtPrice)),de=new to(new on(Nn.id,ie.token0Ref.id,ie.token0Ref.decimals||18,ie.token0Ref.symbol,ie.token0Ref.name),new on(Nn.id,ie.token1Ref.id,ie.token1Ref.decimals||18,ie.token1Ref.symbol,ie.token1Ref.name),ie.feeTier,ie.sqrtPrice,ie.liquidity,oe),he=new ca({pool:de,tickLower:re.tickLower,tickUpper:re.tickUpper,liquidity:re.liquidity}),ue=he.amount0,be=he.amount1,_e=parseFloat(ue.toExact()),Ne=parseFloat(be.toExact()),pe=Math.max(0,_e),Te=Math.max(0,Ne),ve=((j=(U=($=(N=ie.token0Ref)==null?void 0:N.tokenDayData)==null?void 0:$.items)==null?void 0:U[0])==null?void 0:j.priceUSD)||0,xe=((J=(H=(O=(D=ie.token1Ref)==null?void 0:D.tokenDayData)==null?void 0:O.items)==null?void 0:H[0])==null?void 0:J.priceUSD)||0,Ye=pe*parseFloat(String(ve)),ze=Te*parseFloat(String(xe));_=Ye+ze,_>5e4&&console.warn("[PortfolioPage] High position value in filter:",{poolId:ie.id,token0:ie.token0Ref.symbol,token1:ie.token1Ref.symbol,amount0Abs:pe,amount1Abs:Te,token0Price:ve,token1Price:xe,amount0USD:Ye,amount1USD:ze,positionValueUSD:_,positionLiquidity:re.liquidity,poolLiquidity:ie.liquidity})}}catch(ie){console.error("Error calculating position USD value for filtering:",ie),_=0}if(v.type==="pool"){let ie=v.liquidity;typeof ie=="bigint"||typeof ie=="number"?ie=ie.toString():typeof ie=="string"&&(ie=ie.trim());const re=typeof ie=="string"?parseFloat(ie):Number(ie),oe=ie!=null&&ie!==""&&ie!=="0"&&ie!=="0.0"&&ie!=="0x0"&&(typeof ie=="number"?ie!==0:!0)&&(typeof ie=="bigint"?ie!==0n:!0)&&!isNaN(re)&&re>0;return oe&&n==="closed"&&console.warn("[PortfolioPage] Position with liquidity in closed tab:",{tokenId:v.tokenId,liquidity:v.liquidity,liquidityValue:ie,liquidityNum:re,pool:(W=v.poolRef)==null?void 0:W.id,token0:(Y=(Z=v.poolRef)==null?void 0:Z.token0Ref)==null?void 0:Y.symbol,token1:(ee=(Q=v.poolRef)==null?void 0:Q.token1Ref)==null?void 0:ee.symbol}),n==="open"?oe?_>0:!1:!oe}else return n==="open"?_>=yY:_<yY}).sort((v,_)=>{var U,j,D,O,H,J,W,Z,Y,Q,ee,ie,re,oe,de,he;let N=0,$=0;if(v.type==="autowin"){const ue=w==null?void 0:w.find(be=>be.id===v.vaultId);if(ue){const be=parseFloat(v.shares||"0"),_e=parseFloat(ue.totalValueLockedUSD||"0");N=be>0&&_e>0?be/1e6*_e:0}}else if(v.type==="vault")N=parseFloat(v.currentValueUSD||"0");else try{const ue=v.poolRef,be=v;if(be.liquidity==="0"||!ue.sqrtPrice)N=0;else{const _e=ue.tick?Number(ue.tick):Yt.getTickAtSqrtRatio(X.BigInt(ue.sqrtPrice)),Ne=new to(new on(Nn.id,ue.token0Ref.id,ue.token0Ref.decimals||18,ue.token0Ref.symbol,ue.token0Ref.name),new on(Nn.id,ue.token1Ref.id,ue.token1Ref.decimals||18,ue.token1Ref.symbol,ue.token1Ref.name),ue.feeTier,ue.sqrtPrice,ue.liquidity,_e),pe=new ca({pool:Ne,tickLower:be.tickLower,tickUpper:be.tickUpper,liquidity:be.liquidity}),Te=parseFloat(pe.amount0.toExact()),ve=parseFloat(pe.amount1.toExact()),xe=((O=(D=(j=(U=ue.token0Ref)==null?void 0:U.tokenDayData)==null?void 0:j.items)==null?void 0:D[0])==null?void 0:O.priceUSD)||0,Ye=((Z=(W=(J=(H=ue.token1Ref)==null?void 0:H.tokenDayData)==null?void 0:J.items)==null?void 0:W[0])==null?void 0:Z.priceUSD)||0,ze=Math.max(0,Te)*parseFloat(String(xe)),ft=Math.max(0,ve)*parseFloat(String(Ye));N=ze+ft}}catch{N=0}if(_.type==="autowin"){const ue=w==null?void 0:w.find(be=>be.id===_.vaultId);if(ue){const be=parseFloat(_.shares||"0"),_e=parseFloat(ue.totalValueLockedUSD||"0");$=be>0&&_e>0?be/1e6*_e:0}}else if(_.type==="vault")$=parseFloat(_.currentValueUSD||"0");else try{const ue=_.poolRef,be=_;if(be.liquidity==="0"||!ue.sqrtPrice)$=0;else{const _e=ue.tick?Number(ue.tick):Yt.getTickAtSqrtRatio(X.BigInt(ue.sqrtPrice)),Ne=new to(new on(Nn.id,ue.token0Ref.id,ue.token0Ref.decimals||18,ue.token0Ref.symbol,ue.token0Ref.name),new on(Nn.id,ue.token1Ref.id,ue.token1Ref.decimals||18,ue.token1Ref.symbol,ue.token1Ref.name),ue.feeTier,ue.sqrtPrice,ue.liquidity,_e),pe=new ca({pool:Ne,tickLower:be.tickLower,tickUpper:be.tickU
8539pper,liquidity:be.liquidity}),Te=parseFloat(pe.amount0.toExact()),ve=parseFloat(pe.amount1.toExact()),xe=((ie=(ee=(Q=(Y=ue.token0Ref)==null?void 0:Y.tokenDayData)==null?void 0:Q.items)==null?void 0:ee[0])==null?void 0:ie.priceUSD)||0,Ye=((he=(de=(oe=(re=ue.token1Ref)==null?void 0:re.tokenDayData)==null?void 0:oe.items)==null?void 0:de[0])==null?void 0:he.priceUSD)||0,ze=Math.max(0,Te)*parseFloat(String(xe)),ft=Math.max(0,ve)*parseFloat(String(Ye));$=ze+ft}}catch{$=0}return $-N}):[],[T,n,w,P]),F=S=>{S.type==="vault"||S.type==="autowin"?o(`/vaults/${S.vaultId}`):o(`/pools/${S.pool}`)},z=S=>{o(`/tokens/${S.address}`)},K=M.useMemo(()=>{var S;return!((S=d==null?void 0:d.data)!=null&&S.tokens)||h?[]:d.data.tokens.filter(v=>(v.balanceUSD||0)>0).map(v=>({address:v.address||v.id,symbol:v.symbol,name:v.name,logoUri:v.logoUri,balance:v.balance||"0",balanceUSD:v.balanceUSD||0})).sort((v,_)=>_.balanceUSD-v.balanceUSD)},[d,h]),q=(S,v)=>{var _,N,$,U,j,D,O,H;if(S.type==="autowin"){const J=v==null?void 0:v.find(Y=>Y.id===S.vaultId);if(!J)return 0;const W=parseFloat(S.shares||"0"),Z=parseFloat(J.totalValueLockedUSD||"0");return W>0&&Z>0?W/1e6*Z:0}if(S.type==="vault")return parseFloat(S.currentValueUSD||"0");try{const J=S.poolRef,W=S;if(W.liquidity==="0"||!(J!=null&&J.sqrtPrice))return 0;const Z=J.tick!=null?Number(J.tick):Yt.getTickAtSqrtRatio(X.BigInt(J.sqrtPrice)),Y=new to(new on(Nn.id,J.token0Ref.id,J.token0Ref.decimals||18,J.token0Ref.symbol,J.token0Ref.name),new on(Nn.id,J.token1Ref.id,J.token1Ref.decimals||18,J.token1Ref.symbol,J.token1Ref.name),J.feeTier,J.sqrtPrice,J.liquidity,Z),Q=new ca({pool:Y,tickLower:W.tickLower,tickUpper:W.tickUpper,liquidity:W.liquidity}),ee=parseFloat(Q.amount0.toExact()),ie=parseFloat(Q.amount1.toExact()),re=((U=($=(N=(_=J.token0Ref)==null?void 0:_.tokenDayData)==null?void 0:N.items)==null?void 0:$[0])==null?void 0:U.priceUSD)||0,oe=((H=(O=(D=(j=J.token1Ref)==null?void 0:j.tokenDayData)==null?void 0:D.items)==null?void 0:O[0])==null?void 0:H.priceUSD)||0;return Math.max(0,ee)*parseFloat(String(re))+Math.max(0,ie)*parseFloat(String(oe))}catch{return 0}},G=[{label:"Token",key:"token",width:"50%",render:S=>m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[m.jsx(ws,{logoUri:S.logoUri,symbol:S.symbol,name:S.name,id:S.address,size:28}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[S.name&&m.jsx("span",{style:{fontSize:"14px",fontWeight:"500"},children:m.jsx(vN,{text:S.name,maxLength:35})}),m.jsx("span",{style:{fontSize:"12px",color:"rgba(255, 255, 255, 0.6)"},children:S.symbol})]})]})},{label:"Balance",key:"balance",width:"25%",render:S=>{const v=parseFloat(S.balance||"0");return m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[m.jsx("span",{style:{fontSize:"14px",fontWeight:"500"},children:v>0?An(v):"0"}),m.jsx("span",{style:{fontSize:"12px",color:"rgba(255, 255, 255, 0.6)"},children:S.symbol})]})}},{label:"Value",key:"value",width:"25%",render:S=>m.jsxs("span",{style:{fontSize:"14px",fontWeight:"500"},children:["$",An(S.balanceUSD)]})}],I=[{label:"Pair",key:"pair",width:"40%",render:S=>{var v,_,N,$;if(S.type==="vault"||S.type==="autowin")return m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[m.jsx(If,{token0:{id:S.vaultId,address:S.vaultId,symbol:S.token0Symbol,logoUri:S.token0LogoUri},token1:{id:S.vaultId,address:S.vaultId,symbol:S.token1Symbol,logoUri:S.token1LogoUri},size:28,gap:3,borderWidth:2,separatorWidth:1.5}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:m.jsx("span",{style:{fontSize:"14px",fontWeight:"500"},children:m.jsx(vN,{text:S.vaultName,maxLength:35})})})]});{const U=((_=(v=S.poolRef)==null?void 0:v.token0Ref)==null?void 0:_.logoUri)||null,j=(($=(N=S.poolRef)==null?void 0:N.token1Ref)==null?void 0:$.logoUri)||null;return(!U||!j)&&console.log("[PortfolioPage] Missing logos for pool position:",{pair:`${S.poolRef.token0Ref.symbol} / ${S.poolRef.token1Ref.symbol}`,token0LogoUri:U,token1LogoUri:j,token0:S.poolRef.token0Ref,token1:S.poolRef.token1Ref}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[m.jsx(If,{token0:{id:S.poolRef.token0Ref.id,address:S.poolRef.token0Ref.id,symbol:S.poolRef.token0Ref.symbol,n
8539ame:S.poolRef.token0Ref.name,logoUri:U},token1:{id:S.poolRef.token1Ref.id,address:S.poolRef.token1Ref.id,symbol:S.poolRef.token1Ref.symbol,name:S.poolRef.token1Ref.name,logoUri:j},size:28,gap:3,borderWidth:2,separatorWidth:1.5}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:m.jsx("span",{style:{fontSize:"14px",fontWeight:"500"},children:m.jsx(vN,{text:`${S.poolRef.token0Ref.symbol} / ${S.poolRef.token1Ref.symbol}`,maxLength:35})})})]})}}},{label:"Position size",key:"size",width:"24%",sortable:!0,sortValue:S=>q(S,w),render:S=>{if(S.type==="autowin"){const v=w==null?void 0:w.find($=>$.id===S.vaultId),_=(v==null?void 0:v.totalValueLockedUSD)||"0";return m.jsx(_Xe,{row:S,vaultTVL_USD:_})}else if(S.type==="vault"){const v=w==null?void 0:w.find($=>$.id===S.vaultId),_=(v==null?void 0:v.totalValueLockedUSD)||"0";return m.jsx(EXe,{row:S,vaultTVL_USD:_})}else return m.jsx(AXe,{row:S})}},{label:"Type / Fees",key:"type-fees",width:"18%",render:S=>{const v=S.type==="vault"||S.type==="autowin",_=S.type==="autowin",N=S.type==="vault",$=v?S.feeTier/1e4:S.poolRef.feeTier/1e4,U=v?{color:"#FFB648",backgroundColor:"rgba(255, 182, 72, 0.1)"}:{color:"#aaa",backgroundColor:"rgba(170, 170, 170, 0.1)"},j=_?"Staked":N?"Deposit":"Pool";return m.jsxs("span",{style:{fontSize:"12px",fontWeight:600,letterSpacing:"0.4px",padding:"4px 10px",borderRadius:"12px",width:"fit-content",display:"inline-flex",alignItems:"center",gap:6,textShadow:"0px 1.5px 1px #100A25, -0.5px 0px 0px #180E00, 0.5px 0px 0px #180E00, 0px -0.5px 0px #180E00",...U},children:[j,m.jsxs("span",{style:{fontSize:"11px",fontWeight:500,opacity:.85},children:["· ",$,"%"]})]})}},{label:"APR",key:"apr",width:"18%",render:S=>{if(S.type==="autowin"||S.type==="vault")return S.apr?`${S.apr.toFixed(2)}%`:"-";{const v=S.poolRef.poolDayData.items[0].apr||"0";return v!=="0"?`${v}%`:"-"}}}];return m.jsxs(m.Fragment,{children:[m.jsxs(eL,{open:c,onClose:()=>l(!1),className:"Modal",overlayClassName:"NetworksList",children:[m.jsx("div",{className:"Modal__Header",children:m.jsxs("div",{className:"Modal__HeaderContent",children:[m.jsx("span",{className:"Modal__HeaderTitle",children:"Connect your wallet"}),m.jsx("button",{className:"Modal__HeaderClose",onClick:()=>l(!1),tabIndex:0,"aria-label":"Close",children:m.jsx("svg",{viewBox:"0 0 16 16",fill:"none",strokeWidth:"8",style:{width:"24px",height:"24px",color:"rgba(255, 255, 255, 0.65)"},children:m.jsx("path",{d:"M12.5303 4.53033C12.8232 4.23744 12.8232 3.76256 12.5303 3.46967C12.2374 3.17678 11.7626 3.17678 11.4697 3.46967L12.5303 4.53033ZM3.46967 11.4697C3.17678 11.7626 3.17678 12.2374 3.46967 12.5303C3.76256 12.8232 4.23744 12.8232 4.53033 12.5303L3.46967 11.4697ZM4.53033 3.46967C4.23744 3.17678 3.76256 3.17678 3.46967 3.46967C3.17678 3.76256 3.17678 4.23744 3.46967 4.53033L4.53033 3.46967ZM11.4697 12.5303C11.7626 12.8232 12.2374 12.8232 12.5303 12.5303C12.8232 12.2374 12.8232 11.7626 12.5303 11.4697L11.4697 12.5303ZM11.4697 3.46967L3.46967 11.4697L4.53033 12.5303L12.5303 4.53033L11.4697 3.46967ZM3.46967 4.53033L11.4697 12.5303L12.5303 11.4697L4.53033 3.46967L3.46967 4.53033Z",fill:"currentColor"})})})]})}),m.jsxs("div",{className:"Modal__Content",style:{padding:"24px",textAlign:"center",display:"flex",flexDirection:"column",gap:"16px",alignItems:"center"},children:[m.jsx("p",{style:{color:"rgba(255, 255, 255, 0.8)",fontSize:"16px",margin:0},children:"Connect your wallet to assign the referral code to your address"}),m.jsx(QM,{size:"large"})]})]}),m.jsxs(Uu,{className:"PortfolioPage",children:[m.jsx(LS,{}),m.jsxs("div",{className:"PortfolioPage__ContentWrapper",children:[m.jsxs("div",{className:"PortfolioPage__TopRow",children:[m.jsx(yXe,{}),m.jsx(bXe,{}),m.jsx(wXe,{})]}),m.jsxs("div",{className:"PortfolioPage__PortfolioSection",children:[m.jsx("div",{className:"PortfolioPage__Header",children:m.jsx("h2",{className:"PortfolioPage__Title",children:"Portfolio"})}),m.jsxs("div",{className:"PortfolioPage__TabsWrapper",children:[m.jsx(xL,{tabs:["Positions","Tokens"],defaultTab:s==="positions"?"Positions":"Tokens",onChange:S=>{r(S==="Positions"?"positions":"tokens")}}),m.jsxs("div",{className:"PortfolioPage__FilterButtons",style:{visibility:s==="positions"?"visible":"hidden"},children:[m.jsx(k2,{segments:[{key:"open",label:"Open"},{key:"closed",label:"Closed"}],selectedKey:n,onChange:S=>i(S)}),e&&m.jsx(gi,{className:"btn btn--tiny btn__accent",to:"/liquidity/create",children:"New"})]})]}),s==="tokens"?e?m.jsx("div",{className:"PortfolioPage__TableWrapper",children:m.jsx(Zp,{columns:G,data:K,tableClassName:"Table",wrapperClassName:"Table__Wrapper",scrollClassName:"Table__Scroll",emptyMessage:"No tokens found",isLoading:h,onRowClick:z})}):m.jsx("div",{className:"PortfolioPage__TableWrapper",children:m.jsx("div",{className:"PortfolioPage__YourPortfolioCard",children:m.jsx("div",{className:"PortfolioPage__YourPortfolioEmpty",children:m.jsx("p",{children:"Connect your wallet to see your tokens"})})})}):e?m.jsx("div",{className:"PortfolioPage__TableWrapper",children:m.jsx(SXe,{columns:I,positions:B,vaultPositionsData:w,isLoading:(()=>{const S=g&&Array.isArray(g)&&g.length>0,v=w&&Array.isArray(w)&&w.length>0;return b&&!S||C&&!v})(),onRowClick:F,defaultSortKey:"size",defaultSortDirection:"desc"})}):m.jsx("div",{className:"PortfolioPage__TableWrapper",children:m.jsx("div",{className:"PortfolioPage__YourPortfolioCard",children:m.jsx("div",{className:"PortfolioPage__YourPortfolioEmpty",children:m.jsx("p",{children:"Connect your wallet to see your positions"})})})})]})]})]})]})},TXe=[{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"getEthBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct UniswapInterfaceMulticall.Call[]",name:"calls",type:"tuple[]"}],name:"multicall",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"uint256",name:"gasUsed",type:"uint256"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct UniswapInterfaceMulticall.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"}],kXe={USDT0:6,"USDâ®0":6,USDT:6,USDC:6,"USDC.E":6,"USDC.e":6},wY=t=>{if(!t||!t.address)return null;const e=t.address===Mn?"0x6969696969696969696969696969696969696969":t.address;if(!e||!e.startsWith("0x")||e.length!==42)return null;const n=kXe[t.symbol||""]??(t.decimals&&t.decimals>0&&t.decimals<=18?t.decimals:18);return new on(Nn.id,e,n,t.symbol,t.name)},NXe=({btoken0:t,btoken1:e,fee:n,inputAmount:i,inputToken:s,minPrice:r,maxPrice:o,initialPrice:a,priceIsToken1PerToken0:c})=>{const{address:l}=mn(),d=M.useMemo(()=>wY(t),[t]),h=M.useMemo(()=>wY(e),[e]),p=M.useMemo(()=>(t==null?void 0:t.address)===Mn,[t]),g=M.useMemo(()=>(e==null?void 0:e.address)===Mn,[e]),b=M.useMemo(()=>p||g,[p,g]),{data:w=0}=WI(t),{data:C=0}=WI(e),E=w,{data:T,isLoading:A,isFetched:k,refetch:R}=Si({address:vt.v3CoreFactory,abi:z5,functionName:"getPool",args:d&&h&&n?[d.address,h.address,n]:void 0,query:{enabled:!!(d&&h&&n)}}),{data:P,isLoading:B,refetch:F}=vf({contracts:[{address:T,abi:Zm,functionName:"slot0"},{address:T,abi:Zm,functionName:"liquidity"}],query:{enabled:!!T&&k}}),z=M.useMemo(()=>k&&!!T&&T!==Mn,[k,T]),K=M.useMemo(()=>
8539{if(!d||!h||!n||!d.address||!h.address)return null;try{return uoe({factoryAddress:vt.v3CoreFactory,tokenA:d,tokenB:h,fee:n})}catch(Mt){return console.error("[usePoolManager] Error computing pool address:",Mt),null}},[d,h,n]),q=M.useMemo(()=>{var Mt,nn,ln,Oi,un,_n,Cs;try{if(z&&P){if(((Mt=P[0])==null?void 0:Mt.status)!=="success"||((nn=P[1])==null?void 0:nn.status)!=="success")return null;const Wn=(Oi=(ln=P[0])==null?void 0:ln.result)==null?void 0:Oi[0],Zn=(_n=(un=P[0])==null?void 0:un.result)==null?void 0:_n[1],fs=(Cs=P[1])==null?void 0:Cs.result;return new to(d,h,n,Wn.toString(),fs.toString(),Zn)}else{if(!d||!h||a<=0n)return null;let Wn,Zn;c?(Wn=a.toString(),Zn=hs("1",d.decimals).toString()):(Wn=BigInt(hs("1",h.decimals)).toString(),Zn=a.toString());const fs=E3(Wn,Zn);if(!fs)return null;const Us=NQe(fs);if(Us==null)return null;const cs=new to(d,h,n,fs.toString(),"0",Us);return console.log("pool",fs.toString(),Us,cs,cs.token0Price.toSignificant()),cs}}catch{return null}},[d,h,n,a,z,P,c]),G=M.useMemo(()=>{if(!q)return 0;try{const Mt=parseFloat(q.token0Price.toSignificant(8));return w>0&&C>0?w/C:Mt}catch(Mt){return console.error("Error calculating pool price",Mt),0}},[q,w,C]),I=M.useMemo(()=>{if(!d||!h||r==="0")return Uy(Yt.MIN_TICK,Ic.MEDIUM);const Mt=d8[n];try{const nn=Math.floor(parseFloat(r)*10**h.decimals),ln=10**d.decimals,Oi=E3(X.BigInt(nn).toString(),X.BigInt(ln).toString()),un=Yt.getTickAtSqrtRatio(Oi);return Uy(un,Mt)}catch{return Uy(Yt.MIN_TICK,Ic.MEDIUM)}},[r,n,d,h]),S=M.useMemo(()=>{if(!d||!h||o==="â")return Uy(Yt.MAX_TICK,Ic.MEDIUM);const Mt=d8[n];try{const nn=Math.floor(parseFloat(o)*10**h.decimals),ln=10**d.decimals,Oi=E3(X.BigInt(nn).toString(),X.BigInt(ln).toString()),un=Yt.getTickAtSqrtRatio(Oi);return Uy(un,Mt)}catch{return Uy(Yt.MAX_TICK,Ic.MEDIUM)}},[o,n,d,h]),v=M.useMemo(()=>{try{if(!q||!I||!S||!i||i===0n)return{amount0:0n,amount1:0n,position:null};if(I>=S)throw new Error("tickLower must be lower thant tickUpper");let Mt;return console.log("inputAmount",i,s),s==="token0"?Mt=ca.fromAmount0({pool:q,tickLower:I,tickUpper:S,amount0:i.toString(),useFullPrecision:!1}):Mt=ca.fromAmount1({pool:q,tickLower:I,tickUpper:S,amount1:i.toString()}),console.log("position",Mt),console.log("amount0",Mt.amount0.toExact(),Mt.amount0.toSignificant()),console.log("amount1",Mt.amount1.toExact(),Mt.amount1.toSignificant()),{amount0:hs(Mt.amount0.toSignificant(),Mt.pool.token0.decimals),amount1:hs(Mt.amount1.toSignificant(),Mt.pool.token1.decimals),position:Mt}}catch{return{amount0:0n,amount1:0n,position:null}}},[q,I,S,i,s]),_=M.useMemo(()=>p?v.amount0:g?v.amount1:0n,[p,g,v]),{data:N=0n,isLoading:$,refetch:U}=Si({address:d==null?void 0:d.address,abi:Ks,functionName:"allowance",args:l?[l,vt.positionManager]:void 0,query:{enabled:!!l&&!!d,refetchInterval:Mt=>Mt.state.data===void 0?!1:2e3}}),j=M.useMemo(()=>N<v.amount0*105n/100n,[N,v]),{data:D=0n,isLoading:O,refetch:H}=Si({address:h==null?void 0:h.address,abi:Ks,functionName:"allowance",args:l?[l,vt.positionManager]:void 0,query:{enabled:!!l&&!!h,refetchInterval:Mt=>Mt.state.data===void 0?!1:2e3}}),J=M.useMemo(()=>D<v.amount1*105n/100n,[D,v]),{data:W}=$r({address:d==null?void 0:d.address,abi:Ks,functionName:"approve",args:[vt.positionManager,xR],chainId:Nn.id,query:{enabled:!!d&&j}}),{data:Z}=$r({address:h==null?void 0:h.address,abi:Ks,functionName:"approve",args:[vt.positionManager,xR],chainId:Nn.id,query:{enabled:!!h&&J}}),{data:Y,writeContract:Q,isPending:ee,error:ie}=Ls(),{data:re,writeContract:oe,isPending:de,error:he}=Ls(),ue=()=>{W!=null&&W.request&&Q(W.request)},be=()=>{Z!=null&&Z.request&&oe(Z.request)},{data:_e,isLoading:Ne,status:pe}=Ts({hash:Y}),{data:Te,isLoading:ve,status:xe}=Ts({hash:re});M.useEffect(()=>{pe==="success"&&_e&&setTimeout(()=>{U()},1e3),xe==="success"&&Te&&setTimeout(()=>{H()},1e3)},[pe,xe,_e,Te,U,H]);const{data:Ye=0n,refetch:ze}=Si({address:"0x6969696969696969696969696969696969696969",abi:Ks,functionName:"balanceOf",args:l?[l]:void 0,query:{enabled:!!l&&b}}),ft=M.useMemo(()=>b?Ye<_:!1,[b,Ye,_]),{data:lt,writeContract:We,isPending:Dt,reset:Fe,error:it}=Ls(),{data:Qt,writeContract:ke,isPending:nt,reset:ht,error:At}=Ls(),{data:zt,writeContract:Ln,isPending:gn,reset:yn,error:bi}=Ls(),{data:En}=$r({address:vt.multicall2,abi:TXe,functionName:"multicall",args:(()=>
8539{if(!d||!h||!n||!q)return;const Mt=BigInt(q.sqrtRatioX96.toString());return[[{target:vt.v3CoreFactory,gasLimit:6000000n,callData:_i({abi:z5,functionName:"createPool",args:[d.address,h.address,n]})},{target:K,gasLimit:100000n,callData:_i({abi:Zm,functionName:"initialize",args:[Mt]})}]]})(),chainId:Nn.id,query:{enabled:!!q}}),{data:yt}=$r({address:vt.positionManager,abi:Eu,functionName:"mint",args:(()=>{if(!q||!S||!I||!v||!l)return;const Mt=BigInt(Math.floor(Date.now()/1e3)+1200);return[{token0:q.token0.address,token1:q.token1.address,fee:n,tickLower:I,tickUpper:S,amount0Desired:v.amount0,amount1Desired:v.amount1,amount0Min:0n,amount1Min:0n,recipient:l,deadline:Mt}]})(),chainId:Nn.id,query:{enabled:!!q&&!!(v!=null&&v.position)&&!!l&&!ft}}),{data:mt}=$r({address:"0x6969696969696969696969696969696969696969",abi:[{name:"deposit",type:"function",inputs:[],outputs:[],stateMutability:"payable"}],functionName:"deposit",value:_,chainId:Nn.id,query:{enabled:ft&&_>0n}}),_t=async()=>{En!=null&&En.request&&We(En.request)},Vt=async()=>{yt!=null&&yt.request&&ke(yt.request)},Yn=()=>{mt!=null&&mt.request&&Ln(mt.request,{onSettled:()=>{ze()}})},{data:Ee,isLoading:$e}=Ts({hash:lt}),{data:Xe,isLoading:ot}=Ts({hash:Qt}),{data:pt,isLoading:Ot}=Ts({hash:zt});return{status:M.useMemo(()=>!d||!h?"idle":A||B?"fetchPool":ee||de?"waitUserApprovement":Ne||ve?"waitApprovementReceipt":Dt||nt||gn?"waitMainUserSign":$e||ot||Ot?"waitMainReceipt":!z&&(Ee==null?void 0:Ee.status)==="success"?v.position?j?"needT0Approve":J?"needT1Approve":ft?"needWrap":"readyMintPosition":"waitAmount":!z&&a<=0n?"waitInitialAmount":v.position?j?"needT0Approve":J?"needT1Approve":ft?"needWrap":z?"readyMintPosition":"readyCreatePosition":"waitAmount",[d,h,A,B,O,$,z,v,a,j,J,ee,de,Ne,ve,Dt,nt,gn,$e,ot,Ot,ft,Ee]),poolAlreadyExist:z,pool:q,poolAddress:T||K,...v,currentPrice:G,marketPriceDisplay:E,approveToken0:ue,approveToken1:be,createPool:_t,mintPosition:Vt,wrap:Yn,reset:()=>{R(),F(),Fe(),ht(),yn()},createPoolTxHash:lt,mintPositionTxHash:Qt,createPoolReceipt:Ee,mintPositionReceipt:Xe,wrapReceipt:pt,createPoolError:it,mintPositionError:At,wrapError:bi,approveToken0TxHash:Y,approveToken1TxHash:re,approveToken0Receipt:_e,approveToken1Receipt:Te,approveToken0Error:ie,approveToken1Error:he,isApprovingToken0:ee,isApprovingToken1:de,waitingT0ApproveReceipt:Ne,waitingT1ApproveReceipt:ve}},RXe=t=>{if(!t||t==="0"||t==="")return 48;const e=t.replace(/[^\d]/g,"").length;if(e<=9){const n=Math.floor((e-1)/3)*7;return Math.max(48-n,34)}else{const n=e-9,i=Math.floor((n-1)/3)+1;return Math.max(34-i*3,16)}},PXe=["0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce".toLowerCase(),"0x779Ded0c9e1022225f8E0630b35a9b54bE713736".toLowerCase(),"0x549943e04f40284185054145c6E4e9568C1D3241".toLowerCase(),"0x1cE0a25D13CE4d52071aE7e02Cf1F6606F4C79d3".toLowerCase()],IXe=["HONEY","USDT","USDT0","USDC","USDC.E","NECT","NECTAR"],DXe="0x0000000000000000000000000000000000000000",OXe="0x6969696969696969696969696969696969696969",MXe=()=>m.jsx("img",{src:"/assets/components/buttonswapnew.png",alt:"Swap",className:"InitialPriceInput__SwapIcon",style:{objectFit:"contain",filter:"brightness(0) invert(1)",display:"block",flexShrink:0,pointerEvents:"none"}}),vY=t=>{var i,s;const e=((i=t.address)==null?void 0:i.toLowerCase())||"",n=((s=t.symbol)==null?void 0:s.toUpperCase())||"";return PXe.includes(e)||IXe.includes(n)||n.includes("USD")||n.includes("STABLE")},CY=t=>{var i,s;const e=((i=t.address)==null?void 0:i.toLowerCase())||"",n=((s=t.symbol)==null?void 0:s.toUpperCase())||"";return e===DXe.toLowerCase()||e===OXe.toLowerCase()||n==="BERA"||n==="WBERA"},xY=t=>{if(t.length===0)return null;if(t.length===1)return t[0];const[e,n]=t,i=vY(e),s=vY(n),r=CY(e),o=CY(n);return i&&!s?e:s&&!i||r&&!o?n:e},Hoe=({tokens:t,onAmountChange:e,onDisplayPriceChange:n,onTokenSelect:i,value:s})=>{var R,P,B,F;const r=M.useRef(null),o=()=>{if(t.length===0)throw new Error("InitialPriceInput requires at least one token");return xY(t)||t[0]},[a,c]=M.useState(o),[l,d]=M.useState(""),[h,p]=M.useState(!1),g=M.useRef(""),b=M.useMemo(()=>RXe(l),[l]),w=M.useMemo(()=>b+8,[b]),C=z=>{let K=z.replace(",",".");K=K.replace(/[^\d.]/g,"");const q=K.split(".");return q.length>2&&(K=q[0]+"."+q.slice(1).join("")),q.length===2&&q[1].length>18&&(K=q[0]+"."+q[1].substring(0,18)),K},E=(z,K)=>{try{if(!z||z===""||z===".")return 0n;const q=z.endsWith(".")?z.slice(0,-1):z;return!q||q===""?0n:hs(q,K)}catch{return 0n}},T=z=>{const K=z.target.value;let q=C(K);const G=g.current||l;if(q===""){d(""),g.current="",e(0n),n&&n("");return}if(q==="0."&&G&&G.startsWith("0.")&&G.length>2&&K.length<G.length){q="",d(""),g.current="",e(0n),n&&n("");return}q==="0"&&G!=="0."&&K.length>=G.length&&(q="0.");const I=E(q,(a==null?void 0:a.decimals)||18);e(I),n&&n(q),d(q),g.current=q},A=z=>
8539{if(c(z),i(z),l&&l!=="0"&&l!==""){const K=E(l,z.decimals||18);e(K)}},k=()=>{if(t.length<2)return;const z=t.find(K=>K.address!==a.address);z&&A(z)};return M.useEffect(()=>{if(t.length>0){const z=xY(t);z&&(!a||z.address.toLowerCase()!==a.address.toLowerCase())&&(c(z),i(z))}},[t.length,(R=t[0])==null?void 0:R.address,(P=t[1])==null?void 0:P.address]),M.useEffect(()=>{if(s>0n&&(!l||l===""||l==="0")&&a){const z=dt(s,a.decimals||18);z!==l&&(d(z),g.current=z)}},[s,a==null?void 0:a.decimals,l,a]),m.jsx("div",{className:"LiquidityInput",children:m.jsx("div",{className:"Inputs",children:m.jsx("div",{className:"LiquidityInput__InputWrapper",children:m.jsxs("div",{className:"Inputs__From From From--idle",children:[m.jsxs("div",{className:"From__AmountsAndChain",children:[m.jsx("div",{className:"From__Amounts",style:{position:"relative",display:"flex",alignItems:"center",width:"100%",overflow:"hidden",minWidth:0},children:m.jsx("input",{ref:r,className:"From__Input",type:"text",value:l,onChange:T,placeholder:"0.0",style:{fontSize:`${b}px`,lineHeight:`${w}px`,height:`${w}px`,verticalAlign:"middle",boxSizing:"border-box",width:"100%",textAlign:"left"}})}),m.jsx("div",{className:"From__LogosAndBalance",children:m.jsx("div",{className:"From__Logos",children:m.jsxs("button",{className:`networkSelector has-token${t.length>1?"":" disabled"}`,onMouseEnter:()=>t.length>1&&p(!0),onMouseLeave:()=>p(!1),onClick:t.length>1?k:void 0,disabled:t.length<=1,style:{cursor:t.length>1?"pointer":"default"},children:[m.jsx("span",{className:"networkSelector__logoWrapper",children:m.jsx("div",{style:{position:"relative",width:"42px",height:"42px",display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsx(Pb,{mode:"wait",children:h&&t.length>1?m.jsx(Wo.div,{initial:{opacity:0,scale:0,rotate:-90},animate:{opacity:1,scale:1,rotate:0},exit:{opacity:0,scale:0,rotate:90},transition:{duration:.3,ease:[.4,0,.2,1]},style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:3},children:m.jsx(MXe,{})},"swap"):m.jsx(Wo.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:[.4,0,.2,1]},style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsx(ws,{logoUri:a.logoUri,symbol:a.symbol,name:a.name,id:a.address,size:40})},"token")})})}),m.jsx("span",{className:"networkSelector__symbol",children:h&&t.length>1&&((B=t.find(z=>z.address!==a.address))==null?void 0:B.symbol)||a.symbol})]})})})]}),m.jsx("div",{className:"From__Details",children:m.jsxs("p",{className:"From__Convertion",children:[a.symbol," = 1 ",((F=t.find(z=>z.address!==a.address))==null?void 0:F.symbol)||""]})})]})})})})};Hoe.displayName="InitialPriceInput";const zx=[{value:"0.01%",fee:100,label:"0.01%",desc:"Best for very stable pairs.",tvl:"0 TVL"},{value:"0.05%",fee:500,label:"0.05%",desc:"Best for stable pairs.",tvl:"0 TVL"},{value:"0.3%",fee:3e3,label:"0.3%",desc:"Best for most pairs.",tvl:"0 TVL"},{value:"1%",fee:1e4,label:"1%",desc:"Best for exotic pairs.",tvl:"0 TVL"}],LXe=` 8540 query GetTopPoolsForCreatePage { 8541 pools(orderBy: "totalValueLockedUSD", orderDirection: "desc", limit: 12) { 8542 items { 8543 id 8544 totalValueLockedUSD 8545 feeTier 8546 token0Ref { 8547 id 8548 symbol 8549 logoUri 8550 } 8551 token1Ref { 8552 id 8553 symbol 8554 logoUri 8555 } 8556 } 8557 } 8558 } 8559`,$Xe=()=>{var lt,We,Dt,Fe,it,Qt,ke,nt,ht,At,zt,Ln,gn,yn,bi,En;const t=Zo(),[e]=xde(),{address:n,isConnected:i}=mn(),[s,r]=M.useState(1),[o,a]=M.useState(!1),[c,l]=M.useState(!1),[d,h]=M.useState(!1),[p,g]=M.useState(!1),[b,w]=M.useState(!1),[C,E]=M.useState(!1),[T,A]=M.useState(!1),[k,R]=M.useState(null),[P,B]=M.useState(null),[F,z]=M.useState(zx[2].fee),[K,q]=M.useState("0"),[G,I]=M.useState("â"),[S,v]=M.useState(0n),[_,N]=M.useState("token0"),[$,U]=M.useState(0n),[j,D]=M.useState(!1),{data:O}=wf({address:n,token:k==null?void 0:k.address,query:{enabled:!!k}}),{data:H}=wf({address:n,token:P==null?void 0:P.address,query:{enabled:!!P}}),{data:J={tvlMap:{},poolExists:{}},isLoading:W}=Zt({queryKey:["feeTVL",k==null?void 0:k.address,P==null?void 0:P.address],enabled:!!k&&!!P,queryFn:async()=>{var tn,rn;if(!k||!P)return{};const yt="https://sub.winnieswap.com",mt=RI(k.address).toLowerCase(),_t=RI(P.address).toLowerCase(),[Vt,Yn]=mt<_t?[mt,_t]:[_t,mt],$e=await fetch(yt,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 8560 query GetPoolTVLByFee($token0: String!, $token1: String!) { 8561 pools( 8562 where: { 8563 token0: $token0, 8564 token1: $token1 8565 } 8566 limit: 50 8567 ) { 8568 items { 8569 feeTier 8570 totalValueLockedUSD 8571 } 8572 } 8573 } 8574 `,variables:{token0:Vt,token1:Yn}})});if(!$e.ok)return console.error("[CreatePosition] TVL GraphQL error status",$e.
8574status),{};const Xe=await $e.json();if(Xe.errors)return console.error("[CreatePosition] TVL GraphQL errors:",Xe.errors),{};const ot=((rn=(tn=Xe.data)==null?void 0:tn.pools)==null?void 0:rn.items)||[],pt={100:0,500:0,3e3:0,1e4:0},Ot={100:!1,500:!1,3e3:!1,1e4:!1};for(const Mt of ot){const nn=Number(Mt.feeTier),ln=typeof Mt.totalValueLockedUSD=="string"?parseFloat(Mt.totalValueLockedUSD):Number(Mt.totalValueLockedUSD||0);!isNaN(nn)&&nn in pt&&(Ot[nn]=!0,isNaN(ln)||(pt[nn]=Math.max(pt[nn]||0,ln)))}return{tvlMap:pt,poolExists:Ot}}}),{data:Z}=Zt({queryKey:["topPoolsForCreatePage"],queryFn:async()=>{var _t,Vt;const yt=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:LXe})});return yt.ok?((Vt=(_t=(await yt.json()).data)==null?void 0:_t.pools)==null?void 0:Vt.items)||[]:null},staleTime:60*1e3,refetchInterval:60*1e3}),Y=NXe({btoken0:k,btoken1:P,fee:F,inputToken:_,inputAmount:S,minPrice:K,maxPrice:G,initialPrice:$,priceIsToken1PerToken0:j}),{insufficient0:Q,insufficient1:ee}=M.useMemo(()=>({insufficient0:O&&Y.amount0>O.value,insufficient1:H&&Y.amount1>H.value}),[O,H,Y]);M.useEffect(()=>{var Yn,Ee;const yt=Y.status==="waitMainUserSign"||Y.status==="waitMainReceipt",mt=((Yn=Y.createPoolReceipt)==null?void 0:Yn.status)==="success"||((Ee=Y.mintPositionReceipt)==null?void 0:Ee.status)==="success",_t=!!(Y.createPoolTxHash||Y.mintPositionTxHash),Vt=Y.createPoolError||Y.mintPositionError;if(Vt){const $e=Vt.message||Vt.toString()||"";if($e.includes("User rejected")||$e.includes("user rejected")||$e.includes("User denied")||$e.includes("user denied")||$e.includes("rejected")){console.log("[CreatePoolPage] Minting transaction cancelled by user"),l(!0),h(!1),setTimeout(()=>{l(!1)},5e3);return}}yt?(h(!0),l(!1)):d&&!mt&&!_t?(l(!0),h(!1),setTimeout(()=>{l(!1)},5e3)):(mt||_t)&&(h(!1),l(!1))},[Y.status,Y.createPoolReceipt,Y.mintPositionReceipt,Y.createPoolTxHash,Y.mintPositionTxHash,Y.createPoolError,Y.mintPositionError,d]),M.useEffect(()=>{var Yn;const yt=Y.status==="waitUserApprovement"&&Y.isApprovingToken0||Y.status==="waitApprovementReceipt"&&Y.waitingT0ApproveReceipt,mt=((Yn=Y.approveToken0Receipt)==null?void 0:Yn.status)==="success",_t=!!Y.approveToken0TxHash,Vt=Y.approveToken0Error;if(Vt){const Ee=Vt.message||Vt.toString()||"";if(Ee.includes("User rejected")||Ee.includes("user rejected")||Ee.includes("User denied")||Ee.includes("user denied")||Ee.includes("rejected")){console.log("[CreatePoolPage] Approval token0 transaction cancelled by user"),g(!0),w(!1),setTimeout(()=>{g(!1)},5e3);return}}yt?(w(!0),g(!1)):b&&!mt&&!_t?(g(!0),w(!1),setTimeout(()=>{g(!1)},5e3)):(mt||_t)&&(w(!1),g(!1))},[Y.status,Y.isApprovingToken0,Y.waitingT0ApproveReceipt,Y.approveToken0Receipt,Y.approveToken0TxHash,Y.approveToken0Error,b]),M.useEffect(()=>{var Yn;const yt=Y.status==="waitUserApprovement"&&Y.isApprovingToken1||Y.status==="waitApprovementReceipt"&&Y.waitingT1ApproveReceipt,mt=((Yn=Y.approveToken1Receipt)==null?void 0:Yn.status)==="success",_t=!!Y.approveToken1TxHash,Vt=Y.approveToken1Error;if(Vt){const Ee=Vt.message||Vt.toString()||"";if(Ee.includes("User rejected")||Ee.includes("user rejected")||Ee.includes("User denied")||Ee.includes("user denied")||Ee.includes("rejected")){console.log("[CreatePoolPage] Approval token1 transaction cancelled by user"),E(!0),A(!1),setTimeout(()=>{E(!1)},5e3);return}}yt?(A(!0),E(!1)):T&&!mt&&!_t?(E(!0),A(!1),setTimeout(()=>{E(!1)},5e3)):(mt||_t)&&(A(!1),E(!1))},[Y.status,Y.isApprovingToken1,Y.waitingT1ApproveReceipt,Y.approveToken1Receipt,Y.approveToken1TxHash,Y.approveToken1Error,T]);const ie=M.useMemo(()=>{var yt,mt;if(((yt=Y.mintPositionReceipt)==null?void 0:yt.status)==="success"||((mt=Y.createPoolReceipt)==null?void 0:mt.status)==="success")return{text:"View your position",action:()=>{Y.poolAddress?t(`/pools/${Y.poolAddress}`):t("/liquidity")},disabled:!1,loading:!1};if(Y.status==="idle")return{text:"Select tokens",action:()=>{},disabled:!0,loading:!1};if(Y.status==="fetchAllowance")return{text:"Fetching tokens allowance",action:()=>{},disabled:!0,loading:!0};if(Y.status==="waitAmount")return{text:"Wait for amounts",action:()=>{},disabled:!0,loading:!1};if(Y.status==="waitInitialAmount")return{text:"Wait initial Amount",action:()=>{},disabled:!0,loading:!1};if(Q)return{text:`Insufficient ${k==null?void 0:k.symbol} balance`,action:()=>{},disabled:!0,loading:!1};if(ee)return{text:`Insufficient ${P==null?void 0:P.symbol} balance`,action:()=>{},disabled:!0,loading:!1};if(Y.status==="needT0Approve")return{text:`Approve ${k==null?void 0:k.symbol}`,action:Y==null?void 0:Y.approveToken0,disabled:!1,loading:!1};if(Y.status==="needT1Approve")return{text:`Approve ${P==null?void 0:P.symbol}`,action:Y==null?void 0:Y.approveToken1,disabled:!1,loading:!1};if(Y.status==="needWrap")return{text:"Wrap Bera",action:Y==null?void 0:Y.wrap,disabled:!1,loading:!1};if(Y.status==="waitUserApprovement")return{action:()=>{},disabled:!0,loading:!0};if(Y.status==="waitApprovementReceipt")return{action:()=>{},disabled:!0,loading:!0};if(Y.status==="waitMainUserSign")return{action:()=>{},disabled:!0,loading:!0};if(Y.status==="waitMainReceipt")return{action:()=>{},disabled:!0,loading:!0};if(Y.status==="readyMintPosition")return{text:"Mint position",action:Y==null?void 0:Y.mintPosition,disabled:!1,loading:!1};if(Y.status==="readyCreatePosition")return{text:"Create position",action:Y==null?void 0:Y.createPool,disabled:!1,loading:!1}},[Y,Q,ee,k,P]),re=M.useMemo(()=>s===2?!0:Y?["idle","fetchPool"].includes(Y.status):!1,[s,Y]),oe=M.useCallback(yt=>{const mt={...yt};if(mt.address===Mn&&(mt.address="0x6969696969696969696969696969696969696969"),P){if(P.symbol===mt.symbol){R(mt),B(null);return}if(mt.address.toLowerCase()>P.address.toLowerCase()){R(P),B(mt);return}}R(mt)},[P]),de=M.useCallback(yt=>{const mt={...yt};if(mt.address===Mn&&(mt.address="0x6969696969696969696969696969696969696969"),k){if(k.symbol===mt.symbol){B(mt),R(null);return}if(mt.address.toLowerCase()<k.address.toLowerCase()){console.log("plus petite !!!"),B(k),R(mt);return}}B(mt)},[k]),he=18,ue=yt=>{let mt=yt.target.value.replace(/[^\d.,]/g,"");if(mt=mt.replace(",","."),mt.includes(".")){const _t=mt.split(".");_t[1]&&_t[1].length>he&&(mt=_t[0]+"."+_t[1].substring(0,he))}q(mt)},be=yt=>{let mt=yt.target.value.replace(/[^\d.,]/g,"");if(mt=mt.replace(",","."),mt.includes(".")){const _t=mt.split(".");_t[1]&&_t[1].length>he&&(mt=_t[0]+"."+_t[1].substring(0,he))}I(mt)},_e=yt=>{v(yt),N("token0")},Ne=yt=>{v(yt),N("token1")},{data:pe,isLoading:Te}=h4(),ve=e.get("token0"),xe=e.get("token1"),Ye=` 8575 query GetTokenByAddress($id: String!) {
8576 token(id: $id) { 8577 id 8578 symbol 8579 name 8580 decimals 8581 logoUri 8582 tokenDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8583 items { 8584 priceUSD 8585 } 8586 } 8587 } 8588 } 8589 `,{data:ze}=Zt({queryKey:["token-by-address",ve],queryFn:async()=>{var _t;return ve?(_t=(await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Ye,variables:{id:ve.toLowerCase()}})})).json()).data)==null?void 0:_t.token:null},enabled:!!ve&&!k,staleTime:300*1e3}),{data:ft}=Zt({queryKey:["token-by-address",xe],queryFn:async()=>{var _t;return xe?(_t=(await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Ye,variables:{id:xe.toLowerCase()}})})).json()).data)==null?void 0:_t.token:null},enabled:!!xe&&!P,staleTime:300*1e3});return M.useEffect(()=>{var mt,_t,Vt,Yn,Ee,$e,Xe,ot,pt,Ot,tn,rn;const yt=e.get("fee");if(pe&&ve&&xe){const Mt=pe.find(ln=>ln.address.toLowerCase()===ve.toLowerCase()),nn=pe.find(ln=>ln.address.toLowerCase()===xe.toLowerCase());if(Mt&&nn)(!k||k.address.toLowerCase()!==ve.toLowerCase())&&oe(Mt),(!P||P.address.toLowerCase()!==xe.toLowerCase())&&de(nn);else{if((!k||k.address.toLowerCase()!==ve.toLowerCase())&&ze){const ln={address:ze.id,symbol:ze.symbol,name:ze.name||ze.symbol,decimals:ze.decimals||18,logoUri:ze.logoUri||null,totalSupply:"0",lastPrice:parseFloat(((Vt=(_t=(mt=ze.tokenDayData)==null?void 0:mt.items)==null?void 0:_t[0])==null?void 0:Vt.priceUSD)||"0"),status:"IN_POOL",priceUSD:parseFloat((($e=(Ee=(Yn=ze.tokenDayData)==null?void 0:Yn.items)==null?void 0:Ee[0])==null?void 0:$e.priceUSD)||"0")};oe(ln)}if((!P||P.address.toLowerCase()!==xe.toLowerCase())&&ft){const ln={address:ft.id,symbol:ft.symbol,name:ft.name||ft.symbol,decimals:ft.decimals||18,logoUri:ft.logoUri||null,totalSupply:"0",lastPrice:parseFloat(((pt=(ot=(Xe=ft.tokenDayData)==null?void 0:Xe.items)==null?void 0:ot[0])==null?void 0:pt.priceUSD)||"0"),status:"IN_POOL",priceUSD:parseFloat(((rn=(tn=(Ot=ft.tokenDayData)==null?void 0:Ot.items)==null?void 0:tn[0])==null?void 0:rn.priceUSD)||"0")};de(ln)}}}else if(pe&&!ve&&!xe&&!k){const Mt=pe.find(nn=>nn.address.toLowerCase()==="0x0000000000000000000000000000000000000000");Mt&&oe(Mt)}if(yt&&!isNaN(Number(yt))){const Mt=Number(yt);zx.find(ln=>ln.fee===Mt)&&z(Mt)}},[pe,e,k,P,ve,xe,ze,ft,oe,de]),m.jsxs(Uu,{className:`PoolPage PoolPage--create${s===2?" PoolPage--step2":""}`,children:[Array.isArray(Z)&&Z.length>0&&m.jsx("div",{className:"Pool__Banner",children:m.jsx(qd,{pools:Z})}),m.jsxs("div",{className:"PoolPage__CreateLayout",children:[m.jsxs("div",{className:"PoolPage__CreateHeader",children:[m.jsx("div",{className:"PoolPage__Header",style:{marginBottom:12},children:m.jsx("h2",{className:"PoolPage__Title",children:"New position"})}),m.jsxs("div",{className:"PoolPage__Timeline",children:[m.jsxs("div",{className:`PoolPage__Step${s===1?" PoolPage__Step--active":""}${s===2?" PoolPage__Step--clickable":""}`,onClick:s===2?()=>r(1):void 0,onMouseEnter:s===2?()=>a(!0):void 0,onMouseLeave:s===2?()=>a(!1):void 0,children:[m.jsx("div",{className:"PoolPage__StepNum",children:s===2?"â":"1"}),m.jsx("div",{className:"PoolPage__StepLabel",children:s===2&&o?"Back to Step 1":"Select token pair and fees"})]}),m.jsxs("div",{className:`PoolPage__Step${s===2?" PoolPage__Step--active":" PoolPage__Step--next"}`,children:[m.jsx("div",{className:"PoolPage__StepNum",children:"2"}),m.jsx("div",{className:"PoolPage__StepLabel",children:"Set price range and deposit amounts"})]})]})]}),m.jsxs("div",{className:"PoolPage__CreateContent",children:[s===1&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"PoolPage__CreateSection",children:[m.jsx("h3",{className:"PoolPage__CreateSectionTitle",children:"Select pair"}),m.jsx("p",{className:"PoolPage__CreateSectionDesc",children:"Choose the tokens you want to provide liquidity for. You can select tokens on all supported networks."}),m.jsx("div",{className:"PoolPage__TokenSelectors",children:Te?m.jsxs(m.Fragment,{children:[m.jsx(Ke,{width:140,height:40,borderRadius:999}),m.jsx("span",{className:"PoolPage__TokenSeparator",children:"/"}),m.jsx(Ke,{width:140,height:40,borderRadius:999})]}):m.jsxs(m.Fragment,{children:[m.jsx(t8,{preSelected:k,onSelect:oe,showAllTokens:!0}),m.jsx("span",{className:"PoolPage__TokenSeparator",children:"/"}),m.jsx(t8,{preSelected:P,onSelect:de,showAllTokens:!0})]})})]}),m.jsxs("div",{className:"PoolPage__CreateSection",children:[m.jsx("h3",{className:"PoolPage__CreateSectionTitle",children:"Fee tier"}),m.jsx("p",{className:"PoolPage__CreateSectionDesc",children:"The amount earned providing liquidity. Choose an amount that suits your risk tolerance and strategy."}),m.jsx("div",{className:"PoolPage__FeeTiers",children:W?zx.map(yt=>m.jsxs("div",{className:"PoolPage__FeeTierBtn",style:{cursor:"default",pointerEvents:"none"},children:[m.jsx(Ke,{width:"60px",height:"20px",borderRadius:"4px",style:{marginBottom:"4px"}}),m.jsx(Ke,{width:"120px",height:"14px",borderRadius:"4px",style:{marginBottom:"4px"}}),m.jsx(Ke,{width:"80px",height:"16px",borderRadius:"4px",style:{marginTop:"auto"}})]},yt.value)):zx.map(yt=>m.jsxs("button",{className:`PoolPage__FeeTierBtn${F===yt.fee?" active":""}`,onClick:()=>z(yt.fee),type:"button",children:[m.jsx("div",{className:"PoolPage__FeeTierLabel",children:yt.label}),m.jsx("div",{className:"PoolPage__FeeTierDesc",children:yt.desc}),m.jsx("div",{className:"PoolPage__FeeTierTVL",children:(()=>{var Vt,Yn;const mt=((Vt=J.tvlMap)==null?void 0:Vt[yt.fee])||0;return(((Yn=J.poolExists)==null?void 0:Yn[yt.fee])||!1)&&mt===0?"<$0.01 TVL":`$${An(mt)} TVL`})()})]},yt.value))})]}),!Y.poolAlreadyExist&&m.jsxs("div",{className:"PoolPage__CreateSection",children:[m.jsx("h3",{className:"PoolPage__CreateSectionTitle",children:"Creating new pool"}),m.jsx("p",{className:"PoolPage__CreateSectionDesc",children:"Your selections will create a new liquidity pool which may result in lower initial liquidity and increased volatility. Consider adding to an existing pool to minimize these risks."})]}),m.jsx("div",{className:"PoolPage__CreateFooter",children:m.jsx("button",{className:`btn btn--large PoolPage__ContinueBtn ${re?"btn__disabled":"btn__main"}`,type:"button",disabled:re,onClick:()=>r(2),children:"Continue"})})]}),s===2&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"PoolPage__Header",children:m.jsx("div",{style:{display:"flex",alignItems:"center",gap:16},children:k&&P&&m.jsxs(m.Fragment,{children:[m.jsx(If,{token0:{id:k.address,address:k.address,symbol:k.symbol,logoUri:k.logoUri||void 0},token1:{id:P.address,address:P.address,symbol:P.symbol,logoUri:P.logoUri||void 0},size:40,gap:3,borderWidth:2,separatorWidth:2}),m.jsxs("div",{className:"PoolPage__PairMeta",children:[m.jsxs("span",{className:"PoolPage__PairName",children:[k.symbol," / ",P.symbol]}),m.jsxs("span",{className:"PoolPage__PairFee",children:[F/1e4,"%"]})]})]})})}),m.jsxs("div",{className:"PoolPage__CreateTwoColumns",children:[m.jsxs("div",{className:"PoolPage__CreateColumn PoolPage__CreateColumn--left",children:[!Y.poolAlreadyExist&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"PoolPage__CreateSection",children:[m.jsx("h3",{className:"PoolPage__CreateSectionTitle",children:"Creating new pool"}),m.jsx("p",{className:"PoolPage__CreateSectionDesc",children:"Your selections will create a new liquidity pool which may result in lower initial liquidity and increased volatility. Consider adding to an existing pool to minimize these risks."})]}),m.jsxs("div",{className:"PoolPage__CreateSection",children:[m.jsx("h3",{className:"PoolPage__CreateSectionTitle",children:"Set initial price"}),m.jsx("p",{className:"PoolPage__CreateSectionDesc",children:"When creating a new pool, you must set the starting exchange rate for both tokens. This rate will reflect the initial market price."}),m.jsx("div",{className:"PoolPage__LiquidityInputs",children:(Y==null?void 0:Y.status)==="fetchPool"?m.jsx("div",{className:"PoolPage__LiquidityInput",style:{padding:"16px"},children:m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[m.jsx(Ke,{width:"80px",height:"14px",borderRadius:"4px"}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"12px"},children:[m.jsx(Ke,{width:"60%",height:"48px",borderRadius:"14px"}),m.jsx(Ke,{width:120,height:52,borderRadius:999})]}),m.jsx(Ke,{width:"100px",height:"12px",borderRadius:"4px"})]})}):m.jsx("div",{className:"PoolPage__LiquidityInput",children:m.jsx(Hoe,{tokens:[k,P],onAmountChange:U,onTokenSelect:yt=>{D(yt.address.toLowerCase()===P.address.toLowerCase())},value:$})})})]})]}),m.jsxs("div",{className:"PoolPage__CreateSection",children:[m.jsx("h3",{className:"PoolPage__CreateSectionTitle",children:"Set price range"}),m.jsx("p",{className:"PoolPage__CreateSectionDesc",children:"Providing full range liquidity guarantees market participation at all possible prices, which offers simplicity but exposes you to higher impermanent loss potential."}),m.jsxs("div",{className:"PoolPage__PriceRange",children:[m.jsxs("div",{className:"PoolPage__PriceRow",children:[m.jsx("span",{className:"PoolPage__Price
8589Label",children:"Market price:"}),Y!=null&&Y.currentPrice?m.jsxs("span",{className:"PoolPage__PriceValue",children:[`${Y.currentPrice.toLocaleString(void 0,{maximumFractionDigits:6,minimumFractionDigits:0,useGrouping:!1}).replace(/\.?0+$/,"")} ${(P==null?void 0:P.symbol)||""} = 1 ${(k==null?void 0:k.symbol)||""}`,(Y==null?void 0:Y.marketPriceDisplay)&&m.jsxs("span",{style:{color:"#888",marginLeft:8},children:["$",Y.marketPriceDisplay.toLocaleString(void 0,{maximumFractionDigits:2,minimumFractionDigits:0})]})]}):m.jsx("span",{className:"PoolPage__PriceValue",style:{color:"#888"},children:"Set initial price first"})]}),m.jsxs("div",{className:"PoolPage__PriceRow",children:[m.jsx("span",{className:"PoolPage__PriceLabel",children:"Min price"}),m.jsx("input",{className:"PoolPage__PriceInput",type:"text",value:K,onChange:ue}),m.jsxs("span",{className:"PoolPage__PriceUnit",children:[P==null?void 0:P.symbol," = 1 ",k==null?void 0:k.symbol]})]}),m.jsxs("div",{className:"PoolPage__PriceRow",children:[m.jsx("span",{className:"PoolPage__PriceLabel",children:"Max price"}),m.jsx("input",{className:"PoolPage__PriceInput",type:"text",value:G,onChange:be}),m.jsxs("span",{className:"PoolPage__PriceUnit",children:[P==null?void 0:P.symbol," = 1 ",k==null?void 0:k.symbol]})]})]})]})]}),m.jsxs("div",{className:"PoolPage__CreateColumn PoolPage__CreateColumn--right",children:[m.jsx("div",{className:"PoolPage__DepositTabWrapper",children:m.jsx(k2,{style:{justifyContent:"flex-start"},segments:[{key:"deposit",label:"Deposit initial liquidity"}],selectedKey:"deposit",onChange:()=>{}})}),m.jsx("div",{className:"PoolPage__DoubleDeposit",children:(Y==null?void 0:Y.status)==="fetchPool"?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"PoolPage__LiquidityInput",style:{padding:"16px"},children:m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[m.jsx(Ke,{width:"80px",height:"14px",borderRadius:"4px"}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"12px"},children:[m.jsx(Ke,{width:"60%",height:"48px",borderRadius:"14px"}),m.jsx(Ke,{width:120,height:52,borderRadius:999})]}),m.jsx(Ke,{width:"100px",height:"12px",borderRadius:"4px"})]})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0"},children:m.jsx(Ke,{width:28,height:28,borderRadius:14})}),m.jsx("div",{className:"PoolPage__LiquidityInput",style:{padding:"16px"},children:m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[m.jsx(Ke,{width:"80px",height:"14px",borderRadius:"4px"}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"12px"},children:[m.jsx(Ke,{width:"60%",height:"48px",borderRadius:"14px"}),m.jsx(Ke,{width:120,height:52,borderRadius:999})]}),m.jsx(Ke,{width:"100px",height:"12px",borderRadius:"4px"})]})})]}):m.jsxs(m.Fragment,{children:[m.jsx(pK,{selectedToken:k,onAmountChange:_e,value:Y.amount0,isOverBalance:Q||!1,disabled:!1,disableTokenSelector:!0}),m.jsx(DI,{onClick:()=>{},isActive:!1,mode:"deposit"}),m.jsx(pK,{selectedToken:P,onAmountChange:Ne,value:Y.amount1,isOverBalance:ee||!1,disabled:!1,disableTokenSelector:!0})]})}),m.jsx("div",{className:"PoolPage__CreateFooter",children:i?m.jsx("button",{className:`btn btn--large PoolPage__PrimaryBtn ${ie!=null&&ie.disabled?"btn__disabled":"btn__main"}`,type:"button",disabled:ie==null?void 0:ie.disabled,onClick:ie==null?void 0:ie.action,children:ie!=null&&ie.loading?m.jsx(u4,{size:"small",color:"#171410"}):ie==null?void 0:ie.text}):m.jsx(QM,{size:"large",variant:"main"})})]})]})]})]})]}),m.jsx(In,{isVisible:Y.status==="waitUserApprovement"&&Y.isApprovingToken0||Y.status==="waitApprovementReceipt"&&Y.waitingT0ApproveReceipt||!!Y.approveToken0TxHash&&((lt=Y.approveToken0Receipt)==null?void 0:lt.status)!=="success"&&((We=Y.approveToken0Receipt)==null?void 0:We.status)!=="reverted",message:`Approval pending for ${(k==null?void 0:k.symbol)||"token"}`,type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:((Dt=Y.approveToken0Receipt)==null?void 0:Dt.status)==="success"&&!!Y.approveToken0TxHash,message:`Approval confirmed for ${(k==null?void 0:k.symbol)||"token"}`,type:"success",link:Y.approveToken0TxHash?{href:`https://berascan.com/tx/${Y.approveToken0TxHash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:p||((Fe=Y.approveToken0Receipt)==null?void 0:Fe.status)==="reverted"&&!!Y.approveToken0TxHash,message:`Approval cancelled for ${(k==null?void 0:k.symbol)||"token"}`,type:"cancelled",duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:Y.status==="waitUserApprovement"&&Y.isApprovingToken1||Y.status==="waitApprovementReceipt"&&Y.waitingT1ApproveReceipt||!!Y.approveToken1TxHash&&((it=Y.approveToken1Receipt)==null?void 0:it.status)!=="success"&&((Qt=Y.approveToken1Receipt)==null?void 0:Qt.status)!=="reverted",message:`Approval pending for ${(P==null?void 0:P.symbol)||"token"}`,type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:((ke=Y.approveToken1Receipt)==null?void 0:ke.status)==="success"&&!!Y.approveToken1TxHash,message:`Approval confirmed for ${(P==null?void 0:P.symbol)||"token"}`,type:"success",link:Y.approveToken1TxHash?{href:`https://berascan.com/tx/${Y.approveToken1TxHash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:C||((nt=Y.approveToken1Receipt)==null?void 0:nt.status)==="reverted"&&!!Y.approveToken1TxHash,message:`Approval cancelled for ${(P==null?void 0:P.symbol)||"token"}`,type:"cancelled",duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:(Y.status==="waitMainUserSign"||Y.status==="waitMainReceipt")&&!c&&((ht=Y.createPoolReceipt)==null?void 0:ht.status)!=="success"&&((At=Y.mintPositionReceipt)==null?void 0:At.status)!=="success"&&((zt=Y.createPoolReceipt)==null?void 0:zt.status)!=="reverted"&&((Ln=Y.mintPositionReceipt)==null?void 0:Ln.status)!=="reverted",message:"Mint pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:(((gn=Y.createPoolReceipt)==null?void 0:gn.status)==="success"||((yn=Y.mintPositionReceipt)==null?void 0:yn.status)==="success")&&!c,message:"Mint confirmed",type:"success",position:"top-right",link:Y.mintPositionTxHash||Y.createPoolTxHash?{href:`https://berascan.com/tx/${Y.mintPositionTxHash||Y.createPoolTxHash}`,text:"View transaction"}:void 0,duration:3e3}),m.jsx(In,{isVisible:c||((bi=Y.createPoolReceipt)==null?void 0:bi.status)==="reverted"||((En=Y.mintPositionReceipt)==null?void 0:En.status)==="reverted",message:"Mint cancelled",type:"cancelled",duration:3e3,position:"top-right"})]})},CN=(t,e)=>e?e.replace(".bera",".ð»âï¸"):`${t.slice(0,6)}...${t.slice(-4)}`,UXe=({limit:t,showTitle:e=!0,contextMode:n=!1,searchValue:i=""})=>{var U;const{address:s}=mn(),r=t&&t>0?t:50,[o,a]=M.useState(1),{totalHoldings:c}=EL(),{data:l}=KI(n&&s?s.toLowerCase():void 0),d=M.useMemo(()=>
8589{if(!n)return null;const j=[1,2,3];if(l!=null&&l.rank){const D=l.rank;D>3&&(D-2>3&&j.push(D-2),D-1>3&&j.push(D-1),j.push(D)),j.push(D+1,D+2)}return j.filter((D,O,H)=>H.indexOf(D)===O).sort((D,O)=>D-O)},[n,l==null?void 0:l.rank]),{data:h,isLoading:p}=Zt({queryKey:["leaderboard-context",d==null?void 0:d.join(",")],queryFn:async()=>{if(!d||d.length===0)return[];const D="https://api.winnieswap.com".replace(/\/$/,""),O=[],H=Math.max(...d),J=100,W=Math.ceil(H/J),Z=Array.from({length:W},(oe,de)=>{const he=de+1,ue=new URLSearchParams({page:he.toString(),limit:J.toString()}),be=`${D}/leaderboard?${ue.toString()}`;return fetch(be,{method:"GET",headers:{"Content-Type":"application/json"}}).then(_e=>{if(!_e.ok)throw new Error(`Failed to fetch leaderboard page ${he}: ${_e.status}`);return _e.json()})});(await Promise.all(Z)).forEach(oe=>{O.push(...oe.entries)});const Q=O.filter(oe=>d.includes(oe.rank)),ee=Q.filter(oe=>oe.rank<=3).sort((oe,de)=>oe.rank-de.rank);if(!l)return ee;const ie=Q.find(oe=>oe.wallet.toLowerCase()===l.wallet.toLowerCase()),re=[];if(ie&&ie.rank>3){const oe=Q.filter(he=>he.rank<ie.rank&&he.rank>3).sort((he,ue)=>ue.rank-he.rank).slice(0,2).reverse();re.push(...oe),re.push(ie);const de=Q.filter(he=>he.rank>ie.rank).sort((he,ue)=>he.rank-ue.rank).slice(0,2);re.push(...de)}else if(ie&&ie.rank<=3){const oe=Q.filter(de=>de.rank>3).sort((de,he)=>de.rank-he.rank).slice(0,2);re.push(...oe)}return[...ee,...re]},enabled:n&&d!==null&&d.length>0&&d.length>=3,staleTime:300*1e3,gcTime:3e5,refetchOnWindowFocus:!1,refetchInterval:30*1e3,refetchIntervalInBackground:!0}),[g,b]=M.useState({key:"rank",direction:"asc"}),{data:w,isLoading:C,isFetchingNextPage:E,hasNextPage:T,fetchNextPage:A,error:k}=nS({queryKey:["leaderboard-list-infinite",r.toString()],queryFn:async({pageParam:j=1})=>{const O="https://api.winnieswap.com".replace(/\/$/,""),H=typeof j=="number"?j:1,J=new URLSearchParams({page:H.toString(),limit:r.toString()}),W=`${O}/leaderboard?${J.toString()}`;try{const Z=await fetch(W,{method:"GET",headers:{"Content-Type":"application/json"}});if(!Z.ok)throw new Error(`Failed to fetch leaderboard: ${Z.status} ${Z.statusText}`);return Z.json()}catch(Z){const Y=(Z==null?void 0:Z.message)||String(Z);if(Z instanceof TypeError||Y.includes("fetch")||Y.includes("ERR_CONNECTION_REFUSED")||Y.includes("Failed to fetch")||Y.includes("NetworkError")){const Q=new Error("Backend server is not accessible. Please check if the server is running.");throw Q.isConnectionError=!0,Q}throw Z}},getNextPageParam:j=>{const D=j.page||1,O=Math.ceil((j.total||0)/r);return D<O?D+1:void 0},initialPageParam:1,staleTime:300*1e3,gcTime:3e5,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchInterval:!1,retry:(j,D)=>{const O=(D==null?void 0:D.message)||"";return O.includes("not accessible")||O.includes("ERR_CONNECTION_REFUSED")||O.includes("Failed to fetch")||D!=null&&D.isConnectionError?!1:j<1},retryDelay:1e3,enabled:!n}),R=i&&i.trim().length>=42&&i.trim().startsWith("0x"),P=R?i.trim().toLowerCase():void 0,{data:B,isLoading:F}=KI(P),z=M.useMemo(()=>{if(n)return h||[];if(R)return F?[]:B==null?[]:[{rank:B.rank,wallet:B.wallet,beraname:B.beraname,swapVolumeUSD:B.swapVolumeUSD??0,liquidityDepositVolumeUSD:B.liquidityDepositVolumeUSD??0,totalVolumeUSD:B.totalVolumeUSD,currentLiquidityUSD:B.currentLiquidityUSD,positionsCount:B.positionsCount,v3PoolsLiquidityUSD:B.v3PoolsLiquidityUSD??0,stickyVaultsLiquidityUSD:B.stickyVaultsLiquidityUSD??0,autoWinVaultsLiquidityUSD:B.autoWinVaultsLiquidityUSD??0,volumePoints:B.volumePoints,liquidityPoints:B.liquidityPoints,referralPoints:B.referralPoints,totalPoints:B.totalPoints,rankChange:B.rankChange,lastUpdatedAt:B.lastUpdatedAt??new Date().toISOString()}];if(!(w!=null&&w.pages))return[];let j=w.pages.flatMap((D,O)=>D.entries||[]);if(i&&i.trim().length>0&&!R){const D=i.toLowerCase().trim();j=j.filter(O=>O.wallet.toLowerCase().includes(D)||CN(O.wallet,O.beraname).toLowerCase().includes(D))}if(g.key==="rank"&&g.direction==="asc"){const D=j.filter(H=>H.rank>0),O=j.filter(H=>H.rank===0);j=[...D,...O]}else j=[...j].sort((D,O)=>{const H=D.rank===0||D.totalPoints===0,J=O.rank===0||O.totalPoints===0;if(H&&J)return D.totalPoints>O.totalPoints?-1:D.totalPoints<O.totalPoints?1:0;if(H)return 1;if(J)return-1;let W=0,Z=0;const Y=g.key,Q=g.direction;switch(Y){case"rank":W=D.rank===0?Number.MAX_SAFE_INTEGER:D.rank||0,Z=O.rank===0?Number.MAX_SAFE_INTEGER:O.rank||0;break;case"swapVolumeUSD":W=D.swapVolumeUSD??0,Z=O.swapVolumeUSD??0;break;case"totalVolumeUSD":W=D.totalVolumeUSD??0,Z=O.totalVolumeUSD??0;break;case"volumePoints":W=D.volumePoints??0,Z=O.volumePoints??0;break;case"positionsCount":W=D.positionsCount??0,Z=O.positionsCount??0;break;case"currentLiquidityUSD":W=D.currentLiquidityUSD??0,Z=O.currentLiquidityUSD??0;break;case"liquidityPoints":W=D.liquidityPoints??0,Z=O.liquidityPoints??0;break;case"referralPoints":W=D.referralPoints??0,Z=O.referralPoints??0;break;case"totalPoints":W=D.totalPoints??0,Z=O.totalPoints??0;break;case"rankChange":W=D.rankChange??0,Z=O.rankChange??0;break;default:W=D.totalPoints??0,Z=O.totalPoints??0}const ee=typeof W=="number"?W:parseFloat(String(W))||0,ie=typeof Z=="number"?Z:parseFloat(String(Z))||0;return Q==="asc"?ee-ie:ie-ee});return t?j.slice(0,t):j},[n,h,w,g,t,i,R,B,F]),K=M.useMemo(()=>
8589{if(n||t||R)return z;if(w!=null&&w.pages&&w.pages.length>=o&&g.key==="rank"&&g.direction==="asc"){const H=w.pages[o-1];if(H!=null&&H.entries&&H.entries.length>0)return H.entries}const j=(o-1)*r,D=j+r;return j>=z.length?[]:z.slice(j,D)},[z,o,r,n,t,w==null?void 0:w.pages,T,E,g.key,g.direction]),q=M.useMemo(()=>{var D;return n||t||!((D=w==null?void 0:w.pages)!=null&&D[0])||i&&i.trim().length>0||R?z.length:w.pages[0].total||z.length},[w,n,t,z.length,i,R]),G=Math.ceil(q/r);M.useEffect(()=>{a(1)},[i,g.key,g.direction]),M.useEffect(()=>{if(n||t||R||!(w!=null&&w.pages))return;const j=g.key!=="rank"||g.direction!=="asc";if(i&&i.trim().length>0){const J=i.toLowerCase().trim();!w.pages.some(Z=>{var Y;return(Y=Z.entries)==null?void 0:Y.some(Q=>Q.wallet.toLowerCase().includes(J)||CN(Q.wallet,Q.beraname).toLowerCase().includes(J))})&&T&&!E&&A();return}if(j&&!E){const J=w.pages[0];if(!J)return;const W=J.total||0,Z=Math.ceil(W/r),Y=w.pages.length;if(Y>=Z)return;(async()=>{let ee=Y+1;for(;ee<=Z&&!E;)try{await A(),ee++,ee<=Z&&await new Promise(ie=>setTimeout(ie,100))}catch(ie){console.error("Failed to load next page:",ie);break}})();return}const O=o,H=w.pages.length;O>H&&T&&!E&&(async()=>{let W=O-H;for(;W>0&&T&&!E;)try{await A(),W--,W>0&&await new Promise(Z=>setTimeout(Z,100))}catch(Z){console.error("Failed to load next page:",Z);break}})()},[o,(U=w==null?void 0:w.pages)==null?void 0:U.length,i,T,E,A,n,t,R,g.key,g.direction]);const I=M.useMemo(()=>{if(!(n||t||q===0||R)&&!(G<=1))return{currentPage:o,totalPages:G,itemsPerPage:r,totalItems:q,hasNextPage:o<G,hasPreviousPage:o>1,onPageChange:a,itemLabel:"entries"}},[o,G,r,q,n,t,R]),S=(j,D)=>{b({key:j,direction:D||"asc"})},v=M.useMemo(()=>q>0?q:z.length,[q,z.length]),_=M.useMemo(()=>[{label:"Rank",key:"rank",width:"80px",render:j=>{const D=j.rank===0?v:j.rank;return m.jsx("span",{className:"Leaderboard__RankCell",children:m.jsxs("span",{className:`Leaderboard__Rank ${D<=3&&j.rank!==0?"Leaderboard__Rank--top":""}`,children:["#",D]})})},sortable:!0,sortValue:j=>j.rank===0?v+1:j.rank},{label:"User",key:"wallet",render:j=>{const D=s&&j.wallet.toLowerCase()===s.toLowerCase(),O=`https://berascan.com/address/${j.wallet}`,H=CN(j.wallet,j.beraname);return m.jsxs("span",{className:`Leaderboard__UserCell ${D?"Leaderboard__UserCell--current":""}`,children:[m.jsx("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"Leaderboard__Address",onClick:J=>J.stopPropagation(),children:H}),D&&m.jsx("span",{className:"Leaderboard__YouBadge",children:"YOU"})]})}},{label:"Swap Volume",key:"swapVolumeUSD",render:j=>{const D=j.swapVolumeUSD;return D==null||isNaN(D)||D===0?"$0":`$${An(D)}`},sortable:!0,sortValue:j=>j.swapVolumeUSD||0},{label:"Volume Points",key:"volumePoints",render:j=>(j.volumePoints>0&&(j.swapVolumeUSD===0||j.swapVolumeUSD===null||j.swapVolumeUSD),An(j.volumePoints)),sortable:!0,sortValue:j=>j.volumePoints},{label:"Current Positions",key:"positionsCount",width:"140px",render:j=>j.positionsCount.toString(),sortable:!0,sortValue:j=>j.positionsCount},{label:"Current Liquidity",key:"currentLiquidityUSD",render:j=>{const O=s&&j.wallet.toLowerCase()===s.toLowerCase()&&c!==void 0?c:j.currentLiquidityUSD;return`$${An(O)}`},sortable:!0,sortValue:j=>s&&j.wallet.toLowerCase()===s.toLowerCase()&&c!==void 0?c:j.currentLiquidityUSD},{label:"Liquidity Points",key:"liquidityPoints",render:j=>An(j.liquidityPoints),sortable:!0,sortValue:j=>j.liquidityPoints},{label:"Referral Points",key:"referralPoints",render:j=>An(j.referralPoints),sortable:!0,sortValue:j=>j.referralPoints},{label:"Total Points",key:"totalPoints",render:j=>An(j.totalPoints),sortable:!0,sortValue:j=>j.totalPoints},{label:"Change",key:"rankChange",width:"120px",render:j=>{if(j.rankChange===void 0||j.rankChange===0)return m.jsx("span",{className:"Leaderboard__ChangeCell",children:"0"});const D=j.rankChange>0;return m.jsxs("span",{className:`Leaderboard__ChangeCell ${D?"Leaderboard__ChangeCell--positive":"Leaderboard__ChangeCell--negative"}`,children:[m.jsx("img",{src:D?"/assets/components/priceup.png":"/assets/components/pricedown.png",alt:D?"up":"down",className:"Leaderboard__ChangeIcon"}),Math.abs(j.rankChange)]})},sortable:!0,sortValue:j=>j.rankChange??0}],[s,v,R]),N=M.useMemo(()=>k?[{rank:0,wallet:"",totalVolumeUSD:0,volumePoints:0,positionsCount:0,currentLiquidityUSD:0,liquidityPoints:0,referralPoints:0,totalPoints:0,rankChange:void 0,isError:!0,errorMessage:k instanceof Error?k.message:"Failed to fetch"}]:K,[k,K,o,r]),$=M.useMemo(()=>k?_.map((j,D)=>D===0?{...j,colSpan:O=>O.isError?_.length:void 0,render:(O,H)=>O.isError?m.jsxs("div",{style:{textAlign:"center",padding:"20px"},children:[m.jsx("p",{style:{margin:"0 0 10px 0"},children:"Error, contact the Winniers"}),m.jsx("a",{href:"https://x.com/WinnieSwap",target:"_blank",rel:"noopener noreferrer",style:{color:"#1DA1F2",textDecoration:"underline"},children:"https://x.com/WinnieSwap"})]}
8589):j.render?j.render(O,H):O[j.key]}:{...j,render:(O,H)=>O.isError?null:j.render?j.render(O,H):O[j.key]}):_,[k,_]);return m.jsxs("div",{className:"Leaderboard__TableSection",children:[e&&m.jsx("div",{className:"Leaderboard__TableHeader",children:m.jsx("h2",{className:"Leaderboard__SectionTitle",children:"Leaderboard"})}),m.jsx(Zp,{columns:$,data:N,tableClassName:"Table Table--bordered",wrapperClassName:"Table__Wrapper",defaultSortKey:"rank",defaultSortDirection:"asc",emptyMessage:"No data available",pagination:k?void 0:I,itemLabel:"entries",isLoading:C&&!(w&&"pages"in w&&Array.isArray(w.pages))||n&&p&&!(h&&Array.isArray(h))||E&&K.length===0,onSort:S,currentSortKey:g.key,currentSortDirection:g.direction,itemsPerPage:r,getRowClassName:j=>{if(j.isError)return"Leaderboard__TableRow--error";const D=s&&j.wallet&&j.wallet.toLowerCase()===s.toLowerCase(),O=[];return D&&O.push("Leaderboard__TableRow--current"),O.join(" ")}})]})},BXe=()=>{const t=jr(),e=Zo(),n=M.useRef(!1),[i,s]=M.useState(()=>new URLSearchParams(t.search).get("search")||"");return M.useEffect(()=>{if(n.current)return;const r=setTimeout(()=>{const o=new URLSearchParams(t.search);if((o.get("search")||"")!==i.trim()){const c=new URLSearchParams;o.forEach((h,p)=>{p!=="search"&&c.set(p,h)}),i.trim()&&c.set("search",i.trim());const l=c.toString(),d=l?`${t.pathname}?${l}`:t.pathname;e(d,{replace:!0})}},300);return()=>clearTimeout(r)},[i,e,t.pathname]),M.useEffect(()=>{const o=new URLSearchParams(t.search).get("search")||"";o!==i&&(n.current=!0,s(o),setTimeout(()=>{n.current=!1},100))},[t.search]),m.jsx(Uu,{className:"Leaderboard",children:m.jsx("div",{className:"Leaderboard__ContentWrapper",children:m.jsxs("div",{className:"Leaderboard__Content",children:[m.jsx(LS,{}),m.jsxs("div",{className:"Leaderboard__Header",children:[m.jsx("h2",{className:"Leaderboard__SectionTitle",children:"Leaderboard"}),m.jsx(wb,{searchValue:i,setSearchValue:s,mode:"expanded",activeTab:"Leaderboard",hideSlashIcon:!0})]}),m.jsx(UXe,{searchValue:i,showTitle:!1})]})})})},Goe={"1H":{period:"hour",limit:24,label:"1 Hour"},"1D":{period:"hour",limit:24,label:"1 Day"},"1W":{period:"day",limit:7,label:"1 Week"},"1M":{period:"day",limit:30,label:"1 Month"},"1Y":{period:"day",limit:365,label:"1 Year"},ALL:{period:"day",limit:1e3,label:"All Time"}},FXe=(t,e)=>{const n=Goe[e],i=n.period==="hour"?"tokenHourDatas":"tokenDayDatas",s=n.period==="hour"?"periodStartUnix":"date";return` 8590 query GetTokenPriceHistory { 8591 token(id: "${t}") { 8592 id 8593 symbol 8594 name 8595 } 8596 ${i}( 8597 where: { token: "${t}" } 8598 orderBy: "${s}" 8599 orderDirection: "desc" 8600 limit: ${n.limit} 8601 ) { 8602 items { 8603 ${s} 8604 priceUSD 8605 } 8606 } 8607 } 8608 `},jXe=t=>{var c,l;if(!t||t.length===0)return null;const e=((c=t[t.length-1])==null?void 0:c.value)||0,n=((l=t[t.length-2])==null?void 0:l.value)||e,i=e-n,s=n!==0?i/n*100:0,r=t.slice(-1),o=Math.max(...r.map(d=>d.value)),a=Math.min(...r.map(d=>d.value));return{currentPrice:e,priceChange:i,priceChangePercent:s,high24h:o,low24h:a}};function Koe(t,e="1M"){var r,o,a;const n=Goe[e],i=Zt({queryKey:["mobile-token-chart",t,e],enabled:!!t,queryFn:async()=>{var E,T;if(!t)throw new Error("Token address is required");const c="https://sub.winnieswap.com",l=c.endsWith("/graphql")?c:`${c.replace(/\/$/,"")}/graphql`,d=FXe(t,e),h=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d})});if(!h.ok)throw new Error(`GraphQL error: ${h.status} ${h.statusText}`);const p=await h.json();if(p.errors)throw console.error("GraphQL Errors:",p.errors),new Error(p.errors[0].message);const g=p.data.token,b=n.period==="hour"?((E=p.data.tokenHourDatas)==null?void 0:E.items)||[]:((T=p.data.tokenDayDatas)==null?void 0:T.items)||[];if(console.log("[MobileTokenChart] Token:",t),console.log("[MobileTokenChart] Interval:",e,"- Period:",n.period),console.log("[MobileTokenChart] Token Info:",g),console.log("[MobileTokenChart] Raw data:",b),console.log("[MobileTokenChart] Data length:",b.length),!g)throw console.warn("[MobileTokenChart] Token not found:",t),new Error("Token not found in Ponder");b.length===0&&(console.warn("[MobileTokenChart] No data found for token:",t),console.warn("[MobileTokenChart] Make sure this token is indexed by Ponder"));const C=[...b].sort((A,k)=>{const R="periodStartUnix"in A?A.periodStartUnix:A.date,P="periodStartUnix"in k?k.periodStartUnix:k.date;return R-P}).map(A=>({time:"periodStartUnix"in A?A.periodStartUnix:A.date,value:parseFloat(A.priceUSD)}));return console.log("[MobileTokenChart] Chart data points:",C.length),C.length>0&&(console.log("[MobileTokenChart] First point:",C[0]),console.log("[MobileTokenChart] Last point:",C[C.length-1])),{points:C,tokenSymbol:g.symbol,tokenName:g.name}},staleTime:600*1e3,refetchInterval:600*1e3,retry:3,retryDelay:c=>Math.min(1e3*2**c,3e4)}),s=M.useMemo(()=>{var c;return(c=i.data)!=null&&c.points?jXe(i.data.points):null},[i.data]);return{data:((r=i.data)==null?void 0:r.points)||[],tokenSymbol:((o=i.data)==null?void 0:o.tokenSymbol)||"",tokenName:((a=i.data)==null?void 0:a.tokenName)||"",isLoading:i.isLoading,error:i.error,stats:s}}
8608const VXe="#FFB648",WXe=({tokenAddress:t,height:e=280,showStats:n=!0,showIntervalButtons:i=!0,defaultInterval:s="1M",backgroundColor:r="transparent",lineColor:o=VXe})=>{const a=M.useRef(null),c=M.useRef(null),l=M.useRef(null),[d,h]=M.useState(s),{data:p,tokenSymbol:g,isLoading:b,error:w,stats:C}=Koe(t,d);M.useEffect(()=>{if(!a.current)return;if(c.current)try{c.current.remove()}catch(P){console.warn("Error removing chart:",P)}finally{c.current=null,l.current=null}const k=Moe(a.current,{width:a.current.clientWidth,height:e,layout:{background:{type:y8.Solid,color:r},textColor:"#fff"},grid:{vertLines:{visible:!1},horzLines:{visible:!1}},timeScale:{borderColor:"transparent",timeVisible:!0,secondsVisible:!1,minBarSpacing:8},rightPriceScale:{borderColor:"transparent"},crosshair:{mode:1,vertLine:{width:1,color:"rgba(255, 182, 72, 0.5)",style:2},horzLine:{width:1,color:"rgba(255, 182, 72, 0.5)",style:2}},handleScale:{axisPressedMouseMove:{time:!0,price:!0}},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}});if(c.current=k,g)try{const P=k.panes()[0];pQe(P,{horzAlign:"center",vertAlign:"center",lines:[{text:g,color:"rgba(255,182,72,0.08)",fontSize:64,fontStyle:"bold"}]})}catch(P){console.warn("Error creating watermark:",P)}l.current=k.addSeries(Boe,{lineColor:o,topColor:"rgba(255,182,72,0.15)",bottomColor:"rgba(255,182,72,0.00)",lineWidth:2,priceFormat:{type:"custom",minMove:1e-6,formatter:P=>P===0?"$0.00":P<.01?`$${P.toFixed(6)}`:P<1?`$${P.toFixed(4)}`:`$${P.toFixed(2)}`}});const R=()=>{if(c.current&&a.current)try{c.current.applyOptions({width:a.current.clientWidth})}catch(P){console.warn("Error resizing chart:",P)}};return window.addEventListener("resize",R),()=>{if(window.removeEventListener("resize",R),c.current)try{c.current.remove()}catch(P){console.warn("Error cleaning up chart:",P)}finally{c.current=null,l.current=null}}},[e,r,o,g]),M.useEffect(()=>{if(l.current&&p&&Array.isArray(p)&&p.length>0)try{const k=p.map(R=>({time:R.time,value:R.value}));if(l.current.setData(k),c.current)try{c.current.timeScale().fitContent()}catch(R){console.warn("Error fitting chart content:",R)}}catch(k){console.warn("Error setting chart data:",k)}},[p]);const E=k=>k===0?"$0.00":k<.01?`$${k.toFixed(6)}`:k<1?`$${k.toFixed(4)}`:`$${k.toFixed(2)}`,T=k=>`${k>=0?"+":""}${k.toFixed(2)}%`,A=["1H","1D","1W","1M","1Y","ALL"];return m.jsxs("div",{className:"mobile-token-chart",children:[n&&C&&!b&&m.jsx("div",{className:"mobile-token-chart__stats",children:m.jsxs("div",{className:"mobile-token-chart__price-info",children:[m.jsx("span",{className:"mobile-token-chart__current-price",children:E(C.currentPrice)}),m.jsx("span",{className:`mobile-token-chart__price-change ${C.priceChangePercent>=0?"mobile-token-chart__price-change--positive":"mobile-token-chart__price-change--negative"}`,children:T(C.priceChangePercent)})]})}),m.jsxs("div",{className:"mobile-token-chart__container",style:{position:"relative"},children:[m.jsx("div",{ref:a,className:"mobile-token-chart__chart",style:{height:e,width:"100%"}}),(b||w)&&m.jsx("div",{className:"mobile-token-chart__overlay",children:m.jsxs("div",{className:"mobile-token-chart__overlay-content",children:[b&&m.jsxs(m.Fragment,{children:[m.jsx(u4,{size:"mobile"}),m.jsx("p",{className:"mobile-token-chart__overlay-message",children:"Loading price data..."})]}),w&&m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"mobile-token-chart__overlay-message mobile-token-chart__overlay-message--error",children:"Error loading data"}),m.jsx("button",{className:"mobile-token-chart__retry-button btn btn--tiny btn__main",onClick:()=>window.location.reload(),children:"Retry"})]})]})})]}),i&&m.jsx("div",{className:"mobile-token-chart__intervals",children:A.map(k=>m.jsx("button",{className:`mobile-token-chart__interval-btn ${d===k?"mobile-token-chart__interval-btn--active":""}`,onClick:()=>h(k),disabled:b,children:k},k))})]})},qXe=()=>{const t=[{name:"HONEY",address:"0x0E4aaF1351de4c0264C5c7056Ef3777b41BD8e03"},{name:"WBERA",address:"0x7507c1dc16935B82698e4C63f2746A2fCf994dF8"}],[e,n]=M.useState(t[0].address),[i,s]=M.useState(""),{tokenSymbol:r,tokenName:o,data:a,stats:c}=Koe(e);return m.jsx(Uu,{className:"MobileChartTestPage",children:m.jsxs("div",{className:"MobileChartTestPage__Container",children:[m.jsx("h1",{className:"MobileChartTestPage__Title",children:"ð± Mobile Token Chart - Test Page"}),m.jsxs("p",{className:"MobileChartTestPage__Description",children:["Cette page te permet de tester le composant ",m.jsx("code",{children:"MobileTokenChart"})," avant de l'intégrer dans l'application mobile."]}),m.jsxs("div",{className:"MobileChartTestPage__TokenSelector",children:[m.jsx("label",{className:"MobileChartTestPage__Label",children:"Sélectionne un token pour tester :"}),m.jsx("div",{className:"MobileChartTestPage__Buttons",children:t.map(l=>m.jsx("button",{className:`btn ${e===l.address?"btn__main":"btn__shade"}`,onClick:()=>{n(l.address),s("")},children:l.name},l.address))}),m.jsxs("div",{className:"MobileChartTestPage__CustomInput",children:[m.jsx("label",{className:"MobileChartTestPage__Label",style:{fontSize:"12px"},children:"Ou entre une adresse custom :"}),m.jsxs("div",{style:{display:"flex",gap:"8px"},children:[m.jsx("input",{type:"text",className:"MobileChartTestPage__Input",placeholder:"0x...",value:i,onChange:l=>s(l.target.value)}),m.jsx("button",{className:"btn btn__main btn--small",onClick:()=>{i.trim()&&n(i.trim())},disabled:!i.trim(),children:"Test"})]})]})]}),m.jsxs("div",{className:"MobileChartTestPage__Info",children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Token Address:"}),m.jsx("code",{children:e})]}),r&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Symbol:"})," ",m.jsx("span",{style:{color:"#FFB648"},children:r})]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Name:"})," ",m.jsx("span",{style:{color:"rgba(255,255,255,0.7)"},children:o})]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Data Points:"})," ",m.jsx("span",{style:{color:"#4CAF50"},children:(a==null?void 0:a.length)||0})]}),c&&m.jsxs("div",{children:[m.jsx("strong",{children:"Current Price:"})," ",m.jsxs("span",{style:{color:"#FFB648"},children:["$",c.currentPrice.toFixed(6)]})]})]})]}),m.jsx("div",{className:"MobileChartTestPage__ChartWrapper",children:m.jsx(WXe,{tokenAddress:e,height:300,showStats:!0,showIntervalButtons:!0,defaultInterval:"1M"})}),m.jsxs("div",{className:"MobileChartTestPage__Instructions",children:[m.jsx("h3",{children:"ð Instructions :"}),m.jsxs("ol",{children:[m.jsxs("li",{children:["Remplace les adresses de tokens dans ",m.jsx("code",{children:"testTokens"})," avec les vraies adresses de tes tokens sur Berachain"]}),m.jsx("li",{children:"Vérifie que le chart affiche correctement les données de prix"}),m.jsx("li",{children:"Teste la réactivité en redimensionnant la fenêtre (simule mobile)"}),m.jsx("li",{children:"Ouvre les DevTools et passe en mode responsive (Cmd+Shift+M sur Mac)"}),m.jsxs("li",{children:["Une fois validé, tu peux utiliser ",m.jsx("code",{children:"<MobileTokenChart />"})," dans ton app mobile !"]})]})]}),m.jsxs("div",{className:"MobileChartTestPage__Usage",children:[m.jsx("h3",{children:"ð Utilisation dans ton app mobile :"}),m.jsx("pre",{children:`import { MobileTokenChart } from './components/Charts/MobileTokenChart'; 8609 8610// Dans ton composant Token Page 8611<MobileTokenChart 8612 tokenAddress={token.address} 8613 height={280} 8614 showStats={true} 8615 lineColor="#FFB648" 8616 backgroundColor="transparent" 8617/>`})]})]})})}
8617,zXe={isReady:!1,inRange:!1,positionDetails:null,unclaimedFees:null,refetch:()=>{},actualLiquidity:0n},HXe=(t,e)=>{if(!t||!e)return zXe;const n=M.useMemo(()=>!e.tick||!t?!1:e.tick>=t.tickLower&&e.tick<t.tickUpper,[e,t]),i=M.useMemo(()=>{try{return new to(new on(Nn.id,e.token0Ref.id,e.token0Ref.decimals,e.token0Ref.symbol,e.token0Ref.name),new on(Nn.id,e.token1Ref.id,e.token1Ref.decimals,e.token1Ref.symbol,e.token1Ref.name),e.feeTier,e.sqrtPrice,e.liquidity,e.tick||0)}catch(p){return console.error("Error when formating pool:",p),null}},[e]),{data:s,refetch:r}=Si({address:vt.positionManager,abi:Eu,functionName:"positions",args:[BigInt(t.tokenId)]}),o=M.useMemo(()=>s&&Array.isArray(s)?s[7]:BigInt(t.liquidity),[s,t.liquidity]),a=M.useMemo(()=>{if(!i)return null;try{return new ca({pool:i,tickLower:t.tickLower,tickUpper:t.tickUpper,liquidity:o.toString()})}catch(p){return console.error("Error when formating position:",p),null}},[i,t,o]),c=M.useMemo(()=>p=>{const g=parseFloat(p);return g===0?"0":g<.01?g.toFixed(6):g<1?g.toFixed(4):g<100?g.toFixed(2):g.toLocaleString("en-US",{maximumFractionDigits:2})},[]),l=M.useMemo(()=>p=>{try{return BigInt(p).toLocaleString("en-US")}catch{return"0"}},[]),d=M.useMemo(()=>{var E,T,A,k,R,P;if(!a)return null;const p=parseFloat(((A=(T=(E=e.token0Ref.tokenDayData)==null?void 0:E.items)==null?void 0:T[0])==null?void 0:A.priceUSD)||"0"),g=parseFloat(a.amount0.toExact())*p,b=parseFloat(((P=(R=(k=e.token1Ref.tokenDayData)==null?void 0:k.items)==null?void 0:R[0])==null?void 0:P.priceUSD)||"0"),w=parseFloat(a.amount1.toExact())*b,C=g+w;try{return{token0Amount:c(a.amount0.toExact()),token1Amount:c(a.amount1.toExact()),token0USD:g,token1USD:w,positionValueUSD:C,liquidityAmount:l((t==null?void 0:t.liquidity)||"0"),liquidityShare:(C/parseFloat(e.totalValueLockedUSD)*100).toFixed(2)}}catch(B){return console.error("Error when calculate position's datas:",B),null}},[t,e,a]),h=M.useMemo(()=>{if(!t||!e)return{token0Amount:"0",token1Amount:"0",hasUnclaimed:!1};if(s){const p=s[10],g=s[11],b=e.token0Ref||e.token0,w=e.token1Ref||e.token1;return{token0Amount:c(dt(p,b.decimals)),token1Amount:c(dt(g,w.decimals)),hasUnclaimed:p>0n||g>0n}}if(e.feeGrowthGlobal0X128&&t.feeGrowthInside0LastX128){const p=BigInt(e.feeGrowthGlobal0X128),g=BigInt(e.feeGrowthGlobal1X128),b=BigInt(t.feeGrowthInside0LastX128),w=BigInt(t.feeGrowthInside1LastX128),C=p>=b?p-b:0n,E=g>=w?g-w:0n,T=BigInt(t.liquidity),A=T*C>>128n,k=T*E>>128n,R=e.token0Ref||e.token0,P=e.token1Ref||e.token1;return{token0Amount:c(dt(A,R.decimals)),token1Amount:c(dt(k,P.decimals)),hasUnclaimed:A>0n||k>0n}}return{token0Amount:"0",token1Amount:"0",hasUnclaimed:!1}},[e,t,s,c]);return{isReady:!!d&&!!h,inRange:n,positionDetails:d,unclaimedFees:h,refetch:r,actualLiquidity:o}},GXe=({position:t,posData:e,isModalOpen:n})=>{var K,q;const{address:i}=mn(),[s,r]=M.useState([]),[o,a]=M.useState(0),{error:c}=$r({address:vt.positionManager,abi:Eu,functionName:"collect",args:[{tokenId:BigInt(t.tokenId),recipient:i,amount0Max:BigInt("0xffffffffffffffffffffffffffffffff"),amount1Max:BigInt("0xffffffffffffffffffffffffffffffff")}],query:{enabled:!!(i&&t.tokenId&&((K=e.unclaimedFees)!=null&&K.hasUnclaimed)&&n)}}),{writeContract:l,data:d,isPending:h,error:p,reset:g}=Ls(),{data:b,isLoading:w,isSuccess:C,error:E}=Ts({hash:d,query:{enabled:!!d}}),T=M.useCallback(()=>{var I;const G=[];return e.isReady||G.push({type:"not_ready",message:"Position data not loaded"}),(I=e.unclaimedFees)!=null&&I.hasUnclaimed||G.push({type:"no_fees",message:"No fees available to claim"}),t.tokenId||G.push({type:"invalid_position",message:"Invalid position"}),r(G),G.length===0},[e.isReady,(q=e.unclaimedFees)==null?void 0:q.hasUnclaimed,t.tokenId]);M.useEffect(()=>{T()},[T,o]);const A=M.useMemo(()=>s.length===0&&!!i&&!h&&!w,[s.length,i,h,w]),k=h||w,R=C&&!!b,P=h||w?"pending":R?"success":p||E||c?"error":"idle",B=M.useCallback(async()=>{if(!(s.length>0||!i))try{l({address:vt.positionManager,abi:Eu,functionName:"collect",args:[{tokenId:BigInt(t.tokenId),recipient:i,amount0Max:BigInt("0xffffffffffffffffffffffffffffffff"),amount1Max:BigInt("0xffffffffffffffffffffffffffffffff")}]})}catch(G){console.error("Failed to claim fees:",G)}},[s.length,i,l,t.tokenId]),F=M.useCallback(()=>{g(),r([]),a(G=>G+1)},[g]);return{validationErrors:s,canSubmit:A,status:P,isLoading:k,isSuccess:R,isPending:h,claimFees:B,reset:F,claimHash:d,claimReceipt:b,canClaim:A,errors:{claim:p,receipt:E,simulation:c},unclaimedFees:e.unclaimedFees}},KXe=` 8618query GetUserPositions($id: String = "", $owner: String = "") { 8619 positions(where: {pool: $id, owner: $owner}) { 8620 items { 8621 id 8622 tokenId 8623 owner 8624 liquidity 8625 tickLower 8626 tickUpper 8627 depositedToken0 8628 depositedToken1 8629 withdrawnToken0 8630 withdrawnToken1 8631 collectedFeesToken0 8632 collectedFeesToken1 8633 feeGrowthInside0LastX128 8634 feeGrowthInside1LastX128 8635 } 8636 } 8637 } 8638`,YXe=({position:t,pool:e,posData:n,onRefresh:i,onOpenDepositFromPosition:s,onOpenWithdrawFromPosition:r})=>{var b;const{claimFees:o,isLoading:a,isSuccess:c,claimHash:l,isPending:d}=GXe({position:t,posData:n,isModalOpen:!0});M.useEffect(()=>{c&&(i==null||i())},[c,i]);const h=()=>{s==null||s(t)},p=()=>{r==null||r(t)},g=()=>{o()};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"UserPosition__ActionButtons",children:[m.jsx("button",{className:"btn btn--tiny btn__main",onClick:h,children:"Increase"}),m.jsx("button",{className:"btn btn--tiny btn__accent",onClick:p,children:"Withdraw"}),m.jsx("button",{className:"btn btn--tiny btn__shade",onClick:g,disabled:a||!((b=n.unclaimedFees)!=null&&b.hasUnclaimed),children:a?"Claiming...":"Claim Fees"})]}),m.jsx(In,{isVisible:(d||a)&&!c,message:"Claim fees pending",type:"loading",duration:0,position:"top-right"}),m.jsx(In,{isVisible:c&&!!l,message:"Fees claimed successfully",type:"success",link:l?{href:`https://berascan.com/tx/${l}`,text:"View"}:void 0,duration:3e3,position:"top-right"})]})},ZXe=({position:t,pool:e,onRefresh:n,onOpenDepositFromPosition:i,onOpenWithdrawFromPosition:s})=>{var w,C,E,T,A,k,R,P,B,F,z,K,q;const r=HXe(t,e),o=BigInt(t.liquidity||"0");if((r.actualLiquidity>0n?r.actualLiquidity:o)<=0n)return null;const c=!r.isReady;parseFloat(((E=(C=(w=e.token0Ref.tokenDayData)==null?void 0:w.items)==null?void 0:C[0])==null?void 0:E.priceUSD)||"0"),parseFloat(((k=(A=(T=e.token1Ref.tokenDayData)==null?void 0:T.items)==null?void 0:A[0])==null?void 0:k.priceUSD)||"0");const l=(B=(P=(R=e.poolDayData)==null?void 0:R.items)==null?void 0:P[0])!=null&&B.apr?Number(e.poolDayData.items[0].apr):0;
8638let d=(F=r.positionDetails)==null?void 0:F.token0Amount,h=(z=r.positionDetails)==null?void 0:z.token1Amount;if(!d||!h||d==="0"&&h==="0"){const G=parseFloat(t.depositedToken0||"0")-parseFloat(t.withdrawnToken0||"0"),I=parseFloat(t.depositedToken1||"0")-parseFloat(t.withdrawnToken1||"0");d=G>0?q5(G,e.token0Ref.decimals):"0",h=I>0?q5(I,e.token1Ref.decimals):"0"}const p=`${d} ${e.token0Ref.symbol} / ${h} ${e.token1Ref.symbol}`,g=M.useMemo(()=>{try{if(t.tickLower<=-877272&&t.tickUpper>=877272)return{lower:"0",upper:"â",formatted:"Full Range"};const _=new on(Nn.id,e.token0Ref.id,e.token0Ref.decimals,e.token0Ref.symbol,e.token0Ref.name),N=new on(Nn.id,e.token1Ref.id,e.token1Ref.decimals,e.token1Ref.symbol,e.token1Ref.name),$=T3(t.tickLower,_,N),U=T3(t.tickUpper,_,N);let j=null;if(e.tick!==void 0&&e.tick!==null)try{j=T3(e.tick,_,N)}catch(J){console.error("Error calculating current price from tick:",J)}if(!j&&e.sqrtPrice)try{const J=BigInt(e.sqrtPrice),W=BigInt("0x1000000000000000000000000"),Z=Number(J)/Number(W),Y=Z*Z,Q=Math.pow(10,_.decimals-N.decimals);j=Y*Q}catch(J){console.error("Error calculating current price from sqrtPrice:",J)}const D=J=>J===0||!isFinite(J)?"0":J<.01?J.toFixed(6).replace(/\.?0+$/,""):J<1?J.toFixed(4).replace(/\.?0+$/,""):J<1e3?J.toFixed(2).replace(/\.?0+$/,""):J<1e6?`${(J/1e3).toFixed(1)}K`:J<1e9?`${(J/1e6).toFixed(1)}M`:`${(J/1e9).toFixed(1)}B`,O=$>100||U>100;let H;if(O){const J=1/U,W=1/$;H=`1 ${e.token1Ref.symbol} = ${D(J)} - ${D(W)} ${e.token0Ref.symbol}`}else H=`1 ${e.token0Ref.symbol} = ${D($)} - ${D(U)} ${e.token1Ref.symbol}`;return{lower:D($),upper:D(U),formatted:H}}catch(G){return console.error("Error calculating price range:",G),{lower:"-",upper:"-",formatted:"-"}}},[t.tickLower,t.tickUpper,e]),b=()=>{r==null||r.refetch(),n==null||n()};return m.jsx("div",{className:"UserPosition__Item",children:m.jsxs("div",{className:"UserPosition__Header",children:[m.jsxs("div",{className:"UserPosition__HeaderMain",children:[m.jsx("span",{className:"UserPositionsTable__TypeBadgeWrapper",children:m.jsxs("span",{className:`UserPositionsTable__TypeBadge sticky ${r.inRange?"in-range":"out-of-range"}`,title:r.inRange?"In range":"Out of range",children:[m.jsx("span",{className:"UserPosition__RangeIndicator",style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:r.inRange?"#4ade80":"#ef4444",marginRight:"6px",verticalAlign:"middle"}}),"Deposit"]})}),m.jsx("span",{className:"UserPositionsTable__ValueColumn",children:m.jsx("span",{className:"UserPosition__PositionValue",children:c?m.jsx("span",{style:{opacity:.6},children:"Loading..."}):`$${((q=(K=r.positionDetails)==null?void 0:K.positionValueUSD)==null?void 0:q.toFixed(2))||"0.00"}`})}),m.jsx("span",{className:"UserPositionsTable__AmountColumn",children:m.jsx("span",{className:"UserPosition__PositionTokens",children:p})}),m.jsx("span",{className:"UserPositionsTable__RangeColumn",children:m.jsx("span",{className:"UserPosition__Range",title:`Price range: ${g.formatted}`,children:g.formatted})}),m.jsx("span",{className:"UserPositionsTable__AprColumn",children:m.jsx("span",{className:"UserPositionsTable__AprValue",children:l>0?`${l.toFixed(2)}%`:"-"})})]}),m.jsx("div",{className:"UserPosition__HeaderActions",onClick:G=>G.stopPropagation(),children:m.jsx(YXe,{position:t,pool:e,posData:r,onRefresh:b,onOpenDepositFromPosition:i,onOpenWithdrawFromPosition:s})})]})})},QXe=({pool:t,vault:e,onOpenDepositFromPosition:n,onOpenWithdrawFromPosition:i,onHasActivePositionsChange:s})=>{var p,g,b,w,C;const{address:r}=mn(),{data:o,isLoading:a,refetch:c}=Zt({queryKey:["position",t.id,r],queryFn:async()=>{var A,k;if(!(t!=null&&t.id)||!r)return[];const E=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:KXe,variables:{id:t.id.toLowerCase(),owner:r.toLowerCase()}})});return E.ok?((k=(A=(await E.json()).data)==null?void 0:A.positions)==null?void 0:k.items)||[]:[]},enabled:!!r&&!!(t!=null&&t.id)}),l=(g=(p=t.poolDayData)==null?void 0:p.items)==null?void 0:g[0];l!=null&&l.apr&&Number(l.apr),(C=(w=(b=e==null?void 0:e.vaultDayData)==null?void 0:b.items)==null?void 0:w[0])!=null&&C.maxPotentialAPR&&Number(e.vaultDayData.items[0].maxPotentialAPR);const d=M.useMemo(()=>!r||a||!o||o.length===0?!1:o.some(T=>{try{return BigInt(T.liquidity||"0")>0n}catch{return!1}}),[r,a,o]);if(M.useEffect(()=>{if(console.log("[UserPositionDatas] hasActivePositions:",d,"positions:",o==null?void 0:o.length,"isLoading:",a),!r){s==null||s(!1);return}a||s==null||s(d)},[r,a,o,d,s]),!r||a)return null;const h=o&&o.length>0?o.map(E=>m.jsx(ZXe,{position:E,pool:t,onRefresh:c,onOpenDepositFromPosition:n,onOpenWithdrawFromPosition:i},E.id)):[];return m.jsxs("div",{className:"UserPositionsTable__Wrapper",children:[m.jsx("div",{className:"UserPosition__HeaderRow",children:m.jsx("h3",{className:"Pool__StatisticsTitle UserPosition__Title",children:"Your Positions"})}),h.length>0?m.jsx("div",{className:"UserPosition",children:m.jsx("div",{className:"UserPosition__List",children:h})}):m.jsx("div",{className:"UserPosition",children:m.jsx("div",{className:"UserPosition__Empty",children:m.jsx("p",{className:"UserPosition__EmptyText",children:"No position found"})})})]})},XXe=` 8639query GetTokensStats($id: String = "") { 8640 pool(id: $id) { 8641 collectedFeesUSD 8642 feeTier 8643 feesUSD 8644 id 8645 liquidity 8646 liquidityProviderCount 8647 sqrtPrice 8648 tick 8649 totalValueLockedUSD 8650 txCount 8651 volumeUSD 8652 feeGrowthGlobal0X128 8653 feeGrowthGlobal1X128 8654 poolDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8655 items { 8656 apr 8657 date 8658 feesUSD 8659 tvlUSD 8660 txCount 8661 volumeUSD 8662 volumeUSD30D 8663 volumeUSD1D 8664 } 8665 } 8666 token0Ref { 8667 decimals 8668 id 8669 logoUri 8670 name 8671 symbol 8672 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8673 items { 8674 priceUSD 8675 } 8676 } 8677 } 8678 token1Ref { 8679 id 8680 logoUri 8681 name 8682 symbol 8683 decimals 8684 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8685 items { 8686 priceUSD 8687 } 8688 } 8689 } 8690 }, 8691 stickyVaults(where: {pool: $id}) { 8692 items { 8693 collectedFeesUSD 8694 id 8695 name 8696 totalValueLockedUSD 8697 vaultDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8698 items { 8699 apr 8700 maxPotentialAPR 8701 volumeUSD1D 8702 } 8703 } 8704 } 8705 } 8706} 8707`,JXe=()=>{var O,H,J,W;const{poolAddress:t}=c6(),[e,n]=kn.useState("area"),[i,s]=kn.useState("1D"),[r,o]=kn.useState("price"),[a,c]=M.useState(null),[l]=M.useState(null),[d,h]=M.useState("deposit"),[p,g]=M.use
8707State(!1),[b,w]=M.useState(null),{address:C}=mn(),E=` 8708 query GetUserPositions($id: String = "", $owner: String = "") { 8709 positions(where: {pool: $id, owner: $owner}) { 8710 items { 8711 id 8712 tokenId 8713 owner 8714 liquidity 8715 tickLower 8716 tickUpper 8717 depositedToken0 8718 depositedToken1 8719 withdrawnToken0 8720 withdrawnToken1 8721 collectedFeesToken0 8722 collectedFeesToken1 8723 feeGrowthInside0LastX128 8724 feeGrowthInside1LastX128 8725 } 8726 } 8727 } 8728 `,{data:T}=Zt({queryKey:["user-positions",t,C],queryFn:async()=>{var Q,ee;return!t||!C?{positions:[]}:{positions:((ee=(Q=(await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:E,variables:{id:t,owner:C}})})).json()).data)==null?void 0:Q.positions)==null?void 0:ee.items)||[]}},enabled:!!t&&!!C,staleTime:300*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchInterval:30*1e3,refetchIntervalInBackground:!0}),A=kn.useMemo(()=>b||(!(T!=null&&T.positions)||T.positions.length===0?null:T.positions.find(Y=>BigInt(Y.liquidity)>0n)||null),[T,b]),{data:k,isLoading:R}=Zt({queryKey:["pool",t],queryFn:async()=>{var Q;const Y=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:XXe,variables:{id:t}})})).json();if(Y.errors)throw new Error(Y.errors[0].message);return{pool:Y.data.pool,vault:Y.data.stickyVaults.items[0],positions:((Q=Y.data.positions)==null?void 0:Q.items)||[]}},enabled:!!t,staleTime:120*1e3,gcTime:1440*60*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchInterval:30*1e3,refetchIntervalInBackground:!0,placeholderData:Z=>Z}),{pool:P,vault:B}=k??{pool:null,vault:null},{data:F}=Zt({queryKey:["other-pools",t],enabled:!!t&&!!P,staleTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchInterval:300*1e3,refetchIntervalInBackground:!0,queryFn:async()=>{var Y,Q;const Z=` 8729 query GetOtherPools { 8730 pools( 8731 where: { id_not: "${t==null?void 0:t.toLowerCase()}" } 8732 orderBy: "totalValueLockedUSD" 8733 orderDirection: "desc" 8734 limit: 10 8735 ) { 8736 items { 8737 id 8738 token0 8739 token1 8740 totalValueLockedUSD 8741 volumeUSD 8742 feeTier 8743 token0Ref { 8744 id 8745 symbol 8746 name 8747 decimals 8748 logoUri 8749 } 8750 token1Ref { 8751 id 8752 symbol 8753 name 8754 decimals 8755 logoUri 8756 } 8757 poolDayData( 8758 orderBy: "date" 8759 orderDirection: "desc" 8760 limit: 1 8761 ) { 8762 items { 8763 apr 8764 } 8765 } 8766 } 8767 } 8768 } 8769 `;try{const ee=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Z})});if(!ee.ok)return{data:[]};const ie=await ee.json();return ie.errors?{data:[]}:{data:(((Q=(Y=ie.data)==null?void 0:Y.pools)==null?void 0:Q.items)||[]).filter(de=>!Mp(de.id))}}catch{return{data:[]}}}}),z=()=>c(null),K=Z=>{n(Z)},q=Z=>{s(Z)},G=Z=>{o(Z)},I=M.useCallback(Z=>{console.log("[PoolPage] hasActivePositions changed:",Z),g(Z),Z||(h("swap"),w(null))},[]),S=Z=>isFinite(Z)?`$${Z.toFixed(2).replace(/\.?0+$/,"")}`:"$0";if(R&&!P)return m.jsxs("div",{className:"Pool",children:[m.jsx("div",{className:"Pool__Banner",children:m.jsx(qd,{pools:[],vaults:[]})}),m.jsx("div",{className:"Pool__BreadcrumbsContainer",children:m.jsxs("div",{className:"Pool__Breadcrumbs",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:80,height:16,borderRadius:4})]})}),m.jsxs("div",{className:"Pool__Content",children:[m.jsxs("div",{className:"Pool__Left",children:[m.jsx("div",{className:"Pool__ChartHead",children:m.jsx("div",{className:"Pool__ChartHeadTop",children:m.jsx("div",{className:"Pool__SectionHead",children:m.jsx("div",{className:"Pool__SectionHeadTitle",children:m.jsxs("div",{className:"Pool__SectionHeadTitleLeft",children:[m.jsx(Ke,{width:40,height:40,borderRadius:12}),m.jsxs("div",{className:"Pool__NameContainer",style:{marginLeft:"16
8769px"},children:[m.jsx(Ke,{width:120,height:24,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:60,height:16,borderRadius:4})]})]})})})})}),m.jsx("div",{className:"Pool__Chart",style:{minHeight:400},children:m.jsx(Ke,{width:"100%",height:400,borderRadius:12})}),m.jsxs("div",{className:"Pool__Statistics",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Metrics"}),m.jsx("div",{className:"Pool__StatCards",children:Array.from({length:5}).map((Z,Y)=>m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:100,height:24,borderRadius:4})]},Y))})]}),m.jsxs("div",{className:"Pool__InfoSection",children:[m.jsx("h3",{className:"Pool__InfoSectionTitle",children:"Tokens"}),m.jsx("div",{className:"Pool__InfoDetails",children:Array.from({length:2}).map((Z,Y)=>m.jsx("div",{className:"Pool__InfoRow",children:m.jsx(Ke,{width:"100%",height:40,borderRadius:8})},Y))})]})]}),m.jsx("div",{className:"Pool__Right",children:m.jsx("div",{className:"Pool__SwapForm",children:m.jsx(Ke,{width:"100%",height:500,borderRadius:12})})})]})]});if(!P)return m.jsx("div",{className:"VaultDetailPage VaultDetailPage--error",children:m.jsxs("div",{className:"VaultDetailPage__Error",children:[m.jsx("h2",{children:"Pool not found"}),m.jsx("p",{children:"The requested pool does not exist or has been removed"}),m.jsx(gi,{to:"/explore?tab=pools",className:"button button--primary",children:"Back to pools"})]})});const v=(O=P.poolDayData.items)==null?void 0:O[0],_=Number(P.totalValueLockedUSD)||null,N=v.volumeUSD1D?Number(v.volumeUSD1D):null,$=v.volumeUSD30D?Number(v.volumeUSD30D):null,U=v.apr?Number(v.apr):null,j=P.token0Ref,D=P.token1Ref;return m.jsxs("div",{className:"Pool",children:[(F==null?void 0:F.data)&&F.data.length>0&&m.jsx("div",{className:"Pool__Banner",children:m.jsx(qd,{pools:F.data})}),m.jsx("div",{className:"Pool__BreadcrumbsContainer",children:m.jsxs("div",{className:"Pool__Breadcrumbs",children:[m.jsx(gi,{to:"/explore?tab=tokens",className:"Pool__BreadcrumbsLink",children:"Explore"}),m.jsx(qo,{}),m.jsx(gi,{to:"/explore?tab=pools",className:"Pool__BreadcrumbsLink",children:"Pools"}),m.jsx(qo,{}),m.jsxs("span",{className:"Pool__BreadcrumbsLink__3",children:[j.symbol,"/",D.symbol]})]})}),m.jsxs("div",{className:"Pool__Content",children:[m.jsxs("div",{className:"Pool__Left",children:[m.jsx("div",{className:"Pool__ChartHead",children:m.jsx("div",{className:"Pool__ChartHeadTop",children:m.jsx("div",{className:"Pool__SectionHead",children:m.jsx("div",{className:"Pool__SectionHeadTitle",children:m.jsxs("div",{className:"Pool__SectionHeadTitleLeft",children:[m.jsx(If,{token0:{...j,address:j.id},token1:{...D,address:D.id},size:40,separatorWidth:2}),m.jsxs("div",{className:"Pool__NameContainer",children:[m.jsxs("a",{href:`https://berascan.com/address/${t}`,target:"_blank",rel:"noopener noreferrer",className:"Pool__Name Pool__NameLink",title:`${j.symbol}/${D.symbol} - View on Berascan`,children:[j.symbol,"/",D.symbol]}),m.jsx("div",{className:"Pool__Meta",children:m.jsxs("span",{className:"Pool__FeeText",style:{color:"rgba(255,255,255,0.6)",fontWeight:400},children:[P.feeTier/1e4,"%"]})})]})]})})})})}),m.jsx("div",{className:"Pool__Chart",children:m.jsx(w4,{poolAddress:t,chartType:e,interval:i,metric:r,height:400,showToolbar:!0,priceFormatter:S,onChartTypeChange:K,onIntervalChange:q,onMetricChange:G,dataType:"pool",positions:((H=T==null?void 0:T.positions)==null?void 0:H.filter(Z=>BigInt(Z.liquidity)>0n))||[],poolToken0:j?{id:j.id,symbol:j.symbol,name:j.name,decimals:j.decimals}
8769:void 0,poolToken1:D?{id:D.id,symbol:D.symbol,name:D.name,decimals:D.decimals}:void 0})}),m.jsx("div",{className:"Pool__SwapForm--mobile",children:m.jsx(Of,{toggleSidebar:()=>{},initialFromToken:{address:j.id,symbol:j.symbol,name:j.symbol,logoUri:j.logoUri,decimals:18},initialToToken:{address:D.id,symbol:D.symbol,name:D.symbol,logoUri:D.logoUri,decimals:18},initialMode:d,enableDepositWithdraw:p,position:A,pool:P,onSuccess:()=>{},showTitle:!1,isSticky:!1,hideMetrics:!0})}),C&&P&&m.jsx("div",{className:"Pool__PositionsSection",children:m.jsx(QXe,{pool:P,vault:B,onOpenDepositFromPosition:Z=>{w(Z),h("deposit")},onOpenWithdrawFromPosition:Z=>{w(Z),h("withdraw")},onHasActivePositionsChange:I})}),m.jsxs("div",{className:"Pool__Statistics",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Metrics"}),m.jsxs("div",{className:"Pool__StatCards",children:[m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"TVL"}),m.jsxs("p",{className:"Pool__StatCardLabel",children:["$",_===null||isNaN(_)?"N/A":An(_)]})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"Pool APY"}),m.jsx("p",{className:"Pool__StatCardLabel",children:U===null||isNaN(U)||typeof U!="number"?"N/A":`${U.toFixed(2)}%`})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"Vault APY"}),m.jsx("p",{className:"Pool__StatCardLabel",children:B===null||!((W=(J=B==null?void 0:B.vaultDayData)==null?void 0:J.items)!=null&&W.length)?m.jsx("a",{href:"https://x.com/winnieswap",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none",transition:"opacity 0.2s ease"},onMouseEnter:Z=>Z.currentTarget.style.opacity="0.7",onMouseLeave:Z=>Z.currentTarget.style.opacity="1",children:"Contact Winnie"}):`${Number(B.vaultDayData.items[0].maxPotentialAPR||0).toFixed(2)}%`})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"24h Volume"}),m.jsxs("p",{className:"Pool__StatCardLabel",children:["$",N===null||isNaN(N)?"N/A":An(N)]})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"30d Volume"}),m.jsxs("p",{className:"Pool__StatCardLabel",children:["$",$===null||isNaN($)?"N/A":An($)]})]})]})]}),m.jsxs("div",{className:"Pool__InfoSection",children:[m.jsx("h3",{className:"Pool__InfoSectionTitle",children:"Tokens"}),m.jsxs("div",{className:"Pool__InfoDetails",children:[m.jsx("div",{className:"Pool__InfoRow",children:m.jsx("span",{className:"Pool__InfoValue",children:m.jsxs("div",{className:"Pool__TokenInfoDetailed",children:[m.jsx(gi,{to:`/tokens/${j.id}`,className:"Pool__TokenLink",children:m.jsxs("div",{className:"Pool__TokenMain",children:[m.jsx(ws,{logoUri:j.logoUri,symbol:j.symbol,name:j.name,id:j.id,size:32}),m.jsx("span",{className:"Pool__TokenSymbol",children:j.symbol})]})}),m.jsx("div",{className:"Pool__TokenAddressContainer",children:m.jsx("a",{className:"Pool__TokenAddress Pool__TokenAddressLink",href:`https://berascan.com/token/${j.id}`,target:"_blank",rel:"noopener noreferrer",onClick:Z=>Z.stopPropagation(),children:j.id.slice(0,6)+"..."+j.id.slice(-4)})})]})})}),m.jsx("div",{className:"Pool__InfoRow",children:m.jsx("span",{className:"Pool__InfoValue",children:m.jsxs("div",{className:"Pool__TokenInfoDetailed",children:[m.jsx(gi,{to:`/tokens/${D.id}`,className:"Pool__TokenLink",children:m.jsxs("div",{className:"Pool__TokenMain",children:[m.jsx(ws,{logoUri:D.logoUri,symbol:D.symbol,n
8769ame:D.name,id:D.id,size:32}),m.jsx("span",{className:"Pool__TokenSymbol",children:D.symbol})]})}),m.jsx("div",{className:"Pool__TokenAddressContainer",children:m.jsx("a",{className:"Pool__TokenAddress Pool__TokenAddressLink",href:`https://berascan.com/token/${D.id}`,target:"_blank",rel:"noopener noreferrer",onClick:Z=>Z.stopPropagation(),children:D.id.slice(0,6)+"..."+D.id.slice(-4)})})]})})})]})]})]}),m.jsx("div",{className:"Pool__Right",children:m.jsx("div",{className:"Pool__SwapForm",children:m.jsx(Of,{toggleSidebar:()=>{},initialFromToken:{address:j.id,symbol:j.symbol,name:j.symbol,logoUri:j.logoUri,decimals:18},initialToToken:{address:D.id,symbol:D.symbol,name:D.symbol,logoUri:D.logoUri,decimals:18},initialMode:d,enableDepositWithdraw:p,position:A,pool:P,showLiquidityTabs:P?[{key:"add-pool-liquidity",label:"Add Pool Liquidity",url:`/liquidity/create?token0=${P.token0Ref.id}&token1=${P.token1Ref.id}&fee=${P.feeTier}`},...B?[{key:"add-vault-liquidity",label:"Add Vault Liquidity",url:`/vaults/${B.id}`}]:[]]:void 0,onSuccess:()=>{},showTitle:!1,isSticky:!0,hideMetrics:!0})})})]}),m.jsxs(eL,{open:!!a,onClose:z,className:"PoolView__Modal",overlayClassName:"PoolView__ModalOverlay",children:[m.jsxs("div",{className:"PoolView__ModalHeader",children:[m.jsx("span",{className:"PoolView__ModalTitle",children:"Transaction success"}),m.jsx("button",{className:"PoolView__ModalClose",onClick:z,"aria-label":"Close",children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M6 6L14 14M14 6L6 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),m.jsx("div",{className:"PoolView__ModalContent",children:a==="success"&&m.jsxs("div",{className:"PoolView__Success",children:[m.jsx("div",{className:"PoolView__SuccessTitle",children:"Transaction success"}),l&&m.jsx("a",{className:"PoolView__SuccessLink",href:`https://berascan.com/tx/${l}`,target:"_blank",rel:"noopener noreferrer",children:"View in explorer"})]})})]})]})};function eJe({vaultAddress:t,enabled:e=!0}){return Zt({queryKey:["vaultAPRs",t],queryFn:async()=>{if(!t)throw new Error("Vault address is required");const n=await fetch(`https://api.winnieswap.com/vaults/${t}/apr`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`Failed to fetch vault APRs: ${n.statusText}`);const i=await n.json();if(!i.success)throw new Error("Failed to fetch vault APRs");return i},enabled:e&&!!t,staleTime:60*1e3,refetchInterval:300*1e3,retry:3,retryDelay:n=>Math.min(1e3*2**n,3e4)})}const Yoe=({vaultPositions:t,isLoading:e=!1,onDeposit:n,onWithdraw:i,onStake:s,autoWinVault:r,stakeState:o})=>e?m.jsxs("div",{className:"UserPositionsTable__Wrapper",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Your Deposits"}),m.jsx("div",{className:"UserPosition",children:m.jsx("div",{className:"UserPosition__Loading",children:m.jsx(Ke,{width:"100%",height:80,borderRadius:12})})})]}):t.length===0?m.jsxs("div",{className:"UserPositionsTable__Wrapper",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Your Deposits"}),m.jsx("div",{className:"UserPosition",children:m.jsx("div",{className:"UserPosition__Empty",children:m.jsx("p",{className:"UserPosition__EmptyText",children:"No deposit found"})})})]}):m.jsxs("div",{className:"UserPositionsTable__Wrapper",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Your Deposits"}),m.jsx("div",{className:"UserPosition",children:m.jsx("div",{className:"UserPosition__List",children:t.map((a,c)=>m.jsx("div",{className:"UserPosition__Item",children:m.jsxs("div",{className:"UserPosition__Header",children:[m.jsxs("div",{className:"UserPosition__HeaderMain",children:[m.jsx("span",{className:"UserPositionsTable__TypeBadgeWrapper",children:m.jsx("span",{className:`UserPositionsTable__TypeBadge ${a.type}`,children:a.type==="autowin"?"Staked":a.type==="staked"?`Staked (${a.stakedProtocol==="infrared"?"Infrared":a.stakedProtocol==="berahub"?"Berahub":"External"})`:"Deposit"})}),m.jsx("span",{className:"UserPositionsTable__ValueColumn",children:m.jsxs("span",{className:"UserPosition__PositionValue",children:["$",Number(a.valueUSD).toFixed(2)]})}
8769),m.jsx("span",{className:"UserPositionsTable__AmountColumn",children:m.jsxs("span",{className:"UserPosition__PositionTokens",children:[(()=>{if(a.totalDeposited){const d=a.tokenDecimals||18;return q5(hs(a.totalDeposited,d),d)}const l=a.tokenDecimals||18;return q5(a.tokenAmount,l)})()," ",a.tokenName==="WinHONEY"?"":a.type==="sticky"?"STICKY":a.type==="autowin"?"":"STAKED"," ",a.tokenName]})}),m.jsx("span",{className:"UserPositionsTable__AprColumn",children:m.jsx("span",{className:"UserPositionsTable__AprValue",children:a.apr>0?`${Number(a.apr).toFixed(2)}%`:"-"})})]}),m.jsxs("div",{className:"UserPosition__HeaderActions",onClick:l=>l.stopPropagation(),children:[(()=>{const l=a.type==="sticky"&&r&&s;return a.type,l?m.jsx("button",{className:`btn btn--tiny ${o!=null&&o.isPending||o!=null&&o.isLoading||o!=null&&o.isApproving?"btn__disabled":"btn__main"}`,onClick:()=>{s(a)},disabled:(o==null?void 0:o.isPending)||(o==null?void 0:o.isLoading)||(o==null?void 0:o.isApproving),children:o!=null&&o.isApproving?"Approving...":o!=null&&o.isPending||o!=null&&o.isLoading?"Staking...":"Stake"}):null})(),a.type==="staked"&&a.externalLink&&m.jsx("button",{className:"btn btn--tiny btn__accent",onClick:()=>{window.open(a.externalLink,"_blank","noopener,noreferrer")},children:"Unstake"}),a.type!=="staked"&&m.jsxs(m.Fragment,{children:[m.jsx("button",{className:"btn btn--tiny btn__main",onClick:()=>n==null?void 0:n(a),children:"Increase"}),m.jsx("button",{className:"btn btn--tiny btn__accent",onClick:()=>i==null?void 0:i(a),children:"Withdraw"})]})]})]})},c))})})]}),tJe=({stickyVaultAddress:t,autoWinVaultAddress:e,stickyShares:n,slippageBps:i=100})=>{const{address:s}=mn(),{calculateMinAmount:r}=y4(i),o=!!s&&!!t&&!!e&&n>0n;M.useEffect(()=>{},[s,t,e,n,o]);const{minShares:a,isLoading:c}=dL({autoWinVault:e,stickyShares:n||void 0,slippageBps:i}),l=a?r(a,i):null,d=!!l,h=$p({tokenAddress:t,spenderAddress:vt.AUTOWIN_ROUTER,amount:n,enabled:o&&d});M.useEffect(()=>{h.approveStatus==="success"&&h.refetch()},[h.approveStatus,h.refetch]);const p=!h.isNeedApproval,g=M.useMemo(()=>!d||!p||!s||!e||!l||!n?null:{address:vt.AUTOWIN_ROUTER,abi:Tl,functionName:"depositIntoAutoWin",args:[e,n,l,s]},[d,p,s,e,l,n]),{data:b,error:w,isLoading:C}=$r(g?{address:g.address,abi:g.abi,functionName:g.functionName,args:g.args,chainId:Nn.id,query:{enabled:!0}}:{address:void 0,abi:Tl,functionName:"depositIntoAutoWinSelf",args:void 0,chainId:Nn.id,query:{enabled:!1}});M.useEffect(()=>{w&&console.error("Simulate contract error:",w)},[g,b,w,C,d,p,l]);const{data:E,writeContract:T,isPending:A,error:k,reset:R}=Ls(),{isLoading:P,isSuccess:B}=Ts({hash:E,query:{enabled:!!E}}),F=()=>{if(h.isNeedApproval){console.error("Cannot stake: approval needed first");return}if(!C){if(w){console.error("Cannot stake: simulation failed",w);return}if(!(b!=null&&b.request)){console.error("Cannot stake: stakeConfig.request is missing",{stakeConfig:b,isQuoted:d,isAllow:p,minShares:l==null?void 0:l.toString(),transactionConfig:g,isSimulating:C,simulateError:w==null?void 0:w.message});return}T(b.request)}};return{allowance:{isNeed:h.isNeedApproval,allow:h.approve,isLoading:h.isLoading,isApprove:h.isApproving,isSuccess:h.approveStatus==="success",hash:h.approveHash,error:h.approveError,reset:h.reset},isAllow:p,quote:{minShares:l},isQuoted:d,isQuoteLoading:c,stake:{execute:F,isPending:A,isLoading:P,isSuccess:B,hash:E,error:k,reset:R}}},nJe=` 8770 query GetStickyVaults($id: String = "", $user: String = "") { 8771 stickyVault(id: $id) { 8772 id 8773 name 8774 createdAtTimestamp 8775 createdAtBlockNumber 8776 totalValueLockedUSD 8777 txCount 8778 autoWinVault 8779 autoWinVaultRef { 8780 id 8781 totalBgtClaimed 8782 estimatedAPR 8783 positions(where: {user: $user}) { 8784 items { 8785 user 8786 shares 8787 firstDepositAt 8788 lastUpdateAt 8789 } 8790 } 8791 } 8792 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8793 items { 8794 apr 8795 maxPotentialAPR 8796 volumeUSD1D 8797 volumeUSD30D 8798 totalValueLockedUSD 8799 totalSupply 8800 } 8801 } 8802 positions(where: {user: $user}) { 8803 items { 8804 id 8805 user 8806 shares 8807 currentValueUSD 8808 feesEarnedUSD 8809 realizedPnLUSD 8810 initialValueUSD 8811 totalPnLUSD 8812 } 8813 } 8814 poolRef { 8815 id 8816 feeTier 8817 token1Ref { 8818 id 8819 name 8820 symbol 8821 logoUri 8822 decimals 8823 tokenDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8824 items { 8825 priceUSD 8826 } 8827 } 8828 } 8829 token0Ref { 8830 id 8831 name 8832 symbol 8833 logoUri 8834 decimals 8835 tokenDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8836 items { 8837 priceUSD 8838 } 8839 } 8840 } 8841 } 8842 } 8843 } 8844`,EY=()=>{var z,K,q,G,I,S,v,_,N,$,U,j,D,O,H,J,W;const{address:t}=mn(),{vaultAddress:e}=c6(),n=e?Mp(e):!1,{data:i,isLoading:s,refetch:r}=Zt({queryKey:["stickyVault",e],queryFn:async()=>{const Y=await(await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:nJe,variables:{id:e,user:t}})})).json();if(Y.errors)throw new Error(Y.errors[0].message);return Y.data.stickyVault},enabled:!!e&&!n,staleTime:120*1e3,gcTime:1440*60*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchInterval:30*1e3,refetchIntervalInBackgroun
8844d:!0,placeholderData:Z=>Z}),{data:o}=Zt({queryKey:["other-vaults",e],enabled:!!e&&!!i,staleTime:600*1e3,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchInterval:300*1e3,refetchIntervalInBackground:!0,queryFn:async()=>{var Y,Q;const Z=` 8845 query GetOtherVaults { 8846 stickyVaults( 8847 where: { id_not: "${e==null?void 0:e.toLowerCase()}" } 8848 orderBy: "totalValueLockedUSD" 8849 orderDirection: "desc" 8850 limit: 10 8851 ) { 8852 items { 8853 id 8854 name 8855 totalValueLockedUSD 8856 autoWinVault 8857 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8858 items { 8859 maxPotentialAPR 8860 } 8861 } 8862 poolRef { 8863 feeTier 8864 token0Ref { 8865 id 8866 symbol 8867 name 8868 logoUri 8869 } 8870 token1Ref { 8871 id 8872 symbol 8873 name 8874 logoUri 8875 } 8876 } 8877 } 8878 } 8879 } 8880 `;try{const ee=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:Z})});if(!ee.ok)return{data:[]};const ie=await ee.json();return ie.errors?{data:[]}:{data:((Q=(Y=ie.data)==null?void 0:Y.stickyVaults)==null?void 0:Q.items)||[]}}catch{return{data:[]}}}});if(n)return m.jsx(Ky,{to:"/explore?tab=vaults",replace:!0});const[a,c]=M.useState("deposit"),[l,d]=M.useState(null),[h,p]=M.useState(!1),[g,b]=M.useState(!1),{token0:w,token1:C,autoWinVault:E}=M.useMemo(()=>{var Z,Y,Q,ee;return i!=null&&i.poolRef?{token0:{id:i.poolRef.token0Ref.id,address:i.poolRef.token0Ref.id,symbol:i.poolRef.token0Ref.symbol,name:i.poolRef.token0Ref.name,decimals:i.poolRef.token0Ref.decimals,logoUri:i.poolRef.token0Ref.logoUri,priceUSD:((Y=(Z=i.poolRef.token0Ref.tokenDayData)==null?void 0:Z.items)==null?void 0:Y[0].priceUSD)||0},token1:{id:i.poolRef.token1Ref.id,address:i.poolRef.token1Ref.id,symbol:i.poolRef.token1Ref.symbol,name:i.poolRef.token1Ref.name,decimals:i.poolRef.token1Ref.decimals,logoUri:i.poolRef.token1Ref.logoUri,priceUSD:((ee=(Q=i.poolRef.token1Ref.tokenDayData)==null?void 0:Q.items)==null?void 0:ee[0].priceUSD)||0},autoWinVault:i.autoWinVault}:{token0:null,token1:null,autoWinVault:void 0}},[i]),T=hL({vaultAddress:i==null?void 0:i.id,userAddress:t,vaultTVL_USD:i==null?void 0:i.totalValueLockedUSD}),A=fL({autoWinVault:E,userAddress:t,sharesFromIndexer:(G=(q=(K=(z=i==null?void 0:i.autoWinVaultRef)==null?void 0:z.positions)==null?void 0:K.items)==null?void 0:q.find(Z=>Z.user===(t==null?void 0:t.toLowerCase())))==null?void 0:G.shares,stickyVaultAddress:i==null?void 0:i.id,vaultTVL_USD:i==null?void 0:i.totalValueLockedUSD}),{data:k}=eJe({vaultAddress:i==null?void 0:i.id,enabled:!!(i!=null&&i.id)}),R=tJe({stickyVaultAddress:i==null?void 0:i.id,autoWinVaultAddress:E,stickyShares:T.shares,slippageBps:100}),P=()=>{r(),T.refetch(),A.refetch()},B=Z=>{var Y,Q;if(Z.type!=="sticky"){console.log("handleStake: position type is not sticky",Z.type);return}if(console.log("handleStake called",{position:Z,stickyVaultBalanceShares:T.shares.toString(),stickyVaultBalanceValue:T.valueInUSD,autoWinVault:E,isAllow:R.isAllow,isQuoted:R.isQuoted,isQuoteLoading:R.isQuoteLoading,needsApproval:R.allowance.isNeed,stickyShares:(Y=R.quote.minShares)==null?void 0:Y.toString(),allowanceLoading:R.allowance.isLoading,hasStakeConfig:!!R.stake}),!T.shares||T.shares===0n){console.error("handleStake: No sticky shares available",T.shares);return}if(!E){console.error("handleStake: No autoWinVault available");return}if(R.allowance.isNeed){console.log("Calling allowance.allow()");try{R.allowance.allow()}catch(ee){console.error("Error calling allowance.allow()",ee)}return}if(!R.isQuoted&&R.isQuoteLoading){console.log("Quote still loading, waiting...");return}if(!R.isQuoted){console.log("Quote not available, cannot stake",{isQuoted:R.isQuoted,isQuoteLoading:R.isQuoteLoading,minShares:(Q=R.quote.minShares)==null?void 0:Q.toString()});return}console.log("Calling stake.execute()");try{R.stake.execute()}catch(ee){console.error("Error calling stake.execute()",ee)}};M.useEffect(()=>{var Q,ee,ie,re,oe;const Z=R.allowance.error,Y=Z&&(((Q=Z.message)==null?void 0:Q.includes("User rejected"))||((ee=Z.message)==null?void 0:ee.includes("user rejected"))||((ie=Z.message)==null?void 0:ie.includes("User denied"))||((re=Z.message)==null?void 0:re.includes("user denied"))||((oe=Z.message)==null?void 0:oe.includes("rejected")));if(R.allowance.isSuccess&&!R.allowance.isNeed&&R.isQuoted&&R.isAllow&&!R.stake.isPending&&!R.stake.isLoading&&!R.stake.isSuccess&&!Y){console.log("Approval successful, waiting for simulation to complete before calling stake.execute()");const de=setTimeout(()=>{!R.allowance.isNeed&&R.isQuoted&&R.isAllow&&!Y&&(console.log("Auto-executing stake after approval"),R.stake.execute())},2e3);return()=>clearTimeout(de)}},[R.allowance.isSuccess,R.allowance.error,R.allowance.isNeed,R.isQuoted,R.isAllow,R.stake.isPending,R.stake.isLoading,R.stake.isSuccess,R.stake.execute]),M.useEffect(()=>{R.stake.isSuccess&&P()},[R.stake.isSuccess]),M.useEffect(()=>{R.allowance.isSuccess&&R.allowance.hash&&!h&&!R.stake.isSuccess&&(p(!0),setTimeout(()=>{p(!1)},3e3)),!R.allowance.isSuccess&&h&&p(!1)},[R.allowance.isSuccess,R.allowance.hash,R.stake.isSuccess,h]),M.useEffect(()=>{R.stake.isSuccess&&R.stake.hash&&!g&&(b(!0),setTimeout(()=>{b(!1)},3e3)),!R.stake.isSuccess&&g&&b(!1)},[R.stake.isSuccess,R.stake.hash,g]);const F=M.useMemo(()=>{var de,he,ue,be,_e,Ne,pe,Te,ve,xe,Ye,ze,ft;if(!i||!t||!w||!C)return[];const Z=[],Y=(he=(de=i.positions)==null?void 0:de.items)==null?void 0:he.find(lt=>lt.user===t.toLowerCase());if(T.shares>0n){const lt=T.valueInUSD;Z.push({type:"sticky",valueUSD:lt,tokenName:`${w.symbol}-${C.symbol}`,tokenAmount:T.shares,apr:((_e=(be=(ue=i.vaultDayData)==null?void 0:ue.items)==null?void 0:be[0])==null?void 0:_e.maxPotentialAPR)||0})}const Q=(Te=(pe=(Ne=i==null?void 0:i.autoWinVaultRef)==null?void 0:Ne.positions)==null?void 0:pe.items)==null?void 0:Te.find(lt=>lt.user===(t==null?void 0:t.toLowerCase())),ee=Q?parseFloat(Q.shares||"0"):0,ie=A.shares>0n,re=ee>0,oe=A.isLoading;if(ie||oe&&re){const lt=parseFloat(((Ye=(xe=(ve=i.vaultDayData)==null?void 0:ve.items)==null?void 0:xe[0])==null?void 0:Ye.maxPotentialAPR)||"0"),We=parseFloat(((ze=i.autoWinVaultRef)==null?void 0:ze.estimatedAPR)||"0"),Dt=lt+We;let Fe,it;if(ie)Fe=A.shares,it=A.valueInUSD;else if(oe&&re)if(Fe=hs(ee.toString(),18),T.pricePerShare>0&&ee>0)it=ee*T.pricePerShare;else if(i.totalValueLockedUSD&&Y){const Qt=parseFloat(Y.shares||"0"),ke=parseFloat(Y.currentValueUSD||"0");if(Qt>0){const nt=ke/Qt;it=ee*nt}else it=0}else it=0;else Fe=0n,it=0;Z.push({type:"autowin",valueUSD:it,tokenName:`AW-${w.symbol}-${C.symbol}`,tokenAmount:Fe,apr:Dt})}if(i!=null&&i.autoWinVaultRef,(ft=k==null?void 0:k.strategies)!=null&&ft.some(lt=>lt.name==="infrared"||lt.name==="berahub"),Y&&parseFloat(Y.shares)>0){const lt=parseFloat(Y.shares),We=parseFloat(dt(T.shares,18));let Dt=0;A.valueInAssets?Dt=parseFloat(dt(A.valueInAssets,18)):re&&(Dt=ee);const Fe=We+Dt,it=lt-Fe;if(it>.01){const Qt=parseFloat(Y.currentValueUSD||"0"),ke=lt>0?Qt/lt:T.pricePerShare,nt=it*ke,ht=BigInt(Math.floor(it*Math.pow(10,18)));let At,zt,Ln=0;if(k!=null&&k.strategies){const gn=k.strategies.find(yn=>yn.name==="infrared");if(gn)At="infrared",zt=gn.externalLink,Ln=gn.totalAPR;else{const yn=k.strategies.find(bi=>bi.name==="berahub");yn&&(At="berahub",zt=yn.externalLink,Ln=yn.totalAPR)}}Z.push({type:"staked",valueUSD:nt,tokenName:`Staked ${w.symbol}-${C.symbol}`,tokenAmount:ht,apr:Ln,stakedProtocol:At,externalLink:zt})}}return Z},[i,t,w,C,T,A,k]);return M.useEffect(()=>{if(F.length>0&&!l){const Z=F.find(Q=>Q.type==="sticky"),Y=F.find(Q=>Q.type==="autowin");Z?d("sticky"):Y&&d("autowin")}else F.length===0&&d(null)},[F,l]),s?m.jsxs("div",{className:"Pool",children:[m.jsx("div",{className:"Pool__Banner",children:m.jsx(qd,{pools:[],vaults:[]})}),m.jsx("div",{className:"Pool__BreadcrumbsContainer",children:m.jsxs("div",{className:"Pool__Breadcrumbs",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:80,height:16,borderRadius:4})]})}),m.jsxs("div",{className:"Pool__Content",children:[m.jsxs("div",{className:"Pool__Left",children:[m.jsx("div",{className:"Pool__ChartHead",children:m.jsx("div",{className:"Pool__ChartHeadTop",children:m.jsx("div",{className:"Pool__SectionHead",children:m.jsx("div",{className:"Pool__SectionHeadTitle",children:m.jsxs("div",{className:"Pool__SectionHeadTitleLeft",children:[m.jsx(Ke,{width:40,height:40,borderRadius:12}),m.jsxs("div",{className:"Pool__NameContainer",style:{marginLeft:"16
8880px"},children:[m.jsx(Ke,{width:120,height:24,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:60,height:16,borderRadius:4})]})]})})})})}),m.jsx("div",{className:"Pool__Chart",style:{minHeight:400},children:m.jsx(Ke,{width:"100%",height:400,borderRadius:12})}),m.jsxs("div",{className:"Pool__Statistics",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Metrics"}),m.jsx("div",{className:"Pool__StatCards",children:Array.from({length:5}).map((Z,Y)=>m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:100,height:24,borderRadius:4})]},Y))})]}),m.jsxs("div",{className:"Pool__InfoSection",children:[m.jsx("h3",{className:"Pool__InfoSectionTitle",children:"Tokens"}),m.jsx("div",{className:"Pool__InfoDetails",children:Array.from({length:2}).map((Z,Y)=>m.jsx("div",{className:"Pool__InfoRow",children:m.jsx(Ke,{width:"100%",height:40,borderRadius:8})},Y))})]}),m.jsx("div",{className:"Pool__PositionsSection",children:m.jsxs("div",{className:"UserPosition",children:[m.jsx("div",{className:"UserPosition__TopRow",children:m.jsx("h3",{className:"UserPosition__Title",children:"Your Deposits"})}),m.jsx("div",{className:"UserPosition__Loading",children:m.jsx(Ke,{width:"100%",height:80,borderRadius:12})})]})})]}),m.jsx("div",{className:"Pool__Right",children:m.jsx("div",{className:"Pool__SwapForm",children:m.jsx(Ke,{width:"100%",height:500,borderRadius:12})})})]})]}):!i||!w||!C?m.jsx("div",{className:"VaultDetailPage VaultDetailPage--error",children:m.jsxs("div",{className:"VaultDetailPage__Error",children:[m.jsx("h2",{children:"Vault not found"}),m.jsx("p",{children:"The requested vault does not exist or has been removed"}),m.jsx(gi,{to:"/explore?tab=vaults",className:"button button--primary",children:"Back to vaults"})]})}):m.jsxs(Uu,{className:"Pool",children:[(o==null?void 0:o.data)&&o.data.length>0&&m.jsx("div",{className:"Pool__Banner",children:m.jsx(qd,{vaults:o.data})}),m.jsx("div",{className:"Pool__BreadcrumbsContainer",children:m.jsxs("div",{className:"Pool__Breadcrumbs",children:[m.jsx(gi,{to:"/earn?tab=vaults",className:"Pool__BreadcrumbsLink",children:"Earn"}),m.jsx(qo,{}),m.jsx(gi,{to:"/earn?tab=vaults",className:"Pool__BreadcrumbsLink",children:"Vaults"}),m.jsx(qo,{}),m.jsx("span",{className:"Pool__BreadcrumbsLink__3",children:`${w.symbol}/${C.symbol}`})]})}),m.jsxs("div",{className:"Pool__Content",children:[m.jsxs("div",{className:"Pool__Left",children:[m.jsx("div",{className:"Pool__ChartHead",children:m.jsx("div",{className:"Pool__ChartHeadTop",children:m.jsx("div",{className:"Pool__SectionHead",children:m.jsx("div",{className:"Pool__SectionHeadTitle",children:m.jsxs("div",{className:"Pool__SectionHeadTitleLeft",children:[m.jsx(If,{token0:{...w,address:w.id},token1:{...C,address:C.id},size:40,separatorWidth:2}),m.jsxs("div",{className:"Pool__NameContainer",children:[m.jsx("a",{href:`https://berascan.com/address/${i.id}`,target:"_blank",rel:"noopener noreferrer",className:"Pool__Name Pool__NameLink",title:`${w.symbol}/${C.symbol} - View on Berascan`,children:`${w.symbol}/${C.symbol}`}),m.jsx("div",{className:"Pool__Meta",children:((I=i.poolRef)==null?void 0:I.feeTier)&&m.jsxs("span",{className:"Pool__FeeText",style:{color:"rgba(255,255,255,0.6)",fontWeight:400},children:[i.poolRef.feeTier/1e4,"%"]})})]})]})})})})}),m.jsx("div",{className:"Pool__Chart",children:m.jsx(w4,{vaultAddress:i.id,dataType:"vault",height:400,showToolbar:!0})}),m.jsx("div",{className:"VaultDetailPage__SwapForm--mobile",children:m.jsx(Of,{toggleSidebar:()=>{},initialFromToken:w,initialToToken:C,initialMode:a,enableDepositWithdraw:!0,showTitle:!1,isSticky:!1,hideMetrics:!0,vault:i,vaultPosition:{sticky:{shares:T.shares,valueUSD:T.valueInUSD},autowin:A.shares>0n?{shares:A.shares,valueUSD:A.valueInUSD}:null},autoWinVault:E,showUnstakeHint:(S=k==null?void 0:k.strategies)==null?void 0:S.some(Z=>Z.name==="infrared"||Z.name==="berahub"),onSuccess:P})}),t&&m.jsx("div",{className:"Pool__PositionsSection",children:m.jsx(Yoe,{vaultPositions:F,isLoading:s,autoWinVault:E,stickyVaultAddress:i==null?void 0:i.id,stakeState:{isPending:R.stake.isPending,isLoading:R.stake.isLoading,isApproving:R.allowance.isApprove,needsApproval:R.allowance.isNeed},onDeposit:Z=>{c("deposit"),(Z.type==="sticky"||Z.type==="autowin")&&d(Z.type)},onWithdraw:Z=>{c("withdraw"),(Z.type==="sticky"||Z.type==="autowin")&&d(Z.type)},onStake:B})}),m.jsxs("div",{className:"Pool__Statistics",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Metrics"}),m.jsxs("div",{className:"Pool__StatCards",children:[m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"TVL"}),m.jsxs("p",{className:"Pool__StatCardLabel",children:["$",i.totalValueLockedUSD!==0?An(i.totalValueLockedUSD):"N/A"]})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"Deposit APY"}),m.jsx("p",{className:"Pool__StatCardLabel",children:(_=(v=i.vaultDayData)==null?void 0:v.items)!=null&&_.length?`${Number(i.vaultDayData.items[0].maxPotentialAPR||0).toFixed(2)}%`:"N/A"})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"Staked APY"}),m.jsx("p",{className:"Pool__StatCardLabel",children:i.autoWinVault&&((N=i.autoWinVaultRef)!=null&&N.estimatedAPR)&&((j=(U=($=i.vaultDayData)==null?void 0:$.items)==null?void 0:U[0])!=null&&j.maxPotentialAPR)?`${(Number(i.vaultDayData.items[0].maxPotentialAPR||0)+Number(i.autoWinVaultRef.estimatedAPR||0)).toFixed(2)}%`:"Add > $100k"})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"24h Volume"}),m.jsx("p",{className:"Pool__StatCardLabel",children:(O=(D=i.vaultDayData)==null?void 0:D.items)!=null&&O.length&&i.vaultDayData.items[0].volumeUSD1D!=="0"?`$${An(Number(i.vaultDayData.items[0].volumeUSD1D||0))}`:"N/A"})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"30d Volume"}),m.jsx("p",{className:"Pool__StatCardLabel",children:(J=(H=i.vaultDayData)==null?void 0:H.items)!=null&&J.length&&i.vaultDayData.items[0].volumeUSD30D!=="0"?`$${An(Number(i.vaultDayData.items[0].volumeUSD30D||0))}`:"N/A"})]})]})]}),m.jsxs("div",{className:"Pool__InfoSection",children:[m.jsx("h3",{className:"Pool__InfoSectionTitle",children:"Tokens"}
8880),m.jsxs("div",{className:"Pool__InfoDetails",children:[m.jsx("div",{className:"Pool__InfoRow",children:m.jsx("span",{className:"Pool__InfoValue",children:m.jsxs("div",{className:"Pool__TokenInfoDetailed",children:[m.jsx(gi,{to:`/tokens/${w.id}`,className:"Pool__TokenLink",children:m.jsxs("div",{className:"Pool__TokenMain",children:[m.jsx(ws,{logoUri:w.logoUri,symbol:w.symbol,name:w.name,id:w.id,size:32}),m.jsx("span",{className:"Pool__TokenSymbol",children:w.symbol})]})}),m.jsx("div",{className:"Pool__TokenAddressContainer",children:m.jsx("a",{className:"Pool__TokenAddress Pool__TokenAddressLink",href:`https://berascan.com/token/${w.id}`,target:"_blank",rel:"noopener noreferrer",onClick:Z=>Z.stopPropagation(),children:w.id.slice(0,6)+"..."+w.id.slice(-4)})})]})})}),m.jsx("div",{className:"Pool__InfoRow",children:m.jsx("span",{className:"Pool__InfoValue",children:m.jsxs("div",{className:"Pool__TokenInfoDetailed",children:[m.jsx(gi,{to:`/tokens/${C.id}`,className:"Pool__TokenLink",children:m.jsxs("div",{className:"Pool__TokenMain",children:[m.jsx(ws,{logoUri:C.logoUri,symbol:C.symbol,name:C.name,id:C.id,size:32}),m.jsx("span",{className:"Pool__TokenSymbol",children:C.symbol})]})}),m.jsx("div",{className:"Pool__TokenAddressContainer",children:m.jsx("a",{className:"Pool__TokenAddress Pool__TokenAddressLink",href:`https://berascan.com/token/${C.id}`,target:"_blank",rel:"noopener noreferrer",onClick:Z=>Z.stopPropagation(),children:C.id.slice(0,6)+"..."+C.id.slice(-4)})})]})})})]})]})]}),m.jsx("div",{className:"Pool__Right",children:m.jsx("div",{className:"VaultDetailPage__SwapForm",children:m.jsx(Of,{toggleSidebar:()=>{},initialFromToken:w?{address:w.address,symbol:w.symbol,name:w.symbol,logoUri:w.logoUri,decimals:w.decimals||18}:null,initialToToken:C?{address:C.address,symbol:C.symbol,name:C.symbol,logoUri:C.logoUri,decimals:C.decimals||18}:null,initialMode:a,enableDepositWithdraw:!0,showTitle:!1,isSticky:!0,hideMetrics:!0,vault:i,vaultPosition:{sticky:{shares:T.shares,valueUSD:T.valueInUSD},autowin:A.shares>0n?{shares:A.shares,valueUSD:A.valueInUSD}:null},selectedVaultPositionType:l,autoWinVault:E,showUnstakeHint:(W=k==null?void 0:k.strategies)==null?void 0:W.some(Z=>Z.name==="infrared"||Z.name==="berahub"),onSuccess:P})})})]}),m.jsx(In,{isVisible:(R.stake.isPending||R.stake.isLoading||R.allowance.isApprove)&&!R.stake.isSuccess&&!R.allowance.isSuccess,message:R.allowance.isApprove?"Approval pending":"Staking pending",type:"loading",duration:0,position:"top-right",onClose:()=>{p(!1),b(!1)}}),m.jsx(In,{isVisible:R.allowance.isSuccess&&!!R.allowance.hash&&!R.stake.isSuccess&&h,message:"Approval confirmed",type:"success",link:R.allowance.hash?{href:`https://berascan.com/tx/${R.allowance.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:R.stake.isSuccess&&!!R.stake.hash&&g,message:"Staking confirmed",type:"success",link:R.stake.hash?{href:`https://berascan.com/tx/${R.stake.hash}`,text:"View"}:void 0,duration:3e3,position:"top-right"}),m.jsx(In,{isVisible:(()=>{const Z=R.stake.error||R.allowance.error;if(!Z||!(R.stake.isPending||R.allowance.isApprove||R.stake.isSuccess||R.allowance.isSuccess))return!1;const Q=(Z==null?void 0:Z.message)||(Z==null?void 0:Z.toString())||"",ee=String(Z||""),ie=Q||ee;return!(ie.includes("functionName is required")||ie.includes("address is required")||ie.includes("abi is required")||ie.includes("Function name is required"))})(),message:(()=>{const Z=R.stake.error||R.allowance.error,Y=(Z==null?void 0:Z.message)||(Z==null?void 0:Z.toString())||"",Q=String(Z||""),ee=Y||Q;return ee.includes("User rejected")||ee.includes("user rejected")||ee.includes("User denied")||ee.includes("user denied")||ee.includes("rejected")?R.allowance.error?"Approval cancelled":"Staking cancelled":Y||Q||"Transaction failed"})(),type:(()=>{const Z=R.stake.error||R.allowance.error,Y=(Z==null?void 0:Z.message)||(Z==null?void 0:Z.toString())||"",Q=String(Z||""),ee=Y||Q;return ee.includes("User rejected")||ee.includes("user rejected")||ee.includes("User denied")||ee.includes("user denied")||ee.includes("rejected")?"cancelled":"error"})(),duration:3e3,position:"top-right"})]})},Am="0x456c957454dCF68F75af885905Faaac35C14EeCe",D0="0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",_Y="0x6969696969696969696969696969696969696969",SY=["HONEY","wBERA","WBTC","WETH","sUSDe"],iJe=()=>{const{address:t}=mn(),{vaultAddress:e}=c6(),n=e||Am,i=(n==null?void 0:n.toLowerCase())===Am.toLowerCase(),s=qoe(n),{data:r}=Zt({queryKey:["erc4626Vault",n,t],queryFn:async()=>{var R;try{const B=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 8881 query GetERC4626Vault($id: String = "", $user: String = "") { 8882 erc4626Vault(id: $id) { 8883 id 8884 name 8885 symbol 8886 asset 8887 totalAssets 8888 totalSupply 8889 positions(where: {user: $user}) { 8890 items { 8891 id 8892 user 8893 shares 8894 assets 8895 currentValueUSD 8896 totalDeposited 8897 totalWithdrawn 8898 } 8899 } 8900 assetRef { 8901 id 8902 symbol 8903 name 8904 logoUri 8905 decimals 8906 tokenDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8907 items { 8908 priceUSD 8909 } 8910 } 8911 } 8912 dayData(orderBy: "date", orderDirection: "desc", limit: 1) { 8913 items { 8914 apr 8915 } 8916 } 8917 } 8918 } 8919 `,variables:{id:n.toLowerCase(),user:(t==null?void 0:t.toLowerCase())||""}})});if(!B.ok)return null;const F=await B.json();return(R=F==null?void 0:F.data)==null?void 0:R.erc4626Vault}catch(P){return console.error("[ERC4626] Error fetching vault from GraphQL:",P),null}},enabled:!!t,staleTime:30*1e3}),o=M.useMemo(()=>{var P,B;return(B=(P=r==null?void 0:r.positions)==null?void 0:P.items)!=null&&B[0]&&r.positions.items[0].totalDeposited||null},[r]),{data:a}=Zt({queryKey:["tokenListForCollateral"],queryFn:async()=>{try{const R=await fetch("https://api.winnieswap.com/token/list");if(!R.ok)return[];const P=await R.json();return Array.isArray(P)?P:(P==null?void 0:P.data)||[]}catch{return[]}},staleTime:300*1e3}),c=M.useMemo(()=>{const R=a||[],P=new Map;return P.set("HONEY",{address:D0,symbol:"HONEY",name:"Honey"}),P.set("WBERA",{address:_Y,symbol:"wBERA",name:"Wrapped Bera"}),P.set("wBERA",{address:_Y,symbol:"wBERA",name:"Wrapped Bera"}),SY.forEach(B=>
8919{if(P.has(B.toUpperCase()))return;const F=R.find(z=>{var K,q;return((K=z.symbol)==null?void 0:K.toUpperCase())===B.toUpperCase()||((q=z.symbol)==null?void 0:q.toUpperCase())===B.replace("w","W").toUpperCase()});F!=null&&F.address&&P.set(B.toUpperCase(),{address:F.address,symbol:F.symbol||B,name:F.name})}),SY.map(B=>{const F=P.get(B.toUpperCase());return F||{address:"0x0000000000000000000000000000000000000000",symbol:B,name:B}})},[a]),[l,d]=M.useState("deposit"),h=M.useMemo(()=>({address:D0,symbol:"HONEY",name:"Honey",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL",priceUSD:s.honeyPrice||0}),[s.honeyPrice]),p=M.useMemo(()=>({id:Am,name:"Win HONEY",totalValueLockedUSD:s.tvlUSD,poolRef:{token0Ref:{id:D0,symbol:"HONEY",name:"Honey",decimals:18,logoUri:null,tokenDayData:{items:[{priceUSD:s.honeyPrice||0}]}},token1Ref:{id:D0,symbol:"HONEY",name:"Honey",decimals:18,logoUri:null,tokenDayData:{items:[{priceUSD:s.honeyPrice||0}]}}},autoWinVault:!1}),[s.tvlUSD,s.honeyPrice]),g=()=>{s.refetch()},b=M.useMemo(()=>{const R=a||[],P=R.find(F=>{var z,K;return((z=F.address)==null?void 0:z.toLowerCase())===D0.toLowerCase()||((K=F.symbol)==null?void 0:K.toUpperCase())==="HONEY"}),B=parseFloat((P==null?void 0:P.priceUSD)||"0");return console.log("[ERC4626] honeyPriceFromAPI",{honeyToken:P,price:B,tokenListLength:R.length}),B},[a]),{data:w}=Zt({queryKey:["honeyPriceGraphQL",D0],queryFn:async()=>{var R,P,B,F,z;try{const K=` 8920 query GetHoneyPrice { 8921 token(id: "${D0.toLowerCase()}") { 8922 id 8923 symbol 8924 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8925 items { 8926 priceUSD 8927 } 8928 } 8929 } 8930 } 8931 `,q=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:K})});if(!q.ok)return 0;const G=await q.json(),I=(z=(F=(B=(P=(R=G==null?void 0:G.data)==null?void 0:R.token)==null?void 0:P.tokenDayData)==null?void 0:B.items)==null?void 0:F[0])==null?void 0:z.priceUSD,S=parseFloat(I||"0");return console.log("[ERC4626] honeyPriceFromGraphQL",{priceUSD:I,price:S}),S}catch(K){return console.error("[ERC4626] Error fetching honeyPrice from GraphQL:",K),0}},staleTime:300*1e3,enabled:!s.honeyPrice||s.honeyPrice===0}),C=s.honeyPrice||b||w||0;console.log("[ERC4626] Final honeyPrice",{fromHook:s.honeyPrice,fromAPI:b,fromGraphQL:w,final:C});const E=M.useMemo(()=>{var R,P,B,F;return(F=(B=(P=(R=r==null?void 0:r.assetRef)==null?void 0:R.tokenDayData)==null?void 0:P.items)==null?void 0:B[0])!=null&&F.priceUSD?parseFloat(r.assetRef.tokenDayData.items[0].priceUSD):i?C:0},[r,i,C]),T=M.useMemo(()=>{if(!t||!s.userBalance||s.userBalance===0n)return console.log("[ERC4626] userValueUSD: No address or balance",{address:t,balance:s.userBalance}),0;if(!i&&o&&E>0){const R=parseFloat(o),P=R*E;return console.log("[ERC4626] userValueUSD (method: totalDeposited from GraphQL)",{totalDeposited:o,depositedDecimal:R,assetPriceUSD:E,result:P}),P}if(i&&s.userAssets&&s.userAssets>0n&&C>0){const R=parseFloat(dt(s.userAssets,18)),P=R*C;return console.log("[ERC4626] userValueUSD (method 1: userAssets)",{userAssetsDecimal:R,honeyPrice:C,result:P}),P}if(s.pricePerShare>0&&(i?C:E)>0){const R=parseFloat(dt(s.userBalance,18)),P=i?C:E,B=R*s.pricePerShare,F=B*P;return console.log("[ERC4626] userValueUSD (method 2: shares à pricePerShare)",{userSharesDecimal:R,pricePerShare:s.pricePerShare,depositInAsset:B,price:P,result:F}),F}return console.log("[ERC4626] userValueUSD: Cannot calculate",{userBalance:s.userBalance,userAssets:s.userAssets,pricePerShare:s.pricePerShare,honeyPrice:C,assetPriceUSD:E,totalDeposited:o,isMorphoVault:i}),0},[t,s.userBalance,s.userAssets,s.pricePerShare,C,E,o,i,s.honeyPrice,b,w]),A=M.useMemo(()=>{if(s.totalAssets&&s.totalAssets>0n&&C>0){const R=parseFloat(dt(s.totalAssets,18)),P=R*C;return console.log("[ERC4626] calculatedTVL (method 1: totalAssets)",{totalAssetsDecimal:R,honeyPrice:C,result:P}),P}if(s.totalSupply&&s.totalSupply>0n&&s.pricePerShare>0&&C>0){const R=parseFloat(dt(s.totalSupply,18)),P=R*s.pricePerShare,B=P*C;return console.log("[ERC4626] calculatedTVL (method 2: totalSupply à pricePerShare)",{totalSupplyDecimal:R,pricePerShare:s.pricePerShare,tvlInHoney:P,honeyPrice:C,result:B}),B}return console.log("[ERC4626] calculatedTVL: Using fallback tvlUSD",{totalAssets:s.totalAssets,totalSupply:s.totalSupply,pricePerShare:s.pricePerShare,honeyPrice:C,tvlUSD:s.tvlUSD}),s.tvlUSD||0},[s.totalAssets,s.totalSupply,s.pricePerShare,C,s.tvlUSD,s.honeyPrice,b,w]);M.useMemo(()=>({address:Am,symbol:"WinHONEY",name:"Win HONEY",decimals:18,logoUri:null,totalSupply:"0",lastPrice:0,status:"IN_POOL",priceUSD:s.pricePerShare*C}),[s.pricePerShare,C]);const k=M.useMemo(()=>{var F,z,K,q,G;if(!t||(!s.userBalance||s.userBalance===0n)&&!o)return[];const R=i?"WinHONEY":(r==null?void 0:r.symbol)||"Vault Shares";let P;if(i)P=s.userBalance||0n;else if(o){const I=((F=r==null?void 0:r.assetRef)==null?void 0:F.decimals)||18;try{P=hs(o,I)}catch{P=s.userBalance||0n}}else P=s.userBalance||0n;const B=i?18:((z=r==null?void 0:r.assetRef)==null?void 0:z.decimals)||18;return[{type:"sticky",valueUSD:T,tokenName:R,tokenAmount:P,tokenDecimals:B,totalDeposited:i?void 0:o||void 0,apr:(G=(q=(K=r==null?void 0:r.dayData)==null?void 0:K.items)==null?void 0:q[0])!=null&&G.apr?parseFloat(r.dayData.items[0].apr):s.apr||0}]},[t,s.userBalance,s.apr,T,o,r,i]);return s.isLoading?m.jsxs("div",{className:"Pool",children:[m.jsx("div",{className:"Pool__Banner",children:m.jsx(qd,{pools:[],vaults:[]})}),m.jsx("div",{className:"Pool__BreadcrumbsContainer",children:m.jsxs("div",{className:"Pool__Breadcrumbs",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:60,height:16,borderRadius:4}),m.jsx(qo,{}),m.jsx(Ke,{width:80,height:16,borderRadius:4})]})}),m.jsxs("div",{className:"Pool__Content",children:[m.jsxs("div",{className:"Pool__Left",children:[m.jsx("div",{className:"Pool__ChartHead",children:m.jsx("div",{className:"Pool__ChartHeadTop",children:m.jsx("div",{className:"Pool__SectionHead",children:m.jsx("div",{className:"Pool__SectionHeadTitle",children:m.jsxs("div",{className:"Pool__SectionHeadTitleLeft",children:[m.jsx(Ke,{width:40,height:40,borderRadius:12}),m.jsxs("div",{className:"Pool__NameContainer",style:{marginLeft:"16
8931px"},children:[m.jsx(Ke,{width:120,height:24,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:60,height:16,borderRadius:4})]})]})})})})}),m.jsx("div",{className:"Pool__Chart",style:{minHeight:400},children:m.jsx(Ke,{width:"100%",height:400,borderRadius:12})}),m.jsxs("div",{className:"Pool__Statistics",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Metrics"}),m.jsx("div",{className:"Pool__StatCards",children:Array.from({length:4}).map((R,P)=>m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx(Ke,{width:60,height:16,borderRadius:4,style:{marginBottom:"8px"}}),m.jsx(Ke,{width:100,height:24,borderRadius:4})]},P))})]}),t&&m.jsx("div",{className:"Pool__PositionsSection",children:m.jsxs("div",{className:"UserPosition",children:[m.jsx("div",{className:"UserPosition__TopRow",children:m.jsx("h3",{className:"UserPosition__Title",children:"Your Deposits"})}),m.jsx("div",{className:"UserPosition__Loading",children:m.jsx(Ke,{width:"100%",height:80,borderRadius:12})})]})})]}),m.jsx("div",{className:"Pool__Right",children:m.jsx("div",{className:"Pool__SwapForm",children:m.jsx(Ke,{width:"100%",height:500,borderRadius:12})})})]})]}):m.jsxs(Uu,{className:"Pool",children:[m.jsx("div",{className:"Pool__Banner",children:m.jsx(qd,{pools:[],vaults:[]})}),m.jsx("div",{className:"Pool__BreadcrumbsContainer",children:m.jsxs("div",{className:"Pool__Breadcrumbs",children:[m.jsx(gi,{to:"/earn?tab=vaults",className:"Pool__BreadcrumbsLink",children:"Earn"}),m.jsx(qo,{}),m.jsx(gi,{to:"/earn?tab=vaults",className:"Pool__BreadcrumbsLink",children:"Vaults"}),m.jsx(qo,{}),m.jsx("span",{className:"Pool__BreadcrumbsLink__3",children:"Win HONEY"})]})}),m.jsxs("div",{className:"Pool__Content",children:[m.jsxs("div",{className:"Pool__Left",children:[m.jsx("div",{className:"Pool__ChartHead",children:m.jsx("div",{className:"Pool__ChartHeadTop",children:m.jsx("div",{className:"Pool__SectionHead",children:m.jsx("div",{className:"Pool__SectionHeadTitle",children:m.jsxs("div",{className:"Pool__SectionHeadTitleLeft",children:[m.jsx(ws,{logoUri:null,symbol:"HONEY",name:"Honey",id:D0,size:40}),m.jsxs("div",{className:"Pool__NameContainer",children:[m.jsx("a",{href:`https://berascan.com/address/${Am}`,target:"_blank",rel:"noopener noreferrer",className:"Pool__Name Pool__NameLink",title:"Win HONEY - View on Berascan",children:"Win HONEY"}),m.jsx("div",{className:"Pool__Meta",children:m.jsx("span",{className:"Pool__FeeText",style:{color:"rgba(255,255,255,0.6)",fontWeight:400},children:"Lending Vault"})})]})]})})})})}),m.jsx("div",{className:"Pool__Chart",children:m.jsx(w4,{vaultAddress:Am,dataType:"vault",height:400,showToolbar:!0})}),t&&m.jsx("div",{className:"Pool__PositionsSection",children:m.jsx(Yoe,{vaultPositions:k,isLoading:s.isLoading,onDeposit:R=>{d("deposit")},onWithdraw:R=>{d("withdraw")}})}),m.jsxs("div",{className:"Pool__Statistics",children:[m.jsx("h3",{className:"Pool__StatisticsTitle",children:"Metrics"}),m.jsxs("div",{className:"Pool__StatCards",children:[m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"TVL"}),m.jsx("p",{className:"Pool__StatCardLabel",children:s.isLoading?m.jsx(Ke,{width:80,height:20,borderRadius:4}):A>0?`$${An(A)}`:"N/A"})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"Price per Share"}),m.jsx("p",{className:"Pool__StatCardLabel",children:s.isLoading?m.jsx(Ke,{width:80,height:20,borderRadius:4}):s.pricePerShare>0?s.pricePerShare.toFixed(6):"N/A"})]}),m.jsxs("div",{className:"Pool__StatCard",children:[m.jsx("h4",{className:"Pool__StatCardTitle",children:"Deposit APY"}),m.jsx("p",{className:"Pool__StatCardLabel",children:"-"})]})]})]}),m.jsxs("div",{className:"Pool__InfoSection Pool__InfoSection--collateral",children:[m.jsx("h3",{className:"Pool__InfoSectionTitle",children:"Collateral"}),m.jsx("div",{className:"Pool__InfoDetails",children:c.map((R,P)=>m.jsx("div",{className:"Pool__InfoRow",children:m.jsx("span",{className:"Pool__InfoValue",children:m.jsxs("div",{className:"Pool__TokenInfoDetailed",children:[m.jsx(gi,{to:`/tokens/${R.address}`,className:"Pool__TokenLink",children:m.jsxs("div",{className:"Pool__TokenMain",children:[m.jsx(ws,{logoUri:null,symbol:R.symbol,n
8931ame:R.name||R.symbol,id:R.address,size:32}),m.jsx("span",{className:"Pool__TokenSymbol",children:R.symbol})]})}),m.jsx("div",{className:"Pool__TokenAddressContainer",children:m.jsx("a",{className:"Pool__TokenAddress Pool__TokenAddressLink",href:`https://berascan.com/token/${R.address}`,target:"_blank",rel:"noopener noreferrer",onClick:B=>B.stopPropagation(),children:R.address.slice(0,6)+"..."+R.address.slice(-4)})})]})})},P))})]})]}),m.jsx("div",{className:"Pool__Right",children:m.jsx("div",{className:"VaultDetailPage__SwapForm",children:m.jsx(Of,{toggleSidebar:()=>{},initialFromToken:h?{address:h.address,symbol:h.symbol,name:h.symbol,logoUri:h.logoUri,decimals:h.decimals||18}:null,initialToToken:h?{address:h.address,symbol:h.symbol,name:h.symbol,logoUri:h.logoUri,decimals:h.decimals||18}:null,initialMode:l,enableDepositWithdraw:!0,showTitle:!1,isSticky:!0,hideMetrics:!0,vault:p,vaultPosition:{sticky:{shares:s.userBalance||0n,valueUSD:T},autowin:null},isERC4626:!0,erc4626VaultAddress:Am,onSuccess:g})})})]})]})},sJe=()=>{const{vaultAddress:t}=c6();if(!t)return m.jsx(Ky,{to:"/earn?tab=vaults",replace:!0});const{data:e,isLoading:n}=Zt({queryKey:["checkERC4626Vault",t],queryFn:async()=>{var i;try{const r=await fetch("https://sub.winnieswap.com",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 8932 query CheckERC4626Vault($id: String = "") { 8933 erc4626Vault(id: $id) { 8934 id 8935 } 8936 } 8937 `,variables:{id:t.toLowerCase()}})});if(!r.ok)return!1;const o=await r.json();return!!((i=o==null?void 0:o.data)!=null&&i.erc4626Vault)}catch{return!1}},enabled:!!t,staleTime:300*1e3});return n?m.jsx(EY,{}):e?m.jsx(iJe,{}):m.jsx(EY,{})},rJe=()=>{const t=jr();return M.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[t.pathname]),m.jsx("div",{className:"TermsOfServicePage",children:m.jsxs("div",{className:"TermsOfServicePage__container",children:[m.jsx("h1",{className:"TermsOfServicePage__title",children:"Terms of Service"}),m.jsxs("p",{className:"TermsOfServicePage__last-updated",children:["Last Updated: ",new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})]}),m.jsxs("div",{className:"TermsOfServicePage__content",children:[m.jsxs("section",{children:[m.jsx("h2",{children:"1. Introduction"}),m.jsx("p",{children:'Welcome to WinnieSwap. WinnieSwap is operated by Philidor Labs LLC ("we," "our," or "us"). These Terms of Service ("Terms") govern your access to and use of WinnieSwap, a non-custodial decentralized finance (DeFi) interface that provides access to on-chain automated market maker smart contracts and related DeFi protocols.'}),m.jsx("p",{children:"Philidor (the mobile wallet) is operated by the same legal entity, Philidor Labs LLC. This interface is not a third-party centralized exchange and is not operated by a separate company."}),m.jsx("p",{children:"By accessing or using WinnieSwap, you agree to be bound by these Terms. If you do not agree to these Terms, please do not use our services."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"2. Description of Service"}),m.jsx("p",{children:"WinnieSwap is a DeFi liquidity layer platform that enables users to:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Swap tokens across multiple decentralized exchanges"}),m.jsx("li",{children:"Provide liquidity to various pools and earn rewards"}),m.jsx("li",{children:"Access yield-generating vaults including Morpho, Arrakis V1, and Uniswap V3 positions"}),m.jsx("li",{children:"Utilize auto-compounding strategies to maximize yield"}),m.jsx("li",{children:"Explore tokens, pools, and vaults across supported blockchains"}),m.jsx("li",{children:"Track portfolio performance and liquidity positions"})]}),m.jsx("p",{children:"Our platform operates on multiple blockchain networks and interfaces with various smart contracts. You are responsible for understanding the risks associated with DeFi protocols and blockchain technology."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"3. Eligibility"}),m.jsx("p",{children:"To use WinnieSwap, you must:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Be at least 18 years old or the age of majority in your jurisdiction"}),m.jsx("li",{children:"Have the legal capacity to enter into binding agreements"}),m.jsx("li",{children:"Comply with all applicable laws and regulations in your jurisdiction"}),m.jsx("li",{children:"Not be prohibited from using our services under applicable laws"})]})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"4. Use of Service"}),m.jsx("h3",{children:"4.1 Acceptable Use"}),m.jsx("p",{children:"You agree to use WinnieSwap only for lawful purposes and in accordance with these Terms. You agree not to:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Violate any applicable laws or regulations"}),m.jsx("li",{children:"Infringe upon the rights of others"}),m.jsx("li",{children:"Engage in any fraudulent, deceptive, or harmful activities"}),m.jsx("li",{children:"Attempt to gain unauthorized access to our systems or networks"}),m.jsx("li",{children:"Interfere with or disrupt the operation of the platform"}),m.jsx("li",{children:"Use automated systems or bots in a manner that violates these Terms"})]}),m.jsx("h3",{children:"4.2 Wallet Responsibility"}),m.jsx("p",{children:"You are solely responsible for the security of your cryptocurrency wallet and private keys. We do not store, have access to, or control your private keys. Any transactions initiated through your wallet are your sole responsibility."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"5. Risks and Disclaimers"}
8937),m.jsx("h3",{children:"5.1 DeFi Risks"}),m.jsx("p",{children:"Decentralized finance involves significant risks, including but not limited to:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Smart contract vulnerabilities and exploits"}),m.jsx("li",{children:"Impermanent loss in liquidity pools"}),m.jsx("li",{children:"Market volatility and price fluctuations"}),m.jsx("li",{children:"Protocol failures or hacks"}),m.jsx("li",{children:"Regulatory changes affecting DeFi protocols"}),m.jsx("li",{children:"Loss of funds due to user error or technical issues"})]}),m.jsx("h3",{children:"5.2 No Financial Advice"}),m.jsx("p",{children:"WinnieSwap does not provide financial, investment, or trading advice. All information provided on the platform is for informational purposes only. You should conduct your own research and consult with qualified financial advisors before making any investment decisions."}),m.jsx("h3",{children:"5.3 No Guarantees"}),m.jsx("p",{children:"We do not guarantee the accuracy, completeness, or timeliness of any information on the platform. We do not guarantee that the platform will be available at all times or that it will be free from errors, bugs, or interruptions."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"6. Fees and Transactions"}),m.jsx("p",{children:"Certain transactions on WinnieSwap may be subject to fees, including:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Network gas fees charged by the blockchain"}),m.jsx("li",{children:"Protocol fees from underlying DeFi protocols"}),m.jsx("li",{children:"Platform fees as disclosed at the time of transaction"})]}),m.jsx("p",{children:"All fees are non-refundable. You are responsible for all fees associated with your transactions. Transaction fees are determined by the blockchain network and cannot be controlled by WinnieSwap."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"7. Intellectual Property"}),m.jsx("p",{children:"All content, features, and functionality of WinnieSwap, including but not limited to text, graphics, logos, and software, are owned by us or our licensors and are protected by copyright, trademark, and other intellectual property laws."}),m.jsx("p",{children:"You may not reproduce, distribute, modify, or create derivative works of any content from WinnieSwap without our express written permission."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"8. Limitation of Liability"}),m.jsx("p",{children:"TO THE MAXIMUM EXTENT PERMITTED BY LAW, WINNIESWAP AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS OR REVENUES, WHETHER INCURRED DIRECTLY OR INDIRECTLY, OR ANY LOSS OF DATA, USE, GOODWILL, OR OTHER INTANGIBLE LOSSES, RESULTING FROM YOUR USE OF THE PLATFORM."}),m.jsx("p",{children:"OUR TOTAL LIABILITY TO YOU FOR ALL CLAIMS ARISING OUT OF OR RELATING TO THE USE OF WINNIESWAP SHALL NOT EXCEED THE AMOUNT YOU PAID TO US IN THE TWELVE MONTHS PRIOR TO THE EVENT GIVING RISE TO THE LIABILITY."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"9. Indemnification"}),m.jsx("p",{children:"You agree to indemnify, defend, and hold harmless WinnieSwap and its affiliates, officers, directors, employees, and agents from any claims, damages, losses, liabilities, and expenses (including legal fees) arising out of or relating to your use of the platform, violation of these Terms, or infringement of any rights of another party."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"10. Modifications to Terms"}),m.jsx("p",{children:'We reserve the right to modify these Terms at any time. We will notify users of material changes by posting the updated Terms on the platform and updating the "Last Updated" date. Your continued use of WinnieSwap after such modifications constitutes your acceptance of the updated Terms.'})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"11. Termination"}),m.jsx("p",{children:"We may terminate or suspend your access to WinnieSwap at any time, with or without cause or notice, for any reason, including if you breach these Terms. Upon termination, your right to use the platform will immediately cease."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"12. Governing Law"}),m.jsx("p",{children:"These Terms shall be governed by and construed in accordance with the laws of Singapore, without regard to its conflict of law provisions. Any disputes arising out of or relating to these Terms shall be resolved
8937in the courts of Singapore."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"13. Contact Information"}),m.jsx("p",{children:"If you have any questions about these Terms, please contact us at:"}),m.jsxs("p",{children:["Philidor Labs LLC",m.jsx("br",{}),"Email: [email protected]",m.jsx("br",{}),"Website: https://philidor.io"]})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"14. Severability"}),m.jsx("p",{children:"If any provision of these Terms is found to be unenforceable or invalid, that provision shall be limited or eliminated to the minimum extent necessary, and the remaining provisions shall remain in full force and effect."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"15. Entire Agreement"}),m.jsx("p",{children:"These Terms constitute the entire agreement between you and WinnieSwap regarding the use of the platform and supersede all prior agreements and understandings, whether written or oral."})]})]})]})})},oJe=()=>{const t=jr();return M.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[t.pathname]),m.jsx("div",{className:"PrivacyPolicyPage",children:m.jsxs("div",{className:"PrivacyPolicyPage__container",children:[m.jsx("h1",{className:"PrivacyPolicyPage__title",children:"Privacy Policy"}),m.jsxs("p",{className:"PrivacyPolicyPage__last-updated",children:["Last Updated: ",new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})]}),m.jsxs("div",{className:"PrivacyPolicyPage__content",children:[m.jsxs("section",{children:[m.jsx("h2",{children:"1. Introduction"}),m.jsx("p",{children:'Welcome to WinnieSwap. WinnieSwap is operated by Philidor Labs LLC ("we," "our," or "us"). This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our decentralized finance (DeFi) liquidity layer platform.'}),m.jsx("p",{children:"WinnieSwap is committed to protecting your privacy. Please read this Privacy Policy carefully to understand our practices regarding your personal information."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"2. Information We Collect"}),m.jsx("h3",{children:"2.1 Information You Provide"}),m.jsx("p",{children:"We may collect information that you voluntarily provide to us, including:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Wallet addresses when you connect your wallet to the platform"}),m.jsx("li",{children:"Transaction preferences and settings"}),m.jsx("li",{children:"Feedback, support requests, or communications with us"})]}),m.jsxs("p",{style:{color:"rgba(255, 255, 255, 0.7)",fontSize:"14px",fontStyle:"italic",marginTop:"16px"},children:[m.jsx("strong",{children:"Note:"})," While we may have access to this information, we do not use or store wallet addresses or transaction preferences beyond what is necessary for the platform to function. This information is processed locally in your browser and is not transmitted to our servers."]}),m.jsx("h3",{children:"2.2 Automatically Collected Information"}),m.jsx("p",{children:"When you use WinnieSwap, we may automatically collect certain information, including:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"IP address and location data"}),m.jsx("li",{children:"Browser type and version"}),m.jsx("li",{children:"Device information"}),m.jsx("li",{children:"Usage patterns and interactions with the platform"}),m.jsx("li",{children:"On-chain transaction data (publicly available on the blockchain)"})]}),m.jsxs("p",{style:{color:"rgba(255, 255, 255, 0.7)",fontSize:"14px",fontStyle:"italic",marginTop:"16px"},children:[m.jsx("strong",{children:"Note:"})," While this information may be accessible to us, we do not use, store, or retain IP addresses, location data, browser information, device information, usage patterns, or on-chain transaction data. This information is processed locally in your browser and is not transmitted to or stored on our servers."]}),m.jsx("h3",{children:"2.3 Blockchain Data"}),m.jsx("p",{children:"Since WinnieSwap operates on public blockchains, all on-chain transactions are publicly visible. We may access and display publicly available blockchain data related to your wallet address when you connect it to our platform."}),m.jsxs("p",{style:{color:"rgba(255, 255, 255, 0.7)",fontSize:"14px",fontStyle:"italic",marginTop:"16px"},children:[m.jsx("strong",{children:"Important:"})," While we may access publicly available blockchain data to display your portfolio and transaction history within the platform, we do not use, store, or retain this data on our servers. All blockchain data is fetched in real-time and displayed locally in your browser. We do not maintain any database or storage of your on-chain transaction history or wallet activity."]})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"3. How We Use Your Information"}),m.jsx("p",{children:"We use the information we collect to:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Provide, maintain, and improve our services"}),m.jsx("li",{children:"Process transactions and facilitate DeFi operations"}),m.jsx("li",{children:"Display your portfolio, positions, and transaction history"}),m.jsx("li",{children:"Personalize your experience on the platform"}),m.jsx("li",{children:"Monitor and analyze usage patterns to improve our services"}),m.jsx("li",{children:"Detect, prevent, and address technical issues or fraudulent activity"}),m.jsx("li",{children:"Comply with legal obligations and enforce our Terms of Service"}),m.jsx("li",{children:"Communicate with you about updates, security alerts, or support requests"})]})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"4. Information Sharing and Disclosure"}),m.jsx("h3",{children:"4.1 Public Blockchain Data"}),m.jsx("p",{children:"Transactions executed on the blockchain are publicly visible. When you interact with DeFi protocols through WinnieSwap, your wallet address and transaction details become part of the public blockchain record."}),m.jsx("h3",{children:"4.2 Service Providers"}),m.jsx("p",{children:"We may share your information with third-party service providers who assist us in operating the platform, including:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Blockchain infrastru
8937cture providers"}),m.jsx("li",{children:"Analytics and data processing services"}),m.jsx("li",{children:"Cloud hosting and storage providers"}),m.jsx("li",{children:"Customer support services"})]}),m.jsx("h3",{children:"4.3 Legal Requirements"}),m.jsx("p",{children:"We may disclose your information if required by law, court order, or governmental authority, or if we believe disclosure is necessary to protect our rights, property, or safety, or that of our users or others."}),m.jsx("h3",{children:"4.4 Business Transfers"}),m.jsx("p",{children:"In the event of a merger, acquisition, or sale of assets, your information may be transferred to the acquiring entity."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"5. Wallet Connection and Private Keys"}),m.jsxs("p",{children:[m.jsx("strong",{children:"IMPORTANT:"})," WinnieSwap does not store, have access to, or control your private keys, seed phrases, or wallet passwords. When you connect your wallet to our platform, we only access your public wallet address and request permission to initiate transactions on your behalf."]}),m.jsx("p",{children:"You are solely responsible for the security of your wallet and private keys. We strongly recommend:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Never sharing your private keys or seed phrases with anyone"}),m.jsx("li",{children:"Using hardware wallets for enhanced security"}),m.jsx("li",{children:"Verifying all transaction details before confirming"}),m.jsx("li",{children:"Keeping your wallet software updated"})]})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"6. Cookies and Tracking Technologies"}),m.jsx("p",{children:"We use cookies and similar tracking technologies to enhance your experience on WinnieSwap. These technologies help us:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Remember your preferences and settings"}),m.jsx("li",{children:"Analyze how you use the platform"}),m.jsx("li",{children:"Improve our services and user experience"})]}),m.jsx("p",{children:"You can control cookies through your browser settings. However, disabling cookies may limit your ability to use certain features of the platform."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"7. Data Security"}),m.jsx("p",{children:"We implement appropriate technical and organizational measures to protect your information against unauthorized access, alteration, disclosure, or destruction. However, no method of transmission over the internet or electronic storage is 100% secure."}),m.jsx("p",{children:"While we strive to protect your information, we cannot guarantee absolute security. You acknowledge that you provide information at your own risk."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"8. Third-Party Services"}),m.jsx("p",{children:"WinnieSwap integrates with various third-party services and DeFi protocols, including:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"Uniswap V3"}),m.jsx("li",{children:"Morpho"}),m.jsx("li",{children:"Arrakis V1"}),m.jsx("li",{children:"Auto-compounding vaults"}),m.jsx("li",{children:"Wallet providers (MetaMask, WalletConnect, etc.)"})]}),m.jsx("p",{children:"These third-party services have their own privacy policies. We encourage you to review their privacy policies to understand how they handle your information."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"9. Your Rights and Choices"}),m.jsx("p",{children:"Depending on your jurisdiction, you may have certain rights regarding your personal information, including:"}),m.jsxs("ul",{children:[m.jsx("li",{children:"The right to access your personal information"}),m.jsx("li",{children:"The right to correct inaccurate information"}),m.jsx("li",{children:"The right to request deletion of your information"}),m.jsx("li",{children:"The right to object to processing of your information"}),m.jsx("li",{children:"The right to data portability"})]}),m.jsx("p",{children:"To exercise these rights, please contact us at the email address provided in the Contact Information section."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"10. Children's Privacy"}),m.jsx("p",{children:"WinnieSwap is not intended for users under the age of 18. We do not knowingly collect personal information from children. If you believe we have collected information from a child, please contact us immediately."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"11. International Data Transfers"}),m.jsx("p",{children:"Your information may be transferred to and processed in countries other than your country of residence. The
8937se countries may have data protection laws that differ from those in your country. By using WinnieSwap, you consent to the transfer of your information to these countries."})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"12. Changes to This Privacy Policy"}),m.jsx("p",{children:'We may update this Privacy Policy from time to time. We will notify you of material changes by posting the updated Privacy Policy on the platform and updating the "Last Updated" date. Your continued use of WinnieSwap after such changes constitutes your acceptance of the updated Privacy Policy.'})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"13. Contact Information"}),m.jsx("p",{children:"If you have any questions, concerns, or requests regarding this Privacy Policy or our privacy practices, please contact us at:"}),m.jsxs("p",{children:["Philidor Labs LLC",m.jsx("br",{}),"Email: [email protected]",m.jsx("br",{}),"Website: https://philidor.io"]})]}),m.jsxs("section",{children:[m.jsx("h2",{children:"14. Your Consent"}),m.jsx("p",{children:"By using WinnieSwap, you consent to the collection, use, and disclosure of your information as described in this Privacy Policy."})]})]})]})})},aJe=(t={})=>{const{loadingDelay:e=0,minimumLoadingTime:n=200}=t,[i,s]=M.useState(!1),r=jr();return M.useEffect(()=>{const a=()=>{s(!0)},c=()=>{setTimeout(()=>{s(!1)},n)},l=setTimeout(a,e),d=setTimeout(c,n);return()=>{clearTimeout(l),clearTimeout(d)}},[r.pathname,e,n]),{isLoading:i,setLoading:a=>{s(a)}}},Hx="winnieswap_pending_referral",AY="winnieswap_applied_referrals";function cJe(){const{address:t,isConnected:e}=mn(),{signMessageAsync:n}=wte(),i=mXe(),s=M.useRef(!1),r=M.useCallback(()=>{try{const c=localStorage.getItem(AY);return c?JSON.parse(c):[]}catch{return[]}},[]),o=M.useCallback(c=>{try{const l=r();l.includes(c.toLowerCase())||(l.push(c.toLowerCase()),localStorage.setItem(AY,JSON.stringify(l)))}catch(l){console.error("Failed to mark referral as applied:",l)}},[r]),a=M.useCallback(async(c,l)=>{if(!(!c.trim()||!l||!n))try{const d=await n({message:c.trim()});await i.mutateAsync({referralCode:c.trim(),signature:d}),o(c.trim()),localStorage.removeItem(Hx)}catch(d){console.error("Failed to auto-apply referral code:",d)}},[n,i,o]);M.useEffect(()=>{if(typeof window>"u")return;const l=new URLSearchParams(window.location.search).get("ref");if(l){if(e&&t)s.current=!1,a(l,t);else try{localStorage.setItem(Hx,l),console.log("[Referral] Code stocké, sera appliqué à la connexion du wallet:",l)}catch(h){console.error("Failed to store referral code:",h)}if(!(window.location.pathname==="/porfolio"||window.location.pathname==="/porfolio/")){const h=new URL(window.location.href);h.searchParams.delete("ref"),window.history.replaceState({},"",h.toString())}}},[e,t,a]),M.useEffect(()=>{if(!e||!t){s.current=!1;return}if(s.current)return;const c=localStorage.getItem(Hx);if(!c)return;if(r().includes(c.toLowerCase())){localStorage.removeItem(Hx),s.current=!0,console.log("[Referral] Code déjà appliqué précédemment:",c);return}console.log("[Referral] Application automatique du code à la connexion:",c),a(c,t),s.current=!0},[e,t,a,r])}const wo={historicalStaleTime:3600*1e3,currentStaleTime:300*1e3,gcTime:1440*60*1e3};function lJe(){const t=Kc(),{address:e}=mn();M.useEffect(()=>{uJe(t,e);const n=setInterval(()=>{fJe(t)},3600*1e3);return()=>{clearInterval(n)}},[t,e])}async function uJe(t,e){await mJe(t,e),Promise.allSettled([dJe(t),e?gJe(t,e):Promise.resolve(),pJe(t)]).then(()=>{}).catch(()=>{}),setTimeout(()=>{hJe(t).catch(()=>{})},2e3)}async function dJe(t){const e="https://sub.winnieswap.com";t.getQueryData(["tokensStats","","server","volumeUSD","desc",null,null])||t.prefetchInfiniteQuery({queryKey:["tokensStats","","server","volumeUSD","desc",null,null],queryFn:async({pageParam:n})=>{var r;const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 8938 query GetTokensStats($limit: Int!, $after: String, $orderBy: String!, $orderDirection: String!) { 8939 tokens(limit: $limit, after: $after, orderBy: $orderBy, orderDirection: $orderDirection) { 8940 totalCount 8941 pageInfo { 8942 endCursor 8943 hasNextPage 8944 } 8945 items { 8946 feesUSD 8947 id 8948 name 8949 totalSupply 8950 volumeUSD 8951 symbol 8952 logoUri 8953 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8954 items { 8955 priceUSD 8956 oneDayEvo 8957 oneMonthEvo 8958 oneWeekEvo 8959 marketCap 8960 } 8961 } 8962 } 8963 } 8964 } 8965 `,variables:{limit:50,after:n||null,orderBy:"volumeUSD",orderDirection:"desc"}})});if(!i.ok)throw new Error("Failed to fetch tokens");const s=await i.json();if(!((r=s.data)!=null&&r.tokens))throw new Error("No tokens data");return s.data.tokens},getNextPageParam:n=>{var i;return(i=n==null?void 0:n.pageInfo)!=null&&i.hasNextPage?n.pageInfo.endCursor:void 0},initialPageParam:null,staleTime:wo.currentStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:n=>n}).catch(()=>{}),t.getQueryData(["poolStats","","server","totalValueLockedUSD","desc",null,null])||t.prefetchInfiniteQuery({queryKey:["poolStats","","server","totalValueLockedUSD","desc",null,null],queryFn:async({pageParam:n})=>{var r;const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 8966 query GetPoolsStats($limit: Int!, $after: String, $orderBy: String!, $orderDirection: String!) { 8967 pools(limit: $limit, after: $after, orderBy: $orderBy, orderDirection: $orderDirection) { 8968 totalCount 8969 pageInfo { 8970 endCursor 8971 hasNextPage 8972 } 8973 items { 8974 feeTier 8975 id 8976 liquidity 8977 totalValueLockedUSD 8978 volumeUSD 8979 token0Ref { 8980 name 8981 id 8982 symbol 8983 logoUri 8984 } 8985 token1Ref { 8986 id 8987 name 8988 symbol 8989 logoUri 8990 } 8991 poolDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 8992 items { 8993 tvlUSD 8994 volumeUSD 8995 apr 8996 volumeUSD1D 8997 volumeUSD30D 8998 } 8999 } 9000 } 9001 } 9002 } 9003 `,variables:{limit:50,after:n||null,orderBy:"totalValueLockedUSD",orderDirection:"desc"}})});if(!i.ok)throw new Error("Failed to fetch pools");const s=await i.json();if(!((r=s.data)!=null&&r.pools))throw new Error("No pools data");return s.data.pools},getNextPageParam:n=>{var i;return(i=n==null?void 0:n.pageInfo)!=null&&i.hasNextPage?n.pageInfo.endCursor:void 0},initialPageParam:null,staleTime:wo.currentStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:n=>n}).catch(()=>{}),t.getQueryData(["vaults",""])||t.prefetchQuery({queryKey:["vaults",""],queryFn:async()=>{var s;const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9004 query GetStickyVaults($user: String = "") { 9005 stickyVaults { 9006 items { 9007 id 9008 name 9009 totalValueLockedUSD 9010 poolRef { 9011 token1Ref { 9012 id 9013 logoUri 9014 name 9015 symbol 9016 } 9017 token0Ref { 9018 id 9019 logoUri 9020 name 9021 symbol 9022 } 9023 } 9024 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 9025 items { 9026 apr 9027 maxPotentialAPR 9028 volumeUSD1D 9029 volumeUSD30D 9030 } 9031 } 9032 } 9033 } 9034 } 9035 `,variables:{user:""}})});if(!n.ok)throw new Error("Failed to fetch vaults");const i=await n.json();if(!((s=i.data)!=null&&s.stickyVaults))throw new Error("No vaults data");return i.data.stickyVaults},staleTime:wo.currentStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:n=>n}).catch(()=>{}),t.getQueryData(["transactions",""])||t.prefetchInfiniteQuery({queryKey:["transactions",""],queryFn:async({pageParam:n})=>{var r;const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9036 query GetTransactionsFast($limit: Int!, $after: String) { 9037 transactions(orderBy: "timestamp", orderDirection: "desc", limit: $limit, after: $after) { 9038 totalCount 9039 pageInfo { 9040 endCursor 9041 hasNextPage 9042 } 9043 items { 9044 id 9045 timestamp 9046 swaps { 9047 items { 9048 amount1 9049 amount0 9050 amountUSD 9051 recipient 9052 pool { 9053 id 9054 token0Ref { 9055 symbol 9056 id 9057 logoUri 9058 decimals 9059 } 9060 token1Ref { 9061 symbol 9062 id 9063 logoUri 9064 decimals 9065 } 9066 } 9067 } 9068 } 9069 } 9070 } 9071 } 9072 `,variables:{limit:50,after:n||null}})});if(!i.ok)throw new Error("Failed to fetch transactions");const s=await i.json();if(!((r=s.data)!=null&&r.transactions))throw new Error("No transactions data");return s.data.transactions},getNextPageParam:n=>{var i;return(i=n==null?void 0:n.pageInfo)!=null&&i.hasNextPage?n.pageInfo.endCursor:void 0},initialPageParam:null,staleTime:wo.currentStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:n=>n}).catch(()=>{})}async function hJe(t){var n,i,s,r,o,a;const e="https://sub.winnieswap.com";try{const c=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9073 query GetTopTokens { 9074 tokens(limit: 10, orderBy: "volumeUSD", orderDirection: "desc") { 9075 items { 9076 id 9077 } 9078 } 9079 } 9080 `})}),l=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9081 query GetTopPools { 9082 pools(limit: 10, orderBy: "totalValueLockedUSD", orderDirection: "desc") { 9083 items { 9084 id 9085 } 9086 } 9087 } 9088 `})}),d=await c.json(),h=await l.json(),p=((s=(i=(n=d.data)==null?void 0:n.tokens)==null?void 0:i.items)==null?void 0:s.map(E=>E.id))||[],g=((a=(o=(r=h.data)==null?void 0:r.pools)==null?void 0:o.items)==null?void 0:a.map(E=>E.id))||[],b=["1D"],w=["price"],C=[];p.forEach(E=>{b.forEach(T=>
9088{w.forEach(A=>{const k=["ponder-chart-data",E,A,"area",T,null,null];t.getQueryData(k)||C.push(t.prefetchQuery({queryKey:k,queryFn:async()=>{var q,G;const P={"1H":{period:"hour",limit:24},"4H":{period:"hour",limit:168,sampling:4},"1D":{period:"hour",limit:72},"1W":{period:"hour",limit:168,sampling:4},"1M":{period:"day",limit:90},"1Y":{period:"day",limit:365},ALL:{period:"day",limit:1e3}}[T],B=P.period==="hour"?"tokenHourDatas":"tokenDayDatas",F=P.period==="hour"?"periodStartUnix":"date",z=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9089 query GetTokenChartData { 9090 ${B}( 9091 where: { token: "${E}" } 9092 orderBy: "${F}" 9093 orderDirection: "desc" 9094 limit: ${P.limit} 9095 ) { 9096 items { 9097 id 9098 ${F} 9099 priceUSD 9100 volumeUSD 9101 totalValueLockedUSD 9102 } 9103 } 9104 } 9105 `})});if(!z.ok)throw new Error("Failed to fetch chart data");return((G=(q=(await z.json()).data)==null?void 0:q[B])==null?void 0:G.items)||[]},staleTime:wo.historicalStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:R=>R}).catch(()=>{}))})})}),g.forEach(E=>{b.forEach(T=>{w.forEach(A=>{const k=["ponder-chart-data",E,A,"area",T,null,null];t.getQueryData(k)||C.push(t.prefetchQuery({queryKey:k,queryFn:async()=>{var q,G;const P={"1H":{period:"hour",limit:24},"4H":{period:"hour",limit:168,sampling:4},"1D":{period:"hour",limit:72},"1W":{period:"hour",limit:168,sampling:4},"1M":{period:"day",limit:90},"1Y":{period:"day",limit:365},ALL:{period:"day",limit:1e3}}[T],B=P.period==="hour"?"poolHourDatas":"poolDayDatas",F=P.period==="hour"?"periodStartUnix":"date",z=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9106 query GetPoolChartData { 9107 ${B}( 9108 where: { pool: "${E}" } 9109 orderBy: "${F}" 9110 orderDirection: "desc" 9111 limit: ${P.limit} 9112 ) { 9113 items { 9114 id 9115 ${F} 9116 tvlUSD 9117 volumeUSD 9118 token0Price 9119 token1Price 9120 } 9121 } 9122 } 9123 `})});if(!z.ok)throw new Error("Failed to fetch chart data");return((G=(q=(await z.json()).data)==null?void 0:q[B])==null?void 0:G.items)||[]},staleTime:wo.historicalStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:R=>R}).catch(()=>{}))})})}),await Promise.allSettled(C)}catch{}}async function fJe(t){t.invalidateQueries({queryKey:["ponder-chart-data"],refetchType:"active"})}async function pJe(t){const e="https://api.winnieswap.com";t.getQueryData(["leaderboard-list-infinite","20"])||t.prefetchInfiniteQuery({queryKey:["leaderboard-list-infinite","20"],queryFn:async()=>{const n=e.replace(/\/$/,""),i=new URLSearchParams({page:"1",limit:"20"}),s=`${n}/leaderboard?${i.toString()}`,r=await fetch(s,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok)throw new Error("Failed to fetch leaderboard");return r.json()},getNextPageParam:n=>
9123{const i=n.page||1,s=Math.ceil((n.total||0)/20);return i<s?i+1:void 0},initialPageParam:1,staleTime:wo.currentStaleTime}).catch(()=>{})}async function mJe(t,e){const n="https://api.winnieswap.com";t.getQueryData(["tokens-in-pool-no-balances",e])||t.prefetchQuery({queryKey:["tokens-in-pool-no-balances",e],queryFn:async()=>{try{const i=await fetch(`${n}/token/list-with-balances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.json()}catch(i){const s=(i==null?void 0:i.message)||String(i);if(i instanceof TypeError||s.includes("ERR_CONNECTION_REFUSED")||s.includes("Failed to fetch")||s.includes("NetworkError")){const r=new Error("Backend server is not accessible");throw r.isConnectionError=!0,r}throw i}},staleTime:300*1e3,retry:1,retryDelay:1e3}).catch(()=>{}),e&&!t.getQueryData(["tokens-in-pool",e])&&t.prefetchQuery({queryKey:["tokens-in-pool",e],queryFn:async()=>{try{const i=await fetch(`${n}/token/list-with-balances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({walletAddress:e})});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.json()}catch(i){const s=(i==null?void 0:i.message)||String(i);if(i instanceof TypeError||s.includes("ERR_CONNECTION_REFUSED")||s.includes("Failed to fetch")||s.includes("NetworkError")){const r=new Error("Backend server is not accessible");throw r.isConnectionError=!0,r}throw i}},staleTime:300*1e3,retry:(i,s)=>{var r,o;return s!=null&&s.isConnectionError||(r=s==null?void 0:s.message)!=null&&r.includes("not accessible")||(o=s==null?void 0:s.message)!=null&&o.includes("ERR_CONNECTION_REFUSED")?!1:i<1},retryDelay:1e3}).catch(()=>{})}async function gJe(t,e){const n="https://sub.winnieswap.com";t.getQueryData(["positions",e])||t.prefetchQuery({queryKey:["positions",e],queryFn:async()=>{var r;const i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9124 query GetTransactions($owner: String) { 9125 positions(where: {owner: $owner}) { 9126 items { 9127 id 9128 pool 9129 poolRef { 9130 id 9131 sqrtPrice 9132 tick 9133 liquidity 9134 token0Ref { 9135 logoUri 9136 id 9137 name 9138 symbol 9139 decimals 9140 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 9141 items { 9142 priceUSD 9143 } 9144 } 9145 } 9146 token1Ref { 9147 id 9148 logoUri 9149 name 9150 symbol 9151 decimals 9152 tokenDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 9153 items { 9154 priceUSD 9155 } 9156 } 9157 } 9158 feeTier 9159 poolDayData(limit: 1, orderBy: "date", orderDirection: "desc") { 9160 items { 9161 apr 9162 } 9163 } 9164 } 9165 tokenId 9166 tickLower 9167 tickUpper 9168 withdrawnToken1 9169 withdrawnToken0 9170 depositedToken0 9171 depositedToken1 9172 liquidity 9173 } 9174 } 9175 } 9176 `,variables:{owner:e}})});if(!i.ok)throw new Error("Failed to fetch positions");const s=await i.json();if(!((r=s.data)!=null&&r.positions))throw new Error("No positions data");return s.data.positions.items},staleTime:wo.currentStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:i=>i}).catch(()=>{}),t.getQueryData(["vaultPositions",e])||t.prefetchQuery({queryKey:["vaultPositions",e],queryFn:async()=>{var r;const i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:` 9177 query GetUserVaultPositions($user: String) { 9178 stickyVaults { 9179 items { 9180 id 9181 name 9182 totalValueLockedUSD 9183 autoWinVault 9184 autoWinVaultRef { 9185 id 9186 estimatedAPR 9187 positions(where: {user: $user}) { 9188 items { 9189 user 9190 shares 9191 firstDepositAt 9192 lastUpdateAt 9193 } 9194 } 9195 } 9196 vaultDayData(orderBy: "date", orderDirection: "desc", limit: 1) { 9197 items { 9198 apr 9199 maxPotentialAPR 9200 } 9201 } 9202 poolRef { 9203 feeTier 9204 token0Ref { 9205 id 9206 name 9207 symbol 9208 logoUri 9209 decimals 9210 } 9211 token1Ref { 9212 id 9213 name 9214 symbol 9215 logoUri 9216 decimals 9217 } 9218 } 9219 positions(where: {user: $user}) { 9220 items { 9221 id 9222 user 9223 shares 9224 depositedToken0 9225 depositedToken1 9226 currentValueToken0 9227 currentValueToken1 9228 currentValueUSD 9229 feesEarnedUSD 9230 realizedPnLUSD 9231 initialValueUSD 9232 totalPnLUSD 9233 } 9234 } 9235 } 9236 } 9237 } 9238 `,variables:{user:e.toLowerCase()}})});if(!i.ok)throw new Error("Failed to fetch vault positions");const s=await i.json();if(!((r=s.data)!=null&&r.stickyVaults))throw new Error("No vault positions data");return s.data.stickyVaults.items},staleTime:wo.currentStaleTime,gcTime:wo.gcTime,refetchOnMount:!1,refetchOnWindowFocus:!1,placeholderData:i=>i}).catch(()=>{})}var yJe=Object.defineProperty,b8=Object.getOwnPropertySymbols,Zoe=Object.prototype.hasOwnProperty,Qoe=Object.prototype.propertyIsEnumerable,TY=(t,e,n)=>e in t?yJe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,YI=(t,e)=>{for(var n in e||(e={}))Zoe.call(e,n)&&TY(t,n,e[n]);if(b8)for(var n of b8(e))Qoe.call(e,n)&&TY(t,n,e[n]);return t},ZI=(t,e)=>{var n={};for(var i in t)Zoe.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&b8)for(var i of b8(t))e.indexOf(i)<0&&Qoe.call(t,i)&&(n[i]=t[i]);return n};/** 9239 * @license QR Code generator library (TypeScript) 9240 * Copyright (c) Project Nayuki. 9241 * SPDX-License-Identifier: MIT 9242 */var h1;(t=>{const e=class ci{constructor(c,l,d,h){if(this.version=c,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],c<ci.MIN_VERSION||c>ci.MAX_VERSION)throw new RangeError("Version value out of range");if(h<-1||h>7)throw new RangeError("Mask value out of range");this.size=c*4+17;let p=[];for(let b=0;b<this.size;b++)p.push(!1);for(let b=0;b<this.size;b++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const g=this.addEccAndInterleave(d);if(this.drawCodewords(g),h==-1){let b=1e9;for(let w=0;w<8;w++){this.applyMask(w),this.drawFormatBits(w);const C=this.getPenaltyScore();C<b&&(h=w,b=C),this.applyMask(w)}}s(0<=h&&h<=7),this.mask=h,this.applyMask(h),this.drawFormatBits(h),this.isFunction=[]}static encodeText(c,l){const d=t.QrSegment.makeSegments(c);return ci.encodeSegments(d,l)}static encodeBinary(c,l){const d=t.QrSegment.makeBytes(c);return ci.encodeSegments([d],l)}static encodeSegments(c,l,d=1,h=40,p=-1,g=!0){if(!(ci.MIN_VERSION<=d&&d<=h&&h<=ci.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let b,w;for(b=d;;b++){const A=ci.getNumDataCodewords(b,l)*8,k=o.getTotalBits(c,b);if(k<=A){w=k;break}if(b>=h)throw new RangeError("Data too long")}for(const A of[ci.Ecc.MEDIUM,ci.Ecc.QUARTILE,ci.Ecc.HIGH])g&&w<=ci.getNumDataCodewords(b,A)*8&&(l=A);let C=[];
9242for(const A of c){n(A.mode.modeBits,4,C),n(A.numChars,A.mode.numCharCountBits(b),C);for(const k of A.getData())C.push(k)}s(C.length==w);const E=ci.getNumDataCodewords(b,l)*8;s(C.length<=E),n(0,Math.min(4,E-C.length),C),n(0,(8-C.length%8)%8,C),s(C.length%8==0);for(let A=236;C.length<E;A^=253)n(A,8,C);let T=[];for(;T.length*8<C.length;)T.push(0);return C.forEach((A,k)=>T[k>>>3]|=A<<7-(k&7)),new ci(b,l,T,p)}getModule(c,l){return 0<=c&&c<this.size&&0<=l&&l<this.size&&this.modules[l][c]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const c=this.getAlignmentPatternPositions(),l=c.length;for(let d=0;d<l;d++)for(let h=0;h<l;h++)d==0&&h==0||d==0&&h==l-1||d==l-1&&h==0||this.drawAlignmentPattern(c[d],c[h]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(c){const l=this.errorCorrectionLevel.formatBits<<3|c;let d=l;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const h=(l<<10|d)^21522;s(h>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,i(h,p));this.setFunctionModule(8,7,i(h,6)),this.setFunctionModule(8,8,i(h,7)),this.setFunctionModule(7,8,i(h,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,i(h,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,i(h,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,i(h,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let c=this.version;for(let d=0;d<12;d++)c=c<<1^(c>>>11)*7973;const l=this.version<<12|c;s(l>>>18==0);for(let d=0;d<18;d++){const h=i(l,d),p=this.size-11+d%3,g=Math.floor(d/3);this.setFunctionModule(p,g,h),this.setFunctionModule(g,p,h)}}drawFinderPattern(c,l){for(let d=-4;d<=4;d++)for(let h=-4;h<=4;h++){const p=Math.max(Math.abs(h),Math.abs(d)),g=c+h,b=l+d;0<=g&&g<this.size&&0<=b&&b<this.size&&this.setFunctionModule(g,b,p!=2&&p!=4)}}drawAlignmentPattern(c,l){for(let d=-2;d<=2;d++)for(let h=-2;h<=2;h++)this.setFunctionModule(c+h,l+d,Math.max(Math.abs(h),Math.abs(d))!=1)}setFunctionModule(c,l,d){this.modules[l][c]=d,this.isFunction[l][c]=!0}addEccAndInterleave(c){const l=this.version,d=this.errorCorrectionLevel;if(c.length!=ci.getNumDataCodewords(l,d))throw new RangeError("Invalid argument");const h=ci.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][l],p=ci.ECC_CODEWORDS_PER_BLOCK[d.ordinal][l],g=Math.floor(ci.getNumRawDataModules(l)/8),b=h-g%h,w=Math.floor(g/h);let C=[];const E=ci.reedSolomonComputeDivisor(p);for(let A=0,k=0;A<h;A++){let R=c.slice(k,k+w-p+(A<b?0:1));k+=R.length;const P=ci.reedSolomonComputeRemainder(R,E);A<b&&R.push(0),C.push(R.concat(P))}let T=[];for(let A=0;A<C[0].length;A++)C.forEach((k,R)=>{(A!=w-p||R>=b)&&T.push(k[A])});return s(T.length==g),T}drawCodewords(c){if(c.length!=Math.floor(ci.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let h=0;h<this.size;h++)for(let p=0;p<2;p++){const g=d-p,w=(d+1&2)==0?this.size-1-h:h;!this.isFunction[w][g]&&l<c.length*8&&(this.modules[w][g]=i(c[l>>>3],7-(l&7)),l++)}}s(l==c.length*8)}applyMask(c){if(c<0||c>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let d=0;d<this.size;d++){let h;switch(c){case 0:h=(d+l)%2==0;break;case 1:h=l%2==0;break;case 2:h=d%3==0;break;case 3:h=(d+l)%3==0;break;case 4:h=(Math.floor(d/3)+Math.floor(l/2))%2==0;break;case 5:h=d*l%2+d*l%3==0;break;case 6:h=(d*l%2+d*l%3)%2==0;break;case 7:h=((d+l)%2+d*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][d]&&h&&(this.modules[l][d]=!this.modules[l][d])}}getPenaltyScore(){let c=0;for(let p=0;p<this.size;p++){let g=!1,b=0,w=[0,0,0,0,0,0,0];for(let C=0;C<this.size;C++)this.modules[p][C]==g?(b++,b==5?c+=ci.PENALTY_N1:b>5&&c++):(this.finderPenaltyAddHistory(b,w),g||(c+=this.finderPenaltyCountPatterns(w)*ci.PENALTY_N3),g=this.modules[p][C],b=1);c+=this.finderPenaltyTerminateAndCount(g,b,w)*ci.PENALTY_N3}for(let p=0;p<this.size;p++){let g=!1,b=0,w=[0,0,0,0,0,0,0];for(let C=0;C<this.size;C++)this.modules[C][p]==g?(b++,b==5?c+=ci.PENALTY_N1:b>5&&c++):(this.finderPenaltyAddHistory(b,w),g||(c+=this.finderPenaltyCountPatterns(w)*ci.PENA
9242LTY_N3),g=this.modules[C][p],b=1);c+=this.finderPenaltyTerminateAndCount(g,b,w)*ci.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let g=0;g<this.size-1;g++){const b=this.modules[p][g];b==this.modules[p][g+1]&&b==this.modules[p+1][g]&&b==this.modules[p+1][g+1]&&(c+=ci.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((g,b)=>g+(b?1:0),l);const d=this.size*this.size,h=Math.ceil(Math.abs(l*20-d*10)/d)-1;return s(0<=h&&h<=9),c+=h*ci.PENALTY_N4,s(0<=c&&c<=2568888),c}getAlignmentPatternPositions(){if(this.version==1)return[];{const c=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(c*2-2))*2;let d=[6];for(let h=this.size-7;d.length<c;h-=l)d.splice(1,0,h);return d}}static getNumRawDataModules(c){if(c<ci.MIN_VERSION||c>ci.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*c+128)*c+64;if(c>=2){const d=Math.floor(c/7)+2;l-=(25*d-10)*d-55,c>=7&&(l-=36)}return s(208<=l&&l<=29648),l}static getNumDataCodewords(c,l){return Math.floor(ci.getNumRawDataModules(c)/8)-ci.ECC_CODEWORDS_PER_BLOCK[l.ordinal][c]*ci.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][c]}static reedSolomonComputeDivisor(c){if(c<1||c>255)throw new RangeError("Degree out of range");let l=[];for(let h=0;h<c-1;h++)l.push(0);l.push(1);let d=1;for(let h=0;h<c;h++){for(let p=0;p<l.length;p++)l[p]=ci.reedSolomonMultiply(l[p],d),p+1<l.length&&(l[p]^=l[p+1]);d=ci.reedSolomonMultiply(d,2)}return l}static reedSolomonComputeRemainder(c,l){let d=l.map(h=>0);for(const h of c){const p=h^d.shift();d.push(0),l.forEach((g,b)=>d[b]^=ci.reedSolomonMultiply(g,p))}return d}static reedSolomonMultiply(c,l){if(c>>>8||l>>>8)throw new RangeError("Byte out of range");let d=0;for(let h=7;h>=0;h--)d=d<<1^(d>>>7)*285,d^=(l>>>h&1)*c;return s(d>>>8==0),d}finderPenaltyCountPatterns(c){const l=c[1];s(l<=this.size*3);const d=l>0&&c[2]==l&&c[3]==l*3&&c[4]==l&&c[5]==l;return(d&&c[0]>=l*4&&c[6]>=l?1:0)+(d&&c[6]>=l*4&&c[0]>=l?1:0)}finderPenaltyTerminateAndCount(c,l,d){return c&&(this.finderPenaltyAddHistory(l,d),l=0),l+=this.size,this.finderPenaltyAddHistory(l,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(c,l){l[0]==0&&(c+=this.size),l.pop(),l.unshift(c)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],t.QrCode=e;function n(a,c,l){if(c<0||c>31||a>>>c)throw new RangeError("Value out of range");for(let d=c-1;d>=0;d--)l.push(a>>>d&1)}function i(a,c){return(a>>>c&1)!=0}function s(a){if(!a)throw new Error("Assertion error")}const r=class qs{constructor(c,l,d){if(this.mode=c,this.numChars=l,this.bitData=d,l<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(c){let l=[];for(const d of c)n(d,8,l);return new qs(qs.Mode.BYTE,c.length,l)}static makeNumeric(c){if(!qs.isNumeric(c))throw new RangeError("String contains non-numeric characters");let l=[];for(let d=0;d<c.length;){const h=Math.min(c.length-d,3);n(parseInt(c.substring(d,d+h),10),h*3+1,l),d+=h}return new qs(qs.Mode.NUMERIC,c.length,l)}static makeAlphanumeric(c){if(!qs.isAlphanumeric(c))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],d;for(d=0;d+2<=c.length;d+=2){let h=qs.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d))*45;h+=qs.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d+1)),n(h,11,l)}return d<c.length&&n(qs.ALPHANUMERIC_CHARSET.indexOf(c.charAt(d)),6,l),new qs(qs.Mode.ALPHANUMERIC,c.length,l)}static makeSegments(c){return c==""?[]:qs.isNumeric(c)?[qs.makeNumeric(c)]:qs.isAlphanumeric(c)?[qs.makeAlphanumeric(c)]:[qs.makeBytes(qs.toUtf8ByteArray(c))]}static makeEci(c){let l=[];
9242if(c<0)throw new RangeError("ECI assignment value out of range");if(c<128)n(c,8,l);else if(c<16384)n(2,2,l),n(c,14,l);else if(c<1e6)n(6,3,l),n(c,21,l);else throw new RangeError("ECI assignment value out of range");return new qs(qs.Mode.ECI,0,l)}static isNumeric(c){return qs.NUMERIC_REGEX.test(c)}static isAlphanumeric(c){return qs.ALPHANUMERIC_REGEX.test(c)}getData(){return this.bitData.slice()}static getTotalBits(c,l){let d=0;for(const h of c){const p=h.mode.numCharCountBits(l);if(h.numChars>=1<<p)return 1/0;d+=4+p+h.bitData.length}return d}static toUtf8ByteArray(c){c=encodeURI(c);let l=[];for(let d=0;d<c.length;d++)c.charAt(d)!="%"?l.push(c.charCodeAt(d)):(l.push(parseInt(c.substring(d+1,d+3),16)),d+=2);return l}};r.NUMERIC_REGEX=/^[0-9]*$/,r.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,r.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=r;t.QrSegment=r})(h1||(h1={}));(t=>{(e=>{const n=class{constructor(s,r){this.ordinal=s,this.formatBits=r}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),e.Ecc=n})(t.QrCode||(t.QrCode={}))})(h1||(h1={}));(t=>{(e=>{const n=class{constructor(s,r){this.modeBits=s,this.numBitsCharCount=r}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),e.Mode=n})(t.QrSegment||(t.QrSegment={}))})(h1||(h1={}));var f2=h1;/** 9243 * @license qrcode.react 9244 * Copyright (c) Paul O'Shannessy 9245 * SPDX-License-Identifier: ISC 9246 */var bJe={L:f2.QrCode.Ecc.LOW,M:f2.QrCode.Ecc.MEDIUM,Q:f2.QrCode.Ecc.QUARTILE,H:f2.QrCode.Ecc.HIGH},Xoe=128,Joe="L",eae="#FFFFFF",tae="#000000",nae=!1,iae=1,wJe=4,vJe=0,CJe=.1;function sae(t,e=0){const n=[];return t.forEach(function(i,s){let r=null;i.forEach(function(o,a){if(!o&&r!==null){n.push(`M${r+e} ${s+e}h${a-r}v1H${r+e}z`),r=null;return}if(a===i.length-1){if(!o)return;r===null?n.push(`M${a+e},${s+e} h1v1H${a+e}z`):n.push(`M${r+e},${s+e} h${a+1-r}v1H${r+e}z`);return}o&&r===null&&(r=a)})}),n.join("")}function rae(t,e){return t.slice().map((n,i)=>i<e.y||i>=e.y+e.h?n:n.map((s,r)=>r<e.x||r>=e.x+e.w?s:!1))}function xJe(t,e,n,i){if(i==null)return null;const s=t.length+n*2,r=Math.floor(e*CJe),o=s/e,a=(i.width||r)*o,c=(i.height||r)*o,l=i.x==null?t.length/2-a/2:i.x*o,d=i.y==null?t.length/2-c/2:i.y*o,h=i.opacity==null?1:i.opacity;let p=null;if(i.excavate){let b=Math.floor(l),w=Math.floor(d),C=Math.ceil(a+l-b),E=Math.ceil(c+d-w);p={x:b,y:w,w:C,h:E}}const g=i.crossOrigin;return{x:l,y:d,h:c,w:a,excavation:p,opacity:h,crossOrigin:g}}function EJe(t,e){return e!=null?Math.max(Math.floor(e),0):t?wJe:vJe}function oae({value:t,level:e,minVersion:n,includeMargin:i,marginSize:s,imageSettings:r,size:o,boostLevel:a}){let c=kn.useMemo(()=>{const b=(Array.isArray(t)?t:[t]).reduce((w,C)=>(w.push(...f2.QrSegment.makeSegments(C)),w),[]);return f2.QrCode.encodeSegments(b,bJe[e],n,void 0,void 0,a)},[t,e,n,a]);const{cells:l,margin:d,numCells:h,calculatedImageSettings:p}=kn.useMemo(()=>{let g=c.getModules();const b=EJe(i,s),w=g.length+b*2,C=xJe(g,o,b,r);return{cells:g,margin:b,numCells:w,calculatedImageSettings:C}},[c,o,r,i,s]);return{qrcode:c,margin:d,cells:l,numCells:h,calculatedImageSettings:p}}var _Je=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),SJe=kn.forwardRef(function(e,n){const i=e,{value:s,size:r=Xoe,level:o=Joe,bgColor:a=eae,fgColor:c=tae,includeMargin:l=nae,minVersion:d=iae,boostLevel:h,marginSize:p,imageSettings:g}=i,w=ZI(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:C}=w,E=ZI(w,["style"]),T=g==null?void 0:g.src,A=kn.useRef(null),k=kn.useRef(null),R=kn.useCallback(S=>{A.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[P,B]=kn.useState(!1),{margin:F,cells:z,numCells:K,calculatedImageSettings:q}=oae({value:s,level:o,minVersion:d,boostLevel:h,includeMargin:l,marginSize:p,imageSettings:g,size:r});kn.useEffect(()=>{if(A.current!=null){const S=A.current,v=S.getContext("2d");if(!v)return;let _=z;const N=k.current,$=q!=null&&N!==null&&N.complete&&N.naturalHeight!==0&&N.naturalWi
9246dth!==0;$&&q.excavation!=null&&(_=rae(z,q.excavation));const U=window.devicePixelRatio||1;S.height=S.width=r*U;const j=r/K*U;v.scale(j,j),v.fillStyle=a,v.fillRect(0,0,K,K),v.fillStyle=c,_Je?v.fill(new Path2D(sae(_,F))):z.forEach(function(D,O){D.forEach(function(H,J){H&&v.fillRect(J+F,O+F,1,1)})}),q&&(v.globalAlpha=q.opacity),$&&v.drawImage(N,q.x+F,q.y+F,q.w,q.h)}}),kn.useEffect(()=>{B(!1)},[T]);const G=YI({height:r,width:r},C);let I=null;return T!=null&&(I=kn.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{B(!0)},ref:k,crossOrigin:q==null?void 0:q.crossOrigin})),kn.createElement(kn.Fragment,null,kn.createElement("canvas",YI({style:G,height:r,width:r,ref:R,role:"img"},E)),I)});SJe.displayName="QRCodeCanvas";var aae=kn.forwardRef(function(e,n){const i=e,{value:s,size:r=Xoe,level:o=Joe,bgColor:a=eae,fgColor:c=tae,includeMargin:l=nae,minVersion:d=iae,boostLevel:h,title:p,marginSize:g,imageSettings:b}=i,w=ZI(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:C,cells:E,numCells:T,calculatedImageSettings:A}=oae({value:s,level:o,minVersion:d,boostLevel:h,includeMargin:l,marginSize:g,imageSettings:b,size:r});let k=E,R=null;b!=null&&A!=null&&(A.excavation!=null&&(k=rae(E,A.excavation)),R=kn.createElement("image",{href:b.src,height:A.h,width:A.w,x:A.x+C,y:A.y+C,preserveAspectRatio:"none",opacity:A.opacity,crossOrigin:A.crossOrigin}));const P=sae(k,C);return kn.createElement("svg",YI({height:r,width:r,viewBox:`0 0 ${T} ${T}`,ref:n,role:"img"},w),!!p&&kn.createElement("title",null,p),kn.createElement("path",{fill:a,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),kn.createElement("path",{fill:c,d:P,shapeRendering:"crispEdges"}),R)});aae.displayName="QRCodeSVG";function AJe({className:t=""}){const e=jr(),n=M.useRef(null),i=()=>{window.scrollTo({top:0,behavior:"smooth"})};return M.useEffect(()=>{const s=()=>
9246{if(!n.current)return;const a=n.current.querySelectorAll("rect");if(a.length===0){setTimeout(s,100);return}a.forEach(c=>{const l=parseFloat(c.getAttribute("width")||"0"),d=parseFloat(c.getAttribute("height")||"0");l>=7&&d>=7&&l<=12&&d<=12?(c.setAttribute("rx","6"),c.setAttribute("ry","6")):l>=5&&d>=5&&l<=6&&d<=6?(c.setAttribute("rx","4"),c.setAttribute("ry","4")):l<=4&&d<=4&&l>0&&d>0?(c.setAttribute("rx","2"),c.setAttribute("ry","2")):l>0&&d>0&&(c.setAttribute("rx","3"),c.setAttribute("ry","3"))})},r=setTimeout(s,50),o=new MutationObserver(s);return n.current&&o.observe(n.current,{childList:!0,subtree:!0}),()=>{clearTimeout(r),o.disconnect()}},[]),m.jsx("footer",{className:`Footer ${t}`,children:m.jsxs("div",{className:"Footer__Container footer-container",children:[m.jsxs("div",{className:"Footer__Content",children:[m.jsxs("div",{className:"Footer__Columns",children:[m.jsxs("div",{className:"Footer__Column",children:[m.jsx("h3",{className:"Footer__Title",children:"Products"}),m.jsxs("ul",{className:"Footer__List",children:[m.jsx("li",{children:m.jsx(gi,{to:"/",className:"Footer__Link",onClick:s=>{e.pathname==="/"&&(s.preventDefault(),i())},children:"WinnieSwap"})}),m.jsx("li",{children:m.jsx("a",{href:"https://winnie.app",target:"_blank",rel:"noopener noreferrer",className:"Footer__Link",children:"Winnie"})}),m.jsx("li",{children:m.jsx("a",{href:"https://henlo-winnie.dev",target:"_blank",rel:"noopener noreferrer",className:"Footer__Link",children:"Henlo Winnie"})})]})]}),m.jsxs("div",{className:"Footer__Column",children:[m.jsx("h3",{className:"Footer__Title",children:"Resources"}),m.jsxs("ul",{className:"Footer__List",children:[m.jsx("li",{children:m.jsx("a",{href:"https://docs.winnieswap.com/winnieswap/introduction",target:"_blank",rel:"noopener noreferrer",className:"Footer__Link",children:"Docs"})}),m.jsx("li",{children:m.jsx(gi,{to:"/explore?tab=tokens",className:"Footer__Link",children:"Explore"})})]})]}),m.jsxs("div",{className:"Footer__Column",children:[m.jsx("h3",{className:"Footer__Title",children:"Socials"}),m.jsxs("ul",{className:"Footer__List",children:[m.jsx("li",{children:m.jsx("a",{href:"https://x.com/philidorlabs",target:"_blank",rel:"noopener noreferrer",className:"Footer__Link Footer__Link--social",children:"X (Twitter)"})}),m.jsx("li",{children:m.jsx("a",{href:"https://github.com/philidorlabs",target:"_blank",rel:"noopener noreferrer",className:"Footer__Link Footer__Link--social",children:"GitHub"})})]})]})]}),m.jsxs("div",{className:"Footer__QR",children:[m.jsx("p",{className:"Footer__Title",style:{margin:0,marginBottom:"4px",width:"140px",textAlign:"center"},children:"Swap on Mobile"}),m.jsx("div",{className:"Footer__QRWrapper footer-qr-wrapper",children:m.jsxs("div",{className:"Footer__QRCode",children:[m.jsx("div",{className:"footer-qr-code",ref:n,children:m.jsx(aae,{value:"https://winnieswap.com",size:116,level:"H",includeMargin:!1,bgColor:"transparent",fgColor:"#171410",style:{width:"100%",height:"100%"}})}),m.jsx("div",{className:"Footer__QRLogo",style:{width:"32px",height:"32px",borderRadius:"12px",background:"#FFFFFF",boxShadow:"0 8px 20px rgba(0,0,0,0.25)",display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsx("img",{src:"/assets/components/favicon.svg",alt:"Winnie",width:32,height:32,style:{width:"32px",height:"32px"}})})]})})]})]}),m.jsx("div",{className:"Footer__Bottom",children:m.jsxs("div",{className:"Footer__BottomContent",children:[m.jsxs("p",{className:"Footer__Copyright",children:["© ",new Date().getFullYear()," WinnieSwap. All rights reserved."]}),m.jsxs("div",{className:"Footer__Legal",children:[m.jsx(gi,{to:"/privacy-policy",className:"Footer__LegalLink",onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),children:"Privacy Policy"}),m.jsx(gi,{to:"/terms-of-service",className:"Footer__LegalLink",onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),children:"Terms of Service"})]})]})})]})})}function TJe(){const[t,e]=M.useState(!1),{reconnect:n}=E5e(),{isLoading:i}=aJe({loadingDelay:50,minimumLoadingTime:150});cJe(),lJe(),M.useEffect(()=>{n()},[]);const s=()=>{e(!t)};return m.jsxs("div",{className:"app",children:[m.jsx(Jqe,{}),m.jsx(OKe,{}),m.jsx("main",{className:"app-main",children:m.jsx(HQe,{isLoading:i,children:m.jsxs(Hue,{children:[m.jsx(Ws,{path:"/",element:m.jsxs("div",{className:"swap-page",children:[m.jsx(UQe,{onToggleSidebar:s}),t&&m.jsx(BQe,{})]})}),m.jsx(Ws,{path:"/explore",element:m.jsx(wN,{})}),m.jsx(Ws,{path:"/explore/tokens",element:m.jsx(wN,{})}),m.jsx(Ws,{path:"/explore/pools",element:m.jsx(wN,{})}),m.jsx(Ws,{path:"/earn",element:m.jsx(aXe,{})}),m.jsx(Ws,{path:"/tokens",element:m.jsx(Ky,{to:"/explore/tokens",replace:!0})}),m.jsx(Ws,{path:"/pools",element:m.jsx(Ky,{to:"/explore/pools",replace:!0})}),m.jsx(Ws,{path:"/vaults",element:m.jsx(Ky,{to:"/earn?tab=vaults",replace:!0})}),m.jsx(Ws,{path:"/explore/vaults",element:m.jsx(Ky,{to:"/earn?tab=vaults",replace:!0})}),m.jsx(Ws,{path:"/liquidity",element:m.jsx(bY,{})}),m.jsx(Ws,{path:"/portfolio",element:m.jsx(bY,{})}),m.jsx(Ws,{path:"/liquidity/create",element:m.jsx($Xe,{})}),m.jsx(Ws,{path:"/vaults/:vaultAddress",element:m.jsx(sJe,{})}),m.jsx(Ws,{path:"/leaderboard",element:m.jsx(BXe,{})}),m.jsx(Ws,{path:"/mobile-chart-test",element:m.jsx(qXe,{})}),m.jsx(Ws,{path:"/more",element:m.jsx("div",{children:"More Page"})}),m.jsx(Ws,{path:"/token/:tokenId",element:m.jsx(pY,{})}),m.jsx(Ws,{path:"/tokens/:tokenAddress",element:m.jsx(pY,{})}),m.jsx(Ws,{path:"/pools/:poolAddress",element:m.jsx(JXe,{})}),m.jsx(Ws,{path:"/terms-of-service",element:m.jsx(rJe,{})}),m.jsx(Ws,{path:"/privacy-policy",element:m.jsx(oJe,{})})]})})}),m.jsx(AJe,{})]})}function kJe(){return m.jsx(yde,{children:m.jsx(TJe,{})})}const NJe={rpc:["https://celestia-rpc.publicnode.com:443","https://rpc.celestia.pops.one","https://celestia-rpc.lavenderfive.com:443","https://rpc.celestia.bronbro.io:443","https://celestia-rpc.publicnode.com","https://celestia-mainnet-rpc.allthatnode.com:26657","https://celestia-rpc.staketab.org:443","https://rpc-celestia.mzonder.com","https://celestia-rpc.validatrium.club","https://rpc.celestia.qubelabs.io","https://celestia-rpc.stakeandrelax.net","https://celestia-rpc.stakeflow.io","https://celestia-rpc.w3coins.io","https://rpc-celestia.cosmos-spaces.cloud","https://celestia-rpc.sr20de.xyz","https://rpc.celestia.validatrium.club","https://celestia-rpc.chainnode.online"]};function RJe(t){const e=[/rpc\.celestia\.stakelab\.zone/gi,/.*stakelab.*celestia.*/gi,/.*stakelab.*rpc.*/gi];for(const n of e)if(n.test(t))return console.log(`ð Replacing stakelab RPC: ${t} â celestia-rpc.publicnode.com:443`),"https://celestia-rpc.publicnode.com:443";return t}const kY=window.fetch;function PJe(){if(!(typeof window>"u")){if(window.fetch.__cosmosInterceptorInstalled){console.log("â¹ï¸ Cosmos RPC interceptor already installed");return}window.fetch=async function(t,e){var r,o;let n,i=t;typeof t=="string"?n=t:t instanceof URL?n=t.toString():t instanceof Request?n=t.url:n=String(t);const s=/stakelab.*rpc|rpc.*stakelab|stakelab\.zone|rpc\.celestia\.stakelab/gi.test(n);if(s){const a=RJe(n);console.log(`ð Intercepted stakelab RPC call: ${n} â ${a}`),typeof t=="string"?i=a:t instanceof URL?i=new URL(a):t instanceof Request&&(i=new Request
9246(a,{method:t.method,headers:t.headers,body:t.body,mode:t.mode,credentials:t.credentials,cache:t.cache,redirect:t.redirect,referrer:t.referrer,referrerPolicy:t.referrerPolicy,integrity:t.integrity}))}try{return await kY(i,e)}catch(a){if(s&&((r=a.message)!=null&&r.includes("CORS")||(o=a.message)!=null&&o.includes("Failed to fetch"))){const c=NJe.rpc[0];return console.log(`ð Retrying with public RPC after CORS error: ${c}`),await kY(c,e)}throw a}},window.fetch.__cosmosInterceptorInstalled=!0,console.log("â
Cosmos RPC interceptor setup complete - stakelab RPCs will be automatically replaced")}}PJe();Mce.createRoot(document.getElementById("root")).render(m.jsx(kn.StrictMode,{children:m.jsx(Zce,{store:Yle,children:m.jsx(qWe,{children:m.jsx(kJe,{})})})}));export{Fo as $,Ss as A,xn as B,Ve as C,bd as D,Et as E,Id as F,o5 as G,cn as H,Dr as I,tee as J,tS as K,qi as L,Me as M,u5 as N,Dc as O,U0 as P,Ir as Q,Pe as R,ti as S,Xr as T,ds as U,ye as V,Wi as W,Kt as X,Jt as Y,wn as Z,Lt as _,Qe as a,e1e as a$,ut as a0,WUe as a1,Wte as a2,fg as a3,kx as a4,He as a5,ys as a6,Lr as a7,ss as a8,b6e as a9,pee as aA,zJ as aB,met as aC,pet as aD,VY as aE,Kxe as aF,ya as aG,l5 as aH,Yh as aI,st as aJ,JD as aK,Eo as aL,N1e as aM,G8 as aN,U8 as aO,q1e as aP,A6 as aQ,Pd as aR,f1 as aS,c3 as aT,Nd as aU,a1e as aV,Zge as aW,Jge as aX,s1e as aY,i1e as aZ,n1e as a_,d5 as aa,Rr as ab,ei as ac,b3 as ad,A2 as ae,w6e as af,mP as ag,vr as ah,N_ as ai,Md as aj,Ha as ak,jo as al,ent as am,Hte as an,GD as ao,S2e as ap,TO as aq,Kve as ar,XJe as as,qme as at,JJe as au,bp as av,Xme as aw,U3 as ax,zme as ay,Jme as az,n4 as b,j1e as b$,c1e as b0,Mb as b1,o1e as b2,zX as b3,Rj as b4,Pj as b5,t1e as b6,r1e as b7,Qge as b8,IO as b9,pme as bA,mme as bB,mj as bC,fX as bD,gj as bE,gme as bF,pX as bG,K2 as bH,mX as bI,yme as bJ,wme as bK,$3 as bL,I8 as bM,Cme as bN,vme as bO,gX as bP,xme as bQ,yp as bR,MJ as bS,lR as bT,S1e as bU,A1e as bV,KX as bW,eJ as bX,eO as bY,uR as bZ,F1e as b_,eS as ba,Wee as bb,DO as bc,Eve as bd,dV as be,_ve as bf,ip as bg,Ks as bh,fj as bi,BE as bj,Gwe as bk,Mn as bl,wJ as bm,Iye as bn,Dye as bo,xR as bp,sbe as bq,QX as br,R1e as bs,P1e as bt,dme as bu,pj as bv,hX as bw,p6 as bx,hme as by,fme as bz,It as c,obe as c$,$8 as c0,bX as c1,yX as c2,wX as c3,_me as c4,Sme as c5,Ame as c6,Ev as c7,Wye as c8,dO as c9,W3 as cA,j3 as cB,z3 as cC,J2 as cD,V3 as cE,Bm as cF,F3 as cG,K3 as cH,Gc as cI,q3 as cJ,lp as cK,rc as cL,X2 as cM,H3 as cN,J3 as cO,Y1e as cP,Q3 as cQ,Z3 as cR,G3 as cS,I1e as cT,D1e as cU,M1e as cV,L1e as cW,XX as cX,JX as cY,U1e as cZ,Ave as c_,d2e as ca,OJ as cb,pO as cc,f2e as cd,s2e as ce,Fm as cf,WE as cg,pR as ch,bR as ci,wR as cj,vR as ck,yR as cl,mR as cm,gR as cn,qE as co,CR as cp,_6 as cq,iO as cr,Mj as cs,n5 as ct,t5 as cu,e5 as cv,Y3 as cw,X3 as cx,vg as cy,vp as cz,i4 as d,$b as d$,abe as d0,cbe as d1,Dwe as d2,y6 as d3,bO as d4,V1e as d5,m1 as d6,lO as d7,Oj as d8,T6 as d9,tf as dA,fge as dB,pge as dC,nf as dD,mge as dE,Rd as dF,Tme as dG,gf as dH,vX as dI,Pme as dJ,Du as dK,Ime as dL,ug as dM,Db as dN,CX as dO,Fr as dP,Y2 as dQ,Iu as dR,a2e as dS,G1e as dT,dR as dU,Cg as dV,$J as dW,bf as dX,mO as dY,LJ as dZ,eee as d_,_i as da,W1e as db,p1 as dc,wO as dd,_1e as de,g6 as df,Ja as dg,FJ as dh,jJ as di,k2e as dj,T2e as dk,I2e as dl,P2e as dm,ebe as dn,JJ as dp,Lb as dq,gge as dr,Ob as ds,Ib as dt,Eme as du,cp as dv,Ys as dw,Q2 as dx,IX as dy,hge as dz,Gi as e,Oye as e0,xo as e1,A2e as e2,HX as e3,L8 as e4,E1e as e5,b6 as e6,B2e as e7,HE as e8,nee as e9,fbe as ea,iee as eb,hbe as ec,PJ as ed,o2e as ee,eve as ef,rbe as eg,g1 as eh,D2e as ei,ube as ej,lbe as ek,w6 as el,Za as em,dt as en,Owe as eo,hs as ep,gwe as eq,os as f,we as g,$s as h,tt as i,ne as j,Ue as k,Wxe as l,GO as m,le as n,fn as o,Hi as p,h_ as q,vn as r,Oe as s,ar as t,or as u,Gs as v,Yc as w,se as x,xt as y,_et as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.