@fileverse-dev/ddoc 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -480,7 +480,7 @@ ${n.innerHTML}
|
|
|
480
480
|
`),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:(e=this.options.languageClassPrefix)!==null&&e!==void 0?e:"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}}}}),L_=Xe.create({name:"hardBreak"}).extend({addStorage(){return{markdown:{serialize(t,e,n,r){for(let s=r+1;s<n.childCount;s++)if(n.child(s).type!=e.type){t.write(t.inTable?Bg.storage.markdown.serialize.call(this,t,e,n):`\\
|
|
481
481
|
`);return}},parse:{}}}}}),qee=Xe.create({name:"heading"}).extend({addStorage(){return{markdown:{serialize:ui.nodes.heading,parse:{}}}}}),Kee=Xe.create({name:"horizontalRule"}).extend({addStorage(){return{markdown:{serialize:ui.nodes.horizontal_rule,parse:{}}}}}),Qee=Xe.create({name:"image"}).extend({addStorage(){return{markdown:{serialize:ui.nodes.image,parse:{}}}}}),Jee=Xe.create({name:"listItem"}).extend({addStorage(){return{markdown:{serialize:ui.nodes.list_item,parse:{}}}}}),Yee=Xe.create({name:"orderedList"});function Xee(t,e,n){let r=0;for(;n-r>0&&e.child(n-r-1).type.name===t.type.name;r++);return r}const Zee=Yee.extend({addStorage(){return{markdown:{serialize(t,e,n,r){const s=e.attrs.start||1,i=String(s+e.childCount-1).length,o=t.repeat(" ",i+2),l=Xee(e,n,r)%2?") ":". ";t.renderList(e,o,u=>{const c=String(s+u);return t.repeat(" ",i-c.length)+c+l})},parse:{}}}}}),ete=Xe.create({name:"paragraph"}).extend({addStorage(){return{markdown:{serialize:ui.nodes.paragraph,parse:{}}}}});function ax(t){var e,n;return(e=t==null||(n=t.content)===null||n===void 0?void 0:n.content)!==null&&e!==void 0?e:[]}const tte=Xe.create({name:"table"}).extend({addStorage(){return{markdown:{serialize(t,e,n){if(!nte(e)){Bg.storage.markdown.serialize.call(this,t,e,n);return}t.inTable=!0,e.forEach((r,s,i)=>{if(t.write("| "),r.forEach((o,a,l)=>{l&&t.write(" | ");const u=o.firstChild;u.textContent.trim()&&t.renderInline(u)}),t.write(" |"),t.ensureNewLine(),!i){const o=Array.from({length:r.childCount}).map(()=>"---").join(" | ");t.write(`| ${o} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function B_(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function nte(t){const e=ax(t),n=e[0],r=e.slice(1);return!(ax(n).some(s=>s.type.name!=="tableHeader"||B_(s)||s.childCount>1)||r.some(s=>ax(s).some(i=>i.type.name==="tableHeader"||B_(i)||i.childCount>1)))}const rte=Xe.create({name:"taskItem"}).extend({addStorage(){return{markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){[...t.querySelectorAll(".task-list-item")].forEach(e=>{const n=e.querySelector("input");e.setAttribute("data-type","taskItem"),n&&(e.setAttribute("data-checked",n.checked),n.remove())})}}}}}}),ste=Xe.create({name:"taskList"}).extend({addStorage(){return{markdown:{serialize:I_.storage.markdown.serialize,parse:{setup(t){t.use(_ee)},updateDOM(t){[...t.querySelectorAll(".contains-task-list")].forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),ite=Xe.create({name:"text"}).extend({addStorage(){return{markdown:{serialize(t,e){t.text(Uee(e.text))},parse:{}}}}}),ote=Yt.create({name:"bold"}).extend({addStorage(){return{markdown:{serialize:ui.marks.strong,parse:{}}}}}),ate=Yt.create({name:"code"}).extend({addStorage(){return{markdown:{serialize:ui.marks.code,parse:{}}}}}),lte=Yt.create({name:"italic"}).extend({addStorage(){return{markdown:{serialize:ui.marks.em,parse:{}}}}}),ute=Yt.create({name:"link"}).extend({addStorage(){return{markdown:{serialize:ui.marks.link,parse:{}}}}}),cte=Yt.create({name:"strike"}).extend({addStorage(){return{markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}}}}),fte=[Gee,I_,Wee,L_,qee,Kee,Bg,Qee,Jee,Zee,ete,tte,rte,ste,ite,ote,ate,R_,lte,ute,cte];function Fg(t){var e,n;const r=(e=t.storage)===null||e===void 0?void 0:e.markdown,s=(n=fte.find(i=>i.name===t.name))===null||n===void 0?void 0:n.storage.markdown;return r||s?{...s,...r}:null}class dte{constructor(e){Lg(this,"editor",null),this.editor=e}serialize(e){const n=new jee(this.nodes,this.marks,{hardBreakNodeName:L_.name});return n.renderContent(e),n.out}get nodes(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(n=>[n,this.serializeNode(Bg)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="node"&&this.serializeNode(n)).map(n=>[n.name,this.serializeNode(n)]))!==null&&e!==void 0?e:[])}}get marks(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(n=>[n,this.serializeMark(R_)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="mark"&&this.serializeMark(n)).map(n=>[n.name,this.serializeMark(n)]))!==null&&e!==void 0?e:[])}}serializeNode(e){var n;return(n=Fg(e))===null||n===void 0||(n=n.serialize)===null||n===void 0?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;const r=(n=Fg(e))===null||n===void 0?void 0:n.serialize;return r?{...r,open:typeof r.open=="function"?r.open.bind({editor:this.editor,options:e.options}):r.open,close:typeof r.close=="function"?r.close.bind({editor:this.editor,options:e.options}):r.close}:null}}class hte{constructor(e,n){Lg(this,"editor",null),Lg(this,"md",null);let{html:r,linkify:s,breaks:i}=n;this.editor=e,this.md=this.withPatchedRenderer(cr({html:r,linkify:s,breaks:i}))}parse(e){let{inline:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(i=>{var o;return(o=Fg(i))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.setup)===null||o===void 0?void 0:o.call({editor:this.editor,options:i.options},this.md)});const r=this.md.render(e),s=ox(r);return this.editor.extensionManager.extensions.forEach(i=>{var o;return(o=Fg(i))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.updateDOM)===null||o===void 0?void 0:o.call({editor:this.editor,options:i.options},s)}),this.normalizeDOM(s,{inline:n,content:e}),s.innerHTML}return e}normalizeDOM(e,n){let{inline:r,content:s}=n;return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(i=>{var o;((o=i.nextSibling)===null||o===void 0?void 0:o.nodeType)===Node.TEXT_NODE&&!i.closest("pre")&&(i.nextSibling.textContent=i.nextSibling.textContent.replace(/^\n/,""))}),r&&this.normalizeInline(e,s),e}normalizeBlocks(e){const r=Object.values(this.editor.schema.nodes).filter(s=>s.isBlock).map(s=>{var i;return(i=s.spec.parseDOM)===null||i===void 0?void 0:i.map(o=>o.tag)}).flat().filter(Boolean).join(",");r&&[...e.querySelectorAll(r)].forEach(s=>{s.parentElement.matches("p")&&Hee(s)})}normalizeInline(e,n){var r;if((r=e.firstElementChild)!==null&&r!==void 0&&r.matches("p")){var s,i,o,a;const l=e.firstElementChild,{nextElementSibling:u}=l,c=(s=(i=n.match(/^\s+/))===null||i===void 0?void 0:i[0])!==null&&s!==void 0?s:"",f=u?"":(o=(a=n.match(/\s+$/))===null||a===void 0?void 0:a[0])!==null&&o!==void 0?o:"";if(n.match(/^\n\n/)){l.innerHTML=`${l.innerHTML}${f}`;return}Vee(l),e.innerHTML=`${c}${e.innerHTML}${f}`}}withPatchedRenderer(e){const n=r=>function(){const s=r(...arguments);return s===`
|
|
482
482
|
`?s:s[s.length-1]===`
|
|
483
|
-
`?s.slice(0,-1):s};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const pte=wt.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new bt({key:new Mt("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return jp.fromSchema(this.editor.schema).parseSlice(ox(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),mte=wt.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=m7.Commands.config.addCommands();return{setContent:(e,n,r)=>s=>t.setContent(s.editor.storage.markdown.parser.parse(e),n,r)(s),insertContentAt:(e,n,r)=>s=>t.insertContentAt(e,s.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(s)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new hte(this.editor,this.options),serializer:new dte(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[Iee.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),pte.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),gte=[nK,eK.configure({strike:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bold:{HTMLAttributes:{class:"select-text pointer-events-auto"}},italic:{HTMLAttributes:{class:"select-text pointer-events-auto"}},heading:{HTMLAttributes:{class:"select-text pointer-events-auto"}},paragraph:{HTMLAttributes:{class:"select-text pointer-events-auto"}},orderedList:{HTMLAttributes:{class:"flex flex-col items-start list-decimal list-outside space-y-4 ml-6"}},blockquote:{HTMLAttributes:{class:"rounded-lg bg-[#E8EBEC] p-5 font-serif italic text-black"}},codeBlock:{HTMLAttributes:{class:"rounded-lg bg-transparent border border-[#DDE2E4] p-5 font-mono font-medium text-black"},exitOnArrowDown:!0},code:{HTMLAttributes:{class:"rounded bg-transparent p-1.5 font-mono font-medium text-black text-sm",spellcheck:"false"}},history:!1,gapcursor:!1,dropcursor:!1,document:!1,horizontalRule:!1}),QM,rK.configure({types:["heading","paragraph"]}),IK,SK.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0}),TK.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),MK.configure({multicolor:!0}),PK.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),tK,FK,NK.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),RK.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),jM.configure({HTMLAttributes:{class:"space-y-4 !ml-6"}}),HM.configure({width:3,color:"#d1d5db"}),VM,yJ,PY,RY,..._Y,qK.configure({uploadFn:HU}),BK,jK,zK,LY,LK,mte.configure({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!0,breaks:!0,transformPastedText:!0,transformCopiedText:!0})],yte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",bte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",wte=t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},Ate=t=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.classList.add("custom-cursor__label-container"),n.setAttribute("style",`border: 1px solid ${t.color}`);const r=document.createElement("img");r.src=yte,r.classList.add("custom-cursor__icon");const s=document.createElement("div");s.classList.add("custom-cursor__label");const i=document.createElement("span");i.classList.add("custom-cursor__text"),i.textContent=t.name;const o=document.createElement("img");return o.src=bte,o.classList.add("custom-cursor__badge"),s.appendChild(i),n.appendChild(r),n.appendChild(s),n.appendChild(o),e.appendChild(n),e},vte=t=>t.isEns?Ate(t):wte(t),xte="6.13.1";function kte(t,e,n){const r=e.split("|").map(i=>i.trim());for(let i=0;i<r.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${n}`,s.value=t,s}async function _n(t){const e=Object.keys(t);return(await Promise.all(e.map(r=>Promise.resolve(t[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Me(t,e,n){for(let r in e){let s=e[r];const i=n?n[r]:null;i&&kte(s,i,r),Object.defineProperty(t,r,{enumerable:!0,value:s,writable:!1})}}function kc(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(kc).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[t[r]&15];return n}if(typeof t=="object"&&typeof t.toJSON=="function")return kc(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(n=>`${kc(n)}: ${kc(t[n])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function gn(t,e){return t&&t.code===e}function lx(t){return gn(t,"CALL_EXCEPTION")}function _t(t,e,n){let r=t;{const i=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${kc(n)}`);for(const o in n){if(o==="shortMessage")continue;const a=n[o];i.push(o+"="+kc(a))}}i.push(`code=${e}`),i.push(`version=${xte}`),i.length&&(t+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return Me(s,{code:e}),n&&Object.assign(s,n),s.shortMessage==null&&Me(s,{shortMessage:r}),s}function te(t,e,n,r){if(!t)throw _t(e,n,r)}function $(t,e,n,r){te(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function F_(t,e,n){n==null&&(n=""),n&&(n=": "+n),te(t>=e,"missing arguemnt"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),te(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function jg(t,e,n){if(n==null&&(n=""),t!==e){let r=n,s="new";n&&(r+=".",s+=" "+n),te(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function j_(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((t.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(t.substring(s,s+2),16),s+=2;return r}$(!1,"invalid BytesLike value",e||"value",t)}function ct(t,e){return j_(t,e,!1)}function Gn(t,e){return j_(t,e,!0)}function St(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function ux(t){return St(t,!0)||t instanceof Uint8Array}const U_="0123456789abcdef";function Ae(t){const e=ct(t);let n="0x";for(let r=0;r<e.length;r++){const s=e[r];n+=U_[(s&240)>>4]+U_[s&15]}return n}function $t(t){return"0x"+t.map(e=>Ae(e).substring(2)).join("")}function Ec(t){return St(t,!0)?(t.length-2)/2:ct(t).length}function Vt(t,e,n){const r=ct(t);return n!=null&&n>r.length&&te(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),Ae(r.slice(e??0,n??r.length))}function H_(t,e,n){const r=ct(t);te(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),n?s.set(r,e-r.length):s.set(r,0),Ae(s)}function xl(t,e){return H_(t,e,!0)}function Ete(t,e){return H_(t,e,!1)}const Ug=BigInt(0),Es=BigInt(1),Cc=9007199254740991;function Cte(t,e){const n=Hg(t,"value"),r=BigInt(Qe(e,"width"));if(te(n>>r===Ug,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-Es){const s=(Es<<r)-Es;return-((~n&s)+Es)}return n}function V_(t,e){let n=Ce(t,"value");const r=BigInt(Qe(e,"width")),s=Es<<r-Es;if(n<Ug){n=-n,te(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const i=(Es<<r)-Es;return(~n&i)+Es}else te(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function Dh(t,e){const n=Hg(t,"value"),r=BigInt(Qe(e,"bits"));return n&(Es<<r)-Es}function Ce(t,e){switch(typeof t){case"bigint":return t;case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Cc&&t<=Cc,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(n){$(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}$(!1,"invalid BigNumberish value",e||"value",t)}function Hg(t,e){const n=Ce(t,e);return te(n>=Ug,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const z_="0123456789abcdef";function cx(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=z_[n>>4],e+=z_[n&15];return BigInt(e)}return Ce(t)}function Qe(t,e){switch(typeof t){case"bigint":return $(t>=-Cc&&t<=Cc,"overflow",e||"value",t),Number(t);case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Cc&&t<=Cc,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Qe(BigInt(t),e)}catch(n){$(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}$(!1,"invalid numeric value",e||"value",t)}function Ste(t){return Qe(cx(t))}function Zo(t,e){let r=Hg(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Qe(e,"width");for(te(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<s*2;)r="0"+r}return"0x"+r}function Wn(t){const e=Hg(t,"value");if(e===Ug)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(n.substring(i,i+2),16)}return r}function kl(t){let e=Ae(ux(t)?t:Wn(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const $_="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const G_=BigInt(58);function Tte(t){const e=ct(t);let n=cx(e),r="";for(;n;)r=$_[Number(n%G_)]+r,n/=G_;for(let s=0;s<e.length&&!e[s];s++)r=$_[0]+r;return r}function Dte(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return ct(e)}function Ote(t){const e=ct(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}class W_{constructor(e,n,r){q(this,"filter");q(this,"emitter");J(this,Zc);L(this,Zc,n),Me(this,{emitter:e,filter:r})}async removeListener(){T(this,Zc)!=null&&await this.emitter.off(this.filter,T(this,Zc))}}Zc=new WeakMap;function Mte(t,e,n,r,s){$(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function q_(t,e,n,r,s){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<n.length&&n[o]>>6===2;o++)i++;return i}return t==="OVERRUN"?n.length-e-1:0}function Nte(t,e,n,r,s){return t==="OVERLONG"?($(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),q_(t,e,n))}const _te=Object.freeze({error:Mte,ignore:q_,replace:Nte});function Rte(t,e){e==null&&(e=_te.error);const n=ct(t,"bytes"),r=[];let s=0;for(;s<n.length;){const i=n[s++];if(!(i>>7)){r.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,n,r):s+=e("BAD_PREFIX",s-1,n,r);continue}if(s-1+o>=n.length){s+=e("OVERRUN",s-1,n,r);continue}let l=i&(1<<8-o-1)-1;for(let u=0;u<o;u++){let c=n[s];if((c&192)!=128){s+=e("MISSING_CONTINUE",s,n,r),l=null;break}l=l<<6|c&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,n,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,n,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,n,r,l);continue}r.push(l)}}return r}function Vi(t,e){$(typeof t=="string","invalid string value","str",t);let n=[];for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);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){r++;const i=t.charCodeAt(r);$(r<t.length&&(i&64512)===56320,"invalid surrogate pair","str",t);const o=65536+((s&1023)<<10)+(i&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 new Uint8Array(n)}function Pte(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Sc(t,e){return Pte(Rte(t,e))}function K_(t){async function e(n,r){te(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=n.url.split(":")[0].toLowerCase();te(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),te(s==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=_t("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{i=_t("request cancelled","CANCELLED"),o.abort()});const l={method:n.method,headers:new Headers(Array.from(n)),body:n.body||void 0,signal:o.signal};let u;try{u=await fetch(n.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const c={};u.headers.forEach((h,p)=>{c[p.toLowerCase()]=h});const f=await u.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:c,body:d}}return e}const Ite=12,Lte=250;let Q_=K_();const Bte=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Fte=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let fx=!1;async function J_(t,e){try{const n=t.match(Bte);if(!n)throw new Error("invalid data");return new ea(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?Dte(n[3]):Ute(n[3]))}catch{return new ea(599,"BAD REQUEST (invalid data: URI)",{},null,new qn(t))}}function Y_(t){async function e(n,r){try{const s=n.match(Fte);if(!s)throw new Error("invalid link");return new qn(`${t}${s[2]}`)}catch{return new ea(599,"BAD REQUEST (invalid IPFS URI)",{},null,new qn(n))}}return e}const Vg={data:J_,ipfs:Y_("https://gateway.ipfs.io/ipfs/")},X_=new WeakMap;class jte{constructor(e){J(this,$l);J(this,pa);L(this,$l,[]),L(this,pa,!1),X_.set(e,()=>{if(!T(this,pa)){L(this,pa,!0);for(const n of T(this,$l))setTimeout(()=>{n()},0);L(this,$l,[])}})}addListener(e){te(!T(this,pa),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,$l).push(e)}get cancelled(){return T(this,pa)}checkSignal(){te(!this.cancelled,"cancelled","CANCELLED",{})}}$l=new WeakMap,pa=new WeakMap;function zg(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}const Zy=class Zy{constructor(e){J(this,Kl);J(this,ef);J(this,tf);J(this,Os);J(this,so);J(this,nf);J(this,rf);J(this,wn);J(this,Ir);J(this,io);J(this,Gl);J(this,Wl);J(this,ql);J(this,pi);J(this,Ms);J(this,ma);L(this,rf,String(e)),L(this,ef,!1),L(this,tf,!0),L(this,Os,{}),L(this,so,""),L(this,nf,3e5),L(this,Ms,{slotInterval:Lte,maxAttempts:Ite}),L(this,ma,null)}get url(){return T(this,rf)}set url(e){L(this,rf,String(e))}get body(){return T(this,wn)==null?null:new Uint8Array(T(this,wn))}set body(e){if(e==null)L(this,wn,void 0),L(this,Ir,void 0);else if(typeof e=="string")L(this,wn,Vi(e)),L(this,Ir,"text/plain");else if(e instanceof Uint8Array)L(this,wn,e),L(this,Ir,"application/octet-stream");else if(typeof e=="object")L(this,wn,Vi(JSON.stringify(e))),L(this,Ir,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,wn)!=null}get method(){return T(this,so)?T(this,so):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),L(this,so,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,Os));return T(this,io)&&(e.authorization=`Basic ${Ote(Vi(T(this,io)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Ir)&&(e["content-type"]=T(this,Ir)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){T(this,Os)[String(e).toLowerCase()]=String(n)}clearHeaders(){L(this,Os,{})}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,io)||null}setCredentials(e,n){$(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),L(this,io,`${e}:${n}`)}get allowGzip(){return T(this,tf)}set allowGzip(e){L(this,tf,!!e)}get allowInsecureAuthentication(){return!!T(this,ef)}set allowInsecureAuthentication(e){L(this,ef,!!e)}get timeout(){return T(this,nf)}set timeout(e){$(e>=0,"timeout must be non-zero","timeout",e),L(this,nf,e)}get preflightFunc(){return T(this,Gl)||null}set preflightFunc(e){L(this,Gl,e)}get processFunc(){return T(this,Wl)||null}set processFunc(e){L(this,Wl,e)}get retryFunc(){return T(this,ql)||null}set retryFunc(e){L(this,ql,e)}get getUrlFunc(){return T(this,ma)||Q_}set getUrlFunc(e){L(this,ma,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,wn)?Ae(T(this,wn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,Ms).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,Ms).maxAttempts=e.maxAttempts)}send(){return te(T(this,pi)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),L(this,pi,new jte(this)),de(this,Kl,Dp).call(this,0,Z_()+this.timeout,0,this,new ea(0,"",{},null,this))}cancel(){te(T(this,pi)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=X_.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();te(this.method==="GET"&&(n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new Zy(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,L(s,Os,Object.assign({},T(this,Os))),T(this,wn)&&L(s,wn,new Uint8Array(T(this,wn))),L(s,Ir,T(this,Ir)),s}clone(){const e=new Zy(this.url);return L(e,so,T(this,so)),T(this,wn)&&L(e,wn,T(this,wn)),L(e,Ir,T(this,Ir)),L(e,Os,Object.assign({},T(this,Os))),L(e,io,T(this,io)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),L(e,Gl,T(this,Gl)),L(e,Wl,T(this,Wl)),L(e,ql,T(this,ql)),L(e,Ms,Object.assign({},T(this,Ms))),L(e,ma,T(this,ma)),e}static lockConfig(){fx=!0}static getGateway(e){return Vg[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(fx)throw new Error("gateways locked");Vg[e]=n}static registerGetUrl(e){if(fx)throw new Error("gateways locked");Q_=e}static createGetUrlFunc(e){return K_()}static createDataGateway(){return J_}static createIpfsGatewayFunc(e){return Y_(e)}};ef=new WeakMap,tf=new WeakMap,Os=new WeakMap,so=new WeakMap,nf=new WeakMap,rf=new WeakMap,wn=new WeakMap,Ir=new WeakMap,io=new WeakMap,Gl=new WeakMap,Wl=new WeakMap,ql=new WeakMap,pi=new WeakMap,Ms=new WeakMap,ma=new WeakMap,Kl=new WeakSet,Dp=async function(e,n,r,s,i){var c,f,d;if(e>=T(this,Ms).maxAttempts)return i.makeServerError("exceeded maximum retry limit");te(Z_()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await Hte(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Vg){const h=await Vg[a](o.url,zg(T(s,pi)));if(h instanceof ea){let p=h;if(this.processFunc){zg(T(s,pi));try{p=await this.processFunc(o,p)}catch(m){(m.throttle==null||typeof m.stall!="number")&&p.makeServerError("error in post-processing function",m).assertOk()}}return p}o=h}this.preflightFunc&&(o=await this.preflightFunc(o));const l=await this.getUrlFunc(o,zg(T(s,pi)));let u=new ea(l.statusCode,l.statusMessage,l.headers,l.body,s);if(u.statusCode===301||u.statusCode===302){try{const h=u.headers.location||"";return de(c=o.redirect(h),Kl,Dp).call(c,e+1,n,0,s,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const h=u.headers["retry-after"];let p=T(this,Ms).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),de(f=o.clone(),Kl,Dp).call(f,e+1,n,p,s,u)}if(this.processFunc){zg(T(s,pi));try{u=await this.processFunc(o,u)}catch(h){(h.throttle==null||typeof h.stall!="number")&&u.makeServerError("error in post-processing function",h).assertOk();let p=T(this,Ms).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),de(d=o.clone(),Kl,Dp).call(d,e+1,n,p,s,u)}}return u};let qn=Zy;const Mk=class Mk{constructor(e,n,r,s,i){J(this,dp);J(this,hp);J(this,pp);J(this,Lr);J(this,sf);J(this,Ql);L(this,dp,e),L(this,hp,n),L(this,pp,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),L(this,Lr,s==null?null:new Uint8Array(s)),L(this,sf,i||null),L(this,Ql,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Lr)?Ae(T(this,Lr)):"null"}>`}get statusCode(){return T(this,dp)}get statusMessage(){return T(this,hp)}get headers(){return Object.assign({},T(this,pp))}get body(){return T(this,Lr)==null?null:new Uint8Array(T(this,Lr))}get bodyText(){try{return T(this,Lr)==null?"":Sc(T(this,Lr))}catch{te(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{te(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new Mk(599,r,this.headers,this.body,T(this,sf)||void 0);return L(s,Ql,{message:e,error:n}),s}throwThrottleError(e,n){n==null?n=-1:$(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw Me(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Lr)!=null}get request(){return T(this,sf)}ok(){return T(this,Ql).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=T(this,Ql);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Lr)&&(s=Sc(T(this,Lr)))}catch{}te(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};dp=new WeakMap,hp=new WeakMap,pp=new WeakMap,Lr=new WeakMap,sf=new WeakMap,Ql=new WeakMap;let ea=Mk;function Z_(){return new Date().getTime()}function Ute(t){return Vi(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function Hte(t){return new Promise(e=>setTimeout(e,t))}function Vte(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function e4(t,e,n){let r=0;for(let s=0;s<n;s++)r=r*256+t[e+s];return r}function t4(t,e,n,r){const s=[];for(;n<e+1+r;){const i=n4(t,n);s.push(i.result),n+=i.consumed,te(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function n4(t,e){te(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{te(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const s=e4(t,e+1,r);return n(e+1+r+s),t4(t,e,e+1+r,r+s)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),t4(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=e4(t,e+1,r);n(e+1+r+s);const i=Ae(t.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const s=Ae(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:Vte(t[e])}}function $g(t){const e=ct(t,"data"),n=n4(e,0);return $(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function r4(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function s4(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(i){r=r.concat(s4(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=r4(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=r4(e.length);return n.unshift(183+n.length),n.concat(e)}const i4="0123456789abcdef";function El(t){let e="0x";for(const n of s4(t))e+=i4[n>>4],e+=i4[n&15];return e}const Kn=32,dx=new Uint8Array(Kn),zte=["then"],Gg={},o4=new WeakMap;function Cl(t){return o4.get(t)}function a4(t,e){o4.set(t,e)}function Oh(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function hx(t,e,n){return t.indexOf(null)>=0?e.map((r,s)=>r instanceof Tc?hx(Cl(r),r,n):r):t.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(n&&o instanceof Tc&&(o=hx(Cl(o),o,n)),r[s]=o),r},{})}const af=class af extends Array{constructor(...n){const r=n[0];let s=n[1],i=(n[2]||[]).slice(),o=!0;r!==Gg&&(s=n,i=[],o=!1);super(s.length);J(this,of);s.forEach((u,c)=>{this[c]=u});const a=i.reduce((u,c)=>(typeof c=="string"&&u.set(c,(u.get(c)||0)+1),u),new Map);if(a4(this,Object.freeze(s.map((u,c)=>{const f=i[c];return f!=null&&a.get(f)===1?f:null}))),L(this,of,[]),T(this,of)==null&&T(this,of),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(u,c,f)=>{if(typeof c=="string"){if(c.match(/^[0-9]+$/)){const h=Qe(c,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=u[h];return p instanceof Error&&Oh(`index ${h}`,p),p}if(zte.indexOf(c)>=0)return Reflect.get(u,c,f);const d=u[c];if(d instanceof Function)return function(...h){return d.apply(this===f?u:this,h)};if(!(c in u))return u.getValue.apply(this===f?u:this,[c])}return Reflect.get(u,c,f)}});return a4(l,Cl(this)),l}toArray(n){const r=[];return this.forEach((s,i)=>{s instanceof Error&&Oh(`index ${i}`,s),n&&s instanceof af&&(s=s.toArray(n)),r.push(s)}),r}toObject(n){const r=Cl(this);return r.reduce((s,i,o)=>(te(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),hx(r,this,n)),{})}slice(n,r){n==null&&(n=0),n<0&&(n+=this.length,n<0&&(n=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=Cl(this),i=[],o=[];for(let a=n;a<r;a++)i.push(this[a]),o.push(s[a]);return new af(Gg,i,o)}filter(n,r){const s=Cl(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&Oh(`index ${a}`,l),n.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new af(Gg,i,o)}map(n,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&Oh(`index ${i}`,o),s.push(n.call(r,o,i,this))}return s}getValue(n){const r=Cl(this).indexOf(n);if(r===-1)return;const s=this[r];return s instanceof Error&&Oh(`property ${JSON.stringify(n)}`,s.error),s}static fromItems(n,r){return new af(Gg,n,r)}};of=new WeakMap;let Tc=af;function l4(t){let e=Wn(t);return te(e.length<=Kn,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Kn,offset:e.length}),e.length!==Kn&&(e=Gn($t([dx.slice(e.length%Kn),e]))),e}class zi{constructor(e,n,r,s){q(this,"name");q(this,"type");q(this,"localName");q(this,"dynamic");Me(this,{name:e,type:n,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){$(!1,e,this.localName,n)}}class px{constructor(){J(this,lf);J(this,oo);J(this,Jl);L(this,oo,[]),L(this,Jl,0)}get data(){return $t(T(this,oo))}get length(){return T(this,Jl)}appendWriter(e){return de(this,lf,ob).call(this,Gn(e.data))}writeBytes(e){let n=Gn(e);const r=n.length%Kn;return r&&(n=Gn($t([n,dx.slice(r)]))),de(this,lf,ob).call(this,n)}writeValue(e){return de(this,lf,ob).call(this,l4(e))}writeUpdatableValue(){const e=T(this,oo).length;return T(this,oo).push(dx),L(this,Jl,T(this,Jl)+Kn),n=>{T(this,oo)[e]=l4(n)}}}oo=new WeakMap,Jl=new WeakMap,lf=new WeakSet,ob=function(e){return T(this,oo).push(e),L(this,Jl,T(this,Jl)+e.length),e.length};const Nk=class Nk{constructor(e,n,r){J(this,Zl);q(this,"allowLoose");J(this,pr);J(this,Br);J(this,Yl);J(this,Xl);J(this,ga);Me(this,{allowLoose:!!n}),L(this,pr,Gn(e)),L(this,Yl,0),L(this,Xl,null),L(this,ga,r??1024),L(this,Br,0)}get data(){return Ae(T(this,pr))}get dataLength(){return T(this,pr).length}get consumed(){return T(this,Br)}get bytes(){return new Uint8Array(T(this,pr))}subReader(e){const n=new Nk(T(this,pr).slice(T(this,Br)+e),this.allowLoose,T(this,ga));return L(n,Xl,this),n}readBytes(e,n){let r=de(this,Zl,OL).call(this,0,e,!!n);return de(this,Zl,Uk).call(this,e),L(this,Br,T(this,Br)+r.length),r.slice(0,e)}readValue(){return cx(this.readBytes(Kn))}readIndex(){return Ste(this.readBytes(Kn))}};pr=new WeakMap,Br=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,ga=new WeakMap,Zl=new WeakSet,Uk=function(e){var n;if(T(this,Xl))return de(n=T(this,Xl),Zl,Uk).call(n,e);L(this,Yl,T(this,Yl)+e),te(T(this,ga)<1||T(this,Yl)<=T(this,ga)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ga)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),offset:T(this,Br),length:e,info:{bytesRead:T(this,Yl),dataLength:this.dataLength}})},OL=function(e,n,r){let s=Math.ceil(n/Kn)*Kn;return T(this,Br)+s>T(this,pr).length&&(this.allowLoose&&r&&T(this,Br)+n<=T(this,pr).length?s=n:te(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),length:T(this,pr).length,offset:T(this,Br)+s})),T(this,pr).slice(T(this,Br),T(this,Br)+s)};let mx=Nk;function Wg(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function gx(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function $te(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Wg(t.outputLen),Wg(t.blockLen)}function Dc(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 u4(t,e){gx(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const yx=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const c4=t=>t instanceof Uint8Array,Gte=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),bx=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ci=(t,e)=>t<<32-e|t>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function Wte(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function qg(t){if(typeof t=="string"&&(t=Wte(t)),!c4(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function qte(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!c4(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}class wx{clone(){return this._cloneInto()}}function Ax(t){const e=r=>t().update(qg(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Kte(t=32){if(yx&&typeof yx.getRandomValues=="function")return yx.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class f4 extends wx{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,$te(e);const r=qg(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,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Dc(this),this.iHash.update(e),this}digestInto(e){Dc(this),gx(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:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const d4=(t,e,n)=>new f4(t,e).update(n).digest();d4.create=(t,e)=>new f4(t,e);function Qte(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),l=r?4:0,u=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+u,a,r)}class h4 extends wx{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=bx(this.buffer)}update(e){Dc(this);const{view:n,buffer:r,blockLen:s}=this;e=qg(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const l=bx(e);for(;s<=i-o;o+=s)this.process(l,o);continue}r.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){Dc(this),u4(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;Qte(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=bx(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,c[f],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%n&&e.buffer.set(r),e}}const Jte=(t,e,n)=>t&e^~t&n,Yte=(t,e,n)=>t&e^t&n^e&n,Xte=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ta=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),na=new Uint32Array(64);class Zte extends h4{constructor(){super(64,32,8,!1),this.A=ta[0]|0,this.B=ta[1]|0,this.C=ta[2]|0,this.D=ta[3]|0,this.E=ta[4]|0,this.F=ta[5]|0,this.G=ta[6]|0,this.H=ta[7]|0}get(){const{A:e,B:n,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,n,r,s,i,o,a,l]}set(e,n,r,s,i,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)na[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const d=na[f-15],h=na[f-2],p=ci(d,7)^ci(d,18)^d>>>3,m=ci(h,17)^ci(h,19)^h>>>10;na[f]=m+na[f-7]+p+na[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:u,H:c}=this;for(let f=0;f<64;f++){const d=ci(a,6)^ci(a,11)^ci(a,25),h=c+d+Jte(a,l,u)+Xte[f]+na[f]|0,m=(ci(r,2)^ci(r,13)^ci(r,22))+Yte(r,s,i)|0;c=u,u=l,l=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,s,i,o,a,l,u,c)}roundClean(){na.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const p4=Ax(()=>new Zte),Kg=BigInt(2**32-1),vx=BigInt(32);function m4(t,e=!1){return e?{h:Number(t&Kg),l:Number(t>>vx&Kg)}:{h:Number(t>>vx&Kg)|0,l:Number(t&Kg)|0}}function g4(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=m4(t[s],e);[n[s],r[s]]=[i,o]}return[n,r]}const ene=(t,e)=>BigInt(t>>>0)<<vx|BigInt(e>>>0),tne=(t,e,n)=>t>>>n,nne=(t,e,n)=>t<<32-n|e>>>n,rne=(t,e,n)=>t>>>n|e<<32-n,sne=(t,e,n)=>t<<32-n|e>>>n,ine=(t,e,n)=>t<<64-n|e>>>n-32,one=(t,e,n)=>t>>>n-32|e<<64-n,ane=(t,e)=>e,lne=(t,e)=>t,y4=(t,e,n)=>t<<n|e>>>32-n,b4=(t,e,n)=>e<<n|t>>>32-n,w4=(t,e,n)=>e<<n-32|t>>>64-n,A4=(t,e,n)=>t<<n-32|e>>>64-n;function une(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const et={fromBig:m4,split:g4,toBig:ene,shrSH:tne,shrSL:nne,rotrSH:rne,rotrSL:sne,rotrBH:ine,rotrBL:one,rotr32H:ane,rotr32L:lne,rotlSH:y4,rotlSL:b4,rotlBH:w4,rotlBL:A4,add:une,add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,add5H:(t,e,n,r,s,i)=>e+n+r+s+i+(t/2**32|0)|0,add5L:(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},[cne,fne]=et.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),ra=new Uint32Array(80),sa=new Uint32Array(80);class dne extends h4{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:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:u,El:c,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:g}=this;return[e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g]}set(e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g){this.Ah=e|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=u|0,this.El=c|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(e,n){for(let A=0;A<16;A++,n+=4)ra[A]=e.getUint32(n),sa[A]=e.getUint32(n+=4);for(let A=16;A<80;A++){const w=ra[A-15]|0,x=sa[A-15]|0,k=et.rotrSH(w,x,1)^et.rotrSH(w,x,8)^et.shrSH(w,x,7),C=et.rotrSL(w,x,1)^et.rotrSL(w,x,8)^et.shrSL(w,x,7),D=ra[A-2]|0,O=sa[A-2]|0,N=et.rotrSH(D,O,19)^et.rotrBH(D,O,61)^et.shrSH(D,O,6),R=et.rotrSL(D,O,19)^et.rotrBL(D,O,61)^et.shrSL(D,O,6),B=et.add4L(C,R,sa[A-7],sa[A-16]),F=et.add4H(B,k,N,ra[A-7],ra[A-16]);ra[A]=F|0,sa[A]=B|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:u,Dl:c,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:g,Hh:b,Hl:v}=this;for(let A=0;A<80;A++){const w=et.rotrSH(f,d,14)^et.rotrSH(f,d,18)^et.rotrBH(f,d,41),x=et.rotrSL(f,d,14)^et.rotrSL(f,d,18)^et.rotrBL(f,d,41),k=f&h^~f&m,C=d&p^~d&g,D=et.add5L(v,x,C,fne[A],sa[A]),O=et.add5H(D,b,w,k,cne[A],ra[A]),N=D|0,R=et.rotrSH(r,s,28)^et.rotrBH(r,s,34)^et.rotrBH(r,s,39),B=et.rotrSL(r,s,28)^et.rotrBL(r,s,34)^et.rotrBL(r,s,39),F=r&i^r&a^i&a,G=s&o^s&l^o&l;b=m|0,v=g|0,m=h|0,g=p|0,h=f|0,p=d|0,{h:f,l:d}=et.add(u|0,c|0,O|0,N|0),u=a|0,c=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const I=et.add3L(N,B,G);r=et.add3H(I,O,R,F),s=I|0}({h:r,l:s}=et.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=et.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l}=et.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:u,l:c}=et.add(this.Dh|0,this.Dl|0,u|0,c|0),{h:f,l:d}=et.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=et.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:g}=et.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:b,l:v}=et.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(r,s,i,o,a,l,u,c,f,d,h,p,m,g,b,v)}roundClean(){ra.fill(0),sa.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 hne=Ax(()=>new dne);function pne(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const v4=pne();v4.crypto||v4.msCrypto;function mne(t){switch(t){case"sha256":return p4.create();case"sha512":return hne.create()}$(!1,"invalid hashing algorithm name","algorithm",t)}const[x4,k4,E4]=[[],[],[]],gne=BigInt(0),Mh=BigInt(1),yne=BigInt(2),bne=BigInt(7),wne=BigInt(256),Ane=BigInt(113);for(let t=0,e=Mh,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],x4.push(2*(5*r+n)),k4.push((t+1)*(t+2)/2%64);let s=gne;for(let i=0;i<7;i++)e=(e<<Mh^(e>>bne)*Ane)%wne,e&yne&&(s^=Mh<<(Mh<<BigInt(i))-Mh);E4.push(s)}const[vne,xne]=g4(E4,!0),C4=(t,e,n)=>n>32?w4(t,e,n):y4(t,e,n),S4=(t,e,n)=>n>32?A4(t,e,n):b4(t,e,n);function kne(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){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,l=(o+2)%10,u=n[l],c=n[l+1],f=C4(u,c,1)^n[a],d=S4(u,c,1)^n[a+1];for(let h=0;h<50;h+=10)t[o+h]^=f,t[o+h+1]^=d}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=k4[o],l=C4(s,i,a),u=S4(s,i,a),c=x4[o];s=t[c],i=t[c+1],t[c]=l,t[c+1]=u}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]^=vne[r],t[1]^=xne[r]}n.fill(0)}class xx extends wx{constructor(e,n,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Wg(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Gte(this.state)}keccak(){kne(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Dc(this);const{blockLen:n,state:r}=this;e=qg(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Dc(this,!1),gx(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-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 Wg(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(u4(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new xx(n,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Ene=((t,e,n)=>Ax(()=>new xx(e,t,n)))(1,136,256/8);let T4=!1;const D4=function(t){return Ene(t)};let O4=D4;function en(t){const e=ct(t,"data");return Ae(O4(e))}en._=D4,en.lock=function(){T4=!0},en.register=function(t){if(T4)throw new TypeError("keccak256 is locked");O4=t},Object.freeze(en);const M4=function(t){return mne("sha256").update(t).digest()};let N4=M4,_4=!1;function Oc(t){const e=ct(t,"data");return Ae(N4(e))}Oc._=M4,Oc.lock=function(){_4=!0},Oc.register=function(t){if(_4)throw new Error("sha256 is locked");N4=t},Object.freeze(Oc),Object.freeze(Oc);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const R4=BigInt(0),Qg=BigInt(1),Cne=BigInt(2),Jg=t=>t instanceof Uint8Array,Sne=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Mc(t){if(!Jg(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=Sne[t[n]];return e}function P4(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function kx(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function Nc(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const s=r*2,i=t.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function Sl(t){return kx(Mc(t))}function Ex(t){if(!Jg(t))throw new Error("Uint8Array expected");return kx(Mc(Uint8Array.from(t).reverse()))}function _c(t,e){return Nc(t.toString(16).padStart(e*2,"0"))}function Cx(t,e){return _c(t,e).reverse()}function Tne(t){return Nc(P4(t))}function Cs(t,e,n){let r;if(typeof e=="string")try{r=Nc(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(Jg(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(`${t} expected ${n} bytes, got ${s}`);return r}function Nh(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!Jg(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function Dne(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function One(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Mne(t){let e;for(e=0;t>R4;t>>=Qg,e+=1);return e}function Nne(t,e){return t>>BigInt(e)&Qg}const _ne=(t,e,n)=>t|(n?Qg:R4)<<BigInt(e),Sx=t=>(Cne<<BigInt(t-1))-Qg,Tx=t=>new Uint8Array(t),I4=t=>Uint8Array.from(t);function L4(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 r=Tx(t),s=Tx(t),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>n(s,r,...f),l=(f=Tx())=>{s=a(I4([0]),f),r=a(),f.length!==0&&(s=a(I4([1]),f),r=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<e;){r=a();const h=r.slice();d.push(h),f+=r.length}return Nh(...d)};return(f,d)=>{o(),l(f);let h;for(;!(h=d(u()));)l();return o(),h}}const Rne={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function _h(t,e,n={}){const r=(s,i,o)=>{const a=Rne[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=t[s];if(!(o&&l===void 0)&&!a(l,t))throw new Error(`Invalid param ${String(s)}=${l} (${typeof l}), expected ${i}`)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return t}const Pne=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Nne,bitLen:Mne,bitMask:Sx,bitSet:_ne,bytesToHex:Mc,bytesToNumberBE:Sl,bytesToNumberLE:Ex,concatBytes:Nh,createHmacDrbg:L4,ensureBytes:Cs,equalBytes:Dne,hexToBytes:Nc,hexToNumber:kx,numberToBytesBE:_c,numberToBytesLE:Cx,numberToHexUnpadded:P4,numberToVarBytesBE:Tne,utf8ToBytes:One,validateObject:_h},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const yn=BigInt(0),Gt=BigInt(1),Tl=BigInt(2),Ine=BigInt(3),Dx=BigInt(4),B4=BigInt(5),F4=BigInt(8);BigInt(9),BigInt(16);function fr(t,e){const n=t%e;return n>=yn?n:e+n}function Lne(t,e,n){if(n<=yn||e<yn)throw new Error("Expected power/modulo > 0");if(n===Gt)return yn;let r=Gt;for(;e>yn;)e&Gt&&(r=r*t%n),t=t*t%n,e>>=Gt;return r}function Xr(t,e,n){let r=t;for(;e-- >yn;)r*=r,r%=n;return r}function Ox(t,e){if(t===yn||e<=yn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=fr(t,e),r=e,s=yn,i=Gt;for(;n!==yn;){const a=r/n,l=r%n,u=s-i*a;r=n,n=l,s=i,i=u}if(r!==Gt)throw new Error("invert: does not exist");return fr(s,e)}function Bne(t){const e=(t-Gt)/Tl;let n,r,s;for(n=t-Gt,r=0;n%Tl===yn;n/=Tl,r++);for(s=Tl;s<t&&Lne(s,e,t)!==t-Gt;s++);if(r===1){const o=(t+Gt)/Dx;return function(l,u){const c=l.pow(u,o);if(!l.eql(l.sqr(c),u))throw new Error("Cannot find square root");return c}}const i=(n+Gt)/Tl;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,c=a.pow(a.mul(a.ONE,s),n),f=a.pow(l,i),d=a.pow(l,n);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<u&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(c,Gt<<BigInt(u-h-1));c=a.sqr(p),f=a.mul(f,p),d=a.mul(d,c),u=h}return f}}function Fne(t){if(t%Dx===Ine){const e=(t+Gt)/Dx;return function(r,s){const i=r.pow(s,e);if(!r.eql(r.sqr(i),s))throw new Error("Cannot find square root");return i}}if(t%F4===B4){const e=(t-B4)/F4;return function(r,s){const i=r.mul(s,Tl),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,Tl),o),u=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return Bne(t)}const jne=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Une(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=jne.reduce((r,s)=>(r[s]="function",r),e);return _h(t,n)}function Hne(t,e,n){if(n<yn)throw new Error("Expected power > 0");if(n===yn)return t.ONE;if(n===Gt)return e;let r=t.ONE,s=e;for(;n>yn;)n&Gt&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Gt;return r}function Vne(t,e){const n=new Array(e.length),r=e.reduce((i,o,a)=>t.is0(o)?i:(n[a]=i,t.mul(i,o)),t.ONE),s=t.inv(r);return e.reduceRight((i,o,a)=>t.is0(o)?i:(n[a]=t.mul(i,n[a]),t.mul(i,o)),s),n}function j4(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function zne(t,e,n=!1,r={}){if(t<=yn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:i}=j4(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Fne(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:i,MASK:Sx(s),ZERO:yn,ONE:Gt,create:l=>fr(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return yn<=l&&l<t},is0:l=>l===yn,isOdd:l=>(l&Gt)===Gt,neg:l=>fr(-l,t),eql:(l,u)=>l===u,sqr:l=>fr(l*l,t),add:(l,u)=>fr(l+u,t),sub:(l,u)=>fr(l-u,t),mul:(l,u)=>fr(l*u,t),pow:(l,u)=>Hne(a,l,u),div:(l,u)=>fr(l*Ox(u,t),t),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Ox(l,t),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>Vne(a,l),cmov:(l,u,c)=>c?u:l,toBytes:l=>n?Cx(l,i):_c(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return n?Ex(l):Sl(l)}});return Object.freeze(a)}function U4(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 H4(t){const e=U4(t);return e+Math.ceil(e/2)}function $ne(t,e,n=!1){const r=t.length,s=U4(e),i=H4(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=n?Sl(t):Ex(t),a=fr(o,e-Gt)+Gt;return n?Cx(a,s):_c(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Gne=BigInt(0),Mx=BigInt(1);function Wne(t,e){const n=(s,i)=>{const o=i.negate();return s?o:i},r=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:n,unsafeLadder(s,i){let o=t.ZERO,a=s;for(;i>Gne;)i&Mx&&(o=o.add(a)),a=a.double(),i>>=Mx;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let u=s,c=u;for(let f=0;f<o;f++){c=u,l.push(c);for(let d=1;d<a;d++)c=c.add(u),l.push(c);u=c.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let u=t.ZERO,c=t.BASE;const f=BigInt(2**s-1),d=2**s,h=BigInt(s);for(let p=0;p<a;p++){const m=p*l;let g=Number(o&f);o>>=h,g>l&&(g-=d,o+=Mx);const b=m,v=m+Math.abs(g)-1,A=p%2!==0,w=g<0;g===0?c=c.add(n(A,i[b])):u=u.add(n(w,i[v]))}return{p:u,f:c}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let u=i.get(s);return u||(u=this.precomputeWindow(s,l),l!==1&&i.set(s,a(u))),this.wNAF(l,u,o)}}}function V4(t){return Une(t.Fp),_h(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...j4(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qne(t){const e=V4(t);_h(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Kne,hexToBytes:Qne}=Pne,Dl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=Dl;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Kne(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Dl,n=typeof t=="string"?Qne(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=Dl._parseInt(n.subarray(2)),{d:o,l:a}=Dl._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const c=u.toString(16);return c.length&1?`0${c}`:c},r=e(n(t.s)),s=e(n(t.r)),i=r.length/2,o=s.length/2,a=n(i),l=n(o);return`30${n(o+i+4)}02${l}${s}02${a}${r}`}},$i=BigInt(0),Zr=BigInt(1);BigInt(2);const z4=BigInt(3);BigInt(4);function Jne(t){const e=qne(t),{Fp:n}=e,r=e.toBytes||((p,m,g)=>{const b=m.toAffine();return Nh(Uint8Array.from([4]),n.toBytes(b.x),n.toBytes(b.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),g=n.fromBytes(m.subarray(0,n.BYTES)),b=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:g,y:b}});function i(p){const{a:m,b:g}=e,b=n.sqr(p),v=n.mul(b,p);return n.add(n.add(v,n.mul(p,m)),g)}if(!n.eql(n.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&$i<p&&p<e.n}function a(p){if(!o(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(p){const{allowedPrivateKeyLengths:m,nByteLength:g,wrapPrivateKey:b,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=Mc(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(g*2,"0")}let A;try{A=typeof p=="bigint"?p:Sl(Cs("private key",p,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`)}return b&&(A=fr(A,v)),a(A),A}const u=new Map;function c(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,g,b){if(this.px=m,this.py=g,this.pz=b,m==null||!n.isValid(m))throw new Error("x required");if(g==null||!n.isValid(g))throw new Error("y required");if(b==null||!n.isValid(b))throw new Error("z required")}static fromAffine(m){const{x:g,y:b}=m||{};if(!m||!n.isValid(g)||!n.isValid(b))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=A=>n.eql(A,n.ZERO);return v(g)&&v(b)?f.ZERO:new f(g,b,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const g=n.invertBatch(m.map(b=>b.pz));return m.map((b,v)=>b.toAffine(g[v])).map(f.fromAffine)}static fromHex(m){const g=f.fromAffine(s(Cs("pointHex",m)));return g.assertValidity(),g}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:g}=this.toAffine();if(!n.isValid(m)||!n.isValid(g))throw new Error("bad point: x or y not FE");const b=n.sqr(g),v=i(m);if(!n.eql(b,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){c(m);const{px:g,py:b,pz:v}=this,{px:A,py:w,pz:x}=m,k=n.eql(n.mul(g,x),n.mul(A,v)),C=n.eql(n.mul(b,x),n.mul(w,v));return k&&C}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,b=n.mul(g,z4),{px:v,py:A,pz:w}=this;let x=n.ZERO,k=n.ZERO,C=n.ZERO,D=n.mul(v,v),O=n.mul(A,A),N=n.mul(w,w),R=n.mul(v,A);return R=n.add(R,R),C=n.mul(v,w),C=n.add(C,C),x=n.mul(m,C),k=n.mul(b,N),k=n.add(x,k),x=n.sub(O,k),k=n.add(O,k),k=n.mul(x,k),x=n.mul(R,x),C=n.mul(b,C),N=n.mul(m,N),R=n.sub(D,N),R=n.mul(m,R),R=n.add(R,C),C=n.add(D,D),D=n.add(C,D),D=n.add(D,N),D=n.mul(D,R),k=n.add(k,D),N=n.mul(A,w),N=n.add(N,N),D=n.mul(N,R),x=n.sub(x,D),C=n.mul(N,O),C=n.add(C,C),C=n.add(C,C),new f(x,k,C)}add(m){c(m);const{px:g,py:b,pz:v}=this,{px:A,py:w,pz:x}=m;let k=n.ZERO,C=n.ZERO,D=n.ZERO;const O=e.a,N=n.mul(e.b,z4);let R=n.mul(g,A),B=n.mul(b,w),F=n.mul(v,x),G=n.add(g,b),I=n.add(A,w);G=n.mul(G,I),I=n.add(R,B),G=n.sub(G,I),I=n.add(g,v);let U=n.add(A,x);return I=n.mul(I,U),U=n.add(R,F),I=n.sub(I,U),U=n.add(b,v),k=n.add(w,x),U=n.mul(U,k),k=n.add(B,F),U=n.sub(U,k),D=n.mul(O,I),k=n.mul(N,F),D=n.add(k,D),k=n.sub(B,D),D=n.add(B,D),C=n.mul(k,D),B=n.add(R,R),B=n.add(B,R),F=n.mul(O,F),I=n.mul(N,I),B=n.add(B,F),F=n.sub(R,F),F=n.mul(O,F),I=n.add(I,F),R=n.mul(B,I),C=n.add(C,R),R=n.mul(U,I),k=n.mul(G,k),k=n.sub(k,R),R=n.mul(G,B),D=n.mul(U,D),D=n.add(D,R),new f(k,C,D)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,u,m,g=>{const b=n.invertBatch(g.map(v=>v.pz));return g.map((v,A)=>v.toAffine(b[A])).map(f.fromAffine)})}multiplyUnsafe(m){const g=f.ZERO;if(m===$i)return g;if(a(m),m===Zr)return this;const{endo:b}=e;if(!b)return h.unsafeLadder(this,m);let{k1neg:v,k1:A,k2neg:w,k2:x}=b.splitScalar(m),k=g,C=g,D=this;for(;A>$i||x>$i;)A&Zr&&(k=k.add(D)),x&Zr&&(C=C.add(D)),D=D.double(),A>>=Zr,x>>=Zr;return v&&(k=k.negate()),w&&(C=C.negate()),C=new f(n.mul(C.px,b.beta),C.py,C.pz),k.add(C)}multiply(m){a(m);let g=m,b,v;const{endo:A}=e;if(A){const{k1neg:w,k1:x,k2neg:k,k2:C}=A.splitScalar(g);let{p:D,f:O}=this.wNAF(x),{p:N,f:R}=this.wNAF(C);D=h.constTimeNegate(w,D),N=h.constTimeNegate(k,N),N=new f(n.mul(N.px,A.beta),N.py,N.pz),b=D.add(N),v=O.add(R)}else{const{p:w,f:x}=this.wNAF(g);b=w,v=x}return f.normalizeZ([b,v])[0]}multiplyAndAddUnsafe(m,g,b){const v=f.BASE,A=(x,k)=>k===$i||k===Zr||!x.equals(v)?x.multiplyUnsafe(k):x.multiply(k),w=A(this,g).add(A(m,b));return w.is0()?void 0:w}toAffine(m){const{px:g,py:b,pz:v}=this,A=this.is0();m==null&&(m=A?n.ONE:n.inv(v));const w=n.mul(g,m),x=n.mul(b,m),k=n.mul(v,m);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(k,n.ONE))throw new Error("invZ was invalid");return{x:w,y:x}}isTorsionFree(){const{h:m,isTorsionFree:g}=e;if(m===Zr)return!0;if(g)return g(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:g}=e;return m===Zr?this:g?g(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return Mc(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const d=e.nBitLength,h=Wne(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function Yne(t){const e=V4(t);return _h(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Xne(t){const e=Yne(t),{Fp:n,n:r}=e,s=n.BYTES+1,i=2*n.BYTES+1;function o(I){return $i<I&&I<n.ORDER}function a(I){return fr(I,r)}function l(I){return Ox(I,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:f,isWithinCurveOrder:d}=Jne({...e,toBytes(I,U,W){const ee=U.toAffine(),Z=n.toBytes(ee.x),ue=Nh;return W?ue(Uint8Array.from([U.hasEvenY()?2:3]),Z):ue(Uint8Array.from([4]),Z,n.toBytes(ee.y))},fromBytes(I){const U=I.length,W=I[0],ee=I.subarray(1);if(U===s&&(W===2||W===3)){const Z=Sl(ee);if(!o(Z))throw new Error("Point is not on curve");const ue=f(Z);let xe=n.sqrt(ue);const Se=(xe&Zr)===Zr;return(W&1)===1!==Se&&(xe=n.neg(xe)),{x:Z,y:xe}}else if(U===i&&W===4){const Z=n.fromBytes(ee.subarray(0,n.BYTES)),ue=n.fromBytes(ee.subarray(n.BYTES,2*n.BYTES));return{x:Z,y:ue}}else throw new Error(`Point of length ${U} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=I=>Mc(_c(I,e.nByteLength));function p(I){const U=r>>Zr;return I>U}function m(I){return p(I)?a(-I):I}const g=(I,U,W)=>Sl(I.slice(U,W));class b{constructor(U,W,ee){this.r=U,this.s=W,this.recovery=ee,this.assertValidity()}static fromCompact(U){const W=e.nByteLength;return U=Cs("compactSignature",U,W*2),new b(g(U,0,W),g(U,W,2*W))}static fromDER(U){const{r:W,s:ee}=Dl.toSig(Cs("DER",U));return new b(W,ee)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(U){return new b(this.r,this.s,U)}recoverPublicKey(U){const{r:W,s:ee,recovery:Z}=this,ue=C(Cs("msgHash",U));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const xe=Z===2||Z===3?W+e.n:W;if(xe>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const Se=Z&1?"03":"02",ke=u.fromHex(Se+h(xe)),me=l(xe),Ne=a(-ue*me),je=a(ee*me),ze=u.BASE.multiplyAndAddUnsafe(ke,Ne,je);if(!ze)throw new Error("point at infinify");return ze.assertValidity(),ze}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Nc(this.toDERHex())}toDERHex(){return Dl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Nc(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(I){try{return c(I),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const I=H4(e.n);return $ne(e.randomBytes(I),e.n)},precompute(I=8,U=u.BASE){return U._setWindowSize(I),U.multiply(BigInt(3)),U}};function A(I,U=!0){return u.fromPrivateKey(I).toRawBytes(U)}function w(I){const U=I instanceof Uint8Array,W=typeof I=="string",ee=(U||W)&&I.length;return U?ee===s||ee===i:W?ee===2*s||ee===2*i:I instanceof u}function x(I,U,W=!0){if(w(I))throw new Error("first arg must be private key");if(!w(U))throw new Error("second arg must be public key");return u.fromHex(U).multiply(c(I)).toRawBytes(W)}const k=e.bits2int||function(I){const U=Sl(I),W=I.length*8-e.nBitLength;return W>0?U>>BigInt(W):U},C=e.bits2int_modN||function(I){return a(k(I))},D=Sx(e.nBitLength);function O(I){if(typeof I!="bigint")throw new Error("bigint expected");if(!($i<=I&&I<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return _c(I,e.nByteLength)}function N(I,U,W=R){if(["recovered","canonical"].some(tt=>tt in W))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:Z}=e;let{lowS:ue,prehash:xe,extraEntropy:Se}=W;ue==null&&(ue=!0),I=Cs("msgHash",I),xe&&(I=Cs("prehashed msgHash",ee(I)));const ke=C(I),me=c(U),Ne=[O(me),O(ke)];if(Se!=null){const tt=Se===!0?Z(n.BYTES):Se;Ne.push(Cs("extraEntropy",tt))}const je=Nh(...Ne),ze=ke;function Be(tt){const le=k(tt);if(!d(le))return;const $e=l(le),ae=u.BASE.multiply(le).toAffine(),we=a(ae.x);if(we===$i)return;const Fe=a($e*a(ze+we*me));if(Fe===$i)return;let z=(ae.x===we?0:2)|Number(ae.y&Zr),Q=Fe;return ue&&p(Fe)&&(Q=m(Fe),z^=1),new b(we,Q,z)}return{seed:je,k2sig:Be}}const R={lowS:e.lowS,prehash:!1},B={lowS:e.lowS,prehash:!1};function F(I,U,W=R){const{seed:ee,k2sig:Z}=N(I,U,W),ue=e;return L4(ue.hash.outputLen,ue.nByteLength,ue.hmac)(ee,Z)}u.BASE._setWindowSize(8);function G(I,U,W,ee=B){var ae;const Z=I;if(U=Cs("msgHash",U),W=Cs("publicKey",W),"strict"in ee)throw new Error("options.strict was renamed to lowS");const{lowS:ue,prehash:xe}=ee;let Se,ke;try{if(typeof Z=="string"||Z instanceof Uint8Array)try{Se=b.fromDER(Z)}catch(we){if(!(we instanceof Dl.Err))throw we;Se=b.fromCompact(Z)}else if(typeof Z=="object"&&typeof Z.r=="bigint"&&typeof Z.s=="bigint"){const{r:we,s:Fe}=Z;Se=new b(we,Fe)}else throw new Error("PARSE");ke=u.fromHex(W)}catch(we){if(we.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ue&&Se.hasHighS())return!1;xe&&(U=e.hash(U));const{r:me,s:Ne}=Se,je=C(U),ze=l(Ne),Be=a(je*ze),tt=a(me*ze),le=(ae=u.BASE.multiplyAndAddUnsafe(ke,Be,tt))==null?void 0:ae.toAffine();return le?a(le.x)===me:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:x,sign:F,verify:G,ProjectivePoint:u,Signature:b,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Zne(t){return{hash:t,hmac:(e,...n)=>d4(t,e,qte(...n)),randomBytes:Kte}}function ere(t,e){const n=r=>Xne({...t,...Zne(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $4=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),G4=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),tre=BigInt(1),Nx=BigInt(2),W4=(t,e)=>(t+e/Nx)/e;function nre(t){const e=$4,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),u=t*t*t%e,c=u*u*t%e,f=Xr(c,n,e)*c%e,d=Xr(f,n,e)*c%e,h=Xr(d,Nx,e)*u%e,p=Xr(h,s,e)*h%e,m=Xr(p,i,e)*p%e,g=Xr(m,a,e)*m%e,b=Xr(g,l,e)*g%e,v=Xr(b,a,e)*m%e,A=Xr(v,n,e)*c%e,w=Xr(A,o,e)*p%e,x=Xr(w,r,e)*u%e,k=Xr(x,Nx,e);if(!_x.eql(_x.sqr(k),t))throw new Error("Cannot find square root");return k}const _x=zne($4,void 0,void 0,{sqrt:nre}),ia=ere({a:BigInt(0),b:BigInt(7),Fp:_x,n:G4,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=G4,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-tre*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=W4(i*t,e),l=W4(-r*t,e);let u=fr(t-a*n-l*s,e),c=fr(-a*r-l*i,e);const f=u>o,d=c>o;if(f&&(u=e-u),d&&(c=e-c),u>o||c>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:d,k2:c}}}},p4);BigInt(0),ia.ProjectivePoint;const Rh="0x0000000000000000000000000000000000000000",q4="0x0000000000000000000000000000000000000000000000000000000000000000",K4=BigInt(0),Q4=BigInt(1),J4=BigInt(2),Y4=BigInt(27),X4=BigInt(28),Yg=BigInt(35),Rc={};function Z4(t){return xl(Wn(t),32)}const Ns=class Ns{constructor(e,n,r,s){J(this,uf);J(this,cf);J(this,ff);J(this,eu);jg(e,Rc,"Signature"),L(this,uf,n),L(this,cf,r),L(this,ff,s),L(this,eu,null)}get r(){return T(this,uf)}set r(e){$(Ec(e)===32,"invalid r","value",e),L(this,uf,Ae(e))}get s(){return T(this,cf)}set s(e){$(Ec(e)===32,"invalid s","value",e);const n=Ae(e);$(parseInt(n.substring(0,3))<8,"non-canonical s","value",n),L(this,cf,n)}get v(){return T(this,ff)}set v(e){const n=Qe(e,"value");$(n===27||n===28,"invalid v","v",e),L(this,ff,n)}get networkV(){return T(this,eu)}get legacyChainId(){const e=this.networkV;return e==null?null:Ns.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ct(this.s);return this.yParity&&(e[0]|=128),Ae(e)}get compactSerialized(){return $t([this.r,this.yParityAndS])}get serialized(){return $t([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Ns(Rc,this.r,this.s,this.v);return this.networkV&&L(e,eu,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const n=Ce(e,"v");return n==Y4||n==X4?K4:($(n>=Yg,"invalid EIP-155 v","v",e),(n-Yg)/J4)}static getChainIdV(e,n){return Ce(e)*J4+BigInt(35+n-27)}static getNormalizedV(e){const n=Ce(e);return n===K4||n===Y4?27:n===Q4||n===X4?28:($(n>=Yg,"invalid v","v",e),n&Q4?27:28)}static from(e){function n(u,c){$(u,c,"signature",e)}if(e==null)return new Ns(Rc,q4,q4,27);if(typeof e=="string"){const u=ct(e,"signature");if(u.length===64){const c=Ae(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Ns(Rc,c,Ae(f),d)}if(u.length===65){const c=Ae(u.slice(0,32)),f=u.slice(32,64);n((f[0]&128)===0,"non-canonical s");const d=Ns.getNormalizedV(u[64]);return new Ns(Rc,c,Ae(f),d)}n(!1,"invalid raw signature length")}if(e instanceof Ns)return e.clone();const r=e.r;n(r!=null,"missing r");const s=Z4(r),i=function(u,c){if(u!=null)return Z4(u);if(c!=null){n(St(c,32),"invalid yParityAndS");const f=ct(c);return f[0]&=127,Ae(f)}n(!1,"missing s")}(e.s,e.yParityAndS);n((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(u,c,f){if(u!=null){const d=Ce(u);return{networkV:d>=Yg?d:void 0,v:Ns.getNormalizedV(d)}}if(c!=null)return n(St(c,32),"invalid yParityAndS"),{v:ct(c)[0]&128?28:27};if(f!=null){switch(Qe(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Ns(Rc,s,i,a);return o&&L(l,eu,o),n(e.yParity==null||Qe(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};uf=new WeakMap,cf=new WeakMap,ff=new WeakMap,eu=new WeakMap;let Ss=Ns;const tu=class tu{constructor(e){J(this,ao);$(Ec(e)===32,"invalid private key","privateKey","[REDACTED]"),L(this,ao,Ae(e))}get privateKey(){return T(this,ao)}get publicKey(){return tu.computePublicKey(T(this,ao))}get compressedPublicKey(){return tu.computePublicKey(T(this,ao),!0)}sign(e){$(Ec(e)===32,"invalid digest length","digest",e);const n=ia.sign(Gn(e),Gn(T(this,ao)),{lowS:!0});return Ss.from({r:Zo(n.r,32),s:Zo(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=tu.computePublicKey(e);return Ae(ia.getSharedSecret(Gn(T(this,ao)),ct(n),!1))}static computePublicKey(e,n){let r=ct(e,"key");if(r.length===32){const i=ia.getPublicKey(r,!!n);return Ae(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=ia.ProjectivePoint.fromHex(r);return Ae(s.toRawBytes(n))}static recoverPublicKey(e,n){$(Ec(e)===32,"invalid digest length","digest",e);const r=Ss.from(n);let s=ia.Signature.fromCompact(Gn($t([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Gn(e));return $(i!=null,"invalid signautre for digest","signature",n),"0x"+i.toHex(!1)}static addPoints(e,n,r){const s=ia.ProjectivePoint.fromHex(tu.computePublicKey(e).substring(2)),i=ia.ProjectivePoint.fromHex(tu.computePublicKey(n).substring(2));return"0x"+s.add(i).toHex(!!r)}};ao=new WeakMap;let Ph=tu;const rre=BigInt(0),sre=BigInt(36);function eR(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 r=ct(en(n));for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(r[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const Rx={};for(let t=0;t<10;t++)Rx[String(t)]=String(t);for(let t=0;t<26;t++)Rx[String.fromCharCode(65+t)]=String(10+t);const tR=15;function ire(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>Rx[r]).join("");for(;e.length>=tR;){let r=e.substring(0,tR);e=parseInt(r,10)%97+e.substring(r.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const ore=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function are(t){t=t.toLowerCase();let e=rre;for(let n=0;n<t.length;n++)e=e*sre+ore[t[n]];return e}function gt(t){if($(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=eR(t);return $(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){$(t.substring(2,4)===ire(t),"bad icap checksum","address",t);let e=are(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return eR("0x"+e)}$(!1,"invalid address","address",t)}function lre(t){const e=gt(t.from);let r=Ce(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,gt(Vt(en(El([e,r])),12))}function nR(t){return t&&typeof t.getAddress=="function"}function ure(t){try{return gt(t),!0}catch{}return!1}async function Px(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(te(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),$(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),gt(n)}function Qn(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?gt(t):(te(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Px(t,e.resolveName(t)));if(nR(t))return Px(t,t.getAddress());if(t&&typeof t.then=="function")return Px(t,t);$(!1,"unsupported addressable value","target",t)}const Gi={};function ve(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new Rn(Gi,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function dt(t,e){return new Rn(Gi,`bytes${e||""}`,t,{size:e})}const rR=Symbol.for("_ethers_typed"),lo=class lo{constructor(e,n,r,s){q(this,"type");q(this,"value");J(this,nu);q(this,"_typedSymbol");s==null&&(s=null),jg(Gi,e,"Typed"),Me(this,{_typedSymbol:rR,type:n,value:r}),L(this,nu,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return T(this,nu)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,nu)===!0?-1:T(this,nu)===!1?this.value.length:null}static from(e,n){return new lo(Gi,e,n)}static uint8(e){return ve(e,8)}static uint16(e){return ve(e,16)}static uint24(e){return ve(e,24)}static uint32(e){return ve(e,32)}static uint40(e){return ve(e,40)}static uint48(e){return ve(e,48)}static uint56(e){return ve(e,56)}static uint64(e){return ve(e,64)}static uint72(e){return ve(e,72)}static uint80(e){return ve(e,80)}static uint88(e){return ve(e,88)}static uint96(e){return ve(e,96)}static uint104(e){return ve(e,104)}static uint112(e){return ve(e,112)}static uint120(e){return ve(e,120)}static uint128(e){return ve(e,128)}static uint136(e){return ve(e,136)}static uint144(e){return ve(e,144)}static uint152(e){return ve(e,152)}static uint160(e){return ve(e,160)}static uint168(e){return ve(e,168)}static uint176(e){return ve(e,176)}static uint184(e){return ve(e,184)}static uint192(e){return ve(e,192)}static uint200(e){return ve(e,200)}static uint208(e){return ve(e,208)}static uint216(e){return ve(e,216)}static uint224(e){return ve(e,224)}static uint232(e){return ve(e,232)}static uint240(e){return ve(e,240)}static uint248(e){return ve(e,248)}static uint256(e){return ve(e,256)}static uint(e){return ve(e,256)}static int8(e){return ve(e,-8)}static int16(e){return ve(e,-16)}static int24(e){return ve(e,-24)}static int32(e){return ve(e,-32)}static int40(e){return ve(e,-40)}static int48(e){return ve(e,-48)}static int56(e){return ve(e,-56)}static int64(e){return ve(e,-64)}static int72(e){return ve(e,-72)}static int80(e){return ve(e,-80)}static int88(e){return ve(e,-88)}static int96(e){return ve(e,-96)}static int104(e){return ve(e,-104)}static int112(e){return ve(e,-112)}static int120(e){return ve(e,-120)}static int128(e){return ve(e,-128)}static int136(e){return ve(e,-136)}static int144(e){return ve(e,-144)}static int152(e){return ve(e,-152)}static int160(e){return ve(e,-160)}static int168(e){return ve(e,-168)}static int176(e){return ve(e,-176)}static int184(e){return ve(e,-184)}static int192(e){return ve(e,-192)}static int200(e){return ve(e,-200)}static int208(e){return ve(e,-208)}static int216(e){return ve(e,-216)}static int224(e){return ve(e,-224)}static int232(e){return ve(e,-232)}static int240(e){return ve(e,-240)}static int248(e){return ve(e,-248)}static int256(e){return ve(e,-256)}static int(e){return ve(e,-256)}static bytes1(e){return dt(e,1)}static bytes2(e){return dt(e,2)}static bytes3(e){return dt(e,3)}static bytes4(e){return dt(e,4)}static bytes5(e){return dt(e,5)}static bytes6(e){return dt(e,6)}static bytes7(e){return dt(e,7)}static bytes8(e){return dt(e,8)}static bytes9(e){return dt(e,9)}static bytes10(e){return dt(e,10)}static bytes11(e){return dt(e,11)}static bytes12(e){return dt(e,12)}static bytes13(e){return dt(e,13)}static bytes14(e){return dt(e,14)}static bytes15(e){return dt(e,15)}static bytes16(e){return dt(e,16)}static bytes17(e){return dt(e,17)}static bytes18(e){return dt(e,18)}static bytes19(e){return dt(e,19)}static bytes20(e){return dt(e,20)}static bytes21(e){return dt(e,21)}static bytes22(e){return dt(e,22)}static bytes23(e){return dt(e,23)}static bytes24(e){return dt(e,24)}static bytes25(e){return dt(e,25)}static bytes26(e){return dt(e,26)}static bytes27(e){return dt(e,27)}static bytes28(e){return dt(e,28)}static bytes29(e){return dt(e,29)}static bytes30(e){return dt(e,30)}static bytes31(e){return dt(e,31)}static bytes32(e){return dt(e,32)}static address(e){return new lo(Gi,"address",e)}static bool(e){return new lo(Gi,"bool",!!e)}static bytes(e){return new lo(Gi,"bytes",e)}static string(e){return new lo(Gi,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new lo(Gi,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===rR}static dereference(e,n){if(lo.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};nu=new WeakMap;let Rn=lo;class cre extends zi{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=Rn.dereference(n,"string");try{r=gt(r)}catch(s){return this._throwError(s.message,n)}return e.writeValue(r)}decode(e){return gt(Zo(e.readValue(),20))}}class fre extends zi{constructor(n){super(n.name,n.type,"_",n.dynamic);q(this,"coder");this.coder=n}defaultValue(){return this.coder.defaultValue()}encode(n,r){return this.coder.encode(n,r)}decode(n){return this.coder.decode(n)}}function sR(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let l={};r=e.map(u=>{const c=u.localName;return te(c,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),te(!l[c],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),l[c]=!0,n[c]})}else $(!1,"invalid tuple value","tuple",n);$(e.length===r.length,"types/value length mismatch","tuple",n);let s=new px,i=new px,o=[];e.forEach((l,u)=>{let c=r[u];if(l.dynamic){let f=i.length;l.encode(i,c);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,c)}),o.forEach(l=>{l(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function iR(t,e){let n=[],r=[],s=t.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=t.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(u){if(gn(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(t)}catch(a){if(gn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");n.push(o),r.push(i.localName||null)}),Tc.fromItems(n,r)}class dre extends zi{constructor(n,r,s){const i=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",i,s,o);q(this,"coder");q(this,"length");Me(this,{coder:n,length:r})}defaultValue(){const n=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(n);return r}encode(n,r){const s=Rn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,n.writeValue(s.length)),F_(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return sR(n,o,s)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),te(r*Kn<=n.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:n.bytes,offset:r*Kn,length:n.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new fre(this.coder));return iR(n,s)}}class hre extends zi{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=Rn.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class oR extends zi{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=Gn(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class pre extends oR{constructor(e){super("bytes",e)}decode(e){return Ae(super.decode(e))}}class mre extends zi{constructor(n,r){let s="bytes"+String(n);super(s,s,r,!1);q(this,"size");Me(this,{size:n},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(n,r){let s=Gn(Rn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),n.writeBytes(s)}decode(n){return Ae(n.readBytes(this.size))}}const gre=new Uint8Array([]);class yre extends zi{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(gre)}decode(e){return e.readBytes(0),null}}const bre=BigInt(0),wre=BigInt(1),Are=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class vre extends zi{constructor(n,r,s){const i=(r?"int":"uint")+n*8;super(i,i,s,!1);q(this,"size");q(this,"signed");Me(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let s=Ce(Rn.dereference(r,this.type)),i=Dh(Are,Kn*8);if(this.signed){let o=Dh(i,this.size*8-1);(s>o||s<-(o+wre))&&this._throwError("value out-of-bounds",r),s=V_(s,8*Kn)}else(s<bre||s>Dh(i,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(s)}decode(n){let r=Dh(n.readValue(),this.size*8);return this.signed&&(r=Cte(r,this.size*8)),r}}class xre extends oR{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,Vi(Rn.dereference(n,"string")))}decode(e){return Sc(super.decode(e))}}class Xg extends zi{constructor(n,r){let s=!1;const i=[];n.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);q(this,"coders");Me(this,{coders:Object.freeze(n.slice())})}defaultValue(){const n=[];this.coders.forEach(s=>{n.push(s.defaultValue())});const r=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),n[o]==null&&(n[o]=n[i]))}),Object.freeze(n)}encode(n,r){const s=Rn.dereference(r,"tuple");return sR(n,this.coders,s)}decode(n){return iR(n,this.coders)}}function Ol(t){return en(Vi(t))}var kre="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZ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mnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const aR=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),lR=4;function Ere(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=n());let o=n(),a=e;e+=o;let l=0,u=0;function c(){return l==0&&(u=u<<8|t[e++],l=8),u>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let g=0;for(let x=0;x<f;x++)g=g<<1|c();let b=[],v=0,A=d;for(;;){let x=Math.floor(((g-v+1)*s-1)/A),k=0,C=r;for(;C-k>1;){let N=k+C>>>1;x<i[N]?C=N:k=N}if(k==0)break;b.push(k);let D=v+Math.floor(A*i[k]/s),O=v+Math.floor(A*i[k+1]/s)-1;for(;!((D^O)&h);)g=g<<1&m|c(),D=D<<1&m,O=O<<1&m|1;for(;D&~O&p;)g=g&h|g<<1&m>>>1|c(),D=D<<1^h,O=(O^h)<<1|h|1;v=D,A=1+O-D}let w=r-4;return b.map(x=>{switch(x-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return x-1}})}function Cre(t){let e=0;return()=>t[e++]}function uR(t){return Cre(Ere(Sre(t)))}function Sre(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,i=0,o=0,a=0;s<n;s++)a=a<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function Tre(t){return t&1?~t>>1:t>>1}function Dre(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=Tre(e());return n}function Ih(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let i=0;i<s;i++)n.push(e+i);e+=s+1}return n}function cR(t){return Lh(()=>{let e=Ih(t);if(e.length)return e})}function fR(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(Ore(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(Mre(n,t))}return e.flat()}function Lh(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function dR(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)Dre(t,n).forEach((i,o)=>r[o].push(i));return r}function Ore(t,e){let n=1+e(),r=e(),s=Lh(e);return dR(s.length,1+t,e).flatMap((o,a)=>{let[l,...u]=o;return Array(s[a]).fill().map((c,f)=>{let d=f*r;return[l+f*n,u.map(h=>h+d)]})})}function Mre(t,e){let n=1+e();return dR(n,1+t,e).map(s=>[s[0],s.slice(1)])}function Nre(t){let e=[],n=Ih(t);return s(r([]),[]),e;function r(i){let o=t(),a=Lh(()=>{let l=Ih(t).map(u=>n[u]);if(l.length)return r(l)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,l){if(!(i&4&&l===a[a.length-1])){i&2&&(l=a[a.length-1]),i&1&&e.push(a);for(let u of o)for(let c of u.Q)s(u,[...a,c],l)}}}function _re(t){return t.toString(16).toUpperCase().padStart(2,"0")}function hR(t){return`{${_re(t)}}`}function Rre(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function Pc(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function Pre(t,e){let n=t.length,r=n-e.length;for(let s=0;r==0&&s<n;s++)r=t[s]-e[s];return r}var Ire="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9Dz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CCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g";const Bh=44032,Zg=4352,ey=4449,ty=4519,pR=19,mR=21,Ic=28,ny=mR*Ic,Lre=pR*ny,Bre=Bh+Lre,Fre=Zg+pR,jre=ey+mR,Ure=ty+Ic;function Fh(t){return t>>24&255}function gR(t){return t&16777215}let Ix,yR,Lx,ry;function Hre(){let t=uR(Ire);Ix=new Map(cR(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),yR=new Set(Ih(t)),Lx=new Map,ry=new Map;for(let[e,n]of fR(t)){if(!yR.has(e)&&n.length==2){let[r,s]=n,i=ry.get(r);i||(i=new Map,ry.set(r,i)),i.set(s,e)}Lx.set(e,n.reverse())}}function bR(t){return t>=Bh&&t<Bre}function Vre(t,e){if(t>=Zg&&t<Fre&&e>=ey&&e<jre)return Bh+(t-Zg)*ny+(e-ey)*Ic;if(bR(t)&&e>ty&&e<Ure&&(t-Bh)%Ic==0)return t+(e-ty);{let n=ry.get(t);return n&&(n=n.get(e),n)?n:-1}}function wR(t){Ix||Hre();let e=[],n=[],r=!1;function s(i){let o=Ix.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of t)for(;;){if(i<128)e.push(i);else if(bR(i)){let o=i-Bh,a=o/ny|0,l=o%ny/Ic|0,u=o%Ic;s(Zg+a),s(ey+l),u>0&&s(ty+u)}else{let o=Lx.get(i);o?n.push(...o):s(i)}if(!n.length)break;i=n.pop()}if(r&&e.length>1){let i=Fh(e[0]);for(let o=1;o<e.length;o++){let a=Fh(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let u=e[l+1];if(e[l+1]=e[l],e[l]=u,!l||(i=Fh(e[--l]),i<=a))break}i=Fh(e[o])}}return e}function zre(t){let e=[],n=[],r=-1,s=0;for(let i of t){let o=Fh(i),a=gR(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...n),n.length=0,r=a):n.push(a),s=o;else{let l=Vre(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(n.push(a),s=o)}}return r>=0&&e.push(r,...n),e}function AR(t){return wR(t).map(gR)}function $re(t){return zre(wR(t))}const vR=45,xR=".",kR=65039,ER=1,sy=t=>Array.from(t);function jh(t,e){return t.P.has(e)||t.Q.has(e)}class Gre extends Array{get is_emoji(){return!0}}let Bx,CR,Ml,Fx,SR,Lc,jx,Bc,Nl,TR,Ux;function Hx(){if(Bx)return;let t=uR(kre);const e=()=>Ih(t),n=()=>new Set(e()),r=(c,f)=>f.forEach(d=>c.add(d));Bx=new Map(fR(t)),CR=n(),Ml=e(),Fx=new Set(e().map(c=>Ml[c])),Ml=new Set(Ml),SR=n(),n();let s=cR(t),i=t();const o=()=>{let c=new Set;return e().forEach(f=>r(c,s[f])),r(c,e()),c};Lc=Lh(c=>{let f=Lh(t).map(d=>d+96);if(f.length){let d=c>=i;f[0]-=32,f=Pc(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!t();return{N:f,P:h,Q:p,M:m,R:d}}}),jx=n(),Bc=new Map;let a=e().concat(sy(jx)).sort((c,f)=>c-f);a.forEach((c,f)=>{let d=t(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(c),jx.has(c)||Bc.set(c,h)});for(let{V:c,M:f}of new Set(Bc.values())){let d=[];for(let p of c){let m=Lc.filter(b=>jh(b,p)),g=d.find(({G:b})=>m.some(v=>b.has(v)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),r(g.G,m)}let h=d.flatMap(p=>sy(p.G));for(let{G:p,V:m}of d){let g=new Set(h.filter(b=>!p.has(b)));for(let b of m)f.set(b,g)}}Nl=new Set;let l=new Set;const u=c=>Nl.has(c)?l.add(c):Nl.add(c);for(let c of Lc){for(let f of c.P)u(f);for(let f of c.Q)u(f)}for(let c of Nl)!Bc.has(c)&&!l.has(c)&&Bc.set(c,ER);r(Nl,AR(Nl)),TR=Nre(t).map(c=>Gre.from(c)).sort(Pre),Ux=new Map;for(let c of TR){let f=[Ux];for(let d of c){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===kR?f.push(...h):f=h}for(let d of f)d.V=c}}function Vx(t){return(DR(t)?"":`${zx(iy([t]))} `)+hR(t)}function zx(t){return`"${t}"`}function Wre(t){if(t.length>=4&&t[2]==vR&&t[3]==vR)throw new Error(`invalid label extension: "${Pc(t.slice(0,4))}"`)}function qre(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function Kre(t){let e=t[0],n=aR.get(e);if(n)throw Uh(`leading ${n}`);let r=t.length,s=-1;for(let i=1;i<r;i++){e=t[i];let o=aR.get(e);if(o){if(s==i)throw Uh(`${n} + ${o}`);s=i+1,n=o}}if(s==r)throw Uh(`trailing ${n}`)}function iy(t,e=1/0,n=hR){let r=[];Qre(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,i=t.length;for(let o=0;o<i;o++){let a=t[o];DR(a)&&(r.push(Pc(t.slice(s,o))),r.push(n(a)),s=o+1)}return r.push(Pc(t.slice(s,i))),r.join("")}function Qre(t){return Hx(),Ml.has(t)}function DR(t){return Hx(),SR.has(t)}function Jre(t){return ese(Yre(t,$re,rse))}function Yre(t,e,n){if(!t)return[];Hx();let r=0;return t.split(xR).map(s=>{let i=Rre(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=nse(i,e,n),l=a.length,u;if(!l)throw new Error("empty label");let c=o.output=a.flat();if(qre(c),!(o.emoji=l>1||a[0].is_emoji)&&c.every(d=>d<128))Wre(c),u="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)u="Emoji";else{if(Ml.has(c[0]))throw Uh("leading combining mark");for(let m=1;m<l;m++){let g=a[m];if(!g.is_emoji&&Ml.has(g[0]))throw Uh(`emoji + combining mark: "${Pc(a[m-1])} + ${iy([g[0]])}"`)}Kre(c);let h=sy(new Set(d)),[p]=Zre(h);tse(p,d),Xre(p,h),u=p.N}}o.type=u}catch(a){o.error=a}return o})}function Xre(t,e){let n,r=[];for(let s of e){let i=Bc.get(s);if(i===ER)return;if(i){let o=i.M.get(s);if(n=n?n.filter(a=>o.has(a)):sy(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(i=>jh(s,i)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function Zre(t){let e=Lc;for(let n of t){let r=e.filter(s=>jh(s,n));if(!r.length)throw Lc.some(s=>jh(s,n))?MR(e[0],n):OR(n);if(e=r,r.length==1)break}return e}function ese(t){return t.map(({input:e,error:n,output:r})=>{if(n){let s=n.message;throw new Error(t.length==1?s:`Invalid label ${zx(iy(e,63))}: ${s}`)}return Pc(r)}).join(xR)}function OR(t){return new Error(`disallowed character: ${Vx(t)}`)}function MR(t,e){let n=Vx(e),r=Lc.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function Uh(t){return new Error(`illegal placement: ${t}`)}function tse(t,e){for(let n of e)if(!jh(t,n))throw MR(t,n);if(t.M){let n=AR(e);for(let r=1,s=n.length;r<s;r++)if(Fx.has(n[r])){let i=r+1;for(let o;i<s&&Fx.has(o=n[i]);i++)for(let a=r;a<i;a++)if(n[a]==o)throw new Error(`duplicate non-spacing marks: ${Vx(o)}`);if(i-r>lR)throw new Error(`excessive non-spacing marks: ${zx(iy(n.slice(r-1,i)))} (${i-r}/${lR})`);r=i}}}function nse(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let i=sse(t);if(i)s.length&&(r.push(e(s)),s=[]),r.push(n(i));else{let o=t.pop();if(Nl.has(o))s.push(o);else{let a=Bx.get(o);if(a)s.push(...a);else if(!CR.has(o))throw OR(o)}}}return s.length&&r.push(e(s)),r}function rse(t){return t.filter(e=>e!=kR)}function sse(t,e){let n=Ux,r,s=t.length;for(;s&&(n=n.get(t[--s]),!!n);){let{V:i}=n;i&&(r=i,t.length=s)}return r}const NR=new Uint8Array(32);NR.fill(0);function _R(t){return $(t.length!==0,"invalid ENS name; empty component","comp",t),t}function RR(t){const e=Vi(ise(t)),n=[];if(t.length===0)return n;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(n.push(_R(e.slice(r,s))),r=s+1);return $(r<e.length,"invalid ENS name; empty component","name",t),n.push(_R(e.slice(r))),n}function ise(t){try{if(t.length===0)throw new Error("empty label");return Jre(t)}catch(e){$(!1,`invalid ENS name (${e.message})`,"name",t)}}function $x(t){$(typeof t=="string","invalid ENS name; not a string","name",t),$(t.length,"invalid ENS name (empty label)","name",t);let e=NR;const n=RR(t);for(;n.length;)e=en($t([e,en(n.pop())]));return Ae(e)}function ose(t,e){const n=e;return $(n<=255,"DNS encoded label cannot exceed 255","length",n),Ae($t(RR(t).map(r=>{$(r.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function Gx(t,e){return{address:gt(t),storageKeys:e.map((n,r)=>($(St(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function oa(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?($(n.length===2,"invalid slot set",`value[${r}]`,n),Gx(n[0],n[1])):($(n!=null&&typeof n=="object","invalid address-slot set","value",t),Gx(n.address,n.storageKeys)));$(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(n=>{const r=t[n].reduce((s,i)=>(s[i]=!0,s),{});return Gx(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function ase(t){let e;return typeof t=="string"?e=Ph.computePublicKey(t,!1):e=t.publicKey,gt(en("0x"+e.substring(4)).substring(26))}function lse(t,e){return ase(Ph.recoverPublicKey(t,e))}const bn=BigInt(0),use=BigInt(2),cse=BigInt(27),fse=BigInt(28),dse=BigInt(35),hse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Wx=4096*32;function PR(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=Oc(e).substring(4),"0x"+n}function oy(t){return t==="0x"?null:gt(t)}function qx(t,e){try{return oa(t)}catch(n){$(!1,n.message,e,t)}}function Hh(t,e){return t==="0x"?0:Qe(t,e)}function Wt(t,e){if(t==="0x")return bn;const n=Ce(t,e);return $(n<=hse,"value exceeds uint size",e,n),n}function Ot(t,e){const n=Ce(t,"value"),r=Wn(n);return $(r.length<=32,"value too large",`tx.${e}`,n),r}function Kx(t){return oa(t).map(e=>[e.address,e.storageKeys])}function pse(t,e){$(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)$(St(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function mse(t){const e=$g(t);$(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:Hh(e[0],"nonce"),gasPrice:Wt(e[1],"gasPrice"),gasLimit:Wt(e[2],"gasLimit"),to:oy(e[3]),value:Wt(e[4],"value"),data:Ae(e[5]),chainId:bn};if(e.length===6)return n;const r=Wt(e[6],"v"),s=Wt(e[7],"r"),i=Wt(e[8],"s");if(s===bn&&i===bn)n.chainId=r;else{let o=(r-dse)/use;o<bn&&(o=bn),n.chainId=o,$(o!==bn||r===cse||r===fse,"non-canonical legacy v","v",e[6]),n.signature=Ss.from({r:xl(e[7],32),s:xl(e[8],32),v:r})}return n}function gse(t,e){const n=[Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data];let r=bn;if(t.chainId!=bn)r=Ce(t.chainId,"tx.chainId"),$(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const i=t.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==bn&&(n.push(Wn(r)),n.push("0x"),n.push("0x")),El(n);let s=BigInt(27+e.yParity);return r!==bn?s=Ss.getChainIdV(r,e.v):BigInt(e.v)!==s&&$(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(Wn(s)),n.push(Wn(e.r)),n.push(Wn(e.s)),El(n)}function Qx(t,e){let n;try{if(n=Hh(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{$(!1,"invalid yParity","yParity",e[0])}const r=xl(e[1],32),s=xl(e[2],32),i=Ss.from({r,s,yParity:n});t.signature=i}function yse(t){const e=$g(ct(t).slice(1));$(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Ae(t));const n={type:2,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:oy(e[5]),value:Wt(e[6],"value"),data:Ae(e[7]),accessList:qx(e[8],"accessList")};return e.length===9||Qx(n,e.slice(9)),n}function bse(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,Kx(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"yParity")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x02",El(n)])}function wse(t){const e=$g(ct(t).slice(1));$(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Ae(t));const n={type:1,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),gasPrice:Wt(e[2],"gasPrice"),gasLimit:Wt(e[3],"gasLimit"),to:oy(e[4]),value:Wt(e[5],"value"),data:Ae(e[6]),accessList:qx(e[7],"accessList")};return e.length===8||Qx(n,e.slice(8)),n}function Ase(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,Kx(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"recoveryParam")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x01",El(n)])}function vse(t){let e=$g(ct(t).slice(1)),n="3",r=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const i=e[1],o=e[2],a=e[3];$(Array.isArray(i),"invalid network format: blobs not an array","fields[1]",i),$(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),$(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),$(i.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),$(i.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let l=0;l<e[1].length;l++)r.push({data:i[l],commitment:o[l],proof:a[l]});e=e[0]}$(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",Ae(t));const s={type:3,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:oy(e[5]),value:Wt(e[6],"value"),data:Ae(e[7]),accessList:qx(e[8],"accessList"),maxFeePerBlobGas:Wt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),$(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),$(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let i=0;i<s.blobVersionedHashes.length;i++)$(St(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",t);return e.length===11||Qx(s,e.slice(11)),s}function xse(t,e,n){const r=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||Rh,Ot(t.value,"value"),t.data,Kx(t.accessList||[]),Ot(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),pse(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Ot(e.yParity,"yParity")),r.push(Wn(e.r)),r.push(Wn(e.s)),n)?$t(["0x03",El([r,n.map(s=>s.data),n.map(s=>s.commitment),n.map(s=>s.proof)])]):$t(["0x03",El(r)])}const co=class co{constructor(){J(this,kf);J(this,mi);J(this,df);J(this,hf);J(this,pf);J(this,mf);J(this,gf);J(this,yf);J(this,bf);J(this,wf);J(this,Af);J(this,vf);J(this,xf);J(this,ru);J(this,ya);J(this,uo);J(this,ba);L(this,mi,null),L(this,df,null),L(this,pf,0),L(this,mf,bn),L(this,gf,null),L(this,yf,null),L(this,bf,null),L(this,hf,"0x"),L(this,wf,bn),L(this,Af,bn),L(this,vf,null),L(this,xf,null),L(this,ru,null),L(this,ya,null),L(this,ba,null),L(this,uo,null)}get type(){return T(this,mi)}set type(e){switch(e){case null:L(this,mi,null);break;case 0:case"legacy":L(this,mi,0);break;case 1:case"berlin":case"eip-2930":L(this,mi,1);break;case 2:case"london":case"eip-1559":L(this,mi,2);break;case 3:case"cancun":case"eip-4844":L(this,mi,3);break;default:$(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=T(this,df);return e==null&&this.type===3?Rh:e}set to(e){L(this,df,e==null?null:gt(e))}get nonce(){return T(this,pf)}set nonce(e){L(this,pf,Qe(e,"value"))}get gasLimit(){return T(this,mf)}set gasLimit(e){L(this,mf,Ce(e))}get gasPrice(){const e=T(this,gf);return e==null&&(this.type===0||this.type===1)?bn:e}set gasPrice(e){L(this,gf,e==null?null:Ce(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,yf);return e??(this.type===2||this.type===3?bn:null)}set maxPriorityFeePerGas(e){L(this,yf,e==null?null:Ce(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,bf);return e??(this.type===2||this.type===3?bn:null)}set maxFeePerGas(e){L(this,bf,e==null?null:Ce(e,"maxFeePerGas"))}get data(){return T(this,hf)}set data(e){L(this,hf,Ae(e))}get value(){return T(this,wf)}set value(e){L(this,wf,Ce(e,"value"))}get chainId(){return T(this,Af)}set chainId(e){L(this,Af,Ce(e))}get signature(){return T(this,vf)||null}set signature(e){L(this,vf,e==null?null:Ss.from(e))}get accessList(){const e=T(this,xf)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){L(this,xf,e==null?null:oa(e))}get maxFeePerBlobGas(){const e=T(this,ru);return e==null&&this.type===3?bn:e}set maxFeePerBlobGas(e){L(this,ru,e==null?null:Ce(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ya);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){$(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)$(St(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}L(this,ya,e)}get blobs(){return T(this,ba)==null?null:T(this,ba).map(e=>Object.assign({},e))}set blobs(e){if(e==null){L(this,ba,null);return}const n=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(ux(i)){te(T(this,uo),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if($(o.length<=Wx,"blob is too large",`blobs[${s}]`,i),o.length!==Wx){const u=new Uint8Array(Wx);u.set(o),o=u}const a=T(this,uo).blobToKzgCommitment(o),l=Ae(T(this,uo).computeBlobKzgProof(o,a));n.push({data:Ae(o),commitment:Ae(a),proof:l}),r.push(PR(1,a))}else{const o=Ae(i.commitment);n.push({data:Ae(i.data),commitment:o,proof:Ae(i.proof)}),r.push(PR(1,o))}}L(this,ba,n),L(this,ya,r)}get kzg(){return T(this,uo)}set kzg(e){L(this,uo,e)}get hash(){return this.signature==null?null:en(de(this,kf,ab).call(this,!0,!1))}get unsignedHash(){return en(this.unsignedSerialized)}get from(){return this.signature==null?null:lse(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Ph.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return de(this,kf,ab).call(this,!0,!0)}get unsignedSerialized(){return de(this,kf,ab).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,n=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,ru)!=null||T(this,ya);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&te(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),te(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),te(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):n?i.push(2):e?(i.push(1),r||i.push(0)):r?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return co.from(this)}toJSON(){const e=n=>n==null?null:n.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new co;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return co.from(mse(r));switch(r[0]){case 1:return co.from(wse(r));case 2:return co.from(yse(r));case 3:return co.from(vse(r))}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new co;return e.type!=null&&(n.type=e.type),e.to!=null&&(n.to=e.to),e.nonce!=null&&(n.nonce=e.nonce),e.gasLimit!=null&&(n.gasLimit=e.gasLimit),e.gasPrice!=null&&(n.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(n.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(n.data=e.data),e.value!=null&&(n.value=e.value),e.chainId!=null&&(n.chainId=e.chainId),e.signature!=null&&(n.signature=Ss.from(e.signature)),e.accessList!=null&&(n.accessList=e.accessList),e.blobVersionedHashes!=null&&(n.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(n.kzg=e.kzg),e.blobs!=null&&(n.blobs=e.blobs),e.hash!=null&&($(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),$(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&($(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),$(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}};mi=new WeakMap,df=new WeakMap,hf=new WeakMap,pf=new WeakMap,mf=new WeakMap,gf=new WeakMap,yf=new WeakMap,bf=new WeakMap,wf=new WeakMap,Af=new WeakMap,vf=new WeakMap,xf=new WeakMap,ru=new WeakMap,ya=new WeakMap,uo=new WeakMap,ba=new WeakMap,kf=new WeakSet,ab=function(e,n){te(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return gse(this,r);case 1:return Ase(this,r);case 2:return bse(this,r);case 3:return xse(this,r,n?this.blobs:null)}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let Vh=co;const IR=new Uint8Array(32);IR.fill(0);const kse=BigInt(-1),LR=BigInt(0),BR=BigInt(1),Ese=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Cse(t){const e=ct(t),n=e.length%32;return n?$t([e,IR.slice(n)]):Ae(e)}const Sse=Zo(BR,32),Tse=Zo(LR,32),FR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Jx=["name","version","chainId","verifyingContract","salt"];function jR(t){return function(e){return $(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Dse={name:jR("name"),version:jR("version"),chainId:function(t){const e=Ce(t,"domain.chainId");return $(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):kl(e)},verifyingContract:function(t){try{return gt(t).toLowerCase()}catch{}$(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=ct(t,"domain.salt");return $(e.length===32,'invalid domain value "salt"',"domain.salt",t),Ae(e)}};function Yx(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);$(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=Dh(Ese,n?r-1:r),i=n?(s+BR)*kse:LR;return function(o){const a=Ce(o,"value");return $(a>=i&&a<=s,`value out-of-bounds for ${t}`,"value",a),Zo(n?V_(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return $(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const s=ct(r);return $(s.length===n,`invalid length for ${t}`,"value",r),Cse(r)}}}switch(t){case"address":return function(e){return xl(gt(e),32)};case"bool":return function(e){return e?Sse:Tse};case"bytes":return function(e){return en(e)};case"string":return function(e){return Ol(e)}}return null}function UR(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function ay(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}const ns=class ns{constructor(e){J(this,eb);q(this,"primaryType");J(this,mp);J(this,fo);J(this,Ef);L(this,fo,new Map),L(this,Ef,new Map);const n=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:u,type:c})=>{let{base:f,index:d}=ay(c);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),n.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),L(this,mp,JSON.stringify(i));for(const l in i){const u=new Set;for(const c of i[l]){$(!u.has(c.name),`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(l)}`,"types",e),u.add(c.name);const f=ay(c.type).base;$(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!Yx(f)&&($(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),n.get(l).add(f))}}const o=Array.from(r.keys()).filter(l=>r.get(l).length===0);$(o.length!==0,"missing primary type","types",e),$(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),Me(this,{primaryType:o[0]});function a(l,u){$(!u.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),u.add(l);for(const c of n.get(l))if(r.has(c)){a(c,u);for(const f of u)s.get(f).add(c)}u.delete(l)}a(this.primaryType,new Set);for(const[l,u]of s){const c=Array.from(u);c.sort(),T(this,fo).set(l,UR(l,i[l])+c.map(f=>UR(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,mp))}getEncoder(e){let n=T(this,Ef).get(e);return n||(n=de(this,eb,ML).call(this,e),T(this,Ef).set(e,n)),n}encodeType(e){const n=T(this,fo).get(e);return $(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return en(this.encodeData(e,n))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,n,r){if(Yx(e))return r(e,n);const s=ay(e).array;if(s)return $(s.count===-1||s.count===n.length,`array length mismatch; expected length ${s.count}`,"value",n),n.map(o=>this._visit(s.prefix,o,r));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,n[a],r),o),{});$(!1,`unknown type: ${e}`,"type",e)}visit(e,n){return this._visit(this.primaryType,e,n)}static from(e){return new ns(e)}static getPrimaryType(e){return ns.from(e).primaryType}static hashStruct(e,n,r){return ns.from(n).hashStruct(e,r)}static hashDomain(e){const n=[];for(const r in e){if(e[r]==null)continue;const s=FR[r];$(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:s})}return n.sort((r,s)=>Jx.indexOf(r.name)-Jx.indexOf(s.name)),ns.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return $t(["0x1901",ns.hashDomain(e),ns.from(n).hash(r)])}static hash(e,n,r){return en(ns.encode(e,n,r))}static async resolveNames(e,n,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!St(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=ns.from(n);o.visit(r,(a,l)=>(a==="address"&&!St(l,20)&&(i[l]="0x"),l));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&i[l]?i[l]:l),{domain:e,value:r}}static getPayload(e,n,r){ns.hashDomain(e);const s={},i=[];Jx.forEach(l=>{const u=e[l];u!=null&&(s[l]=Dse[l](u),i.push({name:l,type:FR[l]}))});const o=ns.from(n);n=o.types;const a=Object.assign({},n);return $(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,u)=>{if(l.match(/^bytes(\d*)/))return Ae(ct(u));if(l.match(/^u?int/))return Ce(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return $(typeof u=="string","invalid string","value",u),u}$(!1,"unsupported type","type",l)})}}};mp=new WeakMap,fo=new WeakMap,Ef=new WeakMap,eb=new WeakSet,ML=function(e){{const s=Yx(e);if(s)return s}const n=ay(e).array;if(n){const s=n.prefix,i=this.getEncoder(s);return o=>{$(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let a=o.map(i);return T(this,fo).has(s)&&(a=a.map(en)),en($t(a))}}const r=this.types[e];if(r){const s=Ol(T(this,fo).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const u=this.getEncoder(l)(i[a]);return T(this,fo).has(l)?en(u):u});return o.unshift(s),$t(o)}}$(!1,`unknown type: ${e}`,"type",e)};let ly=ns;function Jn(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const Ose=Jn("external public payable override".split(" ")),HR="constant external internal payable private public pure view override",Mse=Jn(HR.split(" ")),VR="constructor error event fallback function receive struct",zR=Jn(VR.split(" ")),$R="calldata memory storage payable indexed",Nse=Jn($R.split(" ")),_se=[VR,$R,"tuple returns",HR].join(" "),Rse=Jn(_se.split(" ")),Pse={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Ise=new RegExp("^(\\s*)"),Lse=new RegExp("^([0-9]+)"),Bse=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),GR=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),WR=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),tb=class tb{constructor(e){J(this,gp);J(this,Dn);J(this,_s);L(this,Dn,0),L(this,_s,e.slice())}get offset(){return T(this,Dn)}get length(){return T(this,_s).length-T(this,Dn)}clone(){return new tb(T(this,_s))}reset(){L(this,Dn,0)}popKeyword(e){const n=this.peek();if(n.type!=="KEYWORD"||!e.has(n.text))throw new Error(`expected keyword ${n.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const n=this.peek();throw new Error(`expected ${e}; got ${n.type} ${JSON.stringify(n.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=de(this,gp,Hk).call(this,T(this,Dn)+1,e.match+1);return L(this,Dn,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;T(this,Dn)<e.match-1;){const r=this.peek().linkNext;n.push(de(this,gp,Hk).call(this,T(this,Dn)+1,r)),L(this,Dn,r)}return L(this,Dn,e.match+1),n}peek(){if(T(this,Dn)>=T(this,_s).length)throw new Error("out-of-bounds");return T(this,_s)[T(this,Dn)]}peekKeyword(e){const n=this.peekType("KEYWORD");return n!=null&&e.has(n)?n:null}peekType(e){if(this.length===0)return null;const n=this.peek();return n.type===e?n.text:null}pop(){const e=this.peek();return Tp(this,Dn)._++,e}toString(){const e=[];for(let n=T(this,Dn);n<T(this,_s).length;n++){const r=T(this,_s)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Dn=new WeakMap,_s=new WeakMap,gp=new WeakSet,Hk=function(e=0,n=0){return new tb(T(this,_s).slice(e,n).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let Ts=tb;function aa(t){const e=[],n=o=>{const a=i<t.length?JSON.stringify(t[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<t.length;){let o=t.substring(i),a=o.match(Ise);a&&(i+=a[1].length,o=t.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let u=Pse[o[0]]||"";if(u){if(l.type=u,l.text=o[0],i++,u==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(u=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),l.match=r.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1;else if(u==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(u==="OPEN_BRACKET")l.type="BRACKET";else if(u==="CLOSE_BRACKET"){let c=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;c=f+c,e[e.length-1].value=Qe(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=c}continue}if(a=o.match(Bse),a){if(l.text=a[1],i+=l.text.length,Rse.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(WR)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(Lse),a){l.text=a[1],l.type="NUMBER",i+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new Ts(e.map(o=>Object.freeze(o)))}function qR(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function uy(t,e){if(e.peekKeyword(zR)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function Wi(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function KR(t){let e=Wi(t,Mse);return qR(e,Jn("constant payable nonpayable".split(" "))),qR(e,Jn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function qi(t,e){return t.popParams().map(n=>En.from(n,e))}function QR(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Ce(t.pop().text);throw new Error("invalid gas")}return null}function _l(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const Fse=new RegExp(/^(.*)\[([0-9]*)\]$/);function JR(t){const e=t.match(WR);if($(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);$(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);$(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const Lt={},dr=Symbol.for("_ethers_internal"),YR="_ParamTypeInternal",XR="_ErrorInternal",ZR="_EventInternal",eP="_ConstructorInternal",tP="_FallbackInternal",nP="_FunctionInternal",rP="_StructInternal",rs=class rs{constructor(e,n,r,s,i,o,a,l){J(this,Cf);q(this,"name");q(this,"type");q(this,"baseType");q(this,"indexed");q(this,"components");q(this,"arrayLength");q(this,"arrayChildren");if(jg(e,Lt,"ParamType"),Object.defineProperty(this,dr,{value:YR}),o&&(o=Object.freeze(o.slice())),s==="array"){if(a==null||l==null)throw new Error("")}else if(a!=null||l!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");Me(this,{name:n,type:r,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=r,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,n))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,i)=>r.components[i].walk(s,n))}return n(this.type,e)}async walkAsync(e,n){const r=[],s=[e];return de(this,Cf,lb).call(this,r,e,n,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,n){if(rs.isParamType(e))return e;if(typeof e=="string")try{return rs.from(aa(e),n)}catch{$(!1,"invalid param type","obj",e)}else if(e instanceof Ts){let a="",l="",u=null;Wi(e,Jn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",u=e.popParams().map(m=>rs.from(m)),a=`tuple(${u.map(m=>m.format()).join(",")})`):(a=JR(e.popType("TYPE")),l=a);let c=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();c=new rs(Lt,"",a,l,null,u,f,c),f=m.value,a+=m.text,l="array",u=null}let d=null;if(Wi(e,Nse).has("indexed")){if(!n)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new rs(Lt,p,a,l,d,u,f,c)}const r=e.name;$(!r||typeof r=="string"&&r.match(GR),"invalid name","obj.name",r);let s=e.indexed;s!=null&&($(n,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(Fse);if(o){const a=parseInt(o[2]||"-1"),l=rs.from({type:o[1],components:e.components});return new rs(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(u=>rs.from(u)):null;return new rs(Lt,r||"",i,"tuple",s,a,null,null)}return i=JR(e.type),new rs(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[dr]===YR}};Cf=new WeakSet,lb=function(e,n,r,s){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=n.slice();a.forEach((l,u)=>{var c;de(c=o,Cf,lb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(n))a=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in n))throw new Error(`missing value for component ${l.name}`);return n[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,u)=>{var c;de(c=o[u],Cf,lb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}const i=r(this.type,n);i.then?e.push(async function(){s(await i)}()):s(i)};let En=rs;class Rl{constructor(e,n,r){q(this,"type");q(this,"inputs");jg(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Me(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{Rl.from(JSON.parse(e))}catch{}return Rl.from(aa(e))}if(e instanceof Ts)switch(e.peekKeyword(zR)){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return fi.from(e);case"fallback":case"receive":return Qi.from(e);case"function":return di.from(e);case"struct":return Pl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return fi.from(e);case"fallback":case"receive":return Qi.from(e);case"function":return di.from(e);case"struct":return Pl.from(e)}te(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}$(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Ki.isFragment(e)}static isError(e){return hr.isFragment(e)}static isEvent(e){return fi.isFragment(e)}static isFunction(e){return di.isFragment(e)}static isStruct(e){return Pl.isFragment(e)}}class cy extends Rl{constructor(n,r,s,i){super(n,r,i);q(this,"name");$(typeof s=="string"&&s.match(GR),"invalid identifier","name",s),i=Object.freeze(i.slice()),Me(this,{name:s})}}function zh(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class hr extends cy{constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,dr,{value:XR})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+zh(e,this.inputs)),n.join(" ")}static from(e){if(hr.isFragment(e))return e;if(typeof e=="string")return hr.from(aa(e));if(e instanceof Ts){const n=uy("error",e),r=qi(e);return _l(e),new hr(Lt,n,r)}return new hr(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===XR}}class fi extends cy{constructor(n,r,s,i){super(n,"event",r,s);q(this,"anonymous");Object.defineProperty(this,dr,{value:ZR}),Me(this,{anonymous:i})}get topicHash(){return Ol(this.format("sighash"))}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("event"),r.push(this.name+zh(n,this.inputs)),n!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(n,r){return r=(r||[]).map(i=>En.from(i)),new fi(Lt,n,r,!1).topicHash}static from(n){if(fi.isFragment(n))return n;if(typeof n=="string")try{return fi.from(aa(n))}catch{$(!1,"invalid event fragment","obj",n)}else if(n instanceof Ts){const r=uy("event",n),s=qi(n,!0),i=!!Wi(n,Jn(["anonymous"])).has("anonymous");return _l(n),new fi(Lt,r,s,i)}return new fi(Lt,n.name,n.inputs?n.inputs.map(r=>En.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[dr]===ZR}}class Ki extends Rl{constructor(n,r,s,i,o){super(n,r,s);q(this,"payable");q(this,"gas");Object.defineProperty(this,dr,{value:eP}),Me(this,{payable:i,gas:o})}format(n){if(te(n!=null&&n!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),n==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[`constructor${zh(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(Ki.isFragment(n))return n;if(typeof n=="string")try{return Ki.from(aa(n))}catch{$(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof Ts){Wi(n,Jn(["constructor"]));const r=qi(n),s=!!Wi(n,Ose).has("payable"),i=QR(n);return _l(n),new Ki(Lt,"constructor",r,s,i)}return new Ki(Lt,"constructor",n.inputs?n.inputs.map(En.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===eP}}class Qi extends Rl{constructor(n,r,s){super(n,"fallback",r);q(this,"payable");Object.defineProperty(this,dr,{value:tP}),Me(this,{payable:s})}format(n){const r=this.inputs.length===0?"receive":"fallback";if(n==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(n){if(Qi.isFragment(n))return n;if(typeof n=="string")try{return Qi.from(aa(n))}catch{$(!1,"invalid fallback fragment","obj",n)}else if(n instanceof Ts){const r=n.toString(),s=n.peekKeyword(Jn(["fallback","receive"]));if($(s,"type must be fallback or receive","obj",r),n.popKeyword(Jn(["fallback","receive"]))==="receive"){const l=qi(n);return $(l.length===0,"receive cannot have arguments","obj.inputs",l),Wi(n,Jn(["payable"])),_l(n),new Qi(Lt,[],!0)}let o=qi(n);o.length?$(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[En.from("bytes")];const a=KR(n);if($(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Wi(n,Jn(["returns"])).has("returns")){const l=qi(n);$(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return _l(n),new Qi(Lt,o,a==="payable")}if(n.type==="receive")return new Qi(Lt,[],!0);if(n.type==="fallback"){const r=[En.from("bytes")],s=n.stateMutability==="payable";return new Qi(Lt,r,s)}$(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[dr]===tP}}class di extends cy{constructor(n,r,s,i,o,a){super(n,"function",r,i);q(this,"constant");q(this,"outputs");q(this,"stateMutability");q(this,"payable");q(this,"gas");Object.defineProperty(this,dr,{value:nP}),o=Object.freeze(o.slice()),Me(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n))),outputs:this.outputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("function"),r.push(this.name+zh(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(zh(n,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(n,r){return r=(r||[]).map(i=>En.from(i)),new di(Lt,n,"view",r,[],null).selector}static from(n){if(di.isFragment(n))return n;if(typeof n=="string")try{return di.from(aa(n))}catch{$(!1,"invalid function fragment","obj",n)}else if(n instanceof Ts){const s=uy("function",n),i=qi(n),o=KR(n);let a=[];Wi(n,Jn(["returns"])).has("returns")&&(a=qi(n));const l=QR(n);return _l(n),new di(Lt,s,o,i,a,l)}let r=n.stateMutability;return r==null&&(r="payable",typeof n.constant=="boolean"?(r="view",n.constant||(r="payable",typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable"))):typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable")),new di(Lt,n.name,r,n.inputs?n.inputs.map(En.from):[],n.outputs?n.outputs.map(En.from):[],n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===nP}}class Pl extends cy{constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,dr,{value:rP})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Pl.from(aa(e))}catch{$(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ts){const n=uy("struct",e),r=qi(e);return _l(e),new Pl(Lt,n,r)}return new Pl(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===rP}}const Ds=new Map;Ds.set(0,"GENERIC_PANIC"),Ds.set(1,"ASSERT_FALSE"),Ds.set(17,"OVERFLOW"),Ds.set(18,"DIVIDE_BY_ZERO"),Ds.set(33,"ENUM_RANGE_ERROR"),Ds.set(34,"BAD_STORAGE_DATA"),Ds.set(49,"STACK_UNDERFLOW"),Ds.set(50,"ARRAY_RANGE_ERROR"),Ds.set(65,"OUT_OF_MEMORY"),Ds.set(81,"UNINITIALIZED_FUNCTION_CALL");const jse=new RegExp(/^bytes([0-9]*)$/),Use=new RegExp(/^(u?int)([0-9]*)$/);let Xx=null,sP=1024;function Hse(t,e,n,r){let s="missing revert data",i=null;const o=null;let a=null;if(n){s="execution reverted";const u=ct(n);if(n=Ae(n),u.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(u.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Ae(u.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],u.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(Ae(u.slice(0,4))==="0x4e487b71")try{const c=Number(r.decode(["uint256"],u.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[c]},i=`Panic due to ${Ds.get(c)||"UNKNOWN"}(${c})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?gt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=gt(e.from)),_t(s,"CALL_EXCEPTION",{action:t,data:n,reason:i,transaction:l,invocation:o,revert:a})}const nb=class nb{constructor(){J(this,wa)}getDefaultValue(e){const n=e.map(s=>de(this,wa,Kf).call(this,En.from(s)));return new Xg(n,"_").defaultValue()}encode(e,n){F_(n.length,e.length,"types/values length mismatch");const r=e.map(o=>de(this,wa,Kf).call(this,En.from(o))),s=new Xg(r,"_"),i=new px;return s.encode(i,n),i.data}decode(e,n,r){const s=e.map(o=>de(this,wa,Kf).call(this,En.from(o)));return new Xg(s,"_").decode(new mx(n,r,sP))}static _setDefaultMaxInflation(e){$(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),sP=e}static defaultAbiCoder(){return Xx==null&&(Xx=new nb),Xx}static getBuiltinCallException(e,n,r){return Hse(e,n,r,nb.defaultAbiCoder())}};wa=new WeakSet,Kf=function(e){if(e.isArray())return new dre(de(this,wa,Kf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new Xg(e.components.map(r=>de(this,wa,Kf).call(this,r)),e.name);switch(e.baseType){case"address":return new cre(e.name);case"bool":return new hre(e.name);case"string":return new xre(e.name);case"bytes":return new pre(e.name);case"":return new yre(e.name)}let n=e.type.match(Use);if(n){let r=parseInt(n[2]||"256");return $(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new vre(r/8,n[1]==="int",e.name)}if(n=e.type.match(jse),n){let r=parseInt(n[1]);return $(r!==0&&r<=32,"invalid bytes length","param",e),new mre(r,e.name)}$(!1,"invalid type","type",e.type)};let Fc=nb;class Vse{constructor(e,n,r){q(this,"fragment");q(this,"name");q(this,"signature");q(this,"topic");q(this,"args");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,signature:i,topic:n,args:r})}}class zse{constructor(e,n,r,s){q(this,"fragment");q(this,"name");q(this,"args");q(this,"signature");q(this,"selector");q(this,"value");const i=e.name,o=e.format();Me(this,{fragment:e,name:i,args:r,signature:o,selector:n,value:s})}}class $se{constructor(e,n,r){q(this,"fragment");q(this,"name");q(this,"args");q(this,"signature");q(this,"selector");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,args:r,signature:i,selector:n})}}class iP{constructor(e){q(this,"hash");q(this,"_isIndexed");Me(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const oP={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},aP={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&oP[t.toString()]&&(e=oP[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}},su=class su{constructor(e){J(this,wi);q(this,"fragments");q(this,"deploy");q(this,"fallback");q(this,"receive");J(this,gi);J(this,yi);J(this,bi);J(this,Ln);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,L(this,bi,new Map),L(this,gi,new Map),L(this,yi,new Map);const r=[];for(const o of n)try{r.push(Rl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Me(this,{fragments:Object.freeze(r)});let s=null,i=!1;L(this,Ln,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Me(this,{deploy:o});return;case"fallback":o.inputs.length===0?i=!0:($(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${a}]`,o),s=o,i=s.payable);return;case"function":l=T(this,bi);break;case"event":l=T(this,yi);break;case"error":l=T(this,gi);break;default:return}const u=o.format();l.has(u)||l.set(u,o)}),this.deploy||Me(this,{deploy:Ki.from("constructor()")}),Me(this,{fallback:s,receive:i})}format(e){const n=e?"minimal":"full";return this.fragments.map(s=>s.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return Fc.defaultAbiCoder()}getFunctionName(e){const n=de(this,wi,ub).call(this,e,null,!1);return $(n,"no matching function","key",e),n.name}hasFunction(e){return!!de(this,wi,ub).call(this,e,null,!1)}getFunction(e,n){return de(this,wi,ub).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(T(this,bi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,bi).get(s),r)}}getEventName(e){const n=de(this,wi,cb).call(this,e,null,!1);return $(n,"no matching event","key",e),n.name}hasEvent(e){return!!de(this,wi,cb).call(this,e,null,!1)}getEvent(e,n){return de(this,wi,cb).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(T(this,yi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,yi).get(s),r)}}getError(e,n){if(St(e)){const s=e.toLowerCase();if(aP[s])return hr.from(aP[s].signature);for(const i of T(this,gi).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,gi))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?hr.from("error Error(string)"):e==="Panic"?hr.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");$(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=hr.from(e).format(),e==="Error(string)")return hr.from("error Error(string)");if(e==="Panic(uint256)")return hr.from("error Panic(uint256)");const r=T(this,gi).get(e);return r||null}forEachError(e){const n=Array.from(T(this,gi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,gi).get(s),r)}}_decodeParams(e,n){return T(this,Ln).decode(e,n)}_encodeParams(e,n){return T(this,Ln).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $(Vt(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,Vt(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $(Vt(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,Vt(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const i=this.getFunction(e);$(i,"unknown function","fragment",e),e=i}let r="invalid length for result data";const s=Gn(n);if(s.length%32===0)try{return T(this,Ln).decode(e.outputs,s)}catch{r="could not decode result data"}te(!1,r,"BAD_DATA",{value:Ae(s),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=ct(e,"data"),s=Fc.getBuiltinCallException("call",n,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const a=Ae(r.slice(0,4)),l=this.getError(a);if(l)try{const u=T(this,Ln).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:u},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(n);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return Ae(T(this,Ln).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const i=this.getEvent(e);$(i,"unknown event","eventFragment",e),e=i}te(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?Ol(o):i.type==="bytes"?en(Ae(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=Zo(o):i.type.match(/^bytes/)?o=Ete(o,32):i.type==="address"&&T(this,Ln).encode(["address"],[o]),xl(Ae(o),32));for(n.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){$(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?$(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?r.push(i.map(l=>s(a,l))):r.push(s(a,i))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,n){if(typeof e=="string"){const o=this.getEvent(e);$(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],i=[];return e.anonymous||r.push(e.topicHash),$(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((o,a)=>{const l=n[a];if(o.indexed)if(o.type==="string")r.push(Ol(l));else if(o.type==="bytes")r.push(en(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Ln).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Ln).encode(s,i),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const h=this.getEvent(e);$(h,"unknown event","eventFragment",e),e=h}if(r!=null&&!e.anonymous){const h=e.topicHash;$(St(r[0],32)&&r[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(En.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=r!=null?T(this,Ln).decode(s,$t(r)):null,l=T(this,Ln).decode(i,n,!0),u=[],c=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new iP(null);else if(o[p])m=new iP(a[d++]);else try{m=a[d++]}catch(g){m=g}else try{m=l[f++]}catch(g){m=g}u.push(m),c.push(h.name||null)}),Tc.fromItems(u,c)}parseTransaction(e){const n=ct(e.data,"tx.data"),r=Ce(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Ae(n.slice(0,4)));if(!s)return null;const i=T(this,Ln).decode(s.inputs,n.slice(4));return new zse(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new Vse(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=Ae(e),r=this.getError(Vt(n,0,4));if(!r)return null;const s=T(this,Ln).decode(r.inputs,Vt(n,4));return new $se(r,r.selector,s)}static from(e){return e instanceof su?e:typeof e=="string"?new su(JSON.parse(e)):typeof e.formatJson=="function"?new su(e.formatJson()):typeof e.format=="function"?new su(e.format("json")):new su(e)}};gi=new WeakMap,yi=new WeakMap,bi=new WeakMap,Ln=new WeakMap,wi=new WeakSet,ub=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,bi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,bi))o.split("(")[0]===e&&i.push(a);if(n){const o=n.length>0?n[n.length-1]:null;let a=n.length,l=!0;Rn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let u=i.length-1;u>=0;u--){const c=i[u].inputs.length;c!==a&&(!l||c!==a-1)&&i.splice(u,1)}for(let u=i.length-1;u>=0;u--){const c=i[u].inputs;for(let f=0;f<n.length;f++)if(Rn.isTyped(n[f])){if(f>=c.length){if(n[f].type==="overrides")continue;i.splice(u,1);break}if(n[f].type!==c[f].baseType){i.splice(u,1);break}}}}if(i.length===1&&n&&n.length!==i[0].inputs.length){const o=n[n.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,bi).get(di.from(e).format());return s||null},cb=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,yi).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,yi))o.split("(")[0]===e&&i.push(a);if(n){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<n.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<n.length;l++)if(Rn.isTyped(n[l])&&n[l].type!==a[l].baseType){i.splice(o,1);break}}}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,yi).get(fi.from(e).format());return s||null};let Zx=su;const lP=BigInt(0);function jc(t){return t??null}function qt(t){return t==null?null:t.toString()}class uP{constructor(e,n,r){q(this,"gasPrice");q(this,"maxFeePerGas");q(this,"maxPriorityFeePerGas");Me(this,{gasPrice:jc(e),maxFeePerGas:jc(n),maxPriorityFeePerGas:jc(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:qt(e),maxFeePerGas:qt(n),maxPriorityFeePerGas:qt(r)}}}function fy(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Ae(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=Ce(t[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=Qe(t[s],`request.${s}`));return t.accessList&&(e.accessList=oa(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>ux(s)?Ae(s):Object.assign({},s))),e}class Gse{constructor(e,n){q(this,"provider");q(this,"number");q(this,"hash");q(this,"timestamp");q(this,"parentHash");q(this,"parentBeaconBlockRoot");q(this,"nonce");q(this,"difficulty");q(this,"gasLimit");q(this,"gasUsed");q(this,"stateRoot");q(this,"receiptsRoot");q(this,"blobGasUsed");q(this,"excessBlobGas");q(this,"miner");q(this,"prevRandao");q(this,"extraData");q(this,"baseFeePerGas");J(this,ho);L(this,ho,e.transactions.map(r=>typeof r!="string"?new Gh(r,n):r)),Me(this,{provider:n,hash:jc(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:jc(e.prevRandao),extraData:e.extraData,baseFeePerGas:jc(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,ho).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,ho).slice();return e.length===0?[]:(te(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:g}=this;return{_type:"Block",baseFeePerGas:qt(e),difficulty:qt(n),extraData:r,gasLimit:qt(s),gasUsed:qt(i),blobGasUsed:qt(this.blobGasUsed),excessBlobGas:qt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const n=this.transactions;return{next:()=>e<this.length?{value:n[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,ho).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=T(this,ho)[e];else{const r=e.toLowerCase();for(const s of T(this,ho))if(typeof s=="string"){if(s!==r)continue;n=s;break}else{if(s.hash===r)continue;n=s;break}}if(n==null)throw new Error("no such tx");return typeof n=="string"?await this.provider.getTransaction(n):n}getPrefetchedTransaction(e){const n=this.prefetchedTransactions;if(typeof e=="number")return n[e];e=e.toLowerCase();for(const r of n)if(r.hash===e)return r;$(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Wse(this)}}ho=new WeakMap;class $h{constructor(e,n){q(this,"provider");q(this,"transactionHash");q(this,"blockHash");q(this,"blockNumber");q(this,"removed");q(this,"address");q(this,"data");q(this,"topics");q(this,"index");q(this,"transactionIndex");this.provider=n;const r=Object.freeze(e.topics.slice());Me(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return te(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return te(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return te(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return qse(this)}}class cP{constructor(e,n){q(this,"provider");q(this,"to");q(this,"from");q(this,"contractAddress");q(this,"hash");q(this,"index");q(this,"blockHash");q(this,"blockNumber");q(this,"logsBloom");q(this,"gasUsed");q(this,"blobGasUsed");q(this,"cumulativeGasUsed");q(this,"gasPrice");q(this,"blobGasPrice");q(this,"type");q(this,"status");q(this,"root");J(this,yp);L(this,yp,Object.freeze(e.logs.map(s=>new $h(s,n))));let r=lP;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Me(this,{provider:n,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return T(this,yp)}toJSON(){const{to:e,from:n,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:u,status:c,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:qt(this.cumulativeGasUsed),from:n,gasPrice:qt(this.gasPrice),blobGasUsed:qt(this.blobGasUsed),blobGasPrice:qt(this.blobGasPrice),gasUsed:qt(this.gasUsed),hash:s,index:i,logs:u,logsBloom:l,root:f,status:c,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return dP(this)}reorderedEvent(e){return te(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),fP(this,e)}}yp=new WeakMap;const _k=class _k{constructor(e,n){q(this,"provider");q(this,"blockNumber");q(this,"blockHash");q(this,"index");q(this,"hash");q(this,"type");q(this,"to");q(this,"from");q(this,"nonce");q(this,"gasLimit");q(this,"gasPrice");q(this,"maxPriorityFeePerGas");q(this,"maxFeePerGas");q(this,"maxFeePerBlobGas");q(this,"data");q(this,"value");q(this,"chainId");q(this,"signature");q(this,"accessList");q(this,"blobVersionedHashes");J(this,Aa);this.provider=n,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,L(this,Aa,-1)}toJSON(){const{blockNumber:e,blockHash:n,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:u,signature:c,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:n,blobVersionedHashes:d,chainId:qt(this.chainId),data:u,from:a,gasLimit:qt(this.gasLimit),gasPrice:qt(this.gasPrice),hash:s,maxFeePerGas:qt(this.maxFeePerGas),maxPriorityFeePerGas:qt(this.maxPriorityFeePerGas),maxFeePerBlobGas:qt(this.maxFeePerBlobGas),nonce:l,signature:c,to:o,index:r,type:i,value:qt(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const n=this.provider.getBlock(e);if(n==null)throw new Error("TODO");return n}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:n,blockNumber:r}=await _n({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return n==null||n.blockNumber==null?0:r-n.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,n){const r=e??1,s=n??0;let i=T(this,Aa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await _n({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h<this.nonce){i=d;return}if(a)return null;const p=await this.getTransaction();if(!(p&&p.blockNumber!=null))for(o===-1&&(o=i-3,o<T(this,Aa)&&(o=T(this,Aa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const g of m)if(g===this.hash)return;for(let g=0;g<m.length;g++){const b=await m.getTransaction(g);if(b.from===this.from&&b.nonce===this.nonce){if(a)return null;const v=await this.provider.getTransactionReceipt(b.hash);if(v==null||d-v.blockNumber+1<r)return;let A="replaced";b.data===this.data&&b.to===this.to&&b.value===this.value?A="repriced":b.data==="0x"&&b.from===b.to&&b.value===lP&&(A="cancelled"),te(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:A==="replaced"||A==="cancelled",reason:A,replacement:b.replaceableTransaction(i),hash:b.hash,receipt:v})}}o++}},u=d=>{if(d==null||d.status!==0)return d;te(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},c=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(c);if(c){if(await c.confirmations()>=r)return u(c)}else if(await l(),r===0)return null;return await new Promise((d,h)=>{const p=[],m=()=>{p.forEach(b=>b())};if(p.push(()=>{a=!0}),s>0){const b=setTimeout(()=>{m(),h(_t("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(b)})}const g=async b=>{if(await b.confirmations()>=r){m();try{d(u(b))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const b=async()=>{try{await l()}catch(v){if(gn(v,"TRANSACTION_REPLACED")){m(),h(v);return}}a||this.provider.once("block",b)};p.push(()=>{this.provider.off("block",b)}),this.provider.once("block",b)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return te(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),dP(this)}reorderedEvent(e){return te(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),te(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),fP(this,e)}replaceableTransaction(e){$(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new _k(this,this.provider);return L(n,Aa,e),n}};Aa=new WeakMap;let Gh=_k;function Wse(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function fP(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function dP(t){return{orphan:"drop-transaction",tx:t}}function qse(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class e2 extends $h{constructor(n,r,s){super(n,n.provider);q(this,"interface");q(this,"fragment");q(this,"args");const i=r.decodeEventLog(s,n.data,n.topics);Me(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class hP extends $h{constructor(n,r){super(n,n.provider);q(this,"error");Me(this,{error:r})}}class Kse extends cP{constructor(n,r,s){super(s,r);J(this,Sf);L(this,Sf,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?T(this,Sf).getEvent(n.topics[0]):null;if(r)try{return new e2(n,T(this,Sf),r)}catch(s){return new hP(n,s)}return n})}}Sf=new WeakMap;class t2 extends Gh{constructor(n,r,s){super(s,r);J(this,bp);L(this,bp,n)}async wait(n,r){const s=await super.wait(n,r);return s==null?null:new Kse(T(this,bp),this.provider,s)}}bp=new WeakMap;class pP extends W_{constructor(n,r,s,i){super(n,r,s);q(this,"log");Me(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Qse extends pP{constructor(e,n,r,s,i){super(e,n,r,new e2(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Me(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const mP=BigInt(0);function gP(t){return t&&typeof t.call=="function"}function yP(t){return t&&typeof t.estimateGas=="function"}function dy(t){return t&&typeof t.resolveName=="function"}function bP(t){return t&&typeof t.sendTransaction=="function"}function wP(t){if(t!=null){if(dy(t))return t;if(t.provider)return t.provider}}class Jse{constructor(e,n,r){J(this,wp);q(this,"fragment");if(Me(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const s=Il(e.runner,"resolveName"),i=dy(s)?s:null;L(this,wp,async function(){const o=await Promise.all(n.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(c,f)=>c==="address"?Array.isArray(f)?Promise.all(f.map(d=>Qn(d,i))):Qn(f,i):f)));return e.interface.encodeFilterTopics(n,o)}())}getTopicFilter(){return T(this,wp)}}wp=new WeakMap;function Il(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Ll(t){return t==null?null:t.provider||null}async function AP(t,e){const n=Rn.dereference(t,"overrides");$(typeof n=="object","invalid overrides parameter","overrides",t);const r=fy(n);return $(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),$(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function Yse(t,e,n){const r=Il(t,"resolveName"),s=dy(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(n[o],(a,l)=>(l=Rn.dereference(l,a),a==="address"?Qn(l,s):l))))}function Xse(t){const e=async function(o){const a=await AP(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await Qn(a.from,wP(t.runner)));const l=t.interface,u=Ce(a.value||mP,"overrides.value")===mP,c=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!c&&!u&&$(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return $(f||u,"cannot send value to non-payable fallback","overrides.value",a.value),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data),a},n=async function(o){const a=Il(t.runner,"call");te(gP(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(u){throw lx(u)&&u.data?t.interface.makeError(u.data,l):u}},r=async function(o){const a=t.runner;te(bP(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),u=Ll(t.runner);return new t2(t.interface,u,l)},s=async function(o){const a=Il(t.runner,"estimateGas");return te(yP(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},i=async o=>await r(o);return Me(i,{_contract:t,estimateGas:s,populateTransaction:e,send:r,staticCall:n}),i}function Zse(t,e){const n=function(...u){const c=t.interface.getFunction(e,u);return te(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),c},r=async function(...u){const c=n(...u);let f={};if(c.inputs.length+1===u.length&&(f=await AP(u.pop()),f.from&&(f.from=await Qn(f.from,wP(t.runner)))),c.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Yse(t.runner,c.inputs,u);return Object.assign({},f,await _n({to:t.getAddress(),data:t.interface.encodeFunctionData(c,d)}))},s=async function(...u){const c=await a(...u);return c.length===1?c[0]:c},i=async function(...u){const c=t.runner;te(bP(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await c.sendTransaction(await r(...u)),d=Ll(t.runner);return new t2(t.interface,d,f)},o=async function(...u){const c=Il(t.runner,"estimateGas");return te(yP(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await r(...u))},a=async function(...u){const c=Il(t.runner,"call");te(gP(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let d="0x";try{d=await c.call(f)}catch(p){throw lx(p)&&p.data?t.interface.makeError(p.data,f):p}const h=n(...u);return t.interface.decodeFunctionResult(h,d)},l=async(...u)=>n(...u).constant?await s(...u):await i(...u);return Me(l,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return te(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),l}function eie(t,e){const n=function(...s){const i=t.interface.getEvent(e,s);return te(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},r=function(...s){return new Jse(t,n(...s),s)};return Me(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return te(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const hy=Symbol.for("_ethersInternal_contract"),vP=new WeakMap;function tie(t,e){vP.set(t[hy],e)}function Rr(t){return vP.get(t[hy])}function nie(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function n2(t,e){let n,r=null;if(Array.isArray(e)){const i=function(o){if(St(o,32))return o;const a=t.interface.getEvent(o);return $(a,"unknown fragment","name",o),a.topicHash};n=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?n=[null]:typeof e=="string"?St(e,32)?n=[e]:(r=t.interface.getEvent(e),$(r,"unknown fragment","event",e),n=[r.topicHash]):nie(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):$(!1,"unknown event name","event",e);n=n.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=n.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:n}}async function Wh(t,e){const{subs:n}=Rr(t);return n.get((await n2(t,e)).tag)||null}async function xP(t,e,n){const r=Ll(t.runner);te(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await n2(t,n),{addr:a,subs:l}=Rr(t);let u=l.get(i);if(!u){const f={address:a||t,topics:o},d=g=>{let b=s;if(b==null)try{b=t.interface.getEvent(g.topics[0])}catch{}if(b){const v=b,A=s?t.interface.decodeEventLog(s,g.data,g.topics):[];s2(t,n,A,w=>new Qse(t,w,n,v,g))}else s2(t,n,[],v=>new pP(t,v,n,g))};let h=[];u={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let g=h;h=[],await Promise.all(g),r.off(f,d)}},l.set(i,u)}return u}let r2=Promise.resolve();async function rie(t,e,n,r){await r2;const s=await Wh(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(n);r&&l.push(r(a?null:o));try{o.call(t,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Rr(t).subs.delete(s.tag)),i>0}async function s2(t,e,n,r){try{await r2}catch{}const s=rie(t,e,n,r);return r2=s,await s}const py=["then"];EL=hy;const Ap=class Ap{constructor(e,n,r,s){q(this,"target");q(this,"interface");q(this,"runner");q(this,"filters");q(this,EL);q(this,"fallback");$(typeof e=="string"||nR(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=Zx.from(n);Me(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,hy,{value:{}});let o,a=null,l=null;if(s){const f=Ll(r);l=new t2(this.interface,f,s)}let u=new Map;if(typeof e=="string")if(St(e))a=e,o=Promise.resolve(e);else{const f=Il(r,"resolveName");if(!dy(f))throw _t("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw _t("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Rr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Rr(this).addr=f,f});tie(this,{addrPromise:o,addr:a,deployTx:l,subs:u});const c=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||py.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>py.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Me(this,{filters:c}),Me(this,{fallback:i.receive||i.fallback?Xse(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||py.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||py.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Ap(this.target,this.interface,e)}attach(e){return new Ap(e,this.interface,this.runner)}async getAddress(){return await Rr(this).addrPromise}async getDeployedCode(){const e=Ll(this.runner);te(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Ll(this.runner);return te(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return Rr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),Zse(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),eie(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,n,r){n==null&&(n=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Rr(this),o=s||await i,{fragment:a,topics:l}=await n2(this,e),u={address:o,topics:l,fromBlock:n,toBlock:r},c=Ll(this.runner);return te(c,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await c.getLogs(u)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new e2(f,this.interface,d)}catch(h){return new hP(f,h)}return new $h(f,c)})}async on(e,n){const r=await xP(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await xP(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await s2(this,e,n,null)}async listenerCount(e){if(e){const s=await Wh(this,e);return s?s.listeners.length:0}const{subs:n}=Rr(this);let r=0;for(const{listeners:s}of n.values())r+=s.length;return r}async listeners(e){if(e){const s=await Wh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:n}=Rr(this);let r=[];for(const{listeners:s}of n.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,n){const r=await Wh(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(n==null||r.listeners.length===0)&&(r.stop(),Rr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await Wh(this,e);if(!n)return this;n.stop(),Rr(this).subs.delete(n.tag)}else{const{subs:n}=Rr(this);for(const{tag:r,stop:s}of n.values())s(),n.delete(r)}return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return await this.off(e,n)}static buildClass(e){class n extends Ap{constructor(s,i=null){super(s,e,i)}}return n}static from(e,n,r){return r==null&&(r=null),new this(e,n,r)}};let i2=Ap;function sie(){return i2}class Uc extends sie(){}function o2(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):$(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class iie{constructor(e){q(this,"name");Me(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const kP=new RegExp("^(ipfs)://(.*)$","i"),EP=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),kP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],Tf=class Tf{constructor(e,n,r){J(this,xa);q(this,"provider");q(this,"address");q(this,"name");J(this,va);J(this,iu);Me(this,{provider:e,address:n,name:r}),L(this,va,null),L(this,iu,new Uc(n,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return T(this,va)==null&&L(this,va,(async()=>{try{return await T(this,iu).supportsInterface("0x9061b923")}catch(e){if(gn(e,"CALL_EXCEPTION"))return!1;throw L(this,va,null),e}})()),await T(this,va)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await de(this,xa,Qf).call(this,"addr(bytes32)");return i==null||i===Rh?null:i}catch(i){if(gn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await de(this,xa,Qf).call(this,"addr(bytes32,uint)",[i]);if(St(o,20))return gt(o)}let n=null;for(const i of this.provider.plugins)if(i instanceof iie&&i.supportsCoinType(e)){n=i;break}if(n==null)return null;const r=await de(this,xa,Qf).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await n.decodeAddress(e,r);if(s!=null)return s;te(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await de(this,xa,Qf).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await de(this,xa,Qf).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const n=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const s=n[1]==="e3010170"?"ipfs":"ipns",i=parseInt(n[4],16);if(n[5].length===i*2)return`${s}://${Tte("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;te(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<EP.length;r++){const s=n.match(EP[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:n}),{linkage:e,url:n};case"ipfs":{const o=o2(n);return e.push({type:"ipfs",value:n}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=i==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:i,value:n});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(s[2]||"").split("/");if(l.length!==2)return e.push({type:`!${i}caip`,value:s[2]||""}),{url:null,linkage:e};const u=l[1],c=new Uc(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(i==="erc721"){const m=await c.ownerOf(u);if(a!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(i==="erc1155"){const m=await c.balanceOf(a,u);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await c[o](u);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),i==="erc1155"&&(f=f.replace("{id}",Zo(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=o2(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new qn(f).send();h.assertOk();try{d=h.bodyJson}catch{try{e.push({type:"!metadata",value:h.bodyText})}catch{const b=h.body;return b&&e.push({type:"!metadata",value:Ae(b)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!d)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(d)});let p=d.image;if(typeof p!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(kP)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=o2(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return te(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async fromName(e,n){var s;let r=n;for(;;){if(r===""||r==="."||n!=="eth"&&r==="eth")return null;const i=await de(s=Tf,rb,NL).call(s,e,r);if(i!=null){const o=new Tf(e,i,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};va=new WeakMap,iu=new WeakMap,xa=new WeakSet,Qf=async function(e,n){n=(n||[]).slice();const r=T(this,iu).interface;n.unshift($x(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),te(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[ose(this.name,255),r.encodeFunctionData(s,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const i=await T(this,iu)[e](...n);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!gn(i,"CALL_EXCEPTION"))throw i}return null},rb=new WeakSet,NL=async function(e,n){const r=await Tf.getEnsAddress(e);try{const i=await new Uc(r,["function resolver(bytes32) view returns (address)"],e).resolver($x(n),{enableCcipRead:!0});return i===Rh?null:i}catch(s){throw s}return null},J(Tf,rb);let my=Tf;const CP=BigInt(0);function lt(t,e){return function(n){return n==null?e:t(n)}}function gy(t,e){return n=>{if(e&&n==null)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map(r=>t(r))}}function qh(t,e){return n=>{const r={};for(const s in t){let i=s;if(e&&s in e&&!(i in n)){for(const o of e[s])if(o in n){i=o;break}}try{const o=t[s](n[i]);o!==void 0&&(r[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";te(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:n})}}return r}}function oie(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}$(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Hc(t){return $(St(t,!0),"invalid data","value",t),t}function Cn(t){return $(St(t,32),"invalid hash","value",t),t}const aie=qh({address:gt,blockHash:Cn,blockNumber:Qe,data:Hc,index:Qe,removed:lt(oie,!1),topics:gy(Cn),transactionHash:Cn,transactionIndex:Qe},{index:["logIndex"]});function lie(t){return aie(t)}const uie=qh({hash:lt(Cn),parentHash:Cn,parentBeaconBlockRoot:lt(Cn,null),number:Qe,timestamp:Qe,nonce:lt(Hc),difficulty:Ce,gasLimit:Ce,gasUsed:Ce,stateRoot:lt(Cn,null),receiptsRoot:lt(Cn,null),blobGasUsed:lt(Ce,null),excessBlobGas:lt(Ce,null),miner:lt(gt),prevRandao:lt(Cn,null),extraData:Hc,baseFeePerGas:lt(Ce)},{prevRandao:["mixHash"]});function cie(t){const e=uie(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:SP(n)),e}const fie=qh({transactionIndex:Qe,blockNumber:Qe,transactionHash:Cn,address:gt,topics:gy(Cn),data:Hc,index:Qe,blockHash:Cn},{index:["logIndex"]});function die(t){return fie(t)}const hie=qh({to:lt(gt,null),from:lt(gt,null),contractAddress:lt(gt,null),index:Qe,root:lt(Ae),gasUsed:Ce,blobGasUsed:lt(Ce,null),logsBloom:lt(Hc),blockHash:Cn,hash:Cn,logs:gy(die),blockNumber:Qe,cumulativeGasUsed:Ce,effectiveGasPrice:lt(Ce),blobGasPrice:lt(Ce,null),status:lt(Qe),type:lt(Qe,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function pie(t){return hie(t)}function SP(t){t.to&&Ce(t.to)===CP&&(t.to="0x0000000000000000000000000000000000000000");const e=qh({hash:Cn,index:lt(Qe,void 0),type:n=>n==="0x"||n==null?0:Qe(n),accessList:lt(oa,null),blobVersionedHashes:lt(gy(Cn,!0),null),blockHash:lt(Cn,null),blockNumber:lt(Qe,null),transactionIndex:lt(Qe,null),from:gt,gasPrice:lt(Ce),maxPriorityFeePerGas:lt(Ce),maxFeePerGas:lt(Ce),maxFeePerBlobGas:lt(Ce,null),gasLimit:Ce,to:lt(gt,null),value:Ce,nonce:Qe,data:Hc,creates:lt(gt,null),chainId:lt(Ce,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=lre(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Ss.from(t.signature):e.signature=Ss.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&Ce(e.blockHash)===CP&&(e.blockHash=null),e}const mie="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Kh{constructor(e){q(this,"name");Me(this,{name:e})}clone(){return new Kh(this.name)}}class yy extends Kh{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||0}`);q(this,"effectiveBlock");q(this,"txBase");q(this,"txCreate");q(this,"txDataZero");q(this,"txDataNonzero");q(this,"txAccessListStorageKey");q(this,"txAccessListAddress");const s={effectiveBlock:n};function i(o,a){let l=(r||{})[o];l==null&&(l=a),$(typeof l=="number",`invalud value for ${o}`,"costs",r),s[o]=l}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Me(this,s)}clone(){return new yy(this.effectiveBlock,this)}}class by extends Kh{constructor(n,r){super("org.ethers.plugins.network.Ens");q(this,"address");q(this,"targetNetwork");Me(this,{address:n||mie,targetNetwork:r??1})}clone(){return new by(this.address,this.targetNetwork)}}class gie extends Kh{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");J(this,vp);J(this,xp);L(this,vp,n),L(this,xp,r)}get url(){return T(this,vp)}get processFunc(){return T(this,xp)}clone(){return this}}vp=new WeakMap,xp=new WeakMap;const a2=new Map,Mf=class Mf{constructor(e,n){J(this,Df);J(this,Of);J(this,ka);L(this,Df,e),L(this,Of,Ce(n)),L(this,ka,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,Df)}set name(e){L(this,Df,e)}get chainId(){return T(this,Of)}set chainId(e){L(this,Of,Ce(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Ce(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Ce(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Ce(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(T(this,ka).values())}attachPlugin(e){if(T(this,ka).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,ka).set(e.name,e.clone()),this}getPlugin(e){return T(this,ka).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new Mf(this.name,this.chainId);return this.plugins.forEach(n=>{e.attachPlugin(n.clone())}),e}computeIntrinsicGas(e){const n=this.getPlugin("org.ethers.plugins.network.GasCost")||new yy;let r=n.txBase;if(e.to==null&&(r+=n.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=n.txDataZero:r+=n.txDataNonzero;if(e.accessList){const s=oa(e.accessList);for(const i in s)r+=n.txAccessListAddress+n.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(yie(),e==null)return Mf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=a2.get(e);if(n)return n();if(typeof e=="bigint")return new Mf("unknown",e);$(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){$(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new Mf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new by(e.ensAddress,e.ensNetwork)),n}$(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=a2.get(e);r&&$(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),a2.set(e,n)}};Df=new WeakMap,Of=new WeakMap,ka=new WeakMap;let rn=Mf;function TP(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let s=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||s++,r[1]=s.toString()}return BigInt(r[0]+r[1])}function DP(t){return new gie(t,async(e,n,r)=>{r.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([r.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:TP(a.maxFee,9),maxPriorityFeePerGas:TP(a.maxPriorityFee,9)}}catch(i){te(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:i})}})}let OP=!1;function yie(){if(OP)return;OP=!0;function t(e,n,r){const s=function(){const i=new rn(e,n);return r.ensNetwork!=null&&i.attachPlugin(new by(null,r.ensNetwork)),i.attachPlugin(new yy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};rn.register(e,s),rn.register(n,s),r.altNames&&r.altNames.forEach(i=>{rn.register(i,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[DP("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[DP("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function l2(t){return JSON.parse(JSON.stringify(t))}class bie{constructor(e){J(this,Nf);J(this,po);J(this,ss);J(this,Ea);J(this,Ai);L(this,po,e),L(this,ss,null),L(this,Ea,4e3),L(this,Ai,-2)}get pollingInterval(){return T(this,Ea)}set pollingInterval(e){L(this,Ea,e)}start(){T(this,ss)||(L(this,ss,T(this,po)._setTimeout(de(this,Nf,fb).bind(this),T(this,Ea))),de(this,Nf,fb).call(this))}stop(){T(this,ss)&&(T(this,po)._clearTimeout(T(this,ss)),L(this,ss,null))}pause(e){this.stop(),e&&L(this,Ai,-2)}resume(){this.start()}}po=new WeakMap,ss=new WeakMap,Ea=new WeakMap,Ai=new WeakMap,Nf=new WeakSet,fb=async function(){try{const e=await T(this,po).getBlockNumber();if(T(this,Ai)===-2){L(this,Ai,e);return}if(e!==T(this,Ai)){for(let n=T(this,Ai)+1;n<=e;n++){if(T(this,ss)==null)return;await T(this,po).emit("block",n)}L(this,Ai,e)}}catch{}T(this,ss)!=null&&L(this,ss,T(this,po)._setTimeout(de(this,Nf,fb).bind(this),T(this,Ea)))};class u2{constructor(e){J(this,ou);J(this,au);J(this,Ca);L(this,ou,e),L(this,Ca,!1),L(this,au,n=>{this._poll(n,T(this,ou))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){T(this,Ca)||(L(this,Ca,!0),T(this,au).call(this,-2),T(this,ou).on("block",T(this,au)))}stop(){T(this,Ca)&&(L(this,Ca,!1),T(this,ou).off("block",T(this,au)))}pause(e){this.stop()}resume(){this.start()}}ou=new WeakMap,au=new WeakMap,Ca=new WeakMap;class wie extends u2{constructor(n,r){super(n);J(this,_f);J(this,mo);L(this,_f,r),L(this,mo,-2)}pause(n){n&&L(this,mo,-2),super.pause(n)}async _poll(n,r){const s=await r.getBlock(T(this,_f));s!=null&&(T(this,mo)===-2?L(this,mo,s.number):s.number>T(this,mo)&&(r.emit(T(this,_f),s.number),L(this,mo,s.number)))}}_f=new WeakMap,mo=new WeakMap;class Aie extends u2{constructor(n,r){super(n);J(this,sb);L(this,sb,l2(r))}async _poll(n,r){throw new Error("@TODO")}}sb=new WeakMap;class vie extends u2{constructor(n,r){super(n);J(this,Rf);L(this,Rf,r)}async _poll(n,r){const s=await r.getTransactionReceipt(T(this,Rf));s&&r.emit(T(this,Rf),s)}}Rf=new WeakMap;class c2{constructor(e,n){J(this,ib);J(this,go);J(this,Pf);J(this,If);J(this,Sa);J(this,is);L(this,go,e),L(this,Pf,l2(n)),L(this,If,de(this,ib,_L).bind(this)),L(this,Sa,!1),L(this,is,-2)}start(){T(this,Sa)||(L(this,Sa,!0),T(this,is)===-2&&T(this,go).getBlockNumber().then(e=>{L(this,is,e)}),T(this,go).on("block",T(this,If)))}stop(){T(this,Sa)&&(L(this,Sa,!1),T(this,go).off("block",T(this,If)))}pause(e){this.stop(),e&&L(this,is,-2)}resume(){this.start()}}go=new WeakMap,Pf=new WeakMap,If=new WeakMap,Sa=new WeakMap,is=new WeakMap,ib=new WeakSet,_L=async function(e){if(T(this,is)===-2)return;const n=l2(T(this,Pf));n.fromBlock=T(this,is)+1,n.toBlock=e;const r=await T(this,go).getLogs(n);if(r.length===0){T(this,is)<e-60&&L(this,is,e-60);return}for(const s of r)T(this,go).emit(T(this,Pf),s),L(this,is,s.blockNumber)};const xie=BigInt(2),kie=10;function wy(t){return t&&typeof t.then=="function"}function Ay(t,e){return t+":"+JSON.stringify(e,(n,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const s=Object.keys(r);return s.sort(),s.reduce((i,o)=>(i[o]=r[o],i),{})}return r})}class vy{constructor(e){q(this,"name");Me(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function Eie(t){return JSON.parse(JSON.stringify(t))}function f2(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function d2(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(St(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:Ay("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:Ay("orphan",n),filter:Eie(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(s=>s==null?null:Array.isArray(s)?f2(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(n.address){const s=[],i=[],o=a=>{St(a)?s.push(a):i.push((async()=>{s.push(await Qn(a,e))})())};Array.isArray(n.address)?n.address.forEach(o):o(n.address),i.length&&await Promise.all(i),r.address=f2(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Ay("event",r),type:"event"}}$(!1,"unknown ProviderEvent","event",t)}function h2(){return new Date().getTime()}const Cie={cacheTimeout:250,pollingInterval:4e3};class xy{constructor(e,n){J(this,st);J(this,Bn);J(this,Ta);J(this,Fn);J(this,Lf);J(this,Fr);J(this,lu);J(this,Da);J(this,yo);J(this,kp);J(this,as);J(this,Bf);J(this,Ff);if(L(this,Ff,Object.assign({},Cie,n||{})),e==="any")L(this,lu,!0),L(this,Fr,null);else if(e){const r=rn.from(e);L(this,lu,!1),L(this,Fr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else L(this,lu,!1),L(this,Fr,null);L(this,yo,-1),L(this,Da,new Map),L(this,Bn,new Map),L(this,Ta,new Map),L(this,Fn,null),L(this,Lf,!1),L(this,kp,1),L(this,as,new Map),L(this,Bf,!1)}get pollingInterval(){return T(this,Ff).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,Ta).values())}attachPlugin(e){if(T(this,Ta).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,Ta).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,Ta).get(e)||null}get disableCcipRead(){return T(this,Bf)}set disableCcipRead(e){L(this,Bf,!!e)}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=n.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],u=l.replace("{sender}",s).replace("{data}",i),c=new qn(u);l.indexOf("{data}")===-1&&(c.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:c,index:a,urls:r});let f="unknown error";const d=await c.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:c,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:c,result:h})}catch{}te(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:f}}),o.push(f)}te(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,n){return new Gse(cie(e),this)}_wrapLog(e,n){return new $h(lie(e),this)}_wrapTransactionReceipt(e,n){return new cP(pie(e),this)}_wrapTransactionResponse(e,n){return new Gh(SP(e),this)}_detectNetwork(){te(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){te(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Qe(await de(this,st,jr).call(this,{method:"getBlockNumber"}),"%response");return T(this,yo)>=0&&L(this,yo,e),e}_getAddress(e){return Qn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(St(e))return St(e,32)?e:kl(e);if(typeof e=="bigint"&&(e=Qe(e,"blockTag")),typeof e=="number")return e>=0?kl(e):T(this,yo)>=0?kl(T(this,yo)+e):this.getBlockNumber().then(n=>kl(n+e));$(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?f2(l.map(u=>u.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,u,c)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(u!=null||c!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),n.length&&(d.topics=n),u&&(d.fromBlock=u),c&&(d.toBlock=c),r&&(d.blockHash=r),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)i.push(this._getAddress(l));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(l=>s(l[0],l[1],l[2])):s(i,o,a)}_getTransactionRequest(e){const n=fy(e),r=[];if(["to","from"].forEach(s=>{if(n[s]==null)return;const i=Qn(n[s],this);wy(i)?r.push(async function(){n[s]=await i}()):n[s]=i}),n.blockTag!=null){const s=this._getBlockTag(n.blockTag);wy(s)?r.push(async function(){n.blockTag=await s}()):n.blockTag=s}return r.length?async function(){return await Promise.all(r),n}():n}async getNetwork(){if(T(this,Fr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Fr)===s&&L(this,Fr,null),i}})();return L(this,Fr,s),(await s).clone()}const e=T(this,Fr),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(T(this,lu)?(this.emit("network",r,n),T(this,Fr)===e&&L(this,Fr,Promise.resolve(r))):te(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await _n({_block:de(this,st,$k).call(this,"latest",!1),gasPrice:(async()=>{try{const c=await de(this,st,jr).call(this,{method:"getGasPrice"});return Ce(c,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const c=await de(this,st,jr).call(this,{method:"getPriorityFee"});return Ce(c,"%response")}catch{}return null})()});let a=null,l=null;const u=this._wrapBlock(s,e);return u&&u.baseFeePerGas&&(l=o??BigInt("1000000000"),a=u.baseFeePerGas*xie+l),new uP(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new qn(r.url),i=await r.processFunc(n,this,s);return new uP(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return wy(n)&&(n=await n),Ce(await de(this,st,jr).call(this,{method:"estimateGas",transaction:n}),"%response")}async call(e){const{tx:n,blockTag:r}=await _n({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await de(this,st,zk).call(this,de(this,st,Vk).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return Ce(await de(this,st,Op).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return Qe(await de(this,st,Op).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return Ae(await de(this,st,Op).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const s=Ce(n,"position");return Ae(await de(this,st,Op).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:s}=await _n({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=Vh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(n)}async getBlock(e,n){const{network:r,params:s}=await _n({network:this.getNetwork(),params:de(this,st,$k).call(this,e,!!n)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:n,params:r}=await _n({network:this.getNetwork(),params:de(this,st,jr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await _n({network:this.getNetwork(),params:de(this,st,jr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await de(this,st,jr).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(r,n)}async getTransactionResult(e){const{result:n}=await _n({network:this.getNetwork(),result:de(this,st,jr).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:Ae(n)}async getLogs(e){let n=this._getFilter(e);wy(n)&&(n=await n);const{network:r,params:s}=await _n({network:this.getNetwork(),params:de(this,st,jr).call(this,{method:"getLogs",filter:n})});return s.map(i=>this._wrapLog(i,r))}_getProvider(e){te(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await my.fromName(this,e)}async getAvatar(e){const n=await this.getResolver(e);return n?await n.getAvatar():null}async resolveName(e){const n=await this.getResolver(e);return n?await n.getAddress():null}async lookupAddress(e){e=gt(e);const n=$x(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await my.getEnsAddress(this),i=await new Uc(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(i==null||i===Rh)return null;const a=await new Uc(i,["function name(bytes32) view returns (string)"],this).name(n);return await this.resolveName(a)!==e?null:a}catch(r){if(gn(r,"BAD_DATA")&&r.value==="0x"||gn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,n,r){const s=n??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async u=>{try{const c=await this.getTransactionReceipt(e);if(c!=null&&u-c.blockNumber+1>=s){i(c),a&&(clearTimeout(a),a=null);return}}catch(c){console.log("EEE",c)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(_t("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){te(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=T(this,as).get(e);n&&(n.timer&&clearTimeout(n.timer),T(this,as).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=Tp(this,kp)._++,s=()=>{T(this,as).delete(r),e()};if(this.paused)T(this,as).set(r,{timer:null,func:s,time:n});else{const i=setTimeout(s,n);T(this,as).set(r,{timer:i,func:s,time:h2()})}return r}_forEachSubscriber(e){for(const n of T(this,Bn).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new vy(e.type);case"block":{const n=new bie(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new wie(this,e.type);case"event":return new c2(this,e.filter);case"transaction":return new vie(this,e.hash);case"orphan":return new Aie(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of T(this,Bn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),T(this,Fn)!=null&&n.pause(T(this,Fn));break}}async on(e,n){const r=await de(this,st,db).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async once(e,n){const r=await de(this,st,db).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async emit(e,...n){const r=await de(this,st,Mp).call(this,e,n);if(!r||r.listeners.length===0)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:i,once:o})=>{const a=new W_(this,o?null:i,e);try{i.call(this,...n,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await de(this,st,Mp).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of T(this,Bn).values())n+=r.length;return n}async listeners(e){if(e){const r=await de(this,st,Mp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let n=[];for(const{listeners:r}of T(this,Bn).values())n=n.concat(r.map(({listener:s})=>s));return n}async off(e,n){const r=await de(this,st,Mp).call(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(!n||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:s}=await de(this,st,db).call(this,e);r&&s.stop(),T(this,Bn).delete(n)}else for(const[n,{started:r,subscriber:s}]of T(this,Bn))r&&s.stop(),T(this,Bn).delete(n);return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return this.off(e,n)}get destroyed(){return T(this,Lf)}destroy(){this.removeAllListeners();for(const e of T(this,as).keys())this._clearTimeout(e);L(this,Lf,!0)}get paused(){return T(this,Fn)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(L(this,yo,-1),T(this,Fn)!=null){if(T(this,Fn)==!!e)return;te(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),L(this,Fn,!!e);for(const n of T(this,as).values())n.timer&&clearTimeout(n.timer),n.time=h2()-n.time}resume(){if(T(this,Fn)!=null){this._forEachSubscriber(e=>e.resume()),L(this,Fn,null);for(const e of T(this,as).values()){let n=e.time;n<0&&(n=0),e.time=h2(),setTimeout(e.func,n)}}}}Bn=new WeakMap,Ta=new WeakMap,Fn=new WeakMap,Lf=new WeakMap,Fr=new WeakMap,lu=new WeakMap,Da=new WeakMap,yo=new WeakMap,kp=new WeakMap,as=new WeakMap,Bf=new WeakMap,Ff=new WeakMap,st=new WeakSet,jr=async function(e){const n=T(this,Ff).cacheTimeout;if(n<0)return await this._perform(e);const r=Ay(e.method,e);let s=T(this,Da).get(r);return s||(s=this._perform(e),T(this,Da).set(r,s),setTimeout(()=>{T(this,Da).get(r)===s&&T(this,Da).delete(r)},n)),await s},Vk=async function(e,n,r){te(r<kie,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const s=fy(e);try{return Ae(await this._perform({method:"call",transaction:s,blockTag:n}))}catch(i){if(!this.disableCcipRead&&lx(i)&&i.data&&r>=0&&n==="latest"&&s.to!=null&&Vt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Qn(s.to,this);let l;try{l=Mie(Vt(i.data,4))}catch(f){te(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}te(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const u=await this.ccipReadFetch(s,l.calldata,l.urls);te(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const c={to:a,data:$t([l.selector,Oie([u,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const f=await de(this,st,Vk).call(this,c,n,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:f}),f}}throw i}},zk=async function(e){const{value:n}=await _n({network:this.getNetwork(),value:e});return n},Op=async function(e,n,r){let s=this._getAddress(n),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await de(this,st,zk).call(this,de(this,st,jr).call(this,Object.assign(e,{address:s,blockTag:i})))},$k=async function(e,n){if(St(e,32))return await de(this,st,jr).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await de(this,st,jr).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},Mp=async function(e,n){let r=await d2(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await d2({orphan:"drop-log",log:n[0]},this)),T(this,Bn).get(r.tag)||null},db=async function(e){const n=await d2(e,this),r=n.tag;let s=T(this,Bn).get(r);return s||(s={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Bn).set(r,s)),s};function Sie(t,e){try{const n=p2(t,e);if(n)return Sc(n)}catch{}return null}function p2(t,e){if(t==="0x")return null;try{const n=Qe(Vt(t,e,e+32)),r=Qe(Vt(t,n,n+32));return Vt(t,n+32,n+32+r)}catch{}return null}function MP(t){const e=Wn(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function Tie(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Die=new Uint8Array([]);function Oie(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(Die),n+=32;for(let r=0;r<t.length;r++){const s=ct(t[r]);e[r]=MP(n),e.push(MP(s.length)),e.push(Tie(s)),n+=32+Math.ceil(s.length/32)*32}return $t(e)}const NP="0x0000000000000000000000000000000000000000000000000000000000000000";function Mie(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};te(Ec(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=Vt(t,0,32);te(Vt(n,0,12)===Vt(NP,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Vt(n,12);try{const r=[],s=Qe(Vt(t,32,64)),i=Qe(Vt(t,s,s+32)),o=Vt(t,s+32);for(let a=0;a<i;a++){const l=Sie(o,a*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{te(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=p2(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{te(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}te(Vt(t,100,128)===Vt(NP,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Vt(t,96,100);try{const r=p2(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{te(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function Vc(t,e){if(t.provider)return t.provider;te(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function _P(t,e){let n=fy(e);if(n.to!=null&&(n.to=Qn(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),Qn(r,t)]).then(([s,i])=>($(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else n.from=t.getAddress();return await _n(n)}class Nie{constructor(e){q(this,"provider");Me(this,{provider:e||null})}async getNonce(e){return Vc(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await _P(this,e)}async populateTransaction(e){const n=Vc(this,"populateTransaction"),r=await _P(this,e);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const s=await this.provider.getNetwork();if(r.chainId!=null){const o=Ce(r.chainId);$(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=s.chainId;const i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?$(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&i&&$(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await n.getFeeData();te(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await n.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(te(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):te(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await _n(r)}async estimateGas(e){return Vc(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Vc(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Vc(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=Vc(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=Vh.from(r);return await n.broadcastTransaction(await this.signTransaction(s))}}const RP=new Set;function zc(t){RP.has(t)||(RP.add(t),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${t} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}function _ie(t){return JSON.parse(JSON.stringify(t))}class PP{constructor(e){J(this,Ma);J(this,Yn);J(this,vi);J(this,uu);J(this,Oa);J(this,cu);J(this,jf);L(this,Yn,e),L(this,vi,null),L(this,uu,de(this,Ma,Gk).bind(this)),L(this,Oa,!1),L(this,cu,null),L(this,jf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,n){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,Oa)||(L(this,Oa,!0),de(this,Ma,Gk).call(this,-2))}stop(){T(this,Oa)&&(L(this,Oa,!1),L(this,jf,!0),de(this,Ma,Wk).call(this),T(this,Yn).off("block",T(this,uu)))}pause(e){e&&de(this,Ma,Wk).call(this),T(this,Yn).off("block",T(this,uu))}resume(){this.start()}}Yn=new WeakMap,vi=new WeakMap,uu=new WeakMap,Oa=new WeakMap,cu=new WeakMap,jf=new WeakMap,Ma=new WeakSet,Gk=async function(e){try{T(this,vi)==null&&L(this,vi,this._subscribe(T(this,Yn)));let n=null;try{n=await T(this,vi)}catch(i){if(!gn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(n==null){L(this,vi,null),T(this,Yn)._recoverSubscriber(this,this._recover(T(this,Yn)));return}const r=await T(this,Yn).getNetwork();if(T(this,cu)||L(this,cu,r),T(this,cu).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,jf))return;const s=await T(this,Yn).send("eth_getFilterChanges",[n]);await this._emitResults(T(this,Yn),s)}catch(n){console.log("@TODO",n)}T(this,Yn).once("block",T(this,uu))},Wk=function(){const e=T(this,vi);e&&(L(this,vi,null),e.then(n=>{T(this,Yn).destroyed||T(this,Yn).send("eth_uninstallFilter",[n])}))};class Rie extends PP{constructor(n,r){super(n);J(this,fu);L(this,fu,_ie(r))}_recover(n){return new c2(n,T(this,fu))}async _subscribe(n){return await n.send("eth_newFilter",[T(this,fu)])}async _emitResults(n,r){for(const s of r)n.emit(T(this,fu),n._wrapLog(s,n._network))}}fu=new WeakMap;class Pie extends PP{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const Iie="bigint,boolean,function,number,string,symbol".split(/,/g);function ky(t){if(t==null||Iie.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(ky);if(typeof t=="object")return Object.keys(t).reduce((e,n)=>(e[n]=t[n],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function Lie(t){return new Promise(e=>{setTimeout(e,t)})}function $c(t){return t&&t.toLowerCase()}function IP(t){return t&&typeof t.pollingInterval=="number"}const LP={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class m2 extends Nie{constructor(n,r){super(n);q(this,"address");r=gt(r),Me(this,{address:r})}connect(n){te(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(n){return await this.populateCall(n)}async sendUncheckedTransaction(n){const r=ky(n),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Qn(o,this.provider);$(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&s.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;s.push((async()=>{r.to=await Qn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(n){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(n);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const u=async()=>{try{const c=await this.provider.getTransaction(s);if(c!=null){i(c.replaceableTransaction(r));return}}catch(c){if(gn(c,"CANCELLED")||gn(c,"BAD_DATA")||gn(c,"NETWORK_ERROR")){c.info==null&&(c.info={}),c.info.sendTransactionHash=s,o(c);return}if(gn(c,"INVALID_ARGUMENT")&&(l++,c.info==null&&(c.info={}),c.info.sendTransactionHash=s,l>10)){o(c);return}this.provider.emit("error",_t("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:c}))}this.provider._setTimeout(()=>{u()},a.pop()||4e3)};u()})}async signTransaction(n){const r=ky(n);if(r.from){const i=await Qn(r.from,this.provider);$(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("personal_sign",[Ae(r),this.address.toLowerCase()])}async signTypedData(n,r,s){const i=ky(s),o=await ly.resolveNames(n,r,i,async a=>{const l=await Qn(a);return $(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(ly.getPayload(o.domain,r,o.value))])}async unlock(n){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),n,null])}async _legacySignMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ae(r)])}}class BP extends xy{constructor(n,r){super(n,r);J(this,Ep);J(this,du);J(this,Uf);J(this,bo);J(this,xi);J(this,Rs);J(this,ls);J(this,mr);L(this,Uf,1),L(this,du,Object.assign({},LP,r||{})),L(this,bo,[]),L(this,xi,null),L(this,ls,null),L(this,mr,null);{let i=null;const o=new Promise(a=>{i=a});L(this,Rs,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?($(!s||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&n!=null&&L(this,ls,rn.from(n))):s&&($(n==null||s.matches(n),"staticNetwork MUST match network object","options",r),L(this,ls,s))}_getOption(n){return T(this,du)[n]}get _network(){return te(T(this,ls),"network is not available yet","NETWORK_ERROR"),T(this,ls)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let s=n.transaction;if(s&&s.type!=null&&Ce(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(n=Object.assign({},n,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(n);return r!=null?await this.send(r.method,r.args):super._perform(n)}async _detectNetwork(){const n=this._getOption("staticNetwork");if(n)if(n===!0){if(T(this,ls))return T(this,ls)}else return n;return T(this,mr)?await T(this,mr):this.ready?(L(this,mr,(async()=>{try{const r=rn.from(Ce(await this.send("eth_chainId",[])));return L(this,mr,null),r}catch(r){throw L(this,mr,null),r}})()),await T(this,mr)):(L(this,mr,(async()=>{const r={id:Tp(this,Uf)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],L(this,mr,null)}catch(i){throw L(this,mr,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return rn.from(Ce(s.result));throw this.getRpcError(r,s)})()),await T(this,mr))}_start(){T(this,Rs)==null||T(this,Rs).resolve==null||(T(this,Rs).resolve(),L(this,Rs,null),(async()=>{for(;T(this,ls)==null&&!this.destroyed;)try{L(this,ls,await this._detectNetwork())}catch(n){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",_t("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await Lie(1e3)}de(this,Ep,qk).call(this)})())}async _waitUntilReady(){if(T(this,Rs)!=null)return await T(this,Rs).promise}_getSubscriber(n){return n.type==="pending"?new Pie(this):n.type==="event"?this._getOption("polling")?new c2(this,n.filter):new Rie(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new vy("orphan"):super._getSubscriber(n)}get ready(){return T(this,Rs)==null}getRpcTransaction(n){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(n[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=kl(Ce(n[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{n[s]!=null&&(r[s]=Ae(n[s]))}),n.accessList&&(r.accessList=oa(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(n){switch(n.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[$c(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[$c(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[$c(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[$c(n.address),"0x"+n.position.toString(16),n.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[n.signedTransaction]};case"getBlock":if("blockTag"in n)return{method:"eth_getBlockByNumber",args:[n.blockTag,!!n.includeTransactions]};if("blockHash"in n)return{method:"eth_getBlockByHash",args:[n.blockHash,!!n.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[n.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[n.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(n.transaction),n.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(n.transaction)]};case"getLogs":return n.filter&&n.filter.address!=null&&(Array.isArray(n.filter.address)?n.filter.address=n.filter.address.map($c):n.filter.address=$c(n.filter.address)),{method:"eth_getLogs",args:[n.filter]}}return null}getRpcError(n,r){const{method:s}=n,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return _t("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=g2(i),u=Fc.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",n.params[0],l?l.data:null);return u.info={error:i,payload:n},u}const o=JSON.stringify(Fie(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return _t("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:n,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=n.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return _t("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return _t("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return _t("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return _t("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:l,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?_t("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:i,payload:n}}):_t("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(_t("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const s=Tp(this,Uf)._++,i=new Promise((o,a)=>{T(this,bo).push({resolve:o,reject:a,payload:{method:n,params:r,id:s,jsonrpc:"2.0"}})});return de(this,Ep,qk).call(this),i}async getSigner(n){n==null&&(n=0);const r=this.send("eth_accounts",[]);if(typeof n=="number"){const i=await r;if(n>=i.length)throw new Error("no such account");return new m2(this,i[n])}const{accounts:s}=await _n({network:this.getNetwork(),accounts:r});n=gt(n);for(const i of s)if(gt(i)===n)return new m2(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new m2(this,r))}destroy(){T(this,xi)&&(clearTimeout(T(this,xi)),L(this,xi,null));for(const{payload:n,reject:r}of T(this,bo))r(_t("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));L(this,bo,[]),super.destroy()}}du=new WeakMap,Uf=new WeakMap,bo=new WeakMap,xi=new WeakMap,Rs=new WeakMap,ls=new WeakMap,mr=new WeakMap,Ep=new WeakSet,qk=function(){if(T(this,xi))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");L(this,xi,setTimeout(()=>{L(this,xi,null);const r=T(this,bo);for(L(this,bo,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,du).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,du).batchMaxSize){r.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:u}of s){if(this.destroyed){l(_t("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const c=o.filter(f=>f.id===u.id)[0];if(c==null){const f=_t("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",f),l(f);continue}if("error"in c){l(this.getRpcError(u,c));continue}a(c.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},n))};class Bie extends BP{constructor(n,r){super(n,r);J(this,Na);let s=this._getOption("pollingInterval");s==null&&(s=LP.pollingInterval),L(this,Na,s)}_getSubscriber(n){const r=super._getSubscriber(n);return IP(r)&&(r.pollingInterval=T(this,Na)),r}get pollingInterval(){return T(this,Na)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");L(this,Na,n),this._forEachSubscriber(r=>{IP(r)&&(r.pollingInterval=T(this,Na))})}}Na=new WeakMap;class Ji extends Bie{constructor(n,r,s){n==null&&(n="http://localhost:8545");super(r,s);J(this,Hf);typeof n=="string"?L(this,Hf,new qn(n)):L(this,Hf,n.clone())}_getConnection(){return T(this,Hf).clone()}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){const r=this._getConnection();r.body=JSON.stringify(n),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Hf=new WeakMap;function g2(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&St(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=g2(t[e]);if(n)return n}return null}if(typeof t=="string")try{return g2(JSON.parse(t))}catch{}return null}function y2(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)y2(t[n],e);if(typeof t=="string")try{return y2(JSON.parse(t),e)}catch{}}}function Fie(t){const e=[];return y2(t,e),e}const Ey="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function jie(t){switch(t){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}$(!1,"unsupported network","network",t)}class Cy extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Ey);const i={polling:!0,staticNetwork:s},o=Cy.getRequest(s,r);super(o,s,i);q(this,"apiKey");Me(this,{apiKey:r})}_getProvider(n){try{return new Cy(n,this.apiKey)}catch{}return super._getProvider(n)}static getRequest(n,r){r==null&&(r=Ey);const s=new qn(`https://${jie(n.name)}/${r}`);return s.allowGzip=!0,r===Ey&&(s.retryFunc=async(i,o,a)=>(zc("AnkrProvider"),!0)),s}getRpcError(n,r){return n.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(n,r)}isCommunityResource(){return this.apiKey===Ey}}const Sy="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function Uie(t){switch(t){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}$(!1,"unsupported network","network",t)}class Ty extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Sy);const i=Ty.getRequest(s,r);super(i,s,{staticNetwork:s});q(this,"apiKey");Me(this,{apiKey:r})}_getProvider(n){try{return new Ty(n,this.apiKey)}catch{}return super._getProvider(n)}async _perform(n){if(n.method==="getTransactionResult"){const{trace:r,tx:s}=await _n({trace:this.send("trace_transaction",[n.hash]),tx:this.getTransaction(n.hash)});if(r==null||s==null)return null;let i,o=!1;try{i=r[0].result.output,o=r[0].error==="Reverted"}catch{}if(i)return te(!o,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:i,reason:null,transaction:s,invocation:null,revert:null}),i;te(!1,"could not parse trace result","BAD_DATA",{value:r})}return await super._perform(n)}isCommunityResource(){return this.apiKey===Sy}static getRequest(n,r){r==null&&(r=Sy);const s=new qn(`https://${Uie(n.name)}/v2/${r}`);return s.allowGzip=!0,r===Sy&&(s.retryFunc=async(i,o,a)=>(zc("alchemy"),!0)),s}}function Dy(t){switch(t){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}$(!1,"unsupported network","network",t)}function Hie(t){switch(t){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}$(!1,"unsupported network","network",t)}class Oy extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Dy(s.name));const i=Oy.getRequest(s,r);super(i,s,{staticNetwork:s});q(this,"apiKey");Me(this,{apiKey:r})}_getProvider(n){try{return new Oy(n,this.apiKey)}catch{}return super._getProvider(n)}isCommunityResource(){return this.apiKey===Dy(this._network.name)}static getRequest(n,r){r==null&&(r=Dy(n.name));const s=new qn(`https://${Hie(n.name)}/${r}`);return s.allowGzip=!0,r===Dy(n.name)&&(s.retryFunc=async(i,o,a)=>(zc("ChainstackProvider"),!0)),s}}class Vie extends Ji{constructor(e){e==null&&(e="mainnet");const n=rn.from(e);$(n.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",n,{staticNetwork:n})}}const FP=2e3;function zie(t){return t&&typeof t.then=="function"}const $ie="org.ethers.plugins.provider.Etherscan",Gie=["enableCcipRead"];let Wie=1;class qie extends xy{constructor(n,r){const s=r??null;super();q(this,"network");q(this,"apiKey");J(this,Vf);const i=rn.from(n);L(this,Vf,i.getPlugin($ie)),Me(this,{apiKey:s,network:i}),this.getBaseUrl()}getBaseUrl(){if(T(this,Vf))return T(this,Vf).baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}$(!1,"unsupported network","network",this.network)}getUrl(n,r){const s=Object.keys(r).reduce((o,a)=>{const l=r[a];return l!=null&&(o+=`&${a}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${n}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(n,r){return r.module=n,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(n,r,s){const i=Wie++,o=s?this.getPostUrl():this.getUrl(n,r),a=s?this.getPostData(n,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new qn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&zc("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(Sc(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return n==="proxy"?h&&h.status==0&&h.message=="NOTOK"&&p&&(this.emit("debug",{action:"receiveError",id:i,reason:"proxy-NOTOK",error:h}),d.throwThrottleError(h.result,FP)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,FP)),d},a&&(l.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),l.body=Object.keys(a).map(f=>`${f}=${a[f]}`).join("&"));const u=await l.send();try{u.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),te(!1,"response error","SERVER_ERROR",{request:l,response:u})}u.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),te(!1,"missing response","SERVER_ERROR",{request:l,response:u}));const c=JSON.parse(Sc(u.body));return n==="proxy"?(c.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"invalid JSON-RPC"}),te(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:u,info:{result:c}})),c.error&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"JSON-RPC error"}),te(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):c.status==0&&(c.message==="No records found"||c.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):((c.status!=1||typeof c.message=="string"&&!c.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:c}),te(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result)}_getTransactionPostData(n){const r={};for(let s in n){if(Gie.indexOf(s)>=0||n[s]==null)continue;let i=n[s];if(!(s==="type"&&i===0)&&!(s==="blockTag"&&i==="latest")){if({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[s])i=kl(i);else if(s==="accessList")i="["+oa(i).map(o=>`{address:"${o.address}",storageKeys:["${o.storageKeys.join('","')}"]}`).join(",")+"]";else if(s==="blobVersionedHashes"){if(i.length===0)continue;te(!1,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:n}})}else i=Ae(i);r[s]=i}}return r}_checkError(n,r,s){let i="";if(gn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(n.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&te(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.transaction}),(n.method==="call"||n.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=Fc.getBuiltinCallException(n.method,n.transaction,o);throw a.info={request:n,error:r},a}if(i&&n.method==="broadcastTransaction"){const o=Vh.from(n.signedTransaction);i.match(/replacement/i)&&i.match(/underpriced/i)&&te(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o}),i.match(/insufficient funds/)&&te(!1,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&te(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:o})}throw r}async _detectNetwork(){return this.network}async _perform(n){switch(n.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet")return"1000000000";if(this.network.name==="optimism")return"1000000";throw new Error("fallback onto the AbstractProvider default");case"getBalance":return this.fetch("account",{action:"balance",address:n.address,tag:n.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:n.address,tag:n.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:n.address,tag:n.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:n.address,position:n.position,tag:n.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:n.signedTransaction},!0).catch(r=>this._checkError(n,r,n.signedTransaction));case"getBlock":if("blockTag"in n)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:n.blockTag,boolean:n.includeTransactions?"true":"false"});te(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:n.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:n.hash});case"call":{if(n.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}}return super._perform(n)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(n){let r=this._getAddress(n);zie(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new Uc(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}Vf=new WeakMap;function Kie(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const Qie=Kie().WebSocket;class b2{constructor(e,n){J(this,ki);J(this,Cp);J(this,_a);J(this,hu);J(this,Ra);L(this,ki,e),L(this,Cp,JSON.stringify(n)),L(this,_a,null),L(this,hu,null),L(this,Ra,null)}get filter(){return JSON.parse(T(this,Cp))}start(){L(this,_a,T(this,ki).send("eth_subscribe",this.filter).then(e=>(T(this,ki)._register(e,this),e)))}stop(){T(this,_a).then(e=>{T(this,ki).destroyed||T(this,ki).send("eth_unsubscribe",[e])}),L(this,_a,null)}pause(e){te(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),L(this,hu,!!e)}resume(){L(this,hu,null)}_handleMessage(e){if(T(this,_a)!=null&&T(this,hu)===null){let n=T(this,Ra);n==null?n=this._emit(T(this,ki),e):n=n.then(async()=>{await this._emit(T(this,ki),e)}),L(this,Ra,n.then(()=>{T(this,Ra)===n&&L(this,Ra,null)}))}}async _emit(e,n){throw new Error("sub-classes must implemente this; _emit")}}ki=new WeakMap,Cp=new WeakMap,_a=new WeakMap,hu=new WeakMap,Ra=new WeakMap;class Jie extends b2{constructor(e){super(e,["newHeads"])}async _emit(e,n){e.emit("block",parseInt(n.number))}}class Yie extends b2{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,n){e.emit("pending",n)}}class Xie extends b2{constructor(n,r){super(n,["logs",r]);J(this,Sp);L(this,Sp,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Sp))}async _emit(n,r){n.emit(this.logFilter,n._wrapLog(r,n._network))}}Sp=new WeakMap;class Zie extends BP{constructor(n,r){const s=Object.assign({},r??{});$(s.batchMaxCount==null||s.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",r),s.batchMaxCount=1,s.staticNetwork==null&&(s.staticNetwork=!0);super(n,s);J(this,pu);J(this,zf);J(this,Pa);L(this,pu,new Map),L(this,zf,new Map),L(this,Pa,new Map)}_getSubscriber(n){switch(n.type){case"close":return new vy("close");case"block":return new Jie(this);case"pending":return new Yie(this);case"event":return new Xie(this,n.filter);case"orphan":if(n.filter.orphan==="drop-log")return new vy("drop-log")}return super._getSubscriber(n)}_register(n,r){T(this,zf).set(n,r);const s=T(this,Pa).get(n);if(s){for(const i of s)r._handleMessage(i);T(this,Pa).delete(n)}}async _send(n){$(!Array.isArray(n),"WebSocket does not support batch send","payload",n);const r=new Promise((s,i)=>{T(this,pu).set(n.id,{payload:n,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(n)),[await r]}async _processMessage(n){const r=JSON.parse(n);if(r&&typeof r=="object"&&"id"in r){const s=T(this,pu).get(r.id);if(s==null){this.emit("error",_t("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,pu).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,zf).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,Pa).get(s);o==null&&(o=[],T(this,Pa).set(s,o)),o.push(r.params.result)}}else{this.emit("error",_t("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(n){throw new Error("sub-classes must override this")}}pu=new WeakMap,zf=new WeakMap,Pa=new WeakMap;class jP extends Zie{constructor(n,r,s){super(r,s);J(this,mu);J(this,Ps);typeof n=="string"?(L(this,mu,()=>new Qie(n)),L(this,Ps,T(this,mu).call(this))):typeof n=="function"?(L(this,mu,n),L(this,Ps,n())):(L(this,mu,null),L(this,Ps,n)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(i){console.log("failed to start WebsocketProvider",i)}},this.websocket.onmessage=i=>{this._processMessage(i.data)}}get websocket(){if(T(this,Ps)==null)throw new Error("websocket closed");return T(this,Ps)}async _write(n){this.websocket.send(n)}async destroy(){T(this,Ps)!=null&&(T(this,Ps).close(),L(this,Ps,null)),super.destroy()}}mu=new WeakMap,Ps=new WeakMap;const Qh="84842078b09946638c03157f83405213";function eoe(t){switch(t){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}$(!1,"unsupported network","network",t)}class toe extends jP{constructor(n,r){const s=new Jh(n,r),i=s._getConnection();te(!i.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,s._network);q(this,"projectId");q(this,"projectSecret");Me(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Qh}}class Jh extends Ji{constructor(n,r,s){n==null&&(n="mainnet");const i=rn.from(n);r==null&&(r=Qh),s==null&&(s=null);const o=Jh.getRequest(i,r,s);super(o,i,{staticNetwork:i});q(this,"projectId");q(this,"projectSecret");Me(this,{projectId:r,projectSecret:s})}_getProvider(n){try{return new Jh(n,this.projectId,this.projectSecret)}catch{}return super._getProvider(n)}isCommunityResource(){return this.projectId===Qh}static getWebSocketProvider(n,r){return new toe(n,r)}static getRequest(n,r,s){r==null&&(r=Qh),s==null&&(s=null);const i=new qn(`https://${eoe(n.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Qh&&(i.retryFunc=async(o,a,l)=>(zc("InfuraProvider"),!0)),i}}const My="919b412a057b5e9c9b6dce193c5a60242d6efadb";function noe(t){switch(t){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}$(!1,"unsupported network","network",t)}class Ny extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=My);const i=Ny.getRequest(s,r);super(i,s,{staticNetwork:s});q(this,"token");Me(this,{token:r})}_getProvider(n){try{return new Ny(n,this.token)}catch{}return super._getProvider(n)}isCommunityResource(){return this.token===My}static getRequest(n,r){r==null&&(r=My);const s=new qn(`https://${noe(n.name)}/${r}`);return s.allowGzip=!0,r===My&&(s.retryFunc=async(i,o,a)=>(zc("QuickNodeProvider"),!0)),s}}const roe=BigInt("1"),soe=BigInt("2");function ioe(t){for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}}function ooe(t){return new Promise(e=>{setTimeout(e,t)})}function w2(){return new Date().getTime()}function A2(t){return JSON.stringify(t,(e,n)=>typeof n=="bigint"?{type:"bigint",value:n.toString()}:n)}const UP={stallTimeout:400,priority:1,weight:1},HP={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function aoe(t,e){for(;(t.blockNumber<0||t.blockNumber<e)&&(t._updateNumber||(t._updateNumber=(async()=>{try{const n=await t.provider.getBlockNumber();n>t.blockNumber&&(t.blockNumber=n)}catch(n){t.blockNumber=-2,t._lastFatalError=n,t._lastFatalErrorTimestamp=w2()}t._updateNumber=null})()),await t._updateNumber,t.outOfSync++,!t._lastFatalError););}function Yh(t){if(t==null)return"null";if(Array.isArray(t))return"["+t.map(Yh).join(",")+"]";if(typeof t=="object"&&typeof t.toJSON=="function")return Yh(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":case"number":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{"+e.map(n=>`${JSON.stringify(n)}:${Yh(t[n])}`).join(",")+"}"}}throw console.log("Could not serialize",t),new Error("Hmm...")}function v2(t){if("error"in t){const n=t.error;return{tag:Yh(n),value:n}}const e=t.result;return{tag:Yh(e),value:e}}function _y(t,e){const n=new Map;for(const{value:s,tag:i,weight:o}of e){const a=n.get(i)||{value:s,weight:0};a.weight+=o,n.set(i,a)}let r=null;for(const s of n.values())s.weight>=t&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function x2(t,e){let n=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:u}of e)if(a instanceof Error){const c=r.get(l)||{value:a,weight:0};c.weight+=u,r.set(l,c),(s==null||c.weight>s.weight)&&(s=c)}else i.push(BigInt(a)),n+=u;if(n<t)return s&&s.weight>=t?s.value:void 0;i.sort((a,l)=>a<l?-1:l>a?1:0);const o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o]+roe)/soe}function k2(t,e){const n=_y(t,e);if(n!==void 0)return n;for(const r of e)if(r.value)return r.value}function loe(t,e){if(t===1)return Qe(x2(t,e),"%internal");const n=new Map,r=(o,a)=>{const l=n.get(o)||{result:o,weight:0};l.weight+=a,n.set(o,l)};for(const{weight:o,value:a}of e){const l=Qe(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of n.values())o>=t&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class uoe extends xy{constructor(n,r,s){super(r,s);J(this,yr);q(this,"quorum");q(this,"eventQuorum");q(this,"eventWorkers");J(this,gr);J(this,wo);J(this,$f);L(this,gr,n.map(i=>i instanceof xy?Object.assign({provider:i},UP,HP):Object.assign({},UP,i,HP))),L(this,wo,-2),L(this,$f,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,gr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,$(this.quorum<=T(this,gr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,gr).map(n=>{const r=Object.assign({},n);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return rn.from(Ce(await this._perform({method:"chainId"})))}async _translatePerform(n,r){switch(r.method){case"broadcastTransaction":return await n.broadcastTransaction(r.signedTransaction);case"call":return await n.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await n.getNetwork()).chainId;case"estimateGas":return await n.estimateGas(r.transaction);case"getBalance":return await n.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await n.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await n.getBlockNumber();case"getCode":return await n.getCode(r.address,r.blockTag);case"getGasPrice":return(await n.getFeeData()).gasPrice;case"getPriorityFee":return(await n.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await n.getLogs(r.filter);case"getStorage":return await n.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await n.getTransaction(r.hash);case"getTransactionCount":return await n.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await n.getTransactionReceipt(r.hash);case"getTransactionResult":return await n.getTransactionResult(r.hash)}}async _perform(n){if(n.method==="broadcastTransaction"){const o=T(this,gr).map(u=>null),a=T(this,gr).map(async({provider:u,weight:c},f)=>{try{const d=await u._perform(n);o[f]=Object.assign(v2({result:d}),{weight:c})}catch(d){o[f]=Object.assign(v2({error:d}),{weight:c})}});for(;;){const u=o.filter(d=>d!=null);for(const{value:d}of u)if(!(d instanceof Error))return d;const c=_y(this.quorum,o.filter(d=>d!=null));if(gn(c,"INSUFFICIENT_FUNDS"))throw c;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=k2(this.quorum,o);if(te(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:n,results:o.map(A2)}}),l instanceof Error)throw l;return l}await de(this,yr,PL).call(this);const r=new Set;let s=0;for(;;){const o=de(this,yr,Kk).call(this,r,n);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await de(this,yr,Qk).call(this,r,n);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:n}of T(this,gr))n.destroy();super.destroy()}}gr=new WeakMap,wo=new WeakMap,$f=new WeakMap,yr=new WeakSet,RL=function(n){const r=Array.from(n).map(i=>i.config),s=T(this,gr).slice();ioe(s),s.sort((i,o)=>i.priority-o.priority);for(const i of s)if(!i._lastFatalError&&r.indexOf(i)===-1)return i;return null},Kk=function(n,r){const s=de(this,yr,RL).call(this,n);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=w2();return i.perform=(async()=>{try{s.requests++;const l=await this._translatePerform(s.provider,r);i.result={result:l}}catch(l){s.errorResponses++,i.result={error:l}}const a=w2()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await ooe(s.stallTimeout),i.staller=null})(),n.add(i),i},PL=async function(){let n=T(this,$f);if(!n){const r=[];T(this,gr).forEach(s=>{r.push((async()=>{await aoe(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),L(this,$f,n=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,gr)){if(i._lastFatalError)continue;const o=i._network;s==null?s=o.chainId:o.chainId!==s&&te(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await n},IL=async function(n,r){const s=[];for(const i of n)if(i.result!=null){const{tag:o,value:a}=v2(i.result);s.push({tag:o,value:a,weight:i.config.weight})}if(!(s.reduce((i,o)=>i+o.weight,0)<this.quorum)){switch(r.method){case"getBlockNumber":{T(this,wo)===-2&&L(this,wo,Math.ceil(Qe(x2(this.quorum,T(this,gr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Qe(o.blockNumber).toString(),weight:o.weight}))))));const i=loe(this.quorum,s);return i===void 0?void 0:(i>T(this,wo)&&L(this,wo,i),T(this,wo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return x2(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?k2(this.quorum,s):_y(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return _y(this.quorum,s);case"broadcastTransaction":return k2(this.quorum,s)}te(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${A2(r.method)})`})}},Qk=async function(n,r){if(n.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of n){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await de(this,yr,IL).call(this,n,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)de(this,yr,Kk).call(this,n,r);return te(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(n).map(a=>A2(a.result))}}),await Promise.race(s),await de(this,yr,Qk).call(this,n,r)};function coe(t){return t&&typeof t.send=="function"&&typeof t.close=="function"}const foe="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function doe(t,e){e==null&&(e={});const n=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof t=="string"&&t.match(/^https?:/))return new Ji(t);if(typeof t=="string"&&t.match(/^wss?:/)||coe(t))return new jP(t);let r=null;try{r=rn.from(t)}catch{}const s=[];if(n("publicPolygon")&&r&&(r.name==="matic"?s.push(new Ji("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Ji("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),n("alchemy"))try{s.push(new Ty(t,e.alchemy))}catch{}if(n("ankr")&&e.ankr!=null)try{s.push(new Cy(t,e.ankr))}catch{}if(n("chainstack"))try{s.push(new Oy(t,e.chainstack))}catch{}if(n("cloudflare"))try{s.push(new Vie(t))}catch{}if(n("etherscan"))try{s.push(new qie(t,e.etherscan))}catch{}if(n("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new Jh(t,o,a))}catch{}if(n("quicknode"))try{let o=e.quicknode;s.push(new Ny(t,o))}catch{}if(te(s.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"}),s.length===1)return s[0];let i=Math.floor(s.length/2);return i>2&&(i=2),r&&foe.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new uoe(s,void 0,{quorum:i})}const hoe=async(t,e)=>{const n={name:t,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!ure(t))return n;try{const r=await poe(t,e);r&&(n.name=r,n.isEns=!0)}catch(r){console.log(r)}return n},poe=async(t,e)=>await moe(e).lookupAddress(t),moe=t=>doe(t),goe=(t,e,n)=>{if((t==null?void 0:t.length)>n){const r=t.substring(0,e),s=t.substring((t==null?void 0:t.length)-e);return`${r}...${s}`}return t};function yoe(t){var e;const{char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=t,a=v7(n),l=new RegExp(`\\s${a}$`),u=i?"^":"",c=r?new RegExp(`${u}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${u}(?:^)?${a}[^\\s${a}]*`,"gm"),f=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!f)return null;const d=o.pos-f.length,h=Array.from(f.matchAll(c)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(p);if(s!==null&&!m)return null;const g=d+h.index;let b=g+h[0].length;return r&&l.test(f.slice(b-1,b+1))&&(h[0]+=" ",b+=1),g<o.pos&&b>=o.pos?{range:{from:g,to:b},query:h[0].slice(n.length),text:h[0]}:null}const boe=new Mt("suggestion");function woe({pluginKey:t=boe,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:u=()=>[],render:c=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=yoe}){let h;const p=c==null?void 0:c(),m=new bt({key:t,view(){return{update:async(g,b)=>{var v,A,w,x,k,C,D;const O=(v=this.key)===null||v===void 0?void 0:v.getState(b),N=(A=this.key)===null||A===void 0?void 0:A.getState(g.state),R=O.active&&N.active&&O.range.from!==N.range.from,B=!O.active&&N.active,F=O.active&&!N.active,G=!B&&!F&&O.query!==N.query,I=B||R,U=G&&!R,W=F||R;if(!I&&!U&&!W)return;const ee=W&&!I?O:N,Z=g.dom.querySelector(`[data-decoration-id="${ee.decorationId}"]`);h={editor:e,range:ee.range,query:ee.query,text:ee.text,items:[],command:ue=>l({editor:e,range:ee.range,props:ue}),decorationNode:Z,clientRect:Z?()=>{var ue;const{decorationId:xe}=(ue=this.key)===null||ue===void 0?void 0:ue.getState(e.state),Se=g.dom.querySelector(`[data-decoration-id="${xe}"]`);return(Se==null?void 0:Se.getBoundingClientRect())||null}:null},I&&((w=p==null?void 0:p.onBeforeStart)===null||w===void 0||w.call(p,h)),U&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),(U||I)&&(h.items=await u({editor:e,query:ee.query})),W&&((k=p==null?void 0:p.onExit)===null||k===void 0||k.call(p,h)),U&&((C=p==null?void 0:p.onUpdate)===null||C===void 0||C.call(p,h)),I&&((D=p==null?void 0:p.onStart)===null||D===void 0||D.call(p,h))},destroy:()=>{var g;h&&((g=p==null?void 0:p.onExit)===null||g===void 0||g.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,b,v,A){const{isEditable:w}=e,{composing:x}=e.view,{selection:k}=g,{empty:C,from:D}=k,O={...b};if(O.composing=x,w&&(C||e.view.composing)){(D<b.range.from||D>b.range.to)&&!x&&!b.composing&&(O.active=!1);const N=d({char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:k.$from}),R=`id_${Math.floor(Math.random()*4294967295)}`;N&&f({editor:e,state:A,range:N.range})?(O.active=!0,O.decorationId=b.decorationId?b.decorationId:R,O.range=N.range,O.query=N.query,O.text=N.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(g,b){var v;const{active:A,range:w}=m.getState(g.state);return A&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:g,event:b,range:w}))||!1},decorations(g){const{active:b,range:v,decorationId:A}=m.getState(g);return b?kt.create(g.doc,[nn.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":A})]):null}}});return m}var Aoe=typeof tr=="object"&&tr&&tr.Object===Object&&tr,voe=typeof self=="object"&&self&&self.Object===Object&&self;Aoe||voe||Function("return this")();var VP=typeof window<"u"?_.useLayoutEffect:_.useEffect;function xoe(t,e,n,r){const s=_.useRef(e);VP(()=>{s.current=e},[e]),_.useEffect(()=>{const i=window;if(!(i&&i.addEventListener))return;const o=a=>{s.current(a)};return i.addEventListener(t,o,r),()=>{i.removeEventListener(t,o,r)}},[t,n,r])}var koe=typeof window>"u";function E2(t,{defaultValue:e=!1,initializeWithValue:n=!0}={}){const r=a=>koe?e:window.matchMedia(a).matches,[s,i]=_.useState(()=>n?r(t):e);function o(){i(r(t))}return VP(()=>{const a=window.matchMedia(t);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[t]),s}function Eoe(t,e,n="mousedown",r={}){xoe(n,s=>{const i=s.target;if(!i||!i.isConnected)return;(Array.isArray(t)?t.filter(a=>!!a.current).every(a=>a.current&&!a.current.contains(i)):t.current&&!t.current.contains(i))&&e(s)},void 0,r)}const Coe=wt.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[woe({editor:this.editor,...this.options.suggestion})]}}),Soe=({query:t,uploadToIpfs:e})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:S.jsx(RT,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:S.jsx(_T,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:S.jsx(A0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:S.jsx(v0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:S.jsx(x0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:S.jsx(k0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:S.jsx(Uu,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:S.jsx(SU,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:S.jsx(E0,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:S.jsx(Md,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:S.jsx(K1,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).insertTable({rows:3,cols:2,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:S.jsx(kU,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).run();const s=document.createElement("input");s.type="file",s.accept="image/*",s.onchange=async()=>{var i;if((i=s.files)!=null&&i.length){const o=s.files[0],a=n.view.state.selection.from;X1(o,n.view,a,e)}},s.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:S.jsx(IT,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:S.jsx(PT,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:S.jsx(OT,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(2).focus(n.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:S.jsx(wU,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(3).focus(n.state.selection.head-1).run()}}].filter(n=>{if(typeof t=="string"&&t.length>0){const r=t.toLowerCase();return n.title.toLowerCase().includes(r)||n.description.toLowerCase().includes(r)||n.searchTerms&&n.searchTerms.some(s=>s.includes(r))}return!0}),Toe=(t,e)=>{const n=t.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<t.scrollTop?t.scrollTop-=t.scrollTop-s+5:i>n+t.scrollTop&&(t.scrollTop+=i-n-t.scrollTop+5)},Doe=({items:t,command:e,editor:n})=>{const[r,s]=_.useState(0),[i,o]=_.useState(t),a=E2("(max-width: 640px)"),l=_.useCallback(c=>{const f=i[c];f&&(f.title==="Continue writing"||e(f))},[e,n,i]);_.useEffect(()=>{if(a){const c=t.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(c)}else o(t)},[t,a]),_.useEffect(()=>{const c=["ArrowUp","ArrowDown","Enter"],f=d=>{if(c.includes(d.key))return d.preventDefault(),d.key==="ArrowUp"?(s((r+i.length-1)%i.length),!0):d.key==="ArrowDown"?(s((r+1)%i.length),!0):d.key==="Enter"?(l(r),!0):!1};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[i,r,s,l]),_.useEffect(()=>{s(0)},[i]);const u=_.useRef(null);return _.useLayoutEffect(()=>{const c=u==null?void 0:u.current,f=c==null?void 0:c.children[r];f&&c&&Toe(c,f)},[r]),i.length>0?S.jsx("div",{id:"slash-command",ref:u,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:i.map((c,f)=>S.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${f===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>l(f),children:[S.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:c.icon}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:c.title}),S.jsx("p",{className:"text-xs text-neutral-500",children:c.description})]})]},f))}):null},Ooe=()=>{let t=null,e=null;return{onStart:n=>{t=new ST(Doe,{props:n,editor:n.editor}),e=Xa("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:n=>{t==null||t.updateProps(n),e&&e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown:n=>{var r;return n.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=t==null?void 0:t.ref)==null?void 0:r.onKeyDown(n)},onExit:()=>{e==null||e[0].destroy(),t==null||t.destroy()}}},Moe=t=>{const e=({query:n})=>Soe({query:n,uploadToIpfs:t});return Coe.configure({suggestion:{items:e,render:Ooe}})},zP=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],Noe=({isPreviewMode:t,initialContent:e,enableCollaboration:n,collaborationId:r,walletAddress:s,username:i,onChange:o,onCollaboratorChange:a,onCommentInteraction:l,onTextSelection:u,ensResolutionUrl:c,handleImageUploadToIpfs:f})=>{var F,G;const[d]=_.useState(new ul),[h,p]=_.useState(!1),[m,g]=_.useState([...gte,Moe(f)]),b=_.useRef(!1),v=(I,U,W)=>{let ee=!1;return I.doc.nodesBetween(U,W,Z=>{Z.marks&&Z.marks.some(ue=>ue.type.name==="highlight"&&ue.attrs.color==="yellow")&&(ee=!0)}),ee},A=(I,U)=>{var ee;const W=U.target;if(W&&W.nodeName==="MARK"&&W.dataset.color&&((ee=W==null?void 0:W.dataset)==null?void 0:ee.color)==="yellow"){const Z=W.textContent,ue=I.posAtCoords({left:U.clientX,top:U.clientY});if(ue){const{state:xe}=I;let Se=ue.pos,ke=ue.pos;if(xe.doc.nodesBetween(Se,ke,(me,Ne)=>{me.marks&&me.marks.length&&me.marks.forEach(je=>{je.type.name==="highlight"&&(Se=Ne,ke=Ne+me.nodeSize)})}),Se!==ke){const me={text:Z,from:Se,to:ke,isHighlightedYellow:v(xe,Se,ke)};l==null||l(me)}}}},w=(I,U,W)=>{A(I,W)},x=(I,U)=>{const W=U.split(`
|
|
483
|
+
`?s.slice(0,-1):s};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const pte=wt.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new bt({key:new Mt("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return jp.fromSchema(this.editor.schema).parseSlice(ox(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),mte=wt.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=m7.Commands.config.addCommands();return{setContent:(e,n,r)=>s=>t.setContent(s.editor.storage.markdown.parser.parse(e),n,r)(s),insertContentAt:(e,n,r)=>s=>t.insertContentAt(e,s.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(s)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new hte(this.editor,this.options),serializer:new dte(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[Iee.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),pte.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),gte=[nK,eK.configure({strike:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bold:{HTMLAttributes:{class:"select-text pointer-events-auto"}},italic:{HTMLAttributes:{class:"select-text pointer-events-auto"}},heading:{HTMLAttributes:{class:"select-text pointer-events-auto"}},paragraph:{HTMLAttributes:{class:"select-text pointer-events-auto"}},orderedList:{HTMLAttributes:{class:"flex flex-col items-start list-decimal list-outside space-y-4 ml-6"}},blockquote:{HTMLAttributes:{class:"rounded-lg bg-[#E8EBEC] p-5 font-serif italic text-black"}},codeBlock:{HTMLAttributes:{class:"rounded-lg bg-transparent border border-[#DDE2E4] p-5 font-mono font-medium text-black"},exitOnArrowDown:!0},code:{HTMLAttributes:{class:"rounded bg-transparent p-1.5 font-mono font-medium text-black text-sm",spellcheck:"false"}},history:!1,gapcursor:!1,dropcursor:!1,document:!1,horizontalRule:!1}),QM,rK.configure({types:["heading","paragraph"]}),IK,SK.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0}),TK.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),MK.configure({multicolor:!0}),PK.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),tK,FK,NK.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),RK.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),jM.configure({HTMLAttributes:{class:"space-y-4 !ml-6"}}),HM.configure({width:3,color:"#d1d5db"}),VM,yJ,PY,RY,..._Y,qK.configure({uploadFn:HU}),BK,jK,zK,LY,LK,mte.configure({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!0,breaks:!0,transformPastedText:!0,transformCopiedText:!1})],yte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",bte="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",wte=t=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.classList.add("collaboration-cursor__label"),n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null),e.insertBefore(n,null),e},Ate=t=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.classList.add("custom-cursor__label-container"),n.setAttribute("style",`border: 1px solid ${t.color}`);const r=document.createElement("img");r.src=yte,r.classList.add("custom-cursor__icon");const s=document.createElement("div");s.classList.add("custom-cursor__label");const i=document.createElement("span");i.classList.add("custom-cursor__text"),i.textContent=t.name;const o=document.createElement("img");return o.src=bte,o.classList.add("custom-cursor__badge"),s.appendChild(i),n.appendChild(r),n.appendChild(s),n.appendChild(o),e.appendChild(n),e},vte=t=>t.isEns?Ate(t):wte(t),xte="6.13.1";function kte(t,e,n){const r=e.split("|").map(i=>i.trim());for(let i=0;i<r.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof t===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${n}`,s.value=t,s}async function _n(t){const e=Object.keys(t);return(await Promise.all(e.map(r=>Promise.resolve(t[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Me(t,e,n){for(let r in e){let s=e[r];const i=n?n[r]:null;i&&kte(s,i,r),Object.defineProperty(t,r,{enumerable:!0,value:s,writable:!1})}}function kc(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(kc).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let n="0x";for(let r=0;r<t.length;r++)n+=e[t[r]>>4],n+=e[t[r]&15];return n}if(typeof t=="object"&&typeof t.toJSON=="function")return kc(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(n=>`${kc(n)}: ${kc(t[n])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function gn(t,e){return t&&t.code===e}function lx(t){return gn(t,"CALL_EXCEPTION")}function _t(t,e,n){let r=t;{const i=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${kc(n)}`);for(const o in n){if(o==="shortMessage")continue;const a=n[o];i.push(o+"="+kc(a))}}i.push(`code=${e}`),i.push(`version=${xte}`),i.length&&(t+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(t);break;default:s=new Error(t)}return Me(s,{code:e}),n&&Object.assign(s,n),s.shortMessage==null&&Me(s,{shortMessage:r}),s}function te(t,e,n,r){if(!t)throw _t(e,n,r)}function $(t,e,n,r){te(t,e,"INVALID_ARGUMENT",{argument:n,value:r})}function F_(t,e,n){n==null&&(n=""),n&&(n=": "+n),te(t>=e,"missing arguemnt"+n,"MISSING_ARGUMENT",{count:t,expectedCount:e}),te(t<=e,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function jg(t,e,n){if(n==null&&(n=""),t!==e){let r=n,s="new";n&&(r+=".",s+=" "+n),te(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function j_(t,e,n){if(t instanceof Uint8Array)return n?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((t.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(t.substring(s,s+2),16),s+=2;return r}$(!1,"invalid BytesLike value",e||"value",t)}function ct(t,e){return j_(t,e,!1)}function Gn(t,e){return j_(t,e,!0)}function St(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&t.length!==2+2*e||e===!0&&t.length%2!==0)}function ux(t){return St(t,!0)||t instanceof Uint8Array}const U_="0123456789abcdef";function Ae(t){const e=ct(t);let n="0x";for(let r=0;r<e.length;r++){const s=e[r];n+=U_[(s&240)>>4]+U_[s&15]}return n}function $t(t){return"0x"+t.map(e=>Ae(e).substring(2)).join("")}function Ec(t){return St(t,!0)?(t.length-2)/2:ct(t).length}function Vt(t,e,n){const r=ct(t);return n!=null&&n>r.length&&te(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:n}),Ae(r.slice(e??0,n??r.length))}function H_(t,e,n){const r=ct(t);te(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),n?s.set(r,e-r.length):s.set(r,0),Ae(s)}function xl(t,e){return H_(t,e,!0)}function Ete(t,e){return H_(t,e,!1)}const Ug=BigInt(0),Es=BigInt(1),Cc=9007199254740991;function Cte(t,e){const n=Hg(t,"value"),r=BigInt(Qe(e,"width"));if(te(n>>r===Ug,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),n>>r-Es){const s=(Es<<r)-Es;return-((~n&s)+Es)}return n}function V_(t,e){let n=Ce(t,"value");const r=BigInt(Qe(e,"width")),s=Es<<r-Es;if(n<Ug){n=-n,te(n<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});const i=(Es<<r)-Es;return(~n&i)+Es}else te(n<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:t});return n}function Dh(t,e){const n=Hg(t,"value"),r=BigInt(Qe(e,"bits"));return n&(Es<<r)-Es}function Ce(t,e){switch(typeof t){case"bigint":return t;case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Cc&&t<=Cc,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(n){$(!1,`invalid BigNumberish string: ${n.message}`,e||"value",t)}}$(!1,"invalid BigNumberish value",e||"value",t)}function Hg(t,e){const n=Ce(t,e);return te(n>=Ug,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),n}const z_="0123456789abcdef";function cx(t){if(t instanceof Uint8Array){let e="0x0";for(const n of t)e+=z_[n>>4],e+=z_[n&15];return BigInt(e)}return Ce(t)}function Qe(t,e){switch(typeof t){case"bigint":return $(t>=-Cc&&t<=Cc,"overflow",e||"value",t),Number(t);case"number":return $(Number.isInteger(t),"underflow",e||"value",t),$(t>=-Cc&&t<=Cc,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return Qe(BigInt(t),e)}catch(n){$(!1,`invalid numeric string: ${n.message}`,e||"value",t)}}$(!1,"invalid numeric value",e||"value",t)}function Ste(t){return Qe(cx(t))}function Zo(t,e){let r=Hg(t,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Qe(e,"width");for(te(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});r.length<s*2;)r="0"+r}return"0x"+r}function Wn(t){const e=Hg(t,"value");if(e===Ug)return new Uint8Array([]);let n=e.toString(16);n.length%2&&(n="0"+n);const r=new Uint8Array(n.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(n.substring(i,i+2),16)}return r}function kl(t){let e=Ae(ux(t)?t:Wn(t)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const $_="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const G_=BigInt(58);function Tte(t){const e=ct(t);let n=cx(e),r="";for(;n;)r=$_[Number(n%G_)]+r,n/=G_;for(let s=0;s<e.length&&!e[s];s++)r=$_[0]+r;return r}function Dte(t){t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return ct(e)}function Ote(t){const e=ct(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}class W_{constructor(e,n,r){q(this,"filter");q(this,"emitter");J(this,Zc);L(this,Zc,n),Me(this,{emitter:e,filter:r})}async removeListener(){T(this,Zc)!=null&&await this.emitter.off(this.filter,T(this,Zc))}}Zc=new WeakMap;function Mte(t,e,n,r,s){$(!1,`invalid codepoint at offset ${e}; ${t}`,"bytes",n)}function q_(t,e,n,r,s){if(t==="BAD_PREFIX"||t==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<n.length&&n[o]>>6===2;o++)i++;return i}return t==="OVERRUN"?n.length-e-1:0}function Nte(t,e,n,r,s){return t==="OVERLONG"?($(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),q_(t,e,n))}const _te=Object.freeze({error:Mte,ignore:q_,replace:Nte});function Rte(t,e){e==null&&(e=_te.error);const n=ct(t,"bytes"),r=[];let s=0;for(;s<n.length;){const i=n[s++];if(!(i>>7)){r.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,n,r):s+=e("BAD_PREFIX",s-1,n,r);continue}if(s-1+o>=n.length){s+=e("OVERRUN",s-1,n,r);continue}let l=i&(1<<8-o-1)-1;for(let u=0;u<o;u++){let c=n[s];if((c&192)!=128){s+=e("MISSING_CONTINUE",s,n,r),l=null;break}l=l<<6|c&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,n,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,n,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,n,r,l);continue}r.push(l)}}return r}function Vi(t,e){$(typeof t=="string","invalid string value","str",t);let n=[];for(let r=0;r<t.length;r++){const s=t.charCodeAt(r);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){r++;const i=t.charCodeAt(r);$(r<t.length&&(i&64512)===56320,"invalid surrogate pair","str",t);const o=65536+((s&1023)<<10)+(i&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 new Uint8Array(n)}function Pte(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Sc(t,e){return Pte(Rte(t,e))}function K_(t){async function e(n,r){te(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=n.url.split(":")[0].toLowerCase();te(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),te(s==="https"||!n.credentials||n.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=_t("request timeout","TIMEOUT"),o.abort()},n.timeout);r&&r.addListener(()=>{i=_t("request cancelled","CANCELLED"),o.abort()});const l={method:n.method,headers:new Headers(Array.from(n)),body:n.body||void 0,signal:o.signal};let u;try{u=await fetch(n.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const c={};u.headers.forEach((h,p)=>{c[p.toLowerCase()]=h});const f=await u.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:u.status,statusMessage:u.statusText,headers:c,body:d}}return e}const Ite=12,Lte=250;let Q_=K_();const Bte=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Fte=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let fx=!1;async function J_(t,e){try{const n=t.match(Bte);if(!n)throw new Error("invalid data");return new ea(200,"OK",{"content-type":n[1]||"text/plain"},n[2]?Dte(n[3]):Ute(n[3]))}catch{return new ea(599,"BAD REQUEST (invalid data: URI)",{},null,new qn(t))}}function Y_(t){async function e(n,r){try{const s=n.match(Fte);if(!s)throw new Error("invalid link");return new qn(`${t}${s[2]}`)}catch{return new ea(599,"BAD REQUEST (invalid IPFS URI)",{},null,new qn(n))}}return e}const Vg={data:J_,ipfs:Y_("https://gateway.ipfs.io/ipfs/")},X_=new WeakMap;class jte{constructor(e){J(this,$l);J(this,pa);L(this,$l,[]),L(this,pa,!1),X_.set(e,()=>{if(!T(this,pa)){L(this,pa,!0);for(const n of T(this,$l))setTimeout(()=>{n()},0);L(this,$l,[])}})}addListener(e){te(!T(this,pa),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,$l).push(e)}get cancelled(){return T(this,pa)}checkSignal(){te(!this.cancelled,"cancelled","CANCELLED",{})}}$l=new WeakMap,pa=new WeakMap;function zg(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}const Zy=class Zy{constructor(e){J(this,Kl);J(this,ef);J(this,tf);J(this,Os);J(this,so);J(this,nf);J(this,rf);J(this,wn);J(this,Ir);J(this,io);J(this,Gl);J(this,Wl);J(this,ql);J(this,pi);J(this,Ms);J(this,ma);L(this,rf,String(e)),L(this,ef,!1),L(this,tf,!0),L(this,Os,{}),L(this,so,""),L(this,nf,3e5),L(this,Ms,{slotInterval:Lte,maxAttempts:Ite}),L(this,ma,null)}get url(){return T(this,rf)}set url(e){L(this,rf,String(e))}get body(){return T(this,wn)==null?null:new Uint8Array(T(this,wn))}set body(e){if(e==null)L(this,wn,void 0),L(this,Ir,void 0);else if(typeof e=="string")L(this,wn,Vi(e)),L(this,Ir,"text/plain");else if(e instanceof Uint8Array)L(this,wn,e),L(this,Ir,"application/octet-stream");else if(typeof e=="object")L(this,wn,Vi(JSON.stringify(e))),L(this,Ir,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,wn)!=null}get method(){return T(this,so)?T(this,so):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),L(this,so,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,Os));return T(this,io)&&(e.authorization=`Basic ${Ote(Vi(T(this,io)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Ir)&&(e["content-type"]=T(this,Ir)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,n){T(this,Os)[String(e).toLowerCase()]=String(n)}clearHeaders(){L(this,Os,{})}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,io)||null}setCredentials(e,n){$(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),L(this,io,`${e}:${n}`)}get allowGzip(){return T(this,tf)}set allowGzip(e){L(this,tf,!!e)}get allowInsecureAuthentication(){return!!T(this,ef)}set allowInsecureAuthentication(e){L(this,ef,!!e)}get timeout(){return T(this,nf)}set timeout(e){$(e>=0,"timeout must be non-zero","timeout",e),L(this,nf,e)}get preflightFunc(){return T(this,Gl)||null}set preflightFunc(e){L(this,Gl,e)}get processFunc(){return T(this,Wl)||null}set processFunc(e){L(this,Wl,e)}get retryFunc(){return T(this,ql)||null}set retryFunc(e){L(this,ql,e)}get getUrlFunc(){return T(this,ma)||Q_}set getUrlFunc(e){L(this,ma,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,wn)?Ae(T(this,wn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,Ms).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,Ms).maxAttempts=e.maxAttempts)}send(){return te(T(this,pi)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),L(this,pi,new jte(this)),de(this,Kl,Dp).call(this,0,Z_()+this.timeout,0,this,new ea(0,"",{},null,this))}cancel(){te(T(this,pi)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=X_.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const n=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();te(this.method==="GET"&&(n!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new Zy(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,L(s,Os,Object.assign({},T(this,Os))),T(this,wn)&&L(s,wn,new Uint8Array(T(this,wn))),L(s,Ir,T(this,Ir)),s}clone(){const e=new Zy(this.url);return L(e,so,T(this,so)),T(this,wn)&&L(e,wn,T(this,wn)),L(e,Ir,T(this,Ir)),L(e,Os,Object.assign({},T(this,Os))),L(e,io,T(this,io)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),L(e,Gl,T(this,Gl)),L(e,Wl,T(this,Wl)),L(e,ql,T(this,ql)),L(e,Ms,Object.assign({},T(this,Ms))),L(e,ma,T(this,ma)),e}static lockConfig(){fx=!0}static getGateway(e){return Vg[e.toLowerCase()]||null}static registerGateway(e,n){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(fx)throw new Error("gateways locked");Vg[e]=n}static registerGetUrl(e){if(fx)throw new Error("gateways locked");Q_=e}static createGetUrlFunc(e){return K_()}static createDataGateway(){return J_}static createIpfsGatewayFunc(e){return Y_(e)}};ef=new WeakMap,tf=new WeakMap,Os=new WeakMap,so=new WeakMap,nf=new WeakMap,rf=new WeakMap,wn=new WeakMap,Ir=new WeakMap,io=new WeakMap,Gl=new WeakMap,Wl=new WeakMap,ql=new WeakMap,pi=new WeakMap,Ms=new WeakMap,ma=new WeakMap,Kl=new WeakSet,Dp=async function(e,n,r,s,i){var c,f,d;if(e>=T(this,Ms).maxAttempts)return i.makeServerError("exceeded maximum retry limit");te(Z_()<=n,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await Hte(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Vg){const h=await Vg[a](o.url,zg(T(s,pi)));if(h instanceof ea){let p=h;if(this.processFunc){zg(T(s,pi));try{p=await this.processFunc(o,p)}catch(m){(m.throttle==null||typeof m.stall!="number")&&p.makeServerError("error in post-processing function",m).assertOk()}}return p}o=h}this.preflightFunc&&(o=await this.preflightFunc(o));const l=await this.getUrlFunc(o,zg(T(s,pi)));let u=new ea(l.statusCode,l.statusMessage,l.headers,l.body,s);if(u.statusCode===301||u.statusCode===302){try{const h=u.headers.location||"";return de(c=o.redirect(h),Kl,Dp).call(c,e+1,n,0,s,u)}catch{}return u}else if(u.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,u,e))){const h=u.headers["retry-after"];let p=T(this,Ms).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),de(f=o.clone(),Kl,Dp).call(f,e+1,n,p,s,u)}if(this.processFunc){zg(T(s,pi));try{u=await this.processFunc(o,u)}catch(h){(h.throttle==null||typeof h.stall!="number")&&u.makeServerError("error in post-processing function",h).assertOk();let p=T(this,Ms).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),de(d=o.clone(),Kl,Dp).call(d,e+1,n,p,s,u)}}return u};let qn=Zy;const Mk=class Mk{constructor(e,n,r,s,i){J(this,dp);J(this,hp);J(this,pp);J(this,Lr);J(this,sf);J(this,Ql);L(this,dp,e),L(this,hp,n),L(this,pp,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),L(this,Lr,s==null?null:new Uint8Array(s)),L(this,sf,i||null),L(this,Ql,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Lr)?Ae(T(this,Lr)):"null"}>`}get statusCode(){return T(this,dp)}get statusMessage(){return T(this,hp)}get headers(){return Object.assign({},T(this,pp))}get body(){return T(this,Lr)==null?null:new Uint8Array(T(this,Lr))}get bodyText(){try{return T(this,Lr)==null?"":Sc(T(this,Lr))}catch{te(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{te(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,n=Object.keys(e);let r=0;return{next:()=>{if(r<n.length){const s=n[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,n){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new Mk(599,r,this.headers,this.body,T(this,sf)||void 0);return L(s,Ql,{message:e,error:n}),s}throwThrottleError(e,n){n==null?n=-1:$(Number.isInteger(n)&&n>=0,"invalid stall timeout","stall",n);const r=new Error(e||"throttling requests");throw Me(r,{stall:n,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Lr)!=null}get request(){return T(this,sf)}ok(){return T(this,Ql).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:n}=T(this,Ql);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Lr)&&(s=Sc(T(this,Lr)))}catch{}te(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:n,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};dp=new WeakMap,hp=new WeakMap,pp=new WeakMap,Lr=new WeakMap,sf=new WeakMap,Ql=new WeakMap;let ea=Mk;function Z_(){return new Date().getTime()}function Ute(t){return Vi(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,n)=>String.fromCharCode(parseInt(n,16))))}function Hte(t){return new Promise(e=>setTimeout(e,t))}function Vte(t){let e=t.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function e4(t,e,n){let r=0;for(let s=0;s<n;s++)r=r*256+t[e+s];return r}function t4(t,e,n,r){const s=[];for(;n<e+1+r;){const i=n4(t,n);s.push(i.result),n+=i.consumed,te(n<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:t,length:r,offset:e})}return{consumed:1+r,result:s}}function n4(t,e){te(t.length!==0,"data too short","BUFFER_OVERRUN",{buffer:t,length:0,offset:1});const n=r=>{te(r<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:r})};if(t[e]>=248){const r=t[e]-247;n(e+1+r);const s=e4(t,e+1,r);return n(e+1+r+s),t4(t,e,e+1+r,r+s)}else if(t[e]>=192){const r=t[e]-192;return n(e+1+r),t4(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;n(e+1+r);const s=e4(t,e+1,r);n(e+1+r+s);const i=Ae(t.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(t[e]>=128){const r=t[e]-128;n(e+1+r);const s=Ae(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:Vte(t[e])}}function $g(t){const e=ct(t,"data"),n=n4(e,0);return $(n.consumed===e.length,"unexpected junk after rlp payload","data",t),n.result}function r4(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function s4(t){if(Array.isArray(t)){let r=[];if(t.forEach(function(i){r=r.concat(s4(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=r4(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=r4(e.length);return n.unshift(183+n.length),n.concat(e)}const i4="0123456789abcdef";function El(t){let e="0x";for(const n of s4(t))e+=i4[n>>4],e+=i4[n&15];return e}const Kn=32,dx=new Uint8Array(Kn),zte=["then"],Gg={},o4=new WeakMap;function Cl(t){return o4.get(t)}function a4(t,e){o4.set(t,e)}function Oh(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw n.error=e,n}function hx(t,e,n){return t.indexOf(null)>=0?e.map((r,s)=>r instanceof Tc?hx(Cl(r),r,n):r):t.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(n&&o instanceof Tc&&(o=hx(Cl(o),o,n)),r[s]=o),r},{})}const af=class af extends Array{constructor(...n){const r=n[0];let s=n[1],i=(n[2]||[]).slice(),o=!0;r!==Gg&&(s=n,i=[],o=!1);super(s.length);J(this,of);s.forEach((u,c)=>{this[c]=u});const a=i.reduce((u,c)=>(typeof c=="string"&&u.set(c,(u.get(c)||0)+1),u),new Map);if(a4(this,Object.freeze(s.map((u,c)=>{const f=i[c];return f!=null&&a.get(f)===1?f:null}))),L(this,of,[]),T(this,of)==null&&T(this,of),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(u,c,f)=>{if(typeof c=="string"){if(c.match(/^[0-9]+$/)){const h=Qe(c,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=u[h];return p instanceof Error&&Oh(`index ${h}`,p),p}if(zte.indexOf(c)>=0)return Reflect.get(u,c,f);const d=u[c];if(d instanceof Function)return function(...h){return d.apply(this===f?u:this,h)};if(!(c in u))return u.getValue.apply(this===f?u:this,[c])}return Reflect.get(u,c,f)}});return a4(l,Cl(this)),l}toArray(n){const r=[];return this.forEach((s,i)=>{s instanceof Error&&Oh(`index ${i}`,s),n&&s instanceof af&&(s=s.toArray(n)),r.push(s)}),r}toObject(n){const r=Cl(this);return r.reduce((s,i,o)=>(te(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),hx(r,this,n)),{})}slice(n,r){n==null&&(n=0),n<0&&(n+=this.length,n<0&&(n=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=Cl(this),i=[],o=[];for(let a=n;a<r;a++)i.push(this[a]),o.push(s[a]);return new af(Gg,i,o)}filter(n,r){const s=Cl(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&Oh(`index ${a}`,l),n.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new af(Gg,i,o)}map(n,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&Oh(`index ${i}`,o),s.push(n.call(r,o,i,this))}return s}getValue(n){const r=Cl(this).indexOf(n);if(r===-1)return;const s=this[r];return s instanceof Error&&Oh(`property ${JSON.stringify(n)}`,s.error),s}static fromItems(n,r){return new af(Gg,n,r)}};of=new WeakMap;let Tc=af;function l4(t){let e=Wn(t);return te(e.length<=Kn,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:Kn,offset:e.length}),e.length!==Kn&&(e=Gn($t([dx.slice(e.length%Kn),e]))),e}class zi{constructor(e,n,r,s){q(this,"name");q(this,"type");q(this,"localName");q(this,"dynamic");Me(this,{name:e,type:n,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,n){$(!1,e,this.localName,n)}}class px{constructor(){J(this,lf);J(this,oo);J(this,Jl);L(this,oo,[]),L(this,Jl,0)}get data(){return $t(T(this,oo))}get length(){return T(this,Jl)}appendWriter(e){return de(this,lf,ob).call(this,Gn(e.data))}writeBytes(e){let n=Gn(e);const r=n.length%Kn;return r&&(n=Gn($t([n,dx.slice(r)]))),de(this,lf,ob).call(this,n)}writeValue(e){return de(this,lf,ob).call(this,l4(e))}writeUpdatableValue(){const e=T(this,oo).length;return T(this,oo).push(dx),L(this,Jl,T(this,Jl)+Kn),n=>{T(this,oo)[e]=l4(n)}}}oo=new WeakMap,Jl=new WeakMap,lf=new WeakSet,ob=function(e){return T(this,oo).push(e),L(this,Jl,T(this,Jl)+e.length),e.length};const Nk=class Nk{constructor(e,n,r){J(this,Zl);q(this,"allowLoose");J(this,pr);J(this,Br);J(this,Yl);J(this,Xl);J(this,ga);Me(this,{allowLoose:!!n}),L(this,pr,Gn(e)),L(this,Yl,0),L(this,Xl,null),L(this,ga,r??1024),L(this,Br,0)}get data(){return Ae(T(this,pr))}get dataLength(){return T(this,pr).length}get consumed(){return T(this,Br)}get bytes(){return new Uint8Array(T(this,pr))}subReader(e){const n=new Nk(T(this,pr).slice(T(this,Br)+e),this.allowLoose,T(this,ga));return L(n,Xl,this),n}readBytes(e,n){let r=de(this,Zl,OL).call(this,0,e,!!n);return de(this,Zl,Uk).call(this,e),L(this,Br,T(this,Br)+r.length),r.slice(0,e)}readValue(){return cx(this.readBytes(Kn))}readIndex(){return Ste(this.readBytes(Kn))}};pr=new WeakMap,Br=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,ga=new WeakMap,Zl=new WeakSet,Uk=function(e){var n;if(T(this,Xl))return de(n=T(this,Xl),Zl,Uk).call(n,e);L(this,Yl,T(this,Yl)+e),te(T(this,ga)<1||T(this,Yl)<=T(this,ga)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ga)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),offset:T(this,Br),length:e,info:{bytesRead:T(this,Yl),dataLength:this.dataLength}})},OL=function(e,n,r){let s=Math.ceil(n/Kn)*Kn;return T(this,Br)+s>T(this,pr).length&&(this.allowLoose&&r&&T(this,Br)+n<=T(this,pr).length?s=n:te(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Gn(T(this,pr)),length:T(this,pr).length,offset:T(this,Br)+s})),T(this,pr).slice(T(this,Br),T(this,Br)+s)};let mx=Nk;function Wg(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function gx(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function $te(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Wg(t.outputLen),Wg(t.blockLen)}function Dc(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 u4(t,e){gx(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const yx=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const c4=t=>t instanceof Uint8Array,Gte=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),bx=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ci=(t,e)=>t<<32-e|t>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function Wte(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function qg(t){if(typeof t=="string"&&(t=Wte(t)),!c4(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function qte(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!c4(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}class wx{clone(){return this._cloneInto()}}function Ax(t){const e=r=>t().update(qg(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Kte(t=32){if(yx&&typeof yx.getRandomValues=="function")return yx.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}class f4 extends wx{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,$te(e);const r=qg(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,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Dc(this),this.iHash.update(e),this}digestInto(e){Dc(this),gx(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:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const d4=(t,e,n)=>new f4(t,e).update(n).digest();d4.create=(t,e)=>new f4(t,e);function Qte(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),l=r?4:0,u=r?0:4;t.setUint32(e+l,o,r),t.setUint32(e+u,a,r)}class h4 extends wx{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=bx(this.buffer)}update(e){Dc(this);const{view:n,buffer:r,blockLen:s}=this;e=qg(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const l=bx(e);for(;s<=i-o;o+=s)this.process(l,o);continue}r.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){Dc(this),u4(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)n[f]=0;Qte(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=bx(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,c[f],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%n&&e.buffer.set(r),e}}const Jte=(t,e,n)=>t&e^~t&n,Yte=(t,e,n)=>t&e^t&n^e&n,Xte=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ta=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),na=new Uint32Array(64);class Zte extends h4{constructor(){super(64,32,8,!1),this.A=ta[0]|0,this.B=ta[1]|0,this.C=ta[2]|0,this.D=ta[3]|0,this.E=ta[4]|0,this.F=ta[5]|0,this.G=ta[6]|0,this.H=ta[7]|0}get(){const{A:e,B:n,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,n,r,s,i,o,a,l]}set(e,n,r,s,i,o,a,l){this.A=e|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,n){for(let f=0;f<16;f++,n+=4)na[f]=e.getUint32(n,!1);for(let f=16;f<64;f++){const d=na[f-15],h=na[f-2],p=ci(d,7)^ci(d,18)^d>>>3,m=ci(h,17)^ci(h,19)^h>>>10;na[f]=m+na[f-7]+p+na[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:u,H:c}=this;for(let f=0;f<64;f++){const d=ci(a,6)^ci(a,11)^ci(a,25),h=c+d+Jte(a,l,u)+Xte[f]+na[f]|0,m=(ci(r,2)^ci(r,13)^ci(r,22))+Yte(r,s,i)|0;c=u,u=l,l=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,s,i,o,a,l,u,c)}roundClean(){na.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const p4=Ax(()=>new Zte),Kg=BigInt(2**32-1),vx=BigInt(32);function m4(t,e=!1){return e?{h:Number(t&Kg),l:Number(t>>vx&Kg)}:{h:Number(t>>vx&Kg)|0,l:Number(t&Kg)|0}}function g4(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=m4(t[s],e);[n[s],r[s]]=[i,o]}return[n,r]}const ene=(t,e)=>BigInt(t>>>0)<<vx|BigInt(e>>>0),tne=(t,e,n)=>t>>>n,nne=(t,e,n)=>t<<32-n|e>>>n,rne=(t,e,n)=>t>>>n|e<<32-n,sne=(t,e,n)=>t<<32-n|e>>>n,ine=(t,e,n)=>t<<64-n|e>>>n-32,one=(t,e,n)=>t>>>n-32|e<<64-n,ane=(t,e)=>e,lne=(t,e)=>t,y4=(t,e,n)=>t<<n|e>>>32-n,b4=(t,e,n)=>e<<n|t>>>32-n,w4=(t,e,n)=>e<<n-32|t>>>64-n,A4=(t,e,n)=>t<<n-32|e>>>64-n;function une(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:s|0}}const et={fromBig:m4,split:g4,toBig:ene,shrSH:tne,shrSL:nne,rotrSH:rne,rotrSL:sne,rotrBH:ine,rotrBL:one,rotr32H:ane,rotr32L:lne,rotlSH:y4,rotlSL:b4,rotlBH:w4,rotlBL:A4,add:une,add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,add5H:(t,e,n,r,s,i)=>e+n+r+s+i+(t/2**32|0)|0,add5L:(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0)},[cne,fne]=et.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),ra=new Uint32Array(80),sa=new Uint32Array(80);class dne extends h4{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:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:u,El:c,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:g}=this;return[e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g]}set(e,n,r,s,i,o,a,l,u,c,f,d,h,p,m,g){this.Ah=e|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=u|0,this.El=c|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=g|0}process(e,n){for(let A=0;A<16;A++,n+=4)ra[A]=e.getUint32(n),sa[A]=e.getUint32(n+=4);for(let A=16;A<80;A++){const w=ra[A-15]|0,x=sa[A-15]|0,k=et.rotrSH(w,x,1)^et.rotrSH(w,x,8)^et.shrSH(w,x,7),C=et.rotrSL(w,x,1)^et.rotrSL(w,x,8)^et.shrSL(w,x,7),D=ra[A-2]|0,O=sa[A-2]|0,N=et.rotrSH(D,O,19)^et.rotrBH(D,O,61)^et.shrSH(D,O,6),R=et.rotrSL(D,O,19)^et.rotrBL(D,O,61)^et.shrSL(D,O,6),B=et.add4L(C,R,sa[A-7],sa[A-16]),F=et.add4H(B,k,N,ra[A-7],ra[A-16]);ra[A]=F|0,sa[A]=B|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:u,Dl:c,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:g,Hh:b,Hl:v}=this;for(let A=0;A<80;A++){const w=et.rotrSH(f,d,14)^et.rotrSH(f,d,18)^et.rotrBH(f,d,41),x=et.rotrSL(f,d,14)^et.rotrSL(f,d,18)^et.rotrBL(f,d,41),k=f&h^~f&m,C=d&p^~d&g,D=et.add5L(v,x,C,fne[A],sa[A]),O=et.add5H(D,b,w,k,cne[A],ra[A]),N=D|0,R=et.rotrSH(r,s,28)^et.rotrBH(r,s,34)^et.rotrBH(r,s,39),B=et.rotrSL(r,s,28)^et.rotrBL(r,s,34)^et.rotrBL(r,s,39),F=r&i^r&a^i&a,G=s&o^s&l^o&l;b=m|0,v=g|0,m=h|0,g=p|0,h=f|0,p=d|0,{h:f,l:d}=et.add(u|0,c|0,O|0,N|0),u=a|0,c=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const I=et.add3L(N,B,G);r=et.add3H(I,O,R,F),s=I|0}({h:r,l:s}=et.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=et.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l}=et.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:u,l:c}=et.add(this.Dh|0,this.Dl|0,u|0,c|0),{h:f,l:d}=et.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=et.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:g}=et.add(this.Gh|0,this.Gl|0,m|0,g|0),{h:b,l:v}=et.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(r,s,i,o,a,l,u,c,f,d,h,p,m,g,b,v)}roundClean(){ra.fill(0),sa.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 hne=Ax(()=>new dne);function pne(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const v4=pne();v4.crypto||v4.msCrypto;function mne(t){switch(t){case"sha256":return p4.create();case"sha512":return hne.create()}$(!1,"invalid hashing algorithm name","algorithm",t)}const[x4,k4,E4]=[[],[],[]],gne=BigInt(0),Mh=BigInt(1),yne=BigInt(2),bne=BigInt(7),wne=BigInt(256),Ane=BigInt(113);for(let t=0,e=Mh,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],x4.push(2*(5*r+n)),k4.push((t+1)*(t+2)/2%64);let s=gne;for(let i=0;i<7;i++)e=(e<<Mh^(e>>bne)*Ane)%wne,e&yne&&(s^=Mh<<(Mh<<BigInt(i))-Mh);E4.push(s)}const[vne,xne]=g4(E4,!0),C4=(t,e,n)=>n>32?w4(t,e,n):y4(t,e,n),S4=(t,e,n)=>n>32?A4(t,e,n):b4(t,e,n);function kne(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){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,l=(o+2)%10,u=n[l],c=n[l+1],f=C4(u,c,1)^n[a],d=S4(u,c,1)^n[a+1];for(let h=0;h<50;h+=10)t[o+h]^=f,t[o+h+1]^=d}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=k4[o],l=C4(s,i,a),u=S4(s,i,a),c=x4[o];s=t[c],i=t[c+1],t[c]=l,t[c+1]=u}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]^=vne[r],t[1]^=xne[r]}n.fill(0)}class xx extends wx{constructor(e,n,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Wg(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Gte(this.state)}keccak(){kne(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Dc(this);const{blockLen:n,state:r}=this;e=qg(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,n&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Dc(this,!1),gx(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-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 Wg(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(u4(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new xx(n,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Ene=((t,e,n)=>Ax(()=>new xx(e,t,n)))(1,136,256/8);let T4=!1;const D4=function(t){return Ene(t)};let O4=D4;function en(t){const e=ct(t,"data");return Ae(O4(e))}en._=D4,en.lock=function(){T4=!0},en.register=function(t){if(T4)throw new TypeError("keccak256 is locked");O4=t},Object.freeze(en);const M4=function(t){return mne("sha256").update(t).digest()};let N4=M4,_4=!1;function Oc(t){const e=ct(t,"data");return Ae(N4(e))}Oc._=M4,Oc.lock=function(){_4=!0},Oc.register=function(t){if(_4)throw new Error("sha256 is locked");N4=t},Object.freeze(Oc),Object.freeze(Oc);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const R4=BigInt(0),Qg=BigInt(1),Cne=BigInt(2),Jg=t=>t instanceof Uint8Array,Sne=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Mc(t){if(!Jg(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=Sne[t[n]];return e}function P4(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function kx(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function Nc(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const s=r*2,i=t.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function Sl(t){return kx(Mc(t))}function Ex(t){if(!Jg(t))throw new Error("Uint8Array expected");return kx(Mc(Uint8Array.from(t).reverse()))}function _c(t,e){return Nc(t.toString(16).padStart(e*2,"0"))}function Cx(t,e){return _c(t,e).reverse()}function Tne(t){return Nc(P4(t))}function Cs(t,e,n){let r;if(typeof e=="string")try{r=Nc(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(Jg(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(`${t} expected ${n} bytes, got ${s}`);return r}function Nh(...t){const e=new Uint8Array(t.reduce((r,s)=>r+s.length,0));let n=0;return t.forEach(r=>{if(!Jg(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function Dne(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function One(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Mne(t){let e;for(e=0;t>R4;t>>=Qg,e+=1);return e}function Nne(t,e){return t>>BigInt(e)&Qg}const _ne=(t,e,n)=>t|(n?Qg:R4)<<BigInt(e),Sx=t=>(Cne<<BigInt(t-1))-Qg,Tx=t=>new Uint8Array(t),I4=t=>Uint8Array.from(t);function L4(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 r=Tx(t),s=Tx(t),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>n(s,r,...f),l=(f=Tx())=>{s=a(I4([0]),f),r=a(),f.length!==0&&(s=a(I4([1]),f),r=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<e;){r=a();const h=r.slice();d.push(h),f+=r.length}return Nh(...d)};return(f,d)=>{o(),l(f);let h;for(;!(h=d(u()));)l();return o(),h}}const Rne={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function _h(t,e,n={}){const r=(s,i,o)=>{const a=Rne[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=t[s];if(!(o&&l===void 0)&&!a(l,t))throw new Error(`Invalid param ${String(s)}=${l} (${typeof l}), expected ${i}`)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return t}const Pne=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Nne,bitLen:Mne,bitMask:Sx,bitSet:_ne,bytesToHex:Mc,bytesToNumberBE:Sl,bytesToNumberLE:Ex,concatBytes:Nh,createHmacDrbg:L4,ensureBytes:Cs,equalBytes:Dne,hexToBytes:Nc,hexToNumber:kx,numberToBytesBE:_c,numberToBytesLE:Cx,numberToHexUnpadded:P4,numberToVarBytesBE:Tne,utf8ToBytes:One,validateObject:_h},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const yn=BigInt(0),Gt=BigInt(1),Tl=BigInt(2),Ine=BigInt(3),Dx=BigInt(4),B4=BigInt(5),F4=BigInt(8);BigInt(9),BigInt(16);function fr(t,e){const n=t%e;return n>=yn?n:e+n}function Lne(t,e,n){if(n<=yn||e<yn)throw new Error("Expected power/modulo > 0");if(n===Gt)return yn;let r=Gt;for(;e>yn;)e&Gt&&(r=r*t%n),t=t*t%n,e>>=Gt;return r}function Xr(t,e,n){let r=t;for(;e-- >yn;)r*=r,r%=n;return r}function Ox(t,e){if(t===yn||e<=yn)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=fr(t,e),r=e,s=yn,i=Gt;for(;n!==yn;){const a=r/n,l=r%n,u=s-i*a;r=n,n=l,s=i,i=u}if(r!==Gt)throw new Error("invert: does not exist");return fr(s,e)}function Bne(t){const e=(t-Gt)/Tl;let n,r,s;for(n=t-Gt,r=0;n%Tl===yn;n/=Tl,r++);for(s=Tl;s<t&&Lne(s,e,t)!==t-Gt;s++);if(r===1){const o=(t+Gt)/Dx;return function(l,u){const c=l.pow(u,o);if(!l.eql(l.sqr(c),u))throw new Error("Cannot find square root");return c}}const i=(n+Gt)/Tl;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,c=a.pow(a.mul(a.ONE,s),n),f=a.pow(l,i),d=a.pow(l,n);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<u&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(c,Gt<<BigInt(u-h-1));c=a.sqr(p),f=a.mul(f,p),d=a.mul(d,c),u=h}return f}}function Fne(t){if(t%Dx===Ine){const e=(t+Gt)/Dx;return function(r,s){const i=r.pow(s,e);if(!r.eql(r.sqr(i),s))throw new Error("Cannot find square root");return i}}if(t%F4===B4){const e=(t-B4)/F4;return function(r,s){const i=r.mul(s,Tl),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,Tl),o),u=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),s))throw new Error("Cannot find square root");return u}}return Bne(t)}const jne=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Une(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=jne.reduce((r,s)=>(r[s]="function",r),e);return _h(t,n)}function Hne(t,e,n){if(n<yn)throw new Error("Expected power > 0");if(n===yn)return t.ONE;if(n===Gt)return e;let r=t.ONE,s=e;for(;n>yn;)n&Gt&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Gt;return r}function Vne(t,e){const n=new Array(e.length),r=e.reduce((i,o,a)=>t.is0(o)?i:(n[a]=i,t.mul(i,o)),t.ONE),s=t.inv(r);return e.reduceRight((i,o,a)=>t.is0(o)?i:(n[a]=t.mul(i,n[a]),t.mul(i,o)),s),n}function j4(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function zne(t,e,n=!1,r={}){if(t<=yn)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:s,nByteLength:i}=j4(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Fne(t),a=Object.freeze({ORDER:t,BITS:s,BYTES:i,MASK:Sx(s),ZERO:yn,ONE:Gt,create:l=>fr(l,t),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return yn<=l&&l<t},is0:l=>l===yn,isOdd:l=>(l&Gt)===Gt,neg:l=>fr(-l,t),eql:(l,u)=>l===u,sqr:l=>fr(l*l,t),add:(l,u)=>fr(l+u,t),sub:(l,u)=>fr(l-u,t),mul:(l,u)=>fr(l*u,t),pow:(l,u)=>Hne(a,l,u),div:(l,u)=>fr(l*Ox(u,t),t),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Ox(l,t),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>Vne(a,l),cmov:(l,u,c)=>c?u:l,toBytes:l=>n?Cx(l,i):_c(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return n?Ex(l):Sl(l)}});return Object.freeze(a)}function U4(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 H4(t){const e=U4(t);return e+Math.ceil(e/2)}function $ne(t,e,n=!1){const r=t.length,s=U4(e),i=H4(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=n?Sl(t):Ex(t),a=fr(o,e-Gt)+Gt;return n?Cx(a,s):_c(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Gne=BigInt(0),Mx=BigInt(1);function Wne(t,e){const n=(s,i)=>{const o=i.negate();return s?o:i},r=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:n,unsafeLadder(s,i){let o=t.ZERO,a=s;for(;i>Gne;)i&Mx&&(o=o.add(a)),a=a.double(),i>>=Mx;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let u=s,c=u;for(let f=0;f<o;f++){c=u,l.push(c);for(let d=1;d<a;d++)c=c.add(u),l.push(c);u=c.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let u=t.ZERO,c=t.BASE;const f=BigInt(2**s-1),d=2**s,h=BigInt(s);for(let p=0;p<a;p++){const m=p*l;let g=Number(o&f);o>>=h,g>l&&(g-=d,o+=Mx);const b=m,v=m+Math.abs(g)-1,A=p%2!==0,w=g<0;g===0?c=c.add(n(A,i[b])):u=u.add(n(w,i[v]))}return{p:u,f:c}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let u=i.get(s);return u||(u=this.precomputeWindow(s,l),l!==1&&i.set(s,a(u))),this.wNAF(l,u,o)}}}function V4(t){return Une(t.Fp),_h(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...j4(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qne(t){const e=V4(t);_h(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Kne,hexToBytes:Qne}=Pne,Dl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=Dl;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Kne(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=Dl,n=typeof t=="string"?Qne(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=Dl._parseInt(n.subarray(2)),{d:o,l:a}=Dl._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(t){const e=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const c=u.toString(16);return c.length&1?`0${c}`:c},r=e(n(t.s)),s=e(n(t.r)),i=r.length/2,o=s.length/2,a=n(i),l=n(o);return`30${n(o+i+4)}02${l}${s}02${a}${r}`}},$i=BigInt(0),Zr=BigInt(1);BigInt(2);const z4=BigInt(3);BigInt(4);function Jne(t){const e=qne(t),{Fp:n}=e,r=e.toBytes||((p,m,g)=>{const b=m.toAffine();return Nh(Uint8Array.from([4]),n.toBytes(b.x),n.toBytes(b.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),g=n.fromBytes(m.subarray(0,n.BYTES)),b=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:g,y:b}});function i(p){const{a:m,b:g}=e,b=n.sqr(p),v=n.mul(b,p);return n.add(n.add(v,n.mul(p,m)),g)}if(!n.eql(n.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&$i<p&&p<e.n}function a(p){if(!o(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(p){const{allowedPrivateKeyLengths:m,nByteLength:g,wrapPrivateKey:b,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=Mc(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(g*2,"0")}let A;try{A=typeof p=="bigint"?p:Sl(Cs("private key",p,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof p}`)}return b&&(A=fr(A,v)),a(A),A}const u=new Map;function c(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,g,b){if(this.px=m,this.py=g,this.pz=b,m==null||!n.isValid(m))throw new Error("x required");if(g==null||!n.isValid(g))throw new Error("y required");if(b==null||!n.isValid(b))throw new Error("z required")}static fromAffine(m){const{x:g,y:b}=m||{};if(!m||!n.isValid(g)||!n.isValid(b))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=A=>n.eql(A,n.ZERO);return v(g)&&v(b)?f.ZERO:new f(g,b,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const g=n.invertBatch(m.map(b=>b.pz));return m.map((b,v)=>b.toAffine(g[v])).map(f.fromAffine)}static fromHex(m){const g=f.fromAffine(s(Cs("pointHex",m)));return g.assertValidity(),g}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,u.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y:g}=this.toAffine();if(!n.isValid(m)||!n.isValid(g))throw new Error("bad point: x or y not FE");const b=n.sqr(g),v=i(m);if(!n.eql(b,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){c(m);const{px:g,py:b,pz:v}=this,{px:A,py:w,pz:x}=m,k=n.eql(n.mul(g,x),n.mul(A,v)),C=n.eql(n.mul(b,x),n.mul(w,v));return k&&C}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:g}=e,b=n.mul(g,z4),{px:v,py:A,pz:w}=this;let x=n.ZERO,k=n.ZERO,C=n.ZERO,D=n.mul(v,v),O=n.mul(A,A),N=n.mul(w,w),R=n.mul(v,A);return R=n.add(R,R),C=n.mul(v,w),C=n.add(C,C),x=n.mul(m,C),k=n.mul(b,N),k=n.add(x,k),x=n.sub(O,k),k=n.add(O,k),k=n.mul(x,k),x=n.mul(R,x),C=n.mul(b,C),N=n.mul(m,N),R=n.sub(D,N),R=n.mul(m,R),R=n.add(R,C),C=n.add(D,D),D=n.add(C,D),D=n.add(D,N),D=n.mul(D,R),k=n.add(k,D),N=n.mul(A,w),N=n.add(N,N),D=n.mul(N,R),x=n.sub(x,D),C=n.mul(N,O),C=n.add(C,C),C=n.add(C,C),new f(x,k,C)}add(m){c(m);const{px:g,py:b,pz:v}=this,{px:A,py:w,pz:x}=m;let k=n.ZERO,C=n.ZERO,D=n.ZERO;const O=e.a,N=n.mul(e.b,z4);let R=n.mul(g,A),B=n.mul(b,w),F=n.mul(v,x),G=n.add(g,b),I=n.add(A,w);G=n.mul(G,I),I=n.add(R,B),G=n.sub(G,I),I=n.add(g,v);let U=n.add(A,x);return I=n.mul(I,U),U=n.add(R,F),I=n.sub(I,U),U=n.add(b,v),k=n.add(w,x),U=n.mul(U,k),k=n.add(B,F),U=n.sub(U,k),D=n.mul(O,I),k=n.mul(N,F),D=n.add(k,D),k=n.sub(B,D),D=n.add(B,D),C=n.mul(k,D),B=n.add(R,R),B=n.add(B,R),F=n.mul(O,F),I=n.mul(N,I),B=n.add(B,F),F=n.sub(R,F),F=n.mul(O,F),I=n.add(I,F),R=n.mul(B,I),C=n.add(C,R),R=n.mul(U,I),k=n.mul(G,k),k=n.sub(k,R),R=n.mul(G,B),D=n.mul(U,D),D=n.add(D,R),new f(k,C,D)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,u,m,g=>{const b=n.invertBatch(g.map(v=>v.pz));return g.map((v,A)=>v.toAffine(b[A])).map(f.fromAffine)})}multiplyUnsafe(m){const g=f.ZERO;if(m===$i)return g;if(a(m),m===Zr)return this;const{endo:b}=e;if(!b)return h.unsafeLadder(this,m);let{k1neg:v,k1:A,k2neg:w,k2:x}=b.splitScalar(m),k=g,C=g,D=this;for(;A>$i||x>$i;)A&Zr&&(k=k.add(D)),x&Zr&&(C=C.add(D)),D=D.double(),A>>=Zr,x>>=Zr;return v&&(k=k.negate()),w&&(C=C.negate()),C=new f(n.mul(C.px,b.beta),C.py,C.pz),k.add(C)}multiply(m){a(m);let g=m,b,v;const{endo:A}=e;if(A){const{k1neg:w,k1:x,k2neg:k,k2:C}=A.splitScalar(g);let{p:D,f:O}=this.wNAF(x),{p:N,f:R}=this.wNAF(C);D=h.constTimeNegate(w,D),N=h.constTimeNegate(k,N),N=new f(n.mul(N.px,A.beta),N.py,N.pz),b=D.add(N),v=O.add(R)}else{const{p:w,f:x}=this.wNAF(g);b=w,v=x}return f.normalizeZ([b,v])[0]}multiplyAndAddUnsafe(m,g,b){const v=f.BASE,A=(x,k)=>k===$i||k===Zr||!x.equals(v)?x.multiplyUnsafe(k):x.multiply(k),w=A(this,g).add(A(m,b));return w.is0()?void 0:w}toAffine(m){const{px:g,py:b,pz:v}=this,A=this.is0();m==null&&(m=A?n.ONE:n.inv(v));const w=n.mul(g,m),x=n.mul(b,m),k=n.mul(v,m);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(k,n.ONE))throw new Error("invZ was invalid");return{x:w,y:x}}isTorsionFree(){const{h:m,isTorsionFree:g}=e;if(m===Zr)return!0;if(g)return g(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:g}=e;return m===Zr?this:g?g(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return Mc(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const d=e.nBitLength,h=Wne(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function Yne(t){const e=V4(t);return _h(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Xne(t){const e=Yne(t),{Fp:n,n:r}=e,s=n.BYTES+1,i=2*n.BYTES+1;function o(I){return $i<I&&I<n.ORDER}function a(I){return fr(I,r)}function l(I){return Ox(I,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:f,isWithinCurveOrder:d}=Jne({...e,toBytes(I,U,W){const ee=U.toAffine(),Z=n.toBytes(ee.x),ue=Nh;return W?ue(Uint8Array.from([U.hasEvenY()?2:3]),Z):ue(Uint8Array.from([4]),Z,n.toBytes(ee.y))},fromBytes(I){const U=I.length,W=I[0],ee=I.subarray(1);if(U===s&&(W===2||W===3)){const Z=Sl(ee);if(!o(Z))throw new Error("Point is not on curve");const ue=f(Z);let xe=n.sqrt(ue);const Se=(xe&Zr)===Zr;return(W&1)===1!==Se&&(xe=n.neg(xe)),{x:Z,y:xe}}else if(U===i&&W===4){const Z=n.fromBytes(ee.subarray(0,n.BYTES)),ue=n.fromBytes(ee.subarray(n.BYTES,2*n.BYTES));return{x:Z,y:ue}}else throw new Error(`Point of length ${U} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=I=>Mc(_c(I,e.nByteLength));function p(I){const U=r>>Zr;return I>U}function m(I){return p(I)?a(-I):I}const g=(I,U,W)=>Sl(I.slice(U,W));class b{constructor(U,W,ee){this.r=U,this.s=W,this.recovery=ee,this.assertValidity()}static fromCompact(U){const W=e.nByteLength;return U=Cs("compactSignature",U,W*2),new b(g(U,0,W),g(U,W,2*W))}static fromDER(U){const{r:W,s:ee}=Dl.toSig(Cs("DER",U));return new b(W,ee)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(U){return new b(this.r,this.s,U)}recoverPublicKey(U){const{r:W,s:ee,recovery:Z}=this,ue=C(Cs("msgHash",U));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const xe=Z===2||Z===3?W+e.n:W;if(xe>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const Se=Z&1?"03":"02",ke=u.fromHex(Se+h(xe)),me=l(xe),Ne=a(-ue*me),je=a(ee*me),ze=u.BASE.multiplyAndAddUnsafe(ke,Ne,je);if(!ze)throw new Error("point at infinify");return ze.assertValidity(),ze}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Nc(this.toDERHex())}toDERHex(){return Dl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Nc(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(I){try{return c(I),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const I=H4(e.n);return $ne(e.randomBytes(I),e.n)},precompute(I=8,U=u.BASE){return U._setWindowSize(I),U.multiply(BigInt(3)),U}};function A(I,U=!0){return u.fromPrivateKey(I).toRawBytes(U)}function w(I){const U=I instanceof Uint8Array,W=typeof I=="string",ee=(U||W)&&I.length;return U?ee===s||ee===i:W?ee===2*s||ee===2*i:I instanceof u}function x(I,U,W=!0){if(w(I))throw new Error("first arg must be private key");if(!w(U))throw new Error("second arg must be public key");return u.fromHex(U).multiply(c(I)).toRawBytes(W)}const k=e.bits2int||function(I){const U=Sl(I),W=I.length*8-e.nBitLength;return W>0?U>>BigInt(W):U},C=e.bits2int_modN||function(I){return a(k(I))},D=Sx(e.nBitLength);function O(I){if(typeof I!="bigint")throw new Error("bigint expected");if(!($i<=I&&I<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return _c(I,e.nByteLength)}function N(I,U,W=R){if(["recovered","canonical"].some(tt=>tt in W))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:Z}=e;let{lowS:ue,prehash:xe,extraEntropy:Se}=W;ue==null&&(ue=!0),I=Cs("msgHash",I),xe&&(I=Cs("prehashed msgHash",ee(I)));const ke=C(I),me=c(U),Ne=[O(me),O(ke)];if(Se!=null){const tt=Se===!0?Z(n.BYTES):Se;Ne.push(Cs("extraEntropy",tt))}const je=Nh(...Ne),ze=ke;function Be(tt){const le=k(tt);if(!d(le))return;const $e=l(le),ae=u.BASE.multiply(le).toAffine(),we=a(ae.x);if(we===$i)return;const Fe=a($e*a(ze+we*me));if(Fe===$i)return;let z=(ae.x===we?0:2)|Number(ae.y&Zr),Q=Fe;return ue&&p(Fe)&&(Q=m(Fe),z^=1),new b(we,Q,z)}return{seed:je,k2sig:Be}}const R={lowS:e.lowS,prehash:!1},B={lowS:e.lowS,prehash:!1};function F(I,U,W=R){const{seed:ee,k2sig:Z}=N(I,U,W),ue=e;return L4(ue.hash.outputLen,ue.nByteLength,ue.hmac)(ee,Z)}u.BASE._setWindowSize(8);function G(I,U,W,ee=B){var ae;const Z=I;if(U=Cs("msgHash",U),W=Cs("publicKey",W),"strict"in ee)throw new Error("options.strict was renamed to lowS");const{lowS:ue,prehash:xe}=ee;let Se,ke;try{if(typeof Z=="string"||Z instanceof Uint8Array)try{Se=b.fromDER(Z)}catch(we){if(!(we instanceof Dl.Err))throw we;Se=b.fromCompact(Z)}else if(typeof Z=="object"&&typeof Z.r=="bigint"&&typeof Z.s=="bigint"){const{r:we,s:Fe}=Z;Se=new b(we,Fe)}else throw new Error("PARSE");ke=u.fromHex(W)}catch(we){if(we.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ue&&Se.hasHighS())return!1;xe&&(U=e.hash(U));const{r:me,s:Ne}=Se,je=C(U),ze=l(Ne),Be=a(je*ze),tt=a(me*ze),le=(ae=u.BASE.multiplyAndAddUnsafe(ke,Be,tt))==null?void 0:ae.toAffine();return le?a(le.x)===me:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:x,sign:F,verify:G,ProjectivePoint:u,Signature:b,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Zne(t){return{hash:t,hmac:(e,...n)=>d4(t,e,qte(...n)),randomBytes:Kte}}function ere(t,e){const n=r=>Xne({...t,...Zne(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $4=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),G4=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),tre=BigInt(1),Nx=BigInt(2),W4=(t,e)=>(t+e/Nx)/e;function nre(t){const e=$4,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),u=t*t*t%e,c=u*u*t%e,f=Xr(c,n,e)*c%e,d=Xr(f,n,e)*c%e,h=Xr(d,Nx,e)*u%e,p=Xr(h,s,e)*h%e,m=Xr(p,i,e)*p%e,g=Xr(m,a,e)*m%e,b=Xr(g,l,e)*g%e,v=Xr(b,a,e)*m%e,A=Xr(v,n,e)*c%e,w=Xr(A,o,e)*p%e,x=Xr(w,r,e)*u%e,k=Xr(x,Nx,e);if(!_x.eql(_x.sqr(k),t))throw new Error("Cannot find square root");return k}const _x=zne($4,void 0,void 0,{sqrt:nre}),ia=ere({a:BigInt(0),b:BigInt(7),Fp:_x,n:G4,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=G4,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-tre*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=W4(i*t,e),l=W4(-r*t,e);let u=fr(t-a*n-l*s,e),c=fr(-a*r-l*i,e);const f=u>o,d=c>o;if(f&&(u=e-u),d&&(c=e-c),u>o||c>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:f,k1:u,k2neg:d,k2:c}}}},p4);BigInt(0),ia.ProjectivePoint;const Rh="0x0000000000000000000000000000000000000000",q4="0x0000000000000000000000000000000000000000000000000000000000000000",K4=BigInt(0),Q4=BigInt(1),J4=BigInt(2),Y4=BigInt(27),X4=BigInt(28),Yg=BigInt(35),Rc={};function Z4(t){return xl(Wn(t),32)}const Ns=class Ns{constructor(e,n,r,s){J(this,uf);J(this,cf);J(this,ff);J(this,eu);jg(e,Rc,"Signature"),L(this,uf,n),L(this,cf,r),L(this,ff,s),L(this,eu,null)}get r(){return T(this,uf)}set r(e){$(Ec(e)===32,"invalid r","value",e),L(this,uf,Ae(e))}get s(){return T(this,cf)}set s(e){$(Ec(e)===32,"invalid s","value",e);const n=Ae(e);$(parseInt(n.substring(0,3))<8,"non-canonical s","value",n),L(this,cf,n)}get v(){return T(this,ff)}set v(e){const n=Qe(e,"value");$(n===27||n===28,"invalid v","v",e),L(this,ff,n)}get networkV(){return T(this,eu)}get legacyChainId(){const e=this.networkV;return e==null?null:Ns.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ct(this.s);return this.yParity&&(e[0]|=128),Ae(e)}get compactSerialized(){return $t([this.r,this.yParityAndS])}get serialized(){return $t([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Ns(Rc,this.r,this.s,this.v);return this.networkV&&L(e,eu,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const n=Ce(e,"v");return n==Y4||n==X4?K4:($(n>=Yg,"invalid EIP-155 v","v",e),(n-Yg)/J4)}static getChainIdV(e,n){return Ce(e)*J4+BigInt(35+n-27)}static getNormalizedV(e){const n=Ce(e);return n===K4||n===Y4?27:n===Q4||n===X4?28:($(n>=Yg,"invalid v","v",e),n&Q4?27:28)}static from(e){function n(u,c){$(u,c,"signature",e)}if(e==null)return new Ns(Rc,q4,q4,27);if(typeof e=="string"){const u=ct(e,"signature");if(u.length===64){const c=Ae(u.slice(0,32)),f=u.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Ns(Rc,c,Ae(f),d)}if(u.length===65){const c=Ae(u.slice(0,32)),f=u.slice(32,64);n((f[0]&128)===0,"non-canonical s");const d=Ns.getNormalizedV(u[64]);return new Ns(Rc,c,Ae(f),d)}n(!1,"invalid raw signature length")}if(e instanceof Ns)return e.clone();const r=e.r;n(r!=null,"missing r");const s=Z4(r),i=function(u,c){if(u!=null)return Z4(u);if(c!=null){n(St(c,32),"invalid yParityAndS");const f=ct(c);return f[0]&=127,Ae(f)}n(!1,"missing s")}(e.s,e.yParityAndS);n((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(u,c,f){if(u!=null){const d=Ce(u);return{networkV:d>=Yg?d:void 0,v:Ns.getNormalizedV(d)}}if(c!=null)return n(St(c,32),"invalid yParityAndS"),{v:ct(c)[0]&128?28:27};if(f!=null){switch(Qe(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}n(!1,"invalid yParity")}n(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Ns(Rc,s,i,a);return o&&L(l,eu,o),n(e.yParity==null||Qe(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),n(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};uf=new WeakMap,cf=new WeakMap,ff=new WeakMap,eu=new WeakMap;let Ss=Ns;const tu=class tu{constructor(e){J(this,ao);$(Ec(e)===32,"invalid private key","privateKey","[REDACTED]"),L(this,ao,Ae(e))}get privateKey(){return T(this,ao)}get publicKey(){return tu.computePublicKey(T(this,ao))}get compressedPublicKey(){return tu.computePublicKey(T(this,ao),!0)}sign(e){$(Ec(e)===32,"invalid digest length","digest",e);const n=ia.sign(Gn(e),Gn(T(this,ao)),{lowS:!0});return Ss.from({r:Zo(n.r,32),s:Zo(n.s,32),v:n.recovery?28:27})}computeSharedSecret(e){const n=tu.computePublicKey(e);return Ae(ia.getSharedSecret(Gn(T(this,ao)),ct(n),!1))}static computePublicKey(e,n){let r=ct(e,"key");if(r.length===32){const i=ia.getPublicKey(r,!!n);return Ae(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=ia.ProjectivePoint.fromHex(r);return Ae(s.toRawBytes(n))}static recoverPublicKey(e,n){$(Ec(e)===32,"invalid digest length","digest",e);const r=Ss.from(n);let s=ia.Signature.fromCompact(Gn($t([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Gn(e));return $(i!=null,"invalid signautre for digest","signature",n),"0x"+i.toHex(!1)}static addPoints(e,n,r){const s=ia.ProjectivePoint.fromHex(tu.computePublicKey(e).substring(2)),i=ia.ProjectivePoint.fromHex(tu.computePublicKey(n).substring(2));return"0x"+s.add(i).toHex(!!r)}};ao=new WeakMap;let Ph=tu;const rre=BigInt(0),sre=BigInt(36);function eR(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 r=ct(en(n));for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(r[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const Rx={};for(let t=0;t<10;t++)Rx[String(t)]=String(t);for(let t=0;t<26;t++)Rx[String.fromCharCode(65+t)]=String(10+t);const tR=15;function ire(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(r=>Rx[r]).join("");for(;e.length>=tR;){let r=e.substring(0,tR);e=parseInt(r,10)%97+e.substring(r.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}const ore=function(){const t={};for(let e=0;e<36;e++){const n="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[n]=BigInt(e)}return t}();function are(t){t=t.toLowerCase();let e=rre;for(let n=0;n<t.length;n++)e=e*sre+ore[t[n]];return e}function gt(t){if($(typeof t=="string","invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/)){t.startsWith("0x")||(t="0x"+t);const e=eR(t);return $(!t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===t,"bad address checksum","address",t),e}if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){$(t.substring(2,4)===ire(t),"bad icap checksum","address",t);let e=are(t.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return eR("0x"+e)}$(!1,"invalid address","address",t)}function lre(t){const e=gt(t.from);let r=Ce(t.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,gt(Vt(en(El([e,r])),12))}function nR(t){return t&&typeof t.getAddress=="function"}function ure(t){try{return gt(t),!0}catch{}return!1}async function Px(t,e){const n=await e;return(n==null||n==="0x0000000000000000000000000000000000000000")&&(te(typeof t!="string","unconfigured name","UNCONFIGURED_NAME",{value:t}),$(!1,"invalid AddressLike value; did not resolve to a value address","target",t)),gt(n)}function Qn(t,e){if(typeof t=="string")return t.match(/^0x[0-9a-f]{40}$/i)?gt(t):(te(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Px(t,e.resolveName(t)));if(nR(t))return Px(t,t.getAddress());if(t&&typeof t.then=="function")return Px(t,t);$(!1,"unsupported addressable value","target",t)}const Gi={};function ve(t,e){let n=!1;return e<0&&(n=!0,e*=-1),new Rn(Gi,`${n?"":"u"}int${e}`,t,{signed:n,width:e})}function dt(t,e){return new Rn(Gi,`bytes${e||""}`,t,{size:e})}const rR=Symbol.for("_ethers_typed"),lo=class lo{constructor(e,n,r,s){q(this,"type");q(this,"value");J(this,nu);q(this,"_typedSymbol");s==null&&(s=null),jg(Gi,e,"Typed"),Me(this,{_typedSymbol:rR,type:n,value:r}),L(this,nu,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return T(this,nu)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,nu)===!0?-1:T(this,nu)===!1?this.value.length:null}static from(e,n){return new lo(Gi,e,n)}static uint8(e){return ve(e,8)}static uint16(e){return ve(e,16)}static uint24(e){return ve(e,24)}static uint32(e){return ve(e,32)}static uint40(e){return ve(e,40)}static uint48(e){return ve(e,48)}static uint56(e){return ve(e,56)}static uint64(e){return ve(e,64)}static uint72(e){return ve(e,72)}static uint80(e){return ve(e,80)}static uint88(e){return ve(e,88)}static uint96(e){return ve(e,96)}static uint104(e){return ve(e,104)}static uint112(e){return ve(e,112)}static uint120(e){return ve(e,120)}static uint128(e){return ve(e,128)}static uint136(e){return ve(e,136)}static uint144(e){return ve(e,144)}static uint152(e){return ve(e,152)}static uint160(e){return ve(e,160)}static uint168(e){return ve(e,168)}static uint176(e){return ve(e,176)}static uint184(e){return ve(e,184)}static uint192(e){return ve(e,192)}static uint200(e){return ve(e,200)}static uint208(e){return ve(e,208)}static uint216(e){return ve(e,216)}static uint224(e){return ve(e,224)}static uint232(e){return ve(e,232)}static uint240(e){return ve(e,240)}static uint248(e){return ve(e,248)}static uint256(e){return ve(e,256)}static uint(e){return ve(e,256)}static int8(e){return ve(e,-8)}static int16(e){return ve(e,-16)}static int24(e){return ve(e,-24)}static int32(e){return ve(e,-32)}static int40(e){return ve(e,-40)}static int48(e){return ve(e,-48)}static int56(e){return ve(e,-56)}static int64(e){return ve(e,-64)}static int72(e){return ve(e,-72)}static int80(e){return ve(e,-80)}static int88(e){return ve(e,-88)}static int96(e){return ve(e,-96)}static int104(e){return ve(e,-104)}static int112(e){return ve(e,-112)}static int120(e){return ve(e,-120)}static int128(e){return ve(e,-128)}static int136(e){return ve(e,-136)}static int144(e){return ve(e,-144)}static int152(e){return ve(e,-152)}static int160(e){return ve(e,-160)}static int168(e){return ve(e,-168)}static int176(e){return ve(e,-176)}static int184(e){return ve(e,-184)}static int192(e){return ve(e,-192)}static int200(e){return ve(e,-200)}static int208(e){return ve(e,-208)}static int216(e){return ve(e,-216)}static int224(e){return ve(e,-224)}static int232(e){return ve(e,-232)}static int240(e){return ve(e,-240)}static int248(e){return ve(e,-248)}static int256(e){return ve(e,-256)}static int(e){return ve(e,-256)}static bytes1(e){return dt(e,1)}static bytes2(e){return dt(e,2)}static bytes3(e){return dt(e,3)}static bytes4(e){return dt(e,4)}static bytes5(e){return dt(e,5)}static bytes6(e){return dt(e,6)}static bytes7(e){return dt(e,7)}static bytes8(e){return dt(e,8)}static bytes9(e){return dt(e,9)}static bytes10(e){return dt(e,10)}static bytes11(e){return dt(e,11)}static bytes12(e){return dt(e,12)}static bytes13(e){return dt(e,13)}static bytes14(e){return dt(e,14)}static bytes15(e){return dt(e,15)}static bytes16(e){return dt(e,16)}static bytes17(e){return dt(e,17)}static bytes18(e){return dt(e,18)}static bytes19(e){return dt(e,19)}static bytes20(e){return dt(e,20)}static bytes21(e){return dt(e,21)}static bytes22(e){return dt(e,22)}static bytes23(e){return dt(e,23)}static bytes24(e){return dt(e,24)}static bytes25(e){return dt(e,25)}static bytes26(e){return dt(e,26)}static bytes27(e){return dt(e,27)}static bytes28(e){return dt(e,28)}static bytes29(e){return dt(e,29)}static bytes30(e){return dt(e,30)}static bytes31(e){return dt(e,31)}static bytes32(e){return dt(e,32)}static address(e){return new lo(Gi,"address",e)}static bool(e){return new lo(Gi,"bool",!!e)}static bytes(e){return new lo(Gi,"bytes",e)}static string(e){return new lo(Gi,"string",e)}static array(e,n){throw new Error("not implemented yet")}static tuple(e,n){throw new Error("not implemented yet")}static overrides(e){return new lo(Gi,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===rR}static dereference(e,n){if(lo.isTyped(e)){if(e.type!==n)throw new Error(`invalid type: expecetd ${n}, got ${e.type}`);return e.value}return e}};nu=new WeakMap;let Rn=lo;class cre extends zi{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,n){let r=Rn.dereference(n,"string");try{r=gt(r)}catch(s){return this._throwError(s.message,n)}return e.writeValue(r)}decode(e){return gt(Zo(e.readValue(),20))}}class fre extends zi{constructor(n){super(n.name,n.type,"_",n.dynamic);q(this,"coder");this.coder=n}defaultValue(){return this.coder.defaultValue()}encode(n,r){return this.coder.encode(n,r)}decode(n){return this.coder.decode(n)}}function sR(t,e,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n=="object"){let l={};r=e.map(u=>{const c=u.localName;return te(c,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),te(!l[c],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:u},value:n}),l[c]=!0,n[c]})}else $(!1,"invalid tuple value","tuple",n);$(e.length===r.length,"types/value length mismatch","tuple",n);let s=new px,i=new px,o=[];e.forEach((l,u)=>{let c=r[u];if(l.dynamic){let f=i.length;l.encode(i,c);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,c)}),o.forEach(l=>{l(s.length)});let a=t.appendWriter(s);return a+=t.appendWriter(i),a}function iR(t,e){let n=[],r=[],s=t.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=t.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(u){if(gn(u,"BUFFER_OVERRUN"))throw u;o=u,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(t)}catch(a){if(gn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");n.push(o),r.push(i.localName||null)}),Tc.fromItems(n,r)}class dre extends zi{constructor(n,r,s){const i=n.type+"["+(r>=0?r:"")+"]",o=r===-1||n.dynamic;super("array",i,s,o);q(this,"coder");q(this,"length");Me(this,{coder:n,length:r})}defaultValue(){const n=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(n);return r}encode(n,r){const s=Rn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,n.writeValue(s.length)),F_(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return sR(n,o,s)}decode(n){let r=this.length;r===-1&&(r=n.readIndex(),te(r*Kn<=n.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:n.bytes,offset:r*Kn,length:n.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new fre(this.coder));return iR(n,s)}}class hre extends zi{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,n){const r=Rn.dereference(n,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class oR extends zi{constructor(e,n){super(e,e,n,!0)}defaultValue(){return"0x"}encode(e,n){n=Gn(n);let r=e.writeValue(n.length);return r+=e.writeBytes(n),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class pre extends oR{constructor(e){super("bytes",e)}decode(e){return Ae(super.decode(e))}}class mre extends zi{constructor(n,r){let s="bytes"+String(n);super(s,s,r,!1);q(this,"size");Me(this,{size:n},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(n,r){let s=Gn(Rn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),n.writeBytes(s)}decode(n){return Ae(n.readBytes(this.size))}}const gre=new Uint8Array([]);class yre extends zi{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,n){return n!=null&&this._throwError("not null",n),e.writeBytes(gre)}decode(e){return e.readBytes(0),null}}const bre=BigInt(0),wre=BigInt(1),Are=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class vre extends zi{constructor(n,r,s){const i=(r?"int":"uint")+n*8;super(i,i,s,!1);q(this,"size");q(this,"signed");Me(this,{size:n,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(n,r){let s=Ce(Rn.dereference(r,this.type)),i=Dh(Are,Kn*8);if(this.signed){let o=Dh(i,this.size*8-1);(s>o||s<-(o+wre))&&this._throwError("value out-of-bounds",r),s=V_(s,8*Kn)}else(s<bre||s>Dh(i,this.size*8))&&this._throwError("value out-of-bounds",r);return n.writeValue(s)}decode(n){let r=Dh(n.readValue(),this.size*8);return this.signed&&(r=Cte(r,this.size*8)),r}}class xre extends oR{constructor(e){super("string",e)}defaultValue(){return""}encode(e,n){return super.encode(e,Vi(Rn.dereference(n,"string")))}decode(e){return Sc(super.decode(e))}}class Xg extends zi{constructor(n,r){let s=!1;const i=[];n.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);q(this,"coders");Me(this,{coders:Object.freeze(n.slice())})}defaultValue(){const n=[];this.coders.forEach(s=>{n.push(s.defaultValue())});const r=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),n[o]==null&&(n[o]=n[i]))}),Object.freeze(n)}encode(n,r){const s=Rn.dereference(r,"tuple");return sR(n,this.coders,s)}decode(n){return iR(n,this.coders)}}function Ol(t){return en(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2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const aR=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),lR=4;function Ere(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=n());let o=n(),a=e;e+=o;let l=0,u=0;function c(){return l==0&&(u=u<<8|t[e++],l=8),u>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let g=0;for(let x=0;x<f;x++)g=g<<1|c();let b=[],v=0,A=d;for(;;){let x=Math.floor(((g-v+1)*s-1)/A),k=0,C=r;for(;C-k>1;){let N=k+C>>>1;x<i[N]?C=N:k=N}if(k==0)break;b.push(k);let D=v+Math.floor(A*i[k]/s),O=v+Math.floor(A*i[k+1]/s)-1;for(;!((D^O)&h);)g=g<<1&m|c(),D=D<<1&m,O=O<<1&m|1;for(;D&~O&p;)g=g&h|g<<1&m>>>1|c(),D=D<<1^h,O=(O^h)<<1|h|1;v=D,A=1+O-D}let w=r-4;return b.map(x=>{switch(x-w){case 3:return w+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return w+256+(t[a++]<<8|t[a++]);case 1:return w+t[a++];default:return x-1}})}function Cre(t){let e=0;return()=>t[e++]}function uR(t){return Cre(Ere(Sre(t)))}function Sre(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let n=t.length,r=new Uint8Array(6*n>>3);for(let s=0,i=0,o=0,a=0;s<n;s++)a=a<<6|e[t.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function Tre(t){return t&1?~t>>1:t>>1}function Dre(t,e){let n=Array(t);for(let r=0,s=0;r<t;r++)n[r]=s+=Tre(e());return n}function Ih(t,e=0){let n=[];for(;;){let r=t(),s=t();if(!s)break;e+=r;for(let i=0;i<s;i++)n.push(e+i);e+=s+1}return n}function cR(t){return Lh(()=>{let e=Ih(t);if(e.length)return e})}function fR(t){let e=[];for(;;){let n=t();if(n==0)break;e.push(Ore(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(Mre(n,t))}return e.flat()}function Lh(t){let e=[];for(;;){let n=t(e.length);if(!n)break;e.push(n)}return e}function dR(t,e,n){let r=Array(t).fill().map(()=>[]);for(let s=0;s<e;s++)Dre(t,n).forEach((i,o)=>r[o].push(i));return r}function Ore(t,e){let n=1+e(),r=e(),s=Lh(e);return dR(s.length,1+t,e).flatMap((o,a)=>{let[l,...u]=o;return Array(s[a]).fill().map((c,f)=>{let d=f*r;return[l+f*n,u.map(h=>h+d)]})})}function Mre(t,e){let n=1+e();return dR(n,1+t,e).map(s=>[s[0],s.slice(1)])}function Nre(t){let e=[],n=Ih(t);return s(r([]),[]),e;function r(i){let o=t(),a=Lh(()=>{let l=Ih(t).map(u=>n[u]);if(l.length)return r(l)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,l){if(!(i&4&&l===a[a.length-1])){i&2&&(l=a[a.length-1]),i&1&&e.push(a);for(let u of o)for(let c of u.Q)s(u,[...a,c],l)}}}function _re(t){return t.toString(16).toUpperCase().padStart(2,"0")}function hR(t){return`{${_re(t)}}`}function Rre(t){let e=[];for(let n=0,r=t.length;n<r;){let s=t.codePointAt(n);n+=s<65536?1:2,e.push(s)}return e}function Pc(t){let n=t.length;if(n<4096)return String.fromCodePoint(...t);let r=[];for(let s=0;s<n;)r.push(String.fromCodePoint(...t.slice(s,s+=4096)));return r.join("")}function Pre(t,e){let n=t.length,r=n-e.length;for(let s=0;r==0&&s<n;s++)r=t[s]-e[s];return r}var Ire="AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEdNRW1JhBirAsJOXcG+xr2C48mrxMpevwF0xohBk0BKRr/AM8u54WwW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mR*Ic,Lre=pR*ny,Bre=Bh+Lre,Fre=Zg+pR,jre=ey+mR,Ure=ty+Ic;function Fh(t){return t>>24&255}function gR(t){return t&16777215}let Ix,yR,Lx,ry;function Hre(){let t=uR(Ire);Ix=new Map(cR(t).flatMap((e,n)=>e.map(r=>[r,n+1<<24]))),yR=new Set(Ih(t)),Lx=new Map,ry=new Map;for(let[e,n]of fR(t)){if(!yR.has(e)&&n.length==2){let[r,s]=n,i=ry.get(r);i||(i=new Map,ry.set(r,i)),i.set(s,e)}Lx.set(e,n.reverse())}}function bR(t){return t>=Bh&&t<Bre}function Vre(t,e){if(t>=Zg&&t<Fre&&e>=ey&&e<jre)return Bh+(t-Zg)*ny+(e-ey)*Ic;if(bR(t)&&e>ty&&e<Ure&&(t-Bh)%Ic==0)return t+(e-ty);{let n=ry.get(t);return n&&(n=n.get(e),n)?n:-1}}function wR(t){Ix||Hre();let e=[],n=[],r=!1;function s(i){let o=Ix.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of t)for(;;){if(i<128)e.push(i);else if(bR(i)){let o=i-Bh,a=o/ny|0,l=o%ny/Ic|0,u=o%Ic;s(Zg+a),s(ey+l),u>0&&s(ty+u)}else{let o=Lx.get(i);o?n.push(...o):s(i)}if(!n.length)break;i=n.pop()}if(r&&e.length>1){let i=Fh(e[0]);for(let o=1;o<e.length;o++){let a=Fh(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let u=e[l+1];if(e[l+1]=e[l],e[l]=u,!l||(i=Fh(e[--l]),i<=a))break}i=Fh(e[o])}}return e}function zre(t){let e=[],n=[],r=-1,s=0;for(let i of t){let o=Fh(i),a=gR(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...n),n.length=0,r=a):n.push(a),s=o;else{let l=Vre(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(n.push(a),s=o)}}return r>=0&&e.push(r,...n),e}function AR(t){return wR(t).map(gR)}function $re(t){return zre(wR(t))}const vR=45,xR=".",kR=65039,ER=1,sy=t=>Array.from(t);function jh(t,e){return t.P.has(e)||t.Q.has(e)}class Gre extends Array{get is_emoji(){return!0}}let Bx,CR,Ml,Fx,SR,Lc,jx,Bc,Nl,TR,Ux;function Hx(){if(Bx)return;let t=uR(kre);const e=()=>Ih(t),n=()=>new Set(e()),r=(c,f)=>f.forEach(d=>c.add(d));Bx=new Map(fR(t)),CR=n(),Ml=e(),Fx=new Set(e().map(c=>Ml[c])),Ml=new Set(Ml),SR=n(),n();let s=cR(t),i=t();const o=()=>{let c=new Set;return e().forEach(f=>r(c,s[f])),r(c,e()),c};Lc=Lh(c=>{let f=Lh(t).map(d=>d+96);if(f.length){let d=c>=i;f[0]-=32,f=Pc(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!t();return{N:f,P:h,Q:p,M:m,R:d}}}),jx=n(),Bc=new Map;let a=e().concat(sy(jx)).sort((c,f)=>c-f);a.forEach((c,f)=>{let d=t(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(c),jx.has(c)||Bc.set(c,h)});for(let{V:c,M:f}of new Set(Bc.values())){let d=[];for(let p of c){let m=Lc.filter(b=>jh(b,p)),g=d.find(({G:b})=>m.some(v=>b.has(v)));g||(g={G:new Set,V:[]},d.push(g)),g.V.push(p),r(g.G,m)}let h=d.flatMap(p=>sy(p.G));for(let{G:p,V:m}of d){let g=new Set(h.filter(b=>!p.has(b)));for(let b of m)f.set(b,g)}}Nl=new Set;let l=new Set;const u=c=>Nl.has(c)?l.add(c):Nl.add(c);for(let c of Lc){for(let f of c.P)u(f);for(let f of c.Q)u(f)}for(let c of Nl)!Bc.has(c)&&!l.has(c)&&Bc.set(c,ER);r(Nl,AR(Nl)),TR=Nre(t).map(c=>Gre.from(c)).sort(Pre),Ux=new Map;for(let c of TR){let f=[Ux];for(let d of c){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===kR?f.push(...h):f=h}for(let d of f)d.V=c}}function Vx(t){return(DR(t)?"":`${zx(iy([t]))} `)+hR(t)}function zx(t){return`"${t}"`}function Wre(t){if(t.length>=4&&t[2]==vR&&t[3]==vR)throw new Error(`invalid label extension: "${Pc(t.slice(0,4))}"`)}function qre(t){for(let n=t.lastIndexOf(95);n>0;)if(t[--n]!==95)throw new Error("underscore allowed only at start")}function Kre(t){let e=t[0],n=aR.get(e);if(n)throw Uh(`leading ${n}`);let r=t.length,s=-1;for(let i=1;i<r;i++){e=t[i];let o=aR.get(e);if(o){if(s==i)throw Uh(`${n} + ${o}`);s=i+1,n=o}}if(s==r)throw Uh(`trailing ${n}`)}function iy(t,e=1/0,n=hR){let r=[];Qre(t[0])&&r.push("◌"),t.length>e&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let s=0,i=t.length;for(let o=0;o<i;o++){let a=t[o];DR(a)&&(r.push(Pc(t.slice(s,o))),r.push(n(a)),s=o+1)}return r.push(Pc(t.slice(s,i))),r.join("")}function Qre(t){return Hx(),Ml.has(t)}function DR(t){return Hx(),SR.has(t)}function Jre(t){return ese(Yre(t,$re,rse))}function Yre(t,e,n){if(!t)return[];Hx();let r=0;return t.split(xR).map(s=>{let i=Rre(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=nse(i,e,n),l=a.length,u;if(!l)throw new Error("empty label");let c=o.output=a.flat();if(qre(c),!(o.emoji=l>1||a[0].is_emoji)&&c.every(d=>d<128))Wre(c),u="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)u="Emoji";else{if(Ml.has(c[0]))throw Uh("leading combining mark");for(let m=1;m<l;m++){let g=a[m];if(!g.is_emoji&&Ml.has(g[0]))throw Uh(`emoji + combining mark: "${Pc(a[m-1])} + ${iy([g[0]])}"`)}Kre(c);let h=sy(new Set(d)),[p]=Zre(h);tse(p,d),Xre(p,h),u=p.N}}o.type=u}catch(a){o.error=a}return o})}function Xre(t,e){let n,r=[];for(let s of e){let i=Bc.get(s);if(i===ER)return;if(i){let o=i.M.get(s);if(n=n?n.filter(a=>o.has(a)):sy(o),!n.length)return}else r.push(s)}if(n){for(let s of n)if(r.every(i=>jh(s,i)))throw new Error(`whole-script confusable: ${t.N}/${s.N}`)}}function Zre(t){let e=Lc;for(let n of t){let r=e.filter(s=>jh(s,n));if(!r.length)throw Lc.some(s=>jh(s,n))?MR(e[0],n):OR(n);if(e=r,r.length==1)break}return e}function ese(t){return t.map(({input:e,error:n,output:r})=>{if(n){let s=n.message;throw new Error(t.length==1?s:`Invalid label ${zx(iy(e,63))}: ${s}`)}return Pc(r)}).join(xR)}function OR(t){return new Error(`disallowed character: ${Vx(t)}`)}function MR(t,e){let n=Vx(e),r=Lc.find(s=>s.P.has(e));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${t.N} + ${n}`)}function Uh(t){return new Error(`illegal placement: ${t}`)}function tse(t,e){for(let n of e)if(!jh(t,n))throw MR(t,n);if(t.M){let n=AR(e);for(let r=1,s=n.length;r<s;r++)if(Fx.has(n[r])){let i=r+1;for(let o;i<s&&Fx.has(o=n[i]);i++)for(let a=r;a<i;a++)if(n[a]==o)throw new Error(`duplicate non-spacing marks: ${Vx(o)}`);if(i-r>lR)throw new Error(`excessive non-spacing marks: ${zx(iy(n.slice(r-1,i)))} (${i-r}/${lR})`);r=i}}}function nse(t,e,n){let r=[],s=[];for(t=t.slice().reverse();t.length;){let i=sse(t);if(i)s.length&&(r.push(e(s)),s=[]),r.push(n(i));else{let o=t.pop();if(Nl.has(o))s.push(o);else{let a=Bx.get(o);if(a)s.push(...a);else if(!CR.has(o))throw OR(o)}}}return s.length&&r.push(e(s)),r}function rse(t){return t.filter(e=>e!=kR)}function sse(t,e){let n=Ux,r,s=t.length;for(;s&&(n=n.get(t[--s]),!!n);){let{V:i}=n;i&&(r=i,t.length=s)}return r}const NR=new Uint8Array(32);NR.fill(0);function _R(t){return $(t.length!==0,"invalid ENS name; empty component","comp",t),t}function RR(t){const e=Vi(ise(t)),n=[];if(t.length===0)return n;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(n.push(_R(e.slice(r,s))),r=s+1);return $(r<e.length,"invalid ENS name; empty component","name",t),n.push(_R(e.slice(r))),n}function ise(t){try{if(t.length===0)throw new Error("empty label");return Jre(t)}catch(e){$(!1,`invalid ENS name (${e.message})`,"name",t)}}function $x(t){$(typeof t=="string","invalid ENS name; not a string","name",t),$(t.length,"invalid ENS name (empty label)","name",t);let e=NR;const n=RR(t);for(;n.length;)e=en($t([e,en(n.pop())]));return Ae(e)}function ose(t,e){const n=e;return $(n<=255,"DNS encoded label cannot exceed 255","length",n),Ae($t(RR(t).map(r=>{$(r.length<=n,`label ${JSON.stringify(t)} exceeds ${n} bytes`,"name",t);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function Gx(t,e){return{address:gt(t),storageKeys:e.map((n,r)=>($(St(n,32),"invalid slot",`storageKeys[${r}]`,n),n.toLowerCase()))}}function oa(t){if(Array.isArray(t))return t.map((n,r)=>Array.isArray(n)?($(n.length===2,"invalid slot set",`value[${r}]`,n),Gx(n[0],n[1])):($(n!=null&&typeof n=="object","invalid address-slot set","value",t),Gx(n.address,n.storageKeys)));$(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(n=>{const r=t[n].reduce((s,i)=>(s[i]=!0,s),{});return Gx(n,Object.keys(r).sort())});return e.sort((n,r)=>n.address.localeCompare(r.address)),e}function ase(t){let e;return typeof t=="string"?e=Ph.computePublicKey(t,!1):e=t.publicKey,gt(en("0x"+e.substring(4)).substring(26))}function lse(t,e){return ase(Ph.recoverPublicKey(t,e))}const bn=BigInt(0),use=BigInt(2),cse=BigInt(27),fse=BigInt(28),dse=BigInt(35),hse=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Wx=4096*32;function PR(t,e){let n=t.toString(16);for(;n.length<2;)n="0"+n;return n+=Oc(e).substring(4),"0x"+n}function oy(t){return t==="0x"?null:gt(t)}function qx(t,e){try{return oa(t)}catch(n){$(!1,n.message,e,t)}}function Hh(t,e){return t==="0x"?0:Qe(t,e)}function Wt(t,e){if(t==="0x")return bn;const n=Ce(t,e);return $(n<=hse,"value exceeds uint size",e,n),n}function Ot(t,e){const n=Ce(t,"value"),r=Wn(n);return $(r.length<=32,"value too large",`tx.${e}`,n),r}function Kx(t){return oa(t).map(e=>[e.address,e.storageKeys])}function pse(t,e){$(Array.isArray(t),`invalid ${e}`,"value",t);for(let n=0;n<t.length;n++)$(St(t[n],32),"invalid ${ param } hash",`value[${n}]`,t[n]);return t}function mse(t){const e=$g(t);$(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",t);const n={type:0,nonce:Hh(e[0],"nonce"),gasPrice:Wt(e[1],"gasPrice"),gasLimit:Wt(e[2],"gasLimit"),to:oy(e[3]),value:Wt(e[4],"value"),data:Ae(e[5]),chainId:bn};if(e.length===6)return n;const r=Wt(e[6],"v"),s=Wt(e[7],"r"),i=Wt(e[8],"s");if(s===bn&&i===bn)n.chainId=r;else{let o=(r-dse)/use;o<bn&&(o=bn),n.chainId=o,$(o!==bn||r===cse||r===fse,"non-canonical legacy v","v",e[6]),n.signature=Ss.from({r:xl(e[7],32),s:xl(e[8],32),v:r})}return n}function gse(t,e){const n=[Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data];let r=bn;if(t.chainId!=bn)r=Ce(t.chainId,"tx.chainId"),$(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(t.signature){const i=t.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==bn&&(n.push(Wn(r)),n.push("0x"),n.push("0x")),El(n);let s=BigInt(27+e.yParity);return r!==bn?s=Ss.getChainIdV(r,e.v):BigInt(e.v)!==s&&$(!1,"tx.chainId/sig.v mismatch","sig",e),n.push(Wn(s)),n.push(Wn(e.r)),n.push(Wn(e.s)),El(n)}function Qx(t,e){let n;try{if(n=Hh(e[0],"yParity"),n!==0&&n!==1)throw new Error("bad yParity")}catch{$(!1,"invalid yParity","yParity",e[0])}const r=xl(e[1],32),s=xl(e[2],32),i=Ss.from({r,s,yParity:n});t.signature=i}function yse(t){const e=$g(ct(t).slice(1));$(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Ae(t));const n={type:2,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:oy(e[5]),value:Wt(e[6],"value"),data:Ae(e[7]),accessList:qx(e[8],"accessList")};return e.length===9||Qx(n,e.slice(9)),n}function bse(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,Kx(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"yParity")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x02",El(n)])}function wse(t){const e=$g(ct(t).slice(1));$(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Ae(t));const n={type:1,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),gasPrice:Wt(e[2],"gasPrice"),gasLimit:Wt(e[3],"gasLimit"),to:oy(e[4]),value:Wt(e[5],"value"),data:Ae(e[6]),accessList:qx(e[7],"accessList")};return e.length===8||Qx(n,e.slice(8)),n}function Ase(t,e){const n=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.gasPrice||0,"gasPrice"),Ot(t.gasLimit,"gasLimit"),t.to||"0x",Ot(t.value,"value"),t.data,Kx(t.accessList||[])];return e&&(n.push(Ot(e.yParity,"recoveryParam")),n.push(Wn(e.r)),n.push(Wn(e.s))),$t(["0x01",El(n)])}function vse(t){let e=$g(ct(t).slice(1)),n="3",r=null;if(e.length===4&&Array.isArray(e[0])){n="3 (network format)";const i=e[1],o=e[2],a=e[3];$(Array.isArray(i),"invalid network format: blobs not an array","fields[1]",i),$(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),$(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),$(i.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),$(i.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let l=0;l<e[1].length;l++)r.push({data:i[l],commitment:o[l],proof:a[l]});e=e[0]}$(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${n}`,"data",Ae(t));const s={type:3,chainId:Wt(e[0],"chainId"),nonce:Hh(e[1],"nonce"),maxPriorityFeePerGas:Wt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Wt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Wt(e[4],"gasLimit"),to:oy(e[5]),value:Wt(e[6],"value"),data:Ae(e[7]),accessList:qx(e[8],"accessList"),maxFeePerBlobGas:Wt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),$(s.to!=null,`invalid address for transaction type: ${n}`,"data",t),$(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",t);for(let i=0;i<s.blobVersionedHashes.length;i++)$(St(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",t);return e.length===11||Qx(s,e.slice(11)),s}function xse(t,e,n){const r=[Ot(t.chainId,"chainId"),Ot(t.nonce,"nonce"),Ot(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ot(t.maxFeePerGas||0,"maxFeePerGas"),Ot(t.gasLimit,"gasLimit"),t.to||Rh,Ot(t.value,"value"),t.data,Kx(t.accessList||[]),Ot(t.maxFeePerBlobGas||0,"maxFeePerBlobGas"),pse(t.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Ot(e.yParity,"yParity")),r.push(Wn(e.r)),r.push(Wn(e.s)),n)?$t(["0x03",El([r,n.map(s=>s.data),n.map(s=>s.commitment),n.map(s=>s.proof)])]):$t(["0x03",El(r)])}const co=class co{constructor(){J(this,kf);J(this,mi);J(this,df);J(this,hf);J(this,pf);J(this,mf);J(this,gf);J(this,yf);J(this,bf);J(this,wf);J(this,Af);J(this,vf);J(this,xf);J(this,ru);J(this,ya);J(this,uo);J(this,ba);L(this,mi,null),L(this,df,null),L(this,pf,0),L(this,mf,bn),L(this,gf,null),L(this,yf,null),L(this,bf,null),L(this,hf,"0x"),L(this,wf,bn),L(this,Af,bn),L(this,vf,null),L(this,xf,null),L(this,ru,null),L(this,ya,null),L(this,ba,null),L(this,uo,null)}get type(){return T(this,mi)}set type(e){switch(e){case null:L(this,mi,null);break;case 0:case"legacy":L(this,mi,0);break;case 1:case"berlin":case"eip-2930":L(this,mi,1);break;case 2:case"london":case"eip-1559":L(this,mi,2);break;case 3:case"cancun":case"eip-4844":L(this,mi,3);break;default:$(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=T(this,df);return e==null&&this.type===3?Rh:e}set to(e){L(this,df,e==null?null:gt(e))}get nonce(){return T(this,pf)}set nonce(e){L(this,pf,Qe(e,"value"))}get gasLimit(){return T(this,mf)}set gasLimit(e){L(this,mf,Ce(e))}get gasPrice(){const e=T(this,gf);return e==null&&(this.type===0||this.type===1)?bn:e}set gasPrice(e){L(this,gf,e==null?null:Ce(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,yf);return e??(this.type===2||this.type===3?bn:null)}set maxPriorityFeePerGas(e){L(this,yf,e==null?null:Ce(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,bf);return e??(this.type===2||this.type===3?bn:null)}set maxFeePerGas(e){L(this,bf,e==null?null:Ce(e,"maxFeePerGas"))}get data(){return T(this,hf)}set data(e){L(this,hf,Ae(e))}get value(){return T(this,wf)}set value(e){L(this,wf,Ce(e,"value"))}get chainId(){return T(this,Af)}set chainId(e){L(this,Af,Ce(e))}get signature(){return T(this,vf)||null}set signature(e){L(this,vf,e==null?null:Ss.from(e))}get accessList(){const e=T(this,xf)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){L(this,xf,e==null?null:oa(e))}get maxFeePerBlobGas(){const e=T(this,ru);return e==null&&this.type===3?bn:e}set maxFeePerBlobGas(e){L(this,ru,e==null?null:Ce(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ya);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){$(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let n=0;n<e.length;n++)$(St(e[n],32),"invalid blobVersionedHash",`value[${n}]`,e[n])}L(this,ya,e)}get blobs(){return T(this,ba)==null?null:T(this,ba).map(e=>Object.assign({},e))}set blobs(e){if(e==null){L(this,ba,null);return}const n=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(ux(i)){te(T(this,uo),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if($(o.length<=Wx,"blob is too large",`blobs[${s}]`,i),o.length!==Wx){const u=new Uint8Array(Wx);u.set(o),o=u}const a=T(this,uo).blobToKzgCommitment(o),l=Ae(T(this,uo).computeBlobKzgProof(o,a));n.push({data:Ae(o),commitment:Ae(a),proof:l}),r.push(PR(1,a))}else{const o=Ae(i.commitment);n.push({data:Ae(i.data),commitment:o,proof:Ae(i.proof)}),r.push(PR(1,o))}}L(this,ba,n),L(this,ya,r)}get kzg(){return T(this,uo)}set kzg(e){L(this,uo,e)}get hash(){return this.signature==null?null:en(de(this,kf,ab).call(this,!0,!1))}get unsignedHash(){return en(this.unsignedSerialized)}get from(){return this.signature==null?null:lse(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Ph.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return de(this,kf,ab).call(this,!0,!0)}get unsignedSerialized(){return de(this,kf,ab).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,n=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,ru)!=null||T(this,ya);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&te(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),te(!n||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),te(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):n?i.push(2):e?(i.push(1),r||i.push(0)):r?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return co.from(this)}toJSON(){const e=n=>n==null?null:n.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new co;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return co.from(mse(r));switch(r[0]){case 1:return co.from(wse(r));case 2:return co.from(yse(r));case 3:return co.from(vse(r))}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const n=new co;return e.type!=null&&(n.type=e.type),e.to!=null&&(n.to=e.to),e.nonce!=null&&(n.nonce=e.nonce),e.gasLimit!=null&&(n.gasLimit=e.gasLimit),e.gasPrice!=null&&(n.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(n.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(n.data=e.data),e.value!=null&&(n.value=e.value),e.chainId!=null&&(n.chainId=e.chainId),e.signature!=null&&(n.signature=Ss.from(e.signature)),e.accessList!=null&&(n.accessList=e.accessList),e.blobVersionedHashes!=null&&(n.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(n.kzg=e.kzg),e.blobs!=null&&(n.blobs=e.blobs),e.hash!=null&&($(n.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),$(n.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&($(n.isSigned(),"unsigned transaction cannot define '.from'","tx",e),$(n.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),n}};mi=new WeakMap,df=new WeakMap,hf=new WeakMap,pf=new WeakMap,mf=new WeakMap,gf=new WeakMap,yf=new WeakMap,bf=new WeakMap,wf=new WeakMap,Af=new WeakMap,vf=new WeakMap,xf=new WeakMap,ru=new WeakMap,ya=new WeakMap,uo=new WeakMap,ba=new WeakMap,kf=new WeakSet,ab=function(e,n){te(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return gse(this,r);case 1:return Ase(this,r);case 2:return bse(this,r);case 3:return xse(this,r,n?this.blobs:null)}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let Vh=co;const IR=new Uint8Array(32);IR.fill(0);const kse=BigInt(-1),LR=BigInt(0),BR=BigInt(1),Ese=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Cse(t){const e=ct(t),n=e.length%32;return n?$t([e,IR.slice(n)]):Ae(e)}const Sse=Zo(BR,32),Tse=Zo(LR,32),FR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Jx=["name","version","chainId","verifyingContract","salt"];function jR(t){return function(e){return $(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Dse={name:jR("name"),version:jR("version"),chainId:function(t){const e=Ce(t,"domain.chainId");return $(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):kl(e)},verifyingContract:function(t){try{return gt(t).toLowerCase()}catch{}$(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=ct(t,"domain.salt");return $(e.length===32,'invalid domain value "salt"',"domain.salt",t),Ae(e)}};function Yx(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const n=e[1]==="",r=parseInt(e[2]);$(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",t);const s=Dh(Ese,n?r-1:r),i=n?(s+BR)*kse:LR;return function(o){const a=Ce(o,"value");return $(a>=i&&a<=s,`value out-of-bounds for ${t}`,"value",a),Zo(n?V_(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return $(n!==0&&n<=32&&e[1]===String(n),"invalid bytes width","type",t),function(r){const s=ct(r);return $(s.length===n,`invalid length for ${t}`,"value",r),Cse(r)}}}switch(t){case"address":return function(e){return xl(gt(e),32)};case"bool":return function(e){return e?Sse:Tse};case"bytes":return function(e){return en(e)};case"string":return function(e){return Ol(e)}}return null}function UR(t,e){return`${t}(${e.map(({name:n,type:r})=>r+" "+n).join(",")})`}function ay(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}const ns=class ns{constructor(e){J(this,eb);q(this,"primaryType");J(this,mp);J(this,fo);J(this,Ef);L(this,fo,new Map),L(this,Ef,new Map);const n=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:u,type:c})=>{let{base:f,index:d}=ay(c);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:u,type:f+(d||"")}}),n.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),L(this,mp,JSON.stringify(i));for(const l in i){const u=new Set;for(const c of i[l]){$(!u.has(c.name),`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(l)}`,"types",e),u.add(c.name);const f=ay(c.type).base;$(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!Yx(f)&&($(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),n.get(l).add(f))}}const o=Array.from(r.keys()).filter(l=>r.get(l).length===0);$(o.length!==0,"missing primary type","types",e),$(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),Me(this,{primaryType:o[0]});function a(l,u){$(!u.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),u.add(l);for(const c of n.get(l))if(r.has(c)){a(c,u);for(const f of u)s.get(f).add(c)}u.delete(l)}a(this.primaryType,new Set);for(const[l,u]of s){const c=Array.from(u);c.sort(),T(this,fo).set(l,UR(l,i[l])+c.map(f=>UR(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,mp))}getEncoder(e){let n=T(this,Ef).get(e);return n||(n=de(this,eb,ML).call(this,e),T(this,Ef).set(e,n)),n}encodeType(e){const n=T(this,fo).get(e);return $(n,`unknown type: ${JSON.stringify(e)}`,"name",e),n}encodeData(e,n){return this.getEncoder(e)(n)}hashStruct(e,n){return en(this.encodeData(e,n))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,n,r){if(Yx(e))return r(e,n);const s=ay(e).array;if(s)return $(s.count===-1||s.count===n.length,`array length mismatch; expected length ${s.count}`,"value",n),n.map(o=>this._visit(s.prefix,o,r));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,n[a],r),o),{});$(!1,`unknown type: ${e}`,"type",e)}visit(e,n){return this._visit(this.primaryType,e,n)}static from(e){return new ns(e)}static getPrimaryType(e){return ns.from(e).primaryType}static hashStruct(e,n,r){return ns.from(n).hashStruct(e,r)}static hashDomain(e){const n=[];for(const r in e){if(e[r]==null)continue;const s=FR[r];$(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),n.push({name:r,type:s})}return n.sort((r,s)=>Jx.indexOf(r.name)-Jx.indexOf(s.name)),ns.hashStruct("EIP712Domain",{EIP712Domain:n},e)}static encode(e,n,r){return $t(["0x1901",ns.hashDomain(e),ns.from(n).hash(r)])}static hash(e,n,r){return en(ns.encode(e,n,r))}static async resolveNames(e,n,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!St(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=ns.from(n);o.visit(r,(a,l)=>(a==="address"&&!St(l,20)&&(i[l]="0x"),l));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&i[l]?i[l]:l),{domain:e,value:r}}static getPayload(e,n,r){ns.hashDomain(e);const s={},i=[];Jx.forEach(l=>{const u=e[l];u!=null&&(s[l]=Dse[l](u),i.push({name:l,type:FR[l]}))});const o=ns.from(n);n=o.types;const a=Object.assign({},n);return $(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",n),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,u)=>{if(l.match(/^bytes(\d*)/))return Ae(ct(u));if(l.match(/^u?int/))return Ce(u).toString();switch(l){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return $(typeof u=="string","invalid string","value",u),u}$(!1,"unsupported type","type",l)})}}};mp=new WeakMap,fo=new WeakMap,Ef=new WeakMap,eb=new WeakSet,ML=function(e){{const s=Yx(e);if(s)return s}const n=ay(e).array;if(n){const s=n.prefix,i=this.getEncoder(s);return o=>{$(n.count===-1||n.count===o.length,`array length mismatch; expected length ${n.count}`,"value",o);let a=o.map(i);return T(this,fo).has(s)&&(a=a.map(en)),en($t(a))}}const r=this.types[e];if(r){const s=Ol(T(this,fo).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const u=this.getEncoder(l)(i[a]);return T(this,fo).has(l)?en(u):u});return o.unshift(s),$t(o)}}$(!1,`unknown type: ${e}`,"type",e)};let ly=ns;function Jn(t){const e=new Set;return t.forEach(n=>e.add(n)),Object.freeze(e)}const Ose=Jn("external public payable override".split(" ")),HR="constant external internal payable private public pure view override",Mse=Jn(HR.split(" ")),VR="constructor error event fallback function receive struct",zR=Jn(VR.split(" ")),$R="calldata memory storage payable indexed",Nse=Jn($R.split(" ")),_se=[VR,$R,"tuple returns",HR].join(" "),Rse=Jn(_se.split(" ")),Pse={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Ise=new RegExp("^(\\s*)"),Lse=new RegExp("^([0-9]+)"),Bse=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),GR=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),WR=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),tb=class tb{constructor(e){J(this,gp);J(this,Dn);J(this,_s);L(this,Dn,0),L(this,_s,e.slice())}get offset(){return T(this,Dn)}get length(){return T(this,_s).length-T(this,Dn)}clone(){return new tb(T(this,_s))}reset(){L(this,Dn,0)}popKeyword(e){const n=this.peek();if(n.type!=="KEYWORD"||!e.has(n.text))throw new Error(`expected keyword ${n.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const n=this.peek();throw new Error(`expected ${e}; got ${n.type} ${JSON.stringify(n.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=de(this,gp,Hk).call(this,T(this,Dn)+1,e.match+1);return L(this,Dn,e.match+1),n}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const n=[];for(;T(this,Dn)<e.match-1;){const r=this.peek().linkNext;n.push(de(this,gp,Hk).call(this,T(this,Dn)+1,r)),L(this,Dn,r)}return L(this,Dn,e.match+1),n}peek(){if(T(this,Dn)>=T(this,_s).length)throw new Error("out-of-bounds");return T(this,_s)[T(this,Dn)]}peekKeyword(e){const n=this.peekType("KEYWORD");return n!=null&&e.has(n)?n:null}peekType(e){if(this.length===0)return null;const n=this.peek();return n.type===e?n.text:null}pop(){const e=this.peek();return Tp(this,Dn)._++,e}toString(){const e=[];for(let n=T(this,Dn);n<T(this,_s).length;n++){const r=T(this,_s)[n];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Dn=new WeakMap,_s=new WeakMap,gp=new WeakSet,Hk=function(e=0,n=0){return new tb(T(this,_s).slice(e,n).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let Ts=tb;function aa(t){const e=[],n=o=>{const a=i<t.length?JSON.stringify(t[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<t.length;){let o=t.substring(i),a=o.match(Ise);a&&(i+=a[1].length,o=t.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let u=Pse[o[0]]||"";if(u){if(l.type=u,l.text=o[0],i++,u==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(u=="CLOSE_PAREN")r.length===0&&n("no matching open bracket"),l.match=r.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1;else if(u==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(u==="OPEN_BRACKET")l.type="BRACKET";else if(u==="CLOSE_BRACKET"){let c=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;c=f+c,e[e.length-1].value=Qe(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=c}continue}if(a=o.match(Bse),a){if(l.text=a[1],i+=l.text.length,Rse.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(WR)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(Lse),a){l.text=a[1],l.type="NUMBER",i+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new Ts(e.map(o=>Object.freeze(o)))}function qR(t,e){let n=[];for(const r in e.keys())t.has(r)&&n.push(r);if(n.length>1)throw new Error(`conflicting types: ${n.join(", ")}`)}function uy(t,e){if(e.peekKeyword(zR)){const n=e.pop().text;if(n!==t)throw new Error(`expected ${t}, got ${n}`)}return e.popType("ID")}function Wi(t,e){const n=new Set;for(;;){const r=t.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(t.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}function KR(t){let e=Wi(t,Mse);return qR(e,Jn("constant payable nonpayable".split(" "))),qR(e,Jn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function qi(t,e){return t.popParams().map(n=>En.from(n,e))}function QR(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Ce(t.pop().text);throw new Error("invalid gas")}return null}function _l(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const Fse=new RegExp(/^(.*)\[([0-9]*)\]$/);function JR(t){const e=t.match(WR);if($(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const n=parseInt(e[2]);$(n!==0&&n<=32,"invalid bytes length","type",t)}else if(e[3]){const n=parseInt(e[3]);$(n!==0&&n<=256&&n%8===0,"invalid numeric width","type",t)}return t}const Lt={},dr=Symbol.for("_ethers_internal"),YR="_ParamTypeInternal",XR="_ErrorInternal",ZR="_EventInternal",eP="_ConstructorInternal",tP="_FallbackInternal",nP="_FunctionInternal",rP="_StructInternal",rs=class rs{constructor(e,n,r,s,i,o,a,l){J(this,Cf);q(this,"name");q(this,"type");q(this,"baseType");q(this,"indexed");q(this,"components");q(this,"arrayLength");q(this,"arrayChildren");if(jg(e,Lt,"ParamType"),Object.defineProperty(this,dr,{value:YR}),o&&(o=Object.freeze(o.slice())),s==="array"){if(a==null||l==null)throw new Error("")}else if(a!=null||l!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");Me(this,{name:n,type:r,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=r,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let n="";return this.isArray()?(n+=this.arrayChildren.format(e),n+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?n+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":n+=this.type,e!=="sighash"&&(this.indexed===!0&&(n+=" indexed"),e==="full"&&this.name&&(n+=" "+this.name)),n}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,n){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,n))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,i)=>r.components[i].walk(s,n))}return n(this.type,e)}async walkAsync(e,n){const r=[],s=[e];return de(this,Cf,lb).call(this,r,e,n,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,n){if(rs.isParamType(e))return e;if(typeof e=="string")try{return rs.from(aa(e),n)}catch{$(!1,"invalid param type","obj",e)}else if(e instanceof Ts){let a="",l="",u=null;Wi(e,Jn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",u=e.popParams().map(m=>rs.from(m)),a=`tuple(${u.map(m=>m.format()).join(",")})`):(a=JR(e.popType("TYPE")),l=a);let c=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();c=new rs(Lt,"",a,l,null,u,f,c),f=m.value,a+=m.text,l="array",u=null}let d=null;if(Wi(e,Nse).has("indexed")){if(!n)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new rs(Lt,p,a,l,d,u,f,c)}const r=e.name;$(!r||typeof r=="string"&&r.match(GR),"invalid name","obj.name",r);let s=e.indexed;s!=null&&($(n,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(Fse);if(o){const a=parseInt(o[2]||"-1"),l=rs.from({type:o[1],components:e.components});return new rs(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(u=>rs.from(u)):null;return new rs(Lt,r||"",i,"tuple",s,a,null,null)}return i=JR(e.type),new rs(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[dr]===YR}};Cf=new WeakSet,lb=function(e,n,r,s){if(this.isArray()){if(!Array.isArray(n))throw new Error("invalid array value");if(this.arrayLength!==-1&&n.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=n.slice();a.forEach((l,u)=>{var c;de(c=o,Cf,lb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(n))a=n.slice();else{if(n==null||typeof n!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in n))throw new Error(`missing value for component ${l.name}`);return n[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,u)=>{var c;de(c=o[u],Cf,lb).call(c,e,l,r,f=>{a[u]=f})}),s(a);return}const i=r(this.type,n);i.then?e.push(async function(){s(await i)}()):s(i)};let En=rs;class Rl{constructor(e,n,r){q(this,"type");q(this,"inputs");jg(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Me(this,{type:n,inputs:r})}static from(e){if(typeof e=="string"){try{Rl.from(JSON.parse(e))}catch{}return Rl.from(aa(e))}if(e instanceof Ts)switch(e.peekKeyword(zR)){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return fi.from(e);case"fallback":case"receive":return Qi.from(e);case"function":return di.from(e);case"struct":return Pl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Ki.from(e);case"error":return hr.from(e);case"event":return fi.from(e);case"fallback":case"receive":return Qi.from(e);case"function":return di.from(e);case"struct":return Pl.from(e)}te(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}$(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Ki.isFragment(e)}static isError(e){return hr.isFragment(e)}static isEvent(e){return fi.isFragment(e)}static isFunction(e){return di.isFragment(e)}static isStruct(e){return Pl.isFragment(e)}}class cy extends Rl{constructor(n,r,s,i){super(n,r,i);q(this,"name");$(typeof s=="string"&&s.match(GR),"invalid identifier","name",s),i=Object.freeze(i.slice()),Me(this,{name:s})}}function zh(t,e){return"("+e.map(n=>n.format(t)).join(t==="full"?", ":",")+")"}class hr extends cy{constructor(e,n,r){super(e,"error",n,r),Object.defineProperty(this,dr,{value:XR})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const n=[];return e!=="sighash"&&n.push("error"),n.push(this.name+zh(e,this.inputs)),n.join(" ")}static from(e){if(hr.isFragment(e))return e;if(typeof e=="string")return hr.from(aa(e));if(e instanceof Ts){const n=uy("error",e),r=qi(e);return _l(e),new hr(Lt,n,r)}return new hr(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===XR}}class fi extends cy{constructor(n,r,s,i){super(n,"event",r,s);q(this,"anonymous");Object.defineProperty(this,dr,{value:ZR}),Me(this,{anonymous:i})}get topicHash(){return Ol(this.format("sighash"))}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("event"),r.push(this.name+zh(n,this.inputs)),n!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(n,r){return r=(r||[]).map(i=>En.from(i)),new fi(Lt,n,r,!1).topicHash}static from(n){if(fi.isFragment(n))return n;if(typeof n=="string")try{return fi.from(aa(n))}catch{$(!1,"invalid event fragment","obj",n)}else if(n instanceof Ts){const r=uy("event",n),s=qi(n,!0),i=!!Wi(n,Jn(["anonymous"])).has("anonymous");return _l(n),new fi(Lt,r,s,i)}return new fi(Lt,n.name,n.inputs?n.inputs.map(r=>En.from(r,!0)):[],!!n.anonymous)}static isFragment(n){return n&&n[dr]===ZR}}class Ki extends Rl{constructor(n,r,s,i,o){super(n,r,s);q(this,"payable");q(this,"gas");Object.defineProperty(this,dr,{value:eP}),Me(this,{payable:i,gas:o})}format(n){if(te(n!=null&&n!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),n==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n)))});const r=[`constructor${zh(n,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(n){if(Ki.isFragment(n))return n;if(typeof n=="string")try{return Ki.from(aa(n))}catch{$(!1,"invalid constuctor fragment","obj",n)}else if(n instanceof Ts){Wi(n,Jn(["constructor"]));const r=qi(n),s=!!Wi(n,Ose).has("payable"),i=QR(n);return _l(n),new Ki(Lt,"constructor",r,s,i)}return new Ki(Lt,"constructor",n.inputs?n.inputs.map(En.from):[],!!n.payable,n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===eP}}class Qi extends Rl{constructor(n,r,s){super(n,"fallback",r);q(this,"payable");Object.defineProperty(this,dr,{value:tP}),Me(this,{payable:s})}format(n){const r=this.inputs.length===0?"receive":"fallback";if(n==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(n){if(Qi.isFragment(n))return n;if(typeof n=="string")try{return Qi.from(aa(n))}catch{$(!1,"invalid fallback fragment","obj",n)}else if(n instanceof Ts){const r=n.toString(),s=n.peekKeyword(Jn(["fallback","receive"]));if($(s,"type must be fallback or receive","obj",r),n.popKeyword(Jn(["fallback","receive"]))==="receive"){const l=qi(n);return $(l.length===0,"receive cannot have arguments","obj.inputs",l),Wi(n,Jn(["payable"])),_l(n),new Qi(Lt,[],!0)}let o=qi(n);o.length?$(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[En.from("bytes")];const a=KR(n);if($(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Wi(n,Jn(["returns"])).has("returns")){const l=qi(n);$(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return _l(n),new Qi(Lt,o,a==="payable")}if(n.type==="receive")return new Qi(Lt,[],!0);if(n.type==="fallback"){const r=[En.from("bytes")],s=n.stateMutability==="payable";return new Qi(Lt,r,s)}$(!1,"invalid fallback description","obj",n)}static isFragment(n){return n&&n[dr]===tP}}class di extends cy{constructor(n,r,s,i,o,a){super(n,"function",r,i);q(this,"constant");q(this,"outputs");q(this,"stateMutability");q(this,"payable");q(this,"gas");Object.defineProperty(this,dr,{value:nP}),o=Object.freeze(o.slice()),Me(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return Ol(this.format("sighash")).substring(0,10)}format(n){if(n==null&&(n="sighash"),n==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(n))),outputs:this.outputs.map(s=>JSON.parse(s.format(n)))});const r=[];return n!=="sighash"&&r.push("function"),r.push(this.name+zh(n,this.inputs)),n!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(zh(n,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(n,r){return r=(r||[]).map(i=>En.from(i)),new di(Lt,n,"view",r,[],null).selector}static from(n){if(di.isFragment(n))return n;if(typeof n=="string")try{return di.from(aa(n))}catch{$(!1,"invalid function fragment","obj",n)}else if(n instanceof Ts){const s=uy("function",n),i=qi(n),o=KR(n);let a=[];Wi(n,Jn(["returns"])).has("returns")&&(a=qi(n));const l=QR(n);return _l(n),new di(Lt,s,o,i,a,l)}let r=n.stateMutability;return r==null&&(r="payable",typeof n.constant=="boolean"?(r="view",n.constant||(r="payable",typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable"))):typeof n.payable=="boolean"&&!n.payable&&(r="nonpayable")),new di(Lt,n.name,r,n.inputs?n.inputs.map(En.from):[],n.outputs?n.outputs.map(En.from):[],n.gas!=null?n.gas:null)}static isFragment(n){return n&&n[dr]===nP}}class Pl extends cy{constructor(e,n,r){super(e,"struct",n,r),Object.defineProperty(this,dr,{value:rP})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Pl.from(aa(e))}catch{$(!1,"invalid struct fragment","obj",e)}else if(e instanceof Ts){const n=uy("struct",e),r=qi(e);return _l(e),new Pl(Lt,n,r)}return new Pl(Lt,e.name,e.inputs?e.inputs.map(En.from):[])}static isFragment(e){return e&&e[dr]===rP}}const Ds=new Map;Ds.set(0,"GENERIC_PANIC"),Ds.set(1,"ASSERT_FALSE"),Ds.set(17,"OVERFLOW"),Ds.set(18,"DIVIDE_BY_ZERO"),Ds.set(33,"ENUM_RANGE_ERROR"),Ds.set(34,"BAD_STORAGE_DATA"),Ds.set(49,"STACK_UNDERFLOW"),Ds.set(50,"ARRAY_RANGE_ERROR"),Ds.set(65,"OUT_OF_MEMORY"),Ds.set(81,"UNINITIALIZED_FUNCTION_CALL");const jse=new RegExp(/^bytes([0-9]*)$/),Use=new RegExp(/^(u?int)([0-9]*)$/);let Xx=null,sP=1024;function Hse(t,e,n,r){let s="missing revert data",i=null;const o=null;let a=null;if(n){s="execution reverted";const u=ct(n);if(n=Ae(n),u.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(u.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Ae(u.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],u.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(Ae(u.slice(0,4))==="0x4e487b71")try{const c=Number(r.decode(["uint256"],u.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[c]},i=`Panic due to ${Ds.get(c)||"UNKNOWN"}(${c})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?gt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=gt(e.from)),_t(s,"CALL_EXCEPTION",{action:t,data:n,reason:i,transaction:l,invocation:o,revert:a})}const nb=class nb{constructor(){J(this,wa)}getDefaultValue(e){const n=e.map(s=>de(this,wa,Kf).call(this,En.from(s)));return new Xg(n,"_").defaultValue()}encode(e,n){F_(n.length,e.length,"types/values length mismatch");const r=e.map(o=>de(this,wa,Kf).call(this,En.from(o))),s=new Xg(r,"_"),i=new px;return s.encode(i,n),i.data}decode(e,n,r){const s=e.map(o=>de(this,wa,Kf).call(this,En.from(o)));return new Xg(s,"_").decode(new mx(n,r,sP))}static _setDefaultMaxInflation(e){$(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),sP=e}static defaultAbiCoder(){return Xx==null&&(Xx=new nb),Xx}static getBuiltinCallException(e,n,r){return Hse(e,n,r,nb.defaultAbiCoder())}};wa=new WeakSet,Kf=function(e){if(e.isArray())return new dre(de(this,wa,Kf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new Xg(e.components.map(r=>de(this,wa,Kf).call(this,r)),e.name);switch(e.baseType){case"address":return new cre(e.name);case"bool":return new hre(e.name);case"string":return new xre(e.name);case"bytes":return new pre(e.name);case"":return new yre(e.name)}let n=e.type.match(Use);if(n){let r=parseInt(n[2]||"256");return $(r!==0&&r<=256&&r%8===0,"invalid "+n[1]+" bit length","param",e),new vre(r/8,n[1]==="int",e.name)}if(n=e.type.match(jse),n){let r=parseInt(n[1]);return $(r!==0&&r<=32,"invalid bytes length","param",e),new mre(r,e.name)}$(!1,"invalid type","type",e.type)};let Fc=nb;class Vse{constructor(e,n,r){q(this,"fragment");q(this,"name");q(this,"signature");q(this,"topic");q(this,"args");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,signature:i,topic:n,args:r})}}class zse{constructor(e,n,r,s){q(this,"fragment");q(this,"name");q(this,"args");q(this,"signature");q(this,"selector");q(this,"value");const i=e.name,o=e.format();Me(this,{fragment:e,name:i,args:r,signature:o,selector:n,value:s})}}class $se{constructor(e,n,r){q(this,"fragment");q(this,"name");q(this,"args");q(this,"signature");q(this,"selector");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,args:r,signature:i,selector:n})}}class iP{constructor(e){q(this,"hash");q(this,"_isIndexed");Me(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const oP={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},aP={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&oP[t.toString()]&&(e=oP[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}},su=class su{constructor(e){J(this,wi);q(this,"fragments");q(this,"deploy");q(this,"fallback");q(this,"receive");J(this,gi);J(this,yi);J(this,bi);J(this,Ln);let n=[];typeof e=="string"?n=JSON.parse(e):n=e,L(this,bi,new Map),L(this,gi,new Map),L(this,yi,new Map);const r=[];for(const o of n)try{r.push(Rl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Me(this,{fragments:Object.freeze(r)});let s=null,i=!1;L(this,Ln,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Me(this,{deploy:o});return;case"fallback":o.inputs.length===0?i=!0:($(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${a}]`,o),s=o,i=s.payable);return;case"function":l=T(this,bi);break;case"event":l=T(this,yi);break;case"error":l=T(this,gi);break;default:return}const u=o.format();l.has(u)||l.set(u,o)}),this.deploy||Me(this,{deploy:Ki.from("constructor()")}),Me(this,{fallback:s,receive:i})}format(e){const n=e?"minimal":"full";return this.fragments.map(s=>s.format(n))}formatJson(){const e=this.fragments.map(n=>n.format("json"));return JSON.stringify(e.map(n=>JSON.parse(n)))}getAbiCoder(){return Fc.defaultAbiCoder()}getFunctionName(e){const n=de(this,wi,ub).call(this,e,null,!1);return $(n,"no matching function","key",e),n.name}hasFunction(e){return!!de(this,wi,ub).call(this,e,null,!1)}getFunction(e,n){return de(this,wi,ub).call(this,e,n||null,!0)}forEachFunction(e){const n=Array.from(T(this,bi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,bi).get(s),r)}}getEventName(e){const n=de(this,wi,cb).call(this,e,null,!1);return $(n,"no matching event","key",e),n.name}hasEvent(e){return!!de(this,wi,cb).call(this,e,null,!1)}getEvent(e,n){return de(this,wi,cb).call(this,e,n||null,!0)}forEachEvent(e){const n=Array.from(T(this,yi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,yi).get(s),r)}}getError(e,n){if(St(e)){const s=e.toLowerCase();if(aP[s])return hr.from(aP[s].signature);for(const i of T(this,gi).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,gi))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?hr.from("error Error(string)"):e==="Panic"?hr.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");$(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=hr.from(e).format(),e==="Error(string)")return hr.from("error Error(string)");if(e==="Panic(uint256)")return hr.from("error Panic(uint256)");const r=T(this,gi).get(e);return r||null}forEachError(e){const n=Array.from(T(this,gi).keys());n.sort((r,s)=>r.localeCompare(s));for(let r=0;r<n.length;r++){const s=n[r];e(T(this,gi).get(s),r)}}_decodeParams(e,n){return T(this,Ln).decode(e,n)}_encodeParams(e,n){return T(this,Ln).encode(e,n)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $(Vt(n,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",n),this._decodeParams(e.inputs,Vt(n,4))}encodeErrorResult(e,n){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $(Vt(n,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",n),this._decodeParams(e.inputs,Vt(n,4))}encodeFunctionData(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $t([e.selector,this._encodeParams(e.inputs,n||[])])}decodeFunctionResult(e,n){if(typeof e=="string"){const i=this.getFunction(e);$(i,"unknown function","fragment",e),e=i}let r="invalid length for result data";const s=Gn(n);if(s.length%32===0)try{return T(this,Ln).decode(e.outputs,s)}catch{r="could not decode result data"}te(!1,r,"BAD_DATA",{value:Ae(s),info:{method:e.name,signature:e.format()}})}makeError(e,n){const r=ct(e,"data"),s=Fc.getBuiltinCallException("call",n,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const a=Ae(r.slice(0,4)),l=this.getError(a);if(l)try{const u=T(this,Ln).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:u},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(n);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,n){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return Ae(T(this,Ln).encode(e.outputs,n||[]))}encodeFilterTopics(e,n){if(typeof e=="string"){const i=this.getEvent(e);$(i,"unknown event","eventFragment",e),e=i}te(n.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:n.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?Ol(o):i.type==="bytes"?en(Ae(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=Zo(o):i.type.match(/^bytes/)?o=Ete(o,32):i.type==="address"&&T(this,Ln).encode(["address"],[o]),xl(Ae(o),32));for(n.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){$(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?$(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?r.push(i.map(l=>s(a,l))):r.push(s(a,i))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,n){if(typeof e=="string"){const o=this.getEvent(e);$(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],i=[];return e.anonymous||r.push(e.topicHash),$(n.length===e.inputs.length,"event arguments/values mismatch","values",n),e.inputs.forEach((o,a)=>{const l=n[a];if(o.indexed)if(o.type==="string")r.push(Ol(l));else if(o.type==="bytes")r.push(en(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Ln).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Ln).encode(s,i),topics:r}}decodeEventLog(e,n,r){if(typeof e=="string"){const h=this.getEvent(e);$(h,"unknown event","eventFragment",e),e=h}if(r!=null&&!e.anonymous){const h=e.topicHash;$(St(r[0],32)&&r[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(En.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=r!=null?T(this,Ln).decode(s,$t(r)):null,l=T(this,Ln).decode(i,n,!0),u=[],c=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new iP(null);else if(o[p])m=new iP(a[d++]);else try{m=a[d++]}catch(g){m=g}else try{m=l[f++]}catch(g){m=g}u.push(m),c.push(h.name||null)}),Tc.fromItems(u,c)}parseTransaction(e){const n=ct(e.data,"tx.data"),r=Ce(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Ae(n.slice(0,4)));if(!s)return null;const i=T(this,Ln).decode(s.inputs,n.slice(4));return new zse(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const n=this.getEvent(e.topics[0]);return!n||n.anonymous?null:new Vse(n,n.topicHash,this.decodeEventLog(n,e.data,e.topics))}parseError(e){const n=Ae(e),r=this.getError(Vt(n,0,4));if(!r)return null;const s=T(this,Ln).decode(r.inputs,Vt(n,4));return new $se(r,r.selector,s)}static from(e){return e instanceof su?e:typeof e=="string"?new su(JSON.parse(e)):typeof e.formatJson=="function"?new su(e.formatJson()):typeof e.format=="function"?new su(e.format("json")):new su(e)}};gi=new WeakMap,yi=new WeakMap,bi=new WeakMap,Ln=new WeakMap,wi=new WeakSet,ub=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,bi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,bi))o.split("(")[0]===e&&i.push(a);if(n){const o=n.length>0?n[n.length-1]:null;let a=n.length,l=!0;Rn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let u=i.length-1;u>=0;u--){const c=i[u].inputs.length;c!==a&&(!l||c!==a-1)&&i.splice(u,1)}for(let u=i.length-1;u>=0;u--){const c=i[u].inputs;for(let f=0;f<n.length;f++)if(Rn.isTyped(n[f])){if(f>=c.length){if(n[f].type==="overrides")continue;i.splice(u,1);break}if(n[f].type!==c[f].baseType){i.splice(u,1);break}}}}if(i.length===1&&n&&n.length!==i[0].inputs.length){const o=n[n.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,bi).get(di.from(e).format());return s||null},cb=function(e,n,r){if(St(e)){const i=e.toLowerCase();for(const o of T(this,yi).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,yi))o.split("(")[0]===e&&i.push(a);if(n){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<n.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<n.length;l++)if(Rn.isTyped(n[l])&&n[l].type!==a[l].baseType){i.splice(o,1);break}}}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");$(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,yi).get(fi.from(e).format());return s||null};let Zx=su;const lP=BigInt(0);function jc(t){return t??null}function qt(t){return t==null?null:t.toString()}class uP{constructor(e,n,r){q(this,"gasPrice");q(this,"maxFeePerGas");q(this,"maxPriorityFeePerGas");Me(this,{gasPrice:jc(e),maxFeePerGas:jc(n),maxPriorityFeePerGas:jc(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:n,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:qt(e),maxFeePerGas:qt(n),maxPriorityFeePerGas:qt(r)}}}function fy(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Ae(t.data));const n="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of n)!(s in t)||t[s]==null||(e[s]=Ce(t[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in t)||t[s]==null||(e[s]=Qe(t[s],`request.${s}`));return t.accessList&&(e.accessList=oa(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(s=>ux(s)?Ae(s):Object.assign({},s))),e}class Gse{constructor(e,n){q(this,"provider");q(this,"number");q(this,"hash");q(this,"timestamp");q(this,"parentHash");q(this,"parentBeaconBlockRoot");q(this,"nonce");q(this,"difficulty");q(this,"gasLimit");q(this,"gasUsed");q(this,"stateRoot");q(this,"receiptsRoot");q(this,"blobGasUsed");q(this,"excessBlobGas");q(this,"miner");q(this,"prevRandao");q(this,"extraData");q(this,"baseFeePerGas");J(this,ho);L(this,ho,e.transactions.map(r=>typeof r!="string"?new Gh(r,n):r)),Me(this,{provider:n,hash:jc(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:jc(e.prevRandao),extraData:e.extraData,baseFeePerGas:jc(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,ho).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,ho).slice();return e.length===0?[]:(te(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:n,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:g}=this;return{_type:"Block",baseFeePerGas:qt(e),difficulty:qt(n),extraData:r,gasLimit:qt(s),gasUsed:qt(i),blobGasUsed:qt(this.blobGasUsed),excessBlobGas:qt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:u,number:c,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:g}}[Symbol.iterator](){let e=0;const n=this.transactions;return{next:()=>e<this.length?{value:n[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,ho).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let n;if(typeof e=="number")n=T(this,ho)[e];else{const r=e.toLowerCase();for(const s of T(this,ho))if(typeof s=="string"){if(s!==r)continue;n=s;break}else{if(s.hash===r)continue;n=s;break}}if(n==null)throw new Error("no such tx");return typeof n=="string"?await this.provider.getTransaction(n):n}getPrefetchedTransaction(e){const n=this.prefetchedTransactions;if(typeof e=="number")return n[e];e=e.toLowerCase();for(const r of n)if(r.hash===e)return r;$(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Wse(this)}}ho=new WeakMap;class $h{constructor(e,n){q(this,"provider");q(this,"transactionHash");q(this,"blockHash");q(this,"blockNumber");q(this,"removed");q(this,"address");q(this,"data");q(this,"topics");q(this,"index");q(this,"transactionIndex");this.provider=n;const r=Object.freeze(e.topics.slice());Me(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}=this;return{_type:"log",address:e,blockHash:n,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:u}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return te(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return te(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return te(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return qse(this)}}class cP{constructor(e,n){q(this,"provider");q(this,"to");q(this,"from");q(this,"contractAddress");q(this,"hash");q(this,"index");q(this,"blockHash");q(this,"blockNumber");q(this,"logsBloom");q(this,"gasUsed");q(this,"blobGasUsed");q(this,"cumulativeGasUsed");q(this,"gasPrice");q(this,"blobGasPrice");q(this,"type");q(this,"status");q(this,"root");J(this,yp);L(this,yp,Object.freeze(e.logs.map(s=>new $h(s,n))));let r=lP;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Me(this,{provider:n,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return T(this,yp)}toJSON(){const{to:e,from:n,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:u,status:c,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:qt(this.cumulativeGasUsed),from:n,gasPrice:qt(this.gasPrice),blobGasUsed:qt(this.blobGasUsed),blobGasPrice:qt(this.blobGasPrice),gasUsed:qt(this.gasUsed),hash:s,index:i,logs:u,logsBloom:l,root:f,status:c,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return dP(this)}reorderedEvent(e){return te(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),fP(this,e)}}yp=new WeakMap;const _k=class _k{constructor(e,n){q(this,"provider");q(this,"blockNumber");q(this,"blockHash");q(this,"index");q(this,"hash");q(this,"type");q(this,"to");q(this,"from");q(this,"nonce");q(this,"gasLimit");q(this,"gasPrice");q(this,"maxPriorityFeePerGas");q(this,"maxFeePerGas");q(this,"maxFeePerBlobGas");q(this,"data");q(this,"value");q(this,"chainId");q(this,"signature");q(this,"accessList");q(this,"blobVersionedHashes");J(this,Aa);this.provider=n,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,L(this,Aa,-1)}toJSON(){const{blockNumber:e,blockHash:n,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:u,signature:c,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:n,blobVersionedHashes:d,chainId:qt(this.chainId),data:u,from:a,gasLimit:qt(this.gasLimit),gasPrice:qt(this.gasPrice),hash:s,maxFeePerGas:qt(this.maxFeePerGas),maxPriorityFeePerGas:qt(this.maxPriorityFeePerGas),maxFeePerBlobGas:qt(this.maxFeePerBlobGas),nonce:l,signature:c,to:o,index:r,type:i,value:qt(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const n=this.provider.getBlock(e);if(n==null)throw new Error("TODO");return n}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:n,blockNumber:r}=await _n({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return n==null||n.blockNumber==null?0:r-n.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,n){const r=e??1,s=n??0;let i=T(this,Aa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await _n({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h<this.nonce){i=d;return}if(a)return null;const p=await this.getTransaction();if(!(p&&p.blockNumber!=null))for(o===-1&&(o=i-3,o<T(this,Aa)&&(o=T(this,Aa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const g of m)if(g===this.hash)return;for(let g=0;g<m.length;g++){const b=await m.getTransaction(g);if(b.from===this.from&&b.nonce===this.nonce){if(a)return null;const v=await this.provider.getTransactionReceipt(b.hash);if(v==null||d-v.blockNumber+1<r)return;let A="replaced";b.data===this.data&&b.to===this.to&&b.value===this.value?A="repriced":b.data==="0x"&&b.from===b.to&&b.value===lP&&(A="cancelled"),te(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:A==="replaced"||A==="cancelled",reason:A,replacement:b.replaceableTransaction(i),hash:b.hash,receipt:v})}}o++}},u=d=>{if(d==null||d.status!==0)return d;te(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},c=await this.provider.getTransactionReceipt(this.hash);if(r===0)return u(c);if(c){if(await c.confirmations()>=r)return u(c)}else if(await l(),r===0)return null;return await new Promise((d,h)=>{const p=[],m=()=>{p.forEach(b=>b())};if(p.push(()=>{a=!0}),s>0){const b=setTimeout(()=>{m(),h(_t("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(b)})}const g=async b=>{if(await b.confirmations()>=r){m();try{d(u(b))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,g)}),this.provider.on(this.hash,g),i>=0){const b=async()=>{try{await l()}catch(v){if(gn(v,"TRANSACTION_REPLACED")){m(),h(v);return}}a||this.provider.once("block",b)};p.push(()=>{this.provider.off("block",b)}),this.provider.once("block",b)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return te(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),dP(this)}reorderedEvent(e){return te(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),te(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),fP(this,e)}replaceableTransaction(e){$(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const n=new _k(this,this.provider);return L(n,Aa,e),n}};Aa=new WeakMap;let Gh=_k;function Wse(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function fP(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function dP(t){return{orphan:"drop-transaction",tx:t}}function qse(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class e2 extends $h{constructor(n,r,s){super(n,n.provider);q(this,"interface");q(this,"fragment");q(this,"args");const i=r.decodeEventLog(s,n.data,n.topics);Me(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class hP extends $h{constructor(n,r){super(n,n.provider);q(this,"error");Me(this,{error:r})}}class Kse extends cP{constructor(n,r,s){super(s,r);J(this,Sf);L(this,Sf,n)}get logs(){return super.logs.map(n=>{const r=n.topics.length?T(this,Sf).getEvent(n.topics[0]):null;if(r)try{return new e2(n,T(this,Sf),r)}catch(s){return new hP(n,s)}return n})}}Sf=new WeakMap;class t2 extends Gh{constructor(n,r,s){super(s,r);J(this,bp);L(this,bp,n)}async wait(n,r){const s=await super.wait(n,r);return s==null?null:new Kse(T(this,bp),this.provider,s)}}bp=new WeakMap;class pP extends W_{constructor(n,r,s,i){super(n,r,s);q(this,"log");Me(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Qse extends pP{constructor(e,n,r,s,i){super(e,n,r,new e2(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Me(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const mP=BigInt(0);function gP(t){return t&&typeof t.call=="function"}function yP(t){return t&&typeof t.estimateGas=="function"}function dy(t){return t&&typeof t.resolveName=="function"}function bP(t){return t&&typeof t.sendTransaction=="function"}function wP(t){if(t!=null){if(dy(t))return t;if(t.provider)return t.provider}}class Jse{constructor(e,n,r){J(this,wp);q(this,"fragment");if(Me(this,{fragment:n}),n.inputs.length<r.length)throw new Error("too many arguments");const s=Il(e.runner,"resolveName"),i=dy(s)?s:null;L(this,wp,async function(){const o=await Promise.all(n.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(c,f)=>c==="address"?Array.isArray(f)?Promise.all(f.map(d=>Qn(d,i))):Qn(f,i):f)));return e.interface.encodeFilterTopics(n,o)}())}getTopicFilter(){return T(this,wp)}}wp=new WeakMap;function Il(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function Ll(t){return t==null?null:t.provider||null}async function AP(t,e){const n=Rn.dereference(t,"overrides");$(typeof n=="object","invalid overrides parameter","overrides",t);const r=fy(n);return $(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),$(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function Yse(t,e,n){const r=Il(t,"resolveName"),s=dy(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(n[o],(a,l)=>(l=Rn.dereference(l,a),a==="address"?Qn(l,s):l))))}function Xse(t){const e=async function(o){const a=await AP(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await Qn(a.from,wP(t.runner)));const l=t.interface,u=Ce(a.value||mP,"overrides.value")===mP,c=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!c&&!u&&$(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return $(f||u,"cannot send value to non-payable fallback","overrides.value",a.value),$(l.fallback||c,"cannot send data to receive-only contract","overrides.data",a.data),a},n=async function(o){const a=Il(t.runner,"call");te(gP(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(u){throw lx(u)&&u.data?t.interface.makeError(u.data,l):u}},r=async function(o){const a=t.runner;te(bP(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),u=Ll(t.runner);return new t2(t.interface,u,l)},s=async function(o){const a=Il(t.runner,"estimateGas");return te(yP(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},i=async o=>await r(o);return Me(i,{_contract:t,estimateGas:s,populateTransaction:e,send:r,staticCall:n}),i}function Zse(t,e){const n=function(...u){const c=t.interface.getFunction(e,u);return te(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:u}}),c},r=async function(...u){const c=n(...u);let f={};if(c.inputs.length+1===u.length&&(f=await AP(u.pop()),f.from&&(f.from=await Qn(f.from,wP(t.runner)))),c.inputs.length!==u.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await Yse(t.runner,c.inputs,u);return Object.assign({},f,await _n({to:t.getAddress(),data:t.interface.encodeFunctionData(c,d)}))},s=async function(...u){const c=await a(...u);return c.length===1?c[0]:c},i=async function(...u){const c=t.runner;te(bP(c),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await c.sendTransaction(await r(...u)),d=Ll(t.runner);return new t2(t.interface,d,f)},o=async function(...u){const c=Il(t.runner,"estimateGas");return te(yP(c),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await c.estimateGas(await r(...u))},a=async function(...u){const c=Il(t.runner,"call");te(gP(c),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...u);let d="0x";try{d=await c.call(f)}catch(p){throw lx(p)&&p.data?t.interface.makeError(p.data,f):p}const h=n(...u);return t.interface.decodeFunctionResult(h,d)},l=async(...u)=>n(...u).constant?await s(...u):await i(...u);return Me(l,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:n,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const u=t.interface.getFunction(e);return te(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),u}}),l}function eie(t,e){const n=function(...s){const i=t.interface.getEvent(e,s);return te(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},r=function(...s){return new Jse(t,n(...s),s)};return Me(r,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:n}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=t.interface.getEvent(e);return te(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const hy=Symbol.for("_ethersInternal_contract"),vP=new WeakMap;function tie(t,e){vP.set(t[hy],e)}function Rr(t){return vP.get(t[hy])}function nie(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function n2(t,e){let n,r=null;if(Array.isArray(e)){const i=function(o){if(St(o,32))return o;const a=t.interface.getEvent(o);return $(a,"unknown fragment","name",o),a.topicHash};n=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?n=[null]:typeof e=="string"?St(e,32)?n=[e]:(r=t.interface.getEvent(e),$(r,"unknown fragment","event",e),n=[r.topicHash]):nie(e)?n=await e.getTopicFilter():"fragment"in e?(r=e.fragment,n=[r.topicHash]):$(!1,"unknown event name","event",e);n=n.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=n.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:n}}async function Wh(t,e){const{subs:n}=Rr(t);return n.get((await n2(t,e)).tag)||null}async function xP(t,e,n){const r=Ll(t.runner);te(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await n2(t,n),{addr:a,subs:l}=Rr(t);let u=l.get(i);if(!u){const f={address:a||t,topics:o},d=g=>{let b=s;if(b==null)try{b=t.interface.getEvent(g.topics[0])}catch{}if(b){const v=b,A=s?t.interface.decodeEventLog(s,g.data,g.topics):[];s2(t,n,A,w=>new Qse(t,w,n,v,g))}else s2(t,n,[],v=>new pP(t,v,n,g))};let h=[];u={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let g=h;h=[],await Promise.all(g),r.off(f,d)}},l.set(i,u)}return u}let r2=Promise.resolve();async function rie(t,e,n,r){await r2;const s=await Wh(t,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(n);r&&l.push(r(a?null:o));try{o.call(t,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Rr(t).subs.delete(s.tag)),i>0}async function s2(t,e,n,r){try{await r2}catch{}const s=rie(t,e,n,r);return r2=s,await s}const py=["then"];EL=hy;const Ap=class Ap{constructor(e,n,r,s){q(this,"target");q(this,"interface");q(this,"runner");q(this,"filters");q(this,EL);q(this,"fallback");$(typeof e=="string"||nR(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=Zx.from(n);Me(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,hy,{value:{}});let o,a=null,l=null;if(s){const f=Ll(r);l=new t2(this.interface,f,s)}let u=new Map;if(typeof e=="string")if(St(e))a=e,o=Promise.resolve(e);else{const f=Il(r,"resolveName");if(!dy(f))throw _t("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw _t("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Rr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Rr(this).addr=f,f});tie(this,{addrPromise:o,addr:a,deployTx:l,subs:u});const c=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||py.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>py.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Me(this,{filters:c}),Me(this,{fallback:i.receive||i.fallback?Xse(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||py.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!gn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||py.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Ap(this.target,this.interface,e)}attach(e){return new Ap(e,this.interface,this.runner)}async getAddress(){return await Rr(this).addrPromise}async getDeployedCode(){const e=Ll(this.runner);te(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const n=await e.getCode(await this.getAddress());return n==="0x"?null:n}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Ll(this.runner);return te(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return Rr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),Zse(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),eie(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,n,r){n==null&&(n=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Rr(this),o=s||await i,{fragment:a,topics:l}=await n2(this,e),u={address:o,topics:l,fromBlock:n,toBlock:r},c=Ll(this.runner);return te(c,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await c.getLogs(u)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new e2(f,this.interface,d)}catch(h){return new hP(f,h)}return new $h(f,c)})}async on(e,n){const r=await xP(this,"on",e);return r.listeners.push({listener:n,once:!1}),r.start(),this}async once(e,n){const r=await xP(this,"once",e);return r.listeners.push({listener:n,once:!0}),r.start(),this}async emit(e,...n){return await s2(this,e,n,null)}async listenerCount(e){if(e){const s=await Wh(this,e);return s?s.listeners.length:0}const{subs:n}=Rr(this);let r=0;for(const{listeners:s}of n.values())r+=s.length;return r}async listeners(e){if(e){const s=await Wh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:n}=Rr(this);let r=[];for(const{listeners:s}of n.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,n){const r=await Wh(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(n==null||r.listeners.length===0)&&(r.stop(),Rr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const n=await Wh(this,e);if(!n)return this;n.stop(),Rr(this).subs.delete(n.tag)}else{const{subs:n}=Rr(this);for(const{tag:r,stop:s}of n.values())s(),n.delete(r)}return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return await this.off(e,n)}static buildClass(e){class n extends Ap{constructor(s,i=null){super(s,e,i)}}return n}static from(e,n,r){return r==null&&(r=null),new this(e,n,r)}};let i2=Ap;function sie(){return i2}class Uc extends sie(){}function o2(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):$(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class iie{constructor(e){q(this,"name");Me(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,n){throw new Error("unsupported coin")}async decodeAddress(e,n){throw new Error("unsupported coin")}}const kP=new RegExp("^(ipfs)://(.*)$","i"),EP=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),kP,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],Tf=class Tf{constructor(e,n,r){J(this,xa);q(this,"provider");q(this,"address");q(this,"name");J(this,va);J(this,iu);Me(this,{provider:e,address:n,name:r}),L(this,va,null),L(this,iu,new Uc(n,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return T(this,va)==null&&L(this,va,(async()=>{try{return await T(this,iu).supportsInterface("0x9061b923")}catch(e){if(gn(e,"CALL_EXCEPTION"))return!1;throw L(this,va,null),e}})()),await T(this,va)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await de(this,xa,Qf).call(this,"addr(bytes32)");return i==null||i===Rh?null:i}catch(i){if(gn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await de(this,xa,Qf).call(this,"addr(bytes32,uint)",[i]);if(St(o,20))return gt(o)}let n=null;for(const i of this.provider.plugins)if(i instanceof iie&&i.supportsCoinType(e)){n=i;break}if(n==null)return null;const r=await de(this,xa,Qf).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await n.decodeAddress(e,r);if(s!=null)return s;te(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const n=await de(this,xa,Qf).call(this,"text(bytes32,string)",[e]);return n==null||n==="0x"?null:n}async getContentHash(){const e=await de(this,xa,Qf).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const n=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const s=n[1]==="e3010170"?"ipfs":"ipns",i=parseInt(n[4],16);if(n[5].length===i*2)return`${s}://${Tte("0x"+n[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;te(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const n=await this.getText("avatar");if(n==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:n});for(let r=0;r<EP.length;r++){const s=n.match(EP[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:n}),{linkage:e,url:n};case"ipfs":{const o=o2(n);return e.push({type:"ipfs",value:n}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=i==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:i,value:n});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(s[2]||"").split("/");if(l.length!==2)return e.push({type:`!${i}caip`,value:s[2]||""}),{url:null,linkage:e};const u=l[1],c=new Uc(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(i==="erc721"){const m=await c.ownerOf(u);if(a!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(i==="erc1155"){const m=await c.balanceOf(a,u);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await c[o](u);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),i==="erc1155"&&(f=f.replace("{id}",Zo(u,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=o2(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new qn(f).send();h.assertOk();try{d=h.bodyJson}catch{try{e.push({type:"!metadata",value:h.bodyText})}catch{const b=h.body;return b&&e.push({type:"!metadata",value:Ae(b)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!d)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(d)});let p=d.image;if(typeof p!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(kP)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=o2(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const n=await e.getNetwork(),r=n.getPlugin("org.ethers.plugins.network.Ens");return te(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:n}}),r.address}static async fromName(e,n){var s;let r=n;for(;;){if(r===""||r==="."||n!=="eth"&&r==="eth")return null;const i=await de(s=Tf,rb,NL).call(s,e,r);if(i!=null){const o=new Tf(e,i,n);return r!==n&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};va=new WeakMap,iu=new WeakMap,xa=new WeakSet,Qf=async function(e,n){n=(n||[]).slice();const r=T(this,iu).interface;n.unshift($x(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),te(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),n=[ose(this.name,255),r.encodeFunctionData(s,n)],e="resolve(bytes,bytes)"),n.push({enableCcipRead:!0});try{const i=await T(this,iu)[e](...n);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!gn(i,"CALL_EXCEPTION"))throw i}return null},rb=new WeakSet,NL=async function(e,n){const r=await Tf.getEnsAddress(e);try{const i=await new Uc(r,["function resolver(bytes32) view returns (address)"],e).resolver($x(n),{enableCcipRead:!0});return i===Rh?null:i}catch(s){throw s}return null},J(Tf,rb);let my=Tf;const CP=BigInt(0);function lt(t,e){return function(n){return n==null?e:t(n)}}function gy(t,e){return n=>{if(e&&n==null)return null;if(!Array.isArray(n))throw new Error("not an array");return n.map(r=>t(r))}}function qh(t,e){return n=>{const r={};for(const s in t){let i=s;if(e&&s in e&&!(i in n)){for(const o of e[s])if(o in n){i=o;break}}try{const o=t[s](n[i]);o!==void 0&&(r[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";te(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:n})}}return r}}function oie(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}$(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function Hc(t){return $(St(t,!0),"invalid data","value",t),t}function Cn(t){return $(St(t,32),"invalid hash","value",t),t}const aie=qh({address:gt,blockHash:Cn,blockNumber:Qe,data:Hc,index:Qe,removed:lt(oie,!1),topics:gy(Cn),transactionHash:Cn,transactionIndex:Qe},{index:["logIndex"]});function lie(t){return aie(t)}const uie=qh({hash:lt(Cn),parentHash:Cn,parentBeaconBlockRoot:lt(Cn,null),number:Qe,timestamp:Qe,nonce:lt(Hc),difficulty:Ce,gasLimit:Ce,gasUsed:Ce,stateRoot:lt(Cn,null),receiptsRoot:lt(Cn,null),blobGasUsed:lt(Ce,null),excessBlobGas:lt(Ce,null),miner:lt(gt),prevRandao:lt(Cn,null),extraData:Hc,baseFeePerGas:lt(Ce)},{prevRandao:["mixHash"]});function cie(t){const e=uie(t);return e.transactions=t.transactions.map(n=>typeof n=="string"?n:SP(n)),e}const fie=qh({transactionIndex:Qe,blockNumber:Qe,transactionHash:Cn,address:gt,topics:gy(Cn),data:Hc,index:Qe,blockHash:Cn},{index:["logIndex"]});function die(t){return fie(t)}const hie=qh({to:lt(gt,null),from:lt(gt,null),contractAddress:lt(gt,null),index:Qe,root:lt(Ae),gasUsed:Ce,blobGasUsed:lt(Ce,null),logsBloom:lt(Hc),blockHash:Cn,hash:Cn,logs:gy(die),blockNumber:Qe,cumulativeGasUsed:Ce,effectiveGasPrice:lt(Ce),blobGasPrice:lt(Ce,null),status:lt(Qe),type:lt(Qe,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function pie(t){return hie(t)}function SP(t){t.to&&Ce(t.to)===CP&&(t.to="0x0000000000000000000000000000000000000000");const e=qh({hash:Cn,index:lt(Qe,void 0),type:n=>n==="0x"||n==null?0:Qe(n),accessList:lt(oa,null),blobVersionedHashes:lt(gy(Cn,!0),null),blockHash:lt(Cn,null),blockNumber:lt(Qe,null),transactionIndex:lt(Qe,null),from:gt,gasPrice:lt(Ce),maxPriorityFeePerGas:lt(Ce),maxFeePerGas:lt(Ce),maxFeePerBlobGas:lt(Ce,null),gasLimit:Ce,to:lt(gt,null),value:Ce,nonce:Qe,data:Hc,creates:lt(gt,null),chainId:lt(Ce,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=lre(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=Ss.from(t.signature):e.signature=Ss.from(t),e.chainId==null){const n=e.signature.legacyChainId;n!=null&&(e.chainId=n)}return e.blockHash&&Ce(e.blockHash)===CP&&(e.blockHash=null),e}const mie="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class Kh{constructor(e){q(this,"name");Me(this,{name:e})}clone(){return new Kh(this.name)}}class yy extends Kh{constructor(n,r){n==null&&(n=0);super(`org.ethers.network.plugins.GasCost#${n||0}`);q(this,"effectiveBlock");q(this,"txBase");q(this,"txCreate");q(this,"txDataZero");q(this,"txDataNonzero");q(this,"txAccessListStorageKey");q(this,"txAccessListAddress");const s={effectiveBlock:n};function i(o,a){let l=(r||{})[o];l==null&&(l=a),$(typeof l=="number",`invalud value for ${o}`,"costs",r),s[o]=l}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Me(this,s)}clone(){return new yy(this.effectiveBlock,this)}}class by extends Kh{constructor(n,r){super("org.ethers.plugins.network.Ens");q(this,"address");q(this,"targetNetwork");Me(this,{address:n||mie,targetNetwork:r??1})}clone(){return new by(this.address,this.targetNetwork)}}class gie extends Kh{constructor(n,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");J(this,vp);J(this,xp);L(this,vp,n),L(this,xp,r)}get url(){return T(this,vp)}get processFunc(){return T(this,xp)}clone(){return this}}vp=new WeakMap,xp=new WeakMap;const a2=new Map,Mf=class Mf{constructor(e,n){J(this,Df);J(this,Of);J(this,ka);L(this,Df,e),L(this,Of,Ce(n)),L(this,ka,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,Df)}set name(e){L(this,Df,e)}get chainId(){return T(this,Of)}set chainId(e){L(this,Of,Ce(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Ce(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Ce(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Ce(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(T(this,ka).values())}attachPlugin(e){if(T(this,ka).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,ka).set(e.name,e.clone()),this}getPlugin(e){return T(this,ka).get(e)||null}getPlugins(e){return this.plugins.filter(n=>n.name.split("#")[0]===e)}clone(){const e=new Mf(this.name,this.chainId);return this.plugins.forEach(n=>{e.attachPlugin(n.clone())}),e}computeIntrinsicGas(e){const n=this.getPlugin("org.ethers.plugins.network.GasCost")||new yy;let r=n.txBase;if(e.to==null&&(r+=n.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=n.txDataZero:r+=n.txDataNonzero;if(e.accessList){const s=oa(e.accessList);for(const i in s)r+=n.txAccessListAddress+n.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(yie(),e==null)return Mf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const n=a2.get(e);if(n)return n();if(typeof e=="bigint")return new Mf("unknown",e);$(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){$(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const n=new Mf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&n.attachPlugin(new by(e.ensAddress,e.ensNetwork)),n}$(!1,"invalid network","network",e)}static register(e,n){typeof e=="number"&&(e=BigInt(e));const r=a2.get(e);r&&$(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),a2.set(e,n)}};Df=new WeakMap,Of=new WeakMap,ka=new WeakMap;let rn=Mf;function TP(t,e){const n=String(t);if(!n.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${t}`);const r=n.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${t}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let s=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||s++,r[1]=s.toString()}return BigInt(r[0]+r[1])}function DP(t){return new gie(t,async(e,n,r)=>{r.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([r.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:TP(a.maxFee,9),maxPriorityFeePerGas:TP(a.maxPriorityFee,9)}}catch(i){te(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:i})}})}let OP=!1;function yie(){if(OP)return;OP=!0;function t(e,n,r){const s=function(){const i=new rn(e,n);return r.ensNetwork!=null&&i.attachPlugin(new by(null,r.ensNetwork)),i.attachPlugin(new yy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};rn.register(e,s),rn.register(n,s),r.altNames&&r.altNames.forEach(i=>{rn.register(i,s)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[DP("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[DP("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function l2(t){return JSON.parse(JSON.stringify(t))}class bie{constructor(e){J(this,Nf);J(this,po);J(this,ss);J(this,Ea);J(this,Ai);L(this,po,e),L(this,ss,null),L(this,Ea,4e3),L(this,Ai,-2)}get pollingInterval(){return T(this,Ea)}set pollingInterval(e){L(this,Ea,e)}start(){T(this,ss)||(L(this,ss,T(this,po)._setTimeout(de(this,Nf,fb).bind(this),T(this,Ea))),de(this,Nf,fb).call(this))}stop(){T(this,ss)&&(T(this,po)._clearTimeout(T(this,ss)),L(this,ss,null))}pause(e){this.stop(),e&&L(this,Ai,-2)}resume(){this.start()}}po=new WeakMap,ss=new WeakMap,Ea=new WeakMap,Ai=new WeakMap,Nf=new WeakSet,fb=async function(){try{const e=await T(this,po).getBlockNumber();if(T(this,Ai)===-2){L(this,Ai,e);return}if(e!==T(this,Ai)){for(let n=T(this,Ai)+1;n<=e;n++){if(T(this,ss)==null)return;await T(this,po).emit("block",n)}L(this,Ai,e)}}catch{}T(this,ss)!=null&&L(this,ss,T(this,po)._setTimeout(de(this,Nf,fb).bind(this),T(this,Ea)))};class u2{constructor(e){J(this,ou);J(this,au);J(this,Ca);L(this,ou,e),L(this,Ca,!1),L(this,au,n=>{this._poll(n,T(this,ou))})}async _poll(e,n){throw new Error("sub-classes must override this")}start(){T(this,Ca)||(L(this,Ca,!0),T(this,au).call(this,-2),T(this,ou).on("block",T(this,au)))}stop(){T(this,Ca)&&(L(this,Ca,!1),T(this,ou).off("block",T(this,au)))}pause(e){this.stop()}resume(){this.start()}}ou=new WeakMap,au=new WeakMap,Ca=new WeakMap;class wie extends u2{constructor(n,r){super(n);J(this,_f);J(this,mo);L(this,_f,r),L(this,mo,-2)}pause(n){n&&L(this,mo,-2),super.pause(n)}async _poll(n,r){const s=await r.getBlock(T(this,_f));s!=null&&(T(this,mo)===-2?L(this,mo,s.number):s.number>T(this,mo)&&(r.emit(T(this,_f),s.number),L(this,mo,s.number)))}}_f=new WeakMap,mo=new WeakMap;class Aie extends u2{constructor(n,r){super(n);J(this,sb);L(this,sb,l2(r))}async _poll(n,r){throw new Error("@TODO")}}sb=new WeakMap;class vie extends u2{constructor(n,r){super(n);J(this,Rf);L(this,Rf,r)}async _poll(n,r){const s=await r.getTransactionReceipt(T(this,Rf));s&&r.emit(T(this,Rf),s)}}Rf=new WeakMap;class c2{constructor(e,n){J(this,ib);J(this,go);J(this,Pf);J(this,If);J(this,Sa);J(this,is);L(this,go,e),L(this,Pf,l2(n)),L(this,If,de(this,ib,_L).bind(this)),L(this,Sa,!1),L(this,is,-2)}start(){T(this,Sa)||(L(this,Sa,!0),T(this,is)===-2&&T(this,go).getBlockNumber().then(e=>{L(this,is,e)}),T(this,go).on("block",T(this,If)))}stop(){T(this,Sa)&&(L(this,Sa,!1),T(this,go).off("block",T(this,If)))}pause(e){this.stop(),e&&L(this,is,-2)}resume(){this.start()}}go=new WeakMap,Pf=new WeakMap,If=new WeakMap,Sa=new WeakMap,is=new WeakMap,ib=new WeakSet,_L=async function(e){if(T(this,is)===-2)return;const n=l2(T(this,Pf));n.fromBlock=T(this,is)+1,n.toBlock=e;const r=await T(this,go).getLogs(n);if(r.length===0){T(this,is)<e-60&&L(this,is,e-60);return}for(const s of r)T(this,go).emit(T(this,Pf),s),L(this,is,s.blockNumber)};const xie=BigInt(2),kie=10;function wy(t){return t&&typeof t.then=="function"}function Ay(t,e){return t+":"+JSON.stringify(e,(n,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const s=Object.keys(r);return s.sort(),s.reduce((i,o)=>(i[o]=r[o],i),{})}return r})}class vy{constructor(e){q(this,"name");Me(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function Eie(t){return JSON.parse(JSON.stringify(t))}function f2(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function d2(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(St(t,32)){const n=t.toLowerCase();return{type:"transaction",tag:Ay("tx",{hash:n}),hash:n}}if(t.orphan){const n=t;return{type:"orphan",tag:Ay("orphan",n),filter:Eie(n)}}if(t.address||t.topics){const n=t,r={topics:(n.topics||[]).map(s=>s==null?null:Array.isArray(s)?f2(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(n.address){const s=[],i=[],o=a=>{St(a)?s.push(a):i.push((async()=>{s.push(await Qn(a,e))})())};Array.isArray(n.address)?n.address.forEach(o):o(n.address),i.length&&await Promise.all(i),r.address=f2(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Ay("event",r),type:"event"}}$(!1,"unknown ProviderEvent","event",t)}function h2(){return new Date().getTime()}const Cie={cacheTimeout:250,pollingInterval:4e3};class xy{constructor(e,n){J(this,st);J(this,Bn);J(this,Ta);J(this,Fn);J(this,Lf);J(this,Fr);J(this,lu);J(this,Da);J(this,yo);J(this,kp);J(this,as);J(this,Bf);J(this,Ff);if(L(this,Ff,Object.assign({},Cie,n||{})),e==="any")L(this,lu,!0),L(this,Fr,null);else if(e){const r=rn.from(e);L(this,lu,!1),L(this,Fr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else L(this,lu,!1),L(this,Fr,null);L(this,yo,-1),L(this,Da,new Map),L(this,Bn,new Map),L(this,Ta,new Map),L(this,Fn,null),L(this,Lf,!1),L(this,kp,1),L(this,as,new Map),L(this,Bf,!1)}get pollingInterval(){return T(this,Ff).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,Ta).values())}attachPlugin(e){if(T(this,Ta).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,Ta).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,Ta).get(e)||null}get disableCcipRead(){return T(this,Bf)}set disableCcipRead(e){L(this,Bf,!!e)}async ccipReadFetch(e,n,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=n.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],u=l.replace("{sender}",s).replace("{data}",i),c=new qn(u);l.indexOf("{data}")===-1&&(c.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:c,index:a,urls:r});let f="unknown error";const d=await c.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:c,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:c,result:h})}catch{}te(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:f}}),o.push(f)}te(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,n){return new Gse(cie(e),this)}_wrapLog(e,n){return new $h(lie(e),this)}_wrapTransactionReceipt(e,n){return new cP(pie(e),this)}_wrapTransactionResponse(e,n){return new Gh(SP(e),this)}_detectNetwork(){te(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){te(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Qe(await de(this,st,jr).call(this,{method:"getBlockNumber"}),"%response");return T(this,yo)>=0&&L(this,yo,e),e}_getAddress(e){return Qn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(St(e))return St(e,32)?e:kl(e);if(typeof e=="bigint"&&(e=Qe(e,"blockTag")),typeof e=="number")return e>=0?kl(e):T(this,yo)>=0?kl(T(this,yo)+e):this.getBlockNumber().then(n=>kl(n+e));$(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const n=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?f2(l.map(u=>u.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,u,c)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(u!=null||c!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),n.length&&(d.topics=n),u&&(d.fromBlock=u),c&&(d.toBlock=c),r&&(d.blockHash=r),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)i.push(this._getAddress(l));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(l=>s(l[0],l[1],l[2])):s(i,o,a)}_getTransactionRequest(e){const n=fy(e),r=[];if(["to","from"].forEach(s=>{if(n[s]==null)return;const i=Qn(n[s],this);wy(i)?r.push(async function(){n[s]=await i}()):n[s]=i}),n.blockTag!=null){const s=this._getBlockTag(n.blockTag);wy(s)?r.push(async function(){n.blockTag=await s}()):n.blockTag=s}return r.length?async function(){return await Promise.all(r),n}():n}async getNetwork(){if(T(this,Fr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Fr)===s&&L(this,Fr,null),i}})();return L(this,Fr,s),(await s).clone()}const e=T(this,Fr),[n,r]=await Promise.all([e,this._detectNetwork()]);return n.chainId!==r.chainId&&(T(this,lu)?(this.emit("network",r,n),T(this,Fr)===e&&L(this,Fr,Promise.resolve(r))):te(!1,`network changed: ${n.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),n.clone()}async getFeeData(){const e=await this.getNetwork(),n=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await _n({_block:de(this,st,$k).call(this,"latest",!1),gasPrice:(async()=>{try{const c=await de(this,st,jr).call(this,{method:"getGasPrice"});return Ce(c,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const c=await de(this,st,jr).call(this,{method:"getPriorityFee"});return Ce(c,"%response")}catch{}return null})()});let a=null,l=null;const u=this._wrapBlock(s,e);return u&&u.baseFeePerGas&&(l=o??BigInt("1000000000"),a=u.baseFeePerGas*xie+l),new uP(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new qn(r.url),i=await r.processFunc(n,this,s);return new uP(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await n()}async estimateGas(e){let n=this._getTransactionRequest(e);return wy(n)&&(n=await n),Ce(await de(this,st,jr).call(this,{method:"estimateGas",transaction:n}),"%response")}async call(e){const{tx:n,blockTag:r}=await _n({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await de(this,st,zk).call(this,de(this,st,Vk).call(this,n,r,e.enableCcipRead?0:-1))}async getBalance(e,n){return Ce(await de(this,st,Op).call(this,{method:"getBalance"},e,n),"%response")}async getTransactionCount(e,n){return Qe(await de(this,st,Op).call(this,{method:"getTransactionCount"},e,n),"%response")}async getCode(e,n){return Ae(await de(this,st,Op).call(this,{method:"getCode"},e,n))}async getStorage(e,n,r){const s=Ce(n,"position");return Ae(await de(this,st,Op).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:n,hash:r,network:s}=await _n({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=Vh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(n)}async getBlock(e,n){const{network:r,params:s}=await _n({network:this.getNetwork(),params:de(this,st,$k).call(this,e,!!n)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:n,params:r}=await _n({network:this.getNetwork(),params:de(this,st,jr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,n)}async getTransactionReceipt(e){const{network:n,params:r}=await _n({network:this.getNetwork(),params:de(this,st,jr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await de(this,st,jr).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(r,n)}async getTransactionResult(e){const{result:n}=await _n({network:this.getNetwork(),result:de(this,st,jr).call(this,{method:"getTransactionResult",hash:e})});return n==null?null:Ae(n)}async getLogs(e){let n=this._getFilter(e);wy(n)&&(n=await n);const{network:r,params:s}=await _n({network:this.getNetwork(),params:de(this,st,jr).call(this,{method:"getLogs",filter:n})});return s.map(i=>this._wrapLog(i,r))}_getProvider(e){te(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await my.fromName(this,e)}async getAvatar(e){const n=await this.getResolver(e);return n?await n.getAvatar():null}async resolveName(e){const n=await this.getResolver(e);return n?await n.getAddress():null}async lookupAddress(e){e=gt(e);const n=$x(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await my.getEnsAddress(this),i=await new Uc(r,["function resolver(bytes32) view returns (address)"],this).resolver(n);if(i==null||i===Rh)return null;const a=await new Uc(i,["function name(bytes32) view returns (string)"],this).name(n);return await this.resolveName(a)!==e?null:a}catch(r){if(gn(r,"BAD_DATA")&&r.value==="0x"||gn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,n,r){const s=n??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async u=>{try{const c=await this.getTransactionReceipt(e);if(c!=null&&u-c.blockNumber+1>=s){i(c),a&&(clearTimeout(a),a=null);return}}catch(c){console.log("EEE",c)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(_t("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){te(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const n=T(this,as).get(e);n&&(n.timer&&clearTimeout(n.timer),T(this,as).delete(e))}_setTimeout(e,n){n==null&&(n=0);const r=Tp(this,kp)._++,s=()=>{T(this,as).delete(r),e()};if(this.paused)T(this,as).set(r,{timer:null,func:s,time:n});else{const i=setTimeout(s,n);T(this,as).set(r,{timer:i,func:s,time:h2()})}return r}_forEachSubscriber(e){for(const n of T(this,Bn).values())e(n.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new vy(e.type);case"block":{const n=new bie(this);return n.pollingInterval=this.pollingInterval,n}case"safe":case"finalized":return new wie(this,e.type);case"event":return new c2(this,e.filter);case"transaction":return new vie(this,e.hash);case"orphan":return new Aie(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,n){for(const r of T(this,Bn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=n,r.started&&n.start(),T(this,Fn)!=null&&n.pause(T(this,Fn));break}}async on(e,n){const r=await de(this,st,db).call(this,e);return r.listeners.push({listener:n,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async once(e,n){const r=await de(this,st,db).call(this,e);return r.listeners.push({listener:n,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,Fn)!=null&&r.subscriber.pause(T(this,Fn))),this}async emit(e,...n){const r=await de(this,st,Mp).call(this,e,n);if(!r||r.listeners.length===0)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:i,once:o})=>{const a=new W_(this,o?null:i,e);try{i.call(this,...n,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await de(this,st,Mp).call(this,e);return r?r.listeners.length:0}let n=0;for(const{listeners:r}of T(this,Bn).values())n+=r.length;return n}async listeners(e){if(e){const r=await de(this,st,Mp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let n=[];for(const{listeners:r}of T(this,Bn).values())n=n.concat(r.map(({listener:s})=>s));return n}async off(e,n){const r=await de(this,st,Mp).call(this,e);if(!r)return this;if(n){const s=r.listeners.map(({listener:i})=>i).indexOf(n);s>=0&&r.listeners.splice(s,1)}return(!n||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Bn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:n,started:r,subscriber:s}=await de(this,st,db).call(this,e);r&&s.stop(),T(this,Bn).delete(n)}else for(const[n,{started:r,subscriber:s}]of T(this,Bn))r&&s.stop(),T(this,Bn).delete(n);return this}async addListener(e,n){return await this.on(e,n)}async removeListener(e,n){return this.off(e,n)}get destroyed(){return T(this,Lf)}destroy(){this.removeAllListeners();for(const e of T(this,as).keys())this._clearTimeout(e);L(this,Lf,!0)}get paused(){return T(this,Fn)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(L(this,yo,-1),T(this,Fn)!=null){if(T(this,Fn)==!!e)return;te(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(n=>n.pause(e)),L(this,Fn,!!e);for(const n of T(this,as).values())n.timer&&clearTimeout(n.timer),n.time=h2()-n.time}resume(){if(T(this,Fn)!=null){this._forEachSubscriber(e=>e.resume()),L(this,Fn,null);for(const e of T(this,as).values()){let n=e.time;n<0&&(n=0),e.time=h2(),setTimeout(e.func,n)}}}}Bn=new WeakMap,Ta=new WeakMap,Fn=new WeakMap,Lf=new WeakMap,Fr=new WeakMap,lu=new WeakMap,Da=new WeakMap,yo=new WeakMap,kp=new WeakMap,as=new WeakMap,Bf=new WeakMap,Ff=new WeakMap,st=new WeakSet,jr=async function(e){const n=T(this,Ff).cacheTimeout;if(n<0)return await this._perform(e);const r=Ay(e.method,e);let s=T(this,Da).get(r);return s||(s=this._perform(e),T(this,Da).set(r,s),setTimeout(()=>{T(this,Da).get(r)===s&&T(this,Da).delete(r)},n)),await s},Vk=async function(e,n,r){te(r<kie,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:n,enableCcipRead:!0})});const s=fy(e);try{return Ae(await this._perform({method:"call",transaction:s,blockTag:n}))}catch(i){if(!this.disableCcipRead&&lx(i)&&i.data&&r>=0&&n==="latest"&&s.to!=null&&Vt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Qn(s.to,this);let l;try{l=Mie(Vt(i.data,4))}catch(f){te(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}te(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const u=await this.ccipReadFetch(s,l.calldata,l.urls);te(u!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const c={to:a,data:$t([l.selector,Oie([u,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:c});try{const f=await de(this,st,Vk).call(this,c,n,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},c),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},c),error:f}),f}}throw i}},zk=async function(e){const{value:n}=await _n({network:this.getNetwork(),value:e});return n},Op=async function(e,n,r){let s=this._getAddress(n),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await de(this,st,zk).call(this,de(this,st,jr).call(this,Object.assign(e,{address:s,blockTag:i})))},$k=async function(e,n){if(St(e,32))return await de(this,st,jr).call(this,{method:"getBlock",blockHash:e,includeTransactions:n});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await de(this,st,jr).call(this,{method:"getBlock",blockTag:r,includeTransactions:n})},Mp=async function(e,n){let r=await d2(e,this);return r.type==="event"&&n&&n.length>0&&n[0].removed===!0&&(r=await d2({orphan:"drop-log",log:n[0]},this)),T(this,Bn).get(r.tag)||null},db=async function(e){const n=await d2(e,this),r=n.tag;let s=T(this,Bn).get(r);return s||(s={subscriber:this._getSubscriber(n),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Bn).set(r,s)),s};function Sie(t,e){try{const n=p2(t,e);if(n)return Sc(n)}catch{}return null}function p2(t,e){if(t==="0x")return null;try{const n=Qe(Vt(t,e,e+32)),r=Qe(Vt(t,n,n+32));return Vt(t,n+32,n+32+r)}catch{}return null}function MP(t){const e=Wn(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function Tie(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const Die=new Uint8Array([]);function Oie(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(Die),n+=32;for(let r=0;r<t.length;r++){const s=ct(t[r]);e[r]=MP(n),e.push(MP(s.length)),e.push(Tie(s)),n+=32+Math.ceil(s.length/32)*32}return $t(e)}const NP="0x0000000000000000000000000000000000000000000000000000000000000000";function Mie(t){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};te(Ec(t)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const n=Vt(t,0,32);te(Vt(n,0,12)===Vt(NP,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Vt(n,12);try{const r=[],s=Qe(Vt(t,32,64)),i=Qe(Vt(t,s,s+32)),o=Vt(t,s+32);for(let a=0;a<i;a++){const l=Sie(o,a*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{te(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=p2(t,64);if(r==null)throw new Error("abort");e.calldata=r}catch{te(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}te(Vt(t,100,128)===Vt(NP,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Vt(t,96,100);try{const r=p2(t,128);if(r==null)throw new Error("abort");e.extraData=r}catch{te(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function Vc(t,e){if(t.provider)return t.provider;te(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function _P(t,e){let n=fy(e);if(n.to!=null&&(n.to=Qn(n.to,t)),n.from!=null){const r=n.from;n.from=Promise.all([t.getAddress(),Qn(r,t)]).then(([s,i])=>($(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else n.from=t.getAddress();return await _n(n)}class Nie{constructor(e){q(this,"provider");Me(this,{provider:e||null})}async getNonce(e){return Vc(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await _P(this,e)}async populateTransaction(e){const n=Vc(this,"populateTransaction"),r=await _P(this,e);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const s=await this.provider.getNetwork();if(r.chainId!=null){const o=Ce(r.chainId);$(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=s.chainId;const i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?$(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&i&&$(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await n.getFeeData();te(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await n.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(te(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):te(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await _n(r)}async estimateGas(e){return Vc(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Vc(this,"call").call(await this.populateCall(e))}async resolveName(e){return await Vc(this,"resolveName").resolveName(e)}async sendTransaction(e){const n=Vc(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=Vh.from(r);return await n.broadcastTransaction(await this.signTransaction(s))}}const RP=new Set;function zc(t){RP.has(t)||(RP.add(t),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${t} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}function _ie(t){return JSON.parse(JSON.stringify(t))}class PP{constructor(e){J(this,Ma);J(this,Yn);J(this,vi);J(this,uu);J(this,Oa);J(this,cu);J(this,jf);L(this,Yn,e),L(this,vi,null),L(this,uu,de(this,Ma,Gk).bind(this)),L(this,Oa,!1),L(this,cu,null),L(this,jf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,n){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,Oa)||(L(this,Oa,!0),de(this,Ma,Gk).call(this,-2))}stop(){T(this,Oa)&&(L(this,Oa,!1),L(this,jf,!0),de(this,Ma,Wk).call(this),T(this,Yn).off("block",T(this,uu)))}pause(e){e&&de(this,Ma,Wk).call(this),T(this,Yn).off("block",T(this,uu))}resume(){this.start()}}Yn=new WeakMap,vi=new WeakMap,uu=new WeakMap,Oa=new WeakMap,cu=new WeakMap,jf=new WeakMap,Ma=new WeakSet,Gk=async function(e){try{T(this,vi)==null&&L(this,vi,this._subscribe(T(this,Yn)));let n=null;try{n=await T(this,vi)}catch(i){if(!gn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(n==null){L(this,vi,null),T(this,Yn)._recoverSubscriber(this,this._recover(T(this,Yn)));return}const r=await T(this,Yn).getNetwork();if(T(this,cu)||L(this,cu,r),T(this,cu).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,jf))return;const s=await T(this,Yn).send("eth_getFilterChanges",[n]);await this._emitResults(T(this,Yn),s)}catch(n){console.log("@TODO",n)}T(this,Yn).once("block",T(this,uu))},Wk=function(){const e=T(this,vi);e&&(L(this,vi,null),e.then(n=>{T(this,Yn).destroyed||T(this,Yn).send("eth_uninstallFilter",[n])}))};class Rie extends PP{constructor(n,r){super(n);J(this,fu);L(this,fu,_ie(r))}_recover(n){return new c2(n,T(this,fu))}async _subscribe(n){return await n.send("eth_newFilter",[T(this,fu)])}async _emitResults(n,r){for(const s of r)n.emit(T(this,fu),n._wrapLog(s,n._network))}}fu=new WeakMap;class Pie extends PP{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,n){for(const r of n)e.emit("pending",r)}}const Iie="bigint,boolean,function,number,string,symbol".split(/,/g);function ky(t){if(t==null||Iie.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(ky);if(typeof t=="object")return Object.keys(t).reduce((e,n)=>(e[n]=t[n],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function Lie(t){return new Promise(e=>{setTimeout(e,t)})}function $c(t){return t&&t.toLowerCase()}function IP(t){return t&&typeof t.pollingInterval=="number"}const LP={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class m2 extends Nie{constructor(n,r){super(n);q(this,"address");r=gt(r),Me(this,{address:r})}connect(n){te(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(n){return await this.populateCall(n)}async sendUncheckedTransaction(n){const r=ky(n),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Qn(o,this.provider);$(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&s.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;s.push((async()=>{r.to=await Qn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(n){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(n);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const u=async()=>{try{const c=await this.provider.getTransaction(s);if(c!=null){i(c.replaceableTransaction(r));return}}catch(c){if(gn(c,"CANCELLED")||gn(c,"BAD_DATA")||gn(c,"NETWORK_ERROR")){c.info==null&&(c.info={}),c.info.sendTransactionHash=s,o(c);return}if(gn(c,"INVALID_ARGUMENT")&&(l++,c.info==null&&(c.info={}),c.info.sendTransactionHash=s,l>10)){o(c);return}this.provider.emit("error",_t("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:c}))}this.provider._setTimeout(()=>{u()},a.pop()||4e3)};u()})}async signTransaction(n){const r=ky(n);if(r.from){const i=await Qn(r.from,this.provider);$(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",n),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("personal_sign",[Ae(r),this.address.toLowerCase()])}async signTypedData(n,r,s){const i=ky(s),o=await ly.resolveNames(n,r,i,async a=>{const l=await Qn(a);return $(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(ly.getPayload(o.domain,r,o.value))])}async unlock(n){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),n,null])}async _legacySignMessage(n){const r=typeof n=="string"?Vi(n):n;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ae(r)])}}class BP extends xy{constructor(n,r){super(n,r);J(this,Ep);J(this,du);J(this,Uf);J(this,bo);J(this,xi);J(this,Rs);J(this,ls);J(this,mr);L(this,Uf,1),L(this,du,Object.assign({},LP,r||{})),L(this,bo,[]),L(this,xi,null),L(this,ls,null),L(this,mr,null);{let i=null;const o=new Promise(a=>{i=a});L(this,Rs,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?($(!s||n!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&n!=null&&L(this,ls,rn.from(n))):s&&($(n==null||s.matches(n),"staticNetwork MUST match network object","options",r),L(this,ls,s))}_getOption(n){return T(this,du)[n]}get _network(){return te(T(this,ls),"network is not available yet","NETWORK_ERROR"),T(this,ls)}async _perform(n){if(n.method==="call"||n.method==="estimateGas"){let s=n.transaction;if(s&&s.type!=null&&Ce(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(n=Object.assign({},n,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(n);return r!=null?await this.send(r.method,r.args):super._perform(n)}async _detectNetwork(){const n=this._getOption("staticNetwork");if(n)if(n===!0){if(T(this,ls))return T(this,ls)}else return n;return T(this,mr)?await T(this,mr):this.ready?(L(this,mr,(async()=>{try{const r=rn.from(Ce(await this.send("eth_chainId",[])));return L(this,mr,null),r}catch(r){throw L(this,mr,null),r}})()),await T(this,mr)):(L(this,mr,(async()=>{const r={id:Tp(this,Uf)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],L(this,mr,null)}catch(i){throw L(this,mr,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return rn.from(Ce(s.result));throw this.getRpcError(r,s)})()),await T(this,mr))}_start(){T(this,Rs)==null||T(this,Rs).resolve==null||(T(this,Rs).resolve(),L(this,Rs,null),(async()=>{for(;T(this,ls)==null&&!this.destroyed;)try{L(this,ls,await this._detectNetwork())}catch(n){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",_t("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:n}})),await Lie(1e3)}de(this,Ep,qk).call(this)})())}async _waitUntilReady(){if(T(this,Rs)!=null)return await T(this,Rs).promise}_getSubscriber(n){return n.type==="pending"?new Pie(this):n.type==="event"?this._getOption("polling")?new c2(this,n.filter):new Rie(this,n.filter):n.type==="orphan"&&n.filter.orphan==="drop-log"?new vy("orphan"):super._getSubscriber(n)}get ready(){return T(this,Rs)==null}getRpcTransaction(n){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(n[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=kl(Ce(n[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{n[s]!=null&&(r[s]=Ae(n[s]))}),n.accessList&&(r.accessList=oa(n.accessList)),n.blobVersionedHashes&&(r.blobVersionedHashes=n.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(n){switch(n.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[$c(n.address),n.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[$c(n.address),n.blockTag]};case"getCode":return{method:"eth_getCode",args:[$c(n.address),n.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[$c(n.address),"0x"+n.position.toString(16),n.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[n.signedTransaction]};case"getBlock":if("blockTag"in n)return{method:"eth_getBlockByNumber",args:[n.blockTag,!!n.includeTransactions]};if("blockHash"in n)return{method:"eth_getBlockByHash",args:[n.blockHash,!!n.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[n.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[n.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(n.transaction),n.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(n.transaction)]};case"getLogs":return n.filter&&n.filter.address!=null&&(Array.isArray(n.filter.address)?n.filter.address=n.filter.address.map($c):n.filter.address=$c(n.filter.address)),{method:"eth_getLogs",args:[n.filter]}}return null}getRpcError(n,r){const{method:s}=n,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return _t("insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.params[0],info:{payload:n,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=g2(i),u=Fc.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",n.params[0],l?l.data:null);return u.info={error:i,payload:n},u}const o=JSON.stringify(Fie(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return _t("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:n,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=n.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return _t("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return _t("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return _t("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return _t("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:l,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?_t("unsupported operation","UNSUPPORTED_OPERATION",{operation:n.method,info:{error:i,payload:n}}):_t("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:n})}send(n,r){if(this.destroyed)return Promise.reject(_t("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n}));const s=Tp(this,Uf)._++,i=new Promise((o,a)=>{T(this,bo).push({resolve:o,reject:a,payload:{method:n,params:r,id:s,jsonrpc:"2.0"}})});return de(this,Ep,qk).call(this),i}async getSigner(n){n==null&&(n=0);const r=this.send("eth_accounts",[]);if(typeof n=="number"){const i=await r;if(n>=i.length)throw new Error("no such account");return new m2(this,i[n])}const{accounts:s}=await _n({network:this.getNetwork(),accounts:r});n=gt(n);for(const i of s)if(gt(i)===n)return new m2(this,n);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new m2(this,r))}destroy(){T(this,xi)&&(clearTimeout(T(this,xi)),L(this,xi,null));for(const{payload:n,reject:r}of T(this,bo))r(_t("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));L(this,bo,[]),super.destroy()}}du=new WeakMap,Uf=new WeakMap,bo=new WeakMap,xi=new WeakMap,Rs=new WeakMap,ls=new WeakMap,mr=new WeakMap,Ep=new WeakSet,qk=function(){if(T(this,xi))return;const n=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");L(this,xi,setTimeout(()=>{L(this,xi,null);const r=T(this,bo);for(L(this,bo,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,du).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,du).batchMaxSize){r.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:u}of s){if(this.destroyed){l(_t("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:u.method}));continue}const c=o.filter(f=>f.id===u.id)[0];if(c==null){const f=_t("missing response for request","BAD_DATA",{value:o,info:{payload:u}});this.emit("error",f),l(f);continue}if("error"in c){l(this.getRpcError(u,c));continue}a(c.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},n))};class Bie extends BP{constructor(n,r){super(n,r);J(this,Na);let s=this._getOption("pollingInterval");s==null&&(s=LP.pollingInterval),L(this,Na,s)}_getSubscriber(n){const r=super._getSubscriber(n);return IP(r)&&(r.pollingInterval=T(this,Na)),r}get pollingInterval(){return T(this,Na)}set pollingInterval(n){if(!Number.isInteger(n)||n<0)throw new Error("invalid interval");L(this,Na,n),this._forEachSubscriber(r=>{IP(r)&&(r.pollingInterval=T(this,Na))})}}Na=new WeakMap;class Ji extends Bie{constructor(n,r,s){n==null&&(n="http://localhost:8545");super(r,s);J(this,Hf);typeof n=="string"?L(this,Hf,new qn(n)):L(this,Hf,n.clone())}_getConnection(){return T(this,Hf).clone()}async send(n,r){return await this._start(),await super.send(n,r)}async _send(n){const r=this._getConnection();r.body=JSON.stringify(n),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Hf=new WeakMap;function g2(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&St(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const n=g2(t[e]);if(n)return n}return null}if(typeof t=="string")try{return g2(JSON.parse(t))}catch{}return null}function y2(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const n in t)y2(t[n],e);if(typeof t=="string")try{return y2(JSON.parse(t),e)}catch{}}}function Fie(t){const e=[];return y2(t,e),e}const Ey="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function jie(t){switch(t){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}$(!1,"unsupported network","network",t)}class Cy extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Ey);const i={polling:!0,staticNetwork:s},o=Cy.getRequest(s,r);super(o,s,i);q(this,"apiKey");Me(this,{apiKey:r})}_getProvider(n){try{return new Cy(n,this.apiKey)}catch{}return super._getProvider(n)}static getRequest(n,r){r==null&&(r=Ey);const s=new qn(`https://${jie(n.name)}/${r}`);return s.allowGzip=!0,r===Ey&&(s.retryFunc=async(i,o,a)=>(zc("AnkrProvider"),!0)),s}getRpcError(n,r){return n.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(n,r)}isCommunityResource(){return this.apiKey===Ey}}const Sy="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function Uie(t){switch(t){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}$(!1,"unsupported network","network",t)}class Ty extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Sy);const i=Ty.getRequest(s,r);super(i,s,{staticNetwork:s});q(this,"apiKey");Me(this,{apiKey:r})}_getProvider(n){try{return new Ty(n,this.apiKey)}catch{}return super._getProvider(n)}async _perform(n){if(n.method==="getTransactionResult"){const{trace:r,tx:s}=await _n({trace:this.send("trace_transaction",[n.hash]),tx:this.getTransaction(n.hash)});if(r==null||s==null)return null;let i,o=!1;try{i=r[0].result.output,o=r[0].error==="Reverted"}catch{}if(i)return te(!o,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:i,reason:null,transaction:s,invocation:null,revert:null}),i;te(!1,"could not parse trace result","BAD_DATA",{value:r})}return await super._perform(n)}isCommunityResource(){return this.apiKey===Sy}static getRequest(n,r){r==null&&(r=Sy);const s=new qn(`https://${Uie(n.name)}/v2/${r}`);return s.allowGzip=!0,r===Sy&&(s.retryFunc=async(i,o,a)=>(zc("alchemy"),!0)),s}}function Dy(t){switch(t){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}$(!1,"unsupported network","network",t)}function Hie(t){switch(t){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}$(!1,"unsupported network","network",t)}class Oy extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=Dy(s.name));const i=Oy.getRequest(s,r);super(i,s,{staticNetwork:s});q(this,"apiKey");Me(this,{apiKey:r})}_getProvider(n){try{return new Oy(n,this.apiKey)}catch{}return super._getProvider(n)}isCommunityResource(){return this.apiKey===Dy(this._network.name)}static getRequest(n,r){r==null&&(r=Dy(n.name));const s=new qn(`https://${Hie(n.name)}/${r}`);return s.allowGzip=!0,r===Dy(n.name)&&(s.retryFunc=async(i,o,a)=>(zc("ChainstackProvider"),!0)),s}}class Vie extends Ji{constructor(e){e==null&&(e="mainnet");const n=rn.from(e);$(n.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",n,{staticNetwork:n})}}const FP=2e3;function zie(t){return t&&typeof t.then=="function"}const $ie="org.ethers.plugins.provider.Etherscan",Gie=["enableCcipRead"];let Wie=1;class qie extends xy{constructor(n,r){const s=r??null;super();q(this,"network");q(this,"apiKey");J(this,Vf);const i=rn.from(n);L(this,Vf,i.getPlugin($ie)),Me(this,{apiKey:s,network:i}),this.getBaseUrl()}getBaseUrl(){if(T(this,Vf))return T(this,Vf).baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}$(!1,"unsupported network","network",this.network)}getUrl(n,r){const s=Object.keys(r).reduce((o,a)=>{const l=r[a];return l!=null&&(o+=`&${a}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${n}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(n,r){return r.module=n,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(n,r,s){const i=Wie++,o=s?this.getPostUrl():this.getUrl(n,r),a=s?this.getPostData(n,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new qn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&zc("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(Sc(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return n==="proxy"?h&&h.status==0&&h.message=="NOTOK"&&p&&(this.emit("debug",{action:"receiveError",id:i,reason:"proxy-NOTOK",error:h}),d.throwThrottleError(h.result,FP)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,FP)),d},a&&(l.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),l.body=Object.keys(a).map(f=>`${f}=${a[f]}`).join("&"));const u=await l.send();try{u.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),te(!1,"response error","SERVER_ERROR",{request:l,response:u})}u.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),te(!1,"missing response","SERVER_ERROR",{request:l,response:u}));const c=JSON.parse(Sc(u.body));return n==="proxy"?(c.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"invalid JSON-RPC"}),te(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:u,info:{result:c}})),c.error&&(this.emit("debug",{action:"receiveError",id:i,result:c,reason:"JSON-RPC error"}),te(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):c.status==0&&(c.message==="No records found"||c.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result):((c.status!=1||typeof c.message=="string"&&!c.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:c}),te(!1,"error response","SERVER_ERROR",{request:l,response:u,info:{result:c}})),this.emit("debug",{action:"receiveRequest",id:i,result:c}),c.result)}_getTransactionPostData(n){const r={};for(let s in n){if(Gie.indexOf(s)>=0||n[s]==null)continue;let i=n[s];if(!(s==="type"&&i===0)&&!(s==="blockTag"&&i==="latest")){if({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[s])i=kl(i);else if(s==="accessList")i="["+oa(i).map(o=>`{address:"${o.address}",storageKeys:["${o.storageKeys.join('","')}"]}`).join(",")+"]";else if(s==="blobVersionedHashes"){if(i.length===0)continue;te(!1,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:n}})}else i=Ae(i);r[s]=i}}return r}_checkError(n,r,s){let i="";if(gn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(n.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&te(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:n.transaction}),(n.method==="call"||n.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=Fc.getBuiltinCallException(n.method,n.transaction,o);throw a.info={request:n,error:r},a}if(i&&n.method==="broadcastTransaction"){const o=Vh.from(n.signedTransaction);i.match(/replacement/i)&&i.match(/underpriced/i)&&te(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o}),i.match(/insufficient funds/)&&te(!1,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&te(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:o})}throw r}async _detectNetwork(){return this.network}async _perform(n){switch(n.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet")return"1000000000";if(this.network.name==="optimism")return"1000000";throw new Error("fallback onto the AbstractProvider default");case"getBalance":return this.fetch("account",{action:"balance",address:n.address,tag:n.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:n.address,tag:n.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:n.address,tag:n.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:n.address,position:n.position,tag:n.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:n.signedTransaction},!0).catch(r=>this._checkError(n,r,n.signedTransaction));case"getBlock":if("blockTag"in n)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:n.blockTag,boolean:n.includeTransactions?"true":"false"});te(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:n.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:n.hash});case"call":{if(n.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(n.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(n,s,n.transaction)}}}return super._perform(n)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(n){let r=this._getAddress(n);zie(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new Uc(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}Vf=new WeakMap;function Kie(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const Qie=Kie().WebSocket;class b2{constructor(e,n){J(this,ki);J(this,Cp);J(this,_a);J(this,hu);J(this,Ra);L(this,ki,e),L(this,Cp,JSON.stringify(n)),L(this,_a,null),L(this,hu,null),L(this,Ra,null)}get filter(){return JSON.parse(T(this,Cp))}start(){L(this,_a,T(this,ki).send("eth_subscribe",this.filter).then(e=>(T(this,ki)._register(e,this),e)))}stop(){T(this,_a).then(e=>{T(this,ki).destroyed||T(this,ki).send("eth_unsubscribe",[e])}),L(this,_a,null)}pause(e){te(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),L(this,hu,!!e)}resume(){L(this,hu,null)}_handleMessage(e){if(T(this,_a)!=null&&T(this,hu)===null){let n=T(this,Ra);n==null?n=this._emit(T(this,ki),e):n=n.then(async()=>{await this._emit(T(this,ki),e)}),L(this,Ra,n.then(()=>{T(this,Ra)===n&&L(this,Ra,null)}))}}async _emit(e,n){throw new Error("sub-classes must implemente this; _emit")}}ki=new WeakMap,Cp=new WeakMap,_a=new WeakMap,hu=new WeakMap,Ra=new WeakMap;class Jie extends b2{constructor(e){super(e,["newHeads"])}async _emit(e,n){e.emit("block",parseInt(n.number))}}class Yie extends b2{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,n){e.emit("pending",n)}}class Xie extends b2{constructor(n,r){super(n,["logs",r]);J(this,Sp);L(this,Sp,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Sp))}async _emit(n,r){n.emit(this.logFilter,n._wrapLog(r,n._network))}}Sp=new WeakMap;class Zie extends BP{constructor(n,r){const s=Object.assign({},r??{});$(s.batchMaxCount==null||s.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",r),s.batchMaxCount=1,s.staticNetwork==null&&(s.staticNetwork=!0);super(n,s);J(this,pu);J(this,zf);J(this,Pa);L(this,pu,new Map),L(this,zf,new Map),L(this,Pa,new Map)}_getSubscriber(n){switch(n.type){case"close":return new vy("close");case"block":return new Jie(this);case"pending":return new Yie(this);case"event":return new Xie(this,n.filter);case"orphan":if(n.filter.orphan==="drop-log")return new vy("drop-log")}return super._getSubscriber(n)}_register(n,r){T(this,zf).set(n,r);const s=T(this,Pa).get(n);if(s){for(const i of s)r._handleMessage(i);T(this,Pa).delete(n)}}async _send(n){$(!Array.isArray(n),"WebSocket does not support batch send","payload",n);const r=new Promise((s,i)=>{T(this,pu).set(n.id,{payload:n,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(n)),[await r]}async _processMessage(n){const r=JSON.parse(n);if(r&&typeof r=="object"&&"id"in r){const s=T(this,pu).get(r.id);if(s==null){this.emit("error",_t("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,pu).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,zf).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,Pa).get(s);o==null&&(o=[],T(this,Pa).set(s,o)),o.push(r.params.result)}}else{this.emit("error",_t("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(n){throw new Error("sub-classes must override this")}}pu=new WeakMap,zf=new WeakMap,Pa=new WeakMap;class jP extends Zie{constructor(n,r,s){super(r,s);J(this,mu);J(this,Ps);typeof n=="string"?(L(this,mu,()=>new Qie(n)),L(this,Ps,T(this,mu).call(this))):typeof n=="function"?(L(this,mu,n),L(this,Ps,n())):(L(this,mu,null),L(this,Ps,n)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(i){console.log("failed to start WebsocketProvider",i)}},this.websocket.onmessage=i=>{this._processMessage(i.data)}}get websocket(){if(T(this,Ps)==null)throw new Error("websocket closed");return T(this,Ps)}async _write(n){this.websocket.send(n)}async destroy(){T(this,Ps)!=null&&(T(this,Ps).close(),L(this,Ps,null)),super.destroy()}}mu=new WeakMap,Ps=new WeakMap;const Qh="84842078b09946638c03157f83405213";function eoe(t){switch(t){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}$(!1,"unsupported network","network",t)}class toe extends jP{constructor(n,r){const s=new Jh(n,r),i=s._getConnection();te(!i.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,s._network);q(this,"projectId");q(this,"projectSecret");Me(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Qh}}class Jh extends Ji{constructor(n,r,s){n==null&&(n="mainnet");const i=rn.from(n);r==null&&(r=Qh),s==null&&(s=null);const o=Jh.getRequest(i,r,s);super(o,i,{staticNetwork:i});q(this,"projectId");q(this,"projectSecret");Me(this,{projectId:r,projectSecret:s})}_getProvider(n){try{return new Jh(n,this.projectId,this.projectSecret)}catch{}return super._getProvider(n)}isCommunityResource(){return this.projectId===Qh}static getWebSocketProvider(n,r){return new toe(n,r)}static getRequest(n,r,s){r==null&&(r=Qh),s==null&&(s=null);const i=new qn(`https://${eoe(n.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Qh&&(i.retryFunc=async(o,a,l)=>(zc("InfuraProvider"),!0)),i}}const My="919b412a057b5e9c9b6dce193c5a60242d6efadb";function noe(t){switch(t){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}$(!1,"unsupported network","network",t)}class Ny extends Ji{constructor(n,r){n==null&&(n="mainnet");const s=rn.from(n);r==null&&(r=My);const i=Ny.getRequest(s,r);super(i,s,{staticNetwork:s});q(this,"token");Me(this,{token:r})}_getProvider(n){try{return new Ny(n,this.token)}catch{}return super._getProvider(n)}isCommunityResource(){return this.token===My}static getRequest(n,r){r==null&&(r=My);const s=new qn(`https://${noe(n.name)}/${r}`);return s.allowGzip=!0,r===My&&(s.retryFunc=async(i,o,a)=>(zc("QuickNodeProvider"),!0)),s}}const roe=BigInt("1"),soe=BigInt("2");function ioe(t){for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}}function ooe(t){return new Promise(e=>{setTimeout(e,t)})}function w2(){return new Date().getTime()}function A2(t){return JSON.stringify(t,(e,n)=>typeof n=="bigint"?{type:"bigint",value:n.toString()}:n)}const UP={stallTimeout:400,priority:1,weight:1},HP={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function aoe(t,e){for(;(t.blockNumber<0||t.blockNumber<e)&&(t._updateNumber||(t._updateNumber=(async()=>{try{const n=await t.provider.getBlockNumber();n>t.blockNumber&&(t.blockNumber=n)}catch(n){t.blockNumber=-2,t._lastFatalError=n,t._lastFatalErrorTimestamp=w2()}t._updateNumber=null})()),await t._updateNumber,t.outOfSync++,!t._lastFatalError););}function Yh(t){if(t==null)return"null";if(Array.isArray(t))return"["+t.map(Yh).join(",")+"]";if(typeof t=="object"&&typeof t.toJSON=="function")return Yh(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":case"number":return BigInt(t).toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{"+e.map(n=>`${JSON.stringify(n)}:${Yh(t[n])}`).join(",")+"}"}}throw console.log("Could not serialize",t),new Error("Hmm...")}function v2(t){if("error"in t){const n=t.error;return{tag:Yh(n),value:n}}const e=t.result;return{tag:Yh(e),value:e}}function _y(t,e){const n=new Map;for(const{value:s,tag:i,weight:o}of e){const a=n.get(i)||{value:s,weight:0};a.weight+=o,n.set(i,a)}let r=null;for(const s of n.values())s.weight>=t&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function x2(t,e){let n=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:u}of e)if(a instanceof Error){const c=r.get(l)||{value:a,weight:0};c.weight+=u,r.set(l,c),(s==null||c.weight>s.weight)&&(s=c)}else i.push(BigInt(a)),n+=u;if(n<t)return s&&s.weight>=t?s.value:void 0;i.sort((a,l)=>a<l?-1:l>a?1:0);const o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o]+roe)/soe}function k2(t,e){const n=_y(t,e);if(n!==void 0)return n;for(const r of e)if(r.value)return r.value}function loe(t,e){if(t===1)return Qe(x2(t,e),"%internal");const n=new Map,r=(o,a)=>{const l=n.get(o)||{result:o,weight:0};l.weight+=a,n.set(o,l)};for(const{weight:o,value:a}of e){const l=Qe(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of n.values())o>=t&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class uoe extends xy{constructor(n,r,s){super(r,s);J(this,yr);q(this,"quorum");q(this,"eventQuorum");q(this,"eventWorkers");J(this,gr);J(this,wo);J(this,$f);L(this,gr,n.map(i=>i instanceof xy?Object.assign({provider:i},UP,HP):Object.assign({},UP,i,HP))),L(this,wo,-2),L(this,$f,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,gr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,$(this.quorum<=T(this,gr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,gr).map(n=>{const r=Object.assign({},n);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return rn.from(Ce(await this._perform({method:"chainId"})))}async _translatePerform(n,r){switch(r.method){case"broadcastTransaction":return await n.broadcastTransaction(r.signedTransaction);case"call":return await n.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await n.getNetwork()).chainId;case"estimateGas":return await n.estimateGas(r.transaction);case"getBalance":return await n.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await n.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await n.getBlockNumber();case"getCode":return await n.getCode(r.address,r.blockTag);case"getGasPrice":return(await n.getFeeData()).gasPrice;case"getPriorityFee":return(await n.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await n.getLogs(r.filter);case"getStorage":return await n.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await n.getTransaction(r.hash);case"getTransactionCount":return await n.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await n.getTransactionReceipt(r.hash);case"getTransactionResult":return await n.getTransactionResult(r.hash)}}async _perform(n){if(n.method==="broadcastTransaction"){const o=T(this,gr).map(u=>null),a=T(this,gr).map(async({provider:u,weight:c},f)=>{try{const d=await u._perform(n);o[f]=Object.assign(v2({result:d}),{weight:c})}catch(d){o[f]=Object.assign(v2({error:d}),{weight:c})}});for(;;){const u=o.filter(d=>d!=null);for(const{value:d}of u)if(!(d instanceof Error))return d;const c=_y(this.quorum,o.filter(d=>d!=null));if(gn(c,"INSUFFICIENT_FUNDS"))throw c;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=k2(this.quorum,o);if(te(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:n,results:o.map(A2)}}),l instanceof Error)throw l;return l}await de(this,yr,PL).call(this);const r=new Set;let s=0;for(;;){const o=de(this,yr,Kk).call(this,r,n);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await de(this,yr,Qk).call(this,r,n);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:n}of T(this,gr))n.destroy();super.destroy()}}gr=new WeakMap,wo=new WeakMap,$f=new WeakMap,yr=new WeakSet,RL=function(n){const r=Array.from(n).map(i=>i.config),s=T(this,gr).slice();ioe(s),s.sort((i,o)=>i.priority-o.priority);for(const i of s)if(!i._lastFatalError&&r.indexOf(i)===-1)return i;return null},Kk=function(n,r){const s=de(this,yr,RL).call(this,n);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=w2();return i.perform=(async()=>{try{s.requests++;const l=await this._translatePerform(s.provider,r);i.result={result:l}}catch(l){s.errorResponses++,i.result={error:l}}const a=w2()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await ooe(s.stallTimeout),i.staller=null})(),n.add(i),i},PL=async function(){let n=T(this,$f);if(!n){const r=[];T(this,gr).forEach(s=>{r.push((async()=>{await aoe(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),L(this,$f,n=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,gr)){if(i._lastFatalError)continue;const o=i._network;s==null?s=o.chainId:o.chainId!==s&&te(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await n},IL=async function(n,r){const s=[];for(const i of n)if(i.result!=null){const{tag:o,value:a}=v2(i.result);s.push({tag:o,value:a,weight:i.config.weight})}if(!(s.reduce((i,o)=>i+o.weight,0)<this.quorum)){switch(r.method){case"getBlockNumber":{T(this,wo)===-2&&L(this,wo,Math.ceil(Qe(x2(this.quorum,T(this,gr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Qe(o.blockNumber).toString(),weight:o.weight}))))));const i=loe(this.quorum,s);return i===void 0?void 0:(i>T(this,wo)&&L(this,wo,i),T(this,wo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return x2(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?k2(this.quorum,s):_y(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return _y(this.quorum,s);case"broadcastTransaction":return k2(this.quorum,s)}te(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${A2(r.method)})`})}},Qk=async function(n,r){if(n.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of n){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await de(this,yr,IL).call(this,n,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)de(this,yr,Kk).call(this,n,r);return te(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(n).map(a=>A2(a.result))}}),await Promise.race(s),await de(this,yr,Qk).call(this,n,r)};function coe(t){return t&&typeof t.send=="function"&&typeof t.close=="function"}const foe="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function doe(t,e){e==null&&(e={});const n=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof t=="string"&&t.match(/^https?:/))return new Ji(t);if(typeof t=="string"&&t.match(/^wss?:/)||coe(t))return new jP(t);let r=null;try{r=rn.from(t)}catch{}const s=[];if(n("publicPolygon")&&r&&(r.name==="matic"?s.push(new Ji("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Ji("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),n("alchemy"))try{s.push(new Ty(t,e.alchemy))}catch{}if(n("ankr")&&e.ankr!=null)try{s.push(new Cy(t,e.ankr))}catch{}if(n("chainstack"))try{s.push(new Oy(t,e.chainstack))}catch{}if(n("cloudflare"))try{s.push(new Vie(t))}catch{}if(n("etherscan"))try{s.push(new qie(t,e.etherscan))}catch{}if(n("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new Jh(t,o,a))}catch{}if(n("quicknode"))try{let o=e.quicknode;s.push(new Ny(t,o))}catch{}if(te(s.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"}),s.length===1)return s[0];let i=Math.floor(s.length/2);return i>2&&(i=2),r&&foe.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new uoe(s,void 0,{quorum:i})}const hoe=async(t,e)=>{const n={name:t,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!ure(t))return n;try{const r=await poe(t,e);r&&(n.name=r,n.isEns=!0)}catch(r){console.log(r)}return n},poe=async(t,e)=>await moe(e).lookupAddress(t),moe=t=>doe(t),goe=(t,e,n)=>{if((t==null?void 0:t.length)>n){const r=t.substring(0,e),s=t.substring((t==null?void 0:t.length)-e);return`${r}...${s}`}return t};function yoe(t){var e;const{char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=t,a=v7(n),l=new RegExp(`\\s${a}$`),u=i?"^":"",c=r?new RegExp(`${u}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${u}(?:^)?${a}[^\\s${a}]*`,"gm"),f=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!f)return null;const d=o.pos-f.length,h=Array.from(f.matchAll(c)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(p);if(s!==null&&!m)return null;const g=d+h.index;let b=g+h[0].length;return r&&l.test(f.slice(b-1,b+1))&&(h[0]+=" ",b+=1),g<o.pos&&b>=o.pos?{range:{from:g,to:b},query:h[0].slice(n.length),text:h[0]}:null}const boe=new Mt("suggestion");function woe({pluginKey:t=boe,editor:e,char:n="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:u=()=>[],render:c=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=yoe}){let h;const p=c==null?void 0:c(),m=new bt({key:t,view(){return{update:async(g,b)=>{var v,A,w,x,k,C,D;const O=(v=this.key)===null||v===void 0?void 0:v.getState(b),N=(A=this.key)===null||A===void 0?void 0:A.getState(g.state),R=O.active&&N.active&&O.range.from!==N.range.from,B=!O.active&&N.active,F=O.active&&!N.active,G=!B&&!F&&O.query!==N.query,I=B||R,U=G&&!R,W=F||R;if(!I&&!U&&!W)return;const ee=W&&!I?O:N,Z=g.dom.querySelector(`[data-decoration-id="${ee.decorationId}"]`);h={editor:e,range:ee.range,query:ee.query,text:ee.text,items:[],command:ue=>l({editor:e,range:ee.range,props:ue}),decorationNode:Z,clientRect:Z?()=>{var ue;const{decorationId:xe}=(ue=this.key)===null||ue===void 0?void 0:ue.getState(e.state),Se=g.dom.querySelector(`[data-decoration-id="${xe}"]`);return(Se==null?void 0:Se.getBoundingClientRect())||null}:null},I&&((w=p==null?void 0:p.onBeforeStart)===null||w===void 0||w.call(p,h)),U&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),(U||I)&&(h.items=await u({editor:e,query:ee.query})),W&&((k=p==null?void 0:p.onExit)===null||k===void 0||k.call(p,h)),U&&((C=p==null?void 0:p.onUpdate)===null||C===void 0||C.call(p,h)),I&&((D=p==null?void 0:p.onStart)===null||D===void 0||D.call(p,h))},destroy:()=>{var g;h&&((g=p==null?void 0:p.onExit)===null||g===void 0||g.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,b,v,A){const{isEditable:w}=e,{composing:x}=e.view,{selection:k}=g,{empty:C,from:D}=k,O={...b};if(O.composing=x,w&&(C||e.view.composing)){(D<b.range.from||D>b.range.to)&&!x&&!b.composing&&(O.active=!1);const N=d({char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:k.$from}),R=`id_${Math.floor(Math.random()*4294967295)}`;N&&f({editor:e,state:A,range:N.range})?(O.active=!0,O.decorationId=b.decorationId?b.decorationId:R,O.range=N.range,O.query=N.query,O.text=N.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(g,b){var v;const{active:A,range:w}=m.getState(g.state);return A&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:g,event:b,range:w}))||!1},decorations(g){const{active:b,range:v,decorationId:A}=m.getState(g);return b?kt.create(g.doc,[nn.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":A})]):null}}});return m}var Aoe=typeof tr=="object"&&tr&&tr.Object===Object&&tr,voe=typeof self=="object"&&self&&self.Object===Object&&self;Aoe||voe||Function("return this")();var VP=typeof window<"u"?_.useLayoutEffect:_.useEffect;function xoe(t,e,n,r){const s=_.useRef(e);VP(()=>{s.current=e},[e]),_.useEffect(()=>{const i=window;if(!(i&&i.addEventListener))return;const o=a=>{s.current(a)};return i.addEventListener(t,o,r),()=>{i.removeEventListener(t,o,r)}},[t,n,r])}var koe=typeof window>"u";function E2(t,{defaultValue:e=!1,initializeWithValue:n=!0}={}){const r=a=>koe?e:window.matchMedia(a).matches,[s,i]=_.useState(()=>n?r(t):e);function o(){i(r(t))}return VP(()=>{const a=window.matchMedia(t);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[t]),s}function Eoe(t,e,n="mousedown",r={}){xoe(n,s=>{const i=s.target;if(!i||!i.isConnected)return;(Array.isArray(t)?t.filter(a=>!!a.current).every(a=>a.current&&!a.current.contains(i)):t.current&&!t.current.contains(i))&&e(s)},void 0,r)}const Coe=wt.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:t,range:e,props:n})=>{n.command({editor:t,range:e})}}}},addProseMirrorPlugins(){return[woe({editor:this.editor,...this.options.suggestion})]}}),Soe=({query:t,uploadToIpfs:e})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:S.jsx(RT,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:S.jsx(_T,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:S.jsx(A0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:S.jsx(v0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:S.jsx(x0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:S.jsx(k0,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:S.jsx(Uu,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:S.jsx(SU,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:S.jsx(E0,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:S.jsx(Md,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:S.jsx(K1,{size:18}),image:"",command:({editor:n,range:r})=>n.chain().focus().deleteRange(r).insertTable({rows:3,cols:2,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:S.jsx(kU,{size:18}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).run();const s=document.createElement("input");s.type="file",s.accept="image/*",s.onchange=async()=>{var i;if((i=s.files)!=null&&i.length){const o=s.files[0],a=n.view.state.selection.from;X1(o,n.view,a,e)}},s.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:S.jsx(IT,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:S.jsx(PT,{}),image:"",command:({editor:n,range:r})=>{n.chain().focus().deleteRange(r).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:S.jsx(OT,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(2).focus(n.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:S.jsx(wU,{}),image:"",command:({editor:n})=>{n.chain().focus().setColumns(3).focus(n.state.selection.head-1).run()}}].filter(n=>{if(typeof t=="string"&&t.length>0){const r=t.toLowerCase();return n.title.toLowerCase().includes(r)||n.description.toLowerCase().includes(r)||n.searchTerms&&n.searchTerms.some(s=>s.includes(r))}return!0}),Toe=(t,e)=>{const n=t.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<t.scrollTop?t.scrollTop-=t.scrollTop-s+5:i>n+t.scrollTop&&(t.scrollTop+=i-n-t.scrollTop+5)},Doe=({items:t,command:e,editor:n})=>{const[r,s]=_.useState(0),[i,o]=_.useState(t),a=E2("(max-width: 640px)"),l=_.useCallback(c=>{const f=i[c];f&&(f.title==="Continue writing"||e(f))},[e,n,i]);_.useEffect(()=>{if(a){const c=t.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(c)}else o(t)},[t,a]),_.useEffect(()=>{const c=["ArrowUp","ArrowDown","Enter"],f=d=>{if(c.includes(d.key))return d.preventDefault(),d.key==="ArrowUp"?(s((r+i.length-1)%i.length),!0):d.key==="ArrowDown"?(s((r+1)%i.length),!0):d.key==="Enter"?(l(r),!0):!1};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[i,r,s,l]),_.useEffect(()=>{s(0)},[i]);const u=_.useRef(null);return _.useLayoutEffect(()=>{const c=u==null?void 0:u.current,f=c==null?void 0:c.children[r];f&&c&&Toe(c,f)},[r]),i.length>0?S.jsx("div",{id:"slash-command",ref:u,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:i.map((c,f)=>S.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${f===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>l(f),children:[S.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:c.icon}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:c.title}),S.jsx("p",{className:"text-xs text-neutral-500",children:c.description})]})]},f))}):null},Ooe=()=>{let t=null,e=null;return{onStart:n=>{t=new ST(Doe,{props:n,editor:n.editor}),e=Xa("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:n=>{t==null||t.updateProps(n),e&&e[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown:n=>{var r;return n.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=t==null?void 0:t.ref)==null?void 0:r.onKeyDown(n)},onExit:()=>{e==null||e[0].destroy(),t==null||t.destroy()}}},Moe=t=>{const e=({query:n})=>Soe({query:n,uploadToIpfs:t});return Coe.configure({suggestion:{items:e,render:Ooe}})},zP=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],Noe=({isPreviewMode:t,initialContent:e,enableCollaboration:n,collaborationId:r,walletAddress:s,username:i,onChange:o,onCollaboratorChange:a,onCommentInteraction:l,onTextSelection:u,ensResolutionUrl:c,handleImageUploadToIpfs:f})=>{var F,G;const[d]=_.useState(new ul),[h,p]=_.useState(!1),[m,g]=_.useState([...gte,Moe(f)]),b=_.useRef(!1),v=(I,U,W)=>{let ee=!1;return I.doc.nodesBetween(U,W,Z=>{Z.marks&&Z.marks.some(ue=>ue.type.name==="highlight"&&ue.attrs.color==="yellow")&&(ee=!0)}),ee},A=(I,U)=>{var ee;const W=U.target;if(W&&W.nodeName==="MARK"&&W.dataset.color&&((ee=W==null?void 0:W.dataset)==null?void 0:ee.color)==="yellow"){const Z=W.textContent,ue=I.posAtCoords({left:U.clientX,top:U.clientY});if(ue){const{state:xe}=I;let Se=ue.pos,ke=ue.pos;if(xe.doc.nodesBetween(Se,ke,(me,Ne)=>{me.marks&&me.marks.length&&me.marks.forEach(je=>{je.type.name==="highlight"&&(Se=Ne,ke=Ne+me.nodeSize)})}),Se!==ke){const me={text:Z,from:Se,to:ke,isHighlightedYellow:v(xe,Se,ke)};l==null||l(me)}}}},w=(I,U,W)=>{A(I,W)},x=(I,U)=>{const W=U.split(`
|
|
484
484
|
|
|
485
485
|
`),ee=W.slice(0,1),Z=W.slice(1).reverse(),ue=ee.concat(Z);let xe=0;const Se=()=>{if(xe<ue.length){const ke=ue[xe],me=I.state.tr;let Ne=me.selection.from;xe>0&&(Ne=me.doc.resolve(Ne).end(1),me.doc.resolve(Ne+1).parent||me.insert(Ne,I.state.schema.nodes.paragraph.create()),Ne+=1),me.insertText(ke,Ne),I.dispatch(me),xe++,requestAnimationFrame(Se)}};Se()},k=AT({extensions:m,editorProps:{...TM,handleDOMEvents:{mouseover:A,keydown:(I,U)=>{if(["ArrowUp","ArrowDown","Enter"].includes(U.key)&&document.querySelector("#slash-command"))return!0},paste:(I,U)=>{if(U.clipboardData){const W=U.clipboardData.getData("text");W.length>2e4&&(U.preventDefault(),x(I,W))}return!1}},handleClick:w},autofocus:"start",onUpdate:I=>{R!=null&&R.isEmpty||o==null||o(I.editor.getJSON())}},[m]),C=AT({extensions:m,editorProps:{...TM,handleDOMEvents:{mouseover:A,keydown:(I,U)=>{if(["ArrowUp","ArrowDown","Enter"].includes(U.key)&&document.querySelector("#slash-command"))return!0},paste:(I,U)=>{if(U.clipboardData){const W=U.clipboardData.getData("text");W.length>2e4&&(U.preventDefault(),x(I,W))}return!1}},handleClick:w},autofocus:"start",onUpdate:I=>{R!=null&&R.isEmpty||o==null||o(I.editor.getJSON())}}),D=_.useRef(()=>{}),O=(I,U=!1)=>{if(!n||!r)throw new Error("docId or username is not provided");p(!0);const W=new RW(r,d,{signaling:["wss://fileverse-signaling-server-0529292ff51c.herokuapp.com/"]});g([...m,iq.configure({document:d}),oq.configure({provider:W,user:{name:I&&I.length>20?goe(I,7,15):I,color:zP[Math.floor(Math.random()*zP.length)],isEns:U},render:vte})]);const ee=setTimeout(()=>{p(!1)},100);return D.current=()=>{clearTimeout(ee),W.destroy(),d.destroy(),p(!1)},D.current},N=_.useRef(null),R=_.useMemo(()=>n&&r&&k&&!h?k:C,[k,C,h]);_.useEffect(()=>{R==null||R.setEditable(!t)},[t,R]),_.useEffect(()=>{e&&R&&!b.current&&(R.commands.setContent(e),b.current=!0),setTimeout(()=>{b.current=!1})},[e,R]),_.useEffect(()=>{if(!R)return;const I=()=>{const{state:U}=R,{from:W,to:ee}=U.selection;if(W!==ee){const Z=U.doc.textBetween(W,ee," ");u==null||u({text:Z,from:W,to:ee,isHighlightedYellow:v(U,W,ee)})}};return R.on("selectionUpdate",I),()=>{R.off("selectionUpdate",I)}},[R]);const B=async()=>{let I=i,U=!1;if(s&&c){const{name:W,isEns:ee}=await hoe(s,c);I=W,U=ee}if(!I)throw new Error("Cannot start collaboration without a username");O(I,U)};return _.useEffect(()=>{n?B():D.current()},[n]),_.useEffect(()=>{var I,U;a==null||a((U=(I=R==null?void 0:R.storage)==null?void 0:I.collaborationCursor)==null?void 0:U.users)},[(G=(F=R==null?void 0:R.storage)==null?void 0:F.collaborationCursor)==null?void 0:G.users]),{editor:R,ref:N,loading:h,connect:O,ydoc:d}},_oe=({title:t,content:e,contentClassName:n,open:r,onOpenChange:s,primaryAction:i,secondaryAction:o})=>S.jsx(LV,{open:r,onOpenChange:s,children:S.jsxs(Z3,{className:"max-w-md sm:w-full w-[90%] z-20",children:[S.jsx(eD,{className:"px-4 pt-0 border-b-[1px]",children:S.jsx(nD,{className:"text-left text-base",children:t})}),S.jsx("div",{className:pe("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",n),children:e&&e}),S.jsxs(tD,{className:"px-5 pb-5 justify-end sm:",children:[o&&S.jsx(jV,{asChild:!0,children:S.jsx(sl,{disabled:o==null?void 0:o.isLoading,isLoading:o==null?void 0:o.isLoading,className:o==null?void 0:o.className,variant:(o==null?void 0:o.variant)||"ghost",onClick:o==null?void 0:o.onClick,children:o==null?void 0:o.label})}),i&&S.jsx(sl,{disabled:i==null?void 0:i.isLoading,isLoading:i==null?void 0:i.isLoading,className:i==null?void 0:i.className,variant:(i==null?void 0:i.variant)||"primary",onClick:i==null?void 0:i.onClick,children:i==null?void 0:i.label})]})]})}),Roe=({editor:t,uploadToIpfs:e})=>{const{toolVisibilty:n,setToolVisibility:r,bottomToolbar:s}=Lw({editor:t,uploadToIpfs:e}),i=E2("(max-width: 1023px)"),[o,a]=_.useState(""),[l,u]=_.useState(""),[c,f]=_.useState(!0),d=()=>{if(o===null){f(!1);return}if(o===""){t.chain().focus().extendMarkRange("link").unsetLink().run(),f(!1);return}let m=o;!o.startsWith("http://")&&!o.startsWith("https://")&&(m="https://"+o);try{m.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&t.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:g})=>(g.insertText(l),!0)).run(),f(!0)}catch{console.error("Invalid URL"),f(!1);return}t.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:g})=>(g.insertText(l),!0)).run(),f(!0),r(Pe.NONE)},h=m=>{const{from:g,to:b}=m.state.selection;return m.state.doc.textBetween(g,b)},p=_.useRef(null);return _.useEffect(()=>{let m=0;const g=()=>{m=Date.now()},b=()=>{var w;if(Date.now()-m>500){const{selection:x}=t.state;x.from!==x.to&&((w=p.current)==null||w.click())}},v=()=>{var x;if(!i)return;const{selection:A}=t.state;A.from!==A.to&&((x=p.current)==null||x.click())};return i?(document.addEventListener("touchstart",g),document.addEventListener("touchend",b)):document.addEventListener("mouseup",v),()=>{i?(document.removeEventListener("touchstart",g),document.removeEventListener("touchend",b)):document.removeEventListener("mouseup",v)}},[t,i]),S.jsxs(W3,{children:[S.jsx("div",{className:"flex w-full justify-between sm:justify-evenly select-none",children:s.map(m=>{if(m)return S.jsx("div",{className:"flex items-center",children:m.title==="Text formating"?S.jsx(q3,{asChild:!0,children:S.jsx("button",{ref:p,onClick:()=>m.onClick(),children:m.icon})}):m.title==="Text color"?S.jsx(q3,{asChild:!0,children:S.jsx("button",{onClick:()=>m.onClick(),children:m.icon})}):S.jsx("button",{className:pe("flex items-center rounded px-2 py-1 transition",{"text-black":m.isActive,"text-[#A1AAB1]":!m.isActive}),onClick:()=>m.onClick(),disabled:!m.isActive,children:m.icon})},m.title)})}),n===Pe.TEXT_FORMATING&&S.jsx(Sz,{editor:t,setToolVisibility:r}),n===Pe.LINK_POPUP&&S.jsx(_oe,{open:n===Pe.LINK_POPUP,onOpenChange:()=>r(Pe.NONE),title:"Link",content:S.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[S.jsx(z0,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:h(t),onChange:m=>u(m.target.value)}),S.jsx(z0,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:t.getAttributes("link").href,onChange:m=>{a(m.target.value)},isValid:c,message:c?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>d(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>r(Pe.NONE),className:"w-auto min-w-[80px]"}})]})},C2=_.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Ry=_.createContext({}),Py=_.createContext(null),S2=typeof document<"u",T2=S2?_.useLayoutEffect:_.useEffect,$P=_.createContext({strict:!1}),D2=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),GP="data-"+D2("framerAppearId"),Poe={skipAnimations:!1,useManualTiming:!1};class WP{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const n=this.order.indexOf(e);n!==-1&&(this.order.splice(n,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function Ioe(t){let e=new WP,n=new WP,r=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const f=c&&s,d=f?e:n;return u&&o.add(l),d.add(l)&&f&&s&&(r=e.order.length),l},cancel:l=>{n.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[e,n]=[n,e],n.clear(),r=e.order.length,r)for(let u=0;u<r;u++){const c=e.order[u];o.has(c)&&(a.schedule(c),t()),c(l)}s=!1,i&&(i=!1,a.process(l))}};return a}const Iy=["read","resolveKeyframes","update","preRender","render","postRender"],Loe=40;function qP(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=Iy.reduce((f,d)=>(f[d]=Ioe(()=>n=!0),f),{}),o=f=>{i[f].process(s)},a=()=>{const f=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(f-s.timestamp,Loe),1),s.timestamp=f,s.isProcessing=!0,Iy.forEach(o),s.isProcessing=!1,n&&e&&(r=!1,t(a))},l=()=>{n=!0,r=!0,s.isProcessing||t(a)};return{schedule:Iy.reduce((f,d)=>{const h=i[d];return f[d]=(p,m=!1,g=!1)=>(n||l(),h.schedule(p,m,g)),f},{}),cancel:f=>Iy.forEach(d=>i[d].cancel(f)),state:s,steps:i}}const{schedule:O2,cancel:Ade}=qP(queueMicrotask,!1);function Gc(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const KP=_.createContext({});let QP=!1;function Boe(t,e,n,r,s){const{visualElement:i}=_.useContext(Ry),o=_.useContext($P),a=_.useContext(Py),l=_.useContext(C2).reducedMotion,u=_.useRef();r=r||o.renderer,!u.current&&r&&(u.current=r(t,{visualState:e,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const c=u.current,f=_.useContext(KP);c&&!c.projection&&s&&(c.type==="html"||c.type==="svg")&&joe(u.current,n,s,f),_.useInsertionEffect(()=>{c&&c.update(n,a)});const d=_.useRef(!!(n[GP]&&!window.HandoffComplete));return T2(()=>{c&&(c.updateFeatures(),O2.render(c.render),d.current&&c.animationState&&c.animationState.animateChanges())}),_.useEffect(()=>{c&&(!d.current&&c.animationState&&c.animationState.animateChanges(),d.current&&(d.current=!1,QP||(QP=!0,queueMicrotask(Foe))))}),c}function Foe(){window.HandoffComplete=!0}function joe(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:JP(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Gc(a),visualElement:t,scheduleRender:()=>t.scheduleRender(),animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function JP(t){if(t)return t.options.allowProjection!==!1?t.projection:JP(t.parent)}function Uoe(t,e,n){return _.useCallback(r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Gc(n)&&(n.current=r))},[e])}function Xh(t){return typeof t=="string"||Array.isArray(t)}function Ly(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const M2=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],N2=["initial",...M2];function By(t){return Ly(t.animate)||N2.some(e=>Xh(t[e]))}function YP(t){return!!(By(t)||t.variants)}function Hoe(t,e){if(By(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Xh(n)?n:void 0,animate:Xh(r)?r:void 0}}return t.inherit!==!1?e:{}}function Voe(t){const{initial:e,animate:n}=Hoe(t,_.useContext(Ry));return _.useMemo(()=>({initial:e,animate:n}),[XP(e),XP(n)])}function XP(t){return Array.isArray(t)?t.join(" "):t}const ZP={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"]},Wc={};for(const t in ZP)Wc[t]={isEnabled:e=>ZP[t].some(n=>!!e[n])};function zoe(t){for(const e in t)Wc[e]={...Wc[e],...t[e]}}const _2=_.createContext({}),$oe=Symbol.for("motionComponentSymbol"),Sn=t=>t;let qc=Sn,Yi=Sn;process.env.NODE_ENV!=="production"&&(qc=(t,e)=>{!t&&typeof console<"u"&&console.warn(e)},Yi=(t,e)=>{if(!t)throw new Error(e)});function Goe({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:r,Component:s}){t&&zoe(t);function i(a,l){let u;const c={..._.useContext(C2),...a,layoutId:Woe(a)},{isStatic:f}=c,d=Voe(a),h=r(a,f);if(!f&&S2){qoe(c,t);const p=Koe(c);u=p.MeasureLayout,d.visualElement=Boe(s,h,c,e,p.ProjectionNode)}return S.jsxs(Ry.Provider,{value:d,children:[u&&d.visualElement?S.jsx(u,{visualElement:d.visualElement,...c}):null,n(s,a,Uoe(h,d.visualElement,l),h,f,d.visualElement)]})}const o=_.forwardRef(i);return o[$oe]=s,o}function Woe({layoutId:t}){const e=_.useContext(_2).id;return e&&t!==void 0?e+"-"+t:t}function qoe(t,e){const n=_.useContext($P).strict;if(process.env.NODE_ENV!=="production"&&e&&n){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";t.ignoreStrict?qc(!1,r):Yi(!1,r)}}function Koe(t){const{drag:e,layout:n}=Wc;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Qoe(t){function e(r,s={}){return Goe(t(r,s))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(r,s)=>(n.has(s)||n.set(s,e(s)),n.get(s))})}const Joe=["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 R2(t){return typeof t!="string"||t.includes("-")?!1:!!(Joe.indexOf(t)>-1||/[A-Z]/u.test(t))}const Fy={};function Yoe(t){Object.assign(Fy,t)}const Zh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Bl=new Set(Zh);function e8(t,{layout:e,layoutId:n}){return Bl.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Fy[t]||t==="opacity")}const Pn=t=>!!(t&&t.getVelocity),Xoe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Zoe=Zh.length;function eae(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},r,s){let i="";for(let o=0;o<Zoe;o++){const a=Zh[o];if(t[a]!==void 0){const l=Xoe[a]||a;i+=`${l}(${t[a]}) `}}return e&&!t.z&&(i+="translateZ(0)"),i=i.trim(),s?i=s(t,r?"":i):n&&r&&(i="none"),i}const t8=t=>e=>typeof e=="string"&&e.startsWith(t),n8=t8("--"),tae=t8("var(--"),P2=t=>tae(t)?nae.test(t.split("/*")[0].trim()):!1,nae=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,rae=(t,e)=>e&&typeof t=="number"?e.transform(t):t,la=(t,e,n)=>n>e?e:n<t?t:n,Kc={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ep={...Kc,transform:t=>la(0,1,t)},jy={...Kc,default:1},tp=t=>Math.round(t*1e5)/1e5,I2=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,sae=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,iae=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function np(t){return typeof t=="string"}const rp=t=>({test:e=>np(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ua=rp("deg"),hi=rp("%"),Le=rp("px"),oae=rp("vh"),aae=rp("vw"),r8={...hi,parse:t=>hi.parse(t)/100,transform:t=>hi.transform(t*100)},s8={...Kc,transform:Math.round},i8={borderWidth:Le,borderTopWidth:Le,borderRightWidth:Le,borderBottomWidth:Le,borderLeftWidth:Le,borderRadius:Le,radius:Le,borderTopLeftRadius:Le,borderTopRightRadius:Le,borderBottomRightRadius:Le,borderBottomLeftRadius:Le,width:Le,maxWidth:Le,height:Le,maxHeight:Le,size:Le,top:Le,right:Le,bottom:Le,left:Le,padding:Le,paddingTop:Le,paddingRight:Le,paddingBottom:Le,paddingLeft:Le,margin:Le,marginTop:Le,marginRight:Le,marginBottom:Le,marginLeft:Le,rotate:ua,rotateX:ua,rotateY:ua,rotateZ:ua,scale:jy,scaleX:jy,scaleY:jy,scaleZ:jy,skew:ua,skewX:ua,skewY:ua,distance:Le,translateX:Le,translateY:Le,translateZ:Le,x:Le,y:Le,z:Le,perspective:Le,transformPerspective:Le,opacity:ep,originX:r8,originY:r8,originZ:Le,zIndex:s8,backgroundPositionX:Le,backgroundPositionY:Le,fillOpacity:ep,strokeOpacity:ep,numOctaves:s8};function L2(t,e,n,r){const{style:s,vars:i,transform:o,transformOrigin:a}=t;let l=!1,u=!1,c=!0;for(const f in e){const d=e[f];if(n8(f)){i[f]=d;continue}const h=i8[f],p=rae(d,h);if(Bl.has(f)){if(l=!0,o[f]=p,!c)continue;d!==(h.default||0)&&(c=!1)}else f.startsWith("origin")?(u=!0,a[f]=p):s[f]=p}if(e.transform||(l||r?s.transform=eae(t.transform,n,c,r):s.transform&&(s.transform="none")),u){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;s.transformOrigin=`${f} ${d} ${h}`}}const B2=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function o8(t,e,n){for(const r in e)!Pn(e[r])&&!e8(r,n)&&(t[r]=e[r])}function lae({transformTemplate:t},e,n){return _.useMemo(()=>{const r=B2();return L2(r,e,{enableHardwareAcceleration:!n},t),Object.assign({},r.vars,r.style)},[e])}function uae(t,e,n){const r=t.style||{},s={};return o8(s,r,t),Object.assign(s,lae(t,e,n)),s}function cae(t,e,n){const r={},s=uae(t,e,n);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=s,r}const fae=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 Uy(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||fae.has(t)}let a8=t=>!Uy(t);function dae(t){t&&(a8=e=>e.startsWith("on")?!Uy(e):t(e))}try{dae(require("@emotion/is-prop-valid").default)}catch{}function hae(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(a8(s)||n===!0&&Uy(s)||!e&&!Uy(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}function l8(t,e,n){return typeof t=="string"?t:Le.transform(e+n*t)}function pae(t,e,n){const r=l8(e,t.x,t.width),s=l8(n,t.y,t.height);return`${r} ${s}`}const mae={offset:"stroke-dashoffset",array:"stroke-dasharray"},gae={offset:"strokeDashoffset",array:"strokeDasharray"};function yae(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?mae:gae;t[i.offset]=Le.transform(-r);const o=Le.transform(e),a=Le.transform(n);t[i.array]=`${o} ${a}`}function F2(t,{attrX:e,attrY:n,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},c,f,d){if(L2(t,u,c,d),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p,dimensions:m}=t;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=pae(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),o!==void 0&&yae(h,o,a,l,!1)}const u8=()=>({...B2(),attrs:{}}),j2=t=>typeof t=="string"&&t.toLowerCase()==="svg";function bae(t,e,n,r){const s=_.useMemo(()=>{const i=u8();return F2(i,e,{enableHardwareAcceleration:!1},j2(r),t.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};o8(i,t.style,t),s.style={...i,...s.style}}return s}function wae(t=!1){return(n,r,s,{latestValues:i},o)=>{const l=(R2(n)?bae:cae)(r,i,o,n),u=hae(r,typeof n=="string",t),c=n!==_.Fragment?{...u,...l,ref:s}:{},{children:f}=r,d=_.useMemo(()=>Pn(f)?f.get():f,[f]);return _.createElement(n,{...c,children:d})}}function c8(t,{style:e,vars:n},r,s){Object.assign(t.style,e,s&&s.getProjectionStyles(r));for(const i in n)t.style.setProperty(i,n[i])}const f8=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 d8(t,e,n,r){c8(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(f8.has(s)?s:D2(s),e.attrs[s])}function U2(t,e,n){var r;const{style:s}=t,i={};for(const o in s)(Pn(s[o])||e.style&&Pn(e.style[o])||e8(o,t)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function h8(t,e,n){const r=U2(t,e,n);for(const s in t)if(Pn(t[s])||Pn(e[s])){const i=Zh.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}function p8(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function H2(t,e,n,r){if(typeof e=="function"){const[s,i]=p8(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=p8(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function m8(t){const e=_.useRef(null);return e.current===null&&(e.current=t()),e.current}const V2=t=>Array.isArray(t),Aae=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),vae=t=>V2(t)?t[t.length-1]||0:t;function Hy(t){const e=Pn(t)?t.get():t;return Aae(e)?e.toValue():e}function xae({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,s,i){const o={latestValues:kae(r,s,i,t),renderState:e()};return n&&(o.mount=a=>n(r,a,o)),o}const g8=t=>(e,n)=>{const r=_.useContext(Ry),s=_.useContext(Py),i=()=>xae(t,e,r,s);return n?i():m8(i)};function kae(t,e,n,r){const s={},i=r(t,{});for(const d in i)s[d]=Hy(i[d]);let{initial:o,animate:a}=t;const l=By(t),u=YP(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let c=n?n.initial===!1:!1;c=c||o===!1;const f=c?a:o;return f&&typeof f!="boolean"&&!Ly(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=H2(t,h);if(!p)return;const{transitionEnd:m,transition:g,...b}=p;for(const v in b){let A=b[v];if(Array.isArray(A)){const w=c?A.length-1:0;A=A[w]}A!==null&&(s[v]=A)}for(const v in m)s[v]=m[v]}),s}const{schedule:pt,cancel:Xi,state:Tn,steps:z2}=qP(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sn,!0),Eae={useVisualState:g8({scrapeMotionValuesFromProps:h8,createRenderState:u8,onMount:(t,e,{renderState:n,latestValues:r})=>{pt.read(()=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),pt.render(()=>{F2(n,r,{enableHardwareAcceleration:!1},j2(e.tagName),t.transformTemplate),d8(e,n)})}})},Cae={useVisualState:g8({scrapeMotionValuesFromProps:U2,createRenderState:B2})};function Sae(t,{forwardMotionProps:e=!1},n,r){return{...R2(t)?Eae:Cae,preloadedFeatures:n,useRender:wae(e),createVisualElement:r,Component:t}}function Zi(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const y8=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Vy(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Tae=t=>e=>y8(e)&&t(e,Vy(e));function eo(t,e,n,r){return Zi(t,e,Tae(n),r)}const Dae=(t,e)=>n=>e(t(n)),to=(...t)=>t.reduce(Dae);function b8(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const w8=b8("dragHorizontal"),A8=b8("dragVertical");function v8(t){let e=!1;if(t==="y")e=A8();else if(t==="x")e=w8();else{const n=w8(),r=A8();n&&r?e=()=>{n(),r()}:(n&&n(),r&&r())}return e}function x8(){const t=v8(!0);return t?(t(),!1):!0}class ca{constructor(e){this.isMounted=!1,this.node=e}update(){}}function k8(t,e){const n=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||x8())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const l=a[r];l&&pt.postRender(()=>l(i,o))};return eo(t.current,n,s,{passive:!t.getProps()[r]})}class Oae extends ca{mount(){this.unmount=to(k8(this.node,!0),k8(this.node,!1))}unmount(){}}class Mae extends ca{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=to(Zi(this.node.current,"focus",()=>this.onFocus()),Zi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const E8=(t,e)=>e?t===e?!0:E8(t,e.parentElement):!1;function $2(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,Vy(n))}class Nae extends ca{constructor(){super(...arguments),this.removeStartListeners=Sn,this.removeEndListeners=Sn,this.removeAccessibleListeners=Sn,this.startPointerPress=(e,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=eo(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c,globalTapTarget:f}=this.node.getProps(),d=!f&&!E8(this.node.current,a.target)?c:u;d&&pt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=eo(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=to(i,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||$2("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&pt.postRender(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Zi(this.node.current,"keyup",o),$2("down",(a,l)=>{this.startPress(a,l)})},n=Zi(this.node.current,"keydown",e),r=()=>{this.isPressing&&$2("cancel",(i,o)=>this.cancelPress(i,o))},s=Zi(this.node.current,"blur",r);this.removeAccessibleListeners=to(n,s)}}startPress(e,n){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&pt.postRender(()=>r(e,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!x8()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&pt.postRender(()=>r(e,n))}mount(){const e=this.node.getProps(),n=eo(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Zi(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=to(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const G2=new WeakMap,W2=new WeakMap,_ae=t=>{const e=G2.get(t.target);e&&e(t)},Rae=t=>{t.forEach(_ae)};function Pae({root:t,...e}){const n=t||document;W2.has(n)||W2.set(n,{});const r=W2.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(Rae,{root:t,...e})),r[s]}function Iae(t,e,n){const r=Pae(e);return G2.set(t,n),r.observe(t),()=>{G2.delete(t),r.unobserve(t)}}const Lae={some:0,all:1};class Bae extends ca{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:Lae[s]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:f}=this.node.getProps(),d=u?c:f;d&&d(l)};return Iae(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(Fae(e,n))&&this.startObserver()}unmount(){}}function Fae({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const jae={inView:{Feature:Bae},tap:{Feature:Nae},focus:{Feature:Mae},hover:{Feature:Oae}};function C8(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function zy(t,e,n){const r=t.getProps();return H2(r,e,n!==void 0?n:r.custom,t)}const no=t=>t*1e3,ro=t=>t/1e3,Uae={type:"spring",stiffness:500,damping:25,restSpeed:10},Hae=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Vae={type:"keyframes",duration:.8},zae={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$ae=(t,{keyframes:e})=>e.length>2?Vae:Bl.has(t)?t.startsWith("scale")?Hae(e[1]):Uae:zae;function Gae({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length}function q2(t,e){return t[e]||t.default||t}const Wae=t=>t!==null;function $y(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Wae),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}let Gy;function qae(){Gy=void 0}const fa={now:()=>(Gy===void 0&&fa.set(Tn.isProcessing||Poe.useManualTiming?Tn.timestamp:performance.now()),Gy),set:t=>{Gy=t,queueMicrotask(qae)}},S8=t=>/^0[^.\s]+$/u.test(t);function Kae(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||S8(t):!0}const T8=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Qae=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Jae(t){const e=Qae.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}const Yae=4;function D8(t,e,n=1){Yi(n<=Yae,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);const[r,s]=Jae(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return T8(o)?parseFloat(o):o}return P2(s)?D8(s,e,n+1):s}const Xae=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),O8=t=>t===Kc||t===Le,M8=(t,e)=>parseFloat(t.split(", ")[e]),N8=(t,e)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return M8(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?M8(i[1],t):0}},Zae=new Set(["x","y","z"]),ele=Zh.filter(t=>!Zae.has(t));function tle(t){const e=[];return ele.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Qc={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:N8(4,13),y:N8(5,14)};Qc.translateX=Qc.x,Qc.translateY=Qc.y;const _8=t=>e=>e.test(t),R8=[Kc,Le,hi,ua,aae,oae,{test:t=>t==="auto",parse:t=>t}],P8=t=>R8.find(_8(t)),Fl=new Set;let K2=!1,Q2=!1;function I8(){if(Q2){const t=Array.from(Fl).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=tle(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Q2=!1,K2=!1,Fl.forEach(t=>t.complete()),Fl.clear()}function L8(){Fl.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Q2=!0)})}function nle(){L8(),I8()}class J2{constructor(e,n,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Fl.add(this),K2||(K2=!0,pt.read(L8),pt.resolveKeyframes(I8))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const l=r.readValue(n,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Fl.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Fl.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Y2=(t,e)=>n=>!!(np(n)&&iae.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),B8=(t,e,n)=>r=>{if(!np(r))return r;const[s,i,o,a]=r.match(I2);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},rle=t=>la(0,255,t),X2={...Kc,transform:t=>Math.round(rle(t))},jl={test:Y2("rgb","red"),parse:B8("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+X2.transform(t)+", "+X2.transform(e)+", "+X2.transform(n)+", "+tp(ep.transform(r))+")"};function sle(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Z2={test:Y2("#"),parse:sle,transform:jl.transform},Jc={test:Y2("hsl","hue"),parse:B8("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+hi.transform(tp(e))+", "+hi.transform(tp(n))+", "+tp(ep.transform(r))+")"},In={test:t=>jl.test(t)||Z2.test(t)||Jc.test(t),parse:t=>jl.test(t)?jl.parse(t):Jc.test(t)?Jc.parse(t):Z2.parse(t),transform:t=>np(t)?t:t.hasOwnProperty("red")?jl.transform(t):Jc.transform(t)};function ile(t){var e,n;return isNaN(t)&&np(t)&&(((e=t.match(I2))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(sae))===null||n===void 0?void 0:n.length)||0)>0}const F8="number",j8="color",ole="var",ale="var(",U8="${}",lle=/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 sp(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(lle,l=>(In.test(l)?(r.color.push(i),s.push(j8),n.push(In.parse(l))):l.startsWith(ale)?(r.var.push(i),s.push(ole),n.push(l)):(r.number.push(i),s.push(F8),n.push(parseFloat(l))),++i,U8)).split(U8);return{values:n,split:a,indexes:r,types:s}}function H8(t){return sp(t).values}function V8(t){const{split:e,types:n}=sp(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=n[o];a===F8?i+=tp(s[o]):a===j8?i+=In.transform(s[o]):i+=s[o]}return i}}const ule=t=>typeof t=="number"?0:t;function cle(t){const e=H8(t);return V8(t)(e.map(ule))}const da={test:ile,parse:H8,createTransformer:V8,getAnimatableNone:cle},fle=new Set(["brightness","contrast","saturate","opacity"]);function dle(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(I2)||[];if(!r)return t;const s=n.replace(r,"");let i=fle.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const hle=/\b([a-z-]*)\(.*?\)/gu,ek={...da,getAnimatableNone:t=>{const e=t.match(hle);return e?e.map(dle).join(" "):t}},ple={...i8,color:In,backgroundColor:In,outlineColor:In,fill:In,stroke:In,borderColor:In,borderTopColor:In,borderRightColor:In,borderBottomColor:In,borderLeftColor:In,filter:ek,WebkitFilter:ek},tk=t=>ple[t];function z8(t,e){let n=tk(t);return n!==ek&&(n=da),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const mle=new Set(["auto","none","0"]);function gle(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!mle.has(i)&&sp(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=z8(n,s)}class $8 extends J2{constructor(e,n,r,s){super(e,n,r,s,s==null?void 0:s.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let u=e[l];if(typeof u=="string"&&(u=u.trim(),P2(u))){const c=D8(u,n.current);c!==void 0&&(e[l]=c),l===e.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!Xae.has(r)||e.length!==2)return;const[s,i]=e,o=P8(s),a=P8(i);if(o!==a)if(O8(o)&&O8(a))for(let l=0;l<e.length;l++){const u=e[l];typeof u=="string"&&(e[l]=parseFloat(u))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)Kae(e[s])&&r.push(s);r.length&&gle(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Qc[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:n,name:r,unresolvedKeyframes:s}=this;if(!n.current)return;const i=n.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Qc[r](n.measureViewportBox(),window.getComputedStyle(n.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,u])=>{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function G8(t){let e;return()=>(e===void 0&&(e=t()),e)}const W8=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(da.test(t)||t==="0")&&!t.startsWith("url("));function yle(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 ble(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=W8(s,e),a=W8(i,e);return qc(o===a,`You are trying to animate ${e} from "${s}" to "${i}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${i} via the \`style\` property.`),!o||!a?!1:yle(t)||n==="spring"&&r}class q8{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&nle(),this._resolved}onKeyframesResolved(e,n){this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!ble(e,r,s,i))if(o)this.options.duration=0;else{l==null||l($y(e,this.options,n)),a==null||a(),this.resolveFinishedPromise();return}const c=this.initPlayback(e,n);c!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...c},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function K8(t,e){return e?t*(1e3/e):0}const wle=5;function Q8(t,e,n){const r=Math.max(e-wle,0);return K8(n-t(r),e-r)}const nk=.001,Ale=.01,J8=10,vle=.05,xle=1;function kle({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let s,i;qc(t<=no(J8),"Spring duration must be 10 seconds or less");let o=1-e;o=la(vle,xle,o),t=la(Ale,J8,ro(t)),o<1?(s=u=>{const c=u*o,f=c*t,d=c-n,h=rk(u,o),p=Math.exp(-f);return nk-d/h*p},i=u=>{const f=u*o*t,d=f*n+n,h=Math.pow(o,2)*Math.pow(u,2)*t,p=Math.exp(-f),m=rk(Math.pow(u,2),o);return(-s(u)+nk>0?-1:1)*((d-h)*p)/m}):(s=u=>{const c=Math.exp(-u*t),f=(u-n)*t+1;return-nk+c*f},i=u=>{const c=Math.exp(-u*t),f=(n-u)*(t*t);return c*f});const a=5/t,l=Cle(s,i,a);if(t=no(t),isNaN(l))return{stiffness:100,damping:10,duration:t};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const Ele=12;function Cle(t,e,n){let r=n;for(let s=1;s<Ele;s++)r=r-t(r)/e(r);return r}function rk(t,e){return t*Math.sqrt(1-e*e)}const Sle=["duration","bounce"],Tle=["stiffness","damping","mass"];function Y8(t,e){return e.some(n=>t[n]!==void 0)}function Dle(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Y8(t,Tle)&&Y8(t,Sle)){const n=kle(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}function X8({keyframes:t,restDelta:e,restSpeed:n,...r}){const s=t[0],i=t[t.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:u,duration:c,velocity:f,isResolvedFromDuration:d}=Dle({...r,velocity:-ro(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*u)),m=i-s,g=ro(Math.sqrt(a/u)),b=Math.abs(m)<5;n||(n=b?.01:2),e||(e=b?.005:.5);let v;if(p<1){const A=rk(g,p);v=w=>{const x=Math.exp(-p*g*w);return i-x*((h+p*g*m)/A*Math.sin(A*w)+m*Math.cos(A*w))}}else if(p===1)v=A=>i-Math.exp(-g*A)*(m+(h+g*m)*A);else{const A=g*Math.sqrt(p*p-1);v=w=>{const x=Math.exp(-p*g*w),k=Math.min(A*w,300);return i-x*((h+p*g*m)*Math.sinh(k)+A*m*Math.cosh(k))/A}}return{calculatedDuration:d&&c||null,next:A=>{const w=v(A);if(d)o.done=A>=c;else{let x=h;A!==0&&(p<1?x=Q8(v,A,w):x=0);const k=Math.abs(x)<=n,C=Math.abs(i-w)<=e;o.done=k&&C}return o.value=o.done?i:w,o}}}function Z8({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:c}){const f=t[0],d={done:!1,value:f},h=D=>a!==void 0&&D<a||l!==void 0&&D>l,p=D=>a===void 0?l:l===void 0||Math.abs(a-D)<Math.abs(l-D)?a:l;let m=n*e;const g=f+m,b=o===void 0?g:o(g);b!==g&&(m=b-f);const v=D=>-m*Math.exp(-D/r),A=D=>b+v(D),w=D=>{const O=v(D),N=A(D);d.done=Math.abs(O)<=u,d.value=d.done?b:N};let x,k;const C=D=>{h(d.value)&&(x=D,k=X8({keyframes:[d.value,p(d.value)],velocity:Q8(A,D,d.value),damping:s,stiffness:i,restDelta:u,restSpeed:c}))};return C(0),{calculatedDuration:null,next:D=>{let O=!1;return!k&&x===void 0&&(O=!0,w(D),C(D)),x!==void 0&&D>=x?k.next(D-x):(!O&&w(D),d)}}}const eI=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Ole=1e-7,Mle=12;function Nle(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=eI(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>Ole&&++a<Mle);return o}function ip(t,e,n,r){if(t===e&&n===r)return Sn;const s=i=>Nle(i,0,1,t,n);return i=>i===0||i===1?i:eI(s(i),e,r)}const _le=ip(.42,0,1,1),Rle=ip(0,0,.58,1),tI=ip(.42,0,.58,1),Ple=t=>Array.isArray(t)&&typeof t[0]!="number",nI=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,rI=t=>e=>1-t(1-e),sk=t=>1-Math.sin(Math.acos(t)),sI=rI(sk),Ile=nI(sk),iI=ip(.33,1.53,.69,.99),ik=rI(iI),Lle=nI(ik),oI={linear:Sn,easeIn:_le,easeInOut:tI,easeOut:Rle,circIn:sk,circInOut:Ile,circOut:sI,backIn:ik,backInOut:Lle,backOut:iI,anticipate:t=>(t*=2)<1?.5*ik(t):.5*(2-Math.pow(2,-10*(t-1)))},aI=t=>{if(Array.isArray(t)){Yi(t.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,n,r,s]=t;return ip(e,n,r,s)}else if(typeof t=="string")return Yi(oI[t]!==void 0,`Invalid easing type '${t}'`),oI[t];return t},op=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r},Bt=(t,e,n)=>t+(e-t)*n;function ok(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 Ble({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=ok(l,a,t+1/3),i=ok(l,a,t),o=ok(l,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Wy(t,e){return n=>n>0?e:t}const ak=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},Fle=[Z2,jl,Jc],jle=t=>Fle.find(e=>e.test(t));function lI(t){const e=jle(t);if(qc(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let n=e.parse(t);return e===Jc&&(n=Ble(n)),n}const uI=(t,e)=>{const n=lI(t),r=lI(e);if(!n||!r)return Wy(t,e);const s={...n};return i=>(s.red=ak(n.red,r.red,i),s.green=ak(n.green,r.green,i),s.blue=ak(n.blue,r.blue,i),s.alpha=Bt(n.alpha,r.alpha,i),jl.transform(s))},lk=new Set(["none","hidden"]);function Ule(t,e){return lk.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Hle(t,e){return n=>Bt(t,e,n)}function uk(t){return typeof t=="number"?Hle:typeof t=="string"?P2(t)?Wy:In.test(t)?uI:$le:Array.isArray(t)?cI:typeof t=="object"?In.test(t)?uI:Vle:Wy}function cI(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>uk(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function Vle(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=uk(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function zle(t,e){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=t.indexes[o][s[o]],l=(n=t.values[a])!==null&&n!==void 0?n:0;r[i]=l,s[o]++}return r}const $le=(t,e)=>{const n=da.createTransformer(e),r=sp(t),s=sp(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?lk.has(t)&&!s.values.length||lk.has(e)&&!r.values.length?Ule(t,e):to(cI(zle(r,s),s.values),n):(qc(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Wy(t,e))};function fI(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?Bt(t,e,n):uk(t)(t,e)}function Gle(t,e,n){const r=[],s=n||fI,i=t.length-1;for(let o=0;o<i;o++){let a=s(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||Sn:e;a=to(l,a)}r.push(a)}return r}function Wle(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(Yi(i===e.length,"Both input and output ranges must be the same length"),i===1)return()=>e[0];if(i===2&&t[0]===t[1])return()=>e[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=Gle(e,r,s),a=o.length,l=u=>{let c=0;if(a>1)for(;c<t.length-2&&!(u<t[c+1]);c++);const f=op(t[c],t[c+1],u);return o[c](f)};return n?u=>l(la(t[0],t[i-1],u)):l}function qle(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=op(0,e,r);t.push(Bt(n,1,s))}}function Kle(t){const e=[0];return qle(e,t.length-1),e}function Qle(t,e){return t.map(n=>n*e)}function Jle(t,e){return t.map(()=>e||tI).splice(0,t.length-1)}function qy({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=Ple(r)?r.map(aI):aI(r),i={done:!1,value:e[0]},o=Qle(n&&n.length===e.length?n:Kle(e),t),a=Wle(o,e,{ease:Array.isArray(s)?s:Jle(e,s)});return{calculatedDuration:t,next:l=>(i.value=a(l),i.done=l>=t,i)}}const dI=2e4;function Yle(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<dI;)e+=n,r=t.next(e);return e>=dI?1/0:e}const Xle=t=>{const e=({timestamp:n})=>t(n);return{start:()=>pt.update(e,!0),stop:()=>Xi(e),now:()=>Tn.isProcessing?Tn.timestamp:fa.now()}},Zle={decay:Z8,inertia:Z8,tween:qy,keyframes:qy,spring:X8},eue=t=>t/100;class ck extends q8{constructor({KeyframeResolver:e=J2,...n}){super(n),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:a}=this.options;a&&a()};const{name:r,motionValue:s,keyframes:i}=this.options,o=(a,l)=>this.onKeyframesResolved(a,l);r&&s&&s.owner?this.resolver=s.owner.resolveKeyframes(i,o,r,s):this.resolver=new e(i,o,r,s),this.resolver.scheduleResolve()}initPlayback(e){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=Zle[n]||qy;let l,u;a!==qy&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&Yi(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),l=to(eue,fI(e[0],e[1])),e=[0,100]);const c=a({...this.options,keyframes:e});i==="mirror"&&(u=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Yle(c));const{calculatedDuration:f}=c,d=f+s,h=d*(r+1)-s;return{generator:c,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:r}=this;if(!r){const{keyframes:D}=this.options;return{done:!0,value:D[D.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:c,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const b=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?b<0:b>c;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=c);let A=this.currentTime,w=i;if(h){const D=Math.min(this.currentTime,c)/f;let O=Math.floor(D),N=D%1;!N&&D>=1&&(N=1),N===1&&O--,O=Math.min(O,h+1),!!(O%2)&&(p==="reverse"?(N=1-N,m&&(N-=m/f)):p==="mirror"&&(w=o)),A=la(0,1,N)*f}const x=v?{done:!1,value:l[0]}:w.next(A);a&&(x.value=a(x.value));let{done:k}=x;!v&&u!==null&&(k=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return C&&s!==void 0&&(x.value=$y(l,this.options,s)),g&&g(x.value),C&&this.finish(),x}get duration(){const{resolved:e}=this;return e?ro(e.calculatedDuration):0}get time(){return ro(this.currentTime)}set time(e){e=no(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=ro(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Xle,onPlay:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=r),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const hI=t=>Array.isArray(t)&&typeof t[0]=="number";function pI(t){return!!(!t||typeof t=="string"&&t in fk||hI(t)||Array.isArray(t)&&t.every(pI))}const ap=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,fk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ap([0,.65,.55,1]),circOut:ap([.55,0,1,.45]),backIn:ap([.31,.01,.66,-.59]),backOut:ap([.33,1.53,.69,.99])};function tue(t){return mI(t)||fk.easeOut}function mI(t){if(t)return hI(t)?ap(t):Array.isArray(t)?t.map(tue):fk[t]}function nue(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=mI(a);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:r,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const rue=G8(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),sue=new Set(["opacity","clipPath","filter","transform"]),Ky=10,iue=2e4;function oue(t){return t.type==="spring"||t.name==="backgroundColor"||!pI(t.ease)}function aue(t,e){const n=new ck({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const s=[];let i=0;for(;!r.done&&i<iue;)r=n.sample(i),s.push(r.value),i+=Ky;return{times:void 0,keyframes:s,duration:i-Ky,ease:"linear"}}class gI extends q8{constructor(e){super(e);const{name:n,motionValue:r,keyframes:s}=this.options;this.resolver=new $8(s,(i,o)=>this.onKeyframesResolved(i,o),n,r),this.resolver.scheduleResolve()}initPlayback(e,n){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:l,name:u}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(oue(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=aue(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),s=m.duration,i=m.times,o=m.ease,a="keyframes"}const c=nue(l.owner.current,u,e,{...this.options,duration:s,times:i,ease:o});return c.startTime=fa.now(),this.pendingTimeline?(c.timeline=this.pendingTimeline,this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:f}=this.options;l.set($y(e,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return ro(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return ro(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=no(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return Sn;const{animation:r}=n;r.timeline=e,r.onfinish=null}return Sn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(!(n.playState==="idle"||n.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:u,onComplete:c,...f}=this.options,d=new ck({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),h=no(this.time);l.setWithVelocity(d.sample(h-Ky).value,d.sample(h).value,Ky)}this.cancel()}}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return rue()&&r&&sue.has(r)&&n&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}function lue(t,e){let n;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;n!==o&&t(o),n=o};return pt.update(r,!0),()=>Xi(r)}const uue=G8(()=>window.ScrollTimeline!==void 0);class cue{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,n){return Promise.all(this.animations).then(e).catch(n)}getAll(e){return this.animations[0][e]}setAll(e,n){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=n}attachTimeline(e){const n=this.animations.map(r=>{if(uue()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),lue(s=>{r.time=r.duration*s},e)});return()=>{n.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let n=0;n<this.animations.length;n++)e=Math.max(e,this.animations[n].duration);return e}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const dk=(t,e,n,r={},s,i)=>o=>{const a=q2(r,t)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-no(l);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};Gae(a)||(c={...c,...$ae(t,c)}),c.duration&&(c.duration=no(c.duration)),c.repeatDelay&&(c.repeatDelay=no(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(f=!0)),f&&!i&&e.get()!==void 0){const d=$y(c.keyframes,a);if(d!==void 0)return pt.update(()=>{c.onUpdate(d),c.onComplete()}),new cue([])}return!i&&gI.supports(c)?new gI(c):new ck(c)};function Qy(t){return!!(Pn(t)&&t.add)}function hk(t,e){t.indexOf(e)===-1&&t.push(e)}function pk(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class mk{constructor(){this.subscriptions=[]}add(e){return hk(this.subscriptions,e),()=>pk(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const yI=new Set;function gk(t,e,n){t||yI.has(e)||(console.warn(e),yI.add(e))}const bI=30,fue=t=>!isNaN(parseFloat(t));class due{constructor(e,n={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=fa.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=fa.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=fue(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&gk(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new mk);const r=this.events[e].add(n);return e==="change"?()=>{r(),pt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=fa.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>bI)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,bI);return K8(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(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function lp(t,e){return new due(t,e)}function hue(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,lp(n))}function pue(t,e){const n=zy(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=vae(i[o]);hue(t,o,a)}}function wI(t){return t.getProps()[GP]}function mue({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function AI(t,e,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;const u=t.getValue("willChange");r&&(o=r);const c=[],f=s&&t.animationState&&t.animationState.getState()[s];for(const d in l){const h=t.getValue(d,(i=t.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||f&&mue(f,d))continue;const m={delay:n,elapsed:0,...q2(o||{},d)};let g=!1;if(window.HandoffAppearAnimations){const v=wI(t);if(v){const A=window.HandoffAppearAnimations(v,d,h,pt);A!==null&&(m.elapsed=A,g=!0)}}h.start(dk(d,h,p,t.shouldReduceMotion&&Bl.has(d)?{type:!1}:m,t,g));const b=h.animation;b&&(Qy(u)&&(u.add(d),b.then(()=>u.remove(d))),c.push(b))}return a&&Promise.all(c).then(()=>{pt.update(()=>{a&&pue(t,a)})}),c}function yk(t,e,n={}){var r;const s=zy(t,e,n.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>Promise.all(AI(t,s,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:d}=i;return gue(t,e,c+u,f,d,n)}:()=>Promise.resolve(),{when:l}=i;if(l){const[u,c]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>c())}else return Promise.all([o(),a(n.delay)])}function gue(t,e,n=0,r=0,s=1,i){const o=[],a=(t.variantChildren.size-1)*r,l=s===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(t.variantChildren).sort(yue).forEach((u,c)=>{u.notify("AnimationStart",e),o.push(yk(u,e,{...i,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function yue(t,e){return t.sortNodePosition(e)}function bue(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>yk(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=yk(t,e,n);else{const s=typeof e=="function"?zy(t,e,n.custom):e;r=Promise.all(AI(t,s,n))}return r.then(()=>{pt.postRender(()=>{t.notify("AnimationComplete",e)})})}const wue=[...M2].reverse(),Aue=M2.length;function vue(t){return e=>Promise.all(e.map(({animation:n,options:r})=>bue(t,n,r)))}function xue(t){let e=vue(t),n=vI(),r=!0;const s=l=>(u,c)=>{var f;const d=zy(t,c,l==="exit"?(f=t.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;u={...u,...m,...p}}return u};function i(l){e=l(t)}function o(l){const u=t.getProps(),c=t.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let g=0;g<Aue;g++){const b=wue[g],v=n[b],A=u[b]!==void 0?u[b]:c[b],w=Xh(A),x=b===l?v.isActive:null;x===!1&&(p=g);let k=A===c[b]&&A!==u[b]&&w;if(k&&r&&t.manuallyAnimateOnMount&&(k=!1),v.protectedKeys={...h},!v.isActive&&x===null||!A&&!v.prevProp||Ly(A)||typeof A=="boolean")continue;let D=kue(v.prevProp,A)||b===l&&v.isActive&&!k&&w||g>p&&w,O=!1;const N=Array.isArray(A)?A:[A];let R=N.reduce(s(b),{});x===!1&&(R={});const{prevResolvedValues:B={}}=v,F={...B,...R},G=I=>{D=!0,d.has(I)&&(O=!0,d.delete(I)),v.needsAnimating[I]=!0;const U=t.getValue(I);U&&(U.liveStyle=!1)};for(const I in F){const U=R[I],W=B[I];if(h.hasOwnProperty(I))continue;let ee=!1;V2(U)&&V2(W)?ee=!C8(U,W):ee=U!==W,ee?U!=null?G(I):d.add(I):U!==void 0&&d.has(I)?G(I):v.protectedKeys[I]=!0}v.prevProp=A,v.prevResolvedValues=R,v.isActive&&(h={...h,...R}),r&&t.blockInitialAnimation&&(D=!1),D&&(!k||O)&&f.push(...N.map(I=>({animation:I,options:{type:b}})))}if(d.size){const g={};d.forEach(b=>{const v=t.getBaseTarget(b),A=t.getValue(b);A&&(A.liveStyle=!0),g[b]=v??null}),f.push({animation:g})}let m=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,u){var c;if(n[l].isActive===u)return Promise.resolve();(c=t.variantChildren)===null||c===void 0||c.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,u)}),n[l].isActive=u;const f=o(l);for(const d in n)n[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>n,reset:()=>{n=vI(),r=!0}}}function kue(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!C8(e,t):!1}function Ul(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function vI(){return{animate:Ul(!0),whileInView:Ul(),whileHover:Ul(),whileTap:Ul(),whileDrag:Ul(),whileFocus:Ul(),exit:Ul()}}class Eue extends ca{constructor(e){super(e),e.animationState||(e.animationState=xue(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ly(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===void 0||e.call(this)}}let Cue=0;class Sue extends ca{constructor(){super(...arguments),this.id=Cue++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Tue={animation:{Feature:Eue},exit:{Feature:Sue}},xI=(t,e)=>Math.abs(t-e);function Due(t,e){const n=xI(t.x,e.x),r=xI(t.y,e.y);return Math.sqrt(n**2+r**2)}class kI{constructor(e,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=wk(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=Due(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=Tn;this.history.push({...p,timestamp:m});const{onStart:g,onMove:b}=this.handlers;d||(g&&g(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=bk(d,this.transformPagePoint),pt.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const g=wk(f.type==="pointercancel"?this.lastMoveEventInfo:bk(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,g),p&&p(f,g)},!y8(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const o=Vy(e),a=bk(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=Tn;this.history=[{...l,timestamp:u}];const{onSessionStart:c}=n;c&&c(e,wk(a,this.history)),this.removeListeners=to(eo(this.contextWindow,"pointermove",this.handlePointerMove),eo(this.contextWindow,"pointerup",this.handlePointerUp),eo(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Xi(this.updatePoint)}}function bk(t,e){return e?{point:e(t.point)}:t}function EI(t,e){return{x:t.x-e.x,y:t.y-e.y}}function wk({point:t},e){return{point:t,delta:EI(t,CI(e)),offset:EI(t,Oue(e)),velocity:Mue(e,.1)}}function Oue(t){return t[0]}function CI(t){return t[t.length-1]}function Mue(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=CI(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>no(e)));)n--;if(!r)return{x:0,y:0};const i=ro(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Pr(t){return t.max-t.min}function Ak(t,e=0,n=.01){return Math.abs(t-e)<=n}function SI(t,e,n,r=.5){t.origin=r,t.originPoint=Bt(e.min,e.max,t.origin),t.scale=Pr(n)/Pr(e),(Ak(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=Bt(n.min,n.max,t.origin)-t.originPoint,(Ak(t.translate)||isNaN(t.translate))&&(t.translate=0)}function up(t,e,n,r){SI(t.x,e.x,n.x,r?r.originX:void 0),SI(t.y,e.y,n.y,r?r.originY:void 0)}function TI(t,e,n){t.min=n.min+e.min,t.max=t.min+Pr(e)}function Nue(t,e,n){TI(t.x,e.x,n.x),TI(t.y,e.y,n.y)}function DI(t,e,n){t.min=e.min-n.min,t.max=t.min+Pr(e)}function cp(t,e,n){DI(t.x,e.x,n.x),DI(t.y,e.y,n.y)}function _ue(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?Bt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?Bt(n,t,r.max):Math.min(t,n)),t}function OI(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 Rue(t,{top:e,left:n,bottom:r,right:s}){return{x:OI(t.x,n,s),y:OI(t.y,e,r)}}function MI(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function Pue(t,e){return{x:MI(t.x,e.x),y:MI(t.y,e.y)}}function Iue(t,e){let n=.5;const r=Pr(t),s=Pr(e);return s>r?n=op(e.min,e.max-r,t.min):r>s&&(n=op(t.min,t.max-s,e.min)),la(0,1,n)}function Lue(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 vk=.35;function Bue(t=vk){return t===!1?t=0:t===!0&&(t=vk),{x:NI(t,"left","right"),y:NI(t,"top","bottom")}}function NI(t,e,n){return{min:_I(t,e),max:_I(t,n)}}function _I(t,e){return typeof t=="number"?t:t[e]||0}const RI=()=>({translate:0,scale:1,origin:0,originPoint:0}),Yc=()=>({x:RI(),y:RI()}),PI=()=>({min:0,max:0}),Kt=()=>({x:PI(),y:PI()});function es(t){return[t("x"),t("y")]}function II({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Fue({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function jue(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function xk(t){return t===void 0||t===1}function kk({scale:t,scaleX:e,scaleY:n}){return!xk(t)||!xk(e)||!xk(n)}function Hl(t){return kk(t)||LI(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function LI(t){return BI(t.x)||BI(t.y)}function BI(t){return t&&t!=="0%"}function Jy(t,e,n){const r=t-n,s=e*r;return n+s}function FI(t,e,n,r,s){return s!==void 0&&(t=Jy(t,s,r)),Jy(t,n,r)+e}function Ek(t,e=0,n=1,r,s){t.min=FI(t.min,e,n,r,s),t.max=FI(t.max,e,n,r,s)}function jI(t,{x:e,y:n}){Ek(t.x,e.translate,e.scale,e.originPoint),Ek(t.y,n.translate,n.scale,n.originPoint)}function Uue(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=n[a],o=i.projectionDelta;const l=i.instance;l&&l.style&&l.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Xc(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,jI(t,o)),r&&Hl(i.latestValues)&&Xc(t,i.latestValues))}e.x=UI(e.x),e.y=UI(e.y)}function UI(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function ha(t,e){t.min=t.min+e,t.max=t.max+e}function HI(t,e,[n,r,s]){const i=e[s]!==void 0?e[s]:.5,o=Bt(t.min,t.max,i);Ek(t,e[n],e[r],o,e.scale)}const Hue=["x","scaleX","originX"],Vue=["y","scaleY","originY"];function Xc(t,e){HI(t.x,e,Hue),HI(t.y,e,Vue)}function VI(t,e){return II(jue(t.getBoundingClientRect(),e))}function zue(t,e,n){const r=VI(t,n),{scroll:s}=e;return s&&(ha(r.x,s.offset.x),ha(r.y,s.offset.y)),r}const zI=({current:t})=>t?t.ownerDocument.defaultView:null,$ue=new WeakMap;class Gue{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Kt(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=c=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Vy(c,"page").point)},i=(c,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=v8(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),es(g=>{let b=this.getAxisMotionValue(g).get()||0;if(hi.test(b)){const{projection:v}=this.visualElement;if(v&&v.layout){const A=v.layout.layoutBox[g];A&&(b=Pr(A)*(parseFloat(b)/100))}}this.originPoint[g]=b}),p&&pt.postRender(()=>p(c,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(c,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:g}=f;if(h&&this.currentDirection===null){this.currentDirection=Wue(g),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,g),this.updateAxis("y",f.point,g),this.visualElement.render(),m&&m(c,f)},a=(c,f)=>this.stop(c,f),l=()=>es(c=>{var f;return this.getAnimationState(c)==="paused"&&((f=this.getAxisMotionValue(c).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new kI(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:zI(this.visualElement)})}stop(e,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&pt.postRender(()=>i(e,n))}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:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!Yy(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=_ue(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;n&&Gc(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=Rue(s.layoutBox,n):this.constraints=!1,this.elastic=Bue(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&es(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Lue(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Gc(e))return!1;const r=e.current;Yi(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=zue(r,s.root,this.visualElement.getTransformPagePoint());let o=Pue(s.layout.layoutBox,i);if(n){const a=n(Fue(o));this.hasMutatedConstraints=!!a,a&&(o=II(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=es(c=>{if(!Yy(c,n,this.currentDirection))return;let f=l&&l[c]||{};o&&(f={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?e[c]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return r.start(dk(e,r,0,n,this.visualElement))}stopAnimation(){es(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){es(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){es(n=>{const{drag:r}=this.getProps();if(!Yy(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n];i.set(e[n]-Bt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Gc(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};es(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=Iue({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),es(o=>{if(!Yy(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(Bt(l,u,s[o]))})}addListeners(){if(!this.visualElement.current)return;$ue.set(this.visualElement,this);const e=this.visualElement.current,n=eo(e,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Gc(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),pt.read(r);const o=Zi(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(es(c=>{const f=this.getAxisMotionValue(c);f&&(this.originPoint[c]+=l[c].translate,f.set(f.get()+l[c].translate))}),this.visualElement.render())});return()=>{o(),n(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=vk,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function Yy(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Wue(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class que extends ca{constructor(e){super(e),this.removeGroupControls=Sn,this.removeListeners=Sn,this.controls=new Gue(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Sn}unmount(){this.removeGroupControls(),this.removeListeners()}}const $I=t=>(e,n)=>{t&&pt.postRender(()=>t(e,n))};class Kue extends ca{constructor(){super(...arguments),this.removePointerDownListener=Sn}onPointerDown(e){this.session=new kI(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:zI(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:$I(e),onStart:$I(n),onMove:r,onEnd:(i,o)=>{delete this.session,s&&pt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=eo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Que(){const t=_.useContext(Py);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:r}=t,s=_.useId();return _.useEffect(()=>r(s),[]),!e&&n?[!1,()=>n&&n(s)]:[!0]}const Xy={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function GI(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const fp={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Le.test(t))t=parseFloat(t);else return t;const n=GI(t,e.target.x),r=GI(t,e.target.y);return`${n}% ${r}%`}},Jue={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=da.parse(t);if(s.length>5)return r;const i=da.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const u=Bt(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}};class Yue extends _.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Yoe(Xue),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),Xy.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||pt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),O2.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function WI(t){const[e,n]=Que(),r=_.useContext(_2);return S.jsx(Yue,{...t,layoutGroup:r,switchLayoutGroup:_.useContext(KP),isPresent:e,safeToRemove:n})}const Xue={borderRadius:{...fp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:fp,borderTopRightRadius:fp,borderBottomLeftRadius:fp,borderBottomRightRadius:fp,boxShadow:Jue},qI=["TopLeft","TopRight","BottomLeft","BottomRight"],Zue=qI.length,KI=t=>typeof t=="string"?parseFloat(t):t,QI=t=>typeof t=="number"||Le.test(t);function ece(t,e,n,r,s,i){s?(t.opacity=Bt(0,n.opacity!==void 0?n.opacity:1,tce(r)),t.opacityExit=Bt(e.opacity!==void 0?e.opacity:1,0,nce(r))):i&&(t.opacity=Bt(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;o<Zue;o++){const a=`border${qI[o]}Radius`;let l=JI(e,a),u=JI(n,a);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||QI(l)===QI(u)?(t[a]=Math.max(Bt(KI(l),KI(u),r),0),(hi.test(u)||hi.test(l))&&(t[a]+="%")):t[a]=u}(e.rotate||n.rotate)&&(t.rotate=Bt(e.rotate||0,n.rotate||0,r))}function JI(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const tce=YI(0,.5,sI),nce=YI(.5,.95,Sn);function YI(t,e,n){return r=>r<t?0:r>e?1:n(op(t,e,r))}function XI(t,e){t.min=e.min,t.max=e.max}function ts(t,e){XI(t.x,e.x),XI(t.y,e.y)}function ZI(t,e,n,r,s){return t-=e,t=Jy(t,1/n,r),s!==void 0&&(t=Jy(t,1/s,r)),t}function rce(t,e=0,n=1,r=.5,s,i=t,o=t){if(hi.test(e)&&(e=parseFloat(e),e=Bt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Bt(i.min,i.max,r);t===i&&(a-=e),t.min=ZI(t.min,e,n,a,s),t.max=ZI(t.max,e,n,a,s)}function eL(t,e,[n,r,s],i,o){rce(t,e[n],e[r],e[s],e.scale,i,o)}const sce=["x","scaleX","originX"],ice=["y","scaleY","originY"];function tL(t,e,n,r){eL(t.x,e,sce,n?n.x:void 0,r?r.x:void 0),eL(t.y,e,ice,n?n.y:void 0,r?r.y:void 0)}function nL(t){return t.translate===0&&t.scale===1}function rL(t){return nL(t.x)&&nL(t.y)}function oce(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function sL(t,e){return Math.round(t.x.min)===Math.round(e.x.min)&&Math.round(t.x.max)===Math.round(e.x.max)&&Math.round(t.y.min)===Math.round(e.y.min)&&Math.round(t.y.max)===Math.round(e.y.max)}function iL(t){return Pr(t.x)/Pr(t.y)}class ace{constructor(){this.members=[]}add(e){hk(this.members,e),e.scheduleRender()}remove(e){if(pk(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 r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function oL(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:c,rotateX:f,rotateY:d,skewX:h,skewY:p}=n;u&&(r=`perspective(${u}px) ${r}`),c&&(r+=`rotate(${c}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const lce=(t,e)=>t.depth-e.depth;class uce{constructor(){this.children=[],this.isDirty=!1}add(e){hk(this.children,e),this.isDirty=!0}remove(e){pk(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(lce),this.isDirty=!1,this.children.forEach(e)}}function cce(t,e){const n=fa.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(Xi(r),t(i-e))};return pt.read(r,!0),()=>Xi(r)}function fce(t){window.MotionDebug&&window.MotionDebug.record(t)}function dce(t){return t instanceof SVGElement&&t.tagName!=="svg"}function hce(t,e,n){const r=Pn(t)?t:lp(t);return r.start(dk("",r,e,n)),r.animation}const Ck=["","X","Y","Z"],pce={visibility:"hidden"},aL=1e3;let mce=0;const Vl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Sk(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function lL(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return!1;const{visualElement:e}=t.options;return e?wI(e)?!0:t.parent&&!t.parent.hasCheckedOptimisedAppear?lL(t.parent):!1:!1}function uL({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=mce++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Vl.totalNodes=Vl.resolvedTargetDeltas=Vl.recalculatedProjection=0,this.nodes.forEach(bce),this.nodes.forEach(kce),this.nodes.forEach(Ece),this.nodes.forEach(wce),fce(Vl)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new uce)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new mk),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,a=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=dce(o),this.instance=o;const{layoutId:l,layout:u,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(u||l)&&(this.isLayoutDirty=!0),t){let f;const d=()=>this.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=cce(d,250),Xy.hasAnimatedSinceResize&&(Xy.hasAnimatedSinceResize=!1,this.nodes.forEach(fL))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||Oce,{onLayoutAnimationStart:g,onLayoutAnimationComplete:b}=c.getProps(),v=!this.targetLayout||!sL(this.targetLayout,p)||h,A=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,A);const w={...q2(m,"layout"),onPlay:g,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else d||fL(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Xi(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(Cce),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.HandoffCancelAllAnimations&&lL(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;c<this.path.length;c++){const f=this.path[c];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(cL);return}this.isUpdating||this.nodes.forEach(vce),this.isUpdating=!1,this.nodes.forEach(xce),this.nodes.forEach(gce),this.nodes.forEach(yce),this.clearAllSnapshots();const a=fa.now();Tn.delta=la(0,1e3/60,a-Tn.timestamp),Tn.timestamp=a,Tn.isProcessing=!0,z2.update.process(Tn),z2.preRender.process(Tn),z2.render.process(Tn),Tn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,O2.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ace),this.sharedNodes.forEach(Sce)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,pt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){pt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Kt(),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);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&(this.scroll={animationId:this.root.animationId,phase:o,isRoot:r(this.instance),offset:n(this.instance)})}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!rL(this.projectionDelta),l=this.getTransformTemplate(),u=l?l(this.latestValues,""):void 0,c=u!==this.prevTransformTemplateValue;o&&(a||Hl(this.latestValues)||c)&&(s(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),Mce(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return Kt();const a=o.measureViewportBox(),{scroll:l}=this.root;return l&&(ha(a.x,l.offset.x),ha(a.y,l.offset.y)),a}removeElementScroll(o){const a=Kt();ts(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l],{scroll:c,options:f}=u;if(u!==this.root&&c&&f.layoutScroll){if(c.isRoot){ts(a,o);const{scroll:d}=this.root;d&&(ha(a.x,-d.offset.x),ha(a.y,-d.offset.y))}ha(a.x,c.offset.x),ha(a.y,c.offset.y)}}return a}applyTransform(o,a=!1){const l=Kt();ts(l,o);for(let u=0;u<this.path.length;u++){const c=this.path[u];!a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&Xc(l,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),Hl(c.latestValues)&&Xc(l,c.latestValues)}return Hl(this.latestValues)&&Xc(l,this.latestValues),l}removeTransform(o){const a=Kt();ts(a,o);for(let l=0;l<this.path.length;l++){const u=this.path[l];if(!u.instance||!Hl(u.latestValues))continue;kk(u.latestValues)&&u.updateSnapshot();const c=Kt(),f=u.measurePageBox();ts(c,f),tL(a,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,c)}return Hl(this.latestValues)&&tL(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!==Tn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==l;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:f,layoutId:d}=this.options;if(!(!this.layout||!(f||d))){if(this.resolvedRelativeTargetAt=Tn.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),cp(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Kt(),this.targetWithTransforms=Kt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Nue(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ts(this.target,this.layout.layoutBox),jI(this.target,this.targetDelta)):ts(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),cp(this.relativeTargetOrigin,this.target,h.target),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Vl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||kk(this.parent.latestValues)||LI(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let u=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(u=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Tn.timestamp&&(u=!1),u)return;const{layout:c,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||f))return;ts(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;Uue(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Kt());const{target:p}=a;if(!p){this.projectionTransform&&(this.projectionDelta=Yc(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=Yc(),this.projectionDeltaWithTransform=Yc());const m=this.projectionTransform;up(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=oL(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Vl.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(o,a=!1){const l=this.snapshot,u=l?l.latestValues:{},c={...this.latestValues},f=Yc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=Kt(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,m=h!==p,g=this.getStack(),b=!g||g.members.length<=1,v=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(Dce));this.animationProgress=0;let A;this.mixTargetDelta=w=>{const x=w/1e3;dL(f.x,o.x,x),dL(f.y,o.y,x),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(cp(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Tce(this.relativeTarget,this.relativeTargetOrigin,d,x),A&&oce(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Kt()),ts(A,this.relativeTarget)),m&&(this.animationValues=c,ece(c,u,this.latestValues,x,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=x},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Xi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=pt.update(()=>{Xy.hasAnimatedSinceResize=!0,this.currentAnimation=hce(0,aL,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(aL),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&yL(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Kt();const f=Pr(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=Pr(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}ts(a,l),Xc(a,c),up(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new ace),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Sk("z",o,u,this.animationValues);for(let c=0;c<Ck.length;c++)Sk(`rotate${Ck[c]}`,o,u,this.animationValues),Sk(`skew${Ck[c]}`,o,u,this.animationValues);o.render();for(const c in u)o.setStaticValue(c,u[c]),this.animationValues&&(this.animationValues[c]=u[c]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return pce;const u={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Hy(o==null?void 0:o.pointerEvents)||"",u.transform=c?c(this.latestValues,""):"none",u;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=Hy(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Hl(this.latestValues)&&(m.transform=c?c({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),u.transform=oL(this.projectionDeltaWithTransform,this.treeScale,d),c&&(u.transform=c(d,u.transform));const{x:h,y:p}=this.projectionDelta;u.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?u.opacity=f===this?(l=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:u.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in Fy){if(d[m]===void 0)continue;const{correct:g,applyTo:b}=Fy[m],v=u.transform==="none"?d[m]:g(d[m],f);if(b){const A=b.length;for(let w=0;w<A;w++)u[b[w]]=v}else u[m]=v}return this.options.layoutId&&(u.pointerEvents=f===this?Hy(o==null?void 0:o.pointerEvents)||"":"none"),u}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(cL),this.root.sharedNodes.clear()}}}function gce(t){t.updateLayout()}function yce(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;i==="size"?es(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=Pr(d);d.min=r[f].min,d.max=d.min+h}):yL(i,n.layoutBox,r)&&es(f=>{const d=o?n.measuredBox[f]:n.layoutBox[f],h=Pr(r[f]);d.max=d.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+h)});const a=Yc();up(a,r,n.layoutBox);const l=Yc();o?up(l,t.applyTransform(s,!0),n.measuredBox):up(l,r,n.layoutBox);const u=!rL(a);let c=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=Kt();cp(p,n.layoutBox,d.layoutBox);const m=Kt();cp(m,r,h.layoutBox),sL(p,m)||(c=!0),f.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function bce(t){Vl.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function wce(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Ace(t){t.clearSnapshot()}function cL(t){t.clearMeasurements()}function vce(t){t.isLayoutDirty=!1}function xce(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fL(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function kce(t){t.resolveTargetDelta()}function Ece(t){t.calcProjection()}function Cce(t){t.resetSkewAndRotation()}function Sce(t){t.removeLeadSnapshot()}function dL(t,e,n){t.translate=Bt(e.translate,0,n),t.scale=Bt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function hL(t,e,n,r){t.min=Bt(e.min,n.min,r),t.max=Bt(e.max,n.max,r)}function Tce(t,e,n,r){hL(t.x,e.x,n.x,r),hL(t.y,e.y,n.y,r)}function Dce(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Oce={duration:.45,ease:[.4,0,.1,1]},pL=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),mL=pL("applewebkit/")&&!pL("chrome/")?Math.round:Sn;function gL(t){t.min=mL(t.min),t.max=mL(t.max)}function Mce(t){gL(t.x),gL(t.y)}function yL(t,e,n){return t==="position"||t==="preserve-aspect"&&!Ak(iL(e),iL(n),.2)}const Nce=uL({attachResizeListener:(t,e)=>Zi(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Tk={current:void 0},bL=uL({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Tk.current){const t=new Nce({});t.mount(window),t.setOptions({layoutScroll:!0}),Tk.current=t}return Tk.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),_ce={pan:{Feature:Kue},drag:{Feature:que,ProjectionNode:bL,MeasureLayout:WI}},Dk={current:null},wL={current:!1};function Rce(){if(wL.current=!0,!!S2)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Dk.current=t.matches;t.addListener(e),e()}else Dk.current=!1}function Pce(t,e,n){const{willChange:r}=e;for(const s in e){const i=e[s],o=n[s];if(Pn(i))t.addValue(s,i),Qy(r)&&r.add(s),process.env.NODE_ENV==="development"&&gk(i.version==="11.2.12",`Attempting to mix Framer Motion versions ${i.version} with 11.2.12 may not work as expected.`);else if(Pn(o))t.addValue(s,lp(i,{owner:t})),Qy(r)&&r.remove(s);else if(o!==i)if(t.hasValue(s)){const a=t.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=t.getStaticValue(s);t.addValue(s,lp(a!==void 0?a:i,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const AL=new WeakMap,Ice=[...R8,In,da],Lce=t=>Ice.find(_8(t)),vL=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Bce=N2.length;class Fce{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.resolveKeyframes=(d,h,p,m)=>new this.KeyframeResolver(d,h,p,m,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=J2,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>pt.render(this.render,!1,!0);const{latestValues:l,renderState:u}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=n.initial?{...l}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=By(n),this.isVariantNode=YP(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&Pn(h)&&(h.set(l[d],!1),Qy(c)&&c.add(d))}}mount(e){this.current=e,AL.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),wL.current||Rce(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Dk.current,process.env.NODE_ENV!=="production"&&gk(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){AL.delete(this.current),this.projection&&this.projection.unmount(),Xi(this.notifyUpdate),Xi(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){const r=Bl.has(e),s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&pt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{s(),i(),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 Wc){const n=Wc[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kt()}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 r=0;r<vL.length;r++){const s=vL[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=Pce(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}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const r=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(r.initial=this.props.initial),r}const n={};for(let r=0;r<Bce;r++){const s=N2[r],i=this.props[s];(Xh(i)||i===!1)&&(n[s]=i)}return n}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&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 r=this.values.get(e);return r===void 0&&n!==void 0&&(r=lp(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(T8(s)||S8(s))?s=parseFloat(s):!Lce(s)&&da.test(n)&&(s=z8(e,n)),this.setBaseTarget(e,Pn(s)?s.get():s)),Pn(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=H2(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Pn(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new mk),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class xL extends Fce{constructor(){super(...arguments),this.KeyframeResolver=$8}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:r}){delete n[e],delete r[e]}}function jce(t){return window.getComputedStyle(t)}class Uce extends xL{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,n){if(Bl.has(n)){const r=tk(n);return r&&r.default||0}else{const r=jce(e),s=(n8(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return VI(e,n)}build(e,n,r,s){L2(e,n,r,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return U2(e,n,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Pn(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,r,s){c8(e,n,r,s)}}class Hce extends xL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Bl.has(n)){const r=tk(n);return r&&r.default||0}return n=f8.has(n)?n:D2(n),e.getAttribute(n)}measureInstanceViewportBox(){return Kt()}scrapeMotionValuesFromProps(e,n,r){return h8(e,n,r)}build(e,n,r,s){F2(e,n,r,this.isSVGTag,s.transformTemplate)}renderInstance(e,n,r,s){d8(e,n,r,s)}mount(e){this.isSVGTag=j2(e.tagName),super.mount(e)}}const Vce=(t,e)=>R2(t)?new Hce(e,{enableHardwareAcceleration:!1}):new Uce(e,{allowProjection:t!==_.Fragment,enableHardwareAcceleration:!0}),zce={...Tue,...jae,..._ce,...{layout:{ProjectionNode:bL,MeasureLayout:WI}}},$ce=Qoe((t,e)=>Sae(t,e,zce,Vce));function kL(){const t=_.useRef(!1);return T2(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function Gce(){const t=kL(),[e,n]=_.useState(0),r=_.useCallback(()=>{t.current&&n(e+1)},[e]);return[_.useCallback(()=>pt.postRender(r),[r]),e]}class Wce extends V.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function qce({children:t,isPresent:e}){const n=_.useId(),r=_.useRef(null),s=_.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=_.useContext(C2);return _.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:u}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const c=document.createElement("style");return i&&(c.nonce=i),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`
|
|
486
486
|
[data-motion-pop-id="${n}"] {
|