@fileverse-dev/ddoc 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.es.js +4 -2
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
@@ -449,7 +449,7 @@ Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,i("_proc
|
|
449
449
|
`,JW="️",qW="";let Rg=null,Pg=null;function YW(n){n===void 0&&(n=[]);const e={};ir.groups=e;const t=new ir;Rg==null&&(Rg=$M(zW)),Pg==null&&(Pg=$M($W)),de(t,"'",yg),de(t,"{",zd),de(t,"}",$d),de(t,"[",ng),de(t,"]",rg),de(t,"(",sg),de(t,")",ig),de(t,"<",og),de(t,">",ag),de(t,"(",lg),de(t,")",cg),de(t,"「",ug),de(t,"」",fg),de(t,"『",dg),de(t,"』",hg),de(t,"<",pg),de(t,">",mg),de(t,"&",gg),de(t,"*",bg),de(t,"@",Ro),de(t,"`",Ag),de(t,"^",vg),de(t,":",Po),de(t,",",yv),de(t,"$",xg),de(t,".",Gs),de(t,"=",Eg),de(t,"!",bv),de(t,"-",Ws),de(t,"%",Cg),de(t,"|",kg),de(t,"+",Sg),de(t,"#",Tg),de(t,"?",Og),de(t,'"',wv),de(t,"/",Ks),de(t,";",Av),de(t,"~",Gd),de(t,"_",Ng),de(t,"\\",wg);const r=zr(t,Ev,mv,{[lv]:!0});zr(r,Ev,r);const s=zr(t,Wc,Si,{[cv]:!0});zr(s,Wc,s);const i=zr(t,vv,dv,{[uv]:!0});zr(i,Wc),zr(i,vv,i);const o=zr(t,HM,jM,{[_M]:!0});de(t,zM,gv,{[_M]:!0}),de(o,zM),zr(o,HM,o);const a=zr(t,xv,UM,{[BM]:!0});zr(a,xv,a),de(a,JW,a);const l=de(a,qW);zr(l,xv,a);const c=[[Wc,s]],u=[[Wc,null],[vv,i]];for(let f=0;f<Rg.length;f++)Do(t,Rg[f],hv,Si,c);for(let f=0;f<Pg.length;f++)Do(t,Pg[f],pv,dv,u);nl(hv,{tld:!0,ascii:!0},e),nl(pv,{utld:!0,alpha:!0},e),Do(t,"file",tg,Si,c),Do(t,"mailto",tg,Si,c),Do(t,"http",Gc,Si,c),Do(t,"https",Gc,Si,c),Do(t,"ftp",Gc,Si,c),Do(t,"ftps",Gc,Si,c),nl(tg,{scheme:!0,ascii:!0},e),nl(Gc,{slashscheme:!0,ascii:!0},e),n=n.sort((f,d)=>f[0]>d[0]?1:-1);for(let f=0;f<n.length;f++){const d=n[f][0],p=n[f][1]?{[GW]:!0}:{[WW]:!0};d.indexOf("-")>=0?p[fv]=!0:Wc.test(d)?Ev.test(d)?p[Zm]=!0:p[cv]=!0:p[lv]=!0,FM(t,d,d,p)}return FM(t,"localhost",Hd,{ascii:!0}),t.jd=new ir(Mg),{start:t,tokens:$c({groups:e},VM)}}function XW(n,e){const t=ZW(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o<r;){let a=n,l=null,c=0,u=null,f=-1,d=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(f=0,d=0,u=a):f>=0&&(f+=t[o].length,d++),c+=t[o].length,i+=t[o].length,o++;i-=f,o-=d,c-=f,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function ZW(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,o=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function Do(n,e,t,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?i=n.j[l]:(i=new ir(r),i.jr=s.slice(),n.j[l]=i),n=i}return i=new ir(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function $M(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const Wd={defaultProtocol:"http",events:null,format:GM,formatHref:GM,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Cv(n,e){e===void 0&&(e=null);let t=$c({},Wd);n&&(t=$c(t,n instanceof Cv?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}Cv.prototype={o:Wd,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:Wd[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function GM(n){return n}function WM(n,e){this.t="token",this.v=n,this.tk=e}WM.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=Wd.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&$c(o,u),{tagName:s,attributes:o,content:i,eventListeners:f}}};function Dg(n,e){class t extends WM{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const KM=Dg("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),QM=Dg("text"),eK=Dg("nl"),Ig=Dg("url",{isLink:!0,toHref(n){return n===void 0&&(n=Wd.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Hd&&n[1].t===Po}}),$r=n=>new ir(n);function tK(n){let{groups:e}=n;const t=e.domain.concat([gg,bg,Ro,wg,Ag,vg,xg,Eg,Ws,mv,Cg,kg,Sg,Tg,Ks,Mg,Gd,Ng]),r=[yg,Po,yv,Gs,bv,Og,wv,Av,og,ag,zd,$d,rg,ng,sg,ig,lg,cg,ug,fg,dg,hg,pg,mg],s=[gg,yg,bg,wg,Ag,vg,xg,Eg,Ws,zd,$d,Cg,kg,Sg,Tg,Og,Ks,Mg,Gd,Ng],i=$r(),o=de(i,Gd);Xe(o,s,o),Xe(o,e.domain,o);const a=$r(),l=$r(),c=$r();Xe(i,e.domain,a),Xe(i,e.scheme,l),Xe(i,e.slashscheme,c),Xe(a,s,o),Xe(a,e.domain,a);const u=de(a,Ro);de(o,Ro,u),de(l,Ro,u),de(c,Ro,u);const f=de(o,Gs);Xe(f,s,o),Xe(f,e.domain,o);const d=$r();Xe(u,e.domain,d),Xe(d,e.domain,d);const h=de(d,Gs);Xe(h,e.domain,d);const p=$r(KM);Xe(h,e.tld,p),Xe(h,e.utld,p),de(u,Hd,p);const m=de(d,Ws);Xe(m,e.domain,d),Xe(p,e.domain,d),de(p,Gs,h),de(p,Ws,m);const y=de(p,Po);Xe(y,e.numeric,KM);const b=de(a,Ws),v=de(a,Gs);Xe(b,e.domain,a),Xe(v,s,o),Xe(v,e.domain,a);const A=$r(Ig);Xe(v,e.tld,A),Xe(v,e.utld,A),Xe(A,e.domain,a),Xe(A,s,o),de(A,Gs,v),de(A,Ws,b),de(A,Ro,u);const w=de(A,Po),x=$r(Ig);Xe(w,e.numeric,x);const C=$r(Ig),S=$r();Xe(C,t,C),Xe(C,r,S),Xe(S,t,C),Xe(S,r,S),de(A,Ks,C),de(x,Ks,C);const M=de(l,Po),R=de(c,Po),O=de(R,Ks),D=de(O,Ks);Xe(l,e.domain,a),de(l,Gs,v),de(l,Ws,b),Xe(c,e.domain,a),de(c,Gs,v),de(c,Ws,b),Xe(M,e.domain,C),de(M,Ks,C),Xe(D,e.domain,C),Xe(D,t,C),de(D,Ks,C);const _=[[zd,$d],[ng,rg],[sg,ig],[og,ag],[lg,cg],[ug,fg],[dg,hg],[pg,mg]];for(let F=0;F<_.length;F++){const[G,B]=_[F],V=de(C,G);de(S,G,V),de(V,B,C);const Q=$r(Ig);Xe(V,t,Q);const ee=$r();Xe(V,r),Xe(Q,t,Q),Xe(Q,r,ee),Xe(ee,t,Q),Xe(ee,r,ee),de(Q,B,C),de(ee,B,C)}return de(i,Hd,A),de(i,gv,eK),{start:i,tokens:VM}}function nK(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s<r;){let a=n,l=null,c=null,u=0,f=null,d=-1;for(;s<r&&!(l=a.go(t[s].t));)o.push(t[s++]);for(;s<r&&(c=l||a.go(t[s].t));)l=null,a=c,a.accepts()?(d=0,f=a):d>=0&&d++,s++,u++;if(d<0)s-=u,s<r&&(o.push(t[s]),s++);else{o.length>0&&(i.push(kv(QM,e,o)),o=[]),s-=d,u-=d;const h=f.t,p=t.slice(s-u,s);i.push(kv(h,e,p))}}return o.length>0&&i.push(kv(QM,e,o)),i}function kv(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const rK=typeof console<"u"&&console&&console.warn||(()=>{}),sK="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",It={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function iK(){ir.groups={},It.scanner=null,It.parser=null,It.tokenQueue=[],It.pluginQueue=[],It.customSchemes=[],It.initialized=!1}function JM(n,e){if(e===void 0&&(e=!1),It.initialized&&rK(`linkifyjs: already initialized - will not register custom scheme "${n}" ${sK}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
450
450
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
451
451
|
2. Cannot start or end with "-"
|
452
|
-
3. "-" cannot repeat`);It.customSchemes.push([n,e])}function oK(){It.scanner=YW(It.customSchemes);for(let n=0;n<It.tokenQueue.length;n++)It.tokenQueue[n][1]({scanner:It.scanner});It.parser=tK(It.scanner.tokens);for(let n=0;n<It.pluginQueue.length;n++)It.pluginQueue[n][1]({scanner:It.scanner,parser:It.parser});It.initialized=!0}function qM(n){return It.initialized||oK(),nK(It.parser.start,n,XW(It.scanner.start,n))}function YM(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Cv(t),s=qM(n),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}function aK(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function lK(n){return new At({key:new Rt("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=NU(t.doc,[...e]);if(_U(a).forEach(({newRange:c})=>{const u=RU(r.doc,c,h=>h.isTextblock);let f,d;if(u.length>1?(f=u[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(f=u[0],d=r.doc.textBetween(f.pos,c.to,void 0," ")),f&&d){const h=d.split(" ").filter(b=>b!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;const y=qM(p).map(b=>b.toObject());if(!aK(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate?n.validate(b.value):!0).forEach(b=>{Nb(b.from,b.to,r.doc).some(v=>v.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function cK(n){return new At({key:new Rt("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(n.whenNotEditable&&e.editable||r.button!==0)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(d=>d.nodeName==="A"))return!1;const l=uS(e.state,n.type.name),c=r.target,u=(s=c==null?void 0:c.href)!==null&&s!==void 0?s:l.href,f=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:l.target;return c&&u?(window.open(u,f),!0):!1}}})}function uK(n){return new At({key:new Rt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:s}=e,{selection:i}=s,{empty:o}=i;if(o)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=YM(a).find(c=>c.isLink&&c.value===a);return!a||!l?!1:(n.editor.commands.setMark(n.type,{href:l.href}),!0)}}})}const fK=Zn.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){JM(n);return}JM(n.scheme,n.optionalSlashes)})},onDestroy(){iK()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",nt(this.options.HTMLAttributes,{...n,href:""}),0]:["a",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vo({find:n=>{const e=[];if(n){const t=YM(n).filter(r=>r.isLink);t.length&&t.forEach(r=>e.push({text:r.value,data:{href:r.href},index:r.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(lK({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(cK({type:this.type,whenNotEditable:this.options.openOnClick==="whenNotEditable"})),this.options.linkOnPaste&&n.push(uK({editor:this.editor,type:this.type})),n}}),dK=Ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new At({key:new Rt("placeholder"),props:{decorations:({doc:n,selection:e})=>{var t;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=e,i=[];if(!r)return null;const{firstChild:o}=n.content,a=o&&o.type.isLeaf,l=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((t=n.type.contentMatch.defaultType)===null||t===void 0?void 0:t.name),u=n.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!a||!l);return n.descendants((f,d)=>{const h=s>=d&&s<=d+f.nodeSize,p=!f.isLeaf&&!f.childCount;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];u&&m.push(this.options.emptyEditorClass);const y=en.node(d,d+f.nodeSize,{class:m.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:d,hasAnchor:h}):this.options.placeholder});i.push(y)}return this.options.includeChildren}),vt.create(n,i)}}})]}}),hK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,pK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,mK=Zn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Pa({find:hK,type:this.type})]},addPasteRules(){return[vo({find:pK,type:this.type})]}}),gK=xt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",nt(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),yK=/^\s*(\[([( |x])?\])\s$/,bK=xt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",nt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const d=t(),h=f.doc.nodeAt(d);return f.setNodeMarkup(d,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{s.setAttribute(c,u)}),s.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,o),s.append(i,l),Object.entries(e).forEach(([c,u])=>{s.setAttribute(c,u)}),{dom:s,contentDOM:l,update:c=>c.type!==this.type?!1:(s.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[yc({find:yK,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),wK=Zn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),AK=PM.extend({renderHTML(){return["div",nt(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),vK=Ot.create({name:"columnExtension",addExtensions(){const n=[];return this.options.column!==!1&&n.push(eN),this.options.columns!==!1&&n.push(mm),n}}),xK=Ot.create({name:"CustomKeymap",addCommands(){return{selectTextWithinNodeBoundaries:()=>({editor:n,commands:e})=>{const{state:t}=n,{tr:r}=t,s=r.selection.$from.start(),i=r.selection.$to.end();return e.setTextSelection({from:s,to:i})}}},addKeyboardShortcuts(){return{"Mod-a":({editor:n})=>{const{state:e}=n,{tr:t}=e,r=t.selection.from,s=t.selection.to,i=t.selection.$from.start(),o=t.selection.$to.end();return r>i||s<o?(n.chain().selectTextWithinNodeBoundaries().run(),!0):!1}}}}),EK=Ot.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),XM=[{tooltip:"Align left",action:n=>n({dataAlign:"start",dataFloat:null}),icon:"AlignLeft",isActive:n=>n.dataAlign==="start"},{tooltip:"Align center",action:n=>n({dataAlign:"center",dataFloat:null}),icon:"AlignCenter",isActive:n=>n.dataAlign==="center"},{tooltip:"Align right",action:n=>n({dataAlign:"end",dataFloat:null}),icon:"AlignRight",isActive:n=>n.dataAlign==="end"},{tooltip:"Delete",icon:"Trash2",delete:n=>n()}];let Kc;const ZM=({node:n,updateAttributes:e,deleteNode:t})=>{const r=gm(),[s,i]=P.useState(),[o,a]=P.useState(0),[l,c]=P.useState(0),[u,f]=P.useState({}),d=P.useRef(null),[h,p]=P.useState(!1),m=()=>{const F={};XM.forEach(({tooltip:G,isActive:B})=>{F[G]=!!(B!=null&&B(n.attrs))}),f(F)},y=()=>{const F=document.querySelector(".ProseMirror");if(F&&c(F==null?void 0:F.clientWidth),!!d.current){if(s==="video"){const G=d.current;G.addEventListener("loadeddata",function(){a(G.videoWidth/G.videoHeight),C("left",0)})}else if(s==="iframe"){const G=d.current;G.onload=()=>{a(G.offsetWidth/G.offsetHeight),C("left",0)}}else d.current.onload=()=>{a(d.current.naturalWidth/d.current.naturalHeight)};setTimeout(()=>m(),200)}},b=F=>{Kc=F};P.useEffect(()=>{y()},[]);const v=({width:F,height:G})=>F<200||G<200,A=F=>{setTimeout(()=>S(F))},w=F=>{Kc=F.clientX,setTimeout(()=>{document.addEventListener("mousemove",A),document.addEventListener("mouseup",x)}),p(!0)},x=()=>{Kc=-1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",x),p(!1)},C=(F,G)=>{var Q,ee;if(!d.current){console.error("Media ref is undefined|null",{resizableImg:d.current});return}const B={width:(Q=d.current)==null?void 0:Q.width,height:(ee=d.current)==null?void 0:ee.height},V={width:-1,height:-1};F==="left"?V.width=B.width-Math.abs(G):(typeof B.width=="string"&&(B.width=Number(B.width)),V.width=B.width+Math.abs(G)),V.width>l&&(V.width=l),s==="iframe"?V.height=V.width/(16/9):V.height=V.width/o,!v(V)&&e(V)},S=F=>{if(Kc===-1)return;const{clientX:G}=F,B=Kc-G;if(B===0)return;const V=B>0?"left":"right";setTimeout(()=>{C(V,Math.abs(B)),Kc=G})},[M,R]=P.useState(),[O,D]=P.useState();P.useEffect(()=>{i(n.attrs["media-type"]),m(),R(n.attrs.dataFloat),D(n.attrs.dataAlign)},[n.attrs]);const _=F=>{switch(F){case"AlignLeft":return k.jsx(ad,{size:16});case"AlignCenter":return k.jsx(Xb,{size:16});case"AlignRight":return k.jsx(Zb,{size:16});case"Trash2":return k.jsx(aw,{size:16});default:return null}};return k.jsx(od,{as:"article",className:pe("media-node-view not-prose transition-all ease-in-out w-full",M&&`f-${n.attrs.dataFloat}`,O&&`justify-${n.attrs.dataAlign}`),children:k.jsxs("div",{className:"w-fit flex relative group transition-all ease-in-out",children:[s==="img"&&k.jsx("img",{src:n.attrs.src,ref:d,className:"rounded-lg",alt:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),s==="video"&&k.jsx("video",{ref:d,className:"rounded-lg",controls:!0,width:n.attrs.width,height:n.attrs.height,children:k.jsx("source",{src:n.attrs.src})}),s==="iframe"&&k.jsx("iframe",{ref:d,className:pe("rounded-lg max-w-full",h&&"pointer-events-none"),src:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),!r&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"horizontal-resize-handle group-hover:bg-black group-hover:border-2 group-hover:border-white/80",title:"Resize",onClick:({clientX:F})=>b(F),onMouseDown:w,onMouseUp:x}),k.jsx("section",{className:"media-control-buttons opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex",children:XM.map((F,G)=>k.jsx("div",{className:"tooltip","data-tip":F.tooltip,children:k.jsx("button",{type:"button",className:pe("btn rounded-none h-8 px-2 py-1 transition",u[F.tooltip]&&"active"),onClick:()=>{var B;return F.tooltip==="Delete"?t():(B=F.action)==null?void 0:B.call(F,e)},children:F.icon&&_(F.icon)})},G))})]})]})})},CK=xt.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},"media-type":{default:"iframe"},alt:{default:null},title:{default:null},width:{default:this.options.width},height:{default:this.options.height},dataAlign:{default:"left"},dataFloat:{default:null}}},addNodeView(){return _a(ZM)},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",nt(this.options.HTMLAttributes,n)]},addCommands(){return{setIframe:n=>({tr:e,dispatch:t})=>{const{selection:r}=e,s=this.type.create(n);return t&&e.replaceRangeWith(r.from-1,r.to,s),!0}}}});var kK="https://platform.twitter.com/widgets.js",Sv="createTweet",SK=function(e){var t=P.useRef(null),r=P.useState(!0),s=r[0],i=r[1];return P.useEffect(function(){var o=!0,a=require("scriptjs");return a(kK,"twitter-embed",function(){if(!window.twttr){console.error("Failure to load window.twttr, aborting load");return}if(o){if(!window.twttr.widgets[Sv]){console.error("Method "+Sv+" is not present anymore in twttr.widget api");return}window.twttr.widgets[Sv](e.tweetId,t==null?void 0:t.current,e.options).then(function(l){i(!1),e.onLoad&&e.onLoad(l)})}}),function(){o=!1}},[]),P.createElement(P.Fragment,null,s&&P.createElement(P.Fragment,null,e.placeholder),P.createElement("div",{ref:t}))};const TK=({node:n,editor:e})=>{const[t,r]=P.useState(!0);return P.useEffect(()=>{e==null||e.chain().focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:k.jsxs("div",{className:"w-full max-w-sm",children:[t&&k.jsx(fN,{width:5,height:5}),k.jsx(SK,{tweetId:n.attrs.tweetId,onLoad:()=>r(!1)})]})})},OK=xt.create({name:"embeddedTweet",group:"block",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:""}}},addAttributes(){return{tweetId:{default:null},align:{default:"center"}}},parseHTML(){return[{tag:"div[data-tweet-id]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(this.options.HTMLAttributes,n)]},addNodeView(){return _a(TK)},addCommands(){return{setTweetEmbed:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{tweetId:n.tweetId,align:"center"},content:[]})}}}),NK=n=>new At({key:new Rt("media-paste-drop"),props:{handlePaste(e,t){var s;return Array.from(((s=t.clipboardData)==null?void 0:s.items)||[]).forEach(i=>{const o=i.getAsFile();if(((o==null?void 0:o.type.indexOf("image"))===0||(o==null?void 0:o.type.indexOf("video"))===0)&&(t.preventDefault(),o&&o.size>1024*1024))throw new Error("Image too large")}),!1},handleDrop(e,t){var a;if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const s=Array.from(((a=t.dataTransfer)==null?void 0:a.files)??[]).filter(({type:l})=>/image|video/i.test(l));if(s.length===0)return!1;t.preventDefault();const{schema:i}=e.state,o=e.posAtCoords({left:t.clientX,top:t.clientY});return o?(s.forEach(async l=>{const c=new FileReader;if(n){const u=i.nodes.resizableMedia.create({src:await n(l),"media-type":l.type.includes("image")?"img":"video"}),f=e.state.tr.insert(o.pos,u);e.dispatch(f)}else c.onload=u=>{var h;const f=i.nodes.resizableMedia.create({src:(h=u.target)==null?void 0:h.result,"media-type":l.type.includes("image")?"img":"video"}),d=e.state.tr.insert(o.pos,f);e.dispatch(d)},c.readAsDataURL(l)}),!0):!1}}}),MK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,RK=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,PK=xt.create({name:"resizableMedia",addOptions(){return{HTMLAttributes:{class:"rounded-lg border border-stone-200"},uploadFn:async()=>""}},inline:!1,group:"block",draggable:!0,addAttributes(){return{src:{default:null},"media-type":{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},dataAlign:{default:"left"},dataFloat:{default:null}}},selectable:!0,parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:n=>({src:n.getAttribute("src"),"media-type":"img"})},{tag:"video",getAttrs:n=>({src:n.getAttribute("src"),"media-type":"video"})}]},renderHTML({HTMLAttributes:n}){const{"media-type":e}=n;return e==="img"?["img",nt(this.options.HTMLAttributes,n)]:e==="video"?["video",{controls:"true",style:"width: 100%",...n},["source",n]]:(e||console.error("TiptapMediaExtension-renderHTML method: Media Type not set, going default with image"),["img",nt(this.options.HTMLAttributes,n)])},addCommands(){return{setMedia:n=>({commands:e})=>{const{"media-type":t}=n;return t==="img"?e.insertContent({type:this.name,attrs:n}):t==="video"?e.insertContent({type:this.name,attrs:{...n,controls:"true"}}):(t||console.error("TiptapMediaExtension-setMedia: Media Type not set, going default with image"),e.insertContent({type:this.name,attrs:n}))}}},addNodeView(){return _a(ZM)},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{selection:e}=n.state;if(e.empty)return!1;const t=e.$to.pos;return n.commands.insertContentAt(t,{type:"dBlock",content:[{type:"paragraph"}]})}}},addInputRules(){return[Db({find:MK,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r,"media-type":"img"}}}),Db({find:RK,type:this.type,getAttributes:n=>{const[,,e]=n;return{src:e,"media-type":"video"}}})]},addProseMirrorPlugins(){return[NK(this.options.uploadFn),k8()]}});function Tv(n,e){let t;return(...s)=>{clearTimeout(t),t=setTimeout(()=>n(...s),e)}}const DK=["top","right","bottom","left"],Qs=Math.min,kr=Math.max,Lg=Math.round,Bg=Math.floor,Io=n=>({x:n,y:n}),IK={left:"right",right:"left",bottom:"top",top:"bottom"},LK={start:"end",end:"start"};function Ov(n,e,t){return kr(n,Qs(e,t))}function Ti(n,e){return typeof n=="function"?n(e):n}function Oi(n){return n.split("-")[0]}function Qc(n){return n.split("-")[1]}function Nv(n){return n==="x"?"y":"x"}function Mv(n){return n==="y"?"height":"width"}function Jc(n){return["top","bottom"].includes(Oi(n))?"y":"x"}function Rv(n){return Nv(Jc(n))}function BK(n,e,t){t===void 0&&(t=!1);const r=Qc(n),s=Rv(n),i=Mv(s);let o=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=_g(o)),[o,_g(o)]}function _K(n){const e=_g(n);return[Pv(n),e,Pv(e)]}function Pv(n){return n.replace(/start|end/g,e=>LK[e])}function FK(n,e,t){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?s:r:e?r:s;case"left":case"right":return e?i:o;default:return[]}}function jK(n,e,t,r){const s=Qc(n);let i=FK(Oi(n),t==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Pv)))),i}function _g(n){return n.replace(/left|right|bottom|top/g,e=>IK[e])}function UK(n){return{top:0,right:0,bottom:0,left:0,...n}}function eR(n){return typeof n!="number"?UK(n):{top:n,right:n,bottom:n,left:n}}function Fg(n){const{x:e,y:t,width:r,height:s}=n;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function tR(n,e,t){let{reference:r,floating:s}=n;const i=Jc(e),o=Rv(e),a=Mv(o),l=Oi(e),c=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,d=r[a]/2-s[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Qc(e)){case"start":h[o]-=d*(t&&c?-1:1);break;case"end":h[o]+=d*(t&&c?-1:1);break}return h}const VK=async(n,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=t,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:s}),{x:u,y:f}=tR(c,r,l),d=r,h={},p=0;for(let m=0;m<a.length;m++){const{name:y,fn:b}=a[m],{x:v,y:A,data:w,reset:x}=await b({x:u,y:f,initialPlacement:r,placement:d,strategy:s,middlewareData:h,rects:c,platform:o,elements:{reference:n,floating:e}});u=v??u,f=A??f,h={...h,[y]:{...h[y],...w}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(d=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:s}):x.rects),{x:u,y:f}=tR(c,d,l)),m=-1)}return{x:u,y:f,placement:d,strategy:s,middlewareData:h}};async function Kd(n,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Ti(e,n),p=eR(h),y=a[d?f==="floating"?"reference":"floating":f],b=Fg(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(A))?await(i.getScale==null?void 0:i.getScale(A))||{x:1,y:1}:{x:1,y:1},x=Fg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:A,strategy:l}):v);return{top:(b.top-x.top+p.top)/w.y,bottom:(x.bottom-b.bottom+p.bottom)/w.y,left:(b.left-x.left+p.left)/w.x,right:(x.right-b.right+p.right)/w.x}}const HK=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Ti(n,e)||{};if(c==null)return{};const f=eR(u),d={x:t,y:r},h=Rv(s),p=Mv(h),m=await o.getDimensions(c),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",A=y?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-d[h]-i.floating[p],x=d[h]-i.reference[h],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=C?C[A]:0;(!S||!await(o.isElement==null?void 0:o.isElement(C)))&&(S=a.floating[A]||i.floating[p]);const M=w/2-x/2,R=S/2-m[p]/2-1,O=Qs(f[b],R),D=Qs(f[v],R),_=O,F=S-m[p]-D,G=S/2-m[p]/2+M,B=Ov(_,G,F),V=!l.arrow&&Qc(s)!=null&&G!==B&&i.reference[p]/2-(G<_?O:D)-m[p]/2<0,Q=V?G<_?G-_:G-F:0;return{[h]:d[h]+Q,data:{[h]:B,centerOffset:G-B-Q,...V&&{alignmentOffset:Q}},reset:V}}}),zK=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Ti(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=Oi(s),v=Oi(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=d||(v||!m?[_g(a)]:_K(a));!d&&p!=="none"&&w.push(...jK(a,m,p,A));const x=[a,...w],C=await Kd(e,y),S=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&S.push(C[b]),f){const _=BK(s,o,A);S.push(C[_[0]],C[_[1]])}if(M=[...M,{placement:s,overflows:S}],!S.every(_=>_<=0)){var R,O;const _=(((R=i.flip)==null?void 0:R.index)||0)+1,F=x[_];if(F)return{data:{index:_,overflows:M},reset:{placement:F}};let G=(O=M.filter(B=>B.overflows[0]<=0).sort((B,V)=>B.overflows[1]-V.overflows[1])[0])==null?void 0:O.placement;if(!G)switch(h){case"bestFit":{var D;const B=(D=M.map(V=>[V.placement,V.overflows.filter(Q=>Q>0).reduce((Q,ee)=>Q+ee,0)]).sort((V,Q)=>V[1]-Q[1])[0])==null?void 0:D[0];B&&(G=B);break}case"initialPlacement":G=a;break}if(s!==G)return{reset:{placement:G}}}return{}}}};function nR(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function rR(n){return DK.some(e=>n[e]>=0)}const $K=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...s}=Ti(n,e);switch(r){case"referenceHidden":{const i=await Kd(e,{...s,elementContext:"reference"}),o=nR(i,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:rR(o)}}}case"escaped":{const i=await Kd(e,{...s,altBoundary:!0}),o=nR(i,t.floating);return{data:{escapedOffsets:o,escaped:rR(o)}}}default:return{}}}}};async function GK(n,e){const{placement:t,platform:r,elements:s}=n,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Oi(t),a=Qc(t),l=Jc(t)==="y",c=["left","top"].includes(o)?-1:1,u=i&&l?-1:1,f=Ti(e,n);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:d*c}:{x:d*c,y:h*u}}const WK=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await GK(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},KK=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:b,y:v}=y;return{x:b,y:v}}},...l}=Ti(n,e),c={x:t,y:r},u=await Kd(e,l),f=Jc(Oi(s)),d=Nv(f);let h=c[d],p=c[f];if(i){const y=d==="y"?"top":"left",b=d==="y"?"bottom":"right",v=h+u[y],A=h-u[b];h=Ov(v,h,A)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",v=p+u[y],A=p-u[b];p=Ov(v,p,A)}const m=a.fn({...e,[d]:h,[f]:p});return{...m,data:{x:m.x-t,y:m.y-r}}}}},QK=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ti(n,e),u={x:t,y:r},f=Jc(s),d=Nv(f);let h=u[d],p=u[f];const m=Ti(a,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const A=d==="y"?"height":"width",w=i.reference[d]-i.floating[A]+y.mainAxis,x=i.reference[d]+i.reference[A]-y.mainAxis;h<w?h=w:h>x&&(h=x)}if(c){var b,v;const A=d==="y"?"width":"height",w=["top","left"].includes(Oi(s)),x=i.reference[f]-i.floating[A]+(w&&((b=o.offset)==null?void 0:b[f])||0)+(w?0:y.crossAxis),C=i.reference[f]+i.reference[A]+(w?0:((v=o.offset)==null?void 0:v[f])||0)-(w?y.crossAxis:0);p<x?p=x:p>C&&(p=C)}return{[d]:h,[f]:p}}}},JK=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:s,elements:i}=e,{apply:o=()=>{},...a}=Ti(n,e),l=await Kd(e,a),c=Oi(t),u=Qc(t),f=Jc(t)==="y",{width:d,height:h}=r.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");const y=h-l.top-l.bottom,b=d-l.left-l.right,v=Qs(h-l[p],y),A=Qs(d-l[m],b),w=!e.middlewareData.shift;let x=v,C=A;if(f?C=u||w?Qs(A,b):b:x=u||w?Qs(v,y):y,w&&!u){const M=kr(l.left,0),R=kr(l.right,0),O=kr(l.top,0),D=kr(l.bottom,0);f?C=d-2*(M!==0||R!==0?M+R:kr(l.left,l.right)):x=h-2*(O!==0||D!==0?O+D:kr(l.top,l.bottom))}await o({...e,availableWidth:C,availableHeight:x});const S=await s.getDimensions(i.floating);return d!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}};function qc(n){return sR(n)?(n.nodeName||"").toLowerCase():"#document"}function Sr(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Ni(n){var e;return(e=(sR(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function sR(n){return n instanceof Node||n instanceof Sr(n).Node}function Js(n){return n instanceof Element||n instanceof Sr(n).Element}function qs(n){return n instanceof HTMLElement||n instanceof Sr(n).HTMLElement}function iR(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Sr(n).ShadowRoot}function Qd(n){const{overflow:e,overflowX:t,overflowY:r,display:s}=ms(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(s)}function qK(n){return["table","td","th"].includes(qc(n))}function Dv(n){const e=Iv(),t=ms(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function YK(n){let e=Lo(n);for(;qs(e)&&!Yc(e);){if(Dv(e))return e;e=Lo(e)}return null}function Iv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Yc(n){return["html","body","#document"].includes(qc(n))}function ms(n){return Sr(n).getComputedStyle(n)}function jg(n){return Js(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function Lo(n){if(qc(n)==="html")return n;const e=n.assignedSlot||n.parentNode||iR(n)&&n.host||Ni(n);return iR(e)?e.host:e}function oR(n){const e=Lo(n);return Yc(e)?n.ownerDocument?n.ownerDocument.body:n.body:qs(e)&&Qd(e)?e:oR(e)}function Jd(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=oR(n),i=s===((r=n.ownerDocument)==null?void 0:r.body),o=Sr(s);return i?e.concat(o,o.visualViewport||[],Qd(s)?s:[],o.frameElement&&t?Jd(o.frameElement):[]):e.concat(s,Jd(s,[],t))}function aR(n){const e=ms(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=qs(n),i=s?n.offsetWidth:t,o=s?n.offsetHeight:r,a=Lg(t)!==i||Lg(r)!==o;return a&&(t=i,r=o),{width:t,height:r,$:a}}function Lv(n){return Js(n)?n:n.contextElement}function Xc(n){const e=Lv(n);if(!qs(e))return Io(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:i}=aR(e);let o=(i?Lg(t.width):t.width)/r,a=(i?Lg(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const XK=Io(0);function lR(n){const e=Sr(n);return!Iv()||!e.visualViewport?XK:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ZK(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Sr(n)?!1:e}function rl(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),i=Lv(n);let o=Io(1);e&&(r?Js(r)&&(o=Xc(r)):o=Xc(n));const a=ZK(i,t,r)?lR(i):Io(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const d=Sr(i),h=r&&Js(r)?Sr(r):r;let p=d,m=p.frameElement;for(;m&&r&&h!==p;){const y=Xc(m),b=m.getBoundingClientRect(),v=ms(m),A=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,w=b.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=A,c+=w,p=Sr(m),m=p.frameElement}}return Fg({width:u,height:f,x:l,y:c})}const e7=[":popover-open",":modal"];function Bv(n){return e7.some(e=>{try{return n.matches(e)}catch{return!1}})}function t7(n){let{elements:e,rect:t,offsetParent:r,strategy:s}=n;const i=s==="fixed",o=Ni(r),a=e?Bv(e.floating):!1;if(r===o||a&&i)return t;let l={scrollLeft:0,scrollTop:0},c=Io(1);const u=Io(0),f=qs(r);if((f||!f&&!i)&&((qc(r)!=="body"||Qd(o))&&(l=jg(r)),qs(r))){const d=rl(r);c=Xc(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x,y:t.y*c.y-l.scrollTop*c.y+u.y}}function n7(n){return Array.from(n.getClientRects())}function cR(n){return rl(Ni(n)).left+jg(n).scrollLeft}function r7(n){const e=Ni(n),t=jg(n),r=n.ownerDocument.body,s=kr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=kr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+cR(n);const a=-t.scrollTop;return ms(r).direction==="rtl"&&(o+=kr(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}function s7(n,e){const t=Sr(n),r=Ni(n),s=t.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const c=Iv();(!c||c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:i,height:o,x:a,y:l}}function i7(n,e){const t=rl(n,!0,e==="fixed"),r=t.top+n.clientTop,s=t.left+n.clientLeft,i=qs(n)?Xc(n):Io(1),o=n.clientWidth*i.x,a=n.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function uR(n,e,t){let r;if(e==="viewport")r=s7(n,t);else if(e==="document")r=r7(Ni(n));else if(Js(e))r=i7(e,t);else{const s=lR(n);r={...e,x:e.x-s.x,y:e.y-s.y}}return Fg(r)}function fR(n,e){const t=Lo(n);return t===e||!Js(t)||Yc(t)?!1:ms(t).position==="fixed"||fR(t,e)}function o7(n,e){const t=e.get(n);if(t)return t;let r=Jd(n,[],!1).filter(a=>Js(a)&&qc(a)!=="body"),s=null;const i=ms(n).position==="fixed";let o=i?Lo(n):n;for(;Js(o)&&!Yc(o);){const a=ms(o),l=Dv(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Qd(o)&&!l&&fR(n,o))?r=r.filter(u=>u!==o):s=a,o=Lo(o)}return e.set(n,r),r}function a7(n){let{element:e,boundary:t,rootBoundary:r,strategy:s}=n;const o=[...t==="clippingAncestors"?Bv(e)?[]:o7(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{const f=uR(e,u,s);return c.top=kr(f.top,c.top),c.right=Qs(f.right,c.right),c.bottom=Qs(f.bottom,c.bottom),c.left=kr(f.left,c.left),c},uR(e,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function l7(n){const{width:e,height:t}=aR(n);return{width:e,height:t}}function c7(n,e,t){const r=qs(e),s=Ni(e),i=t==="fixed",o=rl(n,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Io(0);if(r||!r&&!i)if((qc(e)!=="body"||Qd(s))&&(a=jg(e)),r){const f=rl(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&(l.x=cR(s));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function _v(n){return ms(n).position==="static"}function dR(n,e){return!qs(n)||ms(n).position==="fixed"?null:e?e(n):n.offsetParent}function hR(n,e){const t=Sr(n);if(Bv(n))return t;if(!qs(n)){let s=Lo(n);for(;s&&!Yc(s);){if(Js(s)&&!_v(s))return s;s=Lo(s)}return t}let r=dR(n,e);for(;r&&qK(r)&&_v(r);)r=dR(r,e);return r&&Yc(r)&&_v(r)&&!Dv(r)?t:r||YK(n)||t}const u7=async function(n){const e=this.getOffsetParent||hR,t=this.getDimensions,r=await t(n.floating);return{reference:c7(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function f7(n){return ms(n).direction==="rtl"}const d7={convertOffsetParentRelativeRectToViewportRelativeRect:t7,getDocumentElement:Ni,getClippingRect:a7,getOffsetParent:hR,getElementRects:u7,getClientRects:n7,getDimensions:l7,getScale:Xc,isElement:Js,isRTL:f7};function h7(n,e){let t=null,r;const s=Ni(n);function i(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:d}=n.getBoundingClientRect();if(a||e(),!f||!d)return;const h=Bg(u),p=Bg(s.clientWidth-(c+f)),m=Bg(s.clientHeight-(u+d)),y=Bg(c),v={rootMargin:-h+"px "+-p+"px "+-m+"px "+-y+"px",threshold:kr(0,Qs(1,l))||1};let A=!0;function w(x){const C=x[0].intersectionRatio;if(C!==l){if(!A)return o();C?o(!1,C):r=setTimeout(()=>{o(!1,1e-7)},1e3)}A=!1}try{t=new IntersectionObserver(w,{...v,root:s.ownerDocument})}catch{t=new IntersectionObserver(w,v)}t.observe(n)}return o(!0),i}function p7(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Lv(n),u=s||i?[...c?Jd(c):[],...Jd(e)]:[];u.forEach(b=>{s&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=c&&a?h7(c,t):null;let d=-1,h=null;o&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(e)})),t()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?rl(n):null;l&&y();function y(){const b=rl(n);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&t(),m=b,p=requestAnimationFrame(y)}return t(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",t),i&&v.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const m7=WK,g7=KK,y7=zK,b7=JK,w7=$K,pR=HK,A7=QK,v7=(n,e,t)=>{const r=new Map,s={platform:d7,...t},i={...s.platform,_c:r};return VK(n,e,{...s,platform:i})};var Ug=typeof document<"u"?P.useLayoutEffect:P.useEffect;function Vg(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,s;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!Vg(n[r],e[r]))return!1;return!0}if(s=Object.keys(n),t=s.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=t;r--!==0;){const i=s[r];if(!(i==="_owner"&&n.$$typeof)&&!Vg(n[i],e[i]))return!1}return!0}return n!==n&&e!==e}function mR(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function gR(n,e){const t=mR(n);return Math.round(e*t)/t}function yR(n){const e=H.useRef(n);return Ug(()=>{e.current=n}),e}function x7(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,f]=H.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=H.useState(r);Vg(d,r)||h(r);const[p,m]=H.useState(null),[y,b]=H.useState(null),v=H.useCallback(Q=>{Q!==C.current&&(C.current=Q,m(Q))},[]),A=H.useCallback(Q=>{Q!==S.current&&(S.current=Q,b(Q))},[]),w=i||p,x=o||y,C=H.useRef(null),S=H.useRef(null),M=H.useRef(u),R=l!=null,O=yR(l),D=yR(s),_=H.useCallback(()=>{if(!C.current||!S.current)return;const Q={placement:e,strategy:t,middleware:d};D.current&&(Q.platform=D.current),v7(C.current,S.current,Q).then(ee=>{const Z={...ee,isPositioned:!0};F.current&&!Vg(M.current,Z)&&(M.current=Z,C0.flushSync(()=>{f(Z)}))})},[d,e,t,D]);Ug(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const F=H.useRef(!1);Ug(()=>(F.current=!0,()=>{F.current=!1}),[]),Ug(()=>{if(w&&(C.current=w),x&&(S.current=x),w&&x){if(O.current)return O.current(w,x,_);_()}},[w,x,_,O,R]);const G=H.useMemo(()=>({reference:C,floating:S,setReference:v,setFloating:A}),[v,A]),B=H.useMemo(()=>({reference:w,floating:x}),[w,x]),V=H.useMemo(()=>{const Q={position:t,left:0,top:0};if(!B.floating)return Q;const ee=gR(B.floating,u.x),Z=gR(B.floating,u.y);return a?{...Q,transform:"translate("+ee+"px, "+Z+"px)",...mR(B.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ee,top:Z}},[t,a,B.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:_,refs:G,elements:B,floatingStyles:V}),[u,_,G,B,V])}const E7=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:s}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?pR({element:r.current,padding:s}).fn(t):{}:r?pR({element:r,padding:s}).fn(t):{}}}},C7=(n,e)=>({...m7(n),options:[n,e]}),k7=(n,e)=>({...g7(n),options:[n,e]}),S7=(n,e)=>({...A7(n),options:[n,e]}),T7=(n,e)=>({...y7(n),options:[n,e]}),O7=(n,e)=>({...b7(n),options:[n,e]}),N7=(n,e)=>({...w7(n),options:[n,e]}),M7=(n,e)=>({...E7(n),options:[n,e]});var R7="Arrow",bR=H.forwardRef((n,e)=>{const{children:t,width:r=10,height:s=5,...i}=n;return k.jsx(nr.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:k.jsx("polygon",{points:"0,0 30,0 15,10"})})});bR.displayName=R7;var P7=bR;function D7(n){const[e,t]=H.useState(void 0);return Fa(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}var Fv="Popper",[wR,AR]=fw(Fv),[I7,vR]=wR(Fv),xR=n=>{const{__scopePopper:e,children:t}=n,[r,s]=H.useState(null);return k.jsx(I7,{scope:e,anchor:r,onAnchorChange:s,children:t})};xR.displayName=Fv;var ER="PopperAnchor",CR=H.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...s}=n,i=vR(ER,t),o=H.useRef(null),a=jr(e,o);return H.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:k.jsx(nr.div,{...s,ref:a})});CR.displayName=ER;var jv="PopperContent",[L7,B7]=wR(jv),kR=H.forwardRef((n,e)=>{var ze,Be,et,le,$e,ae;const{__scopePopper:t,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=n,y=vR(jv,t),[b,v]=H.useState(null),A=jr(e,we=>v(we)),[w,x]=H.useState(null),C=D7(w),S=(C==null?void 0:C.width)??0,M=(C==null?void 0:C.height)??0,R=r+(i!=="center"?"-"+i:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(c)?c:[c],_=D.length>0,F={padding:O,boundary:D.filter(F7),altBoundary:_},{refs:G,floatingStyles:B,placement:V,isPositioned:Q,middlewareData:ee}=x7({strategy:"fixed",placement:R,whileElementsMounted:(...we)=>p7(...we,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[C7({mainAxis:s+M,alignmentAxis:o}),l&&k7({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?S7():void 0,...F}),l&&T7({...F}),O7({...F,apply:({elements:we,rects:_e,availableWidth:z,availableHeight:J})=>{const{width:re,height:ce}=_e.reference,I=we.floating.style;I.setProperty("--radix-popper-available-width",`${z}px`),I.setProperty("--radix-popper-available-height",`${J}px`),I.setProperty("--radix-popper-anchor-width",`${re}px`),I.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),w&&M7({element:w,padding:a}),j7({arrowWidth:S,arrowHeight:M}),d&&N7({strategy:"referenceHidden",...F})]}),[Z,he]=OR(V),ke=Eo(p);Fa(()=>{Q&&(ke==null||ke())},[Q,ke]);const Se=(ze=ee.arrow)==null?void 0:ze.x,Ee=(Be=ee.arrow)==null?void 0:Be.y,be=((et=ee.arrow)==null?void 0:et.centerOffset)!==0,[Fe,je]=H.useState();return Fa(()=>{b&&je(window.getComputedStyle(b).zIndex)},[b]),k.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:Q?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Fe,"--radix-popper-transform-origin":[(le=ee.transformOrigin)==null?void 0:le.x,($e=ee.transformOrigin)==null?void 0:$e.y].join(" "),...((ae=ee.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:k.jsx(L7,{scope:t,placedSide:Z,onArrowChange:x,arrowX:Se,arrowY:Ee,shouldHideArrow:be,children:k.jsx(nr.div,{"data-side":Z,"data-align":he,...m,ref:A,style:{...m.style,animation:Q?void 0:"none"}})})})});kR.displayName=jv;var SR="PopperArrow",_7={top:"bottom",right:"left",bottom:"top",left:"right"},TR=H.forwardRef(function(e,t){const{__scopePopper:r,...s}=e,i=B7(SR,r),o=_7[i.placedSide];return k.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:k.jsx(P7,{...s,ref:t,style:{...s.style,display:"block"}})})});TR.displayName=SR;function F7(n){return n!==null}var j7=n=>({name:"transformOrigin",options:n,fn(e){var y,b,v;const{placement:t,rects:r,middlewareData:s}=e,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[c,u]=OR(t),f={start:"0%",center:"50%",end:"100%"}[u],d=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,h=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let p="",m="";return c==="bottom"?(p=o?f:`${d}px`,m=`${-l}px`):c==="top"?(p=o?f:`${d}px`,m=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,m=o?f:`${h}px`):c==="left"&&(p=`${r.floating.width+l}px`,m=o?f:`${h}px`),{data:{x:p,y:m}}}});function OR(n){const[e,t="center"]=n.split("-");return[e,t]}var U7=xR,NR=CR,V7=kR,H7=TR,Uv="Popover",[MR,jie]=fw(Uv,[AR]),qd=AR(),[z7,sl]=MR(Uv),RR=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=n,a=qd(e),l=H.useRef(null),[c,u]=H.useState(!1),[f=!1,d]=wT({prop:r,defaultProp:s,onChange:i});return k.jsx(U7,{...a,children:k.jsx(z7,{scope:e,contentId:Jp(),triggerRef:l,open:f,onOpenChange:d,onOpenToggle:H.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:c,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:t})})};RR.displayName=Uv;var PR="PopoverAnchor",$7=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=sl(PR,t),i=qd(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return H.useEffect(()=>(o(),()=>a()),[o,a]),k.jsx(NR,{...i,...r,ref:e})});$7.displayName=PR;var DR="PopoverTrigger",IR=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=sl(DR,t),i=qd(t),o=jr(e,s.triggerRef),a=k.jsx(nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":jR(s.open),...r,ref:o,onClick:Ar(n.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:k.jsx(NR,{asChild:!0,...i,children:a})});IR.displayName=DR;var G7="PopoverPortal",[Uie,W7]=MR(G7,{forceMount:void 0}),Zc="PopoverContent",LR=H.forwardRef((n,e)=>{const t=W7(Zc,n.__scopePopover),{forceMount:r=t.forceMount,...s}=n,i=sl(Zc,n.__scopePopover);return k.jsx(fd,{present:r||i.open,children:i.modal?k.jsx(K7,{...s,ref:e}):k.jsx(Q7,{...s,ref:e})})});LR.displayName=Zc;var K7=H.forwardRef((n,e)=>{const t=sl(Zc,n.__scopePopover),r=H.useRef(null),s=jr(e,r),i=H.useRef(!1);return H.useEffect(()=>{const o=r.current;if(o)return GT(o)},[]),k.jsx(xw,{as:qp,allowPinchZoom:!0,children:k.jsx(BR,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ar(n.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ar(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ar(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Q7=H.forwardRef((n,e)=>{const t=sl(Zc,n.__scopePopover),r=H.useRef(!1),s=H.useRef(!1);return k.jsx(BR,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,i),i.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=t.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),BR=H.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=n,d=sl(Zc,t),h=qd(t);return MT(),k.jsx(ud,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:k.jsx(pw,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>d.onOpenChange(!1),children:k.jsx(V7,{"data-state":jR(d.open),role:"dialog",id:d.contentId,...h,...f,ref:e,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_R="PopoverClose",FR=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=sl(_R,t);return k.jsx(nr.button,{type:"button",...r,ref:e,onClick:Ar(n.onClick,()=>s.onOpenChange(!1))})});FR.displayName=_R;var J7="PopoverArrow",q7=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=qd(t);return k.jsx(H7,{...s,...r,ref:e})});q7.displayName=J7;function jR(n){return n?"open":"closed"}var Y7=RR,X7=IR,Z7=LR,Hg=FR;const zg=({children:n,isActive:e,onClick:t,disabled:r,className:s})=>{const i=pe("flex items-center gap-2 p-1.5 text-xs font-medium text-neutral-500 text-left w-full rounded-md border border-transparent transition-all",!e&&!r,"hover:border-neutral-200 hover:bg-neutral-100",e&&!r&&"bg-neutral-200 text-neutral-800",r&&"text-neutral-300 cursor-not-allowed",s);return k.jsx("button",{className:i,disabled:r,onClick:t,children:n})},eQ=(n,e,t)=>{const r=P.useCallback(()=>{const a=n.chain();a.setNodeSelection(t).unsetAllMarks(),(e==null?void 0:e.type.name)!=="paragraph"&&a.setParagraph(),a.run()},[n,t,e==null?void 0:e.type.name]),s=P.useCallback(()=>{n.commands.setNodeSelection(t);const{$anchor:a}=n.state.selection,l=a.node(1)||n.state.selection.node;n.chain().setMeta("hideDragHandle",!0).insertContentAt(t+((e==null?void 0:e.nodeSize)||0),l.toJSON()).run()},[n,t,e==null?void 0:e.nodeSize]),i=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).run(),document.execCommand("copy"),alert("copied")},[n,t]),o=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).deleteSelection().run()},[n,t]);return{resetTextFormatting:r,duplicateNode:s,copyNodeToClipboard:i,deleteNode:o}},tQ=({node:n,getPos:e,editor:t,deleteNode:r})=>{const[s,i]=P.useState(!1),o=eQ(t,n,e()),a=gm(),l=["https://twitter.com","https://x.com"],c=P.useMemo(()=>{const{content:R}=n.content;return R[0].type.name==="table"},[n.content]),u=P.useMemo(()=>{var O;const{content:R}=n.content;return(O=R[0].content.content[0])==null?void 0:O.text},[n.content]),f=P.useMemo(()=>{var O;const{content:R}=n.content;return(O=R[0].content.content[1])==null?void 0:O.text},[n.content]),d=P.useMemo(()=>{const{content:R}=n.content;return R[0].content.content.find(O=>{var D;return(D=O==null?void 0:O.text)==null?void 0:D.match(/\/status\/([0-9]*)/)})},[n.content]),h=()=>{if(!u)return;let R=u;if(u.includes("<iframe"))R=f;else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(u):{const G=u.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);G&&G.length>0&&(R=`https://www.youtube.com/embed/${G[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(u):{const G=u.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);G&&G.length>0&&(R=`https://player.vimeo.com/video/${G[1]}`);break}default:return}const O=640,D=360,_=e(),F=_+n.nodeSize;R&&(t==null||t.chain().focus(_).deleteRange({from:_===0?_:_+1,to:F}).setIframe({src:R,width:O,height:D}).run())},p=R=>{const O=R.match(/\/status\/([0-9]*)/);return O&&O.length>0?O[1]:null},m=()=>{if(!u)return;let R=u;const O=l.some(G=>u.includes(G)),D=p(u);O&&D?R=D:d&&(R=p(d.text));const _=e(),F=_+n.nodeSize;R&&(t==null||t.chain().focus(_).deleteRange({from:_===2?_:_+1,to:F}).setTweetEmbed({tweetId:R}).run())},y=()=>{const R=e()+n.nodeSize;t.commands.insertContentAt(R,{type:"dBlock",content:[{type:"paragraph"}]})},b=()=>{const R=e();t.commands.insertContentAt(R,{type:"dBlock",content:[{type:"paragraph"}]})},v=()=>{r()},A=R=>{R.altKey?x():w()},w=()=>{y()},x=()=>{b()},C=R=>{R.altKey&&v()},M=Tv(()=>{if(l.some(R=>u.includes(R))||d!=null&&d.text){m();return}else{h();return}},1e3);return P.useEffect(()=>{u&&M()},[u]),k.jsxs(od,{as:"div",className:pe("flex gap-2 group w-full relative justify-center items-start",a&&"pointer-events-none",c&&"pointer-events-auto"),children:[k.jsxs("section",{className:"lg:flex gap-1 hidden","aria-label":"left-menu",contentEditable:!1,children:[k.jsx(oN,{content:k.jsxs("div",{className:"flex flex-col w-40",children:[k.jsx("div",{className:"text-xs",children:"Click to add below"}),k.jsx("div",{className:"text-xs",children:"Opt + Click to add above"})]}),children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,onClick:A,children:k.jsx(m8,{size:18})})}),k.jsxs(Y7,{open:s,onOpenChange:i,children:[k.jsx(X7,{asChild:!0,children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,draggable:!0,"data-drag-handle":!0,onClick:C,children:k.jsx(l8,{size:18})})}),k.jsx(Z7,{side:"bottom",align:"start",sideOffset:8,className:"z-10",children:k.jsxs(Jw,{className:"p-2 flex flex-col min-w-[16rem]",children:[k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.resetTextFormatting,children:[k.jsx(y8,{size:18}),"Clear formatting"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.copyNodeToClipboard,children:[k.jsx(s8,{size:18}),"Copy to clipboard"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.duplicateNode,children:[k.jsx(o8,{size:18}),"Duplicate"]})}),k.jsx(Nc.Divider,{horizontal:!0}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.deleteNode,className:"text-red-500 hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20",children:[k.jsx(aw,{size:18}),"Delete"]})})]})})]})]}),k.jsx(aT,{className:pe("node-view-content w-full",{"is-table":c})})]})},nQ=xt.create({name:"dBlock",priority:1e3,group:"dBlock",content:"(block|columns)",draggable:!0,selectable:!1,inline:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="d-block"]'}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-type":"d-block"}),0]},addCommands(){return{setDBlock:n=>({state:e,chain:t})=>{const{selection:{from:r}}=e,s=n!==void 0||n!==null?r:n;return t().insertContentAt(s,{type:this.name,content:[{type:"paragraph"}]}).focus(s+2).run()}}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setDBlock(),Enter:({editor:n})=>{var c;const{selection:{$head:e,from:t,to:r},doc:s}=n.state,i=e.node(e.depth-1);if((i==null?void 0:i.type.name)!=="dBlock")return!1;let o=-1,a="";s.descendants((u,f)=>{if(o!==-1)return!1;if(u.type.name===this.name)return;const[d,h]=[f,f+u.nodeSize];return d<=t&&r<=h&&(o=h,a=u.type.name),!1});const l=(c=s.slice(t,o))==null?void 0:c.toJSON().content;try{return a==="codeBlock"?n.chain().newlineInCode().focus().run():["columns","heading"].includes(a)?n.chain().insertContent({type:"dBlock",content:[{type:"paragraph"}]}).focus().run():n.chain().insertContentAt({from:t,to:o},{type:this.name,content:l}).focus(t+4).run()}catch(u){return console.error(`Error inserting content into dBlock node: ${u}`),!1}}}},addNodeView(){return _a(tQ)}});let Vv,Hv;if(typeof WeakMap<"u"){let n=new WeakMap;Vv=e=>n.get(e),Hv=(e,t)=>(n.set(e,t),t)}else{let n=[],e=10,t=0;Vv=r=>{for(let s=0;s<n.length;s+=2)if(n[s]==r)return n[s+1]},Hv=(r,s)=>(t==e&&(t=0),n[t++]=r,n[t++]=s)}class eu{constructor(e,t,r,s){this.left=e,this.top=t,this.right=r,this.bottom=s}}class Ut{constructor(e,t,r,s){this.width=e,this.height=t,this.map=r,this.problems=s}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let s=t%this.width,i=t/this.width|0,o=s+1,a=i+1;for(let l=1;o<this.width&&this.map[t+l]==r;l++)o++;for(let l=1;a<this.height&&this.map[t+this.width*l]==r;l++)a++;return new eu(s,i,o,a)}throw new RangeError("No cell with offset "+e+" found")}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError("No cell with offset "+e+" found")}nextCell(e,t,r){let{left:s,right:i,top:o,bottom:a}=this.findCell(e);return t=="horiz"?(r<0?s==0:i==this.width)?null:this.map[o*this.width+(r<0?s-1:i)]:(r<0?o==0:a==this.height)?null:this.map[s+this.width*(r<0?o-1:a)]}rectBetween(e,t){let{left:r,right:s,top:i,bottom:o}=this.findCell(e),{left:a,right:l,top:c,bottom:u}=this.findCell(t);return new eu(Math.min(r,a),Math.min(i,c),Math.max(s,l),Math.max(o,u))}cellsInRect(e){let t=[],r={};for(let s=e.top;s<e.bottom;s++)for(let i=e.left;i<e.right;i++){let o=s*this.width+i,a=this.map[o];r[a]||(r[a]=!0,(i!=e.left||!i||this.map[o-1]!=a)&&(s!=e.top||!s||this.map[o-this.width]!=a)&&t.push(a))}return t}positionAt(e,t,r){for(let s=0,i=0;;s++){let o=i+r.child(s).nodeSize;if(s==e){let a=t+e*this.width,l=(e+1)*this.width;for(;a<l&&this.map[a]<i;)a++;return a==l?o-1:this.map[a]}i=o}}static get(e){return Vv(e)||Hv(e,rQ(e))}}function rQ(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=sQ(n),t=n.childCount,r=[],s=0,i=null,o=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){let f=n.child(c);u++;for(let p=0;;p++){for(;s<r.length&&r[s]!=0;)s++;if(p==f.childCount)break;let m=f.child(p),{colspan:y,rowspan:b,colwidth:v}=m.attrs;for(let A=0;A<b;A++){if(A+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-A});break}let w=s+A*e;for(let x=0;x<y;x++){r[w+x]==0?r[w+x]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-x});let C=v&&v[x];if(C){let S=(w+x)%e*2,M=o[S];M==null||M!=C&&o[S+1]==1?(o[S]=C,o[S+1]=1):M==C&&o[S+1]++}}}s+=y,u+=m.nodeSize}let d=(c+1)*e,h=0;for(;s<d;)r[s++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}let a=new Ut(e,t,r,i),l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&iQ(a,o,n),a}function sQ(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){let s=n.child(r),i=0;if(t)for(let o=0;o<r;o++){let a=n.child(o);for(let l=0;l<a.childCount;l++){let c=a.child(l);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){let a=s.child(o);i+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function iQ(n,e,t){n.problems||(n.problems=[]);for(let r=0,s={};r<n.map.length;r++){let i=n.map[r];if(s[i])continue;s[i]=!0;let o=t.nodeAt(i),a=null;for(let l=0;l<o.attrs.colspan;l++){let c=(r+l)%n.width,u=e[c*2];u!=null&&(!o.attrs.colwidth||o.attrs.colwidth[l]!=u)&&((a||(a=oQ(o.attrs)))[l]=u)}a&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function oQ(n){if(n.colwidth)return n.colwidth.slice();let e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Tn(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(let t in n.nodes){let r=n.nodes[t],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const Bo=new Rt("selectingCells");function tu(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function aQ(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function gs(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function $g(n){let e=n.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&e.node.type.spec.tableRole=="cell"?e.$anchor:tu(e.$head)||lQ(e.$head)}function lQ(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function zv(n){return n.parent.type.spec.tableRole=="row"&&n.nodeAfter}function cQ(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function $v(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function UR(n,e,t){let r=n.start(-1),i=Ut.get(n.node(-1)).nextCell(n.pos-r,e,t);return i==null?null:n.node(0).resolve(r+i)}function fn(n,e,t){let r={};for(let s in n)r[s]=n[s];return r[e]=t,r}function il(n,e,t=1){let r=fn(n,"colspan",n.colspan-t);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function VR(n,e,t=1){let r=fn(n,"colspan",n.colspan+t);if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<t;s++)r.colwidth.splice(e,0,0)}return r}function uQ(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.height;s++)if(e.nodeAt(n.map[t+s*n.width]).type!=r)return!1;return!0}class ot extends Ie{constructor(e,t=e){let r=e.node(-1),s=Ut.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,t.pos-i),a=e.node(0),l=s.cellsInRect(o).filter(u=>u!=t.pos-i);l.unshift(t.pos-i);let c=l.map(u=>{let f=r.nodeAt(u),d=u+i+1;return new H0(a.resolve(d),a.resolve(d+f.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),s=e.resolve(t.map(this.$headCell.pos));if(zv(r)&&zv(s)&&$v(r,s)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ot.rowSelection(r,s):i&&this.isColSelection()?ot.colSelection(r,s):new ot(r,s)}return Re.between(r,s)}content(){let e=this.$anchorCell.node(-1),t=Ut.get(e),r=this.$anchorCell.start(-1),s=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let l=s.top;l<s.bottom;l++){let c=[];for(let u=l*t.width+s.left,f=s.left;f<s.right;f++,u++){let d=t.map[u];if(!i[d]){i[d]=!0;let h=t.findCell(d),p=e.nodeAt(d),m=s.left-h.left,y=h.right-s.right;if(m>0||y>0){let b=p.attrs;m>0&&(b=il(b,0,m)),y>0&&(b=il(b,b.colspan-y,y)),h.left<s.left?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}if(h.top<s.top||h.bottom>s.bottom){let b=fn(p.attrs,"rowspan",Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top));h.top<s.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}}o.push(e.child(l).copy(oe.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new ue(oe.from(a),1,1)}replace(e,t=ue.empty){let r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?ue.empty:t)}let i=Ie.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new ue(oe.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=Ut.get(t),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(t.nodeAt(i[o]),s+i[o])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.top<=o.top?(i.top>0&&(e=a.resolve(s+r.map[i.left])),o.bottom<r.height&&(t=a.resolve(s+r.map[r.width*(r.height-1)+o.right-1]))):(o.top>0&&(t=a.resolve(s+r.map[o.left])),i.bottom<r.height&&(e=a.resolve(s+r.map[r.width*(r.height-1)+i.right-1]))),new ot(e,t)}isRowSelection(){let e=Ut.get(this.$anchorCell.node(-1)),t=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-t),s=e.colCount(this.$headCell.pos-t);if(Math.min(r,s)>0)return!1;let i=r+this.$anchorCell.nodeAfter.attrs.colspan,o=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,o)==e.width}eq(e){return e instanceof ot&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.left<=o.left?(i.left>0&&(e=a.resolve(s+r.map[i.top*r.width])),o.right<r.width&&(t=a.resolve(s+r.map[r.width*(o.top+1)-1]))):(o.left>0&&(t=a.resolve(s+r.map[o.top*r.width])),i.right<r.width&&(e=a.resolve(s+r.map[r.width*(i.top+1)-1]))),new ot(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new ot(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new ot(e.resolve(t),e.resolve(r))}getBookmark(){return new Gv(this.$anchorCell.pos,this.$headCell.pos)}}ot.prototype.visible=!1,Ie.jsonID("cell",ot);class Gv{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Gv(e.map(this.anchor),e.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&$v(t,r)?new ot(t,r):Ie.near(r,1)}}function fQ(n){if(!(n.selection instanceof ot))return null;let e=[];return n.selection.forEachCell((t,r)=>{e.push(en.node(r,r+t.nodeSize,{class:"selectedCell"}))}),vt.create(n.doc,e)}function dQ({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,s=n.depth;for(;s>=0&&!(n.after(s+1)<n.end(s));s--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(s).type.spec.tableRole)}function hQ({$from:n,$to:e}){let t,r;for(let s=n.depth;s>0;s--){let i=n.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let s=e.depth;s>0;s--){let i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function pQ(n,e,t){let r=(e||n).selection,s=(e||n).doc,i,o;if(r instanceof Ne&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=ot.create(s,r.from);else if(o=="row"){let a=s.resolve(r.from+1);i=ot.rowSelection(a,a)}else if(!t){let a=Ut.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=ot.create(s,l+1,c)}}else r instanceof Re&&dQ(r)?i=Re.create(s,r.from):r instanceof Re&&hQ(r)&&(i=Re.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}function mQ(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.firstChild.type.spec.tableRole=="table");)t--,r--,e=e.firstChild.content;let s=e.firstChild,i=s.type.spec.tableRole,o=s.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content,u=l?0:Math.max(0,t-1),f=l<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(c=Wv(Tn(o).row,new ue(c,u,f)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(t||r?Wv(Tn(o).row,new ue(e,t,r)).content:e);else return null;return gQ(o,a)}function gQ(n,e){let t=[];for(let s=0;s<e.length;s++){let i=e[s];for(let o=i.childCount-1;o>=0;o--){let{rowspan:a,colspan:l}=i.child(o).attrs;for(let c=s;c<s+a;c++)t[c]=(t[c]||0)+l}}let r=0;for(let s=0;s<t.length;s++)r=Math.max(r,t[s]);for(let s=0;s<t.length;s++)if(s>=e.length&&e.push(oe.empty),t[s]<r){let i=Tn(n).cell.createAndFill(),o=[];for(let a=t[s];a<r;a++)o.push(i);e[s]=e[s].append(oe.from(o))}return{height:e.length,width:r,rows:e}}function Wv(n,e){let t=n.createAndFill();return new U0(t).replace(0,t.content.size,e).doc}function yQ({width:n,height:e,rows:t},r,s){if(n!=r){let i=[],o=[];for(let a=0;a<t.length;a++){let l=t[a],c=[];for(let u=i[a]||0,f=0;u<r;f++){let d=l.child(f%l.childCount);u+d.attrs.colspan>r&&(d=d.type.create(il(d.attrs,d.attrs.colspan,u+d.attrs.colspan-r),d.content)),c.push(d),u+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+d.attrs.colspan}o.push(oe.from(c))}t=o,n=r}if(e!=s){let i=[];for(let o=0,a=0;o<s;o++,a++){let l=[],c=t[a%e];for(let u=0;u<c.childCount;u++){let f=c.child(u);o+f.attrs.rowspan>s&&(f=f.type.create(fn(f.attrs,"rowspan",Math.max(1,s-f.attrs.rowspan)),f.content)),l.push(f)}i.push(oe.from(l))}t=i,e=s}return{width:n,height:e,rows:t}}function bQ(n,e,t,r,s,i,o){let a=n.doc.type.schema,l=Tn(a),c,u;if(s>e.width)for(let f=0,d=0;f<e.height;f++){let h=t.child(f);d+=h.nodeSize;let p=[],m;h.lastChild==null||h.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=u||(u=l.header_cell.createAndFill());for(let y=e.width;y<s;y++)p.push(m);n.insert(n.mapping.slice(o).map(d-1+r),p)}if(i>e.height){let f=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,s);p++){let y=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==l.header_cell;f.push(y?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}let d=l.row.create(null,oe.from(f)),h=[];for(let p=e.height;p<i;p++)h.push(d);n.insert(n.mapping.slice(o).map(r+t.nodeSize-2),h)}return!!(c||u)}function HR(n,e,t,r,s,i,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=s;c<i;c++){let u=o*e.width+c,f=e.map[u];if(e.map[u-e.width]==f){l=!0;let d=t.nodeAt(f),{top:h,left:p}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,fn(d.attrs,"rowspan",o-h)),n.insert(n.mapping.slice(a).map(e.positionAt(o,p,t)),d.type.createAndFill(fn(d.attrs,"rowspan",h+d.attrs.rowspan-o))),c+=d.attrs.colspan-1}}return l}function zR(n,e,t,r,s,i,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=s;c<i;c++){let u=c*e.width+o,f=e.map[u];if(e.map[u-1]==f){l=!0;let d=t.nodeAt(f),h=e.colCount(f),p=n.mapping.slice(a).map(f+r);n.setNodeMarkup(p,null,il(d.attrs,o-h,d.attrs.colspan-(o-h))),n.insert(p+d.nodeSize,d.type.createAndFill(il(d.attrs,0,o-h))),c+=d.attrs.rowspan-1}}return l}function $R(n,e,t,r,s){let i=t?n.doc.nodeAt(t-1):n.doc,o=Ut.get(i),{top:a,left:l}=r,c=l+s.width,u=a+s.height,f=n.tr,d=0;function h(){i=t?f.doc.nodeAt(t-1):f.doc,o=Ut.get(i),d=f.mapping.maps.length}bQ(f,o,i,t,c,u,d)&&h(),HR(f,o,i,t,l,c,a,d)&&h(),HR(f,o,i,t,l,c,u,d)&&h(),zR(f,o,i,t,a,u,l,d)&&h(),zR(f,o,i,t,a,u,c,d)&&h();for(let p=a;p<u;p++){let m=o.positionAt(p,l,i),y=o.positionAt(p,c,i);f.replace(f.mapping.slice(d).map(m+t),f.mapping.slice(d).map(y+t),new ue(s.rows[p-a],0,0))}h(),f.setSelection(new ot(f.doc.resolve(t+o.positionAt(a,l,i)),f.doc.resolve(t+o.positionAt(u-1,c-1,i)))),e(f)}const wQ=yb({ArrowLeft:Wg("horiz",-1),ArrowRight:Wg("horiz",1),ArrowUp:Wg("vert",-1),ArrowDown:Wg("vert",1),"Shift-ArrowLeft":Kg("horiz",-1),"Shift-ArrowRight":Kg("horiz",1),"Shift-ArrowUp":Kg("vert",-1),"Shift-ArrowDown":Kg("vert",1),Backspace:Qg,"Mod-Backspace":Qg,Delete:Qg,"Mod-Delete":Qg});function Gg(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Wg(n,e){return(t,r,s)=>{let i=t.selection;if(i instanceof ot)return Gg(t,r,Ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let o=GR(s,n,e);if(o==null)return!1;if(n=="horiz")return Gg(t,r,Ie.near(t.doc.resolve(i.head+e),e));{let a=t.doc.resolve(o),l=UR(a,n,e),c;return l?c=Ie.near(l,1):e<0?c=Ie.near(t.doc.resolve(a.before(-1)),-1):c=Ie.near(t.doc.resolve(a.after(-1)),1),Gg(t,r,c)}}}function Kg(n,e){return(t,r,s)=>{let i=t.selection;if(!(i instanceof ot)){let a=GR(s,n,e);if(a==null)return!1;i=new ot(t.doc.resolve(a))}let o=UR(i.$headCell,n,e);return o?Gg(t,r,new ot(i.$anchorCell,o)):!1}}function Qg(n,e){let t=n.selection;if(!(t instanceof ot))return!1;if(e){let r=n.tr,s=Tn(n.schema).cell.createAndFill().content;t.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ue(s,0,0))}),r.docChanged&&e(r)}return!0}function AQ(n,e){let t=n.state.doc,r=tu(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ot(r))),!0):!1}function vQ(n,e,t){if(!gs(n.state))return!1;let r=mQ(t),s=n.state.selection;if(s instanceof ot){r||(r={width:1,height:1,rows:[oe.from(Wv(Tn(n.state.schema).cell,t))]});let i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),a=Ut.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=yQ(r,a.right-a.left,a.bottom-a.top),$R(n.state,n.dispatch,o,a,r),!0}else if(r){let i=$g(n.state),o=i.start(-1);return $R(n.state,n.dispatch,o,Ut.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function xQ(n,e){if(e.ctrlKey||e.metaKey)return;let t=WR(n,e.target),r;if(e.shiftKey&&n.state.selection instanceof ot)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&t&&(r=tu(n.state.selection.$anchor))!=null&&Kv(n,e).pos!=r.pos)s(r,e),e.preventDefault();else if(!t)return;function s(a,l){let c=Kv(n,l),u=Bo.getState(n.state)==null;if(!c||!$v(a,c))if(u)c=a;else return;let f=new ot(a,c);if(u||!n.state.selection.eq(f)){let d=n.state.tr.setSelection(f);u&&d.setMeta(Bo,a.pos),n.dispatch(d)}}function i(){n.root.removeEventListener("mouseup",i),n.root.removeEventListener("dragstart",i),n.root.removeEventListener("mousemove",o),Bo.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Bo,-1))}function o(a){let l=Bo.getState(n.state),c;if(l!=null)c=n.state.doc.resolve(l);else if(WR(n,a.target)!=t&&(c=Kv(n,e),!c))return i();c&&s(c,a)}n.root.addEventListener("mouseup",i),n.root.addEventListener("dragstart",i),n.root.addEventListener("mousemove",o)}function GR(n,e,t){if(!(n.state.selection instanceof Re))return null;let{$head:r}=n.state.selection;for(let s=r.depth-1;s>=0;s--){let i=r.node(s);if((t<0?r.index(s):r.indexAfter(s))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let a=r.before(s),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?a:null}}return null}function WR(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e}function Kv(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?tu(n.state.doc.resolve(t.pos)):null}const EQ=new Rt("fix-tables");function KR(n,e,t,r){let s=n.childCount,i=e.childCount;e:for(let o=0,a=0;o<i;o++){let l=e.child(o);for(let c=a,u=Math.min(s,o+3);c<u;c++)if(n.child(c)==l){a=c+1,t+=l.nodeSize;continue e}r(l,t),a<s&&n.child(a).sameMarkup(l)?KR(n.child(a),l,t+1,r):l.nodesBetween(0,l.content.size,r,t+1),t+=l.nodeSize}}function QR(n,e){let t,r=(s,i)=>{s.type.spec.tableRole=="table"&&(t=CQ(n,s,i,t))};return e?e.doc!=n.doc&&KR(e.doc,n.doc,0,r):n.doc.descendants(r),t}function CQ(n,e,t,r){let s=Ut.get(e);if(!s.problems)return r;r||(r=n.tr);let i=[];for(let l=0;l<s.height;l++)i.push(0);for(let l=0;l<s.problems.length;l++){let c=s.problems[l];if(c.type=="collision"){let u=e.nodeAt(c.pos);for(let f=0;f<u.attrs.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,il(u.attrs,u.attrs.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"rowspan",u.attrs.rowspan-c.n))}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"colwidth",c.colwidth))}}let o,a;for(let l=0;l<i.length;l++)i[l]&&(o==null&&(o=l),a=l);for(let l=0,c=t+1;l<s.height;l++){let u=e.child(l),f=c+u.nodeSize,d=i[l];if(d>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let y=0;y<d;y++)p.push(Tn(n.schema)[h].createAndFill());let m=(l==0||o==l-1)&&a==l?c+1:f-1;r.insert(r.mapping.map(m),p)}c=f}return r.setMeta(EQ,{fixTables:!0})}function Ys(n){let e=n.selection,t=$g(n),r=t.node(-1),s=t.start(-1),i=Ut.get(r),o;return e instanceof ot?o=i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):o=i.findCell(t.pos-s),o.tableStart=s,o.map=i,o.table=r,o}function JR(n,{map:e,tableStart:t,table:r},s){let i=s>0?-1:0;uQ(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){let a=o*e.width+s;if(s>0&&s<e.width&&e.map[a-1]==e.map[a]){let l=e.map[a],c=r.nodeAt(l);n.setNodeMarkup(n.mapping.map(t+l),null,VR(c.attrs,s-e.colCount(l))),o+=c.attrs.rowspan-1}else{let l=i==null?Tn(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(o,s,r);n.insert(n.mapping.map(t+c),l.createAndFill())}}return n}function kQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.left))}return!0}function SQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.right))}return!0}function TQ(n,{map:e,table:t,tableStart:r},s){let i=n.mapping.maps.length;for(let o=0;o<e.height;){let a=o*e.width+s,l=e.map[a],c=t.nodeAt(l);if(s>0&&e.map[a-1]==l||s<e.width-1&&e.map[a+1]==l)n.setNodeMarkup(n.mapping.slice(i).map(r+l),null,il(c.attrs,s-e.colCount(l)));else{let u=n.mapping.slice(i).map(r+l);n.delete(u,u+c.nodeSize)}o+=c.attrs.rowspan}}function OQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let s=t.right-1;TQ(r,t,s),s!=t.left;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function NQ(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(e.nodeAt(n.map[s+t*n.width]).type!=r)return!1;return!0}function qR(n,{map:e,tableStart:t,table:r},s){let i=t;for(let l=0;l<s;l++)i+=r.child(l).nodeSize;let o=[],a=s>0?-1:0;NQ(e,r,s+a)&&(a=s==0||s==e.height?null:0);for(let l=0,c=e.width*s;l<e.width;l++,c++)if(s>0&&s<e.height&&e.map[c]==e.map[c-e.width]){let u=e.map[c],f=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,fn(f,"rowspan",f.rowspan+1)),l+=f.colspan-1}else{let u=a==null?Tn(r.type.schema).cell:r.nodeAt(e.map[c+a*e.width]).type;o.push(u.createAndFill())}return n.insert(i,Tn(r.type.schema).row.create(null,o)),n}function MQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.top))}return!0}function RQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.bottom))}return!0}function PQ(n,{map:e,table:t,tableStart:r},s){let i=0;for(let l=0;l<s;l++)i+=t.child(l).nodeSize;let o=i+t.child(s).nodeSize,a=n.mapping.maps.length;n.delete(i+r,o+r);for(let l=0,c=s*e.width;l<e.width;l++,c++){let u=e.map[c];if(s>0&&u==e.map[c-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(a).map(u+r),null,fn(f,"rowspan",f.rowspan-1)),l+=f.colspan-1}else if(s<e.width&&u==e.map[c+e.width]){let f=t.nodeAt(u),d=f.type.create(fn(f.attrs,"rowspan",f.attrs.rowspan-1),f.content),h=e.positionAt(s+1,l,t);n.insert(n.mapping.slice(a).map(r+h),d),l+=f.attrs.colspan-1}}}function DQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let s=t.bottom-1;PQ(r,t,s),s!=t.top;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function YR(n){let e=n.content;return e.childCount==1&&e.firstChild.isTextblock&&e.firstChild.childCount==0}function IQ({width:n,height:e,map:t},r){let s=r.top*n+r.left,i=s,o=(r.bottom-1)*n+r.left,a=s+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[a]==t[a+1])return!0;i+=n,a+=n}for(let l=r.left;l<r.right;l++){if(r.top>0&&t[s]==t[s-n]||r.bottom<e&&t[o]==t[o+n])return!0;s++,o++}return!1}function XR(n,e){let t=n.selection;if(!(t instanceof ot)||t.$anchorCell.pos==t.$headCell.pos)return!1;let r=Ys(n),{map:s}=r;if(IQ(s,r))return!1;if(e){let i=n.tr,o={},a=oe.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){let d=s.map[u*s.width+f],h=r.table.nodeAt(d);if(!o[d])if(o[d]=!0,l==null)l=d,c=h;else{YR(h)||(a=a.append(h.content));let p=i.mapping.map(d+r.tableStart);i.delete(p,p+h.nodeSize)}}if(i.setNodeMarkup(l+r.tableStart,null,fn(VR(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),"rowspan",r.bottom-r.top)),a.size){let u=l+1+c.content.size,f=YR(c)?l+1:u;i.replaceWith(f+r.tableStart,u+r.tableStart,a)}i.setSelection(new ot(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function ZR(n,e){const t=Tn(n.schema);return LQ(({node:r})=>t[r.type.spec.tableRole])(n,e)}function LQ(n){return(e,t)=>{let r=e.selection,s,i;if(r instanceof ot){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{if(s=aQ(r.$from),!s)return!1;i=tu(r.$from).pos}if(s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let o=s.attrs,a=[],l=o.colwidth;o.rowspan>1&&(o=fn(o,"rowspan",1)),o.colspan>1&&(o=fn(o,"colspan",1));let c=Ys(e),u=e.tr;for(let d=0;d<c.right-c.left;d++)a.push(l?fn(o,"colwidth",l&&l[d]?[l[d]]:null):o);let f;for(let d=c.top;d<c.bottom;d++){let h=c.map.positionAt(d,c.left,c.table);d==c.top&&(h+=s.nodeSize);for(let p=c.left,m=0;p<c.right;p++,m++)p==c.left&&d==c.top||u.insert(f=u.mapping.map(h+c.tableStart,1),n({node:s,row:d,col:p}).createAndFill(a[m]))}u.setNodeMarkup(i,n({node:s,row:c.top,col:c.left}),a[0]),r instanceof ot&&u.setSelection(new ot(u.doc.resolve(r.$anchorCell.pos),f&&u.doc.resolve(f))),t(u)}return!0}}function BQ(n,e){return function(t,r){if(!gs(t))return!1;let s=$g(t);if(s.nodeAfter.attrs[n]===e)return!1;if(r){let i=t.tr;t.selection instanceof ot?t.selection.forEachCell((o,a)=>{o.attrs[n]!==e&&i.setNodeMarkup(a,null,fn(o.attrs,n,e))}):i.setNodeMarkup(s.pos,null,fn(s.nodeAfter.attrs,n,e)),r(i)}return!0}}function _Q(n){return function(e,t){if(!gs(e))return!1;if(t){let r=Tn(e.schema),s=Ys(e),i=e.tr,o=s.map.cellsInRect(n=="column"?new eu(s.left,0,s.right,s.map.height):n=="row"?new eu(0,s.top,s.map.width,s.bottom):s),a=o.map(l=>s.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<o.length;l++)i.setNodeMarkup(s.tableStart+o[l],r.header_cell,a[l].attrs);t(i)}return!0}}function eP(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==t.header_cell)return!1}return!0}function Yd(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?_Q(n):function(t,r){if(!gs(t))return!1;if(r){let s=Tn(t.schema),i=Ys(t),o=t.tr,a=eP("row",i,s),l=eP("column",i,s),u=(n==="column"?a:n==="row"?l:!1)?1:0,f=n=="column"?new eu(0,u,1,i.map.height):n=="row"?new eu(u,0,i.map.width,1):i,d=n=="column"?l?s.cell:s.header_cell:n=="row"?a?s.cell:s.header_cell:s.cell;i.map.cellsInRect(f).forEach(h=>{const p=h+i.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,d,m.attrs)}),r(o)}return!0}}Yd("row",{useDeprecatedLogic:!0}),Yd("column",{useDeprecatedLogic:!0});let FQ=Yd("cell",{useDeprecatedLogic:!0});function jQ(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,s=n.before();r>=0;r--){let i=n.node(-1).child(r);if(i.childCount)return s-1-i.lastChild.nodeSize;s-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;let t=n.node(-1);for(let r=n.indexAfter(-1),s=n.after();r<t.childCount;r++){let i=t.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}}function tP(n){return function(e,t){if(!gs(e))return!1;let r=jQ($g(e),n);if(r!=null){if(t){let s=e.doc.resolve(r);t(e.tr.setSelection(Re.between(s,cQ(s))).scrollIntoView())}return!0}}}function UQ(n,e){let t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}let VQ=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qv(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Qv(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Qv(n,e,t,r,s,i){let o=0,a=!0,l=e.firstChild,c=n.firstChild;for(let u=0,f=0;u<c.childCount;u++){let{colspan:d,colwidth:h}=c.child(u).attrs;for(let p=0;p<d;p++,f++){let m=s==f?i:h&&h[p],y=m?m+"px":"";o+=m||r,m||(a=!1),l?(l.style.width!=y&&(l.style.width=y),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;l;){let u=l.nextSibling;l.parentNode.removeChild(l),l=u}a?(t.style.width=o+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=o+"px")}const Gr=new Rt("tableColumnResizing");function HQ({handleWidth:n=5,cellMinWidth:e=25,View:t=VQ,lastColumnResizable:r=!0}={}){return new At({key:Gr,state:{init(i,o){return this.spec.props.nodeViews[Tn(o.schema).table.name]=(a,l)=>new t(a,e,l),new Xd(-1,!1)},apply(i,o){return o.apply(i)}},props:{attributes(i){return Gr.getState(i).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove(i,o){zQ(i,o,n,e,r)},mouseleave(i){$Q(i)},mousedown(i,o){GQ(i,o,e)}},decorations(i){let o=Gr.getState(i);if(o.activeHandle>-1)return YQ(i,o.activeHandle)},nodeViews:{}}})}class Xd{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(Gr);if(r&&r.setHandle!=null)return new Xd(r.setHandle,null);if(r&&r.setDragging!==void 0)return new Xd(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let s=e.mapping.map(t.activeHandle,-1);zv(e.doc.resolve(s))||(s=null),t=new Xd(s,t.dragging)}return t}}function zQ(n,e,t,r,s){let i=Gr.getState(n.state);if(!i.dragging){let o=KQ(e.target),a=-1;if(o){let{left:l,right:c}=o.getBoundingClientRect();e.clientX-l<=t?a=nP(n,e,"left"):c-e.clientX<=t&&(a=nP(n,e,"right"))}if(a!=i.activeHandle){if(!s&&a!==-1){let l=n.state.doc.resolve(a),c=l.node(-1),u=Ut.get(c),f=l.start(-1);if(u.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==u.width-1)return}sP(n,a)}}}function $Q(n){let e=Gr.getState(n.state);e.activeHandle>-1&&!e.dragging&&sP(n,-1)}function GQ(n,e,t){let r=Gr.getState(n.state);if(r.activeHandle==-1||r.dragging)return!1;let s=n.state.doc.nodeAt(r.activeHandle),i=WQ(n,r.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(Gr,{setDragging:{startX:e.clientX,startWidth:i}}));function o(l){window.removeEventListener("mouseup",o),window.removeEventListener("mousemove",a);let c=Gr.getState(n.state);c.dragging&&(QQ(n,c.activeHandle,rP(c.dragging,l,t)),n.dispatch(n.state.tr.setMeta(Gr,{setDragging:null})))}function a(l){if(!l.which)return o(l);let c=Gr.getState(n.state),u=rP(c.dragging,l,t);JQ(n,c.activeHandle,u,t)}return window.addEventListener("mouseup",o),window.addEventListener("mousemove",a),e.preventDefault(),!0}function WQ(n,e,{colspan:t,colwidth:r}){let s=r&&r[r.length-1];if(s)return s;let i=n.domAtPos(e),a=i.node.childNodes[i.offset].offsetWidth,l=t;if(r)for(let c=0;c<t;c++)r[c]&&(a-=r[c],l--);return a/l}function KQ(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList.contains("ProseMirror")?null:n.parentNode;return n}function nP(n,e,t){let r=n.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;let{pos:s}=r,i=tu(n.state.doc.resolve(s));if(!i)return-1;if(t=="right")return i.pos;let o=Ut.get(i.node(-1)),a=i.start(-1),l=o.map.indexOf(i.pos-a);return l%o.width==0?-1:a+o.map[l-1]}function rP(n,e,t){let r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function sP(n,e){n.dispatch(n.state.tr.setMeta(Gr,{setHandle:e}))}function QQ(n,e,t){let r=n.state.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=n.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;let f=i.map[u],{attrs:d}=s.nodeAt(f),h=d.colspan==1?0:a-i.colCount(f);if(d.colwidth&&d.colwidth[h]==t)continue;let p=d.colwidth?d.colwidth.slice():qQ(d.colspan);p[h]=t,l.setNodeMarkup(o+f,null,fn(d,"colwidth",p))}l.docChanged&&n.dispatch(l)}function JQ(n,e,t,r){let s=n.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),a=Ut.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1,l=n.domAtPos(s.start(-1)).node;for(;l.nodeName!="TABLE";)l=l.parentNode;Qv(i,l.firstChild,l,r,a,t)}function qQ(n){let e=[];for(let t=0;t<n;t++)e.push(0);return e}function YQ(n,e){let t=[],r=n.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan;for(let l=0;l<i.height;l++){let c=a+l*i.width-1;if((a==i.width||i.map[c]!=i.map[c+1])&&(l==0||i.map[c-1]!=i.map[c-1-i.width])){let u=i.map[c],f=o+u+s.nodeAt(u).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",t.push(en.widget(f,d))}}return vt.create(n.doc,t)}function XQ({allowTableNodeSelection:n=!1}={}){return new At({key:Bo,state:{init(){return null},apply(e,t){let r=e.getMeta(Bo);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;let{deleted:s,pos:i}=e.mapping.mapResult(t);return s?null:i}},props:{decorations:fQ,handleDOMEvents:{mousedown:xQ},createSelectionBetween(e){if(Bo.getState(e.state)!=null)return e.state.selection},handleTripleClick:AQ,handleKeyDown:wQ,handlePaste:vQ},appendTransaction(e,t,r){return pQ(r,QR(r,t),n)}})}function iP(n,e,t,r,s,i){var u;let o=0,a=!0,l=e.firstChild;const c=n.firstChild;if(c)for(let f=0,d=0;f<c.childCount;f+=1){const{colspan:h,colwidth:p}=c.child(f).attrs;for(let m=0;m<h;m+=1,d+=1){const y=s===d?i:p&&p[m],b=y?`${y}px`:"";o+=y||r,y||(a=!1),l?(l.style.width!==b&&(l.style.width=b),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=b}}for(;l;){const f=l.nextSibling;(u=l==null?void 0:l.parentNode)==null||u.removeChild(l),l=f}a?(t.style.width=`${o}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${o}px`)}class ZQ{constructor(e,t){W(this,"node");W(this,"cellMinWidth");W(this,"dom");W(this,"table");W(this,"colgroup");W(this,"contentDOM");this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),iP(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,iP(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function oP(n,e){return n.createAndFill()}function eJ(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function tJ(n,e,t,r,s){const i=eJ(n),o=[],a=[];for(let c=0;c<t;c+=1){const u=oP(i.cell);if(u&&a.push(u),r){const f=oP(i.header_cell);f&&o.push(f)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?o:a));return i.table.createChecked(null,l)}function nJ(n){return n instanceof ot}const Jg=({editor:n})=>{const{selection:e}=n.state;if(!nJ(e))return!1;let t=0;const r=Tb(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},rJ=xt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:ZQ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let t=0,r=!0;try{n.content.firstChild.content.forEach(i=>{if(i.attrs.colwidth)i.attrs.colwidth.forEach(o=>{o?t+=o:(r=!1,t+=this.options.cellMinWidth)});else{r=!1;const o=i.attrs.colspan?i.attrs.colspan:1;t+=this.options.cellMinWidth*o}})}catch{r=!1}return r&&t>0?e.style=`width: ${t}px;`:t&&t>0?e.style=`min-width: ${t}px`:e.style=null,["div",{class:"table-wrapper"},["table",nt(this.options.HTMLAttributes,e),["tbody",0]]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const{selection:o}=r,a=tJ(i.schema,n,e,t);if(s){const l=r.selection.anchor+1;r.replaceRangeWith(o.from-1,o.to,a).scrollIntoView().setSelection(Re.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>kQ(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>SQ(n,e),deleteColumn:()=>({state:n,dispatch:e})=>OQ(n,e),addRowBefore:()=>({state:n,dispatch:e})=>MQ(n,e),addRowAfter:()=>({state:n,dispatch:e})=>RQ(n,e),deleteRow:()=>({state:n,dispatch:e})=>DQ(n,e),deleteTable:()=>({state:n,dispatch:e})=>UQ(n,e),mergeCells:()=>({state:n,dispatch:e})=>XR(n,e),splitCell:()=>({state:n,dispatch:e})=>ZR(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Yd("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Yd("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>FQ(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>XR(n,e)?!0:ZR(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>BQ(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>tP(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>tP(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&QR(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ot.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Jg,"Mod-Backspace":Jg,Delete:Jg,"Mod-Delete":Jg}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[HQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],XQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Ye(xe(n,"tableRole",e))}}});function aP(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}var lP=typeof window<"u"&&typeof document<"u";function Jv(n,e){n&&(typeof n=="function"&&n(e),{}.hasOwnProperty.call(n,"current")&&(n.current=e))}function cP(){return lP&&document.createElement("div")}function sJ(n){var e={"data-placement":n.placement};return n.referenceHidden&&(e["data-reference-hidden"]=""),n.escaped&&(e["data-escaped"]=""),e}function uP(n,e){if(n===e)return!0;if(typeof n=="object"&&n!=null&&typeof e=="object"&&e!=null){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(var t in n)if(e.hasOwnProperty(t)){if(!uP(n[t],e[t]))return!1}else return!1;return!0}else return!1}function iJ(n){var e=[];return n.forEach(function(t){e.find(function(r){return uP(t,r)})||e.push(t)}),e}function oJ(n,e){var t,r;return Object.assign({},e,{popperOptions:Object.assign({},n.popperOptions,e.popperOptions,{modifiers:iJ([].concat(((t=n.popperOptions)==null?void 0:t.modifiers)||[],((r=e.popperOptions)==null?void 0:r.modifiers)||[]))})})}var qv=lP?P.useLayoutEffect:P.useEffect;function aJ(n){var e=P.useRef();return e.current||(e.current=typeof n=="function"?n():n),e.current}function fP(n,e,t){t.split(/\s+/).forEach(function(r){r&&n.classList[e](r)})}var lJ={name:"className",defaultValue:"",fn:function(e){var t=e.popper.firstElementChild,r=function(){var a;return!!((a=e.props.render)!=null&&a.$$tippy)};function s(){if(e.props.className&&!r()){process.env.NODE_ENV!=="production"&&console.warn(["@tippyjs/react: Cannot use `className` prop in conjunction with","`render` prop. Place the className on the element you are","rendering."].join(" "));return}fP(t,"add",e.props.className)}function i(){r()&&fP(t,"remove",e.props.className)}return{onCreate:s,onBeforeUpdate:i,onAfterUpdate:s}}};function cJ(n){function e(t){var r=t.children,s=t.content,i=t.visible,o=t.singleton,a=t.render,l=t.reference,c=t.disabled,u=c===void 0?!1:c,f=t.ignoreAttributes,d=f===void 0?!0:f;t.__source,t.__self;var h=aP(t,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"]),p=i!==void 0,m=o!==void 0,y=P.useState(!1),b=y[0],v=y[1],A=P.useState({}),w=A[0],x=A[1],C=P.useState(),S=C[0],M=C[1],R=aJ(function(){return{container:cP(),renders:1}}),O=Object.assign({ignoreAttributes:d},h,{content:R.container});p&&(process.env.NODE_ENV!=="production"&&["trigger","hideOnClick","showOnCreate"].forEach(function(G){O[G]!==void 0&&console.warn(["@tippyjs/react: Cannot specify `"+G+"` prop in","controlled mode (`visible` prop)"].join(" "))}),O.trigger="manual",O.hideOnClick=!1),m&&(u=!0);var D=O,_=O.plugins||[];a&&(D=Object.assign({},O,{plugins:m&&o.data!=null?[].concat(_,[{fn:function(){return{onTrigger:function(V,Q){var ee=o.data.children.find(function(Z){var he=Z.instance;return he.reference===Q.currentTarget});V.state.$$activeSingletonInstance=ee.instance,M(ee.content)}}}}]):_,render:function(){return{popper:R.container}}}));var F=[l].concat(r?[r.type]:[]);return qv(function(){var G=l;l&&l.hasOwnProperty("current")&&(G=l.current);var B=n(G||R.ref||cP(),Object.assign({},D,{plugins:[lJ].concat(O.plugins||[])}));return R.instance=B,u&&B.disable(),i&&B.show(),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M}),v(!0),function(){B.destroy(),o==null||o.cleanup(B)}},F),qv(function(){var G;if(R.renders===1){R.renders++;return}var B=R.instance;B.setProps(oJ(B.props,D)),(G=B.popperInstance)==null||G.forceUpdate(),u?B.disable():B.enable(),p&&(i?B.show():B.hide()),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M})}),qv(function(){var G;if(a){var B=R.instance;B.setProps({popperOptions:Object.assign({},B.props.popperOptions,{modifiers:[].concat((((G=B.props.popperOptions)==null?void 0:G.modifiers)||[]).filter(function(V){var Q=V.name;return Q!=="$$tippyReact"}),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Q){var ee,Z=Q.state,he=(ee=Z.modifiersData)==null?void 0:ee.hide;(w.placement!==Z.placement||w.referenceHidden!==(he==null?void 0:he.isReferenceHidden)||w.escaped!==(he==null?void 0:he.hasPopperEscaped))&&x({placement:Z.placement,referenceHidden:he==null?void 0:he.isReferenceHidden,escaped:he==null?void 0:he.hasPopperEscaped}),Z.attributes.popper={}}}])})})}},[w.placement,w.referenceHidden,w.escaped].concat(F)),P.createElement(P.Fragment,null,r?P.cloneElement(r,{ref:function(B){R.ref=B,Jv(r.ref,B)}}):null,b&&kt.createPortal(a?a(sJ(w),S,R.instance):s,R.container))}return e}var uJ=function(n,e){return P.forwardRef(function(r,s){var i=r.children,o=aP(r,["children"]);return P.createElement(n,Object.assign({},e,o),i?P.cloneElement(i,{ref:function(l){Jv(s,l),Jv(i.ref,l)}}):null)})},fJ=uJ(cJ(Ba));const dJ=[{name:"Add row above",action:n=>n.chain().focus().addRowBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7h2v-2h4v2h2v-2h4v2h2v-2h4v2h2v-7M4 14h4v3H4v-3m6 0h4v3h-4v-3m10 0v3h-4v-3h4m-9-4h2V7h3V5h-3V2h-2v3H8v2h3v3Z"})})},{name:"Add row below",action:n=>n.chain().focus().addRowAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3h2v2h4V3h2v2h4V3h2v2h4V3h2v7M4 10h4V7H4v3m6 0h4V7h-4v3m10 0V7h-4v3h4m-9 4h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z"})})},{name:"Add left column",action:n=>n.chain().focus().addColumnBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M13 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9V2h-9m7 8v4h-7v-4h7m0 6v4h-7v-4h7m0-12v4h-7V4h7M9 11H6V8H4v3H1v2h3v3h2v-3h3v-2Z"})})},{name:"Add right column",action:n=>n.chain().focus().addColumnAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M11 2a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2V2h9m-7 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m11 7h3V8h2v3h3v2h-3v3h-2v-3h-3v-2Z"})})},{name:"Remove row",action:n=>n.chain().focus().deleteRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41L9.41 13M22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3M4 9h4V6H4v3m6 0h4V6h-4v3m6 0h4V6h-4v3Z"})})},{name:"Remove column",action:n=>n.chain().focus().deleteColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59L17.59 12Z"})})},{name:"Toggle header row",action:n=>n.chain().focus().toggleHeaderRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4Z"})})},{name:"Toggle header column",action:n=>n.chain().focus().toggleHeaderColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M8 2h8a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8Z"})})},{name:"Toggle header cell",action:n=>n.chain().focus().toggleHeaderCell().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M21 19a1 1 0 0 1-1 1h-1v-2h2v1m-6 1v-2h2v2h-2m-4 0v-2h2v2h-2m-4 0v-2h2v2H7m-3 0a1 1 0 0 1-1-1v-1h2v2H4M19 4H5a2 2 0 0 0-2 2v2h18V6c0-1.11-.89-2-2-2M5 14H3v2h2v-2m0-4H3v2h2v-2m16 0h-2v2h2v-2m0 4h-2v2h2v-2m-10 2v-2h2v2h-2m0-4v-2h2v2h-2"})})},{name:"Remove table",action:n=>n.chain().focus().deleteTable().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M12.35 20H10v-3h2.09c.12-.72.37-1.39.72-2H10v-3h4v1.54c.58-.54 1.25-.93 2-1.19V12h4v.35c.75.26 1.42.65 2 1.19V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h9.54c-.54-.58-.93-1.25-1.19-2M16 7h4v3h-4V7m-6 0h4v3h-4V7M8 20H4v-3h4v3m0-5H4v-3h4v3m0-5H4V7h4v3m6.46 5.88l1.42-1.42L18 16.59l2.12-2.13l1.42 1.42L19.41 18l2.13 2.12l-1.42 1.42L18 19.41l-2.12 2.13l-1.42-1.42L16.59 18l-2.13-2.12"})})}],dP=({node:n,getPos:e,selected:t,editor:r})=>{const[s,i]=P.useState(!1),o=gm(),a=P.useRef(null),l=()=>{const{from:u,to:f}=r.state.selection,d=e(),h=d+n.nodeSize;i(d<=u&&f<=h)};P.useEffect(()=>(r.on("selectionUpdate",l),setTimeout(l,100),()=>{r.off("selectionUpdate",l)}));const c=()=>{var d,h;let u=(d=a.current)==null?void 0:d.clientTop;u&&(u+=5);let f=(h=a.current)==null?void 0:h.clientLeft;return f&&(f+=5),{top:`${u}px`,left:`${f}px`}};return k.jsxs(od,{className:"group",children:[k.jsx(aT,{as:"span"}),(s||t)&&k.jsx(fJ,{appendTo:document.body,trigger:"click",interactive:!0,animation:"shift-toward-subtle",placement:"top-start",content:k.jsx("article",{className:"w-screen lg:w-full",contentEditable:!1,children:k.jsx("ul",{tabIndex:0,className:"fixed top-8 right-1/2 translate-x-1/2 menu menu-compact p-2 shadow bg-base-100 rounded-lg w-56",style:c(),children:dJ.map(u=>k.jsx("li",{children:k.jsx(Ha,{variant:"ghost",className:"!items-center w-full !justify-start !font-[400]",onClick:()=>u.action(r),children:k.jsx("span",{children:u.name})})},u.name))})}),children:k.jsx("label",{tabIndex:0,className:pe("trigger-button",{hidden:o}),contentEditable:!1,children:k.jsx(a8,{size:20})})})]})},hJ=xt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"td",className:"relative"})}}),pJ=xt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"th",className:"relative"})}}),hP=n=>(n.stopPropagation(),n.preventDefault(),n),mJ=function(n){const e=n.scrollHeight>n.clientHeight,r=window.getComputedStyle(n).overflowY.indexOf("hidden")!==-1;return e&&!r},pP=function(n){return!n||n===document.body?document.body:mJ(n)?n:pP(n.parentNode)},Yv=(n,e,t)=>{const r=document.createElement(n);if(!r)throw new Error(`Element with name ${n} can't be created.`);return e&&Object.entries(e).forEach(([s,i])=>r.setAttribute(s,i)),t&&Object.entries(t).forEach(([s,i])=>r.addEventListener(s,i)),r},gJ=xt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return({editor:n,HTMLAttributes:e,getPos:t})=>{const r=()=>t(),s=pP(n.options.element);let i=!1;const o={deleteRow:()=>{this.editor.chain().deleteNode("tableRow").focus().run()},selectRow:()=>{const b=r(),v=n.state.doc.resolve(b),A=new Ne(v);n.view.dispatch(n.state.tr.setSelection(A))}},a=()=>{i=!0},l=()=>{i=!1},c=Yv("section",{class:"absolute hidden flex items-center w-2 bg-gray-200 z-50 cursor-pointer border-1 border-indigo-600 rounded-l opacity-25 hover:opacity-100",contenteditable:"false"},{click:b=>{b&&hP(b),o.selectRow()},mouseenter:()=>{a()},mouseover:()=>{a()},mouseleave:()=>{l(),d()}}),u=Yv("button",{class:"text-sm px-1 absolute -translate-x-[125%] hover:active:-translate-x-[125%] mr-2"},{click:b=>{b&&hP(b),o.deleteRow()}}),f=()=>{m(),c.classList.remove("hidden")},d=()=>{setTimeout(()=>{i||c.classList.add("hidden")},100)},h=Yv("tr",{...e},{mouseenter:f,mouseover:f,mouseleave:d});c.append(u),document.body.append(c);let p="";const m=()=>{setTimeout(()=>{const b=h.getBoundingClientRect(),v=JSON.stringify(b);p!==v&&(c.style.top=`${b.top+document.documentElement.scrollTop}px`,c.style.left=`${b.x+document.documentElement.scrollLeft-8}px`,c.style.height=`${b.height+1}px`,p=v)})};return setTimeout(()=>{m()},100),n.on("selectionUpdate",m),n.on("update",m),s==null||s.addEventListener("scroll",m),document.addEventListener("scroll",m),{dom:h,contentDOM:h,destroy:()=>{c.remove(),n.off("selectionUpdate",m),n.off("update",m),s==null||s.removeEventListener("scroll",m),document.removeEventListener("scroll",m)}}}}}),yJ=[rJ.configure({resizable:!0}),hJ,pJ,gJ],bJ=xM.extend({content:"(dBlock|columns)+"});function mP({types:n,node:e}){return e!=null&&e.type?Array.isArray(n)&&n.includes(e.type)||e.type===n:!1}const wJ=Ot.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const n=new Rt(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>this.options.notAfter.includes(t.name));return[new At({key:n,appendTransaction:(t,r,s)=>{const{doc:i,tr:o,schema:a}=s,l=n.getState(s),c=i.content.size,u=a.nodes[this.options.node];if(l)return o.insert(c,u.create())},state:{init:(t,r)=>{const s=r.tr.doc.lastChild;return!mP({node:s,types:e})},apply:(t,r)=>{var i,o,a;if(!t.docChanged)return r;const s=(a=(o=(i=t.doc.lastChild)==null?void 0:i.content)==null?void 0:o.content)==null?void 0:a[0];return!mP({node:s,types:e})}}})]}}),AJ=({node:n,editor:e,getPos:t})=>{const[r,s]=P.useState(""),i=gm(),o=["https://twitter.com","https://x.com"],a=()=>{switch(n.attrs.data){case"twitter":return k.jsx(gT,{size:20});case"iframe":return k.jsx(yT,{size:20});default:return k.jsx(b8,{size:20})}},l=()=>{switch(n.attrs.data){case"twitter":return"Embed a Twitter tweet";case"iframe":return"Embed a video";default:return"Embed an URL"}},c=()=>{if(!r){alert("Please enter a url");return}let p=r;if(r.includes("<iframe")){const A=r.match(/src="([^"]*)"/);A&&A.length>0&&(p=A[1])}else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://www.youtube.com/embed/${A[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://player.vimeo.com/video/${A[1]}`);break}default:{alert("Please enter a valid url");return}}const m=640,y=360,b=t(),v=b+n.nodeSize;p&&(e==null||e.chain().focus(b).deleteRange({from:b,to:v}).setIframe({src:p,width:m,height:y}).run())},u=()=>{if(!r){alert("Please enter a url");return}let p=r;const m=o.some(w=>r.includes(w)),y=r.match(/\/status\/([0-9]*)/),b=y&&y.length>0;if(m&&b)p=y[1];else{alert("invalid url");return}const v=t(),A=v+n.nodeSize;p&&(e==null||e.chain().focus(v).deleteRange({from:v,to:A}).setTweetEmbed({tweetId:p}).run())},d=Tv(()=>{switch(n.attrs.data){case"twitter":u();break;default:c();break}},500);P.useEffect(()=>{const p=m=>{if(m.key==="Backspace"&&r===""){const y=t(),b=y+n.nodeSize;(n.content.size===0||n.textContent==="")&&(e==null||e.chain().focus(y).deleteRange({from:y,to:b}).run(),m.preventDefault())}};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[r,e,t,n]),P.useEffect(()=>{r&&d()},[r]),P.useEffect(()=>{e==null||e.chain().focus()},[]);const h=P.useRef(null);return P.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:!i&&k.jsxs("div",{className:"relative w-full",children:[k.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[#A1AAB1]",children:a()}),k.jsx("input",{ref:h,value:r,placeholder:l(),onChange:p=>s(p.target.value),onClick:p=>p.stopPropagation(),className:"rounded bg-[#f2f2f2] p-3 pl-10 w-full cursor-pointer transition-all ease-in-out text-sm"})]})})},vJ=xt.create({name:"actionButton",group:"block",content:"block*",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{data:{default:null}}},addNodeView(){return _a(AJ)},parseHTML(){return[{tag:"div[data-action-node]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-action-node":""}),0]},addCommands(){return{setActionButton:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{data:n},content:[]})}}}),xJ=[VW,jW.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}),RM,HW.configure({types:["heading","paragraph"]}),AK,fK.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0}),dK.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),mK.configure({multicolor:!0}),wK.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),UW,EK,gK.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),bK.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),vM.configure({HTMLAttributes:{class:"space-y-4 !ml-6"}}),DM.configure({HTMLAttributes:{class:"leading-normal"}}),EM.configure({width:3,color:"#d1d5db"}),CM,nQ,wJ,bJ,...yJ,PK.configure({uploadFn:T8}),xK,CK,OK,vJ,vK],EJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",CJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",kJ=n=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");return t.classList.add("collaboration-cursor__label"),t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null),e.insertBefore(t,null),e},SJ=n=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");t.classList.add("custom-cursor__label-container"),t.setAttribute("style",`border: 1px solid ${n.color}`);const r=document.createElement("img");r.src=EJ,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=n.name;const o=document.createElement("img");return o.src=CJ,o.classList.add("custom-cursor__badge"),s.appendChild(i),t.appendChild(r),t.appendChild(s),t.appendChild(o),e.appendChild(t),e},TJ=n=>n.isEns?SJ(n):kJ(n),OJ="6.13.1";function NJ(n,e,t){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 n===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=n,s}async function On(n){const e=Object.keys(n);return(await Promise.all(e.map(r=>Promise.resolve(n[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Me(n,e,t){for(let r in e){let s=e[r];const i=t?t[r]:null;i&&NJ(s,i,r),Object.defineProperty(n,r,{enumerable:!0,value:s,writable:!1})}}function nu(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(nu).join(", ")+" ]";if(n instanceof Uint8Array){const e="0123456789abcdef";let t="0x";for(let r=0;r<n.length;r++)t+=e[n[r]>>4],t+=e[n[r]&15];return t}if(typeof n=="object"&&typeof n.toJSON=="function")return nu(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{ "+e.map(t=>`${nu(t)}: ${nu(n[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function dn(n,e){return n&&n.code===e}function Xv(n){return dn(n,"CALL_EXCEPTION")}function Mt(n,e,t){let r=n;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${nu(t)}`);for(const o in t){if(o==="shortMessage")continue;const a=t[o];i.push(o+"="+nu(a))}}i.push(`code=${e}`),i.push(`version=${OJ}`),i.length&&(n+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(n);break;default:s=new Error(n)}return Me(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&Me(s,{shortMessage:r}),s}function te(n,e,t,r){if(!n)throw Mt(e,t,r)}function $(n,e,t,r){te(n,e,"INVALID_ARGUMENT",{argument:t,value:r})}function gP(n,e,t){t==null&&(t=""),t&&(t=": "+t),te(n>=e,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:n,expectedCount:e}),te(n<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((n,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");n.push(e)}catch{}return n},[]);function qg(n,e,t){if(t==null&&(t=""),n!==e){let r=t,s="new";t&&(r+=".",s+=" "+t),te(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function yP(n,e,t){if(n instanceof Uint8Array)return t?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((n.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(n.substring(s,s+2),16),s+=2;return r}$(!1,"invalid BytesLike value",e||"value",n)}function ct(n,e){return yP(n,e,!1)}function Vn(n,e){return yP(n,e,!0)}function Ct(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&n.length!==2+2*e||e===!0&&n.length%2!==0)}function Zv(n){return Ct(n,!0)||n instanceof Uint8Array}const bP="0123456789abcdef";function Ae(n){const e=ct(n);let t="0x";for(let r=0;r<e.length;r++){const s=e[r];t+=bP[(s&240)>>4]+bP[s&15]}return t}function zt(n){return"0x"+n.map(e=>Ae(e).substring(2)).join("")}function ru(n){return Ct(n,!0)?(n.length-2)/2:ct(n).length}function Vt(n,e,t){const r=ct(n);return t!=null&&t>r.length&&te(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:t}),Ae(r.slice(e??0,t??r.length))}function wP(n,e,t){const r=ct(n);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),t?s.set(r,e-r.length):s.set(r,0),Ae(s)}function ol(n,e){return wP(n,e,!0)}function MJ(n,e){return wP(n,e,!1)}const Yg=BigInt(0),ys=BigInt(1),su=9007199254740991;function RJ(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"width"));if(te(t>>r===Yg,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),t>>r-ys){const s=(ys<<r)-ys;return-((~t&s)+ys)}return t}function AP(n,e){let t=Ce(n,"value");const r=BigInt(Je(e,"width")),s=ys<<r-ys;if(t<Yg){t=-t,te(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});const i=(ys<<r)-ys;return(~t&i)+ys}else te(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return t}function Zd(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"bits"));return t&(ys<<r)-ys}function Ce(n,e){switch(typeof n){case"bigint":return n;case"number":return $(Number.isInteger(n),"underflow",e||"value",n),$(n>=-su&&n<=su,"overflow",e||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(t){$(!1,`invalid BigNumberish string: ${t.message}`,e||"value",n)}}$(!1,"invalid BigNumberish value",e||"value",n)}function Xg(n,e){const t=Ce(n,e);return te(t>=Yg,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),t}const vP="0123456789abcdef";function e1(n){if(n instanceof Uint8Array){let e="0x0";for(const t of n)e+=vP[t>>4],e+=vP[t&15];return BigInt(e)}return Ce(n)}function Je(n,e){switch(typeof n){case"bigint":return $(n>=-su&&n<=su,"overflow",e||"value",n),Number(n);case"number":return $(Number.isInteger(n),"underflow",e||"value",n),$(n>=-su&&n<=su,"overflow",e||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return Je(BigInt(n),e)}catch(t){$(!1,`invalid numeric string: ${t.message}`,e||"value",n)}}$(!1,"invalid numeric value",e||"value",n)}function PJ(n){return Je(e1(n))}function _o(n,e){let r=Xg(n,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Je(e,"width");for(te(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<s*2;)r="0"+r}return"0x"+r}function Hn(n){const e=Xg(n,"value");if(e===Yg)return new Uint8Array([]);let t=e.toString(16);t.length%2&&(t="0"+t);const r=new Uint8Array(t.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(t.substring(i,i+2),16)}return r}function al(n){let e=Ae(Zv(n)?n:Hn(n)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const xP="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const EP=BigInt(58);function DJ(n){const e=ct(n);let t=e1(e),r="";for(;t;)r=xP[Number(t%EP)]+r,t/=EP;for(let s=0;s<e.length&&!e[s];s++)r=xP[0]+r;return r}function IJ(n){n=atob(n);const e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return ct(e)}function LJ(n){const e=ct(n);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}class CP{constructor(e,t,r){W(this,"filter");W(this,"emitter");q(this,Pu);L(this,Pu,t),Me(this,{emitter:e,filter:r})}async removeListener(){T(this,Pu)!=null&&await this.emitter.off(this.filter,T(this,Pu))}}Pu=new WeakMap;function BJ(n,e,t,r,s){$(!1,`invalid codepoint at offset ${e}; ${n}`,"bytes",t)}function kP(n,e,t,r,s){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<t.length&&t[o]>>6===2;o++)i++;return i}return n==="OVERRUN"?t.length-e-1:0}function _J(n,e,t,r,s){return n==="OVERLONG"?($(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),kP(n,e,t))}const FJ=Object.freeze({error:BJ,ignore:kP,replace:_J});function jJ(n,e){e==null&&(e=FJ.error);const t=ct(n,"bytes"),r=[];let s=0;for(;s<t.length;){const i=t[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,t,r):s+=e("BAD_PREFIX",s-1,t,r);continue}if(s-1+o>=t.length){s+=e("OVERRUN",s-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let c=0;c<o;c++){let u=t[s];if((u&192)!=128){s+=e("MISSING_CONTINUE",s,t,r),l=null;break}l=l<<6|u&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,t,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,t,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,t,r,l);continue}r.push(l)}}return r}function Mi(n,e){$(typeof n=="string","invalid string value","str",n);let t=[];for(let r=0;r<n.length;r++){const s=n.charCodeAt(r);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){r++;const i=n.charCodeAt(r);$(r<n.length&&(i&64512)===56320,"invalid surrogate pair","str",n);const o=65536+((s&1023)<<10)+(i&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function UJ(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function iu(n,e){return UJ(jJ(n,e))}function SP(n){async function e(t,r){te(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=t.url.split(":")[0].toLowerCase();te(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),te(s==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=Mt("request timeout","TIMEOUT"),o.abort()},t.timeout);r&&r.addListener(()=>{i=Mt("request cancelled","CANCELLED"),o.abort()});const l={method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:o.signal};let c;try{c=await fetch(t.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const u={};c.headers.forEach((h,p)=>{u[p.toLowerCase()]=h});const f=await c.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:c.status,statusMessage:c.statusText,headers:u,body:d}}return e}const VJ=12,HJ=250;let TP=SP();const zJ=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),$J=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let t1=!1;async function OP(n,e){try{const t=n.match(zJ);if(!t)throw new Error("invalid data");return new Fo(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?IJ(t[3]):WJ(t[3]))}catch{return new Fo(599,"BAD REQUEST (invalid data: URI)",{},null,new zn(n))}}function NP(n){async function e(t,r){try{const s=t.match($J);if(!s)throw new Error("invalid link");return new zn(`${n}${s[2]}`)}catch{return new Fo(599,"BAD REQUEST (invalid IPFS URI)",{},null,new zn(t))}}return e}const Zg={data:OP,ipfs:NP("https://gateway.ipfs.io/ipfs/")},MP=new WeakMap;class GJ{constructor(e){q(this,Ol);q(this,Xo);L(this,Ol,[]),L(this,Xo,!1),MP.set(e,()=>{if(!T(this,Xo)){L(this,Xo,!0);for(const t of T(this,Ol))setTimeout(()=>{t()},0);L(this,Ol,[])}})}addListener(e){te(!T(this,Xo),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,Ol).push(e)}get cancelled(){return T(this,Xo)}checkSignal(){te(!this.cancelled,"cancelled","CANCELLED",{})}}Ol=new WeakMap,Xo=new WeakMap;function ey(n){if(n==null)throw new Error("missing signal; should not happen");return n.checkSignal(),n}const u0=class u0{constructor(e){q(this,Pl);q(this,Du);q(this,Iu);q(this,xs);q(this,Wi);q(this,Lu);q(this,Bu);q(this,mn);q(this,Nr);q(this,Ki);q(this,Nl);q(this,Ml);q(this,Rl);q(this,ni);q(this,Es);q(this,Zo);L(this,Bu,String(e)),L(this,Du,!1),L(this,Iu,!0),L(this,xs,{}),L(this,Wi,""),L(this,Lu,3e5),L(this,Es,{slotInterval:HJ,maxAttempts:VJ}),L(this,Zo,null)}get url(){return T(this,Bu)}set url(e){L(this,Bu,String(e))}get body(){return T(this,mn)==null?null:new Uint8Array(T(this,mn))}set body(e){if(e==null)L(this,mn,void 0),L(this,Nr,void 0);else if(typeof e=="string")L(this,mn,Mi(e)),L(this,Nr,"text/plain");else if(e instanceof Uint8Array)L(this,mn,e),L(this,Nr,"application/octet-stream");else if(typeof e=="object")L(this,mn,Mi(JSON.stringify(e))),L(this,Nr,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,mn)!=null}get method(){return T(this,Wi)?T(this,Wi):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),L(this,Wi,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,xs));return T(this,Ki)&&(e.authorization=`Basic ${LJ(Mi(T(this,Ki)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Nr)&&(e["content-type"]=T(this,Nr)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){T(this,xs)[String(e).toLowerCase()]=String(t)}clearHeaders(){L(this,xs,{})}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,Ki)||null}setCredentials(e,t){$(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),L(this,Ki,`${e}:${t}`)}get allowGzip(){return T(this,Iu)}set allowGzip(e){L(this,Iu,!!e)}get allowInsecureAuthentication(){return!!T(this,Du)}set allowInsecureAuthentication(e){L(this,Du,!!e)}get timeout(){return T(this,Lu)}set timeout(e){$(e>=0,"timeout must be non-zero","timeout",e),L(this,Lu,e)}get preflightFunc(){return T(this,Nl)||null}set preflightFunc(e){L(this,Nl,e)}get processFunc(){return T(this,Ml)||null}set processFunc(e){L(this,Ml,e)}get retryFunc(){return T(this,Rl)||null}set retryFunc(e){L(this,Rl,e)}get getUrlFunc(){return T(this,Zo)||TP}set getUrlFunc(e){L(this,Zo,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,mn)?Ae(T(this,mn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,Es).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,Es).maxAttempts=e.maxAttempts)}send(){return te(T(this,ni)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),L(this,ni,new GJ(this)),fe(this,Pl,Zh).call(this,0,RP()+this.timeout,0,this,new Fo(0,"",{},null,this))}cancel(){te(T(this,ni)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=MP.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();te(this.method==="GET"&&(t!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new u0(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,L(s,xs,Object.assign({},T(this,xs))),T(this,mn)&&L(s,mn,new Uint8Array(T(this,mn))),L(s,Nr,T(this,Nr)),s}clone(){const e=new u0(this.url);return L(e,Wi,T(this,Wi)),T(this,mn)&&L(e,mn,T(this,mn)),L(e,Nr,T(this,Nr)),L(e,xs,Object.assign({},T(this,xs))),L(e,Ki,T(this,Ki)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),L(e,Nl,T(this,Nl)),L(e,Ml,T(this,Ml)),L(e,Rl,T(this,Rl)),L(e,Es,Object.assign({},T(this,Es))),L(e,Zo,T(this,Zo)),e}static lockConfig(){t1=!0}static getGateway(e){return Zg[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(t1)throw new Error("gateways locked");Zg[e]=t}static registerGetUrl(e){if(t1)throw new Error("gateways locked");TP=e}static createGetUrlFunc(e){return SP()}static createDataGateway(){return OP}static createIpfsGatewayFunc(e){return NP(e)}};Du=new WeakMap,Iu=new WeakMap,xs=new WeakMap,Wi=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,mn=new WeakMap,Nr=new WeakMap,Ki=new WeakMap,Nl=new WeakMap,Ml=new WeakMap,Rl=new WeakMap,ni=new WeakMap,Es=new WeakMap,Zo=new WeakMap,Pl=new WeakSet,Zh=async function(e,t,r,s,i){var u,f,d;if(e>=T(this,Es).maxAttempts)return i.makeServerError("exceeded maximum retry limit");te(RP()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await KJ(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Zg){const h=await Zg[a](o.url,ey(T(s,ni)));if(h instanceof Fo){let p=h;if(this.processFunc){ey(T(s,ni));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,ey(T(s,ni)));let c=new Fo(l.statusCode,l.statusMessage,l.headers,l.body,s);if(c.statusCode===301||c.statusCode===302){try{const h=c.headers.location||"";return fe(u=o.redirect(h),Pl,Zh).call(u,e+1,t,0,s,c)}catch{}return c}else if(c.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,c,e))){const h=c.headers["retry-after"];let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),fe(f=o.clone(),Pl,Zh).call(f,e+1,t,p,s,c)}if(this.processFunc){ey(T(s,ni));try{c=await this.processFunc(o,c)}catch(h){(h.throttle==null||typeof h.stall!="number")&&c.makeServerError("error in post-processing function",h).assertOk();let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),fe(d=o.clone(),Pl,Zh).call(d,e+1,t,p,s,c)}}return c};let zn=u0;const wE=class wE{constructor(e,t,r,s,i){q(this,_h);q(this,Fh);q(this,jh);q(this,Mr);q(this,_u);q(this,Dl);L(this,_h,e),L(this,Fh,t),L(this,jh,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),L(this,Mr,s==null?null:new Uint8Array(s)),L(this,_u,i||null),L(this,Dl,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Mr)?Ae(T(this,Mr)):"null"}>`}get statusCode(){return T(this,_h)}get statusMessage(){return T(this,Fh)}get headers(){return Object.assign({},T(this,jh))}get body(){return T(this,Mr)==null?null:new Uint8Array(T(this,Mr))}get bodyText(){try{return T(this,Mr)==null?"":iu(T(this,Mr))}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,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,t){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 wE(599,r,this.headers,this.body,T(this,_u)||void 0);return L(s,Dl,{message:e,error:t}),s}throwThrottleError(e,t){t==null?t=-1:$(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const r=new Error(e||"throttling requests");throw Me(r,{stall:t,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Mr)!=null}get request(){return T(this,_u)}ok(){return T(this,Dl).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=T(this,Dl);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Mr)&&(s=iu(T(this,Mr)))}catch{}te(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};_h=new WeakMap,Fh=new WeakMap,jh=new WeakMap,Mr=new WeakMap,_u=new WeakMap,Dl=new WeakMap;let Fo=wE;function RP(){return new Date().getTime()}function WJ(n){return Mi(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function KJ(n){return new Promise(e=>setTimeout(e,n))}function QJ(n){let e=n.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function PP(n,e,t){let r=0;for(let s=0;s<t;s++)r=r*256+n[e+s];return r}function DP(n,e,t,r){const s=[];for(;t<e+1+r;){const i=IP(n,t);s.push(i.result),t+=i.consumed,te(t<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:n,length:r,offset:e})}return{consumed:1+r,result:s}}function IP(n,e){te(n.length!==0,"data too short","BUFFER_OVERRUN",{buffer:n,length:0,offset:1});const t=r=>{te(r<=n.length,"data short segment too short","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r})};if(n[e]>=248){const r=n[e]-247;t(e+1+r);const s=PP(n,e+1,r);return t(e+1+r+s),DP(n,e,e+1+r,r+s)}else if(n[e]>=192){const r=n[e]-192;return t(e+1+r),DP(n,e,e+1,r)}else if(n[e]>=184){const r=n[e]-183;t(e+1+r);const s=PP(n,e+1,r);t(e+1+r+s);const i=Ae(n.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(n[e]>=128){const r=n[e]-128;t(e+1+r);const s=Ae(n.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:QJ(n[e])}}function ty(n){const e=ct(n,"data"),t=IP(e,0);return $(t.consumed===e.length,"unexpected junk after rlp payload","data",n),t.result}function LP(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function BP(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(i){r=r.concat(BP(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=LP(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(n,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=LP(e.length);return t.unshift(183+t.length),t.concat(e)}const _P="0123456789abcdef";function ll(n){let e="0x";for(const t of BP(n))e+=_P[t>>4],e+=_P[t&15];return e}const $n=32,n1=new Uint8Array($n),JJ=["then"],ny={},FP=new WeakMap;function cl(n){return FP.get(n)}function jP(n,e){FP.set(n,e)}function eh(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw t.error=e,t}function r1(n,e,t){return n.indexOf(null)>=0?e.map((r,s)=>r instanceof ou?r1(cl(r),r,t):r):n.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(t&&o instanceof ou&&(o=r1(cl(o),o,t)),r[s]=o),r},{})}const ju=class ju extends Array{constructor(...t){const r=t[0];let s=t[1],i=(t[2]||[]).slice(),o=!0;r!==ny&&(s=t,i=[],o=!1);super(s.length);q(this,Fu);s.forEach((c,u)=>{this[u]=c});const a=i.reduce((c,u)=>(typeof u=="string"&&c.set(u,(c.get(u)||0)+1),c),new Map);if(jP(this,Object.freeze(s.map((c,u)=>{const f=i[u];return f!=null&&a.get(f)===1?f:null}))),L(this,Fu,[]),T(this,Fu)==null&&T(this,Fu),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(c,u,f)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const h=Je(u,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=c[h];return p instanceof Error&&eh(`index ${h}`,p),p}if(JJ.indexOf(u)>=0)return Reflect.get(c,u,f);const d=c[u];if(d instanceof Function)return function(...h){return d.apply(this===f?c:this,h)};if(!(u in c))return c.getValue.apply(this===f?c:this,[u])}return Reflect.get(c,u,f)}});return jP(l,cl(this)),l}toArray(t){const r=[];return this.forEach((s,i)=>{s instanceof Error&&eh(`index ${i}`,s),t&&s instanceof ju&&(s=s.toArray(t)),r.push(s)}),r}toObject(t){const r=cl(this);return r.reduce((s,i,o)=>(te(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),r1(r,this,t)),{})}slice(t,r){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=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=t;a<r;a++)i.push(this[a]),o.push(s[a]);return new ju(ny,i,o)}filter(t,r){const s=cl(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&eh(`index ${a}`,l),t.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new ju(ny,i,o)}map(t,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&eh(`index ${i}`,o),s.push(t.call(r,o,i,this))}return s}getValue(t){const r=cl(this).indexOf(t);if(r===-1)return;const s=this[r];return s instanceof Error&&eh(`property ${JSON.stringify(t)}`,s.error),s}static fromItems(t,r){return new ju(ny,t,r)}};Fu=new WeakMap;let ou=ju;function UP(n){let e=Hn(n);return te(e.length<=$n,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:$n,offset:e.length}),e.length!==$n&&(e=Vn(zt([n1.slice(e.length%$n),e]))),e}class Ri{constructor(e,t,r,s){W(this,"name");W(this,"type");W(this,"localName");W(this,"dynamic");Me(this,{name:e,type:t,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){$(!1,e,this.localName,t)}}class s1{constructor(){q(this,Uu);q(this,Qi);q(this,Il);L(this,Qi,[]),L(this,Il,0)}get data(){return zt(T(this,Qi))}get length(){return T(this,Il)}appendWriter(e){return fe(this,Uu,y0).call(this,Vn(e.data))}writeBytes(e){let t=Vn(e);const r=t.length%$n;return r&&(t=Vn(zt([t,n1.slice(r)]))),fe(this,Uu,y0).call(this,t)}writeValue(e){return fe(this,Uu,y0).call(this,UP(e))}writeUpdatableValue(){const e=T(this,Qi).length;return T(this,Qi).push(n1),L(this,Il,T(this,Il)+$n),t=>{T(this,Qi)[e]=UP(t)}}}Qi=new WeakMap,Il=new WeakMap,Uu=new WeakSet,y0=function(e){return T(this,Qi).push(e),L(this,Il,T(this,Il)+e.length),e.length};const AE=class AE{constructor(e,t,r){q(this,_l);W(this,"allowLoose");q(this,cr);q(this,Rr);q(this,Ll);q(this,Bl);q(this,ea);Me(this,{allowLoose:!!t}),L(this,cr,Vn(e)),L(this,Ll,0),L(this,Bl,null),L(this,ea,r??1024),L(this,Rr,0)}get data(){return Ae(T(this,cr))}get dataLength(){return T(this,cr).length}get consumed(){return T(this,Rr)}get bytes(){return new Uint8Array(T(this,cr))}subReader(e){const t=new AE(T(this,cr).slice(T(this,Rr)+e),this.allowLoose,T(this,ea));return L(t,Bl,this),t}readBytes(e,t){let r=fe(this,_l,lF).call(this,0,e,!!t);return fe(this,_l,NE).call(this,e),L(this,Rr,T(this,Rr)+r.length),r.slice(0,e)}readValue(){return e1(this.readBytes($n))}readIndex(){return PJ(this.readBytes($n))}};cr=new WeakMap,Rr=new WeakMap,Ll=new WeakMap,Bl=new WeakMap,ea=new WeakMap,_l=new WeakSet,NE=function(e){var t;if(T(this,Bl))return fe(t=T(this,Bl),_l,NE).call(t,e);L(this,Ll,T(this,Ll)+e),te(T(this,ea)<1||T(this,Ll)<=T(this,ea)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ea)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),offset:T(this,Rr),length:e,info:{bytesRead:T(this,Ll),dataLength:this.dataLength}})},lF=function(e,t,r){let s=Math.ceil(t/$n)*$n;return T(this,Rr)+s>T(this,cr).length&&(this.allowLoose&&r&&T(this,Rr)+t<=T(this,cr).length?s=t:te(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),length:T(this,cr).length,offset:T(this,Rr)+s})),T(this,cr).slice(T(this,Rr),T(this,Rr)+s)};let i1=AE;function ry(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function o1(n,...e){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function qJ(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ry(n.outputLen),ry(n.blockLen)}function au(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function VP(n,e){o1(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const a1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const HP=n=>n instanceof Uint8Array,YJ=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),l1=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Xs=(n,e)=>n<<32-e|n>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function XJ(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function sy(n){if(typeof n=="string"&&(n=XJ(n)),!HP(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function ZJ(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!HP(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}class c1{clone(){return this._cloneInto()}}function u1(n){const e=r=>n().update(sy(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function eq(n=32){if(a1&&typeof a1.getRandomValues=="function")return a1.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}class zP extends c1{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,qJ(e);const r=sy(t);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 au(this),this.iHash.update(e),this}digestInto(e){au(this),o1(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:t,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=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const $P=(n,e,t)=>new zP(n,e).update(t).digest();$P.create=(n,e)=>new zP(n,e);function tq(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),l=r?4:0,c=r?0:4;n.setUint32(e+l,o,r),n.setUint32(e+c,a,r)}class GP extends c1{constructor(e,t,r,s){super(),this.blockLen=e,this.outputLen=t,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=l1(this.buffer)}update(e){au(this);const{view:t,buffer:r,blockLen:s}=this;e=sy(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=l1(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(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){au(this),VP(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;t[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++)t[f]=0;tq(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=l1(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,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%t&&e.buffer.set(r),e}}const nq=(n,e,t)=>n&e^~n&t,rq=(n,e,t)=>n&e^n&t^e&t,sq=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]),jo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Uo=new Uint32Array(64);class iq extends GP{constructor(){super(64,32,8,!1),this.A=jo[0]|0,this.B=jo[1]|0,this.C=jo[2]|0,this.D=jo[3]|0,this.E=jo[4]|0,this.F=jo[5]|0,this.G=jo[6]|0,this.H=jo[7]|0}get(){const{A:e,B:t,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,t,r,s,i,o,a,l]}set(e,t,r,s,i,o,a,l){this.A=e|0,this.B=t|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,t){for(let f=0;f<16;f++,t+=4)Uo[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){const d=Uo[f-15],h=Uo[f-2],p=Xs(d,7)^Xs(d,18)^d>>>3,m=Xs(h,17)^Xs(h,19)^h>>>10;Uo[f]=m+Uo[f-7]+p+Uo[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const d=Xs(a,6)^Xs(a,11)^Xs(a,25),h=u+d+nq(a,l,c)+sq[f]+Uo[f]|0,m=(Xs(r,2)^Xs(r,13)^Xs(r,22))+rq(r,s,i)|0;u=c,c=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,c=c+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,l,c,u)}roundClean(){Uo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const WP=u1(()=>new iq),iy=BigInt(2**32-1),f1=BigInt(32);function KP(n,e=!1){return e?{h:Number(n&iy),l:Number(n>>f1&iy)}:{h:Number(n>>f1&iy)|0,l:Number(n&iy)|0}}function QP(n,e=!1){let t=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let s=0;s<n.length;s++){const{h:i,l:o}=KP(n[s],e);[t[s],r[s]]=[i,o]}return[t,r]}const oq=(n,e)=>BigInt(n>>>0)<<f1|BigInt(e>>>0),aq=(n,e,t)=>n>>>t,lq=(n,e,t)=>n<<32-t|e>>>t,cq=(n,e,t)=>n>>>t|e<<32-t,uq=(n,e,t)=>n<<32-t|e>>>t,fq=(n,e,t)=>n<<64-t|e>>>t-32,dq=(n,e,t)=>n>>>t-32|e<<64-t,hq=(n,e)=>e,pq=(n,e)=>n,JP=(n,e,t)=>n<<t|e>>>32-t,qP=(n,e,t)=>e<<t|n>>>32-t,YP=(n,e,t)=>e<<t-32|n>>>64-t,XP=(n,e,t)=>n<<t-32|e>>>64-t;function mq(n,e,t,r){const s=(e>>>0)+(r>>>0);return{h:n+t+(s/2**32|0)|0,l:s|0}}const Ze={fromBig:KP,split:QP,toBig:oq,shrSH:aq,shrSL:lq,rotrSH:cq,rotrSL:uq,rotrBH:fq,rotrBL:dq,rotr32H:hq,rotr32L:pq,rotlSH:JP,rotlSL:qP,rotlBH:YP,rotlBL:XP,add:mq,add3L:(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),add3H:(n,e,t,r)=>e+t+r+(n/2**32|0)|0,add4L:(n,e,t,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0),add4H:(n,e,t,r,s)=>e+t+r+s+(n/2**32|0)|0,add5H:(n,e,t,r,s,i)=>e+t+r+s+i+(n/2**32|0)|0,add5L:(n,e,t,r,s)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0)},[gq,yq]=Ze.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(n=>BigInt(n))),Vo=new Uint32Array(80),Ho=new Uint32Array(80);class bq extends GP{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:t,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:y}=this;return[e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y]}set(e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y){this.Ah=e|0,this.Al=t|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=c|0,this.El=u|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=y|0}process(e,t){for(let A=0;A<16;A++,t+=4)Vo[A]=e.getUint32(t),Ho[A]=e.getUint32(t+=4);for(let A=16;A<80;A++){const w=Vo[A-15]|0,x=Ho[A-15]|0,C=Ze.rotrSH(w,x,1)^Ze.rotrSH(w,x,8)^Ze.shrSH(w,x,7),S=Ze.rotrSL(w,x,1)^Ze.rotrSL(w,x,8)^Ze.shrSL(w,x,7),M=Vo[A-2]|0,R=Ho[A-2]|0,O=Ze.rotrSH(M,R,19)^Ze.rotrBH(M,R,61)^Ze.shrSH(M,R,6),D=Ze.rotrSL(M,R,19)^Ze.rotrBL(M,R,61)^Ze.shrSL(M,R,6),_=Ze.add4L(S,D,Ho[A-7],Ho[A-16]),F=Ze.add4H(_,C,O,Vo[A-7],Vo[A-16]);Vo[A]=F|0,Ho[A]=_|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:y,Hh:b,Hl:v}=this;for(let A=0;A<80;A++){const w=Ze.rotrSH(f,d,14)^Ze.rotrSH(f,d,18)^Ze.rotrBH(f,d,41),x=Ze.rotrSL(f,d,14)^Ze.rotrSL(f,d,18)^Ze.rotrBL(f,d,41),C=f&h^~f&m,S=d&p^~d&y,M=Ze.add5L(v,x,S,yq[A],Ho[A]),R=Ze.add5H(M,b,w,C,gq[A],Vo[A]),O=M|0,D=Ze.rotrSH(r,s,28)^Ze.rotrBH(r,s,34)^Ze.rotrBH(r,s,39),_=Ze.rotrSL(r,s,28)^Ze.rotrBL(r,s,34)^Ze.rotrBL(r,s,39),F=r&i^r&a^i&a,G=s&o^s&l^o&l;b=m|0,v=y|0,m=h|0,y=p|0,h=f|0,p=d|0,{h:f,l:d}=Ze.add(c|0,u|0,R|0,O|0),c=a|0,u=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const B=Ze.add3L(O,_,G);r=Ze.add3H(B,R,D,F),s=B|0}({h:r,l:s}=Ze.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ze.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l}=Ze.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=Ze.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:f,l:d}=Ze.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=Ze.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:y}=Ze.add(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:v}=Ze.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(r,s,i,o,a,l,c,u,f,d,h,p,m,y,b,v)}roundClean(){Vo.fill(0),Ho.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 wq=u1(()=>new bq);function Aq(){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 ZP=Aq();ZP.crypto||ZP.msCrypto;function vq(n){switch(n){case"sha256":return WP.create();case"sha512":return wq.create()}$(!1,"invalid hashing algorithm name","algorithm",n)}const[eD,tD,nD]=[[],[],[]],xq=BigInt(0),th=BigInt(1),Eq=BigInt(2),Cq=BigInt(7),kq=BigInt(256),Sq=BigInt(113);for(let n=0,e=th,t=1,r=0;n<24;n++){[t,r]=[r,(2*t+3*r)%5],eD.push(2*(5*r+t)),tD.push((n+1)*(n+2)/2%64);let s=xq;for(let i=0;i<7;i++)e=(e<<th^(e>>Cq)*Sq)%kq,e&Eq&&(s^=th<<(th<<BigInt(i))-th);nD.push(s)}const[Tq,Oq]=QP(nD,!0),rD=(n,e,t)=>t>32?YP(n,e,t):JP(n,e,t),sD=(n,e,t)=>t>32?XP(n,e,t):qP(n,e,t);function Nq(n,e=24){const t=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,c=t[l],u=t[l+1],f=rD(c,u,1)^t[a],d=sD(c,u,1)^t[a+1];for(let h=0;h<50;h+=10)n[o+h]^=f,n[o+h+1]^=d}let s=n[2],i=n[3];for(let o=0;o<24;o++){const a=tD[o],l=rD(s,i,a),c=sD(s,i,a),u=eD[o];s=n[u],i=n[u+1],n[u]=l,n[u+1]=c}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=Tq[r],n[1]^=Oq[r]}t.fill(0)}class d1 extends c1{constructor(e,t,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ry(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=YJ(this.state)}keccak(){Nq(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){au(this);const{blockLen:t,state:r}=this;e=sy(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(t-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:s}=this;e[r]^=t,t&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){au(this,!1),o1(e),this.finish();const t=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(t.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 ry(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(VP(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:t,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new d1(t,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 Mq=((n,e,t)=>u1(()=>new d1(e,n,t)))(1,136,256/8);let iD=!1;const oD=function(n){return Mq(n)};let aD=oD;function Xt(n){const e=ct(n,"data");return Ae(aD(e))}Xt._=oD,Xt.lock=function(){iD=!0},Xt.register=function(n){if(iD)throw new TypeError("keccak256 is locked");aD=n},Object.freeze(Xt);const lD=function(n){return vq("sha256").update(n).digest()};let cD=lD,uD=!1;function lu(n){const e=ct(n,"data");return Ae(cD(e))}lu._=lD,lu.lock=function(){uD=!0},lu.register=function(n){if(uD)throw new Error("sha256 is locked");cD=n},Object.freeze(lu),Object.freeze(lu);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fD=BigInt(0),oy=BigInt(1),Rq=BigInt(2),ay=n=>n instanceof Uint8Array,Pq=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function cu(n){if(!ay(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=Pq[n[t]];return e}function dD(n){const e=n.toString(16);return e.length&1?`0${e}`:e}function h1(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function uu(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const t=new Uint8Array(e/2);for(let r=0;r<t.length;r++){const s=r*2,i=n.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function ul(n){return h1(cu(n))}function p1(n){if(!ay(n))throw new Error("Uint8Array expected");return h1(cu(Uint8Array.from(n).reverse()))}function fu(n,e){return uu(n.toString(16).padStart(e*2,"0"))}function m1(n,e){return fu(n,e).reverse()}function Dq(n){return uu(dD(n))}function bs(n,e,t){let r;if(typeof e=="string")try{r=uu(e)}catch(i){throw new Error(`${n} must be valid hex string, got "${e}". Cause: ${i}`)}else if(ay(e))r=Uint8Array.from(e);else throw new Error(`${n} must be hex string or Uint8Array`);const s=r.length;if(typeof t=="number"&&s!==t)throw new Error(`${n} expected ${t} bytes, got ${s}`);return r}function nh(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!ay(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}function Iq(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Lq(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Bq(n){let e;for(e=0;n>fD;n>>=oy,e+=1);return e}function _q(n,e){return n>>BigInt(e)&oy}const Fq=(n,e,t)=>n|(t?oy:fD)<<BigInt(e),g1=n=>(Rq<<BigInt(n-1))-oy,y1=n=>new Uint8Array(n),hD=n=>Uint8Array.from(n);function pD(n,e,t){if(typeof n!="number"||n<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 t!="function")throw new Error("hmacFn must be a function");let r=y1(n),s=y1(n),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>t(s,r,...f),l=(f=y1())=>{s=a(hD([0]),f),r=a(),f.length!==0&&(s=a(hD([1]),f),r=a())},c=()=>{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(c()));)l();return o(),h}}const jq={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function rh(n,e,t={}){const r=(s,i,o)=>{const a=jq[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=n[s];if(!(o&&l===void 0)&&!a(l,n))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(t))r(s,i,!0);return n}const Uq=Object.freeze(Object.defineProperty({__proto__:null,bitGet:_q,bitLen:Bq,bitMask:g1,bitSet:Fq,bytesToHex:cu,bytesToNumberBE:ul,bytesToNumberLE:p1,concatBytes:nh,createHmacDrbg:pD,ensureBytes:bs,equalBytes:Iq,hexToBytes:uu,hexToNumber:h1,numberToBytesBE:fu,numberToBytesLE:m1,numberToHexUnpadded:dD,numberToVarBytesBE:Dq,utf8ToBytes:Lq,validateObject:rh},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hn=BigInt(0),$t=BigInt(1),fl=BigInt(2),Vq=BigInt(3),b1=BigInt(4),mD=BigInt(5),gD=BigInt(8);BigInt(9),BigInt(16);function or(n,e){const t=n%e;return t>=hn?t:e+t}function Hq(n,e,t){if(t<=hn||e<hn)throw new Error("Expected power/modulo > 0");if(t===$t)return hn;let r=$t;for(;e>hn;)e&$t&&(r=r*n%t),n=n*n%t,e>>=$t;return r}function Wr(n,e,t){let r=n;for(;e-- >hn;)r*=r,r%=t;return r}function w1(n,e){if(n===hn||e<=hn)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=or(n,e),r=e,s=hn,i=$t;for(;t!==hn;){const a=r/t,l=r%t,c=s-i*a;r=t,t=l,s=i,i=c}if(r!==$t)throw new Error("invert: does not exist");return or(s,e)}function zq(n){const e=(n-$t)/fl;let t,r,s;for(t=n-$t,r=0;t%fl===hn;t/=fl,r++);for(s=fl;s<n&&Hq(s,e,n)!==n-$t;s++);if(r===1){const o=(n+$t)/b1;return function(l,c){const u=l.pow(c,o);if(!l.eql(l.sqr(u),c))throw new Error("Cannot find square root");return u}}const i=(t+$t)/fl;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=r,u=a.pow(a.mul(a.ONE,s),t),f=a.pow(l,i),d=a.pow(l,t);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<c&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(u,$t<<BigInt(c-h-1));u=a.sqr(p),f=a.mul(f,p),d=a.mul(d,u),c=h}return f}}function $q(n){if(n%b1===Vq){const e=(n+$t)/b1;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(n%gD===mD){const e=(n-mD)/gD;return function(r,s){const i=r.mul(s,fl),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,fl),o),c=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(c),s))throw new Error("Cannot find square root");return c}}return zq(n)}const Gq=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Wq(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=Gq.reduce((r,s)=>(r[s]="function",r),e);return rh(n,t)}function Kq(n,e,t){if(t<hn)throw new Error("Expected power > 0");if(t===hn)return n.ONE;if(t===$t)return e;let r=n.ONE,s=e;for(;t>hn;)t&$t&&(r=n.mul(r,s)),s=n.sqr(s),t>>=$t;return r}function Qq(n,e){const t=new Array(e.length),r=e.reduce((i,o,a)=>n.is0(o)?i:(t[a]=i,n.mul(i,o)),n.ONE),s=n.inv(r);return e.reduceRight((i,o,a)=>n.is0(o)?i:(t[a]=n.mul(i,t[a]),n.mul(i,o)),s),t}function yD(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function Jq(n,e,t=!1,r={}){if(n<=hn)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:s,nByteLength:i}=yD(n,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=$q(n),a=Object.freeze({ORDER:n,BITS:s,BYTES:i,MASK:g1(s),ZERO:hn,ONE:$t,create:l=>or(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return hn<=l&&l<n},is0:l=>l===hn,isOdd:l=>(l&$t)===$t,neg:l=>or(-l,n),eql:(l,c)=>l===c,sqr:l=>or(l*l,n),add:(l,c)=>or(l+c,n),sub:(l,c)=>or(l-c,n),mul:(l,c)=>or(l*c,n),pow:(l,c)=>Kq(a,l,c),div:(l,c)=>or(l*w1(c,n),n),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>w1(l,n),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>Qq(a,l),cmov:(l,c,u)=>u?c:l,toBytes:l=>t?m1(l,i):fu(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return t?p1(l):ul(l)}});return Object.freeze(a)}function bD(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function wD(n){const e=bD(n);return e+Math.ceil(e/2)}function qq(n,e,t=!1){const r=n.length,s=bD(e),i=wD(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=t?ul(n):p1(n),a=or(o,e-$t)+$t;return t?m1(a,s):fu(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Yq=BigInt(0),A1=BigInt(1);function Xq(n,e){const t=(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:t,unsafeLadder(s,i){let o=n.ZERO,a=s;for(;i>Yq;)i&A1&&(o=o.add(a)),a=a.double(),i>>=A1;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let c=s,u=c;for(let f=0;f<o;f++){u=c,l.push(u);for(let d=1;d<a;d++)u=u.add(c),l.push(u);c=u.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let c=n.ZERO,u=n.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 y=Number(o&f);o>>=h,y>l&&(y-=d,o+=A1);const b=m,v=m+Math.abs(y)-1,A=p%2!==0,w=y<0;y===0?u=u.add(t(A,i[b])):c=c.add(t(w,i[v]))}return{p:c,f:u}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let c=i.get(s);return c||(c=this.precomputeWindow(s,l),l!==1&&i.set(s,a(c))),this.wNAF(l,c,o)}}}function AD(n){return Wq(n.Fp),rh(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yD(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Zq(n){const e=AD(n);rh(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:s}=e;if(t){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:eY,hexToBytes:tY}=Uq,dl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(n){const{Err:e}=dl;if(n.length<2||n[0]!==2)throw new e("Invalid signature integer tag");const t=n[1],r=n.subarray(2,t+2);if(!t||r.length!==t)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:eY(r),l:n.subarray(t+2)}},toSig(n){const{Err:e}=dl,t=typeof n=="string"?tY(n):n;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let r=t.length;if(r<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=dl._parseInt(t.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(n){const e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,t=c=>{const u=c.toString(16);return u.length&1?`0${u}`:u},r=e(t(n.s)),s=e(t(n.r)),i=r.length/2,o=s.length/2,a=t(i),l=t(o);return`30${t(o+i+4)}02${l}${s}02${a}${r}`}},Pi=BigInt(0),Kr=BigInt(1);BigInt(2);const vD=BigInt(3);BigInt(4);function nY(n){const e=Zq(n),{Fp:t}=e,r=e.toBytes||((p,m,y)=>{const b=m.toAffine();return nh(Uint8Array.from([4]),t.toBytes(b.x),t.toBytes(b.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),y=t.fromBytes(m.subarray(0,t.BYTES)),b=t.fromBytes(m.subarray(t.BYTES,2*t.BYTES));return{x:y,y:b}});function i(p){const{a:m,b:y}=e,b=t.sqr(p),v=t.mul(b,p);return t.add(t.add(v,t.mul(p,m)),y)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&Pi<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:y,wrapPrivateKey:b,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=cu(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(y*2,"0")}let A;try{A=typeof p=="bigint"?p:ul(bs("private key",p,y))}catch{throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof p}`)}return b&&(A=or(A,v)),a(A),A}const c=new Map;function u(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,y,b){if(this.px=m,this.py=y,this.pz=b,m==null||!t.isValid(m))throw new Error("x required");if(y==null||!t.isValid(y))throw new Error("y required");if(b==null||!t.isValid(b))throw new Error("z required")}static fromAffine(m){const{x:y,y:b}=m||{};if(!m||!t.isValid(y)||!t.isValid(b))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=A=>t.eql(A,t.ZERO);return v(y)&&v(b)?f.ZERO:new f(y,b,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const y=t.invertBatch(m.map(b=>b.pz));return m.map((b,v)=>b.toAffine(y[v])).map(f.fromAffine)}static fromHex(m){const y=f.fromAffine(s(bs("pointHex",m)));return y.assertValidity(),y}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y}=this.toAffine();if(!t.isValid(m)||!t.isValid(y))throw new Error("bad point: x or y not FE");const b=t.sqr(y),v=i(m);if(!t.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(t.isOdd)return!t.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m,C=t.eql(t.mul(y,x),t.mul(A,v)),S=t.eql(t.mul(b,x),t.mul(w,v));return C&&S}negate(){return new f(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:y}=e,b=t.mul(y,vD),{px:v,py:A,pz:w}=this;let x=t.ZERO,C=t.ZERO,S=t.ZERO,M=t.mul(v,v),R=t.mul(A,A),O=t.mul(w,w),D=t.mul(v,A);return D=t.add(D,D),S=t.mul(v,w),S=t.add(S,S),x=t.mul(m,S),C=t.mul(b,O),C=t.add(x,C),x=t.sub(R,C),C=t.add(R,C),C=t.mul(x,C),x=t.mul(D,x),S=t.mul(b,S),O=t.mul(m,O),D=t.sub(M,O),D=t.mul(m,D),D=t.add(D,S),S=t.add(M,M),M=t.add(S,M),M=t.add(M,O),M=t.mul(M,D),C=t.add(C,M),O=t.mul(A,w),O=t.add(O,O),M=t.mul(O,D),x=t.sub(x,M),S=t.mul(O,R),S=t.add(S,S),S=t.add(S,S),new f(x,C,S)}add(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m;let C=t.ZERO,S=t.ZERO,M=t.ZERO;const R=e.a,O=t.mul(e.b,vD);let D=t.mul(y,A),_=t.mul(b,w),F=t.mul(v,x),G=t.add(y,b),B=t.add(A,w);G=t.mul(G,B),B=t.add(D,_),G=t.sub(G,B),B=t.add(y,v);let V=t.add(A,x);return B=t.mul(B,V),V=t.add(D,F),B=t.sub(B,V),V=t.add(b,v),C=t.add(w,x),V=t.mul(V,C),C=t.add(_,F),V=t.sub(V,C),M=t.mul(R,B),C=t.mul(O,F),M=t.add(C,M),C=t.sub(_,M),M=t.add(_,M),S=t.mul(C,M),_=t.add(D,D),_=t.add(_,D),F=t.mul(R,F),B=t.mul(O,B),_=t.add(_,F),F=t.sub(D,F),F=t.mul(R,F),B=t.add(B,F),D=t.mul(_,B),S=t.add(S,D),D=t.mul(V,B),C=t.mul(G,C),C=t.sub(C,D),D=t.mul(G,_),M=t.mul(V,M),M=t.add(M,D),new f(C,S,M)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,c,m,y=>{const b=t.invertBatch(y.map(v=>v.pz));return y.map((v,A)=>v.toAffine(b[A])).map(f.fromAffine)})}multiplyUnsafe(m){const y=f.ZERO;if(m===Pi)return y;if(a(m),m===Kr)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),C=y,S=y,M=this;for(;A>Pi||x>Pi;)A&Kr&&(C=C.add(M)),x&Kr&&(S=S.add(M)),M=M.double(),A>>=Kr,x>>=Kr;return v&&(C=C.negate()),w&&(S=S.negate()),S=new f(t.mul(S.px,b.beta),S.py,S.pz),C.add(S)}multiply(m){a(m);let y=m,b,v;const{endo:A}=e;if(A){const{k1neg:w,k1:x,k2neg:C,k2:S}=A.splitScalar(y);let{p:M,f:R}=this.wNAF(x),{p:O,f:D}=this.wNAF(S);M=h.constTimeNegate(w,M),O=h.constTimeNegate(C,O),O=new f(t.mul(O.px,A.beta),O.py,O.pz),b=M.add(O),v=R.add(D)}else{const{p:w,f:x}=this.wNAF(y);b=w,v=x}return f.normalizeZ([b,v])[0]}multiplyAndAddUnsafe(m,y,b){const v=f.BASE,A=(x,C)=>C===Pi||C===Kr||!x.equals(v)?x.multiplyUnsafe(C):x.multiply(C),w=A(this,y).add(A(m,b));return w.is0()?void 0:w}toAffine(m){const{px:y,py:b,pz:v}=this,A=this.is0();m==null&&(m=A?t.ONE:t.inv(v));const w=t.mul(y,m),x=t.mul(b,m),C=t.mul(v,m);if(A)return{x:t.ZERO,y:t.ZERO};if(!t.eql(C,t.ONE))throw new Error("invZ was invalid");return{x:w,y:x}}isTorsionFree(){const{h:m,isTorsionFree:y}=e;if(m===Kr)return!0;if(y)return y(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:y}=e;return m===Kr?this:y?y(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return cu(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,t.ONE),f.ZERO=new f(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,h=Xq(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function rY(n){const e=AD(n);return rh(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function sY(n){const e=rY(n),{Fp:t,n:r}=e,s=t.BYTES+1,i=2*t.BYTES+1;function o(B){return Pi<B&&B<t.ORDER}function a(B){return or(B,r)}function l(B){return w1(B,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:f,isWithinCurveOrder:d}=nY({...e,toBytes(B,V,Q){const ee=V.toAffine(),Z=t.toBytes(ee.x),he=nh;return Q?he(Uint8Array.from([V.hasEvenY()?2:3]),Z):he(Uint8Array.from([4]),Z,t.toBytes(ee.y))},fromBytes(B){const V=B.length,Q=B[0],ee=B.subarray(1);if(V===s&&(Q===2||Q===3)){const Z=ul(ee);if(!o(Z))throw new Error("Point is not on curve");const he=f(Z);let ke=t.sqrt(he);const Se=(ke&Kr)===Kr;return(Q&1)===1!==Se&&(ke=t.neg(ke)),{x:Z,y:ke}}else if(V===i&&Q===4){const Z=t.fromBytes(ee.subarray(0,t.BYTES)),he=t.fromBytes(ee.subarray(t.BYTES,2*t.BYTES));return{x:Z,y:he}}else throw new Error(`Point of length ${V} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=B=>cu(fu(B,e.nByteLength));function p(B){const V=r>>Kr;return B>V}function m(B){return p(B)?a(-B):B}const y=(B,V,Q)=>ul(B.slice(V,Q));class b{constructor(V,Q,ee){this.r=V,this.s=Q,this.recovery=ee,this.assertValidity()}static fromCompact(V){const Q=e.nByteLength;return V=bs("compactSignature",V,Q*2),new b(y(V,0,Q),y(V,Q,2*Q))}static fromDER(V){const{r:Q,s:ee}=dl.toSig(bs("DER",V));return new b(Q,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(V){return new b(this.r,this.s,V)}recoverPublicKey(V){const{r:Q,s:ee,recovery:Z}=this,he=S(bs("msgHash",V));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const ke=Z===2||Z===3?Q+e.n:Q;if(ke>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const Se=Z&1?"03":"02",Ee=c.fromHex(Se+h(ke)),be=l(ke),Fe=a(-he*be),je=a(ee*be),ze=c.BASE.multiplyAndAddUnsafe(Ee,Fe,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 uu(this.toDERHex())}toDERHex(){return dl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return uu(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(B){try{return u(B),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const B=wD(e.n);return qq(e.randomBytes(B),e.n)},precompute(B=8,V=c.BASE){return V._setWindowSize(B),V.multiply(BigInt(3)),V}};function A(B,V=!0){return c.fromPrivateKey(B).toRawBytes(V)}function w(B){const V=B instanceof Uint8Array,Q=typeof B=="string",ee=(V||Q)&&B.length;return V?ee===s||ee===i:Q?ee===2*s||ee===2*i:B instanceof c}function x(B,V,Q=!0){if(w(B))throw new Error("first arg must be private key");if(!w(V))throw new Error("second arg must be public key");return c.fromHex(V).multiply(u(B)).toRawBytes(Q)}const C=e.bits2int||function(B){const V=ul(B),Q=B.length*8-e.nBitLength;return Q>0?V>>BigInt(Q):V},S=e.bits2int_modN||function(B){return a(C(B))},M=g1(e.nBitLength);function R(B){if(typeof B!="bigint")throw new Error("bigint expected");if(!(Pi<=B&&B<M))throw new Error(`bigint expected < 2^${e.nBitLength}`);return fu(B,e.nByteLength)}function O(B,V,Q=D){if(["recovered","canonical"].some(et=>et in Q))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:Z}=e;let{lowS:he,prehash:ke,extraEntropy:Se}=Q;he==null&&(he=!0),B=bs("msgHash",B),ke&&(B=bs("prehashed msgHash",ee(B)));const Ee=S(B),be=u(V),Fe=[R(be),R(Ee)];if(Se!=null){const et=Se===!0?Z(t.BYTES):Se;Fe.push(bs("extraEntropy",et))}const je=nh(...Fe),ze=Ee;function Be(et){const le=C(et);if(!d(le))return;const $e=l(le),ae=c.BASE.multiply(le).toAffine(),we=a(ae.x);if(we===Pi)return;const _e=a($e*a(ze+we*be));if(_e===Pi)return;let z=(ae.x===we?0:2)|Number(ae.y&Kr),J=_e;return he&&p(_e)&&(J=m(_e),z^=1),new b(we,J,z)}return{seed:je,k2sig:Be}}const D={lowS:e.lowS,prehash:!1},_={lowS:e.lowS,prehash:!1};function F(B,V,Q=D){const{seed:ee,k2sig:Z}=O(B,V,Q),he=e;return pD(he.hash.outputLen,he.nByteLength,he.hmac)(ee,Z)}c.BASE._setWindowSize(8);function G(B,V,Q,ee=_){var ae;const Z=B;if(V=bs("msgHash",V),Q=bs("publicKey",Q),"strict"in ee)throw new Error("options.strict was renamed to lowS");const{lowS:he,prehash:ke}=ee;let Se,Ee;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:_e}=Z;Se=new b(we,_e)}else throw new Error("PARSE");Ee=c.fromHex(Q)}catch(we){if(we.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(he&&Se.hasHighS())return!1;ke&&(V=e.hash(V));const{r:be,s:Fe}=Se,je=S(V),ze=l(Fe),Be=a(je*ze),et=a(be*ze),le=(ae=c.BASE.multiplyAndAddUnsafe(Ee,Be,et))==null?void 0:ae.toAffine();return le?a(le.x)===be:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:x,sign:F,verify:G,ProjectivePoint:c,Signature:b,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function iY(n){return{hash:n,hmac:(e,...t)=>$P(n,e,ZJ(...t)),randomBytes:eq}}function oY(n,e){const t=r=>sY({...n,...iY(r)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xD=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ED=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),aY=BigInt(1),v1=BigInt(2),CD=(n,e)=>(n+e/v1)/e;function lY(n){const e=xD,t=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=n*n*n%e,u=c*c*n%e,f=Wr(u,t,e)*u%e,d=Wr(f,t,e)*u%e,h=Wr(d,v1,e)*c%e,p=Wr(h,s,e)*h%e,m=Wr(p,i,e)*p%e,y=Wr(m,a,e)*m%e,b=Wr(y,l,e)*y%e,v=Wr(b,a,e)*m%e,A=Wr(v,t,e)*u%e,w=Wr(A,o,e)*p%e,x=Wr(w,r,e)*c%e,C=Wr(x,v1,e);if(!x1.eql(x1.sqr(C),n))throw new Error("Cannot find square root");return C}const x1=Jq(xD,void 0,void 0,{sqrt:lY}),zo=oY({a:BigInt(0),b:BigInt(7),Fp:x1,n:ED,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=ED,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-aY*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,o=BigInt("0x100000000000000000000000000000000"),a=CD(i*n,e),l=CD(-r*n,e);let c=or(n-a*t-l*s,e),u=or(-a*r-l*i,e);const f=c>o,d=u>o;if(f&&(c=e-c),d&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:f,k1:c,k2neg:d,k2:u}}}},WP);BigInt(0),zo.ProjectivePoint;const sh="0x0000000000000000000000000000000000000000",kD="0x0000000000000000000000000000000000000000000000000000000000000000",SD=BigInt(0),TD=BigInt(1),OD=BigInt(2),ND=BigInt(27),MD=BigInt(28),ly=BigInt(35),du={};function RD(n){return ol(Hn(n),32)}const Cs=class Cs{constructor(e,t,r,s){q(this,Vu);q(this,Hu);q(this,zu);q(this,Fl);qg(e,du,"Signature"),L(this,Vu,t),L(this,Hu,r),L(this,zu,s),L(this,Fl,null)}get r(){return T(this,Vu)}set r(e){$(ru(e)===32,"invalid r","value",e),L(this,Vu,Ae(e))}get s(){return T(this,Hu)}set s(e){$(ru(e)===32,"invalid s","value",e);const t=Ae(e);$(parseInt(t.substring(0,3))<8,"non-canonical s","value",t),L(this,Hu,t)}get v(){return T(this,zu)}set v(e){const t=Je(e,"value");$(t===27||t===28,"invalid v","v",e),L(this,zu,t)}get networkV(){return T(this,Fl)}get legacyChainId(){const e=this.networkV;return e==null?null:Cs.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 zt([this.r,this.yParityAndS])}get serialized(){return zt([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 Cs(du,this.r,this.s,this.v);return this.networkV&&L(e,Fl,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 t=Ce(e,"v");return t==ND||t==MD?SD:($(t>=ly,"invalid EIP-155 v","v",e),(t-ly)/OD)}static getChainIdV(e,t){return Ce(e)*OD+BigInt(35+t-27)}static getNormalizedV(e){const t=Ce(e);return t===SD||t===ND?27:t===TD||t===MD?28:($(t>=ly,"invalid v","v",e),t&TD?27:28)}static from(e){function t(c,u){$(c,u,"signature",e)}if(e==null)return new Cs(du,kD,kD,27);if(typeof e=="string"){const c=ct(e,"signature");if(c.length===64){const u=Ae(c.slice(0,32)),f=c.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Cs(du,u,Ae(f),d)}if(c.length===65){const u=Ae(c.slice(0,32)),f=c.slice(32,64);t((f[0]&128)===0,"non-canonical s");const d=Cs.getNormalizedV(c[64]);return new Cs(du,u,Ae(f),d)}t(!1,"invalid raw signature length")}if(e instanceof Cs)return e.clone();const r=e.r;t(r!=null,"missing r");const s=RD(r),i=function(c,u){if(c!=null)return RD(c);if(u!=null){t(Ct(u,32),"invalid yParityAndS");const f=ct(u);return f[0]&=127,Ae(f)}t(!1,"missing s")}(e.s,e.yParityAndS);t((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(c,u,f){if(c!=null){const d=Ce(c);return{networkV:d>=ly?d:void 0,v:Cs.getNormalizedV(d)}}if(u!=null)return t(Ct(u,32),"invalid yParityAndS"),{v:ct(u)[0]&128?28:27};if(f!=null){switch(Je(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Cs(du,s,i,a);return o&&L(l,Fl,o),t(e.yParity==null||Je(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};Vu=new WeakMap,Hu=new WeakMap,zu=new WeakMap,Fl=new WeakMap;let ws=Cs;const jl=class jl{constructor(e){q(this,Ji);$(ru(e)===32,"invalid private key","privateKey","[REDACTED]"),L(this,Ji,Ae(e))}get privateKey(){return T(this,Ji)}get publicKey(){return jl.computePublicKey(T(this,Ji))}get compressedPublicKey(){return jl.computePublicKey(T(this,Ji),!0)}sign(e){$(ru(e)===32,"invalid digest length","digest",e);const t=zo.sign(Vn(e),Vn(T(this,Ji)),{lowS:!0});return ws.from({r:_o(t.r,32),s:_o(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=jl.computePublicKey(e);return Ae(zo.getSharedSecret(Vn(T(this,Ji)),ct(t),!1))}static computePublicKey(e,t){let r=ct(e,"key");if(r.length===32){const i=zo.getPublicKey(r,!!t);return Ae(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=zo.ProjectivePoint.fromHex(r);return Ae(s.toRawBytes(t))}static recoverPublicKey(e,t){$(ru(e)===32,"invalid digest length","digest",e);const r=ws.from(t);let s=zo.Signature.fromCompact(Vn(zt([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Vn(e));return $(i!=null,"invalid signautre for digest","signature",t),"0x"+i.toHex(!1)}static addPoints(e,t,r){const s=zo.ProjectivePoint.fromHex(jl.computePublicKey(e).substring(2)),i=zo.ProjectivePoint.fromHex(jl.computePublicKey(t).substring(2));return"0x"+s.add(i).toHex(!!r)}};Ji=new WeakMap;let ih=jl;const cY=BigInt(0),uY=BigInt(36);function PD(n){n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const r=ct(Xt(t));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 E1={};for(let n=0;n<10;n++)E1[String(n)]=String(n);for(let n=0;n<26;n++)E1[String.fromCharCode(65+n)]=String(10+n);const DD=15;function fY(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>E1[r]).join("");for(;e.length>=DD;){let r=e.substring(0,DD);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const dY=function(){const n={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];n[t]=BigInt(e)}return n}();function hY(n){n=n.toLowerCase();let e=cY;for(let t=0;t<n.length;t++)e=e*uY+dY[n[t]];return e}function pt(n){if($(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);const e=PD(n);return $(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===n,"bad address checksum","address",n),e}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){$(n.substring(2,4)===fY(n),"bad icap checksum","address",n);let e=hY(n.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return PD("0x"+e)}$(!1,"invalid address","address",n)}function pY(n){const e=pt(n.from);let r=Ce(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,pt(Vt(Xt(ll([e,r])),12))}function ID(n){return n&&typeof n.getAddress=="function"}function mY(n){try{return pt(n),!0}catch{}return!1}async function C1(n,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(te(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),$(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),pt(t)}function Gn(n,e){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?pt(n):(te(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),C1(n,e.resolveName(n)));if(ID(n))return C1(n,n.getAddress());if(n&&typeof n.then=="function")return C1(n,n);$(!1,"unsupported addressable value","target",n)}const Di={};function ve(n,e){let t=!1;return e<0&&(t=!0,e*=-1),new Nn(Di,`${t?"":"u"}int${e}`,n,{signed:t,width:e})}function ft(n,e){return new Nn(Di,`bytes${e||""}`,n,{size:e})}const LD=Symbol.for("_ethers_typed"),qi=class qi{constructor(e,t,r,s){W(this,"type");W(this,"value");q(this,Ul);W(this,"_typedSymbol");s==null&&(s=null),qg(Di,e,"Typed"),Me(this,{_typedSymbol:LD,type:t,value:r}),L(this,Ul,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,Ul)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,Ul)===!0?-1:T(this,Ul)===!1?this.value.length:null}static from(e,t){return new qi(Di,e,t)}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 ft(e,1)}static bytes2(e){return ft(e,2)}static bytes3(e){return ft(e,3)}static bytes4(e){return ft(e,4)}static bytes5(e){return ft(e,5)}static bytes6(e){return ft(e,6)}static bytes7(e){return ft(e,7)}static bytes8(e){return ft(e,8)}static bytes9(e){return ft(e,9)}static bytes10(e){return ft(e,10)}static bytes11(e){return ft(e,11)}static bytes12(e){return ft(e,12)}static bytes13(e){return ft(e,13)}static bytes14(e){return ft(e,14)}static bytes15(e){return ft(e,15)}static bytes16(e){return ft(e,16)}static bytes17(e){return ft(e,17)}static bytes18(e){return ft(e,18)}static bytes19(e){return ft(e,19)}static bytes20(e){return ft(e,20)}static bytes21(e){return ft(e,21)}static bytes22(e){return ft(e,22)}static bytes23(e){return ft(e,23)}static bytes24(e){return ft(e,24)}static bytes25(e){return ft(e,25)}static bytes26(e){return ft(e,26)}static bytes27(e){return ft(e,27)}static bytes28(e){return ft(e,28)}static bytes29(e){return ft(e,29)}static bytes30(e){return ft(e,30)}static bytes31(e){return ft(e,31)}static bytes32(e){return ft(e,32)}static address(e){return new qi(Di,"address",e)}static bool(e){return new qi(Di,"bool",!!e)}static bytes(e){return new qi(Di,"bytes",e)}static string(e){return new qi(Di,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new qi(Di,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===LD}static dereference(e,t){if(qi.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}};Ul=new WeakMap;let Nn=qi;class gY extends Ri{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let r=Nn.dereference(t,"string");try{r=pt(r)}catch(s){return this._throwError(s.message,t)}return e.writeValue(r)}decode(e){return pt(_o(e.readValue(),20))}}class yY extends Ri{constructor(t){super(t.name,t.type,"_",t.dynamic);W(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,r){return this.coder.encode(t,r)}decode(t){return this.coder.decode(t)}}function BD(n,e,t){let r=[];if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const u=c.localName;return te(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),te(!l[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),l[u]=!0,t[u]})}else $(!1,"invalid tuple value","tuple",t);$(e.length===r.length,"types/value length mismatch","tuple",t);let s=new s1,i=new s1,o=[];e.forEach((l,c)=>{let u=r[c];if(l.dynamic){let f=i.length;l.encode(i,u);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,u)}),o.forEach(l=>{l(s.length)});let a=n.appendWriter(s);return a+=n.appendWriter(i),a}function _D(n,e){let t=[],r=[],s=n.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=n.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(c){if(dn(c,"BUFFER_OVERRUN"))throw c;o=c,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(n)}catch(a){if(dn(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");t.push(o),r.push(i.localName||null)}),ou.fromItems(t,r)}class bY extends Ri{constructor(t,r,s){const i=t.type+"["+(r>=0?r:"")+"]",o=r===-1||t.dynamic;super("array",i,s,o);W(this,"coder");W(this,"length");Me(this,{coder:t,length:r})}defaultValue(){const t=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(t);return r}encode(t,r){const s=Nn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,t.writeValue(s.length)),gP(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return BD(t,o,s)}decode(t){let r=this.length;r===-1&&(r=t.readIndex(),te(r*$n<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:r*$n,length:t.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new yY(this.coder));return _D(t,s)}}class wY extends Ri{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const r=Nn.dereference(t,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class FD extends Ri{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Vn(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class AY extends FD{constructor(e){super("bytes",e)}decode(e){return Ae(super.decode(e))}}class vY extends Ri{constructor(t,r){let s="bytes"+String(t);super(s,s,r,!1);W(this,"size");Me(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,r){let s=Vn(Nn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(s)}decode(t){return Ae(t.readBytes(this.size))}}const xY=new Uint8Array([]);class EY extends Ri{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(xY)}decode(e){return e.readBytes(0),null}}const CY=BigInt(0),kY=BigInt(1),SY=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class TY extends Ri{constructor(t,r,s){const i=(r?"int":"uint")+t*8;super(i,i,s,!1);W(this,"size");W(this,"signed");Me(this,{size:t,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,r){let s=Ce(Nn.dereference(r,this.type)),i=Zd(SY,$n*8);if(this.signed){let o=Zd(i,this.size*8-1);(s>o||s<-(o+kY))&&this._throwError("value out-of-bounds",r),s=AP(s,8*$n)}else(s<CY||s>Zd(i,this.size*8))&&this._throwError("value out-of-bounds",r);return t.writeValue(s)}decode(t){let r=Zd(t.readValue(),this.size*8);return this.signed&&(r=RJ(r,this.size*8)),r}}class OY extends FD{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Mi(Nn.dereference(t,"string")))}decode(e){return iu(super.decode(e))}}class cy extends Ri{constructor(t,r){let s=!1;const i=[];t.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);W(this,"coders");Me(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(s=>{t.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"),t[o]==null&&(t[o]=t[i]))}),Object.freeze(t)}encode(t,r){const s=Nn.dereference(r,"tuple");return BD(t,this.coders,s)}decode(t){return _D(t,this.coders)}}function hl(n){return Xt(Mi(n))}var NY="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";const jD=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),UD=4;function MY(n){let e=0;function t(){return n[e++]<<8|n[e++]}let r=t(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=t());let o=t(),a=e;e+=o;let l=0,c=0;function u(){return l==0&&(c=c<<8|n[e++],l=8),c>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let y=0;for(let x=0;x<f;x++)y=y<<1|u();let b=[],v=0,A=d;for(;;){let x=Math.floor(((y-v+1)*s-1)/A),C=0,S=r;for(;S-C>1;){let O=C+S>>>1;x<i[O]?S=O:C=O}if(C==0)break;b.push(C);let M=v+Math.floor(A*i[C]/s),R=v+Math.floor(A*i[C+1]/s)-1;for(;!((M^R)&h);)y=y<<1&m|u(),M=M<<1&m,R=R<<1&m|1;for(;M&~R&p;)y=y&h|y<<1&m>>>1|u(),M=M<<1^h,R=(R^h)<<1|h|1;v=M,A=1+R-M}let w=r-4;return b.map(x=>{switch(x-w){case 3:return w+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return w+256+(n[a++]<<8|n[a++]);case 1:return w+n[a++];default:return x-1}})}function RY(n){let e=0;return()=>n[e++]}function VD(n){return RY(MY(PY(n)))}function PY(n){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let t=n.length,r=new Uint8Array(6*t>>3);for(let s=0,i=0,o=0,a=0;s<t;s++)a=a<<6|e[n.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function DY(n){return n&1?~n>>1:n>>1}function IY(n,e){let t=Array(n);for(let r=0,s=0;r<n;r++)t[r]=s+=DY(e());return t}function oh(n,e=0){let t=[];for(;;){let r=n(),s=n();if(!s)break;e+=r;for(let i=0;i<s;i++)t.push(e+i);e+=s+1}return t}function HD(n){return ah(()=>{let e=oh(n);if(e.length)return e})}function zD(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(LY(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(BY(t,n))}return e.flat()}function ah(n){let e=[];for(;;){let t=n(e.length);if(!t)break;e.push(t)}return e}function $D(n,e,t){let r=Array(n).fill().map(()=>[]);for(let s=0;s<e;s++)IY(n,t).forEach((i,o)=>r[o].push(i));return r}function LY(n,e){let t=1+e(),r=e(),s=ah(e);return $D(s.length,1+n,e).flatMap((o,a)=>{let[l,...c]=o;return Array(s[a]).fill().map((u,f)=>{let d=f*r;return[l+f*t,c.map(h=>h+d)]})})}function BY(n,e){let t=1+e();return $D(t,1+n,e).map(s=>[s[0],s.slice(1)])}function _Y(n){let e=[],t=oh(n);return s(r([]),[]),e;function r(i){let o=n(),a=ah(()=>{let l=oh(n).map(c=>t[c]);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 c of o)for(let u of c.Q)s(c,[...a,u],l)}}}function FY(n){return n.toString(16).toUpperCase().padStart(2,"0")}function GD(n){return`{${FY(n)}}`}function jY(n){let e=[];for(let t=0,r=n.length;t<r;){let s=n.codePointAt(t);t+=s<65536?1:2,e.push(s)}return e}function hu(n){let t=n.length;if(t<4096)return String.fromCodePoint(...n);let r=[];for(let s=0;s<t;)r.push(String.fromCodePoint(...n.slice(s,s+=4096)));return r.join("")}function UY(n,e){let t=n.length,r=t-e.length;for(let s=0;r==0&&s<t;s++)r=n[s]-e[s];return r}var VY="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";const lh=44032,uy=4352,fy=4449,dy=4519,WD=19,KD=21,pu=28,hy=KD*pu,HY=WD*hy,zY=lh+HY,$Y=uy+WD,GY=fy+KD,WY=dy+pu;function ch(n){return n>>24&255}function QD(n){return n&16777215}let k1,JD,S1,py;function KY(){let n=VD(VY);k1=new Map(HD(n).flatMap((e,t)=>e.map(r=>[r,t+1<<24]))),JD=new Set(oh(n)),S1=new Map,py=new Map;for(let[e,t]of zD(n)){if(!JD.has(e)&&t.length==2){let[r,s]=t,i=py.get(r);i||(i=new Map,py.set(r,i)),i.set(s,e)}S1.set(e,t.reverse())}}function qD(n){return n>=lh&&n<zY}function QY(n,e){if(n>=uy&&n<$Y&&e>=fy&&e<GY)return lh+(n-uy)*hy+(e-fy)*pu;if(qD(n)&&e>dy&&e<WY&&(n-lh)%pu==0)return n+(e-dy);{let t=py.get(n);return t&&(t=t.get(e),t)?t:-1}}function YD(n){k1||KY();let e=[],t=[],r=!1;function s(i){let o=k1.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of n)for(;;){if(i<128)e.push(i);else if(qD(i)){let o=i-lh,a=o/hy|0,l=o%hy/pu|0,c=o%pu;s(uy+a),s(fy+l),c>0&&s(dy+c)}else{let o=S1.get(i);o?t.push(...o):s(i)}if(!t.length)break;i=t.pop()}if(r&&e.length>1){let i=ch(e[0]);for(let o=1;o<e.length;o++){let a=ch(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let c=e[l+1];if(e[l+1]=e[l],e[l]=c,!l||(i=ch(e[--l]),i<=a))break}i=ch(e[o])}}return e}function JY(n){let e=[],t=[],r=-1,s=0;for(let i of n){let o=ch(i),a=QD(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...t),t.length=0,r=a):t.push(a),s=o;else{let l=QY(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(t.push(a),s=o)}}return r>=0&&e.push(r,...t),e}function XD(n){return YD(n).map(QD)}function qY(n){return JY(YD(n))}const ZD=45,eI=".",tI=65039,nI=1,my=n=>Array.from(n);function uh(n,e){return n.P.has(e)||n.Q.has(e)}class YY extends Array{get is_emoji(){return!0}}let T1,rI,pl,O1,sI,mu,N1,gu,ml,iI,M1;function R1(){if(T1)return;let n=VD(NY);const e=()=>oh(n),t=()=>new Set(e()),r=(u,f)=>f.forEach(d=>u.add(d));T1=new Map(zD(n)),rI=t(),pl=e(),O1=new Set(e().map(u=>pl[u])),pl=new Set(pl),sI=t(),t();let s=HD(n),i=n();const o=()=>{let u=new Set;return e().forEach(f=>r(u,s[f])),r(u,e()),u};mu=ah(u=>{let f=ah(n).map(d=>d+96);if(f.length){let d=u>=i;f[0]-=32,f=hu(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!n();return{N:f,P:h,Q:p,M:m,R:d}}}),N1=t(),gu=new Map;let a=e().concat(my(N1)).sort((u,f)=>u-f);a.forEach((u,f)=>{let d=n(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(u),N1.has(u)||gu.set(u,h)});for(let{V:u,M:f}of new Set(gu.values())){let d=[];for(let p of u){let m=mu.filter(b=>uh(b,p)),y=d.find(({G:b})=>m.some(v=>b.has(v)));y||(y={G:new Set,V:[]},d.push(y)),y.V.push(p),r(y.G,m)}let h=d.flatMap(p=>my(p.G));for(let{G:p,V:m}of d){let y=new Set(h.filter(b=>!p.has(b)));for(let b of m)f.set(b,y)}}ml=new Set;let l=new Set;const c=u=>ml.has(u)?l.add(u):ml.add(u);for(let u of mu){for(let f of u.P)c(f);for(let f of u.Q)c(f)}for(let u of ml)!gu.has(u)&&!l.has(u)&&gu.set(u,nI);r(ml,XD(ml)),iI=_Y(n).map(u=>YY.from(u)).sort(UY),M1=new Map;for(let u of iI){let f=[M1];for(let d of u){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===tI?f.push(...h):f=h}for(let d of f)d.V=u}}function P1(n){return(oI(n)?"":`${D1(gy([n]))} `)+GD(n)}function D1(n){return`"${n}"`}function XY(n){if(n.length>=4&&n[2]==ZD&&n[3]==ZD)throw new Error(`invalid label extension: "${hu(n.slice(0,4))}"`)}function ZY(n){for(let t=n.lastIndexOf(95);t>0;)if(n[--t]!==95)throw new Error("underscore allowed only at start")}function eX(n){let e=n[0],t=jD.get(e);if(t)throw fh(`leading ${t}`);let r=n.length,s=-1;for(let i=1;i<r;i++){e=n[i];let o=jD.get(e);if(o){if(s==i)throw fh(`${t} + ${o}`);s=i+1,t=o}}if(s==r)throw fh(`trailing ${t}`)}function gy(n,e=1/0,t=GD){let r=[];tX(n[0])&&r.push("◌"),n.length>e&&(e>>=1,n=[...n.slice(0,e),8230,...n.slice(-e)]);let s=0,i=n.length;for(let o=0;o<i;o++){let a=n[o];oI(a)&&(r.push(hu(n.slice(s,o))),r.push(t(a)),s=o+1)}return r.push(hu(n.slice(s,i))),r.join("")}function tX(n){return R1(),pl.has(n)}function oI(n){return R1(),sI.has(n)}function nX(n){return oX(rX(n,qY,cX))}function rX(n,e,t){if(!n)return[];R1();let r=0;return n.split(eI).map(s=>{let i=jY(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=lX(i,e,t),l=a.length,c;if(!l)throw new Error("empty label");let u=o.output=a.flat();if(ZY(u),!(o.emoji=l>1||a[0].is_emoji)&&u.every(d=>d<128))XY(u),c="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)c="Emoji";else{if(pl.has(u[0]))throw fh("leading combining mark");for(let m=1;m<l;m++){let y=a[m];if(!y.is_emoji&&pl.has(y[0]))throw fh(`emoji + combining mark: "${hu(a[m-1])} + ${gy([y[0]])}"`)}eX(u);let h=my(new Set(d)),[p]=iX(h);aX(p,d),sX(p,h),c=p.N}}o.type=c}catch(a){o.error=a}return o})}function sX(n,e){let t,r=[];for(let s of e){let i=gu.get(s);if(i===nI)return;if(i){let o=i.M.get(s);if(t=t?t.filter(a=>o.has(a)):my(o),!t.length)return}else r.push(s)}if(t){for(let s of t)if(r.every(i=>uh(s,i)))throw new Error(`whole-script confusable: ${n.N}/${s.N}`)}}function iX(n){let e=mu;for(let t of n){let r=e.filter(s=>uh(s,t));if(!r.length)throw mu.some(s=>uh(s,t))?lI(e[0],t):aI(t);if(e=r,r.length==1)break}return e}function oX(n){return n.map(({input:e,error:t,output:r})=>{if(t){let s=t.message;throw new Error(n.length==1?s:`Invalid label ${D1(gy(e,63))}: ${s}`)}return hu(r)}).join(eI)}function aI(n){return new Error(`disallowed character: ${P1(n)}`)}function lI(n,e){let t=P1(e),r=mu.find(s=>s.P.has(e));return r&&(t=`${r.N} ${t}`),new Error(`illegal mixture: ${n.N} + ${t}`)}function fh(n){return new Error(`illegal placement: ${n}`)}function aX(n,e){for(let t of e)if(!uh(n,t))throw lI(n,t);if(n.M){let t=XD(e);for(let r=1,s=t.length;r<s;r++)if(O1.has(t[r])){let i=r+1;for(let o;i<s&&O1.has(o=t[i]);i++)for(let a=r;a<i;a++)if(t[a]==o)throw new Error(`duplicate non-spacing marks: ${P1(o)}`);if(i-r>UD)throw new Error(`excessive non-spacing marks: ${D1(gy(t.slice(r-1,i)))} (${i-r}/${UD})`);r=i}}}function lX(n,e,t){let r=[],s=[];for(n=n.slice().reverse();n.length;){let i=uX(n);if(i)s.length&&(r.push(e(s)),s=[]),r.push(t(i));else{let o=n.pop();if(ml.has(o))s.push(o);else{let a=T1.get(o);if(a)s.push(...a);else if(!rI.has(o))throw aI(o)}}}return s.length&&r.push(e(s)),r}function cX(n){return n.filter(e=>e!=tI)}function uX(n,e){let t=M1,r,s=n.length;for(;s&&(t=t.get(n[--s]),!!t);){let{V:i}=t;i&&(r=i,n.length=s)}return r}const cI=new Uint8Array(32);cI.fill(0);function uI(n){return $(n.length!==0,"invalid ENS name; empty component","comp",n),n}function fI(n){const e=Mi(fX(n)),t=[];if(n.length===0)return t;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(uI(e.slice(r,s))),r=s+1);return $(r<e.length,"invalid ENS name; empty component","name",n),t.push(uI(e.slice(r))),t}function fX(n){try{if(n.length===0)throw new Error("empty label");return nX(n)}catch(e){$(!1,`invalid ENS name (${e.message})`,"name",n)}}function I1(n){$(typeof n=="string","invalid ENS name; not a string","name",n),$(n.length,"invalid ENS name (empty label)","name",n);let e=cI;const t=fI(n);for(;t.length;)e=Xt(zt([e,Xt(t.pop())]));return Ae(e)}function dX(n,e){const t=e;return $(t<=255,"DNS encoded label cannot exceed 255","length",t),Ae(zt(fI(n).map(r=>{$(r.length<=t,`label ${JSON.stringify(n)} exceeds ${t} bytes`,"name",n);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function L1(n,e){return{address:pt(n),storageKeys:e.map((t,r)=>($(Ct(t,32),"invalid slot",`storageKeys[${r}]`,t),t.toLowerCase()))}}function $o(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?($(t.length===2,"invalid slot set",`value[${r}]`,t),L1(t[0],t[1])):($(t!=null&&typeof t=="object","invalid address-slot set","value",n),L1(t.address,t.storageKeys)));$(n!=null&&typeof n=="object","invalid access list","value",n);const e=Object.keys(n).map(t=>{const r=n[t].reduce((s,i)=>(s[i]=!0,s),{});return L1(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function hX(n){let e;return typeof n=="string"?e=ih.computePublicKey(n,!1):e=n.publicKey,pt(Xt("0x"+e.substring(4)).substring(26))}function pX(n,e){return hX(ih.recoverPublicKey(n,e))}const pn=BigInt(0),mX=BigInt(2),gX=BigInt(27),yX=BigInt(28),bX=BigInt(35),wX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),B1=4096*32;function dI(n,e){let t=n.toString(16);for(;t.length<2;)t="0"+t;return t+=lu(e).substring(4),"0x"+t}function yy(n){return n==="0x"?null:pt(n)}function _1(n,e){try{return $o(n)}catch(t){$(!1,t.message,e,n)}}function dh(n,e){return n==="0x"?0:Je(n,e)}function Gt(n,e){if(n==="0x")return pn;const t=Ce(n,e);return $(t<=wX,"value exceeds uint size",e,t),t}function Tt(n,e){const t=Ce(n,"value"),r=Hn(t);return $(r.length<=32,"value too large",`tx.${e}`,t),r}function F1(n){return $o(n).map(e=>[e.address,e.storageKeys])}function AX(n,e){$(Array.isArray(n),`invalid ${e}`,"value",n);for(let t=0;t<n.length;t++)$(Ct(n[t],32),"invalid ${ param } hash",`value[${t}]`,n[t]);return n}function vX(n){const e=ty(n);$(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",n);const t={type:0,nonce:dh(e[0],"nonce"),gasPrice:Gt(e[1],"gasPrice"),gasLimit:Gt(e[2],"gasLimit"),to:yy(e[3]),value:Gt(e[4],"value"),data:Ae(e[5]),chainId:pn};if(e.length===6)return t;const r=Gt(e[6],"v"),s=Gt(e[7],"r"),i=Gt(e[8],"s");if(s===pn&&i===pn)t.chainId=r;else{let o=(r-bX)/mX;o<pn&&(o=pn),t.chainId=o,$(o!==pn||r===gX||r===yX,"non-canonical legacy v","v",e[6]),t.signature=ws.from({r:ol(e[7],32),s:ol(e[8],32),v:r})}return t}function xX(n,e){const t=[Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data];let r=pn;if(n.chainId!=pn)r=Ce(n.chainId,"tx.chainId"),$(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(n.signature){const i=n.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==pn&&(t.push(Hn(r)),t.push("0x"),t.push("0x")),ll(t);let s=BigInt(27+e.yParity);return r!==pn?s=ws.getChainIdV(r,e.v):BigInt(e.v)!==s&&$(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(Hn(s)),t.push(Hn(e.r)),t.push(Hn(e.s)),ll(t)}function j1(n,e){let t;try{if(t=dh(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{$(!1,"invalid yParity","yParity",e[0])}const r=ol(e[1],32),s=ol(e[2],32),i=ws.from({r,s,yParity:t});n.signature=i}function EX(n){const e=ty(ct(n).slice(1));$(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Ae(n));const t={type:2,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:Ae(e[7]),accessList:_1(e[8],"accessList")};return e.length===9||j1(t,e.slice(9)),t}function CX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"yParity")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x02",ll(t)])}function kX(n){const e=ty(ct(n).slice(1));$(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Ae(n));const t={type:1,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),gasPrice:Gt(e[2],"gasPrice"),gasLimit:Gt(e[3],"gasLimit"),to:yy(e[4]),value:Gt(e[5],"value"),data:Ae(e[6]),accessList:_1(e[7],"accessList")};return e.length===8||j1(t,e.slice(8)),t}function SX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"recoveryParam")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x01",ll(t)])}function TX(n){let e=ty(ct(n).slice(1)),t="3",r=null;if(e.length===4&&Array.isArray(e[0])){t="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: ${t}`,"data",Ae(n));const s={type:3,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:Ae(e[7]),accessList:_1(e[8],"accessList"),maxFeePerBlobGas:Gt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),$(s.to!=null,`invalid address for transaction type: ${t}`,"data",n),$(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",n);for(let i=0;i<s.blobVersionedHashes.length;i++)$(Ct(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",n);return e.length===11||j1(s,e.slice(11)),s}function OX(n,e,t){const r=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||sh,Tt(n.value,"value"),n.data,F1(n.accessList||[]),Tt(n.maxFeePerBlobGas||0,"maxFeePerBlobGas"),AX(n.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Tt(e.yParity,"yParity")),r.push(Hn(e.r)),r.push(Hn(e.s)),t)?zt(["0x03",ll([r,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])]):zt(["0x03",ll(r)])}const Xi=class Xi{constructor(){q(this,tf);q(this,ri);q(this,$u);q(this,Gu);q(this,Wu);q(this,Ku);q(this,Qu);q(this,Ju);q(this,qu);q(this,Yu);q(this,Xu);q(this,Zu);q(this,ef);q(this,Vl);q(this,ta);q(this,Yi);q(this,na);L(this,ri,null),L(this,$u,null),L(this,Wu,0),L(this,Ku,pn),L(this,Qu,null),L(this,Ju,null),L(this,qu,null),L(this,Gu,"0x"),L(this,Yu,pn),L(this,Xu,pn),L(this,Zu,null),L(this,ef,null),L(this,Vl,null),L(this,ta,null),L(this,na,null),L(this,Yi,null)}get type(){return T(this,ri)}set type(e){switch(e){case null:L(this,ri,null);break;case 0:case"legacy":L(this,ri,0);break;case 1:case"berlin":case"eip-2930":L(this,ri,1);break;case 2:case"london":case"eip-1559":L(this,ri,2);break;case 3:case"cancun":case"eip-4844":L(this,ri,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,$u);return e==null&&this.type===3?sh:e}set to(e){L(this,$u,e==null?null:pt(e))}get nonce(){return T(this,Wu)}set nonce(e){L(this,Wu,Je(e,"value"))}get gasLimit(){return T(this,Ku)}set gasLimit(e){L(this,Ku,Ce(e))}get gasPrice(){const e=T(this,Qu);return e==null&&(this.type===0||this.type===1)?pn:e}set gasPrice(e){L(this,Qu,e==null?null:Ce(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,Ju);return e??(this.type===2||this.type===3?pn:null)}set maxPriorityFeePerGas(e){L(this,Ju,e==null?null:Ce(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,qu);return e??(this.type===2||this.type===3?pn:null)}set maxFeePerGas(e){L(this,qu,e==null?null:Ce(e,"maxFeePerGas"))}get data(){return T(this,Gu)}set data(e){L(this,Gu,Ae(e))}get value(){return T(this,Yu)}set value(e){L(this,Yu,Ce(e,"value"))}get chainId(){return T(this,Xu)}set chainId(e){L(this,Xu,Ce(e))}get signature(){return T(this,Zu)||null}set signature(e){L(this,Zu,e==null?null:ws.from(e))}get accessList(){const e=T(this,ef)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){L(this,ef,e==null?null:$o(e))}get maxFeePerBlobGas(){const e=T(this,Vl);return e==null&&this.type===3?pn:e}set maxFeePerBlobGas(e){L(this,Vl,e==null?null:Ce(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ta);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 t=0;t<e.length;t++)$(Ct(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}L(this,ta,e)}get blobs(){return T(this,na)==null?null:T(this,na).map(e=>Object.assign({},e))}set blobs(e){if(e==null){L(this,na,null);return}const t=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(Zv(i)){te(T(this,Yi),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if($(o.length<=B1,"blob is too large",`blobs[${s}]`,i),o.length!==B1){const c=new Uint8Array(B1);c.set(o),o=c}const a=T(this,Yi).blobToKzgCommitment(o),l=Ae(T(this,Yi).computeBlobKzgProof(o,a));t.push({data:Ae(o),commitment:Ae(a),proof:l}),r.push(dI(1,a))}else{const o=Ae(i.commitment);t.push({data:Ae(i.data),commitment:o,proof:Ae(i.proof)}),r.push(dI(1,o))}}L(this,na,t),L(this,ta,r)}get kzg(){return T(this,Yi)}set kzg(e){L(this,Yi,e)}get hash(){return this.signature==null?null:Xt(fe(this,tf,b0).call(this,!0,!1))}get unsignedHash(){return Xt(this.unsignedSerialized)}get from(){return this.signature==null?null:pX(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:ih.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return fe(this,tf,b0).call(this,!0,!0)}get unsignedSerialized(){return fe(this,tf,b0).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,Vl)!=null||T(this,ta);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&te(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),te(!t||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):t?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 Xi.from(this)}toJSON(){const e=t=>t==null?null:t.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 Xi;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return Xi.from(vX(r));switch(r[0]){case 1:return Xi.from(kX(r));case 2:return Xi.from(EX(r));case 3:return Xi.from(TX(r))}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Xi;return e.type!=null&&(t.type=e.type),e.to!=null&&(t.to=e.to),e.nonce!=null&&(t.nonce=e.nonce),e.gasLimit!=null&&(t.gasLimit=e.gasLimit),e.gasPrice!=null&&(t.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(t.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(t.data=e.data),e.value!=null&&(t.value=e.value),e.chainId!=null&&(t.chainId=e.chainId),e.signature!=null&&(t.signature=ws.from(e.signature)),e.accessList!=null&&(t.accessList=e.accessList),e.blobVersionedHashes!=null&&(t.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(t.kzg=e.kzg),e.blobs!=null&&(t.blobs=e.blobs),e.hash!=null&&($(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),$(t.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&($(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),$(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}};ri=new WeakMap,$u=new WeakMap,Gu=new WeakMap,Wu=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Ju=new WeakMap,qu=new WeakMap,Yu=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,ef=new WeakMap,Vl=new WeakMap,ta=new WeakMap,Yi=new WeakMap,na=new WeakMap,tf=new WeakSet,b0=function(e,t){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 xX(this,r);case 1:return SX(this,r);case 2:return CX(this,r);case 3:return OX(this,r,t?this.blobs:null)}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let hh=Xi;const hI=new Uint8Array(32);hI.fill(0);const NX=BigInt(-1),pI=BigInt(0),mI=BigInt(1),MX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function RX(n){const e=ct(n),t=e.length%32;return t?zt([e,hI.slice(t)]):Ae(e)}const PX=_o(mI,32),DX=_o(pI,32),gI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},U1=["name","version","chainId","verifyingContract","salt"];function yI(n){return function(e){return $(typeof e=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const IX={name:yI("name"),version:yI("version"),chainId:function(n){const e=Ce(n,"domain.chainId");return $(e>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(e)?Number(e):al(e)},verifyingContract:function(n){try{return pt(n).toLowerCase()}catch{}$(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){const e=ct(n,"domain.salt");return $(e.length===32,'invalid domain value "salt"',"domain.salt",n),Ae(e)}};function V1(n){{const e=n.match(/^(u?)int(\d+)$/);if(e){const t=e[1]==="",r=parseInt(e[2]);$(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",n);const s=Zd(MX,t?r-1:r),i=t?(s+mI)*NX:pI;return function(o){const a=Ce(o,"value");return $(a>=i&&a<=s,`value out-of-bounds for ${n}`,"value",a),_o(t?AP(a,256):a,32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return $(t!==0&&t<=32&&e[1]===String(t),"invalid bytes width","type",n),function(r){const s=ct(r);return $(s.length===t,`invalid length for ${n}`,"value",r),RX(r)}}}switch(n){case"address":return function(e){return ol(pt(e),32)};case"bool":return function(e){return e?PX:DX};case"bytes":return function(e){return Xt(e)};case"string":return function(e){return hl(e)}}return null}function bI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}function by(n){const e=n.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:n}}const qr=class qr{constructor(e){q(this,f0);W(this,"primaryType");q(this,Uh);q(this,Zi);q(this,nf);L(this,Zi,new Map),L(this,nf,new Map);const t=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:c,type:u})=>{let{base:f,index:d}=by(u);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:c,type:f+(d||"")}}),t.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),L(this,Uh,JSON.stringify(i));for(const l in i){const c=new Set;for(const u of i[l]){$(!c.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),c.add(u.name);const f=by(u.type).base;$(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!V1(f)&&($(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),t.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,c){$(!c.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),c.add(l);for(const u of t.get(l))if(r.has(u)){a(u,c);for(const f of c)s.get(f).add(u)}c.delete(l)}a(this.primaryType,new Set);for(const[l,c]of s){const u=Array.from(c);u.sort(),T(this,Zi).set(l,bI(l,i[l])+u.map(f=>bI(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,Uh))}getEncoder(e){let t=T(this,nf).get(e);return t||(t=fe(this,f0,cF).call(this,e),T(this,nf).set(e,t)),t}encodeType(e){const t=T(this,Zi).get(e);return $(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Xt(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(V1(e))return r(e,t);const s=by(e).array;if(s)return $(s.count===-1||s.count===t.length,`array length mismatch; expected length ${s.count}`,"value",t),t.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,t[a],r),o),{});$(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new qr(e)}static getPrimaryType(e){return qr.from(e).primaryType}static hashStruct(e,t,r){return qr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(e[r]==null)continue;const s=gI[r];$(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:s})}return t.sort((r,s)=>U1.indexOf(r.name)-U1.indexOf(s.name)),qr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return zt(["0x1901",qr.hashDomain(e),qr.from(t).hash(r)])}static hash(e,t,r){return Xt(qr.encode(e,t,r))}static async resolveNames(e,t,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!Ct(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=qr.from(t);o.visit(r,(a,l)=>(a==="address"&&!Ct(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,t,r){qr.hashDomain(e);const s={},i=[];U1.forEach(l=>{const c=e[l];c!=null&&(s[l]=IX[l](c),i.push({name:l,type:gI[l]}))});const o=qr.from(t);t=o.types;const a=Object.assign({},t);return $(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return Ae(ct(c));if(l.match(/^u?int/))return Ce(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return $(typeof c=="string","invalid string","value",c),c}$(!1,"unsupported type","type",l)})}}};Uh=new WeakMap,Zi=new WeakMap,nf=new WeakMap,f0=new WeakSet,cF=function(e){{const s=V1(e);if(s)return s}const t=by(e).array;if(t){const s=t.prefix,i=this.getEncoder(s);return o=>{$(t.count===-1||t.count===o.length,`array length mismatch; expected length ${t.count}`,"value",o);let a=o.map(i);return T(this,Zi).has(s)&&(a=a.map(Xt)),Xt(zt(a))}}const r=this.types[e];if(r){const s=hl(T(this,Zi).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(i[a]);return T(this,Zi).has(l)?Xt(c):c});return o.unshift(s),zt(o)}}$(!1,`unknown type: ${e}`,"type",e)};let wy=qr;function Wn(n){const e=new Set;return n.forEach(t=>e.add(t)),Object.freeze(e)}const LX=Wn("external public payable override".split(" ")),wI="constant external internal payable private public pure view override",BX=Wn(wI.split(" ")),AI="constructor error event fallback function receive struct",vI=Wn(AI.split(" ")),xI="calldata memory storage payable indexed",_X=Wn(xI.split(" ")),FX=[AI,xI,"tuple returns",wI].join(" "),jX=Wn(FX.split(" ")),UX={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},VX=new RegExp("^(\\s*)"),HX=new RegExp("^([0-9]+)"),zX=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),EI=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),CI=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),d0=class d0{constructor(e){q(this,Vh);q(this,Cn);q(this,ks);L(this,Cn,0),L(this,ks,e.slice())}get offset(){return T(this,Cn)}get length(){return T(this,ks).length-T(this,Cn)}clone(){return new d0(T(this,ks))}reset(){L(this,Cn,0)}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=fe(this,Vh,ME).call(this,T(this,Cn)+1,e.match+1);return L(this,Cn,e.match+1),t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;T(this,Cn)<e.match-1;){const r=this.peek().linkNext;t.push(fe(this,Vh,ME).call(this,T(this,Cn)+1,r)),L(this,Cn,r)}return L(this,Cn,e.match+1),t}peek(){if(T(this,Cn)>=T(this,ks).length)throw new Error("out-of-bounds");return T(this,ks)[T(this,Cn)]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return Xh(this,Cn)._++,e}toString(){const e=[];for(let t=T(this,Cn);t<T(this,ks).length;t++){const r=T(this,ks)[t];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Cn=new WeakMap,ks=new WeakMap,Vh=new WeakSet,ME=function(e=0,t=0){return new d0(T(this,ks).slice(e,t).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let As=d0;function Go(n){const e=[],t=o=>{const a=i<n.length?JSON.stringify(n[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<n.length;){let o=n.substring(i),a=o.match(VX);a&&(i+=a[1].length,o=n.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let c=UX[o[0]]||"";if(c){if(l.type=c,l.text=o[0],i++,c==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(c=="CLOSE_PAREN")r.length===0&&t("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(c==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(c==="OPEN_BRACKET")l.type="BRACKET";else if(c==="CLOSE_BRACKET"){let u=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;u=f+u,e[e.length-1].value=Je(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=u}continue}if(a=o.match(zX),a){if(l.text=a[1],i+=l.text.length,jX.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(CI)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(HX),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 As(e.map(o=>Object.freeze(o)))}function kI(n,e){let t=[];for(const r in e.keys())n.has(r)&&t.push(r);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Ay(n,e){if(e.peekKeyword(vI)){const t=e.pop().text;if(t!==n)throw new Error(`expected ${n}, got ${t}`)}return e.popType("ID")}function Ii(n,e){const t=new Set;for(;;){const r=n.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(n.pop(),t.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);t.add(r)}return Object.freeze(t)}function SI(n){let e=Ii(n,BX);return kI(e,Wn("constant payable nonpayable".split(" "))),kI(e,Wn("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 Li(n,e){return n.popParams().map(t=>An.from(t,e))}function TI(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return Ce(n.pop().text);throw new Error("invalid gas")}return null}function gl(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}const $X=new RegExp(/^(.*)\[([0-9]*)\]$/);function OI(n){const e=n.match(CI);if($(e,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(e[2]){const t=parseInt(e[2]);$(t!==0&&t<=32,"invalid bytes length","type",n)}else if(e[3]){const t=parseInt(e[3]);$(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",n)}return n}const Lt={},ar=Symbol.for("_ethers_internal"),NI="_ParamTypeInternal",MI="_ErrorInternal",RI="_EventInternal",PI="_ConstructorInternal",DI="_FallbackInternal",II="_FunctionInternal",LI="_StructInternal",Yr=class Yr{constructor(e,t,r,s,i,o,a,l){q(this,rf);W(this,"name");W(this,"type");W(this,"baseType");W(this,"indexed");W(this,"components");W(this,"arrayLength");W(this,"arrayChildren");if(qg(e,Lt,"ParamType"),Object.defineProperty(this,ar,{value:NI}),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:t,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 t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){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,t))}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,t))}return t(this.type,e)}async walkAsync(e,t){const r=[],s=[e];return fe(this,rf,w0).call(this,r,e,t,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,t){if(Yr.isParamType(e))return e;if(typeof e=="string")try{return Yr.from(Go(e),t)}catch{$(!1,"invalid param type","obj",e)}else if(e instanceof As){let a="",l="",c=null;Ii(e,Wn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",c=e.popParams().map(m=>Yr.from(m)),a=`tuple(${c.map(m=>m.format()).join(",")})`):(a=OI(e.popType("TYPE")),l=a);let u=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();u=new Yr(Lt,"",a,l,null,c,f,u),f=m.value,a+=m.text,l="array",c=null}let d=null;if(Ii(e,_X).has("indexed")){if(!t)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Yr(Lt,p,a,l,d,c,f,u)}const r=e.name;$(!r||typeof r=="string"&&r.match(EI),"invalid name","obj.name",r);let s=e.indexed;s!=null&&($(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match($X);if(o){const a=parseInt(o[2]||"-1"),l=Yr.from({type:o[1],components:e.components});return new Yr(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(c=>Yr.from(c)):null;return new Yr(Lt,r||"",i,"tuple",s,a,null,null)}return i=OI(e.type),new Yr(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[ar]===NI}};rf=new WeakSet,w0=function(e,t,r,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=t.slice();a.forEach((l,c)=>{var u;fe(u=o,rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(t))a=t.slice();else{if(t==null||typeof t!="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 t))throw new Error(`missing value for component ${l.name}`);return t[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,c)=>{var u;fe(u=o[c],rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}const i=r(this.type,t);i.then?e.push(async function(){s(await i)}()):s(i)};let An=Yr;class yl{constructor(e,t,r){W(this,"type");W(this,"inputs");qg(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Me(this,{type:t,inputs:r})}static from(e){if(typeof e=="string"){try{yl.from(JSON.parse(e))}catch{}return yl.from(Go(e))}if(e instanceof As)switch(e.peekKeyword(vI)){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return bl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return bl.from(e)}te(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}$(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Bi.isFragment(e)}static isError(e){return lr.isFragment(e)}static isEvent(e){return Zs.isFragment(e)}static isFunction(e){return ei.isFragment(e)}static isStruct(e){return bl.isFragment(e)}}class vy extends yl{constructor(t,r,s,i){super(t,r,i);W(this,"name");$(typeof s=="string"&&s.match(EI),"invalid identifier","name",s),i=Object.freeze(i.slice()),Me(this,{name:s})}}function ph(n,e){return"("+e.map(t=>t.format(n)).join(n==="full"?", ":",")+")"}class lr extends vy{constructor(e,t,r){super(e,"error",t,r),Object.defineProperty(this,ar,{value:MI})}get selector(){return hl(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 t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+ph(e,this.inputs)),t.join(" ")}static from(e){if(lr.isFragment(e))return e;if(typeof e=="string")return lr.from(Go(e));if(e instanceof As){const t=Ay("error",e),r=Li(e);return gl(e),new lr(Lt,t,r)}return new lr(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===MI}}class Zs extends vy{constructor(t,r,s,i){super(t,"event",r,s);W(this,"anonymous");Object.defineProperty(this,ar,{value:RI}),Me(this,{anonymous:i})}get topicHash(){return hl(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("event"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(t,r){return r=(r||[]).map(i=>An.from(i)),new Zs(Lt,t,r,!1).topicHash}static from(t){if(Zs.isFragment(t))return t;if(typeof t=="string")try{return Zs.from(Go(t))}catch{$(!1,"invalid event fragment","obj",t)}else if(t instanceof As){const r=Ay("event",t),s=Li(t,!0),i=!!Ii(t,Wn(["anonymous"])).has("anonymous");return gl(t),new Zs(Lt,r,s,i)}return new Zs(Lt,t.name,t.inputs?t.inputs.map(r=>An.from(r,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ar]===RI}}class Bi extends yl{constructor(t,r,s,i,o){super(t,r,s);W(this,"payable");W(this,"gas");Object.defineProperty(this,ar,{value:PI}),Me(this,{payable:i,gas:o})}format(t){if(te(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="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(t)))});const r=[`constructor${ph(t,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(t){if(Bi.isFragment(t))return t;if(typeof t=="string")try{return Bi.from(Go(t))}catch{$(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof As){Ii(t,Wn(["constructor"]));const r=Li(t),s=!!Ii(t,LX).has("payable"),i=TI(t);return gl(t),new Bi(Lt,"constructor",r,s,i)}return new Bi(Lt,"constructor",t.inputs?t.inputs.map(An.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===PI}}class _i extends yl{constructor(t,r,s){super(t,"fallback",r);W(this,"payable");Object.defineProperty(this,ar,{value:DI}),Me(this,{payable:s})}format(t){const r=this.inputs.length===0?"receive":"fallback";if(t==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(t){if(_i.isFragment(t))return t;if(typeof t=="string")try{return _i.from(Go(t))}catch{$(!1,"invalid fallback fragment","obj",t)}else if(t instanceof As){const r=t.toString(),s=t.peekKeyword(Wn(["fallback","receive"]));if($(s,"type must be fallback or receive","obj",r),t.popKeyword(Wn(["fallback","receive"]))==="receive"){const l=Li(t);return $(l.length===0,"receive cannot have arguments","obj.inputs",l),Ii(t,Wn(["payable"])),gl(t),new _i(Lt,[],!0)}let o=Li(t);o.length?$(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[An.from("bytes")];const a=SI(t);if($(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Ii(t,Wn(["returns"])).has("returns")){const l=Li(t);$(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(c=>c.format("minimal")).join(", "))}return gl(t),new _i(Lt,o,a==="payable")}if(t.type==="receive")return new _i(Lt,[],!0);if(t.type==="fallback"){const r=[An.from("bytes")],s=t.stateMutability==="payable";return new _i(Lt,r,s)}$(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ar]===DI}}class ei extends vy{constructor(t,r,s,i,o,a){super(t,"function",r,i);W(this,"constant");W(this,"outputs");W(this,"stateMutability");W(this,"payable");W(this,"gas");Object.defineProperty(this,ar,{value:II}),o=Object.freeze(o.slice()),Me(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return hl(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="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(t))),outputs:this.outputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("function"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(ph(t,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(t,r){return r=(r||[]).map(i=>An.from(i)),new ei(Lt,t,"view",r,[],null).selector}static from(t){if(ei.isFragment(t))return t;if(typeof t=="string")try{return ei.from(Go(t))}catch{$(!1,"invalid function fragment","obj",t)}else if(t instanceof As){const s=Ay("function",t),i=Li(t),o=SI(t);let a=[];Ii(t,Wn(["returns"])).has("returns")&&(a=Li(t));const l=TI(t);return gl(t),new ei(Lt,s,o,i,a,l)}let r=t.stateMutability;return r==null&&(r="payable",typeof t.constant=="boolean"?(r="view",t.constant||(r="payable",typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable")),new ei(Lt,t.name,r,t.inputs?t.inputs.map(An.from):[],t.outputs?t.outputs.map(An.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===II}}class bl extends vy{constructor(e,t,r){super(e,"struct",t,r),Object.defineProperty(this,ar,{value:LI})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return bl.from(Go(e))}catch{$(!1,"invalid struct fragment","obj",e)}else if(e instanceof As){const t=Ay("struct",e),r=Li(e);return gl(e),new bl(Lt,t,r)}return new bl(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===LI}}const vs=new Map;vs.set(0,"GENERIC_PANIC"),vs.set(1,"ASSERT_FALSE"),vs.set(17,"OVERFLOW"),vs.set(18,"DIVIDE_BY_ZERO"),vs.set(33,"ENUM_RANGE_ERROR"),vs.set(34,"BAD_STORAGE_DATA"),vs.set(49,"STACK_UNDERFLOW"),vs.set(50,"ARRAY_RANGE_ERROR"),vs.set(65,"OUT_OF_MEMORY"),vs.set(81,"UNINITIALIZED_FUNCTION_CALL");const GX=new RegExp(/^bytes([0-9]*)$/),WX=new RegExp(/^(u?int)([0-9]*)$/);let H1=null,BI=1024;function KX(n,e,t,r){let s="missing revert data",i=null;const o=null;let a=null;if(t){s="execution reverted";const c=ct(t);if(t=Ae(t),c.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(c.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Ae(c.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],c.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(c.slice(0,4))==="0x4e487b71")try{const u=Number(r.decode(["uint256"],c.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[u]},i=`Panic due to ${vs.get(u)||"UNKNOWN"}(${u})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?pt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=pt(e.from)),Mt(s,"CALL_EXCEPTION",{action:n,data:t,reason:i,transaction:l,invocation:o,revert:a})}const h0=class h0{constructor(){q(this,ra)}getDefaultValue(e){const t=e.map(s=>fe(this,ra,Tf).call(this,An.from(s)));return new cy(t,"_").defaultValue()}encode(e,t){gP(t.length,e.length,"types/values length mismatch");const r=e.map(o=>fe(this,ra,Tf).call(this,An.from(o))),s=new cy(r,"_"),i=new s1;return s.encode(i,t),i.data}decode(e,t,r){const s=e.map(o=>fe(this,ra,Tf).call(this,An.from(o)));return new cy(s,"_").decode(new i1(t,r,BI))}static _setDefaultMaxInflation(e){$(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),BI=e}static defaultAbiCoder(){return H1==null&&(H1=new h0),H1}static getBuiltinCallException(e,t,r){return KX(e,t,r,h0.defaultAbiCoder())}};ra=new WeakSet,Tf=function(e){if(e.isArray())return new bY(fe(this,ra,Tf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new cy(e.components.map(r=>fe(this,ra,Tf).call(this,r)),e.name);switch(e.baseType){case"address":return new gY(e.name);case"bool":return new wY(e.name);case"string":return new OY(e.name);case"bytes":return new AY(e.name);case"":return new EY(e.name)}let t=e.type.match(WX);if(t){let r=parseInt(t[2]||"256");return $(r!==0&&r<=256&&r%8===0,"invalid "+t[1]+" bit length","param",e),new TY(r/8,t[1]==="int",e.name)}if(t=e.type.match(GX),t){let r=parseInt(t[1]);return $(r!==0&&r<=32,"invalid bytes length","param",e),new vY(r,e.name)}$(!1,"invalid type","type",e.type)};let yu=h0;class QX{constructor(e,t,r){W(this,"fragment");W(this,"name");W(this,"signature");W(this,"topic");W(this,"args");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,signature:i,topic:t,args:r})}}class JX{constructor(e,t,r,s){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");W(this,"value");const i=e.name,o=e.format();Me(this,{fragment:e,name:i,args:r,signature:o,selector:t,value:s})}}class qX{constructor(e,t,r){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,args:r,signature:i,selector:t})}}class _I{constructor(e){W(this,"hash");W(this,"_isIndexed");Me(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const FI={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"},jI={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let e="unknown panic code";return n>=0&&n<=255&&FI[n.toString()]&&(e=FI[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${e})`}}},Hl=class Hl{constructor(e){q(this,ai);W(this,"fragments");W(this,"deploy");W(this,"fallback");W(this,"receive");q(this,si);q(this,ii);q(this,oi);q(this,Pn);let t=[];typeof e=="string"?t=JSON.parse(e):t=e,L(this,oi,new Map),L(this,si,new Map),L(this,ii,new Map);const r=[];for(const o of t)try{r.push(yl.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,Pn,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,oi);break;case"event":l=T(this,ii);break;case"error":l=T(this,si);break;default:return}const c=o.format();l.has(c)||l.set(c,o)}),this.deploy||Me(this,{deploy:Bi.from("constructor()")}),Me(this,{fallback:s,receive:i})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return yu.defaultAbiCoder()}getFunctionName(e){const t=fe(this,ai,A0).call(this,e,null,!1);return $(t,"no matching function","key",e),t.name}hasFunction(e){return!!fe(this,ai,A0).call(this,e,null,!1)}getFunction(e,t){return fe(this,ai,A0).call(this,e,t||null,!0)}forEachFunction(e){const t=Array.from(T(this,oi).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,oi).get(s),r)}}getEventName(e){const t=fe(this,ai,v0).call(this,e,null,!1);return $(t,"no matching event","key",e),t.name}hasEvent(e){return!!fe(this,ai,v0).call(this,e,null,!1)}getEvent(e,t){return fe(this,ai,v0).call(this,e,t||null,!0)}forEachEvent(e){const t=Array.from(T(this,ii).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,ii).get(s),r)}}getError(e,t){if(Ct(e)){const s=e.toLowerCase();if(jI[s])return lr.from(jI[s].signature);for(const i of T(this,si).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,si))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?lr.from("error Error(string)"):e==="Panic"?lr.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=lr.from(e).format(),e==="Error(string)")return lr.from("error Error(string)");if(e==="Panic(uint256)")return lr.from("error Panic(uint256)");const r=T(this,si).get(e);return r||null}forEachError(e){const t=Array.from(T(this,si).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,si).get(s),r)}}_decodeParams(e,t){return T(this,Pn).decode(e,t)}_encodeParams(e,t){return T(this,Pn).encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $(Vt(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $(Vt(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){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=Vn(t);if(s.length%32===0)try{return T(this,Pn).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,t){const r=ct(e,"data"),s=yu.getBuiltinCallException("call",t,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 c=T(this,Pn).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:c},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(t);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return Ae(T(this,Pn).encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const i=this.getEvent(e);$(i,"unknown event","eventFragment",e),e=i}te(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?hl(o):i.type==="bytes"?Xt(Ae(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=_o(o):i.type.match(/^bytes/)?o=MJ(o,32):i.type==="address"&&T(this,Pn).encode(["address"],[o]),ol(Ae(o),32));for(t.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,t){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),$(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(hl(l));else if(o.type==="bytes")r.push(Xt(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Pn).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Pn).encode(s,i),topics:r}}decodeEventLog(e,t,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;$(Ct(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(An.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,Pn).decode(s,zt(r)):null,l=T(this,Pn).decode(i,t,!0),c=[],u=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new _I(null);else if(o[p])m=new _I(a[d++]);else try{m=a[d++]}catch(y){m=y}else try{m=l[f++]}catch(y){m=y}c.push(m),u.push(h.name||null)}),ou.fromItems(c,u)}parseTransaction(e){const t=ct(e.data,"tx.data"),r=Ce(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Ae(t.slice(0,4)));if(!s)return null;const i=T(this,Pn).decode(s.inputs,t.slice(4));return new JX(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new QX(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=Ae(e),r=this.getError(Vt(t,0,4));if(!r)return null;const s=T(this,Pn).decode(r.inputs,Vt(t,4));return new qX(r,r.selector,s)}static from(e){return e instanceof Hl?e:typeof e=="string"?new Hl(JSON.parse(e)):typeof e.formatJson=="function"?new Hl(e.formatJson()):typeof e.format=="function"?new Hl(e.format("json")):new Hl(e)}};si=new WeakMap,ii=new WeakMap,oi=new WeakMap,Pn=new WeakMap,ai=new WeakSet,A0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,oi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,oi))o.split("(")[0]===e&&i.push(a);if(t){const o=t.length>0?t[t.length-1]:null;let a=t.length,l=!0;Nn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let c=i.length-1;c>=0;c--){const u=i[c].inputs.length;u!==a&&(!l||u!==a-1)&&i.splice(c,1)}for(let c=i.length-1;c>=0;c--){const u=i[c].inputs;for(let f=0;f<t.length;f++)if(Nn.isTyped(t[f])){if(f>=u.length){if(t[f].type==="overrides")continue;i.splice(c,1);break}if(t[f].type!==u[f].baseType){i.splice(c,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const o=t[t.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,oi).get(ei.from(e).format());return s||null},v0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,ii).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,ii))o.split("(")[0]===e&&i.push(a);if(t){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<t.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<t.length;l++)if(Nn.isTyped(t[l])&&t[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,ii).get(Zs.from(e).format());return s||null};let z1=Hl;const UI=BigInt(0);function bu(n){return n??null}function Wt(n){return n==null?null:n.toString()}class VI{constructor(e,t,r){W(this,"gasPrice");W(this,"maxFeePerGas");W(this,"maxPriorityFeePerGas");Me(this,{gasPrice:bu(e),maxFeePerGas:bu(t),maxPriorityFeePerGas:bu(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Wt(e),maxFeePerGas:Wt(t),maxPriorityFeePerGas:Wt(r)}}}function xy(n){const e={};n.to&&(e.to=n.to),n.from&&(e.from=n.from),n.data&&(e.data=Ae(n.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in n)||n[s]==null||(e[s]=Ce(n[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in n)||n[s]==null||(e[s]=Je(n[s],`request.${s}`));return n.accessList&&(e.accessList=$o(n.accessList)),"blockTag"in n&&(e.blockTag=n.blockTag),"enableCcipRead"in n&&(e.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(e.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(e.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(e.kzg=n.kzg),"blobs"in n&&n.blobs&&(e.blobs=n.blobs.map(s=>Zv(s)?Ae(s):Object.assign({},s))),e}class YX{constructor(e,t){W(this,"provider");W(this,"number");W(this,"hash");W(this,"timestamp");W(this,"parentHash");W(this,"parentBeaconBlockRoot");W(this,"nonce");W(this,"difficulty");W(this,"gasLimit");W(this,"gasUsed");W(this,"stateRoot");W(this,"receiptsRoot");W(this,"blobGasUsed");W(this,"excessBlobGas");W(this,"miner");W(this,"prevRandao");W(this,"extraData");W(this,"baseFeePerGas");q(this,eo);L(this,eo,e.transactions.map(r=>typeof r!="string"?new gh(r,t):r)),Me(this,{provider:t,hash:bu(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:bu(e.prevRandao),extraData:e.extraData,baseFeePerGas:bu(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,eo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,eo).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:t,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:y}=this;return{_type:"Block",baseFeePerGas:Wt(e),difficulty:Wt(t),extraData:r,gasLimit:Wt(s),gasUsed:Wt(i),blobGasUsed:Wt(this.blobGasUsed),excessBlobGas:Wt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:y}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>e<this.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,eo).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let t;if(typeof e=="number")t=T(this,eo)[e];else{const r=e.toLowerCase();for(const s of T(this,eo))if(typeof s=="string"){if(s!==r)continue;t=s;break}else{if(s.hash===r)continue;t=s;break}}if(t==null)throw new Error("no such tx");return typeof t=="string"?await this.provider.getTransaction(t):t}getPrefetchedTransaction(e){const t=this.prefetchedTransactions;if(typeof e=="number")return t[e];e=e.toLowerCase();for(const r of t)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 XX(this)}}eo=new WeakMap;class mh{constructor(e,t){W(this,"provider");W(this,"transactionHash");W(this,"blockHash");W(this,"blockNumber");W(this,"removed");W(this,"address");W(this,"data");W(this,"topics");W(this,"index");W(this,"transactionIndex");this.provider=t;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:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}=this;return{_type:"log",address:e,blockHash:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}}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 ZX(this)}}class HI{constructor(e,t){W(this,"provider");W(this,"to");W(this,"from");W(this,"contractAddress");W(this,"hash");W(this,"index");W(this,"blockHash");W(this,"blockNumber");W(this,"logsBloom");W(this,"gasUsed");W(this,"blobGasUsed");W(this,"cumulativeGasUsed");W(this,"gasPrice");W(this,"blobGasPrice");W(this,"type");W(this,"status");W(this,"root");q(this,Hh);L(this,Hh,Object.freeze(e.logs.map(s=>new mh(s,t))));let r=UI;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Me(this,{provider:t,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,Hh)}toJSON(){const{to:e,from:t,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:c,status:u,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:Wt(this.cumulativeGasUsed),from:t,gasPrice:Wt(this.gasPrice),blobGasUsed:Wt(this.blobGasUsed),blobGasPrice:Wt(this.blobGasPrice),gasUsed:Wt(this.gasUsed),hash:s,index:i,logs:c,logsBloom:l,root:f,status:u,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 $I(this)}reorderedEvent(e){return te(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),zI(this,e)}}Hh=new WeakMap;const vE=class vE{constructor(e,t){W(this,"provider");W(this,"blockNumber");W(this,"blockHash");W(this,"index");W(this,"hash");W(this,"type");W(this,"to");W(this,"from");W(this,"nonce");W(this,"gasLimit");W(this,"gasPrice");W(this,"maxPriorityFeePerGas");W(this,"maxFeePerGas");W(this,"maxFeePerBlobGas");W(this,"data");W(this,"value");W(this,"chainId");W(this,"signature");W(this,"accessList");W(this,"blobVersionedHashes");q(this,sa);this.provider=t,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,sa,-1)}toJSON(){const{blockNumber:e,blockHash:t,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:c,signature:u,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:t,blobVersionedHashes:d,chainId:Wt(this.chainId),data:c,from:a,gasLimit:Wt(this.gasLimit),gasPrice:Wt(this.gasPrice),hash:s,maxFeePerGas:Wt(this.maxFeePerGas),maxPriorityFeePerGas:Wt(this.maxPriorityFeePerGas),maxFeePerBlobGas:Wt(this.maxFeePerBlobGas),nonce:l,signature:u,to:o,index:r,type:i,value:Wt(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 t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:r}=await On({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:r-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const r=e??1,s=t??0;let i=T(this,sa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await On({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,sa)&&(o=T(this,sa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const y of m)if(y===this.hash)return;for(let y=0;y<m.length;y++){const b=await m.getTransaction(y);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===UI&&(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++}},c=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})},u=await this.provider.getTransactionReceipt(this.hash);if(r===0)return c(u);if(u){if(await u.confirmations()>=r)return c(u)}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(Mt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(b)})}const y=async b=>{if(await b.confirmations()>=r){m();try{d(c(b))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,y)}),this.provider.on(this.hash,y),i>=0){const b=async()=>{try{await l()}catch(v){if(dn(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()"}),$I(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()"}),zI(this,e)}replaceableTransaction(e){$(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new vE(this,this.provider);return L(t,sa,e),t}};sa=new WeakMap;let gh=vE;function XX(n){return{orphan:"drop-block",hash:n.hash,number:n.number}}function zI(n,e){return{orphan:"reorder-transaction",tx:n,other:e}}function $I(n){return{orphan:"drop-transaction",tx:n}}function ZX(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}class $1 extends mh{constructor(t,r,s){super(t,t.provider);W(this,"interface");W(this,"fragment");W(this,"args");const i=r.decodeEventLog(s,t.data,t.topics);Me(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class GI extends mh{constructor(t,r){super(t,t.provider);W(this,"error");Me(this,{error:r})}}class eZ extends HI{constructor(t,r,s){super(s,r);q(this,sf);L(this,sf,t)}get logs(){return super.logs.map(t=>{const r=t.topics.length?T(this,sf).getEvent(t.topics[0]):null;if(r)try{return new $1(t,T(this,sf),r)}catch(s){return new GI(t,s)}return t})}}sf=new WeakMap;class G1 extends gh{constructor(t,r,s){super(s,r);q(this,zh);L(this,zh,t)}async wait(t,r){const s=await super.wait(t,r);return s==null?null:new eZ(T(this,zh),this.provider,s)}}zh=new WeakMap;class WI extends CP{constructor(t,r,s,i){super(t,r,s);W(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 tZ extends WI{constructor(e,t,r,s,i){super(e,t,r,new $1(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 KI=BigInt(0);function QI(n){return n&&typeof n.call=="function"}function JI(n){return n&&typeof n.estimateGas=="function"}function Ey(n){return n&&typeof n.resolveName=="function"}function qI(n){return n&&typeof n.sendTransaction=="function"}function YI(n){if(n!=null){if(Ey(n))return n;if(n.provider)return n.provider}}class nZ{constructor(e,t,r){q(this,$h);W(this,"fragment");if(Me(this,{fragment:t}),t.inputs.length<r.length)throw new Error("too many arguments");const s=wl(e.runner,"resolveName"),i=Ey(s)?s:null;L(this,$h,async function(){const o=await Promise.all(t.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(u,f)=>u==="address"?Array.isArray(f)?Promise.all(f.map(d=>Gn(d,i))):Gn(f,i):f)));return e.interface.encodeFilterTopics(t,o)}())}getTopicFilter(){return T(this,$h)}}$h=new WeakMap;function wl(n,e){return n==null?null:typeof n[e]=="function"?n:n.provider&&typeof n.provider[e]=="function"?n.provider:null}function Al(n){return n==null?null:n.provider||null}async function XI(n,e){const t=Nn.dereference(n,"overrides");$(typeof t=="object","invalid overrides parameter","overrides",n);const r=xy(t);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 rZ(n,e,t){const r=wl(n,"resolveName"),s=Ey(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(t[o],(a,l)=>(l=Nn.dereference(l,a),a==="address"?Gn(l,s):l))))}function sZ(n){const e=async function(o){const a=await XI(o,["data"]);a.to=await n.getAddress(),a.from&&(a.from=await Gn(a.from,YI(n.runner)));const l=n.interface,c=Ce(a.value||KI,"overrides.value")===KI,u=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!u&&!c&&$(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),$(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return $(f||c,"cannot send value to non-payable fallback","overrides.value",a.value),$(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data),a},t=async function(o){const a=wl(n.runner,"call");te(QI(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(c){throw Xv(c)&&c.data?n.interface.makeError(c.data,l):c}},r=async function(o){const a=n.runner;te(qI(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),c=Al(n.runner);return new G1(n.interface,c,l)},s=async function(o){const a=wl(n.runner,"estimateGas");return te(JI(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:n,estimateGas:s,populateTransaction:e,send:r,staticCall:t}),i}function iZ(n,e){const t=function(...c){const u=n.interface.getFunction(e,c);return te(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:c}}),u},r=async function(...c){const u=t(...c);let f={};if(u.inputs.length+1===c.length&&(f=await XI(c.pop()),f.from&&(f.from=await Gn(f.from,YI(n.runner)))),u.inputs.length!==c.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await rZ(n.runner,u.inputs,c);return Object.assign({},f,await On({to:n.getAddress(),data:n.interface.encodeFunctionData(u,d)}))},s=async function(...c){const u=await a(...c);return u.length===1?u[0]:u},i=async function(...c){const u=n.runner;te(qI(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await u.sendTransaction(await r(...c)),d=Al(n.runner);return new G1(n.interface,d,f)},o=async function(...c){const u=wl(n.runner,"estimateGas");return te(JI(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await r(...c))},a=async function(...c){const u=wl(n.runner,"call");te(QI(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...c);let d="0x";try{d=await u.call(f)}catch(p){throw Xv(p)&&p.data?n.interface.makeError(p.data,f):p}const h=t(...c);return n.interface.decodeFunctionResult(h,d)},l=async(...c)=>t(...c).constant?await s(...c):await i(...c);return Me(l,{name:n.interface.getFunctionName(e),_contract:n,_key:e,getFragment:t,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const c=n.interface.getFunction(e);return te(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),c}}),l}function oZ(n,e){const t=function(...s){const i=n.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 nZ(n,t(...s),s)};return Me(r,{name:n.interface.getEventName(e),_contract:n,_key:e,getFragment:t}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=n.interface.getEvent(e);return te(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const Cy=Symbol.for("_ethersInternal_contract"),ZI=new WeakMap;function aZ(n,e){ZI.set(n[Cy],e)}function Tr(n){return ZI.get(n[Cy])}function lZ(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}async function W1(n,e){let t,r=null;if(Array.isArray(e)){const i=function(o){if(Ct(o,32))return o;const a=n.interface.getEvent(o);return $(a,"unknown fragment","name",o),a.topicHash};t=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?t=[null]:typeof e=="string"?Ct(e,32)?t=[e]:(r=n.interface.getEvent(e),$(r,"unknown fragment","event",e),t=[r.topicHash]):lZ(e)?t=await e.getTopicFilter():"fragment"in e?(r=e.fragment,t=[r.topicHash]):$(!1,"unknown event name","event",e);t=t.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=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:t}}async function yh(n,e){const{subs:t}=Tr(n);return t.get((await W1(n,e)).tag)||null}async function eL(n,e,t){const r=Al(n.runner);te(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await W1(n,t),{addr:a,subs:l}=Tr(n);let c=l.get(i);if(!c){const f={address:a||n,topics:o},d=y=>{let b=s;if(b==null)try{b=n.interface.getEvent(y.topics[0])}catch{}if(b){const v=b,A=s?n.interface.decodeEventLog(s,y.data,y.topics):[];Q1(n,t,A,w=>new tZ(n,w,t,v,y))}else Q1(n,t,[],v=>new WI(n,v,t,y))};let h=[];c={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let y=h;h=[],await Promise.all(y),r.off(f,d)}},l.set(i,c)}return c}let K1=Promise.resolve();async function cZ(n,e,t,r){await K1;const s=await yh(n,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(t);r&&l.push(r(a?null:o));try{o.call(n,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Tr(n).subs.delete(s.tag)),i>0}async function Q1(n,e,t,r){try{await K1}catch{}const s=cZ(n,e,t,r);return K1=s,await s}const ky=["then"];rF=Cy;const Gh=class Gh{constructor(e,t,r,s){W(this,"target");W(this,"interface");W(this,"runner");W(this,"filters");W(this,rF);W(this,"fallback");$(typeof e=="string"||ID(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=z1.from(t);Me(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,Cy,{value:{}});let o,a=null,l=null;if(s){const f=Al(r);l=new G1(this.interface,f,s)}let c=new Map;if(typeof e=="string")if(Ct(e))a=e,o=Promise.resolve(e);else{const f=wl(r,"resolveName");if(!Ey(f))throw Mt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Mt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Tr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Tr(this).addr=f,f});aZ(this,{addrPromise:o,addr:a,deployTx:l,subs:c});const u=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>ky.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Me(this,{filters:u}),Me(this,{fallback:i.receive||i.fallback?sZ(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||ky.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Gh(this.target,this.interface,e)}attach(e){return new Gh(e,this.interface,this.runner)}async getAddress(){return await Tr(this).addrPromise}async getDeployedCode(){const e=Al(this.runner);te(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Al(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 Tr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),iZ(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),oZ(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,r){t==null&&(t=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Tr(this),o=s||await i,{fragment:a,topics:l}=await W1(this,e),c={address:o,topics:l,fromBlock:t,toBlock:r},u=Al(this.runner);return te(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(c)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new $1(f,this.interface,d)}catch(h){return new GI(f,h)}return new mh(f,u)})}async on(e,t){const r=await eL(this,"on",e);return r.listeners.push({listener:t,once:!1}),r.start(),this}async once(e,t){const r=await eL(this,"once",e);return r.listeners.push({listener:t,once:!0}),r.start(),this}async emit(e,...t){return await Q1(this,e,t,null)}async listenerCount(e){if(e){const s=await yh(this,e);return s?s.listeners.length:0}const{subs:t}=Tr(this);let r=0;for(const{listeners:s}of t.values())r+=s.length;return r}async listeners(e){if(e){const s=await yh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:t}=Tr(this);let r=[];for(const{listeners:s}of t.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,t){const r=await yh(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(t==null||r.listeners.length===0)&&(r.stop(),Tr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const t=await yh(this,e);if(!t)return this;t.stop(),Tr(this).subs.delete(t.tag)}else{const{subs:t}=Tr(this);for(const{tag:r,stop:s}of t.values())s(),t.delete(r)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends Gh{constructor(s,i=null){super(s,e,i)}}return t}static from(e,t,r){return r==null&&(r=null),new this(e,t,r)}};let J1=Gh;function uZ(){return J1}class wu extends uZ(){}function q1(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):$(!1,"unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}class fZ{constructor(e){W(this,"name");Me(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,t){throw new Error("unsupported coin")}async decodeAddress(e,t){throw new Error("unsupported coin")}}const tL=new RegExp("^(ipfs)://(.*)$","i"),nL=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),tL,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],of=class of{constructor(e,t,r){q(this,oa);W(this,"provider");W(this,"address");W(this,"name");q(this,ia);q(this,zl);Me(this,{provider:e,address:t,name:r}),L(this,ia,null),L(this,zl,new wu(t,["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,ia)==null&&L(this,ia,(async()=>{try{return await T(this,zl).supportsInterface("0x9061b923")}catch(e){if(dn(e,"CALL_EXCEPTION"))return!1;throw L(this,ia,null),e}})()),await T(this,ia)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await fe(this,oa,Of).call(this,"addr(bytes32)");return i==null||i===sh?null:i}catch(i){if(dn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[i]);if(Ct(o,20))return pt(o)}let t=null;for(const i of this.provider.plugins)if(i instanceof fZ&&i.supportsCoinType(e)){t=i;break}if(t==null)return null;const r=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await t.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 t=await fe(this,oa,Of).call(this,"text(bytes32,string)",[e]);return t==null||t==="0x"?null:t}async getContentHash(){const e=await fe(this,oa,Of).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const t=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const s=t[1]==="e3010170"?"ipfs":"ipns",i=parseInt(t[4],16);if(t[5].length===i*2)return`${s}://${DJ("0x"+t[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 t=await this.getText("avatar");if(t==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:t});for(let r=0;r<nL.length;r++){const s=t.match(nL[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:t}),{linkage:e,url:t};case"ipfs":{const o=q1(t);return e.push({type:"ipfs",value:t}),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:t});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 c=l[1],u=new wu(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 u.ownerOf(c);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 u.balanceOf(a,c);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await u[o](c);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}",_o(c,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=q1(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new zn(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(tL)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=q1(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const t=await e.getNetwork(),r=t.getPlugin("org.ethers.plugins.network.Ens");return te(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:t}}),r.address}static async fromName(e,t){var s;let r=t;for(;;){if(r===""||r==="."||t!=="eth"&&r==="eth")return null;const i=await fe(s=of,p0,uF).call(s,e,r);if(i!=null){const o=new of(e,i,t);return r!==t&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};ia=new WeakMap,zl=new WeakMap,oa=new WeakSet,Of=async function(e,t){t=(t||[]).slice();const r=T(this,zl).interface;t.unshift(I1(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),te(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[dX(this.name,255),r.encodeFunctionData(s,t)],e="resolve(bytes,bytes)"),t.push({enableCcipRead:!0});try{const i=await T(this,zl)[e](...t);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!dn(i,"CALL_EXCEPTION"))throw i}return null},p0=new WeakSet,uF=async function(e,t){const r=await of.getEnsAddress(e);try{const i=await new wu(r,["function resolver(bytes32) view returns (address)"],e).resolver(I1(t),{enableCcipRead:!0});return i===sh?null:i}catch(s){throw s}return null},q(of,p0);let Sy=of;const rL=BigInt(0);function at(n,e){return function(t){return t==null?e:n(t)}}function Ty(n,e){return t=>{if(e&&t==null)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map(r=>n(r))}}function bh(n,e){return t=>{const r={};for(const s in n){let i=s;if(e&&s in e&&!(i in t)){for(const o of e[s])if(o in t){i=o;break}}try{const o=n[s](t[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:t})}}return r}}function dZ(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}$(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}function Au(n){return $(Ct(n,!0),"invalid data","value",n),n}function vn(n){return $(Ct(n,32),"invalid hash","value",n),n}const hZ=bh({address:pt,blockHash:vn,blockNumber:Je,data:Au,index:Je,removed:at(dZ,!1),topics:Ty(vn),transactionHash:vn,transactionIndex:Je},{index:["logIndex"]});function pZ(n){return hZ(n)}const mZ=bh({hash:at(vn),parentHash:vn,parentBeaconBlockRoot:at(vn,null),number:Je,timestamp:Je,nonce:at(Au),difficulty:Ce,gasLimit:Ce,gasUsed:Ce,stateRoot:at(vn,null),receiptsRoot:at(vn,null),blobGasUsed:at(Ce,null),excessBlobGas:at(Ce,null),miner:at(pt),prevRandao:at(vn,null),extraData:Au,baseFeePerGas:at(Ce)},{prevRandao:["mixHash"]});function gZ(n){const e=mZ(n);return e.transactions=n.transactions.map(t=>typeof t=="string"?t:sL(t)),e}const yZ=bh({transactionIndex:Je,blockNumber:Je,transactionHash:vn,address:pt,topics:Ty(vn),data:Au,index:Je,blockHash:vn},{index:["logIndex"]});function bZ(n){return yZ(n)}const wZ=bh({to:at(pt,null),from:at(pt,null),contractAddress:at(pt,null),index:Je,root:at(Ae),gasUsed:Ce,blobGasUsed:at(Ce,null),logsBloom:at(Au),blockHash:vn,hash:vn,logs:Ty(bZ),blockNumber:Je,cumulativeGasUsed:Ce,effectiveGasPrice:at(Ce),blobGasPrice:at(Ce,null),status:at(Je),type:at(Je,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function AZ(n){return wZ(n)}function sL(n){n.to&&Ce(n.to)===rL&&(n.to="0x0000000000000000000000000000000000000000");const e=bh({hash:vn,index:at(Je,void 0),type:t=>t==="0x"||t==null?0:Je(t),accessList:at($o,null),blobVersionedHashes:at(Ty(vn,!0),null),blockHash:at(vn,null),blockNumber:at(Je,null),transactionIndex:at(Je,null),from:pt,gasPrice:at(Ce),maxPriorityFeePerGas:at(Ce),maxFeePerGas:at(Ce),maxFeePerBlobGas:at(Ce,null),gasLimit:Ce,to:at(pt,null),value:Ce,nonce:Je,data:Au,creates:at(pt,null),chainId:at(Ce,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(e.to==null&&e.creates==null&&(e.creates=pY(e)),(n.type===1||n.type===2)&&n.accessList==null&&(e.accessList=[]),n.signature?e.signature=ws.from(n.signature):e.signature=ws.from(n),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&Ce(e.blockHash)===rL&&(e.blockHash=null),e}const vZ="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class wh{constructor(e){W(this,"name");Me(this,{name:e})}clone(){return new wh(this.name)}}class Oy extends wh{constructor(t,r){t==null&&(t=0);super(`org.ethers.network.plugins.GasCost#${t||0}`);W(this,"effectiveBlock");W(this,"txBase");W(this,"txCreate");W(this,"txDataZero");W(this,"txDataNonzero");W(this,"txAccessListStorageKey");W(this,"txAccessListAddress");const s={effectiveBlock:t};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 Oy(this.effectiveBlock,this)}}class Ny extends wh{constructor(t,r){super("org.ethers.plugins.network.Ens");W(this,"address");W(this,"targetNetwork");Me(this,{address:t||vZ,targetNetwork:r??1})}clone(){return new Ny(this.address,this.targetNetwork)}}class xZ extends wh{constructor(t,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");q(this,Wh);q(this,Kh);L(this,Wh,t),L(this,Kh,r)}get url(){return T(this,Wh)}get processFunc(){return T(this,Kh)}clone(){return this}}Wh=new WeakMap,Kh=new WeakMap;const Y1=new Map,cf=class cf{constructor(e,t){q(this,af);q(this,lf);q(this,aa);L(this,af,e),L(this,lf,Ce(t)),L(this,aa,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,af)}set name(e){L(this,af,e)}get chainId(){return T(this,lf)}set chainId(e){L(this,lf,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,aa).values())}attachPlugin(e){if(T(this,aa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,aa).set(e.name,e.clone()),this}getPlugin(e){return T(this,aa).get(e)||null}getPlugins(e){return this.plugins.filter(t=>t.name.split("#")[0]===e)}clone(){const e=new cf(this.name,this.chainId);return this.plugins.forEach(t=>{e.attachPlugin(t.clone())}),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new Oy;let r=t.txBase;if(e.to==null&&(r+=t.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=t.txDataZero:r+=t.txDataNonzero;if(e.accessList){const s=$o(e.accessList);for(const i in s)r+=t.txAccessListAddress+t.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(EZ(),e==null)return cf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=Y1.get(e);if(t)return t();if(typeof e=="bigint")return new cf("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 t=new cf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new Ny(e.ensAddress,e.ensNetwork)),t}$(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const r=Y1.get(e);r&&$(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),Y1.set(e,t)}};af=new WeakMap,lf=new WeakMap,aa=new WeakMap;let tn=cf;function iL(n,e){const t=String(n);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${n}`);const r=t.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${n}`);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 oL(n){return new xZ(n,async(e,t,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:iL(a.maxFee,9),maxPriorityFeePerGas:iL(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 aL=!1;function EZ(){if(aL)return;aL=!0;function n(e,t,r){const s=function(){const i=new tn(e,t);return r.ensNetwork!=null&&i.attachPlugin(new Ny(null,r.ensNetwork)),i.attachPlugin(new Oy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};tn.register(e,s),tn.register(t,s),r.altNames&&r.altNames.forEach(i=>{tn.register(i,s)})}n("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),n("ropsten",3,{ensNetwork:3}),n("rinkeby",4,{ensNetwork:4}),n("goerli",5,{ensNetwork:5}),n("kovan",42,{ensNetwork:42}),n("sepolia",11155111,{ensNetwork:11155111}),n("holesky",17e3,{ensNetwork:17e3}),n("classic",61,{}),n("classicKotti",6,{}),n("arbitrum",42161,{ensNetwork:1}),n("arbitrum-goerli",421613,{}),n("arbitrum-sepolia",421614,{}),n("base",8453,{ensNetwork:1}),n("base-goerli",84531,{}),n("base-sepolia",84532,{}),n("bnb",56,{ensNetwork:1}),n("bnbt",97,{}),n("linea",59144,{ensNetwork:1}),n("linea-goerli",59140,{}),n("linea-sepolia",59141,{}),n("matic",137,{ensNetwork:1,plugins:[oL("https://gasstation.polygon.technology/v2")]}),n("matic-amoy",80002,{}),n("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[oL("https://gasstation-testnet.polygon.technology/v2")]}),n("optimism",10,{ensNetwork:1,plugins:[]}),n("optimism-goerli",420,{}),n("optimism-sepolia",11155420,{}),n("xdai",100,{ensNetwork:1})}function X1(n){return JSON.parse(JSON.stringify(n))}class CZ{constructor(e){q(this,uf);q(this,to);q(this,Xr);q(this,la);q(this,li);L(this,to,e),L(this,Xr,null),L(this,la,4e3),L(this,li,-2)}get pollingInterval(){return T(this,la)}set pollingInterval(e){L(this,la,e)}start(){T(this,Xr)||(L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la))),fe(this,uf,x0).call(this))}stop(){T(this,Xr)&&(T(this,to)._clearTimeout(T(this,Xr)),L(this,Xr,null))}pause(e){this.stop(),e&&L(this,li,-2)}resume(){this.start()}}to=new WeakMap,Xr=new WeakMap,la=new WeakMap,li=new WeakMap,uf=new WeakSet,x0=async function(){try{const e=await T(this,to).getBlockNumber();if(T(this,li)===-2){L(this,li,e);return}if(e!==T(this,li)){for(let t=T(this,li)+1;t<=e;t++){if(T(this,Xr)==null)return;await T(this,to).emit("block",t)}L(this,li,e)}}catch{}T(this,Xr)!=null&&L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la)))};class Z1{constructor(e){q(this,$l);q(this,Gl);q(this,ca);L(this,$l,e),L(this,ca,!1),L(this,Gl,t=>{this._poll(t,T(this,$l))})}async _poll(e,t){throw new Error("sub-classes must override this")}start(){T(this,ca)||(L(this,ca,!0),T(this,Gl).call(this,-2),T(this,$l).on("block",T(this,Gl)))}stop(){T(this,ca)&&(L(this,ca,!1),T(this,$l).off("block",T(this,Gl)))}pause(e){this.stop()}resume(){this.start()}}$l=new WeakMap,Gl=new WeakMap,ca=new WeakMap;class kZ extends Z1{constructor(t,r){super(t);q(this,ff);q(this,no);L(this,ff,r),L(this,no,-2)}pause(t){t&&L(this,no,-2),super.pause(t)}async _poll(t,r){const s=await r.getBlock(T(this,ff));s!=null&&(T(this,no)===-2?L(this,no,s.number):s.number>T(this,no)&&(r.emit(T(this,ff),s.number),L(this,no,s.number)))}}ff=new WeakMap,no=new WeakMap;class SZ extends Z1{constructor(t,r){super(t);q(this,m0);L(this,m0,X1(r))}async _poll(t,r){throw new Error("@TODO")}}m0=new WeakMap;class TZ extends Z1{constructor(t,r){super(t);q(this,df);L(this,df,r)}async _poll(t,r){const s=await r.getTransactionReceipt(T(this,df));s&&r.emit(T(this,df),s)}}df=new WeakMap;class ex{constructor(e,t){q(this,g0);q(this,ro);q(this,hf);q(this,pf);q(this,ua);q(this,Zr);L(this,ro,e),L(this,hf,X1(t)),L(this,pf,fe(this,g0,fF).bind(this)),L(this,ua,!1),L(this,Zr,-2)}start(){T(this,ua)||(L(this,ua,!0),T(this,Zr)===-2&&T(this,ro).getBlockNumber().then(e=>{L(this,Zr,e)}),T(this,ro).on("block",T(this,pf)))}stop(){T(this,ua)&&(L(this,ua,!1),T(this,ro).off("block",T(this,pf)))}pause(e){this.stop(),e&&L(this,Zr,-2)}resume(){this.start()}}ro=new WeakMap,hf=new WeakMap,pf=new WeakMap,ua=new WeakMap,Zr=new WeakMap,g0=new WeakSet,fF=async function(e){if(T(this,Zr)===-2)return;const t=X1(T(this,hf));t.fromBlock=T(this,Zr)+1,t.toBlock=e;const r=await T(this,ro).getLogs(t);if(r.length===0){T(this,Zr)<e-60&&L(this,Zr,e-60);return}for(const s of r)T(this,ro).emit(T(this,hf),s),L(this,Zr,s.blockNumber)};const OZ=BigInt(2),NZ=10;function My(n){return n&&typeof n.then=="function"}function Ry(n,e){return n+":"+JSON.stringify(e,(t,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 Py{constructor(e){W(this,"name");Me(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function MZ(n){return JSON.parse(JSON.stringify(n))}function tx(n){return n=Array.from(new Set(n).values()),n.sort(),n}async function nx(n,e){if(n==null)throw new Error("invalid event");if(Array.isArray(n)&&(n={topics:n}),typeof n=="string")switch(n){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:n,tag:n}}if(Ct(n,32)){const t=n.toLowerCase();return{type:"transaction",tag:Ry("tx",{hash:t}),hash:t}}if(n.orphan){const t=n;return{type:"orphan",tag:Ry("orphan",t),filter:MZ(t)}}if(n.address||n.topics){const t=n,r={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?tx(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(t.address){const s=[],i=[],o=a=>{Ct(a)?s.push(a):i.push((async()=>{s.push(await Gn(a,e))})())};Array.isArray(t.address)?t.address.forEach(o):o(t.address),i.length&&await Promise.all(i),r.address=tx(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Ry("event",r),type:"event"}}$(!1,"unknown ProviderEvent","event",n)}function rx(){return new Date().getTime()}const RZ={cacheTimeout:250,pollingInterval:4e3};class Dy{constructor(e,t){q(this,rt);q(this,Dn);q(this,fa);q(this,In);q(this,mf);q(this,Pr);q(this,Wl);q(this,da);q(this,so);q(this,Qh);q(this,es);q(this,gf);q(this,yf);if(L(this,yf,Object.assign({},RZ,t||{})),e==="any")L(this,Wl,!0),L(this,Pr,null);else if(e){const r=tn.from(e);L(this,Wl,!1),L(this,Pr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else L(this,Wl,!1),L(this,Pr,null);L(this,so,-1),L(this,da,new Map),L(this,Dn,new Map),L(this,fa,new Map),L(this,In,null),L(this,mf,!1),L(this,Qh,1),L(this,es,new Map),L(this,gf,!1)}get pollingInterval(){return T(this,yf).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,fa).values())}attachPlugin(e){if(T(this,fa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,fa).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,fa).get(e)||null}get disableCcipRead(){return T(this,gf)}set disableCcipRead(e){L(this,gf,!!e)}async ccipReadFetch(e,t,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],c=l.replace("{sender}",s).replace("{data}",i),u=new zn(c);l.indexOf("{data}")===-1&&(u.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:u,index:a,urls:r});let f="unknown error";const d=await u.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:u,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:u,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,t){return new YX(gZ(e),this)}_wrapLog(e,t){return new mh(pZ(e),this)}_wrapTransactionReceipt(e,t){return new HI(AZ(e),this)}_wrapTransactionResponse(e,t){return new gh(sL(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=Je(await fe(this,rt,Dr).call(this,{method:"getBlockNumber"}),"%response");return T(this,so)>=0&&L(this,so,e),e}_getAddress(e){return Gn(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(Ct(e))return Ct(e,32)?e:al(e);if(typeof e=="bigint"&&(e=Je(e,"blockTag")),typeof e=="number")return e>=0?al(e):T(this,so)>=0?al(T(this,so)+e):this.getBlockNumber().then(t=>al(t+e));$(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?tx(l.map(c=>c.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,c,u)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(c!=null||u!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),t.length&&(d.topics=t),c&&(d.fromBlock=c),u&&(d.toBlock=u),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 t=xy(e),r=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const i=Gn(t[s],this);My(i)?r.push(async function(){t[s]=await i}()):t[s]=i}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);My(s)?r.push(async function(){t.blockTag=await s}()):t.blockTag=s}return r.length?async function(){return await Promise.all(r),t}():t}async getNetwork(){if(T(this,Pr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Pr)===s&&L(this,Pr,null),i}})();return L(this,Pr,s),(await s).clone()}const e=T(this,Pr),[t,r]=await Promise.all([e,this._detectNetwork()]);return t.chainId!==r.chainId&&(T(this,Wl)?(this.emit("network",r,t),T(this,Pr)===e&&L(this,Pr,Promise.resolve(r))):te(!1,`network changed: ${t.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const e=await this.getNetwork(),t=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await On({_block:fe(this,rt,DE).call(this,"latest",!1),gasPrice:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getGasPrice"});return Ce(u,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getPriorityFee"});return Ce(u,"%response")}catch{}return null})()});let a=null,l=null;const c=this._wrapBlock(s,e);return c&&c.baseFeePerGas&&(l=o??BigInt("1000000000"),a=c.baseFeePerGas*OZ+l),new VI(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new zn(r.url),i=await r.processFunc(t,this,s);return new VI(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return My(t)&&(t=await t),Ce(await fe(this,rt,Dr).call(this,{method:"estimateGas",transaction:t}),"%response")}async call(e){const{tx:t,blockTag:r}=await On({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await fe(this,rt,PE).call(this,fe(this,rt,RE).call(this,t,r,e.enableCcipRead?0:-1))}async getBalance(e,t){return Ce(await fe(this,rt,ep).call(this,{method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return Je(await fe(this,rt,ep).call(this,{method:"getTransactionCount"},e,t),"%response")}async getCode(e,t){return Ae(await fe(this,rt,ep).call(this,{method:"getCode"},e,t))}async getStorage(e,t,r){const s=Ce(t,"position");return Ae(await fe(this,rt,ep).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:t,hash:r,network:s}=await On({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=hh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(t)}async getBlock(e,t){const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,DE).call(this,e,!!t)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,t)}async getTransactionReceipt(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await fe(this,rt,Dr).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,t)}async getTransactionResult(e){const{result:t}=await On({network:this.getNetwork(),result:fe(this,rt,Dr).call(this,{method:"getTransactionResult",hash:e})});return t==null?null:Ae(t)}async getLogs(e){let t=this._getFilter(e);My(t)&&(t=await t);const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getLogs",filter:t})});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 Sy.fromName(this,e)}async getAvatar(e){const t=await this.getResolver(e);return t?await t.getAvatar():null}async resolveName(e){const t=await this.getResolver(e);return t?await t.getAddress():null}async lookupAddress(e){e=pt(e);const t=I1(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await Sy.getEnsAddress(this),i=await new wu(r,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(i==null||i===sh)return null;const a=await new wu(i,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(a)!==e?null:a}catch(r){if(dn(r,"BAD_DATA")&&r.value==="0x"||dn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,t,r){const s=t??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async c=>{try{const u=await this.getTransactionReceipt(e);if(u!=null&&c-u.blockNumber+1>=s){i(u),a&&(clearTimeout(a),a=null);return}}catch(u){console.log("EEE",u)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(Mt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){te(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const t=T(this,es).get(e);t&&(t.timer&&clearTimeout(t.timer),T(this,es).delete(e))}_setTimeout(e,t){t==null&&(t=0);const r=Xh(this,Qh)._++,s=()=>{T(this,es).delete(r),e()};if(this.paused)T(this,es).set(r,{timer:null,func:s,time:t});else{const i=setTimeout(s,t);T(this,es).set(r,{timer:i,func:s,time:rx()})}return r}_forEachSubscriber(e){for(const t of T(this,Dn).values())e(t.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new Py(e.type);case"block":{const t=new CZ(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new kZ(this,e.type);case"event":return new ex(this,e.filter);case"transaction":return new TZ(this,e.hash);case"orphan":return new SZ(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,t){for(const r of T(this,Dn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=t,r.started&&t.start(),T(this,In)!=null&&t.pause(T(this,In));break}}async on(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async once(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async emit(e,...t){const r=await fe(this,rt,tp).call(this,e,t);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 CP(this,o?null:i,e);try{i.call(this,...t,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.length:0}let t=0;for(const{listeners:r}of T(this,Dn).values())t+=r.length;return t}async listeners(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let t=[];for(const{listeners:r}of T(this,Dn).values())t=t.concat(r.map(({listener:s})=>s));return t}async off(e,t){const r=await fe(this,rt,tp).call(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(!t||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:t,started:r,subscriber:s}=await fe(this,rt,E0).call(this,e);r&&s.stop(),T(this,Dn).delete(t)}else for(const[t,{started:r,subscriber:s}]of T(this,Dn))r&&s.stop(),T(this,Dn).delete(t);return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return this.off(e,t)}get destroyed(){return T(this,mf)}destroy(){this.removeAllListeners();for(const e of T(this,es).keys())this._clearTimeout(e);L(this,mf,!0)}get paused(){return T(this,In)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(L(this,so,-1),T(this,In)!=null){if(T(this,In)==!!e)return;te(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(e)),L(this,In,!!e);for(const t of T(this,es).values())t.timer&&clearTimeout(t.timer),t.time=rx()-t.time}resume(){if(T(this,In)!=null){this._forEachSubscriber(e=>e.resume()),L(this,In,null);for(const e of T(this,es).values()){let t=e.time;t<0&&(t=0),e.time=rx(),setTimeout(e.func,t)}}}}Dn=new WeakMap,fa=new WeakMap,In=new WeakMap,mf=new WeakMap,Pr=new WeakMap,Wl=new WeakMap,da=new WeakMap,so=new WeakMap,Qh=new WeakMap,es=new WeakMap,gf=new WeakMap,yf=new WeakMap,rt=new WeakSet,Dr=async function(e){const t=T(this,yf).cacheTimeout;if(t<0)return await this._perform(e);const r=Ry(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)},t)),await s},RE=async function(e,t,r){te(r<NZ,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=xy(e);try{return Ae(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(i){if(!this.disableCcipRead&&Xv(i)&&i.data&&r>=0&&t==="latest"&&s.to!=null&&Vt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Gn(s.to,this);let l;try{l=BZ(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 c=await this.ccipReadFetch(s,l.calldata,l.urls);te(c!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const u={to:a,data:zt([l.selector,LZ([c,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:u});try{const f=await fe(this,rt,RE).call(this,u,t,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},u),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},u),error:f}),f}}throw i}},PE=async function(e){const{value:t}=await On({network:this.getNetwork(),value:e});return t},ep=async function(e,t,r){let s=this._getAddress(t),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await fe(this,rt,PE).call(this,fe(this,rt,Dr).call(this,Object.assign(e,{address:s,blockTag:i})))},DE=async function(e,t){if(Ct(e,32))return await fe(this,rt,Dr).call(this,{method:"getBlock",blockHash:e,includeTransactions:t});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await fe(this,rt,Dr).call(this,{method:"getBlock",blockTag:r,includeTransactions:t})},tp=async function(e,t){let r=await nx(e,this);return r.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(r=await nx({orphan:"drop-log",log:t[0]},this)),T(this,Dn).get(r.tag)||null},E0=async function(e){const t=await nx(e,this),r=t.tag;let s=T(this,Dn).get(r);return s||(s={subscriber:this._getSubscriber(t),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Dn).set(r,s)),s};function PZ(n,e){try{const t=sx(n,e);if(t)return iu(t)}catch{}return null}function sx(n,e){if(n==="0x")return null;try{const t=Je(Vt(n,e,e+32)),r=Je(Vt(n,t,t+32));return Vt(n,t+32,t+32+r)}catch{}return null}function lL(n){const e=Hn(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function DZ(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}const IZ=new Uint8Array([]);function LZ(n){const e=[];let t=0;for(let r=0;r<n.length;r++)e.push(IZ),t+=32;for(let r=0;r<n.length;r++){const s=ct(n[r]);e[r]=lL(t),e.push(lL(s.length)),e.push(DZ(s)),t+=32+Math.ceil(s.length/32)*32}return zt(e)}const cL="0x0000000000000000000000000000000000000000000000000000000000000000";function BZ(n){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};te(ru(n)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Vt(n,0,32);te(Vt(t,0,12)===Vt(cL,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Vt(t,12);try{const r=[],s=Je(Vt(n,32,64)),i=Je(Vt(n,s,s+32)),o=Vt(n,s+32);for(let a=0;a<i;a++){const l=PZ(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=sx(n,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(n,100,128)===Vt(cL,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Vt(n,96,100);try{const r=sx(n,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 vu(n,e){if(n.provider)return n.provider;te(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function uL(n,e){let t=xy(e);if(t.to!=null&&(t.to=Gn(t.to,n)),t.from!=null){const r=t.from;t.from=Promise.all([n.getAddress(),Gn(r,n)]).then(([s,i])=>($(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else t.from=n.getAddress();return await On(t)}class _Z{constructor(e){W(this,"provider");Me(this,{provider:e||null})}async getNonce(e){return vu(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await uL(this,e)}async populateTransaction(e){const t=vu(this,"populateTransaction"),r=await uL(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 t.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 t.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 On(r)}async estimateGas(e){return vu(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return vu(this,"call").call(await this.populateCall(e))}async resolveName(e){return await vu(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=vu(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=hh.from(r);return await t.broadcastTransaction(await this.signTransaction(s))}}const fL=new Set;function xu(n){fL.has(n)||(fL.add(n),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${n} (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 FZ(n){return JSON.parse(JSON.stringify(n))}class dL{constructor(e){q(this,pa);q(this,Kn);q(this,ci);q(this,Kl);q(this,ha);q(this,Ql);q(this,bf);L(this,Kn,e),L(this,ci,null),L(this,Kl,fe(this,pa,IE).bind(this)),L(this,ha,!1),L(this,Ql,null),L(this,bf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,ha)||(L(this,ha,!0),fe(this,pa,IE).call(this,-2))}stop(){T(this,ha)&&(L(this,ha,!1),L(this,bf,!0),fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Kl)))}pause(e){e&&fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Kl))}resume(){this.start()}}Kn=new WeakMap,ci=new WeakMap,Kl=new WeakMap,ha=new WeakMap,Ql=new WeakMap,bf=new WeakMap,pa=new WeakSet,IE=async function(e){try{T(this,ci)==null&&L(this,ci,this._subscribe(T(this,Kn)));let t=null;try{t=await T(this,ci)}catch(i){if(!dn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(t==null){L(this,ci,null),T(this,Kn)._recoverSubscriber(this,this._recover(T(this,Kn)));return}const r=await T(this,Kn).getNetwork();if(T(this,Ql)||L(this,Ql,r),T(this,Ql).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,bf))return;const s=await T(this,Kn).send("eth_getFilterChanges",[t]);await this._emitResults(T(this,Kn),s)}catch(t){console.log("@TODO",t)}T(this,Kn).once("block",T(this,Kl))},LE=function(){const e=T(this,ci);e&&(L(this,ci,null),e.then(t=>{T(this,Kn).destroyed||T(this,Kn).send("eth_uninstallFilter",[t])}))};class jZ extends dL{constructor(t,r){super(t);q(this,Jl);L(this,Jl,FZ(r))}_recover(t){return new ex(t,T(this,Jl))}async _subscribe(t){return await t.send("eth_newFilter",[T(this,Jl)])}async _emitResults(t,r){for(const s of r)t.emit(T(this,Jl),t._wrapLog(s,t._network))}}Jl=new WeakMap;class UZ extends dL{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const r of t)e.emit("pending",r)}}const VZ="bigint,boolean,function,number,string,symbol".split(/,/g);function Iy(n){if(n==null||VZ.indexOf(typeof n)>=0||typeof n.getAddress=="function")return n;if(Array.isArray(n))return n.map(Iy);if(typeof n=="object")return Object.keys(n).reduce((e,t)=>(e[t]=n[t],e),{});throw new Error(`should not happen: ${n} (${typeof n})`)}function HZ(n){return new Promise(e=>{setTimeout(e,n)})}function Eu(n){return n&&n.toLowerCase()}function hL(n){return n&&typeof n.pollingInterval=="number"}const pL={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class ix extends _Z{constructor(t,r){super(t);W(this,"address");r=pt(r),Me(this,{address:r})}connect(t){te(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const r=Iy(t),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Gn(o,this.provider);$(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),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 Gn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(t);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const c=async()=>{try{const u=await this.provider.getTransaction(s);if(u!=null){i(u.replaceableTransaction(r));return}}catch(u){if(dn(u,"CANCELLED")||dn(u,"BAD_DATA")||dn(u,"NETWORK_ERROR")){u.info==null&&(u.info={}),u.info.sendTransactionHash=s,o(u);return}if(dn(u,"INVALID_ARGUMENT")&&(l++,u.info==null&&(u.info={}),u.info.sendTransactionHash=s,l>10)){o(u);return}this.provider.emit("error",Mt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{c()},a.pop()||4e3)};c()})}async signTransaction(t){const r=Iy(t);if(r.from){const i=await Gn(r.from,this.provider);$(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("personal_sign",[Ae(r),this.address.toLowerCase()])}async signTypedData(t,r,s){const i=Iy(s),o=await wy.resolveNames(t,r,i,async a=>{const l=await Gn(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(wy.getPayload(o.domain,r,o.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ae(r)])}}class mL extends Dy{constructor(t,r){super(t,r);q(this,Jh);q(this,ql);q(this,wf);q(this,io);q(this,ui);q(this,Ss);q(this,ts);q(this,ur);L(this,wf,1),L(this,ql,Object.assign({},pL,r||{})),L(this,io,[]),L(this,ui,null),L(this,ts,null),L(this,ur,null);{let i=null;const o=new Promise(a=>{i=a});L(this,Ss,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?($(!s||t!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&t!=null&&L(this,ts,tn.from(t))):s&&($(t==null||s.matches(t),"staticNetwork MUST match network object","options",r),L(this,ts,s))}_getOption(t){return T(this,ql)[t]}get _network(){return te(T(this,ts),"network is not available yet","NETWORK_ERROR"),T(this,ts)}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let s=t.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&&(t=Object.assign({},t,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(t);return r!=null?await this.send(r.method,r.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)if(t===!0){if(T(this,ts))return T(this,ts)}else return t;return T(this,ur)?await T(this,ur):this.ready?(L(this,ur,(async()=>{try{const r=tn.from(Ce(await this.send("eth_chainId",[])));return L(this,ur,null),r}catch(r){throw L(this,ur,null),r}})()),await T(this,ur)):(L(this,ur,(async()=>{const r={id:Xh(this,wf)._++,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,ur,null)}catch(i){throw L(this,ur,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return tn.from(Ce(s.result));throw this.getRpcError(r,s)})()),await T(this,ur))}_start(){T(this,Ss)==null||T(this,Ss).resolve==null||(T(this,Ss).resolve(),L(this,Ss,null),(async()=>{for(;T(this,ts)==null&&!this.destroyed;)try{L(this,ts,await this._detectNetwork())}catch(t){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",Mt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await HZ(1e3)}fe(this,Jh,BE).call(this)})())}async _waitUntilReady(){if(T(this,Ss)!=null)return await T(this,Ss).promise}_getSubscriber(t){return t.type==="pending"?new UZ(this):t.type==="event"?this._getOption("polling")?new ex(this,t.filter):new jZ(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new Py("orphan"):super._getSubscriber(t)}get ready(){return T(this,Ss)==null}getRpcTransaction(t){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(t[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=al(Ce(t[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{t[s]!=null&&(r[s]=Ae(t[s]))}),t.accessList&&(r.accessList=$o(t.accessList)),t.blobVersionedHashes&&(r.blobVersionedHashes=t.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(t){switch(t.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:[Eu(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Eu(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[Eu(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Eu(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(Eu):t.filter.address=Eu(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,r){const{method:s}=t,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return Mt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=ox(i),c=yu.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",t.params[0],l?l.data:null);return c.info={error:i,payload:t},c}const o=JSON.stringify($Z(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Mt("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:t,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=t.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Mt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Mt("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Mt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return Mt("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?Mt("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):Mt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,r){if(this.destroyed)return Promise.reject(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const s=Xh(this,wf)._++,i=new Promise((o,a)=>{T(this,io).push({resolve:o,reject:a,payload:{method:t,params:r,id:s,jsonrpc:"2.0"}})});return fe(this,Jh,BE).call(this),i}async getSigner(t){t==null&&(t=0);const r=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await r;if(t>=i.length)throw new Error("no such account");return new ix(this,i[t])}const{accounts:s}=await On({network:this.getNetwork(),accounts:r});t=pt(t);for(const i of s)if(pt(i)===t)return new ix(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new ix(this,r))}destroy(){T(this,ui)&&(clearTimeout(T(this,ui)),L(this,ui,null));for(const{payload:t,reject:r}of T(this,io))r(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));L(this,io,[]),super.destroy()}}ql=new WeakMap,wf=new WeakMap,io=new WeakMap,ui=new WeakMap,Ss=new WeakMap,ts=new WeakMap,ur=new WeakMap,Jh=new WeakSet,BE=function(){if(T(this,ui))return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");L(this,ui,setTimeout(()=>{L(this,ui,null);const r=T(this,io);for(L(this,io,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,ql).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,ql).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:c}of s){if(this.destroyed){l(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:c.method}));continue}const u=o.filter(f=>f.id===c.id)[0];if(u==null){const f=Mt("missing response for request","BAD_DATA",{value:o,info:{payload:c}});this.emit("error",f),l(f);continue}if("error"in u){l(this.getRpcError(c,u));continue}a(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},t))};class zZ extends mL{constructor(t,r){super(t,r);q(this,ma);let s=this._getOption("pollingInterval");s==null&&(s=pL.pollingInterval),L(this,ma,s)}_getSubscriber(t){const r=super._getSubscriber(t);return hL(r)&&(r.pollingInterval=T(this,ma)),r}get pollingInterval(){return T(this,ma)}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");L(this,ma,t),this._forEachSubscriber(r=>{hL(r)&&(r.pollingInterval=T(this,ma))})}}ma=new WeakMap;class Fi extends zZ{constructor(t,r,s){t==null&&(t="http://localhost:8545");super(r,s);q(this,Af);typeof t=="string"?L(this,Af,new zn(t)):L(this,Af,t.clone())}_getConnection(){return T(this,Af).clone()}async send(t,r){return await this._start(),await super.send(t,r)}async _send(t){const r=this._getConnection();r.body=JSON.stringify(t),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Af=new WeakMap;function ox(n){if(n==null)return null;if(typeof n.message=="string"&&n.message.match(/revert/i)&&Ct(n.data))return{message:n.message,data:n.data};if(typeof n=="object"){for(const e in n){const t=ox(n[e]);if(t)return t}return null}if(typeof n=="string")try{return ox(JSON.parse(n))}catch{}return null}function ax(n,e){if(n!=null){if(typeof n.message=="string"&&e.push(n.message),typeof n=="object")for(const t in n)ax(n[t],e);if(typeof n=="string")try{return ax(JSON.parse(n),e)}catch{}}}function $Z(n){const e=[];return ax(n,e),e}const Ly="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function GZ(n){switch(n){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",n)}class By extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Ly);const i={polling:!0,staticNetwork:s},o=By.getRequest(s,r);super(o,s,i);W(this,"apiKey");Me(this,{apiKey:r})}_getProvider(t){try{return new By(t,this.apiKey)}catch{}return super._getProvider(t)}static getRequest(t,r){r==null&&(r=Ly);const s=new zn(`https://${GZ(t.name)}/${r}`);return s.allowGzip=!0,r===Ly&&(s.retryFunc=async(i,o,a)=>(xu("AnkrProvider"),!0)),s}getRpcError(t,r){return t.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(t,r)}isCommunityResource(){return this.apiKey===Ly}}const _y="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function WZ(n){switch(n){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",n)}class Fy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=_y);const i=Fy.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Me(this,{apiKey:r})}_getProvider(t){try{return new Fy(t,this.apiKey)}catch{}return super._getProvider(t)}async _perform(t){if(t.method==="getTransactionResult"){const{trace:r,tx:s}=await On({trace:this.send("trace_transaction",[t.hash]),tx:this.getTransaction(t.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(t)}isCommunityResource(){return this.apiKey===_y}static getRequest(t,r){r==null&&(r=_y);const s=new zn(`https://${WZ(t.name)}/v2/${r}`);return s.allowGzip=!0,r===_y&&(s.retryFunc=async(i,o,a)=>(xu("alchemy"),!0)),s}}function jy(n){switch(n){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}$(!1,"unsupported network","network",n)}function KZ(n){switch(n){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",n)}class Uy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=jy(s.name));const i=Uy.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Me(this,{apiKey:r})}_getProvider(t){try{return new Uy(t,this.apiKey)}catch{}return super._getProvider(t)}isCommunityResource(){return this.apiKey===jy(this._network.name)}static getRequest(t,r){r==null&&(r=jy(t.name));const s=new zn(`https://${KZ(t.name)}/${r}`);return s.allowGzip=!0,r===jy(t.name)&&(s.retryFunc=async(i,o,a)=>(xu("ChainstackProvider"),!0)),s}}class QZ extends Fi{constructor(e){e==null&&(e="mainnet");const t=tn.from(e);$(t.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",t,{staticNetwork:t})}}const gL=2e3;function JZ(n){return n&&typeof n.then=="function"}const qZ="org.ethers.plugins.provider.Etherscan",YZ=["enableCcipRead"];let XZ=1;class ZZ extends Dy{constructor(t,r){const s=r??null;super();W(this,"network");W(this,"apiKey");q(this,vf);const i=tn.from(t);L(this,vf,i.getPlugin(qZ)),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(t,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=${t}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(t,r,s){const i=XZ++,o=s?this.getPostUrl():this.getUrl(t,r),a=s?this.getPostData(t,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new zn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&xu("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(iu(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return t==="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,gL)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,gL)),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 c=await l.send();try{c.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),te(!1,"response error","SERVER_ERROR",{request:l,response:c})}c.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),te(!1,"missing response","SERVER_ERROR",{request:l,response:c}));const u=JSON.parse(iu(c.body));return t==="proxy"?(u.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"invalid JSON-RPC"}),te(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:c,info:{result:u}})),u.error&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"JSON-RPC error"}),te(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):u.status==0&&(u.message==="No records found"||u.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):((u.status!=1||typeof u.message=="string"&&!u.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:u}),te(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result)}_getTransactionPostData(t){const r={};for(let s in t){if(YZ.indexOf(s)>=0||t[s]==null)continue;let i=t[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=al(i);else if(s==="accessList")i="["+$o(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:t}})}else i=Ae(i);r[s]=i}}return r}_checkError(t,r,s){let i="";if(dn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(t.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&te(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.transaction}),(t.method==="call"||t.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=yu.getBuiltinCallException(t.method,t.transaction,o);throw a.info={request:t,error:r},a}if(i&&t.method==="broadcastTransaction"){const o=hh.from(t.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(t){switch(t.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:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(r=>this._checkError(t,r,t.signedTransaction));case"getBlock":if("blockTag"in t)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.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:t.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.hash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}}return super._perform(t)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(t){let r=this._getAddress(t);JZ(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new wu(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}vf=new WeakMap;function eee(){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 tee=eee().WebSocket;class lx{constructor(e,t){q(this,fi);q(this,qh);q(this,ga);q(this,Yl);q(this,ya);L(this,fi,e),L(this,qh,JSON.stringify(t)),L(this,ga,null),L(this,Yl,null),L(this,ya,null)}get filter(){return JSON.parse(T(this,qh))}start(){L(this,ga,T(this,fi).send("eth_subscribe",this.filter).then(e=>(T(this,fi)._register(e,this),e)))}stop(){T(this,ga).then(e=>{T(this,fi).destroyed||T(this,fi).send("eth_unsubscribe",[e])}),L(this,ga,null)}pause(e){te(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),L(this,Yl,!!e)}resume(){L(this,Yl,null)}_handleMessage(e){if(T(this,ga)!=null&&T(this,Yl)===null){let t=T(this,ya);t==null?t=this._emit(T(this,fi),e):t=t.then(async()=>{await this._emit(T(this,fi),e)}),L(this,ya,t.then(()=>{T(this,ya)===t&&L(this,ya,null)}))}}async _emit(e,t){throw new Error("sub-classes must implemente this; _emit")}}fi=new WeakMap,qh=new WeakMap,ga=new WeakMap,Yl=new WeakMap,ya=new WeakMap;class nee extends lx{constructor(e){super(e,["newHeads"])}async _emit(e,t){e.emit("block",parseInt(t.number))}}class ree extends lx{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,t){e.emit("pending",t)}}class see extends lx{constructor(t,r){super(t,["logs",r]);q(this,Yh);L(this,Yh,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Yh))}async _emit(t,r){t.emit(this.logFilter,t._wrapLog(r,t._network))}}Yh=new WeakMap;class iee extends mL{constructor(t,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(t,s);q(this,Xl);q(this,xf);q(this,ba);L(this,Xl,new Map),L(this,xf,new Map),L(this,ba,new Map)}_getSubscriber(t){switch(t.type){case"close":return new Py("close");case"block":return new nee(this);case"pending":return new ree(this);case"event":return new see(this,t.filter);case"orphan":if(t.filter.orphan==="drop-log")return new Py("drop-log")}return super._getSubscriber(t)}_register(t,r){T(this,xf).set(t,r);const s=T(this,ba).get(t);if(s){for(const i of s)r._handleMessage(i);T(this,ba).delete(t)}}async _send(t){$(!Array.isArray(t),"WebSocket does not support batch send","payload",t);const r=new Promise((s,i)=>{T(this,Xl).set(t.id,{payload:t,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(t)),[await r]}async _processMessage(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&"id"in r){const s=T(this,Xl).get(r.id);if(s==null){this.emit("error",Mt("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,Xl).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,xf).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,ba).get(s);o==null&&(o=[],T(this,ba).set(s,o)),o.push(r.params.result)}}else{this.emit("error",Mt("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(t){throw new Error("sub-classes must override this")}}Xl=new WeakMap,xf=new WeakMap,ba=new WeakMap;class yL extends iee{constructor(t,r,s){super(r,s);q(this,Zl);q(this,Ts);typeof t=="string"?(L(this,Zl,()=>new tee(t)),L(this,Ts,T(this,Zl).call(this))):typeof t=="function"?(L(this,Zl,t),L(this,Ts,t())):(L(this,Zl,null),L(this,Ts,t)),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,Ts)==null)throw new Error("websocket closed");return T(this,Ts)}async _write(t){this.websocket.send(t)}async destroy(){T(this,Ts)!=null&&(T(this,Ts).close(),L(this,Ts,null)),super.destroy()}}Zl=new WeakMap,Ts=new WeakMap;const Ah="84842078b09946638c03157f83405213";function oee(n){switch(n){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",n)}class aee extends yL{constructor(t,r){const s=new vh(t,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);W(this,"projectId");W(this,"projectSecret");Me(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Ah}}class vh extends Fi{constructor(t,r,s){t==null&&(t="mainnet");const i=tn.from(t);r==null&&(r=Ah),s==null&&(s=null);const o=vh.getRequest(i,r,s);super(o,i,{staticNetwork:i});W(this,"projectId");W(this,"projectSecret");Me(this,{projectId:r,projectSecret:s})}_getProvider(t){try{return new vh(t,this.projectId,this.projectSecret)}catch{}return super._getProvider(t)}isCommunityResource(){return this.projectId===Ah}static getWebSocketProvider(t,r){return new aee(t,r)}static getRequest(t,r,s){r==null&&(r=Ah),s==null&&(s=null);const i=new zn(`https://${oee(t.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Ah&&(i.retryFunc=async(o,a,l)=>(xu("InfuraProvider"),!0)),i}}const Vy="919b412a057b5e9c9b6dce193c5a60242d6efadb";function lee(n){switch(n){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",n)}class Hy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Vy);const i=Hy.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"token");Me(this,{token:r})}_getProvider(t){try{return new Hy(t,this.token)}catch{}return super._getProvider(t)}isCommunityResource(){return this.token===Vy}static getRequest(t,r){r==null&&(r=Vy);const s=new zn(`https://${lee(t.name)}/${r}`);return s.allowGzip=!0,r===Vy&&(s.retryFunc=async(i,o,a)=>(xu("QuickNodeProvider"),!0)),s}}const cee=BigInt("1"),uee=BigInt("2");function fee(n){for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}}function dee(n){return new Promise(e=>{setTimeout(e,n)})}function cx(){return new Date().getTime()}function ux(n){return JSON.stringify(n,(e,t)=>typeof t=="bigint"?{type:"bigint",value:t.toString()}:t)}const bL={stallTimeout:400,priority:1,weight:1},wL={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 hee(n,e){for(;(n.blockNumber<0||n.blockNumber<e)&&(n._updateNumber||(n._updateNumber=(async()=>{try{const t=await n.provider.getBlockNumber();t>n.blockNumber&&(n.blockNumber=t)}catch(t){n.blockNumber=-2,n._lastFatalError=t,n._lastFatalErrorTimestamp=cx()}n._updateNumber=null})()),await n._updateNumber,n.outOfSync++,!n._lastFatalError););}function xh(n){if(n==null)return"null";if(Array.isArray(n))return"["+n.map(xh).join(",")+"]";if(typeof n=="object"&&typeof n.toJSON=="function")return xh(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":case"number":return BigInt(n).toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{"+e.map(t=>`${JSON.stringify(t)}:${xh(n[t])}`).join(",")+"}"}}throw console.log("Could not serialize",n),new Error("Hmm...")}function fx(n){if("error"in n){const t=n.error;return{tag:xh(t),value:t}}const e=n.result;return{tag:xh(e),value:e}}function zy(n,e){const t=new Map;for(const{value:s,tag:i,weight:o}of e){const a=t.get(i)||{value:s,weight:0};a.weight+=o,t.set(i,a)}let r=null;for(const s of t.values())s.weight>=n&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function dx(n,e){let t=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:c}of e)if(a instanceof Error){const u=r.get(l)||{value:a,weight:0};u.weight+=c,r.set(l,u),(s==null||u.weight>s.weight)&&(s=u)}else i.push(BigInt(a)),t+=c;if(t<n)return s&&s.weight>=n?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]+cee)/uee}function hx(n,e){const t=zy(n,e);if(t!==void 0)return t;for(const r of e)if(r.value)return r.value}function pee(n,e){if(n===1)return Je(dx(n,e),"%internal");const t=new Map,r=(o,a)=>{const l=t.get(o)||{result:o,weight:0};l.weight+=a,t.set(o,l)};for(const{weight:o,value:a}of e){const l=Je(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of t.values())o>=n&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class mee extends Dy{constructor(t,r,s){super(r,s);q(this,dr);W(this,"quorum");W(this,"eventQuorum");W(this,"eventWorkers");q(this,fr);q(this,oo);q(this,Ef);L(this,fr,t.map(i=>i instanceof Dy?Object.assign({provider:i},bL,wL):Object.assign({},bL,i,wL))),L(this,oo,-2),L(this,Ef,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,fr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,$(this.quorum<=T(this,fr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,fr).map(t=>{const r=Object.assign({},t);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return tn.from(Ce(await this._perform({method:"chainId"})))}async _translatePerform(t,r){switch(r.method){case"broadcastTransaction":return await t.broadcastTransaction(r.signedTransaction);case"call":return await t.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await t.getNetwork()).chainId;case"estimateGas":return await t.estimateGas(r.transaction);case"getBalance":return await t.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await t.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await t.getBlockNumber();case"getCode":return await t.getCode(r.address,r.blockTag);case"getGasPrice":return(await t.getFeeData()).gasPrice;case"getPriorityFee":return(await t.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await t.getLogs(r.filter);case"getStorage":return await t.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await t.getTransaction(r.hash);case"getTransactionCount":return await t.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await t.getTransactionReceipt(r.hash);case"getTransactionResult":return await t.getTransactionResult(r.hash)}}async _perform(t){if(t.method==="broadcastTransaction"){const o=T(this,fr).map(c=>null),a=T(this,fr).map(async({provider:c,weight:u},f)=>{try{const d=await c._perform(t);o[f]=Object.assign(fx({result:d}),{weight:u})}catch(d){o[f]=Object.assign(fx({error:d}),{weight:u})}});for(;;){const c=o.filter(d=>d!=null);for(const{value:d}of c)if(!(d instanceof Error))return d;const u=zy(this.quorum,o.filter(d=>d!=null));if(dn(u,"INSUFFICIENT_FUNDS"))throw u;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=hx(this.quorum,o);if(te(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:t,results:o.map(ux)}}),l instanceof Error)throw l;return l}await fe(this,dr,hF).call(this);const r=new Set;let s=0;for(;;){const o=fe(this,dr,_E).call(this,r,t);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await fe(this,dr,FE).call(this,r,t);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:t}of T(this,fr))t.destroy();super.destroy()}}fr=new WeakMap,oo=new WeakMap,Ef=new WeakMap,dr=new WeakSet,dF=function(t){const r=Array.from(t).map(i=>i.config),s=T(this,fr).slice();fee(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},_E=function(t,r){const s=fe(this,dr,dF).call(this,t);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=cx();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=cx()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await dee(s.stallTimeout),i.staller=null})(),t.add(i),i},hF=async function(){let t=T(this,Ef);if(!t){const r=[];T(this,fr).forEach(s=>{r.push((async()=>{await hee(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),L(this,Ef,t=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,fr)){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 t},pF=async function(t,r){const s=[];for(const i of t)if(i.result!=null){const{tag:o,value:a}=fx(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,oo)===-2&&L(this,oo,Math.ceil(Je(dx(this.quorum,T(this,fr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Je(o.blockNumber).toString(),weight:o.weight}))))));const i=pee(this.quorum,s);return i===void 0?void 0:(i>T(this,oo)&&L(this,oo,i),T(this,oo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return dx(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?hx(this.quorum,s):zy(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return zy(this.quorum,s);case"broadcastTransaction":return hx(this.quorum,s)}te(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${ux(r.method)})`})}},FE=async function(t,r){if(t.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of t){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await fe(this,dr,pF).call(this,t,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)fe(this,dr,_E).call(this,t,r);return te(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(t).map(a=>ux(a.result))}}),await Promise.race(s),await fe(this,dr,FE).call(this,t,r)};function gee(n){return n&&typeof n.send=="function"&&typeof n.close=="function"}const yee="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function bee(n,e){e==null&&(e={});const t=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof n=="string"&&n.match(/^https?:/))return new Fi(n);if(typeof n=="string"&&n.match(/^wss?:/)||gee(n))return new yL(n);let r=null;try{r=tn.from(n)}catch{}const s=[];if(t("publicPolygon")&&r&&(r.name==="matic"?s.push(new Fi("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Fi("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),t("alchemy"))try{s.push(new Fy(n,e.alchemy))}catch{}if(t("ankr")&&e.ankr!=null)try{s.push(new By(n,e.ankr))}catch{}if(t("chainstack"))try{s.push(new Uy(n,e.chainstack))}catch{}if(t("cloudflare"))try{s.push(new QZ(n))}catch{}if(t("etherscan"))try{s.push(new ZZ(n,e.etherscan))}catch{}if(t("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new vh(n,o,a))}catch{}if(t("quicknode"))try{let o=e.quicknode;s.push(new Hy(n,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&&yee.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new mee(s,void 0,{quorum:i})}const wee=async(n,e)=>{const t={name:n,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!mY(n))return t;try{const r=await Aee(n,e);r&&(t.name=r,t.isEns=!0)}catch(r){console.log(r)}return t},Aee=async(n,e)=>await vee(e).lookupAddress(n),vee=n=>bee(n),xee=(n,e,t)=>{if((n==null?void 0:n.length)>t){const r=n.substring(0,e),s=n.substring((n==null?void 0:n.length)-e);return`${r}...${s}`}return n};function Eee(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=n,a=aV(t),l=new RegExp(`\\s${a}$`),c=i?"^":"",u=r?new RegExp(`${c}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${c}(?:^)?${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(u)).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 y=d+h.index;let b=y+h[0].length;return r&&l.test(f.slice(b-1,b+1))&&(h[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:h[0].slice(t.length),text:h[0]}:null}const Cee=new Rt("suggestion");function kee({pluginKey:n=Cee,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:c=()=>[],render:u=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=Eee}){let h;const p=u==null?void 0:u(),m=new At({key:n,view(){return{update:async(y,b)=>{var v,A,w,x,C,S,M;const R=(v=this.key)===null||v===void 0?void 0:v.getState(b),O=(A=this.key)===null||A===void 0?void 0:A.getState(y.state),D=R.active&&O.active&&R.range.from!==O.range.from,_=!R.active&&O.active,F=R.active&&!O.active,G=!_&&!F&&R.query!==O.query,B=_||D,V=G&&!D,Q=F||D;if(!B&&!V&&!Q)return;const ee=Q&&!B?R:O,Z=y.dom.querySelector(`[data-decoration-id="${ee.decorationId}"]`);h={editor:e,range:ee.range,query:ee.query,text:ee.text,items:[],command:he=>l({editor:e,range:ee.range,props:he}),decorationNode:Z,clientRect:Z?()=>{var he;const{decorationId:ke}=(he=this.key)===null||he===void 0?void 0:he.getState(e.state),Se=y.dom.querySelector(`[data-decoration-id="${ke}"]`);return(Se==null?void 0:Se.getBoundingClientRect())||null}:null},B&&((w=p==null?void 0:p.onBeforeStart)===null||w===void 0||w.call(p,h)),V&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),(V||B)&&(h.items=await c({editor:e,query:ee.query})),Q&&((C=p==null?void 0:p.onExit)===null||C===void 0||C.call(p,h)),V&&((S=p==null?void 0:p.onUpdate)===null||S===void 0||S.call(p,h)),B&&((M=p==null?void 0:p.onStart)===null||M===void 0||M.call(p,h))},destroy:()=>{var y;h&&((y=p==null?void 0:p.onExit)===null||y===void 0||y.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,b,v,A){const{isEditable:w}=e,{composing:x}=e.view,{selection:C}=y,{empty:S,from:M}=C,R={...b};if(R.composing=x,w&&(S||e.view.composing)){(M<b.range.from||M>b.range.to)&&!x&&!b.composing&&(R.active=!1);const O=d({char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:C.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;O&&f({editor:e,state:A,range:O.range})?(R.active=!0,R.decorationId=b.decorationId?b.decorationId:D,R.range=O.range,R.query=O.query,R.text=O.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(y,b){var v;const{active:A,range:w}=m.getState(y.state);return A&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:y,event:b,range:w}))||!1},decorations(y){const{active:b,range:v,decorationId:A}=m.getState(y);return b?vt.create(y.doc,[en.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":A})]):null}}});return m}var See=typeof Yn=="object"&&Yn&&Yn.Object===Object&&Yn,Tee=typeof self=="object"&&self&&self.Object===Object&&self;See||Tee||Function("return this")();var AL=typeof window<"u"?P.useLayoutEffect:P.useEffect;function Oee(n,e,t,r){const s=P.useRef(e);AL(()=>{s.current=e},[e]),P.useEffect(()=>{const i=window;if(!(i&&i.addEventListener))return;const o=a=>{s.current(a)};return i.addEventListener(n,o,r),()=>{i.removeEventListener(n,o,r)}},[n,t,r])}var Nee=typeof window>"u";function vL(n,{defaultValue:e=!1,initializeWithValue:t=!0}={}){const r=a=>Nee?e:window.matchMedia(a).matches,[s,i]=P.useState(()=>t?r(n):e);function o(){i(r(n))}return AL(()=>{const a=window.matchMedia(n);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[n]),s}function Mee(n,e,t="mousedown",r={}){Oee(t,s=>{const i=s.target;if(!i||!i.isConnected)return;(Array.isArray(n)?n.filter(a=>!!a.current).every(a=>a.current&&!a.current.contains(i)):n.current&&!n.current.contains(i))&&e(s)},void 0,r)}const Ree=Ot.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[kee({editor:this.editor,...this.options.suggestion})]}}),Pee=({query:n,uploadToIpfs:e})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:k.jsx(mT,{size:18}),image:"",command:({editor:t,range:r})=>{t.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:k.jsx(pT,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:k.jsx(zp,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:k.jsx($p,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:k.jsx(Gp,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:k.jsx(Wp,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:k.jsx(Cc,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:k.jsx(d8,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:k.jsx(Kp,{size:18}),image:"",command:({editor:t,range:r})=>t.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:k.jsx(cd,{size:18}),image:"",command:({editor:t,range:r})=>t.chain().focus().deleteRange(r).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:k.jsx(ow,{size:18}),image:"",command:({editor:t,range:r})=>t.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:k.jsx(c8,{size:18}),image:"",command:({editor:t,range:r})=>{t.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=t.view.state.selection.from;uw(o,t.view,a,e)}},s.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:k.jsx(yT,{}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:k.jsx(gT,{}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:k.jsx(fT,{}),image:"",command:({editor:t})=>{t.chain().focus().setColumns(2).focus(t.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:k.jsx(i8,{}),image:"",command:({editor:t})=>{t.chain().focus().setColumns(3).focus(t.state.selection.head-1).run()}}].filter(t=>{if(typeof n=="string"&&n.length>0){const r=n.toLowerCase();return t.title.toLowerCase().includes(r)||t.description.toLowerCase().includes(r)||t.searchTerms&&t.searchTerms.some(s=>s.includes(r))}return!0}),Dee=(n,e)=>{const t=n.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<n.scrollTop?n.scrollTop-=n.scrollTop-s+5:i>t+n.scrollTop&&(n.scrollTop+=i-t-n.scrollTop+5)},Iee=({items:n,command:e,editor:t})=>{const[r,s]=P.useState(0),[i,o]=P.useState(n),a=vL("(max-width: 640px)"),l=P.useCallback(u=>{const f=i[u];f&&(f.title==="Continue writing"||e(f))},[e,t,i]);P.useEffect(()=>{if(a){const u=i.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(u)}else o(n)},[n,a]),P.useEffect(()=>{const u=["ArrowUp","ArrowDown","Enter"],f=d=>{if(u.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]),P.useEffect(()=>{s(0)},[i]);const c=P.useRef(null);return P.useLayoutEffect(()=>{const u=c==null?void 0:c.current,f=u==null?void 0:u.children[r];f&&u&&Dee(u,f)},[r]),i.length>0?k.jsx("div",{id:"slash-command",ref:c,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((u,f)=>k.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:[k.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:u.icon}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium",children:u.title}),k.jsx("p",{className:"text-xs text-neutral-500",children:u.description})]})]},f))}):null},Lee=()=>{let n=null,e=null;return{onStart:t=>{n=new lT(Iee,{props:t,editor:t.editor}),e=Ba("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:t=>{n==null||n.updateProps(t),e&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown:t=>{var r;return t.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=n==null?void 0:n.ref)==null?void 0:r.onKeyDown(t)},onExit:()=>{e==null||e[0].destroy(),n==null||n.destroy()}}},Bee=n=>{const e=({query:t})=>Pee({query:t,uploadToIpfs:n});return Ree.configure({suggestion:{items:e,render:Lee}})},xL=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],_ee=({isPreviewMode:n,initialContent:e,enableCollaboration:t,collaborationId:r,walletAddress:s,username:i,onAutoSave:o,onChange:a,onCollaboratorChange:l,onCommentInteraction:c,onTextSelection:u,ensResolutionUrl:f,handleImageUploadToIpfs:d})=>{var F,G;const[h]=P.useState(new Ka),[p,m]=P.useState(!1),[y,b]=P.useState([...xJ,Bee(d)]),v=P.useRef(!1),A=(B,V)=>{var ee;const Q=V.target;if(Q&&Q.nodeName==="MARK"&&Q.dataset.color&&((ee=Q==null?void 0:Q.dataset)==null?void 0:ee.color)==="yellow"){const Z=Q.textContent,he=B.posAtCoords({left:V.clientX,top:V.clientY});if(he){const{state:ke}=B;let Se=he.pos,Ee=he.pos;if(ke.doc.nodesBetween(Se,Ee,(be,Fe)=>{be.marks&&be.marks.length&&be.marks.forEach(je=>{je.type.name==="highlight"&&(Se=Fe,Ee=Fe+be.nodeSize)})}),Se!==Ee){const be={text:Z,from:Se,to:Ee};c==null||c(be)}}}},w=(B,V,Q)=>{A(B,Q)},x=nT({extensions:y,editorProps:{...cM,handleDOMEvents:{mouseover:A,keydown:(B,V)=>{if(V.key==="Enter")return!0}},handleClick:w},autofocus:"start",onUpdate:B=>{O!=null&&O.isEmpty||a==null||a(B.editor.getJSON())}},[y]),C=nT({extensions:y,editorProps:{...cM,handleDOMEvents:{mouseover:A,keydown:(B,V)=>{if(V.key==="Enter")return!0}},handleClick:w},autofocus:"start",onUpdate:B=>{O!=null&&O.isEmpty||a==null||a(B.editor.getJSON())}}),S=P.useRef(()=>{}),M=(B,V=!1)=>{if(!t||!r)throw new Error("docId or username is not provided");m(!0);const Q=new wG(r,h,{signaling:["wss://fileverse-signaling-server-0529292ff51c.herokuapp.com/"]});b([...y,GG.configure({document:h}),WG.configure({provider:Q,user:{name:B&&B.length>20?xee(B,7,15):B,color:xL[Math.floor(Math.random()*xL.length)],isEns:V},render:TJ})]);const ee=setTimeout(()=>{m(!1)},100);return S.current=()=>{clearTimeout(ee),Q.destroy(),h.destroy(),m(!1)},S.current},R=P.useRef(null),O=P.useMemo(()=>t&&r&&x&&!p?x:C,[x,C,p]);P.useEffect(()=>{O==null||O.setEditable(!n)},[n,O]),P.useEffect(()=>{e&&O&&!v.current&&(O.commands.setContent(e),v.current=!0),setTimeout(()=>{v.current=!1})},[e,O]),P.useEffect(()=>{if(!O)return;const B=()=>{const{state:V}=O,{from:Q,to:ee}=V.selection;if(Q!==ee){const Z=V.doc.textBetween(Q,ee," ");u==null||u({text:Z,from:Q,to:ee})}};return O.on("selectionUpdate",B),()=>{O.off("selectionUpdate",B)}},[O]);const D=async()=>{let B=i,V=!1;if(s&&f){const{name:Q,isEns:ee}=await wee(s,f);B=Q,V=ee}if(!B)throw new Error("Cannot start collaboration without a username");M(B,V)};P.useEffect(()=>{t?D():S.current()},[t]);const _=P.useMemo(()=>Tv((B,V)=>{V({editorJSONData:B.getJSON()})},1e3),[o]);return P.useEffect(()=>{if(O&&o){const B=()=>{_(O,o)};return O.on("update",B),()=>{O.off("update",B)}}},[O,o,_]),P.useEffect(()=>{var B,V;l==null||l((V=(B=O==null?void 0:O.storage)==null?void 0:B.collaborationCursor)==null?void 0:V.users)},[(G=(F=O==null?void 0:O.storage)==null?void 0:F.collaborationCursor)==null?void 0:G.users]),{editor:O,ref:R,loading:p,connect:M,ydoc:h}},Fee=({title:n,content:e,contentClassName:t,open:r,onOpenChange:s,primaryAction:i,secondaryAction:o})=>k.jsx(x6,{open:r,onOpenChange:s,children:k.jsxs(LO,{className:"max-w-md sm:w-full w-[90%] z-20",children:[k.jsx(BO,{className:"px-4 pt-0 border-b-[1px]",children:k.jsx(FO,{className:"text-left text-base",children:n})}),k.jsx("div",{className:pe("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",t),children:e&&e}),k.jsxs(_O,{className:"px-5 pb-5 justify-end sm:",children:[o&&k.jsx(k6,{asChild:!0,children:k.jsx(Ha,{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&&k.jsx(Ha,{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})]})]})}),jee=({editor:n,uploadToIpfs:e})=>{const{toolVisibilty:t,setToolVisibility:r,bottomToolbar:s}=Qw({editor:n,uploadToIpfs:e}),i=vL("(max-width: 1023px)"),[o,a]=P.useState(""),[l,c]=P.useState(""),[u,f]=P.useState(!0),d=()=>{if(o===null){f(!1);return}if(o===""){n.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,})?$/)&&n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0)}catch{console.error("Invalid URL"),f(!1);return}n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0),r(De.NONE)},h=m=>{const{from:y,to:b}=m.state.selection;return m.state.doc.textBetween(y,b)},p=P.useRef(null);return P.useEffect(()=>{let m=0;const y=()=>{m=Date.now()},b=()=>{var w;if(Date.now()-m>500){const{selection:x}=n.state;x.from!==x.to&&((w=p.current)==null||w.click())}},v=()=>{var x;if(!i)return;const{selection:A}=n.state;A.from!==A.to&&((x=p.current)==null||x.click())};return i?(document.addEventListener("touchstart",y),document.addEventListener("touchend",b)):document.addEventListener("mouseup",v),()=>{i?(document.removeEventListener("touchstart",y),document.removeEventListener("touchend",b)):document.removeEventListener("mouseup",v)}},[n,i]),k.jsxs(OO,{children:[k.jsx("div",{className:"flex w-full justify-between sm:justify-evenly select-none",children:s.map(m=>{if(m)return k.jsx("div",{className:"flex items-center",children:m.title==="Text formating"?k.jsx(NO,{asChild:!0,children:k.jsx("button",{ref:p,onClick:()=>m.onClick(),children:m.icon})}):m.title==="Text color"?k.jsx(NO,{asChild:!0,children:k.jsx("button",{onClick:()=>m.onClick(),children:m.icon})}):k.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)})}),t===De.TEXT_FORMATING&&k.jsx(dz,{editor:n,setToolVisibility:r}),t===De.LINK_POPUP&&k.jsx(Fee,{open:t===De.LINK_POPUP,onOpenChange:()=>r(De.NONE),title:"Link",content:k.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[k.jsx(dm,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:h(n),onChange:m=>c(m.target.value)}),k.jsx(dm,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:n.getAttributes("link").href,onChange:m=>{a(m.target.value)},isValid:u,message:u?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>d(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>r(De.NONE),className:"w-auto min-w-[80px]"}})]})},px=P.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"}),$y=P.createContext({}),Gy=P.createContext(null),mx=typeof document<"u",gx=mx?P.useLayoutEffect:P.useEffect,EL=P.createContext({strict:!1}),yx=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),CL="data-"+yx("framerAppearId"),Uee={skipAnimations:!1,useManualTiming:!1};class kL{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 t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function Vee(n){let e=new kL,t=new kL,r=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,c=!1,u=!1)=>{const f=u&&s,d=f?e:t;return c&&o.add(l),d.add(l)&&f&&s&&(r=e.order.length),l},cancel:l=>{t.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[e,t]=[t,e],t.clear(),r=e.order.length,r)for(let c=0;c<r;c++){const u=e.order[c];o.has(u)&&(a.schedule(u),n()),u(l)}s=!1,i&&(i=!1,a.process(l))}};return a}const Wy=["read","resolveKeyframes","update","preRender","render","postRender"],Hee=40;function SL(n,e){let t=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=Wy.reduce((f,d)=>(f[d]=Vee(()=>t=!0),f),{}),o=f=>{i[f].process(s)},a=()=>{const f=performance.now();t=!1,s.delta=r?1e3/60:Math.max(Math.min(f-s.timestamp,Hee),1),s.timestamp=f,s.isProcessing=!0,Wy.forEach(o),s.isProcessing=!1,t&&e&&(r=!1,n(a))},l=()=>{t=!0,r=!0,s.isProcessing||n(a)};return{schedule:Wy.reduce((f,d)=>{const h=i[d];return f[d]=(p,m=!1,y=!1)=>(t||l(),h.schedule(p,m,y)),f},{}),cancel:f=>Wy.forEach(d=>i[d].cancel(f)),state:s,steps:i}}const{schedule:bx,cancel:Xie}=SL(queueMicrotask,!1);function Cu(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}const TL=P.createContext({});let OL=!1;function zee(n,e,t,r,s){const{visualElement:i}=P.useContext($y),o=P.useContext(EL),a=P.useContext(Gy),l=P.useContext(px).reducedMotion,c=P.useRef();r=r||o.renderer,!c.current&&r&&(c.current=r(n,{visualState:e,parent:i,props:t,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const u=c.current,f=P.useContext(TL);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&Gee(c.current,t,s,f),P.useInsertionEffect(()=>{u&&u.update(t,a)});const d=P.useRef(!!(t[CL]&&!window.HandoffComplete));return gx(()=>{u&&(u.updateFeatures(),bx.render(u.render),d.current&&u.animationState&&u.animationState.animateChanges())}),P.useEffect(()=>{u&&(!d.current&&u.animationState&&u.animationState.animateChanges(),d.current&&(d.current=!1,OL||(OL=!0,queueMicrotask($ee))))}),u}function $ee(){window.HandoffComplete=!0}function Gee(n,e,t,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:NL(n.parent)),n.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Cu(a),visualElement:n,scheduleRender:()=>n.scheduleRender(),animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:c})}function NL(n){if(n)return n.options.allowProjection!==!1?n.projection:NL(n.parent)}function Wee(n,e,t){return P.useCallback(r=>{r&&n.mount&&n.mount(r),e&&(r?e.mount(r):e.unmount()),t&&(typeof t=="function"?t(r):Cu(t)&&(t.current=r))},[e])}function Eh(n){return typeof n=="string"||Array.isArray(n)}function Ky(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const wx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ax=["initial",...wx];function Qy(n){return Ky(n.animate)||Ax.some(e=>Eh(n[e]))}function ML(n){return!!(Qy(n)||n.variants)}function Kee(n,e){if(Qy(n)){const{initial:t,animate:r}=n;return{initial:t===!1||Eh(t)?t:void 0,animate:Eh(r)?r:void 0}}return n.inherit!==!1?e:{}}function Qee(n){const{initial:e,animate:t}=Kee(n,P.useContext($y));return P.useMemo(()=>({initial:e,animate:t}),[RL(e),RL(t)])}function RL(n){return Array.isArray(n)?n.join(" "):n}const PL={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"]},ku={};for(const n in PL)ku[n]={isEnabled:e=>PL[n].some(t=>!!e[t])};function Jee(n){for(const e in n)ku[e]={...ku[e],...n[e]}}const vx=P.createContext({}),qee=Symbol.for("motionComponentSymbol"),xn=n=>n;let Su=xn,ji=xn;process.env.NODE_ENV!=="production"&&(Su=(n,e)=>{!n&&typeof console<"u"&&console.warn(e)},ji=(n,e)=>{if(!n)throw new Error(e)});function Yee({preloadedFeatures:n,createVisualElement:e,useRender:t,useVisualState:r,Component:s}){n&&Jee(n);function i(a,l){let c;const u={...P.useContext(px),...a,layoutId:Xee(a)},{isStatic:f}=u,d=Qee(a),h=r(a,f);if(!f&&mx){Zee(u,n);const p=ete(u);c=p.MeasureLayout,d.visualElement=zee(s,h,u,e,p.ProjectionNode)}return k.jsxs($y.Provider,{value:d,children:[c&&d.visualElement?k.jsx(c,{visualElement:d.visualElement,...u}):null,t(s,a,Wee(h,d.visualElement,l),h,f,d.visualElement)]})}const o=P.forwardRef(i);return o[qee]=s,o}function Xee({layoutId:n}){const e=P.useContext(vx).id;return e&&n!==void 0?e+"-"+n:n}function Zee(n,e){const t=P.useContext(EL).strict;if(process.env.NODE_ENV!=="production"&&e&&t){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?Su(!1,r):ji(!1,r)}}function ete(n){const{drag:e,layout:t}=ku;if(!e&&!t)return{};const r={...e,...t};return{MeasureLayout:e!=null&&e.isEnabled(n)||t!=null&&t.isEnabled(n)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function tte(n){function e(r,s={}){return Yee(n(r,s))}if(typeof Proxy>"u")return e;const t=new Map;return new Proxy(e,{get:(r,s)=>(t.has(s)||t.set(s,e(s)),t.get(s))})}const nte=["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 xx(n){return typeof n!="string"||n.includes("-")?!1:!!(nte.indexOf(n)>-1||/[A-Z]/u.test(n))}const Jy={};function rte(n){Object.assign(Jy,n)}const Ch=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],vl=new Set(Ch);function DL(n,{layout:e,layoutId:t}){return vl.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!Jy[n]||n==="opacity")}const Mn=n=>!!(n&&n.getVelocity),ste={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ite=Ch.length;function ote(n,{enableHardwareAcceleration:e=!0,allowTransformNone:t=!0},r,s){let i="";for(let o=0;o<ite;o++){const a=Ch[o];if(n[a]!==void 0){const l=ste[a]||a;i+=`${l}(${n[a]}) `}}return e&&!n.z&&(i+="translateZ(0)"),i=i.trim(),s?i=s(n,r?"":i):t&&r&&(i="none"),i}const IL=n=>e=>typeof e=="string"&&e.startsWith(n),LL=IL("--"),ate=IL("var(--"),Ex=n=>ate(n)?lte.test(n.split("/*")[0].trim()):!1,lte=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,cte=(n,e)=>e&&typeof n=="number"?e.transform(n):n,Wo=(n,e,t)=>t>e?e:t<n?n:t,Tu={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},kh={...Tu,transform:n=>Wo(0,1,n)},qy={...Tu,default:1},Sh=n=>Math.round(n*1e5)/1e5,Cx=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ute=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,fte=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function Th(n){return typeof n=="string"}const Oh=n=>({test:e=>Th(e)&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Ko=Oh("deg"),ti=Oh("%"),Le=Oh("px"),dte=Oh("vh"),hte=Oh("vw"),BL={...ti,parse:n=>ti.parse(n)/100,transform:n=>ti.transform(n*100)},_L={...Tu,transform:Math.round},FL={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:Ko,rotateX:Ko,rotateY:Ko,rotateZ:Ko,scale:qy,scaleX:qy,scaleY:qy,scaleZ:qy,skew:Ko,skewX:Ko,skewY:Ko,distance:Le,translateX:Le,translateY:Le,translateZ:Le,x:Le,y:Le,z:Le,perspective:Le,transformPerspective:Le,opacity:kh,originX:BL,originY:BL,originZ:Le,zIndex:_L,backgroundPositionX:Le,backgroundPositionY:Le,fillOpacity:kh,strokeOpacity:kh,numOctaves:_L};function kx(n,e,t,r){const{style:s,vars:i,transform:o,transformOrigin:a}=n;let l=!1,c=!1,u=!0;for(const f in e){const d=e[f];if(LL(f)){i[f]=d;continue}const h=FL[f],p=cte(d,h);if(vl.has(f)){if(l=!0,o[f]=p,!u)continue;d!==(h.default||0)&&(u=!1)}else f.startsWith("origin")?(c=!0,a[f]=p):s[f]=p}if(e.transform||(l||r?s.transform=ote(n.transform,t,u,r):s.transform&&(s.transform="none")),c){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;s.transformOrigin=`${f} ${d} ${h}`}}const Sx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function jL(n,e,t){for(const r in e)!Mn(e[r])&&!DL(r,t)&&(n[r]=e[r])}function pte({transformTemplate:n},e,t){return P.useMemo(()=>{const r=Sx();return kx(r,e,{enableHardwareAcceleration:!t},n),Object.assign({},r.vars,r.style)},[e])}function mte(n,e,t){const r=n.style||{},s={};return jL(s,r,n),Object.assign(s,pte(n,e,t)),s}function gte(n,e,t){const r={},s=mte(n,e,t);return n.drag&&n.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(r.tabIndex=0),r.style=s,r}const yte=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 Yy(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||yte.has(n)}let UL=n=>!Yy(n);function bte(n){n&&(UL=e=>e.startsWith("on")?!Yy(e):n(e))}try{bte(require("@emotion/is-prop-valid").default)}catch{}function wte(n,e,t){const r={};for(const s in n)s==="values"&&typeof n.values=="object"||(UL(s)||t===!0&&Yy(s)||!e&&!Yy(s)||n.draggable&&s.startsWith("onDrag"))&&(r[s]=n[s]);return r}function VL(n,e,t){return typeof n=="string"?n:Le.transform(e+t*n)}function Ate(n,e,t){const r=VL(e,n.x,n.width),s=VL(t,n.y,n.height);return`${r} ${s}`}const vte={offset:"stroke-dashoffset",array:"stroke-dasharray"},xte={offset:"strokeDashoffset",array:"strokeDasharray"};function Ete(n,e,t=1,r=0,s=!0){n.pathLength=1;const i=s?vte:xte;n[i.offset]=Le.transform(-r);const o=Le.transform(e),a=Le.transform(t);n[i.array]=`${o} ${a}`}function Tx(n,{attrX:e,attrY:t,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},u,f,d){if(kx(n,c,u,d),f){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:h,style:p,dimensions:m}=n;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=Ate(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),t!==void 0&&(h.y=t),r!==void 0&&(h.scale=r),o!==void 0&&Ete(h,o,a,l,!1)}const HL=()=>({...Sx(),attrs:{}}),Ox=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Cte(n,e,t,r){const s=P.useMemo(()=>{const i=HL();return Tx(i,e,{enableHardwareAcceleration:!1},Ox(r),n.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(n.style){const i={};jL(i,n.style,n),s.style={...i,...s.style}}return s}function kte(n=!1){return(t,r,s,{latestValues:i},o)=>{const l=(xx(t)?Cte:gte)(r,i,o,t),c=wte(r,typeof t=="string",n),u=t!==P.Fragment?{...c,...l,ref:s}:{},{children:f}=r,d=P.useMemo(()=>Mn(f)?f.get():f,[f]);return P.createElement(t,{...u,children:d})}}function zL(n,{style:e,vars:t},r,s){Object.assign(n.style,e,s&&s.getProjectionStyles(r));for(const i in t)n.style.setProperty(i,t[i])}const $L=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 GL(n,e,t,r){zL(n,e,void 0,r);for(const s in e.attrs)n.setAttribute($L.has(s)?s:yx(s),e.attrs[s])}function Nx(n,e,t){var r;const{style:s}=n,i={};for(const o in s)(Mn(s[o])||e.style&&Mn(e.style[o])||DL(o,n)||((r=t==null?void 0:t.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function WL(n,e,t){const r=Nx(n,e,t);for(const s in n)if(Mn(n[s])||Mn(e[s])){const i=Ch.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=n[s]}return r}function KL(n){const e=[{},{}];return n==null||n.values.forEach((t,r)=>{e[0][r]=t.get(),e[1][r]=t.getVelocity()}),e}function Mx(n,e,t,r){if(typeof e=="function"){const[s,i]=KL(r);e=e(t!==void 0?t:n.custom,s,i)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,i]=KL(r);e=e(t!==void 0?t:n.custom,s,i)}return e}function QL(n){const e=P.useRef(null);return e.current===null&&(e.current=n()),e.current}const Rx=n=>Array.isArray(n),Ste=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),Tte=n=>Rx(n)?n[n.length-1]||0:n;function Xy(n){const e=Mn(n)?n.get():n;return Ste(e)?e.toValue():e}function Ote({scrapeMotionValuesFromProps:n,createRenderState:e,onMount:t},r,s,i){const o={latestValues:Nte(r,s,i,n),renderState:e()};return t&&(o.mount=a=>t(r,a,o)),o}const JL=n=>(e,t)=>{const r=P.useContext($y),s=P.useContext(Gy),i=()=>Ote(n,e,r,s);return t?i():QL(i)};function Nte(n,e,t,r){const s={},i=r(n,{});for(const d in i)s[d]=Xy(i[d]);let{initial:o,animate:a}=n;const l=Qy(n),c=ML(n);e&&c&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=t?t.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!Ky(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=Mx(n,h);if(!p)return;const{transitionEnd:m,transition:y,...b}=p;for(const v in b){let A=b[v];if(Array.isArray(A)){const w=u?A.length-1:0;A=A[w]}A!==null&&(s[v]=A)}for(const v in m)s[v]=m[v]}),s}const{schedule:dt,cancel:Ui,state:En,steps:Px}=SL(typeof requestAnimationFrame<"u"?requestAnimationFrame:xn,!0),Mte={useVisualState:JL({scrapeMotionValuesFromProps:WL,createRenderState:HL,onMount:(n,e,{renderState:t,latestValues:r})=>{dt.read(()=>{try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}),dt.render(()=>{Tx(t,r,{enableHardwareAcceleration:!1},Ox(e.tagName),n.transformTemplate),GL(e,t)})}})},Rte={useVisualState:JL({scrapeMotionValuesFromProps:Nx,createRenderState:Sx})};function Pte(n,{forwardMotionProps:e=!1},t,r){return{...xx(n)?Mte:Rte,preloadedFeatures:t,useRender:kte(e),createVisualElement:r,Component:n}}function Vi(n,e,t,r={passive:!0}){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t)}const qL=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Zy(n,e="page"){return{point:{x:n[`${e}X`],y:n[`${e}Y`]}}}const Dte=n=>e=>qL(e)&&n(e,Zy(e));function Hi(n,e,t,r){return Vi(n,e,Dte(t),r)}const Ite=(n,e)=>t=>e(n(t)),zi=(...n)=>n.reduce(Ite);function YL(n){let e=null;return()=>{const t=()=>{e=null};return e===null?(e=n,t):!1}}const XL=YL("dragHorizontal"),ZL=YL("dragVertical");function eB(n){let e=!1;if(n==="y")e=ZL();else if(n==="x")e=XL();else{const t=XL(),r=ZL();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}function tB(){const n=eB(!0);return n?(n(),!1):!0}class Qo{constructor(e){this.isMounted=!1,this.node=e}update(){}}function nB(n,e){const t=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||tB())return;const a=n.getProps();n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",e);const l=a[r];l&&dt.postRender(()=>l(i,o))};return Hi(n.current,t,s,{passive:!n.getProps()[r]})}class Lte extends Qo{mount(){this.unmount=zi(nB(this.node,!0),nB(this.node,!1))}unmount(){}}class Bte extends Qo{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=zi(Vi(this.node.current,"focus",()=>this.onFocus()),Vi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const rB=(n,e)=>e?n===e?!0:rB(n,e.parentElement):!1;function Dx(n,e){if(!e)return;const t=new PointerEvent("pointer"+n);e(t,Zy(t))}class _te extends Qo{constructor(){super(...arguments),this.removeStartListeners=xn,this.removeEndListeners=xn,this.removeAccessibleListeners=xn,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=Hi(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:u,globalTapTarget:f}=this.node.getProps(),d=!f&&!rB(this.node.current,a.target)?u:c;d&&dt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Hi(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=zi(i,o),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||Dx("up",(l,c)=>{const{onTap:u}=this.node.getProps();u&&dt.postRender(()=>u(l,c))})};this.removeEndListeners(),this.removeEndListeners=Vi(this.node.current,"keyup",o),Dx("down",(a,l)=>{this.startPress(a,l)})},t=Vi(this.node.current,"keydown",e),r=()=>{this.isPressing&&Dx("cancel",(i,o)=>this.cancelPress(i,o))},s=Vi(this.node.current,"blur",r);this.removeAccessibleListeners=zi(t,s)}}startPress(e,t){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&dt.postRender(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!tB()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&dt.postRender(()=>r(e,t))}mount(){const e=this.node.getProps(),t=Hi(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Vi(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=zi(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ix=new WeakMap,Lx=new WeakMap,Fte=n=>{const e=Ix.get(n.target);e&&e(n)},jte=n=>{n.forEach(Fte)};function Ute({root:n,...e}){const t=n||document;Lx.has(t)||Lx.set(t,{});const r=Lx.get(t),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(jte,{root:n,...e})),r[s]}function Vte(n,e,t){const r=Ute(e);return Ix.set(n,t),r.observe(n),()=>{Ix.delete(n),r.unobserve(n)}}const Hte={some:0,all:1};class zte extends Qo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:s="some",once:i}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:Hte[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),d=c?u:f;d&&d(l)};return Vte(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some($te(e,t))&&this.startObserver()}unmount(){}}function $te({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const Gte={inView:{Feature:zte},tap:{Feature:_te},focus:{Feature:Bte},hover:{Feature:Lte}};function sB(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let r=0;r<t;r++)if(e[r]!==n[r])return!1;return!0}function e0(n,e,t){const r=n.getProps();return Mx(r,e,t!==void 0?t:r.custom,n)}const $i=n=>n*1e3,Gi=n=>n/1e3,Wte={type:"spring",stiffness:500,damping:25,restSpeed:10},Kte=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),Qte={type:"keyframes",duration:.8},Jte={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},qte=(n,{keyframes:e})=>e.length>2?Qte:vl.has(n)?n.startsWith("scale")?Kte(e[1]):Wte:Jte;function Yte({when:n,delay:e,delayChildren:t,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}function Bx(n,e){return n[e]||n.default||n}const Xte=n=>n!==null;function t0(n,{repeat:e,repeatType:t="loop"},r){const s=n.filter(Xte),i=e&&t!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}let n0;function Zte(){n0=void 0}const Jo={now:()=>(n0===void 0&&Jo.set(En.isProcessing||Uee.useManualTiming?En.timestamp:performance.now()),n0),set:n=>{n0=n,queueMicrotask(Zte)}},iB=n=>/^0[^.\s]+$/u.test(n);function ene(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||iB(n):!0}const oB=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),tne=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function nne(n){const e=tne.exec(n);if(!e)return[,];const[,t,r,s]=e;return[`--${t??r}`,s]}const rne=4;function aB(n,e,t=1){ji(t<=rne,`Max CSS variable fallback depth detected in property "${n}". This may indicate a circular fallback dependency.`);const[r,s]=nne(n);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return oB(o)?parseFloat(o):o}return Ex(s)?aB(s,e,t+1):s}const sne=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),lB=n=>n===Tu||n===Le,cB=(n,e)=>parseFloat(n.split(", ")[e]),uB=(n,e)=>(t,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return cB(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?cB(i[1],n):0}},ine=new Set(["x","y","z"]),one=Ch.filter(n=>!ine.has(n));function ane(n){const e=[];return one.forEach(t=>{const r=n.getValue(t);r!==void 0&&(e.push([t,r.get()]),r.set(t.startsWith("scale")?1:0))}),e}const Ou={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:uB(4,13),y:uB(5,14)};Ou.translateX=Ou.x,Ou.translateY=Ou.y;const fB=n=>e=>e.test(n),dB=[Tu,Le,ti,Ko,hte,dte,{test:n=>n==="auto",parse:n=>n}],hB=n=>dB.find(fB(n)),xl=new Set;let _x=!1,Fx=!1;function pB(){if(Fx){const n=Array.from(xl).filter(r=>r.needsMeasurement),e=new Set(n.map(r=>r.element)),t=new Map;e.forEach(r=>{const s=ane(r);s.length&&(t.set(r,s),r.render())}),n.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=t.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Fx=!1,_x=!1,xl.forEach(n=>n.complete()),xl.clear()}function mB(){xl.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Fx=!0)})}function lne(){mB(),pB()}class jx{constructor(e,t,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(xl.add(this),_x||(_x=!0,dt.read(mB),dt.resolveKeyframes(pB))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,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&&t){const l=r.readValue(t,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),xl.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,xl.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Ux=(n,e)=>t=>!!(Th(t)&&fte.test(t)&&t.startsWith(n)||e&&Object.prototype.hasOwnProperty.call(t,e)),gB=(n,e,t)=>r=>{if(!Th(r))return r;const[s,i,o,a]=r.match(Cx);return{[n]:parseFloat(s),[e]:parseFloat(i),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},cne=n=>Wo(0,255,n),Vx={...Tu,transform:n=>Math.round(cne(n))},El={test:Ux("rgb","red"),parse:gB("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:r=1})=>"rgba("+Vx.transform(n)+", "+Vx.transform(e)+", "+Vx.transform(t)+", "+Sh(kh.transform(r))+")"};function une(n){let e="",t="",r="",s="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),r=n.substring(5,7),s=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),r=n.substring(3,4),s=n.substring(4,5),e+=e,t+=t,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Hx={test:Ux("#"),parse:une,transform:El.transform},Nu={test:Ux("hsl","hue"),parse:gB("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:r=1})=>"hsla("+Math.round(n)+", "+ti.transform(Sh(e))+", "+ti.transform(Sh(t))+", "+Sh(kh.transform(r))+")"},Rn={test:n=>El.test(n)||Hx.test(n)||Nu.test(n),parse:n=>El.test(n)?El.parse(n):Nu.test(n)?Nu.parse(n):Hx.parse(n),transform:n=>Th(n)?n:n.hasOwnProperty("red")?El.transform(n):Nu.transform(n)};function fne(n){var e,t;return isNaN(n)&&Th(n)&&(((e=n.match(Cx))===null||e===void 0?void 0:e.length)||0)+(((t=n.match(ute))===null||t===void 0?void 0:t.length)||0)>0}const yB="number",bB="color",dne="var",hne="var(",wB="${}",pne=/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 Nh(n){const e=n.toString(),t=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(pne,l=>(Rn.test(l)?(r.color.push(i),s.push(bB),t.push(Rn.parse(l))):l.startsWith(hne)?(r.var.push(i),s.push(dne),t.push(l)):(r.number.push(i),s.push(yB),t.push(parseFloat(l))),++i,wB)).split(wB);return{values:t,split:a,indexes:r,types:s}}function AB(n){return Nh(n).values}function vB(n){const{split:e,types:t}=Nh(n),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=t[o];a===yB?i+=Sh(s[o]):a===bB?i+=Rn.transform(s[o]):i+=s[o]}return i}}const mne=n=>typeof n=="number"?0:n;function gne(n){const e=AB(n);return vB(n)(e.map(mne))}const qo={test:fne,parse:AB,createTransformer:vB,getAnimatableNone:gne},yne=new Set(["brightness","contrast","saturate","opacity"]);function bne(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[r]=t.match(Cx)||[];if(!r)return n;const s=t.replace(r,"");let i=yne.has(e)?1:0;return r!==t&&(i*=100),e+"("+i+s+")"}const wne=/\b([a-z-]*)\(.*?\)/gu,zx={...qo,getAnimatableNone:n=>{const e=n.match(wne);return e?e.map(bne).join(" "):n}},Ane={...FL,color:Rn,backgroundColor:Rn,outlineColor:Rn,fill:Rn,stroke:Rn,borderColor:Rn,borderTopColor:Rn,borderRightColor:Rn,borderBottomColor:Rn,borderLeftColor:Rn,filter:zx,WebkitFilter:zx},$x=n=>Ane[n];function xB(n,e){let t=$x(n);return t!==zx&&(t=qo),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const vne=new Set(["auto","none","0"]);function xne(n,e,t){let r=0,s;for(;r<n.length&&!s;){const i=n[r];typeof i=="string"&&!vne.has(i)&&Nh(i).values.length&&(s=n[r]),r++}if(s&&t)for(const i of e)n[i]=xB(t,s)}class EB extends jx{constructor(e,t,r,s){super(e,t,r,s,s==null?void 0:s.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let c=e[l];if(typeof c=="string"&&(c=c.trim(),Ex(c))){const u=aB(c,t.current);u!==void 0&&(e[l]=u),l===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!sne.has(r)||e.length!==2)return;const[s,i]=e,o=hB(s),a=hB(i);if(o!==a)if(lB(o)&&lB(a))for(let l=0;l<e.length;l++){const c=e[l];typeof c=="string"&&(e[l]=parseFloat(c))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let s=0;s<e.length;s++)ene(e[s])&&r.push(s);r.length&&xne(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ou[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const s=t[t.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:t,name:r,unresolvedKeyframes:s}=this;if(!t.current)return;const i=t.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Ou[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function CB(n){let e;return()=>(e===void 0&&(e=n()),e)}const kB=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(qo.test(n)||n==="0")&&!n.startsWith("url("));function Ene(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function Cne(n,e,t,r){const s=n[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=n[n.length-1],o=kB(s,e),a=kB(i,e);return Su(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:Ene(n)||t==="spring"&&r}class SB{constructor({autoplay:e=!0,delay:t=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:t,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&lne(),this._resolved}onKeyframesResolved(e,t){this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:c}=this.options;if(!c&&!Cne(e,r,s,i))if(o)this.options.duration=0;else{l==null||l(t0(e,this.options,t)),a==null||a(),this.resolveFinishedPromise();return}const u=this.initPlayback(e,t);u!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...u},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function TB(n,e){return e?n*(1e3/e):0}const kne=5;function OB(n,e,t){const r=Math.max(e-kne,0);return TB(t-n(r),e-r)}const Gx=.001,Sne=.01,NB=10,Tne=.05,One=1;function Nne({duration:n=800,bounce:e=.25,velocity:t=0,mass:r=1}){let s,i;Su(n<=$i(NB),"Spring duration must be 10 seconds or less");let o=1-e;o=Wo(Tne,One,o),n=Wo(Sne,NB,Gi(n)),o<1?(s=c=>{const u=c*o,f=u*n,d=u-t,h=Wx(c,o),p=Math.exp(-f);return Gx-d/h*p},i=c=>{const f=c*o*n,d=f*t+t,h=Math.pow(o,2)*Math.pow(c,2)*n,p=Math.exp(-f),m=Wx(Math.pow(c,2),o);return(-s(c)+Gx>0?-1:1)*((d-h)*p)/m}):(s=c=>{const u=Math.exp(-c*n),f=(c-t)*n+1;return-Gx+u*f},i=c=>{const u=Math.exp(-c*n),f=(t-c)*(n*n);return u*f});const a=5/n,l=Rne(s,i,a);if(n=$i(n),isNaN(l))return{stiffness:100,damping:10,duration:n};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:n}}}const Mne=12;function Rne(n,e,t){let r=t;for(let s=1;s<Mne;s++)r=r-n(r)/e(r);return r}function Wx(n,e){return n*Math.sqrt(1-e*e)}const Pne=["duration","bounce"],Dne=["stiffness","damping","mass"];function MB(n,e){return e.some(t=>n[t]!==void 0)}function Ine(n){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...n};if(!MB(n,Dne)&&MB(n,Pne)){const t=Nne(n);e={...e,...t,mass:1},e.isResolvedFromDuration=!0}return e}function RB({keyframes:n,restDelta:e,restSpeed:t,...r}){const s=n[0],i=n[n.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:c,duration:u,velocity:f,isResolvedFromDuration:d}=Ine({...r,velocity:-Gi(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*c)),m=i-s,y=Gi(Math.sqrt(a/c)),b=Math.abs(m)<5;t||(t=b?.01:2),e||(e=b?.005:.5);let v;if(p<1){const A=Wx(y,p);v=w=>{const x=Math.exp(-p*y*w);return i-x*((h+p*y*m)/A*Math.sin(A*w)+m*Math.cos(A*w))}}else if(p===1)v=A=>i-Math.exp(-y*A)*(m+(h+y*m)*A);else{const A=y*Math.sqrt(p*p-1);v=w=>{const x=Math.exp(-p*y*w),C=Math.min(A*w,300);return i-x*((h+p*y*m)*Math.sinh(C)+A*m*Math.cosh(C))/A}}return{calculatedDuration:d&&u||null,next:A=>{const w=v(A);if(d)o.done=A>=u;else{let x=h;A!==0&&(p<1?x=OB(v,A,w):x=0);const C=Math.abs(x)<=t,S=Math.abs(i-w)<=e;o.done=C&&S}return o.value=o.done?i:w,o}}}function PB({keyframes:n,velocity:e=0,power:t=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const f=n[0],d={done:!1,value:f},h=M=>a!==void 0&&M<a||l!==void 0&&M>l,p=M=>a===void 0?l:l===void 0||Math.abs(a-M)<Math.abs(l-M)?a:l;let m=t*e;const y=f+m,b=o===void 0?y:o(y);b!==y&&(m=b-f);const v=M=>-m*Math.exp(-M/r),A=M=>b+v(M),w=M=>{const R=v(M),O=A(M);d.done=Math.abs(R)<=c,d.value=d.done?b:O};let x,C;const S=M=>{h(d.value)&&(x=M,C=RB({keyframes:[d.value,p(d.value)],velocity:OB(A,M,d.value),damping:s,stiffness:i,restDelta:c,restSpeed:u}))};return S(0),{calculatedDuration:null,next:M=>{let R=!1;return!C&&x===void 0&&(R=!0,w(M),S(M)),x!==void 0&&M>=x?C.next(M-x):(!R&&w(M),d)}}}const DB=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,Lne=1e-7,Bne=12;function _ne(n,e,t,r,s){let i,o,a=0;do o=e+(t-e)/2,i=DB(o,r,s)-n,i>0?t=o:e=o;while(Math.abs(i)>Lne&&++a<Bne);return o}function Mh(n,e,t,r){if(n===e&&t===r)return xn;const s=i=>_ne(i,0,1,n,t);return i=>i===0||i===1?i:DB(s(i),e,r)}const Fne=Mh(.42,0,1,1),jne=Mh(0,0,.58,1),IB=Mh(.42,0,.58,1),Une=n=>Array.isArray(n)&&typeof n[0]!="number",LB=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,BB=n=>e=>1-n(1-e),Kx=n=>1-Math.sin(Math.acos(n)),_B=BB(Kx),Vne=LB(Kx),FB=Mh(.33,1.53,.69,.99),Qx=BB(FB),Hne=LB(Qx),jB={linear:xn,easeIn:Fne,easeInOut:IB,easeOut:jne,circIn:Kx,circInOut:Vne,circOut:_B,backIn:Qx,backInOut:Hne,backOut:FB,anticipate:n=>(n*=2)<1?.5*Qx(n):.5*(2-Math.pow(2,-10*(n-1)))},UB=n=>{if(Array.isArray(n)){ji(n.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,t,r,s]=n;return Mh(e,t,r,s)}else if(typeof n=="string")return ji(jB[n]!==void 0,`Invalid easing type '${n}'`),jB[n];return n},Rh=(n,e,t)=>{const r=e-n;return r===0?1:(t-n)/r},Bt=(n,e,t)=>n+(e-n)*t;function Jx(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function zne({hue:n,saturation:e,lightness:t,alpha:r}){n/=360,e/=100,t/=100;let s=0,i=0,o=0;if(!e)s=i=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;s=Jx(l,a,n+1/3),i=Jx(l,a,n),o=Jx(l,a,n-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function r0(n,e){return t=>t>0?e:n}const qx=(n,e,t)=>{const r=n*n,s=t*(e*e-r)+r;return s<0?0:Math.sqrt(s)},$ne=[Hx,El,Nu],Gne=n=>$ne.find(e=>e.test(n));function VB(n){const e=Gne(n);if(Su(!!e,`'${n}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let t=e.parse(n);return e===Nu&&(t=zne(t)),t}const HB=(n,e)=>{const t=VB(n),r=VB(e);if(!t||!r)return r0(n,e);const s={...t};return i=>(s.red=qx(t.red,r.red,i),s.green=qx(t.green,r.green,i),s.blue=qx(t.blue,r.blue,i),s.alpha=Bt(t.alpha,r.alpha,i),El.transform(s))},Yx=new Set(["none","hidden"]);function Wne(n,e){return Yx.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function Kne(n,e){return t=>Bt(n,e,t)}function Xx(n){return typeof n=="number"?Kne:typeof n=="string"?Ex(n)?r0:Rn.test(n)?HB:qne:Array.isArray(n)?zB:typeof n=="object"?Rn.test(n)?HB:Qne:r0}function zB(n,e){const t=[...n],r=t.length,s=n.map((i,o)=>Xx(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)t[o]=s[o](i);return t}}function Qne(n,e){const t={...n,...e},r={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(r[s]=Xx(n[s])(n[s],e[s]));return s=>{for(const i in r)t[i]=r[i](s);return t}}function Jne(n,e){var t;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=n.indexes[o][s[o]],l=(t=n.values[a])!==null&&t!==void 0?t:0;r[i]=l,s[o]++}return r}const qne=(n,e)=>{const t=qo.createTransformer(e),r=Nh(n),s=Nh(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?Yx.has(n)&&!s.values.length||Yx.has(e)&&!r.values.length?Wne(n,e):zi(zB(Jne(r,s),s.values),t):(Su(!0,`Complex values '${n}' 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.`),r0(n,e))};function $B(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?Bt(n,e,t):Xx(n)(n,e)}function Yne(n,e,t){const r=[],s=t||$B,i=n.length-1;for(let o=0;o<i;o++){let a=s(n[o],n[o+1]);if(e){const l=Array.isArray(e)?e[o]||xn:e;a=zi(l,a)}r.push(a)}return r}function Xne(n,e,{clamp:t=!0,ease:r,mixer:s}={}){const i=n.length;if(ji(i===e.length,"Both input and output ranges must be the same length"),i===1)return()=>e[0];if(i===2&&n[0]===n[1])return()=>e[1];n[0]>n[i-1]&&(n=[...n].reverse(),e=[...e].reverse());const o=Yne(e,r,s),a=o.length,l=c=>{let u=0;if(a>1)for(;u<n.length-2&&!(c<n[u+1]);u++);const f=Rh(n[u],n[u+1],c);return o[u](f)};return t?c=>l(Wo(n[0],n[i-1],c)):l}function Zne(n,e){const t=n[n.length-1];for(let r=1;r<=e;r++){const s=Rh(0,e,r);n.push(Bt(t,1,s))}}function ere(n){const e=[0];return Zne(e,n.length-1),e}function tre(n,e){return n.map(t=>t*e)}function nre(n,e){return n.map(()=>e||IB).splice(0,n.length-1)}function s0({duration:n=300,keyframes:e,times:t,ease:r="easeInOut"}){const s=Une(r)?r.map(UB):UB(r),i={done:!1,value:e[0]},o=tre(t&&t.length===e.length?t:ere(e),n),a=Xne(o,e,{ease:Array.isArray(s)?s:nre(e,s)});return{calculatedDuration:n,next:l=>(i.value=a(l),i.done=l>=n,i)}}const GB=2e4;function rre(n){let e=0;const t=50;let r=n.next(e);for(;!r.done&&e<GB;)e+=t,r=n.next(e);return e>=GB?1/0:e}const sre=n=>{const e=({timestamp:t})=>n(t);return{start:()=>dt.update(e,!0),stop:()=>Ui(e),now:()=>En.isProcessing?En.timestamp:Jo.now()}},ire={decay:PB,inertia:PB,tween:s0,keyframes:s0,spring:RB},ore=n=>n/100;class Zx extends SB{constructor({KeyframeResolver:e=jx,...t}){super(t),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:t="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=ire[t]||s0;let l,c;a!==s0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&ji(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),l=zi(ore,$B(e[0],e[1])),e=[0,100]);const u=a({...this.options,keyframes:e});i==="mirror"&&(c=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=rre(u));const{calculatedDuration:f}=u,d=f+s,h=d*(r+1)-s;return{generator:u,mirroredGenerator:c,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,t=!1){const{resolved:r}=this;if(!r){const{keyframes:M}=this.options;return{done:!0,value:M[M.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:c,totalDuration:u,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?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>u;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let A=this.currentTime,w=i;if(h){const M=Math.min(this.currentTime,u)/f;let R=Math.floor(M),O=M%1;!O&&M>=1&&(O=1),O===1&&R--,R=Math.min(R,h+1),!!(R%2)&&(p==="reverse"?(O=1-O,m&&(O-=m/f)):p==="mirror"&&(w=o)),A=Wo(0,1,O)*f}const x=v?{done:!1,value:l[0]}:w.next(A);a&&(x.value=a(x.value));let{done:C}=x;!v&&c!==null&&(C=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return S&&s!==void 0&&(x.value=t0(l,this.options,s)),y&&y(x.value),S&&this.finish(),x}get duration(){const{resolved:e}=this;return e?Gi(e.calculatedDuration):0}get time(){return Gi(this.currentTime)}set time(e){e=$i(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 t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Gi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=sre,onPlay:t}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),t&&t();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 WB=n=>Array.isArray(n)&&typeof n[0]=="number";function KB(n){return!!(!n||typeof n=="string"&&n in eE||WB(n)||Array.isArray(n)&&n.every(KB))}const Ph=([n,e,t,r])=>`cubic-bezier(${n}, ${e}, ${t}, ${r})`,eE={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ph([0,.65,.55,1]),circOut:Ph([.55,0,1,.45]),backIn:Ph([.31,.01,.66,-.59]),backOut:Ph([.33,1.53,.69,.99])};function are(n){return QB(n)||eE.easeOut}function QB(n){if(n)return WB(n)?Ph(n):Array.isArray(n)?n.map(are):eE[n]}function lre(n,e,t,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const c={[e]:t};l&&(c.offset=l);const u=QB(a);return Array.isArray(u)&&(c.easing=u),n.animate(c,{delay:r,duration:s,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const cre=CB(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ure=new Set(["opacity","clipPath","filter","transform"]),i0=10,fre=2e4;function dre(n){return n.type==="spring"||n.name==="backgroundColor"||!KB(n.ease)}function hre(n,e){const t=new Zx({...e,keyframes:n,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:n[0]};const s=[];let i=0;for(;!r.done&&i<fre;)r=t.sample(i),s.push(r.value),i+=i0;return{times:void 0,keyframes:s,duration:i-i0,ease:"linear"}}class JB extends SB{constructor(e){super(e);const{name:t,motionValue:r,keyframes:s}=this.options;this.resolver=new EB(s,(i,o)=>this.onKeyframesResolved(i,o),t,r),this.resolver.scheduleResolve()}initPlayback(e,t){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:l,name:c}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(dre(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=hre(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),s=m.duration,i=m.times,o=m.ease,a="keyframes"}const u=lre(l.owner.current,c,e,{...this.options,duration:s,times:i,ease:o});return u.startTime=Jo.now(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:f}=this.options;l.set(t0(e,this.options,t)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return Gi(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return Gi(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.currentTime=$i(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:t}=this;if(!t)return xn;const{animation:r}=t;r.timeline=e,r.onfinish=null}return xn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.playState==="finished"&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(!(t.playState==="idle"||t.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:c,onComplete:u,...f}=this.options,d=new Zx({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),h=$i(this.time);l.setWithVelocity(d.sample(h-i0).value,d.sample(h).value,i0)}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:t,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return cre()&&r&&ure.has(r)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}function pre(n,e){let t;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;t!==o&&n(o),t=o};return dt.update(r,!0),()=>Ui(r)}const mre=CB(()=>window.ScrollTimeline!==void 0);class gre{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,t){return Promise.all(this.animations).then(e).catch(t)}getAll(e){return this.animations[0][e]}setAll(e,t){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=t}attachTimeline(e){const t=this.animations.map(r=>{if(mre()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),pre(s=>{r.time=r.duration*s},e)});return()=>{t.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 t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const tE=(n,e,t,r={},s,i)=>o=>{const a=Bx(r,n)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-$i(l);let u={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:n,motionValue:e,element:i?void 0:s};Yte(a)||(u={...u,...qte(n,u)}),u.duration&&(u.duration=$i(u.duration)),u.repeatDelay&&(u.repeatDelay=$i(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(f=!0)),f&&!i&&e.get()!==void 0){const d=t0(u.keyframes,a);if(d!==void 0)return dt.update(()=>{u.onUpdate(d),u.onComplete()}),new gre([])}return!i&&JB.supports(u)?new JB(u):new Zx(u)};function o0(n){return!!(Mn(n)&&n.add)}function nE(n,e){n.indexOf(e)===-1&&n.push(e)}function rE(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}class sE{constructor(){this.subscriptions=[]}add(e){return nE(this.subscriptions,e),()=>rE(this.subscriptions,e)}notify(e,t,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,t,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const qB=new Set;function iE(n,e,t){n||qB.has(e)||(console.warn(e),qB.add(e))}const YB=30,yre=n=>!isNaN(parseFloat(n));class bre{constructor(e,t={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Jo.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=t.owner}setCurrent(e){this.current=e,this.updatedAt=Jo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yre(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&iE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new sE);const r=this.events[e].add(t);return e==="change"?()=>{r(),dt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Jo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>YB)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,YB);return TB(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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 Dh(n,e){return new bre(n,e)}function wre(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,Dh(t))}function Are(n,e){const t=e0(n,e);let{transitionEnd:r={},transition:s={},...i}=t||{};i={...i,...r};for(const o in i){const a=Tte(i[o]);wre(n,o,a)}}function XB(n){return n.getProps()[CL]}function vre({protectedKeys:n,needsAnimating:e},t){const r=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,r}function ZB(n,e,{delay:t=0,transitionOverride:r,type:s}={}){var i;let{transition:o=n.getDefaultTransition(),transitionEnd:a,...l}=e;const c=n.getValue("willChange");r&&(o=r);const u=[],f=s&&n.animationState&&n.animationState.getState()[s];for(const d in l){const h=n.getValue(d,(i=n.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||f&&vre(f,d))continue;const m={delay:t,elapsed:0,...Bx(o||{},d)};let y=!1;if(window.HandoffAppearAnimations){const v=XB(n);if(v){const A=window.HandoffAppearAnimations(v,d,h,dt);A!==null&&(m.elapsed=A,y=!0)}}h.start(tE(d,h,p,n.shouldReduceMotion&&vl.has(d)?{type:!1}:m,n,y));const b=h.animation;b&&(o0(c)&&(c.add(d),b.then(()=>c.remove(d))),u.push(b))}return a&&Promise.all(u).then(()=>{dt.update(()=>{a&&Are(n,a)})}),u}function oE(n,e,t={}){var r;const s=e0(n,e,t.type==="exit"?(r=n.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=n.getDefaultTransition()||{}}=s||{};t.transitionOverride&&(i=t.transitionOverride);const o=s?()=>Promise.all(ZB(n,s,t)):()=>Promise.resolve(),a=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:d}=i;return xre(n,e,u+c,f,d,t)}:()=>Promise.resolve(),{when:l}=i;if(l){const[c,u]=l==="beforeChildren"?[o,a]:[a,o];return c().then(()=>u())}else return Promise.all([o(),a(t.delay)])}function xre(n,e,t=0,r=0,s=1,i){const o=[],a=(n.variantChildren.size-1)*r,l=s===1?(c=0)=>c*r:(c=0)=>a-c*r;return Array.from(n.variantChildren).sort(Ere).forEach((c,u)=>{c.notify("AnimationStart",e),o.push(oE(c,e,{...i,delay:t+l(u)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function Ere(n,e){return n.sortNodePosition(e)}function Cre(n,e,t={}){n.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>oE(n,i,t));r=Promise.all(s)}else if(typeof e=="string")r=oE(n,e,t);else{const s=typeof e=="function"?e0(n,e,t.custom):e;r=Promise.all(ZB(n,s,t))}return r.then(()=>{dt.postRender(()=>{n.notify("AnimationComplete",e)})})}const kre=[...wx].reverse(),Sre=wx.length;function Tre(n){return e=>Promise.all(e.map(({animation:t,options:r})=>Cre(n,t,r)))}function Ore(n){let e=Tre(n),t=e_(),r=!0;const s=l=>(c,u)=>{var f;const d=e0(n,u,l==="exit"?(f=n.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;c={...c,...m,...p}}return c};function i(l){e=l(n)}function o(l){const c=n.getProps(),u=n.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let y=0;y<Sre;y++){const b=kre[y],v=t[b],A=c[b]!==void 0?c[b]:u[b],w=Eh(A),x=b===l?v.isActive:null;x===!1&&(p=y);let C=A===u[b]&&A!==c[b]&&w;if(C&&r&&n.manuallyAnimateOnMount&&(C=!1),v.protectedKeys={...h},!v.isActive&&x===null||!A&&!v.prevProp||Ky(A)||typeof A=="boolean")continue;let M=Nre(v.prevProp,A)||b===l&&v.isActive&&!C&&w||y>p&&w,R=!1;const O=Array.isArray(A)?A:[A];let D=O.reduce(s(b),{});x===!1&&(D={});const{prevResolvedValues:_={}}=v,F={..._,...D},G=B=>{M=!0,d.has(B)&&(R=!0,d.delete(B)),v.needsAnimating[B]=!0;const V=n.getValue(B);V&&(V.liveStyle=!1)};for(const B in F){const V=D[B],Q=_[B];if(h.hasOwnProperty(B))continue;let ee=!1;Rx(V)&&Rx(Q)?ee=!sB(V,Q):ee=V!==Q,ee?V!=null?G(B):d.add(B):V!==void 0&&d.has(B)?G(B):v.protectedKeys[B]=!0}v.prevProp=A,v.prevResolvedValues=D,v.isActive&&(h={...h,...D}),r&&n.blockInitialAnimation&&(M=!1),M&&(!C||R)&&f.push(...O.map(B=>({animation:B,options:{type:b}})))}if(d.size){const y={};d.forEach(b=>{const v=n.getBaseTarget(b),A=n.getValue(b);A&&(A.liveStyle=!0),y[b]=v??null}),f.push({animation:y})}let m=!!f.length;return r&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,c){var u;if(t[l].isActive===c)return Promise.resolve();(u=n.variantChildren)===null||u===void 0||u.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,c)}),t[l].isActive=c;const f=o(l);for(const d in t)t[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>t,reset:()=>{t=e_(),r=!0}}}function Nre(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!sB(e,n):!1}function Cl(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function e_(){return{animate:Cl(!0),whileInView:Cl(),whileHover:Cl(),whileTap:Cl(),whileDrag:Cl(),whileFocus:Cl(),exit:Cl()}}class Mre extends Qo{constructor(e){super(e),e.animationState||(e.animationState=Ore(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ky(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let Rre=0;class Pre extends Qo{constructor(){super(...arguments),this.id=Rre++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);t&&!e&&s.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Dre={animation:{Feature:Mre},exit:{Feature:Pre}},t_=(n,e)=>Math.abs(n-e);function Ire(n,e){const t=t_(n.x,e.x),r=t_(n.y,e.y);return Math.sqrt(t**2+r**2)}class n_{constructor(e,t,{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=lE(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=Ire(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=En;this.history.push({...p,timestamp:m});const{onStart:y,onMove:b}=this.handlers;d||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=aE(d,this.transformPagePoint),dt.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 y=lE(f.type==="pointercancel"?this.lastMoveEventInfo:aE(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,y),p&&p(f,y)},!qL(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.contextWindow=s||window;const o=Zy(e),a=aE(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=En;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,lE(a,this.history)),this.removeListeners=zi(Hi(this.contextWindow,"pointermove",this.handlePointerMove),Hi(this.contextWindow,"pointerup",this.handlePointerUp),Hi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Ui(this.updatePoint)}}function aE(n,e){return e?{point:e(n.point)}:n}function r_(n,e){return{x:n.x-e.x,y:n.y-e.y}}function lE({point:n},e){return{point:n,delta:r_(n,s_(e)),offset:r_(n,Lre(e)),velocity:Bre(e,.1)}}function Lre(n){return n[0]}function s_(n){return n[n.length-1]}function Bre(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,r=null;const s=s_(n);for(;t>=0&&(r=n[t],!(s.timestamp-r.timestamp>$i(e)));)t--;if(!r)return{x:0,y:0};const i=Gi(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 Or(n){return n.max-n.min}function cE(n,e=0,t=.01){return Math.abs(n-e)<=t}function i_(n,e,t,r=.5){n.origin=r,n.originPoint=Bt(e.min,e.max,n.origin),n.scale=Or(t)/Or(e),(cE(n.scale,1,1e-4)||isNaN(n.scale))&&(n.scale=1),n.translate=Bt(t.min,t.max,n.origin)-n.originPoint,(cE(n.translate)||isNaN(n.translate))&&(n.translate=0)}function Ih(n,e,t,r){i_(n.x,e.x,t.x,r?r.originX:void 0),i_(n.y,e.y,t.y,r?r.originY:void 0)}function o_(n,e,t){n.min=t.min+e.min,n.max=n.min+Or(e)}function _re(n,e,t){o_(n.x,e.x,t.x),o_(n.y,e.y,t.y)}function a_(n,e,t){n.min=e.min-t.min,n.max=n.min+Or(e)}function Lh(n,e,t){a_(n.x,e.x,t.x),a_(n.y,e.y,t.y)}function Fre(n,{min:e,max:t},r){return e!==void 0&&n<e?n=r?Bt(e,n,r.min):Math.max(n,e):t!==void 0&&n>t&&(n=r?Bt(t,n,r.max):Math.min(n,t)),n}function l_(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function jre(n,{top:e,left:t,bottom:r,right:s}){return{x:l_(n.x,t,s),y:l_(n.y,e,r)}}function c_(n,e){let t=e.min-n.min,r=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,r]=[r,t]),{min:t,max:r}}function Ure(n,e){return{x:c_(n.x,e.x),y:c_(n.y,e.y)}}function Vre(n,e){let t=.5;const r=Or(n),s=Or(e);return s>r?t=Rh(e.min,e.max-r,n.min):r>s&&(t=Rh(n.min,n.max-s,e.min)),Wo(0,1,t)}function Hre(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const uE=.35;function zre(n=uE){return n===!1?n=0:n===!0&&(n=uE),{x:u_(n,"left","right"),y:u_(n,"top","bottom")}}function u_(n,e,t){return{min:f_(n,e),max:f_(n,t)}}function f_(n,e){return typeof n=="number"?n:n[e]||0}const d_=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mu=()=>({x:d_(),y:d_()}),h_=()=>({min:0,max:0}),Kt=()=>({x:h_(),y:h_()});function Qr(n){return[n("x"),n("y")]}function p_({top:n,left:e,right:t,bottom:r}){return{x:{min:e,max:t},y:{min:n,max:r}}}function $re({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function Gre(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),r=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:r.y,right:r.x}}function fE(n){return n===void 0||n===1}function dE({scale:n,scaleX:e,scaleY:t}){return!fE(n)||!fE(e)||!fE(t)}function kl(n){return dE(n)||m_(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function m_(n){return g_(n.x)||g_(n.y)}function g_(n){return n&&n!=="0%"}function a0(n,e,t){const r=n-t,s=e*r;return t+s}function y_(n,e,t,r,s){return s!==void 0&&(n=a0(n,s,r)),a0(n,t,r)+e}function hE(n,e=0,t=1,r,s){n.min=y_(n.min,e,t,r,s),n.max=y_(n.max,e,t,r,s)}function b_(n,{x:e,y:t}){hE(n.x,e.translate,e.scale,e.originPoint),hE(n.y,t.translate,t.scale,t.originPoint)}function Wre(n,e,t,r=!1){const s=t.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=t[a],o=i.projectionDelta;const l=i.instance;l&&l.style&&l.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Ru(n,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,b_(n,o)),r&&kl(i.latestValues)&&Ru(n,i.latestValues))}e.x=w_(e.x),e.y=w_(e.y)}function w_(n){return Number.isInteger(n)||n>1.0000000000001||n<.999999999999?n:1}function Yo(n,e){n.min=n.min+e,n.max=n.max+e}function A_(n,e,[t,r,s]){const i=e[s]!==void 0?e[s]:.5,o=Bt(n.min,n.max,i);hE(n,e[t],e[r],o,e.scale)}const Kre=["x","scaleX","originX"],Qre=["y","scaleY","originY"];function Ru(n,e){A_(n.x,e,Kre),A_(n.y,e,Qre)}function v_(n,e){return p_(Gre(n.getBoundingClientRect(),e))}function Jre(n,e,t){const r=v_(n,t),{scroll:s}=e;return s&&(Yo(r.x,s.offset.x),Yo(r.y,s.offset.y)),r}const x_=({current:n})=>n?n.ownerDocument.defaultView:null,qre=new WeakMap;class Yre{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:t=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=u=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(Zy(u,"page").point)},i=(u,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=eB(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),Qr(y=>{let b=this.getAxisMotionValue(y).get()||0;if(ti.test(b)){const{projection:v}=this.visualElement;if(v&&v.layout){const A=v.layout.layoutBox[y];A&&(b=Or(A)*(parseFloat(b)/100))}}this.originPoint[y]=b}),p&&dt.postRender(()=>p(u,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(u,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:y}=f;if(h&&this.currentDirection===null){this.currentDirection=Xre(y),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),m&&m(u,f)},a=(u,f)=>this.stop(u,f),l=()=>Qr(u=>{var f;return this.getAnimationState(u)==="paused"&&((f=this.getAxisMotionValue(u).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new n_(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:x_(this.visualElement)})}stop(e,t){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=t;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&dt.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=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),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,r){const{drag:s}=this.getProps();if(!r||!l0(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=Fre(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:t,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;t&&Cu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=jre(s.layoutBox,t):this.constraints=!1,this.elastic=zre(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Qr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Hre(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Cu(e))return!1;const r=e.current;ji(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=Jre(r,s.root,this.visualElement.getTransformPagePoint());let o=Ure(s.layout.layoutBox,i);if(t){const a=t($re(o));this.hasMutatedConstraints=!!a,a&&(o=p_(a))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Qr(u=>{if(!l0(u,t,this.currentDirection))return;let f=l&&l[u]||{};o&&(f={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?e[u]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return r.start(tE(e,r,0,t,this.visualElement))}stopAnimation(){Qr(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Qr(e=>{var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[t];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Qr(t=>{const{drag:r}=this.getProps();if(!l0(t,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(t);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[t];i.set(e[t]-Bt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!Cu(t)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Qr(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=Vre({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(),Qr(o=>{if(!l0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(Bt(l,c,s[o]))})}addListeners(){if(!this.visualElement.current)return;qre.set(this.visualElement,this);const e=this.visualElement.current,t=Hi(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps();c&&u&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Cu(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()),dt.read(r);const o=Vi(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(Qr(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=l[u].translate,f.set(f.get()+l[u].translate))}),this.visualElement.render())});return()=>{o(),t(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=uE,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function l0(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function Xre(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class Zre extends Qo{constructor(e){super(e),this.removeGroupControls=xn,this.removeListeners=xn,this.controls=new Yre(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xn}unmount(){this.removeGroupControls(),this.removeListeners()}}const E_=n=>(e,t)=>{n&&dt.postRender(()=>n(e,t))};class ese extends Qo{constructor(){super(...arguments),this.removePointerDownListener=xn}onPointerDown(e){this.session=new n_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:x_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:E_(e),onStart:E_(t),onMove:r,onEnd:(i,o)=>{delete this.session,s&&dt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Hi(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 tse(){const n=P.useContext(Gy);if(n===null)return[!0,null];const{isPresent:e,onExitComplete:t,register:r}=n,s=P.useId();return P.useEffect(()=>r(s),[]),!e&&t?[!1,()=>t&&t(s)]:[!0]}const c0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function C_(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Bh={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(Le.test(n))n=parseFloat(n);else return n;const t=C_(n,e.target.x),r=C_(n,e.target.y);return`${t}% ${r}%`}},nse={correct:(n,{treeScale:e,projectionDelta:t})=>{const r=n,s=qo.parse(n);if(s.length>5)return r;const i=qo.createTransformer(n),o=typeof s[0]!="number"?1:0,a=t.x.scale*e.x,l=t.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const c=Bt(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),i(s)}};class rse extends P.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;rte(sse),i&&(t.group&&t.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()})),c0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==t||t===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||dt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),bx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function k_(n){const[e,t]=tse(),r=P.useContext(vx);return k.jsx(rse,{...n,layoutGroup:r,switchLayoutGroup:P.useContext(TL),isPresent:e,safeToRemove:t})}const sse={borderRadius:{...Bh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Bh,borderTopRightRadius:Bh,borderBottomLeftRadius:Bh,borderBottomRightRadius:Bh,boxShadow:nse},S_=["TopLeft","TopRight","BottomLeft","BottomRight"],ise=S_.length,T_=n=>typeof n=="string"?parseFloat(n):n,O_=n=>typeof n=="number"||Le.test(n);function ose(n,e,t,r,s,i){s?(n.opacity=Bt(0,t.opacity!==void 0?t.opacity:1,ase(r)),n.opacityExit=Bt(e.opacity!==void 0?e.opacity:1,0,lse(r))):i&&(n.opacity=Bt(e.opacity!==void 0?e.opacity:1,t.opacity!==void 0?t.opacity:1,r));for(let o=0;o<ise;o++){const a=`border${S_[o]}Radius`;let l=N_(e,a),c=N_(t,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||O_(l)===O_(c)?(n[a]=Math.max(Bt(T_(l),T_(c),r),0),(ti.test(c)||ti.test(l))&&(n[a]+="%")):n[a]=c}(e.rotate||t.rotate)&&(n.rotate=Bt(e.rotate||0,t.rotate||0,r))}function N_(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const ase=M_(0,.5,_B),lse=M_(.5,.95,xn);function M_(n,e,t){return r=>r<n?0:r>e?1:t(Rh(n,e,r))}function R_(n,e){n.min=e.min,n.max=e.max}function Jr(n,e){R_(n.x,e.x),R_(n.y,e.y)}function P_(n,e,t,r,s){return n-=e,n=a0(n,1/t,r),s!==void 0&&(n=a0(n,1/s,r)),n}function cse(n,e=0,t=1,r=.5,s,i=n,o=n){if(ti.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);n===i&&(a-=e),n.min=P_(n.min,e,t,a,s),n.max=P_(n.max,e,t,a,s)}function D_(n,e,[t,r,s],i,o){cse(n,e[t],e[r],e[s],e.scale,i,o)}const use=["x","scaleX","originX"],fse=["y","scaleY","originY"];function I_(n,e,t,r){D_(n.x,e,use,t?t.x:void 0,r?r.x:void 0),D_(n.y,e,fse,t?t.y:void 0,r?r.y:void 0)}function L_(n){return n.translate===0&&n.scale===1}function B_(n){return L_(n.x)&&L_(n.y)}function dse(n,e){return n.x.min===e.x.min&&n.x.max===e.x.max&&n.y.min===e.y.min&&n.y.max===e.y.max}function __(n,e){return Math.round(n.x.min)===Math.round(e.x.min)&&Math.round(n.x.max)===Math.round(e.x.max)&&Math.round(n.y.min)===Math.round(e.y.min)&&Math.round(n.y.max)===Math.round(e.y.max)}function F_(n){return Or(n.x)/Or(n.y)}class hse{constructor(){this.members=[]}add(e){nE(this.members,e),e.scheduleRender()}remove(e){if(rE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(s=>e===s);if(t===0)return!1;let r;for(let s=t;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,t){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,t&&(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:t,resumingFrom:r}=e;t.onExitComplete&&t.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 j_(n,e,t){let r="";const s=n.x.translate/e.x,i=n.y.translate/e.y,o=(t==null?void 0:t.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}) `),t){const{transformPerspective:c,rotate:u,rotateX:f,rotateY:d,skewX:h,skewY:p}=t;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=n.x.scale*e.x,l=n.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const pse=(n,e)=>n.depth-e.depth;class mse{constructor(){this.children=[],this.isDirty=!1}add(e){nE(this.children,e),this.isDirty=!0}remove(e){rE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(pse),this.isDirty=!1,this.children.forEach(e)}}function gse(n,e){const t=Jo.now(),r=({timestamp:s})=>{const i=s-t;i>=e&&(Ui(r),n(i-e))};return dt.read(r,!0),()=>Ui(r)}function yse(n){window.MotionDebug&&window.MotionDebug.record(n)}function bse(n){return n instanceof SVGElement&&n.tagName!=="svg"}function wse(n,e,t){const r=Mn(n)?n:Dh(n);return r.start(tE("",r,e,t)),r.animation}const pE=["","X","Y","Z"],Ase={visibility:"hidden"},U_=1e3;let vse=0;const Sl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function mE(n,e,t,r){const{latestValues:s}=e;s[n]&&(t[n]=s[n],e.setStaticValue(n,0),r&&(r[n]=0))}function V_(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return!1;const{visualElement:e}=n.options;return e?XB(e)?!0:n.parent&&!n.parent.hasCheckedOptimisedAppear?V_(n.parent):!1:!1}function H_({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=vse++,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,Sl.totalNodes=Sl.resolvedTargetDeltas=Sl.recalculatedProjection=0,this.nodes.forEach(Cse),this.nodes.forEach(Nse),this.nodes.forEach(Mse),this.nodes.forEach(kse),yse(Sl)},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 mse)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new sE),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=bse(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(c||l)&&(this.isLayoutDirty=!0),n){let f;const d=()=>this.root.updateBlockedByResize=!1;n(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=gse(d,250),c0.hasAnimatedSinceResize&&(c0.hasAnimatedSinceResize=!1,this.nodes.forEach($_))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&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||u.getDefaultTransition()||Lse,{onLayoutAnimationStart:y,onLayoutAnimationComplete:b}=u.getProps(),v=!this.targetLayout||!__(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={...Bx(m,"layout"),onPlay:y,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else d||$_(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,Ui(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(Rse),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&&V_(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];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 c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(z_);return}this.isUpdating||this.nodes.forEach(Tse),this.isUpdating=!1,this.nodes.forEach(Ose),this.nodes.forEach(xse),this.nodes.forEach(Ese),this.clearAllSnapshots();const a=Jo.now();En.delta=Wo(0,1e3/60,a-En.timestamp),En.timestamp=a,En.isProcessing=!0,Px.update.process(En),Px.preRender.process(En),Px.render.process(En),En.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Sse),this.sharedNodes.forEach(Pse)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,dt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){dt.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:t(this.instance)})}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!B_(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&(a||kl(this.latestValues)||u)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),Bse(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&&(Yo(a.x,l.offset.x),Yo(a.y,l.offset.y)),a}removeElementScroll(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:f}=c;if(c!==this.root&&u&&f.layoutScroll){if(u.isRoot){Jr(a,o);const{scroll:d}=this.root;d&&(Yo(a.x,-d.offset.x),Yo(a.y,-d.offset.y))}Yo(a.x,u.offset.x),Yo(a.y,u.offset.y)}}return a}applyTransform(o,a=!1){const l=Kt();Jr(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Ru(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),kl(u.latestValues)&&Ru(l,u.latestValues)}return kl(this.latestValues)&&Ru(l,this.latestValues),l}removeTransform(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!c.instance||!kl(c.latestValues))continue;dE(c.latestValues)&&c.updateSnapshot();const u=Kt(),f=c.measurePageBox();Jr(u,f),I_(a,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,u)}return kl(this.latestValues)&&I_(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!==En.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 c=!!this.resumingFrom||this!==l;if(!(o||c&&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=En.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(),Lh(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),Jr(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(),_re(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Jr(this.target,this.layout.layoutBox),b_(this.target,this.targetDelta)):Jr(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(),Lh(this.relativeTargetOrigin,this.target,h.target),Jr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Sl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||dE(this.parent.latestValues)||m_(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 c=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===En.timestamp&&(c=!1),c)return;const{layout:u,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||!(u||f))return;Jr(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;Wre(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=Mu(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=Mu(),this.projectionDeltaWithTransform=Mu());const m=this.projectionTransform;Ih(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=j_(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Sl.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,c=l?l.latestValues:{},u={...this.latestValues},f=Mu();(!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,y=this.getStack(),b=!y||y.members.length<=1,v=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(Ise));this.animationProgress=0;let A;this.mixTargetDelta=w=>{const x=w/1e3;G_(f.x,o.x,x),G_(f.y,o.y,x),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Lh(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Dse(this.relativeTarget,this.relativeTargetOrigin,d,x),A&&dse(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Kt()),Jr(A,this.relativeTarget)),m&&(this.animationValues=u,ose(u,c,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&&(Ui(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=dt.update(()=>{c0.hasAnimatedSinceResize=!0,this.currentAnimation=wse(0,U_,{...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(U_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&q_(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Kt();const f=Or(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=Or(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}Jr(a,l),Ru(a,u),Ih(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new hse),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}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 c={};l.z&&mE("z",o,c,this.animationValues);for(let u=0;u<pE.length;u++)mE(`rotate${pE[u]}`,o,c,this.animationValues),mE(`skew${pE[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Ase;const c={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,c.opacity="",c.pointerEvents=Xy(o==null?void 0:o.pointerEvents)||"",c.transform=u?u(this.latestValues,""):"none",c;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=Xy(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!kl(this.latestValues)&&(m.transform=u?u({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),c.transform=j_(this.projectionDeltaWithTransform,this.treeScale,d),u&&(c.transform=u(d,c.transform));const{x:h,y:p}=this.projectionDelta;c.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?c.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:c.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in Jy){if(d[m]===void 0)continue;const{correct:y,applyTo:b}=Jy[m],v=c.transform==="none"?d[m]:y(d[m],f);if(b){const A=b.length;for(let w=0;w<A;w++)c[b[w]]=v}else c[m]=v}return this.options.layoutId&&(c.pointerEvents=f===this?Xy(o==null?void 0:o.pointerEvents)||"":"none"),c}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(z_),this.root.sharedNodes.clear()}}}function xse(n){n.updateLayout()}function Ese(n){var e;const t=((e=n.resumeFrom)===null||e===void 0?void 0:e.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=n.layout,{animationType:i}=n.options,o=t.source!==n.layout.source;i==="size"?Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(d);d.min=r[f].min,d.max=d.min+h}):q_(i,t.layoutBox,r)&&Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(r[f]);d.max=d.min+h,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[f].max=n.relativeTarget[f].min+h)});const a=Mu();Ih(a,r,t.layoutBox);const l=Mu();o?Ih(l,n.applyTransform(s,!0),t.measuredBox):Ih(l,r,t.layoutBox);const c=!B_(a);let u=!1;if(!n.resumeFrom){const f=n.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=Kt();Lh(p,t.layoutBox,d.layoutBox);const m=Kt();Lh(m,r,h.layoutBox),__(p,m)||(u=!0),f.options.layoutRoot&&(n.relativeTarget=m,n.relativeTargetOrigin=p,n.relativeParent=f)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:u})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function Cse(n){Sl.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function kse(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function Sse(n){n.clearSnapshot()}function z_(n){n.clearMeasurements()}function Tse(n){n.isLayoutDirty=!1}function Ose(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function $_(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function Nse(n){n.resolveTargetDelta()}function Mse(n){n.calcProjection()}function Rse(n){n.resetSkewAndRotation()}function Pse(n){n.removeLeadSnapshot()}function G_(n,e,t){n.translate=Bt(e.translate,0,t),n.scale=Bt(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function W_(n,e,t,r){n.min=Bt(e.min,t.min,r),n.max=Bt(e.max,t.max,r)}function Dse(n,e,t,r){W_(n.x,e.x,t.x,r),W_(n.y,e.y,t.y,r)}function Ise(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Lse={duration:.45,ease:[.4,0,.1,1]},K_=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Q_=K_("applewebkit/")&&!K_("chrome/")?Math.round:xn;function J_(n){n.min=Q_(n.min),n.max=Q_(n.max)}function Bse(n){J_(n.x),J_(n.y)}function q_(n,e,t){return n==="position"||n==="preserve-aspect"&&!cE(F_(e),F_(t),.2)}const _se=H_({attachResizeListener:(n,e)=>Vi(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),gE={current:void 0},Y_=H_({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!gE.current){const n=new _se({});n.mount(window),n.setOptions({layoutScroll:!0}),gE.current=n}return gE.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Fse={pan:{Feature:ese},drag:{Feature:Zre,ProjectionNode:Y_,MeasureLayout:k_}},yE={current:null},X_={current:!1};function jse(){if(X_.current=!0,!!mx)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>yE.current=n.matches;n.addListener(e),e()}else yE.current=!1}function Use(n,e,t){const{willChange:r}=e;for(const s in e){const i=e[s],o=t[s];if(Mn(i))n.addValue(s,i),o0(r)&&r.add(s),process.env.NODE_ENV==="development"&&iE(i.version==="11.2.12",`Attempting to mix Framer Motion versions ${i.version} with 11.2.12 may not work as expected.`);else if(Mn(o))n.addValue(s,Dh(i,{owner:n})),o0(r)&&r.remove(s);else if(o!==i)if(n.hasValue(s)){const a=n.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=n.getStaticValue(s);n.addValue(s,Dh(a!==void 0?a:i,{owner:n}))}}for(const s in t)e[s]===void 0&&n.removeValue(s);return e}const Z_=new WeakMap,Vse=[...dB,Rn,qo],Hse=n=>Vse.find(fB(n)),eF=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],zse=Ax.length;class $se{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,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=jx,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=()=>dt.render(this.render,!1,!0);const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Qy(t),this.isVariantNode=ML(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(t,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&Mn(h)&&(h.set(l[d],!1),o0(u)&&u.add(d))}}mount(e){this.current=e,Z_.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((t,r)=>this.bindToMotionValue(r,t)),X_.current||jse(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yE.current,process.env.NODE_ENV!=="production"&&iE(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(){Z_.delete(this.current),this.projection&&this.projection.unmount(),Ui(this.notifyUpdate),Ui(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 t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){const r=vl.has(e),s=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&dt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{s(),i(),t.owner&&t.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 ku){const t=ku[e];if(!t)continue;const{isEnabled:r,Feature:s}=t;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,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<eF.length;r++){const s=eF[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=Use(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 t={};for(let r=0;r<zse;r++){const s=Ax[r],i=this.props[s];(Eh(i)||i===!1)&&(t[s]=i)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=Dh(t===null?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){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"&&(oB(s)||iB(s))?s=parseFloat(s):!Hse(s)&&qo.test(t)&&(s=xB(e,t)),this.setBaseTarget(e,Mn(s)?s.get():s)),Mn(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=Mx(this.props,r,(t=this.presenceContext)===null||t===void 0?void 0:t.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Mn(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new sE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class tF extends $se{constructor(){super(...arguments),this.KeyframeResolver=EB}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}}function Gse(n){return window.getComputedStyle(n)}class Wse extends tF{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,t){if(vl.has(t)){const r=$x(t);return r&&r.default||0}else{const r=Gse(e),s=(LL(t)?r.getPropertyValue(t):r[t])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return v_(e,t)}build(e,t,r,s){kx(e,t,r,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return Nx(e,t,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Mn(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}renderInstance(e,t,r,s){zL(e,t,r,s)}}class Kse extends tF{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(vl.has(t)){const r=$x(t);return r&&r.default||0}return t=$L.has(t)?t:yx(t),e.getAttribute(t)}measureInstanceViewportBox(){return Kt()}scrapeMotionValuesFromProps(e,t,r){return WL(e,t,r)}build(e,t,r,s){Tx(e,t,r,this.isSVGTag,s.transformTemplate)}renderInstance(e,t,r,s){GL(e,t,r,s)}mount(e){this.isSVGTag=Ox(e.tagName),super.mount(e)}}const Qse=(n,e)=>xx(n)?new Kse(e,{enableHardwareAcceleration:!1}):new Wse(e,{allowProjection:n!==P.Fragment,enableHardwareAcceleration:!0}),Jse={...Dre,...Gte,...Fse,...{layout:{ProjectionNode:Y_,MeasureLayout:k_}}},qse=tte((n,e)=>Pte(n,e,Jse,Qse));function nF(){const n=P.useRef(!1);return gx(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function Yse(){const n=nF(),[e,t]=P.useState(0),r=P.useCallback(()=>{n.current&&t(e+1)},[e]);return[P.useCallback(()=>dt.postRender(r),[r]),e]}class Xse extends H.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Zse({children:n,isPresent:e}){const t=P.useId(),r=P.useRef(null),s=P.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=P.useContext(px);return P.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:c}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=t;const u=document.createElement("style");return i&&(u.nonce=i),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(`
|
452
|
+
3. "-" cannot repeat`);It.customSchemes.push([n,e])}function oK(){It.scanner=YW(It.customSchemes);for(let n=0;n<It.tokenQueue.length;n++)It.tokenQueue[n][1]({scanner:It.scanner});It.parser=tK(It.scanner.tokens);for(let n=0;n<It.pluginQueue.length;n++)It.pluginQueue[n][1]({scanner:It.scanner,parser:It.parser});It.initialized=!0}function qM(n){return It.initialized||oK(),nK(It.parser.start,n,XW(It.scanner.start,n))}function YM(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Cv(t),s=qM(n),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}function aK(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function lK(n){return new At({key:new Rt("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=NU(t.doc,[...e]);if(_U(a).forEach(({newRange:c})=>{const u=RU(r.doc,c,h=>h.isTextblock);let f,d;if(u.length>1?(f=u[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(f=u[0],d=r.doc.textBetween(f.pos,c.to,void 0," ")),f&&d){const h=d.split(" ").filter(b=>b!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;const y=qM(p).map(b=>b.toObject());if(!aK(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate?n.validate(b.value):!0).forEach(b=>{Nb(b.from,b.to,r.doc).some(v=>v.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function cK(n){return new At({key:new Rt("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(n.whenNotEditable&&e.editable||r.button!==0)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(d=>d.nodeName==="A"))return!1;const l=uS(e.state,n.type.name),c=r.target,u=(s=c==null?void 0:c.href)!==null&&s!==void 0?s:l.href,f=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:l.target;return c&&u?(window.open(u,f),!0):!1}}})}function uK(n){return new At({key:new Rt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:s}=e,{selection:i}=s,{empty:o}=i;if(o)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=YM(a).find(c=>c.isLink&&c.value===a);return!a||!l?!1:(n.editor.commands.setMark(n.type,{href:l.href}),!0)}}})}const fK=Zn.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){JM(n);return}JM(n.scheme,n.optionalSlashes)})},onDestroy(){iK()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",nt(this.options.HTMLAttributes,{...n,href:""}),0]:["a",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vo({find:n=>{const e=[];if(n){const t=YM(n).filter(r=>r.isLink);t.length&&t.forEach(r=>e.push({text:r.value,data:{href:r.href},index:r.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(lK({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(cK({type:this.type,whenNotEditable:this.options.openOnClick==="whenNotEditable"})),this.options.linkOnPaste&&n.push(uK({editor:this.editor,type:this.type})),n}}),dK=Ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new At({key:new Rt("placeholder"),props:{decorations:({doc:n,selection:e})=>{var t;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=e,i=[];if(!r)return null;const{firstChild:o}=n.content,a=o&&o.type.isLeaf,l=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((t=n.type.contentMatch.defaultType)===null||t===void 0?void 0:t.name),u=n.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!a||!l);return n.descendants((f,d)=>{const h=s>=d&&s<=d+f.nodeSize,p=!f.isLeaf&&!f.childCount;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];u&&m.push(this.options.emptyEditorClass);const y=en.node(d,d+f.nodeSize,{class:m.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:d,hasAnchor:h}):this.options.placeholder});i.push(y)}return this.options.includeChildren}),vt.create(n,i)}}})]}}),hK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,pK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,mK=Zn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Pa({find:hK,type:this.type})]},addPasteRules(){return[vo({find:pK,type:this.type})]}}),gK=xt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",nt(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),yK=/^\s*(\[([( |x])?\])\s$/,bK=xt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",nt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const d=t(),h=f.doc.nodeAt(d);return f.setNodeMarkup(d,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{s.setAttribute(c,u)}),s.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,o),s.append(i,l),Object.entries(e).forEach(([c,u])=>{s.setAttribute(c,u)}),{dom:s,contentDOM:l,update:c=>c.type!==this.type?!1:(s.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[yc({find:yK,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),wK=Zn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),AK=PM.extend({renderHTML(){return["div",nt(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),vK=Ot.create({name:"columnExtension",addExtensions(){const n=[];return this.options.column!==!1&&n.push(eN),this.options.columns!==!1&&n.push(mm),n}}),xK=Ot.create({name:"CustomKeymap",addCommands(){return{selectTextWithinNodeBoundaries:()=>({editor:n,commands:e})=>{const{state:t}=n,{tr:r}=t,s=r.selection.$from.start(),i=r.selection.$to.end();return e.setTextSelection({from:s,to:i})}}},addKeyboardShortcuts(){return{"Mod-a":({editor:n})=>{const{state:e}=n,{tr:t}=e,r=t.selection.from,s=t.selection.to,i=t.selection.$from.start(),o=t.selection.$to.end();return r>i||s<o?(n.chain().selectTextWithinNodeBoundaries().run(),!0):!1}}}}),EK=Ot.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),XM=[{tooltip:"Align left",action:n=>n({dataAlign:"start",dataFloat:null}),icon:"AlignLeft",isActive:n=>n.dataAlign==="start"},{tooltip:"Align center",action:n=>n({dataAlign:"center",dataFloat:null}),icon:"AlignCenter",isActive:n=>n.dataAlign==="center"},{tooltip:"Align right",action:n=>n({dataAlign:"end",dataFloat:null}),icon:"AlignRight",isActive:n=>n.dataAlign==="end"},{tooltip:"Delete",icon:"Trash2",delete:n=>n()}];let Kc;const ZM=({node:n,updateAttributes:e,deleteNode:t})=>{const r=gm(),[s,i]=P.useState(),[o,a]=P.useState(0),[l,c]=P.useState(0),[u,f]=P.useState({}),d=P.useRef(null),[h,p]=P.useState(!1),m=()=>{const F={};XM.forEach(({tooltip:G,isActive:B})=>{F[G]=!!(B!=null&&B(n.attrs))}),f(F)},y=()=>{const F=document.querySelector(".ProseMirror");if(F&&c(F==null?void 0:F.clientWidth),!!d.current){if(s==="video"){const G=d.current;G.addEventListener("loadeddata",function(){a(G.videoWidth/G.videoHeight),C("left",0)})}else if(s==="iframe"){const G=d.current;G.onload=()=>{a(G.offsetWidth/G.offsetHeight),C("left",0)}}else d.current.onload=()=>{a(d.current.naturalWidth/d.current.naturalHeight)};setTimeout(()=>m(),200)}},b=F=>{Kc=F};P.useEffect(()=>{y()},[]);const v=({width:F,height:G})=>F<200||G<200,A=F=>{setTimeout(()=>S(F))},w=F=>{Kc=F.clientX,setTimeout(()=>{document.addEventListener("mousemove",A),document.addEventListener("mouseup",x)}),p(!0)},x=()=>{Kc=-1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",x),p(!1)},C=(F,G)=>{var Q,ee;if(!d.current){console.error("Media ref is undefined|null",{resizableImg:d.current});return}const B={width:(Q=d.current)==null?void 0:Q.width,height:(ee=d.current)==null?void 0:ee.height},V={width:-1,height:-1};F==="left"?V.width=B.width-Math.abs(G):(typeof B.width=="string"&&(B.width=Number(B.width)),V.width=B.width+Math.abs(G)),V.width>l&&(V.width=l),s==="iframe"?V.height=V.width/(16/9):V.height=V.width/o,!v(V)&&e(V)},S=F=>{if(Kc===-1)return;const{clientX:G}=F,B=Kc-G;if(B===0)return;const V=B>0?"left":"right";setTimeout(()=>{C(V,Math.abs(B)),Kc=G})},[M,R]=P.useState(),[O,D]=P.useState();P.useEffect(()=>{i(n.attrs["media-type"]),m(),R(n.attrs.dataFloat),D(n.attrs.dataAlign)},[n.attrs]);const _=F=>{switch(F){case"AlignLeft":return k.jsx(ad,{size:16});case"AlignCenter":return k.jsx(Xb,{size:16});case"AlignRight":return k.jsx(Zb,{size:16});case"Trash2":return k.jsx(aw,{size:16});default:return null}};return k.jsx(od,{as:"article",className:pe("media-node-view not-prose transition-all ease-in-out w-full",M&&`f-${n.attrs.dataFloat}`,O&&`justify-${n.attrs.dataAlign}`),children:k.jsxs("div",{className:"w-fit flex relative group transition-all ease-in-out",children:[s==="img"&&k.jsx("img",{src:n.attrs.src,ref:d,className:"rounded-lg",alt:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),s==="video"&&k.jsx("video",{ref:d,className:"rounded-lg",controls:!0,width:n.attrs.width,height:n.attrs.height,children:k.jsx("source",{src:n.attrs.src})}),s==="iframe"&&k.jsx("iframe",{ref:d,className:pe("rounded-lg max-w-full",h&&"pointer-events-none"),src:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),!r&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"horizontal-resize-handle group-hover:bg-black group-hover:border-2 group-hover:border-white/80",title:"Resize",onClick:({clientX:F})=>b(F),onMouseDown:w,onMouseUp:x}),k.jsx("section",{className:"media-control-buttons opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex",children:XM.map((F,G)=>k.jsx("div",{className:"tooltip","data-tip":F.tooltip,children:k.jsx("button",{type:"button",className:pe("btn rounded-none h-8 px-2 py-1 transition",u[F.tooltip]&&"active"),onClick:()=>{var B;return F.tooltip==="Delete"?t():(B=F.action)==null?void 0:B.call(F,e)},children:F.icon&&_(F.icon)})},G))})]})]})})},CK=xt.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},"media-type":{default:"iframe"},alt:{default:null},title:{default:null},width:{default:this.options.width},height:{default:this.options.height},dataAlign:{default:"left"},dataFloat:{default:null}}},addNodeView(){return _a(ZM)},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",nt(this.options.HTMLAttributes,n)]},addCommands(){return{setIframe:n=>({tr:e,dispatch:t})=>{const{selection:r}=e,s=this.type.create(n);return t&&e.replaceRangeWith(r.from-1,r.to,s),!0}}}});var kK="https://platform.twitter.com/widgets.js",Sv="createTweet",SK=function(e){var t=P.useRef(null),r=P.useState(!0),s=r[0],i=r[1];return P.useEffect(function(){var o=!0,a=require("scriptjs");return a(kK,"twitter-embed",function(){if(!window.twttr){console.error("Failure to load window.twttr, aborting load");return}if(o){if(!window.twttr.widgets[Sv]){console.error("Method "+Sv+" is not present anymore in twttr.widget api");return}window.twttr.widgets[Sv](e.tweetId,t==null?void 0:t.current,e.options).then(function(l){i(!1),e.onLoad&&e.onLoad(l)})}}),function(){o=!1}},[]),P.createElement(P.Fragment,null,s&&P.createElement(P.Fragment,null,e.placeholder),P.createElement("div",{ref:t}))};const TK=({node:n,editor:e})=>{const[t,r]=P.useState(!0);return P.useEffect(()=>{e==null||e.chain().focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:k.jsxs("div",{className:"w-full max-w-sm",children:[t&&k.jsx(fN,{width:5,height:5}),k.jsx(SK,{tweetId:n.attrs.tweetId,onLoad:()=>r(!1)})]})})},OK=xt.create({name:"embeddedTweet",group:"block",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:""}}},addAttributes(){return{tweetId:{default:null},align:{default:"center"}}},parseHTML(){return[{tag:"div[data-tweet-id]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(this.options.HTMLAttributes,n)]},addNodeView(){return _a(TK)},addCommands(){return{setTweetEmbed:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{tweetId:n.tweetId,align:"center"},content:[]})}}}),NK=n=>new At({key:new Rt("media-paste-drop"),props:{handlePaste(e,t){var s;return Array.from(((s=t.clipboardData)==null?void 0:s.items)||[]).forEach(i=>{const o=i.getAsFile();if(((o==null?void 0:o.type.indexOf("image"))===0||(o==null?void 0:o.type.indexOf("video"))===0)&&(t.preventDefault(),o&&o.size>1024*1024))throw new Error("Image too large")}),!1},handleDrop(e,t){var a;if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const s=Array.from(((a=t.dataTransfer)==null?void 0:a.files)??[]).filter(({type:l})=>/image|video/i.test(l));if(s.length===0)return!1;t.preventDefault();const{schema:i}=e.state,o=e.posAtCoords({left:t.clientX,top:t.clientY});return o?(s.forEach(async l=>{const c=new FileReader;if(n){const u=i.nodes.resizableMedia.create({src:await n(l),"media-type":l.type.includes("image")?"img":"video"}),f=e.state.tr.insert(o.pos,u);e.dispatch(f)}else c.onload=u=>{var h;const f=i.nodes.resizableMedia.create({src:(h=u.target)==null?void 0:h.result,"media-type":l.type.includes("image")?"img":"video"}),d=e.state.tr.insert(o.pos,f);e.dispatch(d)},c.readAsDataURL(l)}),!0):!1}}}),MK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,RK=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,PK=xt.create({name:"resizableMedia",addOptions(){return{HTMLAttributes:{class:"rounded-lg border border-stone-200"},uploadFn:async()=>""}},inline:!1,group:"block",draggable:!0,addAttributes(){return{src:{default:null},"media-type":{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},dataAlign:{default:"left"},dataFloat:{default:null}}},selectable:!0,parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:n=>({src:n.getAttribute("src"),"media-type":"img"})},{tag:"video",getAttrs:n=>({src:n.getAttribute("src"),"media-type":"video"})}]},renderHTML({HTMLAttributes:n}){const{"media-type":e}=n;return e==="img"?["img",nt(this.options.HTMLAttributes,n)]:e==="video"?["video",{controls:"true",style:"width: 100%",...n},["source",n]]:(e||console.error("TiptapMediaExtension-renderHTML method: Media Type not set, going default with image"),["img",nt(this.options.HTMLAttributes,n)])},addCommands(){return{setMedia:n=>({commands:e})=>{const{"media-type":t}=n;return t==="img"?e.insertContent({type:this.name,attrs:n}):t==="video"?e.insertContent({type:this.name,attrs:{...n,controls:"true"}}):(t||console.error("TiptapMediaExtension-setMedia: Media Type not set, going default with image"),e.insertContent({type:this.name,attrs:n}))}}},addNodeView(){return _a(ZM)},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{selection:e}=n.state;if(e.empty)return!1;const t=e.$to.pos;return n.commands.insertContentAt(t,{type:"dBlock",content:[{type:"paragraph"}]})}}},addInputRules(){return[Db({find:MK,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r,"media-type":"img"}}}),Db({find:RK,type:this.type,getAttributes:n=>{const[,,e]=n;return{src:e,"media-type":"video"}}})]},addProseMirrorPlugins(){return[NK(this.options.uploadFn),k8()]}});function Tv(n,e){let t;return(...s)=>{clearTimeout(t),t=setTimeout(()=>n(...s),e)}}const DK=["top","right","bottom","left"],Qs=Math.min,kr=Math.max,Lg=Math.round,Bg=Math.floor,Io=n=>({x:n,y:n}),IK={left:"right",right:"left",bottom:"top",top:"bottom"},LK={start:"end",end:"start"};function Ov(n,e,t){return kr(n,Qs(e,t))}function Ti(n,e){return typeof n=="function"?n(e):n}function Oi(n){return n.split("-")[0]}function Qc(n){return n.split("-")[1]}function Nv(n){return n==="x"?"y":"x"}function Mv(n){return n==="y"?"height":"width"}function Jc(n){return["top","bottom"].includes(Oi(n))?"y":"x"}function Rv(n){return Nv(Jc(n))}function BK(n,e,t){t===void 0&&(t=!1);const r=Qc(n),s=Rv(n),i=Mv(s);let o=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=_g(o)),[o,_g(o)]}function _K(n){const e=_g(n);return[Pv(n),e,Pv(e)]}function Pv(n){return n.replace(/start|end/g,e=>LK[e])}function FK(n,e,t){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?s:r:e?r:s;case"left":case"right":return e?i:o;default:return[]}}function jK(n,e,t,r){const s=Qc(n);let i=FK(Oi(n),t==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Pv)))),i}function _g(n){return n.replace(/left|right|bottom|top/g,e=>IK[e])}function UK(n){return{top:0,right:0,bottom:0,left:0,...n}}function eR(n){return typeof n!="number"?UK(n):{top:n,right:n,bottom:n,left:n}}function Fg(n){const{x:e,y:t,width:r,height:s}=n;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function tR(n,e,t){let{reference:r,floating:s}=n;const i=Jc(e),o=Rv(e),a=Mv(o),l=Oi(e),c=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,d=r[a]/2-s[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Qc(e)){case"start":h[o]-=d*(t&&c?-1:1);break;case"end":h[o]+=d*(t&&c?-1:1);break}return h}const VK=async(n,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=t,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:s}),{x:u,y:f}=tR(c,r,l),d=r,h={},p=0;for(let m=0;m<a.length;m++){const{name:y,fn:b}=a[m],{x:v,y:A,data:w,reset:x}=await b({x:u,y:f,initialPlacement:r,placement:d,strategy:s,middlewareData:h,rects:c,platform:o,elements:{reference:n,floating:e}});u=v??u,f=A??f,h={...h,[y]:{...h[y],...w}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(d=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:s}):x.rects),{x:u,y:f}=tR(c,d,l)),m=-1)}return{x:u,y:f,placement:d,strategy:s,middlewareData:h}};async function Kd(n,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Ti(e,n),p=eR(h),y=a[d?f==="floating"?"reference":"floating":f],b=Fg(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(A))?await(i.getScale==null?void 0:i.getScale(A))||{x:1,y:1}:{x:1,y:1},x=Fg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:A,strategy:l}):v);return{top:(b.top-x.top+p.top)/w.y,bottom:(x.bottom-b.bottom+p.bottom)/w.y,left:(b.left-x.left+p.left)/w.x,right:(x.right-b.right+p.right)/w.x}}const HK=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Ti(n,e)||{};if(c==null)return{};const f=eR(u),d={x:t,y:r},h=Rv(s),p=Mv(h),m=await o.getDimensions(c),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",A=y?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-d[h]-i.floating[p],x=d[h]-i.reference[h],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=C?C[A]:0;(!S||!await(o.isElement==null?void 0:o.isElement(C)))&&(S=a.floating[A]||i.floating[p]);const M=w/2-x/2,R=S/2-m[p]/2-1,O=Qs(f[b],R),D=Qs(f[v],R),_=O,F=S-m[p]-D,G=S/2-m[p]/2+M,B=Ov(_,G,F),V=!l.arrow&&Qc(s)!=null&&G!==B&&i.reference[p]/2-(G<_?O:D)-m[p]/2<0,Q=V?G<_?G-_:G-F:0;return{[h]:d[h]+Q,data:{[h]:B,centerOffset:G-B-Q,...V&&{alignmentOffset:Q}},reset:V}}}),zK=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Ti(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=Oi(s),v=Oi(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=d||(v||!m?[_g(a)]:_K(a));!d&&p!=="none"&&w.push(...jK(a,m,p,A));const x=[a,...w],C=await Kd(e,y),S=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&S.push(C[b]),f){const _=BK(s,o,A);S.push(C[_[0]],C[_[1]])}if(M=[...M,{placement:s,overflows:S}],!S.every(_=>_<=0)){var R,O;const _=(((R=i.flip)==null?void 0:R.index)||0)+1,F=x[_];if(F)return{data:{index:_,overflows:M},reset:{placement:F}};let G=(O=M.filter(B=>B.overflows[0]<=0).sort((B,V)=>B.overflows[1]-V.overflows[1])[0])==null?void 0:O.placement;if(!G)switch(h){case"bestFit":{var D;const B=(D=M.map(V=>[V.placement,V.overflows.filter(Q=>Q>0).reduce((Q,ee)=>Q+ee,0)]).sort((V,Q)=>V[1]-Q[1])[0])==null?void 0:D[0];B&&(G=B);break}case"initialPlacement":G=a;break}if(s!==G)return{reset:{placement:G}}}return{}}}};function nR(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function rR(n){return DK.some(e=>n[e]>=0)}const $K=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...s}=Ti(n,e);switch(r){case"referenceHidden":{const i=await Kd(e,{...s,elementContext:"reference"}),o=nR(i,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:rR(o)}}}case"escaped":{const i=await Kd(e,{...s,altBoundary:!0}),o=nR(i,t.floating);return{data:{escapedOffsets:o,escaped:rR(o)}}}default:return{}}}}};async function GK(n,e){const{placement:t,platform:r,elements:s}=n,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Oi(t),a=Qc(t),l=Jc(t)==="y",c=["left","top"].includes(o)?-1:1,u=i&&l?-1:1,f=Ti(e,n);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:d*c}:{x:d*c,y:h*u}}const WK=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await GK(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},KK=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:b,y:v}=y;return{x:b,y:v}}},...l}=Ti(n,e),c={x:t,y:r},u=await Kd(e,l),f=Jc(Oi(s)),d=Nv(f);let h=c[d],p=c[f];if(i){const y=d==="y"?"top":"left",b=d==="y"?"bottom":"right",v=h+u[y],A=h-u[b];h=Ov(v,h,A)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",v=p+u[y],A=p-u[b];p=Ov(v,p,A)}const m=a.fn({...e,[d]:h,[f]:p});return{...m,data:{x:m.x-t,y:m.y-r}}}}},QK=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ti(n,e),u={x:t,y:r},f=Jc(s),d=Nv(f);let h=u[d],p=u[f];const m=Ti(a,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const A=d==="y"?"height":"width",w=i.reference[d]-i.floating[A]+y.mainAxis,x=i.reference[d]+i.reference[A]-y.mainAxis;h<w?h=w:h>x&&(h=x)}if(c){var b,v;const A=d==="y"?"width":"height",w=["top","left"].includes(Oi(s)),x=i.reference[f]-i.floating[A]+(w&&((b=o.offset)==null?void 0:b[f])||0)+(w?0:y.crossAxis),C=i.reference[f]+i.reference[A]+(w?0:((v=o.offset)==null?void 0:v[f])||0)-(w?y.crossAxis:0);p<x?p=x:p>C&&(p=C)}return{[d]:h,[f]:p}}}},JK=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:s,elements:i}=e,{apply:o=()=>{},...a}=Ti(n,e),l=await Kd(e,a),c=Oi(t),u=Qc(t),f=Jc(t)==="y",{width:d,height:h}=r.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");const y=h-l.top-l.bottom,b=d-l.left-l.right,v=Qs(h-l[p],y),A=Qs(d-l[m],b),w=!e.middlewareData.shift;let x=v,C=A;if(f?C=u||w?Qs(A,b):b:x=u||w?Qs(v,y):y,w&&!u){const M=kr(l.left,0),R=kr(l.right,0),O=kr(l.top,0),D=kr(l.bottom,0);f?C=d-2*(M!==0||R!==0?M+R:kr(l.left,l.right)):x=h-2*(O!==0||D!==0?O+D:kr(l.top,l.bottom))}await o({...e,availableWidth:C,availableHeight:x});const S=await s.getDimensions(i.floating);return d!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}};function qc(n){return sR(n)?(n.nodeName||"").toLowerCase():"#document"}function Sr(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Ni(n){var e;return(e=(sR(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function sR(n){return n instanceof Node||n instanceof Sr(n).Node}function Js(n){return n instanceof Element||n instanceof Sr(n).Element}function qs(n){return n instanceof HTMLElement||n instanceof Sr(n).HTMLElement}function iR(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Sr(n).ShadowRoot}function Qd(n){const{overflow:e,overflowX:t,overflowY:r,display:s}=ms(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(s)}function qK(n){return["table","td","th"].includes(qc(n))}function Dv(n){const e=Iv(),t=ms(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function YK(n){let e=Lo(n);for(;qs(e)&&!Yc(e);){if(Dv(e))return e;e=Lo(e)}return null}function Iv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Yc(n){return["html","body","#document"].includes(qc(n))}function ms(n){return Sr(n).getComputedStyle(n)}function jg(n){return Js(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function Lo(n){if(qc(n)==="html")return n;const e=n.assignedSlot||n.parentNode||iR(n)&&n.host||Ni(n);return iR(e)?e.host:e}function oR(n){const e=Lo(n);return Yc(e)?n.ownerDocument?n.ownerDocument.body:n.body:qs(e)&&Qd(e)?e:oR(e)}function Jd(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=oR(n),i=s===((r=n.ownerDocument)==null?void 0:r.body),o=Sr(s);return i?e.concat(o,o.visualViewport||[],Qd(s)?s:[],o.frameElement&&t?Jd(o.frameElement):[]):e.concat(s,Jd(s,[],t))}function aR(n){const e=ms(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=qs(n),i=s?n.offsetWidth:t,o=s?n.offsetHeight:r,a=Lg(t)!==i||Lg(r)!==o;return a&&(t=i,r=o),{width:t,height:r,$:a}}function Lv(n){return Js(n)?n:n.contextElement}function Xc(n){const e=Lv(n);if(!qs(e))return Io(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:i}=aR(e);let o=(i?Lg(t.width):t.width)/r,a=(i?Lg(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const XK=Io(0);function lR(n){const e=Sr(n);return!Iv()||!e.visualViewport?XK:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ZK(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Sr(n)?!1:e}function rl(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),i=Lv(n);let o=Io(1);e&&(r?Js(r)&&(o=Xc(r)):o=Xc(n));const a=ZK(i,t,r)?lR(i):Io(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const d=Sr(i),h=r&&Js(r)?Sr(r):r;let p=d,m=p.frameElement;for(;m&&r&&h!==p;){const y=Xc(m),b=m.getBoundingClientRect(),v=ms(m),A=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,w=b.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=A,c+=w,p=Sr(m),m=p.frameElement}}return Fg({width:u,height:f,x:l,y:c})}const e7=[":popover-open",":modal"];function Bv(n){return e7.some(e=>{try{return n.matches(e)}catch{return!1}})}function t7(n){let{elements:e,rect:t,offsetParent:r,strategy:s}=n;const i=s==="fixed",o=Ni(r),a=e?Bv(e.floating):!1;if(r===o||a&&i)return t;let l={scrollLeft:0,scrollTop:0},c=Io(1);const u=Io(0),f=qs(r);if((f||!f&&!i)&&((qc(r)!=="body"||Qd(o))&&(l=jg(r)),qs(r))){const d=rl(r);c=Xc(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x,y:t.y*c.y-l.scrollTop*c.y+u.y}}function n7(n){return Array.from(n.getClientRects())}function cR(n){return rl(Ni(n)).left+jg(n).scrollLeft}function r7(n){const e=Ni(n),t=jg(n),r=n.ownerDocument.body,s=kr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=kr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+cR(n);const a=-t.scrollTop;return ms(r).direction==="rtl"&&(o+=kr(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}function s7(n,e){const t=Sr(n),r=Ni(n),s=t.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const c=Iv();(!c||c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:i,height:o,x:a,y:l}}function i7(n,e){const t=rl(n,!0,e==="fixed"),r=t.top+n.clientTop,s=t.left+n.clientLeft,i=qs(n)?Xc(n):Io(1),o=n.clientWidth*i.x,a=n.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function uR(n,e,t){let r;if(e==="viewport")r=s7(n,t);else if(e==="document")r=r7(Ni(n));else if(Js(e))r=i7(e,t);else{const s=lR(n);r={...e,x:e.x-s.x,y:e.y-s.y}}return Fg(r)}function fR(n,e){const t=Lo(n);return t===e||!Js(t)||Yc(t)?!1:ms(t).position==="fixed"||fR(t,e)}function o7(n,e){const t=e.get(n);if(t)return t;let r=Jd(n,[],!1).filter(a=>Js(a)&&qc(a)!=="body"),s=null;const i=ms(n).position==="fixed";let o=i?Lo(n):n;for(;Js(o)&&!Yc(o);){const a=ms(o),l=Dv(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Qd(o)&&!l&&fR(n,o))?r=r.filter(u=>u!==o):s=a,o=Lo(o)}return e.set(n,r),r}function a7(n){let{element:e,boundary:t,rootBoundary:r,strategy:s}=n;const o=[...t==="clippingAncestors"?Bv(e)?[]:o7(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{const f=uR(e,u,s);return c.top=kr(f.top,c.top),c.right=Qs(f.right,c.right),c.bottom=Qs(f.bottom,c.bottom),c.left=kr(f.left,c.left),c},uR(e,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function l7(n){const{width:e,height:t}=aR(n);return{width:e,height:t}}function c7(n,e,t){const r=qs(e),s=Ni(e),i=t==="fixed",o=rl(n,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Io(0);if(r||!r&&!i)if((qc(e)!=="body"||Qd(s))&&(a=jg(e)),r){const f=rl(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&(l.x=cR(s));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function _v(n){return ms(n).position==="static"}function dR(n,e){return!qs(n)||ms(n).position==="fixed"?null:e?e(n):n.offsetParent}function hR(n,e){const t=Sr(n);if(Bv(n))return t;if(!qs(n)){let s=Lo(n);for(;s&&!Yc(s);){if(Js(s)&&!_v(s))return s;s=Lo(s)}return t}let r=dR(n,e);for(;r&&qK(r)&&_v(r);)r=dR(r,e);return r&&Yc(r)&&_v(r)&&!Dv(r)?t:r||YK(n)||t}const u7=async function(n){const e=this.getOffsetParent||hR,t=this.getDimensions,r=await t(n.floating);return{reference:c7(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function f7(n){return ms(n).direction==="rtl"}const d7={convertOffsetParentRelativeRectToViewportRelativeRect:t7,getDocumentElement:Ni,getClippingRect:a7,getOffsetParent:hR,getElementRects:u7,getClientRects:n7,getDimensions:l7,getScale:Xc,isElement:Js,isRTL:f7};function h7(n,e){let t=null,r;const s=Ni(n);function i(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:d}=n.getBoundingClientRect();if(a||e(),!f||!d)return;const h=Bg(u),p=Bg(s.clientWidth-(c+f)),m=Bg(s.clientHeight-(u+d)),y=Bg(c),v={rootMargin:-h+"px "+-p+"px "+-m+"px "+-y+"px",threshold:kr(0,Qs(1,l))||1};let A=!0;function w(x){const C=x[0].intersectionRatio;if(C!==l){if(!A)return o();C?o(!1,C):r=setTimeout(()=>{o(!1,1e-7)},1e3)}A=!1}try{t=new IntersectionObserver(w,{...v,root:s.ownerDocument})}catch{t=new IntersectionObserver(w,v)}t.observe(n)}return o(!0),i}function p7(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Lv(n),u=s||i?[...c?Jd(c):[],...Jd(e)]:[];u.forEach(b=>{s&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=c&&a?h7(c,t):null;let d=-1,h=null;o&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(e)})),t()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?rl(n):null;l&&y();function y(){const b=rl(n);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&t(),m=b,p=requestAnimationFrame(y)}return t(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",t),i&&v.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const m7=WK,g7=KK,y7=zK,b7=JK,w7=$K,pR=HK,A7=QK,v7=(n,e,t)=>{const r=new Map,s={platform:d7,...t},i={...s.platform,_c:r};return VK(n,e,{...s,platform:i})};var Ug=typeof document<"u"?P.useLayoutEffect:P.useEffect;function Vg(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,s;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!Vg(n[r],e[r]))return!1;return!0}if(s=Object.keys(n),t=s.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=t;r--!==0;){const i=s[r];if(!(i==="_owner"&&n.$$typeof)&&!Vg(n[i],e[i]))return!1}return!0}return n!==n&&e!==e}function mR(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function gR(n,e){const t=mR(n);return Math.round(e*t)/t}function yR(n){const e=H.useRef(n);return Ug(()=>{e.current=n}),e}function x7(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,f]=H.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=H.useState(r);Vg(d,r)||h(r);const[p,m]=H.useState(null),[y,b]=H.useState(null),v=H.useCallback(Q=>{Q!==C.current&&(C.current=Q,m(Q))},[]),A=H.useCallback(Q=>{Q!==S.current&&(S.current=Q,b(Q))},[]),w=i||p,x=o||y,C=H.useRef(null),S=H.useRef(null),M=H.useRef(u),R=l!=null,O=yR(l),D=yR(s),_=H.useCallback(()=>{if(!C.current||!S.current)return;const Q={placement:e,strategy:t,middleware:d};D.current&&(Q.platform=D.current),v7(C.current,S.current,Q).then(ee=>{const Z={...ee,isPositioned:!0};F.current&&!Vg(M.current,Z)&&(M.current=Z,C0.flushSync(()=>{f(Z)}))})},[d,e,t,D]);Ug(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const F=H.useRef(!1);Ug(()=>(F.current=!0,()=>{F.current=!1}),[]),Ug(()=>{if(w&&(C.current=w),x&&(S.current=x),w&&x){if(O.current)return O.current(w,x,_);_()}},[w,x,_,O,R]);const G=H.useMemo(()=>({reference:C,floating:S,setReference:v,setFloating:A}),[v,A]),B=H.useMemo(()=>({reference:w,floating:x}),[w,x]),V=H.useMemo(()=>{const Q={position:t,left:0,top:0};if(!B.floating)return Q;const ee=gR(B.floating,u.x),Z=gR(B.floating,u.y);return a?{...Q,transform:"translate("+ee+"px, "+Z+"px)",...mR(B.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ee,top:Z}},[t,a,B.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:_,refs:G,elements:B,floatingStyles:V}),[u,_,G,B,V])}const E7=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:s}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?pR({element:r.current,padding:s}).fn(t):{}:r?pR({element:r,padding:s}).fn(t):{}}}},C7=(n,e)=>({...m7(n),options:[n,e]}),k7=(n,e)=>({...g7(n),options:[n,e]}),S7=(n,e)=>({...A7(n),options:[n,e]}),T7=(n,e)=>({...y7(n),options:[n,e]}),O7=(n,e)=>({...b7(n),options:[n,e]}),N7=(n,e)=>({...w7(n),options:[n,e]}),M7=(n,e)=>({...E7(n),options:[n,e]});var R7="Arrow",bR=H.forwardRef((n,e)=>{const{children:t,width:r=10,height:s=5,...i}=n;return k.jsx(nr.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:k.jsx("polygon",{points:"0,0 30,0 15,10"})})});bR.displayName=R7;var P7=bR;function D7(n){const[e,t]=H.useState(void 0);return Fa(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}var Fv="Popper",[wR,AR]=fw(Fv),[I7,vR]=wR(Fv),xR=n=>{const{__scopePopper:e,children:t}=n,[r,s]=H.useState(null);return k.jsx(I7,{scope:e,anchor:r,onAnchorChange:s,children:t})};xR.displayName=Fv;var ER="PopperAnchor",CR=H.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...s}=n,i=vR(ER,t),o=H.useRef(null),a=jr(e,o);return H.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:k.jsx(nr.div,{...s,ref:a})});CR.displayName=ER;var jv="PopperContent",[L7,B7]=wR(jv),kR=H.forwardRef((n,e)=>{var ze,Be,et,le,$e,ae;const{__scopePopper:t,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=n,y=vR(jv,t),[b,v]=H.useState(null),A=jr(e,we=>v(we)),[w,x]=H.useState(null),C=D7(w),S=(C==null?void 0:C.width)??0,M=(C==null?void 0:C.height)??0,R=r+(i!=="center"?"-"+i:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(c)?c:[c],_=D.length>0,F={padding:O,boundary:D.filter(F7),altBoundary:_},{refs:G,floatingStyles:B,placement:V,isPositioned:Q,middlewareData:ee}=x7({strategy:"fixed",placement:R,whileElementsMounted:(...we)=>p7(...we,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[C7({mainAxis:s+M,alignmentAxis:o}),l&&k7({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?S7():void 0,...F}),l&&T7({...F}),O7({...F,apply:({elements:we,rects:_e,availableWidth:z,availableHeight:J})=>{const{width:re,height:ce}=_e.reference,I=we.floating.style;I.setProperty("--radix-popper-available-width",`${z}px`),I.setProperty("--radix-popper-available-height",`${J}px`),I.setProperty("--radix-popper-anchor-width",`${re}px`),I.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),w&&M7({element:w,padding:a}),j7({arrowWidth:S,arrowHeight:M}),d&&N7({strategy:"referenceHidden",...F})]}),[Z,he]=OR(V),ke=Eo(p);Fa(()=>{Q&&(ke==null||ke())},[Q,ke]);const Se=(ze=ee.arrow)==null?void 0:ze.x,Ee=(Be=ee.arrow)==null?void 0:Be.y,be=((et=ee.arrow)==null?void 0:et.centerOffset)!==0,[Fe,je]=H.useState();return Fa(()=>{b&&je(window.getComputedStyle(b).zIndex)},[b]),k.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:Q?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Fe,"--radix-popper-transform-origin":[(le=ee.transformOrigin)==null?void 0:le.x,($e=ee.transformOrigin)==null?void 0:$e.y].join(" "),...((ae=ee.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:k.jsx(L7,{scope:t,placedSide:Z,onArrowChange:x,arrowX:Se,arrowY:Ee,shouldHideArrow:be,children:k.jsx(nr.div,{"data-side":Z,"data-align":he,...m,ref:A,style:{...m.style,animation:Q?void 0:"none"}})})})});kR.displayName=jv;var SR="PopperArrow",_7={top:"bottom",right:"left",bottom:"top",left:"right"},TR=H.forwardRef(function(e,t){const{__scopePopper:r,...s}=e,i=B7(SR,r),o=_7[i.placedSide];return k.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:k.jsx(P7,{...s,ref:t,style:{...s.style,display:"block"}})})});TR.displayName=SR;function F7(n){return n!==null}var j7=n=>({name:"transformOrigin",options:n,fn(e){var y,b,v;const{placement:t,rects:r,middlewareData:s}=e,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[c,u]=OR(t),f={start:"0%",center:"50%",end:"100%"}[u],d=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,h=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let p="",m="";return c==="bottom"?(p=o?f:`${d}px`,m=`${-l}px`):c==="top"?(p=o?f:`${d}px`,m=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,m=o?f:`${h}px`):c==="left"&&(p=`${r.floating.width+l}px`,m=o?f:`${h}px`),{data:{x:p,y:m}}}});function OR(n){const[e,t="center"]=n.split("-");return[e,t]}var U7=xR,NR=CR,V7=kR,H7=TR,Uv="Popover",[MR,jie]=fw(Uv,[AR]),qd=AR(),[z7,sl]=MR(Uv),RR=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=n,a=qd(e),l=H.useRef(null),[c,u]=H.useState(!1),[f=!1,d]=wT({prop:r,defaultProp:s,onChange:i});return k.jsx(U7,{...a,children:k.jsx(z7,{scope:e,contentId:Jp(),triggerRef:l,open:f,onOpenChange:d,onOpenToggle:H.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:c,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:t})})};RR.displayName=Uv;var PR="PopoverAnchor",$7=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=sl(PR,t),i=qd(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return H.useEffect(()=>(o(),()=>a()),[o,a]),k.jsx(NR,{...i,...r,ref:e})});$7.displayName=PR;var DR="PopoverTrigger",IR=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=sl(DR,t),i=qd(t),o=jr(e,s.triggerRef),a=k.jsx(nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":jR(s.open),...r,ref:o,onClick:Ar(n.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:k.jsx(NR,{asChild:!0,...i,children:a})});IR.displayName=DR;var G7="PopoverPortal",[Uie,W7]=MR(G7,{forceMount:void 0}),Zc="PopoverContent",LR=H.forwardRef((n,e)=>{const t=W7(Zc,n.__scopePopover),{forceMount:r=t.forceMount,...s}=n,i=sl(Zc,n.__scopePopover);return k.jsx(fd,{present:r||i.open,children:i.modal?k.jsx(K7,{...s,ref:e}):k.jsx(Q7,{...s,ref:e})})});LR.displayName=Zc;var K7=H.forwardRef((n,e)=>{const t=sl(Zc,n.__scopePopover),r=H.useRef(null),s=jr(e,r),i=H.useRef(!1);return H.useEffect(()=>{const o=r.current;if(o)return GT(o)},[]),k.jsx(xw,{as:qp,allowPinchZoom:!0,children:k.jsx(BR,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ar(n.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ar(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ar(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Q7=H.forwardRef((n,e)=>{const t=sl(Zc,n.__scopePopover),r=H.useRef(!1),s=H.useRef(!1);return k.jsx(BR,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,i),i.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=t.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),BR=H.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=n,d=sl(Zc,t),h=qd(t);return MT(),k.jsx(ud,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:k.jsx(pw,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>d.onOpenChange(!1),children:k.jsx(V7,{"data-state":jR(d.open),role:"dialog",id:d.contentId,...h,...f,ref:e,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_R="PopoverClose",FR=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=sl(_R,t);return k.jsx(nr.button,{type:"button",...r,ref:e,onClick:Ar(n.onClick,()=>s.onOpenChange(!1))})});FR.displayName=_R;var J7="PopoverArrow",q7=H.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=qd(t);return k.jsx(H7,{...s,...r,ref:e})});q7.displayName=J7;function jR(n){return n?"open":"closed"}var Y7=RR,X7=IR,Z7=LR,Hg=FR;const zg=({children:n,isActive:e,onClick:t,disabled:r,className:s})=>{const i=pe("flex items-center gap-2 p-1.5 text-xs font-medium text-neutral-500 text-left w-full rounded-md border border-transparent transition-all",!e&&!r,"hover:border-neutral-200 hover:bg-neutral-100",e&&!r&&"bg-neutral-200 text-neutral-800",r&&"text-neutral-300 cursor-not-allowed",s);return k.jsx("button",{className:i,disabled:r,onClick:t,children:n})},eQ=(n,e,t)=>{const r=P.useCallback(()=>{const a=n.chain();a.setNodeSelection(t).unsetAllMarks(),(e==null?void 0:e.type.name)!=="paragraph"&&a.setParagraph(),a.run()},[n,t,e==null?void 0:e.type.name]),s=P.useCallback(()=>{n.commands.setNodeSelection(t);const{$anchor:a}=n.state.selection,l=a.node(1)||n.state.selection.node;n.chain().setMeta("hideDragHandle",!0).insertContentAt(t+((e==null?void 0:e.nodeSize)||0),l.toJSON()).run()},[n,t,e==null?void 0:e.nodeSize]),i=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).run(),document.execCommand("copy"),alert("copied")},[n,t]),o=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).deleteSelection().run()},[n,t]);return{resetTextFormatting:r,duplicateNode:s,copyNodeToClipboard:i,deleteNode:o}},tQ=({node:n,getPos:e,editor:t,deleteNode:r})=>{const[s,i]=P.useState(!1),o=eQ(t,n,e()),a=gm(),l=["https://twitter.com","https://x.com"],c=P.useMemo(()=>{const{content:R}=n.content;return R[0].type.name==="table"},[n.content]),u=P.useMemo(()=>{var O;const{content:R}=n.content;return(O=R[0].content.content[0])==null?void 0:O.text},[n.content]),f=P.useMemo(()=>{var O;const{content:R}=n.content;return(O=R[0].content.content[1])==null?void 0:O.text},[n.content]),d=P.useMemo(()=>{const{content:R}=n.content;return R[0].content.content.find(O=>{var D;return(D=O==null?void 0:O.text)==null?void 0:D.match(/\/status\/([0-9]*)/)})},[n.content]),h=()=>{if(!u)return;let R=u;if(u.includes("<iframe"))R=f;else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(u):{const G=u.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);G&&G.length>0&&(R=`https://www.youtube.com/embed/${G[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(u):{const G=u.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);G&&G.length>0&&(R=`https://player.vimeo.com/video/${G[1]}`);break}default:return}const O=640,D=360,_=e(),F=_+n.nodeSize;R&&(t==null||t.chain().focus(_).deleteRange({from:_===0?_:_+1,to:F}).setIframe({src:R,width:O,height:D}).run())},p=R=>{const O=R.match(/\/status\/([0-9]*)/);return O&&O.length>0?O[1]:null},m=()=>{if(!u)return;let R=u;const O=l.some(G=>u.includes(G)),D=p(u);O&&D?R=D:d&&(R=p(d.text));const _=e(),F=_+n.nodeSize;R&&(t==null||t.chain().focus(_).deleteRange({from:_===2?_:_+1,to:F}).setTweetEmbed({tweetId:R}).run())},y=()=>{const R=e()+n.nodeSize;t.commands.insertContentAt(R,{type:"dBlock",content:[{type:"paragraph"}]})},b=()=>{const R=e();t.commands.insertContentAt(R,{type:"dBlock",content:[{type:"paragraph"}]})},v=()=>{r()},A=R=>{R.altKey?x():w()},w=()=>{y()},x=()=>{b()},C=R=>{R.altKey&&v()},M=Tv(()=>{if(l.some(R=>u.includes(R))||d!=null&&d.text){m();return}else{h();return}},1e3);return P.useEffect(()=>{u&&M()},[u]),k.jsxs(od,{as:"div",className:pe("flex gap-2 group w-full relative justify-center items-start",a&&"pointer-events-none",c&&"pointer-events-auto"),children:[k.jsxs("section",{className:"lg:flex gap-1 hidden","aria-label":"left-menu",contentEditable:!1,children:[k.jsx(oN,{content:k.jsxs("div",{className:"flex flex-col w-40",children:[k.jsx("div",{className:"text-xs",children:"Click to add below"}),k.jsx("div",{className:"text-xs",children:"Opt + Click to add above"})]}),children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,onClick:A,children:k.jsx(m8,{size:18})})}),k.jsxs(Y7,{open:s,onOpenChange:i,children:[k.jsx(X7,{asChild:!0,children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,draggable:!0,"data-drag-handle":!0,onClick:C,children:k.jsx(l8,{size:18})})}),k.jsx(Z7,{side:"bottom",align:"start",sideOffset:8,className:"z-10",children:k.jsxs(Jw,{className:"p-2 flex flex-col min-w-[16rem]",children:[k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.resetTextFormatting,children:[k.jsx(y8,{size:18}),"Clear formatting"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.copyNodeToClipboard,children:[k.jsx(s8,{size:18}),"Copy to clipboard"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.duplicateNode,children:[k.jsx(o8,{size:18}),"Duplicate"]})}),k.jsx(Nc.Divider,{horizontal:!0}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.deleteNode,className:"text-red-500 hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20",children:[k.jsx(aw,{size:18}),"Delete"]})})]})})]})]}),k.jsx(aT,{className:pe("node-view-content w-full",{"is-table":c})})]})},nQ=xt.create({name:"dBlock",priority:1e3,group:"dBlock",content:"(block|columns)",draggable:!0,selectable:!1,inline:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="d-block"]'}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-type":"d-block"}),0]},addCommands(){return{setDBlock:n=>({state:e,chain:t})=>{const{selection:{from:r}}=e,s=n!==void 0||n!==null?r:n;return t().insertContentAt(s,{type:this.name,content:[{type:"paragraph"}]}).focus(s+2).run()}}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setDBlock(),Enter:({editor:n})=>{var c;const{selection:{$head:e,from:t,to:r},doc:s}=n.state,i=e.node(e.depth-1);if((i==null?void 0:i.type.name)!=="dBlock")return!1;let o=-1,a="";s.descendants((u,f)=>{if(o!==-1)return!1;if(u.type.name===this.name)return;const[d,h]=[f,f+u.nodeSize];return d<=t&&r<=h&&(o=h,a=u.type.name),!1});const l=(c=s.slice(t,o))==null?void 0:c.toJSON().content;try{return a==="codeBlock"?n.chain().newlineInCode().focus().run():["columns","heading"].includes(a)?n.chain().insertContent({type:"dBlock",content:[{type:"paragraph"}]}).focus().run():n.chain().insertContentAt({from:t,to:o},{type:this.name,content:l}).focus(t+4).run()}catch(u){return console.error(`Error inserting content into dBlock node: ${u}`),!1}}}},addNodeView(){return _a(tQ)}});let Vv,Hv;if(typeof WeakMap<"u"){let n=new WeakMap;Vv=e=>n.get(e),Hv=(e,t)=>(n.set(e,t),t)}else{let n=[],e=10,t=0;Vv=r=>{for(let s=0;s<n.length;s+=2)if(n[s]==r)return n[s+1]},Hv=(r,s)=>(t==e&&(t=0),n[t++]=r,n[t++]=s)}class eu{constructor(e,t,r,s){this.left=e,this.top=t,this.right=r,this.bottom=s}}class Ut{constructor(e,t,r,s){this.width=e,this.height=t,this.map=r,this.problems=s}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let s=t%this.width,i=t/this.width|0,o=s+1,a=i+1;for(let l=1;o<this.width&&this.map[t+l]==r;l++)o++;for(let l=1;a<this.height&&this.map[t+this.width*l]==r;l++)a++;return new eu(s,i,o,a)}throw new RangeError("No cell with offset "+e+" found")}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError("No cell with offset "+e+" found")}nextCell(e,t,r){let{left:s,right:i,top:o,bottom:a}=this.findCell(e);return t=="horiz"?(r<0?s==0:i==this.width)?null:this.map[o*this.width+(r<0?s-1:i)]:(r<0?o==0:a==this.height)?null:this.map[s+this.width*(r<0?o-1:a)]}rectBetween(e,t){let{left:r,right:s,top:i,bottom:o}=this.findCell(e),{left:a,right:l,top:c,bottom:u}=this.findCell(t);return new eu(Math.min(r,a),Math.min(i,c),Math.max(s,l),Math.max(o,u))}cellsInRect(e){let t=[],r={};for(let s=e.top;s<e.bottom;s++)for(let i=e.left;i<e.right;i++){let o=s*this.width+i,a=this.map[o];r[a]||(r[a]=!0,(i!=e.left||!i||this.map[o-1]!=a)&&(s!=e.top||!s||this.map[o-this.width]!=a)&&t.push(a))}return t}positionAt(e,t,r){for(let s=0,i=0;;s++){let o=i+r.child(s).nodeSize;if(s==e){let a=t+e*this.width,l=(e+1)*this.width;for(;a<l&&this.map[a]<i;)a++;return a==l?o-1:this.map[a]}i=o}}static get(e){return Vv(e)||Hv(e,rQ(e))}}function rQ(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=sQ(n),t=n.childCount,r=[],s=0,i=null,o=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){let f=n.child(c);u++;for(let p=0;;p++){for(;s<r.length&&r[s]!=0;)s++;if(p==f.childCount)break;let m=f.child(p),{colspan:y,rowspan:b,colwidth:v}=m.attrs;for(let A=0;A<b;A++){if(A+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-A});break}let w=s+A*e;for(let x=0;x<y;x++){r[w+x]==0?r[w+x]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-x});let C=v&&v[x];if(C){let S=(w+x)%e*2,M=o[S];M==null||M!=C&&o[S+1]==1?(o[S]=C,o[S+1]=1):M==C&&o[S+1]++}}}s+=y,u+=m.nodeSize}let d=(c+1)*e,h=0;for(;s<d;)r[s++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}let a=new Ut(e,t,r,i),l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&iQ(a,o,n),a}function sQ(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){let s=n.child(r),i=0;if(t)for(let o=0;o<r;o++){let a=n.child(o);for(let l=0;l<a.childCount;l++){let c=a.child(l);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){let a=s.child(o);i+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function iQ(n,e,t){n.problems||(n.problems=[]);for(let r=0,s={};r<n.map.length;r++){let i=n.map[r];if(s[i])continue;s[i]=!0;let o=t.nodeAt(i),a=null;for(let l=0;l<o.attrs.colspan;l++){let c=(r+l)%n.width,u=e[c*2];u!=null&&(!o.attrs.colwidth||o.attrs.colwidth[l]!=u)&&((a||(a=oQ(o.attrs)))[l]=u)}a&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function oQ(n){if(n.colwidth)return n.colwidth.slice();let e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Tn(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(let t in n.nodes){let r=n.nodes[t],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const Bo=new Rt("selectingCells");function tu(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function aQ(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function gs(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function $g(n){let e=n.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&e.node.type.spec.tableRole=="cell"?e.$anchor:tu(e.$head)||lQ(e.$head)}function lQ(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function zv(n){return n.parent.type.spec.tableRole=="row"&&n.nodeAfter}function cQ(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function $v(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function UR(n,e,t){let r=n.start(-1),i=Ut.get(n.node(-1)).nextCell(n.pos-r,e,t);return i==null?null:n.node(0).resolve(r+i)}function fn(n,e,t){let r={};for(let s in n)r[s]=n[s];return r[e]=t,r}function il(n,e,t=1){let r=fn(n,"colspan",n.colspan-t);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function VR(n,e,t=1){let r=fn(n,"colspan",n.colspan+t);if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<t;s++)r.colwidth.splice(e,0,0)}return r}function uQ(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.height;s++)if(e.nodeAt(n.map[t+s*n.width]).type!=r)return!1;return!0}class ot extends Ie{constructor(e,t=e){let r=e.node(-1),s=Ut.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,t.pos-i),a=e.node(0),l=s.cellsInRect(o).filter(u=>u!=t.pos-i);l.unshift(t.pos-i);let c=l.map(u=>{let f=r.nodeAt(u),d=u+i+1;return new H0(a.resolve(d),a.resolve(d+f.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),s=e.resolve(t.map(this.$headCell.pos));if(zv(r)&&zv(s)&&$v(r,s)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ot.rowSelection(r,s):i&&this.isColSelection()?ot.colSelection(r,s):new ot(r,s)}return Re.between(r,s)}content(){let e=this.$anchorCell.node(-1),t=Ut.get(e),r=this.$anchorCell.start(-1),s=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let l=s.top;l<s.bottom;l++){let c=[];for(let u=l*t.width+s.left,f=s.left;f<s.right;f++,u++){let d=t.map[u];if(!i[d]){i[d]=!0;let h=t.findCell(d),p=e.nodeAt(d),m=s.left-h.left,y=h.right-s.right;if(m>0||y>0){let b=p.attrs;m>0&&(b=il(b,0,m)),y>0&&(b=il(b,b.colspan-y,y)),h.left<s.left?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}if(h.top<s.top||h.bottom>s.bottom){let b=fn(p.attrs,"rowspan",Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top));h.top<s.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}}o.push(e.child(l).copy(oe.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new ue(oe.from(a),1,1)}replace(e,t=ue.empty){let r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?ue.empty:t)}let i=Ie.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new ue(oe.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=Ut.get(t),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(t.nodeAt(i[o]),s+i[o])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.top<=o.top?(i.top>0&&(e=a.resolve(s+r.map[i.left])),o.bottom<r.height&&(t=a.resolve(s+r.map[r.width*(r.height-1)+o.right-1]))):(o.top>0&&(t=a.resolve(s+r.map[o.left])),i.bottom<r.height&&(e=a.resolve(s+r.map[r.width*(r.height-1)+i.right-1]))),new ot(e,t)}isRowSelection(){let e=Ut.get(this.$anchorCell.node(-1)),t=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-t),s=e.colCount(this.$headCell.pos-t);if(Math.min(r,s)>0)return!1;let i=r+this.$anchorCell.nodeAfter.attrs.colspan,o=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,o)==e.width}eq(e){return e instanceof ot&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.left<=o.left?(i.left>0&&(e=a.resolve(s+r.map[i.top*r.width])),o.right<r.width&&(t=a.resolve(s+r.map[r.width*(o.top+1)-1]))):(o.left>0&&(t=a.resolve(s+r.map[o.top*r.width])),i.right<r.width&&(e=a.resolve(s+r.map[r.width*(i.top+1)-1]))),new ot(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new ot(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new ot(e.resolve(t),e.resolve(r))}getBookmark(){return new Gv(this.$anchorCell.pos,this.$headCell.pos)}}ot.prototype.visible=!1,Ie.jsonID("cell",ot);class Gv{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Gv(e.map(this.anchor),e.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&$v(t,r)?new ot(t,r):Ie.near(r,1)}}function fQ(n){if(!(n.selection instanceof ot))return null;let e=[];return n.selection.forEachCell((t,r)=>{e.push(en.node(r,r+t.nodeSize,{class:"selectedCell"}))}),vt.create(n.doc,e)}function dQ({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,s=n.depth;for(;s>=0&&!(n.after(s+1)<n.end(s));s--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(s).type.spec.tableRole)}function hQ({$from:n,$to:e}){let t,r;for(let s=n.depth;s>0;s--){let i=n.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let s=e.depth;s>0;s--){let i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function pQ(n,e,t){let r=(e||n).selection,s=(e||n).doc,i,o;if(r instanceof Ne&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=ot.create(s,r.from);else if(o=="row"){let a=s.resolve(r.from+1);i=ot.rowSelection(a,a)}else if(!t){let a=Ut.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=ot.create(s,l+1,c)}}else r instanceof Re&&dQ(r)?i=Re.create(s,r.from):r instanceof Re&&hQ(r)&&(i=Re.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}function mQ(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.firstChild.type.spec.tableRole=="table");)t--,r--,e=e.firstChild.content;let s=e.firstChild,i=s.type.spec.tableRole,o=s.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content,u=l?0:Math.max(0,t-1),f=l<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(c=Wv(Tn(o).row,new ue(c,u,f)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(t||r?Wv(Tn(o).row,new ue(e,t,r)).content:e);else return null;return gQ(o,a)}function gQ(n,e){let t=[];for(let s=0;s<e.length;s++){let i=e[s];for(let o=i.childCount-1;o>=0;o--){let{rowspan:a,colspan:l}=i.child(o).attrs;for(let c=s;c<s+a;c++)t[c]=(t[c]||0)+l}}let r=0;for(let s=0;s<t.length;s++)r=Math.max(r,t[s]);for(let s=0;s<t.length;s++)if(s>=e.length&&e.push(oe.empty),t[s]<r){let i=Tn(n).cell.createAndFill(),o=[];for(let a=t[s];a<r;a++)o.push(i);e[s]=e[s].append(oe.from(o))}return{height:e.length,width:r,rows:e}}function Wv(n,e){let t=n.createAndFill();return new U0(t).replace(0,t.content.size,e).doc}function yQ({width:n,height:e,rows:t},r,s){if(n!=r){let i=[],o=[];for(let a=0;a<t.length;a++){let l=t[a],c=[];for(let u=i[a]||0,f=0;u<r;f++){let d=l.child(f%l.childCount);u+d.attrs.colspan>r&&(d=d.type.create(il(d.attrs,d.attrs.colspan,u+d.attrs.colspan-r),d.content)),c.push(d),u+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+d.attrs.colspan}o.push(oe.from(c))}t=o,n=r}if(e!=s){let i=[];for(let o=0,a=0;o<s;o++,a++){let l=[],c=t[a%e];for(let u=0;u<c.childCount;u++){let f=c.child(u);o+f.attrs.rowspan>s&&(f=f.type.create(fn(f.attrs,"rowspan",Math.max(1,s-f.attrs.rowspan)),f.content)),l.push(f)}i.push(oe.from(l))}t=i,e=s}return{width:n,height:e,rows:t}}function bQ(n,e,t,r,s,i,o){let a=n.doc.type.schema,l=Tn(a),c,u;if(s>e.width)for(let f=0,d=0;f<e.height;f++){let h=t.child(f);d+=h.nodeSize;let p=[],m;h.lastChild==null||h.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=u||(u=l.header_cell.createAndFill());for(let y=e.width;y<s;y++)p.push(m);n.insert(n.mapping.slice(o).map(d-1+r),p)}if(i>e.height){let f=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,s);p++){let y=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==l.header_cell;f.push(y?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}let d=l.row.create(null,oe.from(f)),h=[];for(let p=e.height;p<i;p++)h.push(d);n.insert(n.mapping.slice(o).map(r+t.nodeSize-2),h)}return!!(c||u)}function HR(n,e,t,r,s,i,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=s;c<i;c++){let u=o*e.width+c,f=e.map[u];if(e.map[u-e.width]==f){l=!0;let d=t.nodeAt(f),{top:h,left:p}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,fn(d.attrs,"rowspan",o-h)),n.insert(n.mapping.slice(a).map(e.positionAt(o,p,t)),d.type.createAndFill(fn(d.attrs,"rowspan",h+d.attrs.rowspan-o))),c+=d.attrs.colspan-1}}return l}function zR(n,e,t,r,s,i,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=s;c<i;c++){let u=c*e.width+o,f=e.map[u];if(e.map[u-1]==f){l=!0;let d=t.nodeAt(f),h=e.colCount(f),p=n.mapping.slice(a).map(f+r);n.setNodeMarkup(p,null,il(d.attrs,o-h,d.attrs.colspan-(o-h))),n.insert(p+d.nodeSize,d.type.createAndFill(il(d.attrs,0,o-h))),c+=d.attrs.rowspan-1}}return l}function $R(n,e,t,r,s){let i=t?n.doc.nodeAt(t-1):n.doc,o=Ut.get(i),{top:a,left:l}=r,c=l+s.width,u=a+s.height,f=n.tr,d=0;function h(){i=t?f.doc.nodeAt(t-1):f.doc,o=Ut.get(i),d=f.mapping.maps.length}bQ(f,o,i,t,c,u,d)&&h(),HR(f,o,i,t,l,c,a,d)&&h(),HR(f,o,i,t,l,c,u,d)&&h(),zR(f,o,i,t,a,u,l,d)&&h(),zR(f,o,i,t,a,u,c,d)&&h();for(let p=a;p<u;p++){let m=o.positionAt(p,l,i),y=o.positionAt(p,c,i);f.replace(f.mapping.slice(d).map(m+t),f.mapping.slice(d).map(y+t),new ue(s.rows[p-a],0,0))}h(),f.setSelection(new ot(f.doc.resolve(t+o.positionAt(a,l,i)),f.doc.resolve(t+o.positionAt(u-1,c-1,i)))),e(f)}const wQ=yb({ArrowLeft:Wg("horiz",-1),ArrowRight:Wg("horiz",1),ArrowUp:Wg("vert",-1),ArrowDown:Wg("vert",1),"Shift-ArrowLeft":Kg("horiz",-1),"Shift-ArrowRight":Kg("horiz",1),"Shift-ArrowUp":Kg("vert",-1),"Shift-ArrowDown":Kg("vert",1),Backspace:Qg,"Mod-Backspace":Qg,Delete:Qg,"Mod-Delete":Qg});function Gg(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Wg(n,e){return(t,r,s)=>{let i=t.selection;if(i instanceof ot)return Gg(t,r,Ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let o=GR(s,n,e);if(o==null)return!1;if(n=="horiz")return Gg(t,r,Ie.near(t.doc.resolve(i.head+e),e));{let a=t.doc.resolve(o),l=UR(a,n,e),c;return l?c=Ie.near(l,1):e<0?c=Ie.near(t.doc.resolve(a.before(-1)),-1):c=Ie.near(t.doc.resolve(a.after(-1)),1),Gg(t,r,c)}}}function Kg(n,e){return(t,r,s)=>{let i=t.selection;if(!(i instanceof ot)){let a=GR(s,n,e);if(a==null)return!1;i=new ot(t.doc.resolve(a))}let o=UR(i.$headCell,n,e);return o?Gg(t,r,new ot(i.$anchorCell,o)):!1}}function Qg(n,e){let t=n.selection;if(!(t instanceof ot))return!1;if(e){let r=n.tr,s=Tn(n.schema).cell.createAndFill().content;t.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ue(s,0,0))}),r.docChanged&&e(r)}return!0}function AQ(n,e){let t=n.state.doc,r=tu(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ot(r))),!0):!1}function vQ(n,e,t){if(!gs(n.state))return!1;let r=mQ(t),s=n.state.selection;if(s instanceof ot){r||(r={width:1,height:1,rows:[oe.from(Wv(Tn(n.state.schema).cell,t))]});let i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),a=Ut.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=yQ(r,a.right-a.left,a.bottom-a.top),$R(n.state,n.dispatch,o,a,r),!0}else if(r){let i=$g(n.state),o=i.start(-1);return $R(n.state,n.dispatch,o,Ut.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function xQ(n,e){if(e.ctrlKey||e.metaKey)return;let t=WR(n,e.target),r;if(e.shiftKey&&n.state.selection instanceof ot)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&t&&(r=tu(n.state.selection.$anchor))!=null&&Kv(n,e).pos!=r.pos)s(r,e),e.preventDefault();else if(!t)return;function s(a,l){let c=Kv(n,l),u=Bo.getState(n.state)==null;if(!c||!$v(a,c))if(u)c=a;else return;let f=new ot(a,c);if(u||!n.state.selection.eq(f)){let d=n.state.tr.setSelection(f);u&&d.setMeta(Bo,a.pos),n.dispatch(d)}}function i(){n.root.removeEventListener("mouseup",i),n.root.removeEventListener("dragstart",i),n.root.removeEventListener("mousemove",o),Bo.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Bo,-1))}function o(a){let l=Bo.getState(n.state),c;if(l!=null)c=n.state.doc.resolve(l);else if(WR(n,a.target)!=t&&(c=Kv(n,e),!c))return i();c&&s(c,a)}n.root.addEventListener("mouseup",i),n.root.addEventListener("dragstart",i),n.root.addEventListener("mousemove",o)}function GR(n,e,t){if(!(n.state.selection instanceof Re))return null;let{$head:r}=n.state.selection;for(let s=r.depth-1;s>=0;s--){let i=r.node(s);if((t<0?r.index(s):r.indexAfter(s))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let a=r.before(s),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?a:null}}return null}function WR(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e}function Kv(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?tu(n.state.doc.resolve(t.pos)):null}const EQ=new Rt("fix-tables");function KR(n,e,t,r){let s=n.childCount,i=e.childCount;e:for(let o=0,a=0;o<i;o++){let l=e.child(o);for(let c=a,u=Math.min(s,o+3);c<u;c++)if(n.child(c)==l){a=c+1,t+=l.nodeSize;continue e}r(l,t),a<s&&n.child(a).sameMarkup(l)?KR(n.child(a),l,t+1,r):l.nodesBetween(0,l.content.size,r,t+1),t+=l.nodeSize}}function QR(n,e){let t,r=(s,i)=>{s.type.spec.tableRole=="table"&&(t=CQ(n,s,i,t))};return e?e.doc!=n.doc&&KR(e.doc,n.doc,0,r):n.doc.descendants(r),t}function CQ(n,e,t,r){let s=Ut.get(e);if(!s.problems)return r;r||(r=n.tr);let i=[];for(let l=0;l<s.height;l++)i.push(0);for(let l=0;l<s.problems.length;l++){let c=s.problems[l];if(c.type=="collision"){let u=e.nodeAt(c.pos);for(let f=0;f<u.attrs.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,il(u.attrs,u.attrs.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"rowspan",u.attrs.rowspan-c.n))}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"colwidth",c.colwidth))}}let o,a;for(let l=0;l<i.length;l++)i[l]&&(o==null&&(o=l),a=l);for(let l=0,c=t+1;l<s.height;l++){let u=e.child(l),f=c+u.nodeSize,d=i[l];if(d>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let y=0;y<d;y++)p.push(Tn(n.schema)[h].createAndFill());let m=(l==0||o==l-1)&&a==l?c+1:f-1;r.insert(r.mapping.map(m),p)}c=f}return r.setMeta(EQ,{fixTables:!0})}function Ys(n){let e=n.selection,t=$g(n),r=t.node(-1),s=t.start(-1),i=Ut.get(r),o;return e instanceof ot?o=i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):o=i.findCell(t.pos-s),o.tableStart=s,o.map=i,o.table=r,o}function JR(n,{map:e,tableStart:t,table:r},s){let i=s>0?-1:0;uQ(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){let a=o*e.width+s;if(s>0&&s<e.width&&e.map[a-1]==e.map[a]){let l=e.map[a],c=r.nodeAt(l);n.setNodeMarkup(n.mapping.map(t+l),null,VR(c.attrs,s-e.colCount(l))),o+=c.attrs.rowspan-1}else{let l=i==null?Tn(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(o,s,r);n.insert(n.mapping.map(t+c),l.createAndFill())}}return n}function kQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.left))}return!0}function SQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.right))}return!0}function TQ(n,{map:e,table:t,tableStart:r},s){let i=n.mapping.maps.length;for(let o=0;o<e.height;){let a=o*e.width+s,l=e.map[a],c=t.nodeAt(l);if(s>0&&e.map[a-1]==l||s<e.width-1&&e.map[a+1]==l)n.setNodeMarkup(n.mapping.slice(i).map(r+l),null,il(c.attrs,s-e.colCount(l)));else{let u=n.mapping.slice(i).map(r+l);n.delete(u,u+c.nodeSize)}o+=c.attrs.rowspan}}function OQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let s=t.right-1;TQ(r,t,s),s!=t.left;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function NQ(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(e.nodeAt(n.map[s+t*n.width]).type!=r)return!1;return!0}function qR(n,{map:e,tableStart:t,table:r},s){let i=t;for(let l=0;l<s;l++)i+=r.child(l).nodeSize;let o=[],a=s>0?-1:0;NQ(e,r,s+a)&&(a=s==0||s==e.height?null:0);for(let l=0,c=e.width*s;l<e.width;l++,c++)if(s>0&&s<e.height&&e.map[c]==e.map[c-e.width]){let u=e.map[c],f=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,fn(f,"rowspan",f.rowspan+1)),l+=f.colspan-1}else{let u=a==null?Tn(r.type.schema).cell:r.nodeAt(e.map[c+a*e.width]).type;o.push(u.createAndFill())}return n.insert(i,Tn(r.type.schema).row.create(null,o)),n}function MQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.top))}return!0}function RQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.bottom))}return!0}function PQ(n,{map:e,table:t,tableStart:r},s){let i=0;for(let l=0;l<s;l++)i+=t.child(l).nodeSize;let o=i+t.child(s).nodeSize,a=n.mapping.maps.length;n.delete(i+r,o+r);for(let l=0,c=s*e.width;l<e.width;l++,c++){let u=e.map[c];if(s>0&&u==e.map[c-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(a).map(u+r),null,fn(f,"rowspan",f.rowspan-1)),l+=f.colspan-1}else if(s<e.width&&u==e.map[c+e.width]){let f=t.nodeAt(u),d=f.type.create(fn(f.attrs,"rowspan",f.attrs.rowspan-1),f.content),h=e.positionAt(s+1,l,t);n.insert(n.mapping.slice(a).map(r+h),d),l+=f.attrs.colspan-1}}}function DQ(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let s=t.bottom-1;PQ(r,t,s),s!=t.top;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function YR(n){let e=n.content;return e.childCount==1&&e.firstChild.isTextblock&&e.firstChild.childCount==0}function IQ({width:n,height:e,map:t},r){let s=r.top*n+r.left,i=s,o=(r.bottom-1)*n+r.left,a=s+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[a]==t[a+1])return!0;i+=n,a+=n}for(let l=r.left;l<r.right;l++){if(r.top>0&&t[s]==t[s-n]||r.bottom<e&&t[o]==t[o+n])return!0;s++,o++}return!1}function XR(n,e){let t=n.selection;if(!(t instanceof ot)||t.$anchorCell.pos==t.$headCell.pos)return!1;let r=Ys(n),{map:s}=r;if(IQ(s,r))return!1;if(e){let i=n.tr,o={},a=oe.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){let d=s.map[u*s.width+f],h=r.table.nodeAt(d);if(!o[d])if(o[d]=!0,l==null)l=d,c=h;else{YR(h)||(a=a.append(h.content));let p=i.mapping.map(d+r.tableStart);i.delete(p,p+h.nodeSize)}}if(i.setNodeMarkup(l+r.tableStart,null,fn(VR(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),"rowspan",r.bottom-r.top)),a.size){let u=l+1+c.content.size,f=YR(c)?l+1:u;i.replaceWith(f+r.tableStart,u+r.tableStart,a)}i.setSelection(new ot(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function ZR(n,e){const t=Tn(n.schema);return LQ(({node:r})=>t[r.type.spec.tableRole])(n,e)}function LQ(n){return(e,t)=>{let r=e.selection,s,i;if(r instanceof ot){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{if(s=aQ(r.$from),!s)return!1;i=tu(r.$from).pos}if(s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let o=s.attrs,a=[],l=o.colwidth;o.rowspan>1&&(o=fn(o,"rowspan",1)),o.colspan>1&&(o=fn(o,"colspan",1));let c=Ys(e),u=e.tr;for(let d=0;d<c.right-c.left;d++)a.push(l?fn(o,"colwidth",l&&l[d]?[l[d]]:null):o);let f;for(let d=c.top;d<c.bottom;d++){let h=c.map.positionAt(d,c.left,c.table);d==c.top&&(h+=s.nodeSize);for(let p=c.left,m=0;p<c.right;p++,m++)p==c.left&&d==c.top||u.insert(f=u.mapping.map(h+c.tableStart,1),n({node:s,row:d,col:p}).createAndFill(a[m]))}u.setNodeMarkup(i,n({node:s,row:c.top,col:c.left}),a[0]),r instanceof ot&&u.setSelection(new ot(u.doc.resolve(r.$anchorCell.pos),f&&u.doc.resolve(f))),t(u)}return!0}}function BQ(n,e){return function(t,r){if(!gs(t))return!1;let s=$g(t);if(s.nodeAfter.attrs[n]===e)return!1;if(r){let i=t.tr;t.selection instanceof ot?t.selection.forEachCell((o,a)=>{o.attrs[n]!==e&&i.setNodeMarkup(a,null,fn(o.attrs,n,e))}):i.setNodeMarkup(s.pos,null,fn(s.nodeAfter.attrs,n,e)),r(i)}return!0}}function _Q(n){return function(e,t){if(!gs(e))return!1;if(t){let r=Tn(e.schema),s=Ys(e),i=e.tr,o=s.map.cellsInRect(n=="column"?new eu(s.left,0,s.right,s.map.height):n=="row"?new eu(0,s.top,s.map.width,s.bottom):s),a=o.map(l=>s.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<o.length;l++)i.setNodeMarkup(s.tableStart+o[l],r.header_cell,a[l].attrs);t(i)}return!0}}function eP(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==t.header_cell)return!1}return!0}function Yd(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?_Q(n):function(t,r){if(!gs(t))return!1;if(r){let s=Tn(t.schema),i=Ys(t),o=t.tr,a=eP("row",i,s),l=eP("column",i,s),u=(n==="column"?a:n==="row"?l:!1)?1:0,f=n=="column"?new eu(0,u,1,i.map.height):n=="row"?new eu(u,0,i.map.width,1):i,d=n=="column"?l?s.cell:s.header_cell:n=="row"?a?s.cell:s.header_cell:s.cell;i.map.cellsInRect(f).forEach(h=>{const p=h+i.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,d,m.attrs)}),r(o)}return!0}}Yd("row",{useDeprecatedLogic:!0}),Yd("column",{useDeprecatedLogic:!0});let FQ=Yd("cell",{useDeprecatedLogic:!0});function jQ(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,s=n.before();r>=0;r--){let i=n.node(-1).child(r);if(i.childCount)return s-1-i.lastChild.nodeSize;s-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;let t=n.node(-1);for(let r=n.indexAfter(-1),s=n.after();r<t.childCount;r++){let i=t.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}}function tP(n){return function(e,t){if(!gs(e))return!1;let r=jQ($g(e),n);if(r!=null){if(t){let s=e.doc.resolve(r);t(e.tr.setSelection(Re.between(s,cQ(s))).scrollIntoView())}return!0}}}function UQ(n,e){let t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}let VQ=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qv(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Qv(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Qv(n,e,t,r,s,i){let o=0,a=!0,l=e.firstChild,c=n.firstChild;for(let u=0,f=0;u<c.childCount;u++){let{colspan:d,colwidth:h}=c.child(u).attrs;for(let p=0;p<d;p++,f++){let m=s==f?i:h&&h[p],y=m?m+"px":"";o+=m||r,m||(a=!1),l?(l.style.width!=y&&(l.style.width=y),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;l;){let u=l.nextSibling;l.parentNode.removeChild(l),l=u}a?(t.style.width=o+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=o+"px")}const Gr=new Rt("tableColumnResizing");function HQ({handleWidth:n=5,cellMinWidth:e=25,View:t=VQ,lastColumnResizable:r=!0}={}){return new At({key:Gr,state:{init(i,o){return this.spec.props.nodeViews[Tn(o.schema).table.name]=(a,l)=>new t(a,e,l),new Xd(-1,!1)},apply(i,o){return o.apply(i)}},props:{attributes(i){return Gr.getState(i).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove(i,o){zQ(i,o,n,e,r)},mouseleave(i){$Q(i)},mousedown(i,o){GQ(i,o,e)}},decorations(i){let o=Gr.getState(i);if(o.activeHandle>-1)return YQ(i,o.activeHandle)},nodeViews:{}}})}class Xd{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(Gr);if(r&&r.setHandle!=null)return new Xd(r.setHandle,null);if(r&&r.setDragging!==void 0)return new Xd(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let s=e.mapping.map(t.activeHandle,-1);zv(e.doc.resolve(s))||(s=null),t=new Xd(s,t.dragging)}return t}}function zQ(n,e,t,r,s){let i=Gr.getState(n.state);if(!i.dragging){let o=KQ(e.target),a=-1;if(o){let{left:l,right:c}=o.getBoundingClientRect();e.clientX-l<=t?a=nP(n,e,"left"):c-e.clientX<=t&&(a=nP(n,e,"right"))}if(a!=i.activeHandle){if(!s&&a!==-1){let l=n.state.doc.resolve(a),c=l.node(-1),u=Ut.get(c),f=l.start(-1);if(u.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==u.width-1)return}sP(n,a)}}}function $Q(n){let e=Gr.getState(n.state);e.activeHandle>-1&&!e.dragging&&sP(n,-1)}function GQ(n,e,t){let r=Gr.getState(n.state);if(r.activeHandle==-1||r.dragging)return!1;let s=n.state.doc.nodeAt(r.activeHandle),i=WQ(n,r.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(Gr,{setDragging:{startX:e.clientX,startWidth:i}}));function o(l){window.removeEventListener("mouseup",o),window.removeEventListener("mousemove",a);let c=Gr.getState(n.state);c.dragging&&(QQ(n,c.activeHandle,rP(c.dragging,l,t)),n.dispatch(n.state.tr.setMeta(Gr,{setDragging:null})))}function a(l){if(!l.which)return o(l);let c=Gr.getState(n.state),u=rP(c.dragging,l,t);JQ(n,c.activeHandle,u,t)}return window.addEventListener("mouseup",o),window.addEventListener("mousemove",a),e.preventDefault(),!0}function WQ(n,e,{colspan:t,colwidth:r}){let s=r&&r[r.length-1];if(s)return s;let i=n.domAtPos(e),a=i.node.childNodes[i.offset].offsetWidth,l=t;if(r)for(let c=0;c<t;c++)r[c]&&(a-=r[c],l--);return a/l}function KQ(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList.contains("ProseMirror")?null:n.parentNode;return n}function nP(n,e,t){let r=n.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;let{pos:s}=r,i=tu(n.state.doc.resolve(s));if(!i)return-1;if(t=="right")return i.pos;let o=Ut.get(i.node(-1)),a=i.start(-1),l=o.map.indexOf(i.pos-a);return l%o.width==0?-1:a+o.map[l-1]}function rP(n,e,t){let r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function sP(n,e){n.dispatch(n.state.tr.setMeta(Gr,{setHandle:e}))}function QQ(n,e,t){let r=n.state.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=n.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;let f=i.map[u],{attrs:d}=s.nodeAt(f),h=d.colspan==1?0:a-i.colCount(f);if(d.colwidth&&d.colwidth[h]==t)continue;let p=d.colwidth?d.colwidth.slice():qQ(d.colspan);p[h]=t,l.setNodeMarkup(o+f,null,fn(d,"colwidth",p))}l.docChanged&&n.dispatch(l)}function JQ(n,e,t,r){let s=n.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),a=Ut.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1,l=n.domAtPos(s.start(-1)).node;for(;l.nodeName!="TABLE";)l=l.parentNode;Qv(i,l.firstChild,l,r,a,t)}function qQ(n){let e=[];for(let t=0;t<n;t++)e.push(0);return e}function YQ(n,e){let t=[],r=n.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan;for(let l=0;l<i.height;l++){let c=a+l*i.width-1;if((a==i.width||i.map[c]!=i.map[c+1])&&(l==0||i.map[c-1]!=i.map[c-1-i.width])){let u=i.map[c],f=o+u+s.nodeAt(u).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",t.push(en.widget(f,d))}}return vt.create(n.doc,t)}function XQ({allowTableNodeSelection:n=!1}={}){return new At({key:Bo,state:{init(){return null},apply(e,t){let r=e.getMeta(Bo);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;let{deleted:s,pos:i}=e.mapping.mapResult(t);return s?null:i}},props:{decorations:fQ,handleDOMEvents:{mousedown:xQ},createSelectionBetween(e){if(Bo.getState(e.state)!=null)return e.state.selection},handleTripleClick:AQ,handleKeyDown:wQ,handlePaste:vQ},appendTransaction(e,t,r){return pQ(r,QR(r,t),n)}})}function iP(n,e,t,r,s,i){var u;let o=0,a=!0,l=e.firstChild;const c=n.firstChild;if(c)for(let f=0,d=0;f<c.childCount;f+=1){const{colspan:h,colwidth:p}=c.child(f).attrs;for(let m=0;m<h;m+=1,d+=1){const y=s===d?i:p&&p[m],b=y?`${y}px`:"";o+=y||r,y||(a=!1),l?(l.style.width!==b&&(l.style.width=b),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=b}}for(;l;){const f=l.nextSibling;(u=l==null?void 0:l.parentNode)==null||u.removeChild(l),l=f}a?(t.style.width=`${o}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${o}px`)}class ZQ{constructor(e,t){W(this,"node");W(this,"cellMinWidth");W(this,"dom");W(this,"table");W(this,"colgroup");W(this,"contentDOM");this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),iP(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,iP(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function oP(n,e){return n.createAndFill()}function eJ(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function tJ(n,e,t,r,s){const i=eJ(n),o=[],a=[];for(let c=0;c<t;c+=1){const u=oP(i.cell);if(u&&a.push(u),r){const f=oP(i.header_cell);f&&o.push(f)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?o:a));return i.table.createChecked(null,l)}function nJ(n){return n instanceof ot}const Jg=({editor:n})=>{const{selection:e}=n.state;if(!nJ(e))return!1;let t=0;const r=Tb(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},rJ=xt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:ZQ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let t=0,r=!0;try{n.content.firstChild.content.forEach(i=>{if(i.attrs.colwidth)i.attrs.colwidth.forEach(o=>{o?t+=o:(r=!1,t+=this.options.cellMinWidth)});else{r=!1;const o=i.attrs.colspan?i.attrs.colspan:1;t+=this.options.cellMinWidth*o}})}catch{r=!1}return r&&t>0?e.style=`width: ${t}px;`:t&&t>0?e.style=`min-width: ${t}px`:e.style=null,["div",{class:"table-wrapper"},["table",nt(this.options.HTMLAttributes,e),["tbody",0]]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const{selection:o}=r,a=tJ(i.schema,n,e,t);if(s){const l=r.selection.anchor+1;r.replaceRangeWith(o.from-1,o.to,a).scrollIntoView().setSelection(Re.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>kQ(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>SQ(n,e),deleteColumn:()=>({state:n,dispatch:e})=>OQ(n,e),addRowBefore:()=>({state:n,dispatch:e})=>MQ(n,e),addRowAfter:()=>({state:n,dispatch:e})=>RQ(n,e),deleteRow:()=>({state:n,dispatch:e})=>DQ(n,e),deleteTable:()=>({state:n,dispatch:e})=>UQ(n,e),mergeCells:()=>({state:n,dispatch:e})=>XR(n,e),splitCell:()=>({state:n,dispatch:e})=>ZR(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Yd("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Yd("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>FQ(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>XR(n,e)?!0:ZR(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>BQ(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>tP(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>tP(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&QR(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ot.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Jg,"Mod-Backspace":Jg,Delete:Jg,"Mod-Delete":Jg}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[HQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],XQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Ye(xe(n,"tableRole",e))}}});function aP(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}var lP=typeof window<"u"&&typeof document<"u";function Jv(n,e){n&&(typeof n=="function"&&n(e),{}.hasOwnProperty.call(n,"current")&&(n.current=e))}function cP(){return lP&&document.createElement("div")}function sJ(n){var e={"data-placement":n.placement};return n.referenceHidden&&(e["data-reference-hidden"]=""),n.escaped&&(e["data-escaped"]=""),e}function uP(n,e){if(n===e)return!0;if(typeof n=="object"&&n!=null&&typeof e=="object"&&e!=null){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(var t in n)if(e.hasOwnProperty(t)){if(!uP(n[t],e[t]))return!1}else return!1;return!0}else return!1}function iJ(n){var e=[];return n.forEach(function(t){e.find(function(r){return uP(t,r)})||e.push(t)}),e}function oJ(n,e){var t,r;return Object.assign({},e,{popperOptions:Object.assign({},n.popperOptions,e.popperOptions,{modifiers:iJ([].concat(((t=n.popperOptions)==null?void 0:t.modifiers)||[],((r=e.popperOptions)==null?void 0:r.modifiers)||[]))})})}var qv=lP?P.useLayoutEffect:P.useEffect;function aJ(n){var e=P.useRef();return e.current||(e.current=typeof n=="function"?n():n),e.current}function fP(n,e,t){t.split(/\s+/).forEach(function(r){r&&n.classList[e](r)})}var lJ={name:"className",defaultValue:"",fn:function(e){var t=e.popper.firstElementChild,r=function(){var a;return!!((a=e.props.render)!=null&&a.$$tippy)};function s(){if(e.props.className&&!r()){process.env.NODE_ENV!=="production"&&console.warn(["@tippyjs/react: Cannot use `className` prop in conjunction with","`render` prop. Place the className on the element you are","rendering."].join(" "));return}fP(t,"add",e.props.className)}function i(){r()&&fP(t,"remove",e.props.className)}return{onCreate:s,onBeforeUpdate:i,onAfterUpdate:s}}};function cJ(n){function e(t){var r=t.children,s=t.content,i=t.visible,o=t.singleton,a=t.render,l=t.reference,c=t.disabled,u=c===void 0?!1:c,f=t.ignoreAttributes,d=f===void 0?!0:f;t.__source,t.__self;var h=aP(t,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"]),p=i!==void 0,m=o!==void 0,y=P.useState(!1),b=y[0],v=y[1],A=P.useState({}),w=A[0],x=A[1],C=P.useState(),S=C[0],M=C[1],R=aJ(function(){return{container:cP(),renders:1}}),O=Object.assign({ignoreAttributes:d},h,{content:R.container});p&&(process.env.NODE_ENV!=="production"&&["trigger","hideOnClick","showOnCreate"].forEach(function(G){O[G]!==void 0&&console.warn(["@tippyjs/react: Cannot specify `"+G+"` prop in","controlled mode (`visible` prop)"].join(" "))}),O.trigger="manual",O.hideOnClick=!1),m&&(u=!0);var D=O,_=O.plugins||[];a&&(D=Object.assign({},O,{plugins:m&&o.data!=null?[].concat(_,[{fn:function(){return{onTrigger:function(V,Q){var ee=o.data.children.find(function(Z){var he=Z.instance;return he.reference===Q.currentTarget});V.state.$$activeSingletonInstance=ee.instance,M(ee.content)}}}}]):_,render:function(){return{popper:R.container}}}));var F=[l].concat(r?[r.type]:[]);return qv(function(){var G=l;l&&l.hasOwnProperty("current")&&(G=l.current);var B=n(G||R.ref||cP(),Object.assign({},D,{plugins:[lJ].concat(O.plugins||[])}));return R.instance=B,u&&B.disable(),i&&B.show(),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M}),v(!0),function(){B.destroy(),o==null||o.cleanup(B)}},F),qv(function(){var G;if(R.renders===1){R.renders++;return}var B=R.instance;B.setProps(oJ(B.props,D)),(G=B.popperInstance)==null||G.forceUpdate(),u?B.disable():B.enable(),p&&(i?B.show():B.hide()),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M})}),qv(function(){var G;if(a){var B=R.instance;B.setProps({popperOptions:Object.assign({},B.props.popperOptions,{modifiers:[].concat((((G=B.props.popperOptions)==null?void 0:G.modifiers)||[]).filter(function(V){var Q=V.name;return Q!=="$$tippyReact"}),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Q){var ee,Z=Q.state,he=(ee=Z.modifiersData)==null?void 0:ee.hide;(w.placement!==Z.placement||w.referenceHidden!==(he==null?void 0:he.isReferenceHidden)||w.escaped!==(he==null?void 0:he.hasPopperEscaped))&&x({placement:Z.placement,referenceHidden:he==null?void 0:he.isReferenceHidden,escaped:he==null?void 0:he.hasPopperEscaped}),Z.attributes.popper={}}}])})})}},[w.placement,w.referenceHidden,w.escaped].concat(F)),P.createElement(P.Fragment,null,r?P.cloneElement(r,{ref:function(B){R.ref=B,Jv(r.ref,B)}}):null,b&&kt.createPortal(a?a(sJ(w),S,R.instance):s,R.container))}return e}var uJ=function(n,e){return P.forwardRef(function(r,s){var i=r.children,o=aP(r,["children"]);return P.createElement(n,Object.assign({},e,o),i?P.cloneElement(i,{ref:function(l){Jv(s,l),Jv(i.ref,l)}}):null)})},fJ=uJ(cJ(Ba));const dJ=[{name:"Add row above",action:n=>n.chain().focus().addRowBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7h2v-2h4v2h2v-2h4v2h2v-2h4v2h2v-7M4 14h4v3H4v-3m6 0h4v3h-4v-3m10 0v3h-4v-3h4m-9-4h2V7h3V5h-3V2h-2v3H8v2h3v3Z"})})},{name:"Add row below",action:n=>n.chain().focus().addRowAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3h2v2h4V3h2v2h4V3h2v2h4V3h2v7M4 10h4V7H4v3m6 0h4V7h-4v3m10 0V7h-4v3h4m-9 4h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z"})})},{name:"Add left column",action:n=>n.chain().focus().addColumnBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M13 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9V2h-9m7 8v4h-7v-4h7m0 6v4h-7v-4h7m0-12v4h-7V4h7M9 11H6V8H4v3H1v2h3v3h2v-3h3v-2Z"})})},{name:"Add right column",action:n=>n.chain().focus().addColumnAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M11 2a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2V2h9m-7 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m11 7h3V8h2v3h3v2h-3v3h-2v-3h-3v-2Z"})})},{name:"Remove row",action:n=>n.chain().focus().deleteRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41L9.41 13M22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3M4 9h4V6H4v3m6 0h4V6h-4v3m6 0h4V6h-4v3Z"})})},{name:"Remove column",action:n=>n.chain().focus().deleteColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59L17.59 12Z"})})},{name:"Toggle header row",action:n=>n.chain().focus().toggleHeaderRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4Z"})})},{name:"Toggle header column",action:n=>n.chain().focus().toggleHeaderColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M8 2h8a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8Z"})})},{name:"Toggle header cell",action:n=>n.chain().focus().toggleHeaderCell().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M21 19a1 1 0 0 1-1 1h-1v-2h2v1m-6 1v-2h2v2h-2m-4 0v-2h2v2h-2m-4 0v-2h2v2H7m-3 0a1 1 0 0 1-1-1v-1h2v2H4M19 4H5a2 2 0 0 0-2 2v2h18V6c0-1.11-.89-2-2-2M5 14H3v2h2v-2m0-4H3v2h2v-2m16 0h-2v2h2v-2m0 4h-2v2h2v-2m-10 2v-2h2v2h-2m0-4v-2h2v2h-2"})})},{name:"Remove table",action:n=>n.chain().focus().deleteTable().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M12.35 20H10v-3h2.09c.12-.72.37-1.39.72-2H10v-3h4v1.54c.58-.54 1.25-.93 2-1.19V12h4v.35c.75.26 1.42.65 2 1.19V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h9.54c-.54-.58-.93-1.25-1.19-2M16 7h4v3h-4V7m-6 0h4v3h-4V7M8 20H4v-3h4v3m0-5H4v-3h4v3m0-5H4V7h4v3m6.46 5.88l1.42-1.42L18 16.59l2.12-2.13l1.42 1.42L19.41 18l2.13 2.12l-1.42 1.42L18 19.41l-2.12 2.13l-1.42-1.42L16.59 18l-2.13-2.12"})})}],dP=({node:n,getPos:e,selected:t,editor:r})=>{const[s,i]=P.useState(!1),o=gm(),a=P.useRef(null),l=()=>{const{from:u,to:f}=r.state.selection,d=e(),h=d+n.nodeSize;i(d<=u&&f<=h)};P.useEffect(()=>(r.on("selectionUpdate",l),setTimeout(l,100),()=>{r.off("selectionUpdate",l)}));const c=()=>{var d,h;let u=(d=a.current)==null?void 0:d.clientTop;u&&(u+=5);let f=(h=a.current)==null?void 0:h.clientLeft;return f&&(f+=5),{top:`${u}px`,left:`${f}px`}};return k.jsxs(od,{className:"group",children:[k.jsx(aT,{as:"span"}),(s||t)&&k.jsx(fJ,{appendTo:document.body,trigger:"click",interactive:!0,animation:"shift-toward-subtle",placement:"top-start",content:k.jsx("article",{className:"w-screen lg:w-full",contentEditable:!1,children:k.jsx("ul",{tabIndex:0,className:"fixed top-8 right-1/2 translate-x-1/2 menu menu-compact p-2 shadow bg-base-100 rounded-lg w-56",style:c(),children:dJ.map(u=>k.jsx("li",{children:k.jsx(Ha,{variant:"ghost",className:"!items-center w-full !justify-start !font-[400]",onClick:()=>u.action(r),children:k.jsx("span",{children:u.name})})},u.name))})}),children:k.jsx("label",{tabIndex:0,className:pe("trigger-button",{hidden:o}),contentEditable:!1,children:k.jsx(a8,{size:20})})})]})},hJ=xt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"td",className:"relative"})}}),pJ=xt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"th",className:"relative"})}}),hP=n=>(n.stopPropagation(),n.preventDefault(),n),mJ=function(n){const e=n.scrollHeight>n.clientHeight,r=window.getComputedStyle(n).overflowY.indexOf("hidden")!==-1;return e&&!r},pP=function(n){return!n||n===document.body?document.body:mJ(n)?n:pP(n.parentNode)},Yv=(n,e,t)=>{const r=document.createElement(n);if(!r)throw new Error(`Element with name ${n} can't be created.`);return e&&Object.entries(e).forEach(([s,i])=>r.setAttribute(s,i)),t&&Object.entries(t).forEach(([s,i])=>r.addEventListener(s,i)),r},gJ=xt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return({editor:n,HTMLAttributes:e,getPos:t})=>{const r=()=>t(),s=pP(n.options.element);let i=!1;const o={deleteRow:()=>{this.editor.chain().deleteNode("tableRow").focus().run()},selectRow:()=>{const b=r(),v=n.state.doc.resolve(b),A=new Ne(v);n.view.dispatch(n.state.tr.setSelection(A))}},a=()=>{i=!0},l=()=>{i=!1},c=Yv("section",{class:"absolute hidden flex items-center w-2 bg-gray-200 z-50 cursor-pointer border-1 border-indigo-600 rounded-l opacity-25 hover:opacity-100",contenteditable:"false"},{click:b=>{b&&hP(b),o.selectRow()},mouseenter:()=>{a()},mouseover:()=>{a()},mouseleave:()=>{l(),d()}}),u=Yv("button",{class:"text-sm px-1 absolute -translate-x-[125%] hover:active:-translate-x-[125%] mr-2"},{click:b=>{b&&hP(b),o.deleteRow()}}),f=()=>{m(),c.classList.remove("hidden")},d=()=>{setTimeout(()=>{i||c.classList.add("hidden")},100)},h=Yv("tr",{...e},{mouseenter:f,mouseover:f,mouseleave:d});c.append(u),document.body.append(c);let p="";const m=()=>{setTimeout(()=>{const b=h.getBoundingClientRect(),v=JSON.stringify(b);p!==v&&(c.style.top=`${b.top+document.documentElement.scrollTop}px`,c.style.left=`${b.x+document.documentElement.scrollLeft-8}px`,c.style.height=`${b.height+1}px`,p=v)})};return setTimeout(()=>{m()},100),n.on("selectionUpdate",m),n.on("update",m),s==null||s.addEventListener("scroll",m),document.addEventListener("scroll",m),{dom:h,contentDOM:h,destroy:()=>{c.remove(),n.off("selectionUpdate",m),n.off("update",m),s==null||s.removeEventListener("scroll",m),document.removeEventListener("scroll",m)}}}}}),yJ=[rJ.configure({resizable:!0}),hJ,pJ,gJ],bJ=xM.extend({content:"(dBlock|columns)+"});function mP({types:n,node:e}){return e!=null&&e.type?Array.isArray(n)&&n.includes(e.type)||e.type===n:!1}const wJ=Ot.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const n=new Rt(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>this.options.notAfter.includes(t.name));return[new At({key:n,appendTransaction:(t,r,s)=>{const{doc:i,tr:o,schema:a}=s,l=n.getState(s),c=i.content.size,u=a.nodes[this.options.node];if(l)return o.insert(c,u.create())},state:{init:(t,r)=>{const s=r.tr.doc.lastChild;return!mP({node:s,types:e})},apply:(t,r)=>{var i,o,a;if(!t.docChanged)return r;const s=(a=(o=(i=t.doc.lastChild)==null?void 0:i.content)==null?void 0:o.content)==null?void 0:a[0];return!mP({node:s,types:e})}}})]}}),AJ=({node:n,editor:e,getPos:t})=>{const[r,s]=P.useState(""),i=gm(),o=["https://twitter.com","https://x.com"],a=()=>{switch(n.attrs.data){case"twitter":return k.jsx(gT,{size:20});case"iframe":return k.jsx(yT,{size:20});default:return k.jsx(b8,{size:20})}},l=()=>{switch(n.attrs.data){case"twitter":return"Embed a Twitter tweet";case"iframe":return"Embed a video";default:return"Embed an URL"}},c=()=>{if(!r){alert("Please enter a url");return}let p=r;if(r.includes("<iframe")){const A=r.match(/src="([^"]*)"/);A&&A.length>0&&(p=A[1])}else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://www.youtube.com/embed/${A[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://player.vimeo.com/video/${A[1]}`);break}default:{alert("Please enter a valid url");return}}const m=640,y=360,b=t(),v=b+n.nodeSize;p&&(e==null||e.chain().focus(b).deleteRange({from:b,to:v}).setIframe({src:p,width:m,height:y}).run())},u=()=>{if(!r){alert("Please enter a url");return}let p=r;const m=o.some(w=>r.includes(w)),y=r.match(/\/status\/([0-9]*)/),b=y&&y.length>0;if(m&&b)p=y[1];else{alert("invalid url");return}const v=t(),A=v+n.nodeSize;p&&(e==null||e.chain().focus(v).deleteRange({from:v,to:A}).setTweetEmbed({tweetId:p}).run())},d=Tv(()=>{switch(n.attrs.data){case"twitter":u();break;default:c();break}},500);P.useEffect(()=>{const p=m=>{if(m.key==="Backspace"&&r===""){const y=t(),b=y+n.nodeSize;(n.content.size===0||n.textContent==="")&&(e==null||e.chain().focus(y).deleteRange({from:y,to:b}).run(),m.preventDefault())}};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[r,e,t,n]),P.useEffect(()=>{r&&d()},[r]),P.useEffect(()=>{e==null||e.chain().focus()},[]);const h=P.useRef(null);return P.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:!i&&k.jsxs("div",{className:"relative w-full",children:[k.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[#A1AAB1]",children:a()}),k.jsx("input",{ref:h,value:r,placeholder:l(),onChange:p=>s(p.target.value),onClick:p=>p.stopPropagation(),className:"rounded bg-[#f2f2f2] p-3 pl-10 w-full cursor-pointer transition-all ease-in-out text-sm"})]})})},vJ=xt.create({name:"actionButton",group:"block",content:"block*",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{data:{default:null}}},addNodeView(){return _a(AJ)},parseHTML(){return[{tag:"div[data-action-node]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-action-node":""}),0]},addCommands(){return{setActionButton:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{data:n},content:[]})}}}),xJ=[VW,jW.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}),RM,HW.configure({types:["heading","paragraph"]}),AK,fK.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0}),dK.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),mK.configure({multicolor:!0}),wK.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),UW,EK,gK.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),bK.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),vM.configure({HTMLAttributes:{class:"space-y-4 !ml-6"}}),DM.configure({HTMLAttributes:{class:"leading-normal"}}),EM.configure({width:3,color:"#d1d5db"}),CM,nQ,wJ,bJ,...yJ,PK.configure({uploadFn:T8}),xK,CK,OK,vJ,vK],EJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",CJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",kJ=n=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");return t.classList.add("collaboration-cursor__label"),t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null),e.insertBefore(t,null),e},SJ=n=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");t.classList.add("custom-cursor__label-container"),t.setAttribute("style",`border: 1px solid ${n.color}`);const r=document.createElement("img");r.src=EJ,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=n.name;const o=document.createElement("img");return o.src=CJ,o.classList.add("custom-cursor__badge"),s.appendChild(i),t.appendChild(r),t.appendChild(s),t.appendChild(o),e.appendChild(t),e},TJ=n=>n.isEns?SJ(n):kJ(n),OJ="6.13.1";function NJ(n,e,t){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 n===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=n,s}async function On(n){const e=Object.keys(n);return(await Promise.all(e.map(r=>Promise.resolve(n[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Me(n,e,t){for(let r in e){let s=e[r];const i=t?t[r]:null;i&&NJ(s,i,r),Object.defineProperty(n,r,{enumerable:!0,value:s,writable:!1})}}function nu(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(nu).join(", ")+" ]";if(n instanceof Uint8Array){const e="0123456789abcdef";let t="0x";for(let r=0;r<n.length;r++)t+=e[n[r]>>4],t+=e[n[r]&15];return t}if(typeof n=="object"&&typeof n.toJSON=="function")return nu(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{ "+e.map(t=>`${nu(t)}: ${nu(n[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function dn(n,e){return n&&n.code===e}function Xv(n){return dn(n,"CALL_EXCEPTION")}function Mt(n,e,t){let r=n;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${nu(t)}`);for(const o in t){if(o==="shortMessage")continue;const a=t[o];i.push(o+"="+nu(a))}}i.push(`code=${e}`),i.push(`version=${OJ}`),i.length&&(n+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(n);break;default:s=new Error(n)}return Me(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&Me(s,{shortMessage:r}),s}function te(n,e,t,r){if(!n)throw Mt(e,t,r)}function $(n,e,t,r){te(n,e,"INVALID_ARGUMENT",{argument:t,value:r})}function gP(n,e,t){t==null&&(t=""),t&&(t=": "+t),te(n>=e,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:n,expectedCount:e}),te(n<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((n,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");n.push(e)}catch{}return n},[]);function qg(n,e,t){if(t==null&&(t=""),n!==e){let r=t,s="new";t&&(r+=".",s+=" "+t),te(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function yP(n,e,t){if(n instanceof Uint8Array)return t?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((n.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(n.substring(s,s+2),16),s+=2;return r}$(!1,"invalid BytesLike value",e||"value",n)}function ct(n,e){return yP(n,e,!1)}function Vn(n,e){return yP(n,e,!0)}function Ct(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&n.length!==2+2*e||e===!0&&n.length%2!==0)}function Zv(n){return Ct(n,!0)||n instanceof Uint8Array}const bP="0123456789abcdef";function Ae(n){const e=ct(n);let t="0x";for(let r=0;r<e.length;r++){const s=e[r];t+=bP[(s&240)>>4]+bP[s&15]}return t}function zt(n){return"0x"+n.map(e=>Ae(e).substring(2)).join("")}function ru(n){return Ct(n,!0)?(n.length-2)/2:ct(n).length}function Vt(n,e,t){const r=ct(n);return t!=null&&t>r.length&&te(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:t}),Ae(r.slice(e??0,t??r.length))}function wP(n,e,t){const r=ct(n);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),t?s.set(r,e-r.length):s.set(r,0),Ae(s)}function ol(n,e){return wP(n,e,!0)}function MJ(n,e){return wP(n,e,!1)}const Yg=BigInt(0),ys=BigInt(1),su=9007199254740991;function RJ(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"width"));if(te(t>>r===Yg,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),t>>r-ys){const s=(ys<<r)-ys;return-((~t&s)+ys)}return t}function AP(n,e){let t=Ce(n,"value");const r=BigInt(Je(e,"width")),s=ys<<r-ys;if(t<Yg){t=-t,te(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});const i=(ys<<r)-ys;return(~t&i)+ys}else te(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return t}function Zd(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"bits"));return t&(ys<<r)-ys}function Ce(n,e){switch(typeof n){case"bigint":return n;case"number":return $(Number.isInteger(n),"underflow",e||"value",n),$(n>=-su&&n<=su,"overflow",e||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(t){$(!1,`invalid BigNumberish string: ${t.message}`,e||"value",n)}}$(!1,"invalid BigNumberish value",e||"value",n)}function Xg(n,e){const t=Ce(n,e);return te(t>=Yg,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),t}const vP="0123456789abcdef";function e1(n){if(n instanceof Uint8Array){let e="0x0";for(const t of n)e+=vP[t>>4],e+=vP[t&15];return BigInt(e)}return Ce(n)}function Je(n,e){switch(typeof n){case"bigint":return $(n>=-su&&n<=su,"overflow",e||"value",n),Number(n);case"number":return $(Number.isInteger(n),"underflow",e||"value",n),$(n>=-su&&n<=su,"overflow",e||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return Je(BigInt(n),e)}catch(t){$(!1,`invalid numeric string: ${t.message}`,e||"value",n)}}$(!1,"invalid numeric value",e||"value",n)}function PJ(n){return Je(e1(n))}function _o(n,e){let r=Xg(n,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Je(e,"width");for(te(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<s*2;)r="0"+r}return"0x"+r}function Hn(n){const e=Xg(n,"value");if(e===Yg)return new Uint8Array([]);let t=e.toString(16);t.length%2&&(t="0"+t);const r=new Uint8Array(t.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(t.substring(i,i+2),16)}return r}function al(n){let e=Ae(Zv(n)?n:Hn(n)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const xP="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const EP=BigInt(58);function DJ(n){const e=ct(n);let t=e1(e),r="";for(;t;)r=xP[Number(t%EP)]+r,t/=EP;for(let s=0;s<e.length&&!e[s];s++)r=xP[0]+r;return r}function IJ(n){n=atob(n);const e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return ct(e)}function LJ(n){const e=ct(n);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}class CP{constructor(e,t,r){W(this,"filter");W(this,"emitter");q(this,Pu);L(this,Pu,t),Me(this,{emitter:e,filter:r})}async removeListener(){T(this,Pu)!=null&&await this.emitter.off(this.filter,T(this,Pu))}}Pu=new WeakMap;function BJ(n,e,t,r,s){$(!1,`invalid codepoint at offset ${e}; ${n}`,"bytes",t)}function kP(n,e,t,r,s){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<t.length&&t[o]>>6===2;o++)i++;return i}return n==="OVERRUN"?t.length-e-1:0}function _J(n,e,t,r,s){return n==="OVERLONG"?($(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),kP(n,e,t))}const FJ=Object.freeze({error:BJ,ignore:kP,replace:_J});function jJ(n,e){e==null&&(e=FJ.error);const t=ct(n,"bytes"),r=[];let s=0;for(;s<t.length;){const i=t[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,t,r):s+=e("BAD_PREFIX",s-1,t,r);continue}if(s-1+o>=t.length){s+=e("OVERRUN",s-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let c=0;c<o;c++){let u=t[s];if((u&192)!=128){s+=e("MISSING_CONTINUE",s,t,r),l=null;break}l=l<<6|u&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,t,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,t,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,t,r,l);continue}r.push(l)}}return r}function Mi(n,e){$(typeof n=="string","invalid string value","str",n);let t=[];for(let r=0;r<n.length;r++){const s=n.charCodeAt(r);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){r++;const i=n.charCodeAt(r);$(r<n.length&&(i&64512)===56320,"invalid surrogate pair","str",n);const o=65536+((s&1023)<<10)+(i&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function UJ(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function iu(n,e){return UJ(jJ(n,e))}function SP(n){async function e(t,r){te(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=t.url.split(":")[0].toLowerCase();te(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),te(s==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=Mt("request timeout","TIMEOUT"),o.abort()},t.timeout);r&&r.addListener(()=>{i=Mt("request cancelled","CANCELLED"),o.abort()});const l={method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:o.signal};let c;try{c=await fetch(t.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const u={};c.headers.forEach((h,p)=>{u[p.toLowerCase()]=h});const f=await c.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:c.status,statusMessage:c.statusText,headers:u,body:d}}return e}const VJ=12,HJ=250;let TP=SP();const zJ=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),$J=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let t1=!1;async function OP(n,e){try{const t=n.match(zJ);if(!t)throw new Error("invalid data");return new Fo(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?IJ(t[3]):WJ(t[3]))}catch{return new Fo(599,"BAD REQUEST (invalid data: URI)",{},null,new zn(n))}}function NP(n){async function e(t,r){try{const s=t.match($J);if(!s)throw new Error("invalid link");return new zn(`${n}${s[2]}`)}catch{return new Fo(599,"BAD REQUEST (invalid IPFS URI)",{},null,new zn(t))}}return e}const Zg={data:OP,ipfs:NP("https://gateway.ipfs.io/ipfs/")},MP=new WeakMap;class GJ{constructor(e){q(this,Ol);q(this,Xo);L(this,Ol,[]),L(this,Xo,!1),MP.set(e,()=>{if(!T(this,Xo)){L(this,Xo,!0);for(const t of T(this,Ol))setTimeout(()=>{t()},0);L(this,Ol,[])}})}addListener(e){te(!T(this,Xo),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,Ol).push(e)}get cancelled(){return T(this,Xo)}checkSignal(){te(!this.cancelled,"cancelled","CANCELLED",{})}}Ol=new WeakMap,Xo=new WeakMap;function ey(n){if(n==null)throw new Error("missing signal; should not happen");return n.checkSignal(),n}const u0=class u0{constructor(e){q(this,Pl);q(this,Du);q(this,Iu);q(this,xs);q(this,Wi);q(this,Lu);q(this,Bu);q(this,mn);q(this,Nr);q(this,Ki);q(this,Nl);q(this,Ml);q(this,Rl);q(this,ni);q(this,Es);q(this,Zo);L(this,Bu,String(e)),L(this,Du,!1),L(this,Iu,!0),L(this,xs,{}),L(this,Wi,""),L(this,Lu,3e5),L(this,Es,{slotInterval:HJ,maxAttempts:VJ}),L(this,Zo,null)}get url(){return T(this,Bu)}set url(e){L(this,Bu,String(e))}get body(){return T(this,mn)==null?null:new Uint8Array(T(this,mn))}set body(e){if(e==null)L(this,mn,void 0),L(this,Nr,void 0);else if(typeof e=="string")L(this,mn,Mi(e)),L(this,Nr,"text/plain");else if(e instanceof Uint8Array)L(this,mn,e),L(this,Nr,"application/octet-stream");else if(typeof e=="object")L(this,mn,Mi(JSON.stringify(e))),L(this,Nr,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,mn)!=null}get method(){return T(this,Wi)?T(this,Wi):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),L(this,Wi,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,xs));return T(this,Ki)&&(e.authorization=`Basic ${LJ(Mi(T(this,Ki)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Nr)&&(e["content-type"]=T(this,Nr)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){T(this,xs)[String(e).toLowerCase()]=String(t)}clearHeaders(){L(this,xs,{})}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,Ki)||null}setCredentials(e,t){$(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),L(this,Ki,`${e}:${t}`)}get allowGzip(){return T(this,Iu)}set allowGzip(e){L(this,Iu,!!e)}get allowInsecureAuthentication(){return!!T(this,Du)}set allowInsecureAuthentication(e){L(this,Du,!!e)}get timeout(){return T(this,Lu)}set timeout(e){$(e>=0,"timeout must be non-zero","timeout",e),L(this,Lu,e)}get preflightFunc(){return T(this,Nl)||null}set preflightFunc(e){L(this,Nl,e)}get processFunc(){return T(this,Ml)||null}set processFunc(e){L(this,Ml,e)}get retryFunc(){return T(this,Rl)||null}set retryFunc(e){L(this,Rl,e)}get getUrlFunc(){return T(this,Zo)||TP}set getUrlFunc(e){L(this,Zo,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,mn)?Ae(T(this,mn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,Es).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,Es).maxAttempts=e.maxAttempts)}send(){return te(T(this,ni)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),L(this,ni,new GJ(this)),fe(this,Pl,Zh).call(this,0,RP()+this.timeout,0,this,new Fo(0,"",{},null,this))}cancel(){te(T(this,ni)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=MP.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();te(this.method==="GET"&&(t!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new u0(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,L(s,xs,Object.assign({},T(this,xs))),T(this,mn)&&L(s,mn,new Uint8Array(T(this,mn))),L(s,Nr,T(this,Nr)),s}clone(){const e=new u0(this.url);return L(e,Wi,T(this,Wi)),T(this,mn)&&L(e,mn,T(this,mn)),L(e,Nr,T(this,Nr)),L(e,xs,Object.assign({},T(this,xs))),L(e,Ki,T(this,Ki)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),L(e,Nl,T(this,Nl)),L(e,Ml,T(this,Ml)),L(e,Rl,T(this,Rl)),L(e,Es,Object.assign({},T(this,Es))),L(e,Zo,T(this,Zo)),e}static lockConfig(){t1=!0}static getGateway(e){return Zg[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(t1)throw new Error("gateways locked");Zg[e]=t}static registerGetUrl(e){if(t1)throw new Error("gateways locked");TP=e}static createGetUrlFunc(e){return SP()}static createDataGateway(){return OP}static createIpfsGatewayFunc(e){return NP(e)}};Du=new WeakMap,Iu=new WeakMap,xs=new WeakMap,Wi=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,mn=new WeakMap,Nr=new WeakMap,Ki=new WeakMap,Nl=new WeakMap,Ml=new WeakMap,Rl=new WeakMap,ni=new WeakMap,Es=new WeakMap,Zo=new WeakMap,Pl=new WeakSet,Zh=async function(e,t,r,s,i){var u,f,d;if(e>=T(this,Es).maxAttempts)return i.makeServerError("exceeded maximum retry limit");te(RP()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await KJ(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Zg){const h=await Zg[a](o.url,ey(T(s,ni)));if(h instanceof Fo){let p=h;if(this.processFunc){ey(T(s,ni));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,ey(T(s,ni)));let c=new Fo(l.statusCode,l.statusMessage,l.headers,l.body,s);if(c.statusCode===301||c.statusCode===302){try{const h=c.headers.location||"";return fe(u=o.redirect(h),Pl,Zh).call(u,e+1,t,0,s,c)}catch{}return c}else if(c.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,c,e))){const h=c.headers["retry-after"];let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),fe(f=o.clone(),Pl,Zh).call(f,e+1,t,p,s,c)}if(this.processFunc){ey(T(s,ni));try{c=await this.processFunc(o,c)}catch(h){(h.throttle==null||typeof h.stall!="number")&&c.makeServerError("error in post-processing function",h).assertOk();let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),fe(d=o.clone(),Pl,Zh).call(d,e+1,t,p,s,c)}}return c};let zn=u0;const wE=class wE{constructor(e,t,r,s,i){q(this,_h);q(this,Fh);q(this,jh);q(this,Mr);q(this,_u);q(this,Dl);L(this,_h,e),L(this,Fh,t),L(this,jh,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),L(this,Mr,s==null?null:new Uint8Array(s)),L(this,_u,i||null),L(this,Dl,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Mr)?Ae(T(this,Mr)):"null"}>`}get statusCode(){return T(this,_h)}get statusMessage(){return T(this,Fh)}get headers(){return Object.assign({},T(this,jh))}get body(){return T(this,Mr)==null?null:new Uint8Array(T(this,Mr))}get bodyText(){try{return T(this,Mr)==null?"":iu(T(this,Mr))}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,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,t){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 wE(599,r,this.headers,this.body,T(this,_u)||void 0);return L(s,Dl,{message:e,error:t}),s}throwThrottleError(e,t){t==null?t=-1:$(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const r=new Error(e||"throttling requests");throw Me(r,{stall:t,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Mr)!=null}get request(){return T(this,_u)}ok(){return T(this,Dl).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=T(this,Dl);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Mr)&&(s=iu(T(this,Mr)))}catch{}te(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};_h=new WeakMap,Fh=new WeakMap,jh=new WeakMap,Mr=new WeakMap,_u=new WeakMap,Dl=new WeakMap;let Fo=wE;function RP(){return new Date().getTime()}function WJ(n){return Mi(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function KJ(n){return new Promise(e=>setTimeout(e,n))}function QJ(n){let e=n.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function PP(n,e,t){let r=0;for(let s=0;s<t;s++)r=r*256+n[e+s];return r}function DP(n,e,t,r){const s=[];for(;t<e+1+r;){const i=IP(n,t);s.push(i.result),t+=i.consumed,te(t<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:n,length:r,offset:e})}return{consumed:1+r,result:s}}function IP(n,e){te(n.length!==0,"data too short","BUFFER_OVERRUN",{buffer:n,length:0,offset:1});const t=r=>{te(r<=n.length,"data short segment too short","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r})};if(n[e]>=248){const r=n[e]-247;t(e+1+r);const s=PP(n,e+1,r);return t(e+1+r+s),DP(n,e,e+1+r,r+s)}else if(n[e]>=192){const r=n[e]-192;return t(e+1+r),DP(n,e,e+1,r)}else if(n[e]>=184){const r=n[e]-183;t(e+1+r);const s=PP(n,e+1,r);t(e+1+r+s);const i=Ae(n.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(n[e]>=128){const r=n[e]-128;t(e+1+r);const s=Ae(n.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:QJ(n[e])}}function ty(n){const e=ct(n,"data"),t=IP(e,0);return $(t.consumed===e.length,"unexpected junk after rlp payload","data",n),t.result}function LP(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function BP(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(i){r=r.concat(BP(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=LP(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(n,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=LP(e.length);return t.unshift(183+t.length),t.concat(e)}const _P="0123456789abcdef";function ll(n){let e="0x";for(const t of BP(n))e+=_P[t>>4],e+=_P[t&15];return e}const $n=32,n1=new Uint8Array($n),JJ=["then"],ny={},FP=new WeakMap;function cl(n){return FP.get(n)}function jP(n,e){FP.set(n,e)}function eh(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw t.error=e,t}function r1(n,e,t){return n.indexOf(null)>=0?e.map((r,s)=>r instanceof ou?r1(cl(r),r,t):r):n.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(t&&o instanceof ou&&(o=r1(cl(o),o,t)),r[s]=o),r},{})}const ju=class ju extends Array{constructor(...t){const r=t[0];let s=t[1],i=(t[2]||[]).slice(),o=!0;r!==ny&&(s=t,i=[],o=!1);super(s.length);q(this,Fu);s.forEach((c,u)=>{this[u]=c});const a=i.reduce((c,u)=>(typeof u=="string"&&c.set(u,(c.get(u)||0)+1),c),new Map);if(jP(this,Object.freeze(s.map((c,u)=>{const f=i[u];return f!=null&&a.get(f)===1?f:null}))),L(this,Fu,[]),T(this,Fu)==null&&T(this,Fu),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(c,u,f)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const h=Je(u,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=c[h];return p instanceof Error&&eh(`index ${h}`,p),p}if(JJ.indexOf(u)>=0)return Reflect.get(c,u,f);const d=c[u];if(d instanceof Function)return function(...h){return d.apply(this===f?c:this,h)};if(!(u in c))return c.getValue.apply(this===f?c:this,[u])}return Reflect.get(c,u,f)}});return jP(l,cl(this)),l}toArray(t){const r=[];return this.forEach((s,i)=>{s instanceof Error&&eh(`index ${i}`,s),t&&s instanceof ju&&(s=s.toArray(t)),r.push(s)}),r}toObject(t){const r=cl(this);return r.reduce((s,i,o)=>(te(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),r1(r,this,t)),{})}slice(t,r){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=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=t;a<r;a++)i.push(this[a]),o.push(s[a]);return new ju(ny,i,o)}filter(t,r){const s=cl(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&eh(`index ${a}`,l),t.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new ju(ny,i,o)}map(t,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&eh(`index ${i}`,o),s.push(t.call(r,o,i,this))}return s}getValue(t){const r=cl(this).indexOf(t);if(r===-1)return;const s=this[r];return s instanceof Error&&eh(`property ${JSON.stringify(t)}`,s.error),s}static fromItems(t,r){return new ju(ny,t,r)}};Fu=new WeakMap;let ou=ju;function UP(n){let e=Hn(n);return te(e.length<=$n,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:$n,offset:e.length}),e.length!==$n&&(e=Vn(zt([n1.slice(e.length%$n),e]))),e}class Ri{constructor(e,t,r,s){W(this,"name");W(this,"type");W(this,"localName");W(this,"dynamic");Me(this,{name:e,type:t,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){$(!1,e,this.localName,t)}}class s1{constructor(){q(this,Uu);q(this,Qi);q(this,Il);L(this,Qi,[]),L(this,Il,0)}get data(){return zt(T(this,Qi))}get length(){return T(this,Il)}appendWriter(e){return fe(this,Uu,y0).call(this,Vn(e.data))}writeBytes(e){let t=Vn(e);const r=t.length%$n;return r&&(t=Vn(zt([t,n1.slice(r)]))),fe(this,Uu,y0).call(this,t)}writeValue(e){return fe(this,Uu,y0).call(this,UP(e))}writeUpdatableValue(){const e=T(this,Qi).length;return T(this,Qi).push(n1),L(this,Il,T(this,Il)+$n),t=>{T(this,Qi)[e]=UP(t)}}}Qi=new WeakMap,Il=new WeakMap,Uu=new WeakSet,y0=function(e){return T(this,Qi).push(e),L(this,Il,T(this,Il)+e.length),e.length};const AE=class AE{constructor(e,t,r){q(this,_l);W(this,"allowLoose");q(this,cr);q(this,Rr);q(this,Ll);q(this,Bl);q(this,ea);Me(this,{allowLoose:!!t}),L(this,cr,Vn(e)),L(this,Ll,0),L(this,Bl,null),L(this,ea,r??1024),L(this,Rr,0)}get data(){return Ae(T(this,cr))}get dataLength(){return T(this,cr).length}get consumed(){return T(this,Rr)}get bytes(){return new Uint8Array(T(this,cr))}subReader(e){const t=new AE(T(this,cr).slice(T(this,Rr)+e),this.allowLoose,T(this,ea));return L(t,Bl,this),t}readBytes(e,t){let r=fe(this,_l,lF).call(this,0,e,!!t);return fe(this,_l,NE).call(this,e),L(this,Rr,T(this,Rr)+r.length),r.slice(0,e)}readValue(){return e1(this.readBytes($n))}readIndex(){return PJ(this.readBytes($n))}};cr=new WeakMap,Rr=new WeakMap,Ll=new WeakMap,Bl=new WeakMap,ea=new WeakMap,_l=new WeakSet,NE=function(e){var t;if(T(this,Bl))return fe(t=T(this,Bl),_l,NE).call(t,e);L(this,Ll,T(this,Ll)+e),te(T(this,ea)<1||T(this,Ll)<=T(this,ea)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ea)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),offset:T(this,Rr),length:e,info:{bytesRead:T(this,Ll),dataLength:this.dataLength}})},lF=function(e,t,r){let s=Math.ceil(t/$n)*$n;return T(this,Rr)+s>T(this,cr).length&&(this.allowLoose&&r&&T(this,Rr)+t<=T(this,cr).length?s=t:te(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),length:T(this,cr).length,offset:T(this,Rr)+s})),T(this,cr).slice(T(this,Rr),T(this,Rr)+s)};let i1=AE;function ry(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function o1(n,...e){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function qJ(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ry(n.outputLen),ry(n.blockLen)}function au(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function VP(n,e){o1(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const a1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const HP=n=>n instanceof Uint8Array,YJ=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),l1=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Xs=(n,e)=>n<<32-e|n>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function XJ(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function sy(n){if(typeof n=="string"&&(n=XJ(n)),!HP(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function ZJ(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!HP(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}class c1{clone(){return this._cloneInto()}}function u1(n){const e=r=>n().update(sy(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function eq(n=32){if(a1&&typeof a1.getRandomValues=="function")return a1.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}class zP extends c1{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,qJ(e);const r=sy(t);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 au(this),this.iHash.update(e),this}digestInto(e){au(this),o1(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:t,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=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const $P=(n,e,t)=>new zP(n,e).update(t).digest();$P.create=(n,e)=>new zP(n,e);function tq(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),l=r?4:0,c=r?0:4;n.setUint32(e+l,o,r),n.setUint32(e+c,a,r)}class GP extends c1{constructor(e,t,r,s){super(),this.blockLen=e,this.outputLen=t,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=l1(this.buffer)}update(e){au(this);const{view:t,buffer:r,blockLen:s}=this;e=sy(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=l1(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(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){au(this),VP(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;t[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++)t[f]=0;tq(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=l1(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,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%t&&e.buffer.set(r),e}}const nq=(n,e,t)=>n&e^~n&t,rq=(n,e,t)=>n&e^n&t^e&t,sq=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]),jo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Uo=new Uint32Array(64);class iq extends GP{constructor(){super(64,32,8,!1),this.A=jo[0]|0,this.B=jo[1]|0,this.C=jo[2]|0,this.D=jo[3]|0,this.E=jo[4]|0,this.F=jo[5]|0,this.G=jo[6]|0,this.H=jo[7]|0}get(){const{A:e,B:t,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,t,r,s,i,o,a,l]}set(e,t,r,s,i,o,a,l){this.A=e|0,this.B=t|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,t){for(let f=0;f<16;f++,t+=4)Uo[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){const d=Uo[f-15],h=Uo[f-2],p=Xs(d,7)^Xs(d,18)^d>>>3,m=Xs(h,17)^Xs(h,19)^h>>>10;Uo[f]=m+Uo[f-7]+p+Uo[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const d=Xs(a,6)^Xs(a,11)^Xs(a,25),h=u+d+nq(a,l,c)+sq[f]+Uo[f]|0,m=(Xs(r,2)^Xs(r,13)^Xs(r,22))+rq(r,s,i)|0;u=c,c=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,c=c+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,l,c,u)}roundClean(){Uo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const WP=u1(()=>new iq),iy=BigInt(2**32-1),f1=BigInt(32);function KP(n,e=!1){return e?{h:Number(n&iy),l:Number(n>>f1&iy)}:{h:Number(n>>f1&iy)|0,l:Number(n&iy)|0}}function QP(n,e=!1){let t=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let s=0;s<n.length;s++){const{h:i,l:o}=KP(n[s],e);[t[s],r[s]]=[i,o]}return[t,r]}const oq=(n,e)=>BigInt(n>>>0)<<f1|BigInt(e>>>0),aq=(n,e,t)=>n>>>t,lq=(n,e,t)=>n<<32-t|e>>>t,cq=(n,e,t)=>n>>>t|e<<32-t,uq=(n,e,t)=>n<<32-t|e>>>t,fq=(n,e,t)=>n<<64-t|e>>>t-32,dq=(n,e,t)=>n>>>t-32|e<<64-t,hq=(n,e)=>e,pq=(n,e)=>n,JP=(n,e,t)=>n<<t|e>>>32-t,qP=(n,e,t)=>e<<t|n>>>32-t,YP=(n,e,t)=>e<<t-32|n>>>64-t,XP=(n,e,t)=>n<<t-32|e>>>64-t;function mq(n,e,t,r){const s=(e>>>0)+(r>>>0);return{h:n+t+(s/2**32|0)|0,l:s|0}}const Ze={fromBig:KP,split:QP,toBig:oq,shrSH:aq,shrSL:lq,rotrSH:cq,rotrSL:uq,rotrBH:fq,rotrBL:dq,rotr32H:hq,rotr32L:pq,rotlSH:JP,rotlSL:qP,rotlBH:YP,rotlBL:XP,add:mq,add3L:(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),add3H:(n,e,t,r)=>e+t+r+(n/2**32|0)|0,add4L:(n,e,t,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0),add4H:(n,e,t,r,s)=>e+t+r+s+(n/2**32|0)|0,add5H:(n,e,t,r,s,i)=>e+t+r+s+i+(n/2**32|0)|0,add5L:(n,e,t,r,s)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0)},[gq,yq]=Ze.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(n=>BigInt(n))),Vo=new Uint32Array(80),Ho=new Uint32Array(80);class bq extends GP{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:t,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:y}=this;return[e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y]}set(e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y){this.Ah=e|0,this.Al=t|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=c|0,this.El=u|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=y|0}process(e,t){for(let A=0;A<16;A++,t+=4)Vo[A]=e.getUint32(t),Ho[A]=e.getUint32(t+=4);for(let A=16;A<80;A++){const w=Vo[A-15]|0,x=Ho[A-15]|0,C=Ze.rotrSH(w,x,1)^Ze.rotrSH(w,x,8)^Ze.shrSH(w,x,7),S=Ze.rotrSL(w,x,1)^Ze.rotrSL(w,x,8)^Ze.shrSL(w,x,7),M=Vo[A-2]|0,R=Ho[A-2]|0,O=Ze.rotrSH(M,R,19)^Ze.rotrBH(M,R,61)^Ze.shrSH(M,R,6),D=Ze.rotrSL(M,R,19)^Ze.rotrBL(M,R,61)^Ze.shrSL(M,R,6),_=Ze.add4L(S,D,Ho[A-7],Ho[A-16]),F=Ze.add4H(_,C,O,Vo[A-7],Vo[A-16]);Vo[A]=F|0,Ho[A]=_|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:y,Hh:b,Hl:v}=this;for(let A=0;A<80;A++){const w=Ze.rotrSH(f,d,14)^Ze.rotrSH(f,d,18)^Ze.rotrBH(f,d,41),x=Ze.rotrSL(f,d,14)^Ze.rotrSL(f,d,18)^Ze.rotrBL(f,d,41),C=f&h^~f&m,S=d&p^~d&y,M=Ze.add5L(v,x,S,yq[A],Ho[A]),R=Ze.add5H(M,b,w,C,gq[A],Vo[A]),O=M|0,D=Ze.rotrSH(r,s,28)^Ze.rotrBH(r,s,34)^Ze.rotrBH(r,s,39),_=Ze.rotrSL(r,s,28)^Ze.rotrBL(r,s,34)^Ze.rotrBL(r,s,39),F=r&i^r&a^i&a,G=s&o^s&l^o&l;b=m|0,v=y|0,m=h|0,y=p|0,h=f|0,p=d|0,{h:f,l:d}=Ze.add(c|0,u|0,R|0,O|0),c=a|0,u=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const B=Ze.add3L(O,_,G);r=Ze.add3H(B,R,D,F),s=B|0}({h:r,l:s}=Ze.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ze.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l}=Ze.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=Ze.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:f,l:d}=Ze.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=Ze.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:y}=Ze.add(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:v}=Ze.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(r,s,i,o,a,l,c,u,f,d,h,p,m,y,b,v)}roundClean(){Vo.fill(0),Ho.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 wq=u1(()=>new bq);function Aq(){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 ZP=Aq();ZP.crypto||ZP.msCrypto;function vq(n){switch(n){case"sha256":return WP.create();case"sha512":return wq.create()}$(!1,"invalid hashing algorithm name","algorithm",n)}const[eD,tD,nD]=[[],[],[]],xq=BigInt(0),th=BigInt(1),Eq=BigInt(2),Cq=BigInt(7),kq=BigInt(256),Sq=BigInt(113);for(let n=0,e=th,t=1,r=0;n<24;n++){[t,r]=[r,(2*t+3*r)%5],eD.push(2*(5*r+t)),tD.push((n+1)*(n+2)/2%64);let s=xq;for(let i=0;i<7;i++)e=(e<<th^(e>>Cq)*Sq)%kq,e&Eq&&(s^=th<<(th<<BigInt(i))-th);nD.push(s)}const[Tq,Oq]=QP(nD,!0),rD=(n,e,t)=>t>32?YP(n,e,t):JP(n,e,t),sD=(n,e,t)=>t>32?XP(n,e,t):qP(n,e,t);function Nq(n,e=24){const t=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,c=t[l],u=t[l+1],f=rD(c,u,1)^t[a],d=sD(c,u,1)^t[a+1];for(let h=0;h<50;h+=10)n[o+h]^=f,n[o+h+1]^=d}let s=n[2],i=n[3];for(let o=0;o<24;o++){const a=tD[o],l=rD(s,i,a),c=sD(s,i,a),u=eD[o];s=n[u],i=n[u+1],n[u]=l,n[u+1]=c}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=Tq[r],n[1]^=Oq[r]}t.fill(0)}class d1 extends c1{constructor(e,t,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ry(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=YJ(this.state)}keccak(){Nq(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){au(this);const{blockLen:t,state:r}=this;e=sy(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(t-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:s}=this;e[r]^=t,t&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){au(this,!1),o1(e),this.finish();const t=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(t.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 ry(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(VP(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:t,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new d1(t,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 Mq=((n,e,t)=>u1(()=>new d1(e,n,t)))(1,136,256/8);let iD=!1;const oD=function(n){return Mq(n)};let aD=oD;function Xt(n){const e=ct(n,"data");return Ae(aD(e))}Xt._=oD,Xt.lock=function(){iD=!0},Xt.register=function(n){if(iD)throw new TypeError("keccak256 is locked");aD=n},Object.freeze(Xt);const lD=function(n){return vq("sha256").update(n).digest()};let cD=lD,uD=!1;function lu(n){const e=ct(n,"data");return Ae(cD(e))}lu._=lD,lu.lock=function(){uD=!0},lu.register=function(n){if(uD)throw new Error("sha256 is locked");cD=n},Object.freeze(lu),Object.freeze(lu);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fD=BigInt(0),oy=BigInt(1),Rq=BigInt(2),ay=n=>n instanceof Uint8Array,Pq=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function cu(n){if(!ay(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=Pq[n[t]];return e}function dD(n){const e=n.toString(16);return e.length&1?`0${e}`:e}function h1(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function uu(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const t=new Uint8Array(e/2);for(let r=0;r<t.length;r++){const s=r*2,i=n.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function ul(n){return h1(cu(n))}function p1(n){if(!ay(n))throw new Error("Uint8Array expected");return h1(cu(Uint8Array.from(n).reverse()))}function fu(n,e){return uu(n.toString(16).padStart(e*2,"0"))}function m1(n,e){return fu(n,e).reverse()}function Dq(n){return uu(dD(n))}function bs(n,e,t){let r;if(typeof e=="string")try{r=uu(e)}catch(i){throw new Error(`${n} must be valid hex string, got "${e}". Cause: ${i}`)}else if(ay(e))r=Uint8Array.from(e);else throw new Error(`${n} must be hex string or Uint8Array`);const s=r.length;if(typeof t=="number"&&s!==t)throw new Error(`${n} expected ${t} bytes, got ${s}`);return r}function nh(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!ay(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}function Iq(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Lq(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Bq(n){let e;for(e=0;n>fD;n>>=oy,e+=1);return e}function _q(n,e){return n>>BigInt(e)&oy}const Fq=(n,e,t)=>n|(t?oy:fD)<<BigInt(e),g1=n=>(Rq<<BigInt(n-1))-oy,y1=n=>new Uint8Array(n),hD=n=>Uint8Array.from(n);function pD(n,e,t){if(typeof n!="number"||n<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 t!="function")throw new Error("hmacFn must be a function");let r=y1(n),s=y1(n),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>t(s,r,...f),l=(f=y1())=>{s=a(hD([0]),f),r=a(),f.length!==0&&(s=a(hD([1]),f),r=a())},c=()=>{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(c()));)l();return o(),h}}const jq={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function rh(n,e,t={}){const r=(s,i,o)=>{const a=jq[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=n[s];if(!(o&&l===void 0)&&!a(l,n))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(t))r(s,i,!0);return n}const Uq=Object.freeze(Object.defineProperty({__proto__:null,bitGet:_q,bitLen:Bq,bitMask:g1,bitSet:Fq,bytesToHex:cu,bytesToNumberBE:ul,bytesToNumberLE:p1,concatBytes:nh,createHmacDrbg:pD,ensureBytes:bs,equalBytes:Iq,hexToBytes:uu,hexToNumber:h1,numberToBytesBE:fu,numberToBytesLE:m1,numberToHexUnpadded:dD,numberToVarBytesBE:Dq,utf8ToBytes:Lq,validateObject:rh},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hn=BigInt(0),$t=BigInt(1),fl=BigInt(2),Vq=BigInt(3),b1=BigInt(4),mD=BigInt(5),gD=BigInt(8);BigInt(9),BigInt(16);function or(n,e){const t=n%e;return t>=hn?t:e+t}function Hq(n,e,t){if(t<=hn||e<hn)throw new Error("Expected power/modulo > 0");if(t===$t)return hn;let r=$t;for(;e>hn;)e&$t&&(r=r*n%t),n=n*n%t,e>>=$t;return r}function Wr(n,e,t){let r=n;for(;e-- >hn;)r*=r,r%=t;return r}function w1(n,e){if(n===hn||e<=hn)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=or(n,e),r=e,s=hn,i=$t;for(;t!==hn;){const a=r/t,l=r%t,c=s-i*a;r=t,t=l,s=i,i=c}if(r!==$t)throw new Error("invert: does not exist");return or(s,e)}function zq(n){const e=(n-$t)/fl;let t,r,s;for(t=n-$t,r=0;t%fl===hn;t/=fl,r++);for(s=fl;s<n&&Hq(s,e,n)!==n-$t;s++);if(r===1){const o=(n+$t)/b1;return function(l,c){const u=l.pow(c,o);if(!l.eql(l.sqr(u),c))throw new Error("Cannot find square root");return u}}const i=(t+$t)/fl;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=r,u=a.pow(a.mul(a.ONE,s),t),f=a.pow(l,i),d=a.pow(l,t);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<c&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(u,$t<<BigInt(c-h-1));u=a.sqr(p),f=a.mul(f,p),d=a.mul(d,u),c=h}return f}}function $q(n){if(n%b1===Vq){const e=(n+$t)/b1;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(n%gD===mD){const e=(n-mD)/gD;return function(r,s){const i=r.mul(s,fl),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,fl),o),c=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(c),s))throw new Error("Cannot find square root");return c}}return zq(n)}const Gq=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Wq(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=Gq.reduce((r,s)=>(r[s]="function",r),e);return rh(n,t)}function Kq(n,e,t){if(t<hn)throw new Error("Expected power > 0");if(t===hn)return n.ONE;if(t===$t)return e;let r=n.ONE,s=e;for(;t>hn;)t&$t&&(r=n.mul(r,s)),s=n.sqr(s),t>>=$t;return r}function Qq(n,e){const t=new Array(e.length),r=e.reduce((i,o,a)=>n.is0(o)?i:(t[a]=i,n.mul(i,o)),n.ONE),s=n.inv(r);return e.reduceRight((i,o,a)=>n.is0(o)?i:(t[a]=n.mul(i,t[a]),n.mul(i,o)),s),t}function yD(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function Jq(n,e,t=!1,r={}){if(n<=hn)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:s,nByteLength:i}=yD(n,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=$q(n),a=Object.freeze({ORDER:n,BITS:s,BYTES:i,MASK:g1(s),ZERO:hn,ONE:$t,create:l=>or(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return hn<=l&&l<n},is0:l=>l===hn,isOdd:l=>(l&$t)===$t,neg:l=>or(-l,n),eql:(l,c)=>l===c,sqr:l=>or(l*l,n),add:(l,c)=>or(l+c,n),sub:(l,c)=>or(l-c,n),mul:(l,c)=>or(l*c,n),pow:(l,c)=>Kq(a,l,c),div:(l,c)=>or(l*w1(c,n),n),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>w1(l,n),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>Qq(a,l),cmov:(l,c,u)=>u?c:l,toBytes:l=>t?m1(l,i):fu(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return t?p1(l):ul(l)}});return Object.freeze(a)}function bD(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function wD(n){const e=bD(n);return e+Math.ceil(e/2)}function qq(n,e,t=!1){const r=n.length,s=bD(e),i=wD(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=t?ul(n):p1(n),a=or(o,e-$t)+$t;return t?m1(a,s):fu(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Yq=BigInt(0),A1=BigInt(1);function Xq(n,e){const t=(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:t,unsafeLadder(s,i){let o=n.ZERO,a=s;for(;i>Yq;)i&A1&&(o=o.add(a)),a=a.double(),i>>=A1;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let c=s,u=c;for(let f=0;f<o;f++){u=c,l.push(u);for(let d=1;d<a;d++)u=u.add(c),l.push(u);c=u.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let c=n.ZERO,u=n.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 y=Number(o&f);o>>=h,y>l&&(y-=d,o+=A1);const b=m,v=m+Math.abs(y)-1,A=p%2!==0,w=y<0;y===0?u=u.add(t(A,i[b])):c=c.add(t(w,i[v]))}return{p:c,f:u}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let c=i.get(s);return c||(c=this.precomputeWindow(s,l),l!==1&&i.set(s,a(c))),this.wNAF(l,c,o)}}}function AD(n){return Wq(n.Fp),rh(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yD(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Zq(n){const e=AD(n);rh(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:s}=e;if(t){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:eY,hexToBytes:tY}=Uq,dl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(n){const{Err:e}=dl;if(n.length<2||n[0]!==2)throw new e("Invalid signature integer tag");const t=n[1],r=n.subarray(2,t+2);if(!t||r.length!==t)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:eY(r),l:n.subarray(t+2)}},toSig(n){const{Err:e}=dl,t=typeof n=="string"?tY(n):n;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let r=t.length;if(r<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=dl._parseInt(t.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(n){const e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,t=c=>{const u=c.toString(16);return u.length&1?`0${u}`:u},r=e(t(n.s)),s=e(t(n.r)),i=r.length/2,o=s.length/2,a=t(i),l=t(o);return`30${t(o+i+4)}02${l}${s}02${a}${r}`}},Pi=BigInt(0),Kr=BigInt(1);BigInt(2);const vD=BigInt(3);BigInt(4);function nY(n){const e=Zq(n),{Fp:t}=e,r=e.toBytes||((p,m,y)=>{const b=m.toAffine();return nh(Uint8Array.from([4]),t.toBytes(b.x),t.toBytes(b.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),y=t.fromBytes(m.subarray(0,t.BYTES)),b=t.fromBytes(m.subarray(t.BYTES,2*t.BYTES));return{x:y,y:b}});function i(p){const{a:m,b:y}=e,b=t.sqr(p),v=t.mul(b,p);return t.add(t.add(v,t.mul(p,m)),y)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&Pi<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:y,wrapPrivateKey:b,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=cu(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(y*2,"0")}let A;try{A=typeof p=="bigint"?p:ul(bs("private key",p,y))}catch{throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof p}`)}return b&&(A=or(A,v)),a(A),A}const c=new Map;function u(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,y,b){if(this.px=m,this.py=y,this.pz=b,m==null||!t.isValid(m))throw new Error("x required");if(y==null||!t.isValid(y))throw new Error("y required");if(b==null||!t.isValid(b))throw new Error("z required")}static fromAffine(m){const{x:y,y:b}=m||{};if(!m||!t.isValid(y)||!t.isValid(b))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=A=>t.eql(A,t.ZERO);return v(y)&&v(b)?f.ZERO:new f(y,b,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const y=t.invertBatch(m.map(b=>b.pz));return m.map((b,v)=>b.toAffine(y[v])).map(f.fromAffine)}static fromHex(m){const y=f.fromAffine(s(bs("pointHex",m)));return y.assertValidity(),y}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y}=this.toAffine();if(!t.isValid(m)||!t.isValid(y))throw new Error("bad point: x or y not FE");const b=t.sqr(y),v=i(m);if(!t.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(t.isOdd)return!t.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m,C=t.eql(t.mul(y,x),t.mul(A,v)),S=t.eql(t.mul(b,x),t.mul(w,v));return C&&S}negate(){return new f(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:y}=e,b=t.mul(y,vD),{px:v,py:A,pz:w}=this;let x=t.ZERO,C=t.ZERO,S=t.ZERO,M=t.mul(v,v),R=t.mul(A,A),O=t.mul(w,w),D=t.mul(v,A);return D=t.add(D,D),S=t.mul(v,w),S=t.add(S,S),x=t.mul(m,S),C=t.mul(b,O),C=t.add(x,C),x=t.sub(R,C),C=t.add(R,C),C=t.mul(x,C),x=t.mul(D,x),S=t.mul(b,S),O=t.mul(m,O),D=t.sub(M,O),D=t.mul(m,D),D=t.add(D,S),S=t.add(M,M),M=t.add(S,M),M=t.add(M,O),M=t.mul(M,D),C=t.add(C,M),O=t.mul(A,w),O=t.add(O,O),M=t.mul(O,D),x=t.sub(x,M),S=t.mul(O,R),S=t.add(S,S),S=t.add(S,S),new f(x,C,S)}add(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m;let C=t.ZERO,S=t.ZERO,M=t.ZERO;const R=e.a,O=t.mul(e.b,vD);let D=t.mul(y,A),_=t.mul(b,w),F=t.mul(v,x),G=t.add(y,b),B=t.add(A,w);G=t.mul(G,B),B=t.add(D,_),G=t.sub(G,B),B=t.add(y,v);let V=t.add(A,x);return B=t.mul(B,V),V=t.add(D,F),B=t.sub(B,V),V=t.add(b,v),C=t.add(w,x),V=t.mul(V,C),C=t.add(_,F),V=t.sub(V,C),M=t.mul(R,B),C=t.mul(O,F),M=t.add(C,M),C=t.sub(_,M),M=t.add(_,M),S=t.mul(C,M),_=t.add(D,D),_=t.add(_,D),F=t.mul(R,F),B=t.mul(O,B),_=t.add(_,F),F=t.sub(D,F),F=t.mul(R,F),B=t.add(B,F),D=t.mul(_,B),S=t.add(S,D),D=t.mul(V,B),C=t.mul(G,C),C=t.sub(C,D),D=t.mul(G,_),M=t.mul(V,M),M=t.add(M,D),new f(C,S,M)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,c,m,y=>{const b=t.invertBatch(y.map(v=>v.pz));return y.map((v,A)=>v.toAffine(b[A])).map(f.fromAffine)})}multiplyUnsafe(m){const y=f.ZERO;if(m===Pi)return y;if(a(m),m===Kr)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),C=y,S=y,M=this;for(;A>Pi||x>Pi;)A&Kr&&(C=C.add(M)),x&Kr&&(S=S.add(M)),M=M.double(),A>>=Kr,x>>=Kr;return v&&(C=C.negate()),w&&(S=S.negate()),S=new f(t.mul(S.px,b.beta),S.py,S.pz),C.add(S)}multiply(m){a(m);let y=m,b,v;const{endo:A}=e;if(A){const{k1neg:w,k1:x,k2neg:C,k2:S}=A.splitScalar(y);let{p:M,f:R}=this.wNAF(x),{p:O,f:D}=this.wNAF(S);M=h.constTimeNegate(w,M),O=h.constTimeNegate(C,O),O=new f(t.mul(O.px,A.beta),O.py,O.pz),b=M.add(O),v=R.add(D)}else{const{p:w,f:x}=this.wNAF(y);b=w,v=x}return f.normalizeZ([b,v])[0]}multiplyAndAddUnsafe(m,y,b){const v=f.BASE,A=(x,C)=>C===Pi||C===Kr||!x.equals(v)?x.multiplyUnsafe(C):x.multiply(C),w=A(this,y).add(A(m,b));return w.is0()?void 0:w}toAffine(m){const{px:y,py:b,pz:v}=this,A=this.is0();m==null&&(m=A?t.ONE:t.inv(v));const w=t.mul(y,m),x=t.mul(b,m),C=t.mul(v,m);if(A)return{x:t.ZERO,y:t.ZERO};if(!t.eql(C,t.ONE))throw new Error("invZ was invalid");return{x:w,y:x}}isTorsionFree(){const{h:m,isTorsionFree:y}=e;if(m===Kr)return!0;if(y)return y(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:y}=e;return m===Kr?this:y?y(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return cu(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,t.ONE),f.ZERO=new f(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,h=Xq(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function rY(n){const e=AD(n);return rh(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function sY(n){const e=rY(n),{Fp:t,n:r}=e,s=t.BYTES+1,i=2*t.BYTES+1;function o(B){return Pi<B&&B<t.ORDER}function a(B){return or(B,r)}function l(B){return w1(B,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:f,isWithinCurveOrder:d}=nY({...e,toBytes(B,V,Q){const ee=V.toAffine(),Z=t.toBytes(ee.x),he=nh;return Q?he(Uint8Array.from([V.hasEvenY()?2:3]),Z):he(Uint8Array.from([4]),Z,t.toBytes(ee.y))},fromBytes(B){const V=B.length,Q=B[0],ee=B.subarray(1);if(V===s&&(Q===2||Q===3)){const Z=ul(ee);if(!o(Z))throw new Error("Point is not on curve");const he=f(Z);let ke=t.sqrt(he);const Se=(ke&Kr)===Kr;return(Q&1)===1!==Se&&(ke=t.neg(ke)),{x:Z,y:ke}}else if(V===i&&Q===4){const Z=t.fromBytes(ee.subarray(0,t.BYTES)),he=t.fromBytes(ee.subarray(t.BYTES,2*t.BYTES));return{x:Z,y:he}}else throw new Error(`Point of length ${V} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=B=>cu(fu(B,e.nByteLength));function p(B){const V=r>>Kr;return B>V}function m(B){return p(B)?a(-B):B}const y=(B,V,Q)=>ul(B.slice(V,Q));class b{constructor(V,Q,ee){this.r=V,this.s=Q,this.recovery=ee,this.assertValidity()}static fromCompact(V){const Q=e.nByteLength;return V=bs("compactSignature",V,Q*2),new b(y(V,0,Q),y(V,Q,2*Q))}static fromDER(V){const{r:Q,s:ee}=dl.toSig(bs("DER",V));return new b(Q,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(V){return new b(this.r,this.s,V)}recoverPublicKey(V){const{r:Q,s:ee,recovery:Z}=this,he=S(bs("msgHash",V));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const ke=Z===2||Z===3?Q+e.n:Q;if(ke>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const Se=Z&1?"03":"02",Ee=c.fromHex(Se+h(ke)),be=l(ke),Fe=a(-he*be),je=a(ee*be),ze=c.BASE.multiplyAndAddUnsafe(Ee,Fe,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 uu(this.toDERHex())}toDERHex(){return dl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return uu(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(B){try{return u(B),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const B=wD(e.n);return qq(e.randomBytes(B),e.n)},precompute(B=8,V=c.BASE){return V._setWindowSize(B),V.multiply(BigInt(3)),V}};function A(B,V=!0){return c.fromPrivateKey(B).toRawBytes(V)}function w(B){const V=B instanceof Uint8Array,Q=typeof B=="string",ee=(V||Q)&&B.length;return V?ee===s||ee===i:Q?ee===2*s||ee===2*i:B instanceof c}function x(B,V,Q=!0){if(w(B))throw new Error("first arg must be private key");if(!w(V))throw new Error("second arg must be public key");return c.fromHex(V).multiply(u(B)).toRawBytes(Q)}const C=e.bits2int||function(B){const V=ul(B),Q=B.length*8-e.nBitLength;return Q>0?V>>BigInt(Q):V},S=e.bits2int_modN||function(B){return a(C(B))},M=g1(e.nBitLength);function R(B){if(typeof B!="bigint")throw new Error("bigint expected");if(!(Pi<=B&&B<M))throw new Error(`bigint expected < 2^${e.nBitLength}`);return fu(B,e.nByteLength)}function O(B,V,Q=D){if(["recovered","canonical"].some(et=>et in Q))throw new Error("sign() legacy options not supported");const{hash:ee,randomBytes:Z}=e;let{lowS:he,prehash:ke,extraEntropy:Se}=Q;he==null&&(he=!0),B=bs("msgHash",B),ke&&(B=bs("prehashed msgHash",ee(B)));const Ee=S(B),be=u(V),Fe=[R(be),R(Ee)];if(Se!=null){const et=Se===!0?Z(t.BYTES):Se;Fe.push(bs("extraEntropy",et))}const je=nh(...Fe),ze=Ee;function Be(et){const le=C(et);if(!d(le))return;const $e=l(le),ae=c.BASE.multiply(le).toAffine(),we=a(ae.x);if(we===Pi)return;const _e=a($e*a(ze+we*be));if(_e===Pi)return;let z=(ae.x===we?0:2)|Number(ae.y&Kr),J=_e;return he&&p(_e)&&(J=m(_e),z^=1),new b(we,J,z)}return{seed:je,k2sig:Be}}const D={lowS:e.lowS,prehash:!1},_={lowS:e.lowS,prehash:!1};function F(B,V,Q=D){const{seed:ee,k2sig:Z}=O(B,V,Q),he=e;return pD(he.hash.outputLen,he.nByteLength,he.hmac)(ee,Z)}c.BASE._setWindowSize(8);function G(B,V,Q,ee=_){var ae;const Z=B;if(V=bs("msgHash",V),Q=bs("publicKey",Q),"strict"in ee)throw new Error("options.strict was renamed to lowS");const{lowS:he,prehash:ke}=ee;let Se,Ee;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:_e}=Z;Se=new b(we,_e)}else throw new Error("PARSE");Ee=c.fromHex(Q)}catch(we){if(we.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(he&&Se.hasHighS())return!1;ke&&(V=e.hash(V));const{r:be,s:Fe}=Se,je=S(V),ze=l(Fe),Be=a(je*ze),et=a(be*ze),le=(ae=c.BASE.multiplyAndAddUnsafe(Ee,Be,et))==null?void 0:ae.toAffine();return le?a(le.x)===be:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:x,sign:F,verify:G,ProjectivePoint:c,Signature:b,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function iY(n){return{hash:n,hmac:(e,...t)=>$P(n,e,ZJ(...t)),randomBytes:eq}}function oY(n,e){const t=r=>sY({...n,...iY(r)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xD=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ED=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),aY=BigInt(1),v1=BigInt(2),CD=(n,e)=>(n+e/v1)/e;function lY(n){const e=xD,t=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=n*n*n%e,u=c*c*n%e,f=Wr(u,t,e)*u%e,d=Wr(f,t,e)*u%e,h=Wr(d,v1,e)*c%e,p=Wr(h,s,e)*h%e,m=Wr(p,i,e)*p%e,y=Wr(m,a,e)*m%e,b=Wr(y,l,e)*y%e,v=Wr(b,a,e)*m%e,A=Wr(v,t,e)*u%e,w=Wr(A,o,e)*p%e,x=Wr(w,r,e)*c%e,C=Wr(x,v1,e);if(!x1.eql(x1.sqr(C),n))throw new Error("Cannot find square root");return C}const x1=Jq(xD,void 0,void 0,{sqrt:lY}),zo=oY({a:BigInt(0),b:BigInt(7),Fp:x1,n:ED,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=ED,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-aY*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,o=BigInt("0x100000000000000000000000000000000"),a=CD(i*n,e),l=CD(-r*n,e);let c=or(n-a*t-l*s,e),u=or(-a*r-l*i,e);const f=c>o,d=u>o;if(f&&(c=e-c),d&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:f,k1:c,k2neg:d,k2:u}}}},WP);BigInt(0),zo.ProjectivePoint;const sh="0x0000000000000000000000000000000000000000",kD="0x0000000000000000000000000000000000000000000000000000000000000000",SD=BigInt(0),TD=BigInt(1),OD=BigInt(2),ND=BigInt(27),MD=BigInt(28),ly=BigInt(35),du={};function RD(n){return ol(Hn(n),32)}const Cs=class Cs{constructor(e,t,r,s){q(this,Vu);q(this,Hu);q(this,zu);q(this,Fl);qg(e,du,"Signature"),L(this,Vu,t),L(this,Hu,r),L(this,zu,s),L(this,Fl,null)}get r(){return T(this,Vu)}set r(e){$(ru(e)===32,"invalid r","value",e),L(this,Vu,Ae(e))}get s(){return T(this,Hu)}set s(e){$(ru(e)===32,"invalid s","value",e);const t=Ae(e);$(parseInt(t.substring(0,3))<8,"non-canonical s","value",t),L(this,Hu,t)}get v(){return T(this,zu)}set v(e){const t=Je(e,"value");$(t===27||t===28,"invalid v","v",e),L(this,zu,t)}get networkV(){return T(this,Fl)}get legacyChainId(){const e=this.networkV;return e==null?null:Cs.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 zt([this.r,this.yParityAndS])}get serialized(){return zt([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 Cs(du,this.r,this.s,this.v);return this.networkV&&L(e,Fl,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 t=Ce(e,"v");return t==ND||t==MD?SD:($(t>=ly,"invalid EIP-155 v","v",e),(t-ly)/OD)}static getChainIdV(e,t){return Ce(e)*OD+BigInt(35+t-27)}static getNormalizedV(e){const t=Ce(e);return t===SD||t===ND?27:t===TD||t===MD?28:($(t>=ly,"invalid v","v",e),t&TD?27:28)}static from(e){function t(c,u){$(c,u,"signature",e)}if(e==null)return new Cs(du,kD,kD,27);if(typeof e=="string"){const c=ct(e,"signature");if(c.length===64){const u=Ae(c.slice(0,32)),f=c.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Cs(du,u,Ae(f),d)}if(c.length===65){const u=Ae(c.slice(0,32)),f=c.slice(32,64);t((f[0]&128)===0,"non-canonical s");const d=Cs.getNormalizedV(c[64]);return new Cs(du,u,Ae(f),d)}t(!1,"invalid raw signature length")}if(e instanceof Cs)return e.clone();const r=e.r;t(r!=null,"missing r");const s=RD(r),i=function(c,u){if(c!=null)return RD(c);if(u!=null){t(Ct(u,32),"invalid yParityAndS");const f=ct(u);return f[0]&=127,Ae(f)}t(!1,"missing s")}(e.s,e.yParityAndS);t((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(c,u,f){if(c!=null){const d=Ce(c);return{networkV:d>=ly?d:void 0,v:Cs.getNormalizedV(d)}}if(u!=null)return t(Ct(u,32),"invalid yParityAndS"),{v:ct(u)[0]&128?28:27};if(f!=null){switch(Je(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Cs(du,s,i,a);return o&&L(l,Fl,o),t(e.yParity==null||Je(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};Vu=new WeakMap,Hu=new WeakMap,zu=new WeakMap,Fl=new WeakMap;let ws=Cs;const jl=class jl{constructor(e){q(this,Ji);$(ru(e)===32,"invalid private key","privateKey","[REDACTED]"),L(this,Ji,Ae(e))}get privateKey(){return T(this,Ji)}get publicKey(){return jl.computePublicKey(T(this,Ji))}get compressedPublicKey(){return jl.computePublicKey(T(this,Ji),!0)}sign(e){$(ru(e)===32,"invalid digest length","digest",e);const t=zo.sign(Vn(e),Vn(T(this,Ji)),{lowS:!0});return ws.from({r:_o(t.r,32),s:_o(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=jl.computePublicKey(e);return Ae(zo.getSharedSecret(Vn(T(this,Ji)),ct(t),!1))}static computePublicKey(e,t){let r=ct(e,"key");if(r.length===32){const i=zo.getPublicKey(r,!!t);return Ae(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=zo.ProjectivePoint.fromHex(r);return Ae(s.toRawBytes(t))}static recoverPublicKey(e,t){$(ru(e)===32,"invalid digest length","digest",e);const r=ws.from(t);let s=zo.Signature.fromCompact(Vn(zt([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Vn(e));return $(i!=null,"invalid signautre for digest","signature",t),"0x"+i.toHex(!1)}static addPoints(e,t,r){const s=zo.ProjectivePoint.fromHex(jl.computePublicKey(e).substring(2)),i=zo.ProjectivePoint.fromHex(jl.computePublicKey(t).substring(2));return"0x"+s.add(i).toHex(!!r)}};Ji=new WeakMap;let ih=jl;const cY=BigInt(0),uY=BigInt(36);function PD(n){n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const r=ct(Xt(t));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 E1={};for(let n=0;n<10;n++)E1[String(n)]=String(n);for(let n=0;n<26;n++)E1[String.fromCharCode(65+n)]=String(10+n);const DD=15;function fY(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>E1[r]).join("");for(;e.length>=DD;){let r=e.substring(0,DD);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const dY=function(){const n={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];n[t]=BigInt(e)}return n}();function hY(n){n=n.toLowerCase();let e=cY;for(let t=0;t<n.length;t++)e=e*uY+dY[n[t]];return e}function pt(n){if($(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);const e=PD(n);return $(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===n,"bad address checksum","address",n),e}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){$(n.substring(2,4)===fY(n),"bad icap checksum","address",n);let e=hY(n.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return PD("0x"+e)}$(!1,"invalid address","address",n)}function pY(n){const e=pt(n.from);let r=Ce(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,pt(Vt(Xt(ll([e,r])),12))}function ID(n){return n&&typeof n.getAddress=="function"}function mY(n){try{return pt(n),!0}catch{}return!1}async function C1(n,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(te(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),$(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),pt(t)}function Gn(n,e){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?pt(n):(te(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),C1(n,e.resolveName(n)));if(ID(n))return C1(n,n.getAddress());if(n&&typeof n.then=="function")return C1(n,n);$(!1,"unsupported addressable value","target",n)}const Di={};function ve(n,e){let t=!1;return e<0&&(t=!0,e*=-1),new Nn(Di,`${t?"":"u"}int${e}`,n,{signed:t,width:e})}function ft(n,e){return new Nn(Di,`bytes${e||""}`,n,{size:e})}const LD=Symbol.for("_ethers_typed"),qi=class qi{constructor(e,t,r,s){W(this,"type");W(this,"value");q(this,Ul);W(this,"_typedSymbol");s==null&&(s=null),qg(Di,e,"Typed"),Me(this,{_typedSymbol:LD,type:t,value:r}),L(this,Ul,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,Ul)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,Ul)===!0?-1:T(this,Ul)===!1?this.value.length:null}static from(e,t){return new qi(Di,e,t)}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 ft(e,1)}static bytes2(e){return ft(e,2)}static bytes3(e){return ft(e,3)}static bytes4(e){return ft(e,4)}static bytes5(e){return ft(e,5)}static bytes6(e){return ft(e,6)}static bytes7(e){return ft(e,7)}static bytes8(e){return ft(e,8)}static bytes9(e){return ft(e,9)}static bytes10(e){return ft(e,10)}static bytes11(e){return ft(e,11)}static bytes12(e){return ft(e,12)}static bytes13(e){return ft(e,13)}static bytes14(e){return ft(e,14)}static bytes15(e){return ft(e,15)}static bytes16(e){return ft(e,16)}static bytes17(e){return ft(e,17)}static bytes18(e){return ft(e,18)}static bytes19(e){return ft(e,19)}static bytes20(e){return ft(e,20)}static bytes21(e){return ft(e,21)}static bytes22(e){return ft(e,22)}static bytes23(e){return ft(e,23)}static bytes24(e){return ft(e,24)}static bytes25(e){return ft(e,25)}static bytes26(e){return ft(e,26)}static bytes27(e){return ft(e,27)}static bytes28(e){return ft(e,28)}static bytes29(e){return ft(e,29)}static bytes30(e){return ft(e,30)}static bytes31(e){return ft(e,31)}static bytes32(e){return ft(e,32)}static address(e){return new qi(Di,"address",e)}static bool(e){return new qi(Di,"bool",!!e)}static bytes(e){return new qi(Di,"bytes",e)}static string(e){return new qi(Di,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new qi(Di,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===LD}static dereference(e,t){if(qi.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}};Ul=new WeakMap;let Nn=qi;class gY extends Ri{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let r=Nn.dereference(t,"string");try{r=pt(r)}catch(s){return this._throwError(s.message,t)}return e.writeValue(r)}decode(e){return pt(_o(e.readValue(),20))}}class yY extends Ri{constructor(t){super(t.name,t.type,"_",t.dynamic);W(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,r){return this.coder.encode(t,r)}decode(t){return this.coder.decode(t)}}function BD(n,e,t){let r=[];if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const u=c.localName;return te(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),te(!l[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),l[u]=!0,t[u]})}else $(!1,"invalid tuple value","tuple",t);$(e.length===r.length,"types/value length mismatch","tuple",t);let s=new s1,i=new s1,o=[];e.forEach((l,c)=>{let u=r[c];if(l.dynamic){let f=i.length;l.encode(i,u);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,u)}),o.forEach(l=>{l(s.length)});let a=n.appendWriter(s);return a+=n.appendWriter(i),a}function _D(n,e){let t=[],r=[],s=n.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=n.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(c){if(dn(c,"BUFFER_OVERRUN"))throw c;o=c,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(n)}catch(a){if(dn(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");t.push(o),r.push(i.localName||null)}),ou.fromItems(t,r)}class bY extends Ri{constructor(t,r,s){const i=t.type+"["+(r>=0?r:"")+"]",o=r===-1||t.dynamic;super("array",i,s,o);W(this,"coder");W(this,"length");Me(this,{coder:t,length:r})}defaultValue(){const t=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(t);return r}encode(t,r){const s=Nn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,t.writeValue(s.length)),gP(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return BD(t,o,s)}decode(t){let r=this.length;r===-1&&(r=t.readIndex(),te(r*$n<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:r*$n,length:t.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new yY(this.coder));return _D(t,s)}}class wY extends Ri{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const r=Nn.dereference(t,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class FD extends Ri{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Vn(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class AY extends FD{constructor(e){super("bytes",e)}decode(e){return Ae(super.decode(e))}}class vY extends Ri{constructor(t,r){let s="bytes"+String(t);super(s,s,r,!1);W(this,"size");Me(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,r){let s=Vn(Nn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(s)}decode(t){return Ae(t.readBytes(this.size))}}const xY=new Uint8Array([]);class EY extends Ri{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(xY)}decode(e){return e.readBytes(0),null}}const CY=BigInt(0),kY=BigInt(1),SY=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class TY extends Ri{constructor(t,r,s){const i=(r?"int":"uint")+t*8;super(i,i,s,!1);W(this,"size");W(this,"signed");Me(this,{size:t,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,r){let s=Ce(Nn.dereference(r,this.type)),i=Zd(SY,$n*8);if(this.signed){let o=Zd(i,this.size*8-1);(s>o||s<-(o+kY))&&this._throwError("value out-of-bounds",r),s=AP(s,8*$n)}else(s<CY||s>Zd(i,this.size*8))&&this._throwError("value out-of-bounds",r);return t.writeValue(s)}decode(t){let r=Zd(t.readValue(),this.size*8);return this.signed&&(r=RJ(r,this.size*8)),r}}class OY extends FD{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Mi(Nn.dereference(t,"string")))}decode(e){return iu(super.decode(e))}}class cy extends Ri{constructor(t,r){let s=!1;const i=[];t.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);W(this,"coders");Me(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(s=>{t.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"),t[o]==null&&(t[o]=t[i]))}),Object.freeze(t)}encode(t,r){const s=Nn.dereference(r,"tuple");return BD(t,this.coders,s)}decode(t){return _D(t,this.coders)}}function hl(n){return Xt(Mi(n))}var NY="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";const jD=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),UD=4;function MY(n){let e=0;function t(){return n[e++]<<8|n[e++]}let r=t(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=t());let o=t(),a=e;e+=o;let l=0,c=0;function u(){return l==0&&(c=c<<8|n[e++],l=8),c>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let y=0;for(let x=0;x<f;x++)y=y<<1|u();let b=[],v=0,A=d;for(;;){let x=Math.floor(((y-v+1)*s-1)/A),C=0,S=r;for(;S-C>1;){let O=C+S>>>1;x<i[O]?S=O:C=O}if(C==0)break;b.push(C);let M=v+Math.floor(A*i[C]/s),R=v+Math.floor(A*i[C+1]/s)-1;for(;!((M^R)&h);)y=y<<1&m|u(),M=M<<1&m,R=R<<1&m|1;for(;M&~R&p;)y=y&h|y<<1&m>>>1|u(),M=M<<1^h,R=(R^h)<<1|h|1;v=M,A=1+R-M}let w=r-4;return b.map(x=>{switch(x-w){case 3:return w+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return w+256+(n[a++]<<8|n[a++]);case 1:return w+n[a++];default:return x-1}})}function RY(n){let e=0;return()=>n[e++]}function VD(n){return RY(MY(PY(n)))}function PY(n){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let t=n.length,r=new Uint8Array(6*t>>3);for(let s=0,i=0,o=0,a=0;s<t;s++)a=a<<6|e[n.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function DY(n){return n&1?~n>>1:n>>1}function IY(n,e){let t=Array(n);for(let r=0,s=0;r<n;r++)t[r]=s+=DY(e());return t}function oh(n,e=0){let t=[];for(;;){let r=n(),s=n();if(!s)break;e+=r;for(let i=0;i<s;i++)t.push(e+i);e+=s+1}return t}function HD(n){return ah(()=>{let e=oh(n);if(e.length)return e})}function zD(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(LY(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(BY(t,n))}return e.flat()}function ah(n){let e=[];for(;;){let t=n(e.length);if(!t)break;e.push(t)}return e}function $D(n,e,t){let r=Array(n).fill().map(()=>[]);for(let s=0;s<e;s++)IY(n,t).forEach((i,o)=>r[o].push(i));return r}function LY(n,e){let t=1+e(),r=e(),s=ah(e);return $D(s.length,1+n,e).flatMap((o,a)=>{let[l,...c]=o;return Array(s[a]).fill().map((u,f)=>{let d=f*r;return[l+f*t,c.map(h=>h+d)]})})}function BY(n,e){let t=1+e();return $D(t,1+n,e).map(s=>[s[0],s.slice(1)])}function _Y(n){let e=[],t=oh(n);return s(r([]),[]),e;function r(i){let o=n(),a=ah(()=>{let l=oh(n).map(c=>t[c]);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 c of o)for(let u of c.Q)s(c,[...a,u],l)}}}function FY(n){return n.toString(16).toUpperCase().padStart(2,"0")}function GD(n){return`{${FY(n)}}`}function jY(n){let e=[];for(let t=0,r=n.length;t<r;){let s=n.codePointAt(t);t+=s<65536?1:2,e.push(s)}return e}function hu(n){let t=n.length;if(t<4096)return String.fromCodePoint(...n);let r=[];for(let s=0;s<t;)r.push(String.fromCodePoint(...n.slice(s,s+=4096)));return r.join("")}function UY(n,e){let t=n.length,r=t-e.length;for(let s=0;r==0&&s<t;s++)r=n[s]-e[s];return r}var VY="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";const lh=44032,uy=4352,fy=4449,dy=4519,WD=19,KD=21,pu=28,hy=KD*pu,HY=WD*hy,zY=lh+HY,$Y=uy+WD,GY=fy+KD,WY=dy+pu;function ch(n){return n>>24&255}function QD(n){return n&16777215}let k1,JD,S1,py;function KY(){let n=VD(VY);k1=new Map(HD(n).flatMap((e,t)=>e.map(r=>[r,t+1<<24]))),JD=new Set(oh(n)),S1=new Map,py=new Map;for(let[e,t]of zD(n)){if(!JD.has(e)&&t.length==2){let[r,s]=t,i=py.get(r);i||(i=new Map,py.set(r,i)),i.set(s,e)}S1.set(e,t.reverse())}}function qD(n){return n>=lh&&n<zY}function QY(n,e){if(n>=uy&&n<$Y&&e>=fy&&e<GY)return lh+(n-uy)*hy+(e-fy)*pu;if(qD(n)&&e>dy&&e<WY&&(n-lh)%pu==0)return n+(e-dy);{let t=py.get(n);return t&&(t=t.get(e),t)?t:-1}}function YD(n){k1||KY();let e=[],t=[],r=!1;function s(i){let o=k1.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of n)for(;;){if(i<128)e.push(i);else if(qD(i)){let o=i-lh,a=o/hy|0,l=o%hy/pu|0,c=o%pu;s(uy+a),s(fy+l),c>0&&s(dy+c)}else{let o=S1.get(i);o?t.push(...o):s(i)}if(!t.length)break;i=t.pop()}if(r&&e.length>1){let i=ch(e[0]);for(let o=1;o<e.length;o++){let a=ch(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let c=e[l+1];if(e[l+1]=e[l],e[l]=c,!l||(i=ch(e[--l]),i<=a))break}i=ch(e[o])}}return e}function JY(n){let e=[],t=[],r=-1,s=0;for(let i of n){let o=ch(i),a=QD(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...t),t.length=0,r=a):t.push(a),s=o;else{let l=QY(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(t.push(a),s=o)}}return r>=0&&e.push(r,...t),e}function XD(n){return YD(n).map(QD)}function qY(n){return JY(YD(n))}const ZD=45,eI=".",tI=65039,nI=1,my=n=>Array.from(n);function uh(n,e){return n.P.has(e)||n.Q.has(e)}class YY extends Array{get is_emoji(){return!0}}let T1,rI,pl,O1,sI,mu,N1,gu,ml,iI,M1;function R1(){if(T1)return;let n=VD(NY);const e=()=>oh(n),t=()=>new Set(e()),r=(u,f)=>f.forEach(d=>u.add(d));T1=new Map(zD(n)),rI=t(),pl=e(),O1=new Set(e().map(u=>pl[u])),pl=new Set(pl),sI=t(),t();let s=HD(n),i=n();const o=()=>{let u=new Set;return e().forEach(f=>r(u,s[f])),r(u,e()),u};mu=ah(u=>{let f=ah(n).map(d=>d+96);if(f.length){let d=u>=i;f[0]-=32,f=hu(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!n();return{N:f,P:h,Q:p,M:m,R:d}}}),N1=t(),gu=new Map;let a=e().concat(my(N1)).sort((u,f)=>u-f);a.forEach((u,f)=>{let d=n(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(u),N1.has(u)||gu.set(u,h)});for(let{V:u,M:f}of new Set(gu.values())){let d=[];for(let p of u){let m=mu.filter(b=>uh(b,p)),y=d.find(({G:b})=>m.some(v=>b.has(v)));y||(y={G:new Set,V:[]},d.push(y)),y.V.push(p),r(y.G,m)}let h=d.flatMap(p=>my(p.G));for(let{G:p,V:m}of d){let y=new Set(h.filter(b=>!p.has(b)));for(let b of m)f.set(b,y)}}ml=new Set;let l=new Set;const c=u=>ml.has(u)?l.add(u):ml.add(u);for(let u of mu){for(let f of u.P)c(f);for(let f of u.Q)c(f)}for(let u of ml)!gu.has(u)&&!l.has(u)&&gu.set(u,nI);r(ml,XD(ml)),iI=_Y(n).map(u=>YY.from(u)).sort(UY),M1=new Map;for(let u of iI){let f=[M1];for(let d of u){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===tI?f.push(...h):f=h}for(let d of f)d.V=u}}function P1(n){return(oI(n)?"":`${D1(gy([n]))} `)+GD(n)}function D1(n){return`"${n}"`}function XY(n){if(n.length>=4&&n[2]==ZD&&n[3]==ZD)throw new Error(`invalid label extension: "${hu(n.slice(0,4))}"`)}function ZY(n){for(let t=n.lastIndexOf(95);t>0;)if(n[--t]!==95)throw new Error("underscore allowed only at start")}function eX(n){let e=n[0],t=jD.get(e);if(t)throw fh(`leading ${t}`);let r=n.length,s=-1;for(let i=1;i<r;i++){e=n[i];let o=jD.get(e);if(o){if(s==i)throw fh(`${t} + ${o}`);s=i+1,t=o}}if(s==r)throw fh(`trailing ${t}`)}function gy(n,e=1/0,t=GD){let r=[];tX(n[0])&&r.push("◌"),n.length>e&&(e>>=1,n=[...n.slice(0,e),8230,...n.slice(-e)]);let s=0,i=n.length;for(let o=0;o<i;o++){let a=n[o];oI(a)&&(r.push(hu(n.slice(s,o))),r.push(t(a)),s=o+1)}return r.push(hu(n.slice(s,i))),r.join("")}function tX(n){return R1(),pl.has(n)}function oI(n){return R1(),sI.has(n)}function nX(n){return oX(rX(n,qY,cX))}function rX(n,e,t){if(!n)return[];R1();let r=0;return n.split(eI).map(s=>{let i=jY(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=lX(i,e,t),l=a.length,c;if(!l)throw new Error("empty label");let u=o.output=a.flat();if(ZY(u),!(o.emoji=l>1||a[0].is_emoji)&&u.every(d=>d<128))XY(u),c="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)c="Emoji";else{if(pl.has(u[0]))throw fh("leading combining mark");for(let m=1;m<l;m++){let y=a[m];if(!y.is_emoji&&pl.has(y[0]))throw fh(`emoji + combining mark: "${hu(a[m-1])} + ${gy([y[0]])}"`)}eX(u);let h=my(new Set(d)),[p]=iX(h);aX(p,d),sX(p,h),c=p.N}}o.type=c}catch(a){o.error=a}return o})}function sX(n,e){let t,r=[];for(let s of e){let i=gu.get(s);if(i===nI)return;if(i){let o=i.M.get(s);if(t=t?t.filter(a=>o.has(a)):my(o),!t.length)return}else r.push(s)}if(t){for(let s of t)if(r.every(i=>uh(s,i)))throw new Error(`whole-script confusable: ${n.N}/${s.N}`)}}function iX(n){let e=mu;for(let t of n){let r=e.filter(s=>uh(s,t));if(!r.length)throw mu.some(s=>uh(s,t))?lI(e[0],t):aI(t);if(e=r,r.length==1)break}return e}function oX(n){return n.map(({input:e,error:t,output:r})=>{if(t){let s=t.message;throw new Error(n.length==1?s:`Invalid label ${D1(gy(e,63))}: ${s}`)}return hu(r)}).join(eI)}function aI(n){return new Error(`disallowed character: ${P1(n)}`)}function lI(n,e){let t=P1(e),r=mu.find(s=>s.P.has(e));return r&&(t=`${r.N} ${t}`),new Error(`illegal mixture: ${n.N} + ${t}`)}function fh(n){return new Error(`illegal placement: ${n}`)}function aX(n,e){for(let t of e)if(!uh(n,t))throw lI(n,t);if(n.M){let t=XD(e);for(let r=1,s=t.length;r<s;r++)if(O1.has(t[r])){let i=r+1;for(let o;i<s&&O1.has(o=t[i]);i++)for(let a=r;a<i;a++)if(t[a]==o)throw new Error(`duplicate non-spacing marks: ${P1(o)}`);if(i-r>UD)throw new Error(`excessive non-spacing marks: ${D1(gy(t.slice(r-1,i)))} (${i-r}/${UD})`);r=i}}}function lX(n,e,t){let r=[],s=[];for(n=n.slice().reverse();n.length;){let i=uX(n);if(i)s.length&&(r.push(e(s)),s=[]),r.push(t(i));else{let o=n.pop();if(ml.has(o))s.push(o);else{let a=T1.get(o);if(a)s.push(...a);else if(!rI.has(o))throw aI(o)}}}return s.length&&r.push(e(s)),r}function cX(n){return n.filter(e=>e!=tI)}function uX(n,e){let t=M1,r,s=n.length;for(;s&&(t=t.get(n[--s]),!!t);){let{V:i}=t;i&&(r=i,n.length=s)}return r}const cI=new Uint8Array(32);cI.fill(0);function uI(n){return $(n.length!==0,"invalid ENS name; empty component","comp",n),n}function fI(n){const e=Mi(fX(n)),t=[];if(n.length===0)return t;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(uI(e.slice(r,s))),r=s+1);return $(r<e.length,"invalid ENS name; empty component","name",n),t.push(uI(e.slice(r))),t}function fX(n){try{if(n.length===0)throw new Error("empty label");return nX(n)}catch(e){$(!1,`invalid ENS name (${e.message})`,"name",n)}}function I1(n){$(typeof n=="string","invalid ENS name; not a string","name",n),$(n.length,"invalid ENS name (empty label)","name",n);let e=cI;const t=fI(n);for(;t.length;)e=Xt(zt([e,Xt(t.pop())]));return Ae(e)}function dX(n,e){const t=e;return $(t<=255,"DNS encoded label cannot exceed 255","length",t),Ae(zt(fI(n).map(r=>{$(r.length<=t,`label ${JSON.stringify(n)} exceeds ${t} bytes`,"name",n);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function L1(n,e){return{address:pt(n),storageKeys:e.map((t,r)=>($(Ct(t,32),"invalid slot",`storageKeys[${r}]`,t),t.toLowerCase()))}}function $o(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?($(t.length===2,"invalid slot set",`value[${r}]`,t),L1(t[0],t[1])):($(t!=null&&typeof t=="object","invalid address-slot set","value",n),L1(t.address,t.storageKeys)));$(n!=null&&typeof n=="object","invalid access list","value",n);const e=Object.keys(n).map(t=>{const r=n[t].reduce((s,i)=>(s[i]=!0,s),{});return L1(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function hX(n){let e;return typeof n=="string"?e=ih.computePublicKey(n,!1):e=n.publicKey,pt(Xt("0x"+e.substring(4)).substring(26))}function pX(n,e){return hX(ih.recoverPublicKey(n,e))}const pn=BigInt(0),mX=BigInt(2),gX=BigInt(27),yX=BigInt(28),bX=BigInt(35),wX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),B1=4096*32;function dI(n,e){let t=n.toString(16);for(;t.length<2;)t="0"+t;return t+=lu(e).substring(4),"0x"+t}function yy(n){return n==="0x"?null:pt(n)}function _1(n,e){try{return $o(n)}catch(t){$(!1,t.message,e,n)}}function dh(n,e){return n==="0x"?0:Je(n,e)}function Gt(n,e){if(n==="0x")return pn;const t=Ce(n,e);return $(t<=wX,"value exceeds uint size",e,t),t}function Tt(n,e){const t=Ce(n,"value"),r=Hn(t);return $(r.length<=32,"value too large",`tx.${e}`,t),r}function F1(n){return $o(n).map(e=>[e.address,e.storageKeys])}function AX(n,e){$(Array.isArray(n),`invalid ${e}`,"value",n);for(let t=0;t<n.length;t++)$(Ct(n[t],32),"invalid ${ param } hash",`value[${t}]`,n[t]);return n}function vX(n){const e=ty(n);$(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",n);const t={type:0,nonce:dh(e[0],"nonce"),gasPrice:Gt(e[1],"gasPrice"),gasLimit:Gt(e[2],"gasLimit"),to:yy(e[3]),value:Gt(e[4],"value"),data:Ae(e[5]),chainId:pn};if(e.length===6)return t;const r=Gt(e[6],"v"),s=Gt(e[7],"r"),i=Gt(e[8],"s");if(s===pn&&i===pn)t.chainId=r;else{let o=(r-bX)/mX;o<pn&&(o=pn),t.chainId=o,$(o!==pn||r===gX||r===yX,"non-canonical legacy v","v",e[6]),t.signature=ws.from({r:ol(e[7],32),s:ol(e[8],32),v:r})}return t}function xX(n,e){const t=[Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data];let r=pn;if(n.chainId!=pn)r=Ce(n.chainId,"tx.chainId"),$(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(n.signature){const i=n.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==pn&&(t.push(Hn(r)),t.push("0x"),t.push("0x")),ll(t);let s=BigInt(27+e.yParity);return r!==pn?s=ws.getChainIdV(r,e.v):BigInt(e.v)!==s&&$(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(Hn(s)),t.push(Hn(e.r)),t.push(Hn(e.s)),ll(t)}function j1(n,e){let t;try{if(t=dh(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{$(!1,"invalid yParity","yParity",e[0])}const r=ol(e[1],32),s=ol(e[2],32),i=ws.from({r,s,yParity:t});n.signature=i}function EX(n){const e=ty(ct(n).slice(1));$(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Ae(n));const t={type:2,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:Ae(e[7]),accessList:_1(e[8],"accessList")};return e.length===9||j1(t,e.slice(9)),t}function CX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"yParity")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x02",ll(t)])}function kX(n){const e=ty(ct(n).slice(1));$(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Ae(n));const t={type:1,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),gasPrice:Gt(e[2],"gasPrice"),gasLimit:Gt(e[3],"gasLimit"),to:yy(e[4]),value:Gt(e[5],"value"),data:Ae(e[6]),accessList:_1(e[7],"accessList")};return e.length===8||j1(t,e.slice(8)),t}function SX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"recoveryParam")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x01",ll(t)])}function TX(n){let e=ty(ct(n).slice(1)),t="3",r=null;if(e.length===4&&Array.isArray(e[0])){t="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: ${t}`,"data",Ae(n));const s={type:3,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:Ae(e[7]),accessList:_1(e[8],"accessList"),maxFeePerBlobGas:Gt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),$(s.to!=null,`invalid address for transaction type: ${t}`,"data",n),$(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",n);for(let i=0;i<s.blobVersionedHashes.length;i++)$(Ct(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",n);return e.length===11||j1(s,e.slice(11)),s}function OX(n,e,t){const r=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||sh,Tt(n.value,"value"),n.data,F1(n.accessList||[]),Tt(n.maxFeePerBlobGas||0,"maxFeePerBlobGas"),AX(n.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Tt(e.yParity,"yParity")),r.push(Hn(e.r)),r.push(Hn(e.s)),t)?zt(["0x03",ll([r,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])]):zt(["0x03",ll(r)])}const Xi=class Xi{constructor(){q(this,tf);q(this,ri);q(this,$u);q(this,Gu);q(this,Wu);q(this,Ku);q(this,Qu);q(this,Ju);q(this,qu);q(this,Yu);q(this,Xu);q(this,Zu);q(this,ef);q(this,Vl);q(this,ta);q(this,Yi);q(this,na);L(this,ri,null),L(this,$u,null),L(this,Wu,0),L(this,Ku,pn),L(this,Qu,null),L(this,Ju,null),L(this,qu,null),L(this,Gu,"0x"),L(this,Yu,pn),L(this,Xu,pn),L(this,Zu,null),L(this,ef,null),L(this,Vl,null),L(this,ta,null),L(this,na,null),L(this,Yi,null)}get type(){return T(this,ri)}set type(e){switch(e){case null:L(this,ri,null);break;case 0:case"legacy":L(this,ri,0);break;case 1:case"berlin":case"eip-2930":L(this,ri,1);break;case 2:case"london":case"eip-1559":L(this,ri,2);break;case 3:case"cancun":case"eip-4844":L(this,ri,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,$u);return e==null&&this.type===3?sh:e}set to(e){L(this,$u,e==null?null:pt(e))}get nonce(){return T(this,Wu)}set nonce(e){L(this,Wu,Je(e,"value"))}get gasLimit(){return T(this,Ku)}set gasLimit(e){L(this,Ku,Ce(e))}get gasPrice(){const e=T(this,Qu);return e==null&&(this.type===0||this.type===1)?pn:e}set gasPrice(e){L(this,Qu,e==null?null:Ce(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,Ju);return e??(this.type===2||this.type===3?pn:null)}set maxPriorityFeePerGas(e){L(this,Ju,e==null?null:Ce(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,qu);return e??(this.type===2||this.type===3?pn:null)}set maxFeePerGas(e){L(this,qu,e==null?null:Ce(e,"maxFeePerGas"))}get data(){return T(this,Gu)}set data(e){L(this,Gu,Ae(e))}get value(){return T(this,Yu)}set value(e){L(this,Yu,Ce(e,"value"))}get chainId(){return T(this,Xu)}set chainId(e){L(this,Xu,Ce(e))}get signature(){return T(this,Zu)||null}set signature(e){L(this,Zu,e==null?null:ws.from(e))}get accessList(){const e=T(this,ef)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){L(this,ef,e==null?null:$o(e))}get maxFeePerBlobGas(){const e=T(this,Vl);return e==null&&this.type===3?pn:e}set maxFeePerBlobGas(e){L(this,Vl,e==null?null:Ce(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ta);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 t=0;t<e.length;t++)$(Ct(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}L(this,ta,e)}get blobs(){return T(this,na)==null?null:T(this,na).map(e=>Object.assign({},e))}set blobs(e){if(e==null){L(this,na,null);return}const t=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(Zv(i)){te(T(this,Yi),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if($(o.length<=B1,"blob is too large",`blobs[${s}]`,i),o.length!==B1){const c=new Uint8Array(B1);c.set(o),o=c}const a=T(this,Yi).blobToKzgCommitment(o),l=Ae(T(this,Yi).computeBlobKzgProof(o,a));t.push({data:Ae(o),commitment:Ae(a),proof:l}),r.push(dI(1,a))}else{const o=Ae(i.commitment);t.push({data:Ae(i.data),commitment:o,proof:Ae(i.proof)}),r.push(dI(1,o))}}L(this,na,t),L(this,ta,r)}get kzg(){return T(this,Yi)}set kzg(e){L(this,Yi,e)}get hash(){return this.signature==null?null:Xt(fe(this,tf,b0).call(this,!0,!1))}get unsignedHash(){return Xt(this.unsignedSerialized)}get from(){return this.signature==null?null:pX(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:ih.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return fe(this,tf,b0).call(this,!0,!0)}get unsignedSerialized(){return fe(this,tf,b0).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,Vl)!=null||T(this,ta);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&te(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),te(!t||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):t?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 Xi.from(this)}toJSON(){const e=t=>t==null?null:t.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 Xi;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return Xi.from(vX(r));switch(r[0]){case 1:return Xi.from(kX(r));case 2:return Xi.from(EX(r));case 3:return Xi.from(TX(r))}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Xi;return e.type!=null&&(t.type=e.type),e.to!=null&&(t.to=e.to),e.nonce!=null&&(t.nonce=e.nonce),e.gasLimit!=null&&(t.gasLimit=e.gasLimit),e.gasPrice!=null&&(t.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(t.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(t.data=e.data),e.value!=null&&(t.value=e.value),e.chainId!=null&&(t.chainId=e.chainId),e.signature!=null&&(t.signature=ws.from(e.signature)),e.accessList!=null&&(t.accessList=e.accessList),e.blobVersionedHashes!=null&&(t.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(t.kzg=e.kzg),e.blobs!=null&&(t.blobs=e.blobs),e.hash!=null&&($(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),$(t.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&($(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),$(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}};ri=new WeakMap,$u=new WeakMap,Gu=new WeakMap,Wu=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Ju=new WeakMap,qu=new WeakMap,Yu=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,ef=new WeakMap,Vl=new WeakMap,ta=new WeakMap,Yi=new WeakMap,na=new WeakMap,tf=new WeakSet,b0=function(e,t){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 xX(this,r);case 1:return SX(this,r);case 2:return CX(this,r);case 3:return OX(this,r,t?this.blobs:null)}te(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let hh=Xi;const hI=new Uint8Array(32);hI.fill(0);const NX=BigInt(-1),pI=BigInt(0),mI=BigInt(1),MX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function RX(n){const e=ct(n),t=e.length%32;return t?zt([e,hI.slice(t)]):Ae(e)}const PX=_o(mI,32),DX=_o(pI,32),gI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},U1=["name","version","chainId","verifyingContract","salt"];function yI(n){return function(e){return $(typeof e=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const IX={name:yI("name"),version:yI("version"),chainId:function(n){const e=Ce(n,"domain.chainId");return $(e>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(e)?Number(e):al(e)},verifyingContract:function(n){try{return pt(n).toLowerCase()}catch{}$(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){const e=ct(n,"domain.salt");return $(e.length===32,'invalid domain value "salt"',"domain.salt",n),Ae(e)}};function V1(n){{const e=n.match(/^(u?)int(\d+)$/);if(e){const t=e[1]==="",r=parseInt(e[2]);$(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",n);const s=Zd(MX,t?r-1:r),i=t?(s+mI)*NX:pI;return function(o){const a=Ce(o,"value");return $(a>=i&&a<=s,`value out-of-bounds for ${n}`,"value",a),_o(t?AP(a,256):a,32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return $(t!==0&&t<=32&&e[1]===String(t),"invalid bytes width","type",n),function(r){const s=ct(r);return $(s.length===t,`invalid length for ${n}`,"value",r),RX(r)}}}switch(n){case"address":return function(e){return ol(pt(e),32)};case"bool":return function(e){return e?PX:DX};case"bytes":return function(e){return Xt(e)};case"string":return function(e){return hl(e)}}return null}function bI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}function by(n){const e=n.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:n}}const qr=class qr{constructor(e){q(this,f0);W(this,"primaryType");q(this,Uh);q(this,Zi);q(this,nf);L(this,Zi,new Map),L(this,nf,new Map);const t=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:c,type:u})=>{let{base:f,index:d}=by(u);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:c,type:f+(d||"")}}),t.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),L(this,Uh,JSON.stringify(i));for(const l in i){const c=new Set;for(const u of i[l]){$(!c.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),c.add(u.name);const f=by(u.type).base;$(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!V1(f)&&($(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),t.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,c){$(!c.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),c.add(l);for(const u of t.get(l))if(r.has(u)){a(u,c);for(const f of c)s.get(f).add(u)}c.delete(l)}a(this.primaryType,new Set);for(const[l,c]of s){const u=Array.from(c);u.sort(),T(this,Zi).set(l,bI(l,i[l])+u.map(f=>bI(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,Uh))}getEncoder(e){let t=T(this,nf).get(e);return t||(t=fe(this,f0,cF).call(this,e),T(this,nf).set(e,t)),t}encodeType(e){const t=T(this,Zi).get(e);return $(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Xt(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(V1(e))return r(e,t);const s=by(e).array;if(s)return $(s.count===-1||s.count===t.length,`array length mismatch; expected length ${s.count}`,"value",t),t.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,t[a],r),o),{});$(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new qr(e)}static getPrimaryType(e){return qr.from(e).primaryType}static hashStruct(e,t,r){return qr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(e[r]==null)continue;const s=gI[r];$(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:s})}return t.sort((r,s)=>U1.indexOf(r.name)-U1.indexOf(s.name)),qr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return zt(["0x1901",qr.hashDomain(e),qr.from(t).hash(r)])}static hash(e,t,r){return Xt(qr.encode(e,t,r))}static async resolveNames(e,t,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!Ct(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=qr.from(t);o.visit(r,(a,l)=>(a==="address"&&!Ct(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,t,r){qr.hashDomain(e);const s={},i=[];U1.forEach(l=>{const c=e[l];c!=null&&(s[l]=IX[l](c),i.push({name:l,type:gI[l]}))});const o=qr.from(t);t=o.types;const a=Object.assign({},t);return $(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return Ae(ct(c));if(l.match(/^u?int/))return Ce(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return $(typeof c=="string","invalid string","value",c),c}$(!1,"unsupported type","type",l)})}}};Uh=new WeakMap,Zi=new WeakMap,nf=new WeakMap,f0=new WeakSet,cF=function(e){{const s=V1(e);if(s)return s}const t=by(e).array;if(t){const s=t.prefix,i=this.getEncoder(s);return o=>{$(t.count===-1||t.count===o.length,`array length mismatch; expected length ${t.count}`,"value",o);let a=o.map(i);return T(this,Zi).has(s)&&(a=a.map(Xt)),Xt(zt(a))}}const r=this.types[e];if(r){const s=hl(T(this,Zi).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(i[a]);return T(this,Zi).has(l)?Xt(c):c});return o.unshift(s),zt(o)}}$(!1,`unknown type: ${e}`,"type",e)};let wy=qr;function Wn(n){const e=new Set;return n.forEach(t=>e.add(t)),Object.freeze(e)}const LX=Wn("external public payable override".split(" ")),wI="constant external internal payable private public pure view override",BX=Wn(wI.split(" ")),AI="constructor error event fallback function receive struct",vI=Wn(AI.split(" ")),xI="calldata memory storage payable indexed",_X=Wn(xI.split(" ")),FX=[AI,xI,"tuple returns",wI].join(" "),jX=Wn(FX.split(" ")),UX={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},VX=new RegExp("^(\\s*)"),HX=new RegExp("^([0-9]+)"),zX=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),EI=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),CI=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),d0=class d0{constructor(e){q(this,Vh);q(this,Cn);q(this,ks);L(this,Cn,0),L(this,ks,e.slice())}get offset(){return T(this,Cn)}get length(){return T(this,ks).length-T(this,Cn)}clone(){return new d0(T(this,ks))}reset(){L(this,Cn,0)}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=fe(this,Vh,ME).call(this,T(this,Cn)+1,e.match+1);return L(this,Cn,e.match+1),t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;T(this,Cn)<e.match-1;){const r=this.peek().linkNext;t.push(fe(this,Vh,ME).call(this,T(this,Cn)+1,r)),L(this,Cn,r)}return L(this,Cn,e.match+1),t}peek(){if(T(this,Cn)>=T(this,ks).length)throw new Error("out-of-bounds");return T(this,ks)[T(this,Cn)]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return Xh(this,Cn)._++,e}toString(){const e=[];for(let t=T(this,Cn);t<T(this,ks).length;t++){const r=T(this,ks)[t];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Cn=new WeakMap,ks=new WeakMap,Vh=new WeakSet,ME=function(e=0,t=0){return new d0(T(this,ks).slice(e,t).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let As=d0;function Go(n){const e=[],t=o=>{const a=i<n.length?JSON.stringify(n[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<n.length;){let o=n.substring(i),a=o.match(VX);a&&(i+=a[1].length,o=n.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let c=UX[o[0]]||"";if(c){if(l.type=c,l.text=o[0],i++,c==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(c=="CLOSE_PAREN")r.length===0&&t("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(c==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(c==="OPEN_BRACKET")l.type="BRACKET";else if(c==="CLOSE_BRACKET"){let u=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;u=f+u,e[e.length-1].value=Je(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=u}continue}if(a=o.match(zX),a){if(l.text=a[1],i+=l.text.length,jX.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(CI)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(HX),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 As(e.map(o=>Object.freeze(o)))}function kI(n,e){let t=[];for(const r in e.keys())n.has(r)&&t.push(r);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Ay(n,e){if(e.peekKeyword(vI)){const t=e.pop().text;if(t!==n)throw new Error(`expected ${n}, got ${t}`)}return e.popType("ID")}function Ii(n,e){const t=new Set;for(;;){const r=n.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(n.pop(),t.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);t.add(r)}return Object.freeze(t)}function SI(n){let e=Ii(n,BX);return kI(e,Wn("constant payable nonpayable".split(" "))),kI(e,Wn("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 Li(n,e){return n.popParams().map(t=>An.from(t,e))}function TI(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return Ce(n.pop().text);throw new Error("invalid gas")}return null}function gl(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}const $X=new RegExp(/^(.*)\[([0-9]*)\]$/);function OI(n){const e=n.match(CI);if($(e,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(e[2]){const t=parseInt(e[2]);$(t!==0&&t<=32,"invalid bytes length","type",n)}else if(e[3]){const t=parseInt(e[3]);$(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",n)}return n}const Lt={},ar=Symbol.for("_ethers_internal"),NI="_ParamTypeInternal",MI="_ErrorInternal",RI="_EventInternal",PI="_ConstructorInternal",DI="_FallbackInternal",II="_FunctionInternal",LI="_StructInternal",Yr=class Yr{constructor(e,t,r,s,i,o,a,l){q(this,rf);W(this,"name");W(this,"type");W(this,"baseType");W(this,"indexed");W(this,"components");W(this,"arrayLength");W(this,"arrayChildren");if(qg(e,Lt,"ParamType"),Object.defineProperty(this,ar,{value:NI}),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:t,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 t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){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,t))}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,t))}return t(this.type,e)}async walkAsync(e,t){const r=[],s=[e];return fe(this,rf,w0).call(this,r,e,t,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,t){if(Yr.isParamType(e))return e;if(typeof e=="string")try{return Yr.from(Go(e),t)}catch{$(!1,"invalid param type","obj",e)}else if(e instanceof As){let a="",l="",c=null;Ii(e,Wn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",c=e.popParams().map(m=>Yr.from(m)),a=`tuple(${c.map(m=>m.format()).join(",")})`):(a=OI(e.popType("TYPE")),l=a);let u=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();u=new Yr(Lt,"",a,l,null,c,f,u),f=m.value,a+=m.text,l="array",c=null}let d=null;if(Ii(e,_X).has("indexed")){if(!t)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Yr(Lt,p,a,l,d,c,f,u)}const r=e.name;$(!r||typeof r=="string"&&r.match(EI),"invalid name","obj.name",r);let s=e.indexed;s!=null&&($(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match($X);if(o){const a=parseInt(o[2]||"-1"),l=Yr.from({type:o[1],components:e.components});return new Yr(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(c=>Yr.from(c)):null;return new Yr(Lt,r||"",i,"tuple",s,a,null,null)}return i=OI(e.type),new Yr(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[ar]===NI}};rf=new WeakSet,w0=function(e,t,r,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=t.slice();a.forEach((l,c)=>{var u;fe(u=o,rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(t))a=t.slice();else{if(t==null||typeof t!="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 t))throw new Error(`missing value for component ${l.name}`);return t[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,c)=>{var u;fe(u=o[c],rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}const i=r(this.type,t);i.then?e.push(async function(){s(await i)}()):s(i)};let An=Yr;class yl{constructor(e,t,r){W(this,"type");W(this,"inputs");qg(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Me(this,{type:t,inputs:r})}static from(e){if(typeof e=="string"){try{yl.from(JSON.parse(e))}catch{}return yl.from(Go(e))}if(e instanceof As)switch(e.peekKeyword(vI)){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return bl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return bl.from(e)}te(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}$(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Bi.isFragment(e)}static isError(e){return lr.isFragment(e)}static isEvent(e){return Zs.isFragment(e)}static isFunction(e){return ei.isFragment(e)}static isStruct(e){return bl.isFragment(e)}}class vy extends yl{constructor(t,r,s,i){super(t,r,i);W(this,"name");$(typeof s=="string"&&s.match(EI),"invalid identifier","name",s),i=Object.freeze(i.slice()),Me(this,{name:s})}}function ph(n,e){return"("+e.map(t=>t.format(n)).join(n==="full"?", ":",")+")"}class lr extends vy{constructor(e,t,r){super(e,"error",t,r),Object.defineProperty(this,ar,{value:MI})}get selector(){return hl(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 t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+ph(e,this.inputs)),t.join(" ")}static from(e){if(lr.isFragment(e))return e;if(typeof e=="string")return lr.from(Go(e));if(e instanceof As){const t=Ay("error",e),r=Li(e);return gl(e),new lr(Lt,t,r)}return new lr(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===MI}}class Zs extends vy{constructor(t,r,s,i){super(t,"event",r,s);W(this,"anonymous");Object.defineProperty(this,ar,{value:RI}),Me(this,{anonymous:i})}get topicHash(){return hl(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("event"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(t,r){return r=(r||[]).map(i=>An.from(i)),new Zs(Lt,t,r,!1).topicHash}static from(t){if(Zs.isFragment(t))return t;if(typeof t=="string")try{return Zs.from(Go(t))}catch{$(!1,"invalid event fragment","obj",t)}else if(t instanceof As){const r=Ay("event",t),s=Li(t,!0),i=!!Ii(t,Wn(["anonymous"])).has("anonymous");return gl(t),new Zs(Lt,r,s,i)}return new Zs(Lt,t.name,t.inputs?t.inputs.map(r=>An.from(r,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ar]===RI}}class Bi extends yl{constructor(t,r,s,i,o){super(t,r,s);W(this,"payable");W(this,"gas");Object.defineProperty(this,ar,{value:PI}),Me(this,{payable:i,gas:o})}format(t){if(te(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="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(t)))});const r=[`constructor${ph(t,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(t){if(Bi.isFragment(t))return t;if(typeof t=="string")try{return Bi.from(Go(t))}catch{$(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof As){Ii(t,Wn(["constructor"]));const r=Li(t),s=!!Ii(t,LX).has("payable"),i=TI(t);return gl(t),new Bi(Lt,"constructor",r,s,i)}return new Bi(Lt,"constructor",t.inputs?t.inputs.map(An.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===PI}}class _i extends yl{constructor(t,r,s){super(t,"fallback",r);W(this,"payable");Object.defineProperty(this,ar,{value:DI}),Me(this,{payable:s})}format(t){const r=this.inputs.length===0?"receive":"fallback";if(t==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(t){if(_i.isFragment(t))return t;if(typeof t=="string")try{return _i.from(Go(t))}catch{$(!1,"invalid fallback fragment","obj",t)}else if(t instanceof As){const r=t.toString(),s=t.peekKeyword(Wn(["fallback","receive"]));if($(s,"type must be fallback or receive","obj",r),t.popKeyword(Wn(["fallback","receive"]))==="receive"){const l=Li(t);return $(l.length===0,"receive cannot have arguments","obj.inputs",l),Ii(t,Wn(["payable"])),gl(t),new _i(Lt,[],!0)}let o=Li(t);o.length?$(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[An.from("bytes")];const a=SI(t);if($(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Ii(t,Wn(["returns"])).has("returns")){const l=Li(t);$(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(c=>c.format("minimal")).join(", "))}return gl(t),new _i(Lt,o,a==="payable")}if(t.type==="receive")return new _i(Lt,[],!0);if(t.type==="fallback"){const r=[An.from("bytes")],s=t.stateMutability==="payable";return new _i(Lt,r,s)}$(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ar]===DI}}class ei extends vy{constructor(t,r,s,i,o,a){super(t,"function",r,i);W(this,"constant");W(this,"outputs");W(this,"stateMutability");W(this,"payable");W(this,"gas");Object.defineProperty(this,ar,{value:II}),o=Object.freeze(o.slice()),Me(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return hl(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="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(t))),outputs:this.outputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("function"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(ph(t,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(t,r){return r=(r||[]).map(i=>An.from(i)),new ei(Lt,t,"view",r,[],null).selector}static from(t){if(ei.isFragment(t))return t;if(typeof t=="string")try{return ei.from(Go(t))}catch{$(!1,"invalid function fragment","obj",t)}else if(t instanceof As){const s=Ay("function",t),i=Li(t),o=SI(t);let a=[];Ii(t,Wn(["returns"])).has("returns")&&(a=Li(t));const l=TI(t);return gl(t),new ei(Lt,s,o,i,a,l)}let r=t.stateMutability;return r==null&&(r="payable",typeof t.constant=="boolean"?(r="view",t.constant||(r="payable",typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable")),new ei(Lt,t.name,r,t.inputs?t.inputs.map(An.from):[],t.outputs?t.outputs.map(An.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===II}}class bl extends vy{constructor(e,t,r){super(e,"struct",t,r),Object.defineProperty(this,ar,{value:LI})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return bl.from(Go(e))}catch{$(!1,"invalid struct fragment","obj",e)}else if(e instanceof As){const t=Ay("struct",e),r=Li(e);return gl(e),new bl(Lt,t,r)}return new bl(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===LI}}const vs=new Map;vs.set(0,"GENERIC_PANIC"),vs.set(1,"ASSERT_FALSE"),vs.set(17,"OVERFLOW"),vs.set(18,"DIVIDE_BY_ZERO"),vs.set(33,"ENUM_RANGE_ERROR"),vs.set(34,"BAD_STORAGE_DATA"),vs.set(49,"STACK_UNDERFLOW"),vs.set(50,"ARRAY_RANGE_ERROR"),vs.set(65,"OUT_OF_MEMORY"),vs.set(81,"UNINITIALIZED_FUNCTION_CALL");const GX=new RegExp(/^bytes([0-9]*)$/),WX=new RegExp(/^(u?int)([0-9]*)$/);let H1=null,BI=1024;function KX(n,e,t,r){let s="missing revert data",i=null;const o=null;let a=null;if(t){s="execution reverted";const c=ct(t);if(t=Ae(t),c.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(c.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(Ae(c.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],c.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(c.slice(0,4))==="0x4e487b71")try{const u=Number(r.decode(["uint256"],c.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[u]},i=`Panic due to ${vs.get(u)||"UNKNOWN"}(${u})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?pt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=pt(e.from)),Mt(s,"CALL_EXCEPTION",{action:n,data:t,reason:i,transaction:l,invocation:o,revert:a})}const h0=class h0{constructor(){q(this,ra)}getDefaultValue(e){const t=e.map(s=>fe(this,ra,Tf).call(this,An.from(s)));return new cy(t,"_").defaultValue()}encode(e,t){gP(t.length,e.length,"types/values length mismatch");const r=e.map(o=>fe(this,ra,Tf).call(this,An.from(o))),s=new cy(r,"_"),i=new s1;return s.encode(i,t),i.data}decode(e,t,r){const s=e.map(o=>fe(this,ra,Tf).call(this,An.from(o)));return new cy(s,"_").decode(new i1(t,r,BI))}static _setDefaultMaxInflation(e){$(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),BI=e}static defaultAbiCoder(){return H1==null&&(H1=new h0),H1}static getBuiltinCallException(e,t,r){return KX(e,t,r,h0.defaultAbiCoder())}};ra=new WeakSet,Tf=function(e){if(e.isArray())return new bY(fe(this,ra,Tf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new cy(e.components.map(r=>fe(this,ra,Tf).call(this,r)),e.name);switch(e.baseType){case"address":return new gY(e.name);case"bool":return new wY(e.name);case"string":return new OY(e.name);case"bytes":return new AY(e.name);case"":return new EY(e.name)}let t=e.type.match(WX);if(t){let r=parseInt(t[2]||"256");return $(r!==0&&r<=256&&r%8===0,"invalid "+t[1]+" bit length","param",e),new TY(r/8,t[1]==="int",e.name)}if(t=e.type.match(GX),t){let r=parseInt(t[1]);return $(r!==0&&r<=32,"invalid bytes length","param",e),new vY(r,e.name)}$(!1,"invalid type","type",e.type)};let yu=h0;class QX{constructor(e,t,r){W(this,"fragment");W(this,"name");W(this,"signature");W(this,"topic");W(this,"args");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,signature:i,topic:t,args:r})}}class JX{constructor(e,t,r,s){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");W(this,"value");const i=e.name,o=e.format();Me(this,{fragment:e,name:i,args:r,signature:o,selector:t,value:s})}}class qX{constructor(e,t,r){W(this,"fragment");W(this,"name");W(this,"args");W(this,"signature");W(this,"selector");const s=e.name,i=e.format();Me(this,{fragment:e,name:s,args:r,signature:i,selector:t})}}class _I{constructor(e){W(this,"hash");W(this,"_isIndexed");Me(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const FI={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"},jI={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let e="unknown panic code";return n>=0&&n<=255&&FI[n.toString()]&&(e=FI[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${e})`}}},Hl=class Hl{constructor(e){q(this,ai);W(this,"fragments");W(this,"deploy");W(this,"fallback");W(this,"receive");q(this,si);q(this,ii);q(this,oi);q(this,Pn);let t=[];typeof e=="string"?t=JSON.parse(e):t=e,L(this,oi,new Map),L(this,si,new Map),L(this,ii,new Map);const r=[];for(const o of t)try{r.push(yl.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,Pn,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,oi);break;case"event":l=T(this,ii);break;case"error":l=T(this,si);break;default:return}const c=o.format();l.has(c)||l.set(c,o)}),this.deploy||Me(this,{deploy:Bi.from("constructor()")}),Me(this,{fallback:s,receive:i})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return yu.defaultAbiCoder()}getFunctionName(e){const t=fe(this,ai,A0).call(this,e,null,!1);return $(t,"no matching function","key",e),t.name}hasFunction(e){return!!fe(this,ai,A0).call(this,e,null,!1)}getFunction(e,t){return fe(this,ai,A0).call(this,e,t||null,!0)}forEachFunction(e){const t=Array.from(T(this,oi).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,oi).get(s),r)}}getEventName(e){const t=fe(this,ai,v0).call(this,e,null,!1);return $(t,"no matching event","key",e),t.name}hasEvent(e){return!!fe(this,ai,v0).call(this,e,null,!1)}getEvent(e,t){return fe(this,ai,v0).call(this,e,t||null,!0)}forEachEvent(e){const t=Array.from(T(this,ii).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,ii).get(s),r)}}getError(e,t){if(Ct(e)){const s=e.toLowerCase();if(jI[s])return lr.from(jI[s].signature);for(const i of T(this,si).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,si))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?lr.from("error Error(string)"):e==="Panic"?lr.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=lr.from(e).format(),e==="Error(string)")return lr.from("error Error(string)");if(e==="Panic(uint256)")return lr.from("error Panic(uint256)");const r=T(this,si).get(e);return r||null}forEachError(e){const t=Array.from(T(this,si).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,si).get(s),r)}}_decodeParams(e,t){return T(this,Pn).decode(e,t)}_encodeParams(e,t){return T(this,Pn).encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return $(Vt(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);$(r,"unknown error","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return $(Vt(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){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=Vn(t);if(s.length%32===0)try{return T(this,Pn).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,t){const r=ct(e,"data"),s=yu.getBuiltinCallException("call",t,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 c=T(this,Pn).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:c},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(t);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const r=this.getFunction(e);$(r,"unknown function","fragment",e),e=r}return Ae(T(this,Pn).encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const i=this.getEvent(e);$(i,"unknown event","eventFragment",e),e=i}te(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?hl(o):i.type==="bytes"?Xt(Ae(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=_o(o):i.type.match(/^bytes/)?o=MJ(o,32):i.type==="address"&&T(this,Pn).encode(["address"],[o]),ol(Ae(o),32));for(t.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,t){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),$(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(hl(l));else if(o.type==="bytes")r.push(Xt(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Pn).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Pn).encode(s,i),topics:r}}decodeEventLog(e,t,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;$(Ct(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(An.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,Pn).decode(s,zt(r)):null,l=T(this,Pn).decode(i,t,!0),c=[],u=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new _I(null);else if(o[p])m=new _I(a[d++]);else try{m=a[d++]}catch(y){m=y}else try{m=l[f++]}catch(y){m=y}c.push(m),u.push(h.name||null)}),ou.fromItems(c,u)}parseTransaction(e){const t=ct(e.data,"tx.data"),r=Ce(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(Ae(t.slice(0,4)));if(!s)return null;const i=T(this,Pn).decode(s.inputs,t.slice(4));return new JX(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new QX(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=Ae(e),r=this.getError(Vt(t,0,4));if(!r)return null;const s=T(this,Pn).decode(r.inputs,Vt(t,4));return new qX(r,r.selector,s)}static from(e){return e instanceof Hl?e:typeof e=="string"?new Hl(JSON.parse(e)):typeof e.formatJson=="function"?new Hl(e.formatJson()):typeof e.format=="function"?new Hl(e.format("json")):new Hl(e)}};si=new WeakMap,ii=new WeakMap,oi=new WeakMap,Pn=new WeakMap,ai=new WeakSet,A0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,oi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,oi))o.split("(")[0]===e&&i.push(a);if(t){const o=t.length>0?t[t.length-1]:null;let a=t.length,l=!0;Nn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let c=i.length-1;c>=0;c--){const u=i[c].inputs.length;u!==a&&(!l||u!==a-1)&&i.splice(c,1)}for(let c=i.length-1;c>=0;c--){const u=i[c].inputs;for(let f=0;f<t.length;f++)if(Nn.isTyped(t[f])){if(f>=u.length){if(t[f].type==="overrides")continue;i.splice(c,1);break}if(t[f].type!==u[f].baseType){i.splice(c,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const o=t[t.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,oi).get(ei.from(e).format());return s||null},v0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,ii).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,ii))o.split("(")[0]===e&&i.push(a);if(t){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<t.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<t.length;l++)if(Nn.isTyped(t[l])&&t[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,ii).get(Zs.from(e).format());return s||null};let z1=Hl;const UI=BigInt(0);function bu(n){return n??null}function Wt(n){return n==null?null:n.toString()}class VI{constructor(e,t,r){W(this,"gasPrice");W(this,"maxFeePerGas");W(this,"maxPriorityFeePerGas");Me(this,{gasPrice:bu(e),maxFeePerGas:bu(t),maxPriorityFeePerGas:bu(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Wt(e),maxFeePerGas:Wt(t),maxPriorityFeePerGas:Wt(r)}}}function xy(n){const e={};n.to&&(e.to=n.to),n.from&&(e.from=n.from),n.data&&(e.data=Ae(n.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in n)||n[s]==null||(e[s]=Ce(n[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in n)||n[s]==null||(e[s]=Je(n[s],`request.${s}`));return n.accessList&&(e.accessList=$o(n.accessList)),"blockTag"in n&&(e.blockTag=n.blockTag),"enableCcipRead"in n&&(e.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(e.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(e.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(e.kzg=n.kzg),"blobs"in n&&n.blobs&&(e.blobs=n.blobs.map(s=>Zv(s)?Ae(s):Object.assign({},s))),e}class YX{constructor(e,t){W(this,"provider");W(this,"number");W(this,"hash");W(this,"timestamp");W(this,"parentHash");W(this,"parentBeaconBlockRoot");W(this,"nonce");W(this,"difficulty");W(this,"gasLimit");W(this,"gasUsed");W(this,"stateRoot");W(this,"receiptsRoot");W(this,"blobGasUsed");W(this,"excessBlobGas");W(this,"miner");W(this,"prevRandao");W(this,"extraData");W(this,"baseFeePerGas");q(this,eo);L(this,eo,e.transactions.map(r=>typeof r!="string"?new gh(r,t):r)),Me(this,{provider:t,hash:bu(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:bu(e.prevRandao),extraData:e.extraData,baseFeePerGas:bu(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,eo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,eo).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:t,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:y}=this;return{_type:"Block",baseFeePerGas:Wt(e),difficulty:Wt(t),extraData:r,gasLimit:Wt(s),gasUsed:Wt(i),blobGasUsed:Wt(this.blobGasUsed),excessBlobGas:Wt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:y}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>e<this.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,eo).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let t;if(typeof e=="number")t=T(this,eo)[e];else{const r=e.toLowerCase();for(const s of T(this,eo))if(typeof s=="string"){if(s!==r)continue;t=s;break}else{if(s.hash===r)continue;t=s;break}}if(t==null)throw new Error("no such tx");return typeof t=="string"?await this.provider.getTransaction(t):t}getPrefetchedTransaction(e){const t=this.prefetchedTransactions;if(typeof e=="number")return t[e];e=e.toLowerCase();for(const r of t)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 XX(this)}}eo=new WeakMap;class mh{constructor(e,t){W(this,"provider");W(this,"transactionHash");W(this,"blockHash");W(this,"blockNumber");W(this,"removed");W(this,"address");W(this,"data");W(this,"topics");W(this,"index");W(this,"transactionIndex");this.provider=t;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:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}=this;return{_type:"log",address:e,blockHash:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}}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 ZX(this)}}class HI{constructor(e,t){W(this,"provider");W(this,"to");W(this,"from");W(this,"contractAddress");W(this,"hash");W(this,"index");W(this,"blockHash");W(this,"blockNumber");W(this,"logsBloom");W(this,"gasUsed");W(this,"blobGasUsed");W(this,"cumulativeGasUsed");W(this,"gasPrice");W(this,"blobGasPrice");W(this,"type");W(this,"status");W(this,"root");q(this,Hh);L(this,Hh,Object.freeze(e.logs.map(s=>new mh(s,t))));let r=UI;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Me(this,{provider:t,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,Hh)}toJSON(){const{to:e,from:t,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:c,status:u,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:Wt(this.cumulativeGasUsed),from:t,gasPrice:Wt(this.gasPrice),blobGasUsed:Wt(this.blobGasUsed),blobGasPrice:Wt(this.blobGasPrice),gasUsed:Wt(this.gasUsed),hash:s,index:i,logs:c,logsBloom:l,root:f,status:u,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 $I(this)}reorderedEvent(e){return te(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),zI(this,e)}}Hh=new WeakMap;const vE=class vE{constructor(e,t){W(this,"provider");W(this,"blockNumber");W(this,"blockHash");W(this,"index");W(this,"hash");W(this,"type");W(this,"to");W(this,"from");W(this,"nonce");W(this,"gasLimit");W(this,"gasPrice");W(this,"maxPriorityFeePerGas");W(this,"maxFeePerGas");W(this,"maxFeePerBlobGas");W(this,"data");W(this,"value");W(this,"chainId");W(this,"signature");W(this,"accessList");W(this,"blobVersionedHashes");q(this,sa);this.provider=t,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,sa,-1)}toJSON(){const{blockNumber:e,blockHash:t,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:c,signature:u,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:t,blobVersionedHashes:d,chainId:Wt(this.chainId),data:c,from:a,gasLimit:Wt(this.gasLimit),gasPrice:Wt(this.gasPrice),hash:s,maxFeePerGas:Wt(this.maxFeePerGas),maxPriorityFeePerGas:Wt(this.maxPriorityFeePerGas),maxFeePerBlobGas:Wt(this.maxFeePerBlobGas),nonce:l,signature:u,to:o,index:r,type:i,value:Wt(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 t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:r}=await On({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:r-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const r=e??1,s=t??0;let i=T(this,sa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await On({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,sa)&&(o=T(this,sa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const y of m)if(y===this.hash)return;for(let y=0;y<m.length;y++){const b=await m.getTransaction(y);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===UI&&(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++}},c=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})},u=await this.provider.getTransactionReceipt(this.hash);if(r===0)return c(u);if(u){if(await u.confirmations()>=r)return c(u)}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(Mt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(b)})}const y=async b=>{if(await b.confirmations()>=r){m();try{d(c(b))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,y)}),this.provider.on(this.hash,y),i>=0){const b=async()=>{try{await l()}catch(v){if(dn(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()"}),$I(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()"}),zI(this,e)}replaceableTransaction(e){$(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new vE(this,this.provider);return L(t,sa,e),t}};sa=new WeakMap;let gh=vE;function XX(n){return{orphan:"drop-block",hash:n.hash,number:n.number}}function zI(n,e){return{orphan:"reorder-transaction",tx:n,other:e}}function $I(n){return{orphan:"drop-transaction",tx:n}}function ZX(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}class $1 extends mh{constructor(t,r,s){super(t,t.provider);W(this,"interface");W(this,"fragment");W(this,"args");const i=r.decodeEventLog(s,t.data,t.topics);Me(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class GI extends mh{constructor(t,r){super(t,t.provider);W(this,"error");Me(this,{error:r})}}class eZ extends HI{constructor(t,r,s){super(s,r);q(this,sf);L(this,sf,t)}get logs(){return super.logs.map(t=>{const r=t.topics.length?T(this,sf).getEvent(t.topics[0]):null;if(r)try{return new $1(t,T(this,sf),r)}catch(s){return new GI(t,s)}return t})}}sf=new WeakMap;class G1 extends gh{constructor(t,r,s){super(s,r);q(this,zh);L(this,zh,t)}async wait(t,r){const s=await super.wait(t,r);return s==null?null:new eZ(T(this,zh),this.provider,s)}}zh=new WeakMap;class WI extends CP{constructor(t,r,s,i){super(t,r,s);W(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 tZ extends WI{constructor(e,t,r,s,i){super(e,t,r,new $1(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 KI=BigInt(0);function QI(n){return n&&typeof n.call=="function"}function JI(n){return n&&typeof n.estimateGas=="function"}function Ey(n){return n&&typeof n.resolveName=="function"}function qI(n){return n&&typeof n.sendTransaction=="function"}function YI(n){if(n!=null){if(Ey(n))return n;if(n.provider)return n.provider}}class nZ{constructor(e,t,r){q(this,$h);W(this,"fragment");if(Me(this,{fragment:t}),t.inputs.length<r.length)throw new Error("too many arguments");const s=wl(e.runner,"resolveName"),i=Ey(s)?s:null;L(this,$h,async function(){const o=await Promise.all(t.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(u,f)=>u==="address"?Array.isArray(f)?Promise.all(f.map(d=>Gn(d,i))):Gn(f,i):f)));return e.interface.encodeFilterTopics(t,o)}())}getTopicFilter(){return T(this,$h)}}$h=new WeakMap;function wl(n,e){return n==null?null:typeof n[e]=="function"?n:n.provider&&typeof n.provider[e]=="function"?n.provider:null}function Al(n){return n==null?null:n.provider||null}async function XI(n,e){const t=Nn.dereference(n,"overrides");$(typeof t=="object","invalid overrides parameter","overrides",n);const r=xy(t);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 rZ(n,e,t){const r=wl(n,"resolveName"),s=Ey(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(t[o],(a,l)=>(l=Nn.dereference(l,a),a==="address"?Gn(l,s):l))))}function sZ(n){const e=async function(o){const a=await XI(o,["data"]);a.to=await n.getAddress(),a.from&&(a.from=await Gn(a.from,YI(n.runner)));const l=n.interface,c=Ce(a.value||KI,"overrides.value")===KI,u=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!u&&!c&&$(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),$(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return $(f||c,"cannot send value to non-payable fallback","overrides.value",a.value),$(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data),a},t=async function(o){const a=wl(n.runner,"call");te(QI(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(c){throw Xv(c)&&c.data?n.interface.makeError(c.data,l):c}},r=async function(o){const a=n.runner;te(qI(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),c=Al(n.runner);return new G1(n.interface,c,l)},s=async function(o){const a=wl(n.runner,"estimateGas");return te(JI(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:n,estimateGas:s,populateTransaction:e,send:r,staticCall:t}),i}function iZ(n,e){const t=function(...c){const u=n.interface.getFunction(e,c);return te(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:c}}),u},r=async function(...c){const u=t(...c);let f={};if(u.inputs.length+1===c.length&&(f=await XI(c.pop()),f.from&&(f.from=await Gn(f.from,YI(n.runner)))),u.inputs.length!==c.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await rZ(n.runner,u.inputs,c);return Object.assign({},f,await On({to:n.getAddress(),data:n.interface.encodeFunctionData(u,d)}))},s=async function(...c){const u=await a(...c);return u.length===1?u[0]:u},i=async function(...c){const u=n.runner;te(qI(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await u.sendTransaction(await r(...c)),d=Al(n.runner);return new G1(n.interface,d,f)},o=async function(...c){const u=wl(n.runner,"estimateGas");return te(JI(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await r(...c))},a=async function(...c){const u=wl(n.runner,"call");te(QI(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...c);let d="0x";try{d=await u.call(f)}catch(p){throw Xv(p)&&p.data?n.interface.makeError(p.data,f):p}const h=t(...c);return n.interface.decodeFunctionResult(h,d)},l=async(...c)=>t(...c).constant?await s(...c):await i(...c);return Me(l,{name:n.interface.getFunctionName(e),_contract:n,_key:e,getFragment:t,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const c=n.interface.getFunction(e);return te(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),c}}),l}function oZ(n,e){const t=function(...s){const i=n.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 nZ(n,t(...s),s)};return Me(r,{name:n.interface.getEventName(e),_contract:n,_key:e,getFragment:t}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=n.interface.getEvent(e);return te(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const Cy=Symbol.for("_ethersInternal_contract"),ZI=new WeakMap;function aZ(n,e){ZI.set(n[Cy],e)}function Tr(n){return ZI.get(n[Cy])}function lZ(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}async function W1(n,e){let t,r=null;if(Array.isArray(e)){const i=function(o){if(Ct(o,32))return o;const a=n.interface.getEvent(o);return $(a,"unknown fragment","name",o),a.topicHash};t=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?t=[null]:typeof e=="string"?Ct(e,32)?t=[e]:(r=n.interface.getEvent(e),$(r,"unknown fragment","event",e),t=[r.topicHash]):lZ(e)?t=await e.getTopicFilter():"fragment"in e?(r=e.fragment,t=[r.topicHash]):$(!1,"unknown event name","event",e);t=t.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=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:t}}async function yh(n,e){const{subs:t}=Tr(n);return t.get((await W1(n,e)).tag)||null}async function eL(n,e,t){const r=Al(n.runner);te(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await W1(n,t),{addr:a,subs:l}=Tr(n);let c=l.get(i);if(!c){const f={address:a||n,topics:o},d=y=>{let b=s;if(b==null)try{b=n.interface.getEvent(y.topics[0])}catch{}if(b){const v=b,A=s?n.interface.decodeEventLog(s,y.data,y.topics):[];Q1(n,t,A,w=>new tZ(n,w,t,v,y))}else Q1(n,t,[],v=>new WI(n,v,t,y))};let h=[];c={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let y=h;h=[],await Promise.all(y),r.off(f,d)}},l.set(i,c)}return c}let K1=Promise.resolve();async function cZ(n,e,t,r){await K1;const s=await yh(n,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(t);r&&l.push(r(a?null:o));try{o.call(n,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Tr(n).subs.delete(s.tag)),i>0}async function Q1(n,e,t,r){try{await K1}catch{}const s=cZ(n,e,t,r);return K1=s,await s}const ky=["then"];rF=Cy;const Gh=class Gh{constructor(e,t,r,s){W(this,"target");W(this,"interface");W(this,"runner");W(this,"filters");W(this,rF);W(this,"fallback");$(typeof e=="string"||ID(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=z1.from(t);Me(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,Cy,{value:{}});let o,a=null,l=null;if(s){const f=Al(r);l=new G1(this.interface,f,s)}let c=new Map;if(typeof e=="string")if(Ct(e))a=e,o=Promise.resolve(e);else{const f=wl(r,"resolveName");if(!Ey(f))throw Mt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Mt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Tr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Tr(this).addr=f,f});aZ(this,{addrPromise:o,addr:a,deployTx:l,subs:c});const u=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>ky.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Me(this,{filters:u}),Me(this,{fallback:i.receive||i.fallback?sZ(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||ky.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Gh(this.target,this.interface,e)}attach(e){return new Gh(e,this.interface,this.runner)}async getAddress(){return await Tr(this).addrPromise}async getDeployedCode(){const e=Al(this.runner);te(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=Al(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 Tr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),iZ(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),oZ(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,r){t==null&&(t=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Tr(this),o=s||await i,{fragment:a,topics:l}=await W1(this,e),c={address:o,topics:l,fromBlock:t,toBlock:r},u=Al(this.runner);return te(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(c)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new $1(f,this.interface,d)}catch(h){return new GI(f,h)}return new mh(f,u)})}async on(e,t){const r=await eL(this,"on",e);return r.listeners.push({listener:t,once:!1}),r.start(),this}async once(e,t){const r=await eL(this,"once",e);return r.listeners.push({listener:t,once:!0}),r.start(),this}async emit(e,...t){return await Q1(this,e,t,null)}async listenerCount(e){if(e){const s=await yh(this,e);return s?s.listeners.length:0}const{subs:t}=Tr(this);let r=0;for(const{listeners:s}of t.values())r+=s.length;return r}async listeners(e){if(e){const s=await yh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:t}=Tr(this);let r=[];for(const{listeners:s}of t.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,t){const r=await yh(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(t==null||r.listeners.length===0)&&(r.stop(),Tr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const t=await yh(this,e);if(!t)return this;t.stop(),Tr(this).subs.delete(t.tag)}else{const{subs:t}=Tr(this);for(const{tag:r,stop:s}of t.values())s(),t.delete(r)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends Gh{constructor(s,i=null){super(s,e,i)}}return t}static from(e,t,r){return r==null&&(r=null),new this(e,t,r)}};let J1=Gh;function uZ(){return J1}class wu extends uZ(){}function q1(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):$(!1,"unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}class fZ{constructor(e){W(this,"name");Me(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,t){throw new Error("unsupported coin")}async decodeAddress(e,t){throw new Error("unsupported coin")}}const tL=new RegExp("^(ipfs)://(.*)$","i"),nL=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),tL,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],of=class of{constructor(e,t,r){q(this,oa);W(this,"provider");W(this,"address");W(this,"name");q(this,ia);q(this,zl);Me(this,{provider:e,address:t,name:r}),L(this,ia,null),L(this,zl,new wu(t,["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,ia)==null&&L(this,ia,(async()=>{try{return await T(this,zl).supportsInterface("0x9061b923")}catch(e){if(dn(e,"CALL_EXCEPTION"))return!1;throw L(this,ia,null),e}})()),await T(this,ia)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await fe(this,oa,Of).call(this,"addr(bytes32)");return i==null||i===sh?null:i}catch(i){if(dn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[i]);if(Ct(o,20))return pt(o)}let t=null;for(const i of this.provider.plugins)if(i instanceof fZ&&i.supportsCoinType(e)){t=i;break}if(t==null)return null;const r=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await t.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 t=await fe(this,oa,Of).call(this,"text(bytes32,string)",[e]);return t==null||t==="0x"?null:t}async getContentHash(){const e=await fe(this,oa,Of).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const t=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const s=t[1]==="e3010170"?"ipfs":"ipns",i=parseInt(t[4],16);if(t[5].length===i*2)return`${s}://${DJ("0x"+t[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 t=await this.getText("avatar");if(t==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:t});for(let r=0;r<nL.length;r++){const s=t.match(nL[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:t}),{linkage:e,url:t};case"ipfs":{const o=q1(t);return e.push({type:"ipfs",value:t}),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:t});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 c=l[1],u=new wu(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 u.ownerOf(c);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 u.balanceOf(a,c);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await u[o](c);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}",_o(c,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=q1(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new zn(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(tL)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=q1(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const t=await e.getNetwork(),r=t.getPlugin("org.ethers.plugins.network.Ens");return te(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:t}}),r.address}static async fromName(e,t){var s;let r=t;for(;;){if(r===""||r==="."||t!=="eth"&&r==="eth")return null;const i=await fe(s=of,p0,uF).call(s,e,r);if(i!=null){const o=new of(e,i,t);return r!==t&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};ia=new WeakMap,zl=new WeakMap,oa=new WeakSet,Of=async function(e,t){t=(t||[]).slice();const r=T(this,zl).interface;t.unshift(I1(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),te(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[dX(this.name,255),r.encodeFunctionData(s,t)],e="resolve(bytes,bytes)"),t.push({enableCcipRead:!0});try{const i=await T(this,zl)[e](...t);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!dn(i,"CALL_EXCEPTION"))throw i}return null},p0=new WeakSet,uF=async function(e,t){const r=await of.getEnsAddress(e);try{const i=await new wu(r,["function resolver(bytes32) view returns (address)"],e).resolver(I1(t),{enableCcipRead:!0});return i===sh?null:i}catch(s){throw s}return null},q(of,p0);let Sy=of;const rL=BigInt(0);function at(n,e){return function(t){return t==null?e:n(t)}}function Ty(n,e){return t=>{if(e&&t==null)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map(r=>n(r))}}function bh(n,e){return t=>{const r={};for(const s in n){let i=s;if(e&&s in e&&!(i in t)){for(const o of e[s])if(o in t){i=o;break}}try{const o=n[s](t[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:t})}}return r}}function dZ(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}$(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}function Au(n){return $(Ct(n,!0),"invalid data","value",n),n}function vn(n){return $(Ct(n,32),"invalid hash","value",n),n}const hZ=bh({address:pt,blockHash:vn,blockNumber:Je,data:Au,index:Je,removed:at(dZ,!1),topics:Ty(vn),transactionHash:vn,transactionIndex:Je},{index:["logIndex"]});function pZ(n){return hZ(n)}const mZ=bh({hash:at(vn),parentHash:vn,parentBeaconBlockRoot:at(vn,null),number:Je,timestamp:Je,nonce:at(Au),difficulty:Ce,gasLimit:Ce,gasUsed:Ce,stateRoot:at(vn,null),receiptsRoot:at(vn,null),blobGasUsed:at(Ce,null),excessBlobGas:at(Ce,null),miner:at(pt),prevRandao:at(vn,null),extraData:Au,baseFeePerGas:at(Ce)},{prevRandao:["mixHash"]});function gZ(n){const e=mZ(n);return e.transactions=n.transactions.map(t=>typeof t=="string"?t:sL(t)),e}const yZ=bh({transactionIndex:Je,blockNumber:Je,transactionHash:vn,address:pt,topics:Ty(vn),data:Au,index:Je,blockHash:vn},{index:["logIndex"]});function bZ(n){return yZ(n)}const wZ=bh({to:at(pt,null),from:at(pt,null),contractAddress:at(pt,null),index:Je,root:at(Ae),gasUsed:Ce,blobGasUsed:at(Ce,null),logsBloom:at(Au),blockHash:vn,hash:vn,logs:Ty(bZ),blockNumber:Je,cumulativeGasUsed:Ce,effectiveGasPrice:at(Ce),blobGasPrice:at(Ce,null),status:at(Je),type:at(Je,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function AZ(n){return wZ(n)}function sL(n){n.to&&Ce(n.to)===rL&&(n.to="0x0000000000000000000000000000000000000000");const e=bh({hash:vn,index:at(Je,void 0),type:t=>t==="0x"||t==null?0:Je(t),accessList:at($o,null),blobVersionedHashes:at(Ty(vn,!0),null),blockHash:at(vn,null),blockNumber:at(Je,null),transactionIndex:at(Je,null),from:pt,gasPrice:at(Ce),maxPriorityFeePerGas:at(Ce),maxFeePerGas:at(Ce),maxFeePerBlobGas:at(Ce,null),gasLimit:Ce,to:at(pt,null),value:Ce,nonce:Je,data:Au,creates:at(pt,null),chainId:at(Ce,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(e.to==null&&e.creates==null&&(e.creates=pY(e)),(n.type===1||n.type===2)&&n.accessList==null&&(e.accessList=[]),n.signature?e.signature=ws.from(n.signature):e.signature=ws.from(n),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&Ce(e.blockHash)===rL&&(e.blockHash=null),e}const vZ="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class wh{constructor(e){W(this,"name");Me(this,{name:e})}clone(){return new wh(this.name)}}class Oy extends wh{constructor(t,r){t==null&&(t=0);super(`org.ethers.network.plugins.GasCost#${t||0}`);W(this,"effectiveBlock");W(this,"txBase");W(this,"txCreate");W(this,"txDataZero");W(this,"txDataNonzero");W(this,"txAccessListStorageKey");W(this,"txAccessListAddress");const s={effectiveBlock:t};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 Oy(this.effectiveBlock,this)}}class Ny extends wh{constructor(t,r){super("org.ethers.plugins.network.Ens");W(this,"address");W(this,"targetNetwork");Me(this,{address:t||vZ,targetNetwork:r??1})}clone(){return new Ny(this.address,this.targetNetwork)}}class xZ extends wh{constructor(t,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");q(this,Wh);q(this,Kh);L(this,Wh,t),L(this,Kh,r)}get url(){return T(this,Wh)}get processFunc(){return T(this,Kh)}clone(){return this}}Wh=new WeakMap,Kh=new WeakMap;const Y1=new Map,cf=class cf{constructor(e,t){q(this,af);q(this,lf);q(this,aa);L(this,af,e),L(this,lf,Ce(t)),L(this,aa,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,af)}set name(e){L(this,af,e)}get chainId(){return T(this,lf)}set chainId(e){L(this,lf,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,aa).values())}attachPlugin(e){if(T(this,aa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,aa).set(e.name,e.clone()),this}getPlugin(e){return T(this,aa).get(e)||null}getPlugins(e){return this.plugins.filter(t=>t.name.split("#")[0]===e)}clone(){const e=new cf(this.name,this.chainId);return this.plugins.forEach(t=>{e.attachPlugin(t.clone())}),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new Oy;let r=t.txBase;if(e.to==null&&(r+=t.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=t.txDataZero:r+=t.txDataNonzero;if(e.accessList){const s=$o(e.accessList);for(const i in s)r+=t.txAccessListAddress+t.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(EZ(),e==null)return cf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=Y1.get(e);if(t)return t();if(typeof e=="bigint")return new cf("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 t=new cf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new Ny(e.ensAddress,e.ensNetwork)),t}$(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const r=Y1.get(e);r&&$(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),Y1.set(e,t)}};af=new WeakMap,lf=new WeakMap,aa=new WeakMap;let tn=cf;function iL(n,e){const t=String(n);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${n}`);const r=t.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${n}`);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 oL(n){return new xZ(n,async(e,t,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:iL(a.maxFee,9),maxPriorityFeePerGas:iL(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 aL=!1;function EZ(){if(aL)return;aL=!0;function n(e,t,r){const s=function(){const i=new tn(e,t);return r.ensNetwork!=null&&i.attachPlugin(new Ny(null,r.ensNetwork)),i.attachPlugin(new Oy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};tn.register(e,s),tn.register(t,s),r.altNames&&r.altNames.forEach(i=>{tn.register(i,s)})}n("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),n("ropsten",3,{ensNetwork:3}),n("rinkeby",4,{ensNetwork:4}),n("goerli",5,{ensNetwork:5}),n("kovan",42,{ensNetwork:42}),n("sepolia",11155111,{ensNetwork:11155111}),n("holesky",17e3,{ensNetwork:17e3}),n("classic",61,{}),n("classicKotti",6,{}),n("arbitrum",42161,{ensNetwork:1}),n("arbitrum-goerli",421613,{}),n("arbitrum-sepolia",421614,{}),n("base",8453,{ensNetwork:1}),n("base-goerli",84531,{}),n("base-sepolia",84532,{}),n("bnb",56,{ensNetwork:1}),n("bnbt",97,{}),n("linea",59144,{ensNetwork:1}),n("linea-goerli",59140,{}),n("linea-sepolia",59141,{}),n("matic",137,{ensNetwork:1,plugins:[oL("https://gasstation.polygon.technology/v2")]}),n("matic-amoy",80002,{}),n("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[oL("https://gasstation-testnet.polygon.technology/v2")]}),n("optimism",10,{ensNetwork:1,plugins:[]}),n("optimism-goerli",420,{}),n("optimism-sepolia",11155420,{}),n("xdai",100,{ensNetwork:1})}function X1(n){return JSON.parse(JSON.stringify(n))}class CZ{constructor(e){q(this,uf);q(this,to);q(this,Xr);q(this,la);q(this,li);L(this,to,e),L(this,Xr,null),L(this,la,4e3),L(this,li,-2)}get pollingInterval(){return T(this,la)}set pollingInterval(e){L(this,la,e)}start(){T(this,Xr)||(L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la))),fe(this,uf,x0).call(this))}stop(){T(this,Xr)&&(T(this,to)._clearTimeout(T(this,Xr)),L(this,Xr,null))}pause(e){this.stop(),e&&L(this,li,-2)}resume(){this.start()}}to=new WeakMap,Xr=new WeakMap,la=new WeakMap,li=new WeakMap,uf=new WeakSet,x0=async function(){try{const e=await T(this,to).getBlockNumber();if(T(this,li)===-2){L(this,li,e);return}if(e!==T(this,li)){for(let t=T(this,li)+1;t<=e;t++){if(T(this,Xr)==null)return;await T(this,to).emit("block",t)}L(this,li,e)}}catch{}T(this,Xr)!=null&&L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la)))};class Z1{constructor(e){q(this,$l);q(this,Gl);q(this,ca);L(this,$l,e),L(this,ca,!1),L(this,Gl,t=>{this._poll(t,T(this,$l))})}async _poll(e,t){throw new Error("sub-classes must override this")}start(){T(this,ca)||(L(this,ca,!0),T(this,Gl).call(this,-2),T(this,$l).on("block",T(this,Gl)))}stop(){T(this,ca)&&(L(this,ca,!1),T(this,$l).off("block",T(this,Gl)))}pause(e){this.stop()}resume(){this.start()}}$l=new WeakMap,Gl=new WeakMap,ca=new WeakMap;class kZ extends Z1{constructor(t,r){super(t);q(this,ff);q(this,no);L(this,ff,r),L(this,no,-2)}pause(t){t&&L(this,no,-2),super.pause(t)}async _poll(t,r){const s=await r.getBlock(T(this,ff));s!=null&&(T(this,no)===-2?L(this,no,s.number):s.number>T(this,no)&&(r.emit(T(this,ff),s.number),L(this,no,s.number)))}}ff=new WeakMap,no=new WeakMap;class SZ extends Z1{constructor(t,r){super(t);q(this,m0);L(this,m0,X1(r))}async _poll(t,r){throw new Error("@TODO")}}m0=new WeakMap;class TZ extends Z1{constructor(t,r){super(t);q(this,df);L(this,df,r)}async _poll(t,r){const s=await r.getTransactionReceipt(T(this,df));s&&r.emit(T(this,df),s)}}df=new WeakMap;class ex{constructor(e,t){q(this,g0);q(this,ro);q(this,hf);q(this,pf);q(this,ua);q(this,Zr);L(this,ro,e),L(this,hf,X1(t)),L(this,pf,fe(this,g0,fF).bind(this)),L(this,ua,!1),L(this,Zr,-2)}start(){T(this,ua)||(L(this,ua,!0),T(this,Zr)===-2&&T(this,ro).getBlockNumber().then(e=>{L(this,Zr,e)}),T(this,ro).on("block",T(this,pf)))}stop(){T(this,ua)&&(L(this,ua,!1),T(this,ro).off("block",T(this,pf)))}pause(e){this.stop(),e&&L(this,Zr,-2)}resume(){this.start()}}ro=new WeakMap,hf=new WeakMap,pf=new WeakMap,ua=new WeakMap,Zr=new WeakMap,g0=new WeakSet,fF=async function(e){if(T(this,Zr)===-2)return;const t=X1(T(this,hf));t.fromBlock=T(this,Zr)+1,t.toBlock=e;const r=await T(this,ro).getLogs(t);if(r.length===0){T(this,Zr)<e-60&&L(this,Zr,e-60);return}for(const s of r)T(this,ro).emit(T(this,hf),s),L(this,Zr,s.blockNumber)};const OZ=BigInt(2),NZ=10;function My(n){return n&&typeof n.then=="function"}function Ry(n,e){return n+":"+JSON.stringify(e,(t,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 Py{constructor(e){W(this,"name");Me(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function MZ(n){return JSON.parse(JSON.stringify(n))}function tx(n){return n=Array.from(new Set(n).values()),n.sort(),n}async function nx(n,e){if(n==null)throw new Error("invalid event");if(Array.isArray(n)&&(n={topics:n}),typeof n=="string")switch(n){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:n,tag:n}}if(Ct(n,32)){const t=n.toLowerCase();return{type:"transaction",tag:Ry("tx",{hash:t}),hash:t}}if(n.orphan){const t=n;return{type:"orphan",tag:Ry("orphan",t),filter:MZ(t)}}if(n.address||n.topics){const t=n,r={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?tx(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(t.address){const s=[],i=[],o=a=>{Ct(a)?s.push(a):i.push((async()=>{s.push(await Gn(a,e))})())};Array.isArray(t.address)?t.address.forEach(o):o(t.address),i.length&&await Promise.all(i),r.address=tx(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Ry("event",r),type:"event"}}$(!1,"unknown ProviderEvent","event",n)}function rx(){return new Date().getTime()}const RZ={cacheTimeout:250,pollingInterval:4e3};class Dy{constructor(e,t){q(this,rt);q(this,Dn);q(this,fa);q(this,In);q(this,mf);q(this,Pr);q(this,Wl);q(this,da);q(this,so);q(this,Qh);q(this,es);q(this,gf);q(this,yf);if(L(this,yf,Object.assign({},RZ,t||{})),e==="any")L(this,Wl,!0),L(this,Pr,null);else if(e){const r=tn.from(e);L(this,Wl,!1),L(this,Pr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else L(this,Wl,!1),L(this,Pr,null);L(this,so,-1),L(this,da,new Map),L(this,Dn,new Map),L(this,fa,new Map),L(this,In,null),L(this,mf,!1),L(this,Qh,1),L(this,es,new Map),L(this,gf,!1)}get pollingInterval(){return T(this,yf).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,fa).values())}attachPlugin(e){if(T(this,fa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,fa).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,fa).get(e)||null}get disableCcipRead(){return T(this,gf)}set disableCcipRead(e){L(this,gf,!!e)}async ccipReadFetch(e,t,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],c=l.replace("{sender}",s).replace("{data}",i),u=new zn(c);l.indexOf("{data}")===-1&&(u.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:u,index:a,urls:r});let f="unknown error";const d=await u.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:u,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:u,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,t){return new YX(gZ(e),this)}_wrapLog(e,t){return new mh(pZ(e),this)}_wrapTransactionReceipt(e,t){return new HI(AZ(e),this)}_wrapTransactionResponse(e,t){return new gh(sL(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=Je(await fe(this,rt,Dr).call(this,{method:"getBlockNumber"}),"%response");return T(this,so)>=0&&L(this,so,e),e}_getAddress(e){return Gn(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(Ct(e))return Ct(e,32)?e:al(e);if(typeof e=="bigint"&&(e=Je(e,"blockTag")),typeof e=="number")return e>=0?al(e):T(this,so)>=0?al(T(this,so)+e):this.getBlockNumber().then(t=>al(t+e));$(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?tx(l.map(c=>c.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,c,u)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(c!=null||u!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),t.length&&(d.topics=t),c&&(d.fromBlock=c),u&&(d.toBlock=u),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 t=xy(e),r=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const i=Gn(t[s],this);My(i)?r.push(async function(){t[s]=await i}()):t[s]=i}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);My(s)?r.push(async function(){t.blockTag=await s}()):t.blockTag=s}return r.length?async function(){return await Promise.all(r),t}():t}async getNetwork(){if(T(this,Pr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Pr)===s&&L(this,Pr,null),i}})();return L(this,Pr,s),(await s).clone()}const e=T(this,Pr),[t,r]=await Promise.all([e,this._detectNetwork()]);return t.chainId!==r.chainId&&(T(this,Wl)?(this.emit("network",r,t),T(this,Pr)===e&&L(this,Pr,Promise.resolve(r))):te(!1,`network changed: ${t.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const e=await this.getNetwork(),t=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await On({_block:fe(this,rt,DE).call(this,"latest",!1),gasPrice:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getGasPrice"});return Ce(u,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getPriorityFee"});return Ce(u,"%response")}catch{}return null})()});let a=null,l=null;const c=this._wrapBlock(s,e);return c&&c.baseFeePerGas&&(l=o??BigInt("1000000000"),a=c.baseFeePerGas*OZ+l),new VI(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new zn(r.url),i=await r.processFunc(t,this,s);return new VI(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return My(t)&&(t=await t),Ce(await fe(this,rt,Dr).call(this,{method:"estimateGas",transaction:t}),"%response")}async call(e){const{tx:t,blockTag:r}=await On({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await fe(this,rt,PE).call(this,fe(this,rt,RE).call(this,t,r,e.enableCcipRead?0:-1))}async getBalance(e,t){return Ce(await fe(this,rt,ep).call(this,{method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return Je(await fe(this,rt,ep).call(this,{method:"getTransactionCount"},e,t),"%response")}async getCode(e,t){return Ae(await fe(this,rt,ep).call(this,{method:"getCode"},e,t))}async getStorage(e,t,r){const s=Ce(t,"position");return Ae(await fe(this,rt,ep).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:t,hash:r,network:s}=await On({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=hh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(t)}async getBlock(e,t){const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,DE).call(this,e,!!t)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,t)}async getTransactionReceipt(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await fe(this,rt,Dr).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,t)}async getTransactionResult(e){const{result:t}=await On({network:this.getNetwork(),result:fe(this,rt,Dr).call(this,{method:"getTransactionResult",hash:e})});return t==null?null:Ae(t)}async getLogs(e){let t=this._getFilter(e);My(t)&&(t=await t);const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getLogs",filter:t})});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 Sy.fromName(this,e)}async getAvatar(e){const t=await this.getResolver(e);return t?await t.getAvatar():null}async resolveName(e){const t=await this.getResolver(e);return t?await t.getAddress():null}async lookupAddress(e){e=pt(e);const t=I1(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await Sy.getEnsAddress(this),i=await new wu(r,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(i==null||i===sh)return null;const a=await new wu(i,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(a)!==e?null:a}catch(r){if(dn(r,"BAD_DATA")&&r.value==="0x"||dn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,t,r){const s=t??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async c=>{try{const u=await this.getTransactionReceipt(e);if(u!=null&&c-u.blockNumber+1>=s){i(u),a&&(clearTimeout(a),a=null);return}}catch(u){console.log("EEE",u)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(Mt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){te(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const t=T(this,es).get(e);t&&(t.timer&&clearTimeout(t.timer),T(this,es).delete(e))}_setTimeout(e,t){t==null&&(t=0);const r=Xh(this,Qh)._++,s=()=>{T(this,es).delete(r),e()};if(this.paused)T(this,es).set(r,{timer:null,func:s,time:t});else{const i=setTimeout(s,t);T(this,es).set(r,{timer:i,func:s,time:rx()})}return r}_forEachSubscriber(e){for(const t of T(this,Dn).values())e(t.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new Py(e.type);case"block":{const t=new CZ(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new kZ(this,e.type);case"event":return new ex(this,e.filter);case"transaction":return new TZ(this,e.hash);case"orphan":return new SZ(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,t){for(const r of T(this,Dn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=t,r.started&&t.start(),T(this,In)!=null&&t.pause(T(this,In));break}}async on(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async once(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async emit(e,...t){const r=await fe(this,rt,tp).call(this,e,t);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 CP(this,o?null:i,e);try{i.call(this,...t,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.length:0}let t=0;for(const{listeners:r}of T(this,Dn).values())t+=r.length;return t}async listeners(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let t=[];for(const{listeners:r}of T(this,Dn).values())t=t.concat(r.map(({listener:s})=>s));return t}async off(e,t){const r=await fe(this,rt,tp).call(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(!t||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:t,started:r,subscriber:s}=await fe(this,rt,E0).call(this,e);r&&s.stop(),T(this,Dn).delete(t)}else for(const[t,{started:r,subscriber:s}]of T(this,Dn))r&&s.stop(),T(this,Dn).delete(t);return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return this.off(e,t)}get destroyed(){return T(this,mf)}destroy(){this.removeAllListeners();for(const e of T(this,es).keys())this._clearTimeout(e);L(this,mf,!0)}get paused(){return T(this,In)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(L(this,so,-1),T(this,In)!=null){if(T(this,In)==!!e)return;te(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(e)),L(this,In,!!e);for(const t of T(this,es).values())t.timer&&clearTimeout(t.timer),t.time=rx()-t.time}resume(){if(T(this,In)!=null){this._forEachSubscriber(e=>e.resume()),L(this,In,null);for(const e of T(this,es).values()){let t=e.time;t<0&&(t=0),e.time=rx(),setTimeout(e.func,t)}}}}Dn=new WeakMap,fa=new WeakMap,In=new WeakMap,mf=new WeakMap,Pr=new WeakMap,Wl=new WeakMap,da=new WeakMap,so=new WeakMap,Qh=new WeakMap,es=new WeakMap,gf=new WeakMap,yf=new WeakMap,rt=new WeakSet,Dr=async function(e){const t=T(this,yf).cacheTimeout;if(t<0)return await this._perform(e);const r=Ry(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)},t)),await s},RE=async function(e,t,r){te(r<NZ,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=xy(e);try{return Ae(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(i){if(!this.disableCcipRead&&Xv(i)&&i.data&&r>=0&&t==="latest"&&s.to!=null&&Vt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Gn(s.to,this);let l;try{l=BZ(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 c=await this.ccipReadFetch(s,l.calldata,l.urls);te(c!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const u={to:a,data:zt([l.selector,LZ([c,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:u});try{const f=await fe(this,rt,RE).call(this,u,t,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},u),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},u),error:f}),f}}throw i}},PE=async function(e){const{value:t}=await On({network:this.getNetwork(),value:e});return t},ep=async function(e,t,r){let s=this._getAddress(t),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await fe(this,rt,PE).call(this,fe(this,rt,Dr).call(this,Object.assign(e,{address:s,blockTag:i})))},DE=async function(e,t){if(Ct(e,32))return await fe(this,rt,Dr).call(this,{method:"getBlock",blockHash:e,includeTransactions:t});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await fe(this,rt,Dr).call(this,{method:"getBlock",blockTag:r,includeTransactions:t})},tp=async function(e,t){let r=await nx(e,this);return r.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(r=await nx({orphan:"drop-log",log:t[0]},this)),T(this,Dn).get(r.tag)||null},E0=async function(e){const t=await nx(e,this),r=t.tag;let s=T(this,Dn).get(r);return s||(s={subscriber:this._getSubscriber(t),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Dn).set(r,s)),s};function PZ(n,e){try{const t=sx(n,e);if(t)return iu(t)}catch{}return null}function sx(n,e){if(n==="0x")return null;try{const t=Je(Vt(n,e,e+32)),r=Je(Vt(n,t,t+32));return Vt(n,t+32,t+32+r)}catch{}return null}function lL(n){const e=Hn(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function DZ(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}const IZ=new Uint8Array([]);function LZ(n){const e=[];let t=0;for(let r=0;r<n.length;r++)e.push(IZ),t+=32;for(let r=0;r<n.length;r++){const s=ct(n[r]);e[r]=lL(t),e.push(lL(s.length)),e.push(DZ(s)),t+=32+Math.ceil(s.length/32)*32}return zt(e)}const cL="0x0000000000000000000000000000000000000000000000000000000000000000";function BZ(n){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};te(ru(n)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Vt(n,0,32);te(Vt(t,0,12)===Vt(cL,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Vt(t,12);try{const r=[],s=Je(Vt(n,32,64)),i=Je(Vt(n,s,s+32)),o=Vt(n,s+32);for(let a=0;a<i;a++){const l=PZ(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=sx(n,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(n,100,128)===Vt(cL,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Vt(n,96,100);try{const r=sx(n,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 vu(n,e){if(n.provider)return n.provider;te(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function uL(n,e){let t=xy(e);if(t.to!=null&&(t.to=Gn(t.to,n)),t.from!=null){const r=t.from;t.from=Promise.all([n.getAddress(),Gn(r,n)]).then(([s,i])=>($(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else t.from=n.getAddress();return await On(t)}class _Z{constructor(e){W(this,"provider");Me(this,{provider:e||null})}async getNonce(e){return vu(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await uL(this,e)}async populateTransaction(e){const t=vu(this,"populateTransaction"),r=await uL(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 t.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 t.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 On(r)}async estimateGas(e){return vu(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return vu(this,"call").call(await this.populateCall(e))}async resolveName(e){return await vu(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=vu(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=hh.from(r);return await t.broadcastTransaction(await this.signTransaction(s))}}const fL=new Set;function xu(n){fL.has(n)||(fL.add(n),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${n} (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 FZ(n){return JSON.parse(JSON.stringify(n))}class dL{constructor(e){q(this,pa);q(this,Kn);q(this,ci);q(this,Kl);q(this,ha);q(this,Ql);q(this,bf);L(this,Kn,e),L(this,ci,null),L(this,Kl,fe(this,pa,IE).bind(this)),L(this,ha,!1),L(this,Ql,null),L(this,bf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,ha)||(L(this,ha,!0),fe(this,pa,IE).call(this,-2))}stop(){T(this,ha)&&(L(this,ha,!1),L(this,bf,!0),fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Kl)))}pause(e){e&&fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Kl))}resume(){this.start()}}Kn=new WeakMap,ci=new WeakMap,Kl=new WeakMap,ha=new WeakMap,Ql=new WeakMap,bf=new WeakMap,pa=new WeakSet,IE=async function(e){try{T(this,ci)==null&&L(this,ci,this._subscribe(T(this,Kn)));let t=null;try{t=await T(this,ci)}catch(i){if(!dn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(t==null){L(this,ci,null),T(this,Kn)._recoverSubscriber(this,this._recover(T(this,Kn)));return}const r=await T(this,Kn).getNetwork();if(T(this,Ql)||L(this,Ql,r),T(this,Ql).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,bf))return;const s=await T(this,Kn).send("eth_getFilterChanges",[t]);await this._emitResults(T(this,Kn),s)}catch(t){console.log("@TODO",t)}T(this,Kn).once("block",T(this,Kl))},LE=function(){const e=T(this,ci);e&&(L(this,ci,null),e.then(t=>{T(this,Kn).destroyed||T(this,Kn).send("eth_uninstallFilter",[t])}))};class jZ extends dL{constructor(t,r){super(t);q(this,Jl);L(this,Jl,FZ(r))}_recover(t){return new ex(t,T(this,Jl))}async _subscribe(t){return await t.send("eth_newFilter",[T(this,Jl)])}async _emitResults(t,r){for(const s of r)t.emit(T(this,Jl),t._wrapLog(s,t._network))}}Jl=new WeakMap;class UZ extends dL{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const r of t)e.emit("pending",r)}}const VZ="bigint,boolean,function,number,string,symbol".split(/,/g);function Iy(n){if(n==null||VZ.indexOf(typeof n)>=0||typeof n.getAddress=="function")return n;if(Array.isArray(n))return n.map(Iy);if(typeof n=="object")return Object.keys(n).reduce((e,t)=>(e[t]=n[t],e),{});throw new Error(`should not happen: ${n} (${typeof n})`)}function HZ(n){return new Promise(e=>{setTimeout(e,n)})}function Eu(n){return n&&n.toLowerCase()}function hL(n){return n&&typeof n.pollingInterval=="number"}const pL={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class ix extends _Z{constructor(t,r){super(t);W(this,"address");r=pt(r),Me(this,{address:r})}connect(t){te(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const r=Iy(t),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Gn(o,this.provider);$(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),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 Gn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(t);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const c=async()=>{try{const u=await this.provider.getTransaction(s);if(u!=null){i(u.replaceableTransaction(r));return}}catch(u){if(dn(u,"CANCELLED")||dn(u,"BAD_DATA")||dn(u,"NETWORK_ERROR")){u.info==null&&(u.info={}),u.info.sendTransactionHash=s,o(u);return}if(dn(u,"INVALID_ARGUMENT")&&(l++,u.info==null&&(u.info={}),u.info.sendTransactionHash=s,l>10)){o(u);return}this.provider.emit("error",Mt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{c()},a.pop()||4e3)};c()})}async signTransaction(t){const r=Iy(t);if(r.from){const i=await Gn(r.from,this.provider);$(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("personal_sign",[Ae(r),this.address.toLowerCase()])}async signTypedData(t,r,s){const i=Iy(s),o=await wy.resolveNames(t,r,i,async a=>{const l=await Gn(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(wy.getPayload(o.domain,r,o.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ae(r)])}}class mL extends Dy{constructor(t,r){super(t,r);q(this,Jh);q(this,ql);q(this,wf);q(this,io);q(this,ui);q(this,Ss);q(this,ts);q(this,ur);L(this,wf,1),L(this,ql,Object.assign({},pL,r||{})),L(this,io,[]),L(this,ui,null),L(this,ts,null),L(this,ur,null);{let i=null;const o=new Promise(a=>{i=a});L(this,Ss,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?($(!s||t!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&t!=null&&L(this,ts,tn.from(t))):s&&($(t==null||s.matches(t),"staticNetwork MUST match network object","options",r),L(this,ts,s))}_getOption(t){return T(this,ql)[t]}get _network(){return te(T(this,ts),"network is not available yet","NETWORK_ERROR"),T(this,ts)}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let s=t.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&&(t=Object.assign({},t,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(t);return r!=null?await this.send(r.method,r.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)if(t===!0){if(T(this,ts))return T(this,ts)}else return t;return T(this,ur)?await T(this,ur):this.ready?(L(this,ur,(async()=>{try{const r=tn.from(Ce(await this.send("eth_chainId",[])));return L(this,ur,null),r}catch(r){throw L(this,ur,null),r}})()),await T(this,ur)):(L(this,ur,(async()=>{const r={id:Xh(this,wf)._++,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,ur,null)}catch(i){throw L(this,ur,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return tn.from(Ce(s.result));throw this.getRpcError(r,s)})()),await T(this,ur))}_start(){T(this,Ss)==null||T(this,Ss).resolve==null||(T(this,Ss).resolve(),L(this,Ss,null),(async()=>{for(;T(this,ts)==null&&!this.destroyed;)try{L(this,ts,await this._detectNetwork())}catch(t){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",Mt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await HZ(1e3)}fe(this,Jh,BE).call(this)})())}async _waitUntilReady(){if(T(this,Ss)!=null)return await T(this,Ss).promise}_getSubscriber(t){return t.type==="pending"?new UZ(this):t.type==="event"?this._getOption("polling")?new ex(this,t.filter):new jZ(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new Py("orphan"):super._getSubscriber(t)}get ready(){return T(this,Ss)==null}getRpcTransaction(t){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(t[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=al(Ce(t[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{t[s]!=null&&(r[s]=Ae(t[s]))}),t.accessList&&(r.accessList=$o(t.accessList)),t.blobVersionedHashes&&(r.blobVersionedHashes=t.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(t){switch(t.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:[Eu(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Eu(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[Eu(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Eu(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(Eu):t.filter.address=Eu(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,r){const{method:s}=t,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return Mt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=ox(i),c=yu.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",t.params[0],l?l.data:null);return c.info={error:i,payload:t},c}const o=JSON.stringify($Z(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Mt("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:t,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=t.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Mt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Mt("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Mt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return Mt("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?Mt("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):Mt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,r){if(this.destroyed)return Promise.reject(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const s=Xh(this,wf)._++,i=new Promise((o,a)=>{T(this,io).push({resolve:o,reject:a,payload:{method:t,params:r,id:s,jsonrpc:"2.0"}})});return fe(this,Jh,BE).call(this),i}async getSigner(t){t==null&&(t=0);const r=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await r;if(t>=i.length)throw new Error("no such account");return new ix(this,i[t])}const{accounts:s}=await On({network:this.getNetwork(),accounts:r});t=pt(t);for(const i of s)if(pt(i)===t)return new ix(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new ix(this,r))}destroy(){T(this,ui)&&(clearTimeout(T(this,ui)),L(this,ui,null));for(const{payload:t,reject:r}of T(this,io))r(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));L(this,io,[]),super.destroy()}}ql=new WeakMap,wf=new WeakMap,io=new WeakMap,ui=new WeakMap,Ss=new WeakMap,ts=new WeakMap,ur=new WeakMap,Jh=new WeakSet,BE=function(){if(T(this,ui))return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");L(this,ui,setTimeout(()=>{L(this,ui,null);const r=T(this,io);for(L(this,io,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,ql).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,ql).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:c}of s){if(this.destroyed){l(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:c.method}));continue}const u=o.filter(f=>f.id===c.id)[0];if(u==null){const f=Mt("missing response for request","BAD_DATA",{value:o,info:{payload:c}});this.emit("error",f),l(f);continue}if("error"in u){l(this.getRpcError(c,u));continue}a(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},t))};class zZ extends mL{constructor(t,r){super(t,r);q(this,ma);let s=this._getOption("pollingInterval");s==null&&(s=pL.pollingInterval),L(this,ma,s)}_getSubscriber(t){const r=super._getSubscriber(t);return hL(r)&&(r.pollingInterval=T(this,ma)),r}get pollingInterval(){return T(this,ma)}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");L(this,ma,t),this._forEachSubscriber(r=>{hL(r)&&(r.pollingInterval=T(this,ma))})}}ma=new WeakMap;class Fi extends zZ{constructor(t,r,s){t==null&&(t="http://localhost:8545");super(r,s);q(this,Af);typeof t=="string"?L(this,Af,new zn(t)):L(this,Af,t.clone())}_getConnection(){return T(this,Af).clone()}async send(t,r){return await this._start(),await super.send(t,r)}async _send(t){const r=this._getConnection();r.body=JSON.stringify(t),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Af=new WeakMap;function ox(n){if(n==null)return null;if(typeof n.message=="string"&&n.message.match(/revert/i)&&Ct(n.data))return{message:n.message,data:n.data};if(typeof n=="object"){for(const e in n){const t=ox(n[e]);if(t)return t}return null}if(typeof n=="string")try{return ox(JSON.parse(n))}catch{}return null}function ax(n,e){if(n!=null){if(typeof n.message=="string"&&e.push(n.message),typeof n=="object")for(const t in n)ax(n[t],e);if(typeof n=="string")try{return ax(JSON.parse(n),e)}catch{}}}function $Z(n){const e=[];return ax(n,e),e}const Ly="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function GZ(n){switch(n){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",n)}class By extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Ly);const i={polling:!0,staticNetwork:s},o=By.getRequest(s,r);super(o,s,i);W(this,"apiKey");Me(this,{apiKey:r})}_getProvider(t){try{return new By(t,this.apiKey)}catch{}return super._getProvider(t)}static getRequest(t,r){r==null&&(r=Ly);const s=new zn(`https://${GZ(t.name)}/${r}`);return s.allowGzip=!0,r===Ly&&(s.retryFunc=async(i,o,a)=>(xu("AnkrProvider"),!0)),s}getRpcError(t,r){return t.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(t,r)}isCommunityResource(){return this.apiKey===Ly}}const _y="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function WZ(n){switch(n){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",n)}class Fy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=_y);const i=Fy.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Me(this,{apiKey:r})}_getProvider(t){try{return new Fy(t,this.apiKey)}catch{}return super._getProvider(t)}async _perform(t){if(t.method==="getTransactionResult"){const{trace:r,tx:s}=await On({trace:this.send("trace_transaction",[t.hash]),tx:this.getTransaction(t.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(t)}isCommunityResource(){return this.apiKey===_y}static getRequest(t,r){r==null&&(r=_y);const s=new zn(`https://${WZ(t.name)}/v2/${r}`);return s.allowGzip=!0,r===_y&&(s.retryFunc=async(i,o,a)=>(xu("alchemy"),!0)),s}}function jy(n){switch(n){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}$(!1,"unsupported network","network",n)}function KZ(n){switch(n){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",n)}class Uy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=jy(s.name));const i=Uy.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"apiKey");Me(this,{apiKey:r})}_getProvider(t){try{return new Uy(t,this.apiKey)}catch{}return super._getProvider(t)}isCommunityResource(){return this.apiKey===jy(this._network.name)}static getRequest(t,r){r==null&&(r=jy(t.name));const s=new zn(`https://${KZ(t.name)}/${r}`);return s.allowGzip=!0,r===jy(t.name)&&(s.retryFunc=async(i,o,a)=>(xu("ChainstackProvider"),!0)),s}}class QZ extends Fi{constructor(e){e==null&&(e="mainnet");const t=tn.from(e);$(t.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",t,{staticNetwork:t})}}const gL=2e3;function JZ(n){return n&&typeof n.then=="function"}const qZ="org.ethers.plugins.provider.Etherscan",YZ=["enableCcipRead"];let XZ=1;class ZZ extends Dy{constructor(t,r){const s=r??null;super();W(this,"network");W(this,"apiKey");q(this,vf);const i=tn.from(t);L(this,vf,i.getPlugin(qZ)),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(t,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=${t}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(t,r,s){const i=XZ++,o=s?this.getPostUrl():this.getUrl(t,r),a=s?this.getPostData(t,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new zn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&xu("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(iu(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return t==="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,gL)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,gL)),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 c=await l.send();try{c.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),te(!1,"response error","SERVER_ERROR",{request:l,response:c})}c.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),te(!1,"missing response","SERVER_ERROR",{request:l,response:c}));const u=JSON.parse(iu(c.body));return t==="proxy"?(u.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"invalid JSON-RPC"}),te(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:c,info:{result:u}})),u.error&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"JSON-RPC error"}),te(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):u.status==0&&(u.message==="No records found"||u.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):((u.status!=1||typeof u.message=="string"&&!u.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:u}),te(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result)}_getTransactionPostData(t){const r={};for(let s in t){if(YZ.indexOf(s)>=0||t[s]==null)continue;let i=t[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=al(i);else if(s==="accessList")i="["+$o(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:t}})}else i=Ae(i);r[s]=i}}return r}_checkError(t,r,s){let i="";if(dn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(t.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&te(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.transaction}),(t.method==="call"||t.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=yu.getBuiltinCallException(t.method,t.transaction,o);throw a.info={request:t,error:r},a}if(i&&t.method==="broadcastTransaction"){const o=hh.from(t.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(t){switch(t.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:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(r=>this._checkError(t,r,t.signedTransaction));case"getBlock":if("blockTag"in t)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.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:t.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.hash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}}return super._perform(t)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(t){let r=this._getAddress(t);JZ(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new wu(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}vf=new WeakMap;function eee(){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 tee=eee().WebSocket;class lx{constructor(e,t){q(this,fi);q(this,qh);q(this,ga);q(this,Yl);q(this,ya);L(this,fi,e),L(this,qh,JSON.stringify(t)),L(this,ga,null),L(this,Yl,null),L(this,ya,null)}get filter(){return JSON.parse(T(this,qh))}start(){L(this,ga,T(this,fi).send("eth_subscribe",this.filter).then(e=>(T(this,fi)._register(e,this),e)))}stop(){T(this,ga).then(e=>{T(this,fi).destroyed||T(this,fi).send("eth_unsubscribe",[e])}),L(this,ga,null)}pause(e){te(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),L(this,Yl,!!e)}resume(){L(this,Yl,null)}_handleMessage(e){if(T(this,ga)!=null&&T(this,Yl)===null){let t=T(this,ya);t==null?t=this._emit(T(this,fi),e):t=t.then(async()=>{await this._emit(T(this,fi),e)}),L(this,ya,t.then(()=>{T(this,ya)===t&&L(this,ya,null)}))}}async _emit(e,t){throw new Error("sub-classes must implemente this; _emit")}}fi=new WeakMap,qh=new WeakMap,ga=new WeakMap,Yl=new WeakMap,ya=new WeakMap;class nee extends lx{constructor(e){super(e,["newHeads"])}async _emit(e,t){e.emit("block",parseInt(t.number))}}class ree extends lx{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,t){e.emit("pending",t)}}class see extends lx{constructor(t,r){super(t,["logs",r]);q(this,Yh);L(this,Yh,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Yh))}async _emit(t,r){t.emit(this.logFilter,t._wrapLog(r,t._network))}}Yh=new WeakMap;class iee extends mL{constructor(t,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(t,s);q(this,Xl);q(this,xf);q(this,ba);L(this,Xl,new Map),L(this,xf,new Map),L(this,ba,new Map)}_getSubscriber(t){switch(t.type){case"close":return new Py("close");case"block":return new nee(this);case"pending":return new ree(this);case"event":return new see(this,t.filter);case"orphan":if(t.filter.orphan==="drop-log")return new Py("drop-log")}return super._getSubscriber(t)}_register(t,r){T(this,xf).set(t,r);const s=T(this,ba).get(t);if(s){for(const i of s)r._handleMessage(i);T(this,ba).delete(t)}}async _send(t){$(!Array.isArray(t),"WebSocket does not support batch send","payload",t);const r=new Promise((s,i)=>{T(this,Xl).set(t.id,{payload:t,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(t)),[await r]}async _processMessage(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&"id"in r){const s=T(this,Xl).get(r.id);if(s==null){this.emit("error",Mt("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,Xl).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,xf).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,ba).get(s);o==null&&(o=[],T(this,ba).set(s,o)),o.push(r.params.result)}}else{this.emit("error",Mt("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(t){throw new Error("sub-classes must override this")}}Xl=new WeakMap,xf=new WeakMap,ba=new WeakMap;class yL extends iee{constructor(t,r,s){super(r,s);q(this,Zl);q(this,Ts);typeof t=="string"?(L(this,Zl,()=>new tee(t)),L(this,Ts,T(this,Zl).call(this))):typeof t=="function"?(L(this,Zl,t),L(this,Ts,t())):(L(this,Zl,null),L(this,Ts,t)),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,Ts)==null)throw new Error("websocket closed");return T(this,Ts)}async _write(t){this.websocket.send(t)}async destroy(){T(this,Ts)!=null&&(T(this,Ts).close(),L(this,Ts,null)),super.destroy()}}Zl=new WeakMap,Ts=new WeakMap;const Ah="84842078b09946638c03157f83405213";function oee(n){switch(n){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",n)}class aee extends yL{constructor(t,r){const s=new vh(t,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);W(this,"projectId");W(this,"projectSecret");Me(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Ah}}class vh extends Fi{constructor(t,r,s){t==null&&(t="mainnet");const i=tn.from(t);r==null&&(r=Ah),s==null&&(s=null);const o=vh.getRequest(i,r,s);super(o,i,{staticNetwork:i});W(this,"projectId");W(this,"projectSecret");Me(this,{projectId:r,projectSecret:s})}_getProvider(t){try{return new vh(t,this.projectId,this.projectSecret)}catch{}return super._getProvider(t)}isCommunityResource(){return this.projectId===Ah}static getWebSocketProvider(t,r){return new aee(t,r)}static getRequest(t,r,s){r==null&&(r=Ah),s==null&&(s=null);const i=new zn(`https://${oee(t.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Ah&&(i.retryFunc=async(o,a,l)=>(xu("InfuraProvider"),!0)),i}}const Vy="919b412a057b5e9c9b6dce193c5a60242d6efadb";function lee(n){switch(n){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",n)}class Hy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Vy);const i=Hy.getRequest(s,r);super(i,s,{staticNetwork:s});W(this,"token");Me(this,{token:r})}_getProvider(t){try{return new Hy(t,this.token)}catch{}return super._getProvider(t)}isCommunityResource(){return this.token===Vy}static getRequest(t,r){r==null&&(r=Vy);const s=new zn(`https://${lee(t.name)}/${r}`);return s.allowGzip=!0,r===Vy&&(s.retryFunc=async(i,o,a)=>(xu("QuickNodeProvider"),!0)),s}}const cee=BigInt("1"),uee=BigInt("2");function fee(n){for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}}function dee(n){return new Promise(e=>{setTimeout(e,n)})}function cx(){return new Date().getTime()}function ux(n){return JSON.stringify(n,(e,t)=>typeof t=="bigint"?{type:"bigint",value:t.toString()}:t)}const bL={stallTimeout:400,priority:1,weight:1},wL={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 hee(n,e){for(;(n.blockNumber<0||n.blockNumber<e)&&(n._updateNumber||(n._updateNumber=(async()=>{try{const t=await n.provider.getBlockNumber();t>n.blockNumber&&(n.blockNumber=t)}catch(t){n.blockNumber=-2,n._lastFatalError=t,n._lastFatalErrorTimestamp=cx()}n._updateNumber=null})()),await n._updateNumber,n.outOfSync++,!n._lastFatalError););}function xh(n){if(n==null)return"null";if(Array.isArray(n))return"["+n.map(xh).join(",")+"]";if(typeof n=="object"&&typeof n.toJSON=="function")return xh(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":case"number":return BigInt(n).toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{"+e.map(t=>`${JSON.stringify(t)}:${xh(n[t])}`).join(",")+"}"}}throw console.log("Could not serialize",n),new Error("Hmm...")}function fx(n){if("error"in n){const t=n.error;return{tag:xh(t),value:t}}const e=n.result;return{tag:xh(e),value:e}}function zy(n,e){const t=new Map;for(const{value:s,tag:i,weight:o}of e){const a=t.get(i)||{value:s,weight:0};a.weight+=o,t.set(i,a)}let r=null;for(const s of t.values())s.weight>=n&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function dx(n,e){let t=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:c}of e)if(a instanceof Error){const u=r.get(l)||{value:a,weight:0};u.weight+=c,r.set(l,u),(s==null||u.weight>s.weight)&&(s=u)}else i.push(BigInt(a)),t+=c;if(t<n)return s&&s.weight>=n?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]+cee)/uee}function hx(n,e){const t=zy(n,e);if(t!==void 0)return t;for(const r of e)if(r.value)return r.value}function pee(n,e){if(n===1)return Je(dx(n,e),"%internal");const t=new Map,r=(o,a)=>{const l=t.get(o)||{result:o,weight:0};l.weight+=a,t.set(o,l)};for(const{weight:o,value:a}of e){const l=Je(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of t.values())o>=n&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class mee extends Dy{constructor(t,r,s){super(r,s);q(this,dr);W(this,"quorum");W(this,"eventQuorum");W(this,"eventWorkers");q(this,fr);q(this,oo);q(this,Ef);L(this,fr,t.map(i=>i instanceof Dy?Object.assign({provider:i},bL,wL):Object.assign({},bL,i,wL))),L(this,oo,-2),L(this,Ef,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,fr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,$(this.quorum<=T(this,fr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,fr).map(t=>{const r=Object.assign({},t);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return tn.from(Ce(await this._perform({method:"chainId"})))}async _translatePerform(t,r){switch(r.method){case"broadcastTransaction":return await t.broadcastTransaction(r.signedTransaction);case"call":return await t.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await t.getNetwork()).chainId;case"estimateGas":return await t.estimateGas(r.transaction);case"getBalance":return await t.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await t.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await t.getBlockNumber();case"getCode":return await t.getCode(r.address,r.blockTag);case"getGasPrice":return(await t.getFeeData()).gasPrice;case"getPriorityFee":return(await t.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await t.getLogs(r.filter);case"getStorage":return await t.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await t.getTransaction(r.hash);case"getTransactionCount":return await t.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await t.getTransactionReceipt(r.hash);case"getTransactionResult":return await t.getTransactionResult(r.hash)}}async _perform(t){if(t.method==="broadcastTransaction"){const o=T(this,fr).map(c=>null),a=T(this,fr).map(async({provider:c,weight:u},f)=>{try{const d=await c._perform(t);o[f]=Object.assign(fx({result:d}),{weight:u})}catch(d){o[f]=Object.assign(fx({error:d}),{weight:u})}});for(;;){const c=o.filter(d=>d!=null);for(const{value:d}of c)if(!(d instanceof Error))return d;const u=zy(this.quorum,o.filter(d=>d!=null));if(dn(u,"INSUFFICIENT_FUNDS"))throw u;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=hx(this.quorum,o);if(te(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:t,results:o.map(ux)}}),l instanceof Error)throw l;return l}await fe(this,dr,hF).call(this);const r=new Set;let s=0;for(;;){const o=fe(this,dr,_E).call(this,r,t);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await fe(this,dr,FE).call(this,r,t);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:t}of T(this,fr))t.destroy();super.destroy()}}fr=new WeakMap,oo=new WeakMap,Ef=new WeakMap,dr=new WeakSet,dF=function(t){const r=Array.from(t).map(i=>i.config),s=T(this,fr).slice();fee(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},_E=function(t,r){const s=fe(this,dr,dF).call(this,t);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=cx();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=cx()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await dee(s.stallTimeout),i.staller=null})(),t.add(i),i},hF=async function(){let t=T(this,Ef);if(!t){const r=[];T(this,fr).forEach(s=>{r.push((async()=>{await hee(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),L(this,Ef,t=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,fr)){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 t},pF=async function(t,r){const s=[];for(const i of t)if(i.result!=null){const{tag:o,value:a}=fx(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,oo)===-2&&L(this,oo,Math.ceil(Je(dx(this.quorum,T(this,fr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Je(o.blockNumber).toString(),weight:o.weight}))))));const i=pee(this.quorum,s);return i===void 0?void 0:(i>T(this,oo)&&L(this,oo,i),T(this,oo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return dx(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?hx(this.quorum,s):zy(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return zy(this.quorum,s);case"broadcastTransaction":return hx(this.quorum,s)}te(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${ux(r.method)})`})}},FE=async function(t,r){if(t.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of t){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await fe(this,dr,pF).call(this,t,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)fe(this,dr,_E).call(this,t,r);return te(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(t).map(a=>ux(a.result))}}),await Promise.race(s),await fe(this,dr,FE).call(this,t,r)};function gee(n){return n&&typeof n.send=="function"&&typeof n.close=="function"}const yee="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function bee(n,e){e==null&&(e={});const t=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof n=="string"&&n.match(/^https?:/))return new Fi(n);if(typeof n=="string"&&n.match(/^wss?:/)||gee(n))return new yL(n);let r=null;try{r=tn.from(n)}catch{}const s=[];if(t("publicPolygon")&&r&&(r.name==="matic"?s.push(new Fi("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Fi("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),t("alchemy"))try{s.push(new Fy(n,e.alchemy))}catch{}if(t("ankr")&&e.ankr!=null)try{s.push(new By(n,e.ankr))}catch{}if(t("chainstack"))try{s.push(new Uy(n,e.chainstack))}catch{}if(t("cloudflare"))try{s.push(new QZ(n))}catch{}if(t("etherscan"))try{s.push(new ZZ(n,e.etherscan))}catch{}if(t("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new vh(n,o,a))}catch{}if(t("quicknode"))try{let o=e.quicknode;s.push(new Hy(n,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&&yee.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new mee(s,void 0,{quorum:i})}const wee=async(n,e)=>{const t={name:n,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!mY(n))return t;try{const r=await Aee(n,e);r&&(t.name=r,t.isEns=!0)}catch(r){console.log(r)}return t},Aee=async(n,e)=>await vee(e).lookupAddress(n),vee=n=>bee(n),xee=(n,e,t)=>{if((n==null?void 0:n.length)>t){const r=n.substring(0,e),s=n.substring((n==null?void 0:n.length)-e);return`${r}...${s}`}return n};function Eee(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=n,a=aV(t),l=new RegExp(`\\s${a}$`),c=i?"^":"",u=r?new RegExp(`${c}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${c}(?:^)?${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(u)).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 y=d+h.index;let b=y+h[0].length;return r&&l.test(f.slice(b-1,b+1))&&(h[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:h[0].slice(t.length),text:h[0]}:null}const Cee=new Rt("suggestion");function kee({pluginKey:n=Cee,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:c=()=>[],render:u=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=Eee}){let h;const p=u==null?void 0:u(),m=new At({key:n,view(){return{update:async(y,b)=>{var v,A,w,x,C,S,M;const R=(v=this.key)===null||v===void 0?void 0:v.getState(b),O=(A=this.key)===null||A===void 0?void 0:A.getState(y.state),D=R.active&&O.active&&R.range.from!==O.range.from,_=!R.active&&O.active,F=R.active&&!O.active,G=!_&&!F&&R.query!==O.query,B=_||D,V=G&&!D,Q=F||D;if(!B&&!V&&!Q)return;const ee=Q&&!B?R:O,Z=y.dom.querySelector(`[data-decoration-id="${ee.decorationId}"]`);h={editor:e,range:ee.range,query:ee.query,text:ee.text,items:[],command:he=>l({editor:e,range:ee.range,props:he}),decorationNode:Z,clientRect:Z?()=>{var he;const{decorationId:ke}=(he=this.key)===null||he===void 0?void 0:he.getState(e.state),Se=y.dom.querySelector(`[data-decoration-id="${ke}"]`);return(Se==null?void 0:Se.getBoundingClientRect())||null}:null},B&&((w=p==null?void 0:p.onBeforeStart)===null||w===void 0||w.call(p,h)),V&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),(V||B)&&(h.items=await c({editor:e,query:ee.query})),Q&&((C=p==null?void 0:p.onExit)===null||C===void 0||C.call(p,h)),V&&((S=p==null?void 0:p.onUpdate)===null||S===void 0||S.call(p,h)),B&&((M=p==null?void 0:p.onStart)===null||M===void 0||M.call(p,h))},destroy:()=>{var y;h&&((y=p==null?void 0:p.onExit)===null||y===void 0||y.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,b,v,A){const{isEditable:w}=e,{composing:x}=e.view,{selection:C}=y,{empty:S,from:M}=C,R={...b};if(R.composing=x,w&&(S||e.view.composing)){(M<b.range.from||M>b.range.to)&&!x&&!b.composing&&(R.active=!1);const O=d({char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:C.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;O&&f({editor:e,state:A,range:O.range})?(R.active=!0,R.decorationId=b.decorationId?b.decorationId:D,R.range=O.range,R.query=O.query,R.text=O.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(y,b){var v;const{active:A,range:w}=m.getState(y.state);return A&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:y,event:b,range:w}))||!1},decorations(y){const{active:b,range:v,decorationId:A}=m.getState(y);return b?vt.create(y.doc,[en.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":A})]):null}}});return m}var See=typeof Yn=="object"&&Yn&&Yn.Object===Object&&Yn,Tee=typeof self=="object"&&self&&self.Object===Object&&self;See||Tee||Function("return this")();var AL=typeof window<"u"?P.useLayoutEffect:P.useEffect;function Oee(n,e,t,r){const s=P.useRef(e);AL(()=>{s.current=e},[e]),P.useEffect(()=>{const i=window;if(!(i&&i.addEventListener))return;const o=a=>{s.current(a)};return i.addEventListener(n,o,r),()=>{i.removeEventListener(n,o,r)}},[n,t,r])}var Nee=typeof window>"u";function vL(n,{defaultValue:e=!1,initializeWithValue:t=!0}={}){const r=a=>Nee?e:window.matchMedia(a).matches,[s,i]=P.useState(()=>t?r(n):e);function o(){i(r(n))}return AL(()=>{const a=window.matchMedia(n);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[n]),s}function Mee(n,e,t="mousedown",r={}){Oee(t,s=>{const i=s.target;if(!i||!i.isConnected)return;(Array.isArray(n)?n.filter(a=>!!a.current).every(a=>a.current&&!a.current.contains(i)):n.current&&!n.current.contains(i))&&e(s)},void 0,r)}const Ree=Ot.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[kee({editor:this.editor,...this.options.suggestion})]}}),Pee=({query:n,uploadToIpfs:e})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:k.jsx(mT,{size:18}),image:"",command:({editor:t,range:r})=>{t.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:k.jsx(pT,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:k.jsx(zp,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:k.jsx($p,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:k.jsx(Gp,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:k.jsx(Wp,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:k.jsx(Cc,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:k.jsx(d8,{size:18}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:k.jsx(Kp,{size:18}),image:"",command:({editor:t,range:r})=>t.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:k.jsx(cd,{size:18}),image:"",command:({editor:t,range:r})=>t.chain().focus().deleteRange(r).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:k.jsx(ow,{size:18}),image:"",command:({editor:t,range:r})=>t.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:k.jsx(c8,{size:18}),image:"",command:({editor:t,range:r})=>{t.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=t.view.state.selection.from;uw(o,t.view,a,e)}},s.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:k.jsx(yT,{}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:k.jsx(gT,{}),image:"",command:({editor:t,range:r})=>{t.chain().focus().deleteRange(r).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:k.jsx(fT,{}),image:"",command:({editor:t})=>{t.chain().focus().setColumns(2).focus(t.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:k.jsx(i8,{}),image:"",command:({editor:t})=>{t.chain().focus().setColumns(3).focus(t.state.selection.head-1).run()}}].filter(t=>{if(typeof n=="string"&&n.length>0){const r=n.toLowerCase();return t.title.toLowerCase().includes(r)||t.description.toLowerCase().includes(r)||t.searchTerms&&t.searchTerms.some(s=>s.includes(r))}return!0}),Dee=(n,e)=>{const t=n.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<n.scrollTop?n.scrollTop-=n.scrollTop-s+5:i>t+n.scrollTop&&(n.scrollTop+=i-t-n.scrollTop+5)},Iee=({items:n,command:e,editor:t})=>{const[r,s]=P.useState(0),[i,o]=P.useState(n),a=vL("(max-width: 640px)"),l=P.useCallback(u=>{const f=i[u];f&&(f.title==="Continue writing"||e(f))},[e,t,i]);P.useEffect(()=>{if(a){const u=i.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(u)}else o(n)},[n,a]),P.useEffect(()=>{const u=["ArrowUp","ArrowDown","Enter"],f=d=>{if(u.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]),P.useEffect(()=>{s(0)},[i]);const c=P.useRef(null);return P.useLayoutEffect(()=>{const u=c==null?void 0:c.current,f=u==null?void 0:u.children[r];f&&u&&Dee(u,f)},[r]),i.length>0?k.jsx("div",{id:"slash-command",ref:c,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((u,f)=>k.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:[k.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:u.icon}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium",children:u.title}),k.jsx("p",{className:"text-xs text-neutral-500",children:u.description})]})]},f))}):null},Lee=()=>{let n=null,e=null;return{onStart:t=>{n=new lT(Iee,{props:t,editor:t.editor}),e=Ba("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:t=>{n==null||n.updateProps(t),e&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown:t=>{var r;return t.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=n==null?void 0:n.ref)==null?void 0:r.onKeyDown(t)},onExit:()=>{e==null||e[0].destroy(),n==null||n.destroy()}}},Bee=n=>{const e=({query:t})=>Pee({query:t,uploadToIpfs:n});return Ree.configure({suggestion:{items:e,render:Lee}})},xL=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],_ee=({isPreviewMode:n,initialContent:e,enableCollaboration:t,collaborationId:r,walletAddress:s,username:i,onAutoSave:o,onChange:a,onCollaboratorChange:l,onCommentInteraction:c,onTextSelection:u,ensResolutionUrl:f,handleImageUploadToIpfs:d})=>{var F,G;const[h]=P.useState(new Ka),[p,m]=P.useState(!1),[y,b]=P.useState([...xJ,Bee(d)]),v=P.useRef(!1),A=(B,V)=>{var ee;const Q=V.target;if(Q&&Q.nodeName==="MARK"&&Q.dataset.color&&((ee=Q==null?void 0:Q.dataset)==null?void 0:ee.color)==="yellow"){const Z=Q.textContent,he=B.posAtCoords({left:V.clientX,top:V.clientY});if(he){const{state:ke}=B;let Se=he.pos,Ee=he.pos;if(ke.doc.nodesBetween(Se,Ee,(be,Fe)=>{be.marks&&be.marks.length&&be.marks.forEach(je=>{je.type.name==="highlight"&&(Se=Fe,Ee=Fe+be.nodeSize)})}),Se!==Ee){const be={text:Z,from:Se,to:Ee};c==null||c(be)}}}},w=(B,V,Q)=>{A(B,Q)},x=nT({extensions:y,editorProps:{...cM,handleDOMEvents:{mouseover:A,keydown:(B,V)=>{if(["ArrowUp","ArrowDown","Enter"].includes(V.key)&&document.querySelector("#slash-command"))return!0}},handleClick:w},autofocus:"start",onUpdate:B=>{O!=null&&O.isEmpty||a==null||a(B.editor.getJSON())}},[y]),C=nT({extensions:y,editorProps:{...cM,handleDOMEvents:{mouseover:A,keydown:(B,V)=>{if(["ArrowUp","ArrowDown","Enter"].includes(V.key)&&document.querySelector("#slash-command"))return!0}},handleClick:w},autofocus:"start",onUpdate:B=>{O!=null&&O.isEmpty||a==null||a(B.editor.getJSON())}}),S=P.useRef(()=>{}),M=(B,V=!1)=>{if(!t||!r)throw new Error("docId or username is not provided");m(!0);const Q=new wG(r,h,{signaling:["wss://fileverse-signaling-server-0529292ff51c.herokuapp.com/"]});b([...y,GG.configure({document:h}),WG.configure({provider:Q,user:{name:B&&B.length>20?xee(B,7,15):B,color:xL[Math.floor(Math.random()*xL.length)],isEns:V},render:TJ})]);const ee=setTimeout(()=>{m(!1)},100);return S.current=()=>{clearTimeout(ee),Q.destroy(),h.destroy(),m(!1)},S.current},R=P.useRef(null),O=P.useMemo(()=>t&&r&&x&&!p?x:C,[x,C,p]);P.useEffect(()=>{O==null||O.setEditable(!n)},[n,O]),P.useEffect(()=>{e&&O&&!v.current&&(O.commands.setContent(e),v.current=!0),setTimeout(()=>{v.current=!1})},[e,O]),P.useEffect(()=>{if(!O)return;const B=()=>{const{state:V}=O,{from:Q,to:ee}=V.selection;if(Q!==ee){const Z=V.doc.textBetween(Q,ee," ");u==null||u({text:Z,from:Q,to:ee})}};return O.on("selectionUpdate",B),()=>{O.off("selectionUpdate",B)}},[O]);const D=async()=>{let B=i,V=!1;if(s&&f){const{name:Q,isEns:ee}=await wee(s,f);B=Q,V=ee}if(!B)throw new Error("Cannot start collaboration without a username");M(B,V)};P.useEffect(()=>{t?D():S.current()},[t]);const _=P.useMemo(()=>Tv((B,V)=>{V({editorJSONData:B.getJSON()})},1e3),[o]);return P.useEffect(()=>{if(O&&o){const B=()=>{_(O,o)};return O.on("update",B),()=>{O.off("update",B)}}},[O,o,_]),P.useEffect(()=>{var B,V;l==null||l((V=(B=O==null?void 0:O.storage)==null?void 0:B.collaborationCursor)==null?void 0:V.users)},[(G=(F=O==null?void 0:O.storage)==null?void 0:F.collaborationCursor)==null?void 0:G.users]),{editor:O,ref:R,loading:p,connect:M,ydoc:h}},Fee=({title:n,content:e,contentClassName:t,open:r,onOpenChange:s,primaryAction:i,secondaryAction:o})=>k.jsx(x6,{open:r,onOpenChange:s,children:k.jsxs(LO,{className:"max-w-md sm:w-full w-[90%] z-20",children:[k.jsx(BO,{className:"px-4 pt-0 border-b-[1px]",children:k.jsx(FO,{className:"text-left text-base",children:n})}),k.jsx("div",{className:pe("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",t),children:e&&e}),k.jsxs(_O,{className:"px-5 pb-5 justify-end sm:",children:[o&&k.jsx(k6,{asChild:!0,children:k.jsx(Ha,{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&&k.jsx(Ha,{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})]})]})}),jee=({editor:n,uploadToIpfs:e})=>{const{toolVisibilty:t,setToolVisibility:r,bottomToolbar:s}=Qw({editor:n,uploadToIpfs:e}),i=vL("(max-width: 1023px)"),[o,a]=P.useState(""),[l,c]=P.useState(""),[u,f]=P.useState(!0),d=()=>{if(o===null){f(!1);return}if(o===""){n.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,})?$/)&&n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0)}catch{console.error("Invalid URL"),f(!1);return}n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0),r(De.NONE)},h=m=>{const{from:y,to:b}=m.state.selection;return m.state.doc.textBetween(y,b)},p=P.useRef(null);return P.useEffect(()=>{let m=0;const y=()=>{m=Date.now()},b=()=>{var w;if(Date.now()-m>500){const{selection:x}=n.state;x.from!==x.to&&((w=p.current)==null||w.click())}},v=()=>{var x;if(!i)return;const{selection:A}=n.state;A.from!==A.to&&((x=p.current)==null||x.click())};return i?(document.addEventListener("touchstart",y),document.addEventListener("touchend",b)):document.addEventListener("mouseup",v),()=>{i?(document.removeEventListener("touchstart",y),document.removeEventListener("touchend",b)):document.removeEventListener("mouseup",v)}},[n,i]),k.jsxs(OO,{children:[k.jsx("div",{className:"flex w-full justify-between sm:justify-evenly select-none",children:s.map(m=>{if(m)return k.jsx("div",{className:"flex items-center",children:m.title==="Text formating"?k.jsx(NO,{asChild:!0,children:k.jsx("button",{ref:p,onClick:()=>m.onClick(),children:m.icon})}):m.title==="Text color"?k.jsx(NO,{asChild:!0,children:k.jsx("button",{onClick:()=>m.onClick(),children:m.icon})}):k.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)})}),t===De.TEXT_FORMATING&&k.jsx(dz,{editor:n,setToolVisibility:r}),t===De.LINK_POPUP&&k.jsx(Fee,{open:t===De.LINK_POPUP,onOpenChange:()=>r(De.NONE),title:"Link",content:k.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[k.jsx(dm,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:h(n),onChange:m=>c(m.target.value)}),k.jsx(dm,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:n.getAttributes("link").href,onChange:m=>{a(m.target.value)},isValid:u,message:u?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>d(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>r(De.NONE),className:"w-auto min-w-[80px]"}})]})},px=P.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"}),$y=P.createContext({}),Gy=P.createContext(null),mx=typeof document<"u",gx=mx?P.useLayoutEffect:P.useEffect,EL=P.createContext({strict:!1}),yx=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),CL="data-"+yx("framerAppearId"),Uee={skipAnimations:!1,useManualTiming:!1};class kL{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 t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function Vee(n){let e=new kL,t=new kL,r=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,c=!1,u=!1)=>{const f=u&&s,d=f?e:t;return c&&o.add(l),d.add(l)&&f&&s&&(r=e.order.length),l},cancel:l=>{t.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[e,t]=[t,e],t.clear(),r=e.order.length,r)for(let c=0;c<r;c++){const u=e.order[c];o.has(u)&&(a.schedule(u),n()),u(l)}s=!1,i&&(i=!1,a.process(l))}};return a}const Wy=["read","resolveKeyframes","update","preRender","render","postRender"],Hee=40;function SL(n,e){let t=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=Wy.reduce((f,d)=>(f[d]=Vee(()=>t=!0),f),{}),o=f=>{i[f].process(s)},a=()=>{const f=performance.now();t=!1,s.delta=r?1e3/60:Math.max(Math.min(f-s.timestamp,Hee),1),s.timestamp=f,s.isProcessing=!0,Wy.forEach(o),s.isProcessing=!1,t&&e&&(r=!1,n(a))},l=()=>{t=!0,r=!0,s.isProcessing||n(a)};return{schedule:Wy.reduce((f,d)=>{const h=i[d];return f[d]=(p,m=!1,y=!1)=>(t||l(),h.schedule(p,m,y)),f},{}),cancel:f=>Wy.forEach(d=>i[d].cancel(f)),state:s,steps:i}}const{schedule:bx,cancel:Xie}=SL(queueMicrotask,!1);function Cu(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}const TL=P.createContext({});let OL=!1;function zee(n,e,t,r,s){const{visualElement:i}=P.useContext($y),o=P.useContext(EL),a=P.useContext(Gy),l=P.useContext(px).reducedMotion,c=P.useRef();r=r||o.renderer,!c.current&&r&&(c.current=r(n,{visualState:e,parent:i,props:t,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const u=c.current,f=P.useContext(TL);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&Gee(c.current,t,s,f),P.useInsertionEffect(()=>{u&&u.update(t,a)});const d=P.useRef(!!(t[CL]&&!window.HandoffComplete));return gx(()=>{u&&(u.updateFeatures(),bx.render(u.render),d.current&&u.animationState&&u.animationState.animateChanges())}),P.useEffect(()=>{u&&(!d.current&&u.animationState&&u.animationState.animateChanges(),d.current&&(d.current=!1,OL||(OL=!0,queueMicrotask($ee))))}),u}function $ee(){window.HandoffComplete=!0}function Gee(n,e,t,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:NL(n.parent)),n.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Cu(a),visualElement:n,scheduleRender:()=>n.scheduleRender(),animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:c})}function NL(n){if(n)return n.options.allowProjection!==!1?n.projection:NL(n.parent)}function Wee(n,e,t){return P.useCallback(r=>{r&&n.mount&&n.mount(r),e&&(r?e.mount(r):e.unmount()),t&&(typeof t=="function"?t(r):Cu(t)&&(t.current=r))},[e])}function Eh(n){return typeof n=="string"||Array.isArray(n)}function Ky(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const wx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ax=["initial",...wx];function Qy(n){return Ky(n.animate)||Ax.some(e=>Eh(n[e]))}function ML(n){return!!(Qy(n)||n.variants)}function Kee(n,e){if(Qy(n)){const{initial:t,animate:r}=n;return{initial:t===!1||Eh(t)?t:void 0,animate:Eh(r)?r:void 0}}return n.inherit!==!1?e:{}}function Qee(n){const{initial:e,animate:t}=Kee(n,P.useContext($y));return P.useMemo(()=>({initial:e,animate:t}),[RL(e),RL(t)])}function RL(n){return Array.isArray(n)?n.join(" "):n}const PL={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"]},ku={};for(const n in PL)ku[n]={isEnabled:e=>PL[n].some(t=>!!e[t])};function Jee(n){for(const e in n)ku[e]={...ku[e],...n[e]}}const vx=P.createContext({}),qee=Symbol.for("motionComponentSymbol"),xn=n=>n;let Su=xn,ji=xn;process.env.NODE_ENV!=="production"&&(Su=(n,e)=>{!n&&typeof console<"u"&&console.warn(e)},ji=(n,e)=>{if(!n)throw new Error(e)});function Yee({preloadedFeatures:n,createVisualElement:e,useRender:t,useVisualState:r,Component:s}){n&&Jee(n);function i(a,l){let c;const u={...P.useContext(px),...a,layoutId:Xee(a)},{isStatic:f}=u,d=Qee(a),h=r(a,f);if(!f&&mx){Zee(u,n);const p=ete(u);c=p.MeasureLayout,d.visualElement=zee(s,h,u,e,p.ProjectionNode)}return k.jsxs($y.Provider,{value:d,children:[c&&d.visualElement?k.jsx(c,{visualElement:d.visualElement,...u}):null,t(s,a,Wee(h,d.visualElement,l),h,f,d.visualElement)]})}const o=P.forwardRef(i);return o[qee]=s,o}function Xee({layoutId:n}){const e=P.useContext(vx).id;return e&&n!==void 0?e+"-"+n:n}function Zee(n,e){const t=P.useContext(EL).strict;if(process.env.NODE_ENV!=="production"&&e&&t){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?Su(!1,r):ji(!1,r)}}function ete(n){const{drag:e,layout:t}=ku;if(!e&&!t)return{};const r={...e,...t};return{MeasureLayout:e!=null&&e.isEnabled(n)||t!=null&&t.isEnabled(n)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function tte(n){function e(r,s={}){return Yee(n(r,s))}if(typeof Proxy>"u")return e;const t=new Map;return new Proxy(e,{get:(r,s)=>(t.has(s)||t.set(s,e(s)),t.get(s))})}const nte=["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 xx(n){return typeof n!="string"||n.includes("-")?!1:!!(nte.indexOf(n)>-1||/[A-Z]/u.test(n))}const Jy={};function rte(n){Object.assign(Jy,n)}const Ch=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],vl=new Set(Ch);function DL(n,{layout:e,layoutId:t}){return vl.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!Jy[n]||n==="opacity")}const Mn=n=>!!(n&&n.getVelocity),ste={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ite=Ch.length;function ote(n,{enableHardwareAcceleration:e=!0,allowTransformNone:t=!0},r,s){let i="";for(let o=0;o<ite;o++){const a=Ch[o];if(n[a]!==void 0){const l=ste[a]||a;i+=`${l}(${n[a]}) `}}return e&&!n.z&&(i+="translateZ(0)"),i=i.trim(),s?i=s(n,r?"":i):t&&r&&(i="none"),i}const IL=n=>e=>typeof e=="string"&&e.startsWith(n),LL=IL("--"),ate=IL("var(--"),Ex=n=>ate(n)?lte.test(n.split("/*")[0].trim()):!1,lte=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,cte=(n,e)=>e&&typeof n=="number"?e.transform(n):n,Wo=(n,e,t)=>t>e?e:t<n?n:t,Tu={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},kh={...Tu,transform:n=>Wo(0,1,n)},qy={...Tu,default:1},Sh=n=>Math.round(n*1e5)/1e5,Cx=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ute=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,fte=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function Th(n){return typeof n=="string"}const Oh=n=>({test:e=>Th(e)&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Ko=Oh("deg"),ti=Oh("%"),Le=Oh("px"),dte=Oh("vh"),hte=Oh("vw"),BL={...ti,parse:n=>ti.parse(n)/100,transform:n=>ti.transform(n*100)},_L={...Tu,transform:Math.round},FL={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:Ko,rotateX:Ko,rotateY:Ko,rotateZ:Ko,scale:qy,scaleX:qy,scaleY:qy,scaleZ:qy,skew:Ko,skewX:Ko,skewY:Ko,distance:Le,translateX:Le,translateY:Le,translateZ:Le,x:Le,y:Le,z:Le,perspective:Le,transformPerspective:Le,opacity:kh,originX:BL,originY:BL,originZ:Le,zIndex:_L,backgroundPositionX:Le,backgroundPositionY:Le,fillOpacity:kh,strokeOpacity:kh,numOctaves:_L};function kx(n,e,t,r){const{style:s,vars:i,transform:o,transformOrigin:a}=n;let l=!1,c=!1,u=!0;for(const f in e){const d=e[f];if(LL(f)){i[f]=d;continue}const h=FL[f],p=cte(d,h);if(vl.has(f)){if(l=!0,o[f]=p,!u)continue;d!==(h.default||0)&&(u=!1)}else f.startsWith("origin")?(c=!0,a[f]=p):s[f]=p}if(e.transform||(l||r?s.transform=ote(n.transform,t,u,r):s.transform&&(s.transform="none")),c){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;s.transformOrigin=`${f} ${d} ${h}`}}const Sx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function jL(n,e,t){for(const r in e)!Mn(e[r])&&!DL(r,t)&&(n[r]=e[r])}function pte({transformTemplate:n},e,t){return P.useMemo(()=>{const r=Sx();return kx(r,e,{enableHardwareAcceleration:!t},n),Object.assign({},r.vars,r.style)},[e])}function mte(n,e,t){const r=n.style||{},s={};return jL(s,r,n),Object.assign(s,pte(n,e,t)),s}function gte(n,e,t){const r={},s=mte(n,e,t);return n.drag&&n.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(r.tabIndex=0),r.style=s,r}const yte=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 Yy(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||yte.has(n)}let UL=n=>!Yy(n);function bte(n){n&&(UL=e=>e.startsWith("on")?!Yy(e):n(e))}try{bte(require("@emotion/is-prop-valid").default)}catch{}function wte(n,e,t){const r={};for(const s in n)s==="values"&&typeof n.values=="object"||(UL(s)||t===!0&&Yy(s)||!e&&!Yy(s)||n.draggable&&s.startsWith("onDrag"))&&(r[s]=n[s]);return r}function VL(n,e,t){return typeof n=="string"?n:Le.transform(e+t*n)}function Ate(n,e,t){const r=VL(e,n.x,n.width),s=VL(t,n.y,n.height);return`${r} ${s}`}const vte={offset:"stroke-dashoffset",array:"stroke-dasharray"},xte={offset:"strokeDashoffset",array:"strokeDasharray"};function Ete(n,e,t=1,r=0,s=!0){n.pathLength=1;const i=s?vte:xte;n[i.offset]=Le.transform(-r);const o=Le.transform(e),a=Le.transform(t);n[i.array]=`${o} ${a}`}function Tx(n,{attrX:e,attrY:t,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},u,f,d){if(kx(n,c,u,d),f){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:h,style:p,dimensions:m}=n;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=Ate(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),t!==void 0&&(h.y=t),r!==void 0&&(h.scale=r),o!==void 0&&Ete(h,o,a,l,!1)}const HL=()=>({...Sx(),attrs:{}}),Ox=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Cte(n,e,t,r){const s=P.useMemo(()=>{const i=HL();return Tx(i,e,{enableHardwareAcceleration:!1},Ox(r),n.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(n.style){const i={};jL(i,n.style,n),s.style={...i,...s.style}}return s}function kte(n=!1){return(t,r,s,{latestValues:i},o)=>{const l=(xx(t)?Cte:gte)(r,i,o,t),c=wte(r,typeof t=="string",n),u=t!==P.Fragment?{...c,...l,ref:s}:{},{children:f}=r,d=P.useMemo(()=>Mn(f)?f.get():f,[f]);return P.createElement(t,{...u,children:d})}}function zL(n,{style:e,vars:t},r,s){Object.assign(n.style,e,s&&s.getProjectionStyles(r));for(const i in t)n.style.setProperty(i,t[i])}const $L=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 GL(n,e,t,r){zL(n,e,void 0,r);for(const s in e.attrs)n.setAttribute($L.has(s)?s:yx(s),e.attrs[s])}function Nx(n,e,t){var r;const{style:s}=n,i={};for(const o in s)(Mn(s[o])||e.style&&Mn(e.style[o])||DL(o,n)||((r=t==null?void 0:t.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function WL(n,e,t){const r=Nx(n,e,t);for(const s in n)if(Mn(n[s])||Mn(e[s])){const i=Ch.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=n[s]}return r}function KL(n){const e=[{},{}];return n==null||n.values.forEach((t,r)=>{e[0][r]=t.get(),e[1][r]=t.getVelocity()}),e}function Mx(n,e,t,r){if(typeof e=="function"){const[s,i]=KL(r);e=e(t!==void 0?t:n.custom,s,i)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,i]=KL(r);e=e(t!==void 0?t:n.custom,s,i)}return e}function QL(n){const e=P.useRef(null);return e.current===null&&(e.current=n()),e.current}const Rx=n=>Array.isArray(n),Ste=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),Tte=n=>Rx(n)?n[n.length-1]||0:n;function Xy(n){const e=Mn(n)?n.get():n;return Ste(e)?e.toValue():e}function Ote({scrapeMotionValuesFromProps:n,createRenderState:e,onMount:t},r,s,i){const o={latestValues:Nte(r,s,i,n),renderState:e()};return t&&(o.mount=a=>t(r,a,o)),o}const JL=n=>(e,t)=>{const r=P.useContext($y),s=P.useContext(Gy),i=()=>Ote(n,e,r,s);return t?i():QL(i)};function Nte(n,e,t,r){const s={},i=r(n,{});for(const d in i)s[d]=Xy(i[d]);let{initial:o,animate:a}=n;const l=Qy(n),c=ML(n);e&&c&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=t?t.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!Ky(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=Mx(n,h);if(!p)return;const{transitionEnd:m,transition:y,...b}=p;for(const v in b){let A=b[v];if(Array.isArray(A)){const w=u?A.length-1:0;A=A[w]}A!==null&&(s[v]=A)}for(const v in m)s[v]=m[v]}),s}const{schedule:dt,cancel:Ui,state:En,steps:Px}=SL(typeof requestAnimationFrame<"u"?requestAnimationFrame:xn,!0),Mte={useVisualState:JL({scrapeMotionValuesFromProps:WL,createRenderState:HL,onMount:(n,e,{renderState:t,latestValues:r})=>{dt.read(()=>{try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}),dt.render(()=>{Tx(t,r,{enableHardwareAcceleration:!1},Ox(e.tagName),n.transformTemplate),GL(e,t)})}})},Rte={useVisualState:JL({scrapeMotionValuesFromProps:Nx,createRenderState:Sx})};function Pte(n,{forwardMotionProps:e=!1},t,r){return{...xx(n)?Mte:Rte,preloadedFeatures:t,useRender:kte(e),createVisualElement:r,Component:n}}function Vi(n,e,t,r={passive:!0}){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t)}const qL=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Zy(n,e="page"){return{point:{x:n[`${e}X`],y:n[`${e}Y`]}}}const Dte=n=>e=>qL(e)&&n(e,Zy(e));function Hi(n,e,t,r){return Vi(n,e,Dte(t),r)}const Ite=(n,e)=>t=>e(n(t)),zi=(...n)=>n.reduce(Ite);function YL(n){let e=null;return()=>{const t=()=>{e=null};return e===null?(e=n,t):!1}}const XL=YL("dragHorizontal"),ZL=YL("dragVertical");function eB(n){let e=!1;if(n==="y")e=ZL();else if(n==="x")e=XL();else{const t=XL(),r=ZL();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}function tB(){const n=eB(!0);return n?(n(),!1):!0}class Qo{constructor(e){this.isMounted=!1,this.node=e}update(){}}function nB(n,e){const t=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||tB())return;const a=n.getProps();n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",e);const l=a[r];l&&dt.postRender(()=>l(i,o))};return Hi(n.current,t,s,{passive:!n.getProps()[r]})}class Lte extends Qo{mount(){this.unmount=zi(nB(this.node,!0),nB(this.node,!1))}unmount(){}}class Bte extends Qo{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=zi(Vi(this.node.current,"focus",()=>this.onFocus()),Vi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const rB=(n,e)=>e?n===e?!0:rB(n,e.parentElement):!1;function Dx(n,e){if(!e)return;const t=new PointerEvent("pointer"+n);e(t,Zy(t))}class _te extends Qo{constructor(){super(...arguments),this.removeStartListeners=xn,this.removeEndListeners=xn,this.removeAccessibleListeners=xn,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=Hi(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:u,globalTapTarget:f}=this.node.getProps(),d=!f&&!rB(this.node.current,a.target)?u:c;d&&dt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Hi(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=zi(i,o),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||Dx("up",(l,c)=>{const{onTap:u}=this.node.getProps();u&&dt.postRender(()=>u(l,c))})};this.removeEndListeners(),this.removeEndListeners=Vi(this.node.current,"keyup",o),Dx("down",(a,l)=>{this.startPress(a,l)})},t=Vi(this.node.current,"keydown",e),r=()=>{this.isPressing&&Dx("cancel",(i,o)=>this.cancelPress(i,o))},s=Vi(this.node.current,"blur",r);this.removeAccessibleListeners=zi(t,s)}}startPress(e,t){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&dt.postRender(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!tB()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&dt.postRender(()=>r(e,t))}mount(){const e=this.node.getProps(),t=Hi(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Vi(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=zi(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ix=new WeakMap,Lx=new WeakMap,Fte=n=>{const e=Ix.get(n.target);e&&e(n)},jte=n=>{n.forEach(Fte)};function Ute({root:n,...e}){const t=n||document;Lx.has(t)||Lx.set(t,{});const r=Lx.get(t),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(jte,{root:n,...e})),r[s]}function Vte(n,e,t){const r=Ute(e);return Ix.set(n,t),r.observe(n),()=>{Ix.delete(n),r.unobserve(n)}}const Hte={some:0,all:1};class zte extends Qo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:s="some",once:i}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:Hte[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),d=c?u:f;d&&d(l)};return Vte(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some($te(e,t))&&this.startObserver()}unmount(){}}function $te({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const Gte={inView:{Feature:zte},tap:{Feature:_te},focus:{Feature:Bte},hover:{Feature:Lte}};function sB(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let r=0;r<t;r++)if(e[r]!==n[r])return!1;return!0}function e0(n,e,t){const r=n.getProps();return Mx(r,e,t!==void 0?t:r.custom,n)}const $i=n=>n*1e3,Gi=n=>n/1e3,Wte={type:"spring",stiffness:500,damping:25,restSpeed:10},Kte=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),Qte={type:"keyframes",duration:.8},Jte={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},qte=(n,{keyframes:e})=>e.length>2?Qte:vl.has(n)?n.startsWith("scale")?Kte(e[1]):Wte:Jte;function Yte({when:n,delay:e,delayChildren:t,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}function Bx(n,e){return n[e]||n.default||n}const Xte=n=>n!==null;function t0(n,{repeat:e,repeatType:t="loop"},r){const s=n.filter(Xte),i=e&&t!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}let n0;function Zte(){n0=void 0}const Jo={now:()=>(n0===void 0&&Jo.set(En.isProcessing||Uee.useManualTiming?En.timestamp:performance.now()),n0),set:n=>{n0=n,queueMicrotask(Zte)}},iB=n=>/^0[^.\s]+$/u.test(n);function ene(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||iB(n):!0}const oB=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),tne=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function nne(n){const e=tne.exec(n);if(!e)return[,];const[,t,r,s]=e;return[`--${t??r}`,s]}const rne=4;function aB(n,e,t=1){ji(t<=rne,`Max CSS variable fallback depth detected in property "${n}". This may indicate a circular fallback dependency.`);const[r,s]=nne(n);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return oB(o)?parseFloat(o):o}return Ex(s)?aB(s,e,t+1):s}const sne=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),lB=n=>n===Tu||n===Le,cB=(n,e)=>parseFloat(n.split(", ")[e]),uB=(n,e)=>(t,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return cB(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?cB(i[1],n):0}},ine=new Set(["x","y","z"]),one=Ch.filter(n=>!ine.has(n));function ane(n){const e=[];return one.forEach(t=>{const r=n.getValue(t);r!==void 0&&(e.push([t,r.get()]),r.set(t.startsWith("scale")?1:0))}),e}const Ou={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:uB(4,13),y:uB(5,14)};Ou.translateX=Ou.x,Ou.translateY=Ou.y;const fB=n=>e=>e.test(n),dB=[Tu,Le,ti,Ko,hte,dte,{test:n=>n==="auto",parse:n=>n}],hB=n=>dB.find(fB(n)),xl=new Set;let _x=!1,Fx=!1;function pB(){if(Fx){const n=Array.from(xl).filter(r=>r.needsMeasurement),e=new Set(n.map(r=>r.element)),t=new Map;e.forEach(r=>{const s=ane(r);s.length&&(t.set(r,s),r.render())}),n.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=t.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Fx=!1,_x=!1,xl.forEach(n=>n.complete()),xl.clear()}function mB(){xl.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Fx=!0)})}function lne(){mB(),pB()}class jx{constructor(e,t,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(xl.add(this),_x||(_x=!0,dt.read(mB),dt.resolveKeyframes(pB))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,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&&t){const l=r.readValue(t,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),xl.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,xl.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Ux=(n,e)=>t=>!!(Th(t)&&fte.test(t)&&t.startsWith(n)||e&&Object.prototype.hasOwnProperty.call(t,e)),gB=(n,e,t)=>r=>{if(!Th(r))return r;const[s,i,o,a]=r.match(Cx);return{[n]:parseFloat(s),[e]:parseFloat(i),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},cne=n=>Wo(0,255,n),Vx={...Tu,transform:n=>Math.round(cne(n))},El={test:Ux("rgb","red"),parse:gB("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:r=1})=>"rgba("+Vx.transform(n)+", "+Vx.transform(e)+", "+Vx.transform(t)+", "+Sh(kh.transform(r))+")"};function une(n){let e="",t="",r="",s="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),r=n.substring(5,7),s=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),r=n.substring(3,4),s=n.substring(4,5),e+=e,t+=t,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Hx={test:Ux("#"),parse:une,transform:El.transform},Nu={test:Ux("hsl","hue"),parse:gB("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:r=1})=>"hsla("+Math.round(n)+", "+ti.transform(Sh(e))+", "+ti.transform(Sh(t))+", "+Sh(kh.transform(r))+")"},Rn={test:n=>El.test(n)||Hx.test(n)||Nu.test(n),parse:n=>El.test(n)?El.parse(n):Nu.test(n)?Nu.parse(n):Hx.parse(n),transform:n=>Th(n)?n:n.hasOwnProperty("red")?El.transform(n):Nu.transform(n)};function fne(n){var e,t;return isNaN(n)&&Th(n)&&(((e=n.match(Cx))===null||e===void 0?void 0:e.length)||0)+(((t=n.match(ute))===null||t===void 0?void 0:t.length)||0)>0}const yB="number",bB="color",dne="var",hne="var(",wB="${}",pne=/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 Nh(n){const e=n.toString(),t=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(pne,l=>(Rn.test(l)?(r.color.push(i),s.push(bB),t.push(Rn.parse(l))):l.startsWith(hne)?(r.var.push(i),s.push(dne),t.push(l)):(r.number.push(i),s.push(yB),t.push(parseFloat(l))),++i,wB)).split(wB);return{values:t,split:a,indexes:r,types:s}}function AB(n){return Nh(n).values}function vB(n){const{split:e,types:t}=Nh(n),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=t[o];a===yB?i+=Sh(s[o]):a===bB?i+=Rn.transform(s[o]):i+=s[o]}return i}}const mne=n=>typeof n=="number"?0:n;function gne(n){const e=AB(n);return vB(n)(e.map(mne))}const qo={test:fne,parse:AB,createTransformer:vB,getAnimatableNone:gne},yne=new Set(["brightness","contrast","saturate","opacity"]);function bne(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[r]=t.match(Cx)||[];if(!r)return n;const s=t.replace(r,"");let i=yne.has(e)?1:0;return r!==t&&(i*=100),e+"("+i+s+")"}const wne=/\b([a-z-]*)\(.*?\)/gu,zx={...qo,getAnimatableNone:n=>{const e=n.match(wne);return e?e.map(bne).join(" "):n}},Ane={...FL,color:Rn,backgroundColor:Rn,outlineColor:Rn,fill:Rn,stroke:Rn,borderColor:Rn,borderTopColor:Rn,borderRightColor:Rn,borderBottomColor:Rn,borderLeftColor:Rn,filter:zx,WebkitFilter:zx},$x=n=>Ane[n];function xB(n,e){let t=$x(n);return t!==zx&&(t=qo),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const vne=new Set(["auto","none","0"]);function xne(n,e,t){let r=0,s;for(;r<n.length&&!s;){const i=n[r];typeof i=="string"&&!vne.has(i)&&Nh(i).values.length&&(s=n[r]),r++}if(s&&t)for(const i of e)n[i]=xB(t,s)}class EB extends jx{constructor(e,t,r,s){super(e,t,r,s,s==null?void 0:s.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let c=e[l];if(typeof c=="string"&&(c=c.trim(),Ex(c))){const u=aB(c,t.current);u!==void 0&&(e[l]=u),l===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!sne.has(r)||e.length!==2)return;const[s,i]=e,o=hB(s),a=hB(i);if(o!==a)if(lB(o)&&lB(a))for(let l=0;l<e.length;l++){const c=e[l];typeof c=="string"&&(e[l]=parseFloat(c))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let s=0;s<e.length;s++)ene(e[s])&&r.push(s);r.length&&xne(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ou[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const s=t[t.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:t,name:r,unresolvedKeyframes:s}=this;if(!t.current)return;const i=t.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Ou[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function CB(n){let e;return()=>(e===void 0&&(e=n()),e)}const kB=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(qo.test(n)||n==="0")&&!n.startsWith("url("));function Ene(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function Cne(n,e,t,r){const s=n[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=n[n.length-1],o=kB(s,e),a=kB(i,e);return Su(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:Ene(n)||t==="spring"&&r}class SB{constructor({autoplay:e=!0,delay:t=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:t,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&lne(),this._resolved}onKeyframesResolved(e,t){this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:c}=this.options;if(!c&&!Cne(e,r,s,i))if(o)this.options.duration=0;else{l==null||l(t0(e,this.options,t)),a==null||a(),this.resolveFinishedPromise();return}const u=this.initPlayback(e,t);u!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...u},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function TB(n,e){return e?n*(1e3/e):0}const kne=5;function OB(n,e,t){const r=Math.max(e-kne,0);return TB(t-n(r),e-r)}const Gx=.001,Sne=.01,NB=10,Tne=.05,One=1;function Nne({duration:n=800,bounce:e=.25,velocity:t=0,mass:r=1}){let s,i;Su(n<=$i(NB),"Spring duration must be 10 seconds or less");let o=1-e;o=Wo(Tne,One,o),n=Wo(Sne,NB,Gi(n)),o<1?(s=c=>{const u=c*o,f=u*n,d=u-t,h=Wx(c,o),p=Math.exp(-f);return Gx-d/h*p},i=c=>{const f=c*o*n,d=f*t+t,h=Math.pow(o,2)*Math.pow(c,2)*n,p=Math.exp(-f),m=Wx(Math.pow(c,2),o);return(-s(c)+Gx>0?-1:1)*((d-h)*p)/m}):(s=c=>{const u=Math.exp(-c*n),f=(c-t)*n+1;return-Gx+u*f},i=c=>{const u=Math.exp(-c*n),f=(t-c)*(n*n);return u*f});const a=5/n,l=Rne(s,i,a);if(n=$i(n),isNaN(l))return{stiffness:100,damping:10,duration:n};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:n}}}const Mne=12;function Rne(n,e,t){let r=t;for(let s=1;s<Mne;s++)r=r-n(r)/e(r);return r}function Wx(n,e){return n*Math.sqrt(1-e*e)}const Pne=["duration","bounce"],Dne=["stiffness","damping","mass"];function MB(n,e){return e.some(t=>n[t]!==void 0)}function Ine(n){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...n};if(!MB(n,Dne)&&MB(n,Pne)){const t=Nne(n);e={...e,...t,mass:1},e.isResolvedFromDuration=!0}return e}function RB({keyframes:n,restDelta:e,restSpeed:t,...r}){const s=n[0],i=n[n.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:c,duration:u,velocity:f,isResolvedFromDuration:d}=Ine({...r,velocity:-Gi(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*c)),m=i-s,y=Gi(Math.sqrt(a/c)),b=Math.abs(m)<5;t||(t=b?.01:2),e||(e=b?.005:.5);let v;if(p<1){const A=Wx(y,p);v=w=>{const x=Math.exp(-p*y*w);return i-x*((h+p*y*m)/A*Math.sin(A*w)+m*Math.cos(A*w))}}else if(p===1)v=A=>i-Math.exp(-y*A)*(m+(h+y*m)*A);else{const A=y*Math.sqrt(p*p-1);v=w=>{const x=Math.exp(-p*y*w),C=Math.min(A*w,300);return i-x*((h+p*y*m)*Math.sinh(C)+A*m*Math.cosh(C))/A}}return{calculatedDuration:d&&u||null,next:A=>{const w=v(A);if(d)o.done=A>=u;else{let x=h;A!==0&&(p<1?x=OB(v,A,w):x=0);const C=Math.abs(x)<=t,S=Math.abs(i-w)<=e;o.done=C&&S}return o.value=o.done?i:w,o}}}function PB({keyframes:n,velocity:e=0,power:t=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const f=n[0],d={done:!1,value:f},h=M=>a!==void 0&&M<a||l!==void 0&&M>l,p=M=>a===void 0?l:l===void 0||Math.abs(a-M)<Math.abs(l-M)?a:l;let m=t*e;const y=f+m,b=o===void 0?y:o(y);b!==y&&(m=b-f);const v=M=>-m*Math.exp(-M/r),A=M=>b+v(M),w=M=>{const R=v(M),O=A(M);d.done=Math.abs(R)<=c,d.value=d.done?b:O};let x,C;const S=M=>{h(d.value)&&(x=M,C=RB({keyframes:[d.value,p(d.value)],velocity:OB(A,M,d.value),damping:s,stiffness:i,restDelta:c,restSpeed:u}))};return S(0),{calculatedDuration:null,next:M=>{let R=!1;return!C&&x===void 0&&(R=!0,w(M),S(M)),x!==void 0&&M>=x?C.next(M-x):(!R&&w(M),d)}}}const DB=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,Lne=1e-7,Bne=12;function _ne(n,e,t,r,s){let i,o,a=0;do o=e+(t-e)/2,i=DB(o,r,s)-n,i>0?t=o:e=o;while(Math.abs(i)>Lne&&++a<Bne);return o}function Mh(n,e,t,r){if(n===e&&t===r)return xn;const s=i=>_ne(i,0,1,n,t);return i=>i===0||i===1?i:DB(s(i),e,r)}const Fne=Mh(.42,0,1,1),jne=Mh(0,0,.58,1),IB=Mh(.42,0,.58,1),Une=n=>Array.isArray(n)&&typeof n[0]!="number",LB=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,BB=n=>e=>1-n(1-e),Kx=n=>1-Math.sin(Math.acos(n)),_B=BB(Kx),Vne=LB(Kx),FB=Mh(.33,1.53,.69,.99),Qx=BB(FB),Hne=LB(Qx),jB={linear:xn,easeIn:Fne,easeInOut:IB,easeOut:jne,circIn:Kx,circInOut:Vne,circOut:_B,backIn:Qx,backInOut:Hne,backOut:FB,anticipate:n=>(n*=2)<1?.5*Qx(n):.5*(2-Math.pow(2,-10*(n-1)))},UB=n=>{if(Array.isArray(n)){ji(n.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,t,r,s]=n;return Mh(e,t,r,s)}else if(typeof n=="string")return ji(jB[n]!==void 0,`Invalid easing type '${n}'`),jB[n];return n},Rh=(n,e,t)=>{const r=e-n;return r===0?1:(t-n)/r},Bt=(n,e,t)=>n+(e-n)*t;function Jx(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function zne({hue:n,saturation:e,lightness:t,alpha:r}){n/=360,e/=100,t/=100;let s=0,i=0,o=0;if(!e)s=i=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;s=Jx(l,a,n+1/3),i=Jx(l,a,n),o=Jx(l,a,n-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function r0(n,e){return t=>t>0?e:n}const qx=(n,e,t)=>{const r=n*n,s=t*(e*e-r)+r;return s<0?0:Math.sqrt(s)},$ne=[Hx,El,Nu],Gne=n=>$ne.find(e=>e.test(n));function VB(n){const e=Gne(n);if(Su(!!e,`'${n}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let t=e.parse(n);return e===Nu&&(t=zne(t)),t}const HB=(n,e)=>{const t=VB(n),r=VB(e);if(!t||!r)return r0(n,e);const s={...t};return i=>(s.red=qx(t.red,r.red,i),s.green=qx(t.green,r.green,i),s.blue=qx(t.blue,r.blue,i),s.alpha=Bt(t.alpha,r.alpha,i),El.transform(s))},Yx=new Set(["none","hidden"]);function Wne(n,e){return Yx.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function Kne(n,e){return t=>Bt(n,e,t)}function Xx(n){return typeof n=="number"?Kne:typeof n=="string"?Ex(n)?r0:Rn.test(n)?HB:qne:Array.isArray(n)?zB:typeof n=="object"?Rn.test(n)?HB:Qne:r0}function zB(n,e){const t=[...n],r=t.length,s=n.map((i,o)=>Xx(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)t[o]=s[o](i);return t}}function Qne(n,e){const t={...n,...e},r={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(r[s]=Xx(n[s])(n[s],e[s]));return s=>{for(const i in r)t[i]=r[i](s);return t}}function Jne(n,e){var t;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=n.indexes[o][s[o]],l=(t=n.values[a])!==null&&t!==void 0?t:0;r[i]=l,s[o]++}return r}const qne=(n,e)=>{const t=qo.createTransformer(e),r=Nh(n),s=Nh(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?Yx.has(n)&&!s.values.length||Yx.has(e)&&!r.values.length?Wne(n,e):zi(zB(Jne(r,s),s.values),t):(Su(!0,`Complex values '${n}' 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.`),r0(n,e))};function $B(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?Bt(n,e,t):Xx(n)(n,e)}function Yne(n,e,t){const r=[],s=t||$B,i=n.length-1;for(let o=0;o<i;o++){let a=s(n[o],n[o+1]);if(e){const l=Array.isArray(e)?e[o]||xn:e;a=zi(l,a)}r.push(a)}return r}function Xne(n,e,{clamp:t=!0,ease:r,mixer:s}={}){const i=n.length;if(ji(i===e.length,"Both input and output ranges must be the same length"),i===1)return()=>e[0];if(i===2&&n[0]===n[1])return()=>e[1];n[0]>n[i-1]&&(n=[...n].reverse(),e=[...e].reverse());const o=Yne(e,r,s),a=o.length,l=c=>{let u=0;if(a>1)for(;u<n.length-2&&!(c<n[u+1]);u++);const f=Rh(n[u],n[u+1],c);return o[u](f)};return t?c=>l(Wo(n[0],n[i-1],c)):l}function Zne(n,e){const t=n[n.length-1];for(let r=1;r<=e;r++){const s=Rh(0,e,r);n.push(Bt(t,1,s))}}function ere(n){const e=[0];return Zne(e,n.length-1),e}function tre(n,e){return n.map(t=>t*e)}function nre(n,e){return n.map(()=>e||IB).splice(0,n.length-1)}function s0({duration:n=300,keyframes:e,times:t,ease:r="easeInOut"}){const s=Une(r)?r.map(UB):UB(r),i={done:!1,value:e[0]},o=tre(t&&t.length===e.length?t:ere(e),n),a=Xne(o,e,{ease:Array.isArray(s)?s:nre(e,s)});return{calculatedDuration:n,next:l=>(i.value=a(l),i.done=l>=n,i)}}const GB=2e4;function rre(n){let e=0;const t=50;let r=n.next(e);for(;!r.done&&e<GB;)e+=t,r=n.next(e);return e>=GB?1/0:e}const sre=n=>{const e=({timestamp:t})=>n(t);return{start:()=>dt.update(e,!0),stop:()=>Ui(e),now:()=>En.isProcessing?En.timestamp:Jo.now()}},ire={decay:PB,inertia:PB,tween:s0,keyframes:s0,spring:RB},ore=n=>n/100;class Zx extends SB{constructor({KeyframeResolver:e=jx,...t}){super(t),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:t="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=ire[t]||s0;let l,c;a!==s0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&ji(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),l=zi(ore,$B(e[0],e[1])),e=[0,100]);const u=a({...this.options,keyframes:e});i==="mirror"&&(c=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=rre(u));const{calculatedDuration:f}=u,d=f+s,h=d*(r+1)-s;return{generator:u,mirroredGenerator:c,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,t=!1){const{resolved:r}=this;if(!r){const{keyframes:M}=this.options;return{done:!0,value:M[M.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:c,totalDuration:u,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?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>u;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let A=this.currentTime,w=i;if(h){const M=Math.min(this.currentTime,u)/f;let R=Math.floor(M),O=M%1;!O&&M>=1&&(O=1),O===1&&R--,R=Math.min(R,h+1),!!(R%2)&&(p==="reverse"?(O=1-O,m&&(O-=m/f)):p==="mirror"&&(w=o)),A=Wo(0,1,O)*f}const x=v?{done:!1,value:l[0]}:w.next(A);a&&(x.value=a(x.value));let{done:C}=x;!v&&c!==null&&(C=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return S&&s!==void 0&&(x.value=t0(l,this.options,s)),y&&y(x.value),S&&this.finish(),x}get duration(){const{resolved:e}=this;return e?Gi(e.calculatedDuration):0}get time(){return Gi(this.currentTime)}set time(e){e=$i(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 t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Gi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=sre,onPlay:t}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),t&&t();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 WB=n=>Array.isArray(n)&&typeof n[0]=="number";function KB(n){return!!(!n||typeof n=="string"&&n in eE||WB(n)||Array.isArray(n)&&n.every(KB))}const Ph=([n,e,t,r])=>`cubic-bezier(${n}, ${e}, ${t}, ${r})`,eE={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ph([0,.65,.55,1]),circOut:Ph([.55,0,1,.45]),backIn:Ph([.31,.01,.66,-.59]),backOut:Ph([.33,1.53,.69,.99])};function are(n){return QB(n)||eE.easeOut}function QB(n){if(n)return WB(n)?Ph(n):Array.isArray(n)?n.map(are):eE[n]}function lre(n,e,t,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const c={[e]:t};l&&(c.offset=l);const u=QB(a);return Array.isArray(u)&&(c.easing=u),n.animate(c,{delay:r,duration:s,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const cre=CB(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ure=new Set(["opacity","clipPath","filter","transform"]),i0=10,fre=2e4;function dre(n){return n.type==="spring"||n.name==="backgroundColor"||!KB(n.ease)}function hre(n,e){const t=new Zx({...e,keyframes:n,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:n[0]};const s=[];let i=0;for(;!r.done&&i<fre;)r=t.sample(i),s.push(r.value),i+=i0;return{times:void 0,keyframes:s,duration:i-i0,ease:"linear"}}class JB extends SB{constructor(e){super(e);const{name:t,motionValue:r,keyframes:s}=this.options;this.resolver=new EB(s,(i,o)=>this.onKeyframesResolved(i,o),t,r),this.resolver.scheduleResolve()}initPlayback(e,t){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:l,name:c}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(dre(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=hre(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),s=m.duration,i=m.times,o=m.ease,a="keyframes"}const u=lre(l.owner.current,c,e,{...this.options,duration:s,times:i,ease:o});return u.startTime=Jo.now(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:f}=this.options;l.set(t0(e,this.options,t)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return Gi(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return Gi(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.currentTime=$i(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:t}=this;if(!t)return xn;const{animation:r}=t;r.timeline=e,r.onfinish=null}return xn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.playState==="finished"&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(!(t.playState==="idle"||t.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:c,onComplete:u,...f}=this.options,d=new Zx({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),h=$i(this.time);l.setWithVelocity(d.sample(h-i0).value,d.sample(h).value,i0)}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:t,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return cre()&&r&&ure.has(r)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}function pre(n,e){let t;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;t!==o&&n(o),t=o};return dt.update(r,!0),()=>Ui(r)}const mre=CB(()=>window.ScrollTimeline!==void 0);class gre{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,t){return Promise.all(this.animations).then(e).catch(t)}getAll(e){return this.animations[0][e]}setAll(e,t){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=t}attachTimeline(e){const t=this.animations.map(r=>{if(mre()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),pre(s=>{r.time=r.duration*s},e)});return()=>{t.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 t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const tE=(n,e,t,r={},s,i)=>o=>{const a=Bx(r,n)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-$i(l);let u={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:n,motionValue:e,element:i?void 0:s};Yte(a)||(u={...u,...qte(n,u)}),u.duration&&(u.duration=$i(u.duration)),u.repeatDelay&&(u.repeatDelay=$i(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(f=!0)),f&&!i&&e.get()!==void 0){const d=t0(u.keyframes,a);if(d!==void 0)return dt.update(()=>{u.onUpdate(d),u.onComplete()}),new gre([])}return!i&&JB.supports(u)?new JB(u):new Zx(u)};function o0(n){return!!(Mn(n)&&n.add)}function nE(n,e){n.indexOf(e)===-1&&n.push(e)}function rE(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}class sE{constructor(){this.subscriptions=[]}add(e){return nE(this.subscriptions,e),()=>rE(this.subscriptions,e)}notify(e,t,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,t,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const qB=new Set;function iE(n,e,t){n||qB.has(e)||(console.warn(e),qB.add(e))}const YB=30,yre=n=>!isNaN(parseFloat(n));class bre{constructor(e,t={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Jo.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=t.owner}setCurrent(e){this.current=e,this.updatedAt=Jo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=yre(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&iE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new sE);const r=this.events[e].add(t);return e==="change"?()=>{r(),dt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Jo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>YB)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,YB);return TB(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),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 Dh(n,e){return new bre(n,e)}function wre(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,Dh(t))}function Are(n,e){const t=e0(n,e);let{transitionEnd:r={},transition:s={},...i}=t||{};i={...i,...r};for(const o in i){const a=Tte(i[o]);wre(n,o,a)}}function XB(n){return n.getProps()[CL]}function vre({protectedKeys:n,needsAnimating:e},t){const r=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,r}function ZB(n,e,{delay:t=0,transitionOverride:r,type:s}={}){var i;let{transition:o=n.getDefaultTransition(),transitionEnd:a,...l}=e;const c=n.getValue("willChange");r&&(o=r);const u=[],f=s&&n.animationState&&n.animationState.getState()[s];for(const d in l){const h=n.getValue(d,(i=n.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||f&&vre(f,d))continue;const m={delay:t,elapsed:0,...Bx(o||{},d)};let y=!1;if(window.HandoffAppearAnimations){const v=XB(n);if(v){const A=window.HandoffAppearAnimations(v,d,h,dt);A!==null&&(m.elapsed=A,y=!0)}}h.start(tE(d,h,p,n.shouldReduceMotion&&vl.has(d)?{type:!1}:m,n,y));const b=h.animation;b&&(o0(c)&&(c.add(d),b.then(()=>c.remove(d))),u.push(b))}return a&&Promise.all(u).then(()=>{dt.update(()=>{a&&Are(n,a)})}),u}function oE(n,e,t={}){var r;const s=e0(n,e,t.type==="exit"?(r=n.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=n.getDefaultTransition()||{}}=s||{};t.transitionOverride&&(i=t.transitionOverride);const o=s?()=>Promise.all(ZB(n,s,t)):()=>Promise.resolve(),a=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:d}=i;return xre(n,e,u+c,f,d,t)}:()=>Promise.resolve(),{when:l}=i;if(l){const[c,u]=l==="beforeChildren"?[o,a]:[a,o];return c().then(()=>u())}else return Promise.all([o(),a(t.delay)])}function xre(n,e,t=0,r=0,s=1,i){const o=[],a=(n.variantChildren.size-1)*r,l=s===1?(c=0)=>c*r:(c=0)=>a-c*r;return Array.from(n.variantChildren).sort(Ere).forEach((c,u)=>{c.notify("AnimationStart",e),o.push(oE(c,e,{...i,delay:t+l(u)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function Ere(n,e){return n.sortNodePosition(e)}function Cre(n,e,t={}){n.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>oE(n,i,t));r=Promise.all(s)}else if(typeof e=="string")r=oE(n,e,t);else{const s=typeof e=="function"?e0(n,e,t.custom):e;r=Promise.all(ZB(n,s,t))}return r.then(()=>{dt.postRender(()=>{n.notify("AnimationComplete",e)})})}const kre=[...wx].reverse(),Sre=wx.length;function Tre(n){return e=>Promise.all(e.map(({animation:t,options:r})=>Cre(n,t,r)))}function Ore(n){let e=Tre(n),t=e_(),r=!0;const s=l=>(c,u)=>{var f;const d=e0(n,u,l==="exit"?(f=n.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;c={...c,...m,...p}}return c};function i(l){e=l(n)}function o(l){const c=n.getProps(),u=n.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let y=0;y<Sre;y++){const b=kre[y],v=t[b],A=c[b]!==void 0?c[b]:u[b],w=Eh(A),x=b===l?v.isActive:null;x===!1&&(p=y);let C=A===u[b]&&A!==c[b]&&w;if(C&&r&&n.manuallyAnimateOnMount&&(C=!1),v.protectedKeys={...h},!v.isActive&&x===null||!A&&!v.prevProp||Ky(A)||typeof A=="boolean")continue;let M=Nre(v.prevProp,A)||b===l&&v.isActive&&!C&&w||y>p&&w,R=!1;const O=Array.isArray(A)?A:[A];let D=O.reduce(s(b),{});x===!1&&(D={});const{prevResolvedValues:_={}}=v,F={..._,...D},G=B=>{M=!0,d.has(B)&&(R=!0,d.delete(B)),v.needsAnimating[B]=!0;const V=n.getValue(B);V&&(V.liveStyle=!1)};for(const B in F){const V=D[B],Q=_[B];if(h.hasOwnProperty(B))continue;let ee=!1;Rx(V)&&Rx(Q)?ee=!sB(V,Q):ee=V!==Q,ee?V!=null?G(B):d.add(B):V!==void 0&&d.has(B)?G(B):v.protectedKeys[B]=!0}v.prevProp=A,v.prevResolvedValues=D,v.isActive&&(h={...h,...D}),r&&n.blockInitialAnimation&&(M=!1),M&&(!C||R)&&f.push(...O.map(B=>({animation:B,options:{type:b}})))}if(d.size){const y={};d.forEach(b=>{const v=n.getBaseTarget(b),A=n.getValue(b);A&&(A.liveStyle=!0),y[b]=v??null}),f.push({animation:y})}let m=!!f.length;return r&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,c){var u;if(t[l].isActive===c)return Promise.resolve();(u=n.variantChildren)===null||u===void 0||u.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,c)}),t[l].isActive=c;const f=o(l);for(const d in t)t[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>t,reset:()=>{t=e_(),r=!0}}}function Nre(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!sB(e,n):!1}function Cl(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function e_(){return{animate:Cl(!0),whileInView:Cl(),whileHover:Cl(),whileTap:Cl(),whileDrag:Cl(),whileFocus:Cl(),exit:Cl()}}class Mre extends Qo{constructor(e){super(e),e.animationState||(e.animationState=Ore(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ky(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let Rre=0;class Pre extends Qo{constructor(){super(...arguments),this.id=Rre++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);t&&!e&&s.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Dre={animation:{Feature:Mre},exit:{Feature:Pre}},t_=(n,e)=>Math.abs(n-e);function Ire(n,e){const t=t_(n.x,e.x),r=t_(n.y,e.y);return Math.sqrt(t**2+r**2)}class n_{constructor(e,t,{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=lE(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=Ire(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=En;this.history.push({...p,timestamp:m});const{onStart:y,onMove:b}=this.handlers;d||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=aE(d,this.transformPagePoint),dt.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 y=lE(f.type==="pointercancel"?this.lastMoveEventInfo:aE(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,y),p&&p(f,y)},!qL(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.contextWindow=s||window;const o=Zy(e),a=aE(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=En;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,lE(a,this.history)),this.removeListeners=zi(Hi(this.contextWindow,"pointermove",this.handlePointerMove),Hi(this.contextWindow,"pointerup",this.handlePointerUp),Hi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Ui(this.updatePoint)}}function aE(n,e){return e?{point:e(n.point)}:n}function r_(n,e){return{x:n.x-e.x,y:n.y-e.y}}function lE({point:n},e){return{point:n,delta:r_(n,s_(e)),offset:r_(n,Lre(e)),velocity:Bre(e,.1)}}function Lre(n){return n[0]}function s_(n){return n[n.length-1]}function Bre(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,r=null;const s=s_(n);for(;t>=0&&(r=n[t],!(s.timestamp-r.timestamp>$i(e)));)t--;if(!r)return{x:0,y:0};const i=Gi(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 Or(n){return n.max-n.min}function cE(n,e=0,t=.01){return Math.abs(n-e)<=t}function i_(n,e,t,r=.5){n.origin=r,n.originPoint=Bt(e.min,e.max,n.origin),n.scale=Or(t)/Or(e),(cE(n.scale,1,1e-4)||isNaN(n.scale))&&(n.scale=1),n.translate=Bt(t.min,t.max,n.origin)-n.originPoint,(cE(n.translate)||isNaN(n.translate))&&(n.translate=0)}function Ih(n,e,t,r){i_(n.x,e.x,t.x,r?r.originX:void 0),i_(n.y,e.y,t.y,r?r.originY:void 0)}function o_(n,e,t){n.min=t.min+e.min,n.max=n.min+Or(e)}function _re(n,e,t){o_(n.x,e.x,t.x),o_(n.y,e.y,t.y)}function a_(n,e,t){n.min=e.min-t.min,n.max=n.min+Or(e)}function Lh(n,e,t){a_(n.x,e.x,t.x),a_(n.y,e.y,t.y)}function Fre(n,{min:e,max:t},r){return e!==void 0&&n<e?n=r?Bt(e,n,r.min):Math.max(n,e):t!==void 0&&n>t&&(n=r?Bt(t,n,r.max):Math.min(n,t)),n}function l_(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function jre(n,{top:e,left:t,bottom:r,right:s}){return{x:l_(n.x,t,s),y:l_(n.y,e,r)}}function c_(n,e){let t=e.min-n.min,r=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,r]=[r,t]),{min:t,max:r}}function Ure(n,e){return{x:c_(n.x,e.x),y:c_(n.y,e.y)}}function Vre(n,e){let t=.5;const r=Or(n),s=Or(e);return s>r?t=Rh(e.min,e.max-r,n.min):r>s&&(t=Rh(n.min,n.max-s,e.min)),Wo(0,1,t)}function Hre(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const uE=.35;function zre(n=uE){return n===!1?n=0:n===!0&&(n=uE),{x:u_(n,"left","right"),y:u_(n,"top","bottom")}}function u_(n,e,t){return{min:f_(n,e),max:f_(n,t)}}function f_(n,e){return typeof n=="number"?n:n[e]||0}const d_=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mu=()=>({x:d_(),y:d_()}),h_=()=>({min:0,max:0}),Kt=()=>({x:h_(),y:h_()});function Qr(n){return[n("x"),n("y")]}function p_({top:n,left:e,right:t,bottom:r}){return{x:{min:e,max:t},y:{min:n,max:r}}}function $re({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function Gre(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),r=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:r.y,right:r.x}}function fE(n){return n===void 0||n===1}function dE({scale:n,scaleX:e,scaleY:t}){return!fE(n)||!fE(e)||!fE(t)}function kl(n){return dE(n)||m_(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function m_(n){return g_(n.x)||g_(n.y)}function g_(n){return n&&n!=="0%"}function a0(n,e,t){const r=n-t,s=e*r;return t+s}function y_(n,e,t,r,s){return s!==void 0&&(n=a0(n,s,r)),a0(n,t,r)+e}function hE(n,e=0,t=1,r,s){n.min=y_(n.min,e,t,r,s),n.max=y_(n.max,e,t,r,s)}function b_(n,{x:e,y:t}){hE(n.x,e.translate,e.scale,e.originPoint),hE(n.y,t.translate,t.scale,t.originPoint)}function Wre(n,e,t,r=!1){const s=t.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=t[a],o=i.projectionDelta;const l=i.instance;l&&l.style&&l.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Ru(n,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,b_(n,o)),r&&kl(i.latestValues)&&Ru(n,i.latestValues))}e.x=w_(e.x),e.y=w_(e.y)}function w_(n){return Number.isInteger(n)||n>1.0000000000001||n<.999999999999?n:1}function Yo(n,e){n.min=n.min+e,n.max=n.max+e}function A_(n,e,[t,r,s]){const i=e[s]!==void 0?e[s]:.5,o=Bt(n.min,n.max,i);hE(n,e[t],e[r],o,e.scale)}const Kre=["x","scaleX","originX"],Qre=["y","scaleY","originY"];function Ru(n,e){A_(n.x,e,Kre),A_(n.y,e,Qre)}function v_(n,e){return p_(Gre(n.getBoundingClientRect(),e))}function Jre(n,e,t){const r=v_(n,t),{scroll:s}=e;return s&&(Yo(r.x,s.offset.x),Yo(r.y,s.offset.y)),r}const x_=({current:n})=>n?n.ownerDocument.defaultView:null,qre=new WeakMap;class Yre{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:t=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=u=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(Zy(u,"page").point)},i=(u,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=eB(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),Qr(y=>{let b=this.getAxisMotionValue(y).get()||0;if(ti.test(b)){const{projection:v}=this.visualElement;if(v&&v.layout){const A=v.layout.layoutBox[y];A&&(b=Or(A)*(parseFloat(b)/100))}}this.originPoint[y]=b}),p&&dt.postRender(()=>p(u,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(u,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:y}=f;if(h&&this.currentDirection===null){this.currentDirection=Xre(y),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),m&&m(u,f)},a=(u,f)=>this.stop(u,f),l=()=>Qr(u=>{var f;return this.getAnimationState(u)==="paused"&&((f=this.getAxisMotionValue(u).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new n_(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:x_(this.visualElement)})}stop(e,t){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=t;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&dt.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=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),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,r){const{drag:s}=this.getProps();if(!r||!l0(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=Fre(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:t,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;t&&Cu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=jre(s.layoutBox,t):this.constraints=!1,this.elastic=zre(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Qr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Hre(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Cu(e))return!1;const r=e.current;ji(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=Jre(r,s.root,this.visualElement.getTransformPagePoint());let o=Ure(s.layout.layoutBox,i);if(t){const a=t($re(o));this.hasMutatedConstraints=!!a,a&&(o=p_(a))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Qr(u=>{if(!l0(u,t,this.currentDirection))return;let f=l&&l[u]||{};o&&(f={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?e[u]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return r.start(tE(e,r,0,t,this.visualElement))}stopAnimation(){Qr(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Qr(e=>{var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[t];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Qr(t=>{const{drag:r}=this.getProps();if(!l0(t,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(t);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[t];i.set(e[t]-Bt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!Cu(t)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Qr(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=Vre({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(),Qr(o=>{if(!l0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(Bt(l,c,s[o]))})}addListeners(){if(!this.visualElement.current)return;qre.set(this.visualElement,this);const e=this.visualElement.current,t=Hi(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps();c&&u&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Cu(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()),dt.read(r);const o=Vi(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(Qr(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=l[u].translate,f.set(f.get()+l[u].translate))}),this.visualElement.render())});return()=>{o(),t(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=uE,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function l0(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function Xre(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class Zre extends Qo{constructor(e){super(e),this.removeGroupControls=xn,this.removeListeners=xn,this.controls=new Yre(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xn}unmount(){this.removeGroupControls(),this.removeListeners()}}const E_=n=>(e,t)=>{n&&dt.postRender(()=>n(e,t))};class ese extends Qo{constructor(){super(...arguments),this.removePointerDownListener=xn}onPointerDown(e){this.session=new n_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:x_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:E_(e),onStart:E_(t),onMove:r,onEnd:(i,o)=>{delete this.session,s&&dt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Hi(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 tse(){const n=P.useContext(Gy);if(n===null)return[!0,null];const{isPresent:e,onExitComplete:t,register:r}=n,s=P.useId();return P.useEffect(()=>r(s),[]),!e&&t?[!1,()=>t&&t(s)]:[!0]}const c0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function C_(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Bh={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(Le.test(n))n=parseFloat(n);else return n;const t=C_(n,e.target.x),r=C_(n,e.target.y);return`${t}% ${r}%`}},nse={correct:(n,{treeScale:e,projectionDelta:t})=>{const r=n,s=qo.parse(n);if(s.length>5)return r;const i=qo.createTransformer(n),o=typeof s[0]!="number"?1:0,a=t.x.scale*e.x,l=t.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const c=Bt(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),i(s)}};class rse extends P.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;rte(sse),i&&(t.group&&t.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()})),c0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==t||t===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||dt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),bx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function k_(n){const[e,t]=tse(),r=P.useContext(vx);return k.jsx(rse,{...n,layoutGroup:r,switchLayoutGroup:P.useContext(TL),isPresent:e,safeToRemove:t})}const sse={borderRadius:{...Bh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Bh,borderTopRightRadius:Bh,borderBottomLeftRadius:Bh,borderBottomRightRadius:Bh,boxShadow:nse},S_=["TopLeft","TopRight","BottomLeft","BottomRight"],ise=S_.length,T_=n=>typeof n=="string"?parseFloat(n):n,O_=n=>typeof n=="number"||Le.test(n);function ose(n,e,t,r,s,i){s?(n.opacity=Bt(0,t.opacity!==void 0?t.opacity:1,ase(r)),n.opacityExit=Bt(e.opacity!==void 0?e.opacity:1,0,lse(r))):i&&(n.opacity=Bt(e.opacity!==void 0?e.opacity:1,t.opacity!==void 0?t.opacity:1,r));for(let o=0;o<ise;o++){const a=`border${S_[o]}Radius`;let l=N_(e,a),c=N_(t,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||O_(l)===O_(c)?(n[a]=Math.max(Bt(T_(l),T_(c),r),0),(ti.test(c)||ti.test(l))&&(n[a]+="%")):n[a]=c}(e.rotate||t.rotate)&&(n.rotate=Bt(e.rotate||0,t.rotate||0,r))}function N_(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const ase=M_(0,.5,_B),lse=M_(.5,.95,xn);function M_(n,e,t){return r=>r<n?0:r>e?1:t(Rh(n,e,r))}function R_(n,e){n.min=e.min,n.max=e.max}function Jr(n,e){R_(n.x,e.x),R_(n.y,e.y)}function P_(n,e,t,r,s){return n-=e,n=a0(n,1/t,r),s!==void 0&&(n=a0(n,1/s,r)),n}function cse(n,e=0,t=1,r=.5,s,i=n,o=n){if(ti.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);n===i&&(a-=e),n.min=P_(n.min,e,t,a,s),n.max=P_(n.max,e,t,a,s)}function D_(n,e,[t,r,s],i,o){cse(n,e[t],e[r],e[s],e.scale,i,o)}const use=["x","scaleX","originX"],fse=["y","scaleY","originY"];function I_(n,e,t,r){D_(n.x,e,use,t?t.x:void 0,r?r.x:void 0),D_(n.y,e,fse,t?t.y:void 0,r?r.y:void 0)}function L_(n){return n.translate===0&&n.scale===1}function B_(n){return L_(n.x)&&L_(n.y)}function dse(n,e){return n.x.min===e.x.min&&n.x.max===e.x.max&&n.y.min===e.y.min&&n.y.max===e.y.max}function __(n,e){return Math.round(n.x.min)===Math.round(e.x.min)&&Math.round(n.x.max)===Math.round(e.x.max)&&Math.round(n.y.min)===Math.round(e.y.min)&&Math.round(n.y.max)===Math.round(e.y.max)}function F_(n){return Or(n.x)/Or(n.y)}class hse{constructor(){this.members=[]}add(e){nE(this.members,e),e.scheduleRender()}remove(e){if(rE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(s=>e===s);if(t===0)return!1;let r;for(let s=t;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,t){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,t&&(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:t,resumingFrom:r}=e;t.onExitComplete&&t.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 j_(n,e,t){let r="";const s=n.x.translate/e.x,i=n.y.translate/e.y,o=(t==null?void 0:t.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}) `),t){const{transformPerspective:c,rotate:u,rotateX:f,rotateY:d,skewX:h,skewY:p}=t;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=n.x.scale*e.x,l=n.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const pse=(n,e)=>n.depth-e.depth;class mse{constructor(){this.children=[],this.isDirty=!1}add(e){nE(this.children,e),this.isDirty=!0}remove(e){rE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(pse),this.isDirty=!1,this.children.forEach(e)}}function gse(n,e){const t=Jo.now(),r=({timestamp:s})=>{const i=s-t;i>=e&&(Ui(r),n(i-e))};return dt.read(r,!0),()=>Ui(r)}function yse(n){window.MotionDebug&&window.MotionDebug.record(n)}function bse(n){return n instanceof SVGElement&&n.tagName!=="svg"}function wse(n,e,t){const r=Mn(n)?n:Dh(n);return r.start(tE("",r,e,t)),r.animation}const pE=["","X","Y","Z"],Ase={visibility:"hidden"},U_=1e3;let vse=0;const Sl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function mE(n,e,t,r){const{latestValues:s}=e;s[n]&&(t[n]=s[n],e.setStaticValue(n,0),r&&(r[n]=0))}function V_(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return!1;const{visualElement:e}=n.options;return e?XB(e)?!0:n.parent&&!n.parent.hasCheckedOptimisedAppear?V_(n.parent):!1:!1}function H_({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=vse++,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,Sl.totalNodes=Sl.resolvedTargetDeltas=Sl.recalculatedProjection=0,this.nodes.forEach(Cse),this.nodes.forEach(Nse),this.nodes.forEach(Mse),this.nodes.forEach(kse),yse(Sl)},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 mse)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new sE),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=bse(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(c||l)&&(this.isLayoutDirty=!0),n){let f;const d=()=>this.root.updateBlockedByResize=!1;n(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=gse(d,250),c0.hasAnimatedSinceResize&&(c0.hasAnimatedSinceResize=!1,this.nodes.forEach($_))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&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||u.getDefaultTransition()||Lse,{onLayoutAnimationStart:y,onLayoutAnimationComplete:b}=u.getProps(),v=!this.targetLayout||!__(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={...Bx(m,"layout"),onPlay:y,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else d||$_(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,Ui(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(Rse),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&&V_(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];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 c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(z_);return}this.isUpdating||this.nodes.forEach(Tse),this.isUpdating=!1,this.nodes.forEach(Ose),this.nodes.forEach(xse),this.nodes.forEach(Ese),this.clearAllSnapshots();const a=Jo.now();En.delta=Wo(0,1e3/60,a-En.timestamp),En.timestamp=a,En.isProcessing=!0,Px.update.process(En),Px.preRender.process(En),Px.render.process(En),En.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Sse),this.sharedNodes.forEach(Pse)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,dt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){dt.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:t(this.instance)})}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!B_(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&(a||kl(this.latestValues)||u)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),Bse(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&&(Yo(a.x,l.offset.x),Yo(a.y,l.offset.y)),a}removeElementScroll(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:f}=c;if(c!==this.root&&u&&f.layoutScroll){if(u.isRoot){Jr(a,o);const{scroll:d}=this.root;d&&(Yo(a.x,-d.offset.x),Yo(a.y,-d.offset.y))}Yo(a.x,u.offset.x),Yo(a.y,u.offset.y)}}return a}applyTransform(o,a=!1){const l=Kt();Jr(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Ru(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),kl(u.latestValues)&&Ru(l,u.latestValues)}return kl(this.latestValues)&&Ru(l,this.latestValues),l}removeTransform(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!c.instance||!kl(c.latestValues))continue;dE(c.latestValues)&&c.updateSnapshot();const u=Kt(),f=c.measurePageBox();Jr(u,f),I_(a,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,u)}return kl(this.latestValues)&&I_(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!==En.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 c=!!this.resumingFrom||this!==l;if(!(o||c&&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=En.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(),Lh(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),Jr(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(),_re(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Jr(this.target,this.layout.layoutBox),b_(this.target,this.targetDelta)):Jr(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(),Lh(this.relativeTargetOrigin,this.target,h.target),Jr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Sl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||dE(this.parent.latestValues)||m_(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 c=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===En.timestamp&&(c=!1),c)return;const{layout:u,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||!(u||f))return;Jr(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;Wre(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=Mu(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=Mu(),this.projectionDeltaWithTransform=Mu());const m=this.projectionTransform;Ih(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=j_(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),Sl.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,c=l?l.latestValues:{},u={...this.latestValues},f=Mu();(!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,y=this.getStack(),b=!y||y.members.length<=1,v=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(Ise));this.animationProgress=0;let A;this.mixTargetDelta=w=>{const x=w/1e3;G_(f.x,o.x,x),G_(f.y,o.y,x),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Lh(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Dse(this.relativeTarget,this.relativeTargetOrigin,d,x),A&&dse(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Kt()),Jr(A,this.relativeTarget)),m&&(this.animationValues=u,ose(u,c,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&&(Ui(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=dt.update(()=>{c0.hasAnimatedSinceResize=!0,this.currentAnimation=wse(0,U_,{...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(U_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&q_(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Kt();const f=Or(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=Or(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}Jr(a,l),Ru(a,u),Ih(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new hse),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}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 c={};l.z&&mE("z",o,c,this.animationValues);for(let u=0;u<pE.length;u++)mE(`rotate${pE[u]}`,o,c,this.animationValues),mE(`skew${pE[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Ase;const c={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,c.opacity="",c.pointerEvents=Xy(o==null?void 0:o.pointerEvents)||"",c.transform=u?u(this.latestValues,""):"none",c;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=Xy(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!kl(this.latestValues)&&(m.transform=u?u({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),c.transform=j_(this.projectionDeltaWithTransform,this.treeScale,d),u&&(c.transform=u(d,c.transform));const{x:h,y:p}=this.projectionDelta;c.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?c.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:c.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in Jy){if(d[m]===void 0)continue;const{correct:y,applyTo:b}=Jy[m],v=c.transform==="none"?d[m]:y(d[m],f);if(b){const A=b.length;for(let w=0;w<A;w++)c[b[w]]=v}else c[m]=v}return this.options.layoutId&&(c.pointerEvents=f===this?Xy(o==null?void 0:o.pointerEvents)||"":"none"),c}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(z_),this.root.sharedNodes.clear()}}}function xse(n){n.updateLayout()}function Ese(n){var e;const t=((e=n.resumeFrom)===null||e===void 0?void 0:e.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=n.layout,{animationType:i}=n.options,o=t.source!==n.layout.source;i==="size"?Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(d);d.min=r[f].min,d.max=d.min+h}):q_(i,t.layoutBox,r)&&Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(r[f]);d.max=d.min+h,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[f].max=n.relativeTarget[f].min+h)});const a=Mu();Ih(a,r,t.layoutBox);const l=Mu();o?Ih(l,n.applyTransform(s,!0),t.measuredBox):Ih(l,r,t.layoutBox);const c=!B_(a);let u=!1;if(!n.resumeFrom){const f=n.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=Kt();Lh(p,t.layoutBox,d.layoutBox);const m=Kt();Lh(m,r,h.layoutBox),__(p,m)||(u=!0),f.options.layoutRoot&&(n.relativeTarget=m,n.relativeTargetOrigin=p,n.relativeParent=f)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:u})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function Cse(n){Sl.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function kse(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function Sse(n){n.clearSnapshot()}function z_(n){n.clearMeasurements()}function Tse(n){n.isLayoutDirty=!1}function Ose(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function $_(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function Nse(n){n.resolveTargetDelta()}function Mse(n){n.calcProjection()}function Rse(n){n.resetSkewAndRotation()}function Pse(n){n.removeLeadSnapshot()}function G_(n,e,t){n.translate=Bt(e.translate,0,t),n.scale=Bt(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function W_(n,e,t,r){n.min=Bt(e.min,t.min,r),n.max=Bt(e.max,t.max,r)}function Dse(n,e,t,r){W_(n.x,e.x,t.x,r),W_(n.y,e.y,t.y,r)}function Ise(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Lse={duration:.45,ease:[.4,0,.1,1]},K_=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),Q_=K_("applewebkit/")&&!K_("chrome/")?Math.round:xn;function J_(n){n.min=Q_(n.min),n.max=Q_(n.max)}function Bse(n){J_(n.x),J_(n.y)}function q_(n,e,t){return n==="position"||n==="preserve-aspect"&&!cE(F_(e),F_(t),.2)}const _se=H_({attachResizeListener:(n,e)=>Vi(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),gE={current:void 0},Y_=H_({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!gE.current){const n=new _se({});n.mount(window),n.setOptions({layoutScroll:!0}),gE.current=n}return gE.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Fse={pan:{Feature:ese},drag:{Feature:Zre,ProjectionNode:Y_,MeasureLayout:k_}},yE={current:null},X_={current:!1};function jse(){if(X_.current=!0,!!mx)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>yE.current=n.matches;n.addListener(e),e()}else yE.current=!1}function Use(n,e,t){const{willChange:r}=e;for(const s in e){const i=e[s],o=t[s];if(Mn(i))n.addValue(s,i),o0(r)&&r.add(s),process.env.NODE_ENV==="development"&&iE(i.version==="11.2.12",`Attempting to mix Framer Motion versions ${i.version} with 11.2.12 may not work as expected.`);else if(Mn(o))n.addValue(s,Dh(i,{owner:n})),o0(r)&&r.remove(s);else if(o!==i)if(n.hasValue(s)){const a=n.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=n.getStaticValue(s);n.addValue(s,Dh(a!==void 0?a:i,{owner:n}))}}for(const s in t)e[s]===void 0&&n.removeValue(s);return e}const Z_=new WeakMap,Vse=[...dB,Rn,qo],Hse=n=>Vse.find(fB(n)),eF=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],zse=Ax.length;class $se{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,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=jx,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=()=>dt.render(this.render,!1,!0);const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Qy(t),this.isVariantNode=ML(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(t,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&Mn(h)&&(h.set(l[d],!1),o0(u)&&u.add(d))}}mount(e){this.current=e,Z_.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((t,r)=>this.bindToMotionValue(r,t)),X_.current||jse(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yE.current,process.env.NODE_ENV!=="production"&&iE(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(){Z_.delete(this.current),this.projection&&this.projection.unmount(),Ui(this.notifyUpdate),Ui(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 t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){const r=vl.has(e),s=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&dt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{s(),i(),t.owner&&t.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 ku){const t=ku[e];if(!t)continue;const{isEnabled:r,Feature:s}=t;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,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<eF.length;r++){const s=eF[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=Use(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 t={};for(let r=0;r<zse;r++){const s=Ax[r],i=this.props[s];(Eh(i)||i===!1)&&(t[s]=i)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=Dh(t===null?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){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"&&(oB(s)||iB(s))?s=parseFloat(s):!Hse(s)&&qo.test(t)&&(s=xB(e,t)),this.setBaseTarget(e,Mn(s)?s.get():s)),Mn(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=Mx(this.props,r,(t=this.presenceContext)===null||t===void 0?void 0:t.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Mn(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new sE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class tF extends $se{constructor(){super(...arguments),this.KeyframeResolver=EB}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}}function Gse(n){return window.getComputedStyle(n)}class Wse extends tF{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,t){if(vl.has(t)){const r=$x(t);return r&&r.default||0}else{const r=Gse(e),s=(LL(t)?r.getPropertyValue(t):r[t])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return v_(e,t)}build(e,t,r,s){kx(e,t,r,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return Nx(e,t,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Mn(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}renderInstance(e,t,r,s){zL(e,t,r,s)}}class Kse extends tF{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(vl.has(t)){const r=$x(t);return r&&r.default||0}return t=$L.has(t)?t:yx(t),e.getAttribute(t)}measureInstanceViewportBox(){return Kt()}scrapeMotionValuesFromProps(e,t,r){return WL(e,t,r)}build(e,t,r,s){Tx(e,t,r,this.isSVGTag,s.transformTemplate)}renderInstance(e,t,r,s){GL(e,t,r,s)}mount(e){this.isSVGTag=Ox(e.tagName),super.mount(e)}}const Qse=(n,e)=>xx(n)?new Kse(e,{enableHardwareAcceleration:!1}):new Wse(e,{allowProjection:n!==P.Fragment,enableHardwareAcceleration:!0}),Jse={...Dre,...Gte,...Fse,...{layout:{ProjectionNode:Y_,MeasureLayout:k_}}},qse=tte((n,e)=>Pte(n,e,Jse,Qse));function nF(){const n=P.useRef(!1);return gx(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function Yse(){const n=nF(),[e,t]=P.useState(0),r=P.useCallback(()=>{n.current&&t(e+1)},[e]);return[P.useCallback(()=>dt.postRender(r),[r]),e]}class Xse extends H.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Zse({children:n,isPresent:e}){const t=P.useId(),r=P.useRef(null),s=P.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=P.useContext(px);return P.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:c}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=t;const u=document.createElement("style");return i&&(u.nonce=i),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(`
|
453
453
|
[data-motion-pop-id="${t}"] {
|
454
454
|
position: absolute !important;
|
455
455
|
width: ${o}px !important;
|